svn commit: r362171 - in head/lib/libc: stdio string sys
Author: gbe (doc committer) Date: Sun Jun 14 05:59:30 2020 New Revision: 362171 URL: https://svnweb.freebsd.org/changeset/base/362171 Log: libc manpages: various improvements from NetBSD - Add STANDARDS and HISTORY sections within the appropriate manpages - Mention two USENIX papers within kqueue(2) and strlcpy(3) Reviewed by: bcr (mentor) Approved by: bcr (mentor) Obtained from:NetBSD MFC after:7 days Differential Revision: https://reviews.freebsd.org/D24650 Modified: head/lib/libc/stdio/fflush.3 head/lib/libc/stdio/fopen.3 head/lib/libc/stdio/setbuf.3 head/lib/libc/string/strlcpy.3 head/lib/libc/sys/getgid.2 head/lib/libc/sys/getitimer.2 head/lib/libc/sys/kqueue.2 Modified: head/lib/libc/stdio/fflush.3 == --- head/lib/libc/stdio/fflush.3Sun Jun 14 05:50:28 2020 (r362170) +++ head/lib/libc/stdio/fflush.3Sun Jun 14 05:59:30 2020 (r362171) @@ -32,7 +32,7 @@ .\" @(#)fflush.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd January 23, 2020 +.Dd May 1, 2020 .Dt FFLUSH 3 .Os .Sh NAME @@ -125,3 +125,12 @@ The function conforms to .St -isoC . +.Sh HISTORY +The +.Fn fflush +function first appeared in +.At v4 . +The +.Fn fpurge +function first appeared in +.Bx 4.4 . Modified: head/lib/libc/stdio/fopen.3 == --- head/lib/libc/stdio/fopen.3 Sun Jun 14 05:50:28 2020(r362170) +++ head/lib/libc/stdio/fopen.3 Sun Jun 14 05:59:30 2020(r362171) @@ -32,7 +32,7 @@ .\" @(#)fopen.38.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd January 30, 2013 +.Dd May 1, 2020 .Dt FOPEN 3 .Os .Sh NAME @@ -356,3 +356,8 @@ The .Dq Li b mode does not conform to any standard but is also supported by glibc. +.Sh HISTORY +An +.Fn fopen +function appeared in +.At v1 . Modified: head/lib/libc/stdio/setbuf.3 == --- head/lib/libc/stdio/setbuf.3Sun Jun 14 05:50:28 2020 (r362170) +++ head/lib/libc/stdio/setbuf.3Sun Jun 14 05:59:30 2020 (r362171) @@ -32,7 +32,7 @@ .\" @(#)setbuf.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd February 18, 2013 +.Dd May 1, 2020 .Dt SETBUF 3 .Os .Sh NAME @@ -195,6 +195,23 @@ and functions conform to .St -isoC . +.Sh HISTORY +The +.Fn setbuf +function first appeared in +.At v7 . +The +.Fn setbuffer +function first appeared in +.Bx 4.1c . +The +.Fn setlinebuf +function first appeared in +.Bx 4.2 . +The +.Fn setvbuf +function first appeared in +.Bx 4.4 . .Sh BUGS .Fn setbuf usually uses a suboptimal buffer size and should be avoided. Modified: head/lib/libc/string/strlcpy.3 == --- head/lib/libc/string/strlcpy.3 Sun Jun 14 05:50:28 2020 (r362170) +++ head/lib/libc/string/strlcpy.3 Sun Jun 14 05:59:30 2020 (r362171) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 26, 2016 +.Dd May 1, 2020 .Dt STRLCPY 3 .Os .Sh NAME @@ -189,6 +189,16 @@ As a matter of fact, the first version of this manual .Xr strncat 3 , .Xr strncpy 3 , .Xr wcslcpy 3 +.Rs +.%A Todd C. Miller +.%A Theo de Raadt +.%T strlcpy and strlcat -- Consistent, Safe, String Copy and Concatenation +.%I USENIX Association +.%B Proceedings of the FREENIX Track: 1999 USENIX Annual Technical Conference +.%D June 6-11, 1999 +.%U http://www.usenix.org/publications/library/proceedings/usenix99/ +.%U full_papers/millert/millert.pdf +.Re .Sh HISTORY The .Fn strlcpy Modified: head/lib/libc/sys/getgid.2 == --- head/lib/libc/sys/getgid.2 Sun Jun 14 05:50:28 2020(r362170) +++ head/lib/libc/sys/getgid.2 Sun Jun 14 05:59:30 2020(r362171) @@ -28,7 +28,7 @@ .\" @(#)getgid.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd December 15, 2015 +.Dd May 1, 2020 .Dt GETGID 2 .Os .Sh NAME @@ -78,3 +78,8 @@ and .Fn getegid system calls are expected to conform to .St -p1003.1-90 . +.Sh HISTORY +The +.Fn getgid +function appeared in +.At v4 . Modified: head/lib/libc/sys/getitimer.2 == --- head/lib/libc/sys/getitimer.2 Sun Jun 14 05:50:28 2020 (r362170) +++ head/lib/libc/sys/getitimer.2 Sun Jun 14 05:59:30 2020 (r362171) @@ -28,7 +28,7 @@ .\" @(#)getitimer.28.3 (Berkeley) 5/16/95 .\" $FreeBSD$ .\" -.Dd May 16, 1995 +.Dd May 1, 2020 .Dt GETITIMER 2 .Os .Sh NAME @@ -173,6 +173,21 @@ to be handled. .Xr select 2 , .Xr sigaction 2 , .Xr clocks 7 +.Sh STANDARDS +The +.Fn getitimer +and +.Fn setitimer +functions conform to +.St -p1003.1-2001 . +The later +.St -p1003.1-2008 +revision however marked both functions as obsolescent, +recommending the use of +.Xr
svn commit: r362170 - in head/cddl/contrib/opensolaris/cmd: dtrace lockstat zdb zfs zpool zstreamdump
Author: gbe (doc committer) Date: Sun Jun 14 05:50:28 2020 New Revision: 362170 URL: https://svnweb.freebsd.org/changeset/base/362170 Log: Add HISTORY sections to ZFS and dtrace manpage Reviewed by: bcr (mentor) Approved by: bcr (mentor) MFC after:7 days Differential Revision:https://reviews.freebsd.org/D23833 Modified: head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.1 head/cddl/contrib/opensolaris/cmd/zdb/zdb.8 head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 head/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.1 Modified: head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 == --- head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 Sun Jun 14 05:35:02 2020(r362169) +++ head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 Sun Jun 14 05:50:28 2020(r362170) @@ -20,7 +20,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 30, 2018 +.Dd February 25, 2020 .Dt DTRACE 1 .Os .Sh NAME @@ -776,6 +776,11 @@ failed or that the specified request could not be sati .It 2 Invalid command line options or arguments were specified. .El +.Sh HISTORY +The +.Nm +utility first appeared in +.Fx 7.1 . .Sh SEE ALSO .Xr cpp 1 , .Xr elf 5 , Modified: head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.1 == --- head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.1 Sun Jun 14 05:35:02 2020(r362169) +++ head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.1 Sun Jun 14 05:50:28 2020(r362170) @@ -21,7 +21,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 29, 2015 +.Dd February 25, 2020 .Dt LOCKSTAT 1 .Os .Sh NAME @@ -366,6 +366,11 @@ Count indv cuml rcnt nsec Lock C .Xr dtrace 1 , .Xr ksyms 4 , .Xr locking 9 +.Sh HISTORY +The +.Nm +utility first appeared in +.Fx 7.1 . .Sh NOTES Tail-call elimination can affect call sites. For example, if Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.8 == --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.8 Sun Jun 14 05:35:02 2020 (r362169) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.8 Sun Jun 14 05:50:28 2020 (r362170) @@ -13,7 +13,7 @@ .\" Copyright (c) 2012, 2018 by Delphix. All rights reserved. .\" Copyright 2017 Nexenta Systems, Inc. .\" -.Dd October 06, 2017 +.Dd February 25, 2020 .Dt ZDB 8 .Os .Sh NAME @@ -407,3 +407,8 @@ dedup = 1.11, compress = 1.80, copies = 1.00, dedup * .Sh SEE ALSO .Xr zfs 8 , .Xr zpool 8 +.Sh HISTORY +The +.Nm +utility first appeared in +.Fx 7.0 . Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 == --- head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sun Jun 14 05:35:02 2020 (r362169) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sun Jun 14 05:50:28 2020 (r362170) @@ -3949,6 +3949,11 @@ M F /tank/test/modified .Xr umount 8 , .Xr zfs-program 8 , .Xr zpool 8 +.Sh HISTORY +The +.Nm +utility first appeared in +.Fx 7.0 . .Sh AUTHORS This manual page is a .Xr mdoc 7 Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 == --- head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Sun Jun 14 05:35:02 2020(r362169) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Sun Jun 14 05:50:28 2020(r362170) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 7, 2019 +.Dd February 25, 2020 .Dt ZPOOL 8 .Os .Sh NAME @@ -2462,6 +2462,11 @@ Discarded approximately 29 seconds of transactions. .Xr zpool-features 7 , .Xr zfs 8 , .Xr zfsd 8 +.Sh HISTORY +The +.Nm +utility first appeared in +.Fx 7.0 . .Sh AUTHORS This manual page is a .Xr mdoc 7 Modified: head/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.1 == --- head/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.1 Sun Jun 14 05:35:02 2020(r362169) +++ head/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.1 Sun Jun 14 05:50:28 2020(r362170) @@ -22,7 +22,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 31, 2013 +.Dd February 25, 2020 .Dt ZSTREAMDUMP 8 .Os .Sh NAME @@ -52,6 +52,11 @@ Verbose. Dump all headers, not only begin and end head .El .Sh SEE ALSO .Xr zfs 8 +.Sh HISTORY +The +.Nm +utility first appeared in +.Fx 7.0 . .Sh AUTHORS This manual page is a .Xr mdoc 7 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r362169 - head/lib/libutil
Author: gbe (doc committer) Date: Sun Jun 14 05:35:02 2020 New Revision: 362169 URL: https://svnweb.freebsd.org/changeset/base/362169 Log: libutil: Document function HISTORY within the manpages Reviewed by: bcr (mentor) Approved by: bcr (mentor) MFC after:7 days Differential Revision:https://reviews.freebsd.org/D24795 Modified: head/lib/libutil/_secure_path.3 head/lib/libutil/hexdump.3 head/lib/libutil/kinfo_getallproc.3 head/lib/libutil/kinfo_getfile.3 head/lib/libutil/kinfo_getproc.3 head/lib/libutil/kinfo_getvmmap.3 head/lib/libutil/kinfo_getvmobject.3 head/lib/libutil/login.conf.5 head/lib/libutil/login_auth.3 head/lib/libutil/login_cap.3 head/lib/libutil/login_class.3 head/lib/libutil/login_ok.3 head/lib/libutil/login_times.3 head/lib/libutil/login_tty.3 head/lib/libutil/pidfile.3 head/lib/libutil/pw_util.3 head/lib/libutil/realhostname.3 head/lib/libutil/trimdomain.3 head/lib/libutil/uucplock.3 Modified: head/lib/libutil/_secure_path.3 == --- head/lib/libutil/_secure_path.3 Sun Jun 14 05:33:25 2020 (r362168) +++ head/lib/libutil/_secure_path.3 Sun Jun 14 05:35:02 2020 (r362169) @@ -19,7 +19,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 2, 1997 +.Dd May 10, 2020 .Dt _SECURE_PATH 3 .Os .Sh NAME @@ -69,6 +69,10 @@ reason, at LOG_ERR priority. Code from which this function was derived was contributed to the .Fx project by Berkeley Software Design, Inc. +The function +.Fn _secure_path +first appeared in +.Fx 2.2.5 . .Sh BUGS The checks carried out are rudimentary and no attempt is made to eliminate race conditions between use of this function and Modified: head/lib/libutil/hexdump.3 == --- head/lib/libutil/hexdump.3 Sun Jun 14 05:33:25 2020(r362168) +++ head/lib/libutil/hexdump.3 Sun Jun 14 05:35:02 2020(r362169) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 21, 2017 +.Dd May 8, 2020 .Dt HEXDUMP 3 .Os .Sh NAME @@ -83,6 +83,11 @@ Do not print the character values on each line. .Sh SEE ALSO .Xr ascii 7 , .Xr sbuf_hexdump 9 +.Sh HISTORY +The +.Fn hexdump +function first appeared in +.Fx 6.4 . .Sh AUTHORS This manual page was written by .An Scott Long . Modified: head/lib/libutil/kinfo_getallproc.3 == --- head/lib/libutil/kinfo_getallproc.3 Sun Jun 14 05:33:25 2020 (r362168) +++ head/lib/libutil/kinfo_getallproc.3 Sun Jun 14 05:35:02 2020 (r362169) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 27, 2015 +.Dd May 8, 2020 .Dt KINFO_GETALLPROC 3 .Os .Sh NAME @@ -73,3 +73,8 @@ function returns .Xr free 3 , .Xr malloc 3 , .Xr sysctl 3 +.Sh HISTORY +The +.Fn kinfo_getallproc +function first appeared in +.Fx 8.3 . Modified: head/lib/libutil/kinfo_getfile.3 == --- head/lib/libutil/kinfo_getfile.3Sun Jun 14 05:33:25 2020 (r362168) +++ head/lib/libutil/kinfo_getfile.3Sun Jun 14 05:35:02 2020 (r362169) @@ -78,3 +78,8 @@ function returns .Xr kinfo_getvmmap 3 , .Xr malloc 3 , .Xr sysctl 3 +.Sh HISTORY +The +.Fn kinfo_getfile +function first appeared in +.Fx 7.0 . Modified: head/lib/libutil/kinfo_getproc.3 == --- head/lib/libutil/kinfo_getproc.3Sun Jun 14 05:33:25 2020 (r362168) +++ head/lib/libutil/kinfo_getproc.3Sun Jun 14 05:35:02 2020 (r362169) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 27, 2015 +.Dd May 10, 2020 .Dt KINFO_GETPROC 3 .Os .Sh NAME @@ -72,3 +72,8 @@ function returns .Xr free 3 , .Xr malloc 3 , .Xr sysctl 3 +.Sh HISTORY +The +.Fn kinfo_getproc +function first appeared in +.Fx 7.0 . Modified: head/lib/libutil/kinfo_getvmmap.3 == --- head/lib/libutil/kinfo_getvmmap.3 Sun Jun 14 05:33:25 2020 (r362168) +++ head/lib/libutil/kinfo_getvmmap.3 Sun Jun 14 05:35:02 2020 (r362169) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 18, 2017 +.Dd May 10, 2020 .Dt KINFO_GETVMMAP 3 .Os .Sh NAME @@ -84,3 +84,8 @@ function returns .Xr free 3 , .Xr kinfo_getfile 3 , .Xr malloc 3 +.Sh HISTORY +The +.Fn kinfo_getvmmap +function first appeared in +.Fx 7.0 . Modified: head/lib/libutil/kinfo_getvmobject.3 == --- head/lib/libutil/kinfo_getvmobject.3Sun Jun 14 05:33:25 2020 (r362168) +++ head/lib/libutil/kinfo_getvmobject.3Sun Jun 14 05:35:02 2020 (r362169) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 27, 2015 +.Dd May 20, 2020 .Dt KINFO_GETVMOBJECT 3 .Os .Sh NAME @@ -71,3 +71,8 @@ function returns .Xr free 3 ,
svn commit: r362168 - stable/10/sys/dev/usb/net
Author: hselasky Date: Sun Jun 14 05:33:25 2020 New Revision: 362168 URL: https://svnweb.freebsd.org/changeset/base/362168 Log: MFC r362056: Add missing range checks when receiving USB ethernet packets. Found by: Ilja Van Sprundel, IOActive Sponsored by: Mellanox Technologies Modified: stable/10/sys/dev/usb/net/if_smsc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/net/if_smsc.c == --- stable/10/sys/dev/usb/net/if_smsc.c Sun Jun 14 05:27:37 2020 (r362167) +++ stable/10/sys/dev/usb/net/if_smsc.c Sun Jun 14 05:33:25 2020 (r362168) @@ -949,7 +949,7 @@ smsc_bulk_read_callback(struct usb_xfer *xfer, usb_err struct mbuf *m; struct usb_page_cache *pc; uint32_t rxhdr; - uint16_t pktlen; + int pktlen; int off; int actlen; @@ -975,6 +975,9 @@ smsc_bulk_read_callback(struct usb_xfer *xfer, usb_err /* The frame header is always aligned on a 4 byte boundary */ off = ((off + 0x3) & ~0x3); + if ((off + sizeof(rxhdr)) > actlen) + goto tr_setup; + usbd_copy_out(pc, off, , sizeof(rxhdr)); off += (sizeof(rxhdr) + ETHER_ALIGN); rxhdr = le32toh(rxhdr); @@ -1003,7 +1006,13 @@ smsc_bulk_read_callback(struct usb_xfer *xfer, usb_err ifp->if_iqdrops++; goto tr_setup; } - + if (pktlen > m->m_len) { + smsc_dbg_printf(sc, "buffer too small %d vs %d bytes", + pktlen, m->m_len); + if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); + m_freem(m); + goto tr_setup; + } usbd_copy_out(pc, off, mtod(m, uint8_t *), pktlen); /* Check if RX TCP/UDP checksumming is being offloaded */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r362167 - stable/11/sys/dev/usb/net
Author: hselasky Date: Sun Jun 14 05:27:37 2020 New Revision: 362167 URL: https://svnweb.freebsd.org/changeset/base/362167 Log: MFC r362056: Add missing range checks when receiving USB ethernet packets. Found by: Ilja Van Sprundel, IOActive Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/usb/net/if_smsc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/net/if_smsc.c == --- stable/11/sys/dev/usb/net/if_smsc.c Sun Jun 14 05:25:06 2020 (r362166) +++ stable/11/sys/dev/usb/net/if_smsc.c Sun Jun 14 05:27:37 2020 (r362167) @@ -970,7 +970,7 @@ smsc_bulk_read_callback(struct usb_xfer *xfer, usb_err struct mbuf *m; struct usb_page_cache *pc; uint32_t rxhdr; - uint16_t pktlen; + int pktlen; int off; int actlen; @@ -996,6 +996,9 @@ smsc_bulk_read_callback(struct usb_xfer *xfer, usb_err /* The frame header is always aligned on a 4 byte boundary */ off = ((off + 0x3) & ~0x3); + if ((off + sizeof(rxhdr)) > actlen) + goto tr_setup; + usbd_copy_out(pc, off, , sizeof(rxhdr)); off += (sizeof(rxhdr) + ETHER_ALIGN); rxhdr = le32toh(rxhdr); @@ -1024,7 +1027,13 @@ smsc_bulk_read_callback(struct usb_xfer *xfer, usb_err if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); goto tr_setup; } - + if (pktlen > m->m_len) { + smsc_dbg_printf(sc, "buffer too small %d vs %d bytes", + pktlen, m->m_len); + if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); + m_freem(m); + goto tr_setup; + } usbd_copy_out(pc, off, mtod(m, uint8_t *), pktlen); /* Check if RX TCP/UDP checksumming is being offloaded */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r362166 - stable/12/sys/dev/usb/net
Author: hselasky Date: Sun Jun 14 05:25:06 2020 New Revision: 362166 URL: https://svnweb.freebsd.org/changeset/base/362166 Log: MFC r362056: Add missing range checks when receiving USB ethernet packets. Found by: Ilja Van Sprundel, IOActive Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/usb/net/if_cdceem.c stable/12/sys/dev/usb/net/if_muge.c stable/12/sys/dev/usb/net/if_smsc.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/usb/net/if_cdceem.c == --- stable/12/sys/dev/usb/net/if_cdceem.c Sun Jun 14 05:08:15 2020 (r362165) +++ stable/12/sys/dev/usb/net/if_cdceem.c Sun Jun 14 05:25:06 2020 (r362166) @@ -426,9 +426,10 @@ cdceem_handle_data(struct usb_xfer *xfer, uint16_t hdr struct usb_ether *ue; struct ifnet *ifp; struct mbuf *m; - int actlen, off; uint32_t computed_crc, received_crc; - uint16_t pktlen; + int pktlen; + int actlen; + int off; off = *offp; sc = usbd_xfer_softc(xfer); @@ -442,7 +443,7 @@ cdceem_handle_data(struct usb_xfer *xfer, uint16_t hdr (hdr & CDCEEM_DATA_CRC) ? "valid" : "absent", pktlen); - if (pktlen < ETHER_HDR_LEN) { + if (pktlen < (ETHER_HDR_LEN + 4)) { CDCEEM_WARN(sc, "bad ethernet frame length %d, should be at least %d", pktlen, ETHER_HDR_LEN); @@ -466,6 +467,14 @@ cdceem_handle_data(struct usb_xfer *xfer, uint16_t hdr } pktlen -= 4; /* Subtract the CRC. */ + + if (pktlen > m->m_len) { + CDCEEM_WARN(sc, "buffer too small %d vs %d bytes", + pktlen, m->m_len); + if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); + m_freem(m); + return; + } usbd_copy_out(pc, off, mtod(m, uint8_t *), pktlen); off += pktlen; @@ -512,7 +521,7 @@ cdceem_bulk_read_callback(struct usb_xfer *xfer, usb_e pc = usbd_xfer_get_frame(xfer, 0); off = 0; - while (off < actlen) { + while ((off + sizeof(hdr)) <= actlen) { usbd_copy_out(pc, off, , sizeof(hdr)); CDCEEM_DEBUG(sc, "hdr = %#x", hdr); off += sizeof(hdr); Modified: stable/12/sys/dev/usb/net/if_muge.c == --- stable/12/sys/dev/usb/net/if_muge.c Sun Jun 14 05:08:15 2020 (r362165) +++ stable/12/sys/dev/usb/net/if_muge.c Sun Jun 14 05:25:06 2020 (r362166) @@ -1166,9 +1166,9 @@ muge_bulk_read_callback(struct usb_xfer *xfer, usb_err struct ifnet *ifp = uether_getifp(ue); struct mbuf *m; struct usb_page_cache *pc; - uint16_t pktlen; uint32_t rx_cmd_a, rx_cmd_b; uint16_t rx_cmd_c; + int pktlen; int off; int actlen; @@ -1246,7 +1246,14 @@ muge_bulk_read_callback(struct usb_xfer *xfer, usb_err 1); goto tr_setup; } - + if (pktlen > m->m_len) { + muge_dbg_printf(sc, + "buffer too small %d vs %d bytes", + pktlen, m->m_len); + if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); + m_freem(m); + goto tr_setup; + } usbd_copy_out(pc, off, mtod(m, uint8_t *), pktlen); Modified: stable/12/sys/dev/usb/net/if_smsc.c == --- stable/12/sys/dev/usb/net/if_smsc.c Sun Jun 14 05:08:15 2020 (r362165) +++ stable/12/sys/dev/usb/net/if_smsc.c Sun Jun 14 05:25:06 2020 (r362166) @@ -973,7 +973,7 @@ smsc_bulk_read_callback(struct usb_xfer *xfer, usb_err struct mbuf *m; struct usb_page_cache *pc; uint32_t rxhdr; - uint16_t pktlen; + int pktlen; int off; int actlen; @@ -999,6 +999,9 @@ smsc_bulk_read_callback(struct usb_xfer *xfer, usb_err /* The frame header is always aligned on a 4 byte boundary */ off = ((off + 0x3) & ~0x3); + if ((off + sizeof(rxhdr)) > actlen) + goto tr_setup; + usbd_copy_out(pc, off, , sizeof(rxhdr)); off += (sizeof(rxhdr) + ETHER_ALIGN); rxhdr = le32toh(rxhdr); @@ -1027,7 +1030,13 @@ smsc_bulk_read_callback(struct usb_xfer *xfer, usb_err
svn commit: r362165 - head/contrib/tzcode/stdtime
Author: gbe (doc committer) Date: Sun Jun 14 05:08:15 2020 New Revision: 362165 URL: https://svnweb.freebsd.org/changeset/base/362165 Log: Add a HISTORY section to ctime(3) Reviewed by: bcr (mentor) Approved by: bcr (mentor) Obtained from:OpenBSD MFC after:7 days Differential Revision:https://reviews.freebsd.org/D24635 Modified: head/contrib/tzcode/stdtime/ctime.3 Modified: head/contrib/tzcode/stdtime/ctime.3 == --- head/contrib/tzcode/stdtime/ctime.3 Sun Jun 14 01:22:19 2020 (r362164) +++ head/contrib/tzcode/stdtime/ctime.3 Sun Jun 14 05:08:15 2020 (r362165) @@ -335,6 +335,33 @@ the time package contributed to Berkeley by .An Arthur Olson and which appeared in .Bx 4.3 . +.Pp +The functions +.Fn asctime , +.Fn gmtime , +and +.Fn localtime +first appeared in +.At v5 , +.Fn difftime +and +.Fn mktime +in +.Bx 4.3 Reno , +and +.Fn timegm +and +.Fn timelocal +in SunOS 4.0. +.Pp +The functions +.Fn asctime_r , +.Fn ctime_r , +.Fn gmtime_r , +and +.Fn localtime_r +have been available since +.Fx 8.0 . .Sh BUGS Except for .Fn difftime , ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r362164 - head/sys/sys
Author: rmacklem Date: Sun Jun 14 01:22:19 2020 New Revision: 362164 URL: https://svnweb.freebsd.org/changeset/base/362164 Log: Oops, r362158 committed a duplicate definition of MAXSECFLAVORS. This patch gets rid of the duplicate. Modified: head/sys/sys/mount.h Modified: head/sys/sys/mount.h == --- head/sys/sys/mount.hSun Jun 14 00:40:00 2020(r362163) +++ head/sys/sys/mount.hSun Jun 14 01:22:19 2020(r362164) @@ -518,7 +518,6 @@ struct o2export_args { /* * Export arguments for local filesystem mount calls. */ -#defineMAXSECFLAVORS 5 struct export_args { uint64_t ex_flags; /* export related flags */ uid_t ex_root;/* mapping for root uid */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r362163 - head/usr.sbin/mountd
Author: rmacklem Date: Sun Jun 14 00:40:00 2020 New Revision: 362163 URL: https://svnweb.freebsd.org/changeset/base/362163 Log: Modify mountd to use the new struct export_args committed by r362158. r362158 modified struct export_args for make the ex_flags field 64bits and also changed the anonymous credentials to allow more than 16 groups. This patch fixes mountd.c to use the new structure. It does allocate larger exportlist and grouplist structures now. That will be fixed in a future commit. The only visible change will be that the credentials provided for the -maproot and -mapall exports options can now have more than 16 groups. Reviewed by: kib, freqlabs Relnotes: yes Differential Revision:https://reviews.freebsd.org/D25088 Modified: head/usr.sbin/mountd/mountd.c Modified: head/usr.sbin/mountd/mountd.c == --- head/usr.sbin/mountd/mountd.c Sun Jun 14 00:23:06 2020 (r362162) +++ head/usr.sbin/mountd/mountd.c Sun Jun 14 00:40:00 2020 (r362163) @@ -112,6 +112,15 @@ struct dirlist { #defineDP_DEFSET 0x1 #define DP_HOSTSET 0x2 +/* + * maproot/mapall credentials. + */ +struct expcred { + uid_t cr_uid; + int cr_ngroups; + gid_t cr_groups[NGROUPS_MAX + 1]; +}; + struct exportlist { struct dirlist *ex_dirl; struct dirlist *ex_defdir; @@ -120,8 +129,8 @@ struct exportlist { fsid_t ex_fs; char*ex_fsdir; char*ex_indexfile; - struct xucred ex_defanon; - int ex_defexflags; + struct expcred ex_defanon; + uint64_tex_defexflags; int ex_numsecflavors; int ex_secflavors[MAXSECFLAVORS]; int ex_defnumsecflavors; @@ -152,8 +161,8 @@ struct grouplist { int gr_type; union grouptypes gr_ptr; struct grouplist *gr_next; - struct xucred gr_anon; - int gr_exflags; + struct expcred gr_anon; + uint64_t gr_exflags; int gr_flag; int gr_numsecflavors; int gr_secflavors[MAXSECFLAVORS]; @@ -194,7 +203,7 @@ struct fhreturn { static char*add_expdir(struct dirlist **, char *, int); static voidadd_dlist(struct dirlist **, struct dirlist *, struct grouplist *, int, struct exportlist *, - struct xucred *, int); + struct expcred *, uint64_t); static voidadd_mlist(char *, char *); static int check_dirpath(char *); static int check_options(struct dirlist *); @@ -208,10 +217,10 @@ static void clearout_service(void); static voiddel_mlist(char *hostp, char *dirp); static struct dirlist *dirp_search(struct dirlist *, char *); static int do_export_mount(struct exportlist *, struct statfs *); -static int do_mount(struct exportlist *, struct grouplist *, int, - struct xucred *, char *, int, struct statfs *, int, int *); +static int do_mount(struct exportlist *, struct grouplist *, uint64_t, + struct expcred *, char *, int, struct statfs *, int, int *); static int do_opt(char **, char **, struct exportlist *, - struct grouplist *, int *, int *, struct xucred *); + struct grouplist *, int *, uint64_t *, struct expcred *); static struct exportlist *ex_search(fsid_t *, struct exportlisthead *); static struct exportlist *get_exp(void); static voidfree_dir(struct dirlist *); @@ -226,7 +235,7 @@ static void free_exports(struct exportlisthead *); static voidread_exportfile(int); static int compare_nmount_exportlist(struct iovec *, int, char *); static int compare_export(struct exportlist *, struct exportlist *); -static int compare_cred(struct xucred *, struct xucred *); +static int compare_cred(struct expcred *, struct expcred *); static int compare_secflavor(int *, int *, int); static voiddelete_export(struct iovec *, int, struct statfs *, char *); static int get_host(char *, struct grouplist *, struct grouplist *); @@ -237,13 +246,13 @@ static intget_net(char *, struct netmsk *, int); static voidgetexp_err(struct exportlist *, struct grouplist *, const char *); static struct grouplist*get_grp(void); static voidhang_dirp(struct dirlist *, struct grouplist *, - struct exportlist *, int, struct xucred *, int); + struct exportlist *, int, struct expcred *, uint64_t); static voidhuphandler(int sig); static int makemask(struct sockaddr_storage *ssp, int bitlen); static voidmntsrv(struct svc_req *, SVCXPRT *); static voidnextfield(char **, char **); static voidout_of_mem(void); -static voidparsecred(char *, struct xucred *); +static voidparsecred(char *, struct
svn commit: r362162 - head/sys/net80211
Author: adrian Date: Sun Jun 14 00:23:06 2020 New Revision: 362162 URL: https://svnweb.freebsd.org/changeset/base/362162 Log: [net80211] Treat frames without an rx status as not a decap'ed A-MSDU. Drivers for NICs which do A-MSDU decap in hardware / driver will need to set the rx status, so if it's missing then treat it as not a decap'ed A-MSDU. Modified: head/sys/net80211/ieee80211_input.h Modified: head/sys/net80211/ieee80211_input.h == --- head/sys/net80211/ieee80211_input.h Sun Jun 14 00:21:48 2020 (r362161) +++ head/sys/net80211/ieee80211_input.h Sun Jun 14 00:23:06 2020 (r362162) @@ -136,7 +136,8 @@ ishtinfooui(const uint8_t *frm) static __inline int ieee80211_check_rxseq_amsdu(const struct ieee80211_rx_stats *rxs) { - + if (rxs == NULL) + return 0; return (!! (rxs->c_pktflags & IEEE80211_RX_F_AMSDU)); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r362161 - head/sys/net80211
Author: adrian Date: Sun Jun 14 00:21:48 2020 New Revision: 362161 URL: https://svnweb.freebsd.org/changeset/base/362161 Log: [net80211] Also convert the ddb path Whoops - this belonged in my previous commit. Modified: head/sys/net80211/ieee80211_ddb.c Modified: head/sys/net80211/ieee80211_ddb.c == --- head/sys/net80211/ieee80211_ddb.c Sun Jun 14 00:15:44 2020 (r362160) +++ head/sys/net80211/ieee80211_ddb.c Sun Jun 14 00:21:48 2020 (r362161) @@ -209,6 +209,7 @@ _db_show_txampdu(const char *sep, int ix, const struct static void _db_show_rxampdu(const char *sep, int ix, const struct ieee80211_rx_ampdu *rap) { + struct mbuf *m; int i; db_printf("%srxampdu[%d]: %p flags 0x%x tid %u\n", @@ -219,10 +220,15 @@ _db_show_rxampdu(const char *sep, int ix, const struct db_printf("%s age %d nframes %d\n", sep, rap->rxa_age, rap->rxa_nframes); for (i = 0; i < IEEE80211_AGGR_BAWMAX; i++) - if (rap->rxa_m[i] != NULL) - db_printf("%s m[%2u:%4u] %p\n", sep, i, - IEEE80211_SEQ_ADD(rap->rxa_start, i), - rap->rxa_m[i]); + if (mbufq_len(>rxa_mq[i]) > 0) { + db_printf("%s m[%2u:%4u] ", sep, i, + IEEE80211_SEQ_ADD(rap->rxa_start, i)); + STAILQ_FOREACH(m, >rxa_mq[i].mq_head, + m_stailqpkt) { + db_printf(" %p", m); + } + db_printf("\n"); + } } static void ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r362160 - head
Author: rmacklem Date: Sun Jun 14 00:15:44 2020 New Revision: 362160 URL: https://svnweb.freebsd.org/changeset/base/362160 Log: Add an entry to UPDATING for r362158. Modified: head/UPDATING Modified: head/UPDATING == --- head/UPDATING Sun Jun 14 00:12:29 2020(r362159) +++ head/UPDATING Sun Jun 14 00:15:44 2020(r362160) @@ -26,6 +26,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20200613: + r362158 changed the arguments for VFS_CHECKEXP(). As such, any + out of tree file systems need to be modified and rebuilt. + Also, any file systems that are modules must be rebuilt. + 20200604: read(2) of a directory fd is now rejected by default. root may re-enable it for system root only on non-ZFS filesystems with the ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r362159 - head/sys/sys
Author: rmacklem Date: Sun Jun 14 00:12:29 2020 New Revision: 362159 URL: https://svnweb.freebsd.org/changeset/base/362159 Log: Version bump for r362158, since the arguments for vfs_checkexp() changed. Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h == --- head/sys/sys/param.hSun Jun 14 00:10:18 2020(r362158) +++ head/sys/sys/param.hSun Jun 14 00:12:29 2020(r362159) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300097 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300098 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r362158 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs fs/cd9660 fs/msdosfs fs/nfs fs/nfsserver fs/unionfs kern nlm sys ufs/ffs
Author: rmacklem Date: Sun Jun 14 00:10:18 2020 New Revision: 362158 URL: https://svnweb.freebsd.org/changeset/base/362158 Log: Fix export_args ex_flags field so that is 64bits, the same as mnt_flags. Since mnt_flags was upgraded to 64bits there has been a quirk in "struct export_args", since it hold a copy of mnt_flags in ex_flags, which is an "int" (32bits). This happens to currently work, since all the flag bits used in ex_flags are defined in the low order 32bits. However, new export flags cannot be defined. Also, ex_anon is a "struct xucred", which limits it to 16 additional groups. This patch revises "struct export_args" to make ex_flags 64bits and replaces ex_anon with ex_uid, ex_ngroups and ex_groups (which points to a groups list, so it can be malloc'd up to NGROUPS in size. This requires that the VFS_CHECKEXP() arguments change, so I also modified the last "secflavors" argument to be an array pointer, so that the secflavors could be copied in VFS_CHECKEXP() while the export entry is locked. (Without this patch VFS_CHECKEXP() returns a pointer to the secflavors array and then it is used after being unlocked, which is potentially a problem if the exports entry is changed. In practice this does not occur when mountd is run with "-S", but I think it is worth fixing.) This patch also deleted the vfs_oexport_conv() function, since do_mount_update() does the conversion, as required by the old vfs_cmount() calls. Reviewed by: kib, freqlabs Relnotes: yes Differential Revision:https://reviews.freebsd.org/D25088 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c head/sys/fs/cd9660/cd9660_vfsops.c head/sys/fs/msdosfs/msdosfs_vfsops.c head/sys/fs/nfs/nfsdport.h head/sys/fs/nfs/nfsport.h head/sys/fs/nfsserver/nfs_nfsdport.c head/sys/fs/unionfs/union_vfsops.c head/sys/kern/vfs_export.c head/sys/kern/vfs_init.c head/sys/kern/vfs_mount.c head/sys/nlm/nlm_prot_impl.c head/sys/sys/mount.h head/sys/ufs/ffs/ffs_vfsops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.cSat Jun 13 23:35:22 2020(r362157) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.cSun Jun 14 00:10:18 2020(r362158) @@ -101,8 +101,8 @@ static int zfs_root(vfs_t *vfsp, int flags, vnode_t ** static int zfs_statfs(vfs_t *vfsp, struct statfs *statp); static int zfs_vget(vfs_t *vfsp, ino_t ino, int flags, vnode_t **vpp); static int zfs_sync(vfs_t *vfsp, int waitfor); -static int zfs_checkexp(vfs_t *vfsp, struct sockaddr *nam, int *extflagsp, -struct ucred **credanonp, int *numsecflavors, int **secflavors); +static int zfs_checkexp(vfs_t *vfsp, struct sockaddr *nam, uint64_t *extflagsp, +struct ucred **credanonp, int *numsecflavors, int *secflavors); static int zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, int flags, vnode_t **vpp); static void zfs_objset_close(zfsvfs_t *zfsvfs); static void zfs_freevfs(vfs_t *vfsp); @@ -2268,8 +2268,8 @@ zfs_vget(vfs_t *vfsp, ino_t ino, int flags, vnode_t ** } static int -zfs_checkexp(vfs_t *vfsp, struct sockaddr *nam, int *extflagsp, -struct ucred **credanonp, int *numsecflavors, int **secflavors) +zfs_checkexp(vfs_t *vfsp, struct sockaddr *nam, uint64_t *extflagsp, +struct ucred **credanonp, int *numsecflavors, int *secflavors) { zfsvfs_t *zfsvfs = vfsp->vfs_data; Modified: head/sys/fs/cd9660/cd9660_vfsops.c == --- head/sys/fs/cd9660/cd9660_vfsops.c Sat Jun 13 23:35:22 2020 (r362157) +++ head/sys/fs/cd9660/cd9660_vfsops.c Sun Jun 14 00:10:18 2020 (r362158) @@ -101,16 +101,14 @@ static int cd9660_cmount(struct mntarg *ma, void *data, uint64_t flags) { struct iso_args args; - struct export_args exp; int error; error = copyin(data, , sizeof args); if (error) return (error); - vfs_oexport_conv(, ); ma = mount_argsu(ma, "from", args.fspec, MAXPATHLEN); - ma = mount_arg(ma, "export", , sizeof(exp)); + ma = mount_arg(ma, "export", , sizeof(args.export)); ma = mount_argsu(ma, "cs_disk", args.cs_disk, 64); ma = mount_argsu(ma, "cs_local", args.cs_local, 64); ma = mount_argf(ma, "ssector", "%u", args.ssector); Modified: head/sys/fs/msdosfs/msdosfs_vfsops.c == --- head/sys/fs/msdosfs/msdosfs_vfsops.cSat Jun 13 23:35:22 2020 (r362157) +++ head/sys/fs/msdosfs/msdosfs_vfsops.cSun Jun 14 00:10:18 2020 (r362158) @@ -190,7 +190,6 @@ static int msdosfs_cmount(struct mntarg *ma, void *data, uint64_t flags) { struct msdosfs_args args; - struct
svn commit: r362157 - head/sys/net80211
Author: adrian Date: Sat Jun 13 23:35:22 2020 New Revision: 362157 URL: https://svnweb.freebsd.org/changeset/base/362157 Log: [net80211] Handle offloaded AMSDU in AMPDU reordering. In the 11n world, most NICs did A-MPDU receive/transmit offloading but not A-MSDU offloading. So, the net80211 A-MPDU receive path would just receive MPDUs, do the reordering bit, pass it up to the rest of net80211 for crypto decap and then do A-MSDU decap before throwing ethernet frames up to the rest of the system. However 11ac and 11ax NICs are increasingly doing A-MSDU offload (and newer 11ax stuff does socket offload, but hey I don't want to scare people JUST yet) - so although A-MPDU reordering may be done in the OS, A-MSDUs look like a normal MPDU. This means that all the MSDUs are actually faked into a set of MPDUs with matching 802.11 header - the sequence number, QoS header and any encryption verification bits (like IV) are just copied. This shows up as MASSIVE packet loss in net80211, cause after the first MPDU we just toss the rest. (And don't get me started about ethernet decap with A-MPDU host reordering; we'll have to cross that bridge for later 11ac and 11ax bits too.) Anyway, this work changes each A-MPDU reorder slot into an mbufq. The mbufq is treated as a whole set of frames to pass up to the stack and reordered/de-duped as a group. The last frame in the reorder list is checked to see if it's an A-MSDU final frame so any duplicates are correctly tossed rather than double-received. Other than that, the rest of the logic is unchanged. The previous commit did a small subset of this - if there wasn't any reordering going on then it'd accept the A-MSDUs. This is the rest of the needed work. This is a no-op for 11n NICs doing A-MPDU reordering but needing software A-MSDU decap - they aren't tagged as A-MSDU and so any subsequent frames added to the reorder slot are tossed. Tested: * QCA9880 (ath10k/athp) - STA/AP mode; * RT3593 (if_rsu) - 11n STA+DWDS mode (I'm committing through it rn); * QCA9380 (if_ath) - STA/AP mode. Modified: head/sys/net80211/ieee80211_ht.c head/sys/net80211/ieee80211_ht.h Modified: head/sys/net80211/ieee80211_ht.c == --- head/sys/net80211/ieee80211_ht.cSat Jun 13 22:20:02 2020 (r362156) +++ head/sys/net80211/ieee80211_ht.cSat Jun 13 23:35:22 2020 (r362157) @@ -517,6 +517,22 @@ ieee80211_decap_amsdu(struct ieee80211_node *ni, struc return m; /* last delivered by caller */ } +static void +ampdu_rx_purge_slot(struct ieee80211_rx_ampdu *rap, int i) +{ + struct mbuf *m; + + /* Walk the queue, removing frames as appropriate */ + while (mbufq_len(>rxa_mq[i]) != 0) { + m = mbufq_dequeue(>rxa_mq[i]); + if (m == NULL) + break; + rap->rxa_qbytes -= m->m_pkthdr.len; + rap->rxa_qframes--; + m_freem(m); + } +} + /* * Add the given frame to the current RX reorder slot. * @@ -528,16 +544,94 @@ static int ampdu_rx_add_slot(struct ieee80211_rx_ampdu *rap, int off, int tid, ieee80211_seq rxseq, struct ieee80211_node *ni, -struct mbuf *m) +struct mbuf *m, +const struct ieee80211_rx_stats *rxs) { + const struct ieee80211_rx_stats *rxs_final = NULL; struct ieee80211vap *vap = ni->ni_vap; + int toss_dup; +#definePROCESS 0 /* caller should process frame */ +#defineCONSUMED1 /* frame consumed, caller does nothing */ - if (rap->rxa_m[off] == NULL) { - rap->rxa_m[off] = m; + /* +* Figure out if this is a duplicate frame for the given slot. +* +* We're assuming that the driver will hand us all the frames +* for a given AMSDU decap pass and if we get /a/ frame +* for an AMSDU decap then we'll get all of them. +* +* The tricksy bit is that we don't know when the /end/ of +* the decap pass is, because we aren't tracking state here +* per-slot to know that we've finished receiving the frame list. +* +* The driver sets RX_F_AMSDU and RX_F_AMSDU_MORE to tell us +* what's going on; so ideally we'd just check the frame at the +* end of the reassembly slot to see if its F_AMSDU w/ no F_AMSDU_MORE - +* that means we've received the whole AMSDU decap pass. +*/ + + /* +* Get the rxs of the final mbuf in the slot, if one exists. +*/ + if (mbufq_len(>rxa_mq[off]) != 0) { + rxs_final = ieee80211_get_rx_params_ptr(mbufq_last(>rxa_mq[off])); + } + + /* Default to tossing the duplicate frame */ + toss_dup = 1; + + /* +* Check to see if the final frame has F_AMSDU and
svn commit: r362156 - head/sys/net80211
Author: adrian Date: Sat Jun 13 22:20:02 2020 New Revision: 362156 URL: https://svnweb.freebsd.org/changeset/base/362156 Log: [net80211] separate out node allocation and node initialisation. This is a new, optional (for now!) method that drivers can use to separate node allocation and node initialisation. Right now they're the same, and drivers that need to do node allocation via firmware commands need to sleep and thus they need to defer node allocation into an internal taskqueue. Right now they're just separate but not deferred. Later on if I get the time we'll start deferring the node and key related operations but that requires making a bunch of other stuff (notably things that generate frames!) also async/deferred. Tested: * RT3593, STA/DWDS mode * AR9380, STA/AP modes * QCA9880 (athp) - STA/AP modes Modified: head/sys/net80211/ieee80211_node.c head/sys/net80211/ieee80211_var.h Modified: head/sys/net80211/ieee80211_node.c == --- head/sys/net80211/ieee80211_node.c Sat Jun 13 21:23:26 2020 (r362155) +++ head/sys/net80211/ieee80211_node.c Sat Jun 13 22:20:02 2020 (r362156) @@ -80,6 +80,7 @@ static int ieee80211_sta_join1(struct ieee80211_node * static struct ieee80211_node *node_alloc(struct ieee80211vap *, const uint8_t [IEEE80211_ADDR_LEN]); +static int node_init(struct ieee80211_node *); static void node_cleanup(struct ieee80211_node *); static void node_free(struct ieee80211_node *); static void node_age(struct ieee80211_node *); @@ -116,6 +117,7 @@ ieee80211_node_attach(struct ieee80211com *ic) ieee80211_node_timeout, ic); ic->ic_node_alloc = node_alloc; + ic->ic_node_init = node_init; ic->ic_node_free = node_free; ic->ic_node_cleanup = node_cleanup; ic->ic_node_age = node_age; @@ -1074,6 +1076,12 @@ node_alloc(struct ieee80211vap *vap, const uint8_t mac return ni; } +static int +node_init(struct ieee80211_node *ni) +{ + return 0; +} + /* * Initialize an ie blob with the specified data. If previous * data exists re-use the data block. As a side effect we clear @@ -1414,6 +1422,15 @@ ieee80211_alloc_node(struct ieee80211_node_table *nt, ni->ni_ic = ic; IEEE80211_NODE_UNLOCK(nt); + /* handle failure; free node state */ + if (ic->ic_node_init(ni) != 0) { + vap->iv_stats.is_rx_nodealloc++; + ieee80211_psq_cleanup(>ni_psq); + ieee80211_ratectl_node_deinit(ni); + _ieee80211_free_node(ni); + return NULL; + } + IEEE80211_NOTE(vap, IEEE80211_MSG_INACT, ni, "%s: inact_reload %u", __func__, ni->ni_inact_reload); @@ -1456,6 +1473,16 @@ ieee80211_tmp_node(struct ieee80211vap *vap, ieee80211_psq_init(>ni_psq, "unknown"); ieee80211_ratectl_node_init(ni); + + /* handle failure; free node state */ + if (ic->ic_node_init(ni) != 0) { + vap->iv_stats.is_rx_nodealloc++; + ieee80211_psq_cleanup(>ni_psq); + ieee80211_ratectl_node_deinit(ni); + _ieee80211_free_node(ni); + return NULL; + } + } else { /* XXX msg */ vap->iv_stats.is_rx_nodealloc++; Modified: head/sys/net80211/ieee80211_var.h == --- head/sys/net80211/ieee80211_var.h Sat Jun 13 21:23:26 2020 (r362155) +++ head/sys/net80211/ieee80211_var.h Sat Jun 13 22:20:02 2020 (r362156) @@ -310,11 +310,22 @@ struct ieee80211com { /* TDMA update notification */ void(*ic_tdma_update)(struct ieee80211_node *, const struct ieee80211_tdma_param *, int); - /* node state management */ + + /* Node state management */ + + /* Allocate a new node */ struct ieee80211_node* (*ic_node_alloc)(struct ieee80211vap *, const uint8_t [IEEE80211_ADDR_LEN]); + + /* Driver node initialisation after net80211 setup */ + int (*ic_node_init)(struct ieee80211_node *); + + /* Driver node deallocation */ void(*ic_node_free)(struct ieee80211_node *); + + /* Driver node state cleanup before deallocation */ void(*ic_node_cleanup)(struct ieee80211_node *); + void(*ic_node_age)(struct ieee80211_node *); void(*ic_node_drain)(struct ieee80211_node *); int8_t (*ic_node_getrssi)(const struct ieee80211_node*); ___ svn-src-all@freebsd.org mailing list
svn commit: r362155 - head/sys/netinet
Author: tuexen Date: Sat Jun 13 21:23:26 2020 New Revision: 362155 URL: https://svnweb.freebsd.org/changeset/base/362155 Log: Remove usage of empty macro. MFC after:1 week Modified: head/sys/netinet/sctp_os_bsd.h head/sys/netinet/sctp_pcb.c Modified: head/sys/netinet/sctp_os_bsd.h == --- head/sys/netinet/sctp_os_bsd.h Sat Jun 13 20:54:18 2020 (r362154) +++ head/sys/netinet/sctp_os_bsd.h Sat Jun 13 21:23:26 2020 (r362155) @@ -312,11 +312,6 @@ typedef struct callout sctp_os_timer_t; #define SCTP_GATHER_MTU_FROM_ROUTE(sctp_ifa, sa, nh) ((uint32_t)((nh != NULL) ? nh->nh_mtu : 0)) #define SCTP_GATHER_MTU_FROM_INTFC(sctp_ifn) ((sctp_ifn->ifn_p != NULL) ? ((struct ifnet *)(sctp_ifn->ifn_p))->if_mtu : 0) -/* (de-)register interface event notifications */ -#define SCTP_REGISTER_INTERFACE(ifhandle, af) -#define SCTP_DEREGISTER_INTERFACE(ifhandle, af) - - /*/ /* These are for logging */ /*/ Modified: head/sys/netinet/sctp_pcb.c == --- head/sys/netinet/sctp_pcb.c Sat Jun 13 20:54:18 2020(r362154) +++ head/sys/netinet/sctp_pcb.c Sat Jun 13 21:23:26 2020(r362155) @@ -301,8 +301,6 @@ sctp_delete_ifn(struct sctp_ifn *sctp_ifnp, int hold_a SCTP_IPI_ADDR_WLOCK(); LIST_REMOVE(sctp_ifnp, next_bucket); LIST_REMOVE(sctp_ifnp, next_ifn); - SCTP_DEREGISTER_INTERFACE(sctp_ifnp->ifn_index, - sctp_ifnp->registered_af); if (hold_addr_lock == 0) SCTP_IPI_ADDR_WUNLOCK(); /* Take away the reference, and possibly free it */ @@ -430,7 +428,6 @@ sctp_add_ifa_to_ifn(struct sctp_ifn *sctp_ifnp, struct } if (sctp_ifnp->ifa_count == 1) { /* register the new interface */ - SCTP_REGISTER_INTERFACE(sctp_ifnp->ifn_index, ifa_af); sctp_ifnp->registered_af = ifa_af; } } @@ -471,13 +468,9 @@ sctp_remove_ifa_from_ifn(struct sctp_ifa *sctp_ifap) /* re-register address family type, if needed */ if ((sctp_ifap->ifn_p->num_v6 == 0) && (sctp_ifap->ifn_p->registered_af == AF_INET6)) { - SCTP_DEREGISTER_INTERFACE(sctp_ifap->ifn_p->ifn_index, AF_INET6); - SCTP_REGISTER_INTERFACE(sctp_ifap->ifn_p->ifn_index, AF_INET); sctp_ifap->ifn_p->registered_af = AF_INET; } else if ((sctp_ifap->ifn_p->num_v4 == 0) && (sctp_ifap->ifn_p->registered_af == AF_INET)) { - SCTP_DEREGISTER_INTERFACE(sctp_ifap->ifn_p->ifn_index, AF_INET); - SCTP_REGISTER_INTERFACE(sctp_ifap->ifn_p->ifn_index, AF_INET6); sctp_ifap->ifn_p->registered_af = AF_INET6; } /* free the ifn refcount */ @@ -678,7 +671,6 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint3 vrf->total_ifa_count++; atomic_add_int(_BASE_INFO(ipi_count_ifas), 1); if (new_ifn_af) { - SCTP_REGISTER_INTERFACE(ifn_index, new_ifn_af); sctp_ifnp->registered_af = new_ifn_af; } SCTP_IPI_ADDR_WUNLOCK(); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r362153 - head/sys/netinet
Author: tuexen Date: Sat Jun 13 18:38:59 2020 New Revision: 362153 URL: https://svnweb.freebsd.org/changeset/base/362153 Log: Simpify a condition, no functional change. MFC after:1 week Modified: head/sys/netinet/sctp_input.c Modified: head/sys/netinet/sctp_input.c == --- head/sys/netinet/sctp_input.c Sat Jun 13 18:21:31 2020 (r362152) +++ head/sys/netinet/sctp_input.c Sat Jun 13 18:38:59 2020 (r362153) @@ -5594,9 +5594,8 @@ trigger_send: if (!TAILQ_EMPTY(>asoc.asconf_send_queue) || cnt_ctrl_ready || stcb->asoc.trigger_reset || - ((un_sent) && - (stcb->asoc.peers_rwnd > 0 || - (stcb->asoc.peers_rwnd <= 0 && stcb->asoc.total_flight == 0 { + ((un_sent > 0) && + (stcb->asoc.peers_rwnd > 0 || stcb->asoc.total_flight == 0))) { SCTPDBG(SCTP_DEBUG_INPUT3, "Calling chunk OUTPUT\n"); sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_CONTROL_PROC, SCTP_SO_NOT_LOCKED); SCTPDBG(SCTP_DEBUG_INPUT3, "chunk OUTPUT returns\n"); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r362152 - head/usr.bin/ldd
Author: kib Date: Sat Jun 13 18:21:31 2020 New Revision: 362152 URL: https://svnweb.freebsd.org/changeset/base/362152 Log: Fix ldd for PIE binaries after rtld stopped accepting binaries for dlopen. ldd proclaims ET_DYN objects as shared libraries and tries to dlopen(RTLD_TRACE) them to get dependencies. Since PIE binaries are ET_DYN | DF_1_PIE, refusal to dlopen such binaries breaks ldd. Fix it by reading and parsing dynamic segment looking for DF_FLAG_1 and taking DF_1_PIE into account when deciding between binary and library. Reported by: Dewayne Geraghty Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after:1 week Differential revision:https://reviews.freebsd.org/D25257 Modified: head/usr.bin/ldd/ldd.c Modified: head/usr.bin/ldd/ldd.c == --- head/usr.bin/ldd/ldd.c Sat Jun 13 18:19:42 2020(r362151) +++ head/usr.bin/ldd/ldd.c Sat Jun 13 18:21:31 2020(r362152) @@ -289,10 +289,18 @@ is_executable(const char *fname, int fd, int *is_shlib #endif Elf_Ehdr elf; } hdr; - int n; + Elf_Phdr phdr, dynphdr; + Elf_Dyn *dynp; + void *dyndata; +#if __ELF_WORD_SIZE > 32 && defined(ELF32_SUPPORTED) + Elf32_Phdr phdr32, dynphdr32; + Elf32_Dyn *dynp32; +#endif + int df1pie, dynamic, i, n; *is_shlib = 0; *type = TYPE_UNKNOWN; + df1pie = 0; if ((n = read(fd, , sizeof(hdr))) == -1) { warn("%s: can't read program header", fname); @@ -320,8 +328,6 @@ is_executable(const char *fname, int fd, int *is_shlib if ((size_t)n >= sizeof(hdr.elf32) && IS_ELF(hdr.elf32) && hdr.elf32.e_ident[EI_CLASS] == ELFCLASS32) { /* Handle 32 bit ELF objects */ - Elf32_Phdr phdr; - int dynamic, i; dynamic = 0; *type = TYPE_ELF32; @@ -331,13 +337,14 @@ is_executable(const char *fname, int fd, int *is_shlib return (0); } for (i = 0; i < hdr.elf32.e_phnum; i++) { - if (read(fd, , hdr.elf32.e_phentsize) != - sizeof(phdr)) { + if (read(fd, , hdr.elf32.e_phentsize) != + sizeof(phdr32)) { warnx("%s: can't read program header", fname); return (0); } - if (phdr.p_type == PT_DYNAMIC) { + if (phdr32.p_type == PT_DYNAMIC) { dynamic = 1; + dynphdr32 = phdr32; break; } } @@ -346,9 +353,36 @@ is_executable(const char *fname, int fd, int *is_shlib warnx("%s: not a dynamic ELF executable", fname); return (0); } + if (hdr.elf32.e_type == ET_DYN) { + if (lseek(fd, dynphdr32.p_offset, SEEK_SET) == -1) { + warnx("%s: dynamic segment out of range", + fname); + return (0); + } + dyndata = malloc(dynphdr32.p_filesz); + if (dyndata == NULL) { + warn("malloc"); + return (0); + } + if (read(fd, dyndata, dynphdr32.p_filesz) != + (ssize_t)dynphdr32.p_filesz) { + free(dyndata); + warnx("%s: can't read dynamic segment", fname); + return (0); + } + for (dynp32 = dyndata; dynp32->d_tag != DT_NULL; + dynp32++) { + if (dynp32->d_tag != DT_FLAGS_1) + continue; + df1pie = (dynp32->d_un.d_val & DF_1_PIE) != 0; + break; + } + free(dyndata); + if (hdr.elf32.e_ident[EI_OSABI] == ELFOSABI_FREEBSD) { - *is_shlib = 1; + if (!df1pie) + *is_shlib = 1; return (1); } warnx("%s: not a FreeBSD ELF shared object", fname); @@ -362,8 +396,6 @@ is_executable(const char *fname, int fd, int *is_shlib if ((size_t)n >= sizeof(hdr.elf) && IS_ELF(hdr.elf) && hdr.elf.e_ident[EI_CLASS] == ELF_TARG_CLASS) { /* Handle default ELF objects on this architecture */ - Elf_Phdr
svn commit: r362151 - head/lib/libc/sys
Author: kib Date: Sat Jun 13 18:19:42 2020 New Revision: 362151 URL: https://svnweb.freebsd.org/changeset/base/362151 Log: procctl(2): document PROC_KPTI Reviewed by: bcr Sponsored by: The FreeBSD Foundation MFC after:1 week Differential revision:https://reviews.freebsd.org/D25258 Modified: head/lib/libc/sys/procctl.2 Modified: head/lib/libc/sys/procctl.2 == --- head/lib/libc/sys/procctl.2 Sat Jun 13 18:18:34 2020(r362150) +++ head/lib/libc/sys/procctl.2 Sat Jun 13 18:19:42 2020(r362151) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 16, 2020 +.Dd June 13, 2020 .Dt PROCCTL 2 .Os .Sh NAME @@ -565,6 +565,47 @@ Stack gaps are disabled in the process after .Xr execve 2 . .El .El +.Sh x86 MACHINE-SPECIFIC REQUESTS +.Bl -tag -width PROC_KPTI_STATUS +.It Dv PROC_KPTI_CTL +AMD64 only. +Controls the Kernel Page Table Isolation (KPTI) option for the children +of the specified process. +For the command to work, the +.Va vm.pmap.kpti +tunable must be enabled on boot. +It is not possible to change the KPTI setting for a running process, +except at the +.Xr execve 2 , +where the address space is reinitialized. +.Pp +The +.Fa data +parameter must point to an integer variable containing one of the +following commands: +.Bl -tag -width PROC_KPTI_CTL_DISABLE_ON_EXEC +.It Dv PROC_KPTI_CTL_ENABLE_ON_EXEC +Enable KPTI after +.Xr execve 2 . +.It Dv PROC_KPTI_CTL_DISABLE_ON_EXEC +Disable KPTI after +.Xr execve 2 . +Only root or a process having the +.Va PRIV_IO +privilege might use this option. +.El +.It Dv PROC_KPTI_STATUS +Returns the current KPTI status for the specified process. +.Fa data must point to the integer variable, which returns the +following statuses: +.Bl -tag -width PROC_KPTI_CTL_DISABLE_ON_EXEC +.It Dv PROC_KPTI_CTL_ENABLE_ON_EXEC +.It Dv PROC_KPTI_CTL_DISABLE_ON_EXEC +.El +.Pp +The status is or-ed with the +.Va PROC_KPTI_STATUS_ACTIVE +in case KPTI is active for the current address space of the process. .Sh NOTES Disabling tracing on a process should not be considered a security feature, as it is bypassable both by the kernel and privileged processes, ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r362150 - head/lib/libc/sys
Author: kib Date: Sat Jun 13 18:18:34 2020 New Revision: 362150 URL: https://svnweb.freebsd.org/changeset/base/362150 Log: procctl(2): consistently refer to the data pointer as 'data'. Reviewed by: bcr Sponsored by: The FreeBSD Foundation MFC after:1 week Differential revision:https://reviews.freebsd.org/D25258 Modified: head/lib/libc/sys/procctl.2 Modified: head/lib/libc/sys/procctl.2 == --- head/lib/libc/sys/procctl.2 Sat Jun 13 17:36:08 2020(r362149) +++ head/lib/libc/sys/procctl.2 Sat Jun 13 18:18:34 2020(r362150) @@ -40,7 +40,7 @@ .Sh SYNOPSIS .In sys/procctl.h .Ft int -.Fn procctl "idtype_t idtype" "id_t id" "int cmd" "void *arg" +.Fn procctl "idtype_t idtype" "id_t id" "int cmd" "void *data" .Sh DESCRIPTION The .Fn procctl @@ -80,7 +80,7 @@ by in the specified process or its descendants that did not changed the control nor modified it by other means. The -.Va arg +.Fa data parameter must point to the integer variable holding one of the following values: .Bl -tag -width PROC_ASLR_FORCE_DISABLE @@ -99,7 +99,7 @@ Use the system-wide configured policy for ASLR. .It Dv PROC_ASLR_STATUS Returns the current status of ASLR enablement for the target process. The -.Va arg +.Fa data parameter must point to the integer variable, where one of the following values is written: .Bl -tag -width PROC_ASLR_FORCE_DISABLE @@ -119,7 +119,7 @@ argument of the .Xr mmap 2 syscall, in the target process. The -.Va arg +.Fa data parameter must point to the integer variable holding one of the following values: .Bl -tag -width PROC_PROTMAX_FORCE_DISABLE @@ -140,7 +140,7 @@ Use the system-wide configured policy for PROT_MAX. Returns the current status of implicit PROT_MAX enablement for the target process. The -.Va arg +.Fa data parameter must point to the integer variable, where one of the following values is written: .Bl -tag -width PROC_PROTMAX_FORCE_DISABLE @@ -158,7 +158,7 @@ Set process protection state. This is used to mark a process as protected from being killed if the system exhausts the available memory and swap. The -.Fa arg +.Fa data parameter must point to an integer containing an operation and zero or more optional flags. The following operations are supported: ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
DR for r362149
On r362149 I forgot to reference the review: https://reviews.freebsd.org/D25240 Sorry for that. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r362149 - head/usr.bin/sockstat
Author: fernape (ports committer) Date: Sat Jun 13 17:36:08 2020 New Revision: 362149 URL: https://svnweb.freebsd.org/changeset/base/362149 Log: sockstat(1): Add EXAMPLES to man page Add three examples showing the use of -4, -6, -l, -L, -p and -P Reviewed by: gbe@ Approved by: bcr@ Modified: head/usr.bin/sockstat/sockstat.1 Modified: head/usr.bin/sockstat/sockstat.1 == --- head/usr.bin/sockstat/sockstat.1Sat Jun 13 14:11:02 2020 (r362148) +++ head/usr.bin/sockstat/sockstat.1Sat Jun 13 17:36:08 2020 (r362149) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 3, 2018 +.Dd June 13, 2020 .Dt SOCKSTAT 1 .Os .Sh NAME @@ -177,6 +177,23 @@ If a socket is associated with more than one file desc it is shown multiple times. If a socket is not associated with any file descriptor, the first four columns have no meaning. +.Sh EXAMPLES +Show information for IPv4 sockets listening on port 22 using protocol +TCP: +.Bd -literal -offset indent +$ sockstat -4 -l -P tcp -p 22 +.Ed +.Pp +Show information for sockets using either TCP or UDP, if neither, the local nor +the foreign addresses are in the loopback network: +.Bd -literal -offset indent +$ sockstat -L -P tcp,udp +.Ed +.Pp +Show TCP IPv6 sockets which are listening and connected (default): +.Bd -literal -offset indent +$ sockstat -6 -P tcp +.Ed .Sh SEE ALSO .Xr fstat 1 , .Xr netstat 1 , ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r362148 - head/contrib/nvi/common
Author: yuripv Date: Sat Jun 13 14:11:02 2020 New Revision: 362148 URL: https://svnweb.freebsd.org/changeset/base/362148 Log: nvi: fallback to ISO8859-1 as last resort Current logic of using user's locale encoding that is UTF-8 doesn't make much sense if we already failed the looks_utf8() check and skipped encoding set using "fileencoding" as being UTF-8 as well; fallback to ISO8859-1 in that case. Reviewed by: Zhihao Yuan Differential Revision:https://reviews.freebsd.org/D24919 Modified: head/contrib/nvi/common/exf.c Modified: head/contrib/nvi/common/exf.c == --- head/contrib/nvi/common/exf.c Sat Jun 13 09:16:07 2020 (r362147) +++ head/contrib/nvi/common/exf.c Sat Jun 13 14:11:02 2020 (r362148) @@ -1237,7 +1237,10 @@ file_encinit(SCR *sp) } /* -* Detect UTF-8 and fallback to the locale/preset encoding. +* 1. Check for valid UTF-8. +* 2. Check if fallback fileencoding is set and is NOT UTF-8. +* 3. Check if user locale's encoding is NOT UTF-8. +* 4. Use ISO8859-1 as last resort. * * XXX * A manually set O_FILEENCODING indicates the "fallback @@ -1246,9 +1249,13 @@ file_encinit(SCR *sp) */ if (looks_utf8(buf, blen) > 1) o_set(sp, O_FILEENCODING, OS_STRDUP, "utf-8", 0); - else if (!O_ISSET(sp, O_FILEENCODING) || - !strcasecmp(O_STR(sp, O_FILEENCODING), "utf-8")) + else if (O_ISSET(sp, O_FILEENCODING) && + strcasecmp(O_STR(sp, O_FILEENCODING), "utf-8") != 0) + /* Use fileencoding as is */ ; + else if (strcasecmp(codeset(), "utf-8") != 0) o_set(sp, O_FILEENCODING, OS_STRDUP, codeset(), 0); + else + o_set(sp, O_FILEENCODING, OS_STRDUP, "iso8859-1", 0); conv_enc(sp, O_FILEENCODING, 0); #endif ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r362147 - head/usr.bin/awk
Author: yuripv Date: Sat Jun 13 09:16:07 2020 New Revision: 362147 URL: https://svnweb.freebsd.org/changeset/base/362147 Log: awk(1): use -version instead of -V -V is OpenBSD specific, use -version instead. While here, fix issue reported by mandoc lint and drop nonexistent script(7) reference. PR: 247004 Reviewed by: 0mp, markj Differential Revision:https://reviews.freebsd.org/D25164 Modified: head/usr.bin/awk/awk.1 Modified: head/usr.bin/awk/awk.1 == --- head/usr.bin/awk/awk.1 Sat Jun 13 08:37:24 2020(r362146) +++ head/usr.bin/awk/awk.1 Sat Jun 13 09:16:07 2020(r362147) @@ -23,7 +23,7 @@ .\" THIS SOFTWARE. .\" .\"$FreeBSD$ -.Dd $Mdocdate: September 14 2015 $ +.Dd $Mdocdate: June 6 2020 $ .Dt AWK 1 .Os .Sh NAME @@ -32,7 +32,7 @@ .Sh SYNOPSIS .Nm awk .Op Fl safe -.Op Fl V +.Op Fl version .Op Fl d Ns Op Ar n .Op Fl F Ar fs .Op Fl v Ar var Ns = Ns Ar value @@ -101,7 +101,7 @@ approximation to a .Dq safe version of .Nm . -.It Fl V +.It Fl version Print the version number of .Nm to standard output and exit. @@ -265,7 +265,7 @@ and concatenation .Pq indicated by whitespace . The operators .Ic \&! ++ \-\- += \-= *= /= %= ^= -.Ic > >= < <= == != ?: +.Ic > >= < <= == != ?\&: are also available in expressions. Variables may be scalars, array elements (denoted @@ -752,8 +752,7 @@ Print an error message to standard error: .Xr lex 1 , .Xr printf 1 , .Xr sed 1 , -.Xr re_format 7 , -.Xr script 7 +.Xr re_format 7 .Rs .%A A. V. Aho .%A B. W. Kernighan @@ -774,9 +773,10 @@ except does not support {n,m} pattern matching. .Pp The flags -.Op Fl \ +.Fl d , +.Fl safe , and -.Op Fl safe , +.Fl version as well as the commands .Cm fflush , compl , and , or , .Cm xor , lshift , rshift , ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r362146 - in head/usr.bin/locale: . tests
Author: yuripv Date: Sat Jun 13 08:37:24 2020 New Revision: 362146 URL: https://svnweb.freebsd.org/changeset/base/362146 Log: locale: exit 1 if unknown keyword was specified PR: 241906 Submitted by: Akos Somfai Modified: head/usr.bin/locale/locale.c head/usr.bin/locale/tests/locale_test.sh Modified: head/usr.bin/locale/locale.c == --- head/usr.bin/locale/locale.cSat Jun 13 04:47:59 2020 (r362145) +++ head/usr.bin/locale/locale.cSat Jun 13 08:37:24 2020 (r362146) @@ -61,7 +61,7 @@ void list_locales(void); const char *lookup_localecat(int); char *kwval_lconv(int); intkwval_lookup(const char *, char **, int *, int *, int *); -void showdetails(const char *); +intshowdetails(const char *); void showkeywordslist(char *substring); void showlocale(void); void usage(void); @@ -414,7 +414,8 @@ main(int argc, char *argv[]) setlocale(LC_ALL, ""); if (argc > 0) { while (argc > 0) { - showdetails(*argv); + if (showdetails(*argv) != 0) + exit(EXIT_FAILURE); argv++; argc--; } @@ -837,19 +838,16 @@ kwval_lookup(const char *kwname, char **kwval, int *ca * Show details about requested keyword according to '-k' and/or '-c' * command line options specified. */ -void +int showdetails(const char *kw) { int type, cat, tmpval, alloc; char*kwval; if (kwval_lookup(kw, , , , ) == 0) { - /* -* invalid keyword specified. -* XXX: any actions? -*/ + /* Invalid keyword specified */ fprintf(stderr, "Unknown keyword: `%s'\n", kw); - return; + return (1); } if (prt_categories) { @@ -889,6 +887,8 @@ showdetails(const char *kw) if (alloc) free(kwval); + + return (0); } /* Modified: head/usr.bin/locale/tests/locale_test.sh == --- head/usr.bin/locale/tests/locale_test.shSat Jun 13 04:47:59 2020 (r362145) +++ head/usr.bin/locale/tests/locale_test.shSat Jun 13 08:37:24 2020 (r362146) @@ -160,8 +160,24 @@ no_flags_posix_body() noexpr } +atf_test_case k_flag_unknown_kw +k_flag_unknown_kw_head() +{ + atf_set "descr" \ + "Verify 'locale -k' exit status is '1' for unknown keywords" +} +k_flag_unknown_kw_body() +{ + export LC_ALL="C" + + # Hopefully the keyword will stay nonexistent + atf_check -s exit:1 -o empty -e ignore locale -k nonexistent +} + + atf_init_test_cases() { atf_add_test_case k_flag_posix atf_add_test_case no_flags_posix + atf_add_test_case k_flag_unknown_kw } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"