git: 0ff0a8234f83 - main - sound: Improve /dev/sndstat channel info readability
The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=0ff0a8234f83e6b25e9a2f1b64623baaf723d6dc commit 0ff0a8234f83e6b25e9a2f1b64623baaf723d6dc Author: Christos Margiolis AuthorDate: 2024-10-18 08:41:23 + Commit: Christos Margiolis CommitDate: 2024-10-18 08:41:23 + sound: Improve /dev/sndstat channel info readability Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by:dev_submerge.ch, zlei Differential Revision: https://reviews.freebsd.org/D46857 --- sys/dev/sound/pcm/sndstat.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/dev/sound/pcm/sndstat.c b/sys/dev/sound/pcm/sndstat.c index bc51da083439..b20b3f8f6158 100644 --- a/sys/dev/sound/pcm/sndstat.c +++ b/sys/dev/sound/pcm/sndstat.c @@ -1280,12 +1280,12 @@ sndstat_prepare_pcm(struct sbuf *s, device_t dev, int verbose) } sbuf_printf(s, "\n\t"); - sbuf_printf(s, "interrupts %d, ", c->interrupts); + sbuf_printf(s, "\tinterrupts %d, ", c->interrupts); if (c->direction == PCMDIR_REC) { sbuf_printf(s, "overruns %d, feed %u, hfree %d, " - "sfree %d [b:%d/%d/%d|bs:%d/%d/%d]", + "sfree %d\n\t\t[b:%d/%d/%d|bs:%d/%d/%d]", c->xruns, c->feedcount, sndbuf_getfree(c->bufhard), sndbuf_getfree(c->bufsoft), @@ -1298,7 +1298,7 @@ sndstat_prepare_pcm(struct sbuf *s, device_t dev, int verbose) } else { sbuf_printf(s, "underruns %d, feed %u, ready %d " - "[b:%d/%d/%d|bs:%d/%d/%d]", + "\n\t\t[b:%d/%d/%d|bs:%d/%d/%d]", c->xruns, c->feedcount, sndbuf_getready(c->bufsoft), sndbuf_getsize(c->bufhard), @@ -1310,14 +1310,14 @@ sndstat_prepare_pcm(struct sbuf *s, device_t dev, int verbose) } sbuf_printf(s, "\n\t"); - sbuf_printf(s, "channel flags=0x%b", c->flags, CHN_F_BITS); + sbuf_printf(s, "\tchannel flags=0x%b", c->flags, CHN_F_BITS); sbuf_printf(s, "\n\t"); if (c->parentchannel != NULL) { - sbuf_printf(s, "{%s}", (c->direction == PCMDIR_REC) ? + sbuf_printf(s, "\t{%s}", (c->direction == PCMDIR_REC) ? c->parentchannel->name : "userland"); } else { - sbuf_printf(s, "{%s}", (c->direction == PCMDIR_REC) ? + sbuf_printf(s, "\t{%s}", (c->direction == PCMDIR_REC) ? "hardware" : "userland"); } sbuf_printf(s, " -> ");
git: 46d2f61818f5 - main - unbound: Vendor import 1.22.0
The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=46d2f61818f594174cafe31ee338c6e083fa1876 commit 46d2f61818f594174cafe31ee338c6e083fa1876 Merge: 7aa6667623be 0a6d797cf6eb Author: Cy Schubert AuthorDate: 2024-10-18 13:59:33 + Commit: Cy Schubert CommitDate: 2024-10-18 14:14:21 + unbound: Vendor import 1.22.0 Release notes at https://nlnetlabs.nl/news/2024/Oct/17/unbound-1.22.0-released/ MFC after: 1 week Merge commit '0a6d797cf6eb751d7eb613900cd19803e05d905f' into main contrib/unbound/Makefile.in| 19 +- contrib/unbound/aclocal.m4 | 292 +- contrib/unbound/cachedb/cachedb.c |5 +- contrib/unbound/cachedb/redis.c| 29 +- contrib/unbound/config.h.in| 94 + contrib/unbound/configure | 769 +- contrib/unbound/configure.ac | 74 +- contrib/unbound/contrib/-filter-iterator.patch |2 +- contrib/unbound/daemon/daemon.c| 10 + contrib/unbound/daemon/daemon.h|3 + contrib/unbound/daemon/remote.c| 14 +- contrib/unbound/daemon/stats.c | 14 +- contrib/unbound/daemon/worker.c| 38 +- contrib/unbound/dns64/dns64.c |5 +- contrib/unbound/dnstap/unbound-dnstap-socket.c | 24 +- contrib/unbound/doc/Changelog | 151 +- contrib/unbound/doc/README |2 +- contrib/unbound/doc/example.conf.in| 26 +- contrib/unbound/doc/libunbound.3.in|4 +- contrib/unbound/doc/unbound-anchor.8.in|2 +- contrib/unbound/doc/unbound-checkconf.8.in |2 +- contrib/unbound/doc/unbound-control.8.in | 10 +- contrib/unbound/doc/unbound-host.1.in |2 +- contrib/unbound/doc/unbound.8.in |4 +- contrib/unbound/doc/unbound.conf.5.in | 71 +- contrib/unbound/doc/unbound.doxygen|8 +- contrib/unbound/install-sh | 174 +- contrib/unbound/iterator/iter_scrub.c | 45 +- contrib/unbound/iterator/iter_utils.c | 42 + contrib/unbound/iterator/iter_utils.h |7 + contrib/unbound/iterator/iterator.c| 57 +- contrib/unbound/iterator/iterator.h|2 +- contrib/unbound/libunbound/context.c |2 +- contrib/unbound/libunbound/libworker.c | 16 + contrib/unbound/libunbound/unbound.h |4 + contrib/unbound/ltmain.sh | 866 +- contrib/unbound/services/authzone.c| 39 +- contrib/unbound/services/cache/dns.c | 59 +- contrib/unbound/services/cache/dns.h |3 +- contrib/unbound/services/cache/rrset.c | 10 +- contrib/unbound/services/listen_dnsport.c | 2534 +- contrib/unbound/services/listen_dnsport.h | 405 +- contrib/unbound/services/mesh.c| 13 +- contrib/unbound/services/mesh.h|3 +- contrib/unbound/services/modstack.c|2 +- contrib/unbound/services/rpz.c | 19 + .../unbound/smallapp/unbound-control-setup.sh.in |2 +- contrib/unbound/smallapp/unbound-control.c |6 + contrib/unbound/smallapp/unbound-host.c|6 + contrib/unbound/smallapp/worker_cb.c | 16 + contrib/unbound/testcode/doqclient.c | 2701 +++ contrib/unbound/testcode/unitdoq.c | 84 + .../unbound/testdata/auth_tls.tdir/auth_tls.dsc| 16 + .../testdata/auth_tls.tdir/auth_tls.nsd.conf | 21 + .../unbound/testdata/auth_tls.tdir/auth_tls.post | 14 + .../unbound/testdata/auth_tls.tdir/auth_tls.pre| 47 + .../unbound/testdata/auth_tls.tdir/auth_tls.test | 48 + .../testdata/auth_tls.tdir/auth_tls.ub.conf| 22 + .../testdata/auth_tls.tdir/example.com.zone|4 + .../unbound/testdata/auth_tls.tdir/nsd_server.key | 39 + .../unbound/testdata/auth_tls.tdir/nsd_server.pem | 22 + .../testdata/auth_tls.tdir/unbound_server.key | 39 + .../testdata/auth_tls.tdir/unbound_server.pem | 22 + .../auth_tls_failcert.tdir/auth_tls_failcert.dsc | 16 + .../auth_tls_failcert.nsd.conf | 21 + .../auth_tls_failcert.tdir/auth_tls_failcert.post | 14 + .../auth_tls_failcert.tdir/auth_tls_failcert.pre | 47 + .../auth_tls_failcert.tdir/auth_tls_failcert.test | 56 + .../auth_tls_failcert.ub.conf | 23 + .../auth_tls_failcert.tdir/example.com.zone|4 + .../testdata/auth_tls_failcert.tdir/nsd_server.key | 39 + .../testdata/auth_tls_failcert.tdir/ns
git: 0c2af19e78a0 - main - unbound: Remove testcode and testdata
The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=0c2af19e78a0a8dbbf305b74c944b5758578ea30 commit 0c2af19e78a0a8dbbf305b74c944b5758578ea30 Author: Cy Schubert AuthorDate: 2024-10-18 14:14:41 + Commit: Cy Schubert CommitDate: 2024-10-18 14:14:41 + unbound: Remove testcode and testdata The testcode and testdata directories are not used by FreeBSD. Remove them. MFC after: 1 week --- contrib/unbound/testcode/doqclient.c | 2701 contrib/unbound/testcode/unitdoq.c | 84 - contrib/unbound/testdata/00-lint.tdir/00-lint.pre | 14 - .../09-unbound-control.tdir/conf.bad_credentials |5 - .../conf.spoofed_credentials |5 - .../09-unbound-control.tdir/view_local_data|4 - .../09-unbound-control.tdir/view_local_data_remove |4 - .../testdata/acl_interface.tdir/rpz-nx.zone|3 - .../testdata/acl_interface.tdir/rpz-one.zone |3 - .../testdata/acl_interface.tdir/rpz-two.zone |3 - .../unbound/testdata/auth_tls.tdir/auth_tls.dsc| 16 - .../testdata/auth_tls.tdir/auth_tls.nsd.conf | 21 - .../unbound/testdata/auth_tls.tdir/auth_tls.post | 14 - .../unbound/testdata/auth_tls.tdir/auth_tls.pre| 47 - .../unbound/testdata/auth_tls.tdir/auth_tls.test | 48 - .../testdata/auth_tls.tdir/auth_tls.ub.conf| 22 - .../testdata/auth_tls.tdir/example.com.zone|4 - .../unbound/testdata/auth_tls.tdir/nsd_server.key | 39 - .../unbound/testdata/auth_tls.tdir/nsd_server.pem | 22 - .../testdata/auth_tls.tdir/unbound_server.key | 39 - .../testdata/auth_tls.tdir/unbound_server.pem | 22 - .../auth_tls_failcert.tdir/auth_tls_failcert.dsc | 16 - .../auth_tls_failcert.nsd.conf | 21 - .../auth_tls_failcert.tdir/auth_tls_failcert.post | 14 - .../auth_tls_failcert.tdir/auth_tls_failcert.pre | 47 - .../auth_tls_failcert.tdir/auth_tls_failcert.test | 56 - .../auth_tls_failcert.ub.conf | 23 - .../auth_tls_failcert.tdir/example.com.zone|4 - .../testdata/auth_tls_failcert.tdir/nsd_server.key | 39 - .../testdata/auth_tls_failcert.tdir/nsd_server.pem | 22 - .../auth_tls_failcert.tdir/unbound_server.key | 39 - .../auth_tls_failcert.tdir/unbound_server.pem | 22 - contrib/unbound/testdata/cachedb_cached_ede.crpl | 91 - contrib/unbound/testdata/cachedb_expired.crpl | 324 --- .../testdata/cachedb_expired_client_timeout.crpl | 343 --- .../testdata/cachedb_expired_reply_ttl.crpl| 259 -- .../cachedb_no_store.tdir/cachedb_no_store.conf| 29 - .../cachedb_no_store.tdir/cachedb_no_store.dsc | 16 - .../cachedb_no_store.tdir/cachedb_no_store.post| 20 - .../cachedb_no_store.tdir/cachedb_no_store.pre | 36 - .../cachedb_no_store.servfail.testns |8 - .../cachedb_no_store.tdir/cachedb_no_store.test| 132 - .../cachedb_no_store.tdir/cachedb_no_store.testns |9 - .../unbound/testdata/cachedb_servfail_cname.crpl | 181 -- .../unbound/testdata/cachedb_subnet_change.crpl| 304 --- .../unbound/testdata/cachedb_subnet_expired.crpl | 322 --- .../testdata/cachedb_subnet_toecs_timeout.crpl | 229 -- contrib/unbound/testdata/cachedb_val_expired.crpl | 327 --- .../testdata/cookie_file.tdir/cookie_file.conf | 19 - .../testdata/cookie_file.tdir/cookie_file.dsc | 16 - .../testdata/cookie_file.tdir/cookie_file.pre | 24 - .../testdata/cookie_file.tdir/cookie_file.test | 250 -- contrib/unbound/testdata/disable_edns_do.rpl | 164 -- contrib/unbound/testdata/dns64_prefetch_cache.rpl | 195 -- .../doq_downstream.tdir/doq_downstream.conf| 21 - .../doq_downstream.tdir/doq_downstream.dsc | 16 - .../doq_downstream.tdir/doq_downstream.post| 13 - .../doq_downstream.tdir/doq_downstream.pre | 44 - .../doq_downstream.tdir/doq_downstream.test| 109 - .../doq_downstream.tdir/doq_downstream.testns | 13 - .../doq_downstream.tdir/unbound_server.key | 15 - .../doq_downstream.tdir/unbound_server.pem | 11 - .../unbound/testdata/edns_downstream_cookies.rpl | 235 -- contrib/unbound/testdata/fwd_name_lookup.rpl | 152 -- .../testdata/ip_ratelimit.tdir/ip_ratelimit.conf | 28 - .../testdata/ip_ratelimit.tdir/ip_ratelimit.dsc| 16 - .../testdata/ip_ratelimit.tdir/ip_ratelimit.post | 13 - .../testdata/ip_ratelimit.tdir/ip_ratelimit.pre| 24 - .../testdata/ip_ratelimit.tdir/ip_ratelimit.test | 165 -- .../testdata/ip_ratelimit.tdir/unbound_control.key | 39 - .../testdata/ip_ratelimit.tdir/unbound_control.pem | 22 - .../testdata/ip_ratelimit.tdir/unbound_server.key | 39 - .../testdata/ip_ratelimit.tdir/unbound_server.pem | 22 - .../unbound/testdata/iter_cname_mini
git: 994a82a01956 - main - tcp: garbage collect unused macros
The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=994a82a0195627027f209f956da1c48cf5089079 commit 994a82a0195627027f209f956da1c48cf5089079 Author: Gleb Smirnoff AuthorDate: 2024-10-18 17:35:38 + Commit: Gleb Smirnoff CommitDate: 2024-10-18 17:35:38 + tcp: garbage collect unused macros Fixes: d40c0d47cd2a8100b8b9719bea092dde0512937a --- sys/netinet/tcp_var.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index 3fd6edccf365..9f28e8247e3e 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -1107,8 +1107,6 @@ structtcpstat { #definetcps_rcvmemdrop tcps_rcvreassfull /* compat */ #ifdef _KERNEL -#defineTI_UNLOCKED 1 -#defineTI_RLOCKED 2 #include #include
Re: git: 4f2ca36c7bec - main - arm64: Disable coverage sanitization of `pmap_update_strided`
On 11 Oct 2024, at 17:53, Mark Johnston wrote: > > The branch main has been updated by markj: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=4f2ca36c7becd20b21ce5ef7256bbd42f732dafe > > commit 4f2ca36c7becd20b21ce5ef7256bbd42f732dafe > Author: Zhuo Ying Jiang Li > AuthorDate: 2024-10-11 16:41:49 + > Commit: Mark Johnston > CommitDate: 2024-10-11 16:52:53 + > >arm64: Disable coverage sanitization of `pmap_update_strided` > >The break-before-make update invalidates PTEs, including the PTE >pointing to curthread, causing a fault in `trace_pc`. This >addresses a similar issue in >01bb9a2a3557bc9389f628d301cd691e08266f1d. This broke* GitHub Actions due to the use of Clang 12 (newest Clang in Ubuntu 20.04 LTS which isn’t EOL until April 2025) which doesn’t support this sanitiser. Probably the easiest thing to do is to leave the relevant __nosanitizefoo defined to nothing unless that sanitiser is actually enabled (via __has_feature), as it’s not necessary outside of that, and if it’s enabled then you know it’s supported? Jess * Masked by the OpenZFS import breaking it earlier in both commit history and build order
Re: git: b88df1e893c4 - main - Reapply "sbin/ping: allow normal users to specify larger packets"
Hi Pedro, let me help to explain you what Maxim is talking about. ping(8) before your change: # ping -c 1 -s 65507 10.1.10.1 PING 10.1.10.1 (10.1.10.1): 65507 data bytes 65515 bytes from 10.1.10.1: icmp_seq=0 ttl=64 time=2.078 ms --- 10.1.10.1 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 2.078/2.078/2.078/0.000 ms After your change: # ping -s 65507 10.1.10.1 ping: packet size too large: 65507 > 65467 This is the regression Maxim is pointing you at. Also, after your patch (running from non-root): > ping -s 1 10.1.10.1 PING 10.1.10.1 (10.1.10.1): 1 data bytes ping: sendto: Message too long And this just shows that you didn't even fully achieve what you wanted. To achieve what you want, you first need to fully revert your patch, and then apply the attached patch. It will consistently disable all the size checks that _our_ ping has, instead of incorrectly and blindly applying a diff from DragonflyBSD. HOWEVER, PLEASE DO NOT COMMIT the attached patch! Please revert what you already committed and start a normal review process on phabricator. You can use my attached patch as a start. Please put both the #network group and the #secteam group. This is a kind of sensitive change that can't be done by a drive by commit. P.S. If you are pinging FreeBSD host, the other side needs to have increased maxfrag to reply: # sysctl net.inet.ip.maxfragsperpacket=44 -- Gleb Smirnoff
git: ba23ab2168ff - main - Update the expat version referenced in libbsdxml.3
The branch main has been updated by ngie: URL: https://cgit.FreeBSD.org/src/commit/?id=ba23ab2168ffabc2c5e647a1a37ab9a8fb482bb8 commit ba23ab2168ffabc2c5e647a1a37ab9a8fb482bb8 Author: Enji Cooper AuthorDate: 2024-10-02 02:26:37 + Commit: Enji Cooper CommitDate: 2024-10-19 00:44:42 + Update the expat version referenced in libbsdxml.3 This change updates the version of expat referenced from 2.6.0 to 2.6.3, correcting documentation post-ffd294a1f4c23863c3e515d16dce31d5509bcb01. Bump .Dd for the change. MFC with: ffd294a1f4c23863c3e515d16dce31d5509bcb01 Differential Revision: https://reviews.freebsd.org/D46865 --- lib/libexpat/libbsdxml.3 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libexpat/libbsdxml.3 b/lib/libexpat/libbsdxml.3 index c6c2518ea41a..2ec1f71b58bb 100644 --- a/lib/libexpat/libbsdxml.3 +++ b/lib/libexpat/libbsdxml.3 @@ -23,7 +23,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\"/ -.Dd February 17, 2024 +.Dd October 1, 2024 .Dt LIBBSDXML 3 .Os .Sh NAME @@ -34,7 +34,7 @@ .Sh DESCRIPTION The .Nm -library is a verbatim copy of the eXpat XML library version 2.6.0. +library is a verbatim copy of the eXpat XML library version 2.6.3. .Pp The .Nm
git: 1e5e331b1dce - main - Correct mergeinfo from 1.14.0 import
The branch main has been updated by ngie: URL: https://cgit.FreeBSD.org/src/commit/?id=1e5e331b1dce6c8bc05def42b41234c4f1fcea44 commit 1e5e331b1dce6c8bc05def42b41234c4f1fcea44 Merge: 92c5681cc347 8ef491440fca Author: Enji Cooper AuthorDate: 2024-10-19 02:08:30 + Commit: Enji Cooper CommitDate: 2024-10-19 02:10:07 + Correct mergeinfo from 1.14.0 import This will help ensure that future vendor updates for this component will be more seamless. Suggested by: jtrc27 Fixes: 28f6c2f292806bf31230a959bc4b19d7081669a7
git: 83069000750d - main - cross-build: fix missing the proper way
The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=83069000750d0517a329caf7d519cadf270ba5f7 commit 83069000750d0517a329caf7d519cadf270ba5f7 Author: Kyle Evans AuthorDate: 2024-10-18 20:44:15 + Commit: Kyle Evans CommitDate: 2024-10-18 20:53:15 + cross-build: fix missing the proper way Add it to tools/build/Makefile with a short note of where it's needed, rather than hamfistedly copying it into the tools/build hierarchy. Reported by:jrtc27 Reviewed by:jrtc27 Fixes: aad507854efd13c43 ("Fix the cross-build after recent commits") Differential Revision: https://reviews.freebsd.org/D46854 --- tools/build/Makefile | 4 ++ tools/build/cross-build/include/common/sys/md4.h | 91 2 files changed, 4 insertions(+), 91 deletions(-) diff --git a/tools/build/Makefile b/tools/build/Makefile index 9e9d203f108b..faf130f3d99c 100644 --- a/tools/build/Makefile +++ b/tools/build/Makefile @@ -304,6 +304,10 @@ SYSINCS+= ${SRCTOP}/sys/sys/ctf.h SYSINCS+= ${SRCTOP}/sys/sys/kbio.h # for kldxref: SYSINCS+= ${SRCTOP}/sys/sys/module.h +.if ${.MAKE.OS} != "FreeBSD" +# for libmd: +SYSINCS+= ${SRCTOP}/sys/sys/md4.h +.endif # We want to run the build with only ${WORLDTMP} in $PATH to ensure we don't # accidentally run tools that are incompatible but happen to be in $PATH. diff --git a/tools/build/cross-build/include/common/sys/md4.h b/tools/build/cross-build/include/common/sys/md4.h deleted file mode 100644 index e00675e9f462.. --- a/tools/build/cross-build/include/common/sys/md4.h +++ /dev/null @@ -1,91 +0,0 @@ -/* MD4.H - header file for MD4C.C - */ - -/*- - SPDX-License-Identifier: RSA-MD - - Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All - rights reserved. - - License to copy and use this software is granted provided that it - is identified as the "RSA Data Security, Inc. MD4 Message-Digest - Algorithm" in all material mentioning or referencing this software - or this function. - License is also granted to make and use derivative works provided - that such works are identified as "derived from the RSA Data - Security, Inc. MD4 Message-Digest Algorithm" in all material - mentioning or referencing the derived work. - - RSA Data Security, Inc. makes no representations concerning either - the merchantability of this software or the suitability of this - software for any particular purpose. It is provided "as is" - without express or implied warranty of any kind. - - These notices must be retained in any copies of any part of this - documentation and/or software. - */ - -#ifndef _SYS_MD4_H_ -#define _SYS_MD4_H_ -/* MD4 context. */ -typedef struct MD4Context { - u_int32_t state[4]; /* state (ABCD) */ - u_int32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */ - unsigned char buffer[64];/* input buffer */ -} MD4_CTX; - -#include - -#ifndef _KERNEL - -/* Ensure libmd symbols do not clash with libcrypto */ - -#ifndef MD4Init -#define MD4Init_libmd_MD4Init -#endif -#ifndef MD4Update -#define MD4Update _libmd_MD4Update -#endif -#ifndef MD4Pad -#define MD4Pad _libmd_MD4Pad -#endif -#ifndef MD4Final -#define MD4Final _libmd_MD4Final -#endif -#ifndef MD4End -#define MD4End _libmd_MD4End -#endif -#ifndef MD4Fd -#define MD4Fd _libmd_MD4Fd -#endif -#ifndef MD4FdChunk -#define MD4FdChunk _libmd_MD4FdChunk -#endif -#ifndef MD4File -#define MD4File_libmd_MD4File -#endif -#ifndef MD4FileChunk -#define MD4FileChunk _libmd_MD4FileChunk -#endif -#ifndef MD4Data -#define MD4Data_libmd_MD4Data -#endif - -#endif - -__BEGIN_DECLS -void MD4Init(MD4_CTX *); -void MD4Update(MD4_CTX *, const unsigned char *, unsigned int); -void MD4Pad(MD4_CTX *); -void MD4Final(unsigned char [__min_size(16)], MD4_CTX *); -#ifndef _KERNEL -char * MD4End(MD4_CTX *, char *); -char * MD4Fd(int, char *); -char * MD4FdChunk(int, char *, off_t, off_t); -char * MD4File(const char *, char *); -char * MD4FileChunk(const char *, char *, off_t, off_t); -char * MD4Data(const void *, unsigned int, char *); -#endif -__END_DECLS - -#endif /* _SYS_MD4_H_ */
Re: git: b88df1e893c4 - main - Reapply "sbin/ping: allow normal users to specify larger packets"
On Fri, Oct 18, 2024 at 02:15:43PM -0700, Gleb Smirnoff wrote: T> To achieve what you want, you first need to fully revert your patch, and then T> apply the attached patch. It will consistently disable all the size checks T> that _our_ ping has, instead of incorrectly and blindly applying a diff from T> DragonflyBSD. T> T> HOWEVER, PLEASE DO NOT COMMIT the attached patch! Sorry, forgot the attach in the previous email. -- Gleb Smirnoff diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c index d9d544bc75c8..817889eaf599 100644 --- a/sbin/ping/ping.c +++ b/sbin/ping/ping.c @@ -320,11 +320,6 @@ ping(int argc, char *const *argv) optarg); } sweepmax = (int)ltmp; - if (uid != 0 && sweepmax > DEFDATALEN) { -errc(EX_NOPERM, EPERM, -"packet size too large: %d > %u", -sweepmax, DEFDATALEN); - } options |= F_SWEEP; break; case 'g': /* Minimum packet size for ping sweep */ @@ -334,11 +329,6 @@ ping(int argc, char *const *argv) optarg); } sweepmin = (int)ltmp; - if (uid != 0 && sweepmin > DEFDATALEN) { -errc(EX_NOPERM, EPERM, -"packet size too large: %d > %u", -sweepmin, DEFDATALEN); - } options |= F_SWEEP; break; case 'H': @@ -351,11 +341,6 @@ ping(int argc, char *const *argv) optarg); } sweepincr = (int)ltmp; - if (uid != 0 && sweepincr > DEFDATALEN) { -errc(EX_NOPERM, EPERM, -"packet size too large: %d > %u", -sweepincr, DEFDATALEN); - } options |= F_SWEEP; break; case 'I': /* multicast interface */ @@ -458,12 +443,6 @@ ping(int argc, char *const *argv) errx(EX_USAGE, "invalid packet size: `%s'", optarg); datalen = (int)ltmp; - if (uid != 0 && datalen > DEFDATALEN) { -errno = EPERM; -err(EX_NOPERM, -"packet size too large: %d > %u", -datalen, DEFDATALEN); - } break; case 'T': /* multicast TTL */ ltmp = strtonum(optarg, 0, MAXTTL, &errstr); @@ -811,9 +790,8 @@ ping(int argc, char *const *argv) cap_rights_init(&rights, CAP_RECV, CAP_EVENT); if (caph_rights_limit(srecv, &rights) < 0) err(1, "cap_rights_limit srecv setsockopt"); - if (uid == 0) - (void)setsockopt(ssend, SOL_SOCKET, SO_SNDBUF, (char *)&hold, - sizeof(hold)); + (void)setsockopt(ssend, SOL_SOCKET, SO_SNDBUF, (char *)&hold, + sizeof(hold)); /* CAP_SETSOCKOPT removed */ cap_rights_init(&rights, CAP_SEND); if (caph_rights_limit(ssend, &rights) < 0)
git: b8007cfdb72c - main - mididump: fix gcc build
The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=b8007cfdb72c1be27d1d93937886fd60f21915ab commit b8007cfdb72c1be27d1d93937886fd60f21915ab Author: Gleb Smirnoff AuthorDate: 2024-10-18 21:38:04 + Commit: Gleb Smirnoff CommitDate: 2024-10-18 21:38:04 + mididump: fix gcc build --- usr.bin/mididump/mididump.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.bin/mididump/mididump.c b/usr.bin/mididump/mididump.c index 9c8fe62c9859..16bd775f10d4 100644 --- a/usr.bin/mididump/mididump.c +++ b/usr.bin/mididump/mididump.c @@ -44,10 +44,10 @@ #define NOTE2FREQ(n) (440 * pow(2.0f, ((float)n - 69) / 12)) #define CHAN_MASK 0x0f -struct note { +static struct note { const char *name; const char *alt; -} static notes[] = { +} notes[] = { { "C", NULL }, { "C#", "Db" }, { "D", NULL }, @@ -211,7 +211,7 @@ main(int argc, char *argv[]) case 0xb0 ... 0xbf: b1 = read_byte(fd); b2 = read_byte(fd); - if (b1 < 0 || b1 > ARRLEN(ctls) - 1) + if (b1 > ARRLEN(ctls) - 1) break; printf("Control/Mode change channel=%d, " "control=%d (%s), value=%d",
git: 92c5681cc347 - main - Revert "Add 'origin/googletest/' from commit '8ef491440fcaec96f899d73e08873426c78583a4'"
The branch main has been updated by ngie: URL: https://cgit.FreeBSD.org/src/commit/?id=92c5681cc3470c88ba3aa0d8a4ecb0a9af0173bf commit 92c5681cc3470c88ba3aa0d8a4ecb0a9af0173bf Author: Enji Cooper AuthorDate: 2024-10-19 02:07:19 + Commit: Enji Cooper CommitDate: 2024-10-19 02:07:19 + Revert "Add 'origin/googletest/' from commit '8ef491440fcaec96f899d73e08873426c78583a4'" I used the wrong prefix for googletest; try again. This reverts commit a52d355b540f9b7ba13edf20efae5f33e69de189, reversing changes made to bcf81d7794a7b20425cdb48a580d977c49f75251. --- origin/googletest/.clang-format|4 - .../.github/ISSUE_TEMPLATE/00-bug_report.yml | 53 - .../.github/ISSUE_TEMPLATE/10-feature_request.yml | 33 - .../googletest/.github/ISSUE_TEMPLATE/config.yml |5 - origin/googletest/.github/workflows/gtest-ci.yml | 43 - origin/googletest/.gitignore | 88 - origin/googletest/.travis.yml | 81 - origin/googletest/BUILD.bazel | 219 - origin/googletest/CMakeLists.txt | 27 - origin/googletest/CONTRIBUTING.md | 141 - origin/googletest/CONTRIBUTORS | 65 - origin/googletest/LICENSE | 28 - origin/googletest/README.md| 146 - origin/googletest/WORKSPACE| 27 - origin/googletest/ci/linux-presubmit.sh| 137 - origin/googletest/ci/macos-presubmit.sh| 76 - origin/googletest/ci/windows-presubmit.bat | 58 - origin/googletest/docs/_config.yml |1 - origin/googletest/docs/_data/navigation.yml| 43 - origin/googletest/docs/_layouts/default.html | 58 - origin/googletest/docs/_sass/main.scss | 200 - origin/googletest/docs/advanced.md | 2436 -- origin/googletest/docs/assets/css/style.scss |5 - .../docs/community_created_documentation.md|7 - origin/googletest/docs/faq.md | 692 -- origin/googletest/docs/gmock_cheat_sheet.md| 241 - origin/googletest/docs/gmock_cook_book.md | 4344 --- origin/googletest/docs/gmock_faq.md| 390 - origin/googletest/docs/gmock_for_dummies.md| 700 -- origin/googletest/docs/index.md| 22 - origin/googletest/docs/pkgconfig.md| 144 - origin/googletest/docs/platforms.md|8 - origin/googletest/docs/primer.md | 483 -- origin/googletest/docs/quickstart-bazel.md | 153 - origin/googletest/docs/quickstart-cmake.md | 157 - origin/googletest/docs/reference/actions.md| 115 - origin/googletest/docs/reference/assertions.md | 633 -- origin/googletest/docs/reference/matchers.md | 302 - origin/googletest/docs/reference/mocking.md| 589 -- origin/googletest/docs/reference/testing.md| 1432 origin/googletest/docs/samples.md | 22 - origin/googletest/googlemock/CMakeLists.txt| 209 - origin/googletest/googlemock/README.md | 40 - origin/googletest/googlemock/cmake/gmock.pc.in | 10 - .../googletest/googlemock/cmake/gmock_main.pc.in | 10 - origin/googletest/googlemock/docs/README.md|4 - .../googlemock/include/gmock/gmock-actions.h | 2297 -- .../googlemock/include/gmock/gmock-cardinalities.h | 159 - .../include/gmock/gmock-function-mocker.h | 518 -- .../googlemock/include/gmock/gmock-matchers.h | 5623 -- .../googlemock/include/gmock/gmock-more-actions.h | 658 -- .../googlemock/include/gmock/gmock-more-matchers.h | 120 - .../googlemock/include/gmock/gmock-nice-strict.h | 277 - .../googlemock/include/gmock/gmock-spec-builders.h | 2148 -- origin/googletest/googlemock/include/gmock/gmock.h | 96 - .../include/gmock/internal/custom/README.md| 18 - .../internal/custom/gmock-generated-actions.h |7 - .../include/gmock/internal/custom/gmock-matchers.h | 37 - .../include/gmock/internal/custom/gmock-port.h | 40 - .../include/gmock/internal/gmock-internal-utils.h | 487 -- .../googlemock/include/gmock/internal/gmock-port.h | 139 - .../googlemock/include/gmock/internal/gmock-pp.h | 279 - origin/googletest/googlemock/src/gmock-all.cc | 46 - .../googlemock/src/gmock-cardinalities.cc | 155 - .../googlemock/src/gmock-internal-utils.cc | 257 - origin/googletest/googlemock/src/gmock-matchers.cc | 479 -- .../googlemock/src/gmock-spec-builders.cc | 791 -- origin/googletest/googlemock/src/gmock.cc | 225 - origin/googletest/googlemock/src/gmock_main.cc | 73 - origin/googletest/googlemock/test/BUILD.bazel | 118 - .../googlemock/test/gmock-actions_test.cc | 2169 -- .../
git: bcf81d7794a7 - main - contrib/googletest: correct mergeinfo from 1.14.0 import
The branch main has been updated by ngie: URL: https://cgit.FreeBSD.org/src/commit/?id=bcf81d7794a7b20425cdb48a580d977c49f75251 commit bcf81d7794a7b20425cdb48a580d977c49f75251 Merge: ba23ab2168ff 8ef491440fca Author: Enji Cooper AuthorDate: 2024-10-19 01:08:26 + Commit: Enji Cooper CommitDate: 2024-10-19 01:11:03 + contrib/googletest: correct mergeinfo from 1.14.0 import
git: a52d355b540f - main - Add 'origin/googletest/' from commit '8ef491440fcaec96f899d73e08873426c78583a4'
The branch main has been updated by ngie: URL: https://cgit.FreeBSD.org/src/commit/?id=a52d355b540f9b7ba13edf20efae5f33e69de189 commit a52d355b540f9b7ba13edf20efae5f33e69de189 Merge: bcf81d7794a7 8ef491440fca Author: Enji Cooper AuthorDate: 2024-10-19 01:28:19 + Commit: Enji Cooper CommitDate: 2024-10-19 02:04:12 + Add 'origin/googletest/' from commit '8ef491440fcaec96f899d73e08873426c78583a4' This helps bootstrap the mergeinfo so future googletest imports can be done more easily. Suggested by: jrtc27 Fixes: 28f6c2f292806bf31230a959bc4b19d7081669a7 git-subtree-dir: origin/googletest git-subtree-mainline: bcf81d7794a7b20425cdb48a580d977c49f75251 git-subtree-split: 8ef491440fcaec96f899d73e08873426c78583a4 origin/googletest/.clang-format|4 + .../.github/ISSUE_TEMPLATE/00-bug_report.yml | 53 + .../.github/ISSUE_TEMPLATE/10-feature_request.yml | 33 + .../googletest/.github/ISSUE_TEMPLATE/config.yml |5 + origin/googletest/.github/workflows/gtest-ci.yml | 43 + origin/googletest/.gitignore | 88 + origin/googletest/.travis.yml | 81 + origin/googletest/BUILD.bazel | 219 + origin/googletest/CMakeLists.txt | 27 + origin/googletest/CONTRIBUTING.md | 141 + origin/googletest/CONTRIBUTORS | 65 + origin/googletest/LICENSE | 28 + origin/googletest/README.md| 146 + origin/googletest/WORKSPACE| 27 + origin/googletest/ci/linux-presubmit.sh| 137 + origin/googletest/ci/macos-presubmit.sh| 76 + origin/googletest/ci/windows-presubmit.bat | 58 + origin/googletest/docs/_config.yml |1 + origin/googletest/docs/_data/navigation.yml| 43 + origin/googletest/docs/_layouts/default.html | 58 + origin/googletest/docs/_sass/main.scss | 200 + origin/googletest/docs/advanced.md | 2436 ++ origin/googletest/docs/assets/css/style.scss |5 + .../docs/community_created_documentation.md|7 + origin/googletest/docs/faq.md | 692 ++ origin/googletest/docs/gmock_cheat_sheet.md| 241 + origin/googletest/docs/gmock_cook_book.md | 4344 +++ origin/googletest/docs/gmock_faq.md| 390 + origin/googletest/docs/gmock_for_dummies.md| 700 ++ origin/googletest/docs/index.md| 22 + origin/googletest/docs/pkgconfig.md| 144 + origin/googletest/docs/platforms.md|8 + origin/googletest/docs/primer.md | 483 ++ origin/googletest/docs/quickstart-bazel.md | 153 + origin/googletest/docs/quickstart-cmake.md | 157 + origin/googletest/docs/reference/actions.md| 115 + origin/googletest/docs/reference/assertions.md | 633 ++ origin/googletest/docs/reference/matchers.md | 302 + origin/googletest/docs/reference/mocking.md| 589 ++ origin/googletest/docs/reference/testing.md| 1432 origin/googletest/docs/samples.md | 22 + origin/googletest/googlemock/CMakeLists.txt| 209 + origin/googletest/googlemock/README.md | 40 + origin/googletest/googlemock/cmake/gmock.pc.in | 10 + .../googletest/googlemock/cmake/gmock_main.pc.in | 10 + origin/googletest/googlemock/docs/README.md|4 + .../googlemock/include/gmock/gmock-actions.h | 2297 ++ .../googlemock/include/gmock/gmock-cardinalities.h | 159 + .../include/gmock/gmock-function-mocker.h | 518 ++ .../googlemock/include/gmock/gmock-matchers.h | 5623 ++ .../googlemock/include/gmock/gmock-more-actions.h | 658 ++ .../googlemock/include/gmock/gmock-more-matchers.h | 120 + .../googlemock/include/gmock/gmock-nice-strict.h | 277 + .../googlemock/include/gmock/gmock-spec-builders.h | 2148 ++ origin/googletest/googlemock/include/gmock/gmock.h | 96 + .../include/gmock/internal/custom/README.md| 18 + .../internal/custom/gmock-generated-actions.h |7 + .../include/gmock/internal/custom/gmock-matchers.h | 37 + .../include/gmock/internal/custom/gmock-port.h | 40 + .../include/gmock/internal/gmock-internal-utils.h | 487 ++ .../googlemock/include/gmock/internal/gmock-port.h | 139 + .../googlemock/include/gmock/internal/gmock-pp.h | 279 + origin/googletest/googlemock/src/gmock-all.cc | 46 + .../googlemock/src/gmock-cardinalities.cc | 155 + .../googlemock/src/gmock-internal-utils.cc | 257 + origin/googletest/googlemock/src/gmock-matchers.cc | 479 ++ .../googlemock/src/gmock-spec-builders.cc | 791 ++ origin/googletest/googlemock/src/gmock.cc | 225 + origin/googl
git: 9684658e35ab - main - libc/csu: Unify INIT_RELOCS across architectures
The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=9684658e35ab033c79e0519e3681d9a194976b71 commit 9684658e35ab033c79e0519e3681d9a194976b71 Author: Jessica Clarke AuthorDate: 2024-10-18 23:48:52 + Commit: Jessica Clarke CommitDate: 2024-10-18 23:48:52 + libc/csu: Unify INIT_RELOCS across architectures Some architectures don't need any arguments, whilst others need auxargs, which they get by passing in env thanks to INIT_RELOCS referencing the local variable in __libc_start1(_gcrt) by name. This is unnecessarily confusing, fragile (one has to look at INIT_IRELOCS's definition to see that it uses env) and duplicates code between architectures. Instead, implement it more like rtld-elf. Each architecture provides an ifunc_init that takes the auxargs directly, and those that don't need it can just ignore it. Reviewed by:kib MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D47188 --- lib/libc/csu/aarch64/Makefile.inc| 3 +-- lib/libc/csu/aarch64/reloc.c | 7 +++ lib/libc/csu/amd64/Makefile.inc | 3 +-- lib/libc/csu/amd64/reloc.c | 4 +++- lib/libc/csu/arm/Makefile.inc| 3 +-- lib/libc/csu/i386/Makefile.inc | 3 +-- lib/libc/csu/i386/reloc.c| 4 +++- lib/libc/csu/libc_start1.c | 28 lib/libc/csu/powerpc/Makefile.inc| 3 +-- lib/libc/csu/powerpc64/Makefile.inc | 3 +-- lib/libc/csu/powerpc64/reloc.c | 9 + lib/libc/csu/powerpcspe/Makefile.inc | 3 +-- lib/libc/csu/riscv/Makefile.inc | 3 +-- lib/libc/csu/riscv/reloc.c | 9 + 14 files changed, 43 insertions(+), 42 deletions(-) diff --git a/lib/libc/csu/aarch64/Makefile.inc b/lib/libc/csu/aarch64/Makefile.inc index b3420a638164..6c315c5e2624 100644 --- a/lib/libc/csu/aarch64/Makefile.inc +++ b/lib/libc/csu/aarch64/Makefile.inc @@ -1,4 +1,3 @@ # -CFLAGS+= -DCRT_IRELOC_RELA \ - -DINIT_IRELOCS="" +CFLAGS+= -DCRT_IRELOC_RELA diff --git a/lib/libc/csu/aarch64/reloc.c b/lib/libc/csu/aarch64/reloc.c index ead48a8ad4fb..4ba7920bcb07 100644 --- a/lib/libc/csu/aarch64/reloc.c +++ b/lib/libc/csu/aarch64/reloc.c @@ -24,6 +24,13 @@ * SUCH DAMAGE. */ +#include + +static void +ifunc_init(const Elf_Auxinfo *aux __unused) +{ +} + static void crt1_handle_rela(const Elf_Rela *r) { diff --git a/lib/libc/csu/amd64/Makefile.inc b/lib/libc/csu/amd64/Makefile.inc index f14033217580..6c315c5e2624 100644 --- a/lib/libc/csu/amd64/Makefile.inc +++ b/lib/libc/csu/amd64/Makefile.inc @@ -1,4 +1,3 @@ # -CFLAGS+= -DCRT_IRELOC_RELA \ - -DINIT_IRELOCS="init_cpu_features()" +CFLAGS+= -DCRT_IRELOC_RELA diff --git a/lib/libc/csu/amd64/reloc.c b/lib/libc/csu/amd64/reloc.c index 6424d69fbd5c..f1f83db9a391 100644 --- a/lib/libc/csu/amd64/reloc.c +++ b/lib/libc/csu/amd64/reloc.c @@ -23,6 +23,8 @@ * SUCH DAMAGE. */ +#include + #include #include @@ -30,7 +32,7 @@ static uint32_t cpu_feature, cpu_feature2; static uint32_t cpu_stdext_feature, cpu_stdext_feature2; static void -init_cpu_features(void) +ifunc_init(const Elf_Auxinfo *aux __unused) { u_int p[4]; diff --git a/lib/libc/csu/arm/Makefile.inc b/lib/libc/csu/arm/Makefile.inc index 2534e6579f38..ddead75f874d 100644 --- a/lib/libc/csu/arm/Makefile.inc +++ b/lib/libc/csu/arm/Makefile.inc @@ -1,4 +1,3 @@ # -CFLAGS+= -DCRT_IRELOC_SUPPRESS \ - -DINIT_IRELOCS="" +CFLAGS+= -DCRT_IRELOC_SUPPRESS diff --git a/lib/libc/csu/i386/Makefile.inc b/lib/libc/csu/i386/Makefile.inc index f3f8c2b176ce..32018000e1f2 100644 --- a/lib/libc/csu/i386/Makefile.inc +++ b/lib/libc/csu/i386/Makefile.inc @@ -1,4 +1,3 @@ # -CFLAGS+= -DCRT_IRELOC_REL \ - -DINIT_IRELOCS="init_cpu_features()" +CFLAGS+= -DCRT_IRELOC_REL diff --git a/lib/libc/csu/i386/reloc.c b/lib/libc/csu/i386/reloc.c index 1c9ec173facc..7097f58d8f26 100644 --- a/lib/libc/csu/i386/reloc.c +++ b/lib/libc/csu/i386/reloc.c @@ -23,6 +23,8 @@ * SUCH DAMAGE. */ +#include + #include #include @@ -30,7 +32,7 @@ static uint32_t cpu_feature, cpu_feature2; static uint32_t cpu_stdext_feature, cpu_stdext_feature2; static void -init_cpu_features(void) +ifunc_init(const Elf_Auxinfo *aux __unused) { u_int cpuid_supported, p[4]; diff --git a/lib/libc/csu/libc_start1.c b/lib/libc/csu/libc_start1.c index f0e708e405ce..045ea1e68141 100644 --- a/lib/libc/csu/libc_start1.c +++ b/lib/libc/csu/libc_start1.c @@ -137,6 +137,24 @@ handle_argv(int argc, char *argv[], char **env) } } +static void +handle_irelocs(char *env[]) +{ +#ifndef CRT_IRELOC_SUPPRESS + const Elf_Auxinfo *aux; + + /* Find the auxiliary vector on the stack. */ + while (*env++ != 0) /* Skip over environment, and NULL terminator */ + ; + aux = (const
git: 7aa6667623be - main - lib/clang: Commit cleaned-up workaround for building on RISC-V
The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=7aa6667623bef7306009d50a571e5e8c7766a174 commit 7aa6667623bef7306009d50a571e5e8c7766a174 Author: Jessica Clarke AuthorDate: 2024-10-18 12:59:48 + Commit: Jessica Clarke CommitDate: 2024-10-18 12:59:48 + lib/clang: Commit cleaned-up workaround for building on RISC-V There is a long-standing issue on RISC-V around --gc-sections when statically linking, which affects the bootstrap build of LLVM. Since fixing this properly has remained a TODO for years, commit the workaround with documentation so that building natively from source works out of the box. PR: 258358 MFC after: 1 week --- lib/clang/llvm.build.mk | 8 1 file changed, 8 insertions(+) diff --git a/lib/clang/llvm.build.mk b/lib/clang/llvm.build.mk index 7b16f4485340..2520637e2d06 100644 --- a/lib/clang/llvm.build.mk +++ b/lib/clang/llvm.build.mk @@ -109,6 +109,14 @@ CFLAGS+= -fdata-sections LDFLAGS+= -Wl,-dead_strip .else LDFLAGS+= -Wl,--gc-sections +# XXX: --gc-sections strips the ELF brand note and on RISC-V the OS/ABI ends up +# as NONE, so for statically-linked binaries, i.e. lacking an interpreter, +# get_brandinfo finds nothing and (f)execve fails with ENOEXEC. Work around +# this by manually setting the OS/ABI field via the emulation. +.if ${MACHINE_ARCH:Mriscv64*} != "" && ${NO_SHARED:Uno:tl} != "no" && \ +(${.MAKE.OS} == "FreeBSD" || !defined(BOOTSTRAPPING)) +LDFLAGS+= -Wl,-m,elf64lriscv_fbsd +.endif .endif CXXSTD?= c++17
git: 167bfde7057f - main - ftime.3: fix typo in spelling of libutil
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=167bfde7057f38894c8fbd790a65136f0174368e commit 167bfde7057f38894c8fbd790a65136f0174368e Author: Keith White AuthorDate: 2024-10-18 12:49:30 + Commit: Konstantin Belousov CommitDate: 2024-10-18 12:50:24 + ftime.3: fix typo in spelling of libutil PR: 282171 MFC after: 3 days --- lib/libutil/ftime.3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libutil/ftime.3 b/lib/libutil/ftime.3 index 043bbe2ed2c3..e5770367f022 100644 --- a/lib/libutil/ftime.3 +++ b/lib/libutil/ftime.3 @@ -32,7 +32,7 @@ .Nm ftime .Nd get date and time .Sh LIBRARY -.Lb libuitl +.Lb libutil .Sh SYNOPSIS .In sys/types.h .In sys/timeb.h
git: 8829d4cb09d3 - main - pf tests: Lower chances of false positives for mbuf:inet6_in_mbuf_len
The branch main has been updated by igoro: URL: https://cgit.FreeBSD.org/src/commit/?id=8829d4cb09d39801d3b6bcf8ab8c6b72dd757636 commit 8829d4cb09d39801d3b6bcf8ab8c6b72dd757636 Author: Igor Ostapenko AuthorDate: 2024-10-18 16:24:11 + Commit: Igor Ostapenko CommitDate: 2024-10-18 16:24:11 + pf tests: Lower chances of false positives for mbuf:inet6_in_mbuf_len Reviewed by:kp Approved by:kp (mentor) Differential Revision: https://reviews.freebsd.org/D47175 --- tests/sys/netpfil/pf/mbuf.sh | 5 + 1 file changed, 5 insertions(+) diff --git a/tests/sys/netpfil/pf/mbuf.sh b/tests/sys/netpfil/pf/mbuf.sh index a4664718093a..d845f793a969 100644 --- a/tests/sys/netpfil/pf/mbuf.sh +++ b/tests/sys/netpfil/pf/mbuf.sh @@ -119,6 +119,11 @@ inet6_in_mbuf_len_body() "pass quick inet6 proto icmp6 icmp6-type { neighbrsol, neighbradv }" atf_check -s not-exit:0 -o ignore ping -c1 -t1 2001:db8::2 + # Avoid redundant ICMPv6 packets to avoid false positives during + # counting of net.dummymbuf.hits. + ndp -i ${epair}a -- -nud + jexec alcatraz ndp -i ${epair}b -- -nud + # Should be allowed by from/to addresses pft_set_rules alcatraz \ "block" \
git: 1363acbf25de - main - libc/csu: Support IFUNCs on riscv
The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=1363acbf25de4c36e183cfa0b0e801d4dd9bf2ad commit 1363acbf25de4c36e183cfa0b0e801d4dd9bf2ad Author: Jessica Clarke AuthorDate: 2024-10-18 18:14:58 + Commit: Jessica Clarke CommitDate: 2024-10-18 18:14:58 + libc/csu: Support IFUNCs on riscv When adding support to rtld-elf I neglected the fact that static binaries can have IFUNCs. Add support for this too. Fixes: 729d2b16b74f ("rtld-elf: Support IFUNCs on riscv") MFC after: 1 week --- lib/libc/csu/riscv/Makefile.inc | 4 +-- lib/libc/csu/riscv/reloc.c | 63 + 2 files changed, 65 insertions(+), 2 deletions(-) diff --git a/lib/libc/csu/riscv/Makefile.inc b/lib/libc/csu/riscv/Makefile.inc index 2534e6579f38..5d59d40eb393 100644 --- a/lib/libc/csu/riscv/Makefile.inc +++ b/lib/libc/csu/riscv/Makefile.inc @@ -1,4 +1,4 @@ # -CFLAGS+= -DCRT_IRELOC_SUPPRESS \ - -DINIT_IRELOCS="" +CFLAGS+= -DCRT_IRELOC_RELA \ + -DINIT_IRELOCS="init_cpu_features(env)" diff --git a/lib/libc/csu/riscv/reloc.c b/lib/libc/csu/riscv/reloc.c new file mode 100644 index ..036ea3de8701 --- /dev/null +++ b/lib/libc/csu/riscv/reloc.c @@ -0,0 +1,63 @@ +/*- + * Copyright (c) 2019 Leandro Lupori + * Copyright (c) 2024 Jessica Clarke + * + * 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. + * + * 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. + */ + +static unsigned long elf_hwcap; + +static void +init_cpu_features(char **env) +{ + const Elf_Auxinfo *aux; + + /* Find the auxiliary vector on the stack. */ + while (*env++ != 0) /* Skip over environment, and NULL terminator */ + ; + aux = (const Elf_Auxinfo *)env; + + /* Digest the auxiliary vector. */ + for (; aux->a_type != AT_NULL; aux++) { + switch (aux->a_type) { + case AT_HWCAP: + elf_hwcap = (uint32_t)aux->a_un.a_val; + break; + } + } +} + +static void +crt1_handle_rela(const Elf_Rela *r) +{ + typedef Elf_Addr (*ifunc_resolver_t)( + unsigned long, unsigned long, unsigned long, unsigned long, + unsigned long, unsigned long, unsigned long, unsigned long); + Elf_Addr *ptr, *where, target; + + switch (ELF_R_TYPE(r->r_info)) { + case R_RISCV_IRELATIVE: + ptr = (Elf_Addr *)r->r_addend; + where = (Elf_Addr *)r->r_offset; + target = ((ifunc_resolver_t)ptr)(elf_hwcap, + 0, 0, 0, 0, 0, 0, 0); + *where = target; + break; + } +}
git: d41a40f48482 - main - depend-cleanup.sh: Clean up after riscv static binary IFUNC addition
The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=d41a40f484826e90ed78dce5f006712b0eeaf501 commit d41a40f484826e90ed78dce5f006712b0eeaf501 Author: Jessica Clarke AuthorDate: 2024-10-18 18:15:30 + Commit: Jessica Clarke CommitDate: 2024-10-18 18:15:30 + depend-cleanup.sh: Clean up after riscv static binary IFUNC addition reloc.c is conditionally included by libc_start1.c so existing builds don't feature it in the .depend file and won't know they need to rebuild libc_start1.c. MFC after: 1 week --- tools/build/depend-cleanup.sh | 16 1 file changed, 16 insertions(+) diff --git a/tools/build/depend-cleanup.sh b/tools/build/depend-cleanup.sh index 94cafbd9a8d6..001a450bf182 100755 --- a/tools/build/depend-cleanup.sh +++ b/tools/build/depend-cleanup.sh @@ -199,3 +199,19 @@ clean_dep cddl/lib/libzpool zfs_debug c "linux/zfs/zfs_debug\.c" # 20241011 clean_dep cddl/lib/libzpool arc_os c "linux/zfs/arc_os\.c" + +# 20241018 1363acbf25delibc/csu: Support IFUNCs on riscv +if [ ${MACHINE} = riscv ]; then + for f in "$OBJTOP"/lib/libc/.depend.libc_start1.*o; do + if [ ! -f "$f" ]; then + continue + fi + if ! grep -q 'lib/libc/csu/riscv/reloc\.c' "$f"; then + echo "Removing stale dependencies and objects for libc_start1.c" + run rm -f \ + "$OBJTOP"/lib/libc/.depend.libc_start1.* \ + "$OBJTOP"/lib/libc/libc_start1.*o + break + fi + done +fi
git: 3b2cf9381ef8 - main - amd64: do not pass -z rodynamic to ld.bfd when building vdso
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3b2cf9381ef86847603c3c94811f638660c417ae commit 3b2cf9381ef86847603c3c94811f638660c417ae Author: Konstantin Belousov AuthorDate: 2024-10-18 14:09:26 + Commit: Konstantin Belousov CommitDate: 2024-10-18 18:48:56 + amd64: do not pass -z rodynamic to ld.bfd when building vdso Apparently newer versions of binutils complain instead of silently ignoring the unknown -z option. Reported by:bz Reviewed by:emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D47176 --- sys/tools/amd64_ia32_vdso.sh | 7 ++- sys/tools/amd64_vdso.sh | 9 +++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/sys/tools/amd64_ia32_vdso.sh b/sys/tools/amd64_ia32_vdso.sh index 59923749042f..85d2299b45d0 100644 --- a/sys/tools/amd64_ia32_vdso.sh +++ b/sys/tools/amd64_ia32_vdso.sh @@ -34,9 +34,14 @@ ${CC} -x assembler-with-cpp -DLOCORE -fPIC -nostdinc -c -m32 \ -o ia32_sigtramp.pico -I. -I"${S}" -include opt_global.h \ "${S}"/amd64/ia32/ia32_sigtramp.S +if ${LD} --version | ${AWK} '/^GNU ld/{exit 1}' ; then +RODYNAMIC="-z rodynamic" +else +RODYNAMIC="" +fi ${LD} --shared -Bsymbolic -soname="elf-vdso32.so.1" \ -T "${S}"/conf/vdso_amd64_ia32.ldscript \ - --eh-frame-hdr --no-undefined -z rodynamic -z norelro -nmagic \ + --eh-frame-hdr --no-undefined ${RODYNAMIC} -z norelro -nmagic \ --hash-style=sysv --fatal-warnings --strip-all \ -o elf-vdso32.so.1 ia32_sigtramp.pico diff --git a/sys/tools/amd64_vdso.sh b/sys/tools/amd64_vdso.sh index aec0694ebdb1..2a83ae874ab7 100644 --- a/sys/tools/amd64_vdso.sh +++ b/sys/tools/amd64_vdso.sh @@ -40,12 +40,17 @@ ${CC} -x assembler-with-cpp -DLOCORE -fPIC -nostdinc -c \ # # -z rodynamic is undocumented lld-specific option, seemingly required # for lld to avoid putting dynamic into dedicated writeable segment, -# despite ldscript placement. It is ignored by ld.bfd but ldscript +# despite ldscript placement. It is omitted for ld.bfd, but ldscript # alone is enough there. # +if ${LD} --version | ${AWK} '/^GNU ld/{exit 1}' ; then +RODYNAMIC="-z rodynamic" +else +RODYNAMIC="" +fi ${LD} --shared -Bsymbolic -soname="elf-vdso.so.1" \ -T "${S}"/conf/vdso_amd64.ldscript \ - --eh-frame-hdr --no-undefined -z rodynamic -z norelro -nmagic \ + --eh-frame-hdr --no-undefined ${RODYNAMIC} -z norelro -nmagic \ --hash-style=sysv --fatal-warnings --strip-all \ -o elf-vdso.so.1 sigtramp.pico
git: 366d6a424e1f - main - ipmi: remove timeout from the ipmi_driver_request method
The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=366d6a424e1faad9c151c5794978e218a79fbed8 commit 366d6a424e1faad9c151c5794978e218a79fbed8 Author: Gleb Smirnoff AuthorDate: 2024-10-18 19:30:09 + Commit: Gleb Smirnoff CommitDate: 2024-10-18 19:30:09 + ipmi: remove timeout from the ipmi_driver_request method Driver requests are done with stack allocated request. The request is put on the tailq and then we msleep(9) until kernel process processes it. If we timeout from this sleep, the kernel process may still read the request from our stack, which may already be reused by some other code. Make this sleep unbound and rely on the kernel process that does all its I/O with timouts and will eventually wake us up. Reviewed by:jhb Differential Revision: https://reviews.freebsd.org/D47179 --- sys/dev/ipmi/ipmi.c | 21 ++--- sys/dev/ipmi/ipmi_bt.c | 6 +++--- sys/dev/ipmi/ipmi_kcs.c | 8 sys/dev/ipmi/ipmi_opal.c | 10 -- sys/dev/ipmi/ipmi_smic.c | 2 +- sys/dev/ipmi/ipmi_ssif.c | 5 ++--- sys/dev/ipmi/ipmivars.h | 5 ++--- 7 files changed, 26 insertions(+), 31 deletions(-) diff --git a/sys/dev/ipmi/ipmi.c b/sys/dev/ipmi/ipmi.c index efb8a7e7669b..5f759017441c 100644 --- a/sys/dev/ipmi/ipmi.c +++ b/sys/dev/ipmi/ipmi.c @@ -360,7 +360,7 @@ ipmi_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, kreq->ir_request[req->msg.data_len + 7] = ipmi_ipmb_checksum(&kreq->ir_request[4], req->msg.data_len + 3); - error = ipmi_submit_driver_request(sc, kreq, MAX_TIMEOUT); + error = ipmi_submit_driver_request(sc, kreq); if (error != 0) return (error); @@ -565,11 +565,10 @@ ipmi_complete_request(struct ipmi_softc *sc, struct ipmi_request *req) /* Perform an internal driver request. */ int -ipmi_submit_driver_request(struct ipmi_softc *sc, struct ipmi_request *req, -int timo) +ipmi_submit_driver_request(struct ipmi_softc *sc, struct ipmi_request *req) { - return (sc->ipmi_driver_request(sc, req, timo)); + return (sc->ipmi_driver_request(sc, req)); } /* @@ -636,7 +635,7 @@ ipmi_reset_watchdog(struct ipmi_softc *sc) IPMI_ALLOC_DRIVER_REQUEST(req, IPMI_ADDR(IPMI_APP_REQUEST, 0), IPMI_RESET_WDOG, 0, 0); - error = ipmi_submit_driver_request(sc, req, 0); + error = ipmi_submit_driver_request(sc, req); if (error) { device_printf(sc->ipmi_dev, "Failed to reset watchdog\n"); } else if (req->ir_compcode == 0x80) { @@ -677,7 +676,7 @@ ipmi_set_watchdog(struct ipmi_softc *sc, unsigned int sec) req->ir_request[4] = 0; req->ir_request[5] = 0; } - error = ipmi_submit_driver_request(sc, req, 0); + error = ipmi_submit_driver_request(sc, req); if (error) { device_printf(sc->ipmi_dev, "Failed to set watchdog\n"); } else if (req->ir_compcode != 0) { @@ -812,7 +811,7 @@ ipmi_power_cycle(void *arg, int howto) IPMI_CHASSIS_CONTROL, 1, 0); req->ir_request[0] = IPMI_CC_POWER_CYCLE; - ipmi_submit_driver_request(sc, req, MAX_TIMEOUT); + ipmi_submit_driver_request(sc, req); if (req->ir_error != 0 || req->ir_compcode != 0) { device_printf(sc->ipmi_dev, "Power cycling via IPMI failed code %#x %#x\n", @@ -859,7 +858,7 @@ ipmi_startup(void *arg) IPMI_ALLOC_DRIVER_REQUEST(req, IPMI_ADDR(IPMI_APP_REQUEST, 0), IPMI_GET_DEVICE_ID, 0, 15); - error = ipmi_submit_driver_request(sc, req, MAX_TIMEOUT); + error = ipmi_submit_driver_request(sc, req); if (error == EWOULDBLOCK) { device_printf(dev, "Timed out waiting for GET_DEVICE_ID\n"); return; @@ -888,7 +887,7 @@ ipmi_startup(void *arg) IPMI_INIT_DRIVER_REQUEST(req, IPMI_ADDR(IPMI_APP_REQUEST, 0), IPMI_CLEAR_FLAGS, 1, 0); - ipmi_submit_driver_request(sc, req, 0); + ipmi_submit_driver_request(sc, req); /* XXX: Magic numbers */ if (req->ir_compcode == 0xc0) { @@ -903,7 +902,7 @@ ipmi_startup(void *arg) IPMI_GET_CHANNEL_INFO, 1, 0); req->ir_request[0] = i; - error = ipmi_submit_driver_request(sc, req, 0); + error = ipmi_submit_driver_request(sc, req); if (error != 0 || req->ir_compcode != 0) break; @@ -918,7 +917,7 @@ ipmi_startup(void *arg) IPMI_INIT_DRIVER_REQUEST(req, IPMI_ADDR(IPMI_APP_REQUEST, 0), IPMI_GET_WDOG, 0, 0); - error = ipmi_submit_driver_request(sc, req, 0); + error = ipmi_submit_driver_request(sc, req); if (error == 0 && req->ir_compcode == 0x00) { device_p
Re: git: b88df1e893c4 - main - Reapply "sbin/ping: allow normal users to specify larger packets"
Hi Pedro, Unless you have a plan to address this issue please backout this code as it is clearly wrong. Thanks, Maxim On Wed, 16 Oct 2024, 19:04-, Maxim Konovalov wrote: > Hi Pedro, > > No, this is not right. Let me clarify: > > (1) I never told that there are any issues with the tests. I just > mumbled that the tests should catch such regression though I never > checked if they actually did. > > (2) The MAXPAYLOAD calculation in the code below is not fully correct. > > It should be > > 65535 - 20 (ip header) - 8 (icmp part) = 65507 without IP options > > OR > > 65535 - 20 (ip header) - 40 (ip options) - 8 (icmp part) = 65467 with > IP options, ie. whenever you run ping -R. > > The code below hardcoded the latter value which is simply wrong. > > I wouldn't rely on the fact that you get it from other BSD flavours > and would recommend to have this code reviewed before committing it. > > Maxim > -- Maxim Konovalov
git: 599c4399e9b8 - main - libkldelf: use warnx instead of printf
The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=599c4399e9b8e5db10dcdd949da96ff2b12b70cf commit 599c4399e9b8e5db10dcdd949da96ff2b12b70cf Author: Ka Ho Ng AuthorDate: 2024-10-08 04:25:36 + Commit: Ka Ho Ng CommitDate: 2024-10-18 20:21:44 + libkldelf: use warnx instead of printf Sponsored by: Juniper Networks, Inc. Reviewed by:markj Differential Revision: https://reviews.freebsd.org/D46893 --- lib/libkldelf/ef_obj.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/libkldelf/ef_obj.c b/lib/libkldelf/ef_obj.c index 32a7c17127ed..30e0d7886995 100644 --- a/lib/libkldelf/ef_obj.c +++ b/lib/libkldelf/ef_obj.c @@ -345,20 +345,20 @@ ef_obj_open(struct elf_file *efile, int verbose) if ((ef->nprogtab != 0 && ef->progtab == NULL) || (ef->nrel != 0 && ef->reltab == NULL) || (ef->nrela != 0 && ef->relatab == NULL)) { - printf("malloc failed\n"); + warnx("malloc failed"); error = ENOMEM; goto out; } if (elf_read_symbols(efile, symtabindex, &ef->ddbsymcnt, &ef->ddbsymtab) != 0) { - printf("elf_read_symbols failed\n"); + warnx("elf_read_symbols failed"); goto out; } if (elf_read_string_table(efile, &shdr[symstrindex], &ef->ddbstrcnt, &ef->ddbstrtab) != 0) { - printf("elf_read_string_table failed\n"); + warnx("elf_read_string_table failed"); goto out; } @@ -367,7 +367,7 @@ ef_obj_open(struct elf_file *efile, int verbose) shdr[hdr->e_shstrndx].sh_type == SHT_STRTAB) { if (elf_read_string_table(efile, &shdr[hdr->e_shstrndx], &ef->shstrcnt, &ef->shstrtab) != 0) { - printf("elf_read_string_table failed\n"); + warnx("elf_read_string_table failed"); goto out; } } @@ -413,7 +413,7 @@ ef_obj_open(struct elf_file *efile, int verbose) ef->reltab[rl].sec = shdr[i].sh_info; if (elf_read_rel(efile, i, &ef->reltab[rl].nrel, &ef->reltab[rl].rel) != 0) { - printf("elf_read_rel failed\n"); + warnx("elf_read_rel failed"); goto out; } rl++; @@ -422,7 +422,7 @@ ef_obj_open(struct elf_file *efile, int verbose) ef->relatab[ra].sec = shdr[i].sh_info; if (elf_read_rela(efile, i, &ef->relatab[ra].nrela, &ef->relatab[ra].rela) != 0) { - printf("elf_read_rela failed\n"); + warnx("elf_read_rela failed"); goto out; } ra++;
git: 43628a31e3a2 - main - libkldelf: add elf_lookup_symbol function
The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=43628a31e3a22e1ea9e2936bdcb07ecbd72aaa5f commit 43628a31e3a22e1ea9e2936bdcb07ecbd72aaa5f Author: Ka Ho Ng AuthorDate: 2024-10-08 04:24:37 + Commit: Ka Ho Ng CommitDate: 2024-10-18 20:21:44 + libkldelf: add elf_lookup_symbol function The elf_lookup_symbol function looks up the symbol with a given symbol name. A pointer to the GElf_Sym of the symbol is returned if the symbol exists in the opened ELF file. Sponsored by: Juniper Networks, Inc. Reviewed by:markj Differential Revision: https://reviews.freebsd.org/D46764 --- lib/libkldelf/ef.c | 1 + lib/libkldelf/ef_obj.c | 1 + lib/libkldelf/elf.c| 6 ++ lib/libkldelf/kldelf.h | 13 + 4 files changed, 21 insertions(+) diff --git a/lib/libkldelf/ef.c b/lib/libkldelf/ef.c index 052798ee31e4..dcd87fe2bf83 100644 --- a/lib/libkldelf/ef.c +++ b/lib/libkldelf/ef.c @@ -89,6 +89,7 @@ static struct elf_file_ops ef_file_ops = { .seg_read_string= ef_seg_read_string, .symaddr= ef_symaddr, .lookup_set = ef_lookup_set, + .lookup_symbol = ef_lookup_symbol, }; static void diff --git a/lib/libkldelf/ef_obj.c b/lib/libkldelf/ef_obj.c index e09bd036b71e..32a7c17127ed 100644 --- a/lib/libkldelf/ef_obj.c +++ b/lib/libkldelf/ef_obj.c @@ -109,6 +109,7 @@ static struct elf_file_ops ef_obj_file_ops = { .seg_read_string= ef_obj_seg_read_string, .symaddr= ef_obj_symaddr, .lookup_set = ef_obj_lookup_set, + .lookup_symbol = ef_obj_lookup_symbol, }; static GElf_Off diff --git a/lib/libkldelf/elf.c b/lib/libkldelf/elf.c index da319ffc6c98..8af02622de13 100644 --- a/lib/libkldelf/elf.c +++ b/lib/libkldelf/elf.c @@ -686,3 +686,9 @@ elf_reloc(struct elf_file *efile, const void *reldata, Elf_Type reltype, return (efile->ef_reloc(efile, reldata, reltype, relbase, dataoff, len, dest)); } + +int +elf_lookup_symbol(struct elf_file *efile, const char *name, GElf_Sym **sym) +{ + return (EF_LOOKUP_SYMBOL(efile, name, sym)); +} diff --git a/lib/libkldelf/kldelf.h b/lib/libkldelf/kldelf.h index e0a8cc627ff2..71de31a94291 100644 --- a/lib/libkldelf/kldelf.h +++ b/lib/libkldelf/kldelf.h @@ -48,6 +48,8 @@ (ef)->ef_ops->symaddr((ef)->ef_ef, symidx) #define EF_LOOKUP_SET(ef, name, startp, stopp, countp) \ (ef)->ef_ops->lookup_set((ef)->ef_ef, name, startp, stopp, countp) +#define EF_LOOKUP_SYMBOL(ef, name, sym) \ +(ef)->ef_ops->lookup_symbol((ef)->ef_ef, name, sym) /* XXX, should have a different name. */ typedef struct ef_file *elf_file_t; @@ -67,6 +69,7 @@ struct elf_file_ops { GElf_Addr (*symaddr)(elf_file_t ef, GElf_Size symidx); int (*lookup_set)(elf_file_t ef, const char *name, GElf_Addr *startp, GElf_Addr *stopp, long *countp); + int (*lookup_symbol)(elf_file_t ef, const char *name, GElf_Sym **sym); }; typedef int (elf_reloc_t)(struct elf_file *ef, const void *reldata, @@ -310,6 +313,16 @@ intelf_read_mod_pnp_match_info(struct elf_file *efile, GElf_Addr addr, intelf_reloc(struct elf_file *ef, const void *reldata, Elf_Type reltype, GElf_Addr relbase, GElf_Addr dataoff, size_t len, void *dest); +/* + * Find the symbol with the specified symbol name 'name' within the given + * 'efile'. 0 is returned when such a symbol is found, otherwise ENOENT is + * returned. + * + * XXX: This only return the first symbol being found when traversing symtab. + */ +intelf_lookup_symbol(struct elf_file *efile, const char *name, +GElf_Sym **sym); + __END_DECLS #endif /* _KLDELF_H_*/
git: 968bcca262a2 - main - libkldelf: add a private library for kernel/kld-related ELF parsing
The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=968bcca262a2ea8025924fe10e449bf89caf74bc commit 968bcca262a2ea8025924fe10e449bf89caf74bc Author: Ka Ho Ng AuthorDate: 2024-10-08 04:24:07 + Commit: Ka Ho Ng CommitDate: 2024-10-18 20:20:13 + libkldelf: add a private library for kernel/kld-related ELF parsing The libkldelf library was originally a part of kldxref(8). It exposed ELF parsing helpers specialized in parsing KLDs and the kernel executable. The library can be used to read metadata such as linker_set, mod_depend, mod_version and PNP match info, and raw data from the ELF. To promote the reuse of the facilities the ELF parsing code is separated from kldxref(8) into a new private library. For now, libkldelf's source files will be compiled into kldxref(8) directly if kldxref is built during bootstrapping phase. The reason is linking kldxref(8) against the libkldelf static library has an unwanted side effect which renders the linker sets inside the libkldelf implementation empty if the static library is not build by ld -r all the .o files into a single .o before producing the static library. Sponsored by: Juniper Networks, Inc. Reviewed by:markj Suggested by: jrtc27, markj Differential Revision: https://reviews.freebsd.org/D46719 --- Makefile.inc1| 11 +++-- lib/Makefile | 1 + lib/libkldelf/Makefile | 21 lib/libkldelf/Makefile.depend| 16 {usr.sbin/kldxref => lib/libkldelf}/ef.c | 2 +- {usr.sbin/kldxref => lib/libkldelf}/ef_aarch64.c | 2 +- {usr.sbin/kldxref => lib/libkldelf}/ef_amd64.c | 2 +- {usr.sbin/kldxref => lib/libkldelf}/ef_arm.c | 2 +- {usr.sbin/kldxref => lib/libkldelf}/ef_i386.c| 2 +- {usr.sbin/kldxref => lib/libkldelf}/ef_mips.c| 2 +- {usr.sbin/kldxref => lib/libkldelf}/ef_obj.c | 2 +- {usr.sbin/kldxref => lib/libkldelf}/ef_powerpc.c | 2 +- {usr.sbin/kldxref => lib/libkldelf}/ef_riscv.c | 2 +- {usr.sbin/kldxref => lib/libkldelf}/elf.c| 2 +- usr.sbin/kldxref/ef.h => lib/libkldelf/kldelf.h | 6 ++--- share/mk/src.libnames.mk | 2 ++ usr.sbin/kldxref/Makefile| 31 ++-- usr.sbin/kldxref/kldxref.c | 2 +- 18 files changed, 86 insertions(+), 24 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 55d49d5760f2..0a8895933bea 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -2527,8 +2527,12 @@ ${_bt}-lib/libdwarf: ${_bt_m4_depend} _bt_libelf_depend=${_bt}-lib/libelf .endif +_libkldelf=lib/libkldelf +${_bt}-lib/libkldelf: ${_bt_libelf_depend} +_bt_libkldelf_depend=${_bt}-lib/libkldelf + _kldxref= usr.sbin/kldxref -${_bt}-usr.sbin/kldxref: ${_bt_libelf_depend} +${_bt}-usr.sbin/kldxref: ${_bt_libelf_depend} ${_bt_libkldelf_depend} # flua is required to regenerate syscall files. It first appeared during the # 13.0-CURRENT cycle, thus needs to be built on -older releases and stable @@ -2791,6 +2795,7 @@ bootstrap-tools: ${_bt}-links .PHONY ${_cat} \ ${_kbdcontrol} \ ${_elftoolchain_libs} \ +${_libkldelf} \ ${_kldxref} \ lib/libopenbsd \ usr.bin/mandoc \ @@ -3234,7 +3239,8 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \ lib/libfigpar \ ${_lib_libgssapi} \ lib/libjail \ - lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \ + lib/libkiconv lib/libkldelf lib/libkvm \ + lib/liblzma lib/libmd lib/libnv \ lib/libzstd \ ${_lib_casper} \ lib/ncurses/tinfo \ @@ -3269,6 +3275,7 @@ _prebuild_libs+= lib/libregex .endif lib/libgeom__L: lib/libexpat__L lib/libsbuf__L +lib/libkldelf__L: lib/libelf__L lib/libkvm__L: lib/libelf__L .if ${MK_RADIUS_SUPPORT} != "no" diff --git a/lib/Makefile b/lib/Makefile index 221eac74ee26..e4a4aa95a1ef 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -66,6 +66,7 @@ SUBDIR= ${SUBDIR_BOOTSTRAP} \ libiscsiutil \ libjail \ libkiconv \ + libkldelf \ libkvm \ liblua \ liblzma \ diff --git a/lib/libkldelf/Makefile b/lib/libkldelf/Makefile new file mode 100644 index ..0d1716f17fca --- /dev/null +++ b/lib/libkldelf/Makefile @@ -0,0 +1,21 @@ +.include + +PACKAGE= runtime +LIB= kldelf +PRIVATELIB=yes + +SRCS= ef.c \ + ef_obj.c \ + elf.c \ + ef_aarch64.c \ + ef_arm.c \ + ef_amd64.c \ + ef_i386.c \ + ef_mips.c \ + ef_powerpc.c \ + ef_riscv.c +WARNS?=2 + +LIBADD=elf + +.include diff --git a/lib/libkldelf/Makefile.depend b/lib/libkldelf/Makefile.depend new file mode 100644 ind
git: b75e32a466db - main - ipmi: fix powerpc build
The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=b75e32a466dbab7a6729ff7a6472c6f9c9207491 commit b75e32a466dbab7a6729ff7a6472c6f9c9207491 Author: Gleb Smirnoff AuthorDate: 2024-10-18 20:30:02 + Commit: Gleb Smirnoff CommitDate: 2024-10-18 20:30:44 + ipmi: fix powerpc build Fixes: 366d6a424e1faad9c151c5794978e218a79fbed8 --- sys/dev/ipmi/ipmi_opal.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/dev/ipmi/ipmi_opal.c b/sys/dev/ipmi/ipmi_opal.c index ab0f14e8b3a8..ae7583a0d749 100644 --- a/sys/dev/ipmi/ipmi_opal.c +++ b/sys/dev/ipmi/ipmi_opal.c @@ -142,7 +142,8 @@ opal_ipmi_discard_msgs(struct opal_ipmi_softc *sc) } static int -opal_ipmi_polled_request(struct opal_ipmi_softc *sc, struct ipmi_request *req) +opal_ipmi_polled_request(struct opal_ipmi_softc *sc, struct ipmi_request *req, +int timo) { uint64_t msg_len; int err; @@ -191,7 +192,7 @@ opal_ipmi_polled_request(struct opal_ipmi_softc *sc, struct ipmi_request *req) goto out; } - if ((err = opal_ipmi_recv(sc, &msg_len, 0)) == 0) { + if ((err = opal_ipmi_recv(sc, &msg_len, timo)) == 0) { /* Subtract one extra for the completion code. */ req->ir_replylen = msg_len - sizeof(struct opal_ipmi_msg) - 1; req->ir_replylen = min(req->ir_replylen, req->ir_replybuflen); @@ -254,7 +255,7 @@ opal_ipmi_driver_request(struct ipmi_softc *isc, struct ipmi_request *req) for (i = 0; i < 3; i++) { IPMI_LOCK(&sc->ipmi); - err = opal_ipmi_polled_request(sc, req); + err = opal_ipmi_polled_request(sc, req, 0); IPMI_UNLOCK(&sc->ipmi); if (err == 0) break;
git: 0bdf2535d4f8 - main - tools/build/cross-build: Don't include sys/uio.h from linux limits.h
The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=0bdf2535d4f8a571cb6d230f2f19eb20a452a4f8 commit 0bdf2535d4f8a571cb6d230f2f19eb20a452a4f8 Author: Jessica Clarke AuthorDate: 2024-10-18 20:39:37 + Commit: Jessica Clarke CommitDate: 2024-10-18 20:39:37 + tools/build/cross-build: Don't include sys/uio.h from linux limits.h This creates a circular dependency for OpenZFS's libspl in sys/uio.h, and it shouldn't be needed since the system limits.h already defines IOV_MAX, so delete it, and unconditionally assert that to be the case. Otherwise the re-include of libspl's sys/uio.h tries to use PAGESIZE before it has been defined by OpenZFS's own sys/param.h. Fixes: 7a7741af18d6 ("zfs: merge openzfs/zfs@b10992582") MFC after: 1 week --- tools/build/cross-build/include/linux/limits.h | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tools/build/cross-build/include/linux/limits.h b/tools/build/cross-build/include/linux/limits.h index 5eca34b1120c..4631cabb1104 100644 --- a/tools/build/cross-build/include/linux/limits.h +++ b/tools/build/cross-build/include/linux/limits.h @@ -45,13 +45,11 @@ #if !defined(_GNU_SOURCE) #warning "Attempting to use limits.h with -std=c89/without _GNU_SOURCE, many macros will be missing" #endif +#endif /* C89 */ -#else /* Not C89 */ -/* Not C89 -> check that all macros that we expect are defined */ #ifndef IOV_MAX #error IOV_MAX should be defined #endif -#endif /* C89 */ #ifndef MAXBSIZE #define MAXBSIZE 65536 /* must be power of 2 */ @@ -83,7 +81,6 @@ #endif #include -#include /* For IOV_MAX */ /* Sanity checks for glibc */ #ifndef _GNU_SOURCE
git: 4ad443a106d3 - main - they have been not true since 2012.
The branch main has been updated by jmg: URL: https://cgit.FreeBSD.org/src/commit/?id=4ad443a106d3201453dc4ce0412431df2c0d1a47 commit 4ad443a106d3201453dc4ce0412431df2c0d1a47 Author: John-Mark Gurney AuthorDate: 2024-10-19 04:52:51 + Commit: John-Mark Gurney CommitDate: 2024-10-19 04:52:51 + they have been not true since 2012. --- share/man/man3/stdarg.3 | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/share/man/man3/stdarg.3 b/share/man/man3/stdarg.3 index b7346c91d7a3..71409508e6a8 100644 --- a/share/man/man3/stdarg.3 +++ b/share/man/man3/stdarg.3 @@ -29,7 +29,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd February 25, 2020 +.Dd October 18, 2024 .Dt STDARG 3 .Os .Sh NAME @@ -202,9 +202,6 @@ void foo(char *fmt, ...) These macros are .Em not compatible with the historic macros they replace. -A backward compatible version can be found in the include -file -.In varargs.h . .Sh STANDARDS The .Fn va_start ,
git: b973a14d354f - main - sound: Simplify pcm_chnalloc() and fix infinite loop bug
The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=b973a14d354f332a3428cbab8e9d4b72cb3e2d6e commit b973a14d354f332a3428cbab8e9d4b72cb3e2d6e Author: Christos Margiolis AuthorDate: 2024-10-18 08:38:50 + Commit: Christos Margiolis CommitDate: 2024-10-18 08:38:50 + sound: Simplify pcm_chnalloc() and fix infinite loop bug Simplify logic to execute the following algorithm: 1. Search for a free (i.e not busy) channel and return successfully. 2. If no channel was found, either return an ENOTSUP if no VCHAN can be created (disabled or we reached the limit), or create one more VCHAN and scan for it again. 3. If the second scan failed again, return EBUSY. This patch also solves a bug where we'd end up in an infinite loop, calling vchan_setnew() with the same `newcnt` value indefinitely, after the following scenario: 1. Plug device. 2. Spawn X channels. 3. Kill all channels except _last_ opened. 4. Clean up all unused VCHANs. 5. Spawn X+1 channels. 6. Infinite loop in pcm_chnalloc(). I am not exactly sure which part of pcm_chnalloc() caused this bug, but the patch fixes it at least... Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by:dev_submerge.ch Differential Revision: https://reviews.freebsd.org/D46548 --- sys/dev/sound/pcm/sound.c | 39 +++ 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c index b18b83468150..1aaf614078a4 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -109,13 +109,12 @@ snd_setup_intr(device_t dev, struct resource *res, int flags, driver_intr_t hand return bus_setup_intr(dev, res, flags, NULL, hand, param, cookiep); } -/* return error status and a locked channel */ int pcm_chnalloc(struct snddev_info *d, struct pcm_channel **ch, int direction, pid_t pid, char *comm) { struct pcm_channel *c; - int err, vchancount, vchan_num; + int err, vchancount; bool retry; KASSERT(d != NULL && ch != NULL && @@ -125,46 +124,38 @@ pcm_chnalloc(struct snddev_info *d, struct pcm_channel **ch, int direction, PCM_BUSYASSERT(d); *ch = NULL; - vchan_num = 0; vchancount = (direction == PCMDIR_PLAY) ? d->pvchancount : d->rvchancount; - retry = false; + retry_chnalloc: - err = ENOTSUP; - /* scan for a free channel */ + /* Scan for a free channel. */ CHN_FOREACH(c, d, channels.pcm) { CHN_LOCK(c); - if (c->direction == direction && (c->flags & CHN_F_VIRTUAL)) { - if (vchancount < snd_maxautovchans && - vchan_num < c->unit) { - CHN_UNLOCK(c); - goto vchan_alloc; - } - vchan_num++; + if (c->direction != direction) { + CHN_UNLOCK(c); + continue; } - if (c->direction == direction && !(c->flags & CHN_F_BUSY)) { + if (!(c->flags & CHN_F_BUSY)) { c->flags |= CHN_F_BUSY; c->pid = pid; strlcpy(c->comm, (comm != NULL) ? comm : CHN_COMM_UNKNOWN, sizeof(c->comm)); *ch = c; + return (0); - } else if (c->direction == direction && (c->flags & CHN_F_BUSY)) - err = EBUSY; + } CHN_UNLOCK(c); } - - /* -* We came from retry_chnalloc and still didn't find a free channel. -*/ + /* Maybe next time... */ if (retry) - return (err); + return (EBUSY); -vchan_alloc: - /* no channel available */ + /* No channel available. We also cannot create more VCHANs. */ if (!(vchancount > 0 && vchancount < snd_maxautovchans)) - return (err); + return (ENOTSUP); + + /* Increase the VCHAN count and try to get the new channel. */ err = vchan_setnew(d, direction, vchancount + 1); if (err == 0) { retry = true;
git: 142aca25b07c - main - sound: Sort channels by unit number as well
The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=142aca25b07c9a7067d8040ea98812c54b253bbf commit 142aca25b07c9a7067d8040ea98812c54b253bbf Author: Christos Margiolis AuthorDate: 2024-10-18 08:39:00 + Commit: Christos Margiolis CommitDate: 2024-10-18 08:39:00 + sound: Sort channels by unit number as well Refactor CHN_INSERT_SORT() to also take into account the unit number of each channel, while still prioritizing the type, to make the channel list easier to work with. Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by:dev_submerge.ch Differential Revision: https://reviews.freebsd.org/D46549 --- sys/dev/sound/pcm/channel.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/dev/sound/pcm/channel.h b/sys/dev/sound/pcm/channel.h index 445882a62f0a..d146f51120d8 100644 --- a/sys/dev/sound/pcm/channel.h +++ b/sys/dev/sound/pcm/channel.h @@ -225,7 +225,8 @@ struct pcm_channel { #define CHN_INSERT_SORT(w, x, y, z)do {\ struct pcm_channel *t, *a = NULL; \ CHN_FOREACH(t, x, z) { \ - if ((y)->type w t->type)\ + if (((y)->type w t->type) ||\ + (((y)->type == t->type) && ((y)->unit w t->unit))) \ a = t; \ else\ break; \ @@ -236,7 +237,7 @@ struct pcm_channel { CHN_INSERT_HEAD(x, y, z); \ } while (0) -#define CHN_INSERT_SORT_ASCEND(x, y, z)CHN_INSERT_SORT(>=, x, y, z) +#define CHN_INSERT_SORT_ASCEND(x, y, z)CHN_INSERT_SORT(>, x, y, z) #define CHN_INSERT_SORT_DESCEND(x, y, z) CHN_INSERT_SORT(<, x, y, z) #define CHN_BUF_PARENT(x, y) \
git: 998de46c5145 - main - sound: Remove KASSERT from vchan_setnew()
The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=998de46c51452b046ecd9ba8ed592dd7c4f79f51 commit 998de46c51452b046ecd9ba8ed592dd7c4f79f51 Author: Christos Margiolis AuthorDate: 2024-10-18 08:38:31 + Commit: Christos Margiolis CommitDate: 2024-10-18 08:38:31 + sound: Remove KASSERT from vchan_setnew() This check is not really useful, and can in fact break things, if sysctl_dev_pcm_vchans() calls vchan_setnew() with a value that will not satisfy the KASSERT condition. Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by:dev_submerge.ch, emaste Differential Revision: https://reviews.freebsd.org/D46545 --- sys/dev/sound/pcm/vchan.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/sys/dev/sound/pcm/vchan.c b/sys/dev/sound/pcm/vchan.c index fa4fa2023b71..c1ad9b9ec2ba 100644 --- a/sys/dev/sound/pcm/vchan.c +++ b/sys/dev/sound/pcm/vchan.c @@ -945,9 +945,6 @@ vchan_setnew(struct snddev_info *d, int direction, int newcnt) return (EINVAL); if (newcnt > vcnt) { - KASSERT((newcnt - 1) == vcnt, - ("bogus vchan_create() request newcnt=%d vcnt=%d", - newcnt, vcnt)); /* add new vchans - find a parent channel first */ ch = NULL; CHN_FOREACH(c, d, channels.pcm) {
git: de8ee333388b - main - sound: Get rid of pnum and max variables in chn_init()
The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=de8ee88bf5e551e697b08823b3a6c262f609 commit de8ee88bf5e551e697b08823b3a6c262f609 Author: Christos Margiolis AuthorDate: 2024-10-18 08:38:41 + Commit: Christos Margiolis CommitDate: 2024-10-18 08:38:41 + sound: Get rid of pnum and max variables in chn_init() The VCHAN count is checked in vchan_setnew(), and there is no reason to cap the hardware channels in the first place. This is part of a series of follow-up patches. Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by:dev_submerge.ch Differential Revision: https://reviews.freebsd.org/D46521 --- sys/dev/sound/pcm/channel.c | 22 +- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index e0fd24805a21..bf9c74e2ed1d 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -1165,7 +1165,7 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, struct feeder_class *fc; struct snd_dbuf *b, *bs; char *dirs, buf[CHN_NAMELEN]; - int i, direction, *pnum, max, type, unit; + int i, direction, type, unit; PCM_BUSYASSERT(d); PCM_LOCKASSERT(d); @@ -1174,30 +1174,22 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, case PCMDIR_PLAY: dirs = "play"; direction = PCMDIR_PLAY; - pnum = &d->playcount; type = SND_DEV_DSPHW_PLAY; - max = SND_MAXHWCHAN; break; case PCMDIR_PLAY_VIRTUAL: dirs = "virtual_play"; direction = PCMDIR_PLAY; - pnum = &d->pvchancount; type = SND_DEV_DSPHW_VPLAY; - max = SND_MAXVCHANS; break; case PCMDIR_REC: dirs = "record"; direction = PCMDIR_REC; - pnum = &d->reccount; type = SND_DEV_DSPHW_REC; - max = SND_MAXHWCHAN; break; case PCMDIR_REC_VIRTUAL: dirs = "virtual_record"; direction = PCMDIR_REC; - pnum = &d->rvchancount; type = SND_DEV_DSPHW_VREC; - max = SND_MAXVCHANS; break; default: device_printf(d->dev, @@ -1206,23 +1198,11 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, return (NULL); } - if (*pnum >= max) { - device_printf(d->dev, "%s(): cannot allocate more channels " - "(max=%d)\n", __func__, max); - return (NULL); - } - unit = 0; CHN_FOREACH(c, d, channels.pcm) { if (c->type != type) continue; unit++; - if (unit >= max) { - device_printf(d->dev, "%s(): cannot allocate more " - "channels for type=%d (max=%d)\n", - __func__, type, max); - return (NULL); - } } PCM_UNLOCK(d);
git: ad4c8671bdda - main - sound: Use unr(9) to produce unique channel unit numbers
The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=ad4c8671bddaa30bf0413089c74dde6a618d9021 commit ad4c8671bddaa30bf0413089c74dde6a618d9021 Author: Christos Margiolis AuthorDate: 2024-10-18 08:39:08 + Commit: Christos Margiolis CommitDate: 2024-10-18 08:39:08 + sound: Use unr(9) to produce unique channel unit numbers Currently it is possible to assign a unit number that already exists. Suppose the following channel list: [vp2] If we create 3 channels, we'll end up with the following list: [vp0, vp1, vp2, vp2] This happens because chn_init() does not check if the unit number we are assigning already exists. While fixing this is trivial when the channel list is sorted in ascending order, it is way more involved when sorted in descending order. Even though sorting the list in descending order would require deliberately modifying pcm_chn_add(), and is most likely not going to happen, make the mechanism more robust by using a unr(9) allocator for each channel type. Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by:dev_submerge.ch Differential Revision: https://reviews.freebsd.org/D46680 --- sys/dev/sound/pcm/channel.c | 31 ++- sys/dev/sound/pcm/sound.c | 12 sys/dev/sound/pcm/sound.h | 4 3 files changed, 38 insertions(+), 9 deletions(-) diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index bf9c74e2ed1d..d1c9bc616dcf 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -1157,6 +1157,24 @@ chn_reset(struct pcm_channel *c, uint32_t fmt, uint32_t spd) return r; } +static struct unrhdr * +chn_getunr(struct snddev_info *d, int type) +{ + switch (type) { + case SND_DEV_DSPHW_PLAY: + return (d->p_unr); + case SND_DEV_DSPHW_VPLAY: + return (d->vp_unr); + case SND_DEV_DSPHW_REC: + return (d->r_unr); + case SND_DEV_DSPHW_VREC: + return (d->vr_unr); + default: + __assert_unreachable(); + } + +} + struct pcm_channel * chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, int dir, void *devinfo) @@ -1165,7 +1183,7 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, struct feeder_class *fc; struct snd_dbuf *b, *bs; char *dirs, buf[CHN_NAMELEN]; - int i, direction, type, unit; + int i, direction, type; PCM_BUSYASSERT(d); PCM_LOCKASSERT(d); @@ -1198,13 +1216,6 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, return (NULL); } - unit = 0; - CHN_FOREACH(c, d, channels.pcm) { - if (c->type != type) - continue; - unit++; - } - PCM_UNLOCK(d); b = NULL; bs = NULL; @@ -1216,7 +1227,7 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, CHN_INIT(c, children.busy); c->direction = direction; c->type = type; - c->unit = unit; + c->unit = alloc_unr(chn_getunr(d, c->type)); c->format = SND_FORMAT(AFMT_U8, 1, 0); c->speed = DSP_DEFAULT_SPEED; c->pid = -1; @@ -1304,6 +1315,7 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, return (c); fail: + free_unr(chn_getunr(d, c->type), c->unit); feeder_remove(c); if (c->devinfo && CHANNEL_FREE(c->methods, c->devinfo)) sndbuf_free(b); @@ -1335,6 +1347,7 @@ chn_kill(struct pcm_channel *c) chn_trigger(c, PCMTRIG_ABORT); CHN_UNLOCK(c); } + free_unr(chn_getunr(c->parentsnddev, c->type), c->unit); feeder_remove(c); if (CHANNEL_FREE(c->methods, c->devinfo)) sndbuf_free(b); diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c index 1aaf614078a4..f9c87facfeec 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -568,6 +568,10 @@ pcm_register(device_t dev, void *devinfo, int numplay, int numrec) d->pvchanformat = 0; d->rvchanrate = 0; d->rvchanformat = 0; + d->p_unr = new_unrhdr(0, INT_MAX, NULL); + d->vp_unr = new_unrhdr(0, INT_MAX, NULL); + d->r_unr = new_unrhdr(0, INT_MAX, NULL); + d->vr_unr = new_unrhdr(0, INT_MAX, NULL); CHN_INIT(d, channels.pcm); CHN_INIT(d, channels.pcm.busy); @@ -653,6 +657,14 @@ pcm_unregister(device_t dev) cv_destroy(&d->cv); PCM_UNLOCK(d); snd_mtxfree(d->lock); + if (d->p_unr != NULL) + delete_unrhdr(d->p_unr); + if (d->vp_unr != NULL) + delete_unrhdr(d->vp_unr); + if (d->r_unr != NULL) + de
git: 0a0301deb5b6 - main - sound: Move global variable initialization to sound_modevent()
The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=0a0301deb5b6a9c66829dd20cff9d40c5ba9ad92 commit 0a0301deb5b6a9c66829dd20cff9d40c5ba9ad92 Author: Christos Margiolis AuthorDate: 2024-10-18 08:39:46 + Commit: Christos Margiolis CommitDate: 2024-10-18 08:39:46 + sound: Move global variable initialization to sound_modevent() There is no reason to initialize global variables in feeder_register(), as these variables are unrelated to what the function does. Instead, initialize them during sound(4) load. Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by:zlei Differential Revision: https://reviews.freebsd.org/D46749 --- sys/dev/sound/pcm/feeder.c | 43 --- sys/dev/sound/pcm/sound.c | 46 ++ 2 files changed, 46 insertions(+), 43 deletions(-) diff --git a/sys/dev/sound/pcm/feeder.c b/sys/dev/sound/pcm/feeder.c index 716eb07feaae..87437c6d00b5 100644 --- a/sys/dev/sound/pcm/feeder.c +++ b/sys/dev/sound/pcm/feeder.c @@ -77,49 +77,6 @@ feeder_register(void *p) SLIST_INSERT_HEAD(&feedertab, fte, link); feedercnt++; - /* initialize global variables */ - - if (snd_verbose < 0 || snd_verbose > 4) - snd_verbose = 1; - - if (snd_unit < 0) - snd_unit = -1; - - if (snd_maxautovchans < 0 || - snd_maxautovchans > SND_MAXVCHANS) - snd_maxautovchans = 0; - - if (chn_latency < CHN_LATENCY_MIN || - chn_latency > CHN_LATENCY_MAX) - chn_latency = CHN_LATENCY_DEFAULT; - - if (chn_latency_profile < CHN_LATENCY_PROFILE_MIN || - chn_latency_profile > CHN_LATENCY_PROFILE_MAX) - chn_latency_profile = CHN_LATENCY_PROFILE_DEFAULT; - - if (feeder_rate_min < FEEDRATE_MIN || - feeder_rate_max < FEEDRATE_MIN || - feeder_rate_min > FEEDRATE_MAX || - feeder_rate_max > FEEDRATE_MAX || - !(feeder_rate_min < feeder_rate_max)) { - feeder_rate_min = FEEDRATE_RATEMIN; - feeder_rate_max = FEEDRATE_RATEMAX; - } - - if (feeder_rate_round < FEEDRATE_ROUNDHZ_MIN || - feeder_rate_round > FEEDRATE_ROUNDHZ_MAX) - feeder_rate_round = FEEDRATE_ROUNDHZ; - - if (bootverbose) - printf("%s: snd_unit=%d snd_maxautovchans=%d " - "latency=%d " - "feeder_rate_min=%d feeder_rate_max=%d " - "feeder_rate_round=%d\n", - __func__, snd_unit, snd_maxautovchans, - chn_latency, - feeder_rate_min, feeder_rate_max, - feeder_rate_round); - /* we've got our root feeder so don't veto pcm loading anymore */ pcm_veto_load = 0; diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c index 330c99de14d1..da28a267c81a 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -829,6 +829,51 @@ sound_oss_card_info(oss_card_info *si) // +static void +sound_global_init(void) +{ + if (snd_verbose < 0 || snd_verbose > 4) + snd_verbose = 1; + + if (snd_unit < 0) + snd_unit = -1; + + if (snd_maxautovchans < 0 || + snd_maxautovchans > SND_MAXVCHANS) + snd_maxautovchans = 0; + + if (chn_latency < CHN_LATENCY_MIN || + chn_latency > CHN_LATENCY_MAX) + chn_latency = CHN_LATENCY_DEFAULT; + + if (chn_latency_profile < CHN_LATENCY_PROFILE_MIN || + chn_latency_profile > CHN_LATENCY_PROFILE_MAX) + chn_latency_profile = CHN_LATENCY_PROFILE_DEFAULT; + + if (feeder_rate_min < FEEDRATE_MIN || + feeder_rate_max < FEEDRATE_MIN || + feeder_rate_min > FEEDRATE_MAX || + feeder_rate_max > FEEDRATE_MAX || + !(feeder_rate_min < feeder_rate_max)) { + feeder_rate_min = FEEDRATE_RATEMIN; + feeder_rate_max = FEEDRATE_RATEMAX; + } + + if (feeder_rate_round < FEEDRATE_ROUNDHZ_MIN || + feeder_rate_round > FEEDRATE_ROUNDHZ_MAX) + feeder_rate_round = FEEDRATE_ROUNDHZ; + + if (bootverbose) + printf("%s: snd_unit=%d snd_maxautovchans=%d " + "latency=%d " + "feeder_rate_min=%d feeder_rate_max=%d " +
git: 41ff41776145 - main - sound: Fix indendation in sound_modevent() switch statement
The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=41ff4177614562923a30e2541e2a15883a4ce32c commit 41ff4177614562923a30e2541e2a15883a4ce32c Author: Christos Margiolis AuthorDate: 2024-10-18 08:39:15 + Commit: Christos Margiolis CommitDate: 2024-10-18 08:39:15 + sound: Fix indendation in sound_modevent() switch statement Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by:emaste Differential Revision: https://reviews.freebsd.org/D46856 --- sys/dev/sound/pcm/sound.c | 28 ++-- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c index f9c87facfeec..330c99de14d1 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -836,20 +836,20 @@ sound_modevent(module_t mod, int type, void *data) ret = 0; switch (type) { - case MOD_LOAD: - pcm_devclass = devclass_create("pcm"); - pcmsg_unrhdr = new_unrhdr(1, INT_MAX, NULL); - break; - case MOD_UNLOAD: - if (pcmsg_unrhdr != NULL) { - delete_unrhdr(pcmsg_unrhdr); - pcmsg_unrhdr = NULL; - } - break; - case MOD_SHUTDOWN: - break; - default: - ret = ENOTSUP; + case MOD_LOAD: + pcm_devclass = devclass_create("pcm"); + pcmsg_unrhdr = new_unrhdr(1, INT_MAX, NULL); + break; + case MOD_UNLOAD: + if (pcmsg_unrhdr != NULL) { + delete_unrhdr(pcmsg_unrhdr); + pcmsg_unrhdr = NULL; + } + break; + case MOD_SHUTDOWN: + break; + default: + ret = ENOTSUP; } return ret;
git: e42c82678219 - main - snd_dummy: Drain callout during detach
The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=e42c8267821952407d4f4064026058aeaaa741ac commit e42c8267821952407d4f4064026058aeaaa741ac Author: Christos Margiolis AuthorDate: 2024-10-18 08:40:08 + Commit: Christos Margiolis CommitDate: 2024-10-18 08:40:08 + snd_dummy: Drain callout during detach If we do not enter dummy_chan_trigger() before detaching, we'll get a use-after-free since the callout(9) callback might be called after having been detached. Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by:dev_submerge.ch, markj, emaste Differential Revision: https://reviews.freebsd.org/D46715 --- sys/dev/sound/dummy.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/sound/dummy.c b/sys/dev/sound/dummy.c index f8193a73fcc8..c1cd4dff15f9 100644 --- a/sys/dev/sound/dummy.c +++ b/sys/dev/sound/dummy.c @@ -327,6 +327,7 @@ dummy_detach(device_t dev) struct dummy_softc *sc = device_get_softc(dev); int err; + callout_drain(&sc->callout); err = pcm_unregister(dev); snd_mtxfree(sc->lock);
git: 3cc01caa26e4 - main - sound: Do not cast return value of malloc(9)
The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=3cc01caa26e4bf0798d219b2d40429a2cc1a642a commit 3cc01caa26e4bf0798d219b2d40429a2cc1a642a Author: Christos Margiolis AuthorDate: 2024-10-18 08:40:57 + Commit: Christos Margiolis CommitDate: 2024-10-18 08:40:57 + sound: Do not cast return value of malloc(9) No functional change intended. Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by:dev_submerge.ch, zlei, markj, emaste Differential Revision: https://reviews.freebsd.org/D46844 --- sys/dev/sound/fdt/audio_soc.c | 2 +- sys/dev/sound/pci/hda/hdaa.c | 20 +++- sys/dev/sound/pci/maestro3.c | 2 +- sys/dev/sound/pci/spicds.c| 2 +- sys/dev/sound/pcm/dsp.c | 6 +++--- sys/dev/sound/pcm/sndstat.c | 2 +- 6 files changed, 14 insertions(+), 20 deletions(-) diff --git a/sys/dev/sound/fdt/audio_soc.c b/sys/dev/sound/fdt/audio_soc.c index 3e937720bb5b..92813a3079d8 100644 --- a/sys/dev/sound/fdt/audio_soc.c +++ b/sys/dev/sound/fdt/audio_soc.c @@ -367,7 +367,7 @@ audio_soc_init(void *arg) auxdev = OF_device_from_xref(aux_devs[i]); if (auxdev == NULL) device_printf(sc->dev, "warning: no driver attached to aux node\n"); - aux_node = (struct audio_soc_aux_node *)malloc(sizeof(*aux_node), M_DEVBUF, M_NOWAIT); + aux_node = malloc(sizeof(*aux_node), M_DEVBUF, M_NOWAIT); if (aux_node == NULL) { device_printf(sc->dev, "failed to allocate aux node struct\n"); return; diff --git a/sys/dev/sound/pci/hda/hdaa.c b/sys/dev/sound/pci/hda/hdaa.c index 3489513e038c..bf38e6a97483 100644 --- a/sys/dev/sound/pci/hda/hdaa.c +++ b/sys/dev/sound/pci/hda/hdaa.c @@ -3033,8 +3033,7 @@ hdaa_audio_ctl_parse(struct hdaa_devinfo *devinfo) if (max < 1) return; - ctls = (struct hdaa_audio_ctl *)malloc( - sizeof(*ctls) * max, M_HDAA, M_ZERO | M_NOWAIT); + ctls = malloc(sizeof(*ctls) * max, M_HDAA, M_ZERO | M_NOWAIT); if (ctls == NULL) { /* Blekh! */ @@ -3186,8 +3185,7 @@ hdaa_audio_as_parse(struct hdaa_devinfo *devinfo) if (max < 1) return; - as = (struct hdaa_audio_as *)malloc( - sizeof(*as) * max, M_HDAA, M_ZERO | M_NOWAIT); + as = malloc(sizeof(*as) * max, M_HDAA, M_ZERO | M_NOWAIT); if (as == NULL) { /* Blekh! */ @@ -4077,8 +4075,7 @@ hdaa_audio_bind_as(struct hdaa_devinfo *devinfo) cnt += as[j].num_chans; } if (devinfo->num_chans == 0) { - devinfo->chans = (struct hdaa_chan *)malloc( - sizeof(struct hdaa_chan) * cnt, + devinfo->chans = malloc(sizeof(struct hdaa_chan) * cnt, M_HDAA, M_ZERO | M_NOWAIT); if (devinfo->chans == NULL) { device_printf(devinfo->dev, @@ -5490,10 +5487,8 @@ hdaa_prepare_pcms(struct hdaa_devinfo *devinfo) } devinfo->num_devs = max(ardev, apdev) + max(drdev, dpdev); - devinfo->devs = - (struct hdaa_pcm_devinfo *)malloc( - devinfo->num_devs * sizeof(struct hdaa_pcm_devinfo), - M_HDAA, M_ZERO | M_NOWAIT); + devinfo->devs = malloc(devinfo->num_devs * + sizeof(struct hdaa_pcm_devinfo), M_HDAA, M_ZERO | M_NOWAIT); if (devinfo->devs == NULL) { device_printf(devinfo->dev, "Unable to allocate memory for devices\n"); @@ -6625,9 +6620,8 @@ hdaa_attach(device_t dev) ); if (devinfo->nodecnt > 0) - devinfo->widget = (struct hdaa_widget *)malloc( - sizeof(*(devinfo->widget)) * devinfo->nodecnt, M_HDAA, - M_WAITOK | M_ZERO); + devinfo->widget = malloc(sizeof(*(devinfo->widget)) * + devinfo->nodecnt, M_HDAA, M_WAITOK | M_ZERO); else devinfo->widget = NULL; diff --git a/sys/dev/sound/pci/maestro3.c b/sys/dev/sound/pci/maestro3.c index 4d6dca310eea..f922aa5cec3f 100644 --- a/sys/dev/sound/pci/maestro3.c +++ b/sys/dev/sound/pci/maestro3.c @@ -1453,7 +1453,7 @@ m3_pci_attach(device_t dev) /* Create the buffer for saving the card state during suspend */ len = sizeof(u_int16_t) * (REV_B_CODE_MEMORY_LENGTH + REV_B_DATA_MEMORY_LENGTH); - sc->savemem = (u_int16_t*)malloc(len, M_DEVBUF, M_WAITOK | M_ZERO); + sc->savemem = malloc(len, M_DEVBUF, M_WAITOK | M_ZERO); return 0; diff --git a/sys/dev/sound/pci/spicds.c b/sys/dev/sound/pci/spicds.c index 3b67101b8df0..da0e8d9da6d5 100644 --- a/sys/dev/sound/pci/spicds.c +++ b/sys/dev/sound/pci/spicds.c @@ -144,7 +144,7 @@ spicds_create(device_t dev, void *devinfo, int num, spicds_ctrl ctrl) #if(0) device_p
git: 97570db05ced - main - sound: Move root feeder initialization to separate function
The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=97570db05ced435f4fb1c6a67bdb16966ce5e4d9 commit 97570db05ced435f4fb1c6a67bdb16966ce5e4d9 Author: Christos Margiolis AuthorDate: 2024-10-18 08:39:58 + Commit: Christos Margiolis CommitDate: 2024-10-18 08:39:58 + sound: Move root feeder initialization to separate function feeder_register() is currently a SYSINIT in order to create the root feeder, which happens only when feedercnt is 0. Separating the root feeder registration makes the code more readable. No functional change intended. While here, fix some style errors. Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by:dev_submerge.ch, zlei, markj Differential Revision: https://reviews.freebsd.org/D46821 --- sys/dev/sound/pcm/feeder.c | 69 +- 1 file changed, 38 insertions(+), 31 deletions(-) diff --git a/sys/dev/sound/pcm/feeder.c b/sys/dev/sound/pcm/feeder.c index 87437c6d00b5..c6f93ac54036 100644 --- a/sys/dev/sound/pcm/feeder.c +++ b/sys/dev/sound/pcm/feeder.c @@ -48,51 +48,55 @@ struct feedertab_entry { int idx; }; static SLIST_HEAD(, feedertab_entry) feedertab; +static int feedercnt = 0; /*/ -void -feeder_register(void *p) +static void +feeder_register_root(void *p) { - static int feedercnt = 0; - struct feeder_class *fc = p; struct feedertab_entry *fte; - int i; - - if (feedercnt == 0) { - KASSERT(fc->desc == NULL, ("first feeder not root: %s", fc->name)); - - SLIST_INIT(&feedertab); - fte = malloc(sizeof(*fte), M_FEEDER, M_NOWAIT | M_ZERO); - if (fte == NULL) { - printf("can't allocate memory for root feeder: %s\n", - fc->name); - return; - } - fte->feederclass = fc; - fte->desc = NULL; - fte->idx = feedercnt; - SLIST_INSERT_HEAD(&feedertab, fte, link); - feedercnt++; - - /* we've got our root feeder so don't veto pcm loading anymore */ - pcm_veto_load = 0; + MPASS(feedercnt == 0); + KASSERT(fc->desc == NULL, ("first feeder not root: %s", fc->name)); + SLIST_INIT(&feedertab); + fte = malloc(sizeof(*fte), M_FEEDER, M_NOWAIT | M_ZERO); + if (fte == NULL) { + printf("can't allocate memory for root feeder: %s\n", fc->name); return; } + fte->feederclass = fc; + fte->desc = NULL; + fte->idx = feedercnt; + SLIST_INSERT_HEAD(&feedertab, fte, link); + feedercnt++; + + /* we've got our root feeder so don't veto pcm loading anymore */ + pcm_veto_load = 0; +} + +void +feeder_register(void *p) +{ + struct feeder_class *fc = p; + struct feedertab_entry *fte; + int i; KASSERT(fc->desc != NULL, ("feeder '%s' has no descriptor", fc->name)); - /* beyond this point failure is non-fatal but may result in some translations being unavailable */ + /* +* beyond this point failure is non-fatal but may result in some +* translations being unavailable +*/ i = 0; while ((feedercnt < MAXFEEDERS) && (fc->desc[i].type > 0)) { - /* printf("adding feeder %s, %x -> %x\n", fc->name, fc->desc[i].in, fc->desc[i].out); */ fte = malloc(sizeof(*fte), M_FEEDER, M_NOWAIT | M_ZERO); if (fte == NULL) { - printf("can't allocate memory for feeder '%s', %x -> %x\n", fc->name, fc->desc[i].in, fc->desc[i].out); - + printf("can't allocate memory for feeder '%s', " + "%x -> %x\n", + fc->name, fc->desc[i].in, fc->desc[i].out); return; } fte->feederclass = fc; @@ -103,8 +107,10 @@ feeder_register(void *p) i++; } feedercnt++; - if (feedercnt >= MAXFEEDERS) - printf("MAXFEEDERS (%d >= %d) exceeded\n", feedercnt, MAXFEEDERS); + if (feedercnt >= MAXFEEDERS) { + printf("MAXFEEDERS (%d >= %d) exceeded\n", + feedercnt, MAXFEEDERS); + } } static void @@ -469,5 +475,6 @@ static struct feeder_class feeder_root_class = { .desc = NULL, .data = NULL, }; -SYSINIT(feeder_root, SI_SUB_DRIVERS, SI_ORDER_FIRST, feeder_register, &feeder_root_class); +SYSINIT(feeder_root, SI_SUB_DRIVERS, SI_ORDER_FIRST, feeder_register_root, +&feeder_root_class); SYSUNINIT(feeder_root, SI_SUB_DRIVERS, SI_ORDER_FIRST, feeder_unregisterall, NULL);
git: 3cab66d12d43 - main - sound: Simplify vchan_create() error paths
The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=3cab66d12d439357b948093756ca1af87967c8cc commit 3cab66d12d439357b948093756ca1af87967c8cc Author: Christos Margiolis AuthorDate: 2024-10-18 08:40:23 + Commit: Christos Margiolis CommitDate: 2024-10-18 08:40:23 + sound: Simplify vchan_create() error paths Instead of checking the value of "ret" multiple times, just set a goto label and jump there immediately in case of an error. While here, remove a redundant assignment to "d". Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by:dev_submerge.ch, markj, emaste Differential Revision: https://reviews.freebsd.org/D46833 --- sys/dev/sound/pcm/vchan.c | 76 +++ 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/sys/dev/sound/pcm/vchan.c b/sys/dev/sound/pcm/vchan.c index c1ad9b9ec2ba..9046c144b41b 100644 --- a/sys/dev/sound/pcm/vchan.c +++ b/sys/dev/sound/pcm/vchan.c @@ -674,8 +674,11 @@ vchan_create(struct pcm_channel *parent) struct pcm_channel *ch; struct pcmchan_caps *parent_caps; uint32_t vchanfmt, vchanspd; - int ret, direction, r, save; + int ret, direction, r; + bool save; + ret = 0; + save = false; d = parent->parentsnddev; PCM_BUSYASSERT(d); @@ -688,8 +691,6 @@ vchan_create(struct pcm_channel *parent) parent->direction == PCMDIR_REC)) return (EINVAL); - d = parent->parentsnddev; - CHN_UNLOCK(parent); PCM_LOCK(d); @@ -728,14 +729,13 @@ vchan_create(struct pcm_channel *parent) parent->flags |= CHN_F_HAS_VCHAN; - ret = 0; parent_caps = chn_getcaps(parent); - if (parent_caps == NULL) + if (parent_caps == NULL) { ret = EINVAL; + goto fail; + } - save = 0; - - if (ret == 0 && vchanfmt == 0) { + if (vchanfmt == 0) { const char *vfmt; CHN_UNLOCK(parent); @@ -752,10 +752,10 @@ vchan_create(struct pcm_channel *parent) } if (vchanfmt == 0) vchanfmt = VCHAN_DEFAULT_FORMAT; - save = 1; + save = true; } - if (ret == 0 && vchanspd == 0) { + if (vchanspd == 0) { /* * This is very sad. Few soundcards advertised as being * able to do (insanely) higher/lower speed, but in @@ -773,26 +773,25 @@ vchan_create(struct pcm_channel *parent) RANGE(vchanspd, parent_caps->minspeed, parent_caps->maxspeed); } - save = 1; + save = true; } - if (ret == 0) { - /* -* Limit the speed between feeder_rate_min <-> feeder_rate_max. -*/ - RANGE(vchanspd, feeder_rate_min, feeder_rate_max); - - if (feeder_rate_round) { - RANGE(vchanspd, parent_caps->minspeed, - parent_caps->maxspeed); - vchanspd = CHANNEL_SETSPEED(parent->methods, - parent->devinfo, vchanspd); - } + /* +* Limit the speed between feeder_rate_min <-> feeder_rate_max. +*/ + RANGE(vchanspd, feeder_rate_min, feeder_rate_max); - ret = chn_reset(parent, vchanfmt, vchanspd); + if (feeder_rate_round) { + RANGE(vchanspd, parent_caps->minspeed, + parent_caps->maxspeed); + vchanspd = CHANNEL_SETSPEED(parent->methods, + parent->devinfo, vchanspd); } - if (ret == 0 && save) { + if ((ret = chn_reset(parent, vchanfmt, vchanspd)) != 0) + goto fail; + + if (save) { /* * Save new value. */ @@ -809,23 +808,24 @@ vchan_create(struct pcm_channel *parent) * If the parent channel supports digital format, * enable passthrough mode. */ - if (ret == 0 && snd_fmtvalid(AFMT_PASSTHROUGH, parent_caps->fmtlist)) { + if (snd_fmtvalid(AFMT_PASSTHROUGH, parent_caps->fmtlist)) { parent->flags &= ~CHN_F_VCHAN_DYNAMIC; parent->flags |= CHN_F_VCHAN_PASSTHROUGH; } - if (ret != 0) { - CHN_REMOVE(parent, ch, children); - parent->flags &= ~CHN_F_HAS_VCHAN; - CHN_UNLOCK(parent); - PCM_LOCK(d); - if (pcm_chn_remove(d, ch) == 0) { - PCM_UNLOCK(d); - chn_kill(ch); - } else - PCM_UNLOCK(d); - CHN_LOCK(parent); - } + return (ret); + +fail: + CHN_REMOVE(parent, ch, children); +
git: 248aced26eee - main - sound: Retire SND_MAXHWCHAN
The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=248aced26eee6f569717618d097bc2205a93c800 commit 248aced26eee6f569717618d097bc2205a93c800 Author: Christos Margiolis AuthorDate: 2024-10-18 08:40:16 + Commit: Christos Margiolis CommitDate: 2024-10-18 08:40:16 + sound: Retire SND_MAXHWCHAN No longer used. Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by:dev_submerge.ch Differential Revision: https://reviews.freebsd.org/D46522 --- sys/dev/sound/pcm/sound.h | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/sys/dev/sound/pcm/sound.h b/sys/dev/sound/pcm/sound.h index 2de6ab29bd66..51c9c91f6f20 100644 --- a/sys/dev/sound/pcm/sound.h +++ b/sys/dev/sound/pcm/sound.h @@ -99,11 +99,7 @@ struct snd_mixer; #define SOUND_PREFVER SOUND_MODVER #define SOUND_MAXVER SOUND_MODVER -/* - * By design, limit possible channels for each direction. - */ -#define SND_MAXHWCHAN 256 -#define SND_MAXVCHANS SND_MAXHWCHAN +#define SND_MAXVCHANS 256 #define SD_F_SIMPLEX 0x0001 #define SD_F_AUTOVCHAN 0x0002
git: c30f531ddb62 - main - sound: Shorten channel names
The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=c30f531ddb629ab51359fb540c8ef6068bab288b commit c30f531ddb629ab51359fb540c8ef6068bab288b Author: Christos Margiolis AuthorDate: 2024-10-18 08:40:50 + Commit: Christos Margiolis CommitDate: 2024-10-18 08:40:50 + sound: Shorten channel names The current channel naming convention is: pcmX:[virtual_]play|record:dspX.[v]p|rY - pcmX and dspX share the same unit numbers - "[v]p|r" gives us the same information as "[virtual_]play|record" Remove the redundant information, so that the channel names become more readable: dspX.[virtual_]play|record.Y Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by:dev_submerge.ch Differential Revision: https://reviews.freebsd.org/D46836 --- sys/dev/sound/pcm/channel.c | 10 ++ sys/dev/sound/pcm/dsp.c | 20 ++-- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index 5b0bb105c505..1e68be161322 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -1182,7 +1182,7 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, struct pcm_channel *c; struct feeder_class *fc; struct snd_dbuf *b, *bs; - char *dirs, buf[CHN_NAMELEN]; + char buf[CHN_NAMELEN]; int i, direction, type; PCM_BUSYASSERT(d); @@ -1190,22 +1190,18 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, switch (dir) { case PCMDIR_PLAY: - dirs = "play"; direction = PCMDIR_PLAY; type = SND_DEV_DSPHW_PLAY; break; case PCMDIR_PLAY_VIRTUAL: - dirs = "virtual_play"; direction = PCMDIR_PLAY; type = SND_DEV_DSPHW_VPLAY; break; case PCMDIR_REC: - dirs = "record"; direction = PCMDIR_REC; type = SND_DEV_DSPHW_REC; break; case PCMDIR_REC_VIRTUAL: - dirs = "virtual_record"; direction = PCMDIR_REC; type = SND_DEV_DSPHW_VREC; break; @@ -1239,9 +1235,7 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, c->dev = d->dev; c->trigger = PCMTRIG_STOP; - snprintf(c->name, sizeof(c->name), "%s:%s:%s", - device_get_nameunit(c->dev), dirs, - dsp_unit2name(buf, sizeof(buf), c)); + strlcpy(c->name, dsp_unit2name(buf, sizeof(buf), c), sizeof(c->name)); c->matrix = *feeder_matrix_id_map(SND_CHN_MATRIX_1_0); c->matrix.id = SND_CHN_MATRIX_PCMCHANNEL; diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index 2b765bc8b115..bf68f64929c3 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -170,17 +170,17 @@ static const struct { char *sep; char *alias; } dsp_cdevs[] = { - { SND_DEV_DSP, "dsp",".", NULL }, - { SND_DEV_DSPHW_PLAY, "dsp", ".p", NULL }, - { SND_DEV_DSPHW_VPLAY, "dsp", ".vp", NULL }, - { SND_DEV_DSPHW_REC, "dsp", ".r", NULL }, - { SND_DEV_DSPHW_VREC, "dsp", ".vr", NULL }, + { SND_DEV_DSP, "dsp", ".",NULL }, + { SND_DEV_DSPHW_PLAY, "dsp", ".play.", NULL }, + { SND_DEV_DSPHW_VPLAY, "dsp", ".virtual_play.", NULL }, + { SND_DEV_DSPHW_REC, "dsp", ".record.", NULL }, + { SND_DEV_DSPHW_VREC, "dsp", ".virtual_record.", NULL }, /* Low priority, OSSv4 aliases. */ - { SND_DEV_DSP, "dsp_ac3", ".", "dsp" }, - { SND_DEV_DSP, "dsp_mmap", ".", "dsp" }, - { SND_DEV_DSP, "dsp_multich", ".", "dsp" }, - { SND_DEV_DSP, "dsp_spdifout", ".", "dsp" }, - { SND_DEV_DSP, "dsp_spdifin", ".", "dsp" }, + { SND_DEV_DSP, "dsp_ac3", ".", "dsp" }, + { SND_DEV_DSP, "dsp_mmap", ".", "dsp" }, + { SND_DEV_DSP, "dsp_multich", ".", "dsp" }, + { SND_DEV_DSP, "dsp_spdifout", ".", "dsp" }, + { SND_DEV_DSP, "dsp_spdifin", ".", "dsp" }, }; static void
git: 9263f854e9a6 - main - sound: Simplify channel creation and deletion process
The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=9263f854e9a63cc326a3d5f6331b933c4a010abf commit 9263f854e9a63cc326a3d5f6331b933c4a010abf Author: Christos Margiolis AuthorDate: 2024-10-18 08:40:41 + Commit: Christos Margiolis CommitDate: 2024-10-18 08:40:41 + sound: Simplify channel creation and deletion process Currently we create and destroy channels with the following consistent pattern: - chn_init() -> pcm_chn_add() - pcm_chn_remove() -> chn_kill() Instead of calling two separate functions, merge pcm_chn_add() with chn_init(), and pcm_chn_remove() with chn_kill(). Another benefit of this change is that we avoid the confusion caused by having pcm_chn_add(), as well as pcm_addchan(). Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by:dev_submerge.ch, markj Differential Revision: https://reviews.freebsd.org/D46835 --- sys/dev/sound/pcm/channel.c | 40 +++ sys/dev/sound/pcm/sound.c | 78 + sys/dev/sound/pcm/sound.h | 3 -- sys/dev/sound/pcm/vchan.c | 25 +++ 4 files changed, 45 insertions(+), 101 deletions(-) diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index d1c9bc616dcf..5b0bb105c505 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -1311,6 +1311,24 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, } PCM_LOCK(d); + CHN_INSERT_SORT_ASCEND(d, c, channels.pcm); + + switch (c->type) { + case SND_DEV_DSPHW_PLAY: + d->playcount++; + break; + case SND_DEV_DSPHW_VPLAY: + d->pvchancount++; + break; + case SND_DEV_DSPHW_REC: + d->reccount++; + break; + case SND_DEV_DSPHW_VREC: + d->rvchancount++; + break; + default: + __assert_unreachable(); + } return (c); @@ -1337,11 +1355,33 @@ fail: void chn_kill(struct pcm_channel *c) { + struct snddev_info *d = c->parentsnddev; struct snd_dbuf *b = c->bufhard; struct snd_dbuf *bs = c->bufsoft; PCM_BUSYASSERT(c->parentsnddev); + PCM_LOCK(d); + CHN_REMOVE(d, c, channels.pcm); + + switch (c->type) { + case SND_DEV_DSPHW_PLAY: + d->playcount--; + break; + case SND_DEV_DSPHW_VPLAY: + d->pvchancount--; + break; + case SND_DEV_DSPHW_REC: + d->reccount--; + break; + case SND_DEV_DSPHW_VREC: + d->rvchancount--; + break; + default: + __assert_unreachable(); + } + PCM_UNLOCK(d); + if (CHN_STARTED(c)) { CHN_LOCK(c); chn_trigger(c, PCMTRIG_ABORT); diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c index da28a267c81a..e25cb359f793 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -188,74 +188,6 @@ SYSCTL_PROC(_hw_snd, OID_AUTO, default_unit, sizeof(int), sysctl_hw_snd_default_unit, "I", "default sound device"); -void -pcm_chn_add(struct snddev_info *d, struct pcm_channel *ch) -{ - PCM_BUSYASSERT(d); - PCM_LOCKASSERT(d); - KASSERT(ch != NULL && (ch->direction == PCMDIR_PLAY || - ch->direction == PCMDIR_REC), ("Invalid pcm channel")); - - CHN_INSERT_SORT_ASCEND(d, ch, channels.pcm); - - switch (ch->type) { - case SND_DEV_DSPHW_PLAY: - d->playcount++; - break; - case SND_DEV_DSPHW_VPLAY: - d->pvchancount++; - break; - case SND_DEV_DSPHW_REC: - d->reccount++; - break; - case SND_DEV_DSPHW_VREC: - d->rvchancount++; - break; - default: - __assert_unreachable(); - } -} - -int -pcm_chn_remove(struct snddev_info *d, struct pcm_channel *ch) -{ - struct pcm_channel *tmp; - - PCM_BUSYASSERT(d); - PCM_LOCKASSERT(d); - - tmp = NULL; - - CHN_FOREACH(tmp, d, channels.pcm) { - if (tmp == ch) - break; - } - - if (tmp != ch) - return (EINVAL); - - CHN_REMOVE(d, ch, channels.pcm); - - switch (ch->type) { - case SND_DEV_DSPHW_PLAY: - d->playcount--; - break; - case SND_DEV_DSPHW_VPLAY: - d->pvchancount--; - break; - case SND_DEV_DSPHW_REC: - d->reccount--; - break; - case SND_DEV_DSPHW_VREC: - d->rvchancount--; - break; - default: - __assert_unreachable(); - } - - return (0); -} - int pcm_addchan(dev
git: f3092614bcae - main - sound: Remove useless newspd check in sysctl_dev_pcm_vchanrate()
The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=f3092614bcae949332a8f21f7b78ba68b3ee5899 commit f3092614bcae949332a8f21f7b78ba68b3ee5899 Author: Christos Margiolis AuthorDate: 2024-10-18 08:40:33 + Commit: Christos Margiolis CommitDate: 2024-10-18 08:40:33 + sound: Remove useless newspd check in sysctl_dev_pcm_vchanrate() feeder_rate_min functions as the lower boundary. Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by:dev_submerge.ch, markj, emaste Differential Revision: https://reviews.freebsd.org/D46834 --- sys/dev/sound/pcm/vchan.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/dev/sound/pcm/vchan.c b/sys/dev/sound/pcm/vchan.c index 9046c144b41b..8580eb679f35 100644 --- a/sys/dev/sound/pcm/vchan.c +++ b/sys/dev/sound/pcm/vchan.c @@ -508,8 +508,7 @@ sysctl_dev_pcm_vchanrate(SYSCTL_HANDLER_ARGS) return (ret); } - if (newspd < 1 || newspd < feeder_rate_min || - newspd > feeder_rate_max) { + if (newspd < feeder_rate_min || newspd > feeder_rate_max) { PCM_RELEASE_QUICK(d); return (EINVAL); }
git: 5e33eca8e8f3 - main - sound: Use M_WAITOK where possible
The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=5e33eca8e8f359d4d48f4c50334a03748420a7da commit 5e33eca8e8f359d4d48f4c50334a03748420a7da Author: Christos Margiolis AuthorDate: 2024-10-18 08:41:05 + Commit: Christos Margiolis CommitDate: 2024-10-18 08:41:05 + sound: Use M_WAITOK where possible These malloc(9) calls are in contexts where sleeping is permitted. Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by:dev_submerge.ch, zlei, markj, emaste Differential Revision: https://reviews.freebsd.org/D46845 --- sys/dev/sound/pcm/channel.c | 7 +-- sys/dev/sound/pcm/feeder.c | 14 ++ 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index 1e68be161322..6b8f00f9aa83 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -1296,12 +1296,7 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, */ if (c->direction == PCMDIR_PLAY) { bs->sl = sndbuf_getmaxsize(bs); - bs->shadbuf = malloc(bs->sl, M_DEVBUF, M_NOWAIT); - if (bs->shadbuf == NULL) { - device_printf(d->dev, "%s(): failed to create shadow " - "buffer\n", __func__); - goto fail; - } + bs->shadbuf = malloc(bs->sl, M_DEVBUF, M_WAITOK); } PCM_LOCK(d); diff --git a/sys/dev/sound/pcm/feeder.c b/sys/dev/sound/pcm/feeder.c index c6f93ac54036..2b9599859102 100644 --- a/sys/dev/sound/pcm/feeder.c +++ b/sys/dev/sound/pcm/feeder.c @@ -62,11 +62,7 @@ feeder_register_root(void *p) KASSERT(fc->desc == NULL, ("first feeder not root: %s", fc->name)); SLIST_INIT(&feedertab); - fte = malloc(sizeof(*fte), M_FEEDER, M_NOWAIT | M_ZERO); - if (fte == NULL) { - printf("can't allocate memory for root feeder: %s\n", fc->name); - return; - } + fte = malloc(sizeof(*fte), M_FEEDER, M_WAITOK | M_ZERO); fte->feederclass = fc; fte->desc = NULL; fte->idx = feedercnt; @@ -92,13 +88,7 @@ feeder_register(void *p) */ i = 0; while ((feedercnt < MAXFEEDERS) && (fc->desc[i].type > 0)) { - fte = malloc(sizeof(*fte), M_FEEDER, M_NOWAIT | M_ZERO); - if (fte == NULL) { - printf("can't allocate memory for feeder '%s', " - "%x -> %x\n", - fc->name, fc->desc[i].in, fc->desc[i].out); - return; - } + fte = malloc(sizeof(*fte), M_FEEDER, M_WAITOK | M_ZERO); fte->feederclass = fc; fte->desc = &fc->desc[i]; fte->idx = feedercnt;
git: aaf84d0e9683 - main - sound: Do not check for NULL if sbuf is allocated with SBUF_AUTOEXTEND
The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=aaf84d0e96831cd886b8e1e4ae102b3ba703b90a commit aaf84d0e96831cd886b8e1e4ae102b3ba703b90a Author: Christos Margiolis AuthorDate: 2024-10-18 08:41:16 + Commit: Christos Margiolis CommitDate: 2024-10-18 08:41:16 + sound: Do not check for NULL if sbuf is allocated with SBUF_AUTOEXTEND Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by:dev_submerge.ch, markj Differential Revision: https://reviews.freebsd.org/D46846 --- sys/dev/sound/midi/midi.c | 6 +- sys/dev/sound/pcm/sndstat.c | 5 + 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/sys/dev/sound/midi/midi.c b/sys/dev/sound/midi/midi.c index c42cb1d7a90c..fbfb69de2913 100644 --- a/sys/dev/sound/midi/midi.c +++ b/sys/dev/sound/midi/midi.c @@ -950,12 +950,8 @@ midistat_open(struct cdev *i_dev, int flags, int mode, struct thread *td) return EBUSY; } midistat_isopen = 1; - if (sbuf_new(&midistat_sbuf, NULL, 4096, SBUF_AUTOEXTEND) == NULL) { - error = ENXIO; - goto out; - } + sbuf_new(&midistat_sbuf, NULL, 4096, SBUF_AUTOEXTEND); error = (midistat_prepare(&midistat_sbuf) > 0) ? 0 : ENOMEM; -out: if (error) midistat_isopen = 0; midistat_unlock(); diff --git a/sys/dev/sound/pcm/sndstat.c b/sys/dev/sound/pcm/sndstat.c index 993ca926070f..bc51da083439 100644 --- a/sys/dev/sound/pcm/sndstat.c +++ b/sys/dev/sound/pcm/sndstat.c @@ -150,10 +150,7 @@ sndstat_open(struct cdev *i_dev, int flags, int mode, struct thread *td) pf = malloc(sizeof(*pf), M_DEVBUF, M_WAITOK | M_ZERO); - if (sbuf_new(&pf->sbuf, NULL, 4096, SBUF_AUTOEXTEND) == NULL) { - free(pf, M_DEVBUF); - return (ENOMEM); - } + sbuf_new(&pf->sbuf, NULL, 4096, SBUF_AUTOEXTEND); pf->fflags = flags; TAILQ_INIT(&pf->userdev_list);
git: de009cf68ba6 - main - snd_hda: Remove duplicate HDA_INTEL_CMLK* entries
The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=de009cf68ba68aa5823be3d6afeebb49a15b1251 commit de009cf68ba68aa5823be3d6afeebb49a15b1251 Author: Christos Margiolis AuthorDate: 2024-10-18 08:41:36 + Commit: Christos Margiolis CommitDate: 2024-10-18 08:41:36 + snd_hda: Remove duplicate HDA_INTEL_CMLK* entries No functional change intended. Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by:markj, emaste Differential Revision: https://reviews.freebsd.org/D47152 --- sys/dev/sound/pci/hda/hdac.c | 2 -- sys/dev/sound/pci/hda/hdac.h | 2 -- 2 files changed, 4 deletions(-) diff --git a/sys/dev/sound/pci/hda/hdac.c b/sys/dev/sound/pci/hda/hdac.c index cd5fc6adb80d..929080b7ac69 100644 --- a/sys/dev/sound/pci/hda/hdac.c +++ b/sys/dev/sound/pci/hda/hdac.c @@ -106,8 +106,6 @@ static const struct { { HDA_INTEL_CMLKS, "Intel Comet Lake-S", 0, 0 }, { HDA_INTEL_CNLK,"Intel Cannon Lake", 0, 0 }, { HDA_INTEL_ICLK,"Intel Ice Lake", 0, 0 }, - { HDA_INTEL_CMLKLP, "Intel Comet Lake-LP", 0, 0 }, - { HDA_INTEL_CMLKH, "Intel Comet Lake-H", 0, 0 }, { HDA_INTEL_TGLK,"Intel Tiger Lake",0, 0 }, { HDA_INTEL_TGLKH, "Intel Tiger Lake-H", 0, 0 }, { HDA_INTEL_GMLK,"Intel Gemini Lake", 0, 0 }, diff --git a/sys/dev/sound/pci/hda/hdac.h b/sys/dev/sound/pci/hda/hdac.h index 5e66e8eaed59..91ddb9ed 100644 --- a/sys/dev/sound/pci/hda/hdac.h +++ b/sys/dev/sound/pci/hda/hdac.h @@ -95,8 +95,6 @@ #define HDA_INTEL_CMLKSHDA_MODEL_CONSTRUCT(INTEL, 0xa3f0) #define HDA_INTEL_CNLK HDA_MODEL_CONSTRUCT(INTEL, 0x9dc8) #define HDA_INTEL_ICLK HDA_MODEL_CONSTRUCT(INTEL, 0x34c8) -#define HDA_INTEL_CMLKLP HDA_MODEL_CONSTRUCT(INTEL, 0x02c8) -#define HDA_INTEL_CMLKHHDA_MODEL_CONSTRUCT(INTEL, 0x06c8) #define HDA_INTEL_TGLK HDA_MODEL_CONSTRUCT(INTEL, 0xa0c8) #define HDA_INTEL_TGLKHHDA_MODEL_CONSTRUCT(INTEL, 0x43c8) #define HDA_INTEL_MTL HDA_MODEL_CONSTRUCT(INTEL, 0x7e28)
git: d643e82356d4 - main - snd_hda: Identify NVIDIA GM204
The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=d643e82356d46a20a8f3f2f3c42573a6827d568a commit d643e82356d46a20a8f3f2f3c42573a6827d568a Author: Jani Salonen AuthorDate: 2024-10-18 08:41:44 + Commit: Christos Margiolis CommitDate: 2024-10-18 08:41:44 + snd_hda: Identify NVIDIA GM204 PR: 228615 MFC after: 2 days Reviewed by:markj Differential Revision: https://reviews.freebsd.org/D47166 --- sys/dev/sound/pci/hda/hdac.h | 1 + sys/dev/sound/pci/hda/hdacc.c | 1 + 2 files changed, 2 insertions(+) diff --git a/sys/dev/sound/pci/hda/hdac.h b/sys/dev/sound/pci/hda/hdac.h index 91ddb9ed..d00ad4e4705c 100644 --- a/sys/dev/sound/pci/hda/hdac.h +++ b/sys/dev/sound/pci/hda/hdac.h @@ -883,6 +883,7 @@ #define HDA_CODEC_NVIDIATEGRA124 HDA_CODEC_CONSTRUCT(NVIDIA, 0x0028) #define HDA_CODEC_NVIDIATEGRA210 HDA_CODEC_CONSTRUCT(NVIDIA, 0x0029) #define HDA_CODEC_NVIDIAMCP67 HDA_CODEC_CONSTRUCT(NVIDIA, 0x0067) +#define HDA_CODEC_NVIDIAGM204 HDA_CODEC_CONSTRUCT(NVIDIA, 0x0071) #define HDA_CODEC_NVIDIAMCP73 HDA_CODEC_CONSTRUCT(NVIDIA, 0x8001) #define HDA_CODEC_NVIDIA HDA_CODEC_CONSTRUCT(NVIDIA, 0x) diff --git a/sys/dev/sound/pci/hda/hdacc.c b/sys/dev/sound/pci/hda/hdacc.c index ebb331779ba4..d5643caf4405 100644 --- a/sys/dev/sound/pci/hda/hdacc.c +++ b/sys/dev/sound/pci/hda/hdacc.c @@ -358,6 +358,7 @@ static const struct { { HDA_CODEC_NVIDIAMCP78_3, 0, "NVIDIA MCP78" }, { HDA_CODEC_NVIDIAMCP78_4, 0, "NVIDIA MCP78" }, { HDA_CODEC_NVIDIAMCP7A, 0, "NVIDIA MCP7A" }, + { HDA_CODEC_NVIDIAGM204, 0, "NVIDIA GM204" }, { HDA_CODEC_NVIDIAGT220, 0, "NVIDIA GT220" }, { HDA_CODEC_NVIDIAGT21X, 0, "NVIDIA GT21x" }, { HDA_CODEC_NVIDIAMCP89, 0, "NVIDIA MCP89" },
git: 9ad289155872 - main - vmm.4: Add ppt device detach example
The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=9ad2891558729b1c1ad4ba02377b157e404a3da2 commit 9ad2891558729b1c1ad4ba02377b157e404a3da2 Author: Christos Margiolis AuthorDate: 2024-10-18 08:42:05 + Commit: Christos Margiolis CommitDate: 2024-10-18 08:42:05 + vmm.4: Add ppt device detach example Showcase how to detach ppt from a PCI device and attach a host driver, and vice-versa. MFC after: 2 days Reviewed by:markj Differential Revision: https://reviews.freebsd.org/D46811 --- share/man/man4/vmm.4 | 27 ++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/share/man/man4/vmm.4 b/share/man/man4/vmm.4 index dfd7ad26fb98..7e4c9050021a 100644 --- a/share/man/man4/vmm.4 +++ b/share/man/man4/vmm.4 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd March 6, 2024 +.Dd September 27, 2024 .Dt VMM 4 .Os .Sh NAME @@ -108,11 +108,36 @@ bus 6 slot 5 function 0, and bus 6 slot 5 function 1. .Bd -literal -offset indent pptdevs="10/0/0 6/5/0 6/5/1" .Ed +.Pp +It is possible to detach +.Va ppt +from a PCI device without rebooting the host machine and then attach a host +driver, using the +.Xr devctl 8 +utility. +Suppose +.Va ppt +is currently attached to +.Va pci0:0:1:0 +and we want the host's +.Xr xhci 4 +driver to be attached instead: +.Bd -literal -offset indent +# devctl set driver -f pci0:0:1:0 xhci +.Ed +.Pp +The same can be applied to attach +.Va ppt +back: +.Bd -literal -offset indent +# devctl set driver -f pci0:0:1:0 ppt +.Ed .Sh SEE ALSO .Xr bhyve 4 , .Xr loader.conf 5 , .Xr bhyve 8 , .Xr bhyveload 8 , +.Xr devctl 8 , .Xr kldload 8 .Sh HISTORY .Nm vmm.ko
git: f57efe95cc25 - main - mididump(1): Initial revision
The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=f57efe95cc25ae527c632d4ffcf064799f922216 commit f57efe95cc25ae527c632d4ffcf064799f922216 Author: Christos Margiolis AuthorDate: 2024-10-18 08:42:12 + Commit: Christos Margiolis CommitDate: 2024-10-18 08:42:12 + mididump(1): Initial revision A new utility which dumps MIDI 1.0 events in real-time. Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by:dev_submerge.ch Differential Revision: https://reviews.freebsd.org/D46418 --- usr.bin/Makefile| 1 + usr.bin/mididump/Makefile | 8 ++ usr.bin/mididump/mididump.1 | 80 +++ usr.bin/mididump/mididump.c | 320 4 files changed, 409 insertions(+) diff --git a/usr.bin/Makefile b/usr.bin/Makefile index 88786a0dd7e0..3cd91f8019e3 100644 --- a/usr.bin/Makefile +++ b/usr.bin/Makefile @@ -88,6 +88,7 @@ SUBDIR= alias \ mandoc \ mdo \ mesg \ + mididump \ ministat \ mkdep \ mkfifo \ diff --git a/usr.bin/mididump/Makefile b/usr.bin/mididump/Makefile new file mode 100644 index ..f3b273172b1e --- /dev/null +++ b/usr.bin/mididump/Makefile @@ -0,0 +1,8 @@ +.include + +PROG= mididump +SRCS= ${PROG}.c +MAN= ${PROG}.1 +LDFLAGS+= -lm + +.include diff --git a/usr.bin/mididump/mididump.1 b/usr.bin/mididump/mididump.1 new file mode 100644 index ..7b2bc649eb24 --- /dev/null +++ b/usr.bin/mididump/mididump.1 @@ -0,0 +1,80 @@ +.\"- +.\" SPDX-License-Identifier: BSD-2-Clause +.\" +.\" Copyright (c) 2024 The FreeBSD Foundation +.\" +.\" Portions of this software were developed by Christos Margiolis +.\" under sponsorship from the FreeBSD Foundation. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\"notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\"notice, this list of conditions and the following disclaimer in the +.\"documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd September 14, 2024 +.Dt MIDIDUMP 1 +.Os +.Sh NAME +.Nm mididump +.Nd dump MIDI events +.Sh SYNOPSIS +.Nm +.Op Fl t +.Ar device +.Sh DESCRIPTION +The +.Nm +utility is used to dump MIDI 1.0 events in real-time. +.Pp +The options are as follows: +.Bl -tag -width "-t" +.It Fl t +Print "Timing Clock" events. +These events are not printed by default, as they tend to clutter output. +.El +.Pp +The +.Ar device +argument corresponds to the MIDI device (e.g. +.Pa /dev/umidi0.0 ) . +.Sh SEE ALSO +.Rs +.%T Summary of MIDI 1.0 Messages +.%U https://midi.org/summary-of-midi-1-0-messages +.Re +.Rs +.%T Expanded MIDI 1.0 Messages List (Status Bytes) +.%U https://midi.org/expanded-midi-1-0-messages-list +.Re +.Rs +.%T Standard MIDI-File Format Spec. 1.1, updated +.%U https://www.music.mcgill.ca/~ich/classes/mumt306/StandardMIDIfileformat.html +.Re +.Rs +.%T MIDI CC List for Continuous Controllers +.%U https://anotherproducer.com/online-tools-for-musicians/midi-cc-list/ +.Re +.Sh AUTHORS +The +.Nm +utility was implemented by +.An Christos Margiolis Aq Mt chris...@freebsd.org +under sponsorship from the +.Fx +Foundation. diff --git a/usr.bin/mididump/mididump.c b/usr.bin/mididump/mididump.c new file mode 100644 index ..9c8fe62c9859 --- /dev/null +++ b/usr.bin/mididump/mididump.c @@ -0,0 +1,320 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2024 The FreeBSD Foundation + * + * This software was developed by Christos Margiolis + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following
git: 6f96ef84b359 - main - onyx: Remove unreachable if condition
The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=6f96ef84b359137a51dc1e717887ca7d31ba7bad commit 6f96ef84b359137a51dc1e717887ca7d31ba7bad Author: Christos Margiolis AuthorDate: 2024-10-18 08:41:55 + Commit: Christos Margiolis CommitDate: 2024-10-18 08:41:55 + onyx: Remove unreachable if condition Both conditions are the same, so the second one is unreachable. PR: 229550 Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by:andreast, markj Differential Revision: https://reviews.freebsd.org/D47167 --- sys/dev/sound/macio/onyx.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/dev/sound/macio/onyx.c b/sys/dev/sound/macio/onyx.c index 00c7b826f142..d13f3da92db6 100644 --- a/sys/dev/sound/macio/onyx.c +++ b/sys/dev/sound/macio/onyx.c @@ -197,7 +197,6 @@ onyx_probe(device_t dev) if (strcmp(name, "codec") == 0) { if (iicbus_get_addr(dev) != PCM3052_IICADDR) return (ENXIO); - } else if (strcmp(name, "codec") == 0) { compat = ofw_bus_get_compat(dev); if (compat == NULL || strcmp(compat, "pcm3052") != 0) return (ENXIO);