From owner-svn-src-stable-11@freebsd.org Sun Apr 1 16:42:14 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 626D1F6C608; Sun, 1 Apr 2018 16:42:14 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 150F673E76; Sun, 1 Apr 2018 16:42:14 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0F9B3175E; Sun, 1 Apr 2018 16:42:14 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w31GgDXf037411; Sun, 1 Apr 2018 16:42:13 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w31GgDXV037410; Sun, 1 Apr 2018 16:42:13 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201804011642.w31GgDXV037410@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 1 Apr 2018 16:42:13 +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: r331866 - stable/11/sys/x86/x86 X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sys/x86/x86 X-SVN-Commit-Revision: 331866 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Apr 2018 16:42:14 -0000 Author: markj Date: Sun Apr 1 16:42:13 2018 New Revision: 331866 URL: https://svnweb.freebsd.org/changeset/base/331866 Log: MFC r317567 (by cem): x86 MCA: Fix a deadlock in MCA exception processing Modified: stable/11/sys/x86/x86/mca.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/x86/x86/mca.c ============================================================================== --- stable/11/sys/x86/x86/mca.c Sun Apr 1 07:49:48 2018 (r331865) +++ stable/11/sys/x86/x86/mca.c Sun Apr 1 16:42:13 2018 (r331866) @@ -653,7 +653,7 @@ amd_thresholding_update(enum scan_mode mode, int bank, * count of the number of valid MC records found. */ static int -mca_scan(enum scan_mode mode) +mca_scan(enum scan_mode mode, int *recoverablep) { struct mca_record rec; uint64_t mcg_cap, ucmask; @@ -704,7 +704,9 @@ mca_scan(enum scan_mode mode) } if (mode == POLLED) mca_fill_freelist(); - return (mode == MCE ? recoverable : count); + if (recoverablep != NULL) + *recoverablep = recoverable; + return (count); } /* @@ -726,7 +728,7 @@ mca_scan_cpus(void *context, int pending) CPU_FOREACH(cpu) { sched_bind(td, cpu); thread_unlock(td); - count += mca_scan(POLLED); + count += mca_scan(POLLED, NULL); thread_lock(td); sched_unbind(td); } @@ -1150,7 +1152,7 @@ void mca_intr(void) { uint64_t mcg_status; - int old_count, recoverable; + int recoverable, count; if (!(cpu_feature & CPUID_MCA)) { /* @@ -1164,20 +1166,18 @@ mca_intr(void) } /* Scan the banks and check for any non-recoverable errors. */ - old_count = mca_count; - recoverable = mca_scan(MCE); + count = mca_scan(MCE, &recoverable); mcg_status = rdmsr(MSR_MCG_STATUS); if (!(mcg_status & MCG_STATUS_RIPV)) recoverable = 0; if (!recoverable) { /* - * Wait for at least one error to be logged before - * panic'ing. Some errors will assert a machine check - * on all CPUs, but only certain CPUs will find a valid - * bank to log. + * Only panic if the error was detected local to this CPU. + * Some errors will assert a machine check on all CPUs, but + * only certain CPUs will find a valid bank to log. */ - while (mca_count == old_count) + while (count == 0) cpu_spinwait(); panic("Unrecoverable machine check exception"); @@ -1199,7 +1199,7 @@ cmc_intr(void) * Serialize MCA bank scanning to prevent collisions from * sibling threads. */ - count = mca_scan(CMCI); + count = mca_scan(CMCI, NULL); /* If we found anything, log them to the console. */ if (count != 0) { From owner-svn-src-stable-11@freebsd.org Sun Apr 1 16:43:31 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B865F6C893; Sun, 1 Apr 2018 16:43:31 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 014FE74035; Sun, 1 Apr 2018 16:43:31 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F06A5177A; Sun, 1 Apr 2018 16:43:30 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w31GhU2J037513; Sun, 1 Apr 2018 16:43:30 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w31GhU3h037512; Sun, 1 Apr 2018 16:43:30 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201804011643.w31GhU3h037512@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 1 Apr 2018 16:43: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: r331867 - stable/11/sys/netsmb X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sys/netsmb X-SVN-Commit-Revision: 331867 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Apr 2018 16:43:31 -0000 Author: markj Date: Sun Apr 1 16:43:30 2018 New Revision: 331867 URL: https://svnweb.freebsd.org/changeset/base/331867 Log: MFC r324102 (by cem): netsmb: Fix buggy/racy smb_strdupin() PR: 222687 Modified: stable/11/sys/netsmb/smb_subr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netsmb/smb_subr.c ============================================================================== --- stable/11/sys/netsmb/smb_subr.c Sun Apr 1 16:42:13 2018 (r331866) +++ stable/11/sys/netsmb/smb_subr.c Sun Apr 1 16:43:30 2018 (r331867) @@ -110,22 +110,11 @@ smb_strdup(const char *s) char * smb_strdupin(char *s, size_t maxlen) { - char *p, bt; + char *p; int error; - size_t len; - len = 0; - for (p = s; ;p++) { - if (copyin(p, &bt, 1)) - return NULL; - len++; - if (maxlen && len > maxlen) - return NULL; - if (bt == 0) - break; - } - p = malloc(len, M_SMBSTR, M_WAITOK); - error = copyin(s, p, len); + p = malloc(maxlen + 1, M_SMBSTR, M_WAITOK); + error = copyinstr(s, p, maxlen + 1, NULL); if (error) { free(p, M_SMBSTR); return (NULL); From owner-svn-src-stable-11@freebsd.org Sun Apr 1 22:59:54 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 42B39F81C9C; Sun, 1 Apr 2018 22:59:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E057182164; Sun, 1 Apr 2018 22:59:53 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BAE7A57C7; Sun, 1 Apr 2018 22:59:53 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w31MxrYL024057; Sun, 1 Apr 2018 22:59:53 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w31MxrCX024055; Sun, 1 Apr 2018 22:59:53 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201804012259.w31MxrCX024055@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 1 Apr 2018 22:59: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: r331870 - stable/11/sys/dev/ispfw X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/ispfw X-SVN-Commit-Revision: 331870 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Apr 2018 22:59:54 -0000 Author: mav Date: Sun Apr 1 22:59:53 2018 New Revision: 331870 URL: https://svnweb.freebsd.org/changeset/base/331870 Log: MFC r330292: Update QLogic ISP 24xx/25xx chips firmware to 8.07.00. Modified: stable/11/sys/dev/ispfw/asm_2400.h stable/11/sys/dev/ispfw/asm_2500.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ispfw/asm_2400.h ============================================================================== --- stable/11/sys/dev/ispfw/asm_2400.h Sun Apr 1 18:53:27 2018 (r331869) +++ stable/11/sys/dev/ispfw/asm_2400.h Sun Apr 1 22:59:53 2018 (r331870) @@ -25,23 +25,23 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* - * Firmware Version 7.03.00 (Apr 14, 2014) + * Firmware Version 8.07.00 (2017) */ #ifdef ISP_2400 static const uint32_t isp_2400_risc_code[] = { - 0x0401f195, 0x00112000, 0x00100000, 0x0000c798, - 0x00000007, 0x00000003, 0x00000000, 0x00009496, + 0x0401f1be, 0x00112000, 0x00100000, 0x0000c79b, + 0x00000008, 0x00000007, 0x00000000, 0x00009496, 0x00000003, 0x00000000, 0x20434f50, 0x59524947, - 0x48542032, 0x30303720, 0x514c4f47, 0x49432043, + 0x48542032, 0x30313720, 0x514c4f47, 0x49432043, 0x4f52504f, 0x52415449, 0x4f4e2020, 0x20495350, 0x32347878, 0x20466972, 0x6d776172, 0x65202020, - 0x56657273, 0x696f6e20, 0x2020372e, 0x30332e30, + 0x56657273, 0x696f6e20, 0x2020382e, 0x30372e30, 0x30202024, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x42001800, 0x0010014c, 0x42002000, 0x0010e36f, + 0x42001800, 0x0010014c, 0x42002000, 0x0010e377, 0x500c0800, 0x800c1800, 0x500c1000, 0x800c1800, 0x54042000, 0x80102000, 0x80040800, 0x80081040, 0x040207fc, 0x500c0800, 0x800409c0, 0x040207f6, @@ -124,759 +124,771 @@ static const uint32_t isp_2400_risc_code[] = { 0x00006150, 0x00000010, 0x00006170, 0x00000010, 0x00006190, 0x00000010, 0x000061b0, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00100000, 0x00100000, 0x0000c798, - 0xffffffff, 0x00112004, 0x00020000, 0x00000c50, - 0xffffffff, 0x00112c54, 0x0010fd00, 0x00001b58, - 0xffffffff, 0x001147ac, 0x0000c000, 0x000008b1, - 0x00ffffff, 0x0011505d, 0x00008000, 0x00000696, + 0x00000000, 0x00100000, 0x00100000, 0x0000c79b, + 0xffffffff, 0x00112004, 0x00020000, 0x00001083, + 0xffffffff, 0x00113087, 0x0010fd00, 0x00001b72, + 0xffffffff, 0x00114bf9, 0x0000c000, 0x000008e2, + 0x00ffffff, 0x001154db, 0x00008000, 0x0000069e, 0x00ffffff, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x4203f000, 0x00021fff, 0x40000000, - 0x4203e000, 0x90000100, 0x40000000, 0x42000800, - 0x00020c51, 0x4202f000, 0x00000000, 0x42000000, - 0x00007023, 0x50000000, 0x8c000500, 0x04020003, - 0x42000800, 0x00020000, 0x45780800, 0x80040800, - 0x82040580, 0x00022000, 0x040207fc, 0x4178a000, - 0x4200a800, 0x0010c798, 0x42000800, 0x0010fd00, - 0x40540000, 0x8004b480, 0x0201f800, 0x0010c5e6, - 0x0401fade, 0x0401fa0a, 0x4803c856, 0x42000000, - 0x00001000, 0x50000000, 0x82000480, 0x24320002, - 0x0402000d, 0x0201f800, 0x0010c62d, 0x04000008, - 0x42000800, 0x00007a17, 0x50040000, 0x8c00050e, - 0x04020003, 0x8400054e, 0x44000800, 0x4a030000, - 0x00000000, 0x4a03c020, 0x00000004, 0x4203e000, - 0x6000000f, 0x4a0370e8, 0x00000003, 0x4a0378e8, - 0x00000003, 0x59e00023, 0x8c000500, 0x04020027, - 0x42002800, 0x0010017d, 0x58140800, 0x4817c857, - 0x4807c857, 0x800409c0, 0x0400000b, 0x58142002, - 0x4813c857, 0x58141003, 0x4c140000, 0x0401faaa, - 0x5c002800, 0x0402002a, 0x82142c00, 0x00000004, - 0x0401f7f2, 0x42002800, 0x0010017d, 0x5814a000, - 0x4817c857, 0x4853c857, 0x8050a1c0, 0x0400000f, - 0x4c140000, 0x5814a801, 0x4857c857, 0x40500000, - 0x80540480, 0x04000005, 0x5814b002, 0x485bc857, - 0x0201f800, 0x0010c5dd, 0x5c002800, 0x82142c00, - 0x00000004, 0x0401f7ee, 0x42002800, 0x0010017d, - 0x58140801, 0x4817c857, 0x4807c857, 0x800409c0, - 0x04000018, 0x58142002, 0x4813c857, 0x58141003, - 0x4c140000, 0x0401fa84, 0x04020005, 0x5c002800, - 0x82142c00, 0x00000004, 0x0401f7f2, 0x4803c856, - 0x4a03c020, 0x00004010, 0x4a03c011, 0x40100011, - 0x04006000, 0x4203e000, 0x40000000, 0x4a03c017, - 0x00000000, 0x4203e000, 0x30000001, 0x0401f000, - 0x4803c856, 0x0201f800, 0x0010fd04, 0x0401fb0b, - 0x4a03c014, 0x001c001c, 0x42002000, 0x00111858, - 0x0201f800, 0x0010c5ee, 0x42000000, 0x00001000, - 0x50000000, 0x82000480, 0x24220001, 0x04000908, + 0x00000000, 0x00000006, 0x00000009, 0x0000000c, + 0x0000000f, 0x00000012, 0x00000000, 0x00000000, + 0x0000000c, 0x00000000, 0x00000000, 0x00000000, + 0x00100199, 0x00100198, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00100199, 0x00100198, + 0x00100195, 0x00100199, 0x00100198, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00100199, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00100199, 0x00100199, + 0x00100199, 0x00000000, 0x00100199, 0x00000000, + 0x00000000, 0x00000000, 0x4203f000, 0x00021fff, + 0x40000000, 0x4203e000, 0x90000100, 0x40000000, + 0x42000800, 0x00021084, 0x4202f000, 0x00000000, + 0x42000000, 0x00007023, 0x50000000, 0x8c000500, + 0x04020003, 0x42000800, 0x00020000, 0x45780800, + 0x80040800, 0x82040580, 0x00022000, 0x040207fc, + 0x4178a000, 0x4200a800, 0x0010c79b, 0x42000800, + 0x0010fd00, 0x40540000, 0x8004b480, 0x0201f800, + 0x0010c5e7, 0x0401fadb, 0x0401fa14, 0x4803c856, 0x42000000, 0x00001000, 0x50000000, 0x82000480, - 0x24320001, 0x04000902, 0x59c40000, 0x82000500, - 0xffff0000, 0x80000120, 0x82000580, 0x00002422, - 0x04020005, 0x59a8007e, 0x84000540, 0x4803507e, - 0x0401f00a, 0x59e00003, 0x82000500, 0x00030000, - 0x82000580, 0x00010000, 0x04020004, 0x59a8007e, - 0x84000542, 0x4803507e, 0x4c140000, 0x0201f800, - 0x0010bd98, 0x5c002800, 0x42000800, 0x00001100, - 0x42001800, 0x00000100, 0x82141480, 0x0017ffff, - 0x0402100d, 0x42000800, 0x00000900, 0x82141480, - 0x0013ffff, 0x04021008, 0x42000800, 0x00000240, - 0x42001800, 0x00000040, 0x82141480, 0x0011ffff, - 0x040018d7, 0x48075013, 0x480f5257, 0x42001000, - 0x0000002c, 0x0201f800, 0x00106fe1, 0x82040c00, - 0x00111d44, 0x4807500b, 0x4a03c810, 0x00100000, - 0x4a03c811, 0x0010c798, 0x4a03c812, 0x0010fd00, - 0x4a03c813, 0x00111857, 0x4a03c829, 0x00000004, - 0x59e40001, 0x82000540, 0x0003403f, 0x4803c801, - 0x42001000, 0x0000001c, 0x0401f9fa, 0x4202c000, - 0x00111d44, 0x59aab00b, 0x59aaa00b, 0x59aaa80b, - 0x59aac813, 0x49675056, 0x59a8000b, 0x4803500c, - 0x0401fadd, 0x0201f800, 0x00108242, 0x0401faed, - 0x0401fb3d, 0x0201f800, 0x00101ab2, 0x0201f800, - 0x0010133c, 0x0201f800, 0x00100691, 0x0201f800, - 0x00100d6b, 0x0201f800, 0x00107023, 0x0401f85c, - 0x0201f800, 0x001022a6, 0x0201f800, 0x0010576d, - 0x0201f800, 0x00104f33, 0x0201f800, 0x00106abc, - 0x0201f800, 0x001067bd, 0x0201f800, 0x001013e1, - 0x0201f800, 0x00101243, 0x4203e000, 0xf0000001, - 0x0201f800, 0x0010c72c, 0x4a03c018, 0x00000000, - 0x4203e000, 0x20000511, 0x4203e000, 0x50010000, - 0x4a03c020, 0x00000000, 0x04027010, 0x59e00020, - 0x82000580, 0x00000002, 0x0402000c, 0x4a03c020, - 0x00004000, 0x4a03c011, 0x40000010, 0x04006000, - 0x4203e000, 0x40000000, 0x4a03c017, 0x00000000, - 0x4203e000, 0x30000001, 0x4202d800, 0x00000000, - 0x4203e000, 0xb0600000, 0x59a80082, 0x4003f800, - 0x0201f000, 0x00020004, 0x4df00000, 0x4203e000, - 0x50000000, 0x416c0000, 0x82000c80, 0x00000008, - 0x0402186b, 0x0c01f804, 0x5c03e000, 0x0201f000, - 0x00020008, 0x001002d2, 0x00111729, 0x001114e2, - 0x001002d1, 0x001114ae, 0x001002d1, 0x001002d1, - 0x001002e4, 0x0401f85e, 0x42000800, 0x0010d115, - 0x5804001e, 0x8c000500, 0x0400000d, 0x84000500, - 0x4800081e, 0x4202d800, 0x00000004, 0x0401f983, - 0x49f3c857, 0x5c000800, 0x5c000000, 0x82000540, - 0x00003e00, 0x4c000000, 0x4c040000, 0x1c01f000, - 0x4a038805, 0x000000f0, 0x1c01f000, 0x4a03504e, - 0x00000007, 0x4a03504f, 0x00000003, 0x4a035050, - 0x00000000, 0x4a035051, 0x00009496, 0x0201f800, - 0x00105706, 0x4a035421, 0x0000ffff, 0x4a035015, - 0x00ffffff, 0x0201f800, 0x00109f94, 0x4a035025, - 0x20200000, 0x4a035026, 0x88000200, 0x4a035027, - 0x00ff001f, 0x4a035028, 0x000007d0, 0x4a035029, - 0x80000000, 0x4a03502a, 0x00000200, 0x4a03502b, - 0x00ff0000, 0x4a03502c, 0x00010000, 0x4a035033, - 0x514c4f47, 0x4a035034, 0x49432020, 0x1c01f000, - 0x4d440000, 0x417a8800, 0x4c5c0000, 0x4178b800, - 0x0201f800, 0x00020353, 0x04020005, 0x0201f800, - 0x00104b75, 0x04020002, 0x805cb800, 0x81468800, - 0x83440580, 0x000007f0, 0x040207f6, 0x405c0800, - 0x5c00b800, 0x5c028800, 0x1c01f000, 0x4803c857, + 0x24320002, 0x0402000d, 0x0201f800, 0x0010c62e, + 0x04000008, 0x42000800, 0x00007a17, 0x50040000, + 0x8c00050e, 0x04020003, 0x8400054e, 0x44000800, + 0x4a030000, 0x00000000, 0x4a03c020, 0x00000004, + 0x4203e000, 0x6000000f, 0x4a0370e8, 0x00000003, + 0x4a0378e8, 0x00000003, 0x59e00023, 0x8c000500, + 0x04020027, 0x42002800, 0x0010017d, 0x58140800, + 0x4817c857, 0x4807c857, 0x800409c0, 0x0400000b, + 0x58142002, 0x4813c857, 0x58141003, 0x4c140000, + 0x0401faa7, 0x5c002800, 0x0402002a, 0x82142c00, + 0x00000004, 0x0401f7f2, 0x42002800, 0x0010017d, + 0x5814a000, 0x4817c857, 0x4853c857, 0x8050a1c0, + 0x0400000f, 0x4c140000, 0x5814a801, 0x4857c857, + 0x40500000, 0x80540480, 0x04000005, 0x5814b002, + 0x485bc857, 0x0201f800, 0x0010c5de, 0x5c002800, + 0x82142c00, 0x00000004, 0x0401f7ee, 0x42002800, + 0x0010017d, 0x58140801, 0x4817c857, 0x4807c857, + 0x800409c0, 0x04000018, 0x58142002, 0x4813c857, + 0x58141003, 0x4c140000, 0x0401fa81, 0x04020005, + 0x5c002800, 0x82142c00, 0x00000004, 0x0401f7f2, + 0x4803c856, 0x4a03c020, 0x00004010, 0x4a03c011, + 0x40100011, 0x04006000, 0x4203e000, 0x40000000, + 0x4a03c017, 0x00000000, 0x4203e000, 0x30000001, + 0x0401f000, 0x4803c856, 0x0201f800, 0x0010fd04, + 0x0401fb08, 0x4a03c014, 0x001c001c, 0x42002000, + 0x00111872, 0x0201f800, 0x0010c5ef, 0x42000000, + 0x00001000, 0x50000000, 0x82000480, 0x24220001, + 0x0400090b, 0x42000000, 0x00001000, 0x50000000, + 0x82000480, 0x24320001, 0x04000905, 0x59c40000, + 0x82000500, 0xffff0000, 0x80000120, 0x82000580, + 0x00002422, 0x04020005, 0x59a8007f, 0x84000540, + 0x4803507f, 0x0401f00a, 0x59e00003, 0x82000500, + 0x00030000, 0x82000580, 0x00010000, 0x04020004, + 0x59a8007f, 0x84000542, 0x4803507f, 0x4c140000, + 0x0201f800, 0x0010bd94, 0x5c002800, 0x42000800, + 0x00001100, 0x42001800, 0x00000100, 0x82141480, + 0x0017ffff, 0x0402100d, 0x42000800, 0x00000900, + 0x82141480, 0x0013ffff, 0x04021008, 0x42000800, + 0x00000240, 0x42001800, 0x00000040, 0x82141480, + 0x0011ffff, 0x040018da, 0x48075013, 0x480f5257, + 0x42001000, 0x0000002c, 0x0201f800, 0x00107213, + 0x82040c00, 0x00111d64, 0x4807500b, 0x4a03c810, + 0x00100000, 0x4a03c811, 0x0010c79b, 0x4a03c812, + 0x0010fd00, 0x4a03c813, 0x00111871, 0x4a03c829, + 0x00000004, 0x59e40001, 0x82000540, 0x0003403f, + 0x4803c801, 0x42001000, 0x0000001c, 0x0401f9f7, + 0x4202c000, 0x00111d64, 0x59aab00b, 0x59aaa00b, + 0x59aaa80b, 0x59aac813, 0x49675056, 0x59a8000b, + 0x4803500c, 0x0401fada, 0x0201f800, 0x00108133, + 0x0401faea, 0x0401fb3a, 0x0201f800, 0x00101ad5, + 0x0201f800, 0x0010134e, 0x0201f800, 0x001006b3, + 0x0201f800, 0x00100d9b, 0x0201f800, 0x00107255, + 0x0401f85d, 0x0201f800, 0x001022f2, 0x0201f800, + 0x001058cc, 0x0201f800, 0x00105081, 0x0201f800, + 0x00106ce1, 0x0201f800, 0x001069d7, 0x0201f800, + 0x001013f3, 0x0201f800, 0x00101255, 0x4203e000, + 0xf0000001, 0x0201f800, 0x0010c72f, 0x4a03c018, + 0x00000000, 0x4203e000, 0x20000511, 0x4203e000, + 0x50010000, 0x04006000, 0x4a03c020, 0x00000000, + 0x04027010, 0x59e00020, 0x82000580, 0x00000002, + 0x0402000c, 0x4a03c020, 0x00004000, 0x4a03c011, + 0x40000010, 0x04006000, 0x4203e000, 0x40000000, + 0x4a03c017, 0x00000000, 0x4203e000, 0x30000001, + 0x4202d800, 0x00000000, 0x4203e000, 0xb0600000, + 0x59a80083, 0x4003f800, 0x0201f000, 0x00020004, + 0x4df00000, 0x4203e000, 0x50000000, 0x416c0000, + 0x82000c80, 0x00000008, 0x0402186d, 0x0c01f804, + 0x5c03e000, 0x0201f000, 0x00020008, 0x001002fc, + 0x00111743, 0x001114fc, 0x001002fb, 0x001114c8, + 0x001002fb, 0x001002fb, 0x0010030e, 0x0401f860, + 0x42000800, 0x0010d117, 0x5804001e, 0x8c000500, + 0x0400000d, 0x84000500, 0x4800081e, 0x4202d800, + 0x00000004, 0x0401f97f, 0x49f3c857, 0x5c000800, + 0x5c000000, 0x82000540, 0x00003e00, 0x4c000000, + 0x4c040000, 0x1c01f000, 0x4a038805, 0x000000f0, + 0x1c01f000, 0x4a03504e, 0x00000008, 0x4a03504f, + 0x00000007, 0x4a035050, 0x00000000, 0x4a035051, + 0x00009496, 0x0201f800, 0x00105866, 0x4a035421, + 0x0000ffff, 0x4a035015, 0x00ffffff, 0x0201f800, + 0x00109eef, 0x4a035025, 0x20200000, 0x4a035026, + 0x88000200, 0x4a035027, 0x00ff001f, 0x4a035028, + 0x000007d0, 0x4a035029, 0x80000000, 0x4a03502a, + 0x00000200, 0x4a03502b, 0x00ff0000, 0x4a03502c, + 0x00010000, 0x4a035033, 0x514c4f47, 0x4a035034, + 0x49432020, 0x1c01f000, 0x4d340000, 0x4d440000, + 0x417a8800, 0x4c5c0000, 0x4178b800, 0x0201f800, + 0x00020356, 0x04020005, 0x0201f800, 0x00104cb5, + 0x04020002, 0x805cb800, 0x81468800, 0x83440580, + 0x000007f0, 0x040207f6, 0x405c0800, 0x5c00b800, + 0x5c028800, 0x5c026800, 0x1c01f000, 0x4803c857, 0x5c000000, 0x4c000000, 0x4803c857, 0x0401f80c, 0x485fc857, 0x4203e000, 0x50000000, 0x5c000000, - 0x4d780000, 0x4200b800, 0x00008002, 0x0401f009, + 0x4d780000, 0x4200b800, 0x00008002, 0x0401f00a, 0x486bc857, 0x486fc857, 0x4873c857, 0x485fc857, - 0x4203e000, 0x50000000, 0x4200b800, 0x00008002, - 0x04006000, 0x4c000000, 0x4c040000, 0x59bc00ea, - 0x4803c857, 0x82000500, 0x00000007, 0x82000580, - 0x00000001, 0x04020005, 0x42000800, 0x00000000, - 0x0201f800, 0x001071c9, 0x59b800ea, 0x4803c857, - 0x4a0370e8, 0x00000004, 0x5c000800, 0x4807c025, - 0x80040920, 0x4807c026, 0x5c000000, 0x4803c023, - 0x80000120, 0x4803c024, 0x5c000000, 0x4803c857, - 0x4803c021, 0x80000120, 0x4803c022, 0x41f80000, - 0x4803c029, 0x80000120, 0x4803c02a, 0x41780800, - 0x59a80006, 0x8c000504, 0x04000004, 0x8d0e1d2e, - 0x04000002, 0x84040d48, 0x4807c027, 0x42000000, - 0x00001000, 0x50000000, 0x82000480, 0x24320001, - 0x4803c857, 0x0400104b, 0x0201f800, 0x0010c62d, - 0x04000046, 0x42000800, 0x0010ebce, 0x46000800, - 0xfaceface, 0x80040800, 0x4c080000, 0x4c0c0000, - 0x42001000, 0x00007a00, 0x58080013, 0x44000800, - 0x80040800, 0x58080019, 0x44000800, 0x80040800, - 0x5808001a, 0x44000800, 0x80040800, 0x5808001b, - 0x44000800, 0x80040800, 0x5808001c, 0x44000800, - 0x80040800, 0x5808001f, 0x44000800, 0x80040800, - 0x42001000, 0x00007a40, 0x42001800, 0x0000000b, - 0x50080000, 0x44000800, 0x80081000, 0x80040800, - 0x800c1840, 0x040207fb, 0x42001800, 0x00000003, - 0x42001000, 0x00007b00, 0x480c1003, 0x58080005, - 0x44000800, 0x80040800, 0x800c1840, 0x040217fb, - 0x42001000, 0x00007c00, 0x58080002, 0x44000800, - 0x80040800, 0x58080003, 0x44000800, 0x80040800, - 0x58080020, 0x44000800, 0x80040800, 0x58080021, - 0x44000800, 0x80040800, 0x58080022, 0x44000800, - 0x80040800, 0x58080023, 0x44000800, 0x80040800, - 0x5c001800, 0x5c001000, 0x4a030000, 0x00000000, - 0x485fc020, 0x905cb9c0, 0x825cbd40, 0x00000012, - 0x485fc011, 0x4203e000, 0x40000000, 0x4202d800, - 0x00000005, 0x4a03c017, 0x00000000, 0x4203e000, - 0x30000001, 0x0401f847, 0x0401f7ff, 0x42000000, - 0x00000004, 0x0401f80c, 0x4a03c855, 0x0001eb5a, - 0x59e40001, 0x82000540, 0x00000700, 0x4803c801, - 0x42000000, 0x0010d5d7, 0x49780003, 0x49780004, - 0x1c01f000, 0x42000800, 0x0010d5d9, 0x44000800, - 0x59e40801, 0x82041500, 0xfff3c0ff, 0x480bc801, - 0x8c040d24, 0x0400000c, 0x4c000000, 0x59e41052, - 0x59e40054, 0x800000d4, 0x82000400, 0x0010ebea, - 0x80081480, 0x480bc853, 0x4a03c800, 0x00000040, - 0x5c000000, 0x4a03c850, 0x0010ebea, 0x800000d4, - 0x82002400, 0x0010ebe9, 0x4813c851, 0x4a03c853, - 0x00000400, 0x42000000, 0x0010ebea, 0x82001400, - 0x00001000, 0x45780000, 0x80000000, 0x80081d80, - 0x040207fd, 0x4807c801, 0x1c01f000, 0x42002000, - 0x0010d5d7, 0x59e41801, 0x58100c01, 0x82040500, - 0x00003800, 0x820c1d00, 0xffffc7ff, 0x800c1d40, - 0x480fc801, 0x1c01f000, 0x5c036000, 0x4db00000, - 0x49b3c857, 0x4803c857, 0x1c01f000, 0x1c01f000, - 0x59a80067, 0x8c000530, 0x040207fe, 0x4c080000, - 0x42001000, 0x00000004, 0x0401f862, 0x5c001000, - 0x4201d000, 0x00028b0a, 0x0201f800, 0x001069c8, - 0x4c080000, 0x42001000, 0x00000008, 0x0401f859, - 0x5c001000, 0x4201d000, 0x00028b0a, 0x0201f800, - 0x001069c8, 0x4c080000, 0x42001000, 0x00000010, - 0x0401f850, 0x5c001000, 0x4201d000, 0x00028b0a, - 0x0201f800, 0x001069c8, 0x0401f7e2, 0x8c00050c, - 0x59a80867, 0x04020003, 0x84040d30, 0x0401f006, - 0x84040d70, 0x48075067, 0x42001000, 0x00000000, - 0x0401f040, 0x48075067, 0x836c0500, 0x00000007, - 0x0c01f001, 0x0010046b, 0x00100451, 0x00100451, - 0x00100439, 0x0010045e, 0x00100451, 0x00100451, - 0x0010045e, 0x59a8007e, 0x8c000502, 0x04020013, - 0x59c40801, 0x82040d00, 0x00018000, 0x82040580, - 0x00010000, 0x0400000a, 0x82040580, 0x00008000, - 0x04000004, 0x42001000, 0x42004000, 0x0401f006, - 0x42001000, 0x22002000, 0x0401f003, 0x42001000, - 0x12001000, 0x0401f025, 0x42001000, 0x00001004, - 0x0401f022, 0x59a8007e, 0x8c000502, 0x04020008, - 0x59a80067, 0x8c000534, 0x04020004, 0x42001000, - 0x74057005, 0x0401f819, 0x1c01f000, 0x42001000, - 0x00002008, 0x0401f7fc, 0x59a80067, 0x8c000534, - 0x0402000a, 0x59a8007e, 0x8c000502, 0x04000004, - 0x42001000, 0x24052005, 0x0401f00c, 0x42001000, - 0x74057005, 0x0401f009, 0x1c01f000, 0x1c01f000, - 0x82081500, 0x0000001c, 0x82081540, 0x001c0000, - 0x480bc013, 0x1c01f000, 0x59a80067, 0x8c000530, - 0x04000002, 0x84081570, 0x480b5067, 0x8c000530, - 0x04020005, 0x82081500, 0x00007000, 0x80081114, - 0x0401fff0, 0x1c01f000, 0x40001800, 0x800c18c2, - 0x800c0400, 0x800c18c6, 0x800c0400, 0x800c18c2, - 0x800c0400, 0x800c190e, 0x800c0400, 0x80000112, - 0x1c01f000, 0x41780000, 0x50041800, 0x800c0400, - 0x80040800, 0x80102040, 0x040207fc, 0x80080500, - 0x80000540, 0x1c01f000, 0x4202f000, 0x00000000, - 0x41780000, 0x41780800, 0x41781000, 0x41781800, - 0x41782000, 0x41782800, 0x41783000, 0x41783800, - 0x41784000, 0x41784800, 0x41785000, 0x41785800, - 0x41786000, 0x41786800, 0x41787000, 0x41787800, - 0x41788000, 0x41788800, 0x41789000, 0x41789800, - 0x4178a000, 0x4178a800, 0x4178b000, 0x4178b800, - 0x4178c000, 0x4178c800, 0x4178d000, 0x4178d800, - 0x4178e000, 0x4178e800, 0x4178f000, 0x4178f800, - 0x41790000, 0x41790800, 0x41791000, 0x41791800, - 0x41792000, 0x41792800, 0x41793000, 0x41793800, - 0x41794000, 0x41794800, 0x41795000, 0x41795800, - 0x41796000, 0x41796800, 0x41797000, 0x41797800, - 0x41798000, 0x41798800, 0x42019000, 0x0010d1a5, - 0x42019800, 0x0010d17b, 0x4179a000, 0x4179a800, - 0x4179b000, 0x4179b800, 0x4179c800, 0x4179c000, - 0x4179d000, 0x4179d800, 0x4179e000, 0x4179e800, - 0x4179f000, 0x4179f800, 0x417a0000, 0x417a0800, - 0x417a1000, 0x417a1800, 0x417a2000, 0x42022800, - 0x00006100, 0x417a3000, 0x417a3800, 0x417a4000, - 0x417a4800, 0x417a5000, 0x417a5800, 0x417a6000, - 0x417a6800, 0x417a7000, 0x417a7800, 0x417a8000, - 0x417a8800, 0x417a9000, 0x417a9800, 0x417ae800, - 0x417af800, 0x42030000, 0x00007c00, 0x42031000, - 0x0010d476, 0x42031800, 0x0000bf1d, 0x42032000, - 0x0000bf32, 0x42032800, 0x0010d43e, 0x42033000, - 0x00020c5a, 0x42034000, 0x0010d115, 0x42033800, - 0x0010d134, 0x42034800, 0x0010d1b4, 0x42035000, - 0x0010d080, 0x42035800, 0x0010c880, 0x42030800, - 0x0010d176, 0x417b6000, 0x42036800, 0x00006f00, - 0x4203c800, 0x00003000, 0x42037000, 0x0000ff00, - 0x42037800, 0x0000bf00, 0x42038000, 0x00007700, - 0x42038800, 0x00004000, 0x42039000, 0x00006000, - 0x42039800, 0x0010e906, 0x4203a000, 0x00007600, - 0x4203a800, 0x00007400, 0x4203b000, 0x00007200, - 0x4203b800, 0x00007100, 0x4203c000, 0x00007000, - 0x4203d000, 0x00000000, 0x4203e800, 0x000201ba, - 0x417bd800, 0x1c01f000, 0x42000800, 0x00100000, - 0x50040000, 0x4c000000, 0x42000000, 0x0000aaaa, - 0x44000800, 0x42001800, 0x00005555, 0x42002000, - 0x00010000, 0x82102400, 0x00010000, 0x40100000, - 0x80042c00, 0x440c2800, 0x42003000, 0x0000000a, - 0x80183040, 0x040207ff, 0x50140000, 0x800c0580, - 0x04020004, 0x50040000, 0x800c0580, 0x040207f2, - 0x5c000000, 0x44000800, 0x80142840, 0x4817c861, - 0x4817500a, 0x1c01f000, 0x40681800, 0x59a8081f, - 0x800409c0, 0x04020008, 0x49781c0c, 0x4a001a0c, - 0x00000002, 0x4a001804, 0x00000007, 0x59a80015, - 0x48001805, 0x4c0c0000, 0x0401fdba, 0x5c001800, - 0x800409c0, 0x04020002, 0x80040800, 0x48041806, - 0x1c01f000, 0x4200b000, 0x00000080, 0x59a80086, - 0x8c00053e, 0x04000003, 0x4200b000, 0x00000040, - 0x42024800, 0x0010d5ef, 0x42000000, 0x0010db6f, - 0x48024809, 0x82000400, 0x00000010, 0x83264c00, - 0x0000000b, 0x8058b040, 0x040207fa, 0x1c01f000, - 0x59a8080c, 0x4006d000, 0x4202b800, 0x00000001, - 0x59a8180a, 0x480fc857, 0x82041400, 0x00000015, - 0x82082400, 0x00000015, 0x40100000, 0x800c0480, - 0x04001006, 0x44080800, 0x40080800, 0x40101000, - 0x815eb800, 0x0401f7f7, 0x45780800, 0x495f5020, - 0x1c01f000, 0x0401f803, 0x412d8800, 0x1c01f000, - 0x835c0480, 0x00000104, 0x0400100a, 0x496bc857, - 0x815eb840, 0x416a5800, 0x592ed000, 0x497a5800, - 0x497a5801, 0x497a5805, 0x812e59c0, 0x1c01f000, - 0x42000000, 0x0010d52b, 0x0201f800, 0x0010c50a, - 0x417a5800, 0x0401f7f9, 0x0401f803, 0x412d8800, - 0x1c01f000, 0x815eb840, 0x04001009, 0x416a5800, - 0x492fc857, 0x592ed000, 0x497a5800, 0x497a5801, - 0x497a5805, 0x812e59c0, 0x1c01f000, 0x42000000, - 0x0010d52b, 0x0201f800, 0x0010c50a, 0x417ab800, - 0x417a5800, 0x0401f7f8, 0x492fc857, 0x496a5800, - 0x412ed000, 0x815eb800, 0x59c80000, 0x82000540, - 0x00001200, 0x48039000, 0x1c01f000, 0x492fc857, - 0x812e59c0, 0x04000007, 0x592c0001, 0x497a5801, - 0x4c000000, 0x0401fff1, 0x5c025800, 0x0401f7f9, - 0x1c01f000, 0x4807c856, 0x42007000, 0x00020c51, - 0x4a007000, 0x00000000, 0x59e00003, 0x82000540, - 0x00008080, 0x4803c003, 0x4a03b805, 0x90000001, - 0x59dc0006, 0x4a03b805, 0x70000000, 0x59dc0006, + 0x496fc857, 0x4203e000, 0x50000000, 0x4200b800, + 0x00008002, 0x4c000000, 0x04006000, 0x4c040000, + 0x59bc00ea, 0x4803c857, 0x82000500, 0x00000007, + 0x82000580, 0x00000001, 0x04020005, 0x42000800, + 0x00000000, 0x0201f800, 0x00020c3d, 0x59b800ea, + 0x4803c857, 0x4a0370e8, 0x00000004, 0x5c000800, + 0x4807c025, 0x80040920, 0x4807c026, 0x5c000000, + 0x4803c023, 0x80000120, 0x4803c024, 0x5c000000, + 0x4803c857, 0x4803c021, 0x80000120, 0x4803c022, + 0x41f80000, 0x4803c029, 0x80000120, 0x4803c02a, + 0x41780800, 0x59a80006, 0x8c000504, 0x04000004, + 0x8d0e1d2e, 0x04000002, 0x84040d48, 0x4807c027, + 0x59a80062, 0x8c00050a, 0x04000004, 0x84040d4a, + 0x4807c857, 0x4807c027, 0x42000000, 0x00001000, + 0x50000000, 0x82000480, 0x24320001, 0x4803c857, + 0x0400104b, 0x0201f800, 0x0010c62e, 0x04000046, + 0x42000800, 0x0010ebd6, 0x46000800, 0xfaceface, + 0x80040800, 0x4c080000, 0x4c0c0000, 0x42001000, + 0x00007a00, 0x58080013, 0x44000800, 0x80040800, + 0x58080019, 0x44000800, 0x80040800, 0x5808001a, + 0x44000800, 0x80040800, 0x5808001b, 0x44000800, + 0x80040800, 0x5808001c, 0x44000800, 0x80040800, + 0x5808001f, 0x44000800, 0x80040800, 0x42001000, + 0x00007a40, 0x42001800, 0x0000000b, 0x50080000, + 0x44000800, 0x80081000, 0x80040800, 0x800c1840, + 0x040207fb, 0x42001800, 0x00000003, 0x42001000, + 0x00007b00, 0x480c1003, 0x58080005, 0x44000800, + 0x80040800, 0x800c1840, 0x040217fb, 0x42001000, + 0x00007c00, 0x58080002, 0x44000800, 0x80040800, + 0x58080003, 0x44000800, 0x80040800, 0x58080020, + 0x44000800, 0x80040800, 0x58080021, 0x44000800, + 0x80040800, 0x58080022, 0x44000800, 0x80040800, + 0x58080023, 0x44000800, 0x80040800, 0x5c001800, + 0x5c001000, 0x4a030000, 0x00000000, 0x485fc020, + 0x905cb9c0, 0x825cbd40, 0x00000012, 0x485fc011, + 0x4203e000, 0x40000000, 0x4202d800, 0x00000005, + 0x4a03c017, 0x00000000, 0x4203e000, 0x30000001, + 0x0401f83a, 0x0401f7ff, 0x42000000, 0x00000004, + 0x0401f80c, 0x4a03c855, 0x0001eb5a, 0x59e40001, + 0x82000540, 0x00000700, 0x4803c801, 0x42000000, + 0x0010d5df, 0x49780003, 0x49780004, 0x1c01f000, + 0x42000800, 0x0010d5e1, 0x44000800, 0x59e40801, + 0x82041500, 0xfff3c0ff, 0x480bc801, 0x4a03c850, + 0x0010ebf2, 0x800000d4, 0x82002400, 0x0010ebf1, + 0x4813c851, 0x4a03c853, 0x00000400, 0x42000000, + 0x0010ebf2, 0x82001400, 0x00001000, 0x45780000, + 0x80000000, 0x80081d80, 0x040207fd, 0x4807c801, + 0x1c01f000, 0x42002000, 0x0010d5df, 0x59e41801, + 0x58100c01, 0x82040500, 0x00003800, 0x820c1d00, + 0xffffc7ff, 0x800c1d40, 0x480fc801, 0x1c01f000, + 0x5c036000, 0x4db00000, 0x49b3c857, 0x4803c857, + 0x1c01f000, 0x1c01f000, 0x59a80068, 0x8c000530, + 0x040207fe, 0x4c080000, 0x42001000, 0x00000004, + 0x0401f862, 0x5c001000, 0x4201d000, 0x00028b0a, + 0x0201f800, 0x00106bed, 0x4c080000, 0x42001000, + 0x00000008, 0x0401f859, 0x5c001000, 0x4201d000, + 0x00028b0a, 0x0201f800, 0x00106bed, 0x4c080000, + 0x42001000, 0x00000010, 0x0401f850, 0x5c001000, + 0x4201d000, 0x00028b0a, 0x0201f800, 0x00106bed, + 0x0401f7e2, 0x8c00050c, 0x59a80868, 0x04020003, + 0x84040d30, 0x0401f006, 0x84040d70, 0x48075068, + 0x42001000, 0x00000000, 0x0401f040, 0x48075068, + 0x836c0500, 0x00000007, 0x0c01f001, 0x00100491, + 0x00100477, 0x00100477, 0x0010045f, 0x00100484, + 0x00100477, 0x00100477, 0x00100484, 0x59a8007f, + 0x8c000502, 0x04020013, 0x59c40801, 0x82040d00, + 0x00018000, 0x82040580, 0x00010000, 0x0400000a, + 0x82040580, 0x00008000, 0x04000004, 0x42001000, + 0x42004000, 0x0401f006, 0x42001000, 0x22002000, + 0x0401f003, 0x42001000, 0x12001000, 0x0401f025, + 0x42001000, 0x00001004, 0x0401f022, 0x59a8007f, + 0x8c000502, 0x04020008, 0x59a80068, 0x8c000534, + 0x04020004, 0x42001000, 0x74057005, 0x0401f819, + 0x1c01f000, 0x42001000, 0x00002008, 0x0401f7fc, + 0x59a80068, 0x8c000534, 0x0402000a, 0x59a8007f, + 0x8c000502, 0x04000004, 0x42001000, 0x24052005, + 0x0401f00c, 0x42001000, 0x74057005, 0x0401f009, + 0x1c01f000, 0x1c01f000, 0x82081500, 0x0000001c, + 0x82081540, 0x001c0000, 0x480bc013, 0x1c01f000, + 0x59a80068, 0x8c000530, 0x04000002, 0x84081570, + 0x480b5068, 0x8c000530, 0x04020005, 0x82081500, + 0x00007000, 0x80081114, 0x0401fff0, 0x1c01f000, + 0x40001800, 0x800c18c2, 0x800c0400, 0x800c18c6, + 0x800c0400, 0x800c18c2, 0x800c0400, 0x800c190e, + 0x800c0400, 0x80000112, 0x1c01f000, 0x41780000, + 0x50041800, 0x800c0400, 0x80040800, 0x80102040, + 0x040207fc, 0x80080500, 0x80000540, 0x1c01f000, + 0x4202f000, 0x00000000, 0x41780000, 0x41780800, + 0x41781000, 0x41781800, 0x41782000, 0x41782800, + 0x41783000, 0x41783800, 0x41784000, 0x41784800, + 0x41785000, 0x41785800, 0x41786000, 0x41786800, + 0x41787000, 0x41787800, 0x41788000, 0x41788800, + 0x41789000, 0x41789800, 0x4178a000, 0x4178a800, + 0x4178b000, 0x4178b800, 0x4178c000, 0x4178c800, + 0x4178d000, 0x4178d800, 0x4178e000, 0x4178e800, + 0x4178f000, 0x4178f800, 0x41790000, 0x41790800, + 0x41791000, 0x41791800, 0x41792000, 0x41792800, + 0x41793000, 0x41793800, 0x41794000, 0x41794800, + 0x41795000, 0x41795800, 0x41796000, 0x41796800, + 0x41797000, 0x41797800, 0x41798000, 0x41798800, + 0x42019000, 0x0010d1a7, 0x42019800, 0x0010d17d, + 0x4179a000, 0x4179a800, 0x4179b000, 0x4179b800, + 0x4179c800, 0x4179c000, 0x4179d000, 0x4179d800, + 0x4179e000, 0x4179e800, 0x4179f000, 0x4179f800, + 0x417a0000, 0x417a0800, 0x417a1000, 0x417a1800, + 0x417a2000, 0x42022800, 0x00006100, 0x417a3000, + 0x417a3800, 0x417a4000, 0x417a4800, 0x417a5000, + 0x417a5800, 0x417a6000, 0x417a6800, 0x417a7000, + 0x417a7800, 0x417a8000, 0x417a8800, 0x417a9000, + 0x417a9800, 0x417ae800, 0x417af800, 0x42030000, + 0x00007c00, 0x42031000, 0x0010d47b, 0x42031800, + 0x0000bf1d, 0x42032000, 0x0000bf32, 0x42032800, + 0x0010d440, 0x42033000, 0x0002108d, 0x42034000, + 0x0010d117, 0x42033800, 0x0010d136, 0x42034800, + 0x0010d1b6, 0x42035000, 0x0010d080, 0x42035800, + 0x0010c880, 0x42030800, 0x0010d178, 0x417b6000, + 0x42036800, 0x00006f00, 0x4203c800, 0x00003000, + 0x42037000, 0x0000ff00, 0x42037800, 0x0000bf00, + 0x42038000, 0x00007700, 0x42038800, 0x00004000, + 0x42039000, 0x00006000, 0x42039800, 0x0010e90e, + 0x4203a000, 0x00007600, 0x4203a800, 0x00007400, + 0x4203b000, 0x00007200, 0x4203b800, 0x00007100, + 0x4203c000, 0x00007000, 0x4203d000, 0x00000000, + 0x4203e800, 0x000201bd, 0x417bd800, 0x1c01f000, + 0x42000800, 0x00100000, 0x50040000, 0x4c000000, + 0x42000000, 0x0000aaaa, 0x44000800, 0x42001800, + 0x00005555, 0x42002000, 0x00010000, 0x82102400, + 0x00010000, 0x40100000, 0x80042c00, 0x440c2800, + 0x42003000, 0x0000000a, 0x80183040, 0x040207ff, + 0x50140000, 0x800c0580, 0x04020004, 0x50040000, + 0x800c0580, 0x040207f2, 0x5c000000, 0x44000800, + 0x80142840, 0x4817c861, 0x4817500a, 0x1c01f000, + 0x40681800, 0x59a8081f, 0x800409c0, 0x04020008, + 0x49781c0c, 0x4a001a0c, 0x00000002, 0x4a001804, + 0x00000007, 0x59a80015, 0x48001805, 0x4c0c0000, + 0x0401fdbe, 0x5c001800, 0x800409c0, 0x04020002, + 0x80040800, 0x48041806, 0x1c01f000, 0x4200b000, + 0x00000080, 0x59a80087, 0x8c00053e, 0x04000003, + 0x4200b000, 0x00000040, 0x42024800, 0x0010d5f7, + 0x42000000, 0x0010db77, 0x48024809, 0x82000400, + 0x00000010, 0x83264c00, 0x0000000b, 0x8058b040, + 0x040207fa, 0x1c01f000, 0x59a8080c, 0x4006d000, + 0x4202b800, 0x00000001, 0x59a8180a, 0x480fc857, + 0x82041400, 0x00000015, 0x82082400, 0x00000015, + 0x40100000, 0x800c0480, 0x04001006, 0x44080800, + 0x40080800, 0x40101000, 0x815eb800, 0x0401f7f7, + 0x45780800, 0x495f5020, 0x1c01f000, 0x0401f803, + 0x412d8800, 0x1c01f000, 0x835c0480, 0x00000104, + 0x0400100a, 0x496bc857, 0x815eb840, 0x416a5800, + 0x592ed000, 0x497a5800, 0x497a5801, 0x497a5805, + 0x812e59c0, 0x1c01f000, 0x42000000, 0x0010d52f, + 0x0201f800, 0x0010c50c, 0x417a5800, 0x0401f7f9, + 0x0401f803, 0x412d8800, 0x1c01f000, 0x815eb840, + 0x04001009, 0x416a5800, 0x492fc857, 0x592ed000, + 0x497a5800, 0x497a5801, 0x497a5805, 0x812e59c0, + 0x1c01f000, 0x42000000, 0x0010d52f, 0x0201f800, + 0x0010c50c, 0x417ab800, 0x417a5800, 0x0401f7f8, + 0x492fc857, 0x496a5800, 0x412ed000, 0x815eb800, + 0x59c80000, 0x82000540, 0x00001200, 0x48039000, + 0x1c01f000, 0x492fc857, 0x812e59c0, 0x04000007, + 0x592c0001, 0x497a5801, 0x4c000000, 0x0401fff1, + 0x5c025800, 0x0401f7f9, 0x1c01f000, 0x4807c856, + 0x42007000, 0x00021084, 0x4a007000, 0x00000000, + 0x59e00003, 0x82000540, 0x00008080, 0x4803c003, + 0x4a03b805, 0x90000001, 0x59dc0006, 0x4a03b805, + 0x70000000, 0x59dc0006, 0x4a03b805, 0x30000000, + 0x59dc0006, 0x4a03b805, 0x80000000, 0x4200b000, + 0x00000020, 0x497bb807, 0x8058b040, 0x040207fe, 0x4a03b805, 0x30000000, 0x59dc0006, 0x4a03b805, - 0x80000000, 0x4200b000, 0x00000020, 0x497bb807, - 0x8058b040, 0x040207fe, 0x4a03b805, 0x30000000, - 0x59dc0006, 0x4a03b805, 0x60000001, 0x59dc0006, - 0x4a03b805, 0x70000001, 0x59dc0006, 0x4a03b805, - 0x30000002, 0x4200b000, 0x00000020, 0x497bb807, - 0x8058b040, 0x040207fe, 0x4a03b805, 0x30000000, - 0x59dc0006, 0x4a03b805, 0x60000001, 0x4803c856, - 0x0401ffad, 0x04000d42, 0x42001000, 0x0010d471, - 0x452c1000, 0x4a025801, 0x00000001, 0x4a025802, - 0x00000100, 0x4a025808, 0x001078f8, 0x497a5809, - 0x497a580a, 0x497a580b, 0x0401ff9f, 0x04000d34, - 0x42001000, 0x0010d472, 0x452c1000, 0x4a025801, - 0x00000000, 0x4a025802, 0x00000100, 0x4a025808, - 0x0010105c, 0x497a5803, 0x497a5806, 0x497a5807, - 0x497a5809, 0x59a8007e, 0x8c000500, 0x04000006, - 0x4a03b805, 0xe0000001, 0x59dc0006, 0x8c000522, - 0x040007fc, 0x1c01f000, 0x40681000, 0x0201f800, - 0x00020017, 0x1c01f000, 0x42001000, 0x00020027, - 0x0201f800, 0x0010687a, 0x0201f800, 0x0010a07e, - 0x58380807, 0x42002000, 0x00000001, 0x58040801, - 0x800409c0, 0x04000003, 0x80102000, 0x0401f7fc, - 0x0201f800, 0x0010b9e9, 0x04020011, 0x42000000, - 0x0010d493, 0x0201f800, 0x0010c50a, 0x0201f800, - 0x0010a096, 0x42000800, 0x00000001, 0x42001000, - 0x00020027, 0x0201f800, 0x00106844, 0x42007000, - 0x00020c51, 0x0201f000, 0x00020031, 0x4a03b805, - 0x30000002, 0x59dc0006, 0x4807b800, 0x480bb801, - 0x42007000, 0x00020c51, 0x4a007002, 0x00000040, - 0x480c7008, 0x58380007, 0x82000400, 0x00000005, - 0x48007003, 0x4a007000, 0x00000003, 0x4803b803, - 0x0201f000, 0x00020051, 0x58380802, 0x42001000, - 0x0000ff00, 0x82040480, 0x0000ff00, 0x04021003, - 0x40041000, 0x80000580, 0x48007002, 0x480bb802, - 0x59dc0006, 0x4a03b805, 0x10000000, 0x1c01f000, - 0x4a03b805, 0x30000001, 0x58386001, 0x58301008, - 0x4807c857, 0x4803c857, 0x4833c857, 0x4a006002, - 0x00000200, 0x4a007000, 0x00000000, 0x800811c0, - 0x02000000, 0x0002002d, 0x0201f000, 0x00020093, - 0x59dc0006, 0x8c000520, 0x0400000a, 0x02004800, - 0x000209db, 0x59dc0006, 0x82000500, 0x00006000, - 0x04000004, 0x82000580, 0x00006000, 0x040207f8, - 0x1c01f000, 0x41781800, 0x58382005, 0x40300000, - 0x80100580, 0x04000007, 0x40101800, 0x58102000, - 0x801021c0, 0x040207fa, 0x4803c856, 0x0401f011, - 0x4833c857, 0x58302000, 0x49786000, 0x800c19c0, - 0x04020008, 0x801021c0, 0x04000003, 0x48107005, - 0x0401f008, 0x49787005, 0x49787004, 0x0401f005, - 0x48101800, 0x801021c0, 0x04020002, 0x480c7004, - 0x1c01f000, 0x4803c856, 0x4dc00000, 0x42007000, - 0x0010d474, 0x4a007400, 0x00000000, 0x49787001, - 0x42038000, 0x00007720, 0x4a038006, 0x60000001, - 0x4a038009, 0xf4f60000, 0x42038000, 0x00007700, + 0x60000001, 0x59dc0006, 0x4a03b805, 0x70000001, + 0x59dc0006, 0x4a03b805, 0x30000002, 0x4200b000, + 0x00000020, 0x497bb807, 0x8058b040, 0x040207fe, + 0x4a03b805, 0x30000000, 0x59dc0006, 0x4a03b805, + 0x60000001, 0x4803c856, 0x0401ffad, 0x04000d48, + 0x42001000, 0x0010d476, 0x452c1000, 0x4a025801, + 0x00000001, 0x4a025802, 0x00000100, 0x4a025808, + 0x00107839, 0x497a5809, 0x497a580a, 0x497a580b, + 0x0401ff9f, 0x04000d3a, 0x42001000, 0x0010d477, + 0x452c1000, 0x4a025801, 0x00000000, 0x4a025802, + 0x00000100, 0x4a025808, 0x00101064, 0x497a5803, + 0x497a5806, 0x497a5807, 0x497a5809, 0x59a8007f, + 0x8c000500, 0x04000006, 0x4a03b805, 0xe0000001, + 0x59dc0006, 0x8c000522, 0x040007fc, 0x1c01f000, + 0x40681000, 0x0201f800, 0x00020020, 0x1c01f000, + 0x42001000, 0x00020030, 0x0201f800, 0x00106a97, + 0x0201f800, 0x00109fd9, 0x58380807, 0x42002000, + 0x00000001, 0x58040801, 0x800409c0, 0x04000003, + 0x80102000, 0x0401f7fc, 0x0201f800, 0x0010b9d3, + 0x0402000d, 0x0201f800, 0x00109ff1, 0x42000800, + 0x00000001, 0x42001000, 0x00020030, 0x0201f800, + 0x00106a61, 0x42007000, 0x00021084, 0x0201f000, + 0x0002003a, 0x4a03b805, 0x30000002, 0x59dc0006, + 0x4807b800, 0x480bb801, 0x42007000, 0x00021084, + 0x4a007002, 0x00000040, 0x480c7008, 0x58380007, + 0x82000400, 0x00000005, 0x48007003, 0x4a007000, + 0x00000003, 0x4803b803, 0x0201f000, 0x0002005a, + 0x58380802, 0x42001000, 0x0000ff00, 0x82040480, + 0x0000ff00, 0x04021003, 0x40041000, 0x80000580, + 0x48007002, 0x480bb802, 0x59dc0006, 0x4a03b805, + 0x10000000, 0x1c01f000, 0x4a03b805, 0x30000001, + 0x58386001, 0x58301008, 0x4807c857, 0x4803c857, + 0x4833c857, 0x4a006002, 0x00000200, 0x4a007000, + 0x00000000, 0x800811c0, 0x02000000, 0x00020036, + 0x0201f000, 0x0002009c, 0x59dc0006, 0x8c000520, + 0x0400000a, 0x02004800, 0x00020a23, 0x59dc0006, + 0x82000500, 0x00006000, 0x04000004, 0x82000580, + 0x00006000, 0x040207f8, 0x1c01f000, 0x41781800, + 0x58382005, 0x40300000, 0x80100580, 0x04000007, + 0x40101800, 0x58102000, 0x801021c0, 0x040207fa, + 0x4803c856, 0x0401f011, 0x4833c857, 0x58302000, + 0x49786000, 0x800c19c0, 0x04020008, 0x801021c0, + 0x04000003, 0x48107005, 0x0401f008, 0x49787005, + 0x49787004, 0x0401f005, 0x48101800, 0x801021c0, + 0x04020002, 0x480c7004, 0x1c01f000, 0x4803c856, + 0x4dc00000, 0x42007000, 0x0010d479, 0x4a007400, + 0x00000000, 0x49787001, 0x42038000, 0x00007720, 0x4a038006, 0x60000001, 0x4a038009, 0xf4f60000, - 0x4a03c822, 0x00000010, 0x4a0370e8, 0x00000000, - 0x0401f809, 0x4a0370e9, 0x00003a0f, 0x4a0370e8, - 0x00000000, 0x4a0370e8, 0x00000001, 0x5c038000, - 0x1c01f000, 0x4c5c0000, 0x4178b800, 0x0401f80a, - 0x5c00b800, 0x1c01f000, 0x4803c856, 0x4c5c0000, - 0x825cbd40, 0x00000001, 0x0401f803, 0x5c00b800, - 0x1c01f000, 0x4803c856, 0x4dc00000, 0x4c500000, - 0x4c580000, 0x4c540000, 0x4a0370e8, 0x00000000, - 0x805cb9c0, 0x0400000b, 0x4a038807, 0x00000004, - 0x4a0370e5, 0x00080000, 0x59b800ea, 0x8c000510, - 0x04000004, 0x59b800e0, 0x0401f87d, 0x0401f7fb, - 0x42038000, 0x00007720, 0x0201f800, 0x00100ccd, - 0x59c00007, 0x4a038006, 0x20000000, 0x59c00007, - 0x4a038006, 0x8000000a, 0x59c00007, 0x4a038006, - 0x8000000b, 0x59c00007, 0x4a038006, 0x40000001, + 0x42038000, 0x00007700, 0x4a038006, 0x60000001, + 0x4a038009, 0xf4f60000, 0x4a03c822, 0x00000010, + 0x4a0370e8, 0x00000000, 0x0401f809, 0x4a0370e9, + 0x00003a0f, 0x4a0370e8, 0x00000000, 0x4a0370e8, + 0x00000001, 0x5c038000, 0x1c01f000, 0x4c5c0000, + 0x4178b800, 0x0401f80a, 0x5c00b800, 0x1c01f000, + 0x4803c856, 0x4c5c0000, 0x825cbd40, 0x00000001, + 0x0401f803, 0x5c00b800, 0x1c01f000, 0x4803c856, + 0x4dc00000, 0x4c500000, 0x4c580000, 0x4c540000, + 0x4a0370e8, 0x00000000, 0x805cb9c0, 0x0400000b, + 0x4a038807, 0x00000004, 0x4a0370e5, 0x00080000, + 0x59b800ea, 0x8c000510, 0x04000004, 0x59b800e0, + 0x0401f87d, 0x0401f7fb, 0x42038000, 0x00007720, + 0x0201f800, 0x00100cf9, 0x59c00007, 0x4a038006, + 0x20000000, 0x59c00007, 0x4a038006, 0x8000000a, + 0x59c00007, 0x4a038006, 0x8000000b, 0x59c00007, + 0x4a038006, 0x40000001, 0x83c00580, 0x00007700, + 0x04000004, 0x42038000, 0x00007700, 0x0401f7ed, + 0x42038000, 0x00007720, 0x42000800, 0x00000800, + 0x59c00007, 0x8c00051e, 0x04000006, 0x4a038006, + 0x90000001, 0x80040840, 0x040207fa, 0x0401fc48, 0x83c00580, 0x00007700, 0x04000004, 0x42038000, - 0x00007700, 0x0401f7ed, 0x42038000, 0x00007720, - 0x42000800, 0x00000800, 0x59c00007, 0x8c00051e, - 0x04000006, 0x4a038006, 0x90000001, 0x80040840, - 0x040207fa, 0x0401fc3e, 0x83c00580, 0x00007700, - 0x04000004, 0x42038000, 0x00007700, 0x0401f7f1, - 0x4178a000, 0x805cb9c0, 0x0402001d, 0x4200b000, - 0x00000020, 0x83b8ac00, 0x00000020, 0x0201f800, - 0x0010c5e6, 0x4a0370fb, 0x00000001, 0x4a037020, - 0x00100f3c, 0x59a80032, 0x82000500, 0x0000ffff, - 0x48037021, 0x4a037035, 0x0010e84c, 0x4a037030, - 0x0010d095, 0x4a037031, 0x0010c880, 0x4a037032, - 0x0010d186, 0x4a037036, 0x0010d191, 0x59840002, - 0x48037034, 0x4a037038, 0x00100f33, 0x4a0370fb, - 0x00000001, 0x4200b000, 0x00000020, 0x83b8ac00, - 0x00000000, 0x0201f800, 0x0010c5e6, 0x4200b000, - 0x00000040, 0x83b8ac00, 0x00000040, 0x0201f800, - 0x0010c5e6, 0x805cb9c0, 0x04020006, 0x4a0370e4, - 0xaaaaaaaa, 0x4a0370e5, 0xaaaaaaaa, 0x0401f005, - 0x4a0370e4, 0xa2aa2a82, 0x4a0370e5, 0xaaaaa2aa, - 0x4a0370e6, 0xaaaaaaaa, 0x4a0370fb, 0x00000000, - 0x4a0370e6, 0xaaaaaaaa, 0x42038000, 0x00007720, - 0x4a038006, 0x90000000, 0x59c00007, 0x8c00051e, - 0x02020800, 0x0010032f, 0x42038000, 0x00007700, - 0x4a038006, 0x90000000, 0x59c00007, 0x8c00051e, - 0x02020800, 0x0010032f, 0x5c00a800, 0x5c00b000, - 0x5c00a000, 0x5c038000, 0x1c01f000, 0x4d300000, - 0x4d380000, 0x40026000, 0x82000500, 0x7f000000, - 0x82000580, 0x60000000, 0x04020012, 0x83326500, - 0x00ffffff, 0x0201f800, 0x0010a6dc, 0x0402000d, - 0x59300203, 0x82000580, 0x00000004, 0x04020009, - 0x59300c07, 0x82040580, 0x00000009, 0x04020005, - 0x42027000, 0x00000047, 0x0201f800, 0x00020b22, - 0x5c027000, 0x5c026000, 0x1c01f000, 0x4d300000, - 0x4d2c0000, 0x4d340000, 0x4d400000, 0x4cfc0000, - 0x4d380000, 0x4d3c0000, 0x4d440000, 0x4d4c0000, - 0x4d480000, 0x4c5c0000, 0x4c600000, 0x4c640000, - 0x4d040000, 0x4cc80000, 0x4ccc0000, 0x4cf40000, - 0x4cf80000, 0x0201f800, 0x00020096, 0x5c01f000, - 0x5c01e800, 0x5c019800, 0x5c019000, 0x5c020800, - 0x5c00c800, 0x5c00c000, 0x5c00b800, 0x5c029000, - 0x5c029800, 0x5c028800, 0x5c027800, 0x5c027000, - 0x5c01f800, 0x5c028000, 0x5c026800, 0x5c025800, - 0x5c026000, 0x1c01f000, 0x493bc857, 0x0201f000, - 0x000200c3, 0x83300500, 0x000000ff, 0x82000c80, - 0x00000007, 0x02021800, 0x0010032f, 0x0c01f025, - 0x1c01f000, 0x82000d00, 0xc0000038, 0x02020800, - 0x00100324, 0x0201f800, 0x0010032f, 0x00000000, - 0x00000048, 0x00000054, 0x00000053, 0x001007ba, - 0x001007df, 0x001007da, 0x001007fe, 0x001007c6, - 0x001007d2, 0x001007ba, 0x001007f9, 0x0010085d, - 0x001007ba, 0x00100860, 0x001007ba, 0x001007ba, - 0x00100864, 0x0010086a, 0x00100888, 0x0010089d, - 0x001007ff, 0x001008a6, 0x001008b2, 0x001007ba, - 0x001007ba, 0x001007ba, 0x0201f800, 0x0010032f, - 0x001007c4, 0x00100949, 0x00100823, 0x0010084c, - 0x001007c4, 0x001007c4, 0x001007c4, 0x001007c4, - 0x0201f800, 0x0010032f, 0x4803c856, 0x59300004, - 0x8c00053e, 0x04020005, 0x42027000, 0x00000055, - 0x0201f000, 0x00020b22, 0x0201f800, 0x00107595, - 0x040007fa, 0x1c01f000, 0x4803c856, 0x0401f8e1, - 0x40002800, 0x41782000, 0x42027000, 0x00000056, - 0x0201f000, 0x00020b22, 0x4803c856, 0x42027000, - 0x00000057, 0x0201f000, 0x00020b22, 0x4803c856, - 0x59325809, 0x812e59c0, 0x04000016, 0x59300008, - 0x8c00051a, 0x0402000d, 0x592c0409, 0x8c00051c, - 0x04020003, 0x4a026012, 0xffffffff, 0x59300004, - 0x8c00053e, 0x04020008, 0x42027000, 0x00000048, - 0x0201f000, 0x00020b22, 0x4a025a07, 0x00000007, - 0x0401f7f5, 0x0201f800, 0x00107595, 0x040007f7, - 0x1c01f000, 0x4803c856, 0x83300500, 0x00ffffff, - 0x0201f000, 0x00106e06, 0x1c01f000, 0x4803c856, - 0x813261c0, 0x02000800, 0x0010032f, 0x0201f800, - 0x00109c4d, 0x0400000d, 0x59325809, 0x592c0209, - 0x84000552, 0x48025a09, 0x0201f800, 0x001010f7, - 0x59300004, 0x8c00053e, 0x04020005, 0x417a7800, - 0x0201f800, 0x001097a0, 0x1c01f000, 0x0201f800, - 0x00107595, 0x040007fa, 0x1c01f000, 0x4c040000, - 0x59b808ea, 0x82040d00, 0x00000007, 0x82040580, - 0x00000003, 0x04000004, 0x42000000, 0x60000000, - 0x0401f8c8, 0x5c000800, 0x1c01f000, 0x0401f916, - 0x0400001b, 0x59325809, 0x812e59c0, 0x04000018, - 0x592c0205, 0x82000500, 0x000000ff, 0x82000d80, - 0x00000029, 0x04020012, 0x59300203, 0x82000580, - 0x00000003, 0x0400000b, 0x59300808, 0x84040d26, - 0x48066008, 0x0201f800, 0x0002011f, 0x4a03900d, - 0x00000040, 0x4a0370e5, 0x00000008, 0x1c01f000, - 0x0201f800, 0x00107595, 0x040007f4, 0x42000000, - 0x0010d536, 0x0201f800, 0x0010c50a, 0x59880151, - 0x80000000, 0x48031151, 0x4a03900d, 0x00000040, - 0x42000000, 0xc0000000, 0x0201f000, 0x00020113, - 0x4c5c0000, 0x4c600000, 0x4c640000, 0x4200c800, - 0x0010e853, 0x4200b800, 0x00003000, 0x4200c000, - 0x00000105, 0x0201f800, 0x001065fd, 0x4a0370e4, - 0x02000000, 0x5c00c800, 0x5c00c000, 0x5c00b800, - 0x1c01f000, 0x4933c857, 0x0201f000, 0x00020afe, - 0x4933c857, 0x0201f800, 0x00100cd5, 0x1c01f000, - 0x41300800, 0x800409c0, 0x02020800, 0x0010032f, - 0x0201f800, 0x00100324, 0x42000000, 0x0010d536, - 0x0201f800, 0x0010c50a, 0x4933c857, 0x813261c0, - 0x02000800, 0x0010032f, 0x0401f842, 0x40002800, - 0x0201f800, 0x0010c473, 0x4c140000, 0x59a8007b, - 0x80000540, 0x04000005, 0x8c142d2a, 0x04000003, - 0x0201f800, 0x00100cd5, 0x5c002800, 0x0401f8ae, - 0x04000007, 0x5932680a, 0x59340200, 0x8c00050e, - 0x59300415, 0x02020800, 0x00109f4a, 0x1c01f000, - 0x42000000, 0x0010d536, 0x0201f800, 0x0010c50a, - 0x4933c857, 0x813261c0, 0x02000800, 0x0010032f, - 0x0401f89d, 0x0400000b, 0x0201f800, 0x00109c4d, - 0x04000008, 0x59325809, 0x592c0209, 0x8400054e, - 0x48025a09, 0x417a7800, 0x0201f800, 0x001097a0, - 0x1c01f000, 0x485fc857, 0x5c000000, 0x4d780000, - 0x4203e000, 0x50000000, 0x4200b800, 0x00008005, - 0x0201f000, 0x00100334, 0x4933c857, 0x83300480, - 0x00000020, 0x02021800, 0x0010032f, 0x83300c00, - 0x0010d5ab, 0x50040000, 0x80000000, 0x04001002, - 0x44000800, 0x1c01f000, 0x4933c857, 0x0401f7f4, - 0x4807c856, 0x59b800ea, 0x8c000510, 0x040007fd, - 0x59b800e0, 0x4803c857, 0x1c01f000, 0x4803c856, - 0x42000000, 0x10000000, 0x41300800, 0x0401f029, - 0x8c000510, 0x02000000, 0x00020119, 0x4c040000, - 0x0401f80b, 0x5c000800, 0x82100480, 0x00000008, - 0x02001000, 0x00020119, 0x4c040000, 0x0401fe9c, - 0x5c000800, 0x0201f000, 0x00020119, 0x59b800e2, - 0x59b820e2, 0x80100580, 0x040207fd, 0x80102114, - 0x0401f001, 0x40101800, 0x800c190a, 0x82100500, - 0x0000001f, 0x820c1d00, 0x0000001f, 0x800c2480, - 0x82102500, 0x0000001f, 0x1c01f000, 0x40680000, - 0x406c0800, 0x0401f807, 0x42018800, 0x00000001, - 0x04020003, 0x42018800, 0x00000000, 0x1c01f000, - 0x82000500, 0xf0000000, 0x82040d00, 0x0fffffff, - 0x80040d40, 0x4807c857, 0x42001000, 0x0010d475, - 0x50080000, 0x80000540, 0x04020005, 0x4a0370e5, - 0x00000003, 0x4a0370e4, 0x00000300, 0x80000000, - 0x44001000, 0x42001000, 0x00000400, 0x59b800ea, - 0x8c000510, 0x0400000c, 0x0401ffd1, 0x82100480, - 0x00000008, 0x04001007, 0x4c040000, 0x4c080000, - 0x0401fe63, 0x5c001000, 0x5c000800, 0x0401f020, - 0x59b800ea, 0x8c000516, 0x0402001d, 0x4a0370e4, - 0x00300000, 0x480770e1, 0x42001000, 0x0000ff00, - 0x80081040, 0x04000012, 0x59b808e4, 0x8c040d28, - 0x040207fc, 0x42001000, 0x0010d475, 0x50080000, - 0x80000040, 0x04020005, 0x4a0370e5, 0x00000002, - 0x4a0370e4, 0x00000200, 0x02001800, 0x0010032f, - 0x44001000, 0x8c040d2c, 0x1c01f000, 0x41f80000, - 0x50000000, 0x0201f800, 0x0010032f, 0x80081040, - 0x040207d3, 0x41f80000, 0x50000000, 0x0201f800, - 0x0010032f, 0x4d380000, 0x59300c07, 0x82040580, - 0x00000009, 0x04020006, 0x42027000, 0x00000047, - 0x0201f800, 0x00020b22, 0x80000580, 0x5c027000, - 0x1c01f000, 0x4c500000, 0x4a03900d, 0x00000001, - 0x59c8a020, 0x4a03900d, 0x00000002, 0x59c80820, - 0x8c50a52e, 0x04000002, 0x900409c0, 0x82040d00, - 0x0000ffff, 0x0201f800, 0x001065bc, 0x5c00a000, - 0x1c01f000, 0x42000000, 0x0010d528, 0x0201f800, - 0x0010c50a, 0x0401ffec, 0x0400005b, 0x4933c857, - 0x59300407, 0x82000580, 0x00000000, 0x04000056, - 0x59c82021, 0x4a03900d, 0x00000001, 0x59c82821, - 0x82142d00, 0x0000ffff, 0x59325809, 0x812e59c0, - 0x0400004d, 0x5932680a, 0x0201f800, 0x00104a92, - 0x02020800, 0x00109f32, 0x599c0019, 0x8c00050c, - 0x04020022, 0x0201f800, 0x00104a92, 0x0402001f, - 0x59300812, 0x4807c857, 0x592c0409, 0x8c00051c, - 0x04020018, 0x8400055c, 0x48025c09, 0x42000000, - 0x0010d4a4, 0x0201f800, 0x0010c50a, 0x592c0a05, - 0x82040d00, 0x000000ff, 0x82040580, 0x00000048, - 0x04000007, 0x82040580, 0x00000018, 0x04000004, - 0x82040580, 0x00000068, 0x04020006, 0x59300012, - 0x0201f800, 0x0010a6e6, 0x80000d40, 0x48065803, - 0x4a026012, 0x7fffffff, 0x59300008, 0x8c000516, - 0x04020021, 0x48166014, 0x0201f800, 0x00104a92, - 0x04000004, 0x59300415, 0x8c00051c, 0x04000004, - 0x599c0019, 0x8c00050c, 0x04000017, 0x0201f800, - 0x00100f5c, 0x04020014, 0x0401fa8f, 0x40280000, - 0x4802600e, 0x04000005, 0x4832600c, 0x50200000, - 0x4802600b, 0x4822600d, 0x59300415, 0x8c00051c, - 0x04020004, 0x599c0019, 0x8c00050c, 0x04020885, - 0x4a03900d, 0x00000040, 0x4a0370e5, 0x00000008, - 0x1c01f000, 0x42000000, 0x0010d536, 0x0201f800, - 0x0010c50a, 0x59880153, 0x80000000, 0x48031153, - 0x4a03900d, 0x00000040, 0x42000000, 0xc0000000, - 0x0201f000, 0x00020113, 0x4cf80000, 0x58f40000, - 0x8001f540, 0x0401f820, 0x41781800, 0x0401f935, - 0x04020014, 0x44140800, 0x0401f82a, 0x04000011, - 0x40043800, 0x42001800, 0x00000001, 0x40142000, - 0x0401f92c, 0x0402000b, 0x801c3800, 0x501c0000, - 0x44000800, 0x0401f810, 0x801c0580, 0x04000004, - 0x44103800, 0x801c3840, 0x44143800, 0x0401f819, - 0x5c01f000, 0x1c01f000, 0x80f9f1c0, 0x04020003, - 0x58f41202, 0x0401f003, 0x42001000, 0x00000007, - 0x1c01f000, 0x80f9f1c0, 0x04020006, 0x58f40401, - 0x82000480, 0x00000002, 0x80f40400, 0x0401f005, - 0x58f80401, 0x82000480, 0x00000002, 0x80f80400, - 0x50002800, 0x80000000, 0x50002000, 0x1c01f000, - 0x80f9f1c0, 0x04020008, 0x58f40401, 0x82000480, - 0x00000002, 0x02001800, 0x0010032f, 0x4801ec01, - 0x0401f00b, 0x58f80401, 0x82000480, 0x00000002, - 0x02001800, 0x0010032f, 0x4801f401, 0x82000580, - 0x00000002, 0x04020002, 0x0401f81b, 0x58f40202, - 0x80000040, 0x4801ea02, 0x02000800, 0x0010032f, - 0x82000580, 0x00000001, 0x1c01f000, 0x82f40580, - 0xffffffff, 0x0400000f, 0x58f40201, 0x82000580, - 0x0000dcb3, 0x02020800, 0x0010032f, 0x58f40000, - 0x8001f540, 0x04000006, 0x58f80201, 0x82000580, - 0x0000ddb9, 0x02020800, 0x0010032f, 0x0401f80a, - 0x1c01f000, 0x4d2c0000, 0x40fa5800, 0x0201f800, - 0x001005aa, 0x4979e800, 0x4179f000, 0x5c025800, - 0x1c01f000, 0x80f5e9c0, 0x04000009, 0x80f9f1c0, - 0x04020ff5, 0x4d2c0000, 0x40f65800, 0x0201f800, - 0x001005aa, 0x4179e800, 0x5c025800, 0x1c01f000, - 0x4cf40000, 0x0201f800, 0x00104a92, 0x04020036, - 0x59300808, 0x82040500, 0x00013100, 0x04020032, - 0x8c040d22, 0x04000032, 0x59300028, 0x8001ed40, - 0x02000800, 0x0010032f, 0x82000580, 0xffffffff, - 0x04000029, 0x58f40201, 0x82000580, 0x0000dcb3, - 0x02020800, 0x0010032f, 0x58f40a02, 0x82040500, - 0x0000fffe, 0x04000003, 0x0401ff74, 0x58f40a02, - 0x82040480, 0x0000000f, 0x04021095, 0x80040800, - 0x4805ea02, 0x82040580, 0x00000008, 0x04000099, - 0x82040480, 0x00000008, 0x0400100a, 0x58f40000, - 0x8001ed40, 0x02000800, 0x0010032f, 0x58f40201, - 0x82000580, 0x0000ddb9, 0x02020800, 0x0010032f, - 0x58f40401, 0x82000c00, 0x00000002, 0x4805ec01, - 0x80f40400, 0x59300813, 0x44040000, 0x80000000, - 0x45780000, 0x5c01e800, 0x1c01f000, 0x42001000, - 0x00000400, 0x59b800e4, 0x8c000524, 0x0402005f, - 0x4a0370e4, 0x00030000, 0x40000000, 0x59b800e4, - 0x8c000524, 0x04020057, 0x59300808, 0x84040d62, - 0x48066008, 0x4a0370e4, 0x00020000, 0x4d2c0000, - 0x0201f800, 0x00100584, 0x04000061, 0x492e6028, - 0x4a025a01, 0x0000dcb3, 0x59300009, 0x80001d40, - 0x02000800, 0x0010032f, 0x580c0810, 0x48065803, - 0x580c0205, 0x82000500, 0x000000ff, 0x82000580, - 0x00000068, 0x04020037, 0x580c1801, 0x800c19c0, - 0x02000800, 0x0010032f, 0x580c0c06, 0x82040d00, - 0x00000003, 0x82040580, 0x00000002, 0x04020003, - 0x592c0803, 0x0401f02b, 0x580c2a07, 0x580c0008, - 0x59301812, 0x800c0580, 0x0400002a, 0x82040580, - 0x00000000, 0x04000012, 0x40140000, 0x4c080000, - 0x400c1000, 0x41780800, 0x0201f800, 0x00107000, - 0x800409c0, 0x02020800, 0x0010032f, 0x82140c00, - 0x00000008, 0x0201f800, 0x00106fe1, 0x5c001000, - 0x40041800, 0x592c0803, 0x0401f022, 0x82140400, - 0x00000008, 0x4c080000, 0x400c1000, 0x41780800, - 0x0201f800, 0x00107000, 0x800409c0, 0x02020800, - 0x0010032f, 0x40140800, 0x0201f800, 0x00106fe1, - 0x5c001000, 0x40041800, 0x592c0803, 0x0401f011, - 0x59301812, 0x40040000, 0x800c0580, 0x0402000d, - 0x497a5a02, 0x4a025c01, 0x00000004, 0x0401f011, - 0x4a0370e4, 0x00020000, 0x40000000, 0x40000000, - 0x80081040, 0x02000800, 0x0010032f, 0x0401f79a, - 0x4a025a02, 0x00000001, 0x4a025c01, 0x00000006, - 0x497a5804, 0x400c0000, 0x80040480, 0x48025805, - 0x412de800, 0x5c025800, 0x0401f76d, 0x5c025800, - 0x4a026028, 0xffffffff, 0x0401f787, 0x4d2c0000, - 0x58f65800, 0x0201f800, 0x001005aa, 0x40f65800, - 0x0201f800, 0x001005aa, 0x5c025800, 0x0401f7f5, - 0x4d2c0000, 0x0201f800, 0x00100584, 0x040007f8, - 0x4a025a01, 0x0000ddb9, 0x4a025c01, 0x00000002, - 0x492de800, 0x412de800, 0x5c025800, 0x0401f769, - 0x0401fee2, 0x82f40400, 0x00000004, 0x800c0400, - 0x40000800, 0x50040000, 0x80100580, 0x04000016, - 0x82040c00, 0x00000002, 0x80081040, 0x040207fa, - 0x80f9f1c0, 0x04000011, 0x58f41202, 0x82081480, - 0x00000007, 0x82f80400, 0x00000002, 0x800c0400, - 0x40000800, 0x50040000, 0x80100580, 0x04000006, - 0x82040c00, 0x00000002, 0x80081040, 0x040207fa, - 0x0401f002, 0x1c01f000, 0x82000540, 0x00000001, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Mon Apr 2 13:25:39 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 84CADF58F8B; Mon, 2 Apr 2018 13:25:39 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 386C27E32F; Mon, 2 Apr 2018 13:25:39 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 33553163CB; Mon, 2 Apr 2018 13:25:39 +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 w32DPdgI062074; Mon, 2 Apr 2018 13:25:39 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w32DPdai062073; Mon, 2 Apr 2018 13:25:39 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201804021325.w32DPdai062073@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 2 Apr 2018 13:25:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331876 - in stable: 10/release 11/release X-SVN-Group: stable-11 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: in stable: 10/release 11/release X-SVN-Commit-Revision: 331876 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Apr 2018 13:25:39 -0000 Author: gjb Date: Mon Apr 2 13:25:38 2018 New Revision: 331876 URL: https://svnweb.freebsd.org/changeset/base/331876 Log: MFC r331806: Add logic for "families" for GCE images. This allows for GCE consumers to easily detect the latest major version of FreeBSD when using the gcloud command line utility. To ensure snapshot builds do not conflict with release-style builds (ALPHA, BETA, RC, RELEASE), the '-snap' suffix is appended to the GCE image family name. Sponsored by: The FreeBSD Foundation Modified: stable/11/release/Makefile.gce Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/release/Makefile.gce Directory Properties: stable/10/ (props changed) Modified: stable/11/release/Makefile.gce ============================================================================== --- stable/11/release/Makefile.gce Mon Apr 2 08:06:18 2018 (r331875) +++ stable/11/release/Makefile.gce Mon Apr 2 13:25:38 2018 (r331876) @@ -18,8 +18,13 @@ CLEANFILES+= ${GCE_UPLOAD_TGTS} GCE_BUCKET?= +.if !defined(GCE_FAMILY) || empty(GCE_FAMILY) +GCE_FAMILY= ${TYPE:tl}-${REVISION:S,.,-,} +.endif + .if ${BRANCH} == "STABLE" || ${BRANCH} == "CURRENT" || ${BRANCH} == "PRERELEASE" SNAPSHOT_DATE!= date +-%Y-%m-%d +GCE_FAMILY_SUFX= -snap .endif # Really? Uppercase characters are not allowed? Sigh... @@ -64,6 +69,7 @@ gce-do-upload: /usr/local/bin/gsutil cp ${.OBJDIR}/${GCE_TARGET}.tar.gz \ gs://${GCE_BUCKET}/ /usr/local/bin/gcloud compute images create ${GCE_TARGET} \ + --family=${GCE_FAMILY}${GCE_FAMILY_SUFX} \ --source-uri gs://${GCE_BUCKET}/${GCE_TARGET}.tar.gz touch ${.OBJDIR}/${.TARGET} From owner-svn-src-stable-11@freebsd.org Mon Apr 2 15:28:49 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 132B3F71CAB; Mon, 2 Apr 2018 15:28:49 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9EC318341B; Mon, 2 Apr 2018 15:28:48 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 95B4A17763; Mon, 2 Apr 2018 15:28:48 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w32FSmRq023857; Mon, 2 Apr 2018 15:28:48 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w32FSmd7023856; Mon, 2 Apr 2018 15:28:48 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804021528.w32FSmd7023856@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 2 Apr 2018 15:28: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: r331880 - stable/11/etc X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/etc X-SVN-Commit-Revision: 331880 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Apr 2018 15:28:49 -0000 Author: kevans Date: Mon Apr 2 15:28:48 2018 New Revision: 331880 URL: https://svnweb.freebsd.org/changeset/base/331880 Log: MFC r328331: Support configuring arbitrary limits(1) for any rc.conf daemon Usage is ${name}_limits, and the argument is any flags accepted by limits(1), such as `-n 100' (e.g. only allow 100 open files). Modified: stable/11/etc/rc.subr Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/rc.subr ============================================================================== --- stable/11/etc/rc.subr Mon Apr 2 15:07:41 2018 (r331879) +++ stable/11/etc/rc.subr Mon Apr 2 15:28:48 2018 (r331880) @@ -773,6 +773,8 @@ check_startmsgs() # # ${name}_login_class n Login class to use, else "daemon". # +# ${name}_limits n limits(1) to apply to ${command}. +# # ${rc_arg}_cmd n If set, use this as the method when invoked; # Otherwise, use default command (see below) # @@ -952,7 +954,7 @@ run_rc_command() _group=\$${name}_group _groups=\$${name}_groups \ _fib=\$${name}_fib _env=\$${name}_env \ _prepend=\$${name}_prepend _login_class=\${${name}_login_class:-daemon} \ - _oomprotect=\$${name}_oomprotect + _limits=\$${name}_limits _oomprotect=\$${name}_oomprotect if [ -n "$_user" ]; then # unset $_user if running as that user if [ "$_user" = "$(eval $IDCMD)" ]; then @@ -1073,7 +1075,7 @@ $command $rc_flags $command_args" fi # Prepend default limits - _doit="$_cd limits -C $_login_class $_doit" + _doit="$_cd limits -C $_login_class $_limits $_doit" # run the full command # From owner-svn-src-stable-11@freebsd.org Mon Apr 2 15:39:41 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2FB9DF726C9; Mon, 2 Apr 2018 15:39:41 +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 A4F7483D99; Mon, 2 Apr 2018 15:39:40 +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 w32Fda83083097; Mon, 2 Apr 2018 08:39:36 -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 w32FdaID083096; Mon, 2 Apr 2018 08:39:36 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201804021539.w32FdaID083096@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r331880 - stable/11/etc In-Reply-To: <201804021528.w32FSmd7023856@repo.freebsd.org> To: Kyle Evans Date: Mon, 2 Apr 2018 08:39:36 -0700 (PDT) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@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-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Apr 2018 15:39:41 -0000 > Author: kevans > Date: Mon Apr 2 15:28:48 2018 > New Revision: 331880 > URL: https://svnweb.freebsd.org/changeset/base/331880 > > Log: > MFC r328331: Support configuring arbitrary limits(1) for any rc.conf daemon > > Usage is ${name}_limits, and the argument is any flags accepted by > limits(1), such as `-n 100' (e.g. only allow 100 open files). > > Modified: > stable/11/etc/rc.subr > Directory Properties: > stable/11/ (props changed) > > Modified: stable/11/etc/rc.subr > ============================================================================== > --- stable/11/etc/rc.subr Mon Apr 2 15:07:41 2018 (r331879) > +++ stable/11/etc/rc.subr Mon Apr 2 15:28:48 2018 (r331880) > @@ -773,6 +773,8 @@ check_startmsgs() > # > # ${name}_login_class n Login class to use, else "daemon". > # > +# ${name}_limits n limits(1) to apply to ${command}. > +# Caution, limits(1) is in /usr/bin, this code can fail if used before /usr is mounted. (Ie, our rc.initdiskless) is probably broken by this change if a call is made to limits. -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-stable-11@freebsd.org Mon Apr 2 16:08:52 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9315CF74675; Mon, 2 Apr 2018 16:08:52 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4425384FD7; Mon, 2 Apr 2018 16:08:52 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3A20517DC7; Mon, 2 Apr 2018 16:08:52 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w32G8qsh044118; Mon, 2 Apr 2018 16:08:52 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w32G8qRH044117; Mon, 2 Apr 2018 16:08:52 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201804021608.w32G8qRH044117@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Mon, 2 Apr 2018 16:08: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: r331881 - stable/11/sys/dev/pdq X-SVN-Group: stable-11 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/11/sys/dev/pdq X-SVN-Commit-Revision: 331881 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Apr 2018 16:08:52 -0000 Author: brooks Date: Mon Apr 2 16:08:51 2018 New Revision: 331881 URL: https://svnweb.freebsd.org/changeset/base/331881 Log: fea(4) was removed in HEAD with the removal of EISA support. This is a direct commit. Modified: stable/11/sys/dev/pdq/if_fea.c Modified: stable/11/sys/dev/pdq/if_fea.c ============================================================================== --- stable/11/sys/dev/pdq/if_fea.c Mon Apr 2 15:28:48 2018 (r331880) +++ stable/11/sys/dev/pdq/if_fea.c Mon Apr 2 16:08:51 2018 (r331881) @@ -234,6 +234,7 @@ pdq_eisa_attach (dev) return (error); } + gone_in_dev(dev, 12, "fea(4) driver"); return (0); bad: pdq_free(dev); From owner-svn-src-stable-11@freebsd.org Mon Apr 2 16:11:50 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AAFF7F74C00; Mon, 2 Apr 2018 16:11:50 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 02BC685423; Mon, 2 Apr 2018 16:11:50 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F1C9B17F27; Mon, 2 Apr 2018 16:11:49 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w32GBnuh046116; Mon, 2 Apr 2018 16:11:49 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w32GBncd046112; Mon, 2 Apr 2018 16:11:49 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201804021611.w32GBncd046112@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Mon, 2 Apr 2018 16:11:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331882 - in stable/11: share/man/man4 sys/dev/cm sys/dev/pdq X-SVN-Group: stable-11 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in stable/11: share/man/man4 sys/dev/cm sys/dev/pdq X-SVN-Commit-Revision: 331882 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Apr 2018 16:11:51 -0000 Author: brooks Date: Mon Apr 2 16:11:49 2018 New Revision: 331882 URL: https://svnweb.freebsd.org/changeset/base/331882 Log: MFC r331830: Add deprecation notices for Arcnet and FDDI drivers. We intend to remove support before FreeBSD 12 is branched. Reviewed by: imp, emaste Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D14890 Modified: stable/11/share/man/man4/cm.4 stable/11/share/man/man4/fpa.4 stable/11/sys/dev/cm/if_cm_isa.c stable/11/sys/dev/pdq/if_fpa.c Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/cm.4 ============================================================================== --- stable/11/share/man/man4/cm.4 Mon Apr 2 16:08:51 2018 (r331881) +++ stable/11/share/man/man4/cm.4 Mon Apr 2 16:11:49 2018 (r331882) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 16, 2005 +.Dd March 29, 2018 .Dt CM 4 .Os .Sh NAME @@ -46,6 +46,12 @@ module at boot time, place the following line in .Bd -literal -offset indent if_cm_load="YES" .Ed +.Sh DEPRECATION NOTICE +The +.Nm +driver is not present in +.Fx 12.0 +and later. .Sh DESCRIPTION The .Nm Modified: stable/11/share/man/man4/fpa.4 ============================================================================== --- stable/11/share/man/man4/fpa.4 Mon Apr 2 16:08:51 2018 (r331881) +++ stable/11/share/man/man4/fpa.4 Mon Apr 2 16:11:49 2018 (r331882) @@ -4,7 +4,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 13, 1995 +.Dd March 29, 2018 .Dt FPA 4 .Os .Sh NAME @@ -18,6 +18,12 @@ .Fx only: .Cd "device fddi" +.Sh DEPRECATION NOTICE +The +.Nm +driver is not present in +.Fx 12.0 +and later. .Sh DESCRIPTION The .Nm Modified: stable/11/sys/dev/cm/if_cm_isa.c ============================================================================== --- stable/11/sys/dev/cm/if_cm_isa.c Mon Apr 2 16:08:51 2018 (r331881) +++ stable/11/sys/dev/cm/if_cm_isa.c Mon Apr 2 16:11:49 2018 (r331882) @@ -111,6 +111,7 @@ cm_isa_attach(dev) if (error) goto err; + gone_in_dev(dev, 12, "cm(4) driver"); return 0; err: Modified: stable/11/sys/dev/pdq/if_fpa.c ============================================================================== --- stable/11/sys/dev/pdq/if_fpa.c Mon Apr 2 16:08:51 2018 (r331881) +++ stable/11/sys/dev/pdq/if_fpa.c Mon Apr 2 16:11:49 2018 (r331882) @@ -156,6 +156,7 @@ pdq_pci_attach(device_t dev) } + gone_in_dev(dev, 12, "fpa(4) driver"); return (0); bad: pdq_free(dev); From owner-svn-src-stable-11@freebsd.org Mon Apr 2 16:13:49 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 83851F74E1A; Mon, 2 Apr 2018 16:13:49 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-wm0-f45.google.com (mail-wm0-f45.google.com [74.125.82.45]) (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 01BB285926; Mon, 2 Apr 2018 16:13:48 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-wm0-f45.google.com with SMTP id t67so6760877wmt.0; Mon, 02 Apr 2018 09:13:48 -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:in-reply-to:references:from:date :message-id:subject:to:cc; bh=FgkGMqDrQXhoBZmKwXpEx7Zc99nVi/+dnSvXHoTxHAY=; b=BRSYwqZNzoZwbvvwnuTQSyuTBWTrr1WmQ4Vu5b/tb0YNdgoByBy94ois6s1iMoLjER gDqXGSm4alaxawlDsz+xovGhR2hshJy70UDrLCFB0BW2mFIxRTDA4ErRXntVaNX/uX9C uIlMuey4OisBBUGk8IpRHljD7EqPT7NMcuaCAcaq85aAEFm78oUAhBgCyHdehPUtdtM1 CL9u/zm+XJgJZaO6B6vGWT2iCJa3UgiBUWD3XvuKdyB2YW25Ri5043whEtX1BtOHVZWw VMPwiRyaXrH2NrYlHVnhB+Iv6QYaesgas0dZ9zoj9eXMEUTdIVr8XCwLe5Dszq0+TpQZ C2cQ== X-Gm-Message-State: AElRT7EZ0PcCzRqqvJ6qEe5klfNCOipHEy+lP8fz0+50YDg//1h4PZ9f +j5MSlopizTjfgXX+g4PFdf/LbE1 X-Google-Smtp-Source: AIpwx4+Gfho+Im/PRGwOCB69qSAWdQzx81CdBGB4w7TviifRds+G+MErhZzED21rdlWLis4LIz5j/Q== X-Received: by 10.80.155.6 with SMTP id o6mr13277479edi.280.1522685312305; Mon, 02 Apr 2018 09:08:32 -0700 (PDT) Received: from mail-wr0-f175.google.com (mail-wr0-f175.google.com. [209.85.128.175]) by smtp.gmail.com with ESMTPSA id v16sm568403edc.5.2018.04.02.09.08.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Apr 2018 09:08:31 -0700 (PDT) Received: by mail-wr0-f175.google.com with SMTP id y55so14463441wry.3; Mon, 02 Apr 2018 09:08:31 -0700 (PDT) X-Received: by 2002:a19:c4c8:: with SMTP id u191-v6mr6329871lff.109.1522685311446; Mon, 02 Apr 2018 09:08:31 -0700 (PDT) MIME-Version: 1.0 Received: by 10.46.129.90 with HTTP; Mon, 2 Apr 2018 09:08:10 -0700 (PDT) In-Reply-To: <201804021539.w32FdaID083096@pdx.rh.CN85.dnsmgr.net> References: <201804021528.w32FSmd7023856@repo.freebsd.org> <201804021539.w32FdaID083096@pdx.rh.CN85.dnsmgr.net> From: Kyle Evans Date: Mon, 2 Apr 2018 11:08:10 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r331880 - stable/11/etc To: "Rodney W. Grimes" Cc: Kyle Evans , src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Apr 2018 16:13:49 -0000 On Mon, Apr 2, 2018 at 10:39 AM, Rodney W. Grimes wrote: >> Author: kevans >> Date: Mon Apr 2 15:28:48 2018 >> New Revision: 331880 >> URL: https://svnweb.freebsd.org/changeset/base/331880 >> >> Log: >> MFC r328331: Support configuring arbitrary limits(1) for any rc.conf daemon >> >> Usage is ${name}_limits, and the argument is any flags accepted by >> limits(1), such as `-n 100' (e.g. only allow 100 open files). >> >> Modified: >> stable/11/etc/rc.subr >> Directory Properties: >> stable/11/ (props changed) >> >> Modified: stable/11/etc/rc.subr >> ============================================================================== >> --- stable/11/etc/rc.subr Mon Apr 2 15:07:41 2018 (r331879) >> +++ stable/11/etc/rc.subr Mon Apr 2 15:28:48 2018 (r331880) >> @@ -773,6 +773,8 @@ check_startmsgs() >> # >> # ${name}_login_class n Login class to use, else "daemon". >> # >> +# ${name}_limits n limits(1) to apply to ${command}. >> +# > > Caution, limits(1) is in /usr/bin, this code can fail if used before > /usr is mounted. (Ie, our rc.initdiskless) is probably broken by > this change if a call is made to limits. > I believe this is a non-issue in this case-- this didn't add any limits(1) invocations, it just allowed flags to be passed to the limits(1) invocation that was already being made. From owner-svn-src-stable-11@freebsd.org Mon Apr 2 16:28:09 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AD973F759EE; Mon, 2 Apr 2018 16:28:09 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it0-x243.google.com (mail-it0-x243.google.com [IPv6:2607:f8b0:4001:c0b::243]) (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 40F3886133; Mon, 2 Apr 2018 16:28:09 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it0-x243.google.com with SMTP id b5-v6so8681958itj.1; Mon, 02 Apr 2018 09:28:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=k0k16zOfogxI7Xlo3+BAvhMm3DTIneQ3I/r+MUxXoGo=; b=GlkkRG/+fFFFdmXb9n0kscxVtTMQDIXEwFQZuFfrxuugXChOiXFe7viGvhgd+WZ8HM zfxhhgvJ1RtHmCtjhxXtQo1l2mLFbP5QWA+a0WxqdlS4Aq6SNRnENFV9en+X7BNrFbjJ edb0mlUkBEYK57pclkhXRJATglCsZB+HYjsopusRuii+JwsO5jS902FthMR5u3Xv3qGT Hg/fv7hiNF7gqOurBb56JuBxCPLP5WtG6Jgo20pk1UX75Y6s+4x0IuGYP0Fv2ND8sC82 l3ZD07Y9WVjtXmzLqjZE/RV4eKpI6maW0mpcAvbNWwyEjJ3S9RI4BSvVnn2M6gBwTb2f rdLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=k0k16zOfogxI7Xlo3+BAvhMm3DTIneQ3I/r+MUxXoGo=; b=m5dhJmYMNAPQBVJt+/Et+K4I7AI4OA5vRGu5civwLJ3MTpHnCR+FI+Sbm/46G1f1wh IkXZMeiOkPt5tWbKX16jWsZ+uQ2XOm/rfgROmvufM1DtNwWlA9tQw8d/ZJRaW/Ck5l0B JJPhSo9Ix1YEDEqtjeFZQp7cztxvmAVGkWFzXfbeFDJ1hppu9NTIRujSn+Lo4XQ+oCn2 owz2GKZFm2y/fE37hcgGv/rtydm/FGTkX8VKTw4cvT2fy7CW06vynsl0ju5jLn9gZM4H /9CzDGXoDVn2ky4GRy/haPvuvpE7UKho+MNyuHPqnSiZMxTWhKSYgOY6iVzUMhgwd7GE +zQA== X-Gm-Message-State: ALQs6tCmeeVYHzrnwK7LUUrdeKEvDMCqpF/fHxjFWJrkDal00ElbG0WI UktT8xbhqzkC8XSe7GrPLHWzqT0d1o+4YKDkuQG65RiB X-Google-Smtp-Source: AIpwx49sIDI0N48wxlvvLfUP2JOetbHRuU+xns6jRGzZSs2bfq7TCkm3zViQGSTepe7qP1YST/FURYSWpCeh6Ok018Y= X-Received: by 2002:a24:a0c6:: with SMTP id o189-v6mr1630225ite.52.1522686488358; Mon, 02 Apr 2018 09:28:08 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.130.197 with HTTP; Mon, 2 Apr 2018 09:27:47 -0700 (PDT) In-Reply-To: <20180331184109.GA23589@lonesome.com> References: <201803311138.w2VBcKHP014025@repo.freebsd.org> <68DEEF9A-6290-40AD-B51D-E187593C089F@FreeBSD.org> <20180331131818.GA22697@lonesome.com> <20180331184109.GA23589@lonesome.com> From: Ed Maste Date: Mon, 2 Apr 2018 12:27:47 -0400 X-Google-Sender-Auth: LYvyMa4jMGZVNSCyBmnx2DnRTUY Message-ID: Subject: Re: svn commit: r331838 - in stable/11: . contrib/compiler-rt/include/sanitizer contrib/compiler-rt/include/xray contrib/compiler-rt/lib/BlocksRuntime contrib/compiler-rt/lib/asan contrib/compiler-rt/l... To: Mark Linimon Cc: Dimitry Andric , Antoine Brodin , svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers , re , svn-src-stable-11@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Apr 2018 16:28:10 -0000 On 31 March 2018 at 14:41, Mark Linimon wrote: > > Number of ports with no maintainer: 4625 (16.5%) > > (that number is a bit stale) > > Add the number of port maintainers that are no longer active, overwhelmed > "group" maintainers, and the number of maintainers who only run -stable, > and you have a significant number. Do we have a good way of identifying maintainers who are no longer active? It's understandable that people, and especially volunteers, are going to get busy and may not be so responsive from time to time. On the other hand, it's unfortunate to repeatedly add weeks or months of latency if the maintainer is truly inactive. > Please also consider the fact that the _correct_ way to get patches like > this done is to submit them to the upstream (if it still exists) and get > them to incorporate them. That takes time, as well. I'd argue that the best way to handle cases like this is to develop a patch, ./configure change, workaround etc., simultaneously submitting upstream and committing to the ports tree. This way the port builds and is available for our users right away, upstream benefits from our work, and we don't need to carry a patch indefinitely (assuming upstream accepts it). An approach that relies on upstream accepting first the patch and then producing a new release I suspect is not viable given the variability in responsiveness of different upstreams. > Now let me add a personal irritation: no one has bothered doing a writeup > on "here's how you fix old broken code that no longer works." I am neither > a compiler expert nor a C++ expert -- I can sit around and twiddle knobs > and see if that makes things work, but that's not the type of commit I want > to make. (I have already been trying this with consolekit2, to absolutely > no result.) It's quite difficult to write that up in general, but one thing that is likely feasible is to identify and report common issues; I've tried to do that while working on the switch to lld as /usr/bin/ld - there are a small number of issues that come up with some regularity, and many that are unique. It's a lot harder to enumerate the failures that we'll see due to the compiler though, and the fixes or workarounds are also a lot more varied. > The folks that will suffer are the users who build their own packages, who > will find a large number of regressions with no warning. (e.g., there is > nothing in the ports UPDATING file yet.) Fair point, we should have an entry in UPDATING. > Please see the lld work that emaste has been doing for the type of thing > that makes working on ports a lot more bearable. My work's a bit of a different case though: I'm working to replace an existing and obsolete toolchain component that is not going to be upgraded, is on a deprecation path, and is relatively self-contained, so has different challenges and issues than a compiler upgrade. > tl;dr: this is the type of thing that needs coordination between various > teams. This is the most important point of this discussion: we do need to ensure there's good communication and coordination between teams where dependencies like this exist. I'll take the blame here: Dimitry asked me about merging the Clang update to stable/11 and I agreed that it was reasonable to merge sooner rather than later to have as much lead time as possible before the 11.2 process starts. I also assumed that outstanding Clang 6 issues in ports were farther along in being addressed. The key lesson from this discussion is that for significant commits and merges like this one we should make sure to always have sufficient advance notice. From owner-svn-src-stable-11@freebsd.org Mon Apr 2 20:47:56 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B87FEF8440B; Mon, 2 Apr 2018 20:47:56 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6B04171408; Mon, 2 Apr 2018 20:47:56 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 61A5B1AAF7; Mon, 2 Apr 2018 20:47:56 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w32Klua7087270; Mon, 2 Apr 2018 20:47:56 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w32Kluj1087266; Mon, 2 Apr 2018 20:47:56 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201804022047.w32Kluj1087266@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Mon, 2 Apr 2018 20:47: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: r331885 - stable/11/sys/dev/uart X-SVN-Group: stable-11 X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: stable/11/sys/dev/uart X-SVN-Commit-Revision: 331885 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Apr 2018 20:47:57 -0000 Author: gonzo Date: Mon Apr 2 20:47:55 2018 New Revision: 331885 URL: https://svnweb.freebsd.org/changeset/base/331885 Log: MFC r303100 by andrew: We will be switching to a new arm64 uart cpu driver that handles both FDT and ACPI. As such pull out what will be the common parts of the FDT cpu detection to a new function that can be shared between them. Reviewed by: manu Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D7262 Modified: stable/11/sys/dev/uart/uart_bus_fdt.c stable/11/sys/dev/uart/uart_cpu_fdt.c stable/11/sys/dev/uart/uart_cpu_fdt.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/uart/uart_bus_fdt.c ============================================================================== --- stable/11/sys/dev/uart/uart_bus_fdt.c Mon Apr 2 20:12:25 2018 (r331884) +++ stable/11/sys/dev/uart/uart_bus_fdt.c Mon Apr 2 20:47:55 2018 (r331885) @@ -105,6 +105,129 @@ uart_fdt_find_device(device_t dev) } static int +phandle_chosen_propdev(phandle_t chosen, const char *name, phandle_t *node) +{ + char buf[64]; + + if (OF_getprop(chosen, name, buf, sizeof(buf)) <= 0) + return (ENXIO); + if ((*node = OF_finddevice(buf)) == -1) + return (ENXIO); + + return (0); +} + +static const struct ofw_compat_data * +uart_fdt_find_compatible(phandle_t node, const struct ofw_compat_data *cd) +{ + const struct ofw_compat_data *ocd; + + for (ocd = cd; ocd->ocd_str != NULL; ocd++) { + if (fdt_is_compatible(node, ocd->ocd_str)) + return (ocd); + } + return (NULL); +} + +static uintptr_t +uart_fdt_find_by_node(phandle_t node, int class_list) +{ + struct ofw_compat_data **cd; + const struct ofw_compat_data *ocd; + + if (class_list) { + SET_FOREACH(cd, uart_fdt_class_set) { + ocd = uart_fdt_find_compatible(node, *cd); + if ((ocd != NULL) && (ocd->ocd_data != 0)) + return (ocd->ocd_data); + } + } else { + SET_FOREACH(cd, uart_fdt_class_and_device_set) { + ocd = uart_fdt_find_compatible(node, *cd); + if ((ocd != NULL) && (ocd->ocd_data != 0)) + return (ocd->ocd_data); + } + } + + return (0); +} + +int +uart_cpu_fdt_probe(struct uart_class **classp, bus_space_tag_t *bst, + bus_space_handle_t *bsh, int *baud, u_int *rclk, u_int *shiftp) +{ + const char *propnames[] = {"stdout-path", "linux,stdout-path", "stdout", + "stdin-path", "stdin", NULL}; + const char **name; + struct uart_class *class; + phandle_t node, chosen; + pcell_t br, clk, shift; + char *cp; + int err; + + /* Has the user forced a specific device node? */ + cp = kern_getenv("hw.fdt.console"); + if (cp == NULL) { + /* + * Retrieve /chosen/std{in,out}. + */ + node = -1; + if ((chosen = OF_finddevice("/chosen")) != -1) { + for (name = propnames; *name != NULL; name++) { + if (phandle_chosen_propdev(chosen, *name, + &node) == 0) + break; + } + } + if (chosen == -1 || *name == NULL) + node = OF_finddevice("serial0"); /* Last ditch */ + } else { + node = OF_finddevice(cp); + } + + if (node == -1) + return (ENXIO); + + /* + * Check old style of UART definition first. Unfortunately, the common + * FDT processing is not possible if we have clock, power domains and + * pinmux stuff. + */ + class = (struct uart_class *)uart_fdt_find_by_node(node, 0); + if (class != NULL) { + if ((err = uart_fdt_get_clock(node, &clk)) != 0) + return (err); + } else { + /* Check class only linker set */ + class = + (struct uart_class *)uart_fdt_find_by_node(node, 1); + if (class == NULL) + return (ENXIO); + clk = 0; + } + + /* + * Retrieve serial attributes. + */ + if (uart_fdt_get_shift(node, &shift) != 0) + shift = uart_getregshift(class); + + if (OF_getencprop(node, "current-speed", &br, sizeof(br)) <= 0) + br = 0; + + err = OF_decode_addr(node, 0, bst, bsh, NULL); + if (err != 0) + return (err); + + *classp = class; + *baud = br; + *rclk = clk; + *shiftp = shift; + + return (0); +} + +static int uart_fdt_probe(device_t dev) { struct uart_softc *sc; Modified: stable/11/sys/dev/uart/uart_cpu_fdt.c ============================================================================== --- stable/11/sys/dev/uart/uart_cpu_fdt.c Mon Apr 2 20:12:25 2018 (r331884) +++ stable/11/sys/dev/uart/uart_cpu_fdt.c Mon Apr 2 20:47:55 2018 (r331885) @@ -120,14 +120,11 @@ uart_fdt_find_by_node(phandle_t node, int class_list) int uart_cpu_getdev(int devtype, struct uart_devinfo *di) { - const char *propnames[] = {"stdout-path", "linux,stdout-path", "stdout", - "stdin-path", "stdin", NULL}; - const char **name; struct uart_class *class; - phandle_t node, chosen; - pcell_t shift, br, rclk; - char *cp; - int err; + bus_space_tag_t bst; + bus_space_handle_t bsh; + u_int shift, rclk; + int br, err; /* Allow overriding the FDT using the environment. */ class = &uart_ns8250_class; @@ -138,69 +135,24 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di) if (devtype != UART_DEV_CONSOLE) return (ENXIO); - /* Has the user forced a specific device node? */ - cp = kern_getenv("hw.fdt.console"); - if (cp == NULL) { - /* - * Retrieve /chosen/std{in,out}. - */ - node = -1; - if ((chosen = OF_finddevice("/chosen")) != -1) { - for (name = propnames; *name != NULL; name++) { - if (phandle_chosen_propdev(chosen, *name, - &node) == 0) - break; - } - } - if (chosen == -1 || *name == NULL) - node = OF_finddevice("serial0"); /* Last ditch */ - } else { - node = OF_finddevice(cp); - } + err = uart_cpu_fdt_probe(&class, &bst, &bsh, &br, &rclk, &shift); + if (err != 0) + return (err); - if (node == -1) /* Can't find anything */ - return (ENXIO); - /* - * Check old style of UART definition first. Unfortunately, the common - * FDT processing is not possible if we have clock, power domains and - * pinmux stuff. - */ - class = (struct uart_class *)uart_fdt_find_by_node(node, 0); - if (class != NULL) { - if ((err = uart_fdt_get_clock(node, &rclk)) != 0) - return (err); - } else { - /* Check class only linker set */ - class = - (struct uart_class *)uart_fdt_find_by_node(node, 1); - if (class == NULL) - return (ENXIO); - rclk = 0; - } - - /* - * Retrieve serial attributes. - */ - if (uart_fdt_get_shift(node, &shift) != 0) - shift = uart_getregshift(class); - - if (OF_getencprop(node, "current-speed", &br, sizeof(br)) <= 0) - br = 0; - - /* * Finalize configuration. */ di->bas.chan = 0; - di->bas.regshft = (u_int)shift; + di->bas.regshft = shift; di->baudrate = br; - di->bas.rclk = (u_int)rclk; + di->bas.rclk = rclk; di->ops = uart_getops(class); di->databits = 8; di->stopbits = 1; di->parity = UART_PARITY_NONE; + di->bas.bst = bst; + di->bas.bsh = bsh; - err = OF_decode_addr(node, 0, &di->bas.bst, &di->bas.bsh, NULL); uart_bus_space_mem = di->bas.bst; uart_bus_space_io = NULL; Modified: stable/11/sys/dev/uart/uart_cpu_fdt.h ============================================================================== --- stable/11/sys/dev/uart/uart_cpu_fdt.h Mon Apr 2 20:12:25 2018 (r331884) +++ stable/11/sys/dev/uart/uart_cpu_fdt.h Mon Apr 2 20:47:55 2018 (r331885) @@ -50,6 +50,8 @@ SET_DECLARE(uart_fdt_class_set, struct ofw_compat_data #define UART_FDT_CLASS(data) \ DATA_SET(uart_fdt_class_set, data) +int uart_cpu_fdt_probe(struct uart_class **, bus_space_tag_t *, + bus_space_handle_t *, int *, u_int *, u_int *); int uart_fdt_get_clock(phandle_t node, pcell_t *cell); int uart_fdt_get_shift(phandle_t node, pcell_t *cell); From owner-svn-src-stable-11@freebsd.org Mon Apr 2 20:54:34 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0CBF0F84A06; Mon, 2 Apr 2018 20:54:34 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B418B719F2; Mon, 2 Apr 2018 20:54:33 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 90E091AC86; Mon, 2 Apr 2018 20:54:33 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w32KsXno092123; Mon, 2 Apr 2018 20:54:33 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w32KsXDs092120; Mon, 2 Apr 2018 20:54:33 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201804022054.w32KsXDs092120@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Mon, 2 Apr 2018 20:54:33 +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: r331886 - in stable/11/sys/dev: fdt uart usb/net X-SVN-Group: stable-11 X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: in stable/11/sys/dev: fdt uart usb/net X-SVN-Commit-Revision: 331886 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Apr 2018 20:54:34 -0000 Author: gonzo Date: Mon Apr 2 20:54:33 2018 New Revision: 331886 URL: https://svnweb.freebsd.org/changeset/base/331886 Log: MFC r308533 by andrew: Use ofw_bus_node_is_compatible in more drivers used on arm. Sponsored by: ABT Systems Ltd Modified: stable/11/sys/dev/fdt/fdt_arm_platform.c stable/11/sys/dev/uart/uart_bus_fdt.c stable/11/sys/dev/usb/net/if_smsc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/fdt/fdt_arm_platform.c ============================================================================== --- stable/11/sys/dev/fdt/fdt_arm_platform.c Mon Apr 2 20:47:55 2018 (r331885) +++ stable/11/sys/dev/fdt/fdt_arm_platform.c Mon Apr 2 20:54:33 2018 (r331886) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include "platform_if.h" @@ -58,7 +59,7 @@ fdt_platform_probe(platform_t plat) /* Is the device is compatible? */ root = OF_finddevice("/"); compat = FDT_PLATFORM(plat)->fdt_compatible; - if (fdt_is_compatible(root, compat) != 0) + if (ofw_bus_node_is_compatible(root, compat) != 0) return 0; /* Not compatible, return an error */ Modified: stable/11/sys/dev/uart/uart_bus_fdt.c ============================================================================== --- stable/11/sys/dev/uart/uart_bus_fdt.c Mon Apr 2 20:47:55 2018 (r331885) +++ stable/11/sys/dev/uart/uart_bus_fdt.c Mon Apr 2 20:54:33 2018 (r331886) @@ -123,7 +123,7 @@ uart_fdt_find_compatible(phandle_t node, const struct const struct ofw_compat_data *ocd; for (ocd = cd; ocd->ocd_str != NULL; ocd++) { - if (fdt_is_compatible(node, ocd->ocd_str)) + if (ofw_bus_node_is_compatible(node, ocd->ocd_str)) return (ocd); } return (NULL); Modified: stable/11/sys/dev/usb/net/if_smsc.c ============================================================================== --- stable/11/sys/dev/usb/net/if_smsc.c Mon Apr 2 20:47:55 2018 (r331885) +++ stable/11/sys/dev/usb/net/if_smsc.c Mon Apr 2 20:54:33 2018 (r331886) @@ -1568,8 +1568,8 @@ smsc_fdt_find_eth_node(phandle_t start) /* Traverse through entire tree to find usb ethernet nodes. */ for (node = OF_child(start); node != 0; node = OF_peer(node)) { - if (fdt_is_compatible(node, "net,ethernet") && - fdt_is_compatible(node, "usb,device")) + if (ofw_bus_node_is_compatible(node, "net,ethernet") && + ofw_bus_node_is_compatible(node, "usb,device")) return (node); child = smsc_fdt_find_eth_node(node); if (child != -1) From owner-svn-src-stable-11@freebsd.org Mon Apr 2 21:38:51 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F74CF86F75; Mon, 2 Apr 2018 21:38:51 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 02AF073989; Mon, 2 Apr 2018 21:38:51 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F1BAC1B30F; Mon, 2 Apr 2018 21:38:50 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w32LcomJ013307; Mon, 2 Apr 2018 21:38:50 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w32Lco0n013306; Mon, 2 Apr 2018 21:38:50 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201804022138.w32Lco0n013306@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Mon, 2 Apr 2018 21:38: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: r331888 - stable/11/sys/arm/nvidia X-SVN-Group: stable-11 X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: stable/11/sys/arm/nvidia X-SVN-Commit-Revision: 331888 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Apr 2018 21:38:51 -0000 Author: gonzo Date: Mon Apr 2 21:38:50 2018 New Revision: 331888 URL: https://svnweb.freebsd.org/changeset/base/331888 Log: MFC r302498 by andrew: Remove an unneeded call to fdt_get_unit, the return value is unused. Sponsored by: ABT Systems Ltd Modified: stable/11/sys/arm/nvidia/tegra_pcie.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/nvidia/tegra_pcie.c ============================================================================== --- stable/11/sys/arm/nvidia/tegra_pcie.c Mon Apr 2 21:33:16 2018 (r331887) +++ stable/11/sys/arm/nvidia/tegra_pcie.c Mon Apr 2 21:38:50 2018 (r331888) @@ -1256,7 +1256,7 @@ tegra_pcib_set_bar(struct tegra_pcib_softc *sc, int ba } static int -tegra_pcib_enable(struct tegra_pcib_softc *sc, uint32_t port) +tegra_pcib_enable(struct tegra_pcib_softc *sc) { int rv; int i; @@ -1442,7 +1442,6 @@ tegra_pcib_attach(device_t dev) { struct tegra_pcib_softc *sc; phandle_t node; - uint32_t unit; int rv; int rid; struct tegra_pcib_port *port; @@ -1450,7 +1449,6 @@ tegra_pcib_attach(device_t dev) sc = device_get_softc(dev); sc->dev = dev; - unit = fdt_get_unit(dev); mtx_init(&sc->mtx, "msi_mtx", NULL, MTX_DEF); node = ofw_bus_get_node(dev); @@ -1552,7 +1550,7 @@ tegra_pcib_attach(device_t dev) /* * Enable PCIE device. */ - rv = tegra_pcib_enable(sc, unit); + rv = tegra_pcib_enable(sc); if (rv != 0) goto out; for (i = 0; i < TEGRA_PCIB_MAX_PORTS; i++) { From owner-svn-src-stable-11@freebsd.org Mon Apr 2 21:48:30 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BF8E0F87868; Mon, 2 Apr 2018 21:48:30 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6AE7973FF4; Mon, 2 Apr 2018 21:48:30 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6149A1B4B6; Mon, 2 Apr 2018 21:48:30 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w32LmU5m018180; Mon, 2 Apr 2018 21:48:30 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w32LmTXA018175; Mon, 2 Apr 2018 21:48:29 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201804022148.w32LmTXA018175@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Mon, 2 Apr 2018 21:48:29 +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: r331889 - in stable/11/sys: arm/broadcom/bcm2835 boot/fdt/dts/arm sys X-SVN-Group: stable-11 X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: in stable/11/sys: arm/broadcom/bcm2835 boot/fdt/dts/arm sys X-SVN-Commit-Revision: 331889 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Apr 2018 21:48:31 -0000 Author: gonzo Date: Mon Apr 2 21:48:29 2018 New Revision: 331889 URL: https://svnweb.freebsd.org/changeset/base/331889 Log: MFC r303035 by markm: Random bit generator (RBG) driver for RPi and RPi2. Summary: This driver supports the following methods to trigger gathering random bits from the hardware: 1. interrupt when the FIFO is full (default) fed into the harvest queue 2. callout (when BCM2835_RNG_USE_CALLOUT is defined) every second if hz is less than 100, otherwise hz / 100, feeding the random bits into the harvest queue If the kernel is booted with verbose enabled, the contents of the registers will be dumped after the RBG is started during the attach routine. Author: hackagadget_gmail.com (Stephen J. Kiernan) Test Plan: Built RPI2 kernel and booted on board. Tested the different methods to feed the harvest queue (callout, interrupt) and the interrupt driven approach seems best. However, keeping the other method for people to be able to experiment with. Reviewed By: adrian, delphij, markm Differential Revision: https://reviews.freebsd.org/D6888 Added: stable/11/sys/arm/broadcom/bcm2835/bcm2835_rng.c - copied unchanged from r303035, head/sys/arm/broadcom/bcm2835/bcm2835_rng.c Modified: stable/11/sys/arm/broadcom/bcm2835/files.bcm283x stable/11/sys/boot/fdt/dts/arm/bcm2835.dtsi stable/11/sys/boot/fdt/dts/arm/bcm2836.dtsi stable/11/sys/sys/random.h Directory Properties: stable/11/ (props changed) Copied: stable/11/sys/arm/broadcom/bcm2835/bcm2835_rng.c (from r303035, head/sys/arm/broadcom/bcm2835/bcm2835_rng.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/arm/broadcom/bcm2835/bcm2835_rng.c Mon Apr 2 21:48:29 2018 (r331889, copy of r303035, head/sys/arm/broadcom/bcm2835/bcm2835_rng.c) @@ -0,0 +1,534 @@ +/* + * Copyright (c) 2015, 2016, Stephen J. Kiernan + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include + +#if !defined(BCM2835_RNG_USE_CALLOUT) +#define BCM2835_RNG_USE_INTERRUPT +#endif + +static device_attach_t bcm2835_rng_attach; +static device_detach_t bcm2835_rng_detach; +static device_probe_t bcm2835_rng_probe; + +#define RNG_CTRL 0x00 /* RNG Control Register */ +#define RNG_COMBLK1_OSC 0x003f0000 /* Combiner Blk 1 Oscillator */ +#define RNG_COMBLK1_OSC_SHIFT 16 +#define RNG_COMBLK2_OSC 0x0fc00000 /* Combiner Blk 2 Oscillator */ +#define RNG_COMBLK2_OSC_SHIFT 22 +#define RNG_JCLK_BYP_DIV_CNT 0x0000ff00 /* Jitter clk bypass divider + count */ +#define RNG_JCLK_BYP_DIV_CNT_SHIFT 8 +#define RNG_JCLK_BYP_SRC 0x00000020 /* Jitter clk bypass source */ +#define RNG_JCLK_BYP_SEL 0x00000010 /* Jitter clk bypass select */ +#define RNG_RBG2X 0x00000002 /* RBG 2X SPEED */ +#define RNG_RBGEN_BIT 0x00000001 /* Enable RNG bit */ + +#define RNG_STATUS 0x04 /* RNG status register */ +#define RND_VAL_SHIFT 24 /* Shift for valid words */ +#define RND_VAL_MASK 0x000000ff /* Number valid words mask */ +#define RND_VAL_WARM_CNT 0x40000 /* RNG Warm Up count */ +#define RND_WARM_CNT 0xfffff /* RNG Warm Up Count mask */ + +#define RNG_DATA 0x08 /* RNG Data Register */ +#define RNG_FF_THRES 0x0c +#define RNG_FF_THRES_MASK 0x0000001f + +#define RNG_INT_MASK 0x10 +#define RNG_INT_OFF_BIT 0x00000001 + +#define RNG_FF_DEFAULT 0x10 /* FIFO threshold default */ + +#define RNG_FIFO_WORDS (RNG_FF_DEFAULT / sizeof(uint32_t)) + +#define RNG_NUM_OSCILLATORS 6 +#define RNG_STALL_COUNT_DEFAULT 10 + +struct bcm2835_rng_softc { + device_t sc_dev; + struct resource * sc_mem_res; + struct resource * sc_irq_res; + void * sc_intr_hdl; +#if defined(BCM2835_RNG_USE_CALLOUT) || defined(BCM2835_RNG_USE_INTERRUPT) + uint32_t sc_buf[RNG_FIFO_WORDS]; +#endif +#if defined(BCM2835_RNG_USE_CALLOUT) + struct callout sc_rngto; + int sc_rnghz; +#endif + int sc_stall_count; + int sc_rbg2x; + long sc_underrun; +}; + +static __inline void +bcm2835_rng_stat_inc_underrun(struct bcm2835_rng_softc *sc) +{ + + atomic_add_long(&sc->sc_underrun, 1); +} + +static __inline uint32_t +bcm2835_rng_read4(struct bcm2835_rng_softc *sc, bus_size_t off) +{ + + return bus_read_4(sc->sc_mem_res, off); +} + +static __inline void +bcm2835_rng_read_multi4(struct bcm2835_rng_softc *sc, bus_size_t off, + uint32_t *datap, bus_size_t count) +{ + + bus_read_multi_4(sc->sc_mem_res, off, datap, count); +} + +static __inline void +bcm2835_rng_write4(struct bcm2835_rng_softc *sc, bus_size_t off, uint32_t val) +{ + + bus_write_4(sc->sc_mem_res, off, val); +} + +static void +bcm2835_rng_dump_registers(struct bcm2835_rng_softc *sc, struct sbuf *sbp) +{ + uint32_t comblk2_osc, comblk1_osc, jclk_byp_div, val; + int i; + + /* Display RNG control register contents */ + val = bcm2835_rng_read4(sc, RNG_CTRL); + sbuf_printf(sbp, "RNG_CTRL (%08x)\n", val); + + comblk2_osc = (val & RNG_COMBLK2_OSC) >> RNG_COMBLK2_OSC_SHIFT; + sbuf_printf(sbp, " RNG_COMBLK2_OSC (%02x)\n", comblk2_osc); + for (i = 0; i < RNG_NUM_OSCILLATORS; i++) + if ((comblk2_osc & (1 << i)) == 0) + sbuf_printf(sbp, " Oscillator %d enabled\n", i + 1); + + comblk1_osc = (val & RNG_COMBLK1_OSC) >> RNG_COMBLK1_OSC_SHIFT; + sbuf_printf(sbp, " RNG_COMBLK1_OSC (%02x)\n", comblk1_osc); + for (i = 0; i < RNG_NUM_OSCILLATORS; i++) + if ((comblk1_osc & (1 << i)) == 0) + sbuf_printf(sbp, " Oscillator %d enabled\n", i + 1); + + jclk_byp_div = (val & RNG_JCLK_BYP_DIV_CNT) >> + RNG_JCLK_BYP_DIV_CNT_SHIFT; + sbuf_printf(sbp, + " RNG_JCLK_BYP_DIV_CNT (%02x)\n APB clock frequency / %d\n", + jclk_byp_div, 2 * (jclk_byp_div + 1)); + + sbuf_printf(sbp, " RNG_JCLK_BYP_SRC:\n %s\n", + (val & RNG_JCLK_BYP_SRC) ? "Use divided down APB clock" : + "Use RNG clock (APB clock)"); + + sbuf_printf(sbp, " RNG_JCLK_BYP_SEL:\n %s\n", + (val & RNG_JCLK_BYP_SEL) ? "Bypass internal jitter clock" : + "Use internal jitter clock"); + + if ((val & RNG_RBG2X) != 0) + sbuf_cat(sbp, " RNG_RBG2X: RNG 2X SPEED enabled\n"); + + if ((val & RNG_RBGEN_BIT) != 0) + sbuf_cat(sbp, " RNG_RBGEN_BIT: RBG enabled\n"); + + /* Display RNG status register contents */ + val = bcm2835_rng_read4(sc, RNG_STATUS); + sbuf_printf(sbp, "RNG_CTRL (%08x)\n", val); + sbuf_printf(sbp, " RND_VAL: %02x\n", + (val >> RND_VAL_SHIFT) & RND_VAL_MASK); + sbuf_printf(sbp, " RND_WARM_CNT: %05x\n", val & RND_WARM_CNT); + + /* Display FIFO threshold register contents */ + val = bcm2835_rng_read4(sc, RNG_FF_THRES); + sbuf_printf(sbp, "RNG_FF_THRES: %05x\n", val & RNG_FF_THRES_MASK); + + /* Display interrupt mask register contents */ + val = bcm2835_rng_read4(sc, RNG_INT_MASK); + sbuf_printf(sbp, "RNG_INT_MASK: interrupt %s\n", + ((val & RNG_INT_OFF_BIT) != 0) ? "disabled" : "enabled"); +} + +static void +bcm2835_rng_disable_intr(struct bcm2835_rng_softc *sc) +{ + uint32_t mask; + + /* Set the interrupt off bit in the interrupt mask register */ + mask = bcm2835_rng_read4(sc, RNG_INT_MASK); + mask |= RNG_INT_OFF_BIT; + bcm2835_rng_write4(sc, RNG_INT_MASK, mask); +} + +#if defined(BCM2835_RNG_USE_INTERRUPT) +static void +bcm2835_rng_enable_intr(struct bcm2835_rng_softc *sc) +{ + uint32_t mask; + + /* Clear the interrupt off bit in the interrupt mask register */ + mask = bcm2835_rng_read4(sc, RNG_INT_MASK); + mask &= ~RNG_INT_OFF_BIT; + bcm2835_rng_write4(sc, RNG_INT_MASK, mask); +} +#endif + +static void +bcm2835_rng_start(struct bcm2835_rng_softc *sc) +{ + uint32_t ctrl; + + /* Disable the interrupt */ + bcm2835_rng_disable_intr(sc); + + /* Set the warmup count */ + bcm2835_rng_write4(sc, RNG_STATUS, RND_VAL_WARM_CNT); + + /* Enable the RNG */ + ctrl = bcm2835_rng_read4(sc, RNG_CTRL); + ctrl |= RNG_RBGEN_BIT; + if (sc->sc_rbg2x) + ctrl |= RNG_RBG2X; + bcm2835_rng_write4(sc, RNG_CTRL, ctrl); + +#if defined(BCM2835_RNG_USE_INTERRUPT) + /* Enable the interrupt */ + bcm2835_rng_enable_intr(sc); +#endif +} + +static void +bcm2835_rng_stop(struct bcm2835_rng_softc *sc) +{ + uint32_t ctrl; + + /* Disable the RNG */ + ctrl = bcm2835_rng_read4(sc, RNG_CTRL); + ctrl &= ~RNG_RBGEN_BIT; + bcm2835_rng_write4(sc, RNG_CTRL, ctrl); +} + +static void +bcm2835_rng_harvest(struct bcm2835_rng_softc *sc) +{ + uint32_t *dest; + uint32_t status; + u_int cnt, nread, num_avail, num_words; + int seen_underrun, num_stalls; + + dest = sc->sc_buf; + nread = num_words = 0; + seen_underrun = num_stalls = 0; + for (cnt = sizeof(sc->sc_buf) / sizeof(uint32_t); cnt > 0; + cnt -= num_words) { + /* Read status register to find out how many words available */ + status = bcm2835_rng_read4(sc, RNG_STATUS); + num_avail = (status >> RND_VAL_SHIFT) & RND_VAL_MASK; + + /* If we have none... */ + if (num_avail == 0) { + bcm2835_rng_stat_inc_underrun(sc); + if (++seen_underrun >= sc->sc_stall_count) { + if (num_stalls++ > 0) { + device_printf(sc->sc_dev, + "RNG stalled, disabling device\n"); + bcm2835_rng_stop(sc); + break; + } else { + device_printf(sc->sc_dev, + "Too many underruns, resetting\n"); + bcm2835_rng_stop(sc); + bcm2835_rng_start(sc); + seen_underrun = 0; + } + } + /* Try again */ + continue; + } + + CTR2(KTR_DEV, "%s: %d words available in RNG FIFO", + device_get_nameunit(sc->sc_dev), num_avail); + + /* Pull MIN(num_avail, cnt) words from the FIFO */ + num_words = (num_avail > cnt) ? cnt : num_avail; + bcm2835_rng_read_multi4(sc, RNG_DATA, dest, + num_words); + dest += num_words; + nread += num_words; + } + + cnt = nread * sizeof(uint32_t); + if (cnt > 0) + random_harvest_queue(sc->sc_buf, cnt, cnt * NBBY / 2, + RANDOM_PURE_BROADCOM); + +#if defined(BCM2835_RNG_USE_CALLOUT) + callout_reset(&sc->sc_rngto, sc->sc_rnghz, bcm2835_rng_harvest, sc); +#endif +} + +static int +sysctl_bcm2835_rng_2xspeed(SYSCTL_HANDLER_ARGS) +{ + struct bcm2835_rng_softc *sc = arg1; + int error, rbg2x; + + rbg2x = sc->sc_rbg2x; + error = sysctl_handle_int(oidp, &rbg2x, 0, req); + if (error) + return (error); + if (req->newptr == NULL) + return (error); + if (rbg2x == sc->sc_rbg2x) + return (0); + + /* Reset the RNG */ + bcm2835_rng_stop(sc); + sc->sc_rbg2x = rbg2x; + bcm2835_rng_start(sc); + + return (0); +} + +#ifdef BCM2835_RNG_DEBUG_REGISTERS +static int +sysctl_bcm2835_rng_dump(SYSCTL_HANDLER_ARGS) +{ + struct sbuf sb; + struct bcm2835_rng_softc *sc = arg1; + int error; + + error = sysctl_wire_old_buffer(req, 0); + if (error != 0) + return (error); + sbuf_new_for_sysctl(&sb, NULL, 128, req); + bcm2835_rng_dump_registers(sc, &sb); + error = sbuf_finish(&sb); + sbuf_delete(&sb); + return (error); +} +#endif + +static int +bcm2835_rng_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-rng")) + return (ENXIO); + + device_set_desc(dev, "Broadcom BCM2835 RNG"); + + return (BUS_PROBE_DEFAULT); +} + +static int +bcm2835_rng_attach(device_t dev) +{ + struct bcm2835_rng_softc *sc; + struct sysctl_ctx_list *sysctl_ctx; + struct sysctl_oid *sysctl_tree; + int error, rid; + + error = 0; + sc = device_get_softc(dev); + sc->sc_dev = dev; + sc->sc_stall_count = RNG_STALL_COUNT_DEFAULT; +#ifdef BCM2835_RNG_USE_CALLOUT + /* Initialize callout */ + callout_init(&sc->sc_rngto, CALLOUT_MPSAFE); +#endif + TUNABLE_INT_FETCH("bcmrng.2xspeed", &sc->sc_rbg2x); + TUNABLE_INT_FETCH("bcmrng.stall_count", &sc->sc_stall_count); + + /* Allocate memory resources */ + rid = 0; + sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->sc_mem_res == NULL) { + bcm2835_rng_detach(dev); + return (ENXIO); + } + +#if defined(BCM2835_RNG_USE_INTERRUPT) + /* Allocate interrupt resource */ + rid = 0; + sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_SHAREABLE | RF_ACTIVE); + if (sc->sc_irq_res == NULL) { + bcm2835_rng_detach(dev); + return (ENXIO); + } + + /* Set up the interrupt handler */ + error = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, + NULL, (driver_intr_t *)bcm2835_rng_harvest, sc, &sc->sc_intr_hdl); + if (error) { + device_printf(dev, "Failed to set up IRQ\n"); + sc->sc_intr_hdl = NULL; + bcm2835_rng_detach(dev); + return (error); + } +#endif + + /* Start the RNG */ + bcm2835_rng_start(sc); + + /* Dump the registers if booting verbose */ + if (bootverbose) { + struct sbuf sb; + + (void) sbuf_new(&sb, NULL, 256, + SBUF_AUTOEXTEND | SBUF_INCLUDENUL); + bcm2835_rng_dump_registers(sc, &sb); + sbuf_trim(&sb); + error = sbuf_finish(&sb); + if (error == 0) + device_printf(dev, "%s", sbuf_data(&sb)); + sbuf_delete(&sb); + } + + sysctl_ctx = device_get_sysctl_ctx(dev); + sysctl_tree = device_get_sysctl_tree(dev); + SYSCTL_ADD_LONG(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, + "underrun", CTLFLAG_RD, &sc->sc_underrun, + "Number of FIFO underruns"); + SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, + "2xspeed", CTLTYPE_INT | CTLFLAG_RW, sc, 0, + sysctl_bcm2835_rng_2xspeed, "I", "Enable RBG 2X SPEED"); + SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, + "stall_count", CTLFLAG_RW, &sc->sc_stall_count, + RNG_STALL_COUNT_DEFAULT, "Number of underruns to assume RNG stall"); +#ifdef BCM2835_RNG_DEBUG_REGISTERS + SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, + "dumpregs", CTLTYPE_STRING | CTLFLAG_RD, sc, 0, + sysctl_bcm2835_rng_dump, "S", "Dump RNG registers"); +#endif + +#if defined(BCM2835_RNG_USE_CALLOUT) + /* Reset callout */ + if (hz >= 100) + sc->sc_rnghz = hz / 100; + else + sc->sc_rnghz = 1; + callout_reset(&sc->sc_rngto, sc->sc_rnghz, bcm2835_rng_harvest, sc); +#endif + + return (0); +} + +static int +bcm2835_rng_detach(device_t dev) +{ + struct bcm2835_rng_softc *sc; +#if defined(BCM2835_RNG_USE_INTERRUPT) + int error; +#endif + + sc = device_get_softc(dev); + + /* Stop the RNG */ + bcm2835_rng_stop(sc); + + /* Drain the callout it */ +#if defined(BCM2835_RNG_USE_CALLOUT) + callout_drain(&sc->sc_rngto); +#endif + +#if defined(BCM2835_RNG_USE_INTERRUPT) + /* Tear down the interrupt */ + if (sc->sc_irq_res && sc->sc_intr_hdl) { + error = bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_intr_hdl); + if (error != 0) { + device_printf(dev, "could not tear down IRQ\n"); + return (error); + } + sc->sc_intr_hdl = NULL; + } + + /* Release interrupt resource */ + if (sc->sc_irq_res) { + bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_irq_res); + sc->sc_irq_res = NULL; + } +#endif + + /* Release memory resource */ + if (sc->sc_mem_res != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res); + + return (0); +} + +static device_method_t bcm2835_rng_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, bcm2835_rng_probe), + DEVMETHOD(device_attach, bcm2835_rng_attach), + DEVMETHOD(device_detach, bcm2835_rng_detach), + + DEVMETHOD_END +}; + +static driver_t bcm2835_rng_driver = { + "bcmrng", + bcm2835_rng_methods, + sizeof(struct bcm2835_rng_softc) +}; +static devclass_t bcm2835_rng_devclass; + +DRIVER_MODULE(bcm2835_rng, simplebus, bcm2835_rng_driver, + bcm2835_rng_devclass, 0, 0); +DRIVER_MODULE(bcm2835_rng, ofwbus, bcm2835_rng_driver, bcm2835_rng_devclass, 0, + 0); +MODULE_VERSION(bcm2835_rng, 1); +MODULE_DEPEND(bcm2835_rng, randomdev, 1, 1, 1); Modified: stable/11/sys/arm/broadcom/bcm2835/files.bcm283x ============================================================================== --- stable/11/sys/arm/broadcom/bcm2835/files.bcm283x Mon Apr 2 21:38:50 2018 (r331888) +++ stable/11/sys/arm/broadcom/bcm2835/files.bcm283x Mon Apr 2 21:48:29 2018 (r331889) @@ -11,6 +11,7 @@ arm/broadcom/bcm2835/bcm2835_gpio.c optional gpio arm/broadcom/bcm2835/bcm2835_intr.c standard arm/broadcom/bcm2835/bcm2835_machdep.c standard arm/broadcom/bcm2835/bcm2835_mbox.c standard +arm/broadcom/bcm2835/bcm2835_rng.c optional random arm/broadcom/bcm2835/bcm2835_sdhci.c optional sdhci arm/broadcom/bcm2835/bcm2835_spi.c optional bcm2835_spi arm/broadcom/bcm2835/bcm2835_vcio.c standard Modified: stable/11/sys/boot/fdt/dts/arm/bcm2835.dtsi ============================================================================== --- stable/11/sys/boot/fdt/dts/arm/bcm2835.dtsi Mon Apr 2 21:38:50 2018 (r331888) +++ stable/11/sys/boot/fdt/dts/arm/bcm2835.dtsi Mon Apr 2 21:48:29 2018 (r331889) @@ -396,6 +396,14 @@ }; }; + rng { + compatible = "broadcom,bcm2835-rng", + "broadcom,bcm2708-rng"; + reg = <0x104000 0x20>; + interrupts = <69>; + interrupt-parent = <&intc>; + }; + bsc0 { #address-cells = <1>; #size-cells = <0>; Modified: stable/11/sys/boot/fdt/dts/arm/bcm2836.dtsi ============================================================================== --- stable/11/sys/boot/fdt/dts/arm/bcm2836.dtsi Mon Apr 2 21:38:50 2018 (r331888) +++ stable/11/sys/boot/fdt/dts/arm/bcm2836.dtsi Mon Apr 2 21:48:29 2018 (r331889) @@ -389,6 +389,14 @@ }; }; + rng { + compatible = "broadcom,bcm2835-rng", + "broadcom,bcm2708-rng"; + reg = <0x104000 0x20>; + interrupts = <69>; + interrupt-parent = <&intc>; + }; + bsc0 { #address-cells = <1>; #size-cells = <0>; Modified: stable/11/sys/sys/random.h ============================================================================== --- stable/11/sys/sys/random.h Mon Apr 2 21:38:50 2018 (r331888) +++ stable/11/sys/sys/random.h Mon Apr 2 21:48:29 2018 (r331889) @@ -90,6 +90,7 @@ enum random_entropy_source { RANDOM_PURE_NEHEMIAH, RANDOM_PURE_RNDTEST, RANDOM_PURE_VIRTIO, + RANDOM_PURE_BROADCOM, ENTROPYSOURCE }; From owner-svn-src-stable-11@freebsd.org Mon Apr 2 22:02:51 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E4F83F4F8EF; Mon, 2 Apr 2018 22:02:50 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9A0D474B8F; Mon, 2 Apr 2018 22:02:50 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 951951B7DE; Mon, 2 Apr 2018 22:02:50 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w32M2oZL028120; Mon, 2 Apr 2018 22:02:50 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w32M2nfB028113; Mon, 2 Apr 2018 22:02:49 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201804022202.w32M2nfB028113@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Mon, 2 Apr 2018 22:02:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331890 - in stable/11/sys/arm: arm xscale/i8134x X-SVN-Group: stable-11 X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: in stable/11/sys/arm: arm xscale/i8134x X-SVN-Commit-Revision: 331890 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Apr 2018 22:02:51 -0000 Author: gonzo Date: Mon Apr 2 22:02:49 2018 New Revision: 331890 URL: https://svnweb.freebsd.org/changeset/base/331890 Log: MFC r305094, r305096-r305097 r305094 by cognet: Garbage collect bits forgotten in r295267. r305096 by cognet: Some old arm ports don't load the kernel at the beginning of the memory, because the bootloader, ie redboot, won't let them do so, and so used the memory before the kernel for early memory allocation, such as pagetables, stacks, etc... Make a bit of an effort to try to get that memory mapped. r305097 by cognet: Nuke obio_bs_tag, it was used before it was initialized, and arm_base_bs_tag is the same, anyway. Modified: stable/11/sys/arm/arm/cpufunc_asm_xscale_c3.S stable/11/sys/arm/arm/locore-v4.S stable/11/sys/arm/xscale/i8134x/crb_machdep.c stable/11/sys/arm/xscale/i8134x/obio.c stable/11/sys/arm/xscale/i8134x/obiovar.h stable/11/sys/arm/xscale/i8134x/uart_cpu_i81342.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/arm/cpufunc_asm_xscale_c3.S ============================================================================== --- stable/11/sys/arm/arm/cpufunc_asm_xscale_c3.S Mon Apr 2 21:48:29 2018 (r331889) +++ stable/11/sys/arm/arm/cpufunc_asm_xscale_c3.S Mon Apr 2 22:02:49 2018 (r331890) @@ -364,8 +364,6 @@ ENTRY(xscalec3_setttb) #ifdef CACHE_CLEAN_BLOCK_INTR msr cpsr_fsxc, r3 -#else - str r2, [r3] #endif RET END(xscalec3_setttb) Modified: stable/11/sys/arm/arm/locore-v4.S ============================================================================== --- stable/11/sys/arm/arm/locore-v4.S Mon Apr 2 21:48:29 2018 (r331889) +++ stable/11/sys/arm/arm/locore-v4.S Mon Apr 2 22:02:49 2018 (r331890) @@ -194,6 +194,16 @@ Lunmapped: ldr r2, =(KERNVIRTADDR) mov r3, #64 bl build_pagetables +#if defined(PHYSADDR) && (KERNVIRTADDR != KERNBASE) +/* + * If the kernel wasn't loaded at the beginning of the ram, map the memory + * before the kernel too, as some ports use that for pagetables, stack, etc... + */ + ldr r1, =PHYSADDR + ldr r2, =KERNBASE + ldr r3, =((KERNVIRTADDR - KERNBASE) / L1_S_SIZE) + bl build_pagetables +#endif /* Create a device mapping for early_printf if specified. */ #if defined(SOCDEV_PA) && defined(SOCDEV_VA) Modified: stable/11/sys/arm/xscale/i8134x/crb_machdep.c ============================================================================== --- stable/11/sys/arm/xscale/i8134x/crb_machdep.c Mon Apr 2 21:48:29 2018 (r331889) +++ stable/11/sys/arm/xscale/i8134x/crb_machdep.c Mon Apr 2 22:02:49 2018 (r331890) @@ -286,7 +286,7 @@ initarm(struct arm_boot_params *abp) cpu_setup(); i80321_calibrate_delay(); - i81342_sdram_bounds(obio_bs_tag, IOP34X_VADDR, &memstart, &memsize); + i81342_sdram_bounds(arm_base_bs_tag, IOP34X_VADDR, &memstart, &memsize); physmem = memsize / PAGE_SIZE; cninit(); /* Set stack for exception handlers */ Modified: stable/11/sys/arm/xscale/i8134x/obio.c ============================================================================== --- stable/11/sys/arm/xscale/i8134x/obio.c Mon Apr 2 21:48:29 2018 (r331889) +++ stable/11/sys/arm/xscale/i8134x/obio.c Mon Apr 2 22:02:49 2018 (r331890) @@ -56,8 +56,6 @@ __FBSDID("$FreeBSD$"); #include #include -bus_space_tag_t obio_bs_tag; - static int obio_probe(device_t dev) { @@ -69,8 +67,7 @@ obio_attach(device_t dev) { struct obio_softc *sc = device_get_softc(dev); - obio_bs_tag = arm_base_bs_tag; - sc->oba_st = obio_bs_tag; + sc->oba_st = arm_base_bs_tag; sc->oba_rman.rm_type = RMAN_ARRAY; sc->oba_rman.rm_descr = "OBIO I/O"; if (rman_init(&sc->oba_rman) != 0 || Modified: stable/11/sys/arm/xscale/i8134x/obiovar.h ============================================================================== --- stable/11/sys/arm/xscale/i8134x/obiovar.h Mon Apr 2 21:48:29 2018 (r331889) +++ stable/11/sys/arm/xscale/i8134x/obiovar.h Mon Apr 2 22:02:49 2018 (r331890) @@ -50,6 +50,5 @@ struct obio_softc { struct rman oba_irq_rman; }; -extern bus_space_tag_t obio_bs_tag; #endif /* _IQ80321_OBIOVAR_H_ */ Modified: stable/11/sys/arm/xscale/i8134x/uart_cpu_i81342.c ============================================================================== --- stable/11/sys/arm/xscale/i8134x/uart_cpu_i81342.c Mon Apr 2 21:48:29 2018 (r331889) +++ stable/11/sys/arm/xscale/i8134x/uart_cpu_i81342.c Mon Apr 2 22:02:49 2018 (r331890) @@ -54,14 +54,14 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di) di->ops = uart_getops(&uart_ns8250_class); di->bas.chan = 0; - di->bas.bst = obio_bs_tag; + di->bas.bst = arm_base_bs_tag; di->bas.regshft = 2; di->bas.rclk = 33334000; di->baudrate = 115200; di->databits = 8; di->stopbits = 1; di->parity = UART_PARITY_NONE; - uart_bus_space_io = obio_bs_tag; + uart_bus_space_io = arm_base_bs_tag; uart_bus_space_mem = NULL; di->bas.bsh = IOP34X_UART0_VADDR; return (0); From owner-svn-src-stable-11@freebsd.org Mon Apr 2 22:16:20 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7DB31F5198E; Mon, 2 Apr 2018 22:16:20 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 298DD75665; Mon, 2 Apr 2018 22:16:20 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 200F31B98A; Mon, 2 Apr 2018 22:16:20 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w32MGJGI033046; Mon, 2 Apr 2018 22:16:19 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w32MGJLX033045; Mon, 2 Apr 2018 22:16:19 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201804022216.w32MGJLX033045@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Mon, 2 Apr 2018 22:16:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331891 - stable/11/sys/arm/arm X-SVN-Group: stable-11 X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: stable/11/sys/arm/arm X-SVN-Commit-Revision: 331891 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Apr 2018 22:16:20 -0000 Author: gonzo Date: Mon Apr 2 22:16:19 2018 New Revision: 331891 URL: https://svnweb.freebsd.org/changeset/base/331891 Log: MFC r304488, r304623 r304488 by manu: Keep boot parameters in ARM trampoline code Currently boot parameters (r0 - r3) are forgotten in ARM trampoline code. This patch save them at startup and restore them before jumping into kernel _start() routine. This is usefull when booting with Linux ABI and/or custom bootloader. Submitted by: Grégory Soutadé Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D7395 r304623 by manu: Fix building for ARM kernel that have FLASHADDR, PHYSADDR and LOADERRAMADDR defined. Pointy Hat: myself Reported by: bz Modified: stable/11/sys/arm/arm/elf_trampoline.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/arm/elf_trampoline.c ============================================================================== --- stable/11/sys/arm/arm/elf_trampoline.c Mon Apr 2 22:02:49 2018 (r331890) +++ stable/11/sys/arm/arm/elf_trampoline.c Mon Apr 2 22:16:19 2018 (r331891) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include /* For KERNVIRTADDR */ +#include extern char kernel_start[]; extern char kernel_end[]; @@ -48,7 +49,7 @@ extern void *_end; void _start(void); void __start(void); -void __startC(void); +void __startC(unsigned r0, unsigned r1, unsigned r2, unsigned r3); extern unsigned int cpu_ident(void); extern void armv6_idcache_wbinv_all(void); @@ -125,6 +126,10 @@ static int arm_dcache_l2_nsets; static int arm_dcache_l2_assoc; static int arm_dcache_l2_linesize; +/* + * Boot parameters + */ +static struct arm_boot_params s_boot_params; extern int arm9_dcache_sets_inc; extern int arm9_dcache_sets_max; @@ -173,12 +178,17 @@ bzero(void *addr, int count) static void arm9_setup(void); void -_startC(void) +_startC(unsigned r0, unsigned r1, unsigned r2, unsigned r3) { int tmp1; unsigned int sp = ((unsigned int)&_end & ~3) + 4; unsigned int pc, kernphysaddr; + s_boot_params.abp_r0 = r0; + s_boot_params.abp_r1 = r1; + s_boot_params.abp_r2 = r2; + s_boot_params.abp_r3 = r3; + /* * Figure out the physical address the kernel was loaded at. This * assumes the entry point (this code right here) is in the first page, @@ -212,8 +222,15 @@ _startC(void) /* Temporary set the sp and jump to the new location. */ __asm __volatile( "mov sp, %1\n" + "mov r0, %2\n" + "mov r1, %3\n" + "mov r2, %4\n" + "mov r3, %5\n" "mov pc, %0\n" - : : "r" (target_addr), "r" (tmp_sp)); + : : "r" (target_addr), "r" (tmp_sp), + "r" (s_boot_params.abp_r0), "r" (s_boot_params.abp_r1), + "r" (s_boot_params.abp_r2), "r" (s_boot_params.abp_r3) + : "r0", "r1", "r2", "r3"); } #endif @@ -488,6 +505,7 @@ load_kernel(unsigned int kstart, unsigned int curaddr, vm_offset_t lastaddr = 0; Elf_Addr ssym = 0; Elf_Dyn *dp; + struct arm_boot_params local_boot_params; eh = (Elf32_Ehdr *)kstart; ssym = 0; @@ -556,6 +574,12 @@ load_kernel(unsigned int kstart, unsigned int curaddr, if (!d) return ((void *)lastaddr); + /* + * Now the stack is fixed, copy boot params + * before it's overrided + */ + memcpy(&local_boot_params, &s_boot_params, sizeof(local_boot_params)); + j = eh->e_phnum; for (i = 0; i < j; i++) { volatile char c; @@ -605,7 +629,10 @@ load_kernel(unsigned int kstart, unsigned int curaddr, "mcr p15, 0, %0, c1, c0, 0\n" /* CP15_SCTLR(%0)*/ : "=r" (ssym)); /* Jump to the entry point. */ - ((void(*)(void))(entry_point - KERNVIRTADDR + curaddr))(); + ((void(*)(unsigned, unsigned, unsigned, unsigned)) + (entry_point - KERNVIRTADDR + curaddr)) + (local_boot_params.abp_r0, local_boot_params.abp_r1, + local_boot_params.abp_r2, local_boot_params.abp_r3); __asm __volatile(".globl func_end\n" "func_end:"); From owner-svn-src-stable-11@freebsd.org Mon Apr 2 23:19:10 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A90F0F6C335; Mon, 2 Apr 2018 23:19:10 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5881F780AC; Mon, 2 Apr 2018 23:19:10 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 34C151C352; Mon, 2 Apr 2018 23:19:10 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w32NJ9aq063216; Mon, 2 Apr 2018 23:19:09 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w32NJ8HX063205; Mon, 2 Apr 2018 23:19:08 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201804022319.w32NJ8HX063205@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Mon, 2 Apr 2018 23:19:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331893 - in stable/11/sys/arm: allwinner arm broadcom/bcm2835 freescale/imx nvidia/tegra124 qemu ti X-SVN-Group: stable-11 X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: in stable/11/sys/arm: allwinner arm broadcom/bcm2835 freescale/imx nvidia/tegra124 qemu ti X-SVN-Commit-Revision: 331893 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Apr 2018 23:19:10 -0000 Author: gonzo Date: Mon Apr 2 23:19:07 2018 New Revision: 331893 URL: https://svnweb.freebsd.org/changeset/base/331893 Log: MFC r306263, r306268 r306263 by andrew: Move cpu_reset to be a platform method to allow multiple implementations. Reviewed by: mmel Sponsored by: ABT Systems Ltd Differential Revision: https://reviews.freebsd.org/D8010 r306268 by andrew: Also implement platform_cpu_reset on bcm2836 Modified: stable/11/sys/arm/allwinner/aw_machdep.c stable/11/sys/arm/arm/platform.c stable/11/sys/arm/arm/platform_if.m stable/11/sys/arm/broadcom/bcm2835/bcm2835_machdep.c stable/11/sys/arm/freescale/imx/imx51_machdep.c stable/11/sys/arm/freescale/imx/imx53_machdep.c stable/11/sys/arm/freescale/imx/imx6_machdep.c stable/11/sys/arm/nvidia/tegra124/tegra124_machdep.c stable/11/sys/arm/qemu/virt_machdep.c stable/11/sys/arm/ti/ti_machdep.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/allwinner/aw_machdep.c ============================================================================== --- stable/11/sys/arm/allwinner/aw_machdep.c Mon Apr 2 22:59:33 2018 (r331892) +++ stable/11/sys/arm/allwinner/aw_machdep.c Mon Apr 2 23:19:07 2018 (r331893) @@ -146,8 +146,8 @@ allwinner_devmap_init(platform_t plat) return (0); } -void -cpu_reset() +static void +allwinner_cpu_reset(platform_t plat) { aw_wdog_watchdog_reset(); printf("Reset failed!\n"); @@ -159,6 +159,7 @@ static platform_method_t a10_methods[] = { PLATFORMMETHOD(platform_attach, a10_attach), PLATFORMMETHOD(platform_lastaddr, allwinner_lastaddr), PLATFORMMETHOD(platform_devmap_init, allwinner_devmap_init), + PLATFORMMETHOD(platform_cpu_reset, allwinner_cpu_reset), PLATFORMMETHOD_END, }; @@ -170,6 +171,7 @@ static platform_method_t a13_methods[] = { PLATFORMMETHOD(platform_attach, a13_attach), PLATFORMMETHOD(platform_lastaddr, allwinner_lastaddr), PLATFORMMETHOD(platform_devmap_init, allwinner_devmap_init), + PLATFORMMETHOD(platform_cpu_reset, allwinner_cpu_reset), PLATFORMMETHOD_END, }; @@ -181,6 +183,7 @@ static platform_method_t a20_methods[] = { PLATFORMMETHOD(platform_attach, a20_attach), PLATFORMMETHOD(platform_lastaddr, allwinner_lastaddr), PLATFORMMETHOD(platform_devmap_init, allwinner_devmap_init), + PLATFORMMETHOD(platform_cpu_reset, allwinner_cpu_reset), #ifdef SMP PLATFORMMETHOD(platform_mp_start_ap, aw_mp_start_ap), @@ -196,6 +199,7 @@ static platform_method_t a31_methods[] = { PLATFORMMETHOD(platform_attach, a31_attach), PLATFORMMETHOD(platform_lastaddr, allwinner_lastaddr), PLATFORMMETHOD(platform_devmap_init, allwinner_devmap_init), + PLATFORMMETHOD(platform_cpu_reset, allwinner_cpu_reset), #ifdef SMP PLATFORMMETHOD(platform_mp_start_ap, aw_mp_start_ap), @@ -211,6 +215,7 @@ static platform_method_t a31s_methods[] = { PLATFORMMETHOD(platform_attach, a31s_attach), PLATFORMMETHOD(platform_lastaddr, allwinner_lastaddr), PLATFORMMETHOD(platform_devmap_init, allwinner_devmap_init), + PLATFORMMETHOD(platform_cpu_reset, allwinner_cpu_reset), #ifdef SMP PLATFORMMETHOD(platform_mp_start_ap, aw_mp_start_ap), @@ -226,6 +231,7 @@ static platform_method_t a83t_methods[] = { PLATFORMMETHOD(platform_attach, a83t_attach), PLATFORMMETHOD(platform_lastaddr, allwinner_lastaddr), PLATFORMMETHOD(platform_devmap_init, allwinner_devmap_init), + PLATFORMMETHOD(platform_cpu_reset, allwinner_cpu_reset), #ifdef SMP PLATFORMMETHOD(platform_mp_start_ap, a83t_mp_start_ap), @@ -241,6 +247,7 @@ static platform_method_t h3_methods[] = { PLATFORMMETHOD(platform_attach, h3_attach), PLATFORMMETHOD(platform_lastaddr, allwinner_lastaddr), PLATFORMMETHOD(platform_devmap_init, allwinner_devmap_init), + PLATFORMMETHOD(platform_cpu_reset, allwinner_cpu_reset), #ifdef SMP PLATFORMMETHOD(platform_mp_start_ap, aw_mp_start_ap), Modified: stable/11/sys/arm/arm/platform.c ============================================================================== --- stable/11/sys/arm/arm/platform.c Mon Apr 2 22:59:33 2018 (r331892) +++ stable/11/sys/arm/arm/platform.c Mon Apr 2 23:19:07 2018 (r331893) @@ -188,6 +188,20 @@ platform_late_init(void) PLATFORM_LATE_INIT(plat_obj); } +void +cpu_reset(void) +{ + + PLATFORM_CPU_RESET(plat_obj); + + printf("cpu_reset failed"); + + intr_disable(); + while(1) { + cpu_sleep(0); + } +} + #ifdef MULTIDELAY static void platform_delay(int usec, void *arg __unused) Modified: stable/11/sys/arm/arm/platform_if.m ============================================================================== --- stable/11/sys/arm/arm/platform_if.m Mon Apr 2 22:59:33 2018 (r331892) +++ stable/11/sys/arm/arm/platform_if.m Mon Apr 2 23:19:07 2018 (r331893) @@ -133,3 +133,10 @@ METHOD void mp_setmaxid { METHOD void mp_start_ap { platform_t _plat; }; + +/** + * @brief Called by cpu_reset to reboot. + */ +METHOD void cpu_reset { + platform_t _plat; +}; Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_machdep.c ============================================================================== --- stable/11/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Mon Apr 2 22:59:33 2018 (r331892) +++ stable/11/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Mon Apr 2 23:19:07 2018 (r331893) @@ -116,11 +116,10 @@ bcm2836_devmap_init(platform_t plat) -void -cpu_reset() +static void +bcm2835_cpu_reset(platform_t plat) { bcmwd_watchdog_reset(); - while (1); } #ifdef SOC_BCM2835 @@ -128,6 +127,7 @@ static platform_method_t bcm2835_methods[] = { PLATFORMMETHOD(platform_devmap_init, bcm2835_devmap_init), PLATFORMMETHOD(platform_lastaddr, bcm2835_lastaddr), PLATFORMMETHOD(platform_late_init, bcm2835_late_init), + PLATFORMMETHOD(platform_cpu_reset, bcm2835_cpu_reset), PLATFORMMETHOD_END, }; @@ -139,6 +139,7 @@ static platform_method_t bcm2836_methods[] = { PLATFORMMETHOD(platform_devmap_init, bcm2836_devmap_init), PLATFORMMETHOD(platform_lastaddr, bcm2835_lastaddr), PLATFORMMETHOD(platform_late_init, bcm2835_late_init), + PLATFORMMETHOD(platform_cpu_reset, bcm2835_cpu_reset), PLATFORMMETHOD_END, }; Modified: stable/11/sys/arm/freescale/imx/imx51_machdep.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx51_machdep.c Mon Apr 2 22:59:33 2018 (r331892) +++ stable/11/sys/arm/freescale/imx/imx51_machdep.c Mon Apr 2 23:19:07 2018 (r331893) @@ -81,8 +81,8 @@ imx51_devmap_init(platform_t plat) return (0); } -void -cpu_reset(void) +static void +imx51_cpu_reset(platform_t plat) { imx_wdog_cpu_reset(0x73F98000); @@ -97,6 +97,7 @@ static platform_method_t imx51_methods[] = { PLATFORMMETHOD(platform_attach, imx51_attach), PLATFORMMETHOD(platform_devmap_init, imx51_devmap_init), PLATFORMMETHOD(platform_lastaddr, imx51_lastaddr), + PLATFORMMETHOD(platform_cpu_reset, imx51_cpu_reset), PLATFORMMETHOD_END, }; Modified: stable/11/sys/arm/freescale/imx/imx53_machdep.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx53_machdep.c Mon Apr 2 22:59:33 2018 (r331892) +++ stable/11/sys/arm/freescale/imx/imx53_machdep.c Mon Apr 2 23:19:07 2018 (r331893) @@ -77,8 +77,8 @@ imx53_devmap_init(platform_t plat) return (0); } -void -cpu_reset(void) +static void +imx53_cpu_reset(platform_t plat) { imx_wdog_cpu_reset(0x53F98000); @@ -93,6 +93,7 @@ static platform_method_t imx53_methods[] = { PLATFORMMETHOD(platform_attach, imx53_attach), PLATFORMMETHOD(platform_devmap_init, imx53_devmap_init), PLATFORMMETHOD(platform_lastaddr, imx53_lastaddr), + PLATFORMMETHOD(platform_cpu_reset, imx53_cpu_reset), PLATFORMMETHOD_END, }; Modified: stable/11/sys/arm/freescale/imx/imx6_machdep.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx6_machdep.c Mon Apr 2 22:59:33 2018 (r331892) +++ stable/11/sys/arm/freescale/imx/imx6_machdep.c Mon Apr 2 23:19:07 2018 (r331893) @@ -199,8 +199,8 @@ imx6_devmap_init(platform_t plat) return (0); } -void -cpu_reset(void) +static void +imx6_cpu_reset(platform_t plat) { const uint32_t IMX6_WDOG_CR_PHYS = 0x020bc000; @@ -326,6 +326,7 @@ static platform_method_t imx6_methods[] = { PLATFORMMETHOD(platform_lastaddr, imx6_lastaddr), PLATFORMMETHOD(platform_devmap_init, imx6_devmap_init), PLATFORMMETHOD(platform_late_init, imx6_late_init), + PLATFORMMETHOD(platform_cpu_reset, imx6_cpu_reset), PLATFORMMETHOD_END, }; Modified: stable/11/sys/arm/nvidia/tegra124/tegra124_machdep.c ============================================================================== --- stable/11/sys/arm/nvidia/tegra124/tegra124_machdep.c Mon Apr 2 22:59:33 2018 (r331892) +++ stable/11/sys/arm/nvidia/tegra124/tegra124_machdep.c Mon Apr 2 23:19:07 2018 (r331893) @@ -93,8 +93,8 @@ tegra124_devmap_init(platform_t plat) return (0); } -void -cpu_reset(void) +static void +tegra124_cpu_reset(platform_t plat) { bus_space_handle_t pmc; uint32_t reg; @@ -144,6 +144,8 @@ static platform_method_t tegra124_methods[] = { PLATFORMMETHOD(platform_lastaddr, tegra124_lastaddr), PLATFORMMETHOD(platform_devmap_init, tegra124_devmap_init), PLATFORMMETHOD(platform_late_init, tegra124_late_init), + PLATFORMMETHOD(platform_cpu_reset, tegra124_cpu_reset), + #ifdef SMP PLATFORMMETHOD(platform_mp_start_ap, tegra124_mp_start_ap), PLATFORMMETHOD(platform_mp_setmaxid, tegra124_mp_setmaxid), Modified: stable/11/sys/arm/qemu/virt_machdep.c ============================================================================== --- stable/11/sys/arm/qemu/virt_machdep.c Mon Apr 2 22:59:33 2018 (r331892) +++ stable/11/sys/arm/qemu/virt_machdep.c Mon Apr 2 23:19:07 2018 (r331893) @@ -44,13 +44,6 @@ __FBSDID("$FreeBSD$"); #include "platform_if.h" -void -cpu_reset(void) -{ - - while (1); -} - static vm_offset_t virt_lastaddr(platform_t plat) { Modified: stable/11/sys/arm/ti/ti_machdep.c ============================================================================== --- stable/11/sys/arm/ti/ti_machdep.c Mon Apr 2 22:59:33 2018 (r331892) +++ stable/11/sys/arm/ti/ti_machdep.c Mon Apr 2 23:19:07 2018 (r331893) @@ -95,21 +95,20 @@ ti_am335x_devmap_init(platform_t plat) } #endif -void -cpu_reset() +static void +ti_plat_cpu_reset(platform_t plat) { if (ti_cpu_reset) (*ti_cpu_reset)(); else printf("no cpu_reset implementation\n"); - printf("Reset failed!\n"); - while (1); } #if defined(SOC_OMAP4) static platform_method_t omap4_methods[] = { PLATFORMMETHOD(platform_devmap_init, ti_omap4_devmap_init), PLATFORMMETHOD(platform_lastaddr, ti_lastaddr), + PLATFORMMETHOD(platform_cpu_reset, ti_plat_cpu_reset), PLATFORMMETHOD_END, }; @@ -120,6 +119,7 @@ FDT_PLATFORM_DEF(omap4, "omap4", 0, "ti,omap4430", 0); static platform_method_t am335x_methods[] = { PLATFORMMETHOD(platform_devmap_init, ti_am335x_devmap_init), PLATFORMMETHOD(platform_lastaddr, ti_lastaddr), + PLATFORMMETHOD(platform_cpu_reset, ti_plat_cpu_reset), PLATFORMMETHOD_END, }; From owner-svn-src-stable-11@freebsd.org Mon Apr 2 23:30:23 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8FC42F6CDD4; Mon, 2 Apr 2018 23:30:22 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5E66D7874F; Mon, 2 Apr 2018 23:30:22 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 54A331C4E4; Mon, 2 Apr 2018 23:30:22 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w32NUMvI068098; Mon, 2 Apr 2018 23:30:22 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w32NULVa068091; Mon, 2 Apr 2018 23:30:21 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201804022330.w32NULVa068091@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Mon, 2 Apr 2018 23:30:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331894 - in stable/11/sys/arm: broadcom/bcm2835 conf X-SVN-Group: stable-11 X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: in stable/11/sys/arm: broadcom/bcm2835 conf X-SVN-Commit-Revision: 331894 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Apr 2018 23:30:23 -0000 Author: gonzo Date: Mon Apr 2 23:30:21 2018 New Revision: 331894 URL: https://svnweb.freebsd.org/changeset/base/331894 Log: MFC r306436-r306437, r306489, r306491 r306436 by manu: RPI-B: Add support for MULTIDELAY 100 cycles per us seems accurate enough, at least it's better than the 200 value that was used before. Reviewed by: andrew, imp Differential Revision: https://reviews.freebsd.org/D8062 r306437 by manu: RPI2: Add support for PLATFORM_SMP so we can later add it to GENERIC. Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D8063 r306489 by manu: bcm2835_cpufreq: Only attach driver if we correcly match on the machine compatible string. r306491 by manu: RPI2: Add support for MULTIDELAY, this is needed for inclusion into GENERIC. Added: stable/11/sys/arm/broadcom/bcm2835/bcm2836_mp.h - copied unchanged from r306437, head/sys/arm/broadcom/bcm2835/bcm2836_mp.h Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c stable/11/sys/arm/broadcom/bcm2835/bcm2835_machdep.c stable/11/sys/arm/broadcom/bcm2835/bcm2835_systimer.c stable/11/sys/arm/broadcom/bcm2835/bcm2836_mp.c stable/11/sys/arm/conf/RPI-B stable/11/sys/arm/conf/RPI2 Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c ============================================================================== --- stable/11/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c Mon Apr 2 23:19:07 2018 (r331893) +++ stable/11/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c Mon Apr 2 23:30:21 2018 (r331894) @@ -44,6 +44,11 @@ __FBSDID("$FreeBSD$"); #include #include +#include + +#include +#include + #include #include #include @@ -119,6 +124,13 @@ struct bcm2835_cpufreq_softc { struct intr_config_hook init_hook; }; +static struct ofw_compat_data compat_data[] = { + { "broadcom,bcm2835-vc", 1 }, + { "broadcom,bcm2708-vc", 1 }, + { "brcm,bcm2709", 1 }, + { NULL, 0 } +}; + static int cpufreq_verbose = 0; TUNABLE_INT("hw.bcm2835.cpufreq.verbose", &cpufreq_verbose); static int cpufreq_lowest_freq = DEFAULT_LOWEST_FREQ; @@ -1244,6 +1256,16 @@ bcm2835_cpufreq_init(void *arg) static void bcm2835_cpufreq_identify(driver_t *driver, device_t parent) { + const struct ofw_compat_data *compat; + phandle_t root; + + root = OF_finddevice("/"); + for (compat = compat_data; compat->ocd_str != NULL; compat++) + if (fdt_is_compatible(root, compat->ocd_str)) + break; + + if (compat->ocd_data == 0) + return; DPRINTF("driver=%p, parent=%p\n", driver, parent); if (device_find_child(parent, "bcm2835_cpufreq", -1) != NULL) Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_machdep.c ============================================================================== --- stable/11/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Mon Apr 2 23:19:07 2018 (r331893) +++ stable/11/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Mon Apr 2 23:30:21 2018 (r331894) @@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include "platform_if.h" @@ -131,7 +132,7 @@ static platform_method_t bcm2835_methods[] = { PLATFORMMETHOD_END, }; -FDT_PLATFORM_DEF(bcm2835, "bcm2835", 0, "raspberrypi,model-b", 0); +FDT_PLATFORM_DEF(bcm2835, "bcm2835", 0, "raspberrypi,model-b", 100); #endif #ifdef SOC_BCM2836 @@ -141,7 +142,12 @@ static platform_method_t bcm2836_methods[] = { PLATFORMMETHOD(platform_late_init, bcm2835_late_init), PLATFORMMETHOD(platform_cpu_reset, bcm2835_cpu_reset), +#ifdef SMP + PLATFORMMETHOD(platform_mp_start_ap, bcm2836_mp_start_ap), + PLATFORMMETHOD(platform_mp_setmaxid, bcm2836_mp_setmaxid), +#endif + PLATFORMMETHOD_END, }; -FDT_PLATFORM_DEF(bcm2836, "bcm2836", 0, "brcm,bcm2709", 0); +FDT_PLATFORM_DEF(bcm2836, "bcm2836", 0, "brcm,bcm2709", 100); #endif Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_systimer.c ============================================================================== --- stable/11/sys/arm/broadcom/bcm2835/bcm2835_systimer.c Mon Apr 2 23:19:07 2018 (r331893) +++ stable/11/sys/arm/broadcom/bcm2835/bcm2835_systimer.c Mon Apr 2 23:30:21 2018 (r331894) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -101,6 +102,8 @@ static struct bcm_systimer_softc *bcm_systimer_sc = NU static unsigned bcm_systimer_tc_get_timecount(struct timecounter *); +static delay_func bcm_systimer_delay; + static struct timecounter bcm_systimer_tc = { .tc_name = DEFAULT_TIMER_NAME, .tc_get_timecount = bcm_systimer_tc_get_timecount, @@ -113,6 +116,9 @@ static struct timecounter bcm_systimer_tc = { static unsigned bcm_systimer_tc_get_timecount(struct timecounter *tc) { + if (bcm_systimer_sc == NULL) + return (0); + return bcm_systimer_tc_read_4(SYSTIMER_CLO); } @@ -147,7 +153,7 @@ restart: intr_restore(s); return (0); - } + } return (EINVAL); } @@ -167,7 +173,7 @@ bcm_systimer_intr(void *arg) struct systimer *st = (struct systimer *)arg; uint32_t cs; - cs = bcm_systimer_tc_read_4(SYSTIMER_CS); + cs = bcm_systimer_tc_read_4(SYSTIMER_CS); if ((cs & (1 << st->index)) == 0) return (FILTER_STRAY); @@ -254,6 +260,9 @@ bcm_systimer_attach(device_t dev) bcm_systimer_sc = sc; + if (device_get_unit(dev) == 0) + arm_set_delay(bcm_systimer_delay, sc); + bcm_systimer_tc.tc_frequency = DEFAULT_FREQUENCY; tc_init(&bcm_systimer_tc); @@ -276,19 +285,14 @@ static devclass_t bcm_systimer_devclass; DRIVER_MODULE(bcm_systimer, simplebus, bcm_systimer_driver, bcm_systimer_devclass, 0, 0); -void -DELAY(int usec) +static void +bcm_systimer_delay(int usec, void *arg) { + struct bcm_systimer_softc *sc; int32_t counts; uint32_t first, last; - if (bcm_systimer_sc == NULL) { - for (; usec > 0; usec--) - for (counts = 200; counts > 0; counts--) - /* Prevent gcc from optimizing out the loop */ - cpufunc_nullop(); - return; - } + sc = (struct bcm_systimer_softc *) arg; /* Get the number of times to count */ counts = usec * (bcm_systimer_tc.tc_frequency / 1000000) + 1; Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2836_mp.c ============================================================================== --- stable/11/sys/arm/broadcom/bcm2835/bcm2836_mp.c Mon Apr 2 23:19:07 2018 (r331893) +++ stable/11/sys/arm/broadcom/bcm2835/bcm2836_mp.c Mon Apr 2 23:30:21 2018 (r331894) @@ -45,7 +45,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include + #ifdef DEBUG #define DPRINTF(fmt, ...) do { \ printf("%s:%u: ", __func__, __LINE__); \ @@ -77,7 +80,7 @@ static bus_space_handle_t bs_periph; bus_space_write_4(fdtbus_bs_tag, bs_periph, (addr), (val)) void -platform_mp_setmaxid(void) +bcm2836_mp_setmaxid(platform_t plat) { DPRINTF("platform_mp_setmaxid\n"); @@ -90,7 +93,7 @@ platform_mp_setmaxid(void) } void -platform_mp_start_ap(void) +bcm2836_mp_start_ap(platform_t plat) { uint32_t val; int i, retry; Copied: stable/11/sys/arm/broadcom/bcm2835/bcm2836_mp.h (from r306437, head/sys/arm/broadcom/bcm2835/bcm2836_mp.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/arm/broadcom/bcm2835/bcm2836_mp.h Mon Apr 2 23:30:21 2018 (r331894, copy of r306437, head/sys/arm/broadcom/bcm2835/bcm2836_mp.h) @@ -0,0 +1,38 @@ +/*- + * Copyright (C) 2016 Emmanuel Vadot + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _BCM2836_MP_H_ +#define _BCM2836_MP_H_ + +void bcm2836_mp_setmaxid(platform_t plat); +void bcm2836_mp_start_ap(platform_t plat); + +#endif /* _BCM2836_MP_H_ */ Modified: stable/11/sys/arm/conf/RPI-B ============================================================================== --- stable/11/sys/arm/conf/RPI-B Mon Apr 2 23:19:07 2018 (r331893) +++ stable/11/sys/arm/conf/RPI-B Mon Apr 2 23:30:21 2018 (r331894) @@ -28,6 +28,7 @@ options INTRNG options SCHED_4BSD # 4BSD scheduler options PLATFORM +options MULTIDELAY # NFS root from boopt/dhcp #options BOOTP Modified: stable/11/sys/arm/conf/RPI2 ============================================================================== --- stable/11/sys/arm/conf/RPI2 Mon Apr 2 23:19:07 2018 (r331893) +++ stable/11/sys/arm/conf/RPI2 Mon Apr 2 23:30:21 2018 (r331894) @@ -29,6 +29,8 @@ options INTRNG options SCHED_ULE # ULE scheduler options SMP # Enable multiple cores options PLATFORM +options PLATFORM_SMP +options MULTIDELAY # NFS root from boopt/dhcp #options BOOTP From owner-svn-src-stable-11@freebsd.org Mon Apr 2 23:39:06 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D5350F6D6EF; Mon, 2 Apr 2018 23:39:05 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 82C9E78EDD; Mon, 2 Apr 2018 23:39:05 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7D9811C689; Mon, 2 Apr 2018 23:39:05 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w32Nd58F078303; Mon, 2 Apr 2018 23:39:05 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w32Nd4Ac078102; Mon, 2 Apr 2018 23:39:04 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201804022339.w32Nd4Ac078102@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Mon, 2 Apr 2018 23:39:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331897 - in stable/11/sys: arm/broadcom/bcm2835 boot/fdt/dts/arm dev/usb/net X-SVN-Group: stable-11 X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: in stable/11/sys: arm/broadcom/bcm2835 boot/fdt/dts/arm dev/usb/net X-SVN-Commit-Revision: 331897 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Apr 2018 23:39:06 -0000 Author: gonzo Date: Mon Apr 2 23:39:04 2018 New Revision: 331897 URL: https://svnweb.freebsd.org/changeset/base/331897 Log: MFC r314672, r315967, r324184, r325768 r314672: [rpi] rpi3 should use the same cpufreq logic as rpi2, not rpi-b RPi3 cpufreq is more like that on RPi2. Setting arm frequency above min (say, "sysctl hw.cpufreq.arm_freq=600000001") turns on turbo mode, and the firmware automatically raises voltage, sets frequency to max 1200MHz, and throttle when overheat, etc. Swap if/else parts and use SOC_BCM2835 def so RPi3 can share the same cpufreq logic as RPi2, instead of falling to that for RPi. Submitted by: Jia-Shiun Li Differential Revision: https://reviews.freebsd.org/D9640 r315967: [rpi] Use compatibility string from upstream DTB for I2C controller FreeBSD uses upstream DTB for RPi3 build and compatibility string for i2c device is different there. Add this new string to compatibility data. Reported by: Karl Denninger r324184 by ian: Allow Raspberry Pi platform and drivers to be configured with upstream DTBs. - Added more compatibility strings to drivers not yet converted - Added new RPI platform code compatibility string to match the ones used upstream - Adapted RPI and RPI2 DTS to match the new platform code compatibility string The goal is to use the upstream DTBs as a replacement for our custom one. This is now possible with these changes. Additionally, as the RPI firmware automatically chooses the right DTB for us, this would allow to have one common armv6 kernel for RPI0 and RPI1 (BCM2835-based), and one common armv7 kernel for RPI2 v1.1 (BCM2836-based), and RPI2 v1.2 / RPI3 (BCM2837-based). Submitted by: Sylvain Garrigues Differential Revision: https://reviews.freebsd.org/D12360 r325768 by manu: arm: rpi2: Fix cpufreq(4) Since r324184 the root node compatible for rpi2 is "brcm,bcm2836", add it to the compatible list of bcm2835_cpufreq. Tested On: RPI2 v1.1 RPI2 v1.2 Reported by: many on freebsd-arm@ Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_bsc.c stable/11/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c stable/11/sys/arm/broadcom/bcm2835/bcm2835_machdep.c stable/11/sys/arm/broadcom/bcm2835/bcm2835_rng.c stable/11/sys/boot/fdt/dts/arm/rpi2.dts stable/11/sys/dev/usb/net/if_smsc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_bsc.c ============================================================================== --- stable/11/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Mon Apr 2 23:37:25 2018 (r331896) +++ stable/11/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Mon Apr 2 23:39:04 2018 (r331897) @@ -107,6 +107,7 @@ __FBSDID("$FreeBSD$"); static struct ofw_compat_data compat_data[] = { {"broadcom,bcm2835-bsc", 1}, {"brcm,bcm2708-i2c", 1}, + {"brcm,bcm2835-i2c", 1}, {NULL, 0} }; Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c ============================================================================== --- stable/11/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c Mon Apr 2 23:37:25 2018 (r331896) +++ stable/11/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c Mon Apr 2 23:39:04 2018 (r331897) @@ -68,16 +68,16 @@ __FBSDID("$FreeBSD$"); #define HZ2MHZ(freq) ((freq) / (1000 * 1000)) #define MHZ2HZ(freq) ((freq) * (1000 * 1000)) -#ifdef SOC_BCM2836 -#define OFFSET2MVOLT(val) (((val) / 1000)) -#define MVOLT2OFFSET(val) (((val) * 1000)) -#define DEFAULT_ARM_FREQUENCY 600 -#define DEFAULT_LOWEST_FREQ 600 -#else +#ifdef SOC_BCM2835 #define OFFSET2MVOLT(val) (1200 + ((val) * 25)) #define MVOLT2OFFSET(val) (((val) - 1200) / 25) #define DEFAULT_ARM_FREQUENCY 700 #define DEFAULT_LOWEST_FREQ 300 +#else +#define OFFSET2MVOLT(val) (((val) / 1000)) +#define MVOLT2OFFSET(val) (((val) * 1000)) +#define DEFAULT_ARM_FREQUENCY 600 +#define DEFAULT_LOWEST_FREQ 600 #endif #define DEFAULT_CORE_FREQUENCY 250 #define DEFAULT_SDRAM_FREQUENCY 400 @@ -128,6 +128,7 @@ static struct ofw_compat_data compat_data[] = { { "broadcom,bcm2835-vc", 1 }, { "broadcom,bcm2708-vc", 1 }, { "brcm,bcm2709", 1 }, + { "brcm,bcm2836", 1 }, { NULL, 0 } }; @@ -1546,7 +1547,20 @@ bcm2835_cpufreq_make_freq_list(device_t dev, struct cf if (min_freq > cpufreq_lowest_freq) min_freq = cpufreq_lowest_freq; -#ifdef SOC_BCM2836 +#ifdef SOC_BCM2835 + /* from freq to min_freq */ + for (idx = 0; idx < *count && freq >= min_freq; idx++) { + if (freq > sc->arm_min_freq) + volts = sc->max_voltage_core; + else + volts = sc->min_voltage_core; + sets[idx].freq = freq; + sets[idx].volts = volts; + sets[idx].lat = TRANSITION_LATENCY; + sets[idx].dev = dev; + freq -= MHZSTEP; + } +#else /* XXX RPi2 have only 900/600MHz */ idx = 0; volts = sc->min_voltage_core; @@ -1561,19 +1575,6 @@ bcm2835_cpufreq_make_freq_list(device_t dev, struct cf sets[idx].lat = TRANSITION_LATENCY; sets[idx].dev = dev; idx++; - } -#else - /* from freq to min_freq */ - for (idx = 0; idx < *count && freq >= min_freq; idx++) { - if (freq > sc->arm_min_freq) - volts = sc->max_voltage_core; - else - volts = sc->min_voltage_core; - sets[idx].freq = freq; - sets[idx].volts = volts; - sets[idx].lat = TRANSITION_LATENCY; - sets[idx].dev = dev; - freq -= MHZSTEP; } #endif *count = idx; Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_machdep.c ============================================================================== --- stable/11/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Mon Apr 2 23:37:25 2018 (r331896) +++ stable/11/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Mon Apr 2 23:39:04 2018 (r331897) @@ -132,7 +132,8 @@ static platform_method_t bcm2835_methods[] = { PLATFORMMETHOD_END, }; -FDT_PLATFORM_DEF(bcm2835, "bcm2835", 0, "raspberrypi,model-b", 100); +FDT_PLATFORM_DEF2(bcm2835, bcm2835_legacy, "bcm2835 (legacy)", 0, "raspberrypi,model-b", 100); +FDT_PLATFORM_DEF2(bcm2835, bcm2835, "bcm2835", 0, "brcm,bcm2835", 100); #endif #ifdef SOC_BCM2836 @@ -149,5 +150,6 @@ static platform_method_t bcm2836_methods[] = { PLATFORMMETHOD_END, }; -FDT_PLATFORM_DEF(bcm2836, "bcm2836", 0, "brcm,bcm2709", 100); +FDT_PLATFORM_DEF2(bcm2836, bcm2836_legacy, "bcm2836 (legacy)", 0, "brcm,bcm2709", 100); +FDT_PLATFORM_DEF2(bcm2836, bcm2836, "bcm2836", 0, "brcm,bcm2836", 100); #endif Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_rng.c ============================================================================== --- stable/11/sys/arm/broadcom/bcm2835/bcm2835_rng.c Mon Apr 2 23:37:25 2018 (r331896) +++ stable/11/sys/arm/broadcom/bcm2835/bcm2835_rng.c Mon Apr 2 23:39:04 2018 (r331897) @@ -109,6 +109,12 @@ struct bcm2835_rng_softc { long sc_underrun; }; +static struct ofw_compat_data compat_data[] = { + {"broadcom,bcm2835-rng", 1}, + {"brcm,bcm2835-rng", 1}, + {NULL, 0} +}; + static __inline void bcm2835_rng_stat_inc_underrun(struct bcm2835_rng_softc *sc) { @@ -364,7 +370,7 @@ bcm2835_rng_probe(device_t dev) if (!ofw_bus_status_okay(dev)) return (ENXIO); - if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-rng")) + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) return (ENXIO); device_set_desc(dev, "Broadcom BCM2835 RNG"); Modified: stable/11/sys/boot/fdt/dts/arm/rpi2.dts ============================================================================== --- stable/11/sys/boot/fdt/dts/arm/rpi2.dts Mon Apr 2 23:37:25 2018 (r331896) +++ stable/11/sys/boot/fdt/dts/arm/rpi2.dts Mon Apr 2 23:39:04 2018 (r331897) @@ -30,7 +30,7 @@ / { model = "Raspberry Pi 2 Model B"; - compatible = "brcm,bcm2709"; + compatible = "brcm,bcm2836"; memreserve = <0x08000000 0x08000000>; /* Set by VideoCore */ Modified: stable/11/sys/dev/usb/net/if_smsc.c ============================================================================== --- stable/11/sys/dev/usb/net/if_smsc.c Mon Apr 2 23:37:25 2018 (r331896) +++ stable/11/sys/dev/usb/net/if_smsc.c Mon Apr 2 23:39:04 2018 (r331897) @@ -1568,8 +1568,9 @@ smsc_fdt_find_eth_node(phandle_t start) /* Traverse through entire tree to find usb ethernet nodes. */ for (node = OF_child(start); node != 0; node = OF_peer(node)) { - if (ofw_bus_node_is_compatible(node, "net,ethernet") && - ofw_bus_node_is_compatible(node, "usb,device")) + if ((ofw_bus_node_is_compatible(node, "net,ethernet") && + ofw_bus_node_is_compatible(node, "usb,device")) || + ofw_bus_node_is_compatible(node, "usb424,ec00")) return (node); child = smsc_fdt_find_eth_node(node); if (child != -1) From owner-svn-src-stable-11@freebsd.org Mon Apr 2 23:44:13 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 418E2F6DD2D; Mon, 2 Apr 2018 23:44:13 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D160C79530; Mon, 2 Apr 2018 23:44:12 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C66971C819; Mon, 2 Apr 2018 23:44:12 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w32NiCgS071730; Mon, 2 Apr 2018 23:44:12 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w32NiCvF071727; Mon, 2 Apr 2018 23:44:12 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201804022344.w32NiCvF071727@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Mon, 2 Apr 2018 23:44: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: r331899 - stable/11/sys/dev/usb/net X-SVN-Group: stable-11 X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: stable/11/sys/dev/usb/net X-SVN-Commit-Revision: 331899 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Apr 2018 23:44:13 -0000 Author: gonzo Date: Mon Apr 2 23:44:12 2018 New Revision: 331899 URL: https://svnweb.freebsd.org/changeset/base/331899 Log: MFC r325048: Fix MAC address detection regression introduced by r324184 To accomodate all variaties of Pi DTS files floating around we look for MAC address property either in DTS node for USB ethernet (if it exists) or at predefined path ".../usb/hub/ethernet". After r324184 smsc_fdt_find_eth_node started to return node with compatibility string "usb424,ec00" as an eth node. In imported GNU dts files this node still does not have MAC address related property, and therefor following check for "mac-address" and "local-mac-address" fails. To make this logic more robust do not just search for the node but also make sure it has required property, so if node with accepted compatibility string exists but doesn't have the property we fall back to looking for hardoded path mentioned above. Modified: stable/11/sys/dev/usb/net/if_smsc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/net/if_smsc.c ============================================================================== --- stable/11/sys/dev/usb/net/if_smsc.c Mon Apr 2 23:40:50 2018 (r331898) +++ stable/11/sys/dev/usb/net/if_smsc.c Mon Apr 2 23:44:12 2018 (r331899) @@ -1637,6 +1637,37 @@ smsc_fdt_find_eth_node_by_path(phandle_t start) return (-1); } +/* + * Look through known names that can contain mac address + * return 0 if valid MAC address has been found + */ +static int +smsc_fdt_read_mac_property(phandle_t node, unsigned char *mac) +{ + int len; + + /* Check if there is property */ + if ((len = OF_getproplen(node, "local-mac-address")) > 0) { + if (len != ETHER_ADDR_LEN) + return (EINVAL); + + OF_getprop(node, "local-mac-address", mac, + ETHER_ADDR_LEN); + return (0); + } + + if ((len = OF_getproplen(node, "mac-address")) > 0) { + if (len != ETHER_ADDR_LEN) + return (EINVAL); + + OF_getprop(node, "mac-address", mac, + ETHER_ADDR_LEN); + return (0); + } + + return (ENXIO); +} + /** * Get MAC address from FDT blob. Firmware or loader should fill * mac-address or local-mac-address property. Returns 0 if MAC address @@ -1646,37 +1677,22 @@ static int smsc_fdt_find_mac(unsigned char *mac) { phandle_t node, root; - int len; root = OF_finddevice("/"); node = smsc_fdt_find_eth_node(root); + if (node != -1) { + if (smsc_fdt_read_mac_property(node, mac) == 0) + return (0); + } + /* * If it's not FreeBSD FDT blob for RPi, try more * generic .../usb/hub/ethernet */ - if (node == -1) - node = smsc_fdt_find_eth_node_by_path(root); + node = smsc_fdt_find_eth_node_by_path(root); - if (node != -1) { - /* Check if there is property */ - if ((len = OF_getproplen(node, "local-mac-address")) > 0) { - if (len != ETHER_ADDR_LEN) - return (EINVAL); - - OF_getprop(node, "local-mac-address", mac, - ETHER_ADDR_LEN); - return (0); - } - - if ((len = OF_getproplen(node, "mac-address")) > 0) { - if (len != ETHER_ADDR_LEN) - return (EINVAL); - - OF_getprop(node, "mac-address", mac, - ETHER_ADDR_LEN); - return (0); - } - } + if (node != -1) + return smsc_fdt_read_mac_property(node, mac); return (ENXIO); } From owner-svn-src-stable-11@freebsd.org Tue Apr 3 01:47:43 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2C04F761B3; Tue, 3 Apr 2018 01:47:43 +0000 (UTC) (envelope-from linimon@lonesome.com) Received: from mail.soaustin.net (mail.soaustin.net [192.108.105.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.soaustin.net", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 354B97EB3C; Tue, 3 Apr 2018 01:47:42 +0000 (UTC) (envelope-from linimon@lonesome.com) Received: from lonesome.com (bones.soaustin.net [192.108.105.22]) by mail.soaustin.net (Postfix) with ESMTPSA id C37B4EE8; Mon, 2 Apr 2018 20:47:35 -0500 (CDT) Date: Mon, 2 Apr 2018 20:47:34 -0500 From: Mark Linimon To: Ed Maste Cc: Dimitry Andric , Antoine Brodin , svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers , re , svn-src-stable-11@freebsd.org Subject: Re: svn commit: r331838 - in stable/11: . contrib/compiler-rt/include/sanitizer contrib/compiler-rt/include/xray contrib/compiler-rt/lib/BlocksRuntime contrib/compiler-rt/lib/asan contrib/compiler-rt/l... Message-ID: <20180403014734.GA31748@lonesome.com> References: <201803311138.w2VBcKHP014025@repo.freebsd.org> <68DEEF9A-6290-40AD-B51D-E187593C089F@FreeBSD.org> <20180331131818.GA22697@lonesome.com> <20180331184109.GA23589@lonesome.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2018 01:47:44 -0000 So, the takeaway is, this change stays, and stable/11 users that build their own ports are on their own? Whatever happened to POLA? mcl From owner-svn-src-stable-11@freebsd.org Tue Apr 3 02:03:12 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E1695F7729D; Tue, 3 Apr 2018 02:03:11 +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 3F7B97F62C; Tue, 3 Apr 2018 02:03:10 +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 w3322xnN085228; Mon, 2 Apr 2018 19:02:59 -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 w3322xXG085227; Mon, 2 Apr 2018 19:02:59 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201804030202.w3322xXG085227@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r331838 - in stable/11: . contrib/compiler-rt/include/sanitizer contrib/compiler-rt/include/xray contrib/compiler-rt/lib/BlocksRuntime contrib/compiler-rt/lib/asan contrib/compiler-rt/l... In-Reply-To: <20180403014734.GA31748@lonesome.com> To: Mark Linimon Date: Mon, 2 Apr 2018 19:02:59 -0700 (PDT) CC: Ed Maste , Dimitry Andric , Antoine Brodin , svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers , re , svn-src-stable-11@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-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2018 02:03:12 -0000 > So, the takeaway is, this change stays, and stable/11 users that build > their own ports are on their own? > > Whatever happened to POLA? I have no idea, but I fully agree that changing compilers 30 days before a code slush is just a very bad move. The llvm in 11.1 is 4. Is there some pressing reason that we need llvm 6 to be in release 11.2? Looks like I wont be upgrading to 11.2 as I am sure I'll have blocking issues with some ports. Though I could probably build them with 11.1, I hate that idea as then I have to keep an 11.1 around incase I need to rebuild something. :-( -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-stable-11@freebsd.org Tue Apr 3 02:08:33 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 428E6F777BB for ; Tue, 3 Apr 2018 02:08:33 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x22f.google.com (mail-it0-x22f.google.com [IPv6:2607:f8b0:4001:c0b::22f]) (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 5FD147F93F for ; Tue, 3 Apr 2018 02:08:32 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x22f.google.com with SMTP id 71-v6so18712817ith.2 for ; Mon, 02 Apr 2018 19:08:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=WThxa+EuokpJXL9ViZ9ygewEbQ+TR2jIE4rIskB6JGY=; b=SEzjPCKWHdMzf2+qsUnynAVqFcH0/sXaxevEHSALC2JkgyIAUY2QzgoCX9XB/LpLi2 s9gUAU0CeqsqJCHrr+RteIjo6as4tRrA58CS2rKLPBdNDbJTthQN/KYX0CGl5i3KzBQe 5PgLUiVFMU5b+aKCNWu4YRb5N0PH1ECUzPqzJaeT7iyYzuUVWY2pAQ5O8RiPHdLfjnOi OVdZ7t/hqWsgyePvKrFr5MjeCIWZ5xvQbBNa0AXMkgU3bEO2UablAQfCHYVZVpVm32F6 90u7k8pTOSi4G79Bwz1kbOQ2HpVrEXLtt31/YgG51wTtDdJgB+ulrGL1x5E6aSkfbMG8 JW9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=WThxa+EuokpJXL9ViZ9ygewEbQ+TR2jIE4rIskB6JGY=; b=rwO5fQaSS1Tj8ohZWSr3bZCQMLQHcLdnu1hJ7xkp8CdmvWt2IbHZK7pwGVXIxoIdLo 0CnPZzE1b0hxOS2XqWBpypsKQfqYwpHoCfolu7HrzY4Dd3lezQWEJmlpUwy9bqAluVWl 5czB1af0cov1xeTfbfxWW13f+QMoCsw/vKAH/Gqt1K/hUIGDHQizrOtc0FxBCt6LAMZd S0e9/yOq0EqHaLDw2d3brhdfT705hTaNTVvnDfpe41rNf6QZ/AF1X2+A3EWCEUttfZVQ 6HeMMBGLtiCYjjivBKkmpNyE/H2pK3CnxOr215ulPBIa6TscNzqP4yNw4896IMNJUsKv vatg== X-Gm-Message-State: ALQs6tAeURB/izVWVS5EdM0WZvRV7m1SkrzCHQP1a9z5KfwyvJ8L1GO7 /A9ZDmK60b5zUEeIO7TROE8u5kltTrcD6nMXnZsajQ== X-Google-Smtp-Source: AIpwx49nN8NEbZwgOWmIh3SZuRheSRYP4eEnmUpIP531PYWvSaeR/eDzr52oZ+pq3fGJr7IyyforHkSREtYiWSNYKwU= X-Received: by 2002:a24:b649:: with SMTP id d9-v6mr3403085itj.51.1522721311485; Mon, 02 Apr 2018 19:08:31 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.203.196 with HTTP; Mon, 2 Apr 2018 19:08:30 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: <20180403014734.GA31748@lonesome.com> References: <201803311138.w2VBcKHP014025@repo.freebsd.org> <68DEEF9A-6290-40AD-B51D-E187593C089F@FreeBSD.org> <20180331131818.GA22697@lonesome.com> <20180331184109.GA23589@lonesome.com> <20180403014734.GA31748@lonesome.com> From: Warner Losh Date: Mon, 2 Apr 2018 20:08:30 -0600 X-Google-Sender-Auth: Z6PZcDLDeFhPANTUVzPS8_gZxvo Message-ID: Subject: Re: svn commit: r331838 - in stable/11: . contrib/compiler-rt/include/sanitizer contrib/compiler-rt/include/xray contrib/compiler-rt/lib/BlocksRuntime contrib/compiler-rt/lib/asan contrib/compiler-rt/l... To: Mark Linimon Cc: Ed Maste , Dimitry Andric , Antoine Brodin , svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers , re , svn-src-stable-11@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2018 02:08:33 -0000 On Mon, Apr 2, 2018 at 7:47 PM, Mark Linimon wrote: > So, the takeaway is, this change stays, and stable/11 users that build > their own ports are on their own? > > Whatever happened to POLA? > I think the takeaway was that the timing was good, but the pre-MFC communication could be more explicit in the future. There's also more communication needed about how to fix common breakage from compiler updates that's needed as well when a new compiler is imported. In the mean time, there's fallout in the ports, and people should use the next month to fix them. Not idea, I'll grant. Warner From owner-svn-src-stable-11@freebsd.org Tue Apr 3 02:29:18 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C8C74F78E8F; Tue, 3 Apr 2018 02:29:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 74DC480566; Tue, 3 Apr 2018 02:29:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6FACC1E2F0; Tue, 3 Apr 2018 02:29:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w332TIUl037220; Tue, 3 Apr 2018 02:29:18 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w332THDD037170; Tue, 3 Apr 2018 02:29:17 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201804030229.w332THDD037170@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 3 Apr 2018 02:29:17 +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: r331903 - in stable/11/sys/dev/mpr: . mpi X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/dev/mpr: . mpi X-SVN-Commit-Revision: 331903 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2018 02:29:19 -0000 Author: mav Date: Tue Apr 3 02:29:17 2018 New Revision: 331903 URL: https://svnweb.freebsd.org/changeset/base/331903 Log: MFC r331228: Update mpr(4) driver from v15 to v18 from Broadcom site. Version 16 is just a number bump, since we already had those changes. Version 17 introduces new AdapterType value, that allows new user-space tools from Broadcom to differentiate adapter generations 3 and 3.5. Version 18 updates headers and adds SAS_DEVICE_DISCOVERY_ERROR reporting. Modified: stable/11/sys/dev/mpr/mpi/mpi2.h stable/11/sys/dev/mpr/mpi/mpi2_cnfg.h stable/11/sys/dev/mpr/mpi/mpi2_history.txt stable/11/sys/dev/mpr/mpi/mpi2_ioc.h stable/11/sys/dev/mpr/mpr_ioctl.h stable/11/sys/dev/mpr/mpr_sas.c stable/11/sys/dev/mpr/mpr_sas_lsi.c stable/11/sys/dev/mpr/mpr_user.c stable/11/sys/dev/mpr/mprvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mpr/mpi/mpi2.h ============================================================================== --- stable/11/sys/dev/mpr/mpi/mpi2.h Tue Apr 3 01:22:15 2018 (r331902) +++ stable/11/sys/dev/mpr/mpi/mpi2.h Tue Apr 3 02:29:17 2018 (r331903) @@ -44,7 +44,7 @@ * scatter/gather formats. * Creation Date: June 21, 2006 * - * mpi2.h Version: 02.00.46 + * mpi2.h Version: 02.00.48 * * NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25 * prefix are for use only on MPI v2.5 products, and must not be used @@ -151,6 +151,8 @@ * 04-10-16 02.00.44 Bumped MPI2_HEADER_VERSION_UNIT. * 07-06-16 02.00.45 Bumped MPI2_HEADER_VERSION_UNIT. * 09-02-16 02.00.46 Bumped MPI2_HEADER_VERSION_UNIT. + * 11-23-16 02.00.47 Bumped MPI2_HEADER_VERSION_UNIT. + * 02-03-17 02.00.48 Bumped MPI2_HEADER_VERSION_UNIT. * -------------------------------------------------------------------------- */ @@ -194,7 +196,7 @@ /* Unit and Dev versioning for this MPI header set */ -#define MPI2_HEADER_VERSION_UNIT (0x2E) +#define MPI2_HEADER_VERSION_UNIT (0x30) #define MPI2_HEADER_VERSION_DEV (0x00) #define MPI2_HEADER_VERSION_UNIT_MASK (0xFF00) #define MPI2_HEADER_VERSION_UNIT_SHIFT (8) Modified: stable/11/sys/dev/mpr/mpi/mpi2_cnfg.h ============================================================================== --- stable/11/sys/dev/mpr/mpi/mpi2_cnfg.h Tue Apr 3 01:22:15 2018 (r331902) +++ stable/11/sys/dev/mpr/mpi/mpi2_cnfg.h Tue Apr 3 02:29:17 2018 (r331903) @@ -42,7 +42,7 @@ * Title: MPI Configuration messages and pages * Creation Date: November 10, 2006 * - * mpi2_cnfg.h Version: 02.00.39 + * mpi2_cnfg.h Version: 02.00.40 * * NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25 * prefix are for use only on MPI v2.5 products, and must not be used @@ -255,6 +255,10 @@ * 09-01-16 02.00.39 Added MPI26_CONFIG_PAGE_ENCLOSURE_0 and related defines. * Added MPI26_ENCLOS_PGAD_FORM_GET_NEXT_HANDLE and * MPI26_ENCLOS_PGAD_FORM_HANDLE page address formats. + * 02-02-17 02.00.40 Added MPI2_MANPAGE7_SLOT_UNKNOWN. + * Added ChassisSlot field to SAS Enclosure Page 0. + * Added ChassisSlot Valid bit (bit 5) to the Flags field + * in SAS Enclosure Page 0. * -------------------------------------------------------------------------- */ @@ -853,6 +857,9 @@ typedef struct _MPI2_MANPAGE7_CONNECTOR_INFO #define MPI2_MANPAGE7_LOCATION_NOT_PRESENT (0x20) #define MPI2_MANPAGE7_LOCATION_NOT_CONNECTED (0x80) +/* defines for the Slot field */ +#define MPI2_MANPAGE7_SLOT_UNKNOWN (0xFFFF) + /* * Host code (drivers, BIOS, utilities, etc.) should leave this define set to * one and check the value returned for NumPhys at runtime. @@ -3092,11 +3099,11 @@ typedef struct _MPI2_CONFIG_PAGE_SAS_ENCLOSURE_0 U16 EnclosureHandle; /* 0x16 */ U16 NumSlots; /* 0x18 */ U16 StartSlot; /* 0x1A */ - U8 Reserved2; /* 0x1C */ + U8 ChassisSlot; /* 0x1C */ U8 EnclosureLevel; /* 0x1D */ U16 SEPDevHandle; /* 0x1E */ - U32 Reserved3; /* 0x20 */ - U32 Reserved4; /* 0x24 */ + U32 Reserved2; /* 0x20 */ + U32 Reserved3; /* 0x24 */ } MPI2_CONFIG_PAGE_SAS_ENCLOSURE_0, MPI2_POINTER PTR_MPI2_CONFIG_PAGE_SAS_ENCLOSURE_0, Mpi2SasEnclosurePage0_t, MPI2_POINTER pMpi2SasEnclosurePage0_t, @@ -3107,6 +3114,7 @@ typedef struct _MPI2_CONFIG_PAGE_SAS_ENCLOSURE_0 #define MPI2_SASENCLOSURE0_PAGEVERSION (0x04) /* values for SAS Enclosure Page 0 Flags field */ +#define MPI2_SAS_ENCLS0_FLAGS_CHASSIS_SLOT_VALID (0x0020) #define MPI2_SAS_ENCLS0_FLAGS_ENCL_LEVEL_VALID (0x0010) #define MPI2_SAS_ENCLS0_FLAGS_MNG_MASK (0x000F) #define MPI2_SAS_ENCLS0_FLAGS_MNG_UNKNOWN (0x0000) @@ -3119,6 +3127,7 @@ typedef struct _MPI2_CONFIG_PAGE_SAS_ENCLOSURE_0 #define MPI26_ENCLOSURE0_PAGEVERSION (0x04) /* Values for Enclosure Page 0 Flags field */ +#define MPI26_ENCLS0_FLAGS_CHASSIS_SLOT_VALID (0x0020) #define MPI26_ENCLS0_FLAGS_ENCL_LEVEL_VALID (0x0010) #define MPI26_ENCLS0_FLAGS_MNG_MASK (0x000F) #define MPI26_ENCLS0_FLAGS_MNG_UNKNOWN (0x0000) Modified: stable/11/sys/dev/mpr/mpi/mpi2_history.txt ============================================================================== --- stable/11/sys/dev/mpr/mpi/mpi2_history.txt Tue Apr 3 01:22:15 2018 (r331902) +++ stable/11/sys/dev/mpr/mpi/mpi2_history.txt Tue Apr 3 02:29:17 2018 (r331903) @@ -41,16 +41,16 @@ All rights reserved. --------------------------------------- - Header Set Release Version: 02.00.46 - Header Set Release Date: 09-07-16 + Header Set Release Version: 02.00.48 + Header Set Release Date: 02-03-17 --------------------------------------- Filename Current version Prior version ---------- --------------- ------------- - mpi2.h 02.00.46 02.00.45 - mpi2_cnfg.h 02.00.39 02.00.38 + mpi2.h 02.00.48 02.00.47 + mpi2_cnfg.h 02.00.40 02.00.39 mpi2_init.h 02.00.21 02.00.21 - mpi2_ioc.h 02.00.30 02.00.29 + mpi2_ioc.h 02.00.32 02.00.31 mpi2_raid.h 02.00.11 02.00.11 mpi2_sas.h 02.00.10 02.00.10 mpi2_targ.h 02.00.09 02.00.09 @@ -59,7 +59,7 @@ mpi2_ra.h 02.00.01 02.00.01 mpi2_hbd.h 02.00.04 02.00.04 mpi2_pci.h 02.00.02 02.00.02 - mpi2_history.txt 02.00.43 02.00.43 + mpi2_history.txt 02.00.45 02.00.44 * Date Version Description @@ -161,6 +161,8 @@ mpi2.h * 04-10-16 02.00.44 Bumped MPI2_HEADER_VERSION_UNIT. * 07-06-16 02.00.45 Bumped MPI2_HEADER_VERSION_UNIT. * 09-02-16 02.00.46 Bumped MPI2_HEADER_VERSION_UNIT. + * 11-23-16 02.00.47 Bumped MPI2_HEADER_VERSION_UNIT. + * 02-03-17 02.00.48 Bumped MPI2_HEADER_VERSION_UNIT. * -------------------------------------------------------------------------- mpi2_cnfg.h @@ -363,8 +365,12 @@ mpi2_cnfg.h * phy data. * Added InitStatus to PCIe IO Unit Page 1 header. * 09-01-16 02.00.39 Added MPI26_CONFIG_PAGE_ENCLOSURE_0 and related defines. - * Added MPI26_ENCLOS_PGAD_FORM_GET_NEXT_HANDLE and - * MPI26_ENCLOS_PGAD_FORM_HANDLE page address formats. + * Added MPI26_ENCLOS_PGAD_FORM_GET_NEXT_HANDLE and + * MPI26_ENCLOS_PGAD_FORM_HANDLE page address formats. + * 02-02-17 02.00.40 Added MPI2_MANPAGE7_SLOT_UNKNOWN. + * Added ChassisSlot field to SAS Enclosure Page 0. + * Added ChassisSlot Valid bit (bit 5) to the Flags field + * in SAS Enclosure Page 0. * -------------------------------------------------------------------------- mpi2_init.h @@ -551,10 +557,15 @@ mpi2_ioc.h * Request Message. * Added new values for the RegionType field in the Layout * Data sections of the FLASH Layout Extended Image Data. - * Added new defines for the ReasonCode field of + * Added new defines for the ReasonCode field of * Active Cable Exception Event. - * Added MPI2_EVENT_ENCL_DEVICE_STATUS_CHANGE and - * MPI26_EVENT_DATA_ENCL_DEV_STATUS_CHANGE. + * Added MPI2_EVENT_ENCL_DEVICE_STATUS_CHANGE and + * MPI26_EVENT_DATA_ENCL_DEV_STATUS_CHANGE. + * 11-23-16 02.00.31 Added MPI2_EVENT_SAS_DEVICE_DISCOVERY_ERROR and + * MPI25_EVENT_DATA_SAS_DEVICE_DISCOVERY_ERROR. + * 02-02-17 02.00.32 Added MPI2_FW_DOWNLOAD_ITYPE_CBB_BACKUP. + * Added MPI25_EVENT_DATA_ACTIVE_CABLE_EXCEPT and related + * defines for the ReasonCode field. * -------------------------------------------------------------------------- mpi2_raid.h @@ -676,20 +687,35 @@ mpi2_pci.h mpi2_history.txt Parts list history -Filename 02.00.46 02.00.45 02.00.44 02.00.43 02.00.42 ----------- -------- -------- -------- -------- -------- -mpi2.h 02.00.46 02.00.45 02.00.44 02.00.43 02.00.42 -mpi2_cnfg.h 02.00.39 02.00.38 02.00.37 02.00.36 02.00.35 -mpi2_init.h 02.00.21 02.00.21 02.00.21 02.00.21 02.00.20 -mpi2_ioc.h 02.00.30 02.00.29 02.00.28 02.00.28 02.00.27 -mpi2_raid.h 02.00.11 02.00.11 02.00.11 02.00.11 02.00.11 -mpi2_sas.h 02.00.10 02.00.10 02.00.10 02.00.10 02.00.10 -mpi2_targ.h 02.00.09 02.00.09 02.00.09 02.00.09 02.00.09 -mpi2_tool.h 02.00.14 02.00.13 02.00.13 02.00.13 02.00.13 -mpi2_type.h 02.00.01 02.00.01 02.00.01 02.00.01 02.00.01 -mpi2_ra.h 02.00.01 02.00.01 02.00.01 02.00.01 02.00.01 -mpi2_hbd.h 02.00.04 02.00.04 02.00.04 02.00.04 02.00.03 -mpi2_pci.h 02.00.02 02.00.02 02.00.01 02.00.01 02.00.00 +Filename 02.00.48 +---------- -------- +mpi2.h 02.00.48 +mpi2_cnfg.h 02.00.40 +mpi2_init.h 02.00.21 +mpi2_ioc.h 02.00.32 +mpi2_raid.h 02.00.11 +mpi2_sas.h 02.00.10 +mpi2_targ.h 02.00.09 +mpi2_tool.h 02.00.14 +mpi2_type.h 02.00.01 +mpi2_ra.h 02.00.01 +mpi2_hbd.h 02.00.04 +mpi2_pci.h 02.00.02 + +Filename 02.00.47 02.00.46 02.00.45 02.00.44 02.00.43 02.00.42 +---------- -------- -------- -------- -------- -------- -------- +mpi2.h 02.00.47 02.00.46 02.00.45 02.00.44 02.00.43 02.00.42 +mpi2_cnfg.h 02.00.39 02.00.39 02.00.38 02.00.37 02.00.36 02.00.35 +mpi2_init.h 02.00.21 02.00.21 02.00.21 02.00.21 02.00.21 02.00.20 +mpi2_ioc.h 02.00.31 02.00.30 02.00.29 02.00.28 02.00.28 02.00.27 +mpi2_raid.h 02.00.11 02.00.11 02.00.11 02.00.11 02.00.11 02.00.11 +mpi2_sas.h 02.00.10 02.00.10 02.00.10 02.00.10 02.00.10 02.00.10 +mpi2_targ.h 02.00.09 02.00.09 02.00.09 02.00.09 02.00.09 02.00.09 +mpi2_tool.h 02.00.14 02.00.14 02.00.13 02.00.13 02.00.13 02.00.13 +mpi2_type.h 02.00.01 02.00.01 02.00.01 02.00.01 02.00.01 02.00.01 +mpi2_ra.h 02.00.01 02.00.01 02.00.01 02.00.01 02.00.01 02.00.01 +mpi2_hbd.h 02.00.04 02.00.04 02.00.04 02.00.04 02.00.04 02.00.03 +mpi2_pci.h 02.00.02 02.00.02 02.00.02 02.00.01 02.00.01 02.00.00 Filename 02.00.41 02.00.40 02.00.39 02.00.38 02.00.37 02.00.36 ---------- -------- -------- -------- -------- -------- -------- Modified: stable/11/sys/dev/mpr/mpi/mpi2_ioc.h ============================================================================== --- stable/11/sys/dev/mpr/mpi/mpi2_ioc.h Tue Apr 3 01:22:15 2018 (r331902) +++ stable/11/sys/dev/mpr/mpi/mpi2_ioc.h Tue Apr 3 02:29:17 2018 (r331903) @@ -42,7 +42,7 @@ * Title: MPI IOC, Port, Event, FW Download, and FW Upload messages * Creation Date: October 11, 2006 * - * mpi2_ioc.h Version: 02.00.30 + * mpi2_ioc.h Version: 02.00.32 * * NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25 * prefix are for use only on MPI v2.5 products, and must not be used @@ -200,6 +200,11 @@ * Active Cable Exception Event. * Added MPI2_EVENT_ENCL_DEVICE_STATUS_CHANGE and * MPI26_EVENT_DATA_ENCL_DEV_STATUS_CHANGE. + * 11-23-16 02.00.31 Added MPI2_EVENT_SAS_DEVICE_DISCOVERY_ERROR and + * MPI25_EVENT_DATA_SAS_DEVICE_DISCOVERY_ERROR. + * 02-02-17 02.00.32 Added MPI2_FW_DOWNLOAD_ITYPE_CBB_BACKUP. + * Added MPI25_EVENT_DATA_ACTIVE_CABLE_EXCEPT and related + * defines for the ReasonCode field. * -------------------------------------------------------------------------- */ @@ -610,6 +615,7 @@ typedef struct _MPI2_EVENT_NOTIFICATION_REPLY #define MPI2_EVENT_PCIE_TOPOLOGY_CHANGE_LIST (0x0032) /* MPI v2.6 and later */ #define MPI2_EVENT_PCIE_LINK_COUNTER (0x0033) /* MPI v2.6 and later */ #define MPI2_EVENT_ACTIVE_CABLE_EXCEPTION (0x0034) /* MPI v2.6 and later */ +#define MPI2_EVENT_SAS_DEVICE_DISCOVERY_ERROR (0x0035) /* MPI v2.5 and later */ #define MPI2_EVENT_MIN_PRODUCT_SPECIFIC (0x006E) #define MPI2_EVENT_MAX_PRODUCT_SPECIFIC (0x007F) @@ -715,12 +721,21 @@ typedef struct _MPI26_EVENT_DATA_ACTIVE_CABLE_EXCEPT U8 ReasonCode; /* 0x04 */ U8 ReceptacleID; /* 0x05 */ U16 Reserved1; /* 0x06 */ -} MPI26_EVENT_DATA_ACTIVE_CABLE_EXCEPT, +} MPI25_EVENT_DATA_ACTIVE_CABLE_EXCEPT, + MPI2_POINTER PTR_MPI25_EVENT_DATA_ACTIVE_CABLE_EXCEPT, + Mpi25EventDataActiveCableExcept_t, + MPI2_POINTER pMpi25EventDataActiveCableExcept_t, + MPI26_EVENT_DATA_ACTIVE_CABLE_EXCEPT, MPI2_POINTER PTR_MPI26_EVENT_DATA_ACTIVE_CABLE_EXCEPT, Mpi26EventDataActiveCableExcept_t, MPI2_POINTER pMpi26EventDataActiveCableExcept_t; -/* defines for ReasonCode field */ +/* MPI2.5 defines for the ReasonCode field */ +#define MPI25_EVENT_ACTIVE_CABLE_INSUFFICIENT_POWER (0x00) +#define MPI25_EVENT_ACTIVE_CABLE_PRESENT (0x01) +#define MPI25_EVENT_ACTIVE_CABLE_DEGRADED (0x02) + +/* MPI2.6 defines for the ReasonCode field */ #define MPI26_EVENT_ACTIVE_CABLE_INSUFFICIENT_POWER (0x00) #define MPI26_EVENT_ACTIVE_CABLE_PRESENT (0x01) #define MPI26_EVENT_ACTIVE_CABLE_DEGRADED (0x02) @@ -1168,6 +1183,24 @@ typedef struct _MPI2_EVENT_DATA_SAS_QUIESCE #define MPI2_EVENT_SAS_QUIESCE_RC_COMPLETED (0x02) +typedef struct _MPI25_EVENT_DATA_SAS_DEVICE_DISCOVERY_ERROR +{ + U16 DevHandle; /* 0x00 */ + U8 ReasonCode; /* 0x02 */ + U8 PhysicalPort; /* 0x03 */ + U32 Reserved1[2]; /* 0x04 */ + U64 SASAddress; /* 0x0C */ + U32 Reserved2[2]; /* 0x14 */ +} MPI25_EVENT_DATA_SAS_DEVICE_DISCOVERY_ERROR, + MPI2_POINTER PTR_MPI25_EVENT_DATA_SAS_DEVICE_DISCOVERY_ERROR, + Mpi25EventDataSasDeviceDiscoveryError_t, + MPI2_POINTER pMpi25EventDataSasDeviceDiscoveryError_t; + +/* SAS Device Discovery Error Event data ReasonCode values */ +#define MPI25_EVENT_SAS_DISC_ERR_SMP_FAILED (0x01) +#define MPI25_EVENT_SAS_DISC_ERR_SMP_TIMEOUT (0x02) + + /* Host Based Discovery Phy Event data */ typedef struct _MPI2_EVENT_HBD_PHY_SAS @@ -1493,6 +1526,7 @@ typedef struct _MPI2_FW_DOWNLOAD_REQUEST #define MPI2_FW_DOWNLOAD_ITYPE_COMPLETE (0x0A) #define MPI2_FW_DOWNLOAD_ITYPE_COMMON_BOOT_BLOCK (0x0B) #define MPI2_FW_DOWNLOAD_ITYPE_PUBLIC_KEY (0x0C) /* MPI v2.5 and newer */ +#define MPI2_FW_DOWNLOAD_ITYPE_CBB_BACKUP (0x0D) #define MPI2_FW_DOWNLOAD_ITYPE_SBR (0x0E) #define MPI2_FW_DOWNLOAD_ITYPE_SBR_BACKUP (0x0F) #define MPI2_FW_DOWNLOAD_ITYPE_HIIM (0x10) Modified: stable/11/sys/dev/mpr/mpr_ioctl.h ============================================================================== --- stable/11/sys/dev/mpr/mpr_ioctl.h Tue Apr 3 01:22:15 2018 (r331902) +++ stable/11/sys/dev/mpr/mpr_ioctl.h Tue Apr 3 02:29:17 2018 (r331903) @@ -149,6 +149,7 @@ typedef struct mpr_pci_bits * */ #define MPRIOCTL_ADAPTER_TYPE_SAS3 6 +#define MPRIOCTL_ADAPTER_TYPE_SAS35 7 typedef struct mpr_adapter_data { uint32_t StructureLength; @@ -202,7 +203,7 @@ typedef struct mpr_pass_thru /* * Event queue defines */ -#define MPR_EVENT_QUEUE_SIZE (50) /* Max Events stored in driver */ +#define MPR_EVENT_QUEUE_SIZE (200) /* Max Events stored in driver */ #define MPR_MAX_EVENT_DATA_LENGTH (48) /* Size of each event in Dwords */ typedef struct mpr_event_query Modified: stable/11/sys/dev/mpr/mpr_sas.c ============================================================================== --- stable/11/sys/dev/mpr/mpr_sas.c Tue Apr 3 01:22:15 2018 (r331902) +++ stable/11/sys/dev/mpr/mpr_sas.c Tue Apr 3 02:29:17 2018 (r331903) @@ -708,6 +708,7 @@ mprsas_register_events(struct mpr_softc *sc) setbit(events, MPI2_EVENT_IR_PHYSICAL_DISK); setbit(events, MPI2_EVENT_IR_OPERATION_STATUS); setbit(events, MPI2_EVENT_TEMP_THRESHOLD); + setbit(events, MPI2_EVENT_SAS_DEVICE_DISCOVERY_ERROR); if (sc->facts->MsgVersion >= MPI2_VERSION_02_06) { setbit(events, MPI2_EVENT_ACTIVE_CABLE_EXCEPTION); if (sc->mpr_flags & MPR_FLAGS_GEN35_IOC) { Modified: stable/11/sys/dev/mpr/mpr_sas_lsi.c ============================================================================== --- stable/11/sys/dev/mpr/mpr_sas_lsi.c Tue Apr 3 01:22:15 2018 (r331902) +++ stable/11/sys/dev/mpr/mpr_sas_lsi.c Tue Apr 3 02:29:17 2018 (r331903) @@ -681,6 +681,41 @@ skip_fp_send: } break; } + case MPI2_EVENT_SAS_DEVICE_DISCOVERY_ERROR: + { + pMpi25EventDataSasDeviceDiscoveryError_t discovery_error_data; + uint64_t sas_address; + + discovery_error_data = + (pMpi25EventDataSasDeviceDiscoveryError_t) + fw_event->event_data; + + sas_address = discovery_error_data->SASAddress.High; + sas_address = (sas_address << 32) | + discovery_error_data->SASAddress.Low; + + switch(discovery_error_data->ReasonCode) { + case MPI25_EVENT_SAS_DISC_ERR_SMP_FAILED: + { + mpr_printf(sc, "SMP command failed during discovery " + "for expander with SAS Address %jx and " + "handle 0x%x.\n", sas_address, + discovery_error_data->DevHandle); + break; + } + case MPI25_EVENT_SAS_DISC_ERR_SMP_TIMEOUT: + { + mpr_printf(sc, "SMP command timed out during " + "discovery for expander with SAS Address %jx and " + "handle 0x%x.\n", sas_address, + discovery_error_data->DevHandle); + break; + } + default: + break; + } + break; + } case MPI2_EVENT_PCIE_TOPOLOGY_CHANGE_LIST: { MPI26_EVENT_DATA_PCIE_TOPOLOGY_CHANGE_LIST *data; Modified: stable/11/sys/dev/mpr/mpr_user.c ============================================================================== --- stable/11/sys/dev/mpr/mpr_user.c Tue Apr 3 01:22:15 2018 (r331902) +++ stable/11/sys/dev/mpr/mpr_user.c Tue Apr 3 02:29:17 2018 (r331903) @@ -1189,7 +1189,10 @@ mpr_user_get_adapter_data(struct mpr_softc *sc, mpr_ad /* * General device info. */ - data->AdapterType = MPRIOCTL_ADAPTER_TYPE_SAS3; + if (sc->mpr_flags & MPR_FLAGS_GEN35_IOC) + data->AdapterType = MPRIOCTL_ADAPTER_TYPE_SAS35; + else + data->AdapterType = MPRIOCTL_ADAPTER_TYPE_SAS3; data->PCIDeviceHwId = pci_get_device(sc->mpr_dev); data->PCIDeviceHwRev = pci_read_config(sc->mpr_dev, PCIR_REVID, 1); data->SubSystemId = pci_get_subdevice(sc->mpr_dev); Modified: stable/11/sys/dev/mpr/mprvar.h ============================================================================== --- stable/11/sys/dev/mpr/mprvar.h Tue Apr 3 01:22:15 2018 (r331902) +++ stable/11/sys/dev/mpr/mprvar.h Tue Apr 3 02:29:17 2018 (r331903) @@ -33,7 +33,7 @@ #ifndef _MPRVAR_H #define _MPRVAR_H -#define MPR_DRIVER_VERSION "15.03.00.00-fbsd" +#define MPR_DRIVER_VERSION "18.03.00.00-fbsd" #define MPR_DB_MAX_WAIT 2500 From owner-svn-src-stable-11@freebsd.org Tue Apr 3 03:41:56 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BA5D2F7D681; Tue, 3 Apr 2018 03:41:56 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6208A83390; Tue, 3 Apr 2018 03:41:56 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5CEFF1F096; Tue, 3 Apr 2018 03:41:56 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w333fuPb054626; Tue, 3 Apr 2018 03:41:56 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w333fuuB054625; Tue, 3 Apr 2018 03:41:56 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201804030341.w333fuuB054625@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Tue, 3 Apr 2018 03:41: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: r331905 - stable/11/sys/arm/broadcom/bcm2835 X-SVN-Group: stable-11 X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: stable/11/sys/arm/broadcom/bcm2835 X-SVN-Commit-Revision: 331905 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2018 03:41:57 -0000 Author: gonzo Date: Tue Apr 3 03:41:55 2018 New Revision: 331905 URL: https://svnweb.freebsd.org/changeset/base/331905 Log: MFC r330727 (without optional dts part): [rpi] remove IRQ support for BCM233x RNG Upstream DTBs don't provide IRQ lines for the RNG. Moreover, harvesting bytes as often as the RNG interrupt is triggered (87 times per sec) is an overkill. For these reasons, get rid of the interrupt mode and make callout mode the default, with random bits harvested every 4 seconds. Submitted by: Sylvain Garrigues Reviewed by: ian, imp, manu, mmel Approved by: emaste Differential Revision: https://reviews.freebsd.org/D14541 Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_rng.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_rng.c ============================================================================== --- stable/11/sys/arm/broadcom/bcm2835/bcm2835_rng.c Tue Apr 3 02:41:32 2018 (r331904) +++ stable/11/sys/arm/broadcom/bcm2835/bcm2835_rng.c Tue Apr 3 03:41:55 2018 (r331905) @@ -51,10 +51,6 @@ __FBSDID("$FreeBSD$"); #include #include -#if !defined(BCM2835_RNG_USE_CALLOUT) -#define BCM2835_RNG_USE_INTERRUPT -#endif - static device_attach_t bcm2835_rng_attach; static device_detach_t bcm2835_rng_detach; static device_probe_t bcm2835_rng_probe; @@ -92,18 +88,15 @@ static device_probe_t bcm2835_rng_probe; #define RNG_NUM_OSCILLATORS 6 #define RNG_STALL_COUNT_DEFAULT 10 +#define RNG_CALLOUT_TICKS (hz * 4) + struct bcm2835_rng_softc { device_t sc_dev; struct resource * sc_mem_res; struct resource * sc_irq_res; void * sc_intr_hdl; -#if defined(BCM2835_RNG_USE_CALLOUT) || defined(BCM2835_RNG_USE_INTERRUPT) uint32_t sc_buf[RNG_FIFO_WORDS]; -#endif -#if defined(BCM2835_RNG_USE_CALLOUT) struct callout sc_rngto; - int sc_rnghz; -#endif int sc_stall_count; int sc_rbg2x; long sc_underrun; @@ -214,20 +207,7 @@ bcm2835_rng_disable_intr(struct bcm2835_rng_softc *sc) bcm2835_rng_write4(sc, RNG_INT_MASK, mask); } -#if defined(BCM2835_RNG_USE_INTERRUPT) static void -bcm2835_rng_enable_intr(struct bcm2835_rng_softc *sc) -{ - uint32_t mask; - - /* Clear the interrupt off bit in the interrupt mask register */ - mask = bcm2835_rng_read4(sc, RNG_INT_MASK); - mask &= ~RNG_INT_OFF_BIT; - bcm2835_rng_write4(sc, RNG_INT_MASK, mask); -} -#endif - -static void bcm2835_rng_start(struct bcm2835_rng_softc *sc) { uint32_t ctrl; @@ -244,11 +224,6 @@ bcm2835_rng_start(struct bcm2835_rng_softc *sc) if (sc->sc_rbg2x) ctrl |= RNG_RBG2X; bcm2835_rng_write4(sc, RNG_CTRL, ctrl); - -#if defined(BCM2835_RNG_USE_INTERRUPT) - /* Enable the interrupt */ - bcm2835_rng_enable_intr(sc); -#endif } static void @@ -263,12 +238,13 @@ bcm2835_rng_stop(struct bcm2835_rng_softc *sc) } static void -bcm2835_rng_harvest(struct bcm2835_rng_softc *sc) +bcm2835_rng_harvest(void *arg) { uint32_t *dest; uint32_t status; u_int cnt, nread, num_avail, num_words; int seen_underrun, num_stalls; + struct bcm2835_rng_softc *sc = arg; dest = sc->sc_buf; nread = num_words = 0; @@ -316,9 +292,7 @@ bcm2835_rng_harvest(struct bcm2835_rng_softc *sc) random_harvest_queue(sc->sc_buf, cnt, cnt * NBBY / 2, RANDOM_PURE_BROADCOM); -#if defined(BCM2835_RNG_USE_CALLOUT) - callout_reset(&sc->sc_rngto, sc->sc_rnghz, bcm2835_rng_harvest, sc); -#endif + callout_reset(&sc->sc_rngto, RNG_CALLOUT_TICKS, bcm2835_rng_harvest, sc); } static int @@ -390,10 +364,10 @@ bcm2835_rng_attach(device_t dev) sc = device_get_softc(dev); sc->sc_dev = dev; sc->sc_stall_count = RNG_STALL_COUNT_DEFAULT; -#ifdef BCM2835_RNG_USE_CALLOUT + /* Initialize callout */ callout_init(&sc->sc_rngto, CALLOUT_MPSAFE); -#endif + TUNABLE_INT_FETCH("bcmrng.2xspeed", &sc->sc_rbg2x); TUNABLE_INT_FETCH("bcmrng.stall_count", &sc->sc_stall_count); @@ -406,27 +380,6 @@ bcm2835_rng_attach(device_t dev) return (ENXIO); } -#if defined(BCM2835_RNG_USE_INTERRUPT) - /* Allocate interrupt resource */ - rid = 0; - sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, - RF_SHAREABLE | RF_ACTIVE); - if (sc->sc_irq_res == NULL) { - bcm2835_rng_detach(dev); - return (ENXIO); - } - - /* Set up the interrupt handler */ - error = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, - NULL, (driver_intr_t *)bcm2835_rng_harvest, sc, &sc->sc_intr_hdl); - if (error) { - device_printf(dev, "Failed to set up IRQ\n"); - sc->sc_intr_hdl = NULL; - bcm2835_rng_detach(dev); - return (error); - } -#endif - /* Start the RNG */ bcm2835_rng_start(sc); @@ -461,14 +414,11 @@ bcm2835_rng_attach(device_t dev) sysctl_bcm2835_rng_dump, "S", "Dump RNG registers"); #endif -#if defined(BCM2835_RNG_USE_CALLOUT) - /* Reset callout */ - if (hz >= 100) - sc->sc_rnghz = hz / 100; - else - sc->sc_rnghz = 1; - callout_reset(&sc->sc_rngto, sc->sc_rnghz, bcm2835_rng_harvest, sc); -#endif + /* + * Schedule the initial harvesting one second from now, which should give the + * hardware RNG plenty of time to generate the first random bytes. + */ + callout_reset(&sc->sc_rngto, hz, bcm2835_rng_harvest, sc); return (0); } @@ -477,9 +427,6 @@ static int bcm2835_rng_detach(device_t dev) { struct bcm2835_rng_softc *sc; -#if defined(BCM2835_RNG_USE_INTERRUPT) - int error; -#endif sc = device_get_softc(dev); @@ -487,27 +434,7 @@ bcm2835_rng_detach(device_t dev) bcm2835_rng_stop(sc); /* Drain the callout it */ -#if defined(BCM2835_RNG_USE_CALLOUT) callout_drain(&sc->sc_rngto); -#endif - -#if defined(BCM2835_RNG_USE_INTERRUPT) - /* Tear down the interrupt */ - if (sc->sc_irq_res && sc->sc_intr_hdl) { - error = bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_intr_hdl); - if (error != 0) { - device_printf(dev, "could not tear down IRQ\n"); - return (error); - } - sc->sc_intr_hdl = NULL; - } - - /* Release interrupt resource */ - if (sc->sc_irq_res) { - bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_irq_res); - sc->sc_irq_res = NULL; - } -#endif /* Release memory resource */ if (sc->sc_mem_res != NULL) From owner-svn-src-stable-11@freebsd.org Tue Apr 3 06:06:40 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C0EFF84F18; Tue, 3 Apr 2018 06:06:40 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F158768108; Tue, 3 Apr 2018 06:06:39 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D4030207EC; Tue, 3 Apr 2018 06:06:39 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3366dU1014373; Tue, 3 Apr 2018 06:06:39 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3366dSJ014363; Tue, 3 Apr 2018 06:06:39 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201804030606.w3366dSJ014363@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Tue, 3 Apr 2018 06:06:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331907 - in stable/11/sys/arm: include ti ti/am335x X-SVN-Group: stable-11 X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: in stable/11/sys/arm: include ti ti/am335x X-SVN-Commit-Revision: 331907 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2018 06:06:40 -0000 Author: gonzo Date: Tue Apr 3 06:06:39 2018 New Revision: 331907 URL: https://svnweb.freebsd.org/changeset/base/331907 Log: MFC r307943-r307944, r308698 r307943 by andrew: Remove the need for the delay to be zero when MULTIDELAY is undefined, it may be useful to only enable this in some configs. Sponsored by: ABT Systems Ltd r307944 by andrew: Add MULTIDELAY support to the am335x dmtimer. This will be useful for testing Cortex-A8 support in GENERIC. Sponsored by: ABT Systems Ltd r308698 by loos: After r308533, the platform compatible string must be an exact match. Use "ti,am33xx" instead of "ti,am335x", which gives an exact match in every DTS we support. This fixes the boot on TI SoCs after r308533. Suggested by: gonzo Sponsored by: Rubicon Communications, LLC (Netgate) Modified: stable/11/sys/arm/include/platformvar.h stable/11/sys/arm/ti/am335x/am335x_dmtimer.c stable/11/sys/arm/ti/ti_machdep.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/include/platformvar.h ============================================================================== --- stable/11/sys/arm/include/platformvar.h Tue Apr 3 04:31:54 2018 (r331906) +++ stable/11/sys/arm/include/platformvar.h Tue Apr 3 06:06:39 2018 (r331907) @@ -97,7 +97,7 @@ extern platform_method_t fdt_platform_methods[]; #ifdef MULTIDELAY #define FDT_PLATFORM_CTASSERT(delay) CTASSERT(delay > 0) #else -#define FDT_PLATFORM_CTASSERT(delay) CTASSERT(delay == 0) +#define FDT_PLATFORM_CTASSERT(delay) #endif #define PLATFORM_DATA(NAME, delay) \ Modified: stable/11/sys/arm/ti/am335x/am335x_dmtimer.c ============================================================================== --- stable/11/sys/arm/ti/am335x/am335x_dmtimer.c Tue Apr 3 04:31:54 2018 (r331906) +++ stable/11/sys/arm/ti/am335x/am335x_dmtimer.c Tue Apr 3 06:06:39 2018 (r331907) @@ -38,6 +38,10 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef MULTIDELAY +#include /* For arm_set_delay */ +#endif + #include #include #include @@ -67,6 +71,8 @@ struct am335x_dmtimer_softc { static struct am335x_dmtimer_softc *am335x_dmtimer_et_sc = NULL; static struct am335x_dmtimer_softc *am335x_dmtimer_tc_sc = NULL; +static void am335x_dmtimer_delay(int, void *); + /* * We use dmtimer2 for eventtimer and dmtimer3 for timecounter. */ @@ -235,6 +241,10 @@ am335x_dmtimer_tc_init(struct am335x_dmtimer_softc *sc am335x_dmtimer_tc_sc = sc; tc_init(&sc->func.tc); +#ifdef MULTIDELAY + arm_set_delay(am335x_dmtimer_delay, sc); +#endif + return (0); } @@ -328,23 +338,13 @@ static devclass_t am335x_dmtimer_devclass; DRIVER_MODULE(am335x_dmtimer, simplebus, am335x_dmtimer_driver, am335x_dmtimer_devclass, 0, 0); MODULE_DEPEND(am335x_dmtimer, am335x_prcm, 1, 1, 1); -void -DELAY(int usec) +static void +am335x_dmtimer_delay(int usec, void *arg) { - struct am335x_dmtimer_softc *sc; + struct am335x_dmtimer_softc *sc = arg; int32_t counts; uint32_t first, last; - sc = am335x_dmtimer_tc_sc; - - if (sc == NULL) { - for (; usec > 0; usec--) - for (counts = 200; counts > 0; counts--) - /* Prevent gcc from optimizing out the loop */ - cpufunc_nullop(); - return; - } - /* Get the number of times to count */ counts = (usec + 1) * (sc->sysclk_freq / 1000000); @@ -361,3 +361,19 @@ DELAY(int usec) } } +#ifndef MULTIDELAY +void +DELAY(int usec) +{ + int32_t counts; + + if (am335x_dmtimer_tc_sc == NULL) { + for (; usec > 0; usec--) + for (counts = 200; counts > 0; counts--) + /* Prevent gcc from optimizing out the loop */ + cpufunc_nullop(); + return; + } else + am335x_dmtimer_delay(usec, am335x_dmtimer_tc_sc); +} +#endif Modified: stable/11/sys/arm/ti/ti_machdep.c ============================================================================== --- stable/11/sys/arm/ti/ti_machdep.c Tue Apr 3 04:31:54 2018 (r331906) +++ stable/11/sys/arm/ti/ti_machdep.c Tue Apr 3 06:06:39 2018 (r331907) @@ -124,5 +124,5 @@ static platform_method_t am335x_methods[] = { PLATFORMMETHOD_END, }; -FDT_PLATFORM_DEF(am335x, "am335x", 0, "ti,am335x", 0); +FDT_PLATFORM_DEF(am335x, "am335x", 0, "ti,am33xx", 200); #endif From owner-svn-src-stable-11@freebsd.org Tue Apr 3 07:31:24 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EAE2DF89B32; Tue, 3 Apr 2018 07:31:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A03706B45B; Tue, 3 Apr 2018 07:31:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B25121579; Tue, 3 Apr 2018 07:31:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w337VNu9001204; Tue, 3 Apr 2018 07:31:23 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w337VNcB000791; Tue, 3 Apr 2018 07:31:23 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201804030731.w337VNcB000791@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 3 Apr 2018 07:31: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: r331909 - in stable/11/sys: kern sys x86/acpica x86/x86 X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/11/sys: kern sys x86/acpica x86/x86 X-SVN-Commit-Revision: 331909 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2018 07:31:24 -0000 Author: avg Date: Tue Apr 3 07:31:22 2018 New Revision: 331909 URL: https://svnweb.freebsd.org/changeset/base/331909 Log: MFC r327056: Use resume_cpus() instead of restart_cpus() to resume from ACPI suspension. Modified: stable/11/sys/kern/subr_smp.c stable/11/sys/sys/smp.h stable/11/sys/x86/acpica/acpi_wakeup.c stable/11/sys/x86/x86/mp_x86.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/subr_smp.c ============================================================================== --- stable/11/sys/kern/subr_smp.c Tue Apr 3 06:46:26 2018 (r331908) +++ stable/11/sys/kern/subr_smp.c Tue Apr 3 07:31:22 2018 (r331909) @@ -348,13 +348,18 @@ generic_restart_cpus(cpuset_t map, u_int type) #if X86 if (type == IPI_SUSPEND) - cpus = &suspended_cpus; + cpus = &resuming_cpus; else #endif cpus = &stopped_cpus; /* signal other cpus to restart */ - CPU_COPY_STORE_REL(&map, &started_cpus); +#if X86 + if (type == IPI_SUSPEND) + CPU_COPY_STORE_REL(&map, &toresume_cpus); + else +#endif + CPU_COPY_STORE_REL(&map, &started_cpus); #if X86 if (!nmi_is_broadcast || nmi_kdb_lock == 0) { Modified: stable/11/sys/sys/smp.h ============================================================================== --- stable/11/sys/sys/smp.h Tue Apr 3 06:46:26 2018 (r331908) +++ stable/11/sys/sys/smp.h Tue Apr 3 07:31:22 2018 (r331909) @@ -136,10 +136,13 @@ struct cpu_group *smp_topo_find(struct cpu_group *top, extern void (*cpustop_restartfunc)(void); extern int smp_cpus; -extern volatile cpuset_t started_cpus; -extern volatile cpuset_t stopped_cpus; -extern volatile cpuset_t suspended_cpus; -extern cpuset_t hlt_cpus_mask; +/* The suspend/resume cpusets are x86 only, but minimize ifdefs. */ +extern volatile cpuset_t resuming_cpus; /* woken up cpus in suspend pen */ +extern volatile cpuset_t started_cpus; /* cpus to let out of stop pen */ +extern volatile cpuset_t stopped_cpus; /* cpus in stop pen */ +extern volatile cpuset_t suspended_cpus; /* cpus [near] sleeping in susp pen */ +extern volatile cpuset_t toresume_cpus; /* cpus to let out of suspend pen */ +extern cpuset_t hlt_cpus_mask; /* XXX 'mask' is detail in old impl */ extern cpuset_t logical_cpus_mask; #endif /* SMP */ Modified: stable/11/sys/x86/acpica/acpi_wakeup.c ============================================================================== --- stable/11/sys/x86/acpica/acpi_wakeup.c Tue Apr 3 06:46:26 2018 (r331908) +++ stable/11/sys/x86/acpica/acpi_wakeup.c Tue Apr 3 07:31:22 2018 (r331909) @@ -284,7 +284,7 @@ acpi_wakeup_machdep(struct acpi_softc *sc, int state, #ifdef SMP if (!CPU_EMPTY(&suspcpus)) - restart_cpus(suspcpus); + resume_cpus(suspcpus); #endif mca_resume(); #ifdef __amd64__ Modified: stable/11/sys/x86/x86/mp_x86.c ============================================================================== --- stable/11/sys/x86/x86/mp_x86.c Tue Apr 3 06:46:26 2018 (r331908) +++ stable/11/sys/x86/x86/mp_x86.c Tue Apr 3 07:31:22 2018 (r331909) @@ -114,6 +114,9 @@ struct cpu_ops cpu_ops; static volatile cpuset_t ipi_stop_nmi_pending; +volatile cpuset_t resuming_cpus; +volatile cpuset_t toresume_cpus; + /* used to hold the AP's until we are ready to release them */ struct mtx ap_boot_mtx; @@ -1316,6 +1319,13 @@ cpususpend_handler(void) #endif wbinvd(); CPU_SET_ATOMIC(cpu, &suspended_cpus); + /* + * Hack for xen, which does not use resumectx() so never + * uses the next clause: set resuming_cpus early so that + * resume_cpus() can wait on the same bitmap for acpi and + * xen. resuming_cpus now means eventually_resumable_cpus. + */ + CPU_SET_ATOMIC(cpu, &resuming_cpus); } else { #ifdef __amd64__ fpuresume(susppcbs[cpu]->sp_fpususpend); @@ -1327,12 +1337,12 @@ cpususpend_handler(void) PCPU_SET(switchtime, 0); PCPU_SET(switchticks, ticks); - /* Indicate that we are resumed */ + /* Indicate that we are resuming */ CPU_CLR_ATOMIC(cpu, &suspended_cpus); } - /* Wait for resume */ - while (!CPU_ISSET(cpu, &started_cpus)) + /* Wait for resume directive */ + while (!CPU_ISSET(cpu, &toresume_cpus)) ia32_pause(); if (cpu_ops.cpu_resume) @@ -1348,8 +1358,9 @@ cpususpend_handler(void) lapic_setup(0); /* Indicate that we are resumed */ + CPU_CLR_ATOMIC(cpu, &resuming_cpus); CPU_CLR_ATOMIC(cpu, &suspended_cpus); - CPU_CLR_ATOMIC(cpu, &started_cpus); + CPU_CLR_ATOMIC(cpu, &toresume_cpus); } From owner-svn-src-stable-11@freebsd.org Tue Apr 3 09:22:37 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74D91F6F4D8; Tue, 3 Apr 2018 09:22:37 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 275CC6FFDD; Tue, 3 Apr 2018 09:22:37 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 223FE22866; Tue, 3 Apr 2018 09:22:37 +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 w339Ma7F032044; Tue, 3 Apr 2018 09:22:36 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w339Ma4b032043; Tue, 3 Apr 2018 09:22:36 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201804030922.w339Ma4b032043@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 3 Apr 2018 09:22:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331911 - stable/11/sys/dev/mlx5 X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5 X-SVN-Commit-Revision: 331911 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2018 09:22:37 -0000 Author: hselasky Date: Tue Apr 3 09:22:36 2018 New Revision: 331911 URL: https://svnweb.freebsd.org/changeset/base/331911 Log: MFC r331531: Remove redundant prototype to fix compilation with GCC. Reported by: jeff@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/driver.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/driver.h ============================================================================== --- stable/11/sys/dev/mlx5/driver.h Tue Apr 3 07:52:06 2018 (r331910) +++ stable/11/sys/dev/mlx5/driver.h Tue Apr 3 09:22:36 2018 (r331911) @@ -868,7 +868,6 @@ static inline u32 mlx5_base_mkey(const u32 key) return key & 0xffffff00u; } -void mlx5_enter_error_state(struct mlx5_core_dev *dev, bool force); int mlx5_cmd_init(struct mlx5_core_dev *dev); void mlx5_cmd_cleanup(struct mlx5_core_dev *dev); void mlx5_cmd_use_events(struct mlx5_core_dev *dev); From owner-svn-src-stable-11@freebsd.org Tue Apr 3 09:24:31 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0691F6F6AF; Tue, 3 Apr 2018 09:24:31 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 54DB470196; Tue, 3 Apr 2018 09:24:31 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4F8862286D; Tue, 3 Apr 2018 09:24:31 +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 w339OVmX034949; Tue, 3 Apr 2018 09:24:31 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w339OVhj034948; Tue, 3 Apr 2018 09:24:31 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201804030924.w339OVhj034948@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 3 Apr 2018 09:24:31 +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: r331912 - stable/11/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 331912 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2018 09:24:31 -0000 Author: hselasky Date: Tue Apr 3 09:24:30 2018 New Revision: 331912 URL: https://svnweb.freebsd.org/changeset/base/331912 Log: MFC r331819: Add missing newline character in print in mlx5core. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Tue Apr 3 09:22:36 2018 (r331911) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Tue Apr 3 09:24:30 2018 (r331912) @@ -183,7 +183,7 @@ static void reset_fw_if_needed(struct mlx5_core_dev *d fatal_error == MLX5_SENSOR_NIC_DISABLED || fatal_error == MLX5_SENSOR_NIC_SW_RESET || test_bit(MLX5_SKIP_SW_RESET, &health->flags)) { - mlx5_core_warn(dev, "Not issuing FW reset. Either it's already done or won't help."); + mlx5_core_warn(dev, "Not issuing FW reset. Either it's already done or won't help.\n"); return; } From owner-svn-src-stable-11@freebsd.org Tue Apr 3 09:25:53 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C871F6F917; Tue, 3 Apr 2018 09:25:53 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0BD837039B; Tue, 3 Apr 2018 09:25:53 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E15BE2286F; Tue, 3 Apr 2018 09:25:52 +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 w339Pq6r037044; Tue, 3 Apr 2018 09:25:52 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w339Pq0I037043; Tue, 3 Apr 2018 09:25:52 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201804030925.w339Pq0I037043@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 3 Apr 2018 09:25: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: r331913 - stable/11/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 331913 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2018 09:25:53 -0000 Author: hselasky Date: Tue Apr 3 09:25:52 2018 New Revision: 331913 URL: https://svnweb.freebsd.org/changeset/base/331913 Log: MFC r331820: Properly check if crspace is supported in mlx5core. The old code checked for MLX5_CR_SPACE_DOMAIN which is irrelevant here. However, if dev->vsec_addr would be 0, an access to wrong offset would happen. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_crspace.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_crspace.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_crspace.c Tue Apr 3 09:24:30 2018 (r331912) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_crspace.c Tue Apr 3 09:25:52 2018 (r331913) @@ -65,6 +65,8 @@ enum { #define MLX5_MERGE(rsrc1, rsrc2, start, len) \ (((len) == 32) ? (rsrc2) : MLX5_MERGE_C(rsrc1, rsrc2, start, len)) +#define MLX5_SEMAPHORE_SPACE_DOMAIN 0xA + static int mlx5_pciconf_wait_on_flag(struct mlx5_core_dev *dev, u8 expected_val) { @@ -131,6 +133,9 @@ int mlx5_pciconf_cap9_sem(struct mlx5_core_dev *dev, i int retries = 0; u32 lock_val; + if (!dev->vsec_addr) + return -ENXIO; + if (state == UNLOCK) { pci_write_config_dword(dev->pdev, dev->vsec_addr + PCI_SEMAPHORE_OFFSET, 0); @@ -159,7 +164,6 @@ int mlx5_pciconf_cap9_sem(struct mlx5_core_dev *dev, i return 0; } -#define MLX5_PROTECTED_CR_SPACE_DOMAIN 0x6 static int mlx5_pciconf_set_addr_space(struct mlx5_core_dev *dev, u16 space) { @@ -183,7 +187,6 @@ static int mlx5_pciconf_set_addr_space(struct mlx5_cor return 0; } -#define MLX5_CR_SPACE_DOMAIN 0x2 static int mlx5_get_vendor_cap_addr(struct mlx5_core_dev *dev) { int vend_cap; @@ -196,24 +199,27 @@ static int mlx5_get_vendor_cap_addr(struct mlx5_core_d ret = mlx5_pciconf_cap9_sem(dev, LOCK); if (ret) { mlx5_core_warn(dev, - "pciconf_cap9_sem locking failure\n"); + "pciconf_cap9_sem locking failure\n"); return 0; } - if (mlx5_pciconf_set_addr_space(dev, MLX5_CR_SPACE_DOMAIN)) + if (mlx5_pciconf_set_addr_space(dev, + MLX5_SEMAPHORE_SPACE_DOMAIN)) vend_cap = 0; ret = mlx5_pciconf_cap9_sem(dev, UNLOCK); if (ret) mlx5_core_warn(dev, - "pciconf_cap9_sem unlocking failure\n"); + "pciconf_cap9_sem unlocking failure\n"); return vend_cap; } -#define MLX5_SEMAPHORE_SPACE_DOMAIN 0xA int mlx5_pciconf_set_sem_addr_space(struct mlx5_core_dev *dev, u32 sem_space_address, int state) { u32 data, id = 0; int ret; + + if (!dev->vsec_addr) + return -ENXIO; ret = mlx5_pciconf_set_addr_space(dev, MLX5_SEMAPHORE_SPACE_DOMAIN); From owner-svn-src-stable-11@freebsd.org Tue Apr 3 09:27:06 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 335D6F6FB08; Tue, 3 Apr 2018 09:27:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D583970518; Tue, 3 Apr 2018 09:27:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D086E22871; Tue, 3 Apr 2018 09:27:05 +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 w339R5bV038922; Tue, 3 Apr 2018 09:27:05 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w339R55D038917; Tue, 3 Apr 2018 09:27:05 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201804030927.w339R55D038917@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 3 Apr 2018 09:27:05 +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: r331914 - stable/11/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 331914 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2018 09:27:06 -0000 Author: hselasky Date: Tue Apr 3 09:27:05 2018 New Revision: 331914 URL: https://svnweb.freebsd.org/changeset/base/331914 Log: MFC r331821: Prepare for FW dump in error state in mlx5core. - Move firmware dump prep and cleanup to init_one() and remove_one() so that the init and cleanup will happen only upon driver reload. - Add some prints to indicate firmware dump. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Tue Apr 3 09:25:52 2018 (r331913) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Tue Apr 3 09:27:05 2018 (r331914) @@ -116,14 +116,18 @@ mlx5_fwdump(struct mlx5_core_dev *mdev) uint32_t i, ri; int error; + dev_info(&mdev->pdev->dev, "Issuing FW dump\n"); dd = (struct mlx5_dump_data *)atomic_load_acq_ptr((uintptr_t *) &mdev->dump_data); if (dd == NULL) return; mtx_lock(&dd->dump_lock); - if (dd->dump_valid) + if (dd->dump_valid) { /* only one dump */ + dev_warn(&mdev->pdev->dev, + "Only one FW dump can be captured aborting FW dump\n"); goto failed; + } /* mlx5_vsc already warns, be silent. */ error = mlx5_vsc_lock(mdev); Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Tue Apr 3 09:25:52 2018 (r331913) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Tue Apr 3 09:27:05 2018 (r331914) @@ -1056,8 +1056,6 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, st goto err_fs; } - mlx5_fwdump_prep(dev); - clear_bit(MLX5_INTERFACE_STATE_DOWN, &dev->intf_state); set_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state); @@ -1127,7 +1125,6 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, goto out; } - mlx5_fwdump_clean(dev); mlx5_unregister_device(dev); mlx5_cleanup_fs(dev); @@ -1179,7 +1176,6 @@ struct mlx5_core_event_handler { void *data); }; - static int init_one(struct pci_dev *pdev, const struct pci_device_id *id) { @@ -1224,6 +1220,8 @@ static int init_one(struct pci_dev *pdev, goto clean_health; } + mlx5_fwdump_prep(dev); + pci_save_state(pdev->dev.bsddev); return 0; @@ -1248,6 +1246,7 @@ static void remove_one(struct pci_dev *pdev) return; } + mlx5_fwdump_clean(dev); mlx5_pagealloc_cleanup(dev); mlx5_health_cleanup(dev); mlx5_pci_close(dev, priv); @@ -1264,6 +1263,7 @@ static pci_ers_result_t mlx5_pci_err_detected(struct p dev_info(&pdev->dev, "%s was called\n", __func__); mlx5_enter_error_state(dev, false); mlx5_unload_one(dev, priv, false); + if (state) { mlx5_drain_health_wq(dev); mlx5_pci_disable_device(dev); From owner-svn-src-stable-11@freebsd.org Tue Apr 3 09:28:12 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 224D3F6FC3C; Tue, 3 Apr 2018 09:28:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CCE0C7067B; Tue, 3 Apr 2018 09:28:11 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C7AA822872; Tue, 3 Apr 2018 09:28:11 +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 w339SBUs040617; Tue, 3 Apr 2018 09:28:11 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w339SBWm040616; Tue, 3 Apr 2018 09:28:11 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201804030928.w339SBWm040616@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 3 Apr 2018 09:28: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: r331915 - stable/11/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 331915 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2018 09:28:12 -0000 Author: hselasky Date: Tue Apr 3 09:28:11 2018 New Revision: 331915 URL: https://svnweb.freebsd.org/changeset/base/331915 Log: MFC r331822: Reorganize health recovery in mlx5core. - Move the semaphore locking and unlocking to the same function. - Flags are no longer needed if the reset and crdump will be done in the same function. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Tue Apr 3 09:27:05 2018 (r331914) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Tue Apr 3 09:28:11 2018 (r331915) @@ -48,8 +48,6 @@ enum { enum { MLX5_DROP_NEW_HEALTH_WORK, MLX5_DROP_NEW_RECOVERY_WORK, - MLX5_SKIP_SW_RESET, - MLX5_SW_RESET_SEM_LOCKED, }; enum { @@ -167,7 +165,6 @@ static void reset_fw_if_needed(struct mlx5_core_dev *d { bool supported = (ioread32be(&dev->iseg->initializing) >> MLX5_FW_RESET_SUPPORTED_OFFSET) & 1; - struct mlx5_core_health *health = &dev->priv.health; u32 cmdq_addr, fatal_error; if (!supported) @@ -181,8 +178,7 @@ static void reset_fw_if_needed(struct mlx5_core_dev *d fatal_error = check_fatal_sensors(dev); if (fatal_error == MLX5_SENSOR_PCI_COMM_ERR || fatal_error == MLX5_SENSOR_NIC_DISABLED || - fatal_error == MLX5_SENSOR_NIC_SW_RESET || - test_bit(MLX5_SKIP_SW_RESET, &health->flags)) { + fatal_error == MLX5_SENSOR_NIC_SW_RESET) { mlx5_core_warn(dev, "Not issuing FW reset. Either it's already done or won't help.\n"); return; } @@ -197,26 +193,65 @@ static void reset_fw_if_needed(struct mlx5_core_dev *d &dev->iseg->cmdq_addr_l_sz); } +#define MLX5_CRDUMP_WAIT_MS 60000 +#define MLX5_FW_RESET_WAIT_MS 1000 +#define MLX5_NIC_STATE_POLL_MS 5 void mlx5_enter_error_state(struct mlx5_core_dev *dev, bool force) { + unsigned long end, delay_ms = MLX5_CRDUMP_WAIT_MS; + u32 fatal_error; + int lock = -EBUSY; + mutex_lock(&dev->intf_state_mutex); if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { goto unlock; return; } - if (!force) - mlx5_core_err(dev, "internal state error detected\n"); - if (check_fatal_sensors(dev) || force) { - reset_fw_if_needed(dev); + fatal_error = check_fatal_sensors(dev); + + if (fatal_error || force) { + if (!force) + mlx5_core_err(dev, "internal state error detected\n"); dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR; mlx5_trigger_cmd_completions(dev); } - mlx5_core_event(dev, MLX5_DEV_EVENT_SYS_ERROR, 0); - if (!force) - mlx5_core_err(dev, "system error event triggered\n"); + if (force) + goto err_state_done; + if (fatal_error == MLX5_SENSOR_FW_SYND_RFR) { + if (mlx5_core_is_pf(dev)) + lock = lock_sem_sw_reset(dev, LOCK); + + if (lock != -EBUSY) { + reset_fw_if_needed(dev); + delay_ms = MLX5_FW_RESET_WAIT_MS; + } + } + + /* Recover from SW reset */ + end = jiffies + msecs_to_jiffies(delay_ms); + do { + if (sensor_nic_disabled(dev)) + break; + + msleep(MLX5_NIC_STATE_POLL_MS); + } while (!time_after(jiffies, end)); + + if (!sensor_nic_disabled(dev)) { + dev_err(&dev->pdev->dev, "NIC IFC still %d after %lums.\n", + get_nic_mode(dev), delay_ms); + } + + /* Release FW semaphore if you are the lock owner */ + if (!lock) + lock_sem_sw_reset(dev, UNLOCK); + + mlx5_core_err(dev, "system error event triggered\n"); + +err_state_done: + mlx5_core_event(dev, MLX5_DEV_EVENT_SYS_ERROR, 0); unlock: mutex_unlock(&dev->intf_state_mutex); } @@ -265,7 +300,6 @@ static void health_recover(struct work_struct *work) if (sensor_pci_no_comm(dev)) { dev_err(&dev->pdev->dev, "health recovery flow aborted, PCI reads still not working\n"); recover = false; - goto clear_sem; } nic_mode = get_nic_mode(dev); @@ -281,14 +315,6 @@ static void health_recover(struct work_struct *work) recover = false; } -clear_sem: - if (test_and_clear_bit(MLX5_SW_RESET_SEM_LOCKED, &health->flags)) { - mlx5_core_dbg(dev, "Unlocking FW reset semaphore\n"); - lock_sem_sw_reset(dev, UNLOCK); - } - - test_and_clear_bit(MLX5_SKIP_SW_RESET, &health->flags); - if (recover) { dev_err(&dev->pdev->dev, "starting health recovery flow\n"); mlx5_recover_device(dev); @@ -312,28 +338,10 @@ static void health_care(struct work_struct *work) struct mlx5_core_dev *dev; struct mlx5_priv *priv; unsigned long flags; - int ret; health = container_of(work, struct mlx5_core_health, work); priv = container_of(health, struct mlx5_priv, health); dev = container_of(priv, struct mlx5_core_dev, priv); - - if (mlx5_core_is_pf(dev)) { - ret = lock_sem_sw_reset(dev, LOCK); - if (!ret) { - mlx5_core_warn(dev, "Locked FW reset semaphore\n"); - set_bit(MLX5_SW_RESET_SEM_LOCKED, &health->flags); - } - else if (ret == -EBUSY) { - /* sw reset will be skipped only in case we detect the - * semaphore was already taken. In case of an error - * while taking the semaphore we prefer to issue a - * reset since longer cr-dump time and multiple resets - * are better than a stuck fw. - */ - set_bit(MLX5_SKIP_SW_RESET, &health->flags); - } - } mlx5_core_warn(dev, "handling bad device here\n"); mlx5_handle_bad_state(dev); From owner-svn-src-stable-11@freebsd.org Tue Apr 3 09:29:27 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C311F6FD87; Tue, 3 Apr 2018 09:29:27 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2DCD2708DC; Tue, 3 Apr 2018 09:29:27 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2881422874; Tue, 3 Apr 2018 09:29:27 +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 w339TRJW042647; Tue, 3 Apr 2018 09:29:27 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w339TRGn042644; Tue, 3 Apr 2018 09:29:27 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201804030929.w339TRGn042644@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 3 Apr 2018 09:29: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: r331916 - stable/11/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 331916 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2018 09:29:27 -0000 Author: hselasky Date: Tue Apr 3 09:29:26 2018 New Revision: 331916 URL: https://svnweb.freebsd.org/changeset/base/331916 Log: MFC r331823: Collect firmware dump when mlx5core is in device error state. Firmware dump collecting should be triggered in case firmware syndrome with request for reset bit is set. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Tue Apr 3 09:28:11 2018 (r331915) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Tue Apr 3 09:29:26 2018 (r331916) @@ -221,10 +221,13 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev, goto err_state_done; if (fatal_error == MLX5_SENSOR_FW_SYND_RFR) { + /* Get cr-dump and reset FW semaphore */ if (mlx5_core_is_pf(dev)) lock = lock_sem_sw_reset(dev, LOCK); + /* Execute cr-dump and SW reset */ if (lock != -EBUSY) { + mlx5_fwdump(dev); reset_fw_if_needed(dev); delay_ms = MLX5_FW_RESET_WAIT_MS; } From owner-svn-src-stable-11@freebsd.org Tue Apr 3 09:30:41 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 855EBF6FF56; Tue, 3 Apr 2018 09:30:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 29F9970A83; Tue, 3 Apr 2018 09:30:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 24F2822881; Tue, 3 Apr 2018 09:30:41 +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 w339UfQ8044545; Tue, 3 Apr 2018 09:30:41 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w339UfbJ044543; Tue, 3 Apr 2018 09:30:41 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201804030930.w339UfbJ044543@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 3 Apr 2018 09:30: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: r331917 - stable/11/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 331917 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2018 09:30:41 -0000 Author: hselasky Date: Tue Apr 3 09:30:40 2018 New Revision: 331917 URL: https://svnweb.freebsd.org/changeset/base/331917 Log: MFC r331824: Make sure Giant is locked when allocating bus resources in mlx5core. During health care IRQ resources will be reallocated. Newbus requires that Giant is locked before accessing these resources. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Tue Apr 3 09:29:26 2018 (r331916) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Tue Apr 3 09:30:40 2018 (r331917) @@ -300,6 +300,8 @@ static void health_recover(struct work_struct *work) priv = container_of(health, struct mlx5_priv, health); dev = container_of(priv, struct mlx5_core_dev, priv); + mtx_lock(&Giant); /* XXX newbus needs this */ + if (sensor_pci_no_comm(dev)) { dev_err(&dev->pdev->dev, "health recovery flow aborted, PCI reads still not working\n"); recover = false; @@ -322,6 +324,8 @@ static void health_recover(struct work_struct *work) dev_err(&dev->pdev->dev, "starting health recovery flow\n"); mlx5_recover_device(dev); } + + mtx_unlock(&Giant); } /* How much time to wait until health resetting the driver (in msecs) */ From owner-svn-src-stable-11@freebsd.org Tue Apr 3 09:31:31 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 00881F70077; Tue, 3 Apr 2018 09:31:31 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A627E70C64; Tue, 3 Apr 2018 09:31:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A143D229CA; Tue, 3 Apr 2018 09:31:30 +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 w339VUQN047532; Tue, 3 Apr 2018 09:31:30 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w339VU2i047530; Tue, 3 Apr 2018 09:31:30 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201804030931.w339VU2i047530@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 3 Apr 2018 09:31: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: r331918 - stable/11/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 331918 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2018 09:31:31 -0000 Author: hselasky Date: Tue Apr 3 09:31:30 2018 New Revision: 331918 URL: https://svnweb.freebsd.org/changeset/base/331918 Log: MFC r331825: Fix for use after free in mlx5core. Make sure the command completion handler is not called when the device is in internal error state. This can easily trigger use after free situations. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c Tue Apr 3 09:30:40 2018 (r331917) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c Tue Apr 3 09:31:30 2018 (r331918) @@ -254,7 +254,8 @@ static int mlx5_eq_int(struct mlx5_core_dev *dev, stru break; case MLX5_EVENT_TYPE_CMD: - mlx5_cmd_comp_handler(dev, be32_to_cpu(eqe->data.cmd.vector)); + if (dev->state != MLX5_DEVICE_STATE_INTERNAL_ERROR) + mlx5_cmd_comp_handler(dev, be32_to_cpu(eqe->data.cmd.vector)); break; case MLX5_EVENT_TYPE_PORT_CHANGE: From owner-svn-src-stable-11@freebsd.org Tue Apr 3 09:33:24 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E03FFF70460; Tue, 3 Apr 2018 09:33:23 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8C8F270FD7; Tue, 3 Apr 2018 09:33:23 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 85E2722A1E; Tue, 3 Apr 2018 09:33:23 +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 w339XN6f053505; Tue, 3 Apr 2018 09:33:23 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w339XNRm053504; Tue, 3 Apr 2018 09:33:23 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201804030933.w339XNRm053504@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 3 Apr 2018 09:33: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: r331919 - stable/11/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 331919 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2018 09:33:24 -0000 Author: hselasky Date: Tue Apr 3 09:33:23 2018 New Revision: 331919 URL: https://svnweb.freebsd.org/changeset/base/331919 Log: MFC r331826: Bump mlx5core driver version. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h Tue Apr 3 09:31:30 2018 (r331918) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_core.h Tue Apr 3 09:33:23 2018 (r331919) @@ -33,8 +33,10 @@ #include #define DRIVER_NAME "mlx5_core" -#define DRIVER_VERSION "1.23.0 (03 Mar 2015)" -#define DRIVER_RELDATE "03 Mar 2015" +#ifndef DRIVER_VERSION +#define DRIVER_VERSION "3.4.1" +#endif +#define DRIVER_RELDATE "February 2018" extern int mlx5_core_debug_mask; From owner-svn-src-stable-11@freebsd.org Tue Apr 3 09:34:17 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3574BF70564; Tue, 3 Apr 2018 09:34:17 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D78ED711E1; Tue, 3 Apr 2018 09:34:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D285022A20; Tue, 3 Apr 2018 09:34:16 +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 w339YGVk055009; Tue, 3 Apr 2018 09:34:16 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w339YGlG055008; Tue, 3 Apr 2018 09:34:16 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201804030934.w339YGlG055008@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 3 Apr 2018 09:34:16 +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: r331920 - stable/11/sys/dev/mlx5 X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5 X-SVN-Commit-Revision: 331920 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2018 09:34:17 -0000 Author: hselasky Date: Tue Apr 3 09:34:16 2018 New Revision: 331920 URL: https://svnweb.freebsd.org/changeset/base/331920 Log: MFC r331827: Remove unused structure field in mlx5core. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/driver.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/driver.h ============================================================================== --- stable/11/sys/dev/mlx5/driver.h Tue Apr 3 09:33:23 2018 (r331919) +++ stable/11/sys/dev/mlx5/driver.h Tue Apr 3 09:34:16 2018 (r331920) @@ -371,7 +371,6 @@ struct mlx5_cmd { struct cmd_msg_cache cache; int checksum_disabled; struct mlx5_cmd_stats stats[MLX5_CMD_OP_MAX]; - int moving_to_polling; }; struct mlx5_port_caps { From owner-svn-src-stable-11@freebsd.org Tue Apr 3 09:38:54 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A3553F70B11; Tue, 3 Apr 2018 09:38:54 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 50FC671682; Tue, 3 Apr 2018 09:38:54 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4BD2622A29; Tue, 3 Apr 2018 09:38:54 +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 w339csSv062321; Tue, 3 Apr 2018 09:38:54 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w339csmV062318; Tue, 3 Apr 2018 09:38:54 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201804030938.w339csmV062318@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 3 Apr 2018 09:38:54 +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: r331921 - 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: 331921 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2018 09:38:54 -0000 Author: kib Date: Tue Apr 3 09:38:53 2018 New Revision: 331921 URL: https://svnweb.freebsd.org/changeset/base/331921 Log: MFC r331557: Allow to specify for vm_fault_quick_hold_pages() that nofault mode should be honored. Modified: stable/11/sys/vm/vm.h stable/11/sys/vm/vm_fault.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm.h ============================================================================== --- stable/11/sys/vm/vm.h Tue Apr 3 09:34:16 2018 (r331920) +++ stable/11/sys/vm/vm.h Tue Apr 3 09:38:53 2018 (r331921) @@ -78,7 +78,9 @@ typedef u_char vm_prot_t; /* protection codes */ #define VM_PROT_WRITE ((vm_prot_t) 0x02) #define VM_PROT_EXECUTE ((vm_prot_t) 0x04) #define VM_PROT_COPY ((vm_prot_t) 0x08) /* copy-on-read */ -#define VM_PROT_FAULT_LOOKUP ((vm_prot_t) 0x010) +#define VM_PROT_PRIV_FLAG ((vm_prot_t) 0x10) +#define VM_PROT_FAULT_LOOKUP VM_PROT_PRIV_FLAG +#define VM_PROT_QUICK_NOFAULT VM_PROT_PRIV_FLAG /* same to save bits */ #define VM_PROT_ALL (VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE) #define VM_PROT_RW (VM_PROT_READ|VM_PROT_WRITE) Modified: stable/11/sys/vm/vm_fault.c ============================================================================== --- stable/11/sys/vm/vm_fault.c Tue Apr 3 09:34:16 2018 (r331920) +++ stable/11/sys/vm/vm_fault.c Tue Apr 3 09:38:53 2018 (r331921) @@ -1523,7 +1523,18 @@ vm_fault_quick_hold_pages(vm_map_t map, vm_offset_t ad * page was mapped at the specified virtual address or that * mapping had insufficient permissions. Attempt to fault in * and hold these pages. + * + * If vm_fault_disable_pagefaults() was called, + * i.e., TDP_NOFAULTING is set, we must not sleep nor + * acquire MD VM locks, which means we must not call + * vm_fault_hold(). Some (out of tree) callers mark + * too wide a code area with vm_fault_disable_pagefaults() + * already, use the VM_PROT_QUICK_NOFAULT flag to request + * the proper behaviour explicitly. */ + if ((prot & VM_PROT_QUICK_NOFAULT) != 0 && + (curthread->td_pflags & TDP_NOFAULTING) != 0) + goto error; for (mp = ma, va = addr; va < end; mp++, va += PAGE_SIZE) if (*mp == NULL && vm_fault_hold(map, va, prot, VM_FAULT_NORMAL, mp) != KERN_SUCCESS) From owner-svn-src-stable-11@freebsd.org Tue Apr 3 09:40:54 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C8E3F70DF4; Tue, 3 Apr 2018 09:40:54 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C31B071893; Tue, 3 Apr 2018 09:40:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BDD3622A4A; Tue, 3 Apr 2018 09:40:53 +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 w339erGc067756; Tue, 3 Apr 2018 09:40:53 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w339ernj067739; Tue, 3 Apr 2018 09:40:53 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201804030940.w339ernj067739@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 3 Apr 2018 09:40: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: r331922 - in stable/11/sys: compat/freebsd32 dev/pci kern X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/sys: compat/freebsd32 dev/pci kern X-SVN-Commit-Revision: 331922 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2018 09:40:54 -0000 Author: kib Date: Tue Apr 3 09:40:52 2018 New Revision: 331922 URL: https://svnweb.freebsd.org/changeset/base/331922 Log: MFC r331640: Fix several leaks of kernel stack data through paddings. Modified: stable/11/sys/compat/freebsd32/freebsd32_misc.c stable/11/sys/dev/pci/pci_user.c stable/11/sys/kern/kern_ntptime.c stable/11/sys/kern/kern_sig.c stable/11/sys/kern/sysv_shm.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- stable/11/sys/compat/freebsd32/freebsd32_misc.c Tue Apr 3 09:38:53 2018 (r331921) +++ stable/11/sys/compat/freebsd32/freebsd32_misc.c Tue Apr 3 09:40:52 2018 (r331922) @@ -2989,6 +2989,7 @@ freebsd32_kldstat(struct thread *td, struct freebsd32_ CP(*stat, *stat32, size); bcopy(&stat->pathname[0], &stat32->pathname[0], sizeof(stat->pathname)); + stat32->version = version; error = copyout(stat32, uap->stat, version); } free(stat, M_TEMP); Modified: stable/11/sys/dev/pci/pci_user.c ============================================================================== --- stable/11/sys/dev/pci/pci_user.c Tue Apr 3 09:38:53 2018 (r331921) +++ stable/11/sys/dev/pci/pci_user.c Tue Apr 3 09:40:52 2018 (r331922) @@ -766,6 +766,8 @@ pci_ioctl(struct cdev *dev, u_long cmd, caddr_t data, #ifdef PRE7_COMPAT #ifdef COMPAT_FREEBSD32 if (cmd == PCIOCGETCONF_OLD32) { + memset(&conf_old32, 0, + sizeof(conf_old32)); conf_old32.pc_sel.pc_bus = dinfo->conf.pc_sel.pc_bus; conf_old32.pc_sel.pc_dev = @@ -799,6 +801,7 @@ pci_ioctl(struct cdev *dev, u_long cmd, caddr_t data, } else #endif /* COMPAT_FREEBSD32 */ if (cmd == PCIOCGETCONF_OLD) { + memset(&conf_old, 0, sizeof(conf_old)); conf_old.pc_sel.pc_bus = dinfo->conf.pc_sel.pc_bus; conf_old.pc_sel.pc_dev = Modified: stable/11/sys/kern/kern_ntptime.c ============================================================================== --- stable/11/sys/kern/kern_ntptime.c Tue Apr 3 09:38:53 2018 (r331921) +++ stable/11/sys/kern/kern_ntptime.c Tue Apr 3 09:40:52 2018 (r331922) @@ -285,6 +285,8 @@ sys_ntp_gettime(struct thread *td, struct ntp_gettime_ { struct ntptimeval ntv; + memset(&ntv, 0, sizeof(ntv)); + NTP_LOCK(); ntp_gettime1(&ntv); NTP_UNLOCK(); Modified: stable/11/sys/kern/kern_sig.c ============================================================================== --- stable/11/sys/kern/kern_sig.c Tue Apr 3 09:38:53 2018 (r331921) +++ stable/11/sys/kern/kern_sig.c Tue Apr 3 09:40:52 2018 (r331922) @@ -692,8 +692,8 @@ kern_sigaction(struct thread *td, int sig, const struc ps = p->p_sigacts; mtx_lock(&ps->ps_mtx); if (oact) { + memset(oact, 0, sizeof(*oact)); oact->sa_mask = ps->ps_catchmask[_SIG_IDX(sig)]; - oact->sa_flags = 0; if (SIGISMEMBER(ps->ps_sigonstack, sig)) oact->sa_flags |= SA_ONSTACK; if (!SIGISMEMBER(ps->ps_sigintr, sig)) Modified: stable/11/sys/kern/sysv_shm.c ============================================================================== --- stable/11/sys/kern/sysv_shm.c Tue Apr 3 09:38:53 2018 (r331921) +++ stable/11/sys/kern/sysv_shm.c Tue Apr 3 09:40:52 2018 (r331922) @@ -1447,6 +1447,7 @@ freebsd7_freebsd32_shmctl(struct thread *td, break; case SHM_STAT: case IPC_STAT: + memset(&u32.shmid_ds32, 0, sizeof(u32.shmid_ds32)); freebsd32_ipcperm_old_out(&u.shmid_ds.shm_perm, &u32.shmid_ds32.shm_perm); if (u.shmid_ds.shm_segsz > INT32_MAX) @@ -1610,6 +1611,7 @@ freebsd7_shmctl(struct thread *td, struct freebsd7_shm /* Cases in which we need to copyout */ switch (uap->cmd) { case IPC_STAT: + memset(&old, 0, sizeof(old)); ipcperm_new2old(&buf.shm_perm, &old.shm_perm); if (buf.shm_segsz > INT_MAX) old.shm_segsz = INT_MAX; From owner-svn-src-stable-11@freebsd.org Tue Apr 3 09:46:29 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0E4F5F714C2; Tue, 3 Apr 2018 09:46:29 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A78BC71F50; Tue, 3 Apr 2018 09:46:28 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8236B22BDF; Tue, 3 Apr 2018 09:46:28 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w339kStY078762; Tue, 3 Apr 2018 09:46:28 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w339kS53078761; Tue, 3 Apr 2018 09:46:28 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201804030946.w339kS53078761@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 3 Apr 2018 09:46:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331923 - stable/11/sys/dev/mlx5 X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5 X-SVN-Commit-Revision: 331923 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2018 09:46:29 -0000 Author: hselasky Date: Tue Apr 3 09:46:28 2018 New Revision: 331923 URL: https://svnweb.freebsd.org/changeset/base/331923 Log: MFC r330655: Remove duplicate prototypes. This is a direct commit (mergeinfo was added by r331796). Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/cmd.h Modified: stable/11/sys/dev/mlx5/cmd.h ============================================================================== --- stable/11/sys/dev/mlx5/cmd.h Tue Apr 3 09:40:52 2018 (r331922) +++ stable/11/sys/dev/mlx5/cmd.h Tue Apr 3 09:46:28 2018 (r331923) @@ -50,11 +50,4 @@ int mlx5_cmd_query_cong_params(struct mlx5_core_dev *d void *out, int out_size); int mlx5_cmd_modify_cong_params(struct mlx5_core_dev *mdev, void *in, int in_size); -struct mlx5_core_dev; -int mlx5_cmd_query_cong_counter(struct mlx5_core_dev *dev, - bool reset, void *out, int out_size); -int mlx5_cmd_query_cong_params(struct mlx5_core_dev *dev, int cong_point, - void *out, int out_size); -int mlx5_cmd_modify_cong_params(struct mlx5_core_dev *mdev, - void *in, int in_size); #endif /* MLX5_CMD_H */ From owner-svn-src-stable-11@freebsd.org Tue Apr 3 04:21:56 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 08A8DF8033A for ; Tue, 3 Apr 2018 04:21:56 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from pmta2.delivery6.ore.mailhop.org (pmta2.delivery6.ore.mailhop.org [54.200.129.228]) (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 26F5B84C19 for ; Tue, 3 Apr 2018 04:21:55 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: 582fb5e6-36f6-11e8-b951-f99fef315fd9 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound2.ore.mailhop.org (Halon) with ESMTPSA id 582fb5e6-36f6-11e8-b951-f99fef315fd9; Tue, 03 Apr 2018 04:20:31 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id w334LjBs079497; Mon, 2 Apr 2018 22:21:45 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1522729305.49673.206.camel@freebsd.org> Subject: Re: svn commit: r331838 - in stable/11: . contrib/compiler-rt/include/sanitizer contrib/compiler-rt/include/xray contrib/compiler-rt/lib/BlocksRuntime contrib/compiler-rt/lib/asan contrib/compiler-rt/l... From: Ian Lepore To: rgrimes@freebsd.org, Mark Linimon Cc: Ed Maste , Dimitry Andric , Antoine Brodin , svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers , re , svn-src-stable-11@freebsd.org Date: Mon, 02 Apr 2018 22:21:45 -0600 In-Reply-To: <201804030202.w3322xXG085227@pdx.rh.CN85.dnsmgr.net> References: <201804030202.w3322xXG085227@pdx.rh.CN85.dnsmgr.net> Content-Type: text/plain; charset="ASCII" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Tue, 03 Apr 2018 10:45:36 +0000 X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2018 04:21:56 -0000 On Mon, 2018-04-02 at 19:02 -0700, Rodney W. Grimes wrote: > > > > So, the takeaway is, this change stays, and stable/11 users that build > > their own ports are on their own? > > > > Whatever happened to POLA? > I have no idea, but I fully agree that changing compilers 30 days before > a code slush is just a very bad move. > > The llvm in 11.1 is 4. > Is there some pressing reason that we need llvm 6 to be in release 11.2? > > Looks like I wont be upgrading to 11.2 as I am sure I'll have blocking > issues with some ports. > > Though I could probably build them with 11.1, I hate that idea as then > I have to keep an 11.1 around incase I need to rebuild something. > > :-( I was hoping to import 11.2 to our repo at $work and be shipping products based on it later this year. But there's no way we have resources available to sidetrack and start debugging out of the blue failures of ports that have been working fine for us until now. I guess the best I can do now is import 11-stable immediately before the compiler change. At least I was lucky enough to get all the arm changes important for us MFC'd before the compiler change. -- Ian From owner-svn-src-stable-11@freebsd.org Tue Apr 3 04:32:23 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B00C0F80D3D for ; Tue, 3 Apr 2018 04:32:23 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x231.google.com (mail-it0-x231.google.com [IPv6:2607:f8b0:4001:c0b::231]) (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 2F2B085369 for ; Tue, 3 Apr 2018 04:32:23 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x231.google.com with SMTP id e98-v6so20939485itd.4 for ; Mon, 02 Apr 2018 21:32:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vnboHRjrRjY6pMWRzK7U5yUo/4nwagM8YPKD1rmARFA=; b=S6Y9tig/c+x9I3QGsh9/0VKpH0U49y0i8AKD4jUH0Mkcfp2AkHLfNERNxsq/PKf4m1 +H4XbtC2t0WStwh+KuTHvZd85c5pvJqZzs3ExcaEEAraPCgBsPFe4wOUt7IN60ufQQFM 7z6c+zDdeHDp5ma7cnH6BLsTjj4FDkFYOGZ3zN85c6P6GCBG0WkmnF9fcVORJR97ybdC qbhV3Ey0Pkiw+jb/qnB6pV5/Fq4634qIhal3YCA08Vl4dvBrFBduemWGUOhE4YWqbGyj hnG/52OIBDI1k0sKUeWUwdVVWiMQvdehjSWKV9TBQ427o2dasTd8n4eWJhVsM24249tk st5w== 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=vnboHRjrRjY6pMWRzK7U5yUo/4nwagM8YPKD1rmARFA=; b=gaH5jen52j1zqwGcPmJ86fiaovu8mpoeOZVsZnnynyu1T/yZOKs+7Gy32aq0y29MLp sOjzjY3jWc1qRb0z2H+fZM75fdNqN2fi14LEVZv304jxZgeiBQfmQzp1T+T3oFVl2+tg mdgQUYQkXi5Ztp91WcUF5DN88dYCLW7+3IjoVt6eHr8exk1MD59sRATWBnjvZ26ewUTN vbCBPzvmwEBE1aJlt0nWqIfOJjrCkeZDCBztvS1Sc8NOnWctIJHU64uEIsn1+aZ+srZ3 3tOJjb7xKvw0eJf7D6JlU7r/P42c0a+Z7rySz+Q6eUSb+YNO8FdhrsLYaC0OACXuFH+Y fS+w== X-Gm-Message-State: ALQs6tBeWPZ7HfIyI1O/WrETgfxkpggUS05UfM2HaxxjYmBYpiHAN+FN UBXEEbk3DHvYyr0Xd/50UQiPVT1VmrBDLju6I6n6zg== X-Google-Smtp-Source: AIpwx4+/7b+YQuwvkgmemJbIOYA0e/xwdCn1Qd1z0FCvLPDa8NDppr2ysZKnioR1sNvd4mdZ1ObjN5s2jcshkfKgtXk= X-Received: by 2002:a24:fa83:: with SMTP id v125-v6mr3581803ith.36.1522729942522; Mon, 02 Apr 2018 21:32:22 -0700 (PDT) MIME-Version: 1.0 References: <201804030202.w3322xXG085227@pdx.rh.CN85.dnsmgr.net> <1522729305.49673.206.camel@freebsd.org> In-Reply-To: <1522729305.49673.206.camel@freebsd.org> From: Warner Losh Date: Tue, 03 Apr 2018 04:32:11 +0000 Message-ID: Subject: Re: svn commit: r331838 - in stable/11: . contrib/compiler-rt/include/sanitizer contrib/compiler-rt/include/xray contrib/compiler-rt/lib/BlocksRuntime contrib/compiler-rt/lib/asan contrib/compiler-rt/l... To: Ian Lepore Cc: "Rodney W. Grimes" , Mark Linimon , Ed Maste , Dimitry Andric , Antoine Brodin , svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers , re , svn-src-stable-11@freebsd.org X-Mailman-Approved-At: Tue, 03 Apr 2018 10:45:36 +0000 Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2018 04:32:24 -0000 On Mon, Apr 2, 2018, 10:22 PM Ian Lepore wrote: > On Mon, 2018-04-02 at 19:02 -0700, Rodney W. Grimes wrote: > > > > > > So, the takeaway is, this change stays, and stable/11 users that build > > > their own ports are on their own? > > > > > > Whatever happened to POLA? > > I have no idea, but I fully agree that changing compilers 30 days before > > a code slush is just a very bad move. > > > > The llvm in 11.1 is 4. > > Is there some pressing reason that we need llvm 6 to be in release 11.2? > > > > Looks like I wont be upgrading to 11.2 as I am sure I'll have blocking > > issues with some ports. > > > > Though I could probably build them with 11.1, I hate that idea as then > > I have to keep an 11.1 around incase I need to rebuild something. > > > > :-( > > I was hoping to import 11.2 to our repo at $work and be shipping > products based on it later this year. But there's no way we have > resources available to sidetrack and start debugging out of the blue > failures of ports that have been working fine for us until now. I guess > the best I can do now is import 11-stable immediately before the > compiler change. At least I was lucky enough to get all the arm changes > important for us MFC'd before the compiler change. > All depends on which ports are broken... would be nice to have a list... Warner > From owner-svn-src-stable-11@freebsd.org Tue Apr 3 06:34:22 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8FD21F867C7; Tue, 3 Apr 2018 06:34:22 +0000 (UTC) (envelope-from linimon@lonesome.com) Received: from mail.soaustin.net (mail.soaustin.net [192.108.105.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.soaustin.net", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 21F1169120; Tue, 3 Apr 2018 06:34:21 +0000 (UTC) (envelope-from linimon@lonesome.com) Received: from lonesome.com (bones.soaustin.net [192.108.105.22]) by mail.soaustin.net (Postfix) with ESMTPSA id 38AFA11F1; Tue, 3 Apr 2018 01:34:19 -0500 (CDT) Date: Tue, 3 Apr 2018 01:34:18 -0500 From: Mark Linimon To: Warner Losh Cc: Ian Lepore , "Rodney W. Grimes" , Ed Maste , Dimitry Andric , Antoine Brodin , svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers , re , svn-src-stable-11@freebsd.org Subject: Re: svn commit: r331838 - in stable/11: . contrib/compiler-rt/include/sanitizer contrib/compiler-rt/include/xray contrib/compiler-rt/lib/BlocksRuntime contrib/compiler-rt/lib/asan contrib/compiler-rt/l... Message-ID: <20180403063417.GA32517@lonesome.com> References: <201804030202.w3322xXG085227@pdx.rh.CN85.dnsmgr.net> <1522729305.49673.206.camel@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Mailman-Approved-At: Tue, 03 Apr 2018 10:45:36 +0000 X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2018 06:34:22 -0000 On Tue, Apr 03, 2018 at 04:32:11AM +0000, Warner Losh wrote: > All depends on which ports are broken... would be nice to have a list... It's only a matter of a few hours' work. mcl From owner-svn-src-stable-11@freebsd.org Tue Apr 3 07:32:16 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 233A3F89D34; Tue, 3 Apr 2018 07:32:16 +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 8C1936B751; Tue, 3 Apr 2018 07:32:15 +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 w337W9Vv086229; Tue, 3 Apr 2018 00:32:09 -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 w337W91X086228; Tue, 3 Apr 2018 00:32:09 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201804030732.w337W91X086228@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r331838 - in stable/11: . contrib/compiler-rt/include/sanitizer contrib/compiler-rt/include/xray contrib/compiler-rt/lib/BlocksRuntime contrib/compiler-rt/lib/asan contrib/compiler-rt/l... In-Reply-To: <1522729305.49673.206.camel@freebsd.org> To: Ian Lepore Date: Tue, 3 Apr 2018 00:32:09 -0700 (PDT) CC: rgrimes@freebsd.org, Mark Linimon , Ed Maste , Dimitry Andric , Antoine Brodin , svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers , re , svn-src-stable-11@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-Mailman-Approved-At: Tue, 03 Apr 2018 10:45:37 +0000 X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2018 07:32:16 -0000 > On Mon, 2018-04-02 at 19:02 -0700, Rodney W. Grimes wrote: > > > > > > So, the takeaway is, this change stays, and stable/11 users that build > > > their own ports are on their own? > > > > > > Whatever happened to POLA? > > I have no idea, but I fully agree that changing compilers 30 days before > > a code slush is just a very bad move. > > > > The llvm in 11.1 is 4. > > Is there some pressing reason that we need llvm 6 to be in release 11.2? > > > > Looks like I wont be upgrading to 11.2 as I am sure I'll have blocking > > issues with some ports. > > > > Though I could probably build them with 11.1, I hate that idea as then > > I have to keep an 11.1 around incase I need to rebuild something. > > > > :-( > > I was hoping to import 11.2 to our repo at $work and be shipping > products based on it later this year. But there's no way we have > resources available to sidetrack and start debugging out of the blue > failures of ports that have been working fine for us until now. I guess > the best I can do now is import 11-stable immediately before the > compiler change. At least I was lucky enough to get all the arm changes > important for us MFC'd before the compiler change. Or checkout 11.2 and revert this commit locally, then commit that to your repo at $work. -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-stable-11@freebsd.org Tue Apr 3 14:05:41 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B2BCF82F7E; Tue, 3 Apr 2018 14:05:41 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 030D37EFE5; Tue, 3 Apr 2018 14:05:41 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F1F4E256C9; Tue, 3 Apr 2018 14:05:40 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w33E5eCk052582; Tue, 3 Apr 2018 14:05:40 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w33E5e42052580; Tue, 3 Apr 2018 14:05:40 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <201804031405.w33E5e42052580@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Tue, 3 Apr 2018 14:05: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: r331927 - stable/11/stand/i386/zfsboot X-SVN-Group: stable-11 X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: stable/11/stand/i386/zfsboot X-SVN-Commit-Revision: 331927 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2018 14:05:41 -0000 Author: eugen Date: Tue Apr 3 14:05:40 2018 New Revision: 331927 URL: https://svnweb.freebsd.org/changeset/base/331927 Log: MFC r331630: Fix instructions in the zfsboot manual page. zfsloader(8) fails to probe a slice containing ZFS pool if its second sector contains traces of BSD label (DISKMAGIC == 0x82564557). Fix manual page to show working example erasing such traces. PR: 226714 Approved by: avg (mentor) _M . M stand/i386/zfsboot/zfsboot.8 Modified: stable/11/stand/i386/zfsboot/zfsboot.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/i386/zfsboot/zfsboot.8 ============================================================================== --- stable/11/stand/i386/zfsboot/zfsboot.8 Tue Apr 3 13:54:38 2018 (r331926) +++ stable/11/stand/i386/zfsboot/zfsboot.8 Tue Apr 3 14:05:40 2018 (r331927) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 15, 2014 +.Dd March 27, 2018 .Dt ZFSBOOT 8 .Os .Sh NAME @@ -99,9 +99,9 @@ can also be installed in an MBR slice: .Bd -literal -offset indent gpart create -s mbr ada0 gpart add -t freebsd ada0 -gpart create -s BSD ada0s1 gpart bootcode -b /boot/boot0 ada0 gpart set -a active -i 1 ada0 +dd if=/dev/zero of=/dev/ada0s1 count=2 dd if=/boot/zfsboot of=/dev/ada0s1 count=1 dd if=/boot/zfsboot of=/dev/ada0s1 iseek=1 oseek=1024 .Ed From owner-svn-src-stable-11@freebsd.org Tue Apr 3 14:14:00 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C3A6DF83797; Tue, 3 Apr 2018 14:14:00 +0000 (UTC) (envelope-from eugen@grosbein.net) Received: from hz.grosbein.net (hz.grosbein.net [78.47.246.247]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "hz.grosbein.net", Issuer "hz.grosbein.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4581F7F82A; Tue, 3 Apr 2018 14:14:00 +0000 (UTC) (envelope-from eugen@grosbein.net) Received: from eg.sd.rdtc.ru (root@eg.sd.rdtc.ru [62.231.161.221] (may be forged)) by hz.grosbein.net (8.15.2/8.15.2) with ESMTPS id w33EDrbr017533 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 3 Apr 2018 16:13:54 +0200 (CEST) (envelope-from eugen@grosbein.net) X-Envelope-From: eugen@grosbein.net X-Envelope-To: src-committers@freebsd.org Received: from eg.sd.rdtc.ru (eugen@localhost [127.0.0.1]) by eg.sd.rdtc.ru (8.15.2/8.15.2) with ESMTP id w33EDnvT094655; Tue, 3 Apr 2018 21:13:49 +0700 (+07) (envelope-from eugen@grosbein.net) Subject: Re: svn commit: r331927 - stable/11/stand/i386/zfsboot To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org References: <201804031405.w33E5e42052580@repo.freebsd.org> From: Eugene Grosbein Message-ID: <5AC38C1D.3010701@grosbein.net> Date: Tue, 3 Apr 2018 21:13:49 +0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <201804031405.w33E5e42052580@repo.freebsd.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=3.2 required=5.0 tests=BAYES_00, DATE_IN_FUTURE_96_Q, LOCAL_FROM, RDNS_NONE autolearn=no autolearn_force=no version=3.4.1 X-Spam-Report: * 1.0 DATE_IN_FUTURE_96_Q Date: is 4 days to 4 months after Received: date * -2.3 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 2.6 LOCAL_FROM From my domains * 1.9 RDNS_NONE Delivered to internal network by a host with no rDNS X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on hz.grosbein.net X-Spam-Level: *** X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2018 14:14:00 -0000 On 03.04.2018 21:05, Eugene Grosbein wrote: > Author: eugen > Date: Tue Apr 3 14:05:40 2018 > New Revision: 331927 > URL: https://svnweb.freebsd.org/changeset/base/331927 > > Log: > MFC r331630: Fix instructions in the zfsboot manual page. > > zfsloader(8) fails to probe a slice containing ZFS pool if its second sector > contains traces of BSD label (DISKMAGIC == 0x82564557). > Fix manual page to show working example erasing such traces. > > PR: 226714 > Approved by: avg (mentor) This should be, and for next my commit too: Approved by: mav (mentor) From owner-svn-src-stable-11@freebsd.org Tue Apr 3 15:14:31 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9BA3FF874BF; Tue, 3 Apr 2018 15:14:31 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4AD6882095; Tue, 3 Apr 2018 15:14:31 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 456A42625C; Tue, 3 Apr 2018 15:14:31 +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 w33FEVFk067753; Tue, 3 Apr 2018 15:14:31 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w33FEVQH067752; Tue, 3 Apr 2018 15:14:31 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201804031514.w33FEVQH067752@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 3 Apr 2018 15:14:31 +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: r331930 - stable/11/sys/netinet/cc X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/sys/netinet/cc X-SVN-Commit-Revision: 331930 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2018 15:14:31 -0000 Author: emaste Date: Tue Apr 3 15:14:30 2018 New Revision: 331930 URL: https://svnweb.freebsd.org/changeset/base/331930 Log: MFC r321587: cc_cubic: restore braces around if-condition block r307901 was reverted in r321480, restoring an incorrect block delimitation bug present in the original cc_cubic commit. Restore only the bugfix (brace addition) from r307901. [HEAD revs above; r307901 and r321480 were both merged to stable/11 in r330445.] CID: 1090182 Reported by: bz Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/netinet/cc/cc_cubic.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/cc/cc_cubic.c ============================================================================== --- stable/11/sys/netinet/cc/cc_cubic.c Tue Apr 3 14:29:56 2018 (r331929) +++ stable/11/sys/netinet/cc/cc_cubic.c Tue Apr 3 15:14:30 2018 (r331930) @@ -261,9 +261,10 @@ cubic_cong_signal(struct cc_var *ccv, uint32_t type) * chance the first one is a false alarm and may not indicate * congestion. */ - if (CCV(ccv, t_rxtshift) >= 2) + if (CCV(ccv, t_rxtshift) >= 2) { cubic_data->num_cong_events++; cubic_data->t_last_cong = ticks; + } break; } } From owner-svn-src-stable-11@freebsd.org Tue Apr 3 21:22:44 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C7AFF81B8F; Tue, 3 Apr 2018 21:22:44 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2F7EB75970; Tue, 3 Apr 2018 21:22:44 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A69F211F; Tue, 3 Apr 2018 21:22:44 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w33LMhSH037640; Tue, 3 Apr 2018 21:22:43 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w33LMhOD037638; Tue, 3 Apr 2018 21:22:43 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201804032122.w33LMhOD037638@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Tue, 3 Apr 2018 21:22: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: r331952 - stable/11/sys/cddl/dev/fbt/arm X-SVN-Group: stable-11 X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: stable/11/sys/cddl/dev/fbt/arm X-SVN-Commit-Revision: 331952 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2018 21:22:44 -0000 Author: gonzo Date: Tue Apr 3 21:22:43 2018 New Revision: 331952 URL: https://svnweb.freebsd.org/changeset/base/331952 Log: MFC r312378 by andrew: Use the kernel stack in the ARM FBT DTrace provider. This is used to find the fifth argument to functions being traced, however there was an error where the userspace stack was being used. This may be invalid leading to a kernel panic if this address is unmapped. Submitted by: Graeme Jenkinson Differential Revision: https://reviews.freebsd.org/D9229 MFC commit fields PR: 211389 Modified: stable/11/sys/cddl/dev/fbt/arm/fbt_isa.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/dev/fbt/arm/fbt_isa.c ============================================================================== --- stable/11/sys/cddl/dev/fbt/arm/fbt_isa.c Tue Apr 3 21:17:19 2018 (r331951) +++ stable/11/sys/cddl/dev/fbt/arm/fbt_isa.c Tue Apr 3 21:22:43 2018 (r331952) @@ -61,7 +61,7 @@ fbt_invop(uintptr_t addr, struct trapframe *frame, uin /* Get 5th parameter from stack */ DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); - fifthparam = *(register_t *)frame->tf_usr_sp; + fifthparam = *(register_t *)frame->tf_svc_sp; DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT | CPU_DTRACE_BADADDR); dtrace_probe(fbt->fbtp_id, frame->tf_r0, From owner-svn-src-stable-11@freebsd.org Wed Apr 4 01:56:48 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0287F854F4; Wed, 4 Apr 2018 01:56:47 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A09368134F; Wed, 4 Apr 2018 01:56:47 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B1795268; Wed, 4 Apr 2018 01:56:47 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w341ulVN019376; Wed, 4 Apr 2018 01:56:47 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w341uk90019363; Wed, 4 Apr 2018 01:56:46 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201804040156.w341uk90019363@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Wed, 4 Apr 2018 01:56: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: r331968 - in stable/11/sys/arm: arm include X-SVN-Group: stable-11 X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: in stable/11/sys/arm: arm include X-SVN-Commit-Revision: 331968 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Apr 2018 01:56:48 -0000 Author: mmel Date: Wed Apr 4 01:56:46 2018 New Revision: 331968 URL: https://svnweb.freebsd.org/changeset/base/331968 Log: MFC r319896,r320054: r319896: Implement tunable CPU quirks. These quirks are intended for optimizing CPU performance, not for applying errata workarounds. Nobody can expect that CPU with unfixed errata is stable enough to execute the kernel until quirks are applied. r320054: Manually load tunable CPU quirks. These are needed too early, far before SYSINIT is processed. Modified: stable/11/sys/arm/arm/cpuinfo.c stable/11/sys/arm/arm/mp_machdep.c stable/11/sys/arm/arm/pmap-v6.c stable/11/sys/arm/include/cpuinfo.h stable/11/sys/arm/include/pmap-v6.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/arm/cpuinfo.c ============================================================================== --- stable/11/sys/arm/arm/cpuinfo.c Wed Apr 4 01:13:28 2018 (r331967) +++ stable/11/sys/arm/arm/cpuinfo.c Wed Apr 4 01:56:46 2018 (r331968) @@ -30,12 +30,18 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include #include +#if __ARM_ARCH >= 6 +void reinit_mmu(uint32_t ttb, uint32_t aux_clr, uint32_t aux_set); +#endif + struct cpuinfo cpuinfo = { /* Use safe defaults for start */ @@ -45,6 +51,30 @@ struct cpuinfo cpuinfo = .icache_line_mask = 31, }; +static SYSCTL_NODE(_hw, OID_AUTO, cpu, CTLFLAG_RD, 0, + "CPU"); +static SYSCTL_NODE(_hw_cpu, OID_AUTO, quirks, CTLFLAG_RD, 0, + "CPU quirks"); + +/* + * Tunable CPU quirks. + * Be careful, ACTRL cannot be changed if CPU is started in secure + * mode(world) and write to ACTRL can cause exception! + * These quirks are intended for optimizing CPU performance, not for + * applying errata workarounds. Nobody can expect that CPU with unfixed + * errata is stable enough to execute the kernel until quirks are applied. + */ +static uint32_t cpu_quirks_actlr_mask; +SYSCTL_INT(_hw_cpu_quirks, OID_AUTO, actlr_mask, + CTLFLAG_RDTUN | CTLFLAG_NOFETCH, &cpu_quirks_actlr_mask, 0, + "Bits to be masked in ACTLR"); + +static uint32_t cpu_quirks_actlr_set; +SYSCTL_INT(_hw_cpu_quirks, OID_AUTO, actlr_set, + CTLFLAG_RDTUN | CTLFLAG_NOFETCH, &cpu_quirks_actlr_set, 0, + "Bits to be set in ACTLR"); + + /* Read and parse CPU id scheme */ void cpuinfo_init(void) @@ -53,6 +83,14 @@ cpuinfo_init(void) uint32_t tmp; #endif + /* + * Prematurely fetch CPU quirks. Standard fetch for tunable + * sysctls is handled using SYSINIT, thus too late for boot CPU. + * Keep names in sync with sysctls. + */ + TUNABLE_INT_FETCH("hw.cpu.quirks.actlr_mask", &cpu_quirks_actlr_mask); + TUNABLE_INT_FETCH("hw.cpu.quirks.actlr_set", &cpu_quirks_actlr_set); + cpuinfo.midr = cp15_midr_get(); /* Test old version id schemes first */ if ((cpuinfo.midr & CPU_ID_IMPLEMENTOR_MASK) == CPU_ID_ARM_LTD) { @@ -199,15 +237,17 @@ cpuinfo_init(void) #endif } +#if __ARM_ARCH >= 6 /* * Get bits that must be set or cleared in ACLR register. * Note: Bits in ACLR register are IMPLEMENTATION DEFINED. * Its expected that SCU is in operational state before this * function is called. */ -void +static void cpuinfo_get_actlr_modifier(uint32_t *actlr_mask, uint32_t *actlr_set) { + *actlr_mask = 0; *actlr_set = 0; @@ -282,3 +322,18 @@ cpuinfo_get_actlr_modifier(uint32_t *actlr_mask, uint3 return; } } + +/* Reinitialize MMU to final kernel mapping and apply all CPU quirks. */ +void +cpuinfo_reinit_mmu(uint32_t ttb) +{ + uint32_t actlr_mask; + uint32_t actlr_set; + + cpuinfo_get_actlr_modifier(&actlr_mask, &actlr_set); + actlr_mask |= cpu_quirks_actlr_mask; + actlr_set |= cpu_quirks_actlr_set; + reinit_mmu(ttb, actlr_mask, actlr_set); +} + +#endif /* __ARM_ARCH >= 6 */ Modified: stable/11/sys/arm/arm/mp_machdep.c ============================================================================== --- stable/11/sys/arm/arm/mp_machdep.c Wed Apr 4 01:13:28 2018 (r331967) +++ stable/11/sys/arm/arm/mp_machdep.c Wed Apr 4 01:56:46 2018 (r331968) @@ -155,11 +155,9 @@ init_secondary(int cpu) #ifndef INTRNG int start = 0, end = 0; #endif - uint32_t actlr_mask, actlr_set; pmap_set_tex(); - cpuinfo_get_actlr_modifier(&actlr_mask, &actlr_set); - reinit_mmu(pmap_kern_ttb, actlr_mask, actlr_set); + cpuinfo_reinit_mmu(pmap_kern_ttb); cpu_setup(); /* Provide stack pointers for other processor modes. */ Modified: stable/11/sys/arm/arm/pmap-v6.c ============================================================================== --- stable/11/sys/arm/arm/pmap-v6.c Wed Apr 4 01:13:28 2018 (r331967) +++ stable/11/sys/arm/arm/pmap-v6.c Wed Apr 4 01:56:46 2018 (r331968) @@ -762,7 +762,7 @@ pmap_bootstrap_prepare(vm_paddr_t last) pt1_entry_t *pte1p; pt2_entry_t *pte2p; u_int i; - uint32_t actlr_mask, actlr_set, l1_attr; + uint32_t l1_attr; /* * Now, we are going to make real kernel mapping. Note that we are @@ -879,8 +879,7 @@ pmap_bootstrap_prepare(vm_paddr_t last) /* Finally, switch from 'boot_pt1' to 'kern_pt1'. */ pmap_kern_ttb = base_pt1 | ttb_flags; - cpuinfo_get_actlr_modifier(&actlr_mask, &actlr_set); - reinit_mmu(pmap_kern_ttb, actlr_mask, actlr_set); + cpuinfo_reinit_mmu(pmap_kern_ttb); /* * Initialize the first available KVA. As kernel image is mapped by * sections, we are leaving some gap behind. Modified: stable/11/sys/arm/include/cpuinfo.h ============================================================================== --- stable/11/sys/arm/include/cpuinfo.h Wed Apr 4 01:13:28 2018 (r331967) +++ stable/11/sys/arm/include/cpuinfo.h Wed Apr 4 01:56:46 2018 (r331968) @@ -121,5 +121,7 @@ struct cpuinfo { extern struct cpuinfo cpuinfo; void cpuinfo_init(void); -void cpuinfo_get_actlr_modifier(uint32_t *actlr_mask, uint32_t *actlr_set); +#if __ARM_ARCH >= 6 +void cpuinfo_reinit_mmu(uint32_t ttb); +#endif #endif /* _MACHINE_CPUINFO_H_ */ Modified: stable/11/sys/arm/include/pmap-v6.h ============================================================================== --- stable/11/sys/arm/include/pmap-v6.h Wed Apr 4 01:13:28 2018 (r331967) +++ stable/11/sys/arm/include/pmap-v6.h Wed Apr 4 01:56:46 2018 (r331968) @@ -177,7 +177,6 @@ vm_paddr_t pmap_dump_kextract(vm_offset_t, pt2_entry_t int pmap_fault(pmap_t, vm_offset_t, uint32_t, int, bool); void pmap_set_tex(void); -void reinit_mmu(ttb_entry_t ttb, u_int aux_clr, u_int aux_set); /* * Pre-bootstrap epoch functions set. From owner-svn-src-stable-11@freebsd.org Wed Apr 4 02:17:27 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 880F3F86796; Wed, 4 Apr 2018 02:17:27 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3AF1C8214A; Wed, 4 Apr 2018 02:17:27 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 35CFD55AC; Wed, 4 Apr 2018 02:17:27 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w342HQP8047595; Wed, 4 Apr 2018 02:17:26 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w342HQ48047590; Wed, 4 Apr 2018 02:17:26 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201804040217.w342HQ48047590@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Wed, 4 Apr 2018 02:17:26 +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: r331971 - stable/11/sys/arm/include X-SVN-Group: stable-11 X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: stable/11/sys/arm/include X-SVN-Commit-Revision: 331971 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Apr 2018 02:17:27 -0000 Author: mmel Date: Wed Apr 4 02:17:26 2018 New Revision: 331971 URL: https://svnweb.freebsd.org/changeset/base/331971 Log: MFC r309531,r309553,r309604: r309531: Implement fake pmap_mapdev_attr() for ARMv6. This function is referenced, but never called from DRM2 code. Also, real behavior of pmap_mapdev_attr() in ARM world is unclear as we don't have any additional attribute for a device memory type. r309553: Fix build breakage caused by r309531. r309604: Fix the armv6 build after r309553. Modified: stable/11/sys/arm/include/pmap-v6.h stable/11/sys/arm/include/pmap.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/include/pmap-v6.h ============================================================================== --- stable/11/sys/arm/include/pmap-v6.h Wed Apr 4 02:13:27 2018 (r331970) +++ stable/11/sys/arm/include/pmap-v6.h Wed Apr 4 02:17:26 2018 (r331971) @@ -166,7 +166,6 @@ extern ttb_entry_t pmap_kern_ttb; /* TTB for kernel p void pmap_bootstrap(vm_offset_t); void pmap_kenter(vm_offset_t, vm_paddr_t); void pmap_kremove(vm_offset_t); -void *pmap_mapdev_attr(vm_paddr_t, vm_size_t, int); boolean_t pmap_page_is_mapped(vm_page_t); void pmap_tlb_flush(pmap_t, vm_offset_t); Modified: stable/11/sys/arm/include/pmap.h ============================================================================== --- stable/11/sys/arm/include/pmap.h Wed Apr 4 02:13:27 2018 (r331970) +++ stable/11/sys/arm/include/pmap.h Wed Apr 4 02:17:26 2018 (r331971) @@ -37,6 +37,7 @@ #endif #ifdef _KERNEL +#include extern vm_paddr_t dump_avail[]; extern vm_paddr_t phys_avail[]; @@ -52,6 +53,12 @@ void pmap_page_set_memattr(vm_page_t, vm_memattr_t); void *pmap_mapdev(vm_paddr_t, vm_size_t); void pmap_unmapdev(vm_offset_t, vm_size_t); + +static inline void * +pmap_mapdev_attr(vm_paddr_t addr, vm_size_t size, int attr) +{ + panic("%s is not implemented yet!\n", __func__); +} struct pcb; void pmap_set_pcb_pagedir(pmap_t, struct pcb *); From owner-svn-src-stable-11@freebsd.org Wed Apr 4 02:22:57 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9DBD6F86E44; Wed, 4 Apr 2018 02:22:57 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 34A2A8264B; Wed, 4 Apr 2018 02:22:57 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2D350573E; Wed, 4 Apr 2018 02:22:57 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w342Mvdu056990; Wed, 4 Apr 2018 02:22:57 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w342MvNX056989; Wed, 4 Apr 2018 02:22:57 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201804040222.w342MvNX056989@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Wed, 4 Apr 2018 02:22: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: r331972 - stable/11/sys/arm64/arm64 X-SVN-Group: stable-11 X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: stable/11/sys/arm64/arm64 X-SVN-Commit-Revision: 331972 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Apr 2018 02:22:57 -0000 Author: mmel Date: Wed Apr 4 02:22:56 2018 New Revision: 331972 URL: https://svnweb.freebsd.org/changeset/base/331972 Log: MFC r327827: Initialize CONTEXTIDR register on secondary cores by zero, not with undefined value from X1 register. Modified: stable/11/sys/arm64/arm64/locore.S Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm64/arm64/locore.S ============================================================================== --- stable/11/sys/arm64/arm64/locore.S Wed Apr 4 02:17:26 2018 (r331971) +++ stable/11/sys/arm64/arm64/locore.S Wed Apr 4 02:22:56 2018 (r331972) @@ -167,7 +167,7 @@ ENTRY(mpentry) bl drop_to_el1 /* Set the context id */ - msr contextidr_el1, x1 + msr contextidr_el1, xzr /* Load the kernel page table */ adr x24, pagetable_l0_ttbr1 From owner-svn-src-stable-11@freebsd.org Wed Apr 4 02:30:03 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C32AF873FB; Wed, 4 Apr 2018 02:30:02 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0B482DBA; Wed, 4 Apr 2018 02:30:01 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 45D7C574B; Wed, 4 Apr 2018 02:30:01 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w342U1j7063474; Wed, 4 Apr 2018 02:30:01 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w342U1RD063473; Wed, 4 Apr 2018 02:30:01 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201804040230.w342U1RD063473@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Wed, 4 Apr 2018 02:30: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: r331973 - stable/11/libexec/rtld-elf/aarch64 X-SVN-Group: stable-11 X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: stable/11/libexec/rtld-elf/aarch64 X-SVN-Commit-Revision: 331973 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Apr 2018 02:30:03 -0000 Author: mmel Date: Wed Apr 4 02:30:00 2018 New Revision: 331973 URL: https://svnweb.freebsd.org/changeset/base/331973 Log: MFC r330073: Make rtld_bind_start() debugger friendly. Save link register and annotate call frame structure so debugger can unwind call frame created by rtld_bind_start(). Modified: stable/11/libexec/rtld-elf/aarch64/rtld_start.S Directory Properties: stable/11/ (props changed) Modified: stable/11/libexec/rtld-elf/aarch64/rtld_start.S ============================================================================== --- stable/11/libexec/rtld-elf/aarch64/rtld_start.S Wed Apr 4 02:22:56 2018 (r331972) +++ stable/11/libexec/rtld-elf/aarch64/rtld_start.S Wed Apr 4 02:30:00 2018 (r331973) @@ -55,7 +55,15 @@ END(.rtld_start) * x17 = &_rtld_bind_start */ ENTRY(_rtld_bind_start) + .cfi_startproc mov x17, sp + + /* Save frame pointer and SP */ + stp x29, x30, [sp, #-16]! + mov x29, sp + .cfi_def_cfa x29, 16 + .cfi_offset x30, -8 + .cfi_offset x29, -16 /* Save the arguments */ stp x0, x1, [sp, #-16]! @@ -84,9 +92,6 @@ ENTRY(_rtld_bind_start) /* Call into rtld */ bl _rtld_bind - /* Restore the registers saved by the plt code */ - ldp xzr, x30, [sp, #(5 * 16 + 4 * 32)] - /* Backup the address to branch to */ mov x16, x0 @@ -100,11 +105,16 @@ ENTRY(_rtld_bind_start) ldp x4, x5, [sp], #16 ldp x2, x3, [sp], #16 ldp x0, x1, [sp], #16 - /* And the part of the stack the plt entry handled */ - add sp, sp, #16 + /* Restore frame pointer */ + ldp x29, xzr, [sp], #16 + + /* Restore link register saved by the plt code */ + ldp xzr, x30, [sp], #16 + /* Call into the correct function */ br x16 + .cfi_endproc END(_rtld_bind_start) /* From owner-svn-src-stable-11@freebsd.org Wed Apr 4 02:31:15 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 999FBF87656; Wed, 4 Apr 2018 02:31:15 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4AC0B82F91; Wed, 4 Apr 2018 02:31:15 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 45A40577C; Wed, 4 Apr 2018 02:31:15 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w342VFTP065514; Wed, 4 Apr 2018 02:31:15 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w342VFZX065513; Wed, 4 Apr 2018 02:31:15 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201804040231.w342VFZX065513@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Wed, 4 Apr 2018 02:31:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331974 - stable/11/sys/dev/extres/clk X-SVN-Group: stable-11 X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: stable/11/sys/dev/extres/clk X-SVN-Commit-Revision: 331974 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Apr 2018 02:31:15 -0000 Author: mmel Date: Wed Apr 4 02:31:14 2018 New Revision: 331974 URL: https://svnweb.freebsd.org/changeset/base/331974 Log: MFC r330074: Define meaning of remaining clock rounding flags combinations. Modified: stable/11/sys/dev/extres/clk/clk.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/extres/clk/clk.h ============================================================================== --- stable/11/sys/dev/extres/clk/clk.h Wed Apr 4 02:30:00 2018 (r331973) +++ stable/11/sys/dev/extres/clk/clk.h Wed Apr 4 02:31:14 2018 (r331974) @@ -44,8 +44,12 @@ #define CLK_NODE_CANNOT_STOP 0x00000004 /* Clock cannot be disabled */ /* Flags passed to clk_set_freq() and clknode_set_freq(). */ +#define CLK_SET_ROUND(x) ((x) & (CLK_SET_ROUND_UP | CLK_SET_ROUND_DOWN)) +#define CLK_SET_ROUND_EXACT 0 #define CLK_SET_ROUND_UP 0x00000001 #define CLK_SET_ROUND_DOWN 0x00000002 +#define CLK_SET_ROUND_ANY (CLK_SET_ROUND_UP | CLK_SET_ROUND_DOWN) + #define CLK_SET_USER_MASK 0x0000FFFF #define CLK_SET_DRYRUN 0x00010000 From owner-svn-src-stable-11@freebsd.org Wed Apr 4 05:25:00 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D928F90BDF; Wed, 4 Apr 2018 05:25:00 +0000 (UTC) (envelope-from gordon@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 135DA89CF3; Wed, 4 Apr 2018 05:25:00 +0000 (UTC) (envelope-from gordon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 07A547502; Wed, 4 Apr 2018 05:25:00 +0000 (UTC) (envelope-from gordon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w345OxRa096194; Wed, 4 Apr 2018 05:24:59 GMT (envelope-from gordon@FreeBSD.org) Received: (from gordon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w345OxMx096193; Wed, 4 Apr 2018 05:24:59 GMT (envelope-from gordon@FreeBSD.org) Message-Id: <201804040524.w345OxMx096193@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gordon set sender to gordon@FreeBSD.org using -f From: Gordon Tetlow Date: Wed, 4 Apr 2018 05:24:59 +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: r331982 - stable/11/sys/dev/vt X-SVN-Group: stable-11 X-SVN-Commit-Author: gordon X-SVN-Commit-Paths: stable/11/sys/dev/vt X-SVN-Commit-Revision: 331982 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Apr 2018 05:25:00 -0000 Author: gordon Date: Wed Apr 4 05:24:59 2018 New Revision: 331982 URL: https://svnweb.freebsd.org/changeset/base/331982 Log: MFC r331981: Limit glyph count in vtfont_load to avoid integer overflow. Invalid font data passed to PIO_VFONT can result in an integer overflow in glyphsize. Characters may then be drawn on the console using glyph map entries that point beyond the end of allocated glyph memory, resulting in a kernel memory disclosure. Submitted by: emaste Reported by: Dr. Silvio Cesare of InfoSect Security: CVE-2018-6917 Security: FreeBSD-SA-18:04.vt Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/dev/vt/vt_font.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/vt/vt_font.c ============================================================================== --- stable/11/sys/dev/vt/vt_font.c Wed Apr 4 05:21:46 2018 (r331981) +++ stable/11/sys/dev/vt/vt_font.c Wed Apr 4 05:24:59 2018 (r331982) @@ -42,6 +42,7 @@ static MALLOC_DEFINE(M_VTFONT, "vtfont", "vt font"); /* Some limits to prevent abnormal fonts from being loaded. */ #define VTFONT_MAXMAPPINGS 65536 +#define VTFONT_MAXGLYPHS 131072 #define VTFONT_MAXGLYPHSIZE 2097152 #define VTFONT_MAXDIMENSION 128 @@ -171,7 +172,8 @@ vtfont_load(vfnt_t *f, struct vt_font **ret) /* Make sure the dimensions are valid. */ if (f->width < 1 || f->height < 1) return (EINVAL); - if (f->width > VTFONT_MAXDIMENSION || f->height > VTFONT_MAXDIMENSION) + if (f->width > VTFONT_MAXDIMENSION || f->height > VTFONT_MAXDIMENSION || + f->glyph_count > VTFONT_MAXGLYPHS) return (E2BIG); /* Not too many mappings. */ From owner-svn-src-stable-11@freebsd.org Wed Apr 4 06:11:07 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E8F9F92FFC; Wed, 4 Apr 2018 06:11:07 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 303B48BCDC; Wed, 4 Apr 2018 06:11:07 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2B1AB7BCA; Wed, 4 Apr 2018 06:11:07 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w346B65O054418; Wed, 4 Apr 2018 06:11:07 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w346B6Xq054410; Wed, 4 Apr 2018 06:11:06 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201804040611.w346B6Xq054410@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Wed, 4 Apr 2018 06:11: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: r331988 - in stable/11/sys/arm: arm include X-SVN-Group: stable-11 X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: in stable/11/sys/arm: arm include X-SVN-Commit-Revision: 331988 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Apr 2018 06:11:07 -0000 Author: mmel Date: Wed Apr 4 06:11:05 2018 New Revision: 331988 URL: https://svnweb.freebsd.org/changeset/base/331988 Log: MFC r328467: Implement mitigation for Spectre version 2 attacks on ARMv7. Modified: stable/11/sys/arm/arm/cpuinfo.c stable/11/sys/arm/arm/genassym.c stable/11/sys/arm/arm/machdep.c stable/11/sys/arm/arm/mp_machdep.c stable/11/sys/arm/arm/swtch-v6.S stable/11/sys/arm/arm/trap-v6.c stable/11/sys/arm/include/cpuinfo.h stable/11/sys/arm/include/pcpu.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/arm/cpuinfo.c ============================================================================== --- stable/11/sys/arm/arm/cpuinfo.c Wed Apr 4 05:43:03 2018 (r331987) +++ stable/11/sys/arm/arm/cpuinfo.c Wed Apr 4 06:11:05 2018 (r331988) @@ -31,6 +31,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include @@ -40,6 +42,9 @@ __FBSDID("$FreeBSD$"); #if __ARM_ARCH >= 6 void reinit_mmu(uint32_t ttb, uint32_t aux_clr, uint32_t aux_set); + +int disable_bp_hardening; +int spectre_v2_safe = 1; #endif struct cpuinfo cpuinfo = @@ -253,6 +258,7 @@ cpuinfo_get_actlr_modifier(uint32_t *actlr_mask, uint3 if (cpuinfo.implementer == CPU_IMPLEMENTER_ARM) { switch (cpuinfo.part_number) { + case CPU_ARCH_CORTEX_A75: case CPU_ARCH_CORTEX_A73: case CPU_ARCH_CORTEX_A72: case CPU_ARCH_CORTEX_A57: @@ -335,5 +341,198 @@ cpuinfo_reinit_mmu(uint32_t ttb) actlr_set |= cpu_quirks_actlr_set; reinit_mmu(ttb, actlr_mask, actlr_set); } + +static bool +modify_actlr(uint32_t clear, uint32_t set) +{ + uint32_t reg, newreg; + + reg = cp15_actlr_get(); + newreg = reg; + newreg &= ~clear; + newreg |= set; + if (reg == newreg) + return (true); + cp15_actlr_set(newreg); + + reg = cp15_actlr_get(); + if (reg == newreg) + return (true); + return (false); +} + +/* Apply/restore BP hardening on current core. */ +static int +apply_bp_hardening(bool enable, int kind, bool actrl, uint32_t set_mask) +{ + if (enable) { + if (actrl && !modify_actlr(0, set_mask)) + return (-1); + PCPU_SET(bp_harden_kind, kind); + } else { + PCPU_SET(bp_harden_kind, PCPU_BP_HARDEN_KIND_NONE); + if (actrl) + modify_actlr(~0, PCPU_GET(original_actlr)); + spectre_v2_safe = 0; + } + return (0); +} + +static void +handle_bp_hardening(bool enable) +{ + int kind; + char *kind_str; + + kind = PCPU_BP_HARDEN_KIND_NONE; + /* + * Note: Access to ACTRL is locked to secure world on most boards. + * This means that full BP hardening depends on updated u-boot/firmware + * or is impossible at all (if secure monitor is in on-chip ROM). + */ + if (cpuinfo.implementer == CPU_IMPLEMENTER_ARM) { + switch (cpuinfo.part_number) { + case CPU_ARCH_CORTEX_A8: + /* + * For Cortex-A8, IBE bit must be set otherwise + * BPIALL is effectively NOP. + * Unfortunately, Cortex-A is also affected by + * ARM erratum 687067 which causes non-working + * BPIALL if IBE bit is set and 'Instruction L1 System + * Array Debug Register 0' is not 0. + * This register is not reset on power-up and is + * accessible only from secure world, so we cannot do + * nothing (nor detect) to fix this issue. + * I afraid that on chip ROM based secure monitor on + * AM335x (BeagleBone) doesn't reset this debug + * register. + */ + kind = PCPU_BP_HARDEN_KIND_BPIALL; + if (apply_bp_hardening(enable, kind, true, 1 << 6) != 0) + goto actlr_err; + break; + break; + + case CPU_ARCH_CORTEX_A9: + case CPU_ARCH_CORTEX_A12: + case CPU_ARCH_CORTEX_A17: + case CPU_ARCH_CORTEX_A57: + case CPU_ARCH_CORTEX_A72: + case CPU_ARCH_CORTEX_A73: + case CPU_ARCH_CORTEX_A75: + kind = PCPU_BP_HARDEN_KIND_BPIALL; + if (apply_bp_hardening(enable, kind, false, 0) != 0) + goto actlr_err; + break; + + case CPU_ARCH_CORTEX_A15: + /* + * For Cortex-A15, set 'Enable invalidates of BTB' bit. + * Despite this, the BPIALL is still effectively NOP, + * but with this bit set, the ICIALLU also flushes + * branch predictor as side effect. + */ + kind = PCPU_BP_HARDEN_KIND_ICIALLU; + if (apply_bp_hardening(enable, kind, true, 1 << 0) != 0) + goto actlr_err; + break; + + default: + break; + } + } else if (cpuinfo.implementer == CPU_IMPLEMENTER_QCOM) { + printf("!!!WARNING!!! CPU(%d) is vulnerable to speculative " + "branch attacks. !!!\n" + "Qualcomm Krait cores are known (or believed) to be " + "vulnerable to \n" + "speculative branch attacks, no mitigation exists yet.\n", + PCPU_GET(cpuid)); + goto unkonown_mitigation; + } else { + goto unkonown_mitigation; + } + + if (bootverbose) { + switch (kind) { + case PCPU_BP_HARDEN_KIND_NONE: + kind_str = "not necessary"; + break; + case PCPU_BP_HARDEN_KIND_BPIALL: + kind_str = "BPIALL"; + break; + case PCPU_BP_HARDEN_KIND_ICIALLU: + kind_str = "ICIALLU"; + break; + default: + panic("Unknown BP hardering kind (%d).", kind); + } + printf("CPU(%d) applied BP hardening: %s\n", PCPU_GET(cpuid), + kind_str); + } + + return; + +unkonown_mitigation: + PCPU_SET(bp_harden_kind, PCPU_BP_HARDEN_KIND_NONE); + spectre_v2_safe = 0; + return; + +actlr_err: + PCPU_SET(bp_harden_kind, PCPU_BP_HARDEN_KIND_NONE); + spectre_v2_safe = 0; + printf("!!!WARNING!!! CPU(%d) is vulnerable to speculative branch " + "attacks. !!!\n" + "We cannot enable required bit(s) in ACTRL register\n" + "because it's locked by secure monitor and/or firmware.\n", + PCPU_GET(cpuid)); +} + +void +cpuinfo_init_bp_hardening(void) +{ + + /* + * Store original unmodified ACTRL, so we can restore it when + * BP hardening is disabled by sysctl. + */ + PCPU_SET(original_actlr, cp15_actlr_get()); + handle_bp_hardening(true); +} + +static void +bp_hardening_action(void *arg) +{ + + handle_bp_hardening(disable_bp_hardening == 0); +} + +static int +sysctl_disable_bp_hardening(SYSCTL_HANDLER_ARGS) +{ + int rv; + + rv = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req); + + if (!rv && req->newptr) { + spectre_v2_safe = 1; + dmb(); +#ifdef SMP + smp_rendezvous_cpus(all_cpus, smp_no_rendezvous_barrier, + bp_hardening_action, NULL, NULL); +#else + bp_hardening_action(NULL); +#endif + } + + return (rv); +} + +SYSCTL_PROC(_machdep, OID_AUTO, disable_bp_hardening, + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, + &disable_bp_hardening, 0, sysctl_disable_bp_hardening, "I", + "Disable BP hardening mitigation."); + +SYSCTL_INT(_machdep, OID_AUTO, spectre_v2_safe, CTLFLAG_RD, + &spectre_v2_safe, 0, "System is safe to Spectre Version 2 attacks"); #endif /* __ARM_ARCH >= 6 */ Modified: stable/11/sys/arm/arm/genassym.c ============================================================================== --- stable/11/sys/arm/arm/genassym.c Wed Apr 4 05:43:03 2018 (r331987) +++ stable/11/sys/arm/arm/genassym.c Wed Apr 4 06:11:05 2018 (r331988) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -134,6 +135,10 @@ ASSYM(PCB_VFPSTATE, offsetof(struct pcb, pcb_vfpstate) #if __ARM_ARCH >= 6 ASSYM(PC_CURPMAP, offsetof(struct pcpu, pc_curpmap)); +ASSYM(PC_BP_HARDEN_KIND, offsetof(struct pcpu, pc_bp_harden_kind)); +ASSYM(PCPU_BP_HARDEN_KIND_NONE, PCPU_BP_HARDEN_KIND_NONE); +ASSYM(PCPU_BP_HARDEN_KIND_BPIALL, PCPU_BP_HARDEN_KIND_BPIALL); +ASSYM(PCPU_BP_HARDEN_KIND_ICIALLU, PCPU_BP_HARDEN_KIND_ICIALLU); #endif ASSYM(PAGE_SIZE, PAGE_SIZE); Modified: stable/11/sys/arm/arm/machdep.c ============================================================================== --- stable/11/sys/arm/arm/machdep.c Wed Apr 4 05:43:03 2018 (r331987) +++ stable/11/sys/arm/arm/machdep.c Wed Apr 4 06:11:05 2018 (r331988) @@ -1260,6 +1260,8 @@ initarm(struct arm_boot_params *abp) msgbufinit(msgbufp, msgbufsize); dbg_monitor_init(); arm_kdb_init(); + /* Apply possible BP hardening. */ + cpuinfo_init_bp_hardening(); return ((void *)STACKALIGN(thread0.td_pcb)); } Modified: stable/11/sys/arm/arm/mp_machdep.c ============================================================================== --- stable/11/sys/arm/arm/mp_machdep.c Wed Apr 4 05:43:03 2018 (r331987) +++ stable/11/sys/arm/arm/mp_machdep.c Wed Apr 4 06:11:05 2018 (r331988) @@ -200,6 +200,9 @@ init_secondary(int cpu) /* Configure the interrupt controller */ intr_pic_init_secondary(); + /* Apply possible BP hardening */ + cpuinfo_init_bp_hardening(); + mtx_lock_spin(&ap_boot_mtx); atomic_add_rel_32(&smp_cpus, 1); Modified: stable/11/sys/arm/arm/swtch-v6.S ============================================================================== --- stable/11/sys/arm/arm/swtch-v6.S Wed Apr 4 05:43:03 2018 (r331987) +++ stable/11/sys/arm/arm/swtch-v6.S Wed Apr 4 06:11:05 2018 (r331988) @@ -145,7 +145,16 @@ ENTRY(cpu_context_switch) * predictors and Requirements for branch predictor maintenance * operations sections. */ - mcr CP15_BPIALL /* flush entire Branch Target Cache */ + /* + * Additionally, to mitigate mistrained branch predictor attack + * we must invalidate it on affected CPUs. Unfortunately, BPIALL + * is effectively NOP on Cortex-A15 so it needs special treatment. + */ + ldr r0, [r8, #PC_BP_HARDEN_KIND] + cmp r0, #PCPU_BP_HARDEN_KIND_ICIALLU + mcrne CP15_BPIALL /* Flush entire Branch Target Cache */ + mcreq CP15_ICIALLU /* This is the only way how to flush */ + /* Branch Target Cache on Cortex-A15. */ DSB mov pc, lr END(cpu_context_switch) Modified: stable/11/sys/arm/arm/trap-v6.c ============================================================================== --- stable/11/sys/arm/arm/trap-v6.c Wed Apr 4 05:43:03 2018 (r331987) +++ stable/11/sys/arm/arm/trap-v6.c Wed Apr 4 06:11:05 2018 (r331988) @@ -287,6 +287,7 @@ abort_handler(struct trapframe *tf, int prefetch) struct vmspace *vm; vm_prot_t ftype; bool usermode; + int bp_harden; #ifdef INVARIANTS void *onfault; #endif @@ -303,6 +304,20 @@ abort_handler(struct trapframe *tf, int prefetch) idx = FSR_TO_FAULT(fsr); usermode = TRAPF_USERMODE(tf); /* Abort came from user mode? */ + + /* + * Apply BP hardening by flushing the branch prediction cache + * for prefaults on kernel addresses. + */ + if (__predict_false(prefetch && far > VM_MAXUSER_ADDRESS && + (idx == FAULT_TRAN_L2 || idx == FAULT_PERM_L2))) { + bp_harden = PCPU_GET(bp_harden_kind); + if (bp_harden == PCPU_BP_HARDEN_KIND_BPIALL) + _CP15_BPIALL(); + else if (bp_harden == PCPU_BP_HARDEN_KIND_ICIALLU) + _CP15_ICIALLU(); + } + if (usermode) td->td_frame = tf; Modified: stable/11/sys/arm/include/cpuinfo.h ============================================================================== --- stable/11/sys/arm/include/cpuinfo.h Wed Apr 4 05:43:03 2018 (r331987) +++ stable/11/sys/arm/include/cpuinfo.h Wed Apr 4 06:11:05 2018 (r331988) @@ -49,6 +49,7 @@ #define CPU_ARCH_CORTEX_A57 0xD07 #define CPU_ARCH_CORTEX_A72 0xD08 #define CPU_ARCH_CORTEX_A73 0xD09 +#define CPU_ARCH_CORTEX_A75 0xD0A /* QCOM */ @@ -122,6 +123,7 @@ extern struct cpuinfo cpuinfo; void cpuinfo_init(void); #if __ARM_ARCH >= 6 +void cpuinfo_init_bp_hardening(void); void cpuinfo_reinit_mmu(uint32_t ttb); #endif #endif /* _MACHINE_CPUINFO_H_ */ Modified: stable/11/sys/arm/include/pcpu.h ============================================================================== --- stable/11/sys/arm/include/pcpu.h Wed Apr 4 05:43:03 2018 (r331987) +++ stable/11/sys/arm/include/pcpu.h Wed Apr 4 06:11:05 2018 (r331988) @@ -42,6 +42,10 @@ struct vmspace; #endif /* _KERNEL */ #if __ARM_ARCH >= 6 +/* Branch predictor hardening method */ +#define PCPU_BP_HARDEN_KIND_NONE 0 +#define PCPU_BP_HARDEN_KIND_BPIALL 1 +#define PCPU_BP_HARDEN_KIND_ICIALLU 2 #define PCPU_MD_FIELDS \ unsigned int pc_vfpsid; \ @@ -57,7 +61,9 @@ struct vmspace; void *pc_qmap_pte2p; \ unsigned int pc_dbreg[32]; \ int pc_dbreg_cmd; \ - char __pad[19] + int pc_bp_harden_kind; \ + uint32_t pc_original_actlr; \ + char __pad[11] #else #define PCPU_MD_FIELDS \ char __pad[157] From owner-svn-src-stable-11@freebsd.org Wed Apr 4 06:30:07 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E332CF940F6; Wed, 4 Apr 2018 06:30:06 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 954CF8CA1D; Wed, 4 Apr 2018 06:30:06 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 8DA5E17B38; Wed, 4 Apr 2018 06:30:06 +0000 (UTC) Date: Wed, 4 Apr 2018 06:30:06 +0000 From: Alexey Dokuchaev To: Michal Meloun Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: Re: svn commit: r331988 - in stable/11/sys/arm: arm include Message-ID: <20180404063006.GA11981@FreeBSD.org> References: <201804040611.w346B6Xq054410@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201804040611.w346B6Xq054410@repo.freebsd.org> User-Agent: Mutt/1.9.2 (2017-12-15) X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Apr 2018 06:30:07 -0000 On Wed, Apr 04, 2018 at 06:11:06AM +0000, Michal Meloun wrote: > New Revision: 331988 > URL: https://svnweb.freebsd.org/changeset/base/331988 > > Log: > MFC r328467: > > Implement mitigation for Spectre version 2 attacks on ARMv7. > > + case CPU_ARCH_CORTEX_A8: > + /* > + * For Cortex-A8, IBE bit must be set otherwise > + * BPIALL is effectively NOP. > + * Unfortunately, Cortex-A is also affected by > + * ARM erratum 687067 which causes non-working > + * BPIALL if IBE bit is set and 'Instruction L1 System > + * Array Debug Register 0' is not 0. > + * This register is not reset on power-up and is > + * accessible only from secure world, so we cannot do > + * nothing (nor detect) to fix this issue. > + * I afraid that on chip ROM based secure monitor on "I'm afraid", perhaps? > + printf("!!!WARNING!!! CPU(%d) is vulnerable to speculative " > + "branch attacks. !!!\n" > + "Qualcomm Krait cores are known (or believed) to be " > + "vulnerable to \n" > + "speculative branch attacks, no mitigation exists yet.\n", > + PCPU_GET(cpuid)); > + goto unkonown_mitigation; > + } else { > + goto unkonown_mitigation; unkonown? :-) ./danfe From owner-svn-src-stable-11@freebsd.org Wed Apr 4 08:37:24 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B1609F9E13E; Wed, 4 Apr 2018 08:37:24 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 66DF46C120; Wed, 4 Apr 2018 08:37:24 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 617EA11485; Wed, 4 Apr 2018 08:37:24 +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 w348bOOS032507; Wed, 4 Apr 2018 08:37:24 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w348bOeZ032506; Wed, 4 Apr 2018 08:37:24 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201804040837.w348bOeZ032506@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 4 Apr 2018 08:37:24 +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: r331993 - stable/11/sys/dev/usb/input X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/usb/input X-SVN-Commit-Revision: 331993 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Apr 2018 08:37:24 -0000 Author: hselasky Date: Wed Apr 4 08:37:24 2018 New Revision: 331993 URL: https://svnweb.freebsd.org/changeset/base/331993 Log: MFC r331642: Add support for right and middle click with integrated button to WSP USB trackpad driver. Submitted by: James Wright PR: 226961 Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/usb/input/wsp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/input/wsp.c ============================================================================== --- stable/11/sys/dev/usb/input/wsp.c Wed Apr 4 08:09:25 2018 (r331992) +++ stable/11/sys/dev/usb/input/wsp.c Wed Apr 4 08:37:24 2018 (r331993) @@ -927,7 +927,12 @@ wsp_intr_callback(struct usb_xfer *xfer, usb_error_t e sc->sc_status.button = 0; if (ibt != 0) { - sc->sc_status.button |= MOUSE_BUTTON1DOWN; + if ((params->caps & HAS_INTEGRATED_BUTTON) && ntouch == 2) + sc->sc_status.button |= MOUSE_BUTTON3DOWN; + else if ((params->caps & HAS_INTEGRATED_BUTTON) && ntouch == 3) + sc->sc_status.button |= MOUSE_BUTTON2DOWN; + else + sc->sc_status.button |= MOUSE_BUTTON1DOWN; sc->ibtn = 1; } sc->intr_count++; From owner-svn-src-stable-11@freebsd.org Wed Apr 4 08:40:00 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5036BF9E347; Wed, 4 Apr 2018 08:40:00 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EB8366C3C2; Wed, 4 Apr 2018 08:39:59 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DDCC711489; Wed, 4 Apr 2018 08:39:59 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w348dxjG034565; Wed, 4 Apr 2018 08:39:59 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w348dxt1034562; Wed, 4 Apr 2018 08:39:59 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201804040839.w348dxt1034562@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 4 Apr 2018 08:39:59 +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: r331994 - stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 331994 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Apr 2018 08:40:00 -0000 Author: hselasky Date: Wed Apr 4 08:39:59 2018 New Revision: 331994 URL: https://svnweb.freebsd.org/changeset/base/331994 Log: MFC r331694: Swap two instances of regular macros with function macros in the LinuxKPI, to narrow down the substitution scope. Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/pci.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/pci.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/pci.h Wed Apr 4 08:37:24 2018 (r331993) +++ stable/11/sys/compat/linuxkpi/common/include/linux/pci.h Wed Apr 4 08:39:59 2018 (r331994) @@ -538,7 +538,9 @@ struct msix_entry { * NB: define added to prevent this definition of pci_enable_msix from * clashing with the native FreeBSD version. */ -#define pci_enable_msix linux_pci_enable_msix +#define pci_enable_msix(...) \ + linux_pci_enable_msix(__VA_ARGS__) + static inline int pci_enable_msix(struct pci_dev *pdev, struct msix_entry *entries, int nreq) { @@ -572,7 +574,9 @@ pci_enable_msix(struct pci_dev *pdev, struct msix_entr return (0); } -#define pci_enable_msix_range linux_pci_enable_msix_range +#define pci_enable_msix_range(...) \ + linux_pci_enable_msix_range(__VA_ARGS__) + static inline int pci_enable_msix_range(struct pci_dev *dev, struct msix_entry *entries, int minvec, int maxvec) From owner-svn-src-stable-11@freebsd.org Wed Apr 4 08:41:12 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E15DDF9E658; Wed, 4 Apr 2018 08:41:11 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 92D8F6C7FE; Wed, 4 Apr 2018 08:41:11 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8DAE5114D7; Wed, 4 Apr 2018 08:41:11 +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 w348fBbb037045; Wed, 4 Apr 2018 08:41:11 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w348fArw037034; Wed, 4 Apr 2018 08:41:10 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201804040841.w348fArw037034@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 4 Apr 2018 08:41: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: r331996 - in stable/11/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/compat/linuxkpi/common: include/linux src X-SVN-Commit-Revision: 331996 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Apr 2018 08:41:12 -0000 Author: hselasky Date: Wed Apr 4 08:41:10 2018 New Revision: 331996 URL: https://svnweb.freebsd.org/changeset/base/331996 Log: MFC r331828: Optimise use of Giant in the LinuxKPI. - Make sure Giant is locked when calling PCI device methods. Newbus currently requires this. - Avoid unlocking Giant right before aquiring the sleepqueue lock. This can save a task switch. Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/module.h stable/11/sys/compat/linuxkpi/common/src/linux_compat.c stable/11/sys/compat/linuxkpi/common/src/linux_pci.c stable/11/sys/compat/linuxkpi/common/src/linux_rcu.c stable/11/sys/compat/linuxkpi/common/src/linux_schedule.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/module.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/module.h Wed Apr 4 08:40:49 2018 (r331995) +++ stable/11/sys/compat/linuxkpi/common/include/linux/module.h Wed Apr 4 08:41:10 2018 (r331996) @@ -78,9 +78,7 @@ _module_run(void *arg) printf("Running %s (%p)\n", name, pc); #endif fn = arg; - DROP_GIANT(); fn(); - PICKUP_GIANT(); } #define module_init(fn) \ Modified: stable/11/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- stable/11/sys/compat/linuxkpi/common/src/linux_compat.c Wed Apr 4 08:40:49 2018 (r331995) +++ stable/11/sys/compat/linuxkpi/common/src/linux_compat.c Wed Apr 4 08:41:10 2018 (r331996) @@ -1804,8 +1804,6 @@ linux_wait_for_common(struct completion *c, int flags) if (SCHEDULER_STOPPED()) return (0); - DROP_GIANT(); - task = current; if (flags != 0) @@ -1819,22 +1817,25 @@ linux_wait_for_common(struct completion *c, int flags) break; sleepq_add(c, NULL, "completion", flags, 0); if (flags & SLEEPQ_INTERRUPTIBLE) { + DROP_GIANT(); error = -sleepq_wait_sig(c, 0); + PICKUP_GIANT(); if (error != 0) { linux_schedule_save_interrupt_value(task, error); error = -ERESTARTSYS; goto intr; } - } else + } else { + DROP_GIANT(); sleepq_wait(c, 0); + PICKUP_GIANT(); + } } if (c->done != UINT_MAX) c->done--; sleepq_release(c); intr: - PICKUP_GIANT(); - return (error); } @@ -1851,8 +1852,6 @@ linux_wait_for_timeout_common(struct completion *c, in if (SCHEDULER_STOPPED()) return (0); - DROP_GIANT(); - task = current; if (flags != 0) @@ -1866,10 +1865,14 @@ linux_wait_for_timeout_common(struct completion *c, in break; sleepq_add(c, NULL, "completion", flags, 0); sleepq_set_timeout(c, linux_timer_jiffies_until(end)); + + DROP_GIANT(); if (flags & SLEEPQ_INTERRUPTIBLE) error = -sleepq_timedwait_sig(c, 0); else error = -sleepq_timedwait(c, 0); + PICKUP_GIANT(); + if (error != 0) { /* check for timeout */ if (error == -EWOULDBLOCK) { @@ -1889,8 +1892,6 @@ linux_wait_for_timeout_common(struct completion *c, in /* return how many jiffies are left */ error = linux_timer_jiffies_until(end); done: - PICKUP_GIANT(); - return (error); } Modified: stable/11/sys/compat/linuxkpi/common/src/linux_pci.c ============================================================================== --- stable/11/sys/compat/linuxkpi/common/src/linux_pci.c Wed Apr 4 08:40:49 2018 (r331995) +++ stable/11/sys/compat/linuxkpi/common/src/linux_pci.c Wed Apr 4 08:41:10 2018 (r331996) @@ -171,12 +171,11 @@ linux_pci_attach(device_t dev) pdev->bus = pbus; } - DROP_GIANT(); spin_lock(&pci_lock); list_add(&pdev->links, &pci_devices); spin_unlock(&pci_lock); + error = pdrv->probe(pdev, id); - PICKUP_GIANT(); if (error) { spin_lock(&pci_lock); list_del(&pdev->links); @@ -194,9 +193,9 @@ linux_pci_detach(device_t dev) linux_set_current(curthread); pdev = device_get_softc(dev); - DROP_GIANT(); + pdev->pdrv->remove(pdev); - PICKUP_GIANT(); + spin_lock(&pci_lock); list_del(&pdev->links); spin_unlock(&pci_lock); @@ -258,11 +257,8 @@ linux_pci_shutdown(device_t dev) linux_set_current(curthread); pdev = device_get_softc(dev); - if (pdev->pdrv->shutdown != NULL) { - DROP_GIANT(); + if (pdev->pdrv->shutdown != NULL) pdev->pdrv->shutdown(pdev); - PICKUP_GIANT(); - } return (0); } Modified: stable/11/sys/compat/linuxkpi/common/src/linux_rcu.c ============================================================================== --- stable/11/sys/compat/linuxkpi/common/src/linux_rcu.c Wed Apr 4 08:40:49 2018 (r331995) +++ stable/11/sys/compat/linuxkpi/common/src/linux_rcu.c Wed Apr 4 08:41:10 2018 (r331996) @@ -297,13 +297,13 @@ linux_synchronize_rcu(void) td = curthread; - DROP_GIANT(); - /* * Synchronizing RCU might change the CPU core this function * is running on. Save current values: */ thread_lock(td); + + DROP_GIANT(); old_cpu = PCPU_GET(cpuid); old_pinned = td->td_pinned; Modified: stable/11/sys/compat/linuxkpi/common/src/linux_schedule.c ============================================================================== --- stable/11/sys/compat/linuxkpi/common/src/linux_schedule.c Wed Apr 4 08:40:49 2018 (r331995) +++ stable/11/sys/compat/linuxkpi/common/src/linux_schedule.c Wed Apr 4 08:41:10 2018 (r331996) @@ -55,6 +55,8 @@ linux_add_to_sleepqueue(void *wchan, struct task_struc sleepq_add(wchan, NULL, wmesg, flags, 0); if (timeout != 0) sleepq_set_timeout(wchan, timeout); + + DROP_GIANT(); if ((state & TASK_INTERRUPTIBLE) != 0) { if (timeout == 0) ret = -sleepq_wait_sig(wchan, 0); @@ -67,6 +69,8 @@ linux_add_to_sleepqueue(void *wchan, struct task_struc } else ret = -sleepq_timedwait(wchan, 0); } + PICKUP_GIANT(); + /* filter return value */ if (ret != 0 && ret != -EWOULDBLOCK) { linux_schedule_save_interrupt_value(task, ret); @@ -248,8 +252,6 @@ linux_wait_event_common(wait_queue_head_t *wqh, wait_q if (lock != NULL) spin_unlock_irq(lock); - DROP_GIANT(); - /* range check timeout */ if (timeout < 1) timeout = 1; @@ -272,8 +274,6 @@ linux_wait_event_common(wait_queue_head_t *wqh, wait_q } PRELE(task->task_thread->td_proc); - PICKUP_GIANT(); - if (lock != NULL) spin_lock_irq(lock); return (ret); @@ -297,8 +297,6 @@ linux_schedule_timeout(int timeout) remainder = ticks + timeout; - DROP_GIANT(); - sleepq_lock(task); state = atomic_read(&task->state); if (state != TASK_WAKING) { @@ -309,8 +307,6 @@ linux_schedule_timeout(int timeout) } set_task_state(task, TASK_RUNNING); - PICKUP_GIANT(); - if (timeout == 0) return (MAX_SCHEDULE_TIMEOUT); @@ -356,8 +352,6 @@ linux_wait_on_bit_timeout(unsigned long *word, int bit void *wchan; int ret; - DROP_GIANT(); - /* range check timeout */ if (timeout < 1) timeout = 1; @@ -380,8 +374,6 @@ linux_wait_on_bit_timeout(unsigned long *word, int bit } set_task_state(task, TASK_RUNNING); - PICKUP_GIANT(); - return (ret); } @@ -399,8 +391,6 @@ linux_wait_on_atomic_t(atomic_t *a, unsigned int state void *wchan; int ret; - DROP_GIANT(); - task = current; wchan = a; for (;;) { @@ -416,8 +406,6 @@ linux_wait_on_atomic_t(atomic_t *a, unsigned int state break; } set_task_state(task, TASK_RUNNING); - - PICKUP_GIANT(); return (ret); } From owner-svn-src-stable-11@freebsd.org Wed Apr 4 11:30:21 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34BE9F85F9A; Wed, 4 Apr 2018 11:30:21 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DA15374538; Wed, 4 Apr 2018 11:30:20 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BA5DD130BF; Wed, 4 Apr 2018 11:30:20 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w34BUK6i038110; Wed, 4 Apr 2018 11:30:20 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w34BUKGk038103; Wed, 4 Apr 2018 11:30:20 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201804041130.w34BUKGk038103@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Wed, 4 Apr 2018 11:30:20 +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: r332010 - in stable/11/sys: arm/conf arm/nvidia arm/nvidia/drm2 arm/nvidia/tegra124 boot/fdt/dts/arm contrib/dev/nvidia gnu/dts/arm gnu/dts/include/dt-bindings/clock gnu/dts/include/dt-... X-SVN-Group: stable-11 X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: in stable/11/sys: arm/conf arm/nvidia arm/nvidia/drm2 arm/nvidia/tegra124 boot/fdt/dts/arm contrib/dev/nvidia gnu/dts/arm gnu/dts/include/dt-bindings/clock gnu/dts/include/dt-bindings/gpio gnu/dts/inc... X-SVN-Commit-Revision: 332010 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Apr 2018 11:30:21 -0000 Author: mmel Date: Wed Apr 4 11:30:20 2018 New Revision: 332010 URL: https://svnweb.freebsd.org/changeset/base/332010 Log: MFC (cherry pick)r306197,r306327,r306328,r308390,r308391,r310600,r314703: cherry pick from r306197: Nvidia Tegra 124 and Jetson TK1 related DTS. r306327: Update AHCI driver to match new dts tree r306328: Update PCI driver to match new dts tree r308390: Rework NVIDIA Tegra124 XUSBPAD driver. - Adapt it for new, incompatible, DT bindings introduced by r306197. - Add support for USB super speed pads/ports. r308391: Add NVIDIA Tegra XHCI driver and coresponding firmware blob. r310600: Implement drivers for NVIDIA tegra124 display controller, HDMI source and host1x module. Unfortunately, tegra124 SoC doesn't have 2D acceleration engine and 3D requires not yet started nouveau driver. r314703: Add support for card detect and write protect gpio pins to Tegra SDHCI. Added: stable/11/sys/arm/nvidia/drm2/ - copied from r310600, head/sys/arm/nvidia/drm2/ stable/11/sys/arm/nvidia/tegra_xhci.c - copied unchanged from r308391, head/sys/arm/nvidia/tegra_xhci.c stable/11/sys/contrib/dev/nvidia/ - copied from r308391, head/sys/contrib/dev/nvidia/ Modified: stable/11/sys/arm/conf/TEGRA124 stable/11/sys/arm/nvidia/tegra124/files.tegra124 stable/11/sys/arm/nvidia/tegra124/tegra124_xusbpadctl.c stable/11/sys/arm/nvidia/tegra_ahci.c stable/11/sys/arm/nvidia/tegra_pcie.c stable/11/sys/arm/nvidia/tegra_sdhci.c stable/11/sys/boot/fdt/dts/arm/tegra124-jetson-tk1-fbsd.dts stable/11/sys/gnu/dts/arm/tegra124-jetson-tk1-emc.dtsi (contents, props changed) stable/11/sys/gnu/dts/arm/tegra124-jetson-tk1.dts stable/11/sys/gnu/dts/arm/tegra124.dtsi stable/11/sys/gnu/dts/include/dt-bindings/clock/tegra124-car-common.h stable/11/sys/gnu/dts/include/dt-bindings/clock/tegra124-car.h stable/11/sys/gnu/dts/include/dt-bindings/gpio/tegra-gpio.h stable/11/sys/gnu/dts/include/dt-bindings/memory/tegra124-mc.h stable/11/sys/gnu/dts/include/dt-bindings/pinctrl/pinctrl-tegra-xusb.h stable/11/sys/gnu/dts/include/dt-bindings/reset/tegra124-car.h (contents, props changed) stable/11/sys/gnu/dts/include/dt-bindings/thermal/tegra124-soctherm.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/conf/TEGRA124 ============================================================================== --- stable/11/sys/arm/conf/TEGRA124 Wed Apr 4 11:14:27 2018 (r332009) +++ stable/11/sys/arm/conf/TEGRA124 Wed Apr 4 11:30:20 2018 (r332010) @@ -50,7 +50,7 @@ device vlan # 802.1Q VLAN support #device tun # Packet tunnel. device md # Memory "disks" #device gif # IPv6 and IPv4 tunneling -#device firmware # firmware assist module +device firmware # firmware assist module device ether # Ethernet support device miibus # Required for ethernet device bpf # Berkeley packet filter (required for DHCP) @@ -86,6 +86,8 @@ device pass # Passthrough device (direct ATA/SCSI a # USB support options USB_HOST_ALIGN=64 # Align usb buffers to cache line size. device ehci # EHCI USB interface +device xhci # XHCI USB interface +device tegra124_xusb_fw # Tegra XUSB firmware device usb # USB Bus (required) device umass # Disks/Mass storage - Requires scbus and da device uhid # "Human Interface Devices" @@ -121,11 +123,10 @@ device pci device re # RealTek 8139C+/8169/8169S/8110S # DRM2 -#device fbd -#device vt -#device splash -#device kbdmux -#device drm2 +device fbd +device vt +device kbdmux +device drm2 # Sound #device sound Modified: stable/11/sys/arm/nvidia/tegra124/files.tegra124 ============================================================================== --- stable/11/sys/arm/nvidia/tegra124/files.tegra124 Wed Apr 4 11:14:27 2018 (r332009) +++ stable/11/sys/arm/nvidia/tegra124/files.tegra124 Wed Apr 4 11:30:20 2018 (r332010) @@ -24,6 +24,7 @@ arm/nvidia/tegra_uart.c optional uart arm/nvidia/tegra_sdhci.c optional sdhci arm/nvidia/tegra_gpio.c optional gpio arm/nvidia/tegra_ehci.c optional ehci +arm/nvidia/tegra_xhci.c optional xhci arm/nvidia/tegra_ahci.c optional ahci arm/nvidia/tegra_pcie.c optional pci arm/nvidia/tegra_i2c.c optional iic @@ -35,21 +36,35 @@ arm/nvidia/tegra_soctherm.c standard arm/nvidia/tegra_lic.c standard arm/nvidia/tegra_mc.c standard #arm/nvidia/tegra_hda.c optional snd_hda -#arm/nvidia/drm2/hdmi.c optional drm2 -#arm/nvidia/drm2/tegra_drm_if.m optional drm2 -#arm/nvidia/drm2/tegra_drm_subr.c optional drm2 -#arm/nvidia/drm2/tegra_host1x.c optional drm2 -#arm/nvidia/drm2/tegra_hdmi.c optional drm2 -#arm/nvidia/drm2/tegra_dc_if.m optional drm2 -#arm/nvidia/drm2/tegra_dc.c optional drm2 -#arm/nvidia/drm2/tegra_fb.c optional drm2 -#arm/nvidia/drm2/tegra_bo.c optional drm2 +arm/nvidia/drm2/hdmi.c optional drm2 +arm/nvidia/drm2/tegra_drm_if.m optional drm2 +arm/nvidia/drm2/tegra_drm_subr.c optional drm2 +arm/nvidia/drm2/tegra_host1x.c optional drm2 +arm/nvidia/drm2/tegra_hdmi.c optional drm2 +arm/nvidia/drm2/tegra_dc_if.m optional drm2 +arm/nvidia/drm2/tegra_dc.c optional drm2 +arm/nvidia/drm2/tegra_fb.c optional drm2 +arm/nvidia/drm2/tegra_bo.c optional drm2 # -# Optional devices. +# Firmware # - +tegra124_xusb_fw.c optional tegra124_xusb_fw \ + dependency "$S/arm/nvidia/tegra124/files.tegra124" \ + compile-with "${AWK} -f $S/tools/fw_stub.awk tegra124_xusb.fw:tegra124_xusb_fw -mtegra124_xusb_fw -c${.TARGET}" \ + no-implicit-rule before-depend local \ + clean "tegra124_xusb_fw.c" +tegra124_xusb.fwo optional tegra124_xusb_fw \ + dependency "tegra124_xusb.fw" \ + compile-with "${NORMAL_FWO}" \ + no-implicit-rule \ + clean "tegra124_xusb.fwo" +tegra124_xusb.fw optional tegra124_xusb_fw \ + dependency "$S/contrib/dev/nvidia/tegra124_xusb.bin.uu" \ + compile-with "${NORMAL_FW}" \ + no-obj no-implicit-rule \ + clean "tegra124_xusb.fw" # -# Temporary/ to be moved stuff +# Temporary/to be moved stuff # arm/nvidia/as3722.c optional iic arm/nvidia/as3722_regulators.c optional iic Modified: stable/11/sys/arm/nvidia/tegra124/tegra124_xusbpadctl.c ============================================================================== --- stable/11/sys/arm/nvidia/tegra124/tegra124_xusbpadctl.c Wed Apr 4 11:14:27 2018 (r332009) +++ stable/11/sys/arm/nvidia/tegra124/tegra124_xusbpadctl.c Wed Apr 4 11:30:20 2018 (r332010) @@ -39,26 +39,57 @@ #include #include +#include #include #include #include #include #include +#include + #include #include "phy_if.h" +/* FUSE calibration data. */ +#define FUSE_XUSB_CALIB 0x0F0 +#define FUSE_XUSB_CALIB_HS_CURR_LEVEL_123(x) (((x) >> 15) & 0x3F); +#define FUSE_XUSB_CALIB_HS_IREF_CAP(x) (((x) >> 13) & 0x03); +#define FUSE_XUSB_CALIB_HS_SQUELCH_LEVEL(x) (((x) >> 11) & 0x03); +#define FUSE_XUSB_CALIB_HS_TERM_RANGE_ADJ(x) (((x) >> 7) & 0x0F); +#define FUSE_XUSB_CALIB_HS_CURR_LEVEL_0(x) (((x) >> 0) & 0x3F); + + +/* Registers. */ #define XUSB_PADCTL_USB2_PAD_MUX 0x004 +#define XUSB_PADCTL_USB2_PORT_CAP 0x008 +#define USB2_PORT_CAP_ULPI_PORT_INTERNAL (1 << 25) +#define USB2_PORT_CAP_ULPI_PORT_CAP (1 << 24) +#define USB2_PORT_CAP_PORT_REVERSE_ID(p) (1 << (3 + (p) * 4)) +#define USB2_PORT_CAP_PORT_INTERNAL(p) (1 << (2 + (p) * 4)) +#define USB2_PORT_CAP_PORT_CAP(p, x) (((x) & 3) << ((p) * 4)) +#define USB2_PORT_CAP_PORT_CAP_OTG 0x3 +#define USB2_PORT_CAP_PORT_CAP_DEVICE 0x2 +#define USB2_PORT_CAP_PORT_CAP_HOST 0x1 +#define USB2_PORT_CAP_PORT_CAP_DISABLED 0x0 + +#define XUSB_PADCTL_SS_PORT_MAP 0x014 +#define SS_PORT_MAP_PORT_INTERNAL(p) (1 << (3 + (p) * 4)) +#define SS_PORT_MAP_PORT_MAP(p, x) (((x) & 7) << ((p) * 4)) + #define XUSB_PADCTL_ELPG_PROGRAM 0x01C #define ELPG_PROGRAM_AUX_MUX_LP0_VCORE_DOWN (1 << 26) #define ELPG_PROGRAM_AUX_MUX_LP0_CLAMP_EN_EARLY (1 << 25) #define ELPG_PROGRAM_AUX_MUX_LP0_CLAMP_EN (1 << 24) +#define ELPG_PROGRAM_SSP_ELPG_VCORE_DOWN(x) (1 << (18 + (x) * 4)) +#define ELPG_PROGRAM_SSP_ELPG_CLAMP_EN_EARLY(x) (1 << (17 + (x) * 4)) +#define ELPG_PROGRAM_SSP_ELPG_CLAMP_EN(x) (1 << (16 + (x) * 4)) #define XUSB_PADCTL_IOPHY_PLL_P0_CTL1 0x040 #define IOPHY_PLL_P0_CTL1_PLL0_LOCKDET (1 << 19) -#define IOPHY_PLL_P0_CTL1_REFCLK_SEL_MASK (0xf<< 12) +#define IOPHY_PLL_P0_CTL1_REFCLK_SEL(x) (((x) & 0xF) << 12) #define IOPHY_PLL_P0_CTL1_PLL_RST (1 << 1) #define XUSB_PADCTL_IOPHY_PLL_P0_CTL2 0x044 @@ -66,9 +97,60 @@ #define IOPHY_PLL_P0_CTL2_TXCLKREF_EN (1 << 5) #define IOPHY_PLL_P0_CTL2_TXCLKREF_SEL (1 << 4) +#define XUSB_PADCTL_IOPHY_USB3_PAD_CTL2(x) (0x058 + (x) * 4) +#define IOPHY_USB3_PAD_CTL2_CDR_CNTL(x) (((x) & 0x00FF) << 4) +#define IOPHY_USB3_PAD_CTL2_RX_EQ(x) (((x) & 0xFFFF) << 8) +#define IOPHY_USB3_PAD_CTL2_RX_WANDER(x) (((x) & 0x000F) << 4) +#define IOPHY_USB3_PAD_CTL2_RX_TERM_CNTL(x) (((x) & 0x0003) << 2) +#define IOPHY_USB3_PAD_CTL2_TX_TERM_CNTL(x) (((x) & 0x0003) << 0) + +#define XUSB_PADCTL_IOPHY_USB3_PAD_CTL4(x) (0x068 + (x) * 4) + +#define XUSB_PADCTL_USB2_OTG_PAD_CTL0(x) (0x0A0 + (x) * 4) +#define USB2_OTG_PAD_CTL0_LSBIAS_SEL (1 << 23) +#define USB2_OTG_PAD_CTL0_DISCON_DETECT_METHOD (1 << 22) +#define USB2_OTG_PAD_CTL0_PD_ZI (1 << 21) +#define USB2_OTG_PAD_CTL0_PD2 (1 << 20) +#define USB2_OTG_PAD_CTL0_PD (1 << 19) +#define USB2_OTG_PAD_CTL0_TERM_EN (1 << 18) +#define USB2_OTG_PAD_CTL0_LS_LS_FSLEW(x) (((x) & 0x03) << 16) +#define USB2_OTG_PAD_CTL0_LS_RSLEW(x) (((x) & 0x03) << 14) +#define USB2_OTG_PAD_CTL0_FS_SLEW(x) (((x) & 0x03) << 12) +#define USB2_OTG_PAD_CTL0_HS_SLEW(x) (((x) & 0x3F) << 6) +#define USB2_OTG_PAD_CTL0_HS_CURR_LEVEL(x) (((x) & 0x3F) << 0) + +#define XUSB_PADCTL_USB2_OTG_PAD_CTL1(x) (0x0AC + (x) * 4) +#define USB2_OTG_PAD_CTL1_RPU_RANGE_ADJ(x) (((x) & 0x3) << 11) +#define USB2_OTG_PAD_CTL1_HS_IREF_CAP(x) (((x) & 0x3) << 9) +#define USB2_OTG_PAD_CTL1_SPARE(x) (((x) & 0x3) << 7) +#define USB2_OTG_PAD_CTL1_TERM_RANGE_ADJ(x) (((x) & 0xF) << 3) +#define USB2_OTG_PAD_CTL1_PD_DR (1 << 2) +#define USB2_OTG_PAD_CTL1_PD_DISC_FORCE_POWERUP (1 << 1) +#define USB2_OTG_PAD_CTL1_PD_CHRP_FORCE_POWERUP (1 << 0) + +#define XUSB_PADCTL_USB2_BIAS_PAD_CTL0 0x0B8 +#define USB2_BIAS_PAD_CTL0_ADJRPU(x) (((x) & 0x7) << 14) +#define USB2_BIAS_PAD_CTL0_PD_TRK (1 << 13) +#define USB2_BIAS_PAD_CTL0_PD (1 << 12) +#define USB2_BIAS_PAD_CTL0_TERM_OFFSETL(x) (((x) & 0x3) << 9) +#define USB2_BIAS_PAD_CTL0_VBUS_LEVEL(x) (((x) & 0x3) << 7) +#define USB2_BIAS_PAD_CTL0_HS_CHIRP_LEVEL(x) (((x) & 0x3) << 5) +#define USB2_BIAS_PAD_CTL0_HS_DISCON_LEVEL(x) (((x) & 0x7) << 2) +#define USB2_BIAS_PAD_CTL0_HS_SQUELCH_LEVEL(x) (((x) & 0x3) << 0) + +#define XUSB_PADCTL_HSIC_PAD0_CTL0 0x0C8 +#define HSIC_PAD0_CTL0_HSIC_OPT(x) (((x) & 0xF) << 16) +#define HSIC_PAD0_CTL0_TX_SLEWN(x) (((x) & 0xF) << 12) +#define HSIC_PAD0_CTL0_TX_SLEWP(x) (((x) & 0xF) << 8) +#define HSIC_PAD0_CTL0_TX_RTUNEN(x) (((x) & 0xF) << 4) +#define HSIC_PAD0_CTL0_TX_RTUNEP(x) (((x) & 0xF) << 0) + #define XUSB_PADCTL_USB3_PAD_MUX 0x134 +#define USB3_PAD_MUX_PCIE_IDDQ_DISABLE(x) (1 << (1 + (x))) +#define USB3_PAD_MUX_SATA_IDDQ_DISABLE (1 << 6) + #define XUSB_PADCTL_IOPHY_PLL_S0_CTL1 0x138 #define IOPHY_PLL_S0_CTL1_PLL1_LOCKDET (1 << 27) #define IOPHY_PLL_S0_CTL1_PLL1_MODE (1 << 24) @@ -90,17 +172,25 @@ #define XUSB_PADCTL_IOPHY_MISC_PAD_S0_CTL5 0x158 #define XUSB_PADCTL_IOPHY_MISC_PAD_S0_CTL6 0x15C -struct lane_cfg { - char *function; - char **lanes; - int iddq; -}; -struct xusbpadctl_softc { +#define WR4(_sc, _r, _v) bus_write_4((_sc)->mem_res, (_r), (_v)) +#define RD4(_sc, _r) bus_read_4((_sc)->mem_res, (_r)) + + +struct padctl_softc { device_t dev; struct resource *mem_res; - hwreset_t rst; + hwreset_t rst; int phy_ena_cnt; + + /* Fuses calibration data */ + uint32_t hs_curr_level_0; + uint32_t hs_curr_level_123; + uint32_t hs_iref_cap; + uint32_t hs_term_range_adj; + uint32_t hs_squelch_level; + + uint32_t hs_curr_level_offset; }; static struct ofw_compat_data compat_data[] = { @@ -108,274 +198,295 @@ static struct ofw_compat_data compat_data[] = { {NULL, 0}, }; -struct padctl_lane { - const char *name; - bus_size_t reg; - uint32_t shift; - uint32_t mask; - int iddq; - char **mux; - int nmux; +/* Ports. */ +enum padctl_port_type { + PADCTL_PORT_USB2, + PADCTL_PORT_ULPI, + PADCTL_PORT_HSIC, + PADCTL_PORT_USB3, }; -static char *otg_mux[] = {"snps", "xusb", "uart", "rsvd"}; -static char *usb_mux[] = {"snps", "xusb"}; -static char *pci_mux[] = {"pcie", "usb3", "sata", "rsvd"}; +struct padctl_lane; +struct padctl_port { + enum padctl_port_type type; + const char *name; + const char *base_name; + int idx; + int (*init)(struct padctl_softc *sc, + struct padctl_port *port); -#define LANE(n, r, s, m, i, mx) \ -{ \ - .name = n, \ - .reg = r, \ - .shift = s, \ - .mask = m, \ - .iddq = i, \ - .mux = mx, \ - .nmux = nitems(mx), \ -} - -static const struct padctl_lane lanes_tbl[] = { - LANE("otg-0", XUSB_PADCTL_USB2_PAD_MUX, 0, 0x3, -1, otg_mux), - LANE("otg-1", XUSB_PADCTL_USB2_PAD_MUX, 2, 0x3, -1, otg_mux), - LANE("otg-2", XUSB_PADCTL_USB2_PAD_MUX, 4, 0x3, -1, otg_mux), - LANE("ulpi-0", XUSB_PADCTL_USB2_PAD_MUX, 12, 0x1, -1, usb_mux), - LANE("hsic-0", XUSB_PADCTL_USB2_PAD_MUX, 14, 0x1, -1, usb_mux), - LANE("hsic-1", XUSB_PADCTL_USB2_PAD_MUX, 15, 0x1, -1, usb_mux), - LANE("pcie-0", XUSB_PADCTL_USB3_PAD_MUX, 16, 0x3, 1, pci_mux), - LANE("pcie-1", XUSB_PADCTL_USB3_PAD_MUX, 18, 0x3, 2, pci_mux), - LANE("pcie-2", XUSB_PADCTL_USB3_PAD_MUX, 20, 0x3, 3, pci_mux), - LANE("pcie-3", XUSB_PADCTL_USB3_PAD_MUX, 22, 0x3, 4, pci_mux), - LANE("pcie-4", XUSB_PADCTL_USB3_PAD_MUX, 24, 0x3, 5, pci_mux), - LANE("sata-0", XUSB_PADCTL_USB3_PAD_MUX, 26, 0x3, 6, pci_mux), + /* Runtime data. */ + phandle_t xref; + bool enabled; + regulator_t supply_vbus; /* USB2, USB3 */ + bool internal; /* ULPI, USB2, USB3 */ + uint32_t companion; /* USB3 */ + struct padctl_lane *lane; }; -static int -xusbpadctl_mux_function(const struct padctl_lane *lane, char *fnc_name) -{ - int i; +static int usb3_port_init(struct padctl_softc *sc, struct padctl_port *port); - for (i = 0; i < lane->nmux; i++) { - if (strcmp(fnc_name, lane->mux[i]) == 0) - return (i); - } - - return (-1); +#define PORT(t, n, p, i) { \ + .type = t, \ + .name = n "-" #p, \ + .base_name = n, \ + .idx = p, \ + .init = i, \ } +static struct padctl_port ports_tbl[] = { + PORT(PADCTL_PORT_USB2, "usb2", 0, NULL), + PORT(PADCTL_PORT_USB2, "usb2", 1, NULL), + PORT(PADCTL_PORT_USB2, "usb2", 2, NULL), + PORT(PADCTL_PORT_ULPI, "ulpi", 0, NULL), + PORT(PADCTL_PORT_HSIC, "hsic", 0, NULL), + PORT(PADCTL_PORT_HSIC, "hsic", 1, NULL), + PORT(PADCTL_PORT_USB3, "usb3", 0, usb3_port_init), + PORT(PADCTL_PORT_USB3, "usb3", 1, usb3_port_init), +}; -static int -xusbpadctl_config_lane(struct xusbpadctl_softc *sc, char *lane_name, - const struct padctl_lane *lane, struct lane_cfg *cfg) -{ +/* Pads - a group of lannes. */ +enum padctl_pad_type { + PADCTL_PAD_USB2, + PADCTL_PAD_ULPI, + PADCTL_PAD_HSIC, + PADCTL_PAD_PCIE, + PADCTL_PAD_SATA, +}; - int tmp; - uint32_t reg; +struct padctl_lane; +struct padctl_pad { + const char *name; + enum padctl_pad_type type; + int (*powerup)(struct padctl_softc *sc, + struct padctl_lane *lane); + int (*powerdown)(struct padctl_softc *sc, + struct padctl_lane *lane); + /* Runtime data. */ + bool enabled; + struct padctl_lane *lanes[8]; /* Safe maximum value. */ + int nlanes; +}; - reg = bus_read_4(sc->mem_res, lane->reg); - if (cfg->function != NULL) { - tmp = xusbpadctl_mux_function(lane, cfg->function); - if (tmp == -1) { - device_printf(sc->dev, - "Unknown function %s for lane %s\n", cfg->function, - lane_name); - return (EINVAL); - } - reg &= ~(lane->mask << lane->shift); - reg |= (tmp & lane->mask) << lane->shift; - } - if (cfg->iddq != -1) { - if (lane->iddq == -1) { - device_printf(sc->dev, "Invalid IDDQ for lane %s\n", - lane_name); - return (EINVAL); - } - if (cfg->iddq != 0) - reg &= ~(1 << lane->iddq); - else - reg |= 1 << lane->iddq; - } +static int usb2_powerup(struct padctl_softc *sc, struct padctl_lane *lane); +static int usb2_powerdown(struct padctl_softc *sc, struct padctl_lane *lane); +static int pcie_powerup(struct padctl_softc *sc, struct padctl_lane *lane); +static int pcie_powerdown(struct padctl_softc *sc, struct padctl_lane *lane); +static int sata_powerup(struct padctl_softc *sc, struct padctl_lane *lane); +static int sata_powerdown(struct padctl_softc *sc, struct padctl_lane *lane); - bus_write_4(sc->mem_res, lane->reg, reg); - return (0); +#define PAD(n, t, u, d) { \ + .name = n, \ + .type = t, \ + .powerup = u, \ + .powerdown = d, \ } +static struct padctl_pad pads_tbl[] = { + PAD("usb2", PADCTL_PAD_USB2, usb2_powerup, usb2_powerdown), + PAD("ulpi", PADCTL_PAD_ULPI, NULL, NULL), + PAD("hsic", PADCTL_PAD_HSIC, NULL, NULL), + PAD("pcie", PADCTL_PAD_PCIE, pcie_powerup, pcie_powerdown), + PAD("sata", PADCTL_PAD_SATA, sata_powerup, sata_powerdown), +}; -static const struct padctl_lane * -xusbpadctl_search_lane(char *lane_name) -{ - int i; +/* Lanes. */ +static char *otg_mux[] = {"snps", "xusb", "uart", "rsvd"}; +static char *usb_mux[] = {"snps", "xusb"}; +static char *pci_mux[] = {"pcie", "usb3-ss", "sata", "rsvd"}; - for (i = 0; i < nitems(lanes_tbl); i++) { - if (strcmp(lane_name, lanes_tbl[i].name) == 0) - return (&lanes_tbl[i]); - } +struct padctl_lane { + const char *name; + int idx; + bus_size_t reg; + uint32_t shift; + uint32_t mask; + char **mux; + int nmux; + /* Runtime data. */ + bool enabled; + phandle_t xref; + struct padctl_pad *pad; + struct padctl_port *port; + int mux_idx; - return (NULL); -} +}; -static int -xusbpadctl_config_node(struct xusbpadctl_softc *sc, char *lane_name, - struct lane_cfg *cfg) -{ - const struct padctl_lane *lane; - int rv; - - lane = xusbpadctl_search_lane(lane_name); - if (lane == NULL) { - device_printf(sc->dev, "Unknown lane: %s\n", lane_name); - return (ENXIO); - } - rv = xusbpadctl_config_lane(sc, lane_name, lane, cfg); - return (rv); +#define LANE(n, p, r, s, m, mx) { \ + .name = n "-" #p, \ + .idx = p, \ + .reg = r, \ + .shift = s, \ + .mask = m, \ + .mux = mx, \ + .nmux = nitems(mx), \ } +static struct padctl_lane lanes_tbl[] = { + LANE("usb2", 0, XUSB_PADCTL_USB2_PAD_MUX, 0, 0x3, otg_mux), + LANE("usb2", 1, XUSB_PADCTL_USB2_PAD_MUX, 2, 0x3, otg_mux), + LANE("usb2", 2, XUSB_PADCTL_USB2_PAD_MUX, 4, 0x3, otg_mux), + LANE("ulpi", 0, XUSB_PADCTL_USB2_PAD_MUX, 12, 0x1, usb_mux), + LANE("hsic", 0, XUSB_PADCTL_USB2_PAD_MUX, 14, 0x1, usb_mux), + LANE("hsic", 1, XUSB_PADCTL_USB2_PAD_MUX, 15, 0x1, usb_mux), + LANE("pcie", 0, XUSB_PADCTL_USB3_PAD_MUX, 16, 0x3, pci_mux), + LANE("pcie", 1, XUSB_PADCTL_USB3_PAD_MUX, 18, 0x3, pci_mux), + LANE("pcie", 2, XUSB_PADCTL_USB3_PAD_MUX, 20, 0x3, pci_mux), + LANE("pcie", 3, XUSB_PADCTL_USB3_PAD_MUX, 22, 0x3, pci_mux), + LANE("pcie", 4, XUSB_PADCTL_USB3_PAD_MUX, 24, 0x3, pci_mux), + LANE("sata", 0, XUSB_PADCTL_USB3_PAD_MUX, 26, 0x3, pci_mux), +}; -static int -xusbpadctl_read_node(struct xusbpadctl_softc *sc, phandle_t node, - struct lane_cfg *cfg, char **lanes, int *llanes) -{ - int rv; +/* Define all possible mappings for USB3 port lanes */ +struct padctl_lane_map { + int port_idx; + enum padctl_pad_type pad_type; + int lane_idx; +}; - *llanes = OF_getprop_alloc(node, "nvidia,lanes", 1, (void **)lanes); - if (*llanes <= 0) - return (ENOENT); - - /* Read function (mux) settings. */ - rv = OF_getprop_alloc(node, "nvidia,function", 1, - (void **)&cfg->function); - if (rv <= 0) - cfg->function = NULL; - /* Read numeric properties. */ - rv = OF_getencprop(node, "nvidia,iddq", &cfg->iddq, - sizeof(cfg->iddq)); - if (rv <= 0) - cfg->iddq = -1; - return (0); +#define LANE_MAP(pi, pt, li) { \ + .port_idx = pi, \ + .pad_type = pt, \ + .lane_idx = li, \ } +static struct padctl_lane_map lane_map_tbl[] = { + LANE_MAP(0, PADCTL_PAD_PCIE, 0), /* port USB3-0 -> lane PCIE-0 */ + LANE_MAP(1, PADCTL_PAD_PCIE, 1), /* port USB3-1 -> lane PCIE-1 */ + /* -- or -- */ + LANE_MAP(1, PADCTL_PAD_SATA, 0), /* port USB3-1 -> lane SATA-0 */ +}; +static struct padctl_port *search_lane_port(struct padctl_softc *sc, + struct padctl_lane *lane); +/* ------------------------------------------------------------------------- + * + * PHY functions + */ static int -xusbpadctl_process_node(struct xusbpadctl_softc *sc, phandle_t node) +usb3_port_init(struct padctl_softc *sc, struct padctl_port *port) { - struct lane_cfg cfg; - char *lanes, *lname; - int i, len, llanes, rv; + uint32_t reg; - rv = xusbpadctl_read_node(sc, node, &cfg, &lanes, &llanes); - if (rv != 0) - return (rv); + reg = RD4(sc, XUSB_PADCTL_SS_PORT_MAP); + if (port->internal) + reg &= ~SS_PORT_MAP_PORT_INTERNAL(port->idx); + else + reg |= SS_PORT_MAP_PORT_INTERNAL(port->idx); + reg &= ~SS_PORT_MAP_PORT_MAP(port->idx, ~0); + reg |= SS_PORT_MAP_PORT_MAP(port->idx, port->companion); + WR4(sc, XUSB_PADCTL_SS_PORT_MAP, reg); - len = 0; - lname = lanes; - do { - i = strlen(lname) + 1; - rv = xusbpadctl_config_node(sc, lname, &cfg); - if (rv != 0) - device_printf(sc->dev, - "Cannot configure lane: %s: %d\n", lname, rv); + reg = RD4(sc, XUSB_PADCTL_IOPHY_USB3_PAD_CTL2(port->idx)); + reg &= ~IOPHY_USB3_PAD_CTL2_CDR_CNTL(~0); + reg &= ~IOPHY_USB3_PAD_CTL2_RX_EQ(~0); + reg &= ~IOPHY_USB3_PAD_CTL2_RX_WANDER(~0); + reg |= IOPHY_USB3_PAD_CTL2_CDR_CNTL(0x24); + reg |= IOPHY_USB3_PAD_CTL2_RX_EQ(0xF070); + reg |= IOPHY_USB3_PAD_CTL2_RX_WANDER(0xF); + WR4(sc, XUSB_PADCTL_IOPHY_USB3_PAD_CTL2(port->idx), reg); - len += i; - lname += i; - } while (len < llanes); + WR4(sc, XUSB_PADCTL_IOPHY_USB3_PAD_CTL4(port->idx), + 0x002008EE); - if (lanes != NULL) - OF_prop_free(lanes); - if (cfg.function != NULL) - OF_prop_free(cfg.function); - return (rv); -} + reg = RD4(sc, XUSB_PADCTL_ELPG_PROGRAM); + reg &= ~ELPG_PROGRAM_SSP_ELPG_VCORE_DOWN(port->idx); + WR4(sc, XUSB_PADCTL_ELPG_PROGRAM, reg); + DELAY(100); + reg = RD4(sc, XUSB_PADCTL_ELPG_PROGRAM); + reg &= ~ELPG_PROGRAM_SSP_ELPG_CLAMP_EN_EARLY(port->idx); + WR4(sc, XUSB_PADCTL_ELPG_PROGRAM, reg); + DELAY(100); -static int -xusbpadctl_pinctrl_cfg(device_t dev, phandle_t cfgxref) -{ - struct xusbpadctl_softc *sc; - phandle_t node, cfgnode; - int rv; + reg = RD4(sc, XUSB_PADCTL_ELPG_PROGRAM); + reg &= ~ELPG_PROGRAM_SSP_ELPG_CLAMP_EN(port->idx); + WR4(sc, XUSB_PADCTL_ELPG_PROGRAM, reg); + DELAY(100); - sc = device_get_softc(dev); - cfgnode = OF_node_from_xref(cfgxref); - - rv = 0; - for (node = OF_child(cfgnode); node != 0; node = OF_peer(node)) { - if (!fdt_is_enabled(node)) - continue; - rv = xusbpadctl_process_node(sc, node); - if (rv != 0) - return (rv); - } - - return (rv); + return (0); } static int -xusbpadctl_phy_pcie_powerup(struct xusbpadctl_softc *sc) +pcie_powerup(struct padctl_softc *sc, struct padctl_lane *lane) { uint32_t reg; int i; - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_P0_CTL1); - reg &= ~IOPHY_PLL_P0_CTL1_REFCLK_SEL_MASK; - bus_write_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_P0_CTL1, reg); + reg = RD4(sc, XUSB_PADCTL_IOPHY_PLL_P0_CTL1); + reg &= ~IOPHY_PLL_P0_CTL1_REFCLK_SEL(~0); + WR4(sc, XUSB_PADCTL_IOPHY_PLL_P0_CTL1, reg); DELAY(100); - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_P0_CTL2); + reg = RD4(sc, XUSB_PADCTL_IOPHY_PLL_P0_CTL2); reg |= IOPHY_PLL_P0_CTL2_REFCLKBUF_EN; reg |= IOPHY_PLL_P0_CTL2_TXCLKREF_EN; reg |= IOPHY_PLL_P0_CTL2_TXCLKREF_SEL; - bus_write_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_P0_CTL2, reg); + WR4(sc, XUSB_PADCTL_IOPHY_PLL_P0_CTL2, reg); DELAY(100); - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_P0_CTL1); + reg = RD4(sc, XUSB_PADCTL_IOPHY_PLL_P0_CTL1); reg |= IOPHY_PLL_P0_CTL1_PLL_RST; - bus_write_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_P0_CTL1, reg); + WR4(sc, XUSB_PADCTL_IOPHY_PLL_P0_CTL1, reg); DELAY(100); - for (i = 0; i < 100; i++) { - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_P0_CTL1); + for (i = 100; i > 0; i--) { + reg = RD4(sc, XUSB_PADCTL_IOPHY_PLL_P0_CTL1); if (reg & IOPHY_PLL_P0_CTL1_PLL0_LOCKDET) - return (0); + break; DELAY(10); } + if (i <= 0) { + device_printf(sc->dev, "Failed to power up PCIe phy\n"); + return (ETIMEDOUT); + } + reg = RD4(sc, XUSB_PADCTL_USB3_PAD_MUX); + reg |= USB3_PAD_MUX_PCIE_IDDQ_DISABLE(lane->idx); + WR4(sc, XUSB_PADCTL_USB3_PAD_MUX, reg); - return (ETIMEDOUT); + return (0); } - static int -xusbpadctl_phy_pcie_powerdown(struct xusbpadctl_softc *sc) +pcie_powerdown(struct padctl_softc *sc, struct padctl_lane *lane) { uint32_t reg; - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_P0_CTL1); + reg = RD4(sc, XUSB_PADCTL_USB3_PAD_MUX); + reg &= ~USB3_PAD_MUX_PCIE_IDDQ_DISABLE(lane->idx); + WR4(sc, XUSB_PADCTL_USB3_PAD_MUX, reg); + + reg = RD4(sc, XUSB_PADCTL_IOPHY_PLL_P0_CTL1); reg &= ~IOPHY_PLL_P0_CTL1_PLL_RST; - bus_write_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_P0_CTL1, reg); + WR4(sc, XUSB_PADCTL_IOPHY_PLL_P0_CTL1, reg); DELAY(100); + return (0); } static int -xusbpadctl_phy_sata_powerup(struct xusbpadctl_softc *sc) +sata_powerup(struct padctl_softc *sc, struct padctl_lane *lane) { uint32_t reg; int i; - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_IOPHY_MISC_PAD_S0_CTL1); + reg = RD4(sc, XUSB_PADCTL_IOPHY_MISC_PAD_S0_CTL1); reg &= ~IOPHY_MISC_PAD_S0_CTL1_IDDQ_OVRD; reg &= ~IOPHY_MISC_PAD_S0_CTL1_IDDQ; - bus_write_4(sc->mem_res, XUSB_PADCTL_IOPHY_MISC_PAD_S0_CTL1, reg); + WR4(sc, XUSB_PADCTL_IOPHY_MISC_PAD_S0_CTL1, reg); - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_S0_CTL1); + reg = RD4(sc, XUSB_PADCTL_IOPHY_PLL_S0_CTL1); reg &= ~IOPHY_PLL_S0_CTL1_PLL_PWR_OVRD; reg &= ~IOPHY_PLL_S0_CTL1_PLL_IDDQ; - bus_write_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_S0_CTL1, reg); + WR4(sc, XUSB_PADCTL_IOPHY_PLL_S0_CTL1, reg); - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_S0_CTL1); + reg = RD4(sc, XUSB_PADCTL_IOPHY_PLL_S0_CTL1); reg |= IOPHY_PLL_S0_CTL1_PLL1_MODE; - bus_write_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_S0_CTL1, reg); + WR4(sc, XUSB_PADCTL_IOPHY_PLL_S0_CTL1, reg); - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_S0_CTL1); + reg = RD4(sc, XUSB_PADCTL_IOPHY_PLL_S0_CTL1); reg |= IOPHY_PLL_S0_CTL1_PLL_RST_L; - bus_write_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_S0_CTL1, reg); + WR4(sc, XUSB_PADCTL_IOPHY_PLL_S0_CTL1, reg); for (i = 100; i >= 0; i--) { - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_S0_CTL1); + reg = RD4(sc, XUSB_PADCTL_IOPHY_PLL_S0_CTL1); if (reg & IOPHY_PLL_S0_CTL1_PLL1_LOCKDET) break; DELAY(100); @@ -384,128 +495,233 @@ xusbpadctl_phy_sata_powerup(struct xusbpadctl_softc *s device_printf(sc->dev, "Failed to power up SATA phy\n"); return (ETIMEDOUT); } + reg = RD4(sc, XUSB_PADCTL_USB3_PAD_MUX); + reg |= IOPHY_PLL_S0_CTL1_PLL_RST_L; + WR4(sc, XUSB_PADCTL_USB3_PAD_MUX, reg); + reg = RD4(sc, XUSB_PADCTL_USB3_PAD_MUX); + reg |= USB3_PAD_MUX_SATA_IDDQ_DISABLE; + WR4(sc, XUSB_PADCTL_USB3_PAD_MUX, reg); + return (0); } static int -xusbpadctl_phy_sata_powerdown(struct xusbpadctl_softc *sc) +sata_powerdown(struct padctl_softc *sc, struct padctl_lane *lane) { uint32_t reg; - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_S0_CTL1); + reg = RD4(sc, XUSB_PADCTL_USB3_PAD_MUX); + reg &= ~USB3_PAD_MUX_SATA_IDDQ_DISABLE; + WR4(sc, XUSB_PADCTL_USB3_PAD_MUX, reg); + + reg = RD4(sc, XUSB_PADCTL_IOPHY_PLL_S0_CTL1); reg &= ~IOPHY_PLL_S0_CTL1_PLL_RST_L; - bus_write_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_S0_CTL1, reg); + WR4(sc, XUSB_PADCTL_IOPHY_PLL_S0_CTL1, reg); DELAY(100); - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_S0_CTL1); + reg = RD4(sc, XUSB_PADCTL_IOPHY_PLL_S0_CTL1); reg &= ~IOPHY_PLL_S0_CTL1_PLL1_MODE; - bus_write_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_S0_CTL1, reg); + WR4(sc, XUSB_PADCTL_IOPHY_PLL_S0_CTL1, reg); DELAY(100); - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_S0_CTL1); + reg = RD4(sc, XUSB_PADCTL_IOPHY_PLL_S0_CTL1); reg |= IOPHY_PLL_S0_CTL1_PLL_PWR_OVRD; reg |= IOPHY_PLL_S0_CTL1_PLL_IDDQ; - bus_write_4(sc->mem_res, XUSB_PADCTL_IOPHY_PLL_S0_CTL1, reg); + WR4(sc, XUSB_PADCTL_IOPHY_PLL_S0_CTL1, reg); DELAY(100); - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_IOPHY_MISC_PAD_S0_CTL1); + reg = RD4(sc, XUSB_PADCTL_IOPHY_MISC_PAD_S0_CTL1); reg |= IOPHY_MISC_PAD_S0_CTL1_IDDQ_OVRD; reg |= IOPHY_MISC_PAD_S0_CTL1_IDDQ; - bus_write_4(sc->mem_res, XUSB_PADCTL_IOPHY_MISC_PAD_S0_CTL1, reg); + WR4(sc, XUSB_PADCTL_IOPHY_MISC_PAD_S0_CTL1, reg); DELAY(100); return (0); } static int -xusbpadctl_phy_powerup(struct xusbpadctl_softc *sc) +usb2_powerup(struct padctl_softc *sc, struct padctl_lane *lane) { uint32_t reg; + struct padctl_port *port; + int rv; - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_ELPG_PROGRAM); + port = search_lane_port(sc, lane); + if (port == NULL) { + device_printf(sc->dev, "Cannot find port for lane: %s\n", + lane->name); + } + reg = RD4(sc, XUSB_PADCTL_USB2_BIAS_PAD_CTL0); + reg &= ~USB2_BIAS_PAD_CTL0_HS_SQUELCH_LEVEL(~0); + reg &= ~USB2_BIAS_PAD_CTL0_HS_DISCON_LEVEL(~0); + reg |= USB2_BIAS_PAD_CTL0_HS_SQUELCH_LEVEL(sc->hs_squelch_level); + reg |= USB2_BIAS_PAD_CTL0_HS_DISCON_LEVEL(5); + WR4(sc, XUSB_PADCTL_USB2_BIAS_PAD_CTL0, reg); + + reg = RD4(sc, XUSB_PADCTL_USB2_PORT_CAP); + reg &= ~USB2_PORT_CAP_PORT_CAP(lane->idx, ~0); + reg |= USB2_PORT_CAP_PORT_CAP(lane->idx, USB2_PORT_CAP_PORT_CAP_HOST); + WR4(sc, XUSB_PADCTL_USB2_PORT_CAP, reg); + + reg = RD4(sc, XUSB_PADCTL_USB2_OTG_PAD_CTL0(lane->idx)); + reg &= ~USB2_OTG_PAD_CTL0_HS_CURR_LEVEL(~0); + reg &= ~USB2_OTG_PAD_CTL0_HS_SLEW(~0); + reg &= ~USB2_OTG_PAD_CTL0_LS_RSLEW(~0); + reg &= ~USB2_OTG_PAD_CTL0_PD; + reg &= ~USB2_OTG_PAD_CTL0_PD2; + reg &= ~USB2_OTG_PAD_CTL0_PD_ZI; + + reg |= USB2_OTG_PAD_CTL0_HS_SLEW(14); + if (lane->idx == 0) { + reg |= USB2_OTG_PAD_CTL0_HS_CURR_LEVEL(sc->hs_curr_level_0); + reg |= USB2_OTG_PAD_CTL0_LS_RSLEW(3); + } else { + reg |= USB2_OTG_PAD_CTL0_HS_CURR_LEVEL(sc->hs_curr_level_123); + reg |= USB2_OTG_PAD_CTL0_LS_RSLEW(0); + } + WR4(sc, XUSB_PADCTL_USB2_OTG_PAD_CTL0(lane->idx), reg); + + reg = RD4(sc, XUSB_PADCTL_USB2_OTG_PAD_CTL1(lane->idx)); + reg &= ~USB2_OTG_PAD_CTL1_TERM_RANGE_ADJ(~0); + reg &= ~USB2_OTG_PAD_CTL1_HS_IREF_CAP(~0); + reg &= ~USB2_OTG_PAD_CTL1_PD_DR; + reg &= ~USB2_OTG_PAD_CTL1_PD_DISC_FORCE_POWERUP; + reg &= ~USB2_OTG_PAD_CTL1_PD_CHRP_FORCE_POWERUP; + + reg |= USB2_OTG_PAD_CTL1_TERM_RANGE_ADJ(sc->hs_term_range_adj); + reg |= USB2_OTG_PAD_CTL1_HS_IREF_CAP(sc->hs_iref_cap); + WR4(sc, XUSB_PADCTL_USB2_OTG_PAD_CTL1(lane->idx), reg); + + if (port != NULL && port->supply_vbus != NULL) { + rv = regulator_enable(port->supply_vbus); + if (rv != 0) { + device_printf(sc->dev, + "Cannot enable vbus regulator\n"); + return (rv); + } + } + reg = RD4(sc, XUSB_PADCTL_USB2_BIAS_PAD_CTL0); + reg &= ~USB2_BIAS_PAD_CTL0_PD; + WR4(sc, XUSB_PADCTL_USB2_BIAS_PAD_CTL0, reg); + + return (0); +} + +static int +usb2_powerdown(struct padctl_softc *sc, struct padctl_lane *lane) +{ + uint32_t reg; + struct padctl_port *port; + int rv; + + port = search_lane_port(sc, lane); + if (port == NULL) { + device_printf(sc->dev, "Cannot find port for lane: %s\n", + lane->name); + } + reg = RD4(sc, XUSB_PADCTL_USB2_BIAS_PAD_CTL0); + reg |= USB2_BIAS_PAD_CTL0_PD; + WR4(sc, XUSB_PADCTL_USB2_BIAS_PAD_CTL0, reg); + + if (port != NULL && port->supply_vbus != NULL) { + rv = regulator_enable(port->supply_vbus); + if (rv != 0) { + device_printf(sc->dev, + "Cannot disable vbus regulator\n"); + return (rv); + } + } + return (0); +} + + +static int +phy_powerup(struct padctl_softc *sc) +{ + uint32_t reg; + + reg = RD4(sc, XUSB_PADCTL_ELPG_PROGRAM); + reg &= ~ELPG_PROGRAM_AUX_MUX_LP0_VCORE_DOWN; + WR4(sc, XUSB_PADCTL_ELPG_PROGRAM, reg); + DELAY(100); + + reg = RD4(sc, XUSB_PADCTL_ELPG_PROGRAM); reg &= ~ELPG_PROGRAM_AUX_MUX_LP0_CLAMP_EN; - bus_write_4(sc->mem_res, XUSB_PADCTL_ELPG_PROGRAM, reg); + WR4(sc, XUSB_PADCTL_ELPG_PROGRAM, reg); DELAY(100); - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_ELPG_PROGRAM); + reg = RD4(sc, XUSB_PADCTL_ELPG_PROGRAM); reg &= ~ELPG_PROGRAM_AUX_MUX_LP0_CLAMP_EN_EARLY; - bus_write_4(sc->mem_res, XUSB_PADCTL_ELPG_PROGRAM, reg); + WR4(sc, XUSB_PADCTL_ELPG_PROGRAM, reg); DELAY(100); - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_ELPG_PROGRAM); - reg &= ~ELPG_PROGRAM_AUX_MUX_LP0_VCORE_DOWN; - bus_write_4(sc->mem_res, XUSB_PADCTL_ELPG_PROGRAM, reg); - DELAY(100); - return (0); } static int -xusbpadctl_phy_powerdown(struct xusbpadctl_softc *sc) +phy_powerdown(struct padctl_softc *sc) { uint32_t reg; - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_ELPG_PROGRAM); - reg |= ELPG_PROGRAM_AUX_MUX_LP0_VCORE_DOWN; - bus_write_4(sc->mem_res, XUSB_PADCTL_ELPG_PROGRAM, reg); - DELAY(100); - - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_ELPG_PROGRAM); + reg = RD4(sc, XUSB_PADCTL_ELPG_PROGRAM); reg |= ELPG_PROGRAM_AUX_MUX_LP0_CLAMP_EN_EARLY; - bus_write_4(sc->mem_res, XUSB_PADCTL_ELPG_PROGRAM, reg); + WR4(sc, XUSB_PADCTL_ELPG_PROGRAM, reg); DELAY(100); - reg = bus_read_4(sc->mem_res, XUSB_PADCTL_ELPG_PROGRAM); + reg = RD4(sc, XUSB_PADCTL_ELPG_PROGRAM); reg |= ELPG_PROGRAM_AUX_MUX_LP0_CLAMP_EN; - bus_write_4(sc->mem_res, XUSB_PADCTL_ELPG_PROGRAM, reg); + WR4(sc, XUSB_PADCTL_ELPG_PROGRAM, reg); DELAY(100); + reg = RD4(sc, XUSB_PADCTL_ELPG_PROGRAM); + reg |= ELPG_PROGRAM_AUX_MUX_LP0_VCORE_DOWN; + WR4(sc, XUSB_PADCTL_ELPG_PROGRAM, reg); + DELAY(100); + return (0); } static int xusbpadctl_phy_enable(device_t dev, intptr_t id, bool enable) { - struct xusbpadctl_softc *sc; + struct padctl_softc *sc; + struct padctl_lane *lane; + struct padctl_pad *pad; int rv; sc = device_get_softc(dev); - if ((id != TEGRA_XUSB_PADCTL_PCIE) && - (id != TEGRA_XUSB_PADCTL_SATA)) { + if (id < 0 || id >= nitems(lanes_tbl)) { device_printf(dev, "Unknown phy: %d\n", id); return (ENXIO); } - - rv = 0; + lane = lanes_tbl + id; + if (!lane->enabled) { + device_printf(dev, "Lane is not enabled/configured: %s\n", + lane->name); + return (ENXIO); + } + pad = lane->pad; if (enable) { if (sc->phy_ena_cnt == 0) { - rv = xusbpadctl_phy_powerup(sc); + rv = phy_powerup(sc); if (rv != 0) return (rv); } sc->phy_ena_cnt++; } - if (id == TEGRA_XUSB_PADCTL_PCIE) { - if (enable) - rv = xusbpadctl_phy_pcie_powerup(sc); - else - rv = xusbpadctl_phy_pcie_powerdown(sc); - if (rv != 0) - return (rv); - } else if (id == TEGRA_XUSB_PADCTL_SATA) { - if (enable) - rv = xusbpadctl_phy_sata_powerup(sc); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Wed Apr 4 13:15:13 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3D65F8DD04; Wed, 4 Apr 2018 13:15:12 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 925A27A4D2; Wed, 4 Apr 2018 13:15:12 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8D58B1430E; Wed, 4 Apr 2018 13:15:12 +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 w34DFChS064311; Wed, 4 Apr 2018 13:15:12 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w34DFCAR064310; Wed, 4 Apr 2018 13:15:12 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201804041315.w34DFCAR064310@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 4 Apr 2018 13:15: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: r332022 - stable/11/sys/fs/fuse X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/sys/fs/fuse X-SVN-Commit-Revision: 332022 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Apr 2018 13:15:13 -0000 Author: emaste Date: Wed Apr 4 13:15:12 2018 New Revision: 332022 URL: https://svnweb.freebsd.org/changeset/base/332022 Log: MFC r330354 (eadler): sys/fuse: fix off by one error Reported by: Ilja Van Sprundel Submitted by: Domagoj Stolfa Modified: stable/11/sys/fs/fuse/fuse_internal.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/fuse/fuse_internal.c ============================================================================== --- stable/11/sys/fs/fuse/fuse_internal.c Wed Apr 4 13:12:49 2018 (r332021) +++ stable/11/sys/fs/fuse/fuse_internal.c Wed Apr 4 13:15:12 2018 (r332022) @@ -355,7 +355,7 @@ fuse_internal_readdir_processdata(struct uio *uio, memcpy((char *)cookediov->base + sizeof(struct dirent) - MAXNAMLEN - 1, (char *)buf + FUSE_NAME_OFFSET, fudge->namelen); - ((char *)cookediov->base)[bytesavail] = '\0'; + ((char *)cookediov->base)[bytesavail - 1] = '\0'; err = uiomove(cookediov->base, cookediov->len, uio); if (err) { From owner-svn-src-stable-11@freebsd.org Wed Apr 4 13:23:08 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59232F8E74C; Wed, 4 Apr 2018 13:23:08 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0E1157AFE8; Wed, 4 Apr 2018 13:23:08 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 08188144C3; Wed, 4 Apr 2018 13:23:08 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w34DN8v4074927; Wed, 4 Apr 2018 13:23:08 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w34DN6lF074902; Wed, 4 Apr 2018 13:23:06 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201804041323.w34DN6lF074902@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Wed, 4 Apr 2018 13:23: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: r332025 - in stable/11/sys: arm/allwinner arm/nvidia arm/nvidia/tegra124 conf dev/extres/phy dev/usb/controller X-SVN-Group: stable-11 X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: in stable/11/sys: arm/allwinner arm/nvidia arm/nvidia/tegra124 conf dev/extres/phy dev/usb/controller X-SVN-Commit-Revision: 332025 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Apr 2018 13:23:08 -0000 Author: mmel Date: Wed Apr 4 13:23:06 2018 New Revision: 332025 URL: https://svnweb.freebsd.org/changeset/base/332025 Log: MFC r328201: Convert extres/phy to kobj model. Similarly as other extres pseudo-drivers, implement phy by using kobj model. This detaches it from provider device, so single device driver can export multiple different phys. Additionally, this allows phy to be subclassed to more specialized drivers, like is USB OTG phy, or PCIe phy with hot-plug capability. Added: stable/11/sys/dev/extres/phy/phydev_if.m - copied unchanged from r328201, head/sys/dev/extres/phy/phydev_if.m stable/11/sys/dev/extres/phy/phynode_if.m - copied unchanged from r328201, head/sys/dev/extres/phy/phynode_if.m Deleted: stable/11/sys/dev/extres/phy/phy_if.m Modified: stable/11/sys/arm/allwinner/a10_ehci.c stable/11/sys/arm/allwinner/aw_usbphy.c stable/11/sys/arm/nvidia/tegra124/tegra124_xusbpadctl.c stable/11/sys/arm/nvidia/tegra_ahci.c stable/11/sys/arm/nvidia/tegra_ehci.c stable/11/sys/arm/nvidia/tegra_pcie.c stable/11/sys/arm/nvidia/tegra_usbphy.c stable/11/sys/arm/nvidia/tegra_xhci.c stable/11/sys/conf/files stable/11/sys/dev/extres/phy/phy.c stable/11/sys/dev/extres/phy/phy.h stable/11/sys/dev/usb/controller/generic_ohci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/allwinner/a10_ehci.c ============================================================================== --- stable/11/sys/arm/allwinner/a10_ehci.c Wed Apr 4 13:20:29 2018 (r332024) +++ stable/11/sys/arm/allwinner/a10_ehci.c Wed Apr 4 13:23:06 2018 (r332025) @@ -231,7 +231,7 @@ a10_ehci_attach(device_t self) device_printf(self, "Could not get phy\n"); goto error; } - err = phy_enable(self, aw_sc->phy); + err = phy_enable(aw_sc->phy); if (err != 0) { device_printf(self, "Could not enable phy\n"); goto error; Modified: stable/11/sys/arm/allwinner/aw_usbphy.c ============================================================================== --- stable/11/sys/arm/allwinner/aw_usbphy.c Wed Apr 4 13:20:29 2018 (r332024) +++ stable/11/sys/arm/allwinner/aw_usbphy.c Wed Apr 4 13:23:06 2018 (r332025) @@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include "phy_if.h" +#include "phynode_if.h" #define USBPHY_NPHYS 4 @@ -72,6 +72,16 @@ struct awusbphy_softc { int vbus_det_valid; }; + /* Phy class and methods. */ +static int awusbphy_phy_enable(struct phynode *phy, bool enable); +static phynode_method_t awusbphy_phynode_methods[] = { + PHYNODEMETHOD(phynode_enable, awusbphy_phy_enable), + + PHYNODEMETHOD_END +}; +DEFINE_CLASS_1(awusbphy_phynode, awusbphy_phynode_class, awusbphy_phynode_methods, + 0, phynode_class); + static int awusbphy_init(device_t dev) { @@ -148,12 +158,18 @@ awusbphy_vbus_detect(device_t dev, int *val) } static int -awusbphy_phy_enable(device_t dev, intptr_t phy, bool enable) +awusbphy_phy_enable(struct phynode *phynode, bool enable) { + device_t dev; + intptr_t phy; struct awusbphy_softc *sc; regulator_t reg; int error, vbus_det; + dev = phynode_get_device(phynode); + phy = phynode_get_id(phynode); + sc = device_get_softc(dev); + if (phy < 0 || phy >= USBPHY_NPHYS) return (ERANGE); @@ -203,6 +219,9 @@ static int awusbphy_attach(device_t dev) { int error; + struct phynode *phynode; + struct phynode_init_def phy_init; + int i; error = awusbphy_init(dev); if (error) { @@ -211,7 +230,22 @@ awusbphy_attach(device_t dev) return (error); } - phy_register_provider(dev); + /* Create and register phys. */ + for (i = 0; i < USBPHY_NPHYS; i++) { + bzero(&phy_init, sizeof(phy_init)); + phy_init.id = i; + phy_init.ofw_node = ofw_bus_get_node(dev); + phynode = phynode_create(dev, &awusbphy_phynode_class, + &phy_init); + if (phynode == NULL) { + device_printf(dev, "failed to create USB PHY\n"); + return (ENXIO); + } + if (phynode_register(phynode) == NULL) { + device_printf(dev, "failed to create USB PHY\n"); + return (ENXIO); + } + } return (error); } @@ -220,9 +254,6 @@ static device_method_t awusbphy_methods[] = { /* Device interface */ DEVMETHOD(device_probe, awusbphy_probe), DEVMETHOD(device_attach, awusbphy_attach), - - /* PHY interface */ - DEVMETHOD(phy_enable, awusbphy_phy_enable), DEVMETHOD_END }; Modified: stable/11/sys/arm/nvidia/tegra124/tegra124_xusbpadctl.c ============================================================================== --- stable/11/sys/arm/nvidia/tegra124/tegra124_xusbpadctl.c Wed Apr 4 13:20:29 2018 (r332024) +++ stable/11/sys/arm/nvidia/tegra124/tegra124_xusbpadctl.c Wed Apr 4 13:23:06 2018 (r332025) @@ -22,10 +22,11 @@ * 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 +__FBSDID("$FreeBSD$"); + #include #include #include @@ -50,7 +51,7 @@ #include -#include "phy_if.h" +#include "phydev_if.h" /* FUSE calibration data. */ #define FUSE_XUSB_CALIB 0x0F0 @@ -216,7 +217,6 @@ struct padctl_port { struct padctl_port *port); /* Runtime data. */ - phandle_t xref; bool enabled; regulator_t supply_vbus; /* USB2, USB3 */ bool internal; /* ULPI, USB2, USB3 */ @@ -303,7 +303,6 @@ struct padctl_lane { int nmux; /* Runtime data. */ bool enabled; - phandle_t xref; struct padctl_pad *pad; struct padctl_port *port; int mux_idx; @@ -353,6 +352,16 @@ static struct padctl_lane_map lane_map_tbl[] = { LANE_MAP(1, PADCTL_PAD_SATA, 0), /* port USB3-1 -> lane SATA-0 */ }; + /* Phy class and methods. */ +static int xusbpadctl_phy_enable(struct phynode *phy, bool enable); +static phynode_method_t xusbpadctl_phynode_methods[] = { + PHYNODEMETHOD(phynode_enable, xusbpadctl_phy_enable), + PHYNODEMETHOD_END + +}; +DEFINE_CLASS_1(xusbpadctl_phynode, xusbpadctl_phynode_class, + xusbpadctl_phynode_methods, 0, phynode_class); + static struct padctl_port *search_lane_port(struct padctl_softc *sc, struct padctl_lane *lane); /* ------------------------------------------------------------------------- @@ -683,13 +692,17 @@ phy_powerdown(struct padctl_softc *sc) } static int -xusbpadctl_phy_enable(device_t dev, intptr_t id, bool enable) +xusbpadctl_phy_enable(struct phynode *phy, bool enable) { + device_t dev; + intptr_t id; struct padctl_softc *sc; struct padctl_lane *lane; struct padctl_pad *pad; int rv; + dev = phynode_get_device(phy); + id = phynode_get_id(phy); sc = device_get_softc(dev); if (id < 0 || id >= nitems(lanes_tbl)) { @@ -731,24 +744,6 @@ xusbpadctl_phy_enable(device_t dev, intptr_t id, bool return (0); } -static int -xusbpadctl_phy_map(device_t provider, phandle_t xref, int ncells, - pcell_t *cells, intptr_t *id) -{ - int i; - - if (ncells != 0) - return (ERANGE); - - for (i = 0; i < nitems(lanes_tbl); i++) { - if (lanes_tbl[i].xref == xref) { - *id = i; - return (0); - } - } - return (ENXIO); -} - /* ------------------------------------------------------------------------- * * FDT processing @@ -871,6 +866,8 @@ static int process_lane(struct padctl_softc *sc, phandle_t node, struct padctl_pad *pad) { struct padctl_lane *lane; + struct phynode *phynode; + struct phynode_init_def phy_init; char *name; char *function; int rv; @@ -913,10 +910,25 @@ process_lane(struct padctl_softc *sc, phandle_t node, rv = ENXIO; goto end; } - lane->xref = OF_xref_from_node(node); lane->pad = pad; lane->enabled = true; pad->lanes[pad->nlanes++] = lane; + + /* Create and register phy. */ + bzero(&phy_init, sizeof(phy_init)); + phy_init.id = lane - lanes_tbl; + phy_init.ofw_node = node; + phynode = phynode_create(sc->dev, &xusbpadctl_phynode_class, &phy_init); + if (phynode == NULL) { + device_printf(sc->dev, "Cannot create phy\n"); + rv = ENXIO; + goto end; + } + if (phynode_register(phynode) == NULL) { + device_printf(sc->dev, "Cannot create phy\n"); + return (ENXIO); + } + rv = 0; end: @@ -930,7 +942,6 @@ end: static int process_pad(struct padctl_softc *sc, phandle_t node) { - phandle_t xref; struct padctl_pad *pad; char *name; int rv; @@ -963,9 +974,6 @@ process_pad(struct padctl_softc *sc, phandle_t node) rv = process_lane(sc, node, pad); if (rv != 0) goto end; - - xref = OF_xref_from_node(node); - OF_device_register_xref(xref, sc->dev); } pad->enabled = true; rv = 0; @@ -1193,10 +1201,6 @@ static device_method_t tegra_xusbpadctl_methods[] = { DEVMETHOD(device_probe, xusbpadctl_probe), DEVMETHOD(device_attach, xusbpadctl_attach), DEVMETHOD(device_detach, xusbpadctl_detach), - - /* phy interface */ - DEVMETHOD(phy_enable, xusbpadctl_phy_enable), - DEVMETHOD(phy_map, xusbpadctl_phy_map), DEVMETHOD_END }; Modified: stable/11/sys/arm/nvidia/tegra_ahci.c ============================================================================== --- stable/11/sys/arm/nvidia/tegra_ahci.c Wed Apr 4 13:20:29 2018 (r332024) +++ stable/11/sys/arm/nvidia/tegra_ahci.c Wed Apr 4 13:23:06 2018 (r332025) @@ -372,7 +372,7 @@ enable_fdt_resources(struct tegra_ahci_sc *sc) return (rv); } - rv = phy_enable(sc->dev, sc->phy); + rv = phy_enable(sc->phy); if (rv != 0) { device_printf(sc->dev, "Cannot enable SATA phy\n"); return (rv); Modified: stable/11/sys/arm/nvidia/tegra_ehci.c ============================================================================== --- stable/11/sys/arm/nvidia/tegra_ehci.c Wed Apr 4 13:20:29 2018 (r332024) +++ stable/11/sys/arm/nvidia/tegra_ehci.c Wed Apr 4 13:23:06 2018 (r332025) @@ -214,7 +214,7 @@ tegra_ehci_attach(device_t dev) goto out; } - rv = phy_enable(sc->dev, sc->phy); + rv = phy_enable(sc->phy); if (rv != 0) { device_printf(dev, "Cannot enable phy: %d\n", rv); goto out; Modified: stable/11/sys/arm/nvidia/tegra_pcie.c ============================================================================== --- stable/11/sys/arm/nvidia/tegra_pcie.c Wed Apr 4 13:20:29 2018 (r332024) +++ stable/11/sys/arm/nvidia/tegra_pcie.c Wed Apr 4 13:23:06 2018 (r332025) @@ -1310,7 +1310,7 @@ tegra_pcib_enable(struct tegra_pcib_softc *sc) for (i = 0; i < TEGRA_PCIB_MAX_PORTS; i++) { if (sc->ports[i] != NULL) { - rv = phy_enable(sc->dev, sc->ports[i]->phy); + rv = phy_enable(sc->ports[i]->phy); if (rv != 0) { device_printf(sc->dev, "Cannot enable phy for port %d\n", Modified: stable/11/sys/arm/nvidia/tegra_usbphy.c ============================================================================== --- stable/11/sys/arm/nvidia/tegra_usbphy.c Wed Apr 4 13:20:29 2018 (r332024) +++ stable/11/sys/arm/nvidia/tegra_usbphy.c Wed Apr 4 13:23:06 2018 (r332025) @@ -52,7 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include "phy_if.h" +#include "phynode_if.h" #define CTRL_ICUSB_CTRL 0x15c #define ICUSB_CTR_IC_ENB1 (1 << 3) @@ -300,6 +300,16 @@ static struct ofw_compat_data compat_data[] = { {NULL, 0}, }; + /* Phy controller class and methods. */ +static int usbphy_phy_enable(struct phynode *phy, bool enable); +static phynode_method_t usbphy_phynode_methods[] = { + PHYNODEMETHOD(phynode_enable, usbphy_phy_enable), + + PHYNODEMETHOD_END +}; +DEFINE_CLASS_1(usbphy_phynode, usbphy_phynode_class, usbphy_phynode_methods, + 0, phynode_class); + #define RD4(sc, offs) \ bus_read_4(sc->mem_res, offs) @@ -555,11 +565,13 @@ usbphy_utmi_disable(struct usbphy_softc *sc) } static int -usbphy_phy_enable(device_t dev, int id, bool enable) +usbphy_phy_enable(struct phynode *phy, bool enable) { + device_t dev; struct usbphy_softc *sc; int rv = 0; + dev = phynode_get_device(phy); sc = device_get_softc(dev); if (sc->ifc_type != USB_IFC_TYPE_UTMI) { @@ -701,9 +713,11 @@ usbphy_probe(device_t dev) static int usbphy_attach(device_t dev) { - struct usbphy_softc * sc; + struct usbphy_softc *sc; int rid, rv; phandle_t node; + struct phynode *phynode; + struct phynode_init_def phy_init; sc = device_get_softc(dev); sc->dev = dev; @@ -803,7 +817,20 @@ usbphy_attach(device_t dev) } } - phy_register_provider(dev); + /* Create and register phy. */ + bzero(&phy_init, sizeof(phy_init)); + phy_init.id = 1; + phy_init.ofw_node = node; + phynode = phynode_create(dev, &usbphy_phynode_class, &phy_init); + if (phynode == NULL) { + device_printf(sc->dev, "Cannot create phy\n"); + return (ENXIO); + } + if (phynode_register(phynode) == NULL) { + device_printf(sc->dev, "Cannot create phy\n"); + return (ENXIO); + } + return (0); } @@ -820,9 +847,6 @@ static device_method_t tegra_usbphy_methods[] = { DEVMETHOD(device_probe, usbphy_probe), DEVMETHOD(device_attach, usbphy_attach), DEVMETHOD(device_detach, usbphy_detach), - - /* phy interface */ - DEVMETHOD(phy_enable, usbphy_phy_enable), DEVMETHOD_END }; Modified: stable/11/sys/arm/nvidia/tegra_xhci.c ============================================================================== --- stable/11/sys/arm/nvidia/tegra_xhci.c Wed Apr 4 13:20:29 2018 (r332024) +++ stable/11/sys/arm/nvidia/tegra_xhci.c Wed Apr 4 13:23:06 2018 (r332025) @@ -583,22 +583,22 @@ enable_fdt_resources(struct tegra_xhci_softc *sc) return (rv); } - rv = phy_enable(sc->dev, sc->phy_usb2_0); + rv = phy_enable(sc->phy_usb2_0); if (rv != 0) { device_printf(sc->dev, "Cannot enable USB2_0 phy\n"); return (rv); } - rv = phy_enable(sc->dev, sc->phy_usb2_1); + rv = phy_enable(sc->phy_usb2_1); if (rv != 0) { device_printf(sc->dev, "Cannot enable USB2_1 phy\n"); return (rv); } - rv = phy_enable(sc->dev, sc->phy_usb2_2); + rv = phy_enable(sc->phy_usb2_2); if (rv != 0) { device_printf(sc->dev, "Cannot enable USB2_2 phy\n"); return (rv); } - rv = phy_enable(sc->dev, sc->phy_usb3_0); + rv = phy_enable(sc->phy_usb3_0); if (rv != 0) { device_printf(sc->dev, "Cannot enable USB3_0 phy\n"); return (rv); Modified: stable/11/sys/conf/files ============================================================================== --- stable/11/sys/conf/files Wed Apr 4 13:20:29 2018 (r332024) +++ stable/11/sys/conf/files Wed Apr 4 13:23:06 2018 (r332025) @@ -1682,7 +1682,8 @@ dev/extres/clk/clk_fixed.c optional ext_resources clk dev/extres/clk/clk_gate.c optional ext_resources clk dev/extres/clk/clk_mux.c optional ext_resources clk dev/extres/phy/phy.c optional ext_resources phy -dev/extres/phy/phy_if.m optional ext_resources phy +dev/extres/phy/phydev_if.m optional ext_resources phy +dev/extres/phy/phynode_if.m optional ext_resources phy dev/extres/hwreset/hwreset.c optional ext_resources hwreset dev/extres/hwreset/hwreset_if.m optional ext_resources hwreset dev/extres/regulator/regdev_if.m optional ext_resources regulator Modified: stable/11/sys/dev/extres/phy/phy.c ============================================================================== --- stable/11/sys/dev/extres/phy/phy.c Wed Apr 4 13:20:29 2018 (r332024) +++ stable/11/sys/dev/extres/phy/phy.c Wed Apr 4 13:23:06 2018 (r332025) @@ -22,15 +22,20 @@ * 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 +__FBSDID("$FreeBSD$"); + #include "opt_platform.h" -#include #include #include +#include +#include #include +#include #include +#include #ifdef FDT #include @@ -39,88 +44,452 @@ #include -#include "phy_if.h" +#include "phydev_if.h" +MALLOC_DEFINE(M_PHY, "phy", "Phy framework"); + +/* Forward declarations. */ +struct phy; +struct phynode; + +typedef TAILQ_HEAD(phynode_list, phynode) phynode_list_t; +typedef TAILQ_HEAD(phy_list, phy) phy_list_t; + +/* Default phy methods. */ +static int phynode_method_init(struct phynode *phynode); +static int phynode_method_enable(struct phynode *phynode, bool disable); +static int phynode_method_status(struct phynode *phynode, int *status); + + +/* + * Phy controller methods. + */ +static phynode_method_t phynode_methods[] = { + PHYNODEMETHOD(phynode_init, phynode_method_init), + PHYNODEMETHOD(phynode_enable, phynode_method_enable), + PHYNODEMETHOD(phynode_status, phynode_method_status), + + PHYNODEMETHOD_END +}; +DEFINE_CLASS_0(phynode, phynode_class, phynode_methods, 0); + +/* + * Phy node + */ +struct phynode { + KOBJ_FIELDS; + + TAILQ_ENTRY(phynode) phylist_link; /* Global list entry */ + phy_list_t consumers_list; /* Consumers list */ + + + /* Details of this device. */ + const char *name; /* Globally unique name */ + + device_t pdev; /* Producer device_t */ + void *softc; /* Producer softc */ + intptr_t id; /* Per producer unique id */ +#ifdef FDT + phandle_t ofw_node; /* OFW node of phy */ +#endif + struct sx lock; /* Lock for this phy */ + int ref_cnt; /* Reference counter */ + int enable_cnt; /* Enabled counter */ +}; + struct phy { - device_t consumer_dev; /* consumer device*/ - device_t provider_dev; /* provider device*/ - uintptr_t phy_id; /* phy id */ + device_t cdev; /* consumer device*/ + struct phynode *phynode; + TAILQ_ENTRY(phy) link; /* Consumers list entry */ + + int enable_cnt; }; -MALLOC_DEFINE(M_PHY, "phy", "Phy framework"); +static phynode_list_t phynode_list = TAILQ_HEAD_INITIALIZER(phynode_list); +static struct sx phynode_topo_lock; +SX_SYSINIT(phy_topology, &phynode_topo_lock, "Phy topology lock"); + +#define PHY_TOPO_SLOCK() sx_slock(&phynode_topo_lock) +#define PHY_TOPO_XLOCK() sx_xlock(&phynode_topo_lock) +#define PHY_TOPO_UNLOCK() sx_unlock(&phynode_topo_lock) +#define PHY_TOPO_ASSERT() sx_assert(&phynode_topo_lock, SA_LOCKED) +#define PHY_TOPO_XASSERT() sx_assert(&phynode_topo_lock, SA_XLOCKED) + +#define PHYNODE_SLOCK(_sc) sx_slock(&((_sc)->lock)) +#define PHYNODE_XLOCK(_sc) sx_xlock(&((_sc)->lock)) +#define PHYNODE_UNLOCK(_sc) sx_unlock(&((_sc)->lock)) + +/* ---------------------------------------------------------------------------- + * + * Default phy methods for base class. + * + */ + +static int +phynode_method_init(struct phynode *phynode) +{ + + return (0); +} + +static int +phynode_method_enable(struct phynode *phynode, bool enable) +{ + + if (!enable) + return (ENXIO); + + return (0); +} + +static int +phynode_method_status(struct phynode *phynode, int *status) +{ + *status = PHY_STATUS_ENABLED; + return (0); +} + +/* ---------------------------------------------------------------------------- + * + * Internal functions. + * + */ +/* + * Create and initialize phy object, but do not register it. + */ +struct phynode * +phynode_create(device_t pdev, phynode_class_t phynode_class, + struct phynode_init_def *def) +{ + struct phynode *phynode; + + + /* Create object and initialize it. */ + phynode = malloc(sizeof(struct phynode), M_PHY, M_WAITOK | M_ZERO); + kobj_init((kobj_t)phynode, (kobj_class_t)phynode_class); + sx_init(&phynode->lock, "Phy node lock"); + + /* Allocate softc if required. */ + if (phynode_class->size > 0) { + phynode->softc = malloc(phynode_class->size, M_PHY, + M_WAITOK | M_ZERO); + } + + /* Rest of init. */ + TAILQ_INIT(&phynode->consumers_list); + phynode->id = def->id; + phynode->pdev = pdev; +#ifdef FDT + phynode->ofw_node = def->ofw_node; +#endif + + return (phynode); +} + +/* Register phy object. */ +struct phynode * +phynode_register(struct phynode *phynode) +{ + int rv; + +#ifdef FDT + if (phynode->ofw_node <= 0) + phynode->ofw_node = ofw_bus_get_node(phynode->pdev); + if (phynode->ofw_node <= 0) + return (NULL); +#endif + + rv = PHYNODE_INIT(phynode); + if (rv != 0) { + printf("PHYNODE_INIT failed: %d\n", rv); + return (NULL); + } + + PHY_TOPO_XLOCK(); + TAILQ_INSERT_TAIL(&phynode_list, phynode, phylist_link); + PHY_TOPO_UNLOCK(); +#ifdef FDT + OF_device_register_xref(OF_xref_from_node(phynode->ofw_node), + phynode->pdev); +#endif + return (phynode); +} + +static struct phynode * +phynode_find_by_id(device_t dev, intptr_t id) +{ + struct phynode *entry; + + PHY_TOPO_ASSERT(); + + TAILQ_FOREACH(entry, &phynode_list, phylist_link) { + if ((entry->pdev == dev) && (entry->id == id)) + return (entry); + } + + return (NULL); +} + +/* -------------------------------------------------------------------------- + * + * Phy providers interface + * + */ + +void * +phynode_get_softc(struct phynode *phynode) +{ + + return (phynode->softc); +} + +device_t +phynode_get_device(struct phynode *phynode) +{ + + return (phynode->pdev); +} + +intptr_t phynode_get_id(struct phynode *phynode) +{ + + return (phynode->id); +} + +#ifdef FDT +phandle_t +phynode_get_ofw_node(struct phynode *phynode) +{ + + return (phynode->ofw_node); +} +#endif + +/* -------------------------------------------------------------------------- + * + * Real consumers executive + * + */ + +/* + * Enable phy. + */ int -phy_init(device_t consumer, phy_t phy) +phynode_enable(struct phynode *phynode) { + int rv; - return (PHY_INIT(phy->provider_dev, phy->phy_id, true)); + PHY_TOPO_ASSERT(); + + PHYNODE_XLOCK(phynode); + if (phynode->enable_cnt == 0) { + rv = PHYNODE_ENABLE(phynode, true); + if (rv != 0) { + PHYNODE_UNLOCK(phynode); + return (rv); + } + } + phynode->enable_cnt++; + PHYNODE_UNLOCK(phynode); + return (0); } +/* + * Disable phy. + */ int -phy_deinit(device_t consumer, phy_t phy) +phynode_disable(struct phynode *phynode) { + int rv; - return (PHY_INIT(phy->provider_dev, phy->phy_id, false)); + PHY_TOPO_ASSERT(); + + PHYNODE_XLOCK(phynode); + if (phynode->enable_cnt == 1) { + rv = PHYNODE_ENABLE(phynode, false); + if (rv != 0) { + PHYNODE_UNLOCK(phynode); + return (rv); + } + } + phynode->enable_cnt--; + PHYNODE_UNLOCK(phynode); + return (0); } +/* + * Get phy status. (PHY_STATUS_*) + */ int -phy_enable(device_t consumer, phy_t phy) +phynode_status(struct phynode *phynode, int *status) { + int rv; - return (PHY_ENABLE(phy->provider_dev, phy->phy_id, true)); + PHY_TOPO_ASSERT(); + + PHYNODE_XLOCK(phynode); + rv = PHYNODE_STATUS(phynode, status); + PHYNODE_UNLOCK(phynode); + return (rv); } + /* -------------------------------------------------------------------------- + * + * Phy consumers interface. + * + */ + +/* Helper function for phy_get*() */ +static phy_t +phy_create(struct phynode *phynode, device_t cdev) +{ + struct phy *phy; + + PHY_TOPO_ASSERT(); + + phy = malloc(sizeof(struct phy), M_PHY, M_WAITOK | M_ZERO); + phy->cdev = cdev; + phy->phynode = phynode; + phy->enable_cnt = 0; + + PHYNODE_XLOCK(phynode); + phynode->ref_cnt++; + TAILQ_INSERT_TAIL(&phynode->consumers_list, phy, link); + PHYNODE_UNLOCK(phynode); + + return (phy); +} + int -phy_disable(device_t consumer, phy_t phy) +phy_enable(phy_t phy) { + int rv; + struct phynode *phynode; - return (PHY_ENABLE(phy->provider_dev, phy->phy_id, false)); + phynode = phy->phynode; + KASSERT(phynode->ref_cnt > 0, + ("Attempt to access unreferenced phy.\n")); + + PHY_TOPO_SLOCK(); + rv = phynode_enable(phynode); + if (rv == 0) + phy->enable_cnt++; + PHY_TOPO_UNLOCK(); + return (rv); } int -phy_status(device_t consumer, phy_t phy, int *value) +phy_disable(phy_t phy) { + int rv; + struct phynode *phynode; - return (PHY_STATUS(phy->provider_dev, phy->phy_id, value)); + phynode = phy->phynode; + KASSERT(phynode->ref_cnt > 0, + ("Attempt to access unreferenced phy.\n")); + KASSERT(phy->enable_cnt > 0, + ("Attempt to disable already disabled phy.\n")); + + PHY_TOPO_SLOCK(); + rv = phynode_disable(phynode); + if (rv == 0) + phy->enable_cnt--; + PHY_TOPO_UNLOCK(); + return (rv); } int +phy_status(phy_t phy, int *status) +{ + int rv; + struct phynode *phynode; + + phynode = phy->phynode; + KASSERT(phynode->ref_cnt > 0, + ("Attempt to access unreferenced phy.\n")); + + PHY_TOPO_SLOCK(); + rv = phynode_status(phynode, status); + PHY_TOPO_UNLOCK(); + return (rv); +} + +int phy_get_by_id(device_t consumer_dev, device_t provider_dev, intptr_t id, - phy_t *phy_out) + phy_t *phy) { - phy_t phy; + struct phynode *phynode; - /* Create handle */ - phy = malloc(sizeof(struct phy), M_PHY, - M_WAITOK | M_ZERO); - phy->consumer_dev = consumer_dev; - phy->provider_dev = provider_dev; - phy->phy_id = id; - *phy_out = phy; + PHY_TOPO_SLOCK(); + + phynode = phynode_find_by_id(provider_dev, id); + if (phynode == NULL) { + PHY_TOPO_UNLOCK(); + return (ENODEV); + } + *phy = phy_create(phynode, consumer_dev); + PHY_TOPO_UNLOCK(); + return (0); } void phy_release(phy_t phy) { + struct phynode *phynode; + + phynode = phy->phynode; + KASSERT(phynode->ref_cnt > 0, + ("Attempt to access unreferenced phy.\n")); + + PHY_TOPO_SLOCK(); + while (phy->enable_cnt > 0) { + phynode_disable(phynode); + phy->enable_cnt--; + } + PHYNODE_XLOCK(phynode); + TAILQ_REMOVE(&phynode->consumers_list, phy, link); + phynode->ref_cnt--; + PHYNODE_UNLOCK(phynode); + PHY_TOPO_UNLOCK(); + free(phy, M_PHY); } - #ifdef FDT -int phy_default_map(device_t provider, phandle_t xref, int ncells, +int phydev_default_ofw_map(device_t provider, phandle_t xref, int ncells, pcell_t *cells, intptr_t *id) { + struct phynode *entry; + phandle_t node; - if (ncells == 0) - *id = 1; - else if (ncells == 1) + /* Single device can register multiple subnodes. */ + if (ncells == 0) { + + node = OF_node_from_xref(xref); + PHY_TOPO_XLOCK(); + TAILQ_FOREACH(entry, &phynode_list, phylist_link) { + if ((entry->pdev == provider) && + (entry->ofw_node == node)) { + *id = entry->id; + PHY_TOPO_UNLOCK(); + return (0); + } + } + PHY_TOPO_UNLOCK(); + return (ERANGE); + } + + /* First cell is ID. */ + if (ncells == 1) { *id = cells[0]; - else - return (ERANGE); + return (0); + } - return (0); + /* No default way how to get ID, custom mapper is required. */ + return (ERANGE); } int @@ -151,7 +520,7 @@ phy_get_by_ofw_idx(device_t consumer_dev, phandle_t cn return (ENODEV); } /* Map phy to number. */ - rv = PHY_MAP(phydev, xnode, ncells, cells, &id); + rv = PHYDEV_MAP(phydev, xnode, ncells, cells, &id); OF_prop_free(cells); if (rv != 0) return (rv); @@ -206,33 +575,11 @@ phy_get_by_ofw_property(device_t consumer_dev, phandle return (ENODEV); } /* Map phy to number. */ - rv = PHY_MAP(phydev, cells[0], ncells - 1 , cells + 1, &id); + rv = PHYDEV_MAP(phydev, cells[0], ncells - 1 , cells + 1, &id); OF_prop_free(cells); if (rv != 0) return (rv); return (phy_get_by_id(consumer_dev, phydev, id, phy)); -} - -void -phy_register_provider(device_t provider_dev) -{ - phandle_t xref, node; - - node = ofw_bus_get_node(provider_dev); - if (node <= 0) - panic("%s called on not ofw based device.\n", __func__); - - xref = OF_xref_from_node(node); - OF_device_register_xref(xref, provider_dev); -} - -void -phy_unregister_provider(device_t provider_dev) -{ - phandle_t xref; - - xref = OF_xref_from_device(provider_dev); - OF_device_register_xref(xref, NULL); } #endif Modified: stable/11/sys/dev/extres/phy/phy.h ============================================================================== --- stable/11/sys/dev/extres/phy/phy.h Wed Apr 4 13:20:29 2018 (r332024) +++ stable/11/sys/dev/extres/phy/phy.h Wed Apr 4 13:23:06 2018 (r332025) @@ -27,21 +27,49 @@ #ifndef DEV_EXTRES_PHY_H #define DEV_EXTRES_PHY_H - #include "opt_platform.h" -#include + +#include #ifdef FDT #include *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Wed Apr 4 13:54:52 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3037F90B63; Wed, 4 Apr 2018 13:54:51 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A85AF7CAFA; Wed, 4 Apr 2018 13:54:51 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A347F149C2; Wed, 4 Apr 2018 13:54:51 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w34Dspft010901; Wed, 4 Apr 2018 13:54:51 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w34DspCc010900; Wed, 4 Apr 2018 13:54:51 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804041354.w34DspCc010900@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 4 Apr 2018 13:54:51 +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: r332027 - stable/11/lib/libdl X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/lib/libdl X-SVN-Commit-Revision: 332027 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Apr 2018 13:54:52 -0000 Author: kevans Date: Wed Apr 4 13:54:51 2018 New Revision: 332027 URL: https://svnweb.freebsd.org/changeset/base/332027 Log: MFC r331743: Add libdl to clibs package libdl is a filter on libc, and pretty lightweight. Add it to the 'clibs' package with libc, effectively tying them together in a pkgbase world. Modified: stable/11/lib/libdl/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libdl/Makefile ============================================================================== --- stable/11/lib/libdl/Makefile Wed Apr 4 13:37:59 2018 (r332026) +++ stable/11/lib/libdl/Makefile Wed Apr 4 13:54:51 2018 (r332027) @@ -1,5 +1,6 @@ # $FreeBSD$ +PACKAGE=clibs LIB=dl SHLIB_MAJOR=1 From owner-svn-src-stable-11@freebsd.org Wed Apr 4 13:58:19 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 86BCEF90F3D; Wed, 4 Apr 2018 13:58:19 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 31E7B7CDA4; Wed, 4 Apr 2018 13:58:19 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2C565149C5; Wed, 4 Apr 2018 13:58:19 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w34DwJ2i013414; Wed, 4 Apr 2018 13:58:19 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w34DwI6j013403; Wed, 4 Apr 2018 13:58:18 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804041358.w34DwI6j013403@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 4 Apr 2018 13:58:18 +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: r332028 - in stable/11: stand/efi/loader sys/amd64/amd64 sys/dev/efidev X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: stand/efi/loader sys/amd64/amd64 sys/dev/efidev X-SVN-Commit-Revision: 332028 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Apr 2018 13:58:19 -0000 Author: kevans Date: Wed Apr 4 13:58:18 2018 New Revision: 332028 URL: https://svnweb.freebsd.org/changeset/base/332028 Log: MFC r330868, r331241, r331361, r331365: EFIRT Fixes r330868: EFIRT: SetVirtualAddressMap with 1:1 mapping after exiting boot services This fixes a problem encountered on the Lenovo Thinkpad X220/Yoga 11e where runtime services would try to inexplicably jump to other parts of memory where it shouldn't be when attempting to enumerate EFI vars, causing a panic. The virtual mapping is enabled by default and can be disabled by setting efi_disable_vmap in loader.conf(5). r331241: Check if the gettime runtime service is valid. The U-Boot efi runtime service expects us to set the address map before calling any runtime services. It will then remap a few functions to their runtime version. One of these is the gettime function. If we call into this without having set a runtime map we get a page fault. Add a check to see if this is valid in efi_init() so we don't try to use the possibly invalid pointer. r331361: Enter into the EFI environment before dereferencing the runtime services pointer. This may be within the EFI address space and not the FreeBSD kernel address space. r331365: Re-work efidev ordering to fix efirt preloaded by loader on amd64 On amd64, efi_enter calls fpu_kern_enter(). This may not be called until fpuinitstate has been invoked, resulting in a kernel panic with efirt_load="YES" in loader.conf(5). Move fpuinitstate a little earlier in SI_SUB_DRIVERS so that we can squeeze efirt between it and efirtc at SI_SUB_DRIVERS, SI_ORDER_ANY. efidev must be after efirt and doesn't really need to be at SI_SUB_DEVFS, so drop it at SI_SUB_DRIVER, SI_ORDER_ANY. The not immediately obvious dependency of fpuinitstate by efirt has been noted in both places. Modified: stable/11/stand/efi/loader/bootinfo.c stable/11/sys/amd64/amd64/efirt_machdep.c stable/11/sys/amd64/amd64/fpu.c stable/11/sys/dev/efidev/efidev.c stable/11/sys/dev/efidev/efirt.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/efi/loader/bootinfo.c ============================================================================== --- stable/11/stand/efi/loader/bootinfo.c Wed Apr 4 13:54:51 2018 (r332027) +++ stable/11/stand/efi/loader/bootinfo.c Wed Apr 4 13:58:18 2018 (r332028) @@ -236,17 +236,48 @@ bi_copymodules(vm_offset_t addr) return(addr); } +static EFI_STATUS +efi_do_vmap(EFI_MEMORY_DESCRIPTOR *mm, UINTN sz, UINTN mmsz, UINT32 mmver) +{ + EFI_MEMORY_DESCRIPTOR *desc, *viter, *vmap; + EFI_STATUS ret; + int curr, ndesc, nset; + + nset = 0; + desc = mm; + ndesc = sz / mmsz; + vmap = malloc(sz); + if (vmap == NULL) + /* This isn't really an EFI error case, but pretend it is */ + return (EFI_OUT_OF_RESOURCES); + viter = vmap; + for (curr = 0; curr < ndesc; + curr++, desc = NextMemoryDescriptor(desc, mmsz)) { + if ((desc->Attribute & EFI_MEMORY_RUNTIME) != 0) { + ++nset; + desc->VirtualStart = desc->PhysicalStart; + *viter = *desc; + viter = NextMemoryDescriptor(viter, mmsz); + } + } + ret = RS->SetVirtualAddressMap(nset * mmsz, mmsz, mmver, vmap); + free(vmap); + return (ret); +} + static int bi_load_efi_data(struct preloaded_file *kfp) { EFI_MEMORY_DESCRIPTOR *mm; EFI_PHYSICAL_ADDRESS addr; EFI_STATUS status; + const char *efi_novmap; size_t efisz; UINTN efi_mapkey; UINTN mmsz, pages, retry, sz; UINT32 mmver; struct efi_map_header *efihdr; + bool do_vmap; #if defined(__amd64__) || defined(__aarch64__) struct efi_fb efifb; @@ -266,6 +297,11 @@ bi_load_efi_data(struct preloaded_file *kfp) } #endif + do_vmap = true; + efi_novmap = getenv("efi_disable_vmap"); + if (efi_novmap != NULL) + do_vmap = strcasecmp(efi_novmap, "YES") != 0; + efisz = (sizeof(struct efi_map_header) + 0xf) & ~0xf; /* @@ -321,6 +357,13 @@ bi_load_efi_data(struct preloaded_file *kfp) } status = BS->ExitBootServices(IH, efi_mapkey); if (EFI_ERROR(status) == 0) { + /* + * This may be disabled by setting efi_disable_vmap in + * loader.conf(5). By default we will setup the virtual + * map entries. + */ + if (do_vmap) + efi_do_vmap(mm, sz, mmsz, mmver); efihdr->memory_size = sz; efihdr->descriptor_size = mmsz; efihdr->descriptor_version = mmver; Modified: stable/11/sys/amd64/amd64/efirt_machdep.c ============================================================================== --- stable/11/sys/amd64/amd64/efirt_machdep.c Wed Apr 4 13:54:51 2018 (r332027) +++ stable/11/sys/amd64/amd64/efirt_machdep.c Wed Apr 4 13:58:18 2018 (r332028) @@ -166,7 +166,7 @@ efi_create_1t1_map(struct efi_md *map, int ndesc, int descsz)) { if ((p->md_attr & EFI_MD_ATTR_RT) == 0) continue; - if (p->md_virt != NULL) { + if (p->md_virt != NULL && (uint64_t)p->md_virt != p->md_phys) { if (bootverbose) printf("EFI Runtime entry %d is mapped\n", i); goto fail; Modified: stable/11/sys/amd64/amd64/fpu.c ============================================================================== --- stable/11/sys/amd64/amd64/fpu.c Wed Apr 4 13:54:51 2018 (r332027) +++ stable/11/sys/amd64/amd64/fpu.c Wed Apr 4 13:58:18 2018 (r332028) @@ -357,7 +357,8 @@ fpuinitstate(void *arg __unused) start_emulating(); intr_restore(saveintr); } -SYSINIT(fpuinitstate, SI_SUB_DRIVERS, SI_ORDER_ANY, fpuinitstate, NULL); +/* EFIRT needs this to be initialized before we can enter our EFI environment */ +SYSINIT(fpuinitstate, SI_SUB_DRIVERS, SI_ORDER_FIRST, fpuinitstate, NULL); /* * Free coprocessor (if we have it). Modified: stable/11/sys/dev/efidev/efidev.c ============================================================================== --- stable/11/sys/dev/efidev/efidev.c Wed Apr 4 13:54:51 2018 (r332027) +++ stable/11/sys/dev/efidev/efidev.c Wed Apr 4 13:58:18 2018 (r332028) @@ -216,6 +216,6 @@ static moduledata_t efidev_moddata = { .priv = NULL, }; -DECLARE_MODULE(efidev, efidev_moddata, SI_SUB_DEVFS, SI_ORDER_ANY); +DECLARE_MODULE(efidev, efidev_moddata, SI_SUB_DRIVERS, SI_ORDER_ANY); MODULE_VERSION(efidev, 1); MODULE_DEPEND(efidev, efirt, 1, 1, 1); Modified: stable/11/sys/dev/efidev/efirt.c ============================================================================== --- stable/11/sys/dev/efidev/efirt.c Wed Apr 4 13:54:51 2018 (r332027) +++ stable/11/sys/dev/efidev/efirt.c Wed Apr 4 13:58:18 2018 (r332028) @@ -88,6 +88,9 @@ static int efi_status2err[25] = { EPROTO /* EFI_PROTOCOL_ERROR */ }; +static int efi_enter(void); +static void efi_leave(void); + static int efi_status_to_errno(efi_status status) { @@ -99,6 +102,25 @@ efi_status_to_errno(efi_status status) static struct mtx efi_lock; +static bool +efi_is_in_map(struct efi_md *map, int ndesc, int descsz, vm_offset_t addr) +{ + struct efi_md *p; + int i; + + for (i = 0, p = map; i < ndesc; i++, p = efi_next_descriptor(p, + descsz)) { + if ((p->md_attr & EFI_MD_ATTR_RT) == 0) + continue; + + if (addr >= (uintptr_t)p->md_virt && + addr < (uintptr_t)p->md_virt + p->md_pages * PAGE_SIZE) + return (true); + } + + return (false); +} + static int efi_init(void) { @@ -159,6 +181,30 @@ efi_init(void) return (ENXIO); } + /* + * Some UEFI implementations have multiple implementations of the + * RS->GetTime function. They switch from one we can only use early + * in the boot process to one valid as a RunTime service only when we + * call RS->SetVirtualAddressMap. As this is not always the case, e.g. + * with an old loader.efi, check if the RS->GetTime function is within + * the EFI map, and fail to attach if not. + * + * We need to enter into the EFI environment as efi_runtime may point + * to an EFI address. + */ + efi_enter(); + if (!efi_is_in_map(map, efihdr->memory_size / efihdr->descriptor_size, + efihdr->descriptor_size, (vm_offset_t)efi_runtime->rt_gettime)) { + efi_leave(); + if (bootverbose) + printf( + "EFI runtime services table has an invalid pointer\n"); + efi_runtime = NULL; + efi_destroy_1t1_map(); + return (ENXIO); + } + efi_leave(); + return (0); } @@ -405,5 +451,6 @@ static moduledata_t efirt_moddata = { .evhand = efirt_modevents, .priv = NULL, }; -DECLARE_MODULE(efirt, efirt_moddata, SI_SUB_VM_CONF, SI_ORDER_ANY); +/* After fpuinitstate, before efidev */ +DECLARE_MODULE(efirt, efirt_moddata, SI_SUB_DRIVERS, SI_ORDER_SECOND); MODULE_VERSION(efirt, 1); From owner-svn-src-stable-11@freebsd.org Wed Apr 4 13:59:43 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4CF11F91105; Wed, 4 Apr 2018 13:59:43 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F3C6E7CF7F; Wed, 4 Apr 2018 13:59:42 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EEAE7149C8; Wed, 4 Apr 2018 13:59:42 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w34DxgPi014432; Wed, 4 Apr 2018 13:59:42 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w34Dxg9n014431; Wed, 4 Apr 2018 13:59:42 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804041359.w34Dxg9n014431@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 4 Apr 2018 13:59: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: r332029 - stable/11/sys/dev/efidev X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/sys/dev/efidev X-SVN-Commit-Revision: 332029 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Apr 2018 13:59:43 -0000 Author: kevans Date: Wed Apr 4 13:59:42 2018 New Revision: 332029 URL: https://svnweb.freebsd.org/changeset/base/332029 Log: MFC r330844: Correct minor typo in comment, efi_dmcap -> efi_tmcap Modified: stable/11/sys/dev/efidev/efirt.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/efidev/efirt.c ============================================================================== --- stable/11/sys/dev/efidev/efirt.c Wed Apr 4 13:58:18 2018 (r332028) +++ stable/11/sys/dev/efidev/efirt.c Wed Apr 4 13:59:42 2018 (r332029) @@ -315,7 +315,7 @@ efi_get_time(struct efi_tm *tm) /* * UEFI spec states that the Capabilities argument to GetTime is * optional, but some UEFI implementations choke when passed a NULL - * pointer. Pass a dummy efi_dmcap, even though we won't use it, + * pointer. Pass a dummy efi_tmcap, even though we won't use it, * to workaround such implementations. */ error = efi_get_time_locked(tm, &dummy); From owner-svn-src-stable-11@freebsd.org Wed Apr 4 14:01:11 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 42812F91440; Wed, 4 Apr 2018 14:01:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E5B117D1CE; Wed, 4 Apr 2018 14:01:10 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E0ACC149F4; Wed, 4 Apr 2018 14:01:10 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w34E1AuO016262; Wed, 4 Apr 2018 14:01:10 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w34E1ASS016260; Wed, 4 Apr 2018 14:01:10 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804041401.w34E1ASS016260@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 4 Apr 2018 14:01: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: r332030 - stable/11/sys/dev/efidev X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/sys/dev/efidev X-SVN-Commit-Revision: 332030 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Apr 2018 14:01:11 -0000 Author: kevans Date: Wed Apr 4 14:01:10 2018 New Revision: 332030 URL: https://svnweb.freebsd.org/changeset/base/332030 Log: MFC r331413: efidev: Drop a quick note in about efi_cfgtbl/efi_runtime There's no real annotation for it, so it's not immediately obvious to the unfamiliar that these pointers are to locations in the EFI runtime map unlike the system table pointer immediately above them. Modified: stable/11/sys/dev/efidev/efirt.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/efidev/efirt.c ============================================================================== --- stable/11/sys/dev/efidev/efirt.c Wed Apr 4 13:59:42 2018 (r332029) +++ stable/11/sys/dev/efidev/efirt.c Wed Apr 4 14:01:10 2018 (r332030) @@ -57,6 +57,11 @@ __FBSDID("$FreeBSD$"); #include static struct efi_systbl *efi_systbl; +/* + * The following pointers point to tables in the EFI runtime service data pages. + * Care should be taken to make sure that we've properly entered the EFI runtime + * environment (efi_enter()) before dereferencing them. + */ static struct efi_cfgtbl *efi_cfgtbl; static struct efi_rt *efi_runtime; From owner-svn-src-stable-11@freebsd.org Wed Apr 4 14:09:45 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9948FF91BA5; Wed, 4 Apr 2018 14:09:45 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4A5077D7CF; Wed, 4 Apr 2018 14:09:45 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 451DA14B7C; Wed, 4 Apr 2018 14:09:45 +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 w34E9jvj026092; Wed, 4 Apr 2018 14:09:45 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w34E9jZw026090; Wed, 4 Apr 2018 14:09:45 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201804041409.w34E9jZw026090@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 4 Apr 2018 14:09:45 +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: r332031 - 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: 332031 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Apr 2018 14:09:45 -0000 Author: emaste Date: Wed Apr 4 14:09:44 2018 New Revision: 332031 URL: https://svnweb.freebsd.org/changeset/base/332031 Log: MFC r330356 (eadler): sys/linux: Fix a few potential infoleaks in Linux IPC admbugs: 765, 812, 813, 814 Submitted by: Domagoj Stolfa Reported by: Ilja Van Sprundel Reported by: Vlad Tsyrklevich Modified: stable/11/sys/compat/linux/linux_ipc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linux/linux_ipc.c ============================================================================== --- stable/11/sys/compat/linux/linux_ipc.c Wed Apr 4 14:01:10 2018 (r332030) +++ stable/11/sys/compat/linux/linux_ipc.c Wed Apr 4 14:09:44 2018 (r332031) @@ -548,6 +548,9 @@ linux_semctl(struct thread *td, struct linux_semctl_ar register_t rval; int cmd, error; + memset(&linux_seminfo, 0, sizeof(linux_seminfo)); + memset(&linux_semid64, 0, sizeof(linux_semid64)); + switch (args->cmd & ~LINUX_IPC_64) { case LINUX_IPC_RMID: cmd = IPC_RMID; @@ -702,12 +705,15 @@ linux_msgctl(struct thread *td, struct linux_msgctl_ar struct l_msqid64_ds linux_msqid64; struct msqid_ds bsd_msqid; + memset(&linux_msqid64, 0, sizeof(linux_msqid64)); + bsd_cmd = args->cmd & ~LINUX_IPC_64; switch (bsd_cmd) { case LINUX_IPC_INFO: case LINUX_MSG_INFO: { struct l_msginfo linux_msginfo; + memset(&linux_msginfo, 0, sizeof(linux_msginfo)); /* * XXX MSG_INFO uses the same data structure but returns different * dynamic counters in msgpool, msgmap, and msgtql fields. @@ -832,6 +838,10 @@ linux_shmctl(struct thread *td, struct linux_shmctl_ar struct l_shm_info linux_shm_info; struct shmid_ds bsd_shmid; int error; + + memset(&linux_shm_info, 0, sizeof(linux_shm_info)); + memset(&linux_shmid64, 0, sizeof(linux_shmid64)); + memset(&linux_shminfo64, 0, sizeof(linux_shminfo64)); switch (args->cmd & ~LINUX_IPC_64) { From owner-svn-src-stable-11@freebsd.org Wed Apr 4 16:59:11 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C231F9CDD1; Wed, 4 Apr 2018 16:59:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D820D85BCF; Wed, 4 Apr 2018 16:59:10 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D2E8816766; Wed, 4 Apr 2018 16:59:10 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w34GxADK018404; Wed, 4 Apr 2018 16:59:10 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w34GxAep018403; Wed, 4 Apr 2018 16:59:10 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804041659.w34GxAep018403@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 4 Apr 2018 16:59: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: r332037 - stable/11/etc X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/etc X-SVN-Commit-Revision: 332037 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Apr 2018 16:59:11 -0000 Author: kevans Date: Wed Apr 4 16:59:10 2018 New Revision: 332037 URL: https://svnweb.freebsd.org/changeset/base/332037 Log: MFC r307826,r328949: Firstboot fs mount changes MFC r307826: Use checkyesno instead of rolling my own.. MFC r328949: Fix firstboot fs mount logic The firstboot logic has an error which causes the filesystem to be mounted readonly even though root_rw_mount=YES. This fixes the error to ensure that the root filesystem is mounted rw as expected after the run of the firstboot scripts. Modified: stable/11/etc/rc Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/rc ============================================================================== --- stable/11/etc/rc Wed Apr 4 16:28:30 2018 (r332036) +++ stable/11/etc/rc Wed Apr 4 16:59:10 2018 (r332037) @@ -135,16 +135,16 @@ done # Note: this assumes firstboot_sentinel is on / when we have # a read-only /, or that it is on media that's writable. if [ -e ${firstboot_sentinel} ]; then - [ ${root_rw_mount#[Yy][Ee][Ss]} = "" ] || mount -uw / + checkyesno root_rw_mount && mount -uw / chflags -R 0 ${firstboot_sentinel} rm -rf ${firstboot_sentinel} if [ -e ${firstboot_sentinel}-reboot ]; then chflags -R 0 ${firstboot_sentinel}-reboot rm -rf ${firstboot_sentinel}-reboot - [ ${root_rw_mount#[Yy][Ee][Ss]} = "" ] || mount -ur / + checkyesno root_rw_mount || mount -ur / kill -INT 1 fi - [ ${root_rw_mount#[Yy][Ee][Ss]} = "" ] || mount -ur / + checkyesno root_rw_mount || mount -ur / fi echo '' From owner-svn-src-stable-11@freebsd.org Wed Apr 4 17:00:19 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 31AF3F9CE9C; Wed, 4 Apr 2018 17:00:19 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CF06285D38; Wed, 4 Apr 2018 17:00:18 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C9D1A1676A; Wed, 4 Apr 2018 17:00:18 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w34H0IYZ019281; Wed, 4 Apr 2018 17:00:18 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w34H0Ipd019280; Wed, 4 Apr 2018 17:00:18 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804041700.w34H0Ipd019280@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 4 Apr 2018 17:00:18 +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: r332038 - stable/11/etc/rc.d X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/etc/rc.d X-SVN-Commit-Revision: 332038 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Apr 2018 17:00:19 -0000 Author: kevans Date: Wed Apr 4 17:00:18 2018 New Revision: 332038 URL: https://svnweb.freebsd.org/changeset/base/332038 Log: MFC r328951: Refactor cleanvar to remove shell expansion vulnerability If any process creates a directory named "-P" in /var/run or /var/spool/lock it will cause the purgedir function to start to rm -r /. Simplify a lot of complicated shell logic by leveraging find(1). Modified: stable/11/etc/rc.d/cleanvar Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/rc.d/cleanvar ============================================================================== --- stable/11/etc/rc.d/cleanvar Wed Apr 4 16:59:10 2018 (r332037) +++ stable/11/etc/rc.d/cleanvar Wed Apr 4 17:00:18 2018 (r332038) @@ -19,34 +19,6 @@ stop_cmd=":" extra_commands="reload" reload_cmd="${name}_start" -purgedir() -{ - local dir file - - if [ $# -eq 0 ]; then - purgedir . - else - for dir - do - ( - cd "$dir" && for file in .* * - do - # Skip over logging sockets - [ -S "$file" -a "$file" = "log" ] && continue - [ -S "$file" -a "$file" = "logpriv" ] && continue - [ ."$file" = .. -o ."$file" = ... ] && continue - if [ -d "$file" -a ! -L "$file" ] - then - purgedir "$file" - else - rm -f -- "$file" - fi - done - ) - done - fi -} - cleanvar_prestart() { # These files must be removed only the first time this script is run @@ -58,14 +30,17 @@ cleanvar_prestart() cleanvar_start() { if [ -d /var/run -a ! -f /var/run/clean_var ]; then - purgedir /var/run + # Skip over logging sockets + find /var/run \( -type f -or -type s ! -name log -and ! -name logpriv \) -delete >/var/run/clean_var fi if [ -d /var/spool/lock -a ! -f /var/spool/lock/clean_var ]; then - purgedir /var/spool/lock + find /var/spool/lock -type f -delete >/var/spool/lock/clean_var fi - rm -rf /var/spool/uucp/.Temp/* + if [ -d /var/spool/uucp/.Temp ]; then + find /var/spool/uucp/.Temp -delete + fi } load_rc_config $name From owner-svn-src-stable-11@freebsd.org Wed Apr 4 18:06:53 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A9E62F532EC; Wed, 4 Apr 2018 18:06:53 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5182768CF0; Wed, 4 Apr 2018 18:06:53 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4B5E41730F; Wed, 4 Apr 2018 18:06:53 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w34I6rOI084565; Wed, 4 Apr 2018 18:06:53 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w34I6qQU084556; Wed, 4 Apr 2018 18:06:52 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201804041806.w34I6qQU084556@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Wed, 4 Apr 2018 18:06: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: r332040 - in stable/11: share/man/man4 sys/amd64/conf sys/conf sys/dev/ocs_fc sys/modules sys/modules/ocs_fc X-SVN-Group: stable-11 X-SVN-Commit-Author: ken X-SVN-Commit-Paths: in stable/11: share/man/man4 sys/amd64/conf sys/conf sys/dev/ocs_fc sys/modules sys/modules/ocs_fc X-SVN-Commit-Revision: 332040 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Apr 2018 18:06:53 -0000 Author: ken Date: Wed Apr 4 18:06:52 2018 New Revision: 332040 URL: https://svnweb.freebsd.org/changeset/base/332040 Log: MFC r331766, r331768: ------------------------------------------------------------------------ r331766 | ken | 2018-03-30 09:28:25 -0600 (Fri, 30 Mar 2018) | 25 lines Bring in the Broadcom/Emulex Fibre Channel driver, ocs_fc(4). The ocs_fc(4) driver supports the following hardware: Emulex 16/8G FC GEN 5 HBAS LPe15004 FC Host Bus Adapters LPe160XX FC Host Bus Adapters Emulex 32/16G FC GEN 6 HBAS LPe3100X FC Host Bus Adapters LPe3200X FC Host Bus Adapters The driver supports target and initiator mode, and also supports FC-Tape. Note that the driver only currently works on little endian platforms. It is only included in the module build for amd64 and i386, and in GENERIC on amd64 only. Submitted by: Ram Kishore Vegesna Reviewed by: mav Relnotes: yes Sponsored by: Broadcom Differential Revision: https://reviews.freebsd.org/D11423 ------------------------------------------------------------------------ r331768 | cem | 2018-03-30 10:44:54 -0600 (Fri, 30 Mar 2018) | 9 lines ocs_fc(4): Fix GCC build (-Wredundant-decls) These objects are defined earlier in the same file; an extern declaration after definition is redundant. Broken in r331766 (introduction of ocs_fc(4)). Sponsored by: Dell EMC Isilon ------------------------------------------------------------------------ Differential Revision: https://reviews.freebsd.org/D11423 Relnotes: yes Added: stable/11/share/man/man4/ocs_fc.4 - copied unchanged from r331766, head/share/man/man4/ocs_fc.4 stable/11/sys/dev/ocs_fc/ - copied from r331766, head/sys/dev/ocs_fc/ stable/11/sys/modules/ocs_fc/ - copied from r331766, head/sys/modules/ocs_fc/ Modified: stable/11/share/man/man4/Makefile stable/11/sys/amd64/conf/GENERIC stable/11/sys/conf/files stable/11/sys/dev/ocs_fc/sli4.c stable/11/sys/modules/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/Makefile ============================================================================== --- stable/11/share/man/man4/Makefile Wed Apr 4 17:45:05 2018 (r332039) +++ stable/11/share/man/man4/Makefile Wed Apr 4 18:06:52 2018 (r332040) @@ -402,6 +402,7 @@ MAN= aac.4 \ ${_nvram2env.4} \ ${_nxge.4} \ oce.4 \ + ocs_fc.4\ ohci.4 \ orm.4 \ ow.4 \ Copied: stable/11/share/man/man4/ocs_fc.4 (from r331766, head/share/man/man4/ocs_fc.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/share/man/man4/ocs_fc.4 Wed Apr 4 18:06:52 2018 (r332040, copy of r331766, head/share/man/man4/ocs_fc.4) @@ -0,0 +1,194 @@ +.\" Copyright (c) 2017 Broadcom. All rights reserved. +.\" The term "Broadcom" refers to Broadcom Limited and/or its subsidiaries. +.\" +.\" 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 copyright holder 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 HOLDER OR CONTRIBUTORS BE +.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd March 30, 2018 +.Dt OCS_FC 4 +.Os +.Sh NAME +.Nm ocs_fc +.Nd "Device driver for Emulex Fibre Channel Host Adapters" +.Sh SYNOPSIS +To compile this driver into the kernel, add this line to the +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device ocs_fc" +.Ed +.Pp +To load the driver as a module at boot, add this line to +.Xr loader.conf 5 : +.Bd -literal -offset indent +ocs_fc_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides access to Fibre Channel SCSI devices. +.Pp +The +.Nm +driver supports initiator and target modes. +Support is available for Arbitrated loops, Point-to-Point, +and Fabric connections. +FC-Tape is highly recommended for connections to tape drives that support +it. +FC-Tape includes four elements from the T-10 FCP-4 specification: +.Bl -bullet -offset indent +.It +Precise Delivery of Commands +.It +Confirmed Completion of FCP I/O Operations +.It +Retransmission of Unsuccessfully Transmitted IUs +.It +Task Retry Identification +.El +.Pp +Together these features allow for link level error recovery with tape +devices. +Without link level error recovery, an initiator cannot, for instance, tell whether a tape write +command that has timed out resulted in all, part, or none of the data going to +the tape drive. +FC-Tape is automatically enabled when both the controller and target support it. + +.Sh HARDWARE +The +.Nm +driver supports these Fibre Channel adapters: +.Bl -tag -width xxxxxx -offset indent +.It Emulex 16/8G FC GEN 5 HBAS +.Bd -literal -offset indent +LPe15004 FC Host Bus Adapters +LPe160XX FC Host Bus Adapters +.Ed +.It Emulex 32/16G FC GEN 6 HBAS +.Bd -literal -offset indent +LPe3100X FC Host Bus Adapters +LPe3200X FC Host Bus Adapters +.Ed +.El +.Sh UPDATING FIRMWARE +Adapter firmware updates are persistent. +.Pp +Firmware can be updated by following these steps: +.Bl -enum +.It +Copy this code to a +.Pa Makefile : +.Bd -literal -offset indent +KMOD=ocsflash +FIRMWS=imagename.grp:ocsflash +\&.include +.Ed +.It +Replace +.Pa imagename +with the name of the GRP file. +.It +Copy the +.Pa Makefile +and GRP file to a local directory +.It +Execute +.Cm make +and copy the generated +.Pa ocsflash.ko +file to +.Pa /lib/modules +.It +.Cm sysctl dev.ocs_fc..fw_upgrade=ocsflash +.It +Check kernel messages regarding status of the operation +.It +Reboot the machine +.El +.Pp +.Sh BOOT OPTIONS +Options are controlled by setting values in +.Pa /boot/device.hints . +.Pp +They are: +.Bl -tag -width indent +.It Va hint.ocs_fc.N.initiator +Enable initiator functionality. +Default 1 (enabled), 0 to disable. +.It Va hint.ocs_fc.N.target +Enable target functionality. +Default 1 (enabled), 0 to disable. +.It Va hint.ocs_fc.N.topology +Topology: 0 for Auto, 1 for NPort only, 2 for Loop only. +.It Va hint.ocs_fc.N.speed +Link speed in megabits per second. +Possible values include: +0 Auto-speed negotiation (default), 4000 (4GFC), 8000 (8GFC), 16000 (16GFC). +.El +.Sh SYSCTL OPTIONS +.Bl -tag -width indent +.It Va dev.ocs_fc.N.port_state +Port state (read/write). +Valid values are +.Li online +and +.Li offline . +.It Va dev.ocs_fc.N.wwpn +World Wide Port Name (read/write). +.It Va dev.ocs_fc.N.wwnn +World Wide Node Name (read/write). +.It Va dev.ocs_fc.N.fwrev +Firmware revision (read-only). +.It Va dev.ocs_fc.N.sn +Adapter serial number (read-only). +.It Va dev.ocs_fc.N.configured_speed +Configured Port Speed (read/write). +Valid values are: +0 Auto-speed negotiation (default), 4000 (4GFC), 8000 (8GFC), 16000 (16GFC). +.It Va dev.ocs_fc.N.configured_topology +Configured Port Topology (read/write). +Valid values are: +0-Auto; 1-NPort; 2-Loop. +.It Va dev.ocs_fc.N.current_speed +Current Port Speed (read-only). +.It Va dev.ocs_fc.N.current_topology +Current Port Topology (read-only). +.El +.Sh SUPPORT +For general information and support, +go to the Broadcom website at: +.Pa http://www.broadcom.com/ +or E-Mail at +.Pa ocs-driver-team.pdl@broadcom.com. +.Sh SEE ALSO +.Xr ifconfig 8 +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Broadcom. Modified: stable/11/sys/amd64/conf/GENERIC ============================================================================== --- stable/11/sys/amd64/conf/GENERIC Wed Apr 4 17:45:05 2018 (r332039) +++ stable/11/sys/amd64/conf/GENERIC Wed Apr 4 18:06:52 2018 (r332040) @@ -130,6 +130,7 @@ device adw # Advansys wide SCSI adapters device aic # Adaptec 15[012]x SCSI adapters, AIC-6[23]60. device bt # Buslogic/Mylex MultiMaster SCSI adapters device isci # Intel C600 SAS controller +device ocs_fc # Emulex FC adapters # ATA/SCSI peripherals device scbus # SCSI bus (required for ATA/SCSI) Modified: stable/11/sys/conf/files ============================================================================== --- stable/11/sys/conf/files Wed Apr 4 17:45:05 2018 (r332039) +++ stable/11/sys/conf/files Wed Apr 4 18:06:52 2018 (r332040) @@ -2498,6 +2498,27 @@ dev/oce/oce_mbox.c optional oce pci dev/oce/oce_queue.c optional oce pci dev/oce/oce_sysctl.c optional oce pci dev/oce/oce_util.c optional oce pci +dev/ocs_fc/ocs_pci.c optional ocs_fc pci +dev/ocs_fc/ocs_ioctl.c optional ocs_fc pci +dev/ocs_fc/ocs_os.c optional ocs_fc pci +dev/ocs_fc/ocs_utils.c optional ocs_fc pci +dev/ocs_fc/ocs_hw.c optional ocs_fc pci +dev/ocs_fc/ocs_hw_queues.c optional ocs_fc pci +dev/ocs_fc/sli4.c optional ocs_fc pci +dev/ocs_fc/ocs_sm.c optional ocs_fc pci +dev/ocs_fc/ocs_device.c optional ocs_fc pci +dev/ocs_fc/ocs_xport.c optional ocs_fc pci +dev/ocs_fc/ocs_domain.c optional ocs_fc pci +dev/ocs_fc/ocs_sport.c optional ocs_fc pci +dev/ocs_fc/ocs_els.c optional ocs_fc pci +dev/ocs_fc/ocs_fabric.c optional ocs_fc pci +dev/ocs_fc/ocs_io.c optional ocs_fc pci +dev/ocs_fc/ocs_node.c optional ocs_fc pci +dev/ocs_fc/ocs_scsi.c optional ocs_fc pci +dev/ocs_fc/ocs_unsol.c optional ocs_fc pci +dev/ocs_fc/ocs_ddump.c optional ocs_fc pci +dev/ocs_fc/ocs_mgmt.c optional ocs_fc pci +dev/ocs_fc/ocs_cam.c optional ocs_fc pci dev/ofw/ofw_bus_if.m optional fdt dev/ofw/ofw_bus_subr.c optional fdt dev/ofw/ofw_fdt.c optional fdt Modified: stable/11/sys/dev/ocs_fc/sli4.c ============================================================================== --- head/sys/dev/ocs_fc/sli4.c Fri Mar 30 15:28:25 2018 (r331766) +++ stable/11/sys/dev/ocs_fc/sli4.c Wed Apr 4 18:06:52 2018 (r332040) @@ -5758,9 +5758,6 @@ int32_t sli_link_is_configurable(sli4_t *sli) /* vim: set noexpandtab textwidth=120: */ -extern const char *SLI_QNAME[]; -extern const sli4_reg_t regmap[SLI4_REG_MAX][SLI4_MAX_IF_TYPES]; - /** * @ingroup sli_fc * @brief Write an FCOE_WQ_CREATE command. Modified: stable/11/sys/modules/Makefile ============================================================================== --- stable/11/sys/modules/Makefile Wed Apr 4 17:45:05 2018 (r332039) +++ stable/11/sys/modules/Makefile Wed Apr 4 18:06:52 2018 (r332040) @@ -294,6 +294,7 @@ SUBDIR= \ ${_nvram} \ ${_nxge} \ oce \ + ${_ocs_fc} \ otus \ ${_otusfw} \ ow \ @@ -609,6 +610,7 @@ _lio= lio .endif _nctgpio= nctgpio _ndis= ndis +_ocs_fc= ocs_fc _pccard= pccard .if ${MK_OFED} != "no" || defined(ALL_MODULES) _rdma= rdma From owner-svn-src-stable-11@freebsd.org Wed Apr 4 20:29:56 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 777F1F73F7B; Wed, 4 Apr 2018 20:29:56 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 27BAF72185; Wed, 4 Apr 2018 20:29:56 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1E16A18A14; Wed, 4 Apr 2018 20:29:56 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w34KTtfb007946; Wed, 4 Apr 2018 20:29:55 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w34KTt2l007945; Wed, 4 Apr 2018 20:29:55 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201804042029.w34KTt2l007945@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Wed, 4 Apr 2018 20:29: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: r332044 - stable/11/share/termcap X-SVN-Group: stable-11 X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: stable/11/share/termcap X-SVN-Commit-Revision: 332044 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Apr 2018 20:29:56 -0000 Author: bapt Date: Wed Apr 4 20:29:55 2018 New Revision: 332044 URL: https://svnweb.freebsd.org/changeset/base/332044 Log: MFC r331005-r331006 r331005: Fix tab vs space indentation r331006: Add termcap entries for the st terminal (https://st.suckless.org) Modified: stable/11/share/termcap/termcap Directory Properties: stable/11/ (props changed) Modified: stable/11/share/termcap/termcap ============================================================================== --- stable/11/share/termcap/termcap Wed Apr 4 20:15:41 2018 (r332043) +++ stable/11/share/termcap/termcap Wed Apr 4 20:29:55 2018 (r332044) @@ -4664,24 +4664,61 @@ Eterm|Eterm Terminal Emulator (X11 Window System):\ # Termcap for xterm-termite xterm-termite|VTE-based terminal:\ - :NP:am:hs:mi:ms:ut:xn:\ - :Co#256:co#80:it#8:li#24:pa#32767:\ - :@7=\EOF:@8=\EOM:AB=\E[48;5;%dm:AF=\E[38;5;%dm:AL=\E[%dL:\ - :DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:F1=\E[23~:F2=\E[24~:\ - :IC=\E[%d@:K2=\EOE:Km=\E[M:LE=\E[%dD:RA=\E[?7l:RI=\E[%dC:\ - :SA=\E[?7h:SF=\E[%dS:SR=\E[%dT:UP=\E[%dA:ZH=\E[3m:\ - :ZR=\E[23m:al=\E[L:bl=^G:bt=\E[Z:cb=\E[1K:cd=\E[J:ce=\E[K:\ - :ch=\E[%i%dG:cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:\ - :cs=\E[%i%d;%dr:cv=\E[%i%dd:dc=\E[P:dl=\E[M:do=^J:\ - :ds=\E]2;\007:ec=\E[%dX:ei=\E[4l:fs=^G:ho=\E[H:im=\E[4h:\ - :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\E[15~:k6=\E[17~:\ - :k7=\E[18~:k8=\E[19~:k9=\E[20~:k;=\E[21~:kB=\E[Z:kD=\E[3~:\ - :kI=\E[2~:kN=\E[6~:kP=\E[5~:kb=\177:kd=\EOB:ke=\E[?1l:\ - :kh=\EOH:kl=\EOD:kr=\EOC:ks=\E[?1h:ku=\EOA:le=^H:md=\E[1m:\ - :me=\E[m:mr=\E[7m:nd=\E[C:op=\E[39;49m:r1=\Ec:rc=\E8:\ - :sc=\E7:se=\E[27m:sf=^J:so=\E[7m:sr=\EM:ta=^I:te=\E[?1049l:\ - :ti=\E[?1049h:ts=\E]2;:u6=\E[%i%d;%dR:u7=\E[6n:ue=\E[24m:\ - :up=\E[A:us=\E[4m:ve=\E[?25h:vi=\E[?25l: + :NP:am:hs:mi:ms:ut:xn:\ + :Co#256:co#80:it#8:li#24:pa#32767:\ + :@7=\EOF:@8=\EOM:AB=\E[48;5;%dm:AF=\E[38;5;%dm:AL=\E[%dL:\ + :DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:F1=\E[23~:F2=\E[24~:\ + :IC=\E[%d@:K2=\EOE:Km=\E[M:LE=\E[%dD:RA=\E[?7l:RI=\E[%dC:\ + :SA=\E[?7h:SF=\E[%dS:SR=\E[%dT:UP=\E[%dA:ZH=\E[3m:\ + :ZR=\E[23m:al=\E[L:bl=^G:bt=\E[Z:cb=\E[1K:cd=\E[J:ce=\E[K:\ + :ch=\E[%i%dG:cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:\ + :cs=\E[%i%d;%dr:cv=\E[%i%dd:dc=\E[P:dl=\E[M:do=^J:\ + :ds=\E]2;\007:ec=\E[%dX:ei=\E[4l:fs=^G:ho=\E[H:im=\E[4h:\ + :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\E[15~:k6=\E[17~:\ + :k7=\E[18~:k8=\E[19~:k9=\E[20~:k;=\E[21~:kB=\E[Z:kD=\E[3~:\ + :kI=\E[2~:kN=\E[6~:kP=\E[5~:kb=\177:kd=\EOB:ke=\E[?1l:\ + :kh=\EOH:kl=\EOD:kr=\EOC:ks=\E[?1h:ku=\EOA:le=^H:md=\E[1m:\ + :me=\E[m:mr=\E[7m:nd=\E[C:op=\E[39;49m:r1=\Ec:rc=\E8:\ + :sc=\E7:se=\E[27m:sf=^J:so=\E[7m:sr=\EM:ta=^I:te=\E[?1049l:\ + :ti=\E[?1049h:ts=\E]2;:u6=\E[%i%d;%dR:u7=\E[6n:ue=\E[24m:\ + :up=\E[A:us=\E[4m:ve=\E[?25h:vi=\E[?25l: + +# Termcap for st terminal taken from the st-0.8 sources +st|simpleterm:\ + :am:hs:mi:ms:xn:\ + :co#80:it#8:li#24:\ + :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ + :K1=\E[1~:K2=\EOu:K3=\E[5~:K4=\E[4~:K5=\E[6~:LE=\E[%dD:\ + :RI=\E[%dC:SF=\E[%dS:UP=\E[%dA:ae=\E(B:al=\E[L:as=\E(0:\ + :bl=^G:bt=\E[Z:cd=\E[J:ce=\E[K:cl=\E[H\E[2J:\ + :cm=\E[%i%d;%dH:cr=\r:cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:\ + :dl=\E[M:do=\n:ec=\E[%dX:ei=\E[4l:fs=^G:ho=\E[H:im=\E[4h:\ + :is=\E[4l\E>\E[?1034l:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:\ + :k5=\E[15~:k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:\ + :kD=\E[3~:kI=\E[2~:kN=\E[6~:kP=\E[5~:kb=\177:kd=\EOB:\ + :ke=\E[?1l\E>:kh=\E[1~:kl=\EOD:kr=\EOC:ks=\E[?1h\E=:\ + :ku=\EOA:le=^H:mb=\E[5m:md=\E[1m:me=\E[0m:mh=\E[2m:\ + :mr=\E[7m:nd=\E[C:rc=\E8:sc=\E7:se=\E[27m:sf=\n:so=\E[7m:\ + :sr=\EM:st=\EH:ta=^I:te=\E[?1049l:ti=\E[?1049h:ts=\E]0;:\ + :ue=\E[24m:up=\E[A:us=\E[4m:vb=\E[?5h\E[?5l:\ + :ve=\E[?12l\E[?25h:vi=\E[?25l:vs=\E[?25h: + +st-256color|simpleterm with 256 colors:\ + :cc:\ + :Co#256:pa#32767:\ + :AB=\E[48;5;%dm:AF=\E[38;5;%dm:\ + :..Ic=\E]4;%p1%d;rgb\:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\\:\ + :oc=\E]104\007:tc=st: + +st-meta|simpleterm with meta key:\ + :km:\ + :is=\E[4l\E>\E[?1034h:mm=\E[?1034h:mo=\E[?1034l:\ + :rs=\E[4l\E>\E[?1034h:tc=st: + +st-meta-256color|simpleterm with meta key and 256 colors:\ + :km:\ + :is=\E[4l\E>\E[?1034h:mm=\E[?1034h:mo=\E[?1034l:\ + :rs=\E[4l\E>\E[?1034h:tc=st-256color: # # END OF TERMCAP From owner-svn-src-stable-11@freebsd.org Wed Apr 4 23:30:20 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 539E4F7FA22; Wed, 4 Apr 2018 23:30:20 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0610279E98; Wed, 4 Apr 2018 23:30:20 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 00FE11A7AF; Wed, 4 Apr 2018 23:30:20 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w34NUJhN053515; Wed, 4 Apr 2018 23:30:19 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w34NUJHV053514; Wed, 4 Apr 2018 23:30:19 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804042330.w34NUJHV053514@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 4 Apr 2018 23:30:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332051 - stable/11 X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11 X-SVN-Commit-Revision: 332051 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Apr 2018 23:30:20 -0000 Author: kevans Date: Wed Apr 4 23:30:19 2018 New Revision: 332051 URL: https://svnweb.freebsd.org/changeset/base/332051 Log: Record-only MFC of r325365, r325564 r325365 fixed a bug in patch(1) that would cause a match if we ran out of context, say, at the beginning/end of a file. r325564 reverted it at the request of antoine until an exp-run could be completed to fix all of the ports with broken patches. r325365 was later committed as r326084, which has already been MFC'd. Modified: Directory Properties: stable/11/ (props changed) From owner-svn-src-stable-11@freebsd.org Wed Apr 4 23:53:31 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F1A0BF810A8; Wed, 4 Apr 2018 23:53:30 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8EAD87ACD7; Wed, 4 Apr 2018 23:53:30 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 86B351AC7A; Wed, 4 Apr 2018 23:53:30 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w34NrUAT075217; Wed, 4 Apr 2018 23:53:30 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w34NrTxq075208; Wed, 4 Apr 2018 23:53:29 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201804042353.w34NrTxq075208@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Wed, 4 Apr 2018 23:53:29 +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: r332052 - stable/11/sys/dev/qlxgbe X-SVN-Group: stable-11 X-SVN-Commit-Author: davidcs X-SVN-Commit-Paths: stable/11/sys/dev/qlxgbe X-SVN-Commit-Revision: 332052 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Apr 2018 23:53:31 -0000 Author: davidcs Date: Wed Apr 4 23:53:29 2018 New Revision: 332052 URL: https://svnweb.freebsd.org/changeset/base/332052 Log: MFC r331739 1. Add additional debug prints. 2. Break transmit when IFF_DRV_RUNNING is OFF. 3. set desc_count=0 for default case in switch in ql_rcv_isr() Modified: stable/11/sys/dev/qlxgbe/ql_dbg.h stable/11/sys/dev/qlxgbe/ql_hw.c stable/11/sys/dev/qlxgbe/ql_ioctl.c stable/11/sys/dev/qlxgbe/ql_isr.c stable/11/sys/dev/qlxgbe/ql_os.c stable/11/sys/dev/qlxgbe/ql_ver.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/qlxgbe/ql_dbg.h ============================================================================== --- stable/11/sys/dev/qlxgbe/ql_dbg.h Wed Apr 4 23:30:19 2018 (r332051) +++ stable/11/sys/dev/qlxgbe/ql_dbg.h Wed Apr 4 23:53:29 2018 (r332052) @@ -57,6 +57,7 @@ extern void ql_dump_buf32(qla_host_t *ha, const char * #define INJCT_SGL_RCV_INV_DESC_COUNT 0x0000D #define INJCT_SGL_LRO_INV_DESC_COUNT 0x0000E #define INJCT_PEER_PORT_FAILURE_ERR_RECOVERY 0x0000F +#define INJCT_TXBUF_MBUF_NON_NULL 0x00010 #ifdef QL_DBG Modified: stable/11/sys/dev/qlxgbe/ql_hw.c ============================================================================== --- stable/11/sys/dev/qlxgbe/ql_hw.c Wed Apr 4 23:30:19 2018 (r332051) +++ stable/11/sys/dev/qlxgbe/ql_hw.c Wed Apr 4 23:53:29 2018 (r332052) @@ -1088,7 +1088,11 @@ ql_hw_add_sysctls(qla_host_t *ha) "\t\t\t 8: mbx: mailbox command failure\n" "\t\t\t 9: heartbeat failure\n" "\t\t\t A: temperature failure\n" - "\t\t\t 11: m_getcl or m_getjcl failure\n" ); + "\t\t\t 11: m_getcl or m_getjcl failure\n" + "\t\t\t 13: Invalid Descriptor Count in SGL Receive\n" + "\t\t\t 14: Invalid Descriptor Count in LRO Receive\n" + "\t\t\t 15: peer port error recovery failure\n" + "\t\t\t 16: tx_buf[next_prod_index].mbuf != NULL\n" ); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), @@ -2904,7 +2908,7 @@ ql_del_hw_if_exit: void qla_confirm_9kb_enable(qla_host_t *ha) { - uint32_t supports_9kb = 0; +// uint32_t supports_9kb = 0; ha->hw.mbx_intr_mask_offset = READ_REG32(ha, Q8_MBOX_INT_MASK_MSIX); @@ -2912,10 +2916,12 @@ qla_confirm_9kb_enable(qla_host_t *ha) WRITE_REG32(ha, Q8_MBOX_INT_ENABLE, BIT_2); WRITE_REG32(ha, ha->hw.mbx_intr_mask_offset, 0x0); +#if 0 qla_get_nic_partition(ha, &supports_9kb, NULL); if (!supports_9kb) - ha->hw.enable_9kb = 0; +#endif + ha->hw.enable_9kb = 0; return; } @@ -3587,6 +3593,13 @@ qla_hw_all_mcast(qla_host_t *ha, uint32_t add_mcast) bcopy(ha->hw.mcast[i].addr, mcast, ETHER_ADDR_LEN); mcast = mcast + ETHER_ADDR_LEN; count++; + + device_printf(ha->pci_dev, + "%s: %x:%x:%x:%x:%x:%x \n", + __func__, ha->hw.mcast[i].addr[0], + ha->hw.mcast[i].addr[1], ha->hw.mcast[i].addr[2], + ha->hw.mcast[i].addr[3], ha->hw.mcast[i].addr[4], + ha->hw.mcast[i].addr[5]); if (count == Q8_MAX_MAC_ADDRS) { if (qla_config_mac_addr(ha, ha->hw.mac_addr_arr, @@ -3823,6 +3836,18 @@ ql_hw_tx_done_locked(qla_host_t *ha, uint32_t txr_idx) } hw_tx_cntxt->txr_free += comp_count; + + if (hw_tx_cntxt->txr_free > NUM_TX_DESCRIPTORS) + device_printf(ha->pci_dev, "%s [%d]: txr_idx = %d txr_free = %d" + "txr_next = %d txr_comp = %d\n", __func__, __LINE__, + txr_idx, hw_tx_cntxt->txr_free, + hw_tx_cntxt->txr_next, hw_tx_cntxt->txr_comp); + + QL_ASSERT(ha, (hw_tx_cntxt->txr_free <= NUM_TX_DESCRIPTORS), \ + ("%s [%d]: txr_idx = %d txr_free = %d txr_next = %d txr_comp = %d\n",\ + __func__, __LINE__, txr_idx, hw_tx_cntxt->txr_free, \ + hw_tx_cntxt->txr_next, hw_tx_cntxt->txr_comp)); + return; } @@ -3959,7 +3984,9 @@ qla_init_nic_func(qla_host_t *ha) if (err) { device_printf(dev, "%s: failed [0x%08x]\n", __func__, err); - } + } else { + device_printf(dev, "%s: successful\n", __func__); + } return 0; } Modified: stable/11/sys/dev/qlxgbe/ql_ioctl.c ============================================================================== --- stable/11/sys/dev/qlxgbe/ql_ioctl.c Wed Apr 4 23:30:19 2018 (r332051) +++ stable/11/sys/dev/qlxgbe/ql_ioctl.c Wed Apr 4 23:53:29 2018 (r332052) @@ -267,7 +267,8 @@ ql_eioctl(struct cdev *dev, u_long cmd, caddr_t data, } } else { - if (QLA_LOCK(ha, __func__, QLA_LOCK_DEFAULT_MS_TIMEOUT, 0) == 0) { +#define QLA_LOCK_MDUMP_MS_TIMEOUT (QLA_LOCK_DEFAULT_MS_TIMEOUT * 5) + if (QLA_LOCK(ha, __func__, QLA_LOCK_MDUMP_MS_TIMEOUT, 0) == 0) { if (!ha->hw.mdump_done) { fw_dump->saved = 0; QL_INITIATE_RECOVERY(ha); @@ -301,7 +302,7 @@ ql_eioctl(struct cdev *dev, u_long cmd, caddr_t data, } fw_dump->usec_ts = ha->hw.mdump_usec_ts; - if (QLA_LOCK(ha, __func__, QLA_LOCK_DEFAULT_MS_TIMEOUT, 0) == 0) { + if (QLA_LOCK(ha, __func__, QLA_LOCK_MDUMP_MS_TIMEOUT, 0) == 0) { ha->hw.mdump_done = 0; QLA_UNLOCK(ha, __func__); } else { Modified: stable/11/sys/dev/qlxgbe/ql_isr.c ============================================================================== --- stable/11/sys/dev/qlxgbe/ql_isr.c Wed Apr 4 23:30:19 2018 (r332051) +++ stable/11/sys/dev/qlxgbe/ql_isr.c Wed Apr 4 23:53:29 2018 (r332052) @@ -701,6 +701,7 @@ ql_rcv_isr(qla_host_t *ha, uint32_t sds_idx, uint32_t break; default: + desc_count = 0; device_printf(dev, "%s: default 0x%llx!\n", __func__, (long long unsigned int)sdesc->data[0]); break; Modified: stable/11/sys/dev/qlxgbe/ql_os.c ============================================================================== --- stable/11/sys/dev/qlxgbe/ql_os.c Wed Apr 4 23:30:19 2018 (r332051) +++ stable/11/sys/dev/qlxgbe/ql_os.c Wed Apr 4 23:53:29 2018 (r332052) @@ -1287,13 +1287,20 @@ qla_send(qla_host_t *ha, struct mbuf **m_headp, uint32 tx_idx = ha->hw.tx_cntxt[txr_idx].txr_next; - if (NULL != ha->tx_ring[txr_idx].tx_buf[tx_idx].m_head) { + if ((NULL != ha->tx_ring[txr_idx].tx_buf[tx_idx].m_head) || + (QL_ERR_INJECT(ha, INJCT_TXBUF_MBUF_NON_NULL))){ QL_ASSERT(ha, 0, ("%s [%d]: txr_idx = %d tx_idx = %d "\ "mbuf = %p\n", __func__, __LINE__, txr_idx, tx_idx,\ ha->tx_ring[txr_idx].tx_buf[tx_idx].m_head)); + + device_printf(ha->pci_dev, "%s [%d]: txr_idx = %d tx_idx = %d " + "mbuf = %p\n", __func__, __LINE__, txr_idx, tx_idx, + ha->tx_ring[txr_idx].tx_buf[tx_idx].m_head); + if (m_head) m_freem(m_head); *m_headp = NULL; + QL_INITIATE_RECOVERY(ha); return (ret); } @@ -1426,8 +1433,8 @@ qla_fp_taskqueue(void *context, int pending) qla_tx_fp_t *fp; qla_host_t *ha; struct ifnet *ifp; - struct mbuf *mp; - int ret; + struct mbuf *mp = NULL; + int ret = 0; uint32_t txr_idx; uint32_t iscsi_pdu = 0; uint32_t rx_pkts_left = -1; @@ -1451,7 +1458,7 @@ qla_fp_taskqueue(void *context, int pending) } while (rx_pkts_left && !ha->stop_rcv && - (ifp->if_drv_flags & IFF_DRV_RUNNING)) { + (ifp->if_drv_flags & IFF_DRV_RUNNING) && ha->hw.link_up) { rx_pkts_left = ql_rcv_isr(ha, fp->txr_idx, 64); #ifdef QL_ENABLE_ISCSI_TLV @@ -1496,13 +1503,18 @@ qla_fp_taskqueue(void *context, int pending) /* Send a copy of the frame to the BPF listener */ ETHER_BPF_MTAP(ifp, mp); - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + + if (((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) || + (!ha->hw.link_up)) break; mp = drbr_peek(ifp, fp->tx_br); } } mtx_unlock(&fp->tx_mtx); + + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + goto qla_fp_taskqueue_exit; qla_fp_taskqueue_exit0: Modified: stable/11/sys/dev/qlxgbe/ql_ver.h ============================================================================== --- stable/11/sys/dev/qlxgbe/ql_ver.h Wed Apr 4 23:30:19 2018 (r332051) +++ stable/11/sys/dev/qlxgbe/ql_ver.h Wed Apr 4 23:53:29 2018 (r332052) @@ -36,6 +36,6 @@ #define QLA_VERSION_MAJOR 3 #define QLA_VERSION_MINOR 10 -#define QLA_VERSION_BUILD 36 +#define QLA_VERSION_BUILD 37 #endif /* #ifndef _QL_VER_H_ */ From owner-svn-src-stable-11@freebsd.org Thu Apr 5 00:41:34 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 21EC0F83F92; Thu, 5 Apr 2018 00:41:34 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BA6577CCD1; Thu, 5 Apr 2018 00:41:33 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B54B51B434; Thu, 5 Apr 2018 00:41:33 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w350fX9C009885; Thu, 5 Apr 2018 00:41:33 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w350fXF1009884; Thu, 5 Apr 2018 00:41:33 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804050041.w350fXF1009884@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 5 Apr 2018 00:41:33 +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: r332056 - stable/11/stand/i386/libi386 X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/stand/i386/libi386 X-SVN-Commit-Revision: 332056 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Apr 2018 00:41:34 -0000 Author: kevans Date: Thu Apr 5 00:41:33 2018 New Revision: 332056 URL: https://svnweb.freebsd.org/changeset/base/332056 Log: MFC r331718: stand: Add workaround for HP BIOS issues hrs@ and kuriyama@ have found that on some HP BIOS, a system will fail to boot immediately after installation with the claim that it can't work out which disk they are booting from. They tracked it down to a buffer overrun, and found that it could be alleviated by doing a dummy read before-hand. Modified: stable/11/stand/i386/libi386/biosdisk.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/i386/libi386/biosdisk.c ============================================================================== --- stable/11/stand/i386/libi386/biosdisk.c Thu Apr 5 00:32:01 2018 (r332055) +++ stable/11/stand/i386/libi386/biosdisk.c Thu Apr 5 00:41:33 2018 (r332056) @@ -122,6 +122,8 @@ static int nbdinfo = 0; #define BD(dev) (bdinfo[(dev)->d_unit]) +static void bd_io_workaround(struct disk_devdesc *dev); + static int bd_read(struct disk_devdesc *dev, daddr_t dblk, int blks, caddr_t dest); static int bd_write(struct disk_devdesc *dev, daddr_t dblk, int blks, @@ -726,6 +728,15 @@ bd_chs_io(struct disk_devdesc *dev, daddr_t dblk, int return (0); } +static void +bd_io_workaround(struct disk_devdesc *dev) +{ + uint8_t buf[8 * 1024]; + + bd_edd_io(dev, 0xffffffff, 1, (caddr_t)buf, 0); +} + + static int bd_io(struct disk_devdesc *dev, daddr_t dblk, int blks, caddr_t dest, int write) { @@ -738,6 +749,17 @@ bd_io(struct disk_devdesc *dev, daddr_t dblk, int blks resid = blks; p = dest; + + /* + * Workaround for a problem with some HP ProLiant BIOS failing to work out + * the boot disk after installation. hrs and kuriyama discovered this + * problem with an HP ProLiant DL320e Gen 8 with a 3TB HDD, and discovered + * that an int13h call seems to cause a buffer overrun in the bios. The + * problem is alleviated by doing an extra read before the buggy read. It + * is not immediately known whether other models are similarly affected. + */ + if (dblk >= 0x100000000) + bd_io_workaround(dev); /* Decide whether we have to bounce */ if (VTOP(dest) >> 20 != 0 || (BD(dev).bd_unit < 0x80 && From owner-svn-src-stable-11@freebsd.org Thu Apr 5 12:48:58 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ADD72F82C62; Thu, 5 Apr 2018 12:48:58 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6149879B0C; Thu, 5 Apr 2018 12:48:58 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5C3C522C94; Thu, 5 Apr 2018 12:48:58 +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 w35Cmw42070314; Thu, 5 Apr 2018 12:48:58 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w35Cmw0M070313; Thu, 5 Apr 2018 12:48:58 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201804051248.w35Cmw0M070313@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 5 Apr 2018 12:48:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332062 - 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: 332062 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Apr 2018 12:48:58 -0000 Author: emaste Date: Thu Apr 5 12:48:58 2018 New Revision: 332062 URL: https://svnweb.freebsd.org/changeset/base/332062 Log: MFC r332034: linux_ioctl_hdio: fix kernel memory disclosure Stack-allocated struct linux_hd_big_geometry has undeclared padding copied to userland. admbugs: 765 Reported by: Vlad Tsyrklevich Security: Kernel memory disclosure Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/compat/linux/linux_ioctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linux/linux_ioctl.c ============================================================================== --- stable/11/sys/compat/linux/linux_ioctl.c Thu Apr 5 11:03:21 2018 (r332061) +++ stable/11/sys/compat/linux/linux_ioctl.c Thu Apr 5 12:48:58 2018 (r332062) @@ -253,6 +253,7 @@ linux_ioctl_hdio(struct thread *td, struct linux_ioctl } else if ((args->cmd & 0xffff) == LINUX_HDIO_GET_GEO_BIG) { struct linux_hd_big_geometry hdbg; + memset(&hdbg, 0, sizeof(hdbg)); hdbg.cylinders = fwcylinders; hdbg.heads = fwheads; hdbg.sectors = fwsectors; From owner-svn-src-stable-11@freebsd.org Thu Apr 5 12:54:13 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B2D6F832CC; Thu, 5 Apr 2018 12:54:13 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3E6337A1D4; Thu, 5 Apr 2018 12:54:13 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3972E22E29; Thu, 5 Apr 2018 12:54:13 +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 w35CsDfd076486; Thu, 5 Apr 2018 12:54:13 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w35CsD8o076485; Thu, 5 Apr 2018 12:54:13 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201804051254.w35CsD8o076485@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 5 Apr 2018 12:54:13 +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: r332065 - 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: 332065 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Apr 2018 12:54:13 -0000 Author: emaste Date: Thu Apr 5 12:54:12 2018 New Revision: 332065 URL: https://svnweb.freebsd.org/changeset/base/332065 Log: MFC r332042: Fix kernel memory disclosure in linux_ioctl_socket strlcpy is used to copy a string into a buffer to be copied to userland, previously leaving uninitialized data after the terminating NUL. Zero the buffer first to avoid a kernel memory disclosure. admbugs: 765, 811 Reported by: Ilja Van Sprundel Reported by: Vlad Tsyrklevich Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/compat/linux/linux_ioctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linux/linux_ioctl.c ============================================================================== --- stable/11/sys/compat/linux/linux_ioctl.c Thu Apr 5 12:54:10 2018 (r332064) +++ stable/11/sys/compat/linux/linux_ioctl.c Thu Apr 5 12:54:12 2018 (r332065) @@ -2478,6 +2478,7 @@ linux_ioctl_socket(struct thread *td, struct linux_ioc printf("%s(): ioctl %d on %.*s\n", __func__, args->cmd & 0xffff, LINUX_IFNAMSIZ, lifname); #endif + memset(ifname, 0, sizeof(ifname)); ifp = ifname_linux_to_bsd(td, lifname, ifname); if (ifp == NULL) return (EINVAL); From owner-svn-src-stable-11@freebsd.org Thu Apr 5 12:56:41 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D4C6F8366F; Thu, 5 Apr 2018 12:56:41 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B3EDD7A623; Thu, 5 Apr 2018 12:56:40 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AED1122E2C; Thu, 5 Apr 2018 12:56:40 +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 w35CuecH077385; Thu, 5 Apr 2018 12:56:40 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w35CueRZ077384; Thu, 5 Apr 2018 12:56:40 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201804051256.w35CueRZ077384@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 5 Apr 2018 12:56:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332066 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332066 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Apr 2018 12:56:41 -0000 Author: emaste Date: Thu Apr 5 12:56:40 2018 New Revision: 332066 URL: https://svnweb.freebsd.org/changeset/base/332066 Log: MFC r332045: Fix kernel memory disclosure in tcp_ctloutput strcpy was used to copy a string into a buffer copied to userland, which left uninitialized data after the terminating 0-byte. Use the same approach as in tcp_subr.c: strncpy and explicit '\0'. admbugs: 765, 822 Reported by: Ilja Van Sprundel Reported by: Vlad Tsyrklevich Security: Kernel memory disclosure Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/netinet/tcp_usrreq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/tcp_usrreq.c ============================================================================== --- stable/11/sys/netinet/tcp_usrreq.c Thu Apr 5 12:54:12 2018 (r332065) +++ stable/11/sys/netinet/tcp_usrreq.c Thu Apr 5 12:56:40 2018 (r332066) @@ -1495,7 +1495,9 @@ tcp_ctloutput(struct socket *so, struct sockopt *sopt) return (error); } else if ((sopt->sopt_dir == SOPT_GET) && (sopt->sopt_name == TCP_FUNCTION_BLK)) { - strcpy(fsn.function_set_name, tp->t_fb->tfb_tcp_block_name); + strncpy(fsn.function_set_name, tp->t_fb->tfb_tcp_block_name, + TCP_FUNCTION_NAME_LEN_MAX); + fsn.function_set_name[TCP_FUNCTION_NAME_LEN_MAX - 1] = '\0'; fsn.pcbcnt = tp->t_fb->tfb_refcnt; INP_WUNLOCK(inp); error = sooptcopyout(sopt, &fsn, sizeof fsn); From owner-svn-src-stable-11@freebsd.org Thu Apr 5 12:59:51 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 863F2F83998; Thu, 5 Apr 2018 12:59:51 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0554A7A86D; Thu, 5 Apr 2018 12:59:51 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 000A022E30; Thu, 5 Apr 2018 12:59:50 +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 w35CxoS8078445; Thu, 5 Apr 2018 12:59:50 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w35Cxo40078443; Thu, 5 Apr 2018 12:59:50 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201804051259.w35Cxo40078443@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 5 Apr 2018 12:59: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: r332068 - stable/11/sys/dev/hyperv/vmbus X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/sys/dev/hyperv/vmbus X-SVN-Commit-Revision: 332068 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Apr 2018 12:59:51 -0000 Author: emaste Date: Thu Apr 5 12:59:50 2018 New Revision: 332068 URL: https://svnweb.freebsd.org/changeset/base/332068 Log: MFC r331757: Correct comment typo in Hyper-V PR: 226665 Submitted by: Ryo ONODERA Modified: stable/11/sys/dev/hyperv/vmbus/hyperv.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/vmbus/hyperv.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hyperv.c Thu Apr 5 12:59:49 2018 (r332067) +++ stable/11/sys/dev/hyperv/vmbus/hyperv.c Thu Apr 5 12:59:50 2018 (r332068) @@ -27,7 +27,7 @@ */ /** - * Implements low-level interactions with Hypver-V/Azure + * Implements low-level interactions with Hyper-V/Azure */ #include __FBSDID("$FreeBSD$"); From owner-svn-src-stable-11@freebsd.org Thu Apr 5 14:25:40 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B15DF897BE; Thu, 5 Apr 2018 14:25:40 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3DAA27E9D6; Thu, 5 Apr 2018 14:25:40 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 38A1523D00; Thu, 5 Apr 2018 14:25:40 +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 w35EPeYP044460; Thu, 5 Apr 2018 14:25:40 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w35EPe2R044458; Thu, 5 Apr 2018 14:25:40 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201804051425.w35EPe2R044458@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 5 Apr 2018 14:25:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332071 - in stable/11/sys/amd64: linux linux32 X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in stable/11/sys/amd64: linux linux32 X-SVN-Commit-Revision: 332071 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Apr 2018 14:25:40 -0000 Author: emaste Date: Thu Apr 5 14:25:39 2018 New Revision: 332071 URL: https://svnweb.freebsd.org/changeset/base/332071 Log: MFC r331442: Fixup return style(9) in amd64 linux*_sysvec.c Modified: stable/11/sys/amd64/linux/linux_sysvec.c stable/11/sys/amd64/linux32/linux32_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 Thu Apr 5 13:56:40 2018 (r332070) +++ stable/11/sys/amd64/linux/linux_sysvec.c Thu Apr 5 14:25:39 2018 (r332071) @@ -204,15 +204,15 @@ translate_traps(int signal, int trap_code) { if (signal != SIGBUS) - return signal; + return (signal); switch (trap_code) { case T_PROTFLT: case T_TSSFLT: case T_DOUBLEFLT: case T_PAGEFLT: - return SIGSEGV; + return (SIGSEGV); default: - return signal; + return (signal); } } Modified: stable/11/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- stable/11/sys/amd64/linux32/linux32_sysvec.c Thu Apr 5 13:56:40 2018 (r332070) +++ stable/11/sys/amd64/linux32/linux32_sysvec.c Thu Apr 5 14:25:39 2018 (r332071) @@ -211,15 +211,15 @@ static int translate_traps(int signal, int trap_code) { if (signal != SIGBUS) - return signal; + return (signal); switch (trap_code) { case T_PROTFLT: case T_TSSFLT: case T_DOUBLEFLT: case T_PAGEFLT: - return SIGSEGV; + return (SIGSEGV); default: - return signal; + return (signal); } } From owner-svn-src-stable-11@freebsd.org Thu Apr 5 14:55:45 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3886CF8B732; Thu, 5 Apr 2018 14:55:45 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DBD0780053; Thu, 5 Apr 2018 14:55:44 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D6467241DA; Thu, 5 Apr 2018 14:55:44 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w35EtiAJ059241; Thu, 5 Apr 2018 14:55:44 GMT (envelope-from rgrimes@FreeBSD.org) Received: (from rgrimes@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w35Eti5u059240; Thu, 5 Apr 2018 14:55:44 GMT (envelope-from rgrimes@FreeBSD.org) Message-Id: <201804051455.w35Eti5u059240@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rgrimes set sender to rgrimes@FreeBSD.org using -f From: "Rodney W. Grimes" Date: Thu, 5 Apr 2018 14:55: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: r332074 - stable/11/sys/i386/include X-SVN-Group: stable-11 X-SVN-Commit-Author: rgrimes X-SVN-Commit-Paths: stable/11/sys/i386/include X-SVN-Commit-Revision: 332074 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Apr 2018 14:55:45 -0000 Author: rgrimes Date: Thu Apr 5 14:55:44 2018 New Revision: 332074 URL: https://svnweb.freebsd.org/changeset/base/332074 Log: MFC: r304147(bde) Remove duplicate definition of get_pcb_td(). gcc works for detecting this error. Approved by: bde (mentor) Modified: stable/11/sys/i386/include/md_var.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/i386/include/md_var.h ============================================================================== --- stable/11/sys/i386/include/md_var.h Thu Apr 5 14:39:51 2018 (r332073) +++ stable/11/sys/i386/include/md_var.h Thu Apr 5 14:55:44 2018 (r332074) @@ -71,6 +71,5 @@ void set_gsbase(struct thread *td, uint32_t base); void setidt(int idx, alias_for_inthand_t *func, int typ, int dpl, int selec); union savefpu *get_pcb_user_save_td(struct thread *td); union savefpu *get_pcb_user_save_pcb(struct pcb *pcb); -struct pcb *get_pcb_td(struct thread *td); #endif /* !_MACHINE_MD_VAR_H_ */ From owner-svn-src-stable-11@freebsd.org Thu Apr 5 15:37:50 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 42AD6F8E42F; Thu, 5 Apr 2018 15:37:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E81CE82360; Thu, 5 Apr 2018 15:37:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E2F8F24859; Thu, 5 Apr 2018 15:37:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w35FbnW1079532; Thu, 5 Apr 2018 15:37:49 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w35FbnCh079531; Thu, 5 Apr 2018 15:37:49 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201804051537.w35FbnCh079531@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 5 Apr 2018 15:37:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332076 - stable/11/sys/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sys/sys X-SVN-Commit-Revision: 332076 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Apr 2018 15:37:50 -0000 Author: markj Date: Thu Apr 5 15:37:49 2018 New Revision: 332076 URL: https://svnweb.freebsd.org/changeset/base/332076 Log: MFC r331738, r331853: Have TD_LOCKS_DEC() assert that td_locks is positive. Modified: stable/11/sys/sys/proc.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/sys/proc.h ============================================================================== --- stable/11/sys/sys/proc.h Thu Apr 5 15:00:08 2018 (r332075) +++ stable/11/sys/sys/proc.h Thu Apr 5 15:37:49 2018 (r332076) @@ -377,7 +377,11 @@ do { \ } while (0) #define TD_LOCKS_INC(td) ((td)->td_locks++) -#define TD_LOCKS_DEC(td) ((td)->td_locks--) +#define TD_LOCKS_DEC(td) do { \ + KASSERT(SCHEDULER_STOPPED_TD(td) || (td)->td_locks > 0, \ + ("thread %p owns no locks", (td))); \ + (td)->td_locks--; \ +} while (0) #else #define THREAD_LOCKPTR_ASSERT(td, lock) From owner-svn-src-stable-11@freebsd.org Thu Apr 5 15:52:21 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2B54F8F2AF; Thu, 5 Apr 2018 15:52:21 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 60C028306C; Thu, 5 Apr 2018 15:52:21 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 42FBB24B8D; Thu, 5 Apr 2018 15:52:21 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w35FqLMt088907; Thu, 5 Apr 2018 15:52:21 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w35FqLUP088905; Thu, 5 Apr 2018 15:52:21 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201804051552.w35FqLUP088905@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 5 Apr 2018 15:52:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332078 - in stable/11/sys: kern sys X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/11/sys: kern sys X-SVN-Commit-Revision: 332078 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Apr 2018 15:52:22 -0000 Author: markj Date: Thu Apr 5 15:52:20 2018 New Revision: 332078 URL: https://svnweb.freebsd.org/changeset/base/332078 Log: MFC r331245: Drop KTR_CONTENTION. Modified: stable/11/sys/kern/kern_mutex.c stable/11/sys/sys/ktr_class.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_mutex.c ============================================================================== --- stable/11/sys/kern/kern_mutex.c Thu Apr 5 15:45:54 2018 (r332077) +++ stable/11/sys/kern/kern_mutex.c Thu Apr 5 15:52:20 2018 (r332078) @@ -471,9 +471,6 @@ __mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v) struct turnstile *ts; uintptr_t tid; struct thread *owner; -#ifdef KTR - int cont_logged = 0; -#endif #ifdef LOCK_PROFILING int contested = 0; uint64_t waittime = 0; @@ -617,17 +614,6 @@ retry_turnstile: */ mtx_assert(m, MA_NOTOWNED); -#ifdef KTR - if (!cont_logged) { - CTR6(KTR_CONTENTION, - "contention: %p at %s:%d wants %s, taken by %s:%d", - (void *)tid, file, line, m->lock_object.lo_name, - WITNESS_FILE(&m->lock_object), - WITNESS_LINE(&m->lock_object)); - cont_logged = 1; - } -#endif - /* * Block on the turnstile. */ @@ -645,13 +631,6 @@ retry_turnstile: #endif v = MTX_READ_VALUE(m); } -#ifdef KTR - if (cont_logged) { - CTR4(KTR_CONTENTION, - "contention end: %s acquired by %p at %s:%d", - m->lock_object.lo_name, (void *)tid, file, line); - } -#endif #if defined(KDTRACE_HOOKS) || defined(LOCK_PROFILING) if (__predict_true(!doing_lockprof)) return; Modified: stable/11/sys/sys/ktr_class.h ============================================================================== --- stable/11/sys/sys/ktr_class.h Thu Apr 5 15:45:54 2018 (r332077) +++ stable/11/sys/sys/ktr_class.h Thu Apr 5 15:52:20 2018 (r332078) @@ -63,7 +63,7 @@ #define KTR_VM 0x00100000 /* The virtual memory system */ #define KTR_INET 0x00200000 /* IPv4 stack */ #define KTR_RUNQ 0x00400000 /* Run queue */ -#define KTR_CONTENTION 0x00800000 /* Lock contention */ +#define KTR_SPARE5 0x00800000 #define KTR_UMA 0x01000000 /* UMA slab allocator */ #define KTR_CALLOUT 0x02000000 /* Callouts and timeouts */ #define KTR_GEOM 0x04000000 /* GEOM I/O events */ From owner-svn-src-stable-11@freebsd.org Fri Apr 6 02:47:43 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA747F98F05; Fri, 6 Apr 2018 02:47:43 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5BF547F67B; Fri, 6 Apr 2018 02:47:43 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 56E6B3BCF; Fri, 6 Apr 2018 02:47:43 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w362lhwZ017936; Fri, 6 Apr 2018 02:47:43 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w362lhVQ017935; Fri, 6 Apr 2018 02:47:43 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804060247.w362lhVQ017935@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 6 Apr 2018 02:47: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: r332089 - stable/11/sys/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/sys/sys X-SVN-Commit-Revision: 332089 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 02:47:43 -0000 Author: kevans Date: Fri Apr 6 02:47:43 2018 New Revision: 332089 URL: https://svnweb.freebsd.org/changeset/base/332089 Log: stable/11: Bump FreeBSD_Version for recent rc ${name}_limits bits Some ports had their own interpretation of _limits that conflicted with the new definition as of r328331. r331880 was an MFC of this commit to stable/11. Bump FreeBSD_Version in stable/11 following r331880 so that ports can do the right thing. This is a direct commit to stable/11 Reported by: 0mp Modified: stable/11/sys/sys/param.h Modified: stable/11/sys/sys/param.h ============================================================================== --- stable/11/sys/sys/param.h Thu Apr 5 22:14:55 2018 (r332088) +++ stable/11/sys/sys/param.h Fri Apr 6 02:47:43 2018 (r332089) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1101513 /* Master, propagated to newvers */ +#define __FreeBSD_version 1101514 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable-11@freebsd.org Fri Apr 6 09:25:09 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 88291F95A42; Fri, 6 Apr 2018 09:25:09 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3B1BD6F80D; Fri, 6 Apr 2018 09:25: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 361807DED; Fri, 6 Apr 2018 09:25:09 +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 w369P91C019560; Fri, 6 Apr 2018 09:25:09 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w369P8c2019558; Fri, 6 Apr 2018 09:25:08 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201804060925.w369P8c2019558@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 6 Apr 2018 09:25:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332091 - 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: 332091 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 09:25:09 -0000 Author: kib Date: Fri Apr 6 09:25:08 2018 New Revision: 332091 URL: https://svnweb.freebsd.org/changeset/base/332091 Log: MFC r331760: Make vm_map_max/min/pmap KBI stable. Modified: stable/11/sys/vm/vm_map.c stable/11/sys/vm/vm_map.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_map.c ============================================================================== --- stable/11/sys/vm/vm_map.c Fri Apr 6 02:57:58 2018 (r332090) +++ stable/11/sys/vm/vm_map.c Fri Apr 6 09:25:08 2018 (r332091) @@ -4257,6 +4257,27 @@ vm_map_lookup_done(vm_map_t map, vm_map_entry_t entry) vm_map_unlock_read(map); } +vm_offset_t +vm_map_max_KBI(const struct vm_map *map) +{ + + return (map->max_offset); +} + +vm_offset_t +vm_map_min_KBI(const struct vm_map *map) +{ + + return (map->min_offset); +} + +pmap_t +vm_map_pmap_KBI(vm_map_t map) +{ + + return (map->pmap); +} + #include "opt_ddb.h" #ifdef DDB #include Modified: stable/11/sys/vm/vm_map.h ============================================================================== --- stable/11/sys/vm/vm_map.h Fri Apr 6 02:57:58 2018 (r332090) +++ stable/11/sys/vm/vm_map.h Fri Apr 6 09:25:08 2018 (r332091) @@ -205,6 +205,11 @@ struct vm_map { #define MAP_BUSY_WAKEUP 0x02 #ifdef _KERNEL +#ifdef KLD_MODULE +#define vm_map_max(map) vm_map_max_KBI((map)) +#define vm_map_min(map) vm_map_min_KBI((map)) +#define vm_map_pmap(map) vm_map_pmap_KBI((map)) +#else static __inline vm_offset_t vm_map_max(const struct vm_map *map) { @@ -228,6 +233,7 @@ vm_map_modflags(vm_map_t map, vm_flags_t set, vm_flags { map->flags = (map->flags | set) & ~clear; } +#endif /* KLD_MODULE */ #endif /* _KERNEL */ /* @@ -288,6 +294,9 @@ void vm_map_wakeup(vm_map_t map); void vm_map_busy(vm_map_t map); void vm_map_unbusy(vm_map_t map); void vm_map_wait_busy(vm_map_t map); +vm_offset_t vm_map_max_KBI(const struct vm_map *map); +vm_offset_t vm_map_min_KBI(const struct vm_map *map); +pmap_t vm_map_pmap_KBI(vm_map_t map); #define vm_map_lock(map) _vm_map_lock(map, LOCK_FILE, LOCK_LINE) #define vm_map_unlock(map) _vm_map_unlock(map, LOCK_FILE, LOCK_LINE) From owner-svn-src-stable-11@freebsd.org Fri Apr 6 11:42:09 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 82E72F9EE89; Fri, 6 Apr 2018 11:42:09 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 358F075CF7; Fri, 6 Apr 2018 11:42:09 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3080A11421; Fri, 6 Apr 2018 11:42:09 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w36Bg9RE089296; Fri, 6 Apr 2018 11:42:09 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w36Bg9Rh089295; Fri, 6 Apr 2018 11:42:09 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201804061142.w36Bg9Rh089295@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 6 Apr 2018 11:42:09 +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: r332093 - stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 332093 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 11:42:09 -0000 Author: avg Date: Fri Apr 6 11:42:08 2018 New Revision: 332093 URL: https://svnweb.freebsd.org/changeset/base/332093 Log: MFC r330295: ZFS: fix adding vdevs to very large pools PR: 226096 Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Fri Apr 6 11:20:06 2018 (r332092) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Fri Apr 6 11:42:08 2018 (r332093) @@ -916,6 +916,7 @@ zpool_read_label(int fd, nvlist_t **config) free(label); *config = NULL; + errno = ENOENT; return (-1); } From owner-svn-src-stable-11@freebsd.org Fri Apr 6 12:13:33 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3101FFA19F9; Fri, 6 Apr 2018 12:13:33 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D5E2B7778A; Fri, 6 Apr 2018 12:13:32 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D007B11A29; Fri, 6 Apr 2018 12:13:32 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w36CDWMw004773; Fri, 6 Apr 2018 12:13:32 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w36CDWJ7004771; Fri, 6 Apr 2018 12:13:32 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201804061213.w36CDWJ7004771@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 6 Apr 2018 12:13: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: r332095 - stable/11/sys/geom X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/11/sys/geom X-SVN-Commit-Revision: 332095 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 12:13:33 -0000 Author: avg Date: Fri Apr 6 12:13:32 2018 New Revision: 332095 URL: https://svnweb.freebsd.org/changeset/base/332095 Log: MFC r330977: g_access: deal with races created by geoms that drop the topology lock PR: 225960 Modified: stable/11/sys/geom/geom.h stable/11/sys/geom/geom_subr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/geom/geom.h ============================================================================== --- stable/11/sys/geom/geom.h Fri Apr 6 11:48:12 2018 (r332094) +++ stable/11/sys/geom/geom.h Fri Apr 6 12:13:32 2018 (r332095) @@ -148,8 +148,10 @@ struct g_geom { void *spare1; void *softc; unsigned flags; -#define G_GEOM_WITHER 1 -#define G_GEOM_VOLATILE_BIO 2 +#define G_GEOM_WITHER 0x01 +#define G_GEOM_VOLATILE_BIO 0x02 +#define G_GEOM_IN_ACCESS 0x04 +#define G_GEOM_ACCESS_WAIT 0x08 }; /* Modified: stable/11/sys/geom/geom_subr.c ============================================================================== --- stable/11/sys/geom/geom_subr.c Fri Apr 6 11:48:12 2018 (r332094) +++ stable/11/sys/geom/geom_subr.c Fri Apr 6 12:13:32 2018 (r332095) @@ -862,7 +862,11 @@ int g_access(struct g_consumer *cp, int dcr, int dcw, int dce) { struct g_provider *pp; - int pr,pw,pe; + struct g_geom *gp; + int pw, pe; +#ifdef INVARIANTS + int sr, sw, se; +#endif int error; g_topology_assert(); @@ -870,6 +874,7 @@ g_access(struct g_consumer *cp, int dcr, int dcw, int pp = cp->provider; KASSERT(pp != NULL, ("access but not attached")); G_VALID_PROVIDER(pp); + gp = pp->geom; g_trace(G_T_ACCESS, "g_access(%p(%s), %d, %d, %d)", cp, pp->name, dcr, dcw, dce); @@ -878,7 +883,7 @@ g_access(struct g_consumer *cp, int dcr, int dcw, int KASSERT(cp->acw + dcw >= 0, ("access resulting in negative acw")); KASSERT(cp->ace + dce >= 0, ("access resulting in negative ace")); KASSERT(dcr != 0 || dcw != 0 || dce != 0, ("NOP access request")); - KASSERT(pp->geom->access != NULL, ("NULL geom->access")); + KASSERT(gp->access != NULL, ("NULL geom->access")); /* * If our class cares about being spoiled, and we have been, we @@ -890,10 +895,30 @@ g_access(struct g_consumer *cp, int dcr, int dcw, int return (ENXIO); /* + * A number of GEOM classes either need to perform an I/O on the first + * open or to acquire a different subsystem's lock. To do that they + * may have to drop the topology lock. + * Other GEOM classes perform special actions when opening a lower rank + * geom for the first time. As a result, more than one thread may + * end up performing the special actions. + * So, we prevent concurrent "first" opens by marking the consumer with + * special flag. + * + * Note that if the geom's access method never drops the topology lock, + * then we will never see G_GEOM_IN_ACCESS here. + */ + while ((gp->flags & G_GEOM_IN_ACCESS) != 0) { + g_trace(G_T_ACCESS, + "%s: race on geom %s via provider %s and consumer of %s", + __func__, gp->name, pp->name, cp->geom->name); + gp->flags |= G_GEOM_ACCESS_WAIT; + g_topology_sleep(gp, 0); + } + + /* * Figure out what counts the provider would have had, if this * consumer had (r0w0e0) at this time. */ - pr = pp->acr - cp->acr; pw = pp->acw - cp->acw; pe = pp->ace - cp->ace; @@ -905,7 +930,7 @@ g_access(struct g_consumer *cp, int dcr, int dcw, int pp, pp->name); /* If foot-shooting is enabled, any open on rank#1 is OK */ - if ((g_debugflags & 16) && pp->geom->rank == 1) + if ((g_debugflags & 16) && gp->rank == 1) ; /* If we try exclusive but already write: fail */ else if (dce > 0 && pw > 0) @@ -922,11 +947,27 @@ g_access(struct g_consumer *cp, int dcr, int dcw, int /* Ok then... */ - error = pp->geom->access(pp, dcr, dcw, dce); +#ifdef INVARIANTS + sr = cp->acr; + sw = cp->acw; + se = cp->ace; +#endif + gp->flags |= G_GEOM_IN_ACCESS; + error = gp->access(pp, dcr, dcw, dce); KASSERT(dcr > 0 || dcw > 0 || dce > 0 || error == 0, ("Geom provider %s::%s dcr=%d dcw=%d dce=%d error=%d failed " - "closing ->access()", pp->geom->class->name, pp->name, dcr, dcw, + "closing ->access()", gp->class->name, pp->name, dcr, dcw, dce, error)); + + g_topology_assert(); + gp->flags &= ~G_GEOM_IN_ACCESS; + KASSERT(cp->acr == sr && cp->acw == sw && cp->ace == se, + ("Access counts changed during geom->access")); + if ((gp->flags & G_GEOM_ACCESS_WAIT) != 0) { + gp->flags &= ~G_GEOM_ACCESS_WAIT; + wakeup(gp); + } + if (!error) { /* * If we open first write, spoil any partner consumers. @@ -936,7 +977,7 @@ g_access(struct g_consumer *cp, int dcr, int dcw, int if (pp->acw == 0 && dcw != 0) g_spoil(pp, cp); else if (pp->acw != 0 && pp->acw == -dcw && pp->error == 0 && - !(pp->geom->flags & G_GEOM_WITHER)) + !(gp->flags & G_GEOM_WITHER)) g_post_event(g_new_provider_event, pp, M_WAITOK, pp, NULL); From owner-svn-src-stable-11@freebsd.org Fri Apr 6 12:39:34 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5E8FFF81D8A; Fri, 6 Apr 2018 12:39:34 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0B0C978DAC; Fri, 6 Apr 2018 12:39:34 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 05F6E11D6E; Fri, 6 Apr 2018 12:39:34 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w36CdX53015118; Fri, 6 Apr 2018 12:39:33 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w36CdX1l015117; Fri, 6 Apr 2018 12:39:33 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201804061239.w36CdX1l015117@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 6 Apr 2018 12:39:33 +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: r332097 - stable/11/sys/i386/i386 X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/11/sys/i386/i386 X-SVN-Commit-Revision: 332097 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 12:39:34 -0000 Author: avg Date: Fri Apr 6 12:39:33 2018 New Revision: 332097 URL: https://svnweb.freebsd.org/changeset/base/332097 Log: MFC r331761: align i386 cpu_reset() with amd64 version Modified: stable/11/sys/i386/i386/vm_machdep.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/i386/i386/vm_machdep.c ============================================================================== --- stable/11/sys/i386/i386/vm_machdep.c Fri Apr 6 12:23:59 2018 (r332096) +++ stable/11/sys/i386/i386/vm_machdep.c Fri Apr 6 12:39:33 2018 (r332097) @@ -594,7 +594,8 @@ cpu_reset_proxy() cpu_reset_proxy_active = 1; while (cpu_reset_proxy_active == 1) - ; /* Wait for other cpu to see that we've started */ + ia32_pause(); /* Wait for other cpu to see that we've started */ + CPU_SETOF(cpu_reset_proxyid, &tcrp); stop_cpus(tcrp); printf("cpu_reset_proxy: Stopped CPU %d\n", cpu_reset_proxyid); @@ -634,19 +635,21 @@ cpu_reset() printf("cpu_reset: Restarting BSP\n"); /* Restart CPU #0. */ - /* XXX: restart_cpus(1 << 0); */ CPU_SETOF(0, &started_cpus); wmb(); cnt = 0; - while (cpu_reset_proxy_active == 0 && cnt < 10000000) + while (cpu_reset_proxy_active == 0 && cnt < 10000000) { + ia32_pause(); cnt++; /* Wait for BSP to announce restart */ + } if (cpu_reset_proxy_active == 0) printf("cpu_reset: Failed to restart BSP\n"); enable_intr(); cpu_reset_proxy_active = 2; - while (1); + while (1) + ia32_pause(); /* NOTREACHED */ } From owner-svn-src-stable-11@freebsd.org Fri Apr 6 15:09:31 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A617CF8CC21; Fri, 6 Apr 2018 15:09:31 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 53CD580304; Fri, 6 Apr 2018 15:09:31 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4EAD013605; Fri, 6 Apr 2018 15:09:31 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w36F9VBR089515; Fri, 6 Apr 2018 15:09:31 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w36F9VHn089514; Fri, 6 Apr 2018 15:09:31 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201804061509.w36F9VHn089514@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 6 Apr 2018 15:09:31 +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: r332103 - stable/11/sys/compat/linuxkpi/common/src X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sys/compat/linuxkpi/common/src X-SVN-Commit-Revision: 332103 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 15:09:31 -0000 Author: markj Date: Fri Apr 6 15:09:30 2018 New Revision: 332103 URL: https://svnweb.freebsd.org/changeset/base/332103 Log: MFC r331934: Wrap long lines. Modified: stable/11/sys/compat/linuxkpi/common/src/linux_schedule.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/src/linux_schedule.c ============================================================================== --- stable/11/sys/compat/linuxkpi/common/src/linux_schedule.c Fri Apr 6 15:03:48 2018 (r332102) +++ stable/11/sys/compat/linuxkpi/common/src/linux_schedule.c Fri Apr 6 15:09:30 2018 (r332103) @@ -267,7 +267,8 @@ linux_wait_event_common(wait_queue_head_t *wqh, wait_q PHOLD(task->task_thread->td_proc); sleepq_lock(task); if (atomic_read(&task->state) != TASK_WAKING) { - ret = linux_add_to_sleepqueue(task, task, "wevent", timeout, state); + ret = linux_add_to_sleepqueue(task, task, "wevent", timeout, + state); } else { sleepq_release(task); ret = 0; @@ -300,7 +301,8 @@ linux_schedule_timeout(int timeout) sleepq_lock(task); state = atomic_read(&task->state); if (state != TASK_WAKING) { - ret = linux_add_to_sleepqueue(task, task, "sched", timeout, state); + ret = linux_add_to_sleepqueue(task, task, "sched", timeout, + state); } else { sleepq_release(task); ret = 0; @@ -368,7 +370,8 @@ linux_wait_on_bit_timeout(unsigned long *word, int bit break; } set_task_state(task, state); - ret = linux_add_to_sleepqueue(wchan, task, "wbit", timeout, state); + ret = linux_add_to_sleepqueue(wchan, task, "wbit", timeout, + state); if (ret != 0) break; } From owner-svn-src-stable-11@freebsd.org Fri Apr 6 16:45:01 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AED1DF94A0A; Fri, 6 Apr 2018 16:45:01 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 543C9875FB; Fri, 6 Apr 2018 16:45:01 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4ACCC146E1; Fri, 6 Apr 2018 16:45:01 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w36Gj1si046352; Fri, 6 Apr 2018 16:45:01 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w36Gj1CI046351; Fri, 6 Apr 2018 16:45:01 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804061645.w36Gj1CI046351@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 6 Apr 2018 16:45: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: r332112 - stable/11/usr.bin/dtc X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/usr.bin/dtc X-SVN-Commit-Revision: 332112 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 16:45:01 -0000 Author: kevans Date: Fri Apr 6 16:45:00 2018 New Revision: 332112 URL: https://svnweb.freebsd.org/changeset/base/332112 Log: MFC r320160: dtc: Update to upstream 917526 - Add missing "typename" in divmod's "using" of binary_operator_base::result. Modified: stable/11/usr.bin/dtc/input_buffer.cc Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/dtc/input_buffer.cc ============================================================================== --- stable/11/usr.bin/dtc/input_buffer.cc Fri Apr 6 16:26:46 2018 (r332111) +++ stable/11/usr.bin/dtc/input_buffer.cc Fri Apr 6 16:45:00 2018 (r332112) @@ -698,7 +698,7 @@ template struct divmod : public binary_operator<5, T> { using binary_operator<5, T>::binary_operator; - using binary_operator_base::result; + using typename binary_operator_base::result; result operator()() override { result r = (*binary_operator_base::rhs)(); From owner-svn-src-stable-11@freebsd.org Fri Apr 6 16:48:09 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33D03F94DEF; Fri, 6 Apr 2018 16:48:09 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C9229878AB; Fri, 6 Apr 2018 16:48:08 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A98A2146E4; Fri, 6 Apr 2018 16:48:08 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w36Gm8LB046522; Fri, 6 Apr 2018 16:48:08 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w36Gm8dr046517; Fri, 6 Apr 2018 16:48:08 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201804061648.w36Gm8dr046517@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Fri, 6 Apr 2018 16:48:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332113 - in stable/11/sys/modules: i2c/iicbus i2c/isl spi/at45d spi/mx25l spi/spibus X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/11/sys/modules: i2c/iicbus i2c/isl spi/at45d spi/mx25l spi/spibus X-SVN-Commit-Revision: 332113 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 16:48:09 -0000 Author: ian Date: Fri Apr 6 16:48:07 2018 New Revision: 332113 URL: https://svnweb.freebsd.org/changeset/base/332113 Log: MFC r331868: Add opt_platform.h for several modules that have #ifdef FDT in the source. Submitted by: Andre Albsmeier PR: 227322 227323 Modified: stable/11/sys/modules/i2c/iicbus/Makefile stable/11/sys/modules/i2c/isl/Makefile stable/11/sys/modules/spi/at45d/Makefile stable/11/sys/modules/spi/mx25l/Makefile stable/11/sys/modules/spi/spibus/Makefile Modified: stable/11/sys/modules/i2c/iicbus/Makefile ============================================================================== --- stable/11/sys/modules/i2c/iicbus/Makefile Fri Apr 6 16:45:00 2018 (r332112) +++ stable/11/sys/modules/i2c/iicbus/Makefile Fri Apr 6 16:48:07 2018 (r332113) @@ -13,6 +13,7 @@ SRCS= \ iicbus_if.h \ iiconf.c \ iiconf.h \ + opt_platform.h \ .if !empty(OPT_FDT) SRCS+= ofw_iicbus.c ofw_bus_if.h Modified: stable/11/sys/modules/i2c/isl/Makefile ============================================================================== --- stable/11/sys/modules/i2c/isl/Makefile Fri Apr 6 16:45:00 2018 (r332112) +++ stable/11/sys/modules/i2c/isl/Makefile Fri Apr 6 16:48:07 2018 (r332113) @@ -2,6 +2,6 @@ .PATH: ${SRCTOP}/sys/dev/isl KMOD = isl -SRCS = isl.c device_if.h bus_if.h iicbus_if.h +SRCS = isl.c device_if.h bus_if.h iicbus_if.h opt_platform.h .include Modified: stable/11/sys/modules/spi/at45d/Makefile ============================================================================== --- stable/11/sys/modules/spi/at45d/Makefile Fri Apr 6 16:45:00 2018 (r332112) +++ stable/11/sys/modules/spi/at45d/Makefile Fri Apr 6 16:48:07 2018 (r332113) @@ -9,6 +9,7 @@ SRCS= at45d.c SRCS+= \ bus_if.h \ device_if.h \ + opt_platform.h \ spibus_if.h \ .if !empty(OPT_FDT) Modified: stable/11/sys/modules/spi/mx25l/Makefile ============================================================================== --- stable/11/sys/modules/spi/mx25l/Makefile Fri Apr 6 16:45:00 2018 (r332112) +++ stable/11/sys/modules/spi/mx25l/Makefile Fri Apr 6 16:48:07 2018 (r332113) @@ -9,6 +9,7 @@ SRCS= mx25l.c SRCS+= \ bus_if.h \ device_if.h \ + opt_platform.h \ spibus_if.h \ .if !empty(OPT_FDT) Modified: stable/11/sys/modules/spi/spibus/Makefile ============================================================================== --- stable/11/sys/modules/spi/spibus/Makefile Fri Apr 6 16:45:00 2018 (r332112) +++ stable/11/sys/modules/spi/spibus/Makefile Fri Apr 6 16:48:07 2018 (r332113) @@ -13,6 +13,7 @@ SRCS+= ofw_spibus.c ofw_bus_if.h SRCS+= \ bus_if.h \ device_if.h \ + opt_platform.h \ spibus_if.c \ spibus_if.h \ From owner-svn-src-stable-11@freebsd.org Fri Apr 6 16:59:59 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B5BEF95ED2; Fri, 6 Apr 2018 16:59:59 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4A92668831; Fri, 6 Apr 2018 16:59:59 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 454ED148BF; Fri, 6 Apr 2018 16:59:59 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w36Gxx1g051651; Fri, 6 Apr 2018 16:59:59 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w36GxwEr051645; Fri, 6 Apr 2018 16:59:58 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804061659.w36GxwEr051645@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 6 Apr 2018 16:59:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332115 - in stable/11/stand: . arm/loader defaults forth mips/uboot X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/stand: . arm/loader defaults forth mips/uboot X-SVN-Commit-Revision: 332115 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 16:59:59 -0000 Author: kevans Date: Fri Apr 6 16:59:58 2018 New Revision: 332115 URL: https://svnweb.freebsd.org/changeset/base/332115 Log: MFC r330005-r330007, r330021, r330029, r330622, r331207: Solo loader.conf(5) r330005: Go back to one loader.conf We really only need one loader.conf. The other loader.conf was created because the current one took forever to parse in FORTH. That will be fixed in the next commit. r330006: Take a meat cleaver to defaults/loader.conf Remove almost all of the _load=XXX options (kept only those relevant to splash screens, since there were other settings). Remove the excessively cutesy comment blocks. Remove excessive comments and replace with similar content Remove gratuitous blank lines (while leaving some) We have too many modules to list them all here. There's no purpose in doing so and it's a giant hassle to maintain. In addition the extra ~500 lines slow this down on small platforms. It slowed it down so much small platforms forked, which caused other issues... This is a compromise between those two extremes. r330007: loader.conf is loader agnostic, so remove 4th references. r330021: These two directories build man pages, so it's incorrect to tag them NO_OBJ. Also, make sure the loader.conf.5 man gets built and installed. r330029: Fix a typo: "now" -> "no". r330622: loader.conf(5): Document some other settings These tend to have less coverage in other places and they don't have defaults as of yet, so mention them here: - fdt_overlays - kernels_autodetect (lualoader only) r331207: loader.conf: remove obsolete non-x86 beastie menu statement As of r330005 the same loader.conf defaults are used on all platforms. Added: stable/11/stand/defaults/ - copied from r330007, head/stand/defaults/ Deleted: stable/11/stand/arm/loader/loader.conf stable/11/stand/forth/loader.conf stable/11/stand/forth/loader.conf.5 stable/11/stand/mips/uboot/loader.conf Modified: stable/11/stand/Makefile stable/11/stand/defaults/Makefile stable/11/stand/defaults/loader.conf stable/11/stand/defaults/loader.conf.5 stable/11/stand/forth/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/Makefile ============================================================================== --- stable/11/stand/Makefile Fri Apr 6 16:48:11 2018 (r332114) +++ stable/11/stand/Makefile Fri Apr 6 16:59:58 2018 (r332115) @@ -9,6 +9,7 @@ SUBDIR+= ficl SUBDIR+= forth .endif +SUBDIR+= defaults SUBDIR+= man .include Modified: stable/11/stand/defaults/Makefile ============================================================================== --- head/stand/defaults/Makefile Mon Feb 26 03:16:57 2018 (r330007) +++ stable/11/stand/defaults/Makefile Fri Apr 6 16:59:58 2018 (r332115) @@ -1,11 +1,9 @@ # $FreeBSD$ -NO_OBJ=t - .include FILES+= loader.conf -FILES+= loader.conf.5 +MAN+= loader.conf.5 FILESDIR_loader.conf= /boot/defaults Modified: stable/11/stand/defaults/loader.conf ============================================================================== --- head/stand/defaults/loader.conf Mon Feb 26 03:16:57 2018 (r330007) +++ stable/11/stand/defaults/loader.conf Fri Apr 6 16:59:58 2018 (r332115) @@ -69,7 +69,7 @@ acpi_video_load="NO" # Load the ACPI video extension #loader_delay="3" # Delay in seconds before loading anything. # Default is unset and disabled (no delay). #autoboot_delay="10" # Delay in seconds before autobooting, - # -1 for now user interrupts, NO to disable + # -1 for no user interrupts, NO to disable #password="" # Prevent changes to boot options #bootlock_password="" # Prevent booting (see check-password.4th(8)) #geom_eli_passphrase_prompt="NO" # Prompt for geli(8) passphrase to mount root Modified: stable/11/stand/defaults/loader.conf.5 ============================================================================== --- head/stand/defaults/loader.conf.5 Mon Feb 26 03:16:57 2018 (r330007) +++ stable/11/stand/defaults/loader.conf.5 Fri Apr 6 16:59:58 2018 (r332115) @@ -23,7 +23,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd January 6, 2016 +.Dd March 19, 2018 .Dt LOADER.CONF 5 .Os .Sh NAME @@ -249,7 +249,6 @@ be displayed. If set to .Dq YES , the beastie boot menu will be skipped. -The beastie boot menu is always skipped if running non-x86 hardware. .It Va loader_logo Pq Dq Li orbbw Selects a desired logo in the beastie boot menu. Possible values are: @@ -277,6 +276,23 @@ See the entropy entries in .Pq Dq /boot/entropy The name of the very early boot-time entropy cache file. +.El +.Sh OTHER SETTINGS +Other settings that may be used in +.Nm +that have no default value: +.Bl -tag -width bootfile -offset indent +.It Va fdt_overlays +Specifies a comma-delimited list of FDT overlays to apply. +.Pa /boot/overlays +is created by default for overlays to be placed in. +.It Va kernels_autodetect +If set to +.Dq YES , +attempt to auto-detect kernels installed in +.Pa /boot . +This is an option specific to the Lua-based loader. +It is not available in the default Forth-based loader. .El .Sh FILES .Bl -tag -width /boot/defaults/loader.conf -compact Modified: stable/11/stand/forth/Makefile ============================================================================== --- stable/11/stand/forth/Makefile Fri Apr 6 16:48:11 2018 (r332114) +++ stable/11/stand/forth/Makefile Fri Apr 6 16:59:58 2018 (r332115) @@ -7,7 +7,6 @@ MAN+= beastie.4th.8 \ check-password.4th.8 \ color.4th.8 \ delay.4th.8 \ - loader.conf.5 \ loader.4th.8 \ menu.4th.8 \ menusets.4th.8 \ @@ -33,10 +32,9 @@ FILES+= screen.4th FILES+= shortcuts.4th FILES+= support.4th FILES+= version.4th -FILESDIR_loader.conf= /boot/defaults # Allow machine specific loader.rc to be installed. -.for f in loader.rc menu.rc loader.conf +.for f in loader.rc menu.rc .if exists(${BOOTSRC}/${MACHINE:C/amd64/i386/}/loader/${f}) FILES+= ${BOOTSRC}/${MACHINE:C/amd64/i386/}/loader/${f} .else From owner-svn-src-stable-11@freebsd.org Fri Apr 6 17:04:22 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 55F63F965F6; Fri, 6 Apr 2018 17:04:22 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0AA6468E90; Fri, 6 Apr 2018 17:04:22 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 059F814A66; Fri, 6 Apr 2018 17:04:22 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w36H4LxX056474; Fri, 6 Apr 2018 17:04:21 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w36H4Ler056471; Fri, 6 Apr 2018 17:04:21 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804061704.w36H4Ler056471@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 6 Apr 2018 17:04:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332116 - in stable/11: etc/mtree stand/defaults X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: etc/mtree stand/defaults X-SVN-Commit-Revision: 332116 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 17:04:22 -0000 Author: kevans Date: Fri Apr 6 17:04:21 2018 New Revision: 332116 URL: https://svnweb.freebsd.org/changeset/base/332116 Log: MFC r331212,r331213: Move /boot/overlays to /boot/dtb/overlays r331212: Move /boot/overlays to /boot/dtb/overlays The former is fairly vague; these are FDT overlays to be applied to the running system, so /boot/dtb is a sensible location to put it without cluttering up /boot/dtb even further if desired. r331213: Amend missed reference to /boot/overlays Modified: stable/11/etc/mtree/BSD.root.dist stable/11/stand/defaults/loader.conf stable/11/stand/defaults/loader.conf.5 Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/mtree/BSD.root.dist ============================================================================== --- stable/11/etc/mtree/BSD.root.dist Fri Apr 6 16:59:58 2018 (r332115) +++ stable/11/etc/mtree/BSD.root.dist Fri Apr 6 17:04:21 2018 (r332116) @@ -11,14 +11,14 @@ defaults .. dtb + overlays tags=package=runtime + .. .. firmware .. kernel .. modules - .. - overlays tags=package=runtime .. zfs .. Modified: stable/11/stand/defaults/loader.conf ============================================================================== --- stable/11/stand/defaults/loader.conf Fri Apr 6 16:59:58 2018 (r332115) +++ stable/11/stand/defaults/loader.conf Fri Apr 6 17:04:21 2018 (r332116) @@ -80,7 +80,7 @@ bootenv_autolist="YES" # Auto populate the list of ZF #comconsole_speed="9600" # Set the current serial console speed #console="vidconsole" # A comma separated list of console(s) #currdev="disk1s1a" # Set the current device -module_path="/boot/modules;/boot/dtb;/boot/overlays" # Set the module search path +module_path="/boot/modules;/boot/dtb;/boot/dtb/overlays" # Set the module search path #prompt="\\${interpret}" # Set the command prompt #root_disk_unit="0" # Force the root disk unit number #rootdev="disk1s1a" # Set the root filesystem Modified: stable/11/stand/defaults/loader.conf.5 ============================================================================== --- stable/11/stand/defaults/loader.conf.5 Fri Apr 6 16:59:58 2018 (r332115) +++ stable/11/stand/defaults/loader.conf.5 Fri Apr 6 17:04:21 2018 (r332116) @@ -284,7 +284,7 @@ that have no default value: .Bl -tag -width bootfile -offset indent .It Va fdt_overlays Specifies a comma-delimited list of FDT overlays to apply. -.Pa /boot/overlays +.Pa /boot/dtb/overlays is created by default for overlays to be placed in. .It Va kernels_autodetect If set to From owner-svn-src-stable-11@freebsd.org Fri Apr 6 18:10:40 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 69D0FF9B5E3; Fri, 6 Apr 2018 18:10:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 19DE66C7C0; Fri, 6 Apr 2018 18:10:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 146E81545E; Fri, 6 Apr 2018 18:10:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w36IAd99087149; Fri, 6 Apr 2018 18:10:39 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w36IAcs1087134; Fri, 6 Apr 2018 18:10:38 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804061810.w36IAcs1087134@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 6 Apr 2018 18:10:38 +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: r332123 - in stable/11: lib/libefivar usr.sbin/efidp usr.sbin/efivar X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: lib/libefivar usr.sbin/efidp usr.sbin/efivar X-SVN-Commit-Revision: 332123 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 18:10:40 -0000 Author: kevans Date: Fri Apr 6 18:10:38 2018 New Revision: 332123 URL: https://svnweb.freebsd.org/changeset/base/332123 Log: MFC efivar changes: r321429, r323056-r323057, r323066, r323259-r323260, r323519, r325684, r326050-r326051, r326231, r326287, r326457-r326459, r326472, r326658, r326805, r327574-r327575, r330279 r321429: fix typo r323056: Fix printing File() nodes in device paths. Device paths encoded into the FILEPATH_DEVICE_PATH are UCS2 not ASCII/UTF8. Convert to utf8 and print that when printing File paths. Also, since File may be at the end of a long device path, output File() around the path so it doesn't just show up as random nodes that might accidentally match real node paths names and cause errors. r323057: Fix parsing File() nodes in device paths. o Add File to the mUefiDevicePathLibDevPathFromTextTable table so we don't include 'File()' in the supposed path name. This happens because of a possible misfeature in the EDK2 code where any path that's not recognized is treated as a File() node. o Convert utf8 input into ucs2 output rather than just copying the utf8 and hoping for the best (no good comes from that). o Remove bogus comment about needing to add 1. The dummy array already is length 1, so that's included in sizeof the struct, so there's no need to add it. Sponsored by: Netflix r323066: Add UCS2->UTF8 option. Many UEFI variables are UCS2 strings (some NUL terminated, others not). Add --utf8 (-u) to convert UCS2 strings to UTF8 before printing. Sponsored by: Netflix r323259: Implement efidp_size efidp_size will return the size, in bytes, of a EFI device path structure. This is a convenience wrapper in the same style as the other linux routines. It's implemented by GetDevicePathSize from EDK2 we already needed for other things. Sponsored by: Netflix r323260: Create efi utility printing routines Split out asciidump, utf8dump, bindump, and hexdump into a separate file efiutil.c. Implement new efi_print_load_option for printing out the EFI_LOADER_OPTION data structure used to specify different options to the UEFI boot manager. Sponsored by: Netflix r323519: Minor fixes to edge cases in efi_get_next_variable_name Fix allocating more memory for the names (unlikely to be needed, but still best to get right) to ask for the length the kernel told use we needed, not the old length of the variable. Mind the proper NUL that we add in the space we allocate. Free the old name string before we allcoate a new one to limit what we leak to the last one (free passed in name for the last one in the list), and detect the last one by rv != 0 and errno == ENOENT, rather then just the former to avoid false positives if errno happens to be ENOENT on entry. Sponsored by: Netflix r325684: Simplify the efivar interface a little. We started out having Linux compatible libefivar interfaces. This was in anticipation of porting the GPL'd efibootmgr to FreeBSD via a port. However, since we need that functionality in the base, that port isn't going to happened. It also appears that efivar is a private library that's not used much outside a command line util and efibootmgr. Reduce compatibility with the Linux version a little by removing the mode parameter to efi_set_variable (which was unused on FreeBSD, and not set to something useful in the code we'd written). Also remove some efi error routines that were never implemented and existed only to placate early GPL efibootmgr porting experiments. Suggested by: Matt Williams Sponsored by: Netflix r326050: Document what the command line arguments actually do. List some of the size limitations. Sponsored by: Netflix r326051: This program is more useful if it skips leading whitespace when parsing a textual UEFI Device Path, since otherwise it things the passed in path is a filename. While here, reduce the repetition of 8192. Sponsored by: Netflix r326231: Add efidp_format_device_path_node to format a single node in a device path, much like efidp_format_device_path will format the entire path. Sponsored by: Netflix r326287: efivar: add missing getopt 'u' option r326457: Read multiple lines when parsing the data. Allow multiple device paths to be read when formatting device paths. Set the upper limit to 64k (most of these paths are < 64 bytes). Sponsored by: Netflix r326458: Create a function to translate UEFI paths to unix paths efivar_device_path_to_unix_path translates from UEFI to Unix efivar_unix_path_to_device_path translates from Unix to UEFI At present, only HD() device types are supported (both GPT and MBR). CdRom and floppy devices aren't supported. ZFS isn't supported because there's no way in the UEFI standard to specify a ZFS datastore. Network devices aren't supported either. Three forms of Unix path are accepted: /path/to/file (for a mounted filesystem), //path/to/file (uses the EFI partition on the same disk as /), and dev:/path/to/file (for unmounted filesystem). Two forms are produced (the first and last). Sponsored by: Netflix r326459: Add -u (--to-unix) and -e (--to-efi) to convert unix or efi paths to the other. Sponsored by: Netflix r326472: Add forgotten libgeom. Sponsored by: Netflix r326658: Ensure that "out" is initialized in all error paths. Reported by: gcc Reviewed by: cem Differential Revision: https://reviews.freebsd.org/D13402 r326805: Iniailize str so ucs2_to_utf8 won't free stack garbage. CID: 1381037 Sponsored by: Netflix r327574: Set dp to NULL when we free it, and tree a NULL dp as an error condition. This should prevent a double free. In addition, prevent a leak by freeing dp each loop and when we're done. CID: 1383577 Sponsored by: Netflix r327575: Need to convert '/' back to '\' when creating a path. Ideally, this would be filesystem type dependent, but that's difficult to accomplish and it's unclear how the UEFI firmware will cope. Be conservative and make boot loaders cope instead. Sponsored by: Netflix r330279: libefivar: use standard 2-Clause FreeBSD license Approved by: imp Sponsored by: The FreeBSD Foundation Added: stable/11/lib/libefivar/efivar-dp-xlate.c - copied, changed from r326459, head/lib/libefivar/efivar-dp-xlate.c stable/11/usr.sbin/efivar/efiutil.c - copied, changed from r323260, head/usr.sbin/efivar/efiutil.c stable/11/usr.sbin/efivar/efiutil.h - copied unchanged from r323260, head/usr.sbin/efivar/efiutil.h Modified: stable/11/lib/libefivar/Makefile stable/11/lib/libefivar/efi-osdep.h stable/11/lib/libefivar/efivar-dp-format.c stable/11/lib/libefivar/efivar-dp-parse.c stable/11/lib/libefivar/efivar-dp.h stable/11/lib/libefivar/efivar.c stable/11/lib/libefivar/efivar.h stable/11/lib/libefivar/uefi-dplib.h stable/11/lib/libefivar/uefi-dputil.c stable/11/usr.sbin/efidp/Makefile stable/11/usr.sbin/efidp/efidp.8 stable/11/usr.sbin/efidp/efidp.c stable/11/usr.sbin/efivar/Makefile stable/11/usr.sbin/efivar/efivar.8 stable/11/usr.sbin/efivar/efivar.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libefivar/Makefile ============================================================================== --- stable/11/lib/libefivar/Makefile Fri Apr 6 17:35:35 2018 (r332122) +++ stable/11/lib/libefivar/Makefile Fri Apr 6 18:10:38 2018 (r332123) @@ -35,6 +35,7 @@ PACKAGE=lib${LIB} LIB= efivar SRCS= efivar.c efichar.c efivar-dp-format.c \ efivar-dp-parse.c \ + efivar-dp-xlate.c \ uefi-guid.c uefi-dputil.c INCS= efivar.h efivar-dp.h SHLIB_MAJOR= 1 Modified: stable/11/lib/libefivar/efi-osdep.h ============================================================================== --- stable/11/lib/libefivar/efi-osdep.h Fri Apr 6 17:35:35 2018 (r332122) +++ stable/11/lib/libefivar/efi-osdep.h Fri Apr 6 18:10:38 2018 (r332123) @@ -6,22 +6,22 @@ * 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 - * in this position and unchanged. + * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. * * $FreeBSD$ */ Modified: stable/11/lib/libefivar/efivar-dp-format.c ============================================================================== --- stable/11/lib/libefivar/efivar-dp-format.c Fri Apr 6 17:35:35 2018 (r332122) +++ stable/11/lib/libefivar/efivar-dp-format.c Fri Apr 6 18:10:38 2018 (r332123) @@ -6,22 +6,22 @@ * 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 - * in this position and unchanged. + * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ /* @@ -36,6 +36,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include "efichar.h" + #include "efi-osdep.h" #include "efivar-dp.h" @@ -1872,9 +1874,12 @@ DevPathToTextFilePath ( ) { FILEPATH_DEVICE_PATH *Fp; + char *name = NULL; Fp = DevPath; - UefiDevicePathLibCatPrint (Str, "%s", Fp->PathName); + ucs2_to_utf8(Fp->PathName, &name); + UefiDevicePathLibCatPrint (Str, "File(%s)", name); + free(name); } /** @@ -2267,7 +2272,6 @@ static const DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePath {0, 0, NULL} }; -#ifndef __FreeBSD__ /** Converts a device node to its string representation. @@ -2283,7 +2287,7 @@ static const DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePath is NULL or there was insufficient memory. **/ -CHAR16 * +static char * EFIAPI UefiDevicePathLibConvertDeviceNodeToText ( IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode, @@ -2294,6 +2298,7 @@ UefiDevicePathLibConvertDeviceNodeToText ( POOL_PRINT Str; UINTN Index; DEVICE_PATH_TO_TEXT ToText; + EFI_DEVICE_PATH_PROTOCOL *Node; if (DeviceNode == NULL) { return NULL; @@ -2305,6 +2310,7 @@ UefiDevicePathLibConvertDeviceNodeToText ( // Process the device path node // If not found, use a generic function // + Node = __DECONST(EFI_DEVICE_PATH_PROTOCOL *, DeviceNode); ToText = DevPathToTextNodeGeneric; for (Index = 0; mUefiDevicePathLibToTextTable[Index].Function != NULL; Index++) { if (DevicePathType (DeviceNode) == mUefiDevicePathLibToTextTable[Index].Type && @@ -2318,12 +2324,11 @@ UefiDevicePathLibConvertDeviceNodeToText ( // // Print this node // - ToText (&Str, (VOID *) DeviceNode, DisplayOnly, AllowShortcuts); + ToText (&Str, (VOID *) Node, DisplayOnly, AllowShortcuts); ASSERT (Str.Str != NULL); return Str.Str; } -#endif /** Converts a device path to its text representation. @@ -2424,4 +2429,39 @@ efidp_format_device_path(char *buf, size_t len, const_ free(str); return retval; +} + +ssize_t +efidp_format_device_path_node(char *buf, size_t len, const_efidp dp) +{ + char *str; + ssize_t retval; + + str = UefiDevicePathLibConvertDeviceNodeToText ( + __DECONST(EFI_DEVICE_PATH_PROTOCOL *, dp), FALSE, TRUE); + if (str == NULL) + return -1; + strlcpy(buf, str, len); + retval = strlen(str); + free(str); + + return retval; +} + +size_t +efidp_size(const_efidp dp) +{ + + return GetDevicePathSize(__DECONST(EFI_DEVICE_PATH_PROTOCOL *, dp)); +} + +char * +efidp_extract_file_path(const_efidp dp) +{ + const FILEPATH_DEVICE_PATH *fp; + char *name = NULL; + + fp = (const void *)dp; + ucs2_to_utf8(fp->PathName, &name); + return name; } Modified: stable/11/lib/libefivar/efivar-dp-parse.c ============================================================================== --- stable/11/lib/libefivar/efivar-dp-parse.c Fri Apr 6 17:35:35 2018 (r332122) +++ stable/11/lib/libefivar/efivar-dp-parse.c Fri Apr 6 18:10:38 2018 (r332123) @@ -6,22 +6,22 @@ * 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 - * in this position and unchanged. + * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ /* @@ -38,6 +38,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include "efichar.h" + #include "efi-osdep.h" #include "efivar-dp.h" @@ -3031,21 +3033,15 @@ DevPathFromTextFilePath ( StrCpyS (File->PathName, StrLen (TextDeviceNode) + 1, TextDeviceNode); #else + size_t len = (sizeof (FILEPATH_DEVICE_PATH) + StrLen (TextDeviceNode) * 2); + efi_char * v; File = (FILEPATH_DEVICE_PATH *) CreateDeviceNode ( MEDIA_DEVICE_PATH, MEDIA_FILEPATH_DP, - (UINT16) (sizeof (FILEPATH_DEVICE_PATH) + StrLen (TextDeviceNode) + 1) + (UINT16)len ); - - /* - * Note: We'd have to change the Tianocore header files to fix this - * to not need a cast. Instead we just cast it here. The Interface - * to the user may have issues since this won't be a UCS-2 - * string. Also note that in the original code, a NUL wasn't - * allocated for the end of the string, but we copy that below. This - * has been corrected. - */ - StrCpyS ((char *)File->PathName, StrLen (TextDeviceNode) + 1, TextDeviceNode); + v = File->PathName; + utf8_to_ucs2(TextDeviceNode, &v, &len); #endif return (EFI_DEVICE_PATH_PROTOCOL *) File; @@ -3560,6 +3556,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED DEVICE_PATH_FROM_TEXT_TA {"Media", DevPathFromTextMedia }, {"Fv", DevPathFromTextFv }, {"FvFile", DevPathFromTextFvFile }, + {"File", DevPathFromTextFilePath }, {"Offset", DevPathFromTextRelativeOffsetRange }, {"RamDisk", DevPathFromTextRamDisk }, {"VirtualDisk", DevPathFromTextVirtualDisk }, Copied and modified: stable/11/lib/libefivar/efivar-dp-xlate.c (from r326459, head/lib/libefivar/efivar-dp-xlate.c) ============================================================================== --- head/lib/libefivar/efivar-dp-xlate.c Sat Dec 2 07:29:24 2017 (r326459, copy source) +++ stable/11/lib/libefivar/efivar-dp-xlate.c Fri Apr 6 18:10:38 2018 (r332123) @@ -6,22 +6,22 @@ * 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 - * in this position and unchanged. + * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ #include @@ -527,12 +527,17 @@ find_geom_efimedia(struct gmesh *mesh, const char *dev static int build_dp(const char *efimedia, const char *relpath, efidp *dp) { - char *fp, *dptxt = NULL; + char *fp, *dptxt = NULL, *cp, *rp; int rv = 0; - efidp out; + efidp out = NULL; size_t len; - fp = path_to_file_dp(relpath); + rp = strdup(relpath); + for (cp = rp; *cp; cp++) + if (*cp == '/') + *cp = '\\'; + fp = path_to_file_dp(rp); + free(rp); if (fp == NULL) { rv = ENOMEM; goto errout; @@ -663,6 +668,7 @@ errout: free(rp); if (rv != 0) { free(*dp); + *dp = NULL; } return (rv); } Modified: stable/11/lib/libefivar/efivar-dp.h ============================================================================== --- stable/11/lib/libefivar/efivar-dp.h Fri Apr 6 17:35:35 2018 (r332122) +++ stable/11/lib/libefivar/efivar-dp.h Fri Apr 6 18:10:38 2018 (r332123) @@ -6,22 +6,22 @@ * 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 - * in this position and unchanged. + * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. * * $FreeBSD$ */ @@ -60,6 +60,13 @@ typedef const efidp_data *const_efidp; */ ssize_t efidp_format_device_path(char *buf, size_t len, const_efidp dp, ssize_t max); +ssize_t efidp_format_device_path_node(char *buf, size_t len, const_efidp dp); ssize_t efidp_parse_device_path(char *path, efidp out, size_t max); +char * efidp_extract_file_path(const_efidp dp); + +size_t efidp_size(const_efidp); + +int efivar_device_path_to_unix_path(const_efidp dp, char **dev, char **relpath, char **abspath); +int efivar_unix_path_to_device_path(const char *path, efidp *dp); #endif /* _EFIVAR_DP_H_ */ Modified: stable/11/lib/libefivar/efivar.c ============================================================================== --- stable/11/lib/libefivar/efivar.c Fri Apr 6 17:35:35 2018 (r332122) +++ stable/11/lib/libefivar/efivar.c Fri Apr 6 18:10:38 2018 (r332123) @@ -6,22 +6,22 @@ * 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 - * in this position and unchanged. + * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ #include @@ -150,7 +150,7 @@ efi_append_variable(efi_guid_t guid, const char *name, { return efi_set_variable(guid, name, data, data_size, - attributes | EFI_VARIABLE_APPEND_WRITE, 0); + attributes | EFI_VARIABLE_APPEND_WRITE); } int @@ -158,7 +158,7 @@ efi_del_variable(efi_guid_t guid, const char *name) { /* data_size of 0 deletes the variable */ - return efi_set_variable(guid, name, NULL, 0, 0, 0); + return efi_set_variable(guid, name, NULL, 0, 0); } int @@ -225,8 +225,13 @@ efi_get_next_variable_name(efi_guid_t **guid, char **n if (efi_open_dev() == -1) return -1; + /* + * Always allocate enough for an extra NUL on the end, but don't tell + * the IOCTL about it so we can NUL terminate the name before converting + * it to UTF8. + */ if (buf == NULL) - buf = malloc(buflen); + buf = malloc(buflen + sizeof(efi_char)); again: efi_var_reset(&var); @@ -244,21 +249,23 @@ again: rv = ioctl(efi_fd, EFIIOC_VAR_NEXT, &var); if (rv == 0 && var.name == NULL) { /* - * oops, too little space. Try again. + * Variable name not long enough, so allocate more space for the + * name and try again. As above, mind the NUL we add. */ - void *new = realloc(buf, buflen); - buflen = var.namesize; + void *new = realloc(buf, var.namesize + sizeof(efi_char)); if (new == NULL) { rv = -1; errno = ENOMEM; goto done; } + buflen = var.namesize; buf = new; goto again; } if (rv == 0) { - *name = NULL; /* XXX */ + free(*name); /* Free last name, to avoid leaking */ + *name = NULL; /* Force ucs2_to_utf8 to malloc new space */ var.name[var.namesize / sizeof(efi_char)] = 0; /* EFI doesn't NUL terminate */ rv = ucs2_to_utf8(var.name, name); if (rv != 0) @@ -269,9 +276,11 @@ again: errout: /* XXX The linux interface expects name to be a static buffer -- fix or leak memory? */ + /* XXX for the moment, we free just before we'd leak, but still leak last one */ done: - if (errno == ENOENT) { + if (rv != 0 && errno == ENOENT) { errno = 0; + free(*name); /* Free last name, to avoid leaking */ return 0; } @@ -349,7 +358,7 @@ efi_name_to_guid(const char *name, efi_guid_t *guid) int efi_set_variable(efi_guid_t guid, const char *name, - uint8_t *data, size_t data_size, uint32_t attributes, mode_t mode __unused) + uint8_t *data, size_t data_size, uint32_t attributes) { struct efi_var_ioc var; int rv; Modified: stable/11/lib/libefivar/efivar.h ============================================================================== --- stable/11/lib/libefivar/efivar.h Fri Apr 6 17:35:35 2018 (r332122) +++ stable/11/lib/libefivar/efivar.h Fri Apr 6 18:10:38 2018 (r332123) @@ -6,22 +6,22 @@ * 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 - * in this position and unchanged. + * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. * * $FreeBSD$ */ @@ -83,7 +83,7 @@ int efi_guid_to_symbol(efi_guid_t *guid, char **symbol int efi_guid_to_str(const efi_guid_t *guid, char **sp); int efi_name_to_guid(const char *name, efi_guid_t *guid); int efi_set_variable(efi_guid_t guid, const char *name, - uint8_t *data, size_t data_size, uint32_t attributes, mode_t mode); + uint8_t *data, size_t data_size, uint32_t attributes); int efi_str_to_guid(const char *s, efi_guid_t *guid); int efi_variables_supported(void); @@ -98,38 +98,5 @@ struct uuid_table int efi_known_guid(struct uuid_table **); extern const efi_guid_t efi_guid_empty; - -/* Stubs that are expected, but aren't really used */ -static inline int -efi_error_get(unsigned int n __unused, char ** const fn __unused, - char ** const func __unused, int *line __unused, - char ** const msg __unused, int *err __unused) -{ - return 0; -} - -static inline int -efi_error_set(const char *fn __unused, const char *func __unused, - int line __unused, int err __unused, const char *fmt __unused, ...) -{ - return 0; -} - -static inline void -efi_error_clear(void) -{ -} - -static inline int -efi_error(const char *fmt __unused, ...) -{ - return 0; -} - -static inline int -efi_error_val(int val __unused, const char *fmt __unused, ...) -{ - return 0; -} #endif /* _EFIVAR_H_ */ Modified: stable/11/lib/libefivar/uefi-dplib.h ============================================================================== --- stable/11/lib/libefivar/uefi-dplib.h Fri Apr 6 17:35:35 2018 (r332122) +++ stable/11/lib/libefivar/uefi-dplib.h Fri Apr 6 18:10:38 2018 (r332123) @@ -6,22 +6,22 @@ * 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 - * in this position and unchanged. + * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. * * $FreeBSD$ */ Modified: stable/11/lib/libefivar/uefi-dputil.c ============================================================================== --- stable/11/lib/libefivar/uefi-dputil.c Fri Apr 6 17:35:35 2018 (r332122) +++ stable/11/lib/libefivar/uefi-dputil.c Fri Apr 6 18:10:38 2018 (r332123) @@ -6,22 +6,22 @@ * 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 - * in this position and unchanged. + * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ /* @@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$"); #include "uefi-dplib.h" -/* XXX maybe I sould include the entire DevicePathUtiltiies.c and ifdef out what we don't use */ +/* XXX maybe I should include the entire DevicePathUtiltiies.c and ifdef out what we don't use */ /* * Taken from MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c Modified: stable/11/usr.sbin/efidp/Makefile ============================================================================== --- stable/11/usr.sbin/efidp/Makefile Fri Apr 6 17:35:35 2018 (r332122) +++ stable/11/usr.sbin/efidp/Makefile Fri Apr 6 18:10:38 2018 (r332123) @@ -3,6 +3,6 @@ PROG= efidp MAN= efidp.8 -LIBADD= efivar +LIBADD= efivar geom .include Modified: stable/11/usr.sbin/efidp/efidp.8 ============================================================================== --- stable/11/usr.sbin/efidp/efidp.8 Fri Apr 6 17:35:35 2018 (r332122) +++ stable/11/usr.sbin/efidp/efidp.8 Fri Apr 6 18:10:38 2018 (r332123) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 24, 2017 +.Dd December 1, 2017 .Dt EFIDP 8 .Os .Sh NAME @@ -36,16 +36,44 @@ .Op Fl -parse .Op Fl -format .Sh DESCRIPTION -This program manages +This program converts .Dq Unified Extensible Firmware Interface .Pq UEFI -Device Paths, as defined in the UEFI standard. +Device Paths, as defined in the UEFI standard, to and from binary form. +Binary and textual forms are defined in Chapter 9 of the UEFI +Specification. +.Pp +.Bl -tag -width 20m +.It Fl f Fl -format +Formats a binary UEFI Device Path into its canonical UTF-8 textual form. +A binary Device Path can be no longer than 65536 bytes. +The textual form must fit into 65536 bytes. +Multiple binary device paths may be specified. +.It Fl p Fl -parse +Parses a UEFI Device Path UTF-8 specification and outputs the binary +Device Path form. +Only one device path is parsed, even if there are multiple present in +the input. +Leading white space is ignored. +The resulting binary Device Path can be no longer than 65536 bytes. +Multiple lines may be specified. +Each one will be translated. +.It Fl e Fl --to-efi +Translate a Unix file path to an EFI Device Path. +The output is the textual representation of the EFI Device Path. +.It Fl u Fl --to-unix +Translate an EFI device path to a Unix file path. +The input is the textual representation of the EFI Device Path. +.El .Sh SEE ALSO Appendix A of the UEFI specification has the format for GUIDs. All GUIDs .Dq Globally Unique Identifiers have the format described in RFC 4122. -.El +.Pp +The Unified Extensible Firmware Interface Specification is available +from +.Pa www.uefi.org . .Sh HISTORY The .Nm Modified: stable/11/usr.sbin/efidp/efidp.c ============================================================================== --- stable/11/usr.sbin/efidp/efidp.c Fri Apr 6 17:35:35 2018 (r332122) +++ stable/11/usr.sbin/efidp/efidp.c Fri Apr 6 18:10:38 2018 (r332123) @@ -27,9 +27,11 @@ #include __FBSDID("$FreeBSD$"); +#include #include #include #include +#include #include #include #include @@ -37,21 +39,25 @@ __FBSDID("$FreeBSD$"); #include #include +#define MAXSIZE 65536 /* Everyting will be smaller than this, most 1000x smaller */ + /* options descriptor */ static struct option longopts[] = { + { "to-unix", no_argument, NULL, 'u' }, + { "to-efi", no_argument, NULL, 'e' }, { "format", no_argument, NULL, 'f' }, { "parse", no_argument, NULL, 'p' }, { NULL, 0, NULL, 0 } }; -static int flag_format, flag_parse; +static int flag_format, flag_parse, flag_unix, flag_efi; static void usage(void) { - errx(1, "efidp [-fp]"); + errx(1, "efidp [-efpu]"); } static ssize_t @@ -62,18 +68,16 @@ read_file(int fd, void **rv) off_t off; ssize_t red; - len = 4096; + len = MAXSIZE; off = 0; retval = malloc(len); do { red = read(fd, retval + off, len - off); + if (red == 0) + break; off += red; - if (red < (ssize_t)(len - off)) + if (off == (off_t)len) break; - len *= 2; - retval = reallocf(retval, len); - if (retval == NULL) - return -1; } while (1); *rv = retval; @@ -85,15 +89,21 @@ parse_args(int argc, char **argv) { int ch; - while ((ch = getopt_long(argc, argv, "fp", + while ((ch = getopt_long(argc, argv, "efpu", longopts, NULL)) != -1) { switch (ch) { + case 'e': + flag_efi++; + break; case 'f': flag_format++; break; case 'p': flag_parse++; break; + case 'u': + flag_unix++; + break; default: usage(); } @@ -104,45 +114,139 @@ parse_args(int argc, char **argv) if (argc >= 1) usage(); - if (flag_parse + flag_format != 1) { + if (flag_parse + flag_format + flag_efi + flag_unix != 1) { warnx("Can only use one of -p (--parse), " "and -f (--format)"); usage(); } } -int -main(int argc, char **argv) +static char * +trim(char *s) { - void *data; + char *t; + + while (isspace(*s)) + s++; + t = s + strlen(s) - 1; + while (t > s && isspace(*t)) + *t-- = '\0'; + return s; +} + +static void +unix_to_efi(void) +{ + char buffer[MAXSIZE]; + char efi[MAXSIZE]; + efidp dp; + char *walker; + int rv; + + dp = NULL; + while (fgets(buffer, sizeof(buffer), stdin)) { + walker= trim(buffer); + free(dp); + dp = NULL; + rv = efivar_unix_path_to_device_path(walker, &dp); + if (rv != 0 || dp == NULL) { + errno = rv; + warn("Can't convert '%s' to efi", walker); + continue; + } + if (efidp_format_device_path(efi, sizeof(efi), + dp, efidp_size(dp)) < 0) { + warnx("Can't format dp for '%s'", walker); + continue; + } + printf("%s\n", efi); + } + free(dp); +} + +static void +efi_to_unix(void) +{ + char buffer[MAXSIZE]; + char dpbuf[MAXSIZE]; + efidp dp; + size_t dplen; + char *walker, *dev, *relpath, *abspath; + int rv; + + dp = (efidp)dpbuf; + while (fgets(buffer, sizeof(buffer), stdin)) { + walker= trim(buffer); + dplen = efidp_parse_device_path(walker, dp, sizeof(dpbuf)); + rv = efivar_device_path_to_unix_path(dp, &dev, &relpath, &abspath); + if (rv == 0) + printf("%s:%s %s\n", dev, relpath, abspath); + else { + errno = rv; + warn("Can't convert '%s' to unix", walker); + } + } +} + +static void +format(void) +{ + char buffer[MAXSIZE]; + ssize_t fmtlen; ssize_t len; + void *data; + size_t dplen; + const_efidp dp; - parse_args(argc, argv); len = read_file(STDIN_FILENO, &data); if (len == -1) err(1, "read"); - if (flag_format) { - char buffer[4096]; - ssize_t fmtlen; - + dp = (const_efidp)data; + while (len > 0) { + dplen = efidp_size(dp); fmtlen = efidp_format_device_path(buffer, sizeof(buffer), - (const_efidp)data, len); + dp, dplen); if (fmtlen > 0) printf("%s\n", buffer); - free(data); - } else if (flag_parse) { - efidp dp; - ssize_t dplen; - char *str; + len -= dplen; + dp = (const_efidp)((const char *)dp + dplen); + } + free(data); +} - dp = malloc(8192); - str = realloc(data, len + 1); - if (str == NULL || dp == NULL) - errx(1, "Can't allocate memory."); - str[len] = '\0'; - dplen = efidp_parse_device_path(str, dp, 8192); +static void +parse(void) +{ + char buffer[MAXSIZE]; + efidp dp; + ssize_t dplen; + char *walker; + + dplen = MAXSIZE; + dp = malloc(dplen); + if (dp == NULL) + errx(1, "Can't allocate memory."); + while (fgets(buffer, sizeof(buffer), stdin)) { + walker= trim(buffer); + dplen = efidp_parse_device_path(walker, dp, dplen); if (dplen == -1) - errx(1, "Can't parse %s", str); + errx(1, "Can't parse %s", walker); write(STDOUT_FILENO, dp, dplen); } + free(dp); +} + +int +main(int argc, char **argv) +{ + + parse_args(argc, argv); + if (flag_unix) + efi_to_unix(); + else if (flag_efi) + unix_to_efi(); + else if (flag_format) + format(); + else if (flag_parse) + parse(); } Modified: stable/11/usr.sbin/efivar/Makefile ============================================================================== --- stable/11/usr.sbin/efivar/Makefile Fri Apr 6 17:35:35 2018 (r332122) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Fri Apr 6 18:23:43 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0DB14F9C258; Fri, 6 Apr 2018 18:23:43 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B3DB36D249; Fri, 6 Apr 2018 18:23:42 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AEAC31578C; Fri, 6 Apr 2018 18:23:42 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w36INghU097020; Fri, 6 Apr 2018 18:23:42 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w36INguo097017; Fri, 6 Apr 2018 18:23:42 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201804061823.w36INguo097017@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Fri, 6 Apr 2018 18:23: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: r332125 - in stable/11/share: examples/etc mk X-SVN-Group: stable-11 X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: in stable/11/share: examples/etc mk X-SVN-Commit-Revision: 332125 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 18:23:43 -0000 Author: jkim Date: Fri Apr 6 18:23:42 2018 New Revision: 332125 URL: https://svnweb.freebsd.org/changeset/base/332125 Log: MFC: r314875, r331963 Catch up with Clang 6.0. Modified: stable/11/share/examples/etc/make.conf stable/11/share/mk/bsd.cpu.mk Directory Properties: stable/11/ (props changed) Modified: stable/11/share/examples/etc/make.conf ============================================================================== --- stable/11/share/examples/etc/make.conf Fri Apr 6 18:16:14 2018 (r332124) +++ stable/11/share/examples/etc/make.conf Fri Apr 6 18:23:42 2018 (r332125) @@ -44,8 +44,9 @@ # if omitted), ultrasparc3 # Additionally the following CPU types are recognized by clang: # Intel x86 architecture (for both amd64 and i386): -# (AMD CPUs) bdver4, bdver3, bdver2, bdver1, btver2, btver1 -# (Intel CPUs) skylake, knl, broadwell, haswell, ivybridge, +# (AMD CPUs) znver1, bdver4, bdver3, bdver2, bdver1, btver2, btver1 +# (Intel CPUs) cannonlake, knm, skylake-avx512, knl, goldmont, +# skylake, broadwell, haswell, ivybridge, # sandybridge, westmere, nehalem, silvermont, bonnell # # (?= allows to buildworld for a different CPUTYPE.) Modified: stable/11/share/mk/bsd.cpu.mk ============================================================================== --- stable/11/share/mk/bsd.cpu.mk Fri Apr 6 18:16:14 2018 (r332124) +++ stable/11/share/mk/bsd.cpu.mk Fri Apr 6 18:23:42 2018 (r332125) @@ -173,7 +173,9 @@ _CPUCFLAGS = -mcpu=${CPUTYPE} ########## i386 . if ${MACHINE_CPUARCH} == "i386" -. if ${CPUTYPE} == "bdver4" +. if ${CPUTYPE} == "znver1" +MACHINE_CPU = avx2 avx sse42 sse41 ssse3 sse4a sse3 sse2 sse mmx k6 k5 i586 +. elif ${CPUTYPE} == "bdver4" MACHINE_CPU = xop avx2 avx sse42 sse41 ssse3 sse4a sse3 sse2 sse mmx k6 k5 i586 . elif ${CPUTYPE} == "bdver3" || ${CPUTYPE} == "bdver2" || \ ${CPUTYPE} == "bdver1" @@ -200,14 +202,16 @@ MACHINE_CPU = 3dnow mmx k6 k5 i586 MACHINE_CPU = mmx k6 k5 i586 . elif ${CPUTYPE} == "k5" MACHINE_CPU = k5 i586 -. elif ${CPUTYPE} == "skylake" || ${CPUTYPE} == "knl" +. elif ${CPUTYPE} == "cannonlake" || ${CPUTYPE} == "knm" || \ + ${CPUTYPE} == "skylake-avx512" || ${CPUTYPE} == "knl" MACHINE_CPU = avx512 avx2 avx sse42 sse41 ssse3 sse3 sse2 sse i686 mmx i586 -. elif ${CPUTYPE} == "broadwell" || ${CPUTYPE} == "haswell" +. elif ${CPUTYPE} == "skylake" || ${CPUTYPE} == "broadwell" || \ + ${CPUTYPE} == "haswell" MACHINE_CPU = avx2 avx sse42 sse41 ssse3 sse3 sse2 sse i686 mmx i586 . elif ${CPUTYPE} == "ivybridge" || ${CPUTYPE} == "sandybridge" MACHINE_CPU = avx sse42 sse41 ssse3 sse3 sse2 sse i686 mmx i586 -. elif ${CPUTYPE} == "westmere" || ${CPUTYPE} == "nehalem" || \ - ${CPUTYPE} == "silvermont" +. elif ${CPUTYPE} == "goldmont" || ${CPUTYPE} == "westmere" || \ + ${CPUTYPE} == "nehalem" || ${CPUTYPE} == "silvermont" MACHINE_CPU = sse42 sse41 ssse3 sse3 sse2 sse i686 mmx i586 . elif ${CPUTYPE} == "penryn" MACHINE_CPU = sse41 ssse3 sse3 sse2 sse i686 mmx i586 @@ -242,7 +246,9 @@ MACHINE_CPU = mmx MACHINE_CPU += i486 ########## amd64 . elif ${MACHINE_CPUARCH} == "amd64" -. if ${CPUTYPE} == "bdver4" +. if ${CPUTYPE} == "znver1" +MACHINE_CPU = avx2 avx sse42 sse41 ssse3 sse4a sse3 +. elif ${CPUTYPE} == "bdver4" MACHINE_CPU = xop avx2 avx sse42 sse41 ssse3 sse4a sse3 . elif ${CPUTYPE} == "bdver3" || ${CPUTYPE} == "bdver2" || \ ${CPUTYPE} == "bdver1" @@ -259,14 +265,16 @@ MACHINE_CPU = k8 3dnow sse3 . elif ${CPUTYPE} == "opteron" || ${CPUTYPE} == "athlon64" || \ ${CPUTYPE} == "athlon-fx" || ${CPUTYPE} == "k8" MACHINE_CPU = k8 3dnow -. elif ${CPUTYPE} == "skylake" || ${CPUTYPE} == "knl" +. elif ${CPUTYPE} == "cannonlake" || ${CPUTYPE} == "knm" || \ + ${CPUTYPE} == "skylake-avx512" || ${CPUTYPE} == "knl" MACHINE_CPU = avx512 avx2 avx sse42 sse41 ssse3 sse3 -. elif ${CPUTYPE} == "broadwell" || ${CPUTYPE} == "haswell" +. elif ${CPUTYPE} == "skylake" || ${CPUTYPE} == "broadwell" || \ + ${CPUTYPE} == "haswell" MACHINE_CPU = avx2 avx sse42 sse41 ssse3 sse3 . elif ${CPUTYPE} == "ivybridge" || ${CPUTYPE} == "sandybridge" MACHINE_CPU = avx sse42 sse41 ssse3 sse3 -. elif ${CPUTYPE} == "westmere" || ${CPUTYPE} == "nehalem" || \ - ${CPUTYPE} == "silvermont" +. elif ${CPUTYPE} == "goldmont" || ${CPUTYPE} == "westmere" || \ + ${CPUTYPE} == "nehalem" || ${CPUTYPE} == "silvermont" MACHINE_CPU = sse42 sse41 ssse3 sse3 . elif ${CPUTYPE} == "penryn" MACHINE_CPU = sse41 ssse3 sse3 From owner-svn-src-stable-11@freebsd.org Fri Apr 6 18:25:04 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9D831F9C3D6; Fri, 6 Apr 2018 18:25:04 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 51F0A6D450; Fri, 6 Apr 2018 18:25:04 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4CCD21578D; Fri, 6 Apr 2018 18:25:04 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w36IP4kX097126; Fri, 6 Apr 2018 18:25:04 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w36IP4TO097124; Fri, 6 Apr 2018 18:25:04 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804061825.w36IP4TO097124@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 6 Apr 2018 18:25:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332126 - in stable/11/usr.sbin: . efibootmgr X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/usr.sbin: . efibootmgr X-SVN-Commit-Revision: 332126 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 18:25:04 -0000 Author: kevans Date: Fri Apr 6 18:25:03 2018 New Revision: 332126 URL: https://svnweb.freebsd.org/changeset/base/332126 Log: MFC efibootmgr: r326725-r326728, r326771, r326800-r326804, r326806, r327163 r327572-r327573, r327610-r327611, r327877, r331069 r326725: Import Netflix's efibootmgr to help manage UEFI boot variables efibootmgr manages the UEFI BootXXXX variables that implement the UEFI Boot Manager protocol defined in the UEFI standards. It is modeled after the Linux program of the same name with a mostly compatible set of command line options. Since there's a fair amount of OS specifioc code due to differeing names and methods of doing things, the compatibility isn't 100%. Basic functionality is implemented, though the more advanced next boot functionality that's been defined elsewhere is unimplemented. Submitted by: Matt Williams (with unix / efi path xlate by me) Sponsored by: Netflix r326726: Forgotten in 326725 Release Notes: Yes r326727: Remove vestiges of -d and -p commands. Fix two core dumps when optional data isn't specified. Sponsored by: Netflix r326728: Indent multiple device path entries correctly. Sponsored by: Netflix r326771: Unbreak gcc build by using (void) for functions that take no args. Sponsored by: Netflix r326800: Check return value for set_bootvar and give a good error message. CID: 1383601 Sponsored by: Netflix r326801: Don't leak new_data. CID: 1383605 Sponsored by: Netflix r326802: Fix resource leak. Free converted description after printing it. Also minor style sort of local vars. CID: 1383606 Sponsored by: Netflix r326803: Free load_opt_buf after we're done with it. CID: 1383607 Sponsored by: Netflix r326804: Add sanity testing against maximum sane lengths for device paths for loader and kernel. CID: 1383608 Sponsored by: Netflix r326806: Actually insert the free(d) call missed in r326802. Noticed by: rpokala@ r327163: Remove write-only opt and useless optlen variables. This squashes the warning gebnerated by GCC 6.x. Since variables that are now removed had come documentation value, put relevant bits in comment, so they can be resurrected from there when actually needed. r327572: Ensure that we have a description string. When unspecified, default to "". Sponsored by: Netflix r327573: Free options before setting them. This will prevent us from leaking memory when we have multiple copies of the same option from being specified. Sponsored by: Netflix r327610: Fix usage strings. -d and -p were removed before this was committed to FreeBSD, but the strings weren't updated. Sponsored by: Netflix r327611: There's no need / benefit from deleting the variable before we set it. Sponsored by: Netflix r327877: Fix error in determining the next available boot slot. Sponsored by: Netflix r331069: Make not getting BootOrder a warning, not a fatal error when printing. Sponsored by: Netflix Relnotes: yes Added: stable/11/usr.sbin/efibootmgr/ - copied from r326728, head/usr.sbin/efibootmgr/ Modified: stable/11/usr.sbin/Makefile stable/11/usr.sbin/efibootmgr/efibootmgr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/Makefile ============================================================================== --- stable/11/usr.sbin/Makefile Fri Apr 6 18:23:42 2018 (r332125) +++ stable/11/usr.sbin/Makefile Fri Apr 6 18:25:03 2018 (r332126) @@ -126,7 +126,7 @@ SUBDIR.${MK_CTM}+= ctm SUBDIR.${MK_CXGBETOOL}+= cxgbetool SUBDIR.${MK_MLX5TOOL}+= mlx5tool SUBDIR.${MK_DIALOG}+= bsdconfig -SUBDIR.${MK_EFI}+= efivar efidp +SUBDIR.${MK_EFI}+= efivar efidp efibootmgr SUBDIR.${MK_FLOPPY}+= fdcontrol SUBDIR.${MK_FLOPPY}+= fdformat SUBDIR.${MK_FLOPPY}+= fdread Modified: stable/11/usr.sbin/efibootmgr/efibootmgr.c ============================================================================== --- head/usr.sbin/efibootmgr/efibootmgr.c Sat Dec 9 07:44:00 2017 (r326728) +++ stable/11/usr.sbin/efibootmgr/efibootmgr.c Fri Apr 6 18:25:03 2018 (r332126) @@ -164,18 +164,17 @@ static int set_bootvar(const char *name, uint8_t *data, size_t size) { - efi_del_variable(EFI_GLOBAL_GUID, name); return efi_set_variable(EFI_GLOBAL_GUID, name, data, size, COMMON_ATTRS); } #define USAGE \ - " [-aAnNB Bootvar] [-t timeout] [-T] [-o bootorder] [-O] [--verbose] [--help] \n \ - [-c -d device -p partition -l loader [-L label] [--dry-run]]" + " [-aAnNB Bootvar] [-t timeout] [-T] [-o bootorder] [-O] [--verbose] [--help] \n\ + [-c -l loader [-k kernel ] [-L label] [--dry-run]]" #define CREATE_USAGE \ - " efibootmgr -c -d device -p partition -loader loader [-L label ] [--dry-run]" + " efibootmgr -c -l loader [-k kernel] [-L label] [--dry-run]" #define ORDER_USAGE \ " efibootmgr -o bootvarnum1,bootvarnum2,..." #define TIMEOUT_USAGE \ @@ -217,6 +216,7 @@ parse_args(int argc, char *argv[]) opts.dry_run = true; break; case 'e': + free(opts.env); opts.env = strdup(optarg); break; case 'h': @@ -224,12 +224,15 @@ parse_args(int argc, char *argv[]) errx(1, "%s", USAGE); break; case 'k': + free(opts.kernel); opts.kernel = strdup(optarg); break; case 'L': + free(opts.label); opts.label = strdup(optarg); break; case 'l': + free(opts.loader); opts.loader = strdup(optarg); opts.loader = mangle_loader(opts.loader); break; @@ -244,6 +247,7 @@ parse_args(int argc, char *argv[]) opts.once = true; break; case 'o': + free(opts.order); opts.order = strdup(optarg); break; case 'T': @@ -275,14 +279,16 @@ parse_args(int argc, char *argv[]) static void -print_order() +print_order(void) { uint32_t attrs; uint8_t *data; size_t size, i; - if (efi_get_variable(EFI_GLOBAL_GUID, "BootOrder", &data, &size, &attrs) < 0) - errx(1, "Couldn't get value for BootOrder\n"); + if (efi_get_variable(EFI_GLOBAL_GUID, "BootOrder", &data, &size, &attrs) < 0) { + printf("BootOrder : Couldn't get value for BootOrder\n"); + return; + } if (size % 2 == 1) errx(1, "Bad BootOrder variable: odd length"); @@ -361,6 +367,7 @@ set_boot_order(char *order) free(cp); if (set_bootvar("BootOrder", (uint8_t*)new_data, size) < 0) err(1, "Unabke to set BootOrder to %s", order); + free(new_data); } static void @@ -531,7 +538,7 @@ compare(const void *a, const void *b) } static char * -make_next_boot_var_name() +make_next_boot_var_name(void) { struct entry *v; uint16_t *vals, next_free = 0; @@ -558,7 +565,7 @@ make_next_boot_var_name() } else { /* now just run the list looking for the first hole */ for (i = 0; i < cnt - 1 && next_free == 0; i++) - if (vals[i] != vals[i + 1] + 1) + if (vals[i] + 1 != vals[i + 1]) next_free = vals[i] + 1; if (next_free == 0) next_free = vals[cnt - 1] + 1; @@ -590,12 +597,7 @@ create_loadopt(uint8_t *buf, size_t bufmax, uint32_t a /* * Compute the length to make sure the passed in buffer is long enough. */ - if (description) - utf8_to_ucs2(description, &bbuf, &desc_len); - else { - desc_len = 0; - bbuf = NULL; - } + utf8_to_ucs2(description, &bbuf, &desc_len); len = sizeof(uint32_t) + sizeof(uint16_t) + desc_len + dp_size + optional_data_size; if (len > bufmax) { free(bbuf); @@ -635,6 +637,8 @@ make_boot_var(const char *label, const char *loader, c char *bootvar = NULL; int ret; + assert(label != NULL); + bootvar = make_next_boot_var_name(); if (bootvar == NULL) err(1, "bootvar creation"); @@ -649,8 +653,14 @@ make_boot_var(const char *label, const char *loader, c kerneldp = NULL; } llen = efidp_size(loaderdp); + if (llen > MAX_DP_LEN) + errx(1, "Loader path too long."); klen = efidp_size(kerneldp); + if (klen > MAX_DP_LEN) + errx(1, "Kernel path too long."); dp = malloc(llen + klen); + if (dp == NULL) + errx(1, "Can't allocate memory for new device paths"); memcpy(dp, loaderdp, llen); if (kerneldp != NULL) memcpy((char *)dp + llen, kerneldp, klen); @@ -683,8 +693,9 @@ make_boot_var(const char *label, const char *loader, c new_ent->name = bootvar; new_ent->guid = EFI_GLOBAL_GUID; LIST_INSERT_HEAD(&efivars, new_ent, entries); - + free(load_opt_buf); free(dp); + return 0; } @@ -699,10 +710,8 @@ print_loadopt_str(uint8_t *data, size_t datalen) uint8_t *ep = data + datalen; uint8_t *walker = data; efidp dp, edp; - void *opt; char buf[1024]; int len; - int optlen; int rv; int indent; @@ -726,10 +735,11 @@ print_loadopt_str(uint8_t *data, size_t datalen) if (walker > ep) return; edp = (efidp)walker; - // Everything left is the binary option args - opt = walker; - optlen = ep - walker; - + /* + * Everything left is the binary option args + * opt = walker; + * optlen = ep - walker; + */ indent = 1; while (dp < edp) { efidp_format_device_path(buf, sizeof(buf), dp, @@ -745,12 +755,10 @@ print_loadopt_str(uint8_t *data, size_t datalen) } dp = (efidp)((char *)dp + efidp_size(dp)); } - if (optlen == 0) - return; } static char * -get_descr(uint8_t* data) +get_descr(uint8_t *data) { uint8_t *pos = data; efi_char *desc; @@ -782,9 +790,10 @@ print_boot_vars(bool verbose) * as a command epilogue */ struct entry *v; - uint32_t attrs, load_attrs; uint8_t *data; + char *d; size_t size; + uint32_t attrs, load_attrs; int ret; ret = efi_get_variable(EFI_GLOBAL_GUID, "BootNext", &data, &size, &attrs); @@ -811,9 +820,10 @@ print_boot_vars(bool verbose) if (ret < 0) continue; /* we must have deleted it */ load_attrs = le32dec(data); + d = get_descr(data); printf("%s%c %s", v->name, - ((load_attrs & LOAD_OPTION_ACTIVE) ? '*': ' '), - get_descr(data)); + ((load_attrs & LOAD_OPTION_ACTIVE) ? '*': ' '), d); + free(d); if (verbose) print_loadopt_str(data, size); else @@ -823,7 +833,7 @@ print_boot_vars(bool verbose) } static void -delete_timeout() +delete_timeout(void) { efi_del_variable(EFI_GLOBAL_GUID,"Timeout"); @@ -835,7 +845,8 @@ handle_timeout(int to) uint16_t timeout; le16enc(&timeout, to); - set_bootvar("Timeout", (uint8_t *)&timeout, sizeof(timeout)); + if (set_bootvar("Timeout", (uint8_t *)&timeout, sizeof(timeout)) < 0) + errx(1, "Can't set Timeout for booting."); } int @@ -853,8 +864,8 @@ main(int argc, char *argv[]) /* * side effect, adds to boot order, but not yet active. */ - make_boot_var(opts.label, opts.loader, opts.kernel, opts.env, - opts.dry_run); + make_boot_var(opts.label ? opts.label : "", + opts.loader, opts.kernel, opts.env, opts.dry_run); else if (opts.set_active || opts.set_inactive ) handle_activity(opts.bootnum, opts.set_active); else if (opts.order != NULL) From owner-svn-src-stable-11@freebsd.org Fri Apr 6 18:30:17 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19F8EF9CA5C; Fri, 6 Apr 2018 18:30:17 +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 A8C596D844; Fri, 6 Apr 2018 18:30:16 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id D77D110AFAD; Fri, 6 Apr 2018 14:30:14 -0400 (EDT) From: John Baldwin To: Ed Maste Cc: Mark Linimon , Dimitry Andric , Antoine Brodin , svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers , re , svn-src-stable-11@freebsd.org Subject: Re: svn commit: r331838 - in stable/11: . contrib/compiler-rt/include/sanitizer contrib/compiler-rt/include/xray contrib/compiler-rt/lib/BlocksRuntime contrib/compiler-rt/lib/asan contrib/compiler-rt/l... Date: Fri, 06 Apr 2018 11:24:53 -0700 Message-ID: <2526702.9M648BMneK@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: References: <201803311138.w2VBcKHP014025@repo.freebsd.org> <20180331184109.GA23589@lonesome.com> 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); Fri, 06 Apr 2018 14:30:14 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 18:30:17 -0000 On Monday, April 02, 2018 12:27:47 PM Ed Maste wrote: > On 31 March 2018 at 14:41, Mark Linimon wrote: > This is the most important point of this discussion: we do need to > ensure there's good communication and coordination between teams where > dependencies like this exist. I'll take the blame here: Dimitry asked > me about merging the Clang update to stable/11 and I agreed that it > was reasonable to merge sooner rather than later to have as much lead > time as possible before the 11.2 process starts. I also assumed that > outstanding Clang 6 issues in ports were farther along in being > addressed. > > The key lesson from this discussion is that for significant commits > and merges like this one we should make sure to always have sufficient > advance notice. Is this driven by -mretpoline? That is, would we not be as aggressive with pushing for clang 6 in 11.2 if it weren't for that? I kind of feel like we probably wouldn't and would have left it at 5 and let clang 6 be a FreeBSD 12 thing. Was -mretpoline backported to clang 5 (I thought there was some talk of providing patches for clang 5)? -- John Baldwin From owner-svn-src-stable-11@freebsd.org Fri Apr 6 18:38:26 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32B8EF9D828; Fri, 6 Apr 2018 18:38:26 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DC71B6E631; Fri, 6 Apr 2018 18:38:25 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D34CE15937; Fri, 6 Apr 2018 18:38:25 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w36IcPUK002269; Fri, 6 Apr 2018 18:38:25 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w36IcPql002265; Fri, 6 Apr 2018 18:38:25 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804061838.w36IcPql002265@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 6 Apr 2018 18:38:25 +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: r332127 - in stable/11/stand/efi: include libefi loader X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/stand/efi: include libefi loader X-SVN-Commit-Revision: 332127 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 18:38:26 -0000 Author: kevans Date: Fri Apr 6 18:38:25 2018 New Revision: 332127 URL: https://svnweb.freebsd.org/changeset/base/332127 Log: MFC r329268, r329517 r329268: efi: Only scan the BLKIO MEDIA once Scan only the BLOCK IO MEDIA once instead of each time for each type of device (fd, cd and hdd). Leave the mechanism to free and reprobe all devices if one day we want to implement a "dev rescan" thing. r329517: efi: Do not pad the efi devpath structure This solve problem when booting with efi on armv7 Modified: stable/11/stand/efi/include/efidevp.h stable/11/stand/efi/include/efilib.h stable/11/stand/efi/libefi/efipart.c stable/11/stand/efi/loader/main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/efi/include/efidevp.h ============================================================================== --- stable/11/stand/efi/include/efidevp.h Fri Apr 6 18:25:03 2018 (r332126) +++ stable/11/stand/efi/include/efidevp.h Fri Apr 6 18:38:25 2018 (r332127) @@ -31,6 +31,8 @@ Revision History // Device Path structures - Section C // +#pragma pack(1) + typedef struct _EFI_DEVICE_PATH { UINT8 Type; UINT8 SubType; @@ -450,5 +452,7 @@ typedef struct _EFI_DEVICE_PATH_TO_TEXT_PROTOCOL { EFI_DEVICE_PATH_TO_TEXT_NODE ConvertDeviceNodeToText; EFI_DEVICE_PATH_TO_TEXT_PATH ConvertDevicePathToText; } EFI_DEVICE_PATH_TO_TEXT_PROTOCOL; + +#pragma pack() #endif Modified: stable/11/stand/efi/include/efilib.h ============================================================================== --- stable/11/stand/efi/include/efilib.h Fri Apr 6 18:25:03 2018 (r332126) +++ stable/11/stand/efi/include/efilib.h Fri Apr 6 18:38:25 2018 (r332127) @@ -106,4 +106,7 @@ int wcscmp(CHAR16 *, CHAR16 *); void cpy8to16(const char *, CHAR16 *, size_t); void cpy16to8(const CHAR16 *, char *, size_t); +/* efipart.c */ +int efipart_inithandles(void); + #endif /* _LOADER_EFILIB_H */ Modified: stable/11/stand/efi/libefi/efipart.c ============================================================================== --- stable/11/stand/efi/libefi/efipart.c Fri Apr 6 18:25:03 2018 (r332126) +++ stable/11/stand/efi/libefi/efipart.c Fri Apr 6 18:38:25 2018 (r332127) @@ -148,7 +148,7 @@ efiblk_pdinfo_count(pdinfo_list_t *pdi) return (i); } -static int +int efipart_inithandles(void) { UINTN sz; @@ -176,6 +176,10 @@ efipart_inithandles(void) efipart_handles = hin; efipart_nhandles = sz; +#ifdef EFIPART_DEBUG + printf("%s: Got %d BLOCK IO MEDIA handle(s)\n", __func__, + efipart_nhandles); +#endif return (0); } @@ -319,11 +323,7 @@ efipart_updatefd(void) static int efipart_initfd(void) { - int rv; - rv = efipart_inithandles(); - if (rv != 0) - return (rv); STAILQ_INIT(&fdinfo); efipart_updatefd(); @@ -439,11 +439,7 @@ efipart_updatecd(void) static int efipart_initcd(void) { - int rv; - rv = efipart_inithandles(); - if (rv != 0) - return (rv); STAILQ_INIT(&cdinfo); efipart_updatecd(); @@ -685,11 +681,7 @@ efipart_updatehd(void) static int efipart_inithd(void) { - int rv; - rv = efipart_inithandles(); - if (rv != 0) - return (rv); STAILQ_INIT(&hdinfo); efipart_updatehd(); Modified: stable/11/stand/efi/loader/main.c ============================================================================== --- stable/11/stand/efi/loader/main.c Fri Apr 6 18:25:03 2018 (r332126) +++ stable/11/stand/efi/loader/main.c Fri Apr 6 18:38:25 2018 (r332127) @@ -456,11 +456,15 @@ main(int argc, CHAR16 *argv[]) } /* - * March through the device switch probing for things. + * Scan the BLOCK IO MEDIA handles then + * march through the device switch probing for things. */ - for (i = 0; devsw[i] != NULL; i++) - if (devsw[i]->dv_init != NULL) - (devsw[i]->dv_init)(); + if ((i = efipart_inithandles()) == 0) { + for (i = 0; devsw[i] != NULL; i++) + if (devsw[i]->dv_init != NULL) + (devsw[i]->dv_init)(); + } else + printf("efipart_inithandles failed %d, expect failures", i); printf("Command line arguments:"); for (i = 0; i < argc; i++) From owner-svn-src-stable-11@freebsd.org Fri Apr 6 18:40:26 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CADD6F9DAE0; Fri, 6 Apr 2018 18:40:25 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7CB416E86B; Fri, 6 Apr 2018 18:40:25 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 738BD1593C; Fri, 6 Apr 2018 18:40:25 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w36IePBr002425; Fri, 6 Apr 2018 18:40:25 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w36IeOwc002415; Fri, 6 Apr 2018 18:40:24 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804061840.w36IeOwc002415@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 6 Apr 2018 18:40:24 +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: r332128 - in stable/11/stand: . common efi/libefi efi/loader i386/loader sparc64/loader userboot/userboot X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/stand: . common efi/libefi efi/loader i386/loader sparc64/loader userboot/userboot X-SVN-Commit-Revision: 332128 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 18:40:26 -0000 Author: kevans Date: Fri Apr 6 18:40:24 2018 New Revision: 332128 URL: https://svnweb.freebsd.org/changeset/base/332128 Log: MFC r329725, r329831 r329725: Consolidate three copies of ZFS commands into a central location. There's no reason to have multiple copies of lszfs and reloadbe. Consolidate them into one location. Also ldi_get_size is the same everywhere (except sparc64). Make it the same everywhere as the common definition is more general and will work on spar64. r329831: Fix userboot w/ ZFS after r329725 r329725 cleaned up ZFS commands duplicated in multiple places, but userboot was not setting HAVE_ZFS when MK_ZFS != "no". This resulted in a failure to boot (as seen in PR 226118) in bhyve, with the following message: /boot/userboot.so: Undefined symbol "ldi_get_size" Added: stable/11/stand/common/zfs_cmd.c - copied unchanged from r329725, head/stand/common/zfs_cmd.c Modified: stable/11/stand/efi/libefi/efizfs.c stable/11/stand/efi/loader/Makefile stable/11/stand/efi/loader/main.c stable/11/stand/i386/loader/main.c stable/11/stand/loader.mk stable/11/stand/sparc64/loader/Makefile stable/11/stand/sparc64/loader/main.c stable/11/stand/userboot/userboot/Makefile stable/11/stand/userboot/userboot/main.c Directory Properties: stable/11/ (props changed) Copied: stable/11/stand/common/zfs_cmd.c (from r329725, head/stand/common/zfs_cmd.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/stand/common/zfs_cmd.c Fri Apr 6 18:40:24 2018 (r332128, copy of r329725, head/stand/common/zfs_cmd.c) @@ -0,0 +1,108 @@ +/*- + * Copyright (c) 2018 Warner Losh + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * MD bootstrap main() and assorted miscellaneous + * commands. + */ + +#include +#include +#include +#include + +#include "bootstrap.h" + +#ifdef LOADER_ZFS_SUPPORT +#include "../zfs/libzfs.h" +#endif + +COMMAND_SET(lszfs, "lszfs", "list child datasets of a zfs dataset", + command_lszfs); + +static int +command_lszfs(int argc, char *argv[]) +{ + int err; + + if (argc != 2) { + command_errmsg = "a single dataset must be supplied"; + return (CMD_ERROR); + } + + err = zfs_list(argv[1]); + if (err != 0) { + command_errmsg = strerror(err); + return (CMD_ERROR); + } + return (CMD_OK); +} + +COMMAND_SET(reloadbe, "reloadbe", "refresh the list of ZFS Boot Environments", + command_reloadbe); + +static int +command_reloadbe(int argc, char *argv[]) +{ + int err; + char *root; + + if (argc > 2) { + command_errmsg = "wrong number of arguments"; + return (CMD_ERROR); + } + + if (argc == 2) { + err = zfs_bootenv(argv[1]); + } else { + root = getenv("zfs_be_root"); + if (root == NULL) { + /* There does not appear to be a ZFS pool here, exit without error */ + return (CMD_OK); + } + err = zfs_bootenv(root); + } + + if (err != 0) { + command_errmsg = strerror(err); + return (CMD_ERROR); + } + + return (CMD_OK); +} + +uint64_t +ldi_get_size(void *priv) +{ + int fd = (uintptr_t) priv; + uint64_t size; + + ioctl(fd, DIOCGMEDIASIZE, &size); + return (size); +} Modified: stable/11/stand/efi/libefi/efizfs.c ============================================================================== --- stable/11/stand/efi/libefi/efizfs.c Fri Apr 6 18:38:25 2018 (r332127) +++ stable/11/stand/efi/libefi/efizfs.c Fri Apr 6 18:40:24 2018 (r332128) @@ -109,14 +109,4 @@ efi_zfs_probe(void) } } } - -uint64_t -ldi_get_size(void *priv) -{ - int fd = (uintptr_t) priv; - uint64_t size; - - ioctl(fd, DIOCGMEDIASIZE, &size); - return (size); -} #endif Modified: stable/11/stand/efi/loader/Makefile ============================================================================== --- stable/11/stand/efi/loader/Makefile Fri Apr 6 18:38:25 2018 (r332127) +++ stable/11/stand/efi/loader/Makefile Fri Apr 6 18:40:24 2018 (r332128) @@ -28,6 +28,7 @@ SRCS= autoload.c \ LIBZFSBOOT= ${BOOTOBJ}/zfs/libzfsboot.a CFLAGS+= -I${ZFSSRC} CFLAGS+= -DEFI_ZFS_BOOT +HAVE_ZFS= yes .endif .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201 Modified: stable/11/stand/efi/loader/main.c ============================================================================== --- stable/11/stand/efi/loader/main.c Fri Apr 6 18:38:25 2018 (r332127) +++ stable/11/stand/efi/loader/main.c Fri Apr 6 18:40:24 2018 (r332128) @@ -747,61 +747,6 @@ command_mode(int argc, char *argv[]) return (CMD_OK); } -#ifdef EFI_ZFS_BOOT -COMMAND_SET(lszfs, "lszfs", "list child datasets of a zfs dataset", - command_lszfs); - -static int -command_lszfs(int argc, char *argv[]) -{ - int err; - - if (argc != 2) { - command_errmsg = "wrong number of arguments"; - return (CMD_ERROR); - } - - err = zfs_list(argv[1]); - if (err != 0) { - command_errmsg = strerror(err); - return (CMD_ERROR); - } - return (CMD_OK); -} - -COMMAND_SET(reloadbe, "reloadbe", "refresh the list of ZFS Boot Environments", - command_reloadbe); - -static int -command_reloadbe(int argc, char *argv[]) -{ - int err; - char *root; - - if (argc > 2) { - command_errmsg = "wrong number of arguments"; - return (CMD_ERROR); - } - - if (argc == 2) { - err = zfs_bootenv(argv[1]); - } else { - root = getenv("zfs_be_root"); - if (root == NULL) { - return (CMD_OK); - } - err = zfs_bootenv(root); - } - - if (err != 0) { - command_errmsg = strerror(err); - return (CMD_ERROR); - } - - return (CMD_OK); -} -#endif - #ifdef LOADER_FDT_SUPPORT extern int command_fdt_internal(int argc, char *argv[]); Modified: stable/11/stand/i386/loader/main.c ============================================================================== --- stable/11/stand/i386/loader/main.c Fri Apr 6 18:38:25 2018 (r332127) +++ stable/11/stand/i386/loader/main.c Fri Apr 6 18:40:24 2018 (r332128) @@ -374,63 +374,6 @@ command_heap(int argc, char *argv[]) return(CMD_OK); } -#ifdef LOADER_ZFS_SUPPORT -COMMAND_SET(lszfs, "lszfs", "list child datasets of a zfs dataset", - command_lszfs); - -static int -command_lszfs(int argc, char *argv[]) -{ - int err; - - if (argc != 2) { - command_errmsg = "wrong number of arguments"; - return (CMD_ERROR); - } - - err = zfs_list(argv[1]); - if (err != 0) { - command_errmsg = strerror(err); - return (CMD_ERROR); - } - - return (CMD_OK); -} - -COMMAND_SET(reloadbe, "reloadbe", "refresh the list of ZFS Boot Environments", - command_reloadbe); - -static int -command_reloadbe(int argc, char *argv[]) -{ - int err; - char *root; - - if (argc > 2) { - command_errmsg = "wrong number of arguments"; - return (CMD_ERROR); - } - - if (argc == 2) { - err = zfs_bootenv(argv[1]); - } else { - root = getenv("zfs_be_root"); - if (root == NULL) { - /* There does not appear to be a ZFS pool here, exit without error */ - return (CMD_OK); - } - err = zfs_bootenv(root); - } - - if (err != 0) { - command_errmsg = strerror(err); - return (CMD_ERROR); - } - - return (CMD_OK); -} -#endif - /* ISA bus access functions for PnP. */ static int isa_inb(int port) @@ -463,15 +406,5 @@ i386_zfs_probe(void) sprintf(devname, "disk%d:", unit); zfs_probe_dev(devname, NULL); } -} - -uint64_t -ldi_get_size(void *priv) -{ - int fd = (uintptr_t) priv; - uint64_t size; - - ioctl(fd, DIOCGMEDIASIZE, &size); - return (size); } #endif Modified: stable/11/stand/loader.mk ============================================================================== --- stable/11/stand/loader.mk Fri Apr 6 18:38:25 2018 (r332127) +++ stable/11/stand/loader.mk Fri Apr 6 18:40:24 2018 (r332128) @@ -121,7 +121,8 @@ CFLAGS+= -DLOADER_MBR_SUPPORT CFLAGS+= -DLOADER_ZFS_SUPPORT CFLAGS+= -I${ZFSSRC} CFLAGS+= -I${SYSDIR}/cddl/boot/zfs -.if ${MACHINE} == "amd64" +SRCS+= zfs_cmd.c +.if ${MACHINE_CPUARCH} == "amd64" && ${DO32:U0} == 1 # Have to override to use 32-bit version of zfs library... # kinda lame to select that there XXX LIBZFSBOOT= ${BOOTOBJ}/zfs32/libzfsboot.a Modified: stable/11/stand/sparc64/loader/Makefile ============================================================================== --- stable/11/stand/sparc64/loader/Makefile Fri Apr 6 18:38:25 2018 (r332127) +++ stable/11/stand/sparc64/loader/Makefile Fri Apr 6 18:40:24 2018 (r332128) @@ -19,6 +19,10 @@ NEWVERSWHAT?= "bootstrap loader" sparc64 VERSION_FILE= ${.CURDIR}/../loader/version INSTALLFLAGS= -b +.if ${MK_ZFS} != "no" +HAVE_ZFS= yes +.endif + # Architecture-specific loader code .PATH: ${BOOTSRC}/sparc64/loader SRCS= locore.S main.c metadata.c vers.c Modified: stable/11/stand/sparc64/loader/main.c ============================================================================== --- stable/11/stand/sparc64/loader/main.c Fri Apr 6 18:38:25 2018 (r332127) +++ stable/11/stand/sparc64/loader/main.c Fri Apr 6 18:40:24 2018 (r332128) @@ -735,15 +735,6 @@ tlb_init_sun4u(void) #ifdef LOADER_ZFS_SUPPORT -/* Set by sparc64_zfs_probe to provide partition size. */ -static size_t part_size; - -uint64_t -ldi_get_size(void *priv __unused) -{ - return ((uint64_t)part_size); -} - static void sparc64_zfs_probe(void) { @@ -799,7 +790,6 @@ sparc64_zfs_probe(void) if (part == 2 || vtoc.part[part].tag != VTOC_TAG_FREEBSD_ZFS) continue; - part_size = vtoc.map[part].nblks; (void)sprintf(devname, "%s:%c", alias, part + 'a'); /* Get the GUID of the ZFS pool on the boot device. */ if (strcmp(devname, bootpath) == 0) @@ -948,7 +938,7 @@ static const char *const page_sizes[] = { static void pmap_print_tte_sun4u(tte_t tag, tte_t tte) -{ + printf("%s %s ", page_sizes[(tte >> TD_SIZE_SHIFT) & TD_SIZE_MASK], Modified: stable/11/stand/userboot/userboot/Makefile ============================================================================== --- stable/11/stand/userboot/userboot/Makefile Fri Apr 6 18:38:25 2018 (r332127) +++ stable/11/stand/userboot/userboot/Makefile Fri Apr 6 18:40:24 2018 (r332128) @@ -42,6 +42,7 @@ NEWVERSWHAT= "User boot" ${MACHINE_CPUARCH} .if ${MK_ZFS} != "no" CFLAGS+= -DUSERBOOT_ZFS_SUPPORT LIBZFSBOOT= ${BOOTOBJ}/zfs/libzfsboot.a +HAVE_ZFS=yes .endif # Always add MI sources Modified: stable/11/stand/userboot/userboot/main.c ============================================================================== --- stable/11/stand/userboot/userboot/main.c Fri Apr 6 18:38:25 2018 (r332127) +++ stable/11/stand/userboot/userboot/main.c Fri Apr 6 18:40:24 2018 (r332128) @@ -218,70 +218,7 @@ userboot_zfs_probe(void) userboot_zfs_found = 1; } } - -COMMAND_SET(lszfs, "lszfs", "list child datasets of a zfs dataset", - command_lszfs); - -static int -command_lszfs(int argc, char *argv[]) -{ - int err; - - if (argc != 2) { - command_errmsg = "a single dataset must be supplied"; - return (CMD_ERROR); - } - - err = zfs_list(argv[1]); - if (err != 0) { - command_errmsg = strerror(err); - return (CMD_ERROR); - } - return (CMD_OK); -} - -COMMAND_SET(reloadbe, "reloadbe", "refresh the list of ZFS Boot Environments", - command_reloadbe); - -static int -command_reloadbe(int argc, char *argv[]) -{ - int err; - char *root; - - if (argc > 2) { - command_errmsg = "wrong number of arguments"; - return (CMD_ERROR); - } - - if (argc == 2) { - err = zfs_bootenv(argv[1]); - } else { - root = getenv("zfs_be_root"); - if (root == NULL) { - return (CMD_OK); - } - err = zfs_bootenv(root); - } - - if (err != 0) { - command_errmsg = strerror(err); - return (CMD_ERROR); - } - - return (CMD_OK); -} - -uint64_t -ldi_get_size(void *priv) -{ - int fd = (uintptr_t) priv; - uint64_t size; - - ioctl(fd, DIOCGMEDIASIZE, &size); - return (size); -} -#endif /* USERBOOT_ZFS_SUPPORT */ +#endif COMMAND_SET(quit, "quit", "exit the loader", command_quit); From owner-svn-src-stable-11@freebsd.org Fri Apr 6 18:48:11 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A9EEF9E401; Fri, 6 Apr 2018 18:48:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 300E26EF79; Fri, 6 Apr 2018 18:48:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 10FFA15ADF; Fri, 6 Apr 2018 18:48:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w36ImAnn007419; Fri, 6 Apr 2018 18:48:10 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w36ImAu5007418; Fri, 6 Apr 2018 18:48:10 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804061848.w36ImAu5007418@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 6 Apr 2018 18:48: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: r332129 - stable/11 X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11 X-SVN-Commit-Revision: 332129 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 18:48:11 -0000 Author: kevans Date: Fri Apr 6 18:48:10 2018 New Revision: 332129 URL: https://svnweb.freebsd.org/changeset/base/332129 Log: Record-only MFC of r329269 and r329418 r329269 was a style(9) cleanup that had a functional side-effect. r329418 reverted it while benno regrouped to fight the forces of evil. Modified: Directory Properties: stable/11/ (props changed) From owner-svn-src-stable-11@freebsd.org Fri Apr 6 18:55:03 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1CE41F9EC5A; Fri, 6 Apr 2018 18:55:03 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C46B26F637; Fri, 6 Apr 2018 18:55:02 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BF12B15C7F; Fri, 6 Apr 2018 18:55:02 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w36It2l8012327; Fri, 6 Apr 2018 18:55:02 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w36It2j5012324; Fri, 6 Apr 2018 18:55:02 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804061855.w36It2j5012324@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 6 Apr 2018 18:55: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: r332130 - in stable/11/stand/i386: boot2 loader X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/stand/i386: boot2 loader X-SVN-Commit-Revision: 332130 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 18:55:03 -0000 Author: kevans Date: Fri Apr 6 18:55:02 2018 New Revision: 332130 URL: https://svnweb.freebsd.org/changeset/base/332130 Log: MFC r329726, r329737, r329740 r329726: Honor settings for including / excluding cd9660, ufs, ext2fs and msdos. The Makefile gives the impression that ext2fs and msdos were excluded (they weren't) and that you could exclude cd9660 and ufs support (you couldn't). Allow those to be excluded. We need to look, in the future, at trimming the number of supported filesystems, and this will make that easier. r329737: Purely whitespace changes bringing this file closer to style(9). Curiously, changing whitespace seems to cause the md5 of the .o files to differ these days hence the following testing strategy: Tested by: objdump -d | md5 (both in-tree clang and lang/gcc6) r329740: Further style(9) changes. Tested by: objdump -d | md5 (both in-tree clang and lang/gcc6) Modified: stable/11/stand/i386/boot2/boot2.c stable/11/stand/i386/loader/Makefile stable/11/stand/i386/loader/conf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/i386/boot2/boot2.c ============================================================================== --- stable/11/stand/i386/boot2/boot2.c Fri Apr 6 18:48:10 2018 (r332129) +++ stable/11/stand/i386/boot2/boot2.c Fri Apr 6 18:55:02 2018 (r332130) @@ -72,33 +72,33 @@ extern uint32_t _end; static const char optstr[NOPT] = "DhaCcdgmnpqrsv"; /* Also 'P', 'S' */ static const unsigned char flags[NOPT] = { - RBX_DUAL, - RBX_SERIAL, - RBX_ASKNAME, - RBX_CDROM, - RBX_CONFIG, - RBX_KDB, - RBX_GDB, - RBX_MUTE, - RBX_NOINTR, - RBX_PAUSE, - RBX_QUIET, - RBX_DFLTROOT, - RBX_SINGLE, - RBX_VERBOSE + RBX_DUAL, + RBX_SERIAL, + RBX_ASKNAME, + RBX_CDROM, + RBX_CONFIG, + RBX_KDB, + RBX_GDB, + RBX_MUTE, + RBX_NOINTR, + RBX_PAUSE, + RBX_QUIET, + RBX_DFLTROOT, + RBX_SINGLE, + RBX_VERBOSE }; static const char *const dev_nm[NDEV] = {"ad", "da", "fd"}; static const unsigned char dev_maj[NDEV] = {30, 4, 2}; static struct dsk { - unsigned drive; - unsigned type; - unsigned unit; - uint8_t slice; - uint8_t part; - unsigned start; - int init; + unsigned drive; + unsigned type; + unsigned unit; + uint8_t slice; + uint8_t part; + unsigned start; + int init; } dsk; static char cmd[512], cmddup[512], knamebuf[1024]; static const char *kname; @@ -126,18 +126,22 @@ static void memcpy(void *, const void *, int); static void memcpy(void *dst, const void *src, int len) { - const char *s = src; - char *d = dst; + const char *s; + char *d; - while (len--) - *d++ = *s++; + s = src; + d = dst; + + while (len--) + *d++ = *s++; } static inline int strcmp(const char *s1, const char *s2) { - for (; *s1 == *s2 && *s1; s1++, s2++); - return (unsigned char)*s1 - (unsigned char)*s2; + + for (; *s1 == *s2 && *s1; s1++, s2++); + return ((unsigned char)*s1 - (unsigned char)*s2); } #define UFS_SMALL_CGBASE @@ -146,501 +150,513 @@ strcmp(const char *s1, const char *s2) static int xfsread(ufs_ino_t inode, void *buf, size_t nbyte) { - if ((size_t)fsread(inode, buf, nbyte) != nbyte) { - printf("Invalid %s\n", "format"); - return -1; - } - return 0; + + if ((size_t)fsread(inode, buf, nbyte) != nbyte) { + printf("Invalid %s\n", "format"); + return (-1); + } + return (0); } static inline void getstr(void) { - char *s; - int c; + char *s; + int c; - s = cmd; - for (;;) { - switch (c = xgetc(0)) { - case 0: - break; - case '\177': - case '\b': - if (s > cmd) { - s--; - printf("\b \b"); - } - break; - case '\n': - case '\r': - *s = 0; - return; - default: - if (s - cmd < sizeof(cmd) - 1) - *s++ = c; - putchar(c); + s = cmd; + for (;;) { + switch (c = xgetc(0)) { + case 0: + break; + case '\177': + case '\b': + if (s > cmd) { + s--; + printf("\b \b"); + } + break; + case '\n': + case '\r': + *s = 0; + return; + default: + if (s - cmd < sizeof(cmd) - 1) + *s++ = c; + putchar(c); + } } - } } static inline void putc(int c) { - v86.addr = 0x10; - v86.eax = 0xe00 | (c & 0xff); - v86.ebx = 0x7; - v86int(); + + v86.addr = 0x10; + v86.eax = 0xe00 | (c & 0xff); + v86.ebx = 0x7; + v86int(); } int main(void) { - uint8_t autoboot; - ufs_ino_t ino; - size_t nbyte; + uint8_t autoboot; + ufs_ino_t ino; + size_t nbyte; - dmadat = (void *)(roundup2(__base + (int32_t)&_end, 0x10000) - __base); - v86.ctl = V86_FLAGS; - v86.efl = PSL_RESERVED_DEFAULT | PSL_I; - dsk.drive = *(uint8_t *)PTOV(ARGS); - dsk.type = dsk.drive & DRV_HARD ? TYPE_AD : TYPE_FD; - dsk.unit = dsk.drive & DRV_MASK; - dsk.slice = *(uint8_t *)PTOV(ARGS + 1) + 1; - bootinfo.bi_version = BOOTINFO_VERSION; - bootinfo.bi_size = sizeof(bootinfo); + dmadat = (void *)(roundup2(__base + (int32_t)&_end, 0x10000) - __base); + v86.ctl = V86_FLAGS; + v86.efl = PSL_RESERVED_DEFAULT | PSL_I; + dsk.drive = *(uint8_t *)PTOV(ARGS); + dsk.type = dsk.drive & DRV_HARD ? TYPE_AD : TYPE_FD; + dsk.unit = dsk.drive & DRV_MASK; + dsk.slice = *(uint8_t *)PTOV(ARGS + 1) + 1; + bootinfo.bi_version = BOOTINFO_VERSION; + bootinfo.bi_size = sizeof(bootinfo); - /* Process configuration file */ + /* Process configuration file */ - autoboot = 1; + autoboot = 1; - if ((ino = lookup(PATH_CONFIG)) || - (ino = lookup(PATH_DOTCONFIG))) { - nbyte = fsread(ino, cmd, sizeof(cmd) - 1); - cmd[nbyte] = '\0'; - } + if ((ino = lookup(PATH_CONFIG)) || + (ino = lookup(PATH_DOTCONFIG))) { + nbyte = fsread(ino, cmd, sizeof(cmd) - 1); + cmd[nbyte] = '\0'; + } - if (*cmd) { - memcpy(cmddup, cmd, sizeof(cmd)); - if (parse()) - autoboot = 0; - if (!OPT_CHECK(RBX_QUIET)) - printf("%s: %s", PATH_CONFIG, cmddup); - /* Do not process this command twice */ - *cmd = 0; - } + if (*cmd) { + memcpy(cmddup, cmd, sizeof(cmd)); + if (parse()) + autoboot = 0; + if (!OPT_CHECK(RBX_QUIET)) + printf("%s: %s", PATH_CONFIG, cmddup); + /* Do not process this command twice */ + *cmd = 0; + } - /* - * Try to exec stage 3 boot loader. If interrupted by a keypress, - * or in case of failure, try to load a kernel directly instead. - */ + /* + * Try to exec stage 3 boot loader. If interrupted by a keypress, + * or in case of failure, try to load a kernel directly instead. + */ - if (!kname) { - kname = PATH_LOADER; - if (autoboot && !keyhit(3*SECOND)) { - load(); - kname = PATH_KERNEL; + if (!kname) { + kname = PATH_LOADER; + if (autoboot && !keyhit(3*SECOND)) { + load(); + kname = PATH_KERNEL; + } } - } - /* Present the user with the boot2 prompt. */ + /* Present the user with the boot2 prompt. */ - for (;;) { - if (!autoboot || !OPT_CHECK(RBX_QUIET)) - printf("\nFreeBSD/x86 boot\n" - "Default: %u:%s(%u,%c)%s\n" - "boot: ", - dsk.drive & DRV_MASK, dev_nm[dsk.type], dsk.unit, - 'a' + dsk.part, kname); - if (DO_SIO) - sio_flush(); - if (!autoboot || keyhit(3*SECOND)) - getstr(); - else if (!autoboot || !OPT_CHECK(RBX_QUIET)) - putchar('\n'); - autoboot = 0; - if (parse()) - putchar('\a'); - else - load(); - } + for (;;) { + if (!autoboot || !OPT_CHECK(RBX_QUIET)) + printf("\nFreeBSD/x86 boot\n" + "Default: %u:%s(%u,%c)%s\n" + "boot: ", + dsk.drive & DRV_MASK, dev_nm[dsk.type], dsk.unit, + 'a' + dsk.part, kname); + if (DO_SIO) + sio_flush(); + if (!autoboot || keyhit(3*SECOND)) + getstr(); + else if (!autoboot || !OPT_CHECK(RBX_QUIET)) + putchar('\n'); + autoboot = 0; + if (parse()) + putchar('\a'); + else + load(); + } } /* XXX - Needed for btxld to link the boot2 binary; do not remove. */ void exit(int x) { + } static void load(void) { - union { - struct exec ex; - Elf32_Ehdr eh; - } hdr; - static Elf32_Phdr ep[2]; - static Elf32_Shdr es[2]; - caddr_t p; - ufs_ino_t ino; - uint32_t addr; - int k; - uint8_t i, j; + union { + struct exec ex; + Elf32_Ehdr eh; + } hdr; + static Elf32_Phdr ep[2]; + static Elf32_Shdr es[2]; + caddr_t p; + ufs_ino_t ino; + uint32_t addr; + int k; + uint8_t i, j; - if (!(ino = lookup(kname))) { - if (!ls) - printf("No %s\n", kname); - return; - } - if (xfsread(ino, &hdr, sizeof(hdr))) - return; - - if (N_GETMAGIC(hdr.ex) == ZMAGIC) { - addr = hdr.ex.a_entry & 0xffffff; - p = PTOV(addr); - fs_off = PAGE_SIZE; - if (xfsread(ino, p, hdr.ex.a_text)) - return; - p += roundup2(hdr.ex.a_text, PAGE_SIZE); - if (xfsread(ino, p, hdr.ex.a_data)) - return; - } else if (IS_ELF(hdr.eh)) { - fs_off = hdr.eh.e_phoff; - for (j = k = 0; k < hdr.eh.e_phnum && j < 2; k++) { - if (xfsread(ino, ep + j, sizeof(ep[0]))) + if (!(ino = lookup(kname))) { + if (!ls) + printf("No %s\n", kname); return; - if (ep[j].p_type == PT_LOAD) - j++; } - for (i = 0; i < 2; i++) { - p = PTOV(ep[i].p_paddr & 0xffffff); - fs_off = ep[i].p_offset; - if (xfsread(ino, p, ep[i].p_filesz)) + if (xfsread(ino, &hdr, sizeof(hdr))) return; - } - p += roundup2(ep[1].p_memsz, PAGE_SIZE); - bootinfo.bi_symtab = VTOP(p); - if (hdr.eh.e_shnum == hdr.eh.e_shstrndx + 3) { - fs_off = hdr.eh.e_shoff + sizeof(es[0]) * - (hdr.eh.e_shstrndx + 1); - if (xfsread(ino, &es, sizeof(es))) + + if (N_GETMAGIC(hdr.ex) == ZMAGIC) { + addr = hdr.ex.a_entry & 0xffffff; + p = PTOV(addr); + fs_off = PAGE_SIZE; + if (xfsread(ino, p, hdr.ex.a_text)) + return; + p += roundup2(hdr.ex.a_text, PAGE_SIZE); + if (xfsread(ino, p, hdr.ex.a_data)) + return; + } else if (IS_ELF(hdr.eh)) { + fs_off = hdr.eh.e_phoff; + for (j = k = 0; k < hdr.eh.e_phnum && j < 2; k++) { + if (xfsread(ino, ep + j, sizeof(ep[0]))) + return; + if (ep[j].p_type == PT_LOAD) + j++; + } + for (i = 0; i < 2; i++) { + p = PTOV(ep[i].p_paddr & 0xffffff); + fs_off = ep[i].p_offset; + if (xfsread(ino, p, ep[i].p_filesz)) + return; + } + p += roundup2(ep[1].p_memsz, PAGE_SIZE); + bootinfo.bi_symtab = VTOP(p); + if (hdr.eh.e_shnum == hdr.eh.e_shstrndx + 3) { + fs_off = hdr.eh.e_shoff + sizeof(es[0]) * + (hdr.eh.e_shstrndx + 1); + if (xfsread(ino, &es, sizeof(es))) + return; + for (i = 0; i < 2; i++) { + *(Elf32_Word *)p = es[i].sh_size; + p += sizeof(es[i].sh_size); + fs_off = es[i].sh_offset; + if (xfsread(ino, p, es[i].sh_size)) + return; + p += es[i].sh_size; + } + } + addr = hdr.eh.e_entry & 0xffffff; + bootinfo.bi_esymtab = VTOP(p); + } else { + printf("Invalid %s\n", "format"); return; - for (i = 0; i < 2; i++) { - *(Elf32_Word *)p = es[i].sh_size; - p += sizeof(es[i].sh_size); - fs_off = es[i].sh_offset; - if (xfsread(ino, p, es[i].sh_size)) - return; - p += es[i].sh_size; - } } - addr = hdr.eh.e_entry & 0xffffff; - bootinfo.bi_esymtab = VTOP(p); - } else { - printf("Invalid %s\n", "format"); - return; - } - bootinfo.bi_kernelname = VTOP(kname); - bootinfo.bi_bios_dev = dsk.drive; - __exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK), - MAKEBOOTDEV(dev_maj[dsk.type], dsk.slice, dsk.unit, dsk.part), - 0, 0, 0, VTOP(&bootinfo)); + bootinfo.bi_kernelname = VTOP(kname); + bootinfo.bi_bios_dev = dsk.drive; + __exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK), + MAKEBOOTDEV(dev_maj[dsk.type], dsk.slice, dsk.unit, dsk.part), + 0, 0, 0, VTOP(&bootinfo)); } static int parse() { - char *arg = cmd; - char *ep, *p, *q; - const char *cp; - unsigned int drv; - int c, i, j; - size_t k; + char *arg, *ep, *p, *q; + const char *cp; + unsigned int drv; + int c, i, j; + size_t k; - while ((c = *arg++)) { - if (c == ' ' || c == '\t' || c == '\n') - continue; - for (p = arg; *p && *p != '\n' && *p != ' ' && *p != '\t'; p++); - ep = p; - if (*p) - *p++ = 0; - if (c == '-') { - while ((c = *arg++)) { - if (c == 'P') { - if (*(uint8_t *)PTOV(0x496) & 0x10) { - cp = "yes"; - } else { - opts |= OPT_SET(RBX_DUAL) | OPT_SET(RBX_SERIAL); - cp = "no"; - } - printf("Keyboard: %s\n", cp); - continue; + arg = cmd; + + while ((c = *arg++)) { + if (c == ' ' || c == '\t' || c == '\n') + continue; + for (p = arg; *p && *p != '\n' && *p != ' ' && *p != '\t'; p++); + ep = p; + if (*p) + *p++ = 0; + if (c == '-') { + while ((c = *arg++)) { + if (c == 'P') { + if (*(uint8_t *)PTOV(0x496) & 0x10) { + cp = "yes"; + } else { + opts |= OPT_SET(RBX_DUAL) | + OPT_SET(RBX_SERIAL); + cp = "no"; + } + printf("Keyboard: %s\n", cp); + continue; #if SERIAL - } else if (c == 'S') { - j = 0; - while ((unsigned int)(i = *arg++ - '0') <= 9) - j = j * 10 + i; - if (j > 0 && i == -'0') { - comspeed = j; - break; - } - /* Fall through to error below ('S' not in optstr[]). */ + } else if (c == 'S') { + j = 0; + while ((u_int)(i = *arg++ - '0') <= 9) + j = j * 10 + i; + if (j > 0 && i == -'0') { + comspeed = j; + break; + } + /* + * Fall through to error below + * ('S' not in optstr[]). + */ #endif - } - for (i = 0; c != optstr[i]; i++) - if (i == NOPT - 1) - return -1; - opts ^= OPT_SET(flags[i]); - } + } + for (i = 0; c != optstr[i]; i++) + if (i == NOPT - 1) + return (-1); + opts ^= OPT_SET(flags[i]); + } #if SERIAL - ioctrl = OPT_CHECK(RBX_DUAL) ? (IO_SERIAL|IO_KEYBOARD) : - OPT_CHECK(RBX_SERIAL) ? IO_SERIAL : IO_KEYBOARD; - if (DO_SIO) { - if (sio_init(115200 / comspeed) != 0) - ioctrl &= ~IO_SERIAL; - } + ioctrl = OPT_CHECK(RBX_DUAL) ? (IO_SERIAL|IO_KEYBOARD) : + OPT_CHECK(RBX_SERIAL) ? IO_SERIAL : IO_KEYBOARD; + if (DO_SIO) { + if (sio_init(115200 / comspeed) != 0) + ioctrl &= ~IO_SERIAL; + } #endif - } else { - for (q = arg--; *q && *q != '('; q++); - if (*q) { - drv = -1; - if (arg[1] == ':') { - drv = *arg - '0'; - if (drv > 9) - return (-1); - arg += 2; + } else { + for (q = arg--; *q && *q != '('; q++); + if (*q) { + drv = -1; + if (arg[1] == ':') { + drv = *arg - '0'; + if (drv > 9) + return (-1); + arg += 2; + } + if (q - arg != 2) + return (-1); + for (i = 0; arg[0] != dev_nm[i][0] || + arg[1] != dev_nm[i][1]; i++) + if (i == NDEV - 1) + return (-1); + dsk.type = i; + arg += 3; + dsk.unit = *arg - '0'; + if (arg[1] != ',' || dsk.unit > 9) + return (-1); + arg += 2; + dsk.slice = WHOLE_DISK_SLICE; + if (arg[1] == ',') { + dsk.slice = *arg - '0' + 1; + if (dsk.slice > NDOSPART + 1) + return (-1); + arg += 2; + } + if (arg[1] != ')') + return (-1); + dsk.part = *arg - 'a'; + if (dsk.part > 7) + return (-1); + arg += 2; + if (drv == -1) + drv = dsk.unit; + dsk.drive = (dsk.type <= TYPE_MAXHARD + ? DRV_HARD : 0) + drv; + dsk_meta = 0; + } + k = ep - arg; + if (k > 0) { + if (k >= sizeof(knamebuf)) + return (-1); + memcpy(knamebuf, arg, k + 1); + kname = knamebuf; + } } - if (q - arg != 2) - return -1; - for (i = 0; arg[0] != dev_nm[i][0] || - arg[1] != dev_nm[i][1]; i++) - if (i == NDEV - 1) - return -1; - dsk.type = i; - arg += 3; - dsk.unit = *arg - '0'; - if (arg[1] != ',' || dsk.unit > 9) - return -1; - arg += 2; - dsk.slice = WHOLE_DISK_SLICE; - if (arg[1] == ',') { - dsk.slice = *arg - '0' + 1; - if (dsk.slice > NDOSPART + 1) - return -1; - arg += 2; - } - if (arg[1] != ')') - return -1; - dsk.part = *arg - 'a'; - if (dsk.part > 7) - return (-1); - arg += 2; - if (drv == -1) - drv = dsk.unit; - dsk.drive = (dsk.type <= TYPE_MAXHARD - ? DRV_HARD : 0) + drv; - dsk_meta = 0; - } - k = ep - arg; - if (k > 0) { - if (k >= sizeof(knamebuf)) - return -1; - memcpy(knamebuf, arg, k + 1); - kname = knamebuf; - } + arg = p; } - arg = p; - } - return 0; + return (0); } static int dskread(void *buf, unsigned lba, unsigned nblk) { - struct dos_partition *dp; - struct disklabel *d; - char *sec; - unsigned i; - uint8_t sl; - const char *reason; + struct dos_partition *dp; + struct disklabel *d; + char *sec; + unsigned i; + uint8_t sl; + const char *reason; - if (!dsk_meta) { - sec = dmadat->secbuf; - dsk.start = 0; - if (drvread(sec, DOSBBSECTOR, 1)) - return -1; - dp = (void *)(sec + DOSPARTOFF); - sl = dsk.slice; - if (sl < BASE_SLICE) { - for (i = 0; i < NDOSPART; i++) - if (dp[i].dp_typ == DOSPTYP_386BSD && - (dp[i].dp_flag & 0x80 || sl < BASE_SLICE)) { - sl = BASE_SLICE + i; - if (dp[i].dp_flag & 0x80 || - dsk.slice == COMPATIBILITY_SLICE) - break; + if (!dsk_meta) { + sec = dmadat->secbuf; + dsk.start = 0; + if (drvread(sec, DOSBBSECTOR, 1)) + return (-1); + dp = (void *)(sec + DOSPARTOFF); + sl = dsk.slice; + if (sl < BASE_SLICE) { + for (i = 0; i < NDOSPART; i++) + if (dp[i].dp_typ == DOSPTYP_386BSD && + (dp[i].dp_flag & 0x80 || sl < BASE_SLICE)) { + sl = BASE_SLICE + i; + if (dp[i].dp_flag & 0x80 || + dsk.slice == COMPATIBILITY_SLICE) + break; + } + if (dsk.slice == WHOLE_DISK_SLICE) + dsk.slice = sl; } - if (dsk.slice == WHOLE_DISK_SLICE) - dsk.slice = sl; + if (sl != WHOLE_DISK_SLICE) { + if (sl != COMPATIBILITY_SLICE) + dp += sl - BASE_SLICE; + if (dp->dp_typ != DOSPTYP_386BSD) { + reason = "slice"; + goto error; + } + dsk.start = dp->dp_start; + } + if (drvread(sec, dsk.start + LABELSECTOR, 1)) + return (-1); + d = (void *)(sec + LABELOFFSET); + if (d->d_magic != DISKMAGIC || d->d_magic2 != DISKMAGIC) { + if (dsk.part != RAW_PART) { + reason = "label"; + goto error; + } + } else { + if (!dsk.init) { + if (d->d_type == DTYPE_SCSI) + dsk.type = TYPE_DA; + dsk.init++; + } + if (dsk.part >= d->d_npartitions || + !d->d_partitions[dsk.part].p_size) { + reason = "partition"; + goto error; + } + dsk.start += d->d_partitions[dsk.part].p_offset; + dsk.start -= d->d_partitions[RAW_PART].p_offset; + } } - if (sl != WHOLE_DISK_SLICE) { - if (sl != COMPATIBILITY_SLICE) - dp += sl - BASE_SLICE; - if (dp->dp_typ != DOSPTYP_386BSD) { - reason = "slice"; - goto error; - } - dsk.start = dp->dp_start; - } - if (drvread(sec, dsk.start + LABELSECTOR, 1)) - return -1; - d = (void *)(sec + LABELOFFSET); - if (d->d_magic != DISKMAGIC || d->d_magic2 != DISKMAGIC) { - if (dsk.part != RAW_PART) { - reason = "label"; - goto error; - } - } else { - if (!dsk.init) { - if (d->d_type == DTYPE_SCSI) - dsk.type = TYPE_DA; - dsk.init++; - } - if (dsk.part >= d->d_npartitions || - !d->d_partitions[dsk.part].p_size) { - reason = "partition"; - goto error; - } - dsk.start += d->d_partitions[dsk.part].p_offset; - dsk.start -= d->d_partitions[RAW_PART].p_offset; - } - } - return drvread(buf, dsk.start + lba, nblk); + return (drvread(buf, dsk.start + lba, nblk)); error: - printf("Invalid %s\n", reason); - return -1; + printf("Invalid %s\n", reason); + return (-1); } static void printf(const char *fmt,...) { - va_list ap; - static char buf[10]; - char *s; - unsigned u; - int c; + va_list ap; + static char buf[10]; + char *s; + unsigned u; + int c; - va_start(ap, fmt); - while ((c = *fmt++)) { - if (c == '%') { - c = *fmt++; - switch (c) { - case 'c': - putchar(va_arg(ap, int)); - continue; - case 's': - for (s = va_arg(ap, char *); *s; s++) - putchar(*s); - continue; - case 'u': - u = va_arg(ap, unsigned); - s = buf; - do - *s++ = '0' + u % 10U; - while (u /= 10U); - while (--s >= buf) - putchar(*s); - continue; - } + va_start(ap, fmt); + while ((c = *fmt++)) { + if (c == '%') { + c = *fmt++; + switch (c) { + case 'c': + putchar(va_arg(ap, int)); + continue; + case 's': + for (s = va_arg(ap, char *); *s; s++) + putchar(*s); + continue; + case 'u': + u = va_arg(ap, unsigned); + s = buf; + do + *s++ = '0' + u % 10U; + while (u /= 10U); + while (--s >= buf) + putchar(*s); + continue; + } + } + putchar(c); } - putchar(c); - } - va_end(ap); - return; + va_end(ap); + return; } static void putchar(int c) { - if (c == '\n') - xputc('\r'); - xputc(c); + + if (c == '\n') + xputc('\r'); + xputc(c); } static int drvread(void *buf, unsigned lba, unsigned nblk) { - static unsigned c = 0x2d5c7c2f; + static unsigned c = 0x2d5c7c2f; - if (!OPT_CHECK(RBX_QUIET)) { - xputc(c = c << 8 | c >> 24); - xputc('\b'); - } - v86.ctl = V86_ADDR | V86_CALLF | V86_FLAGS; - v86.addr = XREADORG; /* call to xread in boot1 */ - v86.es = VTOPSEG(buf); - v86.eax = lba; - v86.ebx = VTOPOFF(buf); - v86.ecx = lba >> 16; - v86.edx = nblk << 8 | dsk.drive; - v86int(); - v86.ctl = V86_FLAGS; - if (V86_CY(v86.efl)) { - printf("error %u lba %u\n", v86.eax >> 8 & 0xff, lba); - return -1; - } - return 0; + if (!OPT_CHECK(RBX_QUIET)) { + xputc(c = c << 8 | c >> 24); + xputc('\b'); + } + v86.ctl = V86_ADDR | V86_CALLF | V86_FLAGS; + v86.addr = XREADORG; /* call to xread in boot1 */ + v86.es = VTOPSEG(buf); + v86.eax = lba; + v86.ebx = VTOPOFF(buf); + v86.ecx = lba >> 16; + v86.edx = nblk << 8 | dsk.drive; + v86int(); + v86.ctl = V86_FLAGS; + if (V86_CY(v86.efl)) { + printf("error %u lba %u\n", v86.eax >> 8 & 0xff, lba); + return (-1); + } + return (0); } static int keyhit(unsigned ticks) { - uint32_t t0, t1; + uint32_t t0, t1; - if (OPT_CHECK(RBX_NOINTR)) - return 0; - t0 = 0; - for (;;) { - if (xgetc(1)) - return 1; - t1 = *(uint32_t *)PTOV(0x46c); - if (!t0) - t0 = t1; - if ((uint32_t)(t1 - t0) >= ticks) - return 0; - } + if (OPT_CHECK(RBX_NOINTR)) + return (0); + t0 = 0; + for (;;) { + if (xgetc(1)) + return (1); + t1 = *(uint32_t *)PTOV(0x46c); + if (!t0) + t0 = t1; + if ((uint32_t)(t1 - t0) >= ticks) + return (0); + } } static int xputc(int c) { - if (DO_KBD) - putc(c); - if (DO_SIO) - sio_putc(c); - return c; + + if (DO_KBD) + putc(c); + if (DO_SIO) + sio_putc(c); + return (c); } static int getc(int fn) { - v86.addr = 0x16; - v86.eax = fn << 8; - v86int(); - return fn == 0 ? v86.eax & 0xff : !V86_ZR(v86.efl); + + v86.addr = 0x16; + v86.eax = fn << 8; + v86int(); + return (fn == 0 ? v86.eax & 0xff : !V86_ZR(v86.efl)); } static int xgetc(int fn) { - if (OPT_CHECK(RBX_NOINTR)) - return 0; - for (;;) { - if (DO_KBD && getc(1)) - return fn ? 1 : getc(0); - if (DO_SIO && sio_ischar()) - return fn ? 1 : sio_getc(); - if (fn) - return 0; - } + + if (OPT_CHECK(RBX_NOINTR)) + return (0); + for (;;) { + if (DO_KBD && getc(1)) + return (fn ? 1 : getc(0)); + if (DO_SIO && sio_ischar()) + return (fn ? 1 : sio_getc()); + if (fn) + return (0); + } } Modified: stable/11/stand/i386/loader/Makefile ============================================================================== --- stable/11/stand/i386/loader/Makefile Fri Apr 6 18:48:10 2018 (r332129) +++ stable/11/stand/i386/loader/Makefile Fri Apr 6 18:55:02 2018 (r332130) @@ -5,9 +5,9 @@ HAVE_GELI= yes LOADER_NET_SUPPORT?= yes LOADER_NFS_SUPPORT?= yes LOADER_TFTP_SUPPORT?= yes -LOADER_CD9660_SUPPORT?= no -LOADER_EXT2FS_SUPPORT?= no *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Fri Apr 6 19:01:10 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 44D20F9F405; Fri, 6 Apr 2018 19:01:10 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E953E6FD17; Fri, 6 Apr 2018 19:01:09 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E41C015DD2; Fri, 6 Apr 2018 19:01:09 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w36J19LV015747; Fri, 6 Apr 2018 19:01:09 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w36J18td015737; Fri, 6 Apr 2018 19:01:08 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804061901.w36J18td015737@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 6 Apr 2018 19:01:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332131 - in stable/11: share/mk stand stand/fdt stand/ficl stand/geli stand/libsa stand/mips/uboot stand/uboot/fdt stand/uboot/lib stand/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: share/mk stand stand/fdt stand/ficl stand/geli stand/libsa stand/mips/uboot stand/uboot/fdt stand/uboot/lib stand/zfs X-SVN-Commit-Revision: 332131 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 19:01:10 -0000 Author: kevans Date: Fri Apr 6 19:01:08 2018 New Revision: 332131 URL: https://svnweb.freebsd.org/changeset/base/332131 Log: MFC r329345: Eliminate bsd.stand.mk and -fPIC 32-bit intel builds OK. We don't really need a bsd.stand.mk, and it was causing a -fPIC for the toolchain to be added (bogusly) when building on amd64. Pull all relevant defs back into defs.mk and delete bsd.stand.mk. This saves about 15-20k on i386 loader and zfsloader which when combined with Lua give us a lot more stack space in those constrained environments. Deleted: stable/11/share/mk/bsd.stand.mk Modified: stable/11/stand/defs.mk stable/11/stand/fdt/Makefile stable/11/stand/ficl/Makefile stable/11/stand/geli/Makefile stable/11/stand/libsa/Makefile stable/11/stand/mips/uboot/Makefile stable/11/stand/uboot/fdt/Makefile stable/11/stand/uboot/lib/Makefile stable/11/stand/zfs/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/defs.mk ============================================================================== --- stable/11/stand/defs.mk Fri Apr 6 18:55:02 2018 (r332130) +++ stable/11/stand/defs.mk Fri Apr 6 19:01:08 2018 (r332131) @@ -99,8 +99,10 @@ SSP_CFLAGS= # currently has no /boot/loader, but may soon. CFLAGS+= -ffreestanding ${CFLAGS_NO_SIMD} .if ${MACHINE_CPUARCH} == "aarch64" -CFLAGS+= -mgeneral-regs-only -.elif ${MACHINE_CPUARCH} != "riscv" +CFLAGS+= -mgeneral-regs-only -fPIC +.elif ${MACHINE_CPUARCH} == "riscv" +CFLAGS+= -march=rv64imac -mabi=lp64 +.else CFLAGS+= -msoft-float .endif @@ -108,8 +110,10 @@ CFLAGS+= -msoft-float CFLAGS+= -march=i386 CFLAGS.gcc+= -mpreferred-stack-boundary=2 .endif +.if ${MACHINE_CPUARCH} == "amd64" && ${DO32:U0} == 0 +CFLAGS+= -fPIC -mno-red-zone +.endif - .if ${MACHINE_CPUARCH} == "arm" # Do not generate movt/movw, because the relocation fixup for them does not # translate to the -Bsymbolic -pie format required by self_reloc() in loader(8). @@ -120,6 +124,7 @@ CFLAGS.clang+= -mllvm -arm-use-movt=0 CFLAGS.clang+= -mno-movt .endif CFLAGS.clang+= -mfpu=none +CFLAGS+= -fPIC .endif # The boot loader build uses dd status=none, where possible, for reproducible @@ -128,6 +133,10 @@ CFLAGS.clang+= -mfpu=none # when this test succeeds rather than require dd to be a bootstrap tool. DD_NOSTATUS!=(dd status=none count=0 2> /dev/null && echo status=none) || true DD=dd ${DD_NOSTATUS} + +.if ${MACHINE_CPUARCH} == "mips" +CFLAGS+= -G0 -fno-pic -mno-abicalls +.endif .if ${MK_LOADER_FORCE_LE} != "no" .if ${MACHINE_ARCH} == "powerpc64" Modified: stable/11/stand/fdt/Makefile ============================================================================== --- stable/11/stand/fdt/Makefile Fri Apr 6 18:55:02 2018 (r332130) +++ stable/11/stand/fdt/Makefile Fri Apr 6 19:01:08 2018 (r332131) @@ -17,5 +17,4 @@ CFLAGS+= -I${SYSDIR}/contrib/libfdt/ -I${LDRSRC} CFLAGS+= -Wformat -Wall -.include .include Modified: stable/11/stand/ficl/Makefile ============================================================================== --- stable/11/stand/ficl/Makefile Fri Apr 6 18:55:02 2018 (r332130) +++ stable/11/stand/ficl/Makefile Fri Apr 6 19:01:08 2018 (r332131) @@ -12,7 +12,6 @@ BASE_SRCS= dict.c ficl.c fileaccess.c float.c loader.c SRCS= ${BASE_SRCS} sysdep.c softcore.c CLEANFILES+= softcore.c testmain testmain.o -.include .ifmake testmain CFLAGS= -DTESTMAIN -D_TESTMAIN CFLAGS+= -I${FICLSRC} -I${FICLSRC}/${FICL_CPUARCH} -I${LDRSRC} Modified: stable/11/stand/geli/Makefile ============================================================================== --- stable/11/stand/geli/Makefile Fri Apr 6 18:55:02 2018 (r332130) +++ stable/11/stand/geli/Makefile Fri Apr 6 19:01:08 2018 (r332131) @@ -34,5 +34,4 @@ SRCS+= geliboot_crypto.c g_eli_hmac.c g_eli_key.c g_e .PATH: ${SYSDIR}/opencrypto SRCS+= xform_aes_xts.c -.include .include Modified: stable/11/stand/libsa/Makefile ============================================================================== --- stable/11/stand/libsa/Makefile Fri Apr 6 18:55:02 2018 (r332130) +++ stable/11/stand/libsa/Makefile Fri Apr 6 19:01:08 2018 (r332131) @@ -147,5 +147,4 @@ CFLAGS.bzipfs.c+= -I${SRCTOP}/contrib/bzip2 .PATH: ${SYSDIR}/libkern SRCS+= explicit_bzero.c -.include .include Modified: stable/11/stand/mips/uboot/Makefile ============================================================================== --- stable/11/stand/mips/uboot/Makefile Fri Apr 6 18:55:02 2018 (r332130) +++ stable/11/stand/mips/uboot/Makefile Fri Apr 6 19:01:08 2018 (r332131) @@ -53,5 +53,4 @@ ubldr: ${OBJS} ldscript.abs ${.CURDIR}/ldscript.${MACH CLEANFILES+= ldscript.abs ldscript.pie ubldr ubldr.pie ubldr.bin -.include .include Modified: stable/11/stand/uboot/fdt/Makefile ============================================================================== --- stable/11/stand/uboot/fdt/Makefile Fri Apr 6 18:55:02 2018 (r332130) +++ stable/11/stand/uboot/fdt/Makefile Fri Apr 6 19:01:08 2018 (r332131) @@ -18,5 +18,4 @@ CFLAGS+= -I${FDTSRC} # Pick up the bootstrap header for some interface items CFLAGS+= -I${LDRSRC} -.include .include Modified: stable/11/stand/uboot/lib/Makefile ============================================================================== --- stable/11/stand/uboot/lib/Makefile Fri Apr 6 18:55:02 2018 (r332130) +++ stable/11/stand/uboot/lib/Makefile Fri Apr 6 19:01:08 2018 (r332131) @@ -24,5 +24,4 @@ CFLAGS+= -I${LDRSRC} CFLAGS+= -DDISK_DEBUG .endif -.include .include Modified: stable/11/stand/zfs/Makefile ============================================================================== --- stable/11/stand/zfs/Makefile Fri Apr 6 18:55:02 2018 (r332130) +++ stable/11/stand/zfs/Makefile Fri Apr 6 19:01:08 2018 (r332131) @@ -17,5 +17,4 @@ CFLAGS+= -I${SYSDIR}/crypto/skein CFLAGS+= -Wformat -Wall -.include .include From owner-svn-src-stable-11@freebsd.org Fri Apr 6 19:10:12 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9015FF9FCAF; Fri, 6 Apr 2018 19:10:12 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3911A702B8; Fri, 6 Apr 2018 19:10:12 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2F61815E5C; Fri, 6 Apr 2018 19:10:12 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w36JACOd017673; Fri, 6 Apr 2018 19:10:12 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w36JAC5l017672; Fri, 6 Apr 2018 19:10:12 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804061910.w36JAC5l017672@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 6 Apr 2018 19:10: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: r332132 - stable/11/stand/common X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/stand/common X-SVN-Commit-Revision: 332132 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 19:10:13 -0000 Author: kevans Date: Fri Apr 6 19:10:11 2018 New Revision: 332132 URL: https://svnweb.freebsd.org/changeset/base/332132 Log: MFC r329745: load_elf.c: Use consistent indentation As noted in D14267 load_elf.c has a variety of indentation styles. Move to standard 8 column hard tab indents, 4 space second level indents. Also includes some whitespace cleanups found by clang-format. Modified: stable/11/stand/common/load_elf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/common/load_elf.c ============================================================================== --- stable/11/stand/common/load_elf.c Fri Apr 6 19:01:08 2018 (r332131) +++ stable/11/stand/common/load_elf.c Fri Apr 6 19:10:11 2018 (r332132) @@ -52,29 +52,31 @@ __FBSDID("$FreeBSD$"); #endif typedef struct elf_file { - Elf_Phdr *ph; - Elf_Ehdr *ehdr; - Elf_Sym *symtab; - Elf_Hashelt *hashtab; - Elf_Hashelt nbuckets; - Elf_Hashelt nchains; - Elf_Hashelt *buckets; - Elf_Hashelt *chains; - Elf_Rel *rel; - size_t relsz; - Elf_Rela *rela; - size_t relasz; - char *strtab; - size_t strsz; - int fd; - caddr_t firstpage; - size_t firstlen; - int kernel; - u_int64_t off; + Elf_Phdr *ph; + Elf_Ehdr *ehdr; + Elf_Sym *symtab; + Elf_Hashelt *hashtab; + Elf_Hashelt nbuckets; + Elf_Hashelt nchains; + Elf_Hashelt *buckets; + Elf_Hashelt *chains; + Elf_Rel *rel; + size_t relsz; + Elf_Rela *rela; + size_t relasz; + char *strtab; + size_t strsz; + int fd; + caddr_t firstpage; + size_t firstlen; + int kernel; + u_int64_t off; } *elf_file_t; -static int __elfN(loadimage)(struct preloaded_file *mp, elf_file_t ef, u_int64_t loadaddr); -static int __elfN(lookup_symbol)(struct preloaded_file *mp, elf_file_t ef, const char* name, Elf_Sym* sym); +static int __elfN(loadimage)(struct preloaded_file *mp, elf_file_t ef, + u_int64_t loadaddr); +static int __elfN(lookup_symbol)(struct preloaded_file *mp, elf_file_t ef, + const char* name, Elf_Sym* sym); static int __elfN(reloc_ptr)(struct preloaded_file *mp, elf_file_t ef, Elf_Addr p, void *val, size_t len); static int __elfN(parse_modmetadata)(struct preloaded_file *mp, elf_file_t ef, @@ -198,11 +200,11 @@ __elfN(load_elf_header)(char *filename, elf_file_t ef) { ssize_t bytes_read; Elf_Ehdr *ehdr; - int err; + int err; /* - * Open the image, read and validate the ELF header - */ + * Open the image, read and validate the ELF header + */ if (filename == NULL) /* can't handle nameless */ return (EFTYPE); if ((ef->fd = open(filename, O_RDONLY)) == -1) @@ -237,7 +239,8 @@ __elfN(load_elf_header)(char *filename, elf_file_t ef) if (err) goto error; - if (ehdr->e_version != EV_CURRENT || ehdr->e_machine != ELF_TARG_MACH) { /* Machine ? */ + if (ehdr->e_version != EV_CURRENT || ehdr->e_machine != ELF_TARG_MACH) { + /* Machine ? */ err = EFTYPE; goto error; } @@ -271,136 +274,144 @@ int __elfN(loadfile_raw)(char *filename, u_int64_t dest, struct preloaded_file **result, int multiboot) { - struct preloaded_file *fp, *kfp; - struct elf_file ef; - Elf_Ehdr *ehdr; - int err; + struct preloaded_file *fp, *kfp; + struct elf_file ef; + Elf_Ehdr *ehdr; + int err; - fp = NULL; - bzero(&ef, sizeof(struct elf_file)); - ef.fd = -1; + fp = NULL; + bzero(&ef, sizeof(struct elf_file)); + ef.fd = -1; - err = __elfN(load_elf_header)(filename, &ef); - if (err != 0) - return (err); + err = __elfN(load_elf_header)(filename, &ef); + if (err != 0) + return (err); - ehdr = ef.ehdr; + ehdr = ef.ehdr; - /* - * Check to see what sort of module we are. - */ - kfp = file_findfile(NULL, __elfN(kerneltype)); + /* + * Check to see what sort of module we are. + */ + kfp = file_findfile(NULL, __elfN(kerneltype)); #ifdef __powerpc__ - /* - * Kernels can be ET_DYN, so just assume the first loaded object is the - * kernel. This assumption will be checked later. - */ - if (kfp == NULL) - ef.kernel = 1; -#endif - if (ef.kernel || ehdr->e_type == ET_EXEC) { - /* Looks like a kernel */ - if (kfp != NULL) { - printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadfile: kernel already loaded\n"); - err = EPERM; - goto oerr; - } - /* - * Calculate destination address based on kernel entrypoint. - * - * For ARM, the destination address is independent of any values in the - * elf header (an ARM kernel can be loaded at any 2MB boundary), so we - * leave dest set to the value calculated by archsw.arch_loadaddr() and - * passed in to this function. + /* + * Kernels can be ET_DYN, so just assume the first loaded object is the + * kernel. This assumption will be checked later. */ + if (kfp == NULL) + ef.kernel = 1; +#endif + if (ef.kernel || ehdr->e_type == ET_EXEC) { + /* Looks like a kernel */ + if (kfp != NULL) { + printf("elf" __XSTRING(__ELF_WORD_SIZE) + "_loadfile: kernel already loaded\n"); + err = EPERM; + goto oerr; + } + /* + * Calculate destination address based on kernel entrypoint. + * + * For ARM, the destination address is independent of any values + * in the elf header (an ARM kernel can be loaded at any 2MB + * boundary), so we leave dest set to the value calculated by + * archsw.arch_loadaddr() and passed in to this function. + */ #ifndef __arm__ - if (ehdr->e_type == ET_EXEC) - dest = (ehdr->e_entry & ~PAGE_MASK); + if (ehdr->e_type == ET_EXEC) + dest = (ehdr->e_entry & ~PAGE_MASK); #endif - if ((ehdr->e_entry & ~PAGE_MASK) == 0) { - printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadfile: not a kernel (maybe static binary?)\n"); - err = EPERM; - goto oerr; - } - ef.kernel = 1; + if ((ehdr->e_entry & ~PAGE_MASK) == 0) { + printf("elf" __XSTRING(__ELF_WORD_SIZE) + "_loadfile: not a kernel (maybe static binary?)\n"); + err = EPERM; + goto oerr; + } + ef.kernel = 1; - } else if (ehdr->e_type == ET_DYN) { - /* Looks like a kld module */ - if (multiboot != 0) { - printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadfile: can't load module as multiboot\n"); - err = EPERM; + } else if (ehdr->e_type == ET_DYN) { + /* Looks like a kld module */ + if (multiboot != 0) { + printf("elf" __XSTRING(__ELF_WORD_SIZE) + "_loadfile: can't load module as multiboot\n"); + err = EPERM; + goto oerr; + } + if (kfp == NULL) { + printf("elf" __XSTRING(__ELF_WORD_SIZE) + "_loadfile: can't load module before kernel\n"); + err = EPERM; + goto oerr; + } + if (strcmp(__elfN(kerneltype), kfp->f_type)) { + printf("elf" __XSTRING(__ELF_WORD_SIZE) + "_loadfile: can't load module with kernel type '%s'\n", + kfp->f_type); + err = EPERM; + goto oerr; + } + /* Looks OK, got ahead */ + ef.kernel = 0; + + } else { + err = EFTYPE; goto oerr; } - if (kfp == NULL) { - printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadfile: can't load module before kernel\n"); - err = EPERM; - goto oerr; - } - if (strcmp(__elfN(kerneltype), kfp->f_type)) { - printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadfile: can't load module with kernel type '%s'\n", kfp->f_type); - err = EPERM; - goto oerr; - } - /* Looks OK, got ahead */ - ef.kernel = 0; - } else { - err = EFTYPE; - goto oerr; - } + if (archsw.arch_loadaddr != NULL) + dest = archsw.arch_loadaddr(LOAD_ELF, ehdr, dest); + else + dest = roundup(dest, PAGE_SIZE); - if (archsw.arch_loadaddr != NULL) - dest = archsw.arch_loadaddr(LOAD_ELF, ehdr, dest); - else - dest = roundup(dest, PAGE_SIZE); + /* + * Ok, we think we should handle this. + */ + fp = file_alloc(); + if (fp == NULL) { + printf("elf" __XSTRING(__ELF_WORD_SIZE) + "_loadfile: cannot allocate module info\n"); + err = EPERM; + goto out; + } + if (ef.kernel == 1 && multiboot == 0) + setenv("kernelname", filename, 1); + fp->f_name = strdup(filename); + if (multiboot == 0) + fp->f_type = strdup(ef.kernel ? + __elfN(kerneltype) : __elfN(moduletype)); + else + fp->f_type = strdup("elf multiboot kernel"); - /* - * Ok, we think we should handle this. - */ - fp = file_alloc(); - if (fp == NULL) { - printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadfile: cannot allocate module info\n"); - err = EPERM; - goto out; - } - if (ef.kernel == 1 && multiboot == 0) - setenv("kernelname", filename, 1); - fp->f_name = strdup(filename); - if (multiboot == 0) - fp->f_type = strdup(ef.kernel ? - __elfN(kerneltype) : __elfN(moduletype)); - else - fp->f_type = strdup("elf multiboot kernel"); - #ifdef ELF_VERBOSE - if (ef.kernel) - printf("%s entry at 0x%jx\n", filename, (uintmax_t)ehdr->e_entry); + if (ef.kernel) + printf("%s entry at 0x%jx\n", filename, + (uintmax_t)ehdr->e_entry); #else - printf("%s ", filename); + printf("%s ", filename); #endif - fp->f_size = __elfN(loadimage)(fp, &ef, dest); - if (fp->f_size == 0 || fp->f_addr == 0) - goto ioerr; + fp->f_size = __elfN(loadimage)(fp, &ef, dest); + if (fp->f_size == 0 || fp->f_addr == 0) + goto ioerr; - /* save exec header as metadata */ - file_addmetadata(fp, MODINFOMD_ELFHDR, sizeof(*ehdr), ehdr); + /* save exec header as metadata */ + file_addmetadata(fp, MODINFOMD_ELFHDR, sizeof(*ehdr), ehdr); - /* Load OK, return module pointer */ - *result = (struct preloaded_file *)fp; - err = 0; - goto out; - - ioerr: - err = EIO; - oerr: - file_discard(fp); - out: - if (ef.firstpage) - free(ef.firstpage); - if (ef.fd != -1) - close(ef.fd); - return(err); + /* Load OK, return module pointer */ + *result = (struct preloaded_file *)fp; + err = 0; + goto out; + +ioerr: + err = EIO; +oerr: + file_discard(fp); +out: + if (ef.firstpage) + free(ef.firstpage); + if (ef.fd != -1) + close(ef.fd); + return (err); } /* @@ -410,408 +421,431 @@ __elfN(loadfile_raw)(char *filename, u_int64_t dest, static int __elfN(loadimage)(struct preloaded_file *fp, elf_file_t ef, u_int64_t off) { - int i; - u_int j; - Elf_Ehdr *ehdr; - Elf_Phdr *phdr, *php; - Elf_Shdr *shdr; - char *shstr; - int ret; - vm_offset_t firstaddr; - vm_offset_t lastaddr; - size_t chunk; - ssize_t result; - Elf_Addr ssym, esym; - Elf_Dyn *dp; - Elf_Addr adp; - Elf_Addr ctors; - int ndp; - int symstrindex; - int symtabindex; - Elf_Size size; - u_int fpcopy; - Elf_Sym sym; - Elf_Addr p_start, p_end; + int i; + u_int j; + Elf_Ehdr *ehdr; + Elf_Phdr *phdr, *php; + Elf_Shdr *shdr; + char *shstr; + int ret; + vm_offset_t firstaddr; + vm_offset_t lastaddr; + size_t chunk; + ssize_t result; + Elf_Addr ssym, esym; + Elf_Dyn *dp; + Elf_Addr adp; + Elf_Addr ctors; + int ndp; + int symstrindex; + int symtabindex; + Elf_Size size; + u_int fpcopy; + Elf_Sym sym; + Elf_Addr p_start, p_end; - dp = NULL; - shdr = NULL; - ret = 0; - firstaddr = lastaddr = 0; - ehdr = ef->ehdr; - if (ehdr->e_type == ET_EXEC) { + dp = NULL; + shdr = NULL; + ret = 0; + firstaddr = lastaddr = 0; + ehdr = ef->ehdr; + if (ehdr->e_type == ET_EXEC) { #if defined(__i386__) || defined(__amd64__) #if __ELF_WORD_SIZE == 64 - off = - (off & 0xffffffffff000000ull);/* x86_64 relocates after locore */ + /* x86_64 relocates after locore */ + off = - (off & 0xffffffffff000000ull); #else - off = - (off & 0xff000000u); /* i386 relocates after locore */ + /* i386 relocates after locore */ + off = - (off & 0xff000000u); #endif #elif defined(__powerpc__) - /* - * On the purely virtual memory machines like e500, the kernel is - * linked against its final VA range, which is most often not - * available at the loader stage, but only after kernel initializes - * and completes its VM settings. In such cases we cannot use p_vaddr - * field directly to load ELF segments, but put them at some - * 'load-time' locations. - */ - if (off & 0xf0000000u) { - off = -(off & 0xf0000000u); - /* - * XXX the physical load address should not be hardcoded. Note - * that the Book-E kernel assumes that it's loaded at a 16MB - * boundary for now... - */ - off += 0x01000000; - ehdr->e_entry += off; + /* + * On the purely virtual memory machines like e500, the kernel + * is linked against its final VA range, which is most often + * not available at the loader stage, but only after kernel + * initializes and completes its VM settings. In such cases we + * cannot use p_vaddr field directly to load ELF segments, but + * put them at some 'load-time' locations. + */ + if (off & 0xf0000000u) { + off = -(off & 0xf0000000u); + /* + * XXX the physical load address should not be + * hardcoded. Note that the Book-E kernel assumes that + * it's loaded at a 16MB boundary for now... + */ + off += 0x01000000; + ehdr->e_entry += off; #ifdef ELF_VERBOSE - printf("Converted entry 0x%08x\n", ehdr->e_entry); + printf("Converted entry 0x%08x\n", ehdr->e_entry); #endif - } else - off = 0; + } else + off = 0; #elif defined(__arm__) && !defined(EFI) - /* - * The elf headers in arm kernels specify virtual addresses in all - * header fields, even the ones that should be physical addresses. - * We assume the entry point is in the first page, and masking the page - * offset will leave us with the virtual address the kernel was linked - * at. We subtract that from the load offset, making 'off' into the - * value which, when added to a virtual address in an elf header, - * translates it to a physical address. We do the va->pa conversion on - * the entry point address in the header now, so that later we can - * launch the kernel by just jumping to that address. - * - * When booting from UEFI the copyin and copyout functions handle - * adjusting the location relative to the first virtual address. - * Because of this there is no need to adjust the offset or entry - * point address as these will both be handled by the efi code. - */ - off -= ehdr->e_entry & ~PAGE_MASK; - ehdr->e_entry += off; + /* + * The elf headers in arm kernels specify virtual addresses in + * all header fields, even the ones that should be physical + * addresses. We assume the entry point is in the first page, + * and masking the page offset will leave us with the virtual + * address the kernel was linked at. We subtract that from the + * load offset, making 'off' into the value which, when added + * to a virtual address in an elf header, translates it to a + * physical address. We do the va->pa conversion on the entry + * point address in the header now, so that later we can launch + * the kernel by just jumping to that address. + * + * When booting from UEFI the copyin and copyout functions + * handle adjusting the location relative to the first virtual + * address. Because of this there is no need to adjust the + * offset or entry point address as these will both be handled + * by the efi code. + */ + off -= ehdr->e_entry & ~PAGE_MASK; + ehdr->e_entry += off; #ifdef ELF_VERBOSE - printf("ehdr->e_entry 0x%08x, va<->pa off %llx\n", ehdr->e_entry, off); + printf("ehdr->e_entry 0x%08x, va<->pa off %llx\n", + ehdr->e_entry, off); #endif #else - off = 0; /* other archs use direct mapped kernels */ + off = 0; /* other archs use direct mapped kernels */ #endif - } - ef->off = off; + } + ef->off = off; - if (ef->kernel) - __elfN(relocation_offset) = off; + if (ef->kernel) + __elfN(relocation_offset) = off; - if ((ehdr->e_phoff + ehdr->e_phnum * sizeof(*phdr)) > ef->firstlen) { - printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadimage: program header not within first page\n"); - goto out; - } - phdr = (Elf_Phdr *)(ef->firstpage + ehdr->e_phoff); + if ((ehdr->e_phoff + ehdr->e_phnum * sizeof(*phdr)) > ef->firstlen) { + printf("elf" __XSTRING(__ELF_WORD_SIZE) + "_loadimage: program header not within first page\n"); + goto out; + } + phdr = (Elf_Phdr *)(ef->firstpage + ehdr->e_phoff); - for (i = 0; i < ehdr->e_phnum; i++) { - if (elf_program_header_convert(ehdr, phdr)) - continue; + for (i = 0; i < ehdr->e_phnum; i++) { + if (elf_program_header_convert(ehdr, phdr)) + continue; - /* We want to load PT_LOAD segments only.. */ - if (phdr[i].p_type != PT_LOAD) - continue; + /* We want to load PT_LOAD segments only.. */ + if (phdr[i].p_type != PT_LOAD) + continue; #ifdef ELF_VERBOSE - printf("Segment: 0x%lx@0x%lx -> 0x%lx-0x%lx", - (long)phdr[i].p_filesz, (long)phdr[i].p_offset, - (long)(phdr[i].p_vaddr + off), - (long)(phdr[i].p_vaddr + off + phdr[i].p_memsz - 1)); + printf("Segment: 0x%lx@0x%lx -> 0x%lx-0x%lx", + (long)phdr[i].p_filesz, (long)phdr[i].p_offset, + (long)(phdr[i].p_vaddr + off), + (long)(phdr[i].p_vaddr + off + phdr[i].p_memsz - 1)); #else - if ((phdr[i].p_flags & PF_W) == 0) { - printf("text=0x%lx ", (long)phdr[i].p_filesz); - } else { - printf("data=0x%lx", (long)phdr[i].p_filesz); - if (phdr[i].p_filesz < phdr[i].p_memsz) - printf("+0x%lx", (long)(phdr[i].p_memsz -phdr[i].p_filesz)); - printf(" "); - } + if ((phdr[i].p_flags & PF_W) == 0) { + printf("text=0x%lx ", (long)phdr[i].p_filesz); + } else { + printf("data=0x%lx", (long)phdr[i].p_filesz); + if (phdr[i].p_filesz < phdr[i].p_memsz) + printf("+0x%lx", (long)(phdr[i].p_memsz - + phdr[i].p_filesz)); + printf(" "); + } #endif - fpcopy = 0; - if (ef->firstlen > phdr[i].p_offset) { - fpcopy = ef->firstlen - phdr[i].p_offset; - archsw.arch_copyin(ef->firstpage + phdr[i].p_offset, - phdr[i].p_vaddr + off, fpcopy); - } - if (phdr[i].p_filesz > fpcopy) { - if (kern_pread(ef->fd, phdr[i].p_vaddr + off + fpcopy, - phdr[i].p_filesz - fpcopy, phdr[i].p_offset + fpcopy) != 0) { - printf("\nelf" __XSTRING(__ELF_WORD_SIZE) - "_loadimage: read failed\n"); - goto out; - } - } - /* clear space from oversized segments; eg: bss */ - if (phdr[i].p_filesz < phdr[i].p_memsz) { + fpcopy = 0; + if (ef->firstlen > phdr[i].p_offset) { + fpcopy = ef->firstlen - phdr[i].p_offset; + archsw.arch_copyin(ef->firstpage + phdr[i].p_offset, + phdr[i].p_vaddr + off, fpcopy); + } + if (phdr[i].p_filesz > fpcopy) { + if (kern_pread(ef->fd, phdr[i].p_vaddr + off + fpcopy, + phdr[i].p_filesz - fpcopy, + phdr[i].p_offset + fpcopy) != 0) { + printf("\nelf" __XSTRING(__ELF_WORD_SIZE) + "_loadimage: read failed\n"); + goto out; + } + } + /* clear space from oversized segments; eg: bss */ + if (phdr[i].p_filesz < phdr[i].p_memsz) { #ifdef ELF_VERBOSE - printf(" (bss: 0x%lx-0x%lx)", - (long)(phdr[i].p_vaddr + off + phdr[i].p_filesz), - (long)(phdr[i].p_vaddr + off + phdr[i].p_memsz - 1)); + printf(" (bss: 0x%lx-0x%lx)", + (long)(phdr[i].p_vaddr + off + phdr[i].p_filesz), + (long)(phdr[i].p_vaddr + off + phdr[i].p_memsz -1)); #endif - kern_bzero(phdr[i].p_vaddr + off + phdr[i].p_filesz, - phdr[i].p_memsz - phdr[i].p_filesz); - } + kern_bzero(phdr[i].p_vaddr + off + phdr[i].p_filesz, + phdr[i].p_memsz - phdr[i].p_filesz); + } #ifdef ELF_VERBOSE - printf("\n"); + printf("\n"); #endif - if (archsw.arch_loadseg != NULL) - archsw.arch_loadseg(ehdr, phdr + i, off); + if (archsw.arch_loadseg != NULL) + archsw.arch_loadseg(ehdr, phdr + i, off); - if (firstaddr == 0 || firstaddr > (phdr[i].p_vaddr + off)) - firstaddr = phdr[i].p_vaddr + off; - if (lastaddr == 0 || lastaddr < (phdr[i].p_vaddr + off + phdr[i].p_memsz)) - lastaddr = phdr[i].p_vaddr + off + phdr[i].p_memsz; - } - lastaddr = roundup(lastaddr, sizeof(long)); + if (firstaddr == 0 || firstaddr > (phdr[i].p_vaddr + off)) + firstaddr = phdr[i].p_vaddr + off; + if (lastaddr == 0 || lastaddr < + (phdr[i].p_vaddr + off + phdr[i].p_memsz)) + lastaddr = phdr[i].p_vaddr + off + phdr[i].p_memsz; + } + lastaddr = roundup(lastaddr, sizeof(long)); - /* - * Get the section headers. We need this for finding the .ctors - * section as well as for loading any symbols. Both may be hard - * to do if reading from a .gz file as it involves seeking. I - * think the rule is going to have to be that you must strip a - * file to remove symbols before gzipping it. - */ - chunk = (size_t)ehdr->e_shnum * (size_t)ehdr->e_shentsize; - if (chunk == 0 || ehdr->e_shoff == 0) - goto nosyms; - shdr = alloc_pread(ef->fd, ehdr->e_shoff, chunk); - if (shdr == NULL) { - printf("\nelf" __XSTRING(__ELF_WORD_SIZE) - "_loadimage: failed to read section headers"); - goto nosyms; - } + /* + * Get the section headers. We need this for finding the .ctors + * section as well as for loading any symbols. Both may be hard + * to do if reading from a .gz file as it involves seeking. I + * think the rule is going to have to be that you must strip a + * file to remove symbols before gzipping it. + */ + chunk = (size_t)ehdr->e_shnum * (size_t)ehdr->e_shentsize; + if (chunk == 0 || ehdr->e_shoff == 0) + goto nosyms; + shdr = alloc_pread(ef->fd, ehdr->e_shoff, chunk); + if (shdr == NULL) { + printf("\nelf" __XSTRING(__ELF_WORD_SIZE) + "_loadimage: failed to read section headers"); + goto nosyms; + } - for (i = 0; i < ehdr->e_shnum; i++) - elf_section_header_convert(ehdr, &shdr[i]); + for (i = 0; i < ehdr->e_shnum; i++) + elf_section_header_convert(ehdr, &shdr[i]); - file_addmetadata(fp, MODINFOMD_SHDR, chunk, shdr); + file_addmetadata(fp, MODINFOMD_SHDR, chunk, shdr); - /* - * Read the section string table and look for the .ctors section. - * We need to tell the kernel where it is so that it can call the - * ctors. - */ - chunk = shdr[ehdr->e_shstrndx].sh_size; - if (chunk) { - shstr = alloc_pread(ef->fd, shdr[ehdr->e_shstrndx].sh_offset, chunk); - if (shstr) { - for (i = 0; i < ehdr->e_shnum; i++) { - if (strcmp(shstr + shdr[i].sh_name, ".ctors") != 0) - continue; - ctors = shdr[i].sh_addr; - file_addmetadata(fp, MODINFOMD_CTORS_ADDR, sizeof(ctors), - &ctors); - size = shdr[i].sh_size; - file_addmetadata(fp, MODINFOMD_CTORS_SIZE, sizeof(size), - &size); - break; - } - free(shstr); + /* + * Read the section string table and look for the .ctors section. + * We need to tell the kernel where it is so that it can call the + * ctors. + */ + chunk = shdr[ehdr->e_shstrndx].sh_size; + if (chunk) { + shstr = alloc_pread(ef->fd, shdr[ehdr->e_shstrndx].sh_offset, + chunk); + if (shstr) { + for (i = 0; i < ehdr->e_shnum; i++) { + if (strcmp(shstr + shdr[i].sh_name, + ".ctors") != 0) + continue; + ctors = shdr[i].sh_addr; + file_addmetadata(fp, MODINFOMD_CTORS_ADDR, + sizeof(ctors), &ctors); + size = shdr[i].sh_size; + file_addmetadata(fp, MODINFOMD_CTORS_SIZE, + sizeof(size), &size); + break; + } + free(shstr); + } } - } - /* - * Now load any symbols. - */ - symtabindex = -1; - symstrindex = -1; - for (i = 0; i < ehdr->e_shnum; i++) { - if (shdr[i].sh_type != SHT_SYMTAB) - continue; - for (j = 0; j < ehdr->e_phnum; j++) { - if (phdr[j].p_type != PT_LOAD) - continue; - if (shdr[i].sh_offset >= phdr[j].p_offset && - (shdr[i].sh_offset + shdr[i].sh_size <= - phdr[j].p_offset + phdr[j].p_filesz)) { - shdr[i].sh_offset = 0; - shdr[i].sh_size = 0; - break; - } + /* + * Now load any symbols. + */ + symtabindex = -1; + symstrindex = -1; + for (i = 0; i < ehdr->e_shnum; i++) { + if (shdr[i].sh_type != SHT_SYMTAB) + continue; + for (j = 0; j < ehdr->e_phnum; j++) { + if (phdr[j].p_type != PT_LOAD) + continue; + if (shdr[i].sh_offset >= phdr[j].p_offset && + (shdr[i].sh_offset + shdr[i].sh_size <= + phdr[j].p_offset + phdr[j].p_filesz)) { + shdr[i].sh_offset = 0; + shdr[i].sh_size = 0; + break; + } + } + if (shdr[i].sh_offset == 0 || shdr[i].sh_size == 0) + continue; /* alread loaded in a PT_LOAD above */ + /* Save it for loading below */ + symtabindex = i; + symstrindex = shdr[i].sh_link; } - if (shdr[i].sh_offset == 0 || shdr[i].sh_size == 0) - continue; /* alread loaded in a PT_LOAD above */ - /* Save it for loading below */ - symtabindex = i; - symstrindex = shdr[i].sh_link; - } - if (symtabindex < 0 || symstrindex < 0) - goto nosyms; + if (symtabindex < 0 || symstrindex < 0) + goto nosyms; - /* Ok, committed to a load. */ + /* Ok, committed to a load. */ #ifndef ELF_VERBOSE - printf("syms=["); + printf("syms=["); #endif - ssym = lastaddr; - for (i = symtabindex; i >= 0; i = symstrindex) { + ssym = lastaddr; + for (i = symtabindex; i >= 0; i = symstrindex) { #ifdef ELF_VERBOSE - char *secname; + char *secname; - switch(shdr[i].sh_type) { - case SHT_SYMTAB: /* Symbol table */ - secname = "symtab"; - break; - case SHT_STRTAB: /* String table */ - secname = "strtab"; - break; - default: - secname = "WHOA!!"; - break; - } + switch(shdr[i].sh_type) { + case SHT_SYMTAB: /* Symbol table */ + secname = "symtab"; + break; + case SHT_STRTAB: /* String table */ + secname = "strtab"; + break; + default: + secname = "WHOA!!"; + break; + } #endif - size = shdr[i].sh_size; + size = shdr[i].sh_size; #if defined(__powerpc__) #if __ELF_WORD_SIZE == 64 - size = htobe64(size); + size = htobe64(size); #else - size = htobe32(size); + size = htobe32(size); #endif #endif - archsw.arch_copyin(&size, lastaddr, sizeof(size)); - lastaddr += sizeof(size); + archsw.arch_copyin(&size, lastaddr, sizeof(size)); + lastaddr += sizeof(size); #ifdef ELF_VERBOSE - printf("\n%s: 0x%jx@0x%jx -> 0x%jx-0x%jx", secname, - (uintmax_t)shdr[i].sh_size, (uintmax_t)shdr[i].sh_offset, - (uintmax_t)lastaddr, (uintmax_t)(lastaddr + shdr[i].sh_size)); + printf("\n%s: 0x%jx@0x%jx -> 0x%jx-0x%jx", secname, + (uintmax_t)shdr[i].sh_size, (uintmax_t)shdr[i].sh_offset, + (uintmax_t)lastaddr, + (uintmax_t)(lastaddr + shdr[i].sh_size)); #else - if (i == symstrindex) - printf("+"); - printf("0x%lx+0x%lx", (long)sizeof(size), (long)size); + if (i == symstrindex) + printf("+"); + printf("0x%lx+0x%lx", (long)sizeof(size), (long)size); #endif - if (lseek(ef->fd, (off_t)shdr[i].sh_offset, SEEK_SET) == -1) { - printf("\nelf" __XSTRING(__ELF_WORD_SIZE) "_loadimage: could not seek for symbols - skipped!"); - lastaddr = ssym; - ssym = 0; - goto nosyms; + if (lseek(ef->fd, (off_t)shdr[i].sh_offset, SEEK_SET) == -1) { + printf("\nelf" __XSTRING(__ELF_WORD_SIZE) + "_loadimage: could not seek for symbols - skipped!"); + lastaddr = ssym; + ssym = 0; + goto nosyms; + } + result = archsw.arch_readin(ef->fd, lastaddr, shdr[i].sh_size); + if (result < 0 || (size_t)result != shdr[i].sh_size) { + printf("\nelf" __XSTRING(__ELF_WORD_SIZE) + "_loadimage: could not read symbols - skipped! " + "(%ju != %ju)", (uintmax_t)result, + (uintmax_t)shdr[i].sh_size); + lastaddr = ssym; + ssym = 0; + goto nosyms; + } + /* Reset offsets relative to ssym */ + lastaddr += shdr[i].sh_size; + lastaddr = roundup(lastaddr, sizeof(size)); + if (i == symtabindex) + symtabindex = -1; + else if (i == symstrindex) + symstrindex = -1; } - result = archsw.arch_readin(ef->fd, lastaddr, shdr[i].sh_size); - if (result < 0 || (size_t)result != shdr[i].sh_size) { - printf("\nelf" __XSTRING(__ELF_WORD_SIZE) "_loadimage: could not read symbols - skipped! (%ju != %ju)", (uintmax_t)result, - (uintmax_t)shdr[i].sh_size); - lastaddr = ssym; - ssym = 0; - goto nosyms; - } - /* Reset offsets relative to ssym */ - lastaddr += shdr[i].sh_size; - lastaddr = roundup(lastaddr, sizeof(size)); - if (i == symtabindex) - symtabindex = -1; - else if (i == symstrindex) - symstrindex = -1; - } - esym = lastaddr; + esym = lastaddr; #ifndef ELF_VERBOSE - printf("]"); + printf("]"); #endif #if defined(__powerpc__) /* On PowerPC we always need to provide BE data to the kernel */ #if __ELF_WORD_SIZE == 64 - ssym = htobe64((uint64_t)ssym); - esym = htobe64((uint64_t)esym); + ssym = htobe64((uint64_t)ssym); + esym = htobe64((uint64_t)esym); #else - ssym = htobe32((uint32_t)ssym); - esym = htobe32((uint32_t)esym); + ssym = htobe32((uint32_t)ssym); + esym = htobe32((uint32_t)esym); #endif #endif - file_addmetadata(fp, MODINFOMD_SSYM, sizeof(ssym), &ssym); - file_addmetadata(fp, MODINFOMD_ESYM, sizeof(esym), &esym); + file_addmetadata(fp, MODINFOMD_SSYM, sizeof(ssym), &ssym); + file_addmetadata(fp, MODINFOMD_ESYM, sizeof(esym), &esym); nosyms: - printf("\n"); + printf("\n"); - ret = lastaddr - firstaddr; - fp->f_addr = firstaddr; + ret = lastaddr - firstaddr; + fp->f_addr = firstaddr; - php = NULL; - for (i = 0; i < ehdr->e_phnum; i++) { - if (phdr[i].p_type == PT_DYNAMIC) { - php = phdr + i; - adp = php->p_vaddr; - file_addmetadata(fp, MODINFOMD_DYNAMIC, sizeof(adp), &adp); - break; + php = NULL; + for (i = 0; i < ehdr->e_phnum; i++) { + if (phdr[i].p_type == PT_DYNAMIC) { + php = phdr + i; + adp = php->p_vaddr; + file_addmetadata(fp, MODINFOMD_DYNAMIC, sizeof(adp), + &adp); + break; + } } - } - if (php == NULL) /* this is bad, we cannot get to symbols or _DYNAMIC */ - goto out; + if (php == NULL) /* this is bad, we cannot get to symbols or _DYNAMIC */ + goto out; - ndp = php->p_filesz / sizeof(Elf_Dyn); - if (ndp == 0) - goto out; - dp = malloc(php->p_filesz); - if (dp == NULL) - goto out; - archsw.arch_copyout(php->p_vaddr + off, dp, php->p_filesz); + ndp = php->p_filesz / sizeof(Elf_Dyn); + if (ndp == 0) + goto out; + dp = malloc(php->p_filesz); + if (dp == NULL) + goto out; + archsw.arch_copyout(php->p_vaddr + off, dp, php->p_filesz); - ef->strsz = 0; - for (i = 0; i < ndp; i++) { - if (dp[i].d_tag == 0) - break; - switch (dp[i].d_tag) { - case DT_HASH: - ef->hashtab = (Elf_Hashelt*)(uintptr_t)(dp[i].d_un.d_ptr + off); - break; - case DT_STRTAB: - ef->strtab = (char *)(uintptr_t)(dp[i].d_un.d_ptr + off); - break; - case DT_STRSZ: - ef->strsz = dp[i].d_un.d_val; - break; - case DT_SYMTAB: - ef->symtab = (Elf_Sym*)(uintptr_t)(dp[i].d_un.d_ptr + off); - break; - case DT_REL: - ef->rel = (Elf_Rel *)(uintptr_t)(dp[i].d_un.d_ptr + off); - break; - case DT_RELSZ: - ef->relsz = dp[i].d_un.d_val; - break; - case DT_RELA: - ef->rela = (Elf_Rela *)(uintptr_t)(dp[i].d_un.d_ptr + off); - break; - case DT_RELASZ: - ef->relasz = dp[i].d_un.d_val; - break; - default: - break; + ef->strsz = 0; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Fri Apr 6 19:11:58 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C04BBFA0043; Fri, 6 Apr 2018 19:11:58 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6CF3F70681; Fri, 6 Apr 2018 19:11:58 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 67C2A15FC1; Fri, 6 Apr 2018 19:11:58 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w36JBwIb022403; Fri, 6 Apr 2018 19:11:58 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w36JBwrf022402; Fri, 6 Apr 2018 19:11:58 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804061911.w36JBwrf022402@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 6 Apr 2018 19:11:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332134 - stable/11/stand/sparc64/loader X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/stand/sparc64/loader X-SVN-Commit-Revision: 332134 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 19:11:58 -0000 Author: kevans Date: Fri Apr 6 19:11:58 2018 New Revision: 332134 URL: https://svnweb.freebsd.org/changeset/base/332134 Log: MFC r329758: Fix compilation with LOADER_DEBUG defined after r329725. Modified: stable/11/stand/sparc64/loader/main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/sparc64/loader/main.c ============================================================================== --- stable/11/stand/sparc64/loader/main.c Fri Apr 6 19:11:22 2018 (r332133) +++ stable/11/stand/sparc64/loader/main.c Fri Apr 6 19:11:58 2018 (r332134) @@ -938,7 +938,7 @@ static const char *const page_sizes[] = { static void pmap_print_tte_sun4u(tte_t tag, tte_t tte) - +{ printf("%s %s ", page_sizes[(tte >> TD_SIZE_SHIFT) & TD_SIZE_MASK], From owner-svn-src-stable-11@freebsd.org Fri Apr 6 19:18:01 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E8030FA0668; Fri, 6 Apr 2018 19:18:00 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9A93970B95; Fri, 6 Apr 2018 19:18:00 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 959C11600A; Fri, 6 Apr 2018 19:18:00 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w36JI0SR022805; Fri, 6 Apr 2018 19:18:00 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w36JHxCi022789; Fri, 6 Apr 2018 19:17:59 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804061917.w36JHxCi022789@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 6 Apr 2018 19:17:59 +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: r332135 - in stable/11: contrib/compiler-rt/lib/builtins include stand sys/arm/include sys/arm64/include sys/mips/include sys/powerpc/include sys/riscv/include sys/sparc64/include sys/s... X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: contrib/compiler-rt/lib/builtins include stand sys/arm/include sys/arm64/include sys/mips/include sys/powerpc/include sys/riscv/include sys/sparc64/include sys/sys sys/x86/include X-SVN-Commit-Revision: 332135 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 19:18:01 -0000 Author: kevans Date: Fri Apr 6 19:17:59 2018 New Revision: 332135 URL: https://svnweb.freebsd.org/changeset/base/332135 Log: MFC r329859,r329860: Float protection in stand r329859: Do not include float interfaces when using libsa. We don't support float in the boot loaders, so don't include interfaces for float or double in systems headers. In addition, take the unusual step of spiking double and float to prevent any more accidental seepage. r329860: Floaty McFloatface is funnier... Modified: stable/11/contrib/compiler-rt/lib/builtins/int_types.h stable/11/include/time.h stable/11/stand/defs.mk stable/11/sys/arm/include/_types.h stable/11/sys/arm64/include/_types.h stable/11/sys/mips/include/_types.h stable/11/sys/powerpc/include/_types.h stable/11/sys/powerpc/include/pcb.h stable/11/sys/riscv/include/_types.h stable/11/sys/sparc64/include/_types.h stable/11/sys/sys/_types.h stable/11/sys/x86/include/_types.h Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/compiler-rt/lib/builtins/int_types.h ============================================================================== --- stable/11/contrib/compiler-rt/lib/builtins/int_types.h Fri Apr 6 19:11:58 2018 (r332134) +++ stable/11/contrib/compiler-rt/lib/builtins/int_types.h Fri Apr 6 19:17:59 2018 (r332135) @@ -114,6 +114,7 @@ static __inline tu_int make_tu(du_int h, du_int l) { #endif /* CRT_HAS_128BIT */ +#ifndef _STANDALONE typedef union { su_int u; @@ -125,6 +126,7 @@ typedef union udwords u; double f; } double_bits; +#endif typedef struct { @@ -137,6 +139,7 @@ typedef struct #endif /* _YUGA_LITTLE_ENDIAN */ } uqwords; +#ifndef _STANDALONE typedef union { uqwords u; @@ -159,6 +162,7 @@ typedef struct { long double real, imaginary; } Lcompl #define COMPLEX_REAL(x) (x).real #define COMPLEX_IMAGINARY(x) (x).imaginary +#endif #endif #endif /* INT_TYPES_H */ Modified: stable/11/include/time.h ============================================================================== --- stable/11/include/time.h Fri Apr 6 19:11:58 2018 (r332134) +++ stable/11/include/time.h Fri Apr 6 19:17:59 2018 (r332135) @@ -144,7 +144,9 @@ __BEGIN_DECLS char *asctime(const struct tm *); clock_t clock(void); char *ctime(const time_t *); +#ifndef _STANDALONE double difftime(time_t, time_t); +#endif /* XXX missing: getdate() */ struct tm *gmtime(const time_t *); struct tm *localtime(const time_t *); Modified: stable/11/stand/defs.mk ============================================================================== --- stable/11/stand/defs.mk Fri Apr 6 19:11:58 2018 (r332134) +++ stable/11/stand/defs.mk Fri Apr 6 19:17:59 2018 (r332135) @@ -49,6 +49,9 @@ CFLAGS+= -I${BOOTOBJ}/libsa .endif CFLAGS+= -I${SASRC} -D_STANDALONE CFLAGS+= -I${SYSDIR} +# Spike the floating point interfaces +CFLAGS+= -Ddouble=jagged-little-pill -Dfloat=floaty-mcfloatface + # GELI Support, with backward compat hooks (mostly) .if defined(HAVE_GELI) Modified: stable/11/sys/arm/include/_types.h ============================================================================== --- stable/11/sys/arm/include/_types.h Fri Apr 6 19:11:58 2018 (r332134) +++ stable/11/sys/arm/include/_types.h Fri Apr 6 19:17:59 2018 (r332135) @@ -68,8 +68,10 @@ typedef unsigned long long __uint64_t; */ typedef __uint32_t __clock_t; /* clock()... */ typedef __int32_t __critical_t; +#ifndef _STANDALONE typedef double __double_t; typedef float __float_t; +#endif typedef __int32_t __intfptr_t; typedef __int64_t __intmax_t; typedef __int32_t __intptr_t; Modified: stable/11/sys/arm64/include/_types.h ============================================================================== --- stable/11/sys/arm64/include/_types.h Fri Apr 6 19:11:58 2018 (r332134) +++ stable/11/sys/arm64/include/_types.h Fri Apr 6 19:17:59 2018 (r332135) @@ -56,8 +56,10 @@ typedef unsigned long __uint64_t; */ typedef __int32_t __clock_t; /* clock()... */ typedef __int64_t __critical_t; +#ifndef _STANDALONE typedef double __double_t; typedef float __float_t; +#endif typedef __int64_t __intfptr_t; typedef __int64_t __intmax_t; typedef __int64_t __intptr_t; Modified: stable/11/sys/mips/include/_types.h ============================================================================== --- stable/11/sys/mips/include/_types.h Fri Apr 6 19:11:58 2018 (r332134) +++ stable/11/sys/mips/include/_types.h Fri Apr 6 19:17:59 2018 (r332135) @@ -73,8 +73,10 @@ typedef unsigned long long __uint64_t; * Standard type definitions. */ typedef __int32_t __clock_t; /* clock()... */ +#ifndef _STANDALONE typedef double __double_t; typedef float __float_t; +#endif #ifdef __mips_n64 typedef __int64_t __critical_t; typedef __int64_t __intfptr_t; Modified: stable/11/sys/powerpc/include/_types.h ============================================================================== --- stable/11/sys/powerpc/include/_types.h Fri Apr 6 19:11:58 2018 (r332134) +++ stable/11/sys/powerpc/include/_types.h Fri Apr 6 19:17:59 2018 (r332135) @@ -72,8 +72,10 @@ typedef unsigned long long __uint64_t; * Standard type definitions. */ typedef __uint32_t __clock_t; /* clock()... */ +#ifndef _STANDALONE typedef double __double_t; typedef float __float_t; +#endif #ifdef __LP64__ typedef __int64_t __critical_t; typedef __int64_t __intfptr_t; Modified: stable/11/sys/powerpc/include/pcb.h ============================================================================== --- stable/11/sys/powerpc/include/pcb.h Fri Apr 6 19:11:58 2018 (r332134) +++ stable/11/sys/powerpc/include/pcb.h Fri Apr 6 19:17:59 2018 (r332135) @@ -37,6 +37,7 @@ #include +#ifndef _STANDALONE struct pcb { register_t pcb_context[20]; /* non-volatile r14-r31 */ register_t pcb_cr; /* Condition register */ @@ -79,6 +80,7 @@ struct pcb { } booke; } pcb_cpu; }; +#endif #ifdef _KERNEL Modified: stable/11/sys/riscv/include/_types.h ============================================================================== --- stable/11/sys/riscv/include/_types.h Fri Apr 6 19:11:58 2018 (r332134) +++ stable/11/sys/riscv/include/_types.h Fri Apr 6 19:17:59 2018 (r332135) @@ -56,8 +56,10 @@ typedef unsigned long __uint64_t; */ typedef __int32_t __clock_t; /* clock()... */ typedef __int64_t __critical_t; +#ifndef _STANDALONE typedef double __double_t; typedef float __float_t; +#endif typedef __int64_t __intfptr_t; typedef __int64_t __intmax_t; typedef __int64_t __intptr_t; Modified: stable/11/sys/sparc64/include/_types.h ============================================================================== --- stable/11/sys/sparc64/include/_types.h Fri Apr 6 19:11:58 2018 (r332134) +++ stable/11/sys/sparc64/include/_types.h Fri Apr 6 19:17:59 2018 (r332135) @@ -56,8 +56,10 @@ typedef unsigned long __uint64_t; */ typedef __int32_t __clock_t; /* clock()... */ typedef __int64_t __critical_t; +#ifndef _STANDALONE typedef double __double_t; typedef float __float_t; +#endif typedef __int64_t __intfptr_t; typedef __int64_t __intmax_t; typedef __int64_t __intptr_t; Modified: stable/11/sys/sys/_types.h ============================================================================== --- stable/11/sys/sys/_types.h Fri Apr 6 19:11:58 2018 (r332134) +++ stable/11/sys/sys/_types.h Fri Apr 6 19:17:59 2018 (r332135) @@ -102,7 +102,9 @@ typedef __uint_least32_t __char32_t; typedef struct { long long __max_align1 __aligned(_Alignof(long long)); +#ifndef _STANDALONE long double __max_align2 __aligned(_Alignof(long double)); +#endif } __max_align_t; typedef __uint32_t __dev_t; /* device number */ Modified: stable/11/sys/x86/include/_types.h ============================================================================== --- stable/11/sys/x86/include/_types.h Fri Apr 6 19:11:58 2018 (r332134) +++ stable/11/sys/x86/include/_types.h Fri Apr 6 19:17:59 2018 (r332135) @@ -78,15 +78,19 @@ typedef unsigned long long __uint64_t; #ifdef __LP64__ typedef __int32_t __clock_t; /* clock()... */ typedef __int64_t __critical_t; +#ifndef _STANDALONE typedef double __double_t; typedef float __float_t; +#endif typedef __int64_t __intfptr_t; typedef __int64_t __intptr_t; #else typedef unsigned long __clock_t; typedef __int32_t __critical_t; +#ifndef _STANDALONE typedef long double __double_t; typedef long double __float_t; +#endif typedef __int32_t __intfptr_t; typedef __int32_t __intptr_t; #endif From owner-svn-src-stable-11@freebsd.org Fri Apr 6 19:21:38 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C984FA0AAF; Fri, 6 Apr 2018 19:21:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 299C3711AC; Fri, 6 Apr 2018 19:21:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 246C916167; Fri, 6 Apr 2018 19:21:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w36JLbIT025268; Fri, 6 Apr 2018 19:21:37 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w36JLbtk025259; Fri, 6 Apr 2018 19:21:37 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804061921.w36JLbtk025259@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 6 Apr 2018 19:21: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: r332138 - in stable/11/stand: libsa userboot/userboot zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/stand: libsa userboot/userboot zfs X-SVN-Commit-Revision: 332138 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 19:21:38 -0000 Author: kevans Date: Fri Apr 6 19:21:36 2018 New Revision: 332138 URL: https://svnweb.freebsd.org/changeset/base/332138 Log: MFC r329879, r329892 r329879: libsa: Const-ify buffer argument of write(2) analog r329892: libsa: Change write(2)-alike prototype to match definition Broken in r329879. Apparently old GCC detects this, but modern GCC didn't. Mea culpa. Modified: stable/11/stand/libsa/cd9660.c stable/11/stand/libsa/nfs.c stable/11/stand/libsa/nullfs.c stable/11/stand/libsa/stand.h stable/11/stand/libsa/tftp.c stable/11/stand/libsa/ufs.c stable/11/stand/libsa/write.c stable/11/stand/userboot/userboot/host.c stable/11/stand/zfs/zfs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/libsa/cd9660.c ============================================================================== --- stable/11/stand/libsa/cd9660.c Fri Apr 6 19:21:29 2018 (r332137) +++ stable/11/stand/libsa/cd9660.c Fri Apr 6 19:21:36 2018 (r332138) @@ -66,7 +66,7 @@ static int cd9660_open(const char *path, struct open_f static int cd9660_close(struct open_file *f); static int cd9660_read(struct open_file *f, void *buf, size_t size, size_t *resid); -static int cd9660_write(struct open_file *f, void *buf, size_t size, +static int cd9660_write(struct open_file *f, const void *buf, size_t size, size_t *resid); static off_t cd9660_seek(struct open_file *f, off_t offset, int where); static int cd9660_stat(struct open_file *f, struct stat *sb); @@ -557,7 +557,8 @@ again: } static int -cd9660_write(struct open_file *f __unused, void *start __unused, size_t size __unused, size_t *resid __unused) +cd9660_write(struct open_file *f __unused, const void *buf __unused, + size_t size __unused, size_t *resid __unused) { return EROFS; } Modified: stable/11/stand/libsa/nfs.c ============================================================================== --- stable/11/stand/libsa/nfs.c Fri Apr 6 19:21:29 2018 (r332137) +++ stable/11/stand/libsa/nfs.c Fri Apr 6 19:21:36 2018 (r332138) @@ -126,7 +126,6 @@ struct nfs_iodesc { int nfs_open(const char *path, struct open_file *f); static int nfs_close(struct open_file *f); static int nfs_read(struct open_file *f, void *buf, size_t size, size_t *resid); -static int nfs_write(struct open_file *f, void *buf, size_t size, size_t *resid); static off_t nfs_seek(struct open_file *f, off_t offset, int where); static int nfs_stat(struct open_file *f, struct stat *sb); static int nfs_readdir(struct open_file *f, struct dirent *d); @@ -138,7 +137,7 @@ struct fs_ops nfs_fsops = { nfs_open, nfs_close, nfs_read, - nfs_write, + null_write, nfs_seek, nfs_stat, nfs_readdir @@ -713,15 +712,6 @@ ret: *resid = size; return (0); -} - -/* - * Not implemented. - */ -int -nfs_write(struct open_file *f, void *buf, size_t size, size_t *resid) -{ - return (EROFS); } off_t Modified: stable/11/stand/libsa/nullfs.c ============================================================================== --- stable/11/stand/libsa/nullfs.c Fri Apr 6 19:21:29 2018 (r332137) +++ stable/11/stand/libsa/nullfs.c Fri Apr 6 19:21:36 2018 (r332138) @@ -83,7 +83,7 @@ int null_read (struct open_file *f, void *buf, size_t return EIO; } -int null_write (struct open_file *f, void *buf, size_t size, size_t *resid) +int null_write (struct open_file *f, const void *buf, size_t size, size_t *resid) { return EIO; } Modified: stable/11/stand/libsa/stand.h ============================================================================== --- stable/11/stand/libsa/stand.h Fri Apr 6 19:21:29 2018 (r332137) +++ stable/11/stand/libsa/stand.h Fri Apr 6 19:21:36 2018 (r332138) @@ -105,7 +105,7 @@ struct fs_ops { int (*fo_close)(struct open_file *f); int (*fo_read)(struct open_file *f, void *buf, size_t size, size_t *resid); - int (*fo_write)(struct open_file *f, void *buf, + int (*fo_write)(struct open_file *f, const void *buf, size_t size, size_t *resid); off_t (*fo_seek)(struct open_file *f, off_t offset, int where); int (*fo_stat)(struct open_file *f, struct stat *sb); @@ -289,7 +289,7 @@ extern int open(const char *, int); extern int close(int); extern void closeall(void); extern ssize_t read(int, void *, size_t); -extern ssize_t write(int, void *, size_t); +extern ssize_t write(int, const void *, size_t); extern struct dirent *readdirfd(int); extern void srandom(u_long seed); @@ -383,7 +383,7 @@ extern void nullsys(void); extern int null_open(const char *path, struct open_file *f); extern int null_close(struct open_file *f); extern int null_read(struct open_file *f, void *buf, size_t size, size_t *resid); -extern int null_write(struct open_file *f, void *buf, size_t size, size_t *resid); +extern int null_write(struct open_file *f, const void *buf, size_t size, size_t *resid); extern off_t null_seek(struct open_file *f, off_t offset, int where); extern int null_stat(struct open_file *f, struct stat *sb); extern int null_readdir(struct open_file *f, struct dirent *d); Modified: stable/11/stand/libsa/tftp.c ============================================================================== --- stable/11/stand/libsa/tftp.c Fri Apr 6 19:21:29 2018 (r332137) +++ stable/11/stand/libsa/tftp.c Fri Apr 6 19:21:36 2018 (r332138) @@ -69,7 +69,8 @@ static int tftp_open(const char *path, struct open_fil static int tftp_close(struct open_file *f); static int tftp_parse_oack(struct tftp_handle *h, char *buf, size_t len); static int tftp_read(struct open_file *f, void *buf, size_t size, size_t *resid); -static int tftp_write(struct open_file *f, void *buf, size_t size, size_t *resid); +static int tftp_write(struct open_file *f, const void *buf, size_t size, + size_t *resid); static off_t tftp_seek(struct open_file *f, off_t offset, int where); static int tftp_set_blksize(struct tftp_handle *h, const char *str); static int tftp_stat(struct open_file *f, struct stat *sb); @@ -574,8 +575,8 @@ tftp_close(struct open_file *f) } static int -tftp_write(struct open_file *f __unused, void *start __unused, size_t size __unused, - size_t *resid __unused /* out */) +tftp_write(struct open_file *f __unused, const void *start __unused, + size_t size __unused, size_t *resid __unused /* out */) { return (EROFS); } Modified: stable/11/stand/libsa/ufs.c ============================================================================== --- stable/11/stand/libsa/ufs.c Fri Apr 6 19:21:29 2018 (r332137) +++ stable/11/stand/libsa/ufs.c Fri Apr 6 19:21:36 2018 (r332138) @@ -84,7 +84,8 @@ __FBSDID("$FreeBSD$"); #include "string.h" static int ufs_open(const char *path, struct open_file *f); -static int ufs_write(struct open_file *f, void *buf, size_t size, size_t *resid); +static int ufs_write(struct open_file *f, const void *buf, size_t size, + size_t *resid); static int ufs_close(struct open_file *f); static int ufs_read(struct open_file *f, void *buf, size_t size, size_t *resid); static off_t ufs_seek(struct open_file *f, off_t offset, int where); @@ -131,7 +132,7 @@ struct file { static int read_inode(ino_t, struct open_file *); static int block_map(struct open_file *, ufs2_daddr_t, ufs2_daddr_t *); static int buf_read_file(struct open_file *, char **, size_t *); -static int buf_write_file(struct open_file *, char *, size_t *); +static int buf_write_file(struct open_file *, const char *, size_t *); static int search_directory(char *, struct open_file *, ino_t *); /* @@ -301,7 +302,7 @@ block_map(f, file_block, disk_block_p) static int buf_write_file(f, buf_p, size_p) struct open_file *f; - char *buf_p; + const char *buf_p; size_t *size_p; /* out */ { struct file *fp = (struct file *)f->f_fsdata; @@ -764,14 +765,14 @@ ufs_read(f, start, size, resid) static int ufs_write(f, start, size, resid) struct open_file *f; - void *start; + const void *start; size_t size; size_t *resid; /* out */ { struct file *fp = (struct file *)f->f_fsdata; size_t csize; int rc = 0; - char *addr = start; + const char *addr = start; csize = size; while ((size != 0) && (csize != 0)) { Modified: stable/11/stand/libsa/write.c ============================================================================== --- stable/11/stand/libsa/write.c Fri Apr 6 19:21:29 2018 (r332137) +++ stable/11/stand/libsa/write.c Fri Apr 6 19:21:36 2018 (r332138) @@ -69,7 +69,7 @@ __FBSDID("$FreeBSD$"); ssize_t write(fd, dest, bcount) int fd; - void *dest; + const void *dest; size_t bcount; { struct open_file *f = &files[fd]; @@ -82,7 +82,8 @@ write(fd, dest, bcount) if (f->f_flags & F_RAW) { twiddle(4); errno = (f->f_dev->dv_strategy)(f->f_devdata, F_WRITE, - btodb(f->f_offset), bcount, dest, &resid); + btodb(f->f_offset), bcount, __DECONST(void *, dest), + &resid); if (errno) return (-1); f->f_offset += resid; Modified: stable/11/stand/userboot/userboot/host.c ============================================================================== --- stable/11/stand/userboot/userboot/host.c Fri Apr 6 19:21:29 2018 (r332137) +++ stable/11/stand/userboot/userboot/host.c Fri Apr 6 19:21:36 2018 (r332138) @@ -74,16 +74,6 @@ host_read(struct open_file *f, void *start, size_t siz return (CALLBACK(read, f->f_fsdata, start, size, resid)); } -/* - * Don't be silly - the bootstrap has no business writing anything. - */ -static int -host_write(struct open_file *f, void *start, size_t size, size_t *resid) -{ - - return (EROFS); -} - static off_t host_seek(struct open_file *f, off_t offset, int where) { @@ -183,7 +173,7 @@ struct fs_ops host_fsops = { host_open, host_close, host_read, - host_write, + null_write, host_seek, host_stat, host_readdir Modified: stable/11/stand/zfs/zfs.c ============================================================================== --- stable/11/stand/zfs/zfs.c Fri Apr 6 19:21:29 2018 (r332137) +++ stable/11/stand/zfs/zfs.c Fri Apr 6 19:21:36 2018 (r332138) @@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$"); #define ZFS_BE_LAST 8 static int zfs_open(const char *path, struct open_file *f); -static int zfs_write(struct open_file *f, void *buf, size_t size, size_t *resid); static int zfs_close(struct open_file *f); static int zfs_read(struct open_file *f, void *buf, size_t size, size_t *resid); static off_t zfs_seek(struct open_file *f, off_t offset, int where); @@ -67,7 +66,7 @@ struct fs_ops zfs_fsops = { zfs_open, zfs_close, zfs_read, - zfs_write, + null_write, zfs_seek, zfs_stat, zfs_readdir @@ -169,16 +168,6 @@ zfs_read(struct open_file *f, void *start, size_t size *resid = size - n; return (0); -} - -/* - * Don't be silly - the bootstrap has no business writing anything. - */ -static int -zfs_write(struct open_file *f, void *start, size_t size, size_t *resid /* out */) -{ - - return (EROFS); } static off_t From owner-svn-src-stable-11@freebsd.org Fri Apr 6 19:24:05 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C85FFA0F57; Fri, 6 Apr 2018 19:24:05 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A45F371619; Fri, 6 Apr 2018 19:24:04 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 85E64161B4; Fri, 6 Apr 2018 19:24:04 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w36JO4KB027657; Fri, 6 Apr 2018 19:24:04 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w36JO4ar027655; Fri, 6 Apr 2018 19:24:04 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804061924.w36JO4ar027655@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 6 Apr 2018 19:24:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332140 - stable/11/stand/libsa X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/stand/libsa X-SVN-Commit-Revision: 332140 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 19:24:05 -0000 Author: kevans Date: Fri Apr 6 19:24:04 2018 New Revision: 332140 URL: https://svnweb.freebsd.org/changeset/base/332140 Log: MFC r330026: libsa: Move MAXWAIT from net.h to net.c It's not a setting that has any effect or use outside of the net.c context. Modified: stable/11/stand/libsa/net.c stable/11/stand/libsa/net.h Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/libsa/net.c ============================================================================== --- stable/11/stand/libsa/net.c Fri Apr 6 19:22:22 2018 (r332139) +++ stable/11/stand/libsa/net.c Fri Apr 6 19:24:04 2018 (r332140) @@ -58,6 +58,20 @@ __FBSDID("$FreeBSD$"); #include "net.h" /* + * Maximum wait time for sending and receiving before we give up and timeout. + * If set to 0, operations will eventually timeout completely, but send/recv + * timeouts must progress exponentially from MINTMO to MAXTMO before final + * timeout is hit. + */ +#ifndef MAXWAIT +#define MAXWAIT 0 /* seconds */ +#endif + +#if MAXWAIT < 0 +#error MAXWAIT must not be a negative number +#endif + +/* * Send a packet and wait for a reply, with exponential backoff. * * The send routine must return the actual number of bytes written, Modified: stable/11/stand/libsa/net.h ============================================================================== --- stable/11/stand/libsa/net.h Fri Apr 6 19:22:22 2018 (r332139) +++ stable/11/stand/libsa/net.h Fri Apr 6 19:24:04 2018 (r332140) @@ -61,20 +61,6 @@ enum net_proto { #define MAXTMO 120 /* seconds */ #define MINTMO 2 /* seconds */ -/* - * Maximum wait time for sending and receiving before we give up and timeout. - * If set to 0, operations will eventually timeout completely, but send/recv - * timeouts must progress exponentially from MINTMO to MAXTMO before final - * timeout is hit. - */ -#ifndef MAXWAIT -#define MAXWAIT 0 /* seconds */ -#endif - -#if MAXWAIT < 0 -#error MAXWAIT must not be a negative number -#endif - #define FNAME_SIZE 128 #define IFNAME_SIZE 16 #define RECV_SIZE 1536 /* XXX delete this */ From owner-svn-src-stable-11@freebsd.org Fri Apr 6 19:00:32 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CBC78F9F2C7 for ; Fri, 6 Apr 2018 19:00:32 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-yb0-x22c.google.com (mail-yb0-x22c.google.com [IPv6:2607:f8b0:4002:c09::22c]) (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 5F2C16FB98 for ; Fri, 6 Apr 2018 19:00:32 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by mail-yb0-x22c.google.com with SMTP id f13-v6so747755ybp.3 for ; Fri, 06 Apr 2018 12:00:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=cU6bZ0faTKiqdazf9o5QyYz+eW+0DlIva94eFBjHGE8=; b=Ktm1zHHSmcC5nshiiA1xt8wWOSg6Y8jozQ3DhwcNOZ0aSQ0ks9jIFblokxpz0KteON QZYiAjCZj9mDre6ESe5Yz0xzprNcVQ+jI/nPKKHBZAZaOGpRWzSTzKmhgHfdh4MrxTmS nj6bhFQXnwz+fafEZ9tpR1SLQSFuQO5rKiK+zSfi0SNEMG1KoV94qZliZ3Mk3J6e675U xvotddG1qFXAsoR36xroOFVzbKc8KRM7UFiVO6VNlUwW6dh8/S7FybiNZ6y+RY8RTRfk wyQQnSbjuC7vCF/orrwinBQASV8fDJ0rJnAmcXkRYW0ARV6B0JuQjG2I1bUfBkWj0kwV uQgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=cU6bZ0faTKiqdazf9o5QyYz+eW+0DlIva94eFBjHGE8=; b=kNlr5ZiQn1Ae1m/aP6KL63/iklX1GeweqHbrJC623MRPLSjNfss+azKUb34p67Qkhi fE6quaeGLFSIuSimRLpjCGAKVrF29Vmgr7dB01XOKQDbkZLbxc/v+bAW9BqTWteG/Nv4 beRRcdsfsd5I3mWFnLDvx7BkFzKJUzafuAh7As2Od7cEC6IdtCvWK6kaJAUG0RljcNba Zz2xCdKayjIxHNaMQU4BZ1T23WYrARzRk2PBvgnjdy3lgyCSCUHJuqJKI7ilTdvgFxUa XvGik601vdAoBj8XBl2CtDlGbWickiW7lSE/mCv4P+qA3ZxvwWPVqBKIQsEno9JvoeHb 6Sbg== X-Gm-Message-State: ALQs6tAIpEXZefPzIVyxVS88v8lybnjk8mtPLPon03diYycNm8OU00m2 BIbDC9anIfoEb+7jkDWiEGXO44xozHXjT/AmNDI1Iw== X-Google-Smtp-Source: AIpwx49Uyw9coK/YDsiIp8nqI3lnF9acdlG7VjlTS4PZBTjZHrCKxD8pyXQayFv3fOhwOuozRXwjh7UENj2NLN1sCm0= X-Received: by 2002:a25:5047:: with SMTP id e68-v6mr15655086ybb.165.1523041231480; Fri, 06 Apr 2018 12:00:31 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a5b:64b:0:0:0:0:0 with HTTP; Fri, 6 Apr 2018 12:00:30 -0700 (PDT) In-Reply-To: <2526702.9M648BMneK@ralph.baldwin.cx> References: <201803311138.w2VBcKHP014025@repo.freebsd.org> <20180331184109.GA23589@lonesome.com> <2526702.9M648BMneK@ralph.baldwin.cx> From: Oliver Pinter Date: Fri, 6 Apr 2018 21:00:30 +0200 Message-ID: Subject: Re: svn commit: r331838 - in stable/11: . contrib/compiler-rt/include/sanitizer contrib/compiler-rt/include/xray contrib/compiler-rt/lib/BlocksRuntime contrib/compiler-rt/lib/asan contrib/compiler-rt/l... To: John Baldwin Cc: Ed Maste , Antoine Brodin , src-committers , re , svn-src-stable@freebsd.org, svn-src-all@freebsd.org, Dimitry Andric , svn-src-stable-11@freebsd.org, Mark Linimon Content-Type: text/plain; charset="UTF-8" X-Mailman-Approved-At: Fri, 06 Apr 2018 19:30:17 +0000 X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 19:00:33 -0000 On 4/6/18, John Baldwin wrote: > On Monday, April 02, 2018 12:27:47 PM Ed Maste wrote: >> On 31 March 2018 at 14:41, Mark Linimon wrote: >> This is the most important point of this discussion: we do need to >> ensure there's good communication and coordination between teams where >> dependencies like this exist. I'll take the blame here: Dimitry asked >> me about merging the Clang update to stable/11 and I agreed that it >> was reasonable to merge sooner rather than later to have as much lead >> time as possible before the 11.2 process starts. I also assumed that >> outstanding Clang 6 issues in ports were farther along in being >> addressed. >> >> The key lesson from this discussion is that for significant commits >> and merges like this one we should make sure to always have sufficient >> advance notice. > > Is this driven by -mretpoline? Don't think so since it requires LLD as linker. The LLVM 5 which was already part of the 11-stable has the retpoline option. See r331219. >From other side, I like to see a newer compiler sets in the recent releases, because there are lot of performance improvements and other fixes. > That is, would we not be as aggressive > with pushing for clang 6 in 11.2 if it weren't for that? I kind of feel > like we probably wouldn't and would have left it at 5 and let clang 6 be > a FreeBSD 12 thing. Was -mretpoline backported to clang 5 (I thought > there was some talk of providing patches for clang 5)? > > -- > John Baldwin > _______________________________________________ > 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" > From owner-svn-src-stable-11@freebsd.org Fri Apr 6 19:34:22 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6BFE1FA1A4E; Fri, 6 Apr 2018 19:34:22 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1E73571DA4; Fri, 6 Apr 2018 19:34:22 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 192E716372; Fri, 6 Apr 2018 19:34:22 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w36JYL9a032974; Fri, 6 Apr 2018 19:34:21 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w36JYLJD032971; Fri, 6 Apr 2018 19:34:21 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804061934.w36JYLJD032971@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 6 Apr 2018 19:34:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332141 - stable/11/stand/libsa X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/stand/libsa X-SVN-Commit-Revision: 332141 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 19:34:22 -0000 Author: kevans Date: Fri Apr 6 19:34:21 2018 New Revision: 332141 URL: https://svnweb.freebsd.org/changeset/base/332141 Log: MFC r330056: libsa: replace remaining _write callbacks by null_write There are some _write callbacks left only returning EROFS, replace them by null_write. return EROFS from null_write(). Modified: stable/11/stand/libsa/cd9660.c stable/11/stand/libsa/nullfs.c stable/11/stand/libsa/tftp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/libsa/cd9660.c ============================================================================== --- stable/11/stand/libsa/cd9660.c Fri Apr 6 19:24:04 2018 (r332140) +++ stable/11/stand/libsa/cd9660.c Fri Apr 6 19:34:21 2018 (r332141) @@ -66,8 +66,6 @@ static int cd9660_open(const char *path, struct open_f static int cd9660_close(struct open_file *f); static int cd9660_read(struct open_file *f, void *buf, size_t size, size_t *resid); -static int cd9660_write(struct open_file *f, const void *buf, size_t size, - size_t *resid); static off_t cd9660_seek(struct open_file *f, off_t offset, int where); static int cd9660_stat(struct open_file *f, struct stat *sb); static int cd9660_readdir(struct open_file *f, struct dirent *d); @@ -86,7 +84,7 @@ struct fs_ops cd9660_fsops = { cd9660_open, cd9660_close, cd9660_read, - cd9660_write, + null_write, cd9660_seek, cd9660_stat, cd9660_readdir @@ -554,13 +552,6 @@ again: fp->f_off += isonum_711(ep->length); return (0); -} - -static int -cd9660_write(struct open_file *f __unused, const void *buf __unused, - size_t size __unused, size_t *resid __unused) -{ - return EROFS; } static off_t Modified: stable/11/stand/libsa/nullfs.c ============================================================================== --- stable/11/stand/libsa/nullfs.c Fri Apr 6 19:24:04 2018 (r332140) +++ stable/11/stand/libsa/nullfs.c Fri Apr 6 19:34:21 2018 (r332141) @@ -85,7 +85,7 @@ int null_read (struct open_file *f, void *buf, size_t int null_write (struct open_file *f, const void *buf, size_t size, size_t *resid) { - return EIO; + return EROFS; } off_t null_seek (struct open_file *f, off_t offset, int where) Modified: stable/11/stand/libsa/tftp.c ============================================================================== --- stable/11/stand/libsa/tftp.c Fri Apr 6 19:24:04 2018 (r332140) +++ stable/11/stand/libsa/tftp.c Fri Apr 6 19:34:21 2018 (r332141) @@ -69,8 +69,6 @@ static int tftp_open(const char *path, struct open_fil static int tftp_close(struct open_file *f); static int tftp_parse_oack(struct tftp_handle *h, char *buf, size_t len); static int tftp_read(struct open_file *f, void *buf, size_t size, size_t *resid); -static int tftp_write(struct open_file *f, const void *buf, size_t size, - size_t *resid); static off_t tftp_seek(struct open_file *f, off_t offset, int where); static int tftp_set_blksize(struct tftp_handle *h, const char *str); static int tftp_stat(struct open_file *f, struct stat *sb); @@ -80,7 +78,7 @@ struct fs_ops tftp_fsops = { tftp_open, tftp_close, tftp_read, - tftp_write, + null_write, tftp_seek, tftp_stat, null_readdir @@ -572,13 +570,6 @@ tftp_close(struct open_file *f) } is_open = 0; return (0); -} - -static int -tftp_write(struct open_file *f __unused, const void *start __unused, - size_t size __unused, size_t *resid __unused /* out */) -{ - return (EROFS); } static int From owner-svn-src-stable-11@freebsd.org Fri Apr 6 19:47:08 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 578F5F808BA; Fri, 6 Apr 2018 19:47:08 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 043DF7287B; Fri, 6 Apr 2018 19:47:08 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F317C16514; Fri, 6 Apr 2018 19:47:07 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w36Jl7qR038167; Fri, 6 Apr 2018 19:47:07 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w36Jl7tg038163; Fri, 6 Apr 2018 19:47:07 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804061947.w36Jl7tg038163@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 6 Apr 2018 19:47: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: r332144 - in stable/11: share/mk stand stand/efi X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: share/mk stand stand/efi X-SVN-Commit-Revision: 332144 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 19:47:08 -0000 Author: kevans Date: Fri Apr 6 19:47:07 2018 New Revision: 332144 URL: https://svnweb.freebsd.org/changeset/base/332144 Log: MFC r330077, r330248 r330077: Move EFI up to common makefile. There's no need for all these .if's based on architecture. Sponsored by: Netflix r330248: Create LOADER_UBOOT, and LOADER_OFW. Move these options out of Makefile.${MACHINE_ARCH} and remove the now-empty files. Generate the *32 directories on the necessary architectures (well, currently only amd64) on the fly. Remove LOADER_EFI variable and co-locate it with EFI. Deleted: stable/11/stand/Makefile.arm stable/11/stand/Makefile.arm64 stable/11/stand/Makefile.i386 stable/11/stand/Makefile.mips stable/11/stand/Makefile.powerpc stable/11/stand/Makefile.sparc64 Modified: stable/11/share/mk/src.opts.mk stable/11/stand/Makefile stable/11/stand/Makefile.amd64 stable/11/stand/efi/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/share/mk/src.opts.mk ============================================================================== --- stable/11/share/mk/src.opts.mk Fri Apr 6 19:37:15 2018 (r332143) +++ stable/11/share/mk/src.opts.mk Fri Apr 6 19:47:07 2018 (r332144) @@ -131,6 +131,8 @@ __DEFAULT_YES_OPTIONS = \ LPR \ LS_COLORS \ LZMA_SUPPORT \ + LOADER_OFW \ + LOADER_UBOOT \ MAIL \ MAILWRAPPER \ MAKE \ @@ -276,9 +278,23 @@ BROKEN_OPTIONS+=LLDB .if ${__T} != "armv6" BROKEN_OPTIONS+=LIBSOFT .endif +# EFI doesn't exist on mips, powerpc, sparc or riscv. .if ${__T:Mmips*} || ${__T:Mpowerpc*} || ${__T:Msparc64} || ${__T:Mriscv*} BROKEN_OPTIONS+=EFI .endif +# GELI isn't supported on !x86 +.if ${__T} != "i386" && ${__T} != "amd64" +BROKEN_OPTIONS+=LOADER_GELI +.endif +# OFW is only for powerpc and sparc64, exclude others +.if ${__T:Mpowerpc*} == "" && ${__T:Msparc64} == "" +BROKEN_OPTIONS+=LOADER_OFW +.endif +# UBOOT is only for arm, mips and powerpc, exclude others +.if ${__T:Marm*} == "" && ${__T:Mmips*} == "" && ${__T:Mpowerpc*} == "" +BROKEN_OPTIONS+=LOADER_UBOOT +.endif + .if ${__T:Mmips64*} # profiling won't work on MIPS64 because there is only assembly for o32 BROKEN_OPTIONS+=PROFILE Modified: stable/11/stand/Makefile ============================================================================== --- stable/11/stand/Makefile Fri Apr 6 19:37:15 2018 (r332143) +++ stable/11/stand/Makefile Fri Apr 6 19:47:07 2018 (r332144) @@ -2,20 +2,43 @@ .include -SUBDIR+= libsa -.if ${MK_FORTH} != "no" -# Build the add-in FORTH interpreter. -SUBDIR+= ficl -SUBDIR+= forth +# For amd64 we have to build 32 and 64 bit versions of things. For +# others we don't. LIB32LIST is a list of libraries, which if +# included, need to be built 32-bit as well. +.if ${MACHINE_ARCH} == "amd64" +LIB32LIST=libsa ficl liblua zfs .endif -SUBDIR+= defaults -SUBDIR+= man +S.yes+= libsa +S.${MK_FORTH}+= ficl +S.${MK_FORTH}+= forth +S.${MK_LOADER_LUA}+= liblua +S.${MK_LOADER_LUA}+= lua +S.${MK_FDT}+= fdt +S.${MK_LOADER_OFW}+= ofw +S.${MK_ZFS}+= zfs +S.yes+= defaults +S.yes+= man + +S.${MK_LOADER_GELI}+= geli + .include +S.${MK_EFI}+= efi +S.${MK_LOADER_UBOOT}+= uboot + .if exists(${.CURDIR}/${MACHINE}/.) -SUBDIR+= ${MACHINE} +S.yes+= ${MACHINE} .endif + +# Build the actual subdir list from S.yes, adding in the 32-bit +# variant if necessary. +.for _x in ${S.yes} +SUBDIR+=${_x} +.if defined(LIB32LIST) && ${LIB32LIST:M${_x}} +SUBDIR+=${_x}32 +.endif +.endfor .include Modified: stable/11/stand/Makefile.amd64 ============================================================================== --- stable/11/stand/Makefile.amd64 Fri Apr 6 19:37:15 2018 (r332143) +++ stable/11/stand/Makefile.amd64 Fri Apr 6 19:47:07 2018 (r332144) @@ -1,18 +1,4 @@ # $FreeBSD$ -SUBDIR+= libsa32 -.if ${MK_ZFS} != "no" -SUBDIR+= zfs zfs32 -.endif -.if ${MK_FORTH} != "no" -SUBDIR+= ficl32 -.endif - -SUBDIR+= efi -SUBDIR+= userboot - -.if ${MK_LOADER_GELI} == "yes" -SUBDIR+= geli -.endif - -SUBDIR+= i386 +S.yes+= userboot +S.yes+= i386 Modified: stable/11/stand/efi/Makefile ============================================================================== --- stable/11/stand/efi/Makefile Fri Apr 6 19:37:15 2018 (r332143) +++ stable/11/stand/efi/Makefile Fri Apr 6 19:47:07 2018 (r332144) @@ -8,17 +8,11 @@ NO_OBJ=t # than 4.5 supports it. .if ${COMPILER_TYPE} != "gcc" || ${COMPILER_VERSION} >= 40500 -.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "arm" .if ${MK_FDT} != "no" SUBDIR+= fdt .endif -.endif -.if ${MACHINE_CPUARCH} == "aarch64" || \ - ${MACHINE_CPUARCH} == "amd64" || \ - ${MACHINE_CPUARCH} == "arm" SUBDIR+= libefi loader boot1 -.endif .endif # ${COMPILER_TYPE} != "gcc" || ${COMPILER_VERSION} >= 40500 From owner-svn-src-stable-11@freebsd.org Fri Apr 6 19:52:01 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 461B0F81028; Fri, 6 Apr 2018 19:52:01 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E788D72ED9; Fri, 6 Apr 2018 19:52:00 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E26D01669B; Fri, 6 Apr 2018 19:52:00 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w36Jq0MV042067; Fri, 6 Apr 2018 19:52:00 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w36Jq0u4042066; Fri, 6 Apr 2018 19:52:00 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804061952.w36Jq0u4042066@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 6 Apr 2018 19:52: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: r332147 - stable/11/stand X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/stand X-SVN-Commit-Revision: 332147 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 19:52:01 -0000 Author: kevans Date: Fri Apr 6 19:52:00 2018 New Revision: 332147 URL: https://svnweb.freebsd.org/changeset/base/332147 Log: Revert lua bits that snuck in with r332144 These will get re-MFC'd differently when we import lualoader from head. This is a direct commit to stable/11 Modified: stable/11/stand/Makefile Modified: stable/11/stand/Makefile ============================================================================== --- stable/11/stand/Makefile Fri Apr 6 19:49:57 2018 (r332146) +++ stable/11/stand/Makefile Fri Apr 6 19:52:00 2018 (r332147) @@ -6,15 +6,13 @@ # others we don't. LIB32LIST is a list of libraries, which if # included, need to be built 32-bit as well. .if ${MACHINE_ARCH} == "amd64" -LIB32LIST=libsa ficl liblua zfs +LIB32LIST=libsa ficl zfs .endif S.yes+= libsa S.${MK_FORTH}+= ficl S.${MK_FORTH}+= forth -S.${MK_LOADER_LUA}+= liblua -S.${MK_LOADER_LUA}+= lua S.${MK_FDT}+= fdt S.${MK_LOADER_OFW}+= ofw S.${MK_ZFS}+= zfs From owner-svn-src-stable-11@freebsd.org Fri Apr 6 19:54:11 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D046F8127A; Fri, 6 Apr 2018 19:54:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 215A77321E; Fri, 6 Apr 2018 19:54:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1C29A166D4; Fri, 6 Apr 2018 19:54:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w36JsAFY042979; Fri, 6 Apr 2018 19:54:10 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w36JsAXt042974; Fri, 6 Apr 2018 19:54:10 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804061954.w36JsAXt042974@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 6 Apr 2018 19: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: r332148 - in stable/11/stand: efi i386 powerpc sparc64 uboot X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/stand: efi i386 powerpc sparc64 uboot X-SVN-Commit-Revision: 332148 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 19:54:11 -0000 Author: kevans Date: Fri Apr 6 19:54:10 2018 New Revision: 332148 URL: https://svnweb.freebsd.org/changeset/base/332148 Log: MFC r330249-r330250 r330249: stand: Makefile SUBDIR cleanup Use SUBDIR.${MK_*} where appropriate. r330248 eliminated most of the offenders, sweep the rest under the rug. Differential Revision: https://reviews.freebsd.org/D14545 r330250: stand: Fix build after r330249 One does not simply convert to SUBDIR.yes in stand without making everything else in the affected files SUBDIR.yes -- there are better ways to do this. Modified: stable/11/stand/efi/Makefile stable/11/stand/i386/Makefile stable/11/stand/powerpc/Makefile stable/11/stand/sparc64/Makefile stable/11/stand/uboot/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/efi/Makefile ============================================================================== --- stable/11/stand/efi/Makefile Fri Apr 6 19:52:00 2018 (r332147) +++ stable/11/stand/efi/Makefile Fri Apr 6 19:54:10 2018 (r332148) @@ -8,11 +8,8 @@ NO_OBJ=t # than 4.5 supports it. .if ${COMPILER_TYPE} != "gcc" || ${COMPILER_VERSION} >= 40500 -.if ${MK_FDT} != "no" -SUBDIR+= fdt -.endif - -SUBDIR+= libefi loader boot1 +SUBDIR.${MK_FDT}+= fdt +SUBDIR.yes+= libefi loader boot1 .endif # ${COMPILER_TYPE} != "gcc" || ${COMPILER_VERSION} >= 40500 Modified: stable/11/stand/i386/Makefile ============================================================================== --- stable/11/stand/i386/Makefile Fri Apr 6 19:52:00 2018 (r332147) +++ stable/11/stand/i386/Makefile Fri Apr 6 19:54:10 2018 (r332148) @@ -4,24 +4,20 @@ NO_OBJ=t .include -SUBDIR= mbr pmbr boot0 boot0sio btx boot2 cdboot gptboot \ +SUBDIR.yes= mbr pmbr boot0 boot0sio btx boot2 cdboot gptboot \ libi386 -.if ${MK_LOADER_FIREWIRE} == "yes" -SUBDIR+= libfirewire -.endif +SUBDIR.${MK_LOADER_FIREWIRE}+= libfirewire -SUBDIR+= loader +SUBDIR.yes+= loader # special boot programs, 'self-extracting boot2+loader' -SUBDIR+= pxeldr +SUBDIR.yes+= pxeldr .if ${MACHINE_CPUARCH} == "i386" -SUBDIR+= kgzldr +SUBDIR.yes+= kgzldr .endif -.if ${MK_ZFS} != "no" -SUBDIR+= zfsboot gptzfsboot zfsloader -.endif +SUBDIR.${MK_ZFS}+= zfsboot gptzfsboot zfsloader .include Modified: stable/11/stand/powerpc/Makefile ============================================================================== --- stable/11/stand/powerpc/Makefile Fri Apr 6 19:52:00 2018 (r332147) +++ stable/11/stand/powerpc/Makefile Fri Apr 6 19:54:10 2018 (r332148) @@ -4,9 +4,7 @@ NO_OBJ=t .include -SUBDIR= boot1.chrp ofw uboot -.if ${MK_FDT} == "yes" -SUBDIR+= kboot -.endif +SUBDIR.yes= boot1.chrp ofw uboot +SUBDIR.${MK_FDT}+= kboot .include Modified: stable/11/stand/sparc64/Makefile ============================================================================== --- stable/11/stand/sparc64/Makefile Fri Apr 6 19:52:00 2018 (r332147) +++ stable/11/stand/sparc64/Makefile Fri Apr 6 19:54:10 2018 (r332148) @@ -4,9 +4,7 @@ NO_OBJ=t .include -SUBDIR= boot1 loader -.if ${MK_ZFS} != "no" -SUBDIR+=zfsboot zfsloader -.endif +SUBDIR.yes= boot1 loader +SUBDIR.${MK_ZFS}+=zfsboot zfsloader .include Modified: stable/11/stand/uboot/Makefile ============================================================================== --- stable/11/stand/uboot/Makefile Fri Apr 6 19:52:00 2018 (r332147) +++ stable/11/stand/uboot/Makefile Fri Apr 6 19:54:10 2018 (r332148) @@ -2,10 +2,8 @@ .include -SUBDIR= lib +SUBDIR.yes= lib -.if ${MK_FDT} != "no" -SUBDIR+=fdt -.endif +SUBDIR.${MK_FDT}+=fdt .include From owner-svn-src-stable-11@freebsd.org Fri Apr 6 19:59:29 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A966F817E1; Fri, 6 Apr 2018 19:59:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A47367350A; Fri, 6 Apr 2018 19:59:28 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9A97B166DD; Fri, 6 Apr 2018 19:59:28 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w36JxSxa043242; Fri, 6 Apr 2018 19:59:28 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w36JxSsn043238; Fri, 6 Apr 2018 19:59:28 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804061959.w36JxSsn043238@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 6 Apr 2018 19:59:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332149 - in stable/11/stand/mips/beri: boot2 common loader X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/stand/mips/beri: boot2 common loader X-SVN-Commit-Revision: 332149 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 19:59:29 -0000 Author: kevans Date: Fri Apr 6 19:59:27 2018 New Revision: 332149 URL: https://svnweb.freebsd.org/changeset/base/332149 Log: MFC r330788: beri loader: Replace getc/putc with beri_ prefixed versions This matches a convention that we use, at least in ubldr, to prefix getc/putc with a loader-specific prefix to avoid collisions. This was encountered while trying to build the beri loader with MK_LOADER_LUA=yes. Modified: stable/11/stand/mips/beri/boot2/boot2.c stable/11/stand/mips/beri/common/altera_jtag_uart.c stable/11/stand/mips/beri/common/cons.h stable/11/stand/mips/beri/loader/beri_console.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/mips/beri/boot2/boot2.c ============================================================================== --- stable/11/stand/mips/beri/boot2/boot2.c Fri Apr 6 19:54:10 2018 (r332148) +++ stable/11/stand/mips/beri/boot2/boot2.c Fri Apr 6 19:59:27 2018 (r332149) @@ -627,7 +627,7 @@ static int xputc(int c) { if (ioctrl & IO_KEYBOARD) - putc(c); + beri_putc(c); #if 0 if (ioctrl & IO_SERIAL) sio_putc(c); @@ -642,7 +642,7 @@ xgetc(int fn) return 0; for (;;) { if (ioctrl & IO_KEYBOARD && keyhit(0)) - return fn ? 1 : getc(); + return fn ? 1 : beri_getc(); #if 0 if (ioctrl & IO_SERIAL && sio_ischar()) return fn ? 1 : sio_getc(); Modified: stable/11/stand/mips/beri/common/altera_jtag_uart.c ============================================================================== --- stable/11/stand/mips/beri/common/altera_jtag_uart.c Fri Apr 6 19:54:10 2018 (r332148) +++ stable/11/stand/mips/beri/common/altera_jtag_uart.c Fri Apr 6 19:59:27 2018 (r332149) @@ -159,7 +159,7 @@ keyhit(int seconds) } int -getc(void) +beri_getc(void) { while (!(uart_readable())); @@ -168,7 +168,7 @@ getc(void) } void -putc(int ch) +beri_putc(int ch) { uart_data_write(ch); Modified: stable/11/stand/mips/beri/common/cons.h ============================================================================== --- stable/11/stand/mips/beri/common/cons.h Fri Apr 6 19:54:10 2018 (r332148) +++ stable/11/stand/mips/beri/common/cons.h Fri Apr 6 19:59:27 2018 (r332149) @@ -33,8 +33,8 @@ #ifndef _CONS_H_ #define _CONS_H_ -int getc(void); +int beri_getc(void); int keyhit(int); -void putc(int); +void beri_putc(int); #endif Modified: stable/11/stand/mips/beri/loader/beri_console.c ============================================================================== --- stable/11/stand/mips/beri/loader/beri_console.c Fri Apr 6 19:54:10 2018 (r332148) +++ stable/11/stand/mips/beri/loader/beri_console.c Fri Apr 6 19:59:27 2018 (r332149) @@ -72,14 +72,14 @@ static void c_out(int c) { - putc(c); + beri_putc(c); } static int c_in(void) { - return (getc()); + return (beri_getc()); } static int From owner-svn-src-stable-11@freebsd.org Fri Apr 6 20:24:52 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8E656F836F4; Fri, 6 Apr 2018 20:24:52 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3E80374845; Fri, 6 Apr 2018 20:24:52 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 393A016BBE; Fri, 6 Apr 2018 20:24:52 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w36KOqqt058540; Fri, 6 Apr 2018 20:24:52 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w36KOpTi058529; Fri, 6 Apr 2018 20:24:51 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804062024.w36KOpTi058529@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 6 Apr 2018 20:24:51 +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: r332150 - in stable/11/stand: . common mips/beri/loader powerpc/kboot powerpc/ofw sparc64/loader uboot/common uboot/lib X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/stand: . common mips/beri/loader powerpc/kboot powerpc/ofw sparc64/loader uboot/common uboot/lib X-SVN-Commit-Revision: 332150 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 20:24:52 -0000 Author: kevans Date: Fri Apr 6 20:24:50 2018 New Revision: 332150 URL: https://svnweb.freebsd.org/changeset/base/332150 Log: MFC r329190, r329315, r330131: metadata load file unification r329190: Unify metadata load files for arm, mips, powerpc, sparc64 Summary: All metadata.c files are very similar, with only trivial changes. Unify them into a single common file, with minor special-casing where needed. r329315: stand: Fix ubldr after r329190 metadata load files were consolidated in r329190, and these relocation fixup bits were inadvertently dropped in the process. Re-add them to fix boot with ubldr. r330131: Fix module loading on arm after the metadata.c unification in r329190. Arm modules need an additional address fixup not needed by other platforms. Added: stable/11/stand/common/metadata.c - copied, changed from r329190, head/stand/common/metadata.c Deleted: stable/11/stand/mips/beri/loader/metadata.c stable/11/stand/powerpc/kboot/metadata.c stable/11/stand/powerpc/ofw/metadata.c stable/11/stand/sparc64/loader/metadata.c stable/11/stand/uboot/common/metadata.c Modified: stable/11/stand/loader.mk stable/11/stand/mips/beri/loader/Makefile stable/11/stand/mips/beri/loader/exec.c stable/11/stand/mips/beri/loader/loader.h stable/11/stand/powerpc/kboot/Makefile stable/11/stand/powerpc/kboot/main.c stable/11/stand/powerpc/ofw/Makefile stable/11/stand/sparc64/loader/Makefile stable/11/stand/uboot.mk stable/11/stand/uboot/lib/elf_freebsd.c Directory Properties: stable/11/ (props changed) Copied and modified: stable/11/stand/common/metadata.c (from r329190, head/stand/common/metadata.c) ============================================================================== --- head/stand/common/metadata.c Tue Feb 13 03:44:50 2018 (r329190, copy source) +++ stable/11/stand/common/metadata.c Fri Apr 6 20:24:50 2018 (r332150) @@ -38,6 +38,9 @@ __FBSDID("$FreeBSD$"); #include #endif +#ifdef __arm__ +#include +#endif #include #include "bootstrap.h" @@ -262,6 +265,7 @@ md_copymodules(vm_offset_t addr, int kern64) struct preloaded_file *fp; struct file_metadata *md; uint64_t scratch64; + uint32_t scratch32; int c; c = addr != 0; @@ -278,7 +282,11 @@ md_copymodules(vm_offset_t addr, int kern64) scratch64 = fp->f_size; MOD_SIZE(addr, scratch64, c); } else { - MOD_ADDR(addr, fp->f_addr, c); + scratch32 = fp->f_addr; +#ifdef __arm__ + scratch32 -= __elfN(relocation_offset); +#endif + MOD_ADDR(addr, scratch32, c); MOD_SIZE(addr, fp->f_size, c); } for (md = fp->f_metadata; md != NULL; md = md->md_next) { @@ -315,7 +323,23 @@ md_load_dual(char *args, vm_offset_t *modulep, vm_offs uint64_t scratch64; char *rootdevname; int howto; +#ifdef __arm__ + vm_offset_t vaddr; + int i; + /* + * These metadata addreses must be converted for kernel after + * relocation. + */ + uint32_t mdt[] = { + MODINFOMD_SSYM, MODINFOMD_ESYM, MODINFOMD_KERNEND, + MODINFOMD_ENVP, +#if defined(LOADER_FDT_SUPPORT) + MODINFOMD_DTBP +#endif + }; +#endif + align = kern64 ? 8 : 4; howto = md_getboothowto(args); @@ -409,6 +433,23 @@ md_load_dual(char *args, vm_offset_t *modulep, vm_offs } else { bcopy(&kernend, md->md_data, sizeof kernend); } + +#ifdef __arm__ + /* Convert addresses to the final VA */ + *modulep -= __elfN(relocation_offset); + + /* Do relocation fixup on metadata of each module. */ + for (xp = file_findfile(NULL, NULL); xp != NULL; xp = xp->f_next) { + for (i = 0; i < nitems(mdt); i++) { + md = file_findmetadata(xp, mdt[i]); + if (md) { + bcopy(md->md_data, &vaddr, sizeof vaddr); + vaddr -= __elfN(relocation_offset); + bcopy(&vaddr, md->md_data, sizeof vaddr); + } + } + } +#endif (void)md_copymodules(addr, kern64); #if defined(LOADER_FDT_SUPPORT) Modified: stable/11/stand/loader.mk ============================================================================== --- stable/11/stand/loader.mk Fri Apr 6 19:59:27 2018 (r332149) +++ stable/11/stand/loader.mk Fri Apr 6 20:24:50 2018 (r332150) @@ -22,12 +22,16 @@ SRCS+= load_elf32.c reloc_elf32.c .elif ${MACHINE_CPUARCH} == "powerpc" SRCS+= load_elf32.c reloc_elf32.c SRCS+= load_elf64.c reloc_elf64.c +SRCS+= metadata.c .elif ${MACHINE_CPUARCH} == "sparc64" SRCS+= load_elf64.c reloc_elf64.c +SRCS+= metadata.c .elif ${MACHINE_ARCH:Mmips64*} != "" SRCS+= load_elf64.c reloc_elf64.c +SRCS+= metadata.c .elif ${MACHINE} == "mips" SRCS+= load_elf32.c reloc_elf32.c +SRCS+= metadata.c .endif .if ${LOADER_DISK_SUPPORT:Uyes} == "yes" Modified: stable/11/stand/mips/beri/loader/Makefile ============================================================================== --- stable/11/stand/mips/beri/loader/Makefile Fri Apr 6 19:59:27 2018 (r332149) +++ stable/11/stand/mips/beri/loader/Makefile Fri Apr 6 20:24:50 2018 (r332150) @@ -47,7 +47,6 @@ SRCS= start.S \ main.c \ devicename.c \ exec.c \ - metadata.c \ vers.c \ arch.c Modified: stable/11/stand/mips/beri/loader/exec.c ============================================================================== --- stable/11/stand/mips/beri/loader/exec.c Fri Apr 6 19:59:27 2018 (r332149) +++ stable/11/stand/mips/beri/loader/exec.c Fri Apr 6 20:24:50 2018 (r332150) @@ -85,7 +85,7 @@ beri_elf64_exec(struct preloaded_file *fp) } ehdr = (Elf_Ehdr *)md->md_data; - error = md_load64(fp->f_args, &mdp); + error = md_load64(fp->f_args, &mdp, NULL); if (error) { printf("%s: md_load64 failed\n", fp->f_name); return (error); Modified: stable/11/stand/mips/beri/loader/loader.h ============================================================================== --- stable/11/stand/mips/beri/loader/loader.h Fri Apr 6 19:59:27 2018 (r332149) +++ stable/11/stand/mips/beri/loader/loader.h Fri Apr 6 20:24:50 2018 (r332150) @@ -56,7 +56,7 @@ extern char **boot2_envv; extern struct bootinfo boot2_bootinfo; /* metadata.c */ -int md_load64(char *args, vm_offset_t *modulep); +int md_load64(char *args, vm_offset_t *modulep, vm_offset_t *dtbp); /* vers.c */ extern char bootprog_info[]; Modified: stable/11/stand/powerpc/kboot/Makefile ============================================================================== --- stable/11/stand/powerpc/kboot/Makefile Fri Apr 6 19:59:27 2018 (r332149) +++ stable/11/stand/powerpc/kboot/Makefile Fri Apr 6 20:24:50 2018 (r332150) @@ -17,7 +17,7 @@ NEWVERSWHAT= "kboot loader" ${MACHINE_ARCH} INSTALLFLAGS= -b # Architecture-specific loader code -SRCS= conf.c metadata.c vers.c main.c ppc64_elf_freebsd.c +SRCS= conf.c vers.c main.c ppc64_elf_freebsd.c SRCS+= host_syscall.S hostcons.c hostdisk.c kerneltramp.S kbootfdt.c SRCS+= ucmpdi2.c Modified: stable/11/stand/powerpc/kboot/main.c ============================================================================== --- stable/11/stand/powerpc/kboot/main.c Fri Apr 6 19:59:27 2018 (r332149) +++ stable/11/stand/powerpc/kboot/main.c Fri Apr 6 20:24:50 2018 (r332150) @@ -291,6 +291,7 @@ main(int argc, const char **argv) setenv("currdev", bootdev, 1); setenv("loaddev", bootdev, 1); setenv("LINES", "24", 1); + setenv("usefdt", "1", 1); interact(); /* doesn't return */ Modified: stable/11/stand/powerpc/ofw/Makefile ============================================================================== --- stable/11/stand/powerpc/ofw/Makefile Fri Apr 6 19:59:27 2018 (r332149) +++ stable/11/stand/powerpc/ofw/Makefile Fri Apr 6 20:24:50 2018 (r332150) @@ -17,7 +17,7 @@ NEWVERSWHAT= "Open Firmware loader" ${MACHINE_ARCH} INSTALLFLAGS= -b # Architecture-specific loader code -SRCS= conf.c metadata.c vers.c start.c +SRCS= conf.c vers.c start.c SRCS+= ucmpdi2.c .include "${BOOTSRC}/fdt.mk" Modified: stable/11/stand/sparc64/loader/Makefile ============================================================================== --- stable/11/stand/sparc64/loader/Makefile Fri Apr 6 19:59:27 2018 (r332149) +++ stable/11/stand/sparc64/loader/Makefile Fri Apr 6 20:24:50 2018 (r332150) @@ -25,7 +25,7 @@ HAVE_ZFS= yes # Architecture-specific loader code .PATH: ${BOOTSRC}/sparc64/loader -SRCS= locore.S main.c metadata.c vers.c +SRCS= locore.S main.c vers.c .if ${LOADER_DEBUG} == "yes" CFLAGS+= -DLOADER_DEBUG Modified: stable/11/stand/uboot.mk ============================================================================== --- stable/11/stand/uboot.mk Fri Apr 6 19:59:27 2018 (r332149) +++ stable/11/stand/uboot.mk Fri Apr 6 20:24:50 2018 (r332150) @@ -1,6 +1,6 @@ # $FreeBSD$ -SRCS+= main.c metadata.c +SRCS+= main.c .PATH: ${UBOOTSRC}/common @@ -10,6 +10,9 @@ CFLAGS+= -I${UBOOTSRC}/common LIBUBOOT= ${BOOTOBJ}/uboot/lib/libuboot.a CFLAGS+= -I${UBOOTSRC}/lib CFLAGS+= -I${BOOTOBJ}/uboot/lib +.if ${MACHINE_CPUARCH} == "arm" +SRCS+= metadata.c +.endif .include "${BOOTSRC}/fdt.mk" Modified: stable/11/stand/uboot/lib/elf_freebsd.c ============================================================================== --- stable/11/stand/uboot/lib/elf_freebsd.c Fri Apr 6 19:59:27 2018 (r332149) +++ stable/11/stand/uboot/lib/elf_freebsd.c Fri Apr 6 20:24:50 2018 (r332150) @@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$"); #include "bootstrap.h" #include "libuboot.h" -extern vm_offset_t md_load(char *, vm_offset_t *); +extern vm_offset_t md_load(char *, vm_offset_t *, vm_offset_t *); int __elfN(uboot_load)(char *filename, u_int64_t dest, @@ -81,7 +81,7 @@ __elfN(uboot_exec)(struct preloaded_file *fp) e = (Elf_Ehdr *)&fmp->md_data; - if ((error = md_load(fp->f_args, &mdp)) != 0) + if ((error = md_load(fp->f_args, &mdp, NULL)) != 0) return (error); entry = (void *)e->e_entry; From owner-svn-src-stable-11@freebsd.org Fri Apr 6 20:27:56 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D8D8F83B4D; Fri, 6 Apr 2018 20:27:56 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2FA7D74B8E; Fri, 6 Apr 2018 20:27:56 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A88F16BC8; Fri, 6 Apr 2018 20:27:56 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w36KRunc058750; Fri, 6 Apr 2018 20:27:56 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w36KRtZk058743; Fri, 6 Apr 2018 20:27:55 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804062027.w36KRtZk058743@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 6 Apr 2018 20:27: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: r332152 - in stable/11/stand: ofw/common ofw/libofw powerpc/ofw X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/stand: ofw/common ofw/libofw powerpc/ofw X-SVN-Commit-Revision: 332152 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 20:27:56 -0000 Author: kevans Date: Fri Apr 6 20:27:55 2018 New Revision: 332152 URL: https://svnweb.freebsd.org/changeset/base/332152 Log: MFC r330365, r330371: OFW changes r330365: Move "common" Open Firmware parts of the loader used only on PowerPC to the powerpc/ subdirectory. These have never used by SPARC and we have no other (and almost certainly will have no other) Open Firmware platforms. This makes the directory structure simpler and lets us avoid some cargo-cult MI patterns on code that is, and always was, architecture-specific. r330371: Where we can, pass the kernel an FDT facsimile of the OF device tree rather than a pointer to Open Firmware by default. This eliminates a number of potentially unsafe calls to firmware from the kernel and provides better performance. This feature is meant to be expanded until it is on by default unconditionally and, ideally, we can then garbage-collect the nightmare pile of hacks required to call into Open Firmware from a live kernel. Added: stable/11/stand/powerpc/ofw/elf_freebsd.c - copied unchanged from r330365, head/stand/powerpc/ofw/elf_freebsd.c stable/11/stand/powerpc/ofw/main.c - copied, changed from r330365, head/stand/powerpc/ofw/main.c stable/11/stand/powerpc/ofw/ppc64_elf_freebsd.c - copied unchanged from r330365, head/stand/powerpc/ofw/ppc64_elf_freebsd.c Deleted: stable/11/stand/ofw/common/ stable/11/stand/ofw/libofw/elf_freebsd.c stable/11/stand/ofw/libofw/ppc64_elf_freebsd.c Modified: stable/11/stand/ofw/libofw/Makefile stable/11/stand/ofw/libofw/libofw.h stable/11/stand/powerpc/ofw/Makefile stable/11/stand/powerpc/ofw/conf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/ofw/libofw/Makefile ============================================================================== --- stable/11/stand/ofw/libofw/Makefile Fri Apr 6 20:26:56 2018 (r332151) +++ stable/11/stand/ofw/libofw/Makefile Fri Apr 6 20:27:55 2018 (r332152) @@ -4,7 +4,7 @@ LIB= ofw -SRCS= devicename.c elf_freebsd.c ofw_console.c ofw_copy.c ofw_disk.c \ +SRCS= devicename.c ofw_console.c ofw_copy.c ofw_disk.c \ ofw_memory.c ofw_module.c ofw_net.c ofw_reboot.c \ ofw_time.c openfirm.c .PATH: ${ZFSSRC} @@ -12,10 +12,6 @@ SRCS+= devicename_stubs.c # Pick up the bootstrap header for some interface items CFLAGS+= -I${LDRSRC} - -.if ${MACHINE_CPUARCH} == "powerpc" -SRCS+= ppc64_elf_freebsd.c -.endif .ifdef(BOOT_DISK_DEBUG) # Make the disk code more talkative Modified: stable/11/stand/ofw/libofw/libofw.h ============================================================================== --- stable/11/stand/ofw/libofw/libofw.h Fri Apr 6 20:26:56 2018 (r332151) +++ stable/11/stand/ofw/libofw/libofw.h Fri Apr 6 20:27:55 2018 (r332152) @@ -62,17 +62,9 @@ void ofw_memmap(int); struct preloaded_file; struct file_format; -int ofw_elf_loadfile(char *, vm_offset_t, struct preloaded_file **); -int ofw_elf_exec(struct preloaded_file *); - /* MD code implementing MI interfaces */ vm_offset_t md_load(char *args, vm_offset_t *modulep, vm_offset_t *dtb); vm_offset_t md_load64(char *args, vm_offset_t *modulep, vm_offset_t *dtb); - -extern struct file_format ofw_elf; -#ifdef __powerpc__ -extern struct file_format ofw_elf64; -#endif extern void reboot(void); Modified: stable/11/stand/powerpc/ofw/Makefile ============================================================================== --- stable/11/stand/powerpc/ofw/Makefile Fri Apr 6 20:26:56 2018 (r332151) +++ stable/11/stand/powerpc/ofw/Makefile Fri Apr 6 20:27:55 2018 (r332152) @@ -17,7 +17,7 @@ NEWVERSWHAT= "Open Firmware loader" ${MACHINE_ARCH} INSTALLFLAGS= -b # Architecture-specific loader code -SRCS= conf.c vers.c start.c +SRCS= conf.c vers.c main.c elf_freebsd.c ppc64_elf_freebsd.c start.c SRCS+= ucmpdi2.c .include "${BOOTSRC}/fdt.mk" @@ -37,10 +37,6 @@ RELOC?= 0x1C00000 CFLAGS+= -DRELOC=${RELOC} LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.powerpc - -# Pull in common loader code -.PATH: ${BOOTSRC}/ofw/common -.include "${BOOTSRC}/ofw/common/Makefile.inc" # Open Firmware standalone support library LIBOFW= ${BOOTOBJ}/ofw/libofw/libofw.a Modified: stable/11/stand/powerpc/ofw/conf.c ============================================================================== --- stable/11/stand/powerpc/ofw/conf.c Fri Apr 6 20:26:56 2018 (r332151) +++ stable/11/stand/powerpc/ofw/conf.c Fri Apr 6 20:27:55 2018 (r332152) @@ -97,6 +97,9 @@ struct netif_driver *netif_drivers[] = { * rather than reading the file go first. */ +struct file_format ofw_elf; +struct file_format ofw_elf64; + struct file_format *file_formats[] = { &ofw_elf, &ofw_elf64, Copied: stable/11/stand/powerpc/ofw/elf_freebsd.c (from r330365, head/stand/powerpc/ofw/elf_freebsd.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/stand/powerpc/ofw/elf_freebsd.c Fri Apr 6 20:27:55 2018 (r332152, copy of r330365, head/stand/powerpc/ofw/elf_freebsd.c) @@ -0,0 +1,106 @@ +/*- + * Copyright (c) 2001 Benno Rice + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include +#include +#if defined(__powerpc__) +#include +#endif + +#include + +#include "bootstrap.h" +#include "libofw.h" +#include "openfirm.h" + +extern char end[]; +extern vm_offset_t reloc; /* From /conf.c */ + +int +__elfN(ofw_loadfile)(char *filename, u_int64_t dest, + struct preloaded_file **result) +{ + int r; + + r = __elfN(loadfile)(filename, dest, result); + if (r != 0) + return (r); + +#if defined(__powerpc__) + /* + * No need to sync the icache for modules: this will + * be done by the kernel after relocation. + */ + if (!strcmp((*result)->f_type, "elf kernel")) + __syncicache((void *) (*result)->f_addr, (*result)->f_size); +#endif + return (0); +} + +int +__elfN(ofw_exec)(struct preloaded_file *fp) +{ + struct file_metadata *fmp; + vm_offset_t mdp, dtbp; + Elf_Ehdr *e; + int error; + intptr_t entry; + + if ((fmp = file_findmetadata(fp, MODINFOMD_ELFHDR)) == NULL) { + return(EFTYPE); + } + e = (Elf_Ehdr *)&fmp->md_data; + entry = e->e_entry; + + if ((error = md_load(fp->f_args, &mdp, &dtbp)) != 0) + return (error); + + printf("Kernel entry at 0x%lx ...\n", e->e_entry); + + dev_cleanup(); + if (dtbp != 0) { + OF_quiesce(); + ((int (*)(u_long, u_long, u_long, void *, u_long))entry)(dtbp, + 0, 0, (void *)mdp, 0xfb5d104d); + } else { + OF_chain((void *)reloc, end - (char *)reloc, (void *)entry, + (void *)mdp, 0xfb5d104d); + } + + panic("exec returned"); +} + +struct file_format ofw_elf = +{ + __elfN(ofw_loadfile), + __elfN(ofw_exec) +}; Copied and modified: stable/11/stand/powerpc/ofw/main.c (from r330365, head/stand/powerpc/ofw/main.c) ============================================================================== --- head/stand/powerpc/ofw/main.c Sat Mar 3 23:39:07 2018 (r330365, copy source) +++ stable/11/stand/powerpc/ofw/main.c Fri Apr 6 20:27:55 2018 (r332152) @@ -33,6 +33,8 @@ __FBSDID("$FreeBSD$"); #include "libofw.h" #include "bootstrap.h" +#include + struct arch_switch archsw; /* MI/MD interface boundary */ extern char end[]; @@ -47,6 +49,16 @@ static char heap[HEAP_SIZE]; // In BSS, so uses no spa #define OF_puts(fd, text) OF_write(fd, text, strlen(text)) +static __inline register_t +mfmsr(void) +{ + register_t value; + + __asm __volatile ("mfmsr %0" : "=r"(value)); + + return (value); +} + void init_heap(void) { @@ -144,6 +156,15 @@ main(int (*openfirm)(void *)) env_setenv("loaddev", EV_VOLATILE, bootpath, env_noset, env_nounset); setenv("LINES", "24", 1); /* optional */ + + /* + * On non-Apple hardware, where it works reliably, pass flattened + * device trees to the kernel by default instead of OF CI pointers. + * Apple hardware is the only virtual-mode OF implementation in + * existence, so far as I am aware, so use that as a flag. + */ + if (!(mfmsr() & PSL_DR)) + setenv("usefdt", "1", 1); archsw.arch_getdev = ofw_getdev; archsw.arch_copyin = ofw_copyin; Copied: stable/11/stand/powerpc/ofw/ppc64_elf_freebsd.c (from r330365, head/stand/powerpc/ofw/ppc64_elf_freebsd.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/stand/powerpc/ofw/ppc64_elf_freebsd.c Fri Apr 6 20:27:55 2018 (r332152, copy of r330365, head/stand/powerpc/ofw/ppc64_elf_freebsd.c) @@ -0,0 +1,110 @@ +/*- + * Copyright (c) 2001 Benno Rice + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#define __ELF_WORD_SIZE 64 + +#include +#include + +#include +#include +#include + +#include + +#include "bootstrap.h" +#include "libofw.h" +#include "openfirm.h" + +extern char end[]; +extern vm_offset_t reloc; /* From /conf.c */ + +int +ppc64_ofw_elf_loadfile(char *filename, u_int64_t dest, + struct preloaded_file **result) +{ + int r; + + r = __elfN(loadfile)(filename, dest, result); + if (r != 0) + return (r); + + /* + * No need to sync the icache for modules: this will + * be done by the kernel after relocation. + */ + if (!strcmp((*result)->f_type, "elf kernel")) + __syncicache((void *) (*result)->f_addr, (*result)->f_size); + return (0); +} + +int +ppc64_ofw_elf_exec(struct preloaded_file *fp) +{ + struct file_metadata *fmp; + vm_offset_t mdp, dtbp; + Elf_Ehdr *e; + int error; + intptr_t entry; + + if ((fmp = file_findmetadata(fp, MODINFOMD_ELFHDR)) == NULL) { + return(EFTYPE); + } + e = (Elf_Ehdr *)&fmp->md_data; + + /* Handle function descriptor for ELFv1 kernels */ + if ((e->e_flags & 3) == 2) + entry = e->e_entry; + else + entry = *(uint64_t *)(intptr_t)e->e_entry; + + if ((error = md_load64(fp->f_args, &mdp, &dtbp)) != 0) + return (error); + + printf("Kernel entry at 0x%lx ...\n", entry); + + dev_cleanup(); + + if (dtbp != 0) { + OF_quiesce(); + ((int (*)(u_long, u_long, u_long, void *, u_long))entry)(dtbp, + 0, 0, (void *)mdp, 0xfb5d104d); + } else { + OF_chain((void *)reloc, end - (char *)reloc, (void *)entry, + (void *)mdp, 0xfb5d104d); + } + + panic("exec returned"); +} + +struct file_format ofw_elf64 = +{ + ppc64_ofw_elf_loadfile, + ppc64_ofw_elf_exec +}; From owner-svn-src-stable-11@freebsd.org Fri Apr 6 20:56:07 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 83E7CF85C6F; Fri, 6 Apr 2018 20:56:07 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3004C760A2; Fri, 6 Apr 2018 20:56:07 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2AC2E170E5; Fri, 6 Apr 2018 20:56:07 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w36Ku7fJ074507; Fri, 6 Apr 2018 20:56:07 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w36Ku7e9074506; Fri, 6 Apr 2018 20:56:07 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804062056.w36Ku7e9074506@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 6 Apr 2018 20:56: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: r332153 - stable/11/share/mk X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/share/mk X-SVN-Commit-Revision: 332153 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 20:56:07 -0000 Author: kevans Date: Fri Apr 6 20:56:06 2018 New Revision: 332153 URL: https://svnweb.freebsd.org/changeset/base/332153 Log: stable/11: Mark EFI as a broken option on pc98 This is a direct commit to stable/11, due to pc98 removal in head. Modified: stable/11/share/mk/src.opts.mk Modified: stable/11/share/mk/src.opts.mk ============================================================================== --- stable/11/share/mk/src.opts.mk Fri Apr 6 20:27:55 2018 (r332152) +++ stable/11/share/mk/src.opts.mk Fri Apr 6 20:56:06 2018 (r332153) @@ -278,8 +278,9 @@ BROKEN_OPTIONS+=LLDB .if ${__T} != "armv6" BROKEN_OPTIONS+=LIBSOFT .endif -# EFI doesn't exist on mips, powerpc, sparc or riscv. -.if ${__T:Mmips*} || ${__T:Mpowerpc*} || ${__T:Msparc64} || ${__T:Mriscv*} +# EFI doesn't exist on mips, pc98, powerpc, sparc or riscv. +.if ${__T:Mmips*} || ${__TT:Mpc98*} || ${__T:Mpowerpc*} || ${__T:Msparc64} || \ + ${__T:Mriscv*} BROKEN_OPTIONS+=EFI .endif # GELI isn't supported on !x86 From owner-svn-src-stable-11@freebsd.org Fri Apr 6 21:06:53 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66712F86741; Fri, 6 Apr 2018 21:06:53 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E28267675D; Fri, 6 Apr 2018 21:06:52 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from coleburn.home.andric.com (coleburn.home.andric.com [192.168.0.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 01C5944E05; Fri, 6 Apr 2018 23:06:51 +0200 (CEST) From: Dimitry Andric Message-Id: <9DB407A8-8A6E-4F79-A5B3-5ED26AF37EEF@FreeBSD.org> Content-Type: multipart/signed; boundary="Apple-Mail=_59E2B4E0-1F75-4305-9172-726B1C2294A3"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: svn commit: r331838 - in stable/11: . contrib/compiler-rt/include/sanitizer contrib/compiler-rt/include/xray contrib/compiler-rt/lib/BlocksRuntime contrib/compiler-rt/lib/asan contrib/compiler-rt/l... Date: Fri, 6 Apr 2018 23:06:50 +0200 In-Reply-To: Cc: John Baldwin , Ed Maste , Antoine Brodin , src-committers , re , svn-src-stable@freebsd.org, svn-src-all@freebsd.org, svn-src-stable-11@freebsd.org, Mark Linimon To: Oliver Pinter References: <201803311138.w2VBcKHP014025@repo.freebsd.org> <20180331184109.GA23589@lonesome.com> <2526702.9M648BMneK@ralph.baldwin.cx> X-Mailer: Apple Mail (2.3273) X-Mailman-Approved-At: Fri, 06 Apr 2018 21:26:15 +0000 X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 21:06:53 -0000 --Apple-Mail=_59E2B4E0-1F75-4305-9172-726B1C2294A3 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii On 6 Apr 2018, at 21:00, Oliver Pinter wrote: > > On 4/6/18, John Baldwin wrote: >> On Monday, April 02, 2018 12:27:47 PM Ed Maste wrote: >>> On 31 March 2018 at 14:41, Mark Linimon wrote: >>> This is the most important point of this discussion: we do need to >>> ensure there's good communication and coordination between teams where >>> dependencies like this exist. I'll take the blame here: Dimitry asked >>> me about merging the Clang update to stable/11 and I agreed that it >>> was reasonable to merge sooner rather than later to have as much lead >>> time as possible before the 11.2 process starts. I also assumed that >>> outstanding Clang 6 issues in ports were farther along in being >>> addressed. >>> >>> The key lesson from this discussion is that for significant commits >>> and merges like this one we should make sure to always have sufficient >>> advance notice. >> >> Is this driven by -mretpoline? > > Don't think so since it requires LLD as linker. You can use lld on 11, but it isn't the default. > The LLVM 5 which was already > part of the 11-stable has the retpoline option. See r331219. Indeed, r331219 contains backports (from upstream) for llvm, clang *and* lld. If you want to make use of -mretpoline, you should also pass -fuse-ld=lld on the command line. > From other side, I like to see a newer compiler sets in the recent > releases, because > there are lot of performance improvements and other fixes. That is certainly the case, the flip side is that there are always some new bugs, regressions and newly added warnings. Having the default C++ dialect bumped is really an anomaly, this won't happen every upstream release. :) -Dimitry --Apple-Mail=_59E2B4E0-1F75-4305-9172-726B1C2294A3 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCWsfhagAKCRCwXqMKLiCW o1KkAKDuBRPEESSzWrVU1iq3IRWYFja7nwCfXTrNI0vMPx2R15vCoJcdJqBQAq8= =gktQ -----END PGP SIGNATURE----- --Apple-Mail=_59E2B4E0-1F75-4305-9172-726B1C2294A3-- From owner-svn-src-stable-11@freebsd.org Fri Apr 6 21:37:29 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2762F889DD; Fri, 6 Apr 2018 21:37:28 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9961E778EF; Fri, 6 Apr 2018 21:37:28 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 93DE9177B1; Fri, 6 Apr 2018 21:37:28 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w36LbSiv094314; Fri, 6 Apr 2018 21:37:28 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w36LbQXV094285; Fri, 6 Apr 2018 21:37:26 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804062137.w36LbQXV094285@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 6 Apr 2018 21:37:26 +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: r332154 - in stable/11/stand: common efi/boot1 efi/include efi/libefi efi/loader efi/loader/arch/arm ficl/aarch64 ficl/amd64 ficl/arm ficl/i386 ficl/mips ficl/mips64 ficl/powerpc ficl/r... X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11/stand: common efi/boot1 efi/include efi/libefi efi/loader efi/loader/arch/arm ficl/aarch64 ficl/amd64 ficl/arm ficl/i386 ficl/mips ficl/mips64 ficl/powerpc ficl/riscv ficl/sparc64 i386/bt... X-SVN-Commit-Revision: 332154 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 21:37:29 -0000 Author: kevans Date: Fri Apr 6 21:37:25 2018 New Revision: 332154 URL: https://svnweb.freebsd.org/changeset/base/332154 Log: MFC r330806-r330815, r330837, r330864, r330883 pc98 changes associated with the named commits are also included in this commit, despite not having been made with the original commits due to its removal in head. r330806: Minor cosmetic changes. Make sure { on the same line as struct for all struct *devdesc. Move some type definitions to next to the dv_type define, since that's what sets the d_type. r330807: We can't use d_opendata for blkio storage. open_disk uses d_opendata for it's own purpse. We can't store blkio there. Fortunately, blkio is stored elsewhere and we never actually retrieve blkio from d_opendata. Eliminate it as a source of confusion. Eliminate all stores of d_opendata in efi since this layer doesn't own that field. r330808: Make struct libi386_devdesc match the struct devdesc better Move data to top and call it d_opendata. r330809: Use the actual struct devdesc at the start of all *_devdesc structs The current system is fragile and requires very careful layout of all *_devdesc structures. It also makes it hard to change the base devdesc. Take a page from CAM and put the 'header' in all the derived classes and adjust the code to match. For OFW, move the iHandle h_handle out of a slot conflicting with d_opendata. Due to quirks in the alignment rules, this worked. However changing the code to use d_opendata storage now that it's a pointer is hard, so just have a separate field for it. All other cleanups were to make the *_devdesc structures match where they'd taken some liberties that were none-the-less compatible enough to work. r330810: Remove d_type from devdesc. It's not needed as we can fetch it from d_dev->dv_type when we need it. r330811: GC unused routines. Sponsored by: Netflix r330812: Use the one-line-per-file pattern here, and sort the file names. Sponsored by: Netflix r330813: Move the env convenience routines out of boot1.c. These routines are more generally useful. Even though boot1 is on its way out, it's better to make these common during the transition than copy them. r330814: Star BootCurrent entry when booting. Sponsored by: Netflix r330815: Print the load and device path as well as BootCurrent and BootOrder Sponsored by: Netflix r330837: biosdisk.c should not set d_opendata. Same as 330807, d_opendata is owned by open_disk and we should not set it. M stand/i386/libi386/biosdisk.c r330864: Prefer uintXX_t to u_intXX_t A foolish consistency is the hobgoblin of little minds, adored by little statesmen and philosophers and divines. With consistency a great soul has simply nothing to do. -- Ralph Waldo Emerson r330883: Fix typo that misteriously passes compilation. Added: stable/11/stand/efi/libefi/efienv.c - copied unchanged from r330815, head/stand/efi/libefi/efienv.c Modified: stable/11/stand/common/bootstrap.h stable/11/stand/common/disk.c stable/11/stand/common/disk.h stable/11/stand/common/isapnp.c stable/11/stand/common/load_elf.c stable/11/stand/common/load_elf_obj.c stable/11/stand/common/metadata.c stable/11/stand/common/misc.c stable/11/stand/common/pnp.c stable/11/stand/efi/boot1/boot1.c stable/11/stand/efi/boot1/ufs_module.c stable/11/stand/efi/include/efilib.h stable/11/stand/efi/libefi/Makefile stable/11/stand/efi/libefi/devicename.c stable/11/stand/efi/libefi/efipart.c stable/11/stand/efi/libefi/efizfs.c stable/11/stand/efi/libefi/env.c stable/11/stand/efi/loader/arch/arm/exec.c stable/11/stand/efi/loader/main.c stable/11/stand/ficl/aarch64/sysdep.c stable/11/stand/ficl/amd64/sysdep.c stable/11/stand/ficl/arm/sysdep.c stable/11/stand/ficl/i386/sysdep.c stable/11/stand/ficl/mips/sysdep.c stable/11/stand/ficl/mips64/sysdep.c stable/11/stand/ficl/powerpc/sysdep.c stable/11/stand/ficl/riscv/sysdep.c stable/11/stand/ficl/sparc64/sysdep.c stable/11/stand/i386/btx/lib/btxv86.h stable/11/stand/i386/libi386/biosacpi.c stable/11/stand/i386/libi386/bioscd.c stable/11/stand/i386/libi386/biosdisk.c stable/11/stand/i386/libi386/biospnp.c stable/11/stand/i386/libi386/bootinfo32.c stable/11/stand/i386/libi386/bootinfo64.c stable/11/stand/i386/libi386/devicename.c stable/11/stand/i386/libi386/elf64_freebsd.c stable/11/stand/i386/libi386/libi386.h stable/11/stand/i386/libi386/multiboot.c stable/11/stand/i386/libi386/pxe.c stable/11/stand/i386/loader/chain.c stable/11/stand/i386/loader/main.c stable/11/stand/libsa/arp.c stable/11/stand/libsa/bootp.c stable/11/stand/libsa/bootparam.c stable/11/stand/libsa/dosfs.h stable/11/stand/libsa/ext2fs.c stable/11/stand/libsa/net.h stable/11/stand/libsa/rpc.c stable/11/stand/libsa/stand.h stable/11/stand/mips/beri/loader/beri_disk_cfi.c stable/11/stand/mips/beri/loader/beri_disk_sdcard.c stable/11/stand/mips/beri/loader/devicename.c stable/11/stand/ofw/libofw/devicename.c stable/11/stand/ofw/libofw/libofw.h stable/11/stand/ofw/libofw/openfirm.c stable/11/stand/pc98/libpc98/bioscd.c stable/11/stand/pc98/libpc98/biosdisk.c stable/11/stand/pc98/loader/main.c stable/11/stand/powerpc/boot1.chrp/boot1.c stable/11/stand/powerpc/kboot/ppc64_elf_freebsd.c stable/11/stand/powerpc/ofw/elf_freebsd.c stable/11/stand/powerpc/ofw/main.c stable/11/stand/powerpc/ofw/ppc64_elf_freebsd.c stable/11/stand/sparc64/boot1/boot1.c stable/11/stand/sparc64/loader/main.c stable/11/stand/uboot/common/main.c stable/11/stand/uboot/lib/devicename.c stable/11/stand/uboot/lib/disk.c stable/11/stand/uboot/lib/elf_freebsd.c stable/11/stand/uboot/lib/libuboot.h stable/11/stand/userboot/userboot/bootinfo32.c stable/11/stand/userboot/userboot/bootinfo64.c stable/11/stand/userboot/userboot/devicename.c stable/11/stand/userboot/userboot/elf64_freebsd.c stable/11/stand/userboot/userboot/main.c stable/11/stand/userboot/userboot/userboot_disk.c stable/11/stand/zfs/libzfs.h stable/11/stand/zfs/zfs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/common/bootstrap.h ============================================================================== --- stable/11/stand/common/bootstrap.h Fri Apr 6 20:56:06 2018 (r332153) +++ stable/11/stand/common/bootstrap.h Fri Apr 6 21:37:25 2018 (r332154) @@ -150,7 +150,7 @@ void pnp_addident(struct pnpinfo *pi, char *ident); struct pnpinfo *pnp_allocinfo(void); void pnp_freeinfo(struct pnpinfo *pi); void pnp_addinfo(struct pnpinfo *pi); -char *pnp_eisaformat(u_int8_t *data); +char *pnp_eisaformat(uint8_t *data); /* * < 0 - No ISA in system @@ -168,7 +168,7 @@ extern int isapnp_readport; struct file_metadata { size_t md_size; - u_int16_t md_type; + uint16_t md_type; struct file_metadata *md_next; char md_data[1]; /* data are immediately appended */ }; @@ -210,7 +210,7 @@ struct preloaded_file struct file_format { /* Load function must return EFTYPE if it can't handle the module supplied */ - int (* l_load)(char *filename, u_int64_t dest, struct preloaded_file **result); + int (* l_load)(char *filename, uint64_t dest, struct preloaded_file **result); /* Only a loader that will load a kernel (first module) should have an exec handler */ int (* l_exec)(struct preloaded_file *mp); }; @@ -239,20 +239,20 @@ void file_removemetadata(struct preloaded_file *fp); #define ELF_RELOC_RELA 2 /* Relocation offset for some architectures */ -extern u_int64_t __elfN(relocation_offset); +extern uint64_t __elfN(relocation_offset); struct elf_file; typedef Elf_Addr (symaddr_fn)(struct elf_file *ef, Elf_Size symidx); -int __elfN(loadfile)(char *filename, u_int64_t dest, struct preloaded_file **result); -int __elfN(obj_loadfile)(char *filename, u_int64_t dest, +int __elfN(loadfile)(char *filename, uint64_t dest, struct preloaded_file **result); +int __elfN(obj_loadfile)(char *filename, uint64_t dest, struct preloaded_file **result); int __elfN(reloc)(struct elf_file *ef, symaddr_fn *symaddr, const void *reldata, int reltype, Elf_Addr relbase, Elf_Addr dataaddr, void *data, size_t len); -int __elfN(loadfile_raw)(char *filename, u_int64_t dest, +int __elfN(loadfile_raw)(char *filename, uint64_t dest, struct preloaded_file **result, int multiboot); -int __elfN(load_modmetadata)(struct preloaded_file *fp, u_int64_t dest); +int __elfN(load_modmetadata)(struct preloaded_file *fp, uint64_t dest); #endif /* Modified: stable/11/stand/common/disk.c ============================================================================== --- stable/11/stand/common/disk.c Fri Apr 6 20:56:06 2018 (r332153) +++ stable/11/stand/common/disk.c Fri Apr 6 21:37:25 2018 (r332154) @@ -86,7 +86,7 @@ ptblread(void *d, void *buf, size_t blocks, uint64_t o struct open_disk *od; dev = (struct disk_devdesc *)d; - od = (struct open_disk *)dev->d_opendata; + od = (struct open_disk *)dev->dd.d_opendata; /* * The strategy function assumes the offset is in units of 512 byte @@ -98,7 +98,7 @@ ptblread(void *d, void *buf, size_t blocks, uint64_t o * As the GPT backup partition is located at the end of the disk, * to avoid reading past disk end, flag bcache not to use RA. */ - return (dev->d_dev->dv_strategy(dev, F_READ | F_NORA, offset, + return (dev->dd.d_dev->dv_strategy(dev, F_READ | F_NORA, offset, blocks * od->sectorsize, (char *)buf, NULL)); } @@ -114,7 +114,7 @@ ptable_print(void *arg, const char *pname, const struc int res; pa = (struct print_args *)arg; - od = (struct open_disk *)pa->dev->d_opendata; + od = (struct open_disk *)pa->dev->dd.d_opendata; sprintf(line, " %s%s: %s", pa->prefix, pname, parttype2str(part->type)); if (pa->verbose) @@ -127,8 +127,8 @@ ptable_print(void *arg, const char *pname, const struc res = 0; if (part->type == PART_FREEBSD) { /* Open slice with BSD label */ - dev.d_dev = pa->dev->d_dev; - dev.d_unit = pa->dev->d_unit; + dev.dd.d_dev = pa->dev->dd.d_dev; + dev.dd.d_unit = pa->dev->dd.d_unit; dev.d_slice = part->index; dev.d_partition = -1; if (disk_open(&dev, part->end - part->start + 1, @@ -158,7 +158,7 @@ disk_print(struct disk_devdesc *dev, char *prefix, int struct print_args pa; /* Disk should be opened */ - od = (struct open_disk *)dev->d_opendata; + od = (struct open_disk *)dev->dd.d_opendata; pa.dev = dev; pa.prefix = prefix; pa.verbose = verbose; @@ -171,8 +171,8 @@ disk_read(struct disk_devdesc *dev, void *buf, uint64_ struct open_disk *od; int ret; - od = (struct open_disk *)dev->d_opendata; - ret = dev->d_dev->dv_strategy(dev, F_READ, dev->d_offset + offset, + od = (struct open_disk *)dev->dd.d_opendata; + ret = dev->dd.d_dev->dv_strategy(dev, F_READ, dev->d_offset + offset, blocks * od->sectorsize, buf, NULL); return (ret); @@ -184,8 +184,8 @@ disk_write(struct disk_devdesc *dev, void *buf, uint64 struct open_disk *od; int ret; - od = (struct open_disk *)dev->d_opendata; - ret = dev->d_dev->dv_strategy(dev, F_WRITE, dev->d_offset + offset, + od = (struct open_disk *)dev->dd.d_opendata; + ret = dev->dd.d_dev->dv_strategy(dev, F_WRITE, dev->d_offset + offset, blocks * od->sectorsize, buf, NULL); return (ret); @@ -194,7 +194,7 @@ disk_write(struct disk_devdesc *dev, void *buf, uint64 int disk_ioctl(struct disk_devdesc *dev, u_long cmd, void *data) { - struct open_disk *od = dev->d_opendata; + struct open_disk *od = dev->dd.d_opendata; if (od == NULL) return (ENOTTY); @@ -238,7 +238,7 @@ disk_open(struct disk_devdesc *dev, uint64_t mediasize DEBUG("no memory"); return (ENOMEM); } - dev->d_opendata = od; + dev->dd.d_opendata = od; od->entrysize = 0; od->mediasize = mediasize; od->sectorsize = sectorsize; @@ -348,7 +348,7 @@ disk_close(struct disk_devdesc *dev) { struct open_disk *od; - od = (struct open_disk *)dev->d_opendata; + od = (struct open_disk *)dev->dd.d_opendata; DEBUG("%s closed => %p", disk_fmtdev(dev), od); ptable_close(od->table); free(od); @@ -361,7 +361,7 @@ disk_fmtdev(struct disk_devdesc *dev) static char buf[128]; char *cp; - cp = buf + sprintf(buf, "%s%d", dev->d_dev->dv_name, dev->d_unit); + cp = buf + sprintf(buf, "%s%d", dev->dd.d_dev->dv_name, dev->dd.d_unit); if (dev->d_slice >= 0) { #ifdef LOADER_GPT_SUPPORT if (dev->d_partition == 255) { @@ -423,7 +423,7 @@ disk_parsedev(struct disk_devdesc *dev, const char *de if (*cp != '\0' && *cp != ':') return (EINVAL); - dev->d_unit = unit; + dev->dd.d_unit = unit; dev->d_slice = slice; dev->d_partition = partition; if (path != NULL) Modified: stable/11/stand/common/disk.h ============================================================================== --- stable/11/stand/common/disk.h Fri Apr 6 20:56:06 2018 (r332153) +++ stable/11/stand/common/disk.h Fri Apr 6 21:37:25 2018 (r332154) @@ -81,12 +81,9 @@ #ifndef _DISK_H #define _DISK_H -struct disk_devdesc -{ - struct devsw *d_dev; - int d_type; - int d_unit; - void *d_opendata; +/* Note: Must match the 'struct devdesc' in stand.h */ +struct disk_devdesc { + struct devdesc dd; int d_slice; int d_partition; uint64_t d_offset; Modified: stable/11/stand/common/isapnp.c ============================================================================== --- stable/11/stand/common/isapnp.c Fri Apr 6 20:56:06 2018 (r332153) +++ stable/11/stand/common/isapnp.c Fri Apr 6 21:37:25 2018 (r332154) @@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$"); static void isapnp_write(int d, int r); static void isapnp_send_Initiation_LFSR(void); -static int isapnp_get_serial(u_int8_t *p); +static int isapnp_get_serial(uint8_t *p); static int isapnp_isolation_protocol(void); static void isapnp_enumerate(void); @@ -90,7 +90,7 @@ isapnp_send_Initiation_LFSR(void) * Get the device's serial number. Returns 1 if the serial is valid. */ static int -isapnp_get_serial(u_int8_t *data) +isapnp_get_serial(uint8_t *data) { int i, bit, valid = 0, sum = 0x6a; @@ -123,7 +123,7 @@ isapnp_get_serial(u_int8_t *data) * Returns nonzero if the device fails to report */ static int -isapnp_get_resource_info(u_int8_t *buffer, int len) +isapnp_get_resource_info(uint8_t *buffer, int len) { int i, j; u_char temp; @@ -229,7 +229,7 @@ isapnp_isolation_protocol(void) { int csn; struct pnpinfo *pi; - u_int8_t cardid[_PNP_ID_LEN]; + uint8_t cardid[_PNP_ID_LEN]; int ndevs; isapnp_send_Initiation_LFSR(); Modified: stable/11/stand/common/load_elf.c ============================================================================== --- stable/11/stand/common/load_elf.c Fri Apr 6 20:56:06 2018 (r332153) +++ stable/11/stand/common/load_elf.c Fri Apr 6 21:37:25 2018 (r332154) @@ -70,11 +70,11 @@ typedef struct elf_file { caddr_t firstpage; size_t firstlen; int kernel; - u_int64_t off; + uint64_t off; } *elf_file_t; static int __elfN(loadimage)(struct preloaded_file *mp, elf_file_t ef, - u_int64_t loadaddr); + uint64_t loadaddr); static int __elfN(lookup_symbol)(struct preloaded_file *mp, elf_file_t ef, const char* name, Elf_Sym* sym); static int __elfN(reloc_ptr)(struct preloaded_file *mp, elf_file_t ef, @@ -87,7 +87,7 @@ static char *fake_modname(const char *name); const char *__elfN(kerneltype) = "elf kernel"; const char *__elfN(moduletype) = "elf module"; -u_int64_t __elfN(relocation_offset) = 0; +uint64_t __elfN(relocation_offset) = 0; extern void elf_wrong_field_size(void); #define CONVERT_FIELD(b, f, e) \ @@ -265,13 +265,13 @@ error: * will be saved in (result). */ int -__elfN(loadfile)(char *filename, u_int64_t dest, struct preloaded_file **result) +__elfN(loadfile)(char *filename, uint64_t dest, struct preloaded_file **result) { return (__elfN(loadfile_raw)(filename, dest, result, 0)); } int -__elfN(loadfile_raw)(char *filename, u_int64_t dest, +__elfN(loadfile_raw)(char *filename, uint64_t dest, struct preloaded_file **result, int multiboot) { struct preloaded_file *fp, *kfp; @@ -419,7 +419,7 @@ out: * the Elf header, load the image at (off) */ static int -__elfN(loadimage)(struct preloaded_file *fp, elf_file_t ef, u_int64_t off) +__elfN(loadimage)(struct preloaded_file *fp, elf_file_t ef, uint64_t off) { int i; u_int j; @@ -883,21 +883,21 @@ fake_modname(const char *name) struct mod_metadata64 { int md_version; /* structure version MDTV_* */ int md_type; /* type of entry MDT_* */ - u_int64_t md_data; /* specific data */ - u_int64_t md_cval; /* common string label */ + uint64_t md_data; /* specific data */ + uint64_t md_cval; /* common string label */ }; #endif #if defined(__amd64__) && __ELF_WORD_SIZE == 32 struct mod_metadata32 { int md_version; /* structure version MDTV_* */ int md_type; /* type of entry MDT_* */ - u_int32_t md_data; /* specific data */ - u_int32_t md_cval; /* common string label */ + uint32_t md_data; /* specific data */ + uint32_t md_cval; /* common string label */ }; #endif int -__elfN(load_modmetadata)(struct preloaded_file *fp, u_int64_t dest) +__elfN(load_modmetadata)(struct preloaded_file *fp, uint64_t dest) { struct elf_file ef; int err, i, j; Modified: stable/11/stand/common/load_elf_obj.c ============================================================================== --- stable/11/stand/common/load_elf_obj.c Fri Apr 6 20:56:06 2018 (r332153) +++ stable/11/stand/common/load_elf_obj.c Fri Apr 6 21:37:25 2018 (r332154) @@ -63,7 +63,7 @@ typedef struct elf_file { } *elf_file_t; static int __elfN(obj_loadimage)(struct preloaded_file *mp, elf_file_t ef, - u_int64_t loadaddr); + uint64_t loadaddr); static int __elfN(obj_lookup_set)(struct preloaded_file *mp, elf_file_t ef, const char *name, Elf_Addr *startp, Elf_Addr *stopp, int *countp); static int __elfN(obj_reloc_ptr)(struct preloaded_file *mp, elf_file_t ef, @@ -81,7 +81,7 @@ const char *__elfN(obj_moduletype) = "elf obj module"; * will be saved in (result). */ int -__elfN(obj_loadfile)(char *filename, u_int64_t dest, +__elfN(obj_loadfile)(char *filename, uint64_t dest, struct preloaded_file **result) { struct preloaded_file *fp, *kfp; @@ -186,7 +186,7 @@ out: * the Elf header, load the image at (off) */ static int -__elfN(obj_loadimage)(struct preloaded_file *fp, elf_file_t ef, u_int64_t off) +__elfN(obj_loadimage)(struct preloaded_file *fp, elf_file_t ef, uint64_t off) { Elf_Ehdr *hdr; Elf_Shdr *shdr, *cshdr, *lshdr; @@ -345,8 +345,8 @@ out: struct mod_metadata64 { int md_version; /* structure version MDTV_* */ int md_type; /* type of entry MDT_* */ - u_int64_t md_data; /* specific data */ - u_int64_t md_cval; /* common string label */ + uint64_t md_data; /* specific data */ + uint64_t md_cval; /* common string label */ }; #endif Modified: stable/11/stand/common/metadata.c ============================================================================== --- stable/11/stand/common/metadata.c Fri Apr 6 20:56:06 2018 (r332153) +++ stable/11/stand/common/metadata.c Fri Apr 6 21:37:25 2018 (r332154) @@ -217,7 +217,7 @@ md_copyenv(vm_offset_t addr) static int align; #define COPY32(v, a, c) { \ - u_int32_t x = (v); \ + uint32_t x = (v); \ if (c) \ archsw.arch_copyin(&x, a, sizeof(x)); \ a += sizeof(x); \ Modified: stable/11/stand/common/misc.c ============================================================================== --- stable/11/stand/common/misc.c Fri Apr 6 20:56:06 2018 (r332153) +++ stable/11/stand/common/misc.c Fri Apr 6 21:37:25 2018 (r332154) @@ -185,7 +185,7 @@ hexdump(caddr_t region, size_t len) for (x = 0; x < 16; x++) { if ((line + x) < (region + len)) { - emit("%02x ", *(u_int8_t *)(line + x)); + emit("%02x ", *(uint8_t *)(line + x)); } else { emit("-- "); } @@ -195,7 +195,7 @@ hexdump(caddr_t region, size_t len) emit(" |"); for (x = 0; x < 16; x++) { if ((line + x) < (region + len)) { - c = *(u_int8_t *)(line + x); + c = *(uint8_t *)(line + x); if ((c < ' ') || (c > '~')) /* !isprint(c) */ c = '.'; emit("%c", c); Modified: stable/11/stand/common/pnp.c ============================================================================== --- stable/11/stand/common/pnp.c Fri Apr 6 20:56:06 2018 (r332153) +++ stable/11/stand/common/pnp.c Fri Apr 6 21:37:25 2018 (r332154) @@ -169,7 +169,7 @@ pnp_addinfo(struct pnpinfo *pi) * where 'AAA' is the EISA vendor ID, II is the product ID and RR the revision ID. */ char * -pnp_eisaformat(u_int8_t *data) +pnp_eisaformat(uint8_t *data) { static char idbuf[8]; const char hextoascii[] = "0123456789abcdef"; Modified: stable/11/stand/efi/boot1/boot1.c ============================================================================== --- stable/11/stand/efi/boot1/boot1.c Fri Apr 6 20:56:06 2018 (r332153) +++ stable/11/stand/efi/boot1/boot1.c Fri Apr 6 21:37:25 2018 (r332154) @@ -54,8 +54,6 @@ static EFI_GUID BlockIoProtocolGUID = BLOCK_IO_PROTOCO static EFI_GUID DevicePathGUID = DEVICE_PATH_PROTOCOL; static EFI_GUID LoadedImageGUID = LOADED_IMAGE_PROTOCOL; static EFI_GUID ConsoleControlGUID = EFI_CONSOLE_CONTROL_PROTOCOL_GUID; -static EFI_GUID FreeBSDBootVarGUID = FREEBSD_BOOT_VAR_GUID; -static EFI_GUID GlobalBootVarGUID = UEFI_BOOT_VAR_GUID; /* * Provide Malloc / Free backed by EFIs AllocatePool / FreePool which ensures @@ -80,42 +78,6 @@ Free(void *buf, const char *file __unused, int line __ (void)BS->FreePool(buf); } -static EFI_STATUS -efi_getenv(EFI_GUID *g, const char *v, void *data, size_t *len) -{ - size_t ul; - CHAR16 *uv; - UINT32 attr; - UINTN dl; - EFI_STATUS rv; - - uv = NULL; - if (utf8_to_ucs2(v, &uv, &ul) != 0) - return (EFI_OUT_OF_RESOURCES); - dl = *len; - rv = RS->GetVariable(uv, g, &attr, &dl, data); - if (rv == EFI_SUCCESS) - *len = dl; - free(uv); - return (rv); -} - -static EFI_STATUS -efi_setenv_freebsd_wcs(const char *varname, CHAR16 *valstr) -{ - CHAR16 *var = NULL; - size_t len; - EFI_STATUS rv; - - if (utf8_to_ucs2(varname, &var, &len) != 0) - return (EFI_OUT_OF_RESOURCES); - rv = RS->SetVariable(var, &FreeBSDBootVarGUID, - EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, - (ucs2len(valstr) + 1) * sizeof(efi_char), valstr); - free(var); - return (rv); -} - /* * nodes_match returns TRUE if the imgpath isn't NULL and the nodes match, * FALSE otherwise. @@ -505,14 +467,15 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) boot_current = 0; sz = sizeof(boot_current); - efi_getenv(&GlobalBootVarGUID, "BootCurrent", &boot_current, &sz); + efi_global_getenv("BootCurrent", &boot_current, &sz); printf(" BootCurrent: %04x\n", boot_current); sz = sizeof(boot_order); - efi_getenv(&GlobalBootVarGUID, "BootOrder", &boot_order, &sz); + efi_global_getenv("BootOrder", &boot_order, &sz); printf(" BootOrder:"); for (i = 0; i < sz / sizeof(boot_order[0]); i++) - printf(" %04x", boot_order[i]); + printf(" %04x%s", boot_order[i], + boot_order[i] == boot_current ? "[*]" : ""); printf("\n"); #ifdef TEST_FAILURE Modified: stable/11/stand/efi/boot1/ufs_module.c ============================================================================== --- stable/11/stand/efi/boot1/ufs_module.c Fri Apr 6 20:56:06 2018 (r332153) +++ stable/11/stand/efi/boot1/ufs_module.c Fri Apr 6 21:37:25 2018 (r332154) @@ -44,7 +44,7 @@ static dev_info_t *devinfo; static dev_info_t *devices; static int -dskread(void *buf, u_int64_t lba, int nblk) +dskread(void *buf, uint64_t lba, int nblk) { int size; EFI_STATUS status; Modified: stable/11/stand/efi/include/efilib.h ============================================================================== --- stable/11/stand/efi/include/efilib.h Fri Apr 6 20:56:06 2018 (r332153) +++ stable/11/stand/efi/include/efilib.h Fri Apr 6 21:37:25 2018 (r332154) @@ -106,6 +106,17 @@ int wcscmp(CHAR16 *, CHAR16 *); void cpy8to16(const char *, CHAR16 *, size_t); void cpy16to8(const CHAR16 *, char *, size_t); +/* + * Routines for interacting with EFI's env vars in a more unix-like + * way than the standard APIs. In addition, convenience routines for + * the loader setting / getting FreeBSD specific variables. + */ + +EFI_STATUS efi_freebsd_getenv(const char *v, void *data, __size_t *len); +EFI_STATUS efi_getenv(EFI_GUID *g, const char *v, void *data, __size_t *len); +EFI_STATUS efi_global_getenv(const char *v, void *data, __size_t *len); +EFI_STATUS efi_setenv_freebsd_wcs(const char *varname, CHAR16 *valstr); + /* efipart.c */ int efipart_inithandles(void); Modified: stable/11/stand/efi/libefi/Makefile ============================================================================== --- stable/11/stand/efi/libefi/Makefile Fri Apr 6 20:56:06 2018 (r332153) +++ stable/11/stand/efi/libefi/Makefile Fri Apr 6 21:37:25 2018 (r332154) @@ -5,8 +5,21 @@ LIB= efi WARNS?= 2 -SRCS= delay.c devpath.c efi_console.c efichar.c efinet.c efipart.c env.c errno.c \ - handles.c wchar.c libefi.c efi_driver_utils.c efizfs.c devicename.c +SRCS= delay.c \ + devicename.c \ + devpath.c \ + efi_console.c \ + efi_driver_utils.c \ + efichar.c \ + efienv.c \ + efinet.c \ + efipart.c \ + efizfs.c \ + env.c \ + errno.c \ + handles.c \ + libefi.c \ + wchar.c .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" SRCS+= time.c Modified: stable/11/stand/efi/libefi/devicename.c ============================================================================== --- stable/11/stand/efi/libefi/devicename.c Fri Apr 6 20:56:06 2018 (r332153) +++ stable/11/stand/efi/libefi/devicename.c Fri Apr 6 21:37:25 2018 (r332154) @@ -161,7 +161,6 @@ efi_parsedev(struct devdesc **dev, const char *devspec } idev->d_dev = dv; - idev->d_type = dv->dv_type; if (dev != NULL) *dev = idev; @@ -180,7 +179,7 @@ efi_fmtdev(void *vdev) struct devdesc *dev = (struct devdesc *)vdev; static char buf[SPECNAMELEN + 1]; - switch(dev->d_type) { + switch(dev->d_dev->dv_type) { case DEVT_NONE: strcpy(buf, "(no device)"); break; Copied: stable/11/stand/efi/libefi/efienv.c (from r330815, head/stand/efi/libefi/efienv.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/stand/efi/libefi/efienv.c Fri Apr 6 21:37:25 2018 (r332154, copy of r330815, head/stand/efi/libefi/efienv.c) @@ -0,0 +1,87 @@ +/*- + * Copyright (c) 2018 Netflix, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +static EFI_GUID FreeBSDBootVarGUID = FREEBSD_BOOT_VAR_GUID; +static EFI_GUID GlobalBootVarGUID = UEFI_BOOT_VAR_GUID; + +EFI_STATUS +efi_getenv(EFI_GUID *g, const char *v, void *data, size_t *len) +{ + size_t ul; + CHAR16 *uv; + UINT32 attr; + UINTN dl; + EFI_STATUS rv; + + uv = NULL; + if (utf8_to_ucs2(v, &uv, &ul) != 0) + return (EFI_OUT_OF_RESOURCES); + dl = *len; + rv = RS->GetVariable(uv, g, &attr, &dl, data); + if (rv == EFI_SUCCESS) + *len = dl; + free(uv); + return (rv); +} + +EFI_STATUS +efi_global_getenv(const char *v, void *data, size_t *len) +{ + + return (efi_getenv(&GlobalBootVarGUID, v, data, len)); +} + +EFI_STATUS +efi_freebsd_getenv(const char *v, void *data, size_t *len) +{ + + return (efi_getenv(&FreeBSDBootVarGUID, v, data, len)); +} + +EFI_STATUS +efi_setenv_freebsd_wcs(const char *varname, CHAR16 *valstr) +{ + CHAR16 *var = NULL; + size_t len; + EFI_STATUS rv; + + if (utf8_to_ucs2(varname, &var, &len) != 0) + return (EFI_OUT_OF_RESOURCES); + rv = RS->SetVariable(var, &FreeBSDBootVarGUID, + EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, + (ucs2len(valstr) + 1) * sizeof(efi_char), valstr); + free(var); + return (rv); +} + Modified: stable/11/stand/efi/libefi/efipart.c ============================================================================== --- stable/11/stand/efi/libefi/efipart.c Fri Apr 6 20:56:06 2018 (r332153) +++ stable/11/stand/efi/libefi/efipart.c Fri Apr 6 21:37:25 2018 (r332154) @@ -744,11 +744,10 @@ efipart_print_common(struct devsw *dev, pdinfo_list_t continue; pd->pd_blkio = blkio; - pd_dev.d_dev = dev; - pd_dev.d_unit = pd->pd_unit; + pd_dev.dd.d_dev = dev; + pd_dev.dd.d_unit = pd->pd_unit; pd_dev.d_slice = -1; pd_dev.d_partition = -1; - pd_dev.d_opendata = blkio; ret = disk_open(&pd_dev, blkio->Media->BlockSize * (blkio->Media->LastBlock + 1), blkio->Media->BlockSize); @@ -821,7 +820,7 @@ efipart_open(struct open_file *f, ...) if (pd->pd_bcache == NULL) pd->pd_bcache = bcache_allocate(); - if (dev->d_dev->dv_type == DEVT_DISK) { + if (dev->dd.d_dev->dv_type == DEVT_DISK) { int rc; rc = disk_open(dev, @@ -860,7 +859,7 @@ efipart_close(struct open_file *f) bcache_free(pd->pd_bcache); pd->pd_bcache = NULL; } - if (dev->d_dev->dv_type == DEVT_DISK) + if (dev->dd.d_dev->dv_type == DEVT_DISK) return (disk_close(dev)); return (0); } @@ -880,7 +879,7 @@ efipart_ioctl(struct open_file *f, u_long cmd, void *d if (pd == NULL) return (EINVAL); - if (dev->d_dev->dv_type == DEVT_DISK) { + if (dev->dd.d_dev->dv_type == DEVT_DISK) { rc = disk_ioctl(dev, cmd, data); if (rc != ENOTTY) return (rc); @@ -967,7 +966,7 @@ efipart_strategy(void *devdata, int rw, daddr_t blk, s bcd.dv_devdata = devdata; bcd.dv_cache = pd->pd_bcache; - if (dev->d_dev->dv_type == DEVT_DISK) { + if (dev->dd.d_dev->dv_type == DEVT_DISK) { daddr_t offset; offset = dev->d_offset * pd->pd_blkio->Media->BlockSize; @@ -1011,7 +1010,7 @@ efipart_realstrategy(void *devdata, int rw, daddr_t bl * partition. */ disk_blocks = 0; - if (dev->d_dev->dv_type == DEVT_DISK) { + if (dev->dd.d_dev->dv_type == DEVT_DISK) { if (disk_ioctl(dev, DIOCGMEDIASIZE, &disk_blocks) == 0) { /* DIOCGMEDIASIZE does return bytes. */ disk_blocks /= blkio->Media->BlockSize; Modified: stable/11/stand/efi/libefi/efizfs.c ============================================================================== --- stable/11/stand/efi/libefi/efizfs.c Fri Apr 6 20:56:06 2018 (r332153) +++ stable/11/stand/efi/libefi/efizfs.c Fri Apr 6 21:37:25 2018 (r332154) @@ -29,8 +29,7 @@ __FBSDID("$FreeBSD$"); #include -#include -#include +#include #ifdef EFI_ZFS_BOOT #include Modified: stable/11/stand/efi/libefi/env.c ============================================================================== --- stable/11/stand/efi/libefi/env.c Fri Apr 6 20:56:06 2018 (r332153) +++ stable/11/stand/efi/libefi/env.c Fri Apr 6 21:37:25 2018 (r332154) @@ -35,35 +35,6 @@ __FBSDID("$FreeBSD$"); #include #include "bootstrap.h" -/* - * Simple wrappers to the underlying UEFI functions. - * See http://wiki.phoenix.com/wiki/index.php/EFI_RUNTIME_SERVICES - * for details. - */ -EFI_STATUS -efi_get_next_variable_name(UINTN *variable_name_size, CHAR16 *variable_name, - EFI_GUID *vendor_guid) -{ - return (RS->GetNextVariableName(variable_name_size, variable_name, - vendor_guid)); -} - -EFI_STATUS -efi_get_variable(CHAR16 *variable_name, EFI_GUID *vendor_guid, - UINT32 *attributes, UINTN *data_size, void *data) -{ - return (RS->GetVariable(variable_name, vendor_guid, attributes, - data_size, data)); -} - -EFI_STATUS -efi_set_variable(CHAR16 *variable_name, EFI_GUID *vendor_guid, - UINT32 attributes, UINTN data_size, void *data) -{ - return (RS->SetVariable(variable_name, vendor_guid, attributes, - data_size, data)); -} - void efi_init_environment(void) { Modified: stable/11/stand/efi/loader/arch/arm/exec.c ============================================================================== --- stable/11/stand/efi/loader/arch/arm/exec.c Fri Apr 6 20:56:06 2018 (r332153) +++ stable/11/stand/efi/loader/arch/arm/exec.c Fri Apr 6 21:37:25 2018 (r332154) @@ -47,7 +47,7 @@ extern vm_offset_t md_load(char *, vm_offset_t *); extern int bi_load(char *, vm_offset_t *, vm_offset_t *); static int -__elfN(arm_load)(char *filename, u_int64_t dest, +__elfN(arm_load)(char *filename, uint64_t dest, struct preloaded_file **result) { int r; Modified: stable/11/stand/efi/loader/main.c ============================================================================== --- stable/11/stand/efi/loader/main.c Fri Apr 6 20:56:06 2018 (r332153) +++ stable/11/stand/efi/loader/main.c Fri Apr 6 21:37:25 2018 (r332154) @@ -175,9 +175,7 @@ set_devdesc_currdev(struct devsw *dev, int unit) char *devname; currdev.d_dev = dev; - currdev.d_type = currdev.d_dev->dv_type; currdev.d_unit = unit; - currdev.d_opendata = NULL; devname = efi_fmtdev(&currdev); env_setenv("currdev", EV_VOLATILE, devname, efi_setcurrdev, @@ -202,10 +200,8 @@ find_currdev(EFI_LOADED_IMAGE *img) if (pool_guid != 0) { struct zfs_devdesc currdev; - currdev.d_dev = &zfs_dev; - currdev.d_unit = 0; - currdev.d_type = currdev.d_dev->dv_type; - currdev.d_opendata = NULL; + currdev.dd.d_dev = &zfs_dev; + currdev.dd.d_unit = 0; currdev.pool_guid = pool_guid; currdev.root_guid = 0; devname = efi_fmtdev(&currdev); @@ -224,10 +220,8 @@ find_currdev(EFI_LOADED_IMAGE *img) STAILQ_FOREACH(dp, pdi_list, pd_link) { struct disk_devdesc currdev; - currdev.d_dev = &efipart_hddev; - currdev.d_type = currdev.d_dev->dv_type; - currdev.d_unit = dp->pd_unit; - currdev.d_opendata = NULL; + currdev.dd.d_dev = &efipart_hddev; + currdev.dd.d_unit = dp->pd_unit; currdev.d_slice = -1; currdev.d_partition = -1; @@ -318,6 +312,12 @@ main(int argc, CHAR16 *argv[]) int i, j, vargood, howto; UINTN k; int has_kbd; + CHAR16 *text; + UINT16 boot_current; + size_t sz; + UINT16 boot_order[100]; + EFI_DEVICE_PATH *imgpath; + EFI_STATUS status; #if !defined(__arm__) char buf[40]; #endif @@ -479,6 +479,36 @@ main(int argc, CHAR16 *argv[]) printf("\n%s", bootprog_info); + text = efi_devpath_name(img->FilePath); + if (text != NULL) { + printf(" Load Path: %S\n", text); + efi_setenv_freebsd_wcs("LoaderPath", text); + efi_free_devpath_name(text); + } + + status = BS->HandleProtocol(img->DeviceHandle, &devid, (void **)&imgpath); + if (status == EFI_SUCCESS) { + text = efi_devpath_name(imgpath); + if (text != NULL) { + printf(" Load Device: %S\n", text); + efi_setenv_freebsd_wcs("LoaderDev", text); + efi_free_devpath_name(text); + } + } + + boot_current = 0; + sz = sizeof(boot_current); + efi_global_getenv("BootCurrent", &boot_current, &sz); + printf(" BootCurrent: %04x\n", boot_current); + + sz = sizeof(boot_order); + efi_global_getenv("BootOrder", &boot_order, &sz); + printf(" BootOrder:"); + for (i = 0; i < sz / sizeof(boot_order[0]); i++) + printf(" %04x%s", boot_order[i], + boot_order[i] == boot_current ? "[*]" : ""); + printf("\n"); + /* * Disable the watchdog timer. By default the boot manager sets * the timer to 5 minutes before invoking a boot option. If we @@ -848,7 +878,7 @@ command_chain(int argc, char *argv[]) struct disk_devdesc *d_dev; pdinfo_t *hd, *pd; - switch (dev->d_type) { + switch (dev->d_dev->dv_type) { #ifdef EFI_ZFS_BOOT case DEVT_ZFS: z_dev = (struct zfs_devdesc *)dev; Modified: stable/11/stand/ficl/aarch64/sysdep.c ============================================================================== --- stable/11/stand/ficl/aarch64/sysdep.c Fri Apr 6 20:56:06 2018 (r332153) +++ stable/11/stand/ficl/aarch64/sysdep.c Fri Apr 6 21:37:25 2018 (r332154) @@ -25,12 +25,12 @@ DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y) { DPUNS q; - u_int64_t qx; + uint64_t qx; - qx = (u_int64_t)x * (u_int64_t) y; + qx = (uint64_t)x * (uint64_t) y; - q.hi = (u_int32_t)( qx >> 32 ); - q.lo = (u_int32_t)( qx & 0xFFFFFFFFL); + q.hi = (uint32_t)( qx >> 32 ); + q.lo = (uint32_t)( qx & 0xFFFFFFFFL); return q; } @@ -38,7 +38,7 @@ DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y) UNSQR ficlLongDiv(DPUNS q, FICL_UNS y) { UNSQR result; - u_int64_t qx, qh; + uint64_t qx, qh; qh = q.hi; qx = (qh << 32) | q.lo; Modified: stable/11/stand/ficl/amd64/sysdep.c ============================================================================== --- stable/11/stand/ficl/amd64/sysdep.c Fri Apr 6 20:56:06 2018 (r332153) +++ stable/11/stand/ficl/amd64/sysdep.c Fri Apr 6 21:37:25 2018 (r332154) @@ -25,12 +25,12 @@ DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y) { DPUNS q; - u_int64_t qx; + uint64_t qx; - qx = (u_int64_t)x * (u_int64_t) y; + qx = (uint64_t)x * (uint64_t) y; - q.hi = (u_int32_t)( qx >> 32 ); - q.lo = (u_int32_t)( qx & 0xFFFFFFFFL); + q.hi = (uint32_t)( qx >> 32 ); + q.lo = (uint32_t)( qx & 0xFFFFFFFFL); return q; } @@ -38,7 +38,7 @@ DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y) UNSQR ficlLongDiv(DPUNS q, FICL_UNS y) { UNSQR result; - u_int64_t qx, qh; + uint64_t qx, qh; qh = q.hi; qx = (qh << 32) | q.lo; Modified: stable/11/stand/ficl/arm/sysdep.c ============================================================================== --- stable/11/stand/ficl/arm/sysdep.c Fri Apr 6 20:56:06 2018 (r332153) +++ stable/11/stand/ficl/arm/sysdep.c Fri Apr 6 21:37:25 2018 (r332154) @@ -25,12 +25,12 @@ DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y) { DPUNS q; - u_int64_t qx; + uint64_t qx; - qx = (u_int64_t)x * (u_int64_t) y; + qx = (uint64_t)x * (uint64_t) y; - q.hi = (u_int32_t)( qx >> 32 ); - q.lo = (u_int32_t)( qx & 0xFFFFFFFFL); + q.hi = (uint32_t)( qx >> 32 ); + q.lo = (uint32_t)( qx & 0xFFFFFFFFL); return q; } @@ -38,7 +38,7 @@ DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y) UNSQR ficlLongDiv(DPUNS q, FICL_UNS y) { UNSQR result; - u_int64_t qx, qh; + uint64_t qx, qh; qh = q.hi; qx = (qh << 32) | q.lo; Modified: stable/11/stand/ficl/i386/sysdep.c ============================================================================== --- stable/11/stand/ficl/i386/sysdep.c Fri Apr 6 20:56:06 2018 (r332153) +++ stable/11/stand/ficl/i386/sysdep.c Fri Apr 6 21:37:25 2018 (r332154) @@ -28,12 +28,12 @@ DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y) { DPUNS q; - u_int64_t qx; + uint64_t qx; - qx = (u_int64_t)x * (u_int64_t) y; + qx = (uint64_t)x * (uint64_t) y; - q.hi = (u_int32_t)( qx >> 32 ); - q.lo = (u_int32_t)( qx & 0xFFFFFFFFL); + q.hi = (uint32_t)( qx >> 32 ); + q.lo = (uint32_t)( qx & 0xFFFFFFFFL); return q; } @@ -41,7 +41,7 @@ DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y) UNSQR ficlLongDiv(DPUNS q, FICL_UNS y) { UNSQR result; - u_int64_t qx, qh; + uint64_t qx, qh; qh = q.hi; qx = (qh << 32) | q.lo; @@ -89,7 +89,7 @@ void ficlOutb(FICL_VM *pVM) { u_char c; - u_int32_t port; + uint32_t port; port=stackPopUNS(pVM->pStack); c=(u_char)stackPopINT(pVM->pStack); @@ -104,7 +104,7 @@ void ficlInb(FICL_VM *pVM) { u_char c; - u_int32_t port; + uint32_t port; port=stackPopUNS(pVM->pStack); c=inb(port); Modified: stable/11/stand/ficl/mips/sysdep.c ============================================================================== --- stable/11/stand/ficl/mips/sysdep.c Fri Apr 6 20:56:06 2018 (r332153) +++ stable/11/stand/ficl/mips/sysdep.c Fri Apr 6 21:37:25 2018 (r332154) @@ -25,12 +25,12 @@ DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y) { DPUNS q; - u_int64_t qx; + uint64_t qx; - qx = (u_int64_t)x * (u_int64_t) y; + qx = (uint64_t)x * (uint64_t) y; - q.hi = (u_int32_t)( qx >> 32 ); - q.lo = (u_int32_t)( qx & 0xFFFFFFFFL); + q.hi = (uint32_t)( qx >> 32 ); + q.lo = (uint32_t)( qx & 0xFFFFFFFFL); return q; } @@ -38,7 +38,7 @@ DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y) UNSQR ficlLongDiv(DPUNS q, FICL_UNS y) { UNSQR result; - u_int64_t qx, qh; + uint64_t qx, qh; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Fri Apr 6 21:40:24 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B4DBF88C9B; Fri, 6 Apr 2018 21:40:24 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CF9477AD6; Fri, 6 Apr 2018 21:40:24 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 43248177B5; Fri, 6 Apr 2018 21:40:24 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w36LeOuK094497; Fri, 6 Apr 2018 21:40:24 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w36LeOpa094496; Fri, 6 Apr 2018 21:40:24 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804062140.w36LeOpa094496@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 6 Apr 2018 21:40:24 +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: r332155 - stable/11/stand/common X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/stand/common X-SVN-Commit-Revision: 332155 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 21:40:24 -0000 Author: kevans Date: Fri Apr 6 21:40:23 2018 New Revision: 332155 URL: https://svnweb.freebsd.org/changeset/base/332155 Log: MFC r331331: Apply r228478 (CTASSERT => _Static_assert()) to bootstrap.h Modified: stable/11/stand/common/bootstrap.h Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/common/bootstrap.h ============================================================================== --- stable/11/stand/common/bootstrap.h Fri Apr 6 21:37:25 2018 (r332154) +++ stable/11/stand/common/bootstrap.h Fri Apr 6 21:40:23 2018 (r332155) @@ -330,10 +330,8 @@ void dev_cleanup(void); time_t time(time_t *tloc); -#ifndef CTASSERT /* Allow lint to override */ -#define CTASSERT(x) _CTASSERT(x, __LINE__) -#define _CTASSERT(x, y) __CTASSERT(x, y) -#define __CTASSERT(x, y) typedef char __assert ## y[(x) ? 1 : -1] +#ifndef CTASSERT +#define CTASSERT(x) _Static_assert(x, "compile-time assertion failed") #endif #endif /* !_BOOTSTRAP_H_ */ From owner-svn-src-stable-11@freebsd.org Fri Apr 6 21:50:11 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 86A49F89699; Fri, 6 Apr 2018 21:50:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 35460780BE; Fri, 6 Apr 2018 21:50:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2C3521794B; Fri, 6 Apr 2018 21:50:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w36LoBQ6099584; Fri, 6 Apr 2018 21:50:11 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w36LoAB8099575; Fri, 6 Apr 2018 21:50:10 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804062150.w36LoAB8099575@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 6 Apr 2018 21:50: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: r332156 - in stable/11: stand/efi/boot1 stand/efi/include stand/efi/libefi stand/i386/libfirewire sys/dev/firewire X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/11: stand/efi/boot1 stand/efi/include stand/efi/libefi stand/i386/libfirewire sys/dev/firewire X-SVN-Commit-Revision: 332156 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 21:50:11 -0000 Author: kevans Date: Fri Apr 6 21:50:09 2018 New Revision: 332156 URL: https://svnweb.freebsd.org/changeset/base/332156 Log: MFC r330970, r331067, r331767, r331852, r331858 r330970: libefi: UEFI_BOOT_VAR_GUID duplicates EFI_GLOBAL_VARIABLE Drop UEFI_BOOT_VAR_GUID and use EFI_GLOBAL_VARIABLE. r331067: Only print boot order / boot current if we can get the variables from the loader. Some UEFI implementations don't return all of them. Sponsored by: Netflix r331767: efinet: Do not return only if ReceiveFilter fails If the network interface or the uefi implementation do not support the ReceiveFilter interface do not return only and just print a message. U-Boot doesn't support is and likely never will. Also even if this fails it doesn't mean that network in EFI isn't supported. r331852: fwohcireg.h is 99% the same between the boot loader and the kernel. Delete it and fix up the 1% difference because there's no need for them to be different. r331858: The Uninorth ID was really for Uninorth 2. Deleted: stable/11/stand/i386/libfirewire/fwohcireg.h Modified: stable/11/stand/efi/boot1/boot1.c stable/11/stand/efi/include/efi.h stable/11/stand/efi/libefi/efienv.c stable/11/stand/efi/libefi/efinet.c stable/11/stand/i386/libfirewire/firewire.c stable/11/stand/i386/libfirewire/fwohci.c stable/11/stand/i386/libfirewire/fwohci.h stable/11/sys/dev/firewire/fwohci_pci.c stable/11/sys/dev/firewire/fwohcireg.h Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/efi/boot1/boot1.c ============================================================================== --- stable/11/stand/efi/boot1/boot1.c Fri Apr 6 21:40:23 2018 (r332155) +++ stable/11/stand/efi/boot1/boot1.c Fri Apr 6 21:50:09 2018 (r332156) @@ -467,16 +467,18 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) boot_current = 0; sz = sizeof(boot_current); - efi_global_getenv("BootCurrent", &boot_current, &sz); - printf(" BootCurrent: %04x\n", boot_current); + if (efi_global_getenv("BootCurrent", &boot_current, &sz) == EFI_SUCCESS) { + printf(" BootCurrent: %04x\n", boot_current); - sz = sizeof(boot_order); - efi_global_getenv("BootOrder", &boot_order, &sz); - printf(" BootOrder:"); - for (i = 0; i < sz / sizeof(boot_order[0]); i++) - printf(" %04x%s", boot_order[i], - boot_order[i] == boot_current ? "[*]" : ""); - printf("\n"); + sz = sizeof(boot_order); + if (efi_global_getenv("BootOrder", &boot_order, &sz) == EFI_SUCCESS) { + printf(" BootOrder:"); + for (i = 0; i < sz / sizeof(boot_order[0]); i++) + printf(" %04x%s", boot_order[i], + boot_order[i] == boot_current ? "[*]" : ""); + printf("\n"); + } + } #ifdef TEST_FAILURE /* Modified: stable/11/stand/efi/include/efi.h ============================================================================== --- stable/11/stand/efi/include/efi.h Fri Apr 6 21:40:23 2018 (r332155) +++ stable/11/stand/efi/include/efi.h Fri Apr 6 21:50:09 2018 (r332156) @@ -59,7 +59,5 @@ Revision History */ #define FREEBSD_BOOT_VAR_GUID \ { 0xCFEE69AD, 0xA0DE, 0x47A9, {0x93, 0xA8, 0xF6, 0x31, 0x06, 0xF8, 0xAE, 0x99} } -#define UEFI_BOOT_VAR_GUID \ - { 0x8be4df61, 0x93ca, 0x11d2, {0xaa, 0x0d, 0x00, 0xe0, 0x98, 0x03, 0x2b, 0x8c} } #endif Modified: stable/11/stand/efi/libefi/efienv.c ============================================================================== --- stable/11/stand/efi/libefi/efienv.c Fri Apr 6 21:40:23 2018 (r332155) +++ stable/11/stand/efi/libefi/efienv.c Fri Apr 6 21:50:09 2018 (r332156) @@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$"); #include static EFI_GUID FreeBSDBootVarGUID = FREEBSD_BOOT_VAR_GUID; -static EFI_GUID GlobalBootVarGUID = UEFI_BOOT_VAR_GUID; +static EFI_GUID GlobalBootVarGUID = EFI_GLOBAL_VARIABLE; EFI_STATUS efi_getenv(EFI_GUID *g, const char *v, void *data, size_t *len) Modified: stable/11/stand/efi/libefi/efinet.c ============================================================================== --- stable/11/stand/efi/libefi/efinet.c Fri Apr 6 21:40:23 2018 (r332155) +++ stable/11/stand/efi/libefi/efinet.c Fri Apr 6 21:50:09 2018 (r332156) @@ -225,11 +225,9 @@ efinet_init(struct iodesc *desc, void *machdep_hint) EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST; status = net->ReceiveFilters(net, mask, 0, FALSE, 0, NULL); - if (status != EFI_SUCCESS) { + if (status != EFI_SUCCESS) printf("net%d: cannot set rx. filters (status=%lu)\n", nif->nif_unit, EFI_ERROR_CODE(status)); - return; - } #ifdef EFINET_DEBUG dump_mode(net->Mode); Modified: stable/11/stand/i386/libfirewire/firewire.c ============================================================================== --- stable/11/stand/i386/libfirewire/firewire.c Fri Apr 6 21:40:23 2018 (r332155) +++ stable/11/stand/i386/libfirewire/firewire.c Fri Apr 6 21:50:09 2018 (r332156) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "fwohci.h" #include Modified: stable/11/stand/i386/libfirewire/fwohci.c ============================================================================== --- stable/11/stand/i386/libfirewire/fwohci.c Fri Apr 6 21:40:23 2018 (r332155) +++ stable/11/stand/i386/libfirewire/fwohci.c Fri Apr 6 21:50:09 2018 (r332156) @@ -39,8 +39,9 @@ #include #include +#include #include "fwohci.h" -#include "fwohcireg.h" +#include #include static uint32_t fwphy_wrdata ( struct fwohci_softc *, uint32_t, uint32_t); @@ -62,12 +63,6 @@ char *linkspeed[] = { "S100", "S200", "S400", "S800", "S1600", "S3200", "undef", "undef" }; - -#define FW_EUI64_BYTE(eui, x) \ - ((((x)<4)? \ - ((eui)->hi >> (8*(3-(x)))): \ - ((eui)->lo >> (8*(7-(x)))) \ - ) & 0xff) /* * Communication with PHY device Modified: stable/11/stand/i386/libfirewire/fwohci.h ============================================================================== --- stable/11/stand/i386/libfirewire/fwohci.h Fri Apr 6 21:40:23 2018 (r332155) +++ stable/11/stand/i386/libfirewire/fwohci.h Fri Apr 6 21:50:09 2018 (r332156) @@ -37,10 +37,6 @@ #define MAX_OHCI 5 #define CROMSIZE 0x400 -struct fw_eui64 { - uint32_t hi, lo; -}; - struct fwohci_softc { uint32_t locator; uint32_t devid; Modified: stable/11/sys/dev/firewire/fwohci_pci.c ============================================================================== --- stable/11/sys/dev/firewire/fwohci_pci.c Fri Apr 6 21:40:23 2018 (r332155) +++ stable/11/sys/dev/firewire/fwohci_pci.c Fri Apr 6 21:50:09 2018 (r332156) @@ -169,8 +169,8 @@ fwohci_pci_probe(device_t dev) device_set_desc(dev, "Apple Pangea"); return BUS_PROBE_DEFAULT; } - if (id == (FW_VENDORID_APPLE | FW_DEVICE_UNINORTH)) { - device_set_desc(dev, "Apple UniNorth"); + if (id == (FW_VENDORID_APPLE | FW_DEVICE_UNINORTH2)) { + device_set_desc(dev, "Apple UniNorth 2"); return BUS_PROBE_DEFAULT; } if (id == (FW_VENDORID_LUCENT | FW_DEVICE_FW322)) { Modified: stable/11/sys/dev/firewire/fwohcireg.h ============================================================================== --- stable/11/sys/dev/firewire/fwohcireg.h Fri Apr 6 21:40:23 2018 (r332155) +++ stable/11/sys/dev/firewire/fwohcireg.h Fri Apr 6 21:50:09 2018 (r332156) @@ -72,7 +72,7 @@ #define FW_DEVICE_R5C551 (0x0551 << 16) #define FW_DEVICE_R5C552 (0x0552 << 16) #define FW_DEVICE_PANGEA (0x0030 << 16) -#define FW_DEVICE_UNINORTH (0x0031 << 16) +#define FW_DEVICE_UNINORTH2 (0x0031 << 16) #define FW_DEVICE_AIC5800 (0x5800 << 16) #define FW_DEVICE_FW322 (0x5811 << 16) #define FW_DEVICE_7007 (0x7007 << 16) @@ -328,6 +328,7 @@ struct ohci_registers { struct ohci_dma dma_irch[0x20]; }; +#ifndef _STANDALONE struct fwohcidb_tr { STAILQ_ENTRY(fwohcidb_tr) link; struct fw_xfer *xfer; @@ -337,6 +338,7 @@ struct fwohcidb_tr { bus_addr_t bus_addr; int dbcnt; }; +#endif /* * OHCI info structure. From owner-svn-src-stable-11@freebsd.org Fri Apr 6 23:31:49 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4AF43F903F8; Fri, 6 Apr 2018 23:31:49 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AE4697BC94; Fri, 6 Apr 2018 23:31:48 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A938518AD2; Fri, 6 Apr 2018 23:31:48 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w36NVmOl052390; Fri, 6 Apr 2018 23:31:48 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w36NVlVh052383; Fri, 6 Apr 2018 23:31:47 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201804062331.w36NVlVh052383@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 6 Apr 2018 23:31:47 +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: r332159 - in stable/11/sys: net ofed/drivers/infiniband/ulp/ipoib X-SVN-Group: stable-11 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in stable/11/sys: net ofed/drivers/infiniband/ulp/ipoib X-SVN-Commit-Revision: 332159 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2018 23:31:49 -0000 Author: brooks Date: Fri Apr 6 23:31:47 2018 New Revision: 332159 URL: https://svnweb.freebsd.org/changeset/base/332159 Log: MFC r331648: Improve copy-and-pasted versions of SIOCGIFADDR. The original implementation used a reference to ifr_data and a cast to do the equivalent of accessing ifr_addr. This was copied multiple times since 1996. Approved by: kib Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D14873 Modified: stable/11/sys/net/if_arcsubr.c stable/11/sys/net/if_ethersubr.c stable/11/sys/net/if_fddisubr.c stable/11/sys/net/if_fwsubr.c stable/11/sys/net/if_iso88025subr.c stable/11/sys/net/if_vlan.c stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/if_arcsubr.c ============================================================================== --- stable/11/sys/net/if_arcsubr.c Fri Apr 6 23:25:54 2018 (r332158) +++ stable/11/sys/net/if_arcsubr.c Fri Apr 6 23:31:47 2018 (r332159) @@ -679,12 +679,7 @@ arc_ioctl(struct ifnet *ifp, u_long command, caddr_t d break; case SIOCGIFADDR: - { - struct sockaddr *sa; - - sa = (struct sockaddr *) &ifr->ifr_data; - *(u_int8_t *)sa->sa_data = ARC_LLADDR(ifp); - } + ifr->ifr_addr.sa_data[0] = ARC_LLADDR(ifp); break; case SIOCADDMULTI: Modified: stable/11/sys/net/if_ethersubr.c ============================================================================== --- stable/11/sys/net/if_ethersubr.c Fri Apr 6 23:25:54 2018 (r332158) +++ stable/11/sys/net/if_ethersubr.c Fri Apr 6 23:31:47 2018 (r332159) @@ -1084,13 +1084,8 @@ ether_ioctl(struct ifnet *ifp, u_long command, caddr_t break; case SIOCGIFADDR: - { - struct sockaddr *sa; - - sa = (struct sockaddr *) & ifr->ifr_data; - bcopy(IF_LLADDR(ifp), - (caddr_t) sa->sa_data, ETHER_ADDR_LEN); - } + bcopy(IF_LLADDR(ifp), &ifr->ifr_addr.sa_data[0], + ETHER_ADDR_LEN); break; case SIOCSIFMTU: Modified: stable/11/sys/net/if_fddisubr.c ============================================================================== --- stable/11/sys/net/if_fddisubr.c Fri Apr 6 23:25:54 2018 (r332158) +++ stable/11/sys/net/if_fddisubr.c Fri Apr 6 23:31:47 2018 (r332159) @@ -556,14 +556,9 @@ fddi_ioctl (ifp, command, data) break; } break; - case SIOCGIFADDR: { - struct sockaddr *sa; - - sa = (struct sockaddr *) & ifr->ifr_data; - bcopy(IF_LLADDR(ifp), - (caddr_t) sa->sa_data, FDDI_ADDR_LEN); - - } + case SIOCGIFADDR: + bcopy(IF_LLADDR(ifp), &ifr->ifr_addr.sa_data[0], + FDDI_ADDR_LEN); break; case SIOCSIFMTU: /* Modified: stable/11/sys/net/if_fwsubr.c ============================================================================== --- stable/11/sys/net/if_fwsubr.c Fri Apr 6 23:25:54 2018 (r332158) +++ stable/11/sys/net/if_fwsubr.c Fri Apr 6 23:31:47 2018 (r332159) @@ -660,13 +660,8 @@ firewire_ioctl(struct ifnet *ifp, u_long command, cadd break; case SIOCGIFADDR: - { - struct sockaddr *sa; - - sa = (struct sockaddr *) & ifr->ifr_data; - bcopy(&IFP2FWC(ifp)->fc_hwaddr, - (caddr_t) sa->sa_data, sizeof(struct fw_hwaddr)); - } + bcopy(&IFP2FWC(ifp)->fc_hwaddr, &ifr->ifr_addr.sa_data[0], + sizeof(struct fw_hwaddr)); break; case SIOCSIFMTU: Modified: stable/11/sys/net/if_iso88025subr.c ============================================================================== --- stable/11/sys/net/if_iso88025subr.c Fri Apr 6 23:25:54 2018 (r332158) +++ stable/11/sys/net/if_iso88025subr.c Fri Apr 6 23:31:47 2018 (r332159) @@ -171,13 +171,9 @@ iso88025_ioctl(struct ifnet *ifp, u_long command, cadd } break; - case SIOCGIFADDR: { - struct sockaddr *sa; - - sa = (struct sockaddr *) & ifr->ifr_data; - bcopy(IF_LLADDR(ifp), - (caddr_t) sa->sa_data, ISO88025_ADDR_LEN); - } + case SIOCGIFADDR: + bcopy(IF_LLADDR(ifp), &ifr->ifr_addr.sa_data[0], + ISO88025_ADDR_LEN); break; case SIOCSIFMTU: Modified: stable/11/sys/net/if_vlan.c ============================================================================== --- stable/11/sys/net/if_vlan.c Fri Apr 6 23:25:54 2018 (r332158) +++ stable/11/sys/net/if_vlan.c Fri Apr 6 23:31:47 2018 (r332159) @@ -1842,12 +1842,8 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data #endif break; case SIOCGIFADDR: - { - struct sockaddr *sa; - - sa = (struct sockaddr *)&ifr->ifr_data; - bcopy(IF_LLADDR(ifp), sa->sa_data, ifp->if_addrlen); - } + bcopy(IF_LLADDR(ifp), &ifr->ifr_addr.sa_data[0], + ifp->if_addrlen); break; case SIOCGIFMEDIA: VLAN_SLOCK(); Modified: stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Fri Apr 6 23:25:54 2018 (r332158) +++ stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Fri Apr 6 23:31:47 2018 (r332159) @@ -318,13 +318,8 @@ ipoib_ioctl(struct ifnet *ifp, u_long command, caddr_t break; case SIOCGIFADDR: - { - struct sockaddr *sa; - - sa = (struct sockaddr *) & ifr->ifr_data; - bcopy(IF_LLADDR(ifp), - (caddr_t) sa->sa_data, INFINIBAND_ALEN); - } + bcopy(IF_LLADDR(ifp), &ifr->ifr_addr.sa_data[0], + INFINIBAND_ALEN); break; case SIOCSIFMTU: From owner-svn-src-stable-11@freebsd.org Sat Apr 7 00:23:50 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33A75F93CE4; Sat, 7 Apr 2018 00:23:50 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D860E7DDFF; Sat, 7 Apr 2018 00:23:49 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D319F19334; Sat, 7 Apr 2018 00:23:49 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w370NnhJ079398; Sat, 7 Apr 2018 00:23:49 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w370Nn4J079397; Sat, 7 Apr 2018 00:23:49 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201804070023.w370Nn4J079397@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Sat, 7 Apr 2018 00:23:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332161 - stable/11/sys/dev/sbni X-SVN-Group: stable-11 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/11/sys/dev/sbni X-SVN-Commit-Revision: 332161 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 00:23:50 -0000 Author: brooks Date: Sat Apr 7 00:23:49 2018 New Revision: 332161 URL: https://svnweb.freebsd.org/changeset/base/332161 Log: MFC r331651-r331653 r331651: Copy flags over ifr_union directly rather than via casts through ifr_data. No functional change in practice. If the sbni driver supported 64-bit big-endian system, this would be an ABI changes, but it is i386-only. The old version leaked a word of stack on 64-bit systems. This eliminates the only assignment to ifr_data. r331652: Revert r331651 to recommit with proper commit metadata. r331653: Copy flags over ifr_union directly rather than via casts through ifr_data. No functional change in practice. If the sbni driver supported 64-bit big-endian system, this would be an ABI changes, but it is i386-only. The old version leaked a word of stack on 64-bit systems. This eliminates the only assignment to ifr_data. Reviewed by: kib Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D14874 Modified: stable/11/sys/dev/sbni/if_sbni.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/sbni/if_sbni.c ============================================================================== --- stable/11/sys/dev/sbni/if_sbni.c Sat Apr 7 00:04:28 2018 (r332160) +++ stable/11/sys/dev/sbni/if_sbni.c Sat Apr 7 00:23:49 2018 (r332161) @@ -1144,7 +1144,7 @@ sbni_ioctl(struct ifnet *ifp, u_long command, caddr_t flags.fixed_rxl = (sc->delta_rxl == 0); flags.fixed_rate = 1; SBNI_UNLOCK(sc); - ifr->ifr_data = *(caddr_t*) &flags; + bcopy(&flags, &ifr->ifr_ifru, sizeof(flags)); break; case SIOCGINSTATS: @@ -1163,7 +1163,7 @@ sbni_ioctl(struct ifnet *ifp, u_long command, caddr_t error = priv_check(td, PRIV_DRIVER); if (error) break; - flags = *(struct sbni_flags*)&ifr->ifr_data; + bcopy(&ifr->ifr_ifru, &flags, sizeof(flags)); SBNI_LOCK(sc); if (flags.fixed_rxl) { sc->delta_rxl = 0; From owner-svn-src-stable-11@freebsd.org Sat Apr 7 02:57:00 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 83FDDF9E5FE; Sat, 7 Apr 2018 02:57:00 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 28F7083DC4; Sat, 7 Apr 2018 02:57:00 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1EE071AE65; Sat, 7 Apr 2018 02:57:00 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w372uxTB055151; Sat, 7 Apr 2018 02:56:59 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w372uxSg055147; Sat, 7 Apr 2018 02:56:59 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804070256.w372uxSg055147@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 7 Apr 2018 02:56:59 +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: r332162 - stable/11/tools/build/options X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/tools/build/options X-SVN-Commit-Revision: 332162 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 02:57:00 -0000 Author: kevans Date: Sat Apr 7 02:56:59 2018 New Revision: 332162 URL: https://svnweb.freebsd.org/changeset/base/332162 Log: MFC r330116, r330118, r330251, r330254 r330116: Some missing LOADER_EFI build option descriptions r330118: Add missing punctuation to *_LOADER_EFI descriptions... r330251: Remove LOADER_EFI description files LOADER_EFI functionality got folded into EFI as of r330248. r330254: Add descriptions for recently added loader options Added: stable/11/tools/build/options/WITHOUT_LOADER_OFW - copied unchanged from r330254, head/tools/build/options/WITHOUT_LOADER_OFW stable/11/tools/build/options/WITHOUT_LOADER_UBOOT - copied unchanged from r330254, head/tools/build/options/WITHOUT_LOADER_UBOOT stable/11/tools/build/options/WITH_LOADER_OFW - copied unchanged from r330254, head/tools/build/options/WITH_LOADER_OFW stable/11/tools/build/options/WITH_LOADER_UBOOT - copied unchanged from r330254, head/tools/build/options/WITH_LOADER_UBOOT Modified: Directory Properties: stable/11/ (props changed) Copied: stable/11/tools/build/options/WITHOUT_LOADER_OFW (from r330254, head/tools/build/options/WITHOUT_LOADER_OFW) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/build/options/WITHOUT_LOADER_OFW Sat Apr 7 02:56:59 2018 (r332162, copy of r330254, head/tools/build/options/WITHOUT_LOADER_OFW) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Disable building of openfirmware bootloader components. Copied: stable/11/tools/build/options/WITHOUT_LOADER_UBOOT (from r330254, head/tools/build/options/WITHOUT_LOADER_UBOOT) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/build/options/WITHOUT_LOADER_UBOOT Sat Apr 7 02:56:59 2018 (r332162, copy of r330254, head/tools/build/options/WITHOUT_LOADER_UBOOT) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Disable building of ubldr. Copied: stable/11/tools/build/options/WITH_LOADER_OFW (from r330254, head/tools/build/options/WITH_LOADER_OFW) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/build/options/WITH_LOADER_OFW Sat Apr 7 02:56:59 2018 (r332162, copy of r330254, head/tools/build/options/WITH_LOADER_OFW) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to build openfirmware bootloader components. Copied: stable/11/tools/build/options/WITH_LOADER_UBOOT (from r330254, head/tools/build/options/WITH_LOADER_UBOOT) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/build/options/WITH_LOADER_UBOOT Sat Apr 7 02:56:59 2018 (r332162, copy of r330254, head/tools/build/options/WITH_LOADER_UBOOT) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to build ubldr. From owner-svn-src-stable-11@freebsd.org Sat Apr 7 03:02:07 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A8179F9EBD4; Sat, 7 Apr 2018 03:02:07 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5DCC08494C; Sat, 7 Apr 2018 03:02:07 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 58C301B083; Sat, 7 Apr 2018 03:02:07 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w373272h061474; Sat, 7 Apr 2018 03:02:07 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w373278C061473; Sat, 7 Apr 2018 03:02:07 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804070302.w373278C061473@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 7 Apr 2018 03:02: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: r332163 - stable/11/share/man/man5 X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/share/man/man5 X-SVN-Commit-Revision: 332163 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 03:02:08 -0000 Author: kevans Date: Sat Apr 7 03:02:07 2018 New Revision: 332163 URL: https://svnweb.freebsd.org/changeset/base/332163 Log: Regenerate src.conf(5) after r332162 This is a direct commit to stable/11 Modified: stable/11/share/man/man5/src.conf.5 Modified: stable/11/share/man/man5/src.conf.5 ============================================================================== --- stable/11/share/man/man5/src.conf.5 Sat Apr 7 02:56:59 2018 (r332162) +++ stable/11/share/man/man5/src.conf.5 Sat Apr 7 03:02:07 2018 (r332163) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd March 23, 2018 +.Dd April 6, 2018 .Dt SRC.CONF 5 .Os .Sh NAME @@ -431,18 +431,12 @@ Set to not build CUSE-related programs and libraries. .It Va WITHOUT_CXGBETOOL Set to not build .Xr cxgbetool 8 -.It Va WITHOUT_MLX5TOOL -Set to not build -.Xr mlx5tool 8 .Pp This is a default setting on arm/arm, arm/armeb, arm/armv6, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32 and powerpc/powerpc. .It Va WITH_CXGBETOOL Set to build .Xr cxgbetool 8 -.It Va WITH_MLX5TOOL -Set to build -.Xr mlx5tool 8 .Pp This is a default setting on amd64/amd64, arm64/aarch64, i386/i386, pc98/i386, powerpc/powerpc64 and sparc64/sparc64. @@ -608,7 +602,7 @@ and .Xr efivar 8 . .Pp This is a default setting on -mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, powerpc/powerpc, powerpc/powerpc64 and sparc64/sparc64. +mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, pc98/i386, powerpc/powerpc, powerpc/powerpc64 and sparc64/sparc64. .It Va WITH_EFI Set to build .Xr efivar 3 @@ -616,7 +610,7 @@ and .Xr efivar 8 . .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386 and pc98/i386. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64 and i386/i386. .It Va WITH_EISA Set to build EISA kernel modules. .It Va WITHOUT_ELFCOPY_AS_OBJCOPY @@ -1003,6 +997,29 @@ Enable firewire support in /boot/loader and /boot/zfsl This option is a nop on all other platforms. .It Va WITHOUT_LOADER_GELI Disable inclusion of GELI crypto support in the boot chain binaries. +.Pp +This is a default setting on +arm/arm, arm/armeb, arm/armv6, arm64/aarch64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, powerpc/powerpc, powerpc/powerpc64 and sparc64/sparc64. +.It Va WITHOUT_LOADER_OFW +Disable building of openfirmware bootloader components. +.Pp +This is a default setting on +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32 and pc98/i386. +.It Va WITH_LOADER_OFW +Set to build openfirmware bootloader components. +.Pp +This is a default setting on +powerpc/powerpc, powerpc/powerpc64 and sparc64/sparc64. +.It Va WITHOUT_LOADER_UBOOT +Disable building of ubldr. +.Pp +This is a default setting on +amd64/amd64, arm64/aarch64, i386/i386, pc98/i386 and sparc64/sparc64. +.It Va WITH_LOADER_UBOOT +Set to build ubldr. +.Pp +This is a default setting on +arm/arm, arm/armeb, arm/armv6, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, powerpc/powerpc and powerpc/powerpc64. .It Va WITHOUT_LOCALES Set to not build localization files; see .Xr locale 1 . @@ -1138,6 +1155,18 @@ This must be set in the environment, make command line .Pa /etc/src-env.conf , not .Pa /etc/src.conf . +.It Va WITHOUT_MLX5TOOL +Set to not build +.Xr mlx5tool 8 +.Pp +This is a default setting on +arm/arm, arm/armeb, arm/armv6, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32 and powerpc/powerpc. +.It Va WITH_MLX5TOOL +Set to build +.Xr mlx5tool 8 +.Pp +This is a default setting on +amd64/amd64, arm64/aarch64, i386/i386, pc98/i386, powerpc/powerpc64 and sparc64/sparc64. .It Va WITH_NAND Set to build the NAND Flash components. .It Va WITHOUT_NDIS From owner-svn-src-stable-11@freebsd.org Sat Apr 7 03:51:20 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10E21F80655; Sat, 7 Apr 2018 03:51:20 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B553870C53; Sat, 7 Apr 2018 03:51:19 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AD09A1B8A8; Sat, 7 Apr 2018 03:51:19 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w373pJ4r083640; Sat, 7 Apr 2018 03:51:19 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w373pJAv083639; Sat, 7 Apr 2018 03:51:19 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804070351.w373pJAv083639@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 7 Apr 2018 03:51:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332164 - stable/11/lib/libcapsicum X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/lib/libcapsicum X-SVN-Commit-Revision: 332164 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 03:51:20 -0000 Author: kevans Date: Sat Apr 7 03:51:19 2018 New Revision: 332164 URL: https://svnweb.freebsd.org/changeset/base/332164 Log: MFC r322324: capsicum_helpers: Add FIODTYPE to default ioctls allowed FIODTYPE will be needed by hexdump(1) to speed up the -s flag on devices that should be able to support fseek(3); specifically, in an attempt to correct for the fact that most tape drives don't support seeking yet don't indicate as such when fseeko(3) is invoked. Modified: stable/11/lib/libcapsicum/capsicum_helpers.h Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libcapsicum/capsicum_helpers.h ============================================================================== --- stable/11/lib/libcapsicum/capsicum_helpers.h Sat Apr 7 03:02:07 2018 (r332163) +++ stable/11/lib/libcapsicum/capsicum_helpers.h Sat Apr 7 03:51:19 2018 (r332164) @@ -31,6 +31,7 @@ #include #include +#include #include #include @@ -47,7 +48,7 @@ static __inline int caph_limit_stream(int fd, int flags) { cap_rights_t rights; - unsigned long cmds[] = { TIOCGETA, TIOCGWINSZ }; + unsigned long cmds[] = { TIOCGETA, TIOCGWINSZ, FIODTYPE }; cap_rights_init(&rights, CAP_EVENT, CAP_FCNTL, CAP_FSTAT, CAP_IOCTL, CAP_SEEK); From owner-svn-src-stable-11@freebsd.org Sat Apr 7 14:35:47 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 95858F8CFCF; Sat, 7 Apr 2018 14:35:47 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B33383B42; Sat, 7 Apr 2018 14:35:47 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 461F922143; Sat, 7 Apr 2018 14:35:47 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37EZlWs005937; Sat, 7 Apr 2018 14:35:47 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37EZlfp005936; Sat, 7 Apr 2018 14:35:47 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071435.w37EZlfp005936@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 14:35:47 +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: r332167 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332167 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 14:35:47 -0000 Author: tuexen Date: Sat Apr 7 14:35:46 2018 New Revision: 332167 URL: https://svnweb.freebsd.org/changeset/base/332167 Log: MFC r320650: Don't hold a refcount on an stcb when it is not needed. This improves the consistency with other parts of the code. Modified: stable/11/sys/netinet/sctp_input.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_input.c ============================================================================== --- stable/11/sys/netinet/sctp_input.c Sat Apr 7 14:17:17 2018 (r332166) +++ stable/11/sys/netinet/sctp_input.c Sat Apr 7 14:35:46 2018 (r332167) @@ -2152,23 +2152,23 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, in * cookie was in flight. Only recourse is to abort the * association. */ - atomic_add_int(&stcb->asoc.refcnt, 1); op_err = sctp_generate_cause(SCTP_CAUSE_OUT_OF_RESC, ""); sctp_abort_association(inp, (struct sctp_tcb *)NULL, m, iphlen, src, dst, sh, op_err, mflowtype, mflowid, vrf_id, port); #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) + atomic_add_int(&stcb->asoc.refcnt, 1); SCTP_TCB_UNLOCK(stcb); SCTP_SOCKET_LOCK(so, 1); SCTP_TCB_LOCK(stcb); + atomic_subtract_int(&stcb->asoc.refcnt, 1); #endif (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_18); #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); #endif - atomic_subtract_int(&stcb->asoc.refcnt, 1); return (NULL); } /* process the INIT-ACK info (my info) */ @@ -2189,36 +2189,36 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, in else retval = 0; if (retval < 0) { - atomic_add_int(&stcb->asoc.refcnt, 1); #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) + atomic_add_int(&stcb->asoc.refcnt, 1); SCTP_TCB_UNLOCK(stcb); SCTP_SOCKET_LOCK(so, 1); SCTP_TCB_LOCK(stcb); + atomic_subtract_int(&stcb->asoc.refcnt, 1); #endif (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_19); #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); #endif - atomic_subtract_int(&stcb->asoc.refcnt, 1); return (NULL); } /* load all addresses */ if (sctp_load_addresses_from_init(stcb, m, init_offset + sizeof(struct sctp_init_chunk), initack_offset, src, dst, init_src, port)) { - atomic_add_int(&stcb->asoc.refcnt, 1); #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) + atomic_add_int(&stcb->asoc.refcnt, 1); SCTP_TCB_UNLOCK(stcb); SCTP_SOCKET_LOCK(so, 1); SCTP_TCB_LOCK(stcb); + atomic_subtract_int(&stcb->asoc.refcnt, 1); #endif (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_20); #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); #endif - atomic_subtract_int(&stcb->asoc.refcnt, 1); return (NULL); } /* @@ -2237,18 +2237,18 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, in /* auth HMAC failed, dump the assoc and packet */ SCTPDBG(SCTP_DEBUG_AUTH1, "COOKIE-ECHO: AUTH failed\n"); - atomic_add_int(&stcb->asoc.refcnt, 1); #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) + atomic_add_int(&stcb->asoc.refcnt, 1); SCTP_TCB_UNLOCK(stcb); SCTP_SOCKET_LOCK(so, 1); SCTP_TCB_LOCK(stcb); + atomic_subtract_int(&stcb->asoc.refcnt, 1); #endif (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_21); #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); #endif - atomic_subtract_int(&stcb->asoc.refcnt, 1); return (NULL); } else { /* remaining chunks checked... good to go */ @@ -2298,18 +2298,18 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, in break; #endif default: - atomic_add_int(&stcb->asoc.refcnt, 1); #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) + atomic_add_int(&stcb->asoc.refcnt, 1); SCTP_TCB_UNLOCK(stcb); SCTP_SOCKET_LOCK(so, 1); SCTP_TCB_LOCK(stcb); + atomic_subtract_int(&stcb->asoc.refcnt, 1); #endif (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_22); #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); #endif - atomic_subtract_int(&stcb->asoc.refcnt, 1); return (NULL); } From owner-svn-src-stable-11@freebsd.org Sat Apr 7 14:37:17 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 71C18F8D1EA; Sat, 7 Apr 2018 14:37:17 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 20ACD84946; Sat, 7 Apr 2018 14:37:17 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1B7B622145; Sat, 7 Apr 2018 14:37:17 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37EbGL2006040; Sat, 7 Apr 2018 14:37:16 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37EbGlu006039; Sat, 7 Apr 2018 14:37:16 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071437.w37EbGlu006039@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 14:37:16 +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: r332168 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332168 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 14:37:17 -0000 Author: tuexen Date: Sat Apr 7 14:37:16 2018 New Revision: 332168 URL: https://svnweb.freebsd.org/changeset/base/332168 Log: MFC r320653: Move to open state after plausibility checks. When doing this too early, the MIB counters go wrong. Modified: stable/11/sys/netinet/sctp_input.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_input.c ============================================================================== --- stable/11/sys/netinet/sctp_input.c Sat Apr 7 14:35:46 2018 (r332167) +++ stable/11/sys/netinet/sctp_input.c Sat Apr 7 14:37:16 2018 (r332168) @@ -2255,17 +2255,6 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, in stcb->asoc.authenticated = 1; } } - /* update current state */ - SCTPDBG(SCTP_DEBUG_INPUT2, "moving to OPEN state\n"); - SCTP_SET_STATE(asoc, SCTP_STATE_OPEN); - if (asoc->state & SCTP_STATE_SHUTDOWN_PENDING) { - sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, - stcb->sctp_ep, stcb, asoc->primary_destination); - } - sctp_stop_all_cookie_timers(stcb); - SCTP_STAT_INCR_COUNTER32(sctps_passiveestab); - SCTP_STAT_INCR_GAUGE32(sctps_currestab); - /* * if we're doing ASCONFs, check to see if we have any new local * addresses that need to get added to the peer (eg. addresses @@ -2312,6 +2301,17 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, in #endif return (NULL); } + + /* update current state */ + SCTPDBG(SCTP_DEBUG_INPUT2, "moving to OPEN state\n"); + SCTP_SET_STATE(asoc, SCTP_STATE_OPEN); + if (asoc->state & SCTP_STATE_SHUTDOWN_PENDING) { + sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, + stcb->sctp_ep, stcb, asoc->primary_destination); + } + sctp_stop_all_cookie_timers(stcb); + SCTP_STAT_INCR_COUNTER32(sctps_passiveestab); + SCTP_STAT_INCR_GAUGE32(sctps_currestab); /* set up to notify upper layer */ *notification = SCTP_NOTIFY_ASSOC_UP; From owner-svn-src-stable-11@freebsd.org Sat Apr 7 14:38:59 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87EA8F8D42C; Sat, 7 Apr 2018 14:38:59 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 387CD85A4D; Sat, 7 Apr 2018 14:38:59 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2D3CB22146; Sat, 7 Apr 2018 14:38:59 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37Ecx1Q006147; Sat, 7 Apr 2018 14:38:59 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37EcwIE006145; Sat, 7 Apr 2018 14:38:58 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071438.w37EcwIE006145@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 14:38:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332169 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332169 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 14:38:59 -0000 Author: tuexen Date: Sat Apr 7 14:38:58 2018 New Revision: 332169 URL: https://svnweb.freebsd.org/changeset/base/332169 Log: MFC r321034: Fix the handling of Explicit EOR mode. While there, appropriately handle the overhead depending on the usage of DATA or I-DATA chunks. Take the overhead only into account, when required. Joint work with rrs@ Modified: stable/11/sys/netinet/sctp_output.c stable/11/sys/netinet/sctp_output.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_output.c ============================================================================== --- stable/11/sys/netinet/sctp_output.c Sat Apr 7 14:37:16 2018 (r332168) +++ stable/11/sys/netinet/sctp_output.c Sat Apr 7 14:38:58 2018 (r332169) @@ -6250,11 +6250,7 @@ sctp_get_frag_point(struct sctp_tcb *stcb, } else { ovh = SCTP_MIN_V4_OVERHEAD; } - if (stcb->asoc.idata_supported) { - ovh += sizeof(struct sctp_idata_chunk); - } else { - ovh += sizeof(struct sctp_data_chunk); - } + ovh += SCTP_DATA_CHUNK_OVERHEAD(stcb); if (stcb->asoc.sctp_frag_point > asoc->smallest_mtu) siz = asoc->smallest_mtu - ovh; else @@ -6759,7 +6755,7 @@ sctp_sendall_iterator(struct sctp_inpcb *inp, struct s } } un_sent = ((stcb->asoc.total_output_queue_size - stcb->asoc.total_flight) + - (stcb->asoc.stream_queue_cnt * sizeof(struct sctp_data_chunk))); + (stcb->asoc.stream_queue_cnt * SCTP_DATA_CHUNK_OVERHEAD(stcb))); if ((sctp_is_feature_off(inp, SCTP_PCB_FLAGS_NODELAY)) && (stcb->asoc.total_flight > 0) && @@ -7459,11 +7455,7 @@ dont_do_it: } else { atomic_subtract_int(&sp->length, to_move); } - if (stcb->asoc.idata_supported == 0) { - leading = sizeof(struct sctp_data_chunk); - } else { - leading = sizeof(struct sctp_idata_chunk); - } + leading = SCTP_DATA_CHUNK_OVERHEAD(stcb); if (M_LEADINGSPACE(chk->data) < leading) { /* Not enough room for a chunk header, get some */ struct mbuf *m; @@ -7505,11 +7497,7 @@ dont_do_it: M_ALIGN(chk->data, 4); } } - if (stcb->asoc.idata_supported == 0) { - SCTP_BUF_PREPEND(chk->data, sizeof(struct sctp_data_chunk), M_NOWAIT); - } else { - SCTP_BUF_PREPEND(chk->data, sizeof(struct sctp_idata_chunk), M_NOWAIT); - } + SCTP_BUF_PREPEND(chk->data, SCTP_DATA_CHUNK_OVERHEAD(stcb), M_NOWAIT); if (chk->data == NULL) { /* HELP, TSNH since we assured it would not above? */ #ifdef INVARIANTS @@ -7522,13 +7510,8 @@ dont_do_it: to_move = 0; goto out_of; } - if (stcb->asoc.idata_supported == 0) { - sctp_snd_sb_alloc(stcb, sizeof(struct sctp_data_chunk)); - chk->book_size = chk->send_size = (uint16_t)(to_move + sizeof(struct sctp_data_chunk)); - } else { - sctp_snd_sb_alloc(stcb, sizeof(struct sctp_idata_chunk)); - chk->book_size = chk->send_size = (uint16_t)(to_move + sizeof(struct sctp_idata_chunk)); - } + sctp_snd_sb_alloc(stcb, SCTP_DATA_CHUNK_OVERHEAD(stcb)); + chk->book_size = chk->send_size = (uint16_t)(to_move + SCTP_DATA_CHUNK_OVERHEAD(stcb)); chk->book_size_scale = 0; chk->sent = SCTP_DATAGRAM_UNSENT; @@ -7728,11 +7711,7 @@ sctp_fill_outqueue(struct sctp_tcb *stcb, break; } /* Need an allowance for the data chunk header too */ - if (stcb->asoc.idata_supported == 0) { - space_left -= sizeof(struct sctp_data_chunk); - } else { - space_left -= sizeof(struct sctp_idata_chunk); - } + space_left -= SCTP_DATA_CHUNK_OVERHEAD(stcb); /* must make even word boundary */ space_left &= 0xfffffffc; @@ -7749,18 +7728,10 @@ sctp_fill_outqueue(struct sctp_tcb *stcb, strq = stcb->asoc.ss_functions.sctp_ss_select_stream(stcb, net, asoc); total_moved += moved; space_left -= moved; - if (stcb->asoc.idata_supported == 0) { - if (space_left >= sizeof(struct sctp_data_chunk)) { - space_left -= sizeof(struct sctp_data_chunk); - } else { - space_left = 0; - } + if (space_left >= SCTP_DATA_CHUNK_OVERHEAD(stcb)) { + space_left -= SCTP_DATA_CHUNK_OVERHEAD(stcb); } else { - if (space_left >= sizeof(struct sctp_idata_chunk)) { - space_left -= sizeof(struct sctp_idata_chunk); - } else { - space_left = 0; - } + space_left = 0; } space_left &= 0xfffffffc; } @@ -10209,8 +10180,7 @@ do_it_again: * and we have data in flight we stop, except if we * are handling a fragmented user message. */ - un_sent = ((stcb->asoc.total_output_queue_size - stcb->asoc.total_flight) + - (stcb->asoc.stream_queue_cnt * sizeof(struct sctp_data_chunk))); + un_sent = stcb->asoc.total_output_queue_size - stcb->asoc.total_flight; if ((un_sent < (int)(stcb->asoc.smallest_mtu - SCTP_MIN_OVERHEAD)) && (stcb->asoc.total_flight > 0)) { /* && sctp_is_feature_on(inp, SCTP_PCB_FLAGS_EXPLICIT_EOR))) {*/ @@ -12448,7 +12418,7 @@ sctp_copy_it_in(struct sctp_tcb *stcb, sp->sender_all_done = 0; sp->some_taken = 0; sp->put_last_out = 0; - resv_in_first = sizeof(struct sctp_data_chunk); + resv_in_first = SCTP_DATA_CHUNK_OVERHEAD(stcb); sp->data = sp->tail_mbuf = NULL; if (sp->length == 0) { *error = 0; @@ -12865,12 +12835,19 @@ sctp_lower_sosend(struct socket *so, } /* would we block? */ if (non_blocking) { + uint32_t amount; + if (hold_tcblock == 0) { SCTP_TCB_LOCK(stcb); hold_tcblock = 1; } - inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * sizeof(struct sctp_data_chunk)); - if ((SCTP_SB_LIMIT_SND(so) < (sndlen + inqueue_bytes + stcb->asoc.sb_send_resv)) || + inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * SCTP_DATA_CHUNK_OVERHEAD(stcb)); + if (user_marks_eor == 0) { + amount = sndlen; + } else { + amount = 1; + } + if ((SCTP_SB_LIMIT_SND(so) < (amount + inqueue_bytes + stcb->asoc.sb_send_resv)) || (stcb->asoc.chunks_on_out_queue >= SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue))) { SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EWOULDBLOCK); if (sndlen > SCTP_SB_LIMIT_SND(so)) @@ -13036,7 +13013,7 @@ sctp_lower_sosend(struct socket *so, goto out_unlocked; } /* Calculate the maximum we can send */ - inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * sizeof(struct sctp_data_chunk)); + inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * SCTP_DATA_CHUNK_OVERHEAD(stcb)); if (SCTP_SB_LIMIT_SND(so) > inqueue_bytes) { if (non_blocking) { /* we already checked for non-blocking above. */ @@ -13093,7 +13070,7 @@ sctp_lower_sosend(struct socket *so, ((stcb->asoc.chunks_on_out_queue + stcb->asoc.stream_queue_cnt) >= SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue))) { /* No room right now ! */ SOCKBUF_LOCK(&so->so_snd); - inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * sizeof(struct sctp_data_chunk)); + inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * SCTP_DATA_CHUNK_OVERHEAD(stcb)); while ((SCTP_SB_LIMIT_SND(so) < (inqueue_bytes + local_add_more)) || ((stcb->asoc.stream_queue_cnt + stcb->asoc.chunks_on_out_queue) >= SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue))) { SCTPDBG(SCTP_DEBUG_OUTPUT1, "pre_block limit:%u <(inq:%d + %d) || (%d+%d > %d)\n", @@ -13129,7 +13106,7 @@ sctp_lower_sosend(struct socket *so, SOCKBUF_UNLOCK(&so->so_snd); goto out_unlocked; } - inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * sizeof(struct sctp_data_chunk)); + inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * SCTP_DATA_CHUNK_OVERHEAD(stcb)); } if (SCTP_SB_LIMIT_SND(so) > inqueue_bytes) { max_len = SCTP_SB_LIMIT_SND(so) - inqueue_bytes; @@ -13222,8 +13199,9 @@ skip_preblock: /* How much room do we have? */ struct mbuf *new_tail, *mm; - if (SCTP_SB_LIMIT_SND(so) > stcb->asoc.total_output_queue_size) - max_len = SCTP_SB_LIMIT_SND(so) - stcb->asoc.total_output_queue_size; + inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * SCTP_DATA_CHUNK_OVERHEAD(stcb)); + if (SCTP_SB_LIMIT_SND(so) > inqueue_bytes) + max_len = SCTP_SB_LIMIT_SND(so) - inqueue_bytes; else max_len = 0; @@ -13299,8 +13277,8 @@ skip_preblock: hold_tcblock = 1; } sctp_prune_prsctp(stcb, asoc, srcv, sndlen); - inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * sizeof(struct sctp_data_chunk)); - if (SCTP_SB_LIMIT_SND(so) > stcb->asoc.total_output_queue_size) + inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * SCTP_DATA_CHUNK_OVERHEAD(stcb)); + if (SCTP_SB_LIMIT_SND(so) > inqueue_bytes) max_len = SCTP_SB_LIMIT_SND(so) - inqueue_bytes; else max_len = 0; @@ -13341,8 +13319,7 @@ skip_preblock: } asoc->ifp_had_enobuf = 0; } - un_sent = ((stcb->asoc.total_output_queue_size - stcb->asoc.total_flight) + - (stcb->asoc.stream_queue_cnt * sizeof(struct sctp_data_chunk))); + un_sent = stcb->asoc.total_output_queue_size - stcb->asoc.total_flight; if ((sctp_is_feature_off(inp, SCTP_PCB_FLAGS_NODELAY)) && (stcb->asoc.total_flight > 0) && (stcb->asoc.stream_queue_cnt < SCTP_MAX_DATA_BUNDLING) && @@ -13416,7 +13393,8 @@ skip_preblock: * size we KNOW we will get to sleep safely with the * wakeup flag in place. */ - if (SCTP_SB_LIMIT_SND(so) <= (stcb->asoc.total_output_queue_size + + inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * SCTP_DATA_CHUNK_OVERHEAD(stcb)); + if (SCTP_SB_LIMIT_SND(so) <= (inqueue_bytes + min(SCTP_BASE_SYSCTL(sctp_add_more_threshold), SCTP_SB_LIMIT_SND(so)))) { if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_BLK_LOGGING_ENABLE) { sctp_log_block(SCTP_BLOCK_LOG_INTO_BLK, @@ -13613,8 +13591,7 @@ skip_out_eof: } asoc->ifp_had_enobuf = 0; } - un_sent = ((stcb->asoc.total_output_queue_size - stcb->asoc.total_flight) + - (stcb->asoc.stream_queue_cnt * sizeof(struct sctp_data_chunk))); + un_sent = stcb->asoc.total_output_queue_size - stcb->asoc.total_flight; if ((sctp_is_feature_off(inp, SCTP_PCB_FLAGS_NODELAY)) && (stcb->asoc.total_flight > 0) && (stcb->asoc.stream_queue_cnt < SCTP_MAX_DATA_BUNDLING) && Modified: stable/11/sys/netinet/sctp_output.h ============================================================================== --- stable/11/sys/netinet/sctp_output.h Sat Apr 7 14:37:16 2018 (r332168) +++ stable/11/sys/netinet/sctp_output.h Sat Apr 7 14:38:58 2018 (r332169) @@ -135,6 +135,11 @@ void sctp_fix_ecn_echo(struct sctp_association *); void sctp_move_chunks_from_net(struct sctp_tcb *stcb, struct sctp_nets *net); + +#define SCTP_DATA_CHUNK_OVERHEAD(stcb) ((stcb)->asoc.idata_supported ? \ + sizeof(struct sctp_idata_chunk) : \ + sizeof(struct sctp_data_chunk)) + int sctp_output(struct sctp_inpcb *, struct mbuf *, struct sockaddr *, struct mbuf *, struct thread *, int); From owner-svn-src-stable-11@freebsd.org Sat Apr 7 14:40:23 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A2487F8D624; Sat, 7 Apr 2018 14:40:22 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BEEB86763; Sat, 7 Apr 2018 14:40:22 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 436AA2214B; Sat, 7 Apr 2018 14:40:22 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37EeMvj006332; Sat, 7 Apr 2018 14:40:22 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37EeLiU006328; Sat, 7 Apr 2018 14:40:21 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071440.w37EeLiU006328@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 14:40:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332171 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332171 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 14:40:23 -0000 Author: tuexen Date: Sat Apr 7 14:40:21 2018 New Revision: 332171 URL: https://svnweb.freebsd.org/changeset/base/332171 Log: MFC r321197: Fix the accounting and add code to detect errors in accounting. Joint work with rrs@ Modified: stable/11/sys/netinet/sctp_auth.c stable/11/sys/netinet/sctp_indata.c stable/11/sys/netinet/sctp_pcb.c stable/11/sys/netinet/sctputil.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_auth.c ============================================================================== --- stable/11/sys/netinet/sctp_auth.c Sat Apr 7 14:40:09 2018 (r332170) +++ stable/11/sys/netinet/sctp_auth.c Sat Apr 7 14:40:21 2018 (r332171) @@ -1797,8 +1797,8 @@ sctp_notify_authentication(struct sctp_tcb *stcb, uint sctp_m_freem(m_notify); return; } - control->spec_flags = M_NOTIFICATION; control->length = SCTP_BUF_LEN(m_notify); + control->spec_flags = M_NOTIFICATION; /* not that we need this */ control->tail_mbuf = m_notify; sctp_add_to_readq(stcb->sctp_ep, stcb, control, Modified: stable/11/sys/netinet/sctp_indata.c ============================================================================== --- stable/11/sys/netinet/sctp_indata.c Sat Apr 7 14:40:09 2018 (r332170) +++ stable/11/sys/netinet/sctp_indata.c Sat Apr 7 14:40:21 2018 (r332171) @@ -59,7 +59,7 @@ __FBSDID("$FreeBSD$"); * This will cause sctp_service_queues() to get called on the top entry in * the list. */ -static void +static uint32_t sctp_add_chk_to_control(struct sctp_queued_to_read *control, struct sctp_stream_in *strm, struct sctp_tcb *stcb, @@ -92,6 +92,8 @@ sctp_calc_rwnd(struct sctp_tcb *stcb, struct sctp_asso asoc->size_on_reasm_queue == 0 && asoc->size_on_all_streams == 0) { /* Full rwnd granted */ + KASSERT(asoc->cnt_on_reasm_queue == 0, ("cnt_on_reasm_queue is %u", asoc->cnt_on_reasm_queue)); + KASSERT(asoc->cnt_on_all_streams == 0, ("cnt_on_all_streams is %u", asoc->cnt_on_all_streams)); calc = max(SCTP_SB_LIMIT_RCV(stcb->sctp_socket), SCTP_MINIMAL_RWND); return (calc); } @@ -558,7 +560,15 @@ sctp_queue_data_to_stream(struct sctp_tcb *stcb, } /* EY it wont be queued if it could be delivered directly */ queue_needed = 0; - asoc->size_on_all_streams -= control->length; + if (asoc->size_on_all_streams >= control->length) { + asoc->size_on_all_streams -= control->length; + } else { +#ifdef INVARIANTS + panic("size_on_all_streams = %u smaller than control length %u", asoc->size_on_all_streams, control->length); +#else + asoc->size_on_all_streams = 0; +#endif + } sctp_ucount_decr(asoc->cnt_on_all_streams); strm->last_mid_delivered++; sctp_mark_non_revokable(asoc, control->sinfo_tsn); @@ -571,11 +581,19 @@ sctp_queue_data_to_stream(struct sctp_tcb *stcb, nxt_todel = strm->last_mid_delivered + 1; if (SCTP_MID_EQ(asoc->idata_supported, nxt_todel, control->mid) && (((control->sinfo_flags >> 8) & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG)) { - asoc->size_on_all_streams -= control->length; - sctp_ucount_decr(asoc->cnt_on_all_streams); if (control->on_strm_q == SCTP_ON_ORDERED) { TAILQ_REMOVE(&strm->inqueue, control, next_instrm); + if (asoc->size_on_all_streams >= control->length) { + asoc->size_on_all_streams -= control->length; + } else { #ifdef INVARIANTS + panic("size_on_all_streams = %u smaller than control length %u", asoc->size_on_all_streams, control->length); +#else + asoc->size_on_all_streams = 0; +#endif + } + sctp_ucount_decr(asoc->cnt_on_all_streams); +#ifdef INVARIANTS } else { panic("Huh control: %p is on_strm_q: %d", control, control->on_strm_q); @@ -671,7 +689,7 @@ sctp_setup_tail_pointer(struct sctp_queued_to_read *co } static void -sctp_add_to_tail_pointer(struct sctp_queued_to_read *control, struct mbuf *m) +sctp_add_to_tail_pointer(struct sctp_queued_to_read *control, struct mbuf *m, uint32_t *added) { struct mbuf *prev = NULL; struct sctp_tcb *stcb; @@ -715,6 +733,7 @@ sctp_add_to_tail_pointer(struct sctp_queued_to_read *c */ sctp_sballoc(stcb, &stcb->sctp_socket->so_rcv, m); } + *added += SCTP_BUF_LEN(m); atomic_add_int(&control->length, SCTP_BUF_LEN(m)); m = SCTP_BUF_NEXT(m); } @@ -815,7 +834,15 @@ restart: tchk = TAILQ_FIRST(&control->reasm); if (tchk->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG) { TAILQ_REMOVE(&control->reasm, tchk, sctp_next); - asoc->size_on_reasm_queue -= tchk->send_size; + if (asoc->size_on_reasm_queue >= tchk->send_size) { + asoc->size_on_reasm_queue -= tchk->send_size; + } else { +#ifdef INVARIANTS + panic("size_on_reasm_queue = %u smaller than chunk length %u", asoc->size_on_reasm_queue, tchk->send_size); +#else + asoc->size_on_reasm_queue = 0; +#endif + } sctp_ucount_decr(asoc->cnt_on_reasm_queue); nc->first_frag_seen = 1; nc->fsn_included = tchk->rec.data.fsn; @@ -1127,6 +1154,16 @@ done_un: #endif SCTP_STAT_INCR_COUNTER64(sctps_reasmusrmsgs); TAILQ_REMOVE(&strm->inqueue, control, next_instrm); + if (asoc->size_on_all_streams >= control->length) { + asoc->size_on_all_streams -= control->length; + } else { +#ifdef INVARIANTS + panic("size_on_all_streams = %u smaller than control length %u", asoc->size_on_all_streams, control->length); +#else + asoc->size_on_all_streams = 0; +#endif + } + sctp_ucount_decr(asoc->cnt_on_all_streams); control->on_strm_q = 0; } if (strm->pd_api_started && control->pdapi_started) { @@ -1173,6 +1210,16 @@ deliver_more: #endif SCTP_STAT_INCR_COUNTER64(sctps_reasmusrmsgs); TAILQ_REMOVE(&strm->inqueue, control, next_instrm); + if (asoc->size_on_all_streams >= control->length) { + asoc->size_on_all_streams -= control->length; + } else { +#ifdef INVARIANTS + panic("size_on_all_streams = %u smaller than control length %u", asoc->size_on_all_streams, control->length); +#else + asoc->size_on_all_streams = 0; +#endif + } + sctp_ucount_decr(asoc->cnt_on_all_streams); control->on_strm_q = 0; } ret++; @@ -1219,7 +1266,7 @@ out: } -void +uint32_t sctp_add_chk_to_control(struct sctp_queued_to_read *control, struct sctp_stream_in *strm, struct sctp_tcb *stcb, struct sctp_association *asoc, @@ -1229,6 +1276,7 @@ sctp_add_chk_to_control(struct sctp_queued_to_read *co * Given a control and a chunk, merge the data from the chk onto the * control and free up the chunk resources. */ + uint32_t added = 0; int i_locked = 0; if (control->on_read_q && (hold_rlock == 0)) { @@ -1242,7 +1290,7 @@ sctp_add_chk_to_control(struct sctp_queued_to_read *co control->data = chk->data; sctp_setup_tail_pointer(control); } else { - sctp_add_to_tail_pointer(control, chk->data); + sctp_add_to_tail_pointer(control, chk->data, &added); } control->fsn_included = chk->rec.data.fsn; asoc->size_on_reasm_queue -= chk->send_size; @@ -1268,6 +1316,16 @@ sctp_add_chk_to_control(struct sctp_queued_to_read *co } else if (control->on_strm_q == SCTP_ON_ORDERED) { /* Ordered */ TAILQ_REMOVE(&strm->inqueue, control, next_instrm); + if (asoc->size_on_all_streams >= control->length) { + asoc->size_on_all_streams -= control->length; + } else { +#ifdef INVARIANTS + panic("size_on_all_streams = %u smaller than control length %u", asoc->size_on_all_streams, control->length); +#else + asoc->size_on_all_streams = 0; +#endif + } + sctp_ucount_decr(asoc->cnt_on_all_streams); control->on_strm_q = 0; #ifdef INVARIANTS } else if (control->on_strm_q) { @@ -1283,6 +1341,7 @@ sctp_add_chk_to_control(struct sctp_queued_to_read *co SCTP_INP_READ_UNLOCK(stcb->sctp_ep); } sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); + return (added); } /* @@ -1302,6 +1361,7 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struc struct sctp_tmit_chunk *at, *nat; struct sctp_stream_in *strm; int do_wakeup, unordered; + uint32_t lenadded; strm = &asoc->strmin[control->sinfo_stream]; /* @@ -1314,6 +1374,9 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struc } /* Must be added to the stream-in queue */ if (created_control) { + if (unordered == 0) { + sctp_ucount_incr(asoc->cnt_on_all_streams); + } if (sctp_place_control_in_stream(strm, asoc, control)) { /* Duplicate SSN? */ sctp_clean_up_control(stcb, control); @@ -1373,6 +1436,7 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struc chk->data = NULL; sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); sctp_setup_tail_pointer(control); + asoc->size_on_all_streams += control->length; } else { /* Place the chunk in our list */ int inserted = 0; @@ -1529,7 +1593,8 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struc at->rec.data.fsn, next_fsn, control->fsn_included); TAILQ_REMOVE(&control->reasm, at, sctp_next); - sctp_add_chk_to_control(control, strm, stcb, asoc, at, SCTP_READ_LOCK_NOT_HELD); + lenadded = sctp_add_chk_to_control(control, strm, stcb, asoc, at, SCTP_READ_LOCK_NOT_HELD); + asoc->size_on_all_streams += lenadded; if (control->on_read_q) { do_wakeup = 1; } @@ -1600,7 +1665,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struc uint16_t sid; struct mbuf *op_err; char msg[SCTP_DIAG_INFO_LEN]; - struct sctp_queued_to_read *control = NULL; + struct sctp_queued_to_read *control, *ncontrol; uint32_t ppid; uint8_t chk_flags; struct sctp_stream_reset_list *liste; @@ -2006,7 +2071,13 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struc return (0); } if ((chk_flags & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) { + struct mbuf *m; + control->data = dmbuf; + m = control->data; + for (m = control->data; m; m = m->m_next) { + control->length += SCTP_BUF_LEN(m); + } control->tail_mbuf = NULL; control->end_added = 1; control->last_frag_seen = 1; @@ -2116,16 +2187,16 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struc /* first one on */ TAILQ_INSERT_TAIL(&asoc->pending_reply_queue, control, next); } else { - struct sctp_queued_to_read *ctlOn, *nctlOn; + struct sctp_queued_to_read *lcontrol, *nlcontrol; unsigned char inserted = 0; - TAILQ_FOREACH_SAFE(ctlOn, &asoc->pending_reply_queue, next, nctlOn) { - if (SCTP_TSN_GT(control->sinfo_tsn, ctlOn->sinfo_tsn)) { + TAILQ_FOREACH_SAFE(lcontrol, &asoc->pending_reply_queue, next, nlcontrol) { + if (SCTP_TSN_GT(control->sinfo_tsn, lcontrol->sinfo_tsn)) { continue; } else { /* found it */ - TAILQ_INSERT_BEFORE(ctlOn, control, next); + TAILQ_INSERT_BEFORE(lcontrol, control, next); inserted = 1; break; } @@ -2216,8 +2287,6 @@ finish_express_del: * pending_reply space 3: distribute any chunks in * pending_reply_queue. */ - struct sctp_queued_to_read *ctl, *nctl; - sctp_reset_in_stream(stcb, liste->number_entries, liste->list_of_streams); TAILQ_REMOVE(&asoc->resetHead, liste, next_resp); sctp_send_deferred_reset_response(stcb, liste, SCTP_STREAM_RESET_RESULT_PERFORMED); @@ -2226,34 +2295,34 @@ finish_express_del: liste = TAILQ_FIRST(&asoc->resetHead); if (TAILQ_EMPTY(&asoc->resetHead)) { /* All can be removed */ - TAILQ_FOREACH_SAFE(ctl, &asoc->pending_reply_queue, next, nctl) { - TAILQ_REMOVE(&asoc->pending_reply_queue, ctl, next); - sctp_queue_data_to_stream(stcb, asoc, ctl, abort_flag, &need_reasm_check); + TAILQ_FOREACH_SAFE(control, &asoc->pending_reply_queue, next, ncontrol) { + TAILQ_REMOVE(&asoc->pending_reply_queue, control, next); + sctp_queue_data_to_stream(stcb, asoc, control, abort_flag, &need_reasm_check); if (*abort_flag) { return (0); } if (need_reasm_check) { - (void)sctp_deliver_reasm_check(stcb, asoc, &asoc->strmin[ctl->sinfo_stream], SCTP_READ_LOCK_NOT_HELD); + (void)sctp_deliver_reasm_check(stcb, asoc, &asoc->strmin[control->sinfo_stream], SCTP_READ_LOCK_NOT_HELD); need_reasm_check = 0; } } } else { - TAILQ_FOREACH_SAFE(ctl, &asoc->pending_reply_queue, next, nctl) { - if (SCTP_TSN_GT(ctl->sinfo_tsn, liste->tsn)) { + TAILQ_FOREACH_SAFE(control, &asoc->pending_reply_queue, next, ncontrol) { + if (SCTP_TSN_GT(control->sinfo_tsn, liste->tsn)) { break; } /* - * if ctl->sinfo_tsn is <= liste->tsn we can - * process it which is the NOT of - * ctl->sinfo_tsn > liste->tsn + * if control->sinfo_tsn is <= liste->tsn we + * can process it which is the NOT of + * control->sinfo_tsn > liste->tsn */ - TAILQ_REMOVE(&asoc->pending_reply_queue, ctl, next); - sctp_queue_data_to_stream(stcb, asoc, ctl, abort_flag, &need_reasm_check); + TAILQ_REMOVE(&asoc->pending_reply_queue, control, next); + sctp_queue_data_to_stream(stcb, asoc, control, abort_flag, &need_reasm_check); if (*abort_flag) { return (0); } if (need_reasm_check) { - (void)sctp_deliver_reasm_check(stcb, asoc, &asoc->strmin[ctl->sinfo_stream], SCTP_READ_LOCK_NOT_HELD); + (void)sctp_deliver_reasm_check(stcb, asoc, &asoc->strmin[control->sinfo_stream], SCTP_READ_LOCK_NOT_HELD); need_reasm_check = 0; } } @@ -5181,7 +5250,7 @@ static void sctp_kick_prsctp_reorder_queue(struct sctp_tcb *stcb, struct sctp_stream_in *strmin) { - struct sctp_queued_to_read *ctl, *nctl; + struct sctp_queued_to_read *control, *ncontrol; struct sctp_association *asoc; uint32_t mid; int need_reasm_check = 0; @@ -5192,43 +5261,51 @@ sctp_kick_prsctp_reorder_queue(struct sctp_tcb *stcb, * First deliver anything prior to and including the stream no that * came in. */ - TAILQ_FOREACH_SAFE(ctl, &strmin->inqueue, next_instrm, nctl) { - if (SCTP_MID_GE(asoc->idata_supported, mid, ctl->mid)) { + TAILQ_FOREACH_SAFE(control, &strmin->inqueue, next_instrm, ncontrol) { + if (SCTP_MID_GE(asoc->idata_supported, mid, control->mid)) { /* this is deliverable now */ - if (((ctl->sinfo_flags >> 8) & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) { - if (ctl->on_strm_q) { - if (ctl->on_strm_q == SCTP_ON_ORDERED) { - TAILQ_REMOVE(&strmin->inqueue, ctl, next_instrm); - } else if (ctl->on_strm_q == SCTP_ON_UNORDERED) { - TAILQ_REMOVE(&strmin->uno_inqueue, ctl, next_instrm); + if (((control->sinfo_flags >> 8) & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) { + if (control->on_strm_q) { + if (control->on_strm_q == SCTP_ON_ORDERED) { + TAILQ_REMOVE(&strmin->inqueue, control, next_instrm); + } else if (control->on_strm_q == SCTP_ON_UNORDERED) { + TAILQ_REMOVE(&strmin->uno_inqueue, control, next_instrm); #ifdef INVARIANTS } else { panic("strmin: %p ctl: %p unknown %d", - strmin, ctl, ctl->on_strm_q); + strmin, control, control->on_strm_q); #endif } - ctl->on_strm_q = 0; + control->on_strm_q = 0; } /* subtract pending on streams */ - asoc->size_on_all_streams -= ctl->length; + if (asoc->size_on_all_streams >= control->length) { + asoc->size_on_all_streams -= control->length; + } else { +#ifdef INVARIANTS + panic("size_on_all_streams = %u smaller than control length %u", asoc->size_on_all_streams, control->length); +#else + asoc->size_on_all_streams = 0; +#endif + } sctp_ucount_decr(asoc->cnt_on_all_streams); /* deliver it to at least the delivery-q */ if (stcb->sctp_socket) { - sctp_mark_non_revokable(asoc, ctl->sinfo_tsn); + sctp_mark_non_revokable(asoc, control->sinfo_tsn); sctp_add_to_readq(stcb->sctp_ep, stcb, - ctl, + control, &stcb->sctp_socket->so_rcv, 1, SCTP_READ_LOCK_HELD, SCTP_SO_NOT_LOCKED); } } else { /* Its a fragmented message */ - if (ctl->first_frag_seen) { + if (control->first_frag_seen) { /* * Make it so this is next to * deliver, we restore later */ - strmin->last_mid_delivered = ctl->mid - 1; + strmin->last_mid_delivered = control->mid - 1; need_reasm_check = 1; break; } @@ -5257,32 +5334,40 @@ sctp_kick_prsctp_reorder_queue(struct sctp_tcb *stcb, * now ready. */ mid = strmin->last_mid_delivered + 1; - TAILQ_FOREACH_SAFE(ctl, &strmin->inqueue, next_instrm, nctl) { - if (SCTP_MID_EQ(asoc->idata_supported, mid, ctl->mid)) { - if (((ctl->sinfo_flags >> 8) & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) { + TAILQ_FOREACH_SAFE(control, &strmin->inqueue, next_instrm, ncontrol) { + if (SCTP_MID_EQ(asoc->idata_supported, mid, control->mid)) { + if (((control->sinfo_flags >> 8) & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) { /* this is deliverable now */ - if (ctl->on_strm_q) { - if (ctl->on_strm_q == SCTP_ON_ORDERED) { - TAILQ_REMOVE(&strmin->inqueue, ctl, next_instrm); - } else if (ctl->on_strm_q == SCTP_ON_UNORDERED) { - TAILQ_REMOVE(&strmin->uno_inqueue, ctl, next_instrm); + if (control->on_strm_q) { + if (control->on_strm_q == SCTP_ON_ORDERED) { + TAILQ_REMOVE(&strmin->inqueue, control, next_instrm); + } else if (control->on_strm_q == SCTP_ON_UNORDERED) { + TAILQ_REMOVE(&strmin->uno_inqueue, control, next_instrm); #ifdef INVARIANTS } else { panic("strmin: %p ctl: %p unknown %d", - strmin, ctl, ctl->on_strm_q); + strmin, control, control->on_strm_q); #endif } - ctl->on_strm_q = 0; + control->on_strm_q = 0; } /* subtract pending on streams */ - asoc->size_on_all_streams -= ctl->length; + if (asoc->size_on_all_streams >= control->length) { + asoc->size_on_all_streams -= control->length; + } else { +#ifdef INVARIANTS + panic("size_on_all_streams = %u smaller than control length %u", asoc->size_on_all_streams, control->length); +#else + asoc->size_on_all_streams = 0; +#endif + } sctp_ucount_decr(asoc->cnt_on_all_streams); /* deliver it to at least the delivery-q */ - strmin->last_mid_delivered = ctl->mid; + strmin->last_mid_delivered = control->mid; if (stcb->sctp_socket) { - sctp_mark_non_revokable(asoc, ctl->sinfo_tsn); + sctp_mark_non_revokable(asoc, control->sinfo_tsn); sctp_add_to_readq(stcb->sctp_ep, stcb, - ctl, + control, &stcb->sctp_socket->so_rcv, 1, SCTP_READ_LOCK_HELD, SCTP_SO_NOT_LOCKED); @@ -5290,12 +5375,12 @@ sctp_kick_prsctp_reorder_queue(struct sctp_tcb *stcb, mid = strmin->last_mid_delivered + 1; } else { /* Its a fragmented message */ - if (ctl->first_frag_seen) { + if (control->first_frag_seen) { /* * Make it so this is next to * deliver */ - strmin->last_mid_delivered = ctl->mid - 1; + strmin->last_mid_delivered = control->mid - 1; need_reasm_check = 1; break; } @@ -5347,7 +5432,15 @@ sctp_flush_reassm_for_str_seq(struct sctp_tcb *stcb, } cnt_removed++; TAILQ_REMOVE(&control->reasm, chk, sctp_next); - asoc->size_on_reasm_queue -= chk->send_size; + if (asoc->size_on_reasm_queue >= chk->send_size) { + asoc->size_on_reasm_queue -= chk->send_size; + } else { +#ifdef INVARIANTS + panic("size_on_reasm_queue = %u smaller than chunk length %u", asoc->size_on_reasm_queue, chk->send_size); +#else + asoc->size_on_reasm_queue = 0; +#endif + } sctp_ucount_decr(asoc->cnt_on_reasm_queue); if (chk->data) { sctp_m_freem(chk->data); @@ -5373,6 +5466,16 @@ sctp_flush_reassm_for_str_seq(struct sctp_tcb *stcb, } if (control->on_strm_q == SCTP_ON_ORDERED) { TAILQ_REMOVE(&strm->inqueue, control, next_instrm); + if (asoc->size_on_all_streams >= control->length) { + asoc->size_on_all_streams -= control->length; + } else { +#ifdef INVARIANTS + panic("size_on_all_streams = %u smaller than control length %u", asoc->size_on_all_streams, control->length); +#else + asoc->size_on_all_streams = 0; +#endif + } + sctp_ucount_decr(asoc->cnt_on_all_streams); control->on_strm_q = 0; } else if (control->on_strm_q == SCTP_ON_UNORDERED) { TAILQ_REMOVE(&strm->uno_inqueue, control, next_instrm); @@ -5416,7 +5519,7 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb, unsigned int i, fwd_sz, m_size; uint32_t str_seq; struct sctp_stream_in *strm; - struct sctp_queued_to_read *ctl, *sv; + struct sctp_queued_to_read *control, *sv; asoc = &stcb->asoc; if ((fwd_sz = ntohs(fwd->ch.chunk_length)) < sizeof(struct sctp_forward_tsn_chunk)) { @@ -5575,25 +5678,35 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb, for (cur_mid = strm->last_mid_delivered; SCTP_MID_GE(asoc->idata_supported, mid, cur_mid); cur_mid++) { sctp_flush_reassm_for_str_seq(stcb, asoc, sid, cur_mid, ordered, new_cum_tsn); } - TAILQ_FOREACH(ctl, &stcb->sctp_ep->read_queue, next) { - if ((ctl->sinfo_stream == sid) && - (SCTP_MID_EQ(asoc->idata_supported, ctl->mid, mid))) { + TAILQ_FOREACH(control, &stcb->sctp_ep->read_queue, next) { + if ((control->sinfo_stream == sid) && + (SCTP_MID_EQ(asoc->idata_supported, control->mid, mid))) { str_seq = (sid << 16) | (0x0000ffff & mid); - ctl->pdapi_aborted = 1; + control->pdapi_aborted = 1; sv = stcb->asoc.control_pdapi; - ctl->end_added = 1; - if (ctl->on_strm_q == SCTP_ON_ORDERED) { - TAILQ_REMOVE(&strm->inqueue, ctl, next_instrm); - } else if (ctl->on_strm_q == SCTP_ON_UNORDERED) { - TAILQ_REMOVE(&strm->uno_inqueue, ctl, next_instrm); + control->end_added = 1; + if (control->on_strm_q == SCTP_ON_ORDERED) { + TAILQ_REMOVE(&strm->inqueue, control, next_instrm); + if (asoc->size_on_all_streams >= control->length) { + asoc->size_on_all_streams -= control->length; + } else { #ifdef INVARIANTS - } else if (ctl->on_strm_q) { + panic("size_on_all_streams = %u smaller than control length %u", asoc->size_on_all_streams, control->length); +#else + asoc->size_on_all_streams = 0; +#endif + } + sctp_ucount_decr(asoc->cnt_on_all_streams); + } else if (control->on_strm_q == SCTP_ON_UNORDERED) { + TAILQ_REMOVE(&strm->uno_inqueue, control, next_instrm); +#ifdef INVARIANTS + } else if (control->on_strm_q) { panic("strm: %p ctl: %p unknown %d", - strm, ctl, ctl->on_strm_q); + strm, control, control->on_strm_q); #endif } - ctl->on_strm_q = 0; - stcb->asoc.control_pdapi = ctl; + control->on_strm_q = 0; + stcb->asoc.control_pdapi = control; sctp_ulp_notify(SCTP_NOTIFY_PARTIAL_DELVIERY_INDICATION, stcb, SCTP_PARTIAL_DELIVERY_ABORTED, @@ -5601,8 +5714,8 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb, SCTP_SO_NOT_LOCKED); stcb->asoc.control_pdapi = sv; break; - } else if ((ctl->sinfo_stream == sid) && - SCTP_MID_GT(asoc->idata_supported, ctl->mid, mid)) { + } else if ((control->sinfo_stream == sid) && + SCTP_MID_GT(asoc->idata_supported, control->mid, mid)) { /* We are past our victim SSN */ break; } Modified: stable/11/sys/netinet/sctp_pcb.c ============================================================================== --- stable/11/sys/netinet/sctp_pcb.c Sat Apr 7 14:40:09 2018 (r332170) +++ stable/11/sys/netinet/sctp_pcb.c Sat Apr 7 14:40:21 2018 (r332171) @@ -4599,21 +4599,21 @@ void sctp_clean_up_stream(struct sctp_tcb *stcb, struct sctp_readhead *rh) { struct sctp_tmit_chunk *chk, *nchk; - struct sctp_queued_to_read *ctl, *nctl; + struct sctp_queued_to_read *control, *ncontrol; - TAILQ_FOREACH_SAFE(ctl, rh, next_instrm, nctl) { - TAILQ_REMOVE(rh, ctl, next_instrm); - ctl->on_strm_q = 0; - if (ctl->on_read_q == 0) { - sctp_free_remote_addr(ctl->whoFrom); - if (ctl->data) { - sctp_m_freem(ctl->data); - ctl->data = NULL; + TAILQ_FOREACH_SAFE(control, rh, next_instrm, ncontrol) { + TAILQ_REMOVE(rh, control, next_instrm); + control->on_strm_q = 0; + if (control->on_read_q == 0) { + sctp_free_remote_addr(control->whoFrom); + if (control->data) { + sctp_m_freem(control->data); + control->data = NULL; } } /* Reassembly free? */ - TAILQ_FOREACH_SAFE(chk, &ctl->reasm, sctp_next, nchk) { - TAILQ_REMOVE(&ctl->reasm, chk, sctp_next); + TAILQ_FOREACH_SAFE(chk, &control->reasm, sctp_next, nchk) { + TAILQ_REMOVE(&control->reasm, chk, sctp_next); if (chk->data) { sctp_m_freem(chk->data); chk->data = NULL; @@ -4629,8 +4629,8 @@ sctp_clean_up_stream(struct sctp_tcb *stcb, struct sct * We don't free the address here since all the net's were * freed above. */ - if (ctl->on_read_q == 0) { - sctp_free_a_readq(stcb, ctl); + if (control->on_read_q == 0) { + sctp_free_a_readq(stcb, control); } } } @@ -6801,7 +6801,7 @@ sctp_drain_mbufs(struct sctp_tcb *stcb) struct sctp_association *asoc; struct sctp_tmit_chunk *chk, *nchk; uint32_t cumulative_tsn_p1; - struct sctp_queued_to_read *ctl, *nctl; + struct sctp_queued_to_read *control, *ncontrol; int cnt, strmat; uint32_t gap, i; int fnd = 0; @@ -6818,88 +6818,124 @@ sctp_drain_mbufs(struct sctp_tcb *stcb) cnt = 0; /* Ok that was fun, now we will drain all the inbound streams? */ for (strmat = 0; strmat < asoc->streamincnt; strmat++) { - TAILQ_FOREACH_SAFE(ctl, &asoc->strmin[strmat].inqueue, next_instrm, nctl) { + TAILQ_FOREACH_SAFE(control, &asoc->strmin[strmat].inqueue, next_instrm, ncontrol) { #ifdef INVARIANTS - if (ctl->on_strm_q != SCTP_ON_ORDERED) { + if (control->on_strm_q != SCTP_ON_ORDERED) { panic("Huh control: %p on_q: %d -- not ordered?", - ctl, ctl->on_strm_q); + control, control->on_strm_q); } #endif - if (SCTP_TSN_GT(ctl->sinfo_tsn, cumulative_tsn_p1)) { + if (SCTP_TSN_GT(control->sinfo_tsn, cumulative_tsn_p1)) { /* Yep it is above cum-ack */ cnt++; - SCTP_CALC_TSN_TO_GAP(gap, ctl->sinfo_tsn, asoc->mapping_array_base_tsn); - asoc->size_on_all_streams = sctp_sbspace_sub(asoc->size_on_all_streams, ctl->length); + SCTP_CALC_TSN_TO_GAP(gap, control->sinfo_tsn, asoc->mapping_array_base_tsn); + KASSERT(control->length > 0, ("control has zero length")); + if (asoc->size_on_all_streams >= control->length) { + asoc->size_on_all_streams -= control->length; + } else { +#ifdef INVARIANTS + panic("size_on_all_streams = %u smaller than control length %u", asoc->size_on_all_streams, control->length); +#else + asoc->size_on_all_streams = 0; +#endif + } sctp_ucount_decr(asoc->cnt_on_all_streams); SCTP_UNSET_TSN_PRESENT(asoc->mapping_array, gap); - if (ctl->on_read_q) { - TAILQ_REMOVE(&stcb->sctp_ep->read_queue, ctl, next); - ctl->on_read_q = 0; + if (control->on_read_q) { + TAILQ_REMOVE(&stcb->sctp_ep->read_queue, control, next); + control->on_read_q = 0; } - TAILQ_REMOVE(&asoc->strmin[strmat].inqueue, ctl, next_instrm); - ctl->on_strm_q = 0; - if (ctl->data) { - sctp_m_freem(ctl->data); - ctl->data = NULL; + TAILQ_REMOVE(&asoc->strmin[strmat].inqueue, control, next_instrm); + control->on_strm_q = 0; + if (control->data) { + sctp_m_freem(control->data); + control->data = NULL; } - sctp_free_remote_addr(ctl->whoFrom); + sctp_free_remote_addr(control->whoFrom); /* Now its reasm? */ - TAILQ_FOREACH_SAFE(chk, &ctl->reasm, sctp_next, nchk) { + TAILQ_FOREACH_SAFE(chk, &control->reasm, sctp_next, nchk) { cnt++; SCTP_CALC_TSN_TO_GAP(gap, chk->rec.data.tsn, asoc->mapping_array_base_tsn); - asoc->size_on_reasm_queue = sctp_sbspace_sub(asoc->size_on_reasm_queue, chk->send_size); + KASSERT(chk->send_size > 0, ("chunk has zero length")); + if (asoc->size_on_reasm_queue >= chk->send_size) { + asoc->size_on_reasm_queue -= chk->send_size; + } else { +#ifdef INVARIANTS + panic("size_on_reasm_queue = %u smaller than chunk length %u", asoc->size_on_reasm_queue, chk->send_size); +#else + asoc->size_on_reasm_queue = 0; +#endif + } sctp_ucount_decr(asoc->cnt_on_reasm_queue); SCTP_UNSET_TSN_PRESENT(asoc->mapping_array, gap); - TAILQ_REMOVE(&ctl->reasm, chk, sctp_next); + TAILQ_REMOVE(&control->reasm, chk, sctp_next); if (chk->data) { sctp_m_freem(chk->data); chk->data = NULL; } sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); } - sctp_free_a_readq(stcb, ctl); + sctp_free_a_readq(stcb, control); } } - TAILQ_FOREACH_SAFE(ctl, &asoc->strmin[strmat].uno_inqueue, next_instrm, nctl) { + TAILQ_FOREACH_SAFE(control, &asoc->strmin[strmat].uno_inqueue, next_instrm, ncontrol) { #ifdef INVARIANTS - if (ctl->on_strm_q != SCTP_ON_UNORDERED) { + if (control->on_strm_q != SCTP_ON_UNORDERED) { panic("Huh control: %p on_q: %d -- not unordered?", - ctl, ctl->on_strm_q); + control, control->on_strm_q); } #endif - if (SCTP_TSN_GT(ctl->sinfo_tsn, cumulative_tsn_p1)) { + if (SCTP_TSN_GT(control->sinfo_tsn, cumulative_tsn_p1)) { /* Yep it is above cum-ack */ cnt++; - SCTP_CALC_TSN_TO_GAP(gap, ctl->sinfo_tsn, asoc->mapping_array_base_tsn); - asoc->size_on_all_streams = sctp_sbspace_sub(asoc->size_on_all_streams, ctl->length); + SCTP_CALC_TSN_TO_GAP(gap, control->sinfo_tsn, asoc->mapping_array_base_tsn); + KASSERT(control->length > 0, ("control has zero length")); + if (asoc->size_on_all_streams >= control->length) { + asoc->size_on_all_streams -= control->length; + } else { +#ifdef INVARIANTS + panic("size_on_all_streams = %u smaller than control length %u", asoc->size_on_all_streams, control->length); +#else + asoc->size_on_all_streams = 0; +#endif + } sctp_ucount_decr(asoc->cnt_on_all_streams); SCTP_UNSET_TSN_PRESENT(asoc->mapping_array, gap); - if (ctl->on_read_q) { - TAILQ_REMOVE(&stcb->sctp_ep->read_queue, ctl, next); - ctl->on_read_q = 0; + if (control->on_read_q) { + TAILQ_REMOVE(&stcb->sctp_ep->read_queue, control, next); + control->on_read_q = 0; } - TAILQ_REMOVE(&asoc->strmin[strmat].uno_inqueue, ctl, next_instrm); - ctl->on_strm_q = 0; - if (ctl->data) { - sctp_m_freem(ctl->data); - ctl->data = NULL; + TAILQ_REMOVE(&asoc->strmin[strmat].uno_inqueue, control, next_instrm); + control->on_strm_q = 0; + if (control->data) { + sctp_m_freem(control->data); + control->data = NULL; } - sctp_free_remote_addr(ctl->whoFrom); + sctp_free_remote_addr(control->whoFrom); /* Now its reasm? */ - TAILQ_FOREACH_SAFE(chk, &ctl->reasm, sctp_next, nchk) { + TAILQ_FOREACH_SAFE(chk, &control->reasm, sctp_next, nchk) { cnt++; SCTP_CALC_TSN_TO_GAP(gap, chk->rec.data.tsn, asoc->mapping_array_base_tsn); - asoc->size_on_reasm_queue = sctp_sbspace_sub(asoc->size_on_reasm_queue, chk->send_size); + KASSERT(chk->send_size > 0, ("chunk has zero length")); + if (asoc->size_on_reasm_queue >= chk->send_size) { + asoc->size_on_reasm_queue -= chk->send_size; + } else { +#ifdef INVARIANTS + panic("size_on_reasm_queue = %u smaller than chunk length %u", asoc->size_on_reasm_queue, chk->send_size); +#else + asoc->size_on_reasm_queue = 0; +#endif + } sctp_ucount_decr(asoc->cnt_on_reasm_queue); SCTP_UNSET_TSN_PRESENT(asoc->mapping_array, gap); - TAILQ_REMOVE(&ctl->reasm, chk, sctp_next); + TAILQ_REMOVE(&control->reasm, chk, sctp_next); if (chk->data) { sctp_m_freem(chk->data); chk->data = NULL; } sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); } - sctp_free_a_readq(stcb, ctl); + sctp_free_a_readq(stcb, control); } } } Modified: stable/11/sys/netinet/sctputil.c ============================================================================== --- stable/11/sys/netinet/sctputil.c Sat Apr 7 14:40:09 2018 (r332170) +++ stable/11/sys/netinet/sctputil.c Sat Apr 7 14:40:21 2018 (r332171) @@ -2754,9 +2754,9 @@ sctp_notify_assoc_change(uint16_t state, struct sctp_t m_notify); if (control != NULL) { control->length = SCTP_BUF_LEN(m_notify); + control->spec_flags = M_NOTIFICATION; /* not that we need this */ control->tail_mbuf = m_notify; - control->spec_flags = M_NOTIFICATION; sctp_add_to_readq(stcb->sctp_ep, stcb, control, &stcb->sctp_socket->so_rcv, 1, SCTP_READ_LOCK_NOT_HELD, @@ -3038,7 +3038,10 @@ sctp_notify_send_failed(struct sctp_tcb *stcb, uint8_t sctp_m_freem(m_notify); return; } + control->length = SCTP_BUF_LEN(m_notify); control->spec_flags = M_NOTIFICATION; + /* not that we need this */ + control->tail_mbuf = m_notify; sctp_add_to_readq(stcb->sctp_ep, stcb, control, &stcb->sctp_socket->so_rcv, 1, @@ -3138,7 +3141,10 @@ sctp_notify_send_failed2(struct sctp_tcb *stcb, uint32 sctp_m_freem(m_notify); return; } + control->length = SCTP_BUF_LEN(m_notify); control->spec_flags = M_NOTIFICATION; + /* not that we need this */ + control->tail_mbuf = m_notify; sctp_add_to_readq(stcb->sctp_ep, stcb, control, &stcb->sctp_socket->so_rcv, 1, SCTP_READ_LOCK_NOT_HELD, so_locked); @@ -3239,12 +3245,10 @@ sctp_notify_partial_delivery_indication(struct sctp_tc sctp_m_freem(m_notify); return; } - control->spec_flags = M_NOTIFICATION; control->length = SCTP_BUF_LEN(m_notify); + control->spec_flags = M_NOTIFICATION; /* not that we need this */ control->tail_mbuf = m_notify; - control->held_length = 0; - control->length = 0; sb = &stcb->sctp_socket->so_rcv; if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_SB_LOGGING_ENABLE) { sctp_sblog(sb, control->do_not_ref_stcb ? NULL : stcb, SCTP_LOG_SBALLOC, SCTP_BUF_LEN(m_notify)); @@ -3253,7 +3257,6 @@ sctp_notify_partial_delivery_indication(struct sctp_tc if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_SB_LOGGING_ENABLE) { sctp_sblog(sb, control->do_not_ref_stcb ? NULL : stcb, SCTP_LOG_SBRESULT, 0); } - atomic_add_int(&control->length, SCTP_BUF_LEN(m_notify)); control->end_added = 1; if (stcb->asoc.control_pdapi) TAILQ_INSERT_AFTER(&stcb->sctp_ep->read_queue, stcb->asoc.control_pdapi, control, next); @@ -3348,8 +3351,8 @@ sctp_notify_shutdown_event(struct sctp_tcb *stcb) sctp_m_freem(m_notify); return; } - control->spec_flags = M_NOTIFICATION; control->length = SCTP_BUF_LEN(m_notify); + control->spec_flags = M_NOTIFICATION; /* not that we need this */ control->tail_mbuf = m_notify; sctp_add_to_readq(stcb->sctp_ep, stcb, @@ -3455,8 +3458,8 @@ sctp_notify_stream_reset_add(struct sctp_tcb *stcb, ui sctp_m_freem(m_notify); return; } - control->spec_flags = M_NOTIFICATION; control->length = SCTP_BUF_LEN(m_notify); + control->spec_flags = M_NOTIFICATION; /* not that we need this */ control->tail_mbuf = m_notify; sctp_add_to_readq(stcb->sctp_ep, stcb, @@ -3505,8 +3508,8 @@ sctp_notify_stream_reset_tsn(struct sctp_tcb *stcb, ui sctp_m_freem(m_notify); return; } - control->spec_flags = M_NOTIFICATION; control->length = SCTP_BUF_LEN(m_notify); + control->spec_flags = M_NOTIFICATION; /* not that we need this */ control->tail_mbuf = m_notify; sctp_add_to_readq(stcb->sctp_ep, stcb, @@ -3570,8 +3573,8 @@ sctp_notify_stream_reset(struct sctp_tcb *stcb, sctp_m_freem(m_notify); return; } - control->spec_flags = M_NOTIFICATION; control->length = SCTP_BUF_LEN(m_notify); + control->spec_flags = M_NOTIFICATION; /* not that we need this */ control->tail_mbuf = m_notify; sctp_add_to_readq(stcb->sctp_ep, stcb, @@ -3626,9 +3629,9 @@ sctp_notify_remote_error(struct sctp_tcb *stcb, uint16 m_notify); if (control != NULL) { control->length = SCTP_BUF_LEN(m_notify); + control->spec_flags = M_NOTIFICATION; /* not that we need this */ control->tail_mbuf = m_notify; - control->spec_flags = M_NOTIFICATION; sctp_add_to_readq(stcb->sctp_ep, stcb, control, &stcb->sctp_socket->so_rcv, 1, From owner-svn-src-stable-11@freebsd.org Sat Apr 7 14:41:46 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 07B0BF8D96C; Sat, 7 Apr 2018 14:41:46 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A5D72874E6; Sat, 7 Apr 2018 14:41:45 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9FAAA221A3; Sat, 7 Apr 2018 14:41:45 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37EfjNL009608; Sat, 7 Apr 2018 14:41:45 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37EfiO8009601; Sat, 7 Apr 2018 14:41:44 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071441.w37EfiO8009601@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 14:41: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: r332172 - in stable/11/sys: netinet netinet6 X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in stable/11/sys: netinet netinet6 X-SVN-Commit-Revision: 332172 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 14:41:46 -0000 Author: tuexen Date: Sat Apr 7 14:41:44 2018 New Revision: 332172 URL: https://svnweb.freebsd.org/changeset/base/332172 Log: MFC r321204: Use memset/memcpy instead of bzero/bcopy. Just use one variant instead of both. Use the memset/memcpy ones since they cause less problems in crossplatform deployment. Modified: stable/11/sys/netinet/sctp_asconf.c stable/11/sys/netinet/sctp_auth.c stable/11/sys/netinet/sctp_output.c stable/11/sys/netinet/sctp_pcb.c stable/11/sys/netinet/sctp_usrreq.c stable/11/sys/netinet/sctputil.c stable/11/sys/netinet6/sctp6_usrreq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_asconf.c ============================================================================== --- stable/11/sys/netinet/sctp_asconf.c Sat Apr 7 14:40:21 2018 (r332171) +++ stable/11/sys/netinet/sctp_asconf.c Sat Apr 7 14:41:44 2018 (r332172) @@ -182,7 +182,7 @@ sctp_process_asconf_add_ip(struct sockaddr *src, struc } v4addr = (struct sctp_ipv4addr_param *)ph; sin = &store.sin; - bzero(sin, sizeof(*sin)); + memset(sin, 0, sizeof(*sin)); sin->sin_family = AF_INET; sin->sin_len = sizeof(struct sockaddr_in); sin->sin_port = stcb->rport; @@ -205,7 +205,7 @@ sctp_process_asconf_add_ip(struct sockaddr *src, struc } v6addr = (struct sctp_ipv6addr_param *)ph; sin6 = &store.sin6; - bzero(sin6, sizeof(*sin6)); + memset(sin6, 0, sizeof(*sin6)); sin6->sin6_family = AF_INET6; sin6->sin6_len = sizeof(struct sockaddr_in6); sin6->sin6_port = stcb->rport; @@ -332,7 +332,7 @@ sctp_process_asconf_delete_ip(struct sockaddr *src, } v4addr = (struct sctp_ipv4addr_param *)ph; sin = &store.sin; - bzero(sin, sizeof(*sin)); + memset(sin, 0, sizeof(*sin)); sin->sin_family = AF_INET; sin->sin_len = sizeof(struct sockaddr_in); sin->sin_port = stcb->rport; @@ -352,7 +352,7 @@ sctp_process_asconf_delete_ip(struct sockaddr *src, } v6addr = (struct sctp_ipv6addr_param *)ph; sin6 = &store.sin6; - bzero(sin6, sizeof(*sin6)); + memset(sin6, 0, sizeof(*sin6)); sin6->sin6_family = AF_INET6; sin6->sin6_len = sizeof(struct sockaddr_in6); sin6->sin6_port = stcb->rport; @@ -461,7 +461,7 @@ sctp_process_asconf_set_primary(struct sockaddr *src, } v4addr = (struct sctp_ipv4addr_param *)ph; sin = &store.sin; - bzero(sin, sizeof(*sin)); + memset(sin, 0, sizeof(*sin)); sin->sin_family = AF_INET; sin->sin_len = sizeof(struct sockaddr_in); sin->sin_addr.s_addr = v4addr->addr; @@ -479,7 +479,7 @@ sctp_process_asconf_set_primary(struct sockaddr *src, } v6addr = (struct sctp_ipv6addr_param *)ph; sin6 = &store.sin6; - bzero(sin6, sizeof(*sin6)); + memset(sin6, 0, sizeof(*sin6)); sin6->sin6_family = AF_INET6; sin6->sin6_len = sizeof(struct sockaddr_in6); memcpy((caddr_t)&sin6->sin6_addr, v6addr->addr, @@ -2604,7 +2604,7 @@ sctp_compose_asconf(struct sctp_tcb *stcb, int *retlen SCTP_BUF_LEN(m_asconf_chk) = sizeof(struct sctp_asconf_chunk); SCTP_BUF_LEN(m_asconf) = 0; acp = mtod(m_asconf_chk, struct sctp_asconf_chunk *); - bzero(acp, sizeof(struct sctp_asconf_chunk)); + memset(acp, 0, sizeof(struct sctp_asconf_chunk)); /* save pointers to lookup address and asconf params */ lookup_ptr = (caddr_t)(acp + 1); /* after the header */ ptr = mtod(m_asconf, caddr_t); /* beginning of cluster */ @@ -2737,7 +2737,7 @@ sctp_compose_asconf(struct sctp_tcb *stcb, int *retlen /* XXX for now, we send a IPv4 address of 0.0.0.0 */ lookup->ph.param_type = htons(SCTP_IPV4_ADDRESS); lookup->ph.param_length = htons(SCTP_SIZE32(sizeof(struct sctp_ipv4addr_param))); - bzero(lookup->addr, sizeof(struct in_addr)); + memset(lookup->addr, 0, sizeof(struct in_addr)); SCTP_BUF_LEN(m_asconf_chk) += SCTP_SIZE32(sizeof(struct sctp_ipv4addr_param)); } } Modified: stable/11/sys/netinet/sctp_auth.c ============================================================================== --- stable/11/sys/netinet/sctp_auth.c Sat Apr 7 14:40:21 2018 (r332171) +++ stable/11/sys/netinet/sctp_auth.c Sat Apr 7 14:41:44 2018 (r332172) @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); void sctp_clear_chunklist(sctp_auth_chklist_t *chklist) { - bzero(chklist, sizeof(*chklist)); + memset(chklist, 0, sizeof(*chklist)); /* chklist->num_chunks = 0; */ } @@ -92,7 +92,7 @@ sctp_copy_chunklist(sctp_auth_chklist_t *list) if (new_list == NULL) return (NULL); /* copy it */ - bcopy(list, new_list, sizeof(*new_list)); + memcpy(new_list, list, sizeof(*new_list)); return (new_list); } @@ -338,7 +338,7 @@ sctp_set_key(uint8_t *key, uint32_t keylen) /* out of memory */ return (NULL); } - bcopy(key, new_key->key, keylen); + memcpy(new_key->key, key, keylen); return (new_key); } @@ -427,28 +427,28 @@ sctp_compute_hashkey(sctp_key_t *key1, sctp_key_t *key if (sctp_compare_key(key1, key2) <= 0) { /* key is shared + key1 + key2 */ if (sctp_get_keylen(shared)) { - bcopy(shared->key, key_ptr, shared->keylen); + memcpy(key_ptr, shared->key, shared->keylen); key_ptr += shared->keylen; } if (sctp_get_keylen(key1)) { - bcopy(key1->key, key_ptr, key1->keylen); + memcpy(key_ptr, key1->key, key1->keylen); key_ptr += key1->keylen; } if (sctp_get_keylen(key2)) { - bcopy(key2->key, key_ptr, key2->keylen); + memcpy(key_ptr, key2->key, key2->keylen); } } else { /* key is shared + key2 + key1 */ if (sctp_get_keylen(shared)) { - bcopy(shared->key, key_ptr, shared->keylen); + memcpy(key_ptr, shared->key, shared->keylen); key_ptr += shared->keylen; } if (sctp_get_keylen(key2)) { - bcopy(key2->key, key_ptr, key2->keylen); + memcpy(key_ptr, key2->key, key2->keylen); key_ptr += key2->keylen; } if (sctp_get_keylen(key1)) { - bcopy(key1->key, key_ptr, key1->keylen); + memcpy(key_ptr, key1->key, key1->keylen); } } return (new_key); @@ -764,7 +764,7 @@ sctp_serialize_hmaclist(sctp_hmaclist_t *list, uint8_t for (i = 0; i < list->num_algo; i++) { hmac_id = htons(list->hmac[i]); - bcopy(&hmac_id, ptr, sizeof(hmac_id)); + memcpy(ptr, &hmac_id, sizeof(hmac_id)); ptr += sizeof(hmac_id); } return (list->num_algo * sizeof(hmac_id)); @@ -795,7 +795,7 @@ sctp_alloc_authinfo(void) /* out of memory */ return (NULL); } - bzero(new_authinfo, sizeof(*new_authinfo)); + memset(new_authinfo, 0, sizeof(*new_authinfo)); return (new_authinfo); } @@ -953,10 +953,10 @@ sctp_hmac(uint16_t hmac_algo, uint8_t *key, uint32_t k key = temp; } /* initialize the inner/outer pads with the key and "append" zeroes */ - bzero(ipad, blocklen); - bzero(opad, blocklen); - bcopy(key, ipad, keylen); - bcopy(key, opad, keylen); + memset(ipad, 0, blocklen); + memset(opad, 0, blocklen); + memcpy(ipad, key, keylen); + memcpy(opad, key, keylen); /* XOR the key with ipad and opad values */ for (i = 0; i < blocklen; i++) { @@ -1013,10 +1013,10 @@ sctp_hmac_m(uint16_t hmac_algo, uint8_t *key, uint32_t key = temp; } /* initialize the inner/outer pads with the key and "append" zeroes */ - bzero(ipad, blocklen); - bzero(opad, blocklen); - bcopy(key, ipad, keylen); - bcopy(key, opad, keylen); + memset(ipad, 0, blocklen); + memset(opad, 0, blocklen); + memcpy(ipad, key, keylen); + memcpy(opad, key, keylen); /* XOR the key with ipad and opad values */ for (i = 0; i < blocklen; i++) { @@ -1124,7 +1124,7 @@ sctp_compute_hmac(uint16_t hmac_algo, sctp_key_t *key, sctp_hmac_final(hmac_algo, &ctx, temp); /* save the hashed key as the new key */ key->keylen = digestlen; - bcopy(temp, key->key, key->keylen); + memcpy(key->key, temp, key->keylen); } return (sctp_hmac(hmac_algo, key->key, key->keylen, text, textlen, digest)); @@ -1158,7 +1158,7 @@ sctp_compute_hmac_m(uint16_t hmac_algo, sctp_key_t *ke sctp_hmac_final(hmac_algo, &ctx, temp); /* save the hashed key as the new key */ key->keylen = digestlen; - bcopy(temp, key->key, key->keylen); + memcpy(key->key, temp, key->keylen); } return (sctp_hmac_m(hmac_algo, key->key, key->keylen, m, m_offset, digest, 0)); } @@ -1501,17 +1501,17 @@ sctp_auth_get_cookie_params(struct sctp_tcb *stcb, str /* copy in the RANDOM */ if (p_random != NULL) { keylen = sizeof(*p_random) + random_len; - bcopy(p_random, new_key->key, keylen); + memcpy(new_key->key, p_random, keylen); } /* append in the AUTH chunks */ if (chunks != NULL) { - bcopy(chunks, new_key->key + keylen, + memcpy(new_key->key + keylen, chunks, sizeof(*chunks) + num_chunks); keylen += sizeof(*chunks) + num_chunks; } /* append in the HMACs */ if (hmacs != NULL) { - bcopy(hmacs, new_key->key + keylen, + memcpy(new_key->key + keylen, hmacs, sizeof(*hmacs) + hmacs_len); } } @@ -1550,7 +1550,7 @@ sctp_fill_hmac_digest_m(struct mbuf *m, uint32_t auth_ /* zero the digest + chunk padding */ digestlen = sctp_get_hmac_digest_len(stcb->asoc.peer_hmac_id); - bzero(auth->hmac, SCTP_SIZE32(digestlen)); + memset(auth->hmac, 0, SCTP_SIZE32(digestlen)); /* is the desired key cached? */ if ((keyid != stcb->asoc.authinfo.assoc_keyid) || @@ -1588,7 +1588,7 @@ sctp_fill_hmac_digest_m(struct mbuf *m, uint32_t auth_ static void -sctp_bzero_m(struct mbuf *m, uint32_t m_offset, uint32_t size) +sctp_zero_m(struct mbuf *m, uint32_t m_offset, uint32_t size) { struct mbuf *m_tmp; uint8_t *data; @@ -1607,10 +1607,10 @@ sctp_bzero_m(struct mbuf *m, uint32_t m_offset, uint32 while ((m_tmp != NULL) && (size > 0)) { data = mtod(m_tmp, uint8_t *)+m_offset; if (size > (uint32_t)SCTP_BUF_LEN(m_tmp)) { - bzero(data, SCTP_BUF_LEN(m_tmp)); + memset(data, 0, SCTP_BUF_LEN(m_tmp)); size -= SCTP_BUF_LEN(m_tmp); } else { - bzero(data, size); + memset(data, 0, size); size = 0; } /* clear the offset since it's only for the first mbuf */ @@ -1727,8 +1727,8 @@ sctp_handle_auth(struct sctp_tcb *stcb, struct sctp_au return (-1); } /* save a copy of the digest, zero the pseudo header, and validate */ - bcopy(auth->hmac, digest, digestlen); - sctp_bzero_m(m, offset + sizeof(*auth), SCTP_SIZE32(digestlen)); + memcpy(digest, auth->hmac, digestlen); + sctp_zero_m(m, offset + sizeof(*auth), SCTP_SIZE32(digestlen)); (void)sctp_compute_hmac_m(hmac_id, stcb->asoc.authinfo.recv_key, m, offset, computed_digest); Modified: stable/11/sys/netinet/sctp_output.c ============================================================================== --- stable/11/sys/netinet/sctp_output.c Sat Apr 7 14:40:21 2018 (r332171) +++ stable/11/sys/netinet/sctp_output.c Sat Apr 7 14:41:44 2018 (r332172) @@ -4404,7 +4404,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, * we can try their selection but it may not be * bound. */ - bzero(&lsa6_tmp, sizeof(lsa6_tmp)); + memset(&lsa6_tmp, 0, sizeof(lsa6_tmp)); lsa6_tmp.sin6_family = AF_INET6; lsa6_tmp.sin6_len = sizeof(lsa6_tmp); lsa6 = &lsa6_tmp; @@ -4489,7 +4489,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, * XXX: sa6 may not have a valid sin6_scope_id in * the non-SCOPEDROUTING case. */ - bzero(&lsa6_storage, sizeof(lsa6_storage)); + memset(&lsa6_storage, 0, sizeof(lsa6_storage)); lsa6_storage.sin6_family = AF_INET6; lsa6_storage.sin6_len = sizeof(lsa6_storage); lsa6_storage.sin6_addr = lsa6->sin6_addr; @@ -13730,7 +13730,7 @@ sctp_add_auth_chunk(struct mbuf *m, struct mbuf **m_en SCTP_BUF_RESV_UF(m_auth, SCTP_MIN_OVERHEAD); /* fill in the AUTH chunk details */ auth = mtod(m_auth, struct sctp_auth_chunk *); - bzero(auth, sizeof(*auth)); + memset(auth, 0, sizeof(*auth)); auth->ch.chunk_type = SCTP_AUTHENTICATION; auth->ch.chunk_flags = 0; chunk_len = sizeof(*auth) + Modified: stable/11/sys/netinet/sctp_pcb.c ============================================================================== --- stable/11/sys/netinet/sctp_pcb.c Sat Apr 7 14:40:21 2018 (r332171) +++ stable/11/sys/netinet/sctp_pcb.c Sat Apr 7 14:41:44 2018 (r332172) @@ -702,7 +702,7 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint3 return (NULL); } SCTP_INCR_LADDR_COUNT(); - bzero(wi, sizeof(*wi)); + memset(wi, 0, sizeof(*wi)); (void)SCTP_GETTIME_TIMEVAL(&wi->start_time); wi->ifa = sctp_ifap; wi->action = SCTP_ADD_IP_ADDRESS; @@ -811,7 +811,7 @@ out_now: return; } SCTP_INCR_LADDR_COUNT(); - bzero(wi, sizeof(*wi)); + memset(wi, 0, sizeof(*wi)); (void)SCTP_GETTIME_TIMEVAL(&wi->start_time); wi->ifa = sctp_ifap; wi->action = SCTP_DEL_IP_ADDRESS; @@ -2429,7 +2429,7 @@ sctp_inpcb_alloc(struct socket *so, uint32_t vrf_id) return (ENOBUFS); } /* zap it */ - bzero(inp, sizeof(*inp)); + memset(inp, 0, sizeof(*inp)); /* bump generations */ /* setup socket pointers */ @@ -2715,7 +2715,7 @@ sctp_move_pcb_and_assoc(struct sctp_inpcb *old_inp, st continue; } SCTP_INCR_LADDR_COUNT(); - bzero(laddr, sizeof(*laddr)); + memset(laddr, 0, sizeof(*laddr)); (void)SCTP_GETTIME_TIMEVAL(&laddr->start_time); laddr->ifa = oladdr->ifa; atomic_add_int(&laddr->ifa->refcount, 1); @@ -2765,7 +2765,7 @@ sctp_insert_laddr(struct sctpladdr *list, struct sctp_ return (EINVAL); } SCTP_INCR_LADDR_COUNT(); - bzero(laddr, sizeof(*laddr)); + memset(laddr, 0, sizeof(*laddr)); (void)SCTP_GETTIME_TIMEVAL(&laddr->start_time); laddr->ifa = ifa; laddr->action = act; @@ -3766,7 +3766,7 @@ sctp_add_remote_addr(struct sctp_tcb *stcb, struct soc /* Invalid address */ return (-1); } - /* zero out the bzero area */ + /* zero out the zero area */ memset(&sin->sin_zero, 0, sizeof(sin->sin_zero)); /* assure len is set */ @@ -3849,7 +3849,7 @@ sctp_add_remote_addr(struct sctp_tcb *stcb, struct soc return (-1); } SCTP_INCR_RADDR_COUNT(); - bzero(net, sizeof(struct sctp_nets)); + memset(net, 0, sizeof(struct sctp_nets)); (void)SCTP_GETTIME_TIMEVAL(&net->start_time); memcpy(&net->ro._l_addr, newaddr, newaddr->sa_len); switch (newaddr->sa_family) { @@ -4285,7 +4285,7 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockadd } SCTP_INCR_ASOC_COUNT(); - bzero(stcb, sizeof(*stcb)); + memset(stcb, 0, sizeof(*stcb)); asoc = &stcb->asoc; asoc->assoc_id = sctp_aloc_a_assoc_id(inp, stcb); @@ -5731,7 +5731,7 @@ sctp_pcb_init() SCTP_BASE_VAR(sctp_pcb_initialized) = 1; #if defined(SCTP_LOCAL_TRACE_BUF) - bzero(&SCTP_BASE_SYSCTL(sctp_log), sizeof(struct sctp_log)); + memset(&SCTP_BASE_SYSCTL(sctp_log), 0, sizeof(struct sctp_log)); #endif #if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT) SCTP_MALLOC(SCTP_BASE_STATS, struct sctpstat *, @@ -5740,11 +5740,11 @@ sctp_pcb_init() #endif (void)SCTP_GETTIME_TIMEVAL(&tv); #if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT) - bzero(SCTP_BASE_STATS, (sizeof(struct sctpstat) * (mp_maxid + 1))); + memset(SCTP_BASE_STATS, 0, sizeof(struct sctpstat) * (mp_maxid + 1)); SCTP_BASE_STATS[PCPU_GET(cpuid)].sctps_discontinuitytime.tv_sec = (uint32_t)tv.tv_sec; SCTP_BASE_STATS[PCPU_GET(cpuid)].sctps_discontinuitytime.tv_usec = (uint32_t)tv.tv_usec; #else - bzero(&SCTP_BASE_STATS, sizeof(struct sctpstat)); + memset(&SCTP_BASE_STATS, 0, sizeof(struct sctpstat)); SCTP_BASE_STAT(sctps_discontinuitytime).tv_sec = (uint32_t)tv.tv_sec; SCTP_BASE_STAT(sctps_discontinuitytime).tv_usec = (uint32_t)tv.tv_usec; #endif @@ -6656,17 +6656,17 @@ next_param: /* copy in the RANDOM */ if (p_random != NULL) { keylen = sizeof(*p_random) + random_len; - bcopy(p_random, new_key->key, keylen); + memcpy(new_key->key, p_random, keylen); } /* append in the AUTH chunks */ if (chunks != NULL) { - bcopy(chunks, new_key->key + keylen, + memcpy(new_key->key + keylen, chunks, sizeof(*chunks) + num_chunks); keylen += sizeof(*chunks) + num_chunks; } /* append in the HMACs */ if (hmacs != NULL) { - bcopy(hmacs, new_key->key + keylen, + memcpy(new_key->key + keylen, hmacs, sizeof(*hmacs) + hmacs_len); } } else { Modified: stable/11/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/11/sys/netinet/sctp_usrreq.c Sat Apr 7 14:40:21 2018 (r332171) +++ stable/11/sys/netinet/sctp_usrreq.c Sat Apr 7 14:41:44 2018 (r332172) @@ -85,7 +85,7 @@ sctp_init(void) #if defined(SCTP_PACKET_LOGGING) SCTP_BASE_VAR(packet_log_writers) = 0; SCTP_BASE_VAR(packet_log_end) = 0; - bzero(&SCTP_BASE_VAR(packet_log_buffer), SCTP_PACKET_LOG_SIZE); + memset(&SCTP_BASE_VAR(packet_log_buffer), 0, SCTP_PACKET_LOG_SIZE); #endif } Modified: stable/11/sys/netinet/sctputil.c ============================================================================== --- stable/11/sys/netinet/sctputil.c Sat Apr 7 14:40:21 2018 (r332171) +++ stable/11/sys/netinet/sctputil.c Sat Apr 7 14:41:44 2018 (r332172) @@ -2593,7 +2593,7 @@ sctp_m_getptr(struct mbuf *m, int off, int len, uint8_ /* else, it spans more than one mbuf, so save a temp copy... */ while ((m != NULL) && (len > 0)) { count = min(SCTP_BUF_LEN(m) - off, len); - bcopy(mtod(m, caddr_t)+off, ptr, count); + memcpy(ptr, mtod(m, caddr_t)+off, count); len -= count; ptr += count; off = 0; @@ -6166,7 +6166,7 @@ sctp_dynamic_set_primary(struct sockaddr *sa, uint32_t } /* Now incr the count and int wi structure */ SCTP_INCR_LADDR_COUNT(); - bzero(wi, sizeof(*wi)); + memset(wi, 0, sizeof(*wi)); (void)SCTP_GETTIME_TIMEVAL(&wi->start_time); wi->ifa = ifa; wi->action = SCTP_SET_PRIM_ADDR; Modified: stable/11/sys/netinet6/sctp6_usrreq.c ============================================================================== --- stable/11/sys/netinet6/sctp6_usrreq.c Sat Apr 7 14:40:21 2018 (r332171) +++ stable/11/sys/netinet6/sctp6_usrreq.c Sat Apr 7 14:41:44 2018 (r332172) @@ -305,7 +305,7 @@ sctp6_ctlinput(int cmd, struct sockaddr *pktdst, void return; } /* Copy out the port numbers and the verification tag. */ - bzero(&sh, sizeof(sh)); + memset(&sh, 0, sizeof(sh)); m_copydata(ip6cp->ip6c_m, ip6cp->ip6c_off, sizeof(uint16_t) + sizeof(uint16_t) + sizeof(uint32_t), From owner-svn-src-stable-11@freebsd.org Sat Apr 7 14:43:02 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ED095F8DAED; Sat, 7 Apr 2018 14:43:01 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 967316825A; Sat, 7 Apr 2018 14:43:01 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 914FE222DB; Sat, 7 Apr 2018 14:43:01 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37Eh19W011141; Sat, 7 Apr 2018 14:43:01 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37Eh1hd011140; Sat, 7 Apr 2018 14:43:01 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071443.w37Eh1hd011140@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 14:43: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: r332174 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332174 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 14:43:02 -0000 Author: tuexen Date: Sat Apr 7 14:43:01 2018 New Revision: 332174 URL: https://svnweb.freebsd.org/changeset/base/332174 Log: MFC r321205: Avoid shadowed variables. Modified: stable/11/sys/netinet/sctp_indata.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_indata.c ============================================================================== --- stable/11/sys/netinet/sctp_indata.c Sat Apr 7 14:42:47 2018 (r332173) +++ stable/11/sys/netinet/sctp_indata.c Sat Apr 7 14:43:01 2018 (r332174) @@ -2071,12 +2071,12 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struc return (0); } if ((chk_flags & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) { - struct mbuf *m; + struct mbuf *mm; control->data = dmbuf; - m = control->data; - for (m = control->data; m; m = m->m_next) { - control->length += SCTP_BUF_LEN(m); + mm = control->data; + for (mm = control->data; mm; mm = mm->m_next) { + control->length += SCTP_BUF_LEN(mm); } control->tail_mbuf = NULL; control->end_added = 1; From owner-svn-src-stable-11@freebsd.org Sat Apr 7 14:44:22 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C55CF8DC87; Sat, 7 Apr 2018 14:44:22 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C5E5168EF6; Sat, 7 Apr 2018 14:44:21 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BFF38222DC; Sat, 7 Apr 2018 14:44:21 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37EiLXa011263; Sat, 7 Apr 2018 14:44:21 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37EiLvl011261; Sat, 7 Apr 2018 14:44:21 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071444.w37EiLvl011261@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 14:44:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332175 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332175 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 14:44:22 -0000 Author: tuexen Date: Sat Apr 7 14:44:21 2018 New Revision: 332175 URL: https://svnweb.freebsd.org/changeset/base/332175 Log: MFC r321289: Fix the explicit EOR mode. If the final messages is not complete, send an ABORT. Joint work with rrs@ Modified: stable/11/sys/netinet/sctp_indata.c stable/11/sys/netinet/sctp_ss_functions.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_indata.c ============================================================================== --- stable/11/sys/netinet/sctp_indata.c Sat Apr 7 14:43:01 2018 (r332174) +++ stable/11/sys/netinet/sctp_indata.c Sat Apr 7 14:44:21 2018 (r332175) @@ -4293,47 +4293,44 @@ again: ((*asoc->ss_functions.sctp_ss_is_user_msgs_incomplete) (stcb, asoc))) { asoc->state |= SCTP_STATE_PARTIAL_MSG_LEFT; } + if (((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) || + (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) && + (asoc->stream_queue_cnt == 1) && + (asoc->state & SCTP_STATE_PARTIAL_MSG_LEFT)) { + struct mbuf *op_err; + + *abort_now = 1; + /* XXX */ + op_err = sctp_generate_cause(SCTP_CAUSE_USER_INITIATED_ABT, ""); + stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_24; + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + return; + } if ((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) && (asoc->stream_queue_cnt == 0)) { - if (asoc->state & SCTP_STATE_PARTIAL_MSG_LEFT) { - /* Need to abort here */ - struct mbuf *op_err; + struct sctp_nets *netp; - abort_out_now: - *abort_now = 1; - /* XXX */ - op_err = sctp_generate_cause(SCTP_CAUSE_USER_INITIATED_ABT, ""); - stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_24; - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); - return; + if ((SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) || + (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) { + SCTP_STAT_DECR_GAUGE32(sctps_currestab); + } + SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_SENT); + SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); + sctp_stop_timers_for_shutdown(stcb); + if (asoc->alternate) { + netp = asoc->alternate; } else { - struct sctp_nets *netp; - - if ((SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) || - (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) { - SCTP_STAT_DECR_GAUGE32(sctps_currestab); - } - SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_SENT); - SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); - sctp_stop_timers_for_shutdown(stcb); - if (asoc->alternate) { - netp = asoc->alternate; - } else { - netp = asoc->primary_destination; - } - sctp_send_shutdown(stcb, netp); - sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN, - stcb->sctp_ep, stcb, netp); - sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, - stcb->sctp_ep, stcb, netp); + netp = asoc->primary_destination; } + sctp_send_shutdown(stcb, netp); + sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN, + stcb->sctp_ep, stcb, netp); + sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, + stcb->sctp_ep, stcb, netp); } else if ((SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED) && (asoc->stream_queue_cnt == 0)) { struct sctp_nets *netp; - if (asoc->state & SCTP_STATE_PARTIAL_MSG_LEFT) { - goto abort_out_now; - } SCTP_STAT_DECR_GAUGE32(sctps_currestab); SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_ACK_SENT); SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); @@ -4989,48 +4986,45 @@ hopeless_peer: ((*asoc->ss_functions.sctp_ss_is_user_msgs_incomplete) (stcb, asoc))) { asoc->state |= SCTP_STATE_PARTIAL_MSG_LEFT; } + if (((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) || + (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) && + (asoc->stream_queue_cnt == 1) && + (asoc->state & SCTP_STATE_PARTIAL_MSG_LEFT)) { + struct mbuf *op_err; + + *abort_now = 1; + /* XXX */ + op_err = sctp_generate_cause(SCTP_CAUSE_USER_INITIATED_ABT, ""); + stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_24; + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); + return; + } if ((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) && (asoc->stream_queue_cnt == 0)) { - if (asoc->state & SCTP_STATE_PARTIAL_MSG_LEFT) { - /* Need to abort here */ - struct mbuf *op_err; + struct sctp_nets *netp; - abort_out_now: - *abort_now = 1; - /* XXX */ - op_err = sctp_generate_cause(SCTP_CAUSE_USER_INITIATED_ABT, ""); - stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_31; - sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); - return; + if ((SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) || + (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) { + SCTP_STAT_DECR_GAUGE32(sctps_currestab); + } + SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_SENT); + SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); + sctp_stop_timers_for_shutdown(stcb); + if (asoc->alternate) { + netp = asoc->alternate; } else { - struct sctp_nets *netp; - - if ((SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) || - (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) { - SCTP_STAT_DECR_GAUGE32(sctps_currestab); - } - SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_SENT); - SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); - sctp_stop_timers_for_shutdown(stcb); - if (asoc->alternate) { - netp = asoc->alternate; - } else { - netp = asoc->primary_destination; - } - sctp_send_shutdown(stcb, netp); - sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN, - stcb->sctp_ep, stcb, netp); - sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, - stcb->sctp_ep, stcb, netp); + netp = asoc->primary_destination; } + sctp_send_shutdown(stcb, netp); + sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN, + stcb->sctp_ep, stcb, netp); + sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, + stcb->sctp_ep, stcb, netp); return; } else if ((SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED) && (asoc->stream_queue_cnt == 0)) { struct sctp_nets *netp; - if (asoc->state & SCTP_STATE_PARTIAL_MSG_LEFT) { - goto abort_out_now; - } SCTP_STAT_DECR_GAUGE32(sctps_currestab); SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_ACK_SENT); SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); Modified: stable/11/sys/netinet/sctp_ss_functions.c ============================================================================== --- stable/11/sys/netinet/sctp_ss_functions.c Sat Apr 7 14:43:01 2018 (r332174) +++ stable/11/sys/netinet/sctp_ss_functions.c Sat Apr 7 14:44:21 2018 (r332175) @@ -268,9 +268,23 @@ sctp_ss_default_set_value(struct sctp_tcb *stcb SCTP_U } static int -sctp_ss_default_is_user_msgs_incomplete(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_association *asoc SCTP_UNUSED) +sctp_ss_default_is_user_msgs_incomplete(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_association *asoc) { - return (0); + struct sctp_stream_out *strq; + struct sctp_stream_queue_pending *sp; + + if (asoc->stream_queue_cnt != 1) { + return (0); + } + strq = asoc->ss_data.locked_on_sending; + if (strq == NULL) { + return (0); + } + sp = TAILQ_FIRST(&strq->outqueue); + if (sp == NULL) { + return (0); + } + return (!sp->msg_is_complete); } /* From owner-svn-src-stable-11@freebsd.org Sat Apr 7 14:45:55 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DAACDF8DDC6; Sat, 7 Apr 2018 14:45:55 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 90D8469D38; Sat, 7 Apr 2018 14:45:55 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8AC1F222DE; Sat, 7 Apr 2018 14:45:55 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37Ejteg011374; Sat, 7 Apr 2018 14:45:55 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37EjttO011373; Sat, 7 Apr 2018 14:45:55 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071445.w37EjttO011373@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 14:45: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: r332176 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332176 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 14:45:56 -0000 Author: tuexen Date: Sat Apr 7 14:45:55 2018 New Revision: 332176 URL: https://svnweb.freebsd.org/changeset/base/332176 Log: MFC r321463: Remove duplicate statement. Modified: stable/11/sys/netinet/sctp_indata.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_indata.c ============================================================================== --- stable/11/sys/netinet/sctp_indata.c Sat Apr 7 14:44:21 2018 (r332175) +++ stable/11/sys/netinet/sctp_indata.c Sat Apr 7 14:45:55 2018 (r332176) @@ -2074,7 +2074,6 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struc struct mbuf *mm; control->data = dmbuf; - mm = control->data; for (mm = control->data; mm; mm = mm->m_next) { control->length += SCTP_BUF_LEN(mm); } From owner-svn-src-stable-11@freebsd.org Sat Apr 7 15:10:09 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 187F6F8FBB9; Sat, 7 Apr 2018 15:10:09 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BA696771BE; Sat, 7 Apr 2018 15:10:08 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B105622618; Sat, 7 Apr 2018 15:10:08 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37FA83x021164; Sat, 7 Apr 2018 15:10:08 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37FA8FQ021163; Sat, 7 Apr 2018 15:10:08 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071510.w37FA8FQ021163@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 15:10:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332177 - stable/11/sys/netinet/tcp_stacks X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet/tcp_stacks X-SVN-Commit-Revision: 332177 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 15:10:09 -0000 Author: tuexen Date: Sat Apr 7 15:10:08 2018 New Revision: 332177 URL: https://svnweb.freebsd.org/changeset/base/332177 Log: MFC r322812: Avoid TCP log messages which are false positives. The check for timestamps are too early to handle SYN-ACK correctly. So move it down after the corresponing processing has been done. MFC r322813: Avoid TCP log messages which are false positives. This is https://svnweb.freebsd.org/changeset/base/322812, just for alternate TCP stacks. PR: 216832 Obtained from: antonfb@hesiod.org Modified: stable/11/sys/netinet/tcp_stacks/fastpath.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/tcp_stacks/fastpath.c ============================================================================== --- stable/11/sys/netinet/tcp_stacks/fastpath.c Sat Apr 7 14:45:55 2018 (r332176) +++ stable/11/sys/netinet/tcp_stacks/fastpath.c Sat Apr 7 15:10:08 2018 (r332177) @@ -1812,24 +1812,6 @@ tcp_do_segment_fastslow(struct mbuf *m, struct tcphdr if (TSTMP_GT(to.to_tsecr, tcp_ts_getticks())) to.to_tsecr = 0; } - /* - * If timestamps were negotiated during SYN/ACK they should - * appear on every segment during this session and vice versa. - */ - if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS)) { - if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { - log(LOG_DEBUG, "%s; %s: Timestamp missing, " - "no action\n", s, __func__); - free(s, M_TCPLOG); - } - } - if (!(tp->t_flags & TF_RCVD_TSTMP) && (to.to_flags & TOF_TS)) { - if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { - log(LOG_DEBUG, "%s; %s: Timestamp not expected, " - "no action\n", s, __func__); - free(s, M_TCPLOG); - } - } /* * Process options only when we get SYN/ACK back. The SYN case @@ -1860,6 +1842,26 @@ tcp_do_segment_fastslow(struct mbuf *m, struct tcphdr (to.to_flags & TOF_SACKPERM) == 0) tp->t_flags &= ~TF_SACK_PERMIT; } + + /* + * If timestamps were negotiated during SYN/ACK they should + * appear on every segment during this session and vice versa. + */ + if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS)) { + if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { + log(LOG_DEBUG, "%s; %s: Timestamp missing, " + "no action\n", s, __func__); + free(s, M_TCPLOG); + } + } + if (!(tp->t_flags & TF_RCVD_TSTMP) && (to.to_flags & TOF_TS)) { + if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { + log(LOG_DEBUG, "%s; %s: Timestamp not expected, " + "no action\n", s, __func__); + free(s, M_TCPLOG); + } + } + can_enter = 0; if (__predict_true((tlen == 0))) { /* @@ -2284,24 +2286,6 @@ tcp_do_segment_fastack(struct mbuf *m, struct tcphdr * if (TSTMP_GT(to.to_tsecr, tcp_ts_getticks())) to.to_tsecr = 0; } - /* - * If timestamps were negotiated during SYN/ACK they should - * appear on every segment during this session and vice versa. - */ - if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS)) { - if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { - log(LOG_DEBUG, "%s; %s: Timestamp missing, " - "no action\n", s, __func__); - free(s, M_TCPLOG); - } - } - if (!(tp->t_flags & TF_RCVD_TSTMP) && (to.to_flags & TOF_TS)) { - if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { - log(LOG_DEBUG, "%s; %s: Timestamp not expected, " - "no action\n", s, __func__); - free(s, M_TCPLOG); - } - } /* * Process options only when we get SYN/ACK back. The SYN case @@ -2332,6 +2316,26 @@ tcp_do_segment_fastack(struct mbuf *m, struct tcphdr * (to.to_flags & TOF_SACKPERM) == 0) tp->t_flags &= ~TF_SACK_PERMIT; } + + /* + * If timestamps were negotiated during SYN/ACK they should + * appear on every segment during this session and vice versa. + */ + if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS)) { + if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { + log(LOG_DEBUG, "%s; %s: Timestamp missing, " + "no action\n", s, __func__); + free(s, M_TCPLOG); + } + } + if (!(tp->t_flags & TF_RCVD_TSTMP) && (to.to_flags & TOF_TS)) { + if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { + log(LOG_DEBUG, "%s; %s: Timestamp not expected, " + "no action\n", s, __func__); + free(s, M_TCPLOG); + } + } + /* * Header prediction: check for the two common cases * of a uni-directional data xfer. If the packet has From owner-svn-src-stable-11@freebsd.org Sat Apr 7 15:16:58 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 349D8F90333; Sat, 7 Apr 2018 15:16:58 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DA3027B102; Sat, 7 Apr 2018 15:16:57 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D02F1227A7; Sat, 7 Apr 2018 15:16:57 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37FGvnx026400; Sat, 7 Apr 2018 15:16:57 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37FGvGC026399; Sat, 7 Apr 2018 15:16:57 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071516.w37FGvGC026399@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 15:16: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: r332178 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332178 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 15:16:58 -0000 Author: tuexen Date: Sat Apr 7 15:16:57 2018 New Revision: 332178 URL: https://svnweb.freebsd.org/changeset/base/332178 Log: MFC r322967: Fix blackhole detection. There were two bugs related to the blackhole detection: * The smalles size was tried more than two times. * The restored MSS was not the original one, but the second candidate. Sponsored by: Netflix, Inc. Modified: stable/11/sys/netinet/tcp_timer.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/tcp_timer.c ============================================================================== --- stable/11/sys/netinet/tcp_timer.c Sat Apr 7 15:10:08 2018 (r332177) +++ stable/11/sys/netinet/tcp_timer.c Sat Apr 7 15:16:57 2018 (r332178) @@ -687,19 +687,21 @@ tcp_timer_rexmt(void * xtp) */ if (((tp->t_flags2 & (TF2_PLPMTU_PMTUD|TF2_PLPMTU_MAXSEGSNT)) == (TF2_PLPMTU_PMTUD|TF2_PLPMTU_MAXSEGSNT)) && - (tp->t_rxtshift >= 2 && tp->t_rxtshift % 2 == 0)) { + (tp->t_rxtshift >= 2 && tp->t_rxtshift < 6 && + tp->t_rxtshift % 2 == 0)) { /* * Enter Path MTU Black-hole Detection mechanism: * - Disable Path MTU Discovery (IP "DF" bit). * - Reduce MTU to lower value than what we * negotiated with peer. */ - /* Record that we may have found a black hole. */ - tp->t_flags2 |= TF2_PLPMTU_BLACKHOLE; + if ((tp->t_flags2 & TF2_PLPMTU_BLACKHOLE) == 0) { + /* Record that we may have found a black hole. */ + tp->t_flags2 |= TF2_PLPMTU_BLACKHOLE; + /* Keep track of previous MSS. */ + tp->t_pmtud_saved_maxseg = tp->t_maxseg; + } - /* Keep track of previous MSS. */ - tp->t_pmtud_saved_maxseg = tp->t_maxseg; - /* * Reduce the MSS to blackhole value or to the default * in an attempt to retransmit. @@ -757,7 +759,7 @@ tcp_timer_rexmt(void * xtp) * stage (1448, 1188, 524) 2 chances to recover. */ if ((tp->t_flags2 & TF2_PLPMTU_BLACKHOLE) && - (tp->t_rxtshift > 6)) { + (tp->t_rxtshift >= 6)) { tp->t_flags2 |= TF2_PLPMTU_PMTUD; tp->t_flags2 &= ~TF2_PLPMTU_BLACKHOLE; tp->t_maxseg = tp->t_pmtud_saved_maxseg; From owner-svn-src-stable-11@freebsd.org Sat Apr 7 15:19:11 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1DE3FF9058C; Sat, 7 Apr 2018 15:19:11 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A2F8A7C510; Sat, 7 Apr 2018 15:19:10 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 948E2227A8; Sat, 7 Apr 2018 15:19:10 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37FJAgY026529; Sat, 7 Apr 2018 15:19:10 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37FJAIA026528; Sat, 7 Apr 2018 15:19:10 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071519.w37FJAIA026528@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 15:19: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: r332179 - stable/11/usr.bin/netstat X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/usr.bin/netstat X-SVN-Commit-Revision: 332179 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 15:19:11 -0000 Author: tuexen Date: Sat Apr 7 15:19:10 2018 New Revision: 332179 URL: https://svnweb.freebsd.org/changeset/base/332179 Log: MFC r323352: The combination of IPv6 and SCTP is also supported. Modified: stable/11/usr.bin/netstat/netstat.1 Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/netstat/netstat.1 ============================================================================== --- stable/11/usr.bin/netstat/netstat.1 Sat Apr 7 15:16:57 2018 (r332178) +++ stable/11/usr.bin/netstat/netstat.1 Sat Apr 7 15:19:10 2018 (r332179) @@ -28,7 +28,7 @@ .\" @(#)netstat.1 8.8 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd December 1, 2015 +.Dd September 9, 2017 .Dt NETSTAT 1 .Os .Sh NAME @@ -770,7 +770,7 @@ The following address families and protocols are recog .It Cm inet Pq Dv AF_INET .Cm divert , icmp , igmp , ip , ipsec , pim, sctp , tcp , udp .It Cm inet6 Pq Dv AF_INET6 -.Cm icmp6 , ip6 , ipsec6 , rip6 , tcp , udp +.Cm icmp6 , ip6 , ipsec6 , rip6 , sctp , tcp , udp .It Cm pfkey Pq Dv PF_KEY .Cm pfkey .It Cm netgraph , ng Pq Dv AF_NETGRAPH From owner-svn-src-stable-11@freebsd.org Sat Apr 7 17:35:05 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 62242F99C37; Sat, 7 Apr 2018 17:35:05 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 16E1787C1C; Sat, 7 Apr 2018 17:35:05 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0ABB523E7C; Sat, 7 Apr 2018 17:35:05 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37HZ40J099026; Sat, 7 Apr 2018 17:35:04 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37HZ42n099025; Sat, 7 Apr 2018 17:35:04 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071735.w37HZ42n099025@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 17:35:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332183 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332183 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 17:35:05 -0000 Author: tuexen Date: Sat Apr 7 17:35:04 2018 New Revision: 332183 URL: https://svnweb.freebsd.org/changeset/base/332183 Log: MFC r323372: Savely remove a chunk from the control queue. This bug was found by Coverity scanning the usrsctp library. Modified: stable/11/sys/netinet/sctp_input.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_input.c ============================================================================== --- stable/11/sys/netinet/sctp_input.c Sat Apr 7 17:06:13 2018 (r332182) +++ stable/11/sys/netinet/sctp_input.c Sat Apr 7 17:35:04 2018 (r332183) @@ -3136,14 +3136,14 @@ sctp_handle_ecn_cwr(struct sctp_cwr_chunk *cp, struct * make sure that we have a covered ECNE in the control chunk part. * If so remove it. */ - struct sctp_tmit_chunk *chk; + struct sctp_tmit_chunk *chk, *nchk; struct sctp_ecne_chunk *ecne; int override; uint32_t cwr_tsn; cwr_tsn = ntohl(cp->tsn); override = cp->ch.chunk_flags & SCTP_CWR_REDUCE_OVERRIDE; - TAILQ_FOREACH(chk, &stcb->asoc.control_send_queue, sctp_next) { + TAILQ_FOREACH_SAFE(chk, &stcb->asoc.control_send_queue, sctp_next, nchk) { if (chk->rec.chunk_id.id != SCTP_ECN_ECHO) { continue; } From owner-svn-src-stable-11@freebsd.org Sat Apr 7 17:36:54 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 981CAF99D4F; Sat, 7 Apr 2018 17:36:54 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4C3DB88C5C; Sat, 7 Apr 2018 17:36:54 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 418E423E7D; Sat, 7 Apr 2018 17:36:54 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37Harxw099137; Sat, 7 Apr 2018 17:36:53 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37Harjb099136; Sat, 7 Apr 2018 17:36:53 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071736.w37Harjb099136@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 17:36: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: r332184 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332184 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 17:36:54 -0000 Author: tuexen Date: Sat Apr 7 17:36:53 2018 New Revision: 332184 URL: https://svnweb.freebsd.org/changeset/base/332184 Log: MFC r323374: Silence a Coverity warning from scanning the usrsctp library. Modified: stable/11/sys/netinet/sctp_pcb.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_pcb.c ============================================================================== --- stable/11/sys/netinet/sctp_pcb.c Sat Apr 7 17:35:04 2018 (r332183) +++ stable/11/sys/netinet/sctp_pcb.c Sat Apr 7 17:36:53 2018 (r332184) @@ -2919,9 +2919,9 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *ad */ /* got to be root to get at low ports */ if (ntohs(lport) < IPPORT_RESERVED) { - if (p && (error = + if ((p != NULL) && ((error = priv_check(p, PRIV_NETINET_RESERVEDPORT) - )) { + ) != 0)) { SCTP_INP_DECR_REF(inp); SCTP_INP_WUNLOCK(inp); SCTP_INP_INFO_WUNLOCK(); From owner-svn-src-stable-11@freebsd.org Sat Apr 7 17:38:39 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB7D5F99EF0; Sat, 7 Apr 2018 17:38:38 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8C1C889CBD; Sat, 7 Apr 2018 17:38:38 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6C48D23E7F; Sat, 7 Apr 2018 17:38:38 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37Hcc0o099355; Sat, 7 Apr 2018 17:38:38 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37Hcc5W099354; Sat, 7 Apr 2018 17:38:38 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071738.w37Hcc5W099354@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 17:38:38 +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: r332185 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332185 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 17:38:39 -0000 Author: tuexen Date: Sat Apr 7 17:38:38 2018 New Revision: 332185 URL: https://svnweb.freebsd.org/changeset/base/332185 Log: MFC r323376: Fix locking issues found by Coverity scanning the usrsctp library. Modified: stable/11/sys/netinet/sctp_usrreq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/11/sys/netinet/sctp_usrreq.c Sat Apr 7 17:36:53 2018 (r332184) +++ stable/11/sys/netinet/sctp_usrreq.c Sat Apr 7 17:38:38 2018 (r332185) @@ -1959,6 +1959,7 @@ flags_out: SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error); } else { id->assoc_value = stcb->asoc.vrf_id; + SCTP_TCB_UNLOCK(stcb); *optsize = sizeof(struct sctp_assoc_value); } break; @@ -3063,7 +3064,6 @@ flags_out: if (event_type > 0) { if (stcb) { event->se_on = sctp_stcb_is_feature_on(inp, stcb, event_type); - SCTP_TCB_UNLOCK(stcb); } else { if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || @@ -3077,6 +3077,9 @@ flags_out: } } } + if (stcb != NULL) { + SCTP_TCB_UNLOCK(stcb); + } if (error == 0) { *optsize = sizeof(struct sctp_event); } @@ -3647,12 +3650,16 @@ flags_out: sprstat->sprstat_abandoned_unsent = stcb->asoc.strmout[sid].abandoned_unsent[0]; sprstat->sprstat_abandoned_sent = stcb->asoc.strmout[sid].abandoned_sent[0]; #endif - SCTP_TCB_UNLOCK(stcb); - *optsize = sizeof(struct sctp_prstatus); } else { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; } + if (stcb != NULL) { + SCTP_TCB_UNLOCK(stcb); + } + if (error == 0) { + *optsize = sizeof(struct sctp_prstatus); + } break; } case SCTP_PR_ASSOC_STATUS: @@ -3675,11 +3682,15 @@ flags_out: sprstat->sprstat_abandoned_unsent = stcb->asoc.abandoned_unsent[policy]; sprstat->sprstat_abandoned_sent = stcb->asoc.abandoned_sent[policy]; } - SCTP_TCB_UNLOCK(stcb); - *optsize = sizeof(struct sctp_prstatus); } else { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; + } + if (stcb != NULL) { + SCTP_TCB_UNLOCK(stcb); + } + if (error == 0) { + *optsize = sizeof(struct sctp_prstatus); } break; } From owner-svn-src-stable-11@freebsd.org Sat Apr 7 17:40:12 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 578DEF9A035; Sat, 7 Apr 2018 17:40:12 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0A2658AADB; Sat, 7 Apr 2018 17:40:12 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0513023E83; Sat, 7 Apr 2018 17:40:12 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37HeBMF099491; Sat, 7 Apr 2018 17:40:11 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37HeBA9099490; Sat, 7 Apr 2018 17:40:11 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071740.w37HeBA9099490@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 17:40: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: r332186 - stable/11/sys/netinet6 X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet6 X-SVN-Commit-Revision: 332186 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 17:40:12 -0000 Author: tuexen Date: Sat Apr 7 17:40:11 2018 New Revision: 332186 URL: https://svnweb.freebsd.org/changeset/base/332186 Log: MFC r323377: Fix a locking issue found by Coverity scanning the usrsctp library. Modified: stable/11/sys/netinet6/sctp6_usrreq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet6/sctp6_usrreq.c ============================================================================== --- stable/11/sys/netinet6/sctp6_usrreq.c Sat Apr 7 17:38:38 2018 (r332185) +++ stable/11/sys/netinet6/sctp6_usrreq.c Sat Apr 7 17:40:11 2018 (r332186) @@ -879,7 +879,7 @@ sctp6_connect(struct socket *so, struct sockaddr *addr if (inp->sctp_flags & SCTP_PCB_FLAGS_CONNECTED) { stcb = LIST_FIRST(&inp->sctp_asoc_list); if (stcb) { - SCTP_TCB_UNLOCK(stcb); + SCTP_TCB_LOCK(stcb); } SCTP_INP_RUNLOCK(inp); } else { From owner-svn-src-stable-11@freebsd.org Sat Apr 7 17:41:33 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3854AF9A277; Sat, 7 Apr 2018 17:41:33 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DED3A8B79C; Sat, 7 Apr 2018 17:41:32 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D799923EC7; Sat, 7 Apr 2018 17:41:32 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37HfWYu003013; Sat, 7 Apr 2018 17:41:32 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37HfWEn003012; Sat, 7 Apr 2018 17:41:32 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071741.w37HfWEn003012@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 17:41: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: r332187 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332187 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 17:41:33 -0000 Author: tuexen Date: Sat Apr 7 17:41:32 2018 New Revision: 332187 URL: https://svnweb.freebsd.org/changeset/base/332187 Log: MFC r323378: Fix MTU computation. Coverity scanning usrsctp pointed to this code... Modified: stable/11/sys/netinet/sctp_output.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_output.c ============================================================================== --- stable/11/sys/netinet/sctp_output.c Sat Apr 7 17:40:11 2018 (r332186) +++ stable/11/sys/netinet/sctp_output.c Sat Apr 7 17:41:32 2018 (r332187) @@ -4277,11 +4277,13 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, uint32_t mtu; mtu = SCTP_GATHER_MTU_FROM_ROUTE(net->ro._s_addr, &net->ro._l_addr.sa, ro->ro_rt); - if (net->port) { - mtu -= sizeof(struct udphdr); - } - if (mtu && (stcb->asoc.smallest_mtu > mtu)) { - sctp_mtu_size_reset(inp, &stcb->asoc, mtu); + if (mtu > 0) { + if (net->port) { + mtu -= sizeof(struct udphdr); + } + if ((stcb != NULL) && (stcb->asoc.smallest_mtu > mtu)) { + sctp_mtu_size_reset(inp, &stcb->asoc, mtu); + } net->mtu = mtu; } } else if (ro->ro_rt == NULL) { @@ -4633,13 +4635,14 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, uint32_t mtu; mtu = SCTP_GATHER_MTU_FROM_ROUTE(net->ro._s_addr, &net->ro._l_addr.sa, ro->ro_rt); - if (mtu && - (stcb->asoc.smallest_mtu > mtu)) { - sctp_mtu_size_reset(inp, &stcb->asoc, mtu); - net->mtu = mtu; + if (mtu > 0) { if (net->port) { - net->mtu -= sizeof(struct udphdr); + mtu -= sizeof(struct udphdr); } + if ((stcb != NULL) && (stcb->asoc.smallest_mtu > mtu)) { + sctp_mtu_size_reset(inp, &stcb->asoc, mtu); + } + net->mtu = mtu; } } else if (ifp) { if (ND_IFINFO(ifp)->linkmtu && @@ -12421,7 +12424,6 @@ sctp_copy_it_in(struct sctp_tcb *stcb, resv_in_first = SCTP_DATA_CHUNK_OVERHEAD(stcb); sp->data = sp->tail_mbuf = NULL; if (sp->length == 0) { - *error = 0; goto skip_copy; } if (srcv->sinfo_keynumber_valid) { @@ -13152,7 +13154,7 @@ skip_preblock: if (strm->last_msg_incomplete == 0) { do_a_copy_in: sp = sctp_copy_it_in(stcb, asoc, srcv, uio, net, max_len, user_marks_eor, &error); - if ((sp == NULL) || (error)) { + if (error) { goto out; } SCTP_TCB_SEND_LOCK(stcb); From owner-svn-src-stable-11@freebsd.org Sat Apr 7 17:54:39 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91DB9F9AD9C; Sat, 7 Apr 2018 17:54:39 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 403BB6ACE8; Sat, 7 Apr 2018 17:54:39 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 35627241A2; Sat, 7 Apr 2018 17:54:39 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37HsdOn009662; Sat, 7 Apr 2018 17:54:39 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37HscSo009660; Sat, 7 Apr 2018 17:54:38 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071754.w37HscSo009660@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 17:54:38 +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: r332188 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332188 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 17:54:39 -0000 Author: tuexen Date: Sat Apr 7 17:54:38 2018 New Revision: 332188 URL: https://svnweb.freebsd.org/changeset/base/332188 Log: MFC r323505: Export the UDP encapsualation port and the path state. Modified: stable/11/sys/netinet/sctp_sysctl.c stable/11/sys/netinet/sctp_uio.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_sysctl.c ============================================================================== --- stable/11/sys/netinet/sctp_sysctl.c Sat Apr 7 17:41:32 2018 (r332187) +++ stable/11/sys/netinet/sctp_sysctl.c Sat Apr 7 17:54:38 2018 (r332188) @@ -505,6 +505,14 @@ sctp_sysctl_handle_assoclist(SYSCTL_HANDLER_ARGS) xraddr.rtt = net->rtt / 1000; xraddr.heartbeat_interval = net->heart_beat_delay; xraddr.ssthresh = net->ssthresh; + xraddr.encaps_port = net->port; + if (net->dest_state & SCTP_ADDR_UNCONFIRMED) { + xraddr.state = SCTP_UNCONFIRMED; + } else if (net->dest_state & SCTP_ADDR_REACHABLE) { + xraddr.state = SCTP_ACTIVE; + } else { + xraddr.state = SCTP_INACTIVE; + } xraddr.start_time.tv_sec = (uint32_t)net->start_time.tv_sec; xraddr.start_time.tv_usec = (uint32_t)net->start_time.tv_usec; SCTP_INP_RUNLOCK(inp); Modified: stable/11/sys/netinet/sctp_uio.h ============================================================================== --- stable/11/sys/netinet/sctp_uio.h Sat Apr 7 17:41:32 2018 (r332187) +++ stable/11/sys/netinet/sctp_uio.h Sat Apr 7 17:54:38 2018 (r332188) @@ -1239,7 +1239,9 @@ struct xsctp_raddr { uint32_t rtt; uint32_t heartbeat_interval; uint32_t ssthresh; - uint32_t extra_padding[30]; /* future */ + uint16_t encaps_port; + uint16_t state; + uint32_t extra_padding[29]; /* future */ }; #define SCTP_MAX_LOGGING_SIZE 30000 From owner-svn-src-stable-11@freebsd.org Sat Apr 7 17:59:09 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A73A4F9B1D8; Sat, 7 Apr 2018 17:59:09 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5A5FF6D457; Sat, 7 Apr 2018 17:59:09 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 54F7A241A5; Sat, 7 Apr 2018 17:59:09 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37Hx9F8009882; Sat, 7 Apr 2018 17:59:09 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37Hx8Xn009876; Sat, 7 Apr 2018 17:59:08 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071759.w37Hx8Xn009876@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 17:59:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332189 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332189 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 17:59:09 -0000 Author: tuexen Date: Sat Apr 7 17:59:08 2018 New Revision: 332189 URL: https://svnweb.freebsd.org/changeset/base/332189 Log: MFC r323657: Remove code not used on any platform currently supported. Modified: stable/11/sys/netinet/sctp.h stable/11/sys/netinet/sctp_constants.h stable/11/sys/netinet/sctp_os_bsd.h stable/11/sys/netinet/sctp_pcb.h stable/11/sys/netinet/sctputil.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp.h ============================================================================== --- stable/11/sys/netinet/sctp.h Sat Apr 7 17:54:38 2018 (r332188) +++ stable/11/sys/netinet/sctp.h Sat Apr 7 17:59:08 2018 (r332189) @@ -545,7 +545,6 @@ struct sctp_error_auth_invalid_hmac { #define SCTP_PCB_FLAGS_INTERLEAVE_STRMS 0x0000000000000010 #define SCTP_PCB_FLAGS_DO_ASCONF 0x0000000000000020 #define SCTP_PCB_FLAGS_AUTO_ASCONF 0x0000000000000040 -#define SCTP_PCB_FLAGS_ZERO_COPY_ACTIVE 0x0000000000000080 /* socket options */ #define SCTP_PCB_FLAGS_NODELAY 0x0000000000000100 #define SCTP_PCB_FLAGS_AUTOCLOSE 0x0000000000000200 Modified: stable/11/sys/netinet/sctp_constants.h ============================================================================== --- stable/11/sys/netinet/sctp_constants.h Sat Apr 7 17:54:38 2018 (r332188) +++ stable/11/sys/netinet/sctp_constants.h Sat Apr 7 17:59:08 2018 (r332189) @@ -555,11 +555,9 @@ __FBSDID("$FreeBSD$"); #define SCTP_TIMER_TYPE_INPKILL 15 #define SCTP_TIMER_TYPE_ASOCKILL 16 #define SCTP_TIMER_TYPE_ADDR_WQ 17 -#define SCTP_TIMER_TYPE_ZERO_COPY 18 -#define SCTP_TIMER_TYPE_ZCOPY_SENDQ 19 -#define SCTP_TIMER_TYPE_PRIM_DELETED 20 +#define SCTP_TIMER_TYPE_PRIM_DELETED 18 /* add new timers here - and increment LAST */ -#define SCTP_TIMER_TYPE_LAST 21 +#define SCTP_TIMER_TYPE_LAST 19 #define SCTP_IS_TIMER_TYPE_VALID(t) (((t) > SCTP_TIMER_TYPE_NONE) && \ ((t) < SCTP_TIMER_TYPE_LAST)) Modified: stable/11/sys/netinet/sctp_os_bsd.h ============================================================================== --- stable/11/sys/netinet/sctp_os_bsd.h Sat Apr 7 17:54:38 2018 (r332188) +++ stable/11/sys/netinet/sctp_os_bsd.h Sat Apr 7 17:59:08 2018 (r332189) @@ -404,11 +404,6 @@ typedef struct rtentry sctp_rtentry_t; #define SCTP_RTALLOC(ro, vrf_id, fibnum) \ rtalloc_ign_fib((struct route *)ro, 0UL, fibnum) -/* Future zero copy wakeup/send function */ -#define SCTP_ZERO_COPY_EVENT(inp, so) -/* This is re-pulse ourselves for sendbuf */ -#define SCTP_ZERO_COPY_SENDQ_EVENT(inp, so) - /* * SCTP protocol specific mbuf flags. */ Modified: stable/11/sys/netinet/sctp_pcb.h ============================================================================== --- stable/11/sys/netinet/sctp_pcb.h Sat Apr 7 17:54:38 2018 (r332188) +++ stable/11/sys/netinet/sctp_pcb.h Sat Apr 7 17:59:08 2018 (r332189) @@ -314,10 +314,6 @@ struct sctp_pcb { */ struct sctp_timer signature_change; - /* Zero copy full buffer timer */ - struct sctp_timer zero_copy_timer; - /* Zero copy app to transport (sendq) read repulse timer */ - struct sctp_timer zero_copy_sendq_timer; uint32_t def_cookie_life; /* defaults to 0 */ int auto_close_time; Modified: stable/11/sys/netinet/sctputil.c ============================================================================== --- stable/11/sys/netinet/sctputil.c Sat Apr 7 17:54:38 2018 (r332188) +++ stable/11/sys/netinet/sctputil.c Sat Apr 7 17:59:08 2018 (r332189) @@ -1633,22 +1633,6 @@ sctp_timeout_handler(void *t) /* call the handler for the appropriate timer type */ switch (type) { - case SCTP_TIMER_TYPE_ZERO_COPY: - if (inp == NULL) { - break; - } - if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_ZERO_COPY_ACTIVE)) { - SCTP_ZERO_COPY_EVENT(inp, inp->sctp_socket); - } - break; - case SCTP_TIMER_TYPE_ZCOPY_SENDQ: - if (inp == NULL) { - break; - } - if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_ZERO_COPY_ACTIVE)) { - SCTP_ZERO_COPY_SENDQ_EVENT(inp, inp->sctp_socket); - } - break; case SCTP_TIMER_TYPE_ADDR_WQ: sctp_handle_addr_wq(); break; @@ -1962,14 +1946,6 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s SCTP_TCB_LOCK_ASSERT(stcb); } switch (t_type) { - case SCTP_TIMER_TYPE_ZERO_COPY: - tmr = &inp->sctp_ep.zero_copy_timer; - to_ticks = SCTP_ZERO_COPY_TICK_DELAY; - break; - case SCTP_TIMER_TYPE_ZCOPY_SENDQ: - tmr = &inp->sctp_ep.zero_copy_sendq_timer; - to_ticks = SCTP_ZERO_COPY_SENDQ_TICK_DELAY; - break; case SCTP_TIMER_TYPE_ADDR_WQ: /* Only 1 tick away :-) */ tmr = &SCTP_BASE_INFO(addr_wq_timer); @@ -2251,12 +2227,6 @@ sctp_timer_stop(int t_type, struct sctp_inpcb *inp, st SCTP_TCB_LOCK_ASSERT(stcb); } switch (t_type) { - case SCTP_TIMER_TYPE_ZERO_COPY: - tmr = &inp->sctp_ep.zero_copy_timer; - break; - case SCTP_TIMER_TYPE_ZCOPY_SENDQ: - tmr = &inp->sctp_ep.zero_copy_sendq_timer; - break; case SCTP_TIMER_TYPE_ADDR_WQ: tmr = &SCTP_BASE_INFO(addr_wq_timer); break; @@ -4469,36 +4439,32 @@ sctp_wakeup_the_read_socket(struct sctp_inpcb *inp, ) { if ((inp != NULL) && (inp->sctp_socket != NULL)) { - if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_ZERO_COPY_ACTIVE)) { - SCTP_ZERO_COPY_EVENT(inp, inp->sctp_socket); - } else { #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *so; + struct socket *so; - so = SCTP_INP_SO(inp); - if (!so_locked) { - if (stcb) { - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - } - SCTP_SOCKET_LOCK(so, 1); - if (stcb) { - SCTP_TCB_LOCK(stcb); - atomic_subtract_int(&stcb->asoc.refcnt, 1); - } - if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) { - SCTP_SOCKET_UNLOCK(so, 1); - return; - } + so = SCTP_INP_SO(inp); + if (!so_locked) { + if (stcb) { + atomic_add_int(&stcb->asoc.refcnt, 1); + SCTP_TCB_UNLOCK(stcb); } -#endif - sctp_sorwakeup(inp, inp->sctp_socket); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - if (!so_locked) { + SCTP_SOCKET_LOCK(so, 1); + if (stcb) { + SCTP_TCB_LOCK(stcb); + atomic_subtract_int(&stcb->asoc.refcnt, 1); + } + if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) { SCTP_SOCKET_UNLOCK(so, 1); + return; } + } #endif + sctp_sorwakeup(inp, inp->sctp_socket); +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) + if (!so_locked) { + SCTP_SOCKET_UNLOCK(so, 1); } +#endif } } From owner-svn-src-stable-11@freebsd.org Sat Apr 7 18:02:17 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C19F9F9B601; Sat, 7 Apr 2018 18:02:17 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 743476F1CA; Sat, 7 Apr 2018 18:02:17 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F34724337; Sat, 7 Apr 2018 18:02:17 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37I2HkZ013894; Sat, 7 Apr 2018 18:02:17 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37I2Ha5013893; Sat, 7 Apr 2018 18:02:17 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071802.w37I2Ha5013893@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 18:02:17 +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: r332190 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332190 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 18:02:17 -0000 Author: tuexen Date: Sat Apr 7 18:02:17 2018 New Revision: 332190 URL: https://svnweb.freebsd.org/changeset/base/332190 Log: MFC r323670: Fix an accounting bug and use sctp_timer_start to start a timer. Modified: stable/11/sys/netinet/sctp_indata.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_indata.c ============================================================================== --- stable/11/sys/netinet/sctp_indata.c Sat Apr 7 17:59:08 2018 (r332189) +++ stable/11/sys/netinet/sctp_indata.c Sat Apr 7 18:02:17 2018 (r332190) @@ -1594,9 +1594,17 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struc next_fsn, control->fsn_included); TAILQ_REMOVE(&control->reasm, at, sctp_next); lenadded = sctp_add_chk_to_control(control, strm, stcb, asoc, at, SCTP_READ_LOCK_NOT_HELD); - asoc->size_on_all_streams += lenadded; if (control->on_read_q) { do_wakeup = 1; + } else { + /* + * We only add to the + * size-on-all-streams if its not on + * the read q. The read q flag will + * cause a sballoc so its accounted + * for there. + */ + asoc->size_on_all_streams += lenadded; } next_fsn++; if (control->end_added && control->pdapi_started) { @@ -4229,8 +4237,7 @@ again: } if (net->flight_size) { j++; - (void)SCTP_OS_TIMER_START(&net->rxt_timer.timer, to_ticks, - sctp_timeout_handler, &net->rxt_timer); + sctp_timer_start(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, net); if (net->window_probe) { net->window_probe = 0; } @@ -4242,8 +4249,7 @@ again: */ net->window_probe = 0; if (!SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer)) { - SCTP_OS_TIMER_START(&net->rxt_timer.timer, to_ticks, - sctp_timeout_handler, &net->rxt_timer); + sctp_timer_start(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, net); } } else if (SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer)) { sctp_timer_stop(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, From owner-svn-src-stable-11@freebsd.org Sat Apr 7 18:05:02 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 201ABF9B8E9; Sat, 7 Apr 2018 18:05:02 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B708970B2E; Sat, 7 Apr 2018 18:05:01 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ADE832434F; Sat, 7 Apr 2018 18:05:01 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37I51lU014742; Sat, 7 Apr 2018 18:05:01 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37I51gd014741; Sat, 7 Apr 2018 18:05:01 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071805.w37I51gd014741@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 18:05: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: r332191 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332191 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 18:05:02 -0000 Author: tuexen Date: Sat Apr 7 18:05:01 2018 New Revision: 332191 URL: https://svnweb.freebsd.org/changeset/base/332191 Log: MFC r323763: Remove a no longer used variable. Reported by: Felix Weinrank Modified: stable/11/sys/netinet/sctp_indata.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_indata.c ============================================================================== --- stable/11/sys/netinet/sctp_indata.c Sat Apr 7 18:02:17 2018 (r332190) +++ stable/11/sys/netinet/sctp_indata.c Sat Apr 7 18:05:01 2018 (r332191) @@ -4213,8 +4213,6 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32 again: j = 0; TAILQ_FOREACH(net, &asoc->nets, sctp_next) { - int to_ticks; - if (win_probe_recovery && (net->window_probe)) { win_probe_recovered = 1; /* @@ -4229,11 +4227,6 @@ again: break; } } - } - if (net->RTO == 0) { - to_ticks = MSEC_TO_TICKS(stcb->asoc.initial_rto); - } else { - to_ticks = MSEC_TO_TICKS(net->RTO); } if (net->flight_size) { j++; From owner-svn-src-stable-11@freebsd.org Sat Apr 7 18:06:41 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50EF7F9BA49; Sat, 7 Apr 2018 18:06:41 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F2F8E71A14; Sat, 7 Apr 2018 18:06:40 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ED57124351; Sat, 7 Apr 2018 18:06:40 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37I6e8V014844; Sat, 7 Apr 2018 18:06:40 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37I6eag014843; Sat, 7 Apr 2018 18:06:40 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071806.w37I6eag014843@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 18:06: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: r332192 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332192 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 18:06:41 -0000 Author: tuexen Date: Sat Apr 7 18:06:40 2018 New Revision: 332192 URL: https://svnweb.freebsd.org/changeset/base/332192 Log: MFC r323774: Avoid an overflow when computing the staleness. This issue was found by running libfuzz on the userland stack. Modified: stable/11/sys/netinet/sctp_input.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_input.c ============================================================================== --- stable/11/sys/netinet/sctp_input.c Sat Apr 7 18:05:01 2018 (r332191) +++ stable/11/sys/netinet/sctp_input.c Sat Apr 7 18:06:40 2018 (r332192) @@ -2556,15 +2556,12 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, in /* Expire time is in Ticks, so we convert to seconds */ time_expires.tv_sec = cookie->time_entered.tv_sec + TICKS_TO_SEC(cookie->cookie_life); time_expires.tv_usec = cookie->time_entered.tv_usec; - /* - * TODO sctp_constants.h needs alternative time macros when _KERNEL - * is undefined. - */ if (timevalcmp(&now, &time_expires, >)) { /* cookie is stale! */ struct mbuf *op_err; struct sctp_error_stale_cookie *cause; - uint32_t tim; + struct timeval diff; + uint32_t staleness; op_err = sctp_get_mbuf_for_msg(sizeof(struct sctp_error_stale_cookie), 0, M_NOWAIT, 1, MT_DATA); @@ -2578,12 +2575,19 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, in cause->cause.code = htons(SCTP_CAUSE_STALE_COOKIE); cause->cause.length = htons((sizeof(struct sctp_paramhdr) + (sizeof(uint32_t)))); - /* seconds to usec */ - tim = (now.tv_sec - time_expires.tv_sec) * 1000000; - /* add in usec */ - if (tim == 0) - tim = now.tv_usec - cookie->time_entered.tv_usec; - cause->stale_time = htonl(tim); + diff = now; + timevalsub(&diff, &time_expires); + if (diff.tv_sec > UINT32_MAX / 1000000) { + staleness = UINT32_MAX; + } else { + staleness = diff.tv_sec * 1000000; + } + if (UINT32_MAX - staleness >= diff.tv_usec) { + staleness += diff.tv_usec; + } else { + staleness = UINT32_MAX; + } + cause->stale_time = htonl(staleness); sctp_send_operr_to(src, dst, sh, cookie->peers_vtag, op_err, mflowtype, mflowid, l_inp->fibnum, vrf_id, port); From owner-svn-src-stable-11@freebsd.org Sat Apr 7 18:08:42 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E1376F9BC5F; Sat, 7 Apr 2018 18:08:42 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8FC8D72C2E; Sat, 7 Apr 2018 18:08:42 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 845E224352; Sat, 7 Apr 2018 18:08:42 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37I8giC014965; Sat, 7 Apr 2018 18:08:42 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37I8g7c014964; Sat, 7 Apr 2018 18:08:42 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071808.w37I8g7c014964@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 18:08: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: r332193 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332193 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 18:08:43 -0000 Author: tuexen Date: Sat Apr 7 18:08:42 2018 New Revision: 332193 URL: https://svnweb.freebsd.org/changeset/base/332193 Log: MFC r323776: Fix a warning. Modified: stable/11/sys/netinet/sctp_input.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_input.c ============================================================================== --- stable/11/sys/netinet/sctp_input.c Sat Apr 7 18:06:40 2018 (r332192) +++ stable/11/sys/netinet/sctp_input.c Sat Apr 7 18:08:42 2018 (r332193) @@ -2582,7 +2582,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, in } else { staleness = diff.tv_sec * 1000000; } - if (UINT32_MAX - staleness >= diff.tv_usec) { + if (UINT32_MAX - staleness >= (uint32_t)diff.tv_usec) { staleness += diff.tv_usec; } else { staleness = UINT32_MAX; From owner-svn-src-stable-11@freebsd.org Sat Apr 7 19:09:52 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3DB11F9F989; Sat, 7 Apr 2018 19:09:52 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8687C74A3A; Sat, 7 Apr 2018 19:09:51 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 815EA24CE1; Sat, 7 Apr 2018 19:09:51 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37J9plx046652; Sat, 7 Apr 2018 19:09:51 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37J9p5h046650; Sat, 7 Apr 2018 19:09:51 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071909.w37J9p5h046650@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 19:09:51 +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: r332197 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332197 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 19:09:52 -0000 Author: tuexen Date: Sat Apr 7 19:09:51 2018 New Revision: 332197 URL: https://svnweb.freebsd.org/changeset/base/332197 Log: MFC r323833: Protect the address workqueue timer by a mutex. Modified: stable/11/sys/netinet/sctp_pcb.c stable/11/sys/netinet/sctputil.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_pcb.c ============================================================================== --- stable/11/sys/netinet/sctp_pcb.c Sat Apr 7 18:58:58 2018 (r332196) +++ stable/11/sys/netinet/sctp_pcb.c Sat Apr 7 19:09:51 2018 (r332197) @@ -709,12 +709,11 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint3 SCTP_WQ_ADDR_LOCK(); LIST_INSERT_HEAD(&SCTP_BASE_INFO(addr_wq), wi, sctp_nxt_addr); - SCTP_WQ_ADDR_UNLOCK(); - sctp_timer_start(SCTP_TIMER_TYPE_ADDR_WQ, (struct sctp_inpcb *)NULL, (struct sctp_tcb *)NULL, (struct sctp_nets *)NULL); + SCTP_WQ_ADDR_UNLOCK(); } else { /* it's ready for use */ sctp_ifap->localifa_flags &= ~SCTP_ADDR_DEFER_USE; @@ -821,12 +820,11 @@ out_now: * the newest first :-0 */ LIST_INSERT_HEAD(&SCTP_BASE_INFO(addr_wq), wi, sctp_nxt_addr); - SCTP_WQ_ADDR_UNLOCK(); - sctp_timer_start(SCTP_TIMER_TYPE_ADDR_WQ, (struct sctp_inpcb *)NULL, (struct sctp_tcb *)NULL, (struct sctp_nets *)NULL); + SCTP_WQ_ADDR_UNLOCK(); } return; } Modified: stable/11/sys/netinet/sctputil.c ============================================================================== --- stable/11/sys/netinet/sctputil.c Sat Apr 7 18:58:58 2018 (r332196) +++ stable/11/sys/netinet/sctputil.c Sat Apr 7 19:09:51 2018 (r332197) @@ -1462,13 +1462,11 @@ sctp_handle_addr_wq(void) LIST_INIT(&asc->list_of_work); asc->cnt = 0; - SCTP_WQ_ADDR_LOCK(); LIST_FOREACH_SAFE(wi, &SCTP_BASE_INFO(addr_wq), sctp_nxt_addr, nwi) { LIST_REMOVE(wi, sctp_nxt_addr); LIST_INSERT_HEAD(&asc->list_of_work, wi, sctp_nxt_addr); asc->cnt++; } - SCTP_WQ_ADDR_UNLOCK(); if (asc->cnt == 0) { SCTP_FREE(asc, SCTP_M_ASC_IT); @@ -1492,11 +1490,9 @@ sctp_handle_addr_wq(void) if (SCTP_BASE_VAR(sctp_pcb_initialized) == 0) { sctp_asconf_iterator_end(asc, 0); } else { - SCTP_WQ_ADDR_LOCK(); LIST_FOREACH(wi, &asc->list_of_work, sctp_nxt_addr) { LIST_INSERT_HEAD(&SCTP_BASE_INFO(addr_wq), wi, sctp_nxt_addr); } - SCTP_WQ_ADDR_UNLOCK(); SCTP_FREE(asc, SCTP_M_ASC_IT); } } @@ -1565,8 +1561,7 @@ sctp_timeout_handler(void *t) (tmr->type != SCTP_TIMER_TYPE_SHUTDOWN) && (tmr->type != SCTP_TIMER_TYPE_SHUTDOWNACK) && (tmr->type != SCTP_TIMER_TYPE_SHUTDOWNGUARD) && - (tmr->type != SCTP_TIMER_TYPE_ASOCKILL)) - ) { + (tmr->type != SCTP_TIMER_TYPE_ASOCKILL))) { SCTP_INP_DECR_REF(inp); CURVNET_RESTORE(); return; @@ -1612,6 +1607,12 @@ sctp_timeout_handler(void *t) CURVNET_RESTORE(); return; } + } else if (inp != NULL) { + if (type != SCTP_TIMER_TYPE_INPKILL) { + SCTP_INP_WLOCK(inp); + } + } else { + SCTP_WQ_ADDR_LOCK(); } /* record in stopped what t-o occurred */ tmr->stopped_from = type; @@ -1759,7 +1760,6 @@ sctp_timeout_handler(void *t) } SCTP_STAT_INCR(sctps_timosecret); (void)SCTP_GETTIME_TIMEVAL(&tv); - SCTP_INP_WLOCK(inp); inp->sctp_ep.time_of_secret_change = tv.tv_sec; inp->sctp_ep.last_secret_number = inp->sctp_ep.current_secret_number; @@ -1773,7 +1773,6 @@ sctp_timeout_handler(void *t) inp->sctp_ep.secret_key[secret][i] = sctp_select_initial_TSN(&inp->sctp_ep); } - SCTP_INP_WUNLOCK(inp); sctp_timer_start(SCTP_TIMER_TYPE_NEWCOOKIE, inp, stcb, net); } did_output = 0; @@ -1921,7 +1920,12 @@ sctp_timeout_handler(void *t) get_out: if (stcb) { SCTP_TCB_UNLOCK(stcb); + } else if (inp != NULL) { + SCTP_INP_WUNLOCK(inp); + } else { + SCTP_WQ_ADDR_UNLOCK(); } + out_decr: if (inp) { SCTP_INP_DECR_REF(inp); @@ -6145,11 +6149,11 @@ sctp_dynamic_set_primary(struct sockaddr *sa, uint32_t * newest first :-0 */ LIST_INSERT_HEAD(&SCTP_BASE_INFO(addr_wq), wi, sctp_nxt_addr); - SCTP_WQ_ADDR_UNLOCK(); sctp_timer_start(SCTP_TIMER_TYPE_ADDR_WQ, (struct sctp_inpcb *)NULL, (struct sctp_tcb *)NULL, (struct sctp_nets *)NULL); + SCTP_WQ_ADDR_UNLOCK(); return (0); } From owner-svn-src-stable-11@freebsd.org Sat Apr 7 19:11:21 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4C4BF9FB1F; Sat, 7 Apr 2018 19:11:21 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 878A375A7E; Sat, 7 Apr 2018 19:11:21 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 82A0F24E34; Sat, 7 Apr 2018 19:11:21 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37JBLYZ049046; Sat, 7 Apr 2018 19:11:21 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37JBL9b049045; Sat, 7 Apr 2018 19:11:21 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071911.w37JBL9b049045@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 19:11:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332199 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332199 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 19:11:22 -0000 Author: tuexen Date: Sat Apr 7 19:11:21 2018 New Revision: 332199 URL: https://svnweb.freebsd.org/changeset/base/332199 Log: MFC r323847: No need to wakeup, since sctp_add_to_readq() does it. Modified: stable/11/sys/netinet/sctp_indata.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_indata.c ============================================================================== --- stable/11/sys/netinet/sctp_indata.c Sat Apr 7 19:09:57 2018 (r332198) +++ stable/11/sys/netinet/sctp_indata.c Sat Apr 7 19:11:21 2018 (r332199) @@ -1617,7 +1617,6 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struc control, &stcb->sctp_socket->so_rcv, control->end_added, SCTP_READ_LOCK_NOT_HELD, SCTP_SO_NOT_LOCKED); - do_wakeup = 1; } break; } From owner-svn-src-stable-11@freebsd.org Sat Apr 7 19:13:06 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7BC2BF9FDC6; Sat, 7 Apr 2018 19:13:06 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2F65276B3B; Sat, 7 Apr 2018 19:13:06 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2994F24E88; Sat, 7 Apr 2018 19:13:06 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37JD6QE051432; Sat, 7 Apr 2018 19:13:06 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37JD6dn051431; Sat, 7 Apr 2018 19:13:06 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071913.w37JD6dn051431@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 19:13: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: r332200 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332200 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 19:13:06 -0000 Author: tuexen Date: Sat Apr 7 19:13:05 2018 New Revision: 332200 URL: https://svnweb.freebsd.org/changeset/base/332200 Log: MFC r323850: Free the control structure after using is, not before. Found by Coverity while scanning the usrsctp library. Modified: stable/11/sys/netinet/sctp_indata.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_indata.c ============================================================================== --- stable/11/sys/netinet/sctp_indata.c Sat Apr 7 19:11:21 2018 (r332199) +++ stable/11/sys/netinet/sctp_indata.c Sat Apr 7 19:13:05 2018 (r332200) @@ -1379,10 +1379,10 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struc } if (sctp_place_control_in_stream(strm, asoc, control)) { /* Duplicate SSN? */ - sctp_clean_up_control(stcb, control); sctp_abort_in_reasm(stcb, control, chk, abort_flag, SCTP_FROM_SCTP_INDATA + SCTP_LOC_6); + sctp_clean_up_control(stcb, control); return; } if ((tsn == (asoc->cumulative_tsn + 1) && (asoc->idata_supported == 0))) { From owner-svn-src-stable-11@freebsd.org Sat Apr 7 19:14:32 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3710AF9FF60; Sat, 7 Apr 2018 19:14:32 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D9D51778B7; Sat, 7 Apr 2018 19:14:31 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D4E3824E89; Sat, 7 Apr 2018 19:14:31 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37JEVI2051533; Sat, 7 Apr 2018 19:14:31 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37JEVch051529; Sat, 7 Apr 2018 19:14:31 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071914.w37JEVch051529@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 19:14:31 +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: r332201 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332201 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 19:14:32 -0000 Author: tuexen Date: Sat Apr 7 19:14:31 2018 New Revision: 332201 URL: https://svnweb.freebsd.org/changeset/base/332201 Log: MFC r323861: Code cleanup, no functional change. Modified: stable/11/sys/netinet/sctp_constants.h stable/11/sys/netinet/sctp_input.c stable/11/sys/netinet/sctp_output.c stable/11/sys/netinet/sctp_output.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_constants.h ============================================================================== --- stable/11/sys/netinet/sctp_constants.h Sat Apr 7 19:13:05 2018 (r332200) +++ stable/11/sys/netinet/sctp_constants.h Sat Apr 7 19:14:31 2018 (r332201) @@ -969,9 +969,6 @@ __FBSDID("$FreeBSD$"); #define SCTP_SO_NOT_LOCKED 0 -#define SCTP_HOLDS_LOCK 1 -#define SCTP_NOT_LOCKED 0 - /*- * For address locks, do we hold the lock? */ Modified: stable/11/sys/netinet/sctp_input.c ============================================================================== --- stable/11/sys/netinet/sctp_input.c Sat Apr 7 19:13:05 2018 (r332200) +++ stable/11/sys/netinet/sctp_input.c Sat Apr 7 19:14:31 2018 (r332201) @@ -199,8 +199,7 @@ sctp_handle_init(struct mbuf *m, int iphlen, int offse sctp_send_initiate_ack(inp, stcb, net, m, iphlen, offset, src, dst, sh, cp, mflowtype, mflowid, - vrf_id, port, - ((stcb == NULL) ? SCTP_HOLDS_LOCK : SCTP_NOT_LOCKED)); + vrf_id, port); } outnow: if (stcb == NULL) { Modified: stable/11/sys/netinet/sctp_output.c ============================================================================== --- stable/11/sys/netinet/sctp_output.c Sat Apr 7 19:13:05 2018 (r332200) +++ stable/11/sys/netinet/sctp_output.c Sat Apr 7 19:14:31 2018 (r332201) @@ -5491,7 +5491,7 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct struct sockaddr *src, struct sockaddr *dst, struct sctphdr *sh, struct sctp_init_chunk *init_chk, uint8_t mflowtype, uint32_t mflowid, - uint32_t vrf_id, uint16_t port, int hold_inp_lock) + uint32_t vrf_id, uint16_t port) { struct sctp_association *asoc; struct mbuf *m, *m_tmp, *m_last, *m_cookie, *op_err; @@ -5839,10 +5839,6 @@ do_a_abort: } else { uint32_t vtag, itsn; - if (hold_inp_lock) { - SCTP_INP_INCR_REF(inp); - SCTP_INP_RUNLOCK(inp); - } if (asoc) { atomic_add_int(&asoc->refcnt, 1); SCTP_TCB_UNLOCK(stcb); @@ -5862,12 +5858,12 @@ do_a_abort: SCTP_TCB_LOCK(stcb); atomic_add_int(&asoc->refcnt, -1); } else { + SCTP_INP_INCR_REF(inp); + SCTP_INP_RUNLOCK(inp); vtag = sctp_select_a_tag(inp, inp->sctp_lport, sh->src_port, 1); initack->init.initiate_tag = htonl(vtag); /* get a TSN to use too */ initack->init.initial_tsn = htonl(sctp_select_initial_TSN(&inp->sctp_ep)); - } - if (hold_inp_lock) { SCTP_INP_RLOCK(inp); SCTP_INP_DECR_REF(inp); } Modified: stable/11/sys/netinet/sctp_output.h ============================================================================== --- stable/11/sys/netinet/sctp_output.h Sat Apr 7 19:13:05 2018 (r332200) +++ stable/11/sys/netinet/sctp_output.h Sat Apr 7 19:14:31 2018 (r332201) @@ -86,7 +86,7 @@ sctp_send_initiate_ack(struct sctp_inpcb *, struct sct struct sockaddr *, struct sockaddr *, struct sctphdr *, struct sctp_init_chunk *, uint8_t, uint32_t, - uint32_t, uint16_t, int); + uint32_t, uint16_t); struct mbuf * sctp_arethere_unrecognized_parameters(struct mbuf *, int, int *, From owner-svn-src-stable-11@freebsd.org Sat Apr 7 19:16:07 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 648FBFA00ED; Sat, 7 Apr 2018 19:16:07 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 16ECB786FF; Sat, 7 Apr 2018 19:16:07 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0EADE24E8A; Sat, 7 Apr 2018 19:16:07 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37JG6eN051648; Sat, 7 Apr 2018 19:16:06 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37JG6FF051647; Sat, 7 Apr 2018 19:16:06 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071916.w37JG6FF051647@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 19:16: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: r332202 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332202 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 19:16:07 -0000 Author: tuexen Date: Sat Apr 7 19:16:06 2018 New Revision: 332202 URL: https://svnweb.freebsd.org/changeset/base/332202 Log: MFC r323902: Add missing socket lock. Modified: stable/11/sys/netinet/sctp_pcb.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_pcb.c ============================================================================== --- stable/11/sys/netinet/sctp_pcb.c Sat Apr 7 19:14:31 2018 (r332201) +++ stable/11/sys/netinet/sctp_pcb.c Sat Apr 7 19:16:06 2018 (r332202) @@ -2484,7 +2484,9 @@ sctp_inpcb_alloc(struct socket *so, uint32_t vrf_id) inp->sctp_flags = (SCTP_PCB_FLAGS_TCPTYPE | SCTP_PCB_FLAGS_UNBOUND); /* Be sure we have blocking IO by default */ + SOCK_LOCK(so); SCTP_CLEAR_SO_NBIO(so); + SOCK_UNLOCK(so); } else { /* * unsupported socket type (RAW, etc)- in case we missed it From owner-svn-src-stable-11@freebsd.org Sat Apr 7 19:17:31 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B914FFA0224; Sat, 7 Apr 2018 19:17:31 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 69572793BC; Sat, 7 Apr 2018 19:17:31 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 634DE24E8B; Sat, 7 Apr 2018 19:17:31 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37JHVR4051750; Sat, 7 Apr 2018 19:17:31 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37JHVKv051749; Sat, 7 Apr 2018 19:17:31 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071917.w37JHVKv051749@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 19:17:31 +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: r332203 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332203 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 19:17:32 -0000 Author: tuexen Date: Sat Apr 7 19:17:31 2018 New Revision: 332203 URL: https://svnweb.freebsd.org/changeset/base/332203 Log: MFC r323904: Add missing locking. Found by Coverity while scanning the usrsctp library. Modified: stable/11/sys/netinet/sctp_input.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_input.c ============================================================================== --- stable/11/sys/netinet/sctp_input.c Sat Apr 7 19:16:06 2018 (r332202) +++ stable/11/sys/netinet/sctp_input.c Sat Apr 7 19:17:31 2018 (r332203) @@ -701,6 +701,14 @@ sctp_handle_nat_colliding_state(struct sctp_tcb *stcb) */ struct sctpasochead *head; + if ((SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_COOKIE_WAIT) || + (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_COOKIE_ECHOED)) { + atomic_add_int(&stcb->asoc.refcnt, 1); + SCTP_TCB_UNLOCK(stcb); + SCTP_INP_INFO_WLOCK(); + SCTP_TCB_LOCK(stcb); + atomic_subtract_int(&stcb->asoc.refcnt, 1); + } if (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_COOKIE_WAIT) { /* generate a new vtag and send init */ LIST_REMOVE(stcb, sctp_asocs); @@ -712,6 +720,7 @@ sctp_handle_nat_colliding_state(struct sctp_tcb *stcb) */ LIST_INSERT_HEAD(head, stcb, sctp_asocs); sctp_send_initiate(stcb->sctp_ep, stcb, SCTP_SO_NOT_LOCKED); + SCTP_INP_INFO_WUNLOCK(); return (1); } if (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_COOKIE_ECHOED) { @@ -733,6 +742,7 @@ sctp_handle_nat_colliding_state(struct sctp_tcb *stcb) */ LIST_INSERT_HEAD(head, stcb, sctp_asocs); sctp_send_initiate(stcb->sctp_ep, stcb, SCTP_SO_NOT_LOCKED); + SCTP_INP_INFO_WUNLOCK(); return (1); } return (0); From owner-svn-src-stable-11@freebsd.org Sat Apr 7 19:19:27 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DDFC4FA04E2; Sat, 7 Apr 2018 19:19:26 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8B0887A4FD; Sat, 7 Apr 2018 19:19:26 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7F31D24E8D; Sat, 7 Apr 2018 19:19:26 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37JJQQA051873; Sat, 7 Apr 2018 19:19:26 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37JJQTR051871; Sat, 7 Apr 2018 19:19:26 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071919.w37JJQTR051871@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 19:19:26 +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: r332204 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332204 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 19:19:27 -0000 Author: tuexen Date: Sat Apr 7 19:19:25 2018 New Revision: 332204 URL: https://svnweb.freebsd.org/changeset/base/332204 Log: MFC r324056: Remove unused function. Modified: stable/11/sys/netinet/sctp_asconf.c stable/11/sys/netinet/sctp_asconf.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_asconf.c ============================================================================== --- stable/11/sys/netinet/sctp_asconf.c Sat Apr 7 19:17:31 2018 (r332203) +++ stable/11/sys/netinet/sctp_asconf.c Sat Apr 7 19:19:25 2018 (r332204) @@ -2305,39 +2305,6 @@ sctp_set_primary_ip_address_sa(struct sctp_tcb *stcb, return (0); } -void -sctp_set_primary_ip_address(struct sctp_ifa *ifa) -{ - struct sctp_inpcb *inp; - - /* go through all our PCB's */ - LIST_FOREACH(inp, &SCTP_BASE_INFO(listhead), sctp_list) { - struct sctp_tcb *stcb; - - /* process for all associations for this endpoint */ - LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) { - /* queue an ASCONF:SET_PRIM_ADDR to be sent */ - if (!sctp_asconf_queue_add(stcb, ifa, - SCTP_SET_PRIM_ADDR)) { - /* set primary queuing succeeded */ - SCTPDBG(SCTP_DEBUG_ASCONF1, "set_primary_ip_address: queued on stcb=%p, ", - (void *)stcb); - SCTPDBG_ADDR(SCTP_DEBUG_ASCONF1, &ifa->address.sa); - if ((SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_OPEN) || - (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) { -#ifdef SCTP_TIMER_BASED_ASCONF - sctp_timer_start(SCTP_TIMER_TYPE_ASCONF, - stcb->sctp_ep, stcb, - stcb->asoc.primary_destination); -#else - sctp_send_asconf(stcb, NULL, SCTP_ADDR_NOT_LOCKED); -#endif - } - } - } /* for each stcb */ - } /* for each inp */ -} - int sctp_is_addr_pending(struct sctp_tcb *stcb, struct sctp_ifa *sctp_ifa) { Modified: stable/11/sys/netinet/sctp_asconf.h ============================================================================== --- stable/11/sys/netinet/sctp_asconf.h Sat Apr 7 19:17:31 2018 (r332203) +++ stable/11/sys/netinet/sctp_asconf.h Sat Apr 7 19:19:25 2018 (r332204) @@ -73,9 +73,6 @@ sctp_set_primary_ip_address_sa(struct sctp_tcb *, struct sockaddr *); extern void - sctp_set_primary_ip_address(struct sctp_ifa *ifa); - -extern void sctp_check_address_list(struct sctp_tcb *, struct mbuf *, int, int, struct sockaddr *, uint16_t, uint16_t, uint16_t, uint16_t); From owner-svn-src-stable-11@freebsd.org Sat Apr 7 19:21:16 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 20A9AFA0819; Sat, 7 Apr 2018 19:21:16 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C06667B741; Sat, 7 Apr 2018 19:21:15 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB41A24FC0; Sat, 7 Apr 2018 19:21:15 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37JLFN9052922; Sat, 7 Apr 2018 19:21:15 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37JLFkg052920; Sat, 7 Apr 2018 19:21:15 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071921.w37JLFkg052920@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 19:21:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332205 - stable/11/usr.sbin/traceroute6 X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/usr.sbin/traceroute6 X-SVN-Commit-Revision: 332205 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 19:21:16 -0000 Author: tuexen Date: Sat Apr 7 19:21:15 2018 New Revision: 332205 URL: https://svnweb.freebsd.org/changeset/base/332205 Log: MFC r324119: * Update function definitions. * Ensure that the datalen always describes the length after the IPv6 header consistently, not matter which protocol us used for probes.. * Document that the default length is 20, not 12. * Don't send inormation in probe packets which is not needed or even checked when the responses are processed. * Address CID 978587. This is mainly a cleanup preparing the addition of SCTP and TCP as possible probe packet protocols. Modified: stable/11/usr.sbin/traceroute6/traceroute6.8 stable/11/usr.sbin/traceroute6/traceroute6.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/traceroute6/traceroute6.8 ============================================================================== --- stable/11/usr.sbin/traceroute6/traceroute6.8 Sat Apr 7 19:19:25 2018 (r332204) +++ stable/11/usr.sbin/traceroute6/traceroute6.8 Sat Apr 7 19:21:15 2018 (r332205) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 24, 2009 +.Dd September 30, 2017 .Dt TRACEROUTE6 8 .Os .\" @@ -40,7 +40,7 @@ .Sh SYNOPSIS .Nm .Bk -words -.Op Fl adIlnNrvU +.Op Fl adIlnNrUv .Ek .Bk -words .Op Fl f Ar firsthop @@ -79,7 +79,7 @@ uses the IPv6 protocol hop limit field to elicit an IC response from each gateway along the path to some host. .Pp The only mandatory parameter is the destination host name or IPv6 address. -The default probe datagram carries 12 bytes of payload, +The default probe datagram carries 20 bytes of payload, in addition to the IPv6 header. The size of the payload can be specified by giving a length (in bytes) @@ -96,9 +96,9 @@ Debug mode. .It Fl f Ar firsthop Specify how many hops to skip in trace. .It Fl g Ar gateway -Specify intermediate gateway -.Nm ( -uses routing header). +Specify intermediate gateway. Please note that +.Nm +tries to use routing headers. .It Fl I Use ICMP6 ECHO instead of UDP datagrams. .It Fl l Modified: stable/11/usr.sbin/traceroute6/traceroute6.c ============================================================================== --- stable/11/usr.sbin/traceroute6/traceroute6.c Sat Apr 7 19:19:25 2018 (r332204) +++ stable/11/usr.sbin/traceroute6/traceroute6.c Sat Apr 7 19:21:15 2018 (r332205) @@ -289,23 +289,8 @@ static const char rcsid[] = #define freehostent(x) #endif -/* - * format of a (udp) probe packet. - */ -struct tv32 { - u_int32_t tv32_sec; - u_int32_t tv32_usec; -}; - -struct opacket { - u_char seq; /* sequence number of this packet */ - u_char hops; /* hop limit of the packet */ - u_char pad[2]; - struct tv32 tv; /* time packet left */ -} __attribute__((__packed__)); - u_char packet[512]; /* last inbound (icmp) packet */ -struct opacket *outpacket; /* last output (udp) packet */ +char *outpacket; /* last output packet */ int main(int, char *[]); int wait_for_reply(int, struct msghdr *); @@ -333,7 +318,7 @@ int rcvhlim; struct in6_pktinfo *rcvpktinfo; struct sockaddr_in6 Src, Dst, Rcv; -u_long datalen; /* How much data */ +u_long datalen = 20; /* How much data */ #define ICMP6ECHOLEN 8 /* XXX: 2064 = 127(max hops in type 0 rthdr) * sizeof(ip6_hdr) + 16(margin) */ char rtbuf[2064]; @@ -362,9 +347,7 @@ char *as_server = NULL; void *asn; int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { int mib[4] = { CTL_NET, PF_INET6, IPPROTO_IPV6, IPV6CTL_DEFHLIM }; char hbuf[NI_MAXHOST], src0[NI_MAXHOST], *ep; @@ -533,12 +516,12 @@ main(argc, argv) */ source = optarg; break; - case 'v': - verbose++; - break; case 'U': useproto = IPPROTO_UDP; break; + case 'v': + verbose++; + break; case 'w': ep = NULL; errno = 0; @@ -574,13 +557,13 @@ main(argc, argv) } break; case IPPROTO_NONE: - if ((sndsock = socket(AF_INET6, SOCK_RAW, IPPROTO_NONE)) < 0) { + if ((sndsock = socket(AF_INET6, SOCK_RAW, IPPROTO_NONE)) < 0) { perror("socket(SOCK_RAW)"); exit(5); } break; default: - fprintf(stderr, "traceroute6: unknown probe protocol %d", + fprintf(stderr, "traceroute6: unknown probe protocol %d\n", useproto); exit(5); } @@ -641,7 +624,7 @@ main(argc, argv) ep = NULL; errno = 0; datalen = strtoul(*argv, &ep, 0); - if (errno || !*argv || *ep) { + if (errno || *ep) { fprintf(stderr, "traceroute6: invalid packet length.\n"); exit(1); @@ -649,10 +632,10 @@ main(argc, argv) } switch (useproto) { case IPPROTO_ICMPV6: - minlen = ICMP6ECHOLEN + sizeof(struct tv32); + minlen = ICMP6ECHOLEN; break; case IPPROTO_UDP: - minlen = sizeof(struct opacket); + minlen = sizeof(struct udphdr); break; case IPPROTO_NONE: minlen = 0; @@ -671,6 +654,8 @@ main(argc, argv) minlen, MAXPACKET); exit(1); } + if (useproto == IPPROTO_UDP) + datalen -= sizeof(struct udphdr); outpacket = malloc(datalen); if (!outpacket) { perror("malloc"); @@ -735,8 +720,10 @@ main(argc, argv) #ifdef SO_SNDBUF i = datalen; + if (i == 0) + i = 1; if (setsockopt(sndsock, SOL_SOCKET, SO_SNDBUF, (char *)&i, - sizeof(i)) < 0 && useproto != IPPROTO_NONE) { + sizeof(i)) < 0) { perror("setsockopt(SO_SNDBUF)"); exit(6); } @@ -977,9 +964,7 @@ main(argc, argv) } int -wait_for_reply(sock, mhdr) - int sock; - struct msghdr *mhdr; +wait_for_reply(int sock, struct msghdr *mhdr) { #ifdef HAVE_POLL struct pollfd pfd[1]; @@ -1038,14 +1023,9 @@ setpolicy(so, policy) #endif void -send_probe(seq, hops) - int seq; - u_long hops; +send_probe(int seq, u_long hops) { struct icmp6_hdr *icp; - struct opacket *op; - struct timeval tv; - struct tv32 tv32; int i; i = hops; @@ -1055,9 +1035,6 @@ send_probe(seq, hops) } Dst.sin6_port = htons(port + seq); - (void) gettimeofday(&tv, NULL); - tv32.tv32_sec = htonl(tv.tv_sec); - tv32.tv32_usec = htonl(tv.tv_usec); switch (useproto) { case IPPROTO_ICMPV6: @@ -1068,15 +1045,8 @@ send_probe(seq, hops) icp->icmp6_cksum = 0; icp->icmp6_id = ident; icp->icmp6_seq = htons(seq); - bcopy(&tv32, ((u_int8_t *)outpacket + ICMP6ECHOLEN), - sizeof(tv32)); break; case IPPROTO_UDP: - op = outpacket; - - op->seq = seq; - op->hops = hops; - bcopy(&tv32, &op->tv, sizeof tv32); break; case IPPROTO_NONE: /* No space for anything. No harm as seq/tv32 are decorative. */ @@ -1098,8 +1068,7 @@ send_probe(seq, hops) } int -get_hoplim(mhdr) - struct msghdr *mhdr; +get_hoplim(struct msghdr *mhdr) { struct cmsghdr *cm; @@ -1115,8 +1084,7 @@ get_hoplim(mhdr) } double -deltaT(t1p, t2p) - struct timeval *t1p, *t2p; +deltaT(struct timeval *t1p, struct timeval *t2p) { double dt; @@ -1185,10 +1153,7 @@ pr_type(int t0) } int -packet_ok(mhdr, cc, seq) - struct msghdr *mhdr; - int cc; - int seq; +packet_ok(struct msghdr *mhdr, int cc, int seq) { struct icmp6_hdr *icp; struct sockaddr_in6 *from = (struct sockaddr_in6 *)mhdr->msg_name; @@ -1262,6 +1227,8 @@ packet_ok(mhdr, cc, seq) if ((type == ICMP6_TIME_EXCEEDED && code == ICMP6_TIME_EXCEED_TRANSIT) || type == ICMP6_DST_UNREACH) { struct ip6_hdr *hip; + struct icmp6_hdr *icmp; + struct udphdr *udp; void *up; hip = (struct ip6_hdr *)(icp + 1); @@ -1272,14 +1239,16 @@ packet_ok(mhdr, cc, seq) } switch (useproto) { case IPPROTO_ICMPV6: - if (((struct icmp6_hdr *)up)->icmp6_id == ident && - ((struct icmp6_hdr *)up)->icmp6_seq == htons(seq)) + icmp = (struct icmp6_hdr *)up; + if (icmp->icmp6_id == ident && + icmp->icmp6_seq == htons(seq)) return (type == ICMP6_TIME_EXCEEDED ? -1 : code + 1); break; case IPPROTO_UDP: - if (((struct udphdr *)up)->uh_sport == htons(srcport) && - ((struct udphdr *)up)->uh_dport == htons(port + seq)) + udp = (struct udphdr *)up; + if (udp->uh_sport == htons(srcport) && + udp->uh_dport == htons(port + seq)) return (type == ICMP6_TIME_EXCEEDED ? -1 : code + 1); break; @@ -1328,9 +1297,7 @@ packet_ok(mhdr, cc, seq) * Increment pointer until find the UDP or ICMP header. */ void * -get_uphdr(ip6, lim) - struct ip6_hdr *ip6; - u_char *lim; +get_uphdr(struct ip6_hdr *ip6, u_char *lim) { u_char *cp = (u_char *)ip6, nh; int hlen; @@ -1374,9 +1341,7 @@ get_uphdr(ip6, lim) } void -print(mhdr, cc) - struct msghdr *mhdr; - int cc; +print(struct msghdr *mhdr, int cc) { struct sockaddr_in6 *from = (struct sockaddr_in6 *)mhdr->msg_name; char hbuf[NI_MAXHOST]; @@ -1412,8 +1377,7 @@ print(mhdr, cc) * numeric value, otherwise try for symbolic name. */ const char * -inetname(sa) - struct sockaddr *sa; +inetname(struct sockaddr *sa) { static char line[NI_MAXHOST], domain[MAXHOSTNAMELEN + 1]; static int first = 1; @@ -1447,7 +1411,7 @@ inetname(sa) } void -usage() +usage(void) { fprintf(stderr, From owner-svn-src-stable-11@freebsd.org Sat Apr 7 19:22:33 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B47A8FA09F6; Sat, 7 Apr 2018 19:22:33 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 606FF7C3CC; Sat, 7 Apr 2018 19:22:33 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5827825025; Sat, 7 Apr 2018 19:22:33 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37JMX31057243; Sat, 7 Apr 2018 19:22:33 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37JMXA2057241; Sat, 7 Apr 2018 19:22:33 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071922.w37JMXA2057241@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 19:22:33 +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: r332206 - stable/11/usr.sbin/traceroute6 X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/usr.sbin/traceroute6 X-SVN-Commit-Revision: 332206 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 19:22:34 -0000 Author: tuexen Date: Sat Apr 7 19:22:32 2018 New Revision: 332206 URL: https://svnweb.freebsd.org/changeset/base/332206 Log: MFC r324120: Add SCTP and TCP as protocols for sending probe packets. Modified: stable/11/usr.sbin/traceroute6/traceroute6.8 stable/11/usr.sbin/traceroute6/traceroute6.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/traceroute6/traceroute6.8 ============================================================================== --- stable/11/usr.sbin/traceroute6/traceroute6.8 Sat Apr 7 19:21:15 2018 (r332205) +++ stable/11/usr.sbin/traceroute6/traceroute6.8 Sat Apr 7 19:22:32 2018 (r332206) @@ -40,7 +40,7 @@ .Sh SYNOPSIS .Nm .Bk -words -.Op Fl adIlnNrUv +.Op Fl adIlnNrSTUv .Ek .Bk -words .Op Fl f Ar firsthop @@ -119,7 +119,7 @@ Do not resolve numeric address to hostname. Use a packet with no upper layer header for the probes, instead of UDP datagrams. .It Fl p Ar port -Set UDP port number to +Set SCTP/TCP/UDP port number to .Ar port . .It Fl q Ar probes Set the number of probe per hop count to @@ -138,6 +138,10 @@ that has no route through it .It Fl s Ar src .Ar Src specifies the source IPv6 address to be used. +.It Fl S +Use SCTP packets for the probes. +.It Fl T +Use TCP segments for the probes. .It Fl U Use UDP datagrams for the probes. This is the default. Modified: stable/11/usr.sbin/traceroute6/traceroute6.c ============================================================================== --- stable/11/usr.sbin/traceroute6/traceroute6.c Sat Apr 7 19:21:15 2018 (r332205) +++ stable/11/usr.sbin/traceroute6/traceroute6.c Sat Apr 7 19:22:32 2018 (r332206) @@ -271,6 +271,8 @@ static const char rcsid[] = #include #include +#include +#include #include #ifdef IPSEC @@ -307,10 +309,14 @@ const char *pr_type(int); int packet_ok(struct msghdr *, int, int); void print(struct msghdr *, int); const char *inetname(struct sockaddr *); +u_int32_t sctp_crc32c(void *, u_int32_t); +u_int16_t in_cksum(u_int16_t *addr, int); +u_int16_t tcp_chksum(struct sockaddr_in6 *, struct sockaddr_in6 *, + void *, u_int32_t); void usage(void); int rcvsock; /* receive (icmp) socket file descriptor */ -int sndsock; /* send (udp) socket file descriptor */ +int sndsock; /* send (raw/udp) socket file descriptor */ struct msghdr rcvmhdr; struct iovec rcviov[2]; @@ -394,8 +400,9 @@ main(int argc, char *argv[]) #endif seq = 0; + ident = htons(getpid() & 0xffff); /* same as ping6 */ - while ((ch = getopt(argc, argv, "aA:df:g:Ilm:nNp:q:rs:Uvw:")) != -1) + while ((ch = getopt(argc, argv, "aA:df:g:Ilm:nNp:q:rs:STUvw:")) != -1) switch (ch) { case 'a': as_path = 1; @@ -455,7 +462,6 @@ main(int argc, char *argv[]) break; case 'I': useproto = IPPROTO_ICMPV6; - ident = htons(getpid() & 0xffff); /* same as ping6 */ break; case 'l': lflag++; @@ -516,6 +522,12 @@ main(int argc, char *argv[]) */ source = optarg; break; + case 'S': + useproto = IPPROTO_SCTP; + break; + case 'T': + useproto = IPPROTO_TCP; + break; case 'U': useproto = IPPROTO_UDP; break; @@ -557,7 +569,9 @@ main(int argc, char *argv[]) } break; case IPPROTO_NONE: - if ((sndsock = socket(AF_INET6, SOCK_RAW, IPPROTO_NONE)) < 0) { + case IPPROTO_SCTP: + case IPPROTO_TCP: + if ((sndsock = socket(AF_INET6, SOCK_RAW, useproto)) < 0) { perror("socket(SOCK_RAW)"); exit(5); } @@ -641,6 +655,12 @@ main(int argc, char *argv[]) minlen = 0; datalen = 0; break; + case IPPROTO_SCTP: + minlen = sizeof(struct sctphdr); + break; + case IPPROTO_TCP: + minlen = sizeof(struct tcphdr); + break; default: fprintf(stderr, "traceroute6: unknown probe protocol %d.\n", useproto); @@ -1026,6 +1046,9 @@ void send_probe(int seq, u_long hops) { struct icmp6_hdr *icp; + struct sctphdr *sctp; + struct sctp_chunkhdr *chk; + struct tcphdr *tcp; int i; i = hops; @@ -1051,6 +1074,43 @@ send_probe(int seq, u_long hops) case IPPROTO_NONE: /* No space for anything. No harm as seq/tv32 are decorative. */ break; + case IPPROTO_SCTP: + sctp = (struct sctphdr *)outpacket; + + sctp->src_port = htons(ident); + sctp->dest_port = htons(port + seq); + sctp->v_tag = (sctp->src_port << 16) | sctp->dest_port; + sctp->checksum = htonl(0); + if (datalen >= (u_long)(sizeof(struct sctphdr) + + sizeof(struct sctp_chunkhdr))) { + chk = (struct sctp_chunkhdr *)(sctp + 1); + chk->chunk_type = SCTP_SHUTDOWN_ACK; + chk->chunk_flags = 0; + chk->chunk_length = htons(4); + } + if (datalen >= (u_long)(sizeof(struct sctphdr) + + 2 * sizeof(struct sctp_chunkhdr))) { + chk = chk + 1; + chk->chunk_type = SCTP_PAD_CHUNK; + chk->chunk_flags = 0; + chk->chunk_length = htons((u_int16_t)(datalen - + sizeof(struct sctphdr) - + sizeof(struct sctp_chunkhdr))); + } + sctp->checksum = sctp_crc32c(outpacket, datalen); + break; + case IPPROTO_TCP: + tcp = (struct tcphdr *)outpacket; + + tcp->th_sport = htons(ident); + tcp->th_dport = htons(port + seq); + tcp->th_seq = (tcp->th_sport << 16) | tcp->th_dport; + tcp->th_ack = 0; + tcp->th_off = 5; + tcp->th_flags = TH_SYN; + tcp->th_sum = 0; + tcp->th_sum = tcp_chksum(&Src, &Dst, outpacket, datalen); + break; default: fprintf(stderr, "Unknown probe protocol %d.\n", useproto); exit(1); @@ -1228,6 +1288,8 @@ packet_ok(struct msghdr *mhdr, int cc, int seq) || type == ICMP6_DST_UNREACH) { struct ip6_hdr *hip; struct icmp6_hdr *icmp; + struct sctphdr *sctp; + struct tcphdr *tcp; struct udphdr *udp; void *up; @@ -1252,6 +1314,24 @@ packet_ok(struct msghdr *mhdr, int cc, int seq) return (type == ICMP6_TIME_EXCEEDED ? -1 : code + 1); break; + case IPPROTO_SCTP: + sctp = (struct sctphdr *)up; + if (sctp->src_port == htons(ident) && + sctp->dest_port == htons(port + seq) && + sctp->v_tag == + (u_int32_t)((sctp->src_port << 16) | sctp->dest_port)) + return (type == ICMP6_TIME_EXCEEDED ? + -1 : code + 1); + break; + case IPPROTO_TCP: + tcp = (struct tcphdr *)up; + if (tcp->th_sport == htons(ident) && + tcp->th_dport == htons(port + seq) && + tcp->th_seq == + (tcp_seq)((tcp->th_sport << 16) | tcp->th_dport)) + return (type == ICMP6_TIME_EXCEEDED ? + -1 : code + 1); + break; case IPPROTO_NONE: return (type == ICMP6_TIME_EXCEEDED ? -1 : code + 1); default: @@ -1312,10 +1392,11 @@ get_uphdr(struct ip6_hdr *ip6, u_char *lim) while (lim - cp >= (nh == IPPROTO_NONE ? 0 : 8)) { switch (nh) { case IPPROTO_ESP: - case IPPROTO_TCP: return(NULL); case IPPROTO_ICMPV6: return(useproto == nh ? cp : NULL); + case IPPROTO_SCTP: + case IPPROTO_TCP: case IPPROTO_UDP: return(useproto == nh ? cp : NULL); case IPPROTO_NONE: @@ -1410,12 +1491,163 @@ inetname(struct sockaddr *sa) return line; } +/* + * CRC32C routine for the Stream Control Transmission Protocol + */ + +#define CRC32C(c, d) (c = (c>>8) ^ crc_c[(c^(d))&0xFF]) + +static u_int32_t crc_c[256] = { + 0x00000000, 0xF26B8303, 0xE13B70F7, 0x1350F3F4, + 0xC79A971F, 0x35F1141C, 0x26A1E7E8, 0xD4CA64EB, + 0x8AD958CF, 0x78B2DBCC, 0x6BE22838, 0x9989AB3B, + 0x4D43CFD0, 0xBF284CD3, 0xAC78BF27, 0x5E133C24, + 0x105EC76F, 0xE235446C, 0xF165B798, 0x030E349B, + 0xD7C45070, 0x25AFD373, 0x36FF2087, 0xC494A384, + 0x9A879FA0, 0x68EC1CA3, 0x7BBCEF57, 0x89D76C54, + 0x5D1D08BF, 0xAF768BBC, 0xBC267848, 0x4E4DFB4B, + 0x20BD8EDE, 0xD2D60DDD, 0xC186FE29, 0x33ED7D2A, + 0xE72719C1, 0x154C9AC2, 0x061C6936, 0xF477EA35, + 0xAA64D611, 0x580F5512, 0x4B5FA6E6, 0xB93425E5, + 0x6DFE410E, 0x9F95C20D, 0x8CC531F9, 0x7EAEB2FA, + 0x30E349B1, 0xC288CAB2, 0xD1D83946, 0x23B3BA45, + 0xF779DEAE, 0x05125DAD, 0x1642AE59, 0xE4292D5A, + 0xBA3A117E, 0x4851927D, 0x5B016189, 0xA96AE28A, + 0x7DA08661, 0x8FCB0562, 0x9C9BF696, 0x6EF07595, + 0x417B1DBC, 0xB3109EBF, 0xA0406D4B, 0x522BEE48, + 0x86E18AA3, 0x748A09A0, 0x67DAFA54, 0x95B17957, + 0xCBA24573, 0x39C9C670, 0x2A993584, 0xD8F2B687, + 0x0C38D26C, 0xFE53516F, 0xED03A29B, 0x1F682198, + 0x5125DAD3, 0xA34E59D0, 0xB01EAA24, 0x42752927, + 0x96BF4DCC, 0x64D4CECF, 0x77843D3B, 0x85EFBE38, + 0xDBFC821C, 0x2997011F, 0x3AC7F2EB, 0xC8AC71E8, + 0x1C661503, 0xEE0D9600, 0xFD5D65F4, 0x0F36E6F7, + 0x61C69362, 0x93AD1061, 0x80FDE395, 0x72966096, + 0xA65C047D, 0x5437877E, 0x4767748A, 0xB50CF789, + 0xEB1FCBAD, 0x197448AE, 0x0A24BB5A, 0xF84F3859, + 0x2C855CB2, 0xDEEEDFB1, 0xCDBE2C45, 0x3FD5AF46, + 0x7198540D, 0x83F3D70E, 0x90A324FA, 0x62C8A7F9, + 0xB602C312, 0x44694011, 0x5739B3E5, 0xA55230E6, + 0xFB410CC2, 0x092A8FC1, 0x1A7A7C35, 0xE811FF36, + 0x3CDB9BDD, 0xCEB018DE, 0xDDE0EB2A, 0x2F8B6829, + 0x82F63B78, 0x709DB87B, 0x63CD4B8F, 0x91A6C88C, + 0x456CAC67, 0xB7072F64, 0xA457DC90, 0x563C5F93, + 0x082F63B7, 0xFA44E0B4, 0xE9141340, 0x1B7F9043, + 0xCFB5F4A8, 0x3DDE77AB, 0x2E8E845F, 0xDCE5075C, + 0x92A8FC17, 0x60C37F14, 0x73938CE0, 0x81F80FE3, + 0x55326B08, 0xA759E80B, 0xB4091BFF, 0x466298FC, + 0x1871A4D8, 0xEA1A27DB, 0xF94AD42F, 0x0B21572C, + 0xDFEB33C7, 0x2D80B0C4, 0x3ED04330, 0xCCBBC033, + 0xA24BB5A6, 0x502036A5, 0x4370C551, 0xB11B4652, + 0x65D122B9, 0x97BAA1BA, 0x84EA524E, 0x7681D14D, + 0x2892ED69, 0xDAF96E6A, 0xC9A99D9E, 0x3BC21E9D, + 0xEF087A76, 0x1D63F975, 0x0E330A81, 0xFC588982, + 0xB21572C9, 0x407EF1CA, 0x532E023E, 0xA145813D, + 0x758FE5D6, 0x87E466D5, 0x94B49521, 0x66DF1622, + 0x38CC2A06, 0xCAA7A905, 0xD9F75AF1, 0x2B9CD9F2, + 0xFF56BD19, 0x0D3D3E1A, 0x1E6DCDEE, 0xEC064EED, + 0xC38D26C4, 0x31E6A5C7, 0x22B65633, 0xD0DDD530, + 0x0417B1DB, 0xF67C32D8, 0xE52CC12C, 0x1747422F, + 0x49547E0B, 0xBB3FFD08, 0xA86F0EFC, 0x5A048DFF, + 0x8ECEE914, 0x7CA56A17, 0x6FF599E3, 0x9D9E1AE0, + 0xD3D3E1AB, 0x21B862A8, 0x32E8915C, 0xC083125F, + 0x144976B4, 0xE622F5B7, 0xF5720643, 0x07198540, + 0x590AB964, 0xAB613A67, 0xB831C993, 0x4A5A4A90, + 0x9E902E7B, 0x6CFBAD78, 0x7FAB5E8C, 0x8DC0DD8F, + 0xE330A81A, 0x115B2B19, 0x020BD8ED, 0xF0605BEE, + 0x24AA3F05, 0xD6C1BC06, 0xC5914FF2, 0x37FACCF1, + 0x69E9F0D5, 0x9B8273D6, 0x88D28022, 0x7AB90321, + 0xAE7367CA, 0x5C18E4C9, 0x4F48173D, 0xBD23943E, + 0xF36E6F75, 0x0105EC76, 0x12551F82, 0xE03E9C81, + 0x34F4F86A, 0xC69F7B69, 0xD5CF889D, 0x27A40B9E, + 0x79B737BA, 0x8BDCB4B9, 0x988C474D, 0x6AE7C44E, + 0xBE2DA0A5, 0x4C4623A6, 0x5F16D052, 0xAD7D5351 +}; + +u_int32_t +sctp_crc32c(void *packet, u_int32_t len) +{ + u_int32_t i, crc32c; + u_int8_t byte0, byte1, byte2, byte3; + u_int8_t *buf = (u_int8_t *)packet; + + crc32c = ~0; + for (i = 0; i < len; i++) + CRC32C(crc32c, buf[i]); + crc32c = ~crc32c; + byte0 = crc32c & 0xff; + byte1 = (crc32c>>8) & 0xff; + byte2 = (crc32c>>16) & 0xff; + byte3 = (crc32c>>24) & 0xff; + crc32c = ((byte0 << 24) | (byte1 << 16) | (byte2 << 8) | byte3); + return htonl(crc32c); +} + +u_int16_t +in_cksum(u_int16_t *addr, int len) +{ + int nleft = len; + u_int16_t *w = addr; + u_int16_t answer; + int sum = 0; + + /* + * Our algorithm is simple, using a 32 bit accumulator (sum), + * we add sequential 16 bit words to it, and at the end, fold + * back all the carry bits from the top 16 bits into the lower + * 16 bits. + */ + while (nleft > 1) { + sum += *w++; + nleft -= 2; + } + + /* mop up an odd byte, if necessary */ + if (nleft == 1) + sum += *(u_char *)w; + + /* + * add back carry outs from top 16 bits to low 16 bits + */ + sum = (sum >> 16) + (sum & 0xffff); /* add hi 16 to low 16 */ + sum += (sum >> 16); /* add carry */ + answer = ~sum; /* truncate to 16 bits */ + return (answer); +} + +u_int16_t +tcp_chksum(struct sockaddr_in6 *src, struct sockaddr_in6 *dst, + void *payload, u_int32_t len) +{ + struct { + struct in6_addr src; + struct in6_addr dst; + u_int32_t len; + u_int8_t zero[3]; + u_int8_t next; + } pseudo_hdr; + u_int16_t sum[2]; + + pseudo_hdr.src = src->sin6_addr; + pseudo_hdr.dst = dst->sin6_addr; + pseudo_hdr.len = htonl(len); + pseudo_hdr.zero[0] = 0; + pseudo_hdr.zero[1] = 0; + pseudo_hdr.zero[2] = 0; + pseudo_hdr.next = IPPROTO_TCP; + + sum[1] = in_cksum((u_int16_t *)&pseudo_hdr, sizeof(pseudo_hdr)); + sum[0] = in_cksum(payload, len); + + return (~in_cksum(sum, sizeof(sum))); +} + void usage(void) { fprintf(stderr, -"usage: traceroute6 [-adIlnNrUv] [-A as_server] [-f firsthop] [-g gateway]\n" +"usage: traceroute6 [-adIlnNrSTUv] [-A as_server] [-f firsthop] [-g gateway]\n" " [-m hoplimit] [-p port] [-q probes] [-s src] [-w waittime] target\n" " [datalen]\n"); exit(1); From owner-svn-src-stable-11@freebsd.org Sat Apr 7 19:23:52 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 90CAFFA0B37; Sat, 7 Apr 2018 19:23:52 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4373B7CFC7; Sat, 7 Apr 2018 19:23:52 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3E78A25027; Sat, 7 Apr 2018 19:23:52 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37JNqwo057337; Sat, 7 Apr 2018 19:23:52 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37JNqpM057336; Sat, 7 Apr 2018 19:23:52 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071923.w37JNqpM057336@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 19:23: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: r332207 - stable/11/usr.sbin/traceroute6 X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/usr.sbin/traceroute6 X-SVN-Commit-Revision: 332207 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 19:23:52 -0000 Author: tuexen Date: Sat Apr 7 19:23:51 2018 New Revision: 332207 URL: https://svnweb.freebsd.org/changeset/base/332207 Log: MFC r324122: Fix reporting of probing size. This bug was introduced in r324119. Modified: stable/11/usr.sbin/traceroute6/traceroute6.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/traceroute6/traceroute6.c ============================================================================== --- stable/11/usr.sbin/traceroute6/traceroute6.c Sat Apr 7 19:22:32 2018 (r332206) +++ stable/11/usr.sbin/traceroute6/traceroute6.c Sat Apr 7 19:23:51 2018 (r332207) @@ -904,7 +904,8 @@ main(int argc, char *argv[]) if (source) fprintf(stderr, " from %s", source); fprintf(stderr, ", %lu hops max, %lu byte packets\n", - max_hops, datalen); + max_hops, + datalen + ((useproto == IPPROTO_UDP) ? sizeof(struct udphdr) : 0)); (void) fflush(stderr); if (first_hop > 1) From owner-svn-src-stable-11@freebsd.org Sat Apr 7 19:38:56 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A5ED4FA1B0D; Sat, 7 Apr 2018 19:38:56 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 50EF4854D6; Sat, 7 Apr 2018 19:38:56 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 49998251C7; Sat, 7 Apr 2018 19:38:56 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37JcuS6062485; Sat, 7 Apr 2018 19:38:56 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37Jcu6e062483; Sat, 7 Apr 2018 19:38:56 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071938.w37Jcu6e062483@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 19:38: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: r332209 - in stable/11: sbin/ipfw sys/netpfil/ipfw X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in stable/11: sbin/ipfw sys/netpfil/ipfw X-SVN-Commit-Revision: 332209 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 19:38:56 -0000 Author: tuexen Date: Sat Apr 7 19:38:55 2018 New Revision: 332209 URL: https://svnweb.freebsd.org/changeset/base/332209 Log: MFC r324216: Fix a bug which avoided that rules for matching port numbers for SCTP packets where actually matched. While there, make clean in the man-page that SCTP port numbers are supported in rules. Modified: stable/11/sbin/ipfw/ipfw.8 stable/11/sys/netpfil/ipfw/ip_fw2.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/ipfw/ipfw.8 ============================================================================== --- stable/11/sbin/ipfw/ipfw.8 Sat Apr 7 19:29:19 2018 (r332208) +++ stable/11/sbin/ipfw/ipfw.8 Sat Apr 7 19:38:55 2018 (r332209) @@ -537,7 +537,7 @@ for filtering packets, among the following: .It Layer-2 header fields When available .It IPv4 and IPv6 Protocol -TCP, UDP, ICMP, etc. +SCTP, TCP, UDP, ICMP, etc. .It Source and dest. addresses and ports .It Direction See Section @@ -1396,7 +1396,7 @@ error-prone. No support for sets of IPv6 addresses is provided because IPv6 addresses are typically random past the initial prefix. .It Ar ports : Bro Ar port | port Ns \&- Ns Ar port Ns Brc Ns Op , Ns Ar ports -For protocols which support port numbers (such as TCP and UDP), optional +For protocols which support port numbers (such as SCTP, TCP and UDP), optional .Cm ports may be specified as one or more ports or port ranges, separated by commas but no spaces, and an optional Modified: stable/11/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- stable/11/sys/netpfil/ipfw/ip_fw2.c Sat Apr 7 19:29:19 2018 (r332208) +++ stable/11/sys/netpfil/ipfw/ip_fw2.c Sat Apr 7 19:38:55 2018 (r332209) @@ -1847,7 +1847,8 @@ do { \ */ if ((proto == IPPROTO_UDP || proto == IPPROTO_UDPLITE || - proto == IPPROTO_TCP) && offset == 0) { + proto == IPPROTO_TCP || + proto==IPPROTO_SCTP) && offset == 0) { u_int16_t x = (cmd->opcode == O_IP_SRCPORT) ? src_port : dst_port ; From owner-svn-src-stable-11@freebsd.org Sat Apr 7 19:40:49 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7192EFA1F2B; Sat, 7 Apr 2018 19:40:49 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2537386738; Sat, 7 Apr 2018 19:40:49 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1DA0F252D5; Sat, 7 Apr 2018 19:40:49 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37Jemco062630; Sat, 7 Apr 2018 19:40:48 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37JembX062629; Sat, 7 Apr 2018 19:40:48 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071940.w37JembX062629@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 19:40: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: r332210 - stable/11/sbin/ipfw X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sbin/ipfw X-SVN-Commit-Revision: 332210 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 19:40:49 -0000 Author: tuexen Date: Sat Apr 7 19:40:48 2018 New Revision: 332210 URL: https://svnweb.freebsd.org/changeset/base/332210 Log: MFC r324218: Whitespace changes: Remove leading spaces followed by a tab. Modified: stable/11/sbin/ipfw/ipfw2.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/ipfw/ipfw2.h ============================================================================== --- stable/11/sbin/ipfw/ipfw2.h Sat Apr 7 19:38:55 2018 (r332209) +++ stable/11/sbin/ipfw/ipfw2.h Sat Apr 7 19:40:48 2018 (r332210) @@ -205,14 +205,14 @@ enum tokens { TOK_IP, TOK_IF, - TOK_ALOG, - TOK_DENY_INC, - TOK_SAME_PORTS, - TOK_UNREG_ONLY, + TOK_ALOG, + TOK_DENY_INC, + TOK_SAME_PORTS, + TOK_UNREG_ONLY, TOK_SKIP_GLOBAL, - TOK_RESET_ADDR, - TOK_ALIAS_REV, - TOK_PROXY_ONLY, + TOK_RESET_ADDR, + TOK_ALIAS_REV, + TOK_PROXY_ONLY, TOK_REDIR_ADDR, TOK_REDIR_PORT, TOK_REDIR_PROTO, From owner-svn-src-stable-11@freebsd.org Sat Apr 7 19:42:54 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 844A7FA215A; Sat, 7 Apr 2018 19:42:54 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3349987B9B; Sat, 7 Apr 2018 19:42:54 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2E3EA25359; Sat, 7 Apr 2018 19:42:54 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37Jgsli067110; Sat, 7 Apr 2018 19:42:54 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37Jgs4m067109; Sat, 7 Apr 2018 19:42:54 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071942.w37Jgs4m067109@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 19:42:54 +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: r332211 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332211 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 19:42:54 -0000 Author: tuexen Date: Sat Apr 7 19:42:53 2018 New Revision: 332211 URL: https://svnweb.freebsd.org/changeset/base/332211 Log: MFC r324317: Ensure that the accept ABORT chunks with the T-bit set only the a non-zero matching peer tag is provided. Modified: stable/11/sys/netinet/sctp_input.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_input.c ============================================================================== --- stable/11/sys/netinet/sctp_input.c Sat Apr 7 19:40:48 2018 (r332210) +++ stable/11/sys/netinet/sctp_input.c Sat Apr 7 19:42:53 2018 (r332211) @@ -4676,6 +4676,7 @@ sctp_process_control(struct mbuf *m, int iphlen, int * if ((((ch->chunk_flags & SCTP_HAD_NO_TCB) == 0) && (vtag_in == asoc->my_vtag)) || (((ch->chunk_flags & SCTP_HAD_NO_TCB) == SCTP_HAD_NO_TCB) && + (asoc->peer_vtag != htonl(0)) && (vtag_in == asoc->peer_vtag))) { /* this is valid */ } else { From owner-svn-src-stable-11@freebsd.org Sat Apr 7 19:44:42 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A55C8FA2329; Sat, 7 Apr 2018 19:44:42 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 37CC968BA8; Sat, 7 Apr 2018 19:44:42 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 314912535B; Sat, 7 Apr 2018 19:44:42 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37Jig6i067251; Sat, 7 Apr 2018 19:44:42 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37JifIa067245; Sat, 7 Apr 2018 19:44:41 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071944.w37JifIa067245@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 19:44: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: r332212 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332212 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 19:44:42 -0000 Author: tuexen Date: Sat Apr 7 19:44:41 2018 New Revision: 332212 URL: https://svnweb.freebsd.org/changeset/base/332212 Log: MFC r324615: Code cleanup, not functional change. This avoids taking a pointer of a packed structure which allows simpler compilation of the userland stack. Modified: stable/11/sys/netinet/sctp_constants.h stable/11/sys/netinet/sctp_indata.c stable/11/sys/netinet/sctp_input.c stable/11/sys/netinet/sctp_output.c stable/11/sys/netinet/sctputil.c stable/11/sys/netinet/sctputil.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_constants.h ============================================================================== --- stable/11/sys/netinet/sctp_constants.h Sat Apr 7 19:42:53 2018 (r332211) +++ stable/11/sys/netinet/sctp_constants.h Sat Apr 7 19:44:41 2018 (r332212) @@ -97,10 +97,6 @@ __FBSDID("$FreeBSD$"); */ #define SCTP_DEFAULT_VRF_SIZE 4 -/* constants for rto calc */ -#define sctp_align_safe_nocopy 0 -#define sctp_align_unsafe_makecopy 1 - /* JRS - Values defined for the HTCP algorithm */ #define ALPHA_BASE (1<<7) /* 1.0 with shift << 7 */ #define BETA_MIN (1<<6) /* 0.5 with shift << 7 */ Modified: stable/11/sys/netinet/sctp_indata.c ============================================================================== --- stable/11/sys/netinet/sctp_indata.c Sat Apr 7 19:42:53 2018 (r332211) +++ stable/11/sys/netinet/sctp_indata.c Sat Apr 7 19:44:41 2018 (r332212) @@ -3058,7 +3058,6 @@ sctp_process_segment_range(struct sctp_tcb *stcb, stru &stcb->asoc, tp1->whoTo, &tp1->sent_rcv_time, - sctp_align_safe_nocopy, SCTP_RTT_FROM_DATA); *rto_ok = 0; } @@ -4030,7 +4029,6 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32 sctp_calculate_rto(stcb, asoc, tp1->whoTo, &tp1->sent_rcv_time, - sctp_align_safe_nocopy, SCTP_RTT_FROM_DATA); rto_ok = 0; } @@ -4636,7 +4634,6 @@ hopeless_peer: sctp_calculate_rto(stcb, asoc, tp1->whoTo, &tp1->sent_rcv_time, - sctp_align_safe_nocopy, SCTP_RTT_FROM_DATA); rto_ok = 0; } Modified: stable/11/sys/netinet/sctp_input.c ============================================================================== --- stable/11/sys/netinet/sctp_input.c Sat Apr 7 19:42:53 2018 (r332211) +++ stable/11/sys/netinet/sctp_input.c Sat Apr 7 19:44:41 2018 (r332212) @@ -519,7 +519,7 @@ sctp_process_init_ack(struct mbuf *m, int iphlen, int asoc->primary_destination, SCTP_FROM_SCTP_INPUT + SCTP_LOC_3); /* calculate the RTO */ - net->RTO = sctp_calculate_rto(stcb, asoc, net, &asoc->time_entered, sctp_align_safe_nocopy, + net->RTO = sctp_calculate_rto(stcb, asoc, net, &asoc->time_entered, SCTP_RTT_FROM_NON_DATA); retval = sctp_send_cookie_echo(m, offset, stcb, net); if (retval < 0) { @@ -641,7 +641,7 @@ sctp_handle_heartbeat_ack(struct sctp_heartbeat_chunk tv.tv_sec = cp->heartbeat.hb_info.time_value_1; tv.tv_usec = cp->heartbeat.hb_info.time_value_2; /* Now lets do a RTO with this */ - r_net->RTO = sctp_calculate_rto(stcb, &stcb->asoc, r_net, &tv, sctp_align_safe_nocopy, + r_net->RTO = sctp_calculate_rto(stcb, &stcb->asoc, r_net, &tv, SCTP_RTT_FROM_NON_DATA); if (!(r_net->dest_state & SCTP_ADDR_REACHABLE)) { r_net->dest_state |= SCTP_ADDR_REACHABLE; @@ -1489,6 +1489,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphle struct sctp_init_ack_chunk *initack_cp, initack_buf; struct sctp_nets *net; struct mbuf *op_err; + struct timeval old; int init_offset, initack_offset, i; int retval; int spec_flag = 0; @@ -1650,10 +1651,11 @@ sctp_process_cookie_existing(struct mbuf *m, int iphle * since we did not send a HB make sure we don't * double things */ + old.tv_sec = cookie->time_entered.tv_sec; + old.tv_usec = cookie->time_entered.tv_usec; net->hb_responded = 1; net->RTO = sctp_calculate_rto(stcb, asoc, net, - &cookie->time_entered, - sctp_align_unsafe_makecopy, + &old, SCTP_RTT_FROM_NON_DATA); if (stcb->asoc.sctp_autoclose_ticks && @@ -2370,10 +2372,13 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, in } (void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered); if ((netp != NULL) && (*netp != NULL)) { + struct timeval old; + /* calculate the RTT and set the encaps port */ + old.tv_sec = cookie->time_entered.tv_sec; + old.tv_usec = cookie->time_entered.tv_usec; (*netp)->RTO = sctp_calculate_rto(stcb, asoc, *netp, - &cookie->time_entered, sctp_align_unsafe_makecopy, - SCTP_RTT_FROM_NON_DATA); + &old, SCTP_RTT_FROM_NON_DATA); } /* respond with a COOKIE-ACK */ sctp_send_cookie_ack(stcb); @@ -2939,7 +2944,7 @@ sctp_handle_cookie_ack(struct sctp_cookie_ack_chunk *c SCTP_STAT_INCR_GAUGE32(sctps_currestab); if (asoc->overall_error_count == 0) { net->RTO = sctp_calculate_rto(stcb, asoc, net, - &asoc->time_entered, sctp_align_safe_nocopy, + &asoc->time_entered, SCTP_RTT_FROM_NON_DATA); } (void)SCTP_GETTIME_TIMEVAL(&asoc->time_entered); Modified: stable/11/sys/netinet/sctp_output.c ============================================================================== --- stable/11/sys/netinet/sctp_output.c Sat Apr 7 19:42:53 2018 (r332211) +++ stable/11/sys/netinet/sctp_output.c Sat Apr 7 19:44:41 2018 (r332212) @@ -5501,6 +5501,7 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct struct sctp_paramhdr *ph; union sctp_sockstore *over_addr; struct sctp_scoping scp; + struct timeval now; #ifdef INET struct sockaddr_in *dst4 = (struct sockaddr_in *)dst; struct sockaddr_in *src4 = (struct sockaddr_in *)src; @@ -5601,7 +5602,9 @@ do_a_abort: memset(&stc, 0, sizeof(struct sctp_state_cookie)); /* the time I built cookie */ - (void)SCTP_GETTIME_TIMEVAL(&stc.time_entered); + (void)SCTP_GETTIME_TIMEVAL(&now); + stc.time_entered.tv_sec = now.tv_sec; + stc.time_entered.tv_usec = now.tv_usec; /* populate any tie tags */ if (asoc != NULL) { Modified: stable/11/sys/netinet/sctputil.c ============================================================================== --- stable/11/sys/netinet/sctputil.c Sat Apr 7 19:42:53 2018 (r332211) +++ stable/11/sys/netinet/sctputil.c Sat Apr 7 19:44:41 2018 (r332212) @@ -2422,8 +2422,8 @@ uint32_t sctp_calculate_rto(struct sctp_tcb *stcb, struct sctp_association *asoc, struct sctp_nets *net, - struct timeval *told, - int safe, int rtt_from_sack) + struct timeval *old, + int rtt_from_sack) { /*- * given an association and the starting time of the current RTT @@ -2432,19 +2432,8 @@ sctp_calculate_rto(struct sctp_tcb *stcb, int32_t rtt; /* RTT in ms */ uint32_t new_rto; int first_measure = 0; - struct timeval now, then, *old; + struct timeval now; - /* Copy it out for sparc64 */ - if (safe == sctp_align_unsafe_makecopy) { - old = &then; - memcpy(&then, told, sizeof(struct timeval)); - } else if (safe == sctp_align_safe_nocopy) { - old = told; - } else { - /* error */ - SCTP_PRINTF("Huh, bad rto calc call\n"); - return (0); - } /************************/ /* 1. calculate new RTT */ /************************/ Modified: stable/11/sys/netinet/sctputil.h ============================================================================== --- stable/11/sys/netinet/sctputil.h Sat Apr 7 19:42:53 2018 (r332211) +++ stable/11/sys/netinet/sctputil.h Sat Apr 7 19:44:41 2018 (r332212) @@ -135,7 +135,7 @@ void uint32_t sctp_calculate_rto(struct sctp_tcb *, struct sctp_association *, - struct sctp_nets *, struct timeval *, int, int); + struct sctp_nets *, struct timeval *, int); uint32_t sctp_calculate_len(struct mbuf *); From owner-svn-src-stable-11@freebsd.org Sat Apr 7 19:56:35 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 30B01FA2FA4; Sat, 7 Apr 2018 19:56:35 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D92D66F614; Sat, 7 Apr 2018 19:56:34 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B3E6C2550B; Sat, 7 Apr 2018 19:56:34 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37JuYHD072212; Sat, 7 Apr 2018 19:56:34 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37JuYo2072211; Sat, 7 Apr 2018 19:56:34 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071956.w37JuYo2072211@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 19:56: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: r332213 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332213 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 19:56:35 -0000 Author: tuexen Date: Sat Apr 7 19:56:34 2018 New Revision: 332213 URL: https://svnweb.freebsd.org/changeset/base/332213 Log: MFC r324638: Fix the handling of parital and too short chunks. Ensure that the current behaviour is consistent: stop processing of the chunk, but finish the processing of the previous chunks. This behaviour might be changed in a later commit to ABORT the assoication due to a protocol violation, but changing this is a separate issue. MFC r324725 Fix a bug introduced in r324638. Thanks to Felix Weinrank for making me aware of this. MFC r324726: Revert change which got in accidently. Modified: stable/11/sys/netinet/sctp_input.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_input.c ============================================================================== --- stable/11/sys/netinet/sctp_input.c Sat Apr 7 19:44:41 2018 (r332212) +++ stable/11/sys/netinet/sctp_input.c Sat Apr 7 19:56:34 2018 (r332213) @@ -4521,7 +4521,6 @@ sctp_process_control(struct mbuf *m, int iphlen, int * * until we get into jumbo grams and such.. */ uint8_t chunk_buf[SCTP_CHUNK_BUFFER_SIZE]; - struct sctp_tcb *locked_tcb = stcb; int got_auth = 0; uint32_t auth_offset = 0, auth_len = 0; int auth_skipped = 0; @@ -4533,31 +4532,29 @@ sctp_process_control(struct mbuf *m, int iphlen, int * SCTPDBG(SCTP_DEBUG_INPUT1, "sctp_process_control: iphlen=%u, offset=%u, length=%u stcb:%p\n", iphlen, *offset, length, (void *)stcb); + if (stcb) { + SCTP_TCB_LOCK_ASSERT(stcb); + } /* validate chunk header length... */ if (ntohs(ch->chunk_length) < sizeof(*ch)) { SCTPDBG(SCTP_DEBUG_INPUT1, "Invalid header length %d\n", ntohs(ch->chunk_length)); - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } - return (NULL); + *offset = length; + return (stcb); } /* * validate the verification tag */ vtag_in = ntohl(sh->v_tag); - if (locked_tcb) { - SCTP_TCB_LOCK_ASSERT(locked_tcb); - } if (ch->chunk_type == SCTP_INITIATION) { SCTPDBG(SCTP_DEBUG_INPUT1, "Its an INIT of len:%d vtag:%x\n", ntohs(ch->chunk_length), vtag_in); if (vtag_in != 0) { /* protocol error- silently discard... */ SCTP_STAT_INCR(sctps_badvtag); - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); + if (stcb != NULL) { + SCTP_TCB_UNLOCK(stcb); } return (NULL); } @@ -4580,9 +4577,6 @@ sctp_process_control(struct mbuf *m, int iphlen, int * if (*offset >= length) { /* no more data left in the mbuf chain */ *offset = length; - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } return (NULL); } ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, *offset, @@ -4591,10 +4585,7 @@ sctp_process_control(struct mbuf *m, int iphlen, int * if (ch == NULL) { /* Help */ *offset = length; - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } - return (NULL); + return (stcb); } if (ch->chunk_type == SCTP_COOKIE_ECHO) { goto process_control_chunks; @@ -4631,10 +4622,7 @@ sctp_process_control(struct mbuf *m, int iphlen, int * * sctp_findassociation_ep_asconf(). */ SCTP_INP_DECR_REF(inp); - } else { - locked_tcb = stcb; } - /* now go back and verify any auth chunk to be sure */ if (auth_skipped && (stcb != NULL)) { struct sctp_auth_chunk *auth; @@ -4648,10 +4636,7 @@ sctp_process_control(struct mbuf *m, int iphlen, int * auth_offset)) { /* auth HMAC failed so dump it */ *offset = length; - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } - return (NULL); + return (stcb); } else { /* remaining chunks are HMAC checked */ stcb->asoc.authenticated = 1; @@ -4667,9 +4652,6 @@ sctp_process_control(struct mbuf *m, int iphlen, int * mflowtype, mflowid, inp->fibnum, vrf_id, port); *offset = length; - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } return (NULL); } asoc = &stcb->asoc; @@ -4687,8 +4669,8 @@ sctp_process_control(struct mbuf *m, int iphlen, int * } else { /* drop this packet... */ SCTP_STAT_INCR(sctps_badvtag); - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); + if (stcb != NULL) { + SCTP_TCB_UNLOCK(stcb); } return (NULL); } @@ -4701,8 +4683,8 @@ sctp_process_control(struct mbuf *m, int iphlen, int * * but it won't complete until the shutdown * is completed */ - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); + if (stcb != NULL) { + SCTP_TCB_UNLOCK(stcb); } snprintf(msg, sizeof(msg), "OOTB, %s:%d at %s", __FILE__, __LINE__, __func__); op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), @@ -4721,8 +4703,8 @@ sctp_process_control(struct mbuf *m, int iphlen, int * "invalid vtag: %xh, expect %xh\n", vtag_in, asoc->my_vtag); SCTP_STAT_INCR(sctps_badvtag); - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); + if (stcb != NULL) { + SCTP_TCB_UNLOCK(stcb); } *offset = length; return (NULL); @@ -4758,10 +4740,7 @@ process_control_chunks: if (chk_length < sizeof(*ch) || (*offset + (int)chk_length) > length) { *offset = length; - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } - return (NULL); + return (stcb); } SCTP_STAT_INCR_COUNTER64(sctps_incontrolchunks); /* @@ -4776,8 +4755,8 @@ process_control_chunks: sizeof(struct sctp_init_ack_chunk), chunk_buf); if (ch == NULL) { *offset = length; - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); + if (stcb != NULL) { + SCTP_TCB_UNLOCK(stcb); } return (NULL); } @@ -4799,8 +4778,8 @@ process_control_chunks: chunk_buf); if (ch == NULL) { *offset = length; - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); + if (stcb != NULL) { + SCTP_TCB_UNLOCK(stcb); } return (NULL); } @@ -4811,8 +4790,8 @@ process_control_chunks: if (ch == NULL) { SCTP_PRINTF("sctp_process_control: Can't get the all data....\n"); *offset = length; - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); + if (stcb != NULL) { + SCTP_TCB_UNLOCK(stcb); } return (NULL); } @@ -4852,8 +4831,8 @@ process_control_chunks: (length - *offset > (int)SCTP_SIZE32(chk_length))) { /* RFC 4960 requires that no ABORT is sent */ *offset = length; - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); + if (stcb != NULL) { + SCTP_TCB_UNLOCK(stcb); } return (NULL); } @@ -4873,8 +4852,8 @@ process_control_chunks: mflowtype, mflowid, vrf_id, port); *offset = length; - if ((!abort_no_unlock) && (locked_tcb)) { - SCTP_TCB_UNLOCK(locked_tcb); + if ((!abort_no_unlock) && (stcb != NULL)) { + SCTP_TCB_UNLOCK(stcb); } return (NULL); break; @@ -4884,15 +4863,14 @@ process_control_chunks: SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_INIT-ACK\n"); if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) { /* We are not interested anymore */ - if ((stcb) && (stcb->asoc.total_output_queue_size)) { + if ((stcb != NULL) && (stcb->asoc.total_output_queue_size)) { ; } else { - if ((locked_tcb != NULL) && (locked_tcb != stcb)) { - /* Very unlikely */ - SCTP_TCB_UNLOCK(locked_tcb); + if (stcb != NULL) { + SCTP_TCB_UNLOCK(stcb); } *offset = length; - if (stcb) { + if (stcb != NULL) { #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) so = SCTP_INP_SO(inp); atomic_add_int(&stcb->asoc.refcnt, 1); @@ -4914,10 +4892,7 @@ process_control_chunks: if ((num_chunks > 1) || (length - *offset > (int)SCTP_SIZE32(chk_length))) { *offset = length; - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } - return (NULL); + return (stcb); } if ((netp) && (*netp)) { ret = sctp_handle_init_ack(m, iphlen, *offset, @@ -4941,10 +4916,7 @@ process_control_chunks: if ((stcb != NULL) && (ret == 0)) { sctp_chunk_output(stcb->sctp_ep, stcb, SCTP_OUTPUT_FROM_CONTROL_PROC, SCTP_SO_NOT_LOCKED); } - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } - return (NULL); + return (stcb); break; case SCTP_SELECTIVE_ACK: { @@ -5136,10 +5108,7 @@ process_control_chunks: if ((stcb == NULL) || (chk_length != sizeof(struct sctp_heartbeat_chunk))) { /* Its not ours */ *offset = length; - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } - return (NULL); + return (stcb); } /* He's alive so give him credit */ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { @@ -5169,10 +5138,7 @@ process_control_chunks: (void *)stcb); if ((stcb == NULL) || (chk_length != sizeof(struct sctp_shutdown_chunk))) { *offset = length; - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } - return (NULL); + return (stcb); } if (netp && *netp) { int abort_flag = 0; @@ -5209,7 +5175,7 @@ process_control_chunks: if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) { /* We are not interested anymore */ abend: - if (stcb) { + if (stcb != NULL) { SCTP_TCB_UNLOCK(stcb); } *offset = length; @@ -5254,6 +5220,9 @@ process_control_chunks: } } if (netp) { + struct sctp_tcb *locked_stcb; + + locked_stcb = stcb; ret_buf = sctp_handle_cookie_echo(m, iphlen, *offset, @@ -5264,11 +5233,17 @@ process_control_chunks: auth_skipped, auth_offset, auth_len, - &locked_tcb, + &locked_stcb, mflowtype, mflowid, vrf_id, port); + if ((locked_stcb != NULL) && (locked_stcb != stcb)) { + SCTP_TCB_UNLOCK(locked_stcb); + } + if (stcb != NULL) { + SCTP_TCB_LOCK_ASSERT(stcb); + } } else { ret_buf = NULL; } @@ -5276,8 +5251,8 @@ process_control_chunks: SCTP_ASOC_CREATE_UNLOCK(linp); } if (ret_buf == NULL) { - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); + if (stcb != NULL) { + SCTP_TCB_UNLOCK(stcb); } SCTPDBG(SCTP_DEBUG_INPUT3, "GAK, null buffer\n"); @@ -5304,10 +5279,7 @@ process_control_chunks: case SCTP_COOKIE_ACK: SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_COOKIE-ACK, stcb %p\n", (void *)stcb); if ((stcb == NULL) || chk_length != sizeof(struct sctp_cookie_ack_chunk)) { - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } - return (NULL); + return (stcb); } if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) { /* We are not interested anymore */ @@ -5349,11 +5321,8 @@ process_control_chunks: /* He's alive so give him credit */ if ((stcb == NULL) || (chk_length != sizeof(struct sctp_ecne_chunk))) { /* Its not ours */ - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } *offset = length; - return (NULL); + return (stcb); } if (stcb) { if (stcb->asoc.ecn_supported == 0) { @@ -5376,12 +5345,8 @@ process_control_chunks: SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_ECN-CWR\n"); /* He's alive so give him credit */ if ((stcb == NULL) || (chk_length != sizeof(struct sctp_cwr_chunk))) { - /* Its not ours */ - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } *offset = length; - return (NULL); + return (stcb); } if (stcb) { if (stcb->asoc.ecn_supported == 0) { @@ -5404,10 +5369,7 @@ process_control_chunks: if ((num_chunks > 1) || (length - *offset > (int)SCTP_SIZE32(chk_length))) { *offset = length; - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } - return (NULL); + return (stcb); } if ((stcb) && netp && *netp) { sctp_handle_shutdown_complete((struct sctp_shutdown_complete_chunk *)ch, @@ -5440,11 +5402,8 @@ process_control_chunks: SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_ASCONF-ACK\n"); if (chk_length < sizeof(struct sctp_asconf_ack_chunk)) { /* Its not ours */ - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } *offset = length; - return (NULL); + return (stcb); } if ((stcb) && netp && *netp) { if (stcb->asoc.asconf_supported == 0) { @@ -5470,11 +5429,8 @@ process_control_chunks: SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_FWD-TSN\n"); if (chk_length < sizeof(struct sctp_forward_tsn_chunk)) { /* Its not ours */ - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } *offset = length; - return (NULL); + return (stcb); } /* He's alive so give him credit */ if (stcb) { @@ -5537,11 +5493,8 @@ process_control_chunks: SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_STREAM_RESET\n"); if (((stcb == NULL) || (ch == NULL) || (chk_length < sizeof(struct sctp_stream_reset_tsn_req)))) { /* Its not ours */ - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } *offset = length; - return (NULL); + return (stcb); } if (stcb->asoc.reconfig_supported == 0) { goto unknown_chunk; @@ -5557,11 +5510,8 @@ process_control_chunks: /* re-get it all please */ if (chk_length < sizeof(struct sctp_pktdrop_chunk)) { /* Its not ours */ - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } *offset = length; - return (NULL); + return (stcb); } if (ch && (stcb) && netp && (*netp)) { if (stcb->asoc.pktdrop_supported == 0) { @@ -5570,7 +5520,6 @@ process_control_chunks: sctp_handle_packet_dropped((struct sctp_pktdrop_chunk *)ch, stcb, *netp, min(chk_length, (sizeof(chunk_buf) - 4))); - } break; case SCTP_AUTHENTICATION: @@ -5592,11 +5541,8 @@ process_control_chunks: (chk_length > (sizeof(struct sctp_auth_chunk) + SCTP_AUTH_DIGEST_LEN_MAX))) { /* Its not ours */ - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } *offset = length; - return (NULL); + return (stcb); } if (got_auth == 1) { /* skip this chunk... it's already auth'd */ @@ -5661,11 +5607,8 @@ next_chunk: ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, *offset, sizeof(struct sctp_chunkhdr), chunk_buf); if (ch == NULL) { - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } *offset = length; - return (NULL); + return (stcb); } } /* while */ From owner-svn-src-stable-11@freebsd.org Sat Apr 7 19:58:15 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0399BF801B6; Sat, 7 Apr 2018 19:58:15 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A391370576; Sat, 7 Apr 2018 19:58:14 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 809442550C; Sat, 7 Apr 2018 19:58:14 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37JwERW072330; Sat, 7 Apr 2018 19:58:14 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37JwERH072329; Sat, 7 Apr 2018 19:58:14 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071958.w37JwERH072329@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 19:58:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332214 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332214 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 19:58:15 -0000 Author: tuexen Date: Sat Apr 7 19:58:14 2018 New Revision: 332214 URL: https://svnweb.freebsd.org/changeset/base/332214 Log: MFC r324729: Abort an SCTP association, when a DATA chunk is followed by an unknown chunk with a length smaller than the minimum length. Thanks to Felix Weinrank for making me aware of the problem. Modified: stable/11/sys/netinet/sctp_indata.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_indata.c ============================================================================== --- stable/11/sys/netinet/sctp_indata.c Sat Apr 7 19:56:34 2018 (r332213) +++ stable/11/sys/netinet/sctp_indata.c Sat Apr 7 19:58:14 2018 (r332214) @@ -2696,7 +2696,8 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *o } /* get pointer to the first chunk header */ ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, *offset, - sizeof(struct sctp_chunkhdr), (uint8_t *)&chunk_buf); + sizeof(struct sctp_chunkhdr), + (uint8_t *)&chunk_buf); if (ch == NULL) { return (1); } @@ -2753,7 +2754,8 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *o struct mbuf *op_err; char msg[SCTP_DIAG_INFO_LEN]; - snprintf(msg, sizeof(msg), "DATA chunk of length %d", + snprintf(msg, sizeof(msg), "%s chunk of length %d", + ch->chunk_type == SCTP_DATA ? "DATA" : "I-DATA", chk_length); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_20; @@ -2830,7 +2832,25 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *o return (2); } default: - /* unknown chunk type, use bit rules */ + /* + * Unknown chunk type: use bit rules after + * checking length + */ + if (chk_length < sizeof(struct sctp_chunkhdr)) { + /* + * Need to send an abort since we + * had a invalid chunk. + */ + struct mbuf *op_err; + char msg[SCTP_DIAG_INFO_LEN]; + + snprintf(msg, sizeof(msg), "Chunk of length %d", + chk_length); + op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); + stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_20; + sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); + return (2); + } if (ch->chunk_type & 0x40) { /* Add a error report to the queue */ struct mbuf *op_err; @@ -2866,7 +2886,8 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *o continue; } ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, *offset, - sizeof(struct sctp_chunkhdr), (uint8_t *)&chunk_buf); + sizeof(struct sctp_chunkhdr), + (uint8_t *)&chunk_buf); if (ch == NULL) { *offset = length; stop_proc = 1; From owner-svn-src-stable-11@freebsd.org Sat Apr 7 19:59:41 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 84473F80401; Sat, 7 Apr 2018 19:59:41 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3394C712BB; Sat, 7 Apr 2018 19:59:41 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A40B2550E; Sat, 7 Apr 2018 19:59:41 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37Jxe9d072436; Sat, 7 Apr 2018 19:59:40 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37Jxe5C072435; Sat, 7 Apr 2018 19:59:40 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804071959.w37Jxe5C072435@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 19:59: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: r332215 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332215 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 19:59:41 -0000 Author: tuexen Date: Sat Apr 7 19:59:40 2018 New Revision: 332215 URL: https://svnweb.freebsd.org/changeset/base/332215 Log: MFC r324730: Fix a signed/unsigned warning. Modified: stable/11/sys/netinet/sctp_indata.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_indata.c ============================================================================== --- stable/11/sys/netinet/sctp_indata.c Sat Apr 7 19:58:14 2018 (r332214) +++ stable/11/sys/netinet/sctp_indata.c Sat Apr 7 19:59:40 2018 (r332215) @@ -2641,10 +2641,11 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *o struct sctp_association *asoc; int num_chunks = 0; /* number of control chunks processed */ int stop_proc = 0; - int chk_length, break_flag, last_chunk; + int break_flag, last_chunk; int abort_flag = 0, was_a_gap; struct mbuf *m; uint32_t highest_tsn; + uint16_t chk_length; /* set the rwnd */ sctp_set_rwnd(stcb, &stcb->asoc); @@ -2739,7 +2740,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *o } if ((ch->chunk_type == SCTP_DATA) || (ch->chunk_type == SCTP_IDATA)) { - int clen; + uint16_t clen; if (ch->chunk_type == SCTP_DATA) { clen = sizeof(struct sctp_data_chunk); @@ -2754,7 +2755,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *o struct mbuf *op_err; char msg[SCTP_DIAG_INFO_LEN]; - snprintf(msg, sizeof(msg), "%s chunk of length %d", + snprintf(msg, sizeof(msg), "%s chunk of length %u", ch->chunk_type == SCTP_DATA ? "DATA" : "I-DATA", chk_length); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); @@ -2844,7 +2845,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *o struct mbuf *op_err; char msg[SCTP_DIAG_INFO_LEN]; - snprintf(msg, sizeof(msg), "Chunk of length %d", + snprintf(msg, sizeof(msg), "Chunk of length %u", chk_length); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_20; From owner-svn-src-stable-11@freebsd.org Sat Apr 7 20:00:58 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CBCAEF806CE; Sat, 7 Apr 2018 20:00:58 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7BD1971EE6; Sat, 7 Apr 2018 20:00:58 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 76A5125531; Sat, 7 Apr 2018 20:00:58 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37K0wHH074962; Sat, 7 Apr 2018 20:00:58 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37K0whH074961; Sat, 7 Apr 2018 20:00:58 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072000.w37K0whH074961@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 20:00:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332216 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332216 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 20:00:59 -0000 Author: tuexen Date: Sat Apr 7 20:00:58 2018 New Revision: 332216 URL: https://svnweb.freebsd.org/changeset/base/332216 Log: MFC r324954: Fix a locking issue found by running AFL on the userland stack. Thanks to Felix Weinrank for reporting the issue. Modified: stable/11/sys/netinet/sctp_input.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_input.c ============================================================================== --- stable/11/sys/netinet/sctp_input.c Sat Apr 7 19:59:40 2018 (r332215) +++ stable/11/sys/netinet/sctp_input.c Sat Apr 7 20:00:58 2018 (r332216) @@ -4866,9 +4866,6 @@ process_control_chunks: if ((stcb != NULL) && (stcb->asoc.total_output_queue_size)) { ; } else { - if (stcb != NULL) { - SCTP_TCB_UNLOCK(stcb); - } *offset = length; if (stcb != NULL) { #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) From owner-svn-src-stable-11@freebsd.org Sat Apr 7 20:02:09 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EC70AF80824; Sat, 7 Apr 2018 20:02:08 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9486972AFB; Sat, 7 Apr 2018 20:02:08 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7399F2558B; Sat, 7 Apr 2018 20:02:08 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37K28wF077656; Sat, 7 Apr 2018 20:02:08 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37K28FM077655; Sat, 7 Apr 2018 20:02:08 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072002.w37K28FM077655@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 20:02:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332217 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332217 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 20:02:09 -0000 Author: tuexen Date: Sat Apr 7 20:02:08 2018 New Revision: 332217 URL: https://svnweb.freebsd.org/changeset/base/332217 Log: MFC r324958: Fix a bug in handling special ABORT chunks. Thanks to Felix Weinrank for finding this issue using libfuzzer with the userland stack. Modified: stable/11/sys/netinet/sctp_input.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_input.c ============================================================================== --- stable/11/sys/netinet/sctp_input.c Sat Apr 7 20:00:58 2018 (r332216) +++ stable/11/sys/netinet/sctp_input.c Sat Apr 7 20:02:08 2018 (r332217) @@ -765,7 +765,8 @@ sctp_handle_nat_missing_state(struct sctp_tcb *stcb, } -static void +/* Returns 1 if the stcb was aborted, 0 otherwise */ +static int sctp_handle_abort(struct sctp_abort_chunk *abort, struct sctp_tcb *stcb, struct sctp_nets *net) { @@ -777,29 +778,29 @@ sctp_handle_abort(struct sctp_abort_chunk *abort, SCTPDBG(SCTP_DEBUG_INPUT2, "sctp_handle_abort: handling ABORT\n"); if (stcb == NULL) - return; + return (0); len = ntohs(abort->ch.chunk_length); - if (len > sizeof(struct sctp_chunkhdr)) { + if (len >= sizeof(struct sctp_chunkhdr) + sizeof(struct sctp_error_cause)) { /* * Need to check the cause codes for our two magic nat * aborts which don't kill the assoc necessarily. */ - struct sctp_gen_error_cause *cause; + struct sctp_error_cause *cause; - cause = (struct sctp_gen_error_cause *)(abort + 1); + cause = (struct sctp_error_cause *)(abort + 1); error = ntohs(cause->code); if (error == SCTP_CAUSE_NAT_COLLIDING_STATE) { SCTPDBG(SCTP_DEBUG_INPUT2, "Received Colliding state abort flags:%x\n", abort->ch.chunk_flags); if (sctp_handle_nat_colliding_state(stcb)) { - return; + return (0); } } else if (error == SCTP_CAUSE_NAT_MISSING_STATE) { SCTPDBG(SCTP_DEBUG_INPUT2, "Received missing state abort flags:%x\n", abort->ch.chunk_flags); if (sctp_handle_nat_missing_state(stcb, net)) { - return; + return (0); } } } else { @@ -834,6 +835,7 @@ sctp_handle_abort(struct sctp_abort_chunk *abort, SCTP_SOCKET_UNLOCK(so, 1); #endif SCTPDBG(SCTP_DEBUG_INPUT2, "sctp_handle_abort: finished\n"); + return (1); } static void @@ -5124,11 +5126,16 @@ process_control_chunks: case SCTP_ABORT_ASSOCIATION: SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_ABORT, stcb %p\n", (void *)stcb); - if ((stcb) && netp && *netp) - sctp_handle_abort((struct sctp_abort_chunk *)ch, - stcb, *netp); *offset = length; - return (NULL); + if ((stcb != NULL) && (netp != NULL) && (*netp != NULL)) { + if (sctp_handle_abort((struct sctp_abort_chunk *)ch, stcb, *netp)) { + return (NULL); + } else { + return (stcb); + } + } else { + return (NULL); + } break; case SCTP_SHUTDOWN: SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_SHUTDOWN, stcb %p\n", From owner-svn-src-stable-11@freebsd.org Sat Apr 7 20:03:36 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3838F809C6; Sat, 7 Apr 2018 20:03:35 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 86DFF737E3; Sat, 7 Apr 2018 20:03:35 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 81AF4256A2; Sat, 7 Apr 2018 20:03:35 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37K3ZnC077755; Sat, 7 Apr 2018 20:03:35 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37K3ZWx077754; Sat, 7 Apr 2018 20:03:35 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072003.w37K3ZWx077754@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 20:03:35 +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: r332218 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332218 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 20:03:36 -0000 Author: tuexen Date: Sat Apr 7 20:03:35 2018 New Revision: 332218 URL: https://svnweb.freebsd.org/changeset/base/332218 Log: MFC r324971: Fix a bug reported by Felix Weinrank using the libfuzzer on the userland stack. Modified: stable/11/sys/netinet/sctp_auth.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_auth.c ============================================================================== --- stable/11/sys/netinet/sctp_auth.c Sat Apr 7 20:02:08 2018 (r332217) +++ stable/11/sys/netinet/sctp_auth.c Sat Apr 7 20:03:35 2018 (r332218) @@ -1606,9 +1606,9 @@ sctp_zero_m(struct mbuf *m, uint32_t m_offset, uint32_ /* now use the rest of the mbuf chain */ while ((m_tmp != NULL) && (size > 0)) { data = mtod(m_tmp, uint8_t *)+m_offset; - if (size > (uint32_t)SCTP_BUF_LEN(m_tmp)) { - memset(data, 0, SCTP_BUF_LEN(m_tmp)); - size -= SCTP_BUF_LEN(m_tmp); + if (size > (uint32_t)(SCTP_BUF_LEN(m_tmp) - m_offset)) { + memset(data, 0, SCTP_BUF_LEN(m_tmp) - m_offset); + size -= SCTP_BUF_LEN(m_tmp) - m_offset; } else { memset(data, 0, size); size = 0; From owner-svn-src-stable-11@freebsd.org Sat Apr 7 20:05:26 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1BE50F80C50; Sat, 7 Apr 2018 20:05:26 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BB33F749BD; Sat, 7 Apr 2018 20:05:25 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ADFE9256A5; Sat, 7 Apr 2018 20:05:25 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37K5POA077916; Sat, 7 Apr 2018 20:05:25 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37K5PLI077915; Sat, 7 Apr 2018 20:05:25 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072005.w37K5PLI077915@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 20:05:25 +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: r332220 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332220 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 20:05:26 -0000 Author: tuexen Date: Sat Apr 7 20:05:25 2018 New Revision: 332220 URL: https://svnweb.freebsd.org/changeset/base/332220 Log: MFC r325046: Fix parsing error when processing cmsg in SCTP send calls. The bug is related to a signed/unsigned mismatch. This should most likely fix the issue in sctp_sosend reported by Dmitry Vyukov on the freebsd-hackers mailing list and found by running syzkaller. Modified: stable/11/sys/netinet/sctp_output.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_output.c ============================================================================== --- stable/11/sys/netinet/sctp_output.c Sat Apr 7 20:04:03 2018 (r332219) +++ stable/11/sys/netinet/sctp_output.c Sat Apr 7 20:05:25 2018 (r332220) @@ -3465,32 +3465,35 @@ static int sctp_find_cmsg(int c_type, void *data, struct mbuf *control, size_t cpsize) { struct cmsghdr cmh; - int tlen, at, found; struct sctp_sndinfo sndinfo; struct sctp_prinfo prinfo; struct sctp_authinfo authinfo; + int tot_len, rem_len, cmsg_data_len, cmsg_data_off, off; + int found; - tlen = SCTP_BUF_LEN(control); - at = 0; - found = 0; /* * Independent of how many mbufs, find the c_type inside the control * structure and copy out the data. */ - while (at < tlen) { - if ((tlen - at) < (int)CMSG_ALIGN(sizeof(cmh))) { + found = 0; + tot_len = SCTP_BUF_LEN(control); + for (off = 0; off < tot_len; off += CMSG_ALIGN(cmh.cmsg_len)) { + rem_len = tot_len - off; + if (rem_len < (int)CMSG_ALIGN(sizeof(cmh))) { /* There is not enough room for one more. */ return (found); } - m_copydata(control, at, sizeof(cmh), (caddr_t)&cmh); + m_copydata(control, off, sizeof(cmh), (caddr_t)&cmh); if (cmh.cmsg_len < CMSG_ALIGN(sizeof(cmh))) { /* We dont't have a complete CMSG header. */ return (found); } - if (((int)cmh.cmsg_len + at) > tlen) { + if ((cmh.cmsg_len > INT_MAX) || ((int)cmh.cmsg_len > rem_len)) { /* We don't have the complete CMSG. */ return (found); } + cmsg_data_len = (int)cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh)); + cmsg_data_off = off + CMSG_ALIGN(sizeof(cmh)); if ((cmh.cmsg_level == IPPROTO_SCTP) && ((c_type == cmh.cmsg_type) || ((c_type == SCTP_SNDRCV) && @@ -3498,11 +3501,14 @@ sctp_find_cmsg(int c_type, void *data, struct mbuf *co (cmh.cmsg_type == SCTP_PRINFO) || (cmh.cmsg_type == SCTP_AUTHINFO))))) { if (c_type == cmh.cmsg_type) { - if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh))) < cpsize) { + if (cpsize > INT_MAX) { return (found); } + if (cmsg_data_len < (int)cpsize) { + return (found); + } /* It is exactly what we want. Copy it out. */ - m_copydata(control, at + CMSG_ALIGN(sizeof(cmh)), (int)cpsize, (caddr_t)data); + m_copydata(control, cmsg_data_off, (int)cpsize, (caddr_t)data); return (1); } else { struct sctp_sndrcvinfo *sndrcvinfo; @@ -3516,10 +3522,10 @@ sctp_find_cmsg(int c_type, void *data, struct mbuf *co } switch (cmh.cmsg_type) { case SCTP_SNDINFO: - if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh))) < sizeof(struct sctp_sndinfo)) { + if (cmsg_data_len < (int)sizeof(struct sctp_sndinfo)) { return (found); } - m_copydata(control, at + CMSG_ALIGN(sizeof(cmh)), sizeof(struct sctp_sndinfo), (caddr_t)&sndinfo); + m_copydata(control, cmsg_data_off, sizeof(struct sctp_sndinfo), (caddr_t)&sndinfo); sndrcvinfo->sinfo_stream = sndinfo.snd_sid; sndrcvinfo->sinfo_flags = sndinfo.snd_flags; sndrcvinfo->sinfo_ppid = sndinfo.snd_ppid; @@ -3527,10 +3533,10 @@ sctp_find_cmsg(int c_type, void *data, struct mbuf *co sndrcvinfo->sinfo_assoc_id = sndinfo.snd_assoc_id; break; case SCTP_PRINFO: - if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh))) < sizeof(struct sctp_prinfo)) { + if (cmsg_data_len < (int)sizeof(struct sctp_prinfo)) { return (found); } - m_copydata(control, at + CMSG_ALIGN(sizeof(cmh)), sizeof(struct sctp_prinfo), (caddr_t)&prinfo); + m_copydata(control, cmsg_data_off, sizeof(struct sctp_prinfo), (caddr_t)&prinfo); if (prinfo.pr_policy != SCTP_PR_SCTP_NONE) { sndrcvinfo->sinfo_timetolive = prinfo.pr_value; } else { @@ -3539,10 +3545,10 @@ sctp_find_cmsg(int c_type, void *data, struct mbuf *co sndrcvinfo->sinfo_flags |= prinfo.pr_policy; break; case SCTP_AUTHINFO: - if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh))) < sizeof(struct sctp_authinfo)) { + if (cmsg_data_len < (int)sizeof(struct sctp_authinfo)) { return (found); } - m_copydata(control, at + CMSG_ALIGN(sizeof(cmh)), sizeof(struct sctp_authinfo), (caddr_t)&authinfo); + m_copydata(control, cmsg_data_off, sizeof(struct sctp_authinfo), (caddr_t)&authinfo); sndrcvinfo->sinfo_keynumber_valid = 1; sndrcvinfo->sinfo_keynumber = authinfo.auth_keynumber; break; @@ -3552,7 +3558,6 @@ sctp_find_cmsg(int c_type, void *data, struct mbuf *co found = 1; } } - at += CMSG_ALIGN(cmh.cmsg_len); } return (found); } From owner-svn-src-stable-11@freebsd.org Sat Apr 7 20:06:51 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77ED2F80E54; Sat, 7 Apr 2018 20:06:51 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2AA9975712; Sat, 7 Apr 2018 20:06:51 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 21613256A8; Sat, 7 Apr 2018 20:06:51 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37K6pPi078288; Sat, 7 Apr 2018 20:06:51 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37K6pV2078287; Sat, 7 Apr 2018 20:06:51 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072006.w37K6pV2078287@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 20:06: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: r332221 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332221 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 20:06:51 -0000 Author: tuexen Date: Sat Apr 7 20:06:50 2018 New Revision: 332221 URL: https://svnweb.freebsd.org/changeset/base/332221 Log: MFC r325284: Fix the reporting of the MTU for SCTP sockets when using IPv6. Modified: stable/11/sys/netinet/sctp_usrreq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/11/sys/netinet/sctp_usrreq.c Sat Apr 7 20:05:25 2018 (r332220) +++ stable/11/sys/netinet/sctp_usrreq.c Sat Apr 7 20:06:50 2018 (r332221) @@ -2412,7 +2412,7 @@ flags_out: #endif #ifdef INET6 case AF_INET6: - paddrp->spp_pathmtu -= SCTP_MIN_V4_OVERHEAD; + paddrp->spp_pathmtu -= SCTP_MIN_OVERHEAD; break; #endif default: From owner-svn-src-stable-11@freebsd.org Sat Apr 7 20:08:18 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9013AF80FC6; Sat, 7 Apr 2018 20:08:18 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3ADBB76401; Sat, 7 Apr 2018 20:08:18 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A52E256A9; Sat, 7 Apr 2018 20:08:18 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37K8IaH078396; Sat, 7 Apr 2018 20:08:18 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37K8Hx8078389; Sat, 7 Apr 2018 20:08:17 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072008.w37K8Hx8078389@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 20:08:17 +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: r332222 - in stable/11/sys: netinet netinet6 X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in stable/11/sys: netinet netinet6 X-SVN-Commit-Revision: 332222 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 20:08:18 -0000 Author: tuexen Date: Sat Apr 7 20:08:17 2018 New Revision: 332222 URL: https://svnweb.freebsd.org/changeset/base/332222 Log: MFC r325370: Allow the setting of the MTU for future paths using an SCTP socket option. This functionality was missing. Modified: stable/11/sys/netinet/sctp_output.c stable/11/sys/netinet/sctp_pcb.c stable/11/sys/netinet/sctp_pcb.h stable/11/sys/netinet/sctp_structs.h stable/11/sys/netinet/sctp_usrreq.c stable/11/sys/netinet/sctputil.c stable/11/sys/netinet6/sctp6_usrreq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_output.c ============================================================================== --- stable/11/sys/netinet/sctp_output.c Sat Apr 7 20:06:50 2018 (r332221) +++ stable/11/sys/netinet/sctp_output.c Sat Apr 7 20:08:17 2018 (r332222) @@ -4273,12 +4273,8 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, /* free tempy routes */ RO_RTFREE(ro); } else { - /* - * PMTU check versus smallest asoc MTU goes - * here - */ - if ((ro->ro_rt != NULL) && - (net->ro._s_addr)) { + if ((ro->ro_rt != NULL) && (net->ro._s_addr) && + ((net->dest_state & SCTP_ADDR_NO_PMTUD) == 0)) { uint32_t mtu; mtu = SCTP_GATHER_MTU_FROM_ROUTE(net->ro._s_addr, &net->ro._l_addr.sa, ro->ro_rt); @@ -4635,8 +4631,8 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, } net->src_addr_selected = 0; } - if ((ro->ro_rt != NULL) && - (net->ro._s_addr)) { + if ((ro->ro_rt != NULL) && (net->ro._s_addr) && + ((net->dest_state & SCTP_ADDR_NO_PMTUD) == 0)) { uint32_t mtu; mtu = SCTP_GATHER_MTU_FROM_ROUTE(net->ro._s_addr, &net->ro._l_addr.sa, ro->ro_rt); Modified: stable/11/sys/netinet/sctp_pcb.c ============================================================================== --- stable/11/sys/netinet/sctp_pcb.c Sat Apr 7 20:06:50 2018 (r332221) +++ stable/11/sys/netinet/sctp_pcb.c Sat Apr 7 20:08:17 2018 (r332222) @@ -2577,6 +2577,7 @@ sctp_inpcb_alloc(struct socket *so, uint32_t vrf_id) /* number of streams to pre-open on a association */ m->pre_open_stream_count = SCTP_BASE_SYSCTL(sctp_nr_outgoing_streams_default); + m->default_mtu = 0; /* Add adaptation cookie */ m->adaptation_layer_indicator = 0; m->adaptation_layer_indicator_provided = 0; @@ -3942,7 +3943,28 @@ sctp_add_remote_addr(struct sctp_tcb *stcb, struct soc net, 0, stcb->asoc.vrf_id); - if (net->ro._s_addr != NULL) { + if (stcb->asoc.default_mtu > 0) { + net->mtu = stcb->asoc.default_mtu; + switch (net->ro._l_addr.sa.sa_family) { +#ifdef INET + case AF_INET: + net->mtu += SCTP_MIN_V4_OVERHEAD; + break; +#endif +#ifdef INET6 + case AF_INET6: + net->mtu += SCTP_MIN_OVERHEAD; + break; +#endif + default: + break; + } +#if defined(INET) || defined(INET6) + if (net->port) { + net->mtu += (uint32_t)sizeof(struct udphdr); + } +#endif + } else if (net->ro._s_addr != NULL) { uint32_t imtu, rmtu, hcmtu; net->src_addr_selected = 1; @@ -3966,19 +3988,42 @@ sctp_add_remote_addr(struct sctp_tcb *stcb, struct soc } } if (net->mtu == 0) { - switch (newaddr->sa_family) { + if (stcb->asoc.default_mtu > 0) { + net->mtu = stcb->asoc.default_mtu; + switch (net->ro._l_addr.sa.sa_family) { #ifdef INET - case AF_INET: - net->mtu = SCTP_DEFAULT_MTU; - break; + case AF_INET: + net->mtu += SCTP_MIN_V4_OVERHEAD; + break; #endif #ifdef INET6 - case AF_INET6: - net->mtu = 1280; - break; + case AF_INET6: + net->mtu += SCTP_MIN_OVERHEAD; + break; #endif - default: - break; + default: + break; + } +#if defined(INET) || defined(INET6) + if (net->port) { + net->mtu += (uint32_t)sizeof(struct udphdr); + } +#endif + } else { + switch (newaddr->sa_family) { +#ifdef INET + case AF_INET: + net->mtu = SCTP_DEFAULT_MTU; + break; +#endif +#ifdef INET6 + case AF_INET6: + net->mtu = 1280; + break; +#endif + default: + break; + } } } #if defined(INET) || defined(INET6) Modified: stable/11/sys/netinet/sctp_pcb.h ============================================================================== --- stable/11/sys/netinet/sctp_pcb.h Sat Apr 7 20:06:50 2018 (r332221) +++ stable/11/sys/netinet/sctp_pcb.h Sat Apr 7 20:08:17 2018 (r332222) @@ -287,6 +287,7 @@ struct sctp_pcb { sctp_auth_chklist_t *local_auth_chunks; sctp_hmaclist_t *local_hmacs; uint16_t default_keyid; + uint32_t default_mtu; /* various thresholds */ /* Max times I will init at a guy */ Modified: stable/11/sys/netinet/sctp_structs.h ============================================================================== --- stable/11/sys/netinet/sctp_structs.h Sat Apr 7 20:06:50 2018 (r332221) +++ stable/11/sys/netinet/sctp_structs.h Sat Apr 7 20:08:17 2018 (r332222) @@ -1098,6 +1098,7 @@ struct sctp_association { uint32_t chunks_on_out_queue; /* total chunks floating around, * locked by send socket buffer */ uint32_t peers_adaptation; + uint32_t default_mtu; uint16_t peer_hmac_id; /* peer HMAC id to send */ /* Modified: stable/11/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/11/sys/netinet/sctp_usrreq.c Sat Apr 7 20:06:50 2018 (r332221) +++ stable/11/sys/netinet/sctp_usrreq.c Sat Apr 7 20:08:17 2018 (r332222) @@ -202,6 +202,10 @@ sctp_notify(struct sctp_inpcb *inp, #endif /* no need to unlock here, since the TCB is gone */ } else if (icmp_code == ICMP_UNREACH_NEEDFRAG) { + if ((net->dest_state & SCTP_ADDR_NO_PMTUD) == 0) { + SCTP_TCB_UNLOCK(stcb); + return; + } /* Find the next (smaller) MTU */ if (next_mtu == 0) { /* @@ -2447,7 +2451,7 @@ flags_out: * value */ paddrp->spp_pathmaxrxt = stcb->asoc.def_net_failure; - paddrp->spp_pathmtu = 0; + paddrp->spp_pathmtu = stcb->asoc.default_mtu; if (stcb->asoc.default_dscp & 0x01) { paddrp->spp_dscp = stcb->asoc.default_dscp & 0xfc; paddrp->spp_flags |= SPP_DSCP; @@ -2494,8 +2498,7 @@ flags_out: paddrp->spp_flags |= SPP_IPV6_FLOWLABEL; } #endif - /* can't return this */ - paddrp->spp_pathmtu = 0; + paddrp->spp_pathmtu = inp->sctp_ep.default_mtu; if (sctp_is_feature_off(inp, SCTP_PCB_FLAGS_DONOT_HEARTBEAT)) { paddrp->spp_flags |= SPP_HB_ENABLE; @@ -5479,6 +5482,7 @@ sctp_setopt(struct socket *so, int optname, void *optv sctp_pathmtu_adjustment(stcb, net->mtu); } } + stcb->asoc.default_mtu = paddrp->spp_pathmtu; sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_DO_NOT_PMTUD); } if (paddrp->spp_flags & SPP_PMTUD_ENABLE) { @@ -5488,6 +5492,7 @@ sctp_setopt(struct socket *so, int optname, void *optv } net->dest_state &= ~SCTP_ADDR_NO_PMTUD; } + stcb->asoc.default_mtu = 0; sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_DO_NOT_PMTUD); } if (paddrp->spp_flags & SPP_DSCP) { @@ -5544,8 +5549,12 @@ sctp_setopt(struct socket *so, int optname, void *optv sctp_feature_on(inp, SCTP_PCB_FLAGS_DONOT_HEARTBEAT); } if (paddrp->spp_flags & SPP_PMTUD_ENABLE) { + inp->sctp_ep.default_mtu = 0; sctp_feature_off(inp, SCTP_PCB_FLAGS_DO_NOT_PMTUD); } else if (paddrp->spp_flags & SPP_PMTUD_DISABLE) { + if (paddrp->spp_pathmtu >= SCTP_SMALLEST_PMTU) { + inp->sctp_ep.default_mtu = paddrp->spp_pathmtu; + } sctp_feature_on(inp, SCTP_PCB_FLAGS_DO_NOT_PMTUD); } if (paddrp->spp_flags & SPP_DSCP) { Modified: stable/11/sys/netinet/sctputil.c ============================================================================== --- stable/11/sys/netinet/sctputil.c Sat Apr 7 20:06:50 2018 (r332221) +++ stable/11/sys/netinet/sctputil.c Sat Apr 7 20:08:17 2018 (r332222) @@ -1042,6 +1042,7 @@ sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb asoc->initial_init_rto_max = inp->sctp_ep.initial_init_rto_max; asoc->initial_rto = inp->sctp_ep.initial_rto; + asoc->default_mtu = inp->sctp_ep.default_mtu; asoc->max_init_times = inp->sctp_ep.max_init_times; asoc->max_send_times = inp->sctp_ep.max_send_times; asoc->def_net_failure = inp->sctp_ep.def_net_failure; Modified: stable/11/sys/netinet6/sctp6_usrreq.c ============================================================================== --- stable/11/sys/netinet6/sctp6_usrreq.c Sat Apr 7 20:06:50 2018 (r332221) +++ stable/11/sys/netinet6/sctp6_usrreq.c Sat Apr 7 20:08:17 2018 (r332222) @@ -229,6 +229,10 @@ sctp6_notify(struct sctp_inpcb *inp, } break; case ICMP6_PACKET_TOO_BIG: + if ((net->dest_state & SCTP_ADDR_NO_PMTUD) == 0) { + SCTP_TCB_UNLOCK(stcb); + break; + } if (SCTP_OS_TIMER_PENDING(&net->pmtu_timer.timer)) { timer_stopped = 1; sctp_timer_stop(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net, From owner-svn-src-stable-11@freebsd.org Sat Apr 7 20:10:27 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EF307F81304; Sat, 7 Apr 2018 20:10:26 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9A1FA77691; Sat, 7 Apr 2018 20:10:26 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 93F36256AF; Sat, 7 Apr 2018 20:10:26 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37KAQBB078548; Sat, 7 Apr 2018 20:10:26 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37KAQBH078547; Sat, 7 Apr 2018 20:10:26 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072010.w37KAQBH078547@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 20:10:26 +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: r332223 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332223 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 20:10:27 -0000 Author: tuexen Date: Sat Apr 7 20:10:26 2018 New Revision: 332223 URL: https://svnweb.freebsd.org/changeset/base/332223 Log: MFC r325434: Fix an accounting bug where data was counted twice if on the read queue and on the ordered or unordered queue. While there, improve the checking in INVARIANTs when computing the a_rwnd. Modified: stable/11/sys/netinet/sctp_indata.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_indata.c ============================================================================== --- stable/11/sys/netinet/sctp_indata.c Sat Apr 7 20:08:17 2018 (r332222) +++ stable/11/sys/netinet/sctp_indata.c Sat Apr 7 20:10:26 2018 (r332223) @@ -88,12 +88,14 @@ sctp_calc_rwnd(struct sctp_tcb *stcb, struct sctp_asso if (stcb->sctp_socket == NULL) { return (calc); } + KASSERT(asoc->cnt_on_reasm_queue > 0 || asoc->size_on_reasm_queue == 0, + ("size_on_reasm_queue is %u", asoc->size_on_reasm_queue)); + KASSERT(asoc->cnt_on_all_streams > 0 || asoc->size_on_all_streams == 0, + ("size_on_all_streams is %u", asoc->size_on_all_streams)); if (stcb->asoc.sb_cc == 0 && - asoc->size_on_reasm_queue == 0 && - asoc->size_on_all_streams == 0) { + asoc->cnt_on_reasm_queue == 0 && + asoc->cnt_on_all_streams == 0) { /* Full rwnd granted */ - KASSERT(asoc->cnt_on_reasm_queue == 0, ("cnt_on_reasm_queue is %u", asoc->cnt_on_reasm_queue)); - KASSERT(asoc->cnt_on_all_streams == 0, ("cnt_on_all_streams is %u", asoc->cnt_on_all_streams)); calc = max(SCTP_SB_LIMIT_RCV(stcb->sctp_socket), SCTP_MINIMAL_RWND); return (calc); } @@ -1245,6 +1247,19 @@ deliver_more: } done = (control->end_added) && (control->last_frag_seen); if (control->on_read_q == 0) { + if (!done) { + if (asoc->size_on_all_streams >= control->length) { + asoc->size_on_all_streams -= control->length; + } else { +#ifdef INVARIANTS + panic("size_on_all_streams = %u smaller than control length %u", asoc->size_on_all_streams, control->length); +#else + asoc->size_on_all_streams = 0; +#endif + } + strm->pd_api_started = 1; + control->pdapi_started = 1; + } sctp_add_to_readq(stcb->sctp_ep, stcb, control, &stcb->sctp_socket->so_rcv, control->end_added, @@ -1254,10 +1269,6 @@ deliver_more: if (done) { control = nctl; goto deliver_more; - } else { - /* We are now doing PD API */ - strm->pd_api_started = 1; - control->pdapi_started = 1; } } } @@ -1316,15 +1327,11 @@ sctp_add_chk_to_control(struct sctp_queued_to_read *co } else if (control->on_strm_q == SCTP_ON_ORDERED) { /* Ordered */ TAILQ_REMOVE(&strm->inqueue, control, next_instrm); - if (asoc->size_on_all_streams >= control->length) { - asoc->size_on_all_streams -= control->length; - } else { -#ifdef INVARIANTS - panic("size_on_all_streams = %u smaller than control length %u", asoc->size_on_all_streams, control->length); -#else - asoc->size_on_all_streams = 0; -#endif - } + /* + * Don't need to decrement + * size_on_all_streams, since control is on + * the read queue. + */ sctp_ucount_decr(asoc->cnt_on_all_streams); control->on_strm_q = 0; #ifdef INVARIANTS From owner-svn-src-stable-11@freebsd.org Sat Apr 7 20:11:57 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 052D7F81634; Sat, 7 Apr 2018 20:11:57 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AA35A7857F; Sat, 7 Apr 2018 20:11:56 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A3FD625716; Sat, 7 Apr 2018 20:11:56 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37KBu3L081556; Sat, 7 Apr 2018 20:11:56 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37KBuip081555; Sat, 7 Apr 2018 20:11:56 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072011.w37KBuip081555@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 20:11: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: r332224 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332224 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 20:11:57 -0000 Author: tuexen Date: Sat Apr 7 20:11:56 2018 New Revision: 332224 URL: https://svnweb.freebsd.org/changeset/base/332224 Log: MFC r325746: Cleanup the handling of control chunks. While there fix some minor bug related to clearing the assoc retransmit counter and the dup TSN handling of NR-SACK chunks. Modified: stable/11/sys/netinet/sctp_input.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_input.c ============================================================================== --- stable/11/sys/netinet/sctp_input.c Sat Apr 7 20:10:26 2018 (r332223) +++ stable/11/sys/netinet/sctp_input.c Sat Apr 7 20:11:56 2018 (r332224) @@ -635,6 +635,14 @@ sctp_handle_heartbeat_ack(struct sctp_heartbeat_chunk r_net, SCTP_FROM_SCTP_INPUT + SCTP_LOC_4); sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, r_net); } + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { + sctp_misc_ints(SCTP_THRESHOLD_CLEAR, + stcb->asoc.overall_error_count, + 0, + SCTP_FROM_SCTP_INPUT, + __LINE__); + } + stcb->asoc.overall_error_count = 0; old_error_counter = r_net->error_count; r_net->error_count = 0; r_net->hb_responded = 1; @@ -2928,7 +2936,14 @@ sctp_handle_cookie_ack(struct sctp_cookie_ack_chunk *c return; } asoc = &stcb->asoc; - + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { + sctp_misc_ints(SCTP_THRESHOLD_CLEAR, + asoc->overall_error_count, + 0, + SCTP_FROM_SCTP_INPUT, + __LINE__); + } + asoc->overall_error_count = 0; sctp_stop_all_cookie_timers(stcb); /* process according to association state */ if (SCTP_GET_STATE(asoc) == SCTP_STATE_COOKIE_ECHOED) { @@ -4721,14 +4736,6 @@ sctp_process_control(struct mbuf *m, int iphlen, int * (ch->chunk_type == SCTP_HEARTBEAT_REQUEST)) && (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_COOKIE_ECHOED)) { /* implied cookie-ack.. we must have lost the ack */ - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { - sctp_misc_ints(SCTP_THRESHOLD_CLEAR, - stcb->asoc.overall_error_count, - 0, - SCTP_FROM_SCTP_INPUT, - __LINE__); - } - stcb->asoc.overall_error_count = 0; sctp_handle_cookie_ack((struct sctp_cookie_ack_chunk *)ch, stcb, *netp); } @@ -4862,7 +4869,7 @@ process_control_chunks: case SCTP_PAD_CHUNK: break; case SCTP_INITIATION_ACK: - SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_INIT-ACK\n"); + SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_INIT_ACK\n"); if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) { /* We are not interested anymore */ if ((stcb != NULL) && (stcb->asoc.total_output_queue_size)) { @@ -4893,7 +4900,7 @@ process_control_chunks: *offset = length; return (stcb); } - if ((netp) && (*netp)) { + if ((netp != NULL) && (*netp != NULL)) { ret = sctp_handle_init_ack(m, iphlen, *offset, src, dst, sh, (struct sctp_init_ack_chunk *)ch, @@ -4918,23 +4925,35 @@ process_control_chunks: return (stcb); break; case SCTP_SELECTIVE_ACK: + case SCTP_NR_SELECTIVE_ACK: { - struct sctp_sack_chunk *sack; int abort_now = 0; uint32_t a_rwnd, cum_ack; - uint16_t num_seg, num_dup; + uint16_t num_seg, num_nr_seg, num_dup; uint8_t flags; int offset_seg, offset_dup; - SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_SACK\n"); + SCTPDBG(SCTP_DEBUG_INPUT3, "%s\n", + ch->chunk_type == SCTP_SELECTIVE_ACK ? "SCTP_SACK" : "SCTP_NR_SACK"); SCTP_STAT_INCR(sctps_recvsacks); if (stcb == NULL) { - SCTPDBG(SCTP_DEBUG_INDATA1, "No stcb when processing SACK chunk\n"); + SCTPDBG(SCTP_DEBUG_INDATA1, "No stcb when processing %s chunk\n", + (ch->chunk_type == SCTP_SELECTIVE_ACK) ? "SCTP_SACK" : "SCTP_NR_SACK"); break; } - if (chk_length < sizeof(struct sctp_sack_chunk)) { - SCTPDBG(SCTP_DEBUG_INDATA1, "Bad size on SACK chunk, too small\n"); - break; + if (ch->chunk_type == SCTP_SELECTIVE_ACK) { + if (chk_length < sizeof(struct sctp_sack_chunk)) { + SCTPDBG(SCTP_DEBUG_INDATA1, "Bad size on SACK chunk, too small\n"); + break; + } + } else { + if (stcb->asoc.nrsack_supported == 0) { + goto unknown_chunk; + } + if (chk_length < sizeof(struct sctp_nr_sack_chunk)) { + SCTPDBG(SCTP_DEBUG_INDATA1, "Bad size on NR_SACK chunk, too small\n"); + break; + } } if (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_SHUTDOWN_ACK_SENT) { /*- @@ -4944,108 +4963,44 @@ process_control_chunks: */ break; } - sack = (struct sctp_sack_chunk *)ch; flags = ch->chunk_flags; - cum_ack = ntohl(sack->sack.cum_tsn_ack); - num_seg = ntohs(sack->sack.num_gap_ack_blks); - num_dup = ntohs(sack->sack.num_dup_tsns); - a_rwnd = (uint32_t)ntohl(sack->sack.a_rwnd); - if (sizeof(struct sctp_sack_chunk) + - num_seg * sizeof(struct sctp_gap_ack_block) + - num_dup * sizeof(uint32_t) != chk_length) { - SCTPDBG(SCTP_DEBUG_INDATA1, "Bad size of SACK chunk\n"); - break; - } - offset_seg = *offset + sizeof(struct sctp_sack_chunk); - offset_dup = offset_seg + num_seg * sizeof(struct sctp_gap_ack_block); - SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_SACK process cum_ack:%x num_seg:%d a_rwnd:%d\n", - cum_ack, num_seg, a_rwnd); - stcb->asoc.seen_a_sack_this_pkt = 1; - if ((stcb->asoc.pr_sctp_cnt == 0) && - (num_seg == 0) && - SCTP_TSN_GE(cum_ack, stcb->asoc.last_acked_seq) && - (stcb->asoc.saw_sack_with_frags == 0) && - (stcb->asoc.saw_sack_with_nr_frags == 0) && - (!TAILQ_EMPTY(&stcb->asoc.sent_queue)) - ) { - /* - * We have a SIMPLE sack having no - * prior segments and data on sent - * queue to be acked.. Use the - * faster path sack processing. We - * also allow window update sacks - * with no missing segments to go - * this way too. - */ - sctp_express_handle_sack(stcb, cum_ack, a_rwnd, &abort_now, ecne_seen); + if (ch->chunk_type == SCTP_SELECTIVE_ACK) { + struct sctp_sack_chunk *sack; + + sack = (struct sctp_sack_chunk *)ch; + cum_ack = ntohl(sack->sack.cum_tsn_ack); + num_seg = ntohs(sack->sack.num_gap_ack_blks); + num_nr_seg = 0; + num_dup = ntohs(sack->sack.num_dup_tsns); + a_rwnd = ntohl(sack->sack.a_rwnd); + if (sizeof(struct sctp_sack_chunk) + + num_seg * sizeof(struct sctp_gap_ack_block) + + num_dup * sizeof(uint32_t) != chk_length) { + SCTPDBG(SCTP_DEBUG_INDATA1, "Bad size of SACK chunk\n"); + break; + } + offset_seg = *offset + sizeof(struct sctp_sack_chunk); + offset_dup = offset_seg + num_seg * sizeof(struct sctp_gap_ack_block); } else { - if (netp && *netp) - sctp_handle_sack(m, offset_seg, offset_dup, stcb, - num_seg, 0, num_dup, &abort_now, flags, - cum_ack, a_rwnd, ecne_seen); - } - if (abort_now) { - /* ABORT signal from sack processing */ - *offset = length; - return (NULL); - } - if (TAILQ_EMPTY(&stcb->asoc.send_queue) && - TAILQ_EMPTY(&stcb->asoc.sent_queue) && - (stcb->asoc.stream_queue_cnt == 0)) { - sctp_ulp_notify(SCTP_NOTIFY_SENDER_DRY, stcb, 0, NULL, SCTP_SO_NOT_LOCKED); - } - } - break; - /* - * EY - nr_sack: If the received chunk is an - * nr_sack chunk - */ - case SCTP_NR_SELECTIVE_ACK: - { - struct sctp_nr_sack_chunk *nr_sack; - int abort_now = 0; - uint32_t a_rwnd, cum_ack; - uint16_t num_seg, num_nr_seg, num_dup; - uint8_t flags; - int offset_seg, offset_dup; + struct sctp_nr_sack_chunk *nr_sack; - SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_NR_SACK\n"); - SCTP_STAT_INCR(sctps_recvsacks); - if (stcb == NULL) { - SCTPDBG(SCTP_DEBUG_INDATA1, "No stcb when processing NR-SACK chunk\n"); - break; + nr_sack = (struct sctp_nr_sack_chunk *)ch; + cum_ack = ntohl(nr_sack->nr_sack.cum_tsn_ack); + num_seg = ntohs(nr_sack->nr_sack.num_gap_ack_blks); + num_nr_seg = ntohs(nr_sack->nr_sack.num_nr_gap_ack_blks); + num_dup = ntohs(nr_sack->nr_sack.num_dup_tsns); + a_rwnd = ntohl(nr_sack->nr_sack.a_rwnd); + if (sizeof(struct sctp_nr_sack_chunk) + + (num_seg + num_nr_seg) * sizeof(struct sctp_gap_ack_block) + + num_dup * sizeof(uint32_t) != chk_length) { + SCTPDBG(SCTP_DEBUG_INDATA1, "Bad size of NR_SACK chunk\n"); + break; + } + offset_seg = *offset + sizeof(struct sctp_nr_sack_chunk); + offset_dup = offset_seg + (num_seg + num_nr_seg) * sizeof(struct sctp_gap_ack_block); } - if (stcb->asoc.nrsack_supported == 0) { - goto unknown_chunk; - } - if (chk_length < sizeof(struct sctp_nr_sack_chunk)) { - SCTPDBG(SCTP_DEBUG_INDATA1, "Bad size on NR-SACK chunk, too small\n"); - break; - } - if (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_SHUTDOWN_ACK_SENT) { - /*- - * If we have sent a shutdown-ack, we will pay no - * attention to a sack sent in to us since - * we don't care anymore. - */ - break; - } - nr_sack = (struct sctp_nr_sack_chunk *)ch; - flags = ch->chunk_flags; - cum_ack = ntohl(nr_sack->nr_sack.cum_tsn_ack); - num_seg = ntohs(nr_sack->nr_sack.num_gap_ack_blks); - num_nr_seg = ntohs(nr_sack->nr_sack.num_nr_gap_ack_blks); - num_dup = ntohs(nr_sack->nr_sack.num_dup_tsns); - a_rwnd = (uint32_t)ntohl(nr_sack->nr_sack.a_rwnd); - if (sizeof(struct sctp_nr_sack_chunk) + - (num_seg + num_nr_seg) * sizeof(struct sctp_gap_ack_block) + - num_dup * sizeof(uint32_t) != chk_length) { - SCTPDBG(SCTP_DEBUG_INDATA1, "Bad size of NR_SACK chunk\n"); - break; - } - offset_seg = *offset + sizeof(struct sctp_nr_sack_chunk); - offset_dup = offset_seg + num_seg * sizeof(struct sctp_gap_ack_block); - SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_NR_SACK process cum_ack:%x num_seg:%d a_rwnd:%d\n", + SCTPDBG(SCTP_DEBUG_INPUT3, "%s process cum_ack:%x num_seg:%d a_rwnd:%d\n", + (ch->chunk_type == SCTP_SELECTIVE_ACK) ? "SCTP_SACK" : "SCTP_NR_SACK", cum_ack, num_seg, a_rwnd); stcb->asoc.seen_a_sack_this_pkt = 1; if ((stcb->asoc.pr_sctp_cnt == 0) && @@ -5066,10 +5021,11 @@ process_control_chunks: sctp_express_handle_sack(stcb, cum_ack, a_rwnd, &abort_now, ecne_seen); } else { - if (netp && *netp) + if ((netp != NULL) && (*netp != NULL)) { sctp_handle_sack(m, offset_seg, offset_dup, stcb, num_seg, num_nr_seg, num_dup, &abort_now, flags, cum_ack, a_rwnd, ecne_seen); + } } if (abort_now) { /* ABORT signal from sack processing */ @@ -5081,47 +5037,28 @@ process_control_chunks: (stcb->asoc.stream_queue_cnt == 0)) { sctp_ulp_notify(SCTP_NOTIFY_SENDER_DRY, stcb, 0, NULL, SCTP_SO_NOT_LOCKED); } + break; } - break; - case SCTP_HEARTBEAT_REQUEST: SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_HEARTBEAT\n"); - if ((stcb) && netp && *netp) { + if ((stcb != NULL) && (netp != NULL) && (*netp != NULL)) { SCTP_STAT_INCR(sctps_recvheartbeat); sctp_send_heartbeat_ack(stcb, m, *offset, chk_length, *netp); - - /* He's alive so give him credit */ - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { - sctp_misc_ints(SCTP_THRESHOLD_CLEAR, - stcb->asoc.overall_error_count, - 0, - SCTP_FROM_SCTP_INPUT, - __LINE__); - } - stcb->asoc.overall_error_count = 0; } break; case SCTP_HEARTBEAT_ACK: - SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_HEARTBEAT-ACK\n"); + SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_HEARTBEAT_ACK\n"); if ((stcb == NULL) || (chk_length != sizeof(struct sctp_heartbeat_chunk))) { /* Its not ours */ *offset = length; return (stcb); } - /* He's alive so give him credit */ - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { - sctp_misc_ints(SCTP_THRESHOLD_CLEAR, - stcb->asoc.overall_error_count, - 0, - SCTP_FROM_SCTP_INPUT, - __LINE__); - } - stcb->asoc.overall_error_count = 0; SCTP_STAT_INCR(sctps_recvheartbeatack); - if (netp && *netp) + if ((netp != NULL) && (*netp != NULL)) { sctp_handle_heartbeat_ack((struct sctp_heartbeat_chunk *)ch, stcb, *netp); + } break; case SCTP_ABORT_ASSOCIATION: SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_ABORT, stcb %p\n", @@ -5144,7 +5081,7 @@ process_control_chunks: *offset = length; return (stcb); } - if (netp && *netp) { + if ((netp != NULL) && (*netp != NULL)) { int abort_flag = 0; sctp_handle_shutdown((struct sctp_shutdown_chunk *)ch, @@ -5156,24 +5093,25 @@ process_control_chunks: } break; case SCTP_SHUTDOWN_ACK: - SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_SHUTDOWN-ACK, stcb %p\n", (void *)stcb); - if ((stcb) && (netp) && (*netp)) + SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_SHUTDOWN_ACK, stcb %p\n", (void *)stcb); + if ((stcb != NULL) && (netp != NULL) && (*netp != NULL)) { sctp_handle_shutdown_ack((struct sctp_shutdown_ack_chunk *)ch, stcb, *netp); + } *offset = length; return (NULL); break; - case SCTP_OPERATION_ERROR: - SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_OP-ERR\n"); - if ((stcb) && netp && *netp && sctp_handle_error(ch, stcb, *netp) < 0) { + SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_OP_ERR\n"); + if ((stcb != NULL) && (netp != NULL) && (*netp != NULL) && + sctp_handle_error(ch, stcb, *netp) < 0) { *offset = length; return (NULL); } break; case SCTP_COOKIE_ECHO: SCTPDBG(SCTP_DEBUG_INPUT3, - "SCTP_COOKIE-ECHO, stcb %p\n", (void *)stcb); - if ((stcb) && (stcb->asoc.total_output_queue_size)) { + "SCTP_COOKIE_ECHO, stcb %p\n", (void *)stcb); + if ((stcb != NULL) && (stcb->asoc.total_output_queue_size > 0)) { ; } else { if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) { @@ -5215,7 +5153,7 @@ process_control_chunks: linp = inp; } - if (linp) { + if (linp != NULL) { SCTP_ASOC_CREATE_LOCK(linp); if ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) || (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE)) { @@ -5223,7 +5161,7 @@ process_control_chunks: goto abend; } } - if (netp) { + if (netp != NULL) { struct sctp_tcb *locked_stcb; locked_stcb = stcb; @@ -5251,7 +5189,7 @@ process_control_chunks: } else { ret_buf = NULL; } - if (linp) { + if (linp != NULL) { SCTP_ASOC_CREATE_UNLOCK(linp); } if (ret_buf == NULL) { @@ -5281,7 +5219,7 @@ process_control_chunks: } break; case SCTP_COOKIE_ACK: - SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_COOKIE-ACK, stcb %p\n", (void *)stcb); + SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_COOKIE_ACK, stcb %p\n", (void *)stcb); if ((stcb == NULL) || chk_length != sizeof(struct sctp_cookie_ack_chunk)) { return (stcb); } @@ -5307,75 +5245,43 @@ process_control_chunks: return (NULL); } } - /* He's alive so give him credit */ - if ((stcb) && netp && *netp) { - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { - sctp_misc_ints(SCTP_THRESHOLD_CLEAR, - stcb->asoc.overall_error_count, - 0, - SCTP_FROM_SCTP_INPUT, - __LINE__); - } - stcb->asoc.overall_error_count = 0; + if ((netp != NULL) && (*netp != NULL)) { sctp_handle_cookie_ack((struct sctp_cookie_ack_chunk *)ch, stcb, *netp); } break; case SCTP_ECN_ECHO: - SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_ECN-ECHO\n"); - /* He's alive so give him credit */ + SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_ECN_ECHO\n"); if ((stcb == NULL) || (chk_length != sizeof(struct sctp_ecne_chunk))) { /* Its not ours */ *offset = length; return (stcb); } - if (stcb) { - if (stcb->asoc.ecn_supported == 0) { - goto unknown_chunk; - } - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { - sctp_misc_ints(SCTP_THRESHOLD_CLEAR, - stcb->asoc.overall_error_count, - 0, - SCTP_FROM_SCTP_INPUT, - __LINE__); - } - stcb->asoc.overall_error_count = 0; - sctp_handle_ecn_echo((struct sctp_ecne_chunk *)ch, - stcb); - ecne_seen = 1; + if (stcb->asoc.ecn_supported == 0) { + goto unknown_chunk; } + sctp_handle_ecn_echo((struct sctp_ecne_chunk *)ch, stcb); + ecne_seen = 1; break; case SCTP_ECN_CWR: - SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_ECN-CWR\n"); - /* He's alive so give him credit */ + SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_ECN_CWR\n"); if ((stcb == NULL) || (chk_length != sizeof(struct sctp_cwr_chunk))) { *offset = length; return (stcb); } - if (stcb) { - if (stcb->asoc.ecn_supported == 0) { - goto unknown_chunk; - } - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { - sctp_misc_ints(SCTP_THRESHOLD_CLEAR, - stcb->asoc.overall_error_count, - 0, - SCTP_FROM_SCTP_INPUT, - __LINE__); - } - stcb->asoc.overall_error_count = 0; - sctp_handle_ecn_cwr((struct sctp_cwr_chunk *)ch, stcb, *netp); + if (stcb->asoc.ecn_supported == 0) { + goto unknown_chunk; } + sctp_handle_ecn_cwr((struct sctp_cwr_chunk *)ch, stcb, *netp); break; case SCTP_SHUTDOWN_COMPLETE: - SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_SHUTDOWN-COMPLETE, stcb %p\n", (void *)stcb); + SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_SHUTDOWN_COMPLETE, stcb %p\n", (void *)stcb); /* must be first and only chunk */ if ((num_chunks > 1) || (length - *offset > (int)SCTP_SIZE32(chk_length))) { *offset = length; return (stcb); } - if ((stcb) && netp && *netp) { + if ((stcb != NULL) && (netp != NULL) && (*netp != NULL)) { sctp_handle_shutdown_complete((struct sctp_shutdown_complete_chunk *)ch, stcb, *netp); } @@ -5384,32 +5290,23 @@ process_control_chunks: break; case SCTP_ASCONF: SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_ASCONF\n"); - /* He's alive so give him credit */ - if (stcb) { + if (stcb != NULL) { if (stcb->asoc.asconf_supported == 0) { goto unknown_chunk; } - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { - sctp_misc_ints(SCTP_THRESHOLD_CLEAR, - stcb->asoc.overall_error_count, - 0, - SCTP_FROM_SCTP_INPUT, - __LINE__); - } - stcb->asoc.overall_error_count = 0; sctp_handle_asconf(m, *offset, src, (struct sctp_asconf_chunk *)ch, stcb, asconf_cnt == 0); asconf_cnt++; } break; case SCTP_ASCONF_ACK: - SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_ASCONF-ACK\n"); + SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_ASCONF_ACK\n"); if (chk_length < sizeof(struct sctp_asconf_ack_chunk)) { /* Its not ours */ *offset = length; return (stcb); } - if ((stcb) && netp && *netp) { + if ((stcb != NULL) && (netp != NULL) && (*netp != NULL)) { if (stcb->asoc.asconf_supported == 0) { goto unknown_chunk; } @@ -5430,27 +5327,18 @@ process_control_chunks: break; case SCTP_FORWARD_CUM_TSN: case SCTP_IFORWARD_CUM_TSN: - SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_FWD-TSN\n"); + SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_FWD_TSN\n"); if (chk_length < sizeof(struct sctp_forward_tsn_chunk)) { /* Its not ours */ *offset = length; return (stcb); } - /* He's alive so give him credit */ - if (stcb) { + if (stcb != NULL) { int abort_flag = 0; if (stcb->asoc.prsctp_supported == 0) { goto unknown_chunk; } - stcb->asoc.overall_error_count = 0; - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { - sctp_misc_ints(SCTP_THRESHOLD_CLEAR, - stcb->asoc.overall_error_count, - 0, - SCTP_FROM_SCTP_INPUT, - __LINE__); - } *fwd_tsn_seen = 1; if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) { /* We are not interested anymore */ @@ -5480,17 +5368,7 @@ process_control_chunks: if (abort_flag) { *offset = length; return (NULL); - } else { - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { - sctp_misc_ints(SCTP_THRESHOLD_CLEAR, - stcb->asoc.overall_error_count, - 0, - SCTP_FROM_SCTP_INPUT, - __LINE__); - } - stcb->asoc.overall_error_count = 0; } - } break; case SCTP_STREAM_RESET: @@ -5517,7 +5395,7 @@ process_control_chunks: *offset = length; return (stcb); } - if (ch && (stcb) && netp && (*netp)) { + if ((ch != NULL) && (stcb != NULL) && (netp != NULL) && (*netp != NULL)) { if (stcb->asoc.pktdrop_supported == 0) { goto unknown_chunk; } @@ -5616,7 +5494,7 @@ next_chunk: } } /* while */ - if (asconf_cnt > 0 && stcb != NULL) { + if ((asconf_cnt > 0) && (stcb != NULL)) { sctp_send_asconf_ack(stcb); } return (stcb); @@ -5894,14 +5772,6 @@ sctp_common_input_processing(struct mbuf **mm, int iph * shows us the cookie-ack was lost. Imply it was * there. */ - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) { - sctp_misc_ints(SCTP_THRESHOLD_CLEAR, - stcb->asoc.overall_error_count, - 0, - SCTP_FROM_SCTP_INPUT, - __LINE__); - } - stcb->asoc.overall_error_count = 0; sctp_handle_cookie_ack((struct sctp_cookie_ack_chunk *)ch, stcb, net); break; case SCTP_STATE_COOKIE_WAIT: From owner-svn-src-stable-11@freebsd.org Sat Apr 7 20:13:30 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 64229F817AB; Sat, 7 Apr 2018 20:13:30 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 14593793E1; Sat, 7 Apr 2018 20:13:30 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0DF6C25857; Sat, 7 Apr 2018 20:13:30 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37KDTND083138; Sat, 7 Apr 2018 20:13:29 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37KDTOM083137; Sat, 7 Apr 2018 20:13:29 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072013.w37KDTOM083137@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 20:13:29 +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: r332225 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332225 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 20:13:30 -0000 Author: tuexen Date: Sat Apr 7 20:13:29 2018 New Revision: 332225 URL: https://svnweb.freebsd.org/changeset/base/332225 Log: MFC r325788: Simply the code and use the full buffer for contigous chunk representation. Modified: stable/11/sys/netinet/sctp_input.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_input.c ============================================================================== --- stable/11/sys/netinet/sctp_input.c Sat Apr 7 20:11:56 2018 (r332224) +++ stable/11/sys/netinet/sctp_input.c Sat Apr 7 20:13:29 2018 (r332225) @@ -4527,7 +4527,7 @@ sctp_process_control(struct mbuf *m, int iphlen, int * char msg[SCTP_DIAG_INFO_LEN]; uint32_t vtag_in; int num_chunks = 0; /* number of control chunks processed */ - uint32_t chk_length; + uint32_t chk_length, contiguous; int ret; int abort_no_unlock = 0; int ecne_seen = 0; @@ -4753,58 +4753,30 @@ process_control_chunks: } SCTP_STAT_INCR_COUNTER64(sctps_incontrolchunks); /* - * INIT-ACK only gets the init ack "header" portion only - * because we don't have to process the peer's COOKIE. All - * others get a complete chunk. + * INIT and INIT-ACK only gets the init ack "header" portion + * only because we don't have to process the peer's COOKIE. + * All others get a complete chunk. */ - if ((ch->chunk_type == SCTP_INITIATION_ACK) || - (ch->chunk_type == SCTP_INITIATION)) { - /* get an init-ack chunk */ - ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, *offset, - sizeof(struct sctp_init_ack_chunk), chunk_buf); - if (ch == NULL) { - *offset = length; - if (stcb != NULL) { - SCTP_TCB_UNLOCK(stcb); - } - return (NULL); + switch (ch->chunk_type) { + case SCTP_INITIATION: + contiguous = sizeof(struct sctp_init_chunk); + break; + case SCTP_INITIATION_ACK: + contiguous = sizeof(struct sctp_init_ack_chunk); + break; + default: + contiguous = min(chk_length, sizeof(chunk_buf)); + break; + } + ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, *offset, + contiguous, + chunk_buf); + if (ch == NULL) { + *offset = length; + if (stcb != NULL) { + SCTP_TCB_UNLOCK(stcb); } - } else { - /* For cookies and all other chunks. */ - if (chk_length > sizeof(chunk_buf)) { - /* - * use just the size of the chunk buffer so - * the front part of our chunks fit in - * contiguous space up to the chunk buffer - * size (508 bytes). For chunks that need to - * get more than that they must use the - * sctp_m_getptr() function or other means - * (e.g. know how to parse mbuf chains). - * Cookies do this already. - */ - ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, *offset, - (sizeof(chunk_buf) - 4), - chunk_buf); - if (ch == NULL) { - *offset = length; - if (stcb != NULL) { - SCTP_TCB_UNLOCK(stcb); - } - return (NULL); - } - } else { - /* We can fit it all */ - ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, *offset, - chk_length, chunk_buf); - if (ch == NULL) { - SCTP_PRINTF("sctp_process_control: Can't get the all data....\n"); - *offset = length; - if (stcb != NULL) { - SCTP_TCB_UNLOCK(stcb); - } - return (NULL); - } - } + return (NULL); } num_chunks++; /* Save off the last place we got a control from */ @@ -5401,7 +5373,7 @@ process_control_chunks: } sctp_handle_packet_dropped((struct sctp_pktdrop_chunk *)ch, stcb, *netp, - min(chk_length, (sizeof(chunk_buf) - 4))); + min(chk_length, contiguous)); } break; case SCTP_AUTHENTICATION: From owner-svn-src-stable-11@freebsd.org Sat Apr 7 20:15:13 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A58C1F8199A; Sat, 7 Apr 2018 20:15:13 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5274F7A2D9; Sat, 7 Apr 2018 20:15:13 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4728325858; Sat, 7 Apr 2018 20:15:13 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37KFDqj083256; Sat, 7 Apr 2018 20:15:13 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37KFD3t083255; Sat, 7 Apr 2018 20:15:13 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072015.w37KFD3t083255@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 20:15:13 +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: r332226 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332226 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 20:15:14 -0000 Author: tuexen Date: Sat Apr 7 20:15:12 2018 New Revision: 332226 URL: https://svnweb.freebsd.org/changeset/base/332226 Log: MFC r325864: Fix the handling of ERROR chunks which a lot of error causes. While there, clean up the code. Thanks to Felix Weinrank who found the bug by using fuzz-testing the SCTP userland stack. Modified: stable/11/sys/netinet/sctp_input.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_input.c ============================================================================== --- stable/11/sys/netinet/sctp_input.c Sat Apr 7 20:13:29 2018 (r332225) +++ stable/11/sys/netinet/sctp_input.c Sat Apr 7 20:15:12 2018 (r332226) @@ -1100,19 +1100,11 @@ sctp_handle_shutdown_ack(struct sctp_shutdown_ack_chun #endif } -/* - * Skip past the param header and then we will find the chunk that caused the - * problem. There are two possibilities ASCONF or FWD-TSN other than that and - * our peer must be broken. - */ static void -sctp_process_unrecog_chunk(struct sctp_tcb *stcb, struct sctp_paramhdr *phdr, +sctp_process_unrecog_chunk(struct sctp_tcb *stcb, uint8_t chunk_type, struct sctp_nets *net) { - struct sctp_chunkhdr *chk; - - chk = (struct sctp_chunkhdr *)((caddr_t)phdr + sizeof(*phdr)); - switch (chk->chunk_type) { + switch (chunk_type) { case SCTP_ASCONF_ACK: case SCTP_ASCONF: sctp_asconf_cleanup(stcb, net); @@ -1123,8 +1115,8 @@ sctp_process_unrecog_chunk(struct sctp_tcb *stcb, stru break; default: SCTPDBG(SCTP_DEBUG_INPUT2, - "Peer does not support chunk type %d(%x)??\n", - chk->chunk_type, (uint32_t)chk->chunk_type); + "Peer does not support chunk type %d (0x%x).\n", + chunk_type, chunk_type); break; } } @@ -1136,12 +1128,9 @@ sctp_process_unrecog_chunk(struct sctp_tcb *stcb, stru * XXX: Is this the right thing to do? */ static void -sctp_process_unrecog_param(struct sctp_tcb *stcb, struct sctp_paramhdr *phdr) +sctp_process_unrecog_param(struct sctp_tcb *stcb, uint16_t parameter_type) { - struct sctp_paramhdr *pbad; - - pbad = phdr + 1; - switch (ntohs(pbad->param_type)) { + switch (parameter_type) { /* pr-sctp draft */ case SCTP_PRSCTP_SUPPORTED: stcb->asoc.prsctp_supported = 0; @@ -1166,63 +1155,69 @@ sctp_process_unrecog_param(struct sctp_tcb *stcb, stru break; default: SCTPDBG(SCTP_DEBUG_INPUT2, - "Peer does not support param type %d(%x)??\n", - pbad->param_type, (uint32_t)pbad->param_type); + "Peer does not support param type %d (0x%x)??\n", + parameter_type, parameter_type); break; } } static int sctp_handle_error(struct sctp_chunkhdr *ch, - struct sctp_tcb *stcb, struct sctp_nets *net) + struct sctp_tcb *stcb, struct sctp_nets *net, uint32_t limit) { - int chklen; - struct sctp_paramhdr *phdr; - uint16_t error, error_type; - uint16_t error_len; + struct sctp_error_cause *cause; struct sctp_association *asoc; - int adjust; + uint32_t remaining_length, adjust; + uint16_t code, cause_code, cause_length; #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; #endif /* parse through all of the errors and process */ asoc = &stcb->asoc; - phdr = (struct sctp_paramhdr *)((caddr_t)ch + + cause = (struct sctp_error_cause *)((caddr_t)ch + sizeof(struct sctp_chunkhdr)); - chklen = ntohs(ch->chunk_length) - sizeof(struct sctp_chunkhdr); - error = 0; - while ((size_t)chklen >= sizeof(struct sctp_paramhdr)) { + remaining_length = ntohs(ch->chunk_length); + if (remaining_length > limit) { + remaining_length = limit; + } + if (remaining_length >= sizeof(struct sctp_chunkhdr)) { + remaining_length -= sizeof(struct sctp_chunkhdr); + } else { + remaining_length = 0; + } + code = 0; + while (remaining_length >= sizeof(struct sctp_error_cause)) { /* Process an Error Cause */ - error_type = ntohs(phdr->param_type); - error_len = ntohs(phdr->param_length); - if ((error_len > chklen) || (error_len == 0)) { - /* invalid param length for this param */ - SCTPDBG(SCTP_DEBUG_INPUT1, "Bogus length in error param- chunk left:%d errorlen:%d\n", - chklen, error_len); + cause_code = ntohs(cause->code); + cause_length = ntohs(cause->length); + if ((cause_length > remaining_length) || (cause_length == 0)) { + /* Invalid cause length, possibly due to truncation. */ + SCTPDBG(SCTP_DEBUG_INPUT1, "Bogus length in cause - bytes left: %u cause length: %u\n", + remaining_length, cause_length); return (0); } - if (error == 0) { + if (code == 0) { /* report the first error cause */ - error = error_type; + code = cause_code; } - switch (error_type) { + switch (cause_code) { case SCTP_CAUSE_INVALID_STREAM: case SCTP_CAUSE_MISSING_PARAM: case SCTP_CAUSE_INVALID_PARAM: case SCTP_CAUSE_NO_USER_DATA: - SCTPDBG(SCTP_DEBUG_INPUT1, "Software error we got a %d back? We have a bug :/ (or do they?)\n", - error_type); + SCTPDBG(SCTP_DEBUG_INPUT1, "Software error we got a %u back? We have a bug :/ (or do they?)\n", + cause_code); break; case SCTP_CAUSE_NAT_COLLIDING_STATE: - SCTPDBG(SCTP_DEBUG_INPUT2, "Received Colliding state abort flags:%x\n", + SCTPDBG(SCTP_DEBUG_INPUT2, "Received Colliding state abort flags: %x\n", ch->chunk_flags); if (sctp_handle_nat_colliding_state(stcb)) { return (0); } break; case SCTP_CAUSE_NAT_MISSING_STATE: - SCTPDBG(SCTP_DEBUG_INPUT2, "Received missing state abort flags:%x\n", + SCTPDBG(SCTP_DEBUG_INPUT2, "Received missing state abort flags: %x\n", ch->chunk_flags); if (sctp_handle_nat_missing_state(stcb, net)) { return (0); @@ -1233,12 +1228,18 @@ sctp_handle_error(struct sctp_chunkhdr *ch, * We only act if we have echoed a cookie and are * waiting. */ - if (SCTP_GET_STATE(asoc) == SCTP_STATE_COOKIE_ECHOED) { - int *p; + if ((cause_length >= sizeof(struct sctp_error_stale_cookie)) && + (SCTP_GET_STATE(asoc) == SCTP_STATE_COOKIE_ECHOED)) { + struct sctp_error_stale_cookie *stale_cookie; - p = (int *)((caddr_t)phdr + sizeof(*phdr)); - /* Save the time doubled */ - asoc->cookie_preserve_req = ntohl(*p) << 1; + stale_cookie = (struct sctp_error_stale_cookie *)cause; + asoc->cookie_preserve_req = ntohl(stale_cookie->stale_time); + /* Double it to be more robust on RTX */ + if (asoc->cookie_preserve_req <= UINT32_MAX / 2) { + asoc->cookie_preserve_req *= 2; + } else { + asoc->cookie_preserve_req = UINT32_MAX; + } asoc->stale_cookie_count++; if (asoc->stale_cookie_count > asoc->max_init_times) { @@ -1281,10 +1282,21 @@ sctp_handle_error(struct sctp_chunkhdr *ch, */ break; case SCTP_CAUSE_UNRECOG_CHUNK: - sctp_process_unrecog_chunk(stcb, phdr, net); + if (cause_length >= sizeof(struct sctp_error_unrecognized_chunk)) { + struct sctp_error_unrecognized_chunk *unrec_chunk; + + unrec_chunk = (struct sctp_error_unrecognized_chunk *)cause; + sctp_process_unrecog_chunk(stcb, unrec_chunk->ch.chunk_type, net); + } break; case SCTP_CAUSE_UNRECOG_PARAM: - sctp_process_unrecog_param(stcb, phdr); + /* XXX: We only consider the first parameter */ + if (cause_length >= sizeof(struct sctp_error_cause) + sizeof(struct sctp_paramhdr)) { + struct sctp_paramhdr *unrec_parameter; + + unrec_parameter = (struct sctp_paramhdr *)(cause + 1); + sctp_process_unrecog_param(stcb, ntohs(unrec_parameter->param_type)); + } break; case SCTP_CAUSE_COOKIE_IN_SHUTDOWN: /* @@ -1301,8 +1313,8 @@ sctp_handle_error(struct sctp_chunkhdr *ch, * We should NOT get these here, but in a * ASCONF-ACK. */ - SCTPDBG(SCTP_DEBUG_INPUT2, "Peer sends ASCONF errors in a Operational Error?<%d>?\n", - error_type); + SCTPDBG(SCTP_DEBUG_INPUT2, "Peer sends ASCONF errors in a error cause with code %u.\n", + cause_code); break; case SCTP_CAUSE_OUT_OF_RESC: /* @@ -1314,15 +1326,19 @@ sctp_handle_error(struct sctp_chunkhdr *ch, */ break; default: - SCTPDBG(SCTP_DEBUG_INPUT1, "sctp_handle_error: unknown error type = 0x%xh\n", - error_type); + SCTPDBG(SCTP_DEBUG_INPUT1, "sctp_handle_error: unknown code 0x%x\n", + cause_code); break; } - adjust = SCTP_SIZE32(error_len); - chklen -= adjust; - phdr = (struct sctp_paramhdr *)((caddr_t)phdr + adjust); + adjust = SCTP_SIZE32(cause_length); + if (remaining_length >= adjust) { + remaining_length -= adjust; + } else { + remaining_length = 0; + } + cause = (struct sctp_error_cause *)((caddr_t)cause + adjust); } - sctp_ulp_notify(SCTP_NOTIFY_REMOTE_ERROR, stcb, error, ch, SCTP_SO_NOT_LOCKED); + sctp_ulp_notify(SCTP_NOTIFY_REMOTE_ERROR, stcb, code, ch, SCTP_SO_NOT_LOCKED); return (0); } @@ -5075,7 +5091,7 @@ process_control_chunks: case SCTP_OPERATION_ERROR: SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_OP_ERR\n"); if ((stcb != NULL) && (netp != NULL) && (*netp != NULL) && - sctp_handle_error(ch, stcb, *netp) < 0) { + sctp_handle_error(ch, stcb, *netp, contiguous) < 0) { *offset = length; return (NULL); } From owner-svn-src-stable-11@freebsd.org Sat Apr 7 20:22:06 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8BE28F82297; Sat, 7 Apr 2018 20:22:06 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3A0D57DCFE; Sat, 7 Apr 2018 20:22:06 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1A432259C8; Sat, 7 Apr 2018 20:22:06 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37KM5kM087959; Sat, 7 Apr 2018 20:22:05 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37KM4Ah087948; Sat, 7 Apr 2018 20:22:04 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072022.w37KM4Ah087948@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 20:22:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332227 - in stable/11: sys/conf sys/netinet sys/netinet6 usr.bin/systat X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in stable/11: sys/conf sys/netinet sys/netinet6 usr.bin/systat X-SVN-Commit-Revision: 332227 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 20:22:07 -0000 Author: tuexen Date: Sat Apr 7 20:22:04 2018 New Revision: 332227 URL: https://svnweb.freebsd.org/changeset/base/332227 Log: MFC r326672: Retire SCTP_WITH_NO_CSUM option. This option was used in the early days to allow performance measurements extrapolating the use of SCTP checksum offloading. Since this feature is now available, get rid of this option. This also un-breaks the LINT kernel. Thanks to markj@ for making me aware of the problem. Modified: stable/11/sys/conf/NOTES stable/11/sys/conf/options stable/11/sys/netinet/sctp_crc32.c stable/11/sys/netinet/sctp_crc32.h stable/11/sys/netinet/sctp_input.c stable/11/sys/netinet/sctp_input.h stable/11/sys/netinet/sctp_output.c stable/11/sys/netinet/sctp_sysctl.c stable/11/sys/netinet/sctp_uio.h stable/11/sys/netinet6/sctp6_usrreq.c stable/11/usr.bin/systat/sctp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/conf/NOTES ============================================================================== --- stable/11/sys/conf/NOTES Sat Apr 7 20:15:12 2018 (r332226) +++ stable/11/sys/conf/NOTES Sat Apr 7 20:22:04 2018 (r332227) @@ -664,21 +664,6 @@ options SCTP # faster.. if you are not debugging don't use. options SCTP_DEBUG # -# This option turns off the CRC32c checksum. Basically, -# you will not be able to talk to anyone else who -# has not done this. Its more for experimentation to -# see how much CPU the CRC32c really takes. Most new -# cards for TCP support checksum offload.. so this -# option gives you a "view" into what SCTP would be -# like with such an offload (which only exists in -# high in iSCSI boards so far). With the new -# splitting 8's algorithm its not as bad as it used -# to be.. but it does speed things up try only -# for in a captured lab environment :-) -options SCTP_WITH_NO_CSUM -# - -# # All that options after that turn on specific types of # logging. You can monitor CWND growth, flight size # and all sorts of things. Go look at the code and Modified: stable/11/sys/conf/options ============================================================================== --- stable/11/sys/conf/options Sat Apr 7 20:15:12 2018 (r332226) +++ stable/11/sys/conf/options Sat Apr 7 20:22:04 2018 (r332227) @@ -462,7 +462,6 @@ FLOWTABLE_HASH_ALL opt_route.h # SCTP opt_sctp.h SCTP_DEBUG opt_sctp.h # Enable debug printfs -SCTP_WITH_NO_CSUM opt_sctp.h # Use this at your peril SCTP_LOCK_LOGGING opt_sctp.h # Log to KTR lock activity SCTP_MBUF_LOGGING opt_sctp.h # Log to KTR general mbuf aloc/free SCTP_MBCNT_LOGGING opt_sctp.h # Log to KTR mbcnt activity Modified: stable/11/sys/netinet/sctp_crc32.c ============================================================================== --- stable/11/sys/netinet/sctp_crc32.c Sat Apr 7 20:15:12 2018 (r332226) +++ stable/11/sys/netinet/sctp_crc32.c Sat Apr 7 20:22:04 2018 (r332227) @@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$"); #include -#if !defined(SCTP_WITH_NO_CSUM) static uint32_t sctp_finalize_crc32c(uint32_t crc32c) @@ -113,17 +112,11 @@ sctp_calculate_cksum(struct mbuf *m, uint32_t offset) base = sctp_finalize_crc32c(base); return (base); } -#endif /* !defined(SCTP_WITH_NO_CSUM) */ void sctp_delayed_cksum(struct mbuf *m, uint32_t offset) { -#if defined(SCTP_WITH_NO_CSUM) -#ifdef INVARIANTS - panic("sctp_delayed_cksum() called when using no SCTP CRC."); -#endif -#else uint32_t checksum; checksum = sctp_calculate_cksum(m, offset); @@ -142,5 +135,4 @@ sctp_delayed_cksum(struct mbuf *m, uint32_t offset) return; } *(uint32_t *)(m->m_data + offset) = checksum; -#endif } Modified: stable/11/sys/netinet/sctp_crc32.h ============================================================================== --- stable/11/sys/netinet/sctp_crc32.h Sat Apr 7 20:15:12 2018 (r332226) +++ stable/11/sys/netinet/sctp_crc32.h Sat Apr 7 20:22:04 2018 (r332227) @@ -37,9 +37,7 @@ __FBSDID("$FreeBSD$"); #define _NETINET_SCTP_CRC32_H_ #if defined(_KERNEL) -#if !defined(SCTP_WITH_NO_CSUM) uint32_t sctp_calculate_cksum(struct mbuf *, uint32_t); -#endif void sctp_delayed_cksum(struct mbuf *, uint32_t offset); #endif /* _KERNEL */ #endif /* __crc32c_h__ */ Modified: stable/11/sys/netinet/sctp_input.c ============================================================================== --- stable/11/sys/netinet/sctp_input.c Sat Apr 7 20:15:12 2018 (r332226) +++ stable/11/sys/netinet/sctp_input.c Sat Apr 7 20:22:04 2018 (r332227) @@ -5496,9 +5496,7 @@ void sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, int length, struct sockaddr *src, struct sockaddr *dst, struct sctphdr *sh, struct sctp_chunkhdr *ch, -#if !defined(SCTP_WITH_NO_CSUM) uint8_t compute_crc, -#endif uint8_t ecn_bits, uint8_t mflowtype, uint32_t mflowid, uint16_t fibnum, uint32_t vrf_id, uint16_t port) @@ -5518,7 +5516,6 @@ sctp_common_input_processing(struct mbuf **mm, int iph sctp_audit_log(0xE0, 1); sctp_auditing(0, inp, stcb, net); #endif -#if !defined(SCTP_WITH_NO_CSUM) if (compute_crc != 0) { uint32_t check, calc_check; @@ -5563,7 +5560,6 @@ sctp_common_input_processing(struct mbuf **mm, int iph goto out; } } -#endif /* Destination port of 0 is illegal, based on RFC4960. */ if (sh->dest_port == 0) { SCTP_STAT_INCR(sctps_hdrops); @@ -5881,9 +5877,7 @@ sctp_input_with_port(struct mbuf *i_pak, int off, uint struct sctphdr *sh; struct sctp_chunkhdr *ch; int length, offset; -#if !defined(SCTP_WITH_NO_CSUM) uint8_t compute_crc; -#endif uint32_t mflowid; uint8_t mflowtype; uint16_t fibnum; @@ -5953,9 +5947,6 @@ sctp_input_with_port(struct mbuf *i_pak, int off, uint goto out; } ecn_bits = ip->ip_tos; -#if defined(SCTP_WITH_NO_CSUM) - SCTP_STAT_INCR(sctps_recvnocrc); -#else if (m->m_pkthdr.csum_flags & CSUM_SCTP_VALID) { SCTP_STAT_INCR(sctps_recvhwcrc); compute_crc = 0; @@ -5963,14 +5954,11 @@ sctp_input_with_port(struct mbuf *i_pak, int off, uint SCTP_STAT_INCR(sctps_recvswcrc); compute_crc = 1; } -#endif sctp_common_input_processing(&m, iphlen, offset, length, (struct sockaddr *)&src, (struct sockaddr *)&dst, sh, ch, -#if !defined(SCTP_WITH_NO_CSUM) compute_crc, -#endif ecn_bits, mflowtype, mflowid, fibnum, vrf_id, port); Modified: stable/11/sys/netinet/sctp_input.h ============================================================================== --- stable/11/sys/netinet/sctp_input.h Sat Apr 7 20:15:12 2018 (r332226) +++ stable/11/sys/netinet/sctp_input.h Sat Apr 7 20:22:04 2018 (r332227) @@ -41,9 +41,7 @@ void sctp_common_input_processing(struct mbuf **, int, int, int, struct sockaddr *, struct sockaddr *, struct sctphdr *, struct sctp_chunkhdr *, -#if !defined(SCTP_WITH_NO_CSUM) uint8_t, -#endif uint8_t, uint8_t, uint32_t, uint16_t, uint32_t, uint16_t); Modified: stable/11/sys/netinet/sctp_output.c ============================================================================== --- stable/11/sys/netinet/sctp_output.c Sat Apr 7 20:15:12 2018 (r332226) +++ stable/11/sys/netinet/sctp_output.c Sat Apr 7 20:22:04 2018 (r332227) @@ -4224,23 +4224,15 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, } SCTP_ATTACH_CHAIN(o_pak, m, packet_length); if (port) { -#if defined(SCTP_WITH_NO_CSUM) - SCTP_STAT_INCR(sctps_sendnocrc); -#else sctphdr->checksum = sctp_calculate_cksum(m, sizeof(struct ip) + sizeof(struct udphdr)); SCTP_STAT_INCR(sctps_sendswcrc); -#endif if (V_udp_cksum) { SCTP_ENABLE_UDP_CSUM(o_pak); } } else { -#if defined(SCTP_WITH_NO_CSUM) - SCTP_STAT_INCR(sctps_sendnocrc); -#else m->m_pkthdr.csum_flags = CSUM_SCTP; m->m_pkthdr.csum_data = offsetof(struct sctphdr, checksum); SCTP_STAT_INCR(sctps_sendhwcrc); -#endif } #ifdef SCTP_PACKET_LOGGING if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) @@ -4564,23 +4556,15 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, } SCTP_ATTACH_CHAIN(o_pak, m, packet_length); if (port) { -#if defined(SCTP_WITH_NO_CSUM) - SCTP_STAT_INCR(sctps_sendnocrc); -#else sctphdr->checksum = sctp_calculate_cksum(m, sizeof(struct ip6_hdr) + sizeof(struct udphdr)); SCTP_STAT_INCR(sctps_sendswcrc); -#endif if ((udp->uh_sum = in6_cksum(o_pak, IPPROTO_UDP, sizeof(struct ip6_hdr), packet_length - sizeof(struct ip6_hdr))) == 0) { udp->uh_sum = 0xffff; } } else { -#if defined(SCTP_WITH_NO_CSUM) - SCTP_STAT_INCR(sctps_sendnocrc); -#else m->m_pkthdr.csum_flags = CSUM_SCTP_IPV6; m->m_pkthdr.csum_data = offsetof(struct sctphdr, checksum); SCTP_STAT_INCR(sctps_sendhwcrc); -#endif } /* send it out. table id is taken from stcb */ #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) @@ -11225,23 +11209,15 @@ sctp_send_resp_msg(struct sockaddr *src, struct sockad } ip->ip_len = htons(len); if (port) { -#if defined(SCTP_WITH_NO_CSUM) - SCTP_STAT_INCR(sctps_sendnocrc); -#else shout->checksum = sctp_calculate_cksum(mout, sizeof(struct ip) + sizeof(struct udphdr)); SCTP_STAT_INCR(sctps_sendswcrc); -#endif if (V_udp_cksum) { SCTP_ENABLE_UDP_CSUM(o_pak); } } else { -#if defined(SCTP_WITH_NO_CSUM) - SCTP_STAT_INCR(sctps_sendnocrc); -#else mout->m_pkthdr.csum_flags = CSUM_SCTP; mout->m_pkthdr.csum_data = offsetof(struct sctphdr, checksum); SCTP_STAT_INCR(sctps_sendhwcrc); -#endif } #ifdef SCTP_PACKET_LOGGING if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) { @@ -11255,23 +11231,15 @@ sctp_send_resp_msg(struct sockaddr *src, struct sockad case AF_INET6: ip6->ip6_plen = (uint16_t)(len - sizeof(struct ip6_hdr)); if (port) { -#if defined(SCTP_WITH_NO_CSUM) - SCTP_STAT_INCR(sctps_sendnocrc); -#else shout->checksum = sctp_calculate_cksum(mout, sizeof(struct ip6_hdr) + sizeof(struct udphdr)); SCTP_STAT_INCR(sctps_sendswcrc); -#endif if ((udp->uh_sum = in6_cksum(o_pak, IPPROTO_UDP, sizeof(struct ip6_hdr), len - sizeof(struct ip6_hdr))) == 0) { udp->uh_sum = 0xffff; } } else { -#if defined(SCTP_WITH_NO_CSUM) - SCTP_STAT_INCR(sctps_sendnocrc); -#else mout->m_pkthdr.csum_flags = CSUM_SCTP_IPV6; mout->m_pkthdr.csum_data = offsetof(struct sctphdr, checksum); SCTP_STAT_INCR(sctps_sendhwcrc); -#endif } #ifdef SCTP_PACKET_LOGGING if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) { Modified: stable/11/sys/netinet/sctp_sysctl.c ============================================================================== --- stable/11/sys/netinet/sctp_sysctl.c Sat Apr 7 20:15:12 2018 (r332226) +++ stable/11/sys/netinet/sctp_sysctl.c Sat Apr 7 20:22:04 2018 (r332227) @@ -713,7 +713,6 @@ sctp_sysctl_handle_stats(SYSCTL_HANDLER_ARGS) sb.sctps_recvauthfailed += sarry->sctps_recvauthfailed; sb.sctps_recvexpress += sarry->sctps_recvexpress; sb.sctps_recvexpressm += sarry->sctps_recvexpressm; - sb.sctps_recvnocrc += sarry->sctps_recvnocrc; sb.sctps_recvswcrc += sarry->sctps_recvswcrc; sb.sctps_recvhwcrc += sarry->sctps_recvhwcrc; sb.sctps_sendpackets += sarry->sctps_sendpackets; @@ -726,7 +725,6 @@ sctp_sysctl_handle_stats(SYSCTL_HANDLER_ARGS) sb.sctps_sendecne += sarry->sctps_sendecne; sb.sctps_sendauth += sarry->sctps_sendauth; sb.sctps_senderrors += sarry->sctps_senderrors; - sb.sctps_sendnocrc += sarry->sctps_sendnocrc; sb.sctps_sendswcrc += sarry->sctps_sendswcrc; sb.sctps_sendhwcrc += sarry->sctps_sendhwcrc; sb.sctps_pdrpfmbox += sarry->sctps_pdrpfmbox; Modified: stable/11/sys/netinet/sctp_uio.h ============================================================================== --- stable/11/sys/netinet/sctp_uio.h Sat Apr 7 20:15:12 2018 (r332226) +++ stable/11/sys/netinet/sctp_uio.h Sat Apr 7 20:22:04 2018 (r332227) @@ -984,7 +984,7 @@ struct sctpstat { uint32_t sctps_recvexpress; /* total fast path receives all one * chunk */ uint32_t sctps_recvexpressm; /* total fast path multi-part data */ - uint32_t sctps_recvnocrc; + uint32_t sctps_recv_spare; /* formerly sctps_recvnocrc */ uint32_t sctps_recvswcrc; uint32_t sctps_recvhwcrc; @@ -1004,7 +1004,7 @@ struct sctpstat { uint32_t sctps_sendecne;/* total output ECNE chunks */ uint32_t sctps_sendauth;/* total output AUTH chunks FIXME */ uint32_t sctps_senderrors; /* ip_output error counter */ - uint32_t sctps_sendnocrc; + uint32_t sctps_send_spare; /* formerly sctps_sendnocrc */ uint32_t sctps_sendswcrc; uint32_t sctps_sendhwcrc; /* PCKDROPREP statistics: */ Modified: stable/11/sys/netinet6/sctp6_usrreq.c ============================================================================== --- stable/11/sys/netinet6/sctp6_usrreq.c Sat Apr 7 20:15:12 2018 (r332226) +++ stable/11/sys/netinet6/sctp6_usrreq.c Sat Apr 7 20:22:04 2018 (r332227) @@ -69,9 +69,7 @@ sctp6_input_with_port(struct mbuf **i_pak, int *offp, struct sctphdr *sh; struct sctp_chunkhdr *ch; int length, offset; -#if !defined(SCTP_WITH_NO_CSUM) uint8_t compute_crc; -#endif uint32_t mflowid; uint8_t mflowtype; uint16_t fibnum; @@ -142,9 +140,6 @@ sctp6_input_with_port(struct mbuf **i_pak, int *offp, goto out; } ecn_bits = ((ntohl(ip6->ip6_flow) >> 20) & 0x000000ff); -#if defined(SCTP_WITH_NO_CSUM) - SCTP_STAT_INCR(sctps_recvnocrc); -#else if (m->m_pkthdr.csum_flags & CSUM_SCTP_VALID) { SCTP_STAT_INCR(sctps_recvhwcrc); compute_crc = 0; @@ -152,14 +147,11 @@ sctp6_input_with_port(struct mbuf **i_pak, int *offp, SCTP_STAT_INCR(sctps_recvswcrc); compute_crc = 1; } -#endif sctp_common_input_processing(&m, iphlen, offset, length, (struct sockaddr *)&src, (struct sockaddr *)&dst, sh, ch, -#if !defined(SCTP_WITH_NO_CSUM) compute_crc, -#endif ecn_bits, mflowtype, mflowid, fibnum, vrf_id, port); Modified: stable/11/usr.bin/systat/sctp.c ============================================================================== --- stable/11/usr.bin/systat/sctp.c Sat Apr 7 20:15:12 2018 (r332226) +++ stable/11/usr.bin/systat/sctp.c Sat Apr 7 20:22:04 2018 (r332227) @@ -180,7 +180,6 @@ domode(struct sctpstat *ret) DO(sctps_recvauthfailed); DO(sctps_recvexpress); DO(sctps_recvexpressm); - DO(sctps_recvnocrc); DO(sctps_recvswcrc); DO(sctps_recvhwcrc); @@ -194,7 +193,6 @@ domode(struct sctpstat *ret) DO(sctps_sendecne); DO(sctps_sendauth); DO(sctps_senderrors); - DO(sctps_sendnocrc); DO(sctps_sendswcrc); DO(sctps_sendhwcrc); From owner-svn-src-stable-11@freebsd.org Sat Apr 7 20:23:35 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 29242F82449; Sat, 7 Apr 2018 20:23:35 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CC9D37EB4B; Sat, 7 Apr 2018 20:23:34 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C5BFD259EB; Sat, 7 Apr 2018 20:23:34 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37KNY4C088059; Sat, 7 Apr 2018 20:23:34 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37KNYJU088057; Sat, 7 Apr 2018 20:23:34 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072023.w37KNYJU088057@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 20:23: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: r332228 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332228 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 20:23:35 -0000 Author: tuexen Date: Sat Apr 7 20:23:34 2018 New Revision: 332228 URL: https://svnweb.freebsd.org/changeset/base/332228 Log: MFC r326829: Cleaup, no functional change. Modified: stable/11/sys/netinet/sctp_input.c stable/11/sys/netinet/sctp_output.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_input.c ============================================================================== --- stable/11/sys/netinet/sctp_input.c Sat Apr 7 20:22:04 2018 (r332227) +++ stable/11/sys/netinet/sctp_input.c Sat Apr 7 20:23:34 2018 (r332228) @@ -3208,9 +3208,9 @@ sctp_handle_ecn_cwr(struct sctp_cwr_chunk *cp, struct stcb->asoc.ecn_echo_cnt_onq--; TAILQ_REMOVE(&stcb->asoc.control_send_queue, chk, sctp_next); + stcb->asoc.ctrl_queue_cnt--; sctp_m_freem(chk->data); chk->data = NULL; - stcb->asoc.ctrl_queue_cnt--; sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); if (override == 0) { break; @@ -3642,26 +3642,23 @@ static void sctp_clean_up_stream_reset(struct sctp_tcb *stcb) { struct sctp_association *asoc; - struct sctp_tmit_chunk *chk = stcb->asoc.str_reset; + struct sctp_tmit_chunk *chk; - if (stcb->asoc.str_reset == NULL) { + asoc = &stcb->asoc; + chk = asoc->str_reset; + if (chk == NULL) { return; } - asoc = &stcb->asoc; - + asoc->str_reset = NULL; sctp_timer_stop(SCTP_TIMER_TYPE_STRRESET, stcb->sctp_ep, stcb, chk->whoTo, SCTP_FROM_SCTP_INPUT + SCTP_LOC_28); - TAILQ_REMOVE(&asoc->control_send_queue, - chk, - sctp_next); + TAILQ_REMOVE(&asoc->control_send_queue, chk, sctp_next); + asoc->ctrl_queue_cnt--; if (chk->data) { sctp_m_freem(chk->data); chk->data = NULL; } - asoc->ctrl_queue_cnt--; sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); - /* sa_ignore NO_NULL_CHK */ - stcb->asoc.str_reset = NULL; } Modified: stable/11/sys/netinet/sctp_output.c ============================================================================== --- stable/11/sys/netinet/sctp_output.c Sat Apr 7 20:22:04 2018 (r332227) +++ stable/11/sys/netinet/sctp_output.c Sat Apr 7 20:23:34 2018 (r332228) @@ -6896,11 +6896,11 @@ sctp_toss_old_cookies(struct sctp_tcb *stcb, struct sc TAILQ_FOREACH_SAFE(chk, &asoc->control_send_queue, sctp_next, nchk) { if (chk->rec.chunk_id.id == SCTP_COOKIE_ECHO) { TAILQ_REMOVE(&asoc->control_send_queue, chk, sctp_next); + asoc->ctrl_queue_cnt--; if (chk->data) { sctp_m_freem(chk->data); chk->data = NULL; } - asoc->ctrl_queue_cnt--; sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); } } @@ -6925,11 +6925,11 @@ sctp_toss_old_asconf(struct sctp_tcb *stcb) } } TAILQ_REMOVE(&asoc->asconf_send_queue, chk, sctp_next); + asoc->ctrl_queue_cnt--; if (chk->data) { sctp_m_freem(chk->data); chk->data = NULL; } - asoc->ctrl_queue_cnt--; sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); } } @@ -7053,13 +7053,14 @@ sctp_clean_up_ctl(struct sctp_tcb *stcb, struct sctp_a /* Stray chunks must be cleaned up */ clean_up_anyway: TAILQ_REMOVE(&asoc->control_send_queue, chk, sctp_next); + asoc->ctrl_queue_cnt--; if (chk->data) { sctp_m_freem(chk->data); chk->data = NULL; } - asoc->ctrl_queue_cnt--; - if (chk->rec.chunk_id.id == SCTP_FORWARD_CUM_TSN) + if (chk->rec.chunk_id.id == SCTP_FORWARD_CUM_TSN) { asoc->fwd_tsn_cnt--; + } sctp_free_a_chunk(stcb, chk, so_locked); } else if (chk->rec.chunk_id.id == SCTP_STREAM_RESET) { /* special handling, we must look into the param */ From owner-svn-src-stable-11@freebsd.org Sat Apr 7 20:27:13 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77F1BF8280C; Sat, 7 Apr 2018 20:27:13 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 238CE809ED; Sat, 7 Apr 2018 20:27:13 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1B716259ED; Sat, 7 Apr 2018 20:27:13 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37KRCsF088251; Sat, 7 Apr 2018 20:27:12 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37KRCNN088242; Sat, 7 Apr 2018 20:27:12 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072027.w37KRCNN088242@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 20:27: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: r332229 - in stable/11: sbin/ipfw sys/conf sys/netinet sys/netpfil/ipfw X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in stable/11: sbin/ipfw sys/conf sys/netinet sys/netpfil/ipfw X-SVN-Commit-Revision: 332229 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 20:27:13 -0000 Author: tuexen Date: Sat Apr 7 20:27:11 2018 New Revision: 332229 URL: https://svnweb.freebsd.org/changeset/base/332229 Log: MFC r326233: Add to ipfw support for sending an SCTP packet containing an ABORT chunk. This is similar to the TCP case. where a TCP RST segment can be sent. There is one limitation: When sending an ABORT in response to an incoming packet, it should be tested if there is no ABORT chunk in the received packet. Currently, it is only checked if the first chunk is an ABORT chunk to avoid parsing the whole packet, which could result in a DOS attack. Thanks to Timo Voelker for helping me to test this patch. MFC r327200: When adding support for sending SCTP packets containing an ABORT chunk to ipfw in https://svnweb.freebsd.org/changeset/base/326233, a dependency on the SCTP stack was added to ipfw by accident. This was noted by Kevel Bowling in https://reviews.freebsd.org/D13594 where also a solution was suggested. This patch is based on Kevin's suggestion, but implements the required SCTP checksum computation without any dependency on other SCTP sources. While there, do some cleanups and improve comments. Thanks to Kevin Kevin Bowling for reporting the issue and suggesting a fix. Modified: stable/11/sbin/ipfw/ipfw.8 stable/11/sbin/ipfw/ipfw2.c stable/11/sbin/ipfw/ipfw2.h stable/11/sys/conf/files stable/11/sys/netinet/ip_fw.h stable/11/sys/netinet/sctp_crc32.c stable/11/sys/netinet/sctp_crc32.h stable/11/sys/netpfil/ipfw/ip_fw2.c stable/11/sys/netpfil/ipfw/ip_fw_log.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/ipfw/ipfw.8 ============================================================================== --- stable/11/sbin/ipfw/ipfw.8 Sat Apr 7 20:23:34 2018 (r332228) +++ stable/11/sbin/ipfw/ipfw.8 Sat Apr 7 20:27:11 2018 (r332229) @@ -1173,6 +1173,14 @@ ipfw add reass all from any to any in .Ed .Pp is all you need at the beginning of your ruleset. +.It Cm abort +Discard packets that match this rule, and if the packet is an SCTP packet, +try to send an SCTP packet containing an ABORT chunk. +The search terminates. +.It Cm abort6 +Discard packets that match this rule, and if the packet is an SCTP packet, +try to send an SCTP packet containing an ABORT chunk. +The search terminates. .El .Ss RULE BODY The body of a rule contains zero or more patterns (such as Modified: stable/11/sbin/ipfw/ipfw2.c ============================================================================== --- stable/11/sbin/ipfw/ipfw2.c Sat Apr 7 20:23:34 2018 (r332228) +++ stable/11/sbin/ipfw/ipfw2.c Sat Apr 7 20:27:11 2018 (r332229) @@ -244,6 +244,8 @@ static struct _s_x rule_eactions[] = { }; static struct _s_x rule_actions[] = { + { "abort6", TOK_ABORT6 }, + { "abort", TOK_ABORT }, { "accept", TOK_ACCEPT }, { "pass", TOK_ACCEPT }, { "allow", TOK_ACCEPT }, @@ -1507,6 +1509,8 @@ show_static_rule(struct cmdline_opts *co, struct forma case O_REJECT: if (cmd->arg1 == ICMP_REJECT_RST) bprintf(bp, "reset"); + else if (cmd->arg1 == ICMP_REJECT_ABORT) + bprintf(bp, "abort"); else if (cmd->arg1 == ICMP_UNREACH_HOST) bprintf(bp, "reject"); else @@ -1516,6 +1520,8 @@ show_static_rule(struct cmdline_opts *co, struct forma case O_UNREACH6: if (cmd->arg1 == ICMP6_UNREACH_RST) bprintf(bp, "reset6"); + else if (cmd->arg1 == ICMP6_UNREACH_ABORT) + bprintf(bp, "abort6"); else print_unreach6_code(bp, cmd->arg1); break; @@ -3753,6 +3759,16 @@ compile_rule(char *av[], uint32_t *rbuf, int *rbufsize break; } errx(EX_DATAERR, "Invalid state name %s", *av); + break; + + case TOK_ABORT: + action->opcode = O_REJECT; + action->arg1 = ICMP_REJECT_ABORT; + break; + + case TOK_ABORT6: + action->opcode = O_UNREACH6; + action->arg1 = ICMP6_UNREACH_ABORT; break; case TOK_ACCEPT: Modified: stable/11/sbin/ipfw/ipfw2.h ============================================================================== --- stable/11/sbin/ipfw/ipfw2.h Sat Apr 7 20:23:34 2018 (r332228) +++ stable/11/sbin/ipfw/ipfw2.h Sat Apr 7 20:27:11 2018 (r332229) @@ -81,6 +81,8 @@ enum tokens { TOK_STARTBRACE, TOK_ENDBRACE, + TOK_ABORT6, + TOK_ABORT, TOK_ACCEPT, TOK_COUNT, TOK_EACTION, Modified: stable/11/sys/conf/files ============================================================================== --- stable/11/sys/conf/files Sat Apr 7 20:23:34 2018 (r332228) +++ stable/11/sys/conf/files Sat Apr 7 20:27:11 2018 (r332229) @@ -4094,7 +4094,7 @@ netinet/sctp_asconf.c optional inet sctp | inet6 sctp netinet/sctp_auth.c optional inet sctp | inet6 sctp netinet/sctp_bsd_addr.c optional inet sctp | inet6 sctp netinet/sctp_cc_functions.c optional inet sctp | inet6 sctp -netinet/sctp_crc32.c optional inet sctp | inet6 sctp +netinet/sctp_crc32.c optional inet | inet6 netinet/sctp_indata.c optional inet sctp | inet6 sctp netinet/sctp_input.c optional inet sctp | inet6 sctp netinet/sctp_output.c optional inet sctp | inet6 sctp Modified: stable/11/sys/netinet/ip_fw.h ============================================================================== --- stable/11/sys/netinet/ip_fw.h Sat Apr 7 20:23:34 2018 (r332228) +++ stable/11/sys/netinet/ip_fw.h Sat Apr 7 20:27:11 2018 (r332229) @@ -728,6 +728,8 @@ struct _ipfw_dyn_rule { #define ICMP_REJECT_RST 0x100 /* fake ICMP code (send a TCP RST) */ #define ICMP6_UNREACH_RST 0x100 /* fake ICMPv6 code (send a TCP RST) */ +#define ICMP_REJECT_ABORT 0x101 /* fake ICMP code (send an SCTP ABORT) */ +#define ICMP6_UNREACH_ABORT 0x101 /* fake ICMPv6 code (send an SCTP ABORT) */ /* * These are used for lookup tables. Modified: stable/11/sys/netinet/sctp_crc32.c ============================================================================== --- stable/11/sys/netinet/sctp_crc32.c Sat Apr 7 20:23:34 2018 (r332228) +++ stable/11/sys/netinet/sctp_crc32.c Sat Apr 7 20:27:11 2018 (r332229) @@ -33,29 +33,36 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_sctp.h" + +#ifdef SCTP #include #include #include #include +#else +#include +#include +#include +#include +#endif - static uint32_t sctp_finalize_crc32c(uint32_t crc32c) { uint32_t result; - #if BYTE_ORDER == BIG_ENDIAN uint8_t byte0, byte1, byte2, byte3; - #endif + /* Complement the result */ result = ~crc32c; #if BYTE_ORDER == BIG_ENDIAN /* - * For BIG-ENDIAN.. aka Motorola byte order the result is in - * little-endian form. So we must manually swap the bytes. Then we - * can call htonl() which does nothing... + * For BIG-ENDIAN platforms the result is in little-endian form. So + * we must swap the bytes to return the result in network byte + * order. */ byte0 = result & 0x000000ff; byte1 = (result >> 8) & 0x000000ff; @@ -64,56 +71,54 @@ sctp_finalize_crc32c(uint32_t crc32c) crc32c = ((byte0 << 24) | (byte1 << 16) | (byte2 << 8) | byte3); #else /* - * For INTEL platforms the result comes out in network order. No - * htonl is required or the swap above. So we optimize out both the - * htonl and the manual swap above. + * For LITTLE ENDIAN platforms the result is in already in network + * byte order. */ crc32c = result; #endif return (crc32c); } +/* + * Compute the SCTP checksum in network byte order for a given mbuf chain m + * which contains an SCTP packet starting at offset. + * Since this function is also called by ipfw, don't assume that + * it is compiled on a kernel with SCTP support. + */ uint32_t sctp_calculate_cksum(struct mbuf *m, uint32_t offset) { - /* - * given a mbuf chain with a packetheader offset by 'offset' - * pointing at a sctphdr (with csum set to 0) go through the chain - * of SCTP_BUF_NEXT()'s and calculate the SCTP checksum. This also - * has a side bonus as it will calculate the total length of the - * mbuf chain. Note: if offset is greater than the total mbuf - * length, checksum=1, pktlen=0 is returned (ie. no real error code) - */ uint32_t base = 0xffffffff; - struct mbuf *at; - at = m; - /* find the correct mbuf and offset into mbuf */ - while ((at != NULL) && (offset > (uint32_t)SCTP_BUF_LEN(at))) { - offset -= SCTP_BUF_LEN(at); /* update remaining offset - * left */ - at = SCTP_BUF_NEXT(at); - } - while (at != NULL) { - if ((SCTP_BUF_LEN(at) - offset) > 0) { - base = calculate_crc32c(base, - (unsigned char *)(SCTP_BUF_AT(at, offset)), - (unsigned int)(SCTP_BUF_LEN(at) - offset)); + while (offset > 0) { + KASSERT(m != NULL, ("sctp_calculate_cksum, offset > length of mbuf chain")); + if (offset < (uint32_t)m->m_len) { + break; } - if (offset) { - /* we only offset once into the first mbuf */ - if (offset < (uint32_t)SCTP_BUF_LEN(at)) - offset = 0; - else - offset -= SCTP_BUF_LEN(at); - } - at = SCTP_BUF_NEXT(at); + offset -= m->m_len; + m = m->m_next; } + if (offset > 0) { + base = calculate_crc32c(base, + (unsigned char *)(m->m_data + offset), + (unsigned int)(m->m_len - offset)); + m = m->m_next; + } + while (m != NULL) { + base = calculate_crc32c(base, + (unsigned char *)m->m_data, + (unsigned int)m->m_len); + m = m->m_next; + } base = sctp_finalize_crc32c(base); return (base); } - +#ifdef SCTP +/* + * Compute and insert the SCTP checksum in network byte order for a given + * mbuf chain m which contains an SCTP packet starting at offset. + */ void sctp_delayed_cksum(struct mbuf *m, uint32_t offset) { @@ -125,14 +130,15 @@ sctp_delayed_cksum(struct mbuf *m, uint32_t offset) offset += offsetof(struct sctphdr, checksum); if (offset + sizeof(uint32_t) > (uint32_t)(m->m_len)) { - SCTP_PRINTF("sctp_delayed_cksum(): m->len: %d, off: %d.\n", - (uint32_t)m->m_len, offset); - /* - * XXX this shouldn't happen, but if it does, the correct - * behavior may be to insert the checksum in the appropriate - * next mbuf in the chain. - */ +#ifdef INVARIANTS + panic("sctp_delayed_cksum(): m->m_len: %d, offset: %u.", + m->m_len, offset); +#else + SCTP_PRINTF("sctp_delayed_cksum(): m->m_len: %d, offset: %u.\n", + m->m_len, offset); +#endif return; } *(uint32_t *)(m->m_data + offset) = checksum; } +#endif Modified: stable/11/sys/netinet/sctp_crc32.h ============================================================================== --- stable/11/sys/netinet/sctp_crc32.h Sat Apr 7 20:23:34 2018 (r332228) +++ stable/11/sys/netinet/sctp_crc32.h Sat Apr 7 20:27:11 2018 (r332229) @@ -38,6 +38,8 @@ __FBSDID("$FreeBSD$"); #if defined(_KERNEL) uint32_t sctp_calculate_cksum(struct mbuf *, uint32_t); +#ifdef SCTP void sctp_delayed_cksum(struct mbuf *, uint32_t offset); +#endif #endif /* _KERNEL */ #endif /* __crc32c_h__ */ Modified: stable/11/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- stable/11/sys/netpfil/ipfw/ip_fw2.c Sat Apr 7 20:23:34 2018 (r332228) +++ stable/11/sys/netpfil/ipfw/ip_fw2.c Sat Apr 7 20:27:11 2018 (r332229) @@ -80,6 +80,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include @@ -469,6 +471,113 @@ verify_path(struct in_addr src, struct ifnet *ifp, u_i } /* + * Generate an SCTP packet containing an ABORT chunk. The verification tag + * is given by vtag. The T-bit is set in the ABORT chunk if and only if + * reflected is not 0. + */ + +static struct mbuf * +ipfw_send_abort(struct mbuf *replyto, struct ipfw_flow_id *id, u_int32_t vtag, + int reflected) +{ + struct mbuf *m; + struct ip *ip; +#ifdef INET6 + struct ip6_hdr *ip6; +#endif + struct sctphdr *sctp; + struct sctp_chunkhdr *chunk; + u_int16_t hlen, plen, tlen; + + MGETHDR(m, M_NOWAIT, MT_DATA); + if (m == NULL) + return (NULL); + + M_SETFIB(m, id->fib); +#ifdef MAC + if (replyto != NULL) + mac_netinet_firewall_reply(replyto, m); + else + mac_netinet_firewall_send(m); +#else + (void)replyto; /* don't warn about unused arg */ +#endif + + switch (id->addr_type) { + case 4: + hlen = sizeof(struct ip); + break; +#ifdef INET6 + case 6: + hlen = sizeof(struct ip6_hdr); + break; +#endif + default: + /* XXX: log me?!? */ + FREE_PKT(m); + return (NULL); + } + plen = sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr); + tlen = hlen + plen; + m->m_data += max_linkhdr; + m->m_flags |= M_SKIP_FIREWALL; + m->m_pkthdr.len = m->m_len = tlen; + m->m_pkthdr.rcvif = NULL; + bzero(m->m_data, tlen); + + switch (id->addr_type) { + case 4: + ip = mtod(m, struct ip *); + + ip->ip_v = 4; + ip->ip_hl = sizeof(struct ip) >> 2; + ip->ip_tos = IPTOS_LOWDELAY; + ip->ip_len = htons(tlen); + ip->ip_id = htons(0); + ip->ip_off = htons(0); + ip->ip_ttl = V_ip_defttl; + ip->ip_p = IPPROTO_SCTP; + ip->ip_sum = 0; + ip->ip_src.s_addr = htonl(id->dst_ip); + ip->ip_dst.s_addr = htonl(id->src_ip); + + sctp = (struct sctphdr *)(ip + 1); + break; +#ifdef INET6 + case 6: + ip6 = mtod(m, struct ip6_hdr *); + + ip6->ip6_vfc = IPV6_VERSION; + ip6->ip6_plen = htons(plen); + ip6->ip6_nxt = IPPROTO_SCTP; + ip6->ip6_hlim = IPV6_DEFHLIM; + ip6->ip6_src = id->dst_ip6; + ip6->ip6_dst = id->src_ip6; + + sctp = (struct sctphdr *)(ip6 + 1); + break; +#endif + } + + sctp->src_port = htons(id->dst_port); + sctp->dest_port = htons(id->src_port); + sctp->v_tag = htonl(vtag); + sctp->checksum = htonl(0); + + chunk = (struct sctp_chunkhdr *)(sctp + 1); + chunk->chunk_type = SCTP_ABORT_ASSOCIATION; + chunk->chunk_flags = 0; + if (reflected != 0) { + chunk->chunk_flags |= SCTP_HAD_NO_TCB; + } + chunk->chunk_length = htons(sizeof(struct sctp_chunkhdr)); + + sctp->checksum = sctp_calculate_cksum(m, hlen); + + return (m); +} + +/* * Generate a TCP packet, containing either a RST or a keepalive. * When flags & TH_RST, we are sending a RST packet, because of a * "reset" action matched the packet. @@ -756,7 +865,71 @@ send_reject6(struct ip_fw_args *args, int code, u_int NULL); } FREE_PKT(m); - } else if (code != ICMP6_UNREACH_RST) { /* Send an ICMPv6 unreach. */ + } else if (code == ICMP6_UNREACH_ABORT && + args->f_id.proto == IPPROTO_SCTP) { + struct mbuf *m0; + struct sctphdr *sctp; + u_int32_t v_tag; + int reflected; + + sctp = (struct sctphdr *)((char *)ip6 + hlen); + reflected = 1; + v_tag = ntohl(sctp->v_tag); + /* Investigate the first chunk header if available */ + if (m->m_len >= hlen + sizeof(struct sctphdr) + + sizeof(struct sctp_chunkhdr)) { + struct sctp_chunkhdr *chunk; + + chunk = (struct sctp_chunkhdr *)(sctp + 1); + switch (chunk->chunk_type) { + case SCTP_INITIATION: + /* + * Packets containing an INIT chunk MUST have + * a zero v-tag. + */ + if (v_tag != 0) { + v_tag = 0; + break; + } + /* INIT chunk MUST NOT be bundled */ + if (m->m_pkthdr.len > + hlen + sizeof(struct sctphdr) + + ntohs(chunk->chunk_length) + 3) { + break; + } + /* Use the initiate tag if available */ + if ((m->m_len >= hlen + sizeof(struct sctphdr) + + sizeof(struct sctp_chunkhdr) + + offsetof(struct sctp_init, a_rwnd))) { + struct sctp_init *init; + + init = (struct sctp_init *)(chunk + 1); + v_tag = ntohl(init->initiate_tag); + reflected = 0; + } + break; + case SCTP_ABORT_ASSOCIATION: + /* + * If the packet contains an ABORT chunk, don't + * reply. + * XXX: We should search through all chunks, + * but don't do to avoid attacks. + */ + v_tag = 0; + break; + } + } + if (v_tag == 0) { + m0 = NULL; + } else { + m0 = ipfw_send_abort(args->m, &(args->f_id), v_tag, + reflected); + } + if (m0 != NULL) + ip6_output(m0, NULL, NULL, 0, NULL, NULL, NULL); + FREE_PKT(m); + } else if (code != ICMP6_UNREACH_RST && code != ICMP6_UNREACH_ABORT) { + /* Send an ICMPv6 unreach. */ #if 0 /* * Unlike above, the mbufs need to line up with the ip6 hdr, @@ -796,9 +969,10 @@ send_reject(struct ip_fw_args *args, int code, int ipl if (args->L3offset) m_adj(m, args->L3offset); #endif - if (code != ICMP_REJECT_RST) { /* Send an ICMP unreach */ + if (code != ICMP_REJECT_RST && code != ICMP_REJECT_ABORT) { + /* Send an ICMP unreach */ icmp_error(args->m, ICMP_UNREACH, code, 0L, 0); - } else if (args->f_id.proto == IPPROTO_TCP) { + } else if (code == ICMP_REJECT_RST && args->f_id.proto == IPPROTO_TCP) { struct tcphdr *const tcp = L3HDR(struct tcphdr, mtod(args->m, struct ip *)); if ( (tcp->th_flags & TH_RST) == 0) { @@ -810,6 +984,68 @@ send_reject(struct ip_fw_args *args, int code, int ipl ip_output(m, NULL, NULL, 0, NULL, NULL); } FREE_PKT(args->m); + } else if (code == ICMP_REJECT_ABORT && + args->f_id.proto == IPPROTO_SCTP) { + struct mbuf *m; + struct sctphdr *sctp; + struct sctp_chunkhdr *chunk; + struct sctp_init *init; + u_int32_t v_tag; + int reflected; + + sctp = L3HDR(struct sctphdr, mtod(args->m, struct ip *)); + reflected = 1; + v_tag = ntohl(sctp->v_tag); + if (iplen >= (ip->ip_hl << 2) + sizeof(struct sctphdr) + + sizeof(struct sctp_chunkhdr)) { + /* Look at the first chunk header if available */ + chunk = (struct sctp_chunkhdr *)(sctp + 1); + switch (chunk->chunk_type) { + case SCTP_INITIATION: + /* + * Packets containing an INIT chunk MUST have + * a zero v-tag. + */ + if (v_tag != 0) { + v_tag = 0; + break; + } + /* INIT chunk MUST NOT be bundled */ + if (iplen > + (ip->ip_hl << 2) + sizeof(struct sctphdr) + + ntohs(chunk->chunk_length) + 3) { + break; + } + /* Use the initiate tag if available */ + if ((iplen >= (ip->ip_hl << 2) + + sizeof(struct sctphdr) + + sizeof(struct sctp_chunkhdr) + + offsetof(struct sctp_init, a_rwnd))) { + init = (struct sctp_init *)(chunk + 1); + v_tag = ntohl(init->initiate_tag); + reflected = 0; + } + break; + case SCTP_ABORT_ASSOCIATION: + /* + * If the packet contains an ABORT chunk, don't + * reply. + * XXX: We should search through all chunks, + * but don't do to avoid attacks. + */ + v_tag = 0; + break; + } + } + if (v_tag == 0) { + m = NULL; + } else { + m = ipfw_send_abort(args->m, &(args->f_id), v_tag, + reflected); + } + if (m != NULL) + ip_output(m, NULL, NULL, 0, NULL, NULL); + FREE_PKT(args->m); } else FREE_PKT(args->m); args->m = NULL; @@ -1232,7 +1468,18 @@ do { \ break; case IPPROTO_SCTP: - PULLUP_TO(hlen, ulp, struct sctphdr); + if (pktlen >= hlen + sizeof(struct sctphdr) + + sizeof(struct sctp_chunkhdr) + + offsetof(struct sctp_init, a_rwnd)) + PULLUP_LEN(hlen, ulp, + sizeof(struct sctphdr) + + sizeof(struct sctp_chunkhdr) + + offsetof(struct sctp_init, a_rwnd)); + else if (pktlen >= hlen + sizeof(struct sctphdr)) + PULLUP_LEN(hlen, ulp, pktlen - hlen); + else + PULLUP_LEN(hlen, ulp, + sizeof(struct sctphdr)); src_port = SCTP(ulp)->src_port; dst_port = SCTP(ulp)->dest_port; break; @@ -1410,7 +1657,18 @@ do { \ break; case IPPROTO_SCTP: - PULLUP_TO(hlen, ulp, struct sctphdr); + if (pktlen >= hlen + sizeof(struct sctphdr) + + sizeof(struct sctp_chunkhdr) + + offsetof(struct sctp_init, a_rwnd)) + PULLUP_LEN(hlen, ulp, + sizeof(struct sctphdr) + + sizeof(struct sctp_chunkhdr) + + offsetof(struct sctp_init, a_rwnd)); + else if (pktlen >= hlen + sizeof(struct sctphdr)) + PULLUP_LEN(hlen, ulp, pktlen - hlen); + else + PULLUP_LEN(hlen, ulp, + sizeof(struct sctphdr)); src_port = SCTP(ulp)->src_port; dst_port = SCTP(ulp)->dest_port; break; Modified: stable/11/sys/netpfil/ipfw/ip_fw_log.c ============================================================================== --- stable/11/sys/netpfil/ipfw/ip_fw_log.c Sat Apr 7 20:23:34 2018 (r332228) +++ stable/11/sys/netpfil/ipfw/ip_fw_log.c Sat Apr 7 20:27:11 2018 (r332229) @@ -165,6 +165,8 @@ ipfw_log(struct ip_fw_chain *chain, struct ip_fw *f, u case O_REJECT: if (cmd->arg1==ICMP_REJECT_RST) action = "Reset"; + else if (cmd->arg1==ICMP_REJECT_ABORT) + action = "Abort"; else if (cmd->arg1==ICMP_UNREACH_HOST) action = "Reject"; else @@ -175,6 +177,8 @@ ipfw_log(struct ip_fw_chain *chain, struct ip_fw *f, u case O_UNREACH6: if (cmd->arg1==ICMP6_UNREACH_RST) action = "Reset"; + else if (cmd->arg1==ICMP6_UNREACH_ABORT) + action = "Abort"; else snprintf(SNPARGS(action2, 0), "Unreach %d", cmd->arg1); From owner-svn-src-stable-11@freebsd.org Sat Apr 7 20:34:04 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E18B5F83089; Sat, 7 Apr 2018 20:34:03 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8CA8F845D4; Sat, 7 Apr 2018 20:34:03 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 877C925B96; Sat, 7 Apr 2018 20:34:03 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37KY3m6093650; Sat, 7 Apr 2018 20:34:03 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37KY3Zn093649; Sat, 7 Apr 2018 20:34:03 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072034.w37KY3Zn093649@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 20:34:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332230 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 332230 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 20:34:04 -0000 Author: tuexen Date: Sat Apr 7 20:34:03 2018 New Revision: 332230 URL: https://svnweb.freebsd.org/changeset/base/332230 Log: MFC r327844: Ensure that the vnet is set when calling pru_sockaddr() and pru_peeraddr(). This is already true when called via kern_getsockname() and kern_getpeername(). This patch sets it also, when they arecalled via soo_fill_kinfo(). This is necessary, since the corresponding functions for SCTP require the vnet to be set. Without this, if a process having an wildcard bound SCTP socket is terminated and a core is written, the kernel panics. Modified: stable/11/sys/kern/sys_socket.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/sys_socket.c ============================================================================== --- stable/11/sys/kern/sys_socket.c Sat Apr 7 20:27:11 2018 (r332229) +++ stable/11/sys/kern/sys_socket.c Sat Apr 7 20:34:03 2018 (r332230) @@ -346,6 +346,7 @@ soo_fill_kinfo(struct file *fp, struct kinfo_file *kif kif->kf_type = KF_TYPE_SOCKET; so = fp->f_data; + CURVNET_SET(so->so_vnet); kif->kf_sock_domain = so->so_proto->pr_domain->dom_family; kif->kf_sock_type = so->so_type; kif->kf_sock_protocol = so->so_proto->pr_protocol; @@ -387,6 +388,7 @@ soo_fill_kinfo(struct file *fp, struct kinfo_file *kif } strncpy(kif->kf_path, so->so_proto->pr_domain->dom_name, sizeof(kif->kf_path)); + CURVNET_RESTORE(); return (0); } From owner-svn-src-stable-11@freebsd.org Sat Apr 7 20:37:44 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DA6BAF8340A; Sat, 7 Apr 2018 20:37:44 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8DD308680C; Sat, 7 Apr 2018 20:37:44 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7CD9125B99; Sat, 7 Apr 2018 20:37:44 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37KbiOI093876; Sat, 7 Apr 2018 20:37:44 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37Kbibe093875; Sat, 7 Apr 2018 20:37:44 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072037.w37Kbibe093875@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 20:37: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: r332232 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332232 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 20:37:45 -0000 Author: tuexen Date: Sat Apr 7 20:37:44 2018 New Revision: 332232 URL: https://svnweb.freebsd.org/changeset/base/332232 Log: MFC r328028: Don't provide a (meaningless) cmsg when proving a notification in a recvmsg() call. Modified: stable/11/sys/netinet/sctputil.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctputil.c ============================================================================== --- stable/11/sys/netinet/sctputil.c Sat Apr 7 20:34:57 2018 (r332231) +++ stable/11/sys/netinet/sctputil.c Sat Apr 7 20:37:44 2018 (r332232) @@ -45,7 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include /* for sctp_deliver_data() */ +#include #include #include #include @@ -6091,7 +6091,7 @@ sctp_m_free(struct mbuf *m) return (m_free(m)); } -void +void sctp_m_freem(struct mbuf *mb) { while (mb != NULL) @@ -6161,6 +6161,7 @@ sctp_soreceive(struct socket *so, struct sockaddr *from; struct sctp_extrcvinfo sinfo; int filling_sinfo = 1; + int flags; struct sctp_inpcb *inp; inp = (struct sctp_inpcb *)so->so_pcb; @@ -6188,15 +6189,24 @@ sctp_soreceive(struct socket *so, if (filling_sinfo) { memset(&sinfo, 0, sizeof(struct sctp_extrcvinfo)); } - error = sctp_sorecvmsg(so, uio, mp0, from, fromlen, flagsp, + if (flagsp != NULL) { + flags = *flagsp; + } else { + flags = 0; + } + error = sctp_sorecvmsg(so, uio, mp0, from, fromlen, &flags, (struct sctp_sndrcvinfo *)&sinfo, filling_sinfo); + if (flagsp != NULL) { + *flagsp = flags; + } if (controlp != NULL) { /* copy back the sinfo in a CMSG format */ - if (filling_sinfo) + if (filling_sinfo && ((flags & MSG_NOTIFICATION) == 0)) { *controlp = sctp_build_ctl_nchunk(inp, (struct sctp_sndrcvinfo *)&sinfo); - else + } else { *controlp = NULL; + } } if (psa) { /* copy back the address info */ From owner-svn-src-stable-11@freebsd.org Sat Apr 7 20:39:10 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7238AF83594; Sat, 7 Apr 2018 20:39:10 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1FDAB87545; Sat, 7 Apr 2018 20:39:10 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F3D7725B9B; Sat, 7 Apr 2018 20:39:09 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37Kd99T094021; Sat, 7 Apr 2018 20:39:09 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37Kd9pv094020; Sat, 7 Apr 2018 20:39:09 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072039.w37Kd9pv094020@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 20:39:09 +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: r332234 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332234 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 20:39:10 -0000 Author: tuexen Date: Sat Apr 7 20:39:09 2018 New Revision: 332234 URL: https://svnweb.freebsd.org/changeset/base/332234 Log: MFC r328066: Fix a bug related to fast retransmissions. When processing a SACK advancing the cumtsn-ack in fast recovery, increment the miss-indications for all TSN's reported as missing. Thanks to Fabian Ising for finding the bug and to Timo Voelker for provinding a fix. This fix moves also CMT related initialisation of some variables to a more appropriate place. Modified: stable/11/sys/netinet/sctp_indata.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_indata.c ============================================================================== --- stable/11/sys/netinet/sctp_indata.c Sat Apr 7 20:38:01 2018 (r332233) +++ stable/11/sys/netinet/sctp_indata.c Sat Apr 7 20:39:09 2018 (r332234) @@ -3362,7 +3362,8 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, stru } } } - if (SCTP_TSN_GT(tp1->rec.data.tsn, asoc->this_sack_highest_gap)) { + if (SCTP_TSN_GT(tp1->rec.data.tsn, asoc->this_sack_highest_gap) && + !(accum_moved && asoc->fast_retran_loss_recovery)) { /* we are beyond the tsn in the sack */ break; } @@ -3386,8 +3387,10 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, stru * FR using this SACK. */ continue; - } else if (tp1->whoTo && SCTP_TSN_GT(tp1->rec.data.tsn, - tp1->whoTo->this_sack_highest_newack)) { + } else if (tp1->whoTo && + SCTP_TSN_GT(tp1->rec.data.tsn, + tp1->whoTo->this_sack_highest_newack) && + !(accum_moved && asoc->fast_retran_loss_recovery)) { /* * CMT: New acks were receieved for data sent to * this dest. But no new acks were seen for data @@ -3672,7 +3675,7 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, stru tp1->whoTo->find_pseudo_cumack = 1; tp1->whoTo->find_rtx_pseudo_cumack = 1; } - } else {/* CMT is OFF */ + } else { /* CMT is OFF */ #ifdef SCTP_FR_TO_ALTERNATE /* Can we find an alternate? */ @@ -4601,6 +4604,13 @@ hopeless_peer: if (stcb->asoc.cc_functions.sctp_cwnd_prepare_net_for_sack) { (*stcb->asoc.cc_functions.sctp_cwnd_prepare_net_for_sack) (stcb, net); } + /* + * CMT: SFR algo (and HTNA) - this_sack_highest_newack has + * to be greater than the cumack. Also reset saw_newack to 0 + * for all dests. + */ + net->saw_newack = 0; + net->this_sack_highest_newack = last_tsn; } /* process the new consecutive TSN first */ TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) { @@ -4726,16 +4736,6 @@ hopeless_peer: asoc->this_sack_highest_gap = last_tsn; if ((num_seg > 0) || (num_nr_seg > 0)) { - - /* - * CMT: SFR algo (and HTNA) - this_sack_highest_newack has - * to be greater than the cumack. Also reset saw_newack to 0 - * for all dests. - */ - TAILQ_FOREACH(net, &asoc->nets, sctp_next) { - net->saw_newack = 0; - net->this_sack_highest_newack = last_tsn; - } /* * thisSackHighestGap will increase while handling NEW From owner-svn-src-stable-11@freebsd.org Sat Apr 7 20:40:41 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 123CFF83765; Sat, 7 Apr 2018 20:40:41 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AF3AA682E4; Sat, 7 Apr 2018 20:40:40 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8FEAB25BB4; Sat, 7 Apr 2018 20:40:40 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37KeecS094850; Sat, 7 Apr 2018 20:40:40 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37Keev6094849; Sat, 7 Apr 2018 20:40:40 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072040.w37Keev6094849@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 20:40: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: r332235 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332235 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 20:40:41 -0000 Author: tuexen Date: Sat Apr 7 20:40:40 2018 New Revision: 332235 URL: https://svnweb.freebsd.org/changeset/base/332235 Log: MFC r328477: Update references in comments, since the IDs have become an RFC long time ago. Also cleanup whitespaces. No functional change. Modified: stable/11/sys/netinet/sctp_constants.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_constants.h ============================================================================== --- stable/11/sys/netinet/sctp_constants.h Sat Apr 7 20:39:09 2018 (r332234) +++ stable/11/sys/netinet/sctp_constants.h Sat Apr 7 20:40:40 2018 (r332235) @@ -398,43 +398,32 @@ __FBSDID("$FreeBSD$"); #define SCTP_HOSTNAME_ADDRESS 0x000b #define SCTP_SUPPORTED_ADDRTYPE 0x000c -/* draft-ietf-stewart-tsvwg-strreset-xxx */ +/* RFC 6525 */ #define SCTP_STR_RESET_OUT_REQUEST 0x000d #define SCTP_STR_RESET_IN_REQUEST 0x000e #define SCTP_STR_RESET_TSN_REQUEST 0x000f #define SCTP_STR_RESET_RESPONSE 0x0010 #define SCTP_STR_RESET_ADD_OUT_STREAMS 0x0011 -#define SCTP_STR_RESET_ADD_IN_STREAMS 0x0012 +#define SCTP_STR_RESET_ADD_IN_STREAMS 0x0012 #define SCTP_MAX_RESET_PARAMS 2 -#define SCTP_STREAM_RESET_TSN_DELTA 0x1000 +#define SCTP_STREAM_RESET_TSN_DELTA 0x1000 /*************0x4000 series*************/ /*************0x8000 series*************/ #define SCTP_ECN_CAPABLE 0x8000 -/* draft-ietf-tsvwg-auth-xxx */ +/* RFC 4895 */ #define SCTP_RANDOM 0x8002 #define SCTP_CHUNK_LIST 0x8003 #define SCTP_HMAC_LIST 0x8004 -/* - * draft-ietf-tsvwg-addip-sctp-xx param=0x8008 len=0xNNNN Byte | Byte | Byte - * | Byte Byte | Byte ... - * - * Where each byte is a chunk type extension supported. For example, to support - * all chunks one would have (in hex): - * - * 80 01 00 09 C0 C1 80 81 82 00 00 00 - * - * Has the parameter. C0 = PR-SCTP (RFC3758) C1, 80 = ASCONF (addip draft) 81 - * = Packet Drop 82 = Stream Reset 83 = Authentication - */ -#define SCTP_SUPPORTED_CHUNK_EXT 0x8008 +/* RFC 5061 */ +#define SCTP_SUPPORTED_CHUNK_EXT 0x8008 /*************0xC000 series*************/ #define SCTP_PRSCTP_SUPPORTED 0xc000 -/* draft-ietf-tsvwg-addip-sctp */ +/* RFC 5061 */ #define SCTP_ADD_IP_ADDRESS 0xc001 #define SCTP_DEL_IP_ADDRESS 0xc002 #define SCTP_ERROR_CAUSE_IND 0xc003 @@ -442,8 +431,8 @@ __FBSDID("$FreeBSD$"); #define SCTP_SUCCESS_REPORT 0xc005 #define SCTP_ULP_ADAPTATION 0xc006 /* behave-nat-draft */ -#define SCTP_HAS_NAT_SUPPORT 0xc007 -#define SCTP_NAT_VTAGS 0xc008 +#define SCTP_HAS_NAT_SUPPORT 0xc007 +#define SCTP_NAT_VTAGS 0xc008 /* bits for TOS field */ #define SCTP_ECT0_BIT 0x02 @@ -622,7 +611,7 @@ __FBSDID("$FreeBSD$"); #define SCTP_RTO_INITIAL (3000) /* 3 sec in ms */ -#define SCTP_INP_KILL_TIMEOUT 20/* number of ms to retry kill of inpcb */ +#define SCTP_INP_KILL_TIMEOUT 20 /* number of ms to retry kill of inpcb */ #define SCTP_ASOC_KILL_TIMEOUT 10 /* number of ms to retry kill of inpcb */ #define SCTP_DEF_MAX_INIT 8 From owner-svn-src-stable-11@freebsd.org Sat Apr 7 20:42:07 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2C31FF83A5D; Sat, 7 Apr 2018 20:42:07 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C90F7690EB; Sat, 7 Apr 2018 20:42:06 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C22A325D15; Sat, 7 Apr 2018 20:42:06 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37Kg6GE097928; Sat, 7 Apr 2018 20:42:06 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37Kg66k097927; Sat, 7 Apr 2018 20:42:06 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072042.w37Kg66k097927@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 20:42: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: r332236 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332236 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 20:42:07 -0000 Author: tuexen Date: Sat Apr 7 20:42:06 2018 New Revision: 332236 URL: https://svnweb.freebsd.org/changeset/base/332236 Log: MFC r328478: Add constant for the PAD chunk as defined in RFC 4820. This will be used by traceroute and traceroute6 soon. Modified: stable/11/sys/netinet/sctp_constants.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_constants.h ============================================================================== --- stable/11/sys/netinet/sctp_constants.h Sat Apr 7 20:40:40 2018 (r332235) +++ stable/11/sys/netinet/sctp_constants.h Sat Apr 7 20:42:06 2018 (r332236) @@ -418,6 +418,8 @@ __FBSDID("$FreeBSD$"); #define SCTP_RANDOM 0x8002 #define SCTP_CHUNK_LIST 0x8003 #define SCTP_HMAC_LIST 0x8004 +/* RFC 4820 */ +#define SCTP_PAD 0x8005 /* RFC 5061 */ #define SCTP_SUPPORTED_CHUNK_EXT 0x8008 From owner-svn-src-stable-11@freebsd.org Sat Apr 7 20:44:31 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1404BF83CBC; Sat, 7 Apr 2018 20:44:31 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B52AB6A7B3; Sat, 7 Apr 2018 20:44:30 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AFFDB25D3D; Sat, 7 Apr 2018 20:44:30 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37KiUUR098775; Sat, 7 Apr 2018 20:44:30 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37KiUGm098772; Sat, 7 Apr 2018 20:44:30 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072044.w37KiUGm098772@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 20:44: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: r332237 - in stable/11: contrib/traceroute usr.sbin/traceroute6 X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in stable/11: contrib/traceroute usr.sbin/traceroute6 X-SVN-Commit-Revision: 332237 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 20:44:31 -0000 Author: tuexen Date: Sat Apr 7 20:44:30 2018 New Revision: 332237 URL: https://svnweb.freebsd.org/changeset/base/332237 Log: MFC r328488: When using SCTP for sending probe packets, use INIT chunks for payloads larger than or equal to 32 bytes. For smaller probe packets, keep using SHUTDOWN-ACK chunks, possibly bundled with a PAD chunk. Packets with INIT chunks more likely pass through firewalls. Therefore, use them when possible. Modified: stable/11/contrib/traceroute/traceroute.c stable/11/usr.sbin/traceroute6/traceroute6.8 stable/11/usr.sbin/traceroute6/traceroute6.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/traceroute/traceroute.c ============================================================================== --- stable/11/contrib/traceroute/traceroute.c Sat Apr 7 20:42:06 2018 (r332236) +++ stable/11/contrib/traceroute/traceroute.c Sat Apr 7 20:44:30 2018 (r332237) @@ -220,6 +220,7 @@ static const char rcsid[] = #include #include #include +#include #include #include #include @@ -1489,26 +1490,71 @@ sctp_prep(struct outdata *outdata) { struct sctphdr *const sctp = (struct sctphdr *) outp; struct sctp_chunkhdr *chk; + struct sctp_init_chunk *init; + struct sctp_paramhdr *param; sctp->src_port = htons(ident); sctp->dest_port = htons(port + (fixedPort ? 0 : outdata->seq)); - sctp->v_tag = (sctp->src_port << 16) | sctp->dest_port; + if (protlen >= (int)(sizeof(struct sctphdr) + + sizeof(struct sctp_init_chunk))) { + sctp->v_tag = 0; + } else { + sctp->v_tag = (sctp->src_port << 16) | sctp->dest_port; + } sctp->checksum = htonl(0); - if (protlen >= - (int)(sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr))) { - chk = (struct sctp_chunkhdr *)(sctp + 1); - chk->chunk_type = SCTP_SHUTDOWN_ACK; - chk->chunk_flags = 0; - chk->chunk_length = htons(4); + if (protlen >= (int)(sizeof(struct sctphdr) + + sizeof(struct sctp_init_chunk))) { + /* + * Send a packet containing an INIT chunk. This works + * better in case of firewalls on the path, but + * results in a probe packet containing at least + * 32 bytes of payload. For shorter payloads, use + * SHUTDOWN-ACK chunks. + */ + init = (struct sctp_init_chunk *)(sctp + 1); + init->ch.chunk_type = SCTP_INITIATION; + init->ch.chunk_flags = 0; + init->ch.chunk_length = htons((u_int16_t)(protlen - + sizeof(struct sctphdr))); + init->init.initiate_tag = (sctp->src_port << 16) | + sctp->dest_port; + init->init.a_rwnd = htonl(1500); + init->init.num_outbound_streams = htons(1); + init->init.num_inbound_streams = htons(1); + init->init.initial_tsn = htonl(0); + if (protlen >= (int)(sizeof(struct sctphdr) + + sizeof(struct sctp_init_chunk) + + sizeof(struct sctp_paramhdr))) { + param = (struct sctp_paramhdr *)(init + 1); + param->param_type = htons(SCTP_PAD); + param->param_length = + htons((u_int16_t)(protlen - + sizeof(struct sctphdr) - + sizeof(struct sctp_init_chunk))); + } + } else { + /* + * Send a packet containing a SHUTDOWN-ACK chunk, + * possibly followed by a PAD chunk. + */ + if (protlen >= + (int)(sizeof(struct sctphdr) + + sizeof(struct sctp_chunkhdr))) { + chk = (struct sctp_chunkhdr *)(sctp + 1); + chk->chunk_type = SCTP_SHUTDOWN_ACK; + chk->chunk_flags = 0; + chk->chunk_length = htons(4); + } + if (protlen >= + (int)(sizeof(struct sctphdr) + + 2 * sizeof(struct sctp_chunkhdr))) { + chk = chk + 1; + chk->chunk_type = SCTP_PAD_CHUNK; + chk->chunk_flags = 0; + chk->chunk_length = htons(protlen - + (sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr))); + } } - if (protlen >= - (int)(sizeof(struct sctphdr) + 2 * sizeof(struct sctp_chunkhdr))) { - chk = chk + 1; - chk->chunk_type = SCTP_PAD_CHUNK; - chk->chunk_flags = 0; - chk->chunk_length = htons(protlen - - (sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr))); - } if (doipcksum) { sctp->checksum = sctp_crc32c(sctp, protlen); } @@ -1519,10 +1565,20 @@ sctp_check(const u_char *data, int seq) { struct sctphdr *const sctp = (struct sctphdr *) data; - return (ntohs(sctp->src_port) == ident - && ntohs(sctp->dest_port) == port + (fixedPort ? 0 : seq) - && sctp->v_tag == - (u_int32_t)((sctp->src_port << 16) | sctp->dest_port)); + if (ntohs(sctp->src_port) != ident || + ntohs(sctp->dest_port) != port + (fixedPort ? 0 : seq)) + return (0); + if (protlen < (int)(sizeof(struct sctphdr) + + sizeof(struct sctp_init_chunk))) { + return (sctp->v_tag == + (u_int32_t)((sctp->src_port << 16) | sctp->dest_port)); + } else { + /* + * Don't verify the initiate_tag, since it is not available, + * most of the time. + */ + return (sctp->v_tag == 0); + } } void Modified: stable/11/usr.sbin/traceroute6/traceroute6.8 ============================================================================== --- stable/11/usr.sbin/traceroute6/traceroute6.8 Sat Apr 7 20:42:06 2018 (r332236) +++ stable/11/usr.sbin/traceroute6/traceroute6.8 Sat Apr 7 20:44:30 2018 (r332237) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 30, 2017 +.Dd January 27, 2018 .Dt TRACEROUTE6 8 .Os .\" @@ -140,6 +140,11 @@ that has no route through it specifies the source IPv6 address to be used. .It Fl S Use SCTP packets for the probes. +The size of probe packets must be a multiple of 4. +If +.Ar datalen +is up to 28, probe packets consist of a SHUTDOWN-ACK chunk possibly bundled +with a PAD chunk. For larger probe packets, an INIT chunk is used. .It Fl T Use TCP segments for the probes. .It Fl U Modified: stable/11/usr.sbin/traceroute6/traceroute6.c ============================================================================== --- stable/11/usr.sbin/traceroute6/traceroute6.c Sat Apr 7 20:42:06 2018 (r332236) +++ stable/11/usr.sbin/traceroute6/traceroute6.c Sat Apr 7 20:44:30 2018 (r332237) @@ -272,6 +272,7 @@ static const char rcsid[] = #include #include #include +#include #include #include @@ -676,6 +677,11 @@ main(int argc, char *argv[]) } if (useproto == IPPROTO_UDP) datalen -= sizeof(struct udphdr); + if ((useproto == IPPROTO_SCTP) && (datalen & 3)) { + fprintf(stderr, + "traceroute6: packet size must be a multiple of 4.\n"); + exit(1); + } outpacket = malloc(datalen); if (!outpacket) { perror("malloc"); @@ -1049,6 +1055,8 @@ send_probe(int seq, u_long hops) struct icmp6_hdr *icp; struct sctphdr *sctp; struct sctp_chunkhdr *chk; + struct sctp_init_chunk *init; + struct sctp_paramhdr *param; struct tcphdr *tcp; int i; @@ -1080,23 +1088,64 @@ send_probe(int seq, u_long hops) sctp->src_port = htons(ident); sctp->dest_port = htons(port + seq); - sctp->v_tag = (sctp->src_port << 16) | sctp->dest_port; - sctp->checksum = htonl(0); if (datalen >= (u_long)(sizeof(struct sctphdr) + - sizeof(struct sctp_chunkhdr))) { - chk = (struct sctp_chunkhdr *)(sctp + 1); - chk->chunk_type = SCTP_SHUTDOWN_ACK; - chk->chunk_flags = 0; - chk->chunk_length = htons(4); + sizeof(struct sctp_init_chunk))) { + sctp->v_tag = 0; + } else { + sctp->v_tag = (sctp->src_port << 16) | sctp->dest_port; } + sctp->checksum = htonl(0); if (datalen >= (u_long)(sizeof(struct sctphdr) + - 2 * sizeof(struct sctp_chunkhdr))) { - chk = chk + 1; - chk->chunk_type = SCTP_PAD_CHUNK; - chk->chunk_flags = 0; - chk->chunk_length = htons((u_int16_t)(datalen - - sizeof(struct sctphdr) - - sizeof(struct sctp_chunkhdr))); + sizeof(struct sctp_init_chunk))) { + /* + * Send a packet containing an INIT chunk. This works + * better in case of firewalls on the path, but + * results in a probe packet containing at least + * 32 bytes of payload. For shorter payloads, use + * SHUTDOWN-ACK chunks. + */ + init = (struct sctp_init_chunk *)(sctp + 1); + init->ch.chunk_type = SCTP_INITIATION; + init->ch.chunk_flags = 0; + init->ch.chunk_length = htons((u_int16_t)(datalen - + sizeof(struct sctphdr))); + init->init.initiate_tag = (sctp->src_port << 16) | + sctp->dest_port; + init->init.a_rwnd = htonl(1500); + init->init.num_outbound_streams = htons(1); + init->init.num_inbound_streams = htons(1); + init->init.initial_tsn = htonl(0); + if (datalen >= (u_long)(sizeof(struct sctphdr) + + sizeof(struct sctp_init_chunk) + + sizeof(struct sctp_paramhdr))) { + param = (struct sctp_paramhdr *)(init + 1); + param->param_type = htons(SCTP_PAD); + param->param_length = + htons((u_int16_t)(datalen - + sizeof(struct sctphdr) - + sizeof(struct sctp_init_chunk))); + } + } else { + /* + * Send a packet containing a SHUTDOWN-ACK chunk, + * possibly followed by a PAD chunk. + */ + if (datalen >= (u_long)(sizeof(struct sctphdr) + + sizeof(struct sctp_chunkhdr))) { + chk = (struct sctp_chunkhdr *)(sctp + 1); + chk->chunk_type = SCTP_SHUTDOWN_ACK; + chk->chunk_flags = 0; + chk->chunk_length = htons(4); + } + if (datalen >= (u_long)(sizeof(struct sctphdr) + + 2 * sizeof(struct sctp_chunkhdr))) { + chk = chk + 1; + chk->chunk_type = SCTP_PAD_CHUNK; + chk->chunk_flags = 0; + chk->chunk_length = htons((u_int16_t)(datalen - + sizeof(struct sctphdr) - + sizeof(struct sctp_chunkhdr))); + } } sctp->checksum = sctp_crc32c(outpacket, datalen); break; @@ -1289,6 +1338,7 @@ packet_ok(struct msghdr *mhdr, int cc, int seq) || type == ICMP6_DST_UNREACH) { struct ip6_hdr *hip; struct icmp6_hdr *icmp; + struct sctp_init_chunk *init; struct sctphdr *sctp; struct tcphdr *tcp; struct udphdr *udp; @@ -1317,12 +1367,34 @@ packet_ok(struct msghdr *mhdr, int cc, int seq) break; case IPPROTO_SCTP: sctp = (struct sctphdr *)up; - if (sctp->src_port == htons(ident) && - sctp->dest_port == htons(port + seq) && - sctp->v_tag == - (u_int32_t)((sctp->src_port << 16) | sctp->dest_port)) - return (type == ICMP6_TIME_EXCEEDED ? - -1 : code + 1); + if (sctp->src_port != htons(ident) || + sctp->dest_port != htons(port + seq)) { + break; + } + if (datalen >= (u_long)(sizeof(struct sctphdr) + + sizeof(struct sctp_init_chunk))) { + if (sctp->v_tag != 0) { + break; + } + init = (struct sctp_init_chunk *)(sctp + 1); + /* Check the initiate tag, if available. */ + if ((char *)&init->init.a_rwnd > buf + cc) { + return (type == ICMP6_TIME_EXCEEDED ? + -1 : code + 1); + } + if (init->init.initiate_tag == (u_int32_t) + ((sctp->src_port << 16) | sctp->dest_port)) { + return (type == ICMP6_TIME_EXCEEDED ? + -1 : code + 1); + } + } else { + if (sctp->v_tag == + (u_int32_t)((sctp->src_port << 16) | + sctp->dest_port)) { + return (type == ICMP6_TIME_EXCEEDED ? + -1 : code + 1); + } + } break; case IPPROTO_TCP: tcp = (struct tcphdr *)up; From owner-svn-src-stable-11@freebsd.org Sat Apr 7 20:47:26 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54D5CF83FDF; Sat, 7 Apr 2018 20:47:26 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 07A2A6C0AC; Sat, 7 Apr 2018 20:47:26 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F3F7425D40; Sat, 7 Apr 2018 20:47:25 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37KlP71098944; Sat, 7 Apr 2018 20:47:25 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37KlPBl098943; Sat, 7 Apr 2018 20:47:25 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072047.w37KlPBl098943@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 20:47:25 +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: r332238 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 332238 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 20:47:26 -0000 Author: tuexen Date: Sat Apr 7 20:47:25 2018 New Revision: 332238 URL: https://svnweb.freebsd.org/changeset/base/332238 Log: MFC r331061: Set the inp_vflag consistently for accepted TCP/IPv6 connections when net.inet6.ip6.v6only=0. Without this patch, the inp_vflag would have INP_IPV4 and the INP_IPV6 flags for accepted TCP/IPv6 connections if the sysctl variable net.inet6.ip6.v6only is 0. This resulted in netstat to report the source and destination addresses as IPv4 addresses, even they are IPv6 addresses. PR: 226421 Reviewed by: bz, hiren, kib Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D13514 Modified: stable/11/sys/netinet/tcp_syncache.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/tcp_syncache.c ============================================================================== --- stable/11/sys/netinet/tcp_syncache.c Sat Apr 7 20:44:30 2018 (r332237) +++ stable/11/sys/netinet/tcp_syncache.c Sat Apr 7 20:47:25 2018 (r332238) @@ -687,6 +687,8 @@ syncache_socket(struct syncache *sc, struct socket *ls inp->inp_inc.inc_flags = sc->sc_inc.inc_flags; #ifdef INET6 if (sc->sc_inc.inc_flags & INC_ISIPV6) { + inp->inp_vflag &= ~INP_IPV4; + inp->inp_vflag |= INP_IPV6; inp->in6p_laddr = sc->sc_inc.inc6_laddr; } else { inp->inp_vflag &= ~INP_IPV6; From owner-svn-src-stable-11@freebsd.org Sat Apr 7 20:52:06 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A029F845B8; Sat, 7 Apr 2018 20:52:06 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F28BF6EABA; Sat, 7 Apr 2018 20:52:05 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EB53225EB3; Sat, 7 Apr 2018 20:52:05 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37Kq5x9003685; Sat, 7 Apr 2018 20:52:05 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37Kq57f003683; Sat, 7 Apr 2018 20:52:05 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072052.w37Kq57f003683@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 20:52:05 +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: r332239 - stable/11/usr.bin/truss X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/usr.bin/truss X-SVN-Commit-Revision: 332239 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 20:52:06 -0000 Author: tuexen Date: Sat Apr 7 20:52:05 2018 New Revision: 332239 URL: https://svnweb.freebsd.org/changeset/base/332239 Log: MFC r327919: Add support for readv() and writev() to truss. Sponsored by:i Netflix, Inc. Modified: stable/11/usr.bin/truss/syscall.h stable/11/usr.bin/truss/syscalls.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/truss/syscall.h ============================================================================== --- stable/11/usr.bin/truss/syscall.h Sat Apr 7 20:47:25 2018 (r332238) +++ stable/11/usr.bin/truss/syscall.h Sat Apr 7 20:52:05 2018 (r332239) @@ -81,7 +81,7 @@ enum Argtype { None = 1, Hex, Octal, Int, UInt, LongHe Sockoptname, Msgflags, CapRights, PUInt, PQuadHex, Acltype, Extattrnamespace, Minherit, Mlockall, Mountflags, Msync, Priowhich, Ptraceop, Quotactlcmd, Reboothowto, Rtpriofunc, Schedpolicy, Schedparam, - PSig, Siginfo, Kevent11, + PSig, Siginfo, Kevent11, Iovec, CloudABIAdvice, CloudABIClockID, ClouduABIFDSFlags, CloudABIFDStat, CloudABIFileStat, CloudABIFileType, Modified: stable/11/usr.bin/truss/syscalls.c ============================================================================== --- stable/11/usr.bin/truss/syscalls.c Sat Apr 7 20:47:25 2018 (r332238) +++ stable/11/usr.bin/truss/syscalls.c Sat Apr 7 20:52:05 2018 (r332239) @@ -370,6 +370,8 @@ static struct syscall decoded_syscalls[] = { .args = { { Name, 0 }, { Quotactlcmd, 1 }, { Int, 2 }, { Ptr, 3 } } }, { .name = "read", .ret_type = 1, .nargs = 3, .args = { { Int, 0 }, { BinString | OUT, 1 }, { Sizet, 2 } } }, + { .name = "readv", .ret_type = 1, .nargs = 3, + .args = { { Int, 0 }, { Iovec, 1 }, { Int, 2 } } }, { .name = "readlink", .ret_type = 1, .nargs = 3, .args = { { Name, 0 }, { Readlinkres | OUT, 1 }, { Sizet, 2 } } }, { .name = "readlinkat", .ret_type = 1, .nargs = 4, @@ -504,6 +506,8 @@ static struct syscall decoded_syscalls[] = { { Siginfo | OUT, 5 } } }, { .name = "write", .ret_type = 1, .nargs = 3, .args = { { Int, 0 }, { BinString | IN, 1 }, { Sizet, 2 } } }, + { .name = "writev", .ret_type = 1, .nargs = 3, + .args = { { Int, 0 }, { Iovec, 1 }, { Int, 2 } } }, /* Linux ABI */ { .name = "linux_access", .ret_type = 1, .nargs = 2, @@ -2062,6 +2066,68 @@ print_arg(struct syscall_args *sc, unsigned long *args fprintf(fp, " }"); } else fprintf(fp, "0x%lx", args[sc->offset]); + break; + } +#define IOV_LIMIT 26 + case Iovec: { + /* + * Print argument as an array of struct iovec, where the next + * syscall argument is the number of elements of the array. + */ + struct iovec iov[IOV_LIMIT]; + size_t max_string = trussinfo->strsize; + char tmp2[max_string + 1], *tmp3; + size_t len; + int i, iovcnt; + bool buf_truncated, iov_truncated; + + iovcnt = args[sc->offset + 1]; + if (iovcnt <= 0) { + fprintf(fp, "0x%lx", args[sc->offset]); + break; + } + if (iovcnt > IOV_LIMIT) { + iovcnt = IOV_LIMIT; + iov_truncated = true; + } else { + iov_truncated = false; + } + if (get_struct(pid, (void *)args[sc->offset], + &iov, iovcnt * sizeof(struct iovec)) == -1) { + fprintf(fp, "0x%lx", args[sc->offset]); + break; + } + + fprintf(fp, "%s", "["); + for (i = 0; i < iovcnt; i++) { + len = iov[i].iov_len; + if (len > max_string) { + len = max_string; + buf_truncated = true; + } else { + buf_truncated = false; + } + fprintf(fp, "%s{", (i > 0) ? "," : ""); + if (len && get_struct(pid, iov[i].iov_base, &tmp2, len) + != -1) { + tmp3 = malloc(len * 4 + 1); + while (len) { + if (strvisx(tmp3, tmp2, len, + VIS_CSTYLE|VIS_TAB|VIS_NL) <= + (int)max_string) + break; + len--; + buf_truncated = true; + } + fprintf(fp, "\"%s\"%s", tmp3, + buf_truncated ? "..." : ""); + free(tmp3); + } else { + fprintf(fp, "0x%p", iov[i].iov_base); + } + fprintf(fp, ",%zu}", iov[i].iov_len); + } + fprintf(fp, "%s%s", iov_truncated ? ",..." : "", "]"); break; } From owner-svn-src-stable-11@freebsd.org Sat Apr 7 20:54:38 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 310FCF848A2; Sat, 7 Apr 2018 20:54:38 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D18E170198; Sat, 7 Apr 2018 20:54:37 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CB65925ED4; Sat, 7 Apr 2018 20:54:37 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37KsbOD003867; Sat, 7 Apr 2018 20:54:37 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37Ksbmg003866; Sat, 7 Apr 2018 20:54:37 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072054.w37Ksbmg003866@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 20:54: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: r332241 - stable/11/usr.bin/truss X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/usr.bin/truss X-SVN-Commit-Revision: 332241 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 20:54:38 -0000 Author: tuexen Date: Sat Apr 7 20:54:37 2018 New Revision: 332241 URL: https://svnweb.freebsd.org/changeset/base/332241 Log: MFC r327921: Fix a typo introduced in r327919. Modified: stable/11/usr.bin/truss/syscalls.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/truss/syscalls.c ============================================================================== --- stable/11/usr.bin/truss/syscalls.c Sat Apr 7 20:53:34 2018 (r332240) +++ stable/11/usr.bin/truss/syscalls.c Sat Apr 7 20:54:37 2018 (r332241) @@ -2068,7 +2068,7 @@ print_arg(struct syscall_args *sc, unsigned long *args fprintf(fp, "0x%lx", args[sc->offset]); break; } -#define IOV_LIMIT 26 +#define IOV_LIMIT 16 case Iovec: { /* * Print argument as an array of struct iovec, where the next From owner-svn-src-stable-11@freebsd.org Sat Apr 7 20:56:08 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 64D9BF84ABC; Sat, 7 Apr 2018 20:56:08 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1660F70EF6; Sat, 7 Apr 2018 20:56:08 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0E4FE25ED6; Sat, 7 Apr 2018 20:56:08 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37Ku7mL003997; Sat, 7 Apr 2018 20:56:07 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37Ku74o003996; Sat, 7 Apr 2018 20:56:07 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072056.w37Ku74o003996@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 20:56: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: r332242 - stable/11/usr.bin/truss X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/usr.bin/truss X-SVN-Commit-Revision: 332242 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 20:56:08 -0000 Author: tuexen Date: Sat Apr 7 20:56:07 2018 New Revision: 332242 URL: https://svnweb.freebsd.org/changeset/base/332242 Log: MFC r327961: Mark the iovec parameters of writev() and readv() as IN and OUT. This makes truss work on readv() as expected. Modified: stable/11/usr.bin/truss/syscalls.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/truss/syscalls.c ============================================================================== --- stable/11/usr.bin/truss/syscalls.c Sat Apr 7 20:54:37 2018 (r332241) +++ stable/11/usr.bin/truss/syscalls.c Sat Apr 7 20:56:07 2018 (r332242) @@ -371,7 +371,7 @@ static struct syscall decoded_syscalls[] = { { .name = "read", .ret_type = 1, .nargs = 3, .args = { { Int, 0 }, { BinString | OUT, 1 }, { Sizet, 2 } } }, { .name = "readv", .ret_type = 1, .nargs = 3, - .args = { { Int, 0 }, { Iovec, 1 }, { Int, 2 } } }, + .args = { { Int, 0 }, { Iovec | OUT, 1 }, { Int, 2 } } }, { .name = "readlink", .ret_type = 1, .nargs = 3, .args = { { Name, 0 }, { Readlinkres | OUT, 1 }, { Sizet, 2 } } }, { .name = "readlinkat", .ret_type = 1, .nargs = 4, @@ -507,7 +507,7 @@ static struct syscall decoded_syscalls[] = { { .name = "write", .ret_type = 1, .nargs = 3, .args = { { Int, 0 }, { BinString | IN, 1 }, { Sizet, 2 } } }, { .name = "writev", .ret_type = 1, .nargs = 3, - .args = { { Int, 0 }, { Iovec, 1 }, { Int, 2 } } }, + .args = { { Int, 0 }, { Iovec | IN, 1 }, { Int, 2 } } }, /* Linux ABI */ { .name = "linux_access", .ret_type = 1, .nargs = 2, From owner-svn-src-stable-11@freebsd.org Sat Apr 7 20:57:29 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E8DB0F84C1C; Sat, 7 Apr 2018 20:57:28 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5056971AEE; Sat, 7 Apr 2018 20:57:28 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4B69525ED7; Sat, 7 Apr 2018 20:57:28 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37KvSc4004098; Sat, 7 Apr 2018 20:57:28 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37KvR0P004093; Sat, 7 Apr 2018 20:57:27 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072057.w37KvR0P004093@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 20:57: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: r332243 - stable/11/lib/libsysdecode X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/lib/libsysdecode X-SVN-Commit-Revision: 332243 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 20:57:29 -0000 Author: tuexen Date: Sat Apr 7 20:57:27 2018 New Revision: 332243 URL: https://svnweb.freebsd.org/changeset/base/332243 Log: MFC r327962: Add support for the supported PR-SCTP policies. Modified: stable/11/lib/libsysdecode/Makefile stable/11/lib/libsysdecode/flags.c stable/11/lib/libsysdecode/mktables stable/11/lib/libsysdecode/sysdecode.h stable/11/lib/libsysdecode/sysdecode_enum.3 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libsysdecode/Makefile ============================================================================== --- stable/11/lib/libsysdecode/Makefile Sat Apr 7 20:56:07 2018 (r332242) +++ stable/11/lib/libsysdecode/Makefile Sat Apr 7 20:57:27 2018 (r332243) @@ -50,6 +50,7 @@ MLINKS+=sysdecode_enum.3 sysdecode_acltype.3 \ sysdecode_enum.3 sysdecode_rlimit.3 \ sysdecode_enum.3 sysdecode_rtprio_function.3 \ sysdecode_enum.3 sysdecode_scheduler_policy.3 \ + sysdecode_enum.3 sysdecode_sctp_pr_policy.3 \ sysdecode_enum.3 sysdecode_semctl_cmd.3 \ sysdecode_enum.3 sysdecode_shmctl_cmd.3 \ sysdecode_enum.3 sysdecode_shutdown_how.3 \ Modified: stable/11/lib/libsysdecode/flags.c ============================================================================== --- stable/11/lib/libsysdecode/flags.c Sat Apr 7 20:56:07 2018 (r332242) +++ stable/11/lib/libsysdecode/flags.c Sat Apr 7 20:57:27 2018 (r332243) @@ -1156,3 +1156,10 @@ sysdecode_cap_rights(FILE *fp, cap_rights_t *rightsp) } } } + +const char * +sysdecode_sctp_pr_policy(int policy) +{ + + return (lookup_value(sctpprpolicy, policy)); +} Modified: stable/11/lib/libsysdecode/mktables ============================================================================== --- stable/11/lib/libsysdecode/mktables Sat Apr 7 20:56:07 2018 (r332242) +++ stable/11/lib/libsysdecode/mktables Sat Apr 7 20:57:27 2018 (r332243) @@ -157,6 +157,7 @@ gen_table "sigcode" "SI_[A-Z]+[[:space:]]+0(x[ gen_table "umtxcvwaitflags" "CVWAIT_[A-Z_]+[[:space:]]+0x[0-9]+" "sys/umtx.h" gen_table "umtxrwlockflags" "URWLOCK_PREFER_READER[[:space:]]+0x[0-9]+" "sys/umtx.h" gen_table "caprights" "CAP_[A-Z_]+[[:space:]]+CAPRIGHT\([0-9],[[:space:]]+0x[0-9]{16}ULL\)" "sys/capsicum.h" +gen_table "sctpprpolicy" "SCTP_PR_SCTP_[A-Z_]+" "netinet/sctp_uio.h" "SCTP_PR_SCTP_BUF|SCTP_PR_SCTP_MAX|SCTP_PR_SCTP_ALL" if [ -e "${include_dir}/x86/sysarch.h" ]; then gen_table "sysarchnum" "(AMD64|I386)_[A-Z86_]+[[:space:]]+[0-9]+" "x86/sysarch.h" else Modified: stable/11/lib/libsysdecode/sysdecode.h ============================================================================== --- stable/11/lib/libsysdecode/sysdecode.h Sat Apr 7 20:56:07 2018 (r332242) +++ stable/11/lib/libsysdecode/sysdecode.h Sat Apr 7 20:57:27 2018 (r332243) @@ -89,6 +89,7 @@ bool sysdecode_rfork_flags(FILE *_fp, int _flags, int const char *sysdecode_rlimit(int _resource); const char *sysdecode_rtprio_function(int _function); const char *sysdecode_scheduler_policy(int _policy); +const char *sysdecode_sctp_pr_policy(int _policy); const char *sysdecode_semctl_cmd(int _cmd); bool sysdecode_semget_flags(FILE *_fp, int _flag, int *_rem); bool sysdecode_sendfile_flags(FILE *_fp, int _flags, int *_rem); Modified: stable/11/lib/libsysdecode/sysdecode_enum.3 ============================================================================== --- stable/11/lib/libsysdecode/sysdecode_enum.3 Sat Apr 7 20:56:07 2018 (r332242) +++ stable/11/lib/libsysdecode/sysdecode_enum.3 Sat Apr 7 20:57:27 2018 (r332243) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 3, 2017 +.Dd January 14, 2018 .Dt sysdecode_enum 3 .Os .Sh NAME @@ -53,6 +53,7 @@ .Nm sysdecode_rlimit , .Nm sysdecode_rtprio_function , .Nm sysdecode_scheduler_policy , +.Nm sysdecode_sctp_pr_policy , .Nm sysdecode_semctl_cmd , .Nm sysdecode_shmctl_cmd , .Nm sysdecode_shutdown_how , @@ -126,6 +127,8 @@ .Ft const char * .Fn sysdecode_scheduler_policy "int policy" .Ft const char * +.Fn sysdecode_sctp_pr_policy "int policy" +.Ft const char * .Fn sysdecode_semctl_cmd "int cmd" .Ft const char * .Fn sysdecode_shmctl_cmd "int cmd" @@ -229,6 +232,8 @@ Other functions decode the values described below: .Bl -tag -width "Fn sysdecode_sockaddr_family" .It Fn sysdecode_ipproto An IP protocol. +.It Fn sysdecode_sctp_pr_policy +A PR-SCTP policy. .It Fn sysdecode_signal A process signal. .It Fn sysdecode_sockaddr_family From owner-svn-src-stable-11@freebsd.org Sat Apr 7 21:00:23 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BB4C5F84F7D; Sat, 7 Apr 2018 21:00:22 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 69626733BD; Sat, 7 Apr 2018 21:00:22 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5E9E325EDB; Sat, 7 Apr 2018 21:00:22 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37L0MmO004299; Sat, 7 Apr 2018 21:00:22 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37L0LfE004293; Sat, 7 Apr 2018 21:00:21 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072100.w37L0LfE004293@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 21:00:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332244 - stable/11/lib/libsysdecode X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/lib/libsysdecode X-SVN-Commit-Revision: 332244 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 21:00:23 -0000 Author: tuexen Date: Sat Apr 7 21:00:21 2018 New Revision: 332244 URL: https://svnweb.freebsd.org/changeset/base/332244 Log: MFC r327966: Add a function is decode the sinfo_flags of struct sctp_sndrcvinfo. Added: stable/11/lib/libsysdecode/sysdecode_sctp_sinfo_flags.3 - copied unchanged from r327966, head/lib/libsysdecode/sysdecode_sctp_sinfo_flags.3 Modified: stable/11/lib/libsysdecode/Makefile stable/11/lib/libsysdecode/flags.c stable/11/lib/libsysdecode/sysdecode.3 stable/11/lib/libsysdecode/sysdecode.h stable/11/lib/libsysdecode/sysdecode_enum.3 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libsysdecode/Makefile ============================================================================== --- stable/11/lib/libsysdecode/Makefile Sat Apr 7 20:57:27 2018 (r332243) +++ stable/11/lib/libsysdecode/Makefile Sat Apr 7 21:00:21 2018 (r332244) @@ -21,6 +21,7 @@ MAN= sysdecode.3 \ sysdecode_ioctlname.3 \ sysdecode_mask.3 \ sysdecode_quotactl_cmd.3 \ + sysdecode_sctp_sinfo_flags.3 \ sysdecode_sigcode.3 \ sysdecode_sockopt_name.3 \ sysdecode_socket_protocol.3 \ Modified: stable/11/lib/libsysdecode/flags.c ============================================================================== --- stable/11/lib/libsysdecode/flags.c Sat Apr 7 20:57:27 2018 (r332243) +++ stable/11/lib/libsysdecode/flags.c Sat Apr 7 21:00:21 2018 (r332244) @@ -1163,3 +1163,31 @@ sysdecode_sctp_pr_policy(int policy) return (lookup_value(sctpprpolicy, policy)); } + +static struct name_table sctpsinfoflags[] = { + X(SCTP_EOF) X(SCTP_ABORT) X(SCTP_UNORDERED) X(SCTP_ADDR_OVER) + X(SCTP_SENDALL) X(SCTP_EOR) X(SCTP_SACK_IMMEDIATELY) XEND +}; + +void +sysdecode_sctp_sinfo_flags(FILE *fp, int sinfo_flags) +{ + const char *temp; + int rem; + bool printed; + + printed = print_mask_0(fp, sctpsinfoflags, sinfo_flags, &rem); + if (rem & ~SCTP_PR_SCTP_ALL) { + fprintf(fp, "%s%#x", printed ? "|" : "", rem & ~SCTP_PR_SCTP_ALL); + printed = true; + rem &= ~SCTP_PR_SCTP_ALL; + } + if (rem != 0) { + temp = sysdecode_sctp_pr_policy(rem); + if (temp != NULL) { + fprintf(fp, "%s%s", printed ? "|" : "", temp); + } else { + fprintf(fp, "%s%#x", printed ? "|" : "", rem); + } + } +} Modified: stable/11/lib/libsysdecode/sysdecode.3 ============================================================================== --- stable/11/lib/libsysdecode/sysdecode.3 Sat Apr 7 20:57:27 2018 (r332243) +++ stable/11/lib/libsysdecode/sysdecode.3 Sat Apr 7 21:00:21 2018 (r332244) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 24, 2017 +.Dd January 14, 2018 .Dt SYSDECODE 3 .Os .Sh NAME @@ -76,6 +76,7 @@ A placeholder for use when the ABI is not known. .Xr sysdecode_kevent 3 , .Xr sysdecode_mask 3 , .Xr sysdecode_quotactl_cmd 3 , +.Xr sysdecode_sctp_sinfo_flags 3 , .Xr sysdecode_sigcode 3 , .Xr sysdecode_socket_protocol 3 , .Xr sysdecode_sockopt_name 3 , Modified: stable/11/lib/libsysdecode/sysdecode.h ============================================================================== --- stable/11/lib/libsysdecode/sysdecode.h Sat Apr 7 20:57:27 2018 (r332243) +++ stable/11/lib/libsysdecode/sysdecode.h Sat Apr 7 21:00:21 2018 (r332244) @@ -90,6 +90,7 @@ const char *sysdecode_rlimit(int _resource); const char *sysdecode_rtprio_function(int _function); const char *sysdecode_scheduler_policy(int _policy); const char *sysdecode_sctp_pr_policy(int _policy); +void sysdecode_sctp_sinfo_flags(FILE *_fp, int _sinfo_flags); const char *sysdecode_semctl_cmd(int _cmd); bool sysdecode_semget_flags(FILE *_fp, int _flag, int *_rem); bool sysdecode_sendfile_flags(FILE *_fp, int _flags, int *_rem); Modified: stable/11/lib/libsysdecode/sysdecode_enum.3 ============================================================================== --- stable/11/lib/libsysdecode/sysdecode_enum.3 Sat Apr 7 20:57:27 2018 (r332243) +++ stable/11/lib/libsysdecode/sysdecode_enum.3 Sat Apr 7 21:00:21 2018 (r332244) @@ -54,6 +54,7 @@ .Nm sysdecode_rtprio_function , .Nm sysdecode_scheduler_policy , .Nm sysdecode_sctp_pr_policy , +.Nm sysdecode_sctp_sinfo_flags , .Nm sysdecode_semctl_cmd , .Nm sysdecode_shmctl_cmd , .Nm sysdecode_shutdown_how , Copied: stable/11/lib/libsysdecode/sysdecode_sctp_sinfo_flags.3 (from r327966, head/lib/libsysdecode/sysdecode_sctp_sinfo_flags.3) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/lib/libsysdecode/sysdecode_sctp_sinfo_flags.3 Sat Apr 7 21:00:21 2018 (r332244, copy of r327966, head/lib/libsysdecode/sysdecode_sctp_sinfo_flags.3) @@ -0,0 +1,55 @@ +.\" +.\" Copyright (c) 2018 Michael Tuexen +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd January 14, 2018 +.Dt sysdecode_sctp_sinfo_flags 3 +.Os +.Sh NAME +.Nm sysdecode_sctp_sinfo_flags +.Nd output textual description of the sinfo_flags field of struct sctp_sndrcvinfo +.Sh LIBRARY +.Lb libsysdecode +.Sh SYNOPSIS +.In sys/types.h +.In stdbool.h +.In stdio.h +.In sysdecode.h +.Ft void +.Fn sysdecode_sctp_sinfo_flags "FILE *fp" "int sinfo_flags" +.Sh DESCRIPTION +The +.Fn sysdecode_sctp_sinfo_flags +function outputs a textual description of the +.Fa sinfo_flags +member of a +.Vt struct sctp_sndrcvinfo +to the stream +.Fa fp . +In particular, the embedded PR-SCTP policies are handled. +.Sh SEE ALSO +.Xr sysdecode 3 +.Xr sysdecode_sctp_pr_policy 3 From owner-svn-src-stable-11@freebsd.org Sat Apr 7 21:01:44 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CBD2FF85233; Sat, 7 Apr 2018 21:01:44 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 81974740E1; Sat, 7 Apr 2018 21:01:44 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7997425F37; Sat, 7 Apr 2018 21:01:44 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37L1ifU006670; Sat, 7 Apr 2018 21:01:44 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37L1iQK006668; Sat, 7 Apr 2018 21:01:44 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072101.w37L1iQK006668@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 21:01: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: r332245 - stable/11/usr.bin/truss X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/usr.bin/truss X-SVN-Commit-Revision: 332245 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 21:01:45 -0000 Author: tuexen Date: Sat Apr 7 21:01:43 2018 New Revision: 332245 URL: https://svnweb.freebsd.org/changeset/base/332245 Log: MFC r327967: Improve support for sctp_generic_recvmsg() and sctp_generic_sendmsg() and add support for sctp_generic_sendmsg_iov(). Handle the struct iovec argument and the struct sctp_sndrcvinfo arguments. Modified: stable/11/usr.bin/truss/syscall.h stable/11/usr.bin/truss/syscalls.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/truss/syscall.h ============================================================================== --- stable/11/usr.bin/truss/syscall.h Sat Apr 7 21:00:21 2018 (r332244) +++ stable/11/usr.bin/truss/syscall.h Sat Apr 7 21:01:43 2018 (r332245) @@ -81,7 +81,7 @@ enum Argtype { None = 1, Hex, Octal, Int, UInt, LongHe Sockoptname, Msgflags, CapRights, PUInt, PQuadHex, Acltype, Extattrnamespace, Minherit, Mlockall, Mountflags, Msync, Priowhich, Ptraceop, Quotactlcmd, Reboothowto, Rtpriofunc, Schedpolicy, Schedparam, - PSig, Siginfo, Kevent11, Iovec, + PSig, Siginfo, Kevent11, Iovec, Sctpsndrcvinfo, CloudABIAdvice, CloudABIClockID, ClouduABIFDSFlags, CloudABIFDStat, CloudABIFileStat, CloudABIFileType, Modified: stable/11/usr.bin/truss/syscalls.c ============================================================================== --- stable/11/usr.bin/truss/syscalls.c Sat Apr 7 21:00:21 2018 (r332244) +++ stable/11/usr.bin/truss/syscalls.c Sat Apr 7 21:01:43 2018 (r332245) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -412,13 +413,17 @@ static struct syscall decoded_syscalls[] = { { .name = "sched_setscheduler", .ret_type = 1, .nargs = 3, .args = { { Int, 0 }, { Schedpolicy, 1 }, { Schedparam, 2 } } }, { .name = "sctp_generic_recvmsg", .ret_type = 1, .nargs = 7, - .args = { { Int, 0 }, { Ptr | IN, 1 }, { Int, 2 }, - { Sockaddr | OUT, 3 }, { Ptr | OUT, 4 }, { Ptr | OUT, 5 }, - { Ptr | OUT, 6 } } }, + .args = { { Int, 0 }, { Iovec | OUT, 1 }, { Int, 2 }, + { Sockaddr | OUT, 3 }, { Ptr | OUT, 4 }, + { Sctpsndrcvinfo | OUT, 5 }, { Ptr | OUT, 6 } } }, { .name = "sctp_generic_sendmsg", .ret_type = 1, .nargs = 7, .args = { { Int, 0 }, { BinString | IN, 1 }, { Int, 2 }, - { Sockaddr | IN, 3 }, { Socklent, 4 }, { Ptr | IN, 5 }, - { Msgflags, 6 } } }, + { Sockaddr | IN, 3 }, { Socklent, 4 }, + { Sctpsndrcvinfo | IN, 5 }, { Msgflags, 6 } } }, + { .name = "sctp_generic_sendmsg_iov", .ret_type = 1, .nargs = 7, + .args = { { Int, 0 }, { Iovec | IN, 1 }, { Int, 2 }, + { Sockaddr | IN, 3 }, { Socklent, 4 }, + { Sctpsndrcvinfo | IN, 5 }, { Msgflags, 6 } } }, { .name = "select", .ret_type = 1, .nargs = 5, .args = { { Int, 0 }, { Fd_set, 1 }, { Fd_set, 2 }, { Fd_set, 3 }, { Timeval, 4 } } }, @@ -2128,6 +2133,33 @@ print_arg(struct syscall_args *sc, unsigned long *args fprintf(fp, ",%zu}", iov[i].iov_len); } fprintf(fp, "%s%s", iov_truncated ? ",..." : "", "]"); + break; + } + case Sctpsndrcvinfo: { + struct sctp_sndrcvinfo info; + + if (get_struct(pid, (void *)args[sc->offset], + &info, sizeof(struct sctp_sndrcvinfo)) == -1) { + fprintf(fp, "0x%lx", args[sc->offset]); + break; + } + fprintf(fp, "{sid=%u,", info.sinfo_stream); + if (sc->type & OUT) { + fprintf(fp, "ssn=%u,", info.sinfo_ssn); + } + fputs("flgs=", fp); + sysdecode_sctp_sinfo_flags(fp, info.sinfo_flags); + fprintf(fp, ",ppid=%u,", ntohl(info.sinfo_ppid)); + /* Can't use IN here, since IN is 0 */ + if ((sc->type & OUT) == 0) { + fprintf(fp, "ctx=%u,", info.sinfo_context); + fprintf(fp, "ttl=%u,", info.sinfo_timetolive); + } + if (sc->type & OUT) { + fprintf(fp, "tsn=%u,", info.sinfo_tsn); + fprintf(fp, "cumtsn=%u,", info.sinfo_cumtsn); + } + fprintf(fp, "id=%u}", info.sinfo_assoc_id); break; } From owner-svn-src-stable-11@freebsd.org Sat Apr 7 21:02:43 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 30A63F8538C; Sat, 7 Apr 2018 21:02:43 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D2492749E9; Sat, 7 Apr 2018 21:02:42 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD1882607E; Sat, 7 Apr 2018 21:02:42 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37L2gOf009143; Sat, 7 Apr 2018 21:02:42 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37L2geB009142; Sat, 7 Apr 2018 21:02:42 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072102.w37L2geB009142@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 21:02: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: r332246 - stable/11/lib/libsysdecode X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/lib/libsysdecode X-SVN-Commit-Revision: 332246 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 21:02:43 -0000 Author: tuexen Date: Sat Apr 7 21:02:42 2018 New Revision: 332246 URL: https://svnweb.freebsd.org/changeset/base/332246 Log: MFC r327994: Simplify table generation. Modified: stable/11/lib/libsysdecode/mktables Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libsysdecode/mktables ============================================================================== --- stable/11/lib/libsysdecode/mktables Sat Apr 7 21:01:43 2018 (r332245) +++ stable/11/lib/libsysdecode/mktables Sat Apr 7 21:02:42 2018 (r332246) @@ -157,7 +157,7 @@ gen_table "sigcode" "SI_[A-Z]+[[:space:]]+0(x[ gen_table "umtxcvwaitflags" "CVWAIT_[A-Z_]+[[:space:]]+0x[0-9]+" "sys/umtx.h" gen_table "umtxrwlockflags" "URWLOCK_PREFER_READER[[:space:]]+0x[0-9]+" "sys/umtx.h" gen_table "caprights" "CAP_[A-Z_]+[[:space:]]+CAPRIGHT\([0-9],[[:space:]]+0x[0-9]{16}ULL\)" "sys/capsicum.h" -gen_table "sctpprpolicy" "SCTP_PR_SCTP_[A-Z_]+" "netinet/sctp_uio.h" "SCTP_PR_SCTP_BUF|SCTP_PR_SCTP_MAX|SCTP_PR_SCTP_ALL" +gen_table "sctpprpolicy" "SCTP_PR_SCTP_[A-Z_]+[[:space:]]+0x[0-9]+" "netinet/sctp_uio.h" "SCTP_PR_SCTP_ALL" if [ -e "${include_dir}/x86/sysarch.h" ]; then gen_table "sysarchnum" "(AMD64|I386)_[A-Z86_]+[[:space:]]+[0-9]+" "x86/sysarch.h" else From owner-svn-src-stable-11@freebsd.org Sat Apr 7 21:03:48 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 27A85F854A1; Sat, 7 Apr 2018 21:03:48 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C43CF7535B; Sat, 7 Apr 2018 21:03:47 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB9D22607F; Sat, 7 Apr 2018 21:03:47 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37L3lcX009240; Sat, 7 Apr 2018 21:03:47 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37L3l3N009233; Sat, 7 Apr 2018 21:03:47 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072103.w37L3l3N009233@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 21:03:47 +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: r332247 - stable/11/lib/libsysdecode X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/lib/libsysdecode X-SVN-Commit-Revision: 332247 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 21:03:48 -0000 Author: tuexen Date: Sat Apr 7 21:03:46 2018 New Revision: 332247 URL: https://svnweb.freebsd.org/changeset/base/332247 Log: MFC r327995: Add support for decoding the type of a cmsg. Added: stable/11/lib/libsysdecode/sysdecode_cmsg_type.3 - copied unchanged from r327995, head/lib/libsysdecode/sysdecode_cmsg_type.3 Modified: stable/11/lib/libsysdecode/Makefile stable/11/lib/libsysdecode/flags.c stable/11/lib/libsysdecode/mktables stable/11/lib/libsysdecode/sysdecode.3 stable/11/lib/libsysdecode/sysdecode.h Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libsysdecode/Makefile ============================================================================== --- stable/11/lib/libsysdecode/Makefile Sat Apr 7 21:02:42 2018 (r332246) +++ stable/11/lib/libsysdecode/Makefile Sat Apr 7 21:03:46 2018 (r332247) @@ -15,6 +15,7 @@ CFLAGS+= -I${SRCTOP}/libexec/rtld-elf MAN= sysdecode.3 \ sysdecode_abi_to_freebsd_errno.3 \ sysdecode_cap_rights.3 \ + sysdecode_cmsg_type.3 \ sysdecode_enum.3 \ sysdecode_fcntl_arg.3 \ sysdecode_kevent.3 \ Modified: stable/11/lib/libsysdecode/flags.c ============================================================================== --- stable/11/lib/libsysdecode/flags.c Sat Apr 7 21:02:42 2018 (r332246) +++ stable/11/lib/libsysdecode/flags.c Sat Apr 7 21:03:46 2018 (r332247) @@ -1157,6 +1157,46 @@ sysdecode_cap_rights(FILE *fp, cap_rights_t *rightsp) } } +static struct name_table cmsgtypeip[] = { + X(IP_RECVDSTADDR) X(IP_RECVTTL) X(IP_RECVOPTS) X(IP_RECVRETOPTS) + X(IP_RECVIF) X(IP_RECVTOS) X(IP_FLOWID) X(IP_FLOWTYPE) + X(IP_RSSBUCKETID) XEND +}; + +static struct name_table cmsgtypeipv6[] = { +#if 0 + /* The RFC 2292 defines are kernel space only. */ + X(IPV6_2292PKTINFO) X(IPV6_2292HOPLIMIT) X(IPV6_2292HOPOPTS) + X(IPV6_2292DSTOPTS) X(IPV6_2292RTHDR) X(IPV6_2292NEXTHOP) +#endif + X(IPV6_PKTINFO) X(IPV6_HOPLIMIT) X(IPV6_HOPOPTS) + X(IPV6_DSTOPTS) X(IPV6_RTHDR) X(IPV6_NEXTHOP) + X(IPV6_TCLASS) X(IPV6_FLOWID) X(IPV6_FLOWTYPE) X(IPV6_RSSBUCKETID) + X(IPV6_PATHMTU) X(IPV6_RTHDRDSTOPTS) X(IPV6_USE_MIN_MTU) + X(IPV6_DONTFRAG) X(IPV6_PREFER_TEMPADDR) XEND +}; + +static struct name_table cmsgtypesctp[] = { + X(SCTP_INIT) X(SCTP_SNDRCV) X(SCTP_EXTRCV) X(SCTP_SNDINFO) + X(SCTP_RCVINFO) X(SCTP_NXTINFO) X(SCTP_PRINFO) X(SCTP_AUTHINFO) + X(SCTP_DSTADDRV4) X(SCTP_DSTADDRV6) XEND +}; + +const char * +sysdecode_cmsg_type(int cmsg_level, int cmsg_type) +{ + + if (cmsg_level == SOL_SOCKET) + return (lookup_value(cmsgtypesocket, cmsg_type)); + if (cmsg_level == IPPROTO_IP) + return (lookup_value(cmsgtypeip, cmsg_type)); + if (cmsg_level == IPPROTO_IPV6) + return (lookup_value(cmsgtypeipv6, cmsg_type)); + if (cmsg_level == IPPROTO_SCTP) + return (lookup_value(cmsgtypesctp, cmsg_type)); + return (NULL); +} + const char * sysdecode_sctp_pr_policy(int policy) { Modified: stable/11/lib/libsysdecode/mktables ============================================================================== --- stable/11/lib/libsysdecode/mktables Sat Apr 7 21:02:42 2018 (r332246) +++ stable/11/lib/libsysdecode/mktables Sat Apr 7 21:03:46 2018 (r332247) @@ -158,6 +158,7 @@ gen_table "umtxcvwaitflags" "CVWAIT_[A-Z_]+[[:space:]] gen_table "umtxrwlockflags" "URWLOCK_PREFER_READER[[:space:]]+0x[0-9]+" "sys/umtx.h" gen_table "caprights" "CAP_[A-Z_]+[[:space:]]+CAPRIGHT\([0-9],[[:space:]]+0x[0-9]{16}ULL\)" "sys/capsicum.h" gen_table "sctpprpolicy" "SCTP_PR_SCTP_[A-Z_]+[[:space:]]+0x[0-9]+" "netinet/sctp_uio.h" "SCTP_PR_SCTP_ALL" +gen_table "cmsgtypesocket" "SCM_[A-Z_]+[[:space:]]+0x[0-9]+" "sys/socket.h" if [ -e "${include_dir}/x86/sysarch.h" ]; then gen_table "sysarchnum" "(AMD64|I386)_[A-Z86_]+[[:space:]]+[0-9]+" "x86/sysarch.h" else Modified: stable/11/lib/libsysdecode/sysdecode.3 ============================================================================== --- stable/11/lib/libsysdecode/sysdecode.3 Sat Apr 7 21:02:42 2018 (r332246) +++ stable/11/lib/libsysdecode/sysdecode.3 Sat Apr 7 21:03:46 2018 (r332247) @@ -70,6 +70,7 @@ A placeholder for use when the ABI is not known. .Sh SEE ALSO .Xr sysdecode_abi_to_freebsd_errno 3 , .Xr sysdecode_cap_rights 3 , +.Xr sysdecode_cmsg_type 3 , .Xr sysdecode_enum 3 , .Xr sysdecode_fcntl_arg 3 , .Xr sysdecode_ioctlname 3 , Modified: stable/11/lib/libsysdecode/sysdecode.h ============================================================================== --- stable/11/lib/libsysdecode/sysdecode.h Sat Apr 7 21:02:42 2018 (r332246) +++ stable/11/lib/libsysdecode/sysdecode.h Sat Apr 7 21:03:46 2018 (r332247) @@ -45,6 +45,7 @@ const char *sysdecode_atfd(int _fd); bool sysdecode_atflags(FILE *_fp, int _flags, int *_rem); bool sysdecode_cap_fcntlrights(FILE *_fp, uint32_t _rights, uint32_t *_rem); void sysdecode_cap_rights(FILE *_fp, cap_rights_t *_rightsp); +const char *sysdecode_cmsg_type(int _cmsg_level, int _cmsg_type); const char *sysdecode_extattrnamespace(int _namespace); const char *sysdecode_fadvice(int _advice); void sysdecode_fcntl_arg(FILE *_fp, int _cmd, uintptr_t _arg, int _base); Copied: stable/11/lib/libsysdecode/sysdecode_cmsg_type.3 (from r327995, head/lib/libsysdecode/sysdecode_cmsg_type.3) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/lib/libsysdecode/sysdecode_cmsg_type.3 Sat Apr 7 21:03:46 2018 (r332247, copy of r327995, head/lib/libsysdecode/sysdecode_cmsg_type.3) @@ -0,0 +1,54 @@ +.\" +.\" Copyright (c) 2018 Michael Tuexen +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd January 15, 2018 +.Dt sysdecode_cmsg_type 3 +.Os +.Sh NAME +.Nm sysdecode_cmsg_type +.Nd lookup name of cmsg type +.Sh LIBRARY +.Lb libsysdecode +.Sh SYNOPSIS +.In sys/types.h +.In stdbool.h +.In sysdecode.h +.Ft const char * +.Fn sysdecode_cmsg_type "int cmsg_level" "int cmsg_type" +.Sh DESCRIPTION +The +.Fn sysdecode_cmsg_type +function returns a text description of the +.Fa cmsg_type +member of a +.Vt struct cmsghdr . +.Fn sysdecode_cmsg_type +also takes the +.Fa cmsg_level +to uniquely identify the type. +.Sh SEE ALSO +.Xr sysdecode 3 From owner-svn-src-stable-11@freebsd.org Sat Apr 7 21:04:44 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 09022F855D5; Sat, 7 Apr 2018 21:04:44 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AC21275D30; Sat, 7 Apr 2018 21:04:43 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A59CC26080; Sat, 7 Apr 2018 21:04:43 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37L4htl009329; Sat, 7 Apr 2018 21:04:43 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37L4ha2009324; Sat, 7 Apr 2018 21:04:43 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072104.w37L4ha2009324@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 21:04: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: r332248 - stable/11/lib/libsysdecode X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/lib/libsysdecode X-SVN-Commit-Revision: 332248 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 21:04:44 -0000 Author: tuexen Date: Sat Apr 7 21:04:43 2018 New Revision: 332248 URL: https://svnweb.freebsd.org/changeset/base/332248 Log: MFC r328014: Add support for decoding the nxt_flags, rcv_flags, and snd_flags of SCTP level cmsgs. Modified: stable/11/lib/libsysdecode/Makefile stable/11/lib/libsysdecode/flags.c stable/11/lib/libsysdecode/sysdecode.h stable/11/lib/libsysdecode/sysdecode_mask.3 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libsysdecode/Makefile ============================================================================== --- stable/11/lib/libsysdecode/Makefile Sat Apr 7 21:03:46 2018 (r332247) +++ stable/11/lib/libsysdecode/Makefile Sat Apr 7 21:04:43 2018 (r332248) @@ -96,6 +96,9 @@ MLINKS+=sysdecode_mask.3 sysdecode_accessmode.3 \ sysdecode_mask.3 sysdecode_semget_flags.3 \ sysdecode_mask.3 sysdecode_sendfile_flags.3 \ sysdecode_mask.3 sysdecode_shmat_flags.3 \ + sysdecode_mask.3 sysdecode_sctp_nxt_flags.3 \ + sysdecode_mask.3 sysdecode_sctp_rcv_flags.3 \ + sysdecode_mask.3 sysdecode_sctp_snd_flags.3 \ sysdecode_mask.3 sysdecode_socket_type.3 \ sysdecode_mask.3 sysdecode_thr_create_flags.3 \ sysdecode_mask.3 sysdecode_umtx_cvwait_flags.3 \ Modified: stable/11/lib/libsysdecode/flags.c ============================================================================== --- stable/11/lib/libsysdecode/flags.c Sat Apr 7 21:03:46 2018 (r332247) +++ stable/11/lib/libsysdecode/flags.c Sat Apr 7 21:04:43 2018 (r332248) @@ -1204,6 +1204,40 @@ sysdecode_sctp_pr_policy(int policy) return (lookup_value(sctpprpolicy, policy)); } +static struct name_table sctpsndflags[] = { + X(SCTP_EOF) X(SCTP_ABORT) X(SCTP_UNORDERED) X(SCTP_ADDR_OVER) + X(SCTP_SENDALL) X(SCTP_SACK_IMMEDIATELY) XEND +}; + +bool +sysdecode_sctp_snd_flags(FILE *fp, int flags, int *rem) +{ + + return (print_mask_int(fp, sctpsndflags, flags, rem)); +} + +static struct name_table sctprcvflags[] = { + X(SCTP_UNORDERED) XEND +}; + +bool +sysdecode_sctp_rcv_flags(FILE *fp, int flags, int *rem) +{ + + return (print_mask_int(fp, sctprcvflags, flags, rem)); +} + +static struct name_table sctpnxtflags[] = { + X(SCTP_UNORDERED) X(SCTP_COMPLETE) X(SCTP_NOTIFICATION) XEND +}; + +bool +sysdecode_sctp_nxt_flags(FILE *fp, int flags, int *rem) +{ + + return (print_mask_int(fp, sctpnxtflags, flags, rem)); +} + static struct name_table sctpsinfoflags[] = { X(SCTP_EOF) X(SCTP_ABORT) X(SCTP_UNORDERED) X(SCTP_ADDR_OVER) X(SCTP_SENDALL) X(SCTP_EOR) X(SCTP_SACK_IMMEDIATELY) XEND Modified: stable/11/lib/libsysdecode/sysdecode.h ============================================================================== --- stable/11/lib/libsysdecode/sysdecode.h Sat Apr 7 21:03:46 2018 (r332247) +++ stable/11/lib/libsysdecode/sysdecode.h Sat Apr 7 21:04:43 2018 (r332248) @@ -90,8 +90,11 @@ bool sysdecode_rfork_flags(FILE *_fp, int _flags, int const char *sysdecode_rlimit(int _resource); const char *sysdecode_rtprio_function(int _function); const char *sysdecode_scheduler_policy(int _policy); +bool sysdecode_sctp_nxt_flags(FILE *_fp, int _flags, int *_rem); const char *sysdecode_sctp_pr_policy(int _policy); +bool sysdecode_sctp_rcv_flags(FILE *_fp, int _flags, int *_rem); void sysdecode_sctp_sinfo_flags(FILE *_fp, int _sinfo_flags); +bool sysdecode_sctp_snd_flags(FILE *_fp, int _flags, int *_rem); const char *sysdecode_semctl_cmd(int _cmd); bool sysdecode_semget_flags(FILE *_fp, int _flag, int *_rem); bool sysdecode_sendfile_flags(FILE *_fp, int _flags, int *_rem); Modified: stable/11/lib/libsysdecode/sysdecode_mask.3 ============================================================================== --- stable/11/lib/libsysdecode/sysdecode_mask.3 Sat Apr 7 21:03:46 2018 (r332247) +++ stable/11/lib/libsysdecode/sysdecode_mask.3 Sat Apr 7 21:04:43 2018 (r332248) @@ -50,6 +50,9 @@ .Nm sysdecode_semget_flags , .Nm sysdecode_sendfile_flags , .Nm sysdecode_shmat_flags , +.Nm sysdecode_sctp_nxt_flags , +.Nm sysdecode_sctp_rcv_flags , +.Nm sysdecode_sctp_snd_flags , .Nm sysdecode_socket_type , .Nm sysdecode_thr_create_flags , .Nm sysdecode_umtx_cvwait_flags , @@ -100,6 +103,12 @@ .Ft bool .Fn sysdecode_rfork_flags "FILE *fp" "int flags" "int *rem" .Ft bool +.Fn sysdecode_sctp_nxt_flags "FILE *fp" "int flags" "int *rem" +.Ft bool +.Fn sysdecode_sctp_rcv_flags "FILE *fp" "int flags" "int *rem" +.Ft bool +.Fn sysdecode_sctp_snd_flags "FILE *fp" "int flags" "int *rem" +.Ft bool .Fn sysdecode_semget_flags "FILE *fp" "int flags" "int *rem" .Ft bool .Fn sysdecode_sendfile_flags "FILE *fp" "int flags" "int *rem" @@ -185,6 +194,21 @@ and .Dv F_SETFL .Xr fcntl 2 commands. +.It Fn sysdecode_sctp_nxt_flags +The +.Fa nxt_flags +member of a +.Vt struct sctp_nxtinfo . +.It Fn sysdecode_sctp_rcv_flags +The +.Fa rcv_flags +member of a +.Vt struct sctp_rcvinfo . +.It Fn sysdecode_sctp_snd_flags +The +.Fa snd_flags +member of a +.Vt struct sctp_sndinfo . .It Fn sysdecode_umtx_cvwait_flags The .Fa val From owner-svn-src-stable-11@freebsd.org Sat Apr 7 21:05:40 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D0EE4F856CB; Sat, 7 Apr 2018 21:05:39 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7AEAC765E7; Sat, 7 Apr 2018 21:05:39 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 747AB26081; Sat, 7 Apr 2018 21:05:39 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37L5dDs009422; Sat, 7 Apr 2018 21:05:39 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37L5dbW009420; Sat, 7 Apr 2018 21:05:39 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072105.w37L5dbW009420@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 21:05:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332249 - stable/11/usr.bin/truss X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/usr.bin/truss X-SVN-Commit-Revision: 332249 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 21:05:40 -0000 Author: tuexen Date: Sat Apr 7 21:05:39 2018 New Revision: 332249 URL: https://svnweb.freebsd.org/changeset/base/332249 Log: MFC r328015: Decode msghdr argument of sendmsg() and recvmsg(). Modified: stable/11/usr.bin/truss/syscall.h stable/11/usr.bin/truss/syscalls.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/truss/syscall.h ============================================================================== --- stable/11/usr.bin/truss/syscall.h Sat Apr 7 21:04:43 2018 (r332248) +++ stable/11/usr.bin/truss/syscall.h Sat Apr 7 21:05:39 2018 (r332249) @@ -81,7 +81,7 @@ enum Argtype { None = 1, Hex, Octal, Int, UInt, LongHe Sockoptname, Msgflags, CapRights, PUInt, PQuadHex, Acltype, Extattrnamespace, Minherit, Mlockall, Mountflags, Msync, Priowhich, Ptraceop, Quotactlcmd, Reboothowto, Rtpriofunc, Schedpolicy, Schedparam, - PSig, Siginfo, Kevent11, Iovec, Sctpsndrcvinfo, + PSig, Siginfo, Kevent11, Iovec, Sctpsndrcvinfo, Msghdr, CloudABIAdvice, CloudABIClockID, ClouduABIFDSFlags, CloudABIFDStat, CloudABIFileStat, CloudABIFileType, Modified: stable/11/usr.bin/truss/syscalls.c ============================================================================== --- stable/11/usr.bin/truss/syscalls.c Sat Apr 7 21:04:43 2018 (r332248) +++ stable/11/usr.bin/truss/syscalls.c Sat Apr 7 21:05:39 2018 (r332249) @@ -385,7 +385,7 @@ static struct syscall decoded_syscalls[] = { { Msgflags, 3 }, { Sockaddr | OUT, 4 }, { Ptr | OUT, 5 } } }, { .name = "recvmsg", .ret_type = 1, .nargs = 3, - .args = { { Int, 0 }, { Ptr, 1 }, { Msgflags, 2 } } }, + .args = { { Int, 0 }, { Msghdr | OUT, 1 }, { Msgflags, 2 } } }, { .name = "rename", .ret_type = 1, .nargs = 2, .args = { { Name, 0 }, { Name, 1 } } }, { .name = "renameat", .ret_type = 1, .nargs = 4, @@ -428,7 +428,7 @@ static struct syscall decoded_syscalls[] = { .args = { { Int, 0 }, { Fd_set, 1 }, { Fd_set, 2 }, { Fd_set, 3 }, { Timeval, 4 } } }, { .name = "sendmsg", .ret_type = 1, .nargs = 3, - .args = { { Int, 0 }, { Ptr, 1 }, { Msgflags, 2 } } }, + .args = { { Int, 0 }, { Msghdr | IN, 1 }, { Msgflags, 2 } } }, { .name = "sendto", .ret_type = 1, .nargs = 6, .args = { { Int, 0 }, { BinString | IN, 1 }, { Sizet, 2 }, { Msgflags, 3 }, { Sockaddr | IN, 4 }, @@ -1142,6 +1142,378 @@ print_utrace(FILE *fp, void *utrace_addr, size_t len) fprintf(fp, " }"); } +static void +print_sockaddr(FILE *fp, struct trussinfo *trussinfo, void *arg, socklen_t len) +{ + char addr[64]; + struct sockaddr_in *lsin; + struct sockaddr_in6 *lsin6; + struct sockaddr_un *sun; + struct sockaddr *sa; + u_char *q; + pid_t pid = trussinfo->curthread->proc->pid; + + if (arg == NULL) { + fputs("NULL", fp); + return; + } + /* If the length is too small, just bail. */ + if (len < sizeof(*sa)) { + fprintf(fp, "0x%p", arg); + return; + } + + sa = calloc(1, len); + if (get_struct(pid, arg, sa, len) == -1) { + free(sa); + fprintf(fp, "0x%p", arg); + return; + } + + switch (sa->sa_family) { + case AF_INET: + if (len < sizeof(*lsin)) + goto sockaddr_short; + lsin = (struct sockaddr_in *)(void *)sa; + inet_ntop(AF_INET, &lsin->sin_addr, addr, sizeof(addr)); + fprintf(fp, "{ AF_INET %s:%d }", addr, + htons(lsin->sin_port)); + break; + case AF_INET6: + if (len < sizeof(*lsin6)) + goto sockaddr_short; + lsin6 = (struct sockaddr_in6 *)(void *)sa; + inet_ntop(AF_INET6, &lsin6->sin6_addr, addr, + sizeof(addr)); + fprintf(fp, "{ AF_INET6 [%s]:%d }", addr, + htons(lsin6->sin6_port)); + break; + case AF_UNIX: + sun = (struct sockaddr_un *)sa; + fprintf(fp, "{ AF_UNIX \"%.*s\" }", + (int)(len - offsetof(struct sockaddr_un, sun_path)), + sun->sun_path); + break; + default: + sockaddr_short: + fprintf(fp, + "{ sa_len = %d, sa_family = %d, sa_data = {", + (int)sa->sa_len, (int)sa->sa_family); + for (q = (u_char *)sa->sa_data; + q < (u_char *)sa + len; q++) + fprintf(fp, "%s 0x%02x", + q == (u_char *)sa->sa_data ? "" : ",", + *q); + fputs(" } }", fp); + } + free(sa); +} + +#define IOV_LIMIT 16 + +static void +print_iovec(FILE *fp, struct trussinfo *trussinfo, void *arg, int iovcnt) +{ + struct iovec iov[IOV_LIMIT]; + size_t max_string = trussinfo->strsize; + char tmp2[max_string + 1], *tmp3; + size_t len; + pid_t pid = trussinfo->curthread->proc->pid; + int i; + bool buf_truncated, iov_truncated; + + if (iovcnt <= 0) { + fprintf(fp, "0x%p", arg); + return; + } + if (iovcnt > IOV_LIMIT) { + iovcnt = IOV_LIMIT; + iov_truncated = true; + } else { + iov_truncated = false; + } + if (get_struct(pid, arg, &iov, iovcnt * sizeof(struct iovec)) == -1) { + fprintf(fp, "0x%p", arg); + return; + } + + fputs("[", fp); + for (i = 0; i < iovcnt; i++) { + len = iov[i].iov_len; + if (len > max_string) { + len = max_string; + buf_truncated = true; + } else { + buf_truncated = false; + } + fprintf(fp, "%s{", (i > 0) ? "," : ""); + if (len && get_struct(pid, iov[i].iov_base, &tmp2, len) != -1) { + tmp3 = malloc(len * 4 + 1); + while (len) { + if (strvisx(tmp3, tmp2, len, + VIS_CSTYLE|VIS_TAB|VIS_NL) <= + (int)max_string) + break; + len--; + buf_truncated = true; + } + fprintf(fp, "\"%s\"%s", tmp3, + buf_truncated ? "..." : ""); + free(tmp3); + } else { + fprintf(fp, "0x%p", iov[i].iov_base); + } + fprintf(fp, ",%zu}", iov[i].iov_len); + } + fprintf(fp, "%s%s", iov_truncated ? ",..." : "", "]"); +} + +static void +print_gen_cmsg(FILE *fp, struct cmsghdr *cmsghdr) +{ + u_char *q; + + fputs("{", fp); + for (q = CMSG_DATA(cmsghdr); + q < (u_char *)cmsghdr + cmsghdr->cmsg_len; q++) { + fprintf(fp, "%s0x%02x", q == CMSG_DATA(cmsghdr) ? "" : ",", *q); + } + fputs("}", fp); +} + +static void +print_sctp_initmsg(FILE *fp, struct sctp_initmsg *init) +{ + fprintf(fp, "{out=%u,", init->sinit_num_ostreams); + fprintf(fp, "in=%u,", init->sinit_max_instreams); + fprintf(fp, "max_rtx=%u,", init->sinit_max_attempts); + fprintf(fp, "max_rto=%u}", init->sinit_max_init_timeo); +} + +static void +print_sctp_sndrcvinfo(FILE *fp, bool recv, struct sctp_sndrcvinfo *info) +{ + fprintf(fp, "{sid=%u,", info->sinfo_stream); + if (recv) { + fprintf(fp, "ssn=%u,", info->sinfo_ssn); + } + fputs("flgs=", fp); + sysdecode_sctp_sinfo_flags(fp, info->sinfo_flags); + fprintf(fp, ",ppid=%u,", ntohl(info->sinfo_ppid)); + if (!recv) { + fprintf(fp, "ctx=%u,", info->sinfo_context); + fprintf(fp, "ttl=%u,", info->sinfo_timetolive); + } + if (recv) { + fprintf(fp, "tsn=%u,", info->sinfo_tsn); + fprintf(fp, "cumtsn=%u,", info->sinfo_cumtsn); + } + fprintf(fp, "id=%u}", info->sinfo_assoc_id); +} + +static void +print_sctp_sndinfo(FILE *fp, struct sctp_sndinfo *info) +{ + fprintf(fp, "{sid=%u,", info->snd_sid); + fputs("flgs=", fp); + print_mask_arg(sysdecode_sctp_snd_flags, fp, info->snd_flags); + fprintf(fp, ",ppid=%u,", ntohl(info->snd_ppid)); + fprintf(fp, "ctx=%u,", info->snd_context); + fprintf(fp, "id=%u}", info->snd_assoc_id); +} + +static void +print_sctp_rcvinfo(FILE *fp, struct sctp_rcvinfo *info) +{ + fprintf(fp, "{sid=%u,", info->rcv_sid); + fprintf(fp, "ssn=%u,", info->rcv_ssn); + fputs("flgs=", fp); + print_mask_arg(sysdecode_sctp_rcv_flags, fp, info->rcv_flags); + fprintf(fp, ",ppid=%u,", ntohl(info->rcv_ppid)); + fprintf(fp, "tsn=%u,", info->rcv_tsn); + fprintf(fp, "cumtsn=%u,", info->rcv_cumtsn); + fprintf(fp, "ctx=%u,", info->rcv_context); + fprintf(fp, "id=%u}", info->rcv_assoc_id); +} + +static void +print_sctp_nxtinfo(FILE *fp, struct sctp_nxtinfo *info) +{ + fprintf(fp, "{sid=%u,", info->nxt_sid); + fputs("flgs=", fp); + print_mask_arg(sysdecode_sctp_nxt_flags, fp, info->nxt_flags); + fprintf(fp, ",ppid=%u,", ntohl(info->nxt_ppid)); + fprintf(fp, "len=%u,", info->nxt_length); + fprintf(fp, "id=%u}", info->nxt_assoc_id); +} + +static void +print_sctp_prinfo(FILE *fp, struct sctp_prinfo *info) +{ + fputs("{pol=", fp); + print_integer_arg(sysdecode_sctp_pr_policy, fp, info->pr_policy); + fprintf(fp, ",val=%u}", info->pr_value); +} + +static void +print_sctp_authinfo(FILE *fp, struct sctp_authinfo *info) +{ + fprintf(fp, "{num=%u}", info->auth_keynumber); +} + +static void +print_sctp_ipv4_addr(FILE *fp, struct in_addr *addr) +{ + char buf[INET_ADDRSTRLEN]; + const char *s; + + s = inet_ntop(AF_INET, addr, buf, INET_ADDRSTRLEN); + if (s != NULL) + fprintf(fp, "{addr=%s}", s); + else + fputs("{addr=???}", fp); +} + +static void +print_sctp_ipv6_addr(FILE *fp, struct in6_addr *addr) +{ + char buf[INET6_ADDRSTRLEN]; + const char *s; + + s = inet_ntop(AF_INET6, addr, buf, INET6_ADDRSTRLEN); + if (s != NULL) + fprintf(fp, "{addr=%s}", s); + else + fputs("{addr=???}", fp); +} + +static void +print_sctp_cmsg(FILE *fp, bool recv, struct cmsghdr *cmsghdr) +{ + void *data; + socklen_t len; + + len = cmsghdr->cmsg_len; + data = CMSG_DATA(cmsghdr); + switch (cmsghdr->cmsg_type) { + case SCTP_INIT: + if (len == CMSG_LEN(sizeof(struct sctp_initmsg))) + print_sctp_initmsg(fp, (struct sctp_initmsg *)data); + else + print_gen_cmsg(fp, cmsghdr); + break; + case SCTP_SNDRCV: + if (len == CMSG_LEN(sizeof(struct sctp_sndrcvinfo))) + print_sctp_sndrcvinfo(fp, recv, + (struct sctp_sndrcvinfo *)data); + else + print_gen_cmsg(fp, cmsghdr); + break; +#if 0 + case SCTP_EXTRCV: + if (len == CMSG_LEN(sizeof(struct sctp_extrcvinfo))) + print_sctp_extrcvinfo(fp, + (struct sctp_extrcvinfo *)data); + else + print_gen_cmsg(fp, cmsghdr); + break; +#endif + case SCTP_SNDINFO: + if (len == CMSG_LEN(sizeof(struct sctp_sndinfo))) + print_sctp_sndinfo(fp, (struct sctp_sndinfo *)data); + else + print_gen_cmsg(fp, cmsghdr); + break; + case SCTP_RCVINFO: + if (len == CMSG_LEN(sizeof(struct sctp_rcvinfo))) + print_sctp_rcvinfo(fp, (struct sctp_rcvinfo *)data); + else + print_gen_cmsg(fp, cmsghdr); + break; + case SCTP_NXTINFO: + if (len == CMSG_LEN(sizeof(struct sctp_nxtinfo))) + print_sctp_nxtinfo(fp, (struct sctp_nxtinfo *)data); + else + print_gen_cmsg(fp, cmsghdr); + break; + case SCTP_PRINFO: + if (len == CMSG_LEN(sizeof(struct sctp_prinfo))) + print_sctp_prinfo(fp, (struct sctp_prinfo *)data); + else + print_gen_cmsg(fp, cmsghdr); + break; + case SCTP_AUTHINFO: + if (len == CMSG_LEN(sizeof(struct sctp_authinfo))) + print_sctp_authinfo(fp, (struct sctp_authinfo *)data); + else + print_gen_cmsg(fp, cmsghdr); + break; + case SCTP_DSTADDRV4: + if (len == CMSG_LEN(sizeof(struct in_addr))) + print_sctp_ipv4_addr(fp, (struct in_addr *)data); + else + print_gen_cmsg(fp, cmsghdr); + break; + case SCTP_DSTADDRV6: + if (len == CMSG_LEN(sizeof(struct in6_addr))) + print_sctp_ipv6_addr(fp, (struct in6_addr *)data); + else + print_gen_cmsg(fp, cmsghdr); + break; + default: + print_gen_cmsg(fp, cmsghdr); + } +} + +static void +print_cmsgs(FILE *fp, pid_t pid, bool recv, struct msghdr *msghdr) +{ + struct cmsghdr *cmsghdr; + char *cmsgbuf; + const char *temp; + socklen_t len; + int level, type; + bool first; + + len = msghdr->msg_controllen; + cmsgbuf = calloc(1, len); + if (get_struct(pid, msghdr->msg_control, cmsgbuf, len) == -1) { + fprintf(fp, "0x%p", msghdr); + free(cmsgbuf); + } + msghdr->msg_control = cmsgbuf; + first = true; + fputs("{", fp); + for (cmsghdr = CMSG_FIRSTHDR(msghdr); + cmsghdr != NULL; + cmsghdr = CMSG_NXTHDR(msghdr, cmsghdr)) { + level = cmsghdr->cmsg_level; + type = cmsghdr->cmsg_type; + len = cmsghdr->cmsg_len; + fprintf(fp, "%s{level=", first ? "" : ","); + print_integer_arg(sysdecode_sockopt_level, fp, level); + fputs(",type=", fp); + temp = sysdecode_cmsg_type(level, type); + if (temp) { + fputs(temp, fp); + } else { + fprintf(fp, "%d", type); + } + fputs(",data=", fp); + switch (level) { + case IPPROTO_SCTP: + print_sctp_cmsg(fp, recv, cmsghdr); + break; + default: + print_gen_cmsg(fp, cmsghdr); + break; + } + fputs("}", fp); + } + fputs("}", fp); + free(cmsgbuf); +} + /* * Converts a syscall argument into a string. Said string is * allocated via malloc(), so needs to be free()'d. sc is @@ -1596,13 +1968,7 @@ print_arg(struct syscall_args *sc, unsigned long *args print_mask_arg(sysdecode_rfork_flags, fp, args[sc->offset]); break; case Sockaddr: { - char addr[64]; - struct sockaddr_in *lsin; - struct sockaddr_in6 *lsin6; - struct sockaddr_un *sun; - struct sockaddr *sa; socklen_t len; - u_char *q; if (args[sc->offset] == 0) { fputs("NULL", fp); @@ -1624,56 +1990,7 @@ print_arg(struct syscall_args *sc, unsigned long *args } else len = args[sc->offset + 1]; - /* If the length is too small, just bail. */ - if (len < sizeof(*sa)) { - fprintf(fp, "0x%lx", args[sc->offset]); - break; - } - - sa = calloc(1, len); - if (get_struct(pid, (void *)args[sc->offset], sa, len) == -1) { - free(sa); - fprintf(fp, "0x%lx", args[sc->offset]); - break; - } - - switch (sa->sa_family) { - case AF_INET: - if (len < sizeof(*lsin)) - goto sockaddr_short; - lsin = (struct sockaddr_in *)(void *)sa; - inet_ntop(AF_INET, &lsin->sin_addr, addr, sizeof(addr)); - fprintf(fp, "{ AF_INET %s:%d }", addr, - htons(lsin->sin_port)); - break; - case AF_INET6: - if (len < sizeof(*lsin6)) - goto sockaddr_short; - lsin6 = (struct sockaddr_in6 *)(void *)sa; - inet_ntop(AF_INET6, &lsin6->sin6_addr, addr, - sizeof(addr)); - fprintf(fp, "{ AF_INET6 [%s]:%d }", addr, - htons(lsin6->sin6_port)); - break; - case AF_UNIX: - sun = (struct sockaddr_un *)sa; - fprintf(fp, "{ AF_UNIX \"%.*s\" }", - (int)(len - offsetof(struct sockaddr_un, sun_path)), - sun->sun_path); - break; - default: - sockaddr_short: - fprintf(fp, - "{ sa_len = %d, sa_family = %d, sa_data = {", - (int)sa->sa_len, (int)sa->sa_family); - for (q = (u_char *)sa->sa_data; - q < (u_char *)sa + len; q++) - fprintf(fp, "%s 0x%02x", - q == (u_char *)sa->sa_data ? "" : ",", - *q); - fputs(" } }", fp); - } - free(sa); + print_sockaddr(fp, trussinfo, (void *)args[sc->offset], len); break; } case Sigaction: { @@ -2073,93 +2390,43 @@ print_arg(struct syscall_args *sc, unsigned long *args fprintf(fp, "0x%lx", args[sc->offset]); break; } -#define IOV_LIMIT 16 - case Iovec: { + case Iovec: /* * Print argument as an array of struct iovec, where the next * syscall argument is the number of elements of the array. */ - struct iovec iov[IOV_LIMIT]; - size_t max_string = trussinfo->strsize; - char tmp2[max_string + 1], *tmp3; - size_t len; - int i, iovcnt; - bool buf_truncated, iov_truncated; - iovcnt = args[sc->offset + 1]; - if (iovcnt <= 0) { - fprintf(fp, "0x%lx", args[sc->offset]); - break; - } - if (iovcnt > IOV_LIMIT) { - iovcnt = IOV_LIMIT; - iov_truncated = true; - } else { - iov_truncated = false; - } + print_iovec(fp, trussinfo, (void *)args[sc->offset], + (int)args[sc->offset + 1]); + break; + case Sctpsndrcvinfo: { + struct sctp_sndrcvinfo info; + if (get_struct(pid, (void *)args[sc->offset], - &iov, iovcnt * sizeof(struct iovec)) == -1) { + &info, sizeof(struct sctp_sndrcvinfo)) == -1) { fprintf(fp, "0x%lx", args[sc->offset]); break; } - - fprintf(fp, "%s", "["); - for (i = 0; i < iovcnt; i++) { - len = iov[i].iov_len; - if (len > max_string) { - len = max_string; - buf_truncated = true; - } else { - buf_truncated = false; - } - fprintf(fp, "%s{", (i > 0) ? "," : ""); - if (len && get_struct(pid, iov[i].iov_base, &tmp2, len) - != -1) { - tmp3 = malloc(len * 4 + 1); - while (len) { - if (strvisx(tmp3, tmp2, len, - VIS_CSTYLE|VIS_TAB|VIS_NL) <= - (int)max_string) - break; - len--; - buf_truncated = true; - } - fprintf(fp, "\"%s\"%s", tmp3, - buf_truncated ? "..." : ""); - free(tmp3); - } else { - fprintf(fp, "0x%p", iov[i].iov_base); - } - fprintf(fp, ",%zu}", iov[i].iov_len); - } - fprintf(fp, "%s%s", iov_truncated ? ",..." : "", "]"); + print_sctp_sndrcvinfo(fp, sc->type & OUT, &info); break; } - case Sctpsndrcvinfo: { - struct sctp_sndrcvinfo info; + case Msghdr: { + struct msghdr msghdr; if (get_struct(pid, (void *)args[sc->offset], - &info, sizeof(struct sctp_sndrcvinfo)) == -1) { + &msghdr, sizeof(struct msghdr)) == -1) { fprintf(fp, "0x%lx", args[sc->offset]); break; } - fprintf(fp, "{sid=%u,", info.sinfo_stream); - if (sc->type & OUT) { - fprintf(fp, "ssn=%u,", info.sinfo_ssn); - } - fputs("flgs=", fp); - sysdecode_sctp_sinfo_flags(fp, info.sinfo_flags); - fprintf(fp, ",ppid=%u,", ntohl(info.sinfo_ppid)); - /* Can't use IN here, since IN is 0 */ - if ((sc->type & OUT) == 0) { - fprintf(fp, "ctx=%u,", info.sinfo_context); - fprintf(fp, "ttl=%u,", info.sinfo_timetolive); - } - if (sc->type & OUT) { - fprintf(fp, "tsn=%u,", info.sinfo_tsn); - fprintf(fp, "cumtsn=%u,", info.sinfo_cumtsn); - } - fprintf(fp, "id=%u}", info.sinfo_assoc_id); + fputs("{", fp); + print_sockaddr(fp, trussinfo, msghdr.msg_name, msghdr.msg_namelen); + fprintf(fp, ",%d,", msghdr.msg_namelen); + print_iovec(fp, trussinfo, msghdr.msg_iov, msghdr.msg_iovlen); + fprintf(fp, ",%d,", msghdr.msg_iovlen); + print_cmsgs(fp, pid, sc->type & OUT, &msghdr); + fprintf(fp, ",%u,", msghdr.msg_controllen); + print_mask_arg(sysdecode_msg_flags, fp, msghdr.msg_flags); + fputs("}", fp); break; } From owner-svn-src-stable-11@freebsd.org Sat Apr 7 21:06:40 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02EB2F857AD; Sat, 7 Apr 2018 21:06:40 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AA60E76F35; Sat, 7 Apr 2018 21:06:39 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A43E426083; Sat, 7 Apr 2018 21:06:39 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37L6d1k009509; Sat, 7 Apr 2018 21:06:39 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37L6dl3009508; Sat, 7 Apr 2018 21:06:39 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072106.w37L6dl3009508@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 21:06:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332250 - stable/11/lib/libsysdecode X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/lib/libsysdecode X-SVN-Commit-Revision: 332250 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 21:06:40 -0000 Author: tuexen Date: Sat Apr 7 21:06:39 2018 New Revision: 332250 URL: https://svnweb.freebsd.org/changeset/base/332250 Log: MFC r328033: Bump date, which I missed in r328014. Thanks to jhb@ for reporting. Modified: stable/11/lib/libsysdecode/sysdecode_mask.3 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libsysdecode/sysdecode_mask.3 ============================================================================== --- stable/11/lib/libsysdecode/sysdecode_mask.3 Sat Apr 7 21:05:39 2018 (r332249) +++ stable/11/lib/libsysdecode/sysdecode_mask.3 Sat Apr 7 21:06:39 2018 (r332250) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 24, 2017 +.Dd January 16, 2018 .Dt sysdecode_mask 3 .Os .Sh NAME From owner-svn-src-stable-11@freebsd.org Sat Apr 7 21:07:48 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 699F3F858CA; Sat, 7 Apr 2018 21:07:48 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 14ADD77990; Sat, 7 Apr 2018 21:07:48 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0EB1126085; Sat, 7 Apr 2018 21:07:48 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37L7lYO009601; Sat, 7 Apr 2018 21:07:47 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37L7lEs009600; Sat, 7 Apr 2018 21:07:47 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072107.w37L7lEs009600@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 21:07:47 +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: r332251 - stable/11/usr.bin/truss X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/usr.bin/truss X-SVN-Commit-Revision: 332251 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 21:07:48 -0000 Author: tuexen Date: Sat Apr 7 21:07:47 2018 New Revision: 332251 URL: https://svnweb.freebsd.org/changeset/base/332251 Log: MFC r328058: Using %p already prints "0x", so don't do it explicitly. Modified: stable/11/usr.bin/truss/syscalls.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/truss/syscalls.c ============================================================================== --- stable/11/usr.bin/truss/syscalls.c Sat Apr 7 21:06:39 2018 (r332250) +++ stable/11/usr.bin/truss/syscalls.c Sat Apr 7 21:07:47 2018 (r332251) @@ -1159,14 +1159,14 @@ print_sockaddr(FILE *fp, struct trussinfo *trussinfo, } /* If the length is too small, just bail. */ if (len < sizeof(*sa)) { - fprintf(fp, "0x%p", arg); + fprintf(fp, "%p", arg); return; } sa = calloc(1, len); if (get_struct(pid, arg, sa, len) == -1) { free(sa); - fprintf(fp, "0x%p", arg); + fprintf(fp, "%p", arg); return; } @@ -1223,7 +1223,7 @@ print_iovec(FILE *fp, struct trussinfo *trussinfo, voi bool buf_truncated, iov_truncated; if (iovcnt <= 0) { - fprintf(fp, "0x%p", arg); + fprintf(fp, "%p", arg); return; } if (iovcnt > IOV_LIMIT) { @@ -1233,7 +1233,7 @@ print_iovec(FILE *fp, struct trussinfo *trussinfo, voi iov_truncated = false; } if (get_struct(pid, arg, &iov, iovcnt * sizeof(struct iovec)) == -1) { - fprintf(fp, "0x%p", arg); + fprintf(fp, "%p", arg); return; } @@ -1261,7 +1261,7 @@ print_iovec(FILE *fp, struct trussinfo *trussinfo, voi buf_truncated ? "..." : ""); free(tmp3); } else { - fprintf(fp, "0x%p", iov[i].iov_base); + fprintf(fp, "%p", iov[i].iov_base); } fprintf(fp, ",%zu}", iov[i].iov_len); } @@ -1478,7 +1478,7 @@ print_cmsgs(FILE *fp, pid_t pid, bool recv, struct msg len = msghdr->msg_controllen; cmsgbuf = calloc(1, len); if (get_struct(pid, msghdr->msg_control, cmsgbuf, len) == -1) { - fprintf(fp, "0x%p", msghdr); + fprintf(fp, "%p", msghdr->msg_control); free(cmsgbuf); } msghdr->msg_control = cmsgbuf; From owner-svn-src-stable-11@freebsd.org Sat Apr 7 21:08:44 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CCDDEF85A17; Sat, 7 Apr 2018 21:08:44 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7817F7828C; Sat, 7 Apr 2018 21:08:44 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F9B126086; Sat, 7 Apr 2018 21:08:44 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37L8ip1009688; Sat, 7 Apr 2018 21:08:44 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37L8iWU009687; Sat, 7 Apr 2018 21:08:44 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072108.w37L8iWU009687@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 21:08: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: r332252 - stable/11/usr.bin/truss X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/usr.bin/truss X-SVN-Commit-Revision: 332252 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 21:08:45 -0000 Author: tuexen Date: Sat Apr 7 21:08:44 2018 New Revision: 332252 URL: https://svnweb.freebsd.org/changeset/base/332252 Log: MFC r328059: Improve the printing of cmgs when the length is 0. Fix error handling. Modified: stable/11/usr.bin/truss/syscalls.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/truss/syscalls.c ============================================================================== --- stable/11/usr.bin/truss/syscalls.c Sat Apr 7 21:07:47 2018 (r332251) +++ stable/11/usr.bin/truss/syscalls.c Sat Apr 7 21:08:44 2018 (r332252) @@ -1476,10 +1476,15 @@ print_cmsgs(FILE *fp, pid_t pid, bool recv, struct msg bool first; len = msghdr->msg_controllen; + if (len == 0) { + fputs("{}", fp); + return; + } cmsgbuf = calloc(1, len); if (get_struct(pid, msghdr->msg_control, cmsgbuf, len) == -1) { fprintf(fp, "%p", msghdr->msg_control); free(cmsgbuf); + return; } msghdr->msg_control = cmsgbuf; first = true; From owner-svn-src-stable-11@freebsd.org Sat Apr 7 21:09:52 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 43269F85B6D; Sat, 7 Apr 2018 21:09:52 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E34DC78CAD; Sat, 7 Apr 2018 21:09:51 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DD6AF26087; Sat, 7 Apr 2018 21:09:51 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37L9pY0009778; Sat, 7 Apr 2018 21:09:51 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37L9pkv009777; Sat, 7 Apr 2018 21:09:51 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072109.w37L9pkv009777@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 21:09:51 +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: r332253 - stable/11/usr.bin/truss X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/usr.bin/truss X-SVN-Commit-Revision: 332253 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 21:09:52 -0000 Author: tuexen Date: Sat Apr 7 21:09:51 2018 New Revision: 332253 URL: https://svnweb.freebsd.org/changeset/base/332253 Log: MFC r328081: Add missing assignment to make sure non-first cmsgs are handled as such. Modified: stable/11/usr.bin/truss/syscalls.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/truss/syscalls.c ============================================================================== --- stable/11/usr.bin/truss/syscalls.c Sat Apr 7 21:08:44 2018 (r332252) +++ stable/11/usr.bin/truss/syscalls.c Sat Apr 7 21:09:51 2018 (r332253) @@ -1514,6 +1514,7 @@ print_cmsgs(FILE *fp, pid_t pid, bool recv, struct msg break; } fputs("}", fp); + first = false; } fputs("}", fp); free(cmsgbuf); From owner-svn-src-stable-11@freebsd.org Sat Apr 7 21:12:17 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 772B5F85F07; Sat, 7 Apr 2018 21:12:17 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 27D427A3E4; Sat, 7 Apr 2018 21:12:17 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2111626204; Sat, 7 Apr 2018 21:12:17 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37LCHV8014751; Sat, 7 Apr 2018 21:12:17 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37LCHkT014750; Sat, 7 Apr 2018 21:12:17 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072112.w37LCHkT014750@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 21:12:16 +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: r332254 - stable/11/sys/netinet/libalias X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet/libalias X-SVN-Commit-Revision: 332254 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 21:12:17 -0000 Author: tuexen Date: Sat Apr 7 21:12:16 2018 New Revision: 332254 URL: https://svnweb.freebsd.org/changeset/base/332254 Log: MFC r327205: Fix an assignment. While there, do some whitespace cleanups. CID: 1008936 Modified: stable/11/sys/netinet/libalias/alias_sctp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/libalias/alias_sctp.c ============================================================================== --- stable/11/sys/netinet/libalias/alias_sctp.c Sat Apr 7 21:09:51 2018 (r332253) +++ stable/11/sys/netinet/libalias/alias_sctp.c Sat Apr 7 21:12:16 2018 (r332254) @@ -2116,31 +2116,31 @@ FindSctpGlobal(struct libalias *la, struct in_addr g_a * @return pointer to association or NULL */ static struct sctp_nat_assoc* -FindSctpLocalT(struct libalias *la, struct in_addr g_addr, uint32_t l_vtag, uint16_t g_port, uint16_t l_port) +FindSctpLocalT(struct libalias *la, struct in_addr g_addr, uint32_t l_vtag, uint16_t g_port, uint16_t l_port) { u_int i; struct sctp_nat_assoc *assoc = NULL, *lastmatch = NULL; struct sctp_GlobalAddress *G_Addr = NULL; int cnt = 0; - + if (l_vtag != 0) { /* an init packet, vtag==0 */ i = SN_TABLE_HASH(l_vtag, g_port, la->sctpNatTableSize); LIST_FOREACH(assoc, &la->sctpTableGlobal[i], list_G) { if ((assoc->g_vtag == l_vtag) && (assoc->g_port == g_port) && (assoc->l_port == l_port)) { if (assoc->num_Gaddr) { LIST_FOREACH(G_Addr, &(assoc->Gaddr), list_Gaddr) { - if(G_Addr->g_addr.s_addr == G_Addr->g_addr.s_addr) - return(assoc); /* full match */ + if (G_Addr->g_addr.s_addr == g_addr.s_addr) + return (assoc); /* full match */ } } else { - if (++cnt > 1) return(NULL); + if (++cnt > 1) return (NULL); lastmatch = assoc; } } } } /* If there is more than one match we do not know which local address to send to */ - return( cnt ? lastmatch : NULL ); + return (cnt ? lastmatch : NULL); } /** @ingroup Hash From owner-svn-src-stable-11@freebsd.org Sat Apr 7 21:22:30 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 567D2F86A79; Sat, 7 Apr 2018 21:22:30 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 03BC67FCD9; Sat, 7 Apr 2018 21:22:30 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F21B7263B1; Sat, 7 Apr 2018 21:22:29 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37LMTCY019593; Sat, 7 Apr 2018 21:22:29 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37LMTNX019592; Sat, 7 Apr 2018 21:22:29 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072122.w37LMTNX019592@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 21:22:29 +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: r332255 - stable/11/sys/netinet/libalias X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet/libalias X-SVN-Commit-Revision: 332255 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 21:22:30 -0000 Author: tuexen Date: Sat Apr 7 21:22:29 2018 New Revision: 332255 URL: https://svnweb.freebsd.org/changeset/base/332255 Log: Clarify that the break is not missing. CID: 1008198 Modified: stable/11/sys/netinet/libalias/alias_sctp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/libalias/alias_sctp.c ============================================================================== --- stable/11/sys/netinet/libalias/alias_sctp.c Sat Apr 7 21:12:16 2018 (r332254) +++ stable/11/sys/netinet/libalias/alias_sctp.c Sat Apr 7 21:22:29 2018 (r332255) @@ -1374,6 +1374,7 @@ AddGlobalIPAddresses(struct sctp_nat_msg *sm, struct s case SCTP_ADD_IP_ADDRESS: /* skip to address parameter - leave param_size so bytes left will be calculated properly*/ param = (struct sctp_paramhdr *) &((struct sctp_asconf_addrv4_param *) param)->addrp; + /* FALLTHROUGH */ case SCTP_IPV4_ADDRESS: ipv4_param = (struct sctp_ipv4addr_param *) param; /* add addresses to association */ From owner-svn-src-stable-11@freebsd.org Sat Apr 7 21:24:18 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E0B34F86CA5; Sat, 7 Apr 2018 21:24:17 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8E43C80C9A; Sat, 7 Apr 2018 21:24:17 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 88239263B7; Sat, 7 Apr 2018 21:24:17 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37LOH1l019712; Sat, 7 Apr 2018 21:24:17 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37LOH6E019711; Sat, 7 Apr 2018 21:24:17 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072124.w37LOH6E019711@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 21:24:17 +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: r332256 - stable/11/sys/netinet/libalias X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet/libalias X-SVN-Commit-Revision: 332256 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 21:24:18 -0000 Author: tuexen Date: Sat Apr 7 21:24:17 2018 New Revision: 332256 URL: https://svnweb.freebsd.org/changeset/base/332256 Log: MFC r327209: Clarify that there is no break missing. While there, cleanup whitespaces. Modified: stable/11/sys/netinet/libalias/alias_sctp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/libalias/alias_sctp.c ============================================================================== --- stable/11/sys/netinet/libalias/alias_sctp.c Sat Apr 7 21:22:29 2018 (r332255) +++ stable/11/sys/netinet/libalias/alias_sctp.c Sat Apr 7 21:24:17 2018 (r332256) @@ -1735,27 +1735,28 @@ ProcessSctpMsg(struct libalias *la, int direction, str static int ID_process(struct libalias *la, int direction, struct sctp_nat_assoc *assoc, struct sctp_nat_msg *sm) { - switch(sm->msg) { + switch (sm->msg) { case SN_SCTP_ASCONF: /* a packet containing an ASCONF chunk with ADDIP */ if (!sysctl_accept_global_ootb_addip && (direction == SN_TO_LOCAL)) - return(SN_DROP_PKT); + return (SN_DROP_PKT); /* if this Asconf packet does not contain the Vtag parameters it is of no use in Idle state */ if (!GetAsconfVtags(la, sm, &(assoc->l_vtag), &(assoc->g_vtag), direction)) - return(SN_DROP_PKT); + return (SN_DROP_PKT); + /* FALLTHROUGH */ case SN_SCTP_INIT: /* a packet containing an INIT chunk or an ASCONF AddIP */ if (sysctl_track_global_addresses) AddGlobalIPAddresses(sm, assoc, direction); - switch(direction){ + switch (direction) { case SN_TO_GLOBAL: assoc->l_addr = sm->ip_hdr->ip_src; assoc->a_addr = FindAliasAddress(la, assoc->l_addr); assoc->l_port = sm->sctp_hdr->src_port; assoc->g_port = sm->sctp_hdr->dest_port; - if(sm->msg == SN_SCTP_INIT) + if (sm->msg == SN_SCTP_INIT) assoc->g_vtag = sm->sctpchnk.Init->initiate_tag; if (AddSctpAssocGlobal(la, assoc)) /* DB clash *///**** need to add dst address return((sm->msg == SN_SCTP_INIT) ? SN_REPLY_ABORT : SN_REPLY_ERROR); - if(sm->msg == SN_SCTP_ASCONF) { + if (sm->msg == SN_SCTP_ASCONF) { if (AddSctpAssocLocal(la, assoc, sm->ip_hdr->ip_dst)) /* DB clash */ return(SN_REPLY_ERROR); assoc->TableRegister |= SN_WAIT_TOLOCAL; /* wait for tolocal ack */ @@ -1766,25 +1767,25 @@ ID_process(struct libalias *la, int direction, struct assoc->a_addr = sm->ip_hdr->ip_dst; assoc->l_port = sm->sctp_hdr->dest_port; assoc->g_port = sm->sctp_hdr->src_port; - if(sm->msg == SN_SCTP_INIT) + if (sm->msg == SN_SCTP_INIT) assoc->l_vtag = sm->sctpchnk.Init->initiate_tag; if (AddSctpAssocLocal(la, assoc, sm->ip_hdr->ip_src)) /* DB clash */ return((sm->msg == SN_SCTP_INIT) ? SN_REPLY_ABORT : SN_REPLY_ERROR); - if(sm->msg == SN_SCTP_ASCONF) { + if (sm->msg == SN_SCTP_ASCONF) { if (AddSctpAssocGlobal(la, assoc)) /* DB clash */ //**** need to add src address return(SN_REPLY_ERROR); assoc->TableRegister |= SN_WAIT_TOGLOBAL; /* wait for toglobal ack */ } break; } - assoc->state = (sm->msg == SN_SCTP_INIT) ? SN_INi : SN_INa; - assoc->exp = SN_I_T(la); - sctp_AddTimeOut(la,assoc); - return(SN_NAT_PKT); + assoc->state = (sm->msg == SN_SCTP_INIT) ? SN_INi : SN_INa; + assoc->exp = SN_I_T(la); + sctp_AddTimeOut(la,assoc); + return (SN_NAT_PKT); default: /* Any other type of SCTP message is not valid in Idle */ - return(SN_DROP_PKT); + return (SN_DROP_PKT); } -return(SN_DROP_PKT);/* shouldn't get here very bad: log, drop and hope for the best */ + return (SN_DROP_PKT);/* shouldn't get here very bad: log, drop and hope for the best */ } /** @ingroup state_machine From owner-svn-src-stable-11@freebsd.org Sat Apr 7 21:25:30 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4373FF86DDF; Sat, 7 Apr 2018 21:25:30 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E551981767; Sat, 7 Apr 2018 21:25:29 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DF86F263B9; Sat, 7 Apr 2018 21:25:29 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w37LPTTN019824; Sat, 7 Apr 2018 21:25:29 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w37LPTcE019823; Sat, 7 Apr 2018 21:25:29 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804072125.w37LPTcE019823@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Apr 2018 21:25:29 +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: r332257 - stable/11/sys/netinet/libalias X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet/libalias X-SVN-Commit-Revision: 332257 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Apr 2018 21:25:30 -0000 Author: tuexen Date: Sat Apr 7 21:25:29 2018 New Revision: 332257 URL: https://svnweb.freebsd.org/changeset/base/332257 Log: MFC r327214: Whitespace changes. Modified: stable/11/sys/netinet/libalias/alias_sctp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/libalias/alias_sctp.c ============================================================================== --- stable/11/sys/netinet/libalias/alias_sctp.c Sat Apr 7 21:24:17 2018 (r332256) +++ stable/11/sys/netinet/libalias/alias_sctp.c Sat Apr 7 21:25:29 2018 (r332257) @@ -25,7 +25,7 @@ */ /* - * Alias_sctp forms part of the libalias kernel module to handle + * Alias_sctp forms part of the libalias kernel module to handle * Network Address Translation (NAT) for the SCTP protocol. * * This software was developed by David A. Hayes and Jason But @@ -37,13 +37,13 @@ * proposed by Jason But and Grenville Armitage: * http://caia.swin.edu.au/urp/sonata/ * - * + * * This project has been made possible in part by a grant from * the Cisco University Research Program Fund at Community * Foundation Silicon Valley. * */ -/** @mainpage +/** @mainpage * Alias_sctp is part of the SONATA (http://caia.swin.edu.au/urp/sonata) project * to develop and release a BSD licensed implementation of a Network Address * Translation (NAT) module that supports the Stream Control Transmission @@ -174,7 +174,7 @@ static void SctpAliasLog(const char *format, ...); * * Calls the higher level ShowAliasStats() in alias_db.c which logs all current * statistics about the libalias instance - including SCTP statistics - * + * * @param la Pointer to the libalias instance */ void SctpShowAliasStats(struct libalias *la); @@ -259,7 +259,7 @@ static MALLOC_DEFINE(M_SCTPNAT, "sctpnat", "sctp nat d * Define various log levels and a macro to call specified log functions only if * the current log level (sysctl_log_level) matches the specified level @{ */ -#define SN_LOG_LOW 0 +#define SN_LOG_LOW 0 #define SN_LOG_EVENT 1 #define SN_LOG_INFO 2 #define SN_LOG_DETAIL 3 @@ -420,8 +420,8 @@ int sysctl_chg_loglevel(SYSCTL_HANDLER_ARGS) error = sysctl_handle_int(oidp, &level, 0, req); if (error) return (error); - level = (level > SN_LOG_DEBUG_MAX)?(SN_LOG_DEBUG_MAX):(level); - level = (level < SN_LOG_LOW)?(SN_LOG_LOW):(level); + level = (level > SN_LOG_DEBUG_MAX) ? (SN_LOG_DEBUG_MAX) : (level); + level = (level < SN_LOG_LOW) ? (SN_LOG_LOW) : (level); sysctl_log_level = level; return (0); } @@ -441,12 +441,11 @@ int sysctl_chg_timer(SYSCTL_HANDLER_ARGS) error = sysctl_handle_int(oidp, &timer, 0, req); if (error) return (error); - timer = (timer > SN_MAX_TIMER)?(SN_MAX_TIMER):(timer); + timer = (timer > SN_MAX_TIMER) ? (SN_MAX_TIMER) : (timer); - if (((u_int *)arg1) != &sysctl_holddown_timer) - { - timer = (timer < SN_MIN_TIMER)?(SN_MIN_TIMER):(timer); - } + if (((u_int *)arg1) != &sysctl_holddown_timer) { + timer = (timer < SN_MIN_TIMER) ? (SN_MIN_TIMER) : (timer); + } *(u_int *)arg1 = timer; @@ -470,11 +469,11 @@ int sysctl_chg_hashtable_size(SYSCTL_HANDLER_ARGS) error = sysctl_handle_int(oidp, &size, 0, req); if (error) return (error); - size = (size < SN_MIN_HASH_SIZE)?(SN_MIN_HASH_SIZE):((size > SN_MAX_HASH_SIZE)?(SN_MAX_HASH_SIZE):(size)); + size = (size < SN_MIN_HASH_SIZE) ? (SN_MIN_HASH_SIZE) : ((size > SN_MAX_HASH_SIZE) ? (SN_MAX_HASH_SIZE) : (size)); size |= 0x00000001; /* make odd */ - for(;(((size % 3) == 0) || ((size % 5) == 0) || ((size % 7) == 0) || ((size % 11) == 0)); size+=2); + for (;(((size % 3) == 0) || ((size % 5) == 0) || ((size % 7) == 0) || ((size % 11) == 0)); size+=2); sysctl_hashtable_size = size; return (0); @@ -483,7 +482,7 @@ int sysctl_chg_hashtable_size(SYSCTL_HANDLER_ARGS) /** @ingroup sysctl * @brief sysctl callback for changing net.inet.ip.alias.sctp.error_on_ootb * - * Updates the error_on_clash sysctl variable. + * Updates the error_on_clash sysctl variable. * If set to 0, no ErrorM will be sent if there is a look up table clash * If set to 1, an ErrorM is sent only to the local side * If set to 2, an ErrorM is sent to the local side and global side if there is @@ -538,16 +537,16 @@ int sysctl_chg_initialising_chunk_proc_limit(SYSCTL_HA if (error) return (error); sysctl_initialising_chunk_proc_limit = (proclimit < 1) ? 1: proclimit; - sysctl_chunk_proc_limit = + sysctl_chunk_proc_limit = (sysctl_chunk_proc_limit < sysctl_initialising_chunk_proc_limit) ? sysctl_initialising_chunk_proc_limit : sysctl_chunk_proc_limit; - + return (0); } /** @ingroup sysctl * @brief sysctl callback for changing net.inet.ip.alias.sctp.chunk_proc_limit * - * Updates the chunk_proc_limit sysctl variable. + * Updates the chunk_proc_limit sysctl variable. * Number of chunks that should be processed to find key chunk: * >= initialising_chunk_proc_limit (A high value is a DoS risk) */ @@ -559,7 +558,7 @@ int sysctl_chg_chunk_proc_limit(SYSCTL_HANDLER_ARGS) error = sysctl_handle_int(oidp, &proclimit, 0, req); if (error) return (error); - sysctl_chunk_proc_limit = + sysctl_chunk_proc_limit = (proclimit < sysctl_initialising_chunk_proc_limit) ? sysctl_initialising_chunk_proc_limit : proclimit; return (0); @@ -569,7 +568,7 @@ int sysctl_chg_chunk_proc_limit(SYSCTL_HANDLER_ARGS) /** @ingroup sysctl * @brief sysctl callback for changing net.inet.ip.alias.sctp.param_proc_limit * - * Updates the param_proc_limit sysctl variable. + * Updates the param_proc_limit sysctl variable. * Number of parameters that should be processed to find key parameters: * > 1 (A high value is a DoS risk) */ @@ -581,7 +580,7 @@ int sysctl_chg_param_proc_limit(SYSCTL_HANDLER_ARGS) error = sysctl_handle_int(oidp, &proclimit, 0, req); if (error) return (error); - sysctl_param_proc_limit = + sysctl_param_proc_limit = (proclimit < 2) ? 2 : proclimit; return (0); @@ -612,9 +611,9 @@ int sysctl_chg_track_global_addresses(SYSCTL_HANDLER_A * CODE BEGINS HERE * ---------------------------------------------------------------------- */ -/** +/** * @brief Initialises the SCTP NAT Implementation - * + * * Creates the look-up tables and the timer queue and initialises all state * variables * @@ -648,7 +647,7 @@ void AliasSctpInit(struct libalias *la) la->sctpLinkCount = 0; } -/** +/** * @brief Cleans-up the SCTP NAT Implementation prior to unloading * * Removes all entries from the timer queue, freeing associations as it goes. @@ -703,7 +702,7 @@ void AliasSctpTerm(struct libalias *la) * @param la Pointer to the relevant libalias instance * @param pip Pointer to IP packet to process * @param direction SN_TO_LOCAL | SN_TO_GLOBAL - * + * * @return PKT_ALIAS_OK | PKT_ALIAS_IGNORE | PKT_ALIAS_ERROR */ int @@ -715,10 +714,10 @@ SctpAlias(struct libalias *la, struct ip *pip, int dir if ((direction != SN_TO_LOCAL) && (direction != SN_TO_GLOBAL)) { SctpAliasLog("ERROR: Invalid direction\n"); - return(PKT_ALIAS_ERROR); + return (PKT_ALIAS_ERROR); } - sctp_CheckTimers(la); /* Check timers */ + sctp_CheckTimers(la); /* Check timers */ /* Parse the packet */ rtnval = sctp_PktParser(la, direction, pip, &msg, &assoc); //using *char (change to mbuf when get code from paolo) @@ -733,24 +732,24 @@ SctpAlias(struct libalias *la, struct ip *pip, int dir } SN_LOG(SN_LOG_EVENT, logsctperror("SN_PARSE_ERROR", msg.sctp_hdr->v_tag, rtnval, direction)); - return(PKT_ALIAS_ERROR); + return (PKT_ALIAS_ERROR); case SN_PARSE_ERROR_PARTIALLOOKUP: if (sysctl_error_on_ootb > SN_LOCALandPARTIAL_ERROR_ON_OOTB) { SN_LOG(SN_LOG_EVENT, logsctperror("SN_PARSE_ERROR", msg.sctp_hdr->v_tag, rtnval, direction)); - return(PKT_ALIAS_ERROR); + return (PKT_ALIAS_ERROR); } case SN_PARSE_ERROR_LOOKUP: if (sysctl_error_on_ootb == SN_ERROR_ON_OOTB || (sysctl_error_on_ootb == SN_LOCALandPARTIAL_ERROR_ON_OOTB && direction == SN_TO_LOCAL) || (sysctl_error_on_ootb == SN_LOCAL_ERROR_ON_OOTB && direction == SN_TO_GLOBAL)) { TxAbortErrorM(la, &msg, assoc, SN_REFLECT_ERROR, direction); /*NB assoc=NULL */ - return(PKT_ALIAS_RESPOND); + return (PKT_ALIAS_RESPOND); } default: SN_LOG(SN_LOG_EVENT, logsctperror("SN_PARSE_ERROR", msg.sctp_hdr->v_tag, rtnval, direction)); - return(PKT_ALIAS_ERROR); + return (PKT_ALIAS_ERROR); } SN_LOG(SN_LOG_DETAIL, @@ -768,9 +767,9 @@ SctpAlias(struct libalias *la, struct ip *pip, int dir ); SN_LOG(SN_LOG_DEBUG, logTimerQ(la)); - switch(rtnval){ + switch (rtnval) { case SN_NAT_PKT: - switch(direction) { + switch (direction) { case SN_TO_LOCAL: DifferentialChecksum(&(msg.ip_hdr->ip_sum), &(assoc->l_addr), &(msg.ip_hdr->ip_dst), 2); @@ -792,7 +791,7 @@ SctpAlias(struct libalias *la, struct ip *pip, int dir break; case SN_REPLY_ABORT: case SN_REPLY_ERROR: - case SN_SEND_ABORT: + case SN_SEND_ABORT: TxAbortErrorM(la, &msg, assoc, rtnval, direction); break; default: @@ -812,22 +811,22 @@ SctpAlias(struct libalias *la, struct ip *pip, int dir freeGlobalAddressList(assoc); sn_free(assoc); } - switch(rtnval) { + switch (rtnval) { case SN_NAT_PKT: - return(PKT_ALIAS_OK); + return (PKT_ALIAS_OK); case SN_SEND_ABORT: - return(PKT_ALIAS_OK); + return (PKT_ALIAS_OK); case SN_REPLY_ABORT: case SN_REPLY_ERROR: case SN_REFLECT_ERROR: - return(PKT_ALIAS_RESPOND); + return (PKT_ALIAS_RESPOND); case SN_DROP_PKT: default: - return(PKT_ALIAS_ERROR); + return (PKT_ALIAS_ERROR); } } -/** +/** * @brief Send an AbortM or ErrorM * * We construct the new SCTP packet to send in place of the existing packet we @@ -863,7 +862,7 @@ SctpAlias(struct libalias *la, struct ip *pip, int dir static uint32_t local_sctp_finalize_crc32(uint32_t crc32c) { - /* This routine is duplicated from SCTP + /* This routine is duplicated from SCTP * we need to do that since it MAY be that SCTP * is NOT compiled into the kernel. The CRC32C routines * however are always available in libkern. @@ -922,7 +921,7 @@ TxAbortErrorM(struct libalias *la, struct sctp_nat_msg ip->ip_hl = 5; /* 5*32 bit words */ ip->ip_tos = 0; ip->ip_len = htons(ip_size); - ip->ip_id = sm->ip_hdr->ip_id; + ip->ip_id = sm->ip_hdr->ip_id; ip->ip_off = 0; ip->ip_ttl = 255; ip->ip_p = IPPROTO_SCTP; @@ -935,7 +934,7 @@ TxAbortErrorM(struct libalias *la, struct sctp_nat_msg chunk_hdr->chunk_type = (sndrply & SN_TX_ABORT) ? SCTP_ABORT_ASSOCIATION : SCTP_OPERATION_ERROR; chunk_hdr->chunk_flags = SCTP_MIDDLEBOX_FLAG; if (include_error_cause) { - error_cause->code = htons((sndrply & SN_REFLECT_ERROR) ? SCTP_MISSING_NAT : SCTP_NAT_TABLE_COLLISION); + error_cause->code = htons((sndrply & SN_REFLECT_ERROR) ? SCTP_MISSING_NAT : SCTP_NAT_TABLE_COLLISION); error_cause->length = htons(sizeof(struct sctp_error_cause)); chunk_hdr->chunk_length = htons(sizeof(*chunk_hdr) + sizeof(struct sctp_error_cause)); } else { @@ -943,22 +942,22 @@ TxAbortErrorM(struct libalias *la, struct sctp_nat_msg } /* set specific values */ - switch(sndrply) { + switch (sndrply) { case SN_REFLECT_ERROR: chunk_hdr->chunk_flags |= SCTP_HAD_NO_TCB; /* set Tbit */ - sctp_hdr->v_tag = sm->sctp_hdr->v_tag; + sctp_hdr->v_tag = sm->sctp_hdr->v_tag; break; case SN_REPLY_ERROR: - sctp_hdr->v_tag = (direction == SN_TO_LOCAL) ? assoc->g_vtag : assoc->l_vtag ; + sctp_hdr->v_tag = (direction == SN_TO_LOCAL) ? assoc->g_vtag : assoc->l_vtag ; break; case SN_SEND_ABORT: - sctp_hdr->v_tag = sm->sctp_hdr->v_tag; + sctp_hdr->v_tag = sm->sctp_hdr->v_tag; break; case SN_REPLY_ABORT: sctp_hdr->v_tag = sm->sctpchnk.Init->initiate_tag; break; } - + /* Set send/reply values */ if (sndrply == SN_SEND_ABORT) { /*pass through NAT */ ip->ip_src = (direction == SN_TO_LOCAL) ? sm->ip_hdr->ip_src : assoc->a_addr; @@ -971,10 +970,10 @@ TxAbortErrorM(struct libalias *la, struct sctp_nat_msg sctp_hdr->src_port = sm->sctp_hdr->dest_port; sctp_hdr->dest_port = sm->sctp_hdr->src_port; } - + /* Calculate IP header checksum */ ip->ip_sum = in_cksum_hdr(ip); - + /* calculate SCTP header CRC32 */ sctp_hdr->checksum = 0; sctp_hdr->checksum = local_sctp_finalize_crc32(calculate_crc32c(0xffffffff, (unsigned char *) sctp_hdr, sctp_size)); @@ -1001,18 +1000,18 @@ TxAbortErrorM(struct libalias *la, struct sctp_nat_msg */ /** @ingroup packet_parser * @brief Parses SCTP packets for the key SCTP chunk that will be processed - * + * * This module parses SCTP packets for the key SCTP chunk that will be processed * The module completes the sctp_nat_msg structure and either retrieves the * relevant (existing) stored association from the Hash Tables or creates a new * association entity with state SN_ID * * @param la Pointer to the relevant libalias instance - * @param direction SN_TO_LOCAL | SN_TO_GLOBAL - * @param pip + * @param direction SN_TO_LOCAL | SN_TO_GLOBAL + * @param pip * @param sm Pointer to sctp message information * @param passoc Pointer to the association this SCTP Message belongs to - * + * * @return SN_PARSE_OK | SN_PARSE_ERROR_* */ static int @@ -1047,26 +1046,26 @@ sctp_PktParser(struct libalias *la, int direction, str /* Check SCTP header length and move to first chunk */ if (bytes_left < sizeof(struct sctphdr)) { sm->sctp_hdr = NULL; - return(SN_PARSE_ERROR_IPSHL); /* packet not long enough*/ + return (SN_PARSE_ERROR_IPSHL); /* packet not long enough*/ } sm->sctp_hdr = sctp_hdr = (struct sctphdr *) ip_next(pip); bytes_left -= sizeof(struct sctphdr); - + /* Check for valid ports (zero valued ports would find partially initialised associations */ if (sctp_hdr->src_port == 0 || sctp_hdr->dest_port == 0) - return(SN_PARSE_ERROR_PORT); + return (SN_PARSE_ERROR_PORT); /* Check length of first chunk */ if (bytes_left < SN_MIN_CHUNK_SIZE) /* malformed chunk - could cause endless loop*/ - return(SN_PARSE_ERROR_CHHL); /* packet not long enough for this chunk */ - + return (SN_PARSE_ERROR_CHHL); /* packet not long enough for this chunk */ + /* First chunk */ chunk_hdr = SN_SCTP_FIRSTCHUNK(sctp_hdr); - + chunk_length = SCTP_SIZE32(ntohs(chunk_hdr->chunk_length)); if ((chunk_length < SN_MIN_CHUNK_SIZE) || (chunk_length > bytes_left)) /* malformed chunk - could cause endless loop*/ - return(SN_PARSE_ERROR_CHHL); + return (SN_PARSE_ERROR_CHHL); if ((chunk_hdr->chunk_flags & SCTP_HAD_NO_TCB) && ((chunk_hdr->chunk_type == SCTP_ABORT_ASSOCIATION) || @@ -1089,43 +1088,43 @@ sctp_PktParser(struct libalias *la, int direction, str sm->msg = SN_SCTP_OTHER;/* Initialise to largest value*/ sm->chunk_length = 0; /* only care about length for key chunks */ while (IS_SCTP_CONTROL(chunk_hdr)) { - switch(chunk_hdr->chunk_type) { + switch (chunk_hdr->chunk_type) { case SCTP_INITIATION: if (chunk_length < sizeof(struct sctp_init_chunk)) /* malformed chunk*/ - return(SN_PARSE_ERROR_CHHL); + return (SN_PARSE_ERROR_CHHL); sm->msg = SN_SCTP_INIT; sm->sctpchnk.Init = (struct sctp_init *) ((char *) chunk_hdr + sizeof(struct sctp_chunkhdr)); sm->chunk_length = chunk_length; /* if no existing association, create a new one */ if (*passoc == NULL) { - if (sctp_hdr->v_tag == 0){ //Init requires vtag=0 + if (sctp_hdr->v_tag == 0) { //Init requires vtag=0 *passoc = (struct sctp_nat_assoc *) sn_malloc(sizeof(struct sctp_nat_assoc)); - if (*passoc == NULL) {/* out of resources */ - return(SN_PARSE_ERROR_AS_MALLOC); + if (*passoc == NULL) {/* out of resources */ + return (SN_PARSE_ERROR_AS_MALLOC); } /* Initialise association - malloc initialises memory to zeros */ (*passoc)->state = SN_ID; LIST_INIT(&((*passoc)->Gaddr)); /* always initialise to avoid memory problems */ (*passoc)->TableRegister = SN_NULL_TBL; - return(SN_PARSE_OK); + return (SN_PARSE_OK); } - return(SN_PARSE_ERROR_VTAG); + return (SN_PARSE_ERROR_VTAG); } - return(SN_PARSE_ERROR_LOOKUP); + return (SN_PARSE_ERROR_LOOKUP); case SCTP_INITIATION_ACK: if (chunk_length < sizeof(struct sctp_init_ack_chunk)) /* malformed chunk*/ - return(SN_PARSE_ERROR_CHHL); + return (SN_PARSE_ERROR_CHHL); sm->msg = SN_SCTP_INITACK; sm->sctpchnk.InitAck = (struct sctp_init_ack *) ((char *) chunk_hdr + sizeof(struct sctp_chunkhdr)); sm->chunk_length = chunk_length; - return ((*passoc == NULL)?(SN_PARSE_ERROR_LOOKUP):(SN_PARSE_OK)); + return ((*passoc == NULL) ? (SN_PARSE_ERROR_LOOKUP) : (SN_PARSE_OK)); case SCTP_ABORT_ASSOCIATION: /* access only minimum sized chunk */ sm->msg = SN_SCTP_ABORT; sm->chunk_length = chunk_length; - return ((*passoc == NULL)?(SN_PARSE_ERROR_LOOKUP_ABORT):(SN_PARSE_OK)); + return ((*passoc == NULL) ? (SN_PARSE_ERROR_LOOKUP_ABORT) : (SN_PARSE_OK)); case SCTP_SHUTDOWN_ACK: if (chunk_length < sizeof(struct sctp_shutdown_ack_chunk)) /* malformed chunk*/ - return(SN_PARSE_ERROR_CHHL); + return (SN_PARSE_ERROR_CHHL); if (sm->msg > SN_SCTP_SHUTACK) { sm->msg = SN_SCTP_SHUTACK; sm->chunk_length = chunk_length; @@ -1136,11 +1135,11 @@ sctp_PktParser(struct libalias *la, int direction, str sm->msg = SN_SCTP_SHUTCOMP; sm->chunk_length = chunk_length; } - return ((*passoc == NULL)?(SN_PARSE_ERROR_LOOKUP):(SN_PARSE_OK)); + return ((*passoc == NULL) ? (SN_PARSE_ERROR_LOOKUP) : (SN_PARSE_OK)); case SCTP_ASCONF: if (sm->msg > SN_SCTP_ASCONF) { if (chunk_length < (sizeof(struct sctp_asconf_chunk) + sizeof(struct sctp_ipv4addr_param))) /* malformed chunk*/ - return(SN_PARSE_ERROR_CHHL); + return (SN_PARSE_ERROR_CHHL); //leave parameter searching to later, if required param_hdr = (struct sctp_paramhdr *) ((char *) chunk_hdr + sizeof(struct sctp_asconf_chunk)); /*compulsory IP parameter*/ if (ntohs(param_hdr->param_type) == SCTP_IPV4_ADDRESS) { @@ -1149,38 +1148,38 @@ sctp_PktParser(struct libalias *la, int direction, str ipv4addr.s_addr = ((struct sctp_ipv4addr_param *) param_hdr)->addr; *passoc = FindSctpGlobal(la, ipv4addr, sctp_hdr->v_tag, sctp_hdr->src_port, sctp_hdr->dest_port, &partial_match); } - param_hdr = (struct sctp_paramhdr *) + param_hdr = (struct sctp_paramhdr *) ((char *) param_hdr + sizeof(struct sctp_ipv4addr_param)); /*asconf's compulsory address parameter */ sm->chunk_length = chunk_length - sizeof(struct sctp_asconf_chunk) - sizeof(struct sctp_ipv4addr_param); /* rest of chunk */ } else { if (chunk_length < (sizeof(struct sctp_asconf_chunk) + sizeof(struct sctp_ipv6addr_param))) /* malformed chunk*/ - return(SN_PARSE_ERROR_CHHL); - param_hdr = (struct sctp_paramhdr *) - ((char *) param_hdr + sizeof(struct sctp_ipv6addr_param)); /*asconf's compulsory address parameter */ + return (SN_PARSE_ERROR_CHHL); + param_hdr = (struct sctp_paramhdr *) + ((char *) param_hdr + sizeof(struct sctp_ipv6addr_param)); /*asconf's compulsory address parameter */ sm->chunk_length = chunk_length - sizeof(struct sctp_asconf_chunk) - sizeof(struct sctp_ipv6addr_param); /* rest of chunk */ } sm->msg = SN_SCTP_ASCONF; sm->sctpchnk.Asconf = param_hdr; - + if (*passoc == NULL) { /* AddIP with no association */ *passoc = (struct sctp_nat_assoc *) sn_malloc(sizeof(struct sctp_nat_assoc)); - if (*passoc == NULL) {/* out of resources */ - return(SN_PARSE_ERROR_AS_MALLOC); + if (*passoc == NULL) {/* out of resources */ + return (SN_PARSE_ERROR_AS_MALLOC); } /* Initialise association - malloc initialises memory to zeros */ (*passoc)->state = SN_ID; LIST_INIT(&((*passoc)->Gaddr)); /* always initialise to avoid memory problems */ (*passoc)->TableRegister = SN_NULL_TBL; - return(SN_PARSE_OK); + return (SN_PARSE_OK); } } break; case SCTP_ASCONF_ACK: if (sm->msg > SN_SCTP_ASCONFACK) { if (chunk_length < sizeof(struct sctp_asconf_ack_chunk)) /* malformed chunk*/ - return(SN_PARSE_ERROR_CHHL); + return (SN_PARSE_ERROR_CHHL); //leave parameter searching to later, if required - param_hdr = (struct sctp_paramhdr *) ((char *) chunk_hdr + param_hdr = (struct sctp_paramhdr *) ((char *) chunk_hdr + sizeof(struct sctp_asconf_ack_chunk)); sm->msg = SN_SCTP_ASCONFACK; sm->sctpchnk.Asconf = param_hdr; @@ -1193,33 +1192,33 @@ sctp_PktParser(struct libalias *la, int direction, str /* if no association is found exit - we need to find an Init or AddIP within sysctl_initialising_chunk_proc_limit */ if ((*passoc == NULL) && (chunk_count >= sysctl_initialising_chunk_proc_limit)) - return(SN_PARSE_ERROR_LOOKUP); + return (SN_PARSE_ERROR_LOOKUP); /* finished with this chunk, on to the next chunk*/ bytes_left-= chunk_length; /* Is this the end of the packet ? */ if (bytes_left == 0) - return (*passoc == NULL)?(SN_PARSE_ERROR_LOOKUP):(SN_PARSE_OK); + return (*passoc == NULL) ? (SN_PARSE_ERROR_LOOKUP) : (SN_PARSE_OK); /* Are there enough bytes in packet to at least retrieve length of next chunk ? */ if (bytes_left < SN_MIN_CHUNK_SIZE) - return(SN_PARSE_ERROR_CHHL); + return (SN_PARSE_ERROR_CHHL); chunk_hdr = SN_SCTP_NEXTCHUNK(chunk_hdr); /* Is the chunk long enough to not cause endless look and are there enough bytes in packet to read the chunk ? */ chunk_length = SCTP_SIZE32(ntohs(chunk_hdr->chunk_length)); if ((chunk_length < SN_MIN_CHUNK_SIZE) || (chunk_length > bytes_left)) - return(SN_PARSE_ERROR_CHHL); - if(++chunk_count > sysctl_chunk_proc_limit) - return(SN_PARSE_OK); /* limit for processing chunks, take what we get */ + return (SN_PARSE_ERROR_CHHL); + if (++chunk_count > sysctl_chunk_proc_limit) + return (SN_PARSE_OK); /* limit for processing chunks, take what we get */ } if (*passoc == NULL) - return (partial_match)?(SN_PARSE_ERROR_PARTIALLOOKUP):(SN_PARSE_ERROR_LOOKUP); + return (partial_match) ? (SN_PARSE_ERROR_PARTIALLOOKUP) : (SN_PARSE_ERROR_LOOKUP); else - return(SN_PARSE_OK); + return (SN_PARSE_OK); } /** @ingroup packet_parser @@ -1227,7 +1226,7 @@ sctp_PktParser(struct libalias *la, int direction, str * * GetAsconfVtags scans an Asconf Chunk for the vtags parameter, and then * extracts the vtags. - * + * * GetAsconfVtags is not called from within sctp_PktParser. It is called only * from within ID_process when an AddIP has been received. * @@ -1235,9 +1234,9 @@ sctp_PktParser(struct libalias *la, int direction, str * @param sm Pointer to sctp message information * @param l_vtag Pointer to the local vtag in the association this SCTP Message belongs to * @param g_vtag Pointer to the local vtag in the association this SCTP Message belongs to - * @param direction SN_TO_LOCAL | SN_TO_GLOBAL - * - * @return 1 - success | 0 - fail + * @param direction SN_TO_LOCAL | SN_TO_GLOBAL + * + * @return 1 - success | 0 - fail */ static int GetAsconfVtags(struct libalias *la, struct sctp_nat_msg *sm, uint32_t *l_vtag, uint32_t *g_vtag, int direction) @@ -1249,7 +1248,7 @@ GetAsconfVtags(struct libalias *la, struct sctp_nat_ms uint32_t local_vtag; uint32_t remote_vtag; } __attribute__((packed)); - + struct sctp_vtag_param *vtag_param; struct sctp_paramhdr *param; int bytes_left; @@ -1264,7 +1263,7 @@ GetAsconfVtags(struct libalias *la, struct sctp_nat_ms while((bytes_left >= param_size) && (bytes_left >= SN_VTAG_PARAM_SIZE)) { if (ntohs(param->param_type) == SCTP_VTAG_PARAM) { vtag_param = (struct sctp_vtag_param *) param; - switch(direction) { + switch (direction) { /* The Internet draft is a little ambigious as to order of these vtags. We think it is this way around. If we are wrong, the order will need to be changed. */ @@ -1277,11 +1276,11 @@ GetAsconfVtags(struct libalias *la, struct sctp_nat_ms *l_vtag = vtag_param->local_vtag; break; } - return(1); /* found */ + return (1); /* found */ } bytes_left -= param_size; - if (bytes_left < SN_MIN_PARAM_SIZE) return(0); + if (bytes_left < SN_MIN_PARAM_SIZE) return (0); param = SN_SCTP_NEXTPARAM(param); param_size = SCTP_SIZE32(ntohs(param->param_length)); @@ -1289,22 +1288,22 @@ GetAsconfVtags(struct libalias *la, struct sctp_nat_ms SN_LOG(SN_LOG_EVENT, logsctperror("Parameter parse limit exceeded (GetAsconfVtags)", sm->sctp_hdr->v_tag, sysctl_param_proc_limit, direction)); - return(0); /* not found limit exceeded*/ + return (0); /* not found limit exceeded*/ } } - return(0); /* not found */ + return (0); /* not found */ } /** @ingroup packet_parser * @brief AddGlobalIPAddresses from Init,InitAck,or AddIP packets - * + * * AddGlobalIPAddresses scans an SCTP chunk (in sm) for Global IP addresses, and * adds them. * * @param sm Pointer to sctp message information * @param assoc Pointer to the association this SCTP Message belongs to - * @param direction SN_TO_LOCAL | SN_TO_GLOBAL - * + * @param direction SN_TO_LOCAL | SN_TO_GLOBAL + * */ static void AddGlobalIPAddresses(struct sctp_nat_msg *sm, struct sctp_nat_assoc *assoc, int direction) @@ -1317,7 +1316,7 @@ AddGlobalIPAddresses(struct sctp_nat_msg *sm, struct s int param_size; int param_count, addr_param_count = 0; - switch(direction) { + switch (direction) { case SN_TO_GLOBAL: /* does not contain global addresses */ g_addr = sm->ip_hdr->ip_dst; bytes_left = 0; /* force exit */ @@ -1325,7 +1324,7 @@ AddGlobalIPAddresses(struct sctp_nat_msg *sm, struct s case SN_TO_LOCAL: g_addr = sm->ip_hdr->ip_src; param_count = 1; - switch(sm->msg) { + switch (sm->msg) { case SN_SCTP_INIT: bytes_left = sm->chunk_length - sizeof(struct sctp_init_chunk); param = (struct sctp_paramhdr *)((char *)sm->sctpchnk.Init + sizeof(struct sctp_init)); @@ -1340,16 +1339,16 @@ AddGlobalIPAddresses(struct sctp_nat_msg *sm, struct s break; } } - if (bytes_left >= SN_MIN_PARAM_SIZE) + if (bytes_left >= SN_MIN_PARAM_SIZE) param_size = SCTP_SIZE32(ntohs(param->param_length)); else param_size = bytes_left+1; /* force skip loop */ - - if ((assoc->state == SN_ID) && ((sm->msg == SN_SCTP_INIT) || (bytes_left < SN_MIN_PARAM_SIZE))) {/* add pkt address */ + + if ((assoc->state == SN_ID) && ((sm->msg == SN_SCTP_INIT) || (bytes_left < SN_MIN_PARAM_SIZE))) {/* add pkt address */ G_Addr = (struct sctp_GlobalAddress *) sn_malloc(sizeof(struct sctp_GlobalAddress)); - if (G_Addr == NULL) {/* out of resources */ + if (G_Addr == NULL) {/* out of resources */ SN_LOG(SN_LOG_EVENT, - logsctperror("AddGlobalIPAddress: No resources for adding global address - revert to no tracking", + logsctperror("AddGlobalIPAddress: No resources for adding global address - revert to no tracking", sm->sctp_hdr->v_tag, 0, direction)); assoc->num_Gaddr = 0; /* don't track any more for this assoc*/ sysctl_track_global_addresses=0; @@ -1358,7 +1357,7 @@ AddGlobalIPAddresses(struct sctp_nat_msg *sm, struct s G_Addr->g_addr = g_addr; if (!Add_Global_Address_to_List(assoc, G_Addr)) SN_LOG(SN_LOG_EVENT, - logsctperror("AddGlobalIPAddress: Address already in list", + logsctperror("AddGlobalIPAddress: Address already in list", sm->sctp_hdr->v_tag, assoc->num_Gaddr, direction)); } @@ -1366,11 +1365,11 @@ AddGlobalIPAddresses(struct sctp_nat_msg *sm, struct s while((bytes_left >= param_size) && (bytes_left >= sizeof(struct sctp_ipv4addr_param))) { if (assoc->num_Gaddr >= sysctl_track_global_addresses) { SN_LOG(SN_LOG_EVENT, - logsctperror("AddGlobalIPAddress: Maximum Number of addresses reached", + logsctperror("AddGlobalIPAddress: Maximum Number of addresses reached", sm->sctp_hdr->v_tag, sysctl_track_global_addresses, direction)); return; } - switch(ntohs(param->param_type)) { + switch (ntohs(param->param_type)) { case SCTP_ADD_IP_ADDRESS: /* skip to address parameter - leave param_size so bytes left will be calculated properly*/ param = (struct sctp_paramhdr *) &((struct sctp_asconf_addrv4_param *) param)->addrp; @@ -1379,9 +1378,9 @@ AddGlobalIPAddresses(struct sctp_nat_msg *sm, struct s ipv4_param = (struct sctp_ipv4addr_param *) param; /* add addresses to association */ G_Addr = (struct sctp_GlobalAddress *) sn_malloc(sizeof(struct sctp_GlobalAddress)); - if (G_Addr == NULL) {/* out of resources */ + if (G_Addr == NULL) {/* out of resources */ SN_LOG(SN_LOG_EVENT, - logsctperror("AddGlobalIPAddress: No resources for adding global address - revert to no tracking", + logsctperror("AddGlobalIPAddress: No resources for adding global address - revert to no tracking", sm->sctp_hdr->v_tag, 0, direction)); assoc->num_Gaddr = 0; /* don't track any more for this assoc*/ sysctl_track_global_addresses=0; @@ -1393,22 +1392,22 @@ AddGlobalIPAddresses(struct sctp_nat_msg *sm, struct s G_Addr->g_addr = g_addr; if (!Add_Global_Address_to_List(assoc, G_Addr)) SN_LOG(SN_LOG_EVENT, - logsctperror("AddGlobalIPAddress: Address already in list", + logsctperror("AddGlobalIPAddress: Address already in list", sm->sctp_hdr->v_tag, assoc->num_Gaddr, direction)); return; /*shouldn't be any other addresses if the zero address is given*/ } else { G_Addr->g_addr.s_addr = ipv4_param->addr; if (!Add_Global_Address_to_List(assoc, G_Addr)) SN_LOG(SN_LOG_EVENT, - logsctperror("AddGlobalIPAddress: Address already in list", + logsctperror("AddGlobalIPAddress: Address already in list", sm->sctp_hdr->v_tag, assoc->num_Gaddr, direction)); } - } - + } + bytes_left -= param_size; if (bytes_left < SN_MIN_PARAM_SIZE) break; - + param = SN_SCTP_NEXTPARAM(param); param_size = SCTP_SIZE32(ntohs(param->param_length)); if (++param_count > sysctl_param_proc_limit) { @@ -1420,39 +1419,39 @@ AddGlobalIPAddresses(struct sctp_nat_msg *sm, struct s } if (addr_param_count == 0) { SN_LOG(SN_LOG_DETAIL, - logsctperror("AddGlobalIPAddress: no address parameters to add", + logsctperror("AddGlobalIPAddress: no address parameters to add", sm->sctp_hdr->v_tag, assoc->num_Gaddr, direction)); } } -/** +/** * @brief Add_Global_Address_to_List * * Adds a global IP address to an associations address list, if it is not * already there. The first address added us usually the packet's address, and * is most likely to be used, so it is added at the beginning. Subsequent * addresses are added after this one. - * + * * @param assoc Pointer to the association this SCTP Message belongs to * @param G_addr Pointer to the global address to add * - * @return 1 - success | 0 - fail + * @return 1 - success | 0 - fail */ static int Add_Global_Address_to_List(struct sctp_nat_assoc *assoc, struct sctp_GlobalAddress *G_addr) { - struct sctp_GlobalAddress *iter_G_Addr = NULL, *first_G_Addr = NULL; - first_G_Addr = LIST_FIRST(&(assoc->Gaddr)); + struct sctp_GlobalAddress *iter_G_Addr = NULL, *first_G_Addr = NULL; + first_G_Addr = LIST_FIRST(&(assoc->Gaddr)); if (first_G_Addr == NULL) { LIST_INSERT_HEAD(&(assoc->Gaddr), G_addr, list_Gaddr); /* add new address to beginning of list*/ } else { LIST_FOREACH(iter_G_Addr, &(assoc->Gaddr), list_Gaddr) { if (G_addr->g_addr.s_addr == iter_G_Addr->g_addr.s_addr) - return(0); /* already exists, so don't add */ + return (0); /* already exists, so don't add */ } LIST_INSERT_AFTER(first_G_Addr, G_addr, list_Gaddr); /* add address to end of list*/ } - assoc->num_Gaddr++; - return(1); /* success */ + assoc->num_Gaddr++; + return (1); /* success */ } /** @ingroup packet_parser @@ -1465,8 +1464,8 @@ static int Add_Global_Address_to_List(struct sctp_nat * * @param sm Pointer to sctp message information * @param assoc Pointer to the association this SCTP Message belongs to - * @param direction SN_TO_LOCAL | SN_TO_GLOBAL - * + * @param direction SN_TO_LOCAL | SN_TO_GLOBAL + * */ static void RmGlobalIPAddresses(struct sctp_nat_msg *sm, struct sctp_nat_assoc *assoc, int direction) @@ -1479,7 +1478,7 @@ RmGlobalIPAddresses(struct sctp_nat_msg *sm, struct sc int param_size; int param_count; - if(direction == SN_TO_GLOBAL) + if (direction == SN_TO_GLOBAL) g_addr = sm->ip_hdr->ip_dst; else g_addr = sm->ip_hdr->ip_src; @@ -1487,29 +1486,29 @@ RmGlobalIPAddresses(struct sctp_nat_msg *sm, struct sc bytes_left = sm->chunk_length; param_count = 1; param = sm->sctpchnk.Asconf; - if (bytes_left >= SN_MIN_PARAM_SIZE) { + if (bytes_left >= SN_MIN_PARAM_SIZE) { param_size = SCTP_SIZE32(ntohs(param->param_length)); } else { SN_LOG(SN_LOG_EVENT, - logsctperror("RmGlobalIPAddress: truncated packet - cannot remove IP addresses", + logsctperror("RmGlobalIPAddress: truncated packet - cannot remove IP addresses", sm->sctp_hdr->v_tag, sysctl_track_global_addresses, direction)); return; } - + /* step through Asconf parameters */ while((bytes_left >= param_size) && (bytes_left >= sizeof(struct sctp_ipv4addr_param))) { if (ntohs(param->param_type) == SCTP_DEL_IP_ADDRESS) { asconf_ipv4_param = (struct sctp_asconf_addrv4_param *) param; if (asconf_ipv4_param->addrp.addr == INADDR_ANY) { /* remove all bar pkt address */ LIST_FOREACH_SAFE(G_Addr, &(assoc->Gaddr), list_Gaddr, G_Addr_tmp) { - if(G_Addr->g_addr.s_addr != sm->ip_hdr->ip_src.s_addr) { + if (G_Addr->g_addr.s_addr != sm->ip_hdr->ip_src.s_addr) { if (assoc->num_Gaddr > 1) { /* only delete if more than one */ LIST_REMOVE(G_Addr, list_Gaddr); sn_free(G_Addr); assoc->num_Gaddr--; } else { SN_LOG(SN_LOG_EVENT, - logsctperror("RmGlobalIPAddress: Request to remove last IP address (didn't)", + logsctperror("RmGlobalIPAddress: Request to remove last IP address (didn't)", sm->sctp_hdr->v_tag, assoc->num_Gaddr, direction)); } } @@ -1517,7 +1516,7 @@ RmGlobalIPAddresses(struct sctp_nat_msg *sm, struct sc return; /*shouldn't be any other addresses if the zero address is given*/ } else { LIST_FOREACH_SAFE(G_Addr, &(assoc->Gaddr), list_Gaddr, G_Addr_tmp) { - if(G_Addr->g_addr.s_addr == asconf_ipv4_param->addrp.addr) { + if (G_Addr->g_addr.s_addr == asconf_ipv4_param->addrp.addr) { if (assoc->num_Gaddr > 1) { /* only delete if more than one */ LIST_REMOVE(G_Addr, list_Gaddr); sn_free(G_Addr); @@ -1525,22 +1524,22 @@ RmGlobalIPAddresses(struct sctp_nat_msg *sm, struct sc break; /* Since add only adds new addresses, there should be no double entries */ } else { SN_LOG(SN_LOG_EVENT, - logsctperror("RmGlobalIPAddress: Request to remove last IP address (didn't)", + logsctperror("RmGlobalIPAddress: Request to remove last IP address (didn't)", sm->sctp_hdr->v_tag, assoc->num_Gaddr, direction)); } } } } - } + } bytes_left -= param_size; if (bytes_left == 0) return; else if (bytes_left < SN_MIN_PARAM_SIZE) { SN_LOG(SN_LOG_EVENT, - logsctperror("RmGlobalIPAddress: truncated packet - may not have removed all IP addresses", + logsctperror("RmGlobalIPAddress: truncated packet - may not have removed all IP addresses", sm->sctp_hdr->v_tag, sysctl_track_global_addresses, direction)); return; } - + param = SN_SCTP_NEXTPARAM(param); param_size = SCTP_SIZE32(ntohs(param->param_length)); if (++param_count > sysctl_param_proc_limit) { @@ -1567,11 +1566,11 @@ RmGlobalIPAddresses(struct sctp_nat_msg *sm, struct sc * Since there is currently no connection on this path, there should be no other * ASCONF configuration parameters outstanding, so we presume that if there is * an ACK that it is responding to the AddIP and activate the new association. - * + * * @param la Pointer to the relevant libalias instance * @param sm Pointer to sctp message information - * @param direction SN_TO_LOCAL | SN_TO_GLOBAL - * + * @param direction SN_TO_LOCAL | SN_TO_GLOBAL + * * @return 1 - success | 0 - fail */ static int @@ -1586,45 +1585,45 @@ IsASCONFack(struct libalias *la, struct sctp_nat_msg * param = sm->sctpchnk.Asconf; param_size = SCTP_SIZE32(ntohs(param->param_length)); if (param_size == 8) - return(1); /*success - default acknowledgement of everything */ + return (1); /*success - default acknowledgement of everything */ bytes_left = sm->chunk_length; if (bytes_left < param_size) - return(0); /* not found */ + return (0); /* not found */ /* step through Asconf parameters */ while(bytes_left >= SN_ASCONFACK_PARAM_SIZE) { if (ntohs(param->param_type) == SCTP_SUCCESS_REPORT) - return(1); /* success - but can't match correlation IDs - should only be one */ + return (1); /* success - but can't match correlation IDs - should only be one */ /* check others just in case */ bytes_left -= param_size; if (bytes_left >= SN_MIN_PARAM_SIZE) { param = SN_SCTP_NEXTPARAM(param); } else { - return(0); + return (0); } param_size = SCTP_SIZE32(ntohs(param->param_length)); - if (bytes_left < param_size) return(0); + if (bytes_left < param_size) return (0); if (++param_count > sysctl_param_proc_limit) { SN_LOG(SN_LOG_EVENT, - logsctperror("Parameter parse limit exceeded (IsASCONFack)", + logsctperror("Parameter parse limit exceeded (IsASCONFack)", sm->sctp_hdr->v_tag, sysctl_param_proc_limit, direction)); - return(0); /* not found limit exceeded*/ + return (0); /* not found limit exceeded*/ } } - return(0); /* not success */ + return (0); /* not success */ } /** @ingroup packet_parser - * @brief Check to see if ASCONF contains an Add IP or Del IP parameter - * + * @brief Check to see if ASCONF contains an Add IP or Del IP parameter + * * IsADDorDEL scans an ASCONF packet to see if it contains an AddIP or DelIP * parameter * * @param la Pointer to the relevant libalias instance * @param sm Pointer to sctp message information - * @param direction SN_TO_LOCAL | SN_TO_GLOBAL - * + * @param direction SN_TO_LOCAL | SN_TO_GLOBAL + * * @return SCTP_ADD_IP_ADDRESS | SCTP_DEL_IP_ADDRESS | 0 - fail */ static int @@ -1641,31 +1640,31 @@ IsADDorDEL(struct libalias *la, struct sctp_nat_msg *s bytes_left = sm->chunk_length; if (bytes_left < param_size) - return(0); /* not found */ + return (0); /* not found */ /* step through Asconf parameters */ while(bytes_left >= SN_ASCONFACK_PARAM_SIZE) { if (ntohs(param->param_type) == SCTP_ADD_IP_ADDRESS) - return(SCTP_ADD_IP_ADDRESS); - else if (ntohs(param->param_type) == SCTP_DEL_IP_ADDRESS) - return(SCTP_DEL_IP_ADDRESS); + return (SCTP_ADD_IP_ADDRESS); + else if (ntohs(param->param_type) == SCTP_DEL_IP_ADDRESS) + return (SCTP_DEL_IP_ADDRESS); /* check others just in case */ bytes_left -= param_size; if (bytes_left >= SN_MIN_PARAM_SIZE) { param = SN_SCTP_NEXTPARAM(param); } else { - return(0); /*Neither found */ + return (0); /*Neither found */ } param_size = SCTP_SIZE32(ntohs(param->param_length)); - if (bytes_left < param_size) return(0); + if (bytes_left < param_size) return (0); if (++param_count > sysctl_param_proc_limit) { SN_LOG(SN_LOG_EVENT, - logsctperror("Parameter parse limit exceeded IsADDorDEL)", + logsctperror("Parameter parse limit exceeded IsADDorDEL)", sm->sctp_hdr->v_tag, sysctl_param_proc_limit, direction)); - return(0); /* not found limit exceeded*/ + return (0); /* not found limit exceeded*/ } } - return(0); /*Neither found */ + return (0); /*Neither found */ } /* ---------------------------------------------------------------------- @@ -1688,7 +1687,7 @@ IsADDorDEL(struct libalias *la, struct sctp_nat_msg *s * each state. * * @param la Pointer to the relevant libalias instance - * @param direction SN_TO_LOCAL | SN_TO_GLOBAL + * @param direction SN_TO_LOCAL | SN_TO_GLOBAL * @param sm Pointer to sctp message information * @param assoc Pointer to the association this SCTP Message belongs to * @@ -1705,17 +1704,17 @@ ProcessSctpMsg(struct libalias *la, int direction, str *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***