From owner-svn-src-stable-12@freebsd.org Sun Aug 23 17:34:21 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F172E3C2E98; Sun, 23 Aug 2020 17:34: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZMnT65V1z3cwN; Sun, 23 Aug 2020 17:34: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 B4757ABBD; Sun, 23 Aug 2020 17:34: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 07NHYL7v094388; Sun, 23 Aug 2020 17:34:21 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NHYLrs094387; Sun, 23 Aug 2020 17:34:21 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008231734.07NHYLrs094387@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 23 Aug 2020 17:34:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364501 - in stable/12/sys: amd64/acpica i386/acpica X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/12/sys: amd64/acpica i386/acpica X-SVN-Commit-Revision: 364501 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 17:34:22 -0000 Author: markj Date: Sun Aug 23 17:34:21 2020 New Revision: 364501 URL: https://svnweb.freebsd.org/changeset/base/364501 Log: MFC r364411: Use pmap_mapbios() to map ACPI tables on amd64 and i386. PR: 248746 Modified: stable/12/sys/amd64/acpica/acpi_machdep.c stable/12/sys/i386/acpica/acpi_machdep.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/acpica/acpi_machdep.c ============================================================================== --- stable/12/sys/amd64/acpica/acpi_machdep.c Sun Aug 23 11:06:59 2020 (r364500) +++ stable/12/sys/amd64/acpica/acpi_machdep.c Sun Aug 23 17:34:21 2020 (r364501) @@ -91,91 +91,29 @@ acpi_machdep_quirks(int *quirks) } /* - * Support for mapping ACPI tables during early boot. Currently this - * uses the crashdump map to map each table. However, the crashdump - * map is created in pmap_bootstrap() right after the direct map, so - * we should be able to just use pmap_mapbios() here instead. - * - * This makes the following assumptions about how we use this KVA: - * pages 0 and 1 are used to map in the header of each table found via - * the RSDT or XSDT and pages 2 to n are used to map in the RSDT or - * XSDT. This has to use 2 pages for the table headers in case a - * header spans a page boundary. - * - * XXX: We don't ensure the table fits in the available address space - * in the crashdump map. + * Map a table. First map the header to determine the table length and then map + * the entire table. */ - -/* - * Map some memory using the crashdump map. 'offset' is an offset in - * pages into the crashdump map to use for the start of the mapping. - */ static void * -table_map(vm_paddr_t pa, int offset, vm_offset_t length) +map_table(vm_paddr_t pa, const char *sig) { - vm_offset_t va, off; - void *data; - - off = pa & PAGE_MASK; - length = round_page(length + off); - pa = pa & PG_FRAME; - va = (vm_offset_t)pmap_kenter_temporary(pa, offset) + - (offset * PAGE_SIZE); - data = (void *)(va + off); - length -= PAGE_SIZE; - while (length > 0) { - va += PAGE_SIZE; - pa += PAGE_SIZE; - length -= PAGE_SIZE; - pmap_kenter(va, pa); - invlpg(va); - } - return (data); -} - -/* Unmap memory previously mapped with table_map(). */ -static void -table_unmap(void *data, vm_offset_t length) -{ - vm_offset_t va, off; - - va = (vm_offset_t)data; - off = va & PAGE_MASK; - length = round_page(length + off); - va &= ~PAGE_MASK; - while (length > 0) { - pmap_kremove(va); - invlpg(va); - va += PAGE_SIZE; - length -= PAGE_SIZE; - } -} - -/* - * Map a table at a given offset into the crashdump map. It first - * maps the header to determine the table length and then maps the - * entire table. - */ -static void * -map_table(vm_paddr_t pa, int offset, const char *sig) -{ ACPI_TABLE_HEADER *header; vm_offset_t length; void *table; - header = table_map(pa, offset, sizeof(ACPI_TABLE_HEADER)); + header = pmap_mapbios(pa, sizeof(ACPI_TABLE_HEADER)); if (strncmp(header->Signature, sig, ACPI_NAMESEG_SIZE) != 0) { - table_unmap(header, sizeof(ACPI_TABLE_HEADER)); + pmap_unmapbios((vm_offset_t)header, sizeof(ACPI_TABLE_HEADER)); return (NULL); } length = header->Length; - table_unmap(header, sizeof(ACPI_TABLE_HEADER)); - table = table_map(pa, offset, length); + pmap_unmapbios((vm_offset_t)header, sizeof(ACPI_TABLE_HEADER)); + table = pmap_mapbios(pa, length); if (ACPI_FAILURE(AcpiTbChecksum(table, length))) { if (bootverbose) printf("ACPI: Failed checksum for table %s\n", sig); #if (ACPI_CHECKSUM_ABORT) - table_unmap(table, length); + pmap_unmapbios((vm_offset_t)table, length); return (NULL); #endif } @@ -190,24 +128,15 @@ static int probe_table(vm_paddr_t address, const char *sig) { ACPI_TABLE_HEADER *table; + int ret; - table = table_map(address, 0, sizeof(ACPI_TABLE_HEADER)); - if (table == NULL) { - if (bootverbose) - printf("ACPI: Failed to map table at 0x%jx\n", - (uintmax_t)address); - return (0); - } + table = pmap_mapbios(address, sizeof(ACPI_TABLE_HEADER)); + ret = strncmp(table->Signature, sig, ACPI_NAMESEG_SIZE) == 0; if (bootverbose) printf("Table '%.4s' at 0x%jx\n", table->Signature, (uintmax_t)address); - - if (strncmp(table->Signature, sig, ACPI_NAMESEG_SIZE) != 0) { - table_unmap(table, sizeof(ACPI_TABLE_HEADER)); - return (0); - } - table_unmap(table, sizeof(ACPI_TABLE_HEADER)); - return (1); + pmap_unmapbios((vm_offset_t)table, sizeof(ACPI_TABLE_HEADER)); + return (ret); } /* @@ -218,7 +147,7 @@ void * acpi_map_table(vm_paddr_t pa, const char *sig) { - return (map_table(pa, 0, sig)); + return (map_table(pa, sig)); } /* Unmap a table previously mapped via acpi_map_table(). */ @@ -228,7 +157,7 @@ acpi_unmap_table(void *table) ACPI_TABLE_HEADER *header; header = (ACPI_TABLE_HEADER *)table; - table_unmap(table, header->Length); + pmap_unmapbios((vm_offset_t)table, header->Length); } /* @@ -265,9 +194,7 @@ acpi_find_table(const char *sig) /* * For ACPI >= 2.0, use the XSDT if it is available. - * Otherwise, use the RSDT. We map the XSDT or RSDT at page 2 - * in the crashdump area. Pages 0 and 1 are used to map in the - * headers of candidate ACPI tables. + * Otherwise, use the RSDT. */ addr = 0; if (rsdp->Revision >= 2 && rsdp->XsdtPhysicalAddress != 0) { @@ -281,7 +208,7 @@ acpi_find_table(const char *sig) printf("ACPI: RSDP failed extended checksum\n"); return (0); } - xsdt = map_table(rsdp->XsdtPhysicalAddress, 2, ACPI_SIG_XSDT); + xsdt = map_table(rsdp->XsdtPhysicalAddress, ACPI_SIG_XSDT); if (xsdt == NULL) { if (bootverbose) printf("ACPI: Failed to map XSDT\n"); @@ -296,7 +223,7 @@ acpi_find_table(const char *sig) } acpi_unmap_table(xsdt); } else { - rsdt = map_table(rsdp->RsdtPhysicalAddress, 2, ACPI_SIG_RSDT); + rsdt = map_table(rsdp->RsdtPhysicalAddress, ACPI_SIG_RSDT); if (rsdt == NULL) { if (bootverbose) printf("ACPI: Failed to map RSDT\n"); @@ -324,7 +251,7 @@ acpi_find_table(const char *sig) * Verify that we can map the full table and that its checksum is * correct, etc. */ - table = map_table(addr, 0, sig); + table = map_table(addr, sig); if (table == NULL) return (0); acpi_unmap_table(table); Modified: stable/12/sys/i386/acpica/acpi_machdep.c ============================================================================== --- stable/12/sys/i386/acpica/acpi_machdep.c Sun Aug 23 11:06:59 2020 (r364500) +++ stable/12/sys/i386/acpica/acpi_machdep.c Sun Aug 23 17:34:21 2020 (r364501) @@ -109,89 +109,29 @@ acpi_machdep_quirks(int *quirks) } /* - * Support for mapping ACPI tables during early boot. This abuses the - * crashdump map because the kernel cannot allocate KVA in - * pmap_mapbios() when this is used. This makes the following - * assumptions about how we use this KVA: pages 0 and 1 are used to - * map in the header of each table found via the RSDT or XSDT and - * pages 2 to n are used to map in the RSDT or XSDT. This has to use - * 2 pages for the table headers in case a header spans a page - * boundary. - * - * XXX: We don't ensure the table fits in the available address space - * in the crashdump map. + * Map a table. First map the header to determine the table length and then map + * the entire table. */ - -/* - * Map some memory using the crashdump map. 'offset' is an offset in - * pages into the crashdump map to use for the start of the mapping. - */ static void * -table_map(vm_paddr_t pa, int offset, vm_offset_t length) +map_table(vm_paddr_t pa, const char *sig) { - vm_offset_t va, off; - void *data; - - off = pa & PAGE_MASK; - length = round_page(length + off); - pa = pa & PG_FRAME; - va = (vm_offset_t)pmap_kenter_temporary(pa, offset) + - (offset * PAGE_SIZE); - data = (void *)(va + off); - length -= PAGE_SIZE; - while (length > 0) { - va += PAGE_SIZE; - pa += PAGE_SIZE; - length -= PAGE_SIZE; - pmap_kenter(va, pa); - invlpg(va); - } - return (data); -} - -/* Unmap memory previously mapped with table_map(). */ -static void -table_unmap(void *data, vm_offset_t length) -{ - vm_offset_t va, off; - - va = (vm_offset_t)data; - off = va & PAGE_MASK; - length = round_page(length + off); - va &= ~PAGE_MASK; - while (length > 0) { - pmap_kremove(va); - invlpg(va); - va += PAGE_SIZE; - length -= PAGE_SIZE; - } -} - -/* - * Map a table at a given offset into the crashdump map. It first - * maps the header to determine the table length and then maps the - * entire table. - */ -static void * -map_table(vm_paddr_t pa, int offset, const char *sig) -{ ACPI_TABLE_HEADER *header; vm_offset_t length; void *table; - header = table_map(pa, offset, sizeof(ACPI_TABLE_HEADER)); + header = pmap_mapbios(pa, sizeof(ACPI_TABLE_HEADER)); if (strncmp(header->Signature, sig, ACPI_NAMESEG_SIZE) != 0) { - table_unmap(header, sizeof(ACPI_TABLE_HEADER)); + pmap_unmapbios((vm_offset_t)header, sizeof(ACPI_TABLE_HEADER)); return (NULL); } length = header->Length; - table_unmap(header, sizeof(ACPI_TABLE_HEADER)); - table = table_map(pa, offset, length); + pmap_unmapbios((vm_offset_t)header, sizeof(ACPI_TABLE_HEADER)); + table = pmap_mapbios(pa, length); if (ACPI_FAILURE(AcpiTbChecksum(table, length))) { if (bootverbose) printf("ACPI: Failed checksum for table %s\n", sig); #if (ACPI_CHECKSUM_ABORT) - table_unmap(table, length); + pmap_unmapbios((vm_offset_t)table, length); return (NULL); #endif } @@ -206,24 +146,15 @@ static int probe_table(vm_paddr_t address, const char *sig) { ACPI_TABLE_HEADER *table; + int ret; - table = table_map(address, 0, sizeof(ACPI_TABLE_HEADER)); - if (table == NULL) { - if (bootverbose) - printf("ACPI: Failed to map table at 0x%jx\n", - (uintmax_t)address); - return (0); - } + table = pmap_mapbios(address, sizeof(ACPI_TABLE_HEADER)); if (bootverbose) printf("Table '%.4s' at 0x%jx\n", table->Signature, (uintmax_t)address); - - if (strncmp(table->Signature, sig, ACPI_NAMESEG_SIZE) != 0) { - table_unmap(table, sizeof(ACPI_TABLE_HEADER)); - return (0); - } - table_unmap(table, sizeof(ACPI_TABLE_HEADER)); - return (1); + ret = strncmp(table->Signature, sig, ACPI_NAMESEG_SIZE) == 0; + pmap_unmapbios((vm_offset_t)table, sizeof(ACPI_TABLE_HEADER)); + return (ret); } /* @@ -234,7 +165,7 @@ void * acpi_map_table(vm_paddr_t pa, const char *sig) { - return (map_table(pa, 0, sig)); + return (map_table(pa, sig)); } /* Unmap a table previously mapped via acpi_map_table(). */ @@ -244,7 +175,7 @@ acpi_unmap_table(void *table) ACPI_TABLE_HEADER *header; header = (ACPI_TABLE_HEADER *)table; - table_unmap(table, header->Length); + pmap_unmapbios((vm_offset_t)table, header->Length); } /* @@ -281,9 +212,7 @@ acpi_find_table(const char *sig) /* * For ACPI >= 2.0, use the XSDT if it is available. - * Otherwise, use the RSDT. We map the XSDT or RSDT at page 2 - * in the crashdump area. Pages 0 and 1 are used to map in the - * headers of candidate ACPI tables. + * Otherwise, use the RSDT. */ addr = 0; if (rsdp->Revision >= 2 && rsdp->XsdtPhysicalAddress != 0) { @@ -297,7 +226,7 @@ acpi_find_table(const char *sig) printf("ACPI: RSDP failed extended checksum\n"); return (0); } - xsdt = map_table(rsdp->XsdtPhysicalAddress, 2, ACPI_SIG_XSDT); + xsdt = map_table(rsdp->XsdtPhysicalAddress, ACPI_SIG_XSDT); if (xsdt == NULL) { if (bootverbose) printf("ACPI: Failed to map XSDT\n"); @@ -312,7 +241,7 @@ acpi_find_table(const char *sig) } acpi_unmap_table(xsdt); } else { - rsdt = map_table(rsdp->RsdtPhysicalAddress, 2, ACPI_SIG_RSDT); + rsdt = map_table(rsdp->RsdtPhysicalAddress, ACPI_SIG_RSDT); if (rsdt == NULL) { if (bootverbose) printf("ACPI: Failed to map RSDT\n"); @@ -340,7 +269,7 @@ acpi_find_table(const char *sig) * Verify that we can map the full table and that its checksum is * correct, etc. */ - table = map_table(addr, 0, sig); + table = map_table(addr, sig); if (table == NULL) return (0); acpi_unmap_table(table); From owner-svn-src-stable-12@freebsd.org Sun Aug 23 17:46:11 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 525EA3C32AB; Sun, 23 Aug 2020 17:46:11 +0000 (UTC) (envelope-from leres@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZN37189fz3dm1; Sun, 23 Aug 2020 17:46:11 +0000 (UTC) (envelope-from leres@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 0A867AC70; Sun, 23 Aug 2020 17:46:11 +0000 (UTC) (envelope-from leres@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07NHkApe000966; Sun, 23 Aug 2020 17:46:10 GMT (envelope-from leres@FreeBSD.org) Received: (from leres@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NHkANZ000963; Sun, 23 Aug 2020 17:46:10 GMT (envelope-from leres@FreeBSD.org) Message-Id: <202008231746.07NHkANZ000963@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: leres set sender to leres@FreeBSD.org using -f From: Craig Leres Date: Sun, 23 Aug 2020 17:46:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364502 - in stable/12: contrib/netbsd-tests/usr.bin/grep usr.bin/grep X-SVN-Group: stable-12 X-SVN-Commit-Author: leres X-SVN-Commit-Paths: in stable/12: contrib/netbsd-tests/usr.bin/grep usr.bin/grep X-SVN-Commit-Revision: 364502 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 17:46:11 -0000 Author: leres (ports committer) Date: Sun Aug 23 17:46:10 2020 New Revision: 364502 URL: https://svnweb.freebsd.org/changeset/base/364502 Log: MFC r363381: Fix some regressions with the zgrep(1) wrapper. PR: 247126 Modified: stable/12/contrib/netbsd-tests/usr.bin/grep/t_grep.sh (contents, props changed) stable/12/usr.bin/grep/zgrep.1 stable/12/usr.bin/grep/zgrep.sh Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/netbsd-tests/usr.bin/grep/t_grep.sh ============================================================================== --- stable/12/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Sun Aug 23 17:34:21 2020 (r364501) +++ stable/12/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Sun Aug 23 17:46:10 2020 (r364502) @@ -214,6 +214,89 @@ zgrep_body() atf_check -o file:"$(atf_get_srcdir)/d_zgrep.out" zgrep -h line d_input.gz } +atf_test_case zgrep_combined_flags +zgrep_combined_flags_head() +{ + atf_set "descr" "Checks for zgrep wrapper problems with combined flags (PR 247126)" +} +zgrep_combined_flags_body() +{ + atf_expect_fail "known but unsolved zgrep wrapper script regression" + + echo 'foo bar' > test + + atf_check -o inline:"foo bar\n" zgrep -we foo test + # Avoid hang on reading from stdin in the failure case + atf_check -o inline:"foo bar\n" zgrep -wefoo test < /dev/null +} + +atf_test_case zgrep_eflag +zgrep_eflag_head() +{ + atf_set "descr" "Checks for zgrep wrapper problems with -e PATTERN (PR 247126)" +} +zgrep_eflag_body() +{ + echo 'foo bar' > test + + # Avoid hang on reading from stdin in the failure case + atf_check -o inline:"foo bar\n" zgrep -e 'foo bar' test < /dev/null + atf_check -o inline:"foo bar\n" zgrep --regexp='foo bar' test < /dev/null +} + +atf_test_case zgrep_fflag +zgrep_fflag_head() +{ + atf_set "descr" "Checks for zgrep wrapper problems with -f FILE (PR 247126)" +} +zgrep_fflag_body() +{ + echo foo > pattern + echo foobar > test + + # Avoid hang on reading from stdin in the failure case + atf_check -o inline:"foobar\n" zgrep -f pattern test test + + atf_check -o inline:"foobar\n" zgrep -e foo --ignore-case < test +} + +atf_test_case zgrep_multiple_eflags +zgrep_multiple_eflags_head() +{ + atf_set "descr" "Checks for zgrep wrapper problems with multiple -e flags (PR 247126)" +} +zgrep_multiple_eflags_body() +{ + atf_expect_fail "known but unsolved zgrep wrapper script regression" + + echo foobar > test + + atf_check -o inline:"foobar\n" zgrep -e foo -e xxx test +} + +atf_test_case zgrep_empty_eflag +zgrep_empty_eflag_head() +{ + atf_set "descr" "Checks for zgrep wrapper problems with empty -e flags pattern (PR 247126)" +} +zgrep_empty_eflag_body() +{ + echo foobar > test + + atf_check -o inline:"foobar\n" zgrep -e '' test +} + atf_test_case nonexistent nonexistent_head() { @@ -826,6 +909,12 @@ atf_init_test_cases() atf_add_test_case file_exp atf_add_test_case egrep atf_add_test_case zgrep + atf_add_test_case zgrep_combined_flags + atf_add_test_case zgrep_eflag + atf_add_test_case zgrep_empty_eflag + atf_add_test_case zgrep_fflag + atf_add_test_case zgrep_long_eflag + atf_add_test_case zgrep_multiple_eflags atf_add_test_case nonexistent atf_add_test_case context2 # Begin FreeBSD Modified: stable/12/usr.bin/grep/zgrep.1 ============================================================================== --- stable/12/usr.bin/grep/zgrep.1 Sun Aug 23 17:34:21 2020 (r364501) +++ stable/12/usr.bin/grep/zgrep.1 Sun Aug 23 17:46:10 2020 (r364502) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 21, 2018 +.Dd July 20, 2020 .Dt ZGREP 1 .Os .Sh NAME @@ -86,9 +86,29 @@ to read compressed files. .Sh SEE ALSO .Xr bzip2 1 , .Xr grep 1 , -.Xr xz 1 +.Xr gzip 1 , +.Xr xz 1 , +.Xr zstd 1 .Sh AUTHORS This version of the .Nm utility was written by .An Thomas Klausner Aq Mt wiz@NetBSD.org . +.Sh BUGS +.Xr zgrep 1 +does not handle flags that take arguments if there is no whitespace +between the flag and the argument, for example: +.Pp +.Dl "zgrep -enfs /etc/rpc" +.Pp +When more than one +.Fl e +flag is used matching +should occur for any of the patterns (similar to multiple patterns +supplied in a file with the +.Fl f +flag). +.Xr zgrep 1 +only matches the last +.Fl e +pattern. Modified: stable/12/usr.bin/grep/zgrep.sh ============================================================================== --- stable/12/usr.bin/grep/zgrep.sh Sun Aug 23 17:34:21 2020 (r364501) +++ stable/12/usr.bin/grep/zgrep.sh Sun Aug 23 17:46:10 2020 (r364502) @@ -29,6 +29,7 @@ grep=grep zcat=zstdcat endofopts=0 +pattern_file=0 pattern_found=0 grep_args="" hyphen=0 @@ -75,29 +76,46 @@ while [ $# -gt 0 -a ${endofopts} -eq 0 ] do case $1 in # from GNU grep-2.5.1 -- keep in sync! - -[ABCDXdefm]) + --) + shift + endofopts=1 + ;; + --file=*) + pattern_file=1 + grep_args="${grep_args} ${1}" + shift + ;; + --regexp=*) + pattern="${1#--regexp=}" + pattern_found=1 + shift + ;; + --*) + grep_args="${grep_args} $1" + shift + ;; + -*[ABCDXdefm]) if [ $# -lt 2 ] then echo "${prg}: missing argument for $1 flag" >&2 exit 1 fi case $1 in - -e) + -*e) pattern="$2" pattern_found=1 shift 2 - break + continue ;; + -*f) + pattern_file=1 + ;; *) ;; esac grep_args="${grep_args} $1 $2" shift 2 ;; - --) - shift - endofopts=1 - ;; -) hyphen=1 shift @@ -125,7 +143,7 @@ do done # if no -e option was found, take next argument as grep-pattern -if [ ${pattern_found} -lt 1 ] +if [ ${pattern_file} -eq 0 -a ${pattern_found} -eq 0 ] then if [ $# -ge 1 ]; then pattern="$1" @@ -136,6 +154,7 @@ then echo "${prg}: missing pattern" >&2 exit 1 fi + pattern_found=1 fi ret=0 @@ -143,15 +162,24 @@ ret=0 if [ $# -lt 1 ] then # ... on stdin - ${cattool} ${catargs} - | ${grep} ${grep_args} -- "${pattern}" - || ret=$? + if [ ${pattern_file} -eq 0 ]; then + ${cattool} ${catargs} - | ${grep} ${grep_args} -- "${pattern}" - || ret=$? + else + ${cattool} ${catargs} - | ${grep} ${grep_args} -- - || ret=$? + fi else # ... on all files given on the command line if [ ${silent} -lt 1 -a $# -gt 1 ]; then grep_args="-H ${grep_args}" fi for file; do - ${cattool} ${catargs} -- "${file}" | - ${grep} --label="${file}" ${grep_args} -- "${pattern}" - || ret=$? + if [ ${pattern_file} -eq 0 ]; then + ${cattool} ${catargs} -- "${file}" | + ${grep} --label="${file}" ${grep_args} -- "${pattern}" - || ret=$? + else + ${cattool} ${catargs} -- "${file}" | + ${grep} --label="${file}" ${grep_args} -- - || ret=$? + fi done fi From owner-svn-src-stable-12@freebsd.org Sun Aug 23 19:19:01 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B20DD3C5456; Sun, 23 Aug 2020 19:19:01 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZQ6F4H67z40hB; Sun, 23 Aug 2020 19:19:01 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 76090C318; Sun, 23 Aug 2020 19:19:01 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07NJJ15c056256; Sun, 23 Aug 2020 19:19:01 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NJJ17O056255; Sun, 23 Aug 2020 19:19:01 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008231919.07NJJ17O056255@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Aug 2020 19:19:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364503 - stable/12/sys/amd64/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/amd64/linux X-SVN-Commit-Revision: 364503 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 19:19:01 -0000 Author: trasz Date: Sun Aug 23 19:19:00 2020 New Revision: 364503 URL: https://svnweb.freebsd.org/changeset/base/364503 Log: MFC r347231: Support PTRACE_GETREGSET w/ NT_PRSTATUS in Linux ptrace(2). While Linux strace(1) doesn't strictly require it - it has a fallback to PTRACE_GETREGS - it's a newer interface, so we better support it before the old one is deprecated. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/amd64/linux/linux_ptrace.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/linux/linux_ptrace.c ============================================================================== --- stable/12/sys/amd64/linux/linux_ptrace.c Sun Aug 23 17:46:10 2020 (r364502) +++ stable/12/sys/amd64/linux/linux_ptrace.c Sun Aug 23 19:19:00 2020 (r364503) @@ -131,6 +131,36 @@ struct linux_pt_reg { l_ulong ss; }; +struct linux_pt_regset { + l_ulong r15; + l_ulong r14; + l_ulong r13; + l_ulong r12; + l_ulong rbp; + l_ulong rbx; + l_ulong r11; + l_ulong r10; + l_ulong r9; + l_ulong r8; + l_ulong rax; + l_ulong rcx; + l_ulong rdx; + l_ulong rsi; + l_ulong rdi; + l_ulong orig_rax; + l_ulong rip; + l_ulong cs; + l_ulong eflags; + l_ulong rsp; + l_ulong ss; + l_ulong fs_base; + l_ulong gs_base; + l_ulong ds; + l_ulong es; + l_ulong fs; + l_ulong gs; +}; + /* * Translate amd64 ptrace registers between Linux and FreeBSD formats. * The translation is pretty straighforward, for all registers but @@ -164,6 +194,40 @@ map_regs_to_linux(struct reg *b_reg, struct linux_pt_r } static void +map_regs_to_linux_regset(struct reg *b_reg, unsigned long fs_base, + unsigned long gs_base, struct linux_pt_regset *l_regset) +{ + + l_regset->r15 = b_reg->r_r15; + l_regset->r14 = b_reg->r_r14; + l_regset->r13 = b_reg->r_r13; + l_regset->r12 = b_reg->r_r12; + l_regset->rbp = b_reg->r_rbp; + l_regset->rbx = b_reg->r_rbx; + l_regset->r11 = b_reg->r_r11; + l_regset->r10 = b_reg->r_r10; + l_regset->r9 = b_reg->r_r9; + l_regset->r8 = b_reg->r_r8; + l_regset->rax = b_reg->r_rax; + l_regset->rcx = b_reg->r_rcx; + l_regset->rdx = b_reg->r_rdx; + l_regset->rsi = b_reg->r_rsi; + l_regset->rdi = b_reg->r_rdi; + l_regset->orig_rax = b_reg->r_rax; + l_regset->rip = b_reg->r_rip; + l_regset->cs = b_reg->r_cs; + l_regset->eflags = b_reg->r_rflags; + l_regset->rsp = b_reg->r_rsp; + l_regset->ss = b_reg->r_ss; + l_regset->fs_base = fs_base; + l_regset->gs_base = gs_base; + l_regset->ds = b_reg->r_ds; + l_regset->es = b_reg->r_es; + l_regset->fs = b_reg->r_fs; + l_regset->gs = b_reg->r_gs; +} + +static void map_regs_from_linux(struct reg *b_reg, struct linux_pt_reg *l_reg) { b_reg->r_r15 = l_reg->r15; @@ -306,14 +370,75 @@ linux_ptrace_setregs(struct thread *td, pid_t pid, voi } static int +linux_ptrace_getregset_prstatus(struct thread *td, pid_t pid, l_ulong data) +{ + struct ptrace_lwpinfo lwpinfo; + struct reg b_reg; + struct linux_pt_regset l_regset; + struct iovec iov; + struct pcb *pcb; + unsigned long fsbase, gsbase; + size_t len; + int error; + + error = copyin((const void *)data, &iov, sizeof(iov)); + if (error != 0) { + printf("%s: copyin error %d\n", __func__, error); + return (error); + } + + error = kern_ptrace(td, PT_GETREGS, pid, &b_reg, 0); + if (error != 0) + return (error); + + pcb = td->td_pcb; + if (td == curthread) + update_pcb_bases(pcb); + fsbase = pcb->pcb_fsbase; + gsbase = pcb->pcb_gsbase; + + map_regs_to_linux_regset(&b_reg, fsbase, gsbase, &l_regset); + + /* + * The strace(1) utility depends on RAX being set to -ENOSYS + * on syscall entry; otherwise it loops printing those: + * + * [ Process PID=928 runs in 64 bit mode. ] + * [ Process PID=928 runs in x32 mode. ] + */ + error = kern_ptrace(td, PT_LWPINFO, pid, &lwpinfo, sizeof(lwpinfo)); + if (error != 0) { + printf("%s: PT_LWPINFO failed with error %d\n", + __func__, error); + return (error); + } + if (lwpinfo.pl_flags & PL_FLAG_SCE) + l_regset.rax = -38; // XXX: Don't hardcode? + + len = MIN(iov.iov_len, sizeof(l_regset)); + error = copyout(&l_regset, (void *)iov.iov_base, len); + if (error != 0) { + printf("%s: copyout error %d\n", __func__, error); + return (error); + } + + iov.iov_len -= len; + error = copyout(&iov, (void *)data, sizeof(iov)); + if (error != 0) { + printf("%s: iov copyout error %d\n", __func__, error); + return (error); + } + + return (error); +} + +static int linux_ptrace_getregset(struct thread *td, pid_t pid, l_ulong addr, l_ulong data) { switch (addr) { case LINUX_NT_PRSTATUS: - printf("%s: NT_PRSTATUS not implemented; returning EINVAL\n", - __func__); - return (EINVAL); + return (linux_ptrace_getregset_prstatus(td, pid, data)); default: printf("%s: PTRACE_GETREGSET request %ld not implemented; " "returning EINVAL\n", __func__, addr); From owner-svn-src-stable-12@freebsd.org Sun Aug 23 19:20:39 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 43FDC3C53B1; Sun, 23 Aug 2020 19:20:39 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZQ8718Mdz40wx; Sun, 23 Aug 2020 19:20:39 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 E6313C1A7; Sun, 23 Aug 2020 19:20:38 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07NJKco0056413; Sun, 23 Aug 2020 19:20:38 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NJKcD8056412; Sun, 23 Aug 2020 19:20:38 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008231920.07NJKcD8056412@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Aug 2020 19:20:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364504 - stable/12/sys/amd64/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/amd64/linux X-SVN-Commit-Revision: 364504 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 19:20:39 -0000 Author: trasz Date: Sun Aug 23 19:20:38 2020 New Revision: 364504 URL: https://svnweb.freebsd.org/changeset/base/364504 Log: MFC r347580: Fix handling of r10 in Linux ptrace(2). This fixes decoding of the 'flags' argument to mmap(2) with Linux strace(1). Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/amd64/linux/linux_ptrace.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/linux/linux_ptrace.c ============================================================================== --- stable/12/sys/amd64/linux/linux_ptrace.c Sun Aug 23 19:19:00 2020 (r364503) +++ stable/12/sys/amd64/linux/linux_ptrace.c Sun Aug 23 19:20:38 2020 (r364504) @@ -338,18 +338,27 @@ linux_ptrace_getregs(struct thread *td, pid_t pid, voi map_regs_to_linux(&b_reg, &l_reg); - /* - * The strace(1) utility depends on RAX being set to -ENOSYS - * on syscall entry. - */ error = kern_ptrace(td, PT_LWPINFO, pid, &lwpinfo, sizeof(lwpinfo)); if (error != 0) { printf("%s: PT_LWPINFO failed with error %d\n", __func__, error); return (error); } - if (lwpinfo.pl_flags & PL_FLAG_SCE) - l_reg.rax = -38; // XXX: Don't hardcode? + if (lwpinfo.pl_flags & PL_FLAG_SCE) { + /* + * The strace(1) utility depends on RAX being set to -ENOSYS + * on syscall entry; otherwise it loops printing those: + * + * [ Process PID=928 runs in 64 bit mode. ] + * [ Process PID=928 runs in x32 mode. ] + */ + l_reg.rax = -38; /* -ENOSYS */ + /* + * Undo the mangling done in exception.S:fast_syscall_common(). + */ + l_reg.r10 = l_reg.rcx; + } + error = copyout(&l_reg, (void *)data, sizeof(l_reg)); return (error); } @@ -399,21 +408,27 @@ linux_ptrace_getregset_prstatus(struct thread *td, pid map_regs_to_linux_regset(&b_reg, fsbase, gsbase, &l_regset); - /* - * The strace(1) utility depends on RAX being set to -ENOSYS - * on syscall entry; otherwise it loops printing those: - * - * [ Process PID=928 runs in 64 bit mode. ] - * [ Process PID=928 runs in x32 mode. ] - */ error = kern_ptrace(td, PT_LWPINFO, pid, &lwpinfo, sizeof(lwpinfo)); if (error != 0) { printf("%s: PT_LWPINFO failed with error %d\n", __func__, error); return (error); } - if (lwpinfo.pl_flags & PL_FLAG_SCE) - l_regset.rax = -38; // XXX: Don't hardcode? + if (lwpinfo.pl_flags & PL_FLAG_SCE) { + /* + * The strace(1) utility depends on RAX being set to -ENOSYS + * on syscall entry; otherwise it loops printing those: + * + * [ Process PID=928 runs in 64 bit mode. ] + * [ Process PID=928 runs in x32 mode. ] + */ + l_regset.rax = -38; /* -ENOSYS */ + + /* + * Undo the mangling done in exception.S:fast_syscall_common(). + */ + l_regset.r10 = l_regset.rcx; + } len = MIN(iov.iov_len, sizeof(l_regset)); error = copyout(&l_regset, (void *)iov.iov_base, len); From owner-svn-src-stable-12@freebsd.org Sun Aug 23 19:22:43 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BEE8A3C53DB; Sun, 23 Aug 2020 19:22:43 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZQBW4Z5dz41RS; Sun, 23 Aug 2020 19:22:43 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 80F5BC22B; Sun, 23 Aug 2020 19:22:43 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07NJMh2f062233; Sun, 23 Aug 2020 19:22:43 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NJMgM8062229; Sun, 23 Aug 2020 19:22:42 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008231922.07NJMgM8062229@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Aug 2020 19:22:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364505 - in stable/12/sys: amd64/linux compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in stable/12/sys: amd64/linux compat/linux X-SVN-Commit-Revision: 364505 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 19:22:43 -0000 Author: trasz Date: Sun Aug 23 19:22:42 2020 New Revision: 364505 URL: https://svnweb.freebsd.org/changeset/base/364505 Log: MFC r347971: Implement PTRACE_O_TRACESYSGOOD. This makes Linux strace(1) work. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/amd64/linux/linux_ptrace.c stable/12/sys/compat/linux/linux_emul.h stable/12/sys/compat/linux/linux_misc.c stable/12/sys/compat/linux/linux_misc.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/linux/linux_ptrace.c ============================================================================== --- stable/12/sys/amd64/linux/linux_ptrace.c Sun Aug 23 19:20:38 2020 (r364504) +++ stable/12/sys/amd64/linux/linux_ptrace.c Sun Aug 23 19:22:42 2020 (r364505) @@ -34,8 +34,10 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include +#include #include #include @@ -43,6 +45,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #define LINUX_PTRACE_TRACEME 0 @@ -107,6 +111,37 @@ map_signum(int lsig, int *bsigp) return (0); } +int +linux_ptrace_status(struct thread *td, pid_t pid, int status) +{ + struct ptrace_lwpinfo lwpinfo; + struct linux_pemuldata *pem; + register_t saved_retval; + int error; + + saved_retval = td->td_retval[0]; + error = kern_ptrace(td, PT_LWPINFO, pid, &lwpinfo, sizeof(lwpinfo)); + td->td_retval[0] = saved_retval; + if (error != 0) { + printf("%s: PT_LWPINFO failed with error %d\n", __func__, error); + return (status); + } + + pem = pem_find(td->td_proc); + KASSERT(pem != NULL, ("%s: proc emuldata not found.\n", __func__)); + + LINUX_PEM_SLOCK(pem); + if ((pem->ptrace_flags & LINUX_PTRACE_O_TRACESYSGOOD) && + lwpinfo.pl_flags & PL_FLAG_SCE) + status |= (LINUX_SIGTRAP | 0x80) << 8; + if ((pem->ptrace_flags & LINUX_PTRACE_O_TRACESYSGOOD) && + lwpinfo.pl_flags & PL_FLAG_SCX) + status |= (LINUX_SIGTRAP | 0x80) << 8; + LINUX_PEM_SUNLOCK(pem); + + return (status); +} + struct linux_pt_reg { l_ulong r15; l_ulong r14; @@ -279,6 +314,7 @@ linux_ptrace_peek(struct thread *td, pid_t pid, void * static int linux_ptrace_setoptions(struct thread *td, pid_t pid, l_ulong data) { + struct linux_pemuldata *pem; int mask; mask = 0; @@ -290,15 +326,20 @@ linux_ptrace_setoptions(struct thread *td, pid_t pid, return (EINVAL); } + pem = pem_find(td->td_proc); + KASSERT(pem != NULL, ("%s: proc emuldata not found.\n", __func__)); + /* * PTRACE_O_EXITKILL is ignored, we do that by default. */ + LINUX_PEM_XLOCK(pem); if (data & LINUX_PTRACE_O_TRACESYSGOOD) { - printf("%s: PTRACE_O_TRACESYSGOOD not implemented; " - "returning EINVAL\n", __func__); - return (EINVAL); + pem->ptrace_flags |= LINUX_PTRACE_O_TRACESYSGOOD; + } else { + pem->ptrace_flags &= ~LINUX_PTRACE_O_TRACESYSGOOD; } + LINUX_PEM_XUNLOCK(pem); if (data & LINUX_PTRACE_O_TRACEFORK) mask |= PTRACE_FORK; Modified: stable/12/sys/compat/linux/linux_emul.h ============================================================================== --- stable/12/sys/compat/linux/linux_emul.h Sun Aug 23 19:20:38 2020 (r364504) +++ stable/12/sys/compat/linux/linux_emul.h Sun Aug 23 19:22:42 2020 (r364505) @@ -32,6 +32,8 @@ #ifndef _LINUX_EMUL_H_ #define _LINUX_EMUL_H_ +struct image_params; + /* * modeled after similar structure in NetBSD * this will be extended as we need more functionality @@ -68,6 +70,7 @@ struct linux_pemuldata { struct sx pem_sx; /* lock for this struct */ void *epoll; /* epoll data */ uint32_t persona; /* process execution domain */ + uint32_t ptrace_flags; /* used by ptrace(2) */ }; #define LINUX_PEM_XLOCK(p) sx_xlock(&(p)->pem_sx) Modified: stable/12/sys/compat/linux/linux_misc.c ============================================================================== --- stable/12/sys/compat/linux/linux_misc.c Sun Aug 23 19:20:38 2020 (r364504) +++ stable/12/sys/compat/linux/linux_misc.c Sun Aug 23 19:22:42 2020 (r364505) @@ -984,27 +984,53 @@ linux_futimesat(struct thread *td, struct linux_futime } #endif -int -linux_common_wait(struct thread *td, int pid, int *status, - int options, struct rusage *ru) +static int +linux_common_wait(struct thread *td, int pid, int *statusp, + int options, struct __wrusage *wrup) { - int error, tmpstat; + siginfo_t siginfo; + idtype_t idtype; + id_t id; + int error, status, tmpstat; - error = kern_wait(td, pid, &tmpstat, options, ru); + if (pid == WAIT_ANY) { + idtype = P_ALL; + id = 0; + } else if (pid < 0) { + idtype = P_PGID; + id = (id_t)-pid; + } else { + idtype = P_PID; + id = (id_t)pid; + } + + /* + * For backward compatibility we implicitly add flags WEXITED + * and WTRAPPED here. + */ + options |= WEXITED | WTRAPPED; + error = kern_wait6(td, idtype, id, &status, options, wrup, &siginfo); if (error) return (error); - if (status) { - tmpstat &= 0xffff; - if (WIFSIGNALED(tmpstat)) + if (statusp) { + tmpstat = status & 0xffff; + if (WIFSIGNALED(tmpstat)) { tmpstat = (tmpstat & 0xffffff80) | bsd_to_linux_signal(WTERMSIG(tmpstat)); - else if (WIFSTOPPED(tmpstat)) + } else if (WIFSTOPPED(tmpstat)) { tmpstat = (tmpstat & 0xffff00ff) | (bsd_to_linux_signal(WSTOPSIG(tmpstat)) << 8); - else if (WIFCONTINUED(tmpstat)) +#if defined(__amd64__) && !defined(COMPAT_LINUX32) + if (WSTOPSIG(status) == SIGTRAP) { + tmpstat = linux_ptrace_status(td, + siginfo.si_pid, tmpstat); + } +#endif + } else if (WIFCONTINUED(tmpstat)) { tmpstat = 0xffff; - error = copyout(&tmpstat, status, sizeof(int)); + } + error = copyout(&tmpstat, statusp, sizeof(int)); } return (error); @@ -1035,7 +1061,7 @@ int linux_wait4(struct thread *td, struct linux_wait4_args *args) { int error, options; - struct rusage ru, *rup; + struct __wrusage wru, *wrup; #ifdef DEBUG if (ldebug(wait4)) @@ -1051,14 +1077,14 @@ linux_wait4(struct thread *td, struct linux_wait4_args linux_to_bsd_waitopts(args->options, &options); if (args->rusage != NULL) - rup = &ru; + wrup = &wru; else - rup = NULL; - error = linux_common_wait(td, args->pid, args->status, options, rup); + wrup = NULL; + error = linux_common_wait(td, args->pid, args->status, options, wrup); if (error != 0) return (error); if (args->rusage != NULL) - error = linux_copyout_rusage(&ru, args->rusage); + error = linux_copyout_rusage(&wru.wru_self, args->rusage); return (error); } Modified: stable/12/sys/compat/linux/linux_misc.h ============================================================================== --- stable/12/sys/compat/linux/linux_misc.h Sun Aug 23 19:20:38 2020 (r364504) +++ stable/12/sys/compat/linux/linux_misc.h Sun Aug 23 19:22:42 2020 (r364505) @@ -149,8 +149,9 @@ extern int stclohz; #define LINUX_GRND_NONBLOCK 0x0001 #define LINUX_GRND_RANDOM 0x0002 -int linux_common_wait(struct thread *td, int pid, int *status, - int options, struct rusage *ru); +#if defined(__amd64__) && !defined(COMPAT_LINUX32) +int linux_ptrace_status(struct thread *td, int pid, int status); +#endif void linux_to_bsd_waitopts(int options, int *bsdopts); int linux_set_upcall_kse(struct thread *td, register_t stack); int linux_set_cloned_tls(struct thread *td, void *desc); From owner-svn-src-stable-12@freebsd.org Sun Aug 23 19:25:20 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 572683C5638; Sun, 23 Aug 2020 19:25:20 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZQFX1ch9z41kX; Sun, 23 Aug 2020 19:25:20 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 1AAEAC44B; Sun, 23 Aug 2020 19:25:20 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07NJPJja062426; Sun, 23 Aug 2020 19:25:19 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NJPJeu062425; Sun, 23 Aug 2020 19:25:19 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008231925.07NJPJeu062425@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Aug 2020 19:25:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364506 - stable/12/sys/amd64/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/amd64/linux X-SVN-Commit-Revision: 364506 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 19:25:20 -0000 Author: trasz Date: Sun Aug 23 19:25:19 2020 New Revision: 364506 URL: https://svnweb.freebsd.org/changeset/base/364506 Log: MFC r348049: Make linux_ptrace() use linux_msg() instead of printf(). Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/amd64/linux/linux_ptrace.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/linux/linux_ptrace.c ============================================================================== --- stable/12/sys/amd64/linux/linux_ptrace.c Sun Aug 23 19:22:42 2020 (r364505) +++ stable/12/sys/amd64/linux/linux_ptrace.c Sun Aug 23 19:25:19 2020 (r364506) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #define LINUX_PTRACE_TRACEME 0 #define LINUX_PTRACE_PEEKTEXT 1 @@ -123,7 +124,7 @@ linux_ptrace_status(struct thread *td, pid_t pid, int error = kern_ptrace(td, PT_LWPINFO, pid, &lwpinfo, sizeof(lwpinfo)); td->td_retval[0] = saved_retval; if (error != 0) { - printf("%s: PT_LWPINFO failed with error %d\n", __func__, error); + linux_msg(td, "PT_LWPINFO failed with error %d", error); return (status); } @@ -320,9 +321,9 @@ linux_ptrace_setoptions(struct thread *td, pid_t pid, mask = 0; if (data & ~LINUX_PTRACE_O_MASK) { - printf("%s: unknown ptrace option %lx set; " - "returning EINVAL\n", - __func__, data & ~LINUX_PTRACE_O_MASK); + linux_msg(td, "unknown ptrace option %lx set; " + "returning EINVAL", + data & ~LINUX_PTRACE_O_MASK); return (EINVAL); } @@ -357,8 +358,8 @@ linux_ptrace_setoptions(struct thread *td, pid_t pid, mask |= PTRACE_VFORK; /* XXX: Close enough? */ if (data & LINUX_PTRACE_O_TRACEEXIT) { - printf("%s: PTRACE_O_TRACEEXIT not implemented; " - "returning EINVAL\n", __func__); + linux_msg(td, "PTRACE_O_TRACEEXIT not implemented; " + "returning EINVAL"); return (EINVAL); } @@ -381,7 +382,7 @@ linux_ptrace_getregs(struct thread *td, pid_t pid, voi error = kern_ptrace(td, PT_LWPINFO, pid, &lwpinfo, sizeof(lwpinfo)); if (error != 0) { - printf("%s: PT_LWPINFO failed with error %d\n", __func__, error); + linux_msg(td, "PT_LWPINFO failed with error %d", error); return (error); } if (lwpinfo.pl_flags & PL_FLAG_SCE) { @@ -433,7 +434,7 @@ linux_ptrace_getregset_prstatus(struct thread *td, pid error = copyin((const void *)data, &iov, sizeof(iov)); if (error != 0) { - printf("%s: copyin error %d\n", __func__, error); + linux_msg(td, "copyin error %d", error); return (error); } @@ -451,8 +452,7 @@ linux_ptrace_getregset_prstatus(struct thread *td, pid error = kern_ptrace(td, PT_LWPINFO, pid, &lwpinfo, sizeof(lwpinfo)); if (error != 0) { - printf("%s: PT_LWPINFO failed with error %d\n", - __func__, error); + linux_msg(td, "PT_LWPINFO failed with error %d", error); return (error); } if (lwpinfo.pl_flags & PL_FLAG_SCE) { @@ -474,14 +474,14 @@ linux_ptrace_getregset_prstatus(struct thread *td, pid len = MIN(iov.iov_len, sizeof(l_regset)); error = copyout(&l_regset, (void *)iov.iov_base, len); if (error != 0) { - printf("%s: copyout error %d\n", __func__, error); + linux_msg(td, "copyout error %d", error); return (error); } iov.iov_len -= len; error = copyout(&iov, (void *)data, sizeof(iov)); if (error != 0) { - printf("%s: iov copyout error %d\n", __func__, error); + linux_msg(td, "iov copyout error %d", error); return (error); } @@ -496,8 +496,8 @@ linux_ptrace_getregset(struct thread *td, pid_t pid, l case LINUX_NT_PRSTATUS: return (linux_ptrace_getregset_prstatus(td, pid, data)); default: - printf("%s: PTRACE_GETREGSET request %ld not implemented; " - "returning EINVAL\n", __func__, addr); + linux_msg(td, "PTRACE_GETREGSET request %ld not implemented; " + "returning EINVAL", addr); return (EINVAL); } } @@ -506,7 +506,7 @@ static int linux_ptrace_seize(struct thread *td, pid_t pid, l_ulong addr, l_ulong data) { - printf("%s: PTRACE_SEIZE not implemented; returning EINVAL\n", __func__); + linux_msg(td, "PTRACE_SEIZE not implemented; returning EINVAL"); return (EINVAL); } @@ -587,8 +587,8 @@ linux_ptrace(struct thread *td, struct linux_ptrace_ar error = linux_ptrace_seize(td, pid, uap->addr, uap->data); break; default: - printf("%s: ptrace(%ld, ...) not implemented; returning EINVAL\n", - __func__, uap->req); + linux_msg(td, "ptrace(%ld, ...) not implemented; " + "returning EINVAL", uap->req); error = EINVAL; break; } From owner-svn-src-stable-12@freebsd.org Sun Aug 23 19:26:47 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A29DC3C588E; Sun, 23 Aug 2020 19:26:47 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZQHC3nJSz41Yy; Sun, 23 Aug 2020 19:26:47 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 65023C5C8; Sun, 23 Aug 2020 19:26:47 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07NJQlbk062545; Sun, 23 Aug 2020 19:26:47 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NJQlDU062544; Sun, 23 Aug 2020 19:26:47 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008231926.07NJQlDU062544@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Aug 2020 19:26:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364507 - stable/12/sys/amd64/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/amd64/linux X-SVN-Commit-Revision: 364507 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 19:26:47 -0000 Author: trasz Date: Sun Aug 23 19:26:46 2020 New Revision: 364507 URL: https://svnweb.freebsd.org/changeset/base/364507 Log: MFC r349747: Implement PTRACE_GETSIGINFO. This makes Linux strace(1) quieter in some cases (strace -f man id > /dev/null). Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/amd64/linux/linux_ptrace.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/linux/linux_ptrace.c ============================================================================== --- stable/12/sys/amd64/linux/linux_ptrace.c Sun Aug 23 19:25:19 2020 (r364506) +++ stable/12/sys/amd64/linux/linux_ptrace.c Sun Aug 23 19:26:46 2020 (r364507) @@ -68,6 +68,7 @@ __FBSDID("$FreeBSD$"); #define LINUX_PTRACE_DETACH 17 #define LINUX_PTRACE_SYSCALL 24 #define LINUX_PTRACE_SETOPTIONS 0x4200 +#define LINUX_PTRACE_GETSIGINFO 0x4202 #define LINUX_PTRACE_GETREGSET 0x4204 #define LINUX_PTRACE_SEIZE 0x4206 @@ -367,6 +368,31 @@ linux_ptrace_setoptions(struct thread *td, pid_t pid, } static int +linux_ptrace_getsiginfo(struct thread *td, pid_t pid, l_ulong data) +{ + struct ptrace_lwpinfo lwpinfo; + l_siginfo_t l_siginfo; + int error, sig; + + error = kern_ptrace(td, PT_LWPINFO, pid, &lwpinfo, sizeof(lwpinfo)); + if (error != 0) { + linux_msg(td, "PT_LWPINFO failed with error %d", error); + return (error); + } + + if ((lwpinfo.pl_flags & PL_FLAG_SI) == 0) { + error = EINVAL; + linux_msg(td, "no PL_FLAG_SI, returning %d", error); + return (error); + } + + sig = bsd_to_linux_signal(lwpinfo.pl_siginfo.si_signo); + siginfo_to_lsiginfo(&lwpinfo.pl_siginfo, &l_siginfo, sig); + error = copyout(&l_siginfo, (void *)data, sizeof(l_siginfo)); + return (error); +} + +static int linux_ptrace_getregs(struct thread *td, pid_t pid, void *data) { struct ptrace_lwpinfo lwpinfo; @@ -579,6 +605,9 @@ linux_ptrace(struct thread *td, struct linux_ptrace_ar break; case LINUX_PTRACE_SETOPTIONS: error = linux_ptrace_setoptions(td, pid, uap->data); + break; + case LINUX_PTRACE_GETSIGINFO: + error = linux_ptrace_getsiginfo(td, pid, uap->data); break; case LINUX_PTRACE_GETREGSET: error = linux_ptrace_getregset(td, pid, uap->addr, uap->data); From owner-svn-src-stable-12@freebsd.org Sun Aug 23 19:28:10 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6CFCB3C5A02; Sun, 23 Aug 2020 19:28:10 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZQJp2CyWz41Zj; Sun, 23 Aug 2020 19:28:10 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 15511C523; Sun, 23 Aug 2020 19:28:10 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07NJS9IL062664; Sun, 23 Aug 2020 19:28:09 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NJS96o062663; Sun, 23 Aug 2020 19:28:09 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008231928.07NJS96o062663@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Aug 2020 19:28:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364508 - stable/12/sys/amd64/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/amd64/linux X-SVN-Commit-Revision: 364508 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 19:28:10 -0000 Author: trasz Date: Sun Aug 23 19:28:09 2020 New Revision: 364508 URL: https://svnweb.freebsd.org/changeset/base/364508 Log: MFC r349748: Add support for PTRACE_O_TRACEEXIT to linuxulator ptrace(2). This fixes strace 4.25 from Ubuntu 19.04. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/amd64/linux/linux_ptrace.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/linux/linux_ptrace.c ============================================================================== --- stable/12/sys/amd64/linux/linux_ptrace.c Sun Aug 23 19:26:46 2020 (r364507) +++ stable/12/sys/amd64/linux/linux_ptrace.c Sun Aug 23 19:28:09 2020 (r364508) @@ -72,6 +72,8 @@ __FBSDID("$FreeBSD$"); #define LINUX_PTRACE_GETREGSET 0x4204 #define LINUX_PTRACE_SEIZE 0x4206 +#define LINUX_PTRACE_EVENT_EXIT 6 + #define LINUX_PTRACE_O_TRACESYSGOOD 1 #define LINUX_PTRACE_O_TRACEFORK 2 #define LINUX_PTRACE_O_TRACEVFORK 4 @@ -139,6 +141,9 @@ linux_ptrace_status(struct thread *td, pid_t pid, int if ((pem->ptrace_flags & LINUX_PTRACE_O_TRACESYSGOOD) && lwpinfo.pl_flags & PL_FLAG_SCX) status |= (LINUX_SIGTRAP | 0x80) << 8; + if ((pem->ptrace_flags & LINUX_PTRACE_O_TRACEEXIT) && + lwpinfo.pl_flags & PL_FLAG_EXITED) + status |= (LINUX_SIGTRAP | LINUX_PTRACE_EVENT_EXIT << 8) << 8; LINUX_PEM_SUNLOCK(pem); return (status); @@ -359,9 +364,9 @@ linux_ptrace_setoptions(struct thread *td, pid_t pid, mask |= PTRACE_VFORK; /* XXX: Close enough? */ if (data & LINUX_PTRACE_O_TRACEEXIT) { - linux_msg(td, "PTRACE_O_TRACEEXIT not implemented; " - "returning EINVAL"); - return (EINVAL); + pem->ptrace_flags |= LINUX_PTRACE_O_TRACEEXIT; + } else { + pem->ptrace_flags &= ~LINUX_PTRACE_O_TRACEEXIT; } return (kern_ptrace(td, PT_SET_EVENT_MASK, pid, &mask, sizeof(mask))); From owner-svn-src-stable-12@freebsd.org Sun Aug 23 19:30:15 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 435713C5A99; Sun, 23 Aug 2020 19:30:15 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZQMB2nmrz41xP; Sun, 23 Aug 2020 19:30:13 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 43DF8C4BF; Sun, 23 Aug 2020 19:30:13 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07NJUDqU062913; Sun, 23 Aug 2020 19:30:13 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NJUD6e062912; Sun, 23 Aug 2020 19:30:13 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008231930.07NJUD6e062912@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Aug 2020 19:30:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364510 - stable/12/sys/amd64/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/amd64/linux X-SVN-Commit-Revision: 364510 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 19:30:17 -0000 Author: trasz Date: Sun Aug 23 19:30:12 2020 New Revision: 364510 URL: https://svnweb.freebsd.org/changeset/base/364510 Log: MFC r351821: Improve debugging output. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/amd64/linux/linux_ptrace.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/linux/linux_ptrace.c ============================================================================== --- stable/12/sys/amd64/linux/linux_ptrace.c Sun Aug 23 19:30:06 2020 (r364509) +++ stable/12/sys/amd64/linux/linux_ptrace.c Sun Aug 23 19:30:12 2020 (r364510) @@ -319,6 +319,22 @@ linux_ptrace_peek(struct thread *td, pid_t pid, void * } static int +linux_ptrace_peekuser(struct thread *td, pid_t pid, void *addr, void *data) +{ + + linux_msg(td, "PTRACE_PEEKUSER not implemented; returning EINVAL"); + return (EINVAL); +} + +static int +linux_ptrace_pokeuser(struct thread *td, pid_t pid, void *addr, void *data) +{ + + linux_msg(td, "PTRACE_POKEUSER not implemented; returning EINVAL"); + return (EINVAL); +} + +static int linux_ptrace_setoptions(struct thread *td, pid_t pid, l_ulong data) { struct linux_pemuldata *pem; @@ -566,11 +582,17 @@ linux_ptrace(struct thread *td, struct linux_ptrace_ar error = linux_ptrace_peek(td, pid, (void *)(uap->addr + 4), (void *)(uap->data + 4)); break; + case LINUX_PTRACE_PEEKUSER: + error = linux_ptrace_peekuser(td, pid, addr, (void *)uap->data); + break; case LINUX_PTRACE_POKETEXT: error = kern_ptrace(td, PT_WRITE_I, pid, addr, uap->data); break; case LINUX_PTRACE_POKEDATA: error = kern_ptrace(td, PT_WRITE_D, pid, addr, uap->data); + break; + case LINUX_PTRACE_POKEUSER: + error = linux_ptrace_pokeuser(td, pid, addr, (void *)uap->data); break; case LINUX_PTRACE_CONT: error = map_signum(uap->data, &sig); From owner-svn-src-stable-12@freebsd.org Sun Aug 23 19:42:52 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 06D143C68AB; Sun, 23 Aug 2020 19:42:52 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZQdl1mm0z47Zv; Sun, 23 Aug 2020 19:42:50 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 363DDC896; Sun, 23 Aug 2020 19:42:50 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07NJgnEf086218; Sun, 23 Aug 2020 19:42:49 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NJgm5v086211; Sun, 23 Aug 2020 19:42:48 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008231942.07NJgm5v086211@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Aug 2020 19:42:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364512 - in stable/12/sys: amd64/linux amd64/linux32 arm64/linux i386/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in stable/12/sys: amd64/linux amd64/linux32 arm64/linux i386/linux X-SVN-Commit-Revision: 364512 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 19:42:53 -0000 Author: trasz Date: Sun Aug 23 19:42:48 2020 New Revision: 364512 URL: https://svnweb.freebsd.org/changeset/base/364512 Log: MFC r352209 by emaste: regen linuxulator sysent after r352208 Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/amd64/linux/linux_proto.h stable/12/sys/amd64/linux/linux_systrace_args.c stable/12/sys/amd64/linux32/linux32_proto.h stable/12/sys/amd64/linux32/linux32_systrace_args.c stable/12/sys/arm64/linux/linux_proto.h stable/12/sys/arm64/linux/linux_systrace_args.c stable/12/sys/i386/linux/linux_proto.h stable/12/sys/i386/linux/linux_systrace_args.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/linux/linux_proto.h ============================================================================== --- stable/12/sys/amd64/linux/linux_proto.h Sun Aug 23 19:41:16 2020 (r364511) +++ stable/12/sys/amd64/linux/linux_proto.h Sun Aug 23 19:42:48 2020 (r364512) @@ -1128,9 +1128,9 @@ struct linux_sched_getattr_args { char flags_l_[PADL_(l_uint)]; l_uint flags; char flags_r_[PADR_(l_uint)]; }; struct linux_renameat2_args { - char oldfd_l_[PADL_(l_int)]; l_int oldfd; char oldfd_r_[PADR_(l_int)]; + char olddfd_l_[PADL_(l_int)]; l_int olddfd; char olddfd_r_[PADR_(l_int)]; char oldname_l_[PADL_(const char *)]; const char * oldname; char oldname_r_[PADR_(const char *)]; - char newfd_l_[PADL_(l_int)]; l_int newfd; char newfd_r_[PADR_(l_int)]; + char newdfd_l_[PADL_(l_int)]; l_int newdfd; char newdfd_r_[PADR_(l_int)]; char newname_l_[PADL_(const char *)]; const char * newname; char newname_r_[PADR_(const char *)]; char flags_l_[PADL_(unsigned int)]; unsigned int flags; char flags_r_[PADR_(unsigned int)]; }; Modified: stable/12/sys/amd64/linux/linux_systrace_args.c ============================================================================== --- stable/12/sys/amd64/linux/linux_systrace_args.c Sun Aug 23 19:41:16 2020 (r364511) +++ stable/12/sys/amd64/linux/linux_systrace_args.c Sun Aug 23 19:42:48 2020 (r364512) @@ -2302,9 +2302,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg /* linux_renameat2 */ case 316: { struct linux_renameat2_args *p = params; - iarg[0] = p->oldfd; /* l_int */ + iarg[0] = p->olddfd; /* l_int */ uarg[1] = (intptr_t) p->oldname; /* const char * */ - iarg[2] = p->newfd; /* l_int */ + iarg[2] = p->newdfd; /* l_int */ uarg[3] = (intptr_t) p->newname; /* const char * */ uarg[4] = p->flags; /* unsigned int */ *n_args = 5; Modified: stable/12/sys/amd64/linux32/linux32_proto.h ============================================================================== --- stable/12/sys/amd64/linux32/linux32_proto.h Sun Aug 23 19:41:16 2020 (r364511) +++ stable/12/sys/amd64/linux32/linux32_proto.h Sun Aug 23 19:42:48 2020 (r364512) @@ -1213,9 +1213,9 @@ struct linux_sched_getattr_args { char flags_l_[PADL_(l_uint)]; l_uint flags; char flags_r_[PADR_(l_uint)]; }; struct linux_renameat2_args { - char oldfd_l_[PADL_(l_int)]; l_int oldfd; char oldfd_r_[PADR_(l_int)]; + char olddfd_l_[PADL_(l_int)]; l_int olddfd; char olddfd_r_[PADR_(l_int)]; char oldname_l_[PADL_(const char *)]; const char * oldname; char oldname_r_[PADR_(const char *)]; - char newfd_l_[PADL_(l_int)]; l_int newfd; char newfd_r_[PADR_(l_int)]; + char newdfd_l_[PADL_(l_int)]; l_int newdfd; char newdfd_r_[PADR_(l_int)]; char newname_l_[PADL_(const char *)]; const char * newname; char newname_r_[PADR_(const char *)]; char flags_l_[PADL_(unsigned int)]; unsigned int flags; char flags_r_[PADR_(unsigned int)]; }; Modified: stable/12/sys/amd64/linux32/linux32_systrace_args.c ============================================================================== --- stable/12/sys/amd64/linux32/linux32_systrace_args.c Sun Aug 23 19:41:16 2020 (r364511) +++ stable/12/sys/amd64/linux32/linux32_systrace_args.c Sun Aug 23 19:42:48 2020 (r364512) @@ -2440,9 +2440,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg /* linux_renameat2 */ case 353: { struct linux_renameat2_args *p = params; - iarg[0] = p->oldfd; /* l_int */ + iarg[0] = p->olddfd; /* l_int */ uarg[1] = (intptr_t) p->oldname; /* const char * */ - iarg[2] = p->newfd; /* l_int */ + iarg[2] = p->newdfd; /* l_int */ uarg[3] = (intptr_t) p->newname; /* const char * */ uarg[4] = p->flags; /* unsigned int */ *n_args = 5; Modified: stable/12/sys/arm64/linux/linux_proto.h ============================================================================== --- stable/12/sys/arm64/linux/linux_proto.h Sun Aug 23 19:41:16 2020 (r364511) +++ stable/12/sys/arm64/linux/linux_proto.h Sun Aug 23 19:42:48 2020 (r364512) @@ -974,9 +974,9 @@ struct linux_sched_getattr_args { char flags_l_[PADL_(l_uint)]; l_uint flags; char flags_r_[PADR_(l_uint)]; }; struct linux_renameat2_args { - char oldfd_l_[PADL_(l_int)]; l_int oldfd; char oldfd_r_[PADR_(l_int)]; + char olddfd_l_[PADL_(l_int)]; l_int olddfd; char olddfd_r_[PADR_(l_int)]; char oldname_l_[PADL_(const char *)]; const char * oldname; char oldname_r_[PADR_(const char *)]; - char newfd_l_[PADL_(l_int)]; l_int newfd; char newfd_r_[PADR_(l_int)]; + char newdfd_l_[PADL_(l_int)]; l_int newdfd; char newdfd_r_[PADR_(l_int)]; char newname_l_[PADL_(const char *)]; const char * newname; char newname_r_[PADR_(const char *)]; char flags_l_[PADL_(unsigned int)]; unsigned int flags; char flags_r_[PADR_(unsigned int)]; }; Modified: stable/12/sys/arm64/linux/linux_systrace_args.c ============================================================================== --- stable/12/sys/arm64/linux/linux_systrace_args.c Sun Aug 23 19:41:16 2020 (r364511) +++ stable/12/sys/arm64/linux/linux_systrace_args.c Sun Aug 23 19:42:48 2020 (r364512) @@ -1977,9 +1977,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg /* linux_renameat2 */ case 276: { struct linux_renameat2_args *p = params; - iarg[0] = p->oldfd; /* l_int */ + iarg[0] = p->olddfd; /* l_int */ uarg[1] = (intptr_t) p->oldname; /* const char * */ - iarg[2] = p->newfd; /* l_int */ + iarg[2] = p->newdfd; /* l_int */ uarg[3] = (intptr_t) p->newname; /* const char * */ uarg[4] = p->flags; /* unsigned int */ *n_args = 5; Modified: stable/12/sys/i386/linux/linux_proto.h ============================================================================== --- stable/12/sys/i386/linux/linux_proto.h Sun Aug 23 19:41:16 2020 (r364511) +++ stable/12/sys/i386/linux/linux_proto.h Sun Aug 23 19:42:48 2020 (r364512) @@ -1220,9 +1220,9 @@ struct linux_sched_getattr_args { char flags_l_[PADL_(l_uint)]; l_uint flags; char flags_r_[PADR_(l_uint)]; }; struct linux_renameat2_args { - char oldfd_l_[PADL_(l_int)]; l_int oldfd; char oldfd_r_[PADR_(l_int)]; + char olddfd_l_[PADL_(l_int)]; l_int olddfd; char olddfd_r_[PADR_(l_int)]; char oldname_l_[PADL_(const char *)]; const char * oldname; char oldname_r_[PADR_(const char *)]; - char newfd_l_[PADL_(l_int)]; l_int newfd; char newfd_r_[PADR_(l_int)]; + char newdfd_l_[PADL_(l_int)]; l_int newdfd; char newdfd_r_[PADR_(l_int)]; char newname_l_[PADL_(const char *)]; const char * newname; char newname_r_[PADR_(const char *)]; char flags_l_[PADL_(unsigned int)]; unsigned int flags; char flags_r_[PADR_(unsigned int)]; }; Modified: stable/12/sys/i386/linux/linux_systrace_args.c ============================================================================== --- stable/12/sys/i386/linux/linux_systrace_args.c Sun Aug 23 19:41:16 2020 (r364511) +++ stable/12/sys/i386/linux/linux_systrace_args.c Sun Aug 23 19:42:48 2020 (r364512) @@ -2505,9 +2505,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg /* linux_renameat2 */ case 353: { struct linux_renameat2_args *p = params; - iarg[0] = p->oldfd; /* l_int */ + iarg[0] = p->olddfd; /* l_int */ uarg[1] = (intptr_t) p->oldname; /* const char * */ - iarg[2] = p->newfd; /* l_int */ + iarg[2] = p->newdfd; /* l_int */ uarg[3] = (intptr_t) p->newname; /* const char * */ uarg[4] = p->flags; /* unsigned int */ *n_args = 5; From owner-svn-src-stable-12@freebsd.org Sun Aug 23 19:41:22 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 30DAE3C67C6; Sun, 23 Aug 2020 19:41:22 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZQc06kBxz46g1; Sun, 23 Aug 2020 19:41:18 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 B11EEC780; Sun, 23 Aug 2020 19:41:17 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07NJfHKA079237; Sun, 23 Aug 2020 19:41:17 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NJfGfW079232; Sun, 23 Aug 2020 19:41:16 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008231941.07NJfGfW079232@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Aug 2020 19:41:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364511 - in stable/12/sys: amd64/linux amd64/linux32 arm64/linux i386/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in stable/12/sys: amd64/linux amd64/linux32 arm64/linux i386/linux X-SVN-Commit-Revision: 364511 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 19:41:22 -0000 Author: trasz Date: Sun Aug 23 19:41:16 2020 New Revision: 364511 URL: https://svnweb.freebsd.org/changeset/base/364511 Log: MFC r352208 by emaste: make linux_renameat2 args consistent with linux_renameat Use 'dfd' consistently for a directory fd. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/amd64/linux/syscalls.master stable/12/sys/amd64/linux32/syscalls.master stable/12/sys/arm64/linux/syscalls.master stable/12/sys/i386/linux/syscalls.master Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/linux/syscalls.master ============================================================================== --- stable/12/sys/amd64/linux/syscalls.master Sun Aug 23 19:30:12 2020 (r364510) +++ stable/12/sys/amd64/linux/syscalls.master Sun Aug 23 19:41:16 2020 (r364511) @@ -551,8 +551,8 @@ 315 AUE_NULL STD { int linux_sched_getattr(l_pid_t pid, \ void *attr, l_uint size, l_uint flags); } ; Linux 3.15: -316 AUE_NULL STD { int linux_renameat2(l_int oldfd, \ - const char *oldname, l_int newfd, \ +316 AUE_NULL STD { int linux_renameat2(l_int olddfd, \ + const char *oldname, l_int newdfd, \ const char *newname, unsigned int flags); } ; Linux 3.17: 317 AUE_NULL STD { int linux_seccomp(l_uint op, l_uint flags, \ Modified: stable/12/sys/amd64/linux32/syscalls.master ============================================================================== --- stable/12/sys/amd64/linux32/syscalls.master Sun Aug 23 19:30:12 2020 (r364510) +++ stable/12/sys/amd64/linux32/syscalls.master Sun Aug 23 19:41:16 2020 (r364511) @@ -614,8 +614,8 @@ 352 AUE_NULL STD { int linux_sched_getattr(l_pid_t pid, \ void *attr, l_uint size, l_uint flags); } ; Linux 3.15: -353 AUE_NULL STD { int linux_renameat2(l_int oldfd, \ - const char *oldname, l_int newfd, \ +353 AUE_NULL STD { int linux_renameat2(l_int olddfd, \ + const char *oldname, l_int newdfd, \ const char *newname, unsigned int flags); } ; Linux 3.17: 354 AUE_NULL STD { int linux_seccomp(l_uint op, l_uint flags, \ Modified: stable/12/sys/arm64/linux/syscalls.master ============================================================================== --- stable/12/sys/arm64/linux/syscalls.master Sun Aug 23 19:30:12 2020 (r364510) +++ stable/12/sys/arm64/linux/syscalls.master Sun Aug 23 19:41:16 2020 (r364511) @@ -1464,9 +1464,9 @@ } 276 AUE_NULL STD { int linux_renameat2( - l_int oldfd, + l_int olddfd, const char *oldname, - l_int newfd, + l_int newdfd, const char *newname, unsigned int flags ); Modified: stable/12/sys/i386/linux/syscalls.master ============================================================================== --- stable/12/sys/i386/linux/syscalls.master Sun Aug 23 19:30:12 2020 (r364510) +++ stable/12/sys/i386/linux/syscalls.master Sun Aug 23 19:41:16 2020 (r364511) @@ -620,8 +620,8 @@ 352 AUE_NULL STD { int linux_sched_getattr(l_pid_t pid, \ void *attr, l_uint size, l_uint flags); } ; Linux 3.15: -353 AUE_NULL STD { int linux_renameat2(l_int oldfd, \ - const char *oldname, l_int newfd, \ +353 AUE_NULL STD { int linux_renameat2(l_int olddfd, \ + const char *oldname, l_int newdfd, \ const char *newname, unsigned int flags); } ; Linux 3.17: 354 AUE_NULL STD { int linux_seccomp(l_uint op, l_uint flags, \ From owner-svn-src-stable-12@freebsd.org Sun Aug 23 19:46:02 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3C3663C6E36; Sun, 23 Aug 2020 19:46:02 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZQjM4b45z4Chn; Sun, 23 Aug 2020 19:45:58 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 39C93C89E; Sun, 23 Aug 2020 19:45:57 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07NJjvHI090476; Sun, 23 Aug 2020 19:45:57 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NJjuOA090472; Sun, 23 Aug 2020 19:45:56 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008231945.07NJjuOA090472@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Aug 2020 19:45:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364515 - in stable/12/sys: amd64/linux amd64/linux32 arm64/linux i386/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in stable/12/sys: amd64/linux amd64/linux32 arm64/linux i386/linux X-SVN-Commit-Revision: 364515 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 19:46:02 -0000 Author: trasz Date: Sun Aug 23 19:45:56 2020 New Revision: 364515 URL: https://svnweb.freebsd.org/changeset/base/364515 Log: MFC r352221 by emaste: linuxulator: seccomp syscall first appeared in Linux 3.17 Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/amd64/linux/linux_dummy.c stable/12/sys/amd64/linux32/linux32_dummy.c stable/12/sys/arm64/linux/linux_dummy.c stable/12/sys/i386/linux/linux_dummy.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/linux/linux_dummy.c ============================================================================== --- stable/12/sys/amd64/linux/linux_dummy.c Sun Aug 23 19:44:29 2020 (r364514) +++ stable/12/sys/amd64/linux/linux_dummy.c Sun Aug 23 19:45:56 2020 (r364515) @@ -130,9 +130,10 @@ DUMMY(finit_module); DUMMY(sched_setattr); DUMMY(sched_getattr); /* Linux 3.15: */ -DUMMY(seccomp); DUMMY(memfd_create); DUMMY(kexec_file_load); +/* Linux 3.17: */ +DUMMY(seccomp); /* Linux 3.18: */ DUMMY(bpf); /* Linux 3.19: */ Modified: stable/12/sys/amd64/linux32/linux32_dummy.c ============================================================================== --- stable/12/sys/amd64/linux32/linux32_dummy.c Sun Aug 23 19:44:29 2020 (r364514) +++ stable/12/sys/amd64/linux32/linux32_dummy.c Sun Aug 23 19:45:56 2020 (r364515) @@ -137,8 +137,9 @@ DUMMY(finit_module); DUMMY(sched_setattr); DUMMY(sched_getattr); /* Linux 3.15: */ -DUMMY(seccomp); DUMMY(memfd_create); +/* Linux 3.17: */ +DUMMY(seccomp); /* Linux 3.18: */ DUMMY(bpf); /* Linux 3.19: */ Modified: stable/12/sys/arm64/linux/linux_dummy.c ============================================================================== --- stable/12/sys/arm64/linux/linux_dummy.c Sun Aug 23 19:44:29 2020 (r364514) +++ stable/12/sys/arm64/linux/linux_dummy.c Sun Aug 23 19:45:56 2020 (r364515) @@ -130,8 +130,9 @@ DUMMY(finit_module); DUMMY(sched_setattr); DUMMY(sched_getattr); /* Linux 3.15: */ -DUMMY(seccomp); DUMMY(memfd_create); +/* Linux 3.17: */ +DUMMY(seccomp); /* Linux 3.18: */ DUMMY(bpf); /* Linux 3.19: */ Modified: stable/12/sys/i386/linux/linux_dummy.c ============================================================================== --- stable/12/sys/i386/linux/linux_dummy.c Sun Aug 23 19:44:29 2020 (r364514) +++ stable/12/sys/i386/linux/linux_dummy.c Sun Aug 23 19:45:56 2020 (r364515) @@ -133,8 +133,9 @@ DUMMY(finit_module); DUMMY(sched_setattr); DUMMY(sched_getattr); /* Linux 3.14: */ -DUMMY(seccomp); DUMMY(memfd_create); +/* Linux 3.17: */ +DUMMY(seccomp); /* Linux 3.18: */ DUMMY(bpf); /* Linux 3.19: */ From owner-svn-src-stable-12@freebsd.org Sun Aug 23 19:44:35 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A3CE43C68E8; Sun, 23 Aug 2020 19:44:35 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZQgk17Cmz49l6; Sun, 23 Aug 2020 19:44:33 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 46700C917; Sun, 23 Aug 2020 19:44:31 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07NJiVUW088281; Sun, 23 Aug 2020 19:44:31 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NJiUfY088169; Sun, 23 Aug 2020 19:44:30 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008231944.07NJiUfY088169@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Aug 2020 19:44:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364514 - in stable/12/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in stable/12/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux X-SVN-Commit-Revision: 364514 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 19:44:36 -0000 Author: trasz Date: Sun Aug 23 19:44:29 2020 New Revision: 364514 URL: https://svnweb.freebsd.org/changeset/base/364514 Log: MFC r352210 by emaste: linux: add trivial renameat2 implementation Just return EINVAL if flags != 0. The Linux man page documents one case of EINVAL as "The filesystem does not support one of the flags in flags." After r351723 userland binaries will try using new system calls. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/amd64/linux/linux_dummy.c stable/12/sys/amd64/linux32/linux32_dummy.c stable/12/sys/arm64/linux/linux_dummy.c stable/12/sys/compat/linux/linux_file.c stable/12/sys/i386/linux/linux_dummy.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/linux/linux_dummy.c ============================================================================== --- stable/12/sys/amd64/linux/linux_dummy.c Sun Aug 23 19:43:47 2020 (r364513) +++ stable/12/sys/amd64/linux/linux_dummy.c Sun Aug 23 19:44:29 2020 (r364514) @@ -129,8 +129,6 @@ DUMMY(kcmp); DUMMY(finit_module); DUMMY(sched_setattr); DUMMY(sched_getattr); -/* Linux 3.14: */ -DUMMY(renameat2); /* Linux 3.15: */ DUMMY(seccomp); DUMMY(memfd_create); Modified: stable/12/sys/amd64/linux32/linux32_dummy.c ============================================================================== --- stable/12/sys/amd64/linux32/linux32_dummy.c Sun Aug 23 19:43:47 2020 (r364513) +++ stable/12/sys/amd64/linux32/linux32_dummy.c Sun Aug 23 19:44:29 2020 (r364514) @@ -136,8 +136,6 @@ DUMMY(kcmp); DUMMY(finit_module); DUMMY(sched_setattr); DUMMY(sched_getattr); -/* Linux 3.14: */ -DUMMY(renameat2); /* Linux 3.15: */ DUMMY(seccomp); DUMMY(memfd_create); Modified: stable/12/sys/arm64/linux/linux_dummy.c ============================================================================== --- stable/12/sys/arm64/linux/linux_dummy.c Sun Aug 23 19:43:47 2020 (r364513) +++ stable/12/sys/arm64/linux/linux_dummy.c Sun Aug 23 19:44:29 2020 (r364514) @@ -129,8 +129,6 @@ DUMMY(kcmp); DUMMY(finit_module); DUMMY(sched_setattr); DUMMY(sched_getattr); -/* Linux 3.14: */ -DUMMY(renameat2); /* Linux 3.15: */ DUMMY(seccomp); DUMMY(memfd_create); Modified: stable/12/sys/compat/linux/linux_file.c ============================================================================== --- stable/12/sys/compat/linux/linux_file.c Sun Aug 23 19:43:47 2020 (r364513) +++ stable/12/sys/compat/linux/linux_file.c Sun Aug 23 19:44:29 2020 (r364514) @@ -774,8 +774,28 @@ linux_rename(struct thread *td, struct linux_rename_ar int linux_renameat(struct thread *td, struct linux_renameat_args *args) { + struct linux_renameat2_args renameat2_args = { + .olddfd = args->olddfd, + .oldname = args->oldname, + .newdfd = args->newdfd, + .newname = args->newname, + .flags = 0 + }; + + return (linux_renameat2(td, &renameat2_args)); +} + +int +linux_renameat2(struct thread *td, struct linux_renameat2_args *args) +{ char *from, *to; int error, olddfd, newdfd; + + if (args->flags != 0) { + linux_msg(td, "renameat2 unsupported flags 0x%x\n", + args->flags); + return (EINVAL); + } olddfd = (args->olddfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->olddfd; newdfd = (args->newdfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->newdfd; Modified: stable/12/sys/i386/linux/linux_dummy.c ============================================================================== --- stable/12/sys/i386/linux/linux_dummy.c Sun Aug 23 19:43:47 2020 (r364513) +++ stable/12/sys/i386/linux/linux_dummy.c Sun Aug 23 19:44:29 2020 (r364514) @@ -133,8 +133,6 @@ DUMMY(finit_module); DUMMY(sched_setattr); DUMMY(sched_getattr); /* Linux 3.14: */ -DUMMY(renameat2); -/* Linux 3.15: */ DUMMY(seccomp); DUMMY(memfd_create); /* Linux 3.18: */ From owner-svn-src-stable-12@freebsd.org Sun Aug 23 19:47:15 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D41953C703F; Sun, 23 Aug 2020 19:47:15 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZQkp5Fqnz4DJd; Sun, 23 Aug 2020 19:47:14 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 3E0EBC920; Sun, 23 Aug 2020 19:47:11 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07NJlBQi092574; Sun, 23 Aug 2020 19:47:11 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NJlAb6092567; Sun, 23 Aug 2020 19:47:10 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008231947.07NJlAb6092567@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Aug 2020 19:47:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364516 - in stable/12/sys: amd64/linux amd64/linux32 arm64/linux i386/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in stable/12/sys: amd64/linux amd64/linux32 arm64/linux i386/linux X-SVN-Commit-Revision: 364516 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 19:47:16 -0000 Author: trasz Date: Sun Aug 23 19:47:10 2020 New Revision: 364516 URL: https://svnweb.freebsd.org/changeset/base/364516 Log: MFC r352222 by emaste: linuxulator: memfd_create first appeared in Linux 3.17 Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/amd64/linux/linux_dummy.c stable/12/sys/amd64/linux32/linux32_dummy.c stable/12/sys/arm64/linux/linux_dummy.c stable/12/sys/i386/linux/linux_dummy.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/linux/linux_dummy.c ============================================================================== --- stable/12/sys/amd64/linux/linux_dummy.c Sun Aug 23 19:45:56 2020 (r364515) +++ stable/12/sys/amd64/linux/linux_dummy.c Sun Aug 23 19:47:10 2020 (r364516) @@ -130,9 +130,9 @@ DUMMY(finit_module); DUMMY(sched_setattr); DUMMY(sched_getattr); /* Linux 3.15: */ -DUMMY(memfd_create); DUMMY(kexec_file_load); /* Linux 3.17: */ +DUMMY(memfd_create); DUMMY(seccomp); /* Linux 3.18: */ DUMMY(bpf); Modified: stable/12/sys/amd64/linux32/linux32_dummy.c ============================================================================== --- stable/12/sys/amd64/linux32/linux32_dummy.c Sun Aug 23 19:45:56 2020 (r364515) +++ stable/12/sys/amd64/linux32/linux32_dummy.c Sun Aug 23 19:47:10 2020 (r364516) @@ -136,9 +136,8 @@ DUMMY(kcmp); DUMMY(finit_module); DUMMY(sched_setattr); DUMMY(sched_getattr); -/* Linux 3.15: */ -DUMMY(memfd_create); /* Linux 3.17: */ +DUMMY(memfd_create); DUMMY(seccomp); /* Linux 3.18: */ DUMMY(bpf); Modified: stable/12/sys/arm64/linux/linux_dummy.c ============================================================================== --- stable/12/sys/arm64/linux/linux_dummy.c Sun Aug 23 19:45:56 2020 (r364515) +++ stable/12/sys/arm64/linux/linux_dummy.c Sun Aug 23 19:47:10 2020 (r364516) @@ -129,9 +129,8 @@ DUMMY(kcmp); DUMMY(finit_module); DUMMY(sched_setattr); DUMMY(sched_getattr); -/* Linux 3.15: */ -DUMMY(memfd_create); /* Linux 3.17: */ +DUMMY(memfd_create); DUMMY(seccomp); /* Linux 3.18: */ DUMMY(bpf); Modified: stable/12/sys/i386/linux/linux_dummy.c ============================================================================== --- stable/12/sys/i386/linux/linux_dummy.c Sun Aug 23 19:45:56 2020 (r364515) +++ stable/12/sys/i386/linux/linux_dummy.c Sun Aug 23 19:47:10 2020 (r364516) @@ -132,9 +132,8 @@ DUMMY(kcmp); DUMMY(finit_module); DUMMY(sched_setattr); DUMMY(sched_getattr); -/* Linux 3.14: */ -DUMMY(memfd_create); /* Linux 3.17: */ +DUMMY(memfd_create); DUMMY(seccomp); /* Linux 3.18: */ DUMMY(bpf); From owner-svn-src-stable-12@freebsd.org Sun Aug 23 19:54:08 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 682403C7C4A; Sun, 23 Aug 2020 19:54:08 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZQtl1B45z4JkN; Sun, 23 Aug 2020 19:54:07 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 570D8C8C4; Sun, 23 Aug 2020 19:54:04 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07NJs4l6002956; Sun, 23 Aug 2020 19:54:04 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NJs3jK002949; Sun, 23 Aug 2020 19:54:03 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008231954.07NJs3jK002949@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Aug 2020 19:54:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364518 - in stable/12/sys: amd64/linux amd64/linux32 arm64/linux i386/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in stable/12/sys: amd64/linux amd64/linux32 arm64/linux i386/linux X-SVN-Commit-Revision: 364518 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 19:54:08 -0000 Author: trasz Date: Sun Aug 23 19:54:03 2020 New Revision: 364518 URL: https://svnweb.freebsd.org/changeset/base/364518 Log: MFC r352224 by emaste: Update comments and ordering in linux*_dummy.c - sort alphabetically - getcpu arrived in Linux 2.6.19 - fanotify_* arrived in 2.6.36 Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/amd64/linux/linux_dummy.c stable/12/sys/amd64/linux32/linux32_dummy.c stable/12/sys/arm64/linux/linux_dummy.c stable/12/sys/i386/linux/linux_dummy.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/linux/linux_dummy.c ============================================================================== --- stable/12/sys/amd64/linux/linux_dummy.c Sun Aug 23 19:47:27 2020 (r364517) +++ stable/12/sys/amd64/linux/linux_dummy.c Sun Aug 23 19:54:03 2020 (r364518) @@ -103,6 +103,8 @@ DUMMY(tee); DUMMY(vmsplice); /* Linux 2.6.18: */ DUMMY(move_pages); +/* Linux 2.6.19: */ +DUMMY(getcpu); /* Linux 2.6.22: */ DUMMY(signalfd); /* Linux 2.6.27: */ @@ -110,7 +112,7 @@ DUMMY(signalfd4); DUMMY(inotify_init1); /* Linux 2.6.31: */ DUMMY(perf_event_open); -/* Linux 2.6.38: */ +/* Linux 2.6.36: */ DUMMY(fanotify_init); DUMMY(fanotify_mark); /* Linux 2.6.39: */ @@ -119,7 +121,6 @@ DUMMY(open_by_handle_at); DUMMY(clock_adjtime); /* Linux 3.0: */ DUMMY(setns); -DUMMY(getcpu); /* Linux 3.2: */ DUMMY(process_vm_readv); DUMMY(process_vm_writev); Modified: stable/12/sys/amd64/linux32/linux32_dummy.c ============================================================================== --- stable/12/sys/amd64/linux32/linux32_dummy.c Sun Aug 23 19:47:27 2020 (r364517) +++ stable/12/sys/amd64/linux32/linux32_dummy.c Sun Aug 23 19:54:03 2020 (r364518) @@ -118,7 +118,7 @@ DUMMY(signalfd4); DUMMY(inotify_init1); /* Linux 2.6.31: */ DUMMY(perf_event_open); -/* Linux 2.6.33: */ +/* Linux 2.6.36: */ DUMMY(fanotify_init); DUMMY(fanotify_mark); /* Linux 2.6.39: */ Modified: stable/12/sys/arm64/linux/linux_dummy.c ============================================================================== --- stable/12/sys/arm64/linux/linux_dummy.c Sun Aug 23 19:47:27 2020 (r364517) +++ stable/12/sys/arm64/linux/linux_dummy.c Sun Aug 23 19:54:03 2020 (r364518) @@ -105,12 +105,14 @@ DUMMY(tee); DUMMY(vmsplice); /* Linux 2.6.18: */ DUMMY(move_pages); +/* Linux 2.6.19: */ +DUMMY(getcpu); /* Linux 2.6.27: */ DUMMY(signalfd4); DUMMY(inotify_init1); /* Linux 2.6.31: */ DUMMY(perf_event_open); -/* Linux 2.6.38: */ +/* Linux 2.6.36: */ DUMMY(fanotify_init); DUMMY(fanotify_mark); /* Linux 2.6.39: */ @@ -119,7 +121,6 @@ DUMMY(open_by_handle_at); DUMMY(clock_adjtime); /* Linux 3.0: */ DUMMY(setns); -DUMMY(getcpu); /* Linux 3.2: */ DUMMY(process_vm_readv); DUMMY(process_vm_writev); Modified: stable/12/sys/i386/linux/linux_dummy.c ============================================================================== --- stable/12/sys/i386/linux/linux_dummy.c Sun Aug 23 19:47:27 2020 (r364517) +++ stable/12/sys/i386/linux/linux_dummy.c Sun Aug 23 19:54:03 2020 (r364518) @@ -114,7 +114,7 @@ DUMMY(signalfd4); DUMMY(inotify_init1); /* Linux 2.6.31: */ DUMMY(perf_event_open); -/* Linux 2.6.33: */ +/* Linux 2.6.36: */ DUMMY(fanotify_init); DUMMY(fanotify_mark); /* Linux 2.6.39: */ From owner-svn-src-stable-12@freebsd.org Sun Aug 23 19:59:42 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DB8573C825C; Sun, 23 Aug 2020 19:59:42 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZR1B1D77z4NMx; Sun, 23 Aug 2020 19:59:41 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 2101BC961; Sun, 23 Aug 2020 19:59:40 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07NJxd4P003336; Sun, 23 Aug 2020 19:59:39 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NJxcLT003328; Sun, 23 Aug 2020 19:59:38 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008231959.07NJxcLT003328@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Aug 2020 19:59:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364519 - in stable/12/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in stable/12/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux X-SVN-Commit-Revision: 364519 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 19:59:43 -0000 Author: trasz Date: Sun Aug 23 19:59:38 2020 New Revision: 364519 URL: https://svnweb.freebsd.org/changeset/base/364519 Log: MFC r356177: Implement Linux syslog(2) syscall; just enough to make Linux dmesg(8) utility work. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/amd64/linux/linux_dummy.c stable/12/sys/amd64/linux32/linux32_dummy.c stable/12/sys/arm64/linux/linux_dummy.c stable/12/sys/compat/linux/linux_misc.c stable/12/sys/compat/linux/linux_misc.h stable/12/sys/i386/linux/linux_dummy.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/linux/linux_dummy.c ============================================================================== --- stable/12/sys/amd64/linux/linux_dummy.c Sun Aug 23 19:54:03 2020 (r364518) +++ stable/12/sys/amd64/linux/linux_dummy.c Sun Aug 23 19:59:38 2020 (r364519) @@ -60,7 +60,6 @@ UNIMPLEMENTED(uselib); UNIMPLEMENTED(vserver); DUMMY(sendfile); -DUMMY(syslog); DUMMY(setfsuid); DUMMY(setfsgid); DUMMY(sysfs); Modified: stable/12/sys/amd64/linux32/linux32_dummy.c ============================================================================== --- stable/12/sys/amd64/linux32/linux32_dummy.c Sun Aug 23 19:54:03 2020 (r364518) +++ stable/12/sys/amd64/linux32/linux32_dummy.c Sun Aug 23 19:59:38 2020 (r364519) @@ -63,7 +63,6 @@ UNIMPLEMENTED(vserver); DUMMY(stime); DUMMY(olduname); -DUMMY(syslog); DUMMY(uname); DUMMY(vhangup); DUMMY(swapoff); Modified: stable/12/sys/arm64/linux/linux_dummy.c ============================================================================== --- stable/12/sys/arm64/linux/linux_dummy.c Sun Aug 23 19:54:03 2020 (r364518) +++ stable/12/sys/arm64/linux/linux_dummy.c Sun Aug 23 19:59:38 2020 (r364519) @@ -65,7 +65,6 @@ UNIMPLEMENTED(uselib); UNIMPLEMENTED(vserver); DUMMY(sendfile); -DUMMY(syslog); DUMMY(setfsuid); DUMMY(setfsgid); DUMMY(vhangup); Modified: stable/12/sys/compat/linux/linux_misc.c ============================================================================== --- stable/12/sys/compat/linux/linux_misc.c Sun Aug 23 19:54:03 2020 (r364518) +++ stable/12/sys/compat/linux/linux_misc.c Sun Aug 23 19:59:38 2020 (r364519) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -2626,4 +2627,67 @@ linux_mincore(struct thread *td, struct linux_mincore_ if (args->start & PAGE_MASK) return (EINVAL); return (kern_mincore(td, args->start, args->len, args->vec)); +} + +#define SYSLOG_TAG "<6>" + +int +linux_syslog(struct thread *td, struct linux_syslog_args *args) +{ + char buf[128], *src, *dst; + u_int seq; + int buflen, error; + + if (args->type != LINUX_SYSLOG_ACTION_READ_ALL) { + linux_msg(td, "syslog unsupported type 0x%x", args->type); + return (EINVAL); + } + + if (args->len < 6) { + td->td_retval[0] = 0; + return (0); + } + + error = priv_check(td, PRIV_MSGBUF); + if (error) + return (error); + + mtx_lock(&msgbuf_lock); + msgbuf_peekbytes(msgbufp, NULL, 0, &seq); + mtx_unlock(&msgbuf_lock); + + dst = args->buf; + error = copyout(&SYSLOG_TAG, dst, sizeof(SYSLOG_TAG)); + /* The -1 is to skip the trailing '\0'. */ + dst += sizeof(SYSLOG_TAG) - 1; + + while (error == 0) { + mtx_lock(&msgbuf_lock); + buflen = msgbuf_peekbytes(msgbufp, buf, sizeof(buf), &seq); + mtx_unlock(&msgbuf_lock); + + if (buflen == 0) + break; + + for (src = buf; src < buf + buflen && error == 0; src++) { + if (*src == '\0') + continue; + + if (dst >= args->buf + args->len) + goto out; + + error = copyout(src, dst, 1); + dst++; + + if (*src == '\n' && *(src + 1) != '<' && + dst + sizeof(SYSLOG_TAG) < args->buf + args->len) { + error = copyout(&SYSLOG_TAG, + dst, sizeof(SYSLOG_TAG)); + dst += sizeof(SYSLOG_TAG) - 1; + } + } + } +out: + td->td_retval[0] = dst - args->buf; + return (error); } Modified: stable/12/sys/compat/linux/linux_misc.h ============================================================================== --- stable/12/sys/compat/linux/linux_misc.h Sun Aug 23 19:54:03 2020 (r364518) +++ stable/12/sys/compat/linux/linux_misc.h Sun Aug 23 19:59:38 2020 (r364519) @@ -149,6 +149,9 @@ extern int stclohz; #define LINUX_GRND_NONBLOCK 0x0001 #define LINUX_GRND_RANDOM 0x0002 +/* Linux syslog flags */ +#define LINUX_SYSLOG_ACTION_READ_ALL 3 + #if defined(__amd64__) && !defined(COMPAT_LINUX32) int linux_ptrace_status(struct thread *td, int pid, int status); #endif Modified: stable/12/sys/i386/linux/linux_dummy.c ============================================================================== --- stable/12/sys/i386/linux/linux_dummy.c Sun Aug 23 19:54:03 2020 (r364518) +++ stable/12/sys/i386/linux/linux_dummy.c Sun Aug 23 19:59:38 2020 (r364519) @@ -64,7 +64,6 @@ UNIMPLEMENTED(vserver); DUMMY(stime); DUMMY(fstat); DUMMY(olduname); -DUMMY(syslog); DUMMY(uname); DUMMY(vhangup); DUMMY(vm86old); From owner-svn-src-stable-12@freebsd.org Sun Aug 23 20:08:50 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 016BB3C8FAB; Sun, 23 Aug 2020 20:08:50 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZRCj6DLbz4QQF; Sun, 23 Aug 2020 20:08:49 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 B91AACAC3; Sun, 23 Aug 2020 20:08:49 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07NK8nT8009537; Sun, 23 Aug 2020 20:08:49 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NK8n3U009535; Sun, 23 Aug 2020 20:08:49 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008232008.07NK8n3U009535@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Aug 2020 20:08:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364523 - in stable/12/sys: amd64/linux32 i386/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in stable/12/sys: amd64/linux32 i386/linux X-SVN-Commit-Revision: 364523 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 20:08:50 -0000 Author: trasz Date: Sun Aug 23 20:08:49 2020 New Revision: 364523 URL: https://svnweb.freebsd.org/changeset/base/364523 Log: MFC r356229: Fix definitions for Linux getcpu(2). Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/amd64/linux32/syscalls.master stable/12/sys/i386/linux/syscalls.master Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/linux32/syscalls.master ============================================================================== --- stable/12/sys/amd64/linux32/syscalls.master Sun Aug 23 20:08:05 2020 (r364522) +++ stable/12/sys/amd64/linux32/syscalls.master Sun Aug 23 20:08:49 2020 (r364523) @@ -533,7 +533,8 @@ ; Linux 2.6.18: 317 AUE_NULL STD { int linux_move_pages(void); } ; Linux 2.6.19: -318 AUE_NULL STD { int linux_getcpu(void); } +318 AUE_NULL STD { int linux_getcpu(l_uint *cpu, l_uint *node, \ + void *cache); } 319 AUE_NULL STD { int linux_epoll_pwait(l_int epfd, struct epoll_event *events, \ l_int maxevents, l_int timeout, l_sigset_t *mask, \ l_size_t sigsetsize); } Modified: stable/12/sys/i386/linux/syscalls.master ============================================================================== --- stable/12/sys/i386/linux/syscalls.master Sun Aug 23 20:08:05 2020 (r364522) +++ stable/12/sys/i386/linux/syscalls.master Sun Aug 23 20:08:49 2020 (r364523) @@ -540,7 +540,8 @@ ; Linux 2.6.18: 317 AUE_NULL STD { int linux_move_pages(void); } ; Linux 2.6.19: -318 AUE_NULL STD { int linux_getcpu(void); } +318 AUE_NULL STD { int linux_getcpu(l_uint *cpu, l_uint *node, \ + void *cache); } 319 AUE_NULL STD { int linux_epoll_pwait(l_int epfd, struct epoll_event *events, \ l_int maxevents, l_int timeout, l_sigset_t *mask, \ l_size_t sigsetsize); } From owner-svn-src-stable-12@freebsd.org Sun Aug 23 20:10:12 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CAA2E3C8DF8; Sun, 23 Aug 2020 20:10:12 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZRFJ53mYz4QR3; Sun, 23 Aug 2020 20:10:12 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 91A92CD22; Sun, 23 Aug 2020 20:10:12 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07NKACdL009701; Sun, 23 Aug 2020 20:10:12 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NKABi8009695; Sun, 23 Aug 2020 20:10:11 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008232010.07NKABi8009695@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Aug 2020 20:10:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364524 - in stable/12/sys: amd64/linux32 i386/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in stable/12/sys: amd64/linux32 i386/linux X-SVN-Commit-Revision: 364524 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 20:10:12 -0000 Author: trasz Date: Sun Aug 23 20:10:10 2020 New Revision: 364524 URL: https://svnweb.freebsd.org/changeset/base/364524 Log: MFC r356231: Regen after r356229. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/amd64/linux32/linux32_proto.h stable/12/sys/amd64/linux32/linux32_sysent.c stable/12/sys/amd64/linux32/linux32_systrace_args.c stable/12/sys/i386/linux/linux_proto.h stable/12/sys/i386/linux/linux_sysent.c stable/12/sys/i386/linux/linux_systrace_args.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/linux32/linux32_proto.h ============================================================================== --- stable/12/sys/amd64/linux32/linux32_proto.h Sun Aug 23 20:08:49 2020 (r364523) +++ stable/12/sys/amd64/linux32/linux32_proto.h Sun Aug 23 20:10:10 2020 (r364524) @@ -1044,7 +1044,9 @@ struct linux_move_pages_args { register_t dummy; }; struct linux_getcpu_args { - register_t dummy; + char cpu_l_[PADL_(l_uint *)]; l_uint * cpu; char cpu_r_[PADR_(l_uint *)]; + char node_l_[PADL_(l_uint *)]; l_uint * node; char node_r_[PADR_(l_uint *)]; + char cache_l_[PADL_(void *)]; void * cache; char cache_r_[PADR_(void *)]; }; struct linux_epoll_pwait_args { char epfd_l_[PADL_(l_int)]; l_int epfd; char epfd_r_[PADR_(l_int)]; Modified: stable/12/sys/amd64/linux32/linux32_sysent.c ============================================================================== --- stable/12/sys/amd64/linux32/linux32_sysent.c Sun Aug 23 20:08:49 2020 (r364523) +++ stable/12/sys/amd64/linux32/linux32_sysent.c Sun Aug 23 20:10:10 2020 (r364524) @@ -335,7 +335,7 @@ struct sysent linux32_sysent[] = { { 0, (sy_call_t *)linux_tee, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 315 = linux_tee */ { 0, (sy_call_t *)linux_vmsplice, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 316 = linux_vmsplice */ { 0, (sy_call_t *)linux_move_pages, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 317 = linux_move_pages */ - { 0, (sy_call_t *)linux_getcpu, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 318 = linux_getcpu */ + { AS(linux_getcpu_args), (sy_call_t *)linux_getcpu, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 318 = linux_getcpu */ { AS(linux_epoll_pwait_args), (sy_call_t *)linux_epoll_pwait, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 319 = linux_epoll_pwait */ { AS(linux_utimensat_args), (sy_call_t *)linux_utimensat, AUE_FUTIMESAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 320 = linux_utimensat */ { 0, (sy_call_t *)linux_signalfd, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 321 = linux_signalfd */ Modified: stable/12/sys/amd64/linux32/linux32_systrace_args.c ============================================================================== --- stable/12/sys/amd64/linux32/linux32_systrace_args.c Sun Aug 23 20:08:49 2020 (r364523) +++ stable/12/sys/amd64/linux32/linux32_systrace_args.c Sun Aug 23 20:10:10 2020 (r364524) @@ -2152,7 +2152,11 @@ systrace_args(int sysnum, void *params, uint64_t *uarg } /* linux_getcpu */ case 318: { - *n_args = 0; + struct linux_getcpu_args *p = params; + uarg[0] = (intptr_t) p->cpu; /* l_uint * */ + uarg[1] = (intptr_t) p->node; /* l_uint * */ + uarg[2] = (intptr_t) p->cache; /* void * */ + *n_args = 3; break; } /* linux_epoll_pwait */ @@ -6235,6 +6239,19 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; /* linux_getcpu */ case 318: + switch(ndx) { + case 0: + p = "userland l_uint *"; + break; + case 1: + p = "userland l_uint *"; + break; + case 2: + p = "userland void *"; + break; + default: + break; + }; break; /* linux_epoll_pwait */ case 319: @@ -8730,6 +8747,9 @@ systrace_return_setargdesc(int sysnum, int ndx, char * case 317: /* linux_getcpu */ case 318: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_epoll_pwait */ case 319: if (ndx == 0 || ndx == 1) Modified: stable/12/sys/i386/linux/linux_proto.h ============================================================================== --- stable/12/sys/i386/linux/linux_proto.h Sun Aug 23 20:08:49 2020 (r364523) +++ stable/12/sys/i386/linux/linux_proto.h Sun Aug 23 20:10:10 2020 (r364524) @@ -1053,7 +1053,9 @@ struct linux_move_pages_args { register_t dummy; }; struct linux_getcpu_args { - register_t dummy; + char cpu_l_[PADL_(l_uint *)]; l_uint * cpu; char cpu_r_[PADR_(l_uint *)]; + char node_l_[PADL_(l_uint *)]; l_uint * node; char node_r_[PADR_(l_uint *)]; + char cache_l_[PADL_(void *)]; void * cache; char cache_r_[PADR_(void *)]; }; struct linux_epoll_pwait_args { char epfd_l_[PADL_(l_int)]; l_int epfd; char epfd_r_[PADR_(l_int)]; Modified: stable/12/sys/i386/linux/linux_sysent.c ============================================================================== --- stable/12/sys/i386/linux/linux_sysent.c Sun Aug 23 20:08:49 2020 (r364523) +++ stable/12/sys/i386/linux/linux_sysent.c Sun Aug 23 20:10:10 2020 (r364524) @@ -335,7 +335,7 @@ struct sysent linux_sysent[] = { { 0, (sy_call_t *)linux_tee, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 315 = linux_tee */ { 0, (sy_call_t *)linux_vmsplice, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 316 = linux_vmsplice */ { 0, (sy_call_t *)linux_move_pages, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 317 = linux_move_pages */ - { 0, (sy_call_t *)linux_getcpu, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 318 = linux_getcpu */ + { AS(linux_getcpu_args), (sy_call_t *)linux_getcpu, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 318 = linux_getcpu */ { AS(linux_epoll_pwait_args), (sy_call_t *)linux_epoll_pwait, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 319 = linux_epoll_pwait */ { AS(linux_utimensat_args), (sy_call_t *)linux_utimensat, AUE_FUTIMESAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 320 = linux_utimensat */ { 0, (sy_call_t *)linux_signalfd, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 321 = linux_signalfd */ Modified: stable/12/sys/i386/linux/linux_systrace_args.c ============================================================================== --- stable/12/sys/i386/linux/linux_systrace_args.c Sun Aug 23 20:08:49 2020 (r364523) +++ stable/12/sys/i386/linux/linux_systrace_args.c Sun Aug 23 20:10:10 2020 (r364524) @@ -2219,7 +2219,11 @@ systrace_args(int sysnum, void *params, uint64_t *uarg } /* linux_getcpu */ case 318: { - *n_args = 0; + struct linux_getcpu_args *p = params; + uarg[0] = (intptr_t) p->cpu; /* l_uint * */ + uarg[1] = (intptr_t) p->node; /* l_uint * */ + uarg[2] = (intptr_t) p->cache; /* void * */ + *n_args = 3; break; } /* linux_epoll_pwait */ @@ -6428,6 +6432,19 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; /* linux_getcpu */ case 318: + switch(ndx) { + case 0: + p = "userland l_uint *"; + break; + case 1: + p = "userland l_uint *"; + break; + case 2: + p = "userland void *"; + break; + default: + break; + }; break; /* linux_epoll_pwait */ case 319: @@ -8964,6 +8981,9 @@ systrace_return_setargdesc(int sysnum, int ndx, char * case 317: /* linux_getcpu */ case 318: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_epoll_pwait */ case 319: if (ndx == 0 || ndx == 1) From owner-svn-src-stable-12@freebsd.org Sun Aug 23 20:12:09 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3857D3C912A; Sun, 23 Aug 2020 20:12:09 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZRHY0pCRz4Qtl; Sun, 23 Aug 2020 20:12:09 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 F358DCF9B; Sun, 23 Aug 2020 20:12:08 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07NKC8JJ014693; Sun, 23 Aug 2020 20:12:08 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NKC8wi014687; Sun, 23 Aug 2020 20:12:08 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008232012.07NKC8wi014687@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Aug 2020 20:12:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364525 - in stable/12/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in stable/12/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux X-SVN-Commit-Revision: 364525 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 20:12:09 -0000 Author: trasz Date: Sun Aug 23 20:12:07 2020 New Revision: 364525 URL: https://svnweb.freebsd.org/changeset/base/364525 Log: MFC r356241: Add basic getcpu(2) support to linuxulator. The purpose of this syscall is to query the CPU number and the NUMA domain the calling thread is currently running on. The third argument is ignored. It doesn't do anything regarding scheduling - it's literally just a way to query the current state, without any guarantees you won't get rescheduled an opcode later. This unbreaks Java from CentOS 8 (java-11-openjdk-11.0.5.10-0.el8_0.x86_64). Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/amd64/linux/linux_dummy.c stable/12/sys/amd64/linux32/linux32_dummy.c stable/12/sys/arm64/linux/linux_dummy.c stable/12/sys/compat/linux/linux_misc.c stable/12/sys/i386/linux/linux_dummy.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/linux/linux_dummy.c ============================================================================== --- stable/12/sys/amd64/linux/linux_dummy.c Sun Aug 23 20:10:10 2020 (r364524) +++ stable/12/sys/amd64/linux/linux_dummy.c Sun Aug 23 20:12:07 2020 (r364525) @@ -102,8 +102,6 @@ DUMMY(tee); DUMMY(vmsplice); /* Linux 2.6.18: */ DUMMY(move_pages); -/* Linux 2.6.19: */ -DUMMY(getcpu); /* Linux 2.6.22: */ DUMMY(signalfd); /* Linux 2.6.27: */ Modified: stable/12/sys/amd64/linux32/linux32_dummy.c ============================================================================== --- stable/12/sys/amd64/linux32/linux32_dummy.c Sun Aug 23 20:10:10 2020 (r364524) +++ stable/12/sys/amd64/linux32/linux32_dummy.c Sun Aug 23 20:12:07 2020 (r364525) @@ -108,8 +108,6 @@ DUMMY(tee); DUMMY(vmsplice); /* Linux 2.6.18: */ DUMMY(move_pages); -/* Linux 2.6.19: */ -DUMMY(getcpu); /* Linux 2.6.22: */ DUMMY(signalfd); /* Linux 2.6.27: */ Modified: stable/12/sys/arm64/linux/linux_dummy.c ============================================================================== --- stable/12/sys/arm64/linux/linux_dummy.c Sun Aug 23 20:10:10 2020 (r364524) +++ stable/12/sys/arm64/linux/linux_dummy.c Sun Aug 23 20:12:07 2020 (r364525) @@ -104,8 +104,6 @@ DUMMY(tee); DUMMY(vmsplice); /* Linux 2.6.18: */ DUMMY(move_pages); -/* Linux 2.6.19: */ -DUMMY(getcpu); /* Linux 2.6.27: */ DUMMY(signalfd4); DUMMY(inotify_init1); Modified: stable/12/sys/compat/linux/linux_misc.c ============================================================================== --- stable/12/sys/compat/linux/linux_misc.c Sun Aug 23 20:10:10 2020 (r364524) +++ stable/12/sys/compat/linux/linux_misc.c Sun Aug 23 20:12:07 2020 (r364525) @@ -2691,3 +2691,19 @@ out: td->td_retval[0] = dst - args->buf; return (error); } + +int +linux_getcpu(struct thread *td, struct linux_getcpu_args *args) +{ + int cpu, error, node; + + cpu = td->td_oncpu; /* Make sure it doesn't change during copyout(9) */ + error = 0; + node = 0; /* XXX: Fake NUMA node 0 for now */ + + if (args->cpu != NULL) + error = copyout(&cpu, args->cpu, sizeof(l_int)); + if (args->node != NULL) + error = copyout(&node, args->node, sizeof(l_int)); + return (error); +} Modified: stable/12/sys/i386/linux/linux_dummy.c ============================================================================== --- stable/12/sys/i386/linux/linux_dummy.c Sun Aug 23 20:10:10 2020 (r364524) +++ stable/12/sys/i386/linux/linux_dummy.c Sun Aug 23 20:12:07 2020 (r364525) @@ -104,8 +104,6 @@ DUMMY(tee); DUMMY(vmsplice); /* Linux 2.6.18: */ DUMMY(move_pages); -/* Linux 2.6.19: */ -DUMMY(getcpu); /* Linux 2.6.22: */ DUMMY(signalfd); /* Linux 2.6.27: */ From owner-svn-src-stable-12@freebsd.org Sun Aug 23 20:14:59 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 741AB3C92FE; Sun, 23 Aug 2020 20:14:59 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZRLq2v12z4R25; Sun, 23 Aug 2020 20:14:59 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 4243BCBBD; Sun, 23 Aug 2020 20:14:59 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07NKExIQ015849; Sun, 23 Aug 2020 20:14:59 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NKEvJV015842; Sun, 23 Aug 2020 20:14:57 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008232014.07NKEvJV015842@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Aug 2020 20:14:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364526 - stable/12/sys/amd64/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/amd64/linux X-SVN-Commit-Revision: 364526 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 20:14:59 -0000 Author: trasz Date: Sun Aug 23 20:14:57 2020 New Revision: 364526 URL: https://svnweb.freebsd.org/changeset/base/364526 Log: MFC r357503: Add missing linux(4) syscall entries. This fixes missing debug messages for some of the unimplemented syscalls, in particular the AIO-related ones. MFC r357504: Regen after r357503. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/amd64/linux/linux_dummy.c stable/12/sys/amd64/linux/linux_proto.h stable/12/sys/amd64/linux/linux_syscall.h stable/12/sys/amd64/linux/linux_syscalls.c stable/12/sys/amd64/linux/linux_sysent.c stable/12/sys/amd64/linux/linux_systrace_args.c stable/12/sys/amd64/linux/syscalls.master Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/linux/linux_dummy.c ============================================================================== --- stable/12/sys/amd64/linux/linux_dummy.c Sun Aug 23 20:12:07 2020 (r364525) +++ stable/12/sys/amd64/linux/linux_dummy.c Sun Aug 23 20:14:57 2020 (r364526) @@ -53,9 +53,9 @@ UNIMPLEMENTED(getpmsg); UNIMPLEMENTED(nfsservctl); /* Added in Linux 2.2 removed in 3.1. */ UNIMPLEMENTED(putpmsg); UNIMPLEMENTED(query_module); /* Added in Linux 2.2 removed in 2.6. */ +UNIMPLEMENTED(tuxcall); UNIMPLEMENTED(security); UNIMPLEMENTED(set_thread_area); -UNIMPLEMENTED(tuxcall); UNIMPLEMENTED(uselib); UNIMPLEMENTED(vserver); @@ -64,14 +64,23 @@ DUMMY(setfsuid); DUMMY(setfsgid); DUMMY(sysfs); DUMMY(vhangup); +DUMMY(modify_ldt); DUMMY(pivot_root); DUMMY(adjtimex); DUMMY(swapoff); DUMMY(init_module); +DUMMY(ioperm); DUMMY(delete_module); DUMMY(quotactl); +DUMMY(readahead); +DUMMY(io_setup); +DUMMY(io_destroy); +DUMMY(io_getevents); +DUMMY(io_submit); +DUMMY(io_cancel); DUMMY(lookup_dcookie); DUMMY(remap_file_pages); +DUMMY(restart_syscall); DUMMY(semtimedop); DUMMY(mbind); DUMMY(get_mempolicy); Modified: stable/12/sys/amd64/linux/linux_proto.h ============================================================================== --- stable/12/sys/amd64/linux/linux_proto.h Sun Aug 23 20:12:07 2020 (r364525) +++ stable/12/sys/amd64/linux/linux_proto.h Sun Aug 23 20:14:57 2020 (r364526) @@ -551,6 +551,9 @@ struct linux_sched_rr_get_interval_args { struct linux_vhangup_args { register_t dummy; }; +struct linux_modify_ldt_args { + register_t dummy; +}; struct linux_pivot_root_args { register_t dummy; }; @@ -606,6 +609,9 @@ struct linux_setdomainname_args { struct linux_iopl_args { char level_l_[PADL_(l_uint)]; l_uint level; char level_r_[PADR_(l_uint)]; }; +struct linux_ioperm_args { + register_t dummy; +}; struct linux_init_module_args { register_t dummy; }; @@ -618,6 +624,9 @@ struct linux_quotactl_args { struct linux_gettid_args { register_t dummy; }; +struct linux_readahead_args { + register_t dummy; +}; struct linux_setxattr_args { register_t dummy; }; @@ -679,6 +688,21 @@ struct linux_sched_getaffinity_args { char len_l_[PADL_(l_uint)]; l_uint len; char len_r_[PADR_(l_uint)]; char user_mask_ptr_l_[PADL_(l_ulong *)]; l_ulong * user_mask_ptr; char user_mask_ptr_r_[PADR_(l_ulong *)]; }; +struct linux_io_setup_args { + register_t dummy; +}; +struct linux_io_destroy_args { + register_t dummy; +}; +struct linux_io_getevents_args { + register_t dummy; +}; +struct linux_io_submit_args { + register_t dummy; +}; +struct linux_io_cancel_args { + register_t dummy; +}; struct linux_lookup_dcookie_args { register_t dummy; }; @@ -696,6 +720,9 @@ struct linux_getdents64_args { struct linux_set_tid_address_args { char tidptr_l_[PADL_(l_int *)]; l_int * tidptr; char tidptr_r_[PADR_(l_int *)]; }; +struct linux_restart_syscall_args { + register_t dummy; +}; struct linux_semtimedop_args { register_t dummy; }; @@ -1360,6 +1387,7 @@ int linux_sched_get_priority_max(struct thread *, stru int linux_sched_get_priority_min(struct thread *, struct linux_sched_get_priority_min_args *); int linux_sched_rr_get_interval(struct thread *, struct linux_sched_rr_get_interval_args *); int linux_vhangup(struct thread *, struct linux_vhangup_args *); +int linux_modify_ldt(struct thread *, struct linux_modify_ldt_args *); int linux_pivot_root(struct thread *, struct linux_pivot_root_args *); int linux_sysctl(struct thread *, struct linux_sysctl_args *); int linux_prctl(struct thread *, struct linux_prctl_args *); @@ -1373,10 +1401,12 @@ int linux_reboot(struct thread *, struct linux_reboot_ int linux_sethostname(struct thread *, struct linux_sethostname_args *); int linux_setdomainname(struct thread *, struct linux_setdomainname_args *); int linux_iopl(struct thread *, struct linux_iopl_args *); +int linux_ioperm(struct thread *, struct linux_ioperm_args *); int linux_init_module(struct thread *, struct linux_init_module_args *); int linux_delete_module(struct thread *, struct linux_delete_module_args *); int linux_quotactl(struct thread *, struct linux_quotactl_args *); int linux_gettid(struct thread *, struct linux_gettid_args *); +int linux_readahead(struct thread *, struct linux_readahead_args *); int linux_setxattr(struct thread *, struct linux_setxattr_args *); int linux_lsetxattr(struct thread *, struct linux_lsetxattr_args *); int linux_fsetxattr(struct thread *, struct linux_fsetxattr_args *); @@ -1394,11 +1424,17 @@ int linux_time(struct thread *, struct linux_time_args int linux_sys_futex(struct thread *, struct linux_sys_futex_args *); int linux_sched_setaffinity(struct thread *, struct linux_sched_setaffinity_args *); int linux_sched_getaffinity(struct thread *, struct linux_sched_getaffinity_args *); +int linux_io_setup(struct thread *, struct linux_io_setup_args *); +int linux_io_destroy(struct thread *, struct linux_io_destroy_args *); +int linux_io_getevents(struct thread *, struct linux_io_getevents_args *); +int linux_io_submit(struct thread *, struct linux_io_submit_args *); +int linux_io_cancel(struct thread *, struct linux_io_cancel_args *); int linux_lookup_dcookie(struct thread *, struct linux_lookup_dcookie_args *); int linux_epoll_create(struct thread *, struct linux_epoll_create_args *); int linux_remap_file_pages(struct thread *, struct linux_remap_file_pages_args *); int linux_getdents64(struct thread *, struct linux_getdents64_args *); int linux_set_tid_address(struct thread *, struct linux_set_tid_address_args *); +int linux_restart_syscall(struct thread *, struct linux_restart_syscall_args *); int linux_semtimedop(struct thread *, struct linux_semtimedop_args *); int linux_fadvise64(struct thread *, struct linux_fadvise64_args *); int linux_timer_create(struct thread *, struct linux_timer_create_args *); @@ -1674,6 +1710,7 @@ int linux_io_uring_register(struct thread *, struct li #define LINUX_SYS_AUE_linux_sched_get_priority_min AUE_SCHED_GET_PRIORITY_MIN #define LINUX_SYS_AUE_linux_sched_rr_get_interval AUE_SCHED_RR_GET_INTERVAL #define LINUX_SYS_AUE_linux_vhangup AUE_NULL +#define LINUX_SYS_AUE_linux_modify_ldt AUE_NULL #define LINUX_SYS_AUE_linux_pivot_root AUE_PIVOT_ROOT #define LINUX_SYS_AUE_linux_sysctl AUE_SYSCTL #define LINUX_SYS_AUE_linux_prctl AUE_PRCTL @@ -1687,10 +1724,12 @@ int linux_io_uring_register(struct thread *, struct li #define LINUX_SYS_AUE_linux_sethostname AUE_SYSCTL #define LINUX_SYS_AUE_linux_setdomainname AUE_SYSCTL #define LINUX_SYS_AUE_linux_iopl AUE_NULL +#define LINUX_SYS_AUE_linux_ioperm AUE_NULL #define LINUX_SYS_AUE_linux_init_module AUE_NULL #define LINUX_SYS_AUE_linux_delete_module AUE_NULL #define LINUX_SYS_AUE_linux_quotactl AUE_QUOTACTL #define LINUX_SYS_AUE_linux_gettid AUE_NULL +#define LINUX_SYS_AUE_linux_readahead AUE_NULL #define LINUX_SYS_AUE_linux_setxattr AUE_NULL #define LINUX_SYS_AUE_linux_lsetxattr AUE_NULL #define LINUX_SYS_AUE_linux_fsetxattr AUE_NULL @@ -1708,11 +1747,17 @@ int linux_io_uring_register(struct thread *, struct li #define LINUX_SYS_AUE_linux_sys_futex AUE_NULL #define LINUX_SYS_AUE_linux_sched_setaffinity AUE_NULL #define LINUX_SYS_AUE_linux_sched_getaffinity AUE_NULL +#define LINUX_SYS_AUE_linux_io_setup AUE_NULL +#define LINUX_SYS_AUE_linux_io_destroy AUE_NULL +#define LINUX_SYS_AUE_linux_io_getevents AUE_NULL +#define LINUX_SYS_AUE_linux_io_submit AUE_NULL +#define LINUX_SYS_AUE_linux_io_cancel AUE_NULL #define LINUX_SYS_AUE_linux_lookup_dcookie AUE_NULL #define LINUX_SYS_AUE_linux_epoll_create AUE_NULL #define LINUX_SYS_AUE_linux_remap_file_pages AUE_NULL #define LINUX_SYS_AUE_linux_getdents64 AUE_GETDIRENTRIES #define LINUX_SYS_AUE_linux_set_tid_address AUE_NULL +#define LINUX_SYS_AUE_linux_restart_syscall AUE_NULL #define LINUX_SYS_AUE_linux_semtimedop AUE_NULL #define LINUX_SYS_AUE_linux_fadvise64 AUE_NULL #define LINUX_SYS_AUE_linux_timer_create AUE_NULL Modified: stable/12/sys/amd64/linux/linux_syscall.h ============================================================================== --- stable/12/sys/amd64/linux/linux_syscall.h Sun Aug 23 20:12:07 2020 (r364525) +++ stable/12/sys/amd64/linux/linux_syscall.h Sun Aug 23 20:14:57 2020 (r364526) @@ -158,6 +158,7 @@ #define LINUX_SYS_mlockall 151 #define LINUX_SYS_munlockall 152 #define LINUX_SYS_linux_vhangup 153 +#define LINUX_SYS_linux_modify_ldt 154 #define LINUX_SYS_linux_pivot_root 155 #define LINUX_SYS_linux_sysctl 156 #define LINUX_SYS_linux_prctl 157 @@ -176,10 +177,12 @@ #define LINUX_SYS_linux_sethostname 170 #define LINUX_SYS_linux_setdomainname 171 #define LINUX_SYS_linux_iopl 172 +#define LINUX_SYS_linux_ioperm 173 #define LINUX_SYS_linux_init_module 175 #define LINUX_SYS_linux_delete_module 176 #define LINUX_SYS_linux_quotactl 179 #define LINUX_SYS_linux_gettid 186 +#define LINUX_SYS_linux_readahead 187 #define LINUX_SYS_linux_setxattr 188 #define LINUX_SYS_linux_lsetxattr 189 #define LINUX_SYS_linux_fsetxattr 190 @@ -197,11 +200,17 @@ #define LINUX_SYS_linux_sys_futex 202 #define LINUX_SYS_linux_sched_setaffinity 203 #define LINUX_SYS_linux_sched_getaffinity 204 +#define LINUX_SYS_linux_io_setup 206 +#define LINUX_SYS_linux_io_destroy 207 +#define LINUX_SYS_linux_io_getevents 208 +#define LINUX_SYS_linux_io_submit 209 +#define LINUX_SYS_linux_io_cancel 210 #define LINUX_SYS_linux_lookup_dcookie 212 #define LINUX_SYS_linux_epoll_create 213 #define LINUX_SYS_linux_remap_file_pages 216 #define LINUX_SYS_linux_getdents64 217 #define LINUX_SYS_linux_set_tid_address 218 +#define LINUX_SYS_linux_restart_syscall 219 #define LINUX_SYS_linux_semtimedop 220 #define LINUX_SYS_linux_fadvise64 221 #define LINUX_SYS_linux_timer_create 222 Modified: stable/12/sys/amd64/linux/linux_syscalls.c ============================================================================== --- stable/12/sys/amd64/linux/linux_syscalls.c Sun Aug 23 20:12:07 2020 (r364525) +++ stable/12/sys/amd64/linux/linux_syscalls.c Sun Aug 23 20:14:57 2020 (r364526) @@ -161,7 +161,7 @@ const char *linux_syscallnames[] = { "mlockall", /* 151 = mlockall */ "munlockall", /* 152 = munlockall */ "linux_vhangup", /* 153 = linux_vhangup */ - "#154", /* 154 = modify_ldt */ + "linux_modify_ldt", /* 154 = linux_modify_ldt */ "linux_pivot_root", /* 155 = linux_pivot_root */ "linux_sysctl", /* 156 = linux_sysctl */ "linux_prctl", /* 157 = linux_prctl */ @@ -180,7 +180,7 @@ const char *linux_syscallnames[] = { "linux_sethostname", /* 170 = linux_sethostname */ "linux_setdomainname", /* 171 = linux_setdomainname */ "linux_iopl", /* 172 = linux_iopl */ - "#173", /* 173 = ioperm */ + "linux_ioperm", /* 173 = linux_ioperm */ "#174", /* 174 = create_module */ "linux_init_module", /* 175 = linux_init_module */ "linux_delete_module", /* 176 = linux_delete_module */ @@ -194,7 +194,7 @@ const char *linux_syscallnames[] = { "#184", /* 184 = tuxcall */ "#185", /* 185 = security */ "linux_gettid", /* 186 = linux_gettid */ - "#187", /* 187 = linux_readahead */ + "linux_readahead", /* 187 = linux_readahead */ "linux_setxattr", /* 188 = linux_setxattr */ "linux_lsetxattr", /* 189 = linux_lsetxattr */ "linux_fsetxattr", /* 190 = linux_fsetxattr */ @@ -213,11 +213,11 @@ const char *linux_syscallnames[] = { "linux_sched_setaffinity", /* 203 = linux_sched_setaffinity */ "linux_sched_getaffinity", /* 204 = linux_sched_getaffinity */ "#205", /* 205 = set_thread_area */ - "#206", /* 206 = linux_io_setup */ - "#207", /* 207 = linux_io_destroy */ - "#208", /* 208 = linux_io_getevents */ - "#209", /* 209 = linux_io_submit */ - "#210", /* 210 = linux_io_cancel */ + "linux_io_setup", /* 206 = linux_io_setup */ + "linux_io_destroy", /* 207 = linux_io_destroy */ + "linux_io_getevents", /* 208 = linux_io_getevents */ + "linux_io_submit", /* 209 = linux_io_submit */ + "linux_io_cancel", /* 210 = linux_io_cancel */ "#211", /* 211 = get_thread_area */ "linux_lookup_dcookie", /* 212 = linux_lookup_dcookie */ "linux_epoll_create", /* 213 = linux_epoll_create */ @@ -226,7 +226,7 @@ const char *linux_syscallnames[] = { "linux_remap_file_pages", /* 216 = linux_remap_file_pages */ "linux_getdents64", /* 217 = linux_getdents64 */ "linux_set_tid_address", /* 218 = linux_set_tid_address */ - "#219", /* 219 = restart_syscall */ + "linux_restart_syscall", /* 219 = linux_restart_syscall */ "linux_semtimedop", /* 220 = linux_semtimedop */ "linux_fadvise64", /* 221 = linux_fadvise64 */ "linux_timer_create", /* 222 = linux_timer_create */ Modified: stable/12/sys/amd64/linux/linux_sysent.c ============================================================================== --- stable/12/sys/amd64/linux/linux_sysent.c Sun Aug 23 20:12:07 2020 (r364525) +++ stable/12/sys/amd64/linux/linux_sysent.c Sun Aug 23 20:14:57 2020 (r364526) @@ -171,7 +171,7 @@ struct sysent linux_sysent[] = { { AS(mlockall_args), (sy_call_t *)sys_mlockall, AUE_MLOCKALL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 151 = mlockall */ { 0, (sy_call_t *)sys_munlockall, AUE_MUNLOCKALL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 152 = munlockall */ { 0, (sy_call_t *)linux_vhangup, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 153 = linux_vhangup */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 154 = modify_ldt */ + { 0, (sy_call_t *)linux_modify_ldt, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 154 = linux_modify_ldt */ { 0, (sy_call_t *)linux_pivot_root, AUE_PIVOT_ROOT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 155 = linux_pivot_root */ { AS(linux_sysctl_args), (sy_call_t *)linux_sysctl, AUE_SYSCTL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 156 = linux_sysctl */ { AS(linux_prctl_args), (sy_call_t *)linux_prctl, AUE_PRCTL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 157 = linux_prctl */ @@ -190,7 +190,7 @@ struct sysent linux_sysent[] = { { AS(linux_sethostname_args), (sy_call_t *)linux_sethostname, AUE_SYSCTL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 170 = linux_sethostname */ { AS(linux_setdomainname_args), (sy_call_t *)linux_setdomainname, AUE_SYSCTL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 171 = linux_setdomainname */ { AS(linux_iopl_args), (sy_call_t *)linux_iopl, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 172 = linux_iopl */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 173 = ioperm */ + { 0, (sy_call_t *)linux_ioperm, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 173 = linux_ioperm */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 174 = create_module */ { 0, (sy_call_t *)linux_init_module, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 175 = linux_init_module */ { 0, (sy_call_t *)linux_delete_module, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 176 = linux_delete_module */ @@ -204,7 +204,7 @@ struct sysent linux_sysent[] = { { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 184 = tuxcall */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 185 = security */ { 0, (sy_call_t *)linux_gettid, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 186 = linux_gettid */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 187 = linux_readahead */ + { 0, (sy_call_t *)linux_readahead, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 187 = linux_readahead */ { 0, (sy_call_t *)linux_setxattr, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 188 = linux_setxattr */ { 0, (sy_call_t *)linux_lsetxattr, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 189 = linux_lsetxattr */ { 0, (sy_call_t *)linux_fsetxattr, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 190 = linux_fsetxattr */ @@ -223,11 +223,11 @@ struct sysent linux_sysent[] = { { AS(linux_sched_setaffinity_args), (sy_call_t *)linux_sched_setaffinity, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 203 = linux_sched_setaffinity */ { AS(linux_sched_getaffinity_args), (sy_call_t *)linux_sched_getaffinity, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 204 = linux_sched_getaffinity */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 205 = set_thread_area */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 206 = linux_io_setup */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 207 = linux_io_destroy */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 208 = linux_io_getevents */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 209 = linux_io_submit */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 210 = linux_io_cancel */ + { 0, (sy_call_t *)linux_io_setup, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 206 = linux_io_setup */ + { 0, (sy_call_t *)linux_io_destroy, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 207 = linux_io_destroy */ + { 0, (sy_call_t *)linux_io_getevents, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 208 = linux_io_getevents */ + { 0, (sy_call_t *)linux_io_submit, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 209 = linux_io_submit */ + { 0, (sy_call_t *)linux_io_cancel, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 210 = linux_io_cancel */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 211 = get_thread_area */ { 0, (sy_call_t *)linux_lookup_dcookie, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 212 = linux_lookup_dcookie */ { AS(linux_epoll_create_args), (sy_call_t *)linux_epoll_create, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 213 = linux_epoll_create */ @@ -236,7 +236,7 @@ struct sysent linux_sysent[] = { { 0, (sy_call_t *)linux_remap_file_pages, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 216 = linux_remap_file_pages */ { AS(linux_getdents64_args), (sy_call_t *)linux_getdents64, AUE_GETDIRENTRIES, NULL, 0, 0, 0, SY_THR_STATIC }, /* 217 = linux_getdents64 */ { AS(linux_set_tid_address_args), (sy_call_t *)linux_set_tid_address, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 218 = linux_set_tid_address */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 219 = restart_syscall */ + { 0, (sy_call_t *)linux_restart_syscall, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 219 = linux_restart_syscall */ { 0, (sy_call_t *)linux_semtimedop, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 220 = linux_semtimedop */ { AS(linux_fadvise64_args), (sy_call_t *)linux_fadvise64, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 221 = linux_fadvise64 */ { AS(linux_timer_create_args), (sy_call_t *)linux_timer_create, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 222 = linux_timer_create */ Modified: stable/12/sys/amd64/linux/linux_systrace_args.c ============================================================================== --- stable/12/sys/amd64/linux/linux_systrace_args.c Sun Aug 23 20:12:07 2020 (r364525) +++ stable/12/sys/amd64/linux/linux_systrace_args.c Sun Aug 23 20:14:57 2020 (r364526) @@ -1261,6 +1261,11 @@ systrace_args(int sysnum, void *params, uint64_t *uarg *n_args = 0; break; } + /* linux_modify_ldt */ + case 154: { + *n_args = 0; + break; + } /* linux_pivot_root */ case 155: { *n_args = 0; @@ -1396,6 +1401,11 @@ systrace_args(int sysnum, void *params, uint64_t *uarg *n_args = 1; break; } + /* linux_ioperm */ + case 173: { + *n_args = 0; + break; + } /* linux_init_module */ case 175: { *n_args = 0; @@ -1416,6 +1426,11 @@ systrace_args(int sysnum, void *params, uint64_t *uarg *n_args = 0; break; } + /* linux_readahead */ + case 187: { + *n_args = 0; + break; + } /* linux_setxattr */ case 188: { *n_args = 0; @@ -1521,6 +1536,31 @@ systrace_args(int sysnum, void *params, uint64_t *uarg *n_args = 3; break; } + /* linux_io_setup */ + case 206: { + *n_args = 0; + break; + } + /* linux_io_destroy */ + case 207: { + *n_args = 0; + break; + } + /* linux_io_getevents */ + case 208: { + *n_args = 0; + break; + } + /* linux_io_submit */ + case 209: { + *n_args = 0; + break; + } + /* linux_io_cancel */ + case 210: { + *n_args = 0; + break; + } /* linux_lookup_dcookie */ case 212: { *n_args = 0; @@ -1554,6 +1594,11 @@ systrace_args(int sysnum, void *params, uint64_t *uarg *n_args = 1; break; } + /* linux_restart_syscall */ + case 219: { + *n_args = 0; + break; + } /* linux_semtimedop */ case 220: { *n_args = 0; @@ -4559,6 +4604,9 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d /* linux_vhangup */ case 153: break; + /* linux_modify_ldt */ + case 154: + break; /* linux_pivot_root */ case 155: break; @@ -4762,6 +4810,9 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; }; break; + /* linux_ioperm */ + case 173: + break; /* linux_init_module */ case 175: break; @@ -4774,6 +4825,9 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d /* linux_gettid */ case 186: break; + /* linux_readahead */ + case 187: + break; /* linux_setxattr */ case 188: break; @@ -4890,6 +4944,21 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; }; break; + /* linux_io_setup */ + case 206: + break; + /* linux_io_destroy */ + case 207: + break; + /* linux_io_getevents */ + case 208: + break; + /* linux_io_submit */ + case 209: + break; + /* linux_io_cancel */ + case 210: + break; /* linux_lookup_dcookie */ case 212: break; @@ -4932,6 +5001,9 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; }; break; + /* linux_restart_syscall */ + case 219: + break; /* linux_semtimedop */ case 220: break; @@ -7163,6 +7235,8 @@ systrace_return_setargdesc(int sysnum, int ndx, char * case 152: /* linux_vhangup */ case 153: + /* linux_modify_ldt */ + case 154: /* linux_pivot_root */ case 155: /* linux_sysctl */ @@ -7241,6 +7315,8 @@ systrace_return_setargdesc(int sysnum, int ndx, char * if (ndx == 0 || ndx == 1) p = "int"; break; + /* linux_ioperm */ + case 173: /* linux_init_module */ case 175: /* linux_delete_module */ @@ -7249,6 +7325,8 @@ systrace_return_setargdesc(int sysnum, int ndx, char * case 179: /* linux_gettid */ case 186: + /* linux_readahead */ + case 187: /* linux_setxattr */ case 188: /* linux_lsetxattr */ @@ -7298,6 +7376,16 @@ systrace_return_setargdesc(int sysnum, int ndx, char * if (ndx == 0 || ndx == 1) p = "int"; break; + /* linux_io_setup */ + case 206: + /* linux_io_destroy */ + case 207: + /* linux_io_getevents */ + case 208: + /* linux_io_submit */ + case 209: + /* linux_io_cancel */ + case 210: /* linux_lookup_dcookie */ case 212: /* linux_epoll_create */ @@ -7317,6 +7405,8 @@ systrace_return_setargdesc(int sysnum, int ndx, char * if (ndx == 0 || ndx == 1) p = "int"; break; + /* linux_restart_syscall */ + case 219: /* linux_semtimedop */ case 220: /* linux_fadvise64 */ Modified: stable/12/sys/amd64/linux/syscalls.master ============================================================================== --- stable/12/sys/amd64/linux/syscalls.master Sun Aug 23 20:12:07 2020 (r364525) +++ stable/12/sys/amd64/linux/syscalls.master Sun Aug 23 20:14:57 2020 (r364526) @@ -304,7 +304,7 @@ 151 AUE_MLOCKALL NOPROTO { int mlockall(int how); } 152 AUE_MUNLOCKALL NOPROTO { int munlockall(void); } 153 AUE_NULL STD { int linux_vhangup(void); } -154 AUE_NULL UNIMPL modify_ldt +154 AUE_NULL STD { int linux_modify_ldt(void); } 155 AUE_PIVOT_ROOT STD { int linux_pivot_root(void); } 156 AUE_SYSCTL STD { int linux_sysctl( \ struct l___sysctl_args *args); } @@ -332,7 +332,7 @@ 171 AUE_SYSCTL STD { int linux_setdomainname(char *name, \ l_int len); } 172 AUE_NULL STD { int linux_iopl(l_uint level); } -173 AUE_NULL UNIMPL ioperm +173 AUE_NULL STD { int linux_ioperm(void); } 174 AUE_NULL UNIMPL create_module 175 AUE_NULL STD { int linux_init_module(void); } 176 AUE_NULL STD { int linux_delete_module(void); } @@ -346,7 +346,7 @@ 184 AUE_NULL UNIMPL tuxcall 185 AUE_NULL UNIMPL security 186 AUE_NULL STD { int linux_gettid(void); } -187 AUE_NULL UNIMPL linux_readahead +187 AUE_NULL STD { int linux_readahead(void); } 188 AUE_NULL STD { int linux_setxattr(void); } 189 AUE_NULL STD { int linux_lsetxattr(void); } 190 AUE_NULL STD { int linux_fsetxattr(void); } @@ -368,11 +368,11 @@ 204 AUE_NULL STD { int linux_sched_getaffinity(l_pid_t pid, l_uint len, \ l_ulong *user_mask_ptr); } 205 AUE_NULL UNIMPL set_thread_area -206 AUE_NULL UNIMPL linux_io_setup -207 AUE_NULL UNIMPL linux_io_destroy -208 AUE_NULL UNIMPL linux_io_getevents -209 AUE_NULL UNIMPL linux_io_submit -210 AUE_NULL UNIMPL linux_io_cancel +206 AUE_NULL STD { int linux_io_setup(void); } +207 AUE_NULL STD { int linux_io_destroy(void); } +208 AUE_NULL STD { int linux_io_getevents(void); } +209 AUE_NULL STD { int linux_io_submit(void); } +210 AUE_NULL STD { int linux_io_cancel(void); } 211 AUE_NULL UNIMPL get_thread_area 212 AUE_NULL STD { int linux_lookup_dcookie(void); } 213 AUE_NULL STD { int linux_epoll_create(l_int size); } @@ -382,7 +382,7 @@ 217 AUE_GETDIRENTRIES STD { int linux_getdents64(l_uint fd, \ void *dirent, l_uint count); } 218 AUE_NULL STD { int linux_set_tid_address(l_int *tidptr); } -219 AUE_NULL UNIMPL restart_syscall +219 AUE_NULL STD { int linux_restart_syscall(void); } 220 AUE_NULL STD { int linux_semtimedop(void); } 221 AUE_NULL STD { int linux_fadvise64(l_int fd, l_loff_t offset, \ l_size_t len, l_int advice); } From owner-svn-src-stable-12@freebsd.org Sun Aug 23 20:20:14 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E8FC13C9519; Sun, 23 Aug 2020 20:20:14 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZRSt5qwrz4RRn; Sun, 23 Aug 2020 20:20:14 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 AC9DACE2C; Sun, 23 Aug 2020 20:20:14 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07NKKEYK016286; Sun, 23 Aug 2020 20:20:14 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NKKEVE016284; Sun, 23 Aug 2020 20:20:14 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008232020.07NKKEVE016284@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Aug 2020 20:20:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364528 - in stable/12/share/man: man4 man5 X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in stable/12/share/man: man4 man5 X-SVN-Commit-Revision: 364528 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 20:20:15 -0000 Author: trasz Date: Sun Aug 23 20:20:13 2020 New Revision: 364528 URL: https://svnweb.freebsd.org/changeset/base/364528 Log: MFC r354691: Improve Linuxulator man pages to better reflect the current state, and add some missing Xrs. Sponsored by: The FreeBSD Foundation Modified: stable/12/share/man/man4/linux.4 stable/12/share/man/man5/linprocfs.5 stable/12/share/man/man5/linsysfs.5 Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/linux.4 ============================================================================== --- stable/12/share/man/man4/linux.4 Sun Aug 23 20:19:04 2020 (r364527) +++ stable/12/share/man/man4/linux.4 Sun Aug 23 20:20:13 2020 (r364528) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 1, 2017 +.Dd November 13, 2019 .Dt LINUX 4 .Os .Sh NAME @@ -52,10 +52,10 @@ linux_load="YES" .Sh DESCRIPTION The .Nm -module provides limited -Linux ABI (application binary interface) compatibility -for userland applications. -The module provides the following significant facilities: +module provides limited Linux ABI (application binary interface) compatibility, +making it possible to run many unmodified Linux applications and libraries +without the need for virtualization or emulation. +Some of the facilities provided are: .Bl -bullet .It An image activator @@ -66,76 +66,61 @@ executable images Special signal handling for activated images .It Linux to native system call translation +.It +Linux-specific system calls .El .Pp -It is important to note that the Linux ABI support -it not provided through an emulator. -Rather, a true (albeit limited) ABI implementation is provided. +Note that dynamically linked Linux executables +will require a suitable environment in +.Pa /compat/linux . +This includes native Linux shared libraries, and Linux-specific virtual +filesystems. +To set it up, install the +.Pa emulators/linux_base-c7 +port or the linux_base-c7 +package, and add the following line to the +.Xr rc.conf 5 +file: .Pp -The following +.Dl linux_enable="YES" +.Pp +To avoid mounting Linux-specific filesystems at startup, also add the following +line: +.Pp +.Dl linux_mounts_enable="NO" +.Sh SYSCTL VARIABLES +The following variables are available as both .Xr sysctl 8 -tunable variables are available: -.Bl -tag -width compat.linux.oss_version -.It compat.linux.osname +variables and +.Xr loader 8 +tunables: +.Bl -tag -width indent +.It Va compat.linux.osname Linux kernel operating system name. -.It compat.linux.osrelease +.It Va compat.linux.osrelease Linux kernel operating system release. Changing this to something else is discouraged on non-development systems, because it may change the way Linux programs work. Recent versions of GNU libc are known to use different syscalls depending on the value of this sysctl. -.It compat.linux.oss_version +.It Va compat.linux.oss_version Linux Open Sound System version. -.El -.Pp -The -.Nm -module can be linked into the kernel statically with the -.Dv COMPAT_LINUX -kernel configuration option -or loaded as required. -The following command will load the module -if it is neither linked into the kernel -nor already loaded as a module: -.Bd -literal -offset indent -if ! kldstat -v | grep -E 'linux(aout|elf)' > /dev/null; then - kldload linux > /dev/null 2>&1 -fi -.Ed -.Pp -Note that dynamically linked Linux executables -will require a suitable environment in -.Pa /compat/linux . -Specifically, the Linux run-time linker's hints files -should be correctly initialized. -For this reason, it is common to execute the following commands -to prepare the system to correctly run Linux executables: -.Bd -literal -offset indent -if [ -x /compat/linux/sbin/ldconfig ]; then - /compat/linux/sbin/ldconfig -r /compat/linux -fi -.Ed -.Pp -For information on loading the -.Nm -kernel loadable module automatically on system startup, -see -.Xr rc.conf 5 . -This information applies -regardless of whether the -.Nm -module is statically linked into the kernel -or loaded as a module. .Sh FILES -.Bl -tag -width /compat/linux/dev/fd -compact +.Bl -tag -width /compat/linux/dev/shm -compact .It Pa /compat/linux minimal Linux run-time environment .It Pa /compat/linux/dev/fd -limited Linux file-descriptor file system +file-descriptor file system, see +.Xr fdescfs 5 +.It Pa /compat/linux/dev/shm +in-memory file system, see +.Xr tmpfs 5 .It Pa /compat/linux/proc -limited Linux process file system +Linux process file system, see +.Xr linprocfs 5 .It Pa /compat/linux/sys -limited Linux system file system +Linux kernel objects file system, see +.Xr linsysfs 5 .El .Sh SEE ALSO .Xr brandelf 1 , @@ -143,7 +128,11 @@ limited Linux system file system .Xr elf 5 , .Xr fdescfs 5 , .Xr linprocfs 5 , -.Xr linsysfs 5 +.Xr linsysfs 5 , +.Xr tmpfs 5 .Sh HISTORY Linux ABI support first appeared in .Fx 2.1 . +.Sh BUGS +Support for some of the Linux-specific system calls and system call arguments +is missing. Modified: stable/12/share/man/man5/linprocfs.5 ============================================================================== --- stable/12/share/man/man5/linprocfs.5 Sun Aug 23 20:19:04 2020 (r364527) +++ stable/12/share/man/man5/linprocfs.5 Sun Aug 23 20:20:13 2020 (r364528) @@ -2,7 +2,7 @@ .\" Written by Garrett Wollman .\" This file is in the public domain. .\" -.Dd August 10, 1994 +.Dd November 13, 2019 .Dt LINPROCFS 5 .Os .Sh NAME @@ -75,6 +75,7 @@ file system on .Sh SEE ALSO .Xr mount 2 , .Xr unmount 2 , +.Xr linux 4 , .Xr procfs 5 , .Xr pseudofs 9 .Sh HISTORY Modified: stable/12/share/man/man5/linsysfs.5 ============================================================================== --- stable/12/share/man/man5/linsysfs.5 Sun Aug 23 20:19:04 2020 (r364527) +++ stable/12/share/man/man5/linsysfs.5 Sun Aug 23 20:20:13 2020 (r364528) @@ -3,12 +3,12 @@ .\" .\" $FreeBSD$ .\" -.Dd February 5, 2007 +.Dd November 13, 2019 .Dt LINSYSFS 5 .Os .Sh NAME .Nm linsysfs -.Nd Linux system file system +.Nd Linux kernel objects file system .Sh SYNOPSIS .Bd -literal linsys /compat/linux/sys linsysfs rw 0 0 @@ -76,6 +76,7 @@ is a mount point. .Sh SEE ALSO .Xr nmount 2 , .Xr unmount 2 , +.Xr linux 4 , .Xr linprocfs 5 , .Xr pseudofs 9 .Sh HISTORY From owner-svn-src-stable-12@freebsd.org Sun Aug 23 20:25:11 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DC3913C980D; Sun, 23 Aug 2020 20:25:11 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZRZb5Rf3z4RbZ; Sun, 23 Aug 2020 20:25:11 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 9DA61D119; Sun, 23 Aug 2020 20:25:11 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07NKPBb1021996; Sun, 23 Aug 2020 20:25:11 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NKPAso021989; Sun, 23 Aug 2020 20:25:10 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008232025.07NKPAso021989@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Aug 2020 20:25:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364529 - in stable/12: share/man/man4 sys/amd64/linux sys/amd64/linux32 sys/arm64/linux sys/compat/linux sys/i386/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/amd64/linux sys/amd64/linux32 sys/arm64/linux sys/compat/linux sys/i386/linux X-SVN-Commit-Revision: 364529 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 20:25:11 -0000 Author: trasz Date: Sun Aug 23 20:25:10 2020 New Revision: 364529 URL: https://svnweb.freebsd.org/changeset/base/364529 Log: MFC r355818: Add compat.linux.emul_path, so it can be set to something other than "/compat/linux". Useful when you have several compat directories with different Linux versions and you don't want to clash with files installed by linux-c7 packages. Sponsored by: The FreeBSD Foundation Modified: stable/12/share/man/man4/linux.4 stable/12/sys/amd64/linux/linux_sysvec.c stable/12/sys/amd64/linux32/linux32_sysvec.c stable/12/sys/arm64/linux/linux_sysvec.c stable/12/sys/compat/linux/linux_util.c stable/12/sys/compat/linux/linux_util.h stable/12/sys/i386/linux/linux_sysvec.c Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/linux.4 ============================================================================== --- stable/12/share/man/man4/linux.4 Sun Aug 23 20:20:13 2020 (r364528) +++ stable/12/share/man/man4/linux.4 Sun Aug 23 20:25:10 2020 (r364529) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 13, 2019 +.Dd December 16, 2019 .Dt LINUX 4 .Os .Sh NAME @@ -95,6 +95,10 @@ variables and .Xr loader 8 tunables: .Bl -tag -width indent +.It Va compat.linux.emul_path +Path to the Linux run-time environment. +Defaults to +.Pa /compat/linux . .It Va compat.linux.osname Linux kernel operating system name. .It Va compat.linux.osrelease Modified: stable/12/sys/amd64/linux/linux_sysvec.c ============================================================================== --- stable/12/sys/amd64/linux/linux_sysvec.c Sun Aug 23 20:20:13 2020 (r364528) +++ stable/12/sys/amd64/linux/linux_sysvec.c Sun Aug 23 20:25:10 2020 (r364529) @@ -826,7 +826,7 @@ static Elf64_Brandinfo linux_glibc2brand = { .brand = ELFOSABI_LINUX, .machine = EM_X86_64, .compat_3_brand = "Linux", - .emul_path = "/compat/linux", + .emul_path = linux_emul_path, .interp_path = "/lib64/ld-linux-x86-64.so.2", .sysvec = &elf_linux_sysvec, .interp_newpath = NULL, @@ -838,7 +838,7 @@ static Elf64_Brandinfo linux_glibc2brandshort = { .brand = ELFOSABI_LINUX, .machine = EM_X86_64, .compat_3_brand = "Linux", - .emul_path = "/compat/linux", + .emul_path = linux_emul_path, .interp_path = "/lib64/ld-linux.so.2", .sysvec = &elf_linux_sysvec, .interp_newpath = NULL, @@ -850,7 +850,7 @@ static Elf64_Brandinfo linux_muslbrand = { .brand = ELFOSABI_LINUX, .machine = EM_X86_64, .compat_3_brand = "Linux", - .emul_path = "/compat/linux", + .emul_path = linux_emul_path, .interp_path = "/lib/ld-musl-x86_64.so.1", .sysvec = &elf_linux_sysvec, .interp_newpath = NULL, Modified: stable/12/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- stable/12/sys/amd64/linux32/linux32_sysvec.c Sun Aug 23 20:20:13 2020 (r364528) +++ stable/12/sys/amd64/linux32/linux32_sysvec.c Sun Aug 23 20:25:10 2020 (r364529) @@ -1016,7 +1016,7 @@ static Elf32_Brandinfo linux_brand = { .brand = ELFOSABI_LINUX, .machine = EM_386, .compat_3_brand = "Linux", - .emul_path = "/compat/linux", + .emul_path = linux_emul_path, .interp_path = "/lib/ld-linux.so.1", .sysvec = &elf_linux_sysvec, .interp_newpath = NULL, @@ -1028,7 +1028,7 @@ static Elf32_Brandinfo linux_glibc2brand = { .brand = ELFOSABI_LINUX, .machine = EM_386, .compat_3_brand = "Linux", - .emul_path = "/compat/linux", + .emul_path = linux_emul_path, .interp_path = "/lib/ld-linux.so.2", .sysvec = &elf_linux_sysvec, .interp_newpath = NULL, @@ -1040,7 +1040,7 @@ static Elf32_Brandinfo linux_muslbrand = { .brand = ELFOSABI_LINUX, .machine = EM_386, .compat_3_brand = "Linux", - .emul_path = "/compat/linux", + .emul_path = linux_emul_path, .interp_path = "/lib/ld-musl-i386.so.1", .sysvec = &elf_linux_sysvec, .interp_newpath = NULL, Modified: stable/12/sys/arm64/linux/linux_sysvec.c ============================================================================== --- stable/12/sys/arm64/linux/linux_sysvec.c Sun Aug 23 20:20:13 2020 (r364528) +++ stable/12/sys/arm64/linux/linux_sysvec.c Sun Aug 23 20:25:10 2020 (r364529) @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include MODULE_VERSION(linux64elf, 1); @@ -472,7 +473,7 @@ static Elf64_Brandinfo linux_glibc2brand = { .brand = ELFOSABI_LINUX, .machine = EM_AARCH64, .compat_3_brand = "Linux", - .emul_path = "/compat/linux", + .emul_path = linux_emul_path, .interp_path = "/lib64/ld-linux-x86-64.so.2", .sysvec = &elf_linux_sysvec, .interp_newpath = NULL, Modified: stable/12/sys/compat/linux/linux_util.c ============================================================================== --- stable/12/sys/compat/linux/linux_util.c Sun Aug 23 20:20:13 2020 (r364528) +++ stable/12/sys/compat/linux/linux_util.c Sun Aug 23 20:25:10 2020 (r364529) @@ -46,11 +46,13 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include +#include #include MALLOC_DEFINE(M_LINUX, "linux", "Linux mode structures"); @@ -58,7 +60,11 @@ MALLOC_DEFINE(M_EPOLL, "lepoll", "Linux events structu MALLOC_DEFINE(M_FUTEX, "futex", "Linux futexes"); MALLOC_DEFINE(M_FUTEX_WP, "futex wp", "Linux futex waiting proc"); -const char linux_emul_path[] = "/compat/linux"; +char linux_emul_path[MAXPATHLEN] = "/compat/linux"; + +SYSCTL_STRING(_compat_linux, OID_AUTO, emul_path, CTLFLAG_RWTUN, + linux_emul_path, sizeof(linux_emul_path), + "Linux runtime environment path"); /* * Search an alternate path before passing pathname arguments on to Modified: stable/12/sys/compat/linux/linux_util.h ============================================================================== --- stable/12/sys/compat/linux/linux_util.h Sun Aug 23 20:20:13 2020 (r364528) +++ stable/12/sys/compat/linux/linux_util.h Sun Aug 23 20:25:10 2020 (r364529) @@ -50,7 +50,7 @@ MALLOC_DECLARE(M_EPOLL); MALLOC_DECLARE(M_FUTEX); MALLOC_DECLARE(M_FUTEX_WP); -extern const char linux_emul_path[]; +extern char linux_emul_path[]; int linux_emul_convpath(struct thread *, const char *, enum uio_seg, char **, int, int); Modified: stable/12/sys/i386/linux/linux_sysvec.c ============================================================================== --- stable/12/sys/i386/linux/linux_sysvec.c Sun Aug 23 20:20:13 2020 (r364528) +++ stable/12/sys/i386/linux/linux_sysvec.c Sun Aug 23 20:25:10 2020 (r364529) @@ -990,7 +990,7 @@ static Elf32_Brandinfo linux_brand = { .brand = ELFOSABI_LINUX, .machine = EM_386, .compat_3_brand = "Linux", - .emul_path = "/compat/linux", + .emul_path = linux_emul_path, .interp_path = "/lib/ld-linux.so.1", .sysvec = &elf_linux_sysvec, .interp_newpath = NULL, @@ -1002,7 +1002,7 @@ static Elf32_Brandinfo linux_glibc2brand = { .brand = ELFOSABI_LINUX, .machine = EM_386, .compat_3_brand = "Linux", - .emul_path = "/compat/linux", + .emul_path = linux_emul_path, .interp_path = "/lib/ld-linux.so.2", .sysvec = &elf_linux_sysvec, .interp_newpath = NULL, @@ -1014,7 +1014,7 @@ static Elf32_Brandinfo linux_muslbrand = { .brand = ELFOSABI_LINUX, .machine = EM_386, .compat_3_brand = "Linux", - .emul_path = "/compat/linux", + .emul_path = linux_emul_path, .interp_path = "/lib/ld-musl-i386.so.1", .sysvec = &elf_linux_sysvec, .interp_newpath = NULL, From owner-svn-src-stable-12@freebsd.org Sun Aug 23 21:01:57 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2CF303CA956; Sun, 23 Aug 2020 21:01: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZSP10TSPz4Vs7; Sun, 23 Aug 2020 21:01: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 E7BA4D7B6; Sun, 23 Aug 2020 21:01: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 07NL1uML044680; Sun, 23 Aug 2020 21:01:56 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NL1uGb044678; Sun, 23 Aug 2020 21:01:56 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232101.07NL1uGb044678@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 21:01:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364536 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364536 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 21:01:57 -0000 Author: tuexen Date: Sun Aug 23 21:01:56 2020 New Revision: 364536 URL: https://svnweb.freebsd.org/changeset/base/364536 Log: MFC r357197: Fix build issues for the userland stack on 32-bit platforms. Modified: stable/12/sys/netinet/sctp_asconf.c stable/12/sys/netinet/sctp_output.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_asconf.c ============================================================================== --- stable/12/sys/netinet/sctp_asconf.c Sun Aug 23 20:44:15 2020 (r364535) +++ stable/12/sys/netinet/sctp_asconf.c Sun Aug 23 21:01:56 2020 (r364536) @@ -105,7 +105,7 @@ sctp_asconf_error_response(uint32_t id, uint16_t cause struct mbuf *m_reply = NULL; struct sctp_asconf_paramhdr *aph; struct sctp_error_cause *error; - size_t buf_len; + uint32_t buf_len; uint16_t i, param_length, cause_length, padding_length; uint8_t *tlv; Modified: stable/12/sys/netinet/sctp_output.c ============================================================================== --- stable/12/sys/netinet/sctp_output.c Sun Aug 23 20:44:15 2020 (r364535) +++ stable/12/sys/netinet/sctp_output.c Sun Aug 23 21:01:56 2020 (r364536) @@ -6885,7 +6885,7 @@ sctp_sendall(struct sctp_inpcb *inp, struct uio *uio, /* There is another. */ return (EBUSY); } - if (uio->uio_resid > SCTP_BASE_SYSCTL(sctp_sendall_limit)) { + if (uio->uio_resid > (ssize_t)SCTP_BASE_SYSCTL(sctp_sendall_limit)) { /* You must not be larger than the limit! */ return (EMSGSIZE); } From owner-svn-src-stable-12@freebsd.org Sun Aug 23 21:04:23 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DF7553CAD7A; Sun, 23 Aug 2020 21:04:23 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZSRq5Zsxz4W6C; Sun, 23 Aug 2020 21:04:23 +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 9FA3AD92A; Sun, 23 Aug 2020 21:04:23 +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 07NL4N63047419; Sun, 23 Aug 2020 21:04:23 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NL4Njx047417; Sun, 23 Aug 2020 21:04:23 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232104.07NL4Njx047417@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 21:04:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364537 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364537 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 21:04:23 -0000 Author: tuexen Date: Sun Aug 23 21:04:22 2020 New Revision: 364537 URL: https://svnweb.freebsd.org/changeset/base/364537 Log: MFC r357500: Improve numbering of debug information. Modified: stable/12/sys/netinet/sctp_constants.h stable/12/sys/netinet/sctp_indata.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_constants.h ============================================================================== --- stable/12/sys/netinet/sctp_constants.h Sun Aug 23 21:01:56 2020 (r364536) +++ stable/12/sys/netinet/sctp_constants.h Sun Aug 23 21:04:22 2020 (r364537) @@ -807,7 +807,7 @@ __FBSDID("$FreeBSD$"); #define SCTP_LOC_33 0x00000021 #define SCTP_LOC_34 0x00000022 #define SCTP_LOC_35 0x00000023 - +#define SCTP_LOC_36 0x00000024 /* Free assoc codes */ #define SCTP_NORMAL_PROC 0 Modified: stable/12/sys/netinet/sctp_indata.c ============================================================================== --- stable/12/sys/netinet/sctp_indata.c Sun Aug 23 21:01:56 2020 (r364536) +++ stable/12/sys/netinet/sctp_indata.c Sun Aug 23 21:04:22 2020 (r364537) @@ -1754,7 +1754,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struc * Need to send an abort since we had a empty data chunk. */ op_err = sctp_generate_no_user_data_cause(tsn); - stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_14; + stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_15; sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return (0); @@ -1892,7 +1892,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struc snprintf(msg, sizeof(msg), "Reassembly problem (MID=%8.8x)", mid); err_out: op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); - stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_15; + stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_16; sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return (0); @@ -2041,7 +2041,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struc (uint16_t)mid); } op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); - stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_16; + stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_17; sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return (0); @@ -2613,7 +2613,7 @@ sctp_sack_check(struct sctp_tcb *stcb, int was_a_gap) if (SCTP_OS_TIMER_PENDING(&stcb->asoc.dack_timer.timer)) { sctp_timer_stop(SCTP_TIMER_TYPE_RECV, stcb->sctp_ep, stcb, NULL, - SCTP_FROM_SCTP_INDATA + SCTP_LOC_17); + SCTP_FROM_SCTP_INDATA + SCTP_LOC_18); } sctp_send_shutdown(stcb, ((stcb->asoc.alternate) ? stcb->asoc.alternate : stcb->asoc.primary_destination)); @@ -2766,7 +2766,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *o snprintf(msg, sizeof(msg), "%s", "I-DATA chunk received when DATA was negotiated"); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); - stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_18; + 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); } @@ -2777,7 +2777,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *o snprintf(msg, sizeof(msg), "%s", "DATA chunk received when I-DATA was negotiated"); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); - stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_19; + stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_21; sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); return (2); } @@ -2802,7 +2802,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *o 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; + stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_22; sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); return (2); } @@ -2891,7 +2891,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *o 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; + stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_23; sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); return (2); } @@ -4041,7 +4041,7 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32 snprintf(msg, sizeof(msg), "Cum ack %8.8x greater or equal than TSN %8.8x", cumack, send_s); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); - stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_21; + 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; } @@ -4237,7 +4237,7 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32 net->dest_state &= ~SCTP_ADDR_PF; sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net, - SCTP_FROM_SCTP_INDATA + SCTP_LOC_22); + SCTP_FROM_SCTP_INDATA + SCTP_LOC_25); sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net); asoc->cc_functions.sctp_cwnd_update_exit_pf(stcb, net); /* Done with this net */ @@ -4315,7 +4315,7 @@ again: } else if (SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer)) { sctp_timer_stop(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, net, - SCTP_FROM_SCTP_INDATA + SCTP_LOC_23); + SCTP_FROM_SCTP_INDATA + SCTP_LOC_26); } } } @@ -4368,7 +4368,7 @@ again: *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; + stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_27; sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); return; } @@ -4578,7 +4578,7 @@ hopeless_peer: snprintf(msg, sizeof(msg), "Cum ack %8.8x greater or equal than TSN %8.8x", cum_ack, send_s); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); - stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_25; + stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_28; sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); return; } @@ -4610,7 +4610,7 @@ hopeless_peer: /* stop any timers */ TAILQ_FOREACH(net, &asoc->nets, sctp_next) { sctp_timer_stop(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, - stcb, net, SCTP_FROM_SCTP_INDATA + SCTP_LOC_26); + stcb, net, SCTP_FROM_SCTP_INDATA + SCTP_LOC_29); net->partial_bytes_acked = 0; net->flight_size = 0; } @@ -4810,14 +4810,14 @@ hopeless_peer: if (net->new_pseudo_cumack) sctp_timer_stop(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, net, - SCTP_FROM_SCTP_INDATA + SCTP_LOC_27); + SCTP_FROM_SCTP_INDATA + SCTP_LOC_30); } } else { if (accum_moved) { TAILQ_FOREACH(net, &asoc->nets, sctp_next) { sctp_timer_stop(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, - stcb, net, SCTP_FROM_SCTP_INDATA + SCTP_LOC_28); + stcb, net, SCTP_FROM_SCTP_INDATA + SCTP_LOC_31); } } } @@ -5000,7 +5000,7 @@ hopeless_peer: net->dest_state &= ~SCTP_ADDR_PF; sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net, - SCTP_FROM_SCTP_INDATA + SCTP_LOC_29); + SCTP_FROM_SCTP_INDATA + SCTP_LOC_32); sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net); asoc->cc_functions.sctp_cwnd_update_exit_pf(stcb, net); /* Done with this net */ @@ -5025,7 +5025,7 @@ hopeless_peer: /* stop all timers */ sctp_timer_stop(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, net, - SCTP_FROM_SCTP_INDATA + SCTP_LOC_30); + SCTP_FROM_SCTP_INDATA + SCTP_LOC_33); net->flight_size = 0; net->partial_bytes_acked = 0; } @@ -5063,7 +5063,7 @@ hopeless_peer: *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; + stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_34; sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); return; } @@ -5212,7 +5212,7 @@ again: } else if (SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer)) { sctp_timer_stop(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, net, - SCTP_FROM_SCTP_INDATA + SCTP_LOC_32); + SCTP_FROM_SCTP_INDATA + SCTP_LOC_35); } } } @@ -5618,7 +5618,7 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb, "New cum ack %8.8x too high, highest TSN %8.8x", new_cum_tsn, asoc->highest_tsn_inside_map); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); - stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_33; + stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_36; sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); return; } From owner-svn-src-stable-12@freebsd.org Sun Aug 23 21:05:55 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A707E3CB0BD; Sun, 23 Aug 2020 21:05: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZSTb40rqz4WWY; Sun, 23 Aug 2020 21:05: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 6E3F5DA89; Sun, 23 Aug 2020 21:05: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 07NL5tUQ047717; Sun, 23 Aug 2020 21:05:55 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NL5sWt047714; Sun, 23 Aug 2020 21:05:54 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232105.07NL5sWt047714@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 21:05:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364541 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364541 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 21:05:55 -0000 Author: tuexen Date: Sun Aug 23 21:05:54 2020 New Revision: 364541 URL: https://svnweb.freebsd.org/changeset/base/364541 Log: MFC r357501: Remove unused timer. Modified: stable/12/sys/netinet/sctp_pcb.c stable/12/sys/netinet/sctp_structs.h stable/12/sys/netinet/sctputil.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_pcb.c ============================================================================== --- stable/12/sys/netinet/sctp_pcb.c Sun Aug 23 21:05:39 2020 (r364540) +++ stable/12/sys/netinet/sctp_pcb.c Sun Aug 23 21:05:54 2020 (r364541) @@ -2743,7 +2743,6 @@ sctp_move_pcb_and_assoc(struct sctp_inpcb *old_inp, st stcb->asoc.strreset_timer.ep = (void *)new_inp; stcb->asoc.shut_guard_timer.ep = (void *)new_inp; stcb->asoc.autoclose_timer.ep = (void *)new_inp; - stcb->asoc.delayed_event_timer.ep = (void *)new_inp; stcb->asoc.delete_prim_timer.ep = (void *)new_inp; /* now what about the nets? */ TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { @@ -4404,7 +4403,6 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockadd SCTP_OS_TIMER_INIT(&asoc->asconf_timer.timer); SCTP_OS_TIMER_INIT(&asoc->shut_guard_timer.timer); SCTP_OS_TIMER_INIT(&asoc->autoclose_timer.timer); - SCTP_OS_TIMER_INIT(&asoc->delayed_event_timer.timer); SCTP_OS_TIMER_INIT(&asoc->delete_prim_timer.timer); LIST_INSERT_HEAD(&inp->sctp_asoc_list, stcb, sctp_tcblist); @@ -4778,8 +4776,6 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tc asoc->autoclose_timer.self = NULL; (void)SCTP_OS_TIMER_STOP(&asoc->shut_guard_timer.timer); asoc->shut_guard_timer.self = NULL; - (void)SCTP_OS_TIMER_STOP(&asoc->delayed_event_timer.timer); - asoc->delayed_event_timer.self = NULL; /* Mobility adaptation */ (void)SCTP_OS_TIMER_STOP(&asoc->delete_prim_timer.timer); asoc->delete_prim_timer.self = NULL; @@ -4964,7 +4960,6 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tc (void)SCTP_OS_TIMER_STOP(&asoc->asconf_timer.timer); (void)SCTP_OS_TIMER_STOP(&asoc->shut_guard_timer.timer); (void)SCTP_OS_TIMER_STOP(&asoc->autoclose_timer.timer); - (void)SCTP_OS_TIMER_STOP(&asoc->delayed_event_timer.timer); TAILQ_FOREACH(net, &asoc->nets, sctp_next) { (void)SCTP_OS_TIMER_STOP(&net->rxt_timer.timer); (void)SCTP_OS_TIMER_STOP(&net->pmtu_timer.timer); Modified: stable/12/sys/netinet/sctp_structs.h ============================================================================== --- stable/12/sys/netinet/sctp_structs.h Sun Aug 23 21:05:39 2020 (r364540) +++ stable/12/sys/netinet/sctp_structs.h Sun Aug 23 21:05:54 2020 (r364541) @@ -806,7 +806,6 @@ struct sctp_association { struct sctp_timer strreset_timer; /* stream reset */ struct sctp_timer shut_guard_timer; /* shutdown guard */ struct sctp_timer autoclose_timer; /* automatic close timer */ - struct sctp_timer delayed_event_timer; /* timer for delayed events */ struct sctp_timer delete_prim_timer; /* deleting primary dst */ /* list of restricted local addresses */ Modified: stable/12/sys/netinet/sctputil.c ============================================================================== --- stable/12/sys/netinet/sctputil.c Sun Aug 23 21:05:39 2020 (r364540) +++ stable/12/sys/netinet/sctputil.c Sun Aug 23 21:05:54 2020 (r364541) @@ -789,7 +789,6 @@ sctp_stop_timers_for_shutdown(struct sctp_tcb *stcb) (void)SCTP_OS_TIMER_STOP(&asoc->strreset_timer.timer); (void)SCTP_OS_TIMER_STOP(&asoc->asconf_timer.timer); (void)SCTP_OS_TIMER_STOP(&asoc->autoclose_timer.timer); - (void)SCTP_OS_TIMER_STOP(&asoc->delayed_event_timer.timer); TAILQ_FOREACH(net, &asoc->nets, sctp_next) { (void)SCTP_OS_TIMER_STOP(&net->pmtu_timer.timer); (void)SCTP_OS_TIMER_STOP(&net->hb_timer.timer); From owner-svn-src-stable-12@freebsd.org Sun Aug 23 21:07:41 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 36CD23CB41A; Sun, 23 Aug 2020 21:07: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZSWd0mfTz4X6k; Sun, 23 Aug 2020 21:07: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 F1DD9D3ED; Sun, 23 Aug 2020 21:07: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 07NL7eES047945; Sun, 23 Aug 2020 21:07:40 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NL7dGF047940; Sun, 23 Aug 2020 21:07:39 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232107.07NL7dGF047940@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 21:07:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364543 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364543 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 21:07:41 -0000 Author: tuexen Date: Sun Aug 23 21:07:39 2020 New Revision: 364543 URL: https://svnweb.freebsd.org/changeset/base/364543 Log: MFC r357705: Cleanup timer handling. Modified: stable/12/sys/netinet/sctp_indata.c stable/12/sys/netinet/sctp_output.c stable/12/sys/netinet/sctp_pcb.c stable/12/sys/netinet/sctputil.c stable/12/sys/netinet/sctputil.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_indata.c ============================================================================== --- stable/12/sys/netinet/sctp_indata.c Sun Aug 23 21:06:41 2020 (r364542) +++ stable/12/sys/netinet/sctp_indata.c Sun Aug 23 21:07:39 2020 (r364543) @@ -2663,7 +2663,8 @@ sctp_sack_check(struct sctp_tcb *stcb, int was_a_gap) * is pending, we got our first packet OR * there are gaps or duplicates. */ - (void)SCTP_OS_TIMER_STOP(&stcb->asoc.dack_timer.timer); + sctp_timer_stop(SCTP_TIMER_TYPE_RECV, stcb->sctp_ep, stcb, NULL, + SCTP_FROM_SCTP_INDATA + SCTP_LOC_19); sctp_send_sack(stcb, SCTP_SO_NOT_LOCKED); } } else { Modified: stable/12/sys/netinet/sctp_output.c ============================================================================== --- stable/12/sys/netinet/sctp_output.c Sun Aug 23 21:06:41 2020 (r364542) +++ stable/12/sys/netinet/sctp_output.c Sun Aug 23 21:07:39 2020 (r364543) @@ -10074,7 +10074,8 @@ do_it_again: */ if (SCTP_OS_TIMER_PENDING(&stcb->asoc.dack_timer.timer)) { sctp_send_sack(stcb, so_locked); - (void)SCTP_OS_TIMER_STOP(&stcb->asoc.dack_timer.timer); + sctp_timer_stop(SCTP_TIMER_TYPE_RECV, stcb->sctp_ep, stcb, NULL, + SCTP_FROM_SCTP_OUTPUT + SCTP_LOC_3); } while (asoc->sent_queue_retran_cnt) { /*- @@ -10603,7 +10604,7 @@ sctp_send_sack(struct sctp_tcb *stcb, int so_locked if (stcb->asoc.delayed_ack) { sctp_timer_stop(SCTP_TIMER_TYPE_RECV, stcb->sctp_ep, stcb, NULL, - SCTP_FROM_SCTP_OUTPUT + SCTP_LOC_3); + SCTP_FROM_SCTP_OUTPUT + SCTP_LOC_4); sctp_timer_start(SCTP_TIMER_TYPE_RECV, stcb->sctp_ep, stcb, NULL); } else { @@ -10672,7 +10673,7 @@ sctp_send_sack(struct sctp_tcb *stcb, int so_locked if (stcb->asoc.delayed_ack) { sctp_timer_stop(SCTP_TIMER_TYPE_RECV, stcb->sctp_ep, stcb, NULL, - SCTP_FROM_SCTP_OUTPUT + SCTP_LOC_4); + SCTP_FROM_SCTP_OUTPUT + SCTP_LOC_5); sctp_timer_start(SCTP_TIMER_TYPE_RECV, stcb->sctp_ep, stcb, NULL); } else { @@ -12834,7 +12835,7 @@ sctp_lower_sosend(struct socket *so, if (control) { if (sctp_process_cmsgs_for_init(stcb, control, &error)) { sctp_free_assoc(inp, stcb, SCTP_PCBFREE_FORCE, - SCTP_FROM_SCTP_OUTPUT + SCTP_LOC_5); + SCTP_FROM_SCTP_OUTPUT + SCTP_LOC_6); hold_tcblock = 0; stcb = NULL; goto out_unlocked; Modified: stable/12/sys/netinet/sctp_pcb.c ============================================================================== --- stable/12/sys/netinet/sctp_pcb.c Sun Aug 23 21:06:41 2020 (r364542) +++ stable/12/sys/netinet/sctp_pcb.c Sun Aug 23 21:07:39 2020 (r364543) @@ -3544,7 +3544,6 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, } if (cnt) { /* Ok we have someone out there that will kill us */ - (void)SCTP_OS_TIMER_STOP(&inp->sctp_ep.signature_change.timer); #ifdef SCTP_LOG_CLOSING sctp_log_closing(inp, NULL, 3); #endif @@ -3563,7 +3562,6 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, if ((inp->refcount) || (being_refed) || (inp->sctp_flags & SCTP_PCB_FLAGS_CLOSE_IP)) { - (void)SCTP_OS_TIMER_STOP(&inp->sctp_ep.signature_change.timer); #ifdef SCTP_LOG_CLOSING sctp_log_closing(inp, NULL, 4); #endif @@ -4758,35 +4756,8 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tc return (0); } } - /* now clean up any other timers */ - (void)SCTP_OS_TIMER_STOP(&asoc->dack_timer.timer); - asoc->dack_timer.self = NULL; - (void)SCTP_OS_TIMER_STOP(&asoc->strreset_timer.timer); - /*- - * For stream reset we don't blast this unless - * it is a str-reset timer, it might be the - * free-asoc timer which we DON'T want to - * disturb. - */ - if (asoc->strreset_timer.type == SCTP_TIMER_TYPE_STRRESET) - asoc->strreset_timer.self = NULL; - (void)SCTP_OS_TIMER_STOP(&asoc->asconf_timer.timer); - asoc->asconf_timer.self = NULL; - (void)SCTP_OS_TIMER_STOP(&asoc->autoclose_timer.timer); - asoc->autoclose_timer.self = NULL; - (void)SCTP_OS_TIMER_STOP(&asoc->shut_guard_timer.timer); - asoc->shut_guard_timer.self = NULL; - /* Mobility adaptation */ - (void)SCTP_OS_TIMER_STOP(&asoc->delete_prim_timer.timer); - asoc->delete_prim_timer.self = NULL; - TAILQ_FOREACH(net, &asoc->nets, sctp_next) { - (void)SCTP_OS_TIMER_STOP(&net->rxt_timer.timer); - net->rxt_timer.self = NULL; - (void)SCTP_OS_TIMER_STOP(&net->pmtu_timer.timer); - net->pmtu_timer.self = NULL; - (void)SCTP_OS_TIMER_STOP(&net->hb_timer.timer); - net->hb_timer.self = NULL; - } + /* Now clean up any other timers */ + sctp_stop_association_timers(stcb, false); /* Now the read queue needs to be cleaned up (only once) */ if ((stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) == 0) { SCTP_ADD_SUBSTATE(stcb, SCTP_STATE_ABOUT_TO_BE_FREED); @@ -4954,19 +4925,8 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tc /* * Now restop the timers to be sure this is paranoia at is finest! */ - (void)SCTP_OS_TIMER_STOP(&asoc->strreset_timer.timer); - (void)SCTP_OS_TIMER_STOP(&asoc->dack_timer.timer); - (void)SCTP_OS_TIMER_STOP(&asoc->strreset_timer.timer); - (void)SCTP_OS_TIMER_STOP(&asoc->asconf_timer.timer); - (void)SCTP_OS_TIMER_STOP(&asoc->shut_guard_timer.timer); - (void)SCTP_OS_TIMER_STOP(&asoc->autoclose_timer.timer); - TAILQ_FOREACH(net, &asoc->nets, sctp_next) { - (void)SCTP_OS_TIMER_STOP(&net->rxt_timer.timer); - (void)SCTP_OS_TIMER_STOP(&net->pmtu_timer.timer); - (void)SCTP_OS_TIMER_STOP(&net->hb_timer.timer); - } + sctp_stop_association_timers(stcb, true); - asoc->strreset_timer.type = SCTP_TIMER_TYPE_NONE; /* * The chunk lists and such SHOULD be empty but we check them just * in case. @@ -7030,7 +6990,8 @@ sctp_drain_mbufs(struct sctp_tcb *stcb) * asoc->highest_tsn_inside_map? */ asoc->last_revoke_count = cnt; - (void)SCTP_OS_TIMER_STOP(&stcb->asoc.dack_timer.timer); + sctp_timer_stop(SCTP_TIMER_TYPE_RECV, stcb->sctp_ep, stcb, NULL, + SCTP_FROM_SCTP_PCB + SCTP_LOC_16); /* sa_ignore NO_NULL_CHK */ sctp_send_sack(stcb, SCTP_SO_NOT_LOCKED); sctp_chunk_output(stcb->sctp_ep, stcb, SCTP_OUTPUT_FROM_DRAIN, SCTP_SO_NOT_LOCKED); Modified: stable/12/sys/netinet/sctputil.c ============================================================================== --- stable/12/sys/netinet/sctputil.c Sun Aug 23 21:06:41 2020 (r364542) +++ stable/12/sys/netinet/sctputil.c Sun Aug 23 21:07:39 2020 (r364543) @@ -780,18 +780,66 @@ sctp_audit_log(uint8_t ev, uint8_t fd) void sctp_stop_timers_for_shutdown(struct sctp_tcb *stcb) { - struct sctp_association *asoc; + struct sctp_inpcb *inp; struct sctp_nets *net; - asoc = &stcb->asoc; + inp = stcb->sctp_ep; - (void)SCTP_OS_TIMER_STOP(&asoc->dack_timer.timer); - (void)SCTP_OS_TIMER_STOP(&asoc->strreset_timer.timer); - (void)SCTP_OS_TIMER_STOP(&asoc->asconf_timer.timer); - (void)SCTP_OS_TIMER_STOP(&asoc->autoclose_timer.timer); - TAILQ_FOREACH(net, &asoc->nets, sctp_next) { - (void)SCTP_OS_TIMER_STOP(&net->pmtu_timer.timer); - (void)SCTP_OS_TIMER_STOP(&net->hb_timer.timer); + sctp_timer_stop(SCTP_TIMER_TYPE_RECV, inp, stcb, NULL, + SCTP_FROM_SCTPUTIL + SCTP_LOC_12); + sctp_timer_stop(SCTP_TIMER_TYPE_STRRESET, inp, stcb, NULL, + SCTP_FROM_SCTPUTIL + SCTP_LOC_13); + sctp_timer_stop(SCTP_TIMER_TYPE_ASCONF, inp, stcb, NULL, + SCTP_FROM_SCTPUTIL + SCTP_LOC_14); + sctp_timer_stop(SCTP_TIMER_TYPE_AUTOCLOSE, inp, stcb, NULL, + SCTP_FROM_SCTPUTIL + SCTP_LOC_15); + TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { + sctp_timer_stop(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net, + SCTP_FROM_SCTPUTIL + SCTP_LOC_16); + sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net, + SCTP_FROM_SCTPUTIL + SCTP_LOC_17); + } +} + +void +sctp_stop_association_timers(struct sctp_tcb *stcb, bool stop_assoc_kill_timer) +{ + struct sctp_inpcb *inp; + struct sctp_nets *net; + + inp = stcb->sctp_ep; + sctp_timer_stop(SCTP_TIMER_TYPE_RECV, inp, stcb, NULL, + SCTP_FROM_SCTPUTIL + SCTP_LOC_18); + sctp_timer_stop(SCTP_TIMER_TYPE_STRRESET, inp, stcb, NULL, + SCTP_FROM_SCTPUTIL + SCTP_LOC_19); + if (stop_assoc_kill_timer) { + sctp_timer_stop(SCTP_TIMER_TYPE_ASOCKILL, inp, stcb, NULL, + SCTP_FROM_SCTPUTIL + SCTP_LOC_20); + } + sctp_timer_stop(SCTP_TIMER_TYPE_ASCONF, inp, stcb, NULL, + SCTP_FROM_SCTPUTIL + SCTP_LOC_21); + sctp_timer_stop(SCTP_TIMER_TYPE_AUTOCLOSE, inp, stcb, NULL, + SCTP_FROM_SCTPUTIL + SCTP_LOC_22); + sctp_timer_stop(SCTP_TIMER_TYPE_SHUTDOWNGUARD, inp, stcb, NULL, + SCTP_FROM_SCTPUTIL + SCTP_LOC_23); + /* Mobility adaptation */ + sctp_timer_stop(SCTP_TIMER_TYPE_PRIM_DELETED, inp, stcb, NULL, + SCTP_FROM_SCTPUTIL + SCTP_LOC_24); + TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { + sctp_timer_stop(SCTP_TIMER_TYPE_SEND, inp, stcb, net, + SCTP_FROM_SCTPUTIL + SCTP_LOC_25); + sctp_timer_stop(SCTP_TIMER_TYPE_INIT, inp, stcb, net, + SCTP_FROM_SCTPUTIL + SCTP_LOC_26); + sctp_timer_stop(SCTP_TIMER_TYPE_SHUTDOWN, inp, stcb, net, + SCTP_FROM_SCTPUTIL + SCTP_LOC_27); + sctp_timer_stop(SCTP_TIMER_TYPE_COOKIE, inp, stcb, net, + SCTP_FROM_SCTPUTIL + SCTP_LOC_28); + sctp_timer_stop(SCTP_TIMER_TYPE_SHUTDOWNACK, inp, stcb, net, + SCTP_FROM_SCTPUTIL + SCTP_LOC_29); + sctp_timer_stop(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net, + SCTP_FROM_SCTPUTIL + SCTP_LOC_30); + sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net, + SCTP_FROM_SCTPUTIL + SCTP_LOC_31); } } Modified: stable/12/sys/netinet/sctputil.h ============================================================================== --- stable/12/sys/netinet/sctputil.h Sun Aug 23 21:06:41 2020 (r364542) +++ stable/12/sys/netinet/sctputil.h Sun Aug 23 21:07:39 2020 (r364543) @@ -164,6 +164,9 @@ sctp_pull_off_control_to_new_inp(struct sctp_inpcb *ol void sctp_stop_timers_for_shutdown(struct sctp_tcb *); +/* Stop all timers for association and remote addresses. */ +void sctp_stop_association_timers(struct sctp_tcb *, bool); + void sctp_report_all_outbound(struct sctp_tcb *, uint16_t, int, int #if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) From owner-svn-src-stable-12@freebsd.org Sun Aug 23 21:10:24 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D9DDE3CB3F5; Sun, 23 Aug 2020 21:10:24 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZSZm5QV0z4X3s; Sun, 23 Aug 2020 21:10:24 +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 9D885D99B; Sun, 23 Aug 2020 21:10:24 +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 07NLAOxY048221; Sun, 23 Aug 2020 21:10:24 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NLAOHA048219; Sun, 23 Aug 2020 21:10:24 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232110.07NLAOHA048219@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 21:10:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364544 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364544 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 21:10:24 -0000 Author: tuexen Date: Sun Aug 23 21:10:24 2020 New Revision: 364544 URL: https://svnweb.freebsd.org/changeset/base/364544 Log: MFC r357708: Stop the PMTU and HB timer when removing a net, not when freeing it. Modified: stable/12/sys/netinet/sctp_pcb.c stable/12/sys/netinet/sctp_var.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_pcb.c ============================================================================== --- stable/12/sys/netinet/sctp_pcb.c Sun Aug 23 21:07:39 2020 (r364543) +++ stable/12/sys/netinet/sctp_pcb.c Sun Aug 23 21:10:24 2020 (r364544) @@ -4422,8 +4422,10 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockadd void sctp_remove_net(struct sctp_tcb *stcb, struct sctp_nets *net) { + struct sctp_inpcb *inp; struct sctp_association *asoc; + inp = stcb->sctp_ep; asoc = &stcb->asoc; asoc->numnets--; TAILQ_REMOVE(&asoc->nets, net, sctp_next); @@ -4471,6 +4473,10 @@ out: sctp_free_remote_addr(stcb->asoc.alternate); stcb->asoc.alternate = NULL; } + sctp_timer_stop(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net, + SCTP_FROM_SCTP_PCB + SCTP_LOC_9); + sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net, + SCTP_FROM_SCTP_PCB + SCTP_LOC_10); sctp_free_remote_addr(net); } @@ -6991,7 +6997,7 @@ sctp_drain_mbufs(struct sctp_tcb *stcb) */ asoc->last_revoke_count = cnt; sctp_timer_stop(SCTP_TIMER_TYPE_RECV, stcb->sctp_ep, stcb, NULL, - SCTP_FROM_SCTP_PCB + SCTP_LOC_16); + SCTP_FROM_SCTP_PCB + SCTP_LOC_11); /* sa_ignore NO_NULL_CHK */ sctp_send_sack(stcb, SCTP_SO_NOT_LOCKED); sctp_chunk_output(stcb->sctp_ep, stcb, SCTP_OUTPUT_FROM_DRAIN, SCTP_SO_NOT_LOCKED); Modified: stable/12/sys/netinet/sctp_var.h ============================================================================== --- stable/12/sys/netinet/sctp_var.h Sun Aug 23 21:07:39 2020 (r364543) +++ stable/12/sys/netinet/sctp_var.h Sun Aug 23 21:10:24 2020 (r364544) @@ -187,8 +187,6 @@ extern struct pr_usrreqs sctp_usrreqs; if ((__net)) { \ if (SCTP_DECREMENT_AND_CHECK_REFCOUNT(&(__net)->ref_count)) { \ (void)SCTP_OS_TIMER_STOP(&(__net)->rxt_timer.timer); \ - (void)SCTP_OS_TIMER_STOP(&(__net)->pmtu_timer.timer); \ - (void)SCTP_OS_TIMER_STOP(&(__net)->hb_timer.timer); \ if ((__net)->ro.ro_rt) { \ RTFREE((__net)->ro.ro_rt); \ (__net)->ro.ro_rt = NULL; \ From owner-svn-src-stable-12@freebsd.org Sun Aug 23 21:12:38 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6AB903CB7B3; Sun, 23 Aug 2020 21:12: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZSdL2FDLz4XZT; Sun, 23 Aug 2020 21:12: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 31561DAB5; Sun, 23 Aug 2020 21:12: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 07NLCcbG054018; Sun, 23 Aug 2020 21:12:38 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NLCbKM054016; Sun, 23 Aug 2020 21:12:37 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232112.07NLCbKM054016@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 21:12:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364545 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364545 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 21:12:38 -0000 Author: tuexen Date: Sun Aug 23 21:12:37 2020 New Revision: 364545 URL: https://svnweb.freebsd.org/changeset/base/364545 Log: MFC r357768: Don't start an SCTP timer using a net, which has been removed. Modified: stable/12/sys/netinet/sctp_pcb.c stable/12/sys/netinet/sctputil.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_pcb.c ============================================================================== --- stable/12/sys/netinet/sctp_pcb.c Sun Aug 23 21:10:24 2020 (r364544) +++ stable/12/sys/netinet/sctp_pcb.c Sun Aug 23 21:12:37 2020 (r364545) @@ -4477,6 +4477,7 @@ out: SCTP_FROM_SCTP_PCB + SCTP_LOC_9); sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net, SCTP_FROM_SCTP_PCB + SCTP_LOC_10); + net->dest_state |= SCTP_ADDR_BEING_DELETED; sctp_free_remote_addr(net); } Modified: stable/12/sys/netinet/sctputil.c ============================================================================== --- stable/12/sys/netinet/sctputil.c Sun Aug 23 21:10:24 2020 (r364544) +++ stable/12/sys/netinet/sctputil.c Sun Aug 23 21:12:37 2020 (r364545) @@ -2050,6 +2050,10 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s if (stcb) { SCTP_TCB_LOCK_ASSERT(stcb); } + /* Don't restart timer on net that's been removed. */ + if (net != NULL && (net->dest_state & SCTP_ADDR_BEING_DELETED)) { + return; + } switch (t_type) { case SCTP_TIMER_TYPE_ADDR_WQ: /* Only 1 tick away :-) */ From owner-svn-src-stable-12@freebsd.org Sun Aug 23 21:19:18 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5ED913CB671; Sun, 23 Aug 2020 21:19: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZSn21pN1z4Xvg; Sun, 23 Aug 2020 21:19: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 22244DA34; Sun, 23 Aug 2020 21:19: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 07NLJHja054436; Sun, 23 Aug 2020 21:19:17 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NLJH0C054435; Sun, 23 Aug 2020 21:19:17 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232119.07NLJH0C054435@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 21:19:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364546 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364546 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 21:19:18 -0000 Author: tuexen Date: Sun Aug 23 21:19:17 2020 New Revision: 364546 URL: https://svnweb.freebsd.org/changeset/base/364546 Log: MFC r357830: Don't panic under INVARIANTS when we can't allocate memory for storing a vtag in time wait. This issue was found by running syzkaller. Modified: stable/12/sys/netinet/sctp_pcb.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_pcb.c ============================================================================== --- stable/12/sys/netinet/sctp_pcb.c Sun Aug 23 21:12:37 2020 (r364545) +++ stable/12/sys/netinet/sctp_pcb.c Sun Aug 23 21:19:17 2020 (r364546) @@ -4631,9 +4631,6 @@ sctp_add_vtag_to_timewait(uint32_t tag, uint32_t time, SCTP_MALLOC(twait_block, struct sctp_tagblock *, sizeof(struct sctp_tagblock), SCTP_M_TIMW); if (twait_block == NULL) { -#ifdef INVARIANTS - panic("Can not alloc tagblock"); -#endif return; } memset(twait_block, 0, sizeof(struct sctp_tagblock)); From owner-svn-src-stable-12@freebsd.org Sun Aug 23 21:22:14 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A19C43CBC8B; Sun, 23 Aug 2020 21:22:14 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZSrQ3sS5z4Y4v; Sun, 23 Aug 2020 21:22: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 6838DDAD6; Sun, 23 Aug 2020 21:22: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 07NLMEfY059484; Sun, 23 Aug 2020 21:22:14 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NLMEbO059483; Sun, 23 Aug 2020 21:22:14 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232122.07NLMEbO059483@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 21:22:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364547 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364547 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 21:22:14 -0000 Author: tuexen Date: Sun Aug 23 21:22:13 2020 New Revision: 364547 URL: https://svnweb.freebsd.org/changeset/base/364547 Log: MFC r358028: Fix the non-default stream schedulers such that do not interleave user messages when it is now allowed. Thanks to Christian Wright for reporting the issue for the userland stack and providing a fix for the priority scheduler. Modified: stable/12/sys/netinet/sctp_ss_functions.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_ss_functions.c ============================================================================== --- stable/12/sys/netinet/sctp_ss_functions.c Sun Aug 23 21:19:17 2020 (r364546) +++ stable/12/sys/netinet/sctp_ss_functions.c Sun Aug 23 21:22:13 2020 (r364547) @@ -517,6 +517,9 @@ sctp_ss_prio_select(struct sctp_tcb *stcb SCTP_UNUSED, { struct sctp_stream_out *strq, *strqt, *strqn; + if (asoc->ss_data.locked_on_sending) { + return (asoc->ss_data.locked_on_sending); + } strqt = asoc->ss_data.last_out_stream; prio_again: /* Find the next stream to use */ @@ -694,6 +697,9 @@ sctp_ss_fb_select(struct sctp_tcb *stcb SCTP_UNUSED, s { struct sctp_stream_out *strq = NULL, *strqt; + if (asoc->ss_data.locked_on_sending) { + return (asoc->ss_data.locked_on_sending); + } if (asoc->ss_data.last_out_stream == NULL || TAILQ_FIRST(&asoc->ss_data.out.wheel) == TAILQ_LAST(&asoc->ss_data.out.wheel, sctpwheel_listhead)) { strqt = TAILQ_FIRST(&asoc->ss_data.out.wheel); @@ -900,6 +906,9 @@ sctp_ss_fcfs_select(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_stream_out *strq; struct sctp_stream_queue_pending *sp; + if (asoc->ss_data.locked_on_sending) { + return (asoc->ss_data.locked_on_sending); + } sp = TAILQ_FIRST(&asoc->ss_data.out.list); default_again: if (sp != NULL) { From owner-svn-src-stable-12@freebsd.org Sun Aug 23 21:23:46 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6232A3CBB49; Sun, 23 Aug 2020 21:23: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZStB1x1Dz4Y5f; Sun, 23 Aug 2020 21:23:46 +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 262FDDD1E; Sun, 23 Aug 2020 21:23:46 +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 07NLNkxd060348; Sun, 23 Aug 2020 21:23:46 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NLNkWn060347; Sun, 23 Aug 2020 21:23:46 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232123.07NLNkWn060347@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 21:23:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364548 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364548 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 21:23:46 -0000 Author: tuexen Date: Sun Aug 23 21:23:45 2020 New Revision: 364548 URL: https://svnweb.freebsd.org/changeset/base/364548 Log: MFC r358080: Remove unused function. Modified: stable/12/sys/netinet/sctp_bsd_addr.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_bsd_addr.c ============================================================================== --- stable/12/sys/netinet/sctp_bsd_addr.c Sun Aug 23 21:22:13 2020 (r364547) +++ stable/12/sys/netinet/sctp_bsd_addr.c Sun Aug 23 21:23:45 2020 (r364548) @@ -362,23 +362,6 @@ sctp_addr_change_event_handler(void *arg __unused, str sctp_addr_change(ifa, cmd); } -void - sctp_add_or_del_interfaces(int (*pred) (struct ifnet *), int add){ - struct ifnet *ifn; - struct ifaddr *ifa; - - IFNET_RLOCK(); - CK_STAILQ_FOREACH(ifn, &MODULE_GLOBAL(ifnet), if_link) { - if (!(*pred) (ifn)) { - continue; - } - CK_STAILQ_FOREACH(ifa, &ifn->if_addrhead, ifa_link) { - sctp_addr_change(ifa, add ? RTM_ADD : RTM_DELETE); - } - } - IFNET_RUNLOCK(); -} - struct mbuf * sctp_get_mbuf_for_msg(unsigned int space_needed, int want_header, int how, int allonebuf, int type) From owner-svn-src-stable-12@freebsd.org Sun Aug 23 21:27:55 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 137123CBF64; Sun, 23 Aug 2020 21:27: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZSyy6kkcz4YWQ; Sun, 23 Aug 2020 21:27: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 CB1B4DBDA; Sun, 23 Aug 2020 21:27: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 07NLRs3K060602; Sun, 23 Aug 2020 21:27:54 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NLRs1X060601; Sun, 23 Aug 2020 21:27:54 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232127.07NLRs1X060601@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 21:27:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364549 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364549 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 21:27:55 -0000 Author: tuexen Date: Sun Aug 23 21:27:54 2020 New Revision: 364549 URL: https://svnweb.freebsd.org/changeset/base/364549 Log: MFC r358169: Remove an unused timer type. Modified: stable/12/sys/netinet/sctp_constants.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_constants.h ============================================================================== --- stable/12/sys/netinet/sctp_constants.h Sun Aug 23 21:23:45 2020 (r364548) +++ stable/12/sys/netinet/sctp_constants.h Sun Aug 23 21:27:54 2020 (r364549) @@ -543,14 +543,13 @@ __FBSDID("$FreeBSD$"); #define SCTP_TIMER_TYPE_ASCONF 10 #define SCTP_TIMER_TYPE_SHUTDOWNGUARD 11 #define SCTP_TIMER_TYPE_AUTOCLOSE 12 -#define SCTP_TIMER_TYPE_EVENTWAKE 13 -#define SCTP_TIMER_TYPE_STRRESET 14 -#define SCTP_TIMER_TYPE_INPKILL 15 -#define SCTP_TIMER_TYPE_ASOCKILL 16 -#define SCTP_TIMER_TYPE_ADDR_WQ 17 -#define SCTP_TIMER_TYPE_PRIM_DELETED 18 +#define SCTP_TIMER_TYPE_STRRESET 13 +#define SCTP_TIMER_TYPE_INPKILL 14 +#define SCTP_TIMER_TYPE_ASOCKILL 15 +#define SCTP_TIMER_TYPE_ADDR_WQ 16 +#define SCTP_TIMER_TYPE_PRIM_DELETED 17 /* add new timers here - and increment LAST */ -#define SCTP_TIMER_TYPE_LAST 19 +#define SCTP_TIMER_TYPE_LAST 18 #define SCTP_IS_TIMER_TYPE_VALID(t) (((t) > SCTP_TIMER_TYPE_NONE) && \ ((t) < SCTP_TIMER_TYPE_LAST)) From owner-svn-src-stable-12@freebsd.org Sun Aug 23 21:35:24 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 51BDC3CBDD6; Sun, 23 Aug 2020 21:35:24 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZT7c1WqXz4Yq5; Sun, 23 Aug 2020 21:35:24 +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 1747DDBF3; Sun, 23 Aug 2020 21:35:24 +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 07NLZND3066746; Sun, 23 Aug 2020 21:35:23 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NLZNfF066745; Sun, 23 Aug 2020 21:35:23 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232135.07NLZNfF066745@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 21:35:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364550 - in stable/12: lib/libc/sys sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in stable/12: lib/libc/sys sys/kern X-SVN-Commit-Revision: 364550 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 21:35:24 -0000 Author: tuexen Date: Sun Aug 23 21:35:23 2020 New Revision: 364550 URL: https://svnweb.freebsd.org/changeset/base/364550 Log: MFC r358965: sendfile() does currently not support SCTP sockets. Therefore, fail the call. Manually fix a compile issue. Modified: stable/12/lib/libc/sys/sendfile.2 stable/12/sys/kern/kern_sendfile.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/sys/sendfile.2 ============================================================================== --- stable/12/lib/libc/sys/sendfile.2 Sun Aug 23 21:27:54 2020 (r364549) +++ stable/12/lib/libc/sys/sendfile.2 Sun Aug 23 21:35:23 2020 (r364550) @@ -414,3 +414,12 @@ to .Er EFAULT , if provided an invalid address for .Fa sbytes . +The +.Fn sendfile +system call does not support SCTP sockets, +it will return +.Dv -1 +and set +.Va errno +to +.Er EINVAL. Modified: stable/12/sys/kern/kern_sendfile.c ============================================================================== --- stable/12/sys/kern/kern_sendfile.c Sun Aug 23 21:27:54 2020 (r364549) +++ stable/12/sys/kern/kern_sendfile.c Sun Aug 23 21:35:23 2020 (r364550) @@ -53,6 +53,8 @@ __FBSDID("$FreeBSD$"); #include +#include + #include #include @@ -507,6 +509,12 @@ sendfile_getsock(struct thread *td, int s, struct file return (error); *so = (*sock_fp)->f_data; if ((*so)->so_type != SOCK_STREAM) + return (EINVAL); + /* + * SCTP one-to-one style sockets currently don't work with + * sendfile(). So indicate EINVAL for now. + */ + if ((*so)->so_proto->pr_protocol == IPPROTO_SCTP) return (EINVAL); if (SOLISTENING(*so)) return (ENOTCONN); From owner-svn-src-stable-12@freebsd.org Sun Aug 23 21:38:50 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 04EAB3CBDF1; Sun, 23 Aug 2020 21:38:50 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZTCY6j2Mz4ZLv; Sun, 23 Aug 2020 21:38:49 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 C91A5DA7C; Sun, 23 Aug 2020 21:38:49 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07NLcn6O067012; Sun, 23 Aug 2020 21:38:49 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NLcmsM067003; Sun, 23 Aug 2020 21:38:48 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008232138.07NLcmsM067003@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Aug 2020 21:38:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364552 - in stable/12/sys: amd64/linux amd64/linux32 arm64/linux conf i386/linux modules/linux64 X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in stable/12/sys: amd64/linux amd64/linux32 arm64/linux conf i386/linux modules/linux64 X-SVN-Commit-Revision: 364552 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 21:38:50 -0000 Author: trasz Date: Sun Aug 23 21:38:48 2020 New Revision: 364552 URL: https://svnweb.freebsd.org/changeset/base/364552 Log: MFC r350451 by emaste: linuxulator: rename linux_locore.s to .asm It is assembled using "${CC} -x assembler-with-cpp", which by convention (bsd.suffixes.mk) uses the .asm extension. This is a portion of the review referenced below (D18344). That review also renamed linux_support.s to .S, but that is a functional change (using the compiler's integrated assembler instead of as) and will be revisited separately. Sponsored by: The FreeBSD Foundation Added: stable/12/sys/amd64/linux/linux_locore.asm - copied unchanged from r350451, head/sys/amd64/linux/linux_locore.asm stable/12/sys/amd64/linux32/linux32_locore.asm - copied unchanged from r350451, head/sys/amd64/linux32/linux32_locore.asm stable/12/sys/arm64/linux/linux_locore.asm - copied unchanged from r350451, head/sys/arm64/linux/linux_locore.asm stable/12/sys/i386/linux/linux_locore.asm - copied unchanged from r350451, head/sys/i386/linux/linux_locore.asm Deleted: stable/12/sys/amd64/linux/linux_locore.s stable/12/sys/amd64/linux32/linux32_locore.s stable/12/sys/arm64/linux/linux_locore.s stable/12/sys/i386/linux/linux_locore.s Modified: stable/12/sys/conf/files.amd64 stable/12/sys/conf/files.i386 stable/12/sys/modules/linux64/Makefile Directory Properties: stable/12/ (props changed) Copied: stable/12/sys/amd64/linux/linux_locore.asm (from r350451, head/sys/amd64/linux/linux_locore.asm) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/amd64/linux/linux_locore.asm Sun Aug 23 21:38:48 2020 (r364552, copy of r350451, head/sys/amd64/linux/linux_locore.asm) @@ -0,0 +1,108 @@ +/* $FreeBSD$ */ + +#include "linux_assym.h" /* system definitions */ +#include /* miscellaneous asm macros */ + +#include /* system call numbers */ + + .data + + .globl linux_platform +linux_platform: + .asciz "x86_64" + + + .text +/* + * To avoid excess stack frame the signal trampoline code emulates + * the 'call' instruction. + */ +NON_GPROF_ENTRY(linux_rt_sigcode) + movq %rsp, %rbx /* preserve sigframe */ + call .getip +.getip: + popq %rax + add $.startrtsigcode-.getip, %rax /* ret address */ + pushq %rax + jmp *LINUX_RT_SIGF_HANDLER(%rbx) +.startrtsigcode: + movq $LINUX_SYS_linux_rt_sigreturn,%rax /* linux_rt_sigreturn() */ + syscall /* enter kernel with args */ + hlt +.endrtsigcode: +0: jmp 0b + +NON_GPROF_ENTRY(__vdso_clock_gettime) + movq $LINUX_SYS_linux_clock_gettime,%rax + syscall + ret +.weak clock_gettime +.set clock_gettime, __vdso_clock_gettime + +NON_GPROF_ENTRY(__vdso_time) + movq $LINUX_SYS_linux_time,%rax + syscall + ret +.weak time +.set time, __vdso_time + +NON_GPROF_ENTRY(__vdso_gettimeofday) + movq $LINUX_SYS_gettimeofday,%rax + syscall + ret +.weak gettimeofday +.set gettimeofday, __vdso_gettimeofday + +NON_GPROF_ENTRY(__vdso_getcpu) + movq $-38,%rax /* not implemented */ + ret +.weak getcpu +.set getcpu, __vdso_getcpu + +#if 0 + .section .note.Linux, "a",@note + .long 2f - 1f /* namesz */ + .balign 4 + .long 4f - 3f /* descsz */ + .long 0 +1: + .asciz "Linux" +2: + .balign 4 +3: + .long LINUX_VERSION_CODE +4: + .balign 4 + .previous +#endif + + .section .eh_frame,"a",@progbits +.LSTARTFRAMEDLSI0: + .long .LENDCIEDLSI0-.LSTARTCIEDLSI0 +.LSTARTCIEDLSI0: + .long 0 /* CIE ID */ + .byte 1 /* Version number */ + .string "zR" /* NULL-terminated + * augmentation string + */ + .uleb128 1 /* Code alignment factor */ + .sleb128 -4 /* Data alignment factor */ + .byte 8 /* Return address register column */ + .uleb128 1 /* Augmentation value length */ + .byte 0x1b /* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */ + .byte 0x0c /* DW_CFA_def_cfa */ + .uleb128 4 + .uleb128 4 + .byte 0x88 /* DW_CFA_offset, column 0x8 */ + .uleb128 1 + .align 4 +.LENDCIEDLSI0: + .long .LENDFDEDLSI0-.LSTARTFDEDLSI0 /* Length FDE */ +.LSTARTFDEDLSI0: + .long .LSTARTFDEDLSI0-.LSTARTFRAMEDLSI0 /* CIE pointer */ + .long .startrtsigcode-. /* PC-relative start address */ + .long .endrtsigcode-.startrtsigcode + .uleb128 0 + .align 4 +.LENDFDEDLSI0: + .previous Copied: stable/12/sys/amd64/linux32/linux32_locore.asm (from r350451, head/sys/amd64/linux32/linux32_locore.asm) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/amd64/linux32/linux32_locore.asm Sun Aug 23 21:38:48 2020 (r364552, copy of r350451, head/sys/amd64/linux32/linux32_locore.asm) @@ -0,0 +1,156 @@ +/* $FreeBSD$ */ + +#include "linux32_assym.h" /* system definitions */ +#include /* miscellaneous asm macros */ + +#include /* system call numbers */ + +.data + + .globl linux_platform +linux_platform: + .asciz "i686" + +.text +.code32 + +/* + * To avoid excess stack frame the signal trampoline code emulates + * the 'call' instruction. + */ +NON_GPROF_ENTRY(linux32_sigcode) + movl %esp, %ebx /* preserve sigframe */ + call .getip0 +.getip0: + popl %eax + add $.startsigcode-.getip0, %eax /* ret address */ + push %eax + jmp *LINUX_SIGF_HANDLER(%ebx) +.startsigcode: + popl %eax + movl $LINUX32_SYS_linux_sigreturn,%eax /* linux_sigreturn() */ + int $0x80 /* enter kernel with args */ +.endsigcode: +0: jmp 0b + +NON_GPROF_ENTRY(linux32_rt_sigcode) + leal LINUX_RT_SIGF_UC(%esp),%ebx /* linux ucp */ + leal LINUX_RT_SIGF_SC(%ebx),%ecx /* linux sigcontext */ + movl %esp, %edi + call .getip1 +.getip1: + popl %eax + add $.startrtsigcode-.getip1, %eax /* ret address */ + push %eax + jmp *LINUX_RT_SIGF_HANDLER(%edi) +.startrtsigcode: + movl $LINUX32_SYS_linux_rt_sigreturn,%eax /* linux_rt_sigreturn() */ + int $0x80 /* enter kernel with args */ +.endrtsigcode: +0: jmp 0b + +NON_GPROF_ENTRY(linux32_vsyscall) +.startvsyscall: + int $0x80 + ret +.endvsyscall: + +#if 0 + .section .note.Linux, "a",@note + .long 2f - 1f /* namesz */ + .balign 4 + .long 4f - 3f /* descsz */ + .long 0 +1: + .asciz "Linux" +2: + .balign 4 +3: + .long LINUX_VERSION_CODE +4: + .balign 4 + .previous +#endif + +#define do_cfa_expr(offset) \ + .byte 0x0f; /* DW_CFA_def_cfa_expression */ \ + .uleb128 11f-10f; /* length */ \ +10: .byte 0x74; /* DW_OP_breg4 */ \ + .sleb128 offset; /* offset */ \ + .byte 0x06; /* DW_OP_deref */ \ +11: + + + /* CIE */ + .section .eh_frame,"a",@progbits +.LSTARTFRAMEDLSI1: + .long .LENDCIEDLSI1-.LSTARTCIEDLSI1 +.LSTARTCIEDLSI1: + .long 0 /* CIE ID */ + .byte 1 /* Version number */ + .string "zRS" /* NULL-terminated + * augmentation string + */ + .uleb128 1 /* Code alignment factor */ + .sleb128 -4 /* Data alignment factor */ + .byte 8 /* Return address + * register column + */ + .uleb128 1 /* Augmentation value length */ + .byte 0x1b /* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */ + .byte 0 /* DW_CFA_nop */ + .align 4 +.LENDCIEDLSI1: + + /* FDE */ + .long .LENDFDEDLSI1-.LSTARTFDEDLSI1 /* Length FDE */ +.LSTARTFDEDLSI1: + .long .LSTARTFDEDLSI1-.LSTARTFRAMEDLSI1 /* CIE pointer */ + .long .startsigcode-. /* PC-relative start address */ + .long .endsigcode-.startsigcode + .uleb128 0 /* Augmentation */ + do_cfa_expr(LINUX_SIGF_SC-8) + .align 4 +.LENDFDEDLSI1: + + .long .LENDFDEDLSI2-.LSTARTFDEDLSI2 /* Length FDE */ +.LSTARTFDEDLSI2: + .long .LSTARTFDEDLSI2-.LSTARTFRAMEDLSI1 /* CIE pointer */ + .long .startrtsigcode-. /* PC-relative start address */ + .long .endrtsigcode-.startrtsigcode + .uleb128 0 /* Augmentation */ + do_cfa_expr(LINUX_RT_SIGF_SC-4+LINUX_SC_ESP) + .align 4 +.LENDFDEDLSI2: + .previous + + .section .eh_frame,"a",@progbits +.LSTARTFRAMEDLSI2: + .long .LENDCIEDLSI2-.LSTARTCIEDLSI2 +.LSTARTCIEDLSI2: + .long 0 /* CIE ID */ + .byte 1 /* Version number */ + .string "zR" /* NULL-terminated + * augmentation string + */ + .uleb128 1 /* Code alignment factor */ + .sleb128 -4 /* Data alignment factor */ + .byte 8 /* Return address register column */ + .uleb128 1 /* Augmentation value length */ + .byte 0x1b /* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */ + .byte 0x0c /* DW_CFA_def_cfa */ + .uleb128 4 + .uleb128 4 + .byte 0x88 /* DW_CFA_offset, column 0x8 */ + .uleb128 1 + .align 4 +.LENDCIEDLSI2: + .long .LENDFDEDLSI3-.LSTARTFDEDLSI3 /* Length FDE */ +.LSTARTFDEDLSI3: + .long .LSTARTFDEDLSI3-.LSTARTFRAMEDLSI2 /* CIE pointer */ + .long .startvsyscall-. /* PC-relative start address */ + .long .endvsyscall-.startvsyscall + .uleb128 0 + .align 4 +.LENDFDEDLSI3: + .previous Copied: stable/12/sys/arm64/linux/linux_locore.asm (from r350451, head/sys/arm64/linux/linux_locore.asm) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/arm64/linux/linux_locore.asm Sun Aug 23 21:38:48 2020 (r364552, copy of r350451, head/sys/arm64/linux/linux_locore.asm) @@ -0,0 +1,58 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (C) 2018 Turing Robotic Industries Inc. + * + * 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$ + */ + +/* + * arm64 Linux VDSO implementation. + */ + +#include + + .data + + .globl linux_platform +linux_platform: + .asciz "arm64" + + .text + +ENTRY(__kernel_rt_sigreturn) + brk #0 /* LINUXTODO: implement __kernel_rt_sigreturn */ + ret + +ENTRY(__kernel_gettimeofday) + brk #0 /* LINUXTODO: implement __kernel_gettimeofday */ + ret + +ENTRY(__kernel_clock_gettime) + brk #0 /* LINUXTODO: implement __kernel_clock_gettime */ + ret + +ENTRY(__kernel_clock_getres) + brk #0 /* LINUXTODO: implement __kernel_clock_getres */ + ret Modified: stable/12/sys/conf/files.amd64 ============================================================================== --- stable/12/sys/conf/files.amd64 Sun Aug 23 21:37:20 2020 (r364551) +++ stable/12/sys/conf/files.amd64 Sun Aug 23 21:38:48 2020 (r364552) @@ -45,7 +45,7 @@ linux32_assym.h optional compat_linux32 \ clean "linux32_assym.h" # linux32_locore.o optional compat_linux32 \ - dependency "linux32_assym.h $S/amd64/linux32/linux32_locore.s" \ + dependency "linux32_assym.h $S/amd64/linux32/linux32_locore.asm" \ compile-with "${CC} -x assembler-with-cpp -DLOCORE -m32 -shared -s -pipe -I. -I$S ${WERROR} -Wall -fPIC -fno-common -nostdinc -nostdlib -Wl,-T$S/amd64/linux32/linux32_vdso.lds.s -Wl,-soname=linux32_vdso.so,--eh-frame-hdr,-warn-common ${.IMPSRC} -o ${.TARGET}" \ no-obj no-implicit-rule \ clean "linux32_locore.o" Modified: stable/12/sys/conf/files.i386 ============================================================================== --- stable/12/sys/conf/files.i386 Sun Aug 23 21:37:20 2020 (r364551) +++ stable/12/sys/conf/files.i386 Sun Aug 23 21:38:48 2020 (r364552) @@ -32,7 +32,7 @@ linux_assym.h optional compat_linux \ clean "linux_assym.h" # linux_locore.o optional compat_linux \ - dependency "linux_assym.h $S/i386/linux/linux_locore.s" \ + dependency "linux_assym.h $S/i386/linux/linux_locore.asm" \ compile-with "${CC} -x assembler-with-cpp -DLOCORE -shared -s -pipe -I. -I$S ${WERROR} -Wall -fPIC -fno-common -nostdinc -nostdlib -Wl,-T$S/i386/linux/linux_vdso.lds.s -Wl,-soname=linux_vdso.so,--eh-frame-hdr,-warn-common ${.IMPSRC} -o ${.TARGET}" \ no-obj no-implicit-rule \ clean "linux_locore.o" Copied: stable/12/sys/i386/linux/linux_locore.asm (from r350451, head/sys/i386/linux/linux_locore.asm) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/i386/linux/linux_locore.asm Sun Aug 23 21:38:48 2020 (r364552, copy of r350451, head/sys/i386/linux/linux_locore.asm) @@ -0,0 +1,149 @@ +/* $FreeBSD$ */ + +#include "linux_assym.h" /* system definitions */ +#include /* miscellaneous asm macros */ + +#include /* system call numbers */ + +#include "assym.inc" + +/* + * To avoid excess stack frame the signal trampoline code emulates + * the 'call' instruction. + */ +NON_GPROF_ENTRY(linux_sigcode) + movl %esp, %ebx /* preserve sigframe */ + call .getip0 +.getip0: + popl %eax + add $.startsigcode-.getip0, %eax /* ret address */ + push %eax + jmp *LINUX_SIGF_HANDLER(%ebx) +.startsigcode: + popl %eax /* gcc unwind code need this */ + movl $LINUX_SYS_linux_sigreturn,%eax /* linux_sigreturn() */ + int $0x80 /* enter kernel with args */ +.endsigcode: +0: jmp 0b + +NON_GPROF_ENTRY(linux_rt_sigcode) + leal LINUX_RT_SIGF_UC(%esp),%ebx /* linux ucp */ + leal LINUX_RT_SIGF_SC(%ebx),%ecx /* linux sigcontext */ + movl %esp, %edi + call .getip1 +.getip1: + popl %eax + add $.startrtsigcode-.getip1, %eax /* ret address */ + push %eax + jmp *LINUX_RT_SIGF_HANDLER(%edi) +.startrtsigcode: + movl $LINUX_SYS_linux_rt_sigreturn,%eax /* linux_rt_sigreturn() */ + int $0x80 /* enter kernel with args */ +.endrtsigcode: +0: jmp 0b + +NON_GPROF_ENTRY(linux_vsyscall) +.startvsyscall: + int $0x80 + ret +.endvsyscall: + +#if 0 + .section .note.Linux, "a",@note + .long 2f - 1f /* namesz */ + .balign 4 + .long 4f - 3f /* descsz */ + .long 0 +1: + .asciz "Linux" +2: + .balign 4 +3: + .long LINUX_VERSION_CODE +4: + .balign 4 + .previous +#endif + +#define do_cfa_expr(offset) \ + .byte 0x0f; /* DW_CFA_def_cfa_expression */ \ + .uleb128 11f-10f; /* length */ \ +10: .byte 0x74; /* DW_OP_breg4 */ \ + .sleb128 offset; /* offset */ \ + .byte 0x06; /* DW_OP_deref */ \ +11: + + + /* CIE */ + .section .eh_frame,"a",@progbits +.LSTARTFRAMEDLSI1: + .long .LENDCIEDLSI1-.LSTARTCIEDLSI1 +.LSTARTCIEDLSI1: + .long 0 /* CIE ID */ + .byte 1 /* Version number */ + .string "zRS" /* NULL-terminated + * augmentation string + */ + .uleb128 1 /* Code alignment factor */ + .sleb128 -4 /* Data alignment factor */ + .byte 8 /* Return address + * register column + */ + .uleb128 1 /* Augmentation value length */ + .byte 0x1b /* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */ + .byte 0 /* DW_CFA_nop */ + .align 4 +.LENDCIEDLSI1: + + /* FDE */ + .long .LENDFDEDLSI1-.LSTARTFDEDLSI1 /* Length FDE */ +.LSTARTFDEDLSI1: + .long .LSTARTFDEDLSI1-.LSTARTFRAMEDLSI1 /* CIE pointer */ + .long .startsigcode-. /* PC-relative start address */ + .long .endsigcode-.startsigcode + .uleb128 0 /* Augmentation */ + do_cfa_expr(LINUX_SIGF_SC-8) + .align 4 +.LENDFDEDLSI1: + + .long .LENDFDEDLSI2-.LSTARTFDEDLSI2 /* Length FDE */ +.LSTARTFDEDLSI2: + .long .LSTARTFDEDLSI2-.LSTARTFRAMEDLSI1 /* CIE pointer */ + .long .startrtsigcode-. /* PC-relative start address */ + .long .endrtsigcode-.startrtsigcode + .uleb128 0 /* Augmentation */ + do_cfa_expr(LINUX_RT_SIGF_SC-4+LINUX_SC_ESP) + .align 4 +.LENDFDEDLSI2: + .previous + + .section .eh_frame,"a",@progbits +.LSTARTFRAMEDLSI2: + .long .LENDCIEDLSI2-.LSTARTCIEDLSI2 +.LSTARTCIEDLSI2: + .long 0 /* CIE ID */ + .byte 1 /* Version number */ + .string "zR" /* NULL-terminated + * augmentation string + */ + .uleb128 1 /* Code alignment factor */ + .sleb128 -4 /* Data alignment factor */ + .byte 8 /* Return address register column */ + .uleb128 1 /* Augmentation value length */ + .byte 0x1b /* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */ + .byte 0x0c /* DW_CFA_def_cfa */ + .uleb128 4 + .uleb128 4 + .byte 0x88 /* DW_CFA_offset, column 0x8 */ + .uleb128 1 + .align 4 +.LENDCIEDLSI2: + .long .LENDFDEDLSI3-.LSTARTFDEDLSI3 /* Length FDE */ +.LSTARTFDEDLSI3: + .long .LSTARTFDEDLSI3-.LSTARTFRAMEDLSI2 /* CIE pointer */ + .long .startvsyscall-. /* PC-relative start address */ + .long .endvsyscall-.startvsyscall + .uleb128 0 + .align 4 +.LENDFDEDLSI3: + .previous Modified: stable/12/sys/modules/linux64/Makefile ============================================================================== --- stable/12/sys/modules/linux64/Makefile Sun Aug 23 21:37:20 2020 (r364551) +++ stable/12/sys/modules/linux64/Makefile Sun Aug 23 21:38:48 2020 (r364552) @@ -29,7 +29,7 @@ OBJS= ${VDSO}.so linux_assym.h: linux_genassym.o sh ${SYSDIR}/kern/genassym.sh linux_genassym.o > ${.TARGET} -linux_locore.o: linux_locore.s linux_assym.h +linux_locore.o: linux_locore.asm linux_assym.h ${CC} -x assembler-with-cpp -DLOCORE -shared -mcmodel=small \ -pipe -I. -I${SYSDIR} ${WERROR} -Wall -fno-common -fPIC -nostdinc \ -Wl,-T${SRCTOP}/sys/${MACHINE}/linux/${VDSO}.lds.s \ From owner-svn-src-stable-12@freebsd.org Sun Aug 23 21:44:06 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6A7973CC36A; Sun, 23 Aug 2020 21:44:06 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZTKf2BZDz4Zfv; Sun, 23 Aug 2020 21:44:06 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 2F57BDEBE; Sun, 23 Aug 2020 21:44:06 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07NLi5xx073175; Sun, 23 Aug 2020 21:44:05 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NLi5D2073174; Sun, 23 Aug 2020 21:44:05 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008232144.07NLi5D2073174@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Aug 2020 21:44:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364554 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364554 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 21:44:06 -0000 Author: trasz Date: Sun Aug 23 21:44:05 2020 New Revision: 364554 URL: https://svnweb.freebsd.org/changeset/base/364554 Log: MFC r352914 by kaktus: linux_renameat2: don't add extra \n on error. linux_msg() already adds \n at the end of all messages. Modified: stable/12/sys/compat/linux/linux_file.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_file.c ============================================================================== --- stable/12/sys/compat/linux/linux_file.c Sun Aug 23 21:42:23 2020 (r364553) +++ stable/12/sys/compat/linux/linux_file.c Sun Aug 23 21:44:05 2020 (r364554) @@ -792,7 +792,7 @@ linux_renameat2(struct thread *td, struct linux_rename int error, olddfd, newdfd; if (args->flags != 0) { - linux_msg(td, "renameat2 unsupported flags 0x%x\n", + linux_msg(td, "renameat2 unsupported flags 0x%x", args->flags); return (EINVAL); } From owner-svn-src-stable-12@freebsd.org Sun Aug 23 21:46:49 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D747E3CC4B1; Sun, 23 Aug 2020 21:46:49 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZTNn4skQz4Zx1; Sun, 23 Aug 2020 21:46:49 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 700F3E0A4; Sun, 23 Aug 2020 21:46:49 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07NLkniW073357; Sun, 23 Aug 2020 21:46:49 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NLkmJN073354; Sun, 23 Aug 2020 21:46:48 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008232146.07NLkmJN073354@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Aug 2020 21:46:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364555 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364555 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 21:46:49 -0000 Author: trasz Date: Sun Aug 23 21:46:48 2020 New Revision: 364555 URL: https://svnweb.freebsd.org/changeset/base/364555 Log: MFC r353724 by yuripv: linux: provide just one instance of futex_list Move futex_list definition to linux.c which is included once in linux.ko (i386) and in linux_common.ko (amd64 and aarch64) allowing 32/64 bit linux programs to access the same futexes in the latter case. PR: 240989 Modified: stable/12/sys/compat/linux/linux.c stable/12/sys/compat/linux/linux.h stable/12/sys/compat/linux/linux_futex.c stable/12/sys/compat/linux/linux_futex.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux.c ============================================================================== --- stable/12/sys/compat/linux/linux.c Sun Aug 23 21:44:05 2020 (r364554) +++ stable/12/sys/compat/linux/linux.c Sun Aug 23 21:46:48 2020 (r364555) @@ -43,6 +43,8 @@ __FBSDID("$FreeBSD$"); #include #include +struct futex_list futex_list; + CTASSERT(LINUX_IFNAMSIZ == IFNAMSIZ); static int bsd_to_linux_sigtbl[LINUX_SIGTBLSZ] = { Modified: stable/12/sys/compat/linux/linux.h ============================================================================== --- stable/12/sys/compat/linux/linux.h Sun Aug 23 21:44:05 2020 (r364554) +++ stable/12/sys/compat/linux/linux.h Sun Aug 23 21:46:48 2020 (r364555) @@ -129,4 +129,6 @@ void bsd_to_linux_sigset(sigset_t *, l_sigset_t *); int linux_to_bsd_signal(int sig); int bsd_to_linux_signal(int sig); +extern LIST_HEAD(futex_list, futex) futex_list; + #endif /* _LINUX_MI_H_ */ Modified: stable/12/sys/compat/linux/linux_futex.c ============================================================================== --- stable/12/sys/compat/linux/linux_futex.c Sun Aug 23 21:44:05 2020 (r364554) +++ stable/12/sys/compat/linux/linux_futex.c Sun Aug 23 21:46:48 2020 (r364555) @@ -207,8 +207,6 @@ struct futex { TAILQ_HEAD(lf_waiting_proc, waiting_proc) f_waiting_proc; }; -struct futex_list futex_list; - #define FUTEX_LOCK(f) mtx_lock(&(f)->f_lck) #define FUTEX_LOCKED(f) mtx_owned(&(f)->f_lck) #define FUTEX_UNLOCK(f) mtx_unlock(&(f)->f_lck) Modified: stable/12/sys/compat/linux/linux_futex.h ============================================================================== --- stable/12/sys/compat/linux/linux_futex.h Sun Aug 23 21:44:05 2020 (r364554) +++ stable/12/sys/compat/linux/linux_futex.h Sun Aug 23 21:46:48 2020 (r364555) @@ -38,7 +38,6 @@ #ifndef _LINUX_FUTEX_H #define _LINUX_FUTEX_H -extern LIST_HEAD(futex_list, futex) futex_list; extern struct mtx futex_mtx; #define LINUX_FUTEX_WAIT 0 From owner-svn-src-stable-12@freebsd.org Sun Aug 23 21:48:59 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B1B893CC5D0; Sun, 23 Aug 2020 21:48:59 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZTRH4Gxyz4b4D; Sun, 23 Aug 2020 21:48:59 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 76190DEC7; Sun, 23 Aug 2020 21:48:59 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07NLmxdZ073534; Sun, 23 Aug 2020 21:48:59 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NLmvZj073523; Sun, 23 Aug 2020 21:48:57 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008232148.07NLmvZj073523@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Aug 2020 21:48:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364556 - in stable/12/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in stable/12/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux X-SVN-Commit-Revision: 364556 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 21:48:59 -0000 Author: trasz Date: Sun Aug 23 21:48:57 2020 New Revision: 364556 URL: https://svnweb.freebsd.org/changeset/base/364556 Log: MFC r353725 by yuripv: linux: futex_mtx should follow futex_list Move futex_mtx to linux_common.ko for amd64 and aarch64 along with respective list/mutex init/destroy. PR: 240989 Reported by: Alex S Modified: stable/12/sys/amd64/linux/linux_sysvec.c stable/12/sys/amd64/linux32/linux32_sysvec.c stable/12/sys/arm64/linux/linux_sysvec.c stable/12/sys/compat/linux/linux.c stable/12/sys/compat/linux/linux.h stable/12/sys/compat/linux/linux_common.c stable/12/sys/compat/linux/linux_futex.c stable/12/sys/compat/linux/linux_futex.h stable/12/sys/i386/linux/linux_sysvec.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/linux/linux_sysvec.c ============================================================================== --- stable/12/sys/amd64/linux/linux_sysvec.c Sun Aug 23 21:46:48 2020 (r364555) +++ stable/12/sys/amd64/linux/linux_sysvec.c Sun Aug 23 21:48:57 2020 (r364556) @@ -75,7 +75,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -883,8 +882,6 @@ linux64_elf_modevent(module_t mod, int type, void *dat if (error == 0) { SET_FOREACH(lihp, linux_ioctl_handler_set) linux_ioctl_register_handler(*lihp); - LIST_INIT(&futex_list); - mtx_init(&futex_mtx, "ftllk64", NULL, MTX_DEF); stclohz = (stathz ? stathz : hz); if (bootverbose) printf("Linux x86-64 ELF exec handler installed\n"); @@ -905,7 +902,6 @@ linux64_elf_modevent(module_t mod, int type, void *dat if (error == 0) { SET_FOREACH(lihp, linux_ioctl_handler_set) linux_ioctl_unregister_handler(*lihp); - mtx_destroy(&futex_mtx); if (bootverbose) printf("Linux ELF exec handler removed\n"); } else Modified: stable/12/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- stable/12/sys/amd64/linux32/linux32_sysvec.c Sun Aug 23 21:46:48 2020 (r364555) +++ stable/12/sys/amd64/linux32/linux32_sysvec.c Sun Aug 23 21:48:57 2020 (r364556) @@ -81,7 +81,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -1073,8 +1072,6 @@ linux_elf_modevent(module_t mod, int type, void *data) if (error == 0) { SET_FOREACH(lihp, linux_ioctl_handler_set) linux32_ioctl_register_handler(*lihp); - LIST_INIT(&futex_list); - mtx_init(&futex_mtx, "ftllk", NULL, MTX_DEF); stclohz = (stathz ? stathz : hz); if (bootverbose) printf("Linux ELF exec handler installed\n"); @@ -1095,7 +1092,6 @@ linux_elf_modevent(module_t mod, int type, void *data) if (error == 0) { SET_FOREACH(lihp, linux_ioctl_handler_set) linux32_ioctl_unregister_handler(*lihp); - mtx_destroy(&futex_mtx); if (bootverbose) printf("Linux ELF exec handler removed\n"); } else Modified: stable/12/sys/arm64/linux/linux_sysvec.c ============================================================================== --- stable/12/sys/arm64/linux/linux_sysvec.c Sun Aug 23 21:46:48 2020 (r364555) +++ stable/12/sys/arm64/linux/linux_sysvec.c Sun Aug 23 21:48:57 2020 (r364556) @@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -503,8 +502,6 @@ linux64_elf_modevent(module_t mod, int type, void *dat if (error == 0) { SET_FOREACH(lihp, linux_ioctl_handler_set) linux_ioctl_register_handler(*lihp); - LIST_INIT(&futex_list); - mtx_init(&futex_mtx, "ftllk64", NULL, MTX_DEF); stclohz = (stathz ? stathz : hz); if (bootverbose) printf("Linux arm64 ELF exec handler installed\n"); @@ -524,7 +521,6 @@ linux64_elf_modevent(module_t mod, int type, void *dat if (error == 0) { SET_FOREACH(lihp, linux_ioctl_handler_set) linux_ioctl_unregister_handler(*lihp); - mtx_destroy(&futex_mtx); if (bootverbose) printf("Linux ELF exec handler removed\n"); } else Modified: stable/12/sys/compat/linux/linux.c ============================================================================== --- stable/12/sys/compat/linux/linux.c Sun Aug 23 21:46:48 2020 (r364555) +++ stable/12/sys/compat/linux/linux.c Sun Aug 23 21:48:57 2020 (r364556) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include struct futex_list futex_list; +struct mtx futex_mtx; /* protects the futex list */ CTASSERT(LINUX_IFNAMSIZ == IFNAMSIZ); Modified: stable/12/sys/compat/linux/linux.h ============================================================================== --- stable/12/sys/compat/linux/linux.h Sun Aug 23 21:46:48 2020 (r364555) +++ stable/12/sys/compat/linux/linux.h Sun Aug 23 21:48:57 2020 (r364556) @@ -130,5 +130,6 @@ int linux_to_bsd_signal(int sig); int bsd_to_linux_signal(int sig); extern LIST_HEAD(futex_list, futex) futex_list; +extern struct mtx futex_mtx; #endif /* _LINUX_MI_H_ */ Modified: stable/12/sys/compat/linux/linux_common.c ============================================================================== --- stable/12/sys/compat/linux/linux_common.c Sun Aug 23 21:46:48 2020 (r364555) +++ stable/12/sys/compat/linux/linux_common.c Sun Aug 23 21:48:57 2020 (r364556) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -76,11 +77,14 @@ linux_common_modevent(module_t mod, int type, void *da linux_thread_dtor, NULL, EVENTHANDLER_PRI_ANY); SET_FOREACH(ldhp, linux_device_handler_set) linux_device_register_handler(*ldhp); + LIST_INIT(&futex_list); + mtx_init(&futex_mtx, "ftllk", NULL, MTX_DEF); break; case MOD_UNLOAD: linux_osd_jail_deregister(); SET_FOREACH(ldhp, linux_device_handler_set) linux_device_unregister_handler(*ldhp); + mtx_destroy(&futex_mtx); EVENTHANDLER_DEREGISTER(process_exit, linux_exit_tag); EVENTHANDLER_DEREGISTER(process_exec, linux_exec_tag); EVENTHANDLER_DEREGISTER(thread_dtor, linux_thread_dtor_tag); Modified: stable/12/sys/compat/linux/linux_futex.c ============================================================================== --- stable/12/sys/compat/linux/linux_futex.c Sun Aug 23 21:46:48 2020 (r364555) +++ stable/12/sys/compat/linux/linux_futex.c Sun Aug 23 21:48:57 2020 (r364556) @@ -224,7 +224,6 @@ struct futex { #define FUTEX_ASSERT_LOCKED(f) mtx_assert(&(f)->f_lck, MA_OWNED) #define FUTEX_ASSERT_UNLOCKED(f) mtx_assert(&(f)->f_lck, MA_NOTOWNED) -struct mtx futex_mtx; /* protects the futex list */ #define FUTEXES_LOCK do { \ mtx_lock(&futex_mtx); \ LIN_SDT_PROBE1(locks, futex_mtx, \ Modified: stable/12/sys/compat/linux/linux_futex.h ============================================================================== --- stable/12/sys/compat/linux/linux_futex.h Sun Aug 23 21:46:48 2020 (r364555) +++ stable/12/sys/compat/linux/linux_futex.h Sun Aug 23 21:48:57 2020 (r364556) @@ -38,8 +38,6 @@ #ifndef _LINUX_FUTEX_H #define _LINUX_FUTEX_H -extern struct mtx futex_mtx; - #define LINUX_FUTEX_WAIT 0 #define LINUX_FUTEX_WAKE 1 #define LINUX_FUTEX_FD 2 /* unused */ Modified: stable/12/sys/i386/linux/linux_sysvec.c ============================================================================== --- stable/12/sys/i386/linux/linux_sysvec.c Sun Aug 23 21:46:48 2020 (r364555) +++ stable/12/sys/i386/linux/linux_sysvec.c Sun Aug 23 21:48:57 2020 (r364556) @@ -67,7 +67,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include From owner-svn-src-stable-12@freebsd.org Sun Aug 23 21:52:54 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BBBA53CC85C; Sun, 23 Aug 2020 21:52: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZTWp4Xvvz4bV5; Sun, 23 Aug 2020 21:52: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 7F6D6E158; Sun, 23 Aug 2020 21:52: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 07NLqs2Z079205; Sun, 23 Aug 2020 21:52:54 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NLqsTA079204; Sun, 23 Aug 2020 21:52:54 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232152.07NLqsTA079204@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 21:52:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364557 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364557 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 21:52:54 -0000 Author: tuexen Date: Sun Aug 23 21:52:54 2020 New Revision: 364557 URL: https://svnweb.freebsd.org/changeset/base/364557 Log: MFC r359048: Handle the timers in a consistent sequence according to the definition of the timer type. Just a cleanup, no functional change intended. Modified: stable/12/sys/netinet/sctputil.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctputil.c ============================================================================== --- stable/12/sys/netinet/sctputil.c Sun Aug 23 21:48:57 2020 (r364556) +++ stable/12/sys/netinet/sctputil.c Sun Aug 23 21:52:54 2020 (r364557) @@ -1733,9 +1733,6 @@ sctp_timeout_handler(void *t) /* call the handler for the appropriate timer type */ switch (type) { - case SCTP_TIMER_TYPE_ADDR_WQ: - sctp_handle_addr_wq(); - break; case SCTP_TIMER_TYPE_SEND: if ((stcb == NULL) || (inp == NULL)) { break; @@ -1900,28 +1897,6 @@ sctp_timeout_handler(void *t) #endif sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_SHUT_ACK_TMR, SCTP_SO_NOT_LOCKED); break; - case SCTP_TIMER_TYPE_SHUTDOWNGUARD: - if ((stcb == NULL) || (inp == NULL)) { - break; - } - SCTP_STAT_INCR(sctps_timoshutdownguard); - op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), - "Shutdown guard timer expired"); - sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); - /* no need to unlock on tcb its gone */ - goto out_decr; - - case SCTP_TIMER_TYPE_STRRESET: - if ((stcb == NULL) || (inp == NULL)) { - break; - } - if (sctp_strreset_timer(inp, stcb, net)) { - /* no need to unlock on tcb its gone */ - goto out_decr; - } - SCTP_STAT_INCR(sctps_timostrmrst); - sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_STRRST_TMR, SCTP_SO_NOT_LOCKED); - break; case SCTP_TIMER_TYPE_ASCONF: if ((stcb == NULL) || (inp == NULL)) { break; @@ -1936,13 +1911,16 @@ sctp_timeout_handler(void *t) #endif sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_ASCONF_TMR, SCTP_SO_NOT_LOCKED); break; - case SCTP_TIMER_TYPE_PRIM_DELETED: + case SCTP_TIMER_TYPE_SHUTDOWNGUARD: if ((stcb == NULL) || (inp == NULL)) { break; } - sctp_delete_prim_timer(inp, stcb, net); - SCTP_STAT_INCR(sctps_timodelprim); - break; + SCTP_STAT_INCR(sctps_timoshutdownguard); + op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), + "Shutdown guard timer expired"); + sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); + /* no need to unlock on tcb its gone */ + goto out_decr; case SCTP_TIMER_TYPE_AUTOCLOSE: if ((stcb == NULL) || (inp == NULL)) { @@ -1953,6 +1931,33 @@ sctp_timeout_handler(void *t) sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_AUTOCLOSE_TMR, SCTP_SO_NOT_LOCKED); did_output = 0; break; + case SCTP_TIMER_TYPE_STRRESET: + if ((stcb == NULL) || (inp == NULL)) { + break; + } + if (sctp_strreset_timer(inp, stcb, net)) { + /* no need to unlock on tcb its gone */ + goto out_decr; + } + SCTP_STAT_INCR(sctps_timostrmrst); + sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_STRRST_TMR, SCTP_SO_NOT_LOCKED); + break; + case SCTP_TIMER_TYPE_INPKILL: + SCTP_STAT_INCR(sctps_timoinpkill); + if (inp == NULL) { + break; + } + /* + * special case, take away our increment since WE are the + * killer + */ + SCTP_INP_DECR_REF(inp); + sctp_timer_stop(SCTP_TIMER_TYPE_INPKILL, inp, NULL, NULL, + SCTP_FROM_SCTPUTIL + SCTP_LOC_3); + sctp_inpcb_free(inp, SCTP_FREE_SHOULD_USE_ABORT, + SCTP_CALLED_FROM_INPKILL_TIMER); + inp = NULL; + goto out_no_decr; case SCTP_TIMER_TYPE_ASOCKILL: if ((stcb == NULL) || (inp == NULL)) { break; @@ -1981,22 +1986,16 @@ sctp_timeout_handler(void *t) */ stcb = NULL; goto out_no_decr; - case SCTP_TIMER_TYPE_INPKILL: - SCTP_STAT_INCR(sctps_timoinpkill); - if (inp == NULL) { + case SCTP_TIMER_TYPE_ADDR_WQ: + sctp_handle_addr_wq(); + break; + case SCTP_TIMER_TYPE_PRIM_DELETED: + if ((stcb == NULL) || (inp == NULL)) { break; } - /* - * special case, take away our increment since WE are the - * killer - */ - SCTP_INP_DECR_REF(inp); - sctp_timer_stop(SCTP_TIMER_TYPE_INPKILL, inp, NULL, NULL, - SCTP_FROM_SCTPUTIL + SCTP_LOC_3); - sctp_inpcb_free(inp, SCTP_FREE_SHOULD_USE_ABORT, - SCTP_CALLED_FROM_INPKILL_TIMER); - inp = NULL; - goto out_no_decr; + sctp_delete_prim_timer(inp, stcb, net); + SCTP_STAT_INCR(sctps_timodelprim); + break; default: SCTPDBG(SCTP_DEBUG_TIMER1, "sctp_timeout_handler:unknown timer %d\n", type); @@ -2055,11 +2054,6 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s return; } switch (t_type) { - case SCTP_TIMER_TYPE_ADDR_WQ: - /* Only 1 tick away :-) */ - tmr = &SCTP_BASE_INFO(addr_wq_timer); - to_ticks = SCTP_ADDRESS_TICK_DELAY; - break; case SCTP_TIMER_TYPE_SEND: /* Here we use the RTO timer */ { @@ -2179,22 +2173,6 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s tmr = &inp->sctp_ep.signature_change; to_ticks = inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_SIGNATURE]; break; - case SCTP_TIMER_TYPE_ASOCKILL: - if (stcb == NULL) { - return; - } - tmr = &stcb->asoc.strreset_timer; - to_ticks = MSEC_TO_TICKS(SCTP_ASOC_KILL_TIMEOUT); - break; - case SCTP_TIMER_TYPE_INPKILL: - /* - * The inp is setup to die. We re-use the signature_chage - * timer since that has stopped and we are in the GONE - * state. - */ - tmr = &inp->sctp_ep.signature_change; - to_ticks = MSEC_TO_TICKS(SCTP_INP_KILL_TIMEOUT); - break; case SCTP_TIMER_TYPE_PATHMTURAISE: /* * Here we use the value found in the EP for PMTU ususually @@ -2221,6 +2199,21 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s } tmr = &net->rxt_timer; break; + case SCTP_TIMER_TYPE_ASCONF: + /* + * Here the timer comes from the stcb but its value is from + * the net's RTO. + */ + if ((stcb == NULL) || (net == NULL)) { + return; + } + if (net->RTO == 0) { + to_ticks = MSEC_TO_TICKS(stcb->asoc.initial_rto); + } else { + to_ticks = MSEC_TO_TICKS(net->RTO); + } + tmr = &stcb->asoc.asconf_timer; + break; case SCTP_TIMER_TYPE_SHUTDOWNGUARD: /* * Here we use the endpoints shutdown guard timer usually @@ -2236,6 +2229,20 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s } tmr = &stcb->asoc.shut_guard_timer; break; + case SCTP_TIMER_TYPE_AUTOCLOSE: + if (stcb == NULL) { + return; + } + if (stcb->asoc.sctp_autoclose_ticks == 0) { + /* + * Really an error since stcb is NOT set to + * autoclose + */ + return; + } + to_ticks = stcb->asoc.sctp_autoclose_ticks; + tmr = &stcb->asoc.autoclose_timer; + break; case SCTP_TIMER_TYPE_STRRESET: /* * Here the timer comes from the stcb but its value is from @@ -2251,21 +2258,27 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s } tmr = &stcb->asoc.strreset_timer; break; - case SCTP_TIMER_TYPE_ASCONF: + case SCTP_TIMER_TYPE_INPKILL: /* - * Here the timer comes from the stcb but its value is from - * the net's RTO. + * The inp is setup to die. We re-use the signature_chage + * timer since that has stopped and we are in the GONE + * state. */ - if ((stcb == NULL) || (net == NULL)) { + tmr = &inp->sctp_ep.signature_change; + to_ticks = MSEC_TO_TICKS(SCTP_INP_KILL_TIMEOUT); + break; + case SCTP_TIMER_TYPE_ASOCKILL: + if (stcb == NULL) { return; } - if (net->RTO == 0) { - to_ticks = MSEC_TO_TICKS(stcb->asoc.initial_rto); - } else { - to_ticks = MSEC_TO_TICKS(net->RTO); - } - tmr = &stcb->asoc.asconf_timer; + tmr = &stcb->asoc.strreset_timer; + to_ticks = MSEC_TO_TICKS(SCTP_ASOC_KILL_TIMEOUT); break; + case SCTP_TIMER_TYPE_ADDR_WQ: + /* Only 1 tick away :-) */ + tmr = &SCTP_BASE_INFO(addr_wq_timer); + to_ticks = SCTP_ADDRESS_TICK_DELAY; + break; case SCTP_TIMER_TYPE_PRIM_DELETED: if ((stcb == NULL) || (net != NULL)) { return; @@ -2273,20 +2286,6 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s to_ticks = MSEC_TO_TICKS(stcb->asoc.initial_rto); tmr = &stcb->asoc.delete_prim_timer; break; - case SCTP_TIMER_TYPE_AUTOCLOSE: - if (stcb == NULL) { - return; - } - if (stcb->asoc.sctp_autoclose_ticks == 0) { - /* - * Really an error since stcb is NOT set to - * autoclose - */ - return; - } - to_ticks = stcb->asoc.sctp_autoclose_ticks; - tmr = &stcb->asoc.autoclose_timer; - break; default: SCTPDBG(SCTP_DEBUG_TIMER1, "%s: Unknown timer type %d\n", __func__, t_type); @@ -2336,9 +2335,6 @@ sctp_timer_stop(int t_type, struct sctp_inpcb *inp, st SCTP_TCB_LOCK_ASSERT(stcb); } switch (t_type) { - case SCTP_TIMER_TYPE_ADDR_WQ: - tmr = &SCTP_BASE_INFO(addr_wq_timer); - break; case SCTP_TIMER_TYPE_SEND: if ((stcb == NULL) || (net == NULL)) { return; @@ -2383,24 +2379,6 @@ sctp_timer_stop(int t_type, struct sctp_inpcb *inp, st * must assure that we do not kill it by accident. */ break; - case SCTP_TIMER_TYPE_ASOCKILL: - /* - * Stop the asoc kill timer. - */ - if (stcb == NULL) { - return; - } - tmr = &stcb->asoc.strreset_timer; - break; - - case SCTP_TIMER_TYPE_INPKILL: - /* - * The inp is setup to die. We re-use the signature_chage - * timer since that has stopped and we are in the GONE - * state. - */ - tmr = &inp->sctp_ep.signature_change; - break; case SCTP_TIMER_TYPE_PATHMTURAISE: if ((stcb == NULL) || (net == NULL)) { return; @@ -2413,35 +2391,55 @@ sctp_timer_stop(int t_type, struct sctp_inpcb *inp, st } tmr = &net->rxt_timer; break; + case SCTP_TIMER_TYPE_ASCONF: + if (stcb == NULL) { + return; + } + tmr = &stcb->asoc.asconf_timer; + break; case SCTP_TIMER_TYPE_SHUTDOWNGUARD: if (stcb == NULL) { return; } tmr = &stcb->asoc.shut_guard_timer; break; - case SCTP_TIMER_TYPE_STRRESET: + case SCTP_TIMER_TYPE_AUTOCLOSE: if (stcb == NULL) { return; } - tmr = &stcb->asoc.strreset_timer; + tmr = &stcb->asoc.autoclose_timer; break; - case SCTP_TIMER_TYPE_ASCONF: + case SCTP_TIMER_TYPE_STRRESET: if (stcb == NULL) { return; } - tmr = &stcb->asoc.asconf_timer; + tmr = &stcb->asoc.strreset_timer; break; - case SCTP_TIMER_TYPE_PRIM_DELETED: + case SCTP_TIMER_TYPE_INPKILL: + /* + * The inp is setup to die. We re-use the signature_chage + * timer since that has stopped and we are in the GONE + * state. + */ + tmr = &inp->sctp_ep.signature_change; + break; + case SCTP_TIMER_TYPE_ASOCKILL: + /* + * Stop the asoc kill timer. + */ if (stcb == NULL) { return; } - tmr = &stcb->asoc.delete_prim_timer; + tmr = &stcb->asoc.strreset_timer; break; - case SCTP_TIMER_TYPE_AUTOCLOSE: + case SCTP_TIMER_TYPE_ADDR_WQ: + tmr = &SCTP_BASE_INFO(addr_wq_timer); + break; + case SCTP_TIMER_TYPE_PRIM_DELETED: if (stcb == NULL) { return; } - tmr = &stcb->asoc.autoclose_timer; + tmr = &stcb->asoc.delete_prim_timer; break; default: SCTPDBG(SCTP_DEBUG_TIMER1, "%s: Unknown timer type %d\n", From owner-svn-src-stable-12@freebsd.org Sun Aug 23 21:55:35 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0FC943CC8C9; Sun, 23 Aug 2020 21:55: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZTZt6dKMz4bjj; Sun, 23 Aug 2020 21:55: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 C3C44DDFC; Sun, 23 Aug 2020 21:55: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 07NLtYA9079428; Sun, 23 Aug 2020 21:55:34 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NLtYns079427; Sun, 23 Aug 2020 21:55:34 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232155.07NLtYns079427@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 21:55:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364558 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364558 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 21:55:35 -0000 Author: tuexen Date: Sun Aug 23 21:55:34 2020 New Revision: 364558 URL: https://svnweb.freebsd.org/changeset/base/364558 Log: MFC r359131: The MTU candidates MUST be a multiple of 4, so make them so. Modified: stable/12/sys/netinet/sctputil.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctputil.c ============================================================================== --- stable/12/sys/netinet/sctputil.c Sun Aug 23 21:52:54 2020 (r364557) +++ stable/12/sys/netinet/sctputil.c Sun Aug 23 21:55:34 2020 (r364558) @@ -862,7 +862,7 @@ static uint32_t sctp_mtu_sizes[] = { 2048, 4352, 4464, - 8166, + 8168, 17912, 32000, 65532 From owner-svn-src-stable-12@freebsd.org Sun Aug 23 21:57:25 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 824933CCAB8; Sun, 23 Aug 2020 21:57:25 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZTd12Ymvz4bqS; Sun, 23 Aug 2020 21:57: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 3B379E265; Sun, 23 Aug 2020 21:57: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 07NLvPNa079568; Sun, 23 Aug 2020 21:57:25 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NLvOKi079565; Sun, 23 Aug 2020 21:57:24 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232157.07NLvOKi079565@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 21:57:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364559 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364559 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 21:57:25 -0000 Author: tuexen Date: Sun Aug 23 21:57:24 2020 New Revision: 364559 URL: https://svnweb.freebsd.org/changeset/base/364559 Log: MFC r359151:: Cleanup the stream reset and asconf timer. Modified: stable/12/sys/netinet/sctp_timer.c stable/12/sys/netinet/sctp_timer.h stable/12/sys/netinet/sctputil.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_timer.c ============================================================================== --- stable/12/sys/netinet/sctp_timer.c Sun Aug 23 21:55:34 2020 (r364558) +++ stable/12/sys/netinet/sctp_timer.c Sun Aug 23 21:57:24 2020 (r364559) @@ -1103,10 +1103,9 @@ sctp_cookie_timer(struct sctp_inpcb *inp, } int -sctp_strreset_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb, - struct sctp_nets *net) +sctp_strreset_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb) { - struct sctp_nets *alt; + struct sctp_nets *alt, *net; struct sctp_tmit_chunk *strrst = NULL, *chk = NULL; if (stcb->asoc.stream_reset_outstanding == 0) { @@ -1117,9 +1116,9 @@ sctp_strreset_timer(struct sctp_inpcb *inp, struct sct if (strrst == NULL) { return (0); } + net = strrst->whoTo; /* do threshold management */ - if (sctp_threshold_management(inp, stcb, strrst->whoTo, - stcb->asoc.max_send_times)) { + if (sctp_threshold_management(inp, stcb, net, stcb->asoc.max_send_times)) { /* Assoc is over */ return (1); } @@ -1127,9 +1126,8 @@ sctp_strreset_timer(struct sctp_inpcb *inp, struct sct * Cleared threshold management, now lets backoff the address and * select an alternate */ - sctp_backoff_on_timeout(stcb, strrst->whoTo, 1, 0, 0); - alt = sctp_find_alternate_net(stcb, strrst->whoTo, 0); - sctp_free_remote_addr(strrst->whoTo); + sctp_backoff_on_timeout(stcb, net, 1, 0, 0); + alt = sctp_find_alternate_net(stcb, net, 0); strrst->whoTo = alt; atomic_add_int(&alt->ref_count, 1); @@ -1154,6 +1152,8 @@ sctp_strreset_timer(struct sctp_inpcb *inp, struct sct */ sctp_move_chunks_from_net(stcb, net); } + sctp_free_remote_addr(net); + /* mark the retran info */ if (strrst->sent != SCTP_DATAGRAM_RESEND) sctp_ucount_incr(stcb->asoc.sent_queue_retran_cnt); @@ -1161,7 +1161,7 @@ sctp_strreset_timer(struct sctp_inpcb *inp, struct sct strrst->flags |= CHUNK_FLAGS_FRAGMENT_OK; /* restart the timer */ - sctp_timer_start(SCTP_TIMER_TYPE_STRRESET, inp, stcb, strrst->whoTo); + sctp_timer_start(SCTP_TIMER_TYPE_STRRESET, inp, stcb, alt); return (0); } @@ -1186,8 +1186,9 @@ sctp_asconf_timer(struct sctp_inpcb *inp, struct sctp_ if (asconf == NULL) { return (0); } + net = asconf->whoTo; /* do threshold management */ - if (sctp_threshold_management(inp, stcb, asconf->whoTo, + if (sctp_threshold_management(inp, stcb, net, stcb->asoc.max_send_times)) { /* Assoc is over */ return (1); @@ -1208,10 +1209,9 @@ sctp_asconf_timer(struct sctp_inpcb *inp, struct sctp_ * cleared threshold management, so now backoff the net and * select an alternate */ - sctp_backoff_on_timeout(stcb, asconf->whoTo, 1, 0, 0); - alt = sctp_find_alternate_net(stcb, asconf->whoTo, 0); + sctp_backoff_on_timeout(stcb, net, 1, 0, 0); + alt = sctp_find_alternate_net(stcb, net, 0); if (asconf->whoTo != alt) { - sctp_free_remote_addr(asconf->whoTo); asconf->whoTo = alt; atomic_add_int(&alt->ref_count, 1); } @@ -1248,6 +1248,8 @@ sctp_asconf_timer(struct sctp_inpcb *inp, struct sctp_ */ sctp_move_chunks_from_net(stcb, net); } + sctp_free_remote_addr(net); + /* mark the retran info */ if (asconf->sent != SCTP_DATAGRAM_RESEND) sctp_ucount_incr(stcb->asoc.sent_queue_retran_cnt); Modified: stable/12/sys/netinet/sctp_timer.h ============================================================================== --- stable/12/sys/netinet/sctp_timer.h Sun Aug 23 21:55:34 2020 (r364558) +++ stable/12/sys/netinet/sctp_timer.h Sun Aug 23 21:57:24 2020 (r364559) @@ -50,12 +50,15 @@ sctp_find_alternate_net(struct sctp_tcb *, int sctp_t3rxt_timer(struct sctp_inpcb *, struct sctp_tcb *, struct sctp_nets *); + int sctp_t1init_timer(struct sctp_inpcb *, struct sctp_tcb *, struct sctp_nets *); + int sctp_shutdown_timer(struct sctp_inpcb *, struct sctp_tcb *, struct sctp_nets *); + int sctp_heartbeat_timer(struct sctp_inpcb *, struct sctp_tcb *, struct sctp_nets *); @@ -72,8 +75,7 @@ int sctp_shutdownack_timer(struct sctp_inpcb *, struct sctp_tcb *, struct sctp_nets *); int -sctp_strreset_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb, - struct sctp_nets *net); + sctp_strreset_timer(struct sctp_inpcb *, struct sctp_tcb *); int sctp_asconf_timer(struct sctp_inpcb *, struct sctp_tcb *, Modified: stable/12/sys/netinet/sctputil.c ============================================================================== --- stable/12/sys/netinet/sctputil.c Sun Aug 23 21:55:34 2020 (r364558) +++ stable/12/sys/netinet/sctputil.c Sun Aug 23 21:57:24 2020 (r364559) @@ -1935,7 +1935,7 @@ sctp_timeout_handler(void *t) if ((stcb == NULL) || (inp == NULL)) { break; } - if (sctp_strreset_timer(inp, stcb, net)) { + if (sctp_strreset_timer(inp, stcb)) { /* no need to unlock on tcb its gone */ goto out_decr; } From owner-svn-src-stable-12@freebsd.org Sun Aug 23 21:59:26 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 035AF3CC9DC; Sun, 23 Aug 2020 21:59: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZTgK6DSsz4brF; Sun, 23 Aug 2020 21:59: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 B9447DFD5; Sun, 23 Aug 2020 21:59: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 07NLxPsU079743; Sun, 23 Aug 2020 21:59:25 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NLxNP1079732; Sun, 23 Aug 2020 21:59:23 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232159.07NLxNP1079732@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 21:59:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364560 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364560 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 21:59:26 -0000 Author: tuexen Date: Sun Aug 23 21:59:23 2020 New Revision: 364560 URL: https://svnweb.freebsd.org/changeset/base/364560 Log: MFC r359152: Consistently provide arguments for timer start and stop routines. This is another step in cleaning up timer handling. Modified: stable/12/sys/netinet/sctp_asconf.c stable/12/sys/netinet/sctp_asconf.h stable/12/sys/netinet/sctp_indata.c stable/12/sys/netinet/sctp_input.c stable/12/sys/netinet/sctp_output.c stable/12/sys/netinet/sctp_pcb.c stable/12/sys/netinet/sctp_timer.c stable/12/sys/netinet/sctp_usrreq.c stable/12/sys/netinet/sctputil.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_asconf.c ============================================================================== --- stable/12/sys/netinet/sctp_asconf.c Sun Aug 23 21:57:24 2020 (r364559) +++ stable/12/sys/netinet/sctp_asconf.c Sun Aug 23 21:59:23 2020 (r364560) @@ -939,12 +939,12 @@ sctp_addr_match(struct sctp_paramhdr *ph, struct socka * Cleanup for non-responded/OP ERR'd ASCONF */ void -sctp_asconf_cleanup(struct sctp_tcb *stcb, struct sctp_nets *net) +sctp_asconf_cleanup(struct sctp_tcb *stcb) { /* * clear out any existing asconfs going out */ - sctp_timer_stop(SCTP_TIMER_TYPE_ASCONF, stcb->sctp_ep, stcb, net, + sctp_timer_stop(SCTP_TIMER_TYPE_ASCONF, stcb->sctp_ep, stcb, NULL, SCTP_FROM_SCTP_ASCONF + SCTP_LOC_2); stcb->asoc.asconf_seq_out_acked = stcb->asoc.asconf_seq_out; /* remove the old ASCONF on our outbound queue */ @@ -1725,7 +1725,7 @@ sctp_handle_asconf_ack(struct mbuf *m, int offset, if (serial_num == asoc->asconf_seq_out - 1) { /* stop our timer */ - sctp_timer_stop(SCTP_TIMER_TYPE_ASCONF, stcb->sctp_ep, stcb, net, + sctp_timer_stop(SCTP_TIMER_TYPE_ASCONF, stcb->sctp_ep, stcb, NULL, SCTP_FROM_SCTP_ASCONF + SCTP_LOC_5); } Modified: stable/12/sys/netinet/sctp_asconf.h ============================================================================== --- stable/12/sys/netinet/sctp_asconf.h Sun Aug 23 21:57:24 2020 (r364559) +++ stable/12/sys/netinet/sctp_asconf.h Sun Aug 23 21:59:23 2020 (r364560) @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$"); /* * function prototypes */ -extern void sctp_asconf_cleanup(struct sctp_tcb *, struct sctp_nets *); +extern void sctp_asconf_cleanup(struct sctp_tcb *); extern struct mbuf *sctp_compose_asconf(struct sctp_tcb *, int *, int); Modified: stable/12/sys/netinet/sctp_indata.c ============================================================================== --- stable/12/sys/netinet/sctp_indata.c Sun Aug 23 21:57:24 2020 (r364559) +++ stable/12/sys/netinet/sctp_indata.c Sun Aug 23 21:59:23 2020 (r364560) @@ -4392,7 +4392,7 @@ again: sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN, stcb->sctp_ep, stcb, netp); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, - stcb->sctp_ep, stcb, netp); + stcb->sctp_ep, stcb, NULL); } else if ((SCTP_GET_STATE(stcb) == SCTP_STATE_SHUTDOWN_RECEIVED) && (asoc->stream_queue_cnt == 0)) { struct sctp_nets *netp; @@ -5087,7 +5087,7 @@ hopeless_peer: sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN, stcb->sctp_ep, stcb, netp); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, - stcb->sctp_ep, stcb, netp); + stcb->sctp_ep, stcb, NULL); return; } else if ((SCTP_GET_STATE(stcb) == SCTP_STATE_SHUTDOWN_RECEIVED) && (asoc->stream_queue_cnt == 0)) { Modified: stable/12/sys/netinet/sctp_input.c ============================================================================== --- stable/12/sys/netinet/sctp_input.c Sun Aug 23 21:57:24 2020 (r364559) +++ stable/12/sys/netinet/sctp_input.c Sun Aug 23 21:59:23 2020 (r364560) @@ -826,7 +826,7 @@ sctp_handle_abort(struct sctp_abort_chunk *abort, error = 0; } /* stop any receive timers */ - sctp_timer_stop(SCTP_TIMER_TYPE_RECV, stcb->sctp_ep, stcb, net, + sctp_timer_stop(SCTP_TIMER_TYPE_RECV, stcb->sctp_ep, stcb, NULL, SCTP_FROM_SCTP_INPUT + SCTP_LOC_7); /* notify user of the abort and clean up... */ sctp_abort_notification(stcb, 1, error, abort, SCTP_SO_NOT_LOCKED); @@ -1110,13 +1110,12 @@ sctp_handle_shutdown_ack(struct sctp_shutdown_ack_chun } static void -sctp_process_unrecog_chunk(struct sctp_tcb *stcb, uint8_t chunk_type, - struct sctp_nets *net) +sctp_process_unrecog_chunk(struct sctp_tcb *stcb, uint8_t chunk_type) { switch (chunk_type) { case SCTP_ASCONF_ACK: case SCTP_ASCONF: - sctp_asconf_cleanup(stcb, net); + sctp_asconf_cleanup(stcb); break; case SCTP_IFORWARD_CUM_TSN: case SCTP_FORWARD_CUM_TSN: @@ -1294,7 +1293,7 @@ sctp_handle_error(struct sctp_chunkhdr *ch, 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); + sctp_process_unrecog_chunk(stcb, unrec_chunk->ch.chunk_type); } break; case SCTP_CAUSE_UNRECOG_PARAM: @@ -1643,7 +1642,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphle SCTP_SET_STATE(stcb, SCTP_STATE_OPEN); if (asoc->state & SCTP_STATE_SHUTDOWN_PENDING) { sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, - stcb->sctp_ep, stcb, asoc->primary_destination); + stcb->sctp_ep, stcb, NULL); } SCTP_STAT_INCR_GAUGE32(sctps_currestab); sctp_stop_all_cookie_timers(stcb); @@ -1886,7 +1885,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphle SCTP_SET_STATE(stcb, SCTP_STATE_OPEN); if (asoc->state & SCTP_STATE_SHUTDOWN_PENDING) { sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, - stcb->sctp_ep, stcb, asoc->primary_destination); + stcb->sctp_ep, stcb, NULL); } sctp_stop_all_cookie_timers(stcb); sctp_toss_old_cookies(stcb, asoc); @@ -1956,7 +1955,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphle if (asoc->state & SCTP_STATE_SHUTDOWN_PENDING) { SCTP_SET_STATE(stcb, SCTP_STATE_OPEN); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, - stcb->sctp_ep, stcb, asoc->primary_destination); + stcb->sctp_ep, stcb, NULL); } else if (SCTP_GET_STATE(stcb) != SCTP_STATE_SHUTDOWN_SENT) { /* move to OPEN state, if not in SHUTDOWN_SENT */ @@ -2352,7 +2351,7 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, in SCTP_SET_STATE(stcb, SCTP_STATE_OPEN); if (asoc->state & SCTP_STATE_SHUTDOWN_PENDING) { sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, - stcb->sctp_ep, stcb, asoc->primary_destination); + stcb->sctp_ep, stcb, NULL); } sctp_stop_all_cookie_timers(stcb); SCTP_STAT_INCR_COUNTER32(sctps_passiveestab); @@ -2980,7 +2979,7 @@ sctp_handle_cookie_ack(struct sctp_cookie_ack_chunk *c sctp_start_net_timers(stcb); if (asoc->state & SCTP_STATE_SHUTDOWN_PENDING) { sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, - stcb->sctp_ep, stcb, asoc->primary_destination); + stcb->sctp_ep, stcb, NULL); } /* update RTO */ @@ -3660,7 +3659,7 @@ sctp_clean_up_stream_reset(struct sctp_tcb *stcb) } asoc->str_reset = NULL; sctp_timer_stop(SCTP_TIMER_TYPE_STRRESET, stcb->sctp_ep, stcb, - chk->whoTo, SCTP_FROM_SCTP_INPUT + SCTP_LOC_28); + NULL, SCTP_FROM_SCTP_INPUT + SCTP_LOC_28); TAILQ_REMOVE(&asoc->control_send_queue, chk, sctp_next); asoc->ctrl_queue_cnt--; if (chk->data) { Modified: stable/12/sys/netinet/sctp_output.c ============================================================================== --- stable/12/sys/netinet/sctp_output.c Sun Aug 23 21:57:24 2020 (r364559) +++ stable/12/sys/netinet/sctp_output.c Sun Aug 23 21:59:23 2020 (r364560) @@ -6735,7 +6735,7 @@ sctp_sendall_iterator(struct sctp_inpcb *inp, struct s sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN, stcb->sctp_ep, stcb, net); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, stcb->sctp_ep, stcb, - asoc->primary_destination); + NULL); added_control = 1; do_chunk_output = 0; } @@ -6775,7 +6775,7 @@ sctp_sendall_iterator(struct sctp_inpcb *inp, struct s goto no_chunk_output; } sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, stcb->sctp_ep, stcb, - asoc->primary_destination); + NULL); } } @@ -8447,7 +8447,7 @@ again_one_more_time: /* turn off the timer */ if (SCTP_OS_TIMER_PENDING(&stcb->asoc.dack_timer.timer)) { sctp_timer_stop(SCTP_TIMER_TYPE_RECV, - inp, stcb, net, + inp, stcb, NULL, SCTP_FROM_SCTP_OUTPUT + SCTP_LOC_1); } } @@ -13570,7 +13570,7 @@ dataless_eof: sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN, stcb->sctp_ep, stcb, netp); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, stcb->sctp_ep, stcb, - asoc->primary_destination); + NULL); } } else { /*- @@ -13620,7 +13620,7 @@ dataless_eof: goto out; } sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, stcb->sctp_ep, stcb, - asoc->primary_destination); + NULL); sctp_feature_off(inp, SCTP_PCB_FLAGS_NODELAY); } } Modified: stable/12/sys/netinet/sctp_pcb.c ============================================================================== --- stable/12/sys/netinet/sctp_pcb.c Sun Aug 23 21:57:24 2020 (r364559) +++ stable/12/sys/netinet/sctp_pcb.c Sun Aug 23 21:59:23 2020 (r364560) @@ -3441,15 +3441,13 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, sctp_send_shutdown(asoc, netp); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN, asoc->sctp_ep, asoc, netp); - sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, asoc->sctp_ep, asoc, - asoc->asoc.primary_destination); + sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, asoc->sctp_ep, asoc, NULL); sctp_chunk_output(inp, asoc, SCTP_OUTPUT_FROM_SHUT_TMR, SCTP_SO_LOCKED); } } else { /* mark into shutdown pending */ SCTP_ADD_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); - sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, asoc->sctp_ep, asoc, - asoc->asoc.primary_destination); + sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, asoc->sctp_ep, asoc, NULL); if ((*asoc->asoc.ss_functions.sctp_ss_is_user_msgs_incomplete) (asoc, &asoc->asoc)) { SCTP_ADD_SUBSTATE(asoc, SCTP_STATE_PARTIAL_MSG_LEFT); } Modified: stable/12/sys/netinet/sctp_timer.c ============================================================================== --- stable/12/sys/netinet/sctp_timer.c Sun Aug 23 21:57:24 2020 (r364559) +++ stable/12/sys/netinet/sctp_timer.c Sun Aug 23 21:59:23 2020 (r364560) @@ -1202,7 +1202,7 @@ sctp_asconf_timer(struct sctp_inpcb *inp, struct sctp_ * and cleanup. */ SCTPDBG(SCTP_DEBUG_TIMER1, "asconf_timer: Peer has not responded to our repeated ASCONFs\n"); - sctp_asconf_cleanup(stcb, net); + sctp_asconf_cleanup(stcb); return (0); } /* Modified: stable/12/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/12/sys/netinet/sctp_usrreq.c Sun Aug 23 21:57:24 2020 (r364559) +++ stable/12/sys/netinet/sctp_usrreq.c Sun Aug 23 21:59:23 2020 (r364560) @@ -755,7 +755,7 @@ sctp_disconnect(struct socket *so) sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN, stcb->sctp_ep, stcb, netp); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, - stcb->sctp_ep, stcb, netp); + stcb->sctp_ep, stcb, NULL); sctp_chunk_output(stcb->sctp_ep, stcb, SCTP_OUTPUT_FROM_T3, SCTP_SO_LOCKED); } } else { @@ -778,8 +778,7 @@ sctp_disconnect(struct socket *so) } SCTP_ADD_SUBSTATE(stcb, SCTP_STATE_SHUTDOWN_PENDING); - sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, stcb->sctp_ep, stcb, - netp); + sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, stcb->sctp_ep, stcb, NULL); if ((*asoc->ss_functions.sctp_ss_is_user_msgs_incomplete) (stcb, asoc)) { SCTP_ADD_SUBSTATE(stcb, SCTP_STATE_PARTIAL_MSG_LEFT); } @@ -978,7 +977,7 @@ sctp_shutdown(struct socket *so) return (0); } } - sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, stcb->sctp_ep, stcb, netp); + sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, stcb->sctp_ep, stcb, NULL); /* * XXX: Why do this in the case where we have still data * queued? Modified: stable/12/sys/netinet/sctputil.c ============================================================================== --- stable/12/sys/netinet/sctputil.c Sun Aug 23 21:57:24 2020 (r364559) +++ stable/12/sys/netinet/sctputil.c Sun Aug 23 21:59:23 2020 (r364560) @@ -1870,7 +1870,7 @@ sctp_timeout_handler(void *t) inp->sctp_ep.secret_key[secret][i] = sctp_select_initial_TSN(&inp->sctp_ep); } - sctp_timer_start(SCTP_TIMER_TYPE_NEWCOOKIE, inp, stcb, net); + sctp_timer_start(SCTP_TIMER_TYPE_NEWCOOKIE, inp, NULL, NULL); } did_output = 0; break; From owner-svn-src-stable-12@freebsd.org Sun Aug 23 22:02:19 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E8D043CCDCE; Sun, 23 Aug 2020 22:02:19 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZTkg5wQRz4cB3; Sun, 23 Aug 2020 22:02:19 +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 AF9D9E172; Sun, 23 Aug 2020 22:02:19 +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 07NM2JiB084631; Sun, 23 Aug 2020 22:02:19 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NM2Juq084600; Sun, 23 Aug 2020 22:02:19 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232202.07NM2Juq084600@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 22:02:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364561 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364561 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 22:02:20 -0000 Author: tuexen Date: Sun Aug 23 22:02:19 2020 New Revision: 364561 URL: https://svnweb.freebsd.org/changeset/base/364561 Log: MFC r359162: Remove a set, but unused variable. Modified: stable/12/sys/netinet/sctp_usrreq.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/12/sys/netinet/sctp_usrreq.c Sun Aug 23 21:59:23 2020 (r364560) +++ stable/12/sys/netinet/sctp_usrreq.c Sun Aug 23 22:02:19 2020 (r364561) @@ -769,14 +769,6 @@ sctp_disconnect(struct socket *so) * we will allow user data to be sent first * and move to SHUTDOWN-PENDING */ - struct sctp_nets *netp; - - if (stcb->asoc.alternate) { - netp = stcb->asoc.alternate; - } else { - netp = stcb->asoc.primary_destination; - } - SCTP_ADD_SUBSTATE(stcb, SCTP_STATE_SHUTDOWN_PENDING); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, stcb->sctp_ep, stcb, NULL); if ((*asoc->ss_functions.sctp_ss_is_user_msgs_incomplete) (stcb, asoc)) { From owner-svn-src-stable-12@freebsd.org Sun Aug 23 22:04:03 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BB6DA3CCCCD; Sun, 23 Aug 2020 22:04: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZTmg4W2lz4cJ3; Sun, 23 Aug 2020 22:04: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 7DFDDE0E8; Sun, 23 Aug 2020 22:04: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 07NM43IA085653; Sun, 23 Aug 2020 22:04:03 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NM42Fo085648; Sun, 23 Aug 2020 22:04:02 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232204.07NM42Fo085648@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 22:04:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364562 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364562 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 22:04:03 -0000 Author: tuexen Date: Sun Aug 23 22:04:02 2020 New Revision: 364562 URL: https://svnweb.freebsd.org/changeset/base/364562 Log: MFC r359195: More timer cleanups, no functional change. Modified: stable/12/sys/netinet/sctp_asconf.c stable/12/sys/netinet/sctp_input.c stable/12/sys/netinet/sctp_timer.c stable/12/sys/netinet/sctp_timer.h stable/12/sys/netinet/sctputil.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_asconf.c ============================================================================== --- stable/12/sys/netinet/sctp_asconf.c Sun Aug 23 22:02:19 2020 (r364561) +++ stable/12/sys/netinet/sctp_asconf.c Sun Aug 23 22:04:02 2020 (r364562) @@ -585,8 +585,7 @@ sctp_process_asconf_set_primary(struct sockaddr *src, sctp_move_chunks_from_net(stcb, stcb->asoc.deleted_primary); } - sctp_delete_prim_timer(stcb->sctp_ep, stcb, - stcb->asoc.deleted_primary); + sctp_delete_prim_timer(stcb->sctp_ep, stcb); } } else { /* couldn't set the requested primary address! */ Modified: stable/12/sys/netinet/sctp_input.c ============================================================================== --- stable/12/sys/netinet/sctp_input.c Sun Aug 23 22:02:19 2020 (r364561) +++ stable/12/sys/netinet/sctp_input.c Sun Aug 23 22:04:02 2020 (r364562) @@ -703,8 +703,7 @@ sctp_handle_heartbeat_ack(struct sctp_heartbeat_chunk sctp_move_chunks_from_net(stcb, stcb->asoc.deleted_primary); } - sctp_delete_prim_timer(stcb->sctp_ep, stcb, - stcb->asoc.deleted_primary); + sctp_delete_prim_timer(stcb->sctp_ep, stcb); } } } Modified: stable/12/sys/netinet/sctp_timer.c ============================================================================== --- stable/12/sys/netinet/sctp_timer.c Sun Aug 23 22:02:19 2020 (r364561) +++ stable/12/sys/netinet/sctp_timer.c Sun Aug 23 22:04:02 2020 (r364562) @@ -1264,8 +1264,7 @@ sctp_asconf_timer(struct sctp_inpcb *inp, struct sctp_ /* Mobility adaptation */ void -sctp_delete_prim_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb, - struct sctp_nets *net SCTP_UNUSED) +sctp_delete_prim_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb) { if (stcb->asoc.deleted_primary == NULL) { SCTPDBG(SCTP_DEBUG_ASCONF1, "delete_prim_timer: deleted_primary is not stored...\n"); @@ -1521,9 +1520,7 @@ sctp_pathmtu_timer(struct sctp_inpcb *inp, } void -sctp_autoclose_timer(struct sctp_inpcb *inp, - struct sctp_tcb *stcb, - struct sctp_nets *net) +sctp_autoclose_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb) { struct timeval tn, *tim_touse; struct sctp_association *asoc; @@ -1562,7 +1559,7 @@ sctp_autoclose_timer(struct sctp_inpcb *inp, */ if (SCTP_GET_STATE(stcb) != SCTP_STATE_SHUTDOWN_SENT) { /* only send SHUTDOWN 1st time thru */ - struct sctp_nets *netp; + struct sctp_nets *net; if ((SCTP_GET_STATE(stcb) == SCTP_STATE_OPEN) || (SCTP_GET_STATE(stcb) == SCTP_STATE_SHUTDOWN_RECEIVED)) { @@ -1571,17 +1568,15 @@ sctp_autoclose_timer(struct sctp_inpcb *inp, SCTP_SET_STATE(stcb, SCTP_STATE_SHUTDOWN_SENT); sctp_stop_timers_for_shutdown(stcb); if (stcb->asoc.alternate) { - netp = stcb->asoc.alternate; + net = stcb->asoc.alternate; } else { - netp = stcb->asoc.primary_destination; + net = stcb->asoc.primary_destination; } - sctp_send_shutdown(stcb, netp); + sctp_send_shutdown(stcb, net); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN, - stcb->sctp_ep, stcb, - netp); + stcb->sctp_ep, stcb, net); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, - stcb->sctp_ep, stcb, - netp); + stcb->sctp_ep, stcb, NULL); } } } else { @@ -1594,8 +1589,7 @@ sctp_autoclose_timer(struct sctp_inpcb *inp, /* fool the timer startup to use the time left */ tmp = asoc->sctp_autoclose_ticks; asoc->sctp_autoclose_ticks -= ticks_gone_by; - sctp_timer_start(SCTP_TIMER_TYPE_AUTOCLOSE, inp, stcb, - net); + sctp_timer_start(SCTP_TIMER_TYPE_AUTOCLOSE, inp, stcb, NULL); /* restore the real tick value */ asoc->sctp_autoclose_ticks = tmp; } Modified: stable/12/sys/netinet/sctp_timer.h ============================================================================== --- stable/12/sys/netinet/sctp_timer.h Sun Aug 23 22:02:19 2020 (r364561) +++ stable/12/sys/netinet/sctp_timer.h Sun Aug 23 22:04:02 2020 (r364562) @@ -43,9 +43,7 @@ __FBSDID("$FreeBSD$"); #define SCTP_RTT_SHIFT 3 #define SCTP_RTT_VAR_SHIFT 2 -struct sctp_nets * -sctp_find_alternate_net(struct sctp_tcb *, - struct sctp_nets *, int mode); +struct sctp_nets *sctp_find_alternate_net(struct sctp_tcb *, struct sctp_nets *, int); int sctp_t3rxt_timer(struct sctp_inpcb *, struct sctp_tcb *, @@ -82,12 +80,10 @@ sctp_asconf_timer(struct sctp_inpcb *, struct sctp_tcb struct sctp_nets *); void -sctp_delete_prim_timer(struct sctp_inpcb *, struct sctp_tcb *, - struct sctp_nets *); + sctp_delete_prim_timer(struct sctp_inpcb *, struct sctp_tcb *); void -sctp_autoclose_timer(struct sctp_inpcb *, struct sctp_tcb *, - struct sctp_nets *net); + sctp_autoclose_timer(struct sctp_inpcb *, struct sctp_tcb *); void sctp_audit_retranmission_queue(struct sctp_association *); Modified: stable/12/sys/netinet/sctputil.c ============================================================================== --- stable/12/sys/netinet/sctputil.c Sun Aug 23 22:02:19 2020 (r364561) +++ stable/12/sys/netinet/sctputil.c Sun Aug 23 22:04:02 2020 (r364562) @@ -1927,7 +1927,7 @@ sctp_timeout_handler(void *t) break; } SCTP_STAT_INCR(sctps_timoautoclose); - sctp_autoclose_timer(inp, stcb, net); + sctp_autoclose_timer(inp, stcb); sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_AUTOCLOSE_TMR, SCTP_SO_NOT_LOCKED); did_output = 0; break; @@ -1993,7 +1993,7 @@ sctp_timeout_handler(void *t) if ((stcb == NULL) || (inp == NULL)) { break; } - sctp_delete_prim_timer(inp, stcb, net); + sctp_delete_prim_timer(inp, stcb); SCTP_STAT_INCR(sctps_timodelprim); break; default: From owner-svn-src-stable-12@freebsd.org Sun Aug 23 22:05:58 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0182F3CCCEF; Sun, 23 Aug 2020 22:05: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZTps6gsNz4cj6; Sun, 23 Aug 2020 22:05: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 C8691E41C; Sun, 23 Aug 2020 22:05: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 07NM5vLk085793; Sun, 23 Aug 2020 22:05:57 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NM5vw7085792; Sun, 23 Aug 2020 22:05:57 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232205.07NM5vw7085792@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 22:05:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364563 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364563 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 22:05:58 -0000 Author: tuexen Date: Sun Aug 23 22:05:57 2020 New Revision: 364563 URL: https://svnweb.freebsd.org/changeset/base/364563 Log: MFC r359234: Cleanup the file and add two ASSERT variants for locks, which will be used shortly. Modified: stable/12/sys/netinet/sctp_lock_bsd.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_lock_bsd.h ============================================================================== --- stable/12/sys/netinet/sctp_lock_bsd.h Sun Aug 23 22:04:02 2020 (r364562) +++ stable/12/sys/netinet/sctp_lock_bsd.h Sun Aug 23 22:05:57 2020 (r364563) @@ -64,10 +64,6 @@ __FBSDID("$FreeBSD$"); * synchronize. So the CREATE_INP lock is also another one we must use * extreme caution in locking to make sure we don't hit a re-entrancy issue. * - * For non FreeBSD 5.x we provide a bunch of EMPTY lock macros so we can - * blatantly put locks everywhere and they reduce to nothing on - * NetBSD/OpenBSD and FreeBSD 4.x - * */ /* @@ -77,229 +73,275 @@ __FBSDID("$FreeBSD$"); * the SCTP_BASE_INFO() list's we will do a SCTP_INP_INFO_WLOCK(). */ -extern struct sctp_foo_stuff sctp_logoff[]; -extern int sctp_logoff_stuff; - #define SCTP_IPI_COUNT_INIT() #define SCTP_STATLOG_INIT_LOCK() +#define SCTP_STATLOG_DESTROY() #define SCTP_STATLOG_LOCK() #define SCTP_STATLOG_UNLOCK() -#define SCTP_STATLOG_DESTROY() -#define SCTP_INP_INFO_LOCK_DESTROY() do { \ - if(rw_wowned(&SCTP_BASE_INFO(ipi_ep_mtx))) { \ - rw_wunlock(&SCTP_BASE_INFO(ipi_ep_mtx)); \ - } \ - rw_destroy(&SCTP_BASE_INFO(ipi_ep_mtx)); \ - } while (0) +#define SCTP_INP_INFO_LOCK_INIT() do { \ + rw_init(&SCTP_BASE_INFO(ipi_ep_mtx), "sctp-info"); \ +} while (0) -#define SCTP_INP_INFO_LOCK_INIT() \ - rw_init(&SCTP_BASE_INFO(ipi_ep_mtx), "sctp-info"); +#define SCTP_INP_INFO_LOCK_DESTROY() do { \ + if (rw_wowned(&SCTP_BASE_INFO(ipi_ep_mtx))) { \ + rw_wunlock(&SCTP_BASE_INFO(ipi_ep_mtx)); \ + } \ + rw_destroy(&SCTP_BASE_INFO(ipi_ep_mtx)); \ +} while (0) +#define SCTP_INP_INFO_RLOCK() do { \ + rw_rlock(&SCTP_BASE_INFO(ipi_ep_mtx)); \ +} while (0) -#define SCTP_INP_INFO_RLOCK() do { \ - rw_rlock(&SCTP_BASE_INFO(ipi_ep_mtx)); \ +#define SCTP_INP_INFO_WLOCK() do { \ + rw_wlock(&SCTP_BASE_INFO(ipi_ep_mtx)); \ } while (0) -#define SCTP_MCORE_QLOCK_INIT(cpstr) do { \ - mtx_init(&(cpstr)->que_mtx, \ - "sctp-mcore_queue","queue_lock", \ - MTX_DEF|MTX_DUPOK); \ +#define SCTP_INP_INFO_RUNLOCK() do { \ + rw_runlock(&SCTP_BASE_INFO(ipi_ep_mtx)); \ } while (0) -#define SCTP_MCORE_QLOCK(cpstr) do { \ - mtx_lock(&(cpstr)->que_mtx); \ +#define SCTP_INP_INFO_WUNLOCK() do { \ + rw_wunlock(&SCTP_BASE_INFO(ipi_ep_mtx)); \ } while (0) -#define SCTP_MCORE_QUNLOCK(cpstr) do { \ - mtx_unlock(&(cpstr)->que_mtx); \ + +#define SCTP_MCORE_QLOCK_INIT(cpstr) do { \ + mtx_init(&(cpstr)->que_mtx, "sctp-mcore_queue","queue_lock", \ + MTX_DEF | MTX_DUPOK); \ } while (0) -#define SCTP_MCORE_QDESTROY(cpstr) do { \ - if(mtx_owned(&(cpstr)->core_mtx)) { \ - mtx_unlock(&(cpstr)->que_mtx); \ - } \ - mtx_destroy(&(cpstr)->que_mtx); \ +#define SCTP_MCORE_QDESTROY(cpstr) do { \ + if (mtx_owned(&(cpstr)->core_mtx)) { \ + mtx_unlock(&(cpstr)->que_mtx); \ + } \ + mtx_destroy(&(cpstr)->que_mtx); \ } while (0) +#define SCTP_MCORE_QLOCK(cpstr) do { \ + mtx_lock(&(cpstr)->que_mtx); \ +} while (0) -#define SCTP_MCORE_LOCK_INIT(cpstr) do { \ - mtx_init(&(cpstr)->core_mtx, \ - "sctp-cpulck","cpu_proc_lock", \ - MTX_DEF|MTX_DUPOK); \ +#define SCTP_MCORE_QUNLOCK(cpstr) do { \ + mtx_unlock(&(cpstr)->que_mtx); \ } while (0) -#define SCTP_MCORE_LOCK(cpstr) do { \ - mtx_lock(&(cpstr)->core_mtx); \ + +#define SCTP_MCORE_LOCK_INIT(cpstr) do { \ + mtx_init(&(cpstr)->core_mtx, "sctp-cpulck","cpu_proc_lock", \ + MTX_DEF | MTX_DUPOK); \ } while (0) -#define SCTP_MCORE_UNLOCK(cpstr) do { \ - mtx_unlock(&(cpstr)->core_mtx); \ +#define SCTP_MCORE_DESTROY(cpstr) do { \ + if (mtx_owned(&(cpstr)->core_mtx)) { \ + mtx_unlock(&(cpstr)->core_mtx); \ + } \ + mtx_destroy(&(cpstr)->core_mtx); \ } while (0) -#define SCTP_MCORE_DESTROY(cpstr) do { \ - if(mtx_owned(&(cpstr)->core_mtx)) { \ - mtx_unlock(&(cpstr)->core_mtx); \ - } \ - mtx_destroy(&(cpstr)->core_mtx); \ +#define SCTP_MCORE_LOCK(cpstr) do { \ + mtx_lock(&(cpstr)->core_mtx); \ } while (0) -#define SCTP_INP_INFO_WLOCK() do { \ - rw_wlock(&SCTP_BASE_INFO(ipi_ep_mtx)); \ +#define SCTP_MCORE_UNLOCK(cpstr) do { \ + mtx_unlock(&(cpstr)->core_mtx); \ } while (0) -#define SCTP_INP_INFO_RUNLOCK() rw_runlock(&SCTP_BASE_INFO(ipi_ep_mtx)) -#define SCTP_INP_INFO_WUNLOCK() rw_wunlock(&SCTP_BASE_INFO(ipi_ep_mtx)) +#define SCTP_IPI_ADDR_INIT() do { \ + rw_init(&SCTP_BASE_INFO(ipi_addr_mtx), "sctp-addr"); \ +} while (0) +#define SCTP_IPI_ADDR_DESTROY() do { \ + if (rw_wowned(&SCTP_BASE_INFO(ipi_addr_mtx))) { \ + rw_wunlock(&SCTP_BASE_INFO(ipi_addr_mtx)); \ + } \ + rw_destroy(&SCTP_BASE_INFO(ipi_addr_mtx)); \ +} while (0) -#define SCTP_IPI_ADDR_INIT() \ - rw_init(&SCTP_BASE_INFO(ipi_addr_mtx), "sctp-addr") -#define SCTP_IPI_ADDR_DESTROY() do { \ - if(rw_wowned(&SCTP_BASE_INFO(ipi_addr_mtx))) { \ - rw_wunlock(&SCTP_BASE_INFO(ipi_addr_mtx)); \ - } \ - rw_destroy(&SCTP_BASE_INFO(ipi_addr_mtx)); \ - } while (0) #define SCTP_IPI_ADDR_RLOCK() do { \ - rw_rlock(&SCTP_BASE_INFO(ipi_addr_mtx)); \ + rw_rlock(&SCTP_BASE_INFO(ipi_addr_mtx)); \ } while (0) + #define SCTP_IPI_ADDR_WLOCK() do { \ - rw_wlock(&SCTP_BASE_INFO(ipi_addr_mtx)); \ + rw_wlock(&SCTP_BASE_INFO(ipi_addr_mtx)); \ } while (0) -#define SCTP_IPI_ADDR_RUNLOCK() rw_runlock(&SCTP_BASE_INFO(ipi_addr_mtx)) -#define SCTP_IPI_ADDR_WUNLOCK() rw_wunlock(&SCTP_BASE_INFO(ipi_addr_mtx)) +#define SCTP_IPI_ADDR_RUNLOCK() do { \ + rw_runlock(&SCTP_BASE_INFO(ipi_addr_mtx)); \ +} while (0) +#define SCTP_IPI_ADDR_WUNLOCK() do { \ + rw_wunlock(&SCTP_BASE_INFO(ipi_addr_mtx)); \ +} while (0) -#define SCTP_IPI_ITERATOR_WQ_INIT() \ - mtx_init(&sctp_it_ctl.ipi_iterator_wq_mtx, "sctp-it-wq", "sctp_it_wq", MTX_DEF) -#define SCTP_IPI_ITERATOR_WQ_DESTROY() \ - mtx_destroy(&sctp_it_ctl.ipi_iterator_wq_mtx) +#define SCTP_IPI_ITERATOR_WQ_INIT() do { \ + mtx_init(&sctp_it_ctl.ipi_iterator_wq_mtx, "sctp-it-wq", \ + "sctp_it_wq", MTX_DEF); \ +} while (0) -#define SCTP_IPI_ITERATOR_WQ_LOCK() do { \ - mtx_lock(&sctp_it_ctl.ipi_iterator_wq_mtx); \ +#define SCTP_IPI_ITERATOR_WQ_DESTROY() do { \ + mtx_destroy(&sctp_it_ctl.ipi_iterator_wq_mtx); \ } while (0) -#define SCTP_IPI_ITERATOR_WQ_UNLOCK() mtx_unlock(&sctp_it_ctl.ipi_iterator_wq_mtx) +#define SCTP_IPI_ITERATOR_WQ_LOCK() do { \ + mtx_lock(&sctp_it_ctl.ipi_iterator_wq_mtx); \ +} while (0) +#define SCTP_IPI_ITERATOR_WQ_UNLOCK() do { \ + mtx_unlock(&sctp_it_ctl.ipi_iterator_wq_mtx); \ +} while (0) -#define SCTP_IP_PKTLOG_INIT() \ - mtx_init(&SCTP_BASE_INFO(ipi_pktlog_mtx), "sctp-pktlog", "packetlog", MTX_DEF) +#define SCTP_IP_PKTLOG_INIT() do { \ + mtx_init(&SCTP_BASE_INFO(ipi_pktlog_mtx), "sctp-pktlog", \ + "packetlog", MTX_DEF); \ +} while (0) -#define SCTP_IP_PKTLOG_LOCK() do { \ - mtx_lock(&SCTP_BASE_INFO(ipi_pktlog_mtx)); \ +#define SCTP_IP_PKTLOG_DESTROY() do { \ + mtx_destroy(&SCTP_BASE_INFO(ipi_pktlog_mtx)); \ } while (0) -#define SCTP_IP_PKTLOG_UNLOCK() mtx_unlock(&SCTP_BASE_INFO(ipi_pktlog_mtx)) +#define SCTP_IP_PKTLOG_LOCK() do { \ + mtx_lock(&SCTP_BASE_INFO(ipi_pktlog_mtx)); \ +} while (0) -#define SCTP_IP_PKTLOG_DESTROY() \ - mtx_destroy(&SCTP_BASE_INFO(ipi_pktlog_mtx)) +#define SCTP_IP_PKTLOG_UNLOCK() do { \ + mtx_unlock(&SCTP_BASE_INFO(ipi_pktlog_mtx)); \ +} while (0) - - - /* * The INP locks we will use for locking an SCTP endpoint, so for example if * we want to change something at the endpoint level for example random_store * or cookie secrets we lock the INP level. */ -#define SCTP_INP_READ_INIT(_inp) \ - mtx_init(&(_inp)->inp_rdata_mtx, "sctp-read", "inpr", MTX_DEF | MTX_DUPOK) +#define SCTP_INP_READ_INIT(_inp) do { \ + mtx_init(&(_inp)->inp_rdata_mtx, "sctp-read", "inpr", \ + MTX_DEF | MTX_DUPOK); \ +} while (0) -#define SCTP_INP_READ_DESTROY(_inp) \ - mtx_destroy(&(_inp)->inp_rdata_mtx) +#define SCTP_INP_READ_DESTROY(_inp) do { \ + mtx_destroy(&(_inp)->inp_rdata_mtx); \ +} while (0) -#define SCTP_INP_READ_LOCK(_inp) do { \ - mtx_lock(&(_inp)->inp_rdata_mtx); \ +#define SCTP_INP_READ_LOCK(_inp) do { \ + mtx_lock(&(_inp)->inp_rdata_mtx); \ } while (0) +#define SCTP_INP_READ_UNLOCK(_inp) do { \ + mtx_unlock(&(_inp)->inp_rdata_mtx); \ +} while (0) -#define SCTP_INP_READ_UNLOCK(_inp) mtx_unlock(&(_inp)->inp_rdata_mtx) +#define SCTP_INP_LOCK_INIT(_inp) do { \ + mtx_init(&(_inp)->inp_mtx, "sctp-inp", "inp", \ + MTX_DEF | MTX_DUPOK); \ +} while (0) -#define SCTP_INP_LOCK_INIT(_inp) \ - mtx_init(&(_inp)->inp_mtx, "sctp-inp", "inp", MTX_DEF | MTX_DUPOK) -#define SCTP_ASOC_CREATE_LOCK_INIT(_inp) \ - mtx_init(&(_inp)->inp_create_mtx, "sctp-create", "inp_create", \ - MTX_DEF | MTX_DUPOK) +#define SCTP_INP_LOCK_DESTROY(_inp) do { \ + mtx_destroy(&(_inp)->inp_mtx); \ +} while (0) -#define SCTP_INP_LOCK_DESTROY(_inp) \ - mtx_destroy(&(_inp)->inp_mtx) +#define SCTP_INP_LOCK_CONTENDED(_inp) \ + ((_inp)->inp_mtx.mtx_lock & MTX_CONTESTED) -#define SCTP_INP_LOCK_CONTENDED(_inp) ((_inp)->inp_mtx.mtx_lock & MTX_CONTESTED) +#define SCTP_INP_READ_CONTENDED(_inp) \ + ((_inp)->inp_rdata_mtx.mtx_lock & MTX_CONTESTED) -#define SCTP_INP_READ_CONTENDED(_inp) ((_inp)->inp_rdata_mtx.mtx_lock & MTX_CONTESTED) - -#define SCTP_ASOC_CREATE_LOCK_CONTENDED(_inp) ((_inp)->inp_create_mtx.mtx_lock & MTX_CONTESTED) - - -#define SCTP_ASOC_CREATE_LOCK_DESTROY(_inp) \ - mtx_destroy(&(_inp)->inp_create_mtx) - - #ifdef SCTP_LOCK_LOGGING #define SCTP_INP_RLOCK(_inp) do { \ - if(SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOCK_LOGGING_ENABLE) sctp_log_lock(_inp, (struct sctp_tcb *)NULL, SCTP_LOG_LOCK_INP);\ - mtx_lock(&(_inp)->inp_mtx); \ + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOCK_LOGGING_ENABLE) \ + sctp_log_lock(_inp, NULL, SCTP_LOG_LOCK_INP); \ + mtx_lock(&(_inp)->inp_mtx); \ } while (0) #define SCTP_INP_WLOCK(_inp) do { \ - if(SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOCK_LOGGING_ENABLE) sctp_log_lock(_inp, (struct sctp_tcb *)NULL, SCTP_LOG_LOCK_INP);\ - mtx_lock(&(_inp)->inp_mtx); \ + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOCK_LOGGING_ENABLE) \ + sctp_log_lock(_inp, NULL, SCTP_LOG_LOCK_INP); \ + mtx_lock(&(_inp)->inp_mtx); \ } while (0) - #else - -#define SCTP_INP_RLOCK(_inp) do { \ - mtx_lock(&(_inp)->inp_mtx); \ +#define SCTP_INP_RLOCK(_inp) do { \ + mtx_lock(&(_inp)->inp_mtx); \ } while (0) -#define SCTP_INP_WLOCK(_inp) do { \ - mtx_lock(&(_inp)->inp_mtx); \ +#define SCTP_INP_WLOCK(_inp) do { \ + mtx_lock(&(_inp)->inp_mtx); \ } while (0) - #endif +#define SCTP_INP_RUNLOCK(_inp) do { \ + mtx_unlock(&(_inp)->inp_mtx); \ +} while (0) -#define SCTP_TCB_SEND_LOCK_INIT(_tcb) \ - mtx_init(&(_tcb)->tcb_send_mtx, "sctp-send-tcb", "tcbs", MTX_DEF | MTX_DUPOK) +#define SCTP_INP_WUNLOCK(_inp) do { \ + mtx_unlock(&(_inp)->inp_mtx); \ +} while (0) -#define SCTP_TCB_SEND_LOCK_DESTROY(_tcb) mtx_destroy(&(_tcb)->tcb_send_mtx) +#define SCTP_INP_RLOCK_ASSERT(_inp) do { \ + KASSERT(mtx_owned(&(_inp)->inp_mtx), \ + ("Don't own INP read lock")); \ +} while (0) -#define SCTP_TCB_SEND_LOCK(_tcb) do { \ - mtx_lock(&(_tcb)->tcb_send_mtx); \ +#define SCTP_INP_WLOCK_ASSERT(_inp) do { \ + KASSERT(mtx_owned(&(_inp)->inp_mtx), \ + ("Don't own INP write lock")); \ } while (0) -#define SCTP_TCB_SEND_UNLOCK(_tcb) mtx_unlock(&(_tcb)->tcb_send_mtx) - #define SCTP_INP_INCR_REF(_inp) atomic_add_int(&((_inp)->refcount), 1) #define SCTP_INP_DECR_REF(_inp) atomic_add_int(&((_inp)->refcount), -1) +#define SCTP_ASOC_CREATE_LOCK_INIT(_inp) do { \ + mtx_init(&(_inp)->inp_create_mtx, "sctp-create", "inp_create", \ + MTX_DEF | MTX_DUPOK); \ +} while (0) +#define SCTP_ASOC_CREATE_LOCK_DESTROY(_inp) do { \ + mtx_destroy(&(_inp)->inp_create_mtx); \ +} while (0) + #ifdef SCTP_LOCK_LOGGING -#define SCTP_ASOC_CREATE_LOCK(_inp) \ - do { \ - if(SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOCK_LOGGING_ENABLE) sctp_log_lock(_inp, (struct sctp_tcb *)NULL, SCTP_LOG_LOCK_CREATE); \ - mtx_lock(&(_inp)->inp_create_mtx); \ - } while (0) +#define SCTP_ASOC_CREATE_LOCK(_inp) do { \ + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOCK_LOGGING_ENABLE) \ + sctp_log_lock(_inp, NULL, SCTP_LOG_LOCK_CREATE); \ + mtx_lock(&(_inp)->inp_create_mtx); \ +} while (0) #else - -#define SCTP_ASOC_CREATE_LOCK(_inp) \ - do { \ - mtx_lock(&(_inp)->inp_create_mtx); \ - } while (0) +#define SCTP_ASOC_CREATE_LOCK(_inp) do { \ + mtx_lock(&(_inp)->inp_create_mtx); \ +} while (0) #endif -#define SCTP_INP_RUNLOCK(_inp) mtx_unlock(&(_inp)->inp_mtx) -#define SCTP_INP_WUNLOCK(_inp) mtx_unlock(&(_inp)->inp_mtx) -#define SCTP_ASOC_CREATE_UNLOCK(_inp) mtx_unlock(&(_inp)->inp_create_mtx) +#define SCTP_ASOC_CREATE_UNLOCK(_inp) do { \ + mtx_unlock(&(_inp)->inp_create_mtx); \ +} while (0) +#define SCTP_ASOC_CREATE_LOCK_CONTENDED(_inp) \ + ((_inp)->inp_create_mtx.mtx_lock & MTX_CONTESTED) + + +#define SCTP_TCB_SEND_LOCK_INIT(_tcb) do { \ + mtx_init(&(_tcb)->tcb_send_mtx, "sctp-send-tcb", "tcbs", \ + MTX_DEF | MTX_DUPOK); \ +} while (0) + +#define SCTP_TCB_SEND_LOCK_DESTROY(_tcb) do { \ + mtx_destroy(&(_tcb)->tcb_send_mtx); \ +} while (0) + +#define SCTP_TCB_SEND_LOCK(_tcb) do { \ + mtx_lock(&(_tcb)->tcb_send_mtx); \ +} while (0) + +#define SCTP_TCB_SEND_UNLOCK(_tcb) do { \ + mtx_unlock(&(_tcb)->tcb_send_mtx); \ +} while (0) + /* * For the majority of things (once we have found the association) we will * lock the actual association mutex. This will protect all the assoiciation @@ -308,168 +350,154 @@ extern int sctp_logoff_stuff; * extra SOCKBUF_LOCK(&so->so_rcv) even though the association is locked. */ -#define SCTP_TCB_LOCK_INIT(_tcb) \ - mtx_init(&(_tcb)->tcb_mtx, "sctp-tcb", "tcb", MTX_DEF | MTX_DUPOK) +#define SCTP_TCB_LOCK_INIT(_tcb) do { \ + mtx_init(&(_tcb)->tcb_mtx, "sctp-tcb", "tcb", \ + MTX_DEF | MTX_DUPOK); \ +} while (0) -#define SCTP_TCB_LOCK_DESTROY(_tcb) mtx_destroy(&(_tcb)->tcb_mtx) +#define SCTP_TCB_LOCK_DESTROY(_tcb) do { \ + mtx_destroy(&(_tcb)->tcb_mtx); \ +} while (0) #ifdef SCTP_LOCK_LOGGING -#define SCTP_TCB_LOCK(_tcb) do { \ - if(SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOCK_LOGGING_ENABLE) sctp_log_lock(_tcb->sctp_ep, _tcb, SCTP_LOG_LOCK_TCB); \ - mtx_lock(&(_tcb)->tcb_mtx); \ +#define SCTP_TCB_LOCK(_tcb) do { \ + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOCK_LOGGING_ENABLE) \ + sctp_log_lock(_tcb->sctp_ep, _tcb, SCTP_LOG_LOCK_TCB); \ + mtx_lock(&(_tcb)->tcb_mtx); \ } while (0) - #else -#define SCTP_TCB_LOCK(_tcb) do { \ - mtx_lock(&(_tcb)->tcb_mtx); \ +#define SCTP_TCB_LOCK(_tcb) do { \ + mtx_lock(&(_tcb)->tcb_mtx); \ } while (0) #endif +#define SCTP_TCB_TRYLOCK(_tcb) \ + mtx_trylock(&(_tcb)->tcb_mtx) -#define SCTP_TCB_TRYLOCK(_tcb) mtx_trylock(&(_tcb)->tcb_mtx) +#define SCTP_TCB_UNLOCK(_tcb) do { \ + mtx_unlock(&(_tcb)->tcb_mtx); \ +} while (0) -#define SCTP_TCB_UNLOCK(_tcb) mtx_unlock(&(_tcb)->tcb_mtx) +#define SCTP_TCB_UNLOCK_IFOWNED(_tcb) do { \ + if (mtx_owned(&(_tcb)->tcb_mtx)) \ + mtx_unlock(&(_tcb)->tcb_mtx); \ +} while (0) -#define SCTP_TCB_UNLOCK_IFOWNED(_tcb) do { \ - if (mtx_owned(&(_tcb)->tcb_mtx)) \ - mtx_unlock(&(_tcb)->tcb_mtx); \ - } while (0) +#define SCTP_TCB_LOCK_ASSERT(_tcb) do { \ + KASSERT(mtx_owned(&(_tcb)->tcb_mtx), \ + ("Don't own TCB lock")); \ +} while (0) +#define SCTP_ITERATOR_LOCK_INIT() do { \ + mtx_init(&sctp_it_ctl.it_mtx, "sctp-it", "iterator", MTX_DEF); \ +} while (0) -#ifdef INVARIANTS -#define SCTP_TCB_LOCK_ASSERT(_tcb) do { \ - if (mtx_owned(&(_tcb)->tcb_mtx) == 0) \ - panic("Don't own TCB lock"); \ - } while (0) -#else -#define SCTP_TCB_LOCK_ASSERT(_tcb) -#endif +#define SCTP_ITERATOR_LOCK_DESTROY() do { \ + mtx_destroy(&sctp_it_ctl.it_mtx); \ +} while (0) -#define SCTP_ITERATOR_LOCK_INIT() \ - mtx_init(&sctp_it_ctl.it_mtx, "sctp-it", "iterator", MTX_DEF) - -#ifdef INVARIANTS #define SCTP_ITERATOR_LOCK() \ do { \ - if (mtx_owned(&sctp_it_ctl.it_mtx)) \ - panic("Iterator Lock"); \ + KASSERT(!mtx_owned(&sctp_it_ctl.it_mtx), \ + ("Own the iterator lock")); \ mtx_lock(&sctp_it_ctl.it_mtx); \ } while (0) -#else -#define SCTP_ITERATOR_LOCK() \ - do { \ - mtx_lock(&sctp_it_ctl.it_mtx); \ - } while (0) -#endif +#define SCTP_ITERATOR_UNLOCK() do { \ + mtx_unlock(&sctp_it_ctl.it_mtx); \ +} while (0) -#define SCTP_ITERATOR_UNLOCK() mtx_unlock(&sctp_it_ctl.it_mtx) -#define SCTP_ITERATOR_LOCK_DESTROY() mtx_destroy(&sctp_it_ctl.it_mtx) +#define SCTP_WQ_ADDR_INIT() do { \ + mtx_init(&SCTP_BASE_INFO(wq_addr_mtx), \ + "sctp-addr-wq","sctp_addr_wq", MTX_DEF); \ +} while (0) -#define SCTP_WQ_ADDR_INIT() do { \ - mtx_init(&SCTP_BASE_INFO(wq_addr_mtx), "sctp-addr-wq","sctp_addr_wq",MTX_DEF); \ - } while (0) +#define SCTP_WQ_ADDR_DESTROY() do { \ + if (mtx_owned(&SCTP_BASE_INFO(wq_addr_mtx))) { \ + mtx_unlock(&SCTP_BASE_INFO(wq_addr_mtx)); \ + } \ + mtx_destroy(&SCTP_BASE_INFO(wq_addr_mtx)); \ +} while (0) -#define SCTP_WQ_ADDR_DESTROY() do { \ - if(mtx_owned(&SCTP_BASE_INFO(wq_addr_mtx))) { \ - mtx_unlock(&SCTP_BASE_INFO(wq_addr_mtx)); \ - } \ - mtx_destroy(&SCTP_BASE_INFO(wq_addr_mtx)); \ - } while (0) +#define SCTP_WQ_ADDR_LOCK() do { \ + mtx_lock(&SCTP_BASE_INFO(wq_addr_mtx)); \ +} while (0) -#define SCTP_WQ_ADDR_LOCK() do { \ - mtx_lock(&SCTP_BASE_INFO(wq_addr_mtx)); \ +#define SCTP_WQ_ADDR_UNLOCK() do { \ + mtx_unlock(&SCTP_BASE_INFO(wq_addr_mtx)); \ } while (0) -#define SCTP_WQ_ADDR_UNLOCK() do { \ - mtx_unlock(&SCTP_BASE_INFO(wq_addr_mtx)); \ + +#define SCTP_WQ_ADDR_LOCK_ASSERT() do { \ + KASSERT(mtx_owned(&SCTP_BASE_INFO(wq_addr_mtx)), \ + ("Don't own the ADDR-WQ lock")); \ } while (0) +#define SCTP_INCR_EP_COUNT() do { \ + atomic_add_int(&SCTP_BASE_INFO(ipi_count_ep), 1); \ +} while (0) +#define SCTP_DECR_EP_COUNT() do { \ + atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_ep), 1); \ +} while (0) -#define SCTP_INCR_EP_COUNT() \ - do { \ - atomic_add_int(&SCTP_BASE_INFO(ipi_count_ep), 1); \ - } while (0) +#define SCTP_INCR_ASOC_COUNT() do { \ + atomic_add_int(&SCTP_BASE_INFO(ipi_count_asoc), 1); \ +} while (0) -#define SCTP_DECR_EP_COUNT() \ - do { \ - atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_ep), 1); \ - } while (0) +#define SCTP_DECR_ASOC_COUNT() do { \ + atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_asoc), 1); \ +} while (0) -#define SCTP_INCR_ASOC_COUNT() \ - do { \ - atomic_add_int(&SCTP_BASE_INFO(ipi_count_asoc), 1); \ - } while (0) +#define SCTP_INCR_LADDR_COUNT() do { \ + atomic_add_int(&SCTP_BASE_INFO(ipi_count_laddr), 1); \ +} while (0) -#define SCTP_DECR_ASOC_COUNT() \ - do { \ - atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_asoc), 1); \ - } while (0) +#define SCTP_DECR_LADDR_COUNT() do { \ + atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_laddr), 1); \ +} while (0) -#define SCTP_INCR_LADDR_COUNT() \ - do { \ - atomic_add_int(&SCTP_BASE_INFO(ipi_count_laddr), 1); \ - } while (0) +#define SCTP_INCR_RADDR_COUNT() do { \ + atomic_add_int(&SCTP_BASE_INFO(ipi_count_raddr), 1); \ +} while (0) -#define SCTP_DECR_LADDR_COUNT() \ - do { \ - atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_laddr), 1); \ - } while (0) +#define SCTP_DECR_RADDR_COUNT() do { \ + atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_raddr),1); \ +} while (0) -#define SCTP_INCR_RADDR_COUNT() \ - do { \ - atomic_add_int(&SCTP_BASE_INFO(ipi_count_raddr), 1); \ - } while (0) +#define SCTP_INCR_CHK_COUNT() do { \ + atomic_add_int(&SCTP_BASE_INFO(ipi_count_chunk), 1); \ +} while (0) -#define SCTP_DECR_RADDR_COUNT() \ - do { \ - atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_raddr),1); \ - } while (0) +#define SCTP_DECR_CHK_COUNT() do { \ + KASSERT(SCTP_BASE_INFO(ipi_count_chunk) > 0, \ + ("ipi_count_chunk would become negative")); \ + if (SCTP_BASE_INFO(ipi_count_chunk) != 0) \ + atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_chunk), \ + 1); \ +} while (0) -#define SCTP_INCR_CHK_COUNT() \ - do { \ - atomic_add_int(&SCTP_BASE_INFO(ipi_count_chunk), 1); \ - } while (0) -#ifdef INVARIANTS -#define SCTP_DECR_CHK_COUNT() \ - do { \ - if(SCTP_BASE_INFO(ipi_count_chunk) == 0) \ - panic("chunk count to 0?"); \ - atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_chunk), 1); \ - } while (0) -#else -#define SCTP_DECR_CHK_COUNT() \ - do { \ - if(SCTP_BASE_INFO(ipi_count_chunk) != 0) \ - atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_chunk), 1); \ - } while (0) -#endif -#define SCTP_INCR_READQ_COUNT() \ - do { \ - atomic_add_int(&SCTP_BASE_INFO(ipi_count_readq),1); \ - } while (0) +#define SCTP_INCR_READQ_COUNT() do { \ + atomic_add_int(&SCTP_BASE_INFO(ipi_count_readq), 1); \ +} while (0) -#define SCTP_DECR_READQ_COUNT() \ - do { \ - atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_readq), 1); \ - } while (0) +#define SCTP_DECR_READQ_COUNT() do { \ + atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_readq), 1); \ +} while (0) -#define SCTP_INCR_STRMOQ_COUNT() \ - do { \ - atomic_add_int(&SCTP_BASE_INFO(ipi_count_strmoq), 1); \ - } while (0) +#define SCTP_INCR_STRMOQ_COUNT() do { \ + atomic_add_int(&SCTP_BASE_INFO(ipi_count_strmoq), 1); \ +} while (0) -#define SCTP_DECR_STRMOQ_COUNT() \ - do { \ - atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_strmoq), 1); \ - } while (0) +#define SCTP_DECR_STRMOQ_COUNT() do { \ + atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_strmoq), 1); \ +} while (0) - #if defined(SCTP_SO_LOCK_TESTING) -#define SCTP_INP_SO(sctpinp) (sctpinp)->ip_inp.inp.inp_socket +#define SCTP_INP_SO(sctpinp) \ + (sctpinp)->ip_inp.inp.inp_socket #define SCTP_SOCKET_LOCK(so, refcnt) #define SCTP_SOCKET_UNLOCK(so, refcnt) #endif From owner-svn-src-stable-12@freebsd.org Sun Aug 23 22:07:50 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6659A3CD083; Sun, 23 Aug 2020 22:07:50 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZTs22TKzz4cgy; Sun, 23 Aug 2020 22:07:50 +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 378D6DEF5; Sun, 23 Aug 2020 22:07:50 +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 07NM7oSc085948; Sun, 23 Aug 2020 22:07:50 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NM7o3v085947; Sun, 23 Aug 2020 22:07:50 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232207.07NM7o3v085947@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 22:07:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364564 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364564 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 22:07:50 -0000 Author: tuexen Date: Sun Aug 23 22:07:49 2020 New Revision: 364564 URL: https://svnweb.freebsd.org/changeset/base/364564 Log: MFC r359287: Another cleanup of the timer code. Also be more pedantic about the parameters of the timer start and stop routines. Several inconsistencies have been fixed in earlier commits. Now they will be catched when running an INVARIANTS system. Modified: stable/12/sys/netinet/sctputil.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctputil.c ============================================================================== --- stable/12/sys/netinet/sctputil.c Sun Aug 23 22:05:57 2020 (r364563) +++ stable/12/sys/netinet/sctputil.c Sun Aug 23 22:07:49 2020 (r364564) @@ -1598,9 +1598,35 @@ sctp_handle_addr_wq(void) } } +/*- + * The following table shows which pointers for the inp, stcb, or net are + * stored for each timer after it was started. + * + *|Name |Timer |inp |stcb|net | + *|-----------------------------|-----------------------------|----|----|----| + *|SCTP_TIMER_TYPE_SEND |net->rxt_timer |Yes |Yes |Yes | + *|SCTP_TIMER_TYPE_INIT |net->rxt_timer |Yes |Yes |Yes | + *|SCTP_TIMER_TYPE_RECV |stcb->asoc.dack_timer |Yes |Yes |No | + *|SCTP_TIMER_TYPE_SHUTDOWN |net->rxt_timer |Yes |Yes |Yes | + *|SCTP_TIMER_TYPE_HEARTBEAT |net->hb_timer |Yes |Yes |Yes | + *|SCTP_TIMER_TYPE_COOKIE |net->rxt_timer |Yes |Yes |Yes | + *|SCTP_TIMER_TYPE_NEWCOOKIE |inp->sctp_ep.signature_change|Yes |No |No | + *|SCTP_TIMER_TYPE_PATHMTURAISE |net->pmtu_timer |Yes |Yes |Yes | + *|SCTP_TIMER_TYPE_SHUTDOWNACK |net->rxt_timer |Yes |Yes |Yes | + *|SCTP_TIMER_TYPE_ASCONF |stcb->asoc.asconf_timer |Yes |Yes |Yes | + *|SCTP_TIMER_TYPE_SHUTDOWNGUARD|stcb->asoc.shut_guard_timer |Yes |Yes |No | + *|SCTP_TIMER_TYPE_AUTOCLOSE |stcb->asoc.autoclose_timer |Yes |Yes |No | + *|SCTP_TIMER_TYPE_STRRESET |stcb->asoc.strreset_timer |Yes |Yes |No | + *|SCTP_TIMER_TYPE_INPKILL |inp->sctp_ep.signature_change|Yes |No |No | + *|SCTP_TIMER_TYPE_ASOCKILL |stcb->asoc.strreset_timer |Yes |Yes |No | + *|SCTP_TIMER_TYPE_ADDR_WQ |SCTP_BASE_INFO(addr_wq_timer)|No |No |No | + *|SCTP_TIMER_TYPE_PRIM_DELETED |stcb->asoc.delete_prim_timer |Yes |Yes |No | + */ + void sctp_timeout_handler(void *t) { + struct timeval tv; struct sctp_inpcb *inp; struct sctp_tcb *stcb; struct sctp_nets *net; @@ -1611,6 +1637,7 @@ sctp_timeout_handler(void *t) #endif int did_output; int type; + int i, secret; tmr = (struct sctp_timer *)t; inp = (struct sctp_inpcb *)tmr->ep; @@ -1625,48 +1652,31 @@ sctp_timeout_handler(void *t) #endif /* sanity checks... */ - if (tmr->self != (void *)tmr) { - /* - * SCTP_PRINTF("Stale SCTP timer fired (%p), ignoring...\n", - * (void *)tmr); - */ - CURVNET_RESTORE(); - return; - } + KASSERT(tmr->self == tmr, ("tmr->self corrupted")); + KASSERT(SCTP_IS_TIMER_TYPE_VALID(tmr->type), ("Invalid timer type %d", tmr->type)); + type = tmr->type; tmr->stopped_from = 0xa001; - if (!SCTP_IS_TIMER_TYPE_VALID(tmr->type)) { - /* - * SCTP_PRINTF("SCTP timer fired with invalid type: 0x%x\n", - * tmr->type); - */ - CURVNET_RESTORE(); - return; - } - tmr->stopped_from = 0xa002; - if ((tmr->type != SCTP_TIMER_TYPE_ADDR_WQ) && (inp == NULL)) { - CURVNET_RESTORE(); - return; - } - /* if this is an iterator timeout, get the struct and clear inp */ - tmr->stopped_from = 0xa003; if (inp) { SCTP_INP_INCR_REF(inp); if ((inp->sctp_socket == NULL) && - ((tmr->type != SCTP_TIMER_TYPE_INPKILL) && - (tmr->type != SCTP_TIMER_TYPE_INIT) && - (tmr->type != SCTP_TIMER_TYPE_SEND) && - (tmr->type != SCTP_TIMER_TYPE_RECV) && - (tmr->type != SCTP_TIMER_TYPE_HEARTBEAT) && - (tmr->type != SCTP_TIMER_TYPE_SHUTDOWN) && - (tmr->type != SCTP_TIMER_TYPE_SHUTDOWNACK) && - (tmr->type != SCTP_TIMER_TYPE_SHUTDOWNGUARD) && - (tmr->type != SCTP_TIMER_TYPE_ASOCKILL))) { + ((type != SCTP_TIMER_TYPE_INPKILL) && + (type != SCTP_TIMER_TYPE_INIT) && + (type != SCTP_TIMER_TYPE_SEND) && + (type != SCTP_TIMER_TYPE_RECV) && + (type != SCTP_TIMER_TYPE_HEARTBEAT) && + (type != SCTP_TIMER_TYPE_SHUTDOWN) && + (type != SCTP_TIMER_TYPE_SHUTDOWNACK) && + (type != SCTP_TIMER_TYPE_SHUTDOWNGUARD) && + (type != SCTP_TIMER_TYPE_ASOCKILL))) { SCTP_INP_DECR_REF(inp); CURVNET_RESTORE(); + SCTPDBG(SCTP_DEBUG_TIMER2, + "Timer type = %d handler exiting due to closed socket\n", + type); return; } } - tmr->stopped_from = 0xa004; + tmr->stopped_from = 0xa002; if (stcb) { atomic_add_int(&stcb->asoc.refcnt, 1); if (stcb->asoc.state == 0) { @@ -1675,11 +1685,13 @@ sctp_timeout_handler(void *t) SCTP_INP_DECR_REF(inp); } CURVNET_RESTORE(); + SCTPDBG(SCTP_DEBUG_TIMER2, + "Timer type = %d handler exiting due to CLOSED association\n", + type); return; } } - type = tmr->type; - tmr->stopped_from = 0xa005; + tmr->stopped_from = 0xa003; SCTPDBG(SCTP_DEBUG_TIMER1, "Timer type %d goes off\n", type); if (!SCTP_OS_TIMER_ACTIVE(&tmr->timer)) { if (inp) { @@ -1689,9 +1701,12 @@ sctp_timeout_handler(void *t) atomic_add_int(&stcb->asoc.refcnt, -1); } CURVNET_RESTORE(); + SCTPDBG(SCTP_DEBUG_TIMER2, + "Timer type = %d handler exiting due to not being active\n", + type); return; } - tmr->stopped_from = 0xa006; + tmr->stopped_from = 0xa004; if (stcb) { SCTP_TCB_LOCK(stcb); @@ -1704,12 +1719,13 @@ sctp_timeout_handler(void *t) SCTP_INP_DECR_REF(inp); } CURVNET_RESTORE(); + SCTPDBG(SCTP_DEBUG_TIMER2, + "Timer type = %d handler exiting due to CLOSED association\n", + type); return; } } else if (inp != NULL) { - if (type != SCTP_TIMER_TYPE_INPKILL) { - SCTP_INP_WLOCK(inp); - } + SCTP_INP_WLOCK(inp); } else { SCTP_WQ_ADDR_LOCK(); } @@ -1734,9 +1750,9 @@ sctp_timeout_handler(void *t) /* call the handler for the appropriate timer type */ switch (type) { case SCTP_TIMER_TYPE_SEND: - if ((stcb == NULL) || (inp == NULL)) { - break; - } + KASSERT(inp != NULL && stcb != NULL && net != NULL, + ("timeout of type %d: inp = %p, stcb = %p, net = %p", + type, inp, stcb, net)); SCTP_STAT_INCR(sctps_timodata); stcb->asoc.timodata++; stcb->asoc.num_send_timers_up--; @@ -1770,9 +1786,9 @@ sctp_timeout_handler(void *t) } break; case SCTP_TIMER_TYPE_INIT: - if ((stcb == NULL) || (inp == NULL)) { - break; - } + KASSERT(inp != NULL && stcb != NULL && net != NULL, + ("timeout of type %d: inp = %p, stcb = %p, net = %p", + type, inp, stcb, net)); SCTP_STAT_INCR(sctps_timoinit); stcb->asoc.timoinit++; if (sctp_t1init_timer(inp, stcb, net)) { @@ -1783,36 +1799,36 @@ sctp_timeout_handler(void *t) did_output = 0; break; case SCTP_TIMER_TYPE_RECV: - if ((stcb == NULL) || (inp == NULL)) { - break; - } + KASSERT(inp != NULL && stcb != NULL && net == NULL, + ("timeout of type %d: inp = %p, stcb = %p, net = %p", + type, inp, stcb, net)); SCTP_STAT_INCR(sctps_timosack); stcb->asoc.timosack++; sctp_send_sack(stcb, SCTP_SO_NOT_LOCKED); #ifdef SCTP_AUDITING_ENABLED - sctp_auditing(4, inp, stcb, net); + sctp_auditing(4, inp, stcb, NULL); #endif sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_SACK_TMR, SCTP_SO_NOT_LOCKED); break; case SCTP_TIMER_TYPE_SHUTDOWN: - if ((stcb == NULL) || (inp == NULL)) { - break; - } + KASSERT(inp != NULL && stcb != NULL && net != NULL, + ("timeout of type %d: inp = %p, stcb = %p, net = %p", + type, inp, stcb, net)); + SCTP_STAT_INCR(sctps_timoshutdown); + stcb->asoc.timoshutdown++; if (sctp_shutdown_timer(inp, stcb, net)) { /* no need to unlock on tcb its gone */ goto out_decr; } - SCTP_STAT_INCR(sctps_timoshutdown); - stcb->asoc.timoshutdown++; #ifdef SCTP_AUDITING_ENABLED sctp_auditing(4, inp, stcb, net); #endif sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_SHUT_TMR, SCTP_SO_NOT_LOCKED); break; case SCTP_TIMER_TYPE_HEARTBEAT: - if ((stcb == NULL) || (inp == NULL) || (net == NULL)) { - break; - } + KASSERT(inp != NULL && stcb != NULL && net != NULL, + ("timeout of type %d: inp = %p, stcb = %p, net = %p", + type, inp, stcb, net)); SCTP_STAT_INCR(sctps_timoheartbeat); stcb->asoc.timoheartbeat++; if (sctp_heartbeat_timer(inp, stcb, net)) { @@ -1828,16 +1844,15 @@ sctp_timeout_handler(void *t) } break; case SCTP_TIMER_TYPE_COOKIE: - if ((stcb == NULL) || (inp == NULL)) { - break; - } - + KASSERT(inp != NULL && stcb != NULL && net != NULL, + ("timeout of type %d: inp = %p, stcb = %p, net = %p", + type, inp, stcb, net)); + SCTP_STAT_INCR(sctps_timocookie); + stcb->asoc.timocookie++; if (sctp_cookie_timer(inp, stcb, net)) { /* no need to unlock on tcb its gone */ goto out_decr; } - SCTP_STAT_INCR(sctps_timocookie); - stcb->asoc.timocookie++; #ifdef SCTP_AUDITING_ENABLED sctp_auditing(4, inp, stcb, net); #endif @@ -1848,44 +1863,39 @@ sctp_timeout_handler(void *t) sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_T3, SCTP_SO_NOT_LOCKED); break; case SCTP_TIMER_TYPE_NEWCOOKIE: - { - struct timeval tv; - int i, secret; - - if (inp == NULL) { - break; - } - SCTP_STAT_INCR(sctps_timosecret); - (void)SCTP_GETTIME_TIMEVAL(&tv); - inp->sctp_ep.time_of_secret_change = tv.tv_sec; - inp->sctp_ep.last_secret_number = - inp->sctp_ep.current_secret_number; - inp->sctp_ep.current_secret_number++; - if (inp->sctp_ep.current_secret_number >= - SCTP_HOW_MANY_SECRETS) { - inp->sctp_ep.current_secret_number = 0; - } - secret = (int)inp->sctp_ep.current_secret_number; - for (i = 0; i < SCTP_NUMBER_OF_SECRETS; i++) { - inp->sctp_ep.secret_key[secret][i] = - sctp_select_initial_TSN(&inp->sctp_ep); - } - sctp_timer_start(SCTP_TIMER_TYPE_NEWCOOKIE, inp, NULL, NULL); + KASSERT(inp != NULL && stcb == NULL && net == NULL, + ("timeout of type %d: inp = %p, stcb = %p, net = %p", + type, inp, stcb, net)); + SCTP_STAT_INCR(sctps_timosecret); + (void)SCTP_GETTIME_TIMEVAL(&tv); + inp->sctp_ep.time_of_secret_change = tv.tv_sec; + inp->sctp_ep.last_secret_number = + inp->sctp_ep.current_secret_number; + inp->sctp_ep.current_secret_number++; + if (inp->sctp_ep.current_secret_number >= + SCTP_HOW_MANY_SECRETS) { + inp->sctp_ep.current_secret_number = 0; } + secret = (int)inp->sctp_ep.current_secret_number; + for (i = 0; i < SCTP_NUMBER_OF_SECRETS; i++) { + inp->sctp_ep.secret_key[secret][i] = + sctp_select_initial_TSN(&inp->sctp_ep); + } + sctp_timer_start(SCTP_TIMER_TYPE_NEWCOOKIE, inp, NULL, NULL); did_output = 0; break; case SCTP_TIMER_TYPE_PATHMTURAISE: - if ((stcb == NULL) || (inp == NULL)) { - break; - } + KASSERT(inp != NULL && stcb != NULL && net != NULL, + ("timeout of type %d: inp = %p, stcb = %p, net = %p", + type, inp, stcb, net)); SCTP_STAT_INCR(sctps_timopathmtu); sctp_pathmtu_timer(inp, stcb, net); did_output = 0; break; case SCTP_TIMER_TYPE_SHUTDOWNACK: - if ((stcb == NULL) || (inp == NULL)) { - break; - } + KASSERT(inp != NULL && stcb != NULL && net != NULL, + ("timeout of type %d: inp = %p, stcb = %p, net = %p", + type, inp, stcb, net)); if (sctp_shutdownack_timer(inp, stcb, net)) { /* no need to unlock on tcb its gone */ goto out_decr; @@ -1898,23 +1908,23 @@ sctp_timeout_handler(void *t) sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_SHUT_ACK_TMR, SCTP_SO_NOT_LOCKED); break; case SCTP_TIMER_TYPE_ASCONF: - if ((stcb == NULL) || (inp == NULL)) { - break; - } + KASSERT(inp != NULL && stcb != NULL && net != NULL, + ("timeout of type %d: inp = %p, stcb = %p, net = %p", + type, inp, stcb, net)); + SCTP_STAT_INCR(sctps_timoasconf); if (sctp_asconf_timer(inp, stcb, net)) { /* no need to unlock on tcb its gone */ goto out_decr; } - SCTP_STAT_INCR(sctps_timoasconf); #ifdef SCTP_AUDITING_ENABLED sctp_auditing(4, inp, stcb, net); #endif sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_ASCONF_TMR, SCTP_SO_NOT_LOCKED); break; case SCTP_TIMER_TYPE_SHUTDOWNGUARD: - if ((stcb == NULL) || (inp == NULL)) { - break; - } + KASSERT(inp != NULL && stcb != NULL && net == NULL, + ("timeout of type %d: inp = %p, stcb = %p, net = %p", + type, inp, stcb, net)); SCTP_STAT_INCR(sctps_timoshutdownguard); op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), "Shutdown guard timer expired"); @@ -1923,45 +1933,46 @@ sctp_timeout_handler(void *t) goto out_decr; case SCTP_TIMER_TYPE_AUTOCLOSE: - if ((stcb == NULL) || (inp == NULL)) { - break; - } + KASSERT(inp != NULL && stcb != NULL && net == NULL, + ("timeout of type %d: inp = %p, stcb = %p, net = %p", + type, inp, stcb, net)); SCTP_STAT_INCR(sctps_timoautoclose); sctp_autoclose_timer(inp, stcb); sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_AUTOCLOSE_TMR, SCTP_SO_NOT_LOCKED); did_output = 0; break; case SCTP_TIMER_TYPE_STRRESET: - if ((stcb == NULL) || (inp == NULL)) { - break; - } + KASSERT(inp != NULL && stcb != NULL && net == NULL, + ("timeout of type %d: inp = %p, stcb = %p, net = %p", + type, inp, stcb, net)); + SCTP_STAT_INCR(sctps_timostrmrst); if (sctp_strreset_timer(inp, stcb)) { /* no need to unlock on tcb its gone */ goto out_decr; } - SCTP_STAT_INCR(sctps_timostrmrst); sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_STRRST_TMR, SCTP_SO_NOT_LOCKED); break; case SCTP_TIMER_TYPE_INPKILL: + KASSERT(inp != NULL && stcb == NULL && net == NULL, + ("timeout of type %d: inp = %p, stcb = %p, net = %p", + type, inp, stcb, net)); SCTP_STAT_INCR(sctps_timoinpkill); - if (inp == NULL) { - break; - } /* * special case, take away our increment since WE are the * killer */ - SCTP_INP_DECR_REF(inp); sctp_timer_stop(SCTP_TIMER_TYPE_INPKILL, inp, NULL, NULL, SCTP_FROM_SCTPUTIL + SCTP_LOC_3); + SCTP_INP_DECR_REF(inp); + SCTP_INP_WUNLOCK(inp); sctp_inpcb_free(inp, SCTP_FREE_SHOULD_USE_ABORT, SCTP_CALLED_FROM_INPKILL_TIMER); inp = NULL; goto out_no_decr; case SCTP_TIMER_TYPE_ASOCKILL: - if ((stcb == NULL) || (inp == NULL)) { - break; - } + KASSERT(inp != NULL && stcb != NULL && net == NULL, + ("timeout of type %d: inp = %p, stcb = %p, net = %p", + type, inp, stcb, net)); SCTP_STAT_INCR(sctps_timoassockill); /* Can we free it yet? */ SCTP_INP_DECR_REF(inp); @@ -1987,19 +1998,20 @@ sctp_timeout_handler(void *t) stcb = NULL; goto out_no_decr; case SCTP_TIMER_TYPE_ADDR_WQ: + KASSERT(inp == NULL && stcb == NULL && net == NULL, + ("timeout of type %d: inp = %p, stcb = %p, net = %p", + type, inp, stcb, net)); sctp_handle_addr_wq(); break; case SCTP_TIMER_TYPE_PRIM_DELETED: - if ((stcb == NULL) || (inp == NULL)) { - break; - } - sctp_delete_prim_timer(inp, stcb); + KASSERT(inp != NULL && stcb != NULL && net == NULL, + ("timeout of type %d: inp = %p, stcb = %p, net = %p", + type, inp, stcb, net)); SCTP_STAT_INCR(sctps_timodelprim); + sctp_delete_prim_timer(inp, stcb); break; default: - SCTPDBG(SCTP_DEBUG_TIMER1, "sctp_timeout_handler:unknown timer %d\n", - type); - break; + panic("Unknown timer type %d", type); } #ifdef SCTP_AUDITING_ENABLED sctp_audit_log(0xF1, (uint8_t)type); @@ -2031,53 +2043,104 @@ out_decr: } out_no_decr: - SCTPDBG(SCTP_DEBUG_TIMER1, "Timer now complete (type = %d)\n", type); + SCTPDBG(SCTP_DEBUG_TIMER2, "Timer type = %d handler finished\n", type); CURVNET_RESTORE(); } +/*- + * The following table shows which parameters must be provided + * when calling sctp_timer_start(). For parameters not being + * provided, NULL must be used. + * + * |Name |inp |stcb|net | + * |-----------------------------|----|----|----| + * |SCTP_TIMER_TYPE_SEND |Yes |Yes |Yes | + * |SCTP_TIMER_TYPE_INIT |Yes |Yes |Yes | + * |SCTP_TIMER_TYPE_RECV |Yes |Yes |No | + * |SCTP_TIMER_TYPE_SHUTDOWN |Yes |Yes |Yes | + * |SCTP_TIMER_TYPE_HEARTBEAT |Yes |Yes |Yes | + * |SCTP_TIMER_TYPE_COOKIE |Yes |Yes |Yes | + * |SCTP_TIMER_TYPE_NEWCOOKIE |Yes |No |No | + * |SCTP_TIMER_TYPE_PATHMTURAISE |Yes |Yes |Yes | + * |SCTP_TIMER_TYPE_SHUTDOWNACK |Yes |Yes |Yes | + * |SCTP_TIMER_TYPE_ASCONF |Yes |Yes |Yes | + * |SCTP_TIMER_TYPE_SHUTDOWNGUARD|Yes |Yes |No | + * |SCTP_TIMER_TYPE_AUTOCLOSE |Yes |Yes |No | + * |SCTP_TIMER_TYPE_STRRESET |Yes |Yes |Yes | + * |SCTP_TIMER_TYPE_INPKILL |Yes |No |No | + * |SCTP_TIMER_TYPE_ASOCKILL |Yes |Yes |No | + * |SCTP_TIMER_TYPE_ADDR_WQ |No |No |No | + * |SCTP_TIMER_TYPE_PRIM_DELETED |Yes |Yes |No | + * + */ + void sctp_timer_start(int t_type, struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_nets *net) { - uint32_t to_ticks; struct sctp_timer *tmr; + uint32_t to_ticks; + uint32_t rndval, jitter; - if ((t_type != SCTP_TIMER_TYPE_ADDR_WQ) && (inp == NULL)) - return; - tmr = NULL; - if (stcb) { + to_ticks = 0; + if (stcb != NULL) { SCTP_TCB_LOCK_ASSERT(stcb); + } else if (inp != NULL) { + SCTP_INP_WLOCK_ASSERT(inp); + } else { + SCTP_WQ_ADDR_LOCK_ASSERT(); } - /* Don't restart timer on net that's been removed. */ - if (net != NULL && (net->dest_state & SCTP_ADDR_BEING_DELETED)) { - return; + if (stcb != NULL) { + /* + * Don't restart timer on association that's about to be + * killed. + */ + if ((stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) && + (t_type != SCTP_TIMER_TYPE_ASOCKILL)) { + SCTPDBG(SCTP_DEBUG_TIMER2, + "timer type %d not started: inp=%p, stcb=%p, net=%p (stcb deleted).\n", + t_type, inp, stcb, net); + return; + } + /* Don't restart timer on net that's been removed. */ + if (net != NULL && (net->dest_state & SCTP_ADDR_BEING_DELETED)) { + SCTPDBG(SCTP_DEBUG_TIMER2, + "timer type %d not started: inp=%p, stcb=%p, net=%p (net deleted).\n", + t_type, inp, stcb, net); + return; + } } switch (t_type) { case SCTP_TIMER_TYPE_SEND: - /* Here we use the RTO timer */ - { - int rto_val; - - if ((stcb == NULL) || (net == NULL)) { - return; - } - tmr = &net->rxt_timer; - if (net->RTO == 0) { - rto_val = stcb->asoc.initial_rto; - } else { - rto_val = net->RTO; - } - to_ticks = MSEC_TO_TICKS(rto_val); + /* Here we use the RTO timer. */ + if ((inp == NULL) || (stcb == NULL) || (net == NULL)) { +#ifdef INVARIANTS + panic("sctp_timer_start of type %d: inp = %p, stcb = %p, net = %p", + t_type, inp, stcb, net); +#else + return; +#endif } + tmr = &net->rxt_timer; + if (net->RTO == 0) { + to_ticks = MSEC_TO_TICKS(stcb->asoc.initial_rto); + } else { + to_ticks = MSEC_TO_TICKS(net->RTO); + } break; case SCTP_TIMER_TYPE_INIT: /* * Here we use the INIT timer default usually about 1 - * minute. + * second. */ - if ((stcb == NULL) || (net == NULL)) { + if ((inp == NULL) || (stcb == NULL) || (net == NULL)) { +#ifdef INVARIANTS + panic("sctp_timer_start of type %d: inp = %p, stcb = %p, net = %p", + t_type, inp, stcb, net); +#else return; +#endif } tmr = &net->rxt_timer; if (net->RTO == 0) { @@ -2088,175 +2151,228 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s break; case SCTP_TIMER_TYPE_RECV: /* - * Here we use the Delayed-Ack timer value from the inp + * Here we use the Delayed-Ack timer value from the inp, * ususually about 200ms. */ - if (stcb == NULL) { + if ((inp == NULL) || (stcb == NULL) || (net != NULL)) { +#ifdef INVARIANTS + panic("sctp_timer_start of type %d: inp = %p, stcb = %p, net = %p", + t_type, inp, stcb, net); +#else return; +#endif } tmr = &stcb->asoc.dack_timer; to_ticks = MSEC_TO_TICKS(stcb->asoc.delayed_ack); break; case SCTP_TIMER_TYPE_SHUTDOWN: /* Here we use the RTO of the destination. */ - if ((stcb == NULL) || (net == NULL)) { + if ((inp == NULL) || (stcb == NULL) || (net == NULL)) { +#ifdef INVARIANTS + panic("sctp_timer_start of type %d: inp = %p, stcb = %p, net = %p", + t_type, inp, stcb, net); +#else return; +#endif } + tmr = &net->rxt_timer; if (net->RTO == 0) { to_ticks = MSEC_TO_TICKS(stcb->asoc.initial_rto); } else { to_ticks = MSEC_TO_TICKS(net->RTO); } - tmr = &net->rxt_timer; break; case SCTP_TIMER_TYPE_HEARTBEAT: /* - * the net is used here so that we can add in the RTO. Even + * The net is used here so that we can add in the RTO. Even * though we use a different timer. We also add the HB timer * PLUS a random jitter. */ - if ((stcb == NULL) || (net == NULL)) { + if ((inp == NULL) || (stcb == NULL) || (net == NULL)) { +#ifdef INVARIANTS + panic("sctp_timer_start of type %d: inp = %p, stcb = %p, net = %p", + t_type, inp, stcb, net); +#else return; +#endif + } + if ((net->dest_state & SCTP_ADDR_NOHB) && + !(net->dest_state & SCTP_ADDR_UNCONFIRMED)) { + SCTPDBG(SCTP_DEBUG_TIMER2, + "timer type %d not started: inp=%p, stcb=%p, net=%p.\n", + t_type, inp, stcb, net); + return; + } + tmr = &net->hb_timer; + if (net->RTO == 0) { + to_ticks = stcb->asoc.initial_rto; } else { - uint32_t rndval; - uint32_t jitter; - - if ((net->dest_state & SCTP_ADDR_NOHB) && - !(net->dest_state & SCTP_ADDR_UNCONFIRMED)) { - return; - } - if (net->RTO == 0) { - to_ticks = stcb->asoc.initial_rto; - } else { - to_ticks = net->RTO; - } - rndval = sctp_select_initial_TSN(&inp->sctp_ep); - jitter = rndval % to_ticks; - if (jitter >= (to_ticks >> 1)) { - to_ticks = to_ticks + (jitter - (to_ticks >> 1)); - } else { - to_ticks = to_ticks - jitter; - } - if (!(net->dest_state & SCTP_ADDR_UNCONFIRMED) && - !(net->dest_state & SCTP_ADDR_PF)) { - to_ticks += net->heart_beat_delay; - } - /* - * Now we must convert the to_ticks that are now in - * ms to ticks. - */ - to_ticks = MSEC_TO_TICKS(to_ticks); - tmr = &net->hb_timer; + to_ticks = net->RTO; } + rndval = sctp_select_initial_TSN(&inp->sctp_ep); + jitter = rndval % to_ticks; + if (jitter >= (to_ticks >> 1)) { + to_ticks = to_ticks + (jitter - (to_ticks >> 1)); + } else { + to_ticks = to_ticks - jitter; + } + if (!(net->dest_state & SCTP_ADDR_UNCONFIRMED) && + !(net->dest_state & SCTP_ADDR_PF)) { + to_ticks += net->heart_beat_delay; + } + /* + * Now we must convert the to_ticks that are now in ms to + * ticks. + */ + to_ticks = MSEC_TO_TICKS(to_ticks); break; case SCTP_TIMER_TYPE_COOKIE: /* * Here we can use the RTO timer from the network since one - * RTT was compelete. If a retran happened then we will be - * using the RTO initial value. + * RTT was complete. If a retransmission happened then we + * will be using the RTO initial value. */ - if ((stcb == NULL) || (net == NULL)) { + if ((inp == NULL) || (stcb == NULL) || (net == NULL)) { +#ifdef INVARIANTS + panic("sctp_timer_start of type %d: inp = %p, stcb = %p, net = %p", + t_type, inp, stcb, net); +#else return; +#endif } + tmr = &net->rxt_timer; if (net->RTO == 0) { to_ticks = MSEC_TO_TICKS(stcb->asoc.initial_rto); } else { to_ticks = MSEC_TO_TICKS(net->RTO); } - tmr = &net->rxt_timer; break; case SCTP_TIMER_TYPE_NEWCOOKIE: /* - * nothing needed but the endpoint here ususually about 60 + * Nothing needed but the endpoint here ususually about 60 * minutes. */ + if ((inp == NULL) || (stcb != NULL) || (net != NULL)) { +#ifdef INVARIANTS + panic("sctp_timer_start of type %d: inp = %p, stcb = %p, net = %p", + t_type, inp, stcb, net); +#else + return; +#endif + } tmr = &inp->sctp_ep.signature_change; to_ticks = inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_SIGNATURE]; break; case SCTP_TIMER_TYPE_PATHMTURAISE: /* - * Here we use the value found in the EP for PMTU ususually - * about 10 minutes. + * Here we use the value found in the EP for PMTUD, + * ususually about 10 minutes. */ - if ((stcb == NULL) || (net == NULL)) { + if ((inp == NULL) || (stcb == NULL) || (net == NULL)) { +#ifdef INVARIANTS + panic("sctp_timer_start of type %d: inp = %p, stcb = %p, net = %p", + t_type, inp, stcb, net); +#else return; +#endif } if (net->dest_state & SCTP_ADDR_NO_PMTUD) { + SCTPDBG(SCTP_DEBUG_TIMER2, + "timer type %d not started: inp=%p, stcb=%p, net=%p.\n", + t_type, inp, stcb, net); return; } - to_ticks = inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_PMTU]; tmr = &net->pmtu_timer; + to_ticks = inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_PMTU]; break; case SCTP_TIMER_TYPE_SHUTDOWNACK: - /* Here we use the RTO of the destination */ - if ((stcb == NULL) || (net == NULL)) { + /* Here we use the RTO of the destination. */ + if ((inp == NULL) || (stcb == NULL) || (net == NULL)) { +#ifdef INVARIANTS + panic("sctp_timer_start of type %d: inp = %p, stcb = %p, net = %p", + t_type, inp, stcb, net); +#else return; +#endif } + tmr = &net->rxt_timer; if (net->RTO == 0) { to_ticks = MSEC_TO_TICKS(stcb->asoc.initial_rto); } else { to_ticks = MSEC_TO_TICKS(net->RTO); } - tmr = &net->rxt_timer; break; case SCTP_TIMER_TYPE_ASCONF: /* * Here the timer comes from the stcb but its value is from * the net's RTO. */ - if ((stcb == NULL) || (net == NULL)) { + if ((inp == NULL) || (stcb == NULL) || (net == NULL)) { +#ifdef INVARIANTS + panic("sctp_timer_start of type %d: inp = %p, stcb = %p, net = %p", + t_type, inp, stcb, net); +#else return; +#endif } + tmr = &stcb->asoc.asconf_timer; if (net->RTO == 0) { to_ticks = MSEC_TO_TICKS(stcb->asoc.initial_rto); } else { to_ticks = MSEC_TO_TICKS(net->RTO); } - tmr = &stcb->asoc.asconf_timer; break; case SCTP_TIMER_TYPE_SHUTDOWNGUARD: /* * Here we use the endpoints shutdown guard timer usually * about 3 minutes. */ - if (stcb == NULL) { + if ((inp == NULL) || (stcb == NULL) || (net != NULL)) { +#ifdef INVARIANTS + panic("sctp_timer_start of type %d: inp = %p, stcb = %p, net = %p", + t_type, inp, stcb, net); +#else return; +#endif } + tmr = &stcb->asoc.shut_guard_timer; if (inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_MAXSHUTDOWN] == 0) { to_ticks = 5 * MSEC_TO_TICKS(stcb->asoc.maxrto); } else { to_ticks = inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_MAXSHUTDOWN]; } - tmr = &stcb->asoc.shut_guard_timer; break; case SCTP_TIMER_TYPE_AUTOCLOSE: - if (stcb == NULL) { + if ((inp == NULL) || (stcb == NULL) || (net != NULL)) { +#ifdef INVARIANTS + panic("sctp_timer_start of type %d: inp = %p, stcb = %p, net = %p", + t_type, inp, stcb, net); +#else return; +#endif } - if (stcb->asoc.sctp_autoclose_ticks == 0) { - /* - * Really an error since stcb is NOT set to - * autoclose - */ - return; - } - to_ticks = stcb->asoc.sctp_autoclose_ticks; tmr = &stcb->asoc.autoclose_timer; + to_ticks = stcb->asoc.sctp_autoclose_ticks; break; case SCTP_TIMER_TYPE_STRRESET: /* * Here the timer comes from the stcb but its value is from * the net's RTO. */ - if ((stcb == NULL) || (net == NULL)) { + if ((inp == NULL) || (stcb == NULL) || (net == NULL)) { +#ifdef INVARIANTS + panic("sctp_timer_start of type %d: inp = %p, stcb = %p, net = %p", + t_type, inp, stcb, net); +#else return; +#endif } + tmr = &stcb->asoc.strreset_timer; if (net->RTO == 0) { to_ticks = MSEC_TO_TICKS(stcb->asoc.initial_rto); } else { to_ticks = MSEC_TO_TICKS(net->RTO); } - tmr = &stcb->asoc.strreset_timer; break; case SCTP_TIMER_TYPE_INPKILL: /* @@ -2264,47 +2380,70 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s * timer since that has stopped and we are in the GONE * state. */ + if ((inp == NULL) || (stcb != NULL) || (net != NULL)) { +#ifdef INVARIANTS + panic("sctp_timer_start of type %d: inp = %p, stcb = %p, net = %p", + t_type, inp, stcb, net); +#else + return; +#endif + } tmr = &inp->sctp_ep.signature_change; to_ticks = MSEC_TO_TICKS(SCTP_INP_KILL_TIMEOUT); break; case SCTP_TIMER_TYPE_ASOCKILL: - if (stcb == NULL) { + if ((inp == NULL) || (stcb == NULL) || (net != NULL)) { +#ifdef INVARIANTS + panic("sctp_timer_start of type %d: inp = %p, stcb = %p, net = %p", + t_type, inp, stcb, net); +#else return; +#endif } tmr = &stcb->asoc.strreset_timer; to_ticks = MSEC_TO_TICKS(SCTP_ASOC_KILL_TIMEOUT); break; case SCTP_TIMER_TYPE_ADDR_WQ: + if ((inp != NULL) || (stcb != NULL) || (net != NULL)) { +#ifdef INVARIANTS + panic("sctp_timer_start of type %d: inp = %p, stcb = %p, net = %p", + t_type, inp, stcb, net); +#else + return; +#endif + } /* Only 1 tick away :-) */ tmr = &SCTP_BASE_INFO(addr_wq_timer); to_ticks = SCTP_ADDRESS_TICK_DELAY; break; case SCTP_TIMER_TYPE_PRIM_DELETED: - if ((stcb == NULL) || (net != NULL)) { + if ((inp == NULL) || (stcb == NULL) || (net != NULL)) { +#ifdef INVARIANTS + panic("sctp_timer_start of type %d: inp = %p, stcb = %p, net = %p", + t_type, inp, stcb, net); +#else return; +#endif } - to_ticks = MSEC_TO_TICKS(stcb->asoc.initial_rto); tmr = &stcb->asoc.delete_prim_timer; + to_ticks = MSEC_TO_TICKS(stcb->asoc.initial_rto); break; default: - SCTPDBG(SCTP_DEBUG_TIMER1, "%s: Unknown timer type %d\n", - __func__, t_type); - return; - break; + panic("Unknown timer type %d", t_type); } - if ((to_ticks <= 0) || (tmr == NULL)) { - SCTPDBG(SCTP_DEBUG_TIMER1, "%s: %d:software error to_ticks:%d tmr:%p not set ??\n", - __func__, t_type, to_ticks, (void *)tmr); - return; - } + KASSERT(tmr != NULL, ("tmr is NULL for timer type %d", t_type)); + KASSERT(to_ticks > 0, ("to_ticks == 0 for timer type %d", t_type)); if (SCTP_OS_TIMER_PENDING(&tmr->timer)) { /* - * we do NOT allow you to have it already running. if it is - * we leave the current one up unchanged + * We do NOT allow you to have it already running. If it is, + * we leave the current one up unchanged. */ + SCTPDBG(SCTP_DEBUG_TIMER2, + "timer type %d already running: inp=%p, stcb=%p, net=%p.\n", + t_type, inp, stcb, net); return; } - /* At this point we can proceed */ + /* At this point we can proceed. */ if (t_type == SCTP_TIMER_TYPE_SEND) { stcb->asoc.num_send_timers_up++; } @@ -2312,106 +2451,212 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s tmr->type = t_type; tmr->ep = (void *)inp; tmr->tcb = (void *)stcb; - tmr->net = (void *)net; + if (t_type == SCTP_TIMER_TYPE_STRRESET) { + tmr->net = NULL; + } else { + tmr->net = (void *)net; + } tmr->self = (void *)tmr; tmr->vnet = (void *)curvnet; tmr->ticks = sctp_get_tick_count(); - (void)SCTP_OS_TIMER_START(&tmr->timer, to_ticks, sctp_timeout_handler, tmr); + if (SCTP_OS_TIMER_START(&tmr->timer, to_ticks, sctp_timeout_handler, tmr) == 0) { + SCTPDBG(SCTP_DEBUG_TIMER2, + "timer type %d started: ticks=%u, inp=%p, stcb=%p, net=%p.\n", + t_type, to_ticks, inp, stcb, net); + } else { + /* + * This should not happen, since we checked for pending + * above. + */ + SCTPDBG(SCTP_DEBUG_TIMER2, + "timer type %d restarted: ticks=%u, inp=%p, stcb=%p, net=%p.\n", + t_type, to_ticks, inp, stcb, net); + } return; } +/*- + * The following table shows which parameters must be provided + * when calling sctp_timer_stop(). For parameters not being + * provided, NULL must be used. + * + * |Name |inp |stcb|net | + * |-----------------------------|----|----|----| + * |SCTP_TIMER_TYPE_SEND |Yes |Yes |Yes | + * |SCTP_TIMER_TYPE_INIT |Yes |Yes |Yes | + * |SCTP_TIMER_TYPE_RECV |Yes |Yes |No | + * |SCTP_TIMER_TYPE_SHUTDOWN |Yes |Yes |Yes | + * |SCTP_TIMER_TYPE_HEARTBEAT |Yes |Yes |Yes | + * |SCTP_TIMER_TYPE_COOKIE |Yes |Yes |Yes | + * |SCTP_TIMER_TYPE_NEWCOOKIE |Yes |No |No | + * |SCTP_TIMER_TYPE_PATHMTURAISE |Yes |Yes |Yes | + * |SCTP_TIMER_TYPE_SHUTDOWNACK |Yes |Yes |Yes | + * |SCTP_TIMER_TYPE_ASCONF |Yes |Yes |No | + * |SCTP_TIMER_TYPE_SHUTDOWNGUARD|Yes |Yes |No | + * |SCTP_TIMER_TYPE_AUTOCLOSE |Yes |Yes |No | *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-12@freebsd.org Sun Aug 23 22:09:21 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1A3B43CD08D; Sun, 23 Aug 2020 22:09: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZTtm6wrsz4ctp; Sun, 23 Aug 2020 22:09:20 +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 D11A1E393; Sun, 23 Aug 2020 22:09:20 +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 07NM9KIU086074; Sun, 23 Aug 2020 22:09:20 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NM9K5S086073; Sun, 23 Aug 2020 22:09:20 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232209.07NM9K5S086073@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 22:09:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364565 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364565 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 22:09:21 -0000 Author: tuexen Date: Sun Aug 23 22:09:20 2020 New Revision: 364565 URL: https://svnweb.freebsd.org/changeset/base/364565 Log: MFC r359288: Only call panic when building with INVARIANTS. Modified: stable/12/sys/netinet/sctputil.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctputil.c ============================================================================== --- stable/12/sys/netinet/sctputil.c Sun Aug 23 22:07:49 2020 (r364564) +++ stable/12/sys/netinet/sctputil.c Sun Aug 23 22:09:20 2020 (r364565) @@ -2011,7 +2011,11 @@ sctp_timeout_handler(void *t) sctp_delete_prim_timer(inp, stcb); break; default: +#ifdef INVARIANTS panic("Unknown timer type %d", type); +#else + goto get_out; +#endif } #ifdef SCTP_AUDITING_ENABLED sctp_audit_log(0xF1, (uint8_t)type); @@ -2429,7 +2433,11 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s to_ticks = MSEC_TO_TICKS(stcb->asoc.initial_rto); break; default: +#ifdef INVARIANTS panic("Unknown timer type %d", t_type); +#else + return; +#endif } KASSERT(tmr != NULL, ("tmr is NULL for timer type %d", t_type)); KASSERT(to_ticks > 0, ("to_ticks == 0 for timer type %d", t_type)); @@ -2710,7 +2718,11 @@ sctp_timer_stop(int t_type, struct sctp_inpcb *inp, st tmr = &stcb->asoc.delete_prim_timer; break; default: +#ifdef INVARIANTS panic("Unknown timer type %d", t_type); +#else + return; +#endif } KASSERT(tmr != NULL, ("tmr is NULL for timer type %d", t_type)); if ((tmr->type != SCTP_TIMER_TYPE_NONE) && From owner-svn-src-stable-12@freebsd.org Sun Aug 23 22:12:55 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DB85C3CD03B; Sun, 23 Aug 2020 22:12:55 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZTyv5RChz4d4m; Sun, 23 Aug 2020 22:12:55 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 9DBEEE88C; Sun, 23 Aug 2020 22:12:55 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07NMCtcI091900; Sun, 23 Aug 2020 22:12:55 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NMCt5r091899; Sun, 23 Aug 2020 22:12:55 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008232212.07NMCt5r091899@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Aug 2020 22:12:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364566 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364566 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 22:12:55 -0000 Author: trasz Date: Sun Aug 23 22:12:55 2020 New Revision: 364566 URL: https://svnweb.freebsd.org/changeset/base/364566 Log: MFC r362052: Improve the warnings. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linux/linux_futex.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_futex.c ============================================================================== --- stable/12/sys/compat/linux/linux_futex.c Sun Aug 23 22:09:20 2020 (r364565) +++ stable/12/sys/compat/linux/linux_futex.c Sun Aug 23 22:12:55 2020 (r364566) @@ -1010,9 +1010,7 @@ retry2: /* not yet implemented */ pem = pem_find(td->td_proc); if ((pem->flags & LINUX_XUNSUP_FUTEXPIOP) == 0) { - linux_msg(td, - "linux_sys_futex: " - "unsupported futex_pi op\n"); + linux_msg(td, "unsupported FUTEX_LOCK_PI"); pem->flags |= LINUX_XUNSUP_FUTEXPIOP; LIN_SDT_PROBE0(futex, linux_sys_futex, unimplemented_lock_pi); @@ -1024,9 +1022,7 @@ retry2: /* not yet implemented */ pem = pem_find(td->td_proc); if ((pem->flags & LINUX_XUNSUP_FUTEXPIOP) == 0) { - linux_msg(td, - "linux_sys_futex: " - "unsupported futex_pi op\n"); + linux_msg(td, "unsupported FUTEX_UNLOCK_PI"); pem->flags |= LINUX_XUNSUP_FUTEXPIOP; LIN_SDT_PROBE0(futex, linux_sys_futex, unimplemented_unlock_pi); @@ -1038,9 +1034,7 @@ retry2: /* not yet implemented */ pem = pem_find(td->td_proc); if ((pem->flags & LINUX_XUNSUP_FUTEXPIOP) == 0) { - linux_msg(td, - "linux_sys_futex: " - "unsupported futex_pi op\n"); + linux_msg(td, "unsupported FUTEX_TRYLOCK_PI"); pem->flags |= LINUX_XUNSUP_FUTEXPIOP; LIN_SDT_PROBE0(futex, linux_sys_futex, unimplemented_trylock_pi); @@ -1057,9 +1051,7 @@ retry2: */ pem = pem_find(td->td_proc); if ((pem->flags & LINUX_XDEPR_REQUEUEOP) == 0) { - linux_msg(td, - "linux_sys_futex: " - "unsupported futex_requeue op\n"); + linux_msg(td, "unsupported FUTEX_REQUEUE"); pem->flags |= LINUX_XDEPR_REQUEUEOP; LIN_SDT_PROBE0(futex, linux_sys_futex, deprecated_requeue); @@ -1072,9 +1064,7 @@ retry2: /* not yet implemented */ pem = pem_find(td->td_proc); if ((pem->flags & LINUX_XUNSUP_FUTEXPIOP) == 0) { - linux_msg(td, - "linux_sys_futex: " - "unsupported futex_pi op\n"); + linux_msg(td, "unsupported FUTEX_WAIT_REQUEUE_PI"); pem->flags |= LINUX_XUNSUP_FUTEXPIOP; LIN_SDT_PROBE0(futex, linux_sys_futex, unimplemented_wait_requeue_pi); @@ -1086,9 +1076,7 @@ retry2: /* not yet implemented */ pem = pem_find(td->td_proc); if ((pem->flags & LINUX_XUNSUP_FUTEXPIOP) == 0) { - linux_msg(td, - "linux_sys_futex: " - "unsupported futex_pi op\n"); + linux_msg(td, "unsupported FUTEX_CMP_REQUEUE_PI"); pem->flags |= LINUX_XUNSUP_FUTEXPIOP; LIN_SDT_PROBE0(futex, linux_sys_futex, unimplemented_cmp_requeue_pi); @@ -1097,8 +1085,7 @@ retry2: return (ENOSYS); default: - linux_msg(td, - "linux_sys_futex: unknown op %d\n", args->op); + linux_msg(td, "unsupported futex op %d\n", args->op); LIN_SDT_PROBE1(futex, linux_sys_futex, unknown_operation, args->op); LIN_SDT_PROBE1(futex, linux_sys_futex, return, ENOSYS); From owner-svn-src-stable-12@freebsd.org Sun Aug 23 22:13:58 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 78D6C3CCF6E; Sun, 23 Aug 2020 22:13: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZV062fwJz4dcr; Sun, 23 Aug 2020 22:13: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 3EA1AE440; Sun, 23 Aug 2020 22:13: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 07NMDwfd092020; Sun, 23 Aug 2020 22:13:58 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NMDwMS092019; Sun, 23 Aug 2020 22:13:58 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232213.07NMDwMS092019@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 22:13:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364567 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364567 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 22:13:58 -0000 Author: tuexen Date: Sun Aug 23 22:13:57 2020 New Revision: 364567 URL: https://svnweb.freebsd.org/changeset/base/364567 Log: MFC r359300: Don't restore the vnet too early in error cases. Modified: stable/12/sys/netinet/sctputil.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctputil.c ============================================================================== --- stable/12/sys/netinet/sctputil.c Sun Aug 23 22:12:55 2020 (r364566) +++ stable/12/sys/netinet/sctputil.c Sun Aug 23 22:13:57 2020 (r364567) @@ -1669,10 +1669,10 @@ sctp_timeout_handler(void *t) (type != SCTP_TIMER_TYPE_SHUTDOWNGUARD) && (type != SCTP_TIMER_TYPE_ASOCKILL))) { SCTP_INP_DECR_REF(inp); - CURVNET_RESTORE(); SCTPDBG(SCTP_DEBUG_TIMER2, "Timer type = %d handler exiting due to closed socket\n", type); + CURVNET_RESTORE(); return; } } @@ -1684,10 +1684,10 @@ sctp_timeout_handler(void *t) if (inp) { SCTP_INP_DECR_REF(inp); } - CURVNET_RESTORE(); SCTPDBG(SCTP_DEBUG_TIMER2, "Timer type = %d handler exiting due to CLOSED association\n", type); + CURVNET_RESTORE(); return; } } @@ -1700,10 +1700,10 @@ sctp_timeout_handler(void *t) if (stcb) { atomic_add_int(&stcb->asoc.refcnt, -1); } - CURVNET_RESTORE(); SCTPDBG(SCTP_DEBUG_TIMER2, "Timer type = %d handler exiting due to not being active\n", type); + CURVNET_RESTORE(); return; } tmr->stopped_from = 0xa004; @@ -1718,10 +1718,10 @@ sctp_timeout_handler(void *t) if (inp) { SCTP_INP_DECR_REF(inp); } - CURVNET_RESTORE(); SCTPDBG(SCTP_DEBUG_TIMER2, "Timer type = %d handler exiting due to CLOSED association\n", type); + CURVNET_RESTORE(); return; } } else if (inp != NULL) { From owner-svn-src-stable-12@freebsd.org Sun Aug 23 22:16:03 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E142A3CD072; Sun, 23 Aug 2020 22:16: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZV2W5Mh5z4dYg; Sun, 23 Aug 2020 22:16: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 9AE48E81C; Sun, 23 Aug 2020 22:16: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 07NMG3ND092302; Sun, 23 Aug 2020 22:16:03 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NMG3hB092301; Sun, 23 Aug 2020 22:16:03 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232216.07NMG3hB092301@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 22:16:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364568 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364568 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 22:16:04 -0000 Author: tuexen Date: Sun Aug 23 22:16:03 2020 New Revision: 364568 URL: https://svnweb.freebsd.org/changeset/base/364568 Log: MFC r359301: Use consistent debug output. Modified: stable/12/sys/netinet/sctputil.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctputil.c ============================================================================== --- stable/12/sys/netinet/sctputil.c Sun Aug 23 22:13:57 2020 (r364567) +++ stable/12/sys/netinet/sctputil.c Sun Aug 23 22:16:03 2020 (r364568) @@ -1670,7 +1670,7 @@ sctp_timeout_handler(void *t) (type != SCTP_TIMER_TYPE_ASOCKILL))) { SCTP_INP_DECR_REF(inp); SCTPDBG(SCTP_DEBUG_TIMER2, - "Timer type = %d handler exiting due to closed socket\n", + "Timer type %d handler exiting due to closed socket.\n", type); CURVNET_RESTORE(); return; @@ -1685,7 +1685,7 @@ sctp_timeout_handler(void *t) SCTP_INP_DECR_REF(inp); } SCTPDBG(SCTP_DEBUG_TIMER2, - "Timer type = %d handler exiting due to CLOSED association\n", + "Timer type %d handler exiting due to CLOSED association.\n", type); CURVNET_RESTORE(); return; @@ -1701,7 +1701,7 @@ sctp_timeout_handler(void *t) atomic_add_int(&stcb->asoc.refcnt, -1); } SCTPDBG(SCTP_DEBUG_TIMER2, - "Timer type = %d handler exiting due to not being active\n", + "Timer type %d handler exiting due to not being active.\n", type); CURVNET_RESTORE(); return; @@ -1719,7 +1719,7 @@ sctp_timeout_handler(void *t) SCTP_INP_DECR_REF(inp); } SCTPDBG(SCTP_DEBUG_TIMER2, - "Timer type = %d handler exiting due to CLOSED association\n", + "Timer type %d handler exiting due to CLOSED association.\n", type); CURVNET_RESTORE(); return; @@ -2047,7 +2047,7 @@ out_decr: } out_no_decr: - SCTPDBG(SCTP_DEBUG_TIMER2, "Timer type = %d handler finished\n", type); + SCTPDBG(SCTP_DEBUG_TIMER2, "Timer type %d handler finished.\n", type); CURVNET_RESTORE(); } From owner-svn-src-stable-12@freebsd.org Sun Aug 23 22:17:29 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B7EE23CD707; Sun, 23 Aug 2020 22:17:29 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZV494XLzz4dmF; Sun, 23 Aug 2020 22:17: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 80220E71D; Sun, 23 Aug 2020 22:17: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 07NMHTqS092434; Sun, 23 Aug 2020 22:17:29 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NMHTWw092433; Sun, 23 Aug 2020 22:17:29 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232217.07NMHTWw092433@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 22:17:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364569 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364569 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 22:17:29 -0000 Author: tuexen Date: Sun Aug 23 22:17:29 2020 New Revision: 364569 URL: https://svnweb.freebsd.org/changeset/base/364569 Log: MFC r359305: Improve consistency in debug output. Modified: stable/12/sys/netinet/sctputil.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctputil.c ============================================================================== --- stable/12/sys/netinet/sctputil.c Sun Aug 23 22:16:03 2020 (r364568) +++ stable/12/sys/netinet/sctputil.c Sun Aug 23 22:17:29 2020 (r364569) @@ -1692,7 +1692,7 @@ sctp_timeout_handler(void *t) } } tmr->stopped_from = 0xa003; - SCTPDBG(SCTP_DEBUG_TIMER1, "Timer type %d goes off\n", type); + SCTPDBG(SCTP_DEBUG_TIMER2, "Timer type %d goes off.\n", type); if (!SCTP_OS_TIMER_ACTIVE(&tmr->timer)) { if (inp) { SCTP_INP_DECR_REF(inp); @@ -1729,9 +1729,9 @@ sctp_timeout_handler(void *t) } else { SCTP_WQ_ADDR_LOCK(); } - /* record in stopped what t-o occurred */ - tmr->stopped_from = type; + /* Record in stopped_from which timeout occurred. */ + tmr->stopped_from = type; /* mark as being serviced now */ if (SCTP_OS_TIMER_PENDING(&tmr->timer)) { /* @@ -2103,14 +2103,14 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s if ((stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) && (t_type != SCTP_TIMER_TYPE_ASOCKILL)) { SCTPDBG(SCTP_DEBUG_TIMER2, - "timer type %d not started: inp=%p, stcb=%p, net=%p (stcb deleted).\n", + "Timer type %d not started: inp=%p, stcb=%p, net=%p (stcb deleted).\n", t_type, inp, stcb, net); return; } /* Don't restart timer on net that's been removed. */ if (net != NULL && (net->dest_state & SCTP_ADDR_BEING_DELETED)) { SCTPDBG(SCTP_DEBUG_TIMER2, - "timer type %d not started: inp=%p, stcb=%p, net=%p (net deleted).\n", + "Timer type %d not started: inp=%p, stcb=%p, net=%p (net deleted).\n", t_type, inp, stcb, net); return; } @@ -2203,7 +2203,7 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s if ((net->dest_state & SCTP_ADDR_NOHB) && !(net->dest_state & SCTP_ADDR_UNCONFIRMED)) { SCTPDBG(SCTP_DEBUG_TIMER2, - "timer type %d not started: inp=%p, stcb=%p, net=%p.\n", + "Timer type %d not started: inp=%p, stcb=%p, net=%p.\n", t_type, inp, stcb, net); return; } @@ -2282,7 +2282,7 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s } if (net->dest_state & SCTP_ADDR_NO_PMTUD) { SCTPDBG(SCTP_DEBUG_TIMER2, - "timer type %d not started: inp=%p, stcb=%p, net=%p.\n", + "Timer type %d not started: inp=%p, stcb=%p, net=%p.\n", t_type, inp, stcb, net); return; } @@ -2447,7 +2447,7 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s * we leave the current one up unchanged. */ SCTPDBG(SCTP_DEBUG_TIMER2, - "timer type %d already running: inp=%p, stcb=%p, net=%p.\n", + "Timer type %d already running: inp=%p, stcb=%p, net=%p.\n", t_type, inp, stcb, net); return; } @@ -2469,7 +2469,7 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s tmr->ticks = sctp_get_tick_count(); if (SCTP_OS_TIMER_START(&tmr->timer, to_ticks, sctp_timeout_handler, tmr) == 0) { SCTPDBG(SCTP_DEBUG_TIMER2, - "timer type %d started: ticks=%u, inp=%p, stcb=%p, net=%p.\n", + "Timer type %d started: ticks=%u, inp=%p, stcb=%p, net=%p.\n", t_type, to_ticks, inp, stcb, net); } else { /* @@ -2477,7 +2477,7 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s * above. */ SCTPDBG(SCTP_DEBUG_TIMER2, - "timer type %d restarted: ticks=%u, inp=%p, stcb=%p, net=%p.\n", + "Timer type %d restarted: ticks=%u, inp=%p, stcb=%p, net=%p.\n", t_type, to_ticks, inp, stcb, net); } return; @@ -2734,7 +2734,7 @@ sctp_timer_stop(int t_type, struct sctp_inpcb *inp, st * return. */ SCTPDBG(SCTP_DEBUG_TIMER2, - "shared timer type %d not running: inp=%p, stcb=%p, net=%p.\n", + "Shared timer type %d not running: inp=%p, stcb=%p, net=%p.\n", t_type, inp, stcb, net); return; } @@ -2758,14 +2758,14 @@ sctp_timer_stop(int t_type, struct sctp_inpcb *inp, st ("sctp_timer_stop of type %d: net = %p, tmr->net = %p", t_type, net, tmr->net)); SCTPDBG(SCTP_DEBUG_TIMER2, - "timer type %d stopped: inp=%p, stcb=%p, net=%p.\n", + "Timer type %d stopped: inp=%p, stcb=%p, net=%p.\n", t_type, inp, stcb, net); tmr->ep = NULL; tmr->tcb = NULL; tmr->net = NULL; } else { SCTPDBG(SCTP_DEBUG_TIMER2, - "timer type %d not stopped: inp=%p, stcb=%p, net=%p.\n", + "Timer type %d not stopped: inp=%p, stcb=%p, net=%p.\n", t_type, inp, stcb, net); } return; From owner-svn-src-stable-12@freebsd.org Sun Aug 23 22:19:40 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 31B183CD79F; Sun, 23 Aug 2020 22:19: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZV6h0YFKz4f7S; Sun, 23 Aug 2020 22:19: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 E6059E71E; Sun, 23 Aug 2020 22:19: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 07NMJduT092595; Sun, 23 Aug 2020 22:19:39 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NMJdVd092594; Sun, 23 Aug 2020 22:19:39 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232219.07NMJdVd092594@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 22:19:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364570 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364570 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 22:19:40 -0000 Author: tuexen Date: Sun Aug 23 22:19:39 2020 New Revision: 364570 URL: https://svnweb.freebsd.org/changeset/base/364570 Log: MFC r359306: Remove an optimization, which was incorrect a couple of times and therefore doesn't seem worth to be there. In this case COOKIE where not retransmitted anymore, when the socket was already closed. Modified: stable/12/sys/netinet/sctputil.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctputil.c ============================================================================== --- stable/12/sys/netinet/sctputil.c Sun Aug 23 22:17:29 2020 (r364569) +++ stable/12/sys/netinet/sctputil.c Sun Aug 23 22:19:39 2020 (r364570) @@ -1655,28 +1655,10 @@ sctp_timeout_handler(void *t) KASSERT(tmr->self == tmr, ("tmr->self corrupted")); KASSERT(SCTP_IS_TIMER_TYPE_VALID(tmr->type), ("Invalid timer type %d", tmr->type)); type = tmr->type; - tmr->stopped_from = 0xa001; if (inp) { SCTP_INP_INCR_REF(inp); - if ((inp->sctp_socket == NULL) && - ((type != SCTP_TIMER_TYPE_INPKILL) && - (type != SCTP_TIMER_TYPE_INIT) && - (type != SCTP_TIMER_TYPE_SEND) && - (type != SCTP_TIMER_TYPE_RECV) && - (type != SCTP_TIMER_TYPE_HEARTBEAT) && - (type != SCTP_TIMER_TYPE_SHUTDOWN) && - (type != SCTP_TIMER_TYPE_SHUTDOWNACK) && - (type != SCTP_TIMER_TYPE_SHUTDOWNGUARD) && - (type != SCTP_TIMER_TYPE_ASOCKILL))) { - SCTP_INP_DECR_REF(inp); - SCTPDBG(SCTP_DEBUG_TIMER2, - "Timer type %d handler exiting due to closed socket.\n", - type); - CURVNET_RESTORE(); - return; - } } - tmr->stopped_from = 0xa002; + tmr->stopped_from = 0xa001; if (stcb) { atomic_add_int(&stcb->asoc.refcnt, 1); if (stcb->asoc.state == 0) { @@ -1691,7 +1673,7 @@ sctp_timeout_handler(void *t) return; } } - tmr->stopped_from = 0xa003; + tmr->stopped_from = 0xa002; SCTPDBG(SCTP_DEBUG_TIMER2, "Timer type %d goes off.\n", type); if (!SCTP_OS_TIMER_ACTIVE(&tmr->timer)) { if (inp) { @@ -1706,8 +1688,8 @@ sctp_timeout_handler(void *t) CURVNET_RESTORE(); return; } - tmr->stopped_from = 0xa004; + tmr->stopped_from = 0xa003; if (stcb) { SCTP_TCB_LOCK(stcb); atomic_add_int(&stcb->asoc.refcnt, -1); From owner-svn-src-stable-12@freebsd.org Sun Aug 23 22:21:37 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9FE833CD637; Sun, 23 Aug 2020 22:21:37 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZV8x3pmyz4fC2; Sun, 23 Aug 2020 22:21:37 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 66473E898; Sun, 23 Aug 2020 22:21:37 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07NMLbF1097557; Sun, 23 Aug 2020 22:21:37 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NMLb3g097556; Sun, 23 Aug 2020 22:21:37 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008232221.07NMLb3g097556@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Aug 2020 22:21:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364571 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364571 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 22:21:37 -0000 Author: trasz Date: Sun Aug 23 22:21:36 2020 New Revision: 364571 URL: https://svnweb.freebsd.org/changeset/base/364571 Log: MFC r356172: Make Linux stat(2) et al distinguish between block and character devices. It's required for LTP, among other things. It's not complete, but good enough for now. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linux/linux_stats.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_stats.c ============================================================================== --- stable/12/sys/compat/linux/linux_stats.c Sun Aug 23 22:19:39 2020 (r364570) +++ stable/12/sys/compat/linux/linux_stats.c Sun Aug 23 22:21:36 2020 (r364571) @@ -65,6 +65,11 @@ translate_vnhook_major_minor(struct vnode *vp, struct { int major, minor; + if (vn_isdisk(vp, NULL)) { + sb->st_mode &= ~S_IFMT; + sb->st_mode |= S_IFBLK; + } + if (vp->v_type == VCHR && vp->v_rdev != NULL && linux_driver_get_major_minor(devtoname(vp->v_rdev), &major, &minor) == 0) { @@ -114,6 +119,10 @@ translate_fd_major_minor(struct thread *td, int fd, st fget(td, fd, &cap_no_rights, &fp) != 0) return; vp = fp->f_vnode; + if (vp != NULL && vn_isdisk(vp, NULL)) { + buf->st_mode &= ~S_IFMT; + buf->st_mode |= S_IFBLK; + } if (vp != NULL && vp->v_rdev != NULL && linux_driver_get_major_minor(devtoname(vp->v_rdev), &major, &minor) == 0) { From owner-svn-src-stable-12@freebsd.org Sun Aug 23 22:23:19 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B12113CD4FE; Sun, 23 Aug 2020 22:23:19 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZVBv4FFNz4fLh; Sun, 23 Aug 2020 22:23:19 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 758F8E926; Sun, 23 Aug 2020 22:23:19 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07NMNJtO098716; Sun, 23 Aug 2020 22:23:19 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NMNJv6098715; Sun, 23 Aug 2020 22:23:19 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008232223.07NMNJv6098715@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Aug 2020 22:23:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364572 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364572 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 22:23:19 -0000 Author: trasz Date: Sun Aug 23 22:23:19 2020 New Revision: 364572 URL: https://svnweb.freebsd.org/changeset/base/364572 Log: MFC r363093: Make linux stat(2) return the same st_dev for every devfs instance. The reason for this is to work around an idiosyncrasy of glibc getttynam(3) implementation: it checks whether st_dev returned for fd 0 is the same as st_dev returned for the target of /proc/self/fd/0 symlink, and with linux chroots having their own devfs instance, the check will fail if you chrooted into it. PR: kern/240767 Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linux/linux_stats.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_stats.c ============================================================================== --- stable/12/sys/compat/linux/linux_stats.c Sun Aug 23 22:21:36 2020 (r364571) +++ stable/12/sys/compat/linux/linux_stats.c Sun Aug 23 22:23:19 2020 (r364572) @@ -70,6 +70,17 @@ translate_vnhook_major_minor(struct vnode *vp, struct sb->st_mode |= S_IFBLK; } + /* + * Return the same st_dev for every devfs instance. The reason + * for this is to work around an idiosyncrasy of glibc getttynam() + * implementation: it checks whether st_dev returned for fd 0 + * is the same as st_dev returned for the target of /proc/self/fd/0 + * symlink, and with linux chroots having their own devfs instance, + * the check will fail if you chroot into it. + */ + if (rootdevmp != NULL && vp->v_mount->mnt_vfc == rootdevmp->mnt_vfc) + sb->st_dev = rootdevmp->mnt_stat.f_fsid.val[0]; + if (vp->v_type == VCHR && vp->v_rdev != NULL && linux_driver_get_major_minor(devtoname(vp->v_rdev), &major, &minor) == 0) { @@ -110,6 +121,7 @@ translate_fd_major_minor(struct thread *td, int fd, st { struct file *fp; struct vnode *vp; + struct mount *mp; int major, minor; /* @@ -122,6 +134,12 @@ translate_fd_major_minor(struct thread *td, int fd, st if (vp != NULL && vn_isdisk(vp, NULL)) { buf->st_mode &= ~S_IFMT; buf->st_mode |= S_IFBLK; + } + if (vp != NULL && rootdevmp != NULL) { + mp = vp->v_mount; + __compiler_membar(); + if (mp != NULL && mp->mnt_vfc == rootdevmp->mnt_vfc) + buf->st_dev = rootdevmp->mnt_stat.f_fsid.val[0]; } if (vp != NULL && vp->v_rdev != NULL && linux_driver_get_major_minor(devtoname(vp->v_rdev), From owner-svn-src-stable-12@freebsd.org Sun Aug 23 22:24:49 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 457C93CDAD1; Sun, 23 Aug 2020 22:24: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZVDc0nLDz4fm9; Sun, 23 Aug 2020 22:24: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 A3D83E470; Sun, 23 Aug 2020 22:24: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 07NMOlXi099008; Sun, 23 Aug 2020 22:24:47 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NMOkrq099006; Sun, 23 Aug 2020 22:24:46 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232224.07NMOkrq099006@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 22:24:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364573 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364573 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 22:24:49 -0000 Author: tuexen Date: Sun Aug 23 22:24:46 2020 New Revision: 364573 URL: https://svnweb.freebsd.org/changeset/base/364573 Log: MFC r359379: Some more uint32_t cleanups, no functional change. Modified: stable/12/sys/netinet/sctp_pcb.h stable/12/sys/netinet/sctp_structs.h stable/12/sys/netinet/sctp_timer.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_pcb.h ============================================================================== --- stable/12/sys/netinet/sctp_pcb.h Sun Aug 23 22:23:19 2020 (r364572) +++ stable/12/sys/netinet/sctp_pcb.h Sun Aug 23 22:24:46 2020 (r364573) @@ -273,11 +273,11 @@ struct sctp_pcb { uint32_t secret_key[SCTP_HOW_MANY_SECRETS][SCTP_NUMBER_OF_SECRETS]; unsigned int size_of_a_cookie; - unsigned int sctp_timeoutticks[SCTP_NUM_TMRS]; - unsigned int sctp_minrto; - unsigned int sctp_maxrto; - unsigned int initial_rto; - int initial_init_rto_max; + uint32_t sctp_timeoutticks[SCTP_NUM_TMRS]; + uint32_t sctp_minrto; + uint32_t sctp_maxrto; + uint32_t initial_rto; + uint32_t initial_init_rto_max; unsigned int sctp_sack_freq; uint32_t sctp_sws_sender; @@ -320,7 +320,7 @@ struct sctp_pcb { uint32_t def_cookie_life; /* defaults to 0 */ - int auto_close_time; + uint32_t auto_close_time; uint32_t initial_sequence_debug; uint32_t adaptation_layer_indicator; uint8_t adaptation_layer_indicator_provided; Modified: stable/12/sys/netinet/sctp_structs.h ============================================================================== --- stable/12/sys/netinet/sctp_structs.h Sun Aug 23 22:23:19 2020 (r364572) +++ stable/12/sys/netinet/sctp_structs.h Sun Aug 23 22:24:46 2020 (r364573) @@ -275,7 +275,7 @@ struct sctp_nets { int lastsa; int lastsv; uint64_t rtt; /* last measured rtt value in us */ - unsigned int RTO; + uint32_t RTO; /* This is used for SHUTDOWN/SHUTDOWN-ACK/SEND or INIT timers */ struct sctp_timer rxt_timer; @@ -1062,7 +1062,7 @@ struct sctp_association { uint32_t heart_beat_delay; /* autoclose */ - unsigned int sctp_autoclose_ticks; + uint32_t sctp_autoclose_ticks; /* how many preopen streams we have */ unsigned int pre_open_streams; @@ -1071,7 +1071,7 @@ struct sctp_association { unsigned int max_inbound_streams; /* the cookie life I award for any cookie, in seconds */ - unsigned int cookie_life; + uint32_t cookie_life; /* time to delay acks for */ unsigned int delayed_ack; unsigned int old_delayed_ack; @@ -1080,10 +1080,10 @@ struct sctp_association { unsigned int numduptsns; int dup_tsns[SCTP_MAX_DUP_TSNS]; - unsigned int initial_init_rto_max; /* initial RTO for INIT's */ - unsigned int initial_rto; /* initial send RTO */ - unsigned int minrto; /* per assoc RTO-MIN */ - unsigned int maxrto; /* per assoc RTO-MAX */ + uint32_t initial_init_rto_max; /* initial RTO for INIT's */ + uint32_t initial_rto; /* initial send RTO */ + uint32_t minrto; /* per assoc RTO-MIN */ + uint32_t maxrto; /* per assoc RTO-MAX */ /* authentication fields */ sctp_auth_chklist_t *local_auth_chunks; Modified: stable/12/sys/netinet/sctp_timer.c ============================================================================== --- stable/12/sys/netinet/sctp_timer.c Sun Aug 23 22:23:19 2020 (r364572) +++ stable/12/sys/netinet/sctp_timer.c Sun Aug 23 22:24:46 2020 (r364573) @@ -1524,10 +1524,10 @@ sctp_autoclose_timer(struct sctp_inpcb *inp, struct sc { struct timeval tn, *tim_touse; struct sctp_association *asoc; - int ticks_gone_by; + uint32_t ticks_gone_by; (void)SCTP_GETTIME_TIMEVAL(&tn); - if (stcb->asoc.sctp_autoclose_ticks && + if (stcb->asoc.sctp_autoclose_ticks > 0 && sctp_is_feature_on(inp, SCTP_PCB_FLAGS_AUTOCLOSE)) { /* Auto close is on */ asoc = &stcb->asoc; @@ -1539,9 +1539,8 @@ sctp_autoclose_timer(struct sctp_inpcb *inp, struct sc tim_touse = &asoc->time_last_sent; } /* Now has long enough transpired to autoclose? */ - ticks_gone_by = SEC_TO_TICKS(tn.tv_sec - tim_touse->tv_sec); - if ((ticks_gone_by > 0) && - (ticks_gone_by >= (int)asoc->sctp_autoclose_ticks)) { + ticks_gone_by = SEC_TO_TICKS((uint32_t)(tn.tv_sec - tim_touse->tv_sec)); + if (ticks_gone_by >= asoc->sctp_autoclose_ticks) { /* * autoclose time has hit, call the output routine, * which should do nothing just to be SURE we don't @@ -1584,7 +1583,7 @@ sctp_autoclose_timer(struct sctp_inpcb *inp, struct sc * No auto close at this time, reset t-o to check * later */ - int tmp; + uint32_t tmp; /* fool the timer startup to use the time left */ tmp = asoc->sctp_autoclose_ticks; From owner-svn-src-stable-12@freebsd.org Sun Aug 23 22:26:40 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ABF2F3CDBE4; Sun, 23 Aug 2020 22:26: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZVGm4RLgz4ftY; Sun, 23 Aug 2020 22:26: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 7B29FEA13; Sun, 23 Aug 2020 22:26: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 07NMQe7G099170; Sun, 23 Aug 2020 22:26:40 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NMQcFf099160; Sun, 23 Aug 2020 22:26:38 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232226.07NMQcFf099160@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 22:26:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364574 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364574 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 22:26:40 -0000 Author: tuexen Date: Sun Aug 23 22:26:38 2020 New Revision: 364574 URL: https://svnweb.freebsd.org/changeset/base/364574 Log: MFC r359405: Handle integer overflows correctly when converting msecs and secs to ticks and vice versa. These issues were caught by recently added panic() calls on INVARIANTS systems. Modified: stable/12/sys/netinet/sctp_cc_functions.c stable/12/sys/netinet/sctp_constants.h stable/12/sys/netinet/sctp_input.c stable/12/sys/netinet/sctp_pcb.c stable/12/sys/netinet/sctp_timer.c stable/12/sys/netinet/sctp_usrreq.c stable/12/sys/netinet/sctputil.c stable/12/sys/netinet/sctputil.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_cc_functions.c ============================================================================== --- stable/12/sys/netinet/sctp_cc_functions.c Sun Aug 23 22:24:46 2020 (r364573) +++ stable/12/sys/netinet/sctp_cc_functions.c Sun Aug 23 22:26:38 2020 (r364574) @@ -1914,7 +1914,7 @@ measure_rtt(struct sctp_nets *net) if (net->fast_retran_ip == 0 && net->ssthresh < 0xFFFF && htcp_ccount(&net->cc_mod.htcp_ca) > 3) { if (net->cc_mod.htcp_ca.maxRTT < net->cc_mod.htcp_ca.minRTT) net->cc_mod.htcp_ca.maxRTT = net->cc_mod.htcp_ca.minRTT; - if (net->cc_mod.htcp_ca.maxRTT < srtt && srtt <= net->cc_mod.htcp_ca.maxRTT + MSEC_TO_TICKS(20)) + if (net->cc_mod.htcp_ca.maxRTT < srtt && srtt <= net->cc_mod.htcp_ca.maxRTT + sctp_msecs_to_ticks(20)) net->cc_mod.htcp_ca.maxRTT = srtt; } } @@ -1975,7 +1975,7 @@ htcp_beta_update(struct htcp *ca, uint32_t minRTT, uin } } - if (ca->modeswitch && minRTT > (uint32_t)MSEC_TO_TICKS(10) && maxRTT) { + if (ca->modeswitch && minRTT > sctp_msecs_to_ticks(10) && maxRTT) { ca->beta = (minRTT << 7) / maxRTT; if (ca->beta < BETA_MIN) ca->beta = BETA_MIN; Modified: stable/12/sys/netinet/sctp_constants.h ============================================================================== --- stable/12/sys/netinet/sctp_constants.h Sun Aug 23 22:24:46 2020 (r364573) +++ stable/12/sys/netinet/sctp_constants.h Sun Aug 23 22:26:38 2020 (r364574) @@ -577,16 +577,6 @@ __FBSDID("$FreeBSD$"); #define SCTP_ASOC_MAX_CHUNKS_ON_QUEUE 512 -/* The conversion from time to ticks and vice versa is done by rounding - * upwards. This way we can test in the code the time to be positive and - * know that this corresponds to a positive number of ticks. - */ -#define MSEC_TO_TICKS(x) ((hz == 1000) ? x : ((((x) * hz) + 999) / 1000)) -#define TICKS_TO_MSEC(x) ((hz == 1000) ? x : ((((x) * 1000) + (hz - 1)) / hz)) - -#define SEC_TO_TICKS(x) ((x) * hz) -#define TICKS_TO_SEC(x) (((x) + (hz - 1)) / hz) - /* * Basically the minimum amount of time before I do a early FR. Making this * value to low will cause duplicate retransmissions. Modified: stable/12/sys/netinet/sctp_input.c ============================================================================== --- stable/12/sys/netinet/sctp_input.c Sun Aug 23 22:24:46 2020 (r364573) +++ stable/12/sys/netinet/sctp_input.c Sun Aug 23 22:26:38 2020 (r364574) @@ -2600,7 +2600,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, in */ (void)SCTP_GETTIME_TIMEVAL(&now); /* 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_sec = cookie->time_entered.tv_sec + sctp_ticks_to_secs(cookie->cookie_life); time_expires.tv_usec = cookie->time_entered.tv_usec; if (timevalcmp(&now, &time_expires, >)) { /* cookie is stale! */ Modified: stable/12/sys/netinet/sctp_pcb.c ============================================================================== --- stable/12/sys/netinet/sctp_pcb.c Sun Aug 23 22:24:46 2020 (r364573) +++ stable/12/sys/netinet/sctp_pcb.c Sun Aug 23 22:26:38 2020 (r364574) @@ -2553,13 +2553,13 @@ sctp_inpcb_alloc(struct socket *so, uint32_t vrf_id) m = &inp->sctp_ep; /* setup the base timeout information */ - m->sctp_timeoutticks[SCTP_TIMER_SEND] = SEC_TO_TICKS(SCTP_SEND_SEC); /* needed ? */ - m->sctp_timeoutticks[SCTP_TIMER_INIT] = SEC_TO_TICKS(SCTP_INIT_SEC); /* needed ? */ - m->sctp_timeoutticks[SCTP_TIMER_RECV] = MSEC_TO_TICKS(SCTP_BASE_SYSCTL(sctp_delayed_sack_time_default)); - m->sctp_timeoutticks[SCTP_TIMER_HEARTBEAT] = MSEC_TO_TICKS(SCTP_BASE_SYSCTL(sctp_heartbeat_interval_default)); - m->sctp_timeoutticks[SCTP_TIMER_PMTU] = SEC_TO_TICKS(SCTP_BASE_SYSCTL(sctp_pmtu_raise_time_default)); - m->sctp_timeoutticks[SCTP_TIMER_MAXSHUTDOWN] = SEC_TO_TICKS(SCTP_BASE_SYSCTL(sctp_shutdown_guard_time_default)); - m->sctp_timeoutticks[SCTP_TIMER_SIGNATURE] = SEC_TO_TICKS(SCTP_BASE_SYSCTL(sctp_secret_lifetime_default)); + m->sctp_timeoutticks[SCTP_TIMER_SEND] = sctp_secs_to_ticks(SCTP_SEND_SEC); /* needed ? */ + m->sctp_timeoutticks[SCTP_TIMER_INIT] = sctp_secs_to_ticks(SCTP_INIT_SEC); /* needed ? */ + m->sctp_timeoutticks[SCTP_TIMER_RECV] = sctp_msecs_to_ticks(SCTP_BASE_SYSCTL(sctp_delayed_sack_time_default)); + m->sctp_timeoutticks[SCTP_TIMER_HEARTBEAT] = sctp_msecs_to_ticks(SCTP_BASE_SYSCTL(sctp_heartbeat_interval_default)); + m->sctp_timeoutticks[SCTP_TIMER_PMTU] = sctp_secs_to_ticks(SCTP_BASE_SYSCTL(sctp_pmtu_raise_time_default)); + m->sctp_timeoutticks[SCTP_TIMER_MAXSHUTDOWN] = sctp_secs_to_ticks(SCTP_BASE_SYSCTL(sctp_shutdown_guard_time_default)); + m->sctp_timeoutticks[SCTP_TIMER_SIGNATURE] = sctp_secs_to_ticks(SCTP_BASE_SYSCTL(sctp_secret_lifetime_default)); /* all max/min max are in ms */ m->sctp_maxrto = SCTP_BASE_SYSCTL(sctp_rto_max_default); m->sctp_minrto = SCTP_BASE_SYSCTL(sctp_rto_min_default); @@ -2607,7 +2607,7 @@ sctp_inpcb_alloc(struct socket *so, uint32_t vrf_id) sctp_timer_start(SCTP_TIMER_TYPE_NEWCOOKIE, inp, NULL, NULL); /* How long is a cookie good for ? */ - m->def_cookie_life = MSEC_TO_TICKS(SCTP_BASE_SYSCTL(sctp_valid_cookie_life_default)); + m->def_cookie_life = sctp_msecs_to_ticks(SCTP_BASE_SYSCTL(sctp_valid_cookie_life_default)); /* * Initialize authentication parameters */ Modified: stable/12/sys/netinet/sctp_timer.c ============================================================================== --- stable/12/sys/netinet/sctp_timer.c Sun Aug 23 22:24:46 2020 (r364573) +++ stable/12/sys/netinet/sctp_timer.c Sun Aug 23 22:26:38 2020 (r364574) @@ -1539,7 +1539,7 @@ sctp_autoclose_timer(struct sctp_inpcb *inp, struct sc tim_touse = &asoc->time_last_sent; } /* Now has long enough transpired to autoclose? */ - ticks_gone_by = SEC_TO_TICKS((uint32_t)(tn.tv_sec - tim_touse->tv_sec)); + ticks_gone_by = sctp_secs_to_ticks((uint32_t)(tn.tv_sec - tim_touse->tv_sec)); if (ticks_gone_by >= asoc->sctp_autoclose_ticks) { /* * autoclose time has hit, call the output routine, Modified: stable/12/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/12/sys/netinet/sctp_usrreq.c Sun Aug 23 22:24:46 2020 (r364573) +++ stable/12/sys/netinet/sctp_usrreq.c Sun Aug 23 22:26:38 2020 (r364574) @@ -1581,7 +1581,7 @@ sctp_getopt(struct socket *so, int optname, void *optv break; case SCTP_AUTOCLOSE: if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_AUTOCLOSE)) - val = TICKS_TO_SEC(inp->sctp_ep.auto_close_time); + val = sctp_ticks_to_secs(inp->sctp_ep.auto_close_time); else val = 0; break; @@ -1993,7 +1993,7 @@ flags_out: ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) && (sack->sack_assoc_id == SCTP_FUTURE_ASSOC))) { SCTP_INP_RLOCK(inp); - sack->sack_delay = TICKS_TO_MSEC(inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_RECV]); + sack->sack_delay = sctp_ticks_to_msecs(inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_RECV]); sack->sack_freq = inp->sctp_ep.sctp_sack_freq; SCTP_INP_RUNLOCK(inp); } else { @@ -2474,7 +2474,7 @@ flags_out: /* Use endpoint defaults */ SCTP_INP_RLOCK(inp); paddrp->spp_pathmaxrxt = inp->sctp_ep.def_net_failure; - paddrp->spp_hbinterval = TICKS_TO_MSEC(inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_HEARTBEAT]); + paddrp->spp_hbinterval = sctp_ticks_to_msecs(inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_HEARTBEAT]); paddrp->spp_assoc_id = SCTP_FUTURE_ASSOC; /* get inp's default */ if (inp->sctp_ep.default_dscp & 0x01) { @@ -2746,7 +2746,7 @@ flags_out: SCTP_FIND_STCB(inp, stcb, sasoc->sasoc_assoc_id); if (stcb) { - sasoc->sasoc_cookie_life = TICKS_TO_MSEC(stcb->asoc.cookie_life); + sasoc->sasoc_cookie_life = sctp_ticks_to_msecs(stcb->asoc.cookie_life); sasoc->sasoc_asocmaxrxt = stcb->asoc.max_send_times; sasoc->sasoc_number_peer_destinations = stcb->asoc.numnets; sasoc->sasoc_peer_rwnd = stcb->asoc.peers_rwnd; @@ -2758,7 +2758,7 @@ flags_out: ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) && (sasoc->sasoc_assoc_id == SCTP_FUTURE_ASSOC))) { SCTP_INP_RLOCK(inp); - sasoc->sasoc_cookie_life = TICKS_TO_MSEC(inp->sctp_ep.def_cookie_life); + sasoc->sasoc_cookie_life = sctp_ticks_to_msecs(inp->sctp_ep.def_cookie_life); sasoc->sasoc_asocmaxrxt = inp->sctp_ep.max_send_times; sasoc->sasoc_number_peer_destinations = 0; sasoc->sasoc_peer_rwnd = 0; @@ -3836,7 +3836,7 @@ sctp_setopt(struct socket *so, int optname, void *optv * The value is in ticks. Note this does not effect * old associations, only new ones. */ - inp->sctp_ep.auto_close_time = SEC_TO_TICKS(*mopt); + inp->sctp_ep.auto_close_time = sctp_secs_to_ticks(*mopt); break; } SCTP_INP_WLOCK(inp); @@ -4233,10 +4233,12 @@ sctp_setopt(struct socket *so, int optname, void *optv SCTP_CHECK_AND_CAST(sack, optval, struct sctp_sack_info, optsize); SCTP_FIND_STCB(inp, stcb, sack->sack_assoc_id); if (sack->sack_delay) { - if (sack->sack_delay > SCTP_MAX_SACK_DELAY) - sack->sack_delay = SCTP_MAX_SACK_DELAY; - if (MSEC_TO_TICKS(sack->sack_delay) < 1) { - sack->sack_delay = TICKS_TO_MSEC(1); + if (sack->sack_delay > SCTP_MAX_SACK_DELAY) { + error = EINVAL; + if (stcb != NULL) { + SCTP_TCB_UNLOCK(stcb); + } + break; } } if (stcb) { @@ -4255,7 +4257,7 @@ sctp_setopt(struct socket *so, int optname, void *optv (sack->sack_assoc_id == SCTP_ALL_ASSOC)))) { SCTP_INP_WLOCK(inp); if (sack->sack_delay) { - inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_RECV] = MSEC_TO_TICKS(sack->sack_delay); + inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_RECV] = sctp_msecs_to_ticks(sack->sack_delay); } if (sack->sack_freq) { inp->sctp_ep.sctp_sack_freq = sack->sack_freq; @@ -5618,14 +5620,14 @@ sctp_setopt(struct socket *so, int optname, void *optv else if (paddrp->spp_hbinterval != 0) { if (paddrp->spp_hbinterval > SCTP_MAX_HB_INTERVAL) paddrp->spp_hbinterval = SCTP_MAX_HB_INTERVAL; - inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_HEARTBEAT] = MSEC_TO_TICKS(paddrp->spp_hbinterval); + inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_HEARTBEAT] = sctp_msecs_to_ticks(paddrp->spp_hbinterval); } if (paddrp->spp_flags & SPP_HB_ENABLE) { if (paddrp->spp_flags & SPP_HB_TIME_IS_ZERO) { inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_HEARTBEAT] = 0; } else if (paddrp->spp_hbinterval) { - inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_HEARTBEAT] = MSEC_TO_TICKS(paddrp->spp_hbinterval); + inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_HEARTBEAT] = sctp_msecs_to_ticks(paddrp->spp_hbinterval); } sctp_feature_off(inp, SCTP_PCB_FLAGS_DONOT_HEARTBEAT); } else if (paddrp->spp_flags & SPP_HB_DISABLE) { @@ -5740,7 +5742,7 @@ sctp_setopt(struct socket *so, int optname, void *optv if (sasoc->sasoc_asocmaxrxt) stcb->asoc.max_send_times = sasoc->sasoc_asocmaxrxt; if (sasoc->sasoc_cookie_life) { - stcb->asoc.cookie_life = MSEC_TO_TICKS(sasoc->sasoc_cookie_life); + stcb->asoc.cookie_life = sctp_msecs_to_ticks(sasoc->sasoc_cookie_life); } SCTP_TCB_UNLOCK(stcb); } else { @@ -5752,7 +5754,7 @@ sctp_setopt(struct socket *so, int optname, void *optv if (sasoc->sasoc_asocmaxrxt) inp->sctp_ep.max_send_times = sasoc->sasoc_asocmaxrxt; if (sasoc->sasoc_cookie_life) { - inp->sctp_ep.def_cookie_life = MSEC_TO_TICKS(sasoc->sasoc_cookie_life); + inp->sctp_ep.def_cookie_life = sctp_msecs_to_ticks(sasoc->sasoc_cookie_life); } SCTP_INP_WUNLOCK(inp); } else { Modified: stable/12/sys/netinet/sctputil.c ============================================================================== --- stable/12/sys/netinet/sctputil.c Sun Aug 23 22:24:46 2020 (r364573) +++ stable/12/sys/netinet/sctputil.c Sun Aug 23 22:26:38 2020 (r364574) @@ -773,6 +773,80 @@ sctp_audit_log(uint8_t ev, uint8_t fd) #endif /* + * The conversion from time to ticks and vice versa is done by rounding + * upwards. This way we can test in the code the time to be positive and + * know that this corresponds to a positive number of ticks. + */ + +uint32_t +sctp_msecs_to_ticks(uint32_t msecs) +{ + uint64_t temp; + uint32_t ticks; + + if (hz == 1000) { + ticks = msecs; + } else { + temp = (((uint64_t)msecs * hz) + 999) / 1000; + if (temp > UINT32_MAX) { + ticks = UINT32_MAX; + } else { + ticks = (uint32_t)temp; + } + } + return (ticks); +} + +uint32_t +sctp_ticks_to_msecs(uint32_t ticks) +{ + uint64_t temp; + uint32_t msecs; + + if (hz == 1000) { + msecs = ticks; + } else { + temp = (((uint64_t)ticks * 1000) + (hz - 1)) / hz; + if (temp > UINT32_MAX) { + msecs = UINT32_MAX; + } else { + msecs = (uint32_t)temp; + } + } + return (msecs); +} + +uint32_t +sctp_secs_to_ticks(uint32_t secs) +{ + uint64_t temp; + uint32_t ticks; + + temp = (uint64_t)secs * hz; + if (temp > UINT32_MAX) { + ticks = UINT32_MAX; + } else { + ticks = (uint32_t)temp; + } + return (ticks); +} + +uint32_t +sctp_ticks_to_secs(uint32_t ticks) +{ + uint64_t temp; + uint32_t secs; + + temp = ((uint64_t)ticks + (hz - 1)) / hz; + if (temp > UINT32_MAX) { + secs = UINT32_MAX; + } else { + secs = (uint32_t)temp; + } + return (secs); +} + +/* * sctp_stop_timers_for_shutdown() should be called * when entering the SHUTDOWN_SENT or SHUTDOWN_ACK_SENT * state to make sure that all timers are stopped. @@ -1065,7 +1139,7 @@ sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb SCTP_SET_STATE(stcb, SCTP_STATE_INUSE); asoc->max_burst = inp->sctp_ep.max_burst; asoc->fr_max_burst = inp->sctp_ep.fr_max_burst; - asoc->heart_beat_delay = TICKS_TO_MSEC(inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_HEARTBEAT]); + asoc->heart_beat_delay = sctp_ticks_to_msecs(inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_HEARTBEAT]); asoc->cookie_life = inp->sctp_ep.def_cookie_life; asoc->sctp_cmt_on_off = inp->sctp_cmt_on_off; asoc->ecn_supported = inp->ecn_supported; @@ -1151,7 +1225,7 @@ sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb asoc->context = inp->sctp_context; asoc->local_strreset_support = inp->local_strreset_support; asoc->def_send = inp->def_send; - asoc->delayed_ack = TICKS_TO_MSEC(inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_RECV]); + asoc->delayed_ack = sctp_ticks_to_msecs(inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_RECV]); asoc->sack_freq = inp->sctp_ep.sctp_sack_freq; asoc->pr_sctp_cnt = 0; asoc->total_output_queue_size = 0; @@ -2110,9 +2184,9 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s } tmr = &net->rxt_timer; if (net->RTO == 0) { - to_ticks = MSEC_TO_TICKS(stcb->asoc.initial_rto); + to_ticks = sctp_msecs_to_ticks(stcb->asoc.initial_rto); } else { - to_ticks = MSEC_TO_TICKS(net->RTO); + to_ticks = sctp_msecs_to_ticks(net->RTO); } break; case SCTP_TIMER_TYPE_INIT: @@ -2130,9 +2204,9 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s } tmr = &net->rxt_timer; if (net->RTO == 0) { - to_ticks = MSEC_TO_TICKS(stcb->asoc.initial_rto); + to_ticks = sctp_msecs_to_ticks(stcb->asoc.initial_rto); } else { - to_ticks = MSEC_TO_TICKS(net->RTO); + to_ticks = sctp_msecs_to_ticks(net->RTO); } break; case SCTP_TIMER_TYPE_RECV: @@ -2149,7 +2223,7 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s #endif } tmr = &stcb->asoc.dack_timer; - to_ticks = MSEC_TO_TICKS(stcb->asoc.delayed_ack); + to_ticks = sctp_msecs_to_ticks(stcb->asoc.delayed_ack); break; case SCTP_TIMER_TYPE_SHUTDOWN: /* Here we use the RTO of the destination. */ @@ -2163,9 +2237,9 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s } tmr = &net->rxt_timer; if (net->RTO == 0) { - to_ticks = MSEC_TO_TICKS(stcb->asoc.initial_rto); + to_ticks = sctp_msecs_to_ticks(stcb->asoc.initial_rto); } else { - to_ticks = MSEC_TO_TICKS(net->RTO); + to_ticks = sctp_msecs_to_ticks(net->RTO); } break; case SCTP_TIMER_TYPE_HEARTBEAT: @@ -2210,7 +2284,7 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s * Now we must convert the to_ticks that are now in ms to * ticks. */ - to_ticks = MSEC_TO_TICKS(to_ticks); + to_ticks = sctp_msecs_to_ticks(to_ticks); break; case SCTP_TIMER_TYPE_COOKIE: /* @@ -2228,9 +2302,9 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s } tmr = &net->rxt_timer; if (net->RTO == 0) { - to_ticks = MSEC_TO_TICKS(stcb->asoc.initial_rto); + to_ticks = sctp_msecs_to_ticks(stcb->asoc.initial_rto); } else { - to_ticks = MSEC_TO_TICKS(net->RTO); + to_ticks = sctp_msecs_to_ticks(net->RTO); } break; case SCTP_TIMER_TYPE_NEWCOOKIE: @@ -2283,9 +2357,9 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s } tmr = &net->rxt_timer; if (net->RTO == 0) { - to_ticks = MSEC_TO_TICKS(stcb->asoc.initial_rto); + to_ticks = sctp_msecs_to_ticks(stcb->asoc.initial_rto); } else { - to_ticks = MSEC_TO_TICKS(net->RTO); + to_ticks = sctp_msecs_to_ticks(net->RTO); } break; case SCTP_TIMER_TYPE_ASCONF: @@ -2303,9 +2377,9 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s } tmr = &stcb->asoc.asconf_timer; if (net->RTO == 0) { - to_ticks = MSEC_TO_TICKS(stcb->asoc.initial_rto); + to_ticks = sctp_msecs_to_ticks(stcb->asoc.initial_rto); } else { - to_ticks = MSEC_TO_TICKS(net->RTO); + to_ticks = sctp_msecs_to_ticks(net->RTO); } break; case SCTP_TIMER_TYPE_SHUTDOWNGUARD: @@ -2323,7 +2397,11 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s } tmr = &stcb->asoc.shut_guard_timer; if (inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_MAXSHUTDOWN] == 0) { - to_ticks = 5 * MSEC_TO_TICKS(stcb->asoc.maxrto); + if (stcb->asoc.maxrto < UINT32_MAX / 5) { + to_ticks = sctp_msecs_to_ticks(5 * stcb->asoc.maxrto); + } else { + to_ticks = sctp_msecs_to_ticks(UINT32_MAX); + } } else { to_ticks = inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_MAXSHUTDOWN]; } @@ -2355,9 +2433,9 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s } tmr = &stcb->asoc.strreset_timer; if (net->RTO == 0) { - to_ticks = MSEC_TO_TICKS(stcb->asoc.initial_rto); + to_ticks = sctp_msecs_to_ticks(stcb->asoc.initial_rto); } else { - to_ticks = MSEC_TO_TICKS(net->RTO); + to_ticks = sctp_msecs_to_ticks(net->RTO); } break; case SCTP_TIMER_TYPE_INPKILL: @@ -2375,7 +2453,7 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s #endif } tmr = &inp->sctp_ep.signature_change; - to_ticks = MSEC_TO_TICKS(SCTP_INP_KILL_TIMEOUT); + to_ticks = sctp_msecs_to_ticks(SCTP_INP_KILL_TIMEOUT); break; case SCTP_TIMER_TYPE_ASOCKILL: if ((inp == NULL) || (stcb == NULL) || (net != NULL)) { @@ -2387,7 +2465,7 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s #endif } tmr = &stcb->asoc.strreset_timer; - to_ticks = MSEC_TO_TICKS(SCTP_ASOC_KILL_TIMEOUT); + to_ticks = sctp_msecs_to_ticks(SCTP_ASOC_KILL_TIMEOUT); break; case SCTP_TIMER_TYPE_ADDR_WQ: if ((inp != NULL) || (stcb != NULL) || (net != NULL)) { @@ -2412,7 +2490,7 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s #endif } tmr = &stcb->asoc.delete_prim_timer; - to_ticks = MSEC_TO_TICKS(stcb->asoc.initial_rto); + to_ticks = sctp_msecs_to_ticks(stcb->asoc.initial_rto); break; default: #ifdef INVARIANTS Modified: stable/12/sys/netinet/sctputil.h ============================================================================== --- stable/12/sys/netinet/sctputil.h Sun Aug 23 22:24:46 2020 (r364573) +++ stable/12/sys/netinet/sctputil.h Sun Aug 23 22:26:38 2020 (r364574) @@ -392,5 +392,10 @@ void sctp_hc_set_mtu(union sctp_sockstore *, uint16_t, uint32_t sctp_hc_get_mtu(union sctp_sockstore *, uint16_t); void sctp_set_state(struct sctp_tcb *, int); void sctp_add_substate(struct sctp_tcb *, int); +uint32_t sctp_ticks_to_msecs(uint32_t); +uint32_t sctp_msecs_to_ticks(uint32_t); +uint32_t sctp_ticks_to_secs(uint32_t); +uint32_t sctp_secs_to_ticks(uint32_t); + #endif /* _KERNEL */ #endif From owner-svn-src-stable-12@freebsd.org Sun Aug 23 22:28:19 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AB4ED3CDF95; Sun, 23 Aug 2020 22:28:19 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZVJg44X6z4g5T; Sun, 23 Aug 2020 22:28:19 +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 6F0ACE8B7; Sun, 23 Aug 2020 22:28:19 +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 07NMSJqt099306; Sun, 23 Aug 2020 22:28:19 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NMSJSF099305; Sun, 23 Aug 2020 22:28:19 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232228.07NMSJSF099305@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 22:28:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364575 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364575 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 22:28:19 -0000 Author: tuexen Date: Sun Aug 23 22:28:19 2020 New Revision: 364575 URL: https://svnweb.freebsd.org/changeset/base/364575 Log: MFC r359410: Small cleanup by using a variable just assigned. Modified: stable/12/sys/netinet/sctp_usrreq.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/12/sys/netinet/sctp_usrreq.c Sun Aug 23 22:26:38 2020 (r364574) +++ stable/12/sys/netinet/sctp_usrreq.c Sun Aug 23 22:28:19 2020 (r364575) @@ -2639,8 +2639,8 @@ flags_out: net = stcb->asoc.primary_destination; if (net != NULL) { memcpy(&sstat->sstat_primary.spinfo_address, - &stcb->asoc.primary_destination->ro._l_addr, - ((struct sockaddr *)(&stcb->asoc.primary_destination->ro._l_addr))->sa_len); + &net->ro._l_addr, + ((struct sockaddr *)(&net->ro._l_addr))->sa_len); ((struct sockaddr_in *)&sstat->sstat_primary.spinfo_address)->sin_port = stcb->rport; /* * Again the user can get info from From owner-svn-src-stable-12@freebsd.org Sun Aug 23 22:30:53 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1155F3CDD53; Sun, 23 Aug 2020 22:30:53 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZVMc6djjz3RNS; Sun, 23 Aug 2020 22:30: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 C7A39E8BF; Sun, 23 Aug 2020 22:30: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 07NMUq9s001219; Sun, 23 Aug 2020 22:30:52 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NMUqdS001218; Sun, 23 Aug 2020 22:30:52 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232230.07NMUqdS001218@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 22:30:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364576 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364576 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 22:30:53 -0000 Author: tuexen Date: Sun Aug 23 22:30:52 2020 New Revision: 364576 URL: https://svnweb.freebsd.org/changeset/base/364576 Log: MFC r359657: Do more argument validation under INVARIANTS when starting/stopping an SCTP timer. Modified: stable/12/sys/netinet/sctputil.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctputil.c ============================================================================== --- stable/12/sys/netinet/sctputil.c Sun Aug 23 22:28:19 2020 (r364575) +++ stable/12/sys/netinet/sctputil.c Sun Aug 23 22:30:52 2020 (r364576) @@ -1726,9 +1726,14 @@ sctp_timeout_handler(void *t) #endif /* sanity checks... */ - KASSERT(tmr->self == tmr, ("tmr->self corrupted")); - KASSERT(SCTP_IS_TIMER_TYPE_VALID(tmr->type), ("Invalid timer type %d", tmr->type)); + KASSERT(tmr->self == tmr, + ("sctp_timeout_handler: tmr->self corrupted")); + KASSERT(SCTP_IS_TIMER_TYPE_VALID(tmr->type), + ("sctp_timeout_handler: invalid timer type %d", tmr->type)); type = tmr->type; + KASSERT(stcb == NULL || stcb->sctp_ep == inp, + ("sctp_timeout_handler of type %d: inp = %p, stcb->sctp_ep %p", + type, stcb, stcb->sctp_ep)); if (inp) { SCTP_INP_INCR_REF(inp); } @@ -2142,6 +2147,9 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s uint32_t to_ticks; uint32_t rndval, jitter; + KASSERT(stcb == NULL || stcb->sctp_ep == inp, + ("sctp_timer_start of type %d: inp = %p, stcb->sctp_ep %p", + t_type, stcb, stcb->sctp_ep)); tmr = NULL; to_ticks = 0; if (stcb != NULL) { @@ -2576,6 +2584,9 @@ sctp_timer_stop(int t_type, struct sctp_inpcb *inp, st { struct sctp_timer *tmr; + KASSERT(stcb == NULL || stcb->sctp_ep == inp, + ("sctp_timer_stop of type %d: inp = %p, stcb->sctp_ep %p", + t_type, stcb, stcb->sctp_ep)); if (stcb != NULL) { SCTP_TCB_LOCK_ASSERT(stcb); } else if (inp != NULL) { From owner-svn-src-stable-12@freebsd.org Sun Aug 23 22:34:15 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D18603CDCDB; Sun, 23 Aug 2020 22:34: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZVRW5Br9z3S5p; Sun, 23 Aug 2020 22:34: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 917E3EB98; Sun, 23 Aug 2020 22:34: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 07NMYFeh005273; Sun, 23 Aug 2020 22:34:15 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NMYFoc005272; Sun, 23 Aug 2020 22:34:15 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232234.07NMYFoc005272@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 22:34:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364577 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364577 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 22:34:15 -0000 Author: tuexen Date: Sun Aug 23 22:34:15 2020 New Revision: 364577 URL: https://svnweb.freebsd.org/changeset/base/364577 Log: MFC r360193: Improve input validation when processing AUTH chunks. Thanks to Natalie Silvanovich from Google for finding and reporting the issue found by her in the SCTP userland stack. Modified: stable/12/sys/netinet/sctp_input.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_input.c ============================================================================== --- stable/12/sys/netinet/sctp_input.c Sun Aug 23 22:30:52 2020 (r364576) +++ stable/12/sys/netinet/sctp_input.c Sun Aug 23 22:34:15 2020 (r364577) @@ -2273,8 +2273,11 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, in if (auth_skipped) { struct sctp_auth_chunk *auth; - auth = (struct sctp_auth_chunk *) - sctp_m_getptr(m, auth_offset, auth_len, auth_chunk_buf); + if (auth_len <= SCTP_PARAM_BUFFER_SIZE) { + auth = (struct sctp_auth_chunk *)sctp_m_getptr(m, auth_offset, auth_len, auth_chunk_buf); + } else { + auth = NULL; + } if ((auth == NULL) || sctp_handle_auth(stcb, auth, m, auth_offset)) { /* auth HMAC failed, dump the assoc and packet */ SCTPDBG(SCTP_DEBUG_AUTH1, From owner-svn-src-stable-12@freebsd.org Sun Aug 23 22:35:53 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6E9A33CE034; Sun, 23 Aug 2020 22:35:53 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZVTP2K6nz3S86; Sun, 23 Aug 2020 22:35:53 +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 32A11EA3C; Sun, 23 Aug 2020 22:35:53 +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 07NMZrn5005413; Sun, 23 Aug 2020 22:35:53 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NMZrO8005412; Sun, 23 Aug 2020 22:35:53 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232235.07NMZrO8005412@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 22:35:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364578 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364578 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 22:35:53 -0000 Author: tuexen Date: Sun Aug 23 22:35:52 2020 New Revision: 364578 URL: https://svnweb.freebsd.org/changeset/base/364578 Log: MFC r360209: Improve input validation when processing AUTH chunks. Thanks to Natalie Silvanovich from Google for finding and reporting the issue found by her in the SCTP userland stack. Modified: stable/12/sys/netinet/sctp_input.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_input.c ============================================================================== --- stable/12/sys/netinet/sctp_input.c Sun Aug 23 22:34:15 2020 (r364577) +++ stable/12/sys/netinet/sctp_input.c Sun Aug 23 22:35:52 2020 (r364578) @@ -2094,7 +2094,7 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, in int init_offset, initack_offset, initack_limit; int retval; int error = 0; - uint8_t auth_chunk_buf[SCTP_PARAM_BUFFER_SIZE]; + uint8_t auth_chunk_buf[SCTP_CHUNK_BUFFER_SIZE]; #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; @@ -2273,7 +2273,7 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, in if (auth_skipped) { struct sctp_auth_chunk *auth; - if (auth_len <= SCTP_PARAM_BUFFER_SIZE) { + if (auth_len <= SCTP_CHUNK_BUFFER_SIZE) { auth = (struct sctp_auth_chunk *)sctp_m_getptr(m, auth_offset, auth_len, auth_chunk_buf); } else { auth = NULL; @@ -4670,11 +4670,13 @@ sctp_process_control(struct mbuf *m, int iphlen, int * if (auth_skipped && (stcb != NULL)) { struct sctp_auth_chunk *auth; - auth = (struct sctp_auth_chunk *) - sctp_m_getptr(m, auth_offset, - auth_len, chunk_buf); - got_auth = 1; - auth_skipped = 0; + if (auth_len <= SCTP_CHUNK_BUFFER_SIZE) { + auth = (struct sctp_auth_chunk *)sctp_m_getptr(m, auth_offset, auth_len, chunk_buf); + got_auth = 1; + auth_skipped = 0; + } else { + auth = NULL; + } if ((auth == NULL) || sctp_handle_auth(stcb, auth, m, auth_offset)) { /* auth HMAC failed so dump it */ From owner-svn-src-stable-12@freebsd.org Sun Aug 23 22:39:07 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5F1313CE1D1; Sun, 23 Aug 2020 22:39: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZVY71rHBz3SNt; Sun, 23 Aug 2020 22:39: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 226DCEA3F; Sun, 23 Aug 2020 22:39: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 07NMd7LB005599; Sun, 23 Aug 2020 22:39:07 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NMd77j005598; Sun, 23 Aug 2020 22:39:07 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232239.07NMd77j005598@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 22:39:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364579 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364579 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 22:39:07 -0000 Author: tuexen Date: Sun Aug 23 22:39:06 2020 New Revision: 364579 URL: https://svnweb.freebsd.org/changeset/base/364579 Log: MFC r360662: Fix the computation of the numbers of entries of the mapping array to look at when generating a SACK. This was wrong in case of sequence numbers wrap arounds. Thanks to Gwenael FOURRE for reporting the issue for the userland stack: https://github.com/sctplab/usrsctp/issues/462 Modified: stable/12/sys/netinet/sctp_output.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_output.c ============================================================================== --- stable/12/sys/netinet/sctp_output.c Sun Aug 23 22:35:52 2020 (r364578) +++ stable/12/sys/netinet/sctp_output.c Sun Aug 23 22:39:06 2020 (r364579) @@ -10719,7 +10719,7 @@ sctp_send_sack(struct sctp_tcb *stcb, int so_locked if (highest_tsn > asoc->mapping_array_base_tsn) { siz = (((highest_tsn - asoc->mapping_array_base_tsn) + 1) + 7) / 8; } else { - siz = (((MAX_TSN - highest_tsn) + 1) + highest_tsn + 7) / 8; + siz = (((MAX_TSN - asoc->mapping_array_base_tsn) + 1) + highest_tsn + 7) / 8; } } else { sack = NULL; From owner-svn-src-stable-12@freebsd.org Sun Aug 23 22:40:39 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 601613CE316; Sun, 23 Aug 2020 22:40: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZVZv1zqVz3SDF; Sun, 23 Aug 2020 22:40: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 278AFE6C0; Sun, 23 Aug 2020 22:40: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 07NMedai005756; Sun, 23 Aug 2020 22:40:39 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NMedeb005755; Sun, 23 Aug 2020 22:40:39 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232240.07NMedeb005755@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 22:40:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364580 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364580 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 22:40:39 -0000 Author: tuexen Date: Sun Aug 23 22:40:38 2020 New Revision: 364580 URL: https://svnweb.freebsd.org/changeset/base/364580 Log: MFC r360671: Avoid underflowing a variable, which would result in taking more data from the stream queues then needed. Thanks to Timo Voelker for finding this bug and providing a fix. Modified: stable/12/sys/netinet/sctp_output.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_output.c ============================================================================== --- stable/12/sys/netinet/sctp_output.c Sun Aug 23 22:39:06 2020 (r364579) +++ stable/12/sys/netinet/sctp_output.c Sun Aug 23 22:40:38 2020 (r364580) @@ -7769,7 +7769,11 @@ 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 (space_left >= moved) { + space_left -= moved; + } else { + space_left = 0; + } if (space_left >= SCTP_DATA_CHUNK_OVERHEAD(stcb)) { space_left -= SCTP_DATA_CHUNK_OVERHEAD(stcb); } else { From owner-svn-src-stable-12@freebsd.org Sun Aug 23 22:47:09 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C23543CE49A; Sun, 23 Aug 2020 22:47:09 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZVkP4Ytxz3Sq7; Sun, 23 Aug 2020 22:47:09 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 7B636E6D1; Sun, 23 Aug 2020 22:47:09 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07NMl9Fg011572; Sun, 23 Aug 2020 22:47:09 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NMl9ao011570; Sun, 23 Aug 2020 22:47:09 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008232247.07NMl9ao011570@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Aug 2020 22:47:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364581 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364581 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 22:47:09 -0000 Author: trasz Date: Sun Aug 23 22:47:08 2020 New Revision: 364581 URL: https://svnweb.freebsd.org/changeset/base/364581 Log: MFC r356170: Implement Linux BLKGETSIZE64 ioctl. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linux/linux_ioctl.c stable/12/sys/compat/linux/linux_ioctl.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_ioctl.c ============================================================================== --- stable/12/sys/compat/linux/linux_ioctl.c Sun Aug 23 22:40:38 2020 (r364580) +++ stable/12/sys/compat/linux/linux_ioctl.c Sun Aug 23 22:47:08 2020 (r364581) @@ -286,6 +286,7 @@ linux_ioctl_disk(struct thread *td, struct linux_ioctl struct file *fp; int error; u_int sectorsize; + uint64_t blksize64; off_t mediasize; error = fget(td, args->fd, &cap_ioctl_rights, &fp); @@ -308,6 +309,15 @@ linux_ioctl_disk(struct thread *td, struct linux_ioctl return (copyout(§orsize, (void *)args->arg, sizeof(sectorsize))); break; + case LINUX_BLKGETSIZE64: + error = fo_ioctl(fp, DIOCGMEDIASIZE, + (caddr_t)&mediasize, td->td_ucred, td); + fdrop(fp, td); + if (error) + return (error); + blksize64 = mediasize;; + return (copyout(&blksize64, (void *)args->arg, + sizeof(blksize64))); case LINUX_BLKSSZGET: error = fo_ioctl(fp, DIOCGSECTORSIZE, (caddr_t)§orsize, td->td_ucred, td); Modified: stable/12/sys/compat/linux/linux_ioctl.h ============================================================================== --- stable/12/sys/compat/linux/linux_ioctl.h Sun Aug 23 22:40:38 2020 (r364580) +++ stable/12/sys/compat/linux/linux_ioctl.h Sun Aug 23 22:47:08 2020 (r364581) @@ -57,9 +57,10 @@ #define LINUX_BLKSECTSET 0x1266 #define LINUX_BLKSECTGET 0x1267 #define LINUX_BLKSSZGET 0x1268 +#define LINUX_BLKGETSIZE64 0x1272 #define LINUX_IOCTL_DISK_MIN LINUX_BLKROSET -#define LINUX_IOCTL_DISK_MAX LINUX_BLKSSZGET +#define LINUX_IOCTL_DISK_MAX LINUX_BLKGETSIZE64 /* * hdio From owner-svn-src-stable-12@freebsd.org Sun Aug 23 22:48:20 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AF76C3CE626; Sun, 23 Aug 2020 22:48:20 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZVlm48v4z3SrN; Sun, 23 Aug 2020 22:48:20 +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 71F09EC1B; Sun, 23 Aug 2020 22:48:20 +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 07NMmKS4011702; Sun, 23 Aug 2020 22:48:20 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NMmKbk011701; Sun, 23 Aug 2020 22:48:20 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232248.07NMmKbk011701@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 22:48:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364582 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364582 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 22:48:20 -0000 Author: tuexen Date: Sun Aug 23 22:48:19 2020 New Revision: 364582 URL: https://svnweb.freebsd.org/changeset/base/364582 Log: MFC r360869: Only drop DATA chunk with lower priorities as specified in RFC 7496. This issue was found by looking at a reproducer generated by syzkaller. Modified: stable/12/sys/netinet/sctp_output.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_output.c ============================================================================== --- stable/12/sys/netinet/sctp_output.c Sun Aug 23 22:47:08 2020 (r364581) +++ stable/12/sys/netinet/sctp_output.c Sun Aug 23 22:48:19 2020 (r364582) @@ -6205,11 +6205,11 @@ sctp_prune_prsctp(struct sctp_tcb *stcb, * This one is PR-SCTP AND buffer space * limited type */ - if (chk->rec.data.timetodrop.tv_sec >= (long)srcv->sinfo_timetolive) { + if (chk->rec.data.timetodrop.tv_sec > (long)srcv->sinfo_timetolive) { /* * Lower numbers equates to higher * priority so if the one we are - * looking at has a larger or equal + * looking at has a larger * priority we want to drop the data * and NOT retransmit it. */ @@ -6240,7 +6240,7 @@ sctp_prune_prsctp(struct sctp_tcb *stcb, TAILQ_FOREACH_SAFE(chk, &asoc->send_queue, sctp_next, nchk) { /* Here we must move to the sent queue and mark */ if (PR_SCTP_BUF_ENABLED(chk->flags)) { - if (chk->rec.data.timetodrop.tv_sec >= (long)srcv->sinfo_timetolive) { + if (chk->rec.data.timetodrop.tv_sec > (long)srcv->sinfo_timetolive) { if (chk->data) { /* * We release the book_size @@ -12622,7 +12622,7 @@ sctp_lower_sosend(struct socket *so, top = SCTP_HEADER_TO_CHAIN(i_pak); sndlen = SCTP_HEADER_LEN(i_pak); } - SCTPDBG(SCTP_DEBUG_OUTPUT1, "Send called addr:%p send length %zu\n", + SCTPDBG(SCTP_DEBUG_OUTPUT1, "Send called addr:%p send length %zd\n", (void *)addr, sndlen); if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) && From owner-svn-src-stable-12@freebsd.org Sun Aug 23 22:51:01 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 86C2E3CE5CE; Sun, 23 Aug 2020 22:51: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZVps32NSz3Sy5; Sun, 23 Aug 2020 22:51: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 4B7B2ED38; Sun, 23 Aug 2020 22:51: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 07NMp1gi013749; Sun, 23 Aug 2020 22:51:01 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NMp0pv013744; Sun, 23 Aug 2020 22:51:00 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232251.07NMp0pv013744@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 22:51:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364583 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364583 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 22:51:01 -0000 Author: tuexen Date: Sun Aug 23 22:50:59 2020 New Revision: 364583 URL: https://svnweb.freebsd.org/changeset/base/364583 Log: MFC r360878: Ensure that we have a path when starting the T3 RXT timer. MFC r360942: Fix a copy and paste error introduced in r360878. Modified: stable/12/sys/netinet/sctp_asconf.c stable/12/sys/netinet/sctp_indata.c stable/12/sys/netinet/sctp_input.c stable/12/sys/netinet/sctp_timer.c stable/12/sys/netinet/sctputil.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_asconf.c ============================================================================== --- stable/12/sys/netinet/sctp_asconf.c Sun Aug 23 22:48:19 2020 (r364582) +++ stable/12/sys/netinet/sctp_asconf.c Sun Aug 23 22:50:59 2020 (r364583) @@ -1033,9 +1033,14 @@ sctp_assoc_immediate_retrans(struct sctp_tcb *stcb, st (stcb->asoc.sent_queue_cnt > 0)) { struct sctp_tmit_chunk *chk; - chk = TAILQ_FIRST(&stcb->asoc.sent_queue); - sctp_timer_start(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, - stcb, chk->whoTo); + TAILQ_FOREACH(chk, &stcb->asoc.sent_queue, sctp_next) { + if (chk->whoTo != NULL) { + break; + } + } + if (chk != NULL) { + sctp_timer_start(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, chk->whoTo); + } } } return; Modified: stable/12/sys/netinet/sctp_indata.c ============================================================================== --- stable/12/sys/netinet/sctp_indata.c Sun Aug 23 22:48:19 2020 (r364582) +++ stable/12/sys/netinet/sctp_indata.c Sun Aug 23 22:50:59 2020 (r364583) @@ -4439,7 +4439,12 @@ again: } } } - if (lchk) { + for (; lchk != NULL; lchk = TAILQ_NEXT(lchk, sctp_next)) { + if (lchk->whoTo != NULL) { + break; + } + } + if (lchk != NULL) { /* Assure a timer is up */ sctp_timer_start(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, lchk->whoTo); @@ -5279,7 +5284,12 @@ again: } } } - if (lchk) { + for (; lchk != NULL; lchk = TAILQ_NEXT(lchk, sctp_next)) { + if (lchk->whoTo != NULL) { + break; + } + } + if (lchk != NULL) { /* Assure a timer is up */ sctp_timer_start(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, lchk->whoTo); Modified: stable/12/sys/netinet/sctp_input.c ============================================================================== --- stable/12/sys/netinet/sctp_input.c Sun Aug 23 22:48:19 2020 (r364582) +++ stable/12/sys/netinet/sctp_input.c Sun Aug 23 22:50:59 2020 (r364583) @@ -2956,6 +2956,7 @@ sctp_handle_cookie_ack(struct sctp_cookie_ack_chunk *c { /* cp must not be used, others call this without a c-ack :-) */ struct sctp_association *asoc; + struct sctp_tmit_chunk *chk; SCTPDBG(SCTP_DEBUG_INPUT2, "sctp_handle_cookie_ack: handling COOKIE-ACK\n"); @@ -3059,11 +3060,13 @@ sctp_handle_cookie_ack(struct sctp_cookie_ack_chunk *c closed_socket: /* Toss the cookie if I can */ sctp_toss_old_cookies(stcb, asoc); - if (!TAILQ_EMPTY(&asoc->sent_queue)) { - /* Restart the timer if we have pending data */ - struct sctp_tmit_chunk *chk; - - chk = TAILQ_FIRST(&asoc->sent_queue); + /* Restart the timer if we have pending data */ + TAILQ_FOREACH(chk, &asoc->sent_queue, sctp_next) { + if (chk->whoTo != NULL) { + break; + } + } + if (chk != NULL) { sctp_timer_start(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, chk->whoTo); } } @@ -5159,6 +5162,7 @@ process_control_chunks: } else { struct mbuf *ret_buf; struct sctp_inpcb *linp; + struct sctp_tmit_chunk *chk; if (stcb) { linp = NULL; @@ -5220,14 +5224,13 @@ process_control_chunks: got_auth = 1; auth_skipped = 0; } - if (!TAILQ_EMPTY(&stcb->asoc.sent_queue)) { - /* - * Restart the timer if we have - * pending data - */ - struct sctp_tmit_chunk *chk; - - chk = TAILQ_FIRST(&stcb->asoc.sent_queue); + /* Restart the timer if we have pending data */ + TAILQ_FOREACH(chk, &stcb->asoc.sent_queue, sctp_next) { + if (chk->whoTo != NULL) { + break; + } + } + if (chk != NULL) { sctp_timer_start(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, chk->whoTo); } } Modified: stable/12/sys/netinet/sctp_timer.c ============================================================================== --- stable/12/sys/netinet/sctp_timer.c Sun Aug 23 22:48:19 2020 (r364582) +++ stable/12/sys/netinet/sctp_timer.c Sun Aug 23 22:50:59 2020 (r364583) @@ -977,7 +977,12 @@ sctp_t3rxt_timer(struct sctp_inpcb *inp, /* C3. See if we need to send a Fwd-TSN */ if (SCTP_TSN_GT(stcb->asoc.advanced_peer_ack_point, stcb->asoc.last_acked_seq)) { send_forward_tsn(stcb, &stcb->asoc); - if (lchk) { + for (; lchk != NULL; lchk = TAILQ_NEXT(lchk, sctp_next)) { + if (lchk->whoTo != NULL) { + break; + } + } + if (lchk != NULL) { /* Assure a timer is up */ sctp_timer_start(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, lchk->whoTo); } Modified: stable/12/sys/netinet/sctputil.c ============================================================================== --- stable/12/sys/netinet/sctputil.c Sun Aug 23 22:48:19 2020 (r364582) +++ stable/12/sys/netinet/sctputil.c Sun Aug 23 22:50:59 2020 (r364583) @@ -1836,14 +1836,19 @@ sctp_timeout_handler(void *t) struct sctp_tmit_chunk *chk; /* - * safeguard. If there on some on the sent queue + * Safeguard. If there on some on the sent queue * somewhere but no timers running something is * wrong... so we start a timer on the first chunk * on the send queue on whatever net it is sent to. */ - chk = TAILQ_FIRST(&stcb->asoc.sent_queue); - sctp_timer_start(SCTP_TIMER_TYPE_SEND, inp, stcb, - chk->whoTo); + TAILQ_FOREACH(chk, &stcb->asoc.sent_queue, sctp_next) { + if (chk->whoTo != NULL) { + break; + } + } + if (chk != NULL) { + sctp_timer_start(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, chk->whoTo); + } } break; case SCTP_TIMER_TYPE_INIT: From owner-svn-src-stable-12@freebsd.org Sun Aug 23 22:52:48 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 65AF93CE915; Sun, 23 Aug 2020 22:52: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZVrw20gXz3TR0; Sun, 23 Aug 2020 22:52: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 27D98E6EB; Sun, 23 Aug 2020 22:52: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 07NMqmZg017617; Sun, 23 Aug 2020 22:52:48 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NMqmtQ017616; Sun, 23 Aug 2020 22:52:48 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232252.07NMqmtQ017616@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 22:52:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364584 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364584 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 22:52:48 -0000 Author: tuexen Date: Sun Aug 23 22:52:47 2020 New Revision: 364584 URL: https://svnweb.freebsd.org/changeset/base/364584 Log: MFC r360885: Ensure that the SCTP iterator runs with an stcb and inp, which belong to each other. Modified: stable/12/sys/netinet/sctputil.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctputil.c ============================================================================== --- stable/12/sys/netinet/sctputil.c Sun Aug 23 22:50:59 2020 (r364583) +++ stable/12/sys/netinet/sctputil.c Sun Aug 23 22:52:47 2020 (r364584) @@ -1486,6 +1486,7 @@ select_a_new_ep: } tinp = it->inp; it->inp = LIST_NEXT(it->inp, sctp_list); + it->stcb = NULL; SCTP_INP_RUNLOCK(tinp); if (it->inp == NULL) { goto done_with_iterator; @@ -1555,6 +1556,9 @@ select_a_new_ep: atomic_add_int(&it->stcb->asoc.refcnt, -1); iteration_count = 0; } + KASSERT(it->inp == it->stcb->sctp_ep, + ("%s: stcb %p does not belong to inp %p, but inp %p", + __func__, it->stcb, it->inp, it->stcb->sctp_ep)); /* run function on this one */ (*it->function_assoc) (it->inp, it->stcb, it->pointer, it->val); @@ -1587,6 +1591,7 @@ no_stcb: } else { it->inp = LIST_NEXT(it->inp, sctp_list); } + it->stcb = NULL; if (it->inp == NULL) { goto done_with_iterator; } From owner-svn-src-stable-12@freebsd.org Sun Aug 23 22:54:30 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DD0343CE938; Sun, 23 Aug 2020 22:54: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZVtt5YNTz3TGW; Sun, 23 Aug 2020 22:54: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 A1EA2EBDC; Sun, 23 Aug 2020 22:54: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 07NMsUBM017758; Sun, 23 Aug 2020 22:54:30 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NMsUoF017754; Sun, 23 Aug 2020 22:54:30 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232254.07NMsUoF017754@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 22:54:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364585 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364585 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 22:54:30 -0000 Author: tuexen Date: Sun Aug 23 22:54:30 2020 New Revision: 364585 URL: https://svnweb.freebsd.org/changeset/base/364585 Log: MFC r361116: Ensure that an stcb is not dereferenced when it is about to be freed. This issue was found by SYZKALLER. Modified: stable/12/sys/netinet/sctp_indata.c stable/12/sys/netinet/sctp_indata.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_indata.c ============================================================================== --- stable/12/sys/netinet/sctp_indata.c Sun Aug 23 22:52:47 2020 (r364584) +++ stable/12/sys/netinet/sctp_indata.c Sun Aug 23 22:54:30 2020 (r364585) @@ -164,6 +164,9 @@ sctp_build_readq_entry(struct sctp_tcb *stcb, read_queue_e->data = dm; read_queue_e->stcb = stcb; read_queue_e->port_from = stcb->rport; + if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) { + read_queue_e->do_not_ref_stcb = 1; + } failed_build: return (read_queue_e); } @@ -775,6 +778,7 @@ sctp_build_readq_entry_from_ctl(struct sctp_queued_to_ atomic_add_int(&nc->whoFrom->ref_count, 1); nc->stcb = control->stcb; nc->port_from = control->port_from; + nc->do_not_ref_stcb = control->do_not_ref_stcb; } static void Modified: stable/12/sys/netinet/sctp_indata.h ============================================================================== --- stable/12/sys/netinet/sctp_indata.h Sun Aug 23 22:52:47 2020 (r364584) +++ stable/12/sys/netinet/sctp_indata.h Sun Aug 23 22:54:30 2020 (r364585) @@ -68,6 +68,9 @@ sctp_build_readq_entry(struct sctp_tcb *stcb, (_ctl)->data = dm; \ (_ctl)->stcb = (in_it); \ (_ctl)->port_from = (in_it)->rport; \ + if ((in_it)->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) { \ + (_ctl)->do_not_ref_stcb = 1; \ + }\ } \ } while (0) From owner-svn-src-stable-12@freebsd.org Sun Aug 23 23:02:52 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3C25B3CEBAE; Sun, 23 Aug 2020 23:02: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZW4X0jpyz3Trv; Sun, 23 Aug 2020 23:02: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 EFFE3EC5D; Sun, 23 Aug 2020 23:02: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 07NN2pSk024050; Sun, 23 Aug 2020 23:02:51 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NN2pf0024049; Sun, 23 Aug 2020 23:02:51 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232302.07NN2pf0024049@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 23:02:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364586 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364586 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 23:02:52 -0000 Author: tuexen Date: Sun Aug 23 23:02:51 2020 New Revision: 364586 URL: https://svnweb.freebsd.org/changeset/base/364586 Log: MFC r361213: Whitespace change. Modified: stable/12/sys/netinet/sctputil.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctputil.c ============================================================================== --- stable/12/sys/netinet/sctputil.c Sun Aug 23 22:54:30 2020 (r364585) +++ stable/12/sys/netinet/sctputil.c Sun Aug 23 23:02:51 2020 (r364586) @@ -1557,8 +1557,8 @@ select_a_new_ep: iteration_count = 0; } KASSERT(it->inp == it->stcb->sctp_ep, - ("%s: stcb %p does not belong to inp %p, but inp %p", - __func__, it->stcb, it->inp, it->stcb->sctp_ep)); + ("%s: stcb %p does not belong to inp %p, but inp %p", + __func__, it->stcb, it->inp, it->stcb->sctp_ep)); /* run function on this one */ (*it->function_assoc) (it->inp, it->stcb, it->pointer, it->val); From owner-svn-src-stable-12@freebsd.org Sun Aug 23 23:08:56 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6A9923CEBC8; Sun, 23 Aug 2020 23:08: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZWCX28p1z3VFF; Sun, 23 Aug 2020 23:08: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 2886CF17A; Sun, 23 Aug 2020 23:08: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 07NN8une024374; Sun, 23 Aug 2020 23:08:56 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NN8tig024373; Sun, 23 Aug 2020 23:08:55 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232308.07NN8tig024373@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 23:08:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364587 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364587 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 23:08:56 -0000 Author: tuexen Date: Sun Aug 23 23:08:55 2020 New Revision: 364587 URL: https://svnweb.freebsd.org/changeset/base/364587 Log: MFC r361214: Fix logical condition by looking at usecs. This issue was found by cpp-check running on the userland stack. Modified: stable/12/sys/netinet/sctputil.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctputil.c ============================================================================== --- stable/12/sys/netinet/sctputil.c Sun Aug 23 23:02:51 2020 (r364586) +++ stable/12/sys/netinet/sctputil.c Sun Aug 23 23:08:55 2020 (r364587) @@ -2928,7 +2928,7 @@ sctp_calculate_rto(struct sctp_tcb *stcb, (void)SCTP_GETTIME_TIMEVAL(&now); } if ((old->tv_sec > now.tv_sec) || - ((old->tv_sec == now.tv_sec) && (old->tv_sec > now.tv_sec))) { + ((old->tv_sec == now.tv_sec) && (old->tv_usec > now.tv_usec))) { /* The starting point is in the future. */ return (0); } From owner-svn-src-stable-12@freebsd.org Sun Aug 23 23:10:25 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C67E23CEE1F; Sun, 23 Aug 2020 23:10:25 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZWFF4sSrz3VLH; Sun, 23 Aug 2020 23:10: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 8A302F17B; Sun, 23 Aug 2020 23:10: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 07NNAPJr024534; Sun, 23 Aug 2020 23:10:25 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NNAPMP024533; Sun, 23 Aug 2020 23:10:25 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232310.07NNAPMP024533@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 23:10:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364588 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364588 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 23:10:25 -0000 Author: tuexen Date: Sun Aug 23 23:10:25 2020 New Revision: 364588 URL: https://svnweb.freebsd.org/changeset/base/364588 Log: MFC r361221: Remove redundant check. Modified: stable/12/sys/netinet/sctp_asconf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_asconf.c ============================================================================== --- stable/12/sys/netinet/sctp_asconf.c Sun Aug 23 23:08:55 2020 (r364587) +++ stable/12/sys/netinet/sctp_asconf.c Sun Aug 23 23:10:25 2020 (r364588) @@ -3038,10 +3038,6 @@ sctp_check_address_list_ep(struct sctp_tcb *stcb, stru "check_addr_list_ep: laddr->ifa is NULL"); continue; } - if (laddr->ifa == NULL) { - SCTPDBG(SCTP_DEBUG_ASCONF1, "check_addr_list_ep: laddr->ifa->ifa_addr is NULL"); - continue; - } /* do i have it implicitly? */ if (sctp_cmpaddr(&laddr->ifa->address.sa, init_addr)) { continue; From owner-svn-src-stable-12@freebsd.org Sun Aug 23 23:11:54 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 89F093CEDCD; Sun, 23 Aug 2020 23:11: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZWGy35Pkz3Vd8; Sun, 23 Aug 2020 23:11: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 4D45EF240; Sun, 23 Aug 2020 23:11: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 07NNBsgn030063; Sun, 23 Aug 2020 23:11:54 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NNBsK3030062; Sun, 23 Aug 2020 23:11:54 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232311.07NNBsK3030062@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 23:11:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364589 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364589 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 23:11:54 -0000 Author: tuexen Date: Sun Aug 23 23:11:53 2020 New Revision: 364589 URL: https://svnweb.freebsd.org/changeset/base/364589 Log: MFC r361222: Avoid an integer underflow. Modified: stable/12/sys/netinet/sctp_asconf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_asconf.c ============================================================================== --- stable/12/sys/netinet/sctp_asconf.c Sun Aug 23 23:10:25 2020 (r364588) +++ stable/12/sys/netinet/sctp_asconf.c Sun Aug 23 23:11:53 2020 (r364589) @@ -1803,9 +1803,9 @@ sctp_handle_asconf_ack(struct mbuf *m, int offset, } /* switch */ /* update remaining ASCONF-ACK message length to process */ - ack_length -= SCTP_SIZE32(param_length); - if (ack_length <= 0) { - /* no more data in the mbuf chain */ + if (ack_length > SCTP_SIZE32(param_length)) { + ack_length -= SCTP_SIZE32(param_length); + } else { break; } offset += SCTP_SIZE32(param_length); From owner-svn-src-stable-12@freebsd.org Sun Aug 23 23:13:13 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 765393CEE56; Sun, 23 Aug 2020 23:13: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZWJT2WP0z3Vk7; Sun, 23 Aug 2020 23:13: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 39E04F382; Sun, 23 Aug 2020 23:13: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 07NNDDh7030178; Sun, 23 Aug 2020 23:13:13 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NNDDsF030177; Sun, 23 Aug 2020 23:13:13 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232313.07NNDDsF030177@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 23:13:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364590 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364590 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 23:13:13 -0000 Author: tuexen Date: Sun Aug 23 23:13:12 2020 New Revision: 364590 URL: https://svnweb.freebsd.org/changeset/base/364590 Log: MFC r361224: Cleanup, no functional change intended. Modified: stable/12/sys/netinet/sctp_pcb.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_pcb.c ============================================================================== --- stable/12/sys/netinet/sctp_pcb.c Sun Aug 23 23:11:53 2020 (r364589) +++ stable/12/sys/netinet/sctp_pcb.c Sun Aug 23 23:13:12 2020 (r364590) @@ -5204,16 +5204,12 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tc SCTP_FREE_SHOULD_USE_GRACEFUL_CLOSE, SCTP_CALLED_DIRECTLY_NOCMPSET); SCTP_INP_DECR_REF(inp); - goto out_of; } else { /* The socket is still open. */ SCTP_INP_DECR_REF(inp); + SCTP_INP_RUNLOCK(inp); } } - if (from_inpcbfree == SCTP_NORMAL_PROC) { - SCTP_INP_RUNLOCK(inp); - } -out_of: /* destroyed the asoc */ #ifdef SCTP_LOG_CLOSING sctp_log_closing(inp, NULL, 11); From owner-svn-src-stable-12@freebsd.org Sun Aug 23 23:14:48 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 71D4A3CF01B; Sun, 23 Aug 2020 23:14: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZWLJ2NN1z3VgD; Sun, 23 Aug 2020 23:14: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 351FFF28A; Sun, 23 Aug 2020 23:14: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 07NNEmxt030307; Sun, 23 Aug 2020 23:14:48 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NNEmVq030306; Sun, 23 Aug 2020 23:14:48 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232314.07NNEmVq030306@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 23:14:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364591 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364591 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 23:14:48 -0000 Author: tuexen Date: Sun Aug 23 23:14:47 2020 New Revision: 364591 URL: https://svnweb.freebsd.org/changeset/base/364591 Log: MFC r361225: Remove redundant assignment. Modified: stable/12/sys/netinet/sctputil.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctputil.c ============================================================================== --- stable/12/sys/netinet/sctputil.c Sun Aug 23 23:13:12 2020 (r364590) +++ stable/12/sys/netinet/sctputil.c Sun Aug 23 23:14:47 2020 (r364591) @@ -1144,7 +1144,6 @@ sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb asoc->sctp_cmt_on_off = inp->sctp_cmt_on_off; asoc->ecn_supported = inp->ecn_supported; asoc->prsctp_supported = inp->prsctp_supported; - asoc->idata_supported = inp->idata_supported; asoc->auth_supported = inp->auth_supported; asoc->asconf_supported = inp->asconf_supported; asoc->reconfig_supported = inp->reconfig_supported; From owner-svn-src-stable-12@freebsd.org Sun Aug 23 23:16:14 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CFA8A3CEB74; Sun, 23 Aug 2020 23:16:14 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZWMy4NrCz3W8p; Sun, 23 Aug 2020 23:16: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 79D37F383; Sun, 23 Aug 2020 23:16: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 07NNGEdJ030434; Sun, 23 Aug 2020 23:16:14 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NNGEfk030433; Sun, 23 Aug 2020 23:16:14 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232316.07NNGEfk030433@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 23:16:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364592 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364592 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 23:16:14 -0000 Author: tuexen Date: Sun Aug 23 23:16:14 2020 New Revision: 364592 URL: https://svnweb.freebsd.org/changeset/base/364592 Log: MFC r361226: Don't check an unsigned variable for being negative. Modified: stable/12/sys/netinet/sctp_usrreq.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/12/sys/netinet/sctp_usrreq.c Sun Aug 23 23:14:47 2020 (r364591) +++ stable/12/sys/netinet/sctp_usrreq.c Sun Aug 23 23:16:14 2020 (r364592) @@ -1023,7 +1023,7 @@ sctp_fill_up_addresses_vrf(struct sctp_inpcb *inp, struct sctp_vrf *vrf; actual = 0; - if (limit <= 0) + if (limit == 0) return (actual); if (stcb) { From owner-svn-src-stable-12@freebsd.org Sun Aug 23 23:17:52 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 084D83CF21F; Sun, 23 Aug 2020 23:17: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZWPq6W7Dz3W7S; Sun, 23 Aug 2020 23:17: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 C2D59F311; Sun, 23 Aug 2020 23:17: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 07NNHpDk030551; Sun, 23 Aug 2020 23:17:51 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NNHpIm030550; Sun, 23 Aug 2020 23:17:51 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232317.07NNHpIm030550@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 23:17:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364593 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364593 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 23:17:52 -0000 Author: tuexen Date: Sun Aug 23 23:17:51 2020 New Revision: 364593 URL: https://svnweb.freebsd.org/changeset/base/364593 Log: MFC r361227: Remove assignment without effect. Modified: stable/12/sys/netinet/sctp_auth.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_auth.c ============================================================================== --- stable/12/sys/netinet/sctp_auth.c Sun Aug 23 23:16:14 2020 (r364592) +++ stable/12/sys/netinet/sctp_auth.c Sun Aug 23 23:17:51 2020 (r364593) @@ -658,7 +658,6 @@ sctp_free_hmaclist(sctp_hmaclist_t *list) { if (list != NULL) { SCTP_FREE(list, SCTP_M_AUTH_HL); - list = NULL; } } From owner-svn-src-stable-12@freebsd.org Sun Aug 23 23:19:33 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CA2B33CF307; Sun, 23 Aug 2020 23:19: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZWRn5KgRz3WPv; Sun, 23 Aug 2020 23:19: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 7D32DF28B; Sun, 23 Aug 2020 23:19: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 07NNJX0m030698; Sun, 23 Aug 2020 23:19:33 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NNJWmQ030692; Sun, 23 Aug 2020 23:19:32 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232319.07NNJWmQ030692@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 23:19:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364594 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364594 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 23:19:33 -0000 Author: tuexen Date: Sun Aug 23 23:19:32 2020 New Revision: 364594 URL: https://svnweb.freebsd.org/changeset/base/364594 Log: MFC r361243: Replace snprintf() by SCTP_SNPRINTF() and let SCTP_SNPRINTF() map to snprintf() on FreeBSD. This allows to check for failures of snprintf() on platforms other than FreeBSD kernel. Modified: stable/12/sys/netinet/sctp_asconf.c stable/12/sys/netinet/sctp_indata.c stable/12/sys/netinet/sctp_input.c stable/12/sys/netinet/sctp_os_bsd.h stable/12/sys/netinet/sctp_output.c stable/12/sys/netinet/sctp_pcb.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_asconf.c ============================================================================== --- stable/12/sys/netinet/sctp_asconf.c Sun Aug 23 23:17:51 2020 (r364593) +++ stable/12/sys/netinet/sctp_asconf.c Sun Aug 23 23:19:32 2020 (r364594) @@ -1713,8 +1713,7 @@ sctp_handle_asconf_ack(struct mbuf *m, int offset, char msg[SCTP_DIAG_INFO_LEN]; SCTPDBG(SCTP_DEBUG_ASCONF1, "handle_asconf_ack: got unexpected next serial number! Aborting asoc!\n"); - snprintf(msg, sizeof(msg), "Never sent serial number %8.8x", - serial_num); + SCTP_SNPRINTF(msg, sizeof(msg), "Never sent serial number %8.8x", serial_num); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); *abort_no_unlock = 1; Modified: stable/12/sys/netinet/sctp_indata.c ============================================================================== --- stable/12/sys/netinet/sctp_indata.c Sun Aug 23 23:17:51 2020 (r364593) +++ stable/12/sys/netinet/sctp_indata.c Sun Aug 23 23:19:32 2020 (r364594) @@ -434,7 +434,7 @@ sctp_abort_in_reasm(struct sctp_tcb *stcb, struct mbuf *oper; if (stcb->asoc.idata_supported) { - snprintf(msg, sizeof(msg), + SCTP_SNPRINTF(msg, sizeof(msg), "Reass %x,CF:%x,TSN=%8.8x,SID=%4.4x,FSN=%8.8x,MID:%8.8x", opspot, control->fsn_included, @@ -442,7 +442,7 @@ sctp_abort_in_reasm(struct sctp_tcb *stcb, chk->rec.data.sid, chk->rec.data.fsn, chk->rec.data.mid); } else { - snprintf(msg, sizeof(msg), + SCTP_SNPRINTF(msg, sizeof(msg), "Reass %x,CI:%x,TSN=%8.8x,SID=%4.4x,FSN=%4.4x,SSN:%4.4x", opspot, control->fsn_included, @@ -533,11 +533,11 @@ sctp_queue_data_to_stream(struct sctp_tcb *stcb, */ TAILQ_INSERT_HEAD(&strm->inqueue, control, next_instrm); if (asoc->idata_supported) { - snprintf(msg, sizeof(msg), "Delivered MID=%8.8x, got TSN=%8.8x, SID=%4.4x, MID=%8.8x", + SCTP_SNPRINTF(msg, sizeof(msg), "Delivered MID=%8.8x, got TSN=%8.8x, SID=%4.4x, MID=%8.8x", strm->last_mid_delivered, control->sinfo_tsn, control->sinfo_stream, control->mid); } else { - snprintf(msg, sizeof(msg), "Delivered SSN=%4.4x, got TSN=%8.8x, SID=%4.4x, SSN=%4.4x", + SCTP_SNPRINTF(msg, sizeof(msg), "Delivered SSN=%4.4x, got TSN=%8.8x, SID=%4.4x, SSN=%4.4x", (uint16_t)strm->last_mid_delivered, control->sinfo_tsn, control->sinfo_stream, @@ -648,9 +648,8 @@ sctp_queue_data_to_stream(struct sctp_tcb *stcb, * to put it on the queue. */ if (sctp_place_control_in_stream(strm, asoc, control)) { - snprintf(msg, sizeof(msg), - "Queue to str MID: %u duplicate", - control->mid); + SCTP_SNPRINTF(msg, sizeof(msg), + "Queue to str MID: %u duplicate", control->mid); sctp_clean_up_control(stcb, control); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_3; @@ -1881,8 +1880,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struc * can *not* be fsn 0. XXX: This can happen in case of a * wrap around. Ignore is for now. */ - snprintf(msg, sizeof(msg), "FSN zero for MID=%8.8x, but flags=%2.2x", - mid, chk_flags); + SCTP_SNPRINTF(msg, sizeof(msg), "FSN zero for MID=%8.8x, but flags=%2.2x", mid, chk_flags); goto err_out; } control = sctp_find_reasm_entry(&asoc->strmin[sid], mid, ordered, asoc->idata_supported); @@ -1893,7 +1891,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struc if (control != NULL) { /* We found something, does it belong? */ if (ordered && (mid != control->mid)) { - snprintf(msg, sizeof(msg), "Reassembly problem (MID=%8.8x)", mid); + SCTP_SNPRINTF(msg, sizeof(msg), "Reassembly problem (MID=%8.8x)", mid); err_out: op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_16; @@ -1906,7 +1904,8 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struc * We can't have a switched order with an * unordered chunk */ - snprintf(msg, sizeof(msg), "All fragments of a user message must be ordered or unordered (TSN=%8.8x)", + SCTP_SNPRINTF(msg, sizeof(msg), + "All fragments of a user message must be ordered or unordered (TSN=%8.8x)", tsn); goto err_out; } @@ -1915,7 +1914,8 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struc * We can't have a switched unordered with a * ordered chunk */ - snprintf(msg, sizeof(msg), "All fragments of a user message must be ordered or unordered (TSN=%8.8x)", + SCTP_SNPRINTF(msg, sizeof(msg), + "All fragments of a user message must be ordered or unordered (TSN=%8.8x)", tsn); goto err_out; } @@ -1930,12 +1930,14 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struc if (ordered || asoc->idata_supported) { SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags: 0x%x dup detected on MID: %u\n", chk_flags, mid); - snprintf(msg, sizeof(msg), "Duplicate MID=%8.8x detected.", mid); + SCTP_SNPRINTF(msg, sizeof(msg), "Duplicate MID=%8.8x detected.", mid); goto err_out; } else { if ((tsn == control->fsn_included + 1) && (control->end_added == 0)) { - snprintf(msg, sizeof(msg), "Illegal message sequence, missing end for MID: %8.8x", control->fsn_included); + SCTP_SNPRINTF(msg, sizeof(msg), + "Illegal message sequence, missing end for MID: %8.8x", + control->fsn_included); goto err_out; } else { control = NULL; @@ -2032,13 +2034,13 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struc mid, asoc->strmin[sid].last_mid_delivered); if (asoc->idata_supported) { - snprintf(msg, sizeof(msg), "Delivered MID=%8.8x, got TSN=%8.8x, SID=%4.4x, MID=%8.8x", + SCTP_SNPRINTF(msg, sizeof(msg), "Delivered MID=%8.8x, got TSN=%8.8x, SID=%4.4x, MID=%8.8x", asoc->strmin[sid].last_mid_delivered, tsn, sid, mid); } else { - snprintf(msg, sizeof(msg), "Delivered SSN=%4.4x, got TSN=%8.8x, SID=%4.4x, SSN=%4.4x", + SCTP_SNPRINTF(msg, sizeof(msg), "Delivered SSN=%4.4x, got TSN=%8.8x, SID=%4.4x, SSN=%4.4x", (uint16_t)asoc->strmin[sid].last_mid_delivered, tsn, sid, @@ -2769,7 +2771,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", "I-DATA chunk received when DATA was negotiated"); + SCTP_SNPRINTF(msg, sizeof(msg), "%s", "I-DATA chunk received when DATA was negotiated"); 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); @@ -2780,7 +2782,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", "DATA chunk received when I-DATA was negotiated"); + SCTP_SNPRINTF(msg, sizeof(msg), "%s", "DATA chunk received when I-DATA was negotiated"); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_21; sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); @@ -2803,7 +2805,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 %u", + SCTP_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); @@ -2874,7 +2876,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), "DATA chunk followed by chunk of type %2.2x", + SCTP_SNPRINTF(msg, sizeof(msg), "DATA chunk followed by chunk of type %2.2x", ch->chunk_type); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); @@ -2893,8 +2895,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 %u", - chk_length); + SCTP_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_23; sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); @@ -4043,7 +4044,8 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32 *abort_now = 1; /* XXX */ - snprintf(msg, sizeof(msg), "Cum ack %8.8x greater or equal than TSN %8.8x", + SCTP_SNPRINTF(msg, sizeof(msg), + "Cum ack %8.8x greater or equal than TSN %8.8x", cumack, send_s); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_24; @@ -4585,7 +4587,8 @@ sctp_handle_sack(struct mbuf *m, int offset_seg, int o hopeless_peer: *abort_now = 1; /* XXX */ - snprintf(msg, sizeof(msg), "Cum ack %8.8x greater or equal than TSN %8.8x", + SCTP_SNPRINTF(msg, sizeof(msg), + "Cum ack %8.8x greater or equal than TSN %8.8x", cum_ack, send_s); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_28; @@ -5629,7 +5632,7 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb, * give out). This must be an attacker. */ *abort_flag = 1; - snprintf(msg, sizeof(msg), + SCTP_SNPRINTF(msg, sizeof(msg), "New cum ack %8.8x too high, highest TSN %8.8x", new_cum_tsn, asoc->highest_tsn_inside_map); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); Modified: stable/12/sys/netinet/sctp_input.c ============================================================================== --- stable/12/sys/netinet/sctp_input.c Sun Aug 23 23:17:51 2020 (r364593) +++ stable/12/sys/netinet/sctp_input.c Sun Aug 23 23:19:32 2020 (r364594) @@ -4692,7 +4692,7 @@ sctp_process_control(struct mbuf *m, int iphlen, int * } } if (stcb == NULL) { - snprintf(msg, sizeof(msg), "OOTB, %s:%d at %s", __FILE__, __LINE__, __func__); + SCTP_SNPRINTF(msg, sizeof(msg), "OOTB, %s:%d at %s", __FILE__, __LINE__, __func__); op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), msg); /* no association, so it's out of the blue... */ @@ -4734,7 +4734,7 @@ sctp_process_control(struct mbuf *m, int iphlen, int * if (stcb != NULL) { SCTP_TCB_UNLOCK(stcb); } - snprintf(msg, sizeof(msg), "OOTB, %s:%d at %s", __FILE__, __LINE__, __func__); + SCTP_SNPRINTF(msg, sizeof(msg), "OOTB, %s:%d at %s", __FILE__, __LINE__, __func__); op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), msg); sctp_handle_ootb(m, iphlen, *offset, src, dst, @@ -5671,7 +5671,7 @@ sctp_common_input_processing(struct mbuf **mm, int iph SCTP_TCB_UNLOCK(stcb); stcb = NULL; SCTP_PROBE5(receive, NULL, stcb, m, stcb, sh); - snprintf(msg, sizeof(msg), "OOTB, %s:%d at %s", __FILE__, __LINE__, __func__); + SCTP_SNPRINTF(msg, sizeof(msg), "OOTB, %s:%d at %s", __FILE__, __LINE__, __func__); op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), msg); sctp_handle_ootb(m, iphlen, offset, src, dst, sh, inp, op_err, @@ -5733,7 +5733,7 @@ sctp_common_input_processing(struct mbuf **mm, int iph if (stcb == NULL) { /* out of the blue DATA chunk */ SCTP_PROBE5(receive, NULL, NULL, m, NULL, sh); - snprintf(msg, sizeof(msg), "OOTB, %s:%d at %s", __FILE__, __LINE__, __func__); + SCTP_SNPRINTF(msg, sizeof(msg), "OOTB, %s:%d at %s", __FILE__, __LINE__, __func__); op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), msg); sctp_handle_ootb(m, iphlen, offset, src, dst, sh, inp, op_err, @@ -5799,7 +5799,7 @@ sctp_common_input_processing(struct mbuf **mm, int iph /* * We consider OOTB any data sent during asoc setup. */ - snprintf(msg, sizeof(msg), "OOTB, %s:%d at %s", __FILE__, __LINE__, __func__); + SCTP_SNPRINTF(msg, sizeof(msg), "OOTB, %s:%d at %s", __FILE__, __LINE__, __func__); op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), msg); sctp_handle_ootb(m, iphlen, offset, src, dst, sh, inp, op_err, Modified: stable/12/sys/netinet/sctp_os_bsd.h ============================================================================== --- stable/12/sys/netinet/sctp_os_bsd.h Sun Aug 23 23:17:51 2020 (r364593) +++ stable/12/sys/netinet/sctp_os_bsd.h Sun Aug 23 23:19:32 2020 (r364594) @@ -294,6 +294,8 @@ typedef struct callout sctp_os_timer_t; #define SCTP_ALIGN_TO_END(m, len) M_ALIGN(m, len) +#define SCTP_SNPRINTF(...) snprintf(__VA_ARGS__) + /* We make it so if you have up to 4 threads * writing based on the default size of * the packet log 65 k, that would be Modified: stable/12/sys/netinet/sctp_output.c ============================================================================== --- stable/12/sys/netinet/sctp_output.c Sun Aug 23 23:17:51 2020 (r364593) +++ stable/12/sys/netinet/sctp_output.c Sun Aug 23 23:19:32 2020 (r364594) @@ -5587,7 +5587,7 @@ do_a_abort: if (op_err == NULL) { char msg[SCTP_DIAG_INFO_LEN]; - snprintf(msg, sizeof(msg), "%s:%d at %s", __FILE__, __LINE__, __func__); + SCTP_SNPRINTF(msg, sizeof(msg), "%s:%d at %s", __FILE__, __LINE__, __func__); op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), msg); } @@ -6764,7 +6764,7 @@ sctp_sendall_iterator(struct sctp_inpcb *inp, struct s char msg[SCTP_DIAG_INFO_LEN]; abort_anyway: - snprintf(msg, sizeof(msg), + SCTP_SNPRINTF(msg, sizeof(msg), "%s:%d at %s", __FILE__, __LINE__, __func__); op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), msg); @@ -9632,7 +9632,7 @@ sctp_chunk_retransmission(struct sctp_inpcb *inp, struct mbuf *op_err; char msg[SCTP_DIAG_INFO_LEN]; - snprintf(msg, sizeof(msg), "TSN %8.8x retransmitted %d times, giving up", + SCTP_SNPRINTF(msg, sizeof(msg), "TSN %8.8x retransmitted %d times, giving up", chk->rec.data.tsn, chk->snd_count); op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), msg); @@ -13609,7 +13609,7 @@ dataless_eof: atomic_add_int(&stcb->asoc.refcnt, -1); free_cnt_applied = 0; } - snprintf(msg, sizeof(msg), + SCTP_SNPRINTF(msg, sizeof(msg), "%s:%d at %s", __FILE__, __LINE__, __func__); op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), msg); Modified: stable/12/sys/netinet/sctp_pcb.c ============================================================================== --- stable/12/sys/netinet/sctp_pcb.c Sun Aug 23 23:17:51 2020 (r364593) +++ stable/12/sys/netinet/sctp_pcb.c Sun Aug 23 23:19:32 2020 (r364594) @@ -541,9 +541,9 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint3 atomic_add_int(&vrf->refcount, 1); sctp_ifnp->ifn_mtu = SCTP_GATHER_MTU_FROM_IFN_INFO(ifn, ifn_index, addr->sa_family); if (if_name != NULL) { - snprintf(sctp_ifnp->ifn_name, SCTP_IFNAMSIZ, "%s", if_name); + SCTP_SNPRINTF(sctp_ifnp->ifn_name, SCTP_IFNAMSIZ, "%s", if_name); } else { - snprintf(sctp_ifnp->ifn_name, SCTP_IFNAMSIZ, "%s", "unknown"); + SCTP_SNPRINTF(sctp_ifnp->ifn_name, SCTP_IFNAMSIZ, "%s", "unknown"); } hash_ifn_head = &SCTP_BASE_INFO(vrf_ifn_hash)[(ifn_index & SCTP_BASE_INFO(vrf_ifn_hashmark))]; LIST_INIT(&sctp_ifnp->ifalist); @@ -6229,7 +6229,7 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, s * in setup state we * abort this guy */ - snprintf(msg, sizeof(msg), + SCTP_SNPRINTF(msg, sizeof(msg), "%s:%d at %s", __FILE__, __LINE__, __func__); op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), msg); @@ -6329,7 +6329,7 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, s * in setup state we * abort this guy */ - snprintf(msg, sizeof(msg), + SCTP_SNPRINTF(msg, sizeof(msg), "%s:%d at %s", __FILE__, __LINE__, __func__); op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), msg); From owner-svn-src-stable-12@freebsd.org Sun Aug 23 23:21:27 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CB3083CF45A; Sun, 23 Aug 2020 23:21:27 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZWTz55NGz3WSW; Sun, 23 Aug 2020 23:21:27 +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 93BC9F29E; Sun, 23 Aug 2020 23:21:27 +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 07NNLRHo034164; Sun, 23 Aug 2020 23:21:27 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NNLQ5I034155; Sun, 23 Aug 2020 23:21:26 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232321.07NNLQ5I034155@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 23:21:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364595 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364595 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 23:21:27 -0000 Author: tuexen Date: Sun Aug 23 23:21:26 2020 New Revision: 364595 URL: https://svnweb.freebsd.org/changeset/base/364595 Log: MFC r361872: Non-functional changes due to cleanup (upstream removing of Panda support) of the code. Modified: stable/12/sys/netinet/sctp_constants.h stable/12/sys/netinet/sctp_indata.c stable/12/sys/netinet/sctp_os.h stable/12/sys/netinet/sctp_output.c stable/12/sys/netinet/sctp_pcb.c stable/12/sys/netinet/sctp_usrreq.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_constants.h ============================================================================== --- stable/12/sys/netinet/sctp_constants.h Sun Aug 23 23:19:32 2020 (r364594) +++ stable/12/sys/netinet/sctp_constants.h Sun Aug 23 23:21:26 2020 (r364595) @@ -576,7 +576,6 @@ __FBSDID("$FreeBSD$"); */ #define SCTP_ASOC_MAX_CHUNKS_ON_QUEUE 512 - /* * Basically the minimum amount of time before I do a early FR. Making this * value to low will cause duplicate retransmissions. @@ -756,9 +755,8 @@ __FBSDID("$FreeBSD$"); #define SCTP_FROM_SCTP_ASCONF 0x80000000 #define SCTP_FROM_SCTP_OUTPUT 0x90000000 #define SCTP_FROM_SCTP_PEELOFF 0xa0000000 -#define SCTP_FROM_SCTP_PANDA 0xb0000000 -#define SCTP_FROM_SCTP_SYSCTL 0xc0000000 -#define SCTP_FROM_SCTP_CC_FUNCTIONS 0xd0000000 +#define SCTP_FROM_SCTP_SYSCTL 0xb0000000 +#define SCTP_FROM_SCTP_CC_FUNCTIONS 0xc0000000 /* Location ID's */ #define SCTP_LOC_1 0x00000001 Modified: stable/12/sys/netinet/sctp_indata.c ============================================================================== --- stable/12/sys/netinet/sctp_indata.c Sun Aug 23 23:19:32 2020 (r364594) +++ stable/12/sys/netinet/sctp_indata.c Sun Aug 23 23:21:26 2020 (r364595) @@ -2721,8 +2721,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *o * cluster... i.e. it is a small packet sent in and yet the driver * underneath allocated a full cluster for it. If so we must copy it * to a smaller mbuf and free up the cluster mbuf. This will help - * with cluster starvation. Note for __Panda__ we don't do this - * since it has clusters all the way down to 64 bytes. + * with cluster starvation. */ if (SCTP_BUF_LEN(m) < (long)MLEN && SCTP_BUF_NEXT(m) == NULL) { /* we only handle mbufs that are singletons.. not chains */ Modified: stable/12/sys/netinet/sctp_os.h ============================================================================== --- stable/12/sys/netinet/sctp_os.h Sun Aug 23 23:19:32 2020 (r364594) +++ stable/12/sys/netinet/sctp_os.h Sun Aug 23 23:21:26 2020 (r364595) @@ -67,7 +67,6 @@ __FBSDID("$FreeBSD$"); - /* All os's must implement this address gatherer. If * no VRF's exist, then vrf 0 is the only one and all * addresses and ifn's live here. Modified: stable/12/sys/netinet/sctp_output.c ============================================================================== --- stable/12/sys/netinet/sctp_output.c Sun Aug 23 23:19:32 2020 (r364594) +++ stable/12/sys/netinet/sctp_output.c Sun Aug 23 23:21:26 2020 (r364595) @@ -6481,8 +6481,7 @@ error_out: appendchain = clonechain; } else { if (!copy_by_ref && - (sizeofcpy <= (int)((((SCTP_BASE_SYSCTL(sctp_mbuf_threshold_count) - 1) * MLEN) + MHLEN))) - ) { + (sizeofcpy <= (int)((((SCTP_BASE_SYSCTL(sctp_mbuf_threshold_count) - 1) * MLEN) + MHLEN)))) { /* Its not in a cluster */ if (*endofchain == NULL) { /* lets get a mbuf cluster */ @@ -13525,12 +13524,6 @@ skip_preblock: error = sctp_msg_append(stcb, net, top, srcv, 0); top = NULL; if (sinfo_flags & SCTP_EOF) { - /* - * This should only happen for Panda for the mbuf - * send case, which does NOT yet support EEOR mode. - * Thus, we can just set this flag to do the proper - * EOF handling. - */ got_all_of_the_send = 1; } } Modified: stable/12/sys/netinet/sctp_pcb.c ============================================================================== --- stable/12/sys/netinet/sctp_pcb.c Sun Aug 23 23:19:32 2020 (r364594) +++ stable/12/sys/netinet/sctp_pcb.c Sun Aug 23 23:21:26 2020 (r364595) @@ -746,8 +746,7 @@ sctp_del_addr_from_vrf(uint32_t vrf_id, struct sockadd /*- * The name has priority over the ifn_index - * if its given. We do this especially for - * panda who might recycle indexes fast. + * if its given. */ if (if_name) { if (strncmp(if_name, sctp_ifap->ifn_p->ifn_name, SCTP_IFNAMSIZ) == 0) { @@ -3154,8 +3153,7 @@ continue_anyway: } else { /* * Note for BSD we hit here always other O/S's will - * pass things in via the sctp_ifap argument - * (Panda). + * pass things in via the sctp_ifap argument. */ ifa = sctp_find_ifa_by_addr(&store.sa, vrf_id, SCTP_ADDR_NOT_LOCKED); @@ -4307,11 +4305,7 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockadd * If you have not performed a bind, then we need to do the * ephemeral bind for you. */ - if ((err = sctp_inpcb_bind(inp->sctp_socket, - (struct sockaddr *)NULL, - (struct sctp_ifa *)NULL, - p - ))) { + if ((err = sctp_inpcb_bind(inp->sctp_socket, NULL, NULL, p))) { /* bind error, probably perm */ *error = err; return (NULL); @@ -4679,7 +4673,6 @@ sctp_clean_up_stream(struct sctp_tcb *stcb, struct sct } } } - /*- * Free the association after un-hashing the remote port. This Modified: stable/12/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/12/sys/netinet/sctp_usrreq.c Sun Aug 23 23:19:32 2020 (r364594) +++ stable/12/sys/netinet/sctp_usrreq.c Sun Aug 23 23:21:26 2020 (r364595) @@ -71,7 +71,7 @@ sctp_init(void) SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue) = (nmbclusters / 8); /* * Allow a user to take no more than 1/2 the number of clusters or - * the SB_MAX whichever is smaller for the send window. + * the SB_MAX, whichever is smaller, for the send window. */ sb_max_adj = (u_long)((u_quad_t)(SB_MAX) * MCLBYTES / (MSIZE + MCLBYTES)); SCTP_BASE_SYSCTL(sctp_sendspace) = min(sb_max_adj, From owner-svn-src-stable-12@freebsd.org Sun Aug 23 23:22:55 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D597F3CF32B; Sun, 23 Aug 2020 23:22: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZWWg5N3Jz3WjK; Sun, 23 Aug 2020 23:22: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 9B957F138; Sun, 23 Aug 2020 23:22: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 07NNMtMD036717; Sun, 23 Aug 2020 23:22:55 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NNMtcQ036716; Sun, 23 Aug 2020 23:22:55 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232322.07NNMtcQ036716@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 23:22:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364596 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364596 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 23:22:55 -0000 Author: tuexen Date: Sun Aug 23 23:22:55 2020 New Revision: 364596 URL: https://svnweb.freebsd.org/changeset/base/364596 Log: MFC r361877: Fix typo in comment. Submitted by Orgad Shaneh for the userland stack. Modified: stable/12/sys/netinet/sctp_pcb.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_pcb.c ============================================================================== --- stable/12/sys/netinet/sctp_pcb.c Sun Aug 23 23:21:26 2020 (r364595) +++ stable/12/sys/netinet/sctp_pcb.c Sun Aug 23 23:22:55 2020 (r364596) @@ -5893,7 +5893,7 @@ retry: * holding the lock. We won't find it on the list either and * continue and free/destroy it. While holding the lock, spin, to * avoid the race condition as sctp_iterator_worker() will have to - * wait to re-aquire the lock. + * wait to re-acquire the lock. */ if (sctp_it_ctl.iterator_running != 0 || sctp_it_ctl.cur_it != NULL) { SCTP_IPI_ITERATOR_WQ_UNLOCK(); From owner-svn-src-stable-12@freebsd.org Sun Aug 23 23:24:40 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DAEF23CEEEE; Sun, 23 Aug 2020 23:24: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZWYh5n9zz3X0g; Sun, 23 Aug 2020 23:24: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 A976FF394; Sun, 23 Aug 2020 23:24: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 07NNOeSw036863; Sun, 23 Aug 2020 23:24:40 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NNOcFZ036852; Sun, 23 Aug 2020 23:24:38 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232324.07NNOcFZ036852@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 23:24:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364597 - in stable/12/sys: netinet netinet6 X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in stable/12/sys: netinet netinet6 X-SVN-Commit-Revision: 364597 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 23:24:40 -0000 Author: tuexen Date: Sun Aug 23 23:24:38 2020 New Revision: 364597 URL: https://svnweb.freebsd.org/changeset/base/364597 Log: MFC r361895: Retire SCTP_SO_LOCK_TESTING. This was intended to test the locking used in the MacOS X kernel on a FreeBSD system, to make use of WITNESS and other debugging infrastructure. This hasn't been used for ages, to take it out to reduce the #ifdef complexity. Modified: stable/12/sys/netinet/sctp_auth.c stable/12/sys/netinet/sctp_constants.h stable/12/sys/netinet/sctp_indata.c stable/12/sys/netinet/sctp_input.c stable/12/sys/netinet/sctp_output.c stable/12/sys/netinet/sctp_output.h stable/12/sys/netinet/sctp_sysctl.c stable/12/sys/netinet/sctp_sysctl.h stable/12/sys/netinet/sctp_usrreq.c stable/12/sys/netinet/sctputil.c stable/12/sys/netinet/sctputil.h stable/12/sys/netinet6/sctp6_usrreq.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_auth.c ============================================================================== --- stable/12/sys/netinet/sctp_auth.c Sun Aug 23 23:22:55 2020 (r364596) +++ stable/12/sys/netinet/sctp_auth.c Sun Aug 23 23:24:38 2020 (r364597) @@ -566,9 +566,7 @@ sctp_auth_key_acquire(struct sctp_tcb *stcb, uint16_t void sctp_auth_key_release(struct sctp_tcb *stcb, uint16_t key_id, int so_locked -#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED -#endif ) { sctp_sharedkey_t *skey; @@ -1721,9 +1719,7 @@ sctp_handle_auth(struct sctp_tcb *stcb, struct sctp_au void sctp_notify_authentication(struct sctp_tcb *stcb, uint32_t indication, uint16_t keyid, uint16_t alt_keyid, int so_locked -#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED -#endif ) { struct mbuf *m_notify; Modified: stable/12/sys/netinet/sctp_constants.h ============================================================================== --- stable/12/sys/netinet/sctp_constants.h Sun Aug 23 23:22:55 2020 (r364596) +++ stable/12/sys/netinet/sctp_constants.h Sun Aug 23 23:24:38 2020 (r364597) @@ -943,7 +943,7 @@ __FBSDID("$FreeBSD$"); /*- * defines for socket lock states. - * Used by __APPLE__ and SCTP_SO_LOCK_TESTING + * Used by __APPLE__ */ #define SCTP_SO_LOCKED 1 #define SCTP_SO_NOT_LOCKED 0 Modified: stable/12/sys/netinet/sctp_indata.c ============================================================================== --- stable/12/sys/netinet/sctp_indata.c Sun Aug 23 23:22:55 2020 (r364596) +++ stable/12/sys/netinet/sctp_indata.c Sun Aug 23 23:24:38 2020 (r364597) @@ -555,20 +555,6 @@ sctp_queue_data_to_stream(struct sctp_tcb *stcb, sctp_ucount_incr(asoc->cnt_on_all_streams); nxt_todel = strm->last_mid_delivered + 1; if (SCTP_MID_EQ(asoc->idata_supported, nxt_todel, control->mid)) { -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *so; - - so = SCTP_INP_SO(stcb->sctp_ep); - 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); - if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) { - SCTP_SOCKET_UNLOCK(so, 1); - return; - } -#endif /* can be delivered right away? */ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_STR_LOGGING_ENABLE) { sctp_log_strm_del(control, NULL, SCTP_STR_LOG_FROM_IMMED_DEL); @@ -638,9 +624,6 @@ sctp_queue_data_to_stream(struct sctp_tcb *stcb, } break; } -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif } if (queue_needed) { /* @@ -1956,25 +1939,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struc */ if (stcb->sctp_socket->so_rcv.sb_cc) { /* some to read, wake-up */ -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *so; - - so = SCTP_INP_SO(stcb->sctp_ep); - 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); - if (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) { - /* assoc was freed while we were unlocked */ - SCTP_SOCKET_UNLOCK(so, 1); - return (0); - } -#endif sctp_sorwakeup(stcb->sctp_ep, stcb->sctp_socket); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif } /* now is it in the mapping array of what we have accepted? */ if (chk_type == SCTP_DATA) { @@ -4182,32 +4147,12 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32 } /* sa_ignore NO_NULL_CHK */ if (stcb->sctp_socket) { -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *so; - -#endif SOCKBUF_LOCK(&stcb->sctp_socket->so_snd); if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_WAKE_LOGGING_ENABLE) { /* sa_ignore NO_NULL_CHK */ sctp_wakeup_log(stcb, 1, SCTP_WAKESND_FROM_SACK); } -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - so = SCTP_INP_SO(stcb->sctp_ep); - 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); - if (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) { - /* assoc was freed while we were unlocked */ - SCTP_SOCKET_UNLOCK(so, 1); - return; - } -#endif sctp_sowwakeup_locked(stcb->sctp_ep, stcb->sctp_socket); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif } else { if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_WAKE_LOGGING_ENABLE) { sctp_wakeup_log(stcb, 1, SCTP_NOWAKE_FROM_SACK); @@ -4894,31 +4839,11 @@ hopeless_peer: /* sa_ignore NO_NULL_CHK */ if ((wake_him) && (stcb->sctp_socket)) { -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *so; - -#endif SOCKBUF_LOCK(&stcb->sctp_socket->so_snd); if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_WAKE_LOGGING_ENABLE) { sctp_wakeup_log(stcb, wake_him, SCTP_WAKESND_FROM_SACK); } -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - so = SCTP_INP_SO(stcb->sctp_ep); - 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); - if (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) { - /* assoc was freed while we were unlocked */ - SCTP_SOCKET_UNLOCK(so, 1); - return; - } -#endif sctp_sowwakeup_locked(stcb->sctp_ep, stcb->sctp_socket); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif } else { if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_WAKE_LOGGING_ENABLE) { sctp_wakeup_log(stcb, wake_him, SCTP_NOWAKE_FROM_SACK); Modified: stable/12/sys/netinet/sctp_input.c ============================================================================== --- stable/12/sys/netinet/sctp_input.c Sun Aug 23 23:22:55 2020 (r364596) +++ stable/12/sys/netinet/sctp_input.c Sun Aug 23 23:24:38 2020 (r364597) @@ -214,9 +214,7 @@ outnow: int sctp_is_there_unsent_data(struct sctp_tcb *stcb, int so_locked -#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED -#endif ) { int unsent_data; @@ -788,9 +786,6 @@ static int sctp_handle_abort(struct sctp_abort_chunk *abort, struct sctp_tcb *stcb, struct sctp_nets *net) { -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *so; -#endif uint16_t len; uint16_t error; @@ -838,20 +833,9 @@ sctp_handle_abort(struct sctp_abort_chunk *abort, #ifdef SCTP_ASOCLOG_OF_TSNS sctp_print_out_track_log(stcb); #endif -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - so = SCTP_INP_SO(stcb->sctp_ep); - 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 SCTP_ADD_SUBSTATE(stcb, SCTP_STATE_WAS_ABORTED); (void)sctp_free_assoc(stcb->sctp_ep, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_8); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif SCTPDBG(SCTP_DEBUG_INPUT2, "sctp_handle_abort: finished\n"); return (1); } @@ -892,9 +876,6 @@ sctp_handle_shutdown(struct sctp_shutdown_chunk *cp, struct sctp_association *asoc; int some_on_streamwheel; int old_state; -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *so; -#endif SCTPDBG(SCTP_DEBUG_INPUT2, "sctp_handle_shutdown: handling SHUTDOWN\n"); @@ -943,25 +924,9 @@ sctp_handle_shutdown(struct sctp_shutdown_chunk *cp, asoc->control_pdapi->pdapi_aborted = 1; asoc->control_pdapi = NULL; SCTP_INP_READ_UNLOCK(stcb->sctp_ep); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - so = SCTP_INP_SO(stcb->sctp_ep); - 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); - if (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) { - /* assoc was freed while we were unlocked */ - SCTP_SOCKET_UNLOCK(so, 1); - return; - } -#endif if (stcb->sctp_socket) { sctp_sorwakeup(stcb->sctp_ep, stcb->sctp_socket); } -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif } /* goto SHUTDOWN_RECEIVED state to block new requests */ if (stcb->sctp_socket) { @@ -1021,11 +986,7 @@ sctp_handle_shutdown_ack(struct sctp_shutdown_ack_chun struct sctp_nets *net) { struct sctp_association *asoc; -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *so; - so = SCTP_INP_SO(stcb->sctp_ep); -#endif SCTPDBG(SCTP_DEBUG_INPUT2, "sctp_handle_shutdown_ack: handling SHUTDOWN ACK\n"); if (stcb == NULL) @@ -1055,22 +1016,7 @@ sctp_handle_shutdown_ack(struct sctp_shutdown_ack_chun asoc->control_pdapi->pdapi_aborted = 1; asoc->control_pdapi = NULL; SCTP_INP_READ_UNLOCK(stcb->sctp_ep); -#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); - if (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) { - /* assoc was freed while we were unlocked */ - SCTP_SOCKET_UNLOCK(so, 1); - return; - } -#endif sctp_sorwakeup(stcb->sctp_ep, stcb->sctp_socket); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif } #ifdef INVARIANTS if (!TAILQ_EMPTY(&asoc->send_queue) || @@ -1094,18 +1040,8 @@ sctp_handle_shutdown_ack(struct sctp_shutdown_ack_chun } SCTP_STAT_INCR_COUNTER32(sctps_shutdown); /* free the TCB but first save off the ep */ -#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(stcb->sctp_ep, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_11); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif } static void @@ -1176,9 +1112,6 @@ sctp_handle_error(struct sctp_chunkhdr *ch, struct sctp_association *asoc; 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; @@ -1252,19 +1185,8 @@ sctp_handle_error(struct sctp_chunkhdr *ch, asoc->max_init_times) { sctp_abort_notification(stcb, 0, 0, NULL, SCTP_SO_NOT_LOCKED); /* now free the asoc */ -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - so = SCTP_INP_SO(stcb->sctp_ep); - 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(stcb->sctp_ep, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_12); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif return (-1); } /* blast back to INIT state */ @@ -1648,9 +1570,6 @@ sctp_process_cookie_existing(struct mbuf *m, int iphle if (((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) && (!SCTP_IS_LISTENING(inp))) { -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *so; -#endif /* * Here is where collision would go if we * did a connect() and instead got a @@ -1659,22 +1578,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphle */ stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_CONNECTED; -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - so = SCTP_INP_SO(stcb->sctp_ep); - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - SCTP_SOCKET_LOCK(so, 1); - SCTP_TCB_LOCK(stcb); - atomic_add_int(&stcb->asoc.refcnt, -1); - if (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) { - SCTP_SOCKET_UNLOCK(so, 1); - return (NULL); - } -#endif soisconnected(stcb->sctp_socket); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif } /* notify upper layer */ *notification = SCTP_NOTIFY_ASSOC_UP; @@ -1849,27 +1753,9 @@ sctp_process_cookie_existing(struct mbuf *m, int iphle if (((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) && (!SCTP_IS_LISTENING(inp))) { -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *so; -#endif stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_CONNECTED; -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - so = SCTP_INP_SO(stcb->sctp_ep); - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - SCTP_SOCKET_LOCK(so, 1); - SCTP_TCB_LOCK(stcb); - atomic_add_int(&stcb->asoc.refcnt, -1); - if (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) { - SCTP_SOCKET_UNLOCK(so, 1); - return (NULL); - } -#endif soisconnected(stcb->sctp_socket); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif } if (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_ECHOED) SCTP_STAT_INCR_COUNTER32(sctps_activeestab); @@ -1910,9 +1796,6 @@ sctp_process_cookie_existing(struct mbuf *m, int iphle cookie->tie_tag_peer_vtag == asoc->peer_vtag_nonce && cookie->tie_tag_peer_vtag != 0) { struct sctpasochead *head; -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *so; -#endif if (asoc->peer_supports_nat) { /* @@ -1980,10 +1863,6 @@ sctp_process_cookie_existing(struct mbuf *m, int iphle asoc->mapping_array_size); } SCTP_TCB_UNLOCK(stcb); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - so = SCTP_INP_SO(stcb->sctp_ep); - SCTP_SOCKET_LOCK(so, 1); -#endif SCTP_INP_INFO_WLOCK(); SCTP_INP_WLOCK(stcb->sctp_ep); SCTP_TCB_LOCK(stcb); @@ -2026,9 +1905,6 @@ sctp_process_cookie_existing(struct mbuf *m, int iphle SCTP_TCB_SEND_UNLOCK(stcb); SCTP_INP_WUNLOCK(stcb->sctp_ep); SCTP_INP_INFO_WUNLOCK(); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif asoc->total_flight = 0; asoc->total_flight_count = 0; /* process the INIT info (peer's info) */ @@ -2095,12 +1971,7 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, in int retval; int error = 0; uint8_t auth_chunk_buf[SCTP_CHUNK_BUFFER_SIZE]; -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *so; - so = SCTP_INP_SO(inp); -#endif - /* * find and validate the INIT chunk in the cookie (peer's info) the * INIT should start after the cookie-echo header struct (chunk @@ -2199,18 +2070,8 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, in 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 return (NULL); } /* process the INIT-ACK info (my info) */ @@ -2231,36 +2092,16 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, in else retval = 0; if (retval < 0) { -#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 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)) { -#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 return (NULL); } /* @@ -2282,18 +2123,8 @@ 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"); -#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 return (NULL); } else { /* remaining chunks checked... good to go */ @@ -2333,18 +2164,8 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, in break; #endif default: -#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 return (NULL); } @@ -2373,21 +2194,7 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, in * a bit of protection is worth having.. */ stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_CONNECTED; -#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); - if (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) { - SCTP_SOCKET_UNLOCK(so, 1); - return (NULL); - } -#endif soisconnected(stcb->sctp_socket); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif } else if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) && (SCTP_IS_LISTENING(inp))) { /* @@ -2807,9 +2614,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, in if (so == NULL) { struct mbuf *op_err; -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *pcb_so; -#endif + /* Too many sockets */ SCTPDBG(SCTP_DEBUG_INPUT1, "process_cookie_new: no room for another socket!\n"); op_err = sctp_generate_cause(SCTP_CAUSE_OUT_OF_RESC, ""); @@ -2817,19 +2622,8 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, in src, dst, sh, op_err, mflowtype, mflowid, vrf_id, port); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - pcb_so = SCTP_INP_SO(*inp_p); - atomic_add_int(&(*stcb)->asoc.refcnt, 1); - SCTP_TCB_UNLOCK((*stcb)); - SCTP_SOCKET_LOCK(pcb_so, 1); - SCTP_TCB_LOCK((*stcb)); - atomic_subtract_int(&(*stcb)->asoc.refcnt, 1); -#endif (void)sctp_free_assoc(*inp_p, *stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_23); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(pcb_so, 1); -#endif return (NULL); } inp = (struct sctp_inpcb *)so->so_pcb; @@ -2926,17 +2720,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, in * Pull it from the incomplete queue and wake the * guy */ -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - atomic_add_int(&(*stcb)->asoc.refcnt, 1); - SCTP_TCB_UNLOCK((*stcb)); - SCTP_SOCKET_LOCK(so, 1); -#endif soisconnected(so); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_TCB_LOCK((*stcb)); - atomic_subtract_int(&(*stcb)->asoc.refcnt, 1); - SCTP_SOCKET_UNLOCK(so, 1); -#endif return (m); } } @@ -2996,25 +2780,10 @@ sctp_handle_cookie_ack(struct sctp_cookie_ack_chunk *c sctp_ulp_notify(SCTP_NOTIFY_ASSOC_UP, stcb, 0, NULL, SCTP_SO_NOT_LOCKED); if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) { -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *so; - -#endif stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_CONNECTED; -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - so = SCTP_INP_SO(stcb->sctp_ep); - 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 if ((stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) == 0) { soisconnected(stcb->sctp_socket); } -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif } /* * since we did not send a HB make sure we don't double @@ -3238,9 +3007,6 @@ static void sctp_handle_shutdown_complete(struct sctp_shutdown_complete_chunk *cp SCTP_UNUSED, struct sctp_tcb *stcb, struct sctp_nets *net) { -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *so; -#endif SCTPDBG(SCTP_DEBUG_INPUT2, "sctp_handle_shutdown_complete: handling SHUTDOWN-COMPLETE\n"); @@ -3273,19 +3039,8 @@ sctp_handle_shutdown_complete(struct sctp_shutdown_com /* free the TCB */ SCTPDBG(SCTP_DEBUG_INPUT2, "sctp_handle_shutdown_complete: calls free-asoc\n"); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - so = SCTP_INP_SO(stcb->sctp_ep); - 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(stcb->sctp_ep, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_25); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif return; } @@ -4570,9 +4325,6 @@ sctp_process_control(struct mbuf *m, int iphlen, int * uint32_t auth_offset = 0, auth_len = 0; int auth_skipped = 0; int asconf_cnt = 0; -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *so; -#endif SCTPDBG(SCTP_DEBUG_INPUT1, "sctp_process_control: iphlen=%u, offset=%u, length=%u stcb:%p\n", iphlen, *offset, length, (void *)stcb); @@ -4881,19 +4633,8 @@ process_control_chunks: } else { *offset = length; if (stcb != NULL) { -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - so = SCTP_INP_SO(inp); - 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_29); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif } return (NULL); } @@ -5245,19 +4986,8 @@ process_control_chunks: if ((stcb) && (stcb->asoc.total_output_queue_size)) { ; } else if (stcb) { -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - so = SCTP_INP_SO(inp); - 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_30); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif *offset = length; return (NULL); } @@ -5360,19 +5090,8 @@ process_control_chunks: *fwd_tsn_seen = 1; if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) { /* We are not interested anymore */ -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - so = SCTP_INP_SO(inp); - 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_31); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif *offset = length; return (NULL); } Modified: stable/12/sys/netinet/sctp_output.c ============================================================================== --- stable/12/sys/netinet/sctp_output.c Sun Aug 23 23:22:55 2020 (r364596) +++ stable/12/sys/netinet/sctp_output.c Sun Aug 23 23:24:38 2020 (r364597) @@ -3990,11 +3990,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, uint16_t port, union sctp_sockstore *over_addr, uint8_t mflowtype, uint32_t mflowid, -#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) int so_locked SCTP_UNUSED -#else - int so_locked -#endif ) { /* nofragment_flag to tell if IP_DF should be set (IPv4 only) */ @@ -4024,9 +4020,6 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, struct udphdr *udp = NULL; #endif uint8_t tos_value; -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *so = NULL; -#endif if ((net) && (net->dest_state & SCTP_ADDR_OUT_OF_SCOPE)) { SCTP_LTRACE_ERR_RET_PKT(m, inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EFAULT); @@ -4250,23 +4243,8 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, sctp_packet_log(o_pak); #endif /* send it out. table id is taken from stcb */ -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - if ((SCTP_BASE_SYSCTL(sctp_output_unlocked)) && (so_locked)) { - so = SCTP_INP_SO(inp); - SCTP_SOCKET_UNLOCK(so, 0); - } -#endif SCTP_PROBE5(send, NULL, stcb, ip, stcb, sctphdr); SCTP_IP_OUTPUT(ret, o_pak, ro, stcb, vrf_id); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - if ((SCTP_BASE_SYSCTL(sctp_output_unlocked)) && (so_locked)) { - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - SCTP_SOCKET_LOCK(so, 0); - SCTP_TCB_LOCK(stcb); - atomic_subtract_int(&stcb->asoc.refcnt, 1); - } -#endif if (port) { UDPSTAT_INC(udps_opackets); } @@ -4588,27 +4566,12 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, SCTP_STAT_INCR(sctps_sendhwcrc); } /* send it out. table id is taken from stcb */ -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - if ((SCTP_BASE_SYSCTL(sctp_output_unlocked)) && (so_locked)) { - so = SCTP_INP_SO(inp); - SCTP_SOCKET_UNLOCK(so, 0); - } -#endif #ifdef SCTP_PACKET_LOGGING if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) sctp_packet_log(o_pak); #endif SCTP_PROBE5(send, NULL, stcb, ip6h, stcb, sctphdr); SCTP_IP6_OUTPUT(ret, o_pak, (struct route_in6 *)ro, &ifp, stcb, vrf_id); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - if ((SCTP_BASE_SYSCTL(sctp_output_unlocked)) && (so_locked)) { - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - SCTP_SOCKET_LOCK(so, 0); - SCTP_TCB_LOCK(stcb); - atomic_subtract_int(&stcb->asoc.refcnt, 1); - } -#endif if (net) { /* for link local this must be done */ sin6->sin6_scope_id = prev_scope; @@ -4680,9 +4643,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, void sctp_send_initiate(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int so_locked -#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED -#endif ) { struct mbuf *m, *m_last; @@ -6618,9 +6579,7 @@ sctp_med_chunk_output(struct sctp_inpcb *inp, int *reason_code, int control_only, int from_where, struct timeval *now, int *now_filled, int frag_point, int so_locked -#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED -#endif ); static void @@ -7082,9 +7041,7 @@ all_done: static void sctp_clean_up_ctl(struct sctp_tcb *stcb, struct sctp_association *asoc, int so_locked -#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED -#endif ) { struct sctp_tmit_chunk *chk, *nchk; @@ -7191,9 +7148,7 @@ sctp_move_to_outqueue(struct sctp_tcb *stcb, int eeor_mode, int *bail, int so_locked -#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED -#endif ) { /* Move from the stream to the send_queue keeping track of the total */ @@ -7722,9 +7677,7 @@ out_of: static void sctp_fill_outqueue(struct sctp_tcb *stcb, struct sctp_nets *net, int frag_point, int eeor_mode, int *quit_now, int so_locked -#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED -#endif ) { struct sctp_association *asoc; @@ -7845,9 +7798,7 @@ sctp_med_chunk_output(struct sctp_inpcb *inp, int *reason_code, int control_only, int from_where, struct timeval *now, int *now_filled, int frag_point, int so_locked -#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED -#endif ) { /** @@ -9464,9 +9415,7 @@ sctp_chunk_retransmission(struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_association *asoc, int *cnt_out, struct timeval *now, int *now_filled, int *fr_done, int so_locked -#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED -#endif ) { /*- @@ -10017,9 +9966,7 @@ sctp_chunk_output(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_where, int so_locked -#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED -#endif ) { /*- @@ -10538,9 +10485,7 @@ sctp_fill_in_rest: void sctp_send_sack(struct sctp_tcb *stcb, int so_locked -#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED -#endif ) { /*- @@ -10936,9 +10881,7 @@ sctp_send_sack(struct sctp_tcb *stcb, int so_locked void sctp_send_abort_tcb(struct sctp_tcb *stcb, struct mbuf *operr, int so_locked -#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED -#endif ) { struct mbuf *m_abort, *m, *m_last; @@ -11356,9 +11299,7 @@ sctp_send_shutdown_complete2(struct sockaddr *src, str void sctp_send_hb(struct sctp_tcb *stcb, struct sctp_nets *net, int so_locked -#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED -#endif ) { struct sctp_tmit_chunk *chk; Modified: stable/12/sys/netinet/sctp_output.h ============================================================================== --- stable/12/sys/netinet/sctp_output.h Sun Aug 23 23:22:55 2020 (r364596) +++ stable/12/sys/netinet/sctp_output.h Sun Aug 23 23:24:38 2020 (r364597) @@ -76,9 +76,7 @@ int void sctp_send_initiate(struct sctp_inpcb *, struct sctp_tcb *, int -#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED -#endif ); void @@ -148,15 +146,11 @@ sctp_output(struct sctp_inpcb *, struct mbuf *, struct void sctp_chunk_output(struct sctp_inpcb *, struct sctp_tcb *, int, int -#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED -#endif ); void sctp_send_abort_tcb(struct sctp_tcb *, struct mbuf *, int -#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED -#endif ); void send_forward_tsn(struct sctp_tcb *, struct sctp_association *); Modified: stable/12/sys/netinet/sctp_sysctl.c ============================================================================== --- stable/12/sys/netinet/sctp_sysctl.c Sun Aug 23 23:22:55 2020 (r364596) +++ stable/12/sys/netinet/sctp_sysctl.c Sun Aug 23 23:24:38 2020 (r364597) @@ -130,9 +130,6 @@ sctp_init_sysctls() #if defined(SCTP_DEBUG) SCTP_BASE_SYSCTL(sctp_debug_on) = SCTPCTL_DEBUG_DEFAULT; #endif -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_BASE_SYSCTL(sctp_output_unlocked) = SCTPCTL_OUTPUT_UNLOCKED_DEFAULT; -#endif } @@ -948,9 +945,6 @@ SCTP_UINT_SYSCTL(sendall_limit, sctp_sendall_limit, SC SCTP_UINT_SYSCTL(diag_info_code, sctp_diag_info_code, SCTPCTL_DIAG_INFO_CODE) #ifdef SCTP_DEBUG SCTP_UINT_SYSCTL(debug, sctp_debug_on, SCTPCTL_DEBUG) -#endif -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) -SCTP_UINT_SYSCTL(output_unlocked, sctp_output_unlocked, SCTPCTL_OUTPUT_UNLOCKED) #endif SYSCTL_PROC(_net_inet_sctp, OID_AUTO, stats, CTLFLAG_VNET | CTLTYPE_STRUCT | CTLFLAG_RW, NULL, 0, sctp_sysctl_handle_stats, "S,sctpstat", "SCTP statistics (struct sctp_stat)"); Modified: stable/12/sys/netinet/sctp_sysctl.h ============================================================================== --- stable/12/sys/netinet/sctp_sysctl.h Sun Aug 23 23:22:55 2020 (r364596) +++ stable/12/sys/netinet/sctp_sysctl.h Sun Aug 23 23:24:38 2020 (r364597) @@ -120,9 +120,6 @@ struct sctp_sysctl { #if defined(SCTP_DEBUG) uint32_t sctp_debug_on; #endif -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - uint32_t sctp_output_unlocked; -#endif }; /* @@ -559,12 +556,6 @@ struct sctp_sysctl { #endif -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) -#define SCTPCTL_OUTPUT_UNLOCKED_DESC "Unlock socket when sending packets down to IP" -#define SCTPCTL_OUTPUT_UNLOCKED_MIN 0 -#define SCTPCTL_OUTPUT_UNLOCKED_MAX 1 -#define SCTPCTL_OUTPUT_UNLOCKED_DEFAULT SCTPCTL_OUTPUT_UNLOCKED_MIN -#endif #if defined(_KERNEL) || defined(__Userspace__) Modified: stable/12/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/12/sys/netinet/sctp_usrreq.c Sun Aug 23 23:22:55 2020 (r364596) +++ stable/12/sys/netinet/sctp_usrreq.c Sun Aug 23 23:24:38 2020 (r364597) @@ -163,9 +163,6 @@ sctp_notify(struct sctp_inpcb *inp, uint16_t ip_len, uint32_t next_mtu) { -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *so; -#endif int timer_stopped; if (icmp_type != ICMP_UNREACH) { @@ -195,20 +192,8 @@ sctp_notify(struct sctp_inpcb *inp, (icmp_code == ICMP_UNREACH_PORT)) { /* Treat it like an ABORT. */ sctp_abort_notification(stcb, 1, 0, NULL, SCTP_SO_NOT_LOCKED); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - so = SCTP_INP_SO(inp); - 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); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-12@freebsd.org Sun Aug 23 23:26:01 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2CE2C3CF608; Sun, 23 Aug 2020 23:26: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZWbF0N9yz3X39; Sun, 23 Aug 2020 23:26: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 E3AE0F053; Sun, 23 Aug 2020 23:26:00 +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 07NNQ0bQ036988; Sun, 23 Aug 2020 23:26:00 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NNQ0S1036985; Sun, 23 Aug 2020 23:26:00 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008232326.07NNQ0S1036985@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 23 Aug 2020 23:26:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364598 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364598 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 23:26:01 -0000 Author: tuexen Date: Sun Aug 23 23:26:00 2020 New Revision: 364598 URL: https://svnweb.freebsd.org/changeset/base/364598 Log: MFC r361934: Whitespace cleanups and removal of a stale comment. Modified: stable/12/sys/netinet/sctp_pcb.c stable/12/sys/netinet/sctp_sysctl.c stable/12/sys/netinet/sctputil.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_pcb.c ============================================================================== --- stable/12/sys/netinet/sctp_pcb.c Sun Aug 23 23:24:38 2020 (r364597) +++ stable/12/sys/netinet/sctp_pcb.c Sun Aug 23 23:26:00 2020 (r364598) @@ -5698,7 +5698,6 @@ sctp_startup_mcore_threads(void) i++; } } - /* Now start them all */ CPU_FOREACH(cpu) { (void)kproc_create(sctp_mcore_thread, @@ -5707,7 +5706,6 @@ sctp_startup_mcore_threads(void) RFPROC, SCTP_KTHREAD_PAGES, SCTP_MCORE_NAME); - } } #endif Modified: stable/12/sys/netinet/sctp_sysctl.c ============================================================================== --- stable/12/sys/netinet/sctp_sysctl.c Sun Aug 23 23:24:38 2020 (r364597) +++ stable/12/sys/netinet/sctp_sysctl.c Sun Aug 23 23:26:00 2020 (r364598) @@ -451,7 +451,6 @@ sctp_sysctl_handle_assoclist(SYSCTL_HANDLER_ARGS) xstcb.primary_addr = stcb->asoc.primary_destination->ro._l_addr; xstcb.heartbeat_interval = stcb->asoc.heart_beat_delay; xstcb.state = (uint32_t)sctp_map_assoc_state(stcb->asoc.state); - /* 7.0 does not support these */ xstcb.assoc_id = sctp_get_associd(stcb); xstcb.peers_rwnd = stcb->asoc.peers_rwnd; xstcb.in_streams = stcb->asoc.streamincnt; Modified: stable/12/sys/netinet/sctputil.c ============================================================================== --- stable/12/sys/netinet/sctputil.c Sun Aug 23 23:24:38 2020 (r364597) +++ stable/12/sys/netinet/sctputil.c Sun Aug 23 23:26:00 2020 (r364598) @@ -5553,7 +5553,6 @@ sctp_sorecvmsg(struct socket *so, sockbuf_lock = 1; restart: - restart_nosblocks: if (hold_sblock == 0) { SOCKBUF_LOCK(&so->so_rcv); From owner-svn-src-stable-12@freebsd.org Sun Aug 23 23:39:52 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 239FA3CF87B; Sun, 23 Aug 2020 23:39: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZWvD05S7z3XhM; Sun, 23 Aug 2020 23:39: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 C105AF611; Sun, 23 Aug 2020 23:39: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 07NNdp7j043346; Sun, 23 Aug 2020 23:39:51 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NNdpta043345; Sun, 23 Aug 2020 23:39:51 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202008232339.07NNdpta043345@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 23 Aug 2020 23:39:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364599 - stable/12 X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12 X-SVN-Commit-Revision: 364599 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 23:39:52 -0000 Author: kevans Date: Sun Aug 23 23:39:51 2020 New Revision: 364599 URL: https://svnweb.freebsd.org/changeset/base/364599 Log: Record-only MFC of r351954, r352942 These were merged in r352273 and r353322 respectively. Modified: Directory Properties: stable/12/ (props changed) From owner-svn-src-stable-12@freebsd.org Mon Aug 24 01:11:29 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D105A3A9DEA; Mon, 24 Aug 2020 01:11:29 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZYwx5D5Sz3ckV; Mon, 24 Aug 2020 01:11:29 +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 968481044A; Mon, 24 Aug 2020 01:11:29 +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 07O1BT4u001481; Mon, 24 Aug 2020 01:11:29 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O1BTOU001480; Mon, 24 Aug 2020 01:11:29 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202008240111.07O1BTOU001480@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 24 Aug 2020 01:11:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364601 - stable/12/sys/cam/ctl X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/cam/ctl X-SVN-Commit-Revision: 364601 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 01:11:29 -0000 Author: mav Date: Mon Aug 24 01:11:29 2020 New Revision: 364601 URL: https://svnweb.freebsd.org/changeset/base/364601 Log: MFC r364463: Fix CTL ioctl port creation error handling. Modified: stable/12/sys/cam/ctl/ctl_frontend_ioctl.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/ctl/ctl_frontend_ioctl.c ============================================================================== --- stable/12/sys/cam/ctl/ctl_frontend_ioctl.c Sun Aug 23 23:56:57 2020 (r364600) +++ stable/12/sys/cam/ctl/ctl_frontend_ioctl.c Mon Aug 24 01:11:29 2020 (r364601) @@ -226,7 +226,7 @@ cfi_ioctl_port_create(struct ctl_req *req) req->status = CTL_LUN_ERROR; snprintf(req->error_str, sizeof(req->error_str), "ctl_port_register() failed with error %d", retval); - free(port, M_CTL); + free(cfi, M_CTL); return; } @@ -247,7 +247,9 @@ cfi_ioctl_port_create(struct ctl_req *req) req->status = CTL_LUN_ERROR; snprintf(req->error_str, sizeof(req->error_str), "make_dev_s() failed with error %d", retval); - free(port, M_CTL); + ctl_port_offline(port); + ctl_port_deregister(port); + free(cfi, M_CTL); return; } From owner-svn-src-stable-12@freebsd.org Mon Aug 24 07:42:53 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 663AB3B2D65; Mon, 24 Aug 2020 07:42:53 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZkcY2BrQz4GN1; Mon, 24 Aug 2020 07:42:53 +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 1660E15297; Mon, 24 Aug 2020 07:42:53 +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 07O7gr80045241; Mon, 24 Aug 2020 07:42:53 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O7gpKH045231; Mon, 24 Aug 2020 07:42:51 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240742.07O7gpKH045231@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 07:42:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364605 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364605 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 07:42:53 -0000 Author: tuexen Date: Mon Aug 24 07:42:50 2020 New Revision: 364605 URL: https://svnweb.freebsd.org/changeset/base/364605 Log: MFC r362054: Non-functional changes due to upstream cleanup. Modified: stable/12/sys/netinet/sctp_asconf.c stable/12/sys/netinet/sctp_auth.c stable/12/sys/netinet/sctp_input.c stable/12/sys/netinet/sctp_output.c stable/12/sys/netinet/sctp_output.h stable/12/sys/netinet/sctp_peeloff.c stable/12/sys/netinet/sctp_timer.c stable/12/sys/netinet/sctp_usrreq.c stable/12/sys/netinet/sctputil.c stable/12/sys/netinet/sctputil.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_asconf.c ============================================================================== --- stable/12/sys/netinet/sctp_asconf.c Mon Aug 24 01:58:46 2020 (r364604) +++ stable/12/sys/netinet/sctp_asconf.c Mon Aug 24 07:42:50 2020 (r364605) @@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$"); * SCTP_DEBUG_ASCONF2: detailed info */ - /* * RFC 5061 * Modified: stable/12/sys/netinet/sctp_auth.c ============================================================================== --- stable/12/sys/netinet/sctp_auth.c Mon Aug 24 01:58:46 2020 (r364604) +++ stable/12/sys/netinet/sctp_auth.c Mon Aug 24 07:42:50 2020 (r364605) @@ -565,9 +565,7 @@ sctp_auth_key_acquire(struct sctp_tcb *stcb, uint16_t } void -sctp_auth_key_release(struct sctp_tcb *stcb, uint16_t key_id, int so_locked - SCTP_UNUSED -) +sctp_auth_key_release(struct sctp_tcb *stcb, uint16_t key_id, int so_locked) { sctp_sharedkey_t *skey; @@ -1718,9 +1716,7 @@ sctp_handle_auth(struct sctp_tcb *stcb, struct sctp_au */ void sctp_notify_authentication(struct sctp_tcb *stcb, uint32_t indication, - uint16_t keyid, uint16_t alt_keyid, int so_locked - SCTP_UNUSED -) + uint16_t keyid, uint16_t alt_keyid, int so_locked) { struct mbuf *m_notify; struct sctp_authkey_event *auth; Modified: stable/12/sys/netinet/sctp_input.c ============================================================================== --- stable/12/sys/netinet/sctp_input.c Mon Aug 24 01:58:46 2020 (r364604) +++ stable/12/sys/netinet/sctp_input.c Mon Aug 24 07:42:50 2020 (r364605) @@ -55,8 +55,6 @@ __FBSDID("$FreeBSD$"); #endif #include - - static void sctp_stop_all_cookie_timers(struct sctp_tcb *stcb) { @@ -213,9 +211,7 @@ outnow: */ int -sctp_is_there_unsent_data(struct sctp_tcb *stcb, int so_locked - SCTP_UNUSED -) +sctp_is_there_unsent_data(struct sctp_tcb *stcb, int so_locked) { int unsent_data; unsigned int i; Modified: stable/12/sys/netinet/sctp_output.c ============================================================================== --- stable/12/sys/netinet/sctp_output.c Mon Aug 24 01:58:46 2020 (r364604) +++ stable/12/sys/netinet/sctp_output.c Mon Aug 24 07:42:50 2020 (r364605) @@ -60,7 +60,6 @@ __FBSDID("$FreeBSD$"); #include - #define SCTP_MAX_GAPS_INARRAY 4 struct sack_track { uint8_t right_edge; /* mergable on the right edge */ @@ -3990,8 +3989,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, uint16_t port, union sctp_sockstore *over_addr, uint8_t mflowtype, uint32_t mflowid, - int so_locked SCTP_UNUSED -) + int so_locked) { /* nofragment_flag to tell if IP_DF should be set (IPv4 only) */ /** @@ -4642,9 +4640,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, void -sctp_send_initiate(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int so_locked - SCTP_UNUSED -) +sctp_send_initiate(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int so_locked) { struct mbuf *m, *m_last; struct sctp_nets *net; @@ -6578,9 +6574,7 @@ sctp_med_chunk_output(struct sctp_inpcb *inp, int *num_out, int *reason_code, int control_only, int from_where, - struct timeval *now, int *now_filled, int frag_point, int so_locked - SCTP_UNUSED -); + struct timeval *now, int *now_filled, int frag_point, int so_locked); static void sctp_sendall_iterator(struct sctp_inpcb *inp, struct sctp_tcb *stcb, void *ptr, @@ -7040,9 +7034,7 @@ all_done: } static void -sctp_clean_up_ctl(struct sctp_tcb *stcb, struct sctp_association *asoc, int so_locked - SCTP_UNUSED -) +sctp_clean_up_ctl(struct sctp_tcb *stcb, struct sctp_association *asoc, int so_locked) { struct sctp_tmit_chunk *chk, *nchk; @@ -7147,9 +7139,7 @@ sctp_move_to_outqueue(struct sctp_tcb *stcb, int *giveup, int eeor_mode, int *bail, - int so_locked - SCTP_UNUSED -) + int so_locked) { /* Move from the stream to the send_queue keeping track of the total */ struct sctp_association *asoc; @@ -7676,9 +7666,7 @@ out_of: static void sctp_fill_outqueue(struct sctp_tcb *stcb, - struct sctp_nets *net, int frag_point, int eeor_mode, int *quit_now, int so_locked - SCTP_UNUSED -) + struct sctp_nets *net, int frag_point, int eeor_mode, int *quit_now, int so_locked) { struct sctp_association *asoc; struct sctp_stream_out *strq; @@ -7797,9 +7785,7 @@ sctp_med_chunk_output(struct sctp_inpcb *inp, int *num_out, int *reason_code, int control_only, int from_where, - struct timeval *now, int *now_filled, int frag_point, int so_locked - SCTP_UNUSED -) + struct timeval *now, int *now_filled, int frag_point, int so_locked) { /** * Ok this is the generic chunk service queue. we must do the @@ -9414,9 +9400,7 @@ static int sctp_chunk_retransmission(struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_association *asoc, - int *cnt_out, struct timeval *now, int *now_filled, int *fr_done, int so_locked - SCTP_UNUSED -) + int *cnt_out, struct timeval *now, int *now_filled, int *fr_done, int so_locked) { /*- * send out one MTU of retransmission. If fast_retransmit is @@ -9965,9 +9949,7 @@ void sctp_chunk_output(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_where, - int so_locked - SCTP_UNUSED -) + int so_locked) { /*- * Ok this is the generic chunk service queue. we must do the @@ -10484,9 +10466,7 @@ sctp_fill_in_rest: } void -sctp_send_sack(struct sctp_tcb *stcb, int so_locked - SCTP_UNUSED -) +sctp_send_sack(struct sctp_tcb *stcb, int so_locked) { /*- * Queue up a SACK or NR-SACK in the control queue. @@ -10880,9 +10860,7 @@ sctp_send_sack(struct sctp_tcb *stcb, int so_locked } void -sctp_send_abort_tcb(struct sctp_tcb *stcb, struct mbuf *operr, int so_locked - SCTP_UNUSED -) +sctp_send_abort_tcb(struct sctp_tcb *stcb, struct mbuf *operr, int so_locked) { struct mbuf *m_abort, *m, *m_last; struct mbuf *m_out, *m_end = NULL; @@ -11298,9 +11276,7 @@ sctp_send_shutdown_complete2(struct sockaddr *src, str } void -sctp_send_hb(struct sctp_tcb *stcb, struct sctp_nets *net, int so_locked - SCTP_UNUSED -) +sctp_send_hb(struct sctp_tcb *stcb, struct sctp_nets *net, int so_locked) { struct sctp_tmit_chunk *chk; struct sctp_heartbeat_chunk *hb; Modified: stable/12/sys/netinet/sctp_output.h ============================================================================== --- stable/12/sys/netinet/sctp_output.h Mon Aug 24 01:58:46 2020 (r364604) +++ stable/12/sys/netinet/sctp_output.h Mon Aug 24 07:42:50 2020 (r364605) @@ -74,10 +74,7 @@ int int sctp_v4src_match_nexthop(struct sctp_ifa *sifa, sctp_route_t *ro); -void -sctp_send_initiate(struct sctp_inpcb *, struct sctp_tcb *, int - SCTP_UNUSED -); +void sctp_send_initiate(struct sctp_inpcb *, struct sctp_tcb *, int); void sctp_send_initiate_ack(struct sctp_inpcb *, struct sctp_tcb *, @@ -144,15 +141,10 @@ int sctp_output(struct sctp_inpcb *, struct mbuf *, struct sockaddr *, struct mbuf *, struct thread *, int); -void -sctp_chunk_output(struct sctp_inpcb *, struct sctp_tcb *, int, int - SCTP_UNUSED -); -void -sctp_send_abort_tcb(struct sctp_tcb *, struct mbuf *, int - SCTP_UNUSED -); +void sctp_chunk_output(struct sctp_inpcb *, struct sctp_tcb *, int, int); +void sctp_send_abort_tcb(struct sctp_tcb *, struct mbuf *, int); + void send_forward_tsn(struct sctp_tcb *, struct sctp_association *); void sctp_send_sack(struct sctp_tcb *, int); @@ -160,7 +152,6 @@ void sctp_send_sack(struct sctp_tcb *, int); void sctp_send_hb(struct sctp_tcb *, struct sctp_nets *, int); void sctp_send_ecn_echo(struct sctp_tcb *, struct sctp_nets *, uint32_t); - void sctp_send_packet_dropped(struct sctp_tcb *, struct sctp_nets *, struct mbuf *, Modified: stable/12/sys/netinet/sctp_peeloff.c ============================================================================== --- stable/12/sys/netinet/sctp_peeloff.c Mon Aug 24 01:58:46 2020 (r364604) +++ stable/12/sys/netinet/sctp_peeloff.c Mon Aug 24 07:42:50 2020 (r364605) @@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$"); #include #include - int sctp_can_peel_off(struct socket *head, sctp_assoc_t assoc_id) { Modified: stable/12/sys/netinet/sctp_timer.c ============================================================================== --- stable/12/sys/netinet/sctp_timer.c Mon Aug 24 01:58:46 2020 (r364604) +++ stable/12/sys/netinet/sctp_timer.c Mon Aug 24 07:42:50 2020 (r364605) @@ -55,7 +55,6 @@ __FBSDID("$FreeBSD$"); #include #endif - void sctp_audit_retranmission_queue(struct sctp_association *asoc) { Modified: stable/12/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/12/sys/netinet/sctp_usrreq.c Mon Aug 24 01:58:46 2020 (r364604) +++ stable/12/sys/netinet/sctp_usrreq.c Mon Aug 24 07:42:50 2020 (r364605) @@ -56,7 +56,6 @@ __FBSDID("$FreeBSD$"); #include - extern const struct sctp_cc_functions sctp_cc_functions[]; extern const struct sctp_ss_functions sctp_ss_functions[]; Modified: stable/12/sys/netinet/sctputil.c ============================================================================== --- stable/12/sys/netinet/sctputil.c Mon Aug 24 01:58:46 2020 (r364604) +++ stable/12/sys/netinet/sctputil.c Mon Aug 24 07:42:50 2020 (r364605) @@ -62,7 +62,6 @@ __FBSDID("$FreeBSD$"); #include #endif - #ifndef KTR_SCTP #define KTR_SCTP KTR_SUBSYS #endif @@ -3112,9 +3111,7 @@ sctp_pad_lastmbuf(struct mbuf *m, int padval, struct m static void sctp_notify_assoc_change(uint16_t state, struct sctp_tcb *stcb, - uint16_t error, struct sctp_abort_chunk *abort, uint8_t from_peer, int so_locked - SCTP_UNUSED -) + uint16_t error, struct sctp_abort_chunk *abort, uint8_t from_peer, int so_locked) { struct mbuf *m_notify; struct sctp_assoc_change *sac; @@ -3249,9 +3246,7 @@ set_error: static void sctp_notify_peer_addr_change(struct sctp_tcb *stcb, uint32_t state, - struct sockaddr *sa, uint32_t error, int so_locked - SCTP_UNUSED -) + struct sockaddr *sa, uint32_t error, int so_locked) { struct mbuf *m_notify; struct sctp_paddr_change *spc; @@ -3340,9 +3335,7 @@ sctp_notify_peer_addr_change(struct sctp_tcb *stcb, ui static void sctp_notify_send_failed(struct sctp_tcb *stcb, uint8_t sent, uint32_t error, - struct sctp_tmit_chunk *chk, int so_locked - SCTP_UNUSED -) + struct sctp_tmit_chunk *chk, int so_locked) { struct mbuf *m_notify; struct sctp_send_failed *ssf; @@ -3474,9 +3467,7 @@ sctp_notify_send_failed(struct sctp_tcb *stcb, uint8_t static void sctp_notify_send_failed2(struct sctp_tcb *stcb, uint32_t error, - struct sctp_stream_queue_pending *sp, int so_locked - SCTP_UNUSED -) + struct sctp_stream_queue_pending *sp, int so_locked) { struct mbuf *m_notify; struct sctp_send_failed *ssf; @@ -3622,9 +3613,7 @@ sctp_notify_adaptation_layer(struct sctp_tcb *stcb) /* This always must be called with the read-queue LOCKED in the INP */ static void sctp_notify_partial_delivery_indication(struct sctp_tcb *stcb, uint32_t error, - uint32_t val, int so_locked - SCTP_UNUSED -) + uint32_t val, int so_locked) { struct mbuf *m_notify; struct sctp_pdapi_event *pdapi; @@ -3745,9 +3734,7 @@ sctp_notify_shutdown_event(struct sctp_tcb *stcb) static void sctp_notify_sender_dry_event(struct sctp_tcb *stcb, - int so_locked - SCTP_UNUSED -) + int so_locked) { struct mbuf *m_notify; struct sctp_sender_dry_event *event; @@ -4034,9 +4021,7 @@ sctp_notify_remote_error(struct sctp_tcb *stcb, uint16 void sctp_ulp_notify(uint32_t notification, struct sctp_tcb *stcb, - uint32_t error, void *data, int so_locked - SCTP_UNUSED -) + uint32_t error, void *data, int so_locked) { if ((stcb == NULL) || (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) || @@ -4211,9 +4196,7 @@ sctp_ulp_notify(uint32_t notification, struct sctp_tcb } void -sctp_report_all_outbound(struct sctp_tcb *stcb, uint16_t error, int holds_lock, int so_locked - SCTP_UNUSED -) +sctp_report_all_outbound(struct sctp_tcb *stcb, uint16_t error, int holds_lock, int so_locked) { struct sctp_association *asoc; struct sctp_stream_out *outs; @@ -4322,9 +4305,7 @@ sctp_report_all_outbound(struct sctp_tcb *stcb, uint16 void sctp_abort_notification(struct sctp_tcb *stcb, uint8_t from_peer, uint16_t error, - struct sctp_abort_chunk *abort, int so_locked - SCTP_UNUSED -) + struct sctp_abort_chunk *abort, int so_locked) { if (stcb == NULL) { return; @@ -4446,9 +4427,7 @@ none_in: void sctp_abort_an_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct mbuf *op_err, - int so_locked - SCTP_UNUSED -) + int so_locked) { if (stcb == NULL) { @@ -4826,9 +4805,7 @@ sctp_add_to_readq(struct sctp_inpcb *inp, struct sockbuf *sb, int end, int inp_read_lock_held, - int so_locked - SCTP_UNUSED -) + int so_locked) { /* * Here we must place the control on the end of the socket read @@ -5006,9 +4983,7 @@ sctp_free_bufspace(struct sctp_tcb *stcb, struct sctp_ int sctp_release_pr_sctp_chunk(struct sctp_tcb *stcb, struct sctp_tmit_chunk *tp1, - uint8_t sent, int so_locked - SCTP_UNUSED -) + uint8_t sent, int so_locked) { struct sctp_stream_out *strq; struct sctp_tmit_chunk *chk = NULL, *tp2; Modified: stable/12/sys/netinet/sctputil.h ============================================================================== --- stable/12/sys/netinet/sctputil.h Mon Aug 24 01:58:46 2020 (r364604) +++ stable/12/sys/netinet/sctputil.h Mon Aug 24 07:42:50 2020 (r364605) @@ -117,9 +117,7 @@ sctp_add_to_readq(struct sctp_inpcb *inp, struct sockbuf *sb, int end, int inpread_locked, - int so_locked - SCTP_UNUSED -); + int so_locked); void sctp_iterator_worker(void); @@ -145,10 +143,7 @@ struct mbuf *sctp_add_pad_tombuf(struct mbuf *, int); struct mbuf *sctp_pad_lastmbuf(struct mbuf *, int, struct mbuf *); -void -sctp_ulp_notify(uint32_t, struct sctp_tcb *, uint32_t, void *, int - SCTP_UNUSED -); +void sctp_ulp_notify(uint32_t, struct sctp_tcb *, uint32_t, void *, int); void sctp_pull_off_control_to_new_inp(struct sctp_inpcb *old_inp, @@ -161,18 +156,13 @@ void sctp_stop_timers_for_shutdown(struct sctp_tcb *); /* Stop all timers for association and remote addresses. */ void sctp_stop_association_timers(struct sctp_tcb *, bool); -void -sctp_report_all_outbound(struct sctp_tcb *, uint16_t, int, int - SCTP_UNUSED -); +void sctp_report_all_outbound(struct sctp_tcb *, uint16_t, int, int); int sctp_expand_mapping_array(struct sctp_association *, uint32_t); void sctp_abort_notification(struct sctp_tcb *, uint8_t, uint16_t, - struct sctp_abort_chunk *, int - SCTP_UNUSED -); + struct sctp_abort_chunk *, int); /* We abort responding to an IP packet for some reason */ void @@ -186,9 +176,7 @@ sctp_abort_association(struct sctp_inpcb *, struct sct /* We choose to abort via user input */ void sctp_abort_an_association(struct sctp_inpcb *, struct sctp_tcb *, - struct mbuf *, int - SCTP_UNUSED -); + struct mbuf *, int); void sctp_handle_ootb(struct mbuf *, int, int, @@ -234,9 +222,7 @@ void sctp_print_address(struct sockaddr *); int sctp_release_pr_sctp_chunk(struct sctp_tcb *, struct sctp_tmit_chunk *, - uint8_t, int - SCTP_UNUSED -); + uint8_t, int); struct mbuf *sctp_generate_cause(uint16_t, char *); struct mbuf *sctp_generate_no_user_data_cause(uint32_t); From owner-svn-src-stable-12@freebsd.org Mon Aug 24 07:53:15 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 55CAD3B316F; Mon, 24 Aug 2020 07:53: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZkrW1K9Dz4HJ7; Mon, 24 Aug 2020 07:53: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 11C5814AFD; Mon, 24 Aug 2020 07:53: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 07O7rEXN051840; Mon, 24 Aug 2020 07:53:14 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O7rEYD051839; Mon, 24 Aug 2020 07:53:14 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240753.07O7rEYD051839@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 07:53:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364606 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364606 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 07:53:15 -0000 Author: tuexen Date: Mon Aug 24 07:53:14 2020 New Revision: 364606 URL: https://svnweb.freebsd.org/changeset/base/364606 Log: MFC r362090: Small cleanup due to upstream ifdef cleanups. Modified: stable/12/sys/netinet/sctputil.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctputil.h ============================================================================== --- stable/12/sys/netinet/sctputil.h Mon Aug 24 07:42:50 2020 (r364605) +++ stable/12/sys/netinet/sctputil.h Mon Aug 24 07:53:14 2020 (r364606) @@ -55,7 +55,7 @@ void sctp_m_freem(struct mbuf *m); #define sctp_m_freem m_freem #endif -#if defined(SCTP_LOCAL_TRACE_BUF) || defined(__APPLE__) +#if defined(SCTP_LOCAL_TRACE_BUF) void sctp_log_trace(uint32_t fr, const char *str SCTP_UNUSED, uint32_t a, uint32_t b, uint32_t c, uint32_t d, uint32_t e, uint32_t f); #endif From owner-svn-src-stable-12@freebsd.org Mon Aug 24 07:55:48 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3AE163B3B19; Mon, 24 Aug 2020 07:55: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZkvS0rhjz4HV3; Mon, 24 Aug 2020 07:55: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 DA3E01542A; Mon, 24 Aug 2020 07:55: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 07O7tlO5052044; Mon, 24 Aug 2020 07:55:47 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O7tkcw052038; Mon, 24 Aug 2020 07:55:46 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240755.07O7tkcw052038@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 07:55:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364607 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364607 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 07:55:48 -0000 Author: tuexen Date: Mon Aug 24 07:55:46 2020 New Revision: 364607 URL: https://svnweb.freebsd.org/changeset/base/364607 Log: MFC r362106: More cleanups due to ifdef cleanup done upstream. Modified: stable/12/sys/netinet/sctp_constants.h stable/12/sys/netinet/sctp_input.c stable/12/sys/netinet/sctp_pcb.c stable/12/sys/netinet/sctp_pcb.h stable/12/sys/netinet/sctp_structs.h stable/12/sys/netinet/sctp_uio.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_constants.h ============================================================================== --- stable/12/sys/netinet/sctp_constants.h Mon Aug 24 07:53:14 2020 (r364606) +++ stable/12/sys/netinet/sctp_constants.h Mon Aug 24 07:55:46 2020 (r364607) @@ -1012,7 +1012,7 @@ do { \ do { \ if (inp->sctp_flags & SCTP_PCB_FLAGS_DONT_WAKE) { \ inp->sctp_flags |= SCTP_PCB_FLAGS_WAKEINPUT; \ - SOCKBUF_UNLOCK(&((so)->so_rcv)); \ + SOCKBUF_UNLOCK(&((so)->so_rcv)); \ } else { \ sorwakeup_locked(so); \ } \ Modified: stable/12/sys/netinet/sctp_input.c ============================================================================== --- stable/12/sys/netinet/sctp_input.c Mon Aug 24 07:53:14 2020 (r364606) +++ stable/12/sys/netinet/sctp_input.c Mon Aug 24 07:55:46 2020 (r364607) @@ -5723,7 +5723,7 @@ out: return; } -#if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && defined(SMP) +#if defined(SCTP_MCORE_INPUT) && defined(SMP) extern int *sctp_cpuarry; #endif @@ -5735,7 +5735,7 @@ sctp_input(struct mbuf **mp, int *offp, int proto SCTP m = *mp; off = *offp; -#if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && defined(SMP) +#if defined(SCTP_MCORE_INPUT) && defined(SMP) if (mp_ncpus > 1) { struct ip *ip; struct sctphdr *sh; Modified: stable/12/sys/netinet/sctp_pcb.c ============================================================================== --- stable/12/sys/netinet/sctp_pcb.c Mon Aug 24 07:53:14 2020 (r364606) +++ stable/12/sys/netinet/sctp_pcb.c Mon Aug 24 07:55:46 2020 (r364607) @@ -5548,18 +5548,14 @@ sctp_del_local_addr_restricted(struct sctp_tcb *stcb, return; } -/* - * Temporarily remove for __APPLE__ until we use the Tiger equivalents - */ /* sysctl */ static int sctp_max_number_of_assoc = SCTP_MAX_NUM_OF_ASOC; static int sctp_scale_up_for_address = SCTP_SCALE_FOR_ADDR; - - -#if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && defined(SMP) +#if defined(SCTP_MCORE_INPUT) && defined(SMP) struct sctp_mcore_ctrl *sctp_mcore_workers = NULL; int *sctp_cpuarry = NULL; + void sctp_queue_to_mcore(struct mbuf *m, int off, int cpu_to_use) { @@ -5729,13 +5725,13 @@ sctp_pcb_init(void) #if defined(SCTP_LOCAL_TRACE_BUF) memset(&SCTP_BASE_SYSCTL(sctp_log), 0, sizeof(struct sctp_log)); #endif -#if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT) +#if defined(SMP) && defined(SCTP_USE_PERCPU_STAT) SCTP_MALLOC(SCTP_BASE_STATS, struct sctpstat *, ((mp_maxid + 1) * sizeof(struct sctpstat)), SCTP_M_MCORE); #endif (void)SCTP_GETTIME_TIMEVAL(&tv); -#if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT) +#if defined(SMP) && defined(SCTP_USE_PERCPU_STAT) 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; @@ -5846,7 +5842,7 @@ sctp_pcb_init(void) } sctp_startup_iterator(); -#if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && defined(SMP) +#if defined(SCTP_MCORE_INPUT) && defined(SMP) sctp_startup_mcore_threads(); #endif @@ -6001,7 +5997,7 @@ retry: SCTP_ZONE_DESTROY(SCTP_BASE_INFO(ipi_zone_strmoq)); SCTP_ZONE_DESTROY(SCTP_BASE_INFO(ipi_zone_asconf)); SCTP_ZONE_DESTROY(SCTP_BASE_INFO(ipi_zone_asconf_ack)); -#if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT) +#if defined(SMP) && defined(SCTP_USE_PERCPU_STAT) SCTP_FREE(SCTP_BASE_STATS, SCTP_M_MCORE); #endif } Modified: stable/12/sys/netinet/sctp_pcb.h ============================================================================== --- stable/12/sys/netinet/sctp_pcb.h Mon Aug 24 07:53:14 2020 (r364606) +++ stable/12/sys/netinet/sctp_pcb.h Mon Aug 24 07:55:46 2020 (r364607) @@ -246,7 +246,7 @@ struct sctp_base_info { * All static structures that anchor the system must be here. */ struct sctp_epinfo sctppcbinfo; -#if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT) +#if defined(SMP) && defined(SCTP_USE_PERCPU_STAT) struct sctpstat *sctpstat; #else struct sctpstat sctpstat; @@ -478,7 +478,6 @@ struct sctp_tcb { #include -/* TODO where to put non-_KERNEL things for __Userspace__? */ #if defined(_KERNEL) || defined(__Userspace__) /* Attention Julian, this is the extern that @@ -646,7 +645,7 @@ sctp_initiate_iterator(inp_func inpf, end_func ef, struct sctp_inpcb *, uint8_t co_off); -#if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && defined(SMP) +#if defined(SCTP_MCORE_INPUT) && defined(SMP) void sctp_queue_to_mcore(struct mbuf *m, int off, int cpu_to_use); Modified: stable/12/sys/netinet/sctp_structs.h ============================================================================== --- stable/12/sys/netinet/sctp_structs.h Mon Aug 24 07:53:14 2020 (r364606) +++ stable/12/sys/netinet/sctp_structs.h Mon Aug 24 07:55:46 2020 (r364607) @@ -109,7 +109,7 @@ typedef void (*asoc_func) (struct sctp_inpcb *, struct typedef int (*inp_func) (struct sctp_inpcb *, void *ptr, uint32_t val); typedef void (*end_func) (void *ptr, uint32_t val); -#if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && defined(SMP) +#if defined(SCTP_MCORE_INPUT) && defined(SMP) /* whats on the mcore control struct */ struct sctp_mcore_queue { TAILQ_ENTRY(sctp_mcore_queue) next; @@ -129,10 +129,7 @@ struct sctp_mcore_ctrl { int running; int cpuid; }; - - #endif - struct sctp_iterator { TAILQ_ENTRY(sctp_iterator) sctp_nxt_itr; Modified: stable/12/sys/netinet/sctp_uio.h ============================================================================== --- stable/12/sys/netinet/sctp_uio.h Mon Aug 24 07:53:14 2020 (r364606) +++ stable/12/sys/netinet/sctp_uio.h Mon Aug 24 07:55:46 2020 (r364607) @@ -1128,7 +1128,7 @@ struct sctpstat { #define SCTP_STAT_INCR(_x) SCTP_STAT_INCR_BY(_x,1) #define SCTP_STAT_DECR(_x) SCTP_STAT_DECR_BY(_x,1) -#if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT) +#if defined(SMP) && defined(SCTP_USE_PERCPU_STAT) #define SCTP_STAT_INCR_BY(_x,_d) (SCTP_BASE_STATS[PCPU_GET(cpuid)]._x += _d) #define SCTP_STAT_DECR_BY(_x,_d) (SCTP_BASE_STATS[PCPU_GET(cpuid)]._x -= _d) #else From owner-svn-src-stable-12@freebsd.org Mon Aug 24 07:57:30 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6F5193B3B39; Mon, 24 Aug 2020 07:57: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZkxQ2Njcz4Hpr; Mon, 24 Aug 2020 07:57: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 362B5154BB; Mon, 24 Aug 2020 07:57: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 07O7vT7q052172; Mon, 24 Aug 2020 07:57:29 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O7vTDP052171; Mon, 24 Aug 2020 07:57:29 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240757.07O7vTDP052171@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 07:57:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364608 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364608 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 07:57:30 -0000 Author: tuexen Date: Mon Aug 24 07:57:29 2020 New Revision: 364608 URL: https://svnweb.freebsd.org/changeset/base/364608 Log: MFC r362107: Whitespace change due to upstream cleanup. Modified: stable/12/sys/netinet/sctp_constants.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_constants.h ============================================================================== --- stable/12/sys/netinet/sctp_constants.h Mon Aug 24 07:55:46 2020 (r364607) +++ stable/12/sys/netinet/sctp_constants.h Mon Aug 24 07:57:29 2020 (r364608) @@ -992,7 +992,7 @@ do { \ #define sctp_sowwakeup_locked(inp, so) \ do { \ if (inp->sctp_flags & SCTP_PCB_FLAGS_DONT_WAKE) { \ - SOCKBUF_UNLOCK(&((so)->so_snd)); \ + SOCKBUF_UNLOCK(&((so)->so_snd)); \ inp->sctp_flags |= SCTP_PCB_FLAGS_WAKEOUTPUT; \ } else { \ sowwakeup_locked(so); \ From owner-svn-src-stable-12@freebsd.org Mon Aug 24 07:59:00 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 49D723B3C68; Mon, 24 Aug 2020 07:59:00 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZkz80zX9z4Hrc; Mon, 24 Aug 2020 07:59:00 +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 051BA1542F; Mon, 24 Aug 2020 07:59:00 +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 07O7wxAO052290; Mon, 24 Aug 2020 07:58:59 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O7wxxA052289; Mon, 24 Aug 2020 07:58:59 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240758.07O7wxxA052289@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 07:58:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364609 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364609 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 07:59:00 -0000 Author: tuexen Date: Mon Aug 24 07:58:59 2020 New Revision: 364609 URL: https://svnweb.freebsd.org/changeset/base/364609 Log: MFC r362153: Simpify a condition, no functional change. Modified: stable/12/sys/netinet/sctp_input.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_input.c ============================================================================== --- stable/12/sys/netinet/sctp_input.c Mon Aug 24 07:57:29 2020 (r364608) +++ stable/12/sys/netinet/sctp_input.c Mon Aug 24 07:58:59 2020 (r364609) @@ -5594,9 +5594,8 @@ trigger_send: if (!TAILQ_EMPTY(&stcb->asoc.asconf_send_queue) || cnt_ctrl_ready || stcb->asoc.trigger_reset || - ((un_sent) && - (stcb->asoc.peers_rwnd > 0 || - (stcb->asoc.peers_rwnd <= 0 && stcb->asoc.total_flight == 0)))) { + ((un_sent > 0) && + (stcb->asoc.peers_rwnd > 0 || stcb->asoc.total_flight == 0))) { SCTPDBG(SCTP_DEBUG_INPUT3, "Calling chunk OUTPUT\n"); sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_CONTROL_PROC, SCTP_SO_NOT_LOCKED); SCTPDBG(SCTP_DEBUG_INPUT3, "chunk OUTPUT returns\n"); From owner-svn-src-stable-12@freebsd.org Mon Aug 24 08:01:10 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7B9573B3FDC; Mon, 24 Aug 2020 08:01: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZl1f2kPJz4JJl; Mon, 24 Aug 2020 08:01: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 40EC515443; Mon, 24 Aug 2020 08:01: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 07O81AUB053252; Mon, 24 Aug 2020 08:01:10 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O8196R053250; Mon, 24 Aug 2020 08:01:09 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240801.07O8196R053250@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 08:01:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364610 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364610 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 08:01:10 -0000 Author: tuexen Date: Mon Aug 24 08:01:09 2020 New Revision: 364610 URL: https://svnweb.freebsd.org/changeset/base/364610 Log: MFC r362155: Remove usage of empty macro. Modified: stable/12/sys/netinet/sctp_os_bsd.h stable/12/sys/netinet/sctp_pcb.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_os_bsd.h ============================================================================== --- stable/12/sys/netinet/sctp_os_bsd.h Mon Aug 24 07:58:59 2020 (r364609) +++ stable/12/sys/netinet/sctp_os_bsd.h Mon Aug 24 08:01:09 2020 (r364610) @@ -315,11 +315,6 @@ typedef struct callout sctp_os_timer_t; rt->rt_mtu = mtu; \ } while(0) -/* (de-)register interface event notifications */ -#define SCTP_REGISTER_INTERFACE(ifhandle, af) -#define SCTP_DEREGISTER_INTERFACE(ifhandle, af) - - /*************************/ /* These are for logging */ /*************************/ Modified: stable/12/sys/netinet/sctp_pcb.c ============================================================================== --- stable/12/sys/netinet/sctp_pcb.c Mon Aug 24 07:58:59 2020 (r364609) +++ stable/12/sys/netinet/sctp_pcb.c Mon Aug 24 08:01:09 2020 (r364610) @@ -299,8 +299,6 @@ sctp_delete_ifn(struct sctp_ifn *sctp_ifnp, int hold_a SCTP_IPI_ADDR_WLOCK(); LIST_REMOVE(sctp_ifnp, next_bucket); LIST_REMOVE(sctp_ifnp, next_ifn); - SCTP_DEREGISTER_INTERFACE(sctp_ifnp->ifn_index, - sctp_ifnp->registered_af); if (hold_addr_lock == 0) SCTP_IPI_ADDR_WUNLOCK(); /* Take away the reference, and possibly free it */ @@ -428,7 +426,6 @@ sctp_add_ifa_to_ifn(struct sctp_ifn *sctp_ifnp, struct } if (sctp_ifnp->ifa_count == 1) { /* register the new interface */ - SCTP_REGISTER_INTERFACE(sctp_ifnp->ifn_index, ifa_af); sctp_ifnp->registered_af = ifa_af; } } @@ -469,13 +466,9 @@ sctp_remove_ifa_from_ifn(struct sctp_ifa *sctp_ifap) /* re-register address family type, if needed */ if ((sctp_ifap->ifn_p->num_v6 == 0) && (sctp_ifap->ifn_p->registered_af == AF_INET6)) { - SCTP_DEREGISTER_INTERFACE(sctp_ifap->ifn_p->ifn_index, AF_INET6); - SCTP_REGISTER_INTERFACE(sctp_ifap->ifn_p->ifn_index, AF_INET); sctp_ifap->ifn_p->registered_af = AF_INET; } else if ((sctp_ifap->ifn_p->num_v4 == 0) && (sctp_ifap->ifn_p->registered_af == AF_INET)) { - SCTP_DEREGISTER_INTERFACE(sctp_ifap->ifn_p->ifn_index, AF_INET); - SCTP_REGISTER_INTERFACE(sctp_ifap->ifn_p->ifn_index, AF_INET6); sctp_ifap->ifn_p->registered_af = AF_INET6; } /* free the ifn refcount */ @@ -676,7 +669,6 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint3 vrf->total_ifa_count++; atomic_add_int(&SCTP_BASE_INFO(ipi_count_ifas), 1); if (new_ifn_af) { - SCTP_REGISTER_INTERFACE(ifn_index, new_ifn_af); sctp_ifnp->registered_af = new_ifn_af; } SCTP_IPI_ADDR_WUNLOCK(); From owner-svn-src-stable-12@freebsd.org Mon Aug 24 08:08:14 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0948E3B45E4; Mon, 24 Aug 2020 08:08:14 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZl9n6Z9Rz4Jm9; Mon, 24 Aug 2020 08:08: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 C5936153F3; Mon, 24 Aug 2020 08:08: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 07O88Dri058502; Mon, 24 Aug 2020 08:08:13 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O88CdV058498; Mon, 24 Aug 2020 08:08:12 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240808.07O88CdV058498@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 08:08:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364611 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364611 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 08:08:14 -0000 Author: tuexen Date: Mon Aug 24 08:08:12 2020 New Revision: 364611 URL: https://svnweb.freebsd.org/changeset/base/364611 Log: MFC r362173: Cleanups, no functional change. Modified: stable/12/sys/netinet/sctp_indata.c stable/12/sys/netinet/sctp_output.c stable/12/sys/netinet/sctp_ss_functions.c stable/12/sys/netinet/sctputil.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_indata.c ============================================================================== --- stable/12/sys/netinet/sctp_indata.c Mon Aug 24 08:01:09 2020 (r364610) +++ stable/12/sys/netinet/sctp_indata.c Mon Aug 24 08:08:12 2020 (r364611) @@ -66,7 +66,7 @@ sctp_add_chk_to_control(struct sctp_queued_to_read *co struct sctp_stream_in *strm, struct sctp_tcb *stcb, struct sctp_association *asoc, - struct sctp_tmit_chunk *chk, int lock_held); + struct sctp_tmit_chunk *chk, int hold_rlock); void Modified: stable/12/sys/netinet/sctp_output.c ============================================================================== --- stable/12/sys/netinet/sctp_output.c Mon Aug 24 08:01:09 2020 (r364610) +++ stable/12/sys/netinet/sctp_output.c Mon Aug 24 08:08:12 2020 (r364611) @@ -5124,7 +5124,6 @@ sctp_arethere_unrecognized_parameters(struct mbuf *in_ } } return (op_err); - break; } default: /* Modified: stable/12/sys/netinet/sctp_ss_functions.c ============================================================================== --- stable/12/sys/netinet/sctp_ss_functions.c Mon Aug 24 08:01:09 2020 (r364610) +++ stable/12/sys/netinet/sctp_ss_functions.c Mon Aug 24 08:08:12 2020 (r364611) @@ -767,8 +767,8 @@ sctp_ss_fb_scheduled(struct sctp_tcb *stcb, struct sct */ static void sctp_ss_fcfs_add(struct sctp_tcb *stcb, struct sctp_association *asoc, - struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp, - int holds_lock); + struct sctp_stream_out *strq SCTP_UNUSED, + struct sctp_stream_queue_pending *sp, int holds_lock); static void sctp_ss_fcfs_init(struct sctp_tcb *stcb, struct sctp_association *asoc, Modified: stable/12/sys/netinet/sctputil.c ============================================================================== --- stable/12/sys/netinet/sctputil.c Mon Aug 24 08:01:09 2020 (r364610) +++ stable/12/sys/netinet/sctputil.c Mon Aug 24 08:08:12 2020 (r364611) @@ -5221,10 +5221,6 @@ sctp_find_ifa_in_ep(struct sctp_inpcb *inp, struct soc if (((struct sockaddr_in *)addr)->sin_addr.s_addr == laddr->ifa->address.sin.sin_addr.s_addr) { /* found him. */ - if (holds_lock == 0) { - SCTP_INP_RUNLOCK(inp); - } - return (laddr->ifa); break; } } @@ -5234,10 +5230,6 @@ sctp_find_ifa_in_ep(struct sctp_inpcb *inp, struct soc if (SCTP6_ARE_ADDR_EQUAL((struct sockaddr_in6 *)addr, &laddr->ifa->address.sin6)) { /* found him. */ - if (holds_lock == 0) { - SCTP_INP_RUNLOCK(inp); - } - return (laddr->ifa); break; } } @@ -5246,7 +5238,7 @@ sctp_find_ifa_in_ep(struct sctp_inpcb *inp, struct soc if (holds_lock == 0) { SCTP_INP_RUNLOCK(inp); } - return (NULL); + return (laddr->ifa); } uint32_t @@ -5323,9 +5315,6 @@ sctp_find_ifa_by_addr(struct sockaddr *addr, uint32_t if (((struct sockaddr_in *)addr)->sin_addr.s_addr == sctp_ifap->address.sin.sin_addr.s_addr) { /* found him. */ - if (holds_lock == 0) - SCTP_IPI_ADDR_RUNLOCK(); - return (sctp_ifap); break; } } @@ -5335,9 +5324,6 @@ sctp_find_ifa_by_addr(struct sockaddr *addr, uint32_t if (SCTP6_ARE_ADDR_EQUAL((struct sockaddr_in6 *)addr, &sctp_ifap->address.sin6)) { /* found him. */ - if (holds_lock == 0) - SCTP_IPI_ADDR_RUNLOCK(); - return (sctp_ifap); break; } } @@ -5345,7 +5331,7 @@ sctp_find_ifa_by_addr(struct sockaddr *addr, uint32_t } if (holds_lock == 0) SCTP_IPI_ADDR_RUNLOCK(); - return (NULL); + return (sctp_ifap); } static void @@ -6918,7 +6904,7 @@ sctp_local_addr_count(struct sctp_tcb *stcb) #if defined(INET) int ipv4_local_scope, ipv4_addr_legal; #endif -#if defined (INET6) +#if defined(INET6) int local_scope, site_scope, ipv6_addr_legal; #endif struct sctp_vrf *vrf; From owner-svn-src-stable-12@freebsd.org Mon Aug 24 08:10:28 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F59F3B4630; Mon, 24 Aug 2020 08:10: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZlDN1NVxz4JxS; Mon, 24 Aug 2020 08:10: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 12D4A15544; Mon, 24 Aug 2020 08:10: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 07O8AR1x058688; Mon, 24 Aug 2020 08:10:27 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O8ARR2058687; Mon, 24 Aug 2020 08:10:27 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240810.07O8ARR2058687@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 08:10:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364612 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364612 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 08:10:28 -0000 Author: tuexen Date: Mon Aug 24 08:10:27 2020 New Revision: 364612 URL: https://svnweb.freebsd.org/changeset/base/364612 Log: MFC r362178: Allocate the mbuf for the signature in the COOKIE or the correct size. While there, do also do some cleanups. Modified: stable/12/sys/netinet/sctp_output.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_output.c ============================================================================== --- stable/12/sys/netinet/sctp_output.c Mon Aug 24 08:08:12 2020 (r364611) +++ stable/12/sys/netinet/sctp_output.c Mon Aug 24 08:10:27 2020 (r364612) @@ -3831,8 +3831,6 @@ sctp_add_cookie(struct mbuf *init, int init_offset, struct mbuf *copy_init, *copy_initack, *m_at, *sig, *mret; struct sctp_state_cookie *stc; struct sctp_paramhdr *ph; - uint8_t *foo; - int sig_offset; uint16_t cookie_sz; mret = sctp_get_mbuf_for_msg((sizeof(struct sctp_state_cookie) + @@ -3896,24 +3894,20 @@ sctp_add_cookie(struct mbuf *init, int init_offset, break; } } - sig = sctp_get_mbuf_for_msg(SCTP_SECRET_SIZE, 0, M_NOWAIT, 1, MT_DATA); + sig = sctp_get_mbuf_for_msg(SCTP_SIGNATURE_SIZE, 0, M_NOWAIT, 1, MT_DATA); if (sig == NULL) { /* no space, so free the entire chain */ sctp_m_freem(mret); return (NULL); } - SCTP_BUF_LEN(sig) = 0; SCTP_BUF_NEXT(m_at) = sig; - sig_offset = 0; - foo = (uint8_t *)(mtod(sig, caddr_t)+sig_offset); - memset(foo, 0, SCTP_SIGNATURE_SIZE); - *signature = foo; - SCTP_BUF_LEN(sig) += SCTP_SIGNATURE_SIZE; + SCTP_BUF_LEN(sig) = SCTP_SIGNATURE_SIZE; cookie_sz += SCTP_SIGNATURE_SIZE; ph->param_length = htons(cookie_sz); + *signature = (uint8_t *)mtod(sig, caddr_t); + memset(*signature, 0, SCTP_SIGNATURE_SIZE); return (mret); } - static uint8_t sctp_get_ect(struct sctp_tcb *stcb) From owner-svn-src-stable-12@freebsd.org Mon Aug 24 08:11:47 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EB7B83B4797; Mon, 24 Aug 2020 08:11: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZlFv62MKz4Jqs; Mon, 24 Aug 2020 08:11: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 B309F1582A; Mon, 24 Aug 2020 08:11: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 07O8Bloh060656; Mon, 24 Aug 2020 08:11:47 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O8Bl8P060655; Mon, 24 Aug 2020 08:11:47 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240811.07O8Bl8P060655@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 08:11:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364613 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364613 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 08:11:48 -0000 Author: tuexen Date: Mon Aug 24 08:11:47 2020 New Revision: 364613 URL: https://svnweb.freebsd.org/changeset/base/364613 Log: MFC r362277: Allow the self reference to be NULL in case the timer was stopped. Modified: stable/12/sys/netinet/sctputil.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctputil.c ============================================================================== --- stable/12/sys/netinet/sctputil.c Mon Aug 24 08:10:27 2020 (r364612) +++ stable/12/sys/netinet/sctputil.c Mon Aug 24 08:11:47 2020 (r364613) @@ -1726,7 +1726,7 @@ sctp_timeout_handler(void *t) #endif /* sanity checks... */ - KASSERT(tmr->self == tmr, + KASSERT(tmr->self == NULL || tmr->self == tmr, ("sctp_timeout_handler: tmr->self corrupted")); KASSERT(SCTP_IS_TIMER_TYPE_VALID(tmr->type), ("sctp_timeout_handler: invalid timer type %d", tmr->type)); From owner-svn-src-stable-12@freebsd.org Mon Aug 24 08:13:06 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B1CAB3B4671; Mon, 24 Aug 2020 08: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZlHQ4DQQz4KJq; Mon, 24 Aug 2020 08: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 74491157D0; Mon, 24 Aug 2020 08: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 07O8D6aP064489; Mon, 24 Aug 2020 08:13:06 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O8D6Fh064488; Mon, 24 Aug 2020 08:13:06 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240813.07O8D6Fh064488@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 08:13:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364614 - stable/12/lib/libc/net X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/lib/libc/net X-SVN-Commit-Revision: 364614 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 08:13:06 -0000 Author: tuexen Date: Mon Aug 24 08:13:06 2020 New Revision: 364614 URL: https://svnweb.freebsd.org/changeset/base/364614 Log: MFC r362332: Whitespace changes, not functional change intended. Modified: stable/12/lib/libc/net/sctp_sys_calls.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/net/sctp_sys_calls.c ============================================================================== --- stable/12/lib/libc/net/sctp_sys_calls.c Mon Aug 24 08:11:47 2020 (r364613) +++ stable/12/lib/libc/net/sctp_sys_calls.c Mon Aug 24 08:13:06 2020 (r364614) @@ -100,7 +100,7 @@ sctp_getaddrlen(sa_family_t family) int sctp_connectx(int sd, const struct sockaddr *addrs, int addrcnt, - sctp_assoc_t * id) + sctp_assoc_t *id) { char *buf; int i, ret, *aa; @@ -159,9 +159,9 @@ sctp_connectx(int sd, const struct sockaddr *addrs, in aa = (int *)buf; *aa = addrcnt; ret = setsockopt(sd, IPPROTO_SCTP, SCTP_CONNECT_X, (void *)buf, - (socklen_t) len); + (socklen_t)len); if ((ret == 0) && (id != NULL)) { - *id = *(sctp_assoc_t *) buf; + *id = *(sctp_assoc_t *)buf; } free(buf); return (ret); @@ -269,7 +269,7 @@ sctp_bindx(int sd, struct sockaddr *addrs, int addrcnt } } if (setsockopt(sd, IPPROTO_SCTP, flags, gaddrs, - (socklen_t) argsz) != 0) { + (socklen_t)argsz) != 0) { free(gaddrs); return (-1); } @@ -280,7 +280,7 @@ sctp_bindx(int sd, struct sockaddr *addrs, int addrcnt } int -sctp_opt_info(int sd, sctp_assoc_t id, int opt, void *arg, socklen_t * size) +sctp_opt_info(int sd, sctp_assoc_t id, int opt, void *arg, socklen_t *size) { if (arg == NULL) { errno = EINVAL; @@ -409,13 +409,13 @@ sctp_getpaddrs(int sd, sctp_assoc_t id, struct sockadd return (-1); } asoc = id; - opt_len = (socklen_t) sizeof(sctp_assoc_t); + opt_len = (socklen_t)sizeof(sctp_assoc_t); if (getsockopt(sd, IPPROTO_SCTP, SCTP_GET_REMOTE_ADDR_SIZE, &asoc, &opt_len) != 0) { return (-1); } /* size required is returned in 'asoc' */ - opt_len = (socklen_t) ((size_t)asoc + sizeof(sctp_assoc_t)); + opt_len = (socklen_t)((size_t)asoc + sizeof(sctp_assoc_t)); addrs = calloc(1, (size_t)opt_len); if (addrs == NULL) { errno = ENOMEM; @@ -465,7 +465,7 @@ sctp_getladdrs(int sd, sctp_assoc_t id, struct sockadd return (-1); } size_of_addresses = 0; - opt_len = (socklen_t) sizeof(int); + opt_len = (socklen_t)sizeof(int); if (getsockopt(sd, IPPROTO_SCTP, SCTP_GET_LOCAL_ADDR_SIZE, &size_of_addresses, &opt_len) != 0) { errno = ENOMEM; @@ -475,7 +475,7 @@ sctp_getladdrs(int sd, sctp_assoc_t id, struct sockadd errno = ENOTCONN; return (-1); } - opt_len = (socklen_t) (size_of_addresses + sizeof(sctp_assoc_t)); + opt_len = (socklen_t)(size_of_addresses + sizeof(sctp_assoc_t)); addrs = calloc(1, (size_t)opt_len); if (addrs == NULL) { errno = ENOMEM; @@ -586,6 +586,7 @@ sctp_sendmsg(int s, } who = (struct sockaddr *)&addr; } + iov.iov_base = (char *)data; iov.iov_len = len; @@ -632,7 +633,7 @@ sctp_getassocid(int sd, struct sockaddr *sa) if (getsockopt(sd, IPPROTO_SCTP, SCTP_GET_PEER_ADDR_INFO, &sp, &siz) != 0) { /* We depend on the fact that 0 can never be returned */ - return ((sctp_assoc_t) 0); + return ((sctp_assoc_t)0); } return (sp.spinfo_assoc_id); } @@ -748,7 +749,7 @@ sctp_sendx(int sd, const void *msg, size_t msg_len, aa++; memcpy((caddr_t)aa, addrs, (size_t)(len - sizeof(int))); ret = setsockopt(sd, IPPROTO_SCTP, SCTP_CONNECT_X_DELAYED, (void *)buf, - (socklen_t) len); + (socklen_t)len); free(buf); if (ret != 0) { @@ -766,7 +767,7 @@ continue_send: sinfo->sinfo_assoc_id = sctp_getassocid(sd, addrs); if (sinfo->sinfo_assoc_id == 0) { (void)setsockopt(sd, IPPROTO_SCTP, SCTP_CONNECT_X_COMPLETE, (void *)addrs, - (socklen_t) addrs->sa_len); + (socklen_t)addrs->sa_len); errno = ENOENT; return (-1); } @@ -774,7 +775,7 @@ continue_send: saved_errno = errno; if (no_end_cx == 0) (void)setsockopt(sd, IPPROTO_SCTP, SCTP_CONNECT_X_COMPLETE, (void *)addrs, - (socklen_t) addrs->sa_len); + (socklen_t)addrs->sa_len); errno = saved_errno; return (ret); @@ -808,7 +809,7 @@ sctp_recvmsg(int s, void *dbuf, size_t len, struct sockaddr *from, - socklen_t * fromlen, + socklen_t *fromlen, struct sctp_sndrcvinfo *sinfo, int *msg_flags) { @@ -878,14 +879,14 @@ sctp_recvmsg(int s, #endif } -ssize_t +ssize_t sctp_recvv(int sd, const struct iovec *iov, int iovlen, struct sockaddr *from, - socklen_t * fromlen, + socklen_t *fromlen, void *info, - socklen_t * infolen, + socklen_t *infolen, unsigned int *infotype, int *flags) { @@ -953,17 +954,17 @@ sctp_recvv(int sd, rn_info = (struct sctp_recvv_rn *)info; rn_info->recvv_rcvinfo = *rcvinfo; rn_info->recvv_nxtinfo = *nxtinfo; - *infolen = (socklen_t) sizeof(struct sctp_recvv_rn); + *infolen = (socklen_t)sizeof(struct sctp_recvv_rn); *infotype = SCTP_RECVV_RN; } else if (*infolen >= sizeof(struct sctp_rcvinfo)) { memcpy(info, rcvinfo, sizeof(struct sctp_rcvinfo)); - *infolen = (socklen_t) sizeof(struct sctp_rcvinfo); + *infolen = (socklen_t)sizeof(struct sctp_rcvinfo); *infotype = SCTP_RECVV_RCVINFO; } } else if (nxtinfo != NULL) { if (*infolen >= sizeof(struct sctp_nxtinfo)) { memcpy(info, nxtinfo, sizeof(struct sctp_nxtinfo)); - *infolen = (socklen_t) sizeof(struct sctp_nxtinfo); + *infolen = (socklen_t)sizeof(struct sctp_nxtinfo); *infotype = SCTP_RECVV_NXTINFO; } } @@ -1105,7 +1106,7 @@ sctp_sendv(int sd, for (i = 0; i < addrcnt; i++) { switch (addr->sa_family) { case AF_INET: - addr_len = (socklen_t) sizeof(struct sockaddr_in); + addr_len = (socklen_t)sizeof(struct sockaddr_in); addr_in = (struct sockaddr_in *)addr; if (addr_in->sin_len != addr_len) { free(cmsgbuf); @@ -1130,7 +1131,7 @@ sctp_sendv(int sd, } break; case AF_INET6: - addr_len = (socklen_t) sizeof(struct sockaddr_in6); + addr_len = (socklen_t)sizeof(struct sockaddr_in6); addr_in6 = (struct sockaddr_in6 *)addr; if (addr_in6->sin6_len != addr_len) { free(cmsgbuf); From owner-svn-src-stable-12@freebsd.org Mon Aug 24 08:14:42 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7AE563B4B81; Mon, 24 Aug 2020 08:14: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZlKG2FyJz4Kbj; Mon, 24 Aug 2020 08:14: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 17B3715834; Mon, 24 Aug 2020 08:14: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 07O8Ef1g064616; Mon, 24 Aug 2020 08:14:41 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O8EfT7064614; Mon, 24 Aug 2020 08:14:41 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240814.07O8EfT7064614@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 08:14:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364615 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364615 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 08:14:42 -0000 Author: tuexen Date: Mon Aug 24 08:14:41 2020 New Revision: 364615 URL: https://svnweb.freebsd.org/changeset/base/364615 Log: MFC r362377: Remove last argument of sctp_addr_mgmt_ep_sa(), since it is not used. Modified: stable/12/sys/netinet/sctp_asconf.c stable/12/sys/netinet/sctp_asconf.h stable/12/sys/netinet/sctputil.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_asconf.c ============================================================================== --- stable/12/sys/netinet/sctp_asconf.c Mon Aug 24 08:13:06 2020 (r364614) +++ stable/12/sys/netinet/sctp_asconf.c Mon Aug 24 08:14:41 2020 (r364615) @@ -3178,7 +3178,7 @@ sctp_check_address_list(struct sctp_tcb *stcb, struct */ uint32_t sctp_addr_mgmt_ep_sa(struct sctp_inpcb *inp, struct sockaddr *sa, - uint32_t type, uint32_t vrf_id, struct sctp_ifa *sctp_ifap) + uint32_t type, uint32_t vrf_id) { struct sctp_ifa *ifa; struct sctp_laddr *laddr, *nladdr; @@ -3187,9 +3187,7 @@ sctp_addr_mgmt_ep_sa(struct sctp_inpcb *inp, struct so SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_ASCONF, EINVAL); return (EINVAL); } - if (sctp_ifap) { - ifa = sctp_ifap; - } else if (type == SCTP_ADD_IP_ADDRESS) { + if (type == SCTP_ADD_IP_ADDRESS) { /* For an add the address MUST be on the system */ ifa = sctp_find_ifa_by_addr(sa, vrf_id, SCTP_ADDR_NOT_LOCKED); } else if (type == SCTP_DEL_IP_ADDRESS) { Modified: stable/12/sys/netinet/sctp_asconf.h ============================================================================== --- stable/12/sys/netinet/sctp_asconf.h Mon Aug 24 08:13:06 2020 (r364614) +++ stable/12/sys/netinet/sctp_asconf.h Mon Aug 24 08:14:41 2020 (r364615) @@ -56,8 +56,8 @@ sctp_handle_asconf_ack(struct mbuf *, int, struct sctp struct sctp_tcb *, struct sctp_nets *, int *); extern uint32_t -sctp_addr_mgmt_ep_sa(struct sctp_inpcb *, struct sockaddr *, - uint32_t, uint32_t, struct sctp_ifa *); +sctp_addr_mgmt_ep_sa(struct sctp_inpcb *, struct sockaddr *, uint32_t, + uint32_t); extern int Modified: stable/12/sys/netinet/sctputil.c ============================================================================== --- stable/12/sys/netinet/sctputil.c Mon Aug 24 08:13:06 2020 (r364614) +++ stable/12/sys/netinet/sctputil.c Mon Aug 24 08:14:41 2020 (r364615) @@ -6792,8 +6792,7 @@ sctp_bindx_add_address(struct socket *so, struct sctp_ } else if (lep == NULL) { ((struct sockaddr_in *)addr_touse)->sin_port = 0; *error = sctp_addr_mgmt_ep_sa(inp, addr_touse, - SCTP_ADD_IP_ADDRESS, - vrf_id, NULL); + SCTP_ADD_IP_ADDRESS, vrf_id); } else { *error = EADDRINUSE; } @@ -6884,8 +6883,7 @@ sctp_bindx_delete_address(struct sctp_inpcb *inp, if (assoc_id == 0) { /* delete the address */ *error = sctp_addr_mgmt_ep_sa(inp, addr_touse, - SCTP_DEL_IP_ADDRESS, - vrf_id, NULL); + SCTP_DEL_IP_ADDRESS, vrf_id); } else { /* * FIX: decide whether we allow assoc based bindx From owner-svn-src-stable-12@freebsd.org Mon Aug 24 08:16:08 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 61F143B4BAD; Mon, 24 Aug 2020 08:16: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZlLw1wL6z4Kn6; Mon, 24 Aug 2020 08:16: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 2522115952; Mon, 24 Aug 2020 08:16: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 07O8G8VS064749; Mon, 24 Aug 2020 08:16:08 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O8G7Zu064747; Mon, 24 Aug 2020 08:16:07 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240816.07O8G7Zu064747@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 08:16:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364616 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364616 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 08:16:08 -0000 Author: tuexen Date: Mon Aug 24 08:16:07 2020 New Revision: 364616 URL: https://svnweb.freebsd.org/changeset/base/364616 Log: MFC r362448: Cleanup the adding and deleting of addresses via sctp_bindx(). There is no need to use the association identifier, so remove it. While there, cleanup the code a bit. Modified: stable/12/sys/netinet/sctp_usrreq.c stable/12/sys/netinet/sctputil.c stable/12/sys/netinet/sctputil.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/12/sys/netinet/sctp_usrreq.c Mon Aug 24 08:14:41 2020 (r364615) +++ stable/12/sys/netinet/sctp_usrreq.c Mon Aug 24 08:16:07 2020 (r364616) @@ -6013,9 +6013,7 @@ sctp_setopt(struct socket *so, int optname, void *optv error = EAFNOSUPPORT; break; } - sctp_bindx_add_address(so, inp, addrs->addr, - addrs->sget_assoc_id, vrf_id, - &error, p); + sctp_bindx_add_address(so, inp, addrs->addr, vrf_id, &error, p); break; } case SCTP_BINDX_REM_ADDR: @@ -6059,9 +6057,7 @@ sctp_setopt(struct socket *so, int optname, void *optv error = EAFNOSUPPORT; break; } - sctp_bindx_delete_address(inp, addrs->addr, - addrs->sget_assoc_id, vrf_id, - &error); + sctp_bindx_delete_address(inp, addrs->addr, vrf_id, &error); break; } case SCTP_EVENT: Modified: stable/12/sys/netinet/sctputil.c ============================================================================== --- stable/12/sys/netinet/sctputil.c Mon Aug 24 08:14:41 2020 (r364615) +++ stable/12/sys/netinet/sctputil.c Mon Aug 24 08:16:07 2020 (r364616) @@ -6682,13 +6682,21 @@ sctp_connectx_helper_find(struct sctp_inpcb *inp, stru */ void sctp_bindx_add_address(struct socket *so, struct sctp_inpcb *inp, - struct sockaddr *sa, sctp_assoc_t assoc_id, - uint32_t vrf_id, int *error, void *p) + struct sockaddr *sa, uint32_t vrf_id, int *error, + void *p) { - struct sockaddr *addr_touse; #if defined(INET) && defined(INET6) struct sockaddr_in sin; #endif +#ifdef INET6 + struct sockaddr_in6 *sin6; +#endif +#ifdef INET + struct sockaddr_in *sinp; +#endif + struct sockaddr *addr_to_use; + struct sctp_inpcb *lep; + uint16_t port; /* see if we're bound all already! */ if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) { @@ -6696,13 +6704,9 @@ sctp_bindx_add_address(struct socket *so, struct sctp_ *error = EINVAL; return; } - addr_touse = sa; + switch (sa->sa_family) { #ifdef INET6 - if (sa->sa_family == AF_INET6) { -#ifdef INET - struct sockaddr_in6 *sin6; - -#endif + case AF_INET6: if (sa->sa_len != sizeof(struct sockaddr_in6)) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTPUTIL, EINVAL); *error = EINVAL; @@ -6714,8 +6718,9 @@ sctp_bindx_add_address(struct socket *so, struct sctp_ *error = EINVAL; return; } + sin6 = (struct sockaddr_in6 *)sa; + port = sin6->sin6_port; #ifdef INET - sin6 = (struct sockaddr_in6 *)addr_touse; if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) { if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) && SCTP_IPV6_V6ONLY(inp)) { @@ -6725,13 +6730,15 @@ sctp_bindx_add_address(struct socket *so, struct sctp_ return; } in6_sin6_2_sin(&sin, sin6); - addr_touse = (struct sockaddr *)&sin; + addr_to_use = (struct sockaddr *)&sin; + } else { + addr_to_use = sa; } #endif - } + break; #endif #ifdef INET - if (sa->sa_family == AF_INET) { + case AF_INET: if (sa->sa_len != sizeof(struct sockaddr_in)) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTPUTIL, EINVAL); *error = EINVAL; @@ -6744,8 +6751,16 @@ sctp_bindx_add_address(struct socket *so, struct sctp_ *error = EINVAL; return; } - } + sinp = (struct sockaddr_in *)sa; + port = sinp->sin_port; + addr_to_use = sa; + break; #endif + default: + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTPUTIL, EINVAL); + *error = EINVAL; + return; + } if (inp->sctp_flags & SCTP_PCB_FLAGS_UNBOUND) { if (p == NULL) { /* Can't get proc for Net/Open BSD */ @@ -6753,55 +6768,25 @@ sctp_bindx_add_address(struct socket *so, struct sctp_ *error = EINVAL; return; } - *error = sctp_inpcb_bind(so, addr_touse, NULL, p); + *error = sctp_inpcb_bind(so, addr_to_use, NULL, p); return; } - /* - * No locks required here since bind and mgmt_ep_sa all do their own - * locking. If we do something for the FIX: below we may need to - * lock in that case. - */ - if (assoc_id == 0) { + /* Validate the incoming port. */ + if ((port != 0) && (port != inp->sctp_lport)) { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTPUTIL, EINVAL); + *error = EINVAL; + return; + } + lep = sctp_pcb_findep(addr_to_use, 1, 0, vrf_id); + if (lep == NULL) { /* add the address */ - struct sctp_inpcb *lep; - struct sockaddr_in *lsin = (struct sockaddr_in *)addr_touse; - - /* validate the incoming port */ - if ((lsin->sin_port != 0) && - (lsin->sin_port != inp->sctp_lport)) { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTPUTIL, EINVAL); - *error = EINVAL; - return; - } else { - /* user specified 0 port, set it to existing port */ - lsin->sin_port = inp->sctp_lport; - } - - lep = sctp_pcb_findep(addr_touse, 1, 0, vrf_id); - if (lep != NULL) { - /* - * We must decrement the refcount since we have the - * ep already and are binding. No remove going on - * here. - */ - SCTP_INP_DECR_REF(lep); - } - if (lep == inp) { - /* already bound to it.. ok */ - return; - } else if (lep == NULL) { - ((struct sockaddr_in *)addr_touse)->sin_port = 0; - *error = sctp_addr_mgmt_ep_sa(inp, addr_touse, - SCTP_ADD_IP_ADDRESS, vrf_id); - } else { + *error = sctp_addr_mgmt_ep_sa(inp, addr_to_use, + SCTP_ADD_IP_ADDRESS, vrf_id); + } else { + if (lep != inp) { *error = EADDRINUSE; } - if (*error) - return; - } else { - /* - * FIX: decide whether we allow assoc based bindx - */ + SCTP_INP_DECR_REF(lep); } } @@ -6811,11 +6796,11 @@ sctp_bindx_add_address(struct socket *so, struct sctp_ */ void sctp_bindx_delete_address(struct sctp_inpcb *inp, - struct sockaddr *sa, sctp_assoc_t assoc_id, - uint32_t vrf_id, int *error) + struct sockaddr *sa, uint32_t vrf_id, int *error) { - struct sockaddr *addr_touse; + struct sockaddr *addr_to_use; #if defined(INET) && defined(INET6) + struct sockaddr_in6 *sin6; struct sockaddr_in sin; #endif @@ -6825,13 +6810,9 @@ sctp_bindx_delete_address(struct sctp_inpcb *inp, *error = EINVAL; return; } - addr_touse = sa; + switch (sa->sa_family) { #ifdef INET6 - if (sa->sa_family == AF_INET6) { -#ifdef INET - struct sockaddr_in6 *sin6; -#endif - + case AF_INET6: if (sa->sa_len != sizeof(struct sockaddr_in6)) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTPUTIL, EINVAL); *error = EINVAL; @@ -6844,7 +6825,7 @@ sctp_bindx_delete_address(struct sctp_inpcb *inp, return; } #ifdef INET - sin6 = (struct sockaddr_in6 *)addr_touse; + sin6 = (struct sockaddr_in6 *)sa; if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) { if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) && SCTP_IPV6_V6ONLY(inp)) { @@ -6854,13 +6835,15 @@ sctp_bindx_delete_address(struct sctp_inpcb *inp, return; } in6_sin6_2_sin(&sin, sin6); - addr_touse = (struct sockaddr *)&sin; + addr_to_use = (struct sockaddr *)&sin; + } else { + addr_to_use = sa; } #endif - } + break; #endif #ifdef INET - if (sa->sa_family == AF_INET) { + case AF_INET: if (sa->sa_len != sizeof(struct sockaddr_in)) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTPUTIL, EINVAL); *error = EINVAL; @@ -6873,22 +6856,17 @@ sctp_bindx_delete_address(struct sctp_inpcb *inp, *error = EINVAL; return; } - } + addr_to_use = sa; + break; #endif - /* - * No lock required mgmt_ep_sa does its own locking. If the FIX: - * below is ever changed we may need to lock before calling - * association level binding. - */ - if (assoc_id == 0) { - /* delete the address */ - *error = sctp_addr_mgmt_ep_sa(inp, addr_touse, - SCTP_DEL_IP_ADDRESS, vrf_id); - } else { - /* - * FIX: decide whether we allow assoc based bindx - */ + default: + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTPUTIL, EINVAL); + *error = EINVAL; + return; } + /* No lock required mgmt_ep_sa does its own locking. */ + *error = sctp_addr_mgmt_ep_sa(inp, addr_to_use, SCTP_DEL_IP_ADDRESS, + vrf_id); } /* Modified: stable/12/sys/netinet/sctputil.h ============================================================================== --- stable/12/sys/netinet/sctputil.h Mon Aug 24 08:14:41 2020 (r364615) +++ stable/12/sys/netinet/sctputil.h Mon Aug 24 08:16:07 2020 (r364616) @@ -229,11 +229,10 @@ struct mbuf *sctp_generate_no_user_data_cause(uint32_t void sctp_bindx_add_address(struct socket *so, struct sctp_inpcb *inp, - struct sockaddr *sa, sctp_assoc_t assoc_id, - uint32_t vrf_id, int *error, void *p); + struct sockaddr *sa, uint32_t vrf_id, int *error, + void *p); void -sctp_bindx_delete_address(struct sctp_inpcb *inp, - struct sockaddr *sa, sctp_assoc_t assoc_id, +sctp_bindx_delete_address(struct sctp_inpcb *inp, struct sockaddr *sa, uint32_t vrf_id, int *error); int sctp_local_addr_count(struct sctp_tcb *stcb); From owner-svn-src-stable-12@freebsd.org Mon Aug 24 08:19:26 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 95F243B4BCA; Mon, 24 Aug 2020 08: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZlQk39xTz4KtP; Mon, 24 Aug 2020 08: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 5136015836; Mon, 24 Aug 2020 08: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 07O8JQoI064942; Mon, 24 Aug 2020 08:19:26 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O8JP07064940; Mon, 24 Aug 2020 08:19:25 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240819.07O8JP07064940@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 08:19:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364617 - in stable/12: lib/libc/net sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in stable/12: lib/libc/net sys/netinet X-SVN-Commit-Revision: 364617 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 08:19:26 -0000 Author: tuexen Date: Mon Aug 24 08:19:25 2020 New Revision: 364617 URL: https://svnweb.freebsd.org/changeset/base/364617 Log: MFC r362451: Use a struct sockaddr_in or struct sockaddr_in6 as the option value for the IPPROTO_SCTP level socket options SCTP_BINDX_ADD_ADDR and SCTP_BINDX_REM_ADDR. These socket option are intended for internal use only to implement sctp_bindx(). This is one user of struct sctp_getaddresses less. struct sctp_getaddresses is strange and will be changed shortly. Modified: stable/12/lib/libc/net/sctp_sys_calls.c stable/12/sys/netinet/sctp_usrreq.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/net/sctp_sys_calls.c ============================================================================== --- stable/12/lib/libc/net/sctp_sys_calls.c Mon Aug 24 08:16:07 2020 (r364616) +++ stable/12/lib/libc/net/sctp_sys_calls.c Mon Aug 24 08:19:25 2020 (r364617) @@ -35,6 +35,7 @@ #include __FBSDID("$FreeBSD$"); +#include #include #include #include @@ -170,13 +171,12 @@ sctp_connectx(int sd, const struct sockaddr *addrs, in int sctp_bindx(int sd, struct sockaddr *addrs, int addrcnt, int flags) { - struct sctp_getaddresses *gaddrs; struct sockaddr *sa; struct sockaddr_in *sin; struct sockaddr_in6 *sin6; int i; - size_t argsz; - uint16_t sport = 0; + uint16_t sport; + bool fix_port; /* validate the flags */ if ((flags != SCTP_BINDX_ADD_ADDR) && @@ -189,6 +189,8 @@ sctp_bindx(int sd, struct sockaddr *addrs, int addrcnt errno = EINVAL; return (-1); } + sport = 0; + fix_port = false; /* First pre-screen the addresses */ sa = addrs; for (i = 0; i < addrcnt; i++) { @@ -210,6 +212,7 @@ sctp_bindx(int sd, struct sockaddr *addrs, int addrcnt } else { /* save off the port */ sport = sin->sin_port; + fix_port = (i > 0); } } break; @@ -230,6 +233,7 @@ sctp_bindx(int sd, struct sockaddr *addrs, int addrcnt } else { /* save off the port */ sport = sin6->sin6_port; + fix_port = (i > 0); } } break; @@ -240,42 +244,29 @@ sctp_bindx(int sd, struct sockaddr *addrs, int addrcnt } sa = (struct sockaddr *)((caddr_t)sa + sa->sa_len); } - argsz = sizeof(struct sctp_getaddresses) + - sizeof(struct sockaddr_storage); - if ((gaddrs = (struct sctp_getaddresses *)malloc(argsz)) == NULL) { - errno = ENOMEM; - return (-1); - } sa = addrs; for (i = 0; i < addrcnt; i++) { - memset(gaddrs, 0, argsz); - gaddrs->sget_assoc_id = 0; - memcpy(gaddrs->addr, sa, sa->sa_len); /* * Now, if there was a port mentioned, assure that the first * address has that port to make sure it fails or succeeds * correctly. */ - if ((i == 0) && (sport != 0)) { - switch (gaddrs->addr->sa_family) { + if (fix_port) { + switch (sa->sa_family) { case AF_INET: - sin = (struct sockaddr_in *)gaddrs->addr; - sin->sin_port = sport; + ((struct sockaddr_in *)sa)->sin_port = sport; break; case AF_INET6: - sin6 = (struct sockaddr_in6 *)gaddrs->addr; - sin6->sin6_port = sport; + ((struct sockaddr_in6 *)sa)->sin6_port = sport; break; } + fix_port = false; } - if (setsockopt(sd, IPPROTO_SCTP, flags, gaddrs, - (socklen_t)argsz) != 0) { - free(gaddrs); + if (setsockopt(sd, IPPROTO_SCTP, flags, sa, sa->sa_len) != 0) { return (-1); } sa = (struct sockaddr *)((caddr_t)sa + sa->sa_len); } - free(gaddrs); return (0); } Modified: stable/12/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/12/sys/netinet/sctp_usrreq.c Mon Aug 24 08:16:07 2020 (r364616) +++ stable/12/sys/netinet/sctp_usrreq.c Mon Aug 24 08:19:25 2020 (r364617) @@ -5976,33 +5976,35 @@ sctp_setopt(struct socket *so, int optname, void *optv } case SCTP_BINDX_ADD_ADDR: { - struct sctp_getaddresses *addrs; + struct sockaddr *sa; struct thread *td; td = (struct thread *)p; - SCTP_CHECK_AND_CAST(addrs, optval, struct sctp_getaddresses, - optsize); + SCTP_CHECK_AND_CAST(sa, optval, struct sockaddr, optsize); #ifdef INET - if (addrs->addr->sa_family == AF_INET) { - if (optsize < sizeof(struct sctp_getaddresses) - sizeof(struct sockaddr) + sizeof(struct sockaddr_in)) { + if (sa->sa_family == AF_INET) { + if (optsize < sizeof(struct sockaddr_in)) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; break; } - if (td != NULL && (error = prison_local_ip4(td->td_ucred, &(((struct sockaddr_in *)(addrs->addr))->sin_addr)))) { + if (td != NULL && + (error = prison_local_ip4(td->td_ucred, &(((struct sockaddr_in *)sa)->sin_addr)))) { SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, error); break; } } else #endif #ifdef INET6 - if (addrs->addr->sa_family == AF_INET6) { - if (optsize < sizeof(struct sctp_getaddresses) - sizeof(struct sockaddr) + sizeof(struct sockaddr_in6)) { + if (sa->sa_family == AF_INET6) { + if (optsize < sizeof(struct sockaddr_in6)) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; break; } - if (td != NULL && (error = prison_local_ip6(td->td_ucred, &(((struct sockaddr_in6 *)(addrs->addr))->sin6_addr), + if (td != NULL && + (error = prison_local_ip6(td->td_ucred, + &(((struct sockaddr_in6 *)sa)->sin6_addr), (SCTP_IPV6_V6ONLY(inp) != 0))) != 0) { SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, error); break; @@ -6013,40 +6015,41 @@ sctp_setopt(struct socket *so, int optname, void *optv error = EAFNOSUPPORT; break; } - sctp_bindx_add_address(so, inp, addrs->addr, vrf_id, &error, p); + sctp_bindx_add_address(so, inp, sa, vrf_id, &error, p); break; } case SCTP_BINDX_REM_ADDR: { - struct sctp_getaddresses *addrs; + struct sockaddr *sa; struct thread *td; td = (struct thread *)p; - SCTP_CHECK_AND_CAST(addrs, optval, struct sctp_getaddresses, optsize); + SCTP_CHECK_AND_CAST(sa, optval, struct sockaddr, optsize); #ifdef INET - if (addrs->addr->sa_family == AF_INET) { - if (optsize < sizeof(struct sctp_getaddresses) - sizeof(struct sockaddr) + sizeof(struct sockaddr_in)) { + if (sa->sa_family == AF_INET) { + if (optsize < sizeof(struct sockaddr_in)) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; break; } - if (td != NULL && (error = prison_local_ip4(td->td_ucred, &(((struct sockaddr_in *)(addrs->addr))->sin_addr)))) { + if (td != NULL && + (error = prison_local_ip4(td->td_ucred, &(((struct sockaddr_in *)sa)->sin_addr)))) { SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, error); break; } } else #endif #ifdef INET6 - if (addrs->addr->sa_family == AF_INET6) { - if (optsize < sizeof(struct sctp_getaddresses) - sizeof(struct sockaddr) + sizeof(struct sockaddr_in6)) { + if (sa->sa_family == AF_INET6) { + if (optsize < sizeof(struct sockaddr_in6)) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; break; } if (td != NULL && (error = prison_local_ip6(td->td_ucred, - &(((struct sockaddr_in6 *)(addrs->addr))->sin6_addr), + &(((struct sockaddr_in6 *)sa)->sin6_addr), (SCTP_IPV6_V6ONLY(inp) != 0))) != 0) { SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, error); break; @@ -6057,7 +6060,7 @@ sctp_setopt(struct socket *so, int optname, void *optv error = EAFNOSUPPORT; break; } - sctp_bindx_delete_address(inp, addrs->addr, vrf_id, &error); + sctp_bindx_delete_address(inp, sa, vrf_id, &error); break; } case SCTP_EVENT: From owner-svn-src-stable-12@freebsd.org Mon Aug 24 08:20:50 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 19F583B4A5B; Mon, 24 Aug 2020 08:20:50 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZlSK72x4z4L0G; Mon, 24 Aug 2020 08:20: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 D49EE1583A; Mon, 24 Aug 2020 08:20: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 07O8KnK0066617; Mon, 24 Aug 2020 08:20:49 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O8KnUD066616; Mon, 24 Aug 2020 08:20:49 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240820.07O8KnUD066616@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 08:20:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364618 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364618 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 08:20:50 -0000 Author: tuexen Date: Mon Aug 24 08:20:49 2020 New Revision: 364618 URL: https://svnweb.freebsd.org/changeset/base/364618 Log: MFC r362454: Set a variable also in the case of an INET6 only kernel Modified: stable/12/sys/netinet/sctputil.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctputil.c ============================================================================== --- stable/12/sys/netinet/sctputil.c Mon Aug 24 08:19:25 2020 (r364617) +++ stable/12/sys/netinet/sctputil.c Mon Aug 24 08:20:49 2020 (r364618) @@ -6734,6 +6734,8 @@ sctp_bindx_add_address(struct socket *so, struct sctp_ } else { addr_to_use = sa; } +#else + addr_to_use = sa; #endif break; #endif From owner-svn-src-stable-12@freebsd.org Mon Aug 24 08:22:37 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AD33F3B4CB7; Mon, 24 Aug 2020 08:22:37 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZlVP488Gz4L96; Mon, 24 Aug 2020 08:22: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 7227A15A45; Mon, 24 Aug 2020 08:22: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 07O8Mbr2070781; Mon, 24 Aug 2020 08:22:37 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O8MbuR070780; Mon, 24 Aug 2020 08:22:37 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240822.07O8MbuR070780@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 08:22:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364619 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364619 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 08:22:37 -0000 Author: tuexen Date: Mon Aug 24 08:22:37 2020 New Revision: 364619 URL: https://svnweb.freebsd.org/changeset/base/364619 Log: MFC r362462: Fix the build for an INET6 only configuration. The fix from the last commit is actually needed twice... Modified: stable/12/sys/netinet/sctputil.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctputil.c ============================================================================== --- stable/12/sys/netinet/sctputil.c Mon Aug 24 08:20:49 2020 (r364618) +++ stable/12/sys/netinet/sctputil.c Mon Aug 24 08:22:37 2020 (r364619) @@ -6841,6 +6841,8 @@ sctp_bindx_delete_address(struct sctp_inpcb *inp, } else { addr_to_use = sa; } +#else + addr_to_use = sa; #endif break; #endif From owner-svn-src-stable-12@freebsd.org Mon Aug 24 08:25:01 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A202D3B4FBF; Mon, 24 Aug 2020 08:25: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZlY93gdfz4LG9; Mon, 24 Aug 2020 08:25: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 6157415ABE; Mon, 24 Aug 2020 08:25: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 07O8P1MI070957; Mon, 24 Aug 2020 08:25:01 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O8P0F5070954; Mon, 24 Aug 2020 08:25:00 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240825.07O8P0F5070954@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 08:25:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364620 - in stable/12: lib/libc/net sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in stable/12: lib/libc/net sys/netinet X-SVN-Commit-Revision: 364620 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 08:25:01 -0000 Author: tuexen Date: Mon Aug 24 08:25:00 2020 New Revision: 364620 URL: https://svnweb.freebsd.org/changeset/base/364620 Log: MFC r362473: leanup the defintion of struct sctp_getaddresses. This stucture is used by the IPPROTO_SCTP level socket options SCTP_GET_PEER_ADDRESSES and SCTP_GET_LOCAL_ADDRESSES, which are used by libc to implement sctp_getladdrs() and sctp_getpaddrs(). These changes allow an old libc to work on a newer kernel. Modified: stable/12/lib/libc/net/sctp_sys_calls.c stable/12/sys/netinet/sctp_uio.h stable/12/sys/netinet/sctp_usrreq.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/net/sctp_sys_calls.c ============================================================================== --- stable/12/lib/libc/net/sctp_sys_calls.c Mon Aug 24 08:22:37 2020 (r364619) +++ stable/12/lib/libc/net/sctp_sys_calls.c Mon Aug 24 08:25:00 2020 (r364620) @@ -406,7 +406,7 @@ sctp_getpaddrs(int sd, sctp_assoc_t id, struct sockadd return (-1); } /* size required is returned in 'asoc' */ - opt_len = (socklen_t)((size_t)asoc + sizeof(sctp_assoc_t)); + opt_len = (socklen_t)((size_t)asoc + sizeof(struct sctp_getaddresses)); addrs = calloc(1, (size_t)opt_len); if (addrs == NULL) { errno = ENOMEM; @@ -419,9 +419,9 @@ sctp_getpaddrs(int sd, sctp_assoc_t id, struct sockadd free(addrs); return (-1); } - *raddrs = (struct sockaddr *)&addrs->addr[0]; + *raddrs = &addrs->addr[0].sa; cnt = 0; - sa = (struct sockaddr *)&addrs->addr[0]; + sa = &addrs->addr[0].sa; lim = (caddr_t)addrs + opt_len; while (((caddr_t)sa < lim) && (sa->sa_len > 0)) { sa = (struct sockaddr *)((caddr_t)sa + sa->sa_len); @@ -436,7 +436,7 @@ sctp_freepaddrs(struct sockaddr *addrs) void *fr_addr; /* Take away the hidden association id */ - fr_addr = (void *)((caddr_t)addrs - sizeof(sctp_assoc_t)); + fr_addr = (void *)((caddr_t)addrs - offsetof(struct sctp_getaddresses, addr)); /* Now free it */ free(fr_addr); } @@ -466,7 +466,7 @@ sctp_getladdrs(int sd, sctp_assoc_t id, struct sockadd errno = ENOTCONN; return (-1); } - opt_len = (socklen_t)(size_of_addresses + sizeof(sctp_assoc_t)); + opt_len = (socklen_t)(size_of_addresses + sizeof(struct sctp_getaddresses)); addrs = calloc(1, (size_t)opt_len); if (addrs == NULL) { errno = ENOMEM; @@ -480,9 +480,9 @@ sctp_getladdrs(int sd, sctp_assoc_t id, struct sockadd errno = ENOMEM; return (-1); } - *raddrs = (struct sockaddr *)&addrs->addr[0]; + *raddrs = &addrs->addr[0].sa; cnt = 0; - sa = (struct sockaddr *)&addrs->addr[0]; + sa = &addrs->addr[0].sa; lim = (caddr_t)addrs + opt_len; while (((caddr_t)sa < lim) && (sa->sa_len > 0)) { sa = (struct sockaddr *)((caddr_t)sa + sa->sa_len); @@ -497,7 +497,7 @@ sctp_freeladdrs(struct sockaddr *addrs) void *fr_addr; /* Take away the hidden association id */ - fr_addr = (void *)((caddr_t)addrs - sizeof(sctp_assoc_t)); + fr_addr = (void *)((caddr_t)addrs - offsetof(struct sctp_getaddresses, addr)); /* Now free it */ free(fr_addr); } Modified: stable/12/sys/netinet/sctp_uio.h ============================================================================== --- stable/12/sys/netinet/sctp_uio.h Mon Aug 24 08:22:37 2020 (r364619) +++ stable/12/sys/netinet/sctp_uio.h Mon Aug 24 08:25:00 2020 (r364620) @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$"); #define _NETINET_SCTP_UIO_H_ -#if ! defined(_KERNEL) +#if !defined(_KERNEL) #include #endif #include @@ -633,10 +633,15 @@ struct sctp_setpeerprim { uint8_t sspp_padding[4]; }; +union sctp_sockstore { + struct sockaddr_in sin; + struct sockaddr_in6 sin6; + struct sockaddr sa; +}; + struct sctp_getaddresses { sctp_assoc_t sget_assoc_id; - /* addr is filled in for N * sockaddr_storage */ - struct sockaddr addr[1]; + union sctp_sockstore addr[]; }; struct sctp_status { @@ -1142,12 +1147,6 @@ struct sctpstat { #define SCTP_STAT_DECR_COUNTER32(_x) SCTP_STAT_DECR(_x) #define SCTP_STAT_DECR_COUNTER64(_x) SCTP_STAT_DECR(_x) #define SCTP_STAT_DECR_GAUGE32(_x) SCTP_STAT_DECR(_x) - -union sctp_sockstore { - struct sockaddr_in sin; - struct sockaddr_in6 sin6; - struct sockaddr sa; -}; /***********************************/ Modified: stable/12/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/12/sys/netinet/sctp_usrreq.c Mon Aug 24 08:22:37 2020 (r364619) +++ stable/12/sys/netinet/sctp_usrreq.c Mon Aug 24 08:25:00 2020 (r364620) @@ -970,7 +970,7 @@ sctp_shutdown(struct socket *so) * returns 0 on success, 1 on error */ static uint32_t -sctp_fill_user_address(struct sockaddr_storage *ss, struct sockaddr *sa) +sctp_fill_user_address(union sctp_sockstore *ss, struct sockaddr *sa) { #ifdef INET6 struct sockaddr_in6 lsa6; @@ -991,7 +991,7 @@ static size_t sctp_fill_up_addresses_vrf(struct sctp_inpcb *inp, struct sctp_tcb *stcb, size_t limit, - struct sockaddr_storage *sas, + union sctp_sockstore *addr, uint32_t vrf_id) { struct sctp_ifn *sctp_ifn; @@ -1106,18 +1106,18 @@ sctp_fill_up_addresses_vrf(struct sctp_inpcb *inp, if (actual + sizeof(struct sockaddr_in6) > limit) { return (actual); } - in6_sin_2_v4mapsin6(sin, (struct sockaddr_in6 *)sas); - ((struct sockaddr_in6 *)sas)->sin6_port = inp->sctp_lport; - sas = (struct sockaddr_storage *)((caddr_t)sas + sizeof(struct sockaddr_in6)); + in6_sin_2_v4mapsin6(sin, &addr->sin6); + addr->sin6.sin6_port = inp->sctp_lport; + addr = (union sctp_sockstore *)((caddr_t)addr + sizeof(struct sockaddr_in6)); actual += sizeof(struct sockaddr_in6); } else { #endif if (actual + sizeof(struct sockaddr_in) > limit) { return (actual); } - memcpy(sas, sin, sizeof(struct sockaddr_in)); - ((struct sockaddr_in *)sas)->sin_port = inp->sctp_lport; - sas = (struct sockaddr_storage *)((caddr_t)sas + sizeof(struct sockaddr_in)); + memcpy(addr, sin, sizeof(struct sockaddr_in)); + addr->sin.sin_port = inp->sctp_lport; + addr = (union sctp_sockstore *)((caddr_t)addr + sizeof(struct sockaddr_in)); actual += sizeof(struct sockaddr_in); #ifdef INET6 } @@ -1169,9 +1169,9 @@ sctp_fill_up_addresses_vrf(struct sctp_inpcb *inp, if (actual + sizeof(struct sockaddr_in6) > limit) { return (actual); } - memcpy(sas, sin6, sizeof(struct sockaddr_in6)); - ((struct sockaddr_in6 *)sas)->sin6_port = inp->sctp_lport; - sas = (struct sockaddr_storage *)((caddr_t)sas + sizeof(struct sockaddr_in6)); + memcpy(addr, sin6, sizeof(struct sockaddr_in6)); + addr->sin6.sin6_port = inp->sctp_lport; + addr = (union sctp_sockstore *)((caddr_t)addr + sizeof(struct sockaddr_in6)); actual += sizeof(struct sockaddr_in6); } else { continue; @@ -1198,24 +1198,24 @@ sctp_fill_up_addresses_vrf(struct sctp_inpcb *inp, if (actual + sa_len > limit) { return (actual); } - if (sctp_fill_user_address(sas, &laddr->ifa->address.sa)) + if (sctp_fill_user_address(addr, &laddr->ifa->address.sa)) continue; switch (laddr->ifa->address.sa.sa_family) { #ifdef INET case AF_INET: - ((struct sockaddr_in *)sas)->sin_port = inp->sctp_lport; + addr->sin.sin_port = inp->sctp_lport; break; #endif #ifdef INET6 case AF_INET6: - ((struct sockaddr_in6 *)sas)->sin6_port = inp->sctp_lport; + addr->sin6.sin6_port = inp->sctp_lport; break; #endif default: /* TSNH */ break; } - sas = (struct sockaddr_storage *)((caddr_t)sas + sa_len); + addr = (union sctp_sockstore *)((caddr_t)addr + sa_len); actual += sa_len; } } @@ -1226,13 +1226,13 @@ static size_t sctp_fill_up_addresses(struct sctp_inpcb *inp, struct sctp_tcb *stcb, size_t limit, - struct sockaddr_storage *sas) + union sctp_sockstore *addr) { size_t size = 0; SCTP_IPI_ADDR_RLOCK(); /* fill up addresses for the endpoint's default vrf */ - size = sctp_fill_up_addresses_vrf(inp, stcb, limit, sas, + size = sctp_fill_up_addresses_vrf(inp, stcb, limit, addr, inp->def_vrf_id); SCTP_IPI_ADDR_RUNLOCK(); return (size); @@ -2207,7 +2207,7 @@ flags_out: */ { size_t cpsz, left; - struct sockaddr_storage *sas; + union sctp_sockstore *addr; struct sctp_nets *net; struct sctp_getaddresses *saddr; @@ -2215,9 +2215,9 @@ flags_out: SCTP_FIND_STCB(inp, stcb, saddr->sget_assoc_id); if (stcb) { - left = (*optsize) - sizeof(sctp_assoc_t); - *optsize = sizeof(sctp_assoc_t); - sas = (struct sockaddr_storage *)&saddr->addr[0]; + left = *optsize - offsetof(struct sctp_getaddresses, addr); + *optsize = offsetof(struct sctp_getaddresses, addr); + addr = &saddr->addr[0]; TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { switch (net->ro._l_addr.sa.sa_family) { @@ -2255,16 +2255,16 @@ flags_out: (net->ro._l_addr.sa.sa_family == AF_INET)) { /* Must map the address */ in6_sin_2_v4mapsin6(&net->ro._l_addr.sin, - (struct sockaddr_in6 *)sas); + &addr->sin6); } else { - memcpy(sas, &net->ro._l_addr, cpsz); + memcpy(addr, &net->ro._l_addr, cpsz); } #else - memcpy(sas, &net->ro._l_addr, cpsz); + memcpy(addr, &net->ro._l_addr, cpsz); #endif - ((struct sockaddr_in *)sas)->sin_port = stcb->rport; + addr->sin.sin_port = stcb->rport; - sas = (struct sockaddr_storage *)((caddr_t)sas + cpsz); + addr = (union sctp_sockstore *)((caddr_t)addr + cpsz); left -= cpsz; *optsize += cpsz; } @@ -2278,19 +2278,17 @@ flags_out: case SCTP_GET_LOCAL_ADDRESSES: { size_t limit, actual; - struct sockaddr_storage *sas; struct sctp_getaddresses *saddr; SCTP_CHECK_AND_CAST(saddr, optval, struct sctp_getaddresses, *optsize); SCTP_FIND_STCB(inp, stcb, saddr->sget_assoc_id); - sas = (struct sockaddr_storage *)&saddr->addr[0]; - limit = *optsize - sizeof(sctp_assoc_t); - actual = sctp_fill_up_addresses(inp, stcb, limit, sas); + limit = *optsize - offsetof(struct sctp_getaddresses, addr); + actual = sctp_fill_up_addresses(inp, stcb, limit, saddr->addr); if (stcb) { SCTP_TCB_UNLOCK(stcb); } - *optsize = sizeof(sctp_assoc_t) + actual; + *optsize = offsetof(struct sctp_getaddresses, addr) + actual; break; } case SCTP_PEER_ADDR_PARAMS: From owner-svn-src-stable-12@freebsd.org Mon Aug 24 08:26:08 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0E0E63B5119; Mon, 24 Aug 2020 08:26: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZlZR6bVlz4Lm7; Mon, 24 Aug 2020 08:26: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 C69EE156CF; Mon, 24 Aug 2020 08:26: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 07O8Q7ta071066; Mon, 24 Aug 2020 08:26:07 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O8Q7Ow071065; Mon, 24 Aug 2020 08:26:07 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240826.07O8Q7Ow071065@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 08:26:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364621 - stable/12/lib/libc/net X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/lib/libc/net X-SVN-Commit-Revision: 364621 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 08:26:08 -0000 Author: tuexen Date: Mon Aug 24 08:26:07 2020 New Revision: 364621 URL: https://svnweb.freebsd.org/changeset/base/364621 Log: MFC r362474: Add include missing from my last commit. Modified: stable/12/lib/libc/net/sctp_sys_calls.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/net/sctp_sys_calls.c ============================================================================== --- stable/12/lib/libc/net/sctp_sys_calls.c Mon Aug 24 08:25:00 2020 (r364620) +++ stable/12/lib/libc/net/sctp_sys_calls.c Mon Aug 24 08:26:07 2020 (r364621) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include From owner-svn-src-stable-12@freebsd.org Mon Aug 24 08:27:36 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 24DF93B4EF6; Mon, 24 Aug 2020 08:27:36 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZlc76mdRz4Ldk; Mon, 24 Aug 2020 08:27: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 CCED915A48; Mon, 24 Aug 2020 08:27: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 07O8RZUK071189; Mon, 24 Aug 2020 08:27:35 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O8RZAN071188; Mon, 24 Aug 2020 08:27:35 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240827.07O8RZAN071188@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 08:27:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364622 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364622 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 08:27:36 -0000 Author: tuexen Date: Mon Aug 24 08:27:35 2020 New Revision: 364622 URL: https://svnweb.freebsd.org/changeset/base/364622 Log: MFC r362498: No need to include netinet/sctp_crc32.h twice. Modified: stable/12/sys/netinet/sctp_crc32.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_crc32.c ============================================================================== --- stable/12/sys/netinet/sctp_crc32.c Mon Aug 24 08:26:07 2020 (r364621) +++ stable/12/sys/netinet/sctp_crc32.c Mon Aug 24 08:27:35 2020 (r364622) @@ -45,7 +45,6 @@ __FBSDID("$FreeBSD$"); #include #if defined(SCTP) || defined(SCTP_SUPPORT) #include -#include #include #endif From owner-svn-src-stable-12@freebsd.org Mon Aug 24 08:30:37 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A1F5E3B5481; Mon, 24 Aug 2020 08:30:37 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZlgd3vw8z4Lqs; Mon, 24 Aug 2020 08:30: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 6AB06157E9; Mon, 24 Aug 2020 08:30: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 07O8UbgU071430; Mon, 24 Aug 2020 08:30:37 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O8Ubof071429; Mon, 24 Aug 2020 08:30:37 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240830.07O8Ubof071429@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 08:30:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364623 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364623 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 08:30:37 -0000 Author: tuexen Date: Mon Aug 24 08:30:36 2020 New Revision: 364623 URL: https://svnweb.freebsd.org/changeset/base/364623 Log: MFC r362563: Fix alignment issue manifesting in the userland stack. MFC r364353: Fix two bugs I introduced in r362563. Found by running syzkaller. Modified: stable/12/sys/netinet/sctp_usrreq.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/12/sys/netinet/sctp_usrreq.c Mon Aug 24 08:27:35 2020 (r364622) +++ stable/12/sys/netinet/sctp_usrreq.c Mon Aug 24 08:30:36 2020 (r364623) @@ -970,15 +970,15 @@ sctp_shutdown(struct socket *so) * returns 0 on success, 1 on error */ static uint32_t -sctp_fill_user_address(union sctp_sockstore *ss, struct sockaddr *sa) +sctp_fill_user_address(struct sockaddr *dst, struct sockaddr *src) { #ifdef INET6 struct sockaddr_in6 lsa6; - sa = (struct sockaddr *)sctp_recover_scope((struct sockaddr_in6 *)sa, + src = (struct sockaddr *)sctp_recover_scope((struct sockaddr_in6 *)src, &lsa6); #endif - memcpy(ss, sa, sa->sa_len); + memcpy(dst, src, src->sa_len); return (0); } @@ -991,7 +991,7 @@ static size_t sctp_fill_up_addresses_vrf(struct sctp_inpcb *inp, struct sctp_tcb *stcb, size_t limit, - union sctp_sockstore *addr, + struct sockaddr *addr, uint32_t vrf_id) { struct sctp_ifn *sctp_ifn; @@ -1106,9 +1106,9 @@ sctp_fill_up_addresses_vrf(struct sctp_inpcb *inp, if (actual + sizeof(struct sockaddr_in6) > limit) { return (actual); } - in6_sin_2_v4mapsin6(sin, &addr->sin6); - addr->sin6.sin6_port = inp->sctp_lport; - addr = (union sctp_sockstore *)((caddr_t)addr + sizeof(struct sockaddr_in6)); + in6_sin_2_v4mapsin6(sin, (struct sockaddr_in6 *)addr); + ((struct sockaddr_in6 *)addr)->sin6_port = inp->sctp_lport; + addr = (struct sockaddr *)((caddr_t)addr + sizeof(struct sockaddr_in6)); actual += sizeof(struct sockaddr_in6); } else { #endif @@ -1116,8 +1116,8 @@ sctp_fill_up_addresses_vrf(struct sctp_inpcb *inp, return (actual); } memcpy(addr, sin, sizeof(struct sockaddr_in)); - addr->sin.sin_port = inp->sctp_lport; - addr = (union sctp_sockstore *)((caddr_t)addr + sizeof(struct sockaddr_in)); + ((struct sockaddr_in *)addr)->sin_port = inp->sctp_lport; + addr = (struct sockaddr *)((caddr_t)addr + sizeof(struct sockaddr_in)); actual += sizeof(struct sockaddr_in); #ifdef INET6 } @@ -1170,8 +1170,8 @@ sctp_fill_up_addresses_vrf(struct sctp_inpcb *inp, return (actual); } memcpy(addr, sin6, sizeof(struct sockaddr_in6)); - addr->sin6.sin6_port = inp->sctp_lport; - addr = (union sctp_sockstore *)((caddr_t)addr + sizeof(struct sockaddr_in6)); + ((struct sockaddr_in6 *)addr)->sin6_port = inp->sctp_lport; + addr = (struct sockaddr *)((caddr_t)addr + sizeof(struct sockaddr_in6)); actual += sizeof(struct sockaddr_in6); } else { continue; @@ -1203,19 +1203,19 @@ sctp_fill_up_addresses_vrf(struct sctp_inpcb *inp, switch (laddr->ifa->address.sa.sa_family) { #ifdef INET case AF_INET: - addr->sin.sin_port = inp->sctp_lport; + ((struct sockaddr_in *)addr)->sin_port = inp->sctp_lport; break; #endif #ifdef INET6 case AF_INET6: - addr->sin6.sin6_port = inp->sctp_lport; + ((struct sockaddr_in6 *)addr)->sin6_port = inp->sctp_lport; break; #endif default: /* TSNH */ break; } - addr = (union sctp_sockstore *)((caddr_t)addr + sa_len); + addr = (struct sockaddr *)((caddr_t)addr + sa_len); actual += sa_len; } } @@ -1226,7 +1226,7 @@ static size_t sctp_fill_up_addresses(struct sctp_inpcb *inp, struct sctp_tcb *stcb, size_t limit, - union sctp_sockstore *addr) + struct sockaddr *addr) { size_t size = 0; @@ -2207,7 +2207,7 @@ flags_out: */ { size_t cpsz, left; - union sctp_sockstore *addr; + struct sockaddr *addr; struct sctp_nets *net; struct sctp_getaddresses *saddr; @@ -2217,7 +2217,7 @@ flags_out: if (stcb) { left = *optsize - offsetof(struct sctp_getaddresses, addr); *optsize = offsetof(struct sctp_getaddresses, addr); - addr = &saddr->addr[0]; + addr = &saddr->addr[0].sa; TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { switch (net->ro._l_addr.sa.sa_family) { @@ -2255,16 +2255,16 @@ flags_out: (net->ro._l_addr.sa.sa_family == AF_INET)) { /* Must map the address */ in6_sin_2_v4mapsin6(&net->ro._l_addr.sin, - &addr->sin6); + (struct sockaddr_in6 *)addr); } else { memcpy(addr, &net->ro._l_addr, cpsz); } #else memcpy(addr, &net->ro._l_addr, cpsz); #endif - addr->sin.sin_port = stcb->rport; + ((struct sockaddr_in *)addr)->sin_port = stcb->rport; - addr = (union sctp_sockstore *)((caddr_t)addr + cpsz); + addr = (struct sockaddr *)((caddr_t)addr + cpsz); left -= cpsz; *optsize += cpsz; } @@ -2284,7 +2284,7 @@ flags_out: SCTP_FIND_STCB(inp, stcb, saddr->sget_assoc_id); limit = *optsize - offsetof(struct sctp_getaddresses, addr); - actual = sctp_fill_up_addresses(inp, stcb, limit, saddr->addr); + actual = sctp_fill_up_addresses(inp, stcb, limit, &saddr->addr[0].sa); if (stcb) { SCTP_TCB_UNLOCK(stcb); } From owner-svn-src-stable-12@freebsd.org Mon Aug 24 08:32:16 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D250A3B5354; Mon, 24 Aug 2020 08:32: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZljX5Jg3z4MHC; Mon, 24 Aug 2020 08:32:16 +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 9976A156EB; Mon, 24 Aug 2020 08:32:16 +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 07O8WGJr074705; Mon, 24 Aug 2020 08:32:16 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O8WG8S074704; Mon, 24 Aug 2020 08:32:16 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240832.07O8WG8S074704@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 08:32:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364624 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364624 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 08:32:16 -0000 Author: tuexen Date: Mon Aug 24 08:32:16 2020 New Revision: 364624 URL: https://svnweb.freebsd.org/changeset/base/364624 Log: MFC r362581: Fix the acconting for fragmented unordered messages when using interleaving. This was reported for the userland stack in https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19321 Modified: stable/12/sys/netinet/sctp_indata.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_indata.c ============================================================================== --- stable/12/sys/netinet/sctp_indata.c Mon Aug 24 08:30:36 2020 (r364623) +++ stable/12/sys/netinet/sctp_indata.c Mon Aug 24 08:32:16 2020 (r364624) @@ -1111,6 +1111,16 @@ sctp_deliver_reasm_check(struct sctp_tcb *stcb, struct #endif SCTP_STAT_INCR_COUNTER64(sctps_reasmusrmsgs); TAILQ_REMOVE(&strm->uno_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 (control->on_read_q == 0) { @@ -1391,7 +1401,7 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struc } /* Must be added to the stream-in queue */ if (created_control) { - if (unordered == 0) { + if ((unordered == 0) || (asoc->idata_supported)) { sctp_ucount_incr(asoc->cnt_on_all_streams); } if (sctp_place_control_in_stream(strm, asoc, control)) { From owner-svn-src-stable-12@freebsd.org Mon Aug 24 08:33:33 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B5173B5375; Mon, 24 Aug 2020 08:33: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZll073nDz4MT3; Mon, 24 Aug 2020 08:33: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 D5DC615AEE; Mon, 24 Aug 2020 08:33: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 07O8XWu6077298; Mon, 24 Aug 2020 08:33:32 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O8XWig077297; Mon, 24 Aug 2020 08:33:32 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240833.07O8XWig077297@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 08:33:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364625 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364625 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 08:33:33 -0000 Author: tuexen Date: Mon Aug 24 08:33:32 2020 New Revision: 364625 URL: https://svnweb.freebsd.org/changeset/base/364625 Log: MFC r362720: Don't check ch for not being NULL, since that is true. Modified: stable/12/sys/netinet/sctp_input.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_input.c ============================================================================== --- stable/12/sys/netinet/sctp_input.c Mon Aug 24 08:32:16 2020 (r364624) +++ stable/12/sys/netinet/sctp_input.c Mon Aug 24 08:33:32 2020 (r364625) @@ -5106,7 +5106,7 @@ process_control_chunks: break; case SCTP_STREAM_RESET: SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_STREAM_RESET\n"); - if (((stcb == NULL) || (ch == NULL) || (chk_length < sizeof(struct sctp_stream_reset_tsn_req)))) { + if ((stcb == NULL) || (chk_length < sizeof(struct sctp_stream_reset_tsn_req))) { /* Its not ours */ *offset = length; return (stcb); @@ -5129,7 +5129,7 @@ process_control_chunks: return (stcb); } - if ((ch != NULL) && (stcb != NULL) && (netp != NULL) && (*netp != NULL)) { + if ((stcb != NULL) && (netp != NULL) && (*netp != NULL)) { if (stcb->asoc.pktdrop_supported == 0) { goto unknown_chunk; } @@ -5165,8 +5165,7 @@ process_control_chunks: goto next_chunk; } got_auth = 1; - if ((ch == NULL) || sctp_handle_auth(stcb, (struct sctp_auth_chunk *)ch, - m, *offset)) { + if (sctp_handle_auth(stcb, (struct sctp_auth_chunk *)ch, m, *offset)) { /* auth HMAC failed so dump the packet */ *offset = length; return (stcb); From owner-svn-src-stable-12@freebsd.org Mon Aug 24 08:35:14 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 54DB13B5620; Mon, 24 Aug 2020 08:35:14 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZlmy1d2Kz4MZ4; Mon, 24 Aug 2020 08:35: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 1AF2E15E03; Mon, 24 Aug 2020 08:35: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 07O8ZDAO077472; Mon, 24 Aug 2020 08:35:13 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O8ZDcb077471; Mon, 24 Aug 2020 08:35:13 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240835.07O8ZDcb077471@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 08:35:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364626 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364626 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 08:35:14 -0000 Author: tuexen Date: Mon Aug 24 08:35:13 2020 New Revision: 364626 URL: https://svnweb.freebsd.org/changeset/base/364626 Log: MFC r362722: Don't send packets containing ERROR chunks in response to unknown chunks when being in a state where the verification tag to be used is not known yet. Modified: stable/12/sys/netinet/sctp_input.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_input.c ============================================================================== --- stable/12/sys/netinet/sctp_input.c Mon Aug 24 08:33:32 2020 (r364625) +++ stable/12/sys/netinet/sctp_input.c Mon Aug 24 08:35:13 2020 (r364626) @@ -5178,7 +5178,11 @@ process_control_chunks: default: unknown_chunk: /* it's an unknown chunk! */ - if ((ch->chunk_type & 0x40) && (stcb != NULL)) { + if ((ch->chunk_type & 0x40) && + (stcb != NULL) && + (SCTP_GET_STATE(stcb) != SCTP_STATE_EMPTY) && + (SCTP_GET_STATE(stcb) != SCTP_STATE_INUSE) && + (SCTP_GET_STATE(stcb) != SCTP_STATE_COOKIE_WAIT)) { struct sctp_gen_error_cause *cause; int len; From owner-svn-src-stable-12@freebsd.org Mon Aug 24 08:37:30 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 80C703B55E4; Mon, 24 Aug 2020 08:37: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZlqZ2rCCz4Mkf; Mon, 24 Aug 2020 08:37: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 45FC8156EF; Mon, 24 Aug 2020 08:37: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 07O8bUiX077674; Mon, 24 Aug 2020 08:37:30 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O8bUGg077673; Mon, 24 Aug 2020 08:37:30 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240837.07O8bUGg077673@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 08:37:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364627 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364627 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 08:37:30 -0000 Author: tuexen Date: Mon Aug 24 08:37:29 2020 New Revision: 364627 URL: https://svnweb.freebsd.org/changeset/base/364627 Log: MFC r362813: Fix a bug introduced in https://svnweb.freebsd.org/changeset/base/362173 Modified: stable/12/sys/netinet/sctputil.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctputil.c ============================================================================== --- stable/12/sys/netinet/sctputil.c Mon Aug 24 08:35:13 2020 (r364626) +++ stable/12/sys/netinet/sctputil.c Mon Aug 24 08:37:29 2020 (r364627) @@ -5238,7 +5238,11 @@ sctp_find_ifa_in_ep(struct sctp_inpcb *inp, struct soc if (holds_lock == 0) { SCTP_INP_RUNLOCK(inp); } - return (laddr->ifa); + if (laddr != NULL) { + return (laddr->ifa); + } else { + return (NULL); + } } uint32_t From owner-svn-src-stable-12@freebsd.org Mon Aug 24 08:38:59 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7E2703B57C4; Mon, 24 Aug 2020 08: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZlsH2qTSz4MqP; Mon, 24 Aug 2020 08: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 44FAF15E80; Mon, 24 Aug 2020 08: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 07O8cx47077812; Mon, 24 Aug 2020 08:38:59 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O8cxbn077811; Mon, 24 Aug 2020 08:38:59 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240838.07O8cxbn077811@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 08:38:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364628 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364628 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 08:38:59 -0000 Author: tuexen Date: Mon Aug 24 08:38:58 2020 New Revision: 364628 URL: https://svnweb.freebsd.org/changeset/base/364628 Log: MFC r363008: Improve handling of PKTDROP chunks. This includes the input validation to address two issues found by ossfuzz testing the userland stack: * https://oss-fuzz.com/testcase-detail/5387560242380800 * https://oss-fuzz.com/testcase-detail/4887954068865024 and adding support for I-DATA chunks in addition to DATA chunks. Modified: stable/12/sys/netinet/sctp_input.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_input.c ============================================================================== --- stable/12/sys/netinet/sctp_input.c Mon Aug 24 08:37:29 2020 (r364627) +++ stable/12/sys/netinet/sctp_input.c Mon Aug 24 08:38:58 2020 (r364628) @@ -3046,7 +3046,8 @@ process_chunk_drop(struct sctp_tcb *stcb, struct sctp_ { switch (desc->chunk_type) { case SCTP_DATA: - /* find the tsn to resend (possibly */ + case SCTP_IDATA: + /* find the tsn to resend (possibly) */ { uint32_t tsn; struct sctp_tmit_chunk *tp1; @@ -3080,8 +3081,6 @@ process_chunk_drop(struct sctp_tcb *stcb, struct sctp_ SCTP_STAT_INCR(sctps_pdrptsnnf); } if ((tp1) && (tp1->sent < SCTP_DATAGRAM_ACKED)) { - uint8_t *ddp; - if (((flg & SCTP_BADCRC) == 0) && ((flg & SCTP_FROM_MIDDLE_BOX) == 0)) { return (0); @@ -3096,20 +3095,18 @@ process_chunk_drop(struct sctp_tcb *stcb, struct sctp_ SCTP_STAT_INCR(sctps_pdrpdizrw); return (0); } - ddp = (uint8_t *)(mtod(tp1->data, caddr_t)+ - sizeof(struct sctp_data_chunk)); - { - unsigned int iii; - - for (iii = 0; iii < sizeof(desc->data_bytes); - iii++) { - if (ddp[iii] != desc->data_bytes[iii]) { - SCTP_STAT_INCR(sctps_pdrpbadd); - return (-1); - } - } + if ((uint32_t)SCTP_BUF_LEN(tp1->data) < + SCTP_DATA_CHUNK_OVERHEAD(stcb) + SCTP_NUM_DB_TO_VERIFY) { + /* Payload not matching. */ + SCTP_STAT_INCR(sctps_pdrpbadd); + return (-1); } - + if (memcmp(mtod(tp1->data, caddr_t)+SCTP_DATA_CHUNK_OVERHEAD(stcb), + desc->data_bytes, SCTP_NUM_DB_TO_VERIFY) != 0) { + /* Payload not matching. */ + SCTP_STAT_INCR(sctps_pdrpbadd); + return (-1); + } if (tp1->do_rtt) { /* * this guy had a RTO calculation @@ -4135,104 +4132,126 @@ static void sctp_handle_packet_dropped(struct sctp_pktdrop_chunk *cp, struct sctp_tcb *stcb, struct sctp_nets *net, uint32_t limit) { + struct sctp_chunk_desc desc; + struct sctp_chunkhdr *chk_hdr; + struct sctp_data_chunk *data_chunk; + struct sctp_idata_chunk *idata_chunk; uint32_t bottle_bw, on_queue; + uint32_t offset, chk_len; uint16_t trunc_len; - unsigned int chlen; - unsigned int at; - struct sctp_chunk_desc desc; - struct sctp_chunkhdr *ch; + uint16_t pktdrp_len; + uint8_t pktdrp_flags; - chlen = ntohs(cp->ch.chunk_length); - chlen -= sizeof(struct sctp_pktdrop_chunk); - /* XXX possible chlen underflow */ - if (chlen == 0) { - ch = NULL; - if (cp->ch.chunk_flags & SCTP_FROM_MIDDLE_BOX) + KASSERT(sizeof(struct sctp_pktdrop_chunk) <= limit, + ("PKTDROP chunk too small")); + pktdrp_flags = cp->ch.chunk_flags; + pktdrp_len = ntohs(cp->ch.chunk_length); + KASSERT(limit <= pktdrp_len, ("Inconsistent limit")); + if (pktdrp_flags & SCTP_PACKET_TRUNCATED) { + trunc_len = ntohs(cp->trunc_len); + if (trunc_len <= pktdrp_len - sizeof(struct sctp_pktdrop_chunk)) { + /* The peer plays games with us. */ + return; + } + } else { + trunc_len = 0; + } + limit -= sizeof(struct sctp_pktdrop_chunk); + offset = 0; + if (offset == limit) { + if (pktdrp_flags & SCTP_FROM_MIDDLE_BOX) { SCTP_STAT_INCR(sctps_pdrpbwrpt); + } + } else if (offset + sizeof(struct sctphdr) > limit) { + /* Only a partial SCTP common header. */ + SCTP_STAT_INCR(sctps_pdrpcrupt); + offset = limit; } else { - ch = (struct sctp_chunkhdr *)(cp->data + sizeof(struct sctphdr)); - chlen -= sizeof(struct sctphdr); - /* XXX possible chlen underflow */ - memset(&desc, 0, sizeof(desc)); + /* XXX: Check embedded SCTP common header. */ + offset += sizeof(struct sctphdr); } - trunc_len = (uint16_t)ntohs(cp->trunc_len); - if (trunc_len > limit) { - trunc_len = limit; - } - - /* now the chunks themselves */ - while ((ch != NULL) && (chlen >= sizeof(struct sctp_chunkhdr))) { - desc.chunk_type = ch->chunk_type; - /* get amount we need to move */ - at = ntohs(ch->chunk_length); - if (at < sizeof(struct sctp_chunkhdr)) { - /* corrupt chunk, maybe at the end? */ + /* Now parse through the chunks themselves. */ + while (offset < limit) { + if (offset + sizeof(struct sctp_chunkhdr) > limit) { SCTP_STAT_INCR(sctps_pdrpcrupt); break; } - if (trunc_len == 0) { - /* we are supposed to have all of it */ - if (at > chlen) { - /* corrupt skip it */ - SCTP_STAT_INCR(sctps_pdrpcrupt); + chk_hdr = (struct sctp_chunkhdr *)(cp->data + offset); + desc.chunk_type = chk_hdr->chunk_type; + /* get amount we need to move */ + chk_len = (uint32_t)ntohs(chk_hdr->chunk_length); + if (chk_len < sizeof(struct sctp_chunkhdr)) { + /* Someone is lying... */ + break; + } + if (desc.chunk_type == SCTP_DATA) { + if (stcb->asoc.idata_supported) { + /* Some is playing games with us. */ break; } - } else { - /* is there enough of it left ? */ - if (desc.chunk_type == SCTP_DATA) { - if (chlen < (sizeof(struct sctp_data_chunk) + - sizeof(desc.data_bytes))) { - break; - } - } else { - if (chlen < sizeof(struct sctp_chunkhdr)) { - break; - } + if (chk_len <= sizeof(struct sctp_data_chunk)) { + /* Some is playing games with us. */ + break; } - } - if (desc.chunk_type == SCTP_DATA) { - /* can we get out the tsn? */ - if ((cp->ch.chunk_flags & SCTP_FROM_MIDDLE_BOX)) + if (chk_len < sizeof(struct sctp_data_chunk) + SCTP_NUM_DB_TO_VERIFY) { + /* + * Not enough data bytes available in the + * chunk. + */ + SCTP_STAT_INCR(sctps_pdrpnedat); + goto next_chunk; + } + if (offset + sizeof(struct sctp_data_chunk) + SCTP_NUM_DB_TO_VERIFY > limit) { + /* Not enough data in buffer. */ + break; + } + data_chunk = (struct sctp_data_chunk *)(cp->data + offset); + memcpy(desc.data_bytes, data_chunk + 1, SCTP_NUM_DB_TO_VERIFY); + desc.tsn_ifany = data_chunk->dp.tsn; + if (pktdrp_flags & SCTP_FROM_MIDDLE_BOX) { SCTP_STAT_INCR(sctps_pdrpmbda); - - if (chlen >= (sizeof(struct sctp_data_chunk) + sizeof(uint32_t))) { - /* yep */ - struct sctp_data_chunk *dcp; - uint8_t *ddp; - unsigned int iii; - - dcp = (struct sctp_data_chunk *)ch; - ddp = (uint8_t *)(dcp + 1); - for (iii = 0; iii < sizeof(desc.data_bytes); iii++) { - desc.data_bytes[iii] = ddp[iii]; - } - desc.tsn_ifany = dcp->dp.tsn; - } else { - /* nope we are done. */ + } + } else if (desc.chunk_type == SCTP_IDATA) { + if (!stcb->asoc.idata_supported) { + /* Some is playing games with us. */ + break; + } + if (chk_len <= sizeof(struct sctp_idata_chunk)) { + /* Some is playing games with us. */ + break; + } + if (chk_len < sizeof(struct sctp_idata_chunk) + SCTP_NUM_DB_TO_VERIFY) { + /* + * Not enough data bytes available in the + * chunk. + */ SCTP_STAT_INCR(sctps_pdrpnedat); + goto next_chunk; + } + if (offset + sizeof(struct sctp_idata_chunk) + SCTP_NUM_DB_TO_VERIFY > limit) { + /* Not enough data in buffer. */ break; } + idata_chunk = (struct sctp_idata_chunk *)(cp->data + offset); + memcpy(desc.data_bytes, idata_chunk + 1, SCTP_NUM_DB_TO_VERIFY); + desc.tsn_ifany = idata_chunk->dp.tsn; + if (pktdrp_flags & SCTP_FROM_MIDDLE_BOX) { + SCTP_STAT_INCR(sctps_pdrpmbda); + } } else { - if ((cp->ch.chunk_flags & SCTP_FROM_MIDDLE_BOX)) + if (pktdrp_flags & SCTP_FROM_MIDDLE_BOX) { SCTP_STAT_INCR(sctps_pdrpmbct); + } } - - if (process_chunk_drop(stcb, &desc, net, cp->ch.chunk_flags)) { + if (process_chunk_drop(stcb, &desc, net, pktdrp_flags)) { SCTP_STAT_INCR(sctps_pdrppdbrk); break; } - if (SCTP_SIZE32(at) > chlen) { - break; - } - chlen -= SCTP_SIZE32(at); - if (chlen < sizeof(struct sctp_chunkhdr)) { - /* done, none left */ - break; - } - ch = (struct sctp_chunkhdr *)((caddr_t)ch + SCTP_SIZE32(at)); +next_chunk: + offset += SCTP_SIZE32(chk_len); } /* Now update any rwnd --- possibly */ - if ((cp->ch.chunk_flags & SCTP_FROM_MIDDLE_BOX) == 0) { + if ((pktdrp_flags & SCTP_FROM_MIDDLE_BOX) == 0) { /* From a peer, we get a rwnd report */ uint32_t a_rwnd; @@ -4268,7 +4287,7 @@ sctp_handle_packet_dropped(struct sctp_pktdrop_chunk * } /* now middle boxes in sat networks get a cwnd bump */ - if ((cp->ch.chunk_flags & SCTP_FROM_MIDDLE_BOX) && + if ((pktdrp_flags & SCTP_FROM_MIDDLE_BOX) && (stcb->asoc.sat_t3_loss_recovery == 0) && (stcb->asoc.sat_network)) { /* From owner-svn-src-stable-12@freebsd.org Mon Aug 24 08:40:11 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6256D3B5658; Mon, 24 Aug 2020 08:40: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZltg1SDHz4NBr; Mon, 24 Aug 2020 08:40:11 +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 1508315CA1; Mon, 24 Aug 2020 08:40:11 +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 07O8eA4F077975; Mon, 24 Aug 2020 08:40:10 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O8eAHk077974; Mon, 24 Aug 2020 08:40:10 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240840.07O8eAHk077974@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 08:40:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364629 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364629 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 08:40:11 -0000 Author: tuexen Date: Mon Aug 24 08:40:10 2020 New Revision: 364629 URL: https://svnweb.freebsd.org/changeset/base/364629 Log: MFC r363010: Don't accept FORWARD-TSN chunks when I-FORWARD-TSN was negotiated and vice versa. Modified: stable/12/sys/netinet/sctp_input.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_input.c ============================================================================== --- stable/12/sys/netinet/sctp_input.c Mon Aug 24 08:38:58 2020 (r364628) +++ stable/12/sys/netinet/sctp_input.c Mon Aug 24 08:40:10 2020 (r364629) @@ -5089,7 +5089,8 @@ 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, "%s\n", + ch->chunk_type == SCTP_FORWARD_CUM_TSN ? "FORWARD_TSN" : "I_FORWARD_TSN"); if (chk_length < sizeof(struct sctp_forward_tsn_chunk)) { /* Its not ours */ *offset = length; @@ -5101,6 +5102,18 @@ process_control_chunks: if (stcb->asoc.prsctp_supported == 0) { goto unknown_chunk; + } + if (((asoc->idata_supported == 1) && (ch->chunk_type == SCTP_FORWARD_CUM_TSN)) || + ((asoc->idata_supported == 0) && (ch->chunk_type == SCTP_IFORWARD_CUM_TSN))) { + if (ch->chunk_type == SCTP_FORWARD_CUM_TSN) { + SCTP_SNPRINTF(msg, sizeof(msg), "%s", "FORWARD-TSN chunk received when I-FORWARD-TSN was negotiated"); + } else { + SCTP_SNPRINTF(msg, sizeof(msg), "%s", "I-FORWARD-TSN chunk received when FORWARD-TSN was negotiated"); + } + op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); + sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); + *offset = length; + return (NULL); } *fwd_tsn_seen = 1; if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) { From owner-svn-src-stable-12@freebsd.org Mon Aug 24 08:41:22 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D67B43B5A24; Mon, 24 Aug 2020 08:41: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZlw25RRKz4NT8; Mon, 24 Aug 2020 08:41: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 9E31615B74; Mon, 24 Aug 2020 08:41: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 07O8fMax081305; Mon, 24 Aug 2020 08:41:22 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O8fM5e081304; Mon, 24 Aug 2020 08:41:22 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240841.07O8fM5e081304@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 08:41:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364630 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364630 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 08:41:22 -0000 Author: tuexen Date: Mon Aug 24 08:41:22 2020 New Revision: 364630 URL: https://svnweb.freebsd.org/changeset/base/364630 Log: MFC r363011: Fix error description. Modified: stable/12/sys/netinet/sctp_indata.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_indata.c ============================================================================== --- stable/12/sys/netinet/sctp_indata.c Mon Aug 24 08:40:10 2020 (r364629) +++ stable/12/sys/netinet/sctp_indata.c Mon Aug 24 08:41:22 2020 (r364630) @@ -2745,7 +2745,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *o struct mbuf *op_err; char msg[SCTP_DIAG_INFO_LEN]; - SCTP_SNPRINTF(msg, sizeof(msg), "%s", "I-DATA chunk received when DATA was negotiated"); + SCTP_SNPRINTF(msg, sizeof(msg), "%s", "DATA chunk received when I-DATA was negotiated"); 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); @@ -2756,7 +2756,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *o struct mbuf *op_err; char msg[SCTP_DIAG_INFO_LEN]; - SCTP_SNPRINTF(msg, sizeof(msg), "%s", "DATA chunk received when I-DATA was negotiated"); + SCTP_SNPRINTF(msg, sizeof(msg), "%s", "I-DATA chunk received when DATA was negotiated"); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_21; sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); From owner-svn-src-stable-12@freebsd.org Mon Aug 24 08:57:28 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 90B723B682F; Mon, 24 Aug 2020 08: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZmGc3G5sz4QGb; Mon, 24 Aug 2020 08: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 5356A15DBB; Mon, 24 Aug 2020 08: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 07O8vSt2090767; Mon, 24 Aug 2020 08:57:28 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O8vSZX090766; Mon, 24 Aug 2020 08:57:28 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240857.07O8vSZX090766@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 08:57:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364634 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364634 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 08:57:28 -0000 Author: tuexen Date: Mon Aug 24 08:57:27 2020 New Revision: 364634 URL: https://svnweb.freebsd.org/changeset/base/364634 Log: MFC r363012: Improve consistency. Modified: stable/12/sys/netinet/sctp_input.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_input.c ============================================================================== --- stable/12/sys/netinet/sctp_input.c Mon Aug 24 08:57:02 2020 (r364633) +++ stable/12/sys/netinet/sctp_input.c Mon Aug 24 08:57:27 2020 (r364634) @@ -5103,8 +5103,8 @@ process_control_chunks: if (stcb->asoc.prsctp_supported == 0) { goto unknown_chunk; } - if (((asoc->idata_supported == 1) && (ch->chunk_type == SCTP_FORWARD_CUM_TSN)) || - ((asoc->idata_supported == 0) && (ch->chunk_type == SCTP_IFORWARD_CUM_TSN))) { + if (((stcb->asoc.idata_supported == 1) && (ch->chunk_type == SCTP_FORWARD_CUM_TSN)) || + ((stcb->asoc.idata_supported == 0) && (ch->chunk_type == SCTP_IFORWARD_CUM_TSN))) { if (ch->chunk_type == SCTP_FORWARD_CUM_TSN) { SCTP_SNPRINTF(msg, sizeof(msg), "%s", "FORWARD-TSN chunk received when I-FORWARD-TSN was negotiated"); } else { From owner-svn-src-stable-12@freebsd.org Mon Aug 24 08:58:46 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 487273B676A; Mon, 24 Aug 2020 08:58: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZmJ60tFxz4QMw; Mon, 24 Aug 2020 08:58:46 +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 01B231608E; Mon, 24 Aug 2020 08:58:46 +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 07O8wj3U090882; Mon, 24 Aug 2020 08:58:45 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O8wjPr090881; Mon, 24 Aug 2020 08:58:45 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240858.07O8wjPr090881@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 08:58:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364635 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364635 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 08:58:46 -0000 Author: tuexen Date: Mon Aug 24 08:58:45 2020 New Revision: 364635 URL: https://svnweb.freebsd.org/changeset/base/364635 Log: MFC r363046: Optimize flushing of receive queues. This addresses an issue found and reported for the userland stack in https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=21243 Modified: stable/12/sys/netinet/sctp_indata.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_indata.c ============================================================================== --- stable/12/sys/netinet/sctp_indata.c Mon Aug 24 08:57:27 2020 (r364634) +++ stable/12/sys/netinet/sctp_indata.c Mon Aug 24 08:58:45 2020 (r364635) @@ -5411,11 +5411,9 @@ sctp_kick_prsctp_reorder_queue(struct sctp_tcb *stcb, static void sctp_flush_reassm_for_str_seq(struct sctp_tcb *stcb, - struct sctp_association *asoc, - uint16_t stream, uint32_t mid, int ordered, uint32_t cumtsn) + struct sctp_association *asoc, struct sctp_stream_in *strm, + struct sctp_queued_to_read *control, int ordered, uint32_t cumtsn) { - struct sctp_queued_to_read *control; - struct sctp_stream_in *strm; struct sctp_tmit_chunk *chk, *nchk; int cnt_removed = 0; @@ -5427,12 +5425,6 @@ sctp_flush_reassm_for_str_seq(struct sctp_tcb *stcb, * it can be delivered... But for now we just dump everything on the * queue. */ - strm = &asoc->strmin[stream]; - control = sctp_find_reasm_entry(strm, mid, ordered, asoc->idata_supported); - if (control == NULL) { - /* Not found */ - return; - } if (!asoc->idata_supported && !ordered && SCTP_TSN_GT(control->fsn_included, cumtsn)) { return; } @@ -5609,7 +5601,10 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb, /* Flush all the un-ordered data based on cum-tsn */ SCTP_INP_READ_LOCK(stcb->sctp_ep); for (sid = 0; sid < asoc->streamincnt; sid++) { - sctp_flush_reassm_for_str_seq(stcb, asoc, sid, 0, 0, new_cum_tsn); + strm = &asoc->strmin[sid]; + if (!TAILQ_EMPTY(&strm->uno_inqueue)) { + sctp_flush_reassm_for_str_seq(stcb, asoc, strm, TAILQ_FIRST(&strm->uno_inqueue), 0, new_cum_tsn); + } } SCTP_INP_READ_UNLOCK(stcb->sctp_ep); } @@ -5621,7 +5616,7 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb, if (m && fwd_sz) { /* New method. */ unsigned int num_str; - uint32_t mid, cur_mid; + uint32_t mid; uint16_t sid; uint16_t ordered, flags; struct sctp_strseq *stseq, strseqbuf; @@ -5688,8 +5683,24 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb, asoc->fragmented_delivery_inprogress = 0; } strm = &asoc->strmin[sid]; - 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); + if (ordered) { + TAILQ_FOREACH(control, &strm->inqueue, next_instrm) { + if (SCTP_MID_GE(asoc->idata_supported, mid, control->mid)) { + sctp_flush_reassm_for_str_seq(stcb, asoc, strm, control, ordered, new_cum_tsn); + } + } + } else { + if (asoc->idata_supported) { + TAILQ_FOREACH(control, &strm->uno_inqueue, next_instrm) { + if (SCTP_MID_GE(asoc->idata_supported, mid, control->mid)) { + sctp_flush_reassm_for_str_seq(stcb, asoc, strm, control, ordered, new_cum_tsn); + } + } + } else { + if (!TAILQ_EMPTY(&strm->uno_inqueue)) { + sctp_flush_reassm_for_str_seq(stcb, asoc, strm, TAILQ_FIRST(&strm->uno_inqueue), ordered, new_cum_tsn); + } + } } TAILQ_FOREACH(control, &stcb->sctp_ep->read_queue, next) { if ((control->sinfo_stream == sid) && From owner-svn-src-stable-12@freebsd.org Mon Aug 24 09:00:07 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D4A003B6B0E; Mon, 24 Aug 2020 09:00: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZmKg5Lkhz4QYh; Mon, 24 Aug 2020 09:00: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 9B06D16060; Mon, 24 Aug 2020 09:00: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 07O907di091070; Mon, 24 Aug 2020 09:00:07 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O907e3091069; Mon, 24 Aug 2020 09:00:07 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240900.07O907e3091069@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 09:00:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364636 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364636 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 09:00:07 -0000 Author: tuexen Date: Mon Aug 24 09:00:07 2020 New Revision: 364636 URL: https://svnweb.freebsd.org/changeset/base/364636 Log: MFC r363076: Fix a use-after-free bug for the userland stack. The kernel stack is not affected. Thanks to Mark Wodrich from Google for finding and reporting the bug. Modified: stable/12/sys/netinet/sctp_indata.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_indata.c ============================================================================== --- stable/12/sys/netinet/sctp_indata.c Mon Aug 24 08:58:45 2020 (r364635) +++ stable/12/sys/netinet/sctp_indata.c Mon Aug 24 09:00:07 2020 (r364636) @@ -1700,6 +1700,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struc int *break_flag, int last_chunk, uint8_t chk_type) { struct sctp_tmit_chunk *chk = NULL; /* make gcc happy */ + struct sctp_stream_in *strm; uint32_t tsn, fsn, gap, mid; struct mbuf *dmbuf; int the_len; @@ -2327,12 +2328,13 @@ finish_express_del: /* All can be removed */ TAILQ_FOREACH_SAFE(control, &asoc->pending_reply_queue, next, ncontrol) { TAILQ_REMOVE(&asoc->pending_reply_queue, control, next); + strm = &asoc->strmin[control->sinfo_stream]; 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[control->sinfo_stream], SCTP_READ_LOCK_NOT_HELD); + (void)sctp_deliver_reasm_check(stcb, asoc, strm, SCTP_READ_LOCK_NOT_HELD); need_reasm_check = 0; } } @@ -2347,12 +2349,13 @@ finish_express_del: * control->sinfo_tsn > liste->tsn */ TAILQ_REMOVE(&asoc->pending_reply_queue, control, next); + strm = &asoc->strmin[control->sinfo_stream]; 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[control->sinfo_stream], SCTP_READ_LOCK_NOT_HELD); + (void)sctp_deliver_reasm_check(stcb, asoc, strm, SCTP_READ_LOCK_NOT_HELD); need_reasm_check = 0; } } From owner-svn-src-stable-12@freebsd.org Mon Aug 24 09:06:47 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B91603B7016; Mon, 24 Aug 2020 09:06: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZmTM4RnZz4R2F; Mon, 24 Aug 2020 09:06: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 7C0011622D; Mon, 24 Aug 2020 09:06: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 07O96lBC096824; Mon, 24 Aug 2020 09:06:47 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O96l0x096822; Mon, 24 Aug 2020 09:06:47 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240906.07O96l0x096822@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 09:06:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364638 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364638 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 09:06:47 -0000 Author: tuexen Date: Mon Aug 24 09:06:46 2020 New Revision: 364638 URL: https://svnweb.freebsd.org/changeset/base/364638 Log: MFC r363194: Improve the error handling in generating ASCONF chunks. In case of errors, the cleanup was not consistent. Thanks to Felix Weinrank for fuzzing the userland stack and making me aware of the issue. Modified: stable/12/sys/netinet/sctp_asconf.c stable/12/sys/netinet/sctp_input.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_asconf.c ============================================================================== --- stable/12/sys/netinet/sctp_asconf.c Mon Aug 24 09:00:57 2020 (r364637) +++ stable/12/sys/netinet/sctp_asconf.c Mon Aug 24 09:06:46 2020 (r364638) @@ -2600,14 +2600,14 @@ sctp_compose_asconf(struct sctp_tcb *stcb, int *retlen if (m_asconf_chk == NULL) { /* no mbuf's */ SCTPDBG(SCTP_DEBUG_ASCONF1, - "compose_asconf: couldn't get chunk mbuf!\n"); + "sctp_compose_asconf: couldn't get chunk mbuf!\n"); return (NULL); } m_asconf = sctp_get_mbuf_for_msg(MCLBYTES, 0, M_NOWAIT, 1, MT_DATA); if (m_asconf == NULL) { /* no mbuf's */ SCTPDBG(SCTP_DEBUG_ASCONF1, - "compose_asconf: couldn't get mbuf!\n"); + "sctp_compose_asconf: couldn't get mbuf!\n"); sctp_m_freem(m_asconf_chk); return (NULL); } @@ -2732,10 +2732,12 @@ sctp_compose_asconf(struct sctp_tcb *stcb, int *retlen break; #endif default: - p_size = 0; - addr_size = 0; - addr_ptr = NULL; - break; + SCTPDBG(SCTP_DEBUG_ASCONF1, + "sctp_compose_asconf: no usable lookup addr (family = %d)!\n", + found_addr->sa_family); + sctp_m_freem(m_asconf_chk); + sctp_m_freem(m_asconf); + return (NULL); } lookup->ph.param_length = htons(SCTP_SIZE32(p_size)); memcpy(lookup->addr, addr_ptr, addr_size); @@ -2743,12 +2745,10 @@ sctp_compose_asconf(struct sctp_tcb *stcb, int *retlen } else { /* uh oh... don't have any address?? */ SCTPDBG(SCTP_DEBUG_ASCONF1, - "compose_asconf: no lookup addr!\n"); - /* 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))); - memset(lookup->addr, 0, sizeof(struct in_addr)); - SCTP_BUF_LEN(m_asconf_chk) += SCTP_SIZE32(sizeof(struct sctp_ipv4addr_param)); + "sctp_compose_asconf: no lookup addr!\n"); + sctp_m_freem(m_asconf_chk); + sctp_m_freem(m_asconf); + return (NULL); } } /* chain it all together */ @@ -3274,10 +3274,9 @@ sctp_addr_mgmt_ep_sa(struct sctp_inpcb *inp, struct so } void -sctp_asconf_send_nat_state_update(struct sctp_tcb *stcb, - struct sctp_nets *net) +sctp_asconf_send_nat_state_update(struct sctp_tcb *stcb, struct sctp_nets *net) { - struct sctp_asconf_addr *aa; + struct sctp_asconf_addr *aa_vtag, *aa_add, *aa_del; struct sctp_ifa *sctp_ifap; struct sctp_asconf_tag_param *vtag; #ifdef INET @@ -3286,6 +3285,7 @@ sctp_asconf_send_nat_state_update(struct sctp_tcb *stc #ifdef INET6 struct sockaddr_in6 *to6; #endif + if (net == NULL) { SCTPDBG(SCTP_DEBUG_ASCONF1, "sctp_asconf_send_nat_state_update: Missing net\n"); return; @@ -3295,105 +3295,81 @@ sctp_asconf_send_nat_state_update(struct sctp_tcb *stc return; } /* - * Need to have in the asconf: - vtagparam(my_vtag/peer_vtag) - - * add(0.0.0.0) - del(0.0.0.0) - Any global addresses add(addr) + * Need to have in the ASCONF: - VTAG(my_vtag/peer_vtag) - + * ADD(wildcard) - DEL(wildcard) - ADD(Any global addresses) */ - SCTP_MALLOC(aa, struct sctp_asconf_addr *, sizeof(*aa), - SCTP_M_ASC_ADDR); - if (aa == NULL) { - /* didn't get memory */ - SCTPDBG(SCTP_DEBUG_ASCONF1, - "sctp_asconf_send_nat_state_update: failed to get memory!\n"); + SCTP_MALLOC(aa_vtag, struct sctp_asconf_addr *, sizeof(struct sctp_asconf_addr), SCTP_M_ASC_ADDR); + SCTP_MALLOC(aa_add, struct sctp_asconf_addr *, sizeof(struct sctp_asconf_addr), SCTP_M_ASC_ADDR); + SCTP_MALLOC(aa_del, struct sctp_asconf_addr *, sizeof(struct sctp_asconf_addr), SCTP_M_ASC_ADDR); + + if ((aa_vtag == NULL) || (aa_add == NULL) || (aa_del == NULL)) { + /* Didn't get memory */ + SCTPDBG(SCTP_DEBUG_ASCONF1, "sctp_asconf_send_nat_state_update: failed to get memory!\n"); +out: + if (aa_vtag != NULL) { + SCTP_FREE(aa_vtag, SCTP_M_ASC_ADDR); + } + if (aa_add != NULL) { + SCTP_FREE(aa_add, SCTP_M_ASC_ADDR); + } + if (aa_del != NULL) { + SCTP_FREE(aa_del, SCTP_M_ASC_ADDR); + } return; } - aa->special_del = 0; - /* fill in asconf address parameter fields */ - /* top level elements are "networked" during send */ - aa->ifa = NULL; - aa->sent = 0; /* clear sent flag */ - vtag = (struct sctp_asconf_tag_param *)&aa->ap.aph; + memset(aa_vtag, 0, sizeof(struct sctp_asconf_addr)); + aa_vtag->special_del = 0; + /* Fill in ASCONF address parameter fields. */ + /* Top level elements are "networked" during send. */ + aa_vtag->ifa = NULL; + aa_vtag->sent = 0; /* clear sent flag */ + vtag = (struct sctp_asconf_tag_param *)&aa_vtag->ap.aph; vtag->aph.ph.param_type = SCTP_NAT_VTAGS; vtag->aph.ph.param_length = sizeof(struct sctp_asconf_tag_param); vtag->local_vtag = htonl(stcb->asoc.my_vtag); vtag->remote_vtag = htonl(stcb->asoc.peer_vtag); - TAILQ_INSERT_TAIL(&stcb->asoc.asconf_queue, aa, next); - SCTP_MALLOC(aa, struct sctp_asconf_addr *, sizeof(*aa), - SCTP_M_ASC_ADDR); - if (aa == NULL) { - /* didn't get memory */ - SCTPDBG(SCTP_DEBUG_ASCONF1, - "sctp_asconf_send_nat_state_update: failed to get memory!\n"); - return; - } - memset(aa, 0, sizeof(struct sctp_asconf_addr)); - /* fill in asconf address parameter fields */ - /* ADD(0.0.0.0) */ + memset(aa_add, 0, sizeof(struct sctp_asconf_addr)); + memset(aa_del, 0, sizeof(struct sctp_asconf_addr)); switch (net->ro._l_addr.sa.sa_family) { #ifdef INET case AF_INET: - aa->ap.aph.ph.param_type = SCTP_ADD_IP_ADDRESS; - aa->ap.aph.ph.param_length = sizeof(struct sctp_asconf_addrv4_param); - aa->ap.addrp.ph.param_type = SCTP_IPV4_ADDRESS; - aa->ap.addrp.ph.param_length = sizeof(struct sctp_ipv4addr_param); - /* No need to add an address, we are using 0.0.0.0 */ - TAILQ_INSERT_TAIL(&stcb->asoc.asconf_queue, aa, next); + aa_add->ap.aph.ph.param_type = SCTP_ADD_IP_ADDRESS; + aa_add->ap.aph.ph.param_length = sizeof(struct sctp_asconf_addrv4_param); + aa_add->ap.addrp.ph.param_type = SCTP_IPV4_ADDRESS; + aa_add->ap.addrp.ph.param_length = sizeof(struct sctp_ipv4addr_param); + /* No need to fill the address, we are using 0.0.0.0 */ + aa_del->ap.aph.ph.param_type = SCTP_ADD_IP_ADDRESS; + aa_del->ap.aph.ph.param_length = sizeof(struct sctp_asconf_addrv4_param); + aa_del->ap.addrp.ph.param_type = SCTP_IPV4_ADDRESS; + aa_del->ap.addrp.ph.param_length = sizeof(struct sctp_ipv4addr_param); + /* No need to fill the address, we are using 0.0.0.0 */ break; #endif #ifdef INET6 case AF_INET6: - aa->ap.aph.ph.param_type = SCTP_ADD_IP_ADDRESS; - aa->ap.aph.ph.param_length = sizeof(struct sctp_asconf_addr_param); - aa->ap.addrp.ph.param_type = SCTP_IPV6_ADDRESS; - aa->ap.addrp.ph.param_length = sizeof(struct sctp_ipv6addr_param); - /* No need to add an address, we are using 0.0.0.0 */ - TAILQ_INSERT_TAIL(&stcb->asoc.asconf_queue, aa, next); + aa_add->ap.aph.ph.param_type = SCTP_ADD_IP_ADDRESS; + aa_add->ap.aph.ph.param_length = sizeof(struct sctp_asconf_addr_param); + aa_add->ap.addrp.ph.param_type = SCTP_IPV6_ADDRESS; + aa_add->ap.addrp.ph.param_length = sizeof(struct sctp_ipv6addr_param); + /* No need to fill the address, we are using ::0 */ + aa_del->ap.aph.ph.param_type = SCTP_DEL_IP_ADDRESS; + aa_del->ap.aph.ph.param_length = sizeof(struct sctp_asconf_addr_param); + aa_del->ap.addrp.ph.param_type = SCTP_IPV6_ADDRESS; + aa_del->ap.addrp.ph.param_length = sizeof(struct sctp_ipv6addr_param); + /* No need to fill the address, we are using ::0 */ break; #endif default: SCTPDBG(SCTP_DEBUG_ASCONF1, - "sctp_asconf_send_nat_state_update: unknown address family\n"); - SCTP_FREE(aa, SCTP_M_ASC_ADDR); - return; + "sctp_asconf_send_nat_state_update: unknown address family %d\n", + net->ro._l_addr.sa.sa_family); + goto out; } - SCTP_MALLOC(aa, struct sctp_asconf_addr *, sizeof(*aa), - SCTP_M_ASC_ADDR); - if (aa == NULL) { - /* didn't get memory */ - SCTPDBG(SCTP_DEBUG_ASCONF1, - "sctp_asconf_send_nat_state_update: failed to get memory!\n"); - return; - } - memset(aa, 0, sizeof(struct sctp_asconf_addr)); - /* fill in asconf address parameter fields */ - /* ADD(0.0.0.0) */ - switch (net->ro._l_addr.sa.sa_family) { -#ifdef INET - case AF_INET: - aa->ap.aph.ph.param_type = SCTP_ADD_IP_ADDRESS; - aa->ap.aph.ph.param_length = sizeof(struct sctp_asconf_addrv4_param); - aa->ap.addrp.ph.param_type = SCTP_IPV4_ADDRESS; - aa->ap.addrp.ph.param_length = sizeof(struct sctp_ipv4addr_param); - /* No need to add an address, we are using 0.0.0.0 */ - TAILQ_INSERT_TAIL(&stcb->asoc.asconf_queue, aa, next); - break; -#endif -#ifdef INET6 - case AF_INET6: - aa->ap.aph.ph.param_type = SCTP_DEL_IP_ADDRESS; - aa->ap.aph.ph.param_length = sizeof(struct sctp_asconf_addr_param); - aa->ap.addrp.ph.param_type = SCTP_IPV6_ADDRESS; - aa->ap.addrp.ph.param_length = sizeof(struct sctp_ipv6addr_param); - /* No need to add an address, we are using 0.0.0.0 */ - TAILQ_INSERT_TAIL(&stcb->asoc.asconf_queue, aa, next); - break; -#endif - default: - SCTPDBG(SCTP_DEBUG_ASCONF1, - "sctp_asconf_send_nat_state_update: unknown address family\n"); - SCTP_FREE(aa, SCTP_M_ASC_ADDR); - return; - } + TAILQ_INSERT_TAIL(&stcb->asoc.asconf_queue, aa_vtag, next); + TAILQ_INSERT_TAIL(&stcb->asoc.asconf_queue, aa_add, next); + TAILQ_INSERT_TAIL(&stcb->asoc.asconf_queue, aa_del, next); + /* Now we must hunt the addresses and add all global addresses */ if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) { struct sctp_vrf *vrf = NULL; Modified: stable/12/sys/netinet/sctp_input.c ============================================================================== --- stable/12/sys/netinet/sctp_input.c Mon Aug 24 09:00:57 2020 (r364637) +++ stable/12/sys/netinet/sctp_input.c Mon Aug 24 09:06:46 2020 (r364638) @@ -800,13 +800,13 @@ sctp_handle_abort(struct sctp_abort_chunk *abort, 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", + SCTPDBG(SCTP_DEBUG_INPUT2, "Received Colliding state, ABORT flags:%x\n", abort->ch.chunk_flags); if (sctp_handle_nat_colliding_state(stcb)) { return (0); } } else if (error == 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", abort->ch.chunk_flags); if (sctp_handle_nat_missing_state(stcb, net)) { return (0); @@ -1146,14 +1146,14 @@ sctp_handle_error(struct sctp_chunkhdr *ch, 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, ERROR 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, ERROR flags: %x\n", ch->chunk_flags); if (sctp_handle_nat_missing_state(stcb, net)) { return (0); From owner-svn-src-stable-12@freebsd.org Mon Aug 24 09:10:20 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CF5623B7117; Mon, 24 Aug 2020 09:10:20 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZmYS4fTlz4RP7; Mon, 24 Aug 2020 09:10:20 +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 83FF61622E; Mon, 24 Aug 2020 09:10:20 +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 07O9AK7c097088; Mon, 24 Aug 2020 09:10:20 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O9AJ6n097082; Mon, 24 Aug 2020 09:10:19 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240910.07O9AJ6n097082@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 09:10:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364639 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364639 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 09:10:20 -0000 Author: tuexen Date: Mon Aug 24 09:10:19 2020 New Revision: 364639 URL: https://svnweb.freebsd.org/changeset/base/364639 Log: MFC r363275: Improve the locking of address lists by adding some asserts and rearranging the addition of address such that the lock is not given up during checking and adding. Modified: stable/12/sys/netinet/sctp_lock_bsd.h stable/12/sys/netinet/sctp_pcb.c stable/12/sys/netinet/sctp_usrreq.c stable/12/sys/netinet/sctputil.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_lock_bsd.h ============================================================================== --- stable/12/sys/netinet/sctp_lock_bsd.h Mon Aug 24 09:06:46 2020 (r364638) +++ stable/12/sys/netinet/sctp_lock_bsd.h Mon Aug 24 09:10:19 2020 (r364639) @@ -177,6 +177,13 @@ __FBSDID("$FreeBSD$"); rw_wunlock(&SCTP_BASE_INFO(ipi_addr_mtx)); \ } while (0) +#define SCTP_IPI_ADDR_LOCK_ASSERT() do { \ + rw_assert(&SCTP_BASE_INFO(ipi_addr_mtx), RA_LOCKED); \ +} while (0) + +#define SCTP_IPI_ADDR_WLOCK_ASSERT() do { \ + rw_assert(&SCTP_BASE_INFO(ipi_addr_mtx), RA_WLOCKED); \ +} while (0) #define SCTP_IPI_ITERATOR_WQ_INIT() do { \ mtx_init(&sctp_it_ctl.ipi_iterator_wq_mtx, "sctp-it-wq", \ Modified: stable/12/sys/netinet/sctp_pcb.c ============================================================================== --- stable/12/sys/netinet/sctp_pcb.c Mon Aug 24 09:06:46 2020 (r364638) +++ stable/12/sys/netinet/sctp_pcb.c Mon Aug 24 09:10:19 2020 (r364639) @@ -200,6 +200,7 @@ sctp_find_ifn(void *ifn, uint32_t ifn_index) * We assume the lock is held for the addresses if that's wrong * problems could occur :-) */ + SCTP_IPI_ADDR_LOCK_ASSERT(); hash_ifn_head = &SCTP_BASE_INFO(vrf_ifn_hash)[(ifn_index & SCTP_BASE_INFO(vrf_ifn_hashmark))]; LIST_FOREACH(sctp_ifnp, hash_ifn_head, next_bucket) { if (sctp_ifnp->ifn_index == ifn_index) { @@ -295,12 +296,16 @@ sctp_delete_ifn(struct sctp_ifn *sctp_ifnp, int hold_a /* Not in the list.. sorry */ return; } - if (hold_addr_lock == 0) + if (hold_addr_lock == 0) { SCTP_IPI_ADDR_WLOCK(); + } else { + SCTP_IPI_ADDR_WLOCK_ASSERT(); + } LIST_REMOVE(sctp_ifnp, next_bucket); LIST_REMOVE(sctp_ifnp, next_ifn); - if (hold_addr_lock == 0) + if (hold_addr_lock == 0) { SCTP_IPI_ADDR_WUNLOCK(); + } /* Take away the reference, and possibly free it */ sctp_free_ifn(sctp_ifnp); } @@ -486,8 +491,8 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint3 int dynamic_add) { struct sctp_vrf *vrf; - struct sctp_ifn *sctp_ifnp = NULL; - struct sctp_ifa *sctp_ifap = NULL; + struct sctp_ifn *sctp_ifnp, *new_sctp_ifnp; + struct sctp_ifa *sctp_ifap, *new_sctp_ifap; struct sctp_ifalist *hash_addr_head; struct sctp_ifnlist *hash_ifn_head; uint32_t hash_of_addr; @@ -497,6 +502,23 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint3 SCTPDBG(SCTP_DEBUG_PCB4, "vrf_id 0x%x: adding address: ", vrf_id); SCTPDBG_ADDR(SCTP_DEBUG_PCB4, addr); #endif + SCTP_MALLOC(new_sctp_ifnp, struct sctp_ifn *, + sizeof(struct sctp_ifn), SCTP_M_IFN); + if (new_sctp_ifnp == NULL) { +#ifdef INVARIANTS + panic("No memory for IFN"); +#endif + return (NULL); + } + SCTP_MALLOC(new_sctp_ifap, struct sctp_ifa *, sizeof(struct sctp_ifa), SCTP_M_IFA); + if (new_sctp_ifap == NULL) { +#ifdef INVARIANTS + panic("No memory for IFA"); +#endif + SCTP_FREE(new_sctp_ifnp, SCTP_M_IFN); + return (NULL); + } + SCTP_IPI_ADDR_WLOCK(); sctp_ifnp = sctp_find_ifn(ifn, ifn_index); if (sctp_ifnp) { @@ -507,6 +529,8 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint3 vrf = sctp_allocate_vrf(vrf_id); if (vrf == NULL) { SCTP_IPI_ADDR_WUNLOCK(); + SCTP_FREE(new_sctp_ifnp, SCTP_M_IFN); + SCTP_FREE(new_sctp_ifap, SCTP_M_IFA); return (NULL); } } @@ -516,15 +540,8 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint3 * build one and add it, can't hold lock until after malloc * done though. */ - SCTP_IPI_ADDR_WUNLOCK(); - SCTP_MALLOC(sctp_ifnp, struct sctp_ifn *, - sizeof(struct sctp_ifn), SCTP_M_IFN); - if (sctp_ifnp == NULL) { -#ifdef INVARIANTS - panic("No memory for IFN"); -#endif - return (NULL); - } + sctp_ifnp = new_sctp_ifnp; + new_sctp_ifnp = NULL; memset(sctp_ifnp, 0, sizeof(struct sctp_ifn)); sctp_ifnp->ifn_index = ifn_index; sctp_ifnp->ifn_p = ifn; @@ -540,7 +557,6 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint3 } hash_ifn_head = &SCTP_BASE_INFO(vrf_ifn_hash)[(ifn_index & SCTP_BASE_INFO(vrf_ifn_hashmark))]; LIST_INIT(&sctp_ifnp->ifalist); - SCTP_IPI_ADDR_WLOCK(); LIST_INSERT_HEAD(hash_ifn_head, sctp_ifnp, next_bucket); LIST_INSERT_HEAD(&vrf->ifnlist, sctp_ifnp, next_ifn); atomic_add_int(&SCTP_BASE_INFO(ipi_count_ifns), 1); @@ -567,6 +583,10 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint3 } exit_stage_left: SCTP_IPI_ADDR_WUNLOCK(); + if (new_sctp_ifnp != NULL) { + SCTP_FREE(new_sctp_ifnp, SCTP_M_IFN); + } + SCTP_FREE(new_sctp_ifap, SCTP_M_IFA); return (sctp_ifap); } else { if (sctp_ifap->ifn_p) { @@ -593,14 +613,7 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint3 goto exit_stage_left; } } - SCTP_IPI_ADDR_WUNLOCK(); - SCTP_MALLOC(sctp_ifap, struct sctp_ifa *, sizeof(struct sctp_ifa), SCTP_M_IFA); - if (sctp_ifap == NULL) { -#ifdef INVARIANTS - panic("No memory for IFA"); -#endif - return (NULL); - } + sctp_ifap = new_sctp_ifap; memset(sctp_ifap, 0, sizeof(struct sctp_ifa)); sctp_ifap->ifn_p = sctp_ifnp; atomic_add_int(&sctp_ifnp->refcount, 1); @@ -660,7 +673,6 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint3 (sctp_ifap->src_is_loop == 0)) { sctp_ifap->src_is_glob = 1; } - SCTP_IPI_ADDR_WLOCK(); hash_addr_head = &vrf->vrf_addr_hash[(hash_of_addr & vrf->vrf_addr_hashmark)]; LIST_INSERT_HEAD(hash_addr_head, sctp_ifap, next_bucket); sctp_ifap->refcount = 1; @@ -672,6 +684,10 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint3 sctp_ifnp->registered_af = new_ifn_af; } SCTP_IPI_ADDR_WUNLOCK(); + if (new_sctp_ifnp != NULL) { + SCTP_FREE(new_sctp_ifnp, SCTP_M_IFN); + } + if (dynamic_add) { /* * Bump up the refcount so that when the timer completes it @@ -5921,6 +5937,7 @@ retry: * free the vrf/ifn/ifa lists and hashes (be sure address monitor is * destroyed first). */ + SCTP_IPI_ADDR_WLOCK(); vrf_bucket = &SCTP_BASE_INFO(sctp_vrfhash)[(SCTP_DEFAULT_VRFID & SCTP_BASE_INFO(hashvrfmark))]; LIST_FOREACH_SAFE(vrf, vrf_bucket, next_vrf, nvrf) { LIST_FOREACH_SAFE(ifn, &vrf->ifnlist, next_ifn, nifn) { @@ -5940,6 +5957,7 @@ retry: LIST_REMOVE(vrf, next_vrf); SCTP_FREE(vrf, SCTP_M_VRF); } + SCTP_IPI_ADDR_WUNLOCK(); /* free the vrf hashes */ SCTP_HASH_FREE(SCTP_BASE_INFO(sctp_vrfhash), SCTP_BASE_INFO(hashvrfmark)); SCTP_HASH_FREE(SCTP_BASE_INFO(vrf_ifn_hash), SCTP_BASE_INFO(vrf_ifn_hashmark)); Modified: stable/12/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/12/sys/netinet/sctp_usrreq.c Mon Aug 24 09:06:46 2020 (r364638) +++ stable/12/sys/netinet/sctp_usrreq.c Mon Aug 24 09:10:19 2020 (r364639) @@ -984,9 +984,6 @@ sctp_fill_user_address(struct sockaddr *dst, struct so -/* - * NOTE: assumes addr lock is held - */ static size_t sctp_fill_up_addresses_vrf(struct sctp_inpcb *inp, struct sctp_tcb *stcb, @@ -1006,6 +1003,7 @@ sctp_fill_up_addresses_vrf(struct sctp_inpcb *inp, #endif struct sctp_vrf *vrf; + SCTP_IPI_ADDR_LOCK_ASSERT(); actual = 0; if (limit == 0) return (actual); @@ -1238,9 +1236,6 @@ sctp_fill_up_addresses(struct sctp_inpcb *inp, return (size); } -/* - * NOTE: assumes addr lock is held - */ static int sctp_count_max_addresses_vrf(struct sctp_inpcb *inp, uint32_t vrf_id) { @@ -1254,6 +1249,7 @@ sctp_count_max_addresses_vrf(struct sctp_inpcb *inp, u * bound-all case a TCB may NOT include the loopback or other * addresses as well. */ + SCTP_IPI_ADDR_LOCK_ASSERT(); vrf = sctp_find_vrf(vrf_id); if (vrf == NULL) { return (0); Modified: stable/12/sys/netinet/sctputil.c ============================================================================== --- stable/12/sys/netinet/sctputil.c Mon Aug 24 09:06:46 2020 (r364638) +++ stable/12/sys/netinet/sctputil.c Mon Aug 24 09:10:19 2020 (r364639) @@ -5287,8 +5287,11 @@ sctp_find_ifa_by_addr(struct sockaddr *addr, uint32_t struct sctp_ifalist *hash_head; uint32_t hash_of_addr; - if (holds_lock == 0) + if (holds_lock == 0) { SCTP_IPI_ADDR_RLOCK(); + } else { + SCTP_IPI_ADDR_LOCK_ASSERT(); + } vrf = sctp_find_vrf(vrf_id); if (vrf == NULL) { @@ -6417,7 +6420,7 @@ sctp_dynamic_set_primary(struct sockaddr *sa, uint32_t struct sctp_ifa *ifa; struct sctp_laddr *wi; - ifa = sctp_find_ifa_by_addr(sa, vrf_id, 0); + ifa = sctp_find_ifa_by_addr(sa, vrf_id, SCTP_ADDR_NOT_LOCKED); if (ifa == NULL) { SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTPUTIL, EADDRNOTAVAIL); return (EADDRNOTAVAIL); From owner-svn-src-stable-12@freebsd.org Mon Aug 24 09:11:38 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5CFD23B71D3; Mon, 24 Aug 2020 09:11: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZmZy1rJzz4RcM; Mon, 24 Aug 2020 09:11: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 223A01641A; Mon, 24 Aug 2020 09:11: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 07O9BcB4098929; Mon, 24 Aug 2020 09:11:38 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O9BbAw098928; Mon, 24 Aug 2020 09:11:37 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240911.07O9BbAw098928@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 09:11:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364640 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364640 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 09:11:38 -0000 Author: tuexen Date: Mon Aug 24 09:11:37 2020 New Revision: 364640 URL: https://svnweb.freebsd.org/changeset/base/364640 Log: MFC r363309: Remove code which is not needed. Modified: stable/12/sys/netinet/sctp_pcb.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_pcb.c ============================================================================== --- stable/12/sys/netinet/sctp_pcb.c Mon Aug 24 09:10:19 2020 (r364639) +++ stable/12/sys/netinet/sctp_pcb.c Mon Aug 24 09:11:37 2020 (r364640) @@ -3593,9 +3593,6 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, */ if (from != SCTP_CALLED_FROM_INPKILL_TIMER) { (void)SCTP_OS_TIMER_STOP_DRAIN(&inp->sctp_ep.signature_change.timer); - } else { - /* Probably un-needed */ - (void)SCTP_OS_TIMER_STOP(&inp->sctp_ep.signature_change.timer); } #ifdef SCTP_LOG_CLOSING From owner-svn-src-stable-12@freebsd.org Mon Aug 24 09:13:07 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B3B3E3B7507; Mon, 24 Aug 2020 09:13: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZmcg4kc1z4RpT; Mon, 24 Aug 2020 09:13: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 868171654E; Mon, 24 Aug 2020 09:13: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 07O9D7kW003195; Mon, 24 Aug 2020 09:13:07 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O9D60D003191; Mon, 24 Aug 2020 09:13:06 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240913.07O9D60D003191@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 09:13:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364641 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364641 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 09:13:07 -0000 Author: tuexen Date: Mon Aug 24 09:13:06 2020 New Revision: 364641 URL: https://svnweb.freebsd.org/changeset/base/364641 Log: MFC r363323: Add reference counts for inp/stcb/net when timers are running. This avoids a use-after-free reported for the userland stack. Thanks to Taylor Brandstetter for suggesting a patch for the userland stack. Modified: stable/12/sys/netinet/sctp_os_bsd.h stable/12/sys/netinet/sctp_pcb.c stable/12/sys/netinet/sctp_var.h stable/12/sys/netinet/sctputil.c stable/12/sys/netinet/sctputil.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_os_bsd.h ============================================================================== --- stable/12/sys/netinet/sctp_os_bsd.h Mon Aug 24 09:11:37 2020 (r364640) +++ stable/12/sys/netinet/sctp_os_bsd.h Mon Aug 24 09:13:06 2020 (r364641) @@ -266,12 +266,17 @@ typedef struct callout sctp_os_timer_t; #define SCTP_OS_TIMER_INIT(tmr) callout_init(tmr, 1) -#define SCTP_OS_TIMER_START callout_reset -#define SCTP_OS_TIMER_STOP callout_stop -#define SCTP_OS_TIMER_STOP_DRAIN callout_drain -#define SCTP_OS_TIMER_PENDING callout_pending -#define SCTP_OS_TIMER_ACTIVE callout_active -#define SCTP_OS_TIMER_DEACTIVATE callout_deactivate +/* + * NOTE: The next two shouldn't be called directly outside of sctp_timer_start() + * and sctp_timer_stop(), since they don't handle incrementing/decrementing + * relevant reference counts. + */ +#define SCTP_OS_TIMER_START callout_reset +#define SCTP_OS_TIMER_STOP callout_stop +#define SCTP_OS_TIMER_STOP_DRAIN callout_drain +#define SCTP_OS_TIMER_PENDING callout_pending +#define SCTP_OS_TIMER_ACTIVE callout_active +#define SCTP_OS_TIMER_DEACTIVATE callout_deactivate #define sctp_get_tick_count() (ticks) Modified: stable/12/sys/netinet/sctp_pcb.c ============================================================================== --- stable/12/sys/netinet/sctp_pcb.c Mon Aug 24 09:11:37 2020 (r364640) +++ stable/12/sys/netinet/sctp_pcb.c Mon Aug 24 09:13:06 2020 (r364641) @@ -2739,23 +2739,54 @@ sctp_move_pcb_and_assoc(struct sctp_inpcb *old_inp, st } } } - /* - * Now any running timers need to be adjusted since we really don't - * care if they are running or not just blast in the new_inp into - * all of them. - */ - - stcb->asoc.dack_timer.ep = (void *)new_inp; - stcb->asoc.asconf_timer.ep = (void *)new_inp; - stcb->asoc.strreset_timer.ep = (void *)new_inp; - stcb->asoc.shut_guard_timer.ep = (void *)new_inp; - stcb->asoc.autoclose_timer.ep = (void *)new_inp; - stcb->asoc.delete_prim_timer.ep = (void *)new_inp; + /* Now any running timers need to be adjusted. */ + if (stcb->asoc.dack_timer.ep == old_inp) { + SCTP_INP_DECR_REF(old_inp); + stcb->asoc.dack_timer.ep = new_inp; + SCTP_INP_INCR_REF(new_inp); + } + if (stcb->asoc.asconf_timer.ep == old_inp) { + SCTP_INP_DECR_REF(old_inp); + stcb->asoc.asconf_timer.ep = new_inp; + SCTP_INP_INCR_REF(new_inp); + } + if (stcb->asoc.strreset_timer.ep == old_inp) { + SCTP_INP_DECR_REF(old_inp); + stcb->asoc.strreset_timer.ep = new_inp; + SCTP_INP_INCR_REF(new_inp); + } + if (stcb->asoc.shut_guard_timer.ep == old_inp) { + SCTP_INP_DECR_REF(old_inp); + stcb->asoc.shut_guard_timer.ep = new_inp; + SCTP_INP_INCR_REF(new_inp); + } + if (stcb->asoc.autoclose_timer.ep == old_inp) { + SCTP_INP_DECR_REF(old_inp); + stcb->asoc.autoclose_timer.ep = new_inp; + SCTP_INP_INCR_REF(new_inp); + } + if (stcb->asoc.delete_prim_timer.ep == old_inp) { + SCTP_INP_DECR_REF(old_inp); + stcb->asoc.delete_prim_timer.ep = new_inp; + SCTP_INP_INCR_REF(new_inp); + } /* now what about the nets? */ TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { - net->pmtu_timer.ep = (void *)new_inp; - net->hb_timer.ep = (void *)new_inp; - net->rxt_timer.ep = (void *)new_inp; + if (net->pmtu_timer.ep == old_inp) { + SCTP_INP_DECR_REF(old_inp); + net->pmtu_timer.ep = new_inp; + SCTP_INP_INCR_REF(new_inp); + } + if (net->hb_timer.ep == old_inp) { + SCTP_INP_DECR_REF(old_inp); + net->hb_timer.ep = new_inp; + SCTP_INP_INCR_REF(new_inp); + } + if (net->rxt_timer.ep == old_inp) { + SCTP_INP_DECR_REF(old_inp); + net->rxt_timer.ep = new_inp; + SCTP_INP_INCR_REF(new_inp); + } } SCTP_INP_WUNLOCK(new_inp); SCTP_INP_WUNLOCK(old_inp); @@ -3562,7 +3593,7 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, being_refed++; if (SCTP_ASOC_CREATE_LOCK_CONTENDED(inp)) being_refed++; - + /* NOTE: 0 refcount also means no timers are referencing us. */ if ((inp->refcount) || (being_refed) || (inp->sctp_flags & SCTP_PCB_FLAGS_CLOSE_IP)) { @@ -3584,16 +3615,6 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, SCTP_INP_WUNLOCK(inp); SCTP_ASOC_CREATE_UNLOCK(inp); SCTP_INP_INFO_WUNLOCK(); - /* - * Now we release all locks. Since this INP cannot be found anymore - * except possibly by the kill timer that might be running. We call - * the drain function here. It should hit the case were it sees the - * ACTIVE flag cleared and exit out freeing us to proceed and - * destroy everything. - */ - if (from != SCTP_CALLED_FROM_INPKILL_TIMER) { - (void)SCTP_OS_TIMER_STOP_DRAIN(&inp->sctp_ep.signature_change.timer); - } #ifdef SCTP_LOG_CLOSING sctp_log_closing(inp, NULL, 5); Modified: stable/12/sys/netinet/sctp_var.h ============================================================================== --- stable/12/sys/netinet/sctp_var.h Mon Aug 24 09:11:37 2020 (r364640) +++ stable/12/sys/netinet/sctp_var.h Mon Aug 24 09:13:06 2020 (r364641) @@ -186,7 +186,6 @@ extern struct pr_usrreqs sctp_usrreqs; #define sctp_free_remote_addr(__net) { \ if ((__net)) { \ if (SCTP_DECREMENT_AND_CHECK_REFCOUNT(&(__net)->ref_count)) { \ - (void)SCTP_OS_TIMER_STOP(&(__net)->rxt_timer.timer); \ if ((__net)->ro.ro_rt) { \ RTFREE((__net)->ro.ro_rt); \ (__net)->ro.ro_rt = NULL; \ Modified: stable/12/sys/netinet/sctputil.c ============================================================================== --- stable/12/sys/netinet/sctputil.c Mon Aug 24 09:11:37 2020 (r364640) +++ stable/12/sys/netinet/sctputil.c Mon Aug 24 09:13:06 2020 (r364641) @@ -1709,16 +1709,22 @@ sctp_timeout_handler(void *t) struct sctp_nets *net; struct sctp_timer *tmr; struct mbuf *op_err; - int did_output; int type; int i, secret; + bool did_output, released_asoc_reference; + /* + * If inp, stcb or net are not NULL, then references to these were + * added when the timer was started, and must be released before + * this function returns. + */ tmr = (struct sctp_timer *)t; inp = (struct sctp_inpcb *)tmr->ep; stcb = (struct sctp_tcb *)tmr->tcb; net = (struct sctp_nets *)tmr->net; CURVNET_SET((struct vnet *)tmr->vnet); did_output = 1; + released_asoc_reference = false; #ifdef SCTP_AUDITING_ENABLED sctp_audit_log(0xF0, (uint8_t)tmr->type); @@ -1734,56 +1740,39 @@ sctp_timeout_handler(void *t) KASSERT(stcb == NULL || stcb->sctp_ep == inp, ("sctp_timeout_handler of type %d: inp = %p, stcb->sctp_ep %p", type, stcb, stcb->sctp_ep)); - if (inp) { - SCTP_INP_INCR_REF(inp); - } tmr->stopped_from = 0xa001; - if (stcb) { - atomic_add_int(&stcb->asoc.refcnt, 1); - if (stcb->asoc.state == 0) { - atomic_add_int(&stcb->asoc.refcnt, -1); - if (inp) { - SCTP_INP_DECR_REF(inp); - } - SCTPDBG(SCTP_DEBUG_TIMER2, - "Timer type %d handler exiting due to CLOSED association.\n", - type); - CURVNET_RESTORE(); - return; - } + if ((stcb != NULL) && (stcb->asoc.state == SCTP_STATE_EMPTY)) { + SCTPDBG(SCTP_DEBUG_TIMER2, + "Timer type %d handler exiting due to CLOSED association.\n", + type); + goto out_decr; } tmr->stopped_from = 0xa002; SCTPDBG(SCTP_DEBUG_TIMER2, "Timer type %d goes off.\n", type); if (!SCTP_OS_TIMER_ACTIVE(&tmr->timer)) { - if (inp) { - SCTP_INP_DECR_REF(inp); - } - if (stcb) { - atomic_add_int(&stcb->asoc.refcnt, -1); - } SCTPDBG(SCTP_DEBUG_TIMER2, "Timer type %d handler exiting due to not being active.\n", type); - CURVNET_RESTORE(); - return; + goto out_decr; } tmr->stopped_from = 0xa003; if (stcb) { SCTP_TCB_LOCK(stcb); + /* + * Release reference so that association can be freed if + * necessary below. This is safe now that we have acquired + * the lock. + */ atomic_add_int(&stcb->asoc.refcnt, -1); + released_asoc_reference = true; if ((type != SCTP_TIMER_TYPE_ASOCKILL) && - ((stcb->asoc.state == 0) || + ((stcb->asoc.state == SCTP_STATE_EMPTY) || (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED))) { - SCTP_TCB_UNLOCK(stcb); - if (inp) { - SCTP_INP_DECR_REF(inp); - } SCTPDBG(SCTP_DEBUG_TIMER2, "Timer type %d handler exiting due to CLOSED association.\n", type); - CURVNET_RESTORE(); - return; + goto out; } } else if (inp != NULL) { SCTP_INP_WLOCK(inp); @@ -1798,13 +1787,13 @@ sctp_timeout_handler(void *t) /* * Callout has been rescheduled. */ - goto get_out; + goto out; } if (!SCTP_OS_TIMER_ACTIVE(&tmr->timer)) { /* * Not active, so no action. */ - goto get_out; + goto out; } SCTP_OS_TIMER_DEACTIVATE(&tmr->timer); @@ -1831,6 +1820,7 @@ sctp_timeout_handler(void *t) sctp_auditing(4, inp, stcb, net); #endif sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_T3, SCTP_SO_NOT_LOCKED); + did_output = true; if ((stcb->asoc.num_send_timers_up == 0) && (stcb->asoc.sent_queue_cnt > 0)) { struct sctp_tmit_chunk *chk; @@ -1861,8 +1851,7 @@ sctp_timeout_handler(void *t) /* no need to unlock on tcb its gone */ goto out_decr; } - /* We do output but not here */ - did_output = 0; + did_output = false; break; case SCTP_TIMER_TYPE_RECV: KASSERT(inp != NULL && stcb != NULL && net == NULL, @@ -1875,6 +1864,7 @@ sctp_timeout_handler(void *t) sctp_auditing(4, inp, stcb, NULL); #endif sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_SACK_TMR, SCTP_SO_NOT_LOCKED); + did_output = true; break; case SCTP_TIMER_TYPE_SHUTDOWN: KASSERT(inp != NULL && stcb != NULL && net != NULL, @@ -1890,6 +1880,7 @@ sctp_timeout_handler(void *t) sctp_auditing(4, inp, stcb, net); #endif sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_SHUT_TMR, SCTP_SO_NOT_LOCKED); + did_output = true; break; case SCTP_TIMER_TYPE_HEARTBEAT: KASSERT(inp != NULL && stcb != NULL && net != NULL, @@ -1907,6 +1898,9 @@ sctp_timeout_handler(void *t) if (!(net->dest_state & SCTP_ADDR_NOHB)) { sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net); sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_HB_TMR, SCTP_SO_NOT_LOCKED); + did_output = true; + } else { + did_output = false; } break; case SCTP_TIMER_TYPE_COOKIE: @@ -1927,6 +1921,7 @@ sctp_timeout_handler(void *t) * respect to where from in chunk_output. */ sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_T3, SCTP_SO_NOT_LOCKED); + did_output = true; break; case SCTP_TIMER_TYPE_NEWCOOKIE: KASSERT(inp != NULL && stcb == NULL && net == NULL, @@ -1948,7 +1943,7 @@ sctp_timeout_handler(void *t) sctp_select_initial_TSN(&inp->sctp_ep); } sctp_timer_start(SCTP_TIMER_TYPE_NEWCOOKIE, inp, NULL, NULL); - did_output = 0; + did_output = false; break; case SCTP_TIMER_TYPE_PATHMTURAISE: KASSERT(inp != NULL && stcb != NULL && net != NULL, @@ -1956,7 +1951,7 @@ sctp_timeout_handler(void *t) type, inp, stcb, net)); SCTP_STAT_INCR(sctps_timopathmtu); sctp_pathmtu_timer(inp, stcb, net); - did_output = 0; + did_output = false; break; case SCTP_TIMER_TYPE_SHUTDOWNACK: KASSERT(inp != NULL && stcb != NULL && net != NULL, @@ -1972,6 +1967,7 @@ sctp_timeout_handler(void *t) sctp_auditing(4, inp, stcb, net); #endif sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_SHUT_ACK_TMR, SCTP_SO_NOT_LOCKED); + did_output = true; break; case SCTP_TIMER_TYPE_ASCONF: KASSERT(inp != NULL && stcb != NULL && net != NULL, @@ -1986,6 +1982,7 @@ sctp_timeout_handler(void *t) sctp_auditing(4, inp, stcb, net); #endif sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_ASCONF_TMR, SCTP_SO_NOT_LOCKED); + did_output = true; break; case SCTP_TIMER_TYPE_SHUTDOWNGUARD: KASSERT(inp != NULL && stcb != NULL && net == NULL, @@ -1995,6 +1992,7 @@ sctp_timeout_handler(void *t) op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), "Shutdown guard timer expired"); sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); + did_output = true; /* no need to unlock on tcb its gone */ goto out_decr; @@ -2005,7 +2003,7 @@ sctp_timeout_handler(void *t) SCTP_STAT_INCR(sctps_timoautoclose); sctp_autoclose_timer(inp, stcb); sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_AUTOCLOSE_TMR, SCTP_SO_NOT_LOCKED); - did_output = 0; + did_output = true; break; case SCTP_TIMER_TYPE_STRRESET: KASSERT(inp != NULL && stcb != NULL && net == NULL, @@ -2017,6 +2015,7 @@ sctp_timeout_handler(void *t) goto out_decr; } sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_STRRST_TMR, SCTP_SO_NOT_LOCKED); + did_output = true; break; case SCTP_TIMER_TYPE_INPKILL: KASSERT(inp != NULL && stcb == NULL && net == NULL, @@ -2057,6 +2056,7 @@ sctp_timeout_handler(void *t) ("timeout of type %d: inp = %p, stcb = %p, net = %p", type, inp, stcb, net)); sctp_handle_addr_wq(); + did_output = true; break; case SCTP_TIMER_TYPE_PRIM_DELETED: KASSERT(inp != NULL && stcb != NULL && net == NULL, @@ -2064,20 +2064,22 @@ sctp_timeout_handler(void *t) type, inp, stcb, net)); SCTP_STAT_INCR(sctps_timodelprim); sctp_delete_prim_timer(inp, stcb); + did_output = false; break; default: #ifdef INVARIANTS panic("Unknown timer type %d", type); #else - goto get_out; + did_output = false; + goto out; #endif } #ifdef SCTP_AUDITING_ENABLED sctp_audit_log(0xF1, (uint8_t)type); - if (inp) + if (inp != NULL) sctp_auditing(5, inp, stcb, net); #endif - if ((did_output) && stcb) { + if (did_output && (stcb != NULL)) { /* * Now we need to clean up the control chunk chain if an * ECNE is on it. It must be marked as UNSENT again so next @@ -2087,8 +2089,8 @@ sctp_timeout_handler(void *t) */ sctp_fix_ecn_echo(&stcb->asoc); } -get_out: - if (stcb) { +out: + if (stcb != NULL) { SCTP_TCB_UNLOCK(stcb); } else if (inp != NULL) { SCTP_INP_WUNLOCK(inp); @@ -2097,10 +2099,16 @@ get_out: } out_decr: - if (inp) { + /* These reference counts were incremented in sctp_timer_start(). */ + if (inp != NULL) { SCTP_INP_DECR_REF(inp); } - + if ((stcb != NULL) && !released_asoc_reference) { + atomic_add_int(&stcb->asoc.refcnt, -1); + } + if (net != NULL) { + sctp_free_remote_addr(net); + } out_no_decr: SCTPDBG(SCTP_DEBUG_TIMER2, "Timer type %d handler finished.\n", type); CURVNET_RESTORE(); @@ -2533,6 +2541,19 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, s SCTPDBG(SCTP_DEBUG_TIMER2, "Timer type %d started: ticks=%u, inp=%p, stcb=%p, net=%p.\n", t_type, to_ticks, inp, stcb, net); + /* + * If this is a newly scheduled callout, as opposed to a + * rescheduled one, increment relevant reference counts. + */ + if (tmr->ep != NULL) { + SCTP_INP_INCR_REF(inp); + } + if (tmr->tcb != NULL) { + atomic_add_int(&stcb->asoc.refcnt, 1); + } + if (tmr->net != NULL) { + atomic_add_int(&net->ref_count, 1); + } } else { /* * This should not happen, since we checked for pending @@ -2825,9 +2846,26 @@ sctp_timer_stop(int t_type, struct sctp_inpcb *inp, st SCTPDBG(SCTP_DEBUG_TIMER2, "Timer type %d stopped: inp=%p, stcb=%p, net=%p.\n", t_type, inp, stcb, net); - tmr->ep = NULL; - tmr->tcb = NULL; - tmr->net = NULL; + /* + * If the timer was actually stopped, decrement reference + * counts that were incremented in sctp_timer_start(). + */ + if (tmr->ep != NULL) { + SCTP_INP_DECR_REF(inp); + tmr->ep = NULL; + } + if (tmr->tcb != NULL) { + atomic_add_int(&stcb->asoc.refcnt, -1); + tmr->tcb = NULL; + } + if (tmr->net != NULL) { + /* + * Can't use net, since it doesn't work for + * SCTP_TIMER_TYPE_ASCONF. + */ + sctp_free_remote_addr((struct sctp_nets *)tmr->net); + tmr->net = NULL; + } } else { SCTPDBG(SCTP_DEBUG_TIMER2, "Timer type %d not stopped: inp=%p, stcb=%p, net=%p.\n", Modified: stable/12/sys/netinet/sctputil.h ============================================================================== --- stable/12/sys/netinet/sctputil.h Mon Aug 24 09:11:37 2020 (r364640) +++ stable/12/sys/netinet/sctputil.h Mon Aug 24 09:13:06 2020 (r364641) @@ -90,6 +90,14 @@ sctp_notify_stream_reset_add(struct sctp_tcb *stcb, ui void sctp_notify_stream_reset_tsn(struct sctp_tcb *stcb, uint32_t sending_tsn, uint32_t recv_tsn, int flag); +/* + * NOTE: sctp_timer_start() will increment the reference count of any relevant + * structure the timer is referencing, in order to prevent a race condition + * between the timer executing and the structure being freed. + * + * When the timer fires or sctp_timer_stop() is called, these references are + * removed. + */ void sctp_timer_start(int, struct sctp_inpcb *, struct sctp_tcb *, struct sctp_nets *); From owner-svn-src-stable-12@freebsd.org Mon Aug 24 09:14:33 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3A4AC3B75A1; Mon, 24 Aug 2020 09:14: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZmfK0nR1z4Rsf; Mon, 24 Aug 2020 09:14: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 F2C751642D; Mon, 24 Aug 2020 09:14: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 07O9EWJE003313; Mon, 24 Aug 2020 09:14:32 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O9EWa0003311; Mon, 24 Aug 2020 09:14:32 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240914.07O9EWa0003311@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 09:14:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364642 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364642 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 09:14:33 -0000 Author: tuexen Date: Mon Aug 24 09:14:32 2020 New Revision: 364642 URL: https://svnweb.freebsd.org/changeset/base/364642 Log: MFC r363440: Detect and handle an invalid reassembly constellation, which results in a memory leak. Thanks to Felix Weinrank for finding this issue using fuzz testing the userland stack. Modified: stable/12/sys/netinet/sctp_constants.h stable/12/sys/netinet/sctp_indata.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_constants.h ============================================================================== --- stable/12/sys/netinet/sctp_constants.h Mon Aug 24 09:13:06 2020 (r364641) +++ stable/12/sys/netinet/sctp_constants.h Mon Aug 24 09:14:32 2020 (r364642) @@ -795,6 +795,7 @@ __FBSDID("$FreeBSD$"); #define SCTP_LOC_34 0x00000022 #define SCTP_LOC_35 0x00000023 #define SCTP_LOC_36 0x00000024 +#define SCTP_LOC_37 0x00000025 /* Free assoc codes */ #define SCTP_NORMAL_PROC 0 Modified: stable/12/sys/netinet/sctp_indata.c ============================================================================== --- stable/12/sys/netinet/sctp_indata.c Mon Aug 24 09:13:06 2020 (r364641) +++ stable/12/sys/netinet/sctp_indata.c Mon Aug 24 09:14:32 2020 (r364642) @@ -1567,6 +1567,15 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struc chk->rec.data.fsn); TAILQ_FOREACH(at, &control->reasm, sctp_next) { if (SCTP_TSN_GT(at->rec.data.fsn, chk->rec.data.fsn)) { + if (chk->rec.data.rcv_flags & SCTP_DATA_LAST_FRAG) { + /* Last not at the end? huh? */ + SCTPDBG(SCTP_DEBUG_XXX, + "Last fragment not last in list: -- abort\n"); + sctp_abort_in_reasm(stcb, control, + chk, abort_flag, + SCTP_FROM_SCTP_INDATA + SCTP_LOC_14); + return; + } /* * This one in queue is bigger than the new * one, insert the new one before at. @@ -1597,7 +1606,7 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struc at->rec.data.fsn); sctp_abort_in_reasm(stcb, control, chk, abort_flag, - SCTP_FROM_SCTP_INDATA + SCTP_LOC_14); + SCTP_FROM_SCTP_INDATA + SCTP_LOC_15); return; } } @@ -1751,7 +1760,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struc * Need to send an abort since we had a empty data chunk. */ op_err = sctp_generate_no_user_data_cause(tsn); - stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_15; + stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_16; sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return (0); @@ -1888,7 +1897,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struc SCTP_SNPRINTF(msg, sizeof(msg), "Reassembly problem (MID=%8.8x)", mid); err_out: op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); - stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_16; + stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_17; sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return (0); @@ -2023,7 +2032,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struc (uint16_t)mid); } op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); - stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_17; + stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_18; sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return (0); @@ -2597,7 +2606,7 @@ sctp_sack_check(struct sctp_tcb *stcb, int was_a_gap) if (SCTP_OS_TIMER_PENDING(&stcb->asoc.dack_timer.timer)) { sctp_timer_stop(SCTP_TIMER_TYPE_RECV, stcb->sctp_ep, stcb, NULL, - SCTP_FROM_SCTP_INDATA + SCTP_LOC_18); + SCTP_FROM_SCTP_INDATA + SCTP_LOC_19); } sctp_send_shutdown(stcb, ((stcb->asoc.alternate) ? stcb->asoc.alternate : stcb->asoc.primary_destination)); @@ -2648,7 +2657,7 @@ sctp_sack_check(struct sctp_tcb *stcb, int was_a_gap) * there are gaps or duplicates. */ sctp_timer_stop(SCTP_TIMER_TYPE_RECV, stcb->sctp_ep, stcb, NULL, - SCTP_FROM_SCTP_INDATA + SCTP_LOC_19); + SCTP_FROM_SCTP_INDATA + SCTP_LOC_20); sctp_send_sack(stcb, SCTP_SO_NOT_LOCKED); } } else { @@ -2750,7 +2759,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *o SCTP_SNPRINTF(msg, sizeof(msg), "%s", "DATA chunk received when I-DATA was negotiated"); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); - stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_20; + stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_21; sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); return (2); } @@ -2761,7 +2770,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *o SCTP_SNPRINTF(msg, sizeof(msg), "%s", "I-DATA chunk received when DATA was negotiated"); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); - stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_21; + stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_22; sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); return (2); } @@ -2786,7 +2795,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *o 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_22; + stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_23; sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); return (2); } @@ -2874,7 +2883,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *o SCTP_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_23; + stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_24; sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); return (2); } @@ -4025,7 +4034,7 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32 "Cum ack %8.8x greater or equal than TSN %8.8x", cumack, send_s); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); - stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_24; + stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_25; sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); return; } @@ -4201,7 +4210,7 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32 net->dest_state &= ~SCTP_ADDR_PF; sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net, - SCTP_FROM_SCTP_INDATA + SCTP_LOC_25); + SCTP_FROM_SCTP_INDATA + SCTP_LOC_26); sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net); asoc->cc_functions.sctp_cwnd_update_exit_pf(stcb, net); /* Done with this net */ @@ -4279,7 +4288,7 @@ again: } else if (SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer)) { sctp_timer_stop(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, net, - SCTP_FROM_SCTP_INDATA + SCTP_LOC_26); + SCTP_FROM_SCTP_INDATA + SCTP_LOC_27); } } } @@ -4332,7 +4341,7 @@ again: *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_27; + stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_28; sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); return; } @@ -4548,7 +4557,7 @@ hopeless_peer: "Cum ack %8.8x greater or equal than TSN %8.8x", cum_ack, send_s); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); - stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_28; + stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_29; sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); return; } @@ -4580,7 +4589,7 @@ hopeless_peer: /* stop any timers */ TAILQ_FOREACH(net, &asoc->nets, sctp_next) { sctp_timer_stop(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, - stcb, net, SCTP_FROM_SCTP_INDATA + SCTP_LOC_29); + stcb, net, SCTP_FROM_SCTP_INDATA + SCTP_LOC_30); net->partial_bytes_acked = 0; net->flight_size = 0; } @@ -4780,14 +4789,14 @@ hopeless_peer: if (net->new_pseudo_cumack) sctp_timer_stop(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, net, - SCTP_FROM_SCTP_INDATA + SCTP_LOC_30); + SCTP_FROM_SCTP_INDATA + SCTP_LOC_31); } } else { if (accum_moved) { TAILQ_FOREACH(net, &asoc->nets, sctp_next) { sctp_timer_stop(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, - stcb, net, SCTP_FROM_SCTP_INDATA + SCTP_LOC_31); + stcb, net, SCTP_FROM_SCTP_INDATA + SCTP_LOC_32); } } } @@ -4950,7 +4959,7 @@ hopeless_peer: net->dest_state &= ~SCTP_ADDR_PF; sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net, - SCTP_FROM_SCTP_INDATA + SCTP_LOC_32); + SCTP_FROM_SCTP_INDATA + SCTP_LOC_33); sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net); asoc->cc_functions.sctp_cwnd_update_exit_pf(stcb, net); /* Done with this net */ @@ -4975,7 +4984,7 @@ hopeless_peer: /* stop all timers */ sctp_timer_stop(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, net, - SCTP_FROM_SCTP_INDATA + SCTP_LOC_33); + SCTP_FROM_SCTP_INDATA + SCTP_LOC_34); net->flight_size = 0; net->partial_bytes_acked = 0; } @@ -5013,7 +5022,7 @@ hopeless_peer: *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_34; + stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_35; sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); return; } @@ -5162,7 +5171,7 @@ again: } else if (SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer)) { sctp_timer_stop(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, net, - SCTP_FROM_SCTP_INDATA + SCTP_LOC_35); + SCTP_FROM_SCTP_INDATA + SCTP_LOC_36); } } } @@ -5565,7 +5574,7 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb, "New cum ack %8.8x too high, highest TSN %8.8x", new_cum_tsn, asoc->highest_tsn_inside_map); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); - stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_36; + stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_37; sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); return; } From owner-svn-src-stable-12@freebsd.org Mon Aug 24 09:15:52 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BDF073B725B; Mon, 24 Aug 2020 09:15: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZmgr4HBQz4Rvc; Mon, 24 Aug 2020 09:15: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 764E116263; Mon, 24 Aug 2020 09:15: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 07O9FqxR003433; Mon, 24 Aug 2020 09:15:52 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O9FqHC003432; Mon, 24 Aug 2020 09:15:52 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240915.07O9FqHC003432@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 09:15:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364643 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364643 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 09:15:52 -0000 Author: tuexen Date: Mon Aug 24 09:15:52 2020 New Revision: 364643 URL: https://svnweb.freebsd.org/changeset/base/364643 Log: MFC r363456: Clear the pointer to the socket when closing it also in case of an ungraceful operation. This fixes a use-after-free bug found and reported by Taylor Brandstetter of Google by testing the userland stack. Modified: stable/12/sys/netinet/sctp_pcb.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_pcb.c ============================================================================== --- stable/12/sys/netinet/sctp_pcb.c Mon Aug 24 09:14:32 2020 (r364642) +++ stable/12/sys/netinet/sctp_pcb.c Mon Aug 24 09:15:52 2020 (r364643) @@ -3545,6 +3545,11 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, cnt = 0; LIST_FOREACH_SAFE(asoc, &inp->sctp_asoc_list, sctp_tcblist, nasoc) { SCTP_TCB_LOCK(asoc); + if (immediate != SCTP_FREE_SHOULD_USE_GRACEFUL_CLOSE) { + /* Disconnect the socket please */ + asoc->sctp_socket = NULL; + SCTP_ADD_SUBSTATE(asoc, SCTP_STATE_CLOSED_SOCKET); + } if (asoc->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) { if (asoc->asoc.state & SCTP_STATE_IN_ACCEPT_QUEUE) { SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_IN_ACCEPT_QUEUE); From owner-svn-src-stable-12@freebsd.org Mon Aug 24 09:19:07 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A87C63B7568; Mon, 24 Aug 2020 09:19: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZmlb40XTz4SHY; Mon, 24 Aug 2020 09:19: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 6DD3815DE9; Mon, 24 Aug 2020 09:19: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 07O9J72j003639; Mon, 24 Aug 2020 09:19:07 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07O9J6Lj003633; Mon, 24 Aug 2020 09:19:06 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008240919.07O9J6Lj003633@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 24 Aug 2020 09:19:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364644 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364644 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 09:19:07 -0000 Author: tuexen Date: Mon Aug 24 09:19:05 2020 New Revision: 364644 URL: https://svnweb.freebsd.org/changeset/base/364644 Log: MFC 364268: Improve the handling of concurrent send() calls for SCTP sockets, especially when having the explicit EOR mode enabled. MFC r364270: Remove a line which is needed and was added in https://svnweb.freebsd.org/changeset/base/364268 Modified: stable/12/sys/netinet/sctp_input.c stable/12/sys/netinet/sctp_output.c stable/12/sys/netinet/sctp_pcb.c stable/12/sys/netinet/sctp_structs.h stable/12/sys/netinet/sctputil.c stable/12/sys/netinet/sctputil.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_input.c ============================================================================== --- stable/12/sys/netinet/sctp_input.c Mon Aug 24 09:15:52 2020 (r364643) +++ stable/12/sys/netinet/sctp_input.c Mon Aug 24 09:19:05 2020 (r364644) @@ -829,7 +829,6 @@ sctp_handle_abort(struct sctp_abort_chunk *abort, #ifdef SCTP_ASOCLOG_OF_TSNS sctp_print_out_track_log(stcb); #endif - SCTP_ADD_SUBSTATE(stcb, SCTP_STATE_WAS_ABORTED); (void)sctp_free_assoc(stcb->sctp_ep, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_8); SCTPDBG(SCTP_DEBUG_INPUT2, "sctp_handle_abort: finished\n"); @@ -1866,7 +1865,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphle /* send up all the data */ SCTP_TCB_SEND_LOCK(stcb); - sctp_report_all_outbound(stcb, 0, 1, SCTP_SO_LOCKED); + sctp_report_all_outbound(stcb, 0, SCTP_SO_LOCKED); for (i = 0; i < stcb->asoc.streamoutcnt; i++) { stcb->asoc.strmout[i].chunks_on_queues = 0; #if defined(SCTP_DETAILED_STR_STATS) Modified: stable/12/sys/netinet/sctp_output.c ============================================================================== --- stable/12/sys/netinet/sctp_output.c Mon Aug 24 09:15:52 2020 (r364643) +++ stable/12/sys/netinet/sctp_output.c Mon Aug 24 09:19:05 2020 (r364644) @@ -13151,12 +13151,21 @@ skip_preblock: if (sinfo_flags & SCTP_UNORDERED) { SCTP_STAT_INCR(sctps_sends_with_unord); } + sp->processing = 1; TAILQ_INSERT_TAIL(&strm->outqueue, sp, next); stcb->asoc.ss_functions.sctp_ss_add_to_stream(stcb, asoc, strm, sp, 1); SCTP_TCB_SEND_UNLOCK(stcb); } else { SCTP_TCB_SEND_LOCK(stcb); sp = TAILQ_LAST(&strm->outqueue, sctp_streamhead); + if (sp->processing) { + SCTP_TCB_SEND_UNLOCK(stcb); + SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); + error = EINVAL; + goto out; + } else { + sp->processing = 1; + } SCTP_TCB_SEND_UNLOCK(stcb); if (sp == NULL) { /* ???? Huh ??? last msg is gone */ @@ -13198,13 +13207,14 @@ skip_preblock: } /* Update the mbuf and count */ SCTP_TCB_SEND_LOCK(stcb); - if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) { + if ((stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) || + (stcb->asoc.state & SCTP_STATE_WAS_ABORTED)) { /* * we need to get out. Peer probably * aborted. */ sctp_m_freem(mm); - if (stcb->asoc.state & SCTP_PCB_FLAGS_WAS_ABORTED) { + if (stcb->asoc.state & SCTP_STATE_WAS_ABORTED) { SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ECONNRESET); error = ECONNRESET; } @@ -13404,7 +13414,8 @@ skip_preblock: } } SCTP_TCB_SEND_LOCK(stcb); - if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) { + if ((stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) || + (stcb->asoc.state & SCTP_STATE_WAS_ABORTED)) { SCTP_TCB_SEND_UNLOCK(stcb); goto out_unlocked; } @@ -13420,6 +13431,7 @@ skip_preblock: strm->last_msg_incomplete = 0; asoc->stream_locked = 0; } + sp->processing = 0; } else { SCTP_PRINTF("Huh no sp TSNH?\n"); strm->last_msg_incomplete = 0; Modified: stable/12/sys/netinet/sctp_pcb.c ============================================================================== --- stable/12/sys/netinet/sctp_pcb.c Mon Aug 24 09:15:52 2020 (r364643) +++ stable/12/sys/netinet/sctp_pcb.c Mon Aug 24 09:19:05 2020 (r364644) @@ -4741,6 +4741,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tc /* there is no asoc, really TSNH :-0 */ return (1); } + SCTP_TCB_SEND_LOCK(stcb); if (stcb->asoc.alternate) { sctp_free_remote_addr(stcb->asoc.alternate); stcb->asoc.alternate = NULL; @@ -4775,6 +4776,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tc /* nope, reader or writer in the way */ sctp_timer_start(SCTP_TIMER_TYPE_ASOCKILL, inp, stcb, NULL); /* no asoc destroyed */ + SCTP_TCB_SEND_UNLOCK(stcb); SCTP_TCB_UNLOCK(stcb); #ifdef SCTP_LOG_CLOSING sctp_log_closing(inp, stcb, 8); @@ -4843,6 +4845,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tc SCTP_CLEAR_SUBSTATE(stcb, SCTP_STATE_IN_ACCEPT_QUEUE); sctp_timer_start(SCTP_TIMER_TYPE_ASOCKILL, inp, stcb, NULL); } + SCTP_TCB_SEND_UNLOCK(stcb); SCTP_TCB_UNLOCK(stcb); if ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) || (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE)) @@ -4876,10 +4879,12 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tc if (from_inpcbfree == SCTP_NORMAL_PROC) { atomic_add_int(&stcb->asoc.refcnt, 1); + SCTP_TCB_SEND_UNLOCK(stcb); SCTP_TCB_UNLOCK(stcb); SCTP_INP_INFO_WLOCK(); SCTP_INP_WLOCK(inp); SCTP_TCB_LOCK(stcb); + SCTP_TCB_SEND_LOCK(stcb); } /* Double check the GONE flag */ if ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) || @@ -4927,6 +4932,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tc SCTP_INP_INFO_WUNLOCK(); SCTP_INP_WUNLOCK(inp); } + SCTP_TCB_SEND_UNLOCK(stcb); SCTP_TCB_UNLOCK(stcb); return (0); } @@ -4958,7 +4964,6 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tc * in case. */ /* anything on the wheel needs to be removed */ - SCTP_TCB_SEND_LOCK(stcb); for (i = 0; i < asoc->streamoutcnt; i++) { struct sctp_stream_out *outs; @@ -4989,7 +4994,6 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tc sctp_free_a_strmoq(stcb, sp, SCTP_SO_LOCKED); } } - SCTP_TCB_SEND_UNLOCK(stcb); /* sa_ignore FREED_MEMORY */ TAILQ_FOREACH_SAFE(strrst, &asoc->resetHead, next_resp, nstrrst) { TAILQ_REMOVE(&asoc->resetHead, strrst, next_resp); @@ -5191,6 +5195,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tc /* Insert new items here :> */ /* Get rid of LOCK */ + SCTP_TCB_SEND_UNLOCK(stcb); SCTP_TCB_UNLOCK(stcb); SCTP_TCB_LOCK_DESTROY(stcb); SCTP_TCB_SEND_LOCK_DESTROY(stcb); Modified: stable/12/sys/netinet/sctp_structs.h ============================================================================== --- stable/12/sys/netinet/sctp_structs.h Mon Aug 24 09:15:52 2020 (r364643) +++ stable/12/sys/netinet/sctp_structs.h Mon Aug 24 09:19:05 2020 (r364644) @@ -534,6 +534,7 @@ struct sctp_stream_queue_pending { uint8_t sender_all_done; uint8_t put_last_out; uint8_t discard_rest; + uint8_t processing; }; /* Modified: stable/12/sys/netinet/sctputil.c ============================================================================== --- stable/12/sys/netinet/sctputil.c Mon Aug 24 09:15:52 2020 (r364643) +++ stable/12/sys/netinet/sctputil.c Mon Aug 24 09:19:05 2020 (r364644) @@ -4234,7 +4234,7 @@ sctp_ulp_notify(uint32_t notification, struct sctp_tcb } void -sctp_report_all_outbound(struct sctp_tcb *stcb, uint16_t error, int holds_lock, int so_locked) +sctp_report_all_outbound(struct sctp_tcb *stcb, uint16_t error, int so_locked) { struct sctp_association *asoc; struct sctp_stream_out *outs; @@ -4256,9 +4256,6 @@ sctp_report_all_outbound(struct sctp_tcb *stcb, uint16 return; } /* now through all the gunk freeing chunks */ - if (holds_lock == 0) { - SCTP_TCB_SEND_LOCK(stcb); - } /* sent queue SHOULD be empty */ TAILQ_FOREACH_SAFE(chk, &asoc->sent_queue, sctp_next, nchk) { TAILQ_REMOVE(&asoc->sent_queue, chk, sctp_next); @@ -4335,10 +4332,6 @@ sctp_report_all_outbound(struct sctp_tcb *stcb, uint16 /* sa_ignore FREED_MEMORY */ } } - - if (holds_lock == 0) { - SCTP_TCB_SEND_UNLOCK(stcb); - } } void @@ -4358,8 +4351,11 @@ sctp_abort_notification(struct sctp_tcb *stcb, uint8_t (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET)) { return; } + SCTP_TCB_SEND_LOCK(stcb); + SCTP_ADD_SUBSTATE(stcb, SCTP_STATE_WAS_ABORTED); /* Tell them we lost the asoc */ - sctp_report_all_outbound(stcb, error, 0, so_locked); + sctp_report_all_outbound(stcb, error, so_locked); + SCTP_TCB_SEND_UNLOCK(stcb); if (from_peer) { sctp_ulp_notify(SCTP_NOTIFY_ASSOC_REM_ABORTED, stcb, error, abort, so_locked); } else { @@ -4388,7 +4384,6 @@ sctp_abort_association(struct sctp_inpcb *inp, struct if (stcb != NULL) { /* We have a TCB to abort, send notification too */ sctp_abort_notification(stcb, 0, 0, NULL, SCTP_SO_NOT_LOCKED); - SCTP_ADD_SUBSTATE(stcb, SCTP_STATE_WAS_ABORTED); /* Ok, now lets free it */ SCTP_STAT_INCR_COUNTER32(sctps_aborted); if ((SCTP_GET_STATE(stcb) == SCTP_STATE_OPEN) || @@ -4477,8 +4472,6 @@ sctp_abort_an_association(struct sctp_inpcb *inp, stru } } return; - } else { - SCTP_ADD_SUBSTATE(stcb, SCTP_STATE_WAS_ABORTED); } /* notify the peer */ sctp_send_abort_tcb(stcb, op_err, so_locked); Modified: stable/12/sys/netinet/sctputil.h ============================================================================== --- stable/12/sys/netinet/sctputil.h Mon Aug 24 09:15:52 2020 (r364643) +++ stable/12/sys/netinet/sctputil.h Mon Aug 24 09:19:05 2020 (r364644) @@ -164,7 +164,7 @@ void sctp_stop_timers_for_shutdown(struct sctp_tcb *); /* Stop all timers for association and remote addresses. */ void sctp_stop_association_timers(struct sctp_tcb *, bool); -void sctp_report_all_outbound(struct sctp_tcb *, uint16_t, int, int); +void sctp_report_all_outbound(struct sctp_tcb *, uint16_t, int); int sctp_expand_mapping_array(struct sctp_association *, uint32_t); From owner-svn-src-stable-12@freebsd.org Mon Aug 24 10:28:16 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 55BD43B8F78; Mon, 24 Aug 2020 10:28:16 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZpHN1ZHYz4XVR; Mon, 24 Aug 2020 10:28:16 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 193C31712E; Mon, 24 Aug 2020 10:28:16 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OASFeg047231; Mon, 24 Aug 2020 10:28:15 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OASF73047230; Mon, 24 Aug 2020 10:28:15 GMT (envelope-from manu@FreeBSD.org) Message-Id: <202008241028.07OASF73047230@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 24 Aug 2020 10:28:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364652 - stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: manu X-SVN-Commit-Paths: stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 364652 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 10:28:16 -0000 Author: manu Date: Mon Aug 24 10:28:15 2020 New Revision: 364652 URL: https://svnweb.freebsd.org/changeset/base/364652 Log: MFC r358176-r358177 r358176: linuxkpi: Add list_is_first function This function just test if the element is the first of the list. Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D23766 r358177: linuxkpi: Add str_has_prefix This function test if the string str begins with the string pointed at by prefix. Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D23767 Modified: stable/12/sys/compat/linuxkpi/common/include/linux/list.h stable/12/sys/compat/linuxkpi/common/include/linux/string.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/list.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/list.h Mon Aug 24 09:46:36 2020 (r364651) +++ stable/12/sys/compat/linuxkpi/common/include/linux/list.h Mon Aug 24 10:28:15 2020 (r364652) @@ -449,6 +449,13 @@ static inline void list_cut_position(struct list_head __list_cut_position(list, head, entry); } +static inline int list_is_first(const struct list_head *list, + const struct list_head *head) +{ + + return (list->prev == head); +} + static inline int list_is_last(const struct list_head *list, const struct list_head *head) { Modified: stable/12/sys/compat/linuxkpi/common/include/linux/string.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/string.h Mon Aug 24 09:46:36 2020 (r364651) +++ stable/12/sys/compat/linuxkpi/common/include/linux/string.h Mon Aug 24 10:28:15 2020 (r364652) @@ -158,4 +158,13 @@ memchr_inv(const void *start, int c, size_t length) return (NULL); } +static inline size_t +str_has_prefix(const char *str, const char *prefix) +{ + size_t len; + + len = strlen(prefix); + return (strncmp(str, prefix, len) == 0 ? len : 0); +} + #endif /* _LINUX_STRING_H_ */ From owner-svn-src-stable-12@freebsd.org Mon Aug 24 10:42:05 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EF2D93B9C33; Mon, 24 Aug 2020 10:42:05 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZpbK65Mtz4Yc4; Mon, 24 Aug 2020 10:42:05 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 B472517687; Mon, 24 Aug 2020 10:42:05 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OAg5bk059083; Mon, 24 Aug 2020 10:42:05 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OAg44w059080; Mon, 24 Aug 2020 10:42:04 GMT (envelope-from manu@FreeBSD.org) Message-Id: <202008241042.07OAg44w059080@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 24 Aug 2020 10:42:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364653 - in stable/12/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src dev/qlnx/qlnxe X-SVN-Group: stable-12 X-SVN-Commit-Author: manu X-SVN-Commit-Paths: in stable/12/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src dev/qlnx/qlnxe X-SVN-Commit-Revision: 364653 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 10:42:06 -0000 Author: manu Date: Mon Aug 24 10:42:04 2020 New Revision: 364653 URL: https://svnweb.freebsd.org/changeset/base/364653 Log: MFC r360787, r360851, r360870-r360872 r360787: linuxkpi: Add pci_iomap and pci_iounmap Those function are use to map/unmap io region of a pci device. Different resource can be mapped depending on the bar so use a tailq to store them all. Sponsored-by: The FreeBSD Foundation Reviewed by: emaste, hselasky Differential Revision: https://reviews.freebsd.org/D24696 r360851: linuxkpi: Add bitmap_copy and bitmap_andnot bitmap_copy simply copy the bitmaps, no idea why it exists. bitmap_andnot is similar to bitmap_and but uses !src2. Sponsored-by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D24782 r360870: linuxkpi: Add bitmap_alloc and bitmap_free This is a simple call to kmallock_array/kfree, therefore include linux/slab.h as this is where the kmalloc_array/kfree definition is. Sponsored-by: The FreeBSD Foundation Reviewed by: hselsasky Differential Revision: https://reviews.freebsd.org/D24794 r360871: linuxkpi: Really add bitmap_alloc and bitmap_zalloc This was missing in r360870 Sponsored-by: The FreeBSD Foundation r360872: qnlx: Do not redifines types. r360870 added linux/slab.h into liunx/bitmap.h and this include linux/types.h The qlnx driver is redefining some of those types so remove them and add an explicit linux/types.h include. Pointy hat: manu Reported by: Austin Shafer Modified: stable/12/sys/compat/linuxkpi/common/include/linux/bitmap.h stable/12/sys/compat/linuxkpi/common/include/linux/pci.h stable/12/sys/compat/linuxkpi/common/src/linux_pci.c stable/12/sys/dev/qlnx/qlnxe/bcm_osal.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/bitmap.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/bitmap.h Mon Aug 24 10:28:15 2020 (r364652) +++ stable/12/sys/compat/linuxkpi/common/include/linux/bitmap.h Mon Aug 24 10:42:04 2020 (r364653) @@ -30,6 +30,7 @@ #define _LINUX_BITMAP_H_ #include +#include static inline void bitmap_zero(unsigned long *addr, const unsigned int size) @@ -277,6 +278,17 @@ bitmap_complement(unsigned long *dst, const unsigned l } static inline void +bitmap_copy(unsigned long *dst, const unsigned long *src, + const unsigned int size) +{ + const unsigned int end = BITS_TO_LONGS(size); + unsigned int i; + + for (i = 0; i != end; i++) + dst[i] = src[i]; +} + +static inline void bitmap_or(unsigned long *dst, const unsigned long *src1, const unsigned long *src2, const unsigned int size) { @@ -299,6 +311,17 @@ bitmap_and(unsigned long *dst, const unsigned long *sr } static inline void +bitmap_andnot(unsigned long *dst, const unsigned long *src1, + const unsigned long *src2, const unsigned int size) +{ + const unsigned int end = BITS_TO_LONGS(size); + unsigned int i; + + for (i = 0; i != end; i++) + dst[i] = src1[i] & ~src2[i]; +} + +static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1, const unsigned long *src2, const unsigned int size) { @@ -307,6 +330,25 @@ bitmap_xor(unsigned long *dst, const unsigned long *sr for (i = 0; i != end; i++) dst[i] = src1[i] ^ src2[i]; +} + +static inline unsigned long * +bitmap_alloc(unsigned int size, gfp_t flags) +{ + return (kmalloc_array(BITS_TO_LONGS(size), + sizeof(unsigned long), flags)); +} + +static inline unsigned long * +bitmap_zalloc(unsigned int size, gfp_t flags) +{ + return (bitmap_alloc(size, flags | __GFP_ZERO)); +} + +static inline void +bitmap_free(const unsigned long *bitmap) +{ + kfree(bitmap); } #endif /* _LINUX_BITMAP_H_ */ Modified: stable/12/sys/compat/linuxkpi/common/include/linux/pci.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/pci.h Mon Aug 24 10:28:15 2020 (r364652) +++ stable/12/sys/compat/linuxkpi/common/include/linux/pci.h Mon Aug 24 10:42:04 2020 (r364653) @@ -222,6 +222,13 @@ extern spinlock_t pci_lock; #define __devexit_p(x) x +struct pci_mmio_region { + TAILQ_ENTRY(pci_mmio_region) next; + struct resource *res; + int rid; + int type; +}; + struct pci_dev { struct device dev; struct list_head links; @@ -236,6 +243,8 @@ struct pci_dev { uint32_t class; uint8_t revision; bool msi_enabled; + + TAILQ_HEAD(, pci_mmio_region) mmio; }; static inline struct resource_list_entry * @@ -657,6 +666,41 @@ static inline int pci_enable_sriov(struct pci_dev *dev } static inline void pci_disable_sriov(struct pci_dev *dev) { +} + +static inline void * +pci_iomap(struct pci_dev *dev, int mmio_bar, int mmio_size __unused) +{ + struct pci_mmio_region *mmio; + + mmio = malloc(sizeof(*mmio), M_DEVBUF, M_WAITOK | M_ZERO); + mmio->rid = PCIR_BAR(mmio_bar); + mmio->type = pci_resource_type(dev, mmio_bar); + mmio->res = bus_alloc_resource_any(dev->dev.bsddev, mmio->type, + &mmio->rid, RF_ACTIVE); + if (mmio->res == NULL) { + free(mmio, M_DEVBUF); + return (NULL); + } + TAILQ_INSERT_TAIL(&dev->mmio, mmio, next); + + return ((void *)rman_get_bushandle(mmio->res)); +} + +static inline void +pci_iounmap(struct pci_dev *dev, void *res) +{ + struct pci_mmio_region *mmio, *p; + + TAILQ_FOREACH_SAFE(mmio, &dev->mmio, next, p) { + if (res != (void *)rman_get_bushandle(mmio->res)) + continue; + bus_release_resource(dev->dev.bsddev, + mmio->type, mmio->rid, mmio->res); + TAILQ_REMOVE(&dev->mmio, mmio, next); + free(mmio, M_DEVBUF); + return; + } } #define DEFINE_PCI_DEVICE_TABLE(_table) \ Modified: stable/12/sys/compat/linuxkpi/common/src/linux_pci.c ============================================================================== --- stable/12/sys/compat/linuxkpi/common/src/linux_pci.c Mon Aug 24 10:28:15 2020 (r364652) +++ stable/12/sys/compat/linuxkpi/common/src/linux_pci.c Mon Aug 24 10:42:04 2020 (r364653) @@ -271,6 +271,7 @@ linux_pci_attach_device(device_t dev, struct pci_drive if (error) goto out_dma_init; + TAILQ_INIT(&pdev->mmio); pbus = malloc(sizeof(*pbus), M_DEVBUF, M_WAITOK | M_ZERO); pbus->self = pdev; pbus->number = pci_get_bus(dev); Modified: stable/12/sys/dev/qlnx/qlnxe/bcm_osal.h ============================================================================== --- stable/12/sys/dev/qlnx/qlnxe/bcm_osal.h Mon Aug 24 10:28:15 2020 (r364652) +++ stable/12/sys/dev/qlnx/qlnxe/bcm_osal.h Mon Aug 24 10:42:04 2020 (r364653) @@ -34,6 +34,8 @@ #include "ecore_status.h" #include +#include + #if __FreeBSD_version >= 1200032 #include #else @@ -112,11 +114,6 @@ extern void qlnx_vf_flr_update(void *p_hwfn); #define s32 uint32_t #ifndef QLNX_RDMA - -typedef uint16_t __le16; -typedef uint32_t __le32; -typedef uint16_t __be16; -typedef uint32_t __be32; static __inline unsigned long roundup_pow_of_two(unsigned long x) From owner-svn-src-stable-12@freebsd.org Mon Aug 24 10:46:10 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 98B6C3B9AC8; Mon, 24 Aug 2020 10:46:10 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZph23Yhsz4Yq3; Mon, 24 Aug 2020 10:46:10 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 5DB1D17712; Mon, 24 Aug 2020 10:46:10 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OAkAQh059382; Mon, 24 Aug 2020 10:46:10 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OAk9Z4059378; Mon, 24 Aug 2020 10:46:09 GMT (envelope-from manu@FreeBSD.org) Message-Id: <202008241046.07OAk9Z4059378@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 24 Aug 2020 10:46:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364654 - stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: manu X-SVN-Commit-Paths: stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 364654 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 10:46:10 -0000 Author: manu Date: Mon Aug 24 10:46:09 2020 New Revision: 364654 URL: https://svnweb.freebsd.org/changeset/base/364654 Log: MFC r361007, r361138-r361140, r361245-r361246 r361007: linuxkpi: Add EBADRQC to errno.h This is used in the amdgpu driver from Linux 5.2 Sponsored-by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D24807 r361138: linuxkpi: Add atomic_dec_and_mutex_lock This function decrement the counter and if the result is 0 it acquires the mutex and returns 1, if not it simply returns 0. Needed by DRM from Linux v5.3 Sponsored-by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D24847 r361139: linuxkpi: Add __mutex_init Same as mutex_init, the lock_class_key argument seems to be only used for debug in Linux, simply ignore it for now. Needed by DRM in Linux v5.3 Sponsored-by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D24848 r361140: linuxkpi: Add offsetofend macro This calculate the offset of the end of the member in the given struct. Needed by DRM in Linux v5.3 Sponsored-by: The FreeBSD Foudation Differential Revision: https://reviews.freebsd.org/D24849 r361245: linuxkpi: Add __init_waitqueue_head The only difference with init_waitqueue_head is that the name and the lock class key are provided but we don't use those so use init_waitqueue_head directly. Sponsored-by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D24861 r361246: linuxkpi: add pci_dev_present pci_dev_present shows if a set of pci ids are present in the system. It just wraps pci_find_device. Needed by DRMv5.2 Submitted by: Austing Shafer (ashafer@badland.io) Differential Revision: https://reviews.freebsd.org/D24796 Modified: stable/12/sys/compat/linuxkpi/common/include/linux/errno.h stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h stable/12/sys/compat/linuxkpi/common/include/linux/mutex.h stable/12/sys/compat/linuxkpi/common/include/linux/pci.h stable/12/sys/compat/linuxkpi/common/include/linux/wait.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/errno.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/errno.h Mon Aug 24 10:42:04 2020 (r364653) +++ stable/12/sys/compat/linuxkpi/common/include/linux/errno.h Mon Aug 24 10:46:09 2020 (r364654) @@ -33,6 +33,8 @@ #include +#define EBADRQC 56 /* Bad request code */ + #define ECHRNG EDOM #define ETIME ETIMEDOUT #define ECOMM ESTALE Modified: stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h Mon Aug 24 10:42:04 2020 (r364653) +++ stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h Mon Aug 24 10:46:09 2020 (r364654) @@ -465,6 +465,9 @@ kstrtobool_from_user(const char __user *s, size_t coun type __max2 = (y); \ __max1 > __max2 ? __max1 : __max2; }) +#define offsetofend(t, m) \ + (offsetof(t, m) + sizeof((((t *)0)->m))) + #define clamp_t(type, _x, min, max) min_t(type, max_t(type, _x, min), max) #define clamp(x, lo, hi) min( max(x,lo), hi) #define clamp_val(val, lo, hi) clamp_t(typeof(val), val, lo, hi) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/mutex.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/mutex.h Mon Aug 24 10:42:04 2020 (r364653) +++ stable/12/sys/compat/linuxkpi/common/include/linux/mutex.h Mon Aug 24 10:46:09 2020 (r364654) @@ -37,6 +37,7 @@ #include #include +#include typedef struct mutex { struct sx sx; @@ -107,6 +108,9 @@ mutex_trylock_recursive(struct mutex *lock) #define mutex_init(_m) \ linux_mutex_init(_m, mutex_name(#_m), SX_NOWITNESS) +#define __mutex_init(_m, _n, _l) \ + linux_mutex_init(_m, _n, SX_NOWITNESS) + #define mutex_init_witness(_m) \ linux_mutex_init(_m, mutex_name(#_m), SX_DUPOK) @@ -123,6 +127,16 @@ static inline bool mutex_is_owned(mutex_t *m) { return (sx_xlocked(&m->sx)); +} + +static inline int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *m) +{ + if (atomic_dec_and_test(cnt)) { + mutex_lock(m); + return (1); + } + + return (0); } #ifdef WITNESS_ALL Modified: stable/12/sys/compat/linuxkpi/common/include/linux/pci.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/pci.h Mon Aug 24 10:42:04 2020 (r364653) +++ stable/12/sys/compat/linuxkpi/common/include/linux/pci.h Mon Aug 24 10:46:09 2020 (r364654) @@ -1050,4 +1050,16 @@ extern int linux_pci_attach_device(device_t, struct pc const struct pci_device_id *, struct pci_dev *); extern int linux_pci_detach_device(struct pci_dev *); +static inline int +pci_dev_present(const struct pci_device_id *cur) +{ + while (cur != NULL && (cur->vendor || cur->device)) { + if (pci_find_device(cur->vendor, cur->device) != NULL) { + return (1); + } + cur++; + } + return (0); +} + #endif /* _LINUX_PCI_H_ */ Modified: stable/12/sys/compat/linuxkpi/common/include/linux/wait.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/wait.h Mon Aug 24 10:42:04 2020 (r364653) +++ stable/12/sys/compat/linuxkpi/common/include/linux/wait.h Mon Aug 24 10:46:09 2020 (r364654) @@ -119,6 +119,8 @@ extern wait_queue_func_t default_wake_function; INIT_LIST_HEAD(&(wqh)->task_list); \ } while (0) +#define __init_waitqueue_head(wqh, name, lk) init_waitqueue_head(wqh) + void linux_init_wait_entry(wait_queue_t *, int); void linux_wake_up(wait_queue_head_t *, unsigned int, int, bool); From owner-svn-src-stable-12@freebsd.org Mon Aug 24 12:20:56 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A20793BD021; Mon, 24 Aug 2020 12:20:56 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZrnN3mDHz4gMC; Mon, 24 Aug 2020 12:20:56 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 64D36186A1; Mon, 24 Aug 2020 12:20:56 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OCKuGA016497; Mon, 24 Aug 2020 12:20:56 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OCKubX016495; Mon, 24 Aug 2020 12:20:56 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241220.07OCKubX016495@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 12:20:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364657 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364657 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 12:20:56 -0000 Author: trasz Date: Mon Aug 24 12:20:55 2020 New Revision: 364657 URL: https://svnweb.freebsd.org/changeset/base/364657 Log: MFC r363322: Make linux(4) support the BLKPBSZGET ioctl. Oracle uses it. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linux/linux_ioctl.c stable/12/sys/compat/linux/linux_ioctl.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_ioctl.c ============================================================================== --- stable/12/sys/compat/linux/linux_ioctl.c Mon Aug 24 11:49:49 2020 (r364656) +++ stable/12/sys/compat/linux/linux_ioctl.c Mon Aug 24 12:20:55 2020 (r364657) @@ -285,9 +285,9 @@ linux_ioctl_disk(struct thread *td, struct linux_ioctl { struct file *fp; int error; - u_int sectorsize; + u_int sectorsize, psectorsize; uint64_t blksize64; - off_t mediasize; + off_t mediasize, stripesize; error = fget(td, args->fd, &cap_ioctl_rights, &fp); if (error != 0) @@ -327,6 +327,27 @@ linux_ioctl_disk(struct thread *td, struct linux_ioctl return (copyout(§orsize, (void *)args->arg, sizeof(sectorsize))); break; + case LINUX_BLKPBSZGET: + error = fo_ioctl(fp, DIOCGSTRIPESIZE, + (caddr_t)&stripesize, td->td_ucred, td); + if (error != 0) { + fdrop(fp, td); + return (error); + } + if (stripesize > 0 && stripesize <= 4096) { + psectorsize = stripesize; + } else { + error = fo_ioctl(fp, DIOCGSECTORSIZE, + (caddr_t)§orsize, td->td_ucred, td); + if (error != 0) { + fdrop(fp, td); + return (error); + } + psectorsize = sectorsize; + } + fdrop(fp, td); + return (copyout(&psectorsize, (void *)args->arg, + sizeof(psectorsize))); } fdrop(fp, td); return (ENOIOCTL); Modified: stable/12/sys/compat/linux/linux_ioctl.h ============================================================================== --- stable/12/sys/compat/linux/linux_ioctl.h Mon Aug 24 11:49:49 2020 (r364656) +++ stable/12/sys/compat/linux/linux_ioctl.h Mon Aug 24 12:20:55 2020 (r364657) @@ -58,9 +58,10 @@ #define LINUX_BLKSECTGET 0x1267 #define LINUX_BLKSSZGET 0x1268 #define LINUX_BLKGETSIZE64 0x1272 +#define LINUX_BLKPBSZGET 0x127b #define LINUX_IOCTL_DISK_MIN LINUX_BLKROSET -#define LINUX_IOCTL_DISK_MAX LINUX_BLKGETSIZE64 +#define LINUX_IOCTL_DISK_MAX LINUX_BLKPBSZGET /* * hdio From owner-svn-src-stable-12@freebsd.org Mon Aug 24 12:23:56 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6BA8E3BD25D; Mon, 24 Aug 2020 12:23:56 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZrrr2KWkz4gJ2; Mon, 24 Aug 2020 12:23:56 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 34236186BA; Mon, 24 Aug 2020 12:23:56 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OCNuKu021266; Mon, 24 Aug 2020 12:23:56 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OCNtQv021264; Mon, 24 Aug 2020 12:23:55 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241223.07OCNtQv021264@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 12:23:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364658 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364658 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 12:23:56 -0000 Author: trasz Date: Mon Aug 24 12:23:55 2020 New Revision: 364658 URL: https://svnweb.freebsd.org/changeset/base/364658 Log: MFC r362014: Support SO_SNDBUFFORCE/SO_RCVBUFFORCE by aliasing them to the standard SO_SNDBUF/SO_RCVBUF. Mostly cosmetics, to get rid of the warning during 'apt upgrade'. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linux/linux_socket.c stable/12/sys/compat/linux/linux_socket.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_socket.c ============================================================================== --- stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 12:20:55 2020 (r364657) +++ stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 12:23:55 2020 (r364658) @@ -363,8 +363,10 @@ linux_to_bsd_so_sockopt(int opt) case LINUX_SO_BROADCAST: return (SO_BROADCAST); case LINUX_SO_SNDBUF: + case LINUX_SO_SNDBUFFORCE: return (SO_SNDBUF); case LINUX_SO_RCVBUF: + case LINUX_SO_RCVBUFFORCE: return (SO_RCVBUF); case LINUX_SO_KEEPALIVE: return (SO_KEEPALIVE); Modified: stable/12/sys/compat/linux/linux_socket.h ============================================================================== --- stable/12/sys/compat/linux/linux_socket.h Mon Aug 24 12:20:55 2020 (r364657) +++ stable/12/sys/compat/linux/linux_socket.h Mon Aug 24 12:23:55 2020 (r364658) @@ -206,6 +206,8 @@ int linux_accept(struct thread *td, struct linux_accep #endif #define LINUX_SO_TIMESTAMP 29 #define LINUX_SO_ACCEPTCONN 30 +#define LINUX_SO_SNDBUFFORCE 32 +#define LINUX_SO_RCVBUFFORCE 33 /* Socket options */ #define LINUX_IP_TOS 1 From owner-svn-src-stable-12@freebsd.org Mon Aug 24 12:26:50 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 601AA3BD662; Mon, 24 Aug 2020 12:26:50 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZrwB1rjJz4h5N; Mon, 24 Aug 2020 12:26:50 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 23929184D7; Mon, 24 Aug 2020 12:26:50 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OCQoao021626; Mon, 24 Aug 2020 12:26:50 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OCQnEq021624; Mon, 24 Aug 2020 12:26:49 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241226.07OCQnEq021624@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 12:26:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364659 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364659 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 12:26:50 -0000 Author: trasz Date: Mon Aug 24 12:26:49 2020 New Revision: 364659 URL: https://svnweb.freebsd.org/changeset/base/364659 Log: MFC r357076: Make linux(4) handle MAP_32BIT. This unbreaks Mono (mono-devel-4.6.2.7+dfsg-1ubuntu1 from Ubuntu Bionic); previously would crash on "amd64_is_imm32" assert. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linux/linux_mmap.c stable/12/sys/compat/linux/linux_mmap.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_mmap.c ============================================================================== --- stable/12/sys/compat/linux/linux_mmap.c Mon Aug 24 12:23:55 2020 (r364658) +++ stable/12/sys/compat/linux/linux_mmap.c Mon Aug 24 12:26:49 2020 (r364659) @@ -113,7 +113,15 @@ linux_mmap_common(struct thread *td, uintptr_t addr, s if (flags & LINUX_MAP_GROWSDOWN) bsd_flags |= MAP_STACK; +#if defined(__amd64__) /* + * According to the Linux mmap(2) man page, "MAP_32BIT flag + * is ignored when MAP_FIXED is set." + */ + if ((flags & LINUX_MAP_32BIT) && (flags & LINUX_MAP_FIXED) == 0) + bsd_flags |= MAP_32BIT; + + /* * PROT_READ, PROT_WRITE, or PROT_EXEC implies PROT_READ and PROT_EXEC * on Linux/i386 if the binary requires executable stack. * We do this only for IA32 emulation as on native i386 this is does not @@ -121,7 +129,6 @@ linux_mmap_common(struct thread *td, uintptr_t addr, s * * XXX. Linux checks that the file system is not mounted with noexec. */ -#if defined(__amd64__) linux_fixup_prot(td, &prot); #endif Modified: stable/12/sys/compat/linux/linux_mmap.h ============================================================================== --- stable/12/sys/compat/linux/linux_mmap.h Mon Aug 24 12:23:55 2020 (r364658) +++ stable/12/sys/compat/linux/linux_mmap.h Mon Aug 24 12:26:49 2020 (r364659) @@ -39,6 +39,7 @@ #define LINUX_MAP_PRIVATE 0x0002 #define LINUX_MAP_FIXED 0x0010 #define LINUX_MAP_ANON 0x0020 +#define LINUX_MAP_32BIT 0x0040 #define LINUX_MAP_GROWSDOWN 0x0100 #define LINUX_PROT_GROWSDOWN 0x01000000 From owner-svn-src-stable-12@freebsd.org Mon Aug 24 12:29:23 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EE0D03BD7B0; Mon, 24 Aug 2020 12:29:23 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZrz75nrJz4h6D; Mon, 24 Aug 2020 12:29:23 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 AA25718995; Mon, 24 Aug 2020 12:29:23 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OCTN4J021795; Mon, 24 Aug 2020 12:29:23 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OCTNqj021793; Mon, 24 Aug 2020 12:29:23 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241229.07OCTNqj021793@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 12:29:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364660 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364660 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 12:29:24 -0000 Author: trasz Date: Mon Aug 24 12:29:23 2020 New Revision: 364660 URL: https://svnweb.freebsd.org/changeset/base/364660 Log: MFC r357203: Add TCP_CORK support to linux(4). This fixes one of the things Nginx trips over. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linux/linux_socket.c stable/12/sys/compat/linux/linux_socket.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_socket.c ============================================================================== --- stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 12:26:49 2020 (r364659) +++ stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 12:29:23 2020 (r364660) @@ -401,6 +401,8 @@ linux_to_bsd_tcp_sockopt(int opt) return (TCP_NODELAY); case LINUX_TCP_MAXSEG: return (TCP_MAXSEG); + case LINUX_TCP_CORK: + return (TCP_NOPUSH); case LINUX_TCP_KEEPIDLE: return (TCP_KEEPIDLE); case LINUX_TCP_KEEPINTVL: Modified: stable/12/sys/compat/linux/linux_socket.h ============================================================================== --- stable/12/sys/compat/linux/linux_socket.h Mon Aug 24 12:26:49 2020 (r364659) +++ stable/12/sys/compat/linux/linux_socket.h Mon Aug 24 12:29:23 2020 (r364660) @@ -248,6 +248,7 @@ int linux_accept(struct thread *td, struct linux_accep #define LINUX_TCP_NODELAY 1 #define LINUX_TCP_MAXSEG 2 +#define LINUX_TCP_CORK 3 #define LINUX_TCP_KEEPIDLE 4 #define LINUX_TCP_KEEPINTVL 5 #define LINUX_TCP_KEEPCNT 6 From owner-svn-src-stable-12@freebsd.org Mon Aug 24 12:30:44 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4A0DC3BDC12; Mon, 24 Aug 2020 12:30:44 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZs0h1J3pz4hLJ; Mon, 24 Aug 2020 12:30:44 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 1001E184DD; Mon, 24 Aug 2020 12:30:44 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OCUhH3023890; Mon, 24 Aug 2020 12:30:43 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OCUhlF023889; Mon, 24 Aug 2020 12:30:43 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241230.07OCUhlF023889@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 12:30:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364661 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364661 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 12:30:44 -0000 Author: trasz Date: Mon Aug 24 12:30:43 2020 New Revision: 364661 URL: https://svnweb.freebsd.org/changeset/base/364661 Log: MFC r362051: Make linux(4) handle SO_REUSEPORT. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linux/linux_socket.c stable/12/sys/compat/linux/linux_socket.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_socket.c ============================================================================== --- stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 12:29:23 2020 (r364660) +++ stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 12:30:43 2020 (r364661) @@ -374,6 +374,8 @@ linux_to_bsd_so_sockopt(int opt) return (SO_OOBINLINE); case LINUX_SO_LINGER: return (SO_LINGER); + case LINUX_SO_REUSEPORT: + return (SO_REUSEPORT_LB); case LINUX_SO_PEERCRED: return (LOCAL_PEERCRED); case LINUX_SO_RCVLOWAT: Modified: stable/12/sys/compat/linux/linux_socket.h ============================================================================== --- stable/12/sys/compat/linux/linux_socket.h Mon Aug 24 12:29:23 2020 (r364660) +++ stable/12/sys/compat/linux/linux_socket.h Mon Aug 24 12:30:43 2020 (r364661) @@ -196,6 +196,7 @@ int linux_accept(struct thread *td, struct linux_accep #define LINUX_SO_NO_CHECK 11 #define LINUX_SO_PRIORITY 12 #define LINUX_SO_LINGER 13 +#define LINUX_SO_REUSEPORT 15 #ifndef LINUX_SO_PASSCRED /* powerpc differs */ #define LINUX_SO_PASSCRED 16 #define LINUX_SO_PEERCRED 17 From owner-svn-src-stable-12@freebsd.org Mon Aug 24 12:33:44 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2DBC53BDCA9; Mon, 24 Aug 2020 12:33:44 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZs480VFNz4hN6; Mon, 24 Aug 2020 12:33:44 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 E85191884E; Mon, 24 Aug 2020 12:33:43 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OCXhsn028113; Mon, 24 Aug 2020 12:33:43 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OCXgNV028108; Mon, 24 Aug 2020 12:33:42 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241233.07OCXgNV028108@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 12:33:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364662 - in stable/12: share/man/man4 sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/compat/linux X-SVN-Commit-Revision: 364662 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 12:33:44 -0000 Author: trasz Date: Mon Aug 24 12:33:42 2020 New Revision: 364662 URL: https://svnweb.freebsd.org/changeset/base/364662 Log: MFC r355820: Add a hack to make ^T work for Linux binaries, enabled with 'compat.linux.preserve_vstatus=1' sysctl. Sponsored by: The FreeBSD Foundation Modified: stable/12/share/man/man4/linux.4 stable/12/sys/compat/linux/linux_ioctl.c stable/12/sys/compat/linux/linux_ioctl.h stable/12/sys/compat/linux/linux_mib.c stable/12/sys/compat/linux/linux_mib.h Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/linux.4 ============================================================================== --- stable/12/share/man/man4/linux.4 Mon Aug 24 12:30:43 2020 (r364661) +++ stable/12/share/man/man4/linux.4 Mon Aug 24 12:33:42 2020 (r364662) @@ -109,6 +109,14 @@ Recent versions of GNU libc are known to use different on the value of this sysctl. .It Va compat.linux.oss_version Linux Open Sound System version. +.It Va compat.linux.preserve_vstatus +When set to 1, it prevents Linux applications from resetting the +.Xr termios 4 +VSTATUS setting. +From a user perspective, this makes +.Va SIGINFO +work for Linux executables. +Defaults to 0. .Sh FILES .Bl -tag -width /compat/linux/dev/shm -compact .It Pa /compat/linux Modified: stable/12/sys/compat/linux/linux_ioctl.c ============================================================================== --- stable/12/sys/compat/linux/linux_ioctl.c Mon Aug 24 12:30:43 2020 (r364661) +++ stable/12/sys/compat/linux/linux_ioctl.c Mon Aug 24 12:33:42 2020 (r364662) @@ -552,6 +552,8 @@ bsd_to_linux_termios(struct termios *bios, struct linu lios->c_cc[LINUX_VDISCARD] = bios->c_cc[VDISCARD]; lios->c_cc[LINUX_VWERASE] = bios->c_cc[VWERASE]; lios->c_cc[LINUX_VLNEXT] = bios->c_cc[VLNEXT]; + if (linux_preserve_vstatus) + lios->c_cc[LINUX_VSTATUS] = bios->c_cc[VSTATUS]; for (i=0; ic_cc[VDISCARD] = lios->c_cc[LINUX_VDISCARD]; bios->c_cc[VWERASE] = lios->c_cc[LINUX_VWERASE]; bios->c_cc[VLNEXT] = lios->c_cc[LINUX_VLNEXT]; + if (linux_preserve_vstatus) + bios->c_cc[VSTATUS] = lios->c_cc[LINUX_VSTATUS]; for (i=0; i= LINUX_KERNVER_2006000) +extern int linux_preserve_vstatus; + #endif /* _LINUX_MIB_H_ */ From owner-svn-src-stable-12@freebsd.org Mon Aug 24 12:35:03 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 714F13BDAD7; Mon, 24 Aug 2020 12:35:03 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZs5g2MCnz4hg0; Mon, 24 Aug 2020 12:35:03 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 344C218850; Mon, 24 Aug 2020 12:35:03 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OCZ2al028247; Mon, 24 Aug 2020 12:35:02 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OCZ2Ck028244; Mon, 24 Aug 2020 12:35:02 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241235.07OCZ2Ck028244@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 12:35:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364663 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364663 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 12:35:03 -0000 Author: trasz Date: Mon Aug 24 12:35:02 2020 New Revision: 364663 URL: https://svnweb.freebsd.org/changeset/base/364663 Log: MFC r357202: Add compat.linux.ignore_ip_recverr sysctl. This is a workaround for missing IP_RECVERR setsockopt(2) support. Without it, DNS resolution is broken for glibc >= 2.30 (glibc BZ #24047). From the user point of view this fixes "yum update" on recent CentOS 8. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linux/linux_mib.c stable/12/sys/compat/linux/linux_mib.h stable/12/sys/compat/linux/linux_socket.c stable/12/sys/compat/linux/linux_socket.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_mib.c ============================================================================== --- stable/12/sys/compat/linux/linux_mib.c Mon Aug 24 12:33:42 2020 (r364662) +++ stable/12/sys/compat/linux/linux_mib.c Mon Aug 24 12:35:02 2020 (r364663) @@ -62,6 +62,10 @@ static unsigned linux_osd_jail_slot; SYSCTL_NODE(_compat, OID_AUTO, linux, CTLFLAG_RW, 0, "Linux mode"); +int linux_ignore_ip_recverr = 1; +SYSCTL_INT(_compat_linux, OID_AUTO, ignore_ip_recverr, CTLFLAG_RWTUN, + &linux_ignore_ip_recverr, 0, "Ignore enabling IP_RECVERR"); + int linux_preserve_vstatus = 0; SYSCTL_INT(_compat_linux, OID_AUTO, preserve_vstatus, CTLFLAG_RWTUN, &linux_preserve_vstatus, 0, "Preserve VSTATUS termios(4) flag"); Modified: stable/12/sys/compat/linux/linux_mib.h ============================================================================== --- stable/12/sys/compat/linux/linux_mib.h Mon Aug 24 12:33:42 2020 (r364662) +++ stable/12/sys/compat/linux/linux_mib.h Mon Aug 24 12:35:02 2020 (r364663) @@ -62,6 +62,7 @@ int linux_kernver(struct thread *td); #define linux_use26(t) (linux_kernver(t) >= LINUX_KERNVER_2006000) +extern int linux_ignore_ip_recverr; extern int linux_preserve_vstatus; #endif /* _LINUX_MIB_H_ */ Modified: stable/12/sys/compat/linux/linux_socket.c ============================================================================== --- stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 12:33:42 2020 (r364662) +++ stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 12:35:02 2020 (r364663) @@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$"); #include #endif #include +#include #include #include #include @@ -1569,6 +1570,14 @@ linux_setsockopt(struct thread *td, struct linux_setso } break; case IPPROTO_IP: + if (args->optname == LINUX_IP_RECVERR && + linux_ignore_ip_recverr) { + /* + * XXX: This is a hack to unbreak DNS resolution + * with glibc 2.30 and above. + */ + return (0); + } name = linux_to_bsd_ip_sockopt(args->optname); break; case IPPROTO_IPV6: Modified: stable/12/sys/compat/linux/linux_socket.h ============================================================================== --- stable/12/sys/compat/linux/linux_socket.h Mon Aug 24 12:33:42 2020 (r364662) +++ stable/12/sys/compat/linux/linux_socket.h Mon Aug 24 12:35:02 2020 (r364663) @@ -215,6 +215,7 @@ int linux_accept(struct thread *td, struct linux_accep #define LINUX_IP_TTL 2 #define LINUX_IP_HDRINCL 3 #define LINUX_IP_OPTIONS 4 +#define LINUX_IP_RECVERR 11 #define LINUX_IP_MULTICAST_IF 32 #define LINUX_IP_MULTICAST_TTL 33 From owner-svn-src-stable-12@freebsd.org Mon Aug 24 12:43:55 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 49FFA3BDF4E; Mon, 24 Aug 2020 12:43:55 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZsHv1Fb9z4jYm; Mon, 24 Aug 2020 12:43:55 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 0F10A18AB4; Mon, 24 Aug 2020 12:43:55 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OChsaR034336; Mon, 24 Aug 2020 12:43:54 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OChsIO034334; Mon, 24 Aug 2020 12:43:54 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241243.07OChsIO034334@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 12:43:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364664 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364664 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 12:43:55 -0000 Author: trasz Date: Mon Aug 24 12:43:54 2020 New Revision: 364664 URL: https://svnweb.freebsd.org/changeset/base/364664 Log: MFC r358483 by tijl: linuxulator: Map scheduler priorities to Linux priorities. On Linux the valid range of priorities for the SCHED_FIFO and SCHED_RR scheduling policies is [1,99]. For SCHED_OTHER the single valid priority is 0. On FreeBSD it is [0,31] for all policies. Programs are supposed to query the valid range using sched_get_priority_(min|max), but of course some programs assume the Linux values are valid. This commit adds a tunable compat.linux.map_sched_prio. When enabled sched_get_priority_(min|max) return the Linux values and sched_setscheduler and sched_(get|set)param translate between FreeBSD and Linux values. Because there are more Linux levels than FreeBSD levels, multiple Linux levels map to a single FreeBSD level, which means pre-emption might not happen as it does on Linux, so the tunable allows to disable this behaviour. It is enabled by default because I think it is unlikely that anyone runs real-time software under Linux emulation on FreeBSD that critically relies on correct pre-emption. This fixes FMOD, a commercial sound library used by several games. PR: 240043 Tested by: Alex S Modified: stable/12/sys/compat/linux/linux_misc.c stable/12/sys/compat/linux/linux_misc.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_misc.c ============================================================================== --- stable/12/sys/compat/linux/linux_misc.c Mon Aug 24 12:35:02 2020 (r364663) +++ stable/12/sys/compat/linux/linux_misc.c Mon Aug 24 12:43:54 2020 (r364664) @@ -143,6 +143,11 @@ struct l_pselect6arg { l_size_t ss_len; }; +static bool map_sched_prio = true; +SYSCTL_BOOL(_compat_linux, OID_AUTO, map_sched_prio, CTLFLAG_RDTUN, + &map_sched_prio, 0, "Map scheduler priorities to Linux priorities " + "(not POSIX compliant)"); + static int linux_utimensat_nsec_valid(l_long); @@ -1586,6 +1591,33 @@ linux_sched_setscheduler(struct thread *td, if (error) return (error); + if (map_sched_prio) { + switch (policy) { + case SCHED_OTHER: + if (sched_param.sched_priority != 0) + return (EINVAL); + + sched_param.sched_priority = + PRI_MAX_TIMESHARE - PRI_MIN_TIMESHARE; + break; + case SCHED_FIFO: + case SCHED_RR: + if (sched_param.sched_priority < 1 || + sched_param.sched_priority >= LINUX_MAX_RT_PRIO) + return (EINVAL); + + /* + * Map [1, LINUX_MAX_RT_PRIO - 1] to + * [0, RTP_PRIO_MAX - RTP_PRIO_MIN] (rounding down). + */ + sched_param.sched_priority = + (sched_param.sched_priority - 1) * + (RTP_PRIO_MAX - RTP_PRIO_MIN + 1) / + (LINUX_MAX_RT_PRIO - 1); + break; + } + } + tdt = linux_tdfind(td, args->pid, -1); if (tdt == NULL) return (ESRCH); @@ -1639,6 +1671,20 @@ linux_sched_get_priority_max(struct thread *td, printf(ARGS(sched_get_priority_max, "%d"), args->policy); #endif + if (map_sched_prio) { + switch (args->policy) { + case LINUX_SCHED_OTHER: + td->td_retval[0] = 0; + return (0); + case LINUX_SCHED_FIFO: + case LINUX_SCHED_RR: + td->td_retval[0] = LINUX_MAX_RT_PRIO - 1; + return (0); + default: + return (EINVAL); + } + } + switch (args->policy) { case LINUX_SCHED_OTHER: bsd.policy = SCHED_OTHER; @@ -1666,6 +1712,20 @@ linux_sched_get_priority_min(struct thread *td, printf(ARGS(sched_get_priority_min, "%d"), args->policy); #endif + if (map_sched_prio) { + switch (args->policy) { + case LINUX_SCHED_OTHER: + td->td_retval[0] = 0; + return (0); + case LINUX_SCHED_FIFO: + case LINUX_SCHED_RR: + td->td_retval[0] = 1; + return (0); + default: + return (EINVAL); + } + } + switch (args->policy) { case LINUX_SCHED_OTHER: bsd.policy = SCHED_OTHER; @@ -2123,7 +2183,7 @@ linux_sched_setparam(struct thread *td, { struct sched_param sched_param; struct thread *tdt; - int error; + int error, policy; #ifdef DEBUG if (ldebug(sched_setparam)) @@ -2138,8 +2198,41 @@ linux_sched_setparam(struct thread *td, if (tdt == NULL) return (ESRCH); + if( map_sched_prio ) { + error = kern_sched_getscheduler(td, tdt, &policy); + if (error) + goto out; + + switch (policy) { + case SCHED_OTHER: + if (sched_param.sched_priority != 0) { + error = EINVAL; + goto out; + } + sched_param.sched_priority = + PRI_MAX_TIMESHARE - PRI_MIN_TIMESHARE; + break; + case SCHED_FIFO: + case SCHED_RR: + if (sched_param.sched_priority < 1 || + sched_param.sched_priority >= LINUX_MAX_RT_PRIO) { + error = EINVAL; + goto out; + } + /* + * Map [1, LINUX_MAX_RT_PRIO - 1] to + * [0, RTP_PRIO_MAX - RTP_PRIO_MIN] (rounding down). + */ + sched_param.sched_priority = + (sched_param.sched_priority - 1) * + (RTP_PRIO_MAX - RTP_PRIO_MIN + 1) / + (LINUX_MAX_RT_PRIO - 1); + break; + } + } + error = kern_sched_setparam(td, tdt, &sched_param); - PROC_UNLOCK(tdt->td_proc); +out: PROC_UNLOCK(tdt->td_proc); return (error); } @@ -2149,7 +2242,7 @@ linux_sched_getparam(struct thread *td, { struct sched_param sched_param; struct thread *tdt; - int error; + int error, policy; #ifdef DEBUG if (ldebug(sched_getparam)) @@ -2161,10 +2254,38 @@ linux_sched_getparam(struct thread *td, return (ESRCH); error = kern_sched_getparam(td, tdt, &sched_param); - PROC_UNLOCK(tdt->td_proc); - if (error == 0) - error = copyout(&sched_param, uap->param, - sizeof(sched_param)); + if (error) { + PROC_UNLOCK(tdt->td_proc); + return (error); + } + + if (map_sched_prio) { + error = kern_sched_getscheduler(td, tdt, &policy); + PROC_UNLOCK(tdt->td_proc); + if (error) + return (error); + + switch (policy) { + case SCHED_OTHER: + sched_param.sched_priority = 0; + break; + case SCHED_FIFO: + case SCHED_RR: + /* + * Map [0, RTP_PRIO_MAX - RTP_PRIO_MIN] to + * [1, LINUX_MAX_RT_PRIO - 1] (rounding up). + */ + sched_param.sched_priority = + (sched_param.sched_priority * + (LINUX_MAX_RT_PRIO - 1) + + (RTP_PRIO_MAX - RTP_PRIO_MIN - 1)) / + (RTP_PRIO_MAX - RTP_PRIO_MIN) + 1; + break; + } + } else + PROC_UNLOCK(tdt->td_proc); + + error = copyout(&sched_param, uap->param, sizeof(sched_param)); return (error); } Modified: stable/12/sys/compat/linux/linux_misc.h ============================================================================== --- stable/12/sys/compat/linux/linux_misc.h Mon Aug 24 12:35:02 2020 (r364663) +++ stable/12/sys/compat/linux/linux_misc.h Mon Aug 24 12:43:54 2020 (r364664) @@ -105,6 +105,8 @@ extern const char *linux_kplatform; #define LINUX_SCHED_FIFO 1 #define LINUX_SCHED_RR 2 +#define LINUX_MAX_RT_PRIO 100 + struct l_new_utsname { char sysname[LINUX_MAX_UTSNAME]; char nodename[LINUX_MAX_UTSNAME]; From owner-svn-src-stable-12@freebsd.org Mon Aug 24 12:47:21 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 260B93BE22D; Mon, 24 Aug 2020 12:47:21 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZsMs0D8bz4jcs; Mon, 24 Aug 2020 12:47:21 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 DFF9518647; Mon, 24 Aug 2020 12:47:20 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OClKhU034598; Mon, 24 Aug 2020 12:47:20 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OClKjF034596; Mon, 24 Aug 2020 12:47:20 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241247.07OClKjF034596@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 12:47:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364665 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364665 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 12:47:21 -0000 Author: trasz Date: Mon Aug 24 12:47:20 2020 New Revision: 364665 URL: https://svnweb.freebsd.org/changeset/base/364665 Log: MFC r358673 by tijl: Move compat.linux.map_sched_prio sysctl definition to linux_mib.c so it is only defined by linux_common kernel module and not both linux and linux64 modules. Reported by: Yuri Pankov Modified: stable/12/sys/compat/linux/linux_mib.c stable/12/sys/compat/linux/linux_mib.h stable/12/sys/compat/linux/linux_misc.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_mib.c ============================================================================== --- stable/12/sys/compat/linux/linux_mib.c Mon Aug 24 12:43:54 2020 (r364664) +++ stable/12/sys/compat/linux/linux_mib.c Mon Aug 24 12:47:20 2020 (r364665) @@ -70,6 +70,11 @@ int linux_preserve_vstatus = 0; SYSCTL_INT(_compat_linux, OID_AUTO, preserve_vstatus, CTLFLAG_RWTUN, &linux_preserve_vstatus, 0, "Preserve VSTATUS termios(4) flag"); +bool linux_map_sched_prio = true; +SYSCTL_BOOL(_compat_linux, OID_AUTO, map_sched_prio, CTLFLAG_RDTUN, + &linux_map_sched_prio, 0, "Map scheduler priorities to Linux priorities " + "(not POSIX compliant)"); + static int linux_set_osname(struct thread *td, char *osname); static int linux_set_osrelease(struct thread *td, char *osrelease); static int linux_set_oss_version(struct thread *td, int oss_version); Modified: stable/12/sys/compat/linux/linux_mib.h ============================================================================== --- stable/12/sys/compat/linux/linux_mib.h Mon Aug 24 12:43:54 2020 (r364664) +++ stable/12/sys/compat/linux/linux_mib.h Mon Aug 24 12:47:20 2020 (r364665) @@ -64,5 +64,6 @@ int linux_kernver(struct thread *td); extern int linux_ignore_ip_recverr; extern int linux_preserve_vstatus; +extern bool linux_map_sched_prio; #endif /* _LINUX_MIB_H_ */ Modified: stable/12/sys/compat/linux/linux_misc.c ============================================================================== --- stable/12/sys/compat/linux/linux_misc.c Mon Aug 24 12:43:54 2020 (r364664) +++ stable/12/sys/compat/linux/linux_misc.c Mon Aug 24 12:47:20 2020 (r364665) @@ -143,11 +143,6 @@ struct l_pselect6arg { l_size_t ss_len; }; -static bool map_sched_prio = true; -SYSCTL_BOOL(_compat_linux, OID_AUTO, map_sched_prio, CTLFLAG_RDTUN, - &map_sched_prio, 0, "Map scheduler priorities to Linux priorities " - "(not POSIX compliant)"); - static int linux_utimensat_nsec_valid(l_long); @@ -1591,7 +1586,7 @@ linux_sched_setscheduler(struct thread *td, if (error) return (error); - if (map_sched_prio) { + if (linux_map_sched_prio) { switch (policy) { case SCHED_OTHER: if (sched_param.sched_priority != 0) @@ -1671,7 +1666,7 @@ linux_sched_get_priority_max(struct thread *td, printf(ARGS(sched_get_priority_max, "%d"), args->policy); #endif - if (map_sched_prio) { + if (linux_map_sched_prio) { switch (args->policy) { case LINUX_SCHED_OTHER: td->td_retval[0] = 0; @@ -1712,7 +1707,7 @@ linux_sched_get_priority_min(struct thread *td, printf(ARGS(sched_get_priority_min, "%d"), args->policy); #endif - if (map_sched_prio) { + if (linux_map_sched_prio) { switch (args->policy) { case LINUX_SCHED_OTHER: td->td_retval[0] = 0; @@ -2198,7 +2193,7 @@ linux_sched_setparam(struct thread *td, if (tdt == NULL) return (ESRCH); - if( map_sched_prio ) { + if (linux_map_sched_prio) { error = kern_sched_getscheduler(td, tdt, &policy); if (error) goto out; @@ -2259,7 +2254,7 @@ linux_sched_getparam(struct thread *td, return (error); } - if (map_sched_prio) { + if (linux_map_sched_prio) { error = kern_sched_getscheduler(td, tdt, &policy); PROC_UNLOCK(tdt->td_proc); if (error) From owner-svn-src-stable-12@freebsd.org Mon Aug 24 12:49:52 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BED853BE42F; Mon, 24 Aug 2020 12:49:52 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZsQm3DQDz4jc5; Mon, 24 Aug 2020 12:49:52 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 5384318CCA; Mon, 24 Aug 2020 12:49:52 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OCnqHV034767; Mon, 24 Aug 2020 12:49:52 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OCnpOq034763; Mon, 24 Aug 2020 12:49:51 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241249.07OCnpOq034763@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 12:49:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364666 - in stable/12: share/man/man4 sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/compat/linux X-SVN-Commit-Revision: 364666 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 12:49:52 -0000 Author: trasz Date: Mon Aug 24 12:49:51 2020 New Revision: 364666 URL: https://svnweb.freebsd.org/changeset/base/364666 Log: MFC r362015: Make linux(4) set the openfiles soft resource limit to 1024 for Linux applications, which often depend on this being the case. There's a new sysctl, compat.linux.default_openfiles, to control this behaviour. Sponsored by: The FreeBSD Foundation Modified: stable/12/share/man/man4/linux.4 stable/12/sys/compat/linux/linux_emul.c stable/12/sys/compat/linux/linux_mib.c stable/12/sys/compat/linux/linux_mib.h Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/linux.4 ============================================================================== --- stable/12/share/man/man4/linux.4 Mon Aug 24 12:47:20 2020 (r364665) +++ stable/12/share/man/man4/linux.4 Mon Aug 24 12:49:51 2020 (r364666) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 16, 2019 +.Dd June 10, 2020 .Dt LINUX 4 .Os .Sh NAME @@ -95,6 +95,10 @@ variables and .Xr loader 8 tunables: .Bl -tag -width indent +.It Va compat.linux.default_openfiles +Default soft openfiles resource limit for Linux applications. +Set to -1 to disable the limit. +Defaults to 1024. .It Va compat.linux.emul_path Path to the Linux run-time environment. Defaults to Modified: stable/12/sys/compat/linux/linux_emul.c ============================================================================== --- stable/12/sys/compat/linux/linux_emul.c Mon Aug 24 12:47:20 2020 (r364665) +++ stable/12/sys/compat/linux/linux_emul.c Mon Aug 24 12:49:51 2020 (r364666) @@ -42,10 +42,12 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include +#include #include #include #include @@ -87,6 +89,32 @@ pem_find(struct proc *p) return (pem); } +/* + * Linux apps generally expect the soft open file limit to be set + * to 1024, often iterating over all the file descriptors up to that + * limit instead of using closefrom(2). Give them what they want, + * unless there already is a resource limit in place. + */ +static void +linux_set_default_openfiles(struct thread *td, struct proc *p) +{ + struct rlimit rlim; + int error; + + if (linux_default_openfiles < 0) + return; + + PROC_LOCK(p); + lim_rlimit_proc(p, RLIMIT_NOFILE, &rlim); + PROC_UNLOCK(p); + if (rlim.rlim_cur != rlim.rlim_max || + rlim.rlim_cur <= linux_default_openfiles) + return; + rlim.rlim_cur = linux_default_openfiles; + error = kern_proc_setrlimit(td, p, RLIMIT_NOFILE, &rlim); + KASSERT(error == 0, ("kern_proc_setrlimit failed")); +} + void linux_proc_init(struct thread *td, struct thread *newtd, int flags) { @@ -115,6 +143,8 @@ linux_proc_init(struct thread *td, struct thread *newt p->p_emuldata = pem; } newtd->td_emuldata = em; + + linux_set_default_openfiles(td, p); } else { p = td->td_proc; Modified: stable/12/sys/compat/linux/linux_mib.c ============================================================================== --- stable/12/sys/compat/linux/linux_mib.c Mon Aug 24 12:47:20 2020 (r364665) +++ stable/12/sys/compat/linux/linux_mib.c Mon Aug 24 12:49:51 2020 (r364666) @@ -62,6 +62,11 @@ static unsigned linux_osd_jail_slot; SYSCTL_NODE(_compat, OID_AUTO, linux, CTLFLAG_RW, 0, "Linux mode"); +int linux_default_openfiles = 1024; +SYSCTL_INT(_compat_linux, OID_AUTO, default_openfiles, CTLFLAG_RWTUN, + &linux_default_openfiles, 0, + "Default soft openfiles resource limit, or -1 for unlimited"); + int linux_ignore_ip_recverr = 1; SYSCTL_INT(_compat_linux, OID_AUTO, ignore_ip_recverr, CTLFLAG_RWTUN, &linux_ignore_ip_recverr, 0, "Ignore enabling IP_RECVERR"); Modified: stable/12/sys/compat/linux/linux_mib.h ============================================================================== --- stable/12/sys/compat/linux/linux_mib.h Mon Aug 24 12:47:20 2020 (r364665) +++ stable/12/sys/compat/linux/linux_mib.h Mon Aug 24 12:49:51 2020 (r364666) @@ -62,6 +62,7 @@ int linux_kernver(struct thread *td); #define linux_use26(t) (linux_kernver(t) >= LINUX_KERNVER_2006000) +extern int linux_default_openfiles; extern int linux_ignore_ip_recverr; extern int linux_preserve_vstatus; extern bool linux_map_sched_prio; From owner-svn-src-stable-12@freebsd.org Mon Aug 24 12:51:21 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9640C3BE5DB; Mon, 24 Aug 2020 12:51:21 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZsST3ST2z4kK3; Mon, 24 Aug 2020 12:51:21 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 5A11C18870; Mon, 24 Aug 2020 12:51:21 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OCpLNJ037170; Mon, 24 Aug 2020 12:51:21 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OCpKa2037166; Mon, 24 Aug 2020 12:51:20 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241251.07OCpKa2037166@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 12:51:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364667 - in stable/12: share/man/man4 sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/compat/linux X-SVN-Commit-Revision: 364667 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 12:51:21 -0000 Author: trasz Date: Mon Aug 24 12:51:20 2020 New Revision: 364667 URL: https://svnweb.freebsd.org/changeset/base/364667 Log: MFC r362104: Add compat.linux.debug sysctl, to make it possible to silence down the debug messages. While here, clean up some variable naming. Sponsored by: The FreeBSD Foundation Modified: stable/12/share/man/man4/linux.4 stable/12/sys/compat/linux/linux_mib.c stable/12/sys/compat/linux/linux_mib.h stable/12/sys/compat/linux/linux_util.c Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/linux.4 ============================================================================== --- stable/12/share/man/man4/linux.4 Mon Aug 24 12:49:51 2020 (r364666) +++ stable/12/share/man/man4/linux.4 Mon Aug 24 12:51:20 2020 (r364667) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 10, 2020 +.Dd June 12, 2020 .Dt LINUX 4 .Os .Sh NAME @@ -95,6 +95,10 @@ variables and .Xr loader 8 tunables: .Bl -tag -width indent +.It Va compat.linux.debug +Enable debugging messages. +Set to 0 to silence them. +Defaults to 1. .It Va compat.linux.default_openfiles Default soft openfiles resource limit for Linux applications. Set to -1 to disable the limit. Modified: stable/12/sys/compat/linux/linux_mib.c ============================================================================== --- stable/12/sys/compat/linux/linux_mib.c Mon Aug 24 12:49:51 2020 (r364666) +++ stable/12/sys/compat/linux/linux_mib.c Mon Aug 24 12:51:20 2020 (r364667) @@ -62,6 +62,10 @@ static unsigned linux_osd_jail_slot; SYSCTL_NODE(_compat, OID_AUTO, linux, CTLFLAG_RW, 0, "Linux mode"); +int linux_debug = 1; +SYSCTL_INT(_compat_linux, OID_AUTO, debug, CTLFLAG_RWTUN, + &linux_debug, 0, "Log warnings from linux(4); or 0 to disable"); + int linux_default_openfiles = 1024; SYSCTL_INT(_compat_linux, OID_AUTO, default_openfiles, CTLFLAG_RWTUN, &linux_default_openfiles, 0, Modified: stable/12/sys/compat/linux/linux_mib.h ============================================================================== --- stable/12/sys/compat/linux/linux_mib.h Mon Aug 24 12:49:51 2020 (r364666) +++ stable/12/sys/compat/linux/linux_mib.h Mon Aug 24 12:51:20 2020 (r364667) @@ -62,6 +62,7 @@ int linux_kernver(struct thread *td); #define linux_use26(t) (linux_kernver(t) >= LINUX_KERNVER_2006000) +extern int linux_debug; extern int linux_default_openfiles; extern int linux_ignore_ip_recverr; extern int linux_preserve_vstatus; Modified: stable/12/sys/compat/linux/linux_util.c ============================================================================== --- stable/12/sys/compat/linux/linux_util.c Mon Aug 24 12:49:51 2020 (r364666) +++ stable/12/sys/compat/linux/linux_util.c Mon Aug 24 12:51:20 2020 (r364667) @@ -91,6 +91,9 @@ linux_msg(const struct thread *td, const char *fmt, .. va_list ap; struct proc *p; + if (linux_debug == 0) + return; + p = td->td_proc; printf("linux: pid %d (%s): ", (int)p->p_pid, p->p_comm); va_start(ap, fmt); From owner-svn-src-stable-12@freebsd.org Mon Aug 24 12:54:20 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 92D8B3BE7D9; Mon, 24 Aug 2020 12:54:20 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZsWw3JjTz4ksY; Mon, 24 Aug 2020 12:54:20 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 55A3218ED8; Mon, 24 Aug 2020 12:54:20 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OCsKr3041486; Mon, 24 Aug 2020 12:54:20 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OCsKXb041485; Mon, 24 Aug 2020 12:54:20 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241254.07OCsKXb041485@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 12:54:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364668 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364668 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 12:54:20 -0000 Author: trasz Date: Mon Aug 24 12:54:19 2020 New Revision: 364668 URL: https://svnweb.freebsd.org/changeset/base/364668 Log: MFC r362205: Make Linux uname(2) return x86_64 to 32-bit apps. This helps Steam. PR: kern/240432 Analyzed by: Alex S Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linux/linux_misc.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_misc.c ============================================================================== --- stable/12/sys/compat/linux/linux_misc.c Mon Aug 24 12:51:20 2020 (r364667) +++ stable/12/sys/compat/linux/linux_misc.c Mon Aug 24 12:54:19 2020 (r364668) @@ -776,7 +776,17 @@ linux_newuname(struct thread *td, struct linux_newunam *p = '\0'; break; } +#if defined(__amd64__) + /* + * On amd64, Linux uname(2) needs to return "x86_64" + * for both 64-bit and 32-bit applications. On 32-bit, + * the string returned by getauxval(AT_PLATFORM) needs + * to remain "i686", though. + */ + strlcpy(utsname.machine, "x86_64", LINUX_MAX_UTSNAME); +#else strlcpy(utsname.machine, linux_kplatform, LINUX_MAX_UTSNAME); +#endif return (copyout(&utsname, args->buf, sizeof(utsname))); } From owner-svn-src-stable-12@freebsd.org Mon Aug 24 12:57:03 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C29D53BEB17; Mon, 24 Aug 2020 12:57:03 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZsb34nVkz4l7L; Mon, 24 Aug 2020 12:57:03 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 88D8F18AD5; Mon, 24 Aug 2020 12:57:03 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OCv30e041910; Mon, 24 Aug 2020 12:57:03 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OCv32a041909; Mon, 24 Aug 2020 12:57:03 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241257.07OCv32a041909@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 12:57:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364669 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364669 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 12:57:03 -0000 Author: trasz Date: Mon Aug 24 12:57:03 2020 New Revision: 364669 URL: https://svnweb.freebsd.org/changeset/base/364669 Log: MFC r349746: Fix linuxulator prlimit64(2) with pid == 0. This makes 'ulimit -a' return something reasonable, and helps linux binaries which attempt to close all the files, eg apt(8). Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linux/linux_misc.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_misc.c ============================================================================== --- stable/12/sys/compat/linux/linux_misc.c Mon Aug 24 12:54:19 2020 (r364668) +++ stable/12/sys/compat/linux/linux_misc.c Mon Aug 24 12:57:03 2020 (r364669) @@ -2397,10 +2397,14 @@ linux_prlimit64(struct thread *td, struct linux_prlimi flags |= PGET_CANDEBUG; else flags |= PGET_CANSEE; - error = pget(args->pid, flags, &p); - if (error != 0) - return (error); - + if (args->pid == 0) { + p = td->td_proc; + PHOLD(p); + } else { + error = pget(args->pid, flags, &p); + if (error != 0) + return (error); + } if (args->old != NULL) { PROC_LOCK(p); lim_rlimit_proc(p, which, &rlim); From owner-svn-src-stable-12@freebsd.org Mon Aug 24 12:59:16 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 62D003BEACB; Mon, 24 Aug 2020 12:59:16 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZsdc20bsz4lbH; Mon, 24 Aug 2020 12:59:16 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 27DEE18DCC; Mon, 24 Aug 2020 12:59:16 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OCxGSw042384; Mon, 24 Aug 2020 12:59:16 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OCxF4O042383; Mon, 24 Aug 2020 12:59:15 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241259.07OCxF4O042383@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 12:59:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364670 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364670 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 12:59:16 -0000 Author: trasz Date: Mon Aug 24 12:59:15 2020 New Revision: 364670 URL: https://svnweb.freebsd.org/changeset/base/364670 Log: MFC r349750: Return ENOTSUP for Linux FS_IOC_FIEMAP ioctl. Linux man(1) calls it for no good reason; this avoids the console spam (eg '(man): ioctl fd=4, cmd=0x660b ('f',11) is not implemented'). Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linux/linux_ioctl.c stable/12/sys/compat/linux/linux_ioctl.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_ioctl.c ============================================================================== --- stable/12/sys/compat/linux/linux_ioctl.c Mon Aug 24 12:57:03 2020 (r364669) +++ stable/12/sys/compat/linux/linux_ioctl.c Mon Aug 24 12:59:15 2020 (r364670) @@ -3706,6 +3706,7 @@ linux_ioctl(struct thread *td, struct linux_ioctl_args switch (args->cmd & 0xffff) { case LINUX_BTRFS_IOC_CLONE: + case LINUX_FS_IOC_FIEMAP: return (ENOTSUP); default: Modified: stable/12/sys/compat/linux/linux_ioctl.h ============================================================================== --- stable/12/sys/compat/linux/linux_ioctl.h Mon Aug 24 12:57:03 2020 (r364669) +++ stable/12/sys/compat/linux/linux_ioctl.h Mon Aug 24 12:59:15 2020 (r364670) @@ -753,6 +753,7 @@ * Linux btrfs clone operation */ #define LINUX_BTRFS_IOC_CLONE 0x9409 /* 0x40049409 */ +#define LINUX_FS_IOC_FIEMAP 0x660b /* * Linux evdev ioctl min and max From owner-svn-src-stable-12@freebsd.org Mon Aug 24 12:59:57 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F1B1A3BEC76; Mon, 24 Aug 2020 12:59:57 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZsfP5DQwz4lt1; Mon, 24 Aug 2020 12:59:57 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 7DD1918EE0; Mon, 24 Aug 2020 12:59:57 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OCxvmT042578; Mon, 24 Aug 2020 12:59:57 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OCxt1i042570; Mon, 24 Aug 2020 12:59:55 GMT (envelope-from manu@FreeBSD.org) Message-Id: <202008241259.07OCxt1i042570@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 24 Aug 2020 12:59:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364671 - in stable/12/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src conf libkern sys X-SVN-Group: stable-12 X-SVN-Commit-Author: manu X-SVN-Commit-Paths: in stable/12/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src conf libkern sys X-SVN-Commit-Revision: 364671 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 12:59:58 -0000 Author: manu Date: Mon Aug 24 12:59:55 2020 New Revision: 364671 URL: https://svnweb.freebsd.org/changeset/base/364671 Log: MFC r361247, r361343, r361418-r361419, r361422, r361449 r361247: linuxkpi: Add irq_work.h Since handlers are call in a thread context we can simply use a workqueue to emulate those functions. The DRM code was patched to do that already, having it in linuxkpi allows us to not patch the upstream code. Sponsored-by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D24859 r361343: linuxkpi: Add rcu_work functions The rcu_work function helps to queue some work after waiting for a grace period. This is needed by DRM drivers. Sponsored-by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D24942 r361418: libkern: Add arc4random_uniform This variant get a random number up to the limit passed as the argument. This is simply a copy of the libc version. Sponsored-by: The FreeBSD Foundation Reviewed by: cem, hselasky (previous version) Differential Revision: https://reviews.freebsd.org/D24962 r361419: linuxkpi: Add prandom_u32_max This is just a wrapper around arc4random_uniform Needed by DRM v5.3 Sponsored-by: The FreeBSD Foundation Reviewed by: cem, hselasky Differential Revision: https://reviews.freebsd.org/D24961 r361422: bbr: Use arc4random_uniform from libkern. This unbreak LINT build Reported by: jenkins, melifaro r361449: linuxkpi: Add __same_type and __must_be_array macros The same_type macro simply wraps around builtin_types_compatible_p which exist for both GCC and CLANG, which returns 1 if both types are the same. The __must_be_array macros returns 1 if the argument is an array. This is needed for DRM v5.3 Sponsored-by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D24953 Added: stable/12/sys/compat/linuxkpi/common/include/linux/irq_work.h - copied unchanged from r361247, head/sys/compat/linuxkpi/common/include/linux/irq_work.h stable/12/sys/libkern/arc4random_uniform.c - copied unchanged from r361419, head/sys/libkern/arc4random_uniform.c Modified: stable/12/sys/compat/linuxkpi/common/include/linux/compiler.h stable/12/sys/compat/linuxkpi/common/include/linux/random.h stable/12/sys/compat/linuxkpi/common/include/linux/workqueue.h stable/12/sys/compat/linuxkpi/common/src/linux_work.c stable/12/sys/conf/files stable/12/sys/sys/libkern.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/compiler.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/compiler.h Mon Aug 24 12:59:15 2020 (r364670) +++ stable/12/sys/compat/linuxkpi/common/include/linux/compiler.h Mon Aug 24 12:59:55 2020 (r364671) @@ -111,4 +111,7 @@ #define _AT(T,X) ((T)(X)) +#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) +#define __must_be_array(a) __same_type(a, &(a)[0]) + #endif /* _LINUX_COMPILER_H_ */ Copied: stable/12/sys/compat/linuxkpi/common/include/linux/irq_work.h (from r361247, head/sys/compat/linuxkpi/common/include/linux/irq_work.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/compat/linuxkpi/common/include/linux/irq_work.h Mon Aug 24 12:59:55 2020 (r364671, copy of r361247, head/sys/compat/linuxkpi/common/include/linux/irq_work.h) @@ -0,0 +1,52 @@ +/*- + * Copyright (c) 2020 The FreeBSD Foundation + * + * This software was developed by Emmanuel Vadot under sponsorship + * from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __LINUX_IRQ_WORK_H__ +#define __LINUX_IRQ_WORK_H__ + +#include + +struct irq_work { + struct work_struct work; +}; + +static inline void +init_irq_work(struct irq_work *irqw, void (*func)(struct irq_work *)) +{ + INIT_WORK(&irqw->work, (work_func_t)func); +} + +static inline void +irq_work_queue(struct irq_work *irqw) +{ + schedule_work(&irqw->work); +} + +#endif /* __LINUX_IRQ_WORK_H__ */ Modified: stable/12/sys/compat/linuxkpi/common/include/linux/random.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/random.h Mon Aug 24 12:59:15 2020 (r364670) +++ stable/12/sys/compat/linuxkpi/common/include/linux/random.h Mon Aug 24 12:59:55 2020 (r364671) @@ -63,4 +63,10 @@ get_random_long(void) return (val); } +static inline u32 +prandom_u32_max(u32 max) +{ + return (arc4random_uniform(max)); +} + #endif /* _LINUX_RANDOM_H_ */ Modified: stable/12/sys/compat/linuxkpi/common/include/linux/workqueue.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/workqueue.h Mon Aug 24 12:59:15 2020 (r364670) +++ stable/12/sys/compat/linuxkpi/common/include/linux/workqueue.h Mon Aug 24 12:59:55 2020 (r364671) @@ -72,6 +72,13 @@ struct work_struct { atomic_t state; }; +struct rcu_work { + struct work_struct work; + struct rcu_head rcu; + + struct workqueue_struct *wq; +}; + #define DECLARE_WORK(name, fn) \ struct work_struct name; \ static void name##_init(void *arg) \ @@ -111,6 +118,9 @@ do { \ TASK_INIT(&(work)->work_task, 0, linux_work_fn, (work)); \ } while (0) +#define INIT_RCU_WORK(_work, _fn) \ + INIT_WORK(&(_work)->work, (_fn)) + #define INIT_WORK_ONSTACK(work, fn) \ INIT_WORK(work, fn) @@ -191,6 +201,12 @@ do { \ #define flush_work(work) \ linux_flush_work(work) +#define queue_rcu_work(wq, rwork) \ + linux_queue_rcu_work(wq, rwork) + +#define flush_rcu_work(rwork) \ + linux_flush_rcu_work(rwork) + #define flush_delayed_work(dwork) \ linux_flush_delayed_work(dwork) @@ -236,5 +252,7 @@ extern bool linux_flush_delayed_work(struct delayed_wo extern bool linux_work_pending(struct work_struct *); extern bool linux_work_busy(struct work_struct *); extern struct work_struct *linux_current_work(void); +extern bool linux_queue_rcu_work(struct workqueue_struct *wq, struct rcu_work *rwork); +extern bool linux_flush_rcu_work(struct rcu_work *rwork); #endif /* _LINUX_WORKQUEUE_H_ */ Modified: stable/12/sys/compat/linuxkpi/common/src/linux_work.c ============================================================================== --- stable/12/sys/compat/linuxkpi/common/src/linux_work.c Mon Aug 24 12:59:15 2020 (r364670) +++ stable/12/sys/compat/linuxkpi/common/src/linux_work.c Mon Aug 24 12:59:55 2020 (r364671) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -153,6 +154,53 @@ linux_queue_work_on(int cpu __unused, struct workqueue default: return (false); /* already on a queue */ } +} + +/* + * Callback func for linux_queue_rcu_work + */ +static void +rcu_work_func(struct rcu_head *rcu) +{ + struct rcu_work *rwork; + + rwork = container_of(rcu, struct rcu_work, rcu); + linux_queue_work_on(WORK_CPU_UNBOUND, rwork->wq, &rwork->work); +} + +/* + * This function queue a work after a grace period + * If the work was already pending it returns false, + * if not it calls call_rcu and returns true. + */ +bool +linux_queue_rcu_work(struct workqueue_struct *wq, struct rcu_work *rwork) +{ + + if (!linux_work_pending(&rwork->work)) { + rwork->wq = wq; + linux_call_rcu(RCU_TYPE_REGULAR, &rwork->rcu, rcu_work_func); + return (true); + } + return (false); +} + +/* + * This function waits for the last execution of a work and then + * flush the work. + * It returns true if the work was pending and we waited, it returns + * false otherwise. + */ +bool +linux_flush_rcu_work(struct rcu_work *rwork) +{ + + if (linux_work_pending(&rwork->work)) { + linux_rcu_barrier(RCU_TYPE_REGULAR); + linux_flush_work(&rwork->work); + return (true); + } + return (linux_flush_work(&rwork->work)); } /* Modified: stable/12/sys/conf/files ============================================================================== --- stable/12/sys/conf/files Mon Aug 24 12:59:15 2020 (r364670) +++ stable/12/sys/conf/files Mon Aug 24 12:59:55 2020 (r364671) @@ -4071,6 +4071,7 @@ kgssapi/gsstest.c optional kgssapi_debug # the file should be moved to conf/files. from here. # libkern/arc4random.c standard +libkern/arc4random_uniform.c standard crypto/chacha20/chacha.c standard libkern/asprintf.c standard libkern/bcd.c standard Copied: stable/12/sys/libkern/arc4random_uniform.c (from r361419, head/sys/libkern/arc4random_uniform.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/libkern/arc4random_uniform.c Mon Aug 24 12:59:55 2020 (r364671, copy of r361419, head/sys/libkern/arc4random_uniform.c) @@ -0,0 +1,58 @@ +/* $OpenBSD: arc4random_uniform.c,v 1.3 2019/01/20 02:59:07 bcook Exp $ */ + +/* + * Copyright (c) 2008, Damien Miller + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * $FreeBSD$ + */ + +#include +#include + +/* + * Calculate a uniformly distributed random number less than upper_bound + * avoiding "modulo bias". + * + * Uniformity is achieved by generating new random numbers until the one + * returned is outside the range [0, 2**32 % upper_bound). This + * guarantees the selected random number will be inside + * [2**32 % upper_bound, 2**32) which maps back to [0, upper_bound) + * after reduction modulo upper_bound. + */ +uint32_t +arc4random_uniform(uint32_t upper_bound) +{ + uint32_t r, min; + + if (upper_bound < 2) + return 0; + + /* 2**32 % x == (2**32 - x) % x */ + min = -upper_bound % upper_bound; + + /* + * This could theoretically loop forever but each retry has + * p > 0.5 (worst case, usually far better) of selecting a + * number inside the range we need, so it should rarely need + * to re-roll. + */ + for (;;) { + r = arc4random(); + if (r >= min) + break; + } + + return r % upper_bound; +} Modified: stable/12/sys/sys/libkern.h ============================================================================== --- stable/12/sys/sys/libkern.h Mon Aug 24 12:59:15 2020 (r364670) +++ stable/12/sys/sys/libkern.h Mon Aug 24 12:59:55 2020 (r364671) @@ -127,6 +127,7 @@ extern int arc4rand_iniseed_state; struct malloc_type; uint32_t arc4random(void); void arc4random_buf(void *, size_t); +uint32_t arc4random_uniform(uint32_t); void arc4rand(void *, u_int, int); int timingsafe_bcmp(const void *, const void *, size_t); void *bsearch(const void *, const void *, size_t, From owner-svn-src-stable-12@freebsd.org Mon Aug 24 13:14:40 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 033373BF4AA; Mon, 24 Aug 2020 13:14:40 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZszM6HGmz4mVZ; Mon, 24 Aug 2020 13:14:39 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 BAE48191A1; Mon, 24 Aug 2020 13:14:39 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07ODEdkI054843; Mon, 24 Aug 2020 13:14:39 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07ODEcon054838; Mon, 24 Aug 2020 13:14:38 GMT (envelope-from manu@FreeBSD.org) Message-Id: <202008241314.07ODEcon054838@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 24 Aug 2020 13:14:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364672 - in stable/12/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: stable-12 X-SVN-Commit-Author: manu X-SVN-Commit-Paths: in stable/12/sys/compat/linuxkpi/common: include/linux src X-SVN-Commit-Revision: 364672 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 13:14:40 -0000 Author: manu Date: Mon Aug 24 13:14:38 2020 New Revision: 364672 URL: https://svnweb.freebsd.org/changeset/base/364672 Log: MFC r361450, r361452, r361550-r361551 r361450: linuxkpi: Add refcount.h Implement some refcount functions needed by drm. Just use the atomic_t struct and functions from linuxkpi for simplicity. Sponsored-by: The FreeBSD Foundation Reviewed by: hselsasky Differential Revision: https://reviews.freebsd.org/D24985 r361452: linuxkpi: Fix mod_timer and del_timer_sync mod_timer is supposed to return 1 if the modified timer was pending, which is exactly what callout_reset does so return the value after checking that it's a correct one in case the api change. del_timer_sync returns int so add a function and handle that. Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D24983 r361550: linuxkpi: Add rcu_swap_protected This macros swap an rcu pointer with a normal pointer. The condition only seems to be used for debug/warning under linux, ignore for now. Sponsored-by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D24954 r361551: linuxkpi: Add kstrtou16 This function convert a char * to a u16. Simply use strtoul and cast to compare for ERANGE Sponsored-by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D24996 Added: stable/12/sys/compat/linuxkpi/common/include/linux/refcount.h - copied unchanged from r361450, head/sys/compat/linuxkpi/common/include/linux/refcount.h Modified: stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h stable/12/sys/compat/linuxkpi/common/include/linux/rcupdate.h stable/12/sys/compat/linuxkpi/common/include/linux/timer.h stable/12/sys/compat/linuxkpi/common/src/linux_compat.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h Mon Aug 24 12:59:55 2020 (r364671) +++ stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h Mon Aug 24 13:14:38 2020 (r364672) @@ -377,6 +377,24 @@ kstrtouint(const char *cp, unsigned int base, unsigned } static inline int +kstrtou16(const char *cp, unsigned int base, u16 *res) +{ + char *end; + unsigned long temp; + + *res = temp = strtoul(cp, &end, base); + + /* skip newline character, if any */ + if (*end == '\n') + end++; + if (*cp == 0 || *end != 0) + return (-EINVAL); + if (temp != (u16)temp) + return (-ERANGE); + return (0); +} + +static inline int kstrtou32(const char *cp, unsigned int base, u32 *res) { char *end; Modified: stable/12/sys/compat/linuxkpi/common/include/linux/rcupdate.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/rcupdate.h Mon Aug 24 12:59:55 2020 (r364671) +++ stable/12/sys/compat/linuxkpi/common/include/linux/rcupdate.h Mon Aug 24 13:14:38 2020 (r364672) @@ -97,6 +97,12 @@ (uintptr_t)(v)); \ } while (0) +#define rcu_swap_protected(rcu, ptr, c) do { \ + typeof(ptr) p = rcu_dereference_protected(rcu, c); \ + rcu_assign_pointer(rcu, ptr); \ + (ptr) = p; \ +} while (0) + /* prototypes */ extern void linux_call_rcu(unsigned type, struct rcu_head *ptr, rcu_callback_t func); Copied: stable/12/sys/compat/linuxkpi/common/include/linux/refcount.h (from r361450, head/sys/compat/linuxkpi/common/include/linux/refcount.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/compat/linuxkpi/common/include/linux/refcount.h Mon Aug 24 13:14:38 2020 (r364672, copy of r361450, head/sys/compat/linuxkpi/common/include/linux/refcount.h) @@ -0,0 +1,82 @@ +/*- + * Copyright (c) 2020 The FreeBSD Foundation + * + * This software was developed by Emmanuel Vadot under sponsorship + * from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _LINUX_REFCOUNT_H +#define _LINUX_REFCOUNT_H + +#include + +struct refcount_linux { + atomic_t value; +}; +typedef struct refcount_linux refcount_t; + +static inline void +refcount_set(refcount_t *ref, unsigned int i) +{ + atomic_set(&ref->value, i); +} + +static inline void +refcount_inc(refcount_t *ref) +{ + atomic_inc(&ref->value); +} + +static inline bool +refcount_inc_not_zero(refcount_t *ref) +{ + return (atomic_inc_not_zero(&ref->value)); +} + +static inline void +refcount_dec(refcount_t *ref) +{ + atomic_dec(&ref->value); +} + +static inline unsigned int +refcount_read(refcount_t *ref) +{ + return atomic_read(&ref->value); +} + +static inline bool +refcount_dec_and_lock_irqsave(refcount_t *ref, spinlock_t *lock, + unsigned long *flags) +{ + if (atomic_dec_and_test(&ref->value) == true) { + spin_lock_irqsave(lock, flags); + return (true); + } + return (false); +} + +#endif /* __LINUX_REFCOUNT_H__ */ Modified: stable/12/sys/compat/linuxkpi/common/include/linux/timer.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/timer.h Mon Aug 24 12:59:55 2020 (r364671) +++ stable/12/sys/compat/linuxkpi/common/include/linux/timer.h Mon Aug 24 13:14:38 2020 (r364672) @@ -78,12 +78,12 @@ extern unsigned long linux_timer_hz_mask; callout_init(&(timer)->callout, 1); \ } while (0) -extern void mod_timer(struct timer_list *, int); +extern int mod_timer(struct timer_list *, int); extern void add_timer(struct timer_list *); extern void add_timer_on(struct timer_list *, int cpu); extern int del_timer(struct timer_list *); +extern int del_timer_sync(struct timer_list *); -#define del_timer_sync(timer) (void)callout_drain(&(timer)->callout) #define timer_pending(timer) callout_pending(&(timer)->callout) #define round_jiffies(j) \ ((int)(((j) + linux_timer_hz_mask) & ~linux_timer_hz_mask)) Modified: stable/12/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- stable/12/sys/compat/linuxkpi/common/src/linux_compat.c Mon Aug 24 12:59:55 2020 (r364671) +++ stable/12/sys/compat/linuxkpi/common/src/linux_compat.c Mon Aug 24 13:14:38 2020 (r364672) @@ -1903,14 +1903,19 @@ linux_timer_callback_wrapper(void *context) timer->function(timer->data); } -void +int mod_timer(struct timer_list *timer, int expires) { + int ret; timer->expires = expires; - callout_reset(&timer->callout, + ret = callout_reset(&timer->callout, linux_timer_jiffies_until(expires), &linux_timer_callback_wrapper, timer); + + MPASS(ret == 0 || ret == 1); + + return (ret == 1); } void @@ -1936,6 +1941,15 @@ del_timer(struct timer_list *timer) { if (callout_stop(&(timer)->callout) == -1) + return (0); + return (1); +} + +int +del_timer_sync(struct timer_list *timer) +{ + + if (callout_drain(&(timer)->callout) == -1) return (0); return (1); } From owner-svn-src-stable-12@freebsd.org Mon Aug 24 13:19:19 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9BFD03BF803; Mon, 24 Aug 2020 13:19:19 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZt4l3vpkz4n03; Mon, 24 Aug 2020 13:19:19 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 697B81929D; Mon, 24 Aug 2020 13:19:19 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07ODJJCw055196; Mon, 24 Aug 2020 13:19:19 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07ODJHDN055185; Mon, 24 Aug 2020 13:19:17 GMT (envelope-from manu@FreeBSD.org) Message-Id: <202008241319.07ODJHDN055185@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 24 Aug 2020 13:19:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364674 - in stable/12/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: stable-12 X-SVN-Commit-Author: manu X-SVN-Commit-Paths: in stable/12/sys/compat/linuxkpi/common: include/linux src X-SVN-Commit-Revision: 364674 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 13:19:19 -0000 Author: manu Date: Mon Aug 24 13:19:16 2020 New Revision: 364674 URL: https://svnweb.freebsd.org/changeset/base/364674 Log: MFC r363564-r363567, r363575, r363835-r363837, r363842-r363843, r364232 r363564: linuxkpi: Include linux/sizes.h in dma-mapping.h Linux does the same, this avoids ifdef or extra includes in ported drivers. Reviewed by: emaste, hselasky Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25701 r363565: linuxkpi: Include hardirq.h in preempt.h and lockdep.h in hardirq.h Linux does the same, this avoids ifdef or extra includes in ported drivers. Reviewed by: emaste, hselasky Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25702 r363566: linuxkpi: Add taint* defines This isn't used for us but allow us to port drivers more easily. Reviewed by: hselasky Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25703 r363567: Revert r363564 linux/sizes.h doesn't exists in base ... sorry. r363575: Fix r363565 lockdep.h needs sys/lock.h for LOCK_CLASS r363835: linuxkpi: Add linux/sizes.h This file contain some defines for common sizes. Sponsored-by: The FreeBSD Foundation Reviewed by: hselasky, emaste Differential Revision: https://reviews.freebsd.org/D25941 r363836: linuxkpi: Add kref_put_lock Same as kref_put but in addition to calling the rel function it will acquire the lock first. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky, emaste Differential Revision: https://reviews.freebsd.org/D25942 r363837: linuxkpi: Add nested variant of mutex_lock_interruptible We don't do anything with the _nesteds variant so just call mutex_lock_interruptible Sponsoredby: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D25944 r363842: linuxkpi: Add clear_bit_unlock This calls clear_bit and adds a memory barrier. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D25943 r363843: linuxkpi: Add time_after32 and time_before32 This compare two 32 bits times Sponsored by: The FreeBSD Foundation Reviewed by: kib, hselasky Differential Revision: https://reviews.freebsd.org/D25700 r364232: linuxkpi: Add a few wait_bit functions The linux function does a lot more than that as multiple waitqueue could be fetch from a static table based on the hash of the argument but since in DRM it's only used in one place just add a single variable. We will probably need to change that in the futur but it's ok with DRM even with current linux. Reviewed by: hselasky Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26054 Added: stable/12/sys/compat/linuxkpi/common/include/linux/sizes.h - copied unchanged from r363837, head/sys/compat/linuxkpi/common/include/linux/sizes.h stable/12/sys/compat/linuxkpi/common/include/linux/wait_bit.h - copied unchanged from r364232, head/sys/compat/linuxkpi/common/include/linux/wait_bit.h Modified: stable/12/sys/compat/linuxkpi/common/include/linux/bitops.h stable/12/sys/compat/linuxkpi/common/include/linux/hardirq.h stable/12/sys/compat/linuxkpi/common/include/linux/jiffies.h stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h stable/12/sys/compat/linuxkpi/common/include/linux/kref.h stable/12/sys/compat/linuxkpi/common/include/linux/lockdep.h stable/12/sys/compat/linuxkpi/common/include/linux/mutex.h stable/12/sys/compat/linuxkpi/common/include/linux/preempt.h stable/12/sys/compat/linuxkpi/common/include/linux/wait.h stable/12/sys/compat/linuxkpi/common/src/linux_compat.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/bitops.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/bitops.h Mon Aug 24 13:15:08 2020 (r364673) +++ stable/12/sys/compat/linuxkpi/common/include/linux/bitops.h Mon Aug 24 13:19:16 2020 (r364674) @@ -275,6 +275,13 @@ find_next_zero_bit(const unsigned long *addr, unsigned #define test_bit(i, a) \ !!(READ_ONCE(((volatile const unsigned long *)(a))[BIT_WORD(i)]) & BIT_MASK(i)) +static inline void +clear_bit_unlock(long bit, volatile unsigned long *var) +{ + clear_bit(bit, var); + wmb(); +} + static inline int test_and_clear_bit(long bit, volatile unsigned long *var) { Modified: stable/12/sys/compat/linuxkpi/common/include/linux/hardirq.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/hardirq.h Mon Aug 24 13:15:08 2020 (r364673) +++ stable/12/sys/compat/linuxkpi/common/include/linux/hardirq.h Mon Aug 24 13:19:16 2020 (r364674) @@ -32,6 +32,7 @@ #define _LINUX_HARDIRQ_H_ #include +#include #include #include Modified: stable/12/sys/compat/linuxkpi/common/include/linux/jiffies.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/jiffies.h Mon Aug 24 13:15:08 2020 (r364673) +++ stable/12/sys/compat/linuxkpi/common/include/linux/jiffies.h Mon Aug 24 13:19:16 2020 (r364674) @@ -45,7 +45,9 @@ #define MAX_JIFFY_OFFSET ((INT_MAX >> 1) - 1) #define time_after(a, b) ((int)((b) - (a)) < 0) +#define time_after32(a, b) ((int32_t)((uint32_t)(b) - (uint32_t)(a)) < 0) #define time_before(a, b) time_after(b,a) +#define time_before32(a, b) time_after32(b, a) #define time_after_eq(a, b) ((int)((a) - (b)) >= 0) #define time_before_eq(a, b) time_after_eq(b, a) #define time_in_range(a,b,c) \ Modified: stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h Mon Aug 24 13:15:08 2020 (r364673) +++ stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h Mon Aug 24 13:19:16 2020 (r364674) @@ -593,4 +593,7 @@ linux_ratelimited(linux_ratelimit_t *rl) (is_signed(datatype) ? INT8_MIN : 0) \ ) +#define TAINT_WARN 0 +#define test_taint(x) (0) + #endif /* _LINUX_KERNEL_H_ */ Modified: stable/12/sys/compat/linuxkpi/common/include/linux/kref.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/kref.h Mon Aug 24 13:15:08 2020 (r364673) +++ stable/12/sys/compat/linuxkpi/common/include/linux/kref.h Mon Aug 24 13:19:16 2020 (r364674) @@ -38,6 +38,7 @@ #include #include #include +#include #include @@ -76,6 +77,20 @@ kref_put(struct kref *kref, void (*rel)(struct kref *k } return 0; } + +static inline int +kref_put_lock(struct kref *kref, void (*rel)(struct kref *kref), + spinlock_t *lock) +{ + + if (refcount_release(&kref->refcount.counter)) { + spin_lock(lock); + rel(kref); + return (1); + } + return (0); +} + static inline int kref_sub(struct kref *kref, unsigned int count, Modified: stable/12/sys/compat/linuxkpi/common/include/linux/lockdep.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/lockdep.h Mon Aug 24 13:15:08 2020 (r364673) +++ stable/12/sys/compat/linuxkpi/common/include/linux/lockdep.h Mon Aug 24 13:19:16 2020 (r364674) @@ -32,6 +32,8 @@ #ifndef _LINUX_LOCKDEP_H_ #define _LINUX_LOCKDEP_H_ +#include + struct lock_class_key { }; Modified: stable/12/sys/compat/linuxkpi/common/include/linux/mutex.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/mutex.h Mon Aug 24 13:15:08 2020 (r364673) +++ stable/12/sys/compat/linuxkpi/common/include/linux/mutex.h Mon Aug 24 13:19:16 2020 (r364674) @@ -67,6 +67,8 @@ typedef struct mutex { linux_mutex_lock_interruptible(_m); \ }) +#define mutex_lock_interruptible_nested(m, c) mutex_lock_interruptible(m) + /* * Reuse the interruptable method since the SX * lock handles both signals and interrupts: Modified: stable/12/sys/compat/linuxkpi/common/include/linux/preempt.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/preempt.h Mon Aug 24 13:15:08 2020 (r364673) +++ stable/12/sys/compat/linuxkpi/common/include/linux/preempt.h Mon Aug 24 13:19:16 2020 (r364674) @@ -29,6 +29,7 @@ #ifndef _LINUX_PREEMPT_H_ #define _LINUX_PREEMPT_H_ +#include #include #define in_interrupt() \ Copied: stable/12/sys/compat/linuxkpi/common/include/linux/sizes.h (from r363837, head/sys/compat/linuxkpi/common/include/linux/sizes.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/compat/linuxkpi/common/include/linux/sizes.h Mon Aug 24 13:19:16 2020 (r364674, copy of r363837, head/sys/compat/linuxkpi/common/include/linux/sizes.h) @@ -0,0 +1,51 @@ +/*- + * Copyright (c) 2020 The FreeBSD Foundation + * + * This software was developed by Emmanuel Vadot under sponsorship + * from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __LINUX_SIZES_H__ +#define __LINUX_SIZES_H__ + +#define SZ_1K (1024 * 1) +#define SZ_4K (1024 * 4) +#define SZ_8K (1024 * 8) +#define SZ_16K (1024 * 16) +#define SZ_32K (1024 * 32) +#define SZ_64K (1024 * 64) +#define SZ_128K (1024 * 128) +#define SZ_256K (1024 * 256) +#define SZ_512K (1024 * 512) + +#define SZ_1M (1024 * 1024 * 1) +#define SZ_2M (1024 * 1024 * 2) +#define SZ_8M (1024 * 1024 * 8) +#define SZ_16M (1024 * 1024 * 16) +#define SZ_32M (1024 * 1024 * 32) +#define SZ_64M (1024 * 1024 * 64) + +#endif Modified: stable/12/sys/compat/linuxkpi/common/include/linux/wait.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/wait.h Mon Aug 24 13:15:08 2020 (r364673) +++ stable/12/sys/compat/linuxkpi/common/include/linux/wait.h Mon Aug 24 13:19:16 2020 (r364674) @@ -36,6 +36,7 @@ #include #include #include +#include #include Copied: stable/12/sys/compat/linuxkpi/common/include/linux/wait_bit.h (from r364232, head/sys/compat/linuxkpi/common/include/linux/wait_bit.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/compat/linuxkpi/common/include/linux/wait_bit.h Mon Aug 24 13:19:16 2020 (r364674, copy of r364232, head/sys/compat/linuxkpi/common/include/linux/wait_bit.h) @@ -0,0 +1,64 @@ +/*- + * Copyright (c) 2020 The FreeBSD Foundation + * + * This software was developed by Emmanuel Vadot under sponsorship + * from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __LINUX_WAITBIT_H__ +#define __LINUX_WAITBIT_H__ + +#include +#include + +extern wait_queue_head_t linux_bit_waitq; +extern wait_queue_head_t linux_var_waitq; + +#define wait_var_event_killable(var, cond) \ + wait_event_killable(linux_var_waitq, cond) + +static inline void +clear_and_wake_up_bit(int bit, void *word) +{ + clear_bit_unlock(bit, word); + wake_up_bit(word, bit); +} + +static inline wait_queue_head_t * +bit_waitqueue(void *word, int bit) +{ + + return (&linux_bit_waitq); +} + +static inline void +wake_up_var(void *var) +{ + + wake_up(&linux_var_waitq); +} + +#endif /* __LINUX_WAITBIT_H__ */ Modified: stable/12/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- stable/12/sys/compat/linuxkpi/common/src/linux_compat.c Mon Aug 24 13:15:08 2020 (r364673) +++ stable/12/sys/compat/linuxkpi/common/src/linux_compat.c Mon Aug 24 13:19:16 2020 (r364674) @@ -85,6 +85,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #if defined(__i386__) || defined(__amd64__) #include @@ -117,6 +118,9 @@ spinlock_t pci_lock; unsigned long linux_timer_hz_mask; +wait_queue_head_t linux_bit_waitq; +wait_queue_head_t linux_var_waitq; + int panic_cmp(struct rb_node *one, struct rb_node *two) { @@ -2523,6 +2527,8 @@ linux_compat_init(void *arg) mtx_init(&vmmaplock, "IO Map lock", NULL, MTX_DEF); for (i = 0; i < VMMAP_HASH_SIZE; i++) LIST_INIT(&vmmaphead[i]); + init_waitqueue_head(&linux_bit_waitq); + init_waitqueue_head(&linux_var_waitq); } SYSINIT(linux_compat, SI_SUB_DRIVERS, SI_ORDER_SECOND, linux_compat_init, NULL); From owner-svn-src-stable-12@freebsd.org Mon Aug 24 13:50:56 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9D8EF3C087D; Mon, 24 Aug 2020 13:50:56 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZtnD3VtDz4q1C; Mon, 24 Aug 2020 13:50:56 +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 5C805197F2; Mon, 24 Aug 2020 13:50:56 +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 07ODouGh075062; Mon, 24 Aug 2020 13:50:56 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07ODotGn075061; Mon, 24 Aug 2020 13:50:55 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008241350.07ODotGn075061@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 24 Aug 2020 13:50:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364676 - stable/12/sys/dev/asmc X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/dev/asmc X-SVN-Commit-Revision: 364676 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 13:50:56 -0000 Author: markj Date: Mon Aug 24 13:50:55 2020 New Revision: 364676 URL: https://svnweb.freebsd.org/changeset/base/364676 Log: MFC r364300: asmc(4): Add support for MacBook7,1. PR: 248693 Modified: stable/12/sys/dev/asmc/asmc.c stable/12/sys/dev/asmc/asmcvar.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/asmc/asmc.c ============================================================================== --- stable/12/sys/dev/asmc/asmc.c Mon Aug 24 13:40:35 2020 (r364675) +++ stable/12/sys/dev/asmc/asmc.c Mon Aug 24 13:50:55 2020 (r364676) @@ -173,6 +173,12 @@ struct asmc_model asmc_models[] = { }, { + "MacBook7,1", "Apple SMC MacBook Core 2 Duo (mid 2010)", + ASMC_SMS_FUNCS, ASMC_FAN_FUNCS2, ASMC_LIGHT_FUNCS_DISABLED, + ASMC_MB71_TEMPS, ASMC_MB71_TEMPNAMES, ASMC_MB71_TEMPDESCS + }, + + { "MacBookPro1,1", "Apple SMC MacBook Pro Core Duo (15-inch)", ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, ASMC_LIGHT_FUNCS, ASMC_MBP_TEMPS, ASMC_MBP_TEMPNAMES, ASMC_MBP_TEMPDESCS Modified: stable/12/sys/dev/asmc/asmcvar.h ============================================================================== --- stable/12/sys/dev/asmc/asmcvar.h Mon Aug 24 13:40:35 2020 (r364675) +++ stable/12/sys/dev/asmc/asmcvar.h Mon Aug 24 13:50:55 2020 (r364676) @@ -158,6 +158,21 @@ struct asmc_softc { "Heatsink 1","Heatsink 2" \ "Memory Bank A", } +#define ASMC_MB71_TEMPS { "TB0T", "TB1T", "TB2T", "TC0D", "TC0P", \ + "TH0P", "TN0D", "TN0P", "TN0S", "TN1D", \ + "TN1E", "TN1F", "TN1G", "TN1S", "Th1H", \ + "Ts0P", "Ts0S", NULL } + +#define ASMC_MB71_TEMPNAMES { "enclosure_bottom0", "battery_1", "battery_2", "cpu_package", "cpu_proximity", \ + "hdd_bay", "northbridge0_diode", "northbridge0_proximity", "TN0S", "mpc_die2", \ + "TN1E", "TN1F", "TN1G", "TN1S", "heatsink1", \ + "palm_rest", "memory_proximity", } + +#define ASMC_MB71_TEMPDESCS { "Enclosure Bottom 0", "Battery 1", "Battery 2", "CPU Package", "CPU Proximity", \ + "HDD Bay", "Northbridge Diode", "Northbridge Proximity", "TN0S", "MPC Die 2", \ + "TN1E", "TN1F", "TN1G", "TN1S", "Heatsink 1", \ + "Palm Rest", "Memory Proximity", } + #define ASMC_MBP_TEMPS { "TB0T", "Th0H", "Th1H", "Tm0P", \ "TG0H", "TG0P", "TG0T", NULL } From owner-svn-src-stable-12@freebsd.org Mon Aug 24 13:52:48 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2389E3C0957; Mon, 24 Aug 2020 13:52:48 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZtqN08jLz4qRT; Mon, 24 Aug 2020 13:52:48 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 DD00719370; Mon, 24 Aug 2020 13:52:47 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07ODqlxY079547; Mon, 24 Aug 2020 13:52:47 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07ODql7S079546; Mon, 24 Aug 2020 13:52:47 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241352.07ODql7S079546@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 13:52:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364677 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364677 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 13:52:48 -0000 Author: trasz Date: Mon Aug 24 13:52:47 2020 New Revision: 364677 URL: https://svnweb.freebsd.org/changeset/base/364677 Log: MFC r354732: Support O_CLOEXEC in linux(4) open(2) and openat(2). Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linux/linux_file.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_file.c ============================================================================== --- stable/12/sys/compat/linux/linux_file.c Mon Aug 24 13:50:55 2020 (r364676) +++ stable/12/sys/compat/linux/linux_file.c Mon Aug 24 13:52:47 2020 (r364677) @@ -112,6 +112,8 @@ linux_common_open(struct thread *td, int dirfd, char * bsd_flags |= O_APPEND; if (l_flags & LINUX_O_SYNC) bsd_flags |= O_FSYNC; + if (l_flags & LINUX_O_CLOEXEC) + bsd_flags |= O_CLOEXEC; if (l_flags & LINUX_O_NONBLOCK) bsd_flags |= O_NONBLOCK; if (l_flags & LINUX_FASYNC) From owner-svn-src-stable-12@freebsd.org Mon Aug 24 13:54:42 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 022993C0AD2; Mon, 24 Aug 2020 13:54:42 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZtsY5qLkz4qQB; Mon, 24 Aug 2020 13:54:41 +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 ACBDF194E7; Mon, 24 Aug 2020 13:54:41 +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 07ODsfwL079693; Mon, 24 Aug 2020 13:54:41 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07ODsfuV079692; Mon, 24 Aug 2020 13:54:41 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008241354.07ODsfuV079692@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 24 Aug 2020 13:54:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364678 - stable/12/usr.bin/cpuset X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/usr.bin/cpuset X-SVN-Commit-Revision: 364678 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 13:54:42 -0000 Author: markj Date: Mon Aug 24 13:54:41 2020 New Revision: 364678 URL: https://svnweb.freebsd.org/changeset/base/364678 Log: MFC r364304: cpuset(1): Update the usage message. Modified: stable/12/usr.bin/cpuset/cpuset.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/cpuset/cpuset.c ============================================================================== --- stable/12/usr.bin/cpuset/cpuset.c Mon Aug 24 13:52:47 2020 (r364677) +++ stable/12/usr.bin/cpuset/cpuset.c Mon Aug 24 13:54:41 2020 (r364678) @@ -458,15 +458,16 @@ usage(void) { fprintf(stderr, - "usage: cpuset [-l cpu-list] [-s setid] cmd ...\n"); + "usage: cpuset [-l cpu-list] [-n policy:domain-list] [-s setid] cmd ...\n"); fprintf(stderr, - " cpuset [-l cpu-list] [-s setid] -p pid\n"); + " cpuset [-l cpu-list] [-n policy:domain-list] [-s setid] -p pid\n"); fprintf(stderr, - " cpuset [-c] [-l cpu-list] -C -p pid\n"); + " cpuset [-c] [-l cpu-list] [-n policy:domain-list] -C -p pid\n"); fprintf(stderr, - " cpuset [-c] [-l cpu-list] [-j jailid | -p pid | -t tid | -s setid | -x irq]\n"); + " cpuset [-c] [-l cpu-list] [-n policy:domain-list]\n" + " [-j jailid | -p pid | -t tid | -s setid | -x irq]\n"); fprintf(stderr, - " cpuset -g [-cir] [-d domain | -j jailid | -p pid | -t tid | -s setid |\n" - " -x irq]\n"); + " cpuset -g [-cir]\n" + " [-d domain | -j jailid | -p pid | -t tid | -s setid | -x irq]\n"); exit(1); } From owner-svn-src-stable-12@freebsd.org Mon Aug 24 13:54:59 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2863D3C0E82; Mon, 24 Aug 2020 13:54:59 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZtsv0LtLz4qsS; Mon, 24 Aug 2020 13:54:59 +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 E36B819A0D; Mon, 24 Aug 2020 13:54:58 +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 07ODsw57079760; Mon, 24 Aug 2020 13:54:58 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07ODswNa079759; Mon, 24 Aug 2020 13:54:58 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008241354.07ODswNa079759@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 24 Aug 2020 13:54:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364679 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364679 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 13:54:59 -0000 Author: markj Date: Mon Aug 24 13:54:58 2020 New Revision: 364679 URL: https://svnweb.freebsd.org/changeset/base/364679 Log: MFC r364328: Fix a lock leak when emulating futex(FUTEX_WAIT_BITSET). Modified: stable/12/sys/compat/linux/linux_futex.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_futex.c ============================================================================== --- stable/12/sys/compat/linux/linux_futex.c Mon Aug 24 13:54:41 2020 (r364678) +++ stable/12/sys/compat/linux/linux_futex.c Mon Aug 24 13:54:58 2020 (r364679) @@ -643,6 +643,7 @@ futex_wait(struct futex *f, struct waiting_proc *wp, s if (bitset == 0) { LIN_SDT_PROBE1(futex, futex_wait, return, EINVAL); + futex_put(f, wp); return (EINVAL); } From owner-svn-src-stable-12@freebsd.org Mon Aug 24 13:55:24 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B2A013C0AEE; Mon, 24 Aug 2020 13:55:24 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZttN4MByz4qt1; Mon, 24 Aug 2020 13:55:24 +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 7A58E19822; Mon, 24 Aug 2020 13:55:24 +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 07ODtOVf079866; Mon, 24 Aug 2020 13:55:24 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07ODtO9g079865; Mon, 24 Aug 2020 13:55:24 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008241355.07ODtO9g079865@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 24 Aug 2020 13:55:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364680 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364680 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 13:55:24 -0000 Author: markj Date: Mon Aug 24 13:55:24 2020 New Revision: 364680 URL: https://svnweb.freebsd.org/changeset/base/364680 Log: MFC r364329: Remove "emulation" of clone(CLONE_PARENT | CLONE_THREAD). Modified: stable/12/sys/compat/linux/linux_fork.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_fork.c ============================================================================== --- stable/12/sys/compat/linux/linux_fork.c Mon Aug 24 13:54:58 2020 (r364679) +++ stable/12/sys/compat/linux/linux_fork.c Mon Aug 24 13:55:24 2020 (r364680) @@ -280,6 +280,8 @@ linux_clone_thread(struct thread *td, struct linux_clo td->td_tid, (unsigned)args->flags, args->parent_tidptr, args->child_tidptr); + if ((args->flags & LINUX_CLONE_PARENT) != 0) + return (EINVAL); if (args->flags & LINUX_CLONE_PARENT_SETTID) if (args->parent_tidptr == NULL) return (EINVAL); @@ -342,12 +344,8 @@ linux_clone_thread(struct thread *td, struct linux_clo PROC_LOCK(p); p->p_flag |= P_HADTHREADS; + thread_link(newtd, p); bcopy(p->p_comm, newtd->td_name, sizeof(newtd->td_name)); - - if (args->flags & LINUX_CLONE_PARENT) - thread_link(newtd, p->p_pptr); - else - thread_link(newtd, p); thread_lock(td); /* let the scheduler know about these things. */ From owner-svn-src-stable-12@freebsd.org Mon Aug 24 14:01:53 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 80D1D3C104F; Mon, 24 Aug 2020 14:01:53 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZv1s2qmVz4rVQ; Mon, 24 Aug 2020 14:01:53 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 451ED1982D; Mon, 24 Aug 2020 14:01:53 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OE1rJb084148; Mon, 24 Aug 2020 14:01:53 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OE1qsp084146; Mon, 24 Aug 2020 14:01:52 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241401.07OE1qsp084146@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 14:01:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364683 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364683 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 14:01:53 -0000 Author: trasz Date: Mon Aug 24 14:01:52 2020 New Revision: 364683 URL: https://svnweb.freebsd.org/changeset/base/364683 Log: MFC r362055: Replace LINUX_FASYNC with LINUX_O_ASYNC; no functional changes. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linux/linux_file.c stable/12/sys/compat/linux/linux_file.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_file.c ============================================================================== --- stable/12/sys/compat/linux/linux_file.c Mon Aug 24 14:00:12 2020 (r364682) +++ stable/12/sys/compat/linux/linux_file.c Mon Aug 24 14:01:52 2020 (r364683) @@ -116,7 +116,7 @@ linux_common_open(struct thread *td, int dirfd, char * bsd_flags |= O_CLOEXEC; if (l_flags & LINUX_O_NONBLOCK) bsd_flags |= O_NONBLOCK; - if (l_flags & LINUX_FASYNC) + if (l_flags & LINUX_O_ASYNC) bsd_flags |= O_ASYNC; if (l_flags & LINUX_O_CREAT) bsd_flags |= O_CREAT; @@ -1406,7 +1406,7 @@ fcntl_common(struct thread *td, struct linux_fcntl_arg if (result & O_FSYNC) td->td_retval[0] |= LINUX_O_SYNC; if (result & O_ASYNC) - td->td_retval[0] |= LINUX_FASYNC; + td->td_retval[0] |= LINUX_O_ASYNC; #ifdef LINUX_O_NOFOLLOW if (result & O_NOFOLLOW) td->td_retval[0] |= LINUX_O_NOFOLLOW; @@ -1425,7 +1425,7 @@ fcntl_common(struct thread *td, struct linux_fcntl_arg arg |= O_APPEND; if (args->arg & LINUX_O_SYNC) arg |= O_FSYNC; - if (args->arg & LINUX_FASYNC) + if (args->arg & LINUX_O_ASYNC) arg |= O_ASYNC; #ifdef LINUX_O_NOFOLLOW if (args->arg & LINUX_O_NOFOLLOW) Modified: stable/12/sys/compat/linux/linux_file.h ============================================================================== --- stable/12/sys/compat/linux/linux_file.h Mon Aug 24 14:00:12 2020 (r364682) +++ stable/12/sys/compat/linux/linux_file.h Mon Aug 24 14:01:52 2020 (r364683) @@ -71,7 +71,7 @@ #define LINUX_O_NONBLOCK 00004000 #define LINUX_O_NDELAY LINUX_O_NONBLOCK #define LINUX_O_SYNC 00010000 -#define LINUX_FASYNC 00020000 +#define LINUX_O_ASYNC 00020000 #define LINUX_O_DIRECT 00040000 /* Direct disk access hint */ #define LINUX_O_LARGEFILE 00100000 #define LINUX_O_DIRECTORY 00200000 /* Must be a directory */ From owner-svn-src-stable-12@freebsd.org Mon Aug 24 14:05:46 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 23DB03C12AD; Mon, 24 Aug 2020 14:05:46 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZv6L06xZz4rbH; Mon, 24 Aug 2020 14:05:46 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 DB17D19D14; Mon, 24 Aug 2020 14:05:45 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OE5jeT086026; Mon, 24 Aug 2020 14:05:45 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OE5jrU086025; Mon, 24 Aug 2020 14:05:45 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241405.07OE5jrU086025@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 14:05:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364685 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364685 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 14:05:46 -0000 Author: trasz Date: Mon Aug 24 14:05:45 2020 New Revision: 364685 URL: https://svnweb.freebsd.org/changeset/base/364685 Log: MFC r354805: Make linux(4) open(2)/openat(2) return ELOOP instead of EMLINK, when being passed O_NOFOLLOW. This fixes LTP testcase openat02:5. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linux/linux_file.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_file.c ============================================================================== --- stable/12/sys/compat/linux/linux_file.c Mon Aug 24 14:04:59 2020 (r364684) +++ stable/12/sys/compat/linux/linux_file.c Mon Aug 24 14:05:45 2020 (r364685) @@ -135,8 +135,11 @@ linux_common_open(struct thread *td, int dirfd, char * /* XXX LINUX_O_NOATIME: unable to be easily implemented. */ error = kern_openat(td, dirfd, path, UIO_SYSSPACE, bsd_flags, mode); - if (error != 0) + if (error != 0) { + if (error == EMLINK) + error = ELOOP; goto done; + } if (bsd_flags & O_NOCTTY) goto done; From owner-svn-src-stable-12@freebsd.org Mon Aug 24 14:13:21 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 22EB43C10F6; Mon, 24 Aug 2020 14:13:21 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZvH509r7z4s5S; Mon, 24 Aug 2020 14:13:21 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 DD7CB19A4F; Mon, 24 Aug 2020 14:13:20 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OEDKeE092134; Mon, 24 Aug 2020 14:13:20 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OEDK8m092133; Mon, 24 Aug 2020 14:13:20 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241413.07OEDK8m092133@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 14:13:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364686 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364686 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 14:13:21 -0000 Author: trasz Date: Mon Aug 24 14:13:20 2020 New Revision: 364686 URL: https://svnweb.freebsd.org/changeset/base/364686 Log: MFC r356727: Make linux getcpu(2) report the domain. Submitted by: markj Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linux/linux_misc.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_misc.c ============================================================================== --- stable/12/sys/compat/linux/linux_misc.c Mon Aug 24 14:05:45 2020 (r364685) +++ stable/12/sys/compat/linux/linux_misc.c Mon Aug 24 14:13:20 2020 (r364686) @@ -2829,7 +2829,7 @@ linux_getcpu(struct thread *td, struct linux_getcpu_ar cpu = td->td_oncpu; /* Make sure it doesn't change during copyout(9) */ error = 0; - node = 0; /* XXX: Fake NUMA node 0 for now */ + node = cpuid_to_pcpu[cpu]->pc_domain; if (args->cpu != NULL) error = copyout(&cpu, args->cpu, sizeof(l_int)); From owner-svn-src-stable-12@freebsd.org Mon Aug 24 14:17:25 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B8B963C17C1; Mon, 24 Aug 2020 14:17:25 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZvMn4Sntz4sQ6; Mon, 24 Aug 2020 14:17:25 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 7C78219D2D; Mon, 24 Aug 2020 14:17:25 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OEHPqB092380; Mon, 24 Aug 2020 14:17:25 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OEHPVC092379; Mon, 24 Aug 2020 14:17:25 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241417.07OEHPVC092379@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 14:17:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364687 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364687 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 14:17:25 -0000 Author: trasz Date: Mon Aug 24 14:17:25 2020 New Revision: 364687 URL: https://svnweb.freebsd.org/changeset/base/364687 Log: MFC r357491 by dchagin: linux_to_native_clockid() properly initializes nwhich variable (or return error), so don't initialize nwhich in declaration and remove stale comment from r161304. Modified: stable/12/sys/compat/linux/linux_time.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_time.c ============================================================================== --- stable/12/sys/compat/linux/linux_time.c Mon Aug 24 14:13:20 2020 (r364686) +++ stable/12/sys/compat/linux/linux_time.c Mon Aug 24 14:17:25 2020 (r364687) @@ -253,7 +253,7 @@ linux_clock_gettime(struct thread *td, struct linux_cl struct thread *targettd; struct proc *p; int error, clockwhich; - clockid_t nwhich = 0; /* XXX: GCC */ + clockid_t nwhich; pid_t pid; lwpid_t tid; @@ -382,7 +382,7 @@ linux_clock_settime(struct thread *td, struct linux_cl struct timespec ts; struct l_timespec lts; int error; - clockid_t nwhich = 0; /* XXX: GCC */ + clockid_t nwhich; LIN_SDT_PROBE2(time, linux_clock_settime, entry, args->which, args->tp); @@ -422,7 +422,7 @@ linux_clock_getres(struct thread *td, struct linux_clo struct timespec ts; struct l_timespec lts; int error, clockwhich; - clockid_t nwhich = 0; /* XXX: GCC */ + clockid_t nwhich; pid_t pid; lwpid_t tid; From owner-svn-src-stable-12@freebsd.org Mon Aug 24 14:26:49 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BD6943C1B16; Mon, 24 Aug 2020 14:26:49 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZvZd4YLLz4t59; Mon, 24 Aug 2020 14:26:49 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 80B5119D41; Mon, 24 Aug 2020 14:26:49 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OEQnQW098379; Mon, 24 Aug 2020 14:26:49 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OEQn1h098378; Mon, 24 Aug 2020 14:26:49 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241426.07OEQn1h098378@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 14:26:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364688 - in stable/12/sys: kern sys X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in stable/12/sys: kern sys X-SVN-Commit-Revision: 364688 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 14:26:49 -0000 Author: trasz Date: Mon Aug 24 14:26:48 2020 New Revision: 364688 URL: https://svnweb.freebsd.org/changeset/base/364688 Log: MFC r357492 by dchagin: For code reuse in Linuxulator rename get_proccess_cputime() and get_thread_cputime() and add prototypes for it to . As both functions become a public interface add process lock assert to ensure that the process is not exiting under it. Fix whitespace nit while here. Modified: stable/12/sys/kern/kern_time.c stable/12/sys/sys/syscallsubr.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_time.c ============================================================================== --- stable/12/sys/kern/kern_time.c Mon Aug 24 14:17:25 2020 (r364687) +++ stable/12/sys/kern/kern_time.c Mon Aug 24 14:26:48 2020 (r364688) @@ -243,7 +243,7 @@ sys_clock_gettime(struct thread *td, struct clock_gett return (error); } -static inline void +static inline void cputick2timespec(uint64_t runtime, struct timespec *ats) { runtime = cputick2usec(runtime); @@ -251,12 +251,15 @@ cputick2timespec(uint64_t runtime, struct timespec *at ats->tv_nsec = runtime % 1000000 * 1000; } -static void -get_thread_cputime(struct thread *targettd, struct timespec *ats) +void +kern_thread_cputime(struct thread *targettd, struct timespec *ats) { uint64_t runtime, curtime, switchtime; + struct proc *p; if (targettd == NULL) { /* current thread */ + p = curthread->td_proc; + PROC_LOCK_ASSERT(p, MA_OWNED); critical_enter(); switchtime = PCPU_GET(switchtime); curtime = cpu_ticks(); @@ -264,6 +267,8 @@ get_thread_cputime(struct thread *targettd, struct tim critical_exit(); runtime += curtime - switchtime; } else { + p = targettd->td_proc; + PROC_LOCK_ASSERT(p, MA_OWNED); thread_lock(targettd); runtime = targettd->td_runtime; thread_unlock(targettd); @@ -271,12 +276,13 @@ get_thread_cputime(struct thread *targettd, struct tim cputick2timespec(runtime, ats); } -static void -get_process_cputime(struct proc *targetp, struct timespec *ats) +void +kern_process_cputime(struct proc *targetp, struct timespec *ats) { uint64_t runtime; struct rusage ru; + PROC_LOCK_ASSERT(targetp, MA_OWNED); PROC_STATLOCK(targetp); rufetch(targetp, &ru); runtime = targetp->p_rux.rux_runtime; @@ -301,14 +307,14 @@ get_cputime(struct thread *td, clockid_t clock_id, str td2 = tdfind(tid, p->p_pid); if (td2 == NULL) return (EINVAL); - get_thread_cputime(td2, ats); + kern_thread_cputime(td2, ats); PROC_UNLOCK(td2->td_proc); } else { pid = clock_id & CPUCLOCK_ID_MASK; error = pget(pid, PGET_CANSEE, &p2); if (error != 0) return (EINVAL); - get_process_cputime(p2, ats); + kern_process_cputime(p2, ats); PROC_UNLOCK(p2); } return (0); @@ -361,11 +367,11 @@ kern_clock_gettime(struct thread *td, clockid_t clock_ ats->tv_nsec = 0; break; case CLOCK_THREAD_CPUTIME_ID: - get_thread_cputime(NULL, ats); + kern_thread_cputime(NULL, ats); break; case CLOCK_PROCESS_CPUTIME_ID: PROC_LOCK(p); - get_process_cputime(p, ats); + kern_process_cputime(p, ats); PROC_UNLOCK(p); break; default: Modified: stable/12/sys/sys/syscallsubr.h ============================================================================== --- stable/12/sys/sys/syscallsubr.h Mon Aug 24 14:17:25 2020 (r364687) +++ stable/12/sys/sys/syscallsubr.h Mon Aug 24 14:26:48 2020 (r364688) @@ -93,6 +93,8 @@ int kern_clock_nanosleep(struct thread *td, clockid_t const struct timespec *rqtp, struct timespec *rmtp); int kern_clock_settime(struct thread *td, clockid_t clock_id, struct timespec *ats); +void kern_thread_cputime(struct thread *targettd, struct timespec *ats); +void kern_process_cputime(struct proc *targetp, struct timespec *ats); int kern_close_range(struct thread *td, u_int lowfd, u_int highfd); int kern_close(struct thread *td, int fd); int kern_connectat(struct thread *td, int dirfd, int fd, From owner-svn-src-stable-12@freebsd.org Mon Aug 24 14:48:54 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E515A3C3340; Mon, 24 Aug 2020 14:48:54 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZw465kbwz4vwT; Mon, 24 Aug 2020 14:48:54 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 A80DE1A222; Mon, 24 Aug 2020 14:48:54 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OEms1k011361; Mon, 24 Aug 2020 14:48:54 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OEmsYl011360; Mon, 24 Aug 2020 14:48:54 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241448.07OEmsYl011360@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 14:48:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364689 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364689 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 14:48:55 -0000 Author: trasz Date: Mon Aug 24 14:48:54 2020 New Revision: 364689 URL: https://svnweb.freebsd.org/changeset/base/364689 Log: MFC r357493 by dchagin: Fix clock_gettime() and clock_getres() for cpu clocks: - handle the CLOCK_{PROCESS,THREAD}_CPUTIME_ID specified directly; - fix thread id calculation as in the Linuxulator we should convert the user supplied thread id to struct thread * by linux_tdfind(); - fix CPUCLOCK_SCHED case by using kern_{process,thread}_cputime() directly as native get_cputime() used by kern_clock_gettime() uses native tdfind()/pfind() to find proccess/thread. PR: 240990 Modified: stable/12/sys/compat/linux/linux_time.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_time.c ============================================================================== --- stable/12/sys/compat/linux/linux_time.c Mon Aug 24 14:26:48 2020 (r364688) +++ stable/12/sys/compat/linux/linux_time.c Mon Aug 24 14:48:54 2020 (r364689) @@ -65,6 +65,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_time.c,v 1.14 2006/0 #endif #include +#include #include /* DTrace init */ @@ -203,6 +204,12 @@ linux_to_native_clockid(clockid_t *n, clockid_t l) case LINUX_CLOCK_MONOTONIC: *n = CLOCK_MONOTONIC; break; + case LINUX_CLOCK_PROCESS_CPUTIME_ID: + *n = CLOCK_PROCESS_CPUTIME_ID; + break; + case LINUX_CLOCK_THREAD_CPUTIME_ID: + *n = CLOCK_THREAD_CPUTIME_ID; + break; case LINUX_CLOCK_REALTIME_COARSE: *n = CLOCK_REALTIME_FAST; break; @@ -269,8 +276,13 @@ linux_clock_gettime(struct thread *td, struct linux_cl switch (nwhich) { case CLOCK_PROCESS_CPUTIME_ID: - clockwhich = LINUX_CPUCLOCK_WHICH(args->which); - pid = LINUX_CPUCLOCK_ID(args->which); + if (args->which < 0) { + clockwhich = LINUX_CPUCLOCK_WHICH(args->which); + pid = LINUX_CPUCLOCK_ID(args->which); + } else { + clockwhich = LINUX_CPUCLOCK_SCHED; + pid = 0; + } if (pid == 0) { p = td->td_proc; PROC_LOCK(p); @@ -296,12 +308,8 @@ linux_clock_gettime(struct thread *td, struct linux_cl TIMEVAL_TO_TIMESPEC(&ru.ru_utime, &tp); break; case LINUX_CPUCLOCK_SCHED: + kern_process_cputime(p, &tp); PROC_UNLOCK(p); - error = kern_clock_getcpuclockid2(td, pid, - CPUCLOCK_WHICH_PID, &nwhich); - if (error != 0) - return (EINVAL); - error = kern_clock_gettime(td, nwhich, &tp); break; default: PROC_UNLOCK(p); @@ -311,14 +319,19 @@ linux_clock_gettime(struct thread *td, struct linux_cl break; case CLOCK_THREAD_CPUTIME_ID: - clockwhich = LINUX_CPUCLOCK_WHICH(args->which); + if (args->which < 0) { + clockwhich = LINUX_CPUCLOCK_WHICH(args->which); + tid = LINUX_CPUCLOCK_ID(args->which); + } else { + clockwhich = LINUX_CPUCLOCK_SCHED; + tid = 0; + } p = td->td_proc; - tid = LINUX_CPUCLOCK_ID(args->which); if (tid == 0) { targettd = td; PROC_LOCK(p); } else { - targettd = tdfind(tid, p->p_pid); + targettd = linux_tdfind(td, tid, p->p_pid); if (targettd == NULL) return (EINVAL); } @@ -343,12 +356,10 @@ linux_clock_gettime(struct thread *td, struct linux_cl TIMEVAL_TO_TIMESPEC(&ru.ru_utime, &tp); break; case LINUX_CPUCLOCK_SCHED: - error = kern_clock_getcpuclockid2(td, tid, - CPUCLOCK_WHICH_TID, &nwhich); + if (td == targettd) + targettd = NULL; + kern_thread_cputime(targettd, &tp); PROC_UNLOCK(p); - if (error != 0) - return (EINVAL); - error = kern_clock_gettime(td, nwhich, &tp); break; default: PROC_UNLOCK(p); @@ -440,25 +451,27 @@ linux_clock_getres(struct thread *td, struct linux_clo * Check user supplied clock id in case of per-process * or thread-specific cpu-time clock. */ - switch (nwhich) { - case CLOCK_THREAD_CPUTIME_ID: - tid = LINUX_CPUCLOCK_ID(args->which); - if (tid != 0) { - p = td->td_proc; - if (tdfind(tid, p->p_pid) == NULL) - return (ESRCH); - PROC_UNLOCK(p); + if (args->which < 0) { + switch (nwhich) { + case CLOCK_THREAD_CPUTIME_ID: + tid = LINUX_CPUCLOCK_ID(args->which); + if (tid != 0) { + p = td->td_proc; + if (linux_tdfind(td, tid, p->p_pid) == NULL) + return (EINVAL); + PROC_UNLOCK(p); + } + break; + case CLOCK_PROCESS_CPUTIME_ID: + pid = LINUX_CPUCLOCK_ID(args->which); + if (pid != 0) { + error = pget(pid, PGET_CANSEE, &p); + if (error != 0) + return (EINVAL); + PROC_UNLOCK(p); + } + break; } - break; - case CLOCK_PROCESS_CPUTIME_ID: - pid = LINUX_CPUCLOCK_ID(args->which); - if (pid != 0) { - error = pget(pid, PGET_CANSEE, &p); - if (error != 0) - return (EINVAL); - PROC_UNLOCK(p); - } - break; } if (args->tp == NULL) { @@ -471,6 +484,20 @@ linux_clock_getres(struct thread *td, struct linux_clo case CLOCK_THREAD_CPUTIME_ID: case CLOCK_PROCESS_CPUTIME_ID: clockwhich = LINUX_CPUCLOCK_WHICH(args->which); + /* + * In both cases (when the clock id obtained by a call to + * clock_getcpuclockid() or using the clock + * ID CLOCK_PROCESS_CPUTIME_ID Linux hardcodes precision + * of clock. The same for the CLOCK_THREAD_CPUTIME_ID clock. + * + * See Linux posix_cpu_clock_getres() implementation. + */ + if (args->which > 0 || clockwhich == LINUX_CPUCLOCK_SCHED) { + ts.tv_sec = 0; + ts.tv_nsec = 1; + goto out; + } + switch (clockwhich) { case LINUX_CPUCLOCK_PROF: nwhich = CLOCK_PROF; @@ -478,8 +505,6 @@ linux_clock_getres(struct thread *td, struct linux_clo case LINUX_CPUCLOCK_VIRT: nwhich = CLOCK_VIRTUAL; break; - case LINUX_CPUCLOCK_SCHED: - break; default: return (EINVAL); } @@ -494,6 +519,8 @@ linux_clock_getres(struct thread *td, struct linux_clo LIN_SDT_PROBE1(time, linux_clock_getres, return, error); return (error); } + +out: error = native_to_linux_timespec(<s, &ts); if (error != 0) return (error); From owner-svn-src-stable-12@freebsd.org Mon Aug 24 14:50:52 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EFAC83C33BF; Mon, 24 Aug 2020 14:50:52 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZw6N5wYqz3Rcj; Mon, 24 Aug 2020 14:50:52 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 94EEA1A3EA; Mon, 24 Aug 2020 14:50:52 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OEoqdg012227; Mon, 24 Aug 2020 14:50:52 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OEoqXm012226; Mon, 24 Aug 2020 14:50:52 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241450.07OEoqXm012226@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 14:50:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364690 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364690 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 14:50:53 -0000 Author: trasz Date: Mon Aug 24 14:50:52 2020 New Revision: 364690 URL: https://svnweb.freebsd.org/changeset/base/364690 Log: MFC r362416: Add warnings for unsupported Linux clockids. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linux/linux_time.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_time.c ============================================================================== --- stable/12/sys/compat/linux/linux_time.c Mon Aug 24 14:48:54 2020 (r364689) +++ stable/12/sys/compat/linux/linux_time.c Mon Aug 24 14:50:52 2020 (r364690) @@ -67,6 +67,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_time.c,v 1.14 2006/0 #include #include #include +#include /* DTrace init */ LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); @@ -268,6 +269,8 @@ linux_clock_gettime(struct thread *td, struct linux_cl error = linux_to_native_clockid(&nwhich, args->which); if (error != 0) { + linux_msg(curthread, + "unsupported clock_gettime clockid %d", args->which); LIN_SDT_PROBE1(time, linux_clock_gettime, conversion_error, error); LIN_SDT_PROBE1(time, linux_clock_gettime, return, error); @@ -399,6 +402,8 @@ linux_clock_settime(struct thread *td, struct linux_cl error = linux_to_native_clockid(&nwhich, args->which); if (error != 0) { + linux_msg(curthread, + "unsupported clock_settime clockid %d", args->which); LIN_SDT_PROBE1(time, linux_clock_settime, conversion_error, error); LIN_SDT_PROBE1(time, linux_clock_settime, return, error); @@ -441,6 +446,8 @@ linux_clock_getres(struct thread *td, struct linux_clo error = linux_to_native_clockid(&nwhich, args->which); if (error != 0) { + linux_msg(curthread, + "unsupported clock_getres clockid %d", args->which); LIN_SDT_PROBE1(time, linux_clock_getres, conversion_error, error); LIN_SDT_PROBE1(time, linux_clock_getres, return, error); @@ -600,6 +607,8 @@ linux_clock_nanosleep(struct thread *td, struct linux_ error = linux_to_native_clockid(&clockid, args->which); if (error != 0) { + linux_msg(curthread, + "unsupported clock_nanosleep clockid %d", args->which); LIN_SDT_PROBE1(time, linux_clock_nanosleep, unsupported_clockid, args->which); LIN_SDT_PROBE1(time, linux_clock_settime, return, error); From owner-svn-src-stable-12@freebsd.org Mon Aug 24 14:53:29 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E57813C390B; Mon, 24 Aug 2020 14:53:29 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZw9P5ft2z3SXs; Mon, 24 Aug 2020 14:53:29 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 A6C201A5A0; Mon, 24 Aug 2020 14:53:29 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OErTdE017534; Mon, 24 Aug 2020 14:53:29 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OErTSs017533; Mon, 24 Aug 2020 14:53:29 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241453.07OErTSs017533@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 14:53:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364691 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364691 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 14:53:30 -0000 Author: trasz Date: Mon Aug 24 14:53:29 2020 New Revision: 364691 URL: https://svnweb.freebsd.org/changeset/base/364691 Log: MFC r363125 by netchild: Implement CLOCK_MONOTONIC_RAW (linux >= 2.6.28). It is documented as a raw hardware-based clock not subject to NTP or incremental adjustments. With this "not as precise as CLOCK_MONOTONIC" description in mind, map it to our CLOCK_MONOTNIC_FAST (the same mapping as for the linux CLOCK_MONOTONIC_COARSE). This is needed for the webcomponent of steam (chromium) and some other steam component or game. The linux-steam-utils port contains a LD_PRELOAD based fix for this. There this is mapped to CLOCK_MONOTONIC. As an untrained ear/eye (= the majority of people) is normaly not noticing a difference of jitter in the 10-20 ms range, specially if you don't pay attention like for example in a browser session while watching a video stream, the mapping to CLOCK_MONOTONIC_FAST seems more appropriate than to CLOCK_MONOTONIC. MFC r363130 by netchild: Fix r363125 (Implement CLOCK_MONOTONIC_RAW (linux >= 2.6.28)), by realy using the MONOTONIC version and not the REALTIME version. Modified: stable/12/sys/compat/linux/linux_time.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_time.c ============================================================================== --- stable/12/sys/compat/linux/linux_time.c Mon Aug 24 14:50:52 2020 (r364690) +++ stable/12/sys/compat/linux/linux_time.c Mon Aug 24 14:53:29 2020 (r364691) @@ -215,12 +215,12 @@ linux_to_native_clockid(clockid_t *n, clockid_t l) *n = CLOCK_REALTIME_FAST; break; case LINUX_CLOCK_MONOTONIC_COARSE: + case LINUX_CLOCK_MONOTONIC_RAW: *n = CLOCK_MONOTONIC_FAST; break; case LINUX_CLOCK_BOOTTIME: *n = CLOCK_UPTIME; break; - case LINUX_CLOCK_MONOTONIC_RAW: case LINUX_CLOCK_REALTIME_ALARM: case LINUX_CLOCK_BOOTTIME_ALARM: case LINUX_CLOCK_SGI_CYCLE: From owner-svn-src-stable-12@freebsd.org Mon Aug 24 14:58:59 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7A69E3C3A8D; Mon, 24 Aug 2020 14:58:59 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZwHl2b1qz3Slp; Mon, 24 Aug 2020 14:58:59 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 3D1D61A5A2; Mon, 24 Aug 2020 14:58:59 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OEwxqd018190; Mon, 24 Aug 2020 14:58:59 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OEwxZp018189; Mon, 24 Aug 2020 14:58:59 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241458.07OEwxZp018189@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 14:58:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364692 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364692 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 14:58:59 -0000 Author: trasz Date: Mon Aug 24 14:58:58 2020 New Revision: 364692 URL: https://svnweb.freebsd.org/changeset/base/364692 Log: MFC r363307: Make linux fallocate(2) return EOPNOTSUPP, not ENOSYS, on unsupported mode, as documented in the man page. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linux/linux_file.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_file.c ============================================================================== --- stable/12/sys/compat/linux/linux_file.c Mon Aug 24 14:53:29 2020 (r364691) +++ stable/12/sys/compat/linux/linux_file.c Mon Aug 24 14:58:58 2020 (r364692) @@ -1778,7 +1778,7 @@ linux_fallocate(struct thread *td, struct linux_falloc * mode should be 0. */ if (args->mode != 0) - return (ENOSYS); + return (EOPNOTSUPP); #if defined(__amd64__) && defined(COMPAT_LINUX32) len = PAIR32TO64(off_t, args->len); From owner-svn-src-stable-12@freebsd.org Mon Aug 24 15:45:44 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 076363C4D41; Mon, 24 Aug 2020 15:45:44 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZxKg6pkbz3WTl; Mon, 24 Aug 2020 15:45:43 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 CCD4B1AA4C; Mon, 24 Aug 2020 15:45:43 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OFjh70048955; Mon, 24 Aug 2020 15:45:43 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OFjgMx048949; Mon, 24 Aug 2020 15:45:42 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241545.07OFjgMx048949@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 15:45:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364693 - in stable/12/sys: compat/linux modules/linux_common X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in stable/12/sys: compat/linux modules/linux_common X-SVN-Commit-Revision: 364693 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 15:45:44 -0000 Author: trasz Date: Mon Aug 24 15:45:42 2020 New Revision: 364693 URL: https://svnweb.freebsd.org/changeset/base/364693 Log: MFC r347533 by dchagin: Our bsd_to_linux_sockaddr() and linux_to_bsd_sockaddr() functions alter the userspace sockaddr to convert the format between linux and BSD versions. That's the minimum 3 of copyin/copyout operations for one syscall. Also some syscall uses linux_sa_put() and linux_getsockaddr() when load sockaddr to userspace or from userspace accordingly. To avoid this chaos, especially converting sockaddr in the userspace, rewrite these 4 functions to convert sockaddr only in kernel and leave only 2 of this functions. Also in order to reduce duplication between MD parts of the Linuxulator put struct sockaddr conversion functions that are MI out into linux_common module. PR: 232920 Modified: stable/12/sys/compat/linux/linux.c stable/12/sys/compat/linux/linux.h stable/12/sys/compat/linux/linux_common.h stable/12/sys/compat/linux/linux_socket.c stable/12/sys/compat/linux/linux_socket.h stable/12/sys/modules/linux_common/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux.c ============================================================================== --- stable/12/sys/compat/linux/linux.c Mon Aug 24 14:58:58 2020 (r364692) +++ stable/12/sys/compat/linux/linux.c Mon Aug 24 15:45:42 2020 (r364693) @@ -27,21 +27,29 @@ #include __FBSDID("$FreeBSD$"); +#include + #include #include #include #include #include +#include #include #include +#include #include #include #include #include +#include +#include + #include #include +#include struct futex_list futex_list; struct mtx futex_mtx; /* protects the futex list */ @@ -325,4 +333,194 @@ linux_ifhwaddr(struct ifnet *ifp, struct l_sockaddr *l } return (ENOENT); +} + +int +linux_to_bsd_domain(int domain) +{ + + switch (domain) { + case LINUX_AF_UNSPEC: + return (AF_UNSPEC); + case LINUX_AF_UNIX: + return (AF_LOCAL); + case LINUX_AF_INET: + return (AF_INET); + case LINUX_AF_INET6: + return (AF_INET6); + case LINUX_AF_AX25: + return (AF_CCITT); + case LINUX_AF_IPX: + return (AF_IPX); + case LINUX_AF_APPLETALK: + return (AF_APPLETALK); + } + return (-1); +} + +int +bsd_to_linux_domain(int domain) +{ + + switch (domain) { + case AF_UNSPEC: + return (LINUX_AF_UNSPEC); + case AF_LOCAL: + return (LINUX_AF_UNIX); + case AF_INET: + return (LINUX_AF_INET); + case AF_INET6: + return (LINUX_AF_INET6); + case AF_CCITT: + return (LINUX_AF_AX25); + case AF_IPX: + return (LINUX_AF_IPX); + case AF_APPLETALK: + return (LINUX_AF_APPLETALK); + } + return (-1); +} + +/* + * Based on the fact that: + * 1. Native and Linux storage of struct sockaddr + * and struct sockaddr_in6 are equal. + * 2. On Linux sa_family is the first member of all struct sockaddr. + */ +int +bsd_to_linux_sockaddr(const struct sockaddr *sa, struct l_sockaddr **lsa, + socklen_t len) +{ + struct l_sockaddr *kosa; + int error, bdom; + + *lsa = NULL; + if (len < 2 || len > UCHAR_MAX) + return (EINVAL); + + kosa = malloc(len, M_SONAME, M_WAITOK); + bcopy(sa, kosa, len); + + bdom = bsd_to_linux_domain(sa->sa_family); + if (bdom == -1) { + error = EAFNOSUPPORT; + goto out; + } + + kosa->sa_family = bdom; + *lsa = kosa; + return (0); + +out: + free(kosa, M_SONAME); + return (error); +} + +int +linux_to_bsd_sockaddr(const struct l_sockaddr *osa, struct sockaddr **sap, + socklen_t *len) +{ + struct sockaddr *sa; + struct l_sockaddr *kosa; +#ifdef INET6 + struct sockaddr_in6 *sin6; + bool oldv6size; +#endif + char *name; + int salen, bdom, error, hdrlen, namelen; + + if (*len < 2 || *len > UCHAR_MAX) + return (EINVAL); + + salen = *len; + +#ifdef INET6 + oldv6size = false; + /* + * Check for old (pre-RFC2553) sockaddr_in6. We may accept it + * if it's a v4-mapped address, so reserve the proper space + * for it. + */ + if (salen == sizeof(struct sockaddr_in6) - sizeof(uint32_t)) { + salen += sizeof(uint32_t); + oldv6size = true; + } +#endif + + kosa = malloc(salen, M_SONAME, M_WAITOK); + + if ((error = copyin(osa, kosa, *len))) + goto out; + + bdom = linux_to_bsd_domain(kosa->sa_family); + if (bdom == -1) { + error = EAFNOSUPPORT; + goto out; + } + +#ifdef INET6 + /* + * Older Linux IPv6 code uses obsolete RFC2133 struct sockaddr_in6, + * which lacks the scope id compared with RFC2553 one. If we detect + * the situation, reject the address and write a message to system log. + * + * Still accept addresses for which the scope id is not used. + */ + if (oldv6size) { + if (bdom == AF_INET6) { + sin6 = (struct sockaddr_in6 *)kosa; + if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr) || + (!IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr) && + !IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr) && + !IN6_IS_ADDR_V4COMPAT(&sin6->sin6_addr) && + !IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr) && + !IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))) { + sin6->sin6_scope_id = 0; + } else { + linux_msg(curthread, + "obsolete pre-RFC2553 sockaddr_in6 rejected\n"); + error = EINVAL; + goto out; + } + } else + salen -= sizeof(uint32_t); + } +#endif + if (bdom == AF_INET) { + if (salen < sizeof(struct sockaddr_in)) { + error = EINVAL; + goto out; + } + salen = sizeof(struct sockaddr_in); + } + + if (bdom == AF_LOCAL && salen > sizeof(struct sockaddr_un)) { + hdrlen = offsetof(struct sockaddr_un, sun_path); + name = ((struct sockaddr_un *)kosa)->sun_path; + if (*name == '\0') { + /* + * Linux abstract namespace starts with a NULL byte. + * XXX We do not support abstract namespace yet. + */ + namelen = strnlen(name + 1, salen - hdrlen - 1) + 1; + } else + namelen = strnlen(name, salen - hdrlen); + salen = hdrlen + namelen; + if (salen > sizeof(struct sockaddr_un)) { + error = ENAMETOOLONG; + goto out; + } + } + + sa = (struct sockaddr *)kosa; + sa->sa_family = bdom; + sa->sa_len = salen; + + *sap = sa; + *len = salen; + return (0); + +out: + free(kosa, M_SONAME); + return (error); } Modified: stable/12/sys/compat/linux/linux.h ============================================================================== --- stable/12/sys/compat/linux/linux.h Mon Aug 24 14:58:58 2020 (r364692) +++ stable/12/sys/compat/linux/linux.h Mon Aug 24 15:45:42 2020 (r364693) @@ -47,6 +47,17 @@ struct l_sockaddr { #define LINUX_ARPHRD_LOOPBACK 772 /* + * Supported address families + */ +#define LINUX_AF_UNSPEC 0 +#define LINUX_AF_UNIX 1 +#define LINUX_AF_INET 2 +#define LINUX_AF_AX25 3 +#define LINUX_AF_IPX 4 +#define LINUX_AF_APPLETALK 5 +#define LINUX_AF_INET6 10 + +/* * net device flags */ #define LINUX_IFF_UP 0x0001 Modified: stable/12/sys/compat/linux/linux_common.h ============================================================================== --- stable/12/sys/compat/linux/linux_common.h Mon Aug 24 14:58:58 2020 (r364692) +++ stable/12/sys/compat/linux/linux_common.h Mon Aug 24 15:45:42 2020 (r364693) @@ -35,4 +35,11 @@ struct ifnet *ifname_linux_to_bsd(struct thread *td, void linux_ifflags(struct ifnet *ifp, short *flags); int linux_ifhwaddr(struct ifnet *ifp, struct l_sockaddr *lsa); +int linux_to_bsd_domain(int domain); +int bsd_to_linux_domain(int domain); +int bsd_to_linux_sockaddr(const struct sockaddr *sa, + struct l_sockaddr **lsa, socklen_t len); +int linux_to_bsd_sockaddr(const struct l_sockaddr *lsa, + struct sockaddr **sap, socklen_t *len); + #endif /* _LINUX_COMMON_H_ */ Modified: stable/12/sys/compat/linux/linux_socket.c ============================================================================== --- stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 14:58:58 2020 (r364692) +++ stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 15:45:42 2020 (r364693) @@ -70,177 +70,21 @@ __FBSDID("$FreeBSD$"); #include #include #endif +#include #include #include #include #include #include -static int linux_to_bsd_domain(int); static int linux_sendmsg_common(struct thread *, l_int, struct l_msghdr *, l_uint); static int linux_recvmsg_common(struct thread *, l_int, struct l_msghdr *, l_uint, struct msghdr *); static int linux_set_socket_flags(int, int *); -/* - * Reads a Linux sockaddr and does any necessary translation. - * Linux sockaddrs don't have a length field, only a family. - * Copy the osockaddr structure pointed to by osa to kernel, adjust - * family and convert to sockaddr. - */ -static int -linux_getsockaddr(struct sockaddr **sap, const struct osockaddr *osa, int salen) -{ - struct sockaddr *sa; - struct osockaddr *kosa; -#ifdef INET6 - struct sockaddr_in6 *sin6; - int oldv6size; -#endif - char *name; - int bdom, error, hdrlen, namelen; - if (salen < 2 || salen > UCHAR_MAX || !osa) - return (EINVAL); - -#ifdef INET6 - oldv6size = 0; - /* - * Check for old (pre-RFC2553) sockaddr_in6. We may accept it - * if it's a v4-mapped address, so reserve the proper space - * for it. - */ - if (salen == sizeof(struct sockaddr_in6) - sizeof(uint32_t)) { - salen += sizeof(uint32_t); - oldv6size = 1; - } -#endif - - kosa = malloc(salen, M_SONAME, M_WAITOK); - - if ((error = copyin(osa, kosa, salen))) - goto out; - - bdom = linux_to_bsd_domain(kosa->sa_family); - if (bdom == -1) { - error = EAFNOSUPPORT; - goto out; - } - -#ifdef INET6 - /* - * Older Linux IPv6 code uses obsolete RFC2133 struct sockaddr_in6, - * which lacks the scope id compared with RFC2553 one. If we detect - * the situation, reject the address and write a message to system log. - * - * Still accept addresses for which the scope id is not used. - */ - if (oldv6size) { - if (bdom == AF_INET6) { - sin6 = (struct sockaddr_in6 *)kosa; - if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr) || - (!IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr) && - !IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr) && - !IN6_IS_ADDR_V4COMPAT(&sin6->sin6_addr) && - !IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr) && - !IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))) { - sin6->sin6_scope_id = 0; - } else { - log(LOG_DEBUG, - "obsolete pre-RFC2553 sockaddr_in6 rejected\n"); - error = EINVAL; - goto out; - } - } else - salen -= sizeof(uint32_t); - } -#endif - if (bdom == AF_INET) { - if (salen < sizeof(struct sockaddr_in)) { - error = EINVAL; - goto out; - } - salen = sizeof(struct sockaddr_in); - } - - if (bdom == AF_LOCAL && salen > sizeof(struct sockaddr_un)) { - hdrlen = offsetof(struct sockaddr_un, sun_path); - name = ((struct sockaddr_un *)kosa)->sun_path; - if (*name == '\0') { - /* - * Linux abstract namespace starts with a NULL byte. - * XXX We do not support abstract namespace yet. - */ - namelen = strnlen(name + 1, salen - hdrlen - 1) + 1; - } else - namelen = strnlen(name, salen - hdrlen); - salen = hdrlen + namelen; - if (salen > sizeof(struct sockaddr_un)) { - error = ENAMETOOLONG; - goto out; - } - } - - sa = (struct sockaddr *)kosa; - sa->sa_family = bdom; - sa->sa_len = salen; - - *sap = sa; - return (0); - -out: - free(kosa, M_SONAME); - return (error); -} - static int -linux_to_bsd_domain(int domain) -{ - - switch (domain) { - case LINUX_AF_UNSPEC: - return (AF_UNSPEC); - case LINUX_AF_UNIX: - return (AF_LOCAL); - case LINUX_AF_INET: - return (AF_INET); - case LINUX_AF_INET6: - return (AF_INET6); - case LINUX_AF_AX25: - return (AF_CCITT); - case LINUX_AF_IPX: - return (AF_IPX); - case LINUX_AF_APPLETALK: - return (AF_APPLETALK); - } - return (-1); -} - -static int -bsd_to_linux_domain(int domain) -{ - - switch (domain) { - case AF_UNSPEC: - return (LINUX_AF_UNSPEC); - case AF_LOCAL: - return (LINUX_AF_UNIX); - case AF_INET: - return (LINUX_AF_INET); - case AF_INET6: - return (LINUX_AF_INET6); - case AF_CCITT: - return (LINUX_AF_AX25); - case AF_IPX: - return (LINUX_AF_IPX); - case AF_APPLETALK: - return (LINUX_AF_APPLETALK); - } - return (-1); -} - -static int linux_to_bsd_sockopt_level(int level) { @@ -458,72 +302,7 @@ linux_to_bsd_msg_flags(int flags) return (ret_flags); } -/* -* If bsd_to_linux_sockaddr() or linux_to_bsd_sockaddr() faults, then the -* native syscall will fault. Thus, we don't really need to check the -* return values for these functions. -*/ - static int -bsd_to_linux_sockaddr(struct sockaddr *arg) -{ - struct sockaddr sa; - size_t sa_len = sizeof(struct sockaddr); - int error, bdom; - - if ((error = copyin(arg, &sa, sa_len))) - return (error); - - bdom = bsd_to_linux_domain(sa.sa_family); - if (bdom == -1) - return (EAFNOSUPPORT); - - *(u_short *)&sa = bdom; - return (copyout(&sa, arg, sa_len)); -} - -static int -linux_to_bsd_sockaddr(struct sockaddr *arg, int len) -{ - struct sockaddr sa; - size_t sa_len = sizeof(struct sockaddr); - int error, bdom; - - if ((error = copyin(arg, &sa, sa_len))) - return (error); - - bdom = linux_to_bsd_domain(*(sa_family_t *)&sa); - if (bdom == -1) - return (EAFNOSUPPORT); - - sa.sa_family = bdom; - sa.sa_len = len; - return (copyout(&sa, arg, sa_len)); -} - -static int -linux_sa_put(struct osockaddr *osa) -{ - struct osockaddr sa; - int error, bdom; - - /* - * Only read/write the osockaddr family part, the rest is - * not changed. - */ - error = copyin(osa, &sa, sizeof(sa.sa_family)); - if (error != 0) - return (error); - - bdom = bsd_to_linux_domain(sa.sa_family); - if (bdom == -1) - return (EINVAL); - - sa.sa_family = bdom; - return (copyout(&sa, osa, sizeof(sa.sa_family))); -} - -static int linux_to_bsd_cmsg_type(int cmsg_type) { @@ -616,10 +395,11 @@ linux_sendit(struct thread *td, int s, struct msghdr * struct mbuf *control, enum uio_seg segflg) { struct sockaddr *to; - int error; + int error, len; if (mp->msg_name != NULL) { - error = linux_getsockaddr(&to, mp->msg_name, mp->msg_namelen); + len = mp->msg_namelen; + error = linux_to_bsd_sockaddr(mp->msg_name, &to, &len); if (error != 0) return (error); mp->msg_name = to; @@ -758,13 +538,15 @@ linux_bind(struct thread *td, struct linux_bind_args * struct sockaddr *sa; int error; - error = linux_getsockaddr(&sa, PTRIN(args->name), - args->namelen); + error = linux_to_bsd_sockaddr(PTRIN(args->name), &sa, + &args->namelen); if (error != 0) return (error); error = kern_bindat(td, AT_FDCWD, args->s, sa); free(sa, M_SONAME); + + /* XXX */ if (error == EADDRNOTAVAIL && args->namelen != sizeof(struct sockaddr_in)) return (EINVAL); return (error); @@ -779,8 +561,8 @@ linux_connect(struct thread *td, struct linux_connect_ u_int fflag; int error; - error = linux_getsockaddr(&sa, (struct osockaddr *)PTRIN(args->name), - args->namelen); + error = linux_to_bsd_sockaddr(PTRIN(args->name), &sa, + &args->namelen); if (error != 0) return (error); @@ -824,43 +606,67 @@ static int linux_accept_common(struct thread *td, int s, l_uintptr_t addr, l_uintptr_t namelen, int flags) { - struct accept4_args /* { - int s; - struct sockaddr * __restrict name; - socklen_t * __restrict anamelen; - int flags; - } */ bsd_args; - struct socket *so; + struct l_sockaddr *lsa; + struct sockaddr *sa; struct file *fp; + int bflags, len; + struct socket *so; int error, error1; - bsd_args.s = s; - bsd_args.name = (struct sockaddr * __restrict)PTRIN(addr); - bsd_args.anamelen = PTRIN(namelen); - bsd_args.flags = 0; - error = linux_set_socket_flags(flags, &bsd_args.flags); + bflags = 0; + error = linux_set_socket_flags(flags, &bflags); if (error != 0) return (error); - error = sys_accept4(td, &bsd_args); - bsd_to_linux_sockaddr((struct sockaddr *)bsd_args.name); + + sa = NULL; + if (PTRIN(addr) == NULL) { + len = 0; + error = kern_accept4(td, s, NULL, NULL, bflags, NULL); + } else { + error = copyin(PTRIN(namelen), &len, sizeof(len)); + if (error != 0) + return (error); + if (len < 0) + return (EINVAL); + error = kern_accept4(td, s, &sa, &len, bflags, &fp); + if (error == 0) + fdrop(fp, td); + } + if (error != 0) { + /* + * XXX. This is wrong, different sockaddr structures + * have different sizes. + */ if (error == EFAULT && namelen != sizeof(struct sockaddr_in)) - return (EINVAL); + { + error = EINVAL; + goto out; + } if (error == EINVAL) { error1 = getsock_cap(td, s, &cap_accept_rights, &fp, NULL, NULL); - if (error1 != 0) - return (error1); - so = fp->f_data; - if (so->so_type == SOCK_DGRAM) { - fdrop(fp, td); - return (EOPNOTSUPP); + if (error1 != 0) { + error = error1; + goto out; } + so = fp->f_data; + if (so->so_type == SOCK_DGRAM) + error = EOPNOTSUPP; fdrop(fp, td); } - return (error); + goto out; } - if (addr) - error = linux_sa_put(PTRIN(addr)); + + if (len != 0 && error == 0) { + error = bsd_to_linux_sockaddr(sa, &lsa, len); + if (error == 0) + error = copyout(lsa, PTRIN(addr), len); + free(lsa, M_SONAME); + } + + free(sa, M_SONAME); + +out: if (error != 0) { (void)kern_close(td, td->td_retval[0]); td->td_retval[0] = 0; @@ -887,41 +693,59 @@ linux_accept4(struct thread *td, struct linux_accept4_ int linux_getsockname(struct thread *td, struct linux_getsockname_args *args) { - struct getsockname_args /* { - int fdes; - struct sockaddr * __restrict asa; - socklen_t * __restrict alen; - } */ bsd_args; - int error; + struct l_sockaddr *lsa; + struct sockaddr *sa; + int len, error; - bsd_args.fdes = args->s; - bsd_args.asa = (struct sockaddr * __restrict)PTRIN(args->addr); - bsd_args.alen = PTRIN(args->namelen); - error = sys_getsockname(td, &bsd_args); - bsd_to_linux_sockaddr((struct sockaddr *)bsd_args.asa); + error = copyin(PTRIN(args->namelen), &len, sizeof(len)); if (error != 0) return (error); - return (linux_sa_put(PTRIN(args->addr))); + + error = kern_getsockname(td, args->s, &sa, &len); + if (error != 0) + return (error); + + if (len != 0) { + error = bsd_to_linux_sockaddr(sa, &lsa, len); + if (error == 0) + error = copyout(lsa, PTRIN(args->addr), + len); + free(lsa, M_SONAME); + } + + free(sa, M_SONAME); + if (error == 0) + error = copyout(&len, PTRIN(args->namelen), sizeof(len)); + return (error); } int linux_getpeername(struct thread *td, struct linux_getpeername_args *args) { - struct getpeername_args /* { - int fdes; - caddr_t asa; - int *alen; - } */ bsd_args; - int error; + struct l_sockaddr *lsa; + struct sockaddr *sa; + int len, error; - bsd_args.fdes = args->s; - bsd_args.asa = (struct sockaddr *)PTRIN(args->addr); - bsd_args.alen = (socklen_t *)PTRIN(args->namelen); - error = sys_getpeername(td, &bsd_args); - bsd_to_linux_sockaddr((struct sockaddr *)bsd_args.asa); + error = copyin(PTRIN(args->namelen), &len, sizeof(len)); if (error != 0) return (error); - return (linux_sa_put(PTRIN(args->addr))); + + error = kern_getpeername(td, args->s, &sa, &len); + if (error != 0) + return (error); + + if (len != 0) { + error = bsd_to_linux_sockaddr(sa, &lsa, len); + if (error == 0) + error = copyout(lsa, PTRIN(args->addr), + len); + free(lsa, M_SONAME); + } + + free(sa, M_SONAME); + if (error == 0) + error = copyout(&len, PTRIN(args->namelen), sizeof(len)); + return (error); } int @@ -1043,6 +867,8 @@ linux_sendto(struct thread *td, struct linux_sendto_ar int linux_recvfrom(struct thread *td, struct linux_recvfrom_args *args) { + struct l_sockaddr *lsa; + struct sockaddr *sa; struct msghdr msg; struct iovec aiov; int error, fromlen; @@ -1054,11 +880,14 @@ linux_recvfrom(struct thread *td, struct linux_recvfro return (error); if (fromlen < 0) return (EINVAL); - msg.msg_namelen = fromlen; - } else - msg.msg_namelen = 0; + sa = malloc(fromlen, M_SONAME, M_WAITOK); + } else { + fromlen = 0; + sa = NULL; + } - msg.msg_name = (struct sockaddr * __restrict)PTRIN(args->from); + msg.msg_name = sa; + msg.msg_namelen = fromlen; msg.msg_iov = &aiov; msg.msg_iovlen = 1; aiov.iov_base = PTRIN(args->buf); @@ -1066,24 +895,23 @@ linux_recvfrom(struct thread *td, struct linux_recvfro msg.msg_control = 0; msg.msg_flags = linux_to_bsd_msg_flags(args->flags); - error = kern_recvit(td, args->s, &msg, UIO_USERSPACE, NULL); + error = kern_recvit(td, args->s, &msg, UIO_SYSSPACE, NULL); if (error != 0) return (error); if (PTRIN(args->from) != NULL) { - error = bsd_to_linux_sockaddr((struct sockaddr *) - PTRIN(args->from)); - if (error != 0) - return (error); - - error = linux_sa_put((struct osockaddr *) - PTRIN(args->from)); + error = bsd_to_linux_sockaddr(sa, &lsa, msg.msg_namelen); + if (error == 0) + error = copyout(lsa, PTRIN(args->from), + msg.msg_namelen); + free(lsa, M_SONAME); } - if (PTRIN(args->fromlen) != NULL) + if (error == 0 && PTRIN(args->fromlen) != NULL) error = copyout(&msg.msg_namelen, PTRIN(args->fromlen), sizeof(msg.msg_namelen)); + free(sa, M_SONAME); return (error); } @@ -1289,6 +1117,8 @@ linux_recvmsg_common(struct thread *td, l_int s, struc struct mbuf *control = NULL; struct mbuf **controlp; struct timeval *ftmvl; + struct l_sockaddr *lsa; + struct sockaddr *sa; l_timeval ltmvl; caddr_t outbuf; void *data; @@ -1312,36 +1142,34 @@ linux_recvmsg_common(struct thread *td, l_int s, struc return (error); if (msg->msg_name) { - error = linux_to_bsd_sockaddr((struct sockaddr *)msg->msg_name, - msg->msg_namelen); - if (error != 0) - goto bad; + sa = malloc(msg->msg_namelen, M_SONAME, M_WAITOK); + msg->msg_name = sa; } uiov = msg->msg_iov; msg->msg_iov = iov; controlp = (msg->msg_control != NULL) ? &control : NULL; - error = kern_recvit(td, s, msg, UIO_USERSPACE, controlp); + error = kern_recvit(td, s, msg, UIO_SYSSPACE, controlp); msg->msg_iov = uiov; if (error != 0) goto bad; - error = bsd_to_linux_msghdr(msg, &linux_msg); - if (error != 0) - goto bad; - - if (linux_msg.msg_name) { - error = bsd_to_linux_sockaddr((struct sockaddr *) - PTRIN(linux_msg.msg_name)); + if (sa) { + msg->msg_name = PTRIN(linux_msg.msg_name); + error = bsd_to_linux_sockaddr(sa, &lsa, msg->msg_namelen); + if (error == 0) + error = copyout(lsa, PTRIN(msg->msg_name), + msg->msg_namelen); + free(lsa, M_SONAME); + free(sa, M_SONAME); if (error != 0) goto bad; } - if (linux_msg.msg_name && linux_msg.msg_namelen > 2) { - error = linux_sa_put(PTRIN(linux_msg.msg_name)); - if (error != 0) - goto bad; - } + error = bsd_to_linux_msghdr(msg, &linux_msg); + if (error != 0) + goto bad; + maxlen = linux_msg.msg_controllen; linux_msg.msg_controllen = 0; if (control) { @@ -1544,7 +1372,9 @@ linux_setsockopt(struct thread *td, struct linux_setso int valsize; } */ bsd_args; l_timeval linux_tv; + struct sockaddr *sa; struct timeval tv; + socklen_t len; int error, name; bsd_args.s = args->s; @@ -1593,17 +1423,23 @@ linux_setsockopt(struct thread *td, struct linux_setso if (name == -1) return (ENOPROTOOPT); - bsd_args.name = name; - bsd_args.val = PTRIN(args->optval); - bsd_args.valsize = args->optlen; if (name == IPV6_NEXTHOP) { - linux_to_bsd_sockaddr((struct sockaddr *)bsd_args.val, - bsd_args.valsize); + + len = args->optlen; + error = linux_to_bsd_sockaddr(PTRIN(args->optval), &sa, &len); + if (error != 0) + return (error); + + error = kern_setsockopt(td, args->s, bsd_args.level, + name, sa, UIO_SYSSPACE, len); + free(sa, M_SONAME); + } else { + bsd_args.name = name; + bsd_args.val = PTRIN(args->optval); + bsd_args.valsize = args->optlen; error = sys_setsockopt(td, &bsd_args); - bsd_to_linux_sockaddr((struct sockaddr *)bsd_args.val); - } else - error = sys_setsockopt(td, &bsd_args); + } return (error); } @@ -1621,6 +1457,8 @@ linux_getsockopt(struct thread *td, struct linux_getso l_timeval linux_tv; struct timeval tv; socklen_t tv_len, xulen, len; + struct l_sockaddr *lsa; + struct sockaddr *sa; struct xucred xu; struct l_ucred lxu; int error, name, newval; @@ -1695,14 +1533,32 @@ linux_getsockopt(struct thread *td, struct linux_getso return (EINVAL); bsd_args.name = name; - bsd_args.val = PTRIN(args->optval); bsd_args.avalsize = PTRIN(args->optlen); if (name == IPV6_NEXTHOP) { + error = copyin(PTRIN(args->optlen), &len, sizeof(len)); + if (error != 0) + return (error); + sa = malloc(len, M_SONAME, M_WAITOK); + + error = kern_getsockopt(td, args->s, bsd_args.level, + name, sa, UIO_SYSSPACE, &len); + if (error != 0) + goto out; + + error = bsd_to_linux_sockaddr(sa, &lsa, len); + if (error == 0) + error = copyout(lsa, PTRIN(args->optval), len); + free(lsa, M_SONAME); + if (error == 0) + error = copyout(&len, PTRIN(args->optlen), + sizeof(len)); +out: + free(sa, M_SONAME); + } else { + bsd_args.val = PTRIN(args->optval); error = sys_getsockopt(td, &bsd_args); - bsd_to_linux_sockaddr((struct sockaddr *)bsd_args.val); - } else - error = sys_getsockopt(td, &bsd_args); + } return (error); } Modified: stable/12/sys/compat/linux/linux_socket.h ============================================================================== --- stable/12/sys/compat/linux/linux_socket.h Mon Aug 24 14:58:58 2020 (r364692) +++ stable/12/sys/compat/linux/linux_socket.h Mon Aug 24 15:45:42 2020 (r364693) @@ -109,16 +109,6 @@ struct l_cmsghdr { #define CMSG_HDRSZ CMSG_LEN(0) #define L_CMSG_HDRSZ LINUX_CMSG_LEN(0) -/* Supported address families */ - -#define LINUX_AF_UNSPEC 0 -#define LINUX_AF_UNIX 1 -#define LINUX_AF_INET 2 -#define LINUX_AF_AX25 3 -#define LINUX_AF_IPX 4 -#define LINUX_AF_APPLETALK 5 -#define LINUX_AF_INET6 10 - /* Supported socket types */ #define LINUX_SOCK_STREAM 1 Modified: stable/12/sys/modules/linux_common/Makefile ============================================================================== --- stable/12/sys/modules/linux_common/Makefile Mon Aug 24 14:58:58 2020 (r364692) +++ stable/12/sys/modules/linux_common/Makefile Mon Aug 24 15:45:42 2020 (r364693) @@ -5,7 +5,7 @@ KMOD= linux_common SRCS= linux_common.c linux_mib.c linux_mmap.c linux_util.c linux_emul.c \ linux_errno.c \ - linux.c device_if.h vnode_if.h bus_if.h + linux.c device_if.h vnode_if.h bus_if.h opt_inet6.h EXPORT_SYMS= EXPORT_SYMS+= linux_emul_path From owner-svn-src-stable-12@freebsd.org Mon Aug 24 15:49:37 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DC99C3C4FC9; Mon, 24 Aug 2020 15:49:37 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZxQ95VmLz3X2l; Mon, 24 Aug 2020 15:49:37 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 A19681AEA3; Mon, 24 Aug 2020 15:49:37 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OFnbKM049206; Mon, 24 Aug 2020 15:49:37 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OFnbQ8049205; Mon, 24 Aug 2020 15:49:37 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241549.07OFnbQ8049205@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 15:49:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364694 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364694 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 15:49:38 -0000 Author: trasz Date: Mon Aug 24 15:49:37 2020 New Revision: 364694 URL: https://svnweb.freebsd.org/changeset/base/364694 Log: MFC r347537 by dchagin: Linuxulator getpeername() returns EINVAL in case then namelen less then 0. Modified: stable/12/sys/compat/linux/linux_socket.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_socket.c ============================================================================== --- stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 15:45:42 2020 (r364693) +++ stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 15:49:37 2020 (r364694) @@ -729,6 +729,8 @@ linux_getpeername(struct thread *td, struct linux_getp error = copyin(PTRIN(args->namelen), &len, sizeof(len)); if (error != 0) return (error); + if (len < 0) + return (EINVAL); error = kern_getpeername(td, args->s, &sa, &len); if (error != 0) From owner-svn-src-stable-12@freebsd.org Mon Aug 24 15:50:58 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 86EDE3C531E; Mon, 24 Aug 2020 15:50:58 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZxRk36vyz3Wvk; Mon, 24 Aug 2020 15:50:58 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 4EA481AD9E; Mon, 24 Aug 2020 15:50:58 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OFowLi052513; Mon, 24 Aug 2020 15:50:58 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OFowDR052512; Mon, 24 Aug 2020 15:50:58 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241550.07OFowDR052512@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 15:50:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364695 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364695 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 15:50:58 -0000 Author: trasz Date: Mon Aug 24 15:50:57 2020 New Revision: 364695 URL: https://svnweb.freebsd.org/changeset/base/364695 Log: MFC r347969 by dchagin: Linux send() call returns EAGAIN instead of ENOTCONN in case when the socket is non-blocking and connect() is not finished yet. Initial patch developed by Steven Hartland in 2008 and adopted by me. PR: 129169 Modified: stable/12/sys/compat/linux/linux_socket.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_socket.c ============================================================================== --- stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 15:49:37 2020 (r364694) +++ stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 15:50:57 2020 (r364695) @@ -805,6 +805,8 @@ linux_send(struct thread *td, struct linux_send_args * caddr_t to; int tolen; } */ bsd_args; + struct file *fp; + int error, fflag; bsd_args.s = args->s; bsd_args.buf = (caddr_t)PTRIN(args->msg); @@ -812,7 +814,21 @@ linux_send(struct thread *td, struct linux_send_args * bsd_args.flags = args->flags; bsd_args.to = NULL; bsd_args.tolen = 0; - return (sys_sendto(td, &bsd_args)); + error = sys_sendto(td, &bsd_args); + if (error == ENOTCONN) { + /* + * Linux doesn't return ENOTCONN for non-blocking sockets. + * Instead it returns the EAGAIN. + */ + error = getsock_cap(td, args->s, &cap_send_rights, &fp, + &fflag, NULL); + if (error == 0) { + if (fflag & FNONBLOCK) + error = EAGAIN; + fdrop(fp, td); + } + } + return (error); } struct linux_recv_args { From owner-svn-src-stable-12@freebsd.org Mon Aug 24 15:52:46 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 985153C553C; Mon, 24 Aug 2020 15:52:46 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZxTp3N1tz3XdS; Mon, 24 Aug 2020 15:52:46 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 5630F1B10C; Mon, 24 Aug 2020 15:52:46 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OFqklo054933; Mon, 24 Aug 2020 15:52:46 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OFqka7054932; Mon, 24 Aug 2020 15:52:46 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241552.07OFqka7054932@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 15:52:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364696 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364696 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 15:52:46 -0000 Author: trasz Date: Mon Aug 24 15:52:45 2020 New Revision: 364696 URL: https://svnweb.freebsd.org/changeset/base/364696 Log: MFC r348056 by dchagin: Do not leak sa in linux_recvfrom() call if kern_recvit() fails. Modified: stable/12/sys/compat/linux/linux_socket.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_socket.c ============================================================================== --- stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 15:50:57 2020 (r364695) +++ stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 15:52:45 2020 (r364696) @@ -915,7 +915,7 @@ linux_recvfrom(struct thread *td, struct linux_recvfro error = kern_recvit(td, args->s, &msg, UIO_SYSSPACE, NULL); if (error != 0) - return (error); + goto out; if (PTRIN(args->from) != NULL) { error = bsd_to_linux_sockaddr(sa, &lsa, msg.msg_namelen); @@ -928,7 +928,7 @@ linux_recvfrom(struct thread *td, struct linux_recvfro if (error == 0 && PTRIN(args->fromlen) != NULL) error = copyout(&msg.msg_namelen, PTRIN(args->fromlen), sizeof(msg.msg_namelen)); - +out: free(sa, M_SONAME); return (error); } From owner-svn-src-stable-12@freebsd.org Mon Aug 24 15:53:53 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A4C7E3C5736; Mon, 24 Aug 2020 15:53:53 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZxW53wXvz3XlQ; Mon, 24 Aug 2020 15:53:53 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 6A5C01B1F7; Mon, 24 Aug 2020 15:53:53 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OFrrOl055046; Mon, 24 Aug 2020 15:53:53 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OFrrN8055045; Mon, 24 Aug 2020 15:53:53 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241553.07OFrrN8055045@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 15:53:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364697 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364697 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 15:53:53 -0000 Author: trasz Date: Mon Aug 24 15:53:52 2020 New Revision: 364697 URL: https://svnweb.freebsd.org/changeset/base/364697 Log: MFC r348057 by dchagin: Do not use uninitialised sa. Modified: stable/12/sys/compat/linux/linux_socket.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_socket.c ============================================================================== --- stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 15:52:45 2020 (r364696) +++ stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 15:53:52 2020 (r364697) @@ -1172,7 +1172,7 @@ linux_recvmsg_common(struct thread *td, l_int s, struc if (error != 0) goto bad; - if (sa) { + if (msg->msg_name) { msg->msg_name = PTRIN(linux_msg.msg_name); error = bsd_to_linux_sockaddr(sa, &lsa, msg->msg_namelen); if (error == 0) From owner-svn-src-stable-12@freebsd.org Mon Aug 24 15:54:58 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F312C3C5982; Mon, 24 Aug 2020 15:54:58 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZxXL5yNcz3Xyk; Mon, 24 Aug 2020 15:54:58 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 B114D1B10D; Mon, 24 Aug 2020 15:54:58 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OFsw7r055159; Mon, 24 Aug 2020 15:54:58 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OFswwa055158; Mon, 24 Aug 2020 15:54:58 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241554.07OFswwa055158@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 15:54:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364698 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364698 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 15:54:59 -0000 Author: trasz Date: Mon Aug 24 15:54:58 2020 New Revision: 364698 URL: https://svnweb.freebsd.org/changeset/base/364698 Log: MFC r348058 by dchagin: Do not leak sa in linux_recvmsg() call if kern_recvit() fails. Modified: stable/12/sys/compat/linux/linux_socket.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_socket.c ============================================================================== --- stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 15:53:52 2020 (r364697) +++ stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 15:54:58 2020 (r364698) @@ -1162,7 +1162,8 @@ linux_recvmsg_common(struct thread *td, l_int s, struc if (msg->msg_name) { sa = malloc(msg->msg_namelen, M_SONAME, M_WAITOK); msg->msg_name = sa; - } + } else + sa = NULL; uiov = msg->msg_iov; msg->msg_iov = iov; @@ -1179,7 +1180,6 @@ linux_recvmsg_common(struct thread *td, l_int s, struc error = copyout(lsa, PTRIN(msg->msg_name), msg->msg_namelen); free(lsa, M_SONAME); - free(sa, M_SONAME); if (error != 0) goto bad; } @@ -1299,6 +1299,7 @@ bad: } free(iov, M_IOV); free(linux_cmsg, M_LINUX); + free(sa, M_SONAME); return (error); } From owner-svn-src-stable-12@freebsd.org Mon Aug 24 15:56:31 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BBE763C59A4; Mon, 24 Aug 2020 15:56:31 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZxZ74ZQHz3YGK; Mon, 24 Aug 2020 15:56:31 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 812651AA71; Mon, 24 Aug 2020 15:56:31 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OFuVl3055462; Mon, 24 Aug 2020 15:56:31 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OFuVaL055461; Mon, 24 Aug 2020 15:56:31 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241556.07OFuVaL055461@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 15:56:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364699 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364699 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 15:56:31 -0000 Author: trasz Date: Mon Aug 24 15:56:31 2020 New Revision: 364699 URL: https://svnweb.freebsd.org/changeset/base/364699 Log: MFC r348418 by dchagin: Linux does not support MSG_OOB for unix(4) or non-stream oriented socket, return EOPNOTSUPP as a Linux does. Modified: stable/12/sys/compat/linux/linux_socket.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_socket.c ============================================================================== --- stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 15:54:58 2020 (r364698) +++ stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 15:56:31 2020 (r364699) @@ -946,11 +946,13 @@ linux_sendmsg_common(struct thread *td, l_int s, struc struct iovec *iov; socklen_t datalen; struct sockaddr *sa; + struct socket *so; sa_family_t sa_family; + struct file *fp; void *data; l_size_t len; l_size_t clen; - int error; + int error, fflag; error = copyin(msghdr, &linux_msg, sizeof(linux_msg)); if (error != 0) @@ -981,12 +983,30 @@ linux_sendmsg_common(struct thread *td, l_int s, struc control = NULL; - if (linux_msg.msg_controllen >= sizeof(struct l_cmsghdr)) { - error = kern_getsockname(td, s, &sa, &datalen); + error = kern_getsockname(td, s, &sa, &datalen); + if (error != 0) + goto bad; + sa_family = sa->sa_family; + free(sa, M_SONAME); + + if (flags & LINUX_MSG_OOB) { + error = EOPNOTSUPP; + if (sa_family == AF_UNIX) + goto bad; + + error = getsock_cap(td, s, &cap_send_rights, &fp, + &fflag, NULL); if (error != 0) goto bad; - sa_family = sa->sa_family; - free(sa, M_SONAME); + so = fp->f_data; + if (so->so_type != SOCK_STREAM) + error = EOPNOTSUPP; + fdrop(fp, td); + if (error != 0) + goto bad; + } + + if (linux_msg.msg_controllen >= sizeof(struct l_cmsghdr)) { error = ENOBUFS; control = m_get(M_WAITOK, MT_CONTROL); From owner-svn-src-stable-12@freebsd.org Mon Aug 24 16:00:59 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 06FE03C597F; Mon, 24 Aug 2020 16:00:59 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZxgG6S3yz3YV3; Mon, 24 Aug 2020 16:00:58 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 C1FED1B1FD; Mon, 24 Aug 2020 16:00:58 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OG0wDx057572; Mon, 24 Aug 2020 16:00:58 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OG0wXh057571; Mon, 24 Aug 2020 16:00:58 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241600.07OG0wXh057571@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 16:00:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364700 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364700 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 16:00:59 -0000 Author: trasz Date: Mon Aug 24 16:00:58 2020 New Revision: 364700 URL: https://svnweb.freebsd.org/changeset/base/364700 Log: MFC r362103: Fix naming clash. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linux/linux_socket.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_socket.c ============================================================================== --- stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 15:56:31 2020 (r364699) +++ stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 16:00:58 2020 (r364700) @@ -942,7 +942,7 @@ linux_sendmsg_common(struct thread *td, l_int s, struc struct msghdr msg; struct l_cmsghdr linux_cmsg; struct l_cmsghdr *ptr_cmsg; - struct l_msghdr linux_msg; + struct l_msghdr linux_msghdr; struct iovec *iov; socklen_t datalen; struct sockaddr *sa; @@ -954,7 +954,7 @@ linux_sendmsg_common(struct thread *td, l_int s, struc l_size_t clen; int error, fflag; - error = copyin(msghdr, &linux_msg, sizeof(linux_msg)); + error = copyin(msghdr, &linux_msghdr, sizeof(linux_msghdr)); if (error != 0) return (error); @@ -965,10 +965,11 @@ linux_sendmsg_common(struct thread *td, l_int s, struc * order to handle this case. This should be checked, but allows the * Linux ping to work. */ - if (PTRIN(linux_msg.msg_control) != NULL && linux_msg.msg_controllen == 0) - linux_msg.msg_control = PTROUT(NULL); + if (PTRIN(linux_msghdr.msg_control) != NULL && + linux_msghdr.msg_controllen == 0) + linux_msghdr.msg_control = PTROUT(NULL); - error = linux_to_bsd_msghdr(&msg, &linux_msg); + error = linux_to_bsd_msghdr(&msg, &linux_msghdr); if (error != 0) return (error); @@ -1006,7 +1007,7 @@ linux_sendmsg_common(struct thread *td, l_int s, struc goto bad; } - if (linux_msg.msg_controllen >= sizeof(struct l_cmsghdr)) { + if (linux_msghdr.msg_controllen >= sizeof(struct l_cmsghdr)) { error = ENOBUFS; control = m_get(M_WAITOK, MT_CONTROL); @@ -1014,8 +1015,8 @@ linux_sendmsg_common(struct thread *td, l_int s, struc data = mtod(control, void *); datalen = 0; - ptr_cmsg = PTRIN(linux_msg.msg_control); - clen = linux_msg.msg_controllen; + ptr_cmsg = PTRIN(linux_msghdr.msg_control); + clen = linux_msghdr.msg_controllen; do { error = copyin(ptr_cmsg, &linux_cmsg, sizeof(struct l_cmsghdr)); @@ -1150,7 +1151,7 @@ linux_recvmsg_common(struct thread *td, l_int s, struc struct l_cmsghdr *linux_cmsg = NULL; struct l_ucred linux_ucred; socklen_t datalen, maxlen, outlen; - struct l_msghdr linux_msg; + struct l_msghdr linux_msghdr; struct iovec *iov, *uiov; struct mbuf *control = NULL; struct mbuf **controlp; @@ -1162,11 +1163,11 @@ linux_recvmsg_common(struct thread *td, l_int s, struc void *data; int error, i, fd, fds, *fdp; - error = copyin(msghdr, &linux_msg, sizeof(linux_msg)); + error = copyin(msghdr, &linux_msghdr, sizeof(linux_msghdr)); if (error != 0) return (error); - error = linux_to_bsd_msghdr(msg, &linux_msg); + error = linux_to_bsd_msghdr(msg, &linux_msghdr); if (error != 0) return (error); @@ -1194,7 +1195,7 @@ linux_recvmsg_common(struct thread *td, l_int s, struc goto bad; if (msg->msg_name) { - msg->msg_name = PTRIN(linux_msg.msg_name); + msg->msg_name = PTRIN(linux_msghdr.msg_name); error = bsd_to_linux_sockaddr(sa, &lsa, msg->msg_namelen); if (error == 0) error = copyout(lsa, PTRIN(msg->msg_name), @@ -1204,12 +1205,12 @@ linux_recvmsg_common(struct thread *td, l_int s, struc goto bad; } - error = bsd_to_linux_msghdr(msg, &linux_msg); + error = bsd_to_linux_msghdr(msg, &linux_msghdr); if (error != 0) goto bad; - maxlen = linux_msg.msg_controllen; - linux_msg.msg_controllen = 0; + maxlen = linux_msghdr.msg_controllen; + linux_msghdr.msg_controllen = 0; if (control) { linux_cmsg = malloc(L_CMSG_HDRSZ, M_LINUX, M_WAITOK | M_ZERO); @@ -1217,7 +1218,7 @@ linux_recvmsg_common(struct thread *td, l_int s, struc msg->msg_controllen = control->m_len; cm = CMSG_FIRSTHDR(msg); - outbuf = PTRIN(linux_msg.msg_control); + outbuf = PTRIN(linux_msghdr.msg_control); outlen = 0; while (cm != NULL) { linux_cmsg->cmsg_type = @@ -1283,7 +1284,7 @@ linux_recvmsg_common(struct thread *td, l_int s, struc error = EMSGSIZE; goto bad; } else { - linux_msg.msg_flags |= LINUX_MSG_CTRUNC; + linux_msghdr.msg_flags |= LINUX_MSG_CTRUNC; m_dispose_extcontrolm(control); goto out; } @@ -1305,11 +1306,11 @@ linux_recvmsg_common(struct thread *td, l_int s, struc cm = CMSG_NXTHDR(msg, cm); } - linux_msg.msg_controllen = outlen; + linux_msghdr.msg_controllen = outlen; } out: - error = copyout(&linux_msg, msghdr, sizeof(linux_msg)); + error = copyout(&linux_msghdr, msghdr, sizeof(linux_msghdr)); bad: if (control != NULL) { @@ -1687,7 +1688,7 @@ linux_socketcall(struct thread *td, struct linux_socke return (linux_sendmmsg(td, arg)); } - uprintf("LINUX: 'socket' typ=%d not implemented\n", args->what); + linux_msg(td, "socket type %d not implemented", args->what); return (ENOSYS); } #endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */ From owner-svn-src-stable-12@freebsd.org Mon Aug 24 16:06:19 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D94553C5C19; Mon, 24 Aug 2020 16:06:19 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZxnQ4M7kz3Z8T; Mon, 24 Aug 2020 16:06:18 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 65BDF1AE4E; Mon, 24 Aug 2020 16:06:18 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OG6IAb061943; Mon, 24 Aug 2020 16:06:18 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OG6HKO061940; Mon, 24 Aug 2020 16:06:17 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241606.07OG6HKO061940@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 16:06:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364702 - in stable/12/sys: compat/linux i386/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in stable/12/sys: compat/linux i386/linux X-SVN-Commit-Revision: 364702 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 16:06:20 -0000 Author: trasz Date: Mon Aug 24 16:06:17 2020 New Revision: 364702 URL: https://svnweb.freebsd.org/changeset/base/364702 Log: MFC r354413: Make linux(4) create /dev/shm. Linux applications often expect a tmpfs to be mounted there, and because they like to verify it's actually a mountpoint, a symlink won't do. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linux/linux.c stable/12/sys/compat/linux/linux.h stable/12/sys/compat/linux/linux_common.c stable/12/sys/i386/linux/linux_sysvec.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux.c ============================================================================== --- stable/12/sys/compat/linux/linux.c Mon Aug 24 16:06:11 2020 (r364701) +++ stable/12/sys/compat/linux/linux.c Mon Aug 24 16:06:17 2020 (r364702) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -129,6 +130,12 @@ static int linux_to_bsd_sigtbl[LINUX_SIGTBLSZ] = { SIGSYS /* LINUX_SIGSYS */ }; +static struct cdev *dev_shm_cdev; +static struct cdevsw dev_shm_cdevsw = { + .d_version = D_VERSION, + .d_name = "dev_shm", +}; + /* * Map Linux RT signals to the FreeBSD RT signals. */ @@ -523,4 +530,24 @@ linux_to_bsd_sockaddr(const struct l_sockaddr *osa, st out: free(kosa, M_SONAME); return (error); +} + +void +linux_dev_shm_create(void) +{ + int error; + + error = make_dev_p(MAKEDEV_CHECKNAME | MAKEDEV_WAITOK, &dev_shm_cdev, + &dev_shm_cdevsw, NULL, UID_ROOT, GID_WHEEL, 0, "shm/.mountpoint"); + if (error != 0) { + printf("%s: failed to create device node, error %d\n", + __func__, error); + } +} + +void +linux_dev_shm_destroy(void) +{ + + destroy_dev(dev_shm_cdev); } Modified: stable/12/sys/compat/linux/linux.h ============================================================================== --- stable/12/sys/compat/linux/linux.h Mon Aug 24 16:06:11 2020 (r364701) +++ stable/12/sys/compat/linux/linux.h Mon Aug 24 16:06:17 2020 (r364702) @@ -143,4 +143,7 @@ int bsd_to_linux_signal(int sig); extern LIST_HEAD(futex_list, futex) futex_list; extern struct mtx futex_mtx; +void linux_dev_shm_create(void); +void linux_dev_shm_destroy(void); + #endif /* _LINUX_MI_H_ */ Modified: stable/12/sys/compat/linux/linux_common.c ============================================================================== --- stable/12/sys/compat/linux/linux_common.c Mon Aug 24 16:06:11 2020 (r364701) +++ stable/12/sys/compat/linux/linux_common.c Mon Aug 24 16:06:17 2020 (r364702) @@ -68,6 +68,7 @@ linux_common_modevent(module_t mod, int type, void *da switch(type) { case MOD_LOAD: + linux_dev_shm_create(); linux_osd_jail_register(); linux_exit_tag = EVENTHANDLER_REGISTER(process_exit, linux_proc_exit, NULL, 1000); @@ -81,6 +82,7 @@ linux_common_modevent(module_t mod, int type, void *da mtx_init(&futex_mtx, "ftllk", NULL, MTX_DEF); break; case MOD_UNLOAD: + linux_dev_shm_destroy(); linux_osd_jail_deregister(); SET_FOREACH(ldhp, linux_device_handler_set) linux_device_unregister_handler(*ldhp); Modified: stable/12/sys/i386/linux/linux_sysvec.c ============================================================================== --- stable/12/sys/i386/linux/linux_sysvec.c Mon Aug 24 16:06:11 2020 (r364701) +++ stable/12/sys/i386/linux/linux_sysvec.c Mon Aug 24 16:06:17 2020 (r364702) @@ -1057,6 +1057,7 @@ linux_elf_modevent(module_t mod, int type, void *data) linux_get_machine(&linux_kplatform); linux_szplatform = roundup(strlen(linux_kplatform) + 1, sizeof(char *)); + linux_dev_shm_create(); linux_osd_jail_register(); stclohz = (stathz ? stathz : hz); if (bootverbose) @@ -1082,6 +1083,7 @@ linux_elf_modevent(module_t mod, int type, void *data) EVENTHANDLER_DEREGISTER(process_exit, linux_exit_tag); EVENTHANDLER_DEREGISTER(process_exec, linux_exec_tag); EVENTHANDLER_DEREGISTER(thread_dtor, linux_thread_dtor_tag); + linux_dev_shm_destroy(); linux_osd_jail_deregister(); if (bootverbose) printf("Linux ELF exec handler removed\n"); From owner-svn-src-stable-12@freebsd.org Mon Aug 24 16:15:13 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 41FD13C6489; Mon, 24 Aug 2020 16:15:13 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZxzj11q7z3Zhn; Mon, 24 Aug 2020 16:15:13 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 0696C1B39E; Mon, 24 Aug 2020 16:15:13 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OGFCnW068013; Mon, 24 Aug 2020 16:15:12 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OGFC71068008; Mon, 24 Aug 2020 16:15:12 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241615.07OGFC71068008@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 16:15:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364703 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364703 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 16:15:13 -0000 Author: trasz Date: Mon Aug 24 16:15:12 2020 New Revision: 364703 URL: https://svnweb.freebsd.org/changeset/base/364703 Log: MFC r362059: Don't use newlines with linux_msg(). No functional changes. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linux/linux.c stable/12/sys/compat/linux/linux_event.c stable/12/sys/compat/linux/linux_futex.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux.c ============================================================================== --- stable/12/sys/compat/linux/linux.c Mon Aug 24 16:06:17 2020 (r364702) +++ stable/12/sys/compat/linux/linux.c Mon Aug 24 16:15:12 2020 (r364703) @@ -485,7 +485,7 @@ linux_to_bsd_sockaddr(const struct l_sockaddr *osa, st sin6->sin6_scope_id = 0; } else { linux_msg(curthread, - "obsolete pre-RFC2553 sockaddr_in6 rejected\n"); + "obsolete pre-RFC2553 sockaddr_in6 rejected"); error = EINVAL; goto out; } Modified: stable/12/sys/compat/linux/linux_event.c ============================================================================== --- stable/12/sys/compat/linux/linux_event.c Mon Aug 24 16:06:17 2020 (r364702) +++ stable/12/sys/compat/linux/linux_event.c Mon Aug 24 16:15:12 2020 (r364703) @@ -342,7 +342,7 @@ epoll_to_kevent(struct thread *td, int fd, struct epol if ((pem->flags & LINUX_XUNSUP_EPOLL) == 0) { pem->flags |= LINUX_XUNSUP_EPOLL; LINUX_PEM_XUNLOCK(pem); - linux_msg(td, "epoll_ctl unsupported flags: 0x%x\n", + linux_msg(td, "epoll_ctl unsupported flags: 0x%x", levents); } else LINUX_PEM_XUNLOCK(pem); Modified: stable/12/sys/compat/linux/linux_futex.c ============================================================================== --- stable/12/sys/compat/linux/linux_futex.c Mon Aug 24 16:06:17 2020 (r364702) +++ stable/12/sys/compat/linux/linux_futex.c Mon Aug 24 16:15:12 2020 (r364703) @@ -1086,7 +1086,7 @@ retry2: return (ENOSYS); default: - linux_msg(td, "unsupported futex op %d\n", args->op); + linux_msg(td, "unsupported futex op %d", args->op); LIN_SDT_PROBE1(futex, linux_sys_futex, unknown_operation, args->op); LIN_SDT_PROBE1(futex, linux_sys_futex, return, ENOSYS); From owner-svn-src-stable-12@freebsd.org Mon Aug 24 16:21:04 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 21AA33C64EB; Mon, 24 Aug 2020 16:21:04 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZy6S06sTz3bB9; Mon, 24 Aug 2020 16:21:04 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 DC64B1B227; Mon, 24 Aug 2020 16:21:03 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OGL3cd070590; Mon, 24 Aug 2020 16:21:03 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OGL35L070589; Mon, 24 Aug 2020 16:21:03 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241621.07OGL35L070589@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 16:21:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364704 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364704 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 16:21:04 -0000 Author: trasz Date: Mon Aug 24 16:21:03 2020 New Revision: 364704 URL: https://svnweb.freebsd.org/changeset/base/364704 Log: MFC r362176: Make linux(4) warn about unsupported CMSG level/type. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linux/linux_socket.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_socket.c ============================================================================== --- stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 16:15:12 2020 (r364703) +++ stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 16:21:03 2020 (r364704) @@ -1041,8 +1041,12 @@ linux_sendmsg_common(struct thread *td, l_int s, struc cmsg->cmsg_level = linux_to_bsd_sockopt_level(linux_cmsg.cmsg_level); if (cmsg->cmsg_type == -1 - || cmsg->cmsg_level != SOL_SOCKET) + || cmsg->cmsg_level != SOL_SOCKET) { + linux_msg(curthread, + "unsupported sendmsg cmsg level %d type %d", + linux_cmsg.cmsg_level, linux_cmsg.cmsg_type); goto bad; + } /* * Some applications (e.g. pulseaudio) attempt to @@ -1227,6 +1231,9 @@ linux_recvmsg_common(struct thread *td, l_int s, struc bsd_to_linux_sockopt_level(cm->cmsg_level); if (linux_cmsg->cmsg_type == -1 || cm->cmsg_level != SOL_SOCKET) { + linux_msg(curthread, + "unsupported recvmsg cmsg level %d type %d", + cm->cmsg_level, cm->cmsg_type); error = EINVAL; goto bad; } From owner-svn-src-stable-12@freebsd.org Mon Aug 24 16:23:28 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 479183C68A2; Mon, 24 Aug 2020 16:23:28 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZy9D1BZBz3bSP; Mon, 24 Aug 2020 16:23:28 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 0D8861B71D; Mon, 24 Aug 2020 16:23:28 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OGNRDX074133; Mon, 24 Aug 2020 16:23:27 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OGNRxq074132; Mon, 24 Aug 2020 16:23:27 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241623.07OGNRxq074132@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 16:23:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364705 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364705 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 16:23:28 -0000 Author: trasz Date: Mon Aug 24 16:23:27 2020 New Revision: 364705 URL: https://svnweb.freebsd.org/changeset/base/364705 Log: MFC r362735: Make linux(4) support SO_PROTOCOL. Running Python test suite with python3.8 from Focal triggers those. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linux/linux_socket.c stable/12/sys/compat/linux/linux_socket.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_socket.c ============================================================================== --- stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 16:21:03 2020 (r364704) +++ stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 16:23:27 2020 (r364705) @@ -235,6 +235,8 @@ linux_to_bsd_so_sockopt(int opt) return (SO_TIMESTAMP); case LINUX_SO_ACCEPTCONN: return (SO_ACCEPTCONN); + case LINUX_SO_PROTOCOL: + return (SO_PROTOCOL); } return (-1); } Modified: stable/12/sys/compat/linux/linux_socket.h ============================================================================== --- stable/12/sys/compat/linux/linux_socket.h Mon Aug 24 16:21:03 2020 (r364704) +++ stable/12/sys/compat/linux/linux_socket.h Mon Aug 24 16:23:27 2020 (r364705) @@ -199,6 +199,7 @@ int linux_accept(struct thread *td, struct linux_accep #define LINUX_SO_ACCEPTCONN 30 #define LINUX_SO_SNDBUFFORCE 32 #define LINUX_SO_RCVBUFFORCE 33 +#define LINUX_SO_PROTOCOL 38 /* Socket options */ #define LINUX_IP_TOS 1 From owner-svn-src-stable-12@freebsd.org Mon Aug 24 16:25:28 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5DA813C6A1D; Mon, 24 Aug 2020 16:25:28 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZyCX1nk2z3bqf; Mon, 24 Aug 2020 16:25:28 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 21EF21B780; Mon, 24 Aug 2020 16:25:28 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OGPSBD074457; Mon, 24 Aug 2020 16:25:28 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OGPRhP074456; Mon, 24 Aug 2020 16:25:27 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241625.07OGPRhP074456@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 16:25:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364706 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364706 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 16:25:28 -0000 Author: trasz Date: Mon Aug 24 16:25:27 2020 New Revision: 364706 URL: https://svnweb.freebsd.org/changeset/base/364706 Log: MFC r362833: Rework linux accept(2). This makes the code flow easier to follow, and fixes a bug where calling accept(2) could result in closing fd 0. Note that the code still contains a number of problems: it makes assumptions about l_sockaddr_in being the same as sockaddr_in, the EFAULT-related code looks like it doesn't work at all, and the socket type check is racy. Those will be addressed later on; I'm trying to work in small steps to avoid breaking one thing while fixing another. It fixes Redis, among other things. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linux/linux_socket.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_socket.c ============================================================================== --- stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 16:23:27 2020 (r364705) +++ stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 16:25:27 2020 (r364706) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -610,17 +611,19 @@ linux_accept_common(struct thread *td, int s, l_uintpt { struct l_sockaddr *lsa; struct sockaddr *sa; - struct file *fp; + struct file *fp, *fp1; int bflags, len; struct socket *so; int error, error1; bflags = 0; + fp = NULL; + sa = NULL; + error = linux_set_socket_flags(flags, &bflags); if (error != 0) return (error); - sa = NULL; if (PTRIN(addr) == NULL) { len = 0; error = kern_accept4(td, s, NULL, NULL, bflags, NULL); @@ -631,48 +634,54 @@ linux_accept_common(struct thread *td, int s, l_uintpt if (len < 0) return (EINVAL); error = kern_accept4(td, s, &sa, &len, bflags, &fp); - if (error == 0) - fdrop(fp, td); } + /* + * Translate errno values into ones used by Linux. + */ if (error != 0) { /* * XXX. This is wrong, different sockaddr structures * have different sizes. */ - if (error == EFAULT && namelen != sizeof(struct sockaddr_in)) - { - error = EINVAL; - goto out; - } - if (error == EINVAL) { - error1 = getsock_cap(td, s, &cap_accept_rights, &fp, NULL, NULL); + switch (error) { + case EFAULT: + if (namelen != sizeof(struct sockaddr_in)) + error = EINVAL; + break; + case EINVAL: + error1 = getsock_cap(td, s, &cap_accept_rights, &fp1, NULL, NULL); if (error1 != 0) { error = error1; - goto out; + break; } - so = fp->f_data; + so = fp1->f_data; if (so->so_type == SOCK_DGRAM) error = EOPNOTSUPP; - fdrop(fp, td); + fdrop(fp1, td); + break; } - goto out; + return (error); } - if (len != 0 && error == 0) { + if (len != 0) { error = bsd_to_linux_sockaddr(sa, &lsa, len); if (error == 0) error = copyout(lsa, PTRIN(addr), len); free(lsa, M_SONAME); - } - free(sa, M_SONAME); + /* + * XXX: We should also copyout the len, shouldn't we? + */ -out: - if (error != 0) { - (void)kern_close(td, td->td_retval[0]); - td->td_retval[0] = 0; + if (error != 0) { + fdclose(td, fp, td->td_retval[0]); + td->td_retval[0] = 0; + } } + if (fp != NULL) + fdrop(fp, td); + free(sa, M_SONAME); return (error); } From owner-svn-src-stable-12@freebsd.org Mon Aug 24 16:27:52 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 190873C6BA9; Mon, 24 Aug 2020 16:27:52 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZyGH6gNHz3bwV; Mon, 24 Aug 2020 16:27:51 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 C7F741B5A5; Mon, 24 Aug 2020 16:27:51 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OGRpXt074736; Mon, 24 Aug 2020 16:27:51 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OGRpJr074735; Mon, 24 Aug 2020 16:27:51 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241627.07OGRpJr074735@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 16:27:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364707 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364707 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 16:27:52 -0000 Author: trasz Date: Mon Aug 24 16:27:51 2020 New Revision: 364707 URL: https://svnweb.freebsd.org/changeset/base/364707 Log: MFC r362941: Fix Linux recvmsg(2) when msg_namelen returned is 0. Previously it would fail with EINVAL, breaking some of the Python regression tests. While here, cap the user-controlled message length. Note that the code doesn't seem to be copying out the new length in either (success or failure) case. This will be addressed separately. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linux/linux_socket.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_socket.c ============================================================================== --- stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 16:25:27 2020 (r364706) +++ stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 16:27:51 2020 (r364707) @@ -1195,11 +1195,14 @@ linux_recvmsg_common(struct thread *td, l_int s, struc if (error != 0) return (error); - if (msg->msg_name) { + if (msg->msg_name != NULL && msg->msg_namelen > 0) { + msg->msg_namelen = min(msg->msg_namelen, SOCK_MAXADDRLEN); sa = malloc(msg->msg_namelen, M_SONAME, M_WAITOK); msg->msg_name = sa; - } else + } else { sa = NULL; + msg->msg_name = NULL; + } uiov = msg->msg_iov; msg->msg_iov = iov; @@ -1209,7 +1212,10 @@ linux_recvmsg_common(struct thread *td, l_int s, struc if (error != 0) goto bad; - if (msg->msg_name) { + /* + * Note that kern_recvit() updates msg->msg_namelen. + */ + if (msg->msg_name != NULL && msg->msg_namelen > 0) { msg->msg_name = PTRIN(linux_msghdr.msg_name); error = bsd_to_linux_sockaddr(sa, &lsa, msg->msg_namelen); if (error == 0) From owner-svn-src-stable-12@freebsd.org Mon Aug 24 16:36:36 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7F7523C6C64; Mon, 24 Aug 2020 16:36:36 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZySN2tVkz3cSM; Mon, 24 Aug 2020 16:36:36 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 464FD1B472; Mon, 24 Aug 2020 16:36:36 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OGaaul080555; Mon, 24 Aug 2020 16:36:36 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OGaa5o080554; Mon, 24 Aug 2020 16:36:36 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241636.07OGaa5o080554@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 16:36:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364708 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364708 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 16:36:36 -0000 Author: trasz Date: Mon Aug 24 16:36:35 2020 New Revision: 364708 URL: https://svnweb.freebsd.org/changeset/base/364708 Log: MFC r356728: Make linux(4) use kern_getsockopt(9) instead of going through sys_getsockopt(). It's a cleanup; no functional changes. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linux/linux_socket.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_socket.c ============================================================================== --- stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 16:27:51 2020 (r364707) +++ stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 16:36:35 2020 (r364708) @@ -1511,13 +1511,6 @@ linux_setsockopt(struct thread *td, struct linux_setso int linux_getsockopt(struct thread *td, struct linux_getsockopt_args *args) { - struct getsockopt_args /* { - int s; - int level; - int name; - caddr_t val; - int *avalsize; - } */ bsd_args; l_timeval linux_tv; struct timeval tv; socklen_t tv_len, xulen, len; @@ -1525,11 +1518,10 @@ linux_getsockopt(struct thread *td, struct linux_getso struct sockaddr *sa; struct xucred xu; struct l_ucred lxu; - int error, name, newval; + int error, level, name, newval; - bsd_args.s = args->s; - bsd_args.level = linux_to_bsd_sockopt_level(args->level); - switch (bsd_args.level) { + level = linux_to_bsd_sockopt_level(args->level); + switch (level) { case SOL_SOCKET: name = linux_to_bsd_so_sockopt(args->optname); switch (name) { @@ -1537,7 +1529,7 @@ linux_getsockopt(struct thread *td, struct linux_getso /* FALLTHROUGH */ case SO_SNDTIMEO: tv_len = sizeof(tv); - error = kern_getsockopt(td, args->s, bsd_args.level, + error = kern_getsockopt(td, args->s, level, name, &tv, UIO_SYSSPACE, &tv_len); if (error != 0) return (error); @@ -1553,9 +1545,9 @@ linux_getsockopt(struct thread *td, struct linux_getso * LOCAL_PEERCRED is not served at the SOL_SOCKET level, * but by the Unix socket's level 0. */ - bsd_args.level = 0; + level = 0; xulen = sizeof(xu); - error = kern_getsockopt(td, args->s, bsd_args.level, + error = kern_getsockopt(td, args->s, level, name, &xu, UIO_SYSSPACE, &xulen); if (error != 0) return (error); @@ -1569,7 +1561,7 @@ linux_getsockopt(struct thread *td, struct linux_getso /* NOTREACHED */ case SO_ERROR: len = sizeof(newval); - error = kern_getsockopt(td, args->s, bsd_args.level, + error = kern_getsockopt(td, args->s, level, name, &newval, UIO_SYSSPACE, &len); if (error != 0) return (error); @@ -1596,16 +1588,13 @@ linux_getsockopt(struct thread *td, struct linux_getso if (name == -1) return (EINVAL); - bsd_args.name = name; - bsd_args.avalsize = PTRIN(args->optlen); - if (name == IPV6_NEXTHOP) { error = copyin(PTRIN(args->optlen), &len, sizeof(len)); if (error != 0) return (error); sa = malloc(len, M_SONAME, M_WAITOK); - error = kern_getsockopt(td, args->s, bsd_args.level, + error = kern_getsockopt(td, args->s, level, name, sa, UIO_SYSSPACE, &len); if (error != 0) goto out; @@ -1620,8 +1609,16 @@ linux_getsockopt(struct thread *td, struct linux_getso out: free(sa, M_SONAME); } else { - bsd_args.val = PTRIN(args->optval); - error = sys_getsockopt(td, &bsd_args); + if (args->optval) { + error = copyin(PTRIN(args->optlen), &len, sizeof(len)); + if (error != 0) + return (error); + } + error = kern_getsockopt(td, args->s, level, + name, PTRIN(args->optval), UIO_USERSPACE, &len); + if (error == 0) + error = copyout(&len, PTRIN(args->optlen), + sizeof(len)); } return (error); From owner-svn-src-stable-12@freebsd.org Mon Aug 24 16:41:10 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D31CE3C7304; Mon, 24 Aug 2020 16:41:10 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZyYf5Kffz3d44; Mon, 24 Aug 2020 16:41:10 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 9B9C21B7A3; Mon, 24 Aug 2020 16:41:10 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OGfA3f084550; Mon, 24 Aug 2020 16:41:10 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OGfAtj084509; Mon, 24 Aug 2020 16:41:10 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241641.07OGfAtj084509@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 16:41:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364709 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364709 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 16:41:10 -0000 Author: trasz Date: Mon Aug 24 16:41:10 2020 New Revision: 364709 URL: https://svnweb.freebsd.org/changeset/base/364709 Log: MFC r356729: Make linux(4) use kern_setsockopt(9) instead of going through sys_setsockopt. Just a cleanup; no functional changes. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linux/linux_socket.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_socket.c ============================================================================== --- stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 16:36:35 2020 (r364708) +++ stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 16:41:10 2020 (r364709) @@ -1428,22 +1428,14 @@ linux_shutdown(struct thread *td, struct linux_shutdow int linux_setsockopt(struct thread *td, struct linux_setsockopt_args *args) { - struct setsockopt_args /* { - int s; - int level; - int name; - caddr_t val; - int valsize; - } */ bsd_args; l_timeval linux_tv; struct sockaddr *sa; struct timeval tv; socklen_t len; - int error, name; + int error, level, name; - bsd_args.s = args->s; - bsd_args.level = linux_to_bsd_sockopt_level(args->level); - switch (bsd_args.level) { + level = linux_to_bsd_sockopt_level(args->level); + switch (level) { case SOL_SOCKET: name = linux_to_bsd_so_sockopt(args->optname); switch (name) { @@ -1456,7 +1448,7 @@ linux_setsockopt(struct thread *td, struct linux_setso return (error); tv.tv_sec = linux_tv.tv_sec; tv.tv_usec = linux_tv.tv_usec; - return (kern_setsockopt(td, args->s, bsd_args.level, + return (kern_setsockopt(td, args->s, level, name, &tv, UIO_SYSSPACE, sizeof(tv))); /* NOTREACHED */ default: @@ -1489,20 +1481,17 @@ linux_setsockopt(struct thread *td, struct linux_setso if (name == IPV6_NEXTHOP) { - len = args->optlen; error = linux_to_bsd_sockaddr(PTRIN(args->optval), &sa, &len); if (error != 0) return (error); - error = kern_setsockopt(td, args->s, bsd_args.level, + error = kern_setsockopt(td, args->s, level, name, sa, UIO_SYSSPACE, len); free(sa, M_SONAME); } else { - bsd_args.name = name; - bsd_args.val = PTRIN(args->optval); - bsd_args.valsize = args->optlen; - error = sys_setsockopt(td, &bsd_args); + error = kern_setsockopt(td, args->s, level, + name, PTRIN(args->optval), UIO_USERSPACE, args->optlen); } return (error); From owner-svn-src-stable-12@freebsd.org Mon Aug 24 16:44:18 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D25173C7078; Mon, 24 Aug 2020 16:44:18 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZydG5C5Lz3dGv; Mon, 24 Aug 2020 16:44:18 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 961781BB1A; Mon, 24 Aug 2020 16:44:18 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OGiInd086740; Mon, 24 Aug 2020 16:44:18 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OGiID7086738; Mon, 24 Aug 2020 16:44:18 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241644.07OGiID7086738@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 16:44:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364710 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364710 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 16:44:18 -0000 Author: trasz Date: Mon Aug 24 16:44:17 2020 New Revision: 364710 URL: https://svnweb.freebsd.org/changeset/base/364710 Log: MFC r362101: Minor code cleanup; no functional changes. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linux/linux_socket.c stable/12/sys/compat/linux/linux_socket.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_socket.c ============================================================================== --- stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 16:41:10 2020 (r364709) +++ stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 16:44:17 2020 (r364710) @@ -89,10 +89,9 @@ static int linux_to_bsd_sockopt_level(int level) { - switch (level) { - case LINUX_SOL_SOCKET: + if (level == LINUX_SOL_SOCKET) return (SOL_SOCKET); - } + /* Remaining values are RFC-defined protocol numbers. */ return (level); } @@ -100,10 +99,8 @@ static int bsd_to_linux_sockopt_level(int level) { - switch (level) { - case SOL_SOCKET: + if (level == SOL_SOCKET) return (LINUX_SOL_SOCKET); - } return (level); } Modified: stable/12/sys/compat/linux/linux_socket.h ============================================================================== --- stable/12/sys/compat/linux/linux_socket.h Mon Aug 24 16:41:10 2020 (r364709) +++ stable/12/sys/compat/linux/linux_socket.h Mon Aug 24 16:44:17 2020 (r364710) @@ -166,12 +166,6 @@ int linux_accept(struct thread *td, struct linux_accep /* Socket defines */ #define LINUX_SOL_SOCKET 1 -#define LINUX_SOL_IP 0 -#define LINUX_SOL_TCP 6 -#define LINUX_SOL_UDP 17 -#define LINUX_SOL_IPV6 41 -#define LINUX_SOL_IPX 256 -#define LINUX_SOL_AX25 257 #define LINUX_SO_DEBUG 1 #define LINUX_SO_REUSEADDR 2 From owner-svn-src-stable-12@freebsd.org Mon Aug 24 17:06:37 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9E4B13C80B8; Mon, 24 Aug 2020 17:06:37 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZz7140Z0z3g5b; Mon, 24 Aug 2020 17:06:37 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 6C54F1BBAB; Mon, 24 Aug 2020 17:06:37 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OH6b2h099624; Mon, 24 Aug 2020 17:06:37 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OH6ZUq099611; Mon, 24 Aug 2020 17:06:35 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241706.07OH6ZUq099611@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 17:06:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364712 - in stable/12/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux modules/linux modules/linux64 modules/linux_common X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in stable/12/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux modules/linux modules/linux64 modules/linux_common X-SVN-Commit-Revision: 364712 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 17:06:37 -0000 Author: trasz Date: Mon Aug 24 17:06:34 2020 New Revision: 364712 URL: https://svnweb.freebsd.org/changeset/base/364712 Log: MFC r347538 by dchagin: Linuxulator depends on a fundamental kernel settings such as SMP. Many of them listed in opt_global.h which is not generated while building modules outside of a kernel and such modules never match real cofigured kernel. So, we should prevent our users from building obviously defective modules. Therefore, remove the root cause of the building of modules outside of a kernel - the possibility of building modules with DEBUG or KTR flags. And remove all of DEBUG printfs as it is incomplete and in threaded programms not informative, also a half of system call does not have DEBUG printf. For debuging Linux programms we have dtrace, ktr and ktrace ability. PR: 222861 Modified: stable/12/sys/amd64/linux/linux.h stable/12/sys/amd64/linux/linux_sysvec.c stable/12/sys/amd64/linux32/linux.h stable/12/sys/amd64/linux32/linux32_machdep.c stable/12/sys/amd64/linux32/linux32_sysvec.c stable/12/sys/arm64/linux/linux.h stable/12/sys/arm64/linux/linux_sysvec.c stable/12/sys/compat/linux/linux_file.c stable/12/sys/compat/linux/linux_fork.c stable/12/sys/compat/linux/linux_getcwd.c stable/12/sys/compat/linux/linux_ioctl.c stable/12/sys/compat/linux/linux_misc.c stable/12/sys/compat/linux/linux_misc.h stable/12/sys/compat/linux/linux_signal.c stable/12/sys/compat/linux/linux_stats.c stable/12/sys/i386/linux/linux.h stable/12/sys/i386/linux/linux_machdep.c stable/12/sys/i386/linux/linux_sysvec.c stable/12/sys/modules/linux/Makefile stable/12/sys/modules/linux64/Makefile stable/12/sys/modules/linux_common/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/linux/linux.h ============================================================================== --- stable/12/sys/amd64/linux/linux.h Mon Aug 24 16:45:23 2020 (r364711) +++ stable/12/sys/amd64/linux/linux.h Mon Aug 24 17:06:34 2020 (r364712) @@ -39,15 +39,6 @@ #define LINUX_LEGACY_SYSCALLS -/* - * debugging support - */ -extern u_char linux_debug_map[]; -#define ldebug(name) isclr(linux_debug_map, LINUX_SYS_linux_ ## name) -#define ARGS(nm, fmt) "linux(%ld/%ld): "#nm"("fmt")\n", \ - (long)td->td_proc->p_pid, (long)td->td_tid -#define LMSG(fmt) "linux(%ld/%ld): "fmt"\n", \ - (long)td->td_proc->p_pid, (long)td->td_tid #define LINUX_DTRACE linuxulator /* Modified: stable/12/sys/amd64/linux/linux_sysvec.c ============================================================================== --- stable/12/sys/amd64/linux/linux_sysvec.c Mon Aug 24 16:45:23 2020 (r364711) +++ stable/12/sys/amd64/linux/linux_sysvec.c Mon Aug 24 17:06:34 2020 (r364712) @@ -85,20 +85,6 @@ __FBSDID("$FreeBSD$"); MODULE_VERSION(linux64, 1); -#if defined(DEBUG) -SYSCTL_PROC(_compat_linux, OID_AUTO, debug, - CTLTYPE_STRING | CTLFLAG_RW, - 0, 0, linux_sysctl_debug, "A", - "Linux 64 debugging control"); -#endif - -/* - * Allow the sendsig functions to use the ldebug() facility even though they - * are not syscalls themselves. Map them to syscall 0. This is slightly less - * bogus than using ldebug(sigreturn). - */ -#define LINUX_SYS_linux_rt_sendsig 0 - const char *linux_kplatform; static int linux_szsigcode; static vm_object_t linux_shared_page_obj; @@ -650,9 +636,6 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigse /* Copy the sigframe out to the user's stack. */ if (copyout(&sf, sfp, sizeof(*sfp)) != 0) { -#ifdef DEBUG - printf("process %ld has trashed its stack\n", (long)p->p_pid); -#endif PROC_LOCK(p); sigexit(td, SIGILL); } Modified: stable/12/sys/amd64/linux32/linux.h ============================================================================== --- stable/12/sys/amd64/linux32/linux.h Mon Aug 24 16:45:23 2020 (r364711) +++ stable/12/sys/amd64/linux32/linux.h Mon Aug 24 17:06:34 2020 (r364712) @@ -42,15 +42,6 @@ #define LINUX_LEGACY_SYSCALLS -/* - * debugging support - */ -extern u_char linux_debug_map[]; -#define ldebug(name) isclr(linux_debug_map, LINUX32_SYS_linux_ ## name) -#define ARGS(nm, fmt) "linux(%ld/%ld): "#nm"("fmt")\n", \ - (long)td->td_proc->p_pid, (long)td->td_tid -#define LMSG(fmt) "linux(%ld/%ld): "fmt"\n", \ - (long)td->td_proc->p_pid, (long)td->td_tid #define LINUX_DTRACE linuxulator32 #define LINUX32_MAXUSER ((1ul << 32) - PAGE_SIZE) Modified: stable/12/sys/amd64/linux32/linux32_machdep.c ============================================================================== --- stable/12/sys/amd64/linux32/linux32_machdep.c Mon Aug 24 16:45:23 2020 (r364711) +++ stable/12/sys/amd64/linux32/linux32_machdep.c Mon Aug 24 17:06:34 2020 (r364712) @@ -133,11 +133,6 @@ linux_execve(struct thread *td, struct linux_execve_ar LCONVPATHEXIST(td, args->path, &path); -#ifdef DEBUG - if (ldebug(execve)) - printf(ARGS(execve, "%s"), path); -#endif - error = freebsd32_exec_copyin_args(&eargs, path, UIO_SYSSPACE, args->argp, args->envp); free(path, M_TEMP); @@ -382,11 +377,6 @@ linux_old_select(struct thread *td, struct linux_old_s struct linux_select_args newsel; int error; -#ifdef DEBUG - if (ldebug(old_select)) - printf(ARGS(old_select, "%p"), args->ptr); -#endif - error = copyin(args->ptr, &linux_args, sizeof(linux_args)); if (error) return (error); @@ -410,29 +400,19 @@ linux_set_cloned_tls(struct thread *td, void *desc) error = copyin(desc, &info, sizeof(struct l_user_desc)); if (error) { - printf(LMSG("copyin failed!")); + linux_msg(td, "set_cloned_tls copyin info failed!"); } else { + /* We might copy out the entry_number as GUGS32_SEL. */ info.entry_number = GUGS32_SEL; error = copyout(&info, desc, sizeof(struct l_user_desc)); if (error) - printf(LMSG("copyout failed!")); + linux_msg(td, "set_cloned_tls copyout info failed!"); a[0] = LINUX_LDT_entry_a(&info); a[1] = LINUX_LDT_entry_b(&info); memcpy(&sd, &a, sizeof(a)); -#ifdef DEBUG - if (ldebug(clone)) - printf("Segment created in clone with " - "CLONE_SETTLS: lobase: %x, hibase: %x, " - "lolimit: %x, hilimit: %x, type: %i, " - "dpl: %i, p: %i, xx: %i, long: %i, " - "def32: %i, gran: %i\n", sd.sd_lobase, - sd.sd_hibase, sd.sd_lolimit, sd.sd_hilimit, - sd.sd_type, sd.sd_dpl, sd.sd_p, sd.sd_xx, - sd.sd_long, sd.sd_def32, sd.sd_gran); -#endif pcb = td->td_pcb; pcb->pcb_gsbase = (register_t)info.base_addr; td->td_frame->tf_gs = GSEL(GUGS32_SEL, SEL_UPL); @@ -461,13 +441,6 @@ int linux_mmap2(struct thread *td, struct linux_mmap2_args *args) { -#ifdef DEBUG - if (ldebug(mmap2)) - printf(ARGS(mmap2, "0x%08x, %d, %d, 0x%08x, %d, %d"), - args->addr, args->len, args->prot, - args->flags, args->fd, args->pgoff); -#endif - return (linux_mmap_common(td, PTROUT(args->addr), args->len, args->prot, args->flags, args->fd, (uint64_t)(uint32_t)args->pgoff * PAGE_SIZE)); @@ -483,13 +456,6 @@ linux_mmap(struct thread *td, struct linux_mmap_args * if (error) return (error); -#ifdef DEBUG - if (ldebug(mmap)) - printf(ARGS(mmap, "0x%08x, %d, %d, 0x%08x, %d, %d"), - linux_args.addr, linux_args.len, linux_args.prot, - linux_args.flags, linux_args.fd, linux_args.pgoff); -#endif - return (linux_mmap_common(td, linux_args.addr, linux_args.len, linux_args.prot, linux_args.flags, linux_args.fd, (uint32_t)linux_args.pgoff)); @@ -526,12 +492,6 @@ linux_sigaction(struct thread *td, struct linux_sigact l_sigaction_t act, oact; int error; -#ifdef DEBUG - if (ldebug(sigaction)) - printf(ARGS(sigaction, "%d, %p, %p"), - args->sig, (void *)args->nsa, (void *)args->osa); -#endif - if (args->nsa != NULL) { error = copyin(args->nsa, &osa, sizeof(l_osigaction_t)); if (error) @@ -568,11 +528,6 @@ linux_sigsuspend(struct thread *td, struct linux_sigsu sigset_t sigmask; l_sigset_t mask; -#ifdef DEBUG - if (ldebug(sigsuspend)) - printf(ARGS(sigsuspend, "%08lx"), (unsigned long)args->mask); -#endif - LINUX_SIGEMPTYSET(mask); mask.__mask = args->mask; linux_to_bsd_sigset(&mask, &sigmask); @@ -586,12 +541,6 @@ linux_rt_sigsuspend(struct thread *td, struct linux_rt sigset_t sigmask; int error; -#ifdef DEBUG - if (ldebug(rt_sigsuspend)) - printf(ARGS(rt_sigsuspend, "%p, %d"), - (void *)uap->newset, uap->sigsetsize); -#endif - if (uap->sigsetsize != sizeof(l_sigset_t)) return (EINVAL); @@ -609,11 +558,6 @@ linux_pause(struct thread *td, struct linux_pause_args struct proc *p = td->td_proc; sigset_t sigmask; -#ifdef DEBUG - if (ldebug(pause)) - printf(ARGS(pause, "")); -#endif - PROC_LOCK(p); sigmask = td->td_sigmask; PROC_UNLOCK(p); @@ -627,11 +571,6 @@ linux_sigaltstack(struct thread *td, struct linux_siga l_stack_t lss; int error; -#ifdef DEBUG - if (ldebug(sigaltstack)) - printf(ARGS(sigaltstack, "%p, %p"), uap->uss, uap->uoss); -#endif - if (uap->uss != NULL) { error = copyin(uap->uss, &lss, sizeof(l_stack_t)); if (error) @@ -730,15 +669,6 @@ linux_set_thread_area(struct thread *td, if (error) return (error); -#ifdef DEBUG - if (ldebug(set_thread_area)) - printf(ARGS(set_thread_area, "%i, %x, %x, %i, %i, %i, " - "%i, %i, %i"), info.entry_number, info.base_addr, - info.limit, info.seg_32bit, info.contents, - info.read_exec_only, info.limit_in_pages, - info.seg_not_present, info.useable); -#endif - /* * Semantics of Linux version: every thread in the system has array * of three TLS descriptors. 1st is GLIBC TLS, 2nd is WINE, 3rd unknown. @@ -792,25 +722,6 @@ linux_set_thread_area(struct thread *td, } memcpy(&sd, &a, sizeof(a)); -#ifdef DEBUG - if (ldebug(set_thread_area)) - printf("Segment created in set_thread_area: " - "lobase: %x, hibase: %x, lolimit: %x, hilimit: %x, " - "type: %i, dpl: %i, p: %i, xx: %i, long: %i, " - "def32: %i, gran: %i\n", - sd.sd_lobase, - sd.sd_hibase, - sd.sd_lolimit, - sd.sd_hilimit, - sd.sd_type, - sd.sd_dpl, - sd.sd_p, - sd.sd_xx, - sd.sd_long, - sd.sd_def32, - sd.sd_gran); -#endif - pcb = td->td_pcb; pcb->pcb_gsbase = (register_t)info.base_addr; set_pcb_flags(pcb, PCB_32BIT); Modified: stable/12/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- stable/12/sys/amd64/linux32/linux32_sysvec.c Mon Aug 24 16:45:23 2020 (r364711) +++ stable/12/sys/amd64/linux32/linux32_sysvec.c Mon Aug 24 17:06:34 2020 (r364712) @@ -90,14 +90,6 @@ __FBSDID("$FreeBSD$"); MODULE_VERSION(linux, 1); -/* - * Allow the sendsig functions to use the ldebug() facility even though they - * are not syscalls themselves. Map them to syscall 0. This is slightly less - * bogus than using ldebug(sigreturn). - */ -#define LINUX32_SYS_linux_rt_sendsig 0 -#define LINUX32_SYS_linux_sendsig 0 - const char *linux_kplatform; static int linux_szsigcode; static vm_object_t linux_shared_page_obj; @@ -285,11 +277,6 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigse regs = td->td_frame; oonstack = sigonstack(regs->tf_rsp); -#ifdef DEBUG - if (ldebug(rt_sendsig)) - printf(ARGS(rt_sendsig, "%p, %d, %p, %u"), - catcher, sig, (void*)mask, code); -#endif /* Allocate space for the signal handler context. */ if ((td->td_pflags & TDP_ALTSTACK) && !oonstack && SIGISMEMBER(psp->ps_sigonstack, sig)) { @@ -348,23 +335,11 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigse frame.sf_sc.uc_mcontext.sc_cr2 = (u_int32_t)(uintptr_t)ksi->ksi_addr; frame.sf_sc.uc_mcontext.sc_trapno = bsd_to_linux_trapcode(code); -#ifdef DEBUG - if (ldebug(rt_sendsig)) - printf(LMSG("rt_sendsig flags: 0x%x, sp: %p, ss: 0x%lx, mask: 0x%x"), - frame.sf_sc.uc_stack.ss_flags, td->td_sigstk.ss_sp, - td->td_sigstk.ss_size, frame.sf_sc.uc_mcontext.sc_mask); -#endif - if (copyout(&frame, fp, sizeof(frame)) != 0) { /* * Process has trashed its stack; give it an illegal * instruction to halt it in its tracks. */ -#ifdef DEBUG - if (ldebug(rt_sendsig)) - printf(LMSG("rt_sendsig: bad stack %p, oonstack=%x"), - fp, oonstack); -#endif PROC_LOCK(p); sigexit(td, SIGILL); } @@ -422,12 +397,6 @@ linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t regs = td->td_frame; oonstack = sigonstack(regs->tf_rsp); -#ifdef DEBUG - if (ldebug(sendsig)) - printf(ARGS(sendsig, "%p, %d, %p, %u"), - catcher, sig, (void*)mask, code); -#endif - /* Allocate space for the signal handler context. */ if ((td->td_pflags & TDP_ALTSTACK) && !oonstack && SIGISMEMBER(psp->ps_sigonstack, sig)) { @@ -520,10 +489,6 @@ linux_sigreturn(struct thread *td, struct linux_sigret regs = td->td_frame; -#ifdef DEBUG - if (ldebug(sigreturn)) - printf(ARGS(sigreturn, "%p"), (void *)args->sfp); -#endif /* * The trampoline code hands us the sigframe. * It is unsafe to keep track of it ourselves, in the event that a @@ -605,10 +570,6 @@ linux_rt_sigreturn(struct thread *td, struct linux_rt_ regs = td->td_frame; -#ifdef DEBUG - if (ldebug(rt_sigreturn)) - printf(ARGS(rt_sigreturn, "%p"), (void *)args->ucp); -#endif /* * The trampoline code hands us the ucontext. * It is unsafe to keep track of it ourselves, in the event that a @@ -673,11 +634,6 @@ linux_rt_sigreturn(struct thread *td, struct linux_rt_ ss.ss_size = lss->ss_size; ss.ss_flags = linux_to_bsd_sigaltstack(lss->ss_flags); -#ifdef DEBUG - if (ldebug(rt_sigreturn)) - printf(LMSG("rt_sigret flags: 0x%x, sp: %p, ss: 0x%lx, mask: 0x%x"), - ss.ss_flags, ss.ss_sp, ss.ss_size, context->sc_mask); -#endif (void)kern_sigaltstack(td, &ss, NULL); return (EJUSTRETURN); @@ -867,11 +823,6 @@ SYSCTL_ULONG(_compat_linux32, OID_AUTO, maxssiz, CTLFL static u_long linux32_maxvmem = LINUX32_MAXVMEM; SYSCTL_ULONG(_compat_linux32, OID_AUTO, maxvmem, CTLFLAG_RW, &linux32_maxvmem, 0, ""); - -#if defined(DEBUG) -SYSCTL_PROC(_compat_linux32, OID_AUTO, debug, CTLTYPE_STRING | CTLFLAG_RW, 0, 0, - linux_sysctl_debug, "A", "Linux debugging control"); -#endif static void linux32_fixlimit(struct rlimit *rl, int which) Modified: stable/12/sys/arm64/linux/linux.h ============================================================================== --- stable/12/sys/arm64/linux/linux.h Mon Aug 24 16:45:23 2020 (r364711) +++ stable/12/sys/arm64/linux/linux.h Mon Aug 24 17:06:34 2020 (r364712) @@ -36,14 +36,6 @@ #include #include -/* Debugging support */ -#define DEBUG -extern u_char linux_debug_map[]; -#define ldebug(name) isclr(linux_debug_map, LINUX_SYS_linux_ ## name) -#define ARGS(nm, fmt) "linux(%ld/%ld): "#nm"("fmt")\n", \ - (long)td->td_proc->p_pid, (long)td->td_tid -#define LMSG(fmt) "linux(%ld/%ld): "fmt"\n", \ - (long)td->td_proc->p_pid, (long)td->td_tid #define LINUX_DTRACE linuxulator /* Provide a separate set of types for the Linux types */ Modified: stable/12/sys/arm64/linux/linux_sysvec.c ============================================================================== --- stable/12/sys/arm64/linux/linux_sysvec.c Mon Aug 24 16:45:23 2020 (r364711) +++ stable/12/sys/arm64/linux/linux_sysvec.c Mon Aug 24 17:06:34 2020 (r364712) @@ -59,11 +59,6 @@ __FBSDID("$FreeBSD$"); MODULE_VERSION(linux64elf, 1); -#if defined(DEBUG) -SYSCTL_PROC(_compat_linux, OID_AUTO, debug, CTLTYPE_STRING | CTLFLAG_RW, 0, 0, - linux_sysctl_debug, "A", "64-bit Linux debugging control"); -#endif - const char *linux_kplatform; static int linux_szsigcode; static vm_object_t linux_shared_page_obj; Modified: stable/12/sys/compat/linux/linux_file.c ============================================================================== --- stable/12/sys/compat/linux/linux_file.c Mon Aug 24 16:45:23 2020 (r364711) +++ stable/12/sys/compat/linux/linux_file.c Mon Aug 24 17:06:34 2020 (r364712) @@ -76,10 +76,7 @@ linux_creat(struct thread *td, struct linux_creat_args int error; LCONVPATHEXIST(td, args->path, &path); -#ifdef DEBUG - if (ldebug(creat)) - printf(ARGS(creat, "%s, %d"), path, args->mode); -#endif + error = kern_openat(td, AT_FDCWD, path, UIO_SYSSPACE, O_WRONLY | O_CREAT | O_TRUNC, args->mode); LFREEPATH(path); @@ -170,14 +167,6 @@ linux_common_open(struct thread *td, int dirfd, char * } done: -#ifdef DEBUG -#ifdef LINUX_LEGACY_SYSCALLS - if (ldebug(open)) -#else - if (ldebug(openat)) -#endif - printf(LMSG("open returns error %d"), error); -#endif LFREEPATH(path); return (error); } @@ -193,11 +182,7 @@ linux_openat(struct thread *td, struct linux_openat_ar LCONVPATH_AT(td, args->filename, &path, 1, dfd); else LCONVPATH_AT(td, args->filename, &path, 0, dfd); -#ifdef DEBUG - if (ldebug(openat)) - printf(ARGS(openat, "%i, %s, 0x%x, 0x%x"), args->dfd, - path, args->flags, args->mode); -#endif + return (linux_common_open(td, dfd, path, args->flags, args->mode)); } @@ -211,11 +196,7 @@ linux_open(struct thread *td, struct linux_open_args * LCONVPATHCREAT(td, args->path, &path); else LCONVPATHEXIST(td, args->path, &path); -#ifdef DEBUG - if (ldebug(open)) - printf(ARGS(open, "%s, 0x%x, 0x%x"), - path, args->flags, args->mode); -#endif + return (linux_common_open(td, AT_FDCWD, path, args->flags, args->mode)); } #endif @@ -224,11 +205,6 @@ int linux_lseek(struct thread *td, struct linux_lseek_args *args) { -#ifdef DEBUG - if (ldebug(lseek)) - printf(ARGS(lseek, "%d, %ld, %d"), - args->fdes, (long)args->off, args->whence); -#endif return (kern_lseek(td, args->fdes, args->off, args->whence)); } @@ -239,11 +215,6 @@ linux_llseek(struct thread *td, struct linux_llseek_ar int error; off_t off; -#ifdef DEBUG - if (ldebug(llseek)) - printf(ARGS(llseek, "%d, %d:%d, %d"), - args->fd, args->ohigh, args->olow, args->whence); -#endif off = (args->olow) | (((off_t) args->ohigh) << 32); error = kern_lseek(td, args->fd, off, args->whence); @@ -332,10 +303,6 @@ linux_getdents(struct thread *td, struct linux_getdent int buflen, error; size_t retval; -#ifdef DEBUG - if (ldebug(getdents)) - printf(ARGS(getdents, "%d, *, %d"), args->fd, args->count); -#endif buflen = min(args->count, MAXBSIZE); buf = malloc(buflen, M_TEMP, M_WAITOK); @@ -413,10 +380,6 @@ linux_getdents64(struct thread *td, struct linux_getde int buflen, error; size_t retval; -#ifdef DEBUG - if (ldebug(getdents64)) - uprintf(ARGS(getdents64, "%d, *, %d"), args->fd, args->count); -#endif buflen = min(args->count, MAXBSIZE); buf = malloc(buflen, M_TEMP, M_WAITOK); @@ -488,10 +451,6 @@ linux_readdir(struct thread *td, struct linux_readdir_ struct l_dirent *linux_dirent; int buflen, error; -#ifdef DEBUG - if (ldebug(readdir)) - printf(ARGS(readdir, "%d, *"), args->fd); -#endif buflen = LINUX_RECLEN(LINUX_NAME_MAX); buf = malloc(buflen, M_TEMP, M_WAITOK); @@ -544,10 +503,6 @@ linux_access(struct thread *td, struct linux_access_ar LCONVPATHEXIST(td, args->path, &path); -#ifdef DEBUG - if (ldebug(access)) - printf(ARGS(access, "%s, %d"), path, args->amode); -#endif error = kern_accessat(td, AT_FDCWD, path, UIO_SYSSPACE, 0, args->amode); LFREEPATH(path); @@ -569,11 +524,6 @@ linux_faccessat(struct thread *td, struct linux_facces dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd; LCONVPATHEXIST_AT(td, args->filename, &path, dfd); -#ifdef DEBUG - if (ldebug(faccessat)) - printf(ARGS(access, "%s, %d"), path, args->amode); -#endif - error = kern_accessat(td, dfd, path, UIO_SYSSPACE, 0, args->amode); LFREEPATH(path); @@ -590,11 +540,6 @@ linux_unlink(struct thread *td, struct linux_unlink_ar LCONVPATHEXIST(td, args->path, &path); -#ifdef DEBUG - if (ldebug(unlink)) - printf(ARGS(unlink, "%s"), path); -#endif - error = kern_unlinkat(td, AT_FDCWD, path, UIO_SYSSPACE, 0); if (error == EPERM) { /* Introduce POSIX noncompliant behaviour of Linux */ @@ -622,11 +567,6 @@ linux_unlinkat(struct thread *td, struct linux_unlinka dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd; LCONVPATHEXIST_AT(td, args->pathname, &path, dfd); -#ifdef DEBUG - if (ldebug(unlinkat)) - printf(ARGS(unlinkat, "%s"), path); -#endif - if (args->flag & LINUX_AT_REMOVEDIR) error = kern_rmdirat(td, dfd, path, UIO_SYSSPACE); else @@ -648,10 +588,6 @@ linux_chdir(struct thread *td, struct linux_chdir_args LCONVPATHEXIST(td, args->path, &path); -#ifdef DEBUG - if (ldebug(chdir)) - printf(ARGS(chdir, "%s"), path); -#endif error = kern_chdir(td, path, UIO_SYSSPACE); LFREEPATH(path); return (error); @@ -666,10 +602,6 @@ linux_chmod(struct thread *td, struct linux_chmod_args LCONVPATHEXIST(td, args->path, &path); -#ifdef DEBUG - if (ldebug(chmod)) - printf(ARGS(chmod, "%s, %d"), path, args->mode); -#endif error = kern_fchmodat(td, AT_FDCWD, path, UIO_SYSSPACE, args->mode, 0); LFREEPATH(path); @@ -686,11 +618,6 @@ linux_fchmodat(struct thread *td, struct linux_fchmoda dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd; LCONVPATHEXIST_AT(td, args->filename, &path, dfd); -#ifdef DEBUG - if (ldebug(fchmodat)) - printf(ARGS(fchmodat, "%s, %d"), path, args->mode); -#endif - error = kern_fchmodat(td, dfd, path, UIO_SYSSPACE, args->mode, 0); LFREEPATH(path); return (error); @@ -705,10 +632,6 @@ linux_mkdir(struct thread *td, struct linux_mkdir_args LCONVPATHCREAT(td, args->path, &path); -#ifdef DEBUG - if (ldebug(mkdir)) - printf(ARGS(mkdir, "%s, %d"), path, args->mode); -#endif error = kern_mkdirat(td, AT_FDCWD, path, UIO_SYSSPACE, args->mode); LFREEPATH(path); return (error); @@ -724,10 +647,6 @@ linux_mkdirat(struct thread *td, struct linux_mkdirat_ dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd; LCONVPATHCREAT_AT(td, args->pathname, &path, dfd); -#ifdef DEBUG - if (ldebug(mkdirat)) - printf(ARGS(mkdirat, "%s, %d"), path, args->mode); -#endif error = kern_mkdirat(td, dfd, path, UIO_SYSSPACE, args->mode); LFREEPATH(path); return (error); @@ -742,10 +661,6 @@ linux_rmdir(struct thread *td, struct linux_rmdir_args LCONVPATHEXIST(td, args->path, &path); -#ifdef DEBUG - if (ldebug(rmdir)) - printf(ARGS(rmdir, "%s"), path); -#endif error = kern_rmdirat(td, AT_FDCWD, path, UIO_SYSSPACE); LFREEPATH(path); return (error); @@ -765,10 +680,6 @@ linux_rename(struct thread *td, struct linux_rename_ar return (error); } -#ifdef DEBUG - if (ldebug(rename)) - printf(ARGS(rename, "%s, %s"), from, to); -#endif error = kern_renameat(td, AT_FDCWD, from, AT_FDCWD, to, UIO_SYSSPACE); LFREEPATH(from); LFREEPATH(to); @@ -812,10 +723,6 @@ linux_renameat2(struct thread *td, struct linux_rename return (error); } -#ifdef DEBUG - if (ldebug(renameat)) - printf(ARGS(renameat, "%s, %s"), from, to); -#endif error = kern_renameat(td, olddfd, from, newdfd, to, UIO_SYSSPACE); LFREEPATH(from); LFREEPATH(to); @@ -837,10 +744,6 @@ linux_symlink(struct thread *td, struct linux_symlink_ return (error); } -#ifdef DEBUG - if (ldebug(symlink)) - printf(ARGS(symlink, "%s, %s"), path, to); -#endif error = kern_symlinkat(td, path, AT_FDCWD, to, UIO_SYSSPACE); LFREEPATH(path); LFREEPATH(to); @@ -863,11 +766,6 @@ linux_symlinkat(struct thread *td, struct linux_symlin return (error); } -#ifdef DEBUG - if (ldebug(symlinkat)) - printf(ARGS(symlinkat, "%s, %s"), path, to); -#endif - error = kern_symlinkat(td, path, dfd, to, UIO_SYSSPACE); LFREEPATH(path); LFREEPATH(to); @@ -883,11 +781,6 @@ linux_readlink(struct thread *td, struct linux_readlin LCONVPATHEXIST(td, args->name, &name); -#ifdef DEBUG - if (ldebug(readlink)) - printf(ARGS(readlink, "%s, %p, %d"), name, (void *)args->buf, - args->count); -#endif error = kern_readlinkat(td, AT_FDCWD, name, UIO_SYSSPACE, args->buf, UIO_USERSPACE, args->count); LFREEPATH(name); @@ -904,12 +797,6 @@ linux_readlinkat(struct thread *td, struct linux_readl dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd; LCONVPATHEXIST_AT(td, args->path, &name, dfd); -#ifdef DEBUG - if (ldebug(readlinkat)) - printf(ARGS(readlinkat, "%s, %p, %d"), name, (void *)args->buf, - args->bufsiz); -#endif - error = kern_readlinkat(td, dfd, name, UIO_SYSSPACE, args->buf, UIO_USERSPACE, args->bufsiz); LFREEPATH(name); @@ -923,11 +810,6 @@ linux_truncate(struct thread *td, struct linux_truncat int error; LCONVPATHEXIST(td, args->path, &path); -#ifdef DEBUG - if (ldebug(truncate)) - printf(ARGS(truncate, "%s, %ld"), path, (long)args->length); -#endif - error = kern_truncate(td, path, UIO_SYSSPACE, args->length); LFREEPATH(path); return (error); @@ -949,11 +831,6 @@ linux_truncate64(struct thread *td, struct linux_trunc LCONVPATHEXIST(td, args->path, &path); -#ifdef DEBUG - if (ldebug(truncate64)) - printf(ARGS(truncate64, "%s, %jd"), path, length); -#endif - error = kern_truncate(td, path, UIO_SYSSPACE, length); LFREEPATH(path); return (error); @@ -998,10 +875,6 @@ linux_link(struct thread *td, struct linux_link_args * return (error); } -#ifdef DEBUG - if (ldebug(link)) - printf(ARGS(link, "%s, %s"), path, to); -#endif error = kern_linkat(td, AT_FDCWD, AT_FDCWD, path, to, UIO_SYSSPACE, FOLLOW); LFREEPATH(path); @@ -1029,12 +902,6 @@ linux_linkat(struct thread *td, struct linux_linkat_ar return (error); } -#ifdef DEBUG - if (ldebug(linkat)) - printf(ARGS(linkat, "%i, %s, %i, %s, %i"), args->olddfd, path, - args->newdfd, to, args->flag); -#endif - follow = (args->flag & LINUX_AT_SYMLINK_FOLLOW) == 0 ? NOFOLLOW : FOLLOW; error = kern_linkat(td, olddfd, newdfd, path, to, UIO_SYSSPACE, follow); @@ -1189,12 +1056,6 @@ linux_mount(struct thread *td, struct linux_mount_args if (error != 0) goto out; -#ifdef DEBUG - if (ldebug(mount)) - printf(ARGS(mount, "%s, %s, %s"), - fstypename, mntfromname, mntonname); -#endif - if (strcmp(fstypename, "ext2") == 0) { strcpy(fstypename, "ext2fs"); } else if (strcmp(fstypename, "proc") == 0) { @@ -1503,11 +1364,6 @@ int linux_fcntl(struct thread *td, struct linux_fcntl_args *args) { -#ifdef DEBUG - if (ldebug(fcntl)) - printf(ARGS(fcntl, "%d, %08x, *"), args->fd, args->cmd); -#endif - return (fcntl_common(td, args)); } @@ -1520,11 +1376,6 @@ linux_fcntl64(struct thread *td, struct linux_fcntl64_ struct linux_fcntl_args fcntl_args; int error; -#ifdef DEBUG - if (ldebug(fcntl64)) - printf(ARGS(fcntl64, "%d, %08x, *"), args->fd, args->cmd); -#endif - switch (args->cmd) { case LINUX_F_GETLK64: error = copyin((void *)args->arg, &linux_flock, @@ -1574,10 +1425,6 @@ linux_chown(struct thread *td, struct linux_chown_args LCONVPATHEXIST(td, args->path, &path); -#ifdef DEBUG - if (ldebug(chown)) - printf(ARGS(chown, "%s, %d, %d"), path, args->uid, args->gid); -#endif error = kern_fchownat(td, AT_FDCWD, path, UIO_SYSSPACE, args->uid, args->gid, 0); LFREEPATH(path); @@ -1597,11 +1444,6 @@ linux_fchownat(struct thread *td, struct linux_fchowna dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd; LCONVPATHEXIST_AT(td, args->filename, &path, dfd); -#ifdef DEBUG - if (ldebug(fchownat)) - printf(ARGS(fchownat, "%s, %d, %d"), path, args->uid, args->gid); -#endif - flag = (args->flag & LINUX_AT_SYMLINK_NOFOLLOW) == 0 ? 0 : AT_SYMLINK_NOFOLLOW; error = kern_fchownat(td, dfd, path, UIO_SYSSPACE, args->uid, args->gid, @@ -1619,10 +1461,6 @@ linux_lchown(struct thread *td, struct linux_lchown_ar LCONVPATHEXIST(td, args->path, &path); -#ifdef DEBUG - if (ldebug(lchown)) - printf(ARGS(lchown, "%s, %d, %d"), path, args->uid, args->gid); -#endif error = kern_fchownat(td, AT_FDCWD, path, UIO_SYSSPACE, args->uid, args->gid, AT_SYMLINK_NOFOLLOW); LFREEPATH(path); @@ -1698,11 +1536,6 @@ linux_pipe(struct thread *td, struct linux_pipe_args * int fildes[2]; int error; -#ifdef DEBUG - if (ldebug(pipe)) - printf(ARGS(pipe, "*")); -#endif - error = kern_pipe(td, fildes, 0, NULL, NULL); if (error != 0) return (error); @@ -1722,11 +1555,6 @@ linux_pipe2(struct thread *td, struct linux_pipe2_args { int fildes[2]; int error, flags; - -#ifdef DEBUG - if (ldebug(pipe2)) - printf(ARGS(pipe2, "*, %d"), args->flags); -#endif if ((args->flags & ~(LINUX_O_NONBLOCK | LINUX_O_CLOEXEC)) != 0) return (EINVAL); Modified: stable/12/sys/compat/linux/linux_fork.c ============================================================================== --- stable/12/sys/compat/linux/linux_fork.c Mon Aug 24 16:45:23 2020 (r364711) +++ stable/12/sys/compat/linux/linux_fork.c Mon Aug 24 17:06:34 2020 (r364712) @@ -74,11 +74,6 @@ linux_fork(struct thread *td, struct linux_fork_args * struct proc *p2; struct thread *td2; -#ifdef DEBUG - if (ldebug(fork)) - printf(ARGS(fork, "")); -#endif - bzero(&fr, sizeof(fr)); fr.fr_flags = RFFDG | RFPROC | RFSTOPPED; fr.fr_procp = &p2; @@ -110,11 +105,6 @@ linux_vfork(struct thread *td, struct linux_vfork_args struct proc *p2; struct thread *td2; -#ifdef DEBUG - if (ldebug(vfork)) - printf(ARGS(vfork, "")); -#endif - bzero(&fr, sizeof(fr)); fr.fr_flags = RFFDG | RFPROC | RFMEM | RFPPWAIT | RFSTOPPED; fr.fr_procp = &p2; @@ -149,14 +139,6 @@ linux_clone_proc(struct thread *td, struct linux_clone int exit_signal; struct linux_emuldata *em; -#ifdef DEBUG - if (ldebug(clone)) { - printf(ARGS(clone, "flags %x, stack %p, parent tid: %p, " - "child tid: %p"), (unsigned)args->flags, - args->stack, args->parent_tidptr, args->child_tidptr); - } -#endif - exit_signal = args->flags & 0x000000ff; if (LINUX_SIG_VALID(exit_signal)) { exit_signal = linux_to_bsd_signal(exit_signal); @@ -212,7 +194,7 @@ linux_clone_proc(struct thread *td, struct linux_clone error = copyout(&p2->p_pid, args->parent_tidptr, sizeof(p2->p_pid)); if (error) - printf(LMSG("copyout failed!")); + linux_msg(td, "copyout p_pid failed!"); } PROC_LOCK(p2); @@ -240,13 +222,6 @@ linux_clone_proc(struct thread *td, struct linux_clone sx_xunlock(&proctree_lock); } -#ifdef DEBUG - if (ldebug(clone)) - printf(LMSG("clone: successful rfork to %d, " - "stack %p sig = %d"), (int)p2->p_pid, args->stack, - exit_signal); -#endif - /* * Make this runnable after we are finished with it. */ @@ -268,14 +243,6 @@ linux_clone_thread(struct thread *td, struct linux_clo struct proc *p; int error; -#ifdef DEBUG - if (ldebug(clone)) { - printf(ARGS(clone, "thread: flags %x, stack %p, parent tid: %p, " - "child tid: %p"), (unsigned)args->flags, - args->stack, args->parent_tidptr, args->child_tidptr); - } -#endif - LINUX_CTR4(clone_thread, "thread(%d) flags %x ptid %p ctid %p", td->td_tid, (unsigned)args->flags, args->parent_tidptr, args->child_tidptr); @@ -360,12 +327,6 @@ linux_clone_thread(struct thread *td, struct linux_clo tidhash_add(newtd); -#ifdef DEBUG - if (ldebug(clone)) - printf(ARGS(clone, "successful clone to %d, stack %p"), - (int)newtd->td_tid, args->stack); -#endif - LINUX_CTR2(clone_thread, "thread(%d) successful clone to %d", td->td_tid, newtd->td_tid); @@ -373,7 +334,7 @@ linux_clone_thread(struct thread *td, struct linux_clo error = copyout(&newtd->td_tid, args->parent_tidptr, sizeof(newtd->td_tid)); if (error) - printf(LMSG("clone_thread: copyout failed!")); + linux_msg(td, "clone_thread: copyout td_tid failed!"); } /* Modified: stable/12/sys/compat/linux/linux_getcwd.c ============================================================================== --- stable/12/sys/compat/linux/linux_getcwd.c Mon Aug 24 16:45:23 2020 (r364711) +++ stable/12/sys/compat/linux/linux_getcwd.c Mon Aug 24 17:06:34 2020 (r364712) @@ -65,11 +65,6 @@ linux_getcwd(struct thread *td, struct linux_getcwd_ar char *path; int error, lenused; -#ifdef DEBUG - if (ldebug(getcwd)) - printf(ARGS(getcwd, "%p, %ld"), args->buf, (long)args->bufsize); -#endif - /* * Linux returns ERANGE instead of EINVAL. */ Modified: stable/12/sys/compat/linux/linux_ioctl.c ============================================================================== --- stable/12/sys/compat/linux/linux_ioctl.c Mon Aug 24 16:45:23 2020 (r364711) +++ stable/12/sys/compat/linux/linux_ioctl.c Mon Aug 24 17:06:34 2020 (r364712) @@ -241,12 +241,7 @@ linux_ioctl_hdio(struct thread *td, struct linux_ioctl */ bytespercyl = (off_t) sectorsize * fwheads * fwsectors; fwcylinders = mediasize / bytespercyl; -#if defined(DEBUG) - linux_msg(td, "HDIO_GET_GEO: mediasize %jd, c/h/s %d/%d/%d, " - "bpc %jd", - (intmax_t)mediasize, fwcylinders, fwheads, fwsectors, - (intmax_t)bytespercyl); -#endif + if ((args->cmd & 0xffff) == LINUX_HDIO_GET_GEO) { struct linux_hd_geometry hdg; @@ -438,19 +433,6 @@ bsd_to_linux_termios(struct termios *bios, struct linu { int i; -#ifdef DEBUG - if (ldebug(ioctl)) { - printf("LINUX: BSD termios structure (input):\n"); - printf("i=%08x o=%08x c=%08x l=%08x ispeed=%d ospeed=%d\n", - bios->c_iflag, bios->c_oflag, bios->c_cflag, bios->c_lflag, - bios->c_ispeed, bios->c_ospeed); - printf("c_cc "); - for (i=0; ic_cc[i]); - printf("\n"); - } -#endif - lios->c_iflag = 0; if (bios->c_iflag & IGNBRK) lios->c_iflag |= LINUX_IGNBRK; @@ -561,19 +543,6 @@ bsd_to_linux_termios(struct termios *bios, struct linu lios->c_cc[i] = LINUX_POSIX_VDISABLE; } lios->c_line = 0; - -#ifdef DEBUG - if (ldebug(ioctl)) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-12@freebsd.org Mon Aug 24 17:25:29 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 13A8C3C8961; Mon, 24 Aug 2020 17:25:29 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZzXm6r2qz3yQ1; Mon, 24 Aug 2020 17:25:28 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 CDC301BF58; Mon, 24 Aug 2020 17:25:28 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OHPSQC012484; Mon, 24 Aug 2020 17:25:28 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OHPQmO012470; Mon, 24 Aug 2020 17:25:26 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241725.07OHPQmO012470@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 17:25:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364715 - in stable/12/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux sys vm X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in stable/12/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux sys vm X-SVN-Commit-Revision: 364715 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 17:25:29 -0000 Author: trasz Date: Mon Aug 24 17:25:26 2020 New Revision: 364715 URL: https://svnweb.freebsd.org/changeset/base/364715 Log: MFC r362440: Add linux_madvise(2) instead of having Linux apps call the native FreeBSD madvise(2) directly. While some of the flag values match, most don't. PR: kern/230160 Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/amd64/linux/linux_machdep.c stable/12/sys/amd64/linux/syscalls.master stable/12/sys/amd64/linux32/linux32_machdep.c stable/12/sys/amd64/linux32/syscalls.master stable/12/sys/arm64/linux/linux_machdep.c stable/12/sys/arm64/linux/syscalls.master stable/12/sys/compat/linux/linux_mmap.c stable/12/sys/compat/linux/linux_mmap.h stable/12/sys/i386/linux/linux_machdep.c stable/12/sys/i386/linux/syscalls.master stable/12/sys/sys/syscallsubr.h stable/12/sys/vm/vm_mmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/linux/linux_machdep.c ============================================================================== --- stable/12/sys/amd64/linux/linux_machdep.c Mon Aug 24 17:21:26 2020 (r364714) +++ stable/12/sys/amd64/linux/linux_machdep.c Mon Aug 24 17:25:26 2020 (r364715) @@ -141,6 +141,13 @@ linux_mprotect(struct thread *td, struct linux_mprotec } int +linux_madvise(struct thread *td, struct linux_madvise_args *uap) +{ + + return (linux_madvise_common(td, PTROUT(uap->addr), uap->len, uap->behav)); +} + +int linux_iopl(struct thread *td, struct linux_iopl_args *args) { int error; Modified: stable/12/sys/amd64/linux/syscalls.master ============================================================================== --- stable/12/sys/amd64/linux/syscalls.master Mon Aug 24 17:21:26 2020 (r364714) +++ stable/12/sys/amd64/linux/syscalls.master Mon Aug 24 17:25:26 2020 (r364715) @@ -94,7 +94,7 @@ l_size_t len, l_int fl); } 27 AUE_MINCORE STD { int linux_mincore(l_ulong start, \ l_size_t len, u_char *vec); } -28 AUE_MADVISE NOPROTO { int madvise(void *addr, size_t len, \ +28 AUE_MADVISE STD { int linux_madvise(void *addr, size_t len, \ int behav); } 29 AUE_NULL STD { int linux_shmget(l_key_t key, l_size_t size, \ l_int shmflg); } Modified: stable/12/sys/amd64/linux32/linux32_machdep.c ============================================================================== --- stable/12/sys/amd64/linux32/linux32_machdep.c Mon Aug 24 17:21:26 2020 (r364714) +++ stable/12/sys/amd64/linux32/linux32_machdep.c Mon Aug 24 17:25:26 2020 (r364715) @@ -469,6 +469,13 @@ linux_mprotect(struct thread *td, struct linux_mprotec } int +linux_madvise(struct thread *td, struct linux_madvise_args *uap) +{ + + return (linux_madvise_common(td, PTROUT(uap->addr), uap->len, uap->behav)); +} + +int linux_iopl(struct thread *td, struct linux_iopl_args *args) { int error; Modified: stable/12/sys/amd64/linux32/syscalls.master ============================================================================== --- stable/12/sys/amd64/linux32/syscalls.master Mon Aug 24 17:21:26 2020 (r364714) +++ stable/12/sys/amd64/linux32/syscalls.master Mon Aug 24 17:25:26 2020 (r364715) @@ -389,7 +389,7 @@ char *put_old); } 218 AUE_MINCORE STD { int linux_mincore(l_ulong start, \ l_size_t len, u_char *vec); } -219 AUE_MADVISE NOPROTO { int madvise(void *addr, size_t len, \ +219 AUE_MADVISE STD { int linux_madvise(void *addr, size_t len, \ int behav); } 220 AUE_GETDIRENTRIES STD { int linux_getdents64(l_uint fd, \ void *dirent, l_uint count); } Modified: stable/12/sys/arm64/linux/linux_machdep.c ============================================================================== --- stable/12/sys/arm64/linux/linux_machdep.c Mon Aug 24 17:21:26 2020 (r364714) +++ stable/12/sys/arm64/linux/linux_machdep.c Mon Aug 24 17:25:26 2020 (r364715) @@ -104,6 +104,13 @@ linux_mprotect(struct thread *td, struct linux_mprotec uap->prot)); } +int +linux_madvise(struct thread *td, struct linux_madvise_args *uap) +{ + + return (linux_madvise_common(td, PTROUT(uap->addr), uap->len, uap->behav)); +} + /* LINUXTODO: implement arm64 linux_rt_sigsuspend */ int linux_rt_sigsuspend(struct thread *td, struct linux_rt_sigsuspend_args *uap) Modified: stable/12/sys/arm64/linux/syscalls.master ============================================================================== --- stable/12/sys/arm64/linux/syscalls.master Mon Aug 24 17:21:26 2020 (r364714) +++ stable/12/sys/arm64/linux/syscalls.master Mon Aug 24 17:25:26 2020 (r364715) @@ -1310,8 +1310,9 @@ u_char *vec ); } -233 AUE_MADVISE NOPROTO { - int madvise(void *addr, +233 AUE_MADVISE STD { + int linux_madvise( + void *addr, size_t len, int behav ); Modified: stable/12/sys/compat/linux/linux_mmap.c ============================================================================== --- stable/12/sys/compat/linux/linux_mmap.c Mon Aug 24 17:21:26 2020 (r364714) +++ stable/12/sys/compat/linux/linux_mmap.c Mon Aug 24 17:25:26 2020 (r364715) @@ -233,6 +233,62 @@ linux_mprotect_common(struct thread *td, uintptr_t add return (kern_mprotect(td, addr, len, prot)); } +int +linux_madvise_common(struct thread *td, uintptr_t addr, size_t len, int behav) +{ + + switch (behav) { + case LINUX_MADV_NORMAL: + return (kern_madvise(td, addr, len, MADV_NORMAL)); + case LINUX_MADV_RANDOM: + return (kern_madvise(td, addr, len, MADV_RANDOM)); + case LINUX_MADV_SEQUENTIAL: + return (kern_madvise(td, addr, len, MADV_SEQUENTIAL)); + case LINUX_MADV_WILLNEED: + return (kern_madvise(td, addr, len, MADV_WILLNEED)); + case LINUX_MADV_DONTNEED: + return (kern_madvise(td, addr, len, MADV_DONTNEED)); + case LINUX_MADV_FREE: + return (kern_madvise(td, addr, len, MADV_FREE)); + case LINUX_MADV_REMOVE: + linux_msg(curthread, "unsupported madvise MADV_REMOVE"); + return (EINVAL); + case LINUX_MADV_DONTFORK: + return (kern_minherit(td, addr, len, INHERIT_NONE)); + case LINUX_MADV_DOFORK: + return (kern_minherit(td, addr, len, INHERIT_COPY)); + case LINUX_MADV_MERGEABLE: + linux_msg(curthread, "unsupported madvise MADV_MERGEABLE"); + return (EINVAL); + case LINUX_MADV_UNMERGEABLE: + /* We don't merge anyway. */ + return (0); + case LINUX_MADV_HUGEPAGE: + /* Ignored; on FreeBSD huge pages are always on. */ + return (0); + case LINUX_MADV_NOHUGEPAGE: + linux_msg(curthread, "unsupported madvise MADV_NOHUGEPAGE"); + return (EINVAL); + case LINUX_MADV_DONTDUMP: + return (kern_madvise(td, addr, len, MADV_NOCORE)); + case LINUX_MADV_DODUMP: + return (kern_madvise(td, addr, len, MADV_CORE)); + case LINUX_MADV_WIPEONFORK: + return (kern_minherit(td, addr, len, INHERIT_ZERO)); + case LINUX_MADV_KEEPONFORK: + return (kern_minherit(td, addr, len, INHERIT_COPY)); + case LINUX_MADV_HWPOISON: + linux_msg(curthread, "unsupported madvise MADV_HWPOISON"); + return (EINVAL); + case LINUX_MADV_SOFT_OFFLINE: + linux_msg(curthread, "unsupported madvise MADV_SOFT_OFFLINE"); + return (EINVAL); + default: + linux_msg(curthread, "unsupported madvise behav %d", behav); + return (EINVAL); + } +} + #if defined(__amd64__) static void linux_fixup_prot(struct thread *td, int *prot) Modified: stable/12/sys/compat/linux/linux_mmap.h ============================================================================== --- stable/12/sys/compat/linux/linux_mmap.h Mon Aug 24 17:21:26 2020 (r364714) +++ stable/12/sys/compat/linux/linux_mmap.h Mon Aug 24 17:25:26 2020 (r364715) @@ -45,8 +45,29 @@ #define LINUX_PROT_GROWSDOWN 0x01000000 #define LINUX_PROT_GROWSUP 0x02000000 +#define LINUX_MADV_NORMAL 0 +#define LINUX_MADV_RANDOM 1 +#define LINUX_MADV_SEQUENTIAL 2 +#define LINUX_MADV_WILLNEED 3 +#define LINUX_MADV_DONTNEED 4 +#define LINUX_MADV_FREE 8 +#define LINUX_MADV_REMOVE 9 +#define LINUX_MADV_DONTFORK 10 +#define LINUX_MADV_DOFORK 11 +#define LINUX_MADV_MERGEABLE 12 +#define LINUX_MADV_UNMERGEABLE 13 +#define LINUX_MADV_HUGEPAGE 14 +#define LINUX_MADV_NOHUGEPAGE 15 +#define LINUX_MADV_DONTDUMP 16 +#define LINUX_MADV_DODUMP 17 +#define LINUX_MADV_WIPEONFORK 18 +#define LINUX_MADV_KEEPONFORK 19 +#define LINUX_MADV_HWPOISON 100 +#define LINUX_MADV_SOFT_OFFLINE 101 + int linux_mmap_common(struct thread *, uintptr_t, size_t, int, int, int, off_t); int linux_mprotect_common(struct thread *, uintptr_t, size_t, int); +int linux_madvise_common(struct thread *, uintptr_t, size_t, int); #endif /* _LINUX_MMAP_H_ */ Modified: stable/12/sys/i386/linux/linux_machdep.c ============================================================================== --- stable/12/sys/i386/linux/linux_machdep.c Mon Aug 24 17:21:26 2020 (r364714) +++ stable/12/sys/i386/linux/linux_machdep.c Mon Aug 24 17:25:26 2020 (r364715) @@ -354,6 +354,13 @@ linux_mprotect(struct thread *td, struct linux_mprotec } int +linux_madvise(struct thread *td, struct linux_madvise_args *uap) +{ + + return (linux_madvise_common(td, PTROUT(uap->addr), uap->len, uap->behav)); +} + +int linux_ioperm(struct thread *td, struct linux_ioperm_args *args) { int error; Modified: stable/12/sys/i386/linux/syscalls.master ============================================================================== --- stable/12/sys/i386/linux/syscalls.master Mon Aug 24 17:21:26 2020 (r364714) +++ stable/12/sys/i386/linux/syscalls.master Mon Aug 24 17:25:26 2020 (r364715) @@ -392,7 +392,7 @@ char *put_old); } 218 AUE_MINCORE STD { int linux_mincore(l_ulong start, \ l_size_t len, u_char *vec); } -219 AUE_MADVISE NOPROTO { int madvise(void *addr, size_t len, \ +219 AUE_MADVISE STD { int linux_madvise(void *addr, size_t len, \ int behav); } 220 AUE_GETDIRENTRIES STD { int linux_getdents64(l_uint fd, \ void *dirent, l_uint count); } Modified: stable/12/sys/sys/syscallsubr.h ============================================================================== --- stable/12/sys/sys/syscallsubr.h Mon Aug 24 17:21:26 2020 (r364714) +++ stable/12/sys/sys/syscallsubr.h Mon Aug 24 17:25:26 2020 (r364715) @@ -170,6 +170,8 @@ int kern_lutimes(struct thread *td, char *path, enum u struct timeval *tptr, enum uio_seg tptrseg); int kern_madvise(struct thread *td, uintptr_t addr, size_t len, int behav); int kern_mincore(struct thread *td, uintptr_t addr, size_t len, char *vec); +int kern_minherit(struct thread *td, uintptr_t addr, size_t len, + int inherit); int kern_mkdirat(struct thread *td, int fd, char *path, enum uio_seg segflg, int mode); int kern_mkfifoat(struct thread *td, int fd, char *path, Modified: stable/12/sys/vm/vm_mmap.c ============================================================================== --- stable/12/sys/vm/vm_mmap.c Mon Aug 24 17:21:26 2020 (r364714) +++ stable/12/sys/vm/vm_mmap.c Mon Aug 24 17:25:26 2020 (r364715) @@ -645,13 +645,21 @@ struct minherit_args { int sys_minherit(struct thread *td, struct minherit_args *uap) { + + return (kern_minherit(td, (uintptr_t)uap->addr, uap->len, + uap->inherit)); +} + +int +kern_minherit(struct thread *td, uintptr_t addr0, size_t len, int inherit0) +{ vm_offset_t addr; vm_size_t size, pageoff; vm_inherit_t inherit; - addr = (vm_offset_t)uap->addr; - size = uap->len; - inherit = uap->inherit; + addr = (vm_offset_t)addr0; + size = len; + inherit = inherit0; pageoff = (addr & PAGE_MASK); addr -= pageoff; From owner-svn-src-stable-12@freebsd.org Mon Aug 24 17:29:42 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 53AAC3C8C63; Mon, 24 Aug 2020 17:29:42 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZzdf1xKcz40Bp; Mon, 24 Aug 2020 17:29:42 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 257AB1C380; Mon, 24 Aug 2020 17:29:42 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OHTgsf012741; Mon, 24 Aug 2020 17:29:42 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OHTbgA012720; Mon, 24 Aug 2020 17:29:37 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241729.07OHTbgA012720@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 17:29:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364716 - in stable/12/sys: amd64/linux amd64/linux32 arm64/linux i386/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in stable/12/sys: amd64/linux amd64/linux32 arm64/linux i386/linux X-SVN-Commit-Revision: 364716 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 17:29:42 -0000 Author: trasz Date: Mon Aug 24 17:29:37 2020 New Revision: 364716 URL: https://svnweb.freebsd.org/changeset/base/364716 Log: MFC r362441: Regen after r362440. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/amd64/linux/linux_proto.h stable/12/sys/amd64/linux/linux_syscall.h stable/12/sys/amd64/linux/linux_syscalls.c stable/12/sys/amd64/linux/linux_sysent.c stable/12/sys/amd64/linux/linux_systrace_args.c stable/12/sys/amd64/linux32/linux32_proto.h stable/12/sys/amd64/linux32/linux32_syscall.h stable/12/sys/amd64/linux32/linux32_syscalls.c stable/12/sys/amd64/linux32/linux32_sysent.c stable/12/sys/amd64/linux32/linux32_systrace_args.c stable/12/sys/arm64/linux/linux_proto.h stable/12/sys/arm64/linux/linux_syscall.h stable/12/sys/arm64/linux/linux_syscalls.c stable/12/sys/arm64/linux/linux_sysent.c stable/12/sys/arm64/linux/linux_systrace_args.c stable/12/sys/i386/linux/linux_proto.h stable/12/sys/i386/linux/linux_syscall.h stable/12/sys/i386/linux/linux_syscalls.c stable/12/sys/i386/linux/linux_sysent.c stable/12/sys/i386/linux/linux_systrace_args.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/linux/linux_proto.h ============================================================================== --- stable/12/sys/amd64/linux/linux_proto.h Mon Aug 24 17:25:26 2020 (r364715) +++ stable/12/sys/amd64/linux/linux_proto.h Mon Aug 24 17:29:37 2020 (r364716) @@ -136,6 +136,11 @@ struct linux_mincore_args { char len_l_[PADL_(l_size_t)]; l_size_t len; char len_r_[PADR_(l_size_t)]; char vec_l_[PADL_(u_char *)]; u_char * vec; char vec_r_[PADR_(u_char *)]; }; +struct linux_madvise_args { + char addr_l_[PADL_(void *)]; void * addr; char addr_r_[PADR_(void *)]; + char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; + char behav_l_[PADL_(int)]; int behav; char behav_r_[PADR_(int)]; +}; struct linux_shmget_args { char key_l_[PADL_(l_key_t)]; l_key_t key; char key_r_[PADR_(l_key_t)]; char size_l_[PADL_(l_size_t)]; l_size_t size; char size_r_[PADR_(l_size_t)]; @@ -1292,6 +1297,7 @@ int linux_select(struct thread *, struct linux_select_ int linux_mremap(struct thread *, struct linux_mremap_args *); int linux_msync(struct thread *, struct linux_msync_args *); int linux_mincore(struct thread *, struct linux_mincore_args *); +int linux_madvise(struct thread *, struct linux_madvise_args *); int linux_shmget(struct thread *, struct linux_shmget_args *); int linux_shmat(struct thread *, struct linux_shmat_args *); int linux_shmctl(struct thread *, struct linux_shmctl_args *); @@ -1615,6 +1621,7 @@ int linux_io_uring_register(struct thread *, struct li #define LINUX_SYS_AUE_linux_mremap AUE_NULL #define LINUX_SYS_AUE_linux_msync AUE_MSYNC #define LINUX_SYS_AUE_linux_mincore AUE_MINCORE +#define LINUX_SYS_AUE_linux_madvise AUE_MADVISE #define LINUX_SYS_AUE_linux_shmget AUE_NULL #define LINUX_SYS_AUE_linux_shmat AUE_NULL #define LINUX_SYS_AUE_linux_shmctl AUE_NULL Modified: stable/12/sys/amd64/linux/linux_syscall.h ============================================================================== --- stable/12/sys/amd64/linux/linux_syscall.h Mon Aug 24 17:25:26 2020 (r364715) +++ stable/12/sys/amd64/linux/linux_syscall.h Mon Aug 24 17:29:37 2020 (r364716) @@ -33,7 +33,7 @@ #define LINUX_SYS_linux_mremap 25 #define LINUX_SYS_linux_msync 26 #define LINUX_SYS_linux_mincore 27 -#define LINUX_SYS_madvise 28 +#define LINUX_SYS_linux_madvise 28 #define LINUX_SYS_linux_shmget 29 #define LINUX_SYS_linux_shmat 30 #define LINUX_SYS_linux_shmctl 31 Modified: stable/12/sys/amd64/linux/linux_syscalls.c ============================================================================== --- stable/12/sys/amd64/linux/linux_syscalls.c Mon Aug 24 17:25:26 2020 (r364715) +++ stable/12/sys/amd64/linux/linux_syscalls.c Mon Aug 24 17:29:37 2020 (r364716) @@ -35,7 +35,7 @@ const char *linux_syscallnames[] = { "linux_mremap", /* 25 = linux_mremap */ "linux_msync", /* 26 = linux_msync */ "linux_mincore", /* 27 = linux_mincore */ - "madvise", /* 28 = madvise */ + "linux_madvise", /* 28 = linux_madvise */ "linux_shmget", /* 29 = linux_shmget */ "linux_shmat", /* 30 = linux_shmat */ "linux_shmctl", /* 31 = linux_shmctl */ Modified: stable/12/sys/amd64/linux/linux_sysent.c ============================================================================== --- stable/12/sys/amd64/linux/linux_sysent.c Mon Aug 24 17:25:26 2020 (r364715) +++ stable/12/sys/amd64/linux/linux_sysent.c Mon Aug 24 17:29:37 2020 (r364716) @@ -45,7 +45,7 @@ struct sysent linux_sysent[] = { { AS(linux_mremap_args), (sy_call_t *)linux_mremap, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 25 = linux_mremap */ { AS(linux_msync_args), (sy_call_t *)linux_msync, AUE_MSYNC, NULL, 0, 0, 0, SY_THR_STATIC }, /* 26 = linux_msync */ { AS(linux_mincore_args), (sy_call_t *)linux_mincore, AUE_MINCORE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 27 = linux_mincore */ - { AS(madvise_args), (sy_call_t *)sys_madvise, AUE_MADVISE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 28 = madvise */ + { AS(linux_madvise_args), (sy_call_t *)linux_madvise, AUE_MADVISE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 28 = linux_madvise */ { AS(linux_shmget_args), (sy_call_t *)linux_shmget, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 29 = linux_shmget */ { AS(linux_shmat_args), (sy_call_t *)linux_shmat, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 30 = linux_shmat */ { AS(linux_shmctl_args), (sy_call_t *)linux_shmctl, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 31 = linux_shmctl */ Modified: stable/12/sys/amd64/linux/linux_systrace_args.c ============================================================================== --- stable/12/sys/amd64/linux/linux_systrace_args.c Mon Aug 24 17:25:26 2020 (r364715) +++ stable/12/sys/amd64/linux/linux_systrace_args.c Mon Aug 24 17:29:37 2020 (r364716) @@ -258,9 +258,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg *n_args = 3; break; } - /* madvise */ + /* linux_madvise */ case 28: { - struct madvise_args *p = params; + struct linux_madvise_args *p = params; uarg[0] = (intptr_t) p->addr; /* void * */ uarg[1] = p->len; /* size_t */ iarg[2] = p->behav; /* int */ @@ -2983,7 +2983,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; }; break; - /* madvise */ + /* linux_madvise */ case 28: switch(ndx) { case 0: @@ -6649,7 +6649,7 @@ systrace_return_setargdesc(int sysnum, int ndx, char * if (ndx == 0 || ndx == 1) p = "int"; break; - /* madvise */ + /* linux_madvise */ case 28: if (ndx == 0 || ndx == 1) p = "int"; Modified: stable/12/sys/amd64/linux32/linux32_proto.h ============================================================================== --- stable/12/sys/amd64/linux32/linux32_proto.h Mon Aug 24 17:25:26 2020 (r364715) +++ stable/12/sys/amd64/linux32/linux32_proto.h Mon Aug 24 17:29:37 2020 (r364716) @@ -684,6 +684,11 @@ struct linux_mincore_args { char len_l_[PADL_(l_size_t)]; l_size_t len; char len_r_[PADR_(l_size_t)]; char vec_l_[PADL_(u_char *)]; u_char * vec; char vec_r_[PADR_(u_char *)]; }; +struct linux_madvise_args { + char addr_l_[PADL_(void *)]; void * addr; char addr_r_[PADR_(void *)]; + char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; + char behav_l_[PADL_(int)]; int behav; char behav_r_[PADR_(int)]; +}; struct linux_getdents64_args { char fd_l_[PADL_(l_uint)]; l_uint fd; char fd_r_[PADR_(l_uint)]; char dirent_l_[PADL_(void *)]; void * dirent; char dirent_r_[PADR_(void *)]; @@ -1682,6 +1687,7 @@ int linux_setfsuid(struct thread *, struct linux_setfs int linux_setfsgid(struct thread *, struct linux_setfsgid_args *); int linux_pivot_root(struct thread *, struct linux_pivot_root_args *); int linux_mincore(struct thread *, struct linux_mincore_args *); +int linux_madvise(struct thread *, struct linux_madvise_args *); int linux_getdents64(struct thread *, struct linux_getdents64_args *); int linux_fcntl64(struct thread *, struct linux_fcntl64_args *); int linux_gettid(struct thread *, struct linux_gettid_args *); @@ -2069,6 +2075,7 @@ int linux_io_uring_register(struct thread *, struct li #define LINUX32_SYS_AUE_linux_setfsgid AUE_SETFSGID #define LINUX32_SYS_AUE_linux_pivot_root AUE_PIVOT_ROOT #define LINUX32_SYS_AUE_linux_mincore AUE_MINCORE +#define LINUX32_SYS_AUE_linux_madvise AUE_MADVISE #define LINUX32_SYS_AUE_linux_getdents64 AUE_GETDIRENTRIES #define LINUX32_SYS_AUE_linux_fcntl64 AUE_FCNTL #define LINUX32_SYS_AUE_linux_gettid AUE_NULL Modified: stable/12/sys/amd64/linux32/linux32_syscall.h ============================================================================== --- stable/12/sys/amd64/linux32/linux32_syscall.h Mon Aug 24 17:25:26 2020 (r364715) +++ stable/12/sys/amd64/linux32/linux32_syscall.h Mon Aug 24 17:29:37 2020 (r364716) @@ -199,7 +199,7 @@ #define LINUX32_SYS_linux_setfsgid 216 #define LINUX32_SYS_linux_pivot_root 217 #define LINUX32_SYS_linux_mincore 218 -#define LINUX32_SYS_madvise 219 +#define LINUX32_SYS_linux_madvise 219 #define LINUX32_SYS_linux_getdents64 220 #define LINUX32_SYS_linux_fcntl64 221 #define LINUX32_SYS_linux_gettid 224 Modified: stable/12/sys/amd64/linux32/linux32_syscalls.c ============================================================================== --- stable/12/sys/amd64/linux32/linux32_syscalls.c Mon Aug 24 17:25:26 2020 (r364715) +++ stable/12/sys/amd64/linux32/linux32_syscalls.c Mon Aug 24 17:29:37 2020 (r364716) @@ -226,7 +226,7 @@ const char *linux32_syscallnames[] = { "linux_setfsgid", /* 216 = linux_setfsgid */ "linux_pivot_root", /* 217 = linux_pivot_root */ "linux_mincore", /* 218 = linux_mincore */ - "madvise", /* 219 = madvise */ + "linux_madvise", /* 219 = linux_madvise */ "linux_getdents64", /* 220 = linux_getdents64 */ "linux_fcntl64", /* 221 = linux_fcntl64 */ "#222", /* 222 = */ Modified: stable/12/sys/amd64/linux32/linux32_sysent.c ============================================================================== --- stable/12/sys/amd64/linux32/linux32_sysent.c Mon Aug 24 17:25:26 2020 (r364715) +++ stable/12/sys/amd64/linux32/linux32_sysent.c Mon Aug 24 17:29:37 2020 (r364716) @@ -236,7 +236,7 @@ struct sysent linux32_sysent[] = { { AS(linux_setfsgid_args), (sy_call_t *)linux_setfsgid, AUE_SETFSGID, NULL, 0, 0, 0, SY_THR_STATIC }, /* 216 = linux_setfsgid */ { AS(linux_pivot_root_args), (sy_call_t *)linux_pivot_root, AUE_PIVOT_ROOT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 217 = linux_pivot_root */ { AS(linux_mincore_args), (sy_call_t *)linux_mincore, AUE_MINCORE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 218 = linux_mincore */ - { AS(madvise_args), (sy_call_t *)sys_madvise, AUE_MADVISE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 219 = madvise */ + { AS(linux_madvise_args), (sy_call_t *)linux_madvise, AUE_MADVISE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 219 = linux_madvise */ { AS(linux_getdents64_args), (sy_call_t *)linux_getdents64, AUE_GETDIRENTRIES, NULL, 0, 0, 0, SY_THR_STATIC }, /* 220 = linux_getdents64 */ { AS(linux_fcntl64_args), (sy_call_t *)linux_fcntl64, AUE_FCNTL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 221 = linux_fcntl64 */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 222 = */ Modified: stable/12/sys/amd64/linux32/linux32_systrace_args.c ============================================================================== --- stable/12/sys/amd64/linux32/linux32_systrace_args.c Mon Aug 24 17:25:26 2020 (r364715) +++ stable/12/sys/amd64/linux32/linux32_systrace_args.c Mon Aug 24 17:29:37 2020 (r364716) @@ -1520,9 +1520,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg *n_args = 3; break; } - /* madvise */ + /* linux_madvise */ case 219: { - struct madvise_args *p = params; + struct linux_madvise_args *p = params; uarg[0] = (intptr_t) p->addr; /* void * */ uarg[1] = p->len; /* size_t */ iarg[2] = p->behav; /* int */ @@ -5332,7 +5332,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; }; break; - /* madvise */ + /* linux_madvise */ case 219: switch(ndx) { case 0: @@ -8432,7 +8432,7 @@ systrace_return_setargdesc(int sysnum, int ndx, char * if (ndx == 0 || ndx == 1) p = "int"; break; - /* madvise */ + /* linux_madvise */ case 219: if (ndx == 0 || ndx == 1) p = "int"; Modified: stable/12/sys/arm64/linux/linux_proto.h ============================================================================== --- stable/12/sys/arm64/linux/linux_proto.h Mon Aug 24 17:25:26 2020 (r364715) +++ stable/12/sys/arm64/linux/linux_proto.h Mon Aug 24 17:29:37 2020 (r364716) @@ -854,6 +854,11 @@ struct linux_mincore_args { char len_l_[PADL_(l_size_t)]; l_size_t len; char len_r_[PADR_(l_size_t)]; char vec_l_[PADL_(u_char *)]; u_char * vec; char vec_r_[PADR_(u_char *)]; }; +struct linux_madvise_args { + char addr_l_[PADL_(void *)]; void * addr; char addr_r_[PADR_(void *)]; + char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; + char behav_l_[PADL_(int)]; int behav; char behav_r_[PADR_(int)]; +}; struct linux_remap_file_pages_args { register_t dummy; }; @@ -1240,6 +1245,7 @@ int linux_swapoff(struct thread *, struct linux_swapof int linux_mprotect(struct thread *, struct linux_mprotect_args *); int linux_msync(struct thread *, struct linux_msync_args *); int linux_mincore(struct thread *, struct linux_mincore_args *); +int linux_madvise(struct thread *, struct linux_madvise_args *); int linux_remap_file_pages(struct thread *, struct linux_remap_file_pages_args *); int linux_mbind(struct thread *, struct linux_mbind_args *); int linux_get_mempolicy(struct thread *, struct linux_get_mempolicy_args *); @@ -1507,6 +1513,7 @@ int linux_pkey_free(struct thread *, struct linux_pkey #define LINUX_SYS_AUE_linux_mprotect AUE_MPROTECT #define LINUX_SYS_AUE_linux_msync AUE_MSYNC #define LINUX_SYS_AUE_linux_mincore AUE_MINCORE +#define LINUX_SYS_AUE_linux_madvise AUE_MADVISE #define LINUX_SYS_AUE_linux_remap_file_pages AUE_NULL #define LINUX_SYS_AUE_linux_mbind AUE_NULL #define LINUX_SYS_AUE_linux_get_mempolicy AUE_NULL Modified: stable/12/sys/arm64/linux/linux_syscall.h ============================================================================== --- stable/12/sys/arm64/linux/linux_syscall.h Mon Aug 24 17:25:26 2020 (r364715) +++ stable/12/sys/arm64/linux/linux_syscall.h Mon Aug 24 17:29:37 2020 (r364716) @@ -227,7 +227,7 @@ #define LINUX_SYS_mlockall 230 #define LINUX_SYS_munlockall 231 #define LINUX_SYS_linux_mincore 232 -#define LINUX_SYS_madvise 233 +#define LINUX_SYS_linux_madvise 233 #define LINUX_SYS_linux_remap_file_pages 234 #define LINUX_SYS_linux_mbind 235 #define LINUX_SYS_linux_get_mempolicy 236 Modified: stable/12/sys/arm64/linux/linux_syscalls.c ============================================================================== --- stable/12/sys/arm64/linux/linux_syscalls.c Mon Aug 24 17:25:26 2020 (r364715) +++ stable/12/sys/arm64/linux/linux_syscalls.c Mon Aug 24 17:29:37 2020 (r364716) @@ -240,7 +240,7 @@ const char *linux_syscallnames[] = { "mlockall", /* 230 = mlockall */ "munlockall", /* 231 = munlockall */ "linux_mincore", /* 232 = linux_mincore */ - "madvise", /* 233 = madvise */ + "linux_madvise", /* 233 = linux_madvise */ "linux_remap_file_pages", /* 234 = linux_remap_file_pages */ "linux_mbind", /* 235 = linux_mbind */ "linux_get_mempolicy", /* 236 = linux_get_mempolicy */ Modified: stable/12/sys/arm64/linux/linux_sysent.c ============================================================================== --- stable/12/sys/arm64/linux/linux_sysent.c Mon Aug 24 17:25:26 2020 (r364715) +++ stable/12/sys/arm64/linux/linux_sysent.c Mon Aug 24 17:29:37 2020 (r364716) @@ -250,7 +250,7 @@ struct sysent linux_sysent[] = { { AS(mlockall_args), (sy_call_t *)sys_mlockall, AUE_MLOCKALL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 230 = mlockall */ { 0, (sy_call_t *)sys_munlockall, AUE_MUNLOCKALL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 231 = munlockall */ { AS(linux_mincore_args), (sy_call_t *)linux_mincore, AUE_MINCORE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 232 = linux_mincore */ - { AS(madvise_args), (sy_call_t *)sys_madvise, AUE_MADVISE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 233 = madvise */ + { AS(linux_madvise_args), (sy_call_t *)linux_madvise, AUE_MADVISE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 233 = linux_madvise */ { 0, (sy_call_t *)linux_remap_file_pages, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 234 = linux_remap_file_pages */ { 0, (sy_call_t *)linux_mbind, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 235 = linux_mbind */ { 0, (sy_call_t *)linux_get_mempolicy, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 236 = linux_get_mempolicy */ Modified: stable/12/sys/arm64/linux/linux_systrace_args.c ============================================================================== --- stable/12/sys/arm64/linux/linux_systrace_args.c Mon Aug 24 17:25:26 2020 (r364715) +++ stable/12/sys/arm64/linux/linux_systrace_args.c Mon Aug 24 17:29:37 2020 (r364716) @@ -1766,9 +1766,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg *n_args = 3; break; } - /* madvise */ + /* linux_madvise */ case 233: { - struct madvise_args *p = params; + struct linux_madvise_args *p = params; uarg[0] = (intptr_t) p->addr; /* void * */ uarg[1] = p->len; /* size_t */ iarg[2] = p->behav; /* int */ @@ -4898,7 +4898,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; }; break; - /* madvise */ + /* linux_madvise */ case 233: switch(ndx) { case 0: @@ -6449,7 +6449,7 @@ systrace_return_setargdesc(int sysnum, int ndx, char * if (ndx == 0 || ndx == 1) p = "int"; break; - /* madvise */ + /* linux_madvise */ case 233: if (ndx == 0 || ndx == 1) p = "int"; Modified: stable/12/sys/i386/linux/linux_proto.h ============================================================================== --- stable/12/sys/i386/linux/linux_proto.h Mon Aug 24 17:25:26 2020 (r364715) +++ stable/12/sys/i386/linux/linux_proto.h Mon Aug 24 17:29:37 2020 (r364716) @@ -681,6 +681,11 @@ struct linux_mincore_args { char len_l_[PADL_(l_size_t)]; l_size_t len; char len_r_[PADR_(l_size_t)]; char vec_l_[PADL_(u_char *)]; u_char * vec; char vec_r_[PADR_(u_char *)]; }; +struct linux_madvise_args { + char addr_l_[PADL_(void *)]; void * addr; char addr_r_[PADR_(void *)]; + char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; + char behav_l_[PADL_(int)]; int behav; char behav_r_[PADR_(int)]; +}; struct linux_getdents64_args { char fd_l_[PADL_(l_uint)]; l_uint fd; char fd_r_[PADR_(l_uint)]; char dirent_l_[PADL_(void *)]; void * dirent; char dirent_r_[PADR_(void *)]; @@ -1690,6 +1695,7 @@ int linux_setfsuid(struct thread *, struct linux_setfs int linux_setfsgid(struct thread *, struct linux_setfsgid_args *); int linux_pivot_root(struct thread *, struct linux_pivot_root_args *); int linux_mincore(struct thread *, struct linux_mincore_args *); +int linux_madvise(struct thread *, struct linux_madvise_args *); int linux_getdents64(struct thread *, struct linux_getdents64_args *); int linux_fcntl64(struct thread *, struct linux_fcntl64_args *); int linux_gettid(struct thread *, struct linux_gettid_args *); @@ -2079,6 +2085,7 @@ int linux_io_uring_register(struct thread *, struct li #define LINUX_SYS_AUE_linux_setfsgid AUE_SETFSGID #define LINUX_SYS_AUE_linux_pivot_root AUE_PIVOT_ROOT #define LINUX_SYS_AUE_linux_mincore AUE_MINCORE +#define LINUX_SYS_AUE_linux_madvise AUE_MADVISE #define LINUX_SYS_AUE_linux_getdents64 AUE_GETDIRENTRIES #define LINUX_SYS_AUE_linux_fcntl64 AUE_FCNTL #define LINUX_SYS_AUE_linux_gettid AUE_NULL Modified: stable/12/sys/i386/linux/linux_syscall.h ============================================================================== --- stable/12/sys/i386/linux/linux_syscall.h Mon Aug 24 17:25:26 2020 (r364715) +++ stable/12/sys/i386/linux/linux_syscall.h Mon Aug 24 17:29:37 2020 (r364716) @@ -205,7 +205,7 @@ #define LINUX_SYS_linux_setfsgid 216 #define LINUX_SYS_linux_pivot_root 217 #define LINUX_SYS_linux_mincore 218 -#define LINUX_SYS_madvise 219 +#define LINUX_SYS_linux_madvise 219 #define LINUX_SYS_linux_getdents64 220 #define LINUX_SYS_linux_fcntl64 221 #define LINUX_SYS_linux_gettid 224 Modified: stable/12/sys/i386/linux/linux_syscalls.c ============================================================================== --- stable/12/sys/i386/linux/linux_syscalls.c Mon Aug 24 17:25:26 2020 (r364715) +++ stable/12/sys/i386/linux/linux_syscalls.c Mon Aug 24 17:29:37 2020 (r364716) @@ -226,7 +226,7 @@ const char *linux_syscallnames[] = { "linux_setfsgid", /* 216 = linux_setfsgid */ "linux_pivot_root", /* 217 = linux_pivot_root */ "linux_mincore", /* 218 = linux_mincore */ - "madvise", /* 219 = madvise */ + "linux_madvise", /* 219 = linux_madvise */ "linux_getdents64", /* 220 = linux_getdents64 */ "linux_fcntl64", /* 221 = linux_fcntl64 */ "#222", /* 222 = */ Modified: stable/12/sys/i386/linux/linux_sysent.c ============================================================================== --- stable/12/sys/i386/linux/linux_sysent.c Mon Aug 24 17:25:26 2020 (r364715) +++ stable/12/sys/i386/linux/linux_sysent.c Mon Aug 24 17:29:37 2020 (r364716) @@ -236,7 +236,7 @@ struct sysent linux_sysent[] = { { AS(linux_setfsgid_args), (sy_call_t *)linux_setfsgid, AUE_SETFSGID, NULL, 0, 0, 0, SY_THR_STATIC }, /* 216 = linux_setfsgid */ { AS(linux_pivot_root_args), (sy_call_t *)linux_pivot_root, AUE_PIVOT_ROOT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 217 = linux_pivot_root */ { AS(linux_mincore_args), (sy_call_t *)linux_mincore, AUE_MINCORE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 218 = linux_mincore */ - { AS(madvise_args), (sy_call_t *)sys_madvise, AUE_MADVISE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 219 = madvise */ + { AS(linux_madvise_args), (sy_call_t *)linux_madvise, AUE_MADVISE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 219 = linux_madvise */ { AS(linux_getdents64_args), (sy_call_t *)linux_getdents64, AUE_GETDIRENTRIES, NULL, 0, 0, 0, SY_THR_STATIC }, /* 220 = linux_getdents64 */ { AS(linux_fcntl64_args), (sy_call_t *)linux_fcntl64, AUE_FCNTL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 221 = linux_fcntl64 */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 222 = */ Modified: stable/12/sys/i386/linux/linux_systrace_args.c ============================================================================== --- stable/12/sys/i386/linux/linux_systrace_args.c Mon Aug 24 17:25:26 2020 (r364715) +++ stable/12/sys/i386/linux/linux_systrace_args.c Mon Aug 24 17:29:37 2020 (r364716) @@ -1559,9 +1559,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg *n_args = 3; break; } - /* madvise */ + /* linux_madvise */ case 219: { - struct madvise_args *p = params; + struct linux_madvise_args *p = params; uarg[0] = (intptr_t) p->addr; /* void * */ uarg[1] = p->len; /* size_t */ iarg[2] = p->behav; /* int */ @@ -5446,7 +5446,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; }; break; - /* madvise */ + /* linux_madvise */ case 219: switch(ndx) { case 0: @@ -8643,7 +8643,7 @@ systrace_return_setargdesc(int sysnum, int ndx, char * if (ndx == 0 || ndx == 1) p = "int"; break; - /* madvise */ + /* linux_madvise */ case 219: if (ndx == 0 || ndx == 1) p = "int"; From owner-svn-src-stable-12@freebsd.org Mon Aug 24 17:31:18 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6EB1E3C9081; Mon, 24 Aug 2020 17:31:18 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZzgV2PgZz40SS; Mon, 24 Aug 2020 17:31:18 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 315C91C0CC; Mon, 24 Aug 2020 17:31:18 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OHVIFi013580; Mon, 24 Aug 2020 17:31:18 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OHVIhS013579; Mon, 24 Aug 2020 17:31:18 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008241731.07OHVIhS013579@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Aug 2020 17:31:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364717 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364717 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 17:31:18 -0000 Author: trasz Date: Mon Aug 24 17:31:17 2020 New Revision: 364717 URL: https://svnweb.freebsd.org/changeset/base/364717 Log: MFC r363087: Don't emit warnings on MADV_HUGEPAGE; Firefox uses it a lot. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/compat/linux/linux_mmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_mmap.c ============================================================================== --- stable/12/sys/compat/linux/linux_mmap.c Mon Aug 24 17:29:37 2020 (r364716) +++ stable/12/sys/compat/linux/linux_mmap.c Mon Aug 24 17:31:17 2020 (r364717) @@ -267,7 +267,13 @@ linux_madvise_common(struct thread *td, uintptr_t addr /* Ignored; on FreeBSD huge pages are always on. */ return (0); case LINUX_MADV_NOHUGEPAGE: +#if 0 + /* + * Don't warn - Firefox uses it a lot, and in real Linux it's + * an optional feature. + */ linux_msg(curthread, "unsupported madvise MADV_NOHUGEPAGE"); +#endif return (EINVAL); case LINUX_MADV_DONTDUMP: return (kern_madvise(td, addr, len, MADV_NOCORE)); From owner-svn-src-stable-12@freebsd.org Mon Aug 24 20:02:37 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 049F13CC31D; Mon, 24 Aug 2020 20:02:37 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Bb324696Cz4BqQ; Mon, 24 Aug 2020 20:02:36 +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 B6CE21E070; Mon, 24 Aug 2020 20:02:36 +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 07OK2aF7011135; Mon, 24 Aug 2020 20:02:36 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OK2aHe011134; Mon, 24 Aug 2020 20:02:36 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008242002.07OK2aHe011134@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 24 Aug 2020 20:02:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364729 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364729 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 20:02:37 -0000 Author: markj Date: Mon Aug 24 20:02:36 2020 New Revision: 364729 URL: https://svnweb.freebsd.org/changeset/base/364729 Log: MFC r362631, r364317: Implement an approximation of Linux MADV_DONTNEED semantics. PR: 230160 Modified: stable/12/sys/compat/linux/linux_mmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_mmap.c ============================================================================== --- stable/12/sys/compat/linux/linux_mmap.c Mon Aug 24 20:02:13 2020 (r364728) +++ stable/12/sys/compat/linux/linux_mmap.c Mon Aug 24 20:02:36 2020 (r364729) @@ -38,9 +38,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include +#include #include #include #include @@ -48,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -233,6 +236,105 @@ linux_mprotect_common(struct thread *td, uintptr_t add return (kern_mprotect(td, addr, len, prot)); } +/* + * Implement Linux madvise(MADV_DONTNEED), which has unusual semantics: for + * anonymous memory, pages in the range are immediately discarded. + */ +static int +linux_madvise_dontneed(struct thread *td, vm_offset_t start, vm_offset_t end) +{ + vm_map_t map; + vm_map_entry_t entry; + vm_object_t backing_object, object; + vm_offset_t estart, eend; + vm_pindex_t pstart, pend; + int error; + + map = &td->td_proc->p_vmspace->vm_map; + + if (!vm_map_range_valid(map, start, end)) + return (EINVAL); + start = trunc_page(start); + end = round_page(end); + + error = 0; + vm_map_lock_read(map); + if (!vm_map_lookup_entry(map, start, &entry)) + entry = entry->next; + for (; entry->start < end; entry = entry->next) { + if ((entry->eflags & MAP_ENTRY_IS_SUB_MAP) != 0) + continue; + + if (entry->wired_count != 0) { + error = EINVAL; + break; + } + + object = entry->object.vm_object; + if (object == NULL) + continue; + if ((object->flags & (OBJ_UNMANAGED | OBJ_FICTITIOUS)) != 0) + continue; + + pstart = OFF_TO_IDX(entry->offset); + if (start > entry->start) { + pstart += atop(start - entry->start); + estart = start; + } else { + estart = entry->start; + } + pend = OFF_TO_IDX(entry->offset) + + atop(entry->end - entry->start); + if (entry->end > end) { + pend -= atop(entry->end - end); + eend = end; + } else { + eend = entry->end; + } + + if ((object->type == OBJT_DEFAULT || + object->type == OBJT_SWAP) && object->handle == NULL && + (object->flags & (OBJ_ONEMAPPING | OBJ_NOSPLIT)) == + OBJ_ONEMAPPING) { + /* + * Singly-mapped anonymous memory is discarded. This + * does not match Linux's semantics when the object + * belongs to a shadow chain of length > 1, since + * subsequent faults may retrieve pages from an + * intermediate anonymous object. However, handling + * this case correctly introduces a fair bit of + * complexity. + */ + VM_OBJECT_WLOCK(object); + if ((object->flags & OBJ_ONEMAPPING) != 0) { + vm_object_collapse(object); + vm_object_page_remove(object, pstart, pend, 0); + backing_object = object->backing_object; + if (backing_object != NULL && + (backing_object->type == OBJT_DEFAULT || + backing_object->type == OBJT_SWAP) && + backing_object->handle == NULL && + (backing_object->flags & OBJ_NOSPLIT) == 0) + linux_msg(td, + "possibly incorrect MADV_DONTNEED"); + VM_OBJECT_WUNLOCK(object); + continue; + } + VM_OBJECT_WUNLOCK(object); + } + + /* + * Handle shared mappings. Remove them outright instead of + * calling pmap_advise(), for consistency with Linux. + */ + pmap_remove(map->pmap, estart, eend); + vm_object_madvise(object, pstart, pend, MADV_DONTNEED); + } + vm_map_unlock_read(map); + + return (error); +} + int linux_madvise_common(struct thread *td, uintptr_t addr, size_t len, int behav) { @@ -247,7 +349,7 @@ linux_madvise_common(struct thread *td, uintptr_t addr case LINUX_MADV_WILLNEED: return (kern_madvise(td, addr, len, MADV_WILLNEED)); case LINUX_MADV_DONTNEED: - return (kern_madvise(td, addr, len, MADV_DONTNEED)); + return (linux_madvise_dontneed(td, addr, addr + len)); case LINUX_MADV_FREE: return (kern_madvise(td, addr, len, MADV_FREE)); case LINUX_MADV_REMOVE: From owner-svn-src-stable-12@freebsd.org Tue Aug 25 00:49:58 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A242A3B226B; Tue, 25 Aug 2020 00:49:58 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Bb9Pf3rQ7z4VNQ; Tue, 25 Aug 2020 00:49:58 +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 62E6021371; Tue, 25 Aug 2020 00:49:58 +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 07P0nwf0085559; Tue, 25 Aug 2020 00:49:58 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07P0nwaa085558; Tue, 25 Aug 2020 00:49:58 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008250049.07P0nwaa085558@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 25 Aug 2020 00:49:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364743 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 364743 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2020 00:49:58 -0000 Author: markj Date: Tue Aug 25 00:49:57 2020 New Revision: 364743 URL: https://svnweb.freebsd.org/changeset/base/364743 Log: MFC r364346: Fix handling of ancillary data on non-AF_UNIX Linux sockets. Modified: stable/12/sys/compat/linux/linux_socket.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_socket.c ============================================================================== --- stable/12/sys/compat/linux/linux_socket.c Mon Aug 24 23:50:23 2020 (r364742) +++ stable/12/sys/compat/linux/linux_socket.c Tue Aug 25 00:49:57 2020 (r364743) @@ -1063,7 +1063,7 @@ linux_sendmsg_common(struct thread *td, l_int s, struc * FreeBSD system call interface. */ if (sa_family != AF_UNIX) - continue; + goto next; if (cmsg->cmsg_type == SCM_CREDS) { len = sizeof(struct cmsgcred); @@ -1090,6 +1090,7 @@ linux_sendmsg_common(struct thread *td, l_int s, struc data = (char *)data + CMSG_SPACE(len); datalen += CMSG_SPACE(len); +next: if (clen <= LINUX_CMSG_ALIGN(linux_cmsg.cmsg_len)) break; From owner-svn-src-stable-12@freebsd.org Tue Aug 25 02:14:38 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AFCBC3B5BA2; Tue, 25 Aug 2020 02:14:38 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BbCHL4Wm9z4bVJ; Tue, 25 Aug 2020 02:14:38 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7DE562207D; Tue, 25 Aug 2020 02:14:38 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07P2Ec7Q040674; Tue, 25 Aug 2020 02:14:38 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07P2Ebwr040667; Tue, 25 Aug 2020 02:14:37 GMT (envelope-from np@FreeBSD.org) Message-Id: <202008250214.07P2Ebwr040667@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Tue, 25 Aug 2020 02:14:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364745 - in stable/12: share/man/man4 sys/dev/cxgbe sys/dev/cxgbe/common X-SVN-Group: stable-12 X-SVN-Commit-Author: np X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/dev/cxgbe sys/dev/cxgbe/common X-SVN-Commit-Revision: 364745 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2020 02:14:38 -0000 Author: np Date: Tue Aug 25 02:14:36 2020 New Revision: 364745 URL: https://svnweb.freebsd.org/changeset/base/364745 Log: MFC r351444, r357475, r357479, r357481-r357482, r358859, and r364497. All these are rx improvements in the cxgbe(4) driver. r351444: cxgbe(4): Use the same buffer size for TOE rx queues as the NIC rx queues. This is a minor simplification. r357475: cxgbe(4): Initialize the rx buffer's metadata on first-use and not on allocation. refill_fl doesn't touch any part of a freshly allocated cluster after this change. r357479: cxgbe(4): Avoid ext_arg2 in rxb_free. ext_arg2 is the only item in the third cacheline in an mbuf and could be cold by the time rxb_free runs. Put the information needed by rxb_free in the same line as the refcount, which is very likely to be hot given that rxb_free runs when the refcount is decremented and reaches 0. r357481: cxgbe(4): Retire the allow_mbufs_in_cluster optimization. This simplifies the driver's rx fast path as well as the bookkeeping code that tracks various rx buffer sizes and layouts. r357482: cxgbe(4): Treat NIC rx as special and run its handler directly and not via the t4_cpl_handler dispatch table. r358859: cxgbe(4): Do not try to use 0 as an rx buffer address when the driver is already allocating from the safe zone and the allocation fails. This bug was introduced in r357481. r364497: cxgbe(4): Use large clusters for TOE rx queues when TOE+TLS is enabled. Rx is more efficient within the chip when the receive buffer size matches the TLS PDU size. Sponsored by: Chelsio Communications Modified: stable/12/share/man/man4/cxgbe.4 stable/12/sys/dev/cxgbe/adapter.h stable/12/sys/dev/cxgbe/common/common.h stable/12/sys/dev/cxgbe/common/t4_hw.c stable/12/sys/dev/cxgbe/t4_main.c stable/12/sys/dev/cxgbe/t4_netmap.c stable/12/sys/dev/cxgbe/t4_sge.c Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/cxgbe.4 ============================================================================== --- stable/12/share/man/man4/cxgbe.4 Tue Aug 25 00:58:14 2020 (r364744) +++ stable/12/share/man/man4/cxgbe.4 Tue Aug 25 02:14:36 2020 (r364745) @@ -317,11 +317,6 @@ Allow the hardware to deliver multiple frames in the s opportunistically. The default is -1 which lets the driver decide. 0 or 1 explicitly disable or enable this feature. -.It Va hw.cxgbe.allow_mbufs_in_cluster -1 allows the driver to lay down one or more mbufs within the receive buffer -opportunistically. -This is the default. -0 prohibits the driver from doing so. .It Va hw.cxgbe.largest_rx_cluster .It Va hw.cxgbe.safest_rx_cluster Sizes of rx clusters. Modified: stable/12/sys/dev/cxgbe/adapter.h ============================================================================== --- stable/12/sys/dev/cxgbe/adapter.h Tue Aug 25 00:58:14 2020 (r364744) +++ stable/12/sys/dev/cxgbe/adapter.h Tue Aug 25 02:14:36 2020 (r364745) @@ -314,24 +314,17 @@ struct port_info { #define IS_MAIN_VI(vi) ((vi) == &((vi)->pi->vi[0])) -/* Where the cluster came from, how it has been carved up. */ -struct cluster_layout { - int8_t zidx; - int8_t hwidx; - uint16_t region1; /* mbufs laid out within this region */ - /* region2 is the DMA region */ - uint16_t region3; /* cluster_metadata within this region */ -}; - struct cluster_metadata { + uma_zone_t zone; + caddr_t cl; u_int refcount; - struct fl_sdesc *sd; /* For debug only. Could easily be stale */ }; struct fl_sdesc { caddr_t cl; uint16_t nmbuf; /* # of driver originated mbufs with ref on cluster */ - struct cluster_layout cll; + int16_t moff; /* offset of metadata from cl */ + uint8_t zidx; }; struct tx_desc { @@ -463,20 +456,17 @@ struct sge_eq { char lockname[16]; }; -struct sw_zone_info { +struct rx_buf_info { uma_zone_t zone; /* zone that this cluster comes from */ - int size; /* size of cluster: 2K, 4K, 9K, 16K, etc. */ - int type; /* EXT_xxx type of the cluster */ - int8_t head_hwidx; - int8_t tail_hwidx; + uint16_t size1; /* same as size of cluster: 2K/4K/9K/16K. + * hwsize[hwidx1] = size1. No spare. */ + uint16_t size2; /* hwsize[hwidx2] = size2. + * spare in cluster = size1 - size2. */ + int8_t hwidx1; /* SGE bufsize idx for size1 */ + int8_t hwidx2; /* SGE bufsize idx for size2 */ + uint8_t type; /* EXT_xxx type of the cluster */ }; -struct hw_buf_info { - int8_t zidx; /* backpointer to zone; -ve means unused */ - int8_t next; /* next hwidx for this zone; -1 means no more */ - int size; -}; - enum { NUM_MEMWIN = 3, @@ -516,7 +506,8 @@ struct sge_fl { struct mtx fl_lock; __be64 *desc; /* KVA of descriptor ring, ptr to addresses */ struct fl_sdesc *sdesc; /* KVA of software descriptor ring */ - struct cluster_layout cll_def; /* default refill zone, layout */ + uint16_t zidx; /* refill zone idx */ + uint16_t safe_zidx; uint16_t lowat; /* # of buffers <= this means fl needs help */ int flags; uint16_t buf_boundary; @@ -534,8 +525,6 @@ struct sge_fl { u_int rx_offset; /* offset in fl buf (when buffer packing) */ volatile uint32_t *udb; - uint64_t mbuf_allocated;/* # of mbuf allocated from zone_mbuf */ - uint64_t mbuf_inlined; /* # of mbuf created within clusters */ uint64_t cl_allocated; /* # of clusters allocated */ uint64_t cl_recycled; /* # of clusters recycled */ uint64_t cl_fast_recycled; /* # of clusters recycled (fast) */ @@ -552,7 +541,6 @@ struct sge_fl { bus_dmamap_t desc_map; char lockname[16]; bus_addr_t ba; /* bus address of descriptor ring */ - struct cluster_layout cll_alt; /* alternate refill zone, layout */ }; struct mp_ring; @@ -766,10 +754,8 @@ struct sge { struct sge_iq **iqmap; /* iq->cntxt_id to iq mapping */ struct sge_eq **eqmap; /* eq->cntxt_id to eq mapping */ - int8_t safe_hwidx1; /* may not have room for metadata */ - int8_t safe_hwidx2; /* with room for metadata and maybe more */ - struct sw_zone_info sw_zone_info[SW_ZONE_SIZES]; - struct hw_buf_info hw_buf_info[SGE_FLBUF_SIZES]; + int8_t safe_zidx; + struct rx_buf_info rx_buf_info[SW_ZONE_SIZES]; }; struct devnames { Modified: stable/12/sys/dev/cxgbe/common/common.h ============================================================================== --- stable/12/sys/dev/cxgbe/common/common.h Tue Aug 25 00:58:14 2020 (r364744) +++ stable/12/sys/dev/cxgbe/common/common.h Tue Aug 25 02:14:36 2020 (r364745) @@ -246,6 +246,8 @@ struct tp_params { uint32_t vlan_pri_map; uint32_t ingress_config; + uint32_t max_rx_pdu; + uint32_t max_tx_pdu; uint64_t hash_filter_mask; __be16 err_vec_mask; Modified: stable/12/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- stable/12/sys/dev/cxgbe/common/t4_hw.c Tue Aug 25 00:58:14 2020 (r364744) +++ stable/12/sys/dev/cxgbe/common/t4_hw.c Tue Aug 25 02:14:36 2020 (r364745) @@ -9348,7 +9348,7 @@ static void read_filter_mode_and_ingress_config(struct int t4_init_tp_params(struct adapter *adap, bool sleep_ok) { int chan; - u32 v; + u32 tx_len, rx_len, r, v; struct tp_params *tpp = &adap->params.tp; v = t4_read_reg(adap, A_TP_TIMER_RESOLUTION); @@ -9374,6 +9374,21 @@ int t4_init_tp_params(struct adapter *adap, bool sleep htobe16(V_T6_COMPR_RXERR_VEC(M_T6_COMPR_RXERR_VEC)); } } + + rx_len = t4_read_reg(adap, A_TP_PMM_RX_PAGE_SIZE); + tx_len = t4_read_reg(adap, A_TP_PMM_TX_PAGE_SIZE); + + r = t4_read_reg(adap, A_TP_PARA_REG2); + rx_len = min(rx_len, G_MAXRXDATA(r)); + tx_len = min(tx_len, G_MAXRXDATA(r)); + + r = t4_read_reg(adap, A_TP_PARA_REG7); + v = min(G_PMMAXXFERLEN0(r), G_PMMAXXFERLEN1(r)); + rx_len = min(rx_len, v); + tx_len = min(tx_len, v); + + tpp->max_tx_pdu = tx_len; + tpp->max_rx_pdu = rx_len; return 0; } Modified: stable/12/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/12/sys/dev/cxgbe/t4_main.c Tue Aug 25 00:58:14 2020 (r364744) +++ stable/12/sys/dev/cxgbe/t4_main.c Tue Aug 25 02:14:36 2020 (r364745) @@ -695,6 +695,7 @@ static int sysctl_ulprx_la(SYSCTL_HANDLER_ARGS); static int sysctl_wcwr_stats(SYSCTL_HANDLER_ARGS); static int sysctl_cpus(SYSCTL_HANDLER_ARGS); #ifdef TCP_OFFLOAD +static int sysctl_tls(SYSCTL_HANDLER_ARGS); static int sysctl_tls_rx_ports(SYSCTL_HANDLER_ARGS); static int sysctl_tp_tick(SYSCTL_HANDLER_ARGS); static int sysctl_tp_dack_timer(SYSCTL_HANDLER_ARGS); @@ -6293,8 +6294,8 @@ t4_sysctls(struct adapter *sc) CTLFLAG_RW, &sc->tt.rx_coalesce, 0, "receive coalescing"); sc->tt.tls = 0; - SYSCTL_ADD_INT(ctx, children, OID_AUTO, "tls", CTLFLAG_RW, - &sc->tt.tls, 0, "Inline TLS allowed"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "tls", CTLTYPE_INT | + CTLFLAG_RW, sc, 0, sysctl_tls, "I", "Inline TLS allowed"); SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "tls_rx_ports", CTLTYPE_INT | CTLFLAG_RW, sc, 0, sysctl_tls_rx_ports, @@ -9364,6 +9365,37 @@ sysctl_cpus(SYSCTL_HANDLER_ARGS) #ifdef TCP_OFFLOAD static int +sysctl_tls(SYSCTL_HANDLER_ARGS) +{ + struct adapter *sc = arg1; + int i, j, v, rc; + struct vi_info *vi; + + v = sc->tt.tls; + rc = sysctl_handle_int(oidp, &v, 0, req); + if (rc != 0 || req->newptr == NULL) + return (rc); + + if (v != 0 && !(sc->cryptocaps & FW_CAPS_CONFIG_TLSKEYS)) + return (ENOTSUP); + + rc = begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, "t4stls"); + if (rc) + return (rc); + sc->tt.tls = !!v; + for_each_port(sc, i) { + for_each_vi(sc->port[i], j, vi) { + if (vi->flags & VI_INIT_DONE) + t4_update_fl_bufsize(vi->ifp); + } + } + end_synchronized_op(sc, 0); + + return (0); + +} + +static int sysctl_tls_rx_ports(SYSCTL_HANDLER_ARGS) { struct adapter *sc = arg1; @@ -10039,8 +10071,6 @@ clear_stats(struct adapter *sc, u_int port_id) rxq->rxcsum = 0; rxq->vlan_extraction = 0; - rxq->fl.mbuf_allocated = 0; - rxq->fl.mbuf_inlined = 0; rxq->fl.cl_allocated = 0; rxq->fl.cl_recycled = 0; rxq->fl.cl_fast_recycled = 0; @@ -10069,8 +10099,6 @@ clear_stats(struct adapter *sc, u_int port_id) #endif #ifdef TCP_OFFLOAD for_each_ofld_rxq(vi, i, ofld_rxq) { - ofld_rxq->fl.mbuf_allocated = 0; - ofld_rxq->fl.mbuf_inlined = 0; ofld_rxq->fl.cl_allocated = 0; ofld_rxq->fl.cl_recycled = 0; ofld_rxq->fl.cl_fast_recycled = 0; Modified: stable/12/sys/dev/cxgbe/t4_netmap.c ============================================================================== --- stable/12/sys/dev/cxgbe/t4_netmap.c Tue Aug 25 00:58:14 2020 (r364744) +++ stable/12/sys/dev/cxgbe/t4_netmap.c Tue Aug 25 02:14:36 2020 (r364745) @@ -355,7 +355,7 @@ cxgbe_netmap_on(struct adapter *sc, struct vi_info *vi struct sge_nm_rxq *nm_rxq; struct sge_nm_txq *nm_txq; int rc, i, j, hwidx, defq, nrssq; - struct hw_buf_info *hwb; + struct rx_buf_info *rxb; ASSERT_SYNCHRONIZED_OP(sc); @@ -363,17 +363,22 @@ cxgbe_netmap_on(struct adapter *sc, struct vi_info *vi (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) return (EAGAIN); - hwb = &sc->sge.hw_buf_info[0]; - for (i = 0; i < SGE_FLBUF_SIZES; i++, hwb++) { - if (hwb->size == NETMAP_BUF_SIZE(na)) + rxb = &sc->sge.rx_buf_info[0]; + for (i = 0; i < SW_ZONE_SIZES; i++, rxb++) { + if (rxb->size1 == NETMAP_BUF_SIZE(na)) { + hwidx = rxb->hwidx1; break; + } + if (rxb->size2 == NETMAP_BUF_SIZE(na)) { + hwidx = rxb->hwidx2; + break; + } } - if (i >= SGE_FLBUF_SIZES) { + if (i >= SW_ZONE_SIZES) { if_printf(ifp, "no hwidx for netmap buffer size %d.\n", NETMAP_BUF_SIZE(na)); return (ENXIO); } - hwidx = i; /* Must set caps before calling netmap_reset */ nm_set_native_flags(na); Modified: stable/12/sys/dev/cxgbe/t4_sge.c ============================================================================== --- stable/12/sys/dev/cxgbe/t4_sge.c Tue Aug 25 00:58:14 2020 (r364744) +++ stable/12/sys/dev/cxgbe/t4_sge.c Tue Aug 25 02:14:36 2020 (r364745) @@ -143,16 +143,6 @@ SYSCTL_INT(_hw_cxgbe, OID_AUTO, fl_pack, CTLFLAG_RDTUN "payload pack boundary (bytes)"); /* - * Allow the driver to create mbuf(s) in a cluster allocated for rx. - * 0: never; always allocate mbufs from the zone_mbuf UMA zone. - * 1: ok to create mbuf(s) within a cluster if there is room. - */ -static int allow_mbufs_in_cluster = 1; -SYSCTL_INT(_hw_cxgbe, OID_AUTO, allow_mbufs_in_cluster, CTLFLAG_RDTUN, - &allow_mbufs_in_cluster, 0, - "Allow driver to create mbufs within a rx cluster"); - -/* * Largest rx cluster size that the driver is allowed to allocate. */ static int largest_rx_cluster = MJUM16BYTES; @@ -224,7 +214,8 @@ struct sgl { static int service_iq(struct sge_iq *, int); static int service_iq_fl(struct sge_iq *, int); static struct mbuf *get_fl_payload(struct adapter *, struct sge_fl *, uint32_t); -static int t4_eth_rx(struct sge_iq *, const struct rss_header *, struct mbuf *); +static int eth_rx(struct adapter *, struct sge_rxq *, const struct iq_desc *, + u_int); static inline void init_iq(struct sge_iq *, struct adapter *, int, int, int); static inline void init_fl(struct adapter *, struct sge_fl *, int, int, char *); static inline void init_eq(struct adapter *, struct sge_eq *, int, int, uint8_t, @@ -279,8 +270,7 @@ static int refill_fl(struct adapter *, struct sge_fl * static void refill_sfl(void *); static int alloc_fl_sdesc(struct sge_fl *); static void free_fl_sdesc(struct adapter *, struct sge_fl *); -static void find_best_refill_source(struct adapter *, struct sge_fl *, int); -static void find_safe_refill_source(struct adapter *, struct sge_fl *); +static int find_refill_source(struct adapter *, int, bool); static void add_fl_to_sfl(struct adapter *, struct sge_fl *); static inline void get_pkt_gl(struct mbuf *, struct sglist *); @@ -556,7 +546,6 @@ t4_sge_modload(void) t4_register_cpl_handler(CPL_FW4_MSG, handle_fw_msg); t4_register_cpl_handler(CPL_FW6_MSG, handle_fw_msg); t4_register_cpl_handler(CPL_SGE_EGR_UPDATE, handle_sge_egr_update); - t4_register_cpl_handler(CPL_RX_PKT, t4_eth_rx); #ifdef RATELIMIT t4_register_shared_cpl_handler(CPL_FW4_ACK, ethofld_fw4_ack, CPL_COOKIE_ETHOFLD); @@ -665,24 +654,19 @@ setup_pad_and_pack_boundaries(struct adapter *sc) void t4_tweak_chip_settings(struct adapter *sc) { - int i; + int i, reg; uint32_t v, m; int intr_timer[SGE_NTIMERS] = {1, 5, 10, 50, 100, 200}; int timer_max = M_TIMERVALUE0 * 1000 / sc->params.vpd.cclk; int intr_pktcount[SGE_NCOUNTERS] = {1, 8, 16, 32}; /* 63 max */ uint16_t indsz = min(RX_COPY_THRESHOLD - 1, M_INDICATESIZE); - static int sge_flbuf_sizes[] = { + static int sw_buf_sizes[] = { MCLBYTES, #if MJUMPAGESIZE != MCLBYTES MJUMPAGESIZE, - MJUMPAGESIZE - CL_METADATA_SIZE, - MJUMPAGESIZE - 2 * MSIZE - CL_METADATA_SIZE, #endif MJUM9BYTES, - MJUM16BYTES, - MCLBYTES - MSIZE - CL_METADATA_SIZE, - MJUM9BYTES - CL_METADATA_SIZE, - MJUM16BYTES - CL_METADATA_SIZE, + MJUM16BYTES }; KASSERT(sc->flags & MASTER_PF, @@ -705,13 +689,16 @@ t4_tweak_chip_settings(struct adapter *sc) V_HOSTPAGESIZEPF7(PAGE_SHIFT - 10); t4_write_reg(sc, A_SGE_HOST_PAGE_SIZE, v); - KASSERT(nitems(sge_flbuf_sizes) <= SGE_FLBUF_SIZES, - ("%s: hw buffer size table too big", __func__)); t4_write_reg(sc, A_SGE_FL_BUFFER_SIZE0, 4096); t4_write_reg(sc, A_SGE_FL_BUFFER_SIZE1, 65536); - for (i = 0; i < min(nitems(sge_flbuf_sizes), SGE_FLBUF_SIZES); i++) { - t4_write_reg(sc, A_SGE_FL_BUFFER_SIZE15 - (4 * i), - sge_flbuf_sizes[i]); + reg = A_SGE_FL_BUFFER_SIZE2; + for (i = 0; i < nitems(sw_buf_sizes); i++) { + MPASS(reg <= A_SGE_FL_BUFFER_SIZE15); + t4_write_reg(sc, reg, sw_buf_sizes[i]); + reg += 4; + MPASS(reg <= A_SGE_FL_BUFFER_SIZE15); + t4_write_reg(sc, reg, sw_buf_sizes[i] - CL_METADATA_SIZE); + reg += 4; } v = V_THRESHOLD_0(intr_pktcount[0]) | V_THRESHOLD_1(intr_pktcount[1]) | @@ -788,11 +775,11 @@ t4_tweak_chip_settings(struct adapter *sc) } /* - * SGE wants the buffer to be at least 64B and then a multiple of 16. If - * padding is in use, the buffer's start and end need to be aligned to the pad - * boundary as well. We'll just make sure that the size is a multiple of the - * boundary here, it is up to the buffer allocation code to make sure the start - * of the buffer is aligned as well. + * SGE wants the buffer to be at least 64B and then a multiple of 16. Its + * address mut be 16B aligned. If padding is in use the buffer's start and end + * need to be aligned to the pad boundary as well. We'll just make sure that + * the size is a multiple of the pad boundary here, it is up to the buffer + * allocation code to make sure the start of the buffer is aligned. */ static inline int hwsz_ok(struct adapter *sc, int hwsz) @@ -821,8 +808,7 @@ t4_read_chip_settings(struct adapter *sc) MJUM9BYTES, MJUM16BYTES }; - struct sw_zone_info *swz, *safe_swz; - struct hw_buf_info *hwb; + struct rx_buf_info *rxb; m = F_RXPKTCPLMODE; v = F_RXPKTCPLMODE; @@ -841,114 +827,51 @@ t4_read_chip_settings(struct adapter *sc) rc = EINVAL; } - /* Filter out unusable hw buffer sizes entirely (mark with -2). */ - hwb = &s->hw_buf_info[0]; - for (i = 0; i < nitems(s->hw_buf_info); i++, hwb++) { - r = sc->params.sge.sge_fl_buffer_size[i]; - hwb->size = r; - hwb->zidx = hwsz_ok(sc, r) ? -1 : -2; - hwb->next = -1; - } + s->safe_zidx = -1; + rxb = &s->rx_buf_info[0]; + for (i = 0; i < SW_ZONE_SIZES; i++, rxb++) { + rxb->size1 = sw_buf_sizes[i]; + rxb->zone = m_getzone(rxb->size1); + rxb->type = m_gettype(rxb->size1); + rxb->size2 = 0; + rxb->hwidx1 = -1; + rxb->hwidx2 = -1; + for (j = 0; j < SGE_FLBUF_SIZES; j++) { + int hwsize = sp->sge_fl_buffer_size[j]; - /* - * Create a sorted list in decreasing order of hw buffer sizes (and so - * increasing order of spare area) for each software zone. - * - * If padding is enabled then the start and end of the buffer must align - * to the pad boundary; if packing is enabled then they must align with - * the pack boundary as well. Allocations from the cluster zones are - * aligned to min(size, 4K), so the buffer starts at that alignment and - * ends at hwb->size alignment. If mbuf inlining is allowed the - * starting alignment will be reduced to MSIZE and the driver will - * exercise appropriate caution when deciding on the best buffer layout - * to use. - */ - n = 0; /* no usable buffer size to begin with */ - swz = &s->sw_zone_info[0]; - safe_swz = NULL; - for (i = 0; i < SW_ZONE_SIZES; i++, swz++) { - int8_t head = -1, tail = -1; - - swz->size = sw_buf_sizes[i]; - swz->zone = m_getzone(swz->size); - swz->type = m_gettype(swz->size); - - if (swz->size < PAGE_SIZE) { - MPASS(powerof2(swz->size)); - if (fl_pad && (swz->size % sp->pad_boundary != 0)) + if (!hwsz_ok(sc, hwsize)) continue; - } - if (swz->size == safest_rx_cluster) - safe_swz = swz; + /* hwidx for size1 */ + if (rxb->hwidx1 == -1 && rxb->size1 == hwsize) + rxb->hwidx1 = j; - hwb = &s->hw_buf_info[0]; - for (j = 0; j < SGE_FLBUF_SIZES; j++, hwb++) { - if (hwb->zidx != -1 || hwb->size > swz->size) + /* hwidx for size2 (buffer packing) */ + if (rxb->size1 - CL_METADATA_SIZE < hwsize) continue; -#ifdef INVARIANTS - if (fl_pad) - MPASS(hwb->size % sp->pad_boundary == 0); -#endif - hwb->zidx = i; - if (head == -1) - head = tail = j; - else if (hwb->size < s->hw_buf_info[tail].size) { - s->hw_buf_info[tail].next = j; - tail = j; - } else { - int8_t *cur; - struct hw_buf_info *t; - - for (cur = &head; *cur != -1; cur = &t->next) { - t = &s->hw_buf_info[*cur]; - if (hwb->size == t->size) { - hwb->zidx = -2; - break; - } - if (hwb->size > t->size) { - hwb->next = *cur; - *cur = j; - break; - } + n = rxb->size1 - hwsize - CL_METADATA_SIZE; + if (n == 0) { + rxb->hwidx2 = j; + rxb->size2 = hwsize; + break; /* stop looking */ + } + if (rxb->hwidx2 != -1) { + if (n < sp->sge_fl_buffer_size[rxb->hwidx2] - + hwsize - CL_METADATA_SIZE) { + rxb->hwidx2 = j; + rxb->size2 = hwsize; } + } else if (n <= 2 * CL_METADATA_SIZE) { + rxb->hwidx2 = j; + rxb->size2 = hwsize; } } - swz->head_hwidx = head; - swz->tail_hwidx = tail; - - if (tail != -1) { - n++; - if (swz->size - s->hw_buf_info[tail].size >= - CL_METADATA_SIZE) - sc->flags |= BUF_PACKING_OK; - } + if (rxb->hwidx2 != -1) + sc->flags |= BUF_PACKING_OK; + if (s->safe_zidx == -1 && rxb->size1 == safest_rx_cluster) + s->safe_zidx = i; } - if (n == 0) { - device_printf(sc->dev, "no usable SGE FL buffer size.\n"); - rc = EINVAL; - } - s->safe_hwidx1 = -1; - s->safe_hwidx2 = -1; - if (safe_swz != NULL) { - s->safe_hwidx1 = safe_swz->head_hwidx; - for (i = safe_swz->head_hwidx; i != -1; i = hwb->next) { - int spare; - - hwb = &s->hw_buf_info[i]; -#ifdef INVARIANTS - if (fl_pad) - MPASS(hwb->size % sp->pad_boundary == 0); -#endif - spare = safe_swz->size - hwb->size; - if (spare >= CL_METADATA_SIZE) { - s->safe_hwidx2 = i; - break; - } - } - } - if (sc->flags & IS_VF) return (0); @@ -1007,7 +930,7 @@ t4_sge_sysctls(struct adapter *sc, struct sysctl_ctx_l struct sge_params *sp = &sc->params.sge; SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "buffer_sizes", - CTLTYPE_STRING | CTLFLAG_RD, &sc->sge, 0, sysctl_bufsizes, "A", + CTLTYPE_STRING | CTLFLAG_RD, sc, 0, sysctl_bufsizes, "A", "freelist buffer sizes"); SYSCTL_ADD_INT(ctx, children, OID_AUTO, "fl_pktshift", CTLFLAG_RD, @@ -1115,28 +1038,19 @@ t4_teardown_adapter_queues(struct adapter *sc) return (0); } -/* Maximum payload that can be delivered with a single iq descriptor */ +/* Maximum payload that could arrive with a single iq descriptor. */ static inline int -mtu_to_max_payload(struct adapter *sc, int mtu, const int toe) +max_rx_payload(struct adapter *sc, struct ifnet *ifp, const bool ofld) { - int payload; + int maxp; -#ifdef TCP_OFFLOAD - if (toe) { - int rxcs = G_RXCOALESCESIZE(t4_read_reg(sc, A_TP_PARA_REG2)); - - /* Note that COP can set rx_coalesce on/off per connection. */ - payload = max(mtu, rxcs); - } else { -#endif - /* large enough even when hw VLAN extraction is disabled */ - payload = sc->params.sge.fl_pktshift + ETHER_HDR_LEN + - ETHER_VLAN_ENCAP_LEN + mtu; -#ifdef TCP_OFFLOAD - } -#endif - - return (payload); + /* large enough even when hw VLAN extraction is disabled */ + maxp = sc->params.sge.fl_pktshift + ETHER_HDR_LEN + + ETHER_VLAN_ENCAP_LEN + ifp->if_mtu; + if (ofld && sc->tt.tls && sc->cryptocaps & FW_CAPS_CONFIG_TLSKEYS && + maxp < sc->params.tp.max_rx_pdu) + maxp = sc->params.tp.max_rx_pdu; + return (maxp); } int @@ -1162,7 +1076,7 @@ t4_setup_vi_queues(struct vi_info *vi) struct ifnet *ifp = vi->ifp; struct sysctl_oid *oid = device_get_sysctl_tree(vi->dev); struct sysctl_oid_list *children = SYSCTL_CHILDREN(oid); - int maxp, mtu = ifp->if_mtu; + int maxp; /* Interrupt vector to start from (when using multiple vectors) */ intr_idx = vi->first_intr; @@ -1206,7 +1120,7 @@ t4_setup_vi_queues(struct vi_info *vi) * Allocate rx queues first because a default iqid is required when * creating a tx queue. */ - maxp = mtu_to_max_payload(sc, mtu, 0); + maxp = max_rx_payload(sc, ifp, false); oid = SYSCTL_ADD_NODE(&vi->ctx, children, OID_AUTO, "rxq", CTLFLAG_RD, NULL, "rx queues"); for_each_rxq(vi, i, rxq) { @@ -1228,7 +1142,7 @@ t4_setup_vi_queues(struct vi_info *vi) intr_idx = saved_idx + max(vi->nrxq, vi->nnmrxq); #endif #ifdef TCP_OFFLOAD - maxp = mtu_to_max_payload(sc, mtu, 1); + maxp = max_rx_payload(sc, ifp, true); oid = SYSCTL_ADD_NODE(&vi->ctx, children, OID_AUTO, "ofld_rxq", CTLFLAG_RD, NULL, "rx queues for offloaded TCP connections"); for_each_ofld_rxq(vi, i, ofld_rxq) { @@ -1618,6 +1532,20 @@ last_flit_to_ns(struct adapter *sc, uint64_t lf) return (n * 1000000 / sc->params.vpd.cclk); } +static inline void +move_to_next_rxbuf(struct sge_fl *fl) +{ + + fl->rx_offset = 0; + if (__predict_false((++fl->cidx & 7) == 0)) { + uint16_t cidx = fl->cidx >> 3; + + if (__predict_false(cidx == fl->sidx)) + fl->cidx = cidx = 0; + fl->hw_cidx = cidx; + } +} + /* * Deals with interrupts on an iq+fl queue. */ @@ -1628,8 +1556,8 @@ service_iq_fl(struct sge_iq *iq, int budget) struct sge_fl *fl; struct adapter *sc = iq->adapter; struct iq_desc *d = &iq->desc[iq->cidx]; - int ndescs = 0, limit; - int rsp_type, refill, starved; + int ndescs, limit; + int rsp_type, starved; uint32_t lq; uint16_t fl_hw_cidx; struct mbuf *m0; @@ -1641,10 +1569,7 @@ service_iq_fl(struct sge_iq *iq, int budget) KASSERT(iq->state == IQS_BUSY, ("%s: iq %p not BUSY", __func__, iq)); MPASS(iq->flags & IQ_HAS_FL); - limit = budget ? budget : iq->qsize / 16; - fl = &rxq->fl; - fl_hw_cidx = fl->hw_cidx; /* stable snapshot */ - + ndescs = 0; #if defined(INET) || defined(INET6) if (iq->flags & IQ_ADJ_CREDIT) { MPASS(sort_before_lro(lro)); @@ -1662,38 +1587,40 @@ service_iq_fl(struct sge_iq *iq, int budget) MPASS((iq->flags & IQ_ADJ_CREDIT) == 0); #endif + limit = budget ? budget : iq->qsize / 16; + fl = &rxq->fl; + fl_hw_cidx = fl->hw_cidx; /* stable snapshot */ while ((d->rsp.u.type_gen & F_RSPD_GEN) == iq->gen) { rmb(); - refill = 0; m0 = NULL; rsp_type = G_RSPD_TYPE(d->rsp.u.type_gen); lq = be32toh(d->rsp.pldbuflen_qid); switch (rsp_type) { case X_RSPD_TYPE_FLBUF: + if (lq & F_RSPD_NEWBUF) { + if (fl->rx_offset > 0) + move_to_next_rxbuf(fl); + lq = G_RSPD_LEN(lq); + } + if (IDXDIFF(fl->hw_cidx, fl_hw_cidx, fl->sidx) > 4) { + FL_LOCK(fl); + refill_fl(sc, fl, 64); + FL_UNLOCK(fl); + fl_hw_cidx = fl->hw_cidx; + } + if (d->rss.opcode == CPL_RX_PKT) { + if (__predict_true(eth_rx(sc, rxq, d, lq) == 0)) + break; + goto out; + } m0 = get_fl_payload(sc, fl, lq); if (__predict_false(m0 == NULL)) goto out; - refill = IDXDIFF(fl->hw_cidx, fl_hw_cidx, fl->sidx) > 2; - if (iq->flags & IQ_RX_TIMESTAMP) { - /* - * Fill up rcv_tstmp but do not set M_TSTMP. - * rcv_tstmp is not in the format that the - * kernel expects and we don't want to mislead - * it. For now this is only for custom code - * that knows how to interpret cxgbe's stamp. - */ - m0->m_pkthdr.rcv_tstmp = - last_flit_to_ns(sc, d->rsp.u.last_flit); -#ifdef notyet - m0->m_flags |= M_TSTMP; -#endif - } - /* fall through */ case X_RSPD_TYPE_CPL: @@ -1737,7 +1664,6 @@ service_iq_fl(struct sge_iq *iq, int budget) t4_write_reg(sc, sc->sge_gts_reg, V_CIDXINC(ndescs) | V_INGRESSQID(iq->cntxt_id) | V_SEINTARM(V_QINTR_TIMER_IDX(X_TIMERREG_UPDATE_CIDX))); - ndescs = 0; #if defined(INET) || defined(INET6) if (iq->flags & IQ_LRO_ENABLED && @@ -1746,20 +1672,10 @@ service_iq_fl(struct sge_iq *iq, int budget) tcp_lro_flush_inactive(lro, &lro_timeout); } #endif - if (budget) { - FL_LOCK(fl); - refill_fl(sc, fl, 32); - FL_UNLOCK(fl); - + if (budget) return (EINPROGRESS); - } + ndescs = 0; } - if (refill) { - FL_LOCK(fl); - refill_fl(sc, fl, 32); - FL_UNLOCK(fl); - fl_hw_cidx = fl->hw_cidx; - } } out: #if defined(INET) || defined(INET6) @@ -1787,49 +1703,28 @@ out: return (0); } -static inline int -cl_has_metadata(struct sge_fl *fl, struct cluster_layout *cll) -{ - int rc = fl->flags & FL_BUF_PACKING || cll->region1 > 0; - - if (rc) - MPASS(cll->region3 >= CL_METADATA_SIZE); - - return (rc); -} - static inline struct cluster_metadata * -cl_metadata(struct adapter *sc, struct sge_fl *fl, struct cluster_layout *cll, - caddr_t cl) +cl_metadata(struct fl_sdesc *sd) { - if (cl_has_metadata(fl, cll)) { - struct sw_zone_info *swz = &sc->sge.sw_zone_info[cll->zidx]; - - return ((struct cluster_metadata *)(cl + swz->size) - 1); - } - return (NULL); + return ((void *)(sd->cl + sd->moff)); } static void rxb_free(struct mbuf *m) { - uma_zone_t zone = m->m_ext.ext_arg1; - void *cl = m->m_ext.ext_arg2; + struct cluster_metadata *clm = m->m_ext.ext_arg1; - uma_zfree(zone, cl); + uma_zfree(clm->zone, clm->cl); counter_u64_add(extfree_rels, 1); } /* - * The mbuf returned by this function could be allocated from zone_mbuf or - * constructed in spare room in the cluster. - * - * The mbuf carries the payload in one of these ways - * a) frame inside the mbuf (mbuf from zone_mbuf) - * b) m_cljset (for clusters without metadata) zone_mbuf - * c) m_extaddref (cluster with metadata) inline mbuf - * d) m_extaddref (cluster with metadata) zone_mbuf + * The mbuf returned comes from zone_muf and carries the payload in one of these + * ways + * a) complete frame inside the mbuf + * b) m_cljset (for clusters without metadata) + * d) m_extaddref (cluster with metadata) */ static struct mbuf * get_scatter_segment(struct adapter *sc, struct sge_fl *fl, int fr_offset, @@ -1837,118 +1732,86 @@ get_scatter_segment(struct adapter *sc, struct sge_fl { struct mbuf *m; struct fl_sdesc *sd = &fl->sdesc[fl->cidx]; - struct cluster_layout *cll = &sd->cll; - struct sw_zone_info *swz = &sc->sge.sw_zone_info[cll->zidx]; - struct hw_buf_info *hwb = &sc->sge.hw_buf_info[cll->hwidx]; - struct cluster_metadata *clm = cl_metadata(sc, fl, cll, sd->cl); + struct rx_buf_info *rxb = &sc->sge.rx_buf_info[sd->zidx]; + struct cluster_metadata *clm; int len, blen; caddr_t payload; - blen = hwb->size - fl->rx_offset; /* max possible in this buf */ - len = min(remaining, blen); - payload = sd->cl + cll->region1 + fl->rx_offset; if (fl->flags & FL_BUF_PACKING) { - const u_int l = fr_offset + len; - const u_int pad = roundup2(l, fl->buf_boundary) - l; + u_int l, pad; - if (fl->rx_offset + len + pad < hwb->size) + blen = rxb->size2 - fl->rx_offset; /* max possible in this buf */ + len = min(remaining, blen); + payload = sd->cl + fl->rx_offset; + + l = fr_offset + len; + pad = roundup2(l, fl->buf_boundary) - l; + if (fl->rx_offset + len + pad < rxb->size2) blen = len + pad; - MPASS(fl->rx_offset + blen <= hwb->size); + MPASS(fl->rx_offset + blen <= rxb->size2); } else { MPASS(fl->rx_offset == 0); /* not packing */ + blen = rxb->size1; + len = min(remaining, blen); + payload = sd->cl; } - - if (sc->sc_do_rxcopy && len < RX_COPY_THRESHOLD) { - - /* - * Copy payload into a freshly allocated mbuf. - */ - - m = fr_offset == 0 ? - m_gethdr(M_NOWAIT, MT_DATA) : m_get(M_NOWAIT, MT_DATA); - if (m == NULL) + if (fr_offset == 0) { + m = m_gethdr(M_NOWAIT, MT_DATA); + if (__predict_false(m == NULL)) return (NULL); - fl->mbuf_allocated++; + m->m_pkthdr.len = remaining; + } else { + m = m_get(M_NOWAIT, MT_DATA); + if (__predict_false(m == NULL)) + return (NULL); + } + m->m_len = len; + if (sc->sc_do_rxcopy && len < RX_COPY_THRESHOLD) { /* copy data to mbuf */ bcopy(payload, mtod(m, caddr_t), len); - - } else if (sd->nmbuf * MSIZE < cll->region1) { - - /* - * There's spare room in the cluster for an mbuf. Create one - * and associate it with the payload that's in the cluster. - */ - - MPASS(clm != NULL); - m = (struct mbuf *)(sd->cl + sd->nmbuf * MSIZE); - /* No bzero required */ - if (m_init(m, M_NOWAIT, MT_DATA, - fr_offset == 0 ? M_PKTHDR | M_NOFREE : M_NOFREE)) - return (NULL); - fl->mbuf_inlined++; - m_extaddref(m, payload, blen, &clm->refcount, rxb_free, - swz->zone, sd->cl); - if (sd->nmbuf++ == 0) + if (fl->flags & FL_BUF_PACKING) { + fl->rx_offset += blen; + MPASS(fl->rx_offset <= rxb->size2); + if (fl->rx_offset < rxb->size2) + return (m); /* without advancing the cidx */ + } + } else if (fl->flags & FL_BUF_PACKING) { + clm = cl_metadata(sd); + if (sd->nmbuf++ == 0) { + clm->refcount = 1; + clm->zone = rxb->zone; + clm->cl = sd->cl; counter_u64_add(extfree_refs, 1); - - } else { - - /* - * Grab an mbuf from zone_mbuf and associate it with the - * payload in the cluster. - */ - - m = fr_offset == 0 ? - m_gethdr(M_NOWAIT, MT_DATA) : m_get(M_NOWAIT, MT_DATA); - if (m == NULL) - return (NULL); - fl->mbuf_allocated++; - if (clm != NULL) { - m_extaddref(m, payload, blen, &clm->refcount, - rxb_free, swz->zone, sd->cl); - if (sd->nmbuf++ == 0) - counter_u64_add(extfree_refs, 1); - } else { - m_cljset(m, sd->cl, swz->type); - sd->cl = NULL; /* consumed, not a recycle candidate */ } - } - if (fr_offset == 0) - m->m_pkthdr.len = remaining; - m->m_len = len; + m_extaddref(m, payload, blen, &clm->refcount, rxb_free, clm, + NULL); - if (fl->flags & FL_BUF_PACKING) { fl->rx_offset += blen; - MPASS(fl->rx_offset <= hwb->size); - if (fl->rx_offset < hwb->size) + MPASS(fl->rx_offset <= rxb->size2); + if (fl->rx_offset < rxb->size2) return (m); /* without advancing the cidx */ + } else { + m_cljset(m, sd->cl, rxb->type); + sd->cl = NULL; /* consumed, not a recycle candidate */ } - if (__predict_false(++fl->cidx % 8 == 0)) { - uint16_t cidx = fl->cidx / 8; + move_to_next_rxbuf(fl); - if (__predict_false(cidx == fl->sidx)) - fl->cidx = cidx = 0; - fl->hw_cidx = cidx; - } - fl->rx_offset = 0; - return (m); } static struct mbuf * -get_fl_payload(struct adapter *sc, struct sge_fl *fl, uint32_t len_newbuf) +get_fl_payload(struct adapter *sc, struct sge_fl *fl, const u_int plen) { struct mbuf *m0, *m, **pnext; u_int remaining; - const u_int total = G_RSPD_LEN(len_newbuf); if (__predict_false(fl->flags & FL_BUF_RESUME)) { M_ASSERTPKTHDR(fl->m0); - MPASS(fl->m0->m_pkthdr.len == total); - MPASS(fl->remaining < total); + MPASS(fl->m0->m_pkthdr.len == plen); + MPASS(fl->remaining < plen); m0 = fl->m0; pnext = fl->pnext; @@ -1957,31 +1820,20 @@ get_fl_payload(struct adapter *sc, struct sge_fl *fl, goto get_segment; } - if (fl->rx_offset > 0 && len_newbuf & F_RSPD_NEWBUF) { - fl->rx_offset = 0; - if (__predict_false(++fl->cidx % 8 == 0)) { - uint16_t cidx = fl->cidx / 8; - - if (__predict_false(cidx == fl->sidx)) - fl->cidx = cidx = 0; - fl->hw_cidx = cidx; - } - } - /* * Payload starts at rx_offset in the current hw buffer. Its length is * 'len' and it may span multiple hw buffers. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-12@freebsd.org Tue Aug 25 02:42:08 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BCCC73B707B; Tue, 25 Aug 2020 02:42:08 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BbCv44YdRz4dkJ; Tue, 25 Aug 2020 02:42:08 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7FBE022CC9; Tue, 25 Aug 2020 02:42:08 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07P2g8Ah057889; Tue, 25 Aug 2020 02:42:08 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07P2g8X4057888; Tue, 25 Aug 2020 02:42:08 GMT (envelope-from np@FreeBSD.org) Message-Id: <202008250242.07P2g8X4057888@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Tue, 25 Aug 2020 02:42:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364748 - stable/12/sys/dev/cxgbe X-SVN-Group: stable-12 X-SVN-Commit-Author: np X-SVN-Commit-Paths: stable/12/sys/dev/cxgbe X-SVN-Commit-Revision: 364748 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2020 02:42:08 -0000 Author: np Date: Tue Aug 25 02:42:07 2020 New Revision: 364748 URL: https://svnweb.freebsd.org/changeset/base/364748 Log: MFC r362532: cxgbe(4): Add a tx_len16_to_desc helper. No functional change. Sponsored by: Chelsio Communications Modified: stable/12/sys/dev/cxgbe/adapter.h stable/12/sys/dev/cxgbe/t4_sge.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/cxgbe/adapter.h ============================================================================== --- stable/12/sys/dev/cxgbe/adapter.h Tue Aug 25 02:22:49 2020 (r364747) +++ stable/12/sys/dev/cxgbe/adapter.h Tue Aug 25 02:42:07 2020 (r364748) @@ -1313,4 +1313,12 @@ write_via_memwin(struct adapter *sc, int idx, uint32_t return (rw_via_memwin(sc, idx, addr, (void *)(uintptr_t)val, len, 1)); } + +/* Number of len16 -> number of descriptors */ +static inline int +tx_len16_to_desc(int len16) +{ + + return (howmany(len16, EQ_ESIZE / 16)); +} #endif Modified: stable/12/sys/dev/cxgbe/t4_sge.c ============================================================================== --- stable/12/sys/dev/cxgbe/t4_sge.c Tue Aug 25 02:22:49 2020 (r364747) +++ stable/12/sys/dev/cxgbe/t4_sge.c Tue Aug 25 02:42:07 2020 (r364748) @@ -2522,7 +2522,7 @@ start_wrq_wr(struct sge_wrq *wrq, int len16, struct wr void *w; MPASS(len16 > 0); - ndesc = howmany(len16, EQ_ESIZE / 16); + ndesc = tx_len16_to_desc(len16); MPASS(ndesc > 0 && ndesc <= SGE_MAX_WR_NDESC); EQ_LOCK(eq); @@ -2734,9 +2734,9 @@ eth_tx(struct mp_ring *r, u_int cidx, u_int pidx) M_ASSERTPKTHDR(m0); MPASS(m0->m_nextpkt == NULL); - if (available < SGE_MAX_WR_NDESC) { + if (available < tx_len16_to_desc(mbuf_len16(m0))) { available += reclaim_tx_descs(txq, 64); - if (available < howmany(mbuf_len16(m0), EQ_ESIZE / 16)) + if (available < tx_len16_to_desc(mbuf_len16(m0))) break; /* out of descriptors */ } @@ -4440,7 +4440,7 @@ write_txpkt_vm_wr(struct adapter *sc, struct sge_txq * ctrl = sizeof(struct cpl_tx_pkt_core); if (needs_tso(m0)) ctrl += sizeof(struct cpl_tx_pkt_lso_core); - ndesc = howmany(len16, EQ_ESIZE / 16); + ndesc = tx_len16_to_desc(len16); MPASS(ndesc <= available); /* Firmware work request header */ @@ -4551,7 +4551,7 @@ write_raw_wr(struct sge_txq *txq, void *wr, struct mbu int len16, ndesc; len16 = mbuf_len16(m0); - ndesc = howmany(len16, EQ_ESIZE / 16); + ndesc = tx_len16_to_desc(len16); MPASS(ndesc <= available); dst = wr; @@ -4603,7 +4603,7 @@ write_txpkt_wr(struct adapter *sc, struct sge_txq *txq sizeof(struct cpl_tx_pkt_core) + pktlen, 16); nsegs = 0; } - ndesc = howmany(len16, EQ_ESIZE / 16); + ndesc = tx_len16_to_desc(len16); MPASS(ndesc <= available); /* Firmware work request header */ @@ -4709,7 +4709,7 @@ try_txpkts(struct mbuf *m, struct mbuf *n, struct txpk l2 = txpkts0_len16(nsegs2); } txp->len16 = howmany(sizeof(struct fw_eth_tx_pkts_wr), 16) + l1 + l2; - needed = howmany(txp->len16, EQ_ESIZE / 16); + needed = tx_len16_to_desc(txp->len16); if (needed > SGE_MAX_WR_NDESC || needed > available) return (1); @@ -4743,7 +4743,7 @@ add_to_txpkts(struct mbuf *m, struct txpkts *txp, u_in len16 = txpkts0_len16(nsegs); else len16 = txpkts1_len16(); - needed = howmany(txp->len16 + len16, EQ_ESIZE / 16); + needed = tx_len16_to_desc(txp->len16 + len16); if (needed > SGE_MAX_WR_NDESC || needed > available) return (1); @@ -4784,7 +4784,7 @@ write_txpkts_wr(struct adapter *sc, struct sge_txq *tx MPASS(txp->len16 <= howmany(SGE_MAX_WR_LEN, 16)); MPASS(available > 0 && available < eq->sidx); - ndesc = howmany(txp->len16, EQ_ESIZE / 16); + ndesc = tx_len16_to_desc(txp->len16); MPASS(ndesc <= available); MPASS(wr == (void *)&eq->desc[eq->pidx]); From owner-svn-src-stable-12@freebsd.org Tue Aug 25 02:54:50 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 50A453B83C1; Tue, 25 Aug 2020 02:54:50 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BbD9k1l8lz4fbN; Tue, 25 Aug 2020 02:54:50 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1EFF422F83; Tue, 25 Aug 2020 02:54:50 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07P2soBs064994; Tue, 25 Aug 2020 02:54:50 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07P2smm3064987; Tue, 25 Aug 2020 02:54:48 GMT (envelope-from np@FreeBSD.org) Message-Id: <202008250254.07P2smm3064987@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Tue, 25 Aug 2020 02:54:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364750 - in stable/12/sys/dev/cxgbe: . cxgbei tom X-SVN-Group: stable-12 X-SVN-Commit-Author: np X-SVN-Commit-Paths: in stable/12/sys/dev/cxgbe: . cxgbei tom X-SVN-Commit-Revision: 364750 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2020 02:54:50 -0000 Author: np Date: Tue Aug 25 02:54:48 2020 New Revision: 364750 URL: https://svnweb.freebsd.org/changeset/base/364750 Log: MFC r362616: cxgbe(4): Add a pointer to the adapter softc in vi_info. There were quite a few places where port_info was being accessed only to get to the adapter. Sponsored by: Chelsio Communications Modified: stable/12/sys/dev/cxgbe/adapter.h stable/12/sys/dev/cxgbe/cxgbei/icl_cxgbei.c stable/12/sys/dev/cxgbe/t4_main.c stable/12/sys/dev/cxgbe/t4_netmap.c stable/12/sys/dev/cxgbe/t4_sge.c stable/12/sys/dev/cxgbe/t4_vf.c stable/12/sys/dev/cxgbe/tom/t4_listen.c stable/12/sys/dev/cxgbe/tom/t4_tom.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/cxgbe/adapter.h ============================================================================== --- stable/12/sys/dev/cxgbe/adapter.h Tue Aug 25 02:42:48 2020 (r364749) +++ stable/12/sys/dev/cxgbe/adapter.h Tue Aug 25 02:54:48 2020 (r364750) @@ -187,6 +187,7 @@ enum { struct vi_info { device_t dev; struct port_info *pi; + struct adapter *adapter; struct ifnet *ifp; @@ -931,22 +932,22 @@ struct adapter { #define TXQ_LOCK_ASSERT_NOTOWNED(txq) EQ_LOCK_ASSERT_NOTOWNED(&(txq)->eq) #define for_each_txq(vi, iter, q) \ - for (q = &vi->pi->adapter->sge.txq[vi->first_txq], iter = 0; \ + for (q = &vi->adapter->sge.txq[vi->first_txq], iter = 0; \ iter < vi->ntxq; ++iter, ++q) #define for_each_rxq(vi, iter, q) \ - for (q = &vi->pi->adapter->sge.rxq[vi->first_rxq], iter = 0; \ + for (q = &vi->adapter->sge.rxq[vi->first_rxq], iter = 0; \ iter < vi->nrxq; ++iter, ++q) #define for_each_ofld_txq(vi, iter, q) \ - for (q = &vi->pi->adapter->sge.ofld_txq[vi->first_ofld_txq], iter = 0; \ + for (q = &vi->adapter->sge.ofld_txq[vi->first_ofld_txq], iter = 0; \ iter < vi->nofldtxq; ++iter, ++q) #define for_each_ofld_rxq(vi, iter, q) \ - for (q = &vi->pi->adapter->sge.ofld_rxq[vi->first_ofld_rxq], iter = 0; \ + for (q = &vi->adapter->sge.ofld_rxq[vi->first_ofld_rxq], iter = 0; \ iter < vi->nofldrxq; ++iter, ++q) #define for_each_nm_txq(vi, iter, q) \ - for (q = &vi->pi->adapter->sge.nm_txq[vi->first_nm_txq], iter = 0; \ + for (q = &vi->adapter->sge.nm_txq[vi->first_nm_txq], iter = 0; \ iter < vi->nnmtxq; ++iter, ++q) #define for_each_nm_rxq(vi, iter, q) \ - for (q = &vi->pi->adapter->sge.nm_rxq[vi->first_nm_rxq], iter = 0; \ + for (q = &vi->adapter->sge.nm_rxq[vi->first_nm_rxq], iter = 0; \ iter < vi->nnmrxq; ++iter, ++q) #define for_each_vi(_pi, _iter, _vi) \ for ((_vi) = (_pi)->vi, (_iter) = 0; (_iter) < (_pi)->nvi; \ Modified: stable/12/sys/dev/cxgbe/cxgbei/icl_cxgbei.c ============================================================================== --- stable/12/sys/dev/cxgbe/cxgbei/icl_cxgbei.c Tue Aug 25 02:42:48 2020 (r364749) +++ stable/12/sys/dev/cxgbe/cxgbei/icl_cxgbei.c Tue Aug 25 02:54:48 2020 (r364750) @@ -671,7 +671,7 @@ icl_cxgbei_conn_handoff(struct icl_conn *ic, int fd) MPASS(tp->tod != NULL); MPASS(tp->t_toe != NULL); toep = tp->t_toe; - MPASS(toep->vi->pi->adapter == icc->sc); + MPASS(toep->vi->adapter == icc->sc); icc->toep = toep; icc->cwt = cxgbei_select_worker_thread(icc); Modified: stable/12/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/12/sys/dev/cxgbe/t4_main.c Tue Aug 25 02:42:48 2020 (r364749) +++ stable/12/sys/dev/cxgbe/t4_main.c Tue Aug 25 02:54:48 2020 (r364750) @@ -1297,6 +1297,7 @@ t4_attach(device_t dev) pi->nvi = num_vis; for_each_vi(pi, j, vi) { vi->pi = pi; + vi->adapter = sc; vi->qsize_rxq = t4_qsize_rxq; vi->qsize_txq = t4_qsize_txq; @@ -1695,7 +1696,7 @@ cxgbe_vi_attach(device_t dev, struct vi_info *vi) ifp->if_capabilities |= IFCAP_TOE; #endif #ifdef RATELIMIT - if (is_ethoffload(vi->pi->adapter) && vi->nofldtxq != 0) { + if (is_ethoffload(vi->adapter) && vi->nofldtxq != 0) { ifp->if_capabilities |= IFCAP_TXRTLMT; ifp->if_capenable |= IFCAP_TXRTLMT; } @@ -1706,7 +1707,7 @@ cxgbe_vi_attach(device_t dev, struct vi_info *vi) ifp->if_hw_tsomax = IP_MAXPACKET; ifp->if_hw_tsomaxsegcount = TX_SGL_SEGS_TSO; #ifdef RATELIMIT - if (is_ethoffload(vi->pi->adapter) && vi->nofldtxq != 0) + if (is_ethoffload(vi->adapter) && vi->nofldtxq != 0) ifp->if_hw_tsomaxsegcount = TX_SGL_SEGS_EO_TSO; #endif ifp->if_hw_tsomaxsegsize = 65536; @@ -1834,7 +1835,7 @@ static void cxgbe_init(void *arg) { struct vi_info *vi = arg; - struct adapter *sc = vi->pi->adapter; + struct adapter *sc = vi->adapter; if (begin_synchronized_op(sc, vi, SLEEP_OK | INTR_OK, "t4init") != 0) return; @@ -2144,7 +2145,7 @@ vi_get_counter(struct ifnet *ifp, ift_counter c) struct vi_info *vi = ifp->if_softc; struct fw_vi_stats_vf *s = &vi->stats; - vi_refresh_stats(vi->pi->adapter, vi); + vi_refresh_stats(vi->adapter, vi); switch (c) { case IFCOUNTER_IPACKETS: @@ -2587,7 +2588,7 @@ vcxgbe_detach(device_t dev) struct adapter *sc; vi = device_get_softc(dev); - sc = vi->pi->adapter; + sc = vi->adapter; doom_vi(sc, vi); @@ -5488,7 +5489,7 @@ hashen_to_hashconfig(int hashen) int vi_full_init(struct vi_info *vi) { - struct adapter *sc = vi->pi->adapter; + struct adapter *sc = vi->adapter; struct ifnet *ifp = vi->ifp; uint16_t *rss; struct sge_rxq *rxq; @@ -5918,7 +5919,7 @@ void vi_tick(void *arg) { struct vi_info *vi = arg; - struct adapter *sc = vi->pi->adapter; + struct adapter *sc = vi->adapter; vi_refresh_stats(sc, vi); @@ -6856,7 +6857,7 @@ static int sysctl_holdoff_tmr_idx(SYSCTL_HANDLER_ARGS) { struct vi_info *vi = arg1; - struct adapter *sc = vi->pi->adapter; + struct adapter *sc = vi->adapter; int idx, rc, i; struct sge_rxq *rxq; uint8_t v; @@ -6893,7 +6894,7 @@ static int sysctl_holdoff_pktc_idx(SYSCTL_HANDLER_ARGS) { struct vi_info *vi = arg1; - struct adapter *sc = vi->pi->adapter; + struct adapter *sc = vi->adapter; int idx, rc; idx = vi->pktc_idx; @@ -6923,7 +6924,7 @@ static int sysctl_qsize_rxq(SYSCTL_HANDLER_ARGS) { struct vi_info *vi = arg1; - struct adapter *sc = vi->pi->adapter; + struct adapter *sc = vi->adapter; int qsize, rc; qsize = vi->qsize_rxq; @@ -6953,7 +6954,7 @@ static int sysctl_qsize_txq(SYSCTL_HANDLER_ARGS) { struct vi_info *vi = arg1; - struct adapter *sc = vi->pi->adapter; + struct adapter *sc = vi->adapter; int qsize, rc; qsize = vi->qsize_txq; @@ -9579,7 +9580,7 @@ static int sysctl_holdoff_tmr_idx_ofld(SYSCTL_HANDLER_ARGS) { struct vi_info *vi = arg1; - struct adapter *sc = vi->pi->adapter; + struct adapter *sc = vi->adapter; int idx, rc, i; struct sge_ofld_rxq *ofld_rxq; uint8_t v; @@ -9616,7 +9617,7 @@ static int sysctl_holdoff_pktc_idx_ofld(SYSCTL_HANDLER_ARGS) { struct vi_info *vi = arg1; - struct adapter *sc = vi->pi->adapter; + struct adapter *sc = vi->adapter; int idx, rc; idx = vi->ofld_pktc_idx; Modified: stable/12/sys/dev/cxgbe/t4_netmap.c ============================================================================== --- stable/12/sys/dev/cxgbe/t4_netmap.c Tue Aug 25 02:42:48 2020 (r364749) +++ stable/12/sys/dev/cxgbe/t4_netmap.c Tue Aug 25 02:54:48 2020 (r364750) @@ -125,7 +125,7 @@ alloc_nm_rxq_hwq(struct vi_info *vi, struct sge_nm_rxq { int rc, cntxt_id, i; __be32 v; - struct adapter *sc = vi->pi->adapter; + struct adapter *sc = vi->adapter; struct sge_params *sp = &sc->params.sge; struct netmap_adapter *na = NA(vi->ifp); struct fw_iq_cmd c; @@ -245,7 +245,7 @@ alloc_nm_rxq_hwq(struct vi_info *vi, struct sge_nm_rxq static int free_nm_rxq_hwq(struct vi_info *vi, struct sge_nm_rxq *nm_rxq) { - struct adapter *sc = vi->pi->adapter; + struct adapter *sc = vi->adapter; int rc; rc = -t4_iq_free(sc, sc->mbox, sc->pf, 0, FW_IQ_TYPE_FL_INT_CAP, @@ -262,7 +262,7 @@ alloc_nm_txq_hwq(struct vi_info *vi, struct sge_nm_txq { int rc, cntxt_id; size_t len; - struct adapter *sc = vi->pi->adapter; + struct adapter *sc = vi->adapter; struct netmap_adapter *na = NA(vi->ifp); struct fw_eq_eth_cmd c; @@ -335,7 +335,7 @@ alloc_nm_txq_hwq(struct vi_info *vi, struct sge_nm_txq static int free_nm_txq_hwq(struct vi_info *vi, struct sge_nm_txq *nm_txq) { - struct adapter *sc = vi->pi->adapter; + struct adapter *sc = vi->adapter; int rc; rc = -t4_eth_eq_free(sc, sc->mbox, sc->pf, 0, nm_txq->cntxt_id); @@ -562,7 +562,7 @@ cxgbe_netmap_reg(struct netmap_adapter *na, int on) { struct ifnet *ifp = na->ifp; struct vi_info *vi = ifp->if_softc; - struct adapter *sc = vi->pi->adapter; + struct adapter *sc = vi->adapter; int rc; rc = begin_synchronized_op(sc, vi, SLEEP_OK | INTR_OK, "t4nmreg"); @@ -817,7 +817,7 @@ cxgbe_netmap_txsync(struct netmap_kring *kring, int fl struct netmap_adapter *na = kring->na; struct ifnet *ifp = na->ifp; struct vi_info *vi = ifp->if_softc; - struct adapter *sc = vi->pi->adapter; + struct adapter *sc = vi->adapter; struct sge_nm_txq *nm_txq = &sc->sge.nm_txq[vi->first_nm_txq + kring->ring_id]; const u_int head = kring->rhead; u_int reclaimed = 0; @@ -881,7 +881,7 @@ cxgbe_netmap_rxsync(struct netmap_kring *kring, int fl struct netmap_ring *ring = kring->ring; struct ifnet *ifp = na->ifp; struct vi_info *vi = ifp->if_softc; - struct adapter *sc = vi->pi->adapter; + struct adapter *sc = vi->adapter; struct sge_nm_rxq *nm_rxq = &sc->sge.nm_rxq[vi->first_nm_rxq + kring->ring_id]; u_int const head = kring->rhead; u_int n; @@ -1038,7 +1038,7 @@ void service_nm_rxq(struct sge_nm_rxq *nm_rxq) { struct vi_info *vi = nm_rxq->vi; - struct adapter *sc = vi->pi->adapter; + struct adapter *sc = vi->adapter; struct ifnet *ifp = vi->ifp; struct netmap_adapter *na = NA(ifp); struct netmap_kring *kring = na->rx_rings[nm_rxq->nid]; Modified: stable/12/sys/dev/cxgbe/t4_sge.c ============================================================================== --- stable/12/sys/dev/cxgbe/t4_sge.c Tue Aug 25 02:42:48 2020 (r364749) +++ stable/12/sys/dev/cxgbe/t4_sge.c Tue Aug 25 02:54:48 2020 (r364750) @@ -2061,7 +2061,7 @@ void t4_update_fl_bufsize(struct ifnet *ifp) { struct vi_info *vi = ifp->if_softc; - struct adapter *sc = vi->pi->adapter; + struct adapter *sc = vi->adapter; struct sge_rxq *rxq; #ifdef TCP_OFFLOAD struct sge_ofld_rxq *ofld_rxq; @@ -2695,8 +2695,7 @@ eth_tx(struct mp_ring *r, u_int cidx, u_int pidx) struct sge_eq *eq = &txq->eq; struct ifnet *ifp = txq->ifp; struct vi_info *vi = ifp->if_softc; - struct port_info *pi = vi->pi; - struct adapter *sc = pi->adapter; + struct adapter *sc = vi->adapter; u_int total, remaining; /* # of packets */ u_int available, dbdiff; /* # of hardware descriptors */ u_int n, next_cidx; @@ -3302,7 +3301,7 @@ alloc_rxq(struct vi_info *vi, struct sge_rxq *rxq, int struct sysctl_oid *oid) { int rc; - struct adapter *sc = vi->pi->adapter; + struct adapter *sc = vi->adapter; struct sysctl_oid_list *children; char name[16]; @@ -3432,7 +3431,7 @@ alloc_nm_rxq(struct vi_info *vi, struct sge_nm_rxq *nm struct sysctl_ctx_list *ctx; char name[16]; size_t len; - struct adapter *sc = vi->pi->adapter; + struct adapter *sc = vi->adapter; struct netmap_adapter *na = NA(vi->ifp); MPASS(na != NULL); @@ -3498,7 +3497,7 @@ alloc_nm_rxq(struct vi_info *vi, struct sge_nm_rxq *nm static int free_nm_rxq(struct vi_info *vi, struct sge_nm_rxq *nm_rxq) { - struct adapter *sc = vi->pi->adapter; + struct adapter *sc = vi->adapter; if (vi->flags & VI_INIT_DONE) MPASS(nm_rxq->iq_cntxt_id == INVALID_NM_RXQ_CNTXT_ID); @@ -3564,7 +3563,7 @@ alloc_nm_txq(struct vi_info *vi, struct sge_nm_txq *nm static int free_nm_txq(struct vi_info *vi, struct sge_nm_txq *nm_txq) { - struct adapter *sc = vi->pi->adapter; + struct adapter *sc = vi->adapter; if (vi->flags & VI_INIT_DONE) MPASS(nm_txq->cntxt_id == INVALID_NM_TXQ_CNTXT_ID); @@ -4033,7 +4032,7 @@ static int free_txq(struct vi_info *vi, struct sge_txq *txq) { int rc; - struct adapter *sc = vi->pi->adapter; + struct adapter *sc = vi->adapter; struct sge_eq *eq = &txq->eq; rc = free_eq(sc, eq); Modified: stable/12/sys/dev/cxgbe/t4_vf.c ============================================================================== --- stable/12/sys/dev/cxgbe/t4_vf.c Tue Aug 25 02:42:48 2020 (r364749) +++ stable/12/sys/dev/cxgbe/t4_vf.c Tue Aug 25 02:54:48 2020 (r364750) @@ -702,6 +702,7 @@ t4vf_attach(device_t dev) for_each_vi(pi, j, vi) { vi->pi = pi; + vi->adapter = sc; vi->qsize_rxq = t4_qsize_rxq; vi->qsize_txq = t4_qsize_txq; Modified: stable/12/sys/dev/cxgbe/tom/t4_listen.c ============================================================================== --- stable/12/sys/dev/cxgbe/tom/t4_listen.c Tue Aug 25 02:42:48 2020 (r364749) +++ stable/12/sys/dev/cxgbe/tom/t4_listen.c Tue Aug 25 02:54:48 2020 (r364750) @@ -1422,7 +1422,7 @@ do_pass_establish(struct sge_iq *iq, const struct rss_ ifp = synqe->syn->m_pkthdr.rcvif; vi = ifp->if_softc; - KASSERT(vi->pi->adapter == sc, + KASSERT(vi->adapter == sc, ("%s: vi %p, sc %p mismatch", __func__, vi, sc)); if (__predict_false(inp->inp_flags & INP_DROPPED)) { Modified: stable/12/sys/dev/cxgbe/tom/t4_tom.c ============================================================================== --- stable/12/sys/dev/cxgbe/tom/t4_tom.c Tue Aug 25 02:42:48 2020 (r364749) +++ stable/12/sys/dev/cxgbe/tom/t4_tom.c Tue Aug 25 02:54:48 2020 (r364750) @@ -955,7 +955,7 @@ calc_options0(struct vi_info *vi, struct conn_params * MPASS(cp->opt0_bufsize >= 0 && cp->opt0_bufsize <= M_RCV_BUFSIZ); opt0 |= V_RCV_BUFSIZ(cp->opt0_bufsize); - MPASS(cp->l2t_idx >= 0 && cp->l2t_idx < vi->pi->adapter->vres.l2t.size); + MPASS(cp->l2t_idx >= 0 && cp->l2t_idx < vi->adapter->vres.l2t.size); opt0 |= V_L2T_IDX(cp->l2t_idx); opt0 |= V_SMAC_SEL(vi->smt_idx); @@ -1030,7 +1030,7 @@ calc_options2(struct vi_info *vi, struct conn_params * uint64_t select_ntuple(struct vi_info *vi, struct l2t_entry *e) { - struct adapter *sc = vi->pi->adapter; + struct adapter *sc = vi->adapter; struct tp_params *tp = &sc->params.tp; uint64_t ntuple = 0; From owner-svn-src-stable-12@freebsd.org Tue Aug 25 11:10:37 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ECB2E3C7305; Tue, 25 Aug 2020 11:10:37 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BbR9n643yz4D5n; Tue, 25 Aug 2020 11:10:37 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 9703E28E0C; Tue, 25 Aug 2020 11:10:37 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07PBAbfH066434; Tue, 25 Aug 2020 11:10:37 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07PBAbnl066433; Tue, 25 Aug 2020 11:10:37 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <202008251110.07PBAbnl066433@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Tue, 25 Aug 2020 11:10:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364755 - stable/12/sys/dev/netmap X-SVN-Group: stable-12 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: stable/12/sys/dev/netmap X-SVN-Commit-Revision: 364755 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2020 11:10:38 -0000 Author: vmaffione Date: Tue Aug 25 11:10:37 2020 New Revision: 364755 URL: https://svnweb.freebsd.org/changeset/base/364755 Log: MFC r364341 netmap: fix parsing of legacy nmr->nr_ringid Code was checking for NETMAP_{SW,HW}_RING in req->nr_ringid which had already been masked by NETMAP_RING_MASK. Therefore, the comparisons always failed and set NR_REG_ALL_NIC. Check against the original nmr structure. Submitted by: bpoole@packetforensics.com Reported by: bpoole@packetforensics.com Reviewed by: giuseppe.lettieri@unipi.it Approved by: vmaffione This line, and those below, will be ignored-- > Description of fields to fill in above: 76 columns --| > PR: If and which Problem Report is related. > Submitted by: If someone else sent in the change. > Reported by: If someone else reported the issue. > Reviewed by: If someone else reviewed your modification. > Approved by: If you needed approval for this commit. > Obtained from: If the change is from a third party. > MFC after: N [day[s]|week[s]|month[s]]. Request a reminder email. > MFH: Ports tree branch name. Request approval for merge. > Relnotes: Set to 'yes' for mention in release notes. > Security: Vulnerability reference (one per line) or description. > Sponsored by: If the change was sponsored by an organization. > Pull Request: https://github.com/freebsd/freebsd/pull/### (*full* GitHub URL needed). > Differential Revision: https://reviews.freebsd.org/D### (*full* phabric URL needed). > Empty fields above will be automatically removed. _M . M sys/dev/netmap/netmap_legacy.c Modified: stable/12/sys/dev/netmap/netmap_legacy.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/netmap/netmap_legacy.c ============================================================================== --- stable/12/sys/dev/netmap/netmap_legacy.c Tue Aug 25 09:42:03 2020 (r364754) +++ stable/12/sys/dev/netmap/netmap_legacy.c Tue Aug 25 11:10:37 2020 (r364755) @@ -76,9 +76,9 @@ nmreq_register_from_legacy(struct nmreq *nmr, struct n /* Convert the older nmr->nr_ringid (original * netmap control API) to nmr->nr_flags. */ u_int regmode = NR_REG_DEFAULT; - if (req->nr_ringid & NETMAP_SW_RING) { + if (nmr->nr_ringid & NETMAP_SW_RING) { regmode = NR_REG_SW; - } else if (req->nr_ringid & NETMAP_HW_RING) { + } else if (nmr->nr_ringid & NETMAP_HW_RING) { regmode = NR_REG_ONE_NIC; } else { regmode = NR_REG_ALL_NIC; From owner-svn-src-stable-12@freebsd.org Tue Aug 25 18:11:45 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E3F693B4C48; Tue, 25 Aug 2020 18:11:45 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BbcWj5p12z3YwS; Tue, 25 Aug 2020 18:11:45 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AA6062DF1B; Tue, 25 Aug 2020 18:11:45 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07PIBjTS033593; Tue, 25 Aug 2020 18:11:45 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07PIBjWh033592; Tue, 25 Aug 2020 18:11:45 GMT (envelope-from np@FreeBSD.org) Message-Id: <202008251811.07PIBjWh033592@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Tue, 25 Aug 2020 18:11:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364774 - stable/12/sys/dev/cxgbe/cxgbei X-SVN-Group: stable-12 X-SVN-Commit-Author: np X-SVN-Commit-Paths: stable/12/sys/dev/cxgbe/cxgbei X-SVN-Commit-Revision: 364774 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2020 18:11:46 -0000 Author: np Date: Tue Aug 25 18:11:45 2020 New Revision: 364774 URL: https://svnweb.freebsd.org/changeset/base/364774 Log: MFC r364444: cxgbei: destroy the worker threads' CV and mutex in stop_worker_threads. Modified: stable/12/sys/dev/cxgbe/cxgbei/cxgbei.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/cxgbe/cxgbei/cxgbei.c ============================================================================== --- stable/12/sys/dev/cxgbe/cxgbei/cxgbei.c Tue Aug 25 17:23:33 2020 (r364773) +++ stable/12/sys/dev/cxgbe/cxgbei/cxgbei.c Tue Aug 25 18:11:45 2020 (r364774) @@ -714,6 +714,8 @@ stop_worker_threads(void) cv_wait(&cwt->cwt_cv, &cwt->cwt_lock); } while (cwt->cwt_state != CWT_STOPPED); mtx_unlock(&cwt->cwt_lock); + mtx_destroy(&cwt->cwt_lock); + cv_destroy(&cwt->cwt_cv); } free(cwt_softc, M_CXGBE); } From owner-svn-src-stable-12@freebsd.org Tue Aug 25 18:21:15 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 185873B5628; Tue, 25 Aug 2020 18:21:15 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Bbckg04gnz3Zq5; Tue, 25 Aug 2020 18:21:15 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DABFF2DE72; Tue, 25 Aug 2020 18:21:14 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07PILEg9036816; Tue, 25 Aug 2020 18:21:14 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07PILEMk035752; Tue, 25 Aug 2020 18:21:14 GMT (envelope-from np@FreeBSD.org) Message-Id: <202008251821.07PILEMk035752@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Tue, 25 Aug 2020 18:21:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364776 - in stable/12/sys/dev/cxgbe: common cudbg X-SVN-Group: stable-12 X-SVN-Commit-Author: np X-SVN-Commit-Paths: in stable/12/sys/dev/cxgbe: common cudbg X-SVN-Commit-Revision: 364776 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2020 18:21:15 -0000 Author: np Date: Tue Aug 25 18:21:13 2020 New Revision: 364776 URL: https://svnweb.freebsd.org/changeset/base/364776 Log: MFC r363498: cxgbe(4): Some updates to the common code. Modified: stable/12/sys/dev/cxgbe/common/common.h stable/12/sys/dev/cxgbe/common/t4_hw.c stable/12/sys/dev/cxgbe/common/t4_hw.h stable/12/sys/dev/cxgbe/cudbg/cudbg_lib.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/cxgbe/common/common.h ============================================================================== --- stable/12/sys/dev/cxgbe/common/common.h Tue Aug 25 18:16:40 2020 (r364775) +++ stable/12/sys/dev/cxgbe/common/common.h Tue Aug 25 18:21:13 2020 (r364776) @@ -301,6 +301,7 @@ struct chip_params { u16 vfcount; u32 sge_fl_db; u16 mps_tcam_size; + u16 rss_nentries; }; /* VF-only parameters. */ @@ -379,6 +380,7 @@ struct adapter_params { unsigned int hash_filter:1; unsigned int filter2_wr_support:1; unsigned int port_caps32:1; + unsigned int smac_add_support:1; unsigned int ofldq_wr_cred; unsigned int eo_wr_cred; @@ -784,8 +786,27 @@ int t4_set_rxmode(struct adapter *adap, unsigned int m int t4_alloc_mac_filt(struct adapter *adap, unsigned int mbox, unsigned int viid, bool free, unsigned int naddr, const u8 **addr, u16 *idx, u64 *hash, bool sleep_ok); +int t4_free_mac_filt(struct adapter *adap, unsigned int mbox, + unsigned int viid, unsigned int naddr, + const u8 **addr, bool sleep_ok); +int t4_free_encap_mac_filt(struct adapter *adap, unsigned int viid, + int idx, bool sleep_ok); +int t4_free_raw_mac_filt(struct adapter *adap, unsigned int viid, + const u8 *addr, const u8 *mask, unsigned int idx, + u8 lookup_type, u8 port_id, bool sleep_ok); +int t4_alloc_raw_mac_filt(struct adapter *adap, unsigned int viid, + const u8 *addr, const u8 *mask, unsigned int idx, + u8 lookup_type, u8 port_id, bool sleep_ok); +int t4_alloc_encap_mac_filt(struct adapter *adap, unsigned int viid, + const u8 *addr, const u8 *mask, unsigned int vni, + unsigned int vni_mask, u8 dip_hit, u8 lookup_type, + bool sleep_ok); int t4_change_mac(struct adapter *adap, unsigned int mbox, unsigned int viid, int idx, const u8 *addr, bool persist, uint16_t *smt_idx); +int t4_del_mac(struct adapter *adap, unsigned int mbox, unsigned int viid, + const u8 *addr, bool smac); +int t4_add_mac(struct adapter *adap, unsigned int mbox, unsigned int viid, + int idx, const u8 *addr, bool persist, u8 *smt_idx, bool smac); int t4_set_addr_hash(struct adapter *adap, unsigned int mbox, unsigned int viid, bool ucast, u64 vec, bool sleep_ok); int t4_enable_vi_params(struct adapter *adap, unsigned int mbox, @@ -798,6 +819,10 @@ int t4_mdio_rd(struct adapter *adap, unsigned int mbox unsigned int mmd, unsigned int reg, unsigned int *valp); int t4_mdio_wr(struct adapter *adap, unsigned int mbox, unsigned int phy_addr, unsigned int mmd, unsigned int reg, unsigned int val); +int t4_i2c_io(struct adapter *adap, unsigned int mbox, + int port, unsigned int devid, + unsigned int offset, unsigned int len, + u8 *buf, bool write); int t4_i2c_rd(struct adapter *adap, unsigned int mbox, int port, unsigned int devid, unsigned int offset, unsigned int len, @@ -822,7 +847,7 @@ int t4_sge_ctxt_rd(struct adapter *adap, unsigned int enum ctxt_type ctype, u32 *data); int t4_sge_ctxt_rd_bd(struct adapter *adap, unsigned int cid, enum ctxt_type ctype, u32 *data); -int t4_sge_ctxt_flush(struct adapter *adap, unsigned int mbox); +int t4_sge_ctxt_flush(struct adapter *adap, unsigned int mbox, int ctxt_type); const char *t4_link_down_rc_str(unsigned char link_down_rc); int t4_update_port_info(struct port_info *pi); int t4_handle_fw_rpl(struct adapter *adap, const __be64 *rpl); @@ -855,6 +880,10 @@ void t4_tp_tm_pio_read(struct adapter *adap, u32 *buff u32 start_index, bool sleep_ok); void t4_tp_mib_read(struct adapter *adap, u32 *buff, u32 nregs, u32 start_index, bool sleep_ok); +int t4_configure_ringbb(struct adapter *adap); +int t4_configure_add_smac(struct adapter *adap); +int t4_set_vlan_acl(struct adapter *adap, unsigned int mbox, unsigned int vf, + u16 vlan); static inline int t4vf_query_params(struct adapter *adapter, unsigned int nparams, const u32 *params, Modified: stable/12/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- stable/12/sys/dev/cxgbe/common/t4_hw.c Tue Aug 25 18:16:40 2020 (r364775) +++ stable/12/sys/dev/cxgbe/common/t4_hw.c Tue Aug 25 18:21:13 2020 (r364776) @@ -1359,8 +1359,7 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t 0x9608, 0x9638, 0x9640, 0x96f4, 0x9800, 0x9808, - 0x9820, 0x983c, - 0x9850, 0x9864, + 0x9810, 0x9864, 0x9c00, 0x9c6c, 0x9c80, 0x9cec, 0x9d00, 0x9d6c, @@ -1369,7 +1368,7 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t 0x9e80, 0x9eec, 0x9f00, 0x9f6c, 0x9f80, 0xa020, - 0xd004, 0xd004, + 0xd000, 0xd004, 0xd010, 0xd03c, 0xdfc0, 0xdfe0, 0xe000, 0x1106c, @@ -1410,10 +1409,8 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t 0x1a0b0, 0x1a0e4, 0x1a0ec, 0x1a0f8, 0x1a100, 0x1a108, - 0x1a114, 0x1a120, - 0x1a128, 0x1a130, - 0x1a138, 0x1a138, - 0x1a190, 0x1a1c4, + 0x1a114, 0x1a130, + 0x1a138, 0x1a1c4, 0x1a1fc, 0x1a1fc, 0x1e008, 0x1e00c, 0x1e040, 0x1e044, @@ -2084,7 +2081,7 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t 0x1180, 0x1184, 0x1190, 0x1194, 0x11a0, 0x11a4, - 0x11b0, 0x11b4, + 0x11b0, 0x11c4, 0x11fc, 0x1274, 0x1280, 0x133c, 0x1800, 0x18fc, @@ -2140,7 +2137,7 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t 0x7e4c, 0x7e78, 0x7e80, 0x7edc, 0x7ee8, 0x7efc, - 0x8dc0, 0x8de4, + 0x8dc0, 0x8de0, 0x8df8, 0x8e04, 0x8e10, 0x8e84, 0x8ea0, 0x8f88, @@ -2154,8 +2151,7 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t 0x9640, 0x9704, 0x9710, 0x971c, 0x9800, 0x9808, - 0x9820, 0x983c, - 0x9850, 0x9864, + 0x9810, 0x9864, 0x9c00, 0x9c6c, 0x9c80, 0x9cec, 0x9d00, 0x9d6c, @@ -2164,7 +2160,7 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t 0x9e80, 0x9eec, 0x9f00, 0x9f6c, 0x9f80, 0xa020, - 0xd004, 0xd03c, + 0xd000, 0xd03c, 0xd100, 0xd118, 0xd200, 0xd214, 0xd220, 0xd234, @@ -2198,7 +2194,6 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t 0x191d0, 0x191e8, 0x19238, 0x19290, 0x192a4, 0x192b0, - 0x192bc, 0x192bc, 0x19348, 0x1934c, 0x193f8, 0x19418, 0x19420, 0x19428, @@ -2216,7 +2211,7 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t 0x19d00, 0x19d28, 0x19d50, 0x19d78, 0x19d94, 0x19d98, - 0x19da0, 0x19dc8, + 0x19da0, 0x19de0, 0x19df0, 0x19e10, 0x19e50, 0x19e6c, 0x19ea0, 0x19ebc, @@ -2232,10 +2227,8 @@ void t4_get_regs(struct adapter *adap, u8 *buf, size_t 0x1a0b0, 0x1a0e4, 0x1a0ec, 0x1a0f8, 0x1a100, 0x1a108, - 0x1a114, 0x1a120, - 0x1a128, 0x1a130, - 0x1a138, 0x1a138, - 0x1a190, 0x1a1c4, + 0x1a114, 0x1a130, + 0x1a138, 0x1a1c4, 0x1a1fc, 0x1a1fc, 0x1e008, 0x1e00c, 0x1e040, 0x1e044, @@ -3357,7 +3350,7 @@ int t4_get_tp_version(struct adapter *adapter, u32 *ve * this in the Firmware Version Format since it's convenient. Return * 0 on success, -ENOENT if no Expansion ROM is present. */ -int t4_get_exprom_version(struct adapter *adap, u32 *vers) +int t4_get_exprom_version(struct adapter *adapter, u32 *vers) { struct exprom_header { unsigned char hdr_arr[16]; /* must start with 0x55aa */ @@ -3367,7 +3360,7 @@ int t4_get_exprom_version(struct adapter *adap, u32 *v sizeof(u32))]; int ret; - ret = t4_read_flash(adap, FLASH_EXP_ROM_START, + ret = t4_read_flash(adapter, FLASH_EXP_ROM_START, ARRAY_SIZE(exprom_header_buf), exprom_header_buf, 0); if (ret) @@ -5703,8 +5696,9 @@ int t4_read_rss(struct adapter *adapter, u16 *map) { u32 val; int i, ret; + int rss_nentries = adapter->chip_params->rss_nentries; - for (i = 0; i < RSS_NENTRIES / 2; ++i) { + for (i = 0; i < rss_nentries / 2; ++i) { ret = rd_rss_row(adapter, i, &val); if (ret) return ret; @@ -7374,14 +7368,16 @@ void t4_sge_decode_idma_state(struct adapter *adapter, * Issues a FW command through the given mailbox to flush the * SGE context cache. */ -int t4_sge_ctxt_flush(struct adapter *adap, unsigned int mbox) +int t4_sge_ctxt_flush(struct adapter *adap, unsigned int mbox, int ctxt_type) { int ret; u32 ldst_addrspace; struct fw_ldst_cmd c; memset(&c, 0, sizeof(c)); - ldst_addrspace = V_FW_LDST_CMD_ADDRSPACE(FW_LDST_ADDRSPC_SGE_EGRC); + ldst_addrspace = V_FW_LDST_CMD_ADDRSPACE(ctxt_type == CTXT_EGRESS ? + FW_LDST_ADDRSPC_SGE_EGRC : + FW_LDST_ADDRSPC_SGE_INGC); c.op_to_addrspace = cpu_to_be32(V_FW_CMD_OP(FW_LDST_CMD) | F_FW_CMD_REQUEST | F_FW_CMD_READ | ldst_addrspace); @@ -8035,6 +8031,111 @@ int t4_set_rxmode(struct adapter *adap, unsigned int m } /** + * t4_alloc_encap_mac_filt - Adds a mac entry in mps tcam with VNI support + * @adap: the adapter + * @viid: the VI id + * @mac: the MAC address + * @mask: the mask + * @vni: the VNI id for the tunnel protocol + * @vni_mask: mask for the VNI id + * @dip_hit: to enable DIP match for the MPS entry + * @lookup_type: MAC address for inner (1) or outer (0) header + * @sleep_ok: call is allowed to sleep + * + * Allocates an MPS entry with specified MAC address and VNI value. + * + * Returns a negative error number or the allocated index for this mac. + */ +int t4_alloc_encap_mac_filt(struct adapter *adap, unsigned int viid, + const u8 *addr, const u8 *mask, unsigned int vni, + unsigned int vni_mask, u8 dip_hit, u8 lookup_type, + bool sleep_ok) +{ + struct fw_vi_mac_cmd c; + struct fw_vi_mac_vni *p = c.u.exact_vni; + int ret = 0; + u32 val; + + memset(&c, 0, sizeof(c)); + c.op_to_viid = cpu_to_be32(V_FW_CMD_OP(FW_VI_MAC_CMD) | + F_FW_CMD_REQUEST | F_FW_CMD_WRITE | + V_FW_VI_MAC_CMD_VIID(viid)); + val = V_FW_CMD_LEN16(1) | + V_FW_VI_MAC_CMD_ENTRY_TYPE(FW_VI_MAC_TYPE_EXACTMAC_VNI); + c.freemacs_to_len16 = cpu_to_be32(val); + p->valid_to_idx = cpu_to_be16(F_FW_VI_MAC_CMD_VALID | + V_FW_VI_MAC_CMD_IDX(FW_VI_MAC_ADD_MAC)); + memcpy(p->macaddr, addr, sizeof(p->macaddr)); + memcpy(p->macaddr_mask, mask, sizeof(p->macaddr_mask)); + + p->lookup_type_to_vni = cpu_to_be32(V_FW_VI_MAC_CMD_VNI(vni) | + V_FW_VI_MAC_CMD_DIP_HIT(dip_hit) | + V_FW_VI_MAC_CMD_LOOKUP_TYPE(lookup_type)); + p->vni_mask_pkd = cpu_to_be32(V_FW_VI_MAC_CMD_VNI_MASK(vni_mask)); + + ret = t4_wr_mbox_meat(adap, adap->mbox, &c, sizeof(c), &c, sleep_ok); + if (ret == 0) + ret = G_FW_VI_MAC_CMD_IDX(be16_to_cpu(p->valid_to_idx)); + return ret; +} + +/** + * t4_alloc_raw_mac_filt - Adds a mac entry in mps tcam + * @adap: the adapter + * @viid: the VI id + * @mac: the MAC address + * @mask: the mask + * @idx: index at which to add this entry + * @port_id: the port index + * @lookup_type: MAC address for inner (1) or outer (0) header + * @sleep_ok: call is allowed to sleep + * + * Adds the mac entry at the specified index using raw mac interface. + * + * Returns a negative error number or the allocated index for this mac. + */ +int t4_alloc_raw_mac_filt(struct adapter *adap, unsigned int viid, + const u8 *addr, const u8 *mask, unsigned int idx, + u8 lookup_type, u8 port_id, bool sleep_ok) +{ + int ret = 0; + struct fw_vi_mac_cmd c; + struct fw_vi_mac_raw *p = &c.u.raw; + u32 val; + + memset(&c, 0, sizeof(c)); + c.op_to_viid = cpu_to_be32(V_FW_CMD_OP(FW_VI_MAC_CMD) | + F_FW_CMD_REQUEST | F_FW_CMD_WRITE | + V_FW_VI_MAC_CMD_VIID(viid)); + val = V_FW_CMD_LEN16(1) | + V_FW_VI_MAC_CMD_ENTRY_TYPE(FW_VI_MAC_TYPE_RAW); + c.freemacs_to_len16 = cpu_to_be32(val); + + /* Specify that this is an inner mac address */ + p->raw_idx_pkd = cpu_to_be32(V_FW_VI_MAC_CMD_RAW_IDX(idx)); + + /* Lookup Type. Outer header: 0, Inner header: 1 */ + p->data0_pkd = cpu_to_be32(V_DATALKPTYPE(lookup_type) | + V_DATAPORTNUM(port_id)); + /* Lookup mask and port mask */ + p->data0m_pkd = cpu_to_be64(V_DATALKPTYPE(M_DATALKPTYPE) | + V_DATAPORTNUM(M_DATAPORTNUM)); + + /* Copy the address and the mask */ + memcpy((u8 *)&p->data1[0] + 2, addr, ETHER_ADDR_LEN); + memcpy((u8 *)&p->data1m[0] + 2, mask, ETHER_ADDR_LEN); + + ret = t4_wr_mbox_meat(adap, adap->mbox, &c, sizeof(c), &c, sleep_ok); + if (ret == 0) { + ret = G_FW_VI_MAC_CMD_RAW_IDX(be32_to_cpu(p->raw_idx_pkd)); + if (ret != idx) + ret = -ENOMEM; + } + + return ret; +} + +/** * t4_alloc_mac_filt - allocates exact-match filters for MAC addresses * @adap: the adapter * @mbox: mailbox to use for the FW command @@ -8128,6 +8229,168 @@ int t4_alloc_mac_filt(struct adapter *adap, unsigned i } /** + * t4_free_encap_mac_filt - frees MPS entry at given index + * @adap: the adapter + * @viid: the VI id + * @idx: index of MPS entry to be freed + * @sleep_ok: call is allowed to sleep + * + * Frees the MPS entry at supplied index + * + * Returns a negative error number or zero on success + */ +int t4_free_encap_mac_filt(struct adapter *adap, unsigned int viid, + int idx, bool sleep_ok) +{ + struct fw_vi_mac_exact *p; + struct fw_vi_mac_cmd c; + u8 addr[] = {0,0,0,0,0,0}; + int ret = 0; + u32 exact; + + memset(&c, 0, sizeof(c)); + c.op_to_viid = cpu_to_be32(V_FW_CMD_OP(FW_VI_MAC_CMD) | + F_FW_CMD_REQUEST | + F_FW_CMD_WRITE | + V_FW_CMD_EXEC(0) | + V_FW_VI_MAC_CMD_VIID(viid)); + exact = V_FW_VI_MAC_CMD_ENTRY_TYPE(FW_VI_MAC_TYPE_EXACTMAC); + c.freemacs_to_len16 = cpu_to_be32(V_FW_VI_MAC_CMD_FREEMACS(0) | + exact | + V_FW_CMD_LEN16(1)); + p = c.u.exact; + p->valid_to_idx = cpu_to_be16(F_FW_VI_MAC_CMD_VALID | + V_FW_VI_MAC_CMD_IDX(idx)); + memcpy(p->macaddr, addr, sizeof(p->macaddr)); + + ret = t4_wr_mbox_meat(adap, adap->mbox, &c, sizeof(c), &c, sleep_ok); + return ret; +} + +/** + * t4_free_raw_mac_filt - Frees a raw mac entry in mps tcam + * @adap: the adapter + * @viid: the VI id + * @addr: the MAC address + * @mask: the mask + * @idx: index of the entry in mps tcam + * @lookup_type: MAC address for inner (1) or outer (0) header + * @port_id: the port index + * @sleep_ok: call is allowed to sleep + * + * Removes the mac entry at the specified index using raw mac interface. + * + * Returns a negative error number on failure. + */ +int t4_free_raw_mac_filt(struct adapter *adap, unsigned int viid, + const u8 *addr, const u8 *mask, unsigned int idx, + u8 lookup_type, u8 port_id, bool sleep_ok) +{ + struct fw_vi_mac_cmd c; + struct fw_vi_mac_raw *p = &c.u.raw; + u32 raw; + + memset(&c, 0, sizeof(c)); + c.op_to_viid = cpu_to_be32(V_FW_CMD_OP(FW_VI_MAC_CMD) | + F_FW_CMD_REQUEST | F_FW_CMD_WRITE | + V_FW_CMD_EXEC(0) | + V_FW_VI_MAC_CMD_VIID(viid)); + raw = V_FW_VI_MAC_CMD_ENTRY_TYPE(FW_VI_MAC_TYPE_RAW); + c.freemacs_to_len16 = cpu_to_be32(V_FW_VI_MAC_CMD_FREEMACS(0) | + raw | + V_FW_CMD_LEN16(1)); + + p->raw_idx_pkd = cpu_to_be32(V_FW_VI_MAC_CMD_RAW_IDX(idx) | + FW_VI_MAC_ID_BASED_FREE); + + /* Lookup Type. Outer header: 0, Inner header: 1 */ + p->data0_pkd = cpu_to_be32(V_DATALKPTYPE(lookup_type) | + V_DATAPORTNUM(port_id)); + /* Lookup mask and port mask */ + p->data0m_pkd = cpu_to_be64(V_DATALKPTYPE(M_DATALKPTYPE) | + V_DATAPORTNUM(M_DATAPORTNUM)); + + /* Copy the address and the mask */ + memcpy((u8 *)&p->data1[0] + 2, addr, ETHER_ADDR_LEN); + memcpy((u8 *)&p->data1m[0] + 2, mask, ETHER_ADDR_LEN); + + return t4_wr_mbox_meat(adap, adap->mbox, &c, sizeof(c), &c, sleep_ok); +} + +/** + * t4_free_mac_filt - frees exact-match filters of given MAC addresses + * @adap: the adapter + * @mbox: mailbox to use for the FW command + * @viid: the VI id + * @naddr: the number of MAC addresses to allocate filters for (up to 7) + * @addr: the MAC address(es) + * @sleep_ok: call is allowed to sleep + * + * Frees the exact-match filter for each of the supplied addresses + * + * Returns a negative error number or the number of filters freed. + */ +int t4_free_mac_filt(struct adapter *adap, unsigned int mbox, + unsigned int viid, unsigned int naddr, + const u8 **addr, bool sleep_ok) +{ + int offset, ret = 0; + struct fw_vi_mac_cmd c; + unsigned int nfilters = 0; + unsigned int max_naddr = adap->chip_params->mps_tcam_size; + unsigned int rem = naddr; + + if (naddr > max_naddr) + return -EINVAL; + + for (offset = 0; offset < (int)naddr ; /**/) { + unsigned int fw_naddr = (rem < ARRAY_SIZE(c.u.exact) + ? rem + : ARRAY_SIZE(c.u.exact)); + size_t len16 = DIV_ROUND_UP(offsetof(struct fw_vi_mac_cmd, + u.exact[fw_naddr]), 16); + struct fw_vi_mac_exact *p; + int i; + + memset(&c, 0, sizeof(c)); + c.op_to_viid = cpu_to_be32(V_FW_CMD_OP(FW_VI_MAC_CMD) | + F_FW_CMD_REQUEST | + F_FW_CMD_WRITE | + V_FW_CMD_EXEC(0) | + V_FW_VI_MAC_CMD_VIID(viid)); + c.freemacs_to_len16 = + cpu_to_be32(V_FW_VI_MAC_CMD_FREEMACS(0) | + V_FW_CMD_LEN16(len16)); + + for (i = 0, p = c.u.exact; i < (int)fw_naddr; i++, p++) { + p->valid_to_idx = cpu_to_be16( + F_FW_VI_MAC_CMD_VALID | + V_FW_VI_MAC_CMD_IDX(FW_VI_MAC_MAC_BASED_FREE)); + memcpy(p->macaddr, addr[offset+i], sizeof(p->macaddr)); + } + + ret = t4_wr_mbox_meat(adap, mbox, &c, sizeof(c), &c, sleep_ok); + if (ret) + break; + + for (i = 0, p = c.u.exact; i < fw_naddr; i++, p++) { + u16 index = G_FW_VI_MAC_CMD_IDX( + be16_to_cpu(p->valid_to_idx)); + + if (index < max_naddr) + nfilters++; + } + + offset += fw_naddr; + rem -= fw_naddr; + } + + if (ret == 0) + ret = nfilters; + return ret; +} + +/** * t4_change_mac - modifies the exact-match filter for a MAC address * @adap: the adapter * @mbox: mailbox to use for the FW command @@ -8916,6 +9179,7 @@ const struct chip_params *t4_get_chip_params(int chipi .vfcount = 128, .sge_fl_db = F_DBPRIO, .mps_tcam_size = NUM_MPS_CLS_SRAM_L_INSTANCES, + .rss_nentries = RSS_NENTRIES, }, { /* T5 */ @@ -8928,6 +9192,7 @@ const struct chip_params *t4_get_chip_params(int chipi .vfcount = 128, .sge_fl_db = F_DBPRIO | F_DBTYPE, .mps_tcam_size = NUM_MPS_T5_CLS_SRAM_L_INSTANCES, + .rss_nentries = RSS_NENTRIES, }, { /* T6 */ @@ -8940,6 +9205,7 @@ const struct chip_params *t4_get_chip_params(int chipi .vfcount = 256, .sge_fl_db = 0, .mps_tcam_size = NUM_MPS_T5_CLS_SRAM_L_INSTANCES, + .rss_nentries = T6_RSS_NENTRIES, }, }; @@ -9743,15 +10009,15 @@ int t4_cim_read_la(struct adapter *adap, u32 *la_buf, if (ret) break; - /* address can't exceed 0xfff (UpDbgLaRdPtr is of 12-bits) */ - idx = (idx + 1) & M_UPDBGLARDPTR; - /* - * Bits 0-3 of UpDbgLaRdPtr can be between 0000 to 1001 to + /* Bits 0-3 of UpDbgLaRdPtr can be between 0000 to 1001 to * identify the 32-bit portion of the full 312-bit data */ - if (is_t6(adap)) - while ((idx & 0xf) > 9) - idx = (idx + 1) % M_UPDBGLARDPTR; + if (is_t6(adap) && (idx & 0xf) >= 9) + idx = (idx & 0xff0) + 0x10; + else + idx++; + /* address can't exceed 0xfff */ + idx &= M_UPDBGLARDPTR; } restart: if (cfg & F_UPDBGLAEN) { @@ -10494,88 +10760,81 @@ void t4_clr_port_stats(struct adapter *adap, int idx) } /** - * t4_i2c_rd - read I2C data from adapter + * t4_i2c_io - read/write I2C data from adapter * @adap: the adapter * @port: Port number if per-port device; <0 if not * @devid: per-port device ID or absolute device ID * @offset: byte offset into device I2C space * @len: byte length of I2C space data - * @buf: buffer in which to return I2C data - * - * Reads the I2C data from the indicated device and location. + * @buf: buffer in which to return I2C data for read + * buffer which holds the I2C data for write + * @write: if true, do a write; else do a read + * Reads/Writes the I2C data from/to the indicated device and location. */ -int t4_i2c_rd(struct adapter *adap, unsigned int mbox, +int t4_i2c_io(struct adapter *adap, unsigned int mbox, int port, unsigned int devid, unsigned int offset, unsigned int len, - u8 *buf) + u8 *buf, bool write) { - u32 ldst_addrspace; - struct fw_ldst_cmd ldst; - int ret; + struct fw_ldst_cmd ldst_cmd, ldst_rpl; + unsigned int i2c_max = sizeof(ldst_cmd.u.i2c.data); + int ret = 0; - if (port >= 4 || - devid >= 256 || - offset >= 256 || - len > sizeof ldst.u.i2c.data) + if (len > I2C_PAGE_SIZE) return -EINVAL; - memset(&ldst, 0, sizeof ldst); - ldst_addrspace = V_FW_LDST_CMD_ADDRSPACE(FW_LDST_ADDRSPC_I2C); - ldst.op_to_addrspace = + /* Dont allow reads that spans multiple pages */ + if (offset < I2C_PAGE_SIZE && offset + len > I2C_PAGE_SIZE) + return -EINVAL; + + memset(&ldst_cmd, 0, sizeof(ldst_cmd)); + ldst_cmd.op_to_addrspace = cpu_to_be32(V_FW_CMD_OP(FW_LDST_CMD) | F_FW_CMD_REQUEST | - F_FW_CMD_READ | - ldst_addrspace); - ldst.cycles_to_len16 = cpu_to_be32(FW_LEN16(ldst)); - ldst.u.i2c.pid = (port < 0 ? 0xff : port); - ldst.u.i2c.did = devid; - ldst.u.i2c.boffset = offset; - ldst.u.i2c.blen = len; - ret = t4_wr_mbox(adap, mbox, &ldst, sizeof ldst, &ldst); - if (!ret) - memcpy(buf, ldst.u.i2c.data, len); + (write ? F_FW_CMD_WRITE : F_FW_CMD_READ) | + V_FW_LDST_CMD_ADDRSPACE(FW_LDST_ADDRSPC_I2C)); + ldst_cmd.cycles_to_len16 = cpu_to_be32(FW_LEN16(ldst_cmd)); + ldst_cmd.u.i2c.pid = (port < 0 ? 0xff : port); + ldst_cmd.u.i2c.did = devid; + + while (len > 0) { + unsigned int i2c_len = (len < i2c_max) ? len : i2c_max; + + ldst_cmd.u.i2c.boffset = offset; + ldst_cmd.u.i2c.blen = i2c_len; + + if (write) + memcpy(ldst_cmd.u.i2c.data, buf, i2c_len); + + ret = t4_wr_mbox(adap, mbox, &ldst_cmd, sizeof(ldst_cmd), + write ? NULL : &ldst_rpl); + if (ret) + break; + + if (!write) + memcpy(buf, ldst_rpl.u.i2c.data, i2c_len); + offset += i2c_len; + buf += i2c_len; + len -= i2c_len; + } + return ret; } -/** - * t4_i2c_wr - write I2C data to adapter - * @adap: the adapter - * @port: Port number if per-port device; <0 if not - * @devid: per-port device ID or absolute device ID - * @offset: byte offset into device I2C space - * @len: byte length of I2C space data - * @buf: buffer containing new I2C data - * - * Write the I2C data to the indicated device and location. - */ -int t4_i2c_wr(struct adapter *adap, unsigned int mbox, +int t4_i2c_rd(struct adapter *adap, unsigned int mbox, int port, unsigned int devid, unsigned int offset, unsigned int len, u8 *buf) { - u32 ldst_addrspace; - struct fw_ldst_cmd ldst; + return t4_i2c_io(adap, mbox, port, devid, offset, len, buf, false); +} - if (port >= 4 || - devid >= 256 || - offset >= 256 || - len > sizeof ldst.u.i2c.data) - return -EINVAL; - - memset(&ldst, 0, sizeof ldst); - ldst_addrspace = V_FW_LDST_CMD_ADDRSPACE(FW_LDST_ADDRSPC_I2C); - ldst.op_to_addrspace = - cpu_to_be32(V_FW_CMD_OP(FW_LDST_CMD) | - F_FW_CMD_REQUEST | - F_FW_CMD_WRITE | - ldst_addrspace); - ldst.cycles_to_len16 = cpu_to_be32(FW_LEN16(ldst)); - ldst.u.i2c.pid = (port < 0 ? 0xff : port); - ldst.u.i2c.did = devid; - ldst.u.i2c.boffset = offset; - ldst.u.i2c.blen = len; - memcpy(ldst.u.i2c.data, buf, len); - return t4_wr_mbox(adap, mbox, &ldst, sizeof ldst, &ldst); +int t4_i2c_wr(struct adapter *adap, unsigned int mbox, + int port, unsigned int devid, + unsigned int offset, unsigned int len, + u8 *buf) +{ + return t4_i2c_io(adap, mbox, port, devid, offset, len, buf, true); } /** @@ -10841,4 +11100,220 @@ int t4_set_devlog_level(struct adapter *adapter, unsig devlog_cmd.retval_len16 = cpu_to_be32(FW_LEN16(devlog_cmd)); return t4_wr_mbox(adapter, adapter->mbox, &devlog_cmd, sizeof(devlog_cmd), &devlog_cmd); +} + +int t4_configure_add_smac(struct adapter *adap) +{ + unsigned int param, val; + int ret = 0; + + adap->params.smac_add_support = 0; + param = (V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | + V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_ADD_SMAC)); + /* Query FW to check if FW supports adding source mac address + * to TCAM feature or not. + * If FW returns 1, driver can use this feature and driver need to send + * FW_PARAMS_PARAM_DEV_ADD_SMAC write command with value 1 to + * enable adding smac to TCAM. + */ + ret = t4_query_params(adap, adap->mbox, adap->pf, 0, 1, ¶m, &val); + if (ret) + return ret; + + if (val == 1) { + ret = t4_set_params(adap, adap->mbox, adap->pf, 0, 1, + ¶m, &val); + if (!ret) + /* Firmware allows adding explicit TCAM entries. + * Save this internally. + */ + adap->params.smac_add_support = 1; + } + + return ret; +} + +int t4_configure_ringbb(struct adapter *adap) +{ + unsigned int param, val; + int ret = 0; + + param = (V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | + V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_RING_BACKBONE)); + /* Query FW to check if FW supports ring switch feature or not. + * If FW returns 1, driver can use this feature and driver need to send + * FW_PARAMS_PARAM_DEV_RING_BACKBONE write command with value 1 to + * enable the ring backbone configuration. + */ + ret = t4_query_params(adap, adap->mbox, adap->pf, 0, 1, ¶m, &val); + if (ret < 0) { + CH_ERR(adap, "Querying FW using Ring backbone params command failed, err=%d\n", + ret); + goto out; + } + + if (val != 1) { + CH_ERR(adap, "FW doesnot support ringbackbone features\n"); + goto out; + } + + ret = t4_set_params(adap, adap->mbox, adap->pf, 0, 1, ¶m, &val); + if (ret < 0) { + CH_ERR(adap, "Could not set Ringbackbone, err= %d\n", + ret); + goto out; + } + +out: + return ret; +} + +/* + * t4_set_vlan_acl - Set a VLAN id for the specified VF + * @adapter: the adapter + * @mbox: mailbox to use for the FW command + * @vf: one of the VFs instantiated by the specified PF + * @vlan: The vlanid to be set + * + */ +int t4_set_vlan_acl(struct adapter *adap, unsigned int mbox, unsigned int vf, + u16 vlan) +{ + struct fw_acl_vlan_cmd vlan_cmd; + unsigned int enable; + + enable = (vlan ? F_FW_ACL_VLAN_CMD_EN : 0); + memset(&vlan_cmd, 0, sizeof(vlan_cmd)); + vlan_cmd.op_to_vfn = cpu_to_be32(V_FW_CMD_OP(FW_ACL_VLAN_CMD) | + F_FW_CMD_REQUEST | + F_FW_CMD_WRITE | + F_FW_CMD_EXEC | + V_FW_ACL_VLAN_CMD_PFN(adap->pf) | + V_FW_ACL_VLAN_CMD_VFN(vf)); + vlan_cmd.en_to_len16 = cpu_to_be32(enable | FW_LEN16(vlan_cmd)); + /* Drop all packets that donot match vlan id */ + vlan_cmd.dropnovlan_fm = (enable + ? (F_FW_ACL_VLAN_CMD_DROPNOVLAN | + F_FW_ACL_VLAN_CMD_FM) + : 0); + if (enable != 0) { + vlan_cmd.nvlan = 1; + vlan_cmd.vlanid[0] = cpu_to_be16(vlan); + } + + return t4_wr_mbox(adap, adap->mbox, &vlan_cmd, sizeof(vlan_cmd), NULL); +} + +/** + * t4_del_mac - Removes the exact-match filter for a MAC address + * @adap: the adapter + * @mbox: mailbox to use for the FW command + * @viid: the VI id + * @addr: the MAC address value + * @smac: if true, delete from only the smac region of MPS + * + * Modifies an exact-match filter and sets it to the new MAC address if + * @idx >= 0, or adds the MAC address to a new filter if @idx < 0. In the + * latter case the address is added persistently if @persist is %true. + * + * Returns a negative error number or the index of the filter with the new + * MAC value. Note that this index may differ from @idx. + */ +int t4_del_mac(struct adapter *adap, unsigned int mbox, unsigned int viid, + const u8 *addr, bool smac) +{ + int ret; + struct fw_vi_mac_cmd c; + struct fw_vi_mac_exact *p = c.u.exact; + unsigned int max_mac_addr = adap->chip_params->mps_tcam_size; + + memset(&c, 0, sizeof(c)); + c.op_to_viid = cpu_to_be32(V_FW_CMD_OP(FW_VI_MAC_CMD) | + F_FW_CMD_REQUEST | F_FW_CMD_WRITE | + V_FW_VI_MAC_CMD_VIID(viid)); + c.freemacs_to_len16 = cpu_to_be32( + V_FW_CMD_LEN16(1) | + (smac ? F_FW_VI_MAC_CMD_IS_SMAC : 0)); + + memcpy(p->macaddr, addr, sizeof(p->macaddr)); + p->valid_to_idx = cpu_to_be16( + F_FW_VI_MAC_CMD_VALID | + V_FW_VI_MAC_CMD_IDX(FW_VI_MAC_MAC_BASED_FREE)); + + ret = t4_wr_mbox(adap, mbox, &c, sizeof(c), &c); + if (ret == 0) { + ret = G_FW_VI_MAC_CMD_IDX(be16_to_cpu(p->valid_to_idx)); + if (ret < max_mac_addr) + return -ENOMEM; + } + + return ret; +} + +/** + * t4_add_mac - Adds an exact-match filter for a MAC address + * @adap: the adapter + * @mbox: mailbox to use for the FW command + * @viid: the VI id + * @idx: index of existing filter for old value of MAC address, or -1 + * @addr: the new MAC address value + * @persist: whether a new MAC allocation should be persistent + * @add_smt: if true also add the address to the HW SMT + * @smac: if true, update only the smac region of MPS + * + * Modifies an exact-match filter and sets it to the new MAC address if + * @idx >= 0, or adds the MAC address to a new filter if @idx < 0. In the + * latter case the address is added persistently if @persist is %true. + * + * Returns a negative error number or the index of the filter with the new + * MAC value. Note that this index may differ from @idx. + */ +int t4_add_mac(struct adapter *adap, unsigned int mbox, unsigned int viid, + int idx, const u8 *addr, bool persist, u8 *smt_idx, bool smac) +{ + int ret, mode; + struct fw_vi_mac_cmd c; + struct fw_vi_mac_exact *p = c.u.exact; + unsigned int max_mac_addr = adap->chip_params->mps_tcam_size; + + if (idx < 0) /* new allocation */ + idx = persist ? FW_VI_MAC_ADD_PERSIST_MAC : FW_VI_MAC_ADD_MAC; + mode = smt_idx ? FW_VI_MAC_SMT_AND_MPSTCAM : FW_VI_MAC_MPS_TCAM_ENTRY; + + memset(&c, 0, sizeof(c)); + c.op_to_viid = cpu_to_be32(V_FW_CMD_OP(FW_VI_MAC_CMD) | + F_FW_CMD_REQUEST | F_FW_CMD_WRITE | + V_FW_VI_MAC_CMD_VIID(viid)); + c.freemacs_to_len16 = cpu_to_be32( + V_FW_CMD_LEN16(1) | + (smac ? F_FW_VI_MAC_CMD_IS_SMAC : 0)); + p->valid_to_idx = cpu_to_be16(F_FW_VI_MAC_CMD_VALID | + V_FW_VI_MAC_CMD_SMAC_RESULT(mode) | + V_FW_VI_MAC_CMD_IDX(idx)); + memcpy(p->macaddr, addr, sizeof(p->macaddr)); + + ret = t4_wr_mbox(adap, mbox, &c, sizeof(c), &c); + if (ret == 0) { + ret = G_FW_VI_MAC_CMD_IDX(be16_to_cpu(p->valid_to_idx)); + if (ret >= max_mac_addr) + return -ENOMEM; + if (smt_idx) { + /* Does fw supports returning smt_idx? */ + if (adap->params.viid_smt_extn_support) + *smt_idx = G_FW_VI_MAC_CMD_SMTID(be32_to_cpu(c.op_to_viid)); + else { + /* In T4/T5, SMT contains 256 SMAC entries + * organized in 128 rows of 2 entries each. + * In T6, SMT contains 256 SMAC entries in + * 256 rows. + */ + if (chip_id(adap) <= CHELSIO_T5) + *smt_idx = ((viid & M_FW_VIID_VIN) << 1); + else + *smt_idx = (viid & M_FW_VIID_VIN); + } + } + } + + return ret; } Modified: stable/12/sys/dev/cxgbe/common/t4_hw.h ============================================================================== --- stable/12/sys/dev/cxgbe/common/t4_hw.h Tue Aug 25 18:16:40 2020 (r364775) +++ stable/12/sys/dev/cxgbe/common/t4_hw.h Tue Aug 25 18:21:13 2020 (r364776) @@ -43,6 +43,7 @@ enum { EEPROMVSIZE = 32768, /* Serial EEPROM virtual address space size */ EEPROMPFSIZE = 1024, /* EEPROM writable area size for PFn, n>0 */ RSS_NENTRIES = 2048, /* # of entries in RSS mapping table */ + T6_RSS_NENTRIES = 4096, TCB_SIZE = 128, /* TCB size */ NMTUS = 16, /* size of MTU table */ NCCTRL_WIN = 32, /* # of congestion control windows */ @@ -92,6 +93,7 @@ enum { SGE_CTXT_SIZE = 24, /* size of SGE context */ SGE_NTIMERS = 6, /* # of interrupt holdoff timer values */ SGE_NCOUNTERS = 4, /* # of interrupt packet counter values */ + SGE_NDBQTIMERS = 8, /* # of Doorbell Queue Timer values */ SGE_MAX_IQ_SIZE = 65520, SGE_FLBUF_SIZES = 16, }; @@ -298,5 +300,15 @@ enum { #define M_SGE_TIMESTAMP 0xfffffffffffffffULL #define V_SGE_TIMESTAMP(x) ((__u64)(x) << S_SGE_TIMESTAMP) #define G_SGE_TIMESTAMP(x) (((__u64)(x) >> S_SGE_TIMESTAMP) & M_SGE_TIMESTAMP) + +#define I2C_DEV_ADDR_A0 0xa0 +#define I2C_DEV_ADDR_A2 0xa2 +#define I2C_PAGE_SIZE 0x100 +#define SFP_DIAG_TYPE_ADDR 0x5c +#define SFP_DIAG_TYPE_LEN 0x1 +#define SFF_8472_COMP_ADDR 0x5e +#define SFF_8472_COMP_LEN 0x1 +#define SFF_REV_ADDR 0x1 +#define SFF_REV_LEN 0x1 #endif /* __T4_HW_H */ Modified: stable/12/sys/dev/cxgbe/cudbg/cudbg_lib.c ============================================================================== --- stable/12/sys/dev/cxgbe/cudbg/cudbg_lib.c Tue Aug 25 18:16:40 2020 (r364775) +++ stable/12/sys/dev/cxgbe/cudbg/cudbg_lib.c Tue Aug 25 18:21:13 2020 (r364776) @@ -576,7 +576,7 @@ static int collect_rss(struct cudbg_init *pdbg_init, u32 size; int rc = 0; - size = RSS_NENTRIES * sizeof(u16); + size = padap->chip_params->rss_nentries * sizeof(u16); rc = get_scratch_buff(dbg_buff, size, &scratch_buff); if (rc) goto err; From owner-svn-src-stable-12@freebsd.org Wed Aug 26 00:28:29 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 89FC43C24B9; Wed, 26 Aug 2020 00:28:29 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BbmtP32HRz4PKW; Wed, 26 Aug 2020 00:28:29 +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 4C1BDA26A; Wed, 26 Aug 2020 00:28:29 +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 07Q0STSp065952; Wed, 26 Aug 2020 00:28:29 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07Q0SSb1065949; Wed, 26 Aug 2020 00:28:28 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202008260028.07Q0SSb1065949@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 26 Aug 2020 00:28:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364789 - in stable/12/sys: amd64/acpica arm64/acpica i386/acpica X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12/sys: amd64/acpica arm64/acpica i386/acpica X-SVN-Commit-Revision: 364789 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2020 00:28:29 -0000 Author: mav Date: Wed Aug 26 00:28:28 2020 New Revision: 364789 URL: https://svnweb.freebsd.org/changeset/base/364789 Log: MFC r364399: Remove some noisy ACPI tables messages from verbose dmesg. Those messages were printed hundreds of times during boot, often multiple times for each table. We already print information about the tables in more organized form once to not duplicate it when random ACPI drivers are attaching. Modified: stable/12/sys/amd64/acpica/acpi_machdep.c stable/12/sys/arm64/acpica/acpi_machdep.c stable/12/sys/i386/acpica/acpi_machdep.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/acpica/acpi_machdep.c ============================================================================== --- stable/12/sys/amd64/acpica/acpi_machdep.c Tue Aug 25 23:35:55 2020 (r364788) +++ stable/12/sys/amd64/acpica/acpi_machdep.c Wed Aug 26 00:28:28 2020 (r364789) @@ -132,9 +132,6 @@ probe_table(vm_paddr_t address, const char *sig) table = pmap_mapbios(address, sizeof(ACPI_TABLE_HEADER)); ret = strncmp(table->Signature, sig, ACPI_NAMESEG_SIZE) == 0; - if (bootverbose) - printf("Table '%.4s' at 0x%jx\n", table->Signature, - (uintmax_t)address); pmap_unmapbios((vm_offset_t)table, sizeof(ACPI_TABLE_HEADER)); return (ret); } @@ -239,13 +236,8 @@ acpi_find_table(const char *sig) acpi_unmap_table(rsdt); } pmap_unmapbios((vm_offset_t)rsdp, sizeof(ACPI_TABLE_RSDP)); - if (addr == 0) { - if (bootverbose) - printf("ACPI: No %s table found\n", sig); + if (addr == 0) return (0); - } - if (bootverbose) - printf("%s: Found table at 0x%jx\n", sig, (uintmax_t)addr); /* * Verify that we can map the full table and that its checksum is Modified: stable/12/sys/arm64/acpica/acpi_machdep.c ============================================================================== --- stable/12/sys/arm64/acpica/acpi_machdep.c Tue Aug 25 23:35:55 2020 (r364788) +++ stable/12/sys/arm64/acpica/acpi_machdep.c Wed Aug 26 00:28:28 2020 (r364789) @@ -103,9 +103,6 @@ probe_table(vm_paddr_t address, const char *sig) (uintmax_t)address); return (0); } - if (bootverbose) - printf("Table '%.4s' at 0x%jx\n", table->Signature, - (uintmax_t)address); if (strncmp(table->Signature, sig, ACPI_NAMESEG_SIZE) != 0) { pmap_unmapbios((vm_offset_t)table, sizeof(ACPI_TABLE_HEADER)); @@ -198,13 +195,8 @@ acpi_find_table(const char *sig) } pmap_unmapbios((vm_offset_t)rsdp, sizeof(ACPI_TABLE_RSDP)); - if (addr == 0) { - if (bootverbose) - printf("ACPI: No %s table found\n", sig); + if (addr == 0) return (0); - } - if (bootverbose) - printf("%s: Found table at 0x%jx\n", sig, (uintmax_t)addr); /* * Verify that we can map the full table and that its checksum is Modified: stable/12/sys/i386/acpica/acpi_machdep.c ============================================================================== --- stable/12/sys/i386/acpica/acpi_machdep.c Tue Aug 25 23:35:55 2020 (r364788) +++ stable/12/sys/i386/acpica/acpi_machdep.c Wed Aug 26 00:28:28 2020 (r364789) @@ -149,9 +149,6 @@ probe_table(vm_paddr_t address, const char *sig) int ret; table = pmap_mapbios(address, sizeof(ACPI_TABLE_HEADER)); - if (bootverbose) - printf("Table '%.4s' at 0x%jx\n", table->Signature, - (uintmax_t)address); ret = strncmp(table->Signature, sig, ACPI_NAMESEG_SIZE) == 0; pmap_unmapbios((vm_offset_t)table, sizeof(ACPI_TABLE_HEADER)); return (ret); @@ -257,13 +254,8 @@ acpi_find_table(const char *sig) acpi_unmap_table(rsdt); } pmap_unmapbios((vm_offset_t)rsdp, sizeof(ACPI_TABLE_RSDP)); - if (addr == 0) { - if (bootverbose) - printf("ACPI: No %s table found\n", sig); + if (addr == 0) return (0); - } - if (bootverbose) - printf("%s: Found table at 0x%jx\n", sig, (uintmax_t)addr); /* * Verify that we can map the full table and that its checksum is From owner-svn-src-stable-12@freebsd.org Wed Aug 26 00:50:29 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1788D3C3C37; Wed, 26 Aug 2020 00:50: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BbnMm5yxJz4QtH; Wed, 26 Aug 2020 00:50: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 B1271A8FD; Wed, 26 Aug 2020 00:50: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 07Q0oS4c078320; Wed, 26 Aug 2020 00:50:28 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07Q0oShb078319; Wed, 26 Aug 2020 00:50:28 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202008260050.07Q0oShb078319@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 26 Aug 2020 00:50:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364792 - in stable: 11/secure/caroot/blacklisted 11/secure/caroot/trusted 12/secure/caroot/blacklisted 12/secure/caroot/trusted X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/secure/caroot/blacklisted 11/secure/caroot/trusted 12/secure/caroot/blacklisted 12/secure/caroot/trusted X-SVN-Commit-Revision: 364792 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2020 00:50:29 -0000 Author: kevans Date: Wed Aug 26 00:50:27 2020 New Revision: 364792 URL: https://svnweb.freebsd.org/changeset/base/364792 Log: MFC r364600: caroot: switch to using echo+shell glob to enumerate certs This solves an issue on stable/12 that causes certs to not get installed. ls is apparently not in PATH during installworld, so TRUSTED_CERTS ends up blank and nothing gets installed. We don't really require anything ls-specific, though, so let's just simplify it. Modified: stable/12/secure/caroot/blacklisted/Makefile stable/12/secure/caroot/trusted/Makefile Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/secure/caroot/blacklisted/Makefile stable/11/secure/caroot/trusted/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/12/secure/caroot/blacklisted/Makefile ============================================================================== --- stable/12/secure/caroot/blacklisted/Makefile Wed Aug 26 00:42:59 2020 (r364791) +++ stable/12/secure/caroot/blacklisted/Makefile Wed Aug 26 00:50:27 2020 (r364792) @@ -2,7 +2,7 @@ BINDIR= /usr/share/certs/blacklisted -BLACKLISTED_CERTS!= ls ${.CURDIR}/*.pem 2> /dev/null || true +BLACKLISTED_CERTS!= echo ${.CURDIR}/*.pem 2> /dev/null || true FILES+= ${BLACKLISTED_CERTS} Modified: stable/12/secure/caroot/trusted/Makefile ============================================================================== --- stable/12/secure/caroot/trusted/Makefile Wed Aug 26 00:42:59 2020 (r364791) +++ stable/12/secure/caroot/trusted/Makefile Wed Aug 26 00:50:27 2020 (r364792) @@ -2,7 +2,7 @@ BINDIR= /usr/share/certs/trusted -TRUSTED_CERTS!= ls ${.CURDIR}/*.pem 2> /dev/null || true +TRUSTED_CERTS!= echo ${.CURDIR}/*.pem 2> /dev/null || true FILES+= ${TRUSTED_CERTS} From owner-svn-src-stable-12@freebsd.org Wed Aug 26 17:15:18 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 41E4E3B3BB7; Wed, 26 Aug 2020 17:15:18 +0000 (UTC) (envelope-from grembo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BcCD610qlz4L1f; Wed, 26 Aug 2020 17:15:18 +0000 (UTC) (envelope-from grembo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 071F11664F; Wed, 26 Aug 2020 17:15:18 +0000 (UTC) (envelope-from grembo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07QHFH7k012033; Wed, 26 Aug 2020 17:15:17 GMT (envelope-from grembo@FreeBSD.org) Received: (from grembo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07QHFHG9012032; Wed, 26 Aug 2020 17:15:17 GMT (envelope-from grembo@FreeBSD.org) Message-Id: <202008261715.07QHFHG9012032@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grembo set sender to grembo@FreeBSD.org using -f From: Michael Gmelin Date: Wed, 26 Aug 2020 17:15:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364826 - stable/12/usr.sbin/freebsd-update X-SVN-Group: stable-12 X-SVN-Commit-Author: grembo X-SVN-Commit-Paths: stable/12/usr.sbin/freebsd-update X-SVN-Commit-Revision: 364826 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2020 17:15:18 -0000 Author: grembo (ports committer) Date: Wed Aug 26 17:15:17 2020 New Revision: 364826 URL: https://svnweb.freebsd.org/changeset/base/364826 Log: MFC r364396: Unbreak `freebsd-update updatesready'. The command would only work if PWD happened to be WORKDIR. Also, exit 1 in case WORKDIR exists, but isn't accessible by the current user. PR: 242709 Reported by: Max Fiedler Modified: stable/12/usr.sbin/freebsd-update/freebsd-update.sh Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/freebsd-update/freebsd-update.sh ============================================================================== --- stable/12/usr.sbin/freebsd-update/freebsd-update.sh Wed Aug 26 17:14:16 2020 (r364825) +++ stable/12/usr.sbin/freebsd-update/freebsd-update.sh Wed Aug 26 17:15:17 2020 (r364826) @@ -3341,8 +3341,18 @@ cmd_upgrade () { upgrade_run || exit 1 } -# Check if there are fetched updates ready to install +# Check if there are fetched updates ready to install. +# Chdir into the working directory. cmd_updatesready () { + # Check if working directory exists (if not, no updates pending) + if ! [ -e "${WORKDIR}" ]; then + echo "No updates are available to install." + exit 2 + fi + + # Change into working directory (fail if no permission/directory etc.) + cd ${WORKDIR} || exit 1 + # Construct a unique name from ${BASEDIR} BDHASH=`echo ${BASEDIR} | sha256 -q` From owner-svn-src-stable-12@freebsd.org Wed Aug 26 21:19:06 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2CF863BD102; Wed, 26 Aug 2020 21:19:06 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BcJdQ0ShTz4gGG; Wed, 26 Aug 2020 21:19:06 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E760C19524; Wed, 26 Aug 2020 21:19:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07QLJ5Ja075198; Wed, 26 Aug 2020 21:19:05 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07QLJ5Xo075197; Wed, 26 Aug 2020 21:19:05 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202008262119.07QLJ5Xo075197@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 26 Aug 2020 21:19:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364839 - in stable: 11/tools/build/mk 12/tools/build/mk X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/tools/build/mk 12/tools/build/mk X-SVN-Commit-Revision: 364839 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2020 21:19:06 -0000 Author: jhb Date: Wed Aug 26 21:19:05 2020 New Revision: 364839 URL: https://svnweb.freebsd.org/changeset/base/364839 Log: MFC 361093: Don't remove ubsec(4) manual page for WITHOUT_USB=yes. In head this manpage has been removed entirely, but ubsec(4) is a PCI device and not a USB device. Modified: stable/12/tools/build/mk/OptionalObsoleteFiles.inc Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/tools/build/mk/OptionalObsoleteFiles.inc Directory Properties: stable/11/ (props changed) Modified: stable/12/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- stable/12/tools/build/mk/OptionalObsoleteFiles.inc Wed Aug 26 21:17:18 2020 (r364838) +++ stable/12/tools/build/mk/OptionalObsoleteFiles.inc Wed Aug 26 21:19:05 2020 (r364839) @@ -9892,7 +9892,6 @@ OLD_FILES+=usr/share/man/man4/uark.4.gz OLD_FILES+=usr/share/man/man4/uart.4.gz OLD_FILES+=usr/share/man/man4/uath.4.gz OLD_FILES+=usr/share/man/man4/ubsa.4.gz -OLD_FILES+=usr/share/man/man4/ubsec.4.gz OLD_FILES+=usr/share/man/man4/ubser.4.gz OLD_FILES+=usr/share/man/man4/ubtbcmfw.4.gz OLD_FILES+=usr/share/man/man4/uchcom.4.gz From owner-svn-src-stable-12@freebsd.org Wed Aug 26 21:30:00 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 551273BD354; Wed, 26 Aug 2020 21:30:00 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BcJt018Z9z3SCG; Wed, 26 Aug 2020 21:30:00 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0B3C0196CF; Wed, 26 Aug 2020 21:30:00 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07QLTxcn082876; Wed, 26 Aug 2020 21:29:59 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07QLTxAs082875; Wed, 26 Aug 2020 21:29:59 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202008262129.07QLTxAs082875@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 26 Aug 2020 21:29:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364841 - in stable: 11/tools/build/mk 12/tools/build/mk X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/tools/build/mk 12/tools/build/mk X-SVN-Commit-Revision: 364841 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2020 21:30:00 -0000 Author: jhb Date: Wed Aug 26 21:29:59 2020 New Revision: 364841 URL: https://svnweb.freebsd.org/changeset/base/364841 Log: MFC 359050: Add missing DTrace files for WITHOUT_CDDL=yes. Modified: stable/12/tools/build/mk/OptionalObsoleteFiles.inc Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/tools/build/mk/OptionalObsoleteFiles.inc Directory Properties: stable/11/ (props changed) Modified: stable/12/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- stable/12/tools/build/mk/OptionalObsoleteFiles.inc Wed Aug 26 21:28:47 2020 (r364840) +++ stable/12/tools/build/mk/OptionalObsoleteFiles.inc Wed Aug 26 21:29:59 2020 (r364841) @@ -1162,13 +1162,18 @@ OLD_FILES+=usr/lib/dtrace/drti.o OLD_FILES+=usr/lib/dtrace/errno.d OLD_FILES+=usr/lib/dtrace/io.d OLD_FILES+=usr/lib/dtrace/ip.d +OLD_FILES+=usr/lib/dtrace/mbuf.d OLD_FILES+=usr/lib/dtrace/psinfo.d .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386" OLD_FILES+=usr/lib/dtrace/regs_x86.d .endif +OLD_FILES+=usr/lib/dtrace/sctp.d +OLD_FILES+=usr/lib/dtrace/siftr.d OLD_FILES+=usr/lib/dtrace/signal.d +OLD_FILES+=usr/lib/dtrace/socket.d OLD_FILES+=usr/lib/dtrace/tcp.d OLD_FILES+=usr/lib/dtrace/udp.d +OLD_FILES+=usr/lib/dtrace/udplite.d OLD_FILES+=usr/lib/dtrace/unistd.d OLD_FILES+=usr/lib/libavl.a OLD_FILES+=usr/lib/libavl.so @@ -1216,29 +1221,120 @@ OLD_LIBS+=usr/lib32/libuutil.so.2 OLD_FILES+=usr/lib32/libuutil_p.a .endif OLD_LIBS+=lib/libdtrace.so.2 +OLD_FILES+=usr/libexec/dwatch/chmod +OLD_FILES+=usr/libexec/dwatch/errno +OLD_FILES+=usr/libexec/dwatch/fchmodat +OLD_FILES+=usr/libexec/dwatch/io +OLD_FILES+=usr/libexec/dwatch/io-done +OLD_FILES+=usr/libexec/dwatch/io-start +OLD_FILES+=usr/libexec/dwatch/ip +OLD_FILES+=usr/libexec/dwatch/ip-receive +OLD_FILES+=usr/libexec/dwatch/ip-send +OLD_FILES+=usr/libexec/dwatch/kill +OLD_FILES+=usr/libexec/dwatch/lchmod +OLD_FILES+=usr/libexec/dwatch/nanosleep +OLD_FILES+=usr/libexec/dwatch/open +OLD_FILES+=usr/libexec/dwatch/openat +OLD_FILES+=usr/libexec/dwatch/proc +OLD_FILES+=usr/libexec/dwatch/proc-create +OLD_FILES+=usr/libexec/dwatch/proc-exec +OLD_FILES+=usr/libexec/dwatch/proc-exec-failure +OLD_FILES+=usr/libexec/dwatch/proc-exec-success +OLD_FILES+=usr/libexec/dwatch/proc-exit +OLD_FILES+=usr/libexec/dwatch/proc-signal +OLD_FILES+=usr/libexec/dwatch/proc-signal-clear +OLD_FILES+=usr/libexec/dwatch/proc-signal-discard +OLD_FILES+=usr/libexec/dwatch/proc-signal-send +OLD_FILES+=usr/libexec/dwatch/proc-status +OLD_FILES+=usr/libexec/dwatch/read +OLD_FILES+=usr/libexec/dwatch/recv +OLD_FILES+=usr/libexec/dwatch/recvfrom +OLD_FILES+=usr/libexec/dwatch/recvmsg +OLD_FILES+=usr/libexec/dwatch/rw +OLD_FILES+=usr/libexec/dwatch/sched +OLD_FILES+=usr/libexec/dwatch/sched-change-pri +OLD_FILES+=usr/libexec/dwatch/sched-cpu +OLD_FILES+=usr/libexec/dwatch/sched-dequeue +OLD_FILES+=usr/libexec/dwatch/sched-enqueue +OLD_FILES+=usr/libexec/dwatch/sched-exec +OLD_FILES+=usr/libexec/dwatch/sched-lend-pri +OLD_FILES+=usr/libexec/dwatch/sched-load-change +OLD_FILES+=usr/libexec/dwatch/sched-off-cpu +OLD_FILES+=usr/libexec/dwatch/sched-on-cpu +OLD_FILES+=usr/libexec/dwatch/sched-preempt +OLD_FILES+=usr/libexec/dwatch/sched-pri +OLD_FILES+=usr/libexec/dwatch/sched-queue +OLD_FILES+=usr/libexec/dwatch/sched-remain-cpu +OLD_FILES+=usr/libexec/dwatch/sched-sleep +OLD_FILES+=usr/libexec/dwatch/sched-surrender +OLD_FILES+=usr/libexec/dwatch/sched-tick +OLD_FILES+=usr/libexec/dwatch/sched-wakeup +OLD_FILES+=usr/libexec/dwatch/send +OLD_FILES+=usr/libexec/dwatch/sendmsg +OLD_FILES+=usr/libexec/dwatch/sendrecv +OLD_FILES+=usr/libexec/dwatch/sendto +OLD_FILES+=usr/libexec/dwatch/systop +OLD_FILES+=usr/libexec/dwatch/tcp +OLD_FILES+=usr/libexec/dwatch/tcp-accept +OLD_FILES+=usr/libexec/dwatch/tcp-accept-established +OLD_FILES+=usr/libexec/dwatch/tcp-accept-refused +OLD_FILES+=usr/libexec/dwatch/tcp-connect +OLD_FILES+=usr/libexec/dwatch/tcp-connect-established +OLD_FILES+=usr/libexec/dwatch/tcp-connect-refused +OLD_FILES+=usr/libexec/dwatch/tcp-connect-request +OLD_FILES+=usr/libexec/dwatch/tcp-established +OLD_FILES+=usr/libexec/dwatch/tcp-init +OLD_FILES+=usr/libexec/dwatch/tcp-io +OLD_FILES+=usr/libexec/dwatch/tcp-receive +OLD_FILES+=usr/libexec/dwatch/tcp-refused +OLD_FILES+=usr/libexec/dwatch/tcp-send +OLD_FILES+=usr/libexec/dwatch/tcp-state-change +OLD_FILES+=usr/libexec/dwatch/tcp-status +OLD_FILES+=usr/libexec/dwatch/udp +OLD_FILES+=usr/libexec/dwatch/udp-receive +OLD_FILES+=usr/libexec/dwatch/udp-send +OLD_FILES+=usr/libexec/dwatch/udplite +OLD_FILES+=usr/libexec/dwatch/udplite-receive +OLD_FILES+=usr/libexec/dwatch/udplite-send +OLD_FILES+=usr/libexec/dwatch/vop_create +OLD_FILES+=usr/libexec/dwatch/vop_lookup +OLD_FILES+=usr/libexec/dwatch/vop_mkdir +OLD_FILES+=usr/libexec/dwatch/vop_mknod +OLD_FILES+=usr/libexec/dwatch/vop_readdir +OLD_FILES+=usr/libexec/dwatch/vop_remove +OLD_FILES+=usr/libexec/dwatch/vop_rename +OLD_FILES+=usr/libexec/dwatch/vop_rmdir +OLD_FILES+=usr/libexec/dwatch/vop_symlink +OLD_FILES+=usr/libexec/dwatch/write OLD_FILES+=usr/sbin/dtrace +OLD_FILES+=usr/sbin/dwatch OLD_FILES+=usr/sbin/lockstat OLD_FILES+=usr/sbin/plockstat OLD_FILES+=usr/share/man/man1/dtrace.1.gz OLD_FILES+=usr/share/man/man1/dtruss.1.gz OLD_FILES+=usr/share/man/man1/lockstat.1.gz OLD_FILES+=usr/share/man/man1/plockstat.1.gz +OLD_FILES+=usr/share/dtrace/blocking OLD_FILES+=usr/share/dtrace/disklatency OLD_FILES+=usr/share/dtrace/disklatencycmd OLD_FILES+=usr/share/dtrace/hotopen +OLD_FILES+=usr/share/dtrace/nfsattrstats OLD_FILES+=usr/share/dtrace/nfsclienttime +OLD_FILES+=usr/share/dtrace/siftr OLD_FILES+=usr/share/dtrace/toolkit/execsnoop OLD_FILES+=usr/share/dtrace/toolkit/hotkernel OLD_FILES+=usr/share/dtrace/toolkit/hotuser OLD_FILES+=usr/share/dtrace/toolkit/opensnoop OLD_FILES+=usr/share/dtrace/toolkit/procsystime OLD_FILES+=usr/share/dtrace/tcpconn +OLD_FILES+=usr/share/dtrace/tcpdebug OLD_FILES+=usr/share/dtrace/tcpstate OLD_FILES+=usr/share/dtrace/tcptrack OLD_FILES+=usr/share/dtrace/udptrack OLD_FILES+=usr/share/man/man1/dtrace.1.gz OLD_DIRS+=usr/lib/dtrace OLD_DIRS+=usr/lib32/dtrace +OLD_DIRS+=usr/libexec/dwatch OLD_DIRS+=usr/share/dtrace/toolkit OLD_DIRS+=usr/share/dtrace .endif From owner-svn-src-stable-12@freebsd.org Wed Aug 26 21:35:29 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 28B0B3BCB7E; Wed, 26 Aug 2020 21:35:29 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BcK0J73Xbz3SZZ; Wed, 26 Aug 2020 21:35:28 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D6C6D198A7; Wed, 26 Aug 2020 21:35:28 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07QLZSaa089206; Wed, 26 Aug 2020 21:35:28 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07QLZSvY089205; Wed, 26 Aug 2020 21:35:28 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202008262135.07QLZSvY089205@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 26 Aug 2020 21:35:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364842 - in stable: 11/sys/opencrypto 12/sys/opencrypto X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/sys/opencrypto 12/sys/opencrypto X-SVN-Commit-Revision: 364842 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2020 21:35:29 -0000 Author: jhb Date: Wed Aug 26 21:35:28 2020 New Revision: 364842 URL: https://svnweb.freebsd.org/changeset/base/364842 Log: MFC 361393: Correct the minimum key length for Camellia to 16 bytes (128 bits). Modified: stable/12/sys/opencrypto/cryptodev.h Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/opencrypto/cryptodev.h Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/opencrypto/cryptodev.h ============================================================================== --- stable/12/sys/opencrypto/cryptodev.h Wed Aug 26 21:29:59 2020 (r364841) +++ stable/12/sys/opencrypto/cryptodev.h Wed Aug 26 21:35:28 2020 (r364842) @@ -158,7 +158,7 @@ #define AES_XTS_MAX_KEY (2 * AES_MAX_KEY) #define ARC4_MIN_KEY 1 #define ARC4_MAX_KEY 32 -#define CAMELLIA_MIN_KEY 8 +#define CAMELLIA_MIN_KEY 16 #define CAMELLIA_MAX_KEY 32 /* Maximum hash algorithm result length */ From owner-svn-src-stable-12@freebsd.org Wed Aug 26 21:41:15 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 27BC43BDC2D; Wed, 26 Aug 2020 21:41:15 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BcK6z0CqVz3TCM; Wed, 26 Aug 2020 21:41:15 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DEFCE199E1; Wed, 26 Aug 2020 21:41:14 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07QLfEIq090157; Wed, 26 Aug 2020 21:41:14 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07QLfEsr090156; Wed, 26 Aug 2020 21:41:14 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202008262141.07QLfEsr090156@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 26 Aug 2020 21:41:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364843 - in stable: 11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 364843 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2020 21:41:15 -0000 Author: jhb Date: Wed Aug 26 21:41:14 2020 New Revision: 364843 URL: https://svnweb.freebsd.org/changeset/base/364843 Log: MFC 361220: Correct the order of arguments to copyin() for Q_SETQUOTA. Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Wed Aug 26 21:35:28 2020 (r364842) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Wed Aug 26 21:41:14 2020 (r364843) @@ -268,7 +268,7 @@ zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *ar vfs_unbusy(vfsp); break; case Q_SETQUOTA: - error = copyin(&dqblk, arg, sizeof(dqblk)); + error = copyin(arg, &dqblk, sizeof(dqblk)); if (error == 0) error = zfs_set_userquota(zfsvfs, quota_type, "", id, dbtob(dqblk.dqb_bhardlimit)); From owner-svn-src-stable-12@freebsd.org Wed Aug 26 22:11:23 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 736993BE873; Wed, 26 Aug 2020 22:11:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BcKnl2LzBz3W0k; Wed, 26 Aug 2020 22:11:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 34AC21A153; Wed, 26 Aug 2020 22:11:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07QMBN1k013509; Wed, 26 Aug 2020 22:11:23 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07QMBNq4013508; Wed, 26 Aug 2020 22:11:23 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202008262211.07QMBNq4013508@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 26 Aug 2020 22:11:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364845 - stable/12/sys/dev/cxgbe/crypto X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/12/sys/dev/cxgbe/crypto X-SVN-Commit-Revision: 364845 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2020 22:11:23 -0000 Author: jhb Date: Wed Aug 26 22:11:22 2020 New Revision: 364845 URL: https://svnweb.freebsd.org/changeset/base/364845 Log: MFC 361776: Explicitly zero AES key schedules on the stack. Modified: stable/12/sys/dev/cxgbe/crypto/t4_keyctx.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/cxgbe/crypto/t4_keyctx.c ============================================================================== --- stable/12/sys/dev/cxgbe/crypto/t4_keyctx.c Wed Aug 26 21:49:43 2020 (r364844) +++ stable/12/sys/dev/cxgbe/crypto/t4_keyctx.c Wed Aug 26 22:11:22 2020 (r364845) @@ -75,6 +75,7 @@ t4_init_gmac_hash(const char *key, int klen, char *gha rounds = rijndaelKeySetupEnc(keysched, key, klen); rijndaelEncrypt(keysched, rounds, zeroes, ghash); + explicit_bzero(keysched, sizeof(keysched)); } /* Copy out the partial hash state from a software hash implementation. */ @@ -195,4 +196,5 @@ t4_aes_getdeckey(void *dec_key, const void *enc_key, u break; } MPASS(dkey == dec_key); + explicit_bzero(ek, sizeof(ek)); } From owner-svn-src-stable-12@freebsd.org Wed Aug 26 22:52:08 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9646B3BFCC1; Wed, 26 Aug 2020 22:52:08 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BcLhm3Q3nz3YYX; Wed, 26 Aug 2020 22:52:08 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 59CCE1A81C; Wed, 26 Aug 2020 22:52:08 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07QMq8Ev042186; Wed, 26 Aug 2020 22:52:08 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07QMq8BK042185; Wed, 26 Aug 2020 22:52:08 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202008262252.07QMq8BK042185@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 26 Aug 2020 22:52:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364847 - in stable: 11/lib/libc/sys 12/lib/libc/sys X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/lib/libc/sys 12/lib/libc/sys X-SVN-Commit-Revision: 364847 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2020 22:52:08 -0000 Author: jhb Date: Wed Aug 26 22:52:07 2020 New Revision: 364847 URL: https://svnweb.freebsd.org/changeset/base/364847 Log: MFC 361767: Document SO_NO_OFFLOADS and SO_NO_DDP. Modified: stable/12/lib/libc/sys/getsockopt.2 Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/lib/libc/sys/getsockopt.2 Directory Properties: stable/11/ (props changed) Modified: stable/12/lib/libc/sys/getsockopt.2 ============================================================================== --- stable/12/lib/libc/sys/getsockopt.2 Wed Aug 26 22:36:08 2020 (r364846) +++ stable/12/lib/libc/sys/getsockopt.2 Wed Aug 26 22:52:07 2020 (r364847) @@ -28,7 +28,7 @@ .\" @(#)getsockopt.2 8.4 (Berkeley) 5/2/95 .\" $FreeBSD$ .\" -.Dd September 11, 2019 +.Dd June 03, 2020 .Dt GETSOCKOPT 2 .Os .Sh NAME @@ -191,6 +191,8 @@ The following options are recognized in .It Dv SO_USER_COOKIE Ta "set the 'so_user_cookie' value for the socket (uint32_t, set only)" .It Dv SO_TS_CLOCK Ta "set specific format of timestamp returned by SO_TIMESTAMP" .It Dv SO_MAX_PACING_RATE Ta "set the maximum transmit rate in bytes per second for the socket" +.It Dv SO_NO_OFFLOAD Ta "disables protocol offloads" +.It Dv SO_NO_DDP Ta "disables direct data placement offload" .El .Pp .Dv SO_DEBUG @@ -512,7 +514,6 @@ the error status. It may be used to check for asynchronous errors on connected datagram sockets or for other asynchronous errors. .Pp -Finally, .Dv SO_LABEL returns the MAC label of the socket. .Dv SO_PEERLABEL @@ -521,6 +522,7 @@ Note that your kernel must be compiled with MAC suppor See .Xr mac 3 for more information. +.Pp .Dv SO_LISTENQLIMIT returns the maximal number of queued connections, as set by .Xr listen 2 . @@ -532,6 +534,17 @@ returns the number of unaccepted incomplete connection .Dv SO_MAX_PACING_RATE instruct the socket and underlying network adapter layers to limit the transfer rate to the given unsigned 32-bit value in bytes per second. +.Pp +.Dv SO_NO_OFFLOAD +disables support for protocol offloads. +At present, this prevents TCP sockets from using TCP offload engines. +.Dv SO_NO_DDP +disables support for a specific TCP offload known as direct data +placement (DDP). +DDP is an offload supported by Chelsio network adapters that permits +reassembled TCP data streams to be received via zero-copy in +user-supplied buffers using +.Xr aio_read 2 . .Sh RETURN VALUES .Rv -std .Sh ERRORS From owner-svn-src-stable-12@freebsd.org Wed Aug 26 23:21:28 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0B8033C08E0; Wed, 26 Aug 2020 23:21:28 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BcMLb6tTYz3Zgn; Wed, 26 Aug 2020 23:21:27 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CED9C1AD87; Wed, 26 Aug 2020 23:21:27 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07QNLR5m056562; Wed, 26 Aug 2020 23:21:27 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07QNLQMa056553; Wed, 26 Aug 2020 23:21:26 GMT (envelope-from np@FreeBSD.org) Message-Id: <202008262321.07QNLQMa056553@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Wed, 26 Aug 2020 23:21:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364848 - in stable/12/sys/dev/cxgbe: . common X-SVN-Group: stable-12 X-SVN-Commit-Author: np X-SVN-Commit-Paths: in stable/12/sys/dev/cxgbe: . common X-SVN-Commit-Revision: 364848 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2020 23:21:28 -0000 Author: np Date: Wed Aug 26 23:21:26 2020 New Revision: 364848 URL: https://svnweb.freebsd.org/changeset/base/364848 Log: MFC r340023 (by jhb@), r362905, r362938, and r363167. r340023: Check cannot_use_txpkts() rather than needs_tso() in add_to_txpkts(). Currently this is a no-op, but will matter in the future when cannot_use_txpkts() starts checking other conditions than just needs_tso(). r362905: cxgbe(4): changes in the Tx path to help increase tx coalescing. - Ask the firmware for the number of frames that can be stuffed in one work request. - Modify mp_ring to increase the likelihood of tx coalescing when there are just one or two threads that are doing most of the tx. Add teeth to the abdication mechanism by pushing the consumer lock into mp_ring. This reduces the likelihood that a consumer will get stuck with all the work even though it is above its budget. - Add support for coalesced tx WR to the VF driver. This, with the changes above, results in a 7x improvement in the tx pps of the VF driver for some common cases. The firmware vets the L2 headers submitted by the VF driver and it's a big win if the checks are performed for a batch of packets and not each one individually. r362938: cxgbe(4): Fix a bug (introduced in r362905) where some tx traffic wasn't being reported to BPF. r363167: cxgbev(4): Compare at most 16 bytes of the Ethernet header when trying to coalesce tx work requests. Note that Coverity will still treat this as an out-of-bounds access. We do want to compare 16B starting from ethmacdst but cmp_l2hdr was was going beyond that by 2B. cmp_l2hdr was introduced in r362905. Sponsored by: Chelsio Communications Modified: stable/12/sys/dev/cxgbe/adapter.h stable/12/sys/dev/cxgbe/common/common.h stable/12/sys/dev/cxgbe/t4_main.c stable/12/sys/dev/cxgbe/t4_mp_ring.c stable/12/sys/dev/cxgbe/t4_mp_ring.h stable/12/sys/dev/cxgbe/t4_sge.c stable/12/sys/dev/cxgbe/t4_vf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/cxgbe/adapter.h ============================================================================== --- stable/12/sys/dev/cxgbe/adapter.h Wed Aug 26 22:52:07 2020 (r364847) +++ stable/12/sys/dev/cxgbe/adapter.h Wed Aug 26 23:21:26 2020 (r364848) @@ -546,6 +546,23 @@ struct sge_fl { struct mp_ring; +struct txpkts { + uint8_t wr_type; /* type 0 or type 1 */ + uint8_t npkt; /* # of packets in this work request */ + uint8_t len16; /* # of 16B pieces used by this work request */ + uint8_t score; /* 1-10. coalescing attempted if score > 3 */ + uint8_t max_npkt; /* maximum number of packets allowed */ + uint16_t plen; /* total payload (sum of all packets) */ + + /* straight from fw_eth_tx_pkts_vm_wr. */ + __u8 ethmacdst[6]; + __u8 ethmacsrc[6]; + __be16 ethtype; + __be16 vlantci; + + struct mbuf *mb[15]; +}; + /* txq: SGE egress queue + what's needed for Ethernet NIC */ struct sge_txq { struct sge_eq eq; /* MUST be first */ @@ -556,6 +573,7 @@ struct sge_txq { struct sglist *gl; __be32 cpl_ctrl0; /* for convenience */ int tc_idx; /* traffic class */ + struct txpkts txp; struct task tx_reclaim_task; /* stats for common events first */ Modified: stable/12/sys/dev/cxgbe/common/common.h ============================================================================== --- stable/12/sys/dev/cxgbe/common/common.h Wed Aug 26 22:52:07 2020 (r364847) +++ stable/12/sys/dev/cxgbe/common/common.h Wed Aug 26 23:21:26 2020 (r364848) @@ -393,6 +393,7 @@ struct adapter_params { bool ulptx_memwrite_dsgl; /* use of T5 DSGL allowed */ bool fr_nsmr_tpte_wr_support; /* FW support for FR_NSMR_TPTE_WR */ bool viid_smt_extn_support; /* FW returns vin, vfvld & smt index? */ + unsigned int max_pkts_per_eth_tx_pkts_wr; }; #define CHELSIO_T4 0x4 Modified: stable/12/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/12/sys/dev/cxgbe/t4_main.c Wed Aug 26 22:52:07 2020 (r364847) +++ stable/12/sys/dev/cxgbe/t4_main.c Wed Aug 26 23:21:26 2020 (r364848) @@ -2107,7 +2107,7 @@ cxgbe_transmit(struct ifnet *ifp, struct mbuf *m) vi->rsrv_noflowq); items[0] = m; - rc = mp_ring_enqueue(txq->r, items, 1, 4096); + rc = mp_ring_enqueue(txq->r, items, 1, 256); if (__predict_false(rc != 0)) m_freem(m); @@ -2128,7 +2128,7 @@ cxgbe_qflush(struct ifnet *ifp) txq->eq.flags |= EQ_QFLUSH; TXQ_UNLOCK(txq); while (!mp_ring_is_idle(txq->r)) { - mp_ring_check_drainage(txq->r, 0); + mp_ring_check_drainage(txq->r, 4096); pause("qflush", 1); } TXQ_LOCK(txq); @@ -2177,7 +2177,7 @@ vi_get_counter(struct ifnet *ifp, ift_counter c) struct sge_txq *txq; for_each_txq(vi, i, txq) - drops += counter_u64_fetch(txq->r->drops); + drops += counter_u64_fetch(txq->r->dropped); } return (drops); @@ -2242,7 +2242,7 @@ cxgbe_get_counter(struct ifnet *ifp, ift_counter c) struct sge_txq *txq; for_each_txq(vi, i, txq) - drops += counter_u64_fetch(txq->r->drops); + drops += counter_u64_fetch(txq->r->dropped); } return (drops); @@ -4276,6 +4276,13 @@ get_params__post_init(struct adapter *sc) else sc->params.fr_nsmr_tpte_wr_support = false; + param[0] = FW_PARAM_PFVF(MAX_PKTS_PER_ETH_TX_PKTS_WR); + rc = -t4_query_params(sc, sc->mbox, sc->pf, 0, 1, param, val); + if (rc == 0) + sc->params.max_pkts_per_eth_tx_pkts_wr = val[0]; + else + sc->params.max_pkts_per_eth_tx_pkts_wr = 15; + /* get capabilites */ bzero(&caps, sizeof(caps)); caps.op_to_write = htobe32(V_FW_CMD_OP(FW_CAPS_CONFIG_CMD) | @@ -5687,7 +5694,7 @@ quiesce_txq(struct adapter *sc, struct sge_txq *txq) /* Wait for the mp_ring to empty. */ while (!mp_ring_is_idle(txq->r)) { - mp_ring_check_drainage(txq->r, 0); + mp_ring_check_drainage(txq->r, 4096); pause("rquiesce", 1); } Modified: stable/12/sys/dev/cxgbe/t4_mp_ring.c ============================================================================== --- stable/12/sys/dev/cxgbe/t4_mp_ring.c Wed Aug 26 22:52:07 2020 (r364847) +++ stable/12/sys/dev/cxgbe/t4_mp_ring.c Wed Aug 26 23:21:26 2020 (r364848) @@ -34,6 +34,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include "t4_mp_ring.h" @@ -43,6 +45,23 @@ __FBSDID("$FreeBSD$"); #define atomic_cmpset_rel_64 atomic_cmpset_64 #endif +/* + * mp_ring handles multiple threads (producers) enqueueing data to a tx queue. + * The thread that is writing the hardware descriptors is the consumer and it + * runs with the consumer lock held. A producer becomes the consumer if there + * isn't one already. The consumer runs with the flags sets to BUSY and + * consumes everything (IDLE or COALESCING) or gets STALLED. If it is running + * over its budget it sets flags to TOO_BUSY. A producer that observes a + * TOO_BUSY consumer will become the new consumer by setting flags to + * TAKING_OVER. The original consumer stops and sets the flags back to BUSY for + * the new consumer. + * + * COALESCING is the same as IDLE except there are items being held in the hope + * that they can be coalesced with items that follow. The driver must arrange + * for a tx update or some other event that transmits all the held items in a + * timely manner if nothing else is enqueued. + */ + union ring_state { struct { uint16_t pidx_head; @@ -54,13 +73,21 @@ union ring_state { }; enum { - IDLE = 0, /* consumer ran to completion, nothing more to do. */ + IDLE = 0, /* tx is all caught up, nothing to do. */ + COALESCING, /* IDLE, but tx frames are being held for coalescing */ BUSY, /* consumer is running already, or will be shortly. */ + TOO_BUSY, /* consumer is running and is beyond its budget */ + TAKING_OVER, /* new consumer taking over from a TOO_BUSY consumer */ STALLED, /* consumer stopped due to lack of resources. */ - ABDICATED, /* consumer stopped even though there was work to be - done because it wants another thread to take over. */ }; +enum { + C_FAST = 0, + C_2, + C_3, + C_TAKEOVER, +}; + static inline uint16_t space_available(struct mp_ring *r, union ring_state s) { @@ -83,93 +110,104 @@ increment_idx(struct mp_ring *r, uint16_t idx, uint16_ return (x > n ? idx + n : n - x); } -/* Consumer is about to update the ring's state to s */ -static inline uint16_t -state_to_flags(union ring_state s, int abdicate) -{ - - if (s.cidx == s.pidx_tail) - return (IDLE); - else if (abdicate && s.pidx_tail != s.pidx_head) - return (ABDICATED); - - return (BUSY); -} - /* - * Caller passes in a state, with a guarantee that there is work to do and that - * all items up to the pidx_tail in the state are visible. + * Consumer. Called with the consumer lock held and a guarantee that there is + * work to do. */ static void -drain_ring(struct mp_ring *r, union ring_state os, uint16_t prev, int budget) +drain_ring(struct mp_ring *r, int budget) { - union ring_state ns; + union ring_state os, ns; int n, pending, total; - uint16_t cidx = os.cidx; - uint16_t pidx = os.pidx_tail; + uint16_t cidx; + uint16_t pidx; + bool coalescing; + mtx_assert(r->cons_lock, MA_OWNED); + + os.state = atomic_load_acq_64(&r->state); MPASS(os.flags == BUSY); + + cidx = os.cidx; + pidx = os.pidx_tail; MPASS(cidx != pidx); - if (prev == IDLE) - counter_u64_add(r->starts, 1); pending = 0; total = 0; while (cidx != pidx) { /* Items from cidx to pidx are available for consumption. */ - n = r->drain(r, cidx, pidx); + n = r->drain(r, cidx, pidx, &coalescing); if (n == 0) { critical_enter(); - os.state = r->state; + os.state = atomic_load_64(&r->state); do { ns.state = os.state; ns.cidx = cidx; - ns.flags = STALLED; + + MPASS(os.flags == BUSY || + os.flags == TOO_BUSY || + os.flags == TAKING_OVER); + + if (os.flags == TAKING_OVER) + ns.flags = BUSY; + else + ns.flags = STALLED; } while (atomic_fcmpset_64(&r->state, &os.state, ns.state) == 0); critical_exit(); - if (prev != STALLED) + if (os.flags == TAKING_OVER) + counter_u64_add(r->abdications, 1); + else if (ns.flags == STALLED) counter_u64_add(r->stalls, 1); - else if (total > 0) { - counter_u64_add(r->restarts, 1); - counter_u64_add(r->stalls, 1); - } break; } cidx = increment_idx(r, cidx, n); pending += n; total += n; + counter_u64_add(r->consumed, n); - /* - * We update the cidx only if we've caught up with the pidx, the - * real cidx is getting too far ahead of the one visible to - * everyone else, or we have exceeded our budget. - */ - if (cidx != pidx && pending < 64 && total < budget) - continue; - critical_enter(); - os.state = r->state; + os.state = atomic_load_64(&r->state); do { + MPASS(os.flags == BUSY || os.flags == TOO_BUSY || + os.flags == TAKING_OVER); + ns.state = os.state; ns.cidx = cidx; - ns.flags = state_to_flags(ns, total >= budget); + if (__predict_false(os.flags == TAKING_OVER)) { + MPASS(total >= budget); + ns.flags = BUSY; + continue; + } + if (cidx == os.pidx_tail) { + ns.flags = coalescing ? COALESCING : IDLE; + continue; + } + if (total >= budget) { + ns.flags = TOO_BUSY; + continue; + } + MPASS(os.flags == BUSY); + if (pending < 32) + break; } while (atomic_fcmpset_acq_64(&r->state, &os.state, ns.state) == 0); - critical_exit(); - if (ns.flags == ABDICATED) + if (__predict_false(os.flags == TAKING_OVER)) { + MPASS(ns.flags == BUSY); counter_u64_add(r->abdications, 1); - if (ns.flags != BUSY) { - /* Wrong loop exit if we're going to stall. */ - MPASS(ns.flags != STALLED); - if (prev == STALLED) { - MPASS(total > 0); - counter_u64_add(r->restarts, 1); - } break; } + if (ns.flags == IDLE || ns.flags == COALESCING) { + MPASS(ns.pidx_tail == cidx); + if (ns.pidx_head != ns.pidx_tail) + counter_u64_add(r->cons_idle2, 1); + else + counter_u64_add(r->cons_idle, 1); + break; + } + /* * The acquire style atomic above guarantees visibility of items * associated with any pidx change that we notice here. @@ -177,13 +215,55 @@ drain_ring(struct mp_ring *r, union ring_state os, uin pidx = ns.pidx_tail; pending = 0; } + +#ifdef INVARIANTS + if (os.flags == TAKING_OVER) + MPASS(ns.flags == BUSY); + else { + MPASS(ns.flags == IDLE || ns.flags == COALESCING || + ns.flags == STALLED); + } +#endif } +static void +drain_txpkts(struct mp_ring *r, union ring_state os, int budget) +{ + union ring_state ns; + uint16_t cidx = os.cidx; + uint16_t pidx = os.pidx_tail; + bool coalescing; + + mtx_assert(r->cons_lock, MA_OWNED); + MPASS(os.flags == BUSY); + MPASS(cidx == pidx); + + r->drain(r, cidx, pidx, &coalescing); + MPASS(coalescing == false); + critical_enter(); + os.state = atomic_load_64(&r->state); + do { + ns.state = os.state; + MPASS(os.flags == BUSY); + MPASS(os.cidx == cidx); + if (ns.cidx == ns.pidx_tail) + ns.flags = IDLE; + else + ns.flags = BUSY; + } while (atomic_fcmpset_acq_64(&r->state, &os.state, ns.state) == 0); + critical_exit(); + + if (ns.flags == BUSY) + drain_ring(r, budget); +} + int mp_ring_alloc(struct mp_ring **pr, int size, void *cookie, ring_drain_t drain, - ring_can_drain_t can_drain, struct malloc_type *mt, int flags) + ring_can_drain_t can_drain, struct malloc_type *mt, struct mtx *lck, + int flags) { struct mp_ring *r; + int i; /* All idx are 16b so size can be 65536 at most */ if (pr == NULL || size < 2 || size > 65536 || drain == NULL || @@ -201,43 +281,59 @@ mp_ring_alloc(struct mp_ring **pr, int size, void *coo r->mt = mt; r->drain = drain; r->can_drain = can_drain; - r->enqueues = counter_u64_alloc(flags); - r->drops = counter_u64_alloc(flags); - r->starts = counter_u64_alloc(flags); - r->stalls = counter_u64_alloc(flags); - r->restarts = counter_u64_alloc(flags); - r->abdications = counter_u64_alloc(flags); - if (r->enqueues == NULL || r->drops == NULL || r->starts == NULL || - r->stalls == NULL || r->restarts == NULL || - r->abdications == NULL) { - mp_ring_free(r); - return (ENOMEM); + r->cons_lock = lck; + if ((r->dropped = counter_u64_alloc(flags)) == NULL) + goto failed; + for (i = 0; i < nitems(r->consumer); i++) { + if ((r->consumer[i] = counter_u64_alloc(flags)) == NULL) + goto failed; } - + if ((r->not_consumer = counter_u64_alloc(flags)) == NULL) + goto failed; + if ((r->abdications = counter_u64_alloc(flags)) == NULL) + goto failed; + if ((r->stalls = counter_u64_alloc(flags)) == NULL) + goto failed; + if ((r->consumed = counter_u64_alloc(flags)) == NULL) + goto failed; + if ((r->cons_idle = counter_u64_alloc(flags)) == NULL) + goto failed; + if ((r->cons_idle2 = counter_u64_alloc(flags)) == NULL) + goto failed; *pr = r; return (0); +failed: + mp_ring_free(r); + return (ENOMEM); } void mp_ring_free(struct mp_ring *r) { + int i; if (r == NULL) return; - if (r->enqueues != NULL) - counter_u64_free(r->enqueues); - if (r->drops != NULL) - counter_u64_free(r->drops); - if (r->starts != NULL) - counter_u64_free(r->starts); - if (r->stalls != NULL) - counter_u64_free(r->stalls); - if (r->restarts != NULL) - counter_u64_free(r->restarts); + if (r->dropped != NULL) + counter_u64_free(r->dropped); + for (i = 0; i < nitems(r->consumer); i++) { + if (r->consumer[i] != NULL) + counter_u64_free(r->consumer[i]); + } + if (r->not_consumer != NULL) + counter_u64_free(r->not_consumer); if (r->abdications != NULL) counter_u64_free(r->abdications); + if (r->stalls != NULL) + counter_u64_free(r->stalls); + if (r->consumed != NULL) + counter_u64_free(r->consumed); + if (r->cons_idle != NULL) + counter_u64_free(r->cons_idle); + if (r->cons_idle2 != NULL) + counter_u64_free(r->cons_idle2); free(r, r->mt); } @@ -252,7 +348,8 @@ mp_ring_enqueue(struct mp_ring *r, void **items, int n { union ring_state os, ns; uint16_t pidx_start, pidx_stop; - int i; + int i, nospc, cons; + bool consumer; MPASS(items != NULL); MPASS(n > 0); @@ -261,26 +358,70 @@ mp_ring_enqueue(struct mp_ring *r, void **items, int n * Reserve room for the new items. Our reservation, if successful, is * from 'pidx_start' to 'pidx_stop'. */ - os.state = r->state; + nospc = 0; + os.state = atomic_load_64(&r->state); for (;;) { - if (n >= space_available(r, os)) { - counter_u64_add(r->drops, n); + for (;;) { + if (__predict_true(space_available(r, os) >= n)) + break; + + /* Not enough room in the ring. */ + MPASS(os.flags != IDLE); + MPASS(os.flags != COALESCING); + if (__predict_false(++nospc > 100)) { + counter_u64_add(r->dropped, n); + return (ENOBUFS); + } if (os.flags == STALLED) - mp_ring_check_drainage(r, 0); - return (ENOBUFS); + mp_ring_check_drainage(r, 64); + else + cpu_spinwait(); + os.state = atomic_load_64(&r->state); } + + /* There is room in the ring. */ + + cons = -1; ns.state = os.state; ns.pidx_head = increment_idx(r, os.pidx_head, n); + if (os.flags == IDLE || os.flags == COALESCING) { + MPASS(os.pidx_tail == os.cidx); + if (os.pidx_head == os.pidx_tail) { + cons = C_FAST; + ns.pidx_tail = increment_idx(r, os.pidx_tail, n); + } else + cons = C_2; + ns.flags = BUSY; + } else if (os.flags == TOO_BUSY) { + cons = C_TAKEOVER; + ns.flags = TAKING_OVER; + } critical_enter(); if (atomic_fcmpset_64(&r->state, &os.state, ns.state)) break; critical_exit(); cpu_spinwait(); - } + }; + pidx_start = os.pidx_head; pidx_stop = ns.pidx_head; + if (cons == C_FAST) { + i = pidx_start; + do { + r->items[i] = *items++; + if (__predict_false(++i == r->size)) + i = 0; + } while (i != pidx_stop); + critical_exit(); + counter_u64_add(r->consumer[C_FAST], 1); + mtx_lock(r->cons_lock); + drain_ring(r, budget); + mtx_unlock(r->cons_lock); + return (0); + } + /* * Wait for other producers who got in ahead of us to enqueue their * items, one producer at a time. It is our turn when the ring's @@ -288,7 +429,7 @@ mp_ring_enqueue(struct mp_ring *r, void **items, int n */ while (ns.pidx_tail != pidx_start) { cpu_spinwait(); - ns.state = r->state; + ns.state = atomic_load_64(&r->state); } /* Now it is our turn to fill up the area we reserved earlier. */ @@ -303,21 +444,33 @@ mp_ring_enqueue(struct mp_ring *r, void **items, int n * Update the ring's pidx_tail. The release style atomic guarantees * that the items are visible to any thread that sees the updated pidx. */ - os.state = r->state; + os.state = atomic_load_64(&r->state); do { + consumer = false; ns.state = os.state; ns.pidx_tail = pidx_stop; - ns.flags = BUSY; + if (os.flags == IDLE || os.flags == COALESCING || + (os.flags == STALLED && r->can_drain(r))) { + MPASS(cons == -1); + consumer = true; + ns.flags = BUSY; + } } while (atomic_fcmpset_rel_64(&r->state, &os.state, ns.state) == 0); critical_exit(); - counter_u64_add(r->enqueues, n); - /* - * Turn into a consumer if some other thread isn't active as a consumer - * already. - */ - if (os.flags != BUSY) - drain_ring(r, ns, os.flags, budget); + if (cons == -1) { + if (consumer) + cons = C_3; + else { + counter_u64_add(r->not_consumer, 1); + return (0); + } + } + MPASS(cons > C_FAST && cons < nitems(r->consumer)); + counter_u64_add(r->consumer[cons], 1); + mtx_lock(r->cons_lock); + drain_ring(r, budget); + mtx_unlock(r->cons_lock); return (0); } @@ -327,46 +480,96 @@ mp_ring_check_drainage(struct mp_ring *r, int budget) { union ring_state os, ns; - os.state = r->state; - if (os.flags != STALLED || os.pidx_head != os.pidx_tail || - r->can_drain(r) == 0) - return; - - MPASS(os.cidx != os.pidx_tail); /* implied by STALLED */ - ns.state = os.state; - ns.flags = BUSY; - - /* - * The acquire style atomic guarantees visibility of items associated - * with the pidx that we read here. - */ - if (!atomic_cmpset_acq_64(&r->state, os.state, ns.state)) - return; - - drain_ring(r, ns, os.flags, budget); + os.state = atomic_load_64(&r->state); + if (os.flags == STALLED && r->can_drain(r)) { + MPASS(os.cidx != os.pidx_tail); /* implied by STALLED */ + ns.state = os.state; + ns.flags = BUSY; + if (atomic_cmpset_acq_64(&r->state, os.state, ns.state)) { + mtx_lock(r->cons_lock); + drain_ring(r, budget); + mtx_unlock(r->cons_lock); + } + } else if (os.flags == COALESCING) { + MPASS(os.cidx == os.pidx_tail); + ns.state = os.state; + ns.flags = BUSY; + if (atomic_cmpset_acq_64(&r->state, os.state, ns.state)) { + mtx_lock(r->cons_lock); + drain_txpkts(r, ns, budget); + mtx_unlock(r->cons_lock); + } + } } void mp_ring_reset_stats(struct mp_ring *r) { + int i; - counter_u64_zero(r->enqueues); - counter_u64_zero(r->drops); - counter_u64_zero(r->starts); - counter_u64_zero(r->stalls); - counter_u64_zero(r->restarts); + counter_u64_zero(r->dropped); + for (i = 0; i < nitems(r->consumer); i++) + counter_u64_zero(r->consumer[i]); + counter_u64_zero(r->not_consumer); counter_u64_zero(r->abdications); + counter_u64_zero(r->stalls); + counter_u64_zero(r->consumed); + counter_u64_zero(r->cons_idle); + counter_u64_zero(r->cons_idle2); } -int +bool mp_ring_is_idle(struct mp_ring *r) { union ring_state s; - s.state = r->state; + s.state = atomic_load_64(&r->state); if (s.pidx_head == s.pidx_tail && s.pidx_tail == s.cidx && s.flags == IDLE) - return (1); + return (true); - return (0); + return (false); +} + +void +mp_ring_sysctls(struct mp_ring *r, struct sysctl_ctx_list *ctx, + struct sysctl_oid_list *children) +{ + struct sysctl_oid *oid; + + oid = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "mp_ring", CTLFLAG_RD | + CTLFLAG_MPSAFE, NULL, "mp_ring statistics"); + children = SYSCTL_CHILDREN(oid); + + SYSCTL_ADD_U64(ctx, children, OID_AUTO, "state", CTLFLAG_RD, + __DEVOLATILE(uint64_t *, &r->state), 0, "ring state"); + SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "dropped", CTLFLAG_RD, + &r->dropped, "# of items dropped"); + SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "consumed", + CTLFLAG_RD, &r->consumed, "# of items consumed"); + SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "fast_consumer", + CTLFLAG_RD, &r->consumer[C_FAST], + "# of times producer became consumer (fast)"); + SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "consumer2", + CTLFLAG_RD, &r->consumer[C_2], + "# of times producer became consumer (2)"); + SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "consumer3", + CTLFLAG_RD, &r->consumer[C_3], + "# of times producer became consumer (3)"); + SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "takeovers", + CTLFLAG_RD, &r->consumer[C_TAKEOVER], + "# of times producer took over from another consumer."); + SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "not_consumer", + CTLFLAG_RD, &r->not_consumer, + "# of times producer did not become consumer"); + SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "abdications", + CTLFLAG_RD, &r->abdications, "# of consumer abdications"); + SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "stalls", + CTLFLAG_RD, &r->stalls, "# of consumer stalls"); + SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "cons_idle", + CTLFLAG_RD, &r->cons_idle, + "# of times consumer ran fully to completion"); + SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "cons_idle2", + CTLFLAG_RD, &r->cons_idle2, + "# of times consumer idled when another enqueue was in progress"); } Modified: stable/12/sys/dev/cxgbe/t4_mp_ring.h ============================================================================== --- stable/12/sys/dev/cxgbe/t4_mp_ring.h Wed Aug 26 22:52:07 2020 (r364847) +++ stable/12/sys/dev/cxgbe/t4_mp_ring.h Wed Aug 26 23:21:26 2020 (r364848) @@ -36,33 +36,38 @@ #endif struct mp_ring; -typedef u_int (*ring_drain_t)(struct mp_ring *, u_int, u_int); +typedef u_int (*ring_drain_t)(struct mp_ring *, u_int, u_int, bool *); typedef u_int (*ring_can_drain_t)(struct mp_ring *); struct mp_ring { volatile uint64_t state __aligned(CACHE_LINE_SIZE); + struct malloc_type * mt; int size __aligned(CACHE_LINE_SIZE); void * cookie; - struct malloc_type * mt; ring_drain_t drain; ring_can_drain_t can_drain; /* cheap, may be unreliable */ - counter_u64_t enqueues; - counter_u64_t drops; - counter_u64_t starts; - counter_u64_t stalls; - counter_u64_t restarts; /* recovered after stalling */ + struct mtx * cons_lock; + counter_u64_t dropped; + counter_u64_t consumer[4]; + counter_u64_t not_consumer; counter_u64_t abdications; + counter_u64_t consumed; + counter_u64_t cons_idle; + counter_u64_t cons_idle2; + counter_u64_t stalls; void * volatile items[] __aligned(CACHE_LINE_SIZE); }; int mp_ring_alloc(struct mp_ring **, int, void *, ring_drain_t, - ring_can_drain_t, struct malloc_type *, int); + ring_can_drain_t, struct malloc_type *, struct mtx *, int); void mp_ring_free(struct mp_ring *); int mp_ring_enqueue(struct mp_ring *, void **, int, int); void mp_ring_check_drainage(struct mp_ring *, int); void mp_ring_reset_stats(struct mp_ring *); -int mp_ring_is_idle(struct mp_ring *); +bool mp_ring_is_idle(struct mp_ring *); +void mp_ring_sysctls(struct mp_ring *, struct sysctl_ctx_list *, + struct sysctl_oid_list *); #endif Modified: stable/12/sys/dev/cxgbe/t4_sge.c ============================================================================== --- stable/12/sys/dev/cxgbe/t4_sge.c Wed Aug 26 22:52:07 2020 (r364847) +++ stable/12/sys/dev/cxgbe/t4_sge.c Wed Aug 26 23:21:26 2020 (r364848) @@ -198,19 +198,6 @@ static int lro_mbufs = 0; SYSCTL_INT(_hw_cxgbe, OID_AUTO, lro_mbufs, CTLFLAG_RDTUN, &lro_mbufs, 0, "Enable presorting of LRO frames"); -struct txpkts { - u_int wr_type; /* type 0 or type 1 */ - u_int npkt; /* # of packets in this work request */ - u_int plen; /* total payload (sum of all packets) */ - u_int len16; /* # of 16B pieces used by this work request */ -}; - -/* A packet's SGL. This + m_pkthdr has all info needed for tx */ -struct sgl { - struct sglist sg; - struct sglist_seg seg[TX_SGL_SEGS]; -}; - static int service_iq(struct sge_iq *, int); static int service_iq_fl(struct sge_iq *, int); static struct mbuf *get_fl_payload(struct adapter *, struct sge_fl *, uint32_t); @@ -279,14 +266,16 @@ static inline u_int txpkt_vm_len16(u_int, u_int); static inline u_int txpkts0_len16(u_int); static inline u_int txpkts1_len16(void); static u_int write_raw_wr(struct sge_txq *, void *, struct mbuf *, u_int); -static u_int write_txpkt_wr(struct adapter *, struct sge_txq *, - struct fw_eth_tx_pkt_wr *, struct mbuf *, u_int); +static u_int write_txpkt_wr(struct adapter *, struct sge_txq *, struct mbuf *, + u_int); static u_int write_txpkt_vm_wr(struct adapter *, struct sge_txq *, - struct fw_eth_tx_pkt_vm_wr *, struct mbuf *, u_int); -static int try_txpkts(struct mbuf *, struct mbuf *, struct txpkts *, u_int); -static int add_to_txpkts(struct mbuf *, struct txpkts *, u_int); -static u_int write_txpkts_wr(struct adapter *, struct sge_txq *, - struct fw_eth_tx_pkts_wr *, struct mbuf *, const struct txpkts *, u_int); + struct mbuf *); +static int add_to_txpkts_vf(struct adapter *, struct sge_txq *, struct mbuf *, + int, bool *); +static int add_to_txpkts_pf(struct adapter *, struct sge_txq *, struct mbuf *, + int, bool *); +static u_int write_txpkts_wr(struct adapter *, struct sge_txq *); +static u_int write_txpkts_vm_wr(struct adapter *, struct sge_txq *); static void write_gl_to_txd(struct sge_txq *, struct mbuf *, caddr_t *, int); static inline void copy_to_txd(struct sge_eq *, caddr_t, caddr_t *, int); static inline void ring_eq_db(struct adapter *, struct sge_eq *, u_int); @@ -2653,7 +2642,7 @@ can_resume_eth_tx(struct mp_ring *r) return (total_available_tx_desc(eq) > eq->sidx / 8); } -static inline int +static inline bool cannot_use_txpkts(struct mbuf *m) { /* maybe put a GL limit too, to avoid silliness? */ @@ -2669,8 +2658,9 @@ discard_tx(struct sge_eq *eq) } static inline int -wr_can_update_eq(struct fw_eth_tx_pkts_wr *wr) +wr_can_update_eq(void *p) { + struct fw_eth_tx_pkts_wr *wr = p; switch (G_FW_WR_OP(be32toh(wr->op_pkd))) { case FW_ULPTX_WR: @@ -2678,149 +2668,226 @@ wr_can_update_eq(struct fw_eth_tx_pkts_wr *wr) case FW_ETH_TX_PKTS_WR: case FW_ETH_TX_PKTS2_WR: case FW_ETH_TX_PKT_VM_WR: + case FW_ETH_TX_PKTS_VM_WR: return (1); default: return (0); } } +static inline void +set_txupdate_flags(struct sge_txq *txq, u_int avail, + struct fw_eth_tx_pkt_wr *wr) +{ + struct sge_eq *eq = &txq->eq; + struct txpkts *txp = &txq->txp; + + if ((txp->npkt > 0 || avail < eq->sidx / 2) && + atomic_cmpset_int(&eq->equiq, 0, 1)) { + wr->equiq_to_len16 |= htobe32(F_FW_WR_EQUEQ | F_FW_WR_EQUIQ); + eq->equeqidx = eq->pidx; + } else if (IDXDIFF(eq->pidx, eq->equeqidx, eq->sidx) >= 32) { + wr->equiq_to_len16 |= htobe32(F_FW_WR_EQUEQ); + eq->equeqidx = eq->pidx; + } +} + /* * r->items[cidx] to r->items[pidx], with a wraparound at r->size, are ready to * be consumed. Return the actual number consumed. 0 indicates a stall. */ static u_int -eth_tx(struct mp_ring *r, u_int cidx, u_int pidx) +eth_tx(struct mp_ring *r, u_int cidx, u_int pidx, bool *coalescing) { struct sge_txq *txq = r->cookie; - struct sge_eq *eq = &txq->eq; struct ifnet *ifp = txq->ifp; + struct sge_eq *eq = &txq->eq; + struct txpkts *txp = &txq->txp; struct vi_info *vi = ifp->if_softc; struct adapter *sc = vi->adapter; u_int total, remaining; /* # of packets */ - u_int available, dbdiff; /* # of hardware descriptors */ - u_int n, next_cidx; - struct mbuf *m0, *tail; - struct txpkts txp; - struct fw_eth_tx_pkts_wr *wr; /* any fw WR struct will do */ + u_int n, avail, dbdiff; /* # of hardware descriptors */ + int i, rc; + struct mbuf *m0; + bool snd; + void *wr; /* start of the last WR written to the ring */ - remaining = IDXDIFF(pidx, cidx, r->size); - MPASS(remaining > 0); /* Must not be called without work to do. */ - total = 0; + TXQ_LOCK_ASSERT_OWNED(txq); - TXQ_LOCK(txq); + remaining = IDXDIFF(pidx, cidx, r->size); if (__predict_false(discard_tx(eq))) { + for (i = 0; i < txp->npkt; i++) + m_freem(txp->mb[i]); + txp->npkt = 0; while (cidx != pidx) { m0 = r->items[cidx]; m_freem(m0); if (++cidx == r->size) cidx = 0; } - reclaim_tx_descs(txq, 2048); - total = remaining; - goto done; + reclaim_tx_descs(txq, eq->sidx); + *coalescing = false; + return (remaining); /* emptied */ } /* How many hardware descriptors do we have readily available. */ - if (eq->pidx == eq->cidx) - available = eq->sidx - 1; - else - available = IDXDIFF(eq->cidx, eq->pidx, eq->sidx) - 1; - dbdiff = IDXDIFF(eq->pidx, eq->dbidx, eq->sidx); + if (eq->pidx == eq->cidx) { + avail = eq->sidx - 1; + if (txp->score++ >= 5) + txp->score = 5; /* tx is completely idle, reset. */ + } else + avail = IDXDIFF(eq->cidx, eq->pidx, eq->sidx) - 1; - while (remaining > 0) { + total = 0; + if (remaining == 0) { + if (txp->score-- == 1) /* egr_update had to drain txpkts */ + txp->score = 1; + goto send_txpkts; + } + dbdiff = 0; + MPASS(remaining > 0); + while (remaining > 0) { m0 = r->items[cidx]; M_ASSERTPKTHDR(m0); MPASS(m0->m_nextpkt == NULL); - if (available < tx_len16_to_desc(mbuf_len16(m0))) { - available += reclaim_tx_descs(txq, 64); - if (available < tx_len16_to_desc(mbuf_len16(m0))) - break; /* out of descriptors */ - } + if (avail < 2 * SGE_MAX_WR_NDESC) + avail += reclaim_tx_descs(txq, 64); - next_cidx = cidx + 1; - if (__predict_false(next_cidx == r->size)) - next_cidx = 0; - - wr = (void *)&eq->desc[eq->pidx]; - if (sc->flags & IS_VF) { - total++; - remaining--; - ETHER_BPF_MTAP(ifp, m0); - n = write_txpkt_vm_wr(sc, txq, (void *)wr, m0, - available); - } else if (remaining > 1 && - try_txpkts(m0, r->items[next_cidx], &txp, available) == 0) { - - /* pkts at cidx, next_cidx should both be in txp. */ - MPASS(txp.npkt == 2); - tail = r->items[next_cidx]; - MPASS(tail->m_nextpkt == NULL); - ETHER_BPF_MTAP(ifp, m0); - ETHER_BPF_MTAP(ifp, tail); - m0->m_nextpkt = tail; - - if (__predict_false(++next_cidx == r->size)) - next_cidx = 0; - - while (next_cidx != pidx) { - if (add_to_txpkts(r->items[next_cidx], &txp, - available) != 0) - break; - tail->m_nextpkt = r->items[next_cidx]; - tail = tail->m_nextpkt; - ETHER_BPF_MTAP(ifp, tail); - if (__predict_false(++next_cidx == r->size)) - next_cidx = 0; + if (txp->npkt > 0 || remaining > 1 || txp->score > 3 || + atomic_load_int(&txq->eq.equiq) != 0) { + if (sc->flags & IS_VF) + rc = add_to_txpkts_vf(sc, txq, m0, avail, &snd); + else + rc = add_to_txpkts_pf(sc, txq, m0, avail, &snd); + } else { + snd = false; + rc = EINVAL; + } + if (snd) { + MPASS(txp->npkt > 0); + for (i = 0; i < txp->npkt; i++) + ETHER_BPF_MTAP(ifp, txp->mb[i]); + if (txp->npkt > 1) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-12@freebsd.org Wed Aug 26 23:41:47 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2E8033C0F1E; Wed, 26 Aug 2020 23:41:47 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BcMp30Tc6z3bMh; Wed, 26 Aug 2020 23:41:47 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E80DA1ADD2; Wed, 26 Aug 2020 23:41:46 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07QNfkFm071909; Wed, 26 Aug 2020 23:41:46 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07QNfkno071908; Wed, 26 Aug 2020 23:41:46 GMT (envelope-from np@FreeBSD.org) Message-Id: <202008262341.07QNfkno071908@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Wed, 26 Aug 2020 23:41:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364849 - stable/12/sys/dev/cxgbe X-SVN-Group: stable-12 X-SVN-Commit-Author: np X-SVN-Commit-Paths: stable/12/sys/dev/cxgbe X-SVN-Commit-Revision: 364849 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2020 23:41:47 -0000 Author: np Date: Wed Aug 26 23:41:46 2020 New Revision: 364849 URL: https://svnweb.freebsd.org/changeset/base/364849 Log: MFC r358924: cxgbe(4): Do not display error messages related to the CLIP table if it's not in use by TOE or KTLS. Modified: stable/12/sys/dev/cxgbe/t4_clip.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/cxgbe/t4_clip.c ============================================================================== --- stable/12/sys/dev/cxgbe/t4_clip.c Wed Aug 26 23:21:26 2020 (r364848) +++ stable/12/sys/dev/cxgbe/t4_clip.c Wed Aug 26 23:41:46 2020 (r364849) @@ -273,8 +273,11 @@ update_clip_table(struct adapter *sc) inet_ntop(AF_INET6, &ce->lip, &ip[0], sizeof(ip)); - log(LOG_ERR, "%s: could not add %s (%d)\n", - __func__, ip, rc); + if (sc->active_ulds != 0) { + log(LOG_ERR, + "%s: could not add %s (%d)\n", + __func__, ip, rc); + } free(ce, M_CXGBE); } next: From owner-svn-src-stable-12@freebsd.org Thu Aug 27 00:28:42 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4CA103C2399; Thu, 27 Aug 2020 00:28:42 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BcNrB1JDtz3fFf; Thu, 27 Aug 2020 00:28:42 +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 10E5E1B9DD; Thu, 27 Aug 2020 00:28:42 +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 07R0SfMn099264; Thu, 27 Aug 2020 00:28:41 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07R0SfLn099263; Thu, 27 Aug 2020 00:28:41 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202008270028.07R0SfLn099263@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 27 Aug 2020 00:28:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364851 - stable/12/sys/netpfil/ipfw X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/12/sys/netpfil/ipfw X-SVN-Commit-Revision: 364851 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2020 00:28:42 -0000 Author: emaste Date: Thu Aug 27 00:28:41 2020 New Revision: 364851 URL: https://svnweb.freebsd.org/changeset/base/364851 Log: MFC r364426: ipfw: style(9) fixes Submitted by: Neel Chauhan Modified: stable/12/sys/netpfil/ipfw/ip_fw2.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- stable/12/sys/netpfil/ipfw/ip_fw2.c Thu Aug 27 00:17:17 2020 (r364850) +++ stable/12/sys/netpfil/ipfw/ip_fw2.c Thu Aug 27 00:28:41 2020 (r364851) @@ -754,17 +754,17 @@ ipfw_send_pkt(struct mbuf *replyto, struct ipfw_flow_i * ipv6 specific rules here... */ static __inline int -icmp6type_match (int type, ipfw_insn_u32 *cmd) +icmp6type_match(int type, ipfw_insn_u32 *cmd) { return (type <= ICMP6_MAXTYPE && (cmd->d[type/32] & (1<<(type%32)) ) ); } static int -flow6id_match( int curr_flow, ipfw_insn_u32 *cmd ) +flow6id_match(int curr_flow, ipfw_insn_u32 *cmd) { int i; - for (i=0; i <= cmd->o.arg1; ++i ) - if (curr_flow == cmd->d[i] ) + for (i=0; i <= cmd->o.arg1; ++i) + if (curr_flow == cmd->d[i]) return 1; return 0; } From owner-svn-src-stable-12@freebsd.org Thu Aug 27 00:32:12 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 66A533C24C1; Thu, 27 Aug 2020 00:32:12 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BcNwD27NNz3fhw; Thu, 27 Aug 2020 00:32:12 +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 2C8BE1B751; Thu, 27 Aug 2020 00:32:12 +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 07R0WCc5004100; Thu, 27 Aug 2020 00:32:12 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07R0WCiY004099; Thu, 27 Aug 2020 00:32:12 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202008270032.07R0WCiY004099@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 27 Aug 2020 00:32:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364852 - stable/12/lib/libc/gen X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/lib/libc/gen X-SVN-Commit-Revision: 364852 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2020 00:32:12 -0000 Author: kib Date: Thu Aug 27 00:32:11 2020 New Revision: 364852 URL: https://svnweb.freebsd.org/changeset/base/364852 Log: MFC r364423: dl_iterate_phdr(3): provide exclusive locking for callback when statically linked. Modified: stable/12/lib/libc/gen/dlfcn.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/gen/dlfcn.c ============================================================================== --- stable/12/lib/libc/gen/dlfcn.c Thu Aug 27 00:28:41 2020 (r364851) +++ stable/12/lib/libc/gen/dlfcn.c Thu Aug 27 00:32:11 2020 (r364852) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include "un-namespace.h" #include "libc_private.h" +#include "reentrant.h" static char sorry[] = "Service unavailable"; @@ -164,6 +165,7 @@ _rtld_thread_init(void *li __unused) #ifndef IN_LIBDL static pthread_once_t dl_phdr_info_once = PTHREAD_ONCE_INIT; static struct dl_phdr_info phdr_info; +static mutex_t dl_phdr_info_lock = MUTEX_INITIALIZER; static void dl_init_phdr_info(void) @@ -204,13 +206,17 @@ int dl_iterate_phdr(int (*callback)(struct dl_phdr_info *, size_t, void *) __unused, void *data __unused) { - #ifndef IN_LIBDL + int ret; + __init_elf_aux_vector(); if (__elf_aux_vector == NULL) return (1); _once(&dl_phdr_info_once, dl_init_phdr_info); - return (callback(&phdr_info, sizeof(phdr_info), data)); + mutex_lock(&dl_phdr_info_lock); + ret = callback(&phdr_info, sizeof(phdr_info), data); + mutex_unlock(&dl_phdr_info_lock); + return (ret); #else return (0); #endif From owner-svn-src-stable-12@freebsd.org Thu Aug 27 13:38:21 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 90E003B2493; Thu, 27 Aug 2020 13:38:21 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BckMK3HVNz4dZK; Thu, 27 Aug 2020 13:38:21 +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 54C7024AA9; Thu, 27 Aug 2020 13:38:21 +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 07RDcLx0022100; Thu, 27 Aug 2020 13:38:21 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07RDcL52022099; Thu, 27 Aug 2020 13:38:21 GMT (envelope-from avg@FreeBSD.org) Message-Id: <202008271338.07RDcL52022099@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 27 Aug 2020 13:38:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364865 - stable/12/sys/cam/scsi X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/cam/scsi X-SVN-Commit-Revision: 364865 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2020 13:38:21 -0000 Author: avg Date: Thu Aug 27 13:38:20 2020 New Revision: 364865 URL: https://svnweb.freebsd.org/changeset/base/364865 Log: MFC r354621-r354623 by imp: scsi_da state machine improvements r354621 Require and enforce that dareprobe() has to be called with the periph lock held. r354622 Update the softc state of the da driver before releasing the CCB. r354623 Add asserts for some state transitions Modified: stable/12/sys/cam/scsi/scsi_da.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/12/sys/cam/scsi/scsi_da.c Thu Aug 27 13:33:21 2020 (r364864) +++ stable/12/sys/cam/scsi/scsi_da.c Thu Aug 27 13:38:20 2020 (r364865) @@ -2130,8 +2130,8 @@ daasync(void *callback_arg, u_int32_t code, "Capacity data has changed\n"); cam_periph_lock(periph); softc->flags &= ~DA_FLAG_PROBED; - cam_periph_unlock(periph); dareprobe(periph); + cam_periph_unlock(periph); } else if (asc == 0x28 && ascq == 0x00) { cam_periph_lock(periph); softc->flags &= ~DA_FLAG_PROBED; @@ -2142,8 +2142,8 @@ daasync(void *callback_arg, u_int32_t code, "INQUIRY data has changed\n"); cam_periph_lock(periph); softc->flags &= ~DA_FLAG_PROBED; - cam_periph_unlock(periph); dareprobe(periph); + cam_periph_unlock(periph); } } break; @@ -4593,6 +4593,14 @@ dadone_probewp(struct cam_periph *periph, union ccb *d cam_periph_assert(periph, MA_OWNED); + KASSERT(softc->state == DA_STATE_PROBE_WP, + ("State (%d) not PROBE_WP in dadone_probewp, periph %p ccb %p", + softc->state, periph, done_ccb)); + KASSERT((csio->ccb_h.ccb_state & DA_CCB_TYPE_MASK) == DA_CCB_PROBE_WP, + ("CCB State (%lu) not PROBE_WP in dadone_probewp, periph %p ccb %p", + (unsigned long)csio->ccb_h.ccb_state & DA_CCB_TYPE_MASK, periph, + done_ccb)); + if (softc->minimum_cmd_size > 6) { mode_hdr10 = (struct scsi_mode_header_10 *)csio->data_ptr; dev_spec = mode_hdr10->dev_spec; @@ -4625,11 +4633,11 @@ dadone_probewp(struct cam_periph *periph, union ccb *d } free(csio->data_ptr, M_SCSIDA); - xpt_release_ccb(done_ccb); if ((softc->flags & DA_FLAG_CAN_RC16) != 0) softc->state = DA_STATE_PROBE_RC16; else softc->state = DA_STATE_PROBE_RC; + xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); return; } @@ -4653,6 +4661,13 @@ dadone_proberc(struct cam_periph *periph, union ccb *d csio = &done_ccb->csio; state = csio->ccb_h.ccb_state & DA_CCB_TYPE_MASK; + KASSERT(softc->state == DA_STATE_PROBE_RC || softc->state == DA_STATE_PROBE_RC16, + ("State (%d) not PROBE_RC* in dadone_proberc, periph %p ccb %p", + softc->state, periph, done_ccb)); + KASSERT(state == DA_CCB_PROBE_RC || state == DA_CCB_PROBE_RC16, + ("CCB State (%lu) not PROBE_RC* in dadone_probewp, periph %p ccb %p", + (unsigned long)state, periph, done_ccb)); + lbp = 0; rdcap = NULL; rcaplong = NULL; @@ -4689,8 +4704,8 @@ dadone_proberc(struct cam_periph *periph, union ccb *d */ if (maxsector == 0xffffffff) { free(rdcap, M_SCSIDA); - xpt_release_ccb(done_ccb); softc->state = DA_STATE_PROBE_RC16; + xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); return; } @@ -4796,8 +4811,8 @@ dadone_proberc(struct cam_periph *periph, union ccb *d cam_periph_assert(periph, MA_OWNED); softc->flags &= ~DA_FLAG_CAN_RC16; free(rdcap, M_SCSIDA); - xpt_release_ccb(done_ccb); softc->state = DA_STATE_PROBE_RC; + xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); return; } @@ -4904,14 +4919,14 @@ dadone_proberc(struct cam_periph *periph, union ccb *d dadeleteflag(softc, DA_DELETE_WS10, 1); dadeleteflag(softc, DA_DELETE_UNMAP, 1); - xpt_release_ccb(done_ccb); softc->state = DA_STATE_PROBE_LBP; + xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); return; } - xpt_release_ccb(done_ccb); softc->state = DA_STATE_PROBE_BDC; + xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); return; } @@ -4968,8 +4983,8 @@ dadone_probelbp(struct cam_periph *periph, union ccb * } free(lbp, M_SCSIDA); - xpt_release_ccb(done_ccb); softc->state = DA_STATE_PROBE_BLK_LIMITS; + xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); return; } @@ -5062,8 +5077,8 @@ dadone_probeblklimits(struct cam_periph *periph, union } free(block_limits, M_SCSIDA); - xpt_release_ccb(done_ccb); softc->state = DA_STATE_PROBE_BDC; + xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); return; } @@ -5163,8 +5178,8 @@ dadone_probebdc(struct cam_periph *periph, union ccb * } free(bdc, M_SCSIDA); - xpt_release_ccb(done_ccb); softc->state = DA_STATE_PROBE_ATA; + xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); return; } @@ -5303,8 +5318,8 @@ dadone_probeata(struct cam_periph *periph, union ccb * continue_probe = 1; } if (continue_probe != 0) { - xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); + xpt_release_ccb(done_ccb); return; } else daprobedone(periph, done_ccb); @@ -5793,8 +5808,8 @@ dadone_tur(struct cam_periph *periph, union ccb *done_ /*timeout*/0, /*getcount_only*/0); } - xpt_release_ccb(done_ccb); softc->flags &= ~DA_FLAG_TUR_PENDING; + xpt_release_ccb(done_ccb); da_periph_release_locked(periph, DA_REF_TUR); return; } @@ -5806,6 +5821,8 @@ dareprobe(struct cam_periph *periph) int status; softc = (struct da_softc *)periph->softc; + + cam_periph_assert(periph, MA_OWNED); /* Probe in progress; don't interfere. */ if (softc->state != DA_STATE_NORMAL) From owner-svn-src-stable-12@freebsd.org Thu Aug 27 14:50:49 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 578E83B5541; Thu, 27 Aug 2020 14:50:49 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Bclyx1rMtz3WB1; Thu, 27 Aug 2020 14:50: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 23D59256E8; Thu, 27 Aug 2020 14:50: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 07REonEt066137; Thu, 27 Aug 2020 14:50:49 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07REonnO066136; Thu, 27 Aug 2020 14:50:49 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008271450.07REonnO066136@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 27 Aug 2020 14:50:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364869 - stable/12/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Commit-Revision: 364869 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2020 14:50:49 -0000 Author: markj Date: Thu Aug 27 14:50:48 2020 New Revision: 364869 URL: https://svnweb.freebsd.org/changeset/base/364869 Log: MFC r364437: Remove non-FreeBSD ifdefs from dt_link.c. Modified: stable/12/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Directory Properties: stable/12/ (props changed) Modified: stable/12/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Thu Aug 27 14:36:00 2020 (r364868) +++ stable/12/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Thu Aug 27 14:50:48 2020 (r364869) @@ -25,38 +25,23 @@ * Copyright 2017-2018 Mark Johnston */ -#pragma ident "%Z%%M% %I% %E% SMI" +#include +#include +#include -#define ELF_TARGET_ALL +#include #include - -#include -#ifdef illumos -#include -#else -#define P2ROUNDUP(x, align) (-(-(x) & -(align))) -#endif - -#include -#include -#ifdef illumos -#include -#endif +#include +#include #include #include -#include #include -#include +#include +#include #include -#ifdef illumos -#include -#else -#include +#include + #include -#include -#include -#endif -#include #include #include @@ -82,11 +67,7 @@ static const char DTRACE_SHSTRTAB32[] = "\0" ".SUNW_dof\0" /* 11 */ ".strtab\0" /* 21 */ ".symtab\0" /* 29 */ -#ifdef __sparc -".rela.SUNW_dof"; /* 37 */ -#else ".rel.SUNW_dof"; /* 37 */ -#endif static const char DTRACE_SHSTRTAB64[] = "\0" ".shstrtab\0" /* 1 */ @@ -106,11 +87,7 @@ typedef struct dt_link_pair { typedef struct dof_elf32 { uint32_t de_nrel; /* relocation count */ -#ifdef __sparc - Elf32_Rela *de_rel; /* array of relocations for sparc */ -#else Elf32_Rel *de_rel; /* array of relocations for x86 */ -#endif uint32_t de_nsym; /* symbol count */ Elf32_Sym *de_sym; /* array of symbols */ uint32_t de_strlen; /* size of of string table */ @@ -130,11 +107,7 @@ prepare_elf32(dtrace_hdl_t *dtp, const dof_hdr_t *dof, uint32_t count = 0; size_t base; Elf32_Sym *sym; -#ifdef __sparc - Elf32_Rela *rel; -#else Elf32_Rel *rel; -#endif /*LINTED*/ dofs = (dof_sec_t *)((char *)dof + dof->dofh_secoff); @@ -324,11 +297,7 @@ prepare_elf64(dtrace_hdl_t *dtp, const dof_hdr_t *dof, char *strtab; int i, j, nrel; size_t strtabsz = 1; -#ifdef illumos - uint32_t count = 0; -#else uint64_t count = 0; -#endif size_t base; Elf64_Sym *sym; Elf64_Rela *rel; @@ -530,9 +499,7 @@ dump_elf32(dtrace_hdl_t *dtp, const dof_hdr_t *dof, in #else elf_file.ehdr.e_ident[EI_DATA] = ELFDATA2LSB; #endif -#if defined(__FreeBSD__) elf_file.ehdr.e_ident[EI_OSABI] = ELFOSABI_FREEBSD; -#endif elf_file.ehdr.e_type = ET_REL; #if defined(__arm__) elf_file.ehdr.e_machine = EM_ARM; @@ -540,8 +507,6 @@ dump_elf32(dtrace_hdl_t *dtp, const dof_hdr_t *dof, in elf_file.ehdr.e_machine = EM_MIPS; #elif defined(__powerpc__) elf_file.ehdr.e_machine = EM_PPC; -#elif defined(__sparc) - elf_file.ehdr.e_machine = EM_SPARC; #elif defined(__i386) || defined(__amd64) elf_file.ehdr.e_machine = EM_386; #elif defined(__aarch64__) @@ -562,7 +527,7 @@ dump_elf32(dtrace_hdl_t *dtp, const dof_hdr_t *dof, in shp->sh_offset = off; shp->sh_size = sizeof (DTRACE_SHSTRTAB32); shp->sh_addralign = sizeof (char); - off = P2ROUNDUP(shp->sh_offset + shp->sh_size, 8); + off = roundup2(shp->sh_offset + shp->sh_size, 8); shp = &elf_file.shdr[ESHDR_DOF]; shp->sh_name = 11; /* DTRACE_SHSTRTAB32[11] = ".SUNW_dof" */ @@ -580,7 +545,7 @@ dump_elf32(dtrace_hdl_t *dtp, const dof_hdr_t *dof, in shp->sh_offset = off; shp->sh_size = de.de_strlen; shp->sh_addralign = sizeof (char); - off = P2ROUNDUP(shp->sh_offset + shp->sh_size, 4); + off = roundup2(shp->sh_offset + shp->sh_size, 4); shp = &elf_file.shdr[ESHDR_SYMTAB]; shp->sh_name = 29; /* DTRACE_SHSTRTAB32[29] = ".symtab" */ @@ -592,7 +557,7 @@ dump_elf32(dtrace_hdl_t *dtp, const dof_hdr_t *dof, in shp->sh_info = de.de_global; shp->sh_size = de.de_nsym * sizeof (Elf32_Sym); shp->sh_addralign = 4; - off = P2ROUNDUP(shp->sh_offset + shp->sh_size, 4); + off = roundup2(shp->sh_offset + shp->sh_size, 4); if (de.de_nrel == 0) { if (dt_write(dtp, fd, &elf_file, @@ -607,11 +572,7 @@ dump_elf32(dtrace_hdl_t *dtp, const dof_hdr_t *dof, in shp = &elf_file.shdr[ESHDR_REL]; shp->sh_name = 37; /* DTRACE_SHSTRTAB32[37] = ".rel.SUNW_dof" */ shp->sh_flags = SHF_ALLOC; -#ifdef __sparc - shp->sh_type = SHT_RELA; -#else shp->sh_type = SHT_REL; -#endif shp->sh_entsize = sizeof (de.de_rel[0]); shp->sh_link = ESHDR_SYMTAB; shp->sh_info = ESHDR_DOF; @@ -678,9 +639,7 @@ dump_elf64(dtrace_hdl_t *dtp, const dof_hdr_t *dof, in #else elf_file.ehdr.e_ident[EI_DATA] = ELFDATA2LSB; #endif -#if defined(__FreeBSD__) elf_file.ehdr.e_ident[EI_OSABI] = ELFOSABI_FREEBSD; -#endif elf_file.ehdr.e_type = ET_REL; #if defined(__arm__) elf_file.ehdr.e_machine = EM_ARM; @@ -688,8 +647,6 @@ dump_elf64(dtrace_hdl_t *dtp, const dof_hdr_t *dof, in elf_file.ehdr.e_machine = EM_MIPS; #elif defined(__powerpc64__) elf_file.ehdr.e_machine = EM_PPC64; -#elif defined(__sparc) - elf_file.ehdr.e_machine = EM_SPARCV9; #elif defined(__i386) || defined(__amd64) elf_file.ehdr.e_machine = EM_AMD64; #elif defined(__aarch64__) @@ -710,7 +667,7 @@ dump_elf64(dtrace_hdl_t *dtp, const dof_hdr_t *dof, in shp->sh_offset = off; shp->sh_size = sizeof (DTRACE_SHSTRTAB64); shp->sh_addralign = sizeof (char); - off = P2ROUNDUP(shp->sh_offset + shp->sh_size, 8); + off = roundup2(shp->sh_offset + shp->sh_size, 8); shp = &elf_file.shdr[ESHDR_DOF]; shp->sh_name = 11; /* DTRACE_SHSTRTAB64[11] = ".SUNW_dof" */ @@ -728,7 +685,7 @@ dump_elf64(dtrace_hdl_t *dtp, const dof_hdr_t *dof, in shp->sh_offset = off; shp->sh_size = de.de_strlen; shp->sh_addralign = sizeof (char); - off = P2ROUNDUP(shp->sh_offset + shp->sh_size, 8); + off = roundup2(shp->sh_offset + shp->sh_size, 8); shp = &elf_file.shdr[ESHDR_SYMTAB]; shp->sh_name = 29; /* DTRACE_SHSTRTAB64[29] = ".symtab" */ @@ -740,7 +697,7 @@ dump_elf64(dtrace_hdl_t *dtp, const dof_hdr_t *dof, in shp->sh_info = de.de_global; shp->sh_size = de.de_nsym * sizeof (Elf64_Sym); shp->sh_addralign = 8; - off = P2ROUNDUP(shp->sh_offset + shp->sh_size, 8); + off = roundup2(shp->sh_offset + shp->sh_size, 8); if (de.de_nrel == 0) { if (dt_write(dtp, fd, &elf_file, @@ -981,133 +938,7 @@ dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, __FILE__, __LINE__); return (-1); } -#elif defined(__sparc) -#define DT_OP_RET 0x81c7e008 -#define DT_OP_NOP 0x01000000 -#define DT_OP_CALL 0x40000000 -#define DT_OP_CLR_O0 0x90102000 - -#define DT_IS_MOV_O7(inst) (((inst) & 0xffffe000) == 0x9e100000) -#define DT_IS_RESTORE(inst) (((inst) & 0xc1f80000) == 0x81e80000) -#define DT_IS_RETL(inst) (((inst) & 0xfff83fff) == 0x81c02008) - -#define DT_RS2(inst) ((inst) & 0x1f) -#define DT_MAKE_RETL(reg) (0x81c02008 | ((reg) << 14)) - -/*ARGSUSED*/ -static int -dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, GElf_Rela *rela, - uint32_t *off) -{ - uint32_t *ip; - - if ((rela->r_offset & (sizeof (uint32_t) - 1)) != 0) - return (-1); - - /*LINTED*/ - ip = (uint32_t *)(p + rela->r_offset); - - /* - * We only know about some specific relocation types. - */ - if (GELF_R_TYPE(rela->r_info) != R_SPARC_WDISP30 && - GELF_R_TYPE(rela->r_info) != R_SPARC_WPLT30) - return (-1); - - /* - * We may have already processed this object file in an earlier linker - * invocation. Check to see if the present instruction sequence matches - * the one we would install below. - */ - if (isenabled) { - if (ip[0] == DT_OP_NOP) { - (*off) += sizeof (ip[0]); - return (0); - } - } else { - if (DT_IS_RESTORE(ip[1])) { - if (ip[0] == DT_OP_RET) { - (*off) += sizeof (ip[0]); - return (0); - } - } else if (DT_IS_MOV_O7(ip[1])) { - if (DT_IS_RETL(ip[0])) - return (0); - } else { - if (ip[0] == DT_OP_NOP) { - (*off) += sizeof (ip[0]); - return (0); - } - } - } - - /* - * We only expect call instructions with a displacement of 0. - */ - if (ip[0] != DT_OP_CALL) { - dt_dprintf("found %x instead of a call instruction at %llx\n", - ip[0], (u_longlong_t)rela->r_offset); - return (-1); - } - - if (isenabled) { - /* - * It would necessarily indicate incorrect usage if an is- - * enabled probe were tail-called so flag that as an error. - * It's also potentially (very) tricky to handle gracefully, - * but could be done if this were a desired use scenario. - */ - if (DT_IS_RESTORE(ip[1]) || DT_IS_MOV_O7(ip[1])) { - dt_dprintf("tail call to is-enabled probe at %llx\n", - (u_longlong_t)rela->r_offset); - return (-1); - } - - - /* - * On SPARC, we take advantage of the fact that the first - * argument shares the same register as for the return value. - * The macro handles the work of zeroing that register so we - * don't need to do anything special here. We instrument the - * instruction in the delay slot as we'll need to modify the - * return register after that instruction has been emulated. - */ - ip[0] = DT_OP_NOP; - (*off) += sizeof (ip[0]); - } else { - /* - * If the call is followed by a restore, it's a tail call so - * change the call to a ret. If the call if followed by a mov - * of a register into %o7, it's a tail call in leaf context - * so change the call to a retl-like instruction that returns - * to that register value + 8 (rather than the typical %o7 + - * 8); the delay slot instruction is left, but should have no - * effect. Otherwise we change the call to be a nop. We - * identify the subsequent instruction as the probe point in - * all but the leaf tail-call case to ensure that arguments to - * the probe are complete and consistent. An astute, though - * largely hypothetical, observer would note that there is the - * possibility of a false-positive probe firing if the function - * contained a branch to the instruction in the delay slot of - * the call. Fixing this would require significant in-kernel - * modifications, and isn't worth doing until we see it in the - * wild. - */ - if (DT_IS_RESTORE(ip[1])) { - ip[0] = DT_OP_RET; - (*off) += sizeof (ip[0]); - } else if (DT_IS_MOV_O7(ip[1])) { - ip[0] = DT_MAKE_RETL(DT_RS2(ip[1])); - } else { - ip[0] = DT_OP_NOP; - (*off) += sizeof (ip[0]); - } - } - - return (0); -} - #elif defined(__i386) || defined(__amd64) #define DT_OP_NOP 0x90 @@ -1328,8 +1159,6 @@ process_obj(dtrace_hdl_t *dtp, const char *obj, int *e emachine1 = emachine2 = EM_MIPS; #elif defined(__powerpc__) emachine1 = emachine2 = EM_PPC64; -#elif defined(__sparc) - emachine1 = emachine2 = EM_SPARCV9; #elif defined(__i386) || defined(__amd64) emachine1 = emachine2 = EM_AMD64; #elif defined(__aarch64__) @@ -1344,9 +1173,6 @@ process_obj(dtrace_hdl_t *dtp, const char *obj, int *e emachine1 = emachine2 = EM_MIPS; #elif defined(__powerpc__) emachine1 = emachine2 = EM_PPC; -#elif defined(__sparc) - emachine1 = EM_SPARC; - emachine2 = EM_SPARC32PLUS; #elif defined(__i386) || defined(__amd64) emachine1 = emachine2 = EM_386; #endif @@ -1710,7 +1536,7 @@ process_obj(dtrace_hdl_t *dtp, const char *obj, int *e return (dt_link_error(dtp, elf, fd, bufs, "failed to allocate space for probe")); } -#ifndef illumos + /* * Our linker doesn't understand the SUNW_IGNORE ndx and * will try to use this relocation when we build the @@ -1732,7 +1558,6 @@ process_obj(dtrace_hdl_t *dtp, const char *obj, int *e rel.r_info = 0; (void) gelf_update_rel(data_rel, i, &rel); } -#endif mod = 1; (void) elf_flagdata(data_tgt, ELF_C_SET, ELF_F_DIRTY); @@ -1744,11 +1569,8 @@ process_obj(dtrace_hdl_t *dtp, const char *obj, int *e * already been processed by an earlier link * invocation. */ -#ifndef illumos -#define SHN_SUNW_IGNORE SHN_ABS -#endif - if (rsym.st_shndx != SHN_SUNW_IGNORE) { - rsym.st_shndx = SHN_SUNW_IGNORE; + if (rsym.st_shndx != SHN_ABS) { + rsym.st_shndx = SHN_ABS; (void) gelf_update_sym(data_sym, ndx, &rsym); } } @@ -1778,9 +1600,7 @@ int dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags, const char *file, int objc, char *const objv[]) { -#ifndef illumos char tfile[PATH_MAX]; -#endif char drti[PATH_MAX]; dof_hdr_t *dof; int fd, status, i, cur; @@ -1788,7 +1608,6 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t * size_t len; int eprobes = 0, ret = 0; -#ifndef illumos if (access(file, R_OK) == 0) { fprintf(stderr, "dtrace: target object (%s) already exists. " "Please remove the target\ndtrace: object and rebuild all " @@ -1801,7 +1620,6 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t * */ return (0); } -#endif /* * A NULL program indicates a special use in which we just link @@ -1864,23 +1682,11 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t * if ((dof = dtrace_dof_create(dtp, pgp, dflags)) == NULL) return (-1); /* errno is set for us */ -#ifdef illumos - /* - * Create a temporary file and then unlink it if we're going to - * combine it with drti.o later. We can still refer to it in child - * processes as /dev/fd/. - */ - if ((fd = open64(file, O_RDWR | O_CREAT | O_TRUNC, 0666)) == -1) { - return (dt_link_error(dtp, NULL, -1, NULL, - "failed to open %s: %s", file, strerror(errno))); - } -#else snprintf(tfile, sizeof(tfile), "%s.XXXXXX", file); if ((fd = mkostemp(tfile, O_CLOEXEC)) == -1) return (dt_link_error(dtp, NULL, -1, NULL, "failed to create temporary file %s: %s", tfile, strerror(errno))); -#endif /* * If -xlinktype=DOF has been selected, just write out the DOF. @@ -1910,47 +1716,17 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t * } -#ifdef illumos - if (!dtp->dt_lazyload) - (void) unlink(file); -#endif - if (dtp->dt_oflags & DTRACE_O_LP64) status = dump_elf64(dtp, dof, fd); else status = dump_elf32(dtp, dof, fd); -#ifdef illumos - if (status != 0 || lseek(fd, 0, SEEK_SET) != 0) { - return (dt_link_error(dtp, NULL, -1, NULL, - "failed to write %s: %s", file, strerror(errno))); - } -#else if (status != 0) return (dt_link_error(dtp, NULL, -1, NULL, "failed to write %s: %s", tfile, strerror(dtrace_errno(dtp)))); -#endif if (!dtp->dt_lazyload) { -#ifdef illumos - const char *fmt = "%s -o %s -r -Blocal -Breduce /dev/fd/%d %s"; - - if (dtp->dt_oflags & DTRACE_O_LP64) { - (void) snprintf(drti, sizeof (drti), - "%s/64/drti.o", _dtrace_libdir); - } else { - (void) snprintf(drti, sizeof (drti), - "%s/drti.o", _dtrace_libdir); - } - - len = snprintf(&tmp, 1, fmt, dtp->dt_ld_path, file, fd, - drti) + 1; - - cmd = alloca(len); - - (void) snprintf(cmd, len, fmt, dtp->dt_ld_path, file, fd, drti); -#else const char *fmt = "%s -o %s -r %s %s"; dt_dirpath_t *dp = dt_list_next(&dtp->dt_lib_path); @@ -1963,7 +1739,6 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t * (void) snprintf(cmd, len, fmt, dtp->dt_ld_path, file, tfile, drti); -#endif if ((status = system(cmd)) == -1) { ret = dt_link_error(dtp, NULL, fd, NULL, "failed to run %s: %s", dtp->dt_ld_path, @@ -1986,7 +1761,6 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t * } (void) close(fd); /* release temporary file */ -#ifdef __FreeBSD__ /* * Now that we've linked drti.o, reduce the global __SUNW_dof * symbol to a local symbol. This is needed to so that multiple @@ -2019,25 +1793,20 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t * file, dtp->dt_objcopy_path, WEXITSTATUS(status)); goto done; } -#endif } else { -#ifdef __FreeBSD__ if (rename(tfile, file) != 0) { ret = dt_link_error(dtp, NULL, fd, NULL, "failed to rename %s to %s: %s", tfile, file, strerror(errno)); goto done; } -#endif (void) close(fd); } done: dtrace_dof_destroy(dtp, dof); -#ifdef __FreeBSD__ if (!dtp->dt_lazyload) (void) unlink(tfile); -#endif return (ret); } From owner-svn-src-stable-12@freebsd.org Thu Aug 27 14:51:45 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1ECD23B5735; Thu, 27 Aug 2020 14:51:45 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Bcm0101d1z3WMd; Thu, 27 Aug 2020 14:51:45 +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 D7E6A25856; Thu, 27 Aug 2020 14:51:44 +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 07REpiCF066962; Thu, 27 Aug 2020 14:51:44 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07REpidL066961; Thu, 27 Aug 2020 14:51:44 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008271451.07REpidL066961@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 27 Aug 2020 14:51:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364870 - stable/12/sys/arm64/acpica X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/arm64/acpica X-SVN-Commit-Revision: 364870 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2020 14:51:45 -0000 Author: markj Date: Thu Aug 27 14:51:44 2020 New Revision: 364870 URL: https://svnweb.freebsd.org/changeset/base/364870 Log: MFC r364410: Remove an unused parameter from map_table(). Modified: stable/12/sys/arm64/acpica/acpi_machdep.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/acpica/acpi_machdep.c ============================================================================== --- stable/12/sys/arm64/acpica/acpi_machdep.c Thu Aug 27 14:50:48 2020 (r364869) +++ stable/12/sys/arm64/acpica/acpi_machdep.c Thu Aug 27 14:51:44 2020 (r364870) @@ -61,7 +61,7 @@ acpi_machdep_quirks(int *quirks) } static void * -map_table(vm_paddr_t pa, int offset, const char *sig) +map_table(vm_paddr_t pa, const char *sig) { ACPI_TABLE_HEADER *header; vm_offset_t length; @@ -130,7 +130,7 @@ void * acpi_map_table(vm_paddr_t pa, const char *sig) { - return (map_table(pa, 0, sig)); + return (map_table(pa, sig)); } /* @@ -176,7 +176,7 @@ acpi_find_table(const char *sig) printf("ACPI: RSDP failed extended checksum\n"); return (0); } - xsdt = map_table(rsdp->XsdtPhysicalAddress, 2, ACPI_SIG_XSDT); + xsdt = map_table(rsdp->XsdtPhysicalAddress, ACPI_SIG_XSDT); if (xsdt == NULL) { if (bootverbose) printf("ACPI: Failed to map XSDT\n"); @@ -202,7 +202,7 @@ acpi_find_table(const char *sig) * Verify that we can map the full table and that its checksum is * correct, etc. */ - table = map_table(addr, 0, sig); + table = map_table(addr, sig); if (table == NULL) return (0); acpi_unmap_table(table); From owner-svn-src-stable-12@freebsd.org Thu Aug 27 19:12:48 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1FFC63BF088; Thu, 27 Aug 2020 19:12:48 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Bcsn670bsz4XLG; Thu, 27 Aug 2020 19:12:42 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 C8B738DB5; Thu, 27 Aug 2020 19:12:40 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07RJCePB067498; Thu, 27 Aug 2020 19:12:40 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07RJCeXd067497; Thu, 27 Aug 2020 19:12:40 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <202008271912.07RJCeXd067497@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Thu, 27 Aug 2020 19:12:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364878 - stable/12/sys/dev/e1000 X-SVN-Group: stable-12 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: stable/12/sys/dev/e1000 X-SVN-Commit-Revision: 364878 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2020 19:12:49 -0000 Author: vmaffione Date: Thu Aug 27 19:12:39 2020 New Revision: 364878 URL: https://svnweb.freebsd.org/changeset/base/364878 Log: MFC r363995 em(4): honor vlanhwtag offload The FreeBSD em driver fails to properly reset the VME flag in the e1000 CTRL register oneg the following ifconfig command ifconfig em1 -vlanhwtag Tested on the e1000 device emulated by QEMU, and on a real NIC (chip=0x10d38086). PR: 236584 Submitted by: murat@sunnyvalley.io Reported by: murat@sunnyvalley.io Differential Revision: https://reviews.freebsd.org/D25286 Modified: stable/12/sys/dev/e1000/if_em.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/e1000/if_em.c ============================================================================== --- stable/12/sys/dev/e1000/if_em.c Thu Aug 27 17:46:13 2020 (r364877) +++ stable/12/sys/dev/e1000/if_em.c Thu Aug 27 19:12:39 2020 (r364878) @@ -1330,6 +1330,11 @@ em_if_init(if_ctx_t ctx) ctrl |= E1000_CTRL_VME; E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); } + } else { + u32 ctrl; + ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL); + ctrl &= ~E1000_CTRL_VME; + E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); } /* Don't lose promiscuous settings */ From owner-svn-src-stable-12@freebsd.org Thu Aug 27 19:35:04 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 78A173C1339; Thu, 27 Aug 2020 19:35:04 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BctGw2cDGz4fqJ; Thu, 27 Aug 2020 19:35:04 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 228EA9339; Thu, 27 Aug 2020 19:35:04 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07RJZ4ea080223; Thu, 27 Aug 2020 19:35:04 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07RJZ26L080216; Thu, 27 Aug 2020 19:35:02 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008271935.07RJZ26L080216@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 27 Aug 2020 19:35:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364880 - in stable/12/libexec/rc: . rc.d X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in stable/12/libexec/rc: . rc.d X-SVN-Commit-Revision: 364880 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2020 19:35:04 -0000 Author: trasz Date: Thu Aug 27 19:35:02 2020 New Revision: 364880 URL: https://svnweb.freebsd.org/changeset/base/364880 Log: MFC r352836: Move the SysV IPC stuff out of the 'abi' rc script, into a new one: 'sysvipc' - it has nothing to do with ABIs, and I'd like to later rename 'abi' to 'linux', which better describes its purpose and also matches the rcvar name. Sponsored by: The FreeBSD Foundation Added: stable/12/libexec/rc/rc.d/sysvipc - copied unchanged from r352836, head/libexec/rc/rc.d/sysvipc Modified: stable/12/libexec/rc/rc.conf stable/12/libexec/rc/rc.d/Makefile stable/12/libexec/rc/rc.d/SERVERS stable/12/libexec/rc/rc.d/abi stable/12/libexec/rc/rc.d/localpkg Directory Properties: stable/12/ (props changed) Modified: stable/12/libexec/rc/rc.conf ============================================================================== --- stable/12/libexec/rc/rc.conf Thu Aug 27 19:15:09 2020 (r364879) +++ stable/12/libexec/rc/rc.conf Thu Aug 27 19:35:02 2020 (r364880) @@ -640,8 +640,6 @@ ibcs2_loaders="coff" # List of additional Ibcs2 loader firstboot_sentinel="/firstboot" # Scripts with "firstboot" keyword are run if # this file exists. Should be on a R/W filesystem so # the file can be deleted after the boot completes. - -# Emulation/compatibility services provided by /etc/rc.d/abi sysvipc_enable="NO" # Load System V IPC primitives at startup (or NO). linux_enable="NO" # Linux binary compatibility loaded at startup (or NO). clear_tmp_enable="NO" # Clear /tmp at startup. Modified: stable/12/libexec/rc/rc.d/Makefile ============================================================================== --- stable/12/libexec/rc/rc.d/Makefile Thu Aug 27 19:15:09 2020 (r364879) +++ stable/12/libexec/rc/rc.d/Makefile Thu Aug 27 19:35:02 2020 (r364880) @@ -111,6 +111,7 @@ CONFS= DAEMON \ swaplate \ sysctl \ syslogd \ + sysvipc \ tmp \ ${_ubthidhci} \ ugidfw \ Modified: stable/12/libexec/rc/rc.d/SERVERS ============================================================================== --- stable/12/libexec/rc/rc.d/SERVERS Thu Aug 27 19:15:09 2020 (r364879) +++ stable/12/libexec/rc/rc.d/SERVERS Thu Aug 27 19:35:02 2020 (r364880) @@ -4,7 +4,7 @@ # # PROVIDE: SERVERS -# REQUIRE: mountcritremote abi ldconfig savecore watchdogd +# REQUIRE: mountcritremote sysvipc abi ldconfig savecore watchdogd # This is a dummy dependency, for early-start servers relying on # some basic configuration. Modified: stable/12/libexec/rc/rc.d/abi ============================================================================== --- stable/12/libexec/rc/rc.d/abi Thu Aug 27 19:15:09 2020 (r364879) +++ stable/12/libexec/rc/rc.d/abi Thu Aug 27 19:35:02 2020 (r364880) @@ -14,14 +14,6 @@ desc="Enable foreign ABIs" start_cmd="${name}_start" stop_cmd=":" -sysv_start() -{ - echo -n ' sysvipc' - load_kld sysvmsg - load_kld sysvsem - load_kld sysvshm -} - linux_start() { local _tmpdir @@ -48,12 +40,11 @@ abi_start() local _echostop _echostop= - if checkyesno sysvipc_enable || checkyesno linux_enable; then + if checkyesno linux_enable; then echo -n 'Additional ABI support:' _echostop=yes fi - checkyesno sysvipc_enable && sysv_start checkyesno linux_enable && linux_start [ -n "${_echostop}" ] && echo '.' Modified: stable/12/libexec/rc/rc.d/localpkg ============================================================================== --- stable/12/libexec/rc/rc.d/localpkg Thu Aug 27 19:15:09 2020 (r364879) +++ stable/12/libexec/rc/rc.d/localpkg Thu Aug 27 19:35:02 2020 (r364880) @@ -4,7 +4,7 @@ # # PROVIDE: localpkg -# REQUIRE: abi +# REQUIRE: sysvipc abi # BEFORE: securelevel # KEYWORD: shutdown Copied: stable/12/libexec/rc/rc.d/sysvipc (from r352836, head/libexec/rc/rc.d/sysvipc) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/libexec/rc/rc.d/sysvipc Thu Aug 27 19:35:02 2020 (r364880, copy of r352836, head/libexec/rc/rc.d/sysvipc) @@ -0,0 +1,26 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: sysvipc +# REQUIRE: archdep +# KEYWORD: nojail + +. /etc/rc.subr + +name="sysvipc" +desc="Load SysV IPC modules" +rcvar="sysvipc_enable" +start_cmd="${name}_start" +stop_cmd=":" + +sysvipc_start() +{ + load_kld sysvmsg + load_kld sysvsem + load_kld sysvshm +} + +load_rc_config $name +run_rc_command "$1" From owner-svn-src-stable-12@freebsd.org Thu Aug 27 19:37:29 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7E1223C1799; Thu, 27 Aug 2020 19:37:29 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BctKj2jgtz4fwy; Thu, 27 Aug 2020 19:37:29 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 28D4F93DF; Thu, 27 Aug 2020 19:37:29 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07RJbTpg080541; Thu, 27 Aug 2020 19:37:29 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07RJbS7o080538; Thu, 27 Aug 2020 19:37:28 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008271937.07RJbS7o080538@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 27 Aug 2020 19:37:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364881 - stable/12/libexec/rc/rc.d X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/libexec/rc/rc.d X-SVN-Commit-Revision: 364881 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2020 19:37:29 -0000 Author: trasz Date: Thu Aug 27 19:37:28 2020 New Revision: 364881 URL: https://svnweb.freebsd.org/changeset/base/364881 Log: MFC r352999: Rename etc/rc.d/abi to etc/rc.d/linux; after moving out the SysV IPC stuff it's entirely linux-specific. MFC r353054: Add rcvar back to the linux rc script. Without it it was enabled unconditionally. Sponsored by: The FreeBSD Foundation Added: stable/12/libexec/rc/rc.d/linux - copied, changed from r352999, head/libexec/rc/rc.d/linux Deleted: stable/12/libexec/rc/rc.d/abi Modified: stable/12/libexec/rc/rc.d/Makefile stable/12/libexec/rc/rc.d/SERVERS stable/12/libexec/rc/rc.d/localpkg Directory Properties: stable/12/ (props changed) Modified: stable/12/libexec/rc/rc.d/Makefile ============================================================================== --- stable/12/libexec/rc/rc.d/Makefile Thu Aug 27 19:35:02 2020 (r364880) +++ stable/12/libexec/rc/rc.d/Makefile Thu Aug 27 19:37:28 2020 (r364881) @@ -11,7 +11,6 @@ CONFS= DAEMON \ LOGIN \ NETWORKING \ SERVERS \ - abi \ addswap \ adjkerntz \ archdep \ @@ -54,6 +53,7 @@ CONFS= DAEMON \ kldxref \ ${_kpasswdd} \ ldconfig \ + linux \ local \ localpkg \ lockd \ Modified: stable/12/libexec/rc/rc.d/SERVERS ============================================================================== --- stable/12/libexec/rc/rc.d/SERVERS Thu Aug 27 19:35:02 2020 (r364880) +++ stable/12/libexec/rc/rc.d/SERVERS Thu Aug 27 19:37:28 2020 (r364881) @@ -4,7 +4,7 @@ # # PROVIDE: SERVERS -# REQUIRE: mountcritremote sysvipc abi ldconfig savecore watchdogd +# REQUIRE: mountcritremote sysvipc linux ldconfig savecore watchdogd # This is a dummy dependency, for early-start servers relying on # some basic configuration. Copied and modified: stable/12/libexec/rc/rc.d/linux (from r352999, head/libexec/rc/rc.d/linux) ============================================================================== --- head/libexec/rc/rc.d/linux Wed Oct 2 11:40:40 2019 (r352999, copy source) +++ stable/12/libexec/rc/rc.d/linux Thu Aug 27 19:37:28 2020 (r364881) @@ -11,6 +11,7 @@ name="linux" desc="Enable Linux ABI" +rcvar="linux_enable" start_cmd="${name}_start" stop_cmd=":" Modified: stable/12/libexec/rc/rc.d/localpkg ============================================================================== --- stable/12/libexec/rc/rc.d/localpkg Thu Aug 27 19:35:02 2020 (r364880) +++ stable/12/libexec/rc/rc.d/localpkg Thu Aug 27 19:37:28 2020 (r364881) @@ -4,7 +4,7 @@ # # PROVIDE: localpkg -# REQUIRE: sysvipc abi +# REQUIRE: sysvipc linux # BEFORE: securelevel # KEYWORD: shutdown From owner-svn-src-stable-12@freebsd.org Thu Aug 27 19:40:38 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 906803C1869; Thu, 27 Aug 2020 19:40:38 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BctPL1CCBz4gL5; Thu, 27 Aug 2020 19:40:37 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 600A0940C; Thu, 27 Aug 2020 19:40:34 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07RJeYcO081022; Thu, 27 Aug 2020 19:40:34 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07RJeYvw081021; Thu, 27 Aug 2020 19:40:34 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008271940.07RJeYvw081021@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 27 Aug 2020 19:40:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364882 - stable/12/libexec/rc/rc.d X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/libexec/rc/rc.d X-SVN-Commit-Revision: 364882 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2020 19:40:38 -0000 Author: trasz Date: Thu Aug 27 19:40:33 2020 New Revision: 364882 URL: https://svnweb.freebsd.org/changeset/base/364882 Log: MFC r354458: Extend the linux rc script to mount the neccessary file systems, set ELF fallback brand, and load pty(4). Sponsored by: The FreeBSD Foundation Modified: stable/12/libexec/rc/rc.d/linux Directory Properties: stable/12/ (props changed) Modified: stable/12/libexec/rc/rc.d/linux ============================================================================== --- stable/12/libexec/rc/rc.d/linux Thu Aug 27 19:37:28 2020 (r364881) +++ stable/12/libexec/rc/rc.d/linux Thu Aug 27 19:40:33 2020 (r364882) @@ -17,7 +17,7 @@ stop_cmd=":" linux_start() { - local _tmpdir + local _emul_path _tmpdir load_kld -e 'linux(aout|elf)' linux case `sysctl -n hw.machine_arch` in @@ -33,6 +33,25 @@ linux_start() fi rm -rf ${_tmpdir} fi + + # Linux uses the pre-pts(4) tty naming scheme. + load_kld pty + + # Handle unbranded ELF executables by defaulting to ELFOSABI_LINUX. + if [ `sysctl -ni kern.elf64.fallback_brand` -eq "-1" ]; then + sysctl kern.elf64.fallback_brand=3 > /dev/null + fi + + if [ `sysctl -ni kern.elf32.fallback_brand` -eq "-1" ]; then + sysctl kern.elf32.fallback_brand=3 > /dev/null + fi + + _emul_path="/compat/linux" + mount -o nocover -t linprocfs linprocfs "${_emul_path}/proc" + mount -o nocover -t linsysfs linsysfs "${_emul_path}/sys" + mount -o nocover -t devfs devfs "${_emul_path}/dev" + mount -o nocover -t fdescfs fdescfs "${_emul_path}/dev/fd" + mount -o nocover,mode=1777 -t tmpfs tmpfs "${_emul_path}/dev/shm" } load_rc_config $name From owner-svn-src-stable-12@freebsd.org Thu Aug 27 19:41:32 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 83B4D3C1C17; Thu, 27 Aug 2020 19:41:32 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BctQN2twqz4gdN; Thu, 27 Aug 2020 19:41:32 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 4782A9343; Thu, 27 Aug 2020 19:41:32 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07RJfWMS082810; Thu, 27 Aug 2020 19:41:32 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07RJfV2q082808; Thu, 27 Aug 2020 19:41:31 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008271941.07RJfV2q082808@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 27 Aug 2020 19:41:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364883 - in stable/12/libexec/rc: . rc.d X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in stable/12/libexec/rc: . rc.d X-SVN-Commit-Revision: 364883 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2020 19:41:32 -0000 Author: trasz Date: Thu Aug 27 19:41:31 2020 New Revision: 364883 URL: https://svnweb.freebsd.org/changeset/base/364883 Log: MFC r354690: Add 'linux_mounts_enable' rc.conf(5) variable, to make it possible to disable mounting Linux-specific filesystems under /compat/linux when 'linux_enable' is set to YES. Relnotes: yes Sponsored by: The FreeBSD Foundation Modified: stable/12/libexec/rc/rc.conf stable/12/libexec/rc/rc.d/linux Directory Properties: stable/12/ (props changed) Modified: stable/12/libexec/rc/rc.conf ============================================================================== --- stable/12/libexec/rc/rc.conf Thu Aug 27 19:40:33 2020 (r364882) +++ stable/12/libexec/rc/rc.conf Thu Aug 27 19:41:31 2020 (r364883) @@ -642,6 +642,8 @@ firstboot_sentinel="/firstboot" # Scripts with "firstb # the file can be deleted after the boot completes. sysvipc_enable="NO" # Load System V IPC primitives at startup (or NO). linux_enable="NO" # Linux binary compatibility loaded at startup (or NO). +linux_mounts_enable="YES" # If linux_enable is set to YES, mount Linux-specific + # filesystems at startup. clear_tmp_enable="NO" # Clear /tmp at startup. clear_tmp_X="YES" # Clear and recreate X11-related directories in /tmp ldconfig_insecure="NO" # Set to YES to disable ldconfig security checks Modified: stable/12/libexec/rc/rc.d/linux ============================================================================== --- stable/12/libexec/rc/rc.d/linux Thu Aug 27 19:40:33 2020 (r364882) +++ stable/12/libexec/rc/rc.d/linux Thu Aug 27 19:41:31 2020 (r364883) @@ -46,12 +46,14 @@ linux_start() sysctl kern.elf32.fallback_brand=3 > /dev/null fi - _emul_path="/compat/linux" - mount -o nocover -t linprocfs linprocfs "${_emul_path}/proc" - mount -o nocover -t linsysfs linsysfs "${_emul_path}/sys" - mount -o nocover -t devfs devfs "${_emul_path}/dev" - mount -o nocover -t fdescfs fdescfs "${_emul_path}/dev/fd" - mount -o nocover,mode=1777 -t tmpfs tmpfs "${_emul_path}/dev/shm" + if checkyesno linux_mounts_enable; then + _emul_path="/compat/linux" + mount -o nocover -t linprocfs linprocfs "${_emul_path}/proc" + mount -o nocover -t linsysfs linsysfs "${_emul_path}/sys" + mount -o nocover -t devfs devfs "${_emul_path}/dev" + mount -o nocover -t fdescfs fdescfs "${_emul_path}/dev/fd" + mount -o nocover,mode=1777 -t tmpfs tmpfs "${_emul_path}/dev/shm" + fi } load_rc_config $name From owner-svn-src-stable-12@freebsd.org Thu Aug 27 19:42:53 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C3F8E3C1D81; Thu, 27 Aug 2020 19:42:53 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BctRx4fhZz4h1N; Thu, 27 Aug 2020 19:42:53 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 838D49056; Thu, 27 Aug 2020 19:42:53 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07RJgrrg087061; Thu, 27 Aug 2020 19:42:53 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07RJgruX087060; Thu, 27 Aug 2020 19:42:53 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008271942.07RJgruX087060@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 27 Aug 2020 19:42:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364884 - in stable/12: libexec/rc/rc.d share/man/man4 X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in stable/12: libexec/rc/rc.d share/man/man4 X-SVN-Commit-Revision: 364884 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2020 19:42:53 -0000 Author: trasz Date: Thu Aug 27 19:42:52 2020 New Revision: 364884 URL: https://svnweb.freebsd.org/changeset/base/364884 Log: MFC r362935: Make the linux rc script use linrdlnk by default. This fixes Linux gettyname(3), with caveats (see PR). PR: kern/240767 Sponsored by: The FreeBSD Foundation Modified: stable/12/libexec/rc/rc.d/linux stable/12/share/man/man4/linux.4 Directory Properties: stable/12/ (props changed) Modified: stable/12/libexec/rc/rc.d/linux ============================================================================== --- stable/12/libexec/rc/rc.d/linux Thu Aug 27 19:41:31 2020 (r364883) +++ stable/12/libexec/rc/rc.d/linux Thu Aug 27 19:42:52 2020 (r364884) @@ -51,7 +51,7 @@ linux_start() mount -o nocover -t linprocfs linprocfs "${_emul_path}/proc" mount -o nocover -t linsysfs linsysfs "${_emul_path}/sys" mount -o nocover -t devfs devfs "${_emul_path}/dev" - mount -o nocover -t fdescfs fdescfs "${_emul_path}/dev/fd" + mount -o nocover,linrdlnk -t fdescfs fdescfs "${_emul_path}/dev/fd" mount -o nocover,mode=1777 -t tmpfs tmpfs "${_emul_path}/dev/shm" fi } Modified: stable/12/share/man/man4/linux.4 ============================================================================== --- stable/12/share/man/man4/linux.4 Thu Aug 27 19:41:31 2020 (r364883) +++ stable/12/share/man/man4/linux.4 Thu Aug 27 19:42:52 2020 (r364884) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 12, 2020 +.Dd July 4, 2020 .Dt LINUX 4 .Os .Sh NAME @@ -130,7 +130,9 @@ Defaults to 0. .It Pa /compat/linux minimal Linux run-time environment .It Pa /compat/linux/dev/fd -file-descriptor file system, see +file descriptor file system mounted with the +.Cm linrdlnk +option, see .Xr fdescfs 5 .It Pa /compat/linux/dev/shm in-memory file system, see From owner-svn-src-stable-12@freebsd.org Thu Aug 27 19:44:09 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A39363C1C49; Thu, 27 Aug 2020 19:44:09 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BctTP3pn6z4hHw; Thu, 27 Aug 2020 19:44:09 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 65FC5959B; Thu, 27 Aug 2020 19:44:09 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07RJi97U087319; Thu, 27 Aug 2020 19:44:09 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07RJi99N087318; Thu, 27 Aug 2020 19:44:09 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008271944.07RJi99N087318@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 27 Aug 2020 19:44:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364885 - stable/12/share/man/man4 X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/share/man/man4 X-SVN-Commit-Revision: 364885 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2020 19:44:09 -0000 Author: trasz Date: Thu Aug 27 19:44:08 2020 New Revision: 364885 URL: https://svnweb.freebsd.org/changeset/base/364885 Log: MFC r362943: Make linux(4) man page also mention /compat/linux/dev. Sponsored by: The FreeBSD Foundation Modified: stable/12/share/man/man4/linux.4 Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/linux.4 ============================================================================== --- stable/12/share/man/man4/linux.4 Thu Aug 27 19:42:52 2020 (r364884) +++ stable/12/share/man/man4/linux.4 Thu Aug 27 19:44:08 2020 (r364885) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 4, 2020 +.Dd July 5, 2020 .Dt LINUX 4 .Os .Sh NAME @@ -129,6 +129,9 @@ Defaults to 0. .Bl -tag -width /compat/linux/dev/shm -compact .It Pa /compat/linux minimal Linux run-time environment +.It Pa /compat/linux/dev +device file system, see +.Xr devfs 5 .It Pa /compat/linux/dev/fd file descriptor file system mounted with the .Cm linrdlnk From owner-svn-src-stable-12@freebsd.org Fri Aug 28 00:00:39 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 14C683C726B; Fri, 28 Aug 2020 00:00: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Bd09L6rGPz3Swr; Fri, 28 Aug 2020 00:00:38 +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 CE5CCC39C; Fri, 28 Aug 2020 00:00:38 +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 07S00ceK042397; Fri, 28 Aug 2020 00:00:38 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07S00cm0042394; Fri, 28 Aug 2020 00:00:38 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <202008280000.07S00cm0042394@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 28 Aug 2020 00:00:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364897 - in stable/12: . lib/clang sys/conf X-SVN-Group: stable-12 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: in stable/12: . lib/clang sys/conf X-SVN-Commit-Revision: 364897 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Aug 2020 00:00:39 -0000 Author: gjb Date: Fri Aug 28 00:00:37 2020 New Revision: 364897 URL: https://svnweb.freebsd.org/changeset/base/364897 Log: Rename stable/12 to 12.2-PRERELEASE, marking the start of the 12.2 release cycle. Approved by: re (implicit) Sponsored by: Rubicon Communications, LLC (netgate.com) Modified: stable/12/Makefile.inc1 stable/12/Makefile.libcompat stable/12/lib/clang/llvm.build.mk stable/12/sys/conf/newvers.sh Modified: stable/12/Makefile.inc1 ============================================================================== --- stable/12/Makefile.inc1 Thu Aug 27 23:57:30 2020 (r364896) +++ stable/12/Makefile.inc1 Fri Aug 28 00:00:37 2020 (r364897) @@ -126,9 +126,9 @@ TARGET_ABI= gnueabi .endif .endif MACHINE_ABI?= unknown -MACHINE_TRIPLE?=${MACHINE_ARCH:S/amd64/x86_64/:C/[hs]f$//:S/mipsn32/mips64/}-${MACHINE_ABI}-freebsd12.1 +MACHINE_TRIPLE?=${MACHINE_ARCH:S/amd64/x86_64/:C/[hs]f$//:S/mipsn32/mips64/}-${MACHINE_ABI}-freebsd12.2 TARGET_ABI?= unknown -TARGET_TRIPLE?= ${TARGET_ARCH:S/amd64/x86_64/:C/[hs]f$//:S/mipsn32/mips64/}-${TARGET_ABI}-freebsd12.1 +TARGET_TRIPLE?= ${TARGET_ARCH:S/amd64/x86_64/:C/[hs]f$//:S/mipsn32/mips64/}-${TARGET_ABI}-freebsd12.2 KNOWN_ARCHES?= aarch64/arm64 \ amd64 \ arm \ Modified: stable/12/Makefile.libcompat ============================================================================== --- stable/12/Makefile.libcompat Thu Aug 27 23:57:30 2020 (r364896) +++ stable/12/Makefile.libcompat Fri Aug 28 00:00:37 2020 (r364897) @@ -17,7 +17,7 @@ LIB32CPUFLAGS= -march=${TARGET_CPUTYPE} .if ${WANT_COMPILER_TYPE} == gcc || \ (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc) .else -LIB32CPUFLAGS+= -target x86_64-unknown-freebsd12.1 +LIB32CPUFLAGS+= -target x86_64-unknown-freebsd12.2 .endif LIB32CPUFLAGS+= -m32 LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \ @@ -49,9 +49,9 @@ LIB32CPUFLAGS= -march=${TARGET_CPUTYPE} .endif .else .if ${TARGET_ARCH:Mmips64el*} != "" -LIB32CPUFLAGS= -target mipsel-unknown-freebsd12.1 +LIB32CPUFLAGS= -target mipsel-unknown-freebsd12.2 .else -LIB32CPUFLAGS= -target mips-unknown-freebsd12.1 +LIB32CPUFLAGS= -target mips-unknown-freebsd12.2 .endif .endif LIB32CPUFLAGS+= -mabi=32 Modified: stable/12/lib/clang/llvm.build.mk ============================================================================== --- stable/12/lib/clang/llvm.build.mk Thu Aug 27 23:57:30 2020 (r364896) +++ stable/12/lib/clang/llvm.build.mk Fri Aug 28 00:00:37 2020 (r364897) @@ -40,7 +40,7 @@ TARGET_ABI= -gnueabi TARGET_ABI= .endif VENDOR= unknown -OS_VERSION= freebsd12.1 +OS_VERSION= freebsd12.2 LLVM_TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/:C/[hs]f$//:S/mipsn32/mips64/}-${VENDOR}-${OS_VERSION}${TARGET_ABI} LLVM_BUILD_TRIPLE?= ${BUILD_ARCH:C/amd64/x86_64/:C/[hs]f$//:S/mipsn32/mips64/}-${VENDOR}-${OS_VERSION} Modified: stable/12/sys/conf/newvers.sh ============================================================================== --- stable/12/sys/conf/newvers.sh Thu Aug 27 23:57:30 2020 (r364896) +++ stable/12/sys/conf/newvers.sh Fri Aug 28 00:00:37 2020 (r364897) @@ -48,8 +48,8 @@ # upper case variables starting in column 1 are on one line w/o continuation. TYPE="FreeBSD" -REVISION="12.1" -BRANCH=${BRANCH_OVERRIDE:-STABLE} +REVISION="12.2" +BRANCH=${BRANCH_OVERRIDE:-PRERELEASE} RELEASE="${REVISION}-${BRANCH}" VERSION="${TYPE} ${RELEASE}" From owner-svn-src-stable-12@freebsd.org Fri Aug 28 08:13:50 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 28EFC3D16B8; Fri, 28 Aug 2020 08:13:50 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BdC6Q0FpXz4CnC; Fri, 28 Aug 2020 08:13:50 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 C5FE811FA6; Fri, 28 Aug 2020 08:13:49 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07S8Dn08048904; Fri, 28 Aug 2020 08:13:49 GMT (envelope-from philip@FreeBSD.org) Received: (from philip@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07S8DnsQ048903; Fri, 28 Aug 2020 08:13:49 GMT (envelope-from philip@FreeBSD.org) Message-Id: <202008280813.07S8DnsQ048903@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: philip set sender to philip@FreeBSD.org using -f From: Philip Paeps Date: Fri, 28 Aug 2020 08:13:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364902 - in stable/12: share/zoneinfo usr.sbin/tzsetup X-SVN-Group: stable-12 X-SVN-Commit-Author: philip X-SVN-Commit-Paths: in stable/12: share/zoneinfo usr.sbin/tzsetup X-SVN-Commit-Revision: 364902 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Aug 2020 08:13:50 -0000 Author: philip Date: Fri Aug 28 08:13:49 2020 New Revision: 364902 URL: https://svnweb.freebsd.org/changeset/base/364902 Log: MFC r350079: tzsetup: upgrade to zone1970.tab zone.tab is deprecated. Install zone1970.tab alongside it, and use it for tzsetup(8). This is also useful for other applications that need the modern better maintained file. PR: 243394 Submitted by: tmunro Modified: stable/12/share/zoneinfo/Makefile stable/12/usr.sbin/tzsetup/tzsetup.c Directory Properties: stable/12/ (props changed) Modified: stable/12/share/zoneinfo/Makefile ============================================================================== --- stable/12/share/zoneinfo/Makefile Fri Aug 28 05:40:02 2020 (r364901) +++ stable/12/share/zoneinfo/Makefile Fri Aug 28 08:13:49 2020 (r364902) @@ -104,6 +104,8 @@ install-zoneinfo: .endfor ${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \ ${CONTRIBDIR}/zone.tab ${DESTDIR}/usr/share/zoneinfo/ + ${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \ + ${CONTRIBDIR}/zone1970.tab ${DESTDIR}/usr/share/zoneinfo/ afterinstall: # Modified: stable/12/usr.sbin/tzsetup/tzsetup.c ============================================================================== --- stable/12/usr.sbin/tzsetup/tzsetup.c Fri Aug 28 05:40:02 2020 (r364901) +++ stable/12/usr.sbin/tzsetup/tzsetup.c Fri Aug 28 08:13:49 2020 (r364902) @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); #include #endif -#define _PATH_ZONETAB "/usr/share/zoneinfo/zone.tab" +#define _PATH_ZONETAB "/usr/share/zoneinfo/zone1970.tab" #define _PATH_ISO3166 "/usr/share/misc/iso3166" #define _PATH_ZONEINFO "/usr/share/zoneinfo" #define _PATH_LOCALTIME "/etc/localtime" @@ -217,7 +217,7 @@ struct continent { int nitems; }; -static struct continent africa, america, antarctica, arctic, asia, atlantic; +static struct continent africa, america, antarctica, asia, atlantic; static struct continent australia, europe, indian, pacific, utc; static struct continent_names { @@ -227,7 +227,6 @@ static struct continent_names { { "Africa", &africa }, { "America", &america }, { "Antarctica", &antarctica }, - { "Arctic", &arctic }, { "Asia", &asia }, { "Atlantic", &atlantic }, { "Australia", &australia }, @@ -244,21 +243,20 @@ static struct continent_items { { "1", "Africa" }, { "2", "America -- North and South" }, { "3", "Antarctica" }, - { "4", "Arctic Ocean" }, - { "5", "Asia" }, - { "6", "Atlantic Ocean" }, - { "7", "Australia" }, - { "8", "Europe" }, - { "9", "Indian Ocean" }, - { "0", "Pacific Ocean" }, - { "a", "UTC" } + { "4", "Asia" }, + { "5", "Atlantic Ocean" }, + { "6", "Australia" }, + { "7", "Europe" }, + { "8", "Indian Ocean" }, + { "9", "Pacific Ocean" }, + { "0", "UTC" } }; #define NCONTINENTS \ (int)((sizeof(continent_items)) / (sizeof(continent_items[0]))) static dialogMenuItem continents[NCONTINENTS]; -#define OCEANP(x) ((x) == 3 || (x) == 5 || (x) == 8 || (x) == 9) +#define OCEANP(x) ((x) == 4 || (x) == 7 || (x) == 8) static int continent_country_menu(dialogMenuItem *continent) @@ -482,7 +480,7 @@ read_zones(void) FILE *fp; struct continent *cont; size_t len, contlen; - char *line, *tlc, *file, *descr, *p; + char *line, *country_list, *tlc, *file, *descr, *p; int lineno; fp = fopen(path_zonetab, "r"); @@ -498,10 +496,7 @@ read_zones(void) if (line[0] == '#') continue; - tlc = strsep(&line, "\t"); - if (strlen(tlc) != 2) - errx(1, "%s:%d: invalid country code `%s'", - path_zonetab, lineno, tlc); + country_list = strsep(&line, "\t"); /* coord = */ strsep(&line, "\t"); /* Unused */ file = strsep(&line, "\t"); /* get continent portion from continent/country */ @@ -521,7 +516,13 @@ read_zones(void) descr = (line != NULL && *line != '\0') ? line : NULL; - add_zone_to_country(lineno, tlc, descr, file, cont); + while (country_list != NULL) { + tlc = strsep(&country_list, ","); + if (strlen(tlc) != 2) + errx(1, "%s:%d: invalid country code `%s'", + path_zonetab, lineno, tlc); + add_zone_to_country(lineno, tlc, descr, file, cont); + } } fclose(fp); } From owner-svn-src-stable-12@freebsd.org Fri Aug 28 08:50:08 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 705D73D201A; Fri, 28 Aug 2020 08:50:08 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BdCwJ2T1zz4FM6; Fri, 28 Aug 2020 08:50:08 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 3994D1260B; Fri, 28 Aug 2020 08:50:08 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07S8o8Qp067304; Fri, 28 Aug 2020 08:50:08 GMT (envelope-from gbe@FreeBSD.org) Received: (from gbe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07S8o8Ro067303; Fri, 28 Aug 2020 08:50:08 GMT (envelope-from gbe@FreeBSD.org) Message-Id: <202008280850.07S8o8Ro067303@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gbe set sender to gbe@FreeBSD.org using -f From: Gordon Bergling Date: Fri, 28 Aug 2020 08:50:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364904 - stable/12/share/man/man4 X-SVN-Group: stable-12 X-SVN-Commit-Author: gbe X-SVN-Commit-Paths: stable/12/share/man/man4 X-SVN-Commit-Revision: 364904 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Aug 2020 08:50:08 -0000 Author: gbe (doc committer) Date: Fri Aug 28 08:50:07 2020 New Revision: 364904 URL: https://svnweb.freebsd.org/changeset/base/364904 Log: MFC r364450: gre(4): Mention sysctl for nesting gre tunnels PR: 228465 Submitted by: Sergey Akhmatov Reviewed by: bcr Approved by: bcr Differential Revision: https://reviews.freebsd.org/D26097 Modified: stable/12/share/man/man4/gre.4 Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/gre.4 ============================================================================== --- stable/12/share/man/man4/gre.4 Fri Aug 28 08:14:19 2020 (r364903) +++ stable/12/share/man/man4/gre.4 Fri Aug 28 08:50:07 2020 (r364904) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 29, 2020 +.Dd August 21, 2020 .Dt GRE 4 .Os .Sh NAME @@ -210,6 +210,15 @@ The kernel must be set to forward datagrams by setting .Va net.inet.ip.forwarding .Xr sysctl 8 variable to non-zero. +.Pp +By default, +.Nm +tunnels may not be nested. +This behavior may be modified at runtime by setting the +.Xr sysctl 8 +variable +.Va net.link.gre.max_nesting +to the desired level of nesting. .Sh SEE ALSO .Xr gif 4 , .Xr inet 4 , From owner-svn-src-stable-12@freebsd.org Fri Aug 28 08:52:01 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 49C783D22C2; Fri, 28 Aug 2020 08:52:01 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BdCyT1HNhz4FP5; Fri, 28 Aug 2020 08:52:01 +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 0F866124A8; Fri, 28 Aug 2020 08:52:01 +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 07S8q03J070990; Fri, 28 Aug 2020 08:52:00 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07S8q0mh070989; Fri, 28 Aug 2020 08:52:00 GMT (envelope-from avg@FreeBSD.org) Message-Id: <202008280852.07S8q0mh070989@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 28 Aug 2020 08:52:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364905 - stable/12/sys/cam/scsi X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/cam/scsi X-SVN-Commit-Revision: 364905 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Aug 2020 08:52:01 -0000 Author: avg Date: Fri Aug 28 08:52:00 2020 New Revision: 364905 URL: https://svnweb.freebsd.org/changeset/base/364905 Log: MFC r354668 by imp: Fix a race between daopen and damediapoll Modified: stable/12/sys/cam/scsi/scsi_da.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/12/sys/cam/scsi/scsi_da.c Fri Aug 28 08:50:07 2020 (r364904) +++ stable/12/sys/cam/scsi/scsi_da.c Fri Aug 28 08:52:00 2020 (r364905) @@ -5929,6 +5929,7 @@ damediapoll(void *arg) if (!cam_iosched_has_work_flags(softc->cam_iosched, DA_WORK_TUR) && (softc->flags & DA_FLAG_TUR_PENDING) == 0 && + softc->state == DA_STATE_NORMAL && LIST_EMPTY(&softc->pending_ccbs)) { if (da_periph_acquire(periph, DA_REF_TUR) == 0) { cam_iosched_set_work_flags(softc->cam_iosched, DA_WORK_TUR); From owner-svn-src-stable-12@freebsd.org Fri Aug 28 08:54:28 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 605883D252A; Fri, 28 Aug 2020 08:54:28 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BdD1J1xqQz4FrY; Fri, 28 Aug 2020 08:54:28 +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 25E1C1243E; Fri, 28 Aug 2020 08:54:28 +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 07S8sSmn073669; Fri, 28 Aug 2020 08:54:28 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07S8sSBC073668; Fri, 28 Aug 2020 08:54:28 GMT (envelope-from avg@FreeBSD.org) Message-Id: <202008280854.07S8sSBC073668@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 28 Aug 2020 08:54:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364906 - stable/12/sys/cam X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/cam X-SVN-Commit-Revision: 364906 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Aug 2020 08:54:28 -0000 Author: avg Date: Fri Aug 28 08:54:27 2020 New Revision: 364906 URL: https://svnweb.freebsd.org/changeset/base/364906 Log: MFC r358662 by imp: xpt_async is submitting a CCB, not finishing it up, so use xpt_action() instead of xpt_done(). Modified: stable/12/sys/cam/cam_xpt.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/cam_xpt.c ============================================================================== --- stable/12/sys/cam/cam_xpt.c Fri Aug 28 08:52:00 2020 (r364905) +++ stable/12/sys/cam/cam_xpt.c Fri Aug 28 08:54:27 2020 (r364906) @@ -3171,6 +3171,10 @@ call_sim: start_ccb->ccb_h.status = CAM_REQ_CMP; xpt_done(start_ccb); break; + case XPT_ASYNC: + start_ccb->ccb_h.status = CAM_REQ_CMP; + xpt_done(start_ccb); + break; default: case XPT_SDEV_TYPE: case XPT_TERM_IO: @@ -4462,7 +4466,7 @@ xpt_async(u_int32_t async_code, struct cam_path *path, xpt_freeze_devq(path, 1); else xpt_freeze_simq(path->bus->sim, 1); - xpt_done(ccb); + xpt_action(ccb); } static void From owner-svn-src-stable-12@freebsd.org Fri Aug 28 10:01:04 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 01A543D3A04; Fri, 28 Aug 2020 10:01:04 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BdFV767rfz4JKL; Fri, 28 Aug 2020 10:01:03 +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 B6329131A7; Fri, 28 Aug 2020 10:01:03 +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 07SA13kO011190; Fri, 28 Aug 2020 10:01:03 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07SA13gG011188; Fri, 28 Aug 2020 10:01:03 GMT (envelope-from avg@FreeBSD.org) Message-Id: <202008281001.07SA13gG011188@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 28 Aug 2020 10:01:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364907 - stable/12/sys/cam X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/cam X-SVN-Commit-Revision: 364907 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Aug 2020 10:01:04 -0000 Author: avg Date: Fri Aug 28 10:01:03 2020 New Revision: 364907 URL: https://svnweb.freebsd.org/changeset/base/364907 Log: MFC r358864 by imp: Eliminate xpt_copy_path. Modified: stable/12/sys/cam/cam_xpt.c stable/12/sys/cam/cam_xpt.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/cam_xpt.c ============================================================================== --- stable/12/sys/cam/cam_xpt.c Fri Aug 28 08:54:27 2020 (r364906) +++ stable/12/sys/cam/cam_xpt.c Fri Aug 28 10:01:03 2020 (r364907) @@ -804,7 +804,8 @@ static void xpt_scanner_thread(void *dummy) { union ccb *ccb; - struct cam_path path; + struct mtx *mtx; + struct cam_ed *device; xpt_lock_buses(); for (;;) { @@ -816,15 +817,22 @@ xpt_scanner_thread(void *dummy) xpt_unlock_buses(); /* - * Since lock can be dropped inside and path freed - * by completion callback even before return here, - * take our own path copy for reference. + * We need to lock the device's mutex which we use as + * the path mutex. We can't do it directly because the + * cam_path in the ccb may wind up going away because + * the path lock may be dropped and the path retired in + * the completion callback. We do this directly to keep + * the reference counts in cam_path sane. We also have + * to copy the device pointer because ccb_h.path may + * be freed in the callback. */ - xpt_copy_path(&path, ccb->ccb_h.path); - xpt_path_lock(&path); + mtx = xpt_path_mtx(ccb->ccb_h.path); + device = ccb->ccb_h.path->device; + xpt_acquire_device(device); + mtx_lock(mtx); xpt_action(ccb); - xpt_path_unlock(&path); - xpt_release_path(&path); + mtx_unlock(mtx); + xpt_release_device(device); xpt_lock_buses(); } @@ -3701,15 +3709,6 @@ xpt_clone_path(struct cam_path **new_path_ptr, struct new_path = (struct cam_path *)malloc(sizeof(*path), M_CAMPATH, M_NOWAIT); if (new_path == NULL) return(CAM_RESRC_UNAVAIL); - xpt_copy_path(new_path, path); - *new_path_ptr = new_path; - return (CAM_REQ_CMP); -} - -void -xpt_copy_path(struct cam_path *new_path, struct cam_path *path) -{ - *new_path = *path; if (path->bus != NULL) xpt_acquire_bus(path->bus); @@ -3717,6 +3716,8 @@ xpt_copy_path(struct cam_path *new_path, struct cam_pa xpt_acquire_target(path->target); if (path->device != NULL) xpt_acquire_device(path->device); + *new_path_ptr = new_path; + return (CAM_REQ_CMP); } void Modified: stable/12/sys/cam/cam_xpt.h ============================================================================== --- stable/12/sys/cam/cam_xpt.h Fri Aug 28 08:54:27 2020 (r364906) +++ stable/12/sys/cam/cam_xpt.h Fri Aug 28 10:01:03 2020 (r364907) @@ -140,8 +140,6 @@ cam_status xpt_compile_path(struct cam_path *new_path lun_id_t lun_id); cam_status xpt_clone_path(struct cam_path **new_path, struct cam_path *path); -void xpt_copy_path(struct cam_path *new_path, - struct cam_path *path); void xpt_release_path(struct cam_path *path); From owner-svn-src-stable-12@freebsd.org Fri Aug 28 10:15:55 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 073A03D3DE9; Fri, 28 Aug 2020 10:15:55 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BdFqG6S8bz4KKL; Fri, 28 Aug 2020 10:15:54 +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 C0B02131ED; Fri, 28 Aug 2020 10:15:54 +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 07SAFsBo022711; Fri, 28 Aug 2020 10:15:54 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07SAFsL9022710; Fri, 28 Aug 2020 10:15:54 GMT (envelope-from avg@FreeBSD.org) Message-Id: <202008281015.07SAFsL9022710@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 28 Aug 2020 10:15:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364908 - stable/12/share/man/man4 X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/share/man/man4 X-SVN-Commit-Revision: 364908 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Aug 2020 10:15:55 -0000 Author: avg Date: Fri Aug 28 10:15:54 2020 New Revision: 364908 URL: https://svnweb.freebsd.org/changeset/base/364908 Log: MFC r363905: gpiokeys: add a basic manual page Added: stable/12/share/man/man4/gpiokeys.4 - copied unchanged from r363905, head/share/man/man4/gpiokeys.4 Modified: Directory Properties: stable/12/ (props changed) Copied: stable/12/share/man/man4/gpiokeys.4 (from r363905, head/share/man/man4/gpiokeys.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/share/man/man4/gpiokeys.4 Fri Aug 28 10:15:54 2020 (r364908, copy of r363905, head/share/man/man4/gpiokeys.4) @@ -0,0 +1,152 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD +.\" +.\" Copyright (c) 2020 Andriy Gapon +.\" +.\" 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 August 5, 2020 +.Dt GPIOKEYS 4 +.Os +.Sh NAME +.Nm gpiokeys +.Nd GPIO keys device driver +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "options FDT" +.Cd "device gpio" +.Cd "device gpiokeys" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +gpiokeys_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides a way to represent a set of general purpose inputs as a +.Xr keyboard 4 +device. +At the moment the driver supports only +.Xr FDT 4 +based systems. +The DTS determines what pins are mapped to buttons and what key codes are +generated for each virtual button. +The +.Xr keyboard 4 +device can be used from userland to monitor for input changes. +.Pp +On an +.Xr FDT 4 +based system +the DTS part for a +.Nm +device usually looks like: +.Bd -literal +/ { + + ... + + gpio_keys { + compatible = "gpio-keys"; + + btn1 { + label = "button1"; + linux,code = ; + gpios = <&gpio 0 3 GPIO_ACTIVE_LOW> + }; + + btn2 { + label = "button2"; + linux,code = ; + gpios = <&gpio 0 4 GPIO_ACTIVE_LOW> + }; + }; +}; +.Ed +.Pp +For more details about the +.Va gpios +property, please consult +.Pa /usr/src/sys/dts/bindings-gpio.txt . +.Pp +The +.Nm +driver supports two properties for specifying a key code. +.Pp +The property +.Va freebsd,code +specifies a +.Fx +native scancode compatible with +.Xr kbdmap 5 +keyboard maps. +.Pp +The property +.Va linux,code +specifies an evdev scancode. +That scancode is internally translated to a native scancode. +Note that not all evdev scancodes have corresponding native scancodes. +If a scancode cannot be translated, then a diagnostic message is printed +and the input is ignored. +.Pp +The property +.Va label +is a descriptive name of a button. +It is used for diagnostic messages only. +This property is optional. +If not set, the node name is used in its place. +.Pp +The property +.Va autorepeat +determines whether autorepeat is enabled for a button. +.Pp +The property +.Va debounce-interval +defines debouncing interval time in milliseconds. +If not specified the interval defaults to 5. +.Sh SEE ALSO +.Xr fdt 4 , +.Xr gpio 4 , +.Xr keyboard 4 , +.Xr kbdmap 5 +.Sh HISTORY +The +.Nm +manual page first appeared in +.Fx 12.2 . +.Sh AUTHORS +The +.Nm +driver was written by +.An Oleksandr Tymoshenko Aq Mt gonzo@FreeBSD.org . +This +manual page was written by +.An Andriy Gapon Aq Mt avg@FreeBSD.org . From owner-svn-src-stable-12@freebsd.org Fri Aug 28 10:17:10 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3F2163D3E1B; Fri, 28 Aug 2020 10:17:10 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BdFrk0wjfz4KVS; Fri, 28 Aug 2020 10:17:10 +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 0398F1368B; Fri, 28 Aug 2020 10:17:10 +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 07SAH9xn022844; Fri, 28 Aug 2020 10:17:09 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07SAH9Qa022843; Fri, 28 Aug 2020 10:17:09 GMT (envelope-from avg@FreeBSD.org) Message-Id: <202008281017.07SAH9Qa022843@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 28 Aug 2020 10:17:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364909 - stable/12/sys/arm/allwinner/clkng X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/arm/allwinner/clkng X-SVN-Commit-Revision: 364909 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Aug 2020 10:17:10 -0000 Author: avg Date: Fri Aug 28 10:17:09 2020 New Revision: 364909 URL: https://svnweb.freebsd.org/changeset/base/364909 Log: MFC r363948: ccu_sun8i_r: minor comment update Modified: stable/12/sys/arm/allwinner/clkng/ccu_sun8i_r.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm/allwinner/clkng/ccu_sun8i_r.c ============================================================================== --- stable/12/sys/arm/allwinner/clkng/ccu_sun8i_r.c Fri Aug 28 10:15:54 2020 (r364908) +++ stable/12/sys/arm/allwinner/clkng/ccu_sun8i_r.c Fri Aug 28 10:17:09 2020 (r364909) @@ -119,7 +119,7 @@ NM_CLK(r_ccu_ir_clk, "ir", r_ccu_ir_parents, /* names, parents */ 0x54, /* offset */ 0, 4, 0, 0, /* N factor */ - 16, 2, 0, 0, /* M flags */ + 16, 2, 0, 0, /* M factor */ 24, 2, /* mux */ 31, /* gate */ AW_CLK_HAS_MUX | AW_CLK_REPARENT | AW_CLK_HAS_GATE);/* flags */ From owner-svn-src-stable-12@freebsd.org Fri Aug 28 10:18:30 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ABB5A3D400A; Fri, 28 Aug 2020 10:18:30 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BdFtG43ndz4KYh; Fri, 28 Aug 2020 10:18:30 +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 7038D1368C; Fri, 28 Aug 2020 10:18:30 +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 07SAIUHX022969; Fri, 28 Aug 2020 10:18:30 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07SAIUFA022968; Fri, 28 Aug 2020 10:18:30 GMT (envelope-from avg@FreeBSD.org) Message-Id: <202008281018.07SAIUFA022968@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 28 Aug 2020 10:18:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364910 - stable/12/share/man/man4 X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/share/man/man4 X-SVN-Commit-Revision: 364910 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Aug 2020 10:18:30 -0000 Author: avg Date: Fri Aug 28 10:18:30 2020 New Revision: 364910 URL: https://svnweb.freebsd.org/changeset/base/364910 Log: MFC r364155: hook cp2112.4 to the build Modified: stable/12/share/man/man4/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/Makefile ============================================================================== --- stable/12/share/man/man4/Makefile Fri Aug 28 10:17:09 2020 (r364909) +++ stable/12/share/man/man4/Makefile Fri Aug 28 10:18:30 2020 (r364910) @@ -119,6 +119,7 @@ MAN= aac.4 \ cloudabi.4 \ cmx.4 \ ${_coretemp.4} \ + cp2112.4 \ ${_cpuctl.4} \ cpufreq.4 \ crypto.4 \ From owner-svn-src-stable-12@freebsd.org Fri Aug 28 10:21:12 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6B6533D3F3C; Fri, 28 Aug 2020 10:21:12 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BdFxN2HY1z4KrH; Fri, 28 Aug 2020 10:21:12 +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 32DBC13805; Fri, 28 Aug 2020 10:21:12 +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 07SALCnE023968; Fri, 28 Aug 2020 10:21:12 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07SALCdb023967; Fri, 28 Aug 2020 10:21:12 GMT (envelope-from avg@FreeBSD.org) Message-Id: <202008281021.07SALCdb023967@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 28 Aug 2020 10:21:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364911 - stable/12/share/man/man4 X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/share/man/man4 X-SVN-Commit-Revision: 364911 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Aug 2020 10:21:12 -0000 Author: avg Date: Fri Aug 28 10:21:11 2020 New Revision: 364911 URL: https://svnweb.freebsd.org/changeset/base/364911 Log: MFC r364154: hook gpiokeys.4 to the build Modified: stable/12/share/man/man4/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/Makefile ============================================================================== --- stable/12/share/man/man4/Makefile Fri Aug 28 10:18:30 2020 (r364910) +++ stable/12/share/man/man4/Makefile Fri Aug 28 10:21:11 2020 (r364911) @@ -183,6 +183,7 @@ MAN= aac.4 \ gif.4 \ gpio.4 \ gpioiic.4 \ + gpiokeys.4 \ gpioled.4 \ gpioths.4 \ gre.4 \ From owner-svn-src-stable-12@freebsd.org Fri Aug 28 10:24:15 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BDCA43D40DD; Fri, 28 Aug 2020 10:24:15 +0000 (UTC) (envelope-from agapon@gmail.com) Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BdG0t4zT2z4LG6; Fri, 28 Aug 2020 10:24:14 +0000 (UTC) (envelope-from agapon@gmail.com) Received: by mail-lf1-f52.google.com with SMTP id u25so430252lfm.10; Fri, 28 Aug 2020 03:24:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=EmJFt0IaTafC7nDhuawlYTxWqRVshdsqZIbvwNJ5LTk=; b=fh1a8Dw5P7/2r4lKUTbgnfRenMXSyFh/dhNDtE27qe7rdoo+yOuuksssSC6EAVoJsy muWLWgDDbe4zwAPUtmGKwiM8phwTlB7rZAm29qCRQSZO1ZiS+0FxqgzS7zJnKfd7lc2V Ikfd00ZHC3CUDWGqSQ1fKemFbZJTyJ/YNSf8aZ+28/GmYcgtarUa2C7B5GJBl00JnuoO Ub3uk2RFOI5kmCrBg+v95fccZATwHydla1WLISIK0V5iwEPyfI2+F1AUC8DboAY+Q0+C zSQH1i77+KBM8Bf8V3i1GMwaBfz2PPcpkZj+QCg7os6+IyJlD1iekLOBXnxuKkq8o/Zx li2g== X-Gm-Message-State: AOAM533DHfZ+TlMtrSJzE7eVL17ZgmNYjoyzS3wLvTGod2XEpnqcQxdE SIcGKGO3cHuj4iVEMgQQ0Nj66mrSLl0= X-Google-Smtp-Source: ABdhPJzqB+fhjl3KzBXil/cfyDbQvof5ZR37gMrJRuWWoqJmJ2pGTJ8y/RkoQ5KCx4ns7DRluAHC6g== X-Received: by 2002:a19:cca:: with SMTP id 193mr482403lfm.208.1598610252330; Fri, 28 Aug 2020 03:24:12 -0700 (PDT) Received: from [192.168.0.88] (east.meadow.volia.net. [93.72.151.96]) by smtp.googlemail.com with ESMTPSA id j2sm112197ljb.98.2020.08.28.03.24.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 28 Aug 2020 03:24:11 -0700 (PDT) Subject: Re: svn commit: r364910 - stable/12/share/man/man4 To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org References: <202008281018.07SAIUFA022968@repo.freebsd.org> From: Andriy Gapon Openpgp: preference=signencrypt Autocrypt: addr=avg@FreeBSD.org; prefer-encrypt=mutual; keydata= mQINBFm4LIgBEADNB/3lT7f15UKeQ52xCFQx/GqHkSxEdVyLFZTmY3KyNPQGBtyvVyBfprJ7 mAeXZWfhat6cKNRAGZcL5EmewdQuUfQfBdYmKjbw3a9GFDsDNuhDA2QwFt8BmkiVMRYyvI7l N0eVzszWCUgdc3qqM6qqcgBaqsVmJluwpvwp4ZBXmch5BgDDDb1MPO8AZ2QZfIQmplkj8Y6Z AiNMknkmgaekIINSJX8IzRzKD5WwMsin70psE8dpL/iBsA2cpJGzWMObVTtCxeDKlBCNqM1i gTXta1ukdUT7JgLEFZk9ceYQQMJJtUwzWu1UHfZn0Fs29HTqawfWPSZVbulbrnu5q55R4PlQ /xURkWQUTyDpqUvb4JK371zhepXiXDwrrpnyyZABm3SFLkk2bHlheeKU6Yql4pcmSVym1AS4 dV8y0oHAfdlSCF6tpOPf2+K9nW1CFA8b/tw4oJBTtfZ1kxXOMdyZU5fiG7xb1qDgpQKgHUX8 7Rd2T1UVLVeuhYlXNw2F+a2ucY+cMoqz3LtpksUiBppJhw099gEXehcN2JbUZ2TueJdt1FdS ztnZmsHUXLxrRBtGwqnFL7GSd6snpGIKuuL305iaOGODbb9c7ne1JqBbkw1wh8ci6vvwGlzx rexzimRaBzJxlkjNfMx8WpCvYebGMydNoeEtkWldtjTNVsUAtQARAQABtB5BbmRyaXkgR2Fw b24gPGF2Z0BGcmVlQlNELm9yZz6JAlQEEwEIAD4WIQS+LEO7ngQnXA4Bjr538m7TUc1yjwUC WbgsiAIbIwUJBaOagAULCQgHAgYVCAkKCwIEFgIDAQIeAQIXgAAKCRB38m7TUc1yj+JAEACV l9AK/nOWAt/9cufV2fRj0hdOqB1aCshtSrwHk/exXsDa4/FkmegxXQGY+3GWX3deIyesbVRL rYdtdK0dqJyT1SBqXK1h3/at9rxr9GQA6KWOxTjUFURsU7ok/6SIlm8uLRPNKO+yq0GDjgaO LzN+xykuBA0FlhQAXJnpZLcVfPJdWv7sSHGedL5ln8P8rxR+XnmsA5TUaaPcbhTB+mG+iKFj GghASDSfGqLWFPBlX/fpXikBDZ1gvOr8nyMY9nXhgfXpq3B6QCRYKPy58ChrZ5weeJZ29b7/ QdEO8NFNWHjSD9meiLdWQaqo9Y7uUxN3wySc/YUZxtS0bhAd8zJdNPsJYG8sXgKjeBQMVGuT eCAJFEYJqbwWvIXMfVWop4+O4xB+z2YE3jAbG/9tB/GSnQdVSj3G8MS80iLS58frnt+RSEw/ psahrfh0dh6SFHttE049xYiC+cM8J27Aaf0i9RflyITq57NuJm+AHJoU9SQUkIF0nc6lfA+o JRiyRlHZHKoRQkIg4aiKaZSWjQYRl5Txl0IZUP1dSWMX4s3XTMurC/pnja45dge/4ESOtJ9R 8XuIWg45Oq6MeIWdjKddGhRj3OohsltKgkEU3eLKYtB6qRTQypHHUawCXz88uYt5e3w4V16H lCpSTZV/EVHnNe45FVBlvK7k7HFfDDkryLkCDQRZuCyIARAAlq0slcsVboY/+IUJdcbEiJRW be9HKVz4SUchq0z9MZPX/0dcnvz/gkyYA+OuM78dNS7Mbby5dTvOqfpLJfCuhaNYOhlE0wY+ 1T6Tf1f4c/uA3U/YiadukQ3+6TJuYGAdRZD5EqYFIkreARTVWg87N9g0fT9BEqLw9lJtEGDY EWUE7L++B8o4uu3LQFEYxcrb4K/WKmgtmFcm77s0IKDrfcX4doV92QTIpLiRxcOmCC/OCYuO jB1oaaqXQzZrCutXRK0L5XN1Y1PYjIrEzHMIXmCDlLYnpFkK+itlXwlE2ZQxkfMruCWdQXye syl2fynAe8hvp7Mms9qU2r2K9EcJiR5N1t1C2/kTKNUhcRv7Yd/vwusK7BqJbhlng5ZgRx0m WxdntU/JLEntz3QBsBsWM9Y9wf2V4tLv6/DuDBta781RsCB/UrU2zNuOEkSixlUiHxw1dccI 6CVlaWkkJBxmHX22GdDFrcjvwMNIbbyfQLuBq6IOh8nvu9vuItup7qemDG3Ms6TVwA7BD3j+ 3fGprtyW8Fd/RR2bW2+LWkMrqHffAr6Y6V3h5kd2G9Q8ZWpEJk+LG6Mk3fhZhmCnHhDu6CwN MeUvxXDVO+fqc3JjFm5OxhmfVeJKrbCEUJyM8ESWLoNHLqjywdZga4Q7P12g8DUQ1mRxYg/L HgZY3zfKOqcAEQEAAYkCPAQYAQgAJhYhBL4sQ7ueBCdcDgGOvnfybtNRzXKPBQJZuCyIAhsM BQkFo5qAAAoJEHfybtNRzXKPBVwQAKfFy9P7N3OsLDMB56A4Kf+ZT+d5cIx0Yiaf4n6w7m3i ImHHHk9FIetI4Xe54a2IXh4Bq5UkAGY0667eIs+Z1Ea6I2i27Sdo7DxGwq09Qnm/Y65ADvXs 3aBvokCcm7FsM1wky395m8xUos1681oV5oxgqeRI8/76qy0hD9WR65UW+HQgZRIcIjSel9vR XDaD2HLGPTTGr7u4v00UeTMs6qvPsa2PJagogrKY8RXdFtXvweQFz78NbXhluwix2Tb9ETPk LIpDrtzV73CaE2aqBG/KrboXT2C67BgFtnk7T7Y7iKq4/XvEdDWscz2wws91BOXuMMd4c/c4 OmGW9m3RBLufFrOag1q5yUS9QbFfyqL6dftJP3Zq/xe+mr7sbWbhPVCQFrH3r26mpmy841ym dwQnNcsbIGiBASBSKksOvIDYKa2Wy8htPmWFTEOPRpFXdGQ27awcjjnB42nngyCK5ukZDHi6 w0qK5DNQQCkiweevCIC6wc3p67jl1EMFY5+z+zdTPb3h7LeVnGqW0qBQl99vVFgzLxchKcl0 R/paSFgwqXCZhAKMuUHncJuynDOP7z5LirUeFI8qsBAJi1rXpQoLJTVcW72swZ42IdPiboqx NbTMiNOiE36GqMcTPfKylCbF45JNX4nF9ElM0E+Y8gi4cizJYBRr2FBJgay0b9Cp Message-ID: Date: Fri, 28 Aug 2020 13:24:10 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Firefox/60.0 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <202008281018.07SAIUFA022968@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4BdG0t4zT2z4LG6 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of agapon@gmail.com designates 209.85.167.52 as permitted sender) smtp.mailfrom=agapon@gmail.com X-Spamd-Result: default: False [-1.22 / 15.00]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; ARC_NA(0.00)[]; DMARC_NA(0.00)[FreeBSD.org]; NEURAL_HAM_LONG(-0.67)[-0.670]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_HAM_MEDIUM(-0.64)[-0.639]; NEURAL_SPAM_SHORT(0.09)[0.088]; RCVD_IN_DNSWL_NONE(0.00)[209.85.167.52:from]; RECEIVED_SPAMHAUS_PBL(0.00)[93.72.151.96:received]; FORGED_SENDER(0.30)[avg@FreeBSD.org,agapon@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.167.52:from]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[avg@FreeBSD.org,agapon@gmail.com]; FREEMAIL_ENVFROM(0.00)[gmail.com]; MAILMAN_DEST(0.00)[svn-src-stable-12,svn-src-stable,svn-src-all] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Aug 2020 10:24:15 -0000 On 28/08/2020 13:18, Andriy Gapon wrote: > Author: avg > Date: Fri Aug 28 10:18:30 2020 > New Revision: 364910 > URL: https://svnweb.freebsd.org/changeset/base/364910 > > Log: > MFC r364155: hook cp2112.4 to the build This was merged out-of-order. My apologies. > Modified: > stable/12/share/man/man4/Makefile > Directory Properties: > stable/12/ (props changed) > > Modified: stable/12/share/man/man4/Makefile > ============================================================================== > --- stable/12/share/man/man4/Makefile Fri Aug 28 10:17:09 2020 (r364909) > +++ stable/12/share/man/man4/Makefile Fri Aug 28 10:18:30 2020 (r364910) > @@ -119,6 +119,7 @@ MAN= aac.4 \ > cloudabi.4 \ > cmx.4 \ > ${_coretemp.4} \ > + cp2112.4 \ > ${_cpuctl.4} \ > cpufreq.4 \ > crypto.4 \ > -- Andriy Gapon From owner-svn-src-stable-12@freebsd.org Fri Aug 28 10:27:25 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 42A2A3D3E7A; Fri, 28 Aug 2020 10:27:25 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BdG4Y0cTqz4LWN; Fri, 28 Aug 2020 10:27:25 +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 EC1F11391C; Fri, 28 Aug 2020 10:27:24 +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 07SARO3Y029079; Fri, 28 Aug 2020 10:27:24 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07SAROiY029076; Fri, 28 Aug 2020 10:27:24 GMT (envelope-from avg@FreeBSD.org) Message-Id: <202008281027.07SAROiY029076@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 28 Aug 2020 10:27:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364912 - in stable/12: share/man/man4 sys/conf sys/dev/usb/misc sys/modules/usb sys/modules/usb/cp2112 X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/conf sys/dev/usb/misc sys/modules/usb sys/modules/usb/cp2112 X-SVN-Commit-Revision: 364912 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Aug 2020 10:27:25 -0000 Author: avg Date: Fri Aug 28 10:27:24 2020 New Revision: 364912 URL: https://svnweb.freebsd.org/changeset/base/364912 Log: MFC r363951,r364143,r364144: cp2112: driver for the namesake GPIO and I2C master gadget Added: stable/12/share/man/man4/cp2112.4 - copied unchanged from r364144, head/share/man/man4/cp2112.4 stable/12/sys/dev/usb/misc/cp2112.c - copied, changed from r363951, head/sys/dev/usb/misc/cp2112.c stable/12/sys/modules/usb/cp2112/ - copied from r363951, head/sys/modules/usb/cp2112/ Modified: stable/12/sys/conf/files stable/12/sys/modules/usb/Makefile Directory Properties: stable/12/ (props changed) Copied: stable/12/share/man/man4/cp2112.4 (from r364144, head/share/man/man4/cp2112.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/share/man/man4/cp2112.4 Fri Aug 28 10:27:24 2020 (r364912, copy of r364144, head/share/man/man4/cp2112.4) @@ -0,0 +1,87 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD +.\" +.\" Copyright (c) 2020 Andriy Gapon +.\" +.\" 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 August 12, 2020 +.Dt CP2112 4 +.Os +.Sh NAME +.Nm cp2112 +.Nd driver for a USB GPIO and I2C peripheral device +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device cp2112" +.Cd "device usb" +.Cd "device gpio" +.Cd "device iicbus" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +cp2112_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for Silicon Labs CP2112 device. +The device has 8 general purpose I/O pins and an I2C controller that supports +a subset of the I2C protocol. +.Pp +All pins support both input and output modes. +An output pin can be configured either for open-drain or push-pull operation. +Pins 0, 1 and 7 support special functions: I2C transmit indication, +I2C receive indication and clock output respectively. +At the moment the +.Nm +driver does not provide a way to enable and configure the special functions. +.Pp +The I2C controller supports read transactions with up to 512 bytes of data, +write transactions with up to 61 bytes of data and a write followed by +the repeated start followed by a read transactions where the write can be +up to 16 bytes and the read can be up to 512 bytes. +Zero length transfers are not supported. +The +.Nm +driver creates a +.Xr gpio 4 +and +.Xr iicbus 4 +child buses to expose the respective functions. +.Sh SEE ALSO +.Xr gpio 4 , +.Xr iicbus 4 , +.Xr usb 4 +.Sh HISTORY +The +.Nm +driver and this manual page was written by +.An Andriy Gapon Aq Mt avg@FreeBSD.org . Modified: stable/12/sys/conf/files ============================================================================== --- stable/12/sys/conf/files Fri Aug 28 10:21:11 2020 (r364911) +++ stable/12/sys/conf/files Fri Aug 28 10:27:24 2020 (r364912) @@ -3438,6 +3438,7 @@ dev/usb/serial/usb_serial.c optional ucom | u3g | uar # # USB misc drivers # +dev/usb/misc/cp2112.c optional cp2112 dev/usb/misc/ufm.c optional ufm dev/usb/misc/udbp.c optional udbp dev/usb/misc/ugold.c optional ugold Copied and modified: stable/12/sys/dev/usb/misc/cp2112.c (from r363951, head/sys/dev/usb/misc/cp2112.c) ============================================================================== --- head/sys/dev/usb/misc/cp2112.c Thu Aug 6 13:41:42 2020 (r363951, copy source) +++ stable/12/sys/dev/usb/misc/cp2112.c Fri Aug 28 10:27:24 2020 (r364912) @@ -66,6 +66,8 @@ __FBSDID("$FreeBSD$"); #define USB_DEBUG_VAR usb_debug #include +#define SIZEOF_FIELD(_s, _f) sizeof(((struct _s *)NULL)->_f) + #define CP2112GPIO_LOCK(sc) sx_xlock(&sc->gpio_lock) #define CP2112GPIO_UNLOCK(sc) sx_xunlock(&sc->gpio_lock) #define CP2112GPIO_LOCKED(sc) sx_assert(&sc->gpio_lock, SX_XLOCKED) @@ -93,8 +95,13 @@ __FBSDID("$FreeBSD$"); #define CP2112_REQ_LOCK 0x20 #define CP2112_REQ_USB_CFG 0x21 +#define CP2112_IIC_MAX_READ_LEN 512 #define CP2112_IIC_REPSTART_VER 2 /* Erratum CP2112_E10. */ +#define CP2112_GPIO_SPEC_CLK7 1 /* Pin 7 is clock output. */ +#define CP2112_GPIO_SPEC_TX0 2 /* Pin 0 pulses on USB TX. */ +#define CP2112_GPIO_SPEC_RX1 4 /* Pin 1 pulses on USB RX. */ + #define CP2112_IIC_STATUS0_IDLE 0 #define CP2112_IIC_STATUS0_BUSY 1 #define CP2112_IIC_STATUS0_CMP 2 @@ -104,7 +111,112 @@ __FBSDID("$FreeBSD$"); #define CP2112_IIC_STATUS1_TIMEOUT_BUS 1 #define CP2112_IIC_STATUS1_ARB_LOST 2 +/* CP2112_REQ_VERSION */ +struct version_request { + uint8_t id; + uint8_t part_num; + uint8_t version; +} __packed; +/* CP2112_REQ_GPIO_GET */ +struct gpio_get_req { + uint8_t id; + uint8_t state; +} __packed; + +/* CP2112_REQ_GPIO_SET */ +struct gpio_set_req { + uint8_t id; + uint8_t state; + uint8_t mask; +} __packed; + +/* CP2112_REQ_GPIO_CFG */ +struct gpio_config_req { + uint8_t id; + uint8_t output; + uint8_t pushpull; + uint8_t special; + uint8_t divider; +} __packed; + +/* CP2112_REQ_SMB_XFER_STATUS_REQ */ +struct i2c_xfer_status_req { + uint8_t id; + uint8_t request; +} __packed; + +/* CP2112_REQ_SMB_XFER_STATUS_RESP */ +struct i2c_xfer_status_resp { + uint8_t id; + uint8_t status0; + uint8_t status1; + uint16_t status2; + uint16_t status3; +} __packed; + +/* CP2112_REQ_SMB_READ_FORCE_SEND */ +struct i2c_data_read_force_send_req { + uint8_t id; + uint16_t len; +} __packed; + +/* CP2112_REQ_SMB_READ_RESPONSE */ +struct i2c_data_read_resp { + uint8_t id; + uint8_t status; + uint8_t len; + uint8_t data[61]; +} __packed; + +/* CP2112_REQ_SMB_READ */ +struct i2c_write_read_req { + uint8_t id; + uint8_t slave; + uint16_t rlen; + uint8_t wlen; + uint8_t wdata[16]; +} __packed; + +/* CP2112_REQ_SMB_WRITE */ +struct i2c_read_req { + uint8_t id; + uint8_t slave; + uint16_t len; +} __packed; + +/* CP2112_REQ_SMB_WRITE_READ */ +struct i2c_write_req { + uint8_t id; + uint8_t slave; + uint8_t len; + uint8_t data[61]; +} __packed; + +/* CP2112_REQ_SMB_CFG */ +struct i2c_cfg_req { + uint8_t id; + uint32_t speed; /* Hz */ + uint8_t slave_addr; /* ACK only */ + uint8_t auto_send_read; /* boolean */ + uint16_t write_timeout; /* 0-1000 ms, 0 ~ no timeout */ + uint16_t read_timeout; /* 0-1000 ms, 0 ~ no timeout */ + uint8_t scl_low_timeout;/* boolean */ + uint16_t retry_count; /* 1-1000, 0 ~ forever */ +} __packed; + +enum cp2112_out_mode { + OUT_OD, + OUT_PP, + OUT_KEEP +}; + +enum { + CP2112_INTR_OUT = 0, + CP2112_INTR_IN, + CP2112_N_TRANSFER, +}; + struct cp2112_softc { device_t sc_gpio_dev; device_t sc_iic_dev; @@ -120,10 +232,38 @@ struct cp2112gpio_softc { struct gpio_pin pins[CP2112_GPIO_COUNT]; }; +struct cp2112iic_softc { + device_t dev; + device_t iicbus_dev; + struct usb_xfer *xfers[CP2112_N_TRANSFER]; + u_char own_addr; + struct { + struct mtx lock; + struct cv cv; + struct { + uint8_t *data; + int len; + int done; + int error; + } in; + struct { + const uint8_t *data; + int len; + int done; + int error; + } out; + } io; +}; + static int cp2112_detach(device_t dev); static int cp2112gpio_detach(device_t dev); static int cp2112iic_detach(device_t dev); +static const STRUCT_USB_HOST_ID cp2112_devs[] = { + { USB_VP(USB_VENDOR_SILABS, USB_PRODUCT_SILABS_CP2112) }, + { USB_VP(0x1009, USB_PRODUCT_SILABS_CP2112) }, /* XXX */ +}; + static int cp2112_get_report(device_t dev, uint8_t id, void *data, uint16_t len) { @@ -143,25 +283,103 @@ cp2112_set_report(device_t dev, uint8_t id, void *data int err; sc = device_get_softc(dev); + *(uint8_t *)data = id; err = usbd_req_set_report(sc->sc_udev, NULL, data, len, sc->sc_iface_index, UHID_FEATURE_REPORT, id); return (err); } static int +cp2112_probe(device_t dev) +{ + struct usb_attach_arg *uaa; + + uaa = device_get_ivars(dev); + if (uaa->usb_mode != USB_MODE_HOST) + return (ENXIO); + if (uaa->info.bInterfaceClass != UICLASS_HID) + return (ENXIO); + + if (usbd_lookup_id_by_uaa(cp2112_devs, sizeof(cp2112_devs), uaa) == 0) + return (BUS_PROBE_DEFAULT); + return (ENXIO); +} + +static int +cp2112_attach(device_t dev) +{ + struct version_request vdata; + struct usb_attach_arg *uaa; + struct cp2112_softc *sc; + int err; + + uaa = device_get_ivars(dev); + sc = device_get_softc(dev); + + device_set_usb_desc(dev); + + sc->sc_udev = uaa->device; + sc->sc_iface_index = uaa->info.bIfaceIndex; + + err = cp2112_get_report(dev, CP2112_REQ_VERSION, &vdata, sizeof(vdata)); + if (err != 0) + goto detach; + device_printf(dev, "part number 0x%02x, version 0x%02x\n", + vdata.part_num, vdata.version); + if (vdata.part_num != CP2112_PART_NUM) { + device_printf(dev, "unsupported part number\n"); + goto detach; + } + sc->sc_version = vdata.version; + sc->sc_gpio_dev = device_add_child(dev, "gpio", -1); + if (sc->sc_gpio_dev != NULL) { + err = device_probe_and_attach(sc->sc_gpio_dev); + if (err != 0) { + device_printf(dev, "failed to attach gpio child\n"); + } + } else { + device_printf(dev, "failed to create gpio child\n"); + } + + sc->sc_iic_dev = device_add_child(dev, "iichb", -1); + if (sc->sc_iic_dev != NULL) { + err = device_probe_and_attach(sc->sc_iic_dev); + if (err != 0) { + device_printf(dev, "failed to attach iic child\n"); + } + } else { + device_printf(dev, "failed to create iic child\n"); + } + + return (0); + +detach: + cp2112_detach(dev); + return (ENXIO); +} + +static int +cp2112_detach(device_t dev) +{ + int err; + + err = bus_generic_detach(dev); + if (err != 0) + return (err); + device_delete_children(dev); + return (0); +} + +static int cp2112_gpio_read_pin(device_t dev, uint32_t pin_num, bool *on) { - struct { - uint8_t id; - uint8_t state; - } __packed data; + struct gpio_get_req data; struct cp2112gpio_softc *sc; int err; sc = device_get_softc(dev); CP2112GPIO_LOCKED(sc); - data.id = CP2112_REQ_GPIO_GET; err = cp2112_get_report(device_get_parent(dev), CP2112_REQ_GPIO_GET, &data, sizeof(data)); if (err != 0) @@ -174,11 +392,7 @@ cp2112_gpio_read_pin(device_t dev, uint32_t pin_num, b static int cp2112_gpio_write_pin(device_t dev, uint32_t pin_num, bool on) { - struct { - uint8_t id; - uint8_t state; - uint8_t mask; - } __packed data; + struct gpio_set_req data; struct cp2112gpio_softc *sc; int err; bool actual; @@ -186,10 +400,8 @@ cp2112_gpio_write_pin(device_t dev, uint32_t pin_num, sc = device_get_softc(dev); CP2112GPIO_LOCKED(sc); - data.id = CP2112_REQ_GPIO_SET; data.state = (uint8_t)on << pin_num; data.mask = (uint8_t)1 << pin_num; - err = cp2112_set_report(device_get_parent(dev), CP2112_REQ_GPIO_SET, &data, sizeof(data)); if (err != 0) @@ -204,15 +416,9 @@ cp2112_gpio_write_pin(device_t dev, uint32_t pin_num, static int cp2112_gpio_configure_write_pin(device_t dev, uint32_t pin_num, - bool output, bool pushpull) + bool output, enum cp2112_out_mode *mode) { - struct { - uint8_t id; - uint8_t output; - uint8_t pushpull; - uint8_t special; - uint8_t divider; - } __packed data; + struct gpio_config_req data; struct cp2112gpio_softc *sc; int err; uint8_t mask; @@ -220,21 +426,26 @@ cp2112_gpio_configure_write_pin(device_t dev, uint32_t sc = device_get_softc(dev); CP2112GPIO_LOCKED(sc); - mask = (uint8_t)1 << pin_num; - data.id = CP2112_REQ_GPIO_CFG; err = cp2112_get_report(device_get_parent(dev), CP2112_REQ_GPIO_CFG, &data, sizeof(data)); if (err != 0) return (err); + + mask = (uint8_t)1 << pin_num; if (output) { data.output |= mask; - if (pushpull) + switch (*mode) { + case OUT_PP: data.pushpull |= mask; - else + break; + case OUT_OD: data.pushpull &= ~mask; + break; + default: + break; + } } else { data.output &= ~mask; - data.pushpull &= ~mask; } err = cp2112_set_report(device_get_parent(dev), @@ -247,10 +458,25 @@ cp2112_gpio_configure_write_pin(device_t dev, uint32_t CP2112_REQ_GPIO_CFG, &data, sizeof(data)); if (err != 0) return (err); + if (((data.output & mask) != 0) != output) return (EIO); - if (((data.pushpull & mask) != 0) != pushpull) - return (EIO); + if (output) { + switch (*mode) { + case OUT_PP: + if ((data.pushpull & mask) == 0) + return (EIO); + break; + case OUT_OD: + if ((data.pushpull & mask) != 0) + return (EIO); + break; + default: + *mode = (data.pushpull & mask) != 0 ? + OUT_PP : OUT_OD; + break; + } + } return (0); } @@ -381,6 +607,7 @@ cp2112_gpio_pin_setflags(device_t dev, uint32_t pin_nu { struct cp2112gpio_softc *sc; struct gpio_pin *pin; + enum cp2112_out_mode out_mode; int err; if (pin_num >= CP2112_GPIO_COUNT) @@ -405,118 +632,45 @@ cp2112_gpio_pin_setflags(device_t dev, uint32_t pin_nu return (EINVAL); } - CP2112GPIO_LOCK(sc); - pin = &sc->pins[pin_num]; - /* - * If neither push-pull or opendrain is explcitely requested, then + * If neither push-pull or open-drain is explicitly requested, then * preserve the current state. */ - if ((flags & GPIO_PIN_OUTPUT) != 0 && - (flags & (GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL)) == 0) - flags |= pin->gp_flags & (GPIO_PIN_OPENDRAIN|GPIO_PIN_PUSHPULL); + out_mode = OUT_KEEP; + if ((flags & GPIO_PIN_OUTPUT) != 0) { + if ((flags & GPIO_PIN_OPENDRAIN) != 0) + out_mode = OUT_OD; + if ((flags & GPIO_PIN_PUSHPULL) != 0) + out_mode = OUT_PP; + } + + CP2112GPIO_LOCK(sc); + pin = &sc->pins[pin_num]; err = cp2112_gpio_configure_write_pin(dev, pin_num, - (flags & GPIO_PIN_OUTPUT) != 0, - (flags & GPIO_PIN_PUSHPULL) != 0); - if (err == 0) + (flags & GPIO_PIN_OUTPUT) != 0, &out_mode); + if (err == 0) { + /* + * If neither open-drain or push-pull was requested, then see + * what hardware actually had. Otherwise, it has been + * reconfigured as requested. + */ + if ((flags & GPIO_PIN_OUTPUT) != 0 && + (flags & (GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL)) == 0) { + KASSERT(out_mode != OUT_KEEP, + ("impossible current output mode")); + if (out_mode == OUT_OD) + flags |= GPIO_PIN_OPENDRAIN; + else + flags |= GPIO_PIN_PUSHPULL; + } pin->gp_flags = flags; + } CP2112GPIO_UNLOCK(sc); return (err); } -static const STRUCT_USB_HOST_ID cp2112_devs[] = { - { USB_VP(USB_VENDOR_SILABS, USB_PRODUCT_SILABS_CP2112) }, - { USB_VP(0x1009, USB_PRODUCT_SILABS_CP2112) }, /* XXX */ -}; - static int -cp2112_probe(device_t dev) -{ - struct usb_attach_arg *uaa; - - uaa = device_get_ivars(dev); - if (uaa->usb_mode != USB_MODE_HOST) - return (ENXIO); - if (uaa->info.bInterfaceClass != UICLASS_HID) - return (ENXIO); - - if (usbd_lookup_id_by_uaa(cp2112_devs, sizeof(cp2112_devs), uaa) == 0) - return (BUS_PROBE_DEFAULT); - return (ENXIO); -} - -static int -cp2112_attach(device_t dev) -{ - struct { - uint8_t id; - uint8_t part_num; - uint8_t version; - } __packed vdata; - struct usb_attach_arg *uaa; - struct cp2112_softc *sc; - int err; - - uaa = device_get_ivars(dev); - sc = device_get_softc(dev); - - device_set_usb_desc(dev); - - sc->sc_udev = uaa->device; - sc->sc_iface_index = uaa->info.bIfaceIndex; - - vdata.id = CP2112_REQ_VERSION; - err = cp2112_get_report(dev, CP2112_REQ_VERSION, &vdata, sizeof(vdata)); - if (err != 0) - goto detach; - device_printf(dev, "part number 0x%02x, version 0x%02x\n", - vdata.part_num, vdata.version); - if (vdata.part_num != CP2112_PART_NUM) { - device_printf(dev, "unsupported part number\n"); - goto detach; - } - sc->sc_version = vdata.version; - sc->sc_gpio_dev = device_add_child(dev, "gpio", -1); - if (sc->sc_gpio_dev != NULL) { - err = device_probe_and_attach(sc->sc_gpio_dev); - if (err != 0) { - device_printf(dev, "failed to attach gpio child\n"); - } - } else { - device_printf(dev, "failed to create gpio child\n"); - } - - sc->sc_iic_dev = device_add_child(dev, "iichb", -1); - if (sc->sc_iic_dev != NULL) { - err = device_probe_and_attach(sc->sc_iic_dev); - if (err != 0) { - device_printf(dev, "failed to attach iic child\n"); - } - } else { - device_printf(dev, "failed to create iic child\n"); - } - - return (0); - -detach: - cp2112_detach(dev); - return (ENXIO); -} - -static int -cp2112_detach(device_t dev) -{ - int err; - - err = bus_generic_detach(dev); - if (err != 0) - return (err); - device_delete_children(dev); - return (0); -} - -static int cp2112gpio_probe(device_t dev) { device_set_desc(dev, "CP2112 GPIO interface"); @@ -526,13 +680,7 @@ cp2112gpio_probe(device_t dev) static int cp2112gpio_attach(device_t dev) { - struct { - uint8_t id; - uint8_t output; - uint8_t pushpull; - uint8_t special; - uint8_t divider; - } __packed data; + struct gpio_config_req data; struct cp2112gpio_softc *sc; device_t cp2112; int err; @@ -546,7 +694,6 @@ cp2112gpio_attach(device_t dev) sc->gpio_caps = GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL; - data.id = CP2112_REQ_GPIO_CFG; err = cp2112_get_report(cp2112, CP2112_REQ_GPIO_CFG, &data, sizeof(data)); if (err != 0) @@ -562,7 +709,11 @@ cp2112gpio_attach(device_t dev) snprintf(pin->gp_name, GPIOMAXNAME, "GPIO%u", i); pin->gp_name[GPIOMAXNAME - 1] = '\0'; - if ((data.output & mask) != 0) { + if ((i == 0 && (data.special & CP2112_GPIO_SPEC_TX0) != 0) || + (i == 1 && (data.special & CP2112_GPIO_SPEC_RX1) != 0) || + (i == 7 && (data.special & CP2112_GPIO_SPEC_CLK7) != 0)) { + /* Special mode means that a pin is not for GPIO. */ + } else if ((data.output & mask) != 0) { pin->gp_flags |= GPIO_PIN_OUTPUT; if ((data.pushpull & mask) != 0) pin->gp_flags |= GPIO_PIN_PUSHPULL; @@ -597,94 +748,6 @@ cp2112gpio_detach(device_t dev) return (0); } -static device_method_t cp2112hid_methods[] = { - DEVMETHOD(device_probe, cp2112_probe), - DEVMETHOD(device_attach, cp2112_attach), - DEVMETHOD(device_detach, cp2112_detach), - - DEVMETHOD_END -}; - -static device_method_t cp2112gpio_methods[] = { - /* Device */ - DEVMETHOD(device_probe, cp2112gpio_probe), - DEVMETHOD(device_attach, cp2112gpio_attach), - DEVMETHOD(device_detach, cp2112gpio_detach), - - /* GPIO */ - DEVMETHOD(gpio_get_bus, cp2112_gpio_get_bus), - DEVMETHOD(gpio_pin_max, cp2112_gpio_pin_max), - DEVMETHOD(gpio_pin_get, cp2112_gpio_pin_get), - DEVMETHOD(gpio_pin_set, cp2112_gpio_pin_set), - DEVMETHOD(gpio_pin_toggle, cp2112_gpio_pin_toggle), - DEVMETHOD(gpio_pin_getname, cp2112_gpio_pin_getname), - DEVMETHOD(gpio_pin_getcaps, cp2112_gpio_pin_getcaps), - DEVMETHOD(gpio_pin_getflags, cp2112_gpio_pin_getflags), - DEVMETHOD(gpio_pin_setflags, cp2112_gpio_pin_setflags), - - DEVMETHOD_END -}; - -static driver_t cp2112hid_driver = { - .name = "cp2112hid", - .methods = cp2112hid_methods, - .size = sizeof(struct cp2112_softc), -}; - -static devclass_t cp2112hid_devclass; -DRIVER_MODULE(cp2112hid, uhub, cp2112hid_driver, cp2112hid_devclass, - NULL, NULL); -MODULE_DEPEND(cp2112hid, usb, 1, 1, 1); -MODULE_VERSION(cp2112hid, 1); -USB_PNP_HOST_INFO(cp2112_devs); - -static driver_t cp2112gpio_driver = { - .name = "gpio", - .methods = cp2112gpio_methods, - .size = sizeof(struct cp2112gpio_softc), -}; - -static devclass_t cp2112gpio_devclass; -DRIVER_MODULE(cp2112gpio, cp2112hid, cp2112gpio_driver, cp2112gpio_devclass, - NULL, NULL); -MODULE_DEPEND(cp2112gpio, cp2112hid, 1, 1, 1); -MODULE_DEPEND(cp2112gpio, gpiobus, 1, 1, 1); -MODULE_VERSION(cp2112gpio, 1); - - - -/* CP2112 I2C driver code. */ - - -enum { - CP2112_INTR_OUT = 0, - CP2112_INTR_IN, - CP2112_N_TRANSFER, -}; - -struct cp2112iic_softc { - device_t dev; - device_t iicbus_dev; - struct usb_xfer *xfers[CP2112_N_TRANSFER]; - u_char own_addr; - struct { - struct mtx lock; - struct cv cv; - struct { - uint8_t *data; - int len; - int done; - int error; - } in; - struct { - const uint8_t *data; - int len; - int done; - int error; - } out; - } io; -}; - static void cp2112iic_intr_write_callback(struct usb_xfer *xfer, usb_error_t error) { @@ -890,17 +953,8 @@ cp2112iic_req_resp(struct cp2112iic_softc *sc, const v static int cp2112iic_check_req_status(struct cp2112iic_softc *sc) { - struct { - uint8_t id; - uint8_t request; - } __packed xfer_status_req; - struct { - uint8_t id; - uint8_t status0; - uint8_t status1; - uint16_t status2; - uint16_t status3; - } __packed xfer_status_resp; + struct i2c_xfer_status_req xfer_status_req; + struct i2c_xfer_status_resp xfer_status_resp; int err; mtx_assert(&sc->io.lock, MA_OWNED); @@ -971,16 +1025,8 @@ static int cp2112iic_read_data(struct cp2112iic_softc *sc, void *data, uint16_t in_len, uint16_t *out_len) { - struct { - uint8_t id; - uint16_t length; - } __packed data_read_force_send; - struct { - uint8_t id; - uint8_t status; - uint8_t length; - uint8_t data[61]; - } __packed data_read_resp; + struct i2c_data_read_force_send_req data_read_force_send; + struct i2c_data_read_resp data_read_resp; int err; mtx_assert(&sc->io.lock, MA_OWNED); @@ -993,7 +1039,7 @@ cp2112iic_read_data(struct cp2112iic_softc *sc, void * if (in_len > sizeof(data_read_resp.data)) in_len = sizeof(data_read_resp.data); data_read_force_send.id = CP2112_REQ_SMB_READ_FORCE_SEND; - data_read_force_send.length = htobe16(in_len); + data_read_force_send.len = htobe16(in_len); err = cp2112iic_req_resp(sc, &data_read_force_send, sizeof(data_read_force_send), &data_read_resp, sizeof(data_read_resp)); @@ -1009,7 +1055,7 @@ cp2112iic_read_data(struct cp2112iic_softc *sc, void * } DTRACE_PROBE2(read__response, uint8_t, data_read_resp.status, - uint8_t, data_read_resp.length); + uint8_t, data_read_resp.len); /* * We expect either the request completed status or, more typical for @@ -1021,13 +1067,13 @@ cp2112iic_read_data(struct cp2112iic_softc *sc, void * err = IIC_EBUSERR; goto out; } - if (data_read_resp.length > in_len) { + if (data_read_resp.len > in_len) { device_printf(sc->dev, "device returns more data than asked\n"); err = IIC_EOVERFLOW; goto out; } - *out_len = data_read_resp.length; + *out_len = data_read_resp.len; if (*out_len > 0) memcpy(data, data_read_resp.data, *out_len); out: @@ -1070,11 +1116,13 @@ cp2112iic_transfer(device_t dev, struct iic_msg *msgs, reason = "message with no data"; break; } - if ((msgs[i].flags & IIC_M_RD) != 0 && msgs[i].len > 512) { + if ((msgs[i].flags & IIC_M_RD) != 0 && + msgs[i].len > CP2112_IIC_MAX_READ_LEN) { reason = "too long read"; break; } - if ((msgs[i].flags & IIC_M_RD) == 0 && msgs[i].len > 61) { + if ((msgs[i].flags & IIC_M_RD) == 0 && + msgs[i].len > SIZEOF_FIELD(i2c_write_req, data)) { reason = "too long write"; break; } @@ -1092,7 +1140,8 @@ cp2112iic_transfer(device_t dev, struct iic_msg *msgs, reason = "write without stop"; break; } - if ((msgs[i].flags & IIC_M_NOSTOP) != 0 && msgs[i].len > 16) { + if ((msgs[i].flags & IIC_M_NOSTOP) != 0 && + msgs[i].len > SIZEOF_FIELD(i2c_write_read_req, wdata)) { reason = "too long write without stop"; break; } @@ -1120,22 +1169,16 @@ cp2112iic_transfer(device_t dev, struct iic_msg *msgs, for (i = 0; i < nmsgs; i++) { if (i + 1 < nmsgs && (msgs[i].flags & IIC_M_NOSTOP) != 0) { - KASSERT((msgs[i].flags & IIC_M_RD) == 0, - ("read without stop")); - KASSERT((msgs[i + 1].flags & IIC_M_RD) != 0, - ("write after write without stop")); /* * Combine into a single * CP2112 operation. */ - struct { - uint8_t id; - uint8_t slave; - uint16_t rlen; - uint8_t wlen; - uint8_t wdata[16]; - } __packed req; + struct i2c_write_read_req req; + KASSERT((msgs[i].flags & IIC_M_RD) == 0, + ("read without stop")); + KASSERT((msgs[i + 1].flags & IIC_M_RD) != 0, + ("write after write without stop")); req.id = CP2112_REQ_SMB_WRITE_READ; req.slave = msgs[i].slave & ~LSB; to_read = msgs[i + 1].len; @@ -1150,11 +1193,7 @@ cp2112iic_transfer(device_t dev, struct iic_msg *msgs, */ i++; } else if ((msgs[i].flags & IIC_M_RD) != 0) { - struct { - uint8_t id; - uint8_t slave; - uint16_t len; - } __packed req; + struct i2c_read_req req; req.id = CP2112_REQ_SMB_READ; req.slave = msgs[i].slave & ~LSB; @@ -1162,12 +1201,7 @@ cp2112iic_transfer(device_t dev, struct iic_msg *msgs, req.len = htobe16(to_read); err = cp2112iic_send_req(sc, &req, sizeof(req)); } else { - struct { - uint8_t id; - uint8_t slave; - uint8_t len; - uint8_t data[61]; - } __packed req; + struct i2c_write_req req; req.id = CP2112_REQ_SMB_WRITE; req.slave = msgs[i].slave & ~LSB; @@ -1207,16 +1241,7 @@ cp2112iic_transfer(device_t dev, struct iic_msg *msgs, static int cp2112iic_reset(device_t dev, u_char speed, u_char addr, u_char *oldaddr) { - struct { - uint8_t id; - uint32_t speed; /* Hz */ - uint8_t slave_addr; /* ACK only */ - uint8_t auto_send_read; /* boolean */ - uint16_t write_timeout; /* 0-1000 ms, 0 ~ no timeout */ - uint16_t read_timeout; /* 0-1000 ms, 0 ~ no timeout */ - uint8_t scl_low_timeout;/* boolean */ - uint16_t retry_count; /* 1-1000, 0 ~ forever */ - } __packed smb_cfg; + struct i2c_cfg_req i2c_cfg; struct cp2112iic_softc *sc; device_t cp2112; u_int busfreq; @@ -1229,16 +1254,15 @@ cp2112iic_reset(device_t dev, u_char speed, u_char add else busfreq = IICBUS_GET_FREQUENCY(sc->iicbus_dev, speed); - smb_cfg.id = CP2112_REQ_SMB_CFG; err = cp2112_get_report(cp2112, CP2112_REQ_SMB_CFG, - &smb_cfg, sizeof(smb_cfg)); + &i2c_cfg, sizeof(i2c_cfg)); if (err != 0) { device_printf(dev, "failed to get CP2112_REQ_SMB_CFG report\n"); return (err); } if (oldaddr != NULL) - *oldaddr = smb_cfg.slave_addr; + *oldaddr = i2c_cfg.slave_addr; /* * For simplicity we do not enable Auto Send Read * because of erratum CP2112_E101 (fixed in version 3). @@ -1251,28 +1275,28 @@ cp2112iic_reset(device_t dev, u_char speed, u_char add * TODO: should the device reset request (0x01) be sent? * If the device disconnects as a result, then no. */ - smb_cfg.speed = htobe32(busfreq); + i2c_cfg.speed = htobe32(busfreq); if (addr != 0) - smb_cfg.slave_addr = addr; - smb_cfg.auto_send_read = 0; - smb_cfg.retry_count = htobe16(1); - smb_cfg.scl_low_timeout = 0; + i2c_cfg.slave_addr = addr; + i2c_cfg.auto_send_read = 0; + i2c_cfg.retry_count = htobe16(1); + i2c_cfg.scl_low_timeout = 0; if (bootverbose) { - device_printf(dev, "speed %d Hz\n", be32toh(smb_cfg.speed)); - device_printf(dev, "slave addr 0x%02x\n", smb_cfg.slave_addr); + device_printf(dev, "speed %d Hz\n", be32toh(i2c_cfg.speed)); + device_printf(dev, "slave addr 0x%02x\n", i2c_cfg.slave_addr); device_printf(dev, "auto send read %s\n", - smb_cfg.auto_send_read ? "on" : "off"); + i2c_cfg.auto_send_read ? "on" : "off"); device_printf(dev, "write timeout %d ms (0 - disabled)\n", - be16toh(smb_cfg.write_timeout)); + be16toh(i2c_cfg.write_timeout)); device_printf(dev, "read timeout %d ms (0 - disabled)\n", - be16toh(smb_cfg.read_timeout)); + be16toh(i2c_cfg.read_timeout)); device_printf(dev, "scl low timeout %s\n", - smb_cfg.scl_low_timeout ? "on" : "off"); + i2c_cfg.scl_low_timeout ? "on" : "off"); device_printf(dev, "retry count %d (0 - no limit)\n", - be16toh(smb_cfg.retry_count)); + be16toh(i2c_cfg.retry_count)); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-12@freebsd.org Fri Aug 28 10:28:52 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E26EF3D4065; Fri, 28 Aug 2020 10:28:52 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BdG6D5bcSz4LPW; Fri, 28 Aug 2020 10:28:52 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A499413A05; Fri, 28 Aug 2020 10:28:52 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07SASqbT029205; Fri, 28 Aug 2020 10:28:52 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07SASqSt029204; Fri, 28 Aug 2020 10:28:52 GMT (envelope-from avg@FreeBSD.org) Message-Id: <202008281028.07SASqSt029204@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 28 Aug 2020 10:28:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364913 - stable/12/sys/modules/usb/cp2112 X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/modules/usb/cp2112 X-SVN-Commit-Revision: 364913 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Aug 2020 10:28:53 -0000 Author: avg Date: Fri Aug 28 10:28:52 2020 New Revision: 364913 URL: https://svnweb.freebsd.org/changeset/base/364913 Log: MFC r364269 by eugen: Unbreak building cp2112(8) as a module... outside of kernel build environment. Modified: stable/12/sys/modules/usb/cp2112/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/modules/usb/cp2112/Makefile ============================================================================== --- stable/12/sys/modules/usb/cp2112/Makefile Fri Aug 28 10:27:24 2020 (r364912) +++ stable/12/sys/modules/usb/cp2112/Makefile Fri Aug 28 10:28:52 2020 (r364913) @@ -31,7 +31,7 @@ S= ${SRCTOP}/sys KMOD= cp2112 SRCS= cp2112.c -SRCS+= opt_bus.h opt_usb.h +SRCS+= opt_bus.h opt_platform.h opt_usb.h SRCS+= device_if.h bus_if.h gpio_if.h iicbus_if.h usb_if.h usbdevs.h .include From owner-svn-src-stable-12@freebsd.org Fri Aug 28 10:30:40 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 99B003D4535; Fri, 28 Aug 2020 10:30:40 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BdG8J3YZZz4LYL; Fri, 28 Aug 2020 10:30:40 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5D4DC13A09; Fri, 28 Aug 2020 10:30:40 +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 07SAUe6W029389; Fri, 28 Aug 2020 10:30:40 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07SAUevm029388; Fri, 28 Aug 2020 10:30:40 GMT (envelope-from avg@FreeBSD.org) Message-Id: <202008281030.07SAUevm029388@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 28 Aug 2020 10:30:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364914 - stable/12/sys/dev/iicbus/mux X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/dev/iicbus/mux X-SVN-Commit-Revision: 364914 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Aug 2020 10:30:40 -0000 Author: avg Date: Fri Aug 28 10:30:39 2020 New Revision: 364914 URL: https://svnweb.freebsd.org/changeset/base/364914 Log: MFC r364344: iicmux: fix a sign error in comparison Modified: stable/12/sys/dev/iicbus/mux/iicmux.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/iicbus/mux/iicmux.c ============================================================================== --- stable/12/sys/dev/iicbus/mux/iicmux.c Fri Aug 28 10:28:52 2020 (r364913) +++ stable/12/sys/dev/iicbus/mux/iicmux.c Fri Aug 28 10:30:39 2020 (r364914) @@ -283,7 +283,7 @@ iicmux_attach_children(struct iicmux_softc *sc) } sc->childdevs[idx] = device_add_child(sc->dev, "iicbus", -1); sc->childnodes[idx] = child; - if (sc->maxbus < idx) + if (sc->maxbus < (int)idx) sc->maxbus = idx; } From owner-svn-src-stable-12@freebsd.org Fri Aug 28 10:32:03 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B52673D48C4; Fri, 28 Aug 2020 10:32:03 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BdG9v4Tcbz4M3J; Fri, 28 Aug 2020 10:32:03 +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 7BF9613BCA; Fri, 28 Aug 2020 10:32:03 +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 07SAW3v3034161; Fri, 28 Aug 2020 10:32:03 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07SAW307034160; Fri, 28 Aug 2020 10:32:03 GMT (envelope-from avg@FreeBSD.org) Message-Id: <202008281032.07SAW307034160@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 28 Aug 2020 10:32:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364915 - stable/12/sys/arm/allwinner X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/arm/allwinner X-SVN-Commit-Revision: 364915 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Aug 2020 10:32:03 -0000 Author: avg Date: Fri Aug 28 10:32:03 2020 New Revision: 364915 URL: https://svnweb.freebsd.org/changeset/base/364915 Log: MFC r364146: aw_cir: add support for allwinner,sun6i-a31-ir (found, e.g., on h3) Modified: stable/12/sys/arm/allwinner/aw_cir.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm/allwinner/aw_cir.c ============================================================================== --- stable/12/sys/arm/allwinner/aw_cir.c Fri Aug 28 10:30:39 2020 (r364914) +++ stable/12/sys/arm/allwinner/aw_cir.c Fri Aug 28 10:32:03 2020 (r364915) @@ -134,8 +134,11 @@ __FBSDID("$FreeBSD$"); #define INV_CODE_MASK 0xff00ff00 #define VALID_CODE_MASK 0x00ff0000 -#define A10_IR 1 -#define A13_IR 2 +enum { + A10_IR = 1, + A13_IR, + A31_IR, +}; #define AW_IR_RAW_BUF_SIZE 128 @@ -158,6 +161,7 @@ static struct resource_spec aw_ir_spec[] = { static struct ofw_compat_data compat_data[] = { { "allwinner,sun4i-a10-ir", A10_IR }, { "allwinner,sun5i-a13-ir", A13_IR }, + { "allwinner,sun6i-a31-ir", A31_IR }, { NULL, 0 } }; @@ -414,6 +418,7 @@ aw_ir_attach(device_t dev) sc->fifo_size = 16; break; case A13_IR: + case A31_IR: sc->fifo_size = 64; break; } From owner-svn-src-stable-12@freebsd.org Fri Aug 28 10:33:20 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8CAF23D4B85; Fri, 28 Aug 2020 10:33:20 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BdGCN39tgz4MJ6; Fri, 28 Aug 2020 10:33:20 +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 50B1813A97; Fri, 28 Aug 2020 10:33:20 +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 07SAXKcq035058; Fri, 28 Aug 2020 10:33:20 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07SAXKx4035057; Fri, 28 Aug 2020 10:33:20 GMT (envelope-from avg@FreeBSD.org) Message-Id: <202008281033.07SAXKx4035057@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 28 Aug 2020 10:33:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364916 - stable/12/sys/arm/allwinner X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/arm/allwinner X-SVN-Commit-Revision: 364916 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Aug 2020 10:33:20 -0000 Author: avg Date: Fri Aug 28 10:33:19 2020 New Revision: 364916 URL: https://svnweb.freebsd.org/changeset/base/364916 Log: MFC r364147: aw_cir: minor cleanups Modified: stable/12/sys/arm/allwinner/aw_cir.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm/allwinner/aw_cir.c ============================================================================== --- stable/12/sys/arm/allwinner/aw_cir.c Fri Aug 28 10:32:03 2020 (r364915) +++ stable/12/sys/arm/allwinner/aw_cir.c Fri Aug 28 10:33:19 2020 (r364916) @@ -368,7 +368,7 @@ aw_ir_intr(void *arg) device_printf(sc->dev, "IR code status: %d\n", stat); } - sc->dcnt = 0; + aw_ir_buf_reset(sc); } if (val & AW_IR_RXINT_ROI_EN) { /* RX FIFO overflow */ @@ -469,7 +469,8 @@ aw_ir_attach(device_t dev) &sc->intrhand)) { bus_release_resources(dev, aw_ir_spec, sc->res); device_printf(dev, "cannot setup interrupt handler\n"); - return (ENXIO); + err = ENXIO; + goto error; } /* Enable CIR Mode */ From owner-svn-src-stable-12@freebsd.org Fri Aug 28 13:15:15 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DC6053B11AC; Fri, 28 Aug 2020 13:15:15 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BdKpC5w10z4YGB; Fri, 28 Aug 2020 13:15:15 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AF2D71535A; Fri, 28 Aug 2020 13:15:15 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07SDFF4N034370; Fri, 28 Aug 2020 13:15:15 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07SDFDcC034359; Fri, 28 Aug 2020 13:15:13 GMT (envelope-from avg@FreeBSD.org) Message-Id: <202008281315.07SDFDcC034359@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 28 Aug 2020 13:15:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364917 - in stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 364917 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Aug 2020 13:15:15 -0000 Author: avg Date: Fri Aug 28 13:15:13 2020 New Revision: 364917 URL: https://svnweb.freebsd.org/changeset/base/364917 Log: MFC r362047,r362048: rework how ZVOLs are updated in response to DSL operations Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zvol.h stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Fri Aug 28 10:33:19 2020 (r364916) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Fri Aug 28 13:15:13 2020 (r364917) @@ -1053,6 +1053,9 @@ dmu_objset_create_sync(void *arg, dmu_tx_t *tx) doca->doca_cred, tx); } +#if defined(__FreeBSD__) && defined(_KERNEL) + zvol_create_minors(dp->dp_spa, doca->doca_name); +#endif spa_history_log_internal_ds(ds, "create", tx, ""); dsl_dataset_rele(ds, FTAG); dsl_dir_rele(pdd, FTAG); @@ -1148,6 +1151,9 @@ dmu_objset_clone_sync(void *arg, dmu_tx_t *tx) VERIFY0(dsl_dataset_hold_obj(pdd->dd_pool, obj, FTAG, &ds)); dsl_dataset_name(origin, namebuf); +#if defined(__FreeBSD__) && defined(_KERNEL) + zvol_create_minors(dp->dp_spa, doca->doca_clone); +#endif spa_history_log_internal_ds(ds, "clone", tx, "origin=%s (%llu)", namebuf, origin->ds_object); dsl_dataset_rele(ds, FTAG); Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Fri Aug 28 10:33:19 2020 (r364916) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Fri Aug 28 13:15:13 2020 (r364917) @@ -57,6 +57,9 @@ #include #include #include +#ifdef __FreeBSD__ +#include +#endif #ifdef __FreeBSD__ #undef dump_write @@ -3445,6 +3448,11 @@ dmu_recv_end_sync(void *arg, dmu_tx_t *tx) drc->drc_newsnapobj = dsl_dataset_phys(drc->drc_ds)->ds_prev_snap_obj; } + +#if defined(__FreeBSD__) && defined(_KERNEL) + zvol_create_minors(dp->dp_spa, drc->drc_tofs); +#endif + /* * Release the hold from dmu_recv_begin. This must be done before * we return to open context, so that when we free the dataset's dnode, Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Fri Aug 28 10:33:19 2020 (r364916) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Fri Aug 28 13:15:13 2020 (r364917) @@ -1572,6 +1572,9 @@ dsl_dataset_snapshot_sync(void *arg, dmu_tx_t *tx) dsl_props_set_sync_impl(ds->ds_prev, ZPROP_SRC_LOCAL, ddsa->ddsa_props, tx); } +#if defined(__FreeBSD__) && defined(_KERNEL) + zvol_create_minors(dp->dp_spa, name); +#endif dsl_dataset_rele(ds, FTAG); } } @@ -1646,17 +1649,6 @@ dsl_dataset_snapshot(nvlist_t *snaps, nvlist_t *props, fnvlist_free(suspended); } -#ifdef __FreeBSD__ -#ifdef _KERNEL - if (error == 0) { - for (pair = nvlist_next_nvpair(snaps, NULL); pair != NULL; - pair = nvlist_next_nvpair(snaps, pair)) { - char *snapname = nvpair_name(pair); - zvol_create_minors(snapname); - } - } -#endif -#endif return (error); } @@ -2535,7 +2527,7 @@ dsl_dataset_rename_snapshot_sync_impl(dsl_pool_t *dp, snprintf(newname, ZFS_MAX_DATASET_NAME_LEN, "%s@%s", ddrsa->ddrsa_fsname, ddrsa->ddrsa_newsnapname); zfsvfs_update_fromname(oldname, newname); - zvol_rename_minors(oldname, newname); + zvol_rename_minors(dp->dp_spa, oldname, newname); kmem_free(newname, ZFS_MAX_DATASET_NAME_LEN); kmem_free(oldname, ZFS_MAX_DATASET_NAME_LEN); #endif @@ -3087,9 +3079,6 @@ dsl_dataset_promote_sync(void *arg, dmu_tx_t *tx) } #if defined(__FreeBSD__) && defined(_KERNEL) - /* Take the spa_namespace_lock early so zvol renames don't deadlock. */ - mutex_enter(&spa_namespace_lock); - oldname = kmem_alloc(ZFS_MAX_DATASET_NAME_LEN, KM_SLEEP); newname = kmem_alloc(ZFS_MAX_DATASET_NAME_LEN, KM_SLEEP); #endif @@ -3135,7 +3124,7 @@ dsl_dataset_promote_sync(void *arg, dmu_tx_t *tx) #if defined(__FreeBSD__) && defined(_KERNEL) dsl_dataset_name(ds, newname); zfsvfs_update_fromname(oldname, newname); - zvol_rename_minors(oldname, newname); + zvol_rename_minors(dp->dp_spa, oldname, newname); #endif /* move any clone references */ @@ -3177,8 +3166,6 @@ dsl_dataset_promote_sync(void *arg, dmu_tx_t *tx) } #if defined(__FreeBSD__) && defined(_KERNEL) - mutex_exit(&spa_namespace_lock); - kmem_free(newname, ZFS_MAX_DATASET_NAME_LEN); kmem_free(oldname, ZFS_MAX_DATASET_NAME_LEN); #endif Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c Fri Aug 28 10:33:19 2020 (r364916) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c Fri Aug 28 13:15:13 2020 (r364917) @@ -43,7 +43,11 @@ #include #include #include +#if defined(__FreeBSD__) && defined(_KERNEL) +#include +#endif + int dsl_destroy_snapshot_check_impl(dsl_dataset_t *ds, boolean_t defer) { @@ -489,6 +493,14 @@ dsl_destroy_snapshot_sync_impl(dsl_dataset_t *ds, bool if (dsl_dataset_phys(ds)->ds_userrefs_obj != 0) VERIFY0(zap_destroy(mos, dsl_dataset_phys(ds)->ds_userrefs_obj, tx)); + +#if defined(__FreeBSD__) && defined(_KERNEL) + char dsname[ZFS_MAX_DATASET_NAME_LEN]; + + dsl_dataset_name(ds, dsname); + zvol_remove_minors(dp->dp_spa, dsname); +#endif + dsl_dir_rele(ds->ds_dir, ds); ds->ds_dir = NULL; dmu_object_free_zapified(mos, obj, tx); @@ -979,6 +991,9 @@ dsl_destroy_head_sync(void *arg, dmu_tx_t *tx) VERIFY0(dsl_dataset_hold(dp, ddha->ddha_name, FTAG, &ds)); dsl_destroy_head_sync_impl(ds, tx); +#if defined(__FreeBSD__) && defined(_KERNEL) + zvol_remove_minors(dp->dp_spa, ddha->ddha_name); +#endif dsl_dataset_rele(ds, FTAG); } Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c Fri Aug 28 10:33:19 2020 (r364916) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c Fri Aug 28 13:15:13 2020 (r364917) @@ -2093,7 +2093,7 @@ dsl_dir_rename_sync(void *arg, dmu_tx_t *tx) #ifdef __FreeBSD__ #ifdef _KERNEL zfsvfs_update_fromname(ddra->ddra_oldname, ddra->ddra_newname); - zvol_rename_minors(ddra->ddra_oldname, ddra->ddra_newname); + zvol_rename_minors(dp->dp_spa, ddra->ddra_oldname, ddra->ddra_newname); #endif #endif Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Fri Aug 28 10:33:19 2020 (r364916) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Fri Aug 28 13:15:13 2020 (r364917) @@ -32,6 +32,7 @@ * Copyright (c) 2017, Intel Corporation. * Copyright (c) 2017 Datto Inc. * Copyright 2018 OmniOS Community Edition (OmniOSce) Association. + * Copyright (c) 2016 Actifio, Inc. All rights reserved. */ /* @@ -1280,6 +1281,24 @@ spa_activate(spa_t *spa, int mode) */ trim_thread_create(spa); + /* + * This taskq is used to perform zvol-minor-related tasks + * asynchronously. This has several advantages, including easy + * resolution of various deadlocks (zfsonlinux bug #3681). + * + * The taskq must be single threaded to ensure tasks are always + * processed in the order in which they were dispatched. + * + * A taskq per pool allows one to keep the pools independent. + * This way if one pool is suspended, it will not impact another. + * + * The preferred location to dispatch a zvol minor task is a sync + * task. In this context, there is easy access to the spa_t and minimal + * error handling is required because the sync task must succeed. + */ + spa->spa_zvol_taskq = taskq_create("z_zvol", 1, minclsyspri, + 1, INT_MAX, 0); + for (size_t i = 0; i < TXG_SIZE; i++) { spa->spa_txg_zio[i] = zio_root(spa, NULL, NULL, ZIO_FLAG_CANFAIL); @@ -1323,6 +1342,11 @@ spa_deactivate(spa_t *spa) spa_evicting_os_wait(spa); + if (spa->spa_zvol_taskq) { + taskq_destroy(spa->spa_zvol_taskq); + spa->spa_zvol_taskq = NULL; + } + txg_list_destroy(&spa->spa_vdev_txg_list); list_destroy(&spa->spa_config_dirty_list); @@ -4614,7 +4638,7 @@ spa_open_common(const char *pool, spa_t **spapp, void #ifdef __FreeBSD__ #ifdef _KERNEL if (firstopen) - zvol_create_minors(spa->spa_name); + zvol_create_minors(spa, spa->spa_name); #endif #endif } @@ -5970,7 +5994,7 @@ spa_import(const char *pool, nvlist_t *config, nvlist_ #ifdef __FreeBSD__ #ifdef _KERNEL - zvol_create_minors(pool); + zvol_create_minors(spa, pool); #endif #endif return (0); @@ -6119,6 +6143,12 @@ spa_export_common(char *pool, int new_state, nvlist_t spa_open_ref(spa, FTAG); mutex_exit(&spa_namespace_lock); spa_async_suspend(spa); + if (spa->spa_zvol_taskq) { +#ifdef _KERNEL + zvol_remove_minors(spa, spa_name(spa)); +#endif + taskq_wait(spa->spa_zvol_taskq); + } mutex_enter(&spa_namespace_lock); spa_close(spa, FTAG); Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Fri Aug 28 10:33:19 2020 (r364916) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Fri Aug 28 13:15:13 2020 (r364917) @@ -27,6 +27,7 @@ * Copyright 2013 Saso Kiselkov. All rights reserved. * Copyright (c) 2017 Datto Inc. * Copyright (c) 2017, Intel Corporation. + * Copyright (c) 2016 Actifio, Inc. All rights reserved. */ #ifndef _SYS_SPA_IMPL_H @@ -398,6 +399,8 @@ struct spa { uint64_t spa_lowmem_last_txg; /* txg window start */ hrtime_t spa_ccw_fail_time; /* Conf cache write fail time */ + + taskq_t *spa_zvol_taskq; /* Taskq for minor management */ uint64_t spa_multihost; /* multihost aware (mmp) */ mmp_thread_t spa_mmp; /* multihost mmp thread */ Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zvol.h ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zvol.h Fri Aug 28 10:33:19 2020 (r364916) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zvol.h Fri Aug 28 13:15:13 2020 (r364917) @@ -21,6 +21,7 @@ /* * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016 Actifio, Inc. All rights reserved. */ #ifndef _SYS_ZVOL_H @@ -40,9 +41,6 @@ extern int zvol_check_volsize(uint64_t volsize, uint64 extern int zvol_check_volblocksize(uint64_t volblocksize); extern int zvol_get_stats(objset_t *os, nvlist_t *nv); extern void zvol_create_cb(objset_t *os, void *arg, cred_t *cr, dmu_tx_t *tx); -extern int zvol_create_minor(const char *); -extern int zvol_remove_minor(const char *); -extern void zvol_remove_minors(const char *); extern int zvol_set_volsize(const char *, uint64_t); #ifdef illumos @@ -72,8 +70,10 @@ extern void zvol_log_write_minor(void *minor_hdl, dmu_ #endif /* illumos */ #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) -extern int zvol_create_minors(const char *name); -extern void zvol_rename_minors(const char *oldname, const char *newname); +extern void zvol_create_minors(spa_t *spa, const char *name); +extern void zvol_remove_minors(spa_t *spa, const char *name); +extern void zvol_rename_minors(spa_t *spa, const char *oldname, + const char *newname); #endif #endif /* _KERNEL */ Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Fri Aug 28 10:33:19 2020 (r364916) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Fri Aug 28 13:15:13 2020 (r364917) @@ -1642,8 +1642,10 @@ zfs_ioc_pool_destroy(zfs_cmd_t *zc) int error; zfs_log_history(zc); error = spa_destroy(zc->zc_name); +#ifndef __FreeBSD__ if (error == 0) zvol_remove_minors(zc->zc_name); +#endif return (error); } @@ -1694,8 +1696,10 @@ zfs_ioc_pool_export(zfs_cmd_t *zc) zfs_log_history(zc); error = spa_export(zc->zc_name, NULL, force, hardforce); +#ifndef __FreeBSD__ if (error == 0) zvol_remove_minors(zc->zc_name); +#endif return (error); } @@ -3395,13 +3399,23 @@ zfs_ioc_create(const char *fsname, nvlist_t *innvl, nv if (error == 0) { error = zfs_set_prop_nvlist(fsname, ZPROP_SRC_LOCAL, nvprops, outnvl); +#if defined(__FreeBSD__) && defined(_KERNEL) + /* + * Wait for ZVOL operations to settle down before destroying. + */ + if (error != 0) { + spa_t *spa; + + if (spa_open(fsname, &spa, FTAG) == 0) { + taskqueue_drain_all( + spa->spa_zvol_taskq->tq_queue); + spa_close(spa, FTAG); + } + } +#endif if (error != 0) (void) dsl_destroy_head(fsname); } -#ifdef __FreeBSD__ - if (error == 0 && type == DMU_OST_ZVOL) - zvol_create_minors(fsname); -#endif return (error); } @@ -3443,10 +3457,6 @@ zfs_ioc_clone(const char *fsname, nvlist_t *innvl, nvl if (error != 0) (void) dsl_destroy_head(fsname); } -#ifdef __FreeBSD__ - if (error == 0) - zvol_create_minors(fsname); -#endif return (error); } @@ -3738,9 +3748,6 @@ zfs_ioc_destroy_snaps(const char *poolname, nvlist_t * return (SET_ERROR(EXDEV)); zfs_unmount_snap(nvpair_name(pair)); -#if defined(__FreeBSD__) - zvol_remove_minors(name); -#endif } return (dsl_destroy_snapshots_nvl(snaps, defer, outnvl)); @@ -3924,10 +3931,8 @@ zfs_ioc_destroy(zfs_cmd_t *zc) err = dsl_destroy_snapshot(zc->zc_name, zc->zc_defer_destroy); else err = dsl_destroy_head(zc->zc_name); +#ifndef __FreeBSD__ if (ost == DMU_OST_ZVOL && err == 0) -#ifdef __FreeBSD__ - zvol_remove_minors(zc->zc_name); -#else (void) zvol_remove_minor(zc->zc_name); #endif return (err); @@ -4813,11 +4818,6 @@ zfs_ioc_recv(zfs_cmd_t *zc) } #endif -#ifdef __FreeBSD__ - if (error == 0) - zvol_create_minors(tofs); -#endif - /* * On error, restore the original props. */ @@ -6958,6 +6958,24 @@ zfsdev_ioctl(struct cdev *dev, u_long zcmd, caddr_t ar out: nvlist_free(innvl); + +#if defined(__FreeBSD__) && defined(_KERNEL) + /* + * Wait for ZVOL changes to get applied. + * NB: taskqueue_drain_all() does less than taskq_wait(), + * but enough for what we want. + * And there is no equivalent illumos API. + */ + if (error == 0) { + spa_t *spa; + + if (spa_open(saved_poolname, &spa, FTAG) == 0) { + taskqueue_drain_all( + spa->spa_zvol_taskq->tq_queue); + spa_close(spa, FTAG); + } + } +#endif #ifdef illumos rc = ddi_copyout(zc, (void *)arg, sizeof (zfs_cmd_t), flag); Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Fri Aug 28 10:33:19 2020 (r364916) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Fri Aug 28 13:15:13 2020 (r364917) @@ -30,6 +30,7 @@ * Copyright (c) 2012, 2017 by Delphix. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright (c) 2016 Actifio, Inc. All rights reserved. */ /* Portions Copyright 2011 Martin Matuska */ @@ -184,6 +185,20 @@ typedef struct zvol_state { #endif } zvol_state_t; +typedef enum { + ZVOL_ASYNC_CREATE_MINORS, + ZVOL_ASYNC_REMOVE_MINORS, + ZVOL_ASYNC_RENAME_MINORS, + ZVOL_ASYNC_MAX +} zvol_async_op_t; + +typedef struct { + zvol_async_op_t op; + char pool[ZFS_MAX_DATASET_NAME_LEN]; + char name1[ZFS_MAX_DATASET_NAME_LEN]; + char name2[ZFS_MAX_DATASET_NAME_LEN]; +} zvol_task_t; + #ifndef illumos static LIST_HEAD(, zvol_state) all_zvols; #endif @@ -606,7 +621,7 @@ zvol_name2minor(const char *name, minor_t *minor) /* * Create a minor node (plus a whole lot more) for the specified volume. */ -int +static int zvol_create_minor(const char *name) { zfs_soft_state_t *zs; @@ -690,7 +705,6 @@ zvol_create_minor(const char *name) if (error != 0 || mode == ZFS_VOLMODE_DEFAULT) mode = volmode; - DROP_GIANT(); zv->zv_volmode = mode; if (zv->zv_volmode == ZFS_VOLMODE_GEOM) { g_topology_lock(); @@ -765,7 +779,6 @@ zvol_create_minor(const char *name) zvol_geom_run(zv); g_topology_unlock(); } - PICKUP_GIANT(); ZFS_LOG(1, "ZVOL %s created.", name); #endif @@ -819,22 +832,6 @@ zvol_remove_zv(zvol_state_t *zv) } int -zvol_remove_minor(const char *name) -{ - zvol_state_t *zv; - int rc; - - mutex_enter(&zfsdev_state_lock); - if ((zv = zvol_minor_lookup(name)) == NULL) { - mutex_exit(&zfsdev_state_lock); - return (SET_ERROR(ENXIO)); - } - rc = zvol_remove_zv(zv); - mutex_exit(&zfsdev_state_lock); - return (rc); -} - -int zvol_first_open(zvol_state_t *zv) { dmu_object_info_t doi; @@ -975,7 +972,7 @@ zvol_update_volsize(objset_t *os, uint64_t volsize) } void -zvol_remove_minors(const char *name) +zvol_remove_minors_impl(const char *name) { #ifdef illumos zvol_state_t *zv; @@ -1003,7 +1000,6 @@ zvol_remove_minors(const char *name) namelen = strlen(name); - DROP_GIANT(); mutex_enter(&zfsdev_state_lock); LIST_FOREACH_SAFE(zv, &all_zvols, zv_links, tzv) { @@ -1016,7 +1012,6 @@ zvol_remove_minors(const char *name) } mutex_exit(&zfsdev_state_lock); - PICKUP_GIANT(); #endif /* illumos */ } @@ -2919,7 +2914,7 @@ zvol_create_snapshots(objset_t *os, const char *name) } int -zvol_create_minors(const char *name) +zvol_create_minors_impl(const char *name) { uint64_t cookie; objset_t *os; @@ -2975,7 +2970,7 @@ zvol_create_minors(const char *name) while (dmu_dir_list_next(os, MAXPATHLEN - (p - osname), p, NULL, &cookie) == 0) { dmu_objset_rele(os, FTAG); - (void)zvol_create_minors(osname); + (void)zvol_create_minors_impl(osname); if ((error = dmu_objset_hold(name, FTAG, &os)) != 0) { printf("ZFS WARNING: Unable to put hold on %s (error=%d).\n", name, error); @@ -3044,7 +3039,7 @@ zvol_rename_minor(zvol_state_t *zv, const char *newnam } void -zvol_rename_minors(const char *oldname, const char *newname) +zvol_rename_minors_impl(const char *oldname, const char *newname) { char name[MAXPATHLEN]; struct g_provider *pp; @@ -3057,7 +3052,6 @@ zvol_rename_minors(const char *oldname, const char *ne oldnamelen = strlen(oldname); newnamelen = strlen(newname); - DROP_GIANT(); /* See comment in zvol_open(). */ if (!MUTEX_HELD(&zfsdev_state_lock)) { mutex_enter(&zfsdev_state_lock); @@ -3079,7 +3073,88 @@ zvol_rename_minors(const char *oldname, const char *ne if (locked) mutex_exit(&zfsdev_state_lock); - PICKUP_GIANT(); +} + +static zvol_task_t * +zvol_task_alloc(zvol_async_op_t op, const char *name1, const char *name2) +{ + zvol_task_t *task; + char *delim; + + task = kmem_zalloc(sizeof (zvol_task_t), KM_SLEEP); + task->op = op; + delim = strchr(name1, '/'); + strlcpy(task->pool, name1, delim ? (delim - name1 + 1) : MAXNAMELEN); + + strlcpy(task->name1, name1, MAXNAMELEN); + if (name2 != NULL) + strlcpy(task->name2, name2, MAXNAMELEN); + + return (task); +} + +static void +zvol_task_free(zvol_task_t *task) +{ + kmem_free(task, sizeof (zvol_task_t)); +} + +/* + * The worker thread function performed asynchronously. + */ +static void +zvol_task_cb(void *param) +{ + zvol_task_t *task = (zvol_task_t *)param; + + switch (task->op) { + case ZVOL_ASYNC_CREATE_MINORS: + (void) zvol_create_minors_impl(task->name1); + break; + case ZVOL_ASYNC_REMOVE_MINORS: + zvol_remove_minors_impl(task->name1); + break; + case ZVOL_ASYNC_RENAME_MINORS: + zvol_rename_minors_impl(task->name1, task->name2); + break; + default: + VERIFY(0); + break; + } + + zvol_task_free(task); +} + +static void +zvol_minors_helper(spa_t *spa, zvol_async_op_t op, const char *name1, + const char *name2) +{ + zvol_task_t *task; + + if (dataset_name_hidden(name1)) + return; + if (name2 != NULL && dataset_name_hidden(name2)) + return; + task = zvol_task_alloc(op, name1, name2); + (void)taskq_dispatch(spa->spa_zvol_taskq, zvol_task_cb, task, TQ_SLEEP); +} + +void +zvol_create_minors(spa_t *spa, const char *name) +{ + zvol_minors_helper(spa, ZVOL_ASYNC_CREATE_MINORS, name, NULL); +} + +void +zvol_remove_minors(spa_t *spa, const char *name) +{ + zvol_minors_helper(spa, ZVOL_ASYNC_REMOVE_MINORS, name, NULL); +} + +void +zvol_rename_minors(spa_t *spa, const char *oldname, const char *newname) +{ + zvol_minors_helper(spa, ZVOL_ASYNC_RENAME_MINORS, oldname, newname); } static int From owner-svn-src-stable-12@freebsd.org Fri Aug 28 16:40:39 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AD1EF3B7277; Fri, 28 Aug 2020 16:40: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BdQMC3833z3bJk; Fri, 28 Aug 2020 16:40: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 4E59717DBC; Fri, 28 Aug 2020 16:40: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 07SGedXg058161; Fri, 28 Aug 2020 16:40:39 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07SGedQU058160; Fri, 28 Aug 2020 16:40:39 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <202008281640.07SGedQU058160@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 28 Aug 2020 16:40:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364921 - in stable: 11/usr.sbin/fifolog/lib 12/usr.sbin/fifolog/lib X-SVN-Group: stable-12 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: in stable: 11/usr.sbin/fifolog/lib 12/usr.sbin/fifolog/lib X-SVN-Commit-Revision: 364921 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Aug 2020 16:40:39 -0000 Author: gjb Date: Fri Aug 28 16:40:38 2020 New Revision: 364921 URL: https://svnweb.freebsd.org/changeset/base/364921 Log: MFC r362718 (adrian): [fifolog] wrap the recno when we hit the end of the provided file size. Without this the log just keeps growing to infinity. Reported by: phk Sponsored by: Rubicon Communications, LLC (netgate.com) Modified: stable/12/usr.sbin/fifolog/lib/fifolog_write_poll.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/usr.sbin/fifolog/lib/fifolog_write_poll.c Directory Properties: stable/11/ (props changed) Modified: stable/12/usr.sbin/fifolog/lib/fifolog_write_poll.c ============================================================================== --- stable/12/usr.sbin/fifolog/lib/fifolog_write_poll.c Fri Aug 28 16:40:33 2020 (r364920) +++ stable/12/usr.sbin/fifolog/lib/fifolog_write_poll.c Fri Aug 28 16:40:38 2020 (r364921) @@ -239,6 +239,14 @@ fifolog_write_output(struct fifolog_writer *f, int fl, */ f->seq++; f->recno++; + + /* + * Ensure we wrap recno once we hit the file size (in records.) + */ + if (f->recno >= f->ff->logsize) + /* recno 0 is header; skip */ + f->recno = 1; + f->flag = 0; memset(f->obuf, 0, f->obufsize); From owner-svn-src-stable-12@freebsd.org Fri Aug 28 19:52:17 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 888623BE4B8; Fri, 28 Aug 2020 19:52:17 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BdVcK38fgz4Gq1; Fri, 28 Aug 2020 19:52:17 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4FB8E19FF4; Fri, 28 Aug 2020 19:52:17 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07SJqH3p087008; Fri, 28 Aug 2020 19:52:17 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07SJqHKe087007; Fri, 28 Aug 2020 19:52:17 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202008281952.07SJqHKe087007@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 28 Aug 2020 19:52:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364934 - in stable: 11/sys/kern 12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/sys/kern 12/sys/kern X-SVN-Commit-Revision: 364934 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Aug 2020 19:52:17 -0000 Author: jhb Date: Fri Aug 28 19:52:16 2020 New Revision: 364934 URL: https://svnweb.freebsd.org/changeset/base/364934 Log: MFC 361613: Permit SO_NO_DDP and SO_NO_OFFLOAD to be read via getsockopt(2). Modified: stable/12/sys/kern/uipc_socket.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/kern/uipc_socket.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/kern/uipc_socket.c ============================================================================== --- stable/12/sys/kern/uipc_socket.c Fri Aug 28 19:50:40 2020 (r364933) +++ stable/12/sys/kern/uipc_socket.c Fri Aug 28 19:52:16 2020 (r364934) @@ -3023,6 +3023,8 @@ sogetopt(struct socket *so, struct sockopt *sopt) case SO_TIMESTAMP: case SO_BINTIME: case SO_NOSIGPIPE: + case SO_NO_DDP: + case SO_NO_OFFLOAD: optval = so->so_options & sopt->sopt_name; integer: error = sooptcopyout(sopt, &optval, sizeof optval); From owner-svn-src-stable-12@freebsd.org Fri Aug 28 20:25:04 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 869153BFCC5; Fri, 28 Aug 2020 20:25:04 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BdWL83MK3z4M7V; Fri, 28 Aug 2020 20:25:04 +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 3B8FE1A821; Fri, 28 Aug 2020 20:25:04 +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 07SKP4CG007107; Fri, 28 Aug 2020 20:25:04 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07SKP30t007104; Fri, 28 Aug 2020 20:25:03 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <202008282025.07SKP30t007104@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Fri, 28 Aug 2020 20:25:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364938 - stable/12/sys/arm64/rockchip/clk X-SVN-Group: stable-12 X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: stable/12/sys/arm64/rockchip/clk X-SVN-Commit-Revision: 364938 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Aug 2020 20:25:04 -0000 Author: gonzo Date: Fri Aug 28 20:25:03 2020 New Revision: 364938 URL: https://svnweb.freebsd.org/changeset/base/364938 Log: MFC r357250, r363926-r363927 r357250 (by ganbold@): Add USB3 related clock definitions for Rockchip RK3328 SoC. Reviewed by: manu r363926: Add flag for SYSCON-controlled clocks on Rockhip platform Ethernet clocks on RK3328 are controlled by SYSCON registers, so add RK_CLK_COMPOSITE_GRF flag to indicate that clock node should access grf registers instead of CRU's Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D25918 r363927: Add clocks for ethernet controllers on RK3328 Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D25918 Modified: stable/12/sys/arm64/rockchip/clk/rk3328_cru.c stable/12/sys/arm64/rockchip/clk/rk_clk_composite.c stable/12/sys/arm64/rockchip/clk/rk_clk_composite.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/rockchip/clk/rk3328_cru.c ============================================================================== --- stable/12/sys/arm64/rockchip/clk/rk3328_cru.c Fri Aug 28 20:05:18 2020 (r364937) +++ stable/12/sys/arm64/rockchip/clk/rk3328_cru.c Fri Aug 28 20:25:03 2020 (r364938) @@ -50,8 +50,31 @@ __FBSDID("$FreeBSD$"); #include +/* Registers */ +#define RK3328_GRF_SOC_CON4 0x410 +#define RK3328_GRF_MAC_CON1 0x904 +#define RK3328_GRF_MAC_CON2 0x908 + /* GATES */ +#define SCLK_MAC2PHY_RXTX 83 +#define SCLK_MAC2PHY_SRC 84 +#define SCLK_MAC2PHY_REF 85 +#define SCLK_MAC2PHY_OUT 86 +#define SCLK_MAC2IO_RX 87 +#define SCLK_MAC2IO_TX 88 +#define SCLK_MAC2IO_REFOUT 89 +#define SCLK_MAC2IO_REF 90 +#define SCLK_MAC2IO_OUT 91 +#define SCLK_USB3OTG_REF 96 +#define SCLK_MAC2IO_SRC 99 +#define SCLK_MAC2IO 100 +#define SCLK_MAC2PHY 101 +#define SCLK_MAC2IO_EXT 102 +#define ACLK_USB3OTG 132 +#define ACLK_GMAC 146 +#define ACLK_MAC2PHY 149 +#define ACLK_MAC2IO 150 #define ACLK_PERI 153 #define PCLK_GPIO0 200 #define PCLK_GPIO1 201 @@ -62,6 +85,12 @@ __FBSDID("$FreeBSD$"); #define PCLK_I2C2 207 #define PCLK_I2C3 208 #define PCLK_TSADC 213 +#define PCLK_GMAC 220 +#define PCLK_MAC2PHY 222 +#define PCLK_MAC2IO 223 +#define PCLK_USB3PHY_OTG 224 +#define PCLK_USB3PHY_PIPE 225 +#define PCLK_USB3_GRF 226 #define HCLK_SDMMC 317 #define HCLK_SDIO 318 #define HCLK_EMMC 319 @@ -77,11 +106,20 @@ static struct rk_cru_gate rk3328_gates[] = { /* CRU_CLKGATE_CON4 */ CRU_GATE(0, "gpll_peri", "gpll", 0x210, 0) CRU_GATE(0, "cpll_peri", "cpll", 0x210, 1) + CRU_GATE(SCLK_USB3OTG_REF, "clk_usb3otg_ref", "xin24m", 0x210, 7) /* CRU_CLKGATE_CON8 */ CRU_GATE(0, "pclk_bus", "pclk_bus_pre", 0x220, 3) CRU_GATE(0, "pclk_phy_pre", "pclk_bus_pre", 0x220, 4) + /* CRU_CLKGATE_CON8 */ + CRU_GATE(SCLK_MAC2IO_REF, "clk_mac2io_ref", "clk_mac2io", 0x224, 7) + CRU_GATE(SCLK_MAC2IO_REFOUT, "clk_mac2io_refout", "clk_mac2io", 0x224, 6) + CRU_GATE(SCLK_MAC2IO_TX, "clk_mac2io_tx", "clk_mac2io", 0x224, 5) + CRU_GATE(SCLK_MAC2IO_RX, "clk_mac2io_rx", "clk_mac2io", 0x224, 4) + CRU_GATE(SCLK_MAC2PHY_REF, "clk_mac2phy_ref", "clk_mac2phy", 0x224, 3) + CRU_GATE(SCLK_MAC2PHY_RXTX, "clk_mac2phy_rxtx", "clk_mac2phy", 0x224, 1) + /* CRU_CLKGATE_CON10 */ CRU_GATE(ACLK_PERI, "aclk_peri", "aclk_peri_pre", 0x228, 0) @@ -99,13 +137,27 @@ static struct rk_cru_gate rk3328_gates[] = { CRU_GATE(PCLK_GPIO2, "pclk_gpio2", "pclk_bus", 0x240, 9) CRU_GATE(PCLK_GPIO3, "pclk_gpio3", "pclk_bus", 0x240, 10) + /* CRU_CLKGATE_CON17 */ + CRU_GATE(PCLK_USB3_GRF, "pclk_usb3_grf", "pclk_phy_pre", 0x244, 2) + /* CRU_CLKGATE_CON19 */ CRU_GATE(HCLK_SDMMC, "hclk_sdmmc", "hclk_peri", 0x24C, 0) CRU_GATE(HCLK_SDIO, "hclk_sdio", "hclk_peri", 0x24C, 1) CRU_GATE(HCLK_EMMC, "hclk_emmc", "hclk_peri", 0x24C, 2) CRU_GATE(0, "hclk_peri_niu", "hclk_peri", 0x24C, 12) CRU_GATE(0, "pclk_peri_niu", "hclk_peri", 0x24C, 13) + CRU_GATE(ACLK_USB3OTG, "aclk_usb3otg", "aclk_peri", 0x24C, 14) CRU_GATE(HCLK_SDMMC_EXT, "hclk_sdmmc_ext", "hclk_peri", 0x24C, 15) + + /* CRU_CLKGATE_CON26 */ + CRU_GATE(ACLK_MAC2PHY, "aclk_mac2phy", "aclk_gmac", 0x268, 0) + CRU_GATE(PCLK_MAC2PHY, "pclk_mac2phy", "pclk_gmac", 0x268, 1) + CRU_GATE(ACLK_MAC2IO, "aclk_mac2io", "aclk_gmac", 0x268, 2) + CRU_GATE(PCLK_MAC2IO, "pclk_mac2io", "pclk_gmac", 0x268, 3) + + /* CRU_CLKGATE_CON28 */ + CRU_GATE(PCLK_USB3PHY_OTG, "pclk_usb3phy_otg", "pclk_phy_pre", 0x270, 1) + CRU_GATE(PCLK_USB3PHY_PIPE, "pclk_usb3phy_pipe", "pclk_phy_pre", 0x270, 2) }; /* @@ -992,6 +1044,282 @@ static struct rk_clk_composite_def i2c3 = { .flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_HAVE_GATE, }; +#define SCLK_USB3_REF 72 +#define SCLK_USB3_SUSPEND 73 +#define SCLK_USB3PHY_REF 94 +#define SCLK_REF_USB3OTG 95 +#define SCLK_USB3OTG_SUSPEND 97 +#define SCLK_REF_USB3OTG_SRC 98 + +static const char *ref_usb3otg_parents[] = { "xin24m", "clk_usb3otg_ref" }; + +static struct rk_clk_composite_def ref_usb3otg = { + .clkdef = { + .id = SCLK_REF_USB3OTG, + .name = "clk_ref_usb3otg", + .parent_names = ref_usb3otg_parents, + .parent_cnt = nitems(ref_usb3otg_parents), + }, + .muxdiv_offset = 0x1B4, + + .mux_shift = 8, + .mux_width = 1, + + .flags = RK_CLK_COMPOSITE_HAVE_MUX, +}; + +static const char *usb3otg_suspend_parents[] = { "xin24m"/*, "clk_rtc32k" */}; + +static struct rk_clk_composite_def usb3otg_suspend = { + .clkdef = { + .id = SCLK_USB3OTG_SUSPEND, + .name = "clk_usb3otg_suspend", + .parent_names = usb3otg_suspend_parents, + .parent_cnt = nitems(usb3otg_suspend_parents), + }, + .muxdiv_offset = 0x184, + + .mux_shift = 15, + .mux_width = 1, + + .div_shift = 0, + .div_width = 10, + + /* CRU_CLKGATE_CON4 */ + .gate_offset = 0x210, + .gate_shift = 8, + + .flags = RK_CLK_COMPOSITE_HAVE_GATE, +}; + +static const char *ref_usb3otg_src_parents[] = { "cpll", "gpll" }; + +static struct rk_clk_composite_def ref_usb3otg_src = { + .clkdef = { + .id = SCLK_REF_USB3OTG_SRC, + .name = "clk_ref_usb3otg_src", + .parent_names = ref_usb3otg_src_parents, + .parent_cnt = nitems(ref_usb3otg_src_parents), + }, + .muxdiv_offset = 0x1B4, + + .mux_shift = 7, + .mux_width = 1, + + .div_shift = 0, + .div_width = 7, + + /* CRU_CLKGATE_CON4 */ + .gate_offset = 0x210, + .gate_shift = 9, + + .flags = RK_CLK_COMPOSITE_HAVE_GATE, +}; + +static const char *mac2io_src_parents[] = { "cpll", "gpll" }; + +static struct rk_clk_composite_def mac2io_src = { + .clkdef = { + .id = SCLK_MAC2IO_SRC, + .name = "clk_mac2io_src", + .parent_names = mac2io_src_parents, + .parent_cnt = nitems(mac2io_src_parents), + }, + /* CRU_CLKSEL_CON27 */ + .muxdiv_offset = 0x16c, + + .mux_shift = 7, + .mux_width = 1, + + .div_shift = 0, + .div_width = 5, + + /* CRU_CLKGATE_CON3 */ + .gate_offset = 0x20c, + .gate_shift = 1, + + .flags = RK_CLK_COMPOSITE_HAVE_GATE | RK_CLK_COMPOSITE_HAVE_MUX, +}; + +static const char *mac2io_out_parents[] = { "cpll", "gpll" }; + +static struct rk_clk_composite_def mac2io_out = { + .clkdef = { + .id = SCLK_MAC2IO_OUT, + .name = "clk_mac2io_out", + .parent_names = mac2io_out_parents, + .parent_cnt = nitems(mac2io_out_parents), + }, + /* CRU_CLKSEL_CON27 */ + .muxdiv_offset = 0x16c, + + .mux_shift = 15, + .mux_width = 1, + + .div_shift = 8, + .div_width = 5, + + /* CRU_CLKGATE_CON3 */ + .gate_offset = 0x20c, + .gate_shift = 5, + + .flags = RK_CLK_COMPOSITE_HAVE_GATE | RK_CLK_COMPOSITE_HAVE_MUX, +}; + +static const char *mac2io_parents[] = { "clk_mac2io_src", "gmac_clkin" }; + +static struct rk_clk_composite_def mac2io = { + .clkdef = { + .id = SCLK_MAC2IO, + .name = "clk_mac2io", + .parent_names = mac2io_parents, + .parent_cnt = nitems(mac2io_parents), + }, + .muxdiv_offset = RK3328_GRF_MAC_CON1, + + .mux_shift = 10, + .mux_width = 1, + + .flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_GRF +}; + +static const char *mac2io_ext_parents[] = { "clk_mac2io", "gmac_clkin" }; + +static struct rk_clk_composite_def mac2io_ext = { + .clkdef = { + .id = SCLK_MAC2IO_EXT, + .name = "clk_mac2io_ext", + .parent_names = mac2io_ext_parents, + .parent_cnt = nitems(mac2io_ext_parents), + }, + .muxdiv_offset = RK3328_GRF_SOC_CON4, + + .mux_shift = 14, + .mux_width = 1, + + .flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_GRF +}; + +static const char *mac2phy_src_parents[] = { "cpll", "gpll" }; + +static struct rk_clk_composite_def mac2phy_src = { + .clkdef = { + .id = SCLK_MAC2PHY_SRC, + .name = "clk_mac2phy_src", + .parent_names = mac2phy_src_parents, + .parent_cnt = nitems(mac2phy_src_parents), + }, + /* CRU_CLKSEL_CON26 */ + .muxdiv_offset = 0x168, + + .mux_shift = 7, + .mux_width = 1, + + .div_shift = 0, + .div_width = 5, + + /* CRU_CLKGATE_CON3 */ + .gate_offset = 0x20c, + .gate_shift = 0, + + .flags = RK_CLK_COMPOSITE_HAVE_GATE | RK_CLK_COMPOSITE_HAVE_MUX, +}; + +static const char *mac2phy_parents[] = { "clk_mac2phy_src", "phy_50m_out" }; + +static struct rk_clk_composite_def mac2phy = { + .clkdef = { + .id = SCLK_MAC2PHY, + .name = "clk_mac2phy", + .parent_names = mac2phy_parents, + .parent_cnt = nitems(mac2phy_parents), + }, + .muxdiv_offset = RK3328_GRF_MAC_CON2, + + .mux_shift = 10, + .mux_width = 1, + + .flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_GRF +}; + +static const char *mac2phy_out_parents[] = { "clk_mac2phy" }; + +static struct rk_clk_composite_def mac2phy_out = { + .clkdef = { + .id = SCLK_MAC2PHY_OUT, + .name = "clk_mac2phy_out", + .parent_names = mac2phy_out_parents, + .parent_cnt = nitems(mac2phy_out_parents), + }, + /* CRU_CLKSEL_CON26 */ + .muxdiv_offset = 0x168, + + .div_shift = 8, + .div_width = 2, + + /* CRU_CLKGATE_CON9 */ + .gate_offset = 0x224, + .gate_shift = 2, + + .flags = RK_CLK_COMPOSITE_HAVE_GATE +}; + +static struct clk_fixed_def phy_50m_out = { + .clkdef.name = "phy_50m_out", + .freq = 50000000, +}; + +static struct clk_link_def gmac_clkin = { + .clkdef.name = "gmac_clkin", +}; + +static const char *aclk_gmac_parents[] = { "cpll", "gpll" }; + +static struct rk_clk_composite_def aclk_gmac = { + .clkdef = { + .id = ACLK_GMAC, + .name = "aclk_gmac", + .parent_names = aclk_gmac_parents, + .parent_cnt = nitems(aclk_gmac_parents), + }, + /* CRU_CLKSEL_CON35 */ + .muxdiv_offset = 0x18c, + + .mux_shift = 6, + .mux_width = 2, + + .div_shift = 0, + .div_width = 5, + + /* CRU_CLKGATE_CON3 */ + .gate_offset = 0x20c, + .gate_shift = 2, + + .flags = RK_CLK_COMPOSITE_HAVE_GATE | RK_CLK_COMPOSITE_HAVE_MUX, +}; + +static const char *pclk_gmac_parents[] = { "aclk_gmac" }; + +static struct rk_clk_composite_def pclk_gmac = { + .clkdef = { + .id = PCLK_GMAC, + .name = "pclk_gmac", + .parent_names = pclk_gmac_parents, + .parent_cnt = nitems(pclk_gmac_parents), + }, + /* CRU_CLKSEL_CON25 */ + .muxdiv_offset = 0x164, + + .div_shift = 8, + .div_width = 3, + + /* CRU_CLKGATE_CON9 */ + .gate_offset = 0x224, + .gate_shift = 0, + + .flags = RK_CLK_COMPOSITE_HAVE_GATE +}; + static struct rk_clk rk3328_clks[] = { { .type = RK3328_CLK_PLL, @@ -1076,6 +1404,63 @@ static struct rk_clk rk3328_clks[] = { { .type = RK_CLK_COMPOSITE, .clk.composite = &i2c3 + }, + + { + .type = RK_CLK_COMPOSITE, + .clk.composite = &ref_usb3otg + }, + { + .type = RK_CLK_COMPOSITE, + .clk.composite = &ref_usb3otg_src + }, + { + .type = RK_CLK_COMPOSITE, + .clk.composite = &usb3otg_suspend + }, + { + .type = RK_CLK_COMPOSITE, + .clk.composite = &mac2io_src + }, + { + .type = RK_CLK_COMPOSITE, + .clk.composite = &mac2io + }, + { + .type = RK_CLK_COMPOSITE, + .clk.composite = &mac2io_out + }, + { + .type = RK_CLK_COMPOSITE, + .clk.composite = &mac2io_ext + }, + { + .type = RK_CLK_COMPOSITE, + .clk.composite = &mac2phy_src + }, + { + .type = RK_CLK_COMPOSITE, + .clk.composite = &mac2phy + }, + { + .type = RK_CLK_COMPOSITE, + .clk.composite = &mac2phy_out + }, + { + .type = RK_CLK_FIXED, + .clk.fixed = &phy_50m_out + }, + { + .type = RK_CLK_LINK, + .clk.link = &gmac_clkin + }, + { + .type = RK_CLK_COMPOSITE, + .clk.composite = &aclk_gmac + }, + { + .type = RK_CLK_COMPOSITE, + .clk.composite = &pclk_gmac }, }; Modified: stable/12/sys/arm64/rockchip/clk/rk_clk_composite.c ============================================================================== --- stable/12/sys/arm64/rockchip/clk/rk_clk_composite.c Fri Aug 28 20:05:18 2020 (r364937) +++ stable/12/sys/arm64/rockchip/clk/rk_clk_composite.c Fri Aug 28 20:25:03 2020 (r364938) @@ -36,10 +36,12 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include "clkdev_if.h" +#include "syscon_if.h" struct rk_clk_composite_sc { uint32_t muxdiv_offset; @@ -55,12 +57,14 @@ struct rk_clk_composite_sc { uint32_t gate_shift; uint32_t flags; + + struct syscon *grf; }; #define WRITE4(_clk, off, val) \ - CLKDEV_WRITE_4(clknode_get_device(_clk), off, val) + rk_clk_composite_write_4(_clk, off, val) #define READ4(_clk, off, val) \ - CLKDEV_READ_4(clknode_get_device(_clk), off, val) + rk_clk_composite_read_4(_clk, off, val) #define DEVICE_LOCK(_clk) \ CLKDEV_DEVICE_LOCK(clknode_get_device(_clk)) #define DEVICE_UNLOCK(_clk) \ @@ -75,6 +79,49 @@ struct rk_clk_composite_sc { #define dprintf(format, arg...) #endif +static void +rk_clk_composite_read_4(struct clknode *clk, bus_addr_t addr, uint32_t *val) +{ + struct rk_clk_composite_sc *sc; + + sc = clknode_get_softc(clk); + if (sc->grf) + *val = SYSCON_READ_4(sc->grf, addr); + else + CLKDEV_READ_4(clknode_get_device(clk), addr, val); +} + +static void +rk_clk_composite_write_4(struct clknode *clk, bus_addr_t addr, uint32_t val) +{ + struct rk_clk_composite_sc *sc; + + sc = clknode_get_softc(clk); + if (sc->grf) + SYSCON_WRITE_4(sc->grf, addr, val | (0xffff << 16)); + else + CLKDEV_WRITE_4(clknode_get_device(clk), addr, val); +} + +static struct syscon * +rk_clk_composite_get_grf(struct clknode *clk) +{ + device_t dev; + phandle_t node; + struct syscon *grf; + + grf = NULL; + dev = clknode_get_device(clk); + node = ofw_bus_get_node(dev); + if (OF_hasprop(node, "rockchip,grf") && + syscon_get_by_ofw_property(dev, node, + "rockchip,grf", &grf) != 0) { + return (NULL); + } + + return (grf); +} + static int rk_clk_composite_init(struct clknode *clk, device_t dev) { @@ -82,6 +129,12 @@ rk_clk_composite_init(struct clknode *clk, device_t de uint32_t val, idx; sc = clknode_get_softc(clk); + if ((sc->flags & RK_CLK_COMPOSITE_GRF) != 0) { + sc->grf = rk_clk_composite_get_grf(clk); + if (sc->grf == NULL) + panic("clock %s has GRF flag set but no syscon is available", + clknode_get_name(clk)); + } idx = 0; if ((sc->flags & RK_CLK_COMPOSITE_HAVE_MUX) != 0) { Modified: stable/12/sys/arm64/rockchip/clk/rk_clk_composite.h ============================================================================== --- stable/12/sys/arm64/rockchip/clk/rk_clk_composite.h Fri Aug 28 20:05:18 2020 (r364937) +++ stable/12/sys/arm64/rockchip/clk/rk_clk_composite.h Fri Aug 28 20:25:03 2020 (r364938) @@ -54,6 +54,7 @@ struct rk_clk_composite_def { #define RK_CLK_COMPOSITE_HAVE_GATE 0x0002 #define RK_CLK_COMPOSITE_DIV_EXP 0x0004 /* Register 0, 1, 2, 2, ... */ /* Divider 1, 2, 4, 8, ... */ +#define RK_CLK_COMPOSITE_GRF 0x0008 /* Use syscon registers instead of CRU's */ int rk_clk_composite_register(struct clkdom *clkdom, struct rk_clk_composite_def *clkdef); From owner-svn-src-stable-12@freebsd.org Fri Aug 28 20:37:58 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 933883C1171; Fri, 28 Aug 2020 20:37:58 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BdWd23Swpz4NrR; Fri, 28 Aug 2020 20:37:58 +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 3784E1A954; Fri, 28 Aug 2020 20:37:58 +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 07SKbv4W013550; Fri, 28 Aug 2020 20:37:57 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07SKbvvx013549; Fri, 28 Aug 2020 20:37:57 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <202008282037.07SKbvvx013549@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Fri, 28 Aug 2020 20:37:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364939 - stable/12/release/tools X-SVN-Group: stable-12 X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: stable/12/release/tools X-SVN-Commit-Revision: 364939 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Aug 2020 20:37:58 -0000 Author: gonzo Date: Fri Aug 28 20:37:57 2020 New Revision: 364939 URL: https://svnweb.freebsd.org/changeset/base/364939 Log: MFC r363187: Enable EFI system partition on amd64 and i386 VM images EFI support is a hard requirement for generating Hyper-V Gen2 VM images. Reviewed by: gjb Differential Revision: https://reviews.freebsd.org/D25655 Modified: stable/12/release/tools/vmimage.subr Directory Properties: stable/12/ (props changed) Modified: stable/12/release/tools/vmimage.subr ============================================================================== --- stable/12/release/tools/vmimage.subr Fri Aug 28 20:25:03 2020 (r364938) +++ stable/12/release/tools/vmimage.subr Fri Aug 28 20:37:57 2020 (r364939) @@ -21,12 +21,17 @@ write_partition_layout() { case "${TARGET}:${TARGET_ARCH}" in amd64:amd64 | i386:i386) + # Create an ESP + espfilename=$(mktemp /tmp/efiboot.XXXXXX) + make_esp_file ${espfilename} ${fat32min} ${BOOTFILES}/efi/loader_lua/loader_lua.efi mkimg -s gpt -f ${VMFORMAT} \ -b ${BOOTFILES}/i386/pmbr/pmbr \ -p freebsd-boot/bootfs:=${BOOTFILES}/i386/gptboot/gptboot \ + -p efi:=${espfilename} \ ${SWAPOPT} \ -p freebsd-ufs/rootfs:=${VMBASE} \ -o ${VMIMAGE} + rm ${espfilename} ;; arm64:aarch64) mkimg -s mbr -f ${VMFORMAT} \ From owner-svn-src-stable-12@freebsd.org Sat Aug 29 06:54:40 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2D7B53CF6FB; Sat, 29 Aug 2020 06:54: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BdnJc0QRSz42bK; Sat, 29 Aug 2020 06:54: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 E54DC21F8D; Sat, 29 Aug 2020 06: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 07T6sdcN099511; Sat, 29 Aug 2020 06:54:39 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07T6sdg7099510; Sat, 29 Aug 2020 06:54:39 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202008290654.07T6sdg7099510@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 29 Aug 2020 06:54:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364947 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364947 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Aug 2020 06:54:40 -0000 Author: tuexen Date: Sat Aug 29 06:54:39 2020 New Revision: 364947 URL: https://svnweb.freebsd.org/changeset/base/364947 Log: MFC r364937: Fix a regression with the explicit EOR mode I introduced in r364268. Modified: stable/12/sys/netinet/sctp_output.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_output.c ============================================================================== --- stable/12/sys/netinet/sctp_output.c Sat Aug 29 04:30:12 2020 (r364946) +++ stable/12/sys/netinet/sctp_output.c Sat Aug 29 06:54:39 2020 (r364947) @@ -13121,11 +13121,10 @@ skip_preblock: error = EINVAL; goto out; } - SCTP_TCB_SEND_UNLOCK(stcb); - strm = &stcb->asoc.strmout[srcv->sinfo_stream]; if (strm->last_msg_incomplete == 0) { do_a_copy_in: + SCTP_TCB_SEND_UNLOCK(stcb); sp = sctp_copy_it_in(stcb, asoc, srcv, uio, net, max_len, user_marks_eor, &error); if (error) { goto out; @@ -13154,19 +13153,8 @@ skip_preblock: sp->processing = 1; TAILQ_INSERT_TAIL(&strm->outqueue, sp, next); stcb->asoc.ss_functions.sctp_ss_add_to_stream(stcb, asoc, strm, sp, 1); - SCTP_TCB_SEND_UNLOCK(stcb); } else { - SCTP_TCB_SEND_LOCK(stcb); sp = TAILQ_LAST(&strm->outqueue, sctp_streamhead); - if (sp->processing) { - SCTP_TCB_SEND_UNLOCK(stcb); - SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); - error = EINVAL; - goto out; - } else { - sp->processing = 1; - } - SCTP_TCB_SEND_UNLOCK(stcb); if (sp == NULL) { /* ???? Huh ??? last msg is gone */ #ifdef INVARIANTS @@ -13178,7 +13166,16 @@ skip_preblock: goto do_a_copy_in; } + if (sp->processing) { + SCTP_TCB_SEND_UNLOCK(stcb); + SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); + error = EINVAL; + goto out; + } else { + sp->processing = 1; + } } + SCTP_TCB_SEND_UNLOCK(stcb); while (uio->uio_resid > 0) { /* How much room do we have? */ struct mbuf *new_tail, *mm; @@ -13203,6 +13200,11 @@ skip_preblock: if (mm) { sctp_m_freem(mm); } + SCTP_TCB_SEND_LOCK(stcb); + if (sp != NULL) { + sp->processing = 0; + } + SCTP_TCB_SEND_UNLOCK(stcb); goto out; } /* Update the mbuf and count */ @@ -13218,6 +13220,9 @@ skip_preblock: SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ECONNRESET); error = ECONNRESET; } + if (sp != NULL) { + sp->processing = 0; + } SCTP_TCB_SEND_UNLOCK(stcb); goto out; } @@ -13277,6 +13282,11 @@ skip_preblock: /* wait for space now */ if (non_blocking) { /* Non-blocking io in place out */ + SCTP_TCB_SEND_LOCK(stcb); + if (sp != NULL) { + sp->processing = 0; + } + SCTP_TCB_SEND_UNLOCK(stcb); goto skip_out_eof; } /* What about the INIT, send it maybe */ @@ -13400,6 +13410,11 @@ skip_preblock: } } SOCKBUF_UNLOCK(&so->so_snd); + SCTP_TCB_SEND_LOCK(stcb); + if (sp != NULL) { + sp->processing = 0; + } + SCTP_TCB_SEND_UNLOCK(stcb); goto out_unlocked; } @@ -13409,9 +13424,15 @@ skip_preblock: } } SOCKBUF_UNLOCK(&so->so_snd); + SCTP_TCB_SEND_LOCK(stcb); if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) { + if (sp != NULL) { + sp->processing = 0; + } + SCTP_TCB_SEND_UNLOCK(stcb); goto out_unlocked; } + SCTP_TCB_SEND_UNLOCK(stcb); } SCTP_TCB_SEND_LOCK(stcb); if ((stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) || From owner-svn-src-stable-12@freebsd.org Sat Aug 29 12:54:18 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 599523D7F84; Sat, 29 Aug 2020 12:54:18 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BdxHZ1gr2z4RVl; Sat, 29 Aug 2020 12:54:18 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 1E131260B3; Sat, 29 Aug 2020 12:54:18 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07TCsHB5022933; Sat, 29 Aug 2020 12:54:17 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07TCsHPj022932; Sat, 29 Aug 2020 12:54:17 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202008291254.07TCsHPj022932@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 29 Aug 2020 12:54:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364955 - stable/12/libexec/rc/rc.d X-SVN-Group: stable-12 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/12/libexec/rc/rc.d X-SVN-Commit-Revision: 364955 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Aug 2020 12:54:18 -0000 Author: trasz Date: Sat Aug 29 12:54:17 2020 New Revision: 364955 URL: https://svnweb.freebsd.org/changeset/base/364955 Log: Drop the "nocover" option from the linux rc script; the option is not yet supported in 12-STABLE. This is a direct commit intended as a temporary workaround. Reported by: scf@ Sponsored by: The FreeBSD Foundation Modified: stable/12/libexec/rc/rc.d/linux Modified: stable/12/libexec/rc/rc.d/linux ============================================================================== --- stable/12/libexec/rc/rc.d/linux Sat Aug 29 12:04:13 2020 (r364954) +++ stable/12/libexec/rc/rc.d/linux Sat Aug 29 12:54:17 2020 (r364955) @@ -48,11 +48,11 @@ linux_start() if checkyesno linux_mounts_enable; then _emul_path="/compat/linux" - mount -o nocover -t linprocfs linprocfs "${_emul_path}/proc" - mount -o nocover -t linsysfs linsysfs "${_emul_path}/sys" - mount -o nocover -t devfs devfs "${_emul_path}/dev" - mount -o nocover,linrdlnk -t fdescfs fdescfs "${_emul_path}/dev/fd" - mount -o nocover,mode=1777 -t tmpfs tmpfs "${_emul_path}/dev/shm" + mount -t linprocfs linprocfs "${_emul_path}/proc" + mount -t linsysfs linsysfs "${_emul_path}/sys" + mount -t devfs devfs "${_emul_path}/dev" + mount -o linrdlnk -t fdescfs fdescfs "${_emul_path}/dev/fd" + mount -o mode=1777 -t tmpfs tmpfs "${_emul_path}/dev/shm" fi } From owner-svn-src-stable-12@freebsd.org Sat Aug 29 16:11:09 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 07CFA3B51B4; Sat, 29 Aug 2020 16:11:09 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from mail.farley.org (mail.farley.org [IPv6:2001:470:1f07:14d3:2::11]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Bf1fh2HLRz3TNK; Sat, 29 Aug 2020 16:11:08 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from thor.farley.org (thor.farley.org [IPv6:2001:470:1f07:14d3:1:0:0:5]) by mail.farley.org (8.16.1/8.16.1) with ESMTP id 07TGB0Hr025029; Sat, 29 Aug 2020 12:11:00 -0400 (EDT) (envelope-from scf@FreeBSD.org) Date: Sat, 29 Aug 2020 12:11:00 -0400 (EDT) From: "Sean C. Farley" To: Edward Tomasz Napierala cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: Re: svn commit: r364955 - stable/12/libexec/rc/rc.d In-Reply-To: <202008291254.07TCsHPj022932@repo.freebsd.org> Message-ID: <19ab7ff-43ca-50c8-b8f2-aad62c50648e@FreeBSD.org> References: <202008291254.07TCsHPj022932@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Spam-Status: No, score=-1.0 required=4.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mail.farley.org X-Rspamd-Queue-Id: 4Bf1fh2HLRz3TNK X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [0.00 / 15.00]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; local_wl_from(0.00)[FreeBSD.org] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Aug 2020 16:11:09 -0000 On Sat, 29 Aug 2020, Edward Tomasz Napierala wrote: > Author: trasz > Date: Sat Aug 29 12:54:17 2020 > New Revision: 364955 > URL: https://svnweb.freebsd.org/changeset/base/364955 > > Log: > Drop the "nocover" option from the linux rc script; the option > is not yet supported in 12-STABLE. > > This is a direct commit intended as a temporary workaround. > > Reported by: scf@ > Sponsored by: The FreeBSD Foundation > > Modified: > stable/12/libexec/rc/rc.d/linux Thank you! Sean -- scf@FreeBSD.org From owner-svn-src-stable-12@freebsd.org Sat Aug 29 16:23:01 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EBDDC3B57F3; Sat, 29 Aug 2020 16:23:01 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Bf1wP5sZDz3V1H; Sat, 29 Aug 2020 16:23:01 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 AD8BD8821; Sat, 29 Aug 2020 16:23:01 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07TGN1Hw054107; Sat, 29 Aug 2020 16:23:01 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07TGN0Fl054104; Sat, 29 Aug 2020 16:23:00 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <202008291623.07TGN0Fl054104@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Sat, 29 Aug 2020 16:23:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364961 - in stable/12: lib/libsecureboot stand/common stand/uboot/lib sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: in stable/12: lib/libsecureboot stand/common stand/uboot/lib sys/kern X-SVN-Commit-Revision: 364961 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Aug 2020 16:23:02 -0000 Author: sjg Date: Sat Aug 29 16:23:00 2020 New Revision: 364961 URL: https://svnweb.freebsd.org/changeset/base/364961 Log: MFC loader fixes r361710: stand/uboot: fix setting of gateip.s_addr Missplaced paren. r361933: loader: install allow for more complete device spec in url Rework to simplify and impose sane url syntax. That is we allow for file://[devname[:fstype]]/package r362127: verify_pcr_export: bump kenv_mvallen if needed r362231: make KENV_MVALLEN tunable When doing secure boot, loader wants to export loader.ve.hashed the value of which typically exceeds KENV_MVALLEN. Replace use of KENV_MVALLEN with tunable kenv_mvallen. Add getenv_string_buffer() for the case where a stack buffer cannot be created and use uma_zone_t kenv_zone for suitably sized buffers. r364443: veloader: insist on verifying .4th .lua etc When files are read from .rc or .4th, verify_file is asked to guess the severity (VE_TRY,VE_WANT,VE_MUST) Reviewed by: imp, stevek, kevans Modified: stable/12/lib/libsecureboot/verify_file.c stable/12/stand/common/install.c stable/12/stand/uboot/lib/net.c stable/12/sys/kern/kern_environment.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libsecureboot/verify_file.c ============================================================================== --- stable/12/lib/libsecureboot/verify_file.c Sat Aug 29 16:04:02 2020 (r364960) +++ stable/12/lib/libsecureboot/verify_file.c Sat Aug 29 16:23:00 2020 (r364961) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2017-2018, Juniper Networks, Inc. + * Copyright (c) 2017-2020, Juniper Networks, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "libsecureboot.h" #include @@ -254,6 +255,10 @@ severity_guess(const char *filename) strcmp(cp, ".cookie") == 0 || strcmp(cp, ".hints") == 0) return (VE_TRY); + if (strcmp(cp, ".4th") == 0 || + strcmp(cp, ".lua") == 0 || + strcmp(cp, ".rc") == 0) + return (VE_MUST); } return (VE_WANT); } @@ -532,6 +537,19 @@ verify_pcr_export(void) DEBUG_PRINTF(1, ("%s: setenv(loader.ve.hashed, %s\n", __func__, hinfo)); + if ((hlen = strlen(hinfo)) > KENV_MVALLEN) { + /* + * bump kenv_mvallen + * roundup to multiple of KENV_MVALLEN + */ + char mvallen[16]; + + hlen += KENV_MVALLEN - + (hlen % KENV_MVALLEN); + if (snprintf(mvallen, sizeof(mvallen), + "%d", (int) hlen) < sizeof(mvallen)) + setenv("kenv_mvallen", mvallen, 1); + } free(hinfo); } } Modified: stable/12/stand/common/install.c ============================================================================== --- stable/12/stand/common/install.c Sat Aug 29 16:04:02 2020 (r364960) +++ stable/12/stand/common/install.c Sat Aug 29 16:23:00 2020 (r364961) @@ -184,7 +184,8 @@ cleanup(void) /* * usage: install URL - * where: URL = (tftp|file)://[host]/ + * where: URL = tftp://[host]/ + * or file://[devname[:fstype]]/ */ static int install(char *pkgname) @@ -192,8 +193,9 @@ install(char *pkgname) static char buf[256]; struct fs_ops *proto; struct preloaded_file *fp; - char *s, *currdev; - const char *devname; + char *e, *s, *currdev; + char *devname; + size_t devnamelen; int error, fd, i, local; s = strstr(pkgname, "://"); @@ -201,34 +203,74 @@ install(char *pkgname) goto invalid_url; i = s - pkgname; + s += 3; + if (*s == '\0') + goto invalid_url; + + devname = NULL; + devnamelen = 0; + proto = NULL; + local = 0; + if (i == 4 && !strncasecmp(pkgname, "tftp", i)) { devname = "net0"; + devnamelen = 4; proto = &tftp_fsops; - local = 0; } else if (i == 4 && !strncasecmp(pkgname, "file", i)) { currdev = getenv("currdev"); - if (currdev != NULL && strcmp(currdev, "pxe0:") == 0) { - devname = "pxe0"; - proto = NULL; + local = 1; + + if (*s == '/') { /* file:/// */ + if (devname == NULL) + devname = currdev; + if (devname == NULL) + devname = "disk1"; + } else { /* file://devname[:fstype]/ */ + devname = s; + e = strchr(devname, '/'); + if (!e) + goto invalid_url; + devnamelen = e - devname; + s = e; /* consume devname */ + } + if ((e = strchr(devname, ':')) != NULL) { + /* could be :fstype */ + devnamelen = e - devname; + switch (e[1]) { + case '\0': /* just currdev */ + break; + case 'd': + proto = &dosfs_fsops; + break; #ifdef HOSTPROG - } else if (currdev != NULL && strcmp(currdev, "host0:") == 0) { - extern struct fs_ops host_fsops; + case 'h': + { + extern struct fs_ops host_fsops; - devname = "host0"; - proto = &host_fsops; + proto = &host_fsops; + } + break; #endif - } else { - devname = "disk1"; + case 'u': + proto = &ufs_fsops; + break; + } + } + if (proto == NULL && strncmp(devname, "disk", 4) == 0) { proto = &dosfs_fsops; } - local = 1; - } else - goto invalid_url; + } - s += 3; - if (*s == '\0') + if (devname == NULL) goto invalid_url; + if (devnamelen == 0) { + /* default is currdev which ends with ':' */ + devnamelen = strlen(devname); + if (devname[devnamelen - 1] == ':') + devnamelen--; + } + if (*s != '/' ) { if (local) goto invalid_url; @@ -252,11 +294,12 @@ install(char *pkgname) } else pkgname = s; - if (strlen(devname) + strlen(pkgname) + 2 > sizeof(buf)) { + i = snprintf(buf, sizeof(buf), "%.*s:%s", + (int) devnamelen, devname, pkgname); + if (i >= (int) sizeof(buf)) { command_errmsg = "package name too long"; return (CMD_ERROR); } - sprintf(buf, "%s:%s", devname, pkgname); setenv("install_package", buf, 1); error = pkgfs_init(buf, proto); Modified: stable/12/stand/uboot/lib/net.c ============================================================================== --- stable/12/stand/uboot/lib/net.c Sat Aug 29 16:04:02 2020 (r364960) +++ stable/12/stand/uboot/lib/net.c Sat Aug 29 16:23:00 2020 (r364961) @@ -187,7 +187,7 @@ get_env_net_params() rootip.s_addr = 0; return; } - if ((gateip.s_addr = inet_addr(envstr) == INADDR_NONE)) { + if ((gateip.s_addr = inet_addr(envstr)) == INADDR_NONE) { printf("Could not parse gatewayip '%s'\n", envstr); rootip.s_addr = 0; return; Modified: stable/12/sys/kern/kern_environment.c ============================================================================== --- stable/12/sys/kern/kern_environment.c Sat Aug 29 16:04:02 2020 (r364960) +++ stable/12/sys/kern/kern_environment.c Sat Aug 29 16:23:00 2020 (r364961) @@ -63,6 +63,9 @@ static MALLOC_DEFINE(M_KENV, "kenv", "kernel environme #define KENV_SIZE 512 /* Maximum number of environment strings */ +static uma_zone_t kenv_zone; +static int kenv_mvallen = KENV_MVALLEN; + /* pointer to the config-generated static environment */ char *kern_envp; @@ -85,6 +88,8 @@ bool dynamic_kenv; #define KENV_CHECK if (!dynamic_kenv) \ panic("%s: called before SI_SUB_KMEM", __func__) +static char *getenv_string_buffer(const char *); + int sys_kenv(td, uap) struct thread *td; @@ -110,9 +115,9 @@ sys_kenv(td, uap) #endif done = needed = 0; buflen = uap->len; - if (buflen > KENV_SIZE * (KENV_MNAMELEN + KENV_MVALLEN + 2)) + if (buflen > KENV_SIZE * (KENV_MNAMELEN + kenv_mvallen + 2)) buflen = KENV_SIZE * (KENV_MNAMELEN + - KENV_MVALLEN + 2); + kenv_mvallen + 2); if (uap->len > 0 && uap->value != NULL) buffer = malloc(buflen, M_TEMP, M_WAITOK|M_ZERO); mtx_lock(&kenv_lock); @@ -185,8 +190,8 @@ sys_kenv(td, uap) error = EINVAL; goto done; } - if (len > KENV_MVALLEN + 1) - len = KENV_MVALLEN + 1; + if (len > kenv_mvallen + 1) + len = kenv_mvallen + 1; value = malloc(len, M_TEMP, M_WAITOK); error = copyinstr(uap->value, value, len, NULL); if (error) { @@ -327,7 +332,7 @@ init_dynamic_kenv_from(char *init_env, int *curpos) for (cp = init_env; cp != NULL; cp = cpnext) { cpnext = kernenv_next(cp); len = strlen(cp) + 1; - if (len > KENV_MNAMELEN + 1 + KENV_MVALLEN + 1) { + if (len > KENV_MNAMELEN + 1 + kenv_mvallen + 1) { printf( "WARNING: too long kenv string, ignoring %s\n", cp); @@ -375,7 +380,14 @@ static void init_dynamic_kenv(void *data __unused) { int dynamic_envpos; + int size; + TUNABLE_INT_FETCH("kenv_mvallen", &kenv_mvallen); + size = KENV_MNAMELEN + 1 + kenv_mvallen + 1; + + kenv_zone = uma_zcreate("kenv", size, NULL, NULL, NULL, NULL, + UMA_ALIGN_PTR, 0); + kenvp = malloc((KENV_SIZE + 1) * sizeof(char *), M_KENV, M_WAITOK | M_ZERO); @@ -395,7 +407,7 @@ freeenv(char *env) if (dynamic_kenv && env != NULL) { explicit_bzero(env, strlen(env)); - free(env, M_KENV); + uma_zfree(kenv_zone, env); } } @@ -470,14 +482,11 @@ _getenv_static(const char *name) char * kern_getenv(const char *name) { - char buf[KENV_MNAMELEN + 1 + KENV_MVALLEN + 1]; char *ret; if (dynamic_kenv) { - if (getenv_string(name, buf, sizeof(buf))) { - ret = strdup(buf, M_KENV); - } else { - ret = NULL; + ret = getenv_string_buffer(name); + if (ret == NULL) { WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "getenv"); } @@ -548,7 +557,7 @@ kern_setenv(const char *name, const char *value) if (namelen > KENV_MNAMELEN + 1) return (-1); vallen = strlen(value) + 1; - if (vallen > KENV_MVALLEN + 1) + if (vallen > kenv_mvallen + 1) return (-1); buf = malloc(namelen + vallen, M_KENV, M_WAITOK); sprintf(buf, "%s=%s", name, value); @@ -607,6 +616,33 @@ kern_unsetenv(const char *name) } /* + * Return a buffer containing the string value from an environment variable + */ +static char * +getenv_string_buffer(const char *name) +{ + char *cp, *ret; + int len; + + if (dynamic_kenv) { + len = KENV_MNAMELEN + 1 + kenv_mvallen + 1; + ret = uma_zalloc(kenv_zone, M_WAITOK | M_ZERO); + mtx_lock(&kenv_lock); + cp = _getenv_dynamic(name, NULL); + if (cp != NULL) + strlcpy(ret, cp, len); + mtx_unlock(&kenv_lock); + if (cp == NULL) { + uma_zfree(kenv_zone, ret); + ret = NULL; + } + } else + ret = _getenv_static(name); + + return (ret); +} + +/* * Return a string value from an environment variable. */ int @@ -635,17 +671,19 @@ int getenv_array(const char *name, void *pdata, int size, int *psize, int type_size, bool allow_signed) { - char buf[KENV_MNAMELEN + 1 + KENV_MVALLEN + 1]; uint8_t shift; int64_t value; int64_t old; + char *buf; char *end; char *ptr; int n; + int rc; - if (getenv_string(name, buf, sizeof(buf)) == 0) + if ((buf = getenv_string_buffer(name)) == NULL) return (0); + rc = 0; /* assume failure */ /* get maximum number of elements */ size /= type_size; @@ -758,9 +796,11 @@ getenv_array(const char *name, void *pdata, int size, *psize = n * type_size; if (n != 0) - return (1); /* success */ + rc = 1; /* success */ error: - return (0); /* failure */ + if (dynamic_kenv) + uma_zfree(kenv_zone, buf); + return (rc); } /* @@ -859,15 +899,17 @@ getenv_ulong(const char *name, unsigned long *data) int getenv_quad(const char *name, quad_t *data) { - char value[KENV_MNAMELEN + 1 + KENV_MVALLEN + 1]; - char *vtp; + char *value, *vtp; quad_t iv; - if (!getenv_string(name, value, sizeof(value))) + value = getenv_string_buffer(name); + if (value == NULL) return (0); iv = strtoq(value, &vtp, 0); - if (vtp == value || (vtp[0] != '\0' && vtp[1] != '\0')) + if (vtp == value || (vtp[0] != '\0' && vtp[1] != '\0')) { + freeenv(value); return (0); + } switch (vtp[0]) { case 't': case 'T': iv *= 1024; @@ -883,8 +925,10 @@ getenv_quad(const char *name, quad_t *data) case '\0': break; default: + freeenv(value); return (0); } + freeenv(value); *data = iv; return (1); } From owner-svn-src-stable-12@freebsd.org Sat Aug 29 16:27:22 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3955D3B5E8E; Sat, 29 Aug 2020 16:27:22 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Bf21Q0WBFz3VGP; Sat, 29 Aug 2020 16:27:22 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 E5193837E; Sat, 29 Aug 2020 16:27:21 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07TGRLE8054350; Sat, 29 Aug 2020 16:27:21 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07TGRLSv054349; Sat, 29 Aug 2020 16:27:21 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <202008291627.07TGRLSv054349@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Sat, 29 Aug 2020 16:27:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364962 - stable/12/sys/security/mac_veriexec X-SVN-Group: stable-12 X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: stable/12/sys/security/mac_veriexec X-SVN-Commit-Revision: 364962 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Aug 2020 16:27:22 -0000 Author: sjg Date: Sat Aug 29 16:27:21 2020 New Revision: 364962 URL: https://svnweb.freebsd.org/changeset/base/364962 Log: mac_veriexec_fingerprint_check_vnode: v_writecount > 0 means active writers v_writecount can actually be < 0 for text, so check for v_writecount > 0 MFC of r362125 Reviewed by: stevek Modified: stable/12/sys/security/mac_veriexec/veriexec_fingerprint.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/security/mac_veriexec/veriexec_fingerprint.c ============================================================================== --- stable/12/sys/security/mac_veriexec/veriexec_fingerprint.c Sat Aug 29 16:23:00 2020 (r364961) +++ stable/12/sys/security/mac_veriexec/veriexec_fingerprint.c Sat Aug 29 16:27:21 2020 (r364962) @@ -214,7 +214,7 @@ mac_veriexec_fingerprint_check_vnode(struct vnode *vp, int error; /* reject fingerprint if writers are active */ - if (vp->v_writecount) + if (vp->v_writecount > 0) return (ETXTBSY); if ((vp->v_mount->mnt_flag & MNT_VERIFIED) != 0) { From owner-svn-src-stable-12@freebsd.org Sat Aug 29 18:11:42 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A74C63B7D4D; Sat, 29 Aug 2020 18:11:42 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Bf4Kp41yfz3bZj; Sat, 29 Aug 2020 18:11: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 6D49C9C31; Sat, 29 Aug 2020 18:11: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 07TIBgMj021060; Sat, 29 Aug 2020 18:11:42 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07TIBbu3021036; Sat, 29 Aug 2020 18:11:37 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <202008291811.07TIBbu3021036@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Sat, 29 Aug 2020 18:11:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364963 - in stable/12: crypto/openssl/crypto/aes/asm crypto/openssl/crypto/bn/asm crypto/openssl/crypto/chacha/asm crypto/openssl/crypto/ec/asm crypto/openssl/crypto/modes/asm crypto/o... X-SVN-Group: stable-12 X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: in stable/12: crypto/openssl/crypto/aes/asm crypto/openssl/crypto/bn/asm crypto/openssl/crypto/chacha/asm crypto/openssl/crypto/ec/asm crypto/openssl/crypto/modes/asm crypto/openssl/crypto/poly1305/as... X-SVN-Commit-Revision: 364963 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Aug 2020 18:11:42 -0000 Author: jkim Date: Sat Aug 29 18:11:37 2020 New Revision: 364963 URL: https://svnweb.freebsd.org/changeset/base/364963 Log: MFC: r364822, r364823 Fix Clang version detection and regen X86 assembly files. Modified: stable/12/crypto/openssl/crypto/aes/asm/aesni-mb-x86_64.pl stable/12/crypto/openssl/crypto/aes/asm/aesni-sha1-x86_64.pl stable/12/crypto/openssl/crypto/aes/asm/aesni-sha256-x86_64.pl stable/12/crypto/openssl/crypto/bn/asm/rsaz-avx2.pl stable/12/crypto/openssl/crypto/bn/asm/rsaz-x86_64.pl stable/12/crypto/openssl/crypto/bn/asm/x86_64-mont.pl stable/12/crypto/openssl/crypto/bn/asm/x86_64-mont5.pl stable/12/crypto/openssl/crypto/chacha/asm/chacha-x86.pl stable/12/crypto/openssl/crypto/chacha/asm/chacha-x86_64.pl stable/12/crypto/openssl/crypto/ec/asm/ecp_nistz256-avx2.pl stable/12/crypto/openssl/crypto/ec/asm/ecp_nistz256-x86_64.pl stable/12/crypto/openssl/crypto/ec/asm/x25519-x86_64.pl stable/12/crypto/openssl/crypto/modes/asm/aesni-gcm-x86_64.pl stable/12/crypto/openssl/crypto/modes/asm/ghash-x86_64.pl stable/12/crypto/openssl/crypto/poly1305/asm/poly1305-x86.pl stable/12/crypto/openssl/crypto/poly1305/asm/poly1305-x86_64.pl stable/12/crypto/openssl/crypto/sha/asm/sha1-586.pl stable/12/crypto/openssl/crypto/sha/asm/sha1-mb-x86_64.pl stable/12/crypto/openssl/crypto/sha/asm/sha1-x86_64.pl stable/12/crypto/openssl/crypto/sha/asm/sha256-586.pl stable/12/crypto/openssl/crypto/sha/asm/sha256-mb-x86_64.pl stable/12/crypto/openssl/crypto/sha/asm/sha512-x86_64.pl stable/12/secure/lib/libcrypto/amd64/aesni-gcm-x86_64.S stable/12/secure/lib/libcrypto/amd64/aesni-mb-x86_64.S stable/12/secure/lib/libcrypto/amd64/aesni-sha1-x86_64.S stable/12/secure/lib/libcrypto/amd64/aesni-sha256-x86_64.S stable/12/secure/lib/libcrypto/amd64/chacha-x86_64.S stable/12/secure/lib/libcrypto/amd64/ecp_nistz256-x86_64.S stable/12/secure/lib/libcrypto/amd64/ghash-x86_64.S stable/12/secure/lib/libcrypto/amd64/poly1305-x86_64.S stable/12/secure/lib/libcrypto/amd64/rsaz-avx2.S stable/12/secure/lib/libcrypto/amd64/rsaz-x86_64.S stable/12/secure/lib/libcrypto/amd64/sha1-mb-x86_64.S stable/12/secure/lib/libcrypto/amd64/sha1-x86_64.S stable/12/secure/lib/libcrypto/amd64/sha256-mb-x86_64.S stable/12/secure/lib/libcrypto/amd64/sha256-x86_64.S stable/12/secure/lib/libcrypto/amd64/sha512-x86_64.S stable/12/secure/lib/libcrypto/amd64/x25519-x86_64.S stable/12/secure/lib/libcrypto/amd64/x86_64-mont.S stable/12/secure/lib/libcrypto/amd64/x86_64-mont5.S stable/12/secure/lib/libcrypto/i386/chacha-x86.S stable/12/secure/lib/libcrypto/i386/poly1305-x86.S stable/12/secure/lib/libcrypto/i386/sha1-586.S stable/12/secure/lib/libcrypto/i386/sha256-586.S Directory Properties: stable/12/ (props changed) Modified: stable/12/crypto/openssl/crypto/aes/asm/aesni-mb-x86_64.pl ============================================================================== --- stable/12/crypto/openssl/crypto/aes/asm/aesni-mb-x86_64.pl Sat Aug 29 16:27:21 2020 (r364962) +++ stable/12/crypto/openssl/crypto/aes/asm/aesni-mb-x86_64.pl Sat Aug 29 18:11:37 2020 (r364963) @@ -70,7 +70,7 @@ if (!$avx && $win64 && ($flavour =~ /masm/ || $ENV{ASM $avx = ($1>=10) + ($1>=11); } -if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([0-9]+\.[0-9]+)/) { +if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([0-9]+\.[0-9]+)/) { $avx = ($2>=3.0) + ($2>3.0); } Modified: stable/12/crypto/openssl/crypto/aes/asm/aesni-sha1-x86_64.pl ============================================================================== --- stable/12/crypto/openssl/crypto/aes/asm/aesni-sha1-x86_64.pl Sat Aug 29 16:27:21 2020 (r364962) +++ stable/12/crypto/openssl/crypto/aes/asm/aesni-sha1-x86_64.pl Sat Aug 29 18:11:37 2020 (r364963) @@ -108,7 +108,7 @@ $avx=1 if (!$avx && $win64 && ($flavour =~ /nasm/ || $ $avx=1 if (!$avx && $win64 && ($flavour =~ /masm/ || $ENV{ASM} =~ /ml64/) && `ml64 2>&1` =~ /Version ([0-9]+)\./ && $1>=10); -$avx=1 if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([0-9]+\.[0-9]+)/ && $2>=3.0); +$avx=1 if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([0-9]+\.[0-9]+)/ && $2>=3.0); $shaext=1; ### set to zero if compiling for 1.0.1 Modified: stable/12/crypto/openssl/crypto/aes/asm/aesni-sha256-x86_64.pl ============================================================================== --- stable/12/crypto/openssl/crypto/aes/asm/aesni-sha256-x86_64.pl Sat Aug 29 16:27:21 2020 (r364962) +++ stable/12/crypto/openssl/crypto/aes/asm/aesni-sha256-x86_64.pl Sat Aug 29 18:11:37 2020 (r364963) @@ -70,7 +70,7 @@ if (!$avx && $win64 && ($flavour =~ /masm/ || $ENV{ASM $avx = ($1>=10) + ($1>=12); } -if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([0-9]+\.[0-9]+)/) { +if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([0-9]+\.[0-9]+)/) { $avx = ($2>=3.0) + ($2>3.0); } Modified: stable/12/crypto/openssl/crypto/bn/asm/rsaz-avx2.pl ============================================================================== --- stable/12/crypto/openssl/crypto/bn/asm/rsaz-avx2.pl Sat Aug 29 16:27:21 2020 (r364962) +++ stable/12/crypto/openssl/crypto/bn/asm/rsaz-avx2.pl Sat Aug 29 18:11:37 2020 (r364963) @@ -66,7 +66,7 @@ if (!$avx && $win64 && ($flavour =~ /masm/ || $ENV{ASM $addx = ($1>=11); } -if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|based on LLVM) ([0-9]+)\.([0-9]+)/) { +if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|based on LLVM) ([0-9]+)\.([0-9]+)/) { my $ver = $2 + $3/100.0; # 3.1->3.01, 3.10->3.10 $avx = ($ver>=3.0) + ($ver>=3.01); $addx = ($ver>=3.03); Modified: stable/12/crypto/openssl/crypto/bn/asm/rsaz-x86_64.pl ============================================================================== --- stable/12/crypto/openssl/crypto/bn/asm/rsaz-x86_64.pl Sat Aug 29 16:27:21 2020 (r364962) +++ stable/12/crypto/openssl/crypto/bn/asm/rsaz-x86_64.pl Sat Aug 29 18:11:37 2020 (r364963) @@ -81,7 +81,7 @@ if (!$addx && $win64 && ($flavour =~ /masm/ || $ENV{AS $addx = ($1>=12); } -if (!$addx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([0-9]+)\.([0-9]+)/) { +if (!$addx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([0-9]+)\.([0-9]+)/) { my $ver = $2 + $3/100.0; # 3.1->3.01, 3.10->3.10 $addx = ($ver>=3.03); } Modified: stable/12/crypto/openssl/crypto/bn/asm/x86_64-mont.pl ============================================================================== --- stable/12/crypto/openssl/crypto/bn/asm/x86_64-mont.pl Sat Aug 29 16:27:21 2020 (r364962) +++ stable/12/crypto/openssl/crypto/bn/asm/x86_64-mont.pl Sat Aug 29 18:11:37 2020 (r364963) @@ -75,7 +75,7 @@ if (!$addx && $win64 && ($flavour =~ /masm/ || $ENV{AS $addx = ($1>=12); } -if (!$addx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([0-9]+)\.([0-9]+)/) { +if (!$addx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([0-9]+)\.([0-9]+)/) { my $ver = $2 + $3/100.0; # 3.1->3.01, 3.10->3.10 $addx = ($ver>=3.03); } Modified: stable/12/crypto/openssl/crypto/bn/asm/x86_64-mont5.pl ============================================================================== --- stable/12/crypto/openssl/crypto/bn/asm/x86_64-mont5.pl Sat Aug 29 16:27:21 2020 (r364962) +++ stable/12/crypto/openssl/crypto/bn/asm/x86_64-mont5.pl Sat Aug 29 18:11:37 2020 (r364963) @@ -60,7 +60,7 @@ if (!$addx && $win64 && ($flavour =~ /masm/ || $ENV{AS $addx = ($1>=12); } -if (!$addx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([0-9]+)\.([0-9]+)/) { +if (!$addx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([0-9]+)\.([0-9]+)/) { my $ver = $2 + $3/100.0; # 3.1->3.01, 3.10->3.10 $addx = ($ver>=3.03); } Modified: stable/12/crypto/openssl/crypto/chacha/asm/chacha-x86.pl ============================================================================== --- stable/12/crypto/openssl/crypto/chacha/asm/chacha-x86.pl Sat Aug 29 16:27:21 2020 (r364962) +++ stable/12/crypto/openssl/crypto/chacha/asm/chacha-x86.pl Sat Aug 29 18:11:37 2020 (r364963) @@ -62,7 +62,7 @@ $ymm=1 if ($xmm && !$ymm && $ARGV[0] eq "win32" && $1>=10); # first version supporting AVX $ymm=1 if ($xmm && !$ymm && - `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|based on LLVM) ([0-9]+\.[0-9]+)/ && + `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|based on LLVM) ([0-9]+\.[0-9]+)/ && $2>=3.0); # first version supporting AVX $a="eax"; Modified: stable/12/crypto/openssl/crypto/chacha/asm/chacha-x86_64.pl ============================================================================== --- stable/12/crypto/openssl/crypto/chacha/asm/chacha-x86_64.pl Sat Aug 29 16:27:21 2020 (r364962) +++ stable/12/crypto/openssl/crypto/chacha/asm/chacha-x86_64.pl Sat Aug 29 18:11:37 2020 (r364963) @@ -85,7 +85,7 @@ if (!$avx && $win64 && ($flavour =~ /masm/ || $ENV{ASM $avx = ($1>=10) + ($1>=11); } -if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([0-9]+\.[0-9]+)/) { +if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([0-9]+\.[0-9]+)/) { $avx = ($2>=3.0) + ($2>3.0); } Modified: stable/12/crypto/openssl/crypto/ec/asm/ecp_nistz256-avx2.pl ============================================================================== --- stable/12/crypto/openssl/crypto/ec/asm/ecp_nistz256-avx2.pl Sat Aug 29 16:27:21 2020 (r364962) +++ stable/12/crypto/openssl/crypto/ec/asm/ecp_nistz256-avx2.pl Sat Aug 29 18:11:37 2020 (r364963) @@ -47,7 +47,7 @@ if (!$addx && $win64 && ($flavour =~ /masm/ || $ENV{AS $addx = ($1>=12); } -if (!$addx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|based on LLVM) ([0-9]+)\.([0-9]+)/) { +if (!$addx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|based on LLVM) ([0-9]+)\.([0-9]+)/) { my $ver = $2 + $3/100.0; # 3.1->3.01, 3.10->3.10 $avx = ($ver>=3.0) + ($ver>=3.01); $addx = ($ver>=3.03); Modified: stable/12/crypto/openssl/crypto/ec/asm/ecp_nistz256-x86_64.pl ============================================================================== --- stable/12/crypto/openssl/crypto/ec/asm/ecp_nistz256-x86_64.pl Sat Aug 29 16:27:21 2020 (r364962) +++ stable/12/crypto/openssl/crypto/ec/asm/ecp_nistz256-x86_64.pl Sat Aug 29 18:11:37 2020 (r364963) @@ -72,7 +72,7 @@ if (!$addx && $win64 && ($flavour =~ /masm/ || $ENV{AS $addx = ($1>=12); } -if (!$addx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([0-9]+)\.([0-9]+)/) { +if (!$addx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([0-9]+)\.([0-9]+)/) { my $ver = $2 + $3/100.0; # 3.1->3.01, 3.10->3.10 $avx = ($ver>=3.0) + ($ver>=3.01); $addx = ($ver>=3.03); Modified: stable/12/crypto/openssl/crypto/ec/asm/x25519-x86_64.pl ============================================================================== --- stable/12/crypto/openssl/crypto/ec/asm/x25519-x86_64.pl Sat Aug 29 16:27:21 2020 (r364962) +++ stable/12/crypto/openssl/crypto/ec/asm/x25519-x86_64.pl Sat Aug 29 18:11:37 2020 (r364963) @@ -90,7 +90,7 @@ if (!$addx && $win64 && ($flavour =~ /masm/ || $ENV{AS $addx = ($1>=12); } -if (!$addx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([0-9]+)\.([0-9]+)/) { +if (!$addx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([0-9]+)\.([0-9]+)/) { my $ver = $2 + $3/100.0; # 3.1->3.01, 3.10->3.10 $addx = ($ver>=3.03); } Modified: stable/12/crypto/openssl/crypto/modes/asm/aesni-gcm-x86_64.pl ============================================================================== --- stable/12/crypto/openssl/crypto/modes/asm/aesni-gcm-x86_64.pl Sat Aug 29 16:27:21 2020 (r364962) +++ stable/12/crypto/openssl/crypto/modes/asm/aesni-gcm-x86_64.pl Sat Aug 29 18:11:37 2020 (r364963) @@ -66,7 +66,7 @@ if (!$avx && $win64 && ($flavour =~ /masm/ || $ENV{ASM $avx = ($1>=10) + ($1>=11); } -if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([0-9]+\.[0-9]+)/) { +if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([0-9]+\.[0-9]+)/) { $avx = ($2>=3.0) + ($2>3.0); } Modified: stable/12/crypto/openssl/crypto/modes/asm/ghash-x86_64.pl ============================================================================== --- stable/12/crypto/openssl/crypto/modes/asm/ghash-x86_64.pl Sat Aug 29 16:27:21 2020 (r364962) +++ stable/12/crypto/openssl/crypto/modes/asm/ghash-x86_64.pl Sat Aug 29 18:11:37 2020 (r364963) @@ -116,7 +116,7 @@ if (!$avx && $win64 && ($flavour =~ /masm/ || $ENV{ASM $avx = ($1>=10) + ($1>=11); } -if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([0-9]+\.[0-9]+)/) { +if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([0-9]+\.[0-9]+)/) { $avx = ($2>=3.0) + ($2>3.0); } Modified: stable/12/crypto/openssl/crypto/poly1305/asm/poly1305-x86.pl ============================================================================== --- stable/12/crypto/openssl/crypto/poly1305/asm/poly1305-x86.pl Sat Aug 29 16:27:21 2020 (r364962) +++ stable/12/crypto/openssl/crypto/poly1305/asm/poly1305-x86.pl Sat Aug 29 18:11:37 2020 (r364963) @@ -71,7 +71,7 @@ if ($sse2) { $avx = ($1>=2.09) + ($1>=2.10); } - if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|based on LLVM) ([0-9]+\.[0-9]+)/) { + if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|based on LLVM) ([0-9]+\.[0-9]+)/) { $avx = ($2>=3.0) + ($2>3.0); } } Modified: stable/12/crypto/openssl/crypto/poly1305/asm/poly1305-x86_64.pl ============================================================================== --- stable/12/crypto/openssl/crypto/poly1305/asm/poly1305-x86_64.pl Sat Aug 29 16:27:21 2020 (r364962) +++ stable/12/crypto/openssl/crypto/poly1305/asm/poly1305-x86_64.pl Sat Aug 29 18:11:37 2020 (r364963) @@ -90,7 +90,7 @@ if (!$avx && $win64 && ($flavour =~ /masm/ || $ENV{ASM $avx = ($1>=10) + ($1>=12); } -if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([0-9]+\.[0-9]+)/) { +if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([0-9]+\.[0-9]+)/) { $avx = ($2>=3.0) + ($2>3.0); } Modified: stable/12/crypto/openssl/crypto/sha/asm/sha1-586.pl ============================================================================== --- stable/12/crypto/openssl/crypto/sha/asm/sha1-586.pl Sat Aug 29 16:27:21 2020 (r364962) +++ stable/12/crypto/openssl/crypto/sha/asm/sha1-586.pl Sat Aug 29 18:11:37 2020 (r364963) @@ -144,7 +144,7 @@ $ymm=1 if ($xmm && !$ymm && $ARGV[0] eq "win32" && `ml 2>&1` =~ /Version ([0-9]+)\./ && $1>=10); # first version supporting AVX -$ymm=1 if ($xmm && !$ymm && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|based on LLVM) ([0-9]+\.[0-9]+)/ && +$ymm=1 if ($xmm && !$ymm && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|based on LLVM) ([0-9]+\.[0-9]+)/ && $2>=3.0); # first version supporting AVX $shaext=$xmm; ### set to zero if compiling for 1.0.1 Modified: stable/12/crypto/openssl/crypto/sha/asm/sha1-mb-x86_64.pl ============================================================================== --- stable/12/crypto/openssl/crypto/sha/asm/sha1-mb-x86_64.pl Sat Aug 29 16:27:21 2020 (r364962) +++ stable/12/crypto/openssl/crypto/sha/asm/sha1-mb-x86_64.pl Sat Aug 29 18:11:37 2020 (r364963) @@ -66,7 +66,7 @@ if (!$avx && $win64 && ($flavour =~ /masm/ || $ENV{ASM $avx = ($1>=10) + ($1>=11); } -if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([0-9]+\.[0-9]+)/) { +if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([0-9]+\.[0-9]+)/) { $avx = ($2>=3.0) + ($2>3.0); } Modified: stable/12/crypto/openssl/crypto/sha/asm/sha1-x86_64.pl ============================================================================== --- stable/12/crypto/openssl/crypto/sha/asm/sha1-x86_64.pl Sat Aug 29 16:27:21 2020 (r364962) +++ stable/12/crypto/openssl/crypto/sha/asm/sha1-x86_64.pl Sat Aug 29 18:11:37 2020 (r364963) @@ -119,7 +119,7 @@ if (!$avx && $win64 && ($flavour =~ /masm/ || $ENV{ASM $avx = ($1>=10) + ($1>=11); } -if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([0-9]+\.[0-9]+)/) { +if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([0-9]+\.[0-9]+)/) { $avx = ($2>=3.0) + ($2>3.0); } Modified: stable/12/crypto/openssl/crypto/sha/asm/sha256-586.pl ============================================================================== --- stable/12/crypto/openssl/crypto/sha/asm/sha256-586.pl Sat Aug 29 16:27:21 2020 (r364962) +++ stable/12/crypto/openssl/crypto/sha/asm/sha256-586.pl Sat Aug 29 18:11:37 2020 (r364963) @@ -96,7 +96,7 @@ if ($xmm && !$avx && $ARGV[0] eq "win32" && $avx = ($1>=10) + ($1>=11); } -if ($xmm && !$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|based on LLVM) ([0-9]+\.[0-9]+)/) { +if ($xmm && !$avx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|based on LLVM) ([0-9]+\.[0-9]+)/) { $avx = ($2>=3.0) + ($2>3.0); } Modified: stable/12/crypto/openssl/crypto/sha/asm/sha256-mb-x86_64.pl ============================================================================== --- stable/12/crypto/openssl/crypto/sha/asm/sha256-mb-x86_64.pl Sat Aug 29 16:27:21 2020 (r364962) +++ stable/12/crypto/openssl/crypto/sha/asm/sha256-mb-x86_64.pl Sat Aug 29 18:11:37 2020 (r364963) @@ -67,7 +67,7 @@ if (!$avx && $win64 && ($flavour =~ /masm/ || $ENV{ASM $avx = ($1>=10) + ($1>=11); } -if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([0-9]+\.[0-9]+)/) { +if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([0-9]+\.[0-9]+)/) { $avx = ($2>=3.0) + ($2>3.0); } Modified: stable/12/crypto/openssl/crypto/sha/asm/sha512-x86_64.pl ============================================================================== --- stable/12/crypto/openssl/crypto/sha/asm/sha512-x86_64.pl Sat Aug 29 16:27:21 2020 (r364962) +++ stable/12/crypto/openssl/crypto/sha/asm/sha512-x86_64.pl Sat Aug 29 18:11:37 2020 (r364963) @@ -135,7 +135,7 @@ if (!$avx && $win64 && ($flavour =~ /masm/ || $ENV{ASM $avx = ($1>=10) + ($1>=11); } -if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([0-9]+\.[0-9]+)/) { +if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([0-9]+\.[0-9]+)/) { $avx = ($2>=3.0) + ($2>3.0); } Modified: stable/12/secure/lib/libcrypto/amd64/aesni-gcm-x86_64.S ============================================================================== --- stable/12/secure/lib/libcrypto/amd64/aesni-gcm-x86_64.S Sat Aug 29 16:27:21 2020 (r364962) +++ stable/12/secure/lib/libcrypto/amd64/aesni-gcm-x86_64.S Sat Aug 29 18:11:37 2020 (r364963) @@ -2,20 +2,790 @@ /* Do not modify. This file is auto-generated from aesni-gcm-x86_64.pl. */ .text -.globl aesni_gcm_encrypt -.type aesni_gcm_encrypt,@function -aesni_gcm_encrypt: +.type _aesni_ctr32_ghash_6x,@function +.align 32 +_aesni_ctr32_ghash_6x: .cfi_startproc - xorl %eax,%eax + vmovdqu 32(%r11),%xmm2 + subq $6,%rdx + vpxor %xmm4,%xmm4,%xmm4 + vmovdqu 0-128(%rcx),%xmm15 + vpaddb %xmm2,%xmm1,%xmm10 + vpaddb %xmm2,%xmm10,%xmm11 + vpaddb %xmm2,%xmm11,%xmm12 + vpaddb %xmm2,%xmm12,%xmm13 + vpaddb %xmm2,%xmm13,%xmm14 + vpxor %xmm15,%xmm1,%xmm9 + vmovdqu %xmm4,16+8(%rsp) + jmp .Loop6x + +.align 32 +.Loop6x: + addl $100663296,%ebx + jc .Lhandle_ctr32 + vmovdqu 0-32(%r9),%xmm3 + vpaddb %xmm2,%xmm14,%xmm1 + vpxor %xmm15,%xmm10,%xmm10 + vpxor %xmm15,%xmm11,%xmm11 + +.Lresume_ctr32: + vmovdqu %xmm1,(%r8) + vpclmulqdq $0x10,%xmm3,%xmm7,%xmm5 + vpxor %xmm15,%xmm12,%xmm12 + vmovups 16-128(%rcx),%xmm2 + vpclmulqdq $0x01,%xmm3,%xmm7,%xmm6 + xorq %r12,%r12 + cmpq %r14,%r15 + + vaesenc %xmm2,%xmm9,%xmm9 + vmovdqu 48+8(%rsp),%xmm0 + vpxor %xmm15,%xmm13,%xmm13 + vpclmulqdq $0x00,%xmm3,%xmm7,%xmm1 + vaesenc %xmm2,%xmm10,%xmm10 + vpxor %xmm15,%xmm14,%xmm14 + setnc %r12b + vpclmulqdq $0x11,%xmm3,%xmm7,%xmm7 + vaesenc %xmm2,%xmm11,%xmm11 + vmovdqu 16-32(%r9),%xmm3 + negq %r12 + vaesenc %xmm2,%xmm12,%xmm12 + vpxor %xmm5,%xmm6,%xmm6 + vpclmulqdq $0x00,%xmm3,%xmm0,%xmm5 + vpxor %xmm4,%xmm8,%xmm8 + vaesenc %xmm2,%xmm13,%xmm13 + vpxor %xmm5,%xmm1,%xmm4 + andq $0x60,%r12 + vmovups 32-128(%rcx),%xmm15 + vpclmulqdq $0x10,%xmm3,%xmm0,%xmm1 + vaesenc %xmm2,%xmm14,%xmm14 + + vpclmulqdq $0x01,%xmm3,%xmm0,%xmm2 + leaq (%r14,%r12,1),%r14 + vaesenc %xmm15,%xmm9,%xmm9 + vpxor 16+8(%rsp),%xmm8,%xmm8 + vpclmulqdq $0x11,%xmm3,%xmm0,%xmm3 + vmovdqu 64+8(%rsp),%xmm0 + vaesenc %xmm15,%xmm10,%xmm10 + movbeq 88(%r14),%r13 + vaesenc %xmm15,%xmm11,%xmm11 + movbeq 80(%r14),%r12 + vaesenc %xmm15,%xmm12,%xmm12 + movq %r13,32+8(%rsp) + vaesenc %xmm15,%xmm13,%xmm13 + movq %r12,40+8(%rsp) + vmovdqu 48-32(%r9),%xmm5 + vaesenc %xmm15,%xmm14,%xmm14 + + vmovups 48-128(%rcx),%xmm15 + vpxor %xmm1,%xmm6,%xmm6 + vpclmulqdq $0x00,%xmm5,%xmm0,%xmm1 + vaesenc %xmm15,%xmm9,%xmm9 + vpxor %xmm2,%xmm6,%xmm6 + vpclmulqdq $0x10,%xmm5,%xmm0,%xmm2 + vaesenc %xmm15,%xmm10,%xmm10 + vpxor %xmm3,%xmm7,%xmm7 + vpclmulqdq $0x01,%xmm5,%xmm0,%xmm3 + vaesenc %xmm15,%xmm11,%xmm11 + vpclmulqdq $0x11,%xmm5,%xmm0,%xmm5 + vmovdqu 80+8(%rsp),%xmm0 + vaesenc %xmm15,%xmm12,%xmm12 + vaesenc %xmm15,%xmm13,%xmm13 + vpxor %xmm1,%xmm4,%xmm4 + vmovdqu 64-32(%r9),%xmm1 + vaesenc %xmm15,%xmm14,%xmm14 + + vmovups 64-128(%rcx),%xmm15 + vpxor %xmm2,%xmm6,%xmm6 + vpclmulqdq $0x00,%xmm1,%xmm0,%xmm2 + vaesenc %xmm15,%xmm9,%xmm9 + vpxor %xmm3,%xmm6,%xmm6 + vpclmulqdq $0x10,%xmm1,%xmm0,%xmm3 + vaesenc %xmm15,%xmm10,%xmm10 + movbeq 72(%r14),%r13 + vpxor %xmm5,%xmm7,%xmm7 + vpclmulqdq $0x01,%xmm1,%xmm0,%xmm5 + vaesenc %xmm15,%xmm11,%xmm11 + movbeq 64(%r14),%r12 + vpclmulqdq $0x11,%xmm1,%xmm0,%xmm1 + vmovdqu 96+8(%rsp),%xmm0 + vaesenc %xmm15,%xmm12,%xmm12 + movq %r13,48+8(%rsp) + vaesenc %xmm15,%xmm13,%xmm13 + movq %r12,56+8(%rsp) + vpxor %xmm2,%xmm4,%xmm4 + vmovdqu 96-32(%r9),%xmm2 + vaesenc %xmm15,%xmm14,%xmm14 + + vmovups 80-128(%rcx),%xmm15 + vpxor %xmm3,%xmm6,%xmm6 + vpclmulqdq $0x00,%xmm2,%xmm0,%xmm3 + vaesenc %xmm15,%xmm9,%xmm9 + vpxor %xmm5,%xmm6,%xmm6 + vpclmulqdq $0x10,%xmm2,%xmm0,%xmm5 + vaesenc %xmm15,%xmm10,%xmm10 + movbeq 56(%r14),%r13 + vpxor %xmm1,%xmm7,%xmm7 + vpclmulqdq $0x01,%xmm2,%xmm0,%xmm1 + vpxor 112+8(%rsp),%xmm8,%xmm8 + vaesenc %xmm15,%xmm11,%xmm11 + movbeq 48(%r14),%r12 + vpclmulqdq $0x11,%xmm2,%xmm0,%xmm2 + vaesenc %xmm15,%xmm12,%xmm12 + movq %r13,64+8(%rsp) + vaesenc %xmm15,%xmm13,%xmm13 + movq %r12,72+8(%rsp) + vpxor %xmm3,%xmm4,%xmm4 + vmovdqu 112-32(%r9),%xmm3 + vaesenc %xmm15,%xmm14,%xmm14 + + vmovups 96-128(%rcx),%xmm15 + vpxor %xmm5,%xmm6,%xmm6 + vpclmulqdq $0x10,%xmm3,%xmm8,%xmm5 + vaesenc %xmm15,%xmm9,%xmm9 + vpxor %xmm1,%xmm6,%xmm6 + vpclmulqdq $0x01,%xmm3,%xmm8,%xmm1 + vaesenc %xmm15,%xmm10,%xmm10 + movbeq 40(%r14),%r13 + vpxor %xmm2,%xmm7,%xmm7 + vpclmulqdq $0x00,%xmm3,%xmm8,%xmm2 + vaesenc %xmm15,%xmm11,%xmm11 + movbeq 32(%r14),%r12 + vpclmulqdq $0x11,%xmm3,%xmm8,%xmm8 + vaesenc %xmm15,%xmm12,%xmm12 + movq %r13,80+8(%rsp) + vaesenc %xmm15,%xmm13,%xmm13 + movq %r12,88+8(%rsp) + vpxor %xmm5,%xmm6,%xmm6 + vaesenc %xmm15,%xmm14,%xmm14 + vpxor %xmm1,%xmm6,%xmm6 + + vmovups 112-128(%rcx),%xmm15 + vpslldq $8,%xmm6,%xmm5 + vpxor %xmm2,%xmm4,%xmm4 + vmovdqu 16(%r11),%xmm3 + + vaesenc %xmm15,%xmm9,%xmm9 + vpxor %xmm8,%xmm7,%xmm7 + vaesenc %xmm15,%xmm10,%xmm10 + vpxor %xmm5,%xmm4,%xmm4 + movbeq 24(%r14),%r13 + vaesenc %xmm15,%xmm11,%xmm11 + movbeq 16(%r14),%r12 + vpalignr $8,%xmm4,%xmm4,%xmm0 + vpclmulqdq $0x10,%xmm3,%xmm4,%xmm4 + movq %r13,96+8(%rsp) + vaesenc %xmm15,%xmm12,%xmm12 + movq %r12,104+8(%rsp) + vaesenc %xmm15,%xmm13,%xmm13 + vmovups 128-128(%rcx),%xmm1 + vaesenc %xmm15,%xmm14,%xmm14 + + vaesenc %xmm1,%xmm9,%xmm9 + vmovups 144-128(%rcx),%xmm15 + vaesenc %xmm1,%xmm10,%xmm10 + vpsrldq $8,%xmm6,%xmm6 + vaesenc %xmm1,%xmm11,%xmm11 + vpxor %xmm6,%xmm7,%xmm7 + vaesenc %xmm1,%xmm12,%xmm12 + vpxor %xmm0,%xmm4,%xmm4 + movbeq 8(%r14),%r13 + vaesenc %xmm1,%xmm13,%xmm13 + movbeq 0(%r14),%r12 + vaesenc %xmm1,%xmm14,%xmm14 + vmovups 160-128(%rcx),%xmm1 + cmpl $11,%ebp + jb .Lenc_tail + + vaesenc %xmm15,%xmm9,%xmm9 + vaesenc %xmm15,%xmm10,%xmm10 + vaesenc %xmm15,%xmm11,%xmm11 + vaesenc %xmm15,%xmm12,%xmm12 + vaesenc %xmm15,%xmm13,%xmm13 + vaesenc %xmm15,%xmm14,%xmm14 + + vaesenc %xmm1,%xmm9,%xmm9 + vaesenc %xmm1,%xmm10,%xmm10 + vaesenc %xmm1,%xmm11,%xmm11 + vaesenc %xmm1,%xmm12,%xmm12 + vaesenc %xmm1,%xmm13,%xmm13 + vmovups 176-128(%rcx),%xmm15 + vaesenc %xmm1,%xmm14,%xmm14 + vmovups 192-128(%rcx),%xmm1 + je .Lenc_tail + + vaesenc %xmm15,%xmm9,%xmm9 + vaesenc %xmm15,%xmm10,%xmm10 + vaesenc %xmm15,%xmm11,%xmm11 + vaesenc %xmm15,%xmm12,%xmm12 + vaesenc %xmm15,%xmm13,%xmm13 + vaesenc %xmm15,%xmm14,%xmm14 + + vaesenc %xmm1,%xmm9,%xmm9 + vaesenc %xmm1,%xmm10,%xmm10 + vaesenc %xmm1,%xmm11,%xmm11 + vaesenc %xmm1,%xmm12,%xmm12 + vaesenc %xmm1,%xmm13,%xmm13 + vmovups 208-128(%rcx),%xmm15 + vaesenc %xmm1,%xmm14,%xmm14 + vmovups 224-128(%rcx),%xmm1 + jmp .Lenc_tail + +.align 32 +.Lhandle_ctr32: + vmovdqu (%r11),%xmm0 + vpshufb %xmm0,%xmm1,%xmm6 + vmovdqu 48(%r11),%xmm5 + vpaddd 64(%r11),%xmm6,%xmm10 + vpaddd %xmm5,%xmm6,%xmm11 + vmovdqu 0-32(%r9),%xmm3 + vpaddd %xmm5,%xmm10,%xmm12 + vpshufb %xmm0,%xmm10,%xmm10 + vpaddd %xmm5,%xmm11,%xmm13 + vpshufb %xmm0,%xmm11,%xmm11 + vpxor %xmm15,%xmm10,%xmm10 + vpaddd %xmm5,%xmm12,%xmm14 + vpshufb %xmm0,%xmm12,%xmm12 + vpxor %xmm15,%xmm11,%xmm11 + vpaddd %xmm5,%xmm13,%xmm1 + vpshufb %xmm0,%xmm13,%xmm13 + vpshufb %xmm0,%xmm14,%xmm14 + vpshufb %xmm0,%xmm1,%xmm1 + jmp .Lresume_ctr32 + +.align 32 +.Lenc_tail: + vaesenc %xmm15,%xmm9,%xmm9 + vmovdqu %xmm7,16+8(%rsp) + vpalignr $8,%xmm4,%xmm4,%xmm8 + vaesenc %xmm15,%xmm10,%xmm10 + vpclmulqdq $0x10,%xmm3,%xmm4,%xmm4 + vpxor 0(%rdi),%xmm1,%xmm2 + vaesenc %xmm15,%xmm11,%xmm11 + vpxor 16(%rdi),%xmm1,%xmm0 + vaesenc %xmm15,%xmm12,%xmm12 + vpxor 32(%rdi),%xmm1,%xmm5 + vaesenc %xmm15,%xmm13,%xmm13 + vpxor 48(%rdi),%xmm1,%xmm6 + vaesenc %xmm15,%xmm14,%xmm14 + vpxor 64(%rdi),%xmm1,%xmm7 + vpxor 80(%rdi),%xmm1,%xmm3 + vmovdqu (%r8),%xmm1 + + vaesenclast %xmm2,%xmm9,%xmm9 + vmovdqu 32(%r11),%xmm2 + vaesenclast %xmm0,%xmm10,%xmm10 + vpaddb %xmm2,%xmm1,%xmm0 + movq %r13,112+8(%rsp) + leaq 96(%rdi),%rdi + vaesenclast %xmm5,%xmm11,%xmm11 + vpaddb %xmm2,%xmm0,%xmm5 + movq %r12,120+8(%rsp) + leaq 96(%rsi),%rsi + vmovdqu 0-128(%rcx),%xmm15 + vaesenclast %xmm6,%xmm12,%xmm12 + vpaddb %xmm2,%xmm5,%xmm6 + vaesenclast %xmm7,%xmm13,%xmm13 + vpaddb %xmm2,%xmm6,%xmm7 + vaesenclast %xmm3,%xmm14,%xmm14 + vpaddb %xmm2,%xmm7,%xmm3 + + addq $0x60,%r10 + subq $0x6,%rdx + jc .L6x_done + + vmovups %xmm9,-96(%rsi) + vpxor %xmm15,%xmm1,%xmm9 + vmovups %xmm10,-80(%rsi) + vmovdqa %xmm0,%xmm10 + vmovups %xmm11,-64(%rsi) + vmovdqa %xmm5,%xmm11 + vmovups %xmm12,-48(%rsi) + vmovdqa %xmm6,%xmm12 + vmovups %xmm13,-32(%rsi) + vmovdqa %xmm7,%xmm13 + vmovups %xmm14,-16(%rsi) + vmovdqa %xmm3,%xmm14 + vmovdqu 32+8(%rsp),%xmm7 + jmp .Loop6x + +.L6x_done: + vpxor 16+8(%rsp),%xmm8,%xmm8 + vpxor %xmm4,%xmm8,%xmm8 + .byte 0xf3,0xc3 .cfi_endproc -.size aesni_gcm_encrypt,.-aesni_gcm_encrypt - +.size _aesni_ctr32_ghash_6x,.-_aesni_ctr32_ghash_6x .globl aesni_gcm_decrypt .type aesni_gcm_decrypt,@function +.align 32 aesni_gcm_decrypt: .cfi_startproc - xorl %eax,%eax + xorq %r10,%r10 + cmpq $0x60,%rdx + jb .Lgcm_dec_abort + + leaq (%rsp),%rax +.cfi_def_cfa_register %rax + pushq %rbx +.cfi_offset %rbx,-16 + pushq %rbp +.cfi_offset %rbp,-24 + pushq %r12 +.cfi_offset %r12,-32 + pushq %r13 +.cfi_offset %r13,-40 + pushq %r14 +.cfi_offset %r14,-48 + pushq %r15 +.cfi_offset %r15,-56 + vzeroupper + + vmovdqu (%r8),%xmm1 + addq $-128,%rsp + movl 12(%r8),%ebx + leaq .Lbswap_mask(%rip),%r11 + leaq -128(%rcx),%r14 + movq $0xf80,%r15 + vmovdqu (%r9),%xmm8 + andq $-128,%rsp + vmovdqu (%r11),%xmm0 + leaq 128(%rcx),%rcx + leaq 32+32(%r9),%r9 + movl 240-128(%rcx),%ebp + vpshufb %xmm0,%xmm8,%xmm8 + + andq %r15,%r14 + andq %rsp,%r15 + subq %r14,%r15 + jc .Ldec_no_key_aliasing + cmpq $768,%r15 + jnc .Ldec_no_key_aliasing + subq %r15,%rsp +.Ldec_no_key_aliasing: + + vmovdqu 80(%rdi),%xmm7 + leaq (%rdi),%r14 + vmovdqu 64(%rdi),%xmm4 + leaq -192(%rdi,%rdx,1),%r15 + vmovdqu 48(%rdi),%xmm5 + shrq $4,%rdx + xorq %r10,%r10 + vmovdqu 32(%rdi),%xmm6 + vpshufb %xmm0,%xmm7,%xmm7 + vmovdqu 16(%rdi),%xmm2 + vpshufb %xmm0,%xmm4,%xmm4 + vmovdqu (%rdi),%xmm3 + vpshufb %xmm0,%xmm5,%xmm5 + vmovdqu %xmm4,48(%rsp) + vpshufb %xmm0,%xmm6,%xmm6 + vmovdqu %xmm5,64(%rsp) + vpshufb %xmm0,%xmm2,%xmm2 + vmovdqu %xmm6,80(%rsp) + vpshufb %xmm0,%xmm3,%xmm3 + vmovdqu %xmm2,96(%rsp) + vmovdqu %xmm3,112(%rsp) + + call _aesni_ctr32_ghash_6x + + vmovups %xmm9,-96(%rsi) + vmovups %xmm10,-80(%rsi) + vmovups %xmm11,-64(%rsi) + vmovups %xmm12,-48(%rsi) + vmovups %xmm13,-32(%rsi) + vmovups %xmm14,-16(%rsi) + + vpshufb (%r11),%xmm8,%xmm8 + vmovdqu %xmm8,-64(%r9) + + vzeroupper + movq -48(%rax),%r15 +.cfi_restore %r15 + movq -40(%rax),%r14 +.cfi_restore %r14 + movq -32(%rax),%r13 +.cfi_restore %r13 + movq -24(%rax),%r12 +.cfi_restore %r12 + movq -16(%rax),%rbp +.cfi_restore %rbp + movq -8(%rax),%rbx +.cfi_restore %rbx + leaq (%rax),%rsp +.cfi_def_cfa_register %rsp +.Lgcm_dec_abort: + movq %r10,%rax .byte 0xf3,0xc3 .cfi_endproc .size aesni_gcm_decrypt,.-aesni_gcm_decrypt +.type _aesni_ctr32_6x,@function +.align 32 +_aesni_ctr32_6x: +.cfi_startproc + vmovdqu 0-128(%rcx),%xmm4 + vmovdqu 32(%r11),%xmm2 + leaq -1(%rbp),%r13 + vmovups 16-128(%rcx),%xmm15 + leaq 32-128(%rcx),%r12 + vpxor %xmm4,%xmm1,%xmm9 + addl $100663296,%ebx + jc .Lhandle_ctr32_2 + vpaddb %xmm2,%xmm1,%xmm10 + vpaddb %xmm2,%xmm10,%xmm11 + vpxor %xmm4,%xmm10,%xmm10 + vpaddb %xmm2,%xmm11,%xmm12 + vpxor %xmm4,%xmm11,%xmm11 + vpaddb %xmm2,%xmm12,%xmm13 + vpxor %xmm4,%xmm12,%xmm12 + vpaddb %xmm2,%xmm13,%xmm14 + vpxor %xmm4,%xmm13,%xmm13 + vpaddb %xmm2,%xmm14,%xmm1 + vpxor %xmm4,%xmm14,%xmm14 + jmp .Loop_ctr32 + +.align 16 +.Loop_ctr32: + vaesenc %xmm15,%xmm9,%xmm9 + vaesenc %xmm15,%xmm10,%xmm10 + vaesenc %xmm15,%xmm11,%xmm11 + vaesenc %xmm15,%xmm12,%xmm12 + vaesenc %xmm15,%xmm13,%xmm13 + vaesenc %xmm15,%xmm14,%xmm14 + vmovups (%r12),%xmm15 + leaq 16(%r12),%r12 + decl %r13d + jnz .Loop_ctr32 + + vmovdqu (%r12),%xmm3 + vaesenc %xmm15,%xmm9,%xmm9 + vpxor 0(%rdi),%xmm3,%xmm4 + vaesenc %xmm15,%xmm10,%xmm10 + vpxor 16(%rdi),%xmm3,%xmm5 + vaesenc %xmm15,%xmm11,%xmm11 + vpxor 32(%rdi),%xmm3,%xmm6 + vaesenc %xmm15,%xmm12,%xmm12 + vpxor 48(%rdi),%xmm3,%xmm8 + vaesenc %xmm15,%xmm13,%xmm13 + vpxor 64(%rdi),%xmm3,%xmm2 + vaesenc %xmm15,%xmm14,%xmm14 + vpxor 80(%rdi),%xmm3,%xmm3 + leaq 96(%rdi),%rdi + + vaesenclast %xmm4,%xmm9,%xmm9 + vaesenclast %xmm5,%xmm10,%xmm10 + vaesenclast %xmm6,%xmm11,%xmm11 + vaesenclast %xmm8,%xmm12,%xmm12 + vaesenclast %xmm2,%xmm13,%xmm13 + vaesenclast %xmm3,%xmm14,%xmm14 + vmovups %xmm9,0(%rsi) + vmovups %xmm10,16(%rsi) + vmovups %xmm11,32(%rsi) + vmovups %xmm12,48(%rsi) + vmovups %xmm13,64(%rsi) + vmovups %xmm14,80(%rsi) + leaq 96(%rsi),%rsi + + .byte 0xf3,0xc3 +.align 32 +.Lhandle_ctr32_2: + vpshufb %xmm0,%xmm1,%xmm6 + vmovdqu 48(%r11),%xmm5 + vpaddd 64(%r11),%xmm6,%xmm10 + vpaddd %xmm5,%xmm6,%xmm11 + vpaddd %xmm5,%xmm10,%xmm12 + vpshufb %xmm0,%xmm10,%xmm10 + vpaddd %xmm5,%xmm11,%xmm13 + vpshufb %xmm0,%xmm11,%xmm11 + vpxor %xmm4,%xmm10,%xmm10 + vpaddd %xmm5,%xmm12,%xmm14 + vpshufb %xmm0,%xmm12,%xmm12 + vpxor %xmm4,%xmm11,%xmm11 + vpaddd %xmm5,%xmm13,%xmm1 + vpshufb %xmm0,%xmm13,%xmm13 + vpxor %xmm4,%xmm12,%xmm12 + vpshufb %xmm0,%xmm14,%xmm14 + vpxor %xmm4,%xmm13,%xmm13 + vpshufb %xmm0,%xmm1,%xmm1 + vpxor %xmm4,%xmm14,%xmm14 + jmp .Loop_ctr32 +.cfi_endproc +.size _aesni_ctr32_6x,.-_aesni_ctr32_6x + +.globl aesni_gcm_encrypt +.type aesni_gcm_encrypt,@function +.align 32 +aesni_gcm_encrypt: +.cfi_startproc + xorq %r10,%r10 + cmpq $288,%rdx + jb .Lgcm_enc_abort + + leaq (%rsp),%rax +.cfi_def_cfa_register %rax + pushq %rbx +.cfi_offset %rbx,-16 + pushq %rbp +.cfi_offset %rbp,-24 + pushq %r12 +.cfi_offset %r12,-32 + pushq %r13 +.cfi_offset %r13,-40 + pushq %r14 +.cfi_offset %r14,-48 + pushq %r15 +.cfi_offset %r15,-56 + vzeroupper + + vmovdqu (%r8),%xmm1 + addq $-128,%rsp + movl 12(%r8),%ebx + leaq .Lbswap_mask(%rip),%r11 + leaq -128(%rcx),%r14 + movq $0xf80,%r15 + leaq 128(%rcx),%rcx + vmovdqu (%r11),%xmm0 + andq $-128,%rsp + movl 240-128(%rcx),%ebp + + andq %r15,%r14 + andq %rsp,%r15 + subq %r14,%r15 + jc .Lenc_no_key_aliasing + cmpq $768,%r15 + jnc .Lenc_no_key_aliasing + subq %r15,%rsp +.Lenc_no_key_aliasing: + + leaq (%rsi),%r14 + leaq -192(%rsi,%rdx,1),%r15 + shrq $4,%rdx + + call _aesni_ctr32_6x + vpshufb %xmm0,%xmm9,%xmm8 + vpshufb %xmm0,%xmm10,%xmm2 + vmovdqu %xmm8,112(%rsp) + vpshufb %xmm0,%xmm11,%xmm4 + vmovdqu %xmm2,96(%rsp) + vpshufb %xmm0,%xmm12,%xmm5 + vmovdqu %xmm4,80(%rsp) + vpshufb %xmm0,%xmm13,%xmm6 + vmovdqu %xmm5,64(%rsp) + vpshufb %xmm0,%xmm14,%xmm7 + vmovdqu %xmm6,48(%rsp) + + call _aesni_ctr32_6x + + vmovdqu (%r9),%xmm8 + leaq 32+32(%r9),%r9 + subq $12,%rdx + movq $192,%r10 + vpshufb %xmm0,%xmm8,%xmm8 + + call _aesni_ctr32_ghash_6x + vmovdqu 32(%rsp),%xmm7 + vmovdqu (%r11),%xmm0 + vmovdqu 0-32(%r9),%xmm3 + vpunpckhqdq %xmm7,%xmm7,%xmm1 + vmovdqu 32-32(%r9),%xmm15 + vmovups %xmm9,-96(%rsi) + vpshufb %xmm0,%xmm9,%xmm9 + vpxor %xmm7,%xmm1,%xmm1 + vmovups %xmm10,-80(%rsi) + vpshufb %xmm0,%xmm10,%xmm10 + vmovups %xmm11,-64(%rsi) + vpshufb %xmm0,%xmm11,%xmm11 + vmovups %xmm12,-48(%rsi) + vpshufb %xmm0,%xmm12,%xmm12 + vmovups %xmm13,-32(%rsi) + vpshufb %xmm0,%xmm13,%xmm13 + vmovups %xmm14,-16(%rsi) + vpshufb %xmm0,%xmm14,%xmm14 + vmovdqu %xmm9,16(%rsp) + vmovdqu 48(%rsp),%xmm6 + vmovdqu 16-32(%r9),%xmm0 + vpunpckhqdq %xmm6,%xmm6,%xmm2 + vpclmulqdq $0x00,%xmm3,%xmm7,%xmm5 + vpxor %xmm6,%xmm2,%xmm2 + vpclmulqdq $0x11,%xmm3,%xmm7,%xmm7 + vpclmulqdq $0x00,%xmm15,%xmm1,%xmm1 + + vmovdqu 64(%rsp),%xmm9 + vpclmulqdq $0x00,%xmm0,%xmm6,%xmm4 + vmovdqu 48-32(%r9),%xmm3 + vpxor %xmm5,%xmm4,%xmm4 + vpunpckhqdq %xmm9,%xmm9,%xmm5 + vpclmulqdq $0x11,%xmm0,%xmm6,%xmm6 + vpxor %xmm9,%xmm5,%xmm5 + vpxor %xmm7,%xmm6,%xmm6 + vpclmulqdq $0x10,%xmm15,%xmm2,%xmm2 + vmovdqu 80-32(%r9),%xmm15 + vpxor %xmm1,%xmm2,%xmm2 + + vmovdqu 80(%rsp),%xmm1 + vpclmulqdq $0x00,%xmm3,%xmm9,%xmm7 + vmovdqu 64-32(%r9),%xmm0 + vpxor %xmm4,%xmm7,%xmm7 + vpunpckhqdq %xmm1,%xmm1,%xmm4 + vpclmulqdq $0x11,%xmm3,%xmm9,%xmm9 + vpxor %xmm1,%xmm4,%xmm4 + vpxor %xmm6,%xmm9,%xmm9 + vpclmulqdq $0x00,%xmm15,%xmm5,%xmm5 + vpxor %xmm2,%xmm5,%xmm5 + + vmovdqu 96(%rsp),%xmm2 + vpclmulqdq $0x00,%xmm0,%xmm1,%xmm6 + vmovdqu 96-32(%r9),%xmm3 + vpxor %xmm7,%xmm6,%xmm6 + vpunpckhqdq %xmm2,%xmm2,%xmm7 + vpclmulqdq $0x11,%xmm0,%xmm1,%xmm1 + vpxor %xmm2,%xmm7,%xmm7 + vpxor %xmm9,%xmm1,%xmm1 + vpclmulqdq $0x10,%xmm15,%xmm4,%xmm4 + vmovdqu 128-32(%r9),%xmm15 + vpxor %xmm5,%xmm4,%xmm4 + + vpxor 112(%rsp),%xmm8,%xmm8 + vpclmulqdq $0x00,%xmm3,%xmm2,%xmm5 + vmovdqu 112-32(%r9),%xmm0 + vpunpckhqdq %xmm8,%xmm8,%xmm9 + vpxor %xmm6,%xmm5,%xmm5 + vpclmulqdq $0x11,%xmm3,%xmm2,%xmm2 + vpxor %xmm8,%xmm9,%xmm9 + vpxor %xmm1,%xmm2,%xmm2 + vpclmulqdq $0x00,%xmm15,%xmm7,%xmm7 + vpxor %xmm4,%xmm7,%xmm4 + + vpclmulqdq $0x00,%xmm0,%xmm8,%xmm6 + vmovdqu 0-32(%r9),%xmm3 + vpunpckhqdq %xmm14,%xmm14,%xmm1 + vpclmulqdq $0x11,%xmm0,%xmm8,%xmm8 + vpxor %xmm14,%xmm1,%xmm1 + vpxor %xmm5,%xmm6,%xmm5 + vpclmulqdq $0x10,%xmm15,%xmm9,%xmm9 + vmovdqu 32-32(%r9),%xmm15 + vpxor %xmm2,%xmm8,%xmm7 + vpxor %xmm4,%xmm9,%xmm6 + + vmovdqu 16-32(%r9),%xmm0 + vpxor %xmm5,%xmm7,%xmm9 + vpclmulqdq $0x00,%xmm3,%xmm14,%xmm4 + vpxor %xmm9,%xmm6,%xmm6 + vpunpckhqdq %xmm13,%xmm13,%xmm2 + vpclmulqdq $0x11,%xmm3,%xmm14,%xmm14 + vpxor %xmm13,%xmm2,%xmm2 + vpslldq $8,%xmm6,%xmm9 + vpclmulqdq $0x00,%xmm15,%xmm1,%xmm1 + vpxor %xmm9,%xmm5,%xmm8 + vpsrldq $8,%xmm6,%xmm6 + vpxor %xmm6,%xmm7,%xmm7 + + vpclmulqdq $0x00,%xmm0,%xmm13,%xmm5 + vmovdqu 48-32(%r9),%xmm3 + vpxor %xmm4,%xmm5,%xmm5 + vpunpckhqdq %xmm12,%xmm12,%xmm9 + vpclmulqdq $0x11,%xmm0,%xmm13,%xmm13 + vpxor %xmm12,%xmm9,%xmm9 + vpxor %xmm14,%xmm13,%xmm13 + vpalignr $8,%xmm8,%xmm8,%xmm14 + vpclmulqdq $0x10,%xmm15,%xmm2,%xmm2 + vmovdqu 80-32(%r9),%xmm15 + vpxor %xmm1,%xmm2,%xmm2 + + vpclmulqdq $0x00,%xmm3,%xmm12,%xmm4 + vmovdqu 64-32(%r9),%xmm0 + vpxor %xmm5,%xmm4,%xmm4 + vpunpckhqdq %xmm11,%xmm11,%xmm1 + vpclmulqdq $0x11,%xmm3,%xmm12,%xmm12 + vpxor %xmm11,%xmm1,%xmm1 + vpxor %xmm13,%xmm12,%xmm12 + vxorps 16(%rsp),%xmm7,%xmm7 + vpclmulqdq $0x00,%xmm15,%xmm9,%xmm9 + vpxor %xmm2,%xmm9,%xmm9 + + vpclmulqdq $0x10,16(%r11),%xmm8,%xmm8 + vxorps %xmm14,%xmm8,%xmm8 + + vpclmulqdq $0x00,%xmm0,%xmm11,%xmm5 + vmovdqu 96-32(%r9),%xmm3 + vpxor %xmm4,%xmm5,%xmm5 + vpunpckhqdq %xmm10,%xmm10,%xmm2 + vpclmulqdq $0x11,%xmm0,%xmm11,%xmm11 + vpxor %xmm10,%xmm2,%xmm2 + vpalignr $8,%xmm8,%xmm8,%xmm14 + vpxor %xmm12,%xmm11,%xmm11 + vpclmulqdq $0x10,%xmm15,%xmm1,%xmm1 + vmovdqu 128-32(%r9),%xmm15 + vpxor %xmm9,%xmm1,%xmm1 + + vxorps %xmm7,%xmm14,%xmm14 + vpclmulqdq $0x10,16(%r11),%xmm8,%xmm8 + vxorps %xmm14,%xmm8,%xmm8 + + vpclmulqdq $0x00,%xmm3,%xmm10,%xmm4 + vmovdqu 112-32(%r9),%xmm0 + vpxor %xmm5,%xmm4,%xmm4 + vpunpckhqdq %xmm8,%xmm8,%xmm9 + vpclmulqdq $0x11,%xmm3,%xmm10,%xmm10 + vpxor %xmm8,%xmm9,%xmm9 + vpxor %xmm11,%xmm10,%xmm10 + vpclmulqdq $0x00,%xmm15,%xmm2,%xmm2 + vpxor %xmm1,%xmm2,%xmm2 + + vpclmulqdq $0x00,%xmm0,%xmm8,%xmm5 + vpclmulqdq $0x11,%xmm0,%xmm8,%xmm7 + vpxor %xmm4,%xmm5,%xmm5 + vpclmulqdq $0x10,%xmm15,%xmm9,%xmm6 + vpxor %xmm10,%xmm7,%xmm7 + vpxor %xmm2,%xmm6,%xmm6 + + vpxor %xmm5,%xmm7,%xmm4 + vpxor %xmm4,%xmm6,%xmm6 + vpslldq $8,%xmm6,%xmm1 + vmovdqu 16(%r11),%xmm3 + vpsrldq $8,%xmm6,%xmm6 + vpxor %xmm1,%xmm5,%xmm8 + vpxor %xmm6,%xmm7,%xmm7 + + vpalignr $8,%xmm8,%xmm8,%xmm2 + vpclmulqdq $0x10,%xmm3,%xmm8,%xmm8 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-12@freebsd.org Sat Aug 29 22:09:37 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 18F8B3BF35C; Sat, 29 Aug 2020 22:09:37 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Bf9cJ70LGz48d7; Sat, 29 Aug 2020 22:09:36 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 D47D8C820; Sat, 29 Aug 2020 22:09:36 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07TM9aKj065430; Sat, 29 Aug 2020 22:09:36 GMT (envelope-from jamie@FreeBSD.org) Received: (from jamie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07TM9a48065429; Sat, 29 Aug 2020 22:09:36 GMT (envelope-from jamie@FreeBSD.org) Message-Id: <202008292209.07TM9a48065429@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jamie set sender to jamie@FreeBSD.org using -f From: Jamie Gritton Date: Sat, 29 Aug 2020 22:09:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364969 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: jamie X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 364969 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Aug 2020 22:09:37 -0000 Author: jamie Date: Sat Aug 29 22:09:36 2020 New Revision: 364969 URL: https://svnweb.freebsd.org/changeset/base/364969 Log: Fix a null dereference when debug.disablefullpath=1 and jail created with path=/. PR: 214881 Submitted by: aler (at) playground.ru Reported by: aler (at) playground.ru Modified: stable/12/sys/kern/kern_jail.c Modified: stable/12/sys/kern/kern_jail.c ============================================================================== --- stable/12/sys/kern/kern_jail.c Sat Aug 29 21:47:49 2020 (r364968) +++ stable/12/sys/kern/kern_jail.c Sat Aug 29 22:09:36 2020 (r364969) @@ -943,40 +943,45 @@ kern_jail_set(struct thread *td, struct uio *optuio, i error = EINVAL; goto done_free; } - NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, - path, td); - error = namei(&nd); - if (error) - goto done_free; - root = nd.ni_vp; - NDFREE(&nd, NDF_ONLY_PNBUF); - g_path = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); - strlcpy(g_path, path, MAXPATHLEN); - error = vn_path_to_global_path(td, root, g_path, MAXPATHLEN); - if (error == 0) - path = g_path; - else if (error == ENODEV) { - /* proceed if sysctl debug.disablefullpath == 1 */ - fullpath_disabled = 1; - if (len < 2 || (len == 2 && path[0] == '/')) - path = NULL; - } else { - /* exit on other errors */ - goto done_free; - } - if (root->v_type != VDIR) { - error = ENOTDIR; - vput(root); - goto done_free; - } - VOP_UNLOCK(root, 0); - if (fullpath_disabled) { - /* Leave room for a real-root full pathname. */ - if (len + (path[0] == '/' && strcmp(mypr->pr_path, "/") - ? strlen(mypr->pr_path) : 0) > MAXPATHLEN) { - error = ENAMETOOLONG; - vrele(root); + if (len < 2 || (len == 2 && path[0] == '/')) + path = NULL; + else + { + NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, + path, td); + error = namei(&nd); + if (error) goto done_free; + root = nd.ni_vp; + NDFREE(&nd, NDF_ONLY_PNBUF); + g_path = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); + strlcpy(g_path, path, MAXPATHLEN); + error = vn_path_to_global_path(td, root, g_path, + MAXPATHLEN); + if (error == 0) + path = g_path; + else if (error == ENODEV) { + /* means sysctl debug.disablefullpath == 1 */ + fullpath_disabled = 1; + } else { + /* exit on other errors */ + goto done_free; + } + if (root->v_type != VDIR) { + error = ENOTDIR; + vput(root); + goto done_free; + } + VOP_UNLOCK(root, 0); + if (fullpath_disabled) { + /* Leave room for a real-root full pathname. */ + if (len + (path[0] == '/' && + strcmp(mypr->pr_path, "/") + ? strlen(mypr->pr_path) : 0) > MAXPATHLEN) { + error = ENAMETOOLONG; + vrele(root); + goto done_free; + } } } }