From nobody Mon Nov 8 01:51:54 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7C7601840A7F; Mon, 8 Nov 2021 01:51:54 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HnYy231qkz3tQq; Mon, 8 Nov 2021 01:51:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3D2229D5; Mon, 8 Nov 2021 01:51:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1A81pstI081891; Mon, 8 Nov 2021 01:51:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A81ps1F081890; Mon, 8 Nov 2021 01:51:54 GMT (envelope-from git) Date: Mon, 8 Nov 2021 01:51:54 GMT Message-Id: <202111080151.1A81ps1F081890@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: ced974a7b07d - stable/13 - cosl(): fix polynomial approximation coefficients for ld128 version List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ced974a7b07de731d8cce8d15be9968ece74ff3d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ced974a7b07de731d8cce8d15be9968ece74ff3d commit ced974a7b07de731d8cce8d15be9968ece74ff3d Author: Steve Kargl AuthorDate: 2021-11-02 08:54:10 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-08 01:49:45 +0000 cosl(): fix polynomial approximation coefficients for ld128 version PR: 218514 (cherry picked from commit 6d04e1422e70ca0a77552782c01c291f90716773) --- lib/msun/ld128/k_cosl.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/lib/msun/ld128/k_cosl.c b/lib/msun/ld128/k_cosl.c index fe57773a1348..422357bf8a6c 100644 --- a/lib/msun/ld128/k_cosl.c +++ b/lib/msun/ld128/k_cosl.c @@ -21,8 +21,8 @@ __FBSDID("$FreeBSD$"); #include "math_private.h" /* - * Domain [-0.7854, 0.7854], range ~[-1.80e-37, 1.79e-37]: - * |cos(x) - c(x))| < 2**-122.0 + * Domain [-0.7854, 0.7854], range ~[-1.17e-39, 1.19e-39]: + * |cos(x) - c(x))| < 2**-129.3 * * 113-bit precision requires more care than 64-bit precision, since * simple methods give a minimax polynomial with coefficient for x^2 @@ -31,21 +31,19 @@ __FBSDID("$FreeBSD$"); */ static const double one = 1.0; - static const long double -C1 = 0.04166666666666666666666666666666658424671L, -C2 = -0.001388888888888888888888888888863490893732L, -C3 = 0.00002480158730158730158730158600795304914210L, -C4 = -0.2755731922398589065255474947078934284324e-6L, -C5 = 0.2087675698786809897659225313136400793948e-8L, -C6 = -0.1147074559772972315817149986812031204775e-10L, -C7 = 0.4779477332386808976875457937252120293400e-13L; - -static const double -C8 = -0.1561920696721507929516718307820958119868e-15, -C9 = 0.4110317413744594971475941557607804508039e-18, -C10 = -0.8896592467191938803288521958313920156409e-21, -C11 = 0.1601061435794535138244346256065192782581e-23; +C1 = 4.16666666666666666666666666666666667e-02L, +C2 = -1.38888888888888888888888888888888834e-03L, +C3 = 2.48015873015873015873015873015446795e-05L, +C4 = -2.75573192239858906525573190949988493e-07L, +C5 = 2.08767569878680989792098886701451072e-09L, +C6 = -1.14707455977297247136657111139971865e-11L, +C7 = 4.77947733238738518870113294139830239e-14L, +C8 = -1.56192069685858079920640872925306403e-16L, +C9 = 4.11031762320473354032038893429515732e-19L, +C10= -8.89679121027589608738005163931958096e-22L, +C11= 1.61171797801314301767074036661901531e-24L, +C12= -2.46748624357670948912574279501044295e-27L; long double __kernel_cosl(long double x, long double y) @@ -54,7 +52,7 @@ __kernel_cosl(long double x, long double y) z = x*x; r = z*(C1+z*(C2+z*(C3+z*(C4+z*(C5+z*(C6+z*(C7+ - z*(C8+z*(C9+z*(C10+z*C11)))))))))); + z*(C8+z*(C9+z*(C10+z*(C11+z*C12))))))))))); hz = 0.5*z; w = one-hz; return w + (((one-w)-hz) + (z*r-x*y)); From nobody Mon Nov 8 05:55:55 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id F3A3418311F7; Mon, 8 Nov 2021 05:55:55 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HngMb6ZG5z4gPx; Mon, 8 Nov 2021 05:55:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C181F456A; Mon, 8 Nov 2021 05:55:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1A85ttqw005320; Mon, 8 Nov 2021 05:55:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A85ttbr005319; Mon, 8 Nov 2021 05:55:55 GMT (envelope-from git) Date: Mon, 8 Nov 2021 05:55:55 GMT Message-Id: <202111080555.1A85ttbr005319@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andriy Gapon Subject: git: df838c540632 - stable/13 - fuser: restore functionality by fixing fsid type List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: df838c540632ce3840f78a9067dd9de32458c71a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=df838c540632ce3840f78a9067dd9de32458c71a commit df838c540632ce3840f78a9067dd9de32458c71a Author: Andriy Gapon AuthorDate: 2021-11-01 06:40:17 +0000 Commit: Andriy Gapon CommitDate: 2021-11-08 05:55:30 +0000 fuser: restore functionality by fixing fsid type Use types from sys/stat.h for the filesystem and inode numbers for extra safety. PR: 259504 Reported by: Markus Wild MFC after: 1 week (cherry picked from commit e18fbe6f19ed106f035c7d2aaeade6eb55cc0b5a) --- usr.bin/fstat/fuser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.bin/fstat/fuser.c b/usr.bin/fstat/fuser.c index b4225328fc1f..ad4aebf4a2cb 100644 --- a/usr.bin/fstat/fuser.c +++ b/usr.bin/fstat/fuser.c @@ -92,8 +92,8 @@ struct consumer { STAILQ_ENTRY(consumer) next; }; struct reqfile { - uint32_t fsid; - uint64_t fileid; + dev_t fsid; + ino_t fileid; const char *name; STAILQ_HEAD(, consumer) consumers; }; From nobody Mon Nov 8 06:01:06 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4517518357B7; Mon, 8 Nov 2021 06:01:07 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HngTb14M8z4jfg; Mon, 8 Nov 2021 06:01:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0668342D1; Mon, 8 Nov 2021 06:01:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1A8616DP014821; Mon, 8 Nov 2021 06:01:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A8616bl014820; Mon, 8 Nov 2021 06:01:06 GMT (envelope-from git) Date: Mon, 8 Nov 2021 06:01:06 GMT Message-Id: <202111080601.1A8616bl014820@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andriy Gapon Subject: git: d3aca6fe9bf9 - stable/12 - fuser: restore functionality by fixing fsid type List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: d3aca6fe9bf97ea22bb9bee365b616bcb77a1220 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=d3aca6fe9bf97ea22bb9bee365b616bcb77a1220 commit d3aca6fe9bf97ea22bb9bee365b616bcb77a1220 Author: Andriy Gapon AuthorDate: 2021-11-01 06:40:17 +0000 Commit: Andriy Gapon CommitDate: 2021-11-08 05:59:01 +0000 fuser: restore functionality by fixing fsid type Use types from sys/stat.h for the filesystem and inode numbers for extra safety. PR: 259504 Reported by: Markus Wild MFC after: 1 week (cherry picked from commit e18fbe6f19ed106f035c7d2aaeade6eb55cc0b5a) --- usr.bin/fstat/fuser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.bin/fstat/fuser.c b/usr.bin/fstat/fuser.c index b4225328fc1f..ad4aebf4a2cb 100644 --- a/usr.bin/fstat/fuser.c +++ b/usr.bin/fstat/fuser.c @@ -92,8 +92,8 @@ struct consumer { STAILQ_ENTRY(consumer) next; }; struct reqfile { - uint32_t fsid; - uint64_t fileid; + dev_t fsid; + ino_t fileid; const char *name; STAILQ_HEAD(, consumer) consumers; }; From nobody Mon Nov 8 13:54:56 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 57AE41855E3B; Mon, 8 Nov 2021 13:54:56 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hnt0J2345z4TW0; Mon, 8 Nov 2021 13:54:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 26C3412C9C; Mon, 8 Nov 2021 13:54:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1A8DsuFc047391; Mon, 8 Nov 2021 13:54:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A8Dsudk047390; Mon, 8 Nov 2021 13:54:56 GMT (envelope-from git) Date: Mon, 8 Nov 2021 13:54:56 GMT Message-Id: <202111081354.1A8Dsudk047390@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 96e101bec980 - stable/13 - elftoolchain: stop leaving tempfiles on error List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 96e101bec9808987537af6e529a3ef4f1da9cb83 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=96e101bec9808987537af6e529a3ef4f1da9cb83 commit 96e101bec9808987537af6e529a3ef4f1da9cb83 Author: Chris Rees AuthorDate: 2021-02-15 11:37:06 +0000 Commit: Ed Maste CommitDate: 2021-11-08 13:54:23 +0000 elftoolchain: stop leaving tempfiles on error Temporary files were not cleaned up, resulting in $TMPDIR or even the current directory becoming littered with ecp.* files. This happened with error and even sometimes on success! Approved by: dim MFC after: 4 weeks Accepted upstream: https://sourceforge.net/p/elftoolchain/code/3918/ Differential Revision: https://reviews.freebsd.org/D28651 (cherry picked from commit 5ac70383c8b32eeec80426e837960977971c7c2b) --- contrib/elftoolchain/elfcopy/archive.c | 31 ++++++++++---- contrib/elftoolchain/elfcopy/elfcopy.h | 1 + contrib/elftoolchain/elfcopy/main.c | 77 +++++++++++++++++++++++++++------- 3 files changed, 86 insertions(+), 23 deletions(-) diff --git a/contrib/elftoolchain/elfcopy/archive.c b/contrib/elftoolchain/elfcopy/archive.c index 9e23b831fdca..e57caad58e35 100644 --- a/contrib/elftoolchain/elfcopy/archive.c +++ b/contrib/elftoolchain/elfcopy/archive.c @@ -69,9 +69,11 @@ process_ar_obj(struct elfcopy *ecp, struct ar_obj *obj) /* Output to a temporary file. */ create_tempfile(NULL, &tempfile, &fd); - if ((ecp->eout = elf_begin(fd, ELF_C_WRITE, NULL)) == NULL) + if ((ecp->eout = elf_begin(fd, ELF_C_WRITE, NULL)) == NULL) { + cleanup_tempfile(tempfile); errx(EXIT_FAILURE, "elf_begin() failed: %s", elf_errmsg(-1)); + } elf_flagelf(ecp->eout, ELF_C_SET, ELF_F_LAYOUT); create_elf(ecp); elf_end(ecp->ein); @@ -80,27 +82,40 @@ process_ar_obj(struct elfcopy *ecp, struct ar_obj *obj) obj->buf = NULL; /* Extract archive symbols. */ - if (lseek(fd, 0, SEEK_SET) < 0) + if (lseek(fd, 0, SEEK_SET) < 0) { + cleanup_tempfile(tempfile); err(EXIT_FAILURE, "lseek failed for '%s'", tempfile); - if ((ecp->eout = elf_begin(fd, ELF_C_READ, NULL)) == NULL) + } + if ((ecp->eout = elf_begin(fd, ELF_C_READ, NULL)) == NULL) { + cleanup_tempfile(tempfile); errx(EXIT_FAILURE, "elf_begin() failed: %s", elf_errmsg(-1)); + } extract_arsym(ecp); elf_end(ecp->eout); - if (fstat(fd, &sb) == -1) + if (fstat(fd, &sb) == -1) { + cleanup_tempfile(tempfile); err(EXIT_FAILURE, "fstat %s failed", tempfile); - if (lseek(fd, 0, SEEK_SET) < 0) + } + if (lseek(fd, 0, SEEK_SET) < 0) { + cleanup_tempfile(tempfile); err(EXIT_FAILURE, "lseek %s failed", tempfile); + } obj->size = sb.st_size; - if ((obj->maddr = malloc(obj->size)) == NULL) + if ((obj->maddr = malloc(obj->size)) == NULL) { + cleanup_tempfile(tempfile); err(EXIT_FAILURE, "memory allocation failed for '%s'", tempfile); - if ((size_t) read(fd, obj->maddr, obj->size) != obj->size) + } + if ((size_t) read(fd, obj->maddr, obj->size) != obj->size) { + cleanup_tempfile(tempfile); err(EXIT_FAILURE, "read failed for '%s'", tempfile); - if (unlink(tempfile)) + } + if (cleanup_tempfile(tempfile) < 0) err(EXIT_FAILURE, "unlink %s failed", tempfile); free(tempfile); + tempfile = NULL; close(fd); if (strlen(obj->name) > _MAXNAMELEN_SVR4) add_to_ar_str_table(ecp, obj->name); diff --git a/contrib/elftoolchain/elfcopy/elfcopy.h b/contrib/elftoolchain/elfcopy/elfcopy.h index b8845a574428..17d8b803156d 100644 --- a/contrib/elftoolchain/elfcopy/elfcopy.h +++ b/contrib/elftoolchain/elfcopy/elfcopy.h @@ -277,6 +277,7 @@ void add_to_symtab(struct elfcopy *_ecp, const char *_name, unsigned char _st_info, unsigned char _st_other, int _ndx_known); int add_to_inseg_list(struct elfcopy *_ecp, struct section *_sec); void adjust_addr(struct elfcopy *_ecp); +int cleanup_tempfile(char *_fn); void copy_content(struct elfcopy *_ecp); void copy_data(struct section *_s); void copy_phdr(struct elfcopy *_ecp); diff --git a/contrib/elftoolchain/elfcopy/main.c b/contrib/elftoolchain/elfcopy/main.c index c02bb296c4a3..964d3358de60 100644 --- a/contrib/elftoolchain/elfcopy/main.c +++ b/contrib/elftoolchain/elfcopy/main.c @@ -510,6 +510,27 @@ free_elf(struct elfcopy *ecp) } } +/* + * Remove a temporary file, without freeing its filename. + * + * Safe to pass NULL, will just ignore it. + */ +int +cleanup_tempfile(char *fn) +{ + int errno_save, retval; + + if (fn == NULL) + return 0; + errno_save = errno; + if ((retval = unlink(fn)) < 0) { + warn("unlink tempfile %s failed", fn); + errno = errno_save; + return retval; + } + return 0; +} + /* Create a temporary file. */ void create_tempfile(const char *src, char **fn, int *fd) @@ -656,8 +677,10 @@ create_file(struct elfcopy *ecp, const char *src, const char *dst) } #endif - if (lseek(ifd, 0, SEEK_SET) < 0) + if (lseek(ifd, 0, SEEK_SET) < 0) { + cleanup_tempfile(tempfile); err(EXIT_FAILURE, "lseek failed"); + } /* * If input object is not ELF file, convert it to an intermediate @@ -677,9 +700,12 @@ create_file(struct elfcopy *ecp, const char *src, const char *dst) ecp->oed = ELFDATA2LSB; } create_tempfile(src, &elftemp, &efd); - if ((ecp->eout = elf_begin(efd, ELF_C_WRITE, NULL)) == NULL) + if ((ecp->eout = elf_begin(efd, ELF_C_WRITE, NULL)) == NULL) { + cleanup_tempfile(elftemp); + cleanup_tempfile(tempfile); errx(EXIT_FAILURE, "elf_begin() failed: %s", elf_errmsg(-1)); + } elf_flagelf(ecp->eout, ELF_C_SET, ELF_F_LAYOUT); if (ecp->itf == ETF_BINARY) create_elf_from_binary(ecp, ifd, src); @@ -687,31 +713,45 @@ create_file(struct elfcopy *ecp, const char *src, const char *dst) create_elf_from_ihex(ecp, ifd); else if (ecp->itf == ETF_SREC) create_elf_from_srec(ecp, ifd); - else + else { + cleanup_tempfile(elftemp); + cleanup_tempfile(tempfile); errx(EXIT_FAILURE, "Internal: invalid target flavour"); + } elf_end(ecp->eout); /* Open intermediate ELF object as new input object. */ close(ifd); - if ((ifd = open(elftemp, O_RDONLY)) == -1) + if ((ifd = open(elftemp, O_RDONLY)) == -1) { + cleanup_tempfile(elftemp); + cleanup_tempfile(tempfile); err(EXIT_FAILURE, "open %s failed", src); + } close(efd); - if (unlink(elftemp) < 0) + if (cleanup_tempfile(elftemp) < 0) { + cleanup_tempfile(tempfile); err(EXIT_FAILURE, "unlink %s failed", elftemp); + } free(elftemp); + elftemp = NULL; } - if ((ecp->ein = elf_begin(ifd, ELF_C_READ, NULL)) == NULL) + if ((ecp->ein = elf_begin(ifd, ELF_C_READ, NULL)) == NULL) { + cleanup_tempfile(tempfile); errx(EXIT_FAILURE, "elf_begin() failed: %s", elf_errmsg(-1)); + } switch (elf_kind(ecp->ein)) { case ELF_K_NONE: + cleanup_tempfile(tempfile); errx(EXIT_FAILURE, "file format not recognized"); case ELF_K_ELF: - if ((ecp->eout = elf_begin(ofd, ELF_C_WRITE, NULL)) == NULL) + if ((ecp->eout = elf_begin(ofd, ELF_C_WRITE, NULL)) == NULL) { + cleanup_tempfile(tempfile); errx(EXIT_FAILURE, "elf_begin() failed: %s", elf_errmsg(-1)); + } /* elfcopy(1) manage ELF layout by itself. */ elf_flagelf(ecp->eout, ELF_C_SET, ELF_F_LAYOUT); @@ -730,21 +770,21 @@ create_file(struct elfcopy *ecp, const char *src, const char *dst) * Create (another) tempfile for binary/srec/ihex * output object. */ - if (tempfile != NULL) { - if (unlink(tempfile) < 0) - err(EXIT_FAILURE, "unlink %s failed", - tempfile); - free(tempfile); - } + if (cleanup_tempfile(tempfile) < 0) + errx(EXIT_FAILURE, "unlink %s failed", + tempfile); + free(tempfile); create_tempfile(src, &tempfile, &ofd0); /* * Rewind the file descriptor being processed. */ - if (lseek(ofd, 0, SEEK_SET) < 0) + if (lseek(ofd, 0, SEEK_SET) < 0) { + cleanup_tempfile(tempfile); err(EXIT_FAILURE, "lseek failed for the output object"); + } /* * Call flavour-specific conversion routine. @@ -765,11 +805,13 @@ create_file(struct elfcopy *ecp, const char *src, const char *dst) #if WITH_PE create_pe(ecp, ofd, ofd0); #else + cleanup_tempfile(tempfile); errx(EXIT_FAILURE, "PE/EFI support not enabled" " at compile time"); #endif break; default: + cleanup_tempfile(tempfile); errx(EXIT_FAILURE, "Internal: unsupported" " output flavour %d", ecp->oec); } @@ -784,6 +826,7 @@ create_file(struct elfcopy *ecp, const char *src, const char *dst) /* XXX: Not yet supported. */ break; default: + cleanup_tempfile(tempfile); errx(EXIT_FAILURE, "file format not supported"); } @@ -802,9 +845,13 @@ copy_done: in_place = 1; } - if (copy_from_tempfile(tempfile, dst, ofd, &tfd, in_place) < 0) + if (copy_from_tempfile(tempfile, dst, ofd, + &tfd, in_place) < 0) { + cleanup_tempfile(tempfile); err(EXIT_FAILURE, "creation of %s failed", dst); + } + /* 'tempfile' has been removed by copy_from_tempfile(). */ free(tempfile); tempfile = NULL; From nobody Mon Nov 8 13:54:57 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B5EA01855FA3; Mon, 8 Nov 2021 13:54:57 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hnt0K4MfVz4TNw; Mon, 8 Nov 2021 13:54:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5A3B612D8E; Mon, 8 Nov 2021 13:54:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1A8Dsv14047415; Mon, 8 Nov 2021 13:54:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A8DsvEs047414; Mon, 8 Nov 2021 13:54:57 GMT (envelope-from git) Date: Mon, 8 Nov 2021 13:54:57 GMT Message-Id: <202111081354.1A8DsvEs047414@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 8d91740f968a - stable/13 - strip/objcopy: handle empty file as unknown List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8d91740f968ad15911853a82c79bb5ad1d414375 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=8d91740f968ad15911853a82c79bb5ad1d414375 commit 8d91740f968ad15911853a82c79bb5ad1d414375 Author: Ed Maste AuthorDate: 2021-10-25 21:25:26 +0000 Commit: Ed Maste CommitDate: 2021-11-08 13:54:23 +0000 strip/objcopy: handle empty file as unknown Previously strip reported a somewhat cryptic error for empty files: strip: elf_begin() failed: Invalid argument Add a special case to treat empty files as with an unknown file format. This is consistent with llvm-strip. GNU strip produces no output which does not seem like useful behaviour (but it does exit with status 1). Reported by: andrew Reviewed by: markj MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32648 (cherry picked from commit 179219ea046f46927d6478d43431e8b541703539) --- contrib/elftoolchain/elfcopy/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contrib/elftoolchain/elfcopy/main.c b/contrib/elftoolchain/elfcopy/main.c index 964d3358de60..264e702ef5af 100644 --- a/contrib/elftoolchain/elfcopy/main.c +++ b/contrib/elftoolchain/elfcopy/main.c @@ -738,6 +738,8 @@ create_file(struct elfcopy *ecp, const char *src, const char *dst) if ((ecp->ein = elf_begin(ifd, ELF_C_READ, NULL)) == NULL) { cleanup_tempfile(tempfile); + if (fstat(ifd, &sb) == 0 && sb.st_size == 0) + errx(EXIT_FAILURE, "file format not recognized"); errx(EXIT_FAILURE, "elf_begin() failed: %s", elf_errmsg(-1)); } From nobody Mon Nov 8 14:03:41 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E04BF1831E87; Mon, 8 Nov 2021 14:03:41 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HntBP5yY4z4WjT; Mon, 8 Nov 2021 14:03:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ACC21131BA; Mon, 8 Nov 2021 14:03:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1A8E3f7i061309; Mon, 8 Nov 2021 14:03:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A8E3fYq061308; Mon, 8 Nov 2021 14:03:41 GMT (envelope-from git) Date: Mon, 8 Nov 2021 14:03:41 GMT Message-Id: <202111081403.1A8E3fYq061308@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 2cd53619a1fc - stable/12 - strip/objcopy: handle empty file as unknown List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 2cd53619a1fcdb1283ca1b813ecf10ec9bdb5b0b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=2cd53619a1fcdb1283ca1b813ecf10ec9bdb5b0b commit 2cd53619a1fcdb1283ca1b813ecf10ec9bdb5b0b Author: Ed Maste AuthorDate: 2021-10-25 21:25:26 +0000 Commit: Ed Maste CommitDate: 2021-11-08 14:02:46 +0000 strip/objcopy: handle empty file as unknown Previously strip reported a somewhat cryptic error for empty files: strip: elf_begin() failed: Invalid argument Add a special case to treat empty files as with an unknown file format. This is consistent with llvm-strip. GNU strip produces no output which does not seem like useful behaviour (but it does exit with status 1). Reported by: andrew Reviewed by: markj MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32648 (cherry picked from commit 179219ea046f46927d6478d43431e8b541703539) --- contrib/elftoolchain/elfcopy/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contrib/elftoolchain/elfcopy/main.c b/contrib/elftoolchain/elfcopy/main.c index c02bb296c4a3..ae2d3a2440df 100644 --- a/contrib/elftoolchain/elfcopy/main.c +++ b/contrib/elftoolchain/elfcopy/main.c @@ -702,6 +702,8 @@ create_file(struct elfcopy *ecp, const char *src, const char *dst) } if ((ecp->ein = elf_begin(ifd, ELF_C_READ, NULL)) == NULL) + if (fstat(ifd, &sb) == 0 && sb.st_size == 0) + errx(EXIT_FAILURE, "file format not recognized"); errx(EXIT_FAILURE, "elf_begin() failed: %s", elf_errmsg(-1)); From nobody Mon Nov 8 17:30:41 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A7C7718379EC; Mon, 8 Nov 2021 17:30:41 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HnynF2F0Gz4mJ9; Mon, 8 Nov 2021 17:30:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2D2CC15CA9; Mon, 8 Nov 2021 17:30:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1A8HUfvl037562; Mon, 8 Nov 2021 17:30:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A8HUfPL037561; Mon, 8 Nov 2021 17:30:41 GMT (envelope-from git) Date: Mon, 8 Nov 2021 17:30:41 GMT Message-Id: <202111081730.1A8HUfPL037561@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: 2f4812936a2c - stable/12 - Fix lld warning "SHF_MERGE section size must be a multiple of sh_entsize" List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 2f4812936a2ccaadd260f6bbaacd677e6079d9d0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=2f4812936a2ccaadd260f6bbaacd677e6079d9d0 commit 2f4812936a2ccaadd260f6bbaacd677e6079d9d0 Author: Dimitry Andric AuthorDate: 2021-11-08 10:19:59 +0000 Commit: Dimitry Andric CommitDate: 2021-11-08 17:29:35 +0000 Fix lld warning "SHF_MERGE section size must be a multiple of sh_entsize" Merge commit 56decd982dc0 from llvm git (by Fangrui Song): [ELF] Allow invalid sh_size%sh_entsize!=0 for non-SHF_MERGE sections Fixes https://bugs.llvm.org/show_bug.cgi?id=45370 Fixes https://github.com/Clozure/ccl/issues/273 .stab holds a table of 12-byte entries. GNU as before 2.35 incorrectly sets sh_entsize(.stab) to 20 on 64-bit architectures: https://sourceware.org/bugzilla/show_bug.cgi?id=25768 We should not emit the confusing error: "SHF_MERGE section size (...) must be a multiple of sh_entsize (20) Reviewed By: grimar, psmith Differential Revision: https://reviews.llvm.org/D77368 Direct commit to stable/12, since newer branches have this fix already. PR: 245179 Reported by: andrew@tao11.riddles.org.uk --- contrib/llvm-project/lld/ELF/InputFiles.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/contrib/llvm-project/lld/ELF/InputFiles.cpp b/contrib/llvm-project/lld/ELF/InputFiles.cpp index 43978cd66c61..21d528be6927 100644 --- a/contrib/llvm-project/lld/ELF/InputFiles.cpp +++ b/contrib/llvm-project/lld/ELF/InputFiles.cpp @@ -417,6 +417,9 @@ StringRef ObjFile::getShtGroupSignature(ArrayRef sections, template bool ObjFile::shouldMerge(const Elf_Shdr &sec, StringRef name) { + if (!(sec.sh_flags & SHF_MERGE)) + return false; + // On a regular link we don't merge sections if -O0 (default is -O1). This // sometimes makes the linker significantly faster, although the output will // be bigger. @@ -452,10 +455,7 @@ bool ObjFile::shouldMerge(const Elf_Shdr &sec, StringRef name) { Twine(sec.sh_size) + ") must be a multiple of sh_entsize (" + Twine(entSize) + ")"); - uint64_t flags = sec.sh_flags; - if (!(flags & SHF_MERGE)) - return false; - if (flags & SHF_WRITE) + if (sec.sh_flags & SHF_WRITE) fatal(toString(this) + ":(" + name + "): writable SHF_MERGE section is not supported"); From nobody Mon Nov 8 19:33:30 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 92726183325A; Mon, 8 Nov 2021 19:33:30 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hp1Vy3jxQz4XKh; Mon, 8 Nov 2021 19:33:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F64117739; Mon, 8 Nov 2021 19:33:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1A8JXUPl002671; Mon, 8 Nov 2021 19:33:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A8JXUIi002670; Mon, 8 Nov 2021 19:33:30 GMT (envelope-from git) Date: Mon, 8 Nov 2021 19:33:30 GMT Message-Id: <202111081933.1A8JXUIi002670@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 117844539758 - stable/12 - objcopy: fix stable/12 mismerge List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 11784453975887ef84f7843248bec90dda701eef Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=11784453975887ef84f7843248bec90dda701eef commit 11784453975887ef84f7843248bec90dda701eef Author: Ed Maste AuthorDate: 2021-11-08 19:30:29 +0000 Commit: Ed Maste CommitDate: 2021-11-08 19:32:59 +0000 objcopy: fix stable/12 mismerge Reported by: dim Fixes: 2cd53619a1fc ("strip/objcopy: handle empty file...") Sponsored by: The FreeBSD Foundation --- contrib/elftoolchain/elfcopy/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/elftoolchain/elfcopy/main.c b/contrib/elftoolchain/elfcopy/main.c index ae2d3a2440df..995f031dfa69 100644 --- a/contrib/elftoolchain/elfcopy/main.c +++ b/contrib/elftoolchain/elfcopy/main.c @@ -701,11 +701,12 @@ create_file(struct elfcopy *ecp, const char *src, const char *dst) free(elftemp); } - if ((ecp->ein = elf_begin(ifd, ELF_C_READ, NULL)) == NULL) + if ((ecp->ein = elf_begin(ifd, ELF_C_READ, NULL)) == NULL) { if (fstat(ifd, &sb) == 0 && sb.st_size == 0) errx(EXIT_FAILURE, "file format not recognized"); errx(EXIT_FAILURE, "elf_begin() failed: %s", elf_errmsg(-1)); + } switch (elf_kind(ecp->ein)) { case ELF_K_NONE: From nobody Mon Nov 8 19:38:38 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C027C1837789; Mon, 8 Nov 2021 19:39:17 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io1-f43.google.com (mail-io1-f43.google.com [209.85.166.43]) (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 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hp1dc523jz4Zk8; Mon, 8 Nov 2021 19:39:16 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io1-f43.google.com with SMTP id m9so5177570iop.0; Mon, 08 Nov 2021 11:39:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tNWOH8zSeVMa4Z7dqbWU70jOIQCmMBO/7BLZ43c0cPw=; b=0Cxgmmkgtt6QI0EzwUjS0JpBAjiVpaEsQR988Mxkwdu0FzQ2TBIxy5E5Q0PcuRXm0q wGVkMr/rrRcEVZK48Rcum7Ocs74iG1Tumz/v9WDzbvnuM1nI9xWwbuQGNmkOuq5AuLO5 Zj1heC3M91EImlwHYZh0rbe61qDpBf8tUpBWAaJBflxhtfKWKj8giZgDJ2zjMx10xpzK d+TnliXClZzJ12Brb4FMNB0hETshhQD9l/Sk9i+9oepNgxgDR4lqLBQ3XNVZXJOOp/MU kxAjDSWB01MXcPU5pAcCJj9VsEN2scX7xwF13+Mig4LlFr/a3sQq+j8bcE9slz8QD3Hd IBJg== X-Gm-Message-State: AOAM532tW9aQ5mmh3mgfbPQ8DM1Rko3aQLsFHorryP1AarB7tqQ+PMZ7 gICdoC8gKy0p3yzY/pNBYAe8CLIaJOfAGWieMONF8D3J X-Google-Smtp-Source: ABdhPJy4Ik9ob/vLYkWZxMgG51qDqoHU+qQq/WCilCUEp5cK4fZwWi7z3GSppjh93KC5pPVFSG6Ud1I3FuP4jre1AkM= X-Received: by 2002:a05:6602:2e85:: with SMTP id m5mr1135261iow.112.1636400349272; Mon, 08 Nov 2021 11:39:09 -0800 (PST) List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 References: <202111041832.1A4IWExb004128@gitrepo.freebsd.org> In-Reply-To: <202111041832.1A4IWExb004128@gitrepo.freebsd.org> From: Ed Maste Date: Mon, 8 Nov 2021 14:38:38 -0500 Message-ID: Subject: Re: git: ef1134110e80 - stable/13 - wpa: Fix WITHOUT_CRYPT build To: Cy Schubert Cc: src-committers , "" , dev-commits-src-branches@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4Hp1dc523jz4Zk8 X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of carpeddiem@gmail.com designates 209.85.166.43 as permitted sender) smtp.mailfrom=carpeddiem@gmail.com X-Spamd-Result: default: False [0.98 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FREEFALL_USER(0.00)[carpeddiem]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; TO_DN_SOME(0.00)[]; RCVD_TLS_ALL(0.00)[]; NEURAL_SPAM_SHORT(0.98)[0.981]; NEURAL_SPAM_LONG(1.00)[1.000]; RCVD_IN_DNSWL_NONE(0.00)[209.85.166.43:from]; FORGED_SENDER(0.30)[emaste@freebsd.org,carpeddiem@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.166.43: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)[emaste@freebsd.org,carpeddiem@gmail.com]; FREEMAIL_ENVFROM(0.00)[gmail.com]; RCVD_COUNT_TWO(0.00)[2] X-ThisMailContainsUnwantedMimeParts: N On Thu, 4 Nov 2021 at 14:32, Cy Schubert wrote: > > The branch stable/13 has been updated by cy: > > URL: https://cgit.FreeBSD.org/src/commit/?id=ef1134110e80fe31792d01758b055a4bbec7de69 > > commit ef1134110e80fe31792d01758b055a4bbec7de69 > Author: Cy Schubert > AuthorDate: 2021-10-28 23:55:48 +0000 > Commit: Cy Schubert > CommitDate: 2021-11-04 18:30:25 +0000 > > wpa: Fix WITHOUT_CRYPT build > > PASN requires CRYPT and when built WITHOUT_CRYPT buildworld > fails. Only enable PASN when MK_CRYPT is enabled (default). > > PR: 259517 Do we need to guard the build of pasn_supplicant.c by MK_CRYPT as well? My WITHOUT_CRYPT Cirrus-CI build failed with: --- pasn_supplicant.o --- /tmp/cirrus-ci-build/contrib/wpa//wpa_supplicant/pasn_supplicant.c:588:35: error: no member named 'pasn' in 'struct wpa_supplicant' struct wpas_pasn *pasn = &wpa_s->pasn; ~~~~~ ^ From nobody Mon Nov 8 21:15:07 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0BBC218541BB; Mon, 8 Nov 2021 21:15:08 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hp3mC6nXDz582t; Mon, 8 Nov 2021 21:15:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C5E1218C97; Mon, 8 Nov 2021 21:15:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1A8LF7ZM036548; Mon, 8 Nov 2021 21:15:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A8LF7QP036547; Mon, 8 Nov 2021 21:15:07 GMT (envelope-from git) Date: Mon, 8 Nov 2021 21:15:07 GMT Message-Id: <202111082115.1A8LF7QP036547@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: 188a9517358e - stable/13 - Partially revert ac76bc1145dd because it is no longer necessary List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 188a9517358e9dba97fb8dd682540bc915beed40 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=188a9517358e9dba97fb8dd682540bc915beed40 commit 188a9517358e9dba97fb8dd682540bc915beed40 Author: Dimitry Andric AuthorDate: 2021-11-05 21:26:16 +0000 Commit: Dimitry Andric CommitDate: 2021-11-08 21:00:47 +0000 Partially revert ac76bc1145dd because it is no longer necessary In ac76bc1145dd, I added a few volatiles to work around ctrig_test failures with {inf,inf}. This is not necessary anymore now, since in 3b00222f156d we added -fp-exception-behavior=maytrap for clang >= 10 in libm's Makefile. (The flag tells clang to use stricter floating point semantics, which libm depends on.) PR: 244732, 254911 Fixes: ac76bc1145dd (cherry picked from commit e2157cd0000f6dbb6465d7a885f2dcfd4d3596cb) --- lib/msun/src/s_ccoshf.c | 2 +- lib/msun/src/s_ctanh.c | 2 +- lib/msun/src/s_ctanhf.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/msun/src/s_ccoshf.c b/lib/msun/src/s_ccoshf.c index e72395c277d5..5d7a09ba5f8d 100644 --- a/lib/msun/src/s_ccoshf.c +++ b/lib/msun/src/s_ccoshf.c @@ -43,7 +43,7 @@ static const float huge = 0x1p127; float complex ccoshf(float complex z) { - volatile float x, y, h; + float x, y, h; int32_t hx, hy, ix, iy; x = crealf(z); diff --git a/lib/msun/src/s_ctanh.c b/lib/msun/src/s_ctanh.c index 93e5ad444501..e5840a1bf67b 100644 --- a/lib/msun/src/s_ctanh.c +++ b/lib/msun/src/s_ctanh.c @@ -76,7 +76,7 @@ __FBSDID("$FreeBSD$"); double complex ctanh(double complex z) { - volatile double x, y; + double x, y; double t, beta, s, rho, denom; uint32_t hx, ix, lx; diff --git a/lib/msun/src/s_ctanhf.c b/lib/msun/src/s_ctanhf.c index 164a2c23df9e..c46f86d2e116 100644 --- a/lib/msun/src/s_ctanhf.c +++ b/lib/msun/src/s_ctanhf.c @@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$"); float complex ctanhf(float complex z) { - volatile float x, y; + float x, y; float t, beta, s, rho, denom; uint32_t hx, ix; From nobody Mon Nov 8 21:15:37 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 241AE1854F81; Mon, 8 Nov 2021 21:15:38 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hp3mp0KYVz58gq; Mon, 8 Nov 2021 21:15:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DE53118C98; Mon, 8 Nov 2021 21:15:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1A8LFbCm036720; Mon, 8 Nov 2021 21:15:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A8LFbaY036719; Mon, 8 Nov 2021 21:15:37 GMT (envelope-from git) Date: Mon, 8 Nov 2021 21:15:37 GMT Message-Id: <202111082115.1A8LFbaY036719@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: d92735449c54 - stable/12 - Partially revert ac76bc1145dd because it is no longer necessary List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: d92735449c54a15f6f048ccefd61a9583d1935d0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=d92735449c54a15f6f048ccefd61a9583d1935d0 commit d92735449c54a15f6f048ccefd61a9583d1935d0 Author: Dimitry Andric AuthorDate: 2021-11-05 21:26:16 +0000 Commit: Dimitry Andric CommitDate: 2021-11-08 21:12:26 +0000 Partially revert ac76bc1145dd because it is no longer necessary In ac76bc1145dd, I added a few volatiles to work around ctrig_test failures with {inf,inf}. This is not necessary anymore now, since in 3b00222f156d we added -fp-exception-behavior=maytrap for clang >= 10 in libm's Makefile. (The flag tells clang to use stricter floating point semantics, which libm depends on.) PR: 244732, 254911 Fixes: ac76bc1145dd (cherry picked from commit e2157cd0000f6dbb6465d7a885f2dcfd4d3596cb) --- lib/msun/src/s_ccoshf.c | 2 +- lib/msun/src/s_ctanh.c | 2 +- lib/msun/src/s_ctanhf.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/msun/src/s_ccoshf.c b/lib/msun/src/s_ccoshf.c index e72395c277d5..5d7a09ba5f8d 100644 --- a/lib/msun/src/s_ccoshf.c +++ b/lib/msun/src/s_ccoshf.c @@ -43,7 +43,7 @@ static const float huge = 0x1p127; float complex ccoshf(float complex z) { - volatile float x, y, h; + float x, y, h; int32_t hx, hy, ix, iy; x = crealf(z); diff --git a/lib/msun/src/s_ctanh.c b/lib/msun/src/s_ctanh.c index 13eb9d40b678..88afeb50e26e 100644 --- a/lib/msun/src/s_ctanh.c +++ b/lib/msun/src/s_ctanh.c @@ -76,7 +76,7 @@ __FBSDID("$FreeBSD$"); double complex ctanh(double complex z) { - volatile double x, y; + double x, y; double t, beta, s, rho, denom; uint32_t hx, ix, lx; diff --git a/lib/msun/src/s_ctanhf.c b/lib/msun/src/s_ctanhf.c index 7d375eafd2ae..d2bd0b6786f0 100644 --- a/lib/msun/src/s_ctanhf.c +++ b/lib/msun/src/s_ctanhf.c @@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$"); float complex ctanhf(float complex z) { - volatile float x, y; + float x, y; float t, beta, s, rho, denom; uint32_t hx, ix; From nobody Mon Nov 8 21:15:55 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 96198185514F; Mon, 8 Nov 2021 21:15:57 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hp3n81Z3Nz591g; Mon, 8 Nov 2021 21:15:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C739F18B5B; Mon, 8 Nov 2021 21:15:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1A8LFtla036907; Mon, 8 Nov 2021 21:15:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A8LFtjB036906; Mon, 8 Nov 2021 21:15:55 GMT (envelope-from git) Date: Mon, 8 Nov 2021 21:15:55 GMT Message-Id: <202111082115.1A8LFtjB036906@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: ca6686d6a988 - stable/13 - openssh: diff reduction against upstream 7.9p1 List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ca6686d6a98809b74ab67901d14dafde5109a5fd Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=ca6686d6a98809b74ab67901d14dafde5109a5fd commit ca6686d6a98809b74ab67901d14dafde5109a5fd Author: Ed Maste AuthorDate: 2021-09-02 17:38:30 +0000 Commit: Ed Maste CommitDate: 2021-11-08 21:15:32 +0000 openssh: diff reduction against upstream 7.9p1 Clean up whitespace and nonfunctional differences, and unused functions. (cherry picked from commit 6eac665c8126af387a457ee8a08303c6607a6769) --- crypto/openssh/auth2.c | 1 - crypto/openssh/ssh-gss.h | 6 +++--- crypto/openssh/sshbuf-getput-basic.c | 1 - crypto/openssh/sshbuf.h | 8 -------- 4 files changed, 3 insertions(+), 13 deletions(-) diff --git a/crypto/openssh/auth2.c b/crypto/openssh/auth2.c index b03822e5f150..d6eb067245b7 100644 --- a/crypto/openssh/auth2.c +++ b/crypto/openssh/auth2.c @@ -309,7 +309,6 @@ input_userauth_request(int type, u_int32_t seq, struct ssh *ssh) "(%s,%s) -> (%s,%s)", authctxt->user, authctxt->service, user, service); } - /* reset state */ auth2_challenge_stop(ssh); diff --git a/crypto/openssh/ssh-gss.h b/crypto/openssh/ssh-gss.h index 236efa6b23c6..1e2d00e47ff1 100644 --- a/crypto/openssh/ssh-gss.h +++ b/crypto/openssh/ssh-gss.h @@ -29,10 +29,10 @@ #ifdef GSSAPI -#if defined(HAVE_GSSAPI_GSSAPI_H) -#include -#elif defined(HAVE_GSSAPI_H) +#ifdef HAVE_GSSAPI_H #include +#elif defined(HAVE_GSSAPI_GSSAPI_H) +#include #endif #ifdef KRB5 diff --git a/crypto/openssh/sshbuf-getput-basic.c b/crypto/openssh/sshbuf-getput-basic.c index 9092a7eebf97..50648258f48d 100644 --- a/crypto/openssh/sshbuf-getput-basic.c +++ b/crypto/openssh/sshbuf-getput-basic.c @@ -25,7 +25,6 @@ #include #include -#include "xmalloc.h" #include "ssherr.h" #include "sshbuf.h" diff --git a/crypto/openssh/sshbuf.h b/crypto/openssh/sshbuf.h index 87aa1560eabe..a43598cac4de 100644 --- a/crypto/openssh/sshbuf.h +++ b/crypto/openssh/sshbuf.h @@ -176,14 +176,6 @@ int sshbuf_put_u32(struct sshbuf *buf, u_int32_t val); int sshbuf_put_u16(struct sshbuf *buf, u_int16_t val); int sshbuf_put_u8(struct sshbuf *buf, u_char val); -#if defined(__FreeBSD__) && defined(__i386__) -#define sshbuf_get_time(b, vp) sshbuf_get_u32((b), (u_int32_t *)(vp)) -#define sshbuf_put_time(b, v) sshbuf_put_u32((b), (u_int32_t)(v)) -#else -#define sshbuf_get_time(b, vp) sshbuf_get_u64((b), (u_int64_t *)(vp)) -#define sshbuf_put_time(b, v) sshbuf_put_u64((b), (u_int64_t)(v)) -#endif - /* * Functions to extract or store SSH wire encoded strings (u32 len || data) * The "cstring" variants admit no \0 characters in the string contents. From nobody Mon Nov 8 21:15:56 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id BFC4D1855365; Mon, 8 Nov 2021 21:15:58 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hp3n92286z58ym; Mon, 8 Nov 2021 21:15:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E59D6189C0; Mon, 8 Nov 2021 21:15:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1A8LFuHA036932; Mon, 8 Nov 2021 21:15:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A8LFuxw036931; Mon, 8 Nov 2021 21:15:56 GMT (envelope-from git) Date: Mon, 8 Nov 2021 21:15:56 GMT Message-Id: <202111082115.1A8LFuxw036931@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 32f1062f26fe - stable/13 - openssh: restore local change to gssapi include logic List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 32f1062f26fe9b3b2e68573ab7efcf3212931e4d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=32f1062f26fe9b3b2e68573ab7efcf3212931e4d commit 32f1062f26fe9b3b2e68573ab7efcf3212931e4d Author: Ed Maste AuthorDate: 2021-09-02 20:43:59 +0000 Commit: Ed Maste CommitDate: 2021-11-08 21:15:32 +0000 openssh: restore local change to gssapi include logic /usr/include/gssapi.h claims that it is deprecated, and gssapi/gssapi.h should be used instead. So, test HAVE_GSSAPI_GSSAPI_H first falling back to HAVE_GSSAPI_H. This will be submitted upstream. Fixes: 6eac665c8126 ("openssh: diff reduction against...") Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31810 (cherry picked from commit 258f5f79bb36e3e6955e7fb149cd2f50265a9ea5) --- crypto/openssh/ssh-gss.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crypto/openssh/ssh-gss.h b/crypto/openssh/ssh-gss.h index 1e2d00e47ff1..887399b6b00a 100644 --- a/crypto/openssh/ssh-gss.h +++ b/crypto/openssh/ssh-gss.h @@ -29,10 +29,10 @@ #ifdef GSSAPI -#ifdef HAVE_GSSAPI_H -#include -#elif defined(HAVE_GSSAPI_GSSAPI_H) +#ifdef HAVE_GSSAPI_GSSAPI_H #include +#elif defined(HAVE_GSSAPI_H) +#include #endif #ifdef KRB5 From nobody Mon Nov 8 21:16:04 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3CF02185590F; Mon, 8 Nov 2021 21:16:05 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hp3nJ5pMFz590b; Mon, 8 Nov 2021 21:16:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9EE5A18E7B; Mon, 8 Nov 2021 21:16:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1A8LG4Ts037062; Mon, 8 Nov 2021 21:16:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A8LG4xZ037061; Mon, 8 Nov 2021 21:16:04 GMT (envelope-from git) Date: Mon, 8 Nov 2021 21:16:04 GMT Message-Id: <202111082116.1A8LG4xZ037061@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: ca7ffd26b3b5 - stable/11 - Partially revert ac76bc1145dd because it is no longer necessary List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: ca7ffd26b3b56cf94f8ee6d373d1cb47eb046fe0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/11 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=ca7ffd26b3b56cf94f8ee6d373d1cb47eb046fe0 commit ca7ffd26b3b56cf94f8ee6d373d1cb47eb046fe0 Author: Dimitry Andric AuthorDate: 2021-11-05 21:26:16 +0000 Commit: Dimitry Andric CommitDate: 2021-11-08 21:14:41 +0000 Partially revert ac76bc1145dd because it is no longer necessary In ac76bc1145dd, I added a few volatiles to work around ctrig_test failures with {inf,inf}. This is not necessary anymore now, since in 3b00222f156d we added -fp-exception-behavior=maytrap for clang >= 10 in libm's Makefile. (The flag tells clang to use stricter floating point semantics, which libm depends on.) PR: 244732, 254911 Fixes: ac76bc1145dd (cherry picked from commit e2157cd0000f6dbb6465d7a885f2dcfd4d3596cb) --- lib/msun/src/s_ccoshf.c | 2 +- lib/msun/src/s_ctanh.c | 2 +- lib/msun/src/s_ctanhf.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/msun/src/s_ccoshf.c b/lib/msun/src/s_ccoshf.c index 7fd61798c2f8..eeed92f8cf46 100644 --- a/lib/msun/src/s_ccoshf.c +++ b/lib/msun/src/s_ccoshf.c @@ -41,7 +41,7 @@ static const float huge = 0x1p127; float complex ccoshf(float complex z) { - volatile float x, y, h; + float x, y, h; int32_t hx, hy, ix, iy; x = crealf(z); diff --git a/lib/msun/src/s_ctanh.c b/lib/msun/src/s_ctanh.c index 7d2391eaea79..f5b9bdd9d5f8 100644 --- a/lib/msun/src/s_ctanh.c +++ b/lib/msun/src/s_ctanh.c @@ -74,7 +74,7 @@ __FBSDID("$FreeBSD$"); double complex ctanh(double complex z) { - volatile double x, y; + double x, y; double t, beta, s, rho, denom; uint32_t hx, ix, lx; diff --git a/lib/msun/src/s_ctanhf.c b/lib/msun/src/s_ctanhf.c index c222c15f81ee..520bf77d6d5c 100644 --- a/lib/msun/src/s_ctanhf.c +++ b/lib/msun/src/s_ctanhf.c @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$"); float complex ctanhf(float complex z) { - volatile float x, y; + float x, y; float t, beta, s, rho, denom; uint32_t hx, ix; From nobody Mon Nov 8 21:21:22 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B57911856FB2; Mon, 8 Nov 2021 21:21:22 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hp3vQ4ktHz3Cg7; Mon, 8 Nov 2021 21:21:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 83EFB18FE8; Mon, 8 Nov 2021 21:21:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1A8LLMSm046611; Mon, 8 Nov 2021 21:21:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A8LLMOW046610; Mon, 8 Nov 2021 21:21:22 GMT (envelope-from git) Date: Mon, 8 Nov 2021 21:21:22 GMT Message-Id: <202111082121.1A8LLMOW046610@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: d4754d707a10 - stable/13 - openssh: remove unnecessary $FreeBSD$ tags List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d4754d707a1016bbab8cc9c1fe4ef8e1d1d55c23 Auto-Submitted: auto-generated X-Spam: Yes X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=d4754d707a1016bbab8cc9c1fe4ef8e1d1d55c23 commit d4754d707a1016bbab8cc9c1fe4ef8e1d1d55c23 Author: Ed Maste AuthorDate: 2021-09-08 01:48:15 +0000 Commit: Ed Maste CommitDate: 2021-11-08 21:20:55 +0000 openssh: remove unnecessary $FreeBSD$ tags Diff reduction against upstream: remove $FreeBSD$ tags from files where the tag itself is the only difference from upstream. (cherry picked from commit 0e642632e64a8b8ca740ce3307abe116c990e0b6) --- crypto/openssh/mux.c | 1 - crypto/openssh/sftp-common.c | 1 - 2 files changed, 2 deletions(-) diff --git a/crypto/openssh/mux.c b/crypto/openssh/mux.c index d035fbe75f74..8e4b60827fc8 100644 --- a/crypto/openssh/mux.c +++ b/crypto/openssh/mux.c @@ -18,7 +18,6 @@ /* ssh session multiplexing support */ #include "includes.h" -__RCSID("$FreeBSD$"); #include #include diff --git a/crypto/openssh/sftp-common.c b/crypto/openssh/sftp-common.c index 3d6681467ffd..5d743d3b2b12 100644 --- a/crypto/openssh/sftp-common.c +++ b/crypto/openssh/sftp-common.c @@ -25,7 +25,6 @@ */ #include "includes.h" -__RCSID("$FreeBSD$"); #include #include From nobody Mon Nov 8 23:43:56 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 193A81852F26; Mon, 8 Nov 2021 23:43:57 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hp73x0BZ9z4l7d; Mon, 8 Nov 2021 23:43:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DA4421AD90; Mon, 8 Nov 2021 23:43:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1A8NhuWE036485; Mon, 8 Nov 2021 23:43:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A8NhurS036484; Mon, 8 Nov 2021 23:43:56 GMT (envelope-from git) Date: Mon, 8 Nov 2021 23:43:56 GMT Message-Id: <202111082343.1A8NhurS036484@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: a0880129a545 - stable/13 - ssh: move common Makefile boilerplate to a new ssh.mk List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a0880129a545dbb7ff35b456429b12e55146ef5d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=a0880129a545dbb7ff35b456429b12e55146ef5d commit a0880129a545dbb7ff35b456429b12e55146ef5d Author: Ed Maste AuthorDate: 2021-11-02 18:48:33 +0000 Commit: Ed Maste CommitDate: 2021-11-08 21:24:09 +0000 ssh: move common Makefile boilerplate to a new ssh.mk This moves SSHDIR and ssh_namespace.h handling to a common location, and will simplify future work such as adding U2F support (D32509). Reviewed by: kevans MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32808 (cherry picked from commit 9d63429fa16352f58037ac2aa6ddc734b25e8331) --- secure/Makefile.inc | 6 ------ secure/lib/libssh/Makefile | 4 +--- secure/libexec/sftp-server/Makefile | 3 +-- secure/libexec/ssh-keysign/Makefile | 3 +-- secure/libexec/ssh-pkcs11-helper/Makefile | 3 +-- secure/ssh.mk | 6 ++++++ secure/usr.bin/scp/Makefile | 3 +-- secure/usr.bin/sftp/Makefile | 3 +-- secure/usr.bin/ssh-add/Makefile | 3 +-- secure/usr.bin/ssh-agent/Makefile | 3 +-- secure/usr.bin/ssh-keygen/Makefile | 3 +-- secure/usr.bin/ssh-keyscan/Makefile | 3 +-- secure/usr.bin/ssh/Makefile | 4 +--- secure/usr.sbin/sshd/Makefile | 3 +-- 14 files changed, 18 insertions(+), 32 deletions(-) diff --git a/secure/Makefile.inc b/secure/Makefile.inc index 6c298be0223f..5de6eed37faf 100644 --- a/secure/Makefile.inc +++ b/secure/Makefile.inc @@ -1,15 +1,9 @@ # $FreeBSD$ -.include - .if exists(${.CURDIR:H:H}/lib/libcrypt/obj) CRYPTOBJDIR= ${.CURDIR:H:H}/lib/libcrypt/obj .else CRYPTOBJDIR= ${.CURDIR:H:H}/lib/libcrypt .endif -.if ${MK_OPENSSH} != "no" -SSHDIR= ${SRCTOP}/crypto/openssh -.endif - WARNS?= 0 diff --git a/secure/lib/libssh/Makefile b/secure/lib/libssh/Makefile index aa3dc27fb526..b7a6ba61700e 100644 --- a/secure/lib/libssh/Makefile +++ b/secure/lib/libssh/Makefile @@ -1,6 +1,7 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" LIB= ssh PRIVATELIB= true @@ -45,9 +46,6 @@ SRCS+= getrrsetbyname-ldns.c LIBADD+= ldns .endif -CFLAGS+= -I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h - .if ${MK_GSSAPI} != "no" && ${MK_KERBEROS_SUPPORT} != "no" CFLAGS+= -include krb5_config.h SRCS+= krb5_config.h diff --git a/secure/libexec/sftp-server/Makefile b/secure/libexec/sftp-server/Makefile index 24d675e0cf16..97408d332d34 100644 --- a/secure/libexec/sftp-server/Makefile +++ b/secure/libexec/sftp-server/Makefile @@ -1,12 +1,11 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" PROG= sftp-server SRCS= sftp-server.c sftp-common.c sftp-server-main.c MAN= sftp-server.8 -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h LIBADD= ssh diff --git a/secure/libexec/ssh-keysign/Makefile b/secure/libexec/ssh-keysign/Makefile index e3fc51c66432..72acf1c2d75e 100644 --- a/secure/libexec/ssh-keysign/Makefile +++ b/secure/libexec/ssh-keysign/Makefile @@ -1,12 +1,11 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" PROG= ssh-keysign SRCS= ssh-keysign.c readconf.c uidswap.c MAN= ssh-keysign.8 -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h BINMODE=4555 LIBADD= ssh diff --git a/secure/libexec/ssh-pkcs11-helper/Makefile b/secure/libexec/ssh-pkcs11-helper/Makefile index 19e114be935d..c4ae4f503197 100644 --- a/secure/libexec/ssh-pkcs11-helper/Makefile +++ b/secure/libexec/ssh-pkcs11-helper/Makefile @@ -1,12 +1,11 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" PROG= ssh-pkcs11-helper SRCS= ssh-pkcs11.c ssh-pkcs11-helper.c MAN= ssh-pkcs11-helper.8 -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h LIBADD= ssh diff --git a/secure/ssh.mk b/secure/ssh.mk new file mode 100644 index 000000000000..4ab8cd399ae8 --- /dev/null +++ b/secure/ssh.mk @@ -0,0 +1,6 @@ +# Common Make variables for OpenSSH + +SSHDIR= ${SRCTOP}/crypto/openssh + +CFLAGS+= -I${SSHDIR} -include ssh_namespace.h +SRCS+= ssh_namespace.h diff --git a/secure/usr.bin/scp/Makefile b/secure/usr.bin/scp/Makefile index 34469a443287..34caf79cf8bd 100644 --- a/secure/usr.bin/scp/Makefile +++ b/secure/usr.bin/scp/Makefile @@ -1,12 +1,11 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" PROG= scp SRCS= scp.c PACKAGE= ssh -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h LIBADD= ssh diff --git a/secure/usr.bin/sftp/Makefile b/secure/usr.bin/sftp/Makefile index 249fef233d37..868f7a23bfde 100644 --- a/secure/usr.bin/sftp/Makefile +++ b/secure/usr.bin/sftp/Makefile @@ -1,12 +1,11 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" PROG= sftp SRCS= sftp.c sftp-client.c sftp-common.c sftp-glob.c progressmeter.c PACKAGE= ssh -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h LIBADD= ssh edit diff --git a/secure/usr.bin/ssh-add/Makefile b/secure/usr.bin/ssh-add/Makefile index acce73d3841d..173b46c78e0d 100644 --- a/secure/usr.bin/ssh-add/Makefile +++ b/secure/usr.bin/ssh-add/Makefile @@ -1,12 +1,11 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" PROG= ssh-add SRCS+= ssh-add.c PACKAGE= ssh -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h LIBADD= ssh diff --git a/secure/usr.bin/ssh-agent/Makefile b/secure/usr.bin/ssh-agent/Makefile index 95ccd05811fe..c8139ec376c3 100644 --- a/secure/usr.bin/ssh-agent/Makefile +++ b/secure/usr.bin/ssh-agent/Makefile @@ -1,12 +1,11 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" PROG= ssh-agent SRCS= ssh-agent.c PACKAGE= ssh -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h LIBADD= ssh diff --git a/secure/usr.bin/ssh-keygen/Makefile b/secure/usr.bin/ssh-keygen/Makefile index d6b5616dfc0a..e32a6b84302f 100644 --- a/secure/usr.bin/ssh-keygen/Makefile +++ b/secure/usr.bin/ssh-keygen/Makefile @@ -1,12 +1,11 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" PROG= ssh-keygen SRCS= ssh-keygen.c PACKAGE= ssh -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h LIBADD= ssh diff --git a/secure/usr.bin/ssh-keyscan/Makefile b/secure/usr.bin/ssh-keyscan/Makefile index ade1e4237ff5..130e5f61ec64 100644 --- a/secure/usr.bin/ssh-keyscan/Makefile +++ b/secure/usr.bin/ssh-keyscan/Makefile @@ -1,12 +1,11 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" PROG= ssh-keyscan SRCS= ssh-keyscan.c PACKAGE= ssh -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h LIBADD= ssh diff --git a/secure/usr.bin/ssh/Makefile b/secure/usr.bin/ssh/Makefile index 614cc7627fc5..5528aceed5ee 100644 --- a/secure/usr.bin/ssh/Makefile +++ b/secure/usr.bin/ssh/Makefile @@ -1,6 +1,7 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" CONFS= ssh_config CONFSDIR= /etc/ssh @@ -16,9 +17,6 @@ SRCS= ssh.c readconf.c clientloop.c sshtty.c \ # gss-genr.c really belongs in libssh; see src/secure/lib/libssh/Makefile SRCS+= gss-genr.c -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h - LIBADD= ssh .if ${MK_LDNS} != "no" diff --git a/secure/usr.sbin/sshd/Makefile b/secure/usr.sbin/sshd/Makefile index f5a4d94a62e6..66f4fc248d15 100644 --- a/secure/usr.sbin/sshd/Makefile +++ b/secure/usr.sbin/sshd/Makefile @@ -1,6 +1,7 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" CONFS= moduli sshd_config CONFSDIR= /etc/ssh @@ -25,8 +26,6 @@ PACKAGE= ssh SRCS+= gss-genr.c MAN= sshd.8 sshd_config.5 -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h # Don't rebuild based on moduli.c moduli: .MADE From nobody Tue Nov 9 00:24:52 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 63BFA1848E6C; Tue, 9 Nov 2021 00:24:52 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hp7z82MrLz3FNV; Tue, 9 Nov 2021 00:24:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 31C4C1B510; Tue, 9 Nov 2021 00:24:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1A90Oq0I089879; Tue, 9 Nov 2021 00:24:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A90OquV089878; Tue, 9 Nov 2021 00:24:52 GMT (envelope-from git) Date: Tue, 9 Nov 2021 00:24:52 GMT Message-Id: <202111090024.1A90OquV089878@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 3687d52b52f6 - stable/12 - ssh: move common Makefile boilerplate to a new ssh.mk List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 3687d52b52f6a4cb739bdb0276ebe60d2b59df24 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=3687d52b52f6a4cb739bdb0276ebe60d2b59df24 commit 3687d52b52f6a4cb739bdb0276ebe60d2b59df24 Author: Ed Maste AuthorDate: 2021-11-02 18:48:33 +0000 Commit: Ed Maste CommitDate: 2021-11-08 23:44:18 +0000 ssh: move common Makefile boilerplate to a new ssh.mk This moves SSHDIR and ssh_namespace.h handling to a common location, and will simplify future work such as adding U2F support (D32509). Reviewed by: kevans MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32808 (cherry picked from commit 9d63429fa16352f58037ac2aa6ddc734b25e8331) --- secure/Makefile.inc | 6 ------ secure/lib/libssh/Makefile | 4 +--- secure/libexec/sftp-server/Makefile | 3 +-- secure/libexec/ssh-keysign/Makefile | 3 +-- secure/libexec/ssh-pkcs11-helper/Makefile | 3 +-- secure/ssh.mk | 6 ++++++ secure/usr.bin/scp/Makefile | 3 +-- secure/usr.bin/sftp/Makefile | 3 +-- secure/usr.bin/ssh-add/Makefile | 3 +-- secure/usr.bin/ssh-agent/Makefile | 3 +-- secure/usr.bin/ssh-keygen/Makefile | 3 +-- secure/usr.bin/ssh-keyscan/Makefile | 3 +-- secure/usr.bin/ssh/Makefile | 4 +--- secure/usr.sbin/sshd/Makefile | 3 +-- 14 files changed, 18 insertions(+), 32 deletions(-) diff --git a/secure/Makefile.inc b/secure/Makefile.inc index 6c298be0223f..5de6eed37faf 100644 --- a/secure/Makefile.inc +++ b/secure/Makefile.inc @@ -1,15 +1,9 @@ # $FreeBSD$ -.include - .if exists(${.CURDIR:H:H}/lib/libcrypt/obj) CRYPTOBJDIR= ${.CURDIR:H:H}/lib/libcrypt/obj .else CRYPTOBJDIR= ${.CURDIR:H:H}/lib/libcrypt .endif -.if ${MK_OPENSSH} != "no" -SSHDIR= ${SRCTOP}/crypto/openssh -.endif - WARNS?= 0 diff --git a/secure/lib/libssh/Makefile b/secure/lib/libssh/Makefile index b325fe9d32d4..bc4319e61746 100644 --- a/secure/lib/libssh/Makefile +++ b/secure/lib/libssh/Makefile @@ -1,6 +1,7 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" LIB= ssh PRIVATELIB= true @@ -45,9 +46,6 @@ SRCS+= getrrsetbyname-ldns.c LIBADD+= ldns .endif -CFLAGS+= -I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h - .if ${MK_GSSAPI} != "no" && ${MK_KERBEROS_SUPPORT} != "no" CFLAGS+= -include krb5_config.h SRCS+= krb5_config.h diff --git a/secure/libexec/sftp-server/Makefile b/secure/libexec/sftp-server/Makefile index 24d675e0cf16..97408d332d34 100644 --- a/secure/libexec/sftp-server/Makefile +++ b/secure/libexec/sftp-server/Makefile @@ -1,12 +1,11 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" PROG= sftp-server SRCS= sftp-server.c sftp-common.c sftp-server-main.c MAN= sftp-server.8 -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h LIBADD= ssh diff --git a/secure/libexec/ssh-keysign/Makefile b/secure/libexec/ssh-keysign/Makefile index e3fc51c66432..72acf1c2d75e 100644 --- a/secure/libexec/ssh-keysign/Makefile +++ b/secure/libexec/ssh-keysign/Makefile @@ -1,12 +1,11 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" PROG= ssh-keysign SRCS= ssh-keysign.c readconf.c uidswap.c MAN= ssh-keysign.8 -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h BINMODE=4555 LIBADD= ssh diff --git a/secure/libexec/ssh-pkcs11-helper/Makefile b/secure/libexec/ssh-pkcs11-helper/Makefile index 19e114be935d..c4ae4f503197 100644 --- a/secure/libexec/ssh-pkcs11-helper/Makefile +++ b/secure/libexec/ssh-pkcs11-helper/Makefile @@ -1,12 +1,11 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" PROG= ssh-pkcs11-helper SRCS= ssh-pkcs11.c ssh-pkcs11-helper.c MAN= ssh-pkcs11-helper.8 -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h LIBADD= ssh diff --git a/secure/ssh.mk b/secure/ssh.mk new file mode 100644 index 000000000000..4ab8cd399ae8 --- /dev/null +++ b/secure/ssh.mk @@ -0,0 +1,6 @@ +# Common Make variables for OpenSSH + +SSHDIR= ${SRCTOP}/crypto/openssh + +CFLAGS+= -I${SSHDIR} -include ssh_namespace.h +SRCS+= ssh_namespace.h diff --git a/secure/usr.bin/scp/Makefile b/secure/usr.bin/scp/Makefile index 34469a443287..34caf79cf8bd 100644 --- a/secure/usr.bin/scp/Makefile +++ b/secure/usr.bin/scp/Makefile @@ -1,12 +1,11 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" PROG= scp SRCS= scp.c PACKAGE= ssh -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h LIBADD= ssh diff --git a/secure/usr.bin/sftp/Makefile b/secure/usr.bin/sftp/Makefile index 249fef233d37..868f7a23bfde 100644 --- a/secure/usr.bin/sftp/Makefile +++ b/secure/usr.bin/sftp/Makefile @@ -1,12 +1,11 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" PROG= sftp SRCS= sftp.c sftp-client.c sftp-common.c sftp-glob.c progressmeter.c PACKAGE= ssh -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h LIBADD= ssh edit diff --git a/secure/usr.bin/ssh-add/Makefile b/secure/usr.bin/ssh-add/Makefile index acce73d3841d..173b46c78e0d 100644 --- a/secure/usr.bin/ssh-add/Makefile +++ b/secure/usr.bin/ssh-add/Makefile @@ -1,12 +1,11 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" PROG= ssh-add SRCS+= ssh-add.c PACKAGE= ssh -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h LIBADD= ssh diff --git a/secure/usr.bin/ssh-agent/Makefile b/secure/usr.bin/ssh-agent/Makefile index 50eafa6ba621..d2b28d1c787b 100644 --- a/secure/usr.bin/ssh-agent/Makefile +++ b/secure/usr.bin/ssh-agent/Makefile @@ -1,12 +1,11 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" PROG= ssh-agent SRCS= ssh-agent.c PACKAGE= ssh -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h LIBADD= ssh diff --git a/secure/usr.bin/ssh-keygen/Makefile b/secure/usr.bin/ssh-keygen/Makefile index d6b5616dfc0a..e32a6b84302f 100644 --- a/secure/usr.bin/ssh-keygen/Makefile +++ b/secure/usr.bin/ssh-keygen/Makefile @@ -1,12 +1,11 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" PROG= ssh-keygen SRCS= ssh-keygen.c PACKAGE= ssh -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h LIBADD= ssh diff --git a/secure/usr.bin/ssh-keyscan/Makefile b/secure/usr.bin/ssh-keyscan/Makefile index ade1e4237ff5..130e5f61ec64 100644 --- a/secure/usr.bin/ssh-keyscan/Makefile +++ b/secure/usr.bin/ssh-keyscan/Makefile @@ -1,12 +1,11 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" PROG= ssh-keyscan SRCS= ssh-keyscan.c PACKAGE= ssh -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h LIBADD= ssh diff --git a/secure/usr.bin/ssh/Makefile b/secure/usr.bin/ssh/Makefile index 023fa4a55be9..792360967850 100644 --- a/secure/usr.bin/ssh/Makefile +++ b/secure/usr.bin/ssh/Makefile @@ -1,6 +1,7 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" CONFS= ssh_config CONFSDIR= /etc/ssh @@ -16,9 +17,6 @@ SRCS= ssh.c readconf.c clientloop.c sshtty.c \ # gss-genr.c really belongs in libssh; see src/secure/lib/libssh/Makefile SRCS+= gss-genr.c -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h - LIBADD= ssh .if ${MK_LDNS} != "no" diff --git a/secure/usr.sbin/sshd/Makefile b/secure/usr.sbin/sshd/Makefile index f5a4d94a62e6..66f4fc248d15 100644 --- a/secure/usr.sbin/sshd/Makefile +++ b/secure/usr.sbin/sshd/Makefile @@ -1,6 +1,7 @@ # $FreeBSD$ .include +.include "${SRCTOP}/secure/ssh.mk" CONFS= moduli sshd_config CONFSDIR= /etc/ssh @@ -25,8 +26,6 @@ PACKAGE= ssh SRCS+= gss-genr.c MAN= sshd.8 sshd_config.5 -CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -SRCS+= ssh_namespace.h # Don't rebuild based on moduli.c moduli: .MADE From nobody Tue Nov 9 00:25:14 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7B2C31849158; Tue, 9 Nov 2021 00:25:14 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hp7zZ32cdz3Fg5; Tue, 9 Nov 2021 00:25:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 49C971B706; Tue, 9 Nov 2021 00:25:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1A90PET8090038; Tue, 9 Nov 2021 00:25:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A90PETS090037; Tue, 9 Nov 2021 00:25:14 GMT (envelope-from git) Date: Tue, 9 Nov 2021 00:25:14 GMT Message-Id: <202111090025.1A90PETS090037@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 4cef2da575c5 - stable/12 - openssh: diff reduction against upstream 7.9p1 List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 4cef2da575c5f9b54f301d857455b97b96df2c9f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=4cef2da575c5f9b54f301d857455b97b96df2c9f commit 4cef2da575c5f9b54f301d857455b97b96df2c9f Author: Ed Maste AuthorDate: 2021-09-02 17:38:30 +0000 Commit: Ed Maste CommitDate: 2021-11-08 23:56:32 +0000 openssh: diff reduction against upstream 7.9p1 Clean up whitespace and nonfunctional differences, and unused functions. (cherry picked from commit 6eac665c8126af387a457ee8a08303c6607a6769) --- crypto/openssh/auth2.c | 1 - crypto/openssh/ssh-gss.h | 6 +++--- crypto/openssh/sshbuf-getput-basic.c | 1 - crypto/openssh/sshbuf.h | 8 -------- 4 files changed, 3 insertions(+), 13 deletions(-) diff --git a/crypto/openssh/auth2.c b/crypto/openssh/auth2.c index b03822e5f150..d6eb067245b7 100644 --- a/crypto/openssh/auth2.c +++ b/crypto/openssh/auth2.c @@ -309,7 +309,6 @@ input_userauth_request(int type, u_int32_t seq, struct ssh *ssh) "(%s,%s) -> (%s,%s)", authctxt->user, authctxt->service, user, service); } - /* reset state */ auth2_challenge_stop(ssh); diff --git a/crypto/openssh/ssh-gss.h b/crypto/openssh/ssh-gss.h index 236efa6b23c6..1e2d00e47ff1 100644 --- a/crypto/openssh/ssh-gss.h +++ b/crypto/openssh/ssh-gss.h @@ -29,10 +29,10 @@ #ifdef GSSAPI -#if defined(HAVE_GSSAPI_GSSAPI_H) -#include -#elif defined(HAVE_GSSAPI_H) +#ifdef HAVE_GSSAPI_H #include +#elif defined(HAVE_GSSAPI_GSSAPI_H) +#include #endif #ifdef KRB5 diff --git a/crypto/openssh/sshbuf-getput-basic.c b/crypto/openssh/sshbuf-getput-basic.c index 9092a7eebf97..50648258f48d 100644 --- a/crypto/openssh/sshbuf-getput-basic.c +++ b/crypto/openssh/sshbuf-getput-basic.c @@ -25,7 +25,6 @@ #include #include -#include "xmalloc.h" #include "ssherr.h" #include "sshbuf.h" diff --git a/crypto/openssh/sshbuf.h b/crypto/openssh/sshbuf.h index 87aa1560eabe..a43598cac4de 100644 --- a/crypto/openssh/sshbuf.h +++ b/crypto/openssh/sshbuf.h @@ -176,14 +176,6 @@ int sshbuf_put_u32(struct sshbuf *buf, u_int32_t val); int sshbuf_put_u16(struct sshbuf *buf, u_int16_t val); int sshbuf_put_u8(struct sshbuf *buf, u_char val); -#if defined(__FreeBSD__) && defined(__i386__) -#define sshbuf_get_time(b, vp) sshbuf_get_u32((b), (u_int32_t *)(vp)) -#define sshbuf_put_time(b, v) sshbuf_put_u32((b), (u_int32_t)(v)) -#else -#define sshbuf_get_time(b, vp) sshbuf_get_u64((b), (u_int64_t *)(vp)) -#define sshbuf_put_time(b, v) sshbuf_put_u64((b), (u_int64_t)(v)) -#endif - /* * Functions to extract or store SSH wire encoded strings (u32 len || data) * The "cstring" variants admit no \0 characters in the string contents. From nobody Tue Nov 9 00:25:15 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4F06A1849334; Tue, 9 Nov 2021 00:25:16 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hp7zb5BxXz3FVn; Tue, 9 Nov 2021 00:25:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 765E81B3A7; Tue, 9 Nov 2021 00:25:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1A90PFMK090062; Tue, 9 Nov 2021 00:25:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A90PFs3090061; Tue, 9 Nov 2021 00:25:15 GMT (envelope-from git) Date: Tue, 9 Nov 2021 00:25:15 GMT Message-Id: <202111090025.1A90PFs3090061@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: a471dcbd681e - stable/12 - openssh: restore local change to gssapi include logic List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: a471dcbd681ed59c40f7b7a258b4cd8229168686 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=a471dcbd681ed59c40f7b7a258b4cd8229168686 commit a471dcbd681ed59c40f7b7a258b4cd8229168686 Author: Ed Maste AuthorDate: 2021-09-02 20:43:59 +0000 Commit: Ed Maste CommitDate: 2021-11-08 23:59:37 +0000 openssh: restore local change to gssapi include logic /usr/include/gssapi.h claims that it is deprecated, and gssapi/gssapi.h should be used instead. So, test HAVE_GSSAPI_GSSAPI_H first falling back to HAVE_GSSAPI_H. This will be submitted upstream. Fixes: 6eac665c8126 ("openssh: diff reduction against...") Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31810 (cherry picked from commit 258f5f79bb36e3e6955e7fb149cd2f50265a9ea5) --- crypto/openssh/ssh-gss.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crypto/openssh/ssh-gss.h b/crypto/openssh/ssh-gss.h index 1e2d00e47ff1..887399b6b00a 100644 --- a/crypto/openssh/ssh-gss.h +++ b/crypto/openssh/ssh-gss.h @@ -29,10 +29,10 @@ #ifdef GSSAPI -#ifdef HAVE_GSSAPI_H -#include -#elif defined(HAVE_GSSAPI_GSSAPI_H) +#ifdef HAVE_GSSAPI_GSSAPI_H #include +#elif defined(HAVE_GSSAPI_H) +#include #endif #ifdef KRB5 From nobody Tue Nov 9 00:25:16 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id F0ED91848FF9; Tue, 9 Nov 2021 00:25:16 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hp7zc6D8vz3Fdk; Tue, 9 Nov 2021 00:25:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9D0AD1B3A8; Tue, 9 Nov 2021 00:25:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1A90PGiL090091; Tue, 9 Nov 2021 00:25:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A90PGol090089; Tue, 9 Nov 2021 00:25:16 GMT (envelope-from git) Date: Tue, 9 Nov 2021 00:25:16 GMT Message-Id: <202111090025.1A90PGol090089@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: e644c87aa25c - stable/12 - openssh: remove unnecessary $FreeBSD$ tags List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: e644c87aa25cffb67729abf929638cc7894e66e4 Auto-Submitted: auto-generated X-Spam: Yes X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=e644c87aa25cffb67729abf929638cc7894e66e4 commit e644c87aa25cffb67729abf929638cc7894e66e4 Author: Ed Maste AuthorDate: 2021-09-08 01:48:15 +0000 Commit: Ed Maste CommitDate: 2021-11-09 00:00:44 +0000 openssh: remove unnecessary $FreeBSD$ tags Diff reduction against upstream: remove $FreeBSD$ tags from files where the tag itself is the only difference from upstream. (cherry picked from commit 0e642632e64a8b8ca740ce3307abe116c990e0b6) --- crypto/openssh/mux.c | 1 - crypto/openssh/sftp-common.c | 1 - 2 files changed, 2 deletions(-) diff --git a/crypto/openssh/mux.c b/crypto/openssh/mux.c index d035fbe75f74..8e4b60827fc8 100644 --- a/crypto/openssh/mux.c +++ b/crypto/openssh/mux.c @@ -18,7 +18,6 @@ /* ssh session multiplexing support */ #include "includes.h" -__RCSID("$FreeBSD$"); #include #include diff --git a/crypto/openssh/sftp-common.c b/crypto/openssh/sftp-common.c index 3d6681467ffd..5d743d3b2b12 100644 --- a/crypto/openssh/sftp-common.c +++ b/crypto/openssh/sftp-common.c @@ -25,7 +25,6 @@ */ #include "includes.h" -__RCSID("$FreeBSD$"); #include #include From nobody Tue Nov 9 01:15:03 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B9B7E1820E66; Tue, 9 Nov 2021 01:15:06 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from omta002.cacentral1.a.cloudfilter.net (omta002.cacentral1.a.cloudfilter.net [3.97.99.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hp9563w9Dz3m4b; Tue, 9 Nov 2021 01:15:06 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from shw-obgw-4004a.ext.cloudfilter.net ([10.228.9.227]) by cmsmtp with ESMTP id k4w8m5QCaps7PkFj7mXaX6; Tue, 09 Nov 2021 01:15:05 +0000 Received: from spqr.komquats.com ([70.66.148.124]) by cmsmtp with ESMTPA id kFj6mHkRU1ykvkFj7me5lB; Tue, 09 Nov 2021 01:15:05 +0000 X-Authority-Analysis: v=2.4 cv=DLqcXgBb c=1 sm=1 tr=0 ts=6189cb99 a=Cwc3rblV8FOMdVN/wOAqyQ==:117 a=Cwc3rblV8FOMdVN/wOAqyQ==:17 a=kj9zAlcOel0A:10 a=vIxV3rELxO4A:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=xbaXX6n7seQtcWxjvTEA:9 a=CjuIK1q_8ugA:10 a=vRcdKC0ogzYA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 2779A4FC; Mon, 8 Nov 2021 17:15:03 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 1A91F3na007697; Mon, 8 Nov 2021 17:15:03 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202111090115.1A91F3na007697@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Ed Maste cc: Cy Schubert , src-committers , "" , dev-commits-src-branches@freebsd.org Subject: Re: git: ef1134110e80 - stable/13 - wpa: Fix WITHOUT_CRYPT build In-reply-to: References: <202111041832.1A4IWExb004128@gitrepo.freebsd.org> Comments: In-reply-to Ed Maste message dated "Mon, 08 Nov 2021 14:38:38 -0500." List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 08 Nov 2021 17:15:03 -0800 X-CMAE-Envelope: MS4xfCwVWltofDg/9/0kZ8s55E5O5tJJNBJXU5pUWTrCiWV0HD5ldshJihJ0iBiknpqxGw9PvTmnJeQwK1wpl+5Qw38d2uUr2yj9qR7fxbf1iMsEYB6tE26M hGiA1CCN5KX38kgakjNQomtCyVte/lRjfDKgp/5PFs2WCqgjSeujHE4PDbZczqJF0UeOOaFDYCtdUcB8COtHq55GPlvxLcuVyTiMIJqHb4zZEKm72bGIVGPP VIxYiyjFfTfsPdaoAspbi/RF+ehCIS+NIjtsjadaChL6g1TRGepQFo0qrliRudhHwTG/WtSM/1HNSrKJOwrwNpb81gFFLoL5MLVas2D1EBNC43O+fxYUkOaX wHpQn3RD X-Rspamd-Queue-Id: 4Hp9563w9Dz3m4b X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N In message , Ed Maste writes: > On Thu, 4 Nov 2021 at 14:32, Cy Schubert wrote: > > > > The branch stable/13 has been updated by cy: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=ef1134110e80fe31792d01758b055a > 4bbec7de69 > > > > commit ef1134110e80fe31792d01758b055a4bbec7de69 > > Author: Cy Schubert > > AuthorDate: 2021-10-28 23:55:48 +0000 > > Commit: Cy Schubert > > CommitDate: 2021-11-04 18:30:25 +0000 > > > > wpa: Fix WITHOUT_CRYPT build > > > > PASN requires CRYPT and when built WITHOUT_CRYPT buildworld > > fails. Only enable PASN when MK_CRYPT is enabled (default). > > > > PR: 259517 > > Do we need to guard the build of pasn_supplicant.c by MK_CRYPT as well? > > My WITHOUT_CRYPT Cirrus-CI build failed with: > > --- pasn_supplicant.o --- > /tmp/cirrus-ci-build/contrib/wpa//wpa_supplicant/pasn_supplicant.c:588:35: > error: no member named 'pasn' in 'struct wpa_supplicant' > struct wpas_pasn *pasn = &wpa_s->pasn; > ~~~~~ ^ Possibly. I'll look at that too as I'm working though part of the options survey just posted. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. From nobody Tue Nov 9 02:30:04 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C9A631842F53; Tue, 9 Nov 2021 02:30:06 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from omta002.cacentral1.a.cloudfilter.net (omta002.cacentral1.a.cloudfilter.net [3.97.99.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HpBlf4JYCz4fKc; Tue, 9 Nov 2021 02:30:06 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from shw-obgw-4002a.ext.cloudfilter.net ([10.228.9.250]) by cmsmtp with ESMTP id kBfGm5t74ps7PkGtimXo4i; Tue, 09 Nov 2021 02:30:06 +0000 Received: from spqr.komquats.com ([70.66.148.124]) by cmsmtp with ESMTPA id kGtgmgFzW49dpkGthmRiXX; Tue, 09 Nov 2021 02:30:06 +0000 X-Authority-Analysis: v=2.4 cv=RqTWkQqK c=1 sm=1 tr=0 ts=6189dd2e a=Cwc3rblV8FOMdVN/wOAqyQ==:117 a=Cwc3rblV8FOMdVN/wOAqyQ==:17 a=kj9zAlcOel0A:10 a=vIxV3rELxO4A:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=xbaXX6n7seQtcWxjvTEA:9 a=CjuIK1q_8ugA:10 a=vRcdKC0ogzYA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 452FE725; Mon, 8 Nov 2021 18:30:04 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 1A92U4Xj008873; Mon, 8 Nov 2021 18:30:04 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202111090230.1A92U4Xj008873@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Ed Maste cc: Cy Schubert , src-committers , "" , dev-commits-src-branches@freebsd.org Subject: Re: git: ef1134110e80 - stable/13 - wpa: Fix WITHOUT_CRYPT build In-reply-to: References: <202111041832.1A4IWExb004128@gitrepo.freebsd.org> Comments: In-reply-to Ed Maste message dated "Mon, 08 Nov 2021 14:38:38 -0500." List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 08 Nov 2021 18:30:04 -0800 X-CMAE-Envelope: MS4xfKUIMFZWCvq8fxlEov6LrLhS9zDxekf3YWasttTSV9Kj6E4GLxKwAuFscbaz3M9QYj41FlurcOG+dfVK2WJQ4F+YeYObnrcA3IkmFL09jxereAs5XhAf RIh9T8c8BG+l7hIZnA2budrke3peycmRJh7eDb0t9rFQ5itsKANDxhX11bzIqueE6ZL0UstPW6YXCZxWldcAcGmmAECJAs98c0q5aZCeWenOjtejeXOgqg+Q ubmUuOb6nJY/6cm4uD5AuMBtPYuJrYOriUULko1VOoxUB4386Z8IFzdvam+UT9yPEX5D6B2JGOsrFvv15I8kfLbnPJnQzkjZsl436CDR5nvYO/XHqoJgwTE/ 3gZmcOwV X-Rspamd-Queue-Id: 4HpBlf4JYCz4fKc X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N In message , Ed Maste writes: > On Thu, 4 Nov 2021 at 14:32, Cy Schubert wrote: > > > > The branch stable/13 has been updated by cy: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=ef1134110e80fe31792d01758b055a > 4bbec7de69 > > > > commit ef1134110e80fe31792d01758b055a4bbec7de69 > > Author: Cy Schubert > > AuthorDate: 2021-10-28 23:55:48 +0000 > > Commit: Cy Schubert > > CommitDate: 2021-11-04 18:30:25 +0000 > > > > wpa: Fix WITHOUT_CRYPT build > > > > PASN requires CRYPT and when built WITHOUT_CRYPT buildworld > > fails. Only enable PASN when MK_CRYPT is enabled (default). > > > > PR: 259517 > > Do we need to guard the build of pasn_supplicant.c by MK_CRYPT as well? > > My WITHOUT_CRYPT Cirrus-CI build failed with: > > --- pasn_supplicant.o --- > /tmp/cirrus-ci-build/contrib/wpa//wpa_supplicant/pasn_supplicant.c:588:35: > error: no member named 'pasn' in 'struct wpa_supplicant' > struct wpas_pasn *pasn = &wpa_s->pasn; > ~~~~~ ^ Let me know if this fixes it (as the build failed in tests/ktls). diff --git a/usr.sbin/wpa/wpa_supplicant/Makefile b/usr.sbin/wpa/wpa_supplic ant/Makefile index 8e7edfcf7720..fdb9f2594e2d 100644 --- a/usr.sbin/wpa/wpa_supplicant/Makefile +++ b/usr.sbin/wpa/wpa_supplicant/Makefile @@ -27,7 +27,6 @@ SRCS= bss.c \ notify.c \ op_classes.c \ offchannel.c \ - pasn_supplicant.c \ robust_av.c \ rrm.c \ scan.c \ @@ -37,6 +36,10 @@ SRCS= bss.c \ wpa_supplicant.c \ wpas_glue.c +.if ${MK_CRYPT} != "no" +SRCS+= pasn_supplicant.c +.endif + MAN= wpa_supplicant.8 wpa_supplicant.conf.5 .if ${MK_EXAMPLES} != "no" -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. From nobody Tue Nov 9 04:49:47 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 375471841453; Tue, 9 Nov 2021 04:49:48 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HpFrr13x3z3ty3; Tue, 9 Nov 2021 04:49:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 04AE51ED1B; Tue, 9 Nov 2021 04:49:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1A94nlMw036860; Tue, 9 Nov 2021 04:49:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A94nlZW036859; Tue, 9 Nov 2021 04:49:47 GMT (envelope-from git) Date: Tue, 9 Nov 2021 04:49:47 GMT Message-Id: <202111090449.1A94nlZW036859@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 514a095250b1 - stable/13 - rtld: fix dangerous_ld_env calculation for ld_dynamic_weak List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 514a095250b178ad81319bf8c30938c3f08dd16f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=514a095250b178ad81319bf8c30938c3f08dd16f commit 514a095250b178ad81319bf8c30938c3f08dd16f Author: Konstantin Belousov AuthorDate: 2021-11-06 03:00:52 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-09 04:49:26 +0000 rtld: fix dangerous_ld_env calculation for ld_dynamic_weak (cherry picked from commit 8363963a8f3fc8226b1e3aa627e2fdd09688704e) --- libexec/rtld-elf/rtld.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 05afe5f42c3e..5a8e4f6bbc96 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -726,7 +726,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp) } dangerous_ld_env = libmap_disable || libmap_override != NULL || ld_library_path != NULL || ld_preload != NULL || - ld_elf_hints_path != NULL || ld_loadfltr || ld_dynamic_weak; + ld_elf_hints_path != NULL || ld_loadfltr || !ld_dynamic_weak; ld_tracing = ld_get_env_var(LD_TRACE_LOADED_OBJECTS); ld_utrace = ld_get_env_var(LD_UTRACE); From nobody Tue Nov 9 13:46:18 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 25A9318555E6; Tue, 9 Nov 2021 13:46:19 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HpTlv0YTdz3mVS; Tue, 9 Nov 2021 13:46:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E390B25F08; Tue, 9 Nov 2021 13:46:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1A9DkIOk053043; Tue, 9 Nov 2021 13:46:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A9DkIEO053042; Tue, 9 Nov 2021 13:46:18 GMT (envelope-from git) Date: Tue, 9 Nov 2021 13:46:18 GMT Message-Id: <202111091346.1A9DkIEO053042@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 97767e201286 - stable/13 - arm: fix a typo in nvidia/drm2/tegra_bo.c List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 97767e201286193860c5a7ec699171da51580024 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=97767e201286193860c5a7ec699171da51580024 commit 97767e201286193860c5a7ec699171da51580024 Author: Mateusz Guzik AuthorDate: 2021-10-25 18:42:10 +0000 Commit: Mark Johnston CommitDate: 2021-11-09 13:46:01 +0000 arm: fix a typo in nvidia/drm2/tegra_bo.c Unbreaks building TEGRA124 Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit e2493f4912cabd1d04be88fd17139a64bf2a2622) --- sys/arm/nvidia/drm2/tegra_bo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm/nvidia/drm2/tegra_bo.c b/sys/arm/nvidia/drm2/tegra_bo.c index be5177973f4f..ba614d014564 100644 --- a/sys/arm/nvidia/drm2/tegra_bo.c +++ b/sys/arm/nvidia/drm2/tegra_bo.c @@ -105,7 +105,7 @@ tegra_bo_alloc_contig(size_t npages, u_long alignment, vm_memattr_t memattr, boundary = 0; tries = 0; retry: - m = vm_page_alloc_noobj_contig(VM_ALLOC_WIRE | VM_ALLOC_ZERO, npages, + m = vm_page_alloc_noobj_contig(VM_ALLOC_WIRED | VM_ALLOC_ZERO, npages, low, high, alignment, boundary, memattr); if (m == NULL) { if (tries < 3) { From nobody Tue Nov 9 23:23:11 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4FDD118497E6; Tue, 9 Nov 2021 23:23:11 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HpkYW1lfnz3tym; Tue, 9 Nov 2021 23:23:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1CF955E52; Tue, 9 Nov 2021 23:23:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1A9NNB2C027436; Tue, 9 Nov 2021 23:23:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A9NNBNT027435; Tue, 9 Nov 2021 23:23:11 GMT (envelope-from git) Date: Tue, 9 Nov 2021 23:23:11 GMT Message-Id: <202111092323.1A9NNBNT027435@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 611423faf7a1 - stable/13 - nfscl: Add a missing delegation lock release List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 611423faf7a1316cc56209cf99ae9a6d2aa9fad5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=611423faf7a1316cc56209cf99ae9a6d2aa9fad5 commit 611423faf7a1316cc56209cf99ae9a6d2aa9fad5 Author: Rick Macklem AuthorDate: 2021-10-26 02:09:14 +0000 Commit: Rick Macklem CommitDate: 2021-11-09 23:20:00 +0000 nfscl: Add a missing delegation lock release There was a case in nfscl_doiods() where the function would return without releasing the delegation shared lock, if it was aquired by the call to nfscl_getstateid(). This patch adds that release. I have never observed a failure due to this missing release, so I do not know if it ever happens in practice. However, since the pNFS client is not yet heavily used, it might be the case. Found by code inspection during a recent NFSv4 IETF working group testing event. (cherry picked from commit 23024f004a4c5659bfcb0b08fac2211ae925ee58) --- sys/fs/nfsclient/nfs_clrpcops.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index 30b68b1dcb1b..94f7496378c5 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -5799,6 +5799,8 @@ nfscl_doiods(vnode_t vp, struct uio *uiop, int *iomode, int *must_commit, if (layp == NULL || rflp == NULL) { if (recalled != 0) { NFSFREECRED(newcred); + if (lckp != NULL) + nfscl_lockderef(lckp); nfscl_relref(nmp); return (EIO); } From nobody Tue Nov 9 23:26:57 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B0B17184CF5C; Tue, 9 Nov 2021 23:26:57 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hpkds4cBBz4RNs; Tue, 9 Nov 2021 23:26:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7DB715CBE; Tue, 9 Nov 2021 23:26:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1A9NQveB027795; Tue, 9 Nov 2021 23:26:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A9NQvZh027794; Tue, 9 Nov 2021 23:26:57 GMT (envelope-from git) Date: Tue, 9 Nov 2021 23:26:57 GMT Message-Id: <202111092326.1A9NQvZh027794@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 1a27b987f298 - stable/12 - nfscl: Add a missing delegation lock release List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 1a27b987f29806c6b600a61deceb65d30c6049f5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=1a27b987f29806c6b600a61deceb65d30c6049f5 commit 1a27b987f29806c6b600a61deceb65d30c6049f5 Author: Rick Macklem AuthorDate: 2021-10-26 02:09:14 +0000 Commit: Rick Macklem CommitDate: 2021-11-09 23:24:01 +0000 nfscl: Add a missing delegation lock release There was a case in nfscl_doiods() where the function would return without releasing the delegation shared lock, if it was aquired by the call to nfscl_getstateid(). This patch adds that release. I have never observed a failure due to this missing release, so I do not know if it ever happens in practice. However, since the pNFS client is not yet heavily used, it might be the case. Found by code inspection during a recent NFSv4 IETF working group testing event. (cherry picked from commit 23024f004a4c5659bfcb0b08fac2211ae925ee58) --- sys/fs/nfsclient/nfs_clrpcops.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index 3d26a1dfda88..50f26a5d70c3 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -5672,6 +5672,8 @@ nfscl_doiods(vnode_t vp, struct uio *uiop, int *iomode, int *must_commit, if (layp == NULL || rflp == NULL) { if (recalled != 0) { NFSFREECRED(newcred); + if (lckp != NULL) + nfscl_lockderef(lckp); nfscl_relref(nmp); return (EIO); } From nobody Wed Nov 10 14:23:06 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0AE3818498F7; Wed, 10 Nov 2021 14:23:07 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hq6Wt6NPrz3qKK; Wed, 10 Nov 2021 14:23:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B21151A36E; Wed, 10 Nov 2021 14:23:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AAEN6GX026141; Wed, 10 Nov 2021 14:23:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AAEN6Q6026140; Wed, 10 Nov 2021 14:23:06 GMT (envelope-from git) Date: Wed, 10 Nov 2021 14:23:06 GMT Message-Id: <202111101423.1AAEN6Q6026140@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 8b1c0ba41168 - stable/13 - scsi_cd: Improve TOC access validation List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8b1c0ba41168dfda015f58fc1f3d28208a0e9c66 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=8b1c0ba41168dfda015f58fc1f3d28208a0e9c66 commit 8b1c0ba41168dfda015f58fc1f3d28208a0e9c66 Author: Mark Johnston AuthorDate: 2021-11-03 19:09:17 +0000 Commit: Mark Johnston CommitDate: 2021-11-10 14:22:39 +0000 scsi_cd: Improve TOC access validation 1. During CD probing, we read the TOC header to find the number of entries, then read the TOC itself. The header determines the number of entries, which determines the amount of data to read from the device into the softc in the CD_STATE_MEDIA_TOC_FULL state. We hard-code a limit of 99 tracks (plus one for the lead-out) in the softc, but were not validating that the size reported by the media would fit in this hard-coded limit. Kernel memory corruption could occur if not.[1] Add validation to check this, and refuse to cache the TOC if it would not fit. 2. The CDIOCPLAYTRACKS ioctl uses caller provided track numbers to index into the TOC, but we only validate the starting index. Add validation of the ending index. Also, raise the hard-coded limit from 100 tracks to 170, per a suggestion from Ken. Reported by: C Turt [1] Reviewed by: ken, avg Sponsored by: The FreeBSD Foundation (cherry picked from commit 6afabf00920fb8d41b8f013090f282c17c117efc) --- sys/cam/scsi/scsi_cd.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c index ee59da3e53c9..0c7068bf287e 100644 --- a/sys/cam/scsi/scsi_cd.c +++ b/sys/cam/scsi/scsi_cd.c @@ -136,9 +136,13 @@ typedef enum { #define ccb_state ppriv_field0 #define ccb_bp ppriv_ptr1 +/* + * According to the MMC-6 spec, 6.25.3.2.11, the lead-out is reported by + * READ_TOC as logical track 170, so at most 169 tracks may be reported. + */ struct cd_tocdata { struct ioc_toc_header header; - struct cd_toc_entry entries[100]; + struct cd_toc_entry entries[170]; }; struct cd_toc_single { @@ -1596,12 +1600,13 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) } /* Number of TOC entries, plus leadout */ - num_entries = (toch->ending_track - toch->starting_track) + 2; - cdindex = toch->starting_track + num_entries -1; + num_entries = toch->ending_track - toch->starting_track + 2; + cdindex = toch->starting_track + num_entries - 1; if ((done_ccb->ccb_h.ccb_state & CD_CCB_TYPE_MASK) == CD_CCB_MEDIA_TOC_HDR) { - if (num_entries <= 0) { + if (num_entries <= 0 || + num_entries > nitems(softc->toc.entries)) { softc->flags &= ~CD_FLAG_VALID_TOC; bzero(&softc->toc, sizeof(softc->toc)); /* @@ -1838,23 +1843,19 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int flag, struct thread *td) */ if (softc->flags & CD_FLAG_VALID_TOC) { union msf_lba *sentry, *eentry; + struct ioc_toc_header *th; int st, et; - if (args->end_track < - softc->toc.header.ending_track + 1) + th = &softc->toc.header; + if (args->end_track < th->ending_track + 1) args->end_track++; - if (args->end_track > - softc->toc.header.ending_track + 1) - args->end_track = - softc->toc.header.ending_track + 1; - st = args->start_track - - softc->toc.header.starting_track; - et = args->end_track - - softc->toc.header.starting_track; - if ((st < 0) - || (et < 0) - || (st > (softc->toc.header.ending_track - - softc->toc.header.starting_track))) { + if (args->end_track > th->ending_track + 1) + args->end_track = th->ending_track + 1; + st = args->start_track - th->starting_track; + et = args->end_track - th->starting_track; + if (st < 0 || et < 0 || + st > th->ending_track - th->starting_track || + et > th->ending_track - th->starting_track) { error = EINVAL; cam_periph_unlock(periph); break; From nobody Wed Nov 10 14:24:27 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3AC6B1849EAB; Wed, 10 Nov 2021 14:24:28 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hq6YS17RVz3qvR; Wed, 10 Nov 2021 14:24:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 06CE81A36F; Wed, 10 Nov 2021 14:24:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AAEORxs026340; Wed, 10 Nov 2021 14:24:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AAEOR01026339; Wed, 10 Nov 2021 14:24:27 GMT (envelope-from git) Date: Wed, 10 Nov 2021 14:24:27 GMT Message-Id: <202111101424.1AAEOR01026339@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: f607b686f9a9 - stable/12 - scsi_cd: Improve TOC access validation List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: f607b686f9a96745e337a8d045f0f51b599a245e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f607b686f9a96745e337a8d045f0f51b599a245e commit f607b686f9a96745e337a8d045f0f51b599a245e Author: Mark Johnston AuthorDate: 2021-11-03 19:09:17 +0000 Commit: Mark Johnston CommitDate: 2021-11-10 14:24:06 +0000 scsi_cd: Improve TOC access validation 1. During CD probing, we read the TOC header to find the number of entries, then read the TOC itself. The header determines the number of entries, which determines the amount of data to read from the device into the softc in the CD_STATE_MEDIA_TOC_FULL state. We hard-code a limit of 99 tracks (plus one for the lead-out) in the softc, but were not validating that the size reported by the media would fit in this hard-coded limit. Kernel memory corruption could occur if not.[1] Add validation to check this, and refuse to cache the TOC if it would not fit. 2. The CDIOCPLAYTRACKS ioctl uses caller provided track numbers to index into the TOC, but we only validate the starting index. Add validation of the ending index. Also, raise the hard-coded limit from 100 tracks to 170, per a suggestion from Ken. Reported by: C Turt [1] Reviewed by: ken, avg Sponsored by: The FreeBSD Foundation (cherry picked from commit 6afabf00920fb8d41b8f013090f282c17c117efc) --- sys/cam/scsi/scsi_cd.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c index 7f22befd3520..4f7cac43a041 100644 --- a/sys/cam/scsi/scsi_cd.c +++ b/sys/cam/scsi/scsi_cd.c @@ -136,9 +136,13 @@ typedef enum { #define ccb_state ppriv_field0 #define ccb_bp ppriv_ptr1 +/* + * According to the MMC-6 spec, 6.25.3.2.11, the lead-out is reported by + * READ_TOC as logical track 170, so at most 169 tracks may be reported. + */ struct cd_tocdata { struct ioc_toc_header header; - struct cd_toc_entry entries[100]; + struct cd_toc_entry entries[170]; }; struct cd_toc_single { @@ -1580,12 +1584,13 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) } /* Number of TOC entries, plus leadout */ - num_entries = (toch->ending_track - toch->starting_track) + 2; - cdindex = toch->starting_track + num_entries -1; + num_entries = toch->ending_track - toch->starting_track + 2; + cdindex = toch->starting_track + num_entries - 1; if ((done_ccb->ccb_h.ccb_state & CD_CCB_TYPE_MASK) == CD_CCB_MEDIA_TOC_HDR) { - if (num_entries <= 0) { + if (num_entries <= 0 || + num_entries > nitems(softc->toc.entries)) { softc->flags &= ~CD_FLAG_VALID_TOC; bzero(&softc->toc, sizeof(softc->toc)); /* @@ -1823,23 +1828,19 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int flag, struct thread *td) */ if (softc->flags & CD_FLAG_VALID_TOC) { union msf_lba *sentry, *eentry; + struct ioc_toc_header *th; int st, et; - if (args->end_track < - softc->toc.header.ending_track + 1) + th = &softc->toc.header; + if (args->end_track < th->ending_track + 1) args->end_track++; - if (args->end_track > - softc->toc.header.ending_track + 1) - args->end_track = - softc->toc.header.ending_track + 1; - st = args->start_track - - softc->toc.header.starting_track; - et = args->end_track - - softc->toc.header.starting_track; - if ((st < 0) - || (et < 0) - || (st > (softc->toc.header.ending_track - - softc->toc.header.starting_track))) { + if (args->end_track > th->ending_track + 1) + args->end_track = th->ending_track + 1; + st = args->start_track - th->starting_track; + et = args->end_track - th->starting_track; + if (st < 0 || et < 0 || + st > th->ending_track - th->starting_track || + et > th->ending_track - th->starting_track) { error = EINVAL; cam_periph_unlock(periph); break; From nobody Wed Nov 10 14:57:31 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 12A5B185B5A7; Wed, 10 Nov 2021 14:57:32 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hq7Hb75Jdz4XCX; Wed, 10 Nov 2021 14:57:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D35A51A849; Wed, 10 Nov 2021 14:57:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AAEvVUn066319; Wed, 10 Nov 2021 14:57:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AAEvVRi066318; Wed, 10 Nov 2021 14:57:31 GMT (envelope-from git) Date: Wed, 10 Nov 2021 14:57:31 GMT Message-Id: <202111101457.1AAEvVRi066318@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: f552d2c115a9 - releng/12.3 - scsi_cd: Improve TOC access validation List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/releng/12.3 X-Git-Reftype: branch X-Git-Commit: f552d2c115a9d334b6e6ff2d0fb0993e4023a3cc Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/12.3 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f552d2c115a9d334b6e6ff2d0fb0993e4023a3cc commit f552d2c115a9d334b6e6ff2d0fb0993e4023a3cc Author: Mark Johnston AuthorDate: 2021-11-03 19:09:17 +0000 Commit: Mark Johnston CommitDate: 2021-11-10 14:57:14 +0000 scsi_cd: Improve TOC access validation 1. During CD probing, we read the TOC header to find the number of entries, then read the TOC itself. The header determines the number of entries, which determines the amount of data to read from the device into the softc in the CD_STATE_MEDIA_TOC_FULL state. We hard-code a limit of 99 tracks (plus one for the lead-out) in the softc, but were not validating that the size reported by the media would fit in this hard-coded limit. Kernel memory corruption could occur if not.[1] Add validation to check this, and refuse to cache the TOC if it would not fit. 2. The CDIOCPLAYTRACKS ioctl uses caller provided track numbers to index into the TOC, but we only validate the starting index. Add validation of the ending index. Also, raise the hard-coded limit from 100 tracks to 170, per a suggestion from Ken. Approved by: re (gjb) Reported by: C Turt [1] Reviewed by: ken, avg Sponsored by: The FreeBSD Foundation (cherry picked from commit 6afabf00920fb8d41b8f013090f282c17c117efc) (cherry picked from commit f607b686f9a96745e337a8d045f0f51b599a245e) --- sys/cam/scsi/scsi_cd.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c index 7f22befd3520..4f7cac43a041 100644 --- a/sys/cam/scsi/scsi_cd.c +++ b/sys/cam/scsi/scsi_cd.c @@ -136,9 +136,13 @@ typedef enum { #define ccb_state ppriv_field0 #define ccb_bp ppriv_ptr1 +/* + * According to the MMC-6 spec, 6.25.3.2.11, the lead-out is reported by + * READ_TOC as logical track 170, so at most 169 tracks may be reported. + */ struct cd_tocdata { struct ioc_toc_header header; - struct cd_toc_entry entries[100]; + struct cd_toc_entry entries[170]; }; struct cd_toc_single { @@ -1580,12 +1584,13 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) } /* Number of TOC entries, plus leadout */ - num_entries = (toch->ending_track - toch->starting_track) + 2; - cdindex = toch->starting_track + num_entries -1; + num_entries = toch->ending_track - toch->starting_track + 2; + cdindex = toch->starting_track + num_entries - 1; if ((done_ccb->ccb_h.ccb_state & CD_CCB_TYPE_MASK) == CD_CCB_MEDIA_TOC_HDR) { - if (num_entries <= 0) { + if (num_entries <= 0 || + num_entries > nitems(softc->toc.entries)) { softc->flags &= ~CD_FLAG_VALID_TOC; bzero(&softc->toc, sizeof(softc->toc)); /* @@ -1823,23 +1828,19 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int flag, struct thread *td) */ if (softc->flags & CD_FLAG_VALID_TOC) { union msf_lba *sentry, *eentry; + struct ioc_toc_header *th; int st, et; - if (args->end_track < - softc->toc.header.ending_track + 1) + th = &softc->toc.header; + if (args->end_track < th->ending_track + 1) args->end_track++; - if (args->end_track > - softc->toc.header.ending_track + 1) - args->end_track = - softc->toc.header.ending_track + 1; - st = args->start_track - - softc->toc.header.starting_track; - et = args->end_track - - softc->toc.header.starting_track; - if ((st < 0) - || (et < 0) - || (st > (softc->toc.header.ending_track - - softc->toc.header.starting_track))) { + if (args->end_track > th->ending_track + 1) + args->end_track = th->ending_track + 1; + st = args->start_track - th->starting_track; + et = args->end_track - th->starting_track; + if (st < 0 || et < 0 || + st > th->ending_track - th->starting_track || + et > th->ending_track - th->starting_track) { error = EINVAL; cam_periph_unlock(periph); break; From nobody Wed Nov 10 19:13:25 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 50BEE18469AF; Wed, 10 Nov 2021 19:13:25 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HqDys1qJ6z564J; Wed, 10 Nov 2021 19:13:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1F12E1DF61; Wed, 10 Nov 2021 19:13:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AAJDPkl014917; Wed, 10 Nov 2021 19:13:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AAJDPx5014916; Wed, 10 Nov 2021 19:13:25 GMT (envelope-from git) Date: Wed, 10 Nov 2021 19:13:25 GMT Message-Id: <202111101913.1AAJDPx5014916@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Guangyuan Yang Subject: git: e8e8c6c2bf32 - stable/13 - powerd(8): Add rc.conf(5) to see also List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ygy X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e8e8c6c2bf3279d2e12f6a89dfbe9452824a3cb3 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by ygy (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=e8e8c6c2bf3279d2e12f6a89dfbe9452824a3cb3 commit e8e8c6c2bf3279d2e12f6a89dfbe9452824a3cb3 Author: Felix Johnson AuthorDate: 2021-11-07 02:39:23 +0000 Commit: Guangyuan Yang CommitDate: 2021-11-10 19:12:59 +0000 powerd(8): Add rc.conf(5) to see also powerd_flags is mentioned in rc.conf(5) and can be set there and pass to powerd. PR: 258320 Reported by: Michael (cherry picked from commit ec071430a7822997619fe6d99853d8f49ea10b20) --- usr.sbin/powerd/powerd.8 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/usr.sbin/powerd/powerd.8 b/usr.sbin/powerd/powerd.8 index eb0d84292207..9c5133f536d7 100644 --- a/usr.sbin/powerd/powerd.8 +++ b/usr.sbin/powerd/powerd.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 3, 2020 +.Dd November 6, 2021 .Dt POWERD 8 .Os .Sh NAME @@ -143,7 +143,8 @@ The default PID file. .Sh SEE ALSO .Xr acpi 4 , .Xr apm 4 , -.Xr cpufreq 4 +.Xr cpufreq 4 , +.Xr rc.conf 5 .Sh HISTORY The .Nm From nobody Wed Nov 10 19:37:06 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A6B5F17ECC2E; Wed, 10 Nov 2021 19:37:06 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HqFVB4GjCz3Hnj; Wed, 10 Nov 2021 19:37:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6E0D61E73B; Wed, 10 Nov 2021 19:37:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AAJb6SM042057; Wed, 10 Nov 2021 19:37:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AAJb6bN042056; Wed, 10 Nov 2021 19:37:06 GMT (envelope-from git) Date: Wed, 10 Nov 2021 19:37:06 GMT Message-Id: <202111101937.1AAJb6bN042056@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 4ac2d43111f0 - stable/13 - Implementations of cexpl() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4ac2d43111f005ea8a326dc30fcf4df522bcf661 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=4ac2d43111f005ea8a326dc30fcf4df522bcf661 commit 4ac2d43111f005ea8a326dc30fcf4df522bcf661 Author: Steve Kargl AuthorDate: 2021-11-05 02:04:01 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-10 19:36:20 +0000 Implementations of cexpl() PR: 216862 (cherry picked from commit 046e2d5db1e8afd2d09ea28e5d2a7550535d4b77) --- include/complex.h | 2 + lib/msun/Makefile | 4 +- lib/msun/Symbol.map | 1 + lib/msun/ld128/s_cexpl.c | 94 +++++++++++++++++++++++++++++++++++++++++ lib/msun/ld80/s_cexpl.c | 107 +++++++++++++++++++++++++++++++++++++++++++++++ lib/msun/man/cexp.3 | 17 +++++--- lib/msun/man/complex.3 | 8 +++- lib/msun/src/k_sincosl.h | 29 +++++++------ lib/msun/src/s_cexp.c | 16 +++++-- lib/msun/src/s_cexpf.c | 11 +++-- lib/msun/src/s_cosl.c | 7 +++- 11 files changed, 265 insertions(+), 31 deletions(-) diff --git a/include/complex.h b/include/complex.h index 892bc55e5145..c31c15d9da4b 100644 --- a/include/complex.h +++ b/include/complex.h @@ -98,6 +98,8 @@ double complex ccosh(double complex); float complex ccoshf(float complex); double complex cexp(double complex); float complex cexpf(float complex); +long double complex + cexpl(long double complex); double cimag(double complex) __pure2; float cimagf(float complex) __pure2; long double cimagl(long double complex) __pure2; diff --git a/lib/msun/Makefile b/lib/msun/Makefile index 1d94e371e61f..d7c0e2f88358 100644 --- a/lib/msun/Makefile +++ b/lib/msun/Makefile @@ -117,7 +117,7 @@ COMMON_SRCS+= catrigl.c \ e_lgammal.c e_lgammal_r.c e_powl.c \ e_remainderl.c e_sinhl.c e_sqrtl.c \ invtrig.c k_cosl.c k_sinl.c k_tanl.c \ - s_asinhl.c s_atanl.c s_cbrtl.c s_ceill.c \ + s_asinhl.c s_atanl.c s_cbrtl.c s_ceill.c s_cexpl.c \ s_clogl.c s_cosl.c s_cospil.c s_cprojl.c \ s_csqrtl.c s_erfl.c s_exp2l.c s_expl.c s_floorl.c s_fmal.c \ s_fmaxl.c s_fminl.c s_frexpl.c s_logbl.c s_logl.c s_nanl.c \ @@ -189,7 +189,7 @@ MLINKS+=ccos.3 ccosf.3 ccos.3 csin.3 ccos.3 csinf.3 ccos.3 ctan.3 ccos.3 ctanf.3 MLINKS+=ccosh.3 ccoshf.3 ccosh.3 csinh.3 ccosh.3 csinhf.3 \ ccosh.3 ctanh.3 ccosh.3 ctanhf.3 MLINKS+=ceil.3 ceilf.3 ceil.3 ceill.3 -MLINKS+=cexp.3 cexpf.3 +MLINKS+=cexp.3 cexpf.3 cexp.3 cexpl.3 MLINKS+=cimag.3 cimagf.3 cimag.3 cimagl.3 \ cimag.3 conj.3 cimag.3 conjf.3 cimag.3 conjl.3 \ cimag.3 cproj.3 cimag.3 cprojf.3 cimag.3 cprojl.3 \ diff --git a/lib/msun/Symbol.map b/lib/msun/Symbol.map index 7229e7ef31fd..8650d56eb9d5 100644 --- a/lib/msun/Symbol.map +++ b/lib/msun/Symbol.map @@ -307,6 +307,7 @@ FBSD_1.5 { /* First added in 14.0-CURRENT */ FBSD_1.7 { + cexpl; cospi; cospif; cospil; diff --git a/lib/msun/ld128/s_cexpl.c b/lib/msun/ld128/s_cexpl.c new file mode 100644 index 000000000000..24f5e3792115 --- /dev/null +++ b/lib/msun/ld128/s_cexpl.c @@ -0,0 +1,94 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Steven G. Kargl + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include "fpmath.h" +#include "math_private.h" +#include "k_expl.h" + +/* XXX cexpl() should be converted to use bits likeo src/s_cexp.c. */ + +static const long double +cexp_ovfl = 2.27892930024498818830197576893019292e+04L, +exp_ovfl = 1.13565234062941439494919310779707649e+04L; + +long double complex +cexpl(long double complex z) +{ + long double c, exp_x, s, x, y; + + x = creall(z); + y = cimagl(z); + + /* cexp(x + I 0) = exp(x) + I 0 */ + if (y == 0) + return (CMPLXL(expl(x), y)); + /* cexp(0 + I y) = cos(y) + I sin(y) */ + if (x == 0) { + sincosl(y, &s, &c); + return (CMPLXL(c, s)); + } + + if (!isfinite(y)) { + if (isfinite(x) || isnan(x)) { + /* cexp(finite|NaN +- I Inf|NaN) = NaN + I NaN */ + return (CMPLXL(y - y, y - y)); + } else if (isinf(x) && copysignl(1.L, x) < 0) { + /* cexp(-Inf +- I Inf|NaN) = 0 + I 0 */ + return (CMPLXL(0.0, 0.0)); + } else { + /* cexp(+Inf +- I Inf|NaN) = Inf + I NaN */ + return (CMPLXL(x, y - y)); + } + } + + if (x > exp_ovfl && x < cexp_ovfl) { + /* + * x is between exp_ovfl and cexp_ovfl, so we must scale to + * avoid overflow in exp(x). + */ + return (__ldexp_cexpl(z, 0)); + } else { + /* + * Cases covered here: + * - x < exp_ovfl and exp(x) won't overflow (common case) + * - x > cexp_ovfl, so exp(x) * s overflows for all s > 0 + * - x = +-Inf (generated by exp()) + * - x = NaN (spurious inexact exception from y) + */ + exp_x = expl(x); + sincosl(y, &s, &c); + return (CMPLXL(exp_x * c, exp_x * s)); + } +} diff --git a/lib/msun/ld80/s_cexpl.c b/lib/msun/ld80/s_cexpl.c new file mode 100644 index 000000000000..5cc35f6d2514 --- /dev/null +++ b/lib/msun/ld80/s_cexpl.c @@ -0,0 +1,107 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2011 David Schultz + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * src/s_cexp.c converted to long double complex by Steven G. Kargl + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#ifdef __i386__ +#include +#endif + +#include "fpmath.h" +#include "math.h" +#include "math_private.h" +#include "k_expl.h" + +long double complex +cexpl (long double complex z) +{ + long double c, exp_x, s, x, y; + uint64_t lx, ly; + uint16_t hx, hy; + + ENTERI(); + + x = creall(z); + y = cimagl(z); + + EXTRACT_LDBL80_WORDS(hy, ly, y); + hy &= 0x7fff; + + /* cexp(x + I 0) = exp(x) + I 0 */ + if ((hy | ly) == 0) + RETURNI(CMPLXL(expl(x), y)); + EXTRACT_LDBL80_WORDS(hx, lx, x); + /* cexp(0 + I y) = cos(y) + I sin(y) */ + if (((hx & 0x7fff) | lx) == 0) { + sincosl(y, &s, &c); + RETURNI(CMPLXL(c, s)); + } + + if (hy >= 0x7fff) { + if ((hx & 0x7fff) < 0x7fff || ((hx & 0x7fff) == 0x7fff && + (lx & 0x7fffffffffffffffULL) != 0)) { + /* cexp(finite|NaN +- I Inf|NaN) = NaN + I NaN */ + RETURNI(CMPLXL(y - y, y - y)); + } else if (hx & 0x8000) { + /* cexp(-Inf +- I Inf|NaN) = 0 + I 0 */ + RETURNI(CMPLXL(0.0, 0.0)); + } else { + /* cexp(+Inf +- I Inf|NaN) = Inf + I NaN */ + RETURNI(CMPLXL(x, y - y)); + } + } + + /* + * exp_ovfl = 11356.5234062941439497 + * cexp_ovfl = 22755.3287906024445633 + */ + if ((hx == 0x400c && lx > 0xb17217f7d1cf79acULL) || + (hx == 0x400d && lx < 0xb1c6a8573de9768cULL)) { + /* + * x is between exp_ovfl and cexp_ovfl, so we must scale to + * avoid overflow in exp(x). + */ + RETURNI(__ldexp_cexpl(z, 0)); + } else { + /* + * Cases covered here: + * - x < exp_ovfl and exp(x) won't overflow (common case) + * - x > cexp_ovfl, so exp(x) * s overflows for all s > 0 + * - x = +-Inf (generated by exp()) + * - x = NaN (spurious inexact exception from y) + */ + exp_x = expl(x); + sincosl(y, &s, &c); + RETURNI(CMPLXL(exp_x * c, exp_x * s)); + } +} diff --git a/lib/msun/man/cexp.3 b/lib/msun/man/cexp.3 index 776e6cee823e..27ab3e9c2098 100644 --- a/lib/msun/man/cexp.3 +++ b/lib/msun/man/cexp.3 @@ -24,12 +24,13 @@ .\" .\" $FreeBSD$ .\" -.Dd March 6, 2011 +.Dd November 3, 2021 .Dt CEXP 3 .Os .Sh NAME .Nm cexp , -.Nm cexpf +.Nm cexpf , +.Nm cexpl .Nd complex exponential functions .Sh LIBRARY .Lb libm @@ -39,11 +40,14 @@ .Fn cexp "double complex z" .Ft float complex .Fn cexpf "float complex z" +.Ft long double complex +.Fn cexpl "long double complex z" .Sh DESCRIPTION The -.Fn cexp +.Fn cexp , +.Fn cexpf , and -.Fn cexpf +.Fn cexpl functions compute the complex exponential of .Fa z , also known as @@ -106,8 +110,9 @@ is not finite, the sign of the result is indeterminate. .Xr math 3 .Sh STANDARDS The -.Fn cexp +.Fn cexp , +.Fn cexpf , and -.Fn cexpf +.Fn cexpl functions conform to .St -isoC-99 . diff --git a/lib/msun/man/complex.3 b/lib/msun/man/complex.3 index f1acfbe6da74..8cc0b7f97c52 100644 --- a/lib/msun/man/complex.3 +++ b/lib/msun/man/complex.3 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 19, 2018 +.Dd November 3, 2021 .Dt COMPLEX 3 .Os .Sh NAME @@ -121,3 +121,9 @@ The .In complex.h functions described here conform to .St -isoC-99 . +.Sh BUGS +The power functions, +.Fn cpowf, cpow , +and +.Fn cpowl , +are implemented, but the code was neither reviewed nor tested. diff --git a/lib/msun/src/k_sincosl.h b/lib/msun/src/k_sincosl.h index 4d4dc69f7820..6425f14a1ea0 100644 --- a/lib/msun/src/k_sincosl.h +++ b/lib/msun/src/k_sincosl.h @@ -76,13 +76,6 @@ __kernel_sincosl(long double x, long double y, int iy, long double *sn, #elif LDBL_MANT_DIG == 113 /* ld128 version of k_sincosl.c. */ static const long double -C1 = 0.04166666666666666666666666666666658424671L, -C2 = -0.001388888888888888888888888888863490893732L, -C3 = 0.00002480158730158730158730158600795304914210L, -C4 = -0.2755731922398589065255474947078934284324e-6L, -C5 = 0.2087675698786809897659225313136400793948e-8L, -C6 = -0.1147074559772972315817149986812031204775e-10L, -C7 = 0.4779477332386808976875457937252120293400e-13L, S1 = -0.16666666666666666666666666666666666606732416116558L, S2 = 0.0083333333333333333333333333333331135404851288270047L, S3 = -0.00019841269841269841269841269839935785325638310428717L, @@ -93,15 +86,25 @@ S7 = -0.76471637318198151807063387954939213287488216303768e-12L, S8 = 0.28114572543451292625024967174638477283187397621303e-14L; static const double -C8 = -0.1561920696721507929516718307820958119868e-15, -C9 = 0.4110317413744594971475941557607804508039e-18, -C10 = -0.8896592467191938803288521958313920156409e-21, -C11 = 0.1601061435794535138244346256065192782581e-23, S9 = -0.82206352458348947812512122163446202498005154296863e-17, S10 = 0.19572940011906109418080609928334380560135358385256e-19, S11 = -0.38680813379701966970673724299207480965452616911420e-22, S12 = 0.64038150078671872796678569586315881020659912139412e-25; +static const long double +C1 = 4.16666666666666666666666666666666667e-02L, +C2 = -1.38888888888888888888888888888888834e-03L, +C3 = 2.48015873015873015873015873015446795e-05L, +C4 = -2.75573192239858906525573190949988493e-07L, +C5 = 2.08767569878680989792098886701451072e-09L, +C6 = -1.14707455977297247136657111139971865e-11L, +C7 = 4.77947733238738518870113294139830239e-14L, +C8 = -1.56192069685858079920640872925306403e-16L, +C9 = 4.11031762320473354032038893429515732e-19L, +C10= -8.89679121027589608738005163931958096e-22L, +C11= 1.61171797801314301767074036661901531e-24L, +C12= -2.46748624357670948912574279501044295e-27L; + static inline void __kernel_sincosl(long double x, long double y, int iy, long double *sn, long double *cs) @@ -120,12 +123,12 @@ __kernel_sincosl(long double x, long double y, int iy, long double *sn, if (iy == 0) *sn = x + v * (S1 + z * r); else - *cs = x - ((z * (y / 2 - v * r) - y) - v * S1); + *sn = x - ((z * (y / 2 - v * r) - y) - v * S1); hz = z / 2; w = 1 - hz; r = z * (C1 + z * (C2 + z * (C3 + z * (C4 + z * (C5 + z * (C6 + - z * (C7 + z * (C8 + z * (C9 + z * (C10 + z * C11)))))))))); + z * (C7 + z * (C8 + z * (C9 + z * (C10 + z * (C11+z*C12))))))))))); *cs = w + (((1 - w) - hz) + (z * r - x * y)); } diff --git a/lib/msun/src/s_cexp.c b/lib/msun/src/s_cexp.c index 2ef8ba1972ca..a1f853eca4cc 100644 --- a/lib/msun/src/s_cexp.c +++ b/lib/msun/src/s_cexp.c @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include "math_private.h" @@ -41,7 +42,7 @@ cexp_ovfl = 0x4096b8e4; /* (MAX_EXP - MIN_DENORM_EXP) * ln2 */ double complex cexp(double complex z) { - double x, y, exp_x; + double c, exp_x, s, x, y; uint32_t hx, hy, lx, ly; x = creal(z); @@ -55,8 +56,10 @@ cexp(double complex z) return (CMPLX(exp(x), y)); EXTRACT_WORDS(hx, lx, x); /* cexp(0 + I y) = cos(y) + I sin(y) */ - if (((hx & 0x7fffffff) | lx) == 0) - return (CMPLX(cos(y), sin(y))); + if (((hx & 0x7fffffff) | lx) == 0) { + sincos(y, &s, &c); + return (CMPLX(c, s)); + } if (hy >= 0x7ff00000) { if (lx != 0 || (hx & 0x7fffffff) != 0x7ff00000) { @@ -86,6 +89,11 @@ cexp(double complex z) * - x = NaN (spurious inexact exception from y) */ exp_x = exp(x); - return (CMPLX(exp_x * cos(y), exp_x * sin(y))); + sincos(y, &s, &c); + return (CMPLX(exp_x * c, exp_x * s)); } } + +#if (LDBL_MANT_DIG == 53) +__weak_reference(cexp, cexpl); +#endif diff --git a/lib/msun/src/s_cexpf.c b/lib/msun/src/s_cexpf.c index b815c99af89f..d905b74ff4bd 100644 --- a/lib/msun/src/s_cexpf.c +++ b/lib/msun/src/s_cexpf.c @@ -41,7 +41,7 @@ cexp_ovfl = 0x43400074; /* (MAX_EXP - MIN_DENORM_EXP) * ln2 */ float complex cexpf(float complex z) { - float x, y, exp_x; + float c, exp_x, s, x, y; uint32_t hx, hy; x = crealf(z); @@ -55,8 +55,10 @@ cexpf(float complex z) return (CMPLXF(expf(x), y)); GET_FLOAT_WORD(hx, x); /* cexp(0 + I y) = cos(y) + I sin(y) */ - if ((hx & 0x7fffffff) == 0) - return (CMPLXF(cosf(y), sinf(y))); + if ((hx & 0x7fffffff) == 0) { + sincosf(y, &s, &c); + return (CMPLXF(c, s)); + } if (hy >= 0x7f800000) { if ((hx & 0x7fffffff) != 0x7f800000) { @@ -86,6 +88,7 @@ cexpf(float complex z) * - x = NaN (spurious inexact exception from y) */ exp_x = expf(x); - return (CMPLXF(exp_x * cosf(y), exp_x * sinf(y))); + sincosf(y, &s, &c); + return (CMPLXF(exp_x * c, exp_x * s)); } } diff --git a/lib/msun/src/s_cosl.c b/lib/msun/src/s_cosl.c index 46a2e8620a22..3d066483f227 100644 --- a/lib/msun/src/s_cosl.c +++ b/lib/msun/src/s_cosl.c @@ -39,12 +39,17 @@ __FBSDID("$FreeBSD$"); #include #endif +#include "fpmath.h" #include "math.h" #include "math_private.h" #if LDBL_MANT_DIG == 64 #include "../ld80/e_rem_pio2l.h" +static const union IEEEl2bits +pio4u = LD80C(0xc90fdaa22168c235, -00001, 7.85398163397448309628e-01L); +#define pio4 (pio4u.e) #elif LDBL_MANT_DIG == 113 #include "../ld128/e_rem_pio2l.h" +long double pio4 = 7.85398163397448309615660845819875721e-1L; #else #error "Unsupported long double format" #endif @@ -71,7 +76,7 @@ cosl(long double x) ENTERI(); /* Optimize the case where x is already within range. */ - if (z.e < M_PI_4) + if (z.e < pio4) RETURNI(__kernel_cosl(z.e, 0)); e0 = __ieee754_rem_pio2l(x, y); From nobody Wed Nov 10 19:37:07 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6A36117ECBE7; Wed, 10 Nov 2021 19:37:08 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HqFVC55Hzz3Hfq; Wed, 10 Nov 2021 19:37:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 867B11E3AA; Wed, 10 Nov 2021 19:37:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AAJb7Uw042081; Wed, 10 Nov 2021 19:37:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AAJb7VK042080; Wed, 10 Nov 2021 19:37:07 GMT (envelope-from git) Date: Wed, 10 Nov 2021 19:37:07 GMT Message-Id: <202111101937.1AAJb7VK042080@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 1d6fd007ebd4 - stable/13 - rtld: ignore fstatfs(2) errors when checking MNT_NOEXEC flag List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1d6fd007ebd4d7d3cf857fa7c4fcf8770102614b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1d6fd007ebd4d7d3cf857fa7c4fcf8770102614b commit 1d6fd007ebd4d7d3cf857fa7c4fcf8770102614b Author: Konstantin Belousov AuthorDate: 2021-11-06 03:06:34 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-10 19:36:20 +0000 rtld: ignore fstatfs(2) errors when checking MNT_NOEXEC flag (cherry picked from commit c5637b8be8a5b6aaf663a58b0027f7f924d78b04) --- libexec/rtld-elf/rtld.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 5a8e4f6bbc96..db89a878c5f9 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -2773,19 +2773,17 @@ do_load_object(int fd, const char *name, char *path, struct stat *sbp, struct statfs fs; /* - * but first, make sure that environment variables haven't been + * First, make sure that environment variables haven't been * used to circumvent the noexec flag on a filesystem. + * We ignore fstatfs(2) failures, since fd might reference + * not a file, e.g. shmfd. */ - if (dangerous_ld_env) { - if (fstatfs(fd, &fs) != 0) { - _rtld_error("Cannot fstatfs \"%s\"", printable_path(path)); - return NULL; - } - if (fs.f_flags & MNT_NOEXEC) { + if (dangerous_ld_env && fstatfs(fd, &fs) == 0 && + (fs.f_flags & MNT_NOEXEC) != 0) { _rtld_error("Cannot execute objects on %s", fs.f_mntonname); - return NULL; - } + return (NULL); } + dbg("loading \"%s\"", printable_path(path)); obj = map_object(fd, printable_path(path), sbp); if (obj == NULL) From nobody Wed Nov 10 19:37:08 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7945717ECD41; Wed, 10 Nov 2021 19:37:10 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HqFVF414Sz3Hyl; Wed, 10 Nov 2021 19:37:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AB78B1E267; Wed, 10 Nov 2021 19:37:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AAJb8bV042105; Wed, 10 Nov 2021 19:37:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AAJb8X7042104; Wed, 10 Nov 2021 19:37:08 GMT (envelope-from git) Date: Wed, 10 Nov 2021 19:37:08 GMT Message-Id: <202111101937.1AAJb8X7042104@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 7647baa1e8f4 - stable/13 - rtld: style adjustments List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7647baa1e8f4870a02737b77f4c27853f3275e2a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7647baa1e8f4870a02737b77f4c27853f3275e2a commit 7647baa1e8f4870a02737b77f4c27853f3275e2a Author: Konstantin Belousov AuthorDate: 2021-11-06 03:20:39 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-10 19:36:20 +0000 rtld: style adjustments (cherry picked from commit 74aec9618fd709513ef2d319598dd82801c29726) --- libexec/rtld-elf/rtld.c | 126 +++++++++++++++++++++++++----------------------- 1 file changed, 65 insertions(+), 61 deletions(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index db89a878c5f9..c173c5a6e22e 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -974,7 +974,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp) /* Return the exit procedure and the program entry point. */ *exit_proc = rtld_exit_ptr; *objp = obj_main; - return (func_ptr_type) obj_main->entry; + return ((func_ptr_type)obj_main->entry); } void * @@ -1035,7 +1035,7 @@ _rtld_bind(Obj_Entry *obj, Elf_Size reloff) */ target = reloc_jmpslot(where, target, defobj, obj, rel); lock_release(rtld_bind_lock, &lockstate); - return target; + return (target); } /* @@ -1092,8 +1092,10 @@ errmsg_restore(struct dlerror_save *saved_msg) static const char * basename(const char *name) { - const char *p = strrchr(name, '/'); - return p != NULL ? p + 1 : name; + const char *p; + + p = strrchr(name, '/'); + return (p != NULL ? p + 1 : name); } static struct utsname uts; @@ -1696,11 +1698,11 @@ digest_phdr(const Elf_Phdr *phdr, int phnum, caddr_t entry, const char *path) } if (nsegs < 1) { _rtld_error("%s: too few PT_LOAD segments", path); - return NULL; + return (NULL); } obj->entry = entry; - return obj; + return (obj); } void @@ -1761,9 +1763,9 @@ dlcheck(void *handle) if (obj == NULL || obj->refcount == 0 || obj->dl_refcount == 0) { _rtld_error("Invalid shared object handle %p", handle); - return NULL; + return (NULL); } - return obj; + return (obj); } /* @@ -1777,7 +1779,7 @@ donelist_check(DoneList *dlp, const Obj_Entry *obj) for (i = 0; i < dlp->num_used; i++) if (dlp->objs[i] == obj) - return true; + return (true); /* * Our donelist allocation should always be sufficient. But if * our threads locking isn't working properly, more shared objects @@ -1786,7 +1788,7 @@ donelist_check(DoneList *dlp, const Obj_Entry *obj) */ if (dlp->num_used < dlp->num_alloc) dlp->objs[dlp->num_used++] = obj; - return false; + return (false); } /* @@ -1806,7 +1808,7 @@ elf_hash(const char *name) h ^= g >> 24; h &= ~g; } - return h; + return (h); } /* @@ -1975,10 +1977,10 @@ find_symdef(unsigned long symnum, const Obj_Entry *refobj, * the cache. */ if (symnum >= refobj->dynsymcount) - return NULL; /* Bad object */ + return (NULL); /* Bad object */ if (cache != NULL && cache[symnum].sym != NULL) { *defobj_out = cache[symnum].obj; - return cache[symnum].sym; + return (cache[symnum].sym); } ref = refobj->symtab + symnum; @@ -2035,7 +2037,7 @@ find_symdef(unsigned long symnum, const Obj_Entry *refobj, _rtld_error("%s: Undefined symbol \"%s%s%s\"", refobj->path, name, ve != NULL ? "@" : "", ve != NULL ? ve->name : ""); } - return def; + return (def); } /* @@ -2736,7 +2738,7 @@ load_object(const char *name, int fd_u, const Obj_Entry *refobj, int flags) _rtld_error("Cannot fstat \"%s\"", printable_path(path)); close(fd); free(path); - return NULL; + return (NULL); } TAILQ_FOREACH(obj, &obj_list, next) { if (obj->marker || obj->doomed) @@ -2748,7 +2750,7 @@ load_object(const char *name, int fd_u, const Obj_Entry *refobj, int flags) object_add_name(obj, name); free(path); close(fd); - return obj; + return (obj); } if (flags & RTLD_LO_NOLOAD) { free(path); @@ -2762,7 +2764,7 @@ load_object(const char *name, int fd_u, const Obj_Entry *refobj, int flags) free(path); close(fd); - return obj; + return (obj); } static Obj_Entry * @@ -2787,7 +2789,7 @@ do_load_object(int fd, const char *name, char *path, struct stat *sbp, dbg("loading \"%s\"", printable_path(path)); obj = map_object(fd, printable_path(path), sbp); if (obj == NULL) - return NULL; + return (NULL); /* * If DT_SONAME is present in the object, digest_dynamic2 already @@ -2847,7 +2849,7 @@ obj_from_addr(const void *addr) if (addr < (void *)(obj->mapbase + obj->mapsize)) return obj; } - return NULL; + return (NULL); } static void @@ -3049,7 +3051,7 @@ objlist_find(Objlist *list, const Obj_Entry *obj) STAILQ_FOREACH(elm, list, link) if (elm->obj == obj) return elm; - return NULL; + return (NULL); } static void @@ -3429,7 +3431,7 @@ search_library_path(const char *name, const char *path, struct try_library_args arg; if (path == NULL) - return NULL; + return (NULL); arg.name = name; arg.namelen = strlen(name); @@ -3530,7 +3532,7 @@ dlclose_locked(void *handle, RtldLockState *lockstate) root = dlcheck(handle); if (root == NULL) - return -1; + return (-1); LD_UTRACE(UTRACE_DLCLOSE_START, handle, NULL, 0, root->dl_refcount, root->path); @@ -3554,7 +3556,7 @@ dlclose_locked(void *handle, RtldLockState *lockstate) unref_dag(root); LD_UTRACE(UTRACE_DLCLOSE_STOP, handle, NULL, 0, 0, NULL); - return 0; + return (0); } char * @@ -3772,7 +3774,7 @@ dlopen_object(const char *name, int fd, Obj_Entry *refobj, int lo_flags, objlist_clear(&initlist); if (lockstate == &mlockstate) lock_release(rtld_bind_lock, lockstate); - return obj; + return (obj); trace: trace_loaded_objects(obj); if (lockstate == &mlockstate) @@ -3811,7 +3813,7 @@ do_dlsym(void *handle, const char *name, void *retaddr, const Ver_Entry *ve, _rtld_error("Cannot determine caller's shared object"); lock_release(rtld_bind_lock, &lockstate); LD_UTRACE(UTRACE_DLSYM_STOP, handle, NULL, 0, 0, name); - return NULL; + return (NULL); } if (handle == NULL) { /* Just the caller's shared object. */ res = symlook_obj(&req, obj); @@ -3864,7 +3866,7 @@ do_dlsym(void *handle, const char *name, void *retaddr, const Ver_Entry *ve, if ((obj = dlcheck(handle)) == NULL) { lock_release(rtld_bind_lock, &lockstate); LD_UTRACE(UTRACE_DLSYM_STOP, handle, NULL, 0, 0, name); - return NULL; + return (NULL); } donelist_init(&donelist); @@ -3924,14 +3926,14 @@ do_dlsym(void *handle, const char *name, void *retaddr, const Ver_Entry *ve, ve != NULL ? ve->name : ""); lock_release(rtld_bind_lock, &lockstate); LD_UTRACE(UTRACE_DLSYM_STOP, handle, NULL, 0, 0, name); - return NULL; + return (NULL); } void * dlsym(void *handle, const char *name) { - return do_dlsym(handle, name, __builtin_return_address(0), NULL, - SYMLOOK_DLSYM); + return (do_dlsym(handle, name, __builtin_return_address(0), NULL, + SYMLOOK_DLSYM)); } dlfunc_t @@ -3956,8 +3958,8 @@ dlvsym(void *handle, const char *name, const char *version) ventry.file = NULL; ventry.hash = elf_hash(version); ventry.flags= 0; - return do_dlsym(handle, name, __builtin_return_address(0), &ventry, - SYMLOOK_DLSYM); + return (do_dlsym(handle, name, __builtin_return_address(0), &ventry, + SYMLOOK_DLSYM)); } int @@ -3992,7 +3994,7 @@ dladdr(const void *addr, Dl_info *info) if (obj == NULL) { _rtld_error("No shared object contains address"); lock_release(rtld_bind_lock, &lockstate); - return 0; + return (0); } info->dli_fname = obj->path; info->dli_fbase = obj->mapbase; @@ -4031,7 +4033,7 @@ dladdr(const void *addr, Dl_info *info) break; } lock_release(rtld_bind_lock, &lockstate); - return 1; + return (1); } int @@ -5258,8 +5260,8 @@ allocate_tls(Obj_Entry *objs, void *oldtls, size_t tcbsize, size_t tcbalign) dtv = xcalloc(tls_max_index + 2, sizeof(Elf_Addr)); segbase = (Elf_Addr)(tls + roundup(tls_static_space, ralign)); - ((Elf_Addr*)segbase)[0] = segbase; - ((Elf_Addr*)segbase)[1] = (Elf_Addr) dtv; + ((Elf_Addr *)segbase)[0] = segbase; + ((Elf_Addr *)segbase)[1] = (Elf_Addr) dtv; dtv[0] = tls_dtv_generation; dtv[1] = tls_max_index; @@ -5270,18 +5272,19 @@ allocate_tls(Obj_Entry *objs, void *oldtls, size_t tcbsize, size_t tcbalign) */ oldsegbase = (Elf_Addr) oldtls; memcpy((void *)(segbase - tls_static_space), - (const void *)(oldsegbase - tls_static_space), - tls_static_space); + (const void *)(oldsegbase - tls_static_space), + tls_static_space); /* * If any dynamic TLS blocks have been created tls_get_addr(), * move them over. */ - olddtv = ((Elf_Addr**)oldsegbase)[1]; + olddtv = ((Elf_Addr **)oldsegbase)[1]; for (i = 0; i < olddtv[1]; i++) { - if (olddtv[i+2] < oldsegbase - size || olddtv[i+2] > oldsegbase) { - dtv[i+2] = olddtv[i+2]; - olddtv[i+2] = 0; + if (olddtv[i + 2] < oldsegbase - size || + olddtv[i + 2] > oldsegbase) { + dtv[i + 2] = olddtv[i + 2]; + olddtv[i + 2] = 0; } } @@ -5289,23 +5292,23 @@ allocate_tls(Obj_Entry *objs, void *oldtls, size_t tcbsize, size_t tcbalign) * We assume that this block was the one we created with * allocate_initial_tls(). */ - free_tls(oldtls, 2*sizeof(Elf_Addr), sizeof(Elf_Addr)); + free_tls(oldtls, 2 * sizeof(Elf_Addr), sizeof(Elf_Addr)); } else { for (obj = objs; obj != NULL; obj = TAILQ_NEXT(obj, next)) { if (obj->marker || obj->tlsoffset == 0) continue; addr = segbase - obj->tlsoffset; - memset((void*)(addr + obj->tlsinitsize), - 0, obj->tlssize - obj->tlsinitsize); + memset((void *)(addr + obj->tlsinitsize), + 0, obj->tlssize - obj->tlsinitsize); if (obj->tlsinit) { - memcpy((void*) addr, obj->tlsinit, obj->tlsinitsize); - obj->static_tls_copied = true; + memcpy((void *)addr, obj->tlsinit, obj->tlsinitsize); + obj->static_tls_copied = true; } dtv[obj->tlsindex + 1] = addr; } } - return (void*) segbase; + return ((void *)segbase); } void @@ -5325,18 +5328,19 @@ free_tls(void *tls, size_t tcbsize __unused, size_t tcbalign) ralign = tls_static_max_align; size = roundup(tls_static_space, ralign); - dtv = ((Elf_Addr**)tls)[1]; + dtv = ((Elf_Addr **)tls)[1]; dtvsize = dtv[1]; - tlsend = (Elf_Addr) tls; + tlsend = (Elf_Addr)tls; tlsstart = tlsend - size; for (i = 0; i < dtvsize; i++) { - if (dtv[i + 2] != 0 && (dtv[i + 2] < tlsstart || dtv[i + 2] > tlsend)) { - free_aligned((void *)dtv[i + 2]); + if (dtv[i + 2] != 0 && (dtv[i + 2] < tlsstart || + dtv[i + 2] > tlsend)) { + free_aligned((void *)dtv[i + 2]); } } free_aligned((void *)tlsstart); - free((void*) dtv); + free((void *)dtv); } #endif /* TLS_VARIANT_II */ @@ -5373,11 +5377,11 @@ allocate_tls_offset(Obj_Entry *obj) size_t off; if (obj->tls_done) - return true; + return (true); if (obj->tlssize == 0) { obj->tls_done = true; - return true; + return (true); } if (tls_last_offset == 0) @@ -5400,7 +5404,7 @@ allocate_tls_offset(Obj_Entry *obj) */ if (tls_static_space != 0) { if (off > tls_static_space) - return false; + return (false); } else if (obj->tlsalign > tls_static_max_align) { tls_static_max_align = obj->tlsalign; } @@ -5409,7 +5413,7 @@ allocate_tls_offset(Obj_Entry *obj) tls_last_size = obj->tlssize; obj->tls_done = true; - return true; + return (true); } void @@ -5490,7 +5494,7 @@ locate_dependency(const Obj_Entry *obj, const char *name) STAILQ_FOREACH(entry, &list_main, link) { if (object_match_name(entry->obj, name)) - return entry->obj; + return (entry->obj); } for (needed = obj->needed; needed != NULL; needed = needed->next) { @@ -5655,7 +5659,7 @@ rtld_verify_object_versions(Obj_Entry *obj) break; vn = (const Elf_Verneed *)((const char *)vn + vn->vn_next); } - return 0; + return (0); } static int @@ -5680,7 +5684,7 @@ rtld_verify_versions(const Objlist *objlist) } if (rc == 0 || ld_tracing != NULL) rc = rtld_verify_object_versions(&obj_rtld); - return rc; + return (rc); } const Ver_Entry * @@ -5694,10 +5698,10 @@ fetch_ventry(const Obj_Entry *obj, unsigned long symnum) _rtld_error("%s: symbol %s has wrong verneed value %d", obj->path, obj->strtab + symnum, vernum); } else if (obj->vertab[vernum].hash != 0) { - return &obj->vertab[vernum]; + return (&obj->vertab[vernum]); } } - return NULL; + return (NULL); } int From nobody Thu Nov 11 00:02:14 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0F6EE184ED79; Thu, 11 Nov 2021 00:02:15 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HqMN66ZzMz4RjB; Thu, 11 Nov 2021 00:02:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C31FA21D35; Thu, 11 Nov 2021 00:02:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AB02E0K002052; Thu, 11 Nov 2021 00:02:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AB02ERF002051; Thu, 11 Nov 2021 00:02:14 GMT (envelope-from git) Date: Thu, 11 Nov 2021 00:02:14 GMT Message-Id: <202111110002.1AB02ERF002051@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Glen Barber Subject: git: 76cbfe08b42d - releng/12.3 - 12.3: update to RC1 List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/releng/12.3 X-Git-Reftype: branch X-Git-Commit: 76cbfe08b42dc27b03eeb929a7df22bef4540c60 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/12.3 has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=76cbfe08b42dc27b03eeb929a7df22bef4540c60 commit 76cbfe08b42dc27b03eeb929a7df22bef4540c60 Author: Glen Barber AuthorDate: 2021-11-11 00:01:38 +0000 Commit: Glen Barber CommitDate: 2021-11-11 00:01:38 +0000 12.3: update to RC1 Approved by: re (implicit) Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/conf/newvers.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 5a8f7e6432c5..b6c4ba9491e6 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -49,7 +49,7 @@ TYPE="FreeBSD" REVISION="12.3" -BRANCH="BETA3" +BRANCH="RC1" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi From nobody Thu Nov 11 00:35:03 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 069A0183E774; Thu, 11 Nov 2021 00:35:04 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HqN5z5VFdz4c9s; Thu, 11 Nov 2021 00:35:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9E1D1226FA; Thu, 11 Nov 2021 00:35:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AB0Z3Pb042578; Thu, 11 Nov 2021 00:35:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AB0Z3Eu042577; Thu, 11 Nov 2021 00:35:03 GMT (envelope-from git) Date: Thu, 11 Nov 2021 00:35:03 GMT Message-Id: <202111110035.1AB0Z3Eu042577@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Guangyuan Yang Subject: git: c702a2897efc - stable/13 - find(1): Update date format reference and remove cvs(1) references List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ygy X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c702a2897efcfef31f2fdfee0e36c7a9a63373ec Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by ygy (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=c702a2897efcfef31f2fdfee0e36c7a9a63373ec commit c702a2897efcfef31f2fdfee0e36c7a9a63373ec Author: Felix Johnson AuthorDate: 2021-11-08 06:14:58 +0000 Commit: Guangyuan Yang CommitDate: 2021-11-11 00:34:15 +0000 find(1): Update date format reference and remove cvs(1) references cvs(1) is not installed by default. Change the date format reference to note that find(1) understands ISO8601 and RFC822 date formats. Also remove references to cvs(1). PR: 254894 Reported by: danielsh@apache.org (cherry picked from commit 52dbe1a0f419b8d45b4beed56b90ff48bc12e14c) --- usr.bin/find/find.1 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/usr.bin/find/find.1 b/usr.bin/find/find.1 index 8bc9f9d69604..72fe3c0bea06 100644 --- a/usr.bin/find/find.1 +++ b/usr.bin/find/find.1 @@ -31,7 +31,7 @@ .\" @(#)find.1 8.7 (Berkeley) 5/9/95 .\" $FreeBSD$ .\" -.Dd May 13, 2021 +.Dd November 8, 2021 .Dt FIND 1 .Os .Sh NAME @@ -659,8 +659,7 @@ In addition, if then .Ar file is instead interpreted as a direct date specification of the form -understood by -.Xr cvs 1 . +understood by ISO8601 or RFC822. Note that .Ic -newermm is equivalent to @@ -1001,7 +1000,6 @@ section below for details. .Sh SEE ALSO .Xr chflags 1 , .Xr chmod 1 , -.Xr cvs 1 , .Xr locate 1 , .Xr lsvfs 1 , .Xr whereis 1 , From nobody Thu Nov 11 16:26:32 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 015BA183A185; Thu, 11 Nov 2021 16:26:33 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HqnCr6ZdGz4Zc8; Thu, 11 Nov 2021 16:26:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BDB367138; Thu, 11 Nov 2021 16:26:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1ABGQWKf007026; Thu, 11 Nov 2021 16:26:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1ABGQWAK007025; Thu, 11 Nov 2021 16:26:32 GMT (envelope-from git) Date: Thu, 11 Nov 2021 16:26:32 GMT Message-Id: <202111111626.1ABGQWAK007025@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 113c2e8977bb - stable/13 - usb_audio: Fix a typo in a source code comment List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 113c2e8977bb5d593c20756e8f0f2650d5e20f3c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=113c2e8977bb5d593c20756e8f0f2650d5e20f3c commit 113c2e8977bb5d593c20756e8f0f2650d5e20f3c Author: Gordon Bergling AuthorDate: 2021-11-07 13:04:26 +0000 Commit: Gordon Bergling CommitDate: 2021-11-11 16:26:19 +0000 usb_audio: Fix a typo in a source code comment - s/maxium/maximum/ (cherry picked from commit 3d6ed119e3fe123b7e18adf8672c45ab81068527) --- sys/dev/sound/usb/uaudio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c index 538e4180f6de..3a7d4189b9ef 100644 --- a/sys/dev/sound/usb/uaudio.c +++ b/sys/dev/sound/usb/uaudio.c @@ -1588,7 +1588,7 @@ uaudio20_check_rate(struct usb_device *udev, uint8_t iface_no, { struct usb_device_request req; usb_error_t error; -#define UAUDIO20_MAX_RATES 32 /* we support at maxium 32 rates */ +#define UAUDIO20_MAX_RATES 32 /* we support at maximum 32 rates */ uint8_t data[2 + UAUDIO20_MAX_RATES * 12]; uint16_t actlen; uint16_t rates; From nobody Thu Nov 11 16:26:52 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3588D183A2D4; Thu, 11 Nov 2021 16:26:53 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HqnDF0rB7z4b2q; Thu, 11 Nov 2021 16:26:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F048970D0; Thu, 11 Nov 2021 16:26:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1ABGQqSW007153; Thu, 11 Nov 2021 16:26:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1ABGQqNo007152; Thu, 11 Nov 2021 16:26:52 GMT (envelope-from git) Date: Thu, 11 Nov 2021 16:26:52 GMT Message-Id: <202111111626.1ABGQqNo007152@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 0729442a85eb - stable/13 - efi(8): Fix a typo in a source code comment List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0729442a85eb7fdcea30ccd16ca94b4ee321a37e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=0729442a85eb7fdcea30ccd16ca94b4ee321a37e commit 0729442a85eb7fdcea30ccd16ca94b4ee321a37e Author: Gordon Bergling AuthorDate: 2021-11-07 13:07:24 +0000 Commit: Gordon Bergling CommitDate: 2021-11-11 16:26:43 +0000 efi(8): Fix a typo in a source code comment - s/writting/writing/ (cherry picked from commit 2b0f6ad444c0ec82facf55c0ee4806c2ba217daa) --- stand/efi/include/efiuga.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stand/efi/include/efiuga.h b/stand/efi/include/efiuga.h index 28c738e7fbc4..00464b7cb4c0 100644 --- a/stand/efi/include/efiuga.h +++ b/stand/efi/include/efiuga.h @@ -139,7 +139,7 @@ typedef enum { @retval EFI_SUCCESS - The Blt operation completed. @retval EFI_INVALID_PARAMETER - BltOperation is not valid. - @retval EFI_DEVICE_ERROR - A hardware error occurred writting to the video buffer. + @retval EFI_DEVICE_ERROR - A hardware error occurred writing to the video buffer. --*/ typedef From nobody Thu Nov 11 16:27:44 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3C795183AA91; Thu, 11 Nov 2021 16:27:45 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HqnFF18dYz4bZJ; Thu, 11 Nov 2021 16:27:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 07D0F7543; Thu, 11 Nov 2021 16:27:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1ABGRiqe007325; Thu, 11 Nov 2021 16:27:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1ABGRixx007324; Thu, 11 Nov 2021 16:27:44 GMT (envelope-from git) Date: Thu, 11 Nov 2021 16:27:44 GMT Message-Id: <202111111627.1ABGRixx007324@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 8be6c438c847 - stable/13 - e1000: Fix a typo in a source code comment List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8be6c438c847a0f5bab03a648887831eefc8cba8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=8be6c438c847a0f5bab03a648887831eefc8cba8 commit 8be6c438c847a0f5bab03a648887831eefc8cba8 Author: Gordon Bergling AuthorDate: 2021-11-07 13:12:23 +0000 Commit: Gordon Bergling CommitDate: 2021-11-11 16:27:31 +0000 e1000: Fix a typo in a source code comment - s/overwritting/overwriting/ (cherry picked from commit e9c7c6f5a021a02c5af2fa446d31cf3756b58d62) --- sys/dev/e1000/e1000_phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/e1000/e1000_phy.c b/sys/dev/e1000/e1000_phy.c index 872a5267bfdb..5c346b2163de 100644 --- a/sys/dev/e1000/e1000_phy.c +++ b/sys/dev/e1000/e1000_phy.c @@ -474,7 +474,7 @@ s32 e1000_write_phy_reg_i2c(struct e1000_hw *hw, u32 offset, u16 data) DEBUGFUNC("e1000_write_phy_reg_i2c"); - /* Prevent overwritting SFP I2C EEPROM which is at A0 address.*/ + /* Prevent overwriting SFP I2C EEPROM which is at A0 address.*/ if ((hw->phy.addr == 0) || (hw->phy.addr > 7)) { DEBUGOUT1("PHY I2C Address %d is out of range.\n", hw->phy.addr); From nobody Thu Nov 11 16:30:21 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7E09F183E29F; Thu, 11 Nov 2021 16:30:21 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HqnJF36sRz4d4P; Thu, 11 Nov 2021 16:30:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 47E1C765C; Thu, 11 Nov 2021 16:30:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1ABGULhB015376; Thu, 11 Nov 2021 16:30:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1ABGULmE015373; Thu, 11 Nov 2021 16:30:21 GMT (envelope-from git) Date: Thu, 11 Nov 2021 16:30:21 GMT Message-Id: <202111111630.1ABGULmE015373@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 8825ad095035 - stable/12 - e1000: Fix a typo in a source code comment List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 8825ad095035fb5e1172e2f9da5fc1165426eec1 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=8825ad095035fb5e1172e2f9da5fc1165426eec1 commit 8825ad095035fb5e1172e2f9da5fc1165426eec1 Author: Gordon Bergling AuthorDate: 2021-11-07 13:12:23 +0000 Commit: Gordon Bergling CommitDate: 2021-11-11 16:29:40 +0000 e1000: Fix a typo in a source code comment - s/overwritting/overwriting/ (cherry picked from commit e9c7c6f5a021a02c5af2fa446d31cf3756b58d62) --- sys/dev/e1000/e1000_phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/e1000/e1000_phy.c b/sys/dev/e1000/e1000_phy.c index 872a5267bfdb..5c346b2163de 100644 --- a/sys/dev/e1000/e1000_phy.c +++ b/sys/dev/e1000/e1000_phy.c @@ -474,7 +474,7 @@ s32 e1000_write_phy_reg_i2c(struct e1000_hw *hw, u32 offset, u16 data) DEBUGFUNC("e1000_write_phy_reg_i2c"); - /* Prevent overwritting SFP I2C EEPROM which is at A0 address.*/ + /* Prevent overwriting SFP I2C EEPROM which is at A0 address.*/ if ((hw->phy.addr == 0) || (hw->phy.addr > 7)) { DEBUGOUT1("PHY I2C Address %d is out of range.\n", hw->phy.addr); From nobody Thu Nov 11 16:36:11 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 856D618412BD; Thu, 11 Nov 2021 16:36:11 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HqnQz2jHfz4ffC; Thu, 11 Nov 2021 16:36:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 365FB7819; Thu, 11 Nov 2021 16:36:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1ABGaBCO020341; Thu, 11 Nov 2021 16:36:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1ABGaBmI020340; Thu, 11 Nov 2021 16:36:11 GMT (envelope-from git) Date: Thu, 11 Nov 2021 16:36:11 GMT Message-Id: <202111111636.1ABGaBmI020340@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 483c5c20172a - stable/12 - efi(8): Fix a typo in a source code comment List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 483c5c20172a1cee26283bfe2db131584a9cfb59 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=483c5c20172a1cee26283bfe2db131584a9cfb59 commit 483c5c20172a1cee26283bfe2db131584a9cfb59 Author: Gordon Bergling AuthorDate: 2021-11-07 13:07:24 +0000 Commit: Gordon Bergling CommitDate: 2021-11-11 16:36:01 +0000 efi(8): Fix a typo in a source code comment - s/writting/writing/ (cherry picked from commit 2b0f6ad444c0ec82facf55c0ee4806c2ba217daa) --- stand/efi/include/efiuga.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stand/efi/include/efiuga.h b/stand/efi/include/efiuga.h index 28c738e7fbc4..00464b7cb4c0 100644 --- a/stand/efi/include/efiuga.h +++ b/stand/efi/include/efiuga.h @@ -139,7 +139,7 @@ typedef enum { @retval EFI_SUCCESS - The Blt operation completed. @retval EFI_INVALID_PARAMETER - BltOperation is not valid. - @retval EFI_DEVICE_ERROR - A hardware error occurred writting to the video buffer. + @retval EFI_DEVICE_ERROR - A hardware error occurred writing to the video buffer. --*/ typedef From nobody Thu Nov 11 16:36:41 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 1ACBD1841DDE; Thu, 11 Nov 2021 16:36:42 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HqnRY3q0rz4gSH; Thu, 11 Nov 2021 16:36:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 532E5779A; Thu, 11 Nov 2021 16:36:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1ABGafq5020486; Thu, 11 Nov 2021 16:36:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1ABGaf6r020485; Thu, 11 Nov 2021 16:36:41 GMT (envelope-from git) Date: Thu, 11 Nov 2021 16:36:41 GMT Message-Id: <202111111636.1ABGaf6r020485@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: fdc24dade710 - stable/12 - usb_audio: Fix a typo in a source code comment List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: fdc24dade71027ec0b3065b4b15bc496a20deb6d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=fdc24dade71027ec0b3065b4b15bc496a20deb6d commit fdc24dade71027ec0b3065b4b15bc496a20deb6d Author: Gordon Bergling AuthorDate: 2021-11-07 13:04:26 +0000 Commit: Gordon Bergling CommitDate: 2021-11-11 16:36:32 +0000 usb_audio: Fix a typo in a source code comment - s/maxium/maximum/ (cherry picked from commit 3d6ed119e3fe123b7e18adf8672c45ab81068527) --- sys/dev/sound/usb/uaudio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c index e2e86fe5df63..221f4d3d1bd7 100644 --- a/sys/dev/sound/usb/uaudio.c +++ b/sys/dev/sound/usb/uaudio.c @@ -1592,7 +1592,7 @@ uaudio20_check_rate(struct usb_device *udev, uint8_t iface_no, { struct usb_device_request req; usb_error_t error; -#define UAUDIO20_MAX_RATES 32 /* we support at maxium 32 rates */ +#define UAUDIO20_MAX_RATES 32 /* we support at maximum 32 rates */ uint8_t data[2 + UAUDIO20_MAX_RATES * 12]; uint16_t actlen; uint16_t rates; From nobody Thu Nov 11 20:44:13 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CD14E184F1A2; Thu, 11 Nov 2021 20:44:13 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hqtx95Qg0z4xY1; Thu, 11 Nov 2021 20:44:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9AB9D12BEC; Thu, 11 Nov 2021 20:44:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1ABKiDKT057136; Thu, 11 Nov 2021 20:44:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1ABKiDLP057135; Thu, 11 Nov 2021 20:44:13 GMT (envelope-from git) Date: Thu, 11 Nov 2021 20:44:13 GMT Message-Id: <202111112044.1ABKiDLP057135@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 6b94990f7019 - stable/12 - Allocate extra inodes in makefs when leaving free space in UFS images. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 6b94990f701982d8469a6915fa94e234005090f5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=6b94990f701982d8469a6915fa94e234005090f5 commit 6b94990f701982d8469a6915fa94e234005090f5 Author: Nathan Whitehorn AuthorDate: 2021-04-06 17:43:29 +0000 Commit: Ed Maste CommitDate: 2021-11-11 20:01:27 +0000 Allocate extra inodes in makefs when leaving free space in UFS images. By default, makefs(8) has very few spare inodes in its output images, which is fine for static filesystems, but not so great for VM images where many more files will be added. Make makefs(8) use the same default settings as newfs(8) when creating images with free space -- there isn't much point to leaving free space on the image if you can't put files there. If no free space is requested, use current behavior of a minimal number of available inodes. Reviewed by: manu MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D29492 (cherry picked from commit afb6a168f8ee08ac74769464726c396fbef83d0b) --- usr.sbin/makefs/ffs.c | 8 +++++++- usr.sbin/makefs/ffs.h | 2 ++ usr.sbin/makefs/ffs/mkfs.c | 18 +++++++++++++++++- usr.sbin/makefs/makefs.8 | 5 ++++- 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/usr.sbin/makefs/ffs.c b/usr.sbin/makefs/ffs.c index 99b5ba06159d..7a4c31c7dbda 100644 --- a/usr.sbin/makefs/ffs.c +++ b/usr.sbin/makefs/ffs.c @@ -190,6 +190,7 @@ ffs_prep_opts(fsinfo_t *fsopts) ffs_opts->fsize= -1; ffs_opts->cpg= -1; ffs_opts->density= -1; + ffs_opts->min_inodes= false; ffs_opts->minfree= -1; ffs_opts->optimization= -1; ffs_opts->maxcontig= -1; @@ -266,6 +267,11 @@ ffs_makefs(const char *image, const char *dir, fsnode *root, fsinfo_t *fsopts) printf("ffs_makefs: image %s directory %s root %p\n", image, dir, root); + /* if user wants no free space, use minimum number of inodes */ + if (fsopts->minsize == 0 && fsopts->freeblockpc == 0 && + fsopts->freeblocks == 0) + ((ffs_opt_t *)fsopts->fs_specific)->min_inodes = true; + /* validate tree and options */ TIMER_START(start); ffs_validate(dir, root, fsopts); @@ -424,7 +430,7 @@ ffs_validate(const char *dir, fsnode *root, fsinfo_t *fsopts) if (fsopts->roundup > 0) fsopts->size = roundup(fsopts->size, fsopts->roundup); - /* calculate density if necessary */ + /* calculate density to just fit inodes if no free space */ if (ffs_opts->density == -1) ffs_opts->density = fsopts->size / fsopts->inodes + 1; diff --git a/usr.sbin/makefs/ffs.h b/usr.sbin/makefs/ffs.h index 8b4fbc33dc83..e1dda429ff26 100644 --- a/usr.sbin/makefs/ffs.h +++ b/usr.sbin/makefs/ffs.h @@ -44,6 +44,7 @@ #include #include +#include typedef struct { char label[MAXVOLLEN]; /* volume name/label */ @@ -52,6 +53,7 @@ typedef struct { int cpg; /* cylinders per group */ int cpgflg; /* cpg was specified by user */ int density; /* bytes per inode */ + bool min_inodes; /* allocate minimum number of inodes */ int ntracks; /* number of tracks */ int nsectors; /* number of sectors */ int rpm; /* rpm */ diff --git a/usr.sbin/makefs/ffs/mkfs.c b/usr.sbin/makefs/ffs/mkfs.c index 0c8447150f0e..572a19a44f02 100644 --- a/usr.sbin/makefs/ffs/mkfs.c +++ b/usr.sbin/makefs/ffs/mkfs.c @@ -117,10 +117,13 @@ static int avgfpdir; /* expected number of files per directory */ struct fs * ffs_mkfs(const char *fsys, const fsinfo_t *fsopts, time_t tstamp) { - int fragsperinode, optimalfpg, origdensity, minfpg, lastminfpg; + int fragsperinode, optimalfpg, origdensity, mindensity; + int minfpg, lastminfpg; int32_t csfrags; uint32_t i, cylno; long long sizepb; + ino_t maxinum; + int minfragsperinode; /* minimum ratio of frags to inodes */ void *space; int size; int nprintcols, printcolwidth; @@ -311,7 +314,20 @@ ffs_mkfs(const char *fsys, const fsinfo_t *fsopts, time_t tstamp) * can put into each cylinder group. If this is too big, we reduce * the density until it fits. */ + maxinum = (((int64_t)(1)) << 32) - INOPB(&sblock); + minfragsperinode = 1 + fssize / maxinum; + mindensity = minfragsperinode * fsize; + if (density == 0) + density = MAX(2, minfragsperinode) * fsize; + if (density < mindensity) { + origdensity = density; + density = mindensity; + fprintf(stderr, "density increased from %d to %d\n", + origdensity, density); + } origdensity = density; + if (!ffs_opts->min_inodes) + density = MIN(density, MAX(2, minfragsperinode) * fsize); for (;;) { fragsperinode = MAX(numfrags(&sblock, density), 1); minfpg = fragsperinode * INOPB(&sblock); diff --git a/usr.sbin/makefs/makefs.8 b/usr.sbin/makefs/makefs.8 index 8c4fbcb7b322..4a4c69b06946 100644 --- a/usr.sbin/makefs/makefs.8 +++ b/usr.sbin/makefs/makefs.8 @@ -312,7 +312,10 @@ Expected number of files per directory. .It Sy bsize Block size. .It Sy density -Bytes per inode. +Bytes per inode. If unset, will allocate the minimum number of inodes to +represent the filesystem if no free space has been requested (free blocks +or minimum size set); otherwise the larger of the newfs defaults or what +is required by the free inode parameters if set. .It Sy fsize Fragment size. .It Sy label From nobody Fri Nov 12 12:20:23 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id DD5C7184AC49; Fri, 12 Nov 2021 12:20:23 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HrHjM5xHWz4bpF; Fri, 12 Nov 2021 12:20:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A7DE81F414; Fri, 12 Nov 2021 12:20:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1ACCKNu6002470; Fri, 12 Nov 2021 12:20:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1ACCKNcv002469; Fri, 12 Nov 2021 12:20:23 GMT (envelope-from git) Date: Fri, 12 Nov 2021 12:20:23 GMT Message-Id: <202111121220.1ACCKNcv002469@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Andrey V. Elsukov" Subject: git: faba420cb9b1 - stable/13 - ip_divert: calculate delayed checksum for IPv6 adress family List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ae X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: faba420cb9b1f60d04bbf9f3f4e2ab89894ba898 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by ae: URL: https://cgit.FreeBSD.org/src/commit/?id=faba420cb9b1f60d04bbf9f3f4e2ab89894ba898 commit faba420cb9b1f60d04bbf9f3f4e2ab89894ba898 Author: Andrey V. Elsukov AuthorDate: 2021-11-02 16:59:06 +0000 Commit: Andrey V. Elsukov CommitDate: 2021-11-12 12:19:19 +0000 ip_divert: calculate delayed checksum for IPv6 adress family Before passing an IPv6 packet to application apply delayed checksum calculation. Mbuf flags will be lost when divert listener will return a packet back, so we will not be able to do delayed checksum calculation later. Also an application will get a packet with correct checksum. Reviewed by: donner Differential Revision: https://reviews.freebsd.org/D32807 (cherry picked from commit 4a9e95286cacce5bf7cd193b43c4a461cf7d69b8) --- sys/netinet/ip_divert.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c index 4141386a6a2d..4919893d6a61 100644 --- a/sys/netinet/ip_divert.c +++ b/sys/netinet/ip_divert.c @@ -227,6 +227,25 @@ divert_packet(struct mbuf *m, bool incoming) m->m_pkthdr.csum_flags &= ~CSUM_SCTP; } #endif +#ifdef INET6 + if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA_IPV6) { + m = mb_unmapped_to_ext(m); + if (m == NULL) + return; + in6_delayed_cksum(m, m->m_pkthdr.len - + sizeof(struct ip6_hdr), sizeof(struct ip6_hdr)); + m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6; + } +#if defined(SCTP) || defined(SCTP_SUPPORT) + if (m->m_pkthdr.csum_flags & CSUM_SCTP_IPV6) { + m = mb_unmapped_to_ext(m); + if (m == NULL) + return; + sctp_delayed_cksum(m, sizeof(struct ip6_hdr)); + m->m_pkthdr.csum_flags &= ~CSUM_SCTP_IPV6; + } +#endif +#endif /* INET6 */ bzero(&divsrc, sizeof(divsrc)); divsrc.sin_len = sizeof(divsrc); divsrc.sin_family = AF_INET; From nobody Fri Nov 12 12:21:49 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 10801184ACF8; Fri, 12 Nov 2021 12:21:50 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HrHl16cS7z4cMd; Fri, 12 Nov 2021 12:21:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C311F1F51F; Fri, 12 Nov 2021 12:21:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1ACCLntr006774; Fri, 12 Nov 2021 12:21:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1ACCLnVP006773; Fri, 12 Nov 2021 12:21:49 GMT (envelope-from git) Date: Fri, 12 Nov 2021 12:21:49 GMT Message-Id: <202111121221.1ACCLnVP006773@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Andrey V. Elsukov" Subject: git: b3c1846830af - stable/12 - ip_divert: calculate delayed checksum for IPv6 adress family List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ae X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: b3c1846830af71ee197dcfbdd9a6bea5980cbbdd Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by ae: URL: https://cgit.FreeBSD.org/src/commit/?id=b3c1846830af71ee197dcfbdd9a6bea5980cbbdd commit b3c1846830af71ee197dcfbdd9a6bea5980cbbdd Author: Andrey V. Elsukov AuthorDate: 2021-11-02 16:59:06 +0000 Commit: Andrey V. Elsukov CommitDate: 2021-11-12 12:20:46 +0000 ip_divert: calculate delayed checksum for IPv6 adress family Before passing an IPv6 packet to application apply delayed checksum calculation. Mbuf flags will be lost when divert listener will return a packet back, so we will not be able to do delayed checksum calculation later. Also an application will get a packet with correct checksum. Reviewed by: donner Differential Revision: https://reviews.freebsd.org/D32807 (cherry picked from commit 4a9e95286cacce5bf7cd193b43c4a461cf7d69b8) --- sys/netinet/ip_divert.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c index 54cd0f509b51..74ff93663c58 100644 --- a/sys/netinet/ip_divert.c +++ b/sys/netinet/ip_divert.c @@ -216,6 +216,25 @@ divert_packet(struct mbuf *m, int incoming) m->m_pkthdr.csum_flags &= ~CSUM_SCTP; } #endif +#ifdef INET6 + if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA_IPV6) { + m = mb_unmapped_to_ext(m); + if (m == NULL) + return; + in6_delayed_cksum(m, m->m_pkthdr.len - + sizeof(struct ip6_hdr), sizeof(struct ip6_hdr)); + m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6; + } +#if defined(SCTP) || defined(SCTP_SUPPORT) + if (m->m_pkthdr.csum_flags & CSUM_SCTP_IPV6) { + m = mb_unmapped_to_ext(m); + if (m == NULL) + return; + sctp_delayed_cksum(m, sizeof(struct ip6_hdr)); + m->m_pkthdr.csum_flags &= ~CSUM_SCTP_IPV6; + } +#endif +#endif /* INET6 */ bzero(&divsrc, sizeof(divsrc)); divsrc.sin_len = sizeof(divsrc); divsrc.sin_family = AF_INET; From nobody Fri Nov 12 12:59:33 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5CC64185EA45; Fri, 12 Nov 2021 12:59:33 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HrJZY25Rvz4q2l; Fri, 12 Nov 2021 12:59:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2528B1F9FC; Fri, 12 Nov 2021 12:59:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1ACCxX5A047636; Fri, 12 Nov 2021 12:59:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1ACCxXnP047635; Fri, 12 Nov 2021 12:59:33 GMT (envelope-from git) Date: Fri, 12 Nov 2021 12:59:33 GMT Message-Id: <202111121259.1ACCxXnP047635@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Andrey V. Elsukov" Subject: git: 80be188a8160 - stable/12 - Fix the build after b3c1846830af71ee197dcfbdd9a6bea5980cbbdd List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ae X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 80be188a8160ba0f229823470df148a7089c5576 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by ae: URL: https://cgit.FreeBSD.org/src/commit/?id=80be188a8160ba0f229823470df148a7089c5576 commit 80be188a8160ba0f229823470df148a7089c5576 Author: Andrey V. Elsukov AuthorDate: 2021-11-12 12:57:18 +0000 Commit: Andrey V. Elsukov CommitDate: 2021-11-12 12:57:18 +0000 Fix the build after b3c1846830af71ee197dcfbdd9a6bea5980cbbdd stable/12 doesn't support unmapped mbufs, thus we don't need to use mb_unmapped_to_ext(). This is direct commit to stable/12. --- sys/netinet/ip_divert.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c index 74ff93663c58..2aa4ba7bc05e 100644 --- a/sys/netinet/ip_divert.c +++ b/sys/netinet/ip_divert.c @@ -218,18 +218,12 @@ divert_packet(struct mbuf *m, int incoming) #endif #ifdef INET6 if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA_IPV6) { - m = mb_unmapped_to_ext(m); - if (m == NULL) - return; in6_delayed_cksum(m, m->m_pkthdr.len - sizeof(struct ip6_hdr), sizeof(struct ip6_hdr)); m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6; } #if defined(SCTP) || defined(SCTP_SUPPORT) if (m->m_pkthdr.csum_flags & CSUM_SCTP_IPV6) { - m = mb_unmapped_to_ext(m); - if (m == NULL) - return; sctp_delayed_cksum(m, sizeof(struct ip6_hdr)); m->m_pkthdr.csum_flags &= ~CSUM_SCTP_IPV6; } From nobody Fri Nov 12 14:36:56 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D44121842C55; Fri, 12 Nov 2021 14:36:56 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HrLkw5cqfz4QsS; Fri, 12 Nov 2021 14:36:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A0C2D210C0; Fri, 12 Nov 2021 14:36:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1ACEautC080998; Fri, 12 Nov 2021 14:36:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1ACEauiw080997; Fri, 12 Nov 2021 14:36:56 GMT (envelope-from git) Date: Fri, 12 Nov 2021 14:36:56 GMT Message-Id: <202111121436.1ACEauiw080997@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 8ababf739aa9 - stable/13 - LinuxKPI: Add sysctl(8) knob to control verbosity of WARN_ON's. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8ababf739aa903934a1b85c10fa7bee59eb57369 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=8ababf739aa903934a1b85c10fa7bee59eb57369 commit 8ababf739aa903934a1b85c10fa7bee59eb57369 Author: Hans Petter Selasky AuthorDate: 2021-11-02 15:52:46 +0000 Commit: Hans Petter Selasky CommitDate: 2021-11-12 14:31:24 +0000 LinuxKPI: Add sysctl(8) knob to control verbosity of WARN_ON's. The purpose of this change is to reduce the amount of dmesg(8) noise when VT switching after a panic. Submitted by: Greg V Differential Revision: https://reviews.freebsd.org/D30174 Sponsored by: NVIDIA Networking (cherry picked from commit 2390a1441effaba0e3d0f2f447f448aaf20428f1) --- sys/compat/linuxkpi/common/include/linux/kernel.h | 25 +++++++++++++---------- sys/compat/linuxkpi/common/src/linux_compat.c | 5 +++++ 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/kernel.h b/sys/compat/linuxkpi/common/include/linux/kernel.h index aba5896111f7..0909e7fb78f3 100644 --- a/sys/compat/linuxkpi/common/include/linux/kernel.h +++ b/sys/compat/linuxkpi/common/include/linux/kernel.h @@ -121,28 +121,31 @@ extern const volatile int lkpi_build_bug_on_zero; } \ } while (0) +extern int linuxkpi_warn_dump_stack; #define WARN_ON(cond) ({ \ - bool __ret = (cond); \ - if (__ret) { \ + bool __ret = (cond); \ + if (__ret) { \ printf("WARNING %s failed at %s:%d\n", \ __stringify(cond), __FILE__, __LINE__); \ - linux_dump_stack(); \ - } \ - unlikely(__ret); \ + if (linuxkpi_warn_dump_stack) \ + linux_dump_stack(); \ + } \ + unlikely(__ret); \ }) #define WARN_ON_SMP(cond) WARN_ON(cond) #define WARN_ON_ONCE(cond) ({ \ - static bool __warn_on_once; \ - bool __ret = (cond); \ - if (__ret && !__warn_on_once) { \ + static bool __warn_on_once; \ + bool __ret = (cond); \ + if (__ret && !__warn_on_once) { \ __warn_on_once = 1; \ printf("WARNING %s failed at %s:%d\n", \ __stringify(cond), __FILE__, __LINE__); \ - linux_dump_stack(); \ - } \ - unlikely(__ret); \ + if (linuxkpi_warn_dump_stack) \ + linux_dump_stack(); \ + } \ + unlikely(__ret); \ }) #define oops_in_progress SCHEDULER_STOPPED() diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index a1462c6a7010..45b149a08ae8 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -102,6 +102,11 @@ int linuxkpi_debug; SYSCTL_INT(_compat_linuxkpi, OID_AUTO, debug, CTLFLAG_RWTUN, &linuxkpi_debug, 0, "Set to enable pr_debug() prints. Clear to disable."); +int linuxkpi_warn_dump_stack = 0; +SYSCTL_INT(_compat_linuxkpi, OID_AUTO, warn_dump_stack, CTLFLAG_RWTUN, + &linuxkpi_warn_dump_stack, 0, + "Set to enable stack traces from WARN_ON(). Clear to disable."); + static struct timeval lkpi_net_lastlog; static int lkpi_net_curpps; static int lkpi_net_maxpps = 99; From nobody Fri Nov 12 14:36:57 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3BCEF1842F89; Fri, 12 Nov 2021 14:36:58 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HrLky0sGpz4R2F; Fri, 12 Nov 2021 14:36:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D02BF21067; Fri, 12 Nov 2021 14:36:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1ACEaveR081022; Fri, 12 Nov 2021 14:36:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1ACEavai081021; Fri, 12 Nov 2021 14:36:57 GMT (envelope-from git) Date: Fri, 12 Nov 2021 14:36:57 GMT Message-Id: <202111121436.1ACEavai081021@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: af21e0057acc - stable/13 - beep(1): Initial version of utility to create terminal beep via soundcard. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: af21e0057acc06d606a06f8babc9e1524c3cd66e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=af21e0057acc06d606a06f8babc9e1524c3cd66e commit af21e0057acc06d606a06f8babc9e1524c3cd66e Author: Hans Petter Selasky AuthorDate: 2021-10-26 17:13:00 +0000 Commit: Hans Petter Selasky CommitDate: 2021-11-12 14:33:10 +0000 beep(1): Initial version of utility to create terminal beep via soundcard. Reviewed by: imp@, emaste@ and pstef@ Differential Revision: https://reviews.freebsd.org/D32672 Sponsored by: NVIDIA Networking (cherry picked from commit 8abfbe5a79b19bb95430f574d970843607f5809c) --- usr.bin/Makefile | 1 + usr.bin/beep/Makefile | 8 ++ usr.bin/beep/beep.1 | 84 +++++++++++++++ usr.bin/beep/beep.c | 275 ++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 368 insertions(+) diff --git a/usr.bin/Makefile b/usr.bin/Makefile index 9b38cc2512b7..6126e93b28a8 100644 --- a/usr.bin/Makefile +++ b/usr.bin/Makefile @@ -10,6 +10,7 @@ SUBDIR= alias \ backlight \ banner \ basename \ + beep \ brandelf \ bsdcat \ bsdiff \ diff --git a/usr.bin/beep/Makefile b/usr.bin/beep/Makefile new file mode 100644 index 000000000000..754656ef059b --- /dev/null +++ b/usr.bin/beep/Makefile @@ -0,0 +1,8 @@ +# $FreeBSD$ + +PROG= beep +MAN= beep.1 + +LDFLAGS= -lm + +.include diff --git a/usr.bin/beep/beep.1 b/usr.bin/beep/beep.1 new file mode 100644 index 000000000000..55fe0173272a --- /dev/null +++ b/usr.bin/beep/beep.1 @@ -0,0 +1,84 @@ +.\"- +.\" Copyright (c) 2021 Hans Petter Selasky +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd November 4, 2021 +.Dt beep 1 +.Os +.Sh NAME +.Nm beep +.Nd play a beep sound +.Sh SYNOPSIS +.Nm +.Op Fl F Ar frequency +.Op Fl D Ar duration_ms +.Op Fl r Ar sample_rate_hz +.Op Fl d Ar oss_device +.Op Fl g Ar gain +.Op Fl B +.Op Fl h +.Sh DESCRIPTION +The +.Nm +utility is used to playback a beep on the soundcard. +.Pp +The options are as follows: +.Bl -tag -width "-f device" +.It Fl F +Sets the center frequency of the beep in Hz. +The default is 440 Hz . +.It Fl D +Sets the duration of the beep in milliseconds. +The default is 150 ms . +.It Fl d +Sets the soundcard to use. +The default is /dev/dsp . +.It Fl r +Sets the soundcard samplerate in Hz. +The default is 48000 Hz. +.It Fl g +Sets the waveform gain, between 0 and 100 inclusively. +The default is 75. +.It Fl B +Runs the +.Nm +utility in the background. +.It Fl h +Display summary of options. +.El +.Sh EXAMPLES +.Pp +Playback default beep sound using /dev/dsp . +.Bl -tag -width Ds -offset indent +.It $ beep +.El +.Sh SEE ALSO +.Xr mixer 3 , +.Xr sound 4 , +.Sh HISTORY +The +.Nm +utility first appeared in FreeBSD 14.0. +.Sh AUTHORS +.An Hans Petter Selasky Aq Mt hselasky@FreeBSD.org diff --git a/usr.bin/beep/beep.c b/usr.bin/beep/beep.c new file mode 100644 index 000000000000..151236b4825b --- /dev/null +++ b/usr.bin/beep/beep.c @@ -0,0 +1,275 @@ +/*- + * Copyright (c) 2021 Hans Petter Selasky + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define SAMPLE_RATE_DEF 48000 /* hz */ +#define SAMPLE_RATE_MAX 48000 /* hz */ +#define SAMPLE_RATE_MIN 8000 /* hz */ + +#define DURATION_DEF 150 /* ms */ +#define DURATION_MAX 2000 /* ms */ +#define DURATION_MIN 50 /* ms */ + +#define GAIN_DEF 75 +#define GAIN_MAX 100 +#define GAIN_MIN 0 + +#define WAVE_POWER 1.25f + +#define DEFAULT_HZ 440 + +#define DEFAULT_DEVICE _PATH_DEV "dsp" + +static int frequency = DEFAULT_HZ; +static int duration_ms = DURATION_DEF; +static int sample_rate = SAMPLE_RATE_DEF; +static int gain = GAIN_DEF; +static const char *oss_dev = DEFAULT_DEVICE; +static bool background; + +/* + * wave_function_16 + * + * "phase" should be in the range [0.0f .. 1.0f> + * "power" should be in the range <0.0f .. 2.0f> + * + * The return value is in the range [-1.0f .. 1.0f] + */ +static float +wave_function_16(float phase, float power) +{ + uint16_t x = phase * (1U << 16); + float retval; + uint8_t num; + + /* Handle special cases, if any */ + switch (x) { + case 0xffff: + case 0x0000: + return (1.0f); + case 0x3fff: + case 0x4000: + case 0xBfff: + case 0xC000: + return (0.0f); + case 0x7FFF: + case 0x8000: + return (-1.0f); + default: + break; + } + + /* Apply Gray coding */ + for (uint16_t mask = 1U << 15; mask != 1; mask /= 2) { + if (x & mask) + x ^= (mask - 1); + } + + /* Find first set bit */ + for (num = 0; num != 14; num++) { + if (x & (1U << num)) { + num++; + break; + } + } + + /* Initialize return value */ + retval = 0.0; + + /* Compute the rest of the power series */ + for (; num != 14; num++) { + if (x & (1U << num)) { + retval = (1.0f - retval) / 2.0f; + retval = powf(retval, power); + } else { + retval = (1.0f + retval) / 2.0f; + retval = powf(retval, power); + } + } + + /* Check if halfway */ + if (x & (1ULL << 14)) + retval = -retval; + + return (retval); +} + +static void +usage(void) +{ + fprintf(stderr, "Usage: %s [parameters]\n" + "\t" "-F \n" + "\t" "-D \n" + "\t" "-r \n" + "\t" "-d \n" + "\t" "-g \n" + "\t" "-B Run in background\n" + "\t" "-h Show usage\n", + getprogname(), + DEFAULT_HZ, + DURATION_MIN, DURATION_MAX, DURATION_DEF, + SAMPLE_RATE_MIN, SAMPLE_RATE_MAX, SAMPLE_RATE_DEF, + DEFAULT_DEVICE, + GAIN_MIN, GAIN_MAX, GAIN_DEF); + exit(1); +} + +int +main(int argc, char **argv) +{ + int32_t *buffer; + size_t slope; + size_t size; + size_t off; + float a; + float d; + float p; + int c; + int f; + + while ((c = getopt(argc, argv, "BF:D:r:g:d:h")) != -1) { + switch (c) { + case 'F': + frequency = strtol(optarg, NULL, 10); + break; + case 'D': + duration_ms = strtol(optarg, NULL, 10); + if (duration_ms < DURATION_MIN || + duration_ms > DURATION_MAX) + usage(); + break; + case 'r': + sample_rate = strtol(optarg, NULL, 10); + if (sample_rate < SAMPLE_RATE_MIN || + sample_rate > SAMPLE_RATE_MAX) + usage(); + break; + case 'g': + gain = strtol(optarg, NULL, 10); + if (gain < GAIN_MIN || + gain > GAIN_MAX) + usage(); + break; + case 'd': + oss_dev = optarg; + break; + case 'B': + background = true; + break; + default: + usage(); + break; + } + } + + if (background && daemon(0, 0) != 0) + errx(1, "daemon(0,0) failed"); + + f = open(oss_dev, O_WRONLY); + if (f < 0) + errx(1, "Failed to open '%s'", oss_dev); + + c = 1; /* mono */ + if (ioctl(f, SOUND_PCM_WRITE_CHANNELS, &c) != 0) + errx(1, "ioctl SOUND_PCM_WRITE_CHANNELS(1) failed"); + + c = AFMT_S32_NE; + if (ioctl(f, SNDCTL_DSP_SETFMT, &c) != 0) + errx(1, "ioctl SNDCTL_DSP_SETFMT(AFMT_S32_NE) failed"); + + if (ioctl(f, SNDCTL_DSP_SPEED, &sample_rate) != 0) + errx(1, "ioctl SNDCTL_DSP_SPEED(%d) failed", sample_rate); + + c = (2 << 16); + while ((1ULL << (c & 63)) < (size_t)(4 * sample_rate / 50)) + c++; + if (ioctl(f, SNDCTL_DSP_SETFRAGMENT, &c)) + errx(1, "ioctl SNDCTL_DSP_SETFRAGMENT(0x%x) failed", c); + + if (ioctl(f, SNDCTL_DSP_GETODELAY, &c) != 0) + errx(1, "ioctl SNDCTL_DSP_GETODELAY failed"); + + size = ((sample_rate * duration_ms) + 999) / 1000; + buffer = malloc(sizeof(buffer[0]) * size); + if (buffer == NULL) + errx(1, "out of memory"); + + /* compute slope duration in samples */ + slope = (DURATION_MIN * sample_rate) / 2000; + + /* compute base gain */ + a = powf(65536.0f, (float)gain / (float)GAIN_MAX) / 65536.0f; + + /* set initial phase and delta */ + p = 0; + d = (float)frequency / (float)sample_rate; + + /* compute wave */ + for (p = off = 0; off != size; off++, p += d) { + float sample; + + p = p - floorf(p); + sample = a * wave_function_16(p, WAVE_POWER); + + if (off < slope) + sample = sample * off / (float)slope; + else if (off > (size - slope)) + sample = sample * (size - off - 1) / (float)slope; + + buffer[off] = sample * 0x7fffff00; + } + + if (write(f, buffer, size * sizeof(buffer[0])) != + (ssize_t)(size * sizeof(buffer[0]))) + errx(1, "failed writing to DSP device(%s)", oss_dev); + + free(buffer); + + /* wait for data to be written */ + while (ioctl(f, SNDCTL_DSP_GETODELAY, &c) == 0) { + if (c == 0) + break; + usleep(10000); + } + + /* wait for audio to go out */ + usleep(50000); + close(f); + + return (0); +} From nobody Fri Nov 12 14:36:58 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6845C1842F90; Fri, 12 Nov 2021 14:36:59 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HrLkz0nfJz4QyZ; Fri, 12 Nov 2021 14:36:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E7ABA21302; Fri, 12 Nov 2021 14:36:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1ACEawCK081052; Fri, 12 Nov 2021 14:36:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1ACEawxX081051; Fri, 12 Nov 2021 14:36:58 GMT (envelope-from git) Date: Fri, 12 Nov 2021 14:36:58 GMT Message-Id: <202111121436.1ACEawxX081051@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 4a36455c4179 - stable/13 - Factor out flags preserved during mbuf demote into a separate define. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4a36455c417978a3f7cc62c0e8e05935ab503373 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=4a36455c417978a3f7cc62c0e8e05935ab503373 commit 4a36455c417978a3f7cc62c0e8e05935ab503373 Author: Hans Petter Selasky AuthorDate: 2021-11-04 17:48:23 +0000 Commit: Hans Petter Selasky CommitDate: 2021-11-12 14:33:54 +0000 Factor out flags preserved during mbuf demote into a separate define. This define will later on be used by coming TLS RX hardware offload patches. No functional change intended. Reviewed by: jhb@ Sponsored by: NVIDIA Networking (cherry picked from commit dd31400c3c2aa941d057e78296c193959a6d9ed3) --- sys/kern/uipc_mbuf.c | 5 +++-- sys/sys/mbuf.h | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 5588da2dcd20..4fa94fb3019e 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -268,13 +268,14 @@ m_demote(struct mbuf *m0, int all, int flags) { struct mbuf *m; + flags |= M_DEMOTEFLAGS; + for (m = all ? m0 : m0->m_next; m != NULL; m = m->m_next) { KASSERT(m->m_nextpkt == NULL, ("%s: m_nextpkt in m %p, m0 %p", __func__, m, m0)); if (m->m_flags & M_PKTHDR) m_demote_pkthdr(m); - m->m_flags = m->m_flags & (M_EXT | M_RDONLY | M_NOFREE | - M_EXTPG | flags); + m->m_flags &= flags; } } diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index 640856016e0e..9f84d0758bc6 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -494,6 +494,12 @@ m_epg_pagelen(const struct mbuf *m, int pidx, int pgoff) (M_PKTHDR|M_EOR|M_RDONLY|M_BCAST|M_MCAST|M_PROMISC|M_VLANTAG|M_TSTMP| \ M_TSTMP_HPREC|M_TSTMP_LRO|M_PROTOFLAGS) +/* + * Flags preserved during demote. + */ +#define M_DEMOTEFLAGS \ + (M_EXT | M_RDONLY | M_NOFREE | M_EXTPG) + /* * Mbuf flag description for use with printf(9) %b identifier. */ From nobody Fri Nov 12 14:44:11 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CCDFB18474BD; Fri, 12 Nov 2021 14:44:11 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HrLvH5S09z4Tbj; Fri, 12 Nov 2021 14:44:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B712210F6; Fri, 12 Nov 2021 14:44:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1ACEiBPf093920; Fri, 12 Nov 2021 14:44:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1ACEiB7q093919; Fri, 12 Nov 2021 14:44:11 GMT (envelope-from git) Date: Fri, 12 Nov 2021 14:44:11 GMT Message-Id: <202111121444.1ACEiB7q093919@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 7e34088b7800 - stable/12 - LinuxKPI: add net_ratelimit() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 7e34088b7800b39a42807c0fde1537bdcbb1cd62 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=7e34088b7800b39a42807c0fde1537bdcbb1cd62 commit 7e34088b7800b39a42807c0fde1537bdcbb1cd62 Author: Hans Petter Selasky AuthorDate: 2021-11-12 14:43:36 +0000 Commit: Hans Petter Selasky CommitDate: 2021-11-12 14:43:36 +0000 LinuxKPI: add net_ratelimit() Add a net_ratelimit() compat implementation based on ppsratecheck(). Add a sysctl to allow tuning of the number of messages. Sponsored-by: The FreeBSD Foundation Reviewed-by: hselasky Differential Revision: https://reviews.freebsd.org/D29399 (cherry picked from commit bc042266b2bfc3f52f685df7ccdd6e857b4b9da9) --- sys/compat/linuxkpi/common/include/linux/net.h | 10 ++++++++++ sys/compat/linuxkpi/common/src/linux_compat.c | 15 +++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/net.h b/sys/compat/linuxkpi/common/include/linux/net.h index 282a45d2db32..5365cd0e9552 100644 --- a/sys/compat/linuxkpi/common/include/linux/net.h +++ b/sys/compat/linuxkpi/common/include/linux/net.h @@ -76,4 +76,14 @@ sock_release(struct socket *so) soclose(so); } + +int linuxkpi_net_ratelimit(void); + +static inline int +net_ratelimit(void) +{ + + return (linuxkpi_net_ratelimit()); +} + #endif /* _LINUX_NET_H_ */ diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index 7175c0f87364..bb649e42ab8c 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -97,6 +98,12 @@ int linuxkpi_debug; SYSCTL_INT(_compat_linuxkpi, OID_AUTO, debug, CTLFLAG_RWTUN, &linuxkpi_debug, 0, "Set to enable pr_debug() prints. Clear to disable."); +static struct timeval lkpi_net_lastlog; +static int lkpi_net_curpps; +static int lkpi_net_maxpps = 99; +SYSCTL_INT(_compat_linuxkpi, OID_AUTO, net_ratelimit, CTLFLAG_RWTUN, + &lkpi_net_maxpps, 0, "Limit number of LinuxKPI net messages per second."); + MALLOC_DEFINE(M_KMALLOC, "linux", "Linux kmalloc compat"); #include @@ -2514,6 +2521,14 @@ linux_dump_stack(void) #endif } +int +linuxkpi_net_ratelimit(void) +{ + + return (ppsratecheck(&lkpi_net_lastlog, &lkpi_net_curpps, + lkpi_net_maxpps)); +} + #if defined(__i386__) || defined(__amd64__) bool linux_cpu_has_clflush; #endif From nobody Fri Nov 12 14:44:12 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5C16818474C7; Fri, 12 Nov 2021 14:44:13 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HrLvK0yXkz4TpL; Fri, 12 Nov 2021 14:44:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CA84621153; Fri, 12 Nov 2021 14:44:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1ACEiCw4093944; Fri, 12 Nov 2021 14:44:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1ACEiCge093943; Fri, 12 Nov 2021 14:44:12 GMT (envelope-from git) Date: Fri, 12 Nov 2021 14:44:12 GMT Message-Id: <202111121444.1ACEiCge093943@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 0e9e3016b9db - stable/12 - LinuxKPI: Add sysctl(8) knob to control verbosity of WARN_ON's. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 0e9e3016b9db4572f78ebb7cf475e8fae84e37df Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=0e9e3016b9db4572f78ebb7cf475e8fae84e37df commit 0e9e3016b9db4572f78ebb7cf475e8fae84e37df Author: Hans Petter Selasky AuthorDate: 2021-11-12 14:43:52 +0000 Commit: Hans Petter Selasky CommitDate: 2021-11-12 14:43:52 +0000 LinuxKPI: Add sysctl(8) knob to control verbosity of WARN_ON's. The purpose of this change is to reduce the amount of dmesg(8) noise when VT switching after a panic. Submitted by: Greg V Differential Revision: https://reviews.freebsd.org/D30174 Sponsored by: NVIDIA Networking (cherry picked from commit 2390a1441effaba0e3d0f2f447f448aaf20428f1) --- sys/compat/linuxkpi/common/include/linux/kernel.h | 25 +++++++++++++---------- sys/compat/linuxkpi/common/src/linux_compat.c | 5 +++++ 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/kernel.h b/sys/compat/linuxkpi/common/include/linux/kernel.h index 36d89cf83557..9e96c9935e45 100644 --- a/sys/compat/linuxkpi/common/include/linux/kernel.h +++ b/sys/compat/linuxkpi/common/include/linux/kernel.h @@ -105,28 +105,31 @@ extern const volatile int lkpi_build_bug_on_zero; } \ } while (0) +extern int linuxkpi_warn_dump_stack; #define WARN_ON(cond) ({ \ - bool __ret = (cond); \ - if (__ret) { \ + bool __ret = (cond); \ + if (__ret) { \ printf("WARNING %s failed at %s:%d\n", \ __stringify(cond), __FILE__, __LINE__); \ - linux_dump_stack(); \ - } \ - unlikely(__ret); \ + if (linuxkpi_warn_dump_stack) \ + linux_dump_stack(); \ + } \ + unlikely(__ret); \ }) #define WARN_ON_SMP(cond) WARN_ON(cond) #define WARN_ON_ONCE(cond) ({ \ - static bool __warn_on_once; \ - bool __ret = (cond); \ - if (__ret && !__warn_on_once) { \ + static bool __warn_on_once; \ + bool __ret = (cond); \ + if (__ret && !__warn_on_once) { \ __warn_on_once = 1; \ printf("WARNING %s failed at %s:%d\n", \ __stringify(cond), __FILE__, __LINE__); \ - linux_dump_stack(); \ - } \ - unlikely(__ret); \ + if (linuxkpi_warn_dump_stack) \ + linux_dump_stack(); \ + } \ + unlikely(__ret); \ }) #define oops_in_progress SCHEDULER_STOPPED() diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index bb649e42ab8c..e3ccda6e8f23 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -98,6 +98,11 @@ int linuxkpi_debug; SYSCTL_INT(_compat_linuxkpi, OID_AUTO, debug, CTLFLAG_RWTUN, &linuxkpi_debug, 0, "Set to enable pr_debug() prints. Clear to disable."); +int linuxkpi_warn_dump_stack = 0; +SYSCTL_INT(_compat_linuxkpi, OID_AUTO, warn_dump_stack, CTLFLAG_RWTUN, + &linuxkpi_warn_dump_stack, 0, + "Set to enable stack traces from WARN_ON(). Clear to disable."); + static struct timeval lkpi_net_lastlog; static int lkpi_net_curpps; static int lkpi_net_maxpps = 99; From nobody Fri Nov 12 15:30:46 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5D7481841284; Fri, 12 Nov 2021 15:30:46 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HrMx228rTz4mxt; Fri, 12 Nov 2021 15:30:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 29DF121C30; Fri, 12 Nov 2021 15:30:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1ACFUkAe056518; Fri, 12 Nov 2021 15:30:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1ACFUkNq056517; Fri, 12 Nov 2021 15:30:46 GMT (envelope-from git) Date: Fri, 12 Nov 2021 15:30:46 GMT Message-Id: <202111121530.1ACFUkNq056517@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Glen Barber Subject: git: 35a5a941bf83 - releng/12.3 - 12.3: update DVD pkg configuration List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/releng/12.3 X-Git-Reftype: branch X-Git-Commit: 35a5a941bf83ad16979b213ed64813cdbc757ce6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/12.3 has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=35a5a941bf83ad16979b213ed64813cdbc757ce6 commit 35a5a941bf83ad16979b213ed64813cdbc757ce6 Author: Glen Barber AuthorDate: 2021-11-12 15:29:53 +0000 Commit: Glen Barber CommitDate: 2021-11-12 15:29:53 +0000 12.3: update DVD pkg configuration Use the release_3 package repository to populate the dvd1.iso images. Approved by: re (implicit) Sponsored by: Rubicon Communications, LLC ("Netgate") --- release/pkg_repos/release-dvd.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/pkg_repos/release-dvd.conf b/release/pkg_repos/release-dvd.conf index 34997f2c7067..fd090224cc81 100644 --- a/release/pkg_repos/release-dvd.conf +++ b/release/pkg_repos/release-dvd.conf @@ -1,6 +1,6 @@ # $FreeBSD$ release: { - url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly", + url: "pkg+http://pkg.FreeBSD.org/${ABI}/release_3", mirror_type: "srv", signature_type: "fingerprints", fingerprints: "/usr/share/keys/pkg", From nobody Fri Nov 12 22:43:20 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A348B1844545; Fri, 12 Nov 2021 22:43:20 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HrYX84Bq8z3q16; Fri, 12 Nov 2021 22:43:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7083327E3F; Fri, 12 Nov 2021 22:43:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1ACMhKlh035534; Fri, 12 Nov 2021 22:43:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1ACMhKGj035533; Fri, 12 Nov 2021 22:43:20 GMT (envelope-from git) Date: Fri, 12 Nov 2021 22:43:20 GMT Message-Id: <202111122243.1ACMhKGj035533@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Peter Grehan Subject: git: a4c22552b8c4 - stable/13 - igc: correctly update RCTL when changing multicast filters. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: grehan X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a4c22552b8c4e73d3d801cca98caa6fb771b1920 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by grehan: URL: https://cgit.FreeBSD.org/src/commit/?id=a4c22552b8c4e73d3d801cca98caa6fb771b1920 commit a4c22552b8c4e73d3d801cca98caa6fb771b1920 Author: Peter Grehan AuthorDate: 2021-10-11 17:49:01 +0000 Commit: Peter Grehan CommitDate: 2021-11-12 20:44:21 +0000 igc: correctly update RCTL when changing multicast filters. Fix clearing of bits in RCTL for the non-bpf/non-allmulti case. Update RCTL after modifying the multicast filter registers as per the Linux driver. This fixes LACP on igc interfaces, where incoming LACP multicasti control packets were being dropped. Obtained from: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 5a3eb6207a353c3a18da8abcf00a2d75276dd29e) --- sys/dev/igc/if_igc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/igc/if_igc.c b/sys/dev/igc/if_igc.c index 6d94a7c223c7..436493185d5c 100644 --- a/sys/dev/igc/if_igc.c +++ b/sys/dev/igc/if_igc.c @@ -1172,12 +1172,12 @@ igc_if_multi_set(if_ctx_t ctx) reg_rctl |= IGC_RCTL_MPE; reg_rctl &= ~IGC_RCTL_UPE; } else - reg_rctl = ~(IGC_RCTL_UPE | IGC_RCTL_MPE); - - IGC_WRITE_REG(&adapter->hw, IGC_RCTL, reg_rctl); + reg_rctl &= ~(IGC_RCTL_UPE | IGC_RCTL_MPE); if (mcnt < MAX_NUM_MULTICAST_ADDRESSES) igc_update_mc_addr_list(&adapter->hw, mta, mcnt); + + IGC_WRITE_REG(&adapter->hw, IGC_RCTL, reg_rctl); } /********************************************************************* From nobody Fri Nov 12 22:43:21 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id F086B184480E; Fri, 12 Nov 2021 22:43:21 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HrYX967Y6z3pq4; Fri, 12 Nov 2021 22:43:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ACFD519E; Fri, 12 Nov 2021 22:43:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1ACMhLEl035558; Fri, 12 Nov 2021 22:43:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1ACMhLPC035557; Fri, 12 Nov 2021 22:43:21 GMT (envelope-from git) Date: Fri, 12 Nov 2021 22:43:21 GMT Message-Id: <202111122243.1ACMhLPC035557@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Peter Grehan Subject: git: 37bfb1c96596 - stable/13 - igc: Use hardware routine for PHY reset List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: grehan X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 37bfb1c96596f0801e33a497f7f15d07a02e1a09 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by grehan: URL: https://cgit.FreeBSD.org/src/commit/?id=37bfb1c96596f0801e33a497f7f15d07a02e1a09 commit 37bfb1c96596f0801e33a497f7f15d07a02e1a09 Author: Peter Grehan AuthorDate: 2021-11-01 13:35:43 +0000 Commit: Peter Grehan CommitDate: 2021-11-12 20:45:41 +0000 igc: Use hardware routine for PHY reset Summary: The previously used software reset routine wasn't sufficient to reset the PHY if the bootloader hadn't left the device in an initialized state. This was seen with the onboard igc port on an 11th-gen Intel NUC. The software reset isn't used in the Linux driver so all related code has been removed. Tested on: Netgate 6100 onboard ports, a discrete PCIe I225-LM card, and an 11th-gen Intel NUC. Reported by: woodsb02 Tested by: woodsb02 (NUC) Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 561cd74b1704ab76a3286733fb43da53b6892ea4) --- sys/dev/igc/igc_api.c | 15 --------------- sys/dev/igc/igc_api.h | 1 - sys/dev/igc/igc_hw.h | 1 - sys/dev/igc/igc_i225.c | 11 +++-------- sys/dev/igc/igc_phy.c | 37 ++----------------------------------- sys/dev/igc/igc_phy.h | 1 - 6 files changed, 5 insertions(+), 61 deletions(-) diff --git a/sys/dev/igc/igc_api.c b/sys/dev/igc/igc_api.c index cad116c2395d..6aafc9898df8 100644 --- a/sys/dev/igc/igc_api.c +++ b/sys/dev/igc/igc_api.c @@ -535,21 +535,6 @@ s32 igc_phy_hw_reset(struct igc_hw *hw) return IGC_SUCCESS; } -/** - * igc_phy_commit - Soft PHY reset - * @hw: pointer to the HW structure - * - * Performs a soft PHY reset on those that apply. This is a function pointer - * entry point called by drivers. - **/ -s32 igc_phy_commit(struct igc_hw *hw) -{ - if (hw->phy.ops.commit) - return hw->phy.ops.commit(hw); - - return IGC_SUCCESS; -} - /** * igc_set_d0_lplu_state - Sets low power link up state for D0 * @hw: pointer to the HW structure diff --git a/sys/dev/igc/igc_api.h b/sys/dev/igc/igc_api.h index a0fc9ff21166..f9064b540c7c 100644 --- a/sys/dev/igc/igc_api.h +++ b/sys/dev/igc/igc_api.h @@ -42,7 +42,6 @@ s32 igc_get_phy_info(struct igc_hw *hw); void igc_release_phy(struct igc_hw *hw); s32 igc_acquire_phy(struct igc_hw *hw); s32 igc_phy_hw_reset(struct igc_hw *hw); -s32 igc_phy_commit(struct igc_hw *hw); void igc_power_up_phy(struct igc_hw *hw); void igc_power_down_phy(struct igc_hw *hw); s32 igc_read_mac_addr(struct igc_hw *hw); diff --git a/sys/dev/igc/igc_hw.h b/sys/dev/igc/igc_hw.h index a07d2894f97a..a8323a8578a9 100644 --- a/sys/dev/igc/igc_hw.h +++ b/sys/dev/igc/igc_hw.h @@ -382,7 +382,6 @@ struct igc_phy_operations { s32 (*init_params)(struct igc_hw *); s32 (*acquire)(struct igc_hw *); s32 (*check_reset_block)(struct igc_hw *); - s32 (*commit)(struct igc_hw *); s32 (*force_speed_duplex)(struct igc_hw *); s32 (*get_info)(struct igc_hw *); s32 (*set_page)(struct igc_hw *, u16); diff --git a/sys/dev/igc/igc_i225.c b/sys/dev/igc/igc_i225.c index 75c4b5125a97..4c50daa16b79 100644 --- a/sys/dev/igc/igc_i225.c +++ b/sys/dev/igc/igc_i225.c @@ -136,7 +136,6 @@ static s32 igc_init_phy_params_i225(struct igc_hw *hw) { struct igc_phy_info *phy = &hw->phy; s32 ret_val = IGC_SUCCESS; - u32 ctrl_ext; DEBUGFUNC("igc_init_phy_params_i225"); @@ -155,10 +154,10 @@ static s32 igc_init_phy_params_i225(struct igc_hw *hw) phy->ops.acquire = igc_acquire_phy_base; phy->ops.check_reset_block = igc_check_reset_block_generic; - phy->ops.commit = igc_phy_sw_reset_generic; phy->ops.release = igc_release_phy_base; - - ctrl_ext = IGC_READ_REG(hw, IGC_CTRL_EXT); + phy->ops.reset = igc_phy_hw_reset_generic; + phy->ops.read_reg = igc_read_phy_reg_gpy; + phy->ops.write_reg = igc_write_phy_reg_gpy; /* Make sure the PHY is in a good state. Several people have reported * firmware leaving the PHY's page select register set to something @@ -169,10 +168,6 @@ static s32 igc_init_phy_params_i225(struct igc_hw *hw) if (ret_val) goto out; - IGC_WRITE_REG(hw, IGC_CTRL_EXT, ctrl_ext); - phy->ops.read_reg = igc_read_phy_reg_gpy; - phy->ops.write_reg = igc_write_phy_reg_gpy; - ret_val = igc_get_phy_id(hw); /* Verify phy id and set remaining function pointers */ switch (phy->id) { diff --git a/sys/dev/igc/igc_phy.c b/sys/dev/igc/igc_phy.c index a1d71ab15829..a6823ddf7bac 100644 --- a/sys/dev/igc/igc_phy.c +++ b/sys/dev/igc/igc_phy.c @@ -26,7 +26,6 @@ void igc_init_phy_ops_generic(struct igc_hw *hw) phy->ops.init_params = igc_null_ops_generic; phy->ops.acquire = igc_null_ops_generic; phy->ops.check_reset_block = igc_null_ops_generic; - phy->ops.commit = igc_null_ops_generic; phy->ops.force_speed_duplex = igc_null_ops_generic; phy->ops.get_info = igc_null_ops_generic; phy->ops.set_page = igc_null_set_page; @@ -147,7 +146,7 @@ s32 igc_get_phy_id(struct igc_hw *hw) return ret_val; phy->id = (u32)(phy_id << 16); - usec_delay(20); + usec_delay(200); ret_val = phy->ops.read_reg(hw, PHY_ID2, &phy_id); if (ret_val) return ret_val; @@ -155,7 +154,6 @@ s32 igc_get_phy_id(struct igc_hw *hw) phy->id |= (u32)(phy_id & PHY_REVISION_MASK); phy->revision = (u32)(phy_id & ~PHY_REVISION_MASK); - return IGC_SUCCESS; } @@ -314,7 +312,7 @@ static s32 igc_phy_setup_autoneg(struct igc_hw *hw) if ((phy->autoneg_mask & ADVERTISE_2500_FULL) && hw->phy.id == I225_I_PHY_ID) { - /* Read the MULTI GBT AN Control Register - reg 7.32 */ + /* Read the MULTI GBT AN Control Register - reg 7.32 */ ret_val = phy->ops.read_reg(hw, (STANDARD_AN_REG_MASK << MMD_DEVADDR_SHIFT) | ANEG_MULTIGBT_AN_CTRL, @@ -847,37 +845,6 @@ s32 igc_phy_has_link_generic(struct igc_hw *hw, u32 iterations, return ret_val; } -/** - * igc_phy_sw_reset_generic - PHY software reset - * @hw: pointer to the HW structure - * - * Does a software reset of the PHY by reading the PHY control register and - * setting/write the control register reset bit to the PHY. - **/ -s32 igc_phy_sw_reset_generic(struct igc_hw *hw) -{ - s32 ret_val; - u16 phy_ctrl; - - DEBUGFUNC("igc_phy_sw_reset_generic"); - - if (!hw->phy.ops.read_reg) - return IGC_SUCCESS; - - ret_val = hw->phy.ops.read_reg(hw, PHY_CONTROL, &phy_ctrl); - if (ret_val) - return ret_val; - - phy_ctrl |= MII_CR_RESET; - ret_val = hw->phy.ops.write_reg(hw, PHY_CONTROL, phy_ctrl); - if (ret_val) - return ret_val; - - usec_delay(1); - - return ret_val; -} - /** * igc_phy_hw_reset_generic - PHY hardware reset * @hw: pointer to the HW structure diff --git a/sys/dev/igc/igc_phy.h b/sys/dev/igc/igc_phy.h index 61cc46cdc583..36fa0677c3e6 100644 --- a/sys/dev/igc/igc_phy.h +++ b/sys/dev/igc/igc_phy.h @@ -18,7 +18,6 @@ s32 igc_null_set_page(struct igc_hw *hw, u16 data); s32 igc_check_downshift_generic(struct igc_hw *hw); s32 igc_check_reset_block_generic(struct igc_hw *hw); s32 igc_get_phy_id(struct igc_hw *hw); -s32 igc_phy_sw_reset_generic(struct igc_hw *hw); void igc_phy_force_speed_duplex_setup(struct igc_hw *hw, u16 *phy_ctrl); s32 igc_phy_hw_reset_generic(struct igc_hw *hw); s32 igc_phy_reset_dsp_generic(struct igc_hw *hw); From nobody Sat Nov 13 00:53:59 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 664911839172; Sat, 13 Nov 2021 00:54:00 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HrcQw1RCzz538J; Sat, 13 Nov 2021 00:54:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 004B219CB; Sat, 13 Nov 2021 00:54:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AD0rx2K008993; Sat, 13 Nov 2021 00:53:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AD0rxAg008992; Sat, 13 Nov 2021 00:53:59 GMT (envelope-from git) Date: Sat, 13 Nov 2021 00:53:59 GMT Message-Id: <202111130053.1AD0rxAg008992@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Peter Grehan Subject: git: 73e1138208a5 - stable/12 - igc: correctly update RCTL when changing multicast filters. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: grehan X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 73e1138208a5888aaabfc44d8e48aa04554c9146 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by grehan: URL: https://cgit.FreeBSD.org/src/commit/?id=73e1138208a5888aaabfc44d8e48aa04554c9146 commit 73e1138208a5888aaabfc44d8e48aa04554c9146 Author: Peter Grehan AuthorDate: 2021-10-11 17:49:01 +0000 Commit: Peter Grehan CommitDate: 2021-11-13 00:58:34 +0000 igc: correctly update RCTL when changing multicast filters. Fix clearing of bits in RCTL for the non-bpf/non-allmulti case. Update RCTL after modifying the multicast filter registers as per the Linux driver. This fixes LACP on igc interfaces, where incoming LACP multicasti control packets were being dropped. Obtained from: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 5a3eb6207a353c3a18da8abcf00a2d75276dd29e) --- sys/dev/igc/if_igc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/igc/if_igc.c b/sys/dev/igc/if_igc.c index b72f55166907..06b78394cd2f 100644 --- a/sys/dev/igc/if_igc.c +++ b/sys/dev/igc/if_igc.c @@ -1172,12 +1172,12 @@ igc_if_multi_set(if_ctx_t ctx) reg_rctl |= IGC_RCTL_MPE; reg_rctl &= ~IGC_RCTL_UPE; } else - reg_rctl = ~(IGC_RCTL_UPE | IGC_RCTL_MPE); - - IGC_WRITE_REG(&adapter->hw, IGC_RCTL, reg_rctl); + reg_rctl &= ~(IGC_RCTL_UPE | IGC_RCTL_MPE); if (mcnt < MAX_NUM_MULTICAST_ADDRESSES) igc_update_mc_addr_list(&adapter->hw, mta, mcnt); + + IGC_WRITE_REG(&adapter->hw, IGC_RCTL, reg_rctl); } /********************************************************************* From nobody Sat Nov 13 00:54:01 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C28C0183936A; Sat, 13 Nov 2021 00:54:01 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HrcQx2hYrz53MR; Sat, 13 Nov 2021 00:54:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 277011E80; Sat, 13 Nov 2021 00:54:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AD0s1k0009025; Sat, 13 Nov 2021 00:54:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AD0s10X009024; Sat, 13 Nov 2021 00:54:01 GMT (envelope-from git) Date: Sat, 13 Nov 2021 00:54:01 GMT Message-Id: <202111130054.1AD0s10X009024@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Peter Grehan Subject: git: 267a39780ea8 - stable/12 - igc: Use hardware routine for PHY reset List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: grehan X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 267a39780ea8c89b7a89ca9e91dcfff02c69656f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by grehan: URL: https://cgit.FreeBSD.org/src/commit/?id=267a39780ea8c89b7a89ca9e91dcfff02c69656f commit 267a39780ea8c89b7a89ca9e91dcfff02c69656f Author: Peter Grehan AuthorDate: 2021-11-01 13:35:43 +0000 Commit: Peter Grehan CommitDate: 2021-11-13 01:14:09 +0000 igc: Use hardware routine for PHY reset Summary: The previously used software reset routine wasn't sufficient to reset the PHY if the bootloader hadn't left the device in an initialized state. This was seen with the onboard igc port on an 11th-gen Intel NUC. The software reset isn't used in the Linux driver so all related code has been removed. Tested on: Netgate 6100 onboard ports, a discrete PCIe I225-LM card, and an 11th-gen Intel NUC. Reported by: woodsb02 Tested by: woodsb02 (NUC) Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 561cd74b1704ab76a3286733fb43da53b6892ea4) --- sys/dev/igc/igc_api.c | 15 --------------- sys/dev/igc/igc_api.h | 1 - sys/dev/igc/igc_hw.h | 1 - sys/dev/igc/igc_i225.c | 11 +++-------- sys/dev/igc/igc_phy.c | 37 ++----------------------------------- sys/dev/igc/igc_phy.h | 1 - 6 files changed, 5 insertions(+), 61 deletions(-) diff --git a/sys/dev/igc/igc_api.c b/sys/dev/igc/igc_api.c index cad116c2395d..6aafc9898df8 100644 --- a/sys/dev/igc/igc_api.c +++ b/sys/dev/igc/igc_api.c @@ -535,21 +535,6 @@ s32 igc_phy_hw_reset(struct igc_hw *hw) return IGC_SUCCESS; } -/** - * igc_phy_commit - Soft PHY reset - * @hw: pointer to the HW structure - * - * Performs a soft PHY reset on those that apply. This is a function pointer - * entry point called by drivers. - **/ -s32 igc_phy_commit(struct igc_hw *hw) -{ - if (hw->phy.ops.commit) - return hw->phy.ops.commit(hw); - - return IGC_SUCCESS; -} - /** * igc_set_d0_lplu_state - Sets low power link up state for D0 * @hw: pointer to the HW structure diff --git a/sys/dev/igc/igc_api.h b/sys/dev/igc/igc_api.h index a0fc9ff21166..f9064b540c7c 100644 --- a/sys/dev/igc/igc_api.h +++ b/sys/dev/igc/igc_api.h @@ -42,7 +42,6 @@ s32 igc_get_phy_info(struct igc_hw *hw); void igc_release_phy(struct igc_hw *hw); s32 igc_acquire_phy(struct igc_hw *hw); s32 igc_phy_hw_reset(struct igc_hw *hw); -s32 igc_phy_commit(struct igc_hw *hw); void igc_power_up_phy(struct igc_hw *hw); void igc_power_down_phy(struct igc_hw *hw); s32 igc_read_mac_addr(struct igc_hw *hw); diff --git a/sys/dev/igc/igc_hw.h b/sys/dev/igc/igc_hw.h index a07d2894f97a..a8323a8578a9 100644 --- a/sys/dev/igc/igc_hw.h +++ b/sys/dev/igc/igc_hw.h @@ -382,7 +382,6 @@ struct igc_phy_operations { s32 (*init_params)(struct igc_hw *); s32 (*acquire)(struct igc_hw *); s32 (*check_reset_block)(struct igc_hw *); - s32 (*commit)(struct igc_hw *); s32 (*force_speed_duplex)(struct igc_hw *); s32 (*get_info)(struct igc_hw *); s32 (*set_page)(struct igc_hw *, u16); diff --git a/sys/dev/igc/igc_i225.c b/sys/dev/igc/igc_i225.c index 75c4b5125a97..4c50daa16b79 100644 --- a/sys/dev/igc/igc_i225.c +++ b/sys/dev/igc/igc_i225.c @@ -136,7 +136,6 @@ static s32 igc_init_phy_params_i225(struct igc_hw *hw) { struct igc_phy_info *phy = &hw->phy; s32 ret_val = IGC_SUCCESS; - u32 ctrl_ext; DEBUGFUNC("igc_init_phy_params_i225"); @@ -155,10 +154,10 @@ static s32 igc_init_phy_params_i225(struct igc_hw *hw) phy->ops.acquire = igc_acquire_phy_base; phy->ops.check_reset_block = igc_check_reset_block_generic; - phy->ops.commit = igc_phy_sw_reset_generic; phy->ops.release = igc_release_phy_base; - - ctrl_ext = IGC_READ_REG(hw, IGC_CTRL_EXT); + phy->ops.reset = igc_phy_hw_reset_generic; + phy->ops.read_reg = igc_read_phy_reg_gpy; + phy->ops.write_reg = igc_write_phy_reg_gpy; /* Make sure the PHY is in a good state. Several people have reported * firmware leaving the PHY's page select register set to something @@ -169,10 +168,6 @@ static s32 igc_init_phy_params_i225(struct igc_hw *hw) if (ret_val) goto out; - IGC_WRITE_REG(hw, IGC_CTRL_EXT, ctrl_ext); - phy->ops.read_reg = igc_read_phy_reg_gpy; - phy->ops.write_reg = igc_write_phy_reg_gpy; - ret_val = igc_get_phy_id(hw); /* Verify phy id and set remaining function pointers */ switch (phy->id) { diff --git a/sys/dev/igc/igc_phy.c b/sys/dev/igc/igc_phy.c index a1d71ab15829..a6823ddf7bac 100644 --- a/sys/dev/igc/igc_phy.c +++ b/sys/dev/igc/igc_phy.c @@ -26,7 +26,6 @@ void igc_init_phy_ops_generic(struct igc_hw *hw) phy->ops.init_params = igc_null_ops_generic; phy->ops.acquire = igc_null_ops_generic; phy->ops.check_reset_block = igc_null_ops_generic; - phy->ops.commit = igc_null_ops_generic; phy->ops.force_speed_duplex = igc_null_ops_generic; phy->ops.get_info = igc_null_ops_generic; phy->ops.set_page = igc_null_set_page; @@ -147,7 +146,7 @@ s32 igc_get_phy_id(struct igc_hw *hw) return ret_val; phy->id = (u32)(phy_id << 16); - usec_delay(20); + usec_delay(200); ret_val = phy->ops.read_reg(hw, PHY_ID2, &phy_id); if (ret_val) return ret_val; @@ -155,7 +154,6 @@ s32 igc_get_phy_id(struct igc_hw *hw) phy->id |= (u32)(phy_id & PHY_REVISION_MASK); phy->revision = (u32)(phy_id & ~PHY_REVISION_MASK); - return IGC_SUCCESS; } @@ -314,7 +312,7 @@ static s32 igc_phy_setup_autoneg(struct igc_hw *hw) if ((phy->autoneg_mask & ADVERTISE_2500_FULL) && hw->phy.id == I225_I_PHY_ID) { - /* Read the MULTI GBT AN Control Register - reg 7.32 */ + /* Read the MULTI GBT AN Control Register - reg 7.32 */ ret_val = phy->ops.read_reg(hw, (STANDARD_AN_REG_MASK << MMD_DEVADDR_SHIFT) | ANEG_MULTIGBT_AN_CTRL, @@ -847,37 +845,6 @@ s32 igc_phy_has_link_generic(struct igc_hw *hw, u32 iterations, return ret_val; } -/** - * igc_phy_sw_reset_generic - PHY software reset - * @hw: pointer to the HW structure - * - * Does a software reset of the PHY by reading the PHY control register and - * setting/write the control register reset bit to the PHY. - **/ -s32 igc_phy_sw_reset_generic(struct igc_hw *hw) -{ - s32 ret_val; - u16 phy_ctrl; - - DEBUGFUNC("igc_phy_sw_reset_generic"); - - if (!hw->phy.ops.read_reg) - return IGC_SUCCESS; - - ret_val = hw->phy.ops.read_reg(hw, PHY_CONTROL, &phy_ctrl); - if (ret_val) - return ret_val; - - phy_ctrl |= MII_CR_RESET; - ret_val = hw->phy.ops.write_reg(hw, PHY_CONTROL, phy_ctrl); - if (ret_val) - return ret_val; - - usec_delay(1); - - return ret_val; -} - /** * igc_phy_hw_reset_generic - PHY hardware reset * @hw: pointer to the HW structure diff --git a/sys/dev/igc/igc_phy.h b/sys/dev/igc/igc_phy.h index 61cc46cdc583..36fa0677c3e6 100644 --- a/sys/dev/igc/igc_phy.h +++ b/sys/dev/igc/igc_phy.h @@ -18,7 +18,6 @@ s32 igc_null_set_page(struct igc_hw *hw, u16 data); s32 igc_check_downshift_generic(struct igc_hw *hw); s32 igc_check_reset_block_generic(struct igc_hw *hw); s32 igc_get_phy_id(struct igc_hw *hw); -s32 igc_phy_sw_reset_generic(struct igc_hw *hw); void igc_phy_force_speed_duplex_setup(struct igc_hw *hw, u16 *phy_ctrl); s32 igc_phy_hw_reset_generic(struct igc_hw *hw); s32 igc_phy_reset_dsp_generic(struct igc_hw *hw); From nobody Sat Nov 13 04:02:49 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id AF1BF18552DF; Sat, 13 Nov 2021 04:02:49 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hrhcn4N22z4pZn; Sat, 13 Nov 2021 04:02:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 75C5D46B0; Sat, 13 Nov 2021 04:02:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AD42nnm064211; Sat, 13 Nov 2021 04:02:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AD42n39064210; Sat, 13 Nov 2021 04:02:49 GMT (envelope-from git) Date: Sat, 13 Nov 2021 04:02:49 GMT Message-Id: <202111130402.1AD42n39064210@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 1e5dc6aa1895 - stable/13 - Add some of Intel Alder Lake device IDs. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1e5dc6aa1895b0bd29b0105f7bb98b492e3d1a3f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=1e5dc6aa1895b0bd29b0105f7bb98b492e3d1a3f commit 1e5dc6aa1895b0bd29b0105f7bb98b492e3d1a3f Author: Alexander Motin AuthorDate: 2021-11-06 03:05:15 +0000 Commit: Alexander Motin CommitDate: 2021-11-13 04:02:46 +0000 Add some of Intel Alder Lake device IDs. MFC after: 1 week (cherry picked from commit dc238358f9f48ee4c983e2131656edb15636ab9e) --- sys/dev/ahci/ahci_pci.c | 1 + sys/dev/sound/pci/hda/hdac.c | 1 + sys/dev/sound/pci/hda/hdac.h | 3 +++ sys/dev/sound/pci/hda/hdacc.c | 2 ++ sys/dev/usb/controller/xhci_pci.c | 2 ++ 5 files changed, 9 insertions(+) diff --git a/sys/dev/ahci/ahci_pci.c b/sys/dev/ahci/ahci_pci.c index ccc107a14bc8..5fd4c53418c2 100644 --- a/sys/dev/ahci/ahci_pci.c +++ b/sys/dev/ahci/ahci_pci.c @@ -191,6 +191,7 @@ static const struct { {0x23a38086, 0x00, "Intel Coleto Creek", 0}, {0x31e38086, 0x00, "Intel Gemini Lake", 0}, {0x5ae38086, 0x00, "Intel Apollo Lake", 0}, + {0x7ae28086, 0x00, "Intel Alder Lake", 0}, {0x8c028086, 0x00, "Intel Lynx Point", 0}, {0x8c038086, 0x00, "Intel Lynx Point", 0}, {0x8c048086, 0x00, "Intel Lynx Point (RAID)", 0}, diff --git a/sys/dev/sound/pci/hda/hdac.c b/sys/dev/sound/pci/hda/hdac.c index ec907715c5b1..39ad44027557 100644 --- a/sys/dev/sound/pci/hda/hdac.c +++ b/sys/dev/sound/pci/hda/hdac.c @@ -112,6 +112,7 @@ static const struct { { HDA_INTEL_CMLKH, "Intel Comet Lake-H", 0, 0 }, { HDA_INTEL_TGLK, "Intel Tiger Lake", 0, 0 }, { HDA_INTEL_GMLK, "Intel Gemini Lake", 0, 0 }, + { HDA_INTEL_ALLK, "Intel Alder Lake", 0, 0 }, { HDA_INTEL_82801F, "Intel 82801F", 0, 0 }, { HDA_INTEL_63XXESB, "Intel 631x/632xESB", 0, 0 }, { HDA_INTEL_82801G, "Intel 82801G", 0, 0 }, diff --git a/sys/dev/sound/pci/hda/hdac.h b/sys/dev/sound/pci/hda/hdac.h index 8e427d3412da..f765bf61cb1a 100644 --- a/sys/dev/sound/pci/hda/hdac.h +++ b/sys/dev/sound/pci/hda/hdac.h @@ -70,6 +70,7 @@ #define HDA_INTEL_JLK2 HDA_MODEL_CONSTRUCT(INTEL, 0x4dc8) #define HDA_INTEL_BXTNP HDA_MODEL_CONSTRUCT(INTEL, 0x5a98) #define HDA_INTEL_MACBOOKPRO92 HDA_MODEL_CONSTRUCT(INTEL, 0x7270) +#define HDA_INTEL_ALLK HDA_MODEL_CONSTRUCT(INTEL, 0x7ad0) #define HDA_INTEL_SCH HDA_MODEL_CONSTRUCT(INTEL, 0x811b) #define HDA_INTEL_LPT1 HDA_MODEL_CONSTRUCT(INTEL, 0x8c20) #define HDA_INTEL_LPT2 HDA_MODEL_CONSTRUCT(INTEL, 0x8c21) @@ -434,6 +435,7 @@ #define HDA_CODEC_ALC888 HDA_CODEC_CONSTRUCT(REALTEK, 0x0888) #define HDA_CODEC_ALC889 HDA_CODEC_CONSTRUCT(REALTEK, 0x0889) #define HDA_CODEC_ALC892 HDA_CODEC_CONSTRUCT(REALTEK, 0x0892) +#define HDA_CODEC_ALC897 HDA_CODEC_CONSTRUCT(REALTEK, 0x0897) #define HDA_CODEC_ALC899 HDA_CODEC_CONSTRUCT(REALTEK, 0x0899) #define HDA_CODEC_ALC1150 HDA_CODEC_CONSTRUCT(REALTEK, 0x0900) #define HDA_CODEC_ALCS1200A HDA_CODEC_CONSTRUCT(REALTEK, 0x0b00) @@ -730,6 +732,7 @@ #define HDA_CODEC_INTELGMLK1 HDA_CODEC_CONSTRUCT(INTEL, 0x280d) #define HDA_CODEC_INTELICLK HDA_CODEC_CONSTRUCT(INTEL, 0x280f) #define HDA_CODEC_INTELTGLK HDA_CODEC_CONSTRUCT(INTEL, 0x2812) +#define HDA_CODEC_INTELALLK HDA_CODEC_CONSTRUCT(INTEL, 0x2815) #define HDA_CODEC_INTELJLK HDA_CODEC_CONSTRUCT(INTEL, 0x281a) #define HDA_CODEC_INTELELLK HDA_CODEC_CONSTRUCT(INTEL, 0x281b) #define HDA_CODEC_INTELCT HDA_CODEC_CONSTRUCT(INTEL, 0x2880) diff --git a/sys/dev/sound/pci/hda/hdacc.c b/sys/dev/sound/pci/hda/hdacc.c index 3b1ca7ea61e5..06c1eb444dce 100644 --- a/sys/dev/sound/pci/hda/hdacc.c +++ b/sys/dev/sound/pci/hda/hdacc.c @@ -147,6 +147,7 @@ static const struct { { HDA_CODEC_ALC888, 0, "Realtek ALC888" }, { HDA_CODEC_ALC889, 0, "Realtek ALC889" }, { HDA_CODEC_ALC892, 0, "Realtek ALC892" }, + { HDA_CODEC_ALC897, 0, "Realtek ALC897" }, { HDA_CODEC_ALC899, 0, "Realtek ALC899" }, { HDA_CODEC_ALC1150, 0, "Realtek ALC1150" }, { HDA_CODEC_ALCS1200A, 0, "Realtek ALCS1200A" }, @@ -392,6 +393,7 @@ static const struct { { HDA_CODEC_INTELGMLK1, 0, "Intel Gemini Lake" }, { HDA_CODEC_INTELICLK, 0, "Intel Ice Lake" }, { HDA_CODEC_INTELTGLK, 0, "Intel Tiger Lake" }, + { HDA_CODEC_INTELALLK, 0, "Intel Alder Lake" }, { HDA_CODEC_SII1390, 0, "Silicon Image SiI1390" }, { HDA_CODEC_SII1392, 0, "Silicon Image SiI1392" }, /* Unknown CODECs */ diff --git a/sys/dev/usb/controller/xhci_pci.c b/sys/dev/usb/controller/xhci_pci.c index 615d16ee3740..7ed0420b7664 100644 --- a/sys/dev/usb/controller/xhci_pci.c +++ b/sys/dev/usb/controller/xhci_pci.c @@ -134,6 +134,8 @@ xhci_pci_match(device_t self) return ("Intel Gemini Lake USB 3.0 controller"); case 0x5aa88086: return ("Intel Apollo Lake USB 3.0 controller"); + case 0x7ae08086: + return ("Intel Alder Lake USB 3.2 controller"); case 0x8c318086: return ("Intel Lynx Point USB 3.0 controller"); case 0x8cb18086: From nobody Sat Nov 13 04:03:14 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E7DE21855628; Sat, 13 Nov 2021 04:03:14 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HrhdG69hBz4pfF; Sat, 13 Nov 2021 04:03:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B475F483E; Sat, 13 Nov 2021 04:03:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AD43EKX064360; Sat, 13 Nov 2021 04:03:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AD43Ei1064359; Sat, 13 Nov 2021 04:03:14 GMT (envelope-from git) Date: Sat, 13 Nov 2021 04:03:14 GMT Message-Id: <202111130403.1AD43Ei1064359@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 08f5721e4c10 - stable/12 - Add some of Intel Alder Lake device IDs. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 08f5721e4c1019664f5ba802363ed75e7d91283e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=08f5721e4c1019664f5ba802363ed75e7d91283e commit 08f5721e4c1019664f5ba802363ed75e7d91283e Author: Alexander Motin AuthorDate: 2021-11-06 03:05:15 +0000 Commit: Alexander Motin CommitDate: 2021-11-13 04:03:12 +0000 Add some of Intel Alder Lake device IDs. MFC after: 1 week (cherry picked from commit dc238358f9f48ee4c983e2131656edb15636ab9e) --- sys/dev/ahci/ahci_pci.c | 1 + sys/dev/sound/pci/hda/hdac.c | 1 + sys/dev/sound/pci/hda/hdac.h | 3 +++ sys/dev/sound/pci/hda/hdacc.c | 2 ++ sys/dev/usb/controller/xhci_pci.c | 2 ++ 5 files changed, 9 insertions(+) diff --git a/sys/dev/ahci/ahci_pci.c b/sys/dev/ahci/ahci_pci.c index 590da7b50050..fd0a808f1d9c 100644 --- a/sys/dev/ahci/ahci_pci.c +++ b/sys/dev/ahci/ahci_pci.c @@ -187,6 +187,7 @@ static const struct { {0x23a38086, 0x00, "Intel Coleto Creek", 0}, {0x31e38086, 0x00, "Intel Gemini Lake", 0}, {0x5ae38086, 0x00, "Intel Apollo Lake", 0}, + {0x7ae28086, 0x00, "Intel Alder Lake", 0}, {0x8c028086, 0x00, "Intel Lynx Point", 0}, {0x8c038086, 0x00, "Intel Lynx Point", 0}, {0x8c048086, 0x00, "Intel Lynx Point (RAID)", 0}, diff --git a/sys/dev/sound/pci/hda/hdac.c b/sys/dev/sound/pci/hda/hdac.c index 90358876054e..a9d13f1a03e6 100644 --- a/sys/dev/sound/pci/hda/hdac.c +++ b/sys/dev/sound/pci/hda/hdac.c @@ -113,6 +113,7 @@ static const struct { { HDA_INTEL_CMLKH, "Intel Comet Lake-H", 0, 0 }, { HDA_INTEL_TGLK, "Intel Tiger Lake", 0, 0 }, { HDA_INTEL_GMLK, "Intel Gemini Lake", 0, 0 }, + { HDA_INTEL_ALLK, "Intel Alder Lake", 0, 0 }, { HDA_INTEL_82801F, "Intel 82801F", 0, 0 }, { HDA_INTEL_63XXESB, "Intel 631x/632xESB", 0, 0 }, { HDA_INTEL_82801G, "Intel 82801G", 0, 0 }, diff --git a/sys/dev/sound/pci/hda/hdac.h b/sys/dev/sound/pci/hda/hdac.h index 8e427d3412da..f765bf61cb1a 100644 --- a/sys/dev/sound/pci/hda/hdac.h +++ b/sys/dev/sound/pci/hda/hdac.h @@ -70,6 +70,7 @@ #define HDA_INTEL_JLK2 HDA_MODEL_CONSTRUCT(INTEL, 0x4dc8) #define HDA_INTEL_BXTNP HDA_MODEL_CONSTRUCT(INTEL, 0x5a98) #define HDA_INTEL_MACBOOKPRO92 HDA_MODEL_CONSTRUCT(INTEL, 0x7270) +#define HDA_INTEL_ALLK HDA_MODEL_CONSTRUCT(INTEL, 0x7ad0) #define HDA_INTEL_SCH HDA_MODEL_CONSTRUCT(INTEL, 0x811b) #define HDA_INTEL_LPT1 HDA_MODEL_CONSTRUCT(INTEL, 0x8c20) #define HDA_INTEL_LPT2 HDA_MODEL_CONSTRUCT(INTEL, 0x8c21) @@ -434,6 +435,7 @@ #define HDA_CODEC_ALC888 HDA_CODEC_CONSTRUCT(REALTEK, 0x0888) #define HDA_CODEC_ALC889 HDA_CODEC_CONSTRUCT(REALTEK, 0x0889) #define HDA_CODEC_ALC892 HDA_CODEC_CONSTRUCT(REALTEK, 0x0892) +#define HDA_CODEC_ALC897 HDA_CODEC_CONSTRUCT(REALTEK, 0x0897) #define HDA_CODEC_ALC899 HDA_CODEC_CONSTRUCT(REALTEK, 0x0899) #define HDA_CODEC_ALC1150 HDA_CODEC_CONSTRUCT(REALTEK, 0x0900) #define HDA_CODEC_ALCS1200A HDA_CODEC_CONSTRUCT(REALTEK, 0x0b00) @@ -730,6 +732,7 @@ #define HDA_CODEC_INTELGMLK1 HDA_CODEC_CONSTRUCT(INTEL, 0x280d) #define HDA_CODEC_INTELICLK HDA_CODEC_CONSTRUCT(INTEL, 0x280f) #define HDA_CODEC_INTELTGLK HDA_CODEC_CONSTRUCT(INTEL, 0x2812) +#define HDA_CODEC_INTELALLK HDA_CODEC_CONSTRUCT(INTEL, 0x2815) #define HDA_CODEC_INTELJLK HDA_CODEC_CONSTRUCT(INTEL, 0x281a) #define HDA_CODEC_INTELELLK HDA_CODEC_CONSTRUCT(INTEL, 0x281b) #define HDA_CODEC_INTELCT HDA_CODEC_CONSTRUCT(INTEL, 0x2880) diff --git a/sys/dev/sound/pci/hda/hdacc.c b/sys/dev/sound/pci/hda/hdacc.c index ecec360ebccf..6e31dc157f8b 100644 --- a/sys/dev/sound/pci/hda/hdacc.c +++ b/sys/dev/sound/pci/hda/hdacc.c @@ -148,6 +148,7 @@ static const struct { { HDA_CODEC_ALC888, 0, "Realtek ALC888" }, { HDA_CODEC_ALC889, 0, "Realtek ALC889" }, { HDA_CODEC_ALC892, 0, "Realtek ALC892" }, + { HDA_CODEC_ALC897, 0, "Realtek ALC897" }, { HDA_CODEC_ALC899, 0, "Realtek ALC899" }, { HDA_CODEC_ALC1150, 0, "Realtek ALC1150" }, { HDA_CODEC_ALCS1200A, 0, "Realtek ALCS1200A" }, @@ -393,6 +394,7 @@ static const struct { { HDA_CODEC_INTELGMLK1, 0, "Intel Gemini Lake" }, { HDA_CODEC_INTELICLK, 0, "Intel Ice Lake" }, { HDA_CODEC_INTELTGLK, 0, "Intel Tiger Lake" }, + { HDA_CODEC_INTELALLK, 0, "Intel Alder Lake" }, { HDA_CODEC_SII1390, 0, "Silicon Image SiI1390" }, { HDA_CODEC_SII1392, 0, "Silicon Image SiI1392" }, /* Unknown CODECs */ diff --git a/sys/dev/usb/controller/xhci_pci.c b/sys/dev/usb/controller/xhci_pci.c index 4c64fc5c8d94..360595cbc6c6 100644 --- a/sys/dev/usb/controller/xhci_pci.c +++ b/sys/dev/usb/controller/xhci_pci.c @@ -138,6 +138,8 @@ xhci_pci_match(device_t self) return ("Intel Gemini Lake USB 3.0 controller"); case 0x5aa88086: return ("Intel Apollo Lake USB 3.0 controller"); + case 0x7ae08086: + return ("Intel Alder Lake USB 3.2 controller"); case 0x8c318086: return ("Intel Lynx Point USB 3.0 controller"); case 0x8cb18086: From nobody Sat Nov 13 06:15:10 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D81251845EB3; Sat, 13 Nov 2021 06:15:10 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HrlYV5cXrz4Tvm; Sat, 13 Nov 2021 06:15:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9D65D5FEE; Sat, 13 Nov 2021 06:15:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AD6FAqu037588; Sat, 13 Nov 2021 06:15:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AD6FAYB037587; Sat, 13 Nov 2021 06:15:10 GMT (envelope-from git) Date: Sat, 13 Nov 2021 06:15:10 GMT Message-Id: <202111130615.1AD6FAYB037587@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Guangyuan Yang Subject: git: de5334c8c988 - stable/13 - sockstat(1): Update Synopsis section List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ygy X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: de5334c8c988a1f5859f5b3b2dfe0e002d3a90a1 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by ygy (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=de5334c8c988a1f5859f5b3b2dfe0e002d3a90a1 commit de5334c8c988a1f5859f5b3b2dfe0e002d3a90a1 Author: Felix Johnson AuthorDate: 2021-11-10 20:22:06 +0000 Commit: Guangyuan Yang CommitDate: 2021-11-13 06:14:51 +0000 sockstat(1): Update Synopsis section Update sockstat(1) manpage so the Synopsis section includes q (silent mode) and the -j argument name is consistent. PR: 256795 Reported by: Nick Reilly (cherry picked from commit 5504d8394289853e8c065e88a83fb464cb50d934) --- usr.bin/sockstat/sockstat.1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.bin/sockstat/sockstat.1 b/usr.bin/sockstat/sockstat.1 index f602ad467f9f..bf04028ce9d4 100644 --- a/usr.bin/sockstat/sockstat.1 +++ b/usr.bin/sockstat/sockstat.1 @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 28, 2021 +.Dd November 11, 2021 .Dt SOCKSTAT 1 .Os .Sh NAME @@ -35,8 +35,8 @@ .Nd list open sockets .Sh SYNOPSIS .Nm -.Op Fl 46CcLlnSsUuvw -.Op Fl j Ar jid +.Op Fl 46CcLlnqSsUuvw +.Op Fl j Ar jail .Op Fl p Ar ports .Op Fl P Ar protocols .Sh DESCRIPTION From nobody Sat Nov 13 09:05:00 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E325A18555E4; Sat, 13 Nov 2021 09:05:00 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HrqKS65zgz3rjY; Sat, 13 Nov 2021 09:05:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B32DD108DD; Sat, 13 Nov 2021 09:05:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AD950vi064673; Sat, 13 Nov 2021 09:05:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AD950Tk064672; Sat, 13 Nov 2021 09:05:00 GMT (envelope-from git) Date: Sat, 13 Nov 2021 09:05:00 GMT Message-Id: <202111130905.1AD950Tk064672@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andriy Gapon Subject: git: c9882d7600f9 - stable/13 - htu21: don't needlessly bother hardware when measurements are not needed List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c9882d7600f95d5aa9dfb369548900148a47a950 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=c9882d7600f95d5aa9dfb369548900148a47a950 commit c9882d7600f95d5aa9dfb369548900148a47a950 Author: Andriy Gapon AuthorDate: 2021-11-06 16:47:32 +0000 Commit: Andriy Gapon CommitDate: 2021-11-13 08:59:33 +0000 htu21: don't needlessly bother hardware when measurements are not needed sysctl(8) first queries a sysctl to get a size of its value even if the sysctl is of a fixed size, e.g. it has an integer type. Only after that sysctl(8) queries an actual value of the sysctl. Previosuly the driver would needlessly read a sensor in the first step. (cherry picked from commit 43b031a371eb90c15c390c26202f5f58d09300ef) --- sys/dev/iicbus/htu21.c | 88 +++++++++++++++++++++++++++----------------------- 1 file changed, 48 insertions(+), 40 deletions(-) diff --git a/sys/dev/iicbus/htu21.c b/sys/dev/iicbus/htu21.c index 5c59ebe8f54a..24f868eb5165 100644 --- a/sys/dev/iicbus/htu21.c +++ b/sys/dev/iicbus/htu21.c @@ -192,21 +192,24 @@ htu21_temp_sysctl(SYSCTL_HANDLER_ARGS) dev = arg1; sc = device_get_softc(dev); - if (sc->sc_hold) - error = htu21_get_measurement(dev, HTU21_GET_TEMP, - raw_data, nitems(raw_data)); - else - error = htu21_get_measurement_nohold(dev, HTU21_GET_TEMP_NH, - raw_data, nitems(raw_data)); - - if (error != 0) { - return (EIO); - } else if (!check_crc_16(raw_data, raw_data[2])) { - temp = -1; - sc->sc_errcount++; - } else { - temp = (((uint16_t)raw_data[0]) << 8) | (raw_data[1] & 0xfc); - temp = ((temp * 17572) >> 16 ) + 27315 - 4685; + if (req->oldptr != NULL) { + if (sc->sc_hold) + error = htu21_get_measurement(dev, HTU21_GET_TEMP, + raw_data, nitems(raw_data)); + else + error = htu21_get_measurement_nohold(dev, + HTU21_GET_TEMP_NH, raw_data, nitems(raw_data)); + + if (error != 0) { + return (EIO); + } else if (!check_crc_16(raw_data, raw_data[2])) { + temp = -1; + sc->sc_errcount++; + } else { + temp = (((uint16_t)raw_data[0]) << 8) | + (raw_data[1] & 0xfc); + temp = ((temp * 17572) >> 16 ) + 27315 - 4685; + } } error = sysctl_handle_int(oidp, &temp, 0, req); @@ -224,21 +227,24 @@ htu21_rh_sysctl(SYSCTL_HANDLER_ARGS) dev = arg1; sc = device_get_softc(dev); - if (sc->sc_hold) - error = htu21_get_measurement(dev, HTU21_GET_HUM, - raw_data, nitems(raw_data)); - else - error = htu21_get_measurement_nohold(dev, HTU21_GET_HUM_NH, - raw_data, nitems(raw_data)); - - if (error != 0) { - return (EIO); - } else if (!check_crc_16(raw_data, raw_data[2])) { - rh = -1; - sc->sc_errcount++; - } else { - rh = (((uint16_t)raw_data[0]) << 8) | (raw_data[1] & 0xfc); - rh = ((rh * 12500) >> 16 ) - 600; + if (req->oldptr != NULL) { + if (sc->sc_hold) + error = htu21_get_measurement(dev, HTU21_GET_HUM, + raw_data, nitems(raw_data)); + else + error = htu21_get_measurement_nohold(dev, + HTU21_GET_HUM_NH, raw_data, nitems(raw_data)); + + if (error != 0) { + return (EIO); + } else if (!check_crc_16(raw_data, raw_data[2])) { + rh = -1; + sc->sc_errcount++; + } else { + rh = (((uint16_t)raw_data[0]) << 8) | + (raw_data[1] & 0xfc); + rh = ((rh * 12500) >> 16 ) - 600; + } } error = sysctl_handle_int(oidp, &rh, 0, req); @@ -302,11 +308,12 @@ htu21_heater_sysctl(SYSCTL_HANDLER_ARGS) dev = arg1; sc = device_get_softc(dev); - error = htu21_get_cfg(dev, &cfg); - if (error != 0) - return (EIO); - - heater = (cfg & 0x04) != 0; + if (req->oldptr != NULL) { + error = htu21_get_cfg(dev, &cfg); + if (error != 0) + return (EIO); + heater = (cfg & 0x04) != 0; + } error = sysctl_handle_int(oidp, &heater, 0, req); if (error != 0 || req->newptr == NULL) return (error); @@ -328,11 +335,12 @@ htu21_power_sysctl(SYSCTL_HANDLER_ARGS) dev = arg1; sc = device_get_softc(dev); - error = htu21_get_cfg(dev, &cfg); - if (error != 0) - return (EIO); - - power = (cfg & 0x40) == 0; + if (req->oldptr != NULL) { + error = htu21_get_cfg(dev, &cfg); + if (error != 0) + return (EIO); + power = (cfg & 0x40) == 0; + } error = sysctl_handle_int(oidp, &power, 0, req); return (error); } From nobody Sat Nov 13 09:05:01 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 99736185575A; Sat, 13 Nov 2021 09:05:02 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HrqKV26tGz3rrv; Sat, 13 Nov 2021 09:05:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D689F10ABB; Sat, 13 Nov 2021 09:05:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AD9516B064697; Sat, 13 Nov 2021 09:05:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AD951Ha064696; Sat, 13 Nov 2021 09:05:01 GMT (envelope-from git) Date: Sat, 13 Nov 2021 09:05:01 GMT Message-Id: <202111130905.1AD951Ha064696@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andriy Gapon Subject: git: 737ed8b99f7d - stable/13 - htu21: allow configuration via hints on FDT-based systems List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 737ed8b99f7d10c0fc15e4dcfc58d5ada2997e5d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=737ed8b99f7d10c0fc15e4dcfc58d5ada2997e5d commit 737ed8b99f7d10c0fc15e4dcfc58d5ada2997e5d Author: Andriy Gapon AuthorDate: 2021-11-04 11:56:12 +0000 Commit: Andriy Gapon CommitDate: 2021-11-13 09:04:29 +0000 htu21: allow configuration via hints on FDT-based systems On-board devices should be configured via the FDT and overlays. Hints are primarily useful for external and temporarily attached devices. Adding hints is much easier and faster than writing and compiling an overlay. (cherry picked from commit a75159eabc90dc35af68c92f7d5eb72e087f6131) --- sys/dev/iicbus/htu21.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sys/dev/iicbus/htu21.c b/sys/dev/iicbus/htu21.c index 24f868eb5165..6b834354d73f 100644 --- a/sys/dev/iicbus/htu21.c +++ b/sys/dev/iicbus/htu21.c @@ -466,11 +466,17 @@ static int htu21_probe(device_t dev) { uint8_t addr; + int rc; #ifdef FDT - if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data) + if (!ofw_bus_status_okay(dev)) return (ENXIO); + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data) + rc = BUS_PROBE_GENERIC; + else #endif + rc = BUS_PROBE_NOWILDCARD; + addr = iicbus_get_addr(dev); if (addr != (HTU21_ADDR << 1)) { device_printf(dev, "non-standard slave address 0x%02x\n", @@ -478,7 +484,7 @@ htu21_probe(device_t dev) } device_set_desc(dev, "HTU21 temperature and humidity sensor"); - return (BUS_PROBE_GENERIC); + return (rc); } static int @@ -524,6 +530,4 @@ static devclass_t htu21_devclass; DRIVER_MODULE(htu21, iicbus, htu21_driver, htu21_devclass, 0, 0); MODULE_DEPEND(htu21, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER); MODULE_VERSION(htu21, 1); -#ifdef FDT IICBUS_FDT_PNP_INFO(compat_data); -#endif From nobody Sat Nov 13 09:11:05 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6B613185787B; Sat, 13 Nov 2021 09:11:05 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HrqST2VYrz3tV8; Sat, 13 Nov 2021 09:11:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 33DF410AC7; Sat, 13 Nov 2021 09:11:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AD9B52V075164; Sat, 13 Nov 2021 09:11:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AD9B5IU075163; Sat, 13 Nov 2021 09:11:05 GMT (envelope-from git) Date: Sat, 13 Nov 2021 09:11:05 GMT Message-Id: <202111130911.1AD9B5IU075163@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andriy Gapon Subject: git: d6f71e09a789 - stable/13 - pcf8591: driver for adc/dac with i2c interface List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d6f71e09a789f57f28d397c032ead62dc0b09c48 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=d6f71e09a789f57f28d397c032ead62dc0b09c48 commit d6f71e09a789f57f28d397c032ead62dc0b09c48 Author: Andriy Gapon AuthorDate: 2020-08-17 10:05:11 +0000 Commit: Andriy Gapon CommitDate: 2021-11-13 09:10:44 +0000 pcf8591: driver for adc/dac with i2c interface (cherry picked from commit a60b30469741392e66ec6fd21a8d5c4810a2d407) --- share/man/man4/Makefile | 1 + share/man/man4/pcf8591.4 | 122 ++++++++++++++++++ sys/conf/files | 1 + sys/dev/iicbus/pcf8591.c | 271 +++++++++++++++++++++++++++++++++++++++ sys/modules/i2c/Makefile | 1 + sys/modules/i2c/pcf8591/Makefile | 17 +++ 6 files changed, 413 insertions(+) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 2f3283e14573..e80b451f20b2 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -424,6 +424,7 @@ MAN= aac.4 \ pccard.4 \ pccbb.4 \ pcf.4 \ + pcf8591.4 \ ${_pchtherm.4} \ pci.4 \ pcib.4 \ diff --git a/share/man/man4/pcf8591.4 b/share/man/man4/pcf8591.4 new file mode 100644 index 000000000000..2876ad057f90 --- /dev/null +++ b/share/man/man4/pcf8591.4 @@ -0,0 +1,122 @@ +.\" +.\" 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: head/share/man/man4/cp2112.4 364144 2020-08-12 09:42:05Z avg $ +.\" +.Dd November 6, 2021 +.Dt PCF8591 4 +.Os +.Sh NAME +.Nm pcf8591 +.Nd driver for the PCF8591 8-bit A/D and D/A converter +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device pcf8591" +.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 +pcf8591_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver supports reading four inputs and setting one output over I2C. +The hardware supports configuring the input lines as: +.Bl -bullet +.It +four single-ended inputs +.It +three differential inputs (one input line is shared between all three inputs) +.It +two single-ended inputs and one differential input +.It +two differential inputs. +.El +.Pp +The +.Nm +driver reports data via +.Xr sysctl 8 +entries in the device's node in the +.Xr sysctl 8 +tree: +.Bl -tag -width inputs.%d +.It Va inputs.%d +The input level of the corresponding input in steps between 0 and 255. +Absolute voltage depends on an actual reference voltage. +.El +.Pp +On an +.Xr FDT 4 +based system the following properties must be set: +.Bl -tag -width "compatible" +.It Va compatible +Must be set to "nxp,pcf8591". +.It Va reg +The I2C address of +.Nm . +It should be in the range from 0x40 to 0x4f (7-bit). +.El +.Pp +The DTS part for a +.Nm +device usually looks like: +.Bd -literal +/ { + + ... + pcf8591adc { + compatible = "nxp,pcf8591"; + reg = <0x48>; + }; +}; +.Ed +.Sh SEE ALSO +.Xr fdt 4 , +.Xr iicbus 4 , +.Xr sysctl 8 +.Sh HISTORY +The +.Nm +driver and this manual page was written by +.An Andriy Gapon Aq Mt avg@FreeBSD.org . +.Sh BUGS +The +.Nm +driver does not support changing the input configuration. +All input lines are configured as single-ended inputs. +.Pp +The +.Nm +driver does not support setting the output. +It is always disabled (tri-state). diff --git a/sys/conf/files b/sys/conf/files index 282a86d74347..92e68a0b103e 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1885,6 +1885,7 @@ dev/iicbus/mux/iic_gpiomux.c optional iic_gpiomux fdt dev/iicbus/mux/ltc430x.c optional ltc430x dev/iicbus/nxprtc.c optional nxprtc | pcf8563 dev/iicbus/ofw_iicbus.c optional fdt iicbus +dev/iicbus/pcf8591.c optional pcf8591 dev/iicbus/rtc8583.c optional rtc8583 dev/iicbus/rtc/rx8803.c optional rx8803 iicbus fdt dev/iicbus/s35390a.c optional s35390a diff --git a/sys/dev/iicbus/pcf8591.c b/sys/dev/iicbus/pcf8591.c new file mode 100644 index 000000000000..ff769b368d91 --- /dev/null +++ b/sys/dev/iicbus/pcf8591.c @@ -0,0 +1,271 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 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. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_platform.h" + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#ifdef FDT +#include +#include +#endif + +/* + * Driver for PCF8591 I2C 8-bit ADC and DAC. + */ +#define CTRL_CH_SELECT_MASK 0x03 +#define CTRL_AUTOINC_EN 0x04 +#define CTRL_CH_CONFIG_MASK 0x30 +#define CTRL_CH_CONFIG_4_SINGLE 0x00 +#define CTRL_CH_CONFIG_3_DIFF 0x10 +#define CTRL_CH_CONFIG_2_SINGLE_1_DIFF 0x20 +#define CTRL_CH_CONFIG_2_DIFF 0x30 +#define CTRL_OUTPUT_EN 0x40 + +struct pcf8591_softc { + device_t sc_dev; + int sc_ch_count; + uint8_t sc_addr; + uint8_t sc_cfg; + uint8_t sc_output; +}; + +#ifdef FDT +static struct ofw_compat_data compat_data[] = { + { "nxp,pcf8591", true }, + { NULL, false } +}; +#endif + +static int +pcf8591_set_config(device_t dev) +{ + + struct iic_msg msg; + uint8_t data[2]; + struct pcf8591_softc *sc; + int error; + + sc = device_get_softc(dev); + data[0] = sc->sc_cfg; + data[1] = sc->sc_output; + msg.slave = sc->sc_addr; + msg.flags = IIC_M_WR; + msg.len = nitems(data); + msg.buf = data; + + error = iicbus_transfer_excl(dev, &msg, 1, IIC_INTRWAIT); + return (error); +} + +static int +pcf8591_get_reading(device_t dev, uint8_t *reading) +{ + struct iic_msg msg; + struct pcf8591_softc *sc; + int error; + + sc = device_get_softc(dev); + + msg.slave = sc->sc_addr; + msg.flags = IIC_M_RD; + msg.len = 1; + msg.buf = reading; + + error = iicbus_transfer_excl(dev, &msg, 1, IIC_INTRWAIT); + return (error); +} + +static int +pcf8591_select_channel(device_t dev, int channel) +{ + struct pcf8591_softc *sc; + int error; + uint8_t unused; + + sc = device_get_softc(dev); + if (channel >= sc->sc_ch_count) + return (EINVAL); + sc->sc_cfg &= ~CTRL_CH_SELECT_MASK; + sc->sc_cfg += channel; + error = pcf8591_set_config(dev); + if (error != 0) + return (error); + + /* + * The next read is still for the old channel, + * so do it and discard. + */ + error = pcf8591_get_reading(dev, &unused); + return (error); +} + +static int +pcf8591_channel_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct pcf8591_softc *sc; + device_t dev; + int error, channel, val; + uint8_t reading; + + dev = arg1; + channel = arg2; + sc = device_get_softc(dev); + + if (req->oldptr != NULL) { + error = pcf8591_select_channel(dev, channel); + if (error != 0) + return (EIO); + error = pcf8591_get_reading(dev, &reading); + if (error != 0) + return (EIO); + val = reading; + } + error = sysctl_handle_int(oidp, &val, 0, req); + return (error); +} + +static void +pcf8591_start(void *arg) +{ + device_t dev; + struct pcf8591_softc *sc; + struct sysctl_ctx_list *ctx; + struct sysctl_oid *tree_node; + struct sysctl_oid_list *tree; + struct sysctl_oid *inputs_node; + struct sysctl_oid_list *inputs; + int error; + + sc = arg; + dev = sc->sc_dev; + + /* + * Set initial -- and, for the time being, fixed -- configuration. + * Channel auto-incrementi is disabled, although it could be more + * performant and precise for bulk channel queries. + * The inputs are configured as four single channels. + * The output is disabled. + */ + sc->sc_cfg = 0; + sc->sc_output = 0; + sc->sc_ch_count = 4; + error = pcf8591_set_config(dev); + + ctx = device_get_sysctl_ctx(dev); + tree_node = device_get_sysctl_tree(dev); + tree = SYSCTL_CHILDREN(tree_node); + + inputs_node = SYSCTL_ADD_NODE(ctx, tree, OID_AUTO, "inputs", + CTLTYPE_NODE, NULL, "Input channels"); + inputs = SYSCTL_CHILDREN(inputs_node); + for (int i = 0; i < sc->sc_ch_count; i++) { + char buf[4]; + + snprintf(buf, sizeof(buf), "%d", i); + SYSCTL_ADD_PROC(ctx, inputs, OID_AUTO, buf, + CTLTYPE_INT | CTLFLAG_RD, dev, i, + pcf8591_channel_sysctl, "I", "Input level from 0 to 255 " + "(relative to Vref)"); + } +} + +static int +pcf8591_probe(device_t dev) +{ +#ifdef FDT + if (!ofw_bus_status_okay(dev)) + return (ENXIO); +#endif + device_set_desc(dev, "PCF8591 8-bit ADC / DAC"); +#ifdef FDT + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data) + return (BUS_PROBE_GENERIC); +#endif + return (BUS_PROBE_NOWILDCARD); +} + +static int +pcf8591_attach(device_t dev) +{ + struct pcf8591_softc *sc; + + sc = device_get_softc(dev); + sc->sc_dev = dev; + sc->sc_addr = iicbus_get_addr(dev); + + /* + * We have to wait until interrupts are enabled. Usually I2C read + * and write only works when the interrupts are available. + */ + config_intrhook_oneshot(pcf8591_start, sc); + return (0); +} + +static int +pcf8591_detach(device_t dev) +{ + return (0); +} + +static device_method_t pcf8591_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, pcf8591_probe), + DEVMETHOD(device_attach, pcf8591_attach), + DEVMETHOD(device_detach, pcf8591_detach), + + DEVMETHOD_END +}; + +static driver_t pcf8591_driver = { + "pcf8591", + pcf8591_methods, + sizeof(struct pcf8591_softc) +}; + +static devclass_t pcf8591_devclass; + +DRIVER_MODULE(pcf8591, iicbus, pcf8591_driver, pcf8591_devclass, 0, 0); +MODULE_DEPEND(pcf8591, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER); +MODULE_VERSION(pcf8591, 1); +#ifdef FDT +IICBUS_FDT_PNP_INFO(compat_data); +#endif diff --git a/sys/modules/i2c/Makefile b/sys/modules/i2c/Makefile index edd92943c6c1..b79e2a98fc7d 100644 --- a/sys/modules/i2c/Makefile +++ b/sys/modules/i2c/Makefile @@ -20,6 +20,7 @@ SUBDIR = \ jedec_dimm \ mux \ nxprtc \ + pcf8591 \ rtc8583 \ s35390a \ smb \ diff --git a/sys/modules/i2c/pcf8591/Makefile b/sys/modules/i2c/pcf8591/Makefile new file mode 100644 index 000000000000..82148867a00f --- /dev/null +++ b/sys/modules/i2c/pcf8591/Makefile @@ -0,0 +1,17 @@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/dev/iicbus +KMOD= pcf8591 +SRCS= pcf8591.c + +SRCS+= \ + bus_if.h \ + device_if.h \ + iicbus_if.h \ + opt_platform.h + +.if !empty(OPT_FDT) +SRCS+= ofw_bus_if.h +.endif + +.include From nobody Sat Nov 13 09:12:18 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7FEAF18597B3; Sat, 13 Nov 2021 09:12:18 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HrqTt34hMz3vkf; Sat, 13 Nov 2021 09:12:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4A8EC10CA8; Sat, 13 Nov 2021 09:12:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AD9CIsv078369; Sat, 13 Nov 2021 09:12:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AD9CIAw078368; Sat, 13 Nov 2021 09:12:18 GMT (envelope-from git) Date: Sat, 13 Nov 2021 09:12:18 GMT Message-Id: <202111130912.1AD9CIAw078368@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andriy Gapon Subject: git: 8f57430de139 - stable/13 - driver for MAX44009 I2C illuminance sensor List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8f57430de13961726e106d6aab5fa56ff877df03 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=8f57430de13961726e106d6aab5fa56ff877df03 commit 8f57430de13961726e106d6aab5fa56ff877df03 Author: Andriy Gapon AuthorDate: 2020-08-20 08:11:31 +0000 Commit: Andriy Gapon CommitDate: 2021-11-13 09:12:05 +0000 driver for MAX44009 I2C illuminance sensor (cherry picked from commit ff6fe2983550aeab0852e982e7fe5ac4c672c205) --- share/man/man4/Makefile | 1 + share/man/man4/max44009.4 | 92 ++++++++++++++++++ sys/conf/files | 1 + sys/dev/iicbus/max44009.c | 193 ++++++++++++++++++++++++++++++++++++++ sys/modules/i2c/Makefile | 1 + sys/modules/i2c/max44009/Makefile | 17 ++++ 6 files changed, 305 insertions(+) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index e80b451f20b2..f5aaa2b616a6 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -293,6 +293,7 @@ MAN= aac.4 \ mac_stub.4 \ mac_test.4 \ malo.4 \ + max44009.4 \ md.4 \ mdio.4 \ me.4 \ diff --git a/share/man/man4/max44009.4 b/share/man/man4/max44009.4 new file mode 100644 index 000000000000..fa399c52cec3 --- /dev/null +++ b/share/man/man4/max44009.4 @@ -0,0 +1,92 @@ +.\" +.\" 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 November 6, 2021 +.Dt MAX44009 4 +.Os +.Sh NAME +.Nm max44009 +.Nd driver for MAX44009 Ambient Light Sensor +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device max44009" +.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 +max44009_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver reports illuminance data from MAX44009 Ambient Light Sensor. +.Pp +The +.Nm +driver reports data via +.Xr sysctl 8 +entry in the device's node in the +.Xr sysctl 8 +tree: +.Bl -tag -width illuminance +.It Va illuminance +The illuminance, in lux units. +.El +.Pp +On an +.Xr FDT 4 +based system the following properties must be set: +.Bl -tag -width "compatible" +.It Va compatible +Must be set to +.Qq maxim,max44009 . +.It Va reg +The I2C address of +.Nm +which can be either 0x4a or 0x4b. +.El +.Sh SEE ALSO +.Xr fdt 4 , +.Xr iicbus 4 , +.Xr sysctl 8 +.Sh HISTORY +The +.Nm +driver and this manual page was written by +.An Andriy Gapon Aq Mt avg@FreeBSD.org . +.Sh BUGS +The +.Nm +driver does not support illuminance thresholds and the corresponding +interrupt. diff --git a/sys/conf/files b/sys/conf/files index 92e68a0b103e..a9f67bcf46f7 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1878,6 +1878,7 @@ dev/iicbus/iicoc_fdt.c optional iicoc ext_resources fdt dev/iicbus/iicoc_pci.c optional iicoc pci dev/iicbus/isl12xx.c optional isl12xx dev/iicbus/lm75.c optional lm75 +dev/iicbus/max44009.c optional max44009 dev/iicbus/mux/pca9547.c optional pca9547 iicmux fdt dev/iicbus/mux/iicmux.c optional iicmux dev/iicbus/mux/iicmux_if.m optional iicmux diff --git a/sys/dev/iicbus/max44009.c b/sys/dev/iicbus/max44009.c new file mode 100644 index 000000000000..739b43ed9055 --- /dev/null +++ b/sys/dev/iicbus/max44009.c @@ -0,0 +1,193 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 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. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_platform.h" + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#ifdef FDT +#include +#include +#endif + +/* + * Driver for MAX44009 Ambient Light Sensor with ADC. + */ +#define REG_LUX_HIGH 0x03 +#define REG_LUX_LOW 0x04 + +struct max44009_softc { + device_t sc_dev; + uint8_t sc_addr; +}; + +#ifdef FDT +static const struct ofw_compat_data compat_data[] = { + { "maxim,max44009", true }, + { NULL, false }, +}; +#endif + +static int +max44009_get_reading(device_t dev, u_int *reading) +{ + struct iic_msg msgs[4]; + struct max44009_softc *sc; + u_int val; + uint8_t reghi, reglo, valhi, vallo; + int error; + + sc = device_get_softc(dev); + + reghi = REG_LUX_HIGH; + reglo = REG_LUX_LOW; + msgs[0].slave = sc->sc_addr; + msgs[0].flags = IIC_M_WR | IIC_M_NOSTOP; + msgs[0].len = 1; + msgs[0].buf = ®hi; + msgs[1].slave = sc->sc_addr; + msgs[1].flags = IIC_M_RD | IIC_M_NOSTOP; + msgs[1].len = 1; + msgs[1].buf = &valhi; + msgs[2].slave = sc->sc_addr; + msgs[2].flags = IIC_M_WR | IIC_M_NOSTOP; + msgs[2].len = 1; + msgs[2].buf = ®lo; + msgs[3].slave = sc->sc_addr; + msgs[3].flags = IIC_M_RD; + msgs[3].len = 1; + msgs[3].buf = &vallo; + + error = iicbus_transfer_excl(dev, msgs, nitems(msgs), IIC_INTRWAIT); + if (error != 0) + return (error); + + val = ((valhi & 0x0f) << 4) | (vallo & 0x0f); + val <<= (valhi & 0xf0) >> 4; + val = val * 72 / 100; + *reading = val; + return (0); +} + +static int +max44009_lux_sysctl(SYSCTL_HANDLER_ARGS) +{ + device_t dev; + u_int reading; + int error, val; + + if (req->oldptr != NULL) { + dev = arg1; + error = max44009_get_reading(dev, &reading); + if (error != 0) + return (EIO); + val = reading; + } + error = sysctl_handle_int(oidp, &val, 0, req); + return (error); +} + +static int +max44009_probe(device_t dev) +{ + int rc; + +#ifdef FDT + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data) + rc = BUS_PROBE_GENERIC; + else +#endif + rc = BUS_PROBE_NOWILDCARD; + device_set_desc(dev, "MAX44009 light intensity sensor"); + return (rc); +} + +static int +max44009_attach(device_t dev) +{ + struct max44009_softc *sc; + struct sysctl_ctx_list *ctx; + struct sysctl_oid *tree_node; + struct sysctl_oid_list *tree; + + sc = device_get_softc(dev); + sc->sc_dev = dev; + sc->sc_addr = iicbus_get_addr(dev); + + ctx = device_get_sysctl_ctx(dev); + tree_node = device_get_sysctl_tree(dev); + tree = SYSCTL_CHILDREN(tree_node); + + SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "illuminance", + CTLTYPE_INT | CTLFLAG_RD, dev, 0, + max44009_lux_sysctl, "I", "Light intensity, lux"); + return (0); +} + +static int +max44009_detach(device_t dev) +{ + return (0); +} + +static device_method_t max44009_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, max44009_probe), + DEVMETHOD(device_attach, max44009_attach), + DEVMETHOD(device_detach, max44009_detach), + + DEVMETHOD_END +}; + +static driver_t max44009_driver = { + "max44009", + max44009_methods, + sizeof(struct max44009_softc) +}; + +static devclass_t max44009_devclass; + +DRIVER_MODULE(max44009, iicbus, max44009_driver, max44009_devclass, 0, 0); +MODULE_DEPEND(max44009, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER); +MODULE_VERSION(max44009, 1); +IICBUS_FDT_PNP_INFO(compat_data); diff --git a/sys/modules/i2c/Makefile b/sys/modules/i2c/Makefile index b79e2a98fc7d..483eb012bb95 100644 --- a/sys/modules/i2c/Makefile +++ b/sys/modules/i2c/Makefile @@ -18,6 +18,7 @@ SUBDIR = \ isl \ isl12xx \ jedec_dimm \ + max44009 \ mux \ nxprtc \ pcf8591 \ diff --git a/sys/modules/i2c/max44009/Makefile b/sys/modules/i2c/max44009/Makefile new file mode 100644 index 000000000000..1e201c5aaba4 --- /dev/null +++ b/sys/modules/i2c/max44009/Makefile @@ -0,0 +1,17 @@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/dev/iicbus +KMOD= max44009 +SRCS= max44009.c + +SRCS+= \ + bus_if.h \ + device_if.h \ + iicbus_if.h \ + opt_platform.h + +.if !empty(OPT_FDT) +SRCS+= ofw_bus_if.h +.endif + +.include From nobody Sat Nov 13 09:12:44 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A6251185A228; Sat, 13 Nov 2021 09:12:44 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HrqVN4937z3w3W; Sat, 13 Nov 2021 09:12:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F94B10CAD; Sat, 13 Nov 2021 09:12:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AD9Cixo078510; Sat, 13 Nov 2021 09:12:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AD9Cibl078509; Sat, 13 Nov 2021 09:12:44 GMT (envelope-from git) Date: Sat, 13 Nov 2021 09:12:44 GMT Message-Id: <202111130912.1AD9Cibl078509@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andriy Gapon Subject: git: 7785ea337373 - stable/13 - gpioled: allow the driver to be disabled via fdt List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7785ea33737369ea6e204a34e8300d5d2a090ab4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=7785ea33737369ea6e204a34e8300d5d2a090ab4 commit 7785ea33737369ea6e204a34e8300d5d2a090ab4 Author: Andriy Gapon AuthorDate: 2020-09-25 07:32:47 +0000 Commit: Andriy Gapon CommitDate: 2021-11-13 09:12:36 +0000 gpioled: allow the driver to be disabled via fdt (cherry picked from commit 832503063e32a449f8ed6ecf865d01e575559971) --- sys/dev/gpio/gpioled_fdt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/gpio/gpioled_fdt.c b/sys/dev/gpio/gpioled_fdt.c index 3f627706860a..58bcd0fbd2bb 100644 --- a/sys/dev/gpio/gpioled_fdt.c +++ b/sys/dev/gpio/gpioled_fdt.c @@ -144,6 +144,8 @@ gpioleds_detach_led(struct gpioled *led) static int gpioled_probe(device_t dev) { + if (!ofw_bus_status_okay(dev)) + return (ENXIO); if (!ofw_bus_is_compatible(dev, "gpio-leds")) return (ENXIO); From nobody Sat Nov 13 09:13:30 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5D121185B22F; Sat, 13 Nov 2021 09:13:30 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HrqWG28Bjz4R8k; Sat, 13 Nov 2021 09:13:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A74D10E82; Sat, 13 Nov 2021 09:13:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AD9DUGc078677; Sat, 13 Nov 2021 09:13:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AD9DUZR078676; Sat, 13 Nov 2021 09:13:30 GMT (envelope-from git) Date: Sat, 13 Nov 2021 09:13:30 GMT Message-Id: <202111130913.1AD9DUZR078676@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andriy Gapon Subject: git: 25fb4fb2518f - stable/13 - files.arm64: fix sort order for aw_i2s.c List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 25fb4fb2518f53b9c986367932d7fa6b7b6697ec Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=25fb4fb2518f53b9c986367932d7fa6b7b6697ec commit 25fb4fb2518f53b9c986367932d7fa6b7b6697ec Author: Andriy Gapon AuthorDate: 2021-09-24 17:26:07 +0000 Commit: Andriy Gapon CommitDate: 2021-11-13 09:13:21 +0000 files.arm64: fix sort order for aw_i2s.c (cherry picked from commit 24f567bb0e5060adb21bed24b00effec4f37f034) --- sys/conf/files.arm64 | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index 84fd0c7858ff..6e911c4f54aa 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -303,6 +303,7 @@ arm/allwinner/sunxi_dma_if.m optional a31_dmac arm/allwinner/aw_cir.c optional evdev aw_cir fdt arm/allwinner/aw_dwc3.c optional aw_dwc3 fdt arm/allwinner/aw_gpio.c optional gpio aw_gpio fdt +arm/allwinner/aw_i2s.c optional fdt sound aw_i2s arm/allwinner/aw_mmc.c optional mmc aw_mmc fdt | mmccam aw_mmc fdt arm/allwinner/aw_nmi.c optional aw_nmi fdt \ compile-with "${NORMAL_C} -I$S/contrib/device-tree/include" From nobody Sat Nov 13 09:16:58 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7D97F185B7A1; Sat, 13 Nov 2021 09:16:58 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HrqbG36GRz4R7x; Sat, 13 Nov 2021 09:16:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4AF5510D22; Sat, 13 Nov 2021 09:16:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AD9GwQ6079038; Sat, 13 Nov 2021 09:16:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AD9GwX0079037; Sat, 13 Nov 2021 09:16:58 GMT (envelope-from git) Date: Sat, 13 Nov 2021 09:16:58 GMT Message-Id: <202111130916.1AD9GwX0079037@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andriy Gapon Subject: git: 81eae1144593 - stable/13 - Revert "files.arm64: fix sort order for aw_i2s.c" List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 81eae1144593162b6bcb03aa8195056134a4e0de Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=81eae1144593162b6bcb03aa8195056134a4e0de commit 81eae1144593162b6bcb03aa8195056134a4e0de Author: Andriy Gapon AuthorDate: 2021-11-13 09:15:11 +0000 Commit: Andriy Gapon CommitDate: 2021-11-13 09:15:11 +0000 Revert "files.arm64: fix sort order for aw_i2s.c" This reverts commit 25fb4fb2518f53b9c986367932d7fa6b7b6697ec. This MFC was done prematurely as aw_i2s is not stable/13 yet. Strangely, git cherry-pick did not complain when applying the diff, although the line to be removed was not in the patched file. --- sys/conf/files.arm64 | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index 6e911c4f54aa..84fd0c7858ff 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -303,7 +303,6 @@ arm/allwinner/sunxi_dma_if.m optional a31_dmac arm/allwinner/aw_cir.c optional evdev aw_cir fdt arm/allwinner/aw_dwc3.c optional aw_dwc3 fdt arm/allwinner/aw_gpio.c optional gpio aw_gpio fdt -arm/allwinner/aw_i2s.c optional fdt sound aw_i2s arm/allwinner/aw_mmc.c optional mmc aw_mmc fdt | mmccam aw_mmc fdt arm/allwinner/aw_nmi.c optional aw_nmi fdt \ compile-with "${NORMAL_C} -I$S/contrib/device-tree/include" From nobody Sat Nov 13 23:16:57 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9913418570D2; Sat, 13 Nov 2021 23:16:57 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HsBDT2Z6Pz53dt; Sat, 13 Nov 2021 23:16:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 29C821BFB2; Sat, 13 Nov 2021 23:16:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1ADNGvsn004932; Sat, 13 Nov 2021 23:16:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1ADNGvu2004930; Sat, 13 Nov 2021 23:16:57 GMT (envelope-from git) Date: Sat, 13 Nov 2021 23:16:57 GMT Message-Id: <202111132316.1ADNGvu2004930@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 59264e60e1e9 - stable/13 - pf: ensure we have the correct source/destination IP address in ICMP errors List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 59264e60e1e97c2112df1b54876ba0eea988ab8c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=59264e60e1e97c2112df1b54876ba0eea988ab8c commit 59264e60e1e97c2112df1b54876ba0eea988ab8c Author: Luiz Otavio O Souza AuthorDate: 2021-10-19 11:37:54 +0000 Commit: Kristof Provost CommitDate: 2021-11-13 23:15:37 +0000 pf: ensure we have the correct source/destination IP address in ICMP errors When we route-to a packet that later turns out to not fit in the outbound interface MTU we generate an ICMP error. However, if we've already changed those (i.e. we've passed through a NAT rule) we have to undo the transformation first. Obtained from: pfSense MFC after: 3 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D32571 (cherry picked from commit ab238f14544b2415561c4fed674ee360aa8b5860) --- sys/netpfil/pf/pf.c | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 101 insertions(+), 2 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 90c856ce5fcf..042658906bd2 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -313,6 +313,8 @@ static u_int pf_purge_expired_states(u_int, int); static void pf_purge_unlinked_rules(void); static int pf_mtag_uminit(void *, int, int); static void pf_mtag_free(struct m_tag *); +static void pf_packet_rework_nat(struct mbuf *, struct pf_pdesc *, + int, struct pf_state_key *); #ifdef INET static void pf_route(struct mbuf **, struct pf_krule *, int, struct ifnet *, struct pf_kstate *, @@ -334,6 +336,16 @@ extern struct proc *pf_purge_proc; VNET_DEFINE(struct pf_limit, pf_limits[PF_LIMIT_MAX]); +#define PACKET_UNDO_NAT(_m, _pd, _off, _s, _dir) \ + do { \ + struct pf_state_key *nk; \ + if ((_dir) == PF_OUT) \ + nk = (_s)->key[PF_SK_STACK]; \ + else \ + nk = (_s)->key[PF_SK_WIRE]; \ + pf_packet_rework_nat(_m, _pd, _off, nk); \ + } while (0) + #define PACKET_LOOPED(pd) ((pd)->pf_mtag && \ (pd)->pf_mtag->flags & PF_PACKET_LOOPED) @@ -439,6 +451,83 @@ pf_addr_cmp(struct pf_addr *a, struct pf_addr *b, sa_family_t af) return (0); } +static void +pf_packet_rework_nat(struct mbuf *m, struct pf_pdesc *pd, int off, + struct pf_state_key *nk) +{ + + switch (pd->proto) { + case IPPROTO_TCP: { + struct tcphdr *th = &pd->hdr.tcp; + + if (PF_ANEQ(pd->src, &nk->addr[pd->sidx], pd->af)) + pf_change_ap(m, pd->src, &th->th_sport, pd->ip_sum, + &th->th_sum, &nk->addr[pd->sidx], + nk->port[pd->sidx], 0, pd->af); + if (PF_ANEQ(pd->dst, &nk->addr[pd->didx], pd->af)) + pf_change_ap(m, pd->dst, &th->th_dport, pd->ip_sum, + &th->th_sum, &nk->addr[pd->didx], + nk->port[pd->didx], 0, pd->af); + m_copyback(m, off, sizeof(*th), (caddr_t)th); + break; + } + case IPPROTO_UDP: { + struct udphdr *uh = &pd->hdr.udp; + + if (PF_ANEQ(pd->src, &nk->addr[pd->sidx], pd->af)) + pf_change_ap(m, pd->src, &uh->uh_sport, pd->ip_sum, + &uh->uh_sum, &nk->addr[pd->sidx], + nk->port[pd->sidx], 1, pd->af); + if (PF_ANEQ(pd->dst, &nk->addr[pd->didx], pd->af)) + pf_change_ap(m, pd->dst, &uh->uh_dport, pd->ip_sum, + &uh->uh_sum, &nk->addr[pd->didx], + nk->port[pd->didx], 1, pd->af); + m_copyback(m, off, sizeof(*uh), (caddr_t)uh); + break; + } + case IPPROTO_ICMP: { + struct icmp *ih = &pd->hdr.icmp; + + if (nk->port[pd->sidx] != ih->icmp_id) { + pd->hdr.icmp.icmp_cksum = pf_cksum_fixup( + ih->icmp_cksum, ih->icmp_id, + nk->port[pd->sidx], 0); + ih->icmp_id = nk->port[pd->sidx]; + pd->sport = &ih->icmp_id; + + m_copyback(m, off, ICMP_MINLEN, (caddr_t)ih); + } + /* FALLTHROUGH */ + } + default: + if (PF_ANEQ(pd->src, &nk->addr[pd->sidx], pd->af)) { + switch (pd->af) { + case AF_INET: + pf_change_a(&pd->src->v4.s_addr, + pd->ip_sum, nk->addr[pd->sidx].v4.s_addr, + 0); + break; + case AF_INET6: + PF_ACPY(pd->src, &nk->addr[pd->sidx], pd->af); + break; + } + } + if (PF_ANEQ(pd->dst, &nk->addr[pd->didx], pd->af)) { + switch (pd->af) { + case AF_INET: + pf_change_a(&pd->dst->v4.s_addr, + pd->ip_sum, nk->addr[pd->didx].v4.s_addr, + 0); + break; + case AF_INET6: + PF_ACPY(pd->dst, &nk->addr[pd->didx], pd->af); + break; + } + } + break; + } +} + static __inline uint32_t pf_hashkey(struct pf_state_key *sk) { @@ -5916,6 +6005,11 @@ pf_route(struct mbuf **m, struct pf_krule *r, int dir, struct ifnet *oifp, error = EMSGSIZE; KMOD_IPSTAT_INC(ips_cantfrag); if (r->rt != PF_DUPTO) { + if (s && pd->nat_rule != NULL) + PACKET_UNDO_NAT(m0, pd, + (ip->ip_hl << 2) + (ip_off & IP_OFFMASK), + s, dir); + icmp_error(m0, ICMP_UNREACH, ICMP_UNREACH_NEEDFRAG, 0, ifp->if_mtu); goto done; @@ -6083,9 +6177,14 @@ pf_route6(struct mbuf **m, struct pf_krule *r, int dir, struct ifnet *oifp, nd6_output_ifp(ifp, ifp, m0, &dst, NULL); else { in6_ifstat_inc(ifp, ifs6_in_toobig); - if (r->rt != PF_DUPTO) + if (r->rt != PF_DUPTO) { + if (s && pd->nat_rule != NULL) + PACKET_UNDO_NAT(m0, pd, + ((caddr_t)ip6 - m0->m_data) + + sizeof(struct ip6_hdr), s, dir); + icmp6_error(m0, ICMP6_PACKET_TOO_BIG, 0, ifp->if_mtu); - else + } else goto bad; } From nobody Sat Nov 13 23:16:57 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D74B31857226; Sat, 13 Nov 2021 23:16:57 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HsBDT5dwWz53T7; Sat, 13 Nov 2021 23:16:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9758A1BFB3; Sat, 13 Nov 2021 23:16:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1ADNGvdR005013; Sat, 13 Nov 2021 23:16:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1ADNGvsV005012; Sat, 13 Nov 2021 23:16:57 GMT (envelope-from git) Date: Sat, 13 Nov 2021 23:16:57 GMT Message-Id: <202111132316.1ADNGvsV005012@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: a50876f0ac7a - stable/12 - pf: ensure we have the correct source/destination IP address in ICMP errors List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: a50876f0ac7a5839531c0c169cb1c88bc6e13389 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=a50876f0ac7a5839531c0c169cb1c88bc6e13389 commit a50876f0ac7a5839531c0c169cb1c88bc6e13389 Author: Luiz Otavio O Souza AuthorDate: 2021-10-19 11:37:54 +0000 Commit: Kristof Provost CommitDate: 2021-11-13 23:15:43 +0000 pf: ensure we have the correct source/destination IP address in ICMP errors When we route-to a packet that later turns out to not fit in the outbound interface MTU we generate an ICMP error. However, if we've already changed those (i.e. we've passed through a NAT rule) we have to undo the transformation first. Obtained from: pfSense MFC after: 3 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D32571 (cherry picked from commit ab238f14544b2415561c4fed674ee360aa8b5860) --- sys/netpfil/pf/pf.c | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 101 insertions(+), 2 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index dd4c49959a60..5ec25baee419 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -314,6 +314,8 @@ static u_int pf_purge_expired_states(u_int, int); static void pf_purge_unlinked_rules(void); static int pf_mtag_uminit(void *, int, int); static void pf_mtag_free(struct m_tag *); +static void pf_packet_rework_nat(struct mbuf *, struct pf_pdesc *, + int, struct pf_state_key *); #ifdef INET static void pf_route(struct mbuf **, struct pf_krule *, int, struct ifnet *, struct pf_kstate *, @@ -335,6 +337,16 @@ extern struct proc *pf_purge_proc; VNET_DEFINE(struct pf_limit, pf_limits[PF_LIMIT_MAX]); +#define PACKET_UNDO_NAT(_m, _pd, _off, _s, _dir) \ + do { \ + struct pf_state_key *nk; \ + if ((_dir) == PF_OUT) \ + nk = (_s)->key[PF_SK_STACK]; \ + else \ + nk = (_s)->key[PF_SK_WIRE]; \ + pf_packet_rework_nat(_m, _pd, _off, nk); \ + } while (0) + #define PACKET_LOOPED(pd) ((pd)->pf_mtag && \ (pd)->pf_mtag->flags & PF_PACKET_LOOPED) @@ -439,6 +451,83 @@ pf_addr_cmp(struct pf_addr *a, struct pf_addr *b, sa_family_t af) return (0); } +static void +pf_packet_rework_nat(struct mbuf *m, struct pf_pdesc *pd, int off, + struct pf_state_key *nk) +{ + + switch (pd->proto) { + case IPPROTO_TCP: { + struct tcphdr *th = &pd->hdr.tcp; + + if (PF_ANEQ(pd->src, &nk->addr[pd->sidx], pd->af)) + pf_change_ap(m, pd->src, &th->th_sport, pd->ip_sum, + &th->th_sum, &nk->addr[pd->sidx], + nk->port[pd->sidx], 0, pd->af); + if (PF_ANEQ(pd->dst, &nk->addr[pd->didx], pd->af)) + pf_change_ap(m, pd->dst, &th->th_dport, pd->ip_sum, + &th->th_sum, &nk->addr[pd->didx], + nk->port[pd->didx], 0, pd->af); + m_copyback(m, off, sizeof(*th), (caddr_t)th); + break; + } + case IPPROTO_UDP: { + struct udphdr *uh = &pd->hdr.udp; + + if (PF_ANEQ(pd->src, &nk->addr[pd->sidx], pd->af)) + pf_change_ap(m, pd->src, &uh->uh_sport, pd->ip_sum, + &uh->uh_sum, &nk->addr[pd->sidx], + nk->port[pd->sidx], 1, pd->af); + if (PF_ANEQ(pd->dst, &nk->addr[pd->didx], pd->af)) + pf_change_ap(m, pd->dst, &uh->uh_dport, pd->ip_sum, + &uh->uh_sum, &nk->addr[pd->didx], + nk->port[pd->didx], 1, pd->af); + m_copyback(m, off, sizeof(*uh), (caddr_t)uh); + break; + } + case IPPROTO_ICMP: { + struct icmp *ih = &pd->hdr.icmp; + + if (nk->port[pd->sidx] != ih->icmp_id) { + pd->hdr.icmp.icmp_cksum = pf_cksum_fixup( + ih->icmp_cksum, ih->icmp_id, + nk->port[pd->sidx], 0); + ih->icmp_id = nk->port[pd->sidx]; + pd->sport = &ih->icmp_id; + + m_copyback(m, off, ICMP_MINLEN, (caddr_t)ih); + } + /* FALLTHROUGH */ + } + default: + if (PF_ANEQ(pd->src, &nk->addr[pd->sidx], pd->af)) { + switch (pd->af) { + case AF_INET: + pf_change_a(&pd->src->v4.s_addr, + pd->ip_sum, nk->addr[pd->sidx].v4.s_addr, + 0); + break; + case AF_INET6: + PF_ACPY(pd->src, &nk->addr[pd->sidx], pd->af); + break; + } + } + if (PF_ANEQ(pd->dst, &nk->addr[pd->didx], pd->af)) { + switch (pd->af) { + case AF_INET: + pf_change_a(&pd->dst->v4.s_addr, + pd->ip_sum, nk->addr[pd->didx].v4.s_addr, + 0); + break; + case AF_INET6: + PF_ACPY(pd->dst, &nk->addr[pd->didx], pd->af); + break; + } + } + break; + } +} + static __inline uint32_t pf_hashkey(struct pf_state_key *sk) { @@ -6021,6 +6110,11 @@ pf_route(struct mbuf **m, struct pf_krule *r, int dir, struct ifnet *oifp, error = EMSGSIZE; KMOD_IPSTAT_INC(ips_cantfrag); if (r->rt != PF_DUPTO) { + if (s && pd->nat_rule != NULL) + PACKET_UNDO_NAT(m0, pd, + (ip->ip_hl << 2) + (ip_off & IP_OFFMASK), + s, dir); + icmp_error(m0, ICMP_UNREACH, ICMP_UNREACH_NEEDFRAG, 0, ifp->if_mtu); goto done; @@ -6166,9 +6260,14 @@ pf_route6(struct mbuf **m, struct pf_krule *r, int dir, struct ifnet *oifp, nd6_output_ifp(ifp, ifp, m0, &dst, NULL); else { in6_ifstat_inc(ifp, ifs6_in_toobig); - if (r->rt != PF_DUPTO) + if (r->rt != PF_DUPTO) { + if (s && pd->nat_rule != NULL) + PACKET_UNDO_NAT(m0, pd, + ((caddr_t)ip6 - m0->m_data) + + sizeof(struct ip6_hdr), s, dir); + icmp6_error(m0, ICMP6_PACKET_TOO_BIG, 0, ifp->if_mtu); - else + } else goto bad; } From nobody Sat Nov 13 23:16:58 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D721818570DA; Sat, 13 Nov 2021 23:16:58 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HsBDV3lCFz53W4; Sat, 13 Nov 2021 23:16:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 52A901BF1B; Sat, 13 Nov 2021 23:16:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1ADNGwwv005037; Sat, 13 Nov 2021 23:16:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1ADNGwtt005036; Sat, 13 Nov 2021 23:16:58 GMT (envelope-from git) Date: Sat, 13 Nov 2021 23:16:58 GMT Message-Id: <202111132316.1ADNGwtt005036@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: b0010a493177 - stable/13 - pf tests: test NAT-ed ICMP errors List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b0010a493177f6d2296943704a2b3df4e0764dbc Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=b0010a493177f6d2296943704a2b3df4e0764dbc commit b0010a493177f6d2296943704a2b3df4e0764dbc Author: Kristof Provost AuthorDate: 2021-10-19 11:52:21 +0000 Commit: Kristof Provost CommitDate: 2021-11-13 23:15:37 +0000 pf tests: test NAT-ed ICMP errors Ensure that the ICMP error is returned with the correct source and destination addresses. MFC after: 3 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D32572 (cherry picked from commit 30276ef12cbb47cdd302741096262041be30ec11) --- tests/sys/netpfil/common/Makefile | 2 + tests/sys/netpfil/common/pft_icmp_check.py | 112 +++++++++++++++++++++++++++++ tests/sys/netpfil/pf/route_to.sh | 59 +++++++++++++++ 3 files changed, 173 insertions(+) diff --git a/tests/sys/netpfil/common/Makefile b/tests/sys/netpfil/common/Makefile index 749e0dd99469..189b8b44cfce 100644 --- a/tests/sys/netpfil/common/Makefile +++ b/tests/sys/netpfil/common/Makefile @@ -16,10 +16,12 @@ ATF_TESTS_SH+= \ ${PACKAGE}FILES+= \ utils.subr \ runner.subr \ + pft_icmp_check.py \ pft_ping.py \ pft_synflood.py \ sniffer.py +${PACKAGE}FILESMODE_pft_icmp_check.py= 0555 ${PACKAGE}FILESMODE_pft_ping.py= 0555 ${PACKAGE}FILESMODE_pft_synflood.py= 0555 diff --git a/tests/sys/netpfil/common/pft_icmp_check.py b/tests/sys/netpfil/common/pft_icmp_check.py new file mode 100644 index 000000000000..e3c5b927aa63 --- /dev/null +++ b/tests/sys/netpfil/common/pft_icmp_check.py @@ -0,0 +1,112 @@ +#!/usr/bin/env python3 +# +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2021 Rubicon Communications, LLC (Netgate) +# +# 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. +# + +import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) +import random +import scapy.all as sp +import socket +import sys +from sniffer import Sniffer + +PAYLOAD_MAGIC = bytes.fromhex('42c0ffee') + +def ping(send_if, dst_ip, args): + ether = sp.Ether() + ip = sp.IP(dst=dst_ip, src=args.fromaddr[0]) + icmp = sp.ICMP(type='echo-request') + raw = sp.raw(PAYLOAD_MAGIC * 250) # We want 1000 bytes payload, -ish + + ip.flags = 2 # Don't fragment + icmp.seq = random.randint(0, 65535) + args.icmp_seq = icmp.seq + + req = ether / ip / icmp / raw + sp.sendp(req, iface=send_if, verbose=False) + +def check_icmp_too_big(args, packet): + """ + Verify that this is an ICMP packet too big error, and that the IP addresses + in the payload packet match expectations. + """ + icmp = packet.getlayer(sp.ICMP) + if not icmp: + return False + + if not icmp.type == 3: + return False + ip = packet.getlayer(sp.IPerror) + if not ip: + return False + + if ip.src != args.fromaddr[0]: + print("Incorrect src addr %s" % ip.src) + return False + if ip.dst != args.to[0]: + print("Incorrect dst addr %s" % ip.dst) + return False + + icmp2 = packet.getlayer(sp.ICMPerror) + if not icmp2: + print("IPerror doesn't contain ICMP") + return False + if icmp2.seq != args.icmp_seq: + print("Incorrect icmp seq %d != %d" % (icmp2.seq, args.icmp_seq)) + return False + return True + +def main(): + parser = argparse.ArgumentParser("pft_icmp_check.py", + description="ICMP error validation tool") + parser.add_argument('--to', nargs=1, required=True, + help='The destination IP address') + parser.add_argument('--fromaddr', nargs=1, required=True, + help='The source IP address') + parser.add_argument('--sendif', nargs=1, required=True, + help='The interface through which the packet(s) will be sent') + parser.add_argument('--recvif', nargs=1, + help='The interface on which to expect the ICMP error') + + args = parser.parse_args() + sniffer = None + if not args.recvif is None: + sniffer = Sniffer(args, check_icmp_too_big) + + ping(args.sendif[0], args.to[0], args) + + if sniffer: + sniffer.join() + + if sniffer.foundCorrectPacket: + sys.exit(0) + else: + sys.exit(1) + +if __name__ == '__main__': + main() diff --git a/tests/sys/netpfil/pf/route_to.sh b/tests/sys/netpfil/pf/route_to.sh index 957317eb462e..e7646a5fb7f7 100644 --- a/tests/sys/netpfil/pf/route_to.sh +++ b/tests/sys/netpfil/pf/route_to.sh @@ -27,6 +27,8 @@ . $(atf_get_srcdir)/utils.subr +common_dir=$(atf_get_srcdir)/../common + atf_test_case "v4" "cleanup" v4_head() { @@ -250,10 +252,67 @@ multiwanlocal_cleanup() pft_cleanup } +atf_test_case "icmp_nat" "cleanup" +icmp_nat_head() +{ + atf_set descr 'Test that ICMP packets are correct for route-to + NAT' + atf_set require.user root +} + +icmp_nat_body() +{ + pft_init + + epair_one=$(vnet_mkepair) + epair_two=$(vnet_mkepair) + epair_three=$(vnet_mkepair) + + vnet_mkjail gw ${epair_one}b ${epair_two}a ${epair_three}a + vnet_mkjail srv ${epair_two}b + vnet_mkjail srv2 ${epair_three}b + + ifconfig ${epair_one}a 192.0.2.2/24 up + route add -net 198.51.100.0/24 192.0.2.1 + jexec gw sysctl net.inet.ip.forwarding=1 + jexec gw ifconfig ${epair_one}b 192.0.2.1/24 up + jexec gw ifconfig ${epair_two}a 198.51.100.1/24 up + jexec gw ifconfig ${epair_three}a 203.0.113.1/24 up mtu 500 + jexec srv ifconfig ${epair_two}b 198.51.100.2/24 up + jexec srv route add default 198.51.100.1 + jexec srv2 ifconfig ${epair_three}b 203.0.113.2/24 up mtu 500 + jexec srv2 route add default 203.0.113.1 + + # Sanity check + atf_check -s exit:0 -o ignore ping -c 1 198.51.100.2 + + jexec gw pfctl -e + pft_set_rules gw \ + "nat on ${epair_two}a inet from 192.0.2.0/24 to any -> (${epair_two}a)" \ + "nat on ${epair_three}a inet from 192.0.2.0/24 to any -> (${epair_three}a)" \ + "pass out route-to (${epair_three}a 203.0.113.2) proto icmp icmp-type echoreq" + + # Now ensure that we get an ICMP error with the correct IP addresses in it. + atf_check -s exit:0 ${common_dir}/pft_icmp_check.py \ + --to 198.51.100.2 \ + --fromaddr 192.0.2.2 \ + --recvif ${epair_one}a \ + --sendif ${epair_one}a + + # ping reports the ICMP error, so check of that too. + atf_check -s exit:2 -o match:'frag needed and DF set' \ + ping -D -c 1 -s 1000 198.51.100.2 +} + +icmp_nat_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "v4" atf_add_test_case "v6" atf_add_test_case "multiwan" atf_add_test_case "multiwanlocal" + atf_add_test_case "icmp_nat" } From nobody Sat Nov 13 23:16:58 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3059A18571DA; Sat, 13 Nov 2021 23:16:59 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HsBDV73YWz53TJ; Sat, 13 Nov 2021 23:16:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CB3301BE64; Sat, 13 Nov 2021 23:16:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1ADNGwbG005061; Sat, 13 Nov 2021 23:16:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1ADNGwuV005060; Sat, 13 Nov 2021 23:16:58 GMT (envelope-from git) Date: Sat, 13 Nov 2021 23:16:58 GMT Message-Id: <202111132316.1ADNGwuV005060@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 741e50928a23 - stable/12 - pf tests: test NAT-ed ICMP errors List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 741e50928a23372b6d2b0f9f77efda915c4d311c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=741e50928a23372b6d2b0f9f77efda915c4d311c commit 741e50928a23372b6d2b0f9f77efda915c4d311c Author: Kristof Provost AuthorDate: 2021-10-19 11:52:21 +0000 Commit: Kristof Provost CommitDate: 2021-11-13 23:15:43 +0000 pf tests: test NAT-ed ICMP errors Ensure that the ICMP error is returned with the correct source and destination addresses. MFC after: 3 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D32572 (cherry picked from commit 30276ef12cbb47cdd302741096262041be30ec11) --- tests/sys/netpfil/common/Makefile | 2 + tests/sys/netpfil/common/pft_icmp_check.py | 112 +++++++++++++++++++++++++++++ tests/sys/netpfil/pf/route_to.sh | 59 +++++++++++++++ 3 files changed, 173 insertions(+) diff --git a/tests/sys/netpfil/common/Makefile b/tests/sys/netpfil/common/Makefile index 8347d817a61c..72ec6e76e73f 100644 --- a/tests/sys/netpfil/common/Makefile +++ b/tests/sys/netpfil/common/Makefile @@ -13,12 +13,14 @@ ATF_TESTS_SH+= \ tos ${PACKAGE}FILES+= \ + pft_icmp_check.py \ pft_ping.py \ pft_synflood.py \ runner.subr \ sniffer.py \ utils.subr +${PACKAGE}FILESMODE_pft_icmp_check.py= 0555 ${PACKAGE}FILESMODE_pft_ping.py= 0555 ${PACKAGE}FILESMODE_pft_synflood.py= 0555 diff --git a/tests/sys/netpfil/common/pft_icmp_check.py b/tests/sys/netpfil/common/pft_icmp_check.py new file mode 100644 index 000000000000..e3c5b927aa63 --- /dev/null +++ b/tests/sys/netpfil/common/pft_icmp_check.py @@ -0,0 +1,112 @@ +#!/usr/bin/env python3 +# +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2021 Rubicon Communications, LLC (Netgate) +# +# 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. +# + +import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) +import random +import scapy.all as sp +import socket +import sys +from sniffer import Sniffer + +PAYLOAD_MAGIC = bytes.fromhex('42c0ffee') + +def ping(send_if, dst_ip, args): + ether = sp.Ether() + ip = sp.IP(dst=dst_ip, src=args.fromaddr[0]) + icmp = sp.ICMP(type='echo-request') + raw = sp.raw(PAYLOAD_MAGIC * 250) # We want 1000 bytes payload, -ish + + ip.flags = 2 # Don't fragment + icmp.seq = random.randint(0, 65535) + args.icmp_seq = icmp.seq + + req = ether / ip / icmp / raw + sp.sendp(req, iface=send_if, verbose=False) + +def check_icmp_too_big(args, packet): + """ + Verify that this is an ICMP packet too big error, and that the IP addresses + in the payload packet match expectations. + """ + icmp = packet.getlayer(sp.ICMP) + if not icmp: + return False + + if not icmp.type == 3: + return False + ip = packet.getlayer(sp.IPerror) + if not ip: + return False + + if ip.src != args.fromaddr[0]: + print("Incorrect src addr %s" % ip.src) + return False + if ip.dst != args.to[0]: + print("Incorrect dst addr %s" % ip.dst) + return False + + icmp2 = packet.getlayer(sp.ICMPerror) + if not icmp2: + print("IPerror doesn't contain ICMP") + return False + if icmp2.seq != args.icmp_seq: + print("Incorrect icmp seq %d != %d" % (icmp2.seq, args.icmp_seq)) + return False + return True + +def main(): + parser = argparse.ArgumentParser("pft_icmp_check.py", + description="ICMP error validation tool") + parser.add_argument('--to', nargs=1, required=True, + help='The destination IP address') + parser.add_argument('--fromaddr', nargs=1, required=True, + help='The source IP address') + parser.add_argument('--sendif', nargs=1, required=True, + help='The interface through which the packet(s) will be sent') + parser.add_argument('--recvif', nargs=1, + help='The interface on which to expect the ICMP error') + + args = parser.parse_args() + sniffer = None + if not args.recvif is None: + sniffer = Sniffer(args, check_icmp_too_big) + + ping(args.sendif[0], args.to[0], args) + + if sniffer: + sniffer.join() + + if sniffer.foundCorrectPacket: + sys.exit(0) + else: + sys.exit(1) + +if __name__ == '__main__': + main() diff --git a/tests/sys/netpfil/pf/route_to.sh b/tests/sys/netpfil/pf/route_to.sh index 957317eb462e..e7646a5fb7f7 100755 --- a/tests/sys/netpfil/pf/route_to.sh +++ b/tests/sys/netpfil/pf/route_to.sh @@ -27,6 +27,8 @@ . $(atf_get_srcdir)/utils.subr +common_dir=$(atf_get_srcdir)/../common + atf_test_case "v4" "cleanup" v4_head() { @@ -250,10 +252,67 @@ multiwanlocal_cleanup() pft_cleanup } +atf_test_case "icmp_nat" "cleanup" +icmp_nat_head() +{ + atf_set descr 'Test that ICMP packets are correct for route-to + NAT' + atf_set require.user root +} + +icmp_nat_body() +{ + pft_init + + epair_one=$(vnet_mkepair) + epair_two=$(vnet_mkepair) + epair_three=$(vnet_mkepair) + + vnet_mkjail gw ${epair_one}b ${epair_two}a ${epair_three}a + vnet_mkjail srv ${epair_two}b + vnet_mkjail srv2 ${epair_three}b + + ifconfig ${epair_one}a 192.0.2.2/24 up + route add -net 198.51.100.0/24 192.0.2.1 + jexec gw sysctl net.inet.ip.forwarding=1 + jexec gw ifconfig ${epair_one}b 192.0.2.1/24 up + jexec gw ifconfig ${epair_two}a 198.51.100.1/24 up + jexec gw ifconfig ${epair_three}a 203.0.113.1/24 up mtu 500 + jexec srv ifconfig ${epair_two}b 198.51.100.2/24 up + jexec srv route add default 198.51.100.1 + jexec srv2 ifconfig ${epair_three}b 203.0.113.2/24 up mtu 500 + jexec srv2 route add default 203.0.113.1 + + # Sanity check + atf_check -s exit:0 -o ignore ping -c 1 198.51.100.2 + + jexec gw pfctl -e + pft_set_rules gw \ + "nat on ${epair_two}a inet from 192.0.2.0/24 to any -> (${epair_two}a)" \ + "nat on ${epair_three}a inet from 192.0.2.0/24 to any -> (${epair_three}a)" \ + "pass out route-to (${epair_three}a 203.0.113.2) proto icmp icmp-type echoreq" + + # Now ensure that we get an ICMP error with the correct IP addresses in it. + atf_check -s exit:0 ${common_dir}/pft_icmp_check.py \ + --to 198.51.100.2 \ + --fromaddr 192.0.2.2 \ + --recvif ${epair_one}a \ + --sendif ${epair_one}a + + # ping reports the ICMP error, so check of that too. + atf_check -s exit:2 -o match:'frag needed and DF set' \ + ping -D -c 1 -s 1000 198.51.100.2 +} + +icmp_nat_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "v4" atf_add_test_case "v6" atf_add_test_case "multiwan" atf_add_test_case "multiwanlocal" + atf_add_test_case "icmp_nat" } From nobody Sun Nov 14 01:13:25 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 914C4183DE66; Sun, 14 Nov 2021 01:13:25 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HsDps3hTWz3tCF; Sun, 14 Nov 2021 01:13:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F0901D47A; Sun, 14 Nov 2021 01:13:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AE1DPAp064293; Sun, 14 Nov 2021 01:13:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AE1DPwZ064292; Sun, 14 Nov 2021 01:13:25 GMT (envelope-from git) Date: Sun, 14 Nov 2021 01:13:25 GMT Message-Id: <202111140113.1AE1DPwZ064292@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Peter Grehan Subject: git: 3d093d5b0053 - releng/12.3 - igc: correctly update RCTL when changing multicast filters. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: grehan X-Git-Repository: src X-Git-Refname: refs/heads/releng/12.3 X-Git-Reftype: branch X-Git-Commit: 3d093d5b00533827864689f7638476eff83c7894 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/12.3 has been updated by grehan: URL: https://cgit.FreeBSD.org/src/commit/?id=3d093d5b00533827864689f7638476eff83c7894 commit 3d093d5b00533827864689f7638476eff83c7894 Author: Peter Grehan AuthorDate: 2021-10-11 17:49:01 +0000 Commit: Peter Grehan CommitDate: 2021-11-14 01:40:32 +0000 igc: correctly update RCTL when changing multicast filters. Fix clearing of bits in RCTL for the non-bpf/non-allmulti case. Update RCTL after modifying the multicast filter registers as per the Linux driver. This fixes LACP on igc interfaces, where incoming LACP multicasti control packets were being dropped. Approved by: re (gjb) Obtained from: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 5a3eb6207a353c3a18da8abcf00a2d75276dd29e) (cherry picked from commit 73e1138208a5888aaabfc44d8e48aa04554c9146) --- sys/dev/igc/if_igc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/igc/if_igc.c b/sys/dev/igc/if_igc.c index b72f55166907..06b78394cd2f 100644 --- a/sys/dev/igc/if_igc.c +++ b/sys/dev/igc/if_igc.c @@ -1172,12 +1172,12 @@ igc_if_multi_set(if_ctx_t ctx) reg_rctl |= IGC_RCTL_MPE; reg_rctl &= ~IGC_RCTL_UPE; } else - reg_rctl = ~(IGC_RCTL_UPE | IGC_RCTL_MPE); - - IGC_WRITE_REG(&adapter->hw, IGC_RCTL, reg_rctl); + reg_rctl &= ~(IGC_RCTL_UPE | IGC_RCTL_MPE); if (mcnt < MAX_NUM_MULTICAST_ADDRESSES) igc_update_mc_addr_list(&adapter->hw, mta, mcnt); + + IGC_WRITE_REG(&adapter->hw, IGC_RCTL, reg_rctl); } /********************************************************************* From nobody Sun Nov 14 01:13:26 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D31F8183E211; Sun, 14 Nov 2021 01:13:26 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HsDpt4lRGz3t1n; Sun, 14 Nov 2021 01:13:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 82A891D7FE; Sun, 14 Nov 2021 01:13:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AE1DQUY064319; Sun, 14 Nov 2021 01:13:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AE1DQJr064318; Sun, 14 Nov 2021 01:13:26 GMT (envelope-from git) Date: Sun, 14 Nov 2021 01:13:26 GMT Message-Id: <202111140113.1AE1DQJr064318@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Peter Grehan Subject: git: d9d625047784 - releng/12.3 - igc: Use hardware routine for PHY reset List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: grehan X-Git-Repository: src X-Git-Refname: refs/heads/releng/12.3 X-Git-Reftype: branch X-Git-Commit: d9d62504778435df82b6f01b74c0bf2f8d1256d3 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch releng/12.3 has been updated by grehan: URL: https://cgit.FreeBSD.org/src/commit/?id=d9d62504778435df82b6f01b74c0bf2f8d1256d3 commit d9d62504778435df82b6f01b74c0bf2f8d1256d3 Author: Peter Grehan AuthorDate: 2021-11-01 13:35:43 +0000 Commit: Peter Grehan CommitDate: 2021-11-14 01:41:25 +0000 igc: Use hardware routine for PHY reset Summary: The previously used software reset routine wasn't sufficient to reset the PHY if the bootloader hadn't left the device in an initialized state. This was seen with the onboard igc port on an 11th-gen Intel NUC. The software reset isn't used in the Linux driver so all related code has been removed. Tested on: Netgate 6100 onboard ports, a discrete PCIe I225-LM card, and an 11th-gen Intel NUC. Approved by: re (gjb) Reported by: woodsb02 Tested by: woodsb02 (NUC) Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 561cd74b1704ab76a3286733fb43da53b6892ea4) (cherry picked from commit 267a39780ea8c89b7a89ca9e91dcfff02c69656f) --- sys/dev/igc/igc_api.c | 15 --------------- sys/dev/igc/igc_api.h | 1 - sys/dev/igc/igc_hw.h | 1 - sys/dev/igc/igc_i225.c | 11 +++-------- sys/dev/igc/igc_phy.c | 37 ++----------------------------------- sys/dev/igc/igc_phy.h | 1 - 6 files changed, 5 insertions(+), 61 deletions(-) diff --git a/sys/dev/igc/igc_api.c b/sys/dev/igc/igc_api.c index cad116c2395d..6aafc9898df8 100644 --- a/sys/dev/igc/igc_api.c +++ b/sys/dev/igc/igc_api.c @@ -535,21 +535,6 @@ s32 igc_phy_hw_reset(struct igc_hw *hw) return IGC_SUCCESS; } -/** - * igc_phy_commit - Soft PHY reset - * @hw: pointer to the HW structure - * - * Performs a soft PHY reset on those that apply. This is a function pointer - * entry point called by drivers. - **/ -s32 igc_phy_commit(struct igc_hw *hw) -{ - if (hw->phy.ops.commit) - return hw->phy.ops.commit(hw); - - return IGC_SUCCESS; -} - /** * igc_set_d0_lplu_state - Sets low power link up state for D0 * @hw: pointer to the HW structure diff --git a/sys/dev/igc/igc_api.h b/sys/dev/igc/igc_api.h index a0fc9ff21166..f9064b540c7c 100644 --- a/sys/dev/igc/igc_api.h +++ b/sys/dev/igc/igc_api.h @@ -42,7 +42,6 @@ s32 igc_get_phy_info(struct igc_hw *hw); void igc_release_phy(struct igc_hw *hw); s32 igc_acquire_phy(struct igc_hw *hw); s32 igc_phy_hw_reset(struct igc_hw *hw); -s32 igc_phy_commit(struct igc_hw *hw); void igc_power_up_phy(struct igc_hw *hw); void igc_power_down_phy(struct igc_hw *hw); s32 igc_read_mac_addr(struct igc_hw *hw); diff --git a/sys/dev/igc/igc_hw.h b/sys/dev/igc/igc_hw.h index a07d2894f97a..a8323a8578a9 100644 --- a/sys/dev/igc/igc_hw.h +++ b/sys/dev/igc/igc_hw.h @@ -382,7 +382,6 @@ struct igc_phy_operations { s32 (*init_params)(struct igc_hw *); s32 (*acquire)(struct igc_hw *); s32 (*check_reset_block)(struct igc_hw *); - s32 (*commit)(struct igc_hw *); s32 (*force_speed_duplex)(struct igc_hw *); s32 (*get_info)(struct igc_hw *); s32 (*set_page)(struct igc_hw *, u16); diff --git a/sys/dev/igc/igc_i225.c b/sys/dev/igc/igc_i225.c index 75c4b5125a97..4c50daa16b79 100644 --- a/sys/dev/igc/igc_i225.c +++ b/sys/dev/igc/igc_i225.c @@ -136,7 +136,6 @@ static s32 igc_init_phy_params_i225(struct igc_hw *hw) { struct igc_phy_info *phy = &hw->phy; s32 ret_val = IGC_SUCCESS; - u32 ctrl_ext; DEBUGFUNC("igc_init_phy_params_i225"); @@ -155,10 +154,10 @@ static s32 igc_init_phy_params_i225(struct igc_hw *hw) phy->ops.acquire = igc_acquire_phy_base; phy->ops.check_reset_block = igc_check_reset_block_generic; - phy->ops.commit = igc_phy_sw_reset_generic; phy->ops.release = igc_release_phy_base; - - ctrl_ext = IGC_READ_REG(hw, IGC_CTRL_EXT); + phy->ops.reset = igc_phy_hw_reset_generic; + phy->ops.read_reg = igc_read_phy_reg_gpy; + phy->ops.write_reg = igc_write_phy_reg_gpy; /* Make sure the PHY is in a good state. Several people have reported * firmware leaving the PHY's page select register set to something @@ -169,10 +168,6 @@ static s32 igc_init_phy_params_i225(struct igc_hw *hw) if (ret_val) goto out; - IGC_WRITE_REG(hw, IGC_CTRL_EXT, ctrl_ext); - phy->ops.read_reg = igc_read_phy_reg_gpy; - phy->ops.write_reg = igc_write_phy_reg_gpy; - ret_val = igc_get_phy_id(hw); /* Verify phy id and set remaining function pointers */ switch (phy->id) { diff --git a/sys/dev/igc/igc_phy.c b/sys/dev/igc/igc_phy.c index a1d71ab15829..a6823ddf7bac 100644 --- a/sys/dev/igc/igc_phy.c +++ b/sys/dev/igc/igc_phy.c @@ -26,7 +26,6 @@ void igc_init_phy_ops_generic(struct igc_hw *hw) phy->ops.init_params = igc_null_ops_generic; phy->ops.acquire = igc_null_ops_generic; phy->ops.check_reset_block = igc_null_ops_generic; - phy->ops.commit = igc_null_ops_generic; phy->ops.force_speed_duplex = igc_null_ops_generic; phy->ops.get_info = igc_null_ops_generic; phy->ops.set_page = igc_null_set_page; @@ -147,7 +146,7 @@ s32 igc_get_phy_id(struct igc_hw *hw) return ret_val; phy->id = (u32)(phy_id << 16); - usec_delay(20); + usec_delay(200); ret_val = phy->ops.read_reg(hw, PHY_ID2, &phy_id); if (ret_val) return ret_val; @@ -155,7 +154,6 @@ s32 igc_get_phy_id(struct igc_hw *hw) phy->id |= (u32)(phy_id & PHY_REVISION_MASK); phy->revision = (u32)(phy_id & ~PHY_REVISION_MASK); - return IGC_SUCCESS; } @@ -314,7 +312,7 @@ static s32 igc_phy_setup_autoneg(struct igc_hw *hw) if ((phy->autoneg_mask & ADVERTISE_2500_FULL) && hw->phy.id == I225_I_PHY_ID) { - /* Read the MULTI GBT AN Control Register - reg 7.32 */ + /* Read the MULTI GBT AN Control Register - reg 7.32 */ ret_val = phy->ops.read_reg(hw, (STANDARD_AN_REG_MASK << MMD_DEVADDR_SHIFT) | ANEG_MULTIGBT_AN_CTRL, @@ -847,37 +845,6 @@ s32 igc_phy_has_link_generic(struct igc_hw *hw, u32 iterations, return ret_val; } -/** - * igc_phy_sw_reset_generic - PHY software reset - * @hw: pointer to the HW structure - * - * Does a software reset of the PHY by reading the PHY control register and - * setting/write the control register reset bit to the PHY. - **/ -s32 igc_phy_sw_reset_generic(struct igc_hw *hw) -{ - s32 ret_val; - u16 phy_ctrl; - - DEBUGFUNC("igc_phy_sw_reset_generic"); - - if (!hw->phy.ops.read_reg) - return IGC_SUCCESS; - - ret_val = hw->phy.ops.read_reg(hw, PHY_CONTROL, &phy_ctrl); - if (ret_val) - return ret_val; - - phy_ctrl |= MII_CR_RESET; - ret_val = hw->phy.ops.write_reg(hw, PHY_CONTROL, phy_ctrl); - if (ret_val) - return ret_val; - - usec_delay(1); - - return ret_val; -} - /** * igc_phy_hw_reset_generic - PHY hardware reset * @hw: pointer to the HW structure diff --git a/sys/dev/igc/igc_phy.h b/sys/dev/igc/igc_phy.h index 61cc46cdc583..36fa0677c3e6 100644 --- a/sys/dev/igc/igc_phy.h +++ b/sys/dev/igc/igc_phy.h @@ -18,7 +18,6 @@ s32 igc_null_set_page(struct igc_hw *hw, u16 data); s32 igc_check_downshift_generic(struct igc_hw *hw); s32 igc_check_reset_block_generic(struct igc_hw *hw); s32 igc_get_phy_id(struct igc_hw *hw); -s32 igc_phy_sw_reset_generic(struct igc_hw *hw); void igc_phy_force_speed_duplex_setup(struct igc_hw *hw, u16 *phy_ctrl); s32 igc_phy_hw_reset_generic(struct igc_hw *hw); s32 igc_phy_reset_dsp_generic(struct igc_hw *hw); From nobody Sun Nov 14 01:23:18 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 31DEB184D470; Sun, 14 Nov 2021 01:23:19 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HsF2H0qPyz4S90; Sun, 14 Nov 2021 01:23:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F09CF1DB93; Sun, 14 Nov 2021 01:23:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AE1NIXs077253; Sun, 14 Nov 2021 01:23:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AE1NINl077252; Sun, 14 Nov 2021 01:23:18 GMT (envelope-from git) Date: Sun, 14 Nov 2021 01:23:18 GMT Message-Id: <202111140123.1AE1NINl077252@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 4b7ef53860b8 - stable/13 - nfscl: Do pNFS layout return_on_close synchronously List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4b7ef53860b86699bb4691005ea07f3872a36dbe Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=4b7ef53860b86699bb4691005ea07f3872a36dbe commit 4b7ef53860b86699bb4691005ea07f3872a36dbe Author: Rick Macklem AuthorDate: 2021-10-31 23:31:31 +0000 Commit: Rick Macklem CommitDate: 2021-11-14 01:18:38 +0000 nfscl: Do pNFS layout return_on_close synchronously For pNFS servers that specify that Layouts are to be returned upon close, they may expect that LayoutReturn to happen before the associated Close. This patch modifies the NFSv4.1/4.2 pNFS client so that this is done. This only affects a pNFS mount against a non-FreeBSD NFSv4.1/4.2 server that specifies return_on_close in LayoutGet replies. Found during a recent IETF NFSv4 working group testing event. (cherry picked from commit d5d2ce1c8550a41e7374893ccd864c172461221f) --- sys/fs/nfs/nfsclstate.h | 1 + sys/fs/nfsclient/nfs_clstate.c | 63 ++++++++++++++++++++++++++++++------------ 2 files changed, 47 insertions(+), 17 deletions(-) diff --git a/sys/fs/nfs/nfsclstate.h b/sys/fs/nfs/nfsclstate.h index 898a7de391dc..03400a2cdea5 100644 --- a/sys/fs/nfs/nfsclstate.h +++ b/sys/fs/nfs/nfsclstate.h @@ -273,6 +273,7 @@ struct nfscllayout { #define NFSLY_RETONCLOSE 0x0080 #define NFSLY_WRITTEN 0x0100 /* Has been used to write to a DS. */ #define NFSLY_FLEXFILE 0x0200 +#define NFSLY_RETURNED 0x0400 /* * Flex file layout mirror specific stuff for nfsclflayout. diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 3b76cbe502c4..ced5bfeb2880 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -127,7 +127,7 @@ static struct nfsclclient *nfscl_getclntsess(uint8_t *); static struct nfscldeleg *nfscl_finddeleg(struct nfsclclient *, u_int8_t *, int); static void nfscl_retoncloselayout(vnode_t, struct nfsclclient *, uint8_t *, - int, struct nfsclrecalllayout **); + int, struct nfsclrecalllayout **, struct nfscllayout **); static void nfscl_reldevinfo_locked(struct nfscldevinfo *); static struct nfscllayout *nfscl_findlayout(struct nfsclclient *, u_int8_t *, int); @@ -2936,7 +2936,8 @@ tryagain2: while (lyp != NULL) { nlyp = TAILQ_PREV(lyp, nfscllayouthead, nfsly_list); if (lyp->nfsly_timestamp < NFSD_MONOSEC && - (lyp->nfsly_flags & NFSLY_RECALL) == 0 && + (lyp->nfsly_flags & (NFSLY_RECALL | + NFSLY_RETONCLOSE)) == 0 && lyp->nfsly_lock.nfslock_usecnt == 0 && lyp->nfsly_lock.nfslock_lock == 0) { NFSCL_DEBUG(4, "ret stale lay=%d\n", @@ -2971,7 +2972,13 @@ tryagain2: TAILQ_REMOVE(&rlh, lyp, nfsly_list); NFSCL_DEBUG(4, "ret layout\n"); nfscl_layoutreturn(clp->nfsc_nmp, lyp, cred, p); - nfscl_freelayout(lyp); + if ((lyp->nfsly_flags & NFSLY_RETONCLOSE) != 0) { + NFSLOCKCLSTATE(); + lyp->nfsly_flags |= NFSLY_RETURNED; + wakeup(lyp); + NFSUNLOCKCLSTATE(); + } else + nfscl_freelayout(lyp); } /* @@ -3336,6 +3343,7 @@ nfscl_doclose(vnode_t vp, struct nfsclclient **clpp, NFSPROC_T *p) struct nfscldeleg *dp; struct nfsfh *nfhp; struct nfsclrecalllayout *recallp; + struct nfscllayout *lyp; int error; error = nfscl_getcl(vp->v_mount, NULL, NULL, false, true, &clp); @@ -3365,7 +3373,8 @@ nfscl_doclose(vnode_t vp, struct nfsclclient **clpp, NFSPROC_T *p) } /* Return any layouts marked return on close. */ - nfscl_retoncloselayout(vp, clp, nfhp->nfh_fh, nfhp->nfh_len, &recallp); + nfscl_retoncloselayout(vp, clp, nfhp->nfh_fh, nfhp->nfh_len, &recallp, + &lyp); /* Now process the opens against the server. */ LIST_INIT(&delayed); @@ -3396,6 +3405,20 @@ lookformore: } } nfscl_clrelease(clp); + + /* Now, wait for any layout that is returned upon close. */ + if (lyp != NULL) { + while ((lyp->nfsly_flags & NFSLY_RETURNED) == 0) { + if (NFSCL_FORCEDISM(nmp->nm_mountp)) { + lyp = NULL; + break; + } + msleep(lyp, NFSCLSTATEMUTEXPTR, PZERO, "nfslroc", hz); + } + if (lyp != NULL) + nfscl_freelayout(lyp); + } + NFSUNLOCKCLSTATE(); /* * recallp has been set NULL by nfscl_retoncloselayout() if it was @@ -5223,28 +5246,34 @@ nfscl_getlayout(struct nfsclclient *clp, uint8_t *fhp, int fhlen, */ static void nfscl_retoncloselayout(vnode_t vp, struct nfsclclient *clp, uint8_t *fhp, - int fhlen, struct nfsclrecalllayout **recallpp) + int fhlen, struct nfsclrecalllayout **recallpp, struct nfscllayout **lypp) { struct nfscllayout *lyp; uint32_t iomode; + *lypp = NULL; if (vp->v_type != VREG || !NFSHASPNFS(VFSTONFS(vp->v_mount)) || nfscl_enablecallb == 0 || nfs_numnfscbd == 0 || (VTONFS(vp)->n_flag & NNOLAYOUT) != 0) return; lyp = nfscl_findlayout(clp, fhp, fhlen); - if (lyp != NULL && (lyp->nfsly_flags & (NFSLY_RETONCLOSE | - NFSLY_RECALL)) == NFSLY_RETONCLOSE) { - iomode = 0; - if (!LIST_EMPTY(&lyp->nfsly_flayread)) - iomode |= NFSLAYOUTIOMODE_READ; - if (!LIST_EMPTY(&lyp->nfsly_flayrw)) - iomode |= NFSLAYOUTIOMODE_RW; - (void)nfscl_layoutrecall(NFSLAYOUTRETURN_FILE, lyp, iomode, - 0, UINT64_MAX, lyp->nfsly_stateid.seqid, 0, 0, NULL, - *recallpp); - NFSCL_DEBUG(4, "retoncls recall iomode=%d\n", iomode); - *recallpp = NULL; + if (lyp != NULL && (lyp->nfsly_flags & NFSLY_RETONCLOSE) != 0) { + if ((lyp->nfsly_flags & NFSLY_RECALL) == 0) { + iomode = 0; + if (!LIST_EMPTY(&lyp->nfsly_flayread)) + iomode |= NFSLAYOUTIOMODE_READ; + if (!LIST_EMPTY(&lyp->nfsly_flayrw)) + iomode |= NFSLAYOUTIOMODE_RW; + nfscl_layoutrecall(NFSLAYOUTRETURN_FILE, lyp, iomode, + 0, UINT64_MAX, lyp->nfsly_stateid.seqid, 0, 0, NULL, + *recallpp); + NFSCL_DEBUG(4, "retoncls recall iomode=%d\n", iomode); + *recallpp = NULL; + } + + /* Now, wake up renew thread to do LayoutReturn. */ + wakeup(clp); + *lypp = lyp; } } From nobody Sun Nov 14 01:26:06 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id DAC3A184E28B; Sun, 14 Nov 2021 01:26:06 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HsF5V5nTyz4Sy1; Sun, 14 Nov 2021 01:26:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A666E1DCF6; Sun, 14 Nov 2021 01:26:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AE1Q6Fi077557; Sun, 14 Nov 2021 01:26:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AE1Q6hb077556; Sun, 14 Nov 2021 01:26:06 GMT (envelope-from git) Date: Sun, 14 Nov 2021 01:26:06 GMT Message-Id: <202111140126.1AE1Q6hb077556@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: d4c5187bb179 - stable/13 - nfscl: Add setting n_localmodtime to the Write RPC code List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d4c5187bb17925578532c98da55310250c4715d5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=d4c5187bb17925578532c98da55310250c4715d5 commit d4c5187bb17925578532c98da55310250c4715d5 Author: Rick Macklem AuthorDate: 2021-10-31 00:08:28 +0000 Commit: Rick Macklem CommitDate: 2021-11-14 01:21:50 +0000 nfscl: Add setting n_localmodtime to the Write RPC code Similar to commit 2be417843a, I believe there could be a race between the NFS client VOP_LOOKUP() and file Writing that could result in stale file attributes being loaded into the NFS vnode by VOP_LOOKUP(). I have not been able to reproduce a failure due to this race, but I believe that there are two possibilities: The Lookup RPC happens while VOP_WRITE() is being executed and loads stale file attributes after VOP_WRITE() returns when it has already completed the Write/Commit RPC(s). --> For this case, setting the local modify timestamp at the end of VOP_WRITE() should ensure that stale file attributes are not loaded. The Lookup RPC occurs after VOP_WRITE() has returned, while asynchronous Write/Commit RPCs are in progress and then is blocked by the vnode held by VOP_OPEN/VOP_CLOSE/VOP_FSYNC which will flush writes via ncl_flush() or ncl_vinvalbuf(), clearing the NMODIFIED flag (which indicates Writes-in-progress). The VOP_LOOKUP() then acquires the NFS vnode lock and fills in stale file attributes. --> Setting the local modify timestamp in ncl_flsuh() and ncl_vinvalbuf() when they clear NMODIFIED should ensure that stale file attributes are not loaded. This patch does the above. PR: 259071 (cherry picked from commit 50dcff0816e5e4aa94f51ce27da5121e49902996) --- sys/fs/nfsclient/nfs_clbio.c | 18 +++++++++++++++--- sys/fs/nfsclient/nfs_clvnops.c | 7 +++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clbio.c b/sys/fs/nfsclient/nfs_clbio.c index 10a76f0a4b83..250d01d88948 100644 --- a/sys/fs/nfsclient/nfs_clbio.c +++ b/sys/fs/nfsclient/nfs_clbio.c @@ -907,6 +907,7 @@ ncl_write(struct vop_write_args *ap) int bp_cached, n, on, error = 0, error1, save2, wouldcommit; size_t orig_resid, local_resid; off_t orig_size, tmp_off; + struct timespec ts; KASSERT(uio->uio_rw == UIO_WRITE, ("ncl_write mode")); KASSERT(uio->uio_segflg != UIO_USERSPACE || uio->uio_td == curthread, @@ -1284,7 +1285,12 @@ again: break; } while (uio->uio_resid > 0 && n > 0); - if (error != 0) { + if (error == 0) { + nanouptime(&ts); + NFSLOCKNODE(np); + np->n_localmodtime = ts; + NFSUNLOCKNODE(np); + } else { if (ioflag & IO_UNIT) { VATTR_NULL(&vattr); vattr.va_size = orig_size; @@ -1356,6 +1362,7 @@ ncl_vinvalbuf(struct vnode *vp, int flags, struct thread *td, int intrflg) struct nfsmount *nmp = VFSTONFS(vp->v_mount); int error = 0, slpflag, slptimeo; bool old_lock; + struct timespec ts; ASSERT_VOP_LOCKED(vp, "ncl_vinvalbuf"); @@ -1400,16 +1407,21 @@ ncl_vinvalbuf(struct vnode *vp, int flags, struct thread *td, int intrflg) } if (NFSHASPNFS(nmp)) { nfscl_layoutcommit(vp, td); + nanouptime(&ts); /* * Invalidate the attribute cache, since writes to a DS * won't update the size attribute. */ NFSLOCKNODE(np); np->n_attrstamp = 0; - } else + } else { + nanouptime(&ts); NFSLOCKNODE(np); - if (np->n_directio_asyncwr == 0) + } + if (np->n_directio_asyncwr == 0 && (np->n_flag & NMODIFIED) != 0) { + np->n_localmodtime = ts; np->n_flag &= ~NMODIFIED; + } NFSUNLOCKNODE(np); out: ncl_excl_finish(vp, old_lock); diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index 8da0186c3c62..0ab02af9e5e8 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -2833,6 +2833,7 @@ ncl_flush(struct vnode *vp, int waitfor, struct thread *td, #endif struct buf *bvec_on_stack[NFS_COMMITBVECSIZ]; u_int bvecsize = 0, bveccount; + struct timespec ts; if (called_from_renewthread != 0) slptimeo = hz; @@ -3153,6 +3154,12 @@ done: vn_printf(vp, "ncl_flush failed"); error = called_from_renewthread != 0 ? EIO : EBUSY; } + if (error == 0) { + nanouptime(&ts); + NFSLOCKNODE(np); + np->n_localmodtime = ts; + NFSUNLOCKNODE(np); + } return (error); } From nobody Sun Nov 14 02:57:00 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id F3EF818524AF; Sun, 14 Nov 2021 02:57:00 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HsH6N6YCyz4vLl; Sun, 14 Nov 2021 02:57:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C0CCF1ECFC; Sun, 14 Nov 2021 02:57:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AE2v0qS097283; Sun, 14 Nov 2021 02:57:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AE2v0h5097282; Sun, 14 Nov 2021 02:57:00 GMT (envelope-from git) Date: Sun, 14 Nov 2021 02:57:00 GMT Message-Id: <202111140257.1AE2v0h5097282@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 00ec7c6ab526 - stable/13 - nfscl: Fix race between Lookup and Setattr of size List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 00ec7c6ab526e0a8b10f57c578f423d647c4d93b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=00ec7c6ab526e0a8b10f57c578f423d647c4d93b commit 00ec7c6ab526e0a8b10f57c578f423d647c4d93b Author: Rick Macklem AuthorDate: 2021-10-30 23:35:02 +0000 Commit: Rick Macklem CommitDate: 2021-11-14 02:52:26 +0000 nfscl: Fix race between Lookup and Setattr of size PR#259071 provides a test program that fails for the NFS client. Testing with it, there appears to be a race between Lookup and VOPs like Setattr-of-size, where Lookup ends up loading stale attributes (including what might be the wrong file size) into the NFS vnode's attribute cache. The race occurs when the modifying VOP (which holds a lock on the vnode), blocks the acquisition of the vnode in Lookup, after the RPC (with now potentially stale attributes). Here's what seems to happen: Child Parent does stat(), which does VOP_LOOKUP(), doing the Lookup RPC with the directory vnode locked, acquiring file attributes valid at this point in time blocks waiting for locked file does ftruncate(), which vnode does VOP_SETATTR() of Size, changing the file's size while holding an exclusive lock on the file's vnode releases the vnode lock acquires file vnode and fills in now stale attributes including the old wrong Size does a read() which returns wrong data size This patch fixes the problem by saving a timestamp in the NFS vnode in the VOPs that modify the file (Setattr-of-size, Allocate). Then lookup/readdirplus compares that timestamp with the time just before starting the RPC after it has acquired the file's vnode. If the modifying RPC occurred during the Lookup, the attributes in the RPC reply are discarded, since they might be stale. With this patch the test program works as expected. Note that the test program does not fail on a July stable/12, although this race is in the NFS client code. I suspect a fairly recent change to the name caching code exposed this bug. PR: 259071 (cherry picked from commit 2be417843a04f25e631e99d5188eb2652b13d80d) --- sys/fs/nfsclient/nfs_clrpcops.c | 29 +++++++++++++-- sys/fs/nfsclient/nfs_clvnops.c | 78 +++++++++++++++++++++++++++++++++++++---- sys/fs/nfsclient/nfsnode.h | 1 + 3 files changed, 99 insertions(+), 9 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index 94f7496378c5..6489569f8acf 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -3384,7 +3384,8 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep, nfsattrbit_t attrbits, dattrbits; size_t tresid; u_int32_t *tl2 = NULL, rderr; - struct timespec dctime; + struct timespec dctime, ts; + bool attr_ok; KASSERT(uiop->uio_iovcnt == 1 && (uiop->uio_resid & (DIRBLKSIZ - 1)) == 0, @@ -3569,6 +3570,7 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep, *tl = txdr_unsigned(NFSV4OP_GETATTR); (void) nfsrv_putattrbit(nd, &dattrbits); } + nanouptime(&ts); error = nfscl_request(nd, vp, p, cred, stuff); if (error) return (error); @@ -3726,6 +3728,7 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep, ncookie.lval[1]; if (nfhp != NULL) { + attr_ok = true; if (NFSRV_CMPFH(nfhp->nfh_fh, nfhp->nfh_len, dnp->n_fhp->nfh_fh, dnp->n_fhp->nfh_len)) { VREF(vp); @@ -3755,12 +3758,32 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep, if (!error) { newvp = NFSTOV(np); unlocknewvp = 1; + /* + * If n_localmodtime >= time before RPC, + * then a file modification operation, + * such as VOP_SETATTR() of size, has + * occurred while the Lookup RPC and + * acquisition of the vnode happened. As + * such, the attributes might be stale, + * with possibly an incorrect size. + */ + NFSLOCKNODE(np); + if (timespecisset( + &np->n_localmodtime) && + timespeccmp(&np->n_localmodtime, + &ts, >=)) { + NFSCL_DEBUG(4, "nfsrpc_readdirplus:" + " localmod stale attributes\n"); + attr_ok = false; + } + NFSUNLOCKNODE(np); } } nfhp = NULL; if (newvp != NULLVP) { - error = nfscl_loadattrcache(&newvp, - &nfsva, NULL, NULL, 0, 0); + if (attr_ok) + error = nfscl_loadattrcache(&newvp, + &nfsva, NULL, NULL, 0, 0); if (error) { if (unlocknewvp) vput(newvp); diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index 0ab02af9e5e8..eab6eed82830 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -1012,6 +1012,7 @@ nfs_setattr(struct vop_setattr_args *ap) struct vattr *vap = ap->a_vap; int error = 0; u_quad_t tsize; + struct timespec ts; #ifndef nolint tsize = (u_quad_t)0; @@ -1106,11 +1107,18 @@ nfs_setattr(struct vop_setattr_args *ap) NFSUNLOCKNODE(np); } error = nfs_setattrrpc(vp, vap, ap->a_cred, td); - if (error && vap->va_size != VNOVAL) { - NFSLOCKNODE(np); - np->n_size = np->n_vattr.na_size = tsize; - vnode_pager_setsize(vp, tsize); - NFSUNLOCKNODE(np); + if (vap->va_size != VNOVAL) { + if (error == 0) { + nanouptime(&ts); + NFSLOCKNODE(np); + np->n_localmodtime = ts; + NFSUNLOCKNODE(np); + } else { + NFSLOCKNODE(np); + np->n_size = np->n_vattr.na_size = tsize; + vnode_pager_setsize(vp, tsize); + NFSUNLOCKNODE(np); + } } return (error); } @@ -1167,7 +1175,7 @@ nfs_lookup(struct vop_lookup_args *ap) struct nfsfh *nfhp; struct nfsvattr dnfsva, nfsva; struct vattr vattr; - struct timespec nctime; + struct timespec nctime, ts; *vpp = NULLVP; if ((flags & ISLASTCN) && (mp->mnt_flag & MNT_RDONLY) && @@ -1271,6 +1279,7 @@ nfs_lookup(struct vop_lookup_args *ap) newvp = NULLVP; NFSINCRGLOBAL(nfsstatsv1.lookupcache_misses); + nanouptime(&ts); error = nfsrpc_lookup(dvp, cnp->cn_nameptr, cnp->cn_namelen, cnp->cn_cred, td, &dnfsva, &nfsva, &nfhp, &attrflag, &dattrflag, NULL); @@ -1337,6 +1346,22 @@ nfs_lookup(struct vop_lookup_args *ap) if (error) return (error); newvp = NFSTOV(np); + /* + * If n_localmodtime >= time before RPC, then + * a file modification operation, such as + * VOP_SETATTR() of size, has occurred while + * the Lookup RPC and acquisition of the vnode + * happened. As such, the attributes might + * be stale, with possibly an incorrect size. + */ + NFSLOCKNODE(np); + if (timespecisset(&np->n_localmodtime) && + timespeccmp(&np->n_localmodtime, &ts, >=)) { + NFSCL_DEBUG(4, "nfs_lookup: rename localmod " + "stale attributes\n"); + attrflag = 0; + } + NFSUNLOCKNODE(np); if (attrflag) (void) nfscl_loadattrcache(&newvp, &nfsva, NULL, NULL, 0, 1); @@ -1396,6 +1421,22 @@ nfs_lookup(struct vop_lookup_args *ap) if (error) return (error); newvp = NFSTOV(np); + /* + * If n_localmodtime >= time before RPC, then + * a file modification operation, such as + * VOP_SETATTR() of size, has occurred while + * the Lookup RPC and acquisition of the vnode + * happened. As such, the attributes might + * be stale, with possibly an incorrect size. + */ + NFSLOCKNODE(np); + if (timespecisset(&np->n_localmodtime) && + timespeccmp(&np->n_localmodtime, &ts, >=)) { + NFSCL_DEBUG(4, "nfs_lookup: localmod " + "stale attributes\n"); + attrflag = 0; + } + NFSUNLOCKNODE(np); if (attrflag) (void) nfscl_loadattrcache(&newvp, &nfsva, NULL, NULL, 0, 1); @@ -2613,7 +2654,9 @@ nfs_lookitup(struct vnode *dvp, char *name, int len, struct ucred *cred, struct componentname cn; int error = 0, attrflag, dattrflag; u_int hash; + struct timespec ts; + nanouptime(&ts); error = nfsrpc_lookup(dvp, name, len, cred, td, &dnfsva, &nfsva, &nfhp, &attrflag, &dattrflag, NULL); if (dattrflag) @@ -2674,6 +2717,22 @@ printf("replace=%s\n",nnn); if (error) return (error); newvp = NFSTOV(np); + /* + * If n_localmodtime >= time before RPC, then + * a file modification operation, such as + * VOP_SETATTR() of size, has occurred while + * the Lookup RPC and acquisition of the vnode + * happened. As such, the attributes might + * be stale, with possibly an incorrect size. + */ + NFSLOCKNODE(np); + if (timespecisset(&np->n_localmodtime) && + timespeccmp(&np->n_localmodtime, &ts, >=)) { + NFSCL_DEBUG(4, "nfs_lookitup: localmod " + "stale attributes\n"); + attrflag = 0; + } + NFSUNLOCKNODE(np); } if (!attrflag && *npp == NULL) { if (newvp == dvp) @@ -3628,11 +3687,14 @@ nfs_allocate(struct vop_allocate_args *ap) struct thread *td = curthread; struct nfsvattr nfsva; struct nfsmount *nmp; + struct nfsnode *np; off_t alen; int attrflag, error, ret; + struct timespec ts; attrflag = 0; nmp = VFSTONFS(vp->v_mount); + np = VTONFS(vp); mtx_lock(&nmp->nm_mtx); if (NFSHASNFSV4(nmp) && nmp->nm_minorvers >= NFSV42_MINORVERSION && (nmp->nm_privflag & NFSMNTP_NOALLOCATE) == 0) { @@ -3652,6 +3714,10 @@ nfs_allocate(struct vop_allocate_args *ap) if (error == 0) { *ap->a_offset += alen; *ap->a_len -= alen; + nanouptime(&ts); + NFSLOCKNODE(np); + np->n_localmodtime = ts; + NFSUNLOCKNODE(np); } else if (error == NFSERR_NOTSUPP) { mtx_lock(&nmp->nm_mtx); nmp->nm_privflag |= NFSMNTP_NOALLOCATE; diff --git a/sys/fs/nfsclient/nfsnode.h b/sys/fs/nfsclient/nfsnode.h index b34e362a8522..833737654f6b 100644 --- a/sys/fs/nfsclient/nfsnode.h +++ b/sys/fs/nfsclient/nfsnode.h @@ -129,6 +129,7 @@ struct nfsnode { struct nfsv4node *n_v4; /* extra V4 stuff */ struct ucred *n_writecred; /* Cred. for putpages */ struct nfsclopen *n_openstateid; /* Cached open stateid */ + struct timespec n_localmodtime; /* Last local modify */ }; #define n_atim n_un1.nf_atim From nobody Sun Nov 14 03:18:08 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id EF5B6185BA8F; Sun, 14 Nov 2021 03:18:08 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HsHZm6Pvtz3HlJ; Sun, 14 Nov 2021 03:18:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BC7401F262; Sun, 14 Nov 2021 03:18:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AE3I8AI025118; Sun, 14 Nov 2021 03:18:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AE3I8DS025117; Sun, 14 Nov 2021 03:18:08 GMT (envelope-from git) Date: Sun, 14 Nov 2021 03:18:08 GMT Message-Id: <202111140318.1AE3I8DS025117@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 724a71a58dee - stable/13 - nfscl: Use NFSMNTP_DELEGISSUED in two more functions List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 724a71a58deedc84eae9a0052eac75d65e4d03ed Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=724a71a58deedc84eae9a0052eac75d65e4d03ed commit 724a71a58deedc84eae9a0052eac75d65e4d03ed Author: Rick Macklem AuthorDate: 2021-10-30 03:35:02 +0000 Commit: Rick Macklem CommitDate: 2021-11-14 03:14:39 +0000 nfscl: Use NFSMNTP_DELEGISSUED in two more functions Commit 5e5ca4c8fc53 added a NFSMNTP_DELEGISSUED flag to indicate when a delegation has been issued to the mount. For the common case where an NFSv4 server is not issuing delegations, this flag can be checked to avoid acquisition of the NFSCLSTATEMUTEX. This patch adds checks for NFSMNTP_DELEGISSUED being set to two more functions. This change appears to be performance neutral for a small number of opens, but should reduce lock contention for a large number of opens for the common case where server is not issuing delegations. (cherry picked from commit dc6dd769de63c4eceb8899205a5d780d9f278fd2) --- sys/fs/nfsclient/nfs_clstate.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index ced5bfeb2880..f1d661e7c90a 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -4590,6 +4590,12 @@ nfscl_mustflush(vnode_t vp) nmp = VFSTONFS(vp->v_mount); if (!NFSHASNFSV4(nmp)) return (1); + NFSLOCKMNT(nmp); + if ((nmp->nm_privflag & NFSMNTP_DELEGISSUED) == 0) { + NFSUNLOCKMNT(nmp); + return (1); + } + NFSUNLOCKMNT(nmp); NFSLOCKCLSTATE(); clp = nfscl_findcl(nmp); if (clp == NULL) { @@ -4773,6 +4779,12 @@ nfscl_renamedeleg(vnode_t fvp, nfsv4stateid_t *fstp, int *gotfdp, vnode_t tvp, *gottdp = 0; if (NFSHASPNFS(nmp)) return (retcnt); + NFSLOCKMNT(nmp); + if ((nmp->nm_privflag & NFSMNTP_DELEGISSUED) == 0) { + NFSUNLOCKMNT(nmp); + return (retcnt); + } + NFSUNLOCKMNT(nmp); NFSLOCKCLSTATE(); /* * Loop around waiting for: From nobody Sun Nov 14 06:38:21 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CEA041841F5C; Sun, 14 Nov 2021 06:38:21 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HsN1n5SQpz3Cpl; Sun, 14 Nov 2021 06:38:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 96F2121CB3; Sun, 14 Nov 2021 06:38:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AE6cLZ6090495; Sun, 14 Nov 2021 06:38:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AE6cLpL090494; Sun, 14 Nov 2021 06:38:21 GMT (envelope-from git) Date: Sun, 14 Nov 2021 06:38:21 GMT Message-Id: <202111140638.1AE6cLpL090494@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Guangyuan Yang Subject: git: 109330155000 - stable/13 - module(9): Document that evhand can be NULL List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ygy X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 109330155000bfec215ee39148254d2a0b628798 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by ygy (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=109330155000bfec215ee39148254d2a0b628798 commit 109330155000bfec215ee39148254d2a0b628798 Author: Felix Johnson AuthorDate: 2021-11-11 06:28:45 +0000 Commit: Guangyuan Yang CommitDate: 2021-11-14 06:37:20 +0000 module(9): Document that evhand can be NULL PR: 192250 Reported by: ngie (cherry picked from commit c5e0492ae81e4b0d7946ccfbedb434a9c4071256) --- share/man/man9/module.9 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/share/man/man9/module.9 b/share/man/man9/module.9 index 2ba7b3d6c621..5bd9a13c6925 100644 --- a/share/man/man9/module.9 +++ b/share/man/man9/module.9 @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 12, 2018 +.Dd November 11, 2021 .Dt MODULE 9 .Os .Sh NAME @@ -42,6 +42,9 @@ The structure contains the name of the device, a unique ID number, a pointer to an event handler function and to an argument, which is given to the event handler, as well as some kernel internal data. +If the event handler function is +.Dv NULL , +the module will use a no-operation function handler instead. .Pp The .Xr DECLARE_MODULE 9