svn commit: r363297 - head/sys/kern
Author: mjg Date: Sat Jul 18 00:14:43 2020 New Revision: 363297 URL: https://svnweb.freebsd.org/changeset/base/363297 Log: Short-circuit tdfind when looking for the calling thread. Common occurence with cpuset and other places. Modified: head/sys/kern/kern_thread.c Modified: head/sys/kern/kern_thread.c == --- head/sys/kern/kern_thread.c Fri Jul 17 23:10:35 2020(r363296) +++ head/sys/kern/kern_thread.c Sat Jul 18 00:14:43 2020(r363297) @@ -1299,6 +1299,14 @@ tdfind(lwpid_t tid, pid_t pid) struct thread *td; int run = 0; + td = curthread; + if (td->td_tid == tid) { + if (pid != -1 && td->td_proc->p_pid != pid) + return (NULL); + PROC_LOCK(td->td_proc); + return (td); + } + rw_rlock(_lock); LIST_FOREACH(td, TIDHASH(tid), td_hash) { if (td->td_tid == tid) { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363296 - head/sys/vm
Author: chs Date: Fri Jul 17 23:10:35 2020 New Revision: 363296 URL: https://svnweb.freebsd.org/changeset/base/363296 Log: Fix vnode_pager handling of read ahead/behind pages when a disk read fails. Rather than marking the read ahead/behind pages valid even though they were not initialized, free them using the new function vm_page_free_invalid(). Reviewed by: markj, kib Sponsored by: Netflix Differential Revision:https://reviews.freebsd.org/D25430 Modified: head/sys/vm/vnode_pager.c Modified: head/sys/vm/vnode_pager.c == --- head/sys/vm/vnode_pager.c Fri Jul 17 23:09:36 2020(r363295) +++ head/sys/vm/vnode_pager.c Fri Jul 17 23:10:35 2020(r363296) @@ -1139,6 +1139,21 @@ vnode_pager_generic_getpages_done(struct buf *bp) bp->b_data = unmapped_buf; } + /* +* If the read failed, we must free any read ahead/behind pages here. +* The requested pages are freed by the caller (for sync requests) +* or by the bp->b_pgiodone callback (for async requests). +*/ + if (error != 0) { + VM_OBJECT_WLOCK(object); + for (i = 0; i < bp->b_pgbefore; i++) + vm_page_free_invalid(bp->b_pages[i]); + for (i = bp->b_npages - bp->b_pgafter; i < bp->b_npages; i++) + vm_page_free_invalid(bp->b_pages[i]); + VM_OBJECT_WUNLOCK(object); + return (error); + } + /* Read lock to protect size. */ VM_OBJECT_RLOCK(object); for (i = 0, tfoff = IDX_TO_OFF(bp->b_pages[0]->pindex); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363295 - head/sys/vm
Author: chs Date: Fri Jul 17 23:09:36 2020 New Revision: 363295 URL: https://svnweb.freebsd.org/changeset/base/363295 Log: Add a new function vm_page_free_invalid() for freeing invalid pages that might be wired. If the page is wired then it cannot be freed now, but the thread that eventually unwires it will free it at that point. Reviewed by: markj, kib Sponsored by: Netflix Differential Revision:https://reviews.freebsd.org/D25430 Modified: head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/sys/vm/vm_page.c == --- head/sys/vm/vm_page.c Fri Jul 17 23:08:01 2020(r363294) +++ head/sys/vm/vm_page.c Fri Jul 17 23:09:36 2020(r363295) @@ -1362,6 +1362,31 @@ vm_page_readahead_finish(vm_page_t m) } /* + * Destroy the identity of an invalid page and free it if possible. + * This is intended to be used when reading a page from backing store fails. + */ +void +vm_page_free_invalid(vm_page_t m) +{ + + KASSERT(vm_page_none_valid(m), ("page %p is valid", m)); + KASSERT(!pmap_page_is_mapped(m), ("page %p is mapped", m)); + vm_page_assert_xbusied(m); + KASSERT(m->object != NULL, ("page %p has no object", m)); + VM_OBJECT_ASSERT_WLOCKED(m->object); + + /* +* If someone has wired this page while the object lock +* was not held, then the thread that unwires is responsible +* for freeing the page. Otherwise just free the page now. +* The wire count of this unmapped page cannot change while +* we have the page xbusy and the page's object wlocked. +*/ + if (vm_page_remove(m)) + vm_page_free(m); +} + +/* * vm_page_sleep_if_busy: * * Sleep and release the object lock if the page is busied. Modified: head/sys/vm/vm_page.h == --- head/sys/vm/vm_page.h Fri Jul 17 23:08:01 2020(r363294) +++ head/sys/vm/vm_page.h Fri Jul 17 23:09:36 2020(r363295) @@ -629,6 +629,7 @@ void vm_page_deactivate_noreuse(vm_page_t); void vm_page_dequeue(vm_page_t m); void vm_page_dequeue_deferred(vm_page_t m); vm_page_t vm_page_find_least(vm_object_t, vm_pindex_t); +void vm_page_free_invalid(vm_page_t); vm_page_t vm_page_getfake(vm_paddr_t paddr, vm_memattr_t memattr); void vm_page_initfake(vm_page_t m, vm_paddr_t paddr, vm_memattr_t memattr); int vm_page_insert (vm_page_t, vm_object_t, vm_pindex_t); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363294 - head/sys/vm
Author: chs Date: Fri Jul 17 23:08:01 2020 New Revision: 363294 URL: https://svnweb.freebsd.org/changeset/base/363294 Log: Revert my change from r361855 in favor of a better fix. Reviewed by: markj, kib Sponsored by: Netflix Differential Revision:https://reviews.freebsd.org/D25430 Modified: head/sys/vm/vnode_pager.c Modified: head/sys/vm/vnode_pager.c == --- head/sys/vm/vnode_pager.c Fri Jul 17 22:54:39 2020(r363293) +++ head/sys/vm/vnode_pager.c Fri Jul 17 23:08:01 2020(r363294) @@ -1150,30 +1150,28 @@ vnode_pager_generic_getpages_done(struct buf *bp) if (mt == bogus_page) continue; - if (error == 0) { - if (nextoff <= object->un_pager.vnp.vnp_size) { - /* -* Read filled up entire page. -*/ - vm_page_valid(mt); - KASSERT(mt->dirty == 0, - ("%s: page %p is dirty", __func__, mt)); - KASSERT(!pmap_page_is_mapped(mt), - ("%s: page %p is mapped", __func__, mt)); - } else { - /* -* Read did not fill up entire page. -* -* Currently we do not set the entire page -* valid, we just try to clear the piece that -* we couldn't read. -*/ - vm_page_set_valid_range(mt, 0, - object->un_pager.vnp.vnp_size - tfoff); - KASSERT((mt->dirty & vm_page_bits(0, - object->un_pager.vnp.vnp_size - tfoff)) == - 0, ("%s: page %p is dirty", __func__, mt)); - } + if (nextoff <= object->un_pager.vnp.vnp_size) { + /* +* Read filled up entire page. +*/ + vm_page_valid(mt); + KASSERT(mt->dirty == 0, + ("%s: page %p is dirty", __func__, mt)); + KASSERT(!pmap_page_is_mapped(mt), + ("%s: page %p is mapped", __func__, mt)); + } else { + /* +* Read did not fill up entire page. +* +* Currently we do not set the entire page valid, +* we just try to clear the piece that we couldn't +* read. +*/ + vm_page_set_valid_range(mt, 0, + object->un_pager.vnp.vnp_size - tfoff); + KASSERT((mt->dirty & vm_page_bits(0, + object->un_pager.vnp.vnp_size - tfoff)) == 0, + ("%s: page %p is dirty", __func__, mt)); } if (i < bp->b_pgbefore || i >= bp->b_npages - bp->b_pgafter) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363291 - in head: . share/man/man9
Author: gbe (doc committer) Date: Fri Jul 17 22:15:02 2020 New Revision: 363291 URL: https://svnweb.freebsd.org/changeset/base/363291 Log: devstat(9): Update the man page to reflect the current implementation - Rename devstat_add_entry to devstat_new_entry - Update the description of devstat_trans_flags - Add manpage aliases for devstat_start_transaction_bio and devstat_end_transaction_bio PR: 157316 Submitted by: novel Reviewed by: cem, bcr (mentor) Approved by: bcr (mentor) MFC after:1 week Differential Revision:https://reviews.freebsd.org/D25677 Modified: head/ObsoleteFiles.inc head/share/man/man9/Makefile head/share/man/man9/devstat.9 Modified: head/ObsoleteFiles.inc == --- head/ObsoleteFiles.inc Fri Jul 17 22:07:19 2020(r363290) +++ head/ObsoleteFiles.inc Fri Jul 17 22:15:02 2020(r363291) @@ -36,6 +36,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20200715: rework of devstat(9) man page +OLD_FILES+=usr/share/man/man9/devstat_add_entry.9.gz + # 20200714: update byacc to 20200330 OLD_FILES+=usr/tests/usr.bin/yacc/btyacc_calc1.y OLD_FILES+=usr/tests/usr.bin/yacc/btyacc_demo.y Modified: head/share/man/man9/Makefile == --- head/share/man/man9/MakefileFri Jul 17 22:07:19 2020 (r363290) +++ head/share/man/man9/MakefileFri Jul 17 22:15:02 2020 (r363291) @@ -968,10 +968,12 @@ MLINKS+=device_set_desc.9 device_get_desc.9 \ device_set_desc.9 device_set_desc_copy.9 MLINKS+=device_set_flags.9 device_get_flags.9 MLINKS+=devstat.9 devicestat.9 \ - devstat.9 devstat_add_entry.9 \ + devstat.9 devstat_new_entry.9 \ devstat.9 devstat_end_transaction.9 \ + devstat.9 devstat_end_transaction_bio.9 \ devstat.9 devstat_remove_entry.9 \ - devstat.9 devstat_start_transaction.9 + devstat.9 devstat_start_transaction.9 \ + devstat.9 devstat_start_transaction_bio.9 MLINKS+=disk.9 disk_add_alias.9 \ disk.9 disk_alloc.9 \ disk.9 disk_create.9 \ Modified: head/share/man/man9/devstat.9 == --- head/share/man/man9/devstat.9 Fri Jul 17 22:07:19 2020 (r363290) +++ head/share/man/man9/devstat.9 Fri Jul 17 22:15:02 2020 (r363291) @@ -27,25 +27,24 @@ .\" .\" $FreeBSD$ .\" -.Dd August 22, 2018 +.Dd July 15, 2020 .Dt DEVSTAT 9 .Os .Sh NAME .Nm devstat , -.Nm devstat_add_entry , .Nm devstat_end_transaction , .Nm devstat_end_transaction_bio , .Nm devstat_end_transaction_bio_bt , +.Nm devstat_new_entry , .Nm devstat_remove_entry , .Nm devstat_start_transaction , .Nm devstat_start_transaction_bio .Nd kernel interface for keeping device statistics .Sh SYNOPSIS .In sys/devicestat.h -.Ft void -.Fo devstat_add_entry -.Fa "struct devstat *ds" -.Fa "const char *dev_name" +.Ft struct devstat * +.Fo devstat_new_entry +.Fa "const void *dev_name" .Fa "int unit_number" .Fa "uint32_t block_size" .Fa "devstat_support_flags flags" @@ -78,7 +77,6 @@ .Fa "struct devstat *ds" .Fa "const struct bio *bp" .Fc -.Fc .Ft void .Fo devstat_end_transaction_bio_bt .Fa "struct devstat *ds" @@ -103,19 +101,13 @@ for most disk-like drivers in the 2000s and beyond. New consumers of the interface should almost certainly use only the "bio" variants of the start and end transacation routines. .Pp -.Fn devstat_add_entry -registers a device with the -.Nm -subsystem. -The caller is expected to have already allocated \fBand zeroed\fR -the devstat structure before calling this function. -.Fn devstat_add_entry +.Fn devstat_new_entry +allocates and initializes +.Va devstat +structure and returns a pointer to it. +.Fn devstat_new_entry takes several arguments: .Bl -tag -width device_type -.It ds -The -.Va devstat -structure, allocated and zeroed by the client. .It dev_name The device name, e.g., da, cd, sa. .It unit_number @@ -386,6 +378,8 @@ to insert a device in the list. The second parameter is attach order. See below for a list of available priorities. +.It id +Identification for GEOM nodes. .El .Pp Each device is given a device type. @@ -478,7 +472,18 @@ typedef enum { DEVSTAT_WRITE = 0x02, DEVSTAT_FREE= 0x03 } devstat_trans_flags; +#define DEVSTAT_N_TRANS_FLAGS 4 .Ed +.Pp +DEVSTAT_NO_DATA is a type of transactions to the device which are neither +reads or writes. +For instance, +.Tn SCSI +drivers often send a test unit ready command to +.Tn SCSI +devices. +The test unit ready command does not read or write any data. +It merely causes the device to return its status. .Pp There are four possible values for the .Va tag_type ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To
svn commit: r363288 - head/sbin/mount_nfs
Author: gbe (doc committer) Date: Fri Jul 17 21:55:24 2020 New Revision: 363288 URL: https://svnweb.freebsd.org/changeset/base/363288 Log: mount_nfs(8): document alternate form of the gssname option PR: 238506 Submitted by: Greg Veldman Reviewed by: 0mp, bcr (mentor) Approved by: bcr (mentor) MFC after:1 week Differential Revision:https://reviews.freebsd.org/D25667 Modified: head/sbin/mount_nfs/mount_nfs.8 Modified: head/sbin/mount_nfs/mount_nfs.8 == --- head/sbin/mount_nfs/mount_nfs.8 Fri Jul 17 21:47:06 2020 (r363287) +++ head/sbin/mount_nfs/mount_nfs.8 Fri Jul 17 21:55:24 2020 (r363288) @@ -159,7 +159,16 @@ should be specified without instance or domain and is .Dq "host" , .Dq "nfs" or -.Dq "root" . +.Dq "root" , +although the form +.Sm off +.Aq Ar service +@ +.Aq Ar fqdn +.Sm on +can also be used if the local system's +.Xr gethostname 3 +value does not match the host-based principal in the keytab. .It Cm hard Same as not specifying .Cm soft . ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363287 - head/share/man/man4
Author: gbe (doc committer) Date: Fri Jul 17 21:47:06 2020 New Revision: 363287 URL: https://svnweb.freebsd.org/changeset/base/363287 Log: iwm(4): Document limitations of the driver Document that iwm(4) currently doesn't support 802.11n and 802.11ac. PR: 247874 Submitted by: Charles Ross Reviewed by: brueffer, markj Approved by: brueffer MFC after:1 week Differential Revision:https://reviews.freebsd.org/D25666 Modified: head/share/man/man4/iwm.4 Modified: head/share/man/man4/iwm.4 == --- head/share/man/man4/iwm.4 Fri Jul 17 20:43:00 2020(r363286) +++ head/share/man/man4/iwm.4 Fri Jul 17 21:47:06 2020(r363287) @@ -106,6 +106,12 @@ For more information on configuring this device, see This driver requires the firmware built with the .Nm iwmfw module to work. +.Pp +Currently, +.Nm +only supports 802.11b and 802.11g modes. +It will not associate to access points that are configured to operate only +in 802.11n or 802.11ac modes. .Sh EXAMPLES Join an existing BSS network (i.e., connect to an access point): .Bd -literal -offset indent ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363286 - head/usr.bin/at
Author: allanjude Date: Fri Jul 17 20:43:00 2020 New Revision: 363286 URL: https://svnweb.freebsd.org/changeset/base/363286 Log: at(1): Fix location of at(1) crontab With r318443, atrun was moved from /etc/crontab to /etc/cron.d/at, but the man-page was unfortunately not updated to reflect this. PR: 248048 Submitted by: debdrup Reported by: yoitsmeremember+fbsd at gmail.com Reviewed by: Pau Amma Sponsored by: Klara Inc. Differential Revision:https://reviews.freebsd.org/D25709 Modified: head/usr.bin/at/at.man Modified: head/usr.bin/at/at.man == --- head/usr.bin/at/at.man Fri Jul 17 19:07:59 2020(r363285) +++ head/usr.bin/at/at.man Fri Jul 17 20:43:00 2020(r363286) @@ -213,9 +213,10 @@ every five minutes. This implies that the granularity of .Nm might not be optimal for every deployment. -If a finer granularity is needed, the system crontab at -.Pa /etc/crontab -needs to be changed. +If a finer granularity is desired, the +.Pa /etc/cron.d/at +file can be edited and will be read by the system crontab, from which +the SHELL and PATH environment variables are inherited. .Sh OPTIONS .Bl -tag -width indent .It Fl q Ar queue ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363285 - head/sys/contrib/ipfilter/netinet
Author: cy Date: Fri Jul 17 19:07:59 2020 New Revision: 363285 URL: https://svnweb.freebsd.org/changeset/base/363285 Log: Fix incorrect byte order in ipfstat -f output. - make sure frag is initialized to 0 - initialize ipfr_p field NetBSD PR:55137 Submitted by: chris...@netbsd.org Reported by: chris...@netbsd.org Obtained from:NetBSD fil.c r1.32, ip_frag.c r1.8 MFC after:2 weeks Modified: head/sys/contrib/ipfilter/netinet/fil.c head/sys/contrib/ipfilter/netinet/ip_frag.c Modified: head/sys/contrib/ipfilter/netinet/fil.c == --- head/sys/contrib/ipfilter/netinet/fil.c Fri Jul 17 19:07:56 2020 (r363284) +++ head/sys/contrib/ipfilter/netinet/fil.c Fri Jul 17 19:07:59 2020 (r363285) @@ -1698,7 +1698,7 @@ ipf_pr_ipv4hdr(fin) fi->fi_p = p; fin->fin_crc = p; fi->fi_tos = ip->ip_tos; - fin->fin_id = ip->ip_id; + fin->fin_id = ntohs(ip->ip_id); off = ntohs(ip->ip_off); /* Get both TTL and protocol */ Modified: head/sys/contrib/ipfilter/netinet/ip_frag.c == --- head/sys/contrib/ipfilter/netinet/ip_frag.c Fri Jul 17 19:07:56 2020 (r363284) +++ head/sys/contrib/ipfilter/netinet/ip_frag.c Fri Jul 17 19:07:59 2020 (r363285) @@ -404,6 +404,7 @@ ipfr_frag_new(softc, softf, fin, pass, table } } + memset(, 0, sizeof(frag)); frag.ipfr_v = fin->fin_v; idx = fin->fin_v; frag.ipfr_p = fin->fin_p; @@ -452,6 +453,7 @@ ipfr_frag_new(softc, softf, fin, pass, table FBUMPD(ifs_nomem); return NULL; } + memset(fran, 0, sizeof(*fran)); WRITE_ENTER(lock); @@ -489,6 +491,7 @@ ipfr_frag_new(softc, softf, fin, pass, table table[idx] = fra; bcopy((char *)_ifp, (char *)>ipfr_ifp, IPFR_CMPSZ); fra->ipfr_v = fin->fin_v; + fra->ipfr_p = fin->fin_p; fra->ipfr_ttl = softc->ipf_ticks + softf->ipfr_ttl; fra->ipfr_firstend = frag.ipfr_firstend; @@ -677,6 +680,7 @@ ipf_frag_lookup(softc, softf, fin, table * * build up a hash value to index the table with. */ + memset(, 0, sizeof(frag)); frag.ipfr_v = fin->fin_v; idx = fin->fin_v; frag.ipfr_p = fin->fin_p; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363279 - in head/contrib/ipfilter: man tools
Author: cy Date: Fri Jul 17 19:07:40 2020 New Revision: 363279 URL: https://svnweb.freebsd.org/changeset/base/363279 Log: Historically ipfstat listings and stats only listed IPv4 or IPv6 output. ipfstat would list IPv4 outputs by default while -6 would produce IPv6 outputs. This commit combines the ipfstat -i and -o outputs into one listing of IPv4 and IPv6 rules. The -4 option lists only IPv4 rules (as the default before) while -6 continues to list only rules that affect IPv6. PR: 247952 Reported by: jo...@a1poweruser.com MFC after:1 week Modified: head/contrib/ipfilter/man/ipfstat.8 head/contrib/ipfilter/tools/ipfstat.c Modified: head/contrib/ipfilter/man/ipfstat.8 == --- head/contrib/ipfilter/man/ipfstat.8 Fri Jul 17 19:07:37 2020 (r363278) +++ head/contrib/ipfilter/man/ipfstat.8 Fri Jul 17 19:07:40 2020 (r363279) @@ -5,7 +5,7 @@ ipfstat \- reports on packet filter statistics and fil .SH SYNOPSIS .B ipfstat [ -.B \-6aAdfghIilnoRsv +.B \-46aAdfghIilnoRsv ] .br .B ipfstat -t @@ -35,6 +35,11 @@ is to retrieve and display the accumulated statistics accumulated over time as the kernel has put packets through the filter. .SH OPTIONS .TP +.B \-4 +Display filter lists and states for IPv4, if available. This is the default +when displaying states. \fB-4\fP and \fB-6\fP is the default when +displaying lists. +.TP .B \-6 Display filter lists and states for IPv6, if available. .TP @@ -190,4 +195,4 @@ more entries is to resize the screen. .SH SEE ALSO ipf(8) .SH BUGS -none known. +\fB-4\fP and \fB-6\fP should also be the default when displaying states. Modified: head/contrib/ipfilter/tools/ipfstat.c == --- head/contrib/ipfilter/tools/ipfstat.c Fri Jul 17 19:07:37 2020 (r363278) +++ head/contrib/ipfilter/tools/ipfstat.c Fri Jul 17 19:07:40 2020 (r363279) @@ -58,6 +58,7 @@ staticwordtab_t *state_fields = NULL; intnohdrfields = 0; intopts = 0; #ifdef USE_INET6 +intuse_inet4 = 0; intuse_inet6 = 0; #endif intlive_kernel = 1; @@ -165,15 +166,15 @@ static void usage(name) char *name; { #ifdef USE_INET6 - fprintf(stderr, "Usage: %s [-6aAdfghIilnoRsv]\n", name); + fprintf(stderr, "Usage: %s [-46aAdfghIilnoRsv]\n", name); #else - fprintf(stderr, "Usage: %s [-aAdfghIilnoRsv]\n", name); + fprintf(stderr, "Usage: %s [-4aAdfghIilnoRsv]\n", name); #endif fprintf(stderr, " %s [-M corefile] [-N symbol-list]\n", name); #ifdef USE_INET6 - fprintf(stderr, " %s -t [-6C] ", name); + fprintf(stderr, " %s -t [-46C] ", name); #else - fprintf(stderr, " %s -t [-C] ", name); + fprintf(stderr, " %s -t [-4C] ", name); #endif fprintf(stderr, "[-D destination address] [-P protocol] [-S source address] [-T refresh time]\n"); exit(1); @@ -208,9 +209,9 @@ int main(argc,argv) u_32_t frf; #ifdef USE_INET6 - options = "6aACdfghIilnostvD:m:M:N:O:P:RS:T:"; + options = "46aACdfghIilnostvD:m:M:N:O:P:RS:T:"; #else - options = "aACdfghIilnostvD:m:M:N:O:P:RS:T:"; + options = "4aACdfghIilnostvD:m:M:N:O:P:RS:T:"; #endif saddr.in4.s_addr = INADDR_ANY; /* default any v4 source addr */ @@ -285,6 +286,9 @@ int main(argc,argv) switch (c) { #ifdef USE_INET6 + case '4' : + use_inet4 = 1; + break; case '6' : use_inet6 = 1; break; @@ -387,6 +391,10 @@ int main(argc,argv) break; } } +#ifdef USE_INET6 + if (use_inet4 == 0 && use_inet6 == 0) + use_inet4 = use_inet6 = 1; +#endif if (live_kernel == 1) { bzero((char *), sizeof(fio)); @@ -413,7 +421,7 @@ int main(argc,argv) else if (opts & OPT_STATETOP) topipstates(saddr, daddr, sport, dport, protocol, #ifdef USE_INET6 - use_inet6 ? 6 : 4, + use_inet6 && !use_inet4 ? 6 : 4, #else 4, #endif @@ -812,15 +820,21 @@ printlivelist(fiop, out, set, fp, group, comment) if (rule.iri_rule == NULL) break; #ifdef USE_INET6 - if (use_inet6 != 0) { + if (use_inet6 != 0 && use_inet4 == 0) { if (fp->fr_family != 0 && fp->fr_family != AF_INET6) continue; - } else + } else if (use_inet4 != 0 && use_inet6 == 0) { #endif - { if (fp->fr_family != 0 && fp->fr_family != AF_INET) continue; +#ifdef USE_INET6 + }
svn commit: r363284 - head/sys/contrib/ipfilter/netinet
Author: cy Date: Fri Jul 17 19:07:56 2020 New Revision: 363284 URL: https://svnweb.freebsd.org/changeset/base/363284 Log: pfil_run_hooks() can be called recursively, so we have to define FASTROUTE_RECURSION in fil.c Submitted by: chris...@netbsd.org Reported by: chris...@netbsd.org Obtained from:NetBSD r1.31 MFC after:2 weeks Modified: head/sys/contrib/ipfilter/netinet/fil.c Modified: head/sys/contrib/ipfilter/netinet/fil.c == --- head/sys/contrib/ipfilter/netinet/fil.c Fri Jul 17 19:07:53 2020 (r363283) +++ head/sys/contrib/ipfilter/netinet/fil.c Fri Jul 17 19:07:56 2020 (r363284) @@ -115,6 +115,8 @@ extern int opts; extern int blockreason; #endif /* _KERNEL */ +#define FASTROUTE_RECURSION + #defineLBUMP(x)softc->x++ #defineLBUMPD(x, y)do { softc->x.y++; DT(y); } while (0) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363283 - head/contrib/ipfilter/tools
Author: cy Date: Fri Jul 17 19:07:53 2020 New Revision: 363283 URL: https://svnweb.freebsd.org/changeset/base/363283 Log: -4 and -6 only make sense with -i, -o, and -t. PR: 247952 MFC after:1 week Modified: head/contrib/ipfilter/tools/ipfstat.c Modified: head/contrib/ipfilter/tools/ipfstat.c == --- head/contrib/ipfilter/tools/ipfstat.c Fri Jul 17 19:07:50 2020 (r363282) +++ head/contrib/ipfilter/tools/ipfstat.c Fri Jul 17 19:07:53 2020 (r363283) @@ -394,6 +394,15 @@ int main(argc,argv) } } #ifdef USE_INET6 + if ((use_inet4 || use_inet6) && + !(opts & (OPT_INQUE | OPT_OUTQUE | OPT_STATETOP))) { +#ifdef STATETOP + FPRINTF(stderr, "No -i, -o, or -t given with -4 or -6\n"); +#else + FPRINTF(stderr, "No -i or -o given with -4 or -6\n"); +#endif + exit(-2); + } if (use_inet4 == 0 && use_inet6 == 0) use_inet4 = use_inet6 = 1; #endif ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363281 - head/contrib/ipfilter/tools
Author: cy Date: Fri Jul 17 19:07:47 2020 New Revision: 363281 URL: https://svnweb.freebsd.org/changeset/base/363281 Log: Make ipfstat -t header generic when IPv4 and IPv6 output are displayed in the same display. PR: 247952 MFC after:1 week Modified: head/contrib/ipfilter/tools/ipfstat.c Modified: head/contrib/ipfilter/tools/ipfstat.c == --- head/contrib/ipfilter/tools/ipfstat.c Fri Jul 17 19:07:44 2020 (r363280) +++ head/contrib/ipfilter/tools/ipfstat.c Fri Jul 17 19:07:47 2020 (r363281) @@ -1973,6 +1973,9 @@ static char *getip(v, addr) static char hostbuf[MAXHOSTNAMELEN+1]; #endif + if (v == 0) + return ("any"); + if (v == 4) return inet_ntoa(addr->in4); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363278 - head/contrib/ipfilter/tools
Author: cy Date: Fri Jul 17 19:07:37 2020 New Revision: 363278 URL: https://svnweb.freebsd.org/changeset/base/363278 Log: fr_family (the protocol family) must be AF_INET or AF_INET6, as in the kernel, not an arbitrary 4 or 6. This only affected printing ipfilter stats and rules from a kernel dump. (This is currently undocumented.) PR: 247952 MFC after:1 week Modified: head/contrib/ipfilter/tools/ipfstat.c Modified: head/contrib/ipfilter/tools/ipfstat.c == --- head/contrib/ipfilter/tools/ipfstat.c Fri Jul 17 19:07:34 2020 (r363277) +++ head/contrib/ipfilter/tools/ipfstat.c Fri Jul 17 19:07:37 2020 (r363278) @@ -913,12 +913,12 @@ static void printdeadlist(fiop, out, set, fp, group, c fp = #ifdef USE_INET6 if (use_inet6 != 0) { - if (fp->fr_family != 0 && fp->fr_family != 6) + if (fp->fr_family != 0 && fp->fr_family != AF_INET6) continue; } else #endif { - if (fp->fr_family != 0 && fp->fr_family != 4) + if (fp->fr_family != 0 && fp->fr_family != AF_INET) continue; } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363280 - in head/contrib/ipfilter: man tools
Author: cy Date: Fri Jul 17 19:07:44 2020 New Revision: 363280 URL: https://svnweb.freebsd.org/changeset/base/363280 Log: ipfstat -t defaults to IPv4 output. Make consistent with ipfstat -i and ipfstat -o where without an argument IPv4 and IPv6 states are shown. Use -4 and -6 to limit the display to IPv4 or IPv6 respectively. PR: 247952 MFC after:1 week Modified: head/contrib/ipfilter/man/ipfstat.8 head/contrib/ipfilter/tools/ipfstat.c Modified: head/contrib/ipfilter/man/ipfstat.8 == --- head/contrib/ipfilter/man/ipfstat.8 Fri Jul 17 19:07:40 2020 (r363279) +++ head/contrib/ipfilter/man/ipfstat.8 Fri Jul 17 19:07:44 2020 (r363280) @@ -195,4 +195,5 @@ more entries is to resize the screen. .SH SEE ALSO ipf(8) .SH BUGS -\fB-4\fP and \fB-6\fP should also be the default when displaying states. +\fB-4\fP and \fB-6\fP are only valid with \fB-i\fP, \fB-o\fP, and \fB-t\fP. +An error should result when used with other arguments. Modified: head/contrib/ipfilter/tools/ipfstat.c == --- head/contrib/ipfilter/tools/ipfstat.c Fri Jul 17 19:07:40 2020 (r363279) +++ head/contrib/ipfilter/tools/ipfstat.c Fri Jul 17 19:07:44 2020 (r363280) @@ -421,9 +421,9 @@ int main(argc,argv) else if (opts & OPT_STATETOP) topipstates(saddr, daddr, sport, dport, protocol, #ifdef USE_INET6 - use_inet6 && !use_inet4 ? 6 : 4, + use_inet6 && use_inet4 ? 0 : use_inet6 && !use_inet4 ? 6 : 4, #else - 4, + 4, #endif #endif refreshtime, topclosed, filter); @@ -1367,7 +1367,7 @@ static void topipstates(saddr, daddr, sport, dport, pr if (ipsstp->iss_list == NULL) break; - if (ips.is_v != ver) + if (ver != 0 && ips.is_v != ver) continue; if ((filter != NULL) && ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363277 - head/contrib/ipfilter/tools
Author: cy Date: Fri Jul 17 19:07:34 2020 New Revision: 363277 URL: https://svnweb.freebsd.org/changeset/base/363277 Log: Only use the use_inet6 variable when INET6 is a build option. This is a prerequisite to upcoming argument processing cleanups which will resolve consistency as was done with ippool previously. PR: 247952 MFC after:1 week Modified: head/contrib/ipfilter/tools/ipfstat.c Modified: head/contrib/ipfilter/tools/ipfstat.c == --- head/contrib/ipfilter/tools/ipfstat.c Fri Jul 17 15:50:03 2020 (r363276) +++ head/contrib/ipfilter/tools/ipfstat.c Fri Jul 17 19:07:34 2020 (r363277) @@ -57,7 +57,9 @@ staticwordtab_t *state_fields = NULL; intnohdrfields = 0; intopts = 0; +#ifdef USE_INET6 intuse_inet6 = 0; +#endif intlive_kernel = 1; intstate_fd = -1; intipf_fd = -1; @@ -410,8 +412,13 @@ int main(argc,argv) #ifdef STATETOP else if (opts & OPT_STATETOP) topipstates(saddr, daddr, sport, dport, protocol, - use_inet6 ? 6 : 4, refreshtime, topclosed, filter); +#ifdef USE_INET6 + use_inet6 ? 6 : 4, +#else + 4, #endif +#endif + refreshtime, topclosed, filter); else if (opts & OPT_AUTHSTATS) showauthstates(frauthstp); else if (opts & OPT_GROUPS) @@ -904,10 +911,13 @@ static void printdeadlist(fiop, out, set, fp, group, c return; } fp = +#ifdef USE_INET6 if (use_inet6 != 0) { if (fp->fr_family != 0 && fp->fr_family != 6) continue; - } else { + } else +#endif + { if (fp->fr_family != 0 && fp->fr_family != 4) continue; } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363282 - head/contrib/ipfilter/tools
Author: cy Date: Fri Jul 17 19:07:50 2020 New Revision: 363282 URL: https://svnweb.freebsd.org/changeset/base/363282 Log: The output from usage() need not contain usage for -t when STATETOP is not compiled in. PR: 247952 MFC after:1 week Modified: head/contrib/ipfilter/tools/ipfstat.c Modified: head/contrib/ipfilter/tools/ipfstat.c == --- head/contrib/ipfilter/tools/ipfstat.c Fri Jul 17 19:07:47 2020 (r363281) +++ head/contrib/ipfilter/tools/ipfstat.c Fri Jul 17 19:07:50 2020 (r363282) @@ -171,10 +171,12 @@ static void usage(name) fprintf(stderr, "Usage: %s [-4aAdfghIilnoRsv]\n", name); #endif fprintf(stderr, " %s [-M corefile] [-N symbol-list]\n", name); +#ifdef STATETOP #ifdef USE_INET6 fprintf(stderr, " %s -t [-46C] ", name); #else fprintf(stderr, " %s -t [-4C] ", name); +#endif #endif fprintf(stderr, "[-D destination address] [-P protocol] [-S source address] [-T refresh time]\n"); exit(1); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363276 - in head/sys/netgraph/bluetooth: include l2cap
Author: takawata Date: Fri Jul 17 15:50:03 2020 New Revision: 363276 URL: https://svnweb.freebsd.org/changeset/base/363276 Log: Fix L2CAP ACL packet PB(Packet Boundary) flag for LE PDU. ACL packet boundary flag should be 0 instead of 2 for LE PDU. Some HCI will drop LE packet with PB flag is 2, and if sent, some target may reject the packet. PR: 248024 Reported by: Greg V Reviewed by: Greg V, emax Differential Revision:https://reviews.freebsd.org/D25704 Modified: head/sys/netgraph/bluetooth/include/ng_hci.h head/sys/netgraph/bluetooth/l2cap/ng_l2cap_llpi.c Modified: head/sys/netgraph/bluetooth/include/ng_hci.h == --- head/sys/netgraph/bluetooth/include/ng_hci.hFri Jul 17 15:09:49 2020(r363275) +++ head/sys/netgraph/bluetooth/include/ng_hci.hFri Jul 17 15:50:03 2020(r363276) @@ -393,10 +393,10 @@ (((h) & 0x0fff) | (((pb) & 3) << 12) | (((bc) & 3) << 14)) /* PB flag values */ - /* 00 - reserved for future use */ +#defineNG_HCI_LE_PACKET_START 0x0 #defineNG_HCI_PACKET_FRAGMENT 0x1 #defineNG_HCI_PACKET_START 0x2 - /* 11 - reserved for future use */ + /* 11 for AMP packet, not supported */ /* BC flag values */ #define NG_HCI_POINT2POINT 0x0 /* only Host controller to Host */ Modified: head/sys/netgraph/bluetooth/l2cap/ng_l2cap_llpi.c == --- head/sys/netgraph/bluetooth/l2cap/ng_l2cap_llpi.c Fri Jul 17 15:09:49 2020(r363275) +++ head/sys/netgraph/bluetooth/l2cap/ng_l2cap_llpi.c Fri Jul 17 15:50:03 2020(r363276) @@ -547,7 +547,7 @@ ng_l2cap_lp_send(ng_l2cap_con_p con, u_int16_t dcid, s ng_l2cap_hdr_t *l2cap_hdr = NULL; ng_hci_acldata_pkt_t *acl_hdr = NULL; struct mbuf*m_last = NULL, *m = NULL; -int len, flag = NG_HCI_PACKET_START; +int len, flag = (con->linktype == NG_HCI_LINK_ACL) ? NG_HCI_PACKET_START : NG_HCI_LE_PACKET_START; KASSERT((con->tx_pkt == NULL), ("%s: %s - another packet pending?!\n", __func__, NG_NODE_NAME(l2cap->node))); @@ -713,7 +713,8 @@ ng_l2cap_lp_receive(ng_l2cap_p l2cap, struct mbuf *m) } /* Process packet */ - if (pb == NG_HCI_PACKET_START) { + if ((pb == NG_HCI_PACKET_START) || (pb == NG_HCI_LE_PACKET_START)) + { if (con->rx_pkt != NULL) { NG_L2CAP_ERR( "%s: %s - dropping incomplete L2CAP packet, got %d bytes, want %d bytes\n", ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363275 - head/sys/netinet
Author: tuexen Date: Fri Jul 17 15:09:49 2020 New Revision: 363275 URL: https://svnweb.freebsd.org/changeset/base/363275 Log: Improve the locking of address lists by adding some asserts and rearranging the addition of address such that the lock is not given up during checking and adding. MFC after:1 week Modified: head/sys/netinet/sctp_lock_bsd.h head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_usrreq.c head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctp_lock_bsd.h == --- head/sys/netinet/sctp_lock_bsd.hFri Jul 17 14:51:51 2020 (r363274) +++ head/sys/netinet/sctp_lock_bsd.hFri Jul 17 15:09:49 2020 (r363275) @@ -177,6 +177,13 @@ __FBSDID("$FreeBSD$"); rw_wunlock(_BASE_INFO(ipi_addr_mtx)); \ } while (0) +#define SCTP_IPI_ADDR_LOCK_ASSERT() do { \ + rw_assert(_BASE_INFO(ipi_addr_mtx), RA_LOCKED);\ +} while (0) + +#define SCTP_IPI_ADDR_WLOCK_ASSERT() do { \ + rw_assert(_BASE_INFO(ipi_addr_mtx), RA_WLOCKED); \ +} while (0) #define SCTP_IPI_ITERATOR_WQ_INIT() do { \ mtx_init(_it_ctl.ipi_iterator_wq_mtx, "sctp-it-wq",\ Modified: head/sys/netinet/sctp_pcb.c == --- head/sys/netinet/sctp_pcb.c Fri Jul 17 14:51:51 2020(r363274) +++ head/sys/netinet/sctp_pcb.c Fri Jul 17 15:09:49 2020(r363275) @@ -200,6 +200,7 @@ sctp_find_ifn(void *ifn, uint32_t ifn_index) * We assume the lock is held for the addresses if that's wrong * problems could occur :-) */ + SCTP_IPI_ADDR_LOCK_ASSERT(); hash_ifn_head = _BASE_INFO(vrf_ifn_hash)[(ifn_index & SCTP_BASE_INFO(vrf_ifn_hashmark))]; LIST_FOREACH(sctp_ifnp, hash_ifn_head, next_bucket) { if (sctp_ifnp->ifn_index == ifn_index) { @@ -295,12 +296,16 @@ sctp_delete_ifn(struct sctp_ifn *sctp_ifnp, int hold_a /* Not in the list.. sorry */ return; } - if (hold_addr_lock == 0) + if (hold_addr_lock == 0) { SCTP_IPI_ADDR_WLOCK(); + } else { + SCTP_IPI_ADDR_WLOCK_ASSERT(); + } LIST_REMOVE(sctp_ifnp, next_bucket); LIST_REMOVE(sctp_ifnp, next_ifn); - if (hold_addr_lock == 0) + if (hold_addr_lock == 0) { SCTP_IPI_ADDR_WUNLOCK(); + } /* Take away the reference, and possibly free it */ sctp_free_ifn(sctp_ifnp); } @@ -486,8 +491,8 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint3 int dynamic_add) { struct sctp_vrf *vrf; - struct sctp_ifn *sctp_ifnp = NULL; - struct sctp_ifa *sctp_ifap = NULL; + struct sctp_ifn *sctp_ifnp, *new_sctp_ifnp; + struct sctp_ifa *sctp_ifap, *new_sctp_ifap; struct sctp_ifalist *hash_addr_head; struct sctp_ifnlist *hash_ifn_head; uint32_t hash_of_addr; @@ -497,6 +502,23 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint3 SCTPDBG(SCTP_DEBUG_PCB4, "vrf_id 0x%x: adding address: ", vrf_id); SCTPDBG_ADDR(SCTP_DEBUG_PCB4, addr); #endif + SCTP_MALLOC(new_sctp_ifnp, struct sctp_ifn *, + sizeof(struct sctp_ifn), SCTP_M_IFN); + if (new_sctp_ifnp == NULL) { +#ifdef INVARIANTS + panic("No memory for IFN"); +#endif + return (NULL); + } + SCTP_MALLOC(new_sctp_ifap, struct sctp_ifa *, sizeof(struct sctp_ifa), SCTP_M_IFA); + if (new_sctp_ifap == NULL) { +#ifdef INVARIANTS + panic("No memory for IFA"); +#endif + SCTP_FREE(new_sctp_ifnp, SCTP_M_IFN); + return (NULL); + } + SCTP_IPI_ADDR_WLOCK(); sctp_ifnp = sctp_find_ifn(ifn, ifn_index); if (sctp_ifnp) { @@ -507,6 +529,8 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint3 vrf = sctp_allocate_vrf(vrf_id); if (vrf == NULL) { SCTP_IPI_ADDR_WUNLOCK(); + SCTP_FREE(new_sctp_ifnp, SCTP_M_IFN); + SCTP_FREE(new_sctp_ifap, SCTP_M_IFA); return (NULL); } } @@ -516,15 +540,8 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint3 * build one and add it, can't hold lock until after malloc * done though. */ - SCTP_IPI_ADDR_WUNLOCK(); - SCTP_MALLOC(sctp_ifnp, struct sctp_ifn *, - sizeof(struct sctp_ifn), SCTP_M_IFN); - if (sctp_ifnp == NULL) { -#ifdef INVARIANTS - panic("No memory for IFN"); -#endif - return (NULL); - } +
svn commit: r363274 - in head/sys: arm64/acpica dev/acpica
Author: br Date: Fri Jul 17 14:51:51 2020 New Revision: 363274 URL: https://svnweb.freebsd.org/changeset/base/363274 Log: Add acpi_iort_map_pci_smmuv3(). This new function allows us to find the SMMU instance assigned for a particular PCI RID. Reviewed by: andrew Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D25687 Modified: head/sys/arm64/acpica/acpi_iort.c head/sys/dev/acpica/acpivar.h Modified: head/sys/arm64/acpica/acpi_iort.c == --- head/sys/arm64/acpica/acpi_iort.c Fri Jul 17 14:45:16 2020 (r363273) +++ head/sys/arm64/acpica/acpi_iort.c Fri Jul 17 14:51:51 2020 (r363274) @@ -160,7 +160,7 @@ iort_entry_lookup(struct iort_node *node, u_int id, u_ if (i == node->nentries) return (NULL); if ((entry->flags & ACPI_IORT_ID_SINGLE_MAPPING) == 0) - *outid = entry->outbase + (id - entry->base); + *outid = entry->outbase + (id - entry->base); else *outid = entry->outbase; return (entry->out_node); @@ -562,5 +562,24 @@ acpi_iort_map_pci_msi(u_int seg, u_int rid, u_int *xre /* return first node, we don't handle more than that now. */ *xref = node->entries.its[0].xref; + return (0); +} + +int +acpi_iort_map_pci_smmuv3(u_int seg, u_int rid, u_int *xref, u_int *sid) +{ + ACPI_IORT_SMMU_V3 *smmu; + struct iort_node *node; + + node = iort_pci_rc_map(seg, rid, ACPI_IORT_NODE_SMMU_V3, sid); + if (node == NULL) + return (ENOENT); + + /* This should be an SMMU node. */ + KASSERT(node->type == ACPI_IORT_NODE_SMMU_V3, ("bad node")); + + smmu = (ACPI_IORT_SMMU_V3 *)>data.smmu_v3; + *xref = smmu->BaseAddress; + return (0); } Modified: head/sys/dev/acpica/acpivar.h == --- head/sys/dev/acpica/acpivar.h Fri Jul 17 14:45:16 2020 (r363273) +++ head/sys/dev/acpica/acpivar.h Fri Jul 17 14:51:51 2020 (r363274) @@ -556,6 +556,7 @@ int acpi_get_domain(device_t dev, device_t child, int * ARM specific ACPI interfaces, relating to IORT table. */ intacpi_iort_map_pci_msi(u_int seg, u_int rid, u_int *xref, u_int *devid); +intacpi_iort_map_pci_smmuv3(u_int seg, u_int rid, u_int *xref, u_int *devid); intacpi_iort_its_lookup(u_int its_id, u_int *xref, int *pxm); #endif #endif /* _KERNEL */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363273 - head/sys/opencrypto
Author: markj Date: Fri Jul 17 14:45:16 2020 New Revision: 363273 URL: https://svnweb.freebsd.org/changeset/base/363273 Log: Clean up crypto_init(). The function is called from a KLD load handler, so it may sleep. - Stop checking for errors from uma_zcreate(), they don't happen. - Convert M_NOWAIT allocations to M_WAITOK. - Remove error handling for existing M_WAITOK allocations. - Fix style. Reviewed by: cem, delphij, jhb MFC after:1 week Differential Revision:https://reviews.freebsd.org/D25696 Modified: head/sys/opencrypto/crypto.c Modified: head/sys/opencrypto/crypto.c == --- head/sys/opencrypto/crypto.cFri Jul 17 14:39:07 2020 (r363272) +++ head/sys/opencrypto/crypto.cFri Jul 17 14:45:16 2020 (r363273) @@ -325,41 +325,25 @@ crypto_init(void) TAILQ_INIT(_kq); mtx_init(_q_mtx, "crypto", "crypto op queues", MTX_DEF); - cryptop_zone = uma_zcreate("cryptop", sizeof (struct cryptop), - 0, 0, 0, 0, - UMA_ALIGN_PTR, UMA_ZONE_ZINIT); + cryptop_zone = uma_zcreate("cryptop", + sizeof(struct cryptop), NULL, NULL, NULL, NULL, + UMA_ALIGN_PTR, UMA_ZONE_ZINIT); cryptoses_zone = uma_zcreate("crypto_session", sizeof(struct crypto_session), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); - if (cryptop_zone == NULL || cryptoses_zone == NULL) { - printf("crypto_init: cannot setup crypto zones\n"); - error = ENOMEM; - goto bad; - } - crypto_drivers_size = CRYPTO_DRIVERS_INITIAL; crypto_drivers = malloc(crypto_drivers_size * - sizeof(struct cryptocap), M_CRYPTO_DATA, M_NOWAIT | M_ZERO); - if (crypto_drivers == NULL) { - printf("crypto_init: cannot setup crypto drivers\n"); - error = ENOMEM; - goto bad; - } + sizeof(struct cryptocap), M_CRYPTO_DATA, M_WAITOK | M_ZERO); if (crypto_workers_num < 1 || crypto_workers_num > mp_ncpus) crypto_workers_num = mp_ncpus; - crypto_tq = taskqueue_create("crypto", M_WAITOK|M_ZERO, - taskqueue_thread_enqueue, _tq); - if (crypto_tq == NULL) { - printf("crypto init: cannot setup crypto taskqueue\n"); - error = ENOMEM; - goto bad; - } + crypto_tq = taskqueue_create("crypto", M_WAITOK | M_ZERO, + taskqueue_thread_enqueue, _tq); taskqueue_start_threads(_tq, crypto_workers_num, PRI_MIN_KERN, - "crypto"); + "crypto"); error = kproc_create((void (*)(void *)) crypto_proc, NULL, , 0, 0, "crypto"); @@ -369,14 +353,8 @@ crypto_init(void) goto bad; } - crypto_ret_workers = malloc(crypto_workers_num * sizeof(struct crypto_ret_worker), - M_CRYPTO_DATA, M_NOWAIT|M_ZERO); - if (crypto_ret_workers == NULL) { - error = ENOMEM; - printf("crypto_init: cannot allocate ret workers\n"); - goto bad; - } - + crypto_ret_workers = mallocarray(crypto_workers_num, + sizeof(struct crypto_ret_worker), M_CRYPTO_DATA, M_WAITOK | M_ZERO); FOREACH_CRYPTO_RETW(ret_worker) { TAILQ_INIT(_worker->crp_ordered_ret_q); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363272 - head/sys/cddl/dev/dtrace/aarch64
Author: andrew Date: Fri Jul 17 14:39:07 2020 New Revision: 363272 URL: https://svnweb.freebsd.org/changeset/base/363272 Log: Don't overflow the trap frame when accessing lr or xzr. When emulating a load pair or store pair in dtrace on arm64 we need to copy the data between the stack and trap frame. When the registers are either the link register or the zero register we will access memory past the end of the trap frame as these are encoded as registers 30 and 31 respectively while the array they access only has 30 entries. Fix this by creating 2 helper functions to perform the operation with special cases for these registers. Sponsored by: Innovate UK Modified: head/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c Modified: head/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c == --- head/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c Fri Jul 17 14:17:13 2020(r363271) +++ head/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c Fri Jul 17 14:39:07 2020(r363272) @@ -231,6 +231,31 @@ dtrace_probe_error(dtrace_state_t *state, dtrace_epid_ (uintptr_t)which, (uintptr_t)fault, (uintptr_t)fltoffs); } +static void +dtrace_load64(uint64_t *addr, struct trapframe *frame, u_int reg) +{ + + KASSERT(reg <= 31, ("dtrace_load64: Invalid register %u", reg)); + if (reg < nitems(frame->tf_x)) + frame->tf_x[reg] = *addr; + else if (reg == 30) /* lr */ + frame->tf_lr = *addr; + /* Nothing to do for load to xzr */ +} + +static void +dtrace_store64(uint64_t *addr, struct trapframe *frame, u_int reg) +{ + + KASSERT(reg <= 31, ("dtrace_store64: Invalid register %u", reg)); + if (reg < nitems(frame->tf_x)) + *addr = frame->tf_x[reg]; + else if (reg == 30) /* lr */ + *addr = frame->tf_lr; + else if (reg == 31) /* xzr */ + *addr = 0; +} + static int dtrace_invop_start(struct trapframe *frame) { @@ -258,12 +283,12 @@ dtrace_invop_start(struct trapframe *frame) sp -= (~offs & OFFSET_MASK) + 1; else sp += (offs); - *(sp + 0) = frame->tf_x[arg1]; - *(sp + 1) = frame->tf_x[arg2]; + dtrace_store64(sp + 0, frame, arg1); + dtrace_store64(sp + 1, frame, arg2); break; case LDP_64: - frame->tf_x[arg1] = *(sp + 0); - frame->tf_x[arg2] = *(sp + 1); + dtrace_load64(sp + 0, frame, arg1); + dtrace_load64(sp + 1, frame, arg2); if (offs >> (OFFSET_SIZE - 1)) sp -= (~offs & OFFSET_MASK) + 1; else ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363268 - head/share/man/man7
Author: pstef Date: Fri Jul 17 06:33:20 2020 New Revision: 363268 URL: https://svnweb.freebsd.org/changeset/base/363268 Log: Promote use of unprivileged users for building ports by documenting SU_CMD. Phrasing by Daniel O'Connor. Reviewed by: 0mp MFC after:14 days Differential Revision:https://reviews.freebsd.org/D25433 Modified: head/share/man/man7/ports.7 Modified: head/share/man/man7/ports.7 == --- head/share/man/man7/ports.7 Fri Jul 17 02:53:41 2020(r363267) +++ head/share/man/man7/ports.7 Fri Jul 17 06:33:20 2020(r363268) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 4, 2020 +.Dd July 17, 2020 .Dt PORTS 7 .Os .Sh NAME @@ -437,6 +437,14 @@ Where to find/put distfiles, normally .Pa distfiles/ in .Va PORTSDIR . +.It Va SU_CMD +Command used to elevate privilege to configure and install a port. +The unprivileged user must have write access to +.Va WRKDIRPREFIX +and +.Va DISTDIR . +The default is +.Ql /usr/bin/su root -c .It Va PACKAGES Used only for the .Cm package ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"