Re: svn commit: r363263 - in head/lib/csu: . common
On Thu, Jul 16, 2020 at 4:58 PM John Baldwin wrote: > > Author: jhb > Date: Thu Jul 16 21:58:43 2020 > New Revision: 363263 > URL: https://svnweb.freebsd.org/changeset/base/363263 > > Log: > Include ABI note tag in shared libraries. > > Split the ELF feature note into a separate file that is linked into > *crt1.o the same as crtbrand.S was before. crtbrand.o is now linked > into crti.o on all platforms in addition to *crt1.o. > This is pretty handy; any chance we can backport this series for 12.3? Thanks, Kyle Evans ___ 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"
Re: svn commit: r365619 - in stable/12/sys: conf sys
On Thu, Sep 10, 2020 at 7:04 PM Glen Barber wrote: > > Author: gjb > Date: Fri Sep 11 00:04:23 2020 > New Revision: 365619 > URL: https://svnweb.freebsd.org/changeset/base/365619 > > Log: > Rename stable/12 to -STABLE, and bump __FreeBSD_version after > releng/12.2 had been created. > I had wondered this before, and now I wonder again after a recent pkgbase discussion about versioning schemes. Why do we rename stable to -PRERELEASE at all? It's decidedly a (minor) downgrade to try to go from -PRERELEASE to -RELEASE since anyone that manages to get a -PRERELEASE build is still along -STABLE. Thanks, Kyle Evans > Modified: > stable/12/sys/conf/newvers.sh > stable/12/sys/sys/param.h > > Modified: stable/12/sys/conf/newvers.sh > == > --- stable/12/sys/conf/newvers.sh Thu Sep 10 23:56:59 2020 > (r365618) > +++ stable/12/sys/conf/newvers.sh Fri Sep 11 00:04:23 2020 > (r365619) > @@ -49,7 +49,7 @@ > > TYPE="FreeBSD" > REVISION="12.2" > -BRANCH=${BRANCH_OVERRIDE:-PRERELEASE} > +BRANCH=${BRANCH_OVERRIDE:-STABLE} > RELEASE="${REVISION}-${BRANCH}" > VERSION="${TYPE} ${RELEASE}" > > > Modified: stable/12/sys/sys/param.h > == > --- stable/12/sys/sys/param.h Thu Sep 10 23:56:59 2020(r365618) > +++ stable/12/sys/sys/param.h Fri Sep 11 00:04:23 2020(r365619) > @@ -60,7 +60,7 @@ > * in the range 5 to 9. > */ > #undef __FreeBSD_version > -#define __FreeBSD_version 1201526 /* Master, propagated to newvers */ > +#define __FreeBSD_version 1202500 /* 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"
Re: svn commit: r368181 - in stable/12/sys/netinet: . tcp_stacks
On Wed, Jan 13, 2021 at 4:57 PM Michael Tuexen wrote: > > > On 13. Jan 2021, at 16:33, Kyle Evans wrote: > > > > On Wed, Jan 13, 2021 at 9:31 AM Michael Tuexen wrote: > >> > >>> On 13. Jan 2021, at 16:16, Kyle Evans wrote: > >>> > >>> On Wed, Jan 6, 2021 at 9:01 AM Kyle Evans wrote: > >>>> > >>>> On Mon, Nov 30, 2020 at 3:45 AM Michael Tuexen > >>>> wrote: > >>>>> > >>>>> Author: tuexen > >>>>> Date: Mon Nov 30 09:45:44 2020 > >>>>> New Revision: 368181 > >>>>> URL: https://svnweb.freebsd.org/changeset/base/368181 > >>>>> > >>>>> Log: > >>>>> MFC r367530: > >>>>> RFC 7323 specifies that: > >>>>> * TCP segments without timestamps should be dropped when support for > >>>>> the timestamp option has been negotiated. > >>>>> * TCP segments with timestamps should be processed normally if support > >>>>> for the timestamp option has not been negotiated. > >>>>> This patch enforces the above. > >>>>> Manually resolved merge conflicts. > >>>>> > >>>>> MFC 367891: > >>>>> Fix an issue I introuced in r367530: tcp_twcheck() can be called > >>>>> with to == NULL for SYN segments. So don't assume tp != NULL. > >>>>> Thanks to jhb@ for reporting and suggesting a fix. > >>>>> > >>>>> MFC r367946: > >>>>> Fix two occurences of a typo in a comment introduced in r367530. > >>>>> Thanks to lstewart@ for reporting them. > >>>>> > >>>> > >>>> Hi Michael, > >>>> > >>>> Dmitri (CC'd) spotted a regression in the golang test suite along > >>>> stable/12 and bisected it back to this MFC (reported via > >>>> efnet#bsdports). The test puts up a local HTTP server and attempts to > >>>> close the read-side while the write-side is still going, hopefully > >>>> observing a write failure on the write-side in the process (but it > >>>> never does). > >>>> > >>>> I minimized it to this (rough) reproducer, which shows the write side > >>>> hanging around in CLOSE_WAIT and successfully writing the msg > >>>> repeatedly on recent -CURRENT while 12.2 observes an EPIPE almost > >>>> immediately: https://people.freebsd.org/~kevans/tcpr.c > >>>> > >>>> root@viper:~/grep# sockstat -s | grep 8993 > >>>> root a.out 80831 4 tcp4 127.0.0.1:8993*:* > >>>> LISTEN > >>>> root a.out 80831 5 tcp4 127.0.0.1:8993 > >>>> 127.0.0.1:40319CLOSE_WAIT > >>>> root@viper:~/grep# > >>>> > >>> > >>> Ping? > >> Hi Kyle, > >> > >> thanks for pinging. I missed your original mail (not sure why it did not > >> end up in the > >> correct mailbox). Will look into it later today/tomorrow. > >> > >> Thanks for providing a reproducer. Just to get it crystal clear: You say > >> that the > >> programs runs fine on CURRENT but not on stable/12. Is that correct? > >> > > > > Excellent, thanks! It runs fine on 12.2, but not on an up-to-date > > -CURRENT or stable/12 after this MFC. > The issue should be fixed by https://reviews.freebsd.org/D28143 > > With that patch your reproducer terminates immediately, sometimes reporting > tuexen@head:~ % ./tcpr > waiting for server > attempting to connect > got client > connected, closing > waiting > write fail (bad!): 54 > > and sometimes reporting > > tuexen@head:~ % ./tcpr > waiting for server > attempting to connect > connected, closing > waiting > got client > pipe gone (good!) > > but that depends on the timing. > A-ha, thanks! I can't imagine why I slapped a huge "bad!" blanket label on errors since ECONNRESET is exceedingly reasonable; thanks for the speedy resolution! :-) ___ 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"
Re: svn commit: r368181 - in stable/12/sys/netinet: . tcp_stacks
On Wed, Jan 13, 2021 at 9:31 AM Michael Tuexen wrote: > > > On 13. Jan 2021, at 16:16, Kyle Evans wrote: > > > > On Wed, Jan 6, 2021 at 9:01 AM Kyle Evans wrote: > >> > >> On Mon, Nov 30, 2020 at 3:45 AM Michael Tuexen wrote: > >>> > >>> Author: tuexen > >>> Date: Mon Nov 30 09:45:44 2020 > >>> New Revision: 368181 > >>> URL: https://svnweb.freebsd.org/changeset/base/368181 > >>> > >>> Log: > >>> MFC r367530: > >>> RFC 7323 specifies that: > >>> * TCP segments without timestamps should be dropped when support for > >>>the timestamp option has been negotiated. > >>> * TCP segments with timestamps should be processed normally if support > >>>for the timestamp option has not been negotiated. > >>> This patch enforces the above. > >>> Manually resolved merge conflicts. > >>> > >>> MFC 367891: > >>> Fix an issue I introuced in r367530: tcp_twcheck() can be called > >>> with to == NULL for SYN segments. So don't assume tp != NULL. > >>> Thanks to jhb@ for reporting and suggesting a fix. > >>> > >>> MFC r367946: > >>> Fix two occurences of a typo in a comment introduced in r367530. > >>> Thanks to lstewart@ for reporting them. > >>> > >> > >> Hi Michael, > >> > >> Dmitri (CC'd) spotted a regression in the golang test suite along > >> stable/12 and bisected it back to this MFC (reported via > >> efnet#bsdports). The test puts up a local HTTP server and attempts to > >> close the read-side while the write-side is still going, hopefully > >> observing a write failure on the write-side in the process (but it > >> never does). > >> > >> I minimized it to this (rough) reproducer, which shows the write side > >> hanging around in CLOSE_WAIT and successfully writing the msg > >> repeatedly on recent -CURRENT while 12.2 observes an EPIPE almost > >> immediately: https://people.freebsd.org/~kevans/tcpr.c > >> > >> root@viper:~/grep# sockstat -s | grep 8993 > >> root a.out 80831 4 tcp4 127.0.0.1:8993*:* > >> LISTEN > >> root a.out 80831 5 tcp4 127.0.0.1:8993 > >> 127.0.0.1:40319CLOSE_WAIT > >> root@viper:~/grep# > >> > > > > Ping? > Hi Kyle, > > thanks for pinging. I missed your original mail (not sure why it did not end > up in the > correct mailbox). Will look into it later today/tomorrow. > > Thanks for providing a reproducer. Just to get it crystal clear: You say that > the > programs runs fine on CURRENT but not on stable/12. Is that correct? > Excellent, thanks! It runs fine on 12.2, but not on an up-to-date -CURRENT or stable/12 after this MFC. > Best regards > Michael > > > >>> > >>> Modified: > >>> stable/12/sys/netinet/tcp_input.c > >>> stable/12/sys/netinet/tcp_stacks/rack.c > >>> stable/12/sys/netinet/tcp_syncache.c > >>> stable/12/sys/netinet/tcp_timewait.c > >>> Directory Properties: > >>> stable/12/ (props changed) > >>> > >>> Modified: stable/12/sys/netinet/tcp_input.c > >>> == > >>> --- stable/12/sys/netinet/tcp_input.c Mon Nov 30 09:22:33 2020 > >>> (r368180) > >>> +++ stable/12/sys/netinet/tcp_input.c Mon Nov 30 09:45:44 2020 > >>> (r368181) > >>> @@ -975,8 +975,8 @@ findpcb: > >>>} > >>>INP_INFO_RLOCK_ASSERT(&V_tcbinfo); > >>> > >>> - if (thflags & TH_SYN) > >>> - tcp_dooptions(&to, optp, optlen, TO_SYN); > >>> + tcp_dooptions(&to, optp, optlen, > >>> + (thflags & TH_SYN) ? TO_SYN : 0); > >>>/* > >>> * NB: tcp_twcheck unlocks the INP and frees the mbuf. > >>> */ > >>> @@ -1706,20 +1706,29 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, > >>> stru > >>>} > >>> > >>>/* > >>> -* If timestamps were negotiated during SYN/ACK they should > >>> -* appear on every segment during this session and vice versa. > >>> +
Re: svn commit: r368181 - in stable/12/sys/netinet: . tcp_stacks
On Wed, Jan 6, 2021 at 9:01 AM Kyle Evans wrote: > > On Mon, Nov 30, 2020 at 3:45 AM Michael Tuexen wrote: > > > > Author: tuexen > > Date: Mon Nov 30 09:45:44 2020 > > New Revision: 368181 > > URL: https://svnweb.freebsd.org/changeset/base/368181 > > > > Log: > > MFC r367530: > > RFC 7323 specifies that: > > * TCP segments without timestamps should be dropped when support for > > the timestamp option has been negotiated. > > * TCP segments with timestamps should be processed normally if support > > for the timestamp option has not been negotiated. > > This patch enforces the above. > > Manually resolved merge conflicts. > > > > MFC 367891: > > Fix an issue I introuced in r367530: tcp_twcheck() can be called > > with to == NULL for SYN segments. So don't assume tp != NULL. > > Thanks to jhb@ for reporting and suggesting a fix. > > > > MFC r367946: > > Fix two occurences of a typo in a comment introduced in r367530. > > Thanks to lstewart@ for reporting them. > > > > Hi Michael, > > Dmitri (CC'd) spotted a regression in the golang test suite along > stable/12 and bisected it back to this MFC (reported via > efnet#bsdports). The test puts up a local HTTP server and attempts to > close the read-side while the write-side is still going, hopefully > observing a write failure on the write-side in the process (but it > never does). > > I minimized it to this (rough) reproducer, which shows the write side > hanging around in CLOSE_WAIT and successfully writing the msg > repeatedly on recent -CURRENT while 12.2 observes an EPIPE almost > immediately: https://people.freebsd.org/~kevans/tcpr.c > > root@viper:~/grep# sockstat -s | grep 8993 > root a.out 80831 4 tcp4 127.0.0.1:8993*:* > LISTEN > root a.out 80831 5 tcp4 127.0.0.1:8993 > 127.0.0.1:40319CLOSE_WAIT > root@viper:~/grep# > Ping? > > > > Modified: > > stable/12/sys/netinet/tcp_input.c > > stable/12/sys/netinet/tcp_stacks/rack.c > > stable/12/sys/netinet/tcp_syncache.c > > stable/12/sys/netinet/tcp_timewait.c > > Directory Properties: > > stable/12/ (props changed) > > > > Modified: stable/12/sys/netinet/tcp_input.c > > == > > --- stable/12/sys/netinet/tcp_input.c Mon Nov 30 09:22:33 2020 > > (r368180) > > +++ stable/12/sys/netinet/tcp_input.c Mon Nov 30 09:45:44 2020 > > (r368181) > > @@ -975,8 +975,8 @@ findpcb: > > } > > INP_INFO_RLOCK_ASSERT(&V_tcbinfo); > > > > - if (thflags & TH_SYN) > > - tcp_dooptions(&to, optp, optlen, TO_SYN); > > + tcp_dooptions(&to, optp, optlen, > > + (thflags & TH_SYN) ? TO_SYN : 0); > > /* > > * NB: tcp_twcheck unlocks the INP and frees the mbuf. > > */ > > @@ -1706,20 +1706,29 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, > > stru > > } > > > > /* > > -* If timestamps were negotiated during SYN/ACK they should > > -* appear on every segment during this session and vice versa. > > +* If timestamps were negotiated during SYN/ACK and a > > +* segment without a timestamp is received, silently drop > > +* the segment. > > +* See section 3.2 of RFC 7323. > > */ > > if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS)) { > > if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { > > log(LOG_DEBUG, "%s; %s: Timestamp missing, " > > - "no action\n", s, __func__); > > + "segment silently dropped\n", s, __func__); > > free(s, M_TCPLOG); > > } > > + goto drop; > > } > > + /* > > +* If timestamps were not negotiated during SYN/ACK and a > > +* segment with a timestamp is received, ignore the > > +* timestamp and process the packet normally. > > +* See section 3.2 of RFC 7323. > > +*/ > > if (!(tp->t_flags & TF_RCVD_TSTMP) && (to.to_flags & TOF_TS)) { > > if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { > >
Re: svn commit: r368181 - in stable/12/sys/netinet: . tcp_stacks
On Mon, Nov 30, 2020 at 3:45 AM Michael Tuexen wrote: > > Author: tuexen > Date: Mon Nov 30 09:45:44 2020 > New Revision: 368181 > URL: https://svnweb.freebsd.org/changeset/base/368181 > > Log: > MFC r367530: > RFC 7323 specifies that: > * TCP segments without timestamps should be dropped when support for > the timestamp option has been negotiated. > * TCP segments with timestamps should be processed normally if support > for the timestamp option has not been negotiated. > This patch enforces the above. > Manually resolved merge conflicts. > > MFC 367891: > Fix an issue I introuced in r367530: tcp_twcheck() can be called > with to == NULL for SYN segments. So don't assume tp != NULL. > Thanks to jhb@ for reporting and suggesting a fix. > > MFC r367946: > Fix two occurences of a typo in a comment introduced in r367530. > Thanks to lstewart@ for reporting them. > Hi Michael, Dmitri (CC'd) spotted a regression in the golang test suite along stable/12 and bisected it back to this MFC (reported via efnet#bsdports). The test puts up a local HTTP server and attempts to close the read-side while the write-side is still going, hopefully observing a write failure on the write-side in the process (but it never does). I minimized it to this (rough) reproducer, which shows the write side hanging around in CLOSE_WAIT and successfully writing the msg repeatedly on recent -CURRENT while 12.2 observes an EPIPE almost immediately: https://people.freebsd.org/~kevans/tcpr.c root@viper:~/grep# sockstat -s | grep 8993 root a.out 80831 4 tcp4 127.0.0.1:8993*:* LISTEN root a.out 80831 5 tcp4 127.0.0.1:8993 127.0.0.1:40319CLOSE_WAIT root@viper:~/grep# Thanks, Kyle Evans > > Modified: > stable/12/sys/netinet/tcp_input.c > stable/12/sys/netinet/tcp_stacks/rack.c > stable/12/sys/netinet/tcp_syncache.c > stable/12/sys/netinet/tcp_timewait.c > Directory Properties: > stable/12/ (props changed) > > Modified: stable/12/sys/netinet/tcp_input.c > == > --- stable/12/sys/netinet/tcp_input.c Mon Nov 30 09:22:33 2020 > (r368180) > +++ stable/12/sys/netinet/tcp_input.c Mon Nov 30 09:45:44 2020 > (r368181) > @@ -975,8 +975,8 @@ findpcb: > } > INP_INFO_RLOCK_ASSERT(&V_tcbinfo); > > - if (thflags & TH_SYN) > - tcp_dooptions(&to, optp, optlen, TO_SYN); > + tcp_dooptions(&to, optp, optlen, > + (thflags & TH_SYN) ? TO_SYN : 0); > /* > * NB: tcp_twcheck unlocks the INP and frees the mbuf. > */ > @@ -1706,20 +1706,29 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru > } > > /* > -* If timestamps were negotiated during SYN/ACK they should > -* appear on every segment during this session and vice versa. > +* If timestamps were negotiated during SYN/ACK and a > +* segment without a timestamp is received, silently drop > +* the segment. > +* See section 3.2 of RFC 7323. > */ > if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS)) { > if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { > log(LOG_DEBUG, "%s; %s: Timestamp missing, " > - "no action\n", s, __func__); > + "segment silently dropped\n", s, __func__); > free(s, M_TCPLOG); > } > + goto drop; > } > + /* > +* If timestamps were not negotiated during SYN/ACK and a > +* segment with a timestamp is received, ignore the > +* timestamp and process the packet normally. > +* See section 3.2 of RFC 7323. > +*/ > if (!(tp->t_flags & TF_RCVD_TSTMP) && (to.to_flags & TOF_TS)) { > if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { > log(LOG_DEBUG, "%s; %s: Timestamp not expected, " > - "no action\n", s, __func__); > + "segment processed normally\n", s, __func__); > free(s, M_TCPLOG); > } > } > > Modified: stable/12/sys/netinet/tcp_stacks/rack.c > == > --- stable/12/sys/netinet/tcp_stacks/rack.c Mon Nov 30 09:22:33 2020
Re: svn commit: r368820 - head
On Mon, Dec 21, 2020 at 8:24 AM Rodney W. Grimes wrote: > > > On Sun, 20 Dec 2020 15:46:12 +0100 > > "Hartmann, O." wrote: > > > > > On Sun, 20 Dec 2020 02:59:44 + (UTC) > > > Li-Wen Hsu wrote: > > > > > > > Author: lwhsu > > > > Date: Sun Dec 20 02:59:44 2020 > > > > New Revision: 368820 > > > > URL: https://svnweb.freebsd.org/changeset/base/368820 > > > > > > > > Log: > > > > Mark the repository as being converted to Git. > > > > > > > > This is the last Subversion commit to src. > > > > > > > > Sponsored by: The FreeBSD Foundation > > > > > > > > Modified: > > > > head/README > > > > head/README.md > > > > > > > > Modified: head/README > > > > == > > > > --- head/README Sat Dec 19 22:04:46 2020(r368819) > > > > +++ head/README Sun Dec 20 02:59:44 2020(r368820) > > > > @@ -1,3 +1,5 @@ > > > > +This repository is being converted from Subversion to Git. > > > > + > > > > This is the top level of the FreeBSD source directory. This file > > > > was last revised on: > > > > $FreeBSD$ > > > > > > > > Modified: head/README.md > > > > == > > > > --- head/README.mdSat Dec 19 22:04:46 2020(r368819) > > > > +++ head/README.mdSun Dec 20 02:59:44 2020(r368820) > > > > @@ -1,3 +1,5 @@ > > > > +This repository is being converted from Subversion to Git. > > > > + > > > > FreeBSD Source: > > > > --- > > > > This is the top level of the FreeBSD source directory. This file > > > > ___ > > > > svn-src-h...@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" > > > > > > Is this message of yours also the last message concerning the source > > > changes? Since then > > > you published this message, no further logs ran into list > > > svn-src-h...@freebsd.org. > > > > > > > Take a look at this https://wiki.freebsd.org/git. Write access to > > Subversion has been disabled. > > I think the bigger question is why as a committer have I not seen ANY > commits to git since this cut over? Is it a) none have happened in 24 hours, > or b) commit mail is no longer going to developers as it use to? > According to the wiki, the repo conversion is not yet done so no commits have been made. =) ___ 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: r368779 - head/sys/kern
Author: kevans Date: Sat Dec 19 03:30:06 2020 New Revision: 368779 URL: https://svnweb.freebsd.org/changeset/base/368779 Log: kern: cpuset: allow jails to modify child jails' roots This partially lifts a restriction imposed by r191639 ("Prevent a superuser inside a jail from modifying the dedicated root cpuset of that jail") that's perhaps beneficial after r192895 ("Add hierarchical jails."). Jails still cannot modify their own cpuset, but they can modify child jails' roots to further restrict them or widen them back to the modifying jails' own mask. As a side effect of this, the system root may once again widen the mask of jails as long as they're still using a subset of the parent jails' mask. This was previously prevented by the fact that cpuset_getroot of a root set will return that root, rather than the root's parent -- cpuset_modify uses cpuset_getroot since it was introduced in r327895, previously it was just validating against set->cs_parent which allowed the system root to widen jail masks. Reviewed by: jamie MFC after:1 week Differential Revision:https://reviews.freebsd.org/D27352 Modified: head/sys/kern/kern_cpuset.c Modified: head/sys/kern/kern_cpuset.c == --- head/sys/kern/kern_cpuset.c Sat Dec 19 03:07:38 2020(r368778) +++ head/sys/kern/kern_cpuset.c Sat Dec 19 03:30:06 2020(r368779) @@ -688,19 +688,34 @@ cpuset_modify(struct cpuset *set, cpuset_t *mask) if (error) return (error); /* -* In case we are called from within the jail +* In case we are called from within the jail, * we do not allow modifying the dedicated root * cpuset of the jail but may still allow to -* change child sets. +* change child sets, including subordinate jails' +* roots. */ - if (jailed(curthread->td_ucred) && - set->cs_flags & CPU_SET_ROOT) + if ((set->cs_flags & CPU_SET_ROOT) != 0 && + jailed(curthread->td_ucred) && + set == curthread->td_ucred->cr_prison->pr_cpuset) return (EPERM); /* * Verify that we have access to this set of * cpus. */ - root = cpuset_getroot(set); + if ((set->cs_flags & (CPU_SET_ROOT | CPU_SET_RDONLY)) == CPU_SET_ROOT) { + KASSERT(set->cs_parent != NULL, + ("jail.cpuset=%d is not a proper child of parent jail's root.", + set->cs_id)); + + /* +* cpuset_getroot() cannot work here due to how top-level jail +* roots are constructed. Top-level jails are parented to +* thread0's cpuset (i.e. cpuset 1) rather than the system root. +*/ + root = set->cs_parent; + } else { + root = cpuset_getroot(set); + } mtx_lock_spin(&cpuset_lock); if (root && !CPU_SUBSET(&root->cs_mask, mask)) { error = EINVAL; ___ 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"
Re: svn commit: r368721 - head/stand/efi/loader
On Thu, Dec 17, 2020 at 1:47 PM Andrew Gallatin wrote: > > On 12/17/20 12:02 PM, Warner Losh wrote: > > Author: imp > > Date: Thu Dec 17 17:02:09 2020 > > New Revision: 368721 > > URL: > > https://urldefense.com/v3/__https://svnweb.freebsd.org/changeset/base/368721__;!!OToaGQ!5c1mLnhtRtEV6Cv_MTWpzXWaGZEYYDp4TJ6wVDzjVZiehAItts7ZWC15uNnQYRa5Fg$ > > > > Log: > >Drop EFI_STAGING_SIZE back down to 64M > > > >vmware can't cope with anything larger than 64MB. Drop this back to > >64MB everywhere but arm. > > There were all kinds of booting problems before this was bumped up. > In fact, I still have EFI_STAGING_SIZE=128 in src.conf because I needed > it be be able to boot when using Nvidia graphics. By reducing this, I > feel like we're just playing whack-a-mole. > IIRC those have long since become OBE as we'll now grow the staging area to accommodate nvidia. ___ 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: r368729 - in head: stand/lua tools/boot
Author: kevans Date: Thu Dec 17 18:29:30 2020 New Revision: 368729 URL: https://svnweb.freebsd.org/changeset/base/368729 Log: lualoader: fix lua-lint run luacheck rightfully complains that i is unused in the show-module-options loop at the end (it was used for some debugging in the process). We've added a new pager module that's compiled in, so declare that as an acceptable global. Modified: head/stand/lua/cli.lua head/tools/boot/lua-lint.sh Modified: head/stand/lua/cli.lua == --- head/stand/lua/cli.lua Thu Dec 17 18:24:36 2020(r368728) +++ head/stand/lua/cli.lua Thu Dec 17 18:29:30 2020(r368729) @@ -234,7 +234,7 @@ cli["show-module-options"] = function() end pager.open() - for i, v in ipairs(lines) do + for _, v in ipairs(lines) do pager.output(v .. "\n") end pager.close() Modified: head/tools/boot/lua-lint.sh == --- head/tools/boot/lua-lint.sh Thu Dec 17 18:24:36 2020(r368728) +++ head/tools/boot/lua-lint.sh Thu Dec 17 18:29:30 2020(r368729) @@ -17,4 +17,5 @@ LUACHECK=$(which luacheck) cd $(make -V SRCTOP)/stand ${LUACHECK} . --globals loader --globals lfs --globals io.getchar \ --globals io.ischar --globals printc --globals cli_execute \ - --globals cli_execute_unparsed --globals try_include --std lua53 + --globals cli_execute_unparsed --globals try_include \ + --globals pager --std lua53 ___ 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: r368728 - head/stand/lua
Author: kevans Date: Thu Dec 17 18:24:36 2020 New Revision: 368728 URL: https://svnweb.freebsd.org/changeset/base/368728 Log: lualoader: cli: provide a show-module-options loader command This effectively dumps everything lualoader knows about to the console using the libsa pager; that particular lua interface was added in r368591. A pager stub implementation has been added that just dumps the output as-is as a compat shim for older loader binaries that do not have lpager. This stub should be moved into a more appropriate .lua file if we add anything else that needs the pager. Modified: head/stand/lua/cli.lua head/stand/lua/cli.lua.8 head/stand/lua/config.lua head/stand/lua/config.lua.8 Modified: head/stand/lua/cli.lua == --- head/stand/lua/cli.lua Thu Dec 17 18:15:07 2020(r368727) +++ head/stand/lua/cli.lua Thu Dec 17 18:24:36 2020(r368728) @@ -32,6 +32,18 @@ local core = require("core") local cli = {} +if not pager then + -- shim for the pager module that just doesn't do it. + -- XXX Remove after 12.2 goes EoL. + pager = { + open = function() end, + close = function() end, + output = function(str) + printc(str) + end, + } +end + -- Internal function -- Parses arguments to boot and returns two values: kernel_name, argstr -- Defaults to nil and "" respectively. @@ -171,6 +183,61 @@ cli["toggle-module"] = function(...) local module = argv[1] setModule(module, not config.isModuleEnabled(module)) +end + +cli["show-module-options"] = function() + local module_info = config.getModuleInfo() + local modules = module_info['modules'] + local blacklist = module_info['blacklist'] + local lines = {} + + for module, info in pairs(modules) do + if #lines > 0 then + lines[#lines + 1] = "" + end + + lines[#lines + 1] = "Name:" .. module + if info.name then + lines[#lines + 1] = "Path:" .. info.name + end + + if info.type then + lines[#lines + 1] = "Type:" .. info.type + end + + if info.flags then + lines[#lines + 1] = "Flags: " .. info.flags + end + + if info.before then + lines[#lines + 1] = "Before load: " .. info.before + end + + if info.after then + lines[#lines + 1] = "After load: " .. info.after + end + + if info.error then + lines[#lines + 1] = "Error: " .. info.error + end + + local status + if blacklist[module] and not info.force then + status = "Blacklisted" + elseif info.load == "YES" then + status = "Load" + else + status = "Don't load" + end + + lines[#lines + 1] = "Status: " .. status + end + + pager.open() + for i, v in ipairs(lines) do + pager.output(v .. "\n") + end + pager.close() end -- Used for splitting cli varargs into cmd_name and the rest of argv Modified: head/stand/lua/cli.lua.8 == --- head/stand/lua/cli.lua.8Thu Dec 17 18:15:07 2020(r368727) +++ head/stand/lua/cli.lua.8Thu Dec 17 18:24:36 2020(r368728) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 12, 2020 +.Dd December 17, 2020 .Dt CLI.LUA 8 .Os .Sh NAME @@ -96,6 +96,8 @@ module provides the following default commands: .Ic disable-module .It .Ic toggle-module +.It +.Ic show-module-options .El .Pp For @@ -125,6 +127,10 @@ commands manipulate the list of modules to be loaded a Modules blacklisted are considered disabled by .Ic toggle-module . These commands will override any such restriction as needed. +The +.Ic show-module-options +command will dump the list of modules that loader has been made aware of and +any applicable options using paged output. .Ss Exported Functions The following functions are exported from .Nm : Modified: head/stand/lua/config.lua == --- head/stand/lua/config.lua Thu Dec 17 18:15:07 2020(r368727) +++ head/stand/lua/config.lua Thu Dec 17 18:24:36 2020(r368728) @@ -721,6 +721,13 @@ function config.isModuleEnabled(modname) return not blacklist[modname] end +function config.getModuleInfo() + return { + modules = modules, + blacklist = getBlacklist() + } +end + hook.registerType
Re: svn commit: r368713 - head/usr.sbin/freebsd-update
On Wed, Dec 16, 2020 at 9:43 PM Kyle Evans wrote: > > Author: kevans > Date: Thu Dec 17 03:42:54 2020 > New Revision: 368713 > URL: https://svnweb.freebsd.org/changeset/base/368713 > > Log: > freebsd-update: unconditionally regenerate passwd/login.conf files > > The existing logic is nice in theory, but in practice freebsd-update will > not preserve the timestamps on these files. When doing a major upgrade, e.g. > from 12.1-RELEASE -> 12.2-RELEASE, pwd.mkdb et al. appear in the INDEX and > we clobber the timestamp several times in the process of packaging up the > existing system into /var/db/freebsd-update/files and extracting for > comparisons. This leads to these files not getting regenerated when they're > most likely to be needed. > > Measures could be taken to preserve timestamps, but it's unclear whether > the complexity and overhead of doing so is really outweighed by the marginal > benefit. > > I observed this issue when pkg subsequently failed to install a package that > wanted to add a user, claiming that the user was removed in the process. > bapt@ pointed to this pre-existing bug with freebsd-update as the cause. > > PR: 234014, 232921 > Reviewed by: bapt, emaste > MFC after:1 week > Differential Revision:https://reviews.freebsd.org/D27635 > Bah, I found this one immediately after: PR: 235766 ___ 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: r368713 - head/usr.sbin/freebsd-update
Author: kevans Date: Thu Dec 17 03:42:54 2020 New Revision: 368713 URL: https://svnweb.freebsd.org/changeset/base/368713 Log: freebsd-update: unconditionally regenerate passwd/login.conf files The existing logic is nice in theory, but in practice freebsd-update will not preserve the timestamps on these files. When doing a major upgrade, e.g. from 12.1-RELEASE -> 12.2-RELEASE, pwd.mkdb et al. appear in the INDEX and we clobber the timestamp several times in the process of packaging up the existing system into /var/db/freebsd-update/files and extracting for comparisons. This leads to these files not getting regenerated when they're most likely to be needed. Measures could be taken to preserve timestamps, but it's unclear whether the complexity and overhead of doing so is really outweighed by the marginal benefit. I observed this issue when pkg subsequently failed to install a package that wanted to add a user, claiming that the user was removed in the process. bapt@ pointed to this pre-existing bug with freebsd-update as the cause. PR: 234014, 232921 Reviewed by: bapt, emaste MFC after:1 week Differential Revision:https://reviews.freebsd.org/D27635 Modified: head/usr.sbin/freebsd-update/freebsd-update.sh Modified: head/usr.sbin/freebsd-update/freebsd-update.sh == --- head/usr.sbin/freebsd-update/freebsd-update.sh Thu Dec 17 02:54:32 2020(r368712) +++ head/usr.sbin/freebsd-update/freebsd-update.sh Thu Dec 17 03:42:54 2020(r368713) @@ -2949,17 +2949,9 @@ Kernel updates have been installed. Please reboot and env DESTDIR=${BASEDIR} certctl rehash fi - # Rebuild generated pwd files. - if [ ${BASEDIR}/etc/master.passwd -nt ${BASEDIR}/etc/spwd.db ] || - [ ${BASEDIR}/etc/master.passwd -nt ${BASEDIR}/etc/pwd.db ] || - [ ${BASEDIR}/etc/master.passwd -nt ${BASEDIR}/etc/passwd ]; then - pwd_mkdb -d ${BASEDIR}/etc -p ${BASEDIR}/etc/master.passwd - fi - - # Rebuild /etc/login.conf.db if necessary. - if [ ${BASEDIR}/etc/login.conf -nt ${BASEDIR}/etc/login.conf.db ]; then - cap_mkdb ${BASEDIR}/etc/login.conf - fi + # Rebuild generated pwd files and /etc/login.conf.db. + pwd_mkdb -d ${BASEDIR}/etc -p ${BASEDIR}/etc/master.passwd + cap_mkdb ${BASEDIR}/etc/login.conf # Rebuild man page databases, if necessary. for D in /usr/share/man /usr/share/openssl/man; do ___ 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: r368683 - stable/12/sys/kern
Author: kevans Date: Tue Dec 15 21:54:31 2020 New Revision: 368683 URL: https://svnweb.freebsd.org/changeset/base/368683 Log: MFC r368326: kern: soclose: don't sleep on SO_LINGER w/ timeout=0 This is a valid scenario that's handled in the various protocol layers where it makes sense (e.g., tcp_disconnect and sctp_disconnect). Given that it indicates we should immediately drop the connection, it makes little sense to sleep on it. This could lead to panics with INVARIANTS. On non-INVARIANTS kernels, this could result in the thread hanging until a signal interrupts it if the protocol does not mark the socket as disconnected for whatever reason. Modified: stable/12/sys/kern/uipc_socket.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/uipc_socket.c == --- stable/12/sys/kern/uipc_socket.cTue Dec 15 21:53:54 2020 (r368682) +++ stable/12/sys/kern/uipc_socket.cTue Dec 15 21:54:31 2020 (r368683) @@ -1090,7 +1090,8 @@ soclose(struct socket *so) goto drop; } } - if (so->so_options & SO_LINGER) { + + if ((so->so_options & SO_LINGER) != 0 && so->so_linger != 0) { if ((so->so_state & SS_ISDISCONNECTING) && (so->so_state & SS_NBIO)) goto drop; ___ 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: r368682 - stable/12/sbin/bectl
Author: kevans Date: Tue Dec 15 21:53:54 2020 New Revision: 368682 URL: https://svnweb.freebsd.org/changeset/base/368682 Log: MFC r368388: bectl: simplify the tail end of the jail cmd This has already confused me once (and I'm pretty sure I wrote it), so let's clarify: unjailing after the command has completed will only happen if we're interactive and -U has not been specified. This just folds two conditionals together to make it obvious how -b/-U interact with each other. Modified: stable/12/sbin/bectl/bectl_jail.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/bectl/bectl_jail.c == --- stable/12/sbin/bectl/bectl_jail.c Tue Dec 15 21:53:15 2020 (r368681) +++ stable/12/sbin/bectl/bectl_jail.c Tue Dec 15 21:53:54 2020 (r368682) @@ -356,10 +356,8 @@ bectl_cmd_jail(int argc, char *argv[]) } free(jargv); - if (!interactive) - return (0); - - if (unjail) { + /* Non-interactive (-b) mode means the jail sticks around. */ + if (interactive && unjail) { /* * We're not checking the jail id result here because in the * case of invalid param, or last command in jail was an error ___ 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: r368681 - stable/12/sys/kern
Author: kevans Date: Tue Dec 15 21:53:15 2020 New Revision: 368681 URL: https://svnweb.freebsd.org/changeset/base/368681 Log: MFC r368462: cpuset_set{affinity,domain}: do not allow empty masks cpuset_modify() would not currently catch this, because it only checks that the new mask is a subset of the root set and circumvents the EDEADLK check in cpuset_testupdate(). This change both directly validates the mask coming in since we can trivially detect an empty mask, and it updates cpuset_testupdate to catch stuff like this going forward by always ensuring we don't end up with an empty mask. The check_mask argument has been renamed because the 'check' verbiage does not imply to me that it's actually doing a different operation. We're either augmenting the existing mask, or we are replacing it entirely. Modified: stable/12/sys/kern/kern_cpuset.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_cpuset.c == --- stable/12/sys/kern/kern_cpuset.cTue Dec 15 21:52:31 2020 (r368680) +++ stable/12/sys/kern/kern_cpuset.cTue Dec 15 21:53:15 2020 (r368681) @@ -633,7 +633,7 @@ domainset_shadow(const struct domainset *pdomain, * empty as well as RDONLY flags. */ static int -cpuset_testupdate(struct cpuset *set, cpuset_t *mask, int check_mask) +cpuset_testupdate(struct cpuset *set, cpuset_t *mask, int augment_mask) { struct cpuset *nset; cpuset_t newmask; @@ -642,13 +642,14 @@ cpuset_testupdate(struct cpuset *set, cpuset_t *mask, mtx_assert(&cpuset_lock, MA_OWNED); if (set->cs_flags & CPU_SET_RDONLY) return (EPERM); - if (check_mask) { - if (!CPU_OVERLAP(&set->cs_mask, mask)) - return (EDEADLK); + if (augment_mask) { CPU_COPY(&set->cs_mask, &newmask); CPU_AND(&newmask, mask); } else CPU_COPY(mask, &newmask); + + if (CPU_EMPTY(&newmask)) + return (EDEADLK); error = 0; LIST_FOREACH(nset, &set->cs_children, cs_siblings) if ((error = cpuset_testupdate(nset, &newmask, 1)) != 0) @@ -723,7 +724,7 @@ out: */ static int cpuset_testupdate_domain(struct cpuset *set, struct domainset *dset, -struct domainset *orig, int *count, int check_mask) +struct domainset *orig, int *count, int augment_mask __unused) { struct cpuset *nset; struct domainset *domain; @@ -1923,6 +1924,10 @@ kern_cpuset_setaffinity(struct thread *td, cpulevel_t } } + if (CPU_EMPTY(mask)) { + error = EDEADLK; + goto out; + } switch (level) { case CPU_LEVEL_ROOT: case CPU_LEVEL_CPUSET: @@ -2177,6 +2182,10 @@ kern_cpuset_setdomain(struct thread *td, cpulevel_t le goto out; } + } + if (DOMAINSET_EMPTY(mask)) { + error = EDEADLK; + goto out; } DOMAINSET_COPY(mask, &domain.ds_mask); domain.ds_policy = policy; ___ 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: r368680 - stable/12/sys/kern
Author: kevans Date: Tue Dec 15 21:52:31 2020 New Revision: 368680 URL: https://svnweb.freebsd.org/changeset/base/368680 Log: MFC r368461: kern: cpuset: resolve race between cpuset_lookup/cpuset_rel The race plays out like so between threads A and B: 1. A ref's cpuset 10 2. B does a lookup of cpuset 10, grabs the cpuset lock and searches cpuset_ids 3. A rel's cpuset 10 and observes the last ref, waits on the cpuset lock while B is still searching and not yet ref'd 4. B ref's cpuset 10 and drops the cpuset lock 5. A proceeds to free the cpuset out from underneath B Resolve the race by only releasing the last reference under the cpuset lock. Thread A now picks up the spinlock and observes that the cpuset has been revived, returning immediately for B to deal with later. Modified: stable/12/sys/kern/kern_cpuset.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_cpuset.c == --- stable/12/sys/kern/kern_cpuset.cTue Dec 15 21:51:45 2020 (r368679) +++ stable/12/sys/kern/kern_cpuset.cTue Dec 15 21:52:31 2020 (r368680) @@ -207,9 +207,13 @@ cpuset_rel(struct cpuset *set) { cpusetid_t id; - if (refcount_release(&set->cs_ref) == 0) + if (refcount_release_if_not_last(&set->cs_ref)) return; mtx_lock_spin(&cpuset_lock); + if (!refcount_release(&set->cs_ref)) { + mtx_unlock_spin(&cpuset_lock); + return; + } LIST_REMOVE(set, cs_siblings); id = set->cs_id; if (id != CPUSET_INVALID) @@ -229,9 +233,13 @@ static void cpuset_rel_defer(struct setlist *head, struct cpuset *set) { - if (refcount_release(&set->cs_ref) == 0) + if (refcount_release_if_not_last(&set->cs_ref)) return; mtx_lock_spin(&cpuset_lock); + if (!refcount_release(&set->cs_ref)) { + mtx_unlock_spin(&cpuset_lock); + return; + } LIST_REMOVE(set, cs_siblings); if (set->cs_id != CPUSET_INVALID) LIST_REMOVE(set, cs_link); ___ 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: r368679 - stable/12/sys/kern
Author: kevans Date: Tue Dec 15 21:51:45 2020 New Revision: 368679 URL: https://svnweb.freebsd.org/changeset/base/368679 Log: MFC r368460: kern: cpuset: plug a unr leak cpuset_rel_defer() is supposed to be functionally equivalent to cpuset_rel() but with anything that might sleep deferred until cpuset_rel_complete -- this setup is used specifically for cpuset_setproc. Add in the missing unr free to match cpuset_rel. This fixes a leak that was observed when I wrote a small userland application to try and debug another issue, which effectively did: cpuset(&newid); cpuset(&scratch); newid gets leaked when scratch is created; it's off the list, so there's no mechanism for anything else to relinquish it. A more realistic reproducer would likely be a process that inherits some cpuset that it's the only ref for, but it creates a new one to modify. Alternatively, administratively reassigning a process' cpuset that it's the last ref for will have the same effect. Modified: stable/12/sys/kern/kern_cpuset.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_cpuset.c == --- stable/12/sys/kern/kern_cpuset.cTue Dec 15 21:50:05 2020 (r368678) +++ stable/12/sys/kern/kern_cpuset.cTue Dec 15 21:51:45 2020 (r368679) @@ -246,9 +246,14 @@ cpuset_rel_defer(struct setlist *head, struct cpuset * static void cpuset_rel_complete(struct cpuset *set) { + cpusetid_t id; + + id = set->cs_id; LIST_REMOVE(set, cs_link); cpuset_rel(set->cs_parent); uma_zfree(cpuset_zone, set); + if (id != CPUSET_INVALID) + free_unr(cpuset_unr, id); } /* ___ 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: r368678 - in stable: 11/secure/caroot/blacklisted 11/secure/caroot/trusted 12/secure/caroot/blacklisted 12/secure/caroot/trusted
Author: kevans Date: Tue Dec 15 21:50:05 2020 New Revision: 368678 URL: https://svnweb.freebsd.org/changeset/base/368678 Log: MFC r368555: caroot: update bundle Summary: - One (1) added - Ten (10) removed Added: stable/12/secure/caroot/blacklisted/GeoTrust_Global_CA.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/GeoTrust_Global_CA.pem stable/12/secure/caroot/blacklisted/GeoTrust_Primary_Certification_Authority.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/GeoTrust_Primary_Certification_Authority.pem stable/12/secure/caroot/blacklisted/GeoTrust_Primary_Certification_Authority_-_G3.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/GeoTrust_Primary_Certification_Authority_-_G3.pem stable/12/secure/caroot/blacklisted/GeoTrust_Universal_CA.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/GeoTrust_Universal_CA.pem stable/12/secure/caroot/blacklisted/GeoTrust_Universal_CA_2.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/GeoTrust_Universal_CA_2.pem stable/12/secure/caroot/blacklisted/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G4.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G4.pem stable/12/secure/caroot/blacklisted/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5.pem stable/12/secure/caroot/blacklisted/thawte_Primary_Root_CA.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/thawte_Primary_Root_CA.pem stable/12/secure/caroot/blacklisted/thawte_Primary_Root_CA_-_G2.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/thawte_Primary_Root_CA_-_G2.pem stable/12/secure/caroot/blacklisted/thawte_Primary_Root_CA_-_G3.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/thawte_Primary_Root_CA_-_G3.pem stable/12/secure/caroot/trusted/NAVER_Global_Root_Certification_Authority.pem - copied unchanged from r368555, head/secure/caroot/trusted/NAVER_Global_Root_Certification_Authority.pem Deleted: stable/12/secure/caroot/trusted/GeoTrust_Global_CA.pem stable/12/secure/caroot/trusted/GeoTrust_Primary_Certification_Authority.pem stable/12/secure/caroot/trusted/GeoTrust_Primary_Certification_Authority_-_G3.pem stable/12/secure/caroot/trusted/GeoTrust_Universal_CA.pem stable/12/secure/caroot/trusted/GeoTrust_Universal_CA_2.pem stable/12/secure/caroot/trusted/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G4.pem stable/12/secure/caroot/trusted/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5.pem stable/12/secure/caroot/trusted/thawte_Primary_Root_CA.pem stable/12/secure/caroot/trusted/thawte_Primary_Root_CA_-_G2.pem stable/12/secure/caroot/trusted/thawte_Primary_Root_CA_-_G3.pem Modified: Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Added: stable/11/secure/caroot/blacklisted/GeoTrust_Global_CA.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/GeoTrust_Global_CA.pem stable/11/secure/caroot/blacklisted/GeoTrust_Primary_Certification_Authority.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/GeoTrust_Primary_Certification_Authority.pem stable/11/secure/caroot/blacklisted/GeoTrust_Primary_Certification_Authority_-_G3.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/GeoTrust_Primary_Certification_Authority_-_G3.pem stable/11/secure/caroot/blacklisted/GeoTrust_Universal_CA.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/GeoTrust_Universal_CA.pem stable/11/secure/caroot/blacklisted/GeoTrust_Universal_CA_2.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/GeoTrust_Universal_CA_2.pem stable/11/secure/caroot/blacklisted/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G4.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G4.pem stable/11/secure/caroot/blacklisted/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5.pem stable/11/secure/caroot/blacklisted/thawte_Primary_Root_CA.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/thawte_Primary_Root_CA.pem stable/11/secure/caroot/blacklisted/thawte_Primary_Root_CA_-_G2.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/thawte_Primary_Root_CA_-_G2.pem stable/11/secure/caroot/blacklisted/thawte_Primary_Root_CA_-_G3.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/thawte_Prima
svn commit: r368678 - in stable: 11/secure/caroot/blacklisted 11/secure/caroot/trusted 12/secure/caroot/blacklisted 12/secure/caroot/trusted
Author: kevans Date: Tue Dec 15 21:50:05 2020 New Revision: 368678 URL: https://svnweb.freebsd.org/changeset/base/368678 Log: MFC r368555: caroot: update bundle Summary: - One (1) added - Ten (10) removed Added: stable/11/secure/caroot/blacklisted/GeoTrust_Global_CA.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/GeoTrust_Global_CA.pem stable/11/secure/caroot/blacklisted/GeoTrust_Primary_Certification_Authority.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/GeoTrust_Primary_Certification_Authority.pem stable/11/secure/caroot/blacklisted/GeoTrust_Primary_Certification_Authority_-_G3.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/GeoTrust_Primary_Certification_Authority_-_G3.pem stable/11/secure/caroot/blacklisted/GeoTrust_Universal_CA.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/GeoTrust_Universal_CA.pem stable/11/secure/caroot/blacklisted/GeoTrust_Universal_CA_2.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/GeoTrust_Universal_CA_2.pem stable/11/secure/caroot/blacklisted/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G4.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G4.pem stable/11/secure/caroot/blacklisted/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5.pem stable/11/secure/caroot/blacklisted/thawte_Primary_Root_CA.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/thawte_Primary_Root_CA.pem stable/11/secure/caroot/blacklisted/thawte_Primary_Root_CA_-_G2.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/thawte_Primary_Root_CA_-_G2.pem stable/11/secure/caroot/blacklisted/thawte_Primary_Root_CA_-_G3.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/thawte_Primary_Root_CA_-_G3.pem stable/11/secure/caroot/trusted/NAVER_Global_Root_Certification_Authority.pem - copied unchanged from r368555, head/secure/caroot/trusted/NAVER_Global_Root_Certification_Authority.pem Deleted: stable/11/secure/caroot/trusted/GeoTrust_Global_CA.pem stable/11/secure/caroot/trusted/GeoTrust_Primary_Certification_Authority.pem stable/11/secure/caroot/trusted/GeoTrust_Primary_Certification_Authority_-_G3.pem stable/11/secure/caroot/trusted/GeoTrust_Universal_CA.pem stable/11/secure/caroot/trusted/GeoTrust_Universal_CA_2.pem stable/11/secure/caroot/trusted/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G4.pem stable/11/secure/caroot/trusted/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5.pem stable/11/secure/caroot/trusted/thawte_Primary_Root_CA.pem stable/11/secure/caroot/trusted/thawte_Primary_Root_CA_-_G2.pem stable/11/secure/caroot/trusted/thawte_Primary_Root_CA_-_G3.pem Modified: Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Added: stable/12/secure/caroot/blacklisted/GeoTrust_Global_CA.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/GeoTrust_Global_CA.pem stable/12/secure/caroot/blacklisted/GeoTrust_Primary_Certification_Authority.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/GeoTrust_Primary_Certification_Authority.pem stable/12/secure/caroot/blacklisted/GeoTrust_Primary_Certification_Authority_-_G3.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/GeoTrust_Primary_Certification_Authority_-_G3.pem stable/12/secure/caroot/blacklisted/GeoTrust_Universal_CA.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/GeoTrust_Universal_CA.pem stable/12/secure/caroot/blacklisted/GeoTrust_Universal_CA_2.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/GeoTrust_Universal_CA_2.pem stable/12/secure/caroot/blacklisted/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G4.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G4.pem stable/12/secure/caroot/blacklisted/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5.pem stable/12/secure/caroot/blacklisted/thawte_Primary_Root_CA.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/thawte_Primary_Root_CA.pem stable/12/secure/caroot/blacklisted/thawte_Primary_Root_CA_-_G2.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/thawte_Primary_Root_CA_-_G2.pem stable/12/secure/caroot/blacklisted/thawte_Primary_Root_CA_-_G3.pem - copied unchanged from r368555, head/secure/caroot/blacklisted/thawte_Prima
svn commit: r368591 - in head/stand: common liblua
Author: kevans Date: Sat Dec 12 21:25:38 2020 New Revision: 368591 URL: https://svnweb.freebsd.org/changeset/base/368591 Log: stand: liblua: add a pager module This is nearly a 1:1 mapping of the pager API from libsa. The only real difference is that pager.output() will accept any number of arguments and coerce all of them to strings for output using luaL_tolstring (i.e. the __tostring metamethod will be used). The only consumer planned at this time is the upcoming "show-module-options" implementation. MFC after:1 week Added: head/stand/liblua/lpager.c (contents, props changed) Modified: head/stand/common/interp_lua.c head/stand/liblua/Makefile head/stand/liblua/lutils.h Modified: head/stand/common/interp_lua.c == --- head/stand/common/interp_lua.c Sat Dec 12 21:02:24 2020 (r368590) +++ head/stand/common/interp_lua.c Sat Dec 12 21:25:38 2020 (r368591) @@ -95,6 +95,7 @@ static const luaL_Reg loadedlibs[] = { {"io", luaopen_io}, {"lfs", luaopen_lfs}, {"loader", luaopen_loader}, + {"pager", luaopen_pager}, {NULL, NULL} }; Modified: head/stand/liblua/Makefile == --- head/stand/liblua/Makefile Sat Dec 12 21:02:24 2020(r368590) +++ head/stand/liblua/Makefile Sat Dec 12 21:25:38 2020(r368591) @@ -23,7 +23,7 @@ SRCS+=lauxlib.c lbaselib.c lstrlib.c loadlib.c #SRCS+=lbitlib.c liolib.c lmathlib.c loslib.c ltablib.c # Our utilities. -SRCS+= lerrno.c lstd.c lutils.c +SRCS+= lerrno.c lpager.c lstd.c lutils.c .PATH: ${FLUASRC}/modules SRCS+= lfs.c Added: head/stand/liblua/lpager.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/stand/liblua/lpager.c Sat Dec 12 21:25:38 2020(r368591) @@ -0,0 +1,89 @@ +/*- + * Copyright (c) 2020 Kyle Evans + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include "lauxlib.h" + +/* Open the pager. No arguments, no return value. */ +static int +lpager_open(lua_State *L) +{ + + pager_open(); + return (0); +} + +/* + * Output to the pager. All arguments are interpreted as strings and passed to + * pager_output(). No return value. + */ +static int +lpager_output(lua_State *L) +{ + const char *outstr; + int i; + + for (i = 1; i <= lua_gettop(L); i++) { + outstr = luaL_tolstring(L, i, NULL); + pager_output(outstr); + lua_pop(L, -1); + } + + return (0); +} + +/* Output to the pager from a file. Takes a filename, no return value. */ +static int +lpager_file(lua_State *L) +{ + + return (pager_file(luaL_checkstring(L, 1))); +} + +static int +lpager_close(lua_State *L) +{ + + pager_close(); + return (0); +} + +static const struct luaL_Reg pagerlib[] = { + { "open", lpager_open }, + { "output", lpager_output }, + { "file", lpager_file }, + { "close", lpager_close }, + { NULL, NULL }, +}; + +int +luaopen_pager(lua_State *L) +{ + luaL_newlib(L, pagerlib); + return 1; +} Modified: head/stand/liblua/lutils.h == --- head/stand/liblua/lutils.h Sat Dec 12 21:02:24 2020(r368590) +++ head/stand/liblua/lutils.h Sat Dec 12 21:25:38 2020(r368591
svn commit: r368579 - head/stand/lua
Author: kevans Date: Sat Dec 12 14:53:34 2020 New Revision: 368579 URL: https://svnweb.freebsd.org/changeset/base/368579 Log: lualoader: config: fix module enabled check A last minute rewrite left this logically wrong; if it's present in modules_blacklist, then we do not load it. Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua == --- head/stand/lua/config.lua Sat Dec 12 11:51:29 2020(r368578) +++ head/stand/lua/config.lua Sat Dec 12 14:53:34 2020(r368579) @@ -718,7 +718,7 @@ function config.isModuleEnabled(modname) end local blacklist = getBlacklist() - return blacklist[modname] + return not blacklist[modname] end hook.registerType("config.loaded") ___ 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"
Re: svn commit: r368575 - head/stand/lua
On Sat, Dec 12, 2020 at 8:17 AM Toomas Soome wrote: > > On 12. Dec 2020, at 16:10, Kyle Evans wrote: > > > > On Sat, Dec 12, 2020 at 1:35 AM Toomas Soome wrote: > >> > >> How about ’show-module-options’? > >> > >> rgds, > >> toomas > >> > > > > I missed that one. My 4th is a bit rusty, but it looks like this > > should just be enumerating over config's local modules table and > > dumping everything in sight? > > > > Yes, with pager or it is a bit useless. > Hmm... we don't currently expose the pager routines to lua, so I'll write a quick pager module to do so. I'll write the lua-side to use the pager if it's available but fallback to dumping it all out otherwise (which, thinking about the modules I typically have installed and looking at a test-run of 4thloader's show-module-options on an even more minimal system, 100% agree). ___ 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"
Re: svn commit: r368575 - head/stand/lua
On Sat, Dec 12, 2020 at 1:35 AM Toomas Soome wrote: > > How about ’show-module-options’? > > rgds, > toomas > I missed that one. My 4th is a bit rusty, but it looks like this should just be enumerating over config's local modules table and dumping everything in sight? Thanks, Kyle Evans ___ 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: r368575 - head/stand/lua
Author: kevans Date: Sat Dec 12 05:57:42 2020 New Revision: 368575 URL: https://svnweb.freebsd.org/changeset/base/368575 Log: lualoader: provide module-manipulation commands Specifically, we have: - enable-module - disable-module - toggle-module These can be used to add/remove modules to be loaded or force modules to be loaded in spite of modules_blacklist. In the typical case, a user is expected to use them to recover an issue happening due to a module directive they've added to their loader.conf or because they discover that they've under-specified what to load. MFC after:1 week Modified: head/stand/lua/cli.lua head/stand/lua/cli.lua.8 head/stand/lua/config.lua head/stand/lua/config.lua.8 Modified: head/stand/lua/cli.lua == --- head/stand/lua/cli.lua Sat Dec 12 02:26:43 2020(r368574) +++ head/stand/lua/cli.lua Sat Dec 12 05:57:42 2020(r368575) @@ -65,6 +65,14 @@ local function parseBootArgs(argv, with_kernel) end end +local function setModule(module, loading) + if loading and config.enableModule(module) then + print(module .. " will be loaded") + elseif not loading and config.disableModule(module) then + print(module .. " will not be loaded") + end +end + -- Declares a global function cli_execute that attempts to dispatch the -- arguments passed as a lua function. This gives lua a chance to intercept -- builtin CLI commands like "boot" @@ -132,6 +140,37 @@ end cli['reload-conf'] = function() config.reload() +end + +cli["enable-module"] = function(...) + local _, argv = cli.arguments(...) + if #argv == 0 then + print("usage error: enable-module module") + return + end + + setModule(argv[1], true) +end + +cli["disable-module"] = function(...) + local _, argv = cli.arguments(...) + if #argv == 0 then + print("usage error: disable-module module") + return + end + + setModule(argv[1], false) +end + +cli["toggle-module"] = function(...) + local _, argv = cli.arguments(...) + if #argv == 0 then + print("usage error: toggle-module module") + return + end + + local module = argv[1] + setModule(module, not config.isModuleEnabled(module)) end -- Used for splitting cli varargs into cmd_name and the rest of argv Modified: head/stand/lua/cli.lua.8 == --- head/stand/lua/cli.lua.8Sat Dec 12 02:26:43 2020(r368574) +++ head/stand/lua/cli.lua.8Sat Dec 12 05:57:42 2020(r368575) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 13, 2019 +.Dd December 12, 2020 .Dt CLI.LUA 8 .Os .Sh NAME @@ -77,14 +77,26 @@ This function may be invoked by a user at the loader p .Ic foo . Arguments may be passed to it as usual, space-delimited. .Ss Default Commands -As of present, the +The .Nm -module by default provides commands for -.Ic autoboot , -.Ic boot , -.Ic boot-conf , -and -.Ic reload-conf . +module provides the following default commands: +.Bl -bullet +.\"-width toggle-module -offset indent +.It +.Ic autoboot +.It +.Ic boot +.It +.Ic boot-conf +.It +.Ic reload-conf +.It +.Ic enable-module +.It +.Ic disable-module +.It +.Ic toggle-module +.El .Pp For .Ic autoboot , @@ -103,6 +115,16 @@ The command will reload the configuration from disk. This is useful if you have manually changed currdev and would like to easily reload the configuration from the new device. +.Pp +The +.Ic enable-module , +.Ic disable-module , +and +.Ic toggle-module +commands manipulate the list of modules to be loaded along with the kernel. +Modules blacklisted are considered disabled by +.Ic toggle-module . +These commands will override any such restriction as needed. .Ss Exported Functions The following functions are exported from .Nm : Modified: head/stand/lua/config.lua == --- head/stand/lua/config.lua Sat Dec 12 02:26:43 2020(r368574) +++ head/stand/lua/config.lua Sat Dec 12 05:57:42 2020(r368575) @@ -312,7 +312,7 @@ local function loadModule(mod, silent) for k, v in pairs(mod) do if v.load ~= nil and v.load:lower() == "yes" then local module_name = v.name or k - if blacklist[module_name] ~= nil then + if not v.force and blacklist[module_name] ~= nil then if not silent then print(MSG_MODBLACKLIST:format(module_name)) end @@ -680,6 +680,45 @@ function config.loadelf() status = loadModule(modules, not config.verbose) hook.runAll("modules.loaded") retu
svn commit: r368555 - in head/secure/caroot: blacklisted trusted
Author: kevans Date: Fri Dec 11 18:14:43 2020 New Revision: 368555 URL: https://svnweb.freebsd.org/changeset/base/368555 Log: caroot: update bundle Summary: - One (1) added - Ten (10) removed MFC after:3 days Added: head/secure/caroot/blacklisted/GeoTrust_Global_CA.pem - copied unchanged from r368554, head/secure/caroot/trusted/GeoTrust_Global_CA.pem head/secure/caroot/blacklisted/GeoTrust_Primary_Certification_Authority.pem - copied unchanged from r368554, head/secure/caroot/trusted/GeoTrust_Primary_Certification_Authority.pem head/secure/caroot/blacklisted/GeoTrust_Primary_Certification_Authority_-_G3.pem - copied unchanged from r368554, head/secure/caroot/trusted/GeoTrust_Primary_Certification_Authority_-_G3.pem head/secure/caroot/blacklisted/GeoTrust_Universal_CA.pem - copied unchanged from r368554, head/secure/caroot/trusted/GeoTrust_Universal_CA.pem head/secure/caroot/blacklisted/GeoTrust_Universal_CA_2.pem - copied unchanged from r368554, head/secure/caroot/trusted/GeoTrust_Universal_CA_2.pem head/secure/caroot/blacklisted/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G4.pem - copied unchanged from r368554, head/secure/caroot/trusted/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G4.pem head/secure/caroot/blacklisted/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5.pem - copied unchanged from r368554, head/secure/caroot/trusted/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5.pem head/secure/caroot/blacklisted/thawte_Primary_Root_CA.pem - copied unchanged from r368554, head/secure/caroot/trusted/thawte_Primary_Root_CA.pem head/secure/caroot/blacklisted/thawte_Primary_Root_CA_-_G2.pem - copied unchanged from r368554, head/secure/caroot/trusted/thawte_Primary_Root_CA_-_G2.pem head/secure/caroot/blacklisted/thawte_Primary_Root_CA_-_G3.pem - copied unchanged from r368554, head/secure/caroot/trusted/thawte_Primary_Root_CA_-_G3.pem head/secure/caroot/trusted/NAVER_Global_Root_Certification_Authority.pem (contents, props changed) Deleted: head/secure/caroot/trusted/GeoTrust_Global_CA.pem head/secure/caroot/trusted/GeoTrust_Primary_Certification_Authority.pem head/secure/caroot/trusted/GeoTrust_Primary_Certification_Authority_-_G3.pem head/secure/caroot/trusted/GeoTrust_Universal_CA.pem head/secure/caroot/trusted/GeoTrust_Universal_CA_2.pem head/secure/caroot/trusted/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G4.pem head/secure/caroot/trusted/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5.pem head/secure/caroot/trusted/thawte_Primary_Root_CA.pem head/secure/caroot/trusted/thawte_Primary_Root_CA_-_G2.pem head/secure/caroot/trusted/thawte_Primary_Root_CA_-_G3.pem Copied: head/secure/caroot/blacklisted/GeoTrust_Global_CA.pem (from r368554, head/secure/caroot/trusted/GeoTrust_Global_CA.pem) == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/secure/caroot/blacklisted/GeoTrust_Global_CA.pem Fri Dec 11 18:14:43 2020(r368555, copy of r368554, head/secure/caroot/trusted/GeoTrust_Global_CA.pem) @@ -0,0 +1,90 @@ +## +## GeoTrust Global CA +## +## This is a single X.509 certificate for a public Certificate +## Authority (CA). It was automatically extracted from Mozilla's +## root CA list (the file `certdata.txt' in security/nss). +## +## Extracted from nss +## with $FreeBSD: head/secure/caroot/MAca-bundle.pl 352951 2019-10-02 01:27:50Z kevans $ +## +## @generated +## +Certificate: +Data: +Version: 3 (0x2) +Serial Number: 144470 (0x23456) +Signature Algorithm: sha1WithRSAEncryption +Issuer: C = US, O = GeoTrust Inc., CN = GeoTrust Global CA +Validity +Not Before: May 21 04:00:00 2002 GMT +Not After : May 21 04:00:00 2022 GMT +Subject: C = US, O = GeoTrust Inc., CN = GeoTrust Global CA +Subject Public Key Info: +Public Key Algorithm: rsaEncryption +RSA Public-Key: (2048 bit) +Modulus: +00:da:cc:18:63:30:fd:f4:17:23:1a:56:7e:5b:df: +3c:6c:38:e4:71:b7:78:91:d4:bc:a1:d8:4c:f8:a8: +43:b6:03:e9:4d:21:07:08:88:da:58:2f:66:39:29: +bd:05:78:8b:9d:38:e8:05:b7:6a:7e:71:a4:e6:c4: +60:a6:b0:ef:80:e4:89:28:0f:9e:25:d6:ed:83:f3: +ad:a6:91:c7:98:c9:42:18:35:14:9d:ad:98:46:92: +2e:4f:ca:f1:87:43:c1:16:95:57:2d:50:ef:89:2d: +80:7a:57:ad:f2:ee:5f:6b:d2:00:8d:b9:14:f8:14: +15:35:d9:c0:46:a3:7b:72:c8:91:bf:c9:55:2b:cd: +d0:97:3e:9c:26:64:cc:df:ce:83:19:71:ca:4e:e6: +d4:d5:7b:a9:19:cd:55:de:c8:ec:d2:5e:38:53:e5: +5c:4f:8c:2d:fe:50:23:36:fc:66:e6:c
svn commit: r368549 - head/share/man/man5
Author: kevans Date: Fri Dec 11 04:02:19 2020 New Revision: 368549 URL: https://svnweb.freebsd.org/changeset/base/368549 Log: src.conf(5): regenerate after WITHOUT_GNU_GREP became default Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 == --- head/share/man/man5/src.conf.5 Fri Dec 11 03:59:41 2020 (r368548) +++ head/share/man/man5/src.conf.5 Fri Dec 11 04:02:19 2020 (r368549) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd December 8, 2020 +.Dd December 10, 2020 .Dt SRC.CONF 5 .Os .Sh NAME @@ -668,8 +668,8 @@ programs instead of the traditional FreeBSD versions. .It Va WITHOUT_GNU_DIFF Set to not build GNU .Xr diff3 1 . -.It Va WITHOUT_GNU_GREP -Set to not build GNU +.It Va WITH_GNU_GREP +Build and install GNU .Xr grep 1 . .It Va WITHOUT_GOOGLETEST Set to neither build nor install ___ 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: r368548 - head/share/mk
Author: kevans Date: Fri Dec 11 03:59:41 2020 New Revision: 368548 URL: https://svnweb.freebsd.org/changeset/base/368548 Log: Flip the GNU_GREP default to OFF bsdgrep was made the default in r368439. Stop building gnugrep entirely as the natural next step towards removal. Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk == --- head/share/mk/src.opts.mk Fri Dec 11 02:22:42 2020(r368547) +++ head/share/mk/src.opts.mk Fri Dec 11 03:59:41 2020(r368548) @@ -108,7 +108,6 @@ __DEFAULT_YES_OPTIONS = \ GAMES \ GH_BC \ GNU_DIFF \ -GNU_GREP \ GOOGLETEST \ GPIO \ HAST \ @@ -208,6 +207,7 @@ __DEFAULT_NO_OPTIONS = \ DTRACE_TESTS \ EXPERIMENTAL \ GDB \ +GNU_GREP \ HESIOD \ LIBSOFT \ LOADER_FIREWIRE \ ___ 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: r368487 - head/sys/netgraph
Author: kevans Date: Wed Dec 9 15:28:56 2020 New Revision: 368487 URL: https://svnweb.freebsd.org/changeset/base/368487 Log: netgraph: macfilter: small fixes Two issues: - The DEBUG macro defined is in direct conflict with the DEBUG kernel option, which broke the -LINT build[0] - Building with NG_MACFILTER_DEBUG did not compile on LP64 systems due to using %d for sizeof(). Reported by: Jenkins[0] Modified: head/sys/netgraph/ng_macfilter.c Modified: head/sys/netgraph/ng_macfilter.c == --- head/sys/netgraph/ng_macfilter.cWed Dec 9 14:05:08 2020 (r368486) +++ head/sys/netgraph/ng_macfilter.cWed Dec 9 15:28:56 2020 (r368487) @@ -76,9 +76,9 @@ MALLOC_DEFINE(M_NETGRAPH_MACFILTER, "netgraph_macfilte #define MACTABLE_BLOCKSIZE 128 /* block size for incrementing table */ #ifdef NG_MACFILTER_DEBUG -#define DEBUG(fmt, ...) printf("%s:%d: " fmt "\n", __FUNCTION__, __LINE__, __VA_ARGS__) +#define MACFILTER_DEBUG(fmt, ...) printf("%s:%d: " fmt "\n", __FUNCTION__, __LINE__, __VA_ARGS__) #else -#define DEBUG(fmt, ...) +#define MACFILTER_DEBUG(fmt, ...) #endif #define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x" #define MAC_S_ARGS(v) (v)[0], (v)[1], (v)[2], (v)[3], (v)[4], (v)[5] @@ -148,7 +148,7 @@ macfilter_get_upper_hook_count(const struct ng_parse_t const struct ngm_macfilter_hooks *const ngm_hooks = (const struct ngm_macfilter_hooks *)(buf - OFFSETOF(struct ngm_macfilter_hooks, hooks)); -DEBUG("buf %p, ngm_hooks %p, n %d", buf, ngm_hooks, ngm_hooks->n); +MACFILTER_DEBUG("buf %p, ngm_hooks %p, n %d", buf, ngm_hooks, ngm_hooks->n); return ngm_hooks->n; } @@ -294,7 +294,7 @@ macfilter_mactable_resize(macfilter_p mfp) n = mfp->mf_mac_allocated + MACTABLE_BLOCKSIZE; if (n != mfp->mf_mac_allocated) { -DEBUG("used=%d allocated=%d->%d", +MACFILTER_DEBUG("used=%d allocated=%d->%d", mfp->mf_mac_used, mfp->mf_mac_allocated, n); mf_mac_p mfp_new = realloc(mfp->mf_macs, @@ -410,7 +410,7 @@ macfilter_mactable_change(macfilter_p mfp, u_char *eth mf_mac_p mf_macs = mfp->mf_macs; -DEBUG("ether=" MAC_FMT " found=%d i=%d ether=" MAC_FMT " hookid=%d->%d used=%d allocated=%d", +MACFILTER_DEBUG("ether=" MAC_FMT " found=%d i=%d ether=" MAC_FMT " hookid=%d->%d used=%d allocated=%d", MAC_S_ARGS(ether), found, i, MAC_S_ARGS(mf_macs[i].ether), (found? mf_macs[i].hookid:NG_MACFILTER_HOOK_DEFAULT_ID), hookid, mfp->mf_mac_used, mfp->mf_mac_allocated); @@ -493,7 +493,7 @@ macfilter_find_hook(macfilter_p mfp, const char *hookn static int macfilter_direct(macfilter_p mfp, struct ngm_macfilter_direct *md) { -DEBUG("ether=" MAC_FMT " hook=%s", +MACFILTER_DEBUG("ether=" MAC_FMT " hook=%s", MAC_S_ARGS(md->ether), md->hookname); int hookid = macfilter_find_hook(mfp, md->hookname); @@ -506,7 +506,7 @@ macfilter_direct(macfilter_p mfp, struct ngm_macfilter static int macfilter_direct_hookid(macfilter_p mfp, struct ngm_macfilter_direct_hookid *mdi) { -DEBUG("ether=" MAC_FMT " hookid=%d", +MACFILTER_DEBUG("ether=" MAC_FMT " hookid=%d", MAC_S_ARGS(mdi->ether), mdi->hookid); if (mdi->hookid >= mfp->mf_upper_cnt) @@ -545,13 +545,13 @@ macfilter_ether_output(hook_p hook, macfilter_p mfp, s mf_macs[i].bytes_out += m->m_len - ETHER_HDR_LEN; #ifdef NG_MACFILTER_DEBUG_RECVDATA -DEBUG("ether=" MAC_FMT " len=%db->%lldb: bytes: %s -> %s", +MACFILTER_DEBUG("ether=" MAC_FMT " len=%db->%lldb: bytes: %s -> %s", MAC_S_ARGS(ether), m->m_len - ETHER_HDR_LEN, mf_macs[i].bytes_out, NG_HOOK_NAME(hook), NG_HOOK_NAME(*next_hook)); #endif } else { #ifdef NG_MACFILTER_DEBUG_RECVDATA -DEBUG("ether=" MAC_FMT " len=%db->?b: bytes: %s->%s", +MACFILTER_DEBUG("ether=" MAC_FMT " len=%db->?b: bytes: %s->%s", MAC_S_ARGS(ether), m->m_len - ETHER_HDR_LEN, NG_HOOK_NAME(hook), NG_HOOK_NAME(*next_hook)); #endif @@ -587,13 +587,13 @@ macfilter_ether_input(hook_p hook, macfilter_p mfp, st hookid = mf_macs[i].hookid; #ifdef NG_MACFILTER_DEBUG_RECVDATA -DEBUG("ether=" MAC_FMT " len=%db->%lldb: bytes: %s->%s", +MACFILTER_DEBUG("ether=" MAC_FMT " len=%db->%lldb: bytes: %s->%s", MAC_S_ARGS(ether), m->m_len - ETHER_HDR_LEN, mf_macs[i].bytes_in, NG_HOOK_NAME(hook), NG_HOOK_NAME(*next_hook)); #endif } else { #ifdef NG_MACFILTER_DEBUG_RECVDATA -DEBUG("ether=" MAC_FMT " len=%db->?b: bytes: %s->%s", +MACFILTER_DEBUG("ether=" MAC_FMT " len=%db->?b: bytes: %s->%s", MAC_S_ARGS(ether), m->m_len - ETHER_HDR_LEN, NG_HOOK_NAME(hook), NG_HOOK_NAME(*next_hook)); #endif @@ -642,7 +642,7 @@ ng_macf
svn commit: r368483 - head/usr.bin/grep
Author: kevans Date: Wed Dec 9 05:27:45 2020 New Revision: 368483 URL: https://svnweb.freebsd.org/changeset/base/368483 Log: grep: replace the internal queue with a ring buffer We know up front how many items we can have in the queue (-B/Bflag), so pay the cost of those particular allocations early on. The reduced queue maintenance overhead seemed to yield about an ~8% improvement for my earlier `grep -C8 -r closefrom .` test. MFC after:2 weeks Modified: head/usr.bin/grep/grep.c head/usr.bin/grep/grep.h head/usr.bin/grep/queue.c Modified: head/usr.bin/grep/grep.c == --- head/usr.bin/grep/grep.cWed Dec 9 05:12:04 2020(r368482) +++ head/usr.bin/grep/grep.cWed Dec 9 05:27:45 2020(r368483) @@ -707,6 +707,8 @@ main(int argc, char *argv[]) if ((aargc == 0 || aargc == 1) && !Hflag) hflag = true; + initqueue(); + if (aargc == 0 && dirbehave != DIR_RECURSE) exit(!procfile("-")); Modified: head/usr.bin/grep/grep.h == --- head/usr.bin/grep/grep.hWed Dec 9 05:12:04 2020(r368482) +++ head/usr.bin/grep/grep.hWed Dec 9 05:27:45 2020(r368483) @@ -149,6 +149,7 @@ char*grep_strdup(const char *str); voidgrep_printline(struct str *line, int sep); /* queue.c */ +voidinitqueue(void); boolenqueue(struct str *x); voidprintqueue(void); voidclearqueue(void); Modified: head/usr.bin/grep/queue.c == --- head/usr.bin/grep/queue.c Wed Dec 9 05:12:04 2020(r368482) +++ head/usr.bin/grep/queue.c Wed Dec 9 05:27:45 2020(r368483) @@ -6,6 +6,7 @@ * * Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav * All rights reserved. + * Copyright (c) 2020 Kyle Evans * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -45,77 +46,99 @@ __FBSDID("$FreeBSD$"); #include "grep.h" -struct qentry { - STAILQ_ENTRY(qentry)list; - struct str data; -}; +typedef struct str qentry_t; -static STAILQ_HEAD(, qentry) queue = STAILQ_HEAD_INITIALIZER(queue); -static long long count; +static long long filled; +static qentry_t*qend, *qpool; -static struct qentry *dequeue(void); - /* - * Enqueue another line; return true if we've dequeued a line as a result + * qnext is the next entry to populate. qlist is where the list actually + * starts, for the purposes of printing. */ -bool -enqueue(struct str *x) +static qentry_t*qlist, *qnext; + +void +initqueue(void) { - struct qentry *item; - item = grep_malloc(sizeof(struct qentry)); - item->data.dat = grep_malloc(sizeof(char) * x->len); - item->data.len = x->len; - item->data.line_no = x->line_no; - item->data.boff = x->boff; - item->data.off = x->off; - memcpy(item->data.dat, x->dat, x->len); - item->data.file = x->file; + qlist = qnext = qpool = grep_calloc(Bflag, sizeof(*qpool)); + qend = qpool + (Bflag - 1); +} - STAILQ_INSERT_TAIL(&queue, item, list); +static qentry_t * +advqueue(qentry_t *itemp) +{ - if (++count > Bflag) { - item = dequeue(); - free(item->data.dat); - free(item); - return (true); - } - return (false); + if (itemp == qend) + return (qpool); + return (itemp + 1); } -static struct qentry * -dequeue(void) +/* + * Enqueue another line; return true if we've dequeued a line as a result + */ +bool +enqueue(struct str *x) { - struct qentry *item; + qentry_t *item; + bool rotated; - item = STAILQ_FIRST(&queue); - if (item == NULL) - return (NULL); + item = qnext; + qnext = advqueue(qnext); + rotated = false; - STAILQ_REMOVE_HEAD(&queue, list); - --count; - return (item); + if (filled < Bflag) { + filled++; + } else if (filled == Bflag) { + /* We had already filled up coming in; just rotate. */ + qlist = advqueue(qlist); + rotated = true; + free(item->dat); + } + item->dat = grep_malloc(sizeof(char) * x->len); + item->len = x->len; + item->line_no = x->line_no; + item->boff = x->boff; + item->off = x->off; + memcpy(item->dat, x->dat, x->len); + item->file = x->file; + + return (rotated); }
svn commit: r368482 - head/usr.bin/grep/tests
Author: kevans Date: Wed Dec 9 05:12:04 2020 New Revision: 368482 URL: https://svnweb.freebsd.org/changeset/base/368482 Log: grep: tests: stop expecting a failure of gnuext w/ bsdgrep libregex now supports these and we no longer offer to not link against libregex. Modified: head/usr.bin/grep/tests/grep_freebsd_test.sh Modified: head/usr.bin/grep/tests/grep_freebsd_test.sh == --- head/usr.bin/grep/tests/grep_freebsd_test.shWed Dec 9 03:24:09 2020(r368481) +++ head/usr.bin/grep/tests/grep_freebsd_test.shWed Dec 9 05:12:04 2020(r368482) @@ -87,9 +87,7 @@ gnuext_body() { grep_type _type=$? - if [ $_type -eq $GREP_TYPE_BSD ]; then - atf_expect_fail "this test requires GNU extensions in regex(3)" - elif [ $_type -eq $GREP_TYPE_GNU_FREEBSD ]; then + if [ $_type -eq $GREP_TYPE_GNU_FREEBSD ]; then atf_expect_fail "\\s and \\S are known to be buggy in base gnugrep" fi ___ 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: r368481 - in head/usr.bin: kdump truss
Author: kevans Date: Wed Dec 9 03:24:09 2020 New Revision: 368481 URL: https://svnweb.freebsd.org/changeset/base/368481 Log: kdump/truss: decode new _umtx_op flags In both cases, print the flag bits first followed by the command. Output now looks something like this: (ktrace) _umtx_op(0x8605f7008,0xf,0,0,0) _umtx_op(0x9fffdce8,0x8003,0x1,0,0) (truss) _umtx_op(0x7fffda50,UMTX_OP_WAKE,0x1,0x0,0x0) = 0 (0x0) _umtx_op(0x9fffdd08,UMTX_OP__32BIT|UMTX_OP_WAKE,0x1,0x0,0x0) = 0 (0x0) Reviewed by: kib Differential Revision:https://reviews.freebsd.org/D27325 Modified: head/usr.bin/kdump/kdump.c head/usr.bin/truss/syscalls.c Modified: head/usr.bin/kdump/kdump.c == --- head/usr.bin/kdump/kdump.c Wed Dec 9 03:22:44 2020(r368480) +++ head/usr.bin/kdump/kdump.c Wed Dec 9 03:24:09 2020(r368481) @@ -254,14 +254,21 @@ print_integer_arg_valid(const char *(*decoder)(int), i } } +static bool +print_mask_arg_part(bool (*decoder)(FILE *, int, int *), int value, int *rem) +{ + + printf("%#x<", value); + return (decoder(stdout, value, rem)); +} + static void print_mask_arg(bool (*decoder)(FILE *, int, int *), int value) { bool invalid; int rem; - printf("%#x<", value); - invalid = !decoder(stdout, value, &rem); + invalid = !print_mask_arg_part(decoder, value, &rem); printf(">"); if (invalid) printf("%u", rem); @@ -1455,10 +1462,16 @@ ktrsyscall(struct ktr_syscall *ktr, u_int sv_flags) ip++; narg--; break; - case SYS__umtx_op: + case SYS__umtx_op: { + int op; + print_number(ip, narg, c); putchar(','); - print_integer_arg(sysdecode_umtx_op, *ip); + if (print_mask_arg_part(sysdecode_umtx_op_flags, + *ip, &op)) + putchar('|'); + print_integer_arg(sysdecode_umtx_op, op); + putchar('>'); switch (*ip) { case UMTX_OP_CV_WAIT: ip++; @@ -1478,6 +1491,7 @@ ktrsyscall(struct ktr_syscall *ktr, u_int sv_flags) ip++; narg--; break; + } case SYS_ftruncate: case SYS_truncate: print_number(ip, narg, c); Modified: head/usr.bin/truss/syscalls.c == --- head/usr.bin/truss/syscalls.c Wed Dec 9 03:22:44 2020 (r368480) +++ head/usr.bin/truss/syscalls.c Wed Dec 9 03:24:09 2020 (r368481) @@ -888,12 +888,20 @@ print_integer_arg(const char *(*decoder)(int), FILE *f fprintf(fp, "%d", value); } +static bool +print_mask_arg_part(bool (*decoder)(FILE *, int, int *), FILE *fp, int value, +int *rem) +{ + + return (decoder(fp, value, rem)); +} + static void print_mask_arg(bool (*decoder)(FILE *, int, int *), FILE *fp, int value) { int rem; - if (!decoder(fp, value, &rem)) + if (!print_mask_arg_part(decoder, fp, value, &rem)) fprintf(fp, "0x%x", rem); else if (rem != 0) fprintf(fp, "|0x%x", rem); @@ -2303,9 +2311,15 @@ print_arg(struct syscall_args *sc, unsigned long *args case Procctl: print_integer_arg(sysdecode_procctl_cmd, fp, args[sc->offset]); break; - case Umtxop: - print_integer_arg(sysdecode_umtx_op, fp, args[sc->offset]); + case Umtxop: { + int rem; + + if (print_mask_arg_part(sysdecode_umtx_op_flags, fp, + args[sc->offset], &rem)) + fprintf(fp, "|"); + print_integer_arg(sysdecode_umtx_op, fp, rem); break; + } case Atfd: print_integer_arg(sysdecode_atfd, fp, args[sc->offset]); break; ___ 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: r368480 - head/lib/libsysdecode
Author: kevans Date: Wed Dec 9 03:22:44 2020 New Revision: 368480 URL: https://svnweb.freebsd.org/changeset/base/368480 Log: libsysdecode: decode _UMTX_OP flags Assume that UMTX_OP with a double underbar following is a flag, while any underbar+alphanumeric combination immeiately following is an op. This was a part of D27325. Reviewed by: kib Modified: head/lib/libsysdecode/flags.c head/lib/libsysdecode/mktables head/lib/libsysdecode/sysdecode.h Modified: head/lib/libsysdecode/flags.c == --- head/lib/libsysdecode/flags.c Wed Dec 9 03:20:51 2020 (r368479) +++ head/lib/libsysdecode/flags.c Wed Dec 9 03:22:44 2020 (r368480) @@ -941,6 +941,20 @@ sysdecode_umtx_op(int op) return (lookup_value(umtxop, op)); } +bool +sysdecode_umtx_op_flags(FILE *fp, int op, int *rem) +{ + uintmax_t val; + bool printed; + + printed = false; + val = (unsigned)op; + print_mask_part(fp, umtxopflags, &val, &printed); + if (rem != NULL) + *rem = val; + return (printed); +} + const char * sysdecode_vmresult(int result) { Modified: head/lib/libsysdecode/mktables == --- head/lib/libsysdecode/mktables Wed Dec 9 03:20:51 2020 (r368479) +++ head/lib/libsysdecode/mktables Wed Dec 9 03:22:44 2020 (r368480) @@ -145,7 +145,8 @@ gen_table "sockoptudp" "UDP_[[:alnum:]]+[[:space: gen_table "sockoptudplite" "UDPLITE_[[:alnum:]_]+[[:space:]]+[0-9]+" "netinet/udplite.h" gen_table "socktype""SOCK_[A-Z]+[[:space:]]+[1-9]+[0-9]*" "sys/socket.h" gen_table "thrcreateflags" "THR_[A-Z]+[[:space:]]+0x[0-9]+" "sys/thr.h" -gen_table "umtxop" "UMTX_OP_[[:alnum:]_]+[[:space:]]+[0-9]+" "sys/umtx.h" +gen_table "umtxop" "UMTX_OP_[[:alnum:]][[:alnum:]_]*[[:space:]]+[0-9]+" "sys/umtx.h" +gen_table "umtxopflags" "UMTX_OP__[[:alnum:]_]+[[:space:]]+[0-9]+" "sys/umtx.h" gen_table "vmprot" "VM_PROT_[A-Z]+[[:space:]]+\(\(vm_prot_t\)[[:space:]]+0x[0-9]+\)" "vm/vm.h" gen_table "vmresult""KERN_[A-Z_]+[[:space:]]+[0-9]+" "vm/vm_param.h" gen_table "wait6opt""W[A-Z]+[[:space:]]+[0-9]+" "sys/wait.h" Modified: head/lib/libsysdecode/sysdecode.h == --- head/lib/libsysdecode/sysdecode.h Wed Dec 9 03:20:51 2020 (r368479) +++ head/lib/libsysdecode/sysdecode.h Wed Dec 9 03:22:44 2020 (r368480) @@ -121,6 +121,7 @@ const char *sysdecode_sysarch_number(int _number); bool sysdecode_thr_create_flags(FILE *_fp, int _flags, int *_rem); bool sysdecode_umtx_cvwait_flags(FILE *_fp, u_long _flags, u_long *_rem); const char *sysdecode_umtx_op(int _op); +bool sysdecode_umtx_op_flags(FILE *_fp, int op, int *_rem); bool sysdecode_umtx_rwlock_flags(FILE *_fp, u_long _flags, u_long *_rem); intsysdecode_utrace(FILE *_fp, void *_buf, size_t _len); bool sysdecode_vmprot(FILE *_fp, int _type, int *_rem); ___ 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: r368479 - head/lib/libc/sys
Author: kevans Date: Wed Dec 9 03:20:51 2020 New Revision: 368479 URL: https://svnweb.freebsd.org/changeset/base/368479 Log: _umtx_op(2): document recent addition of 32bit compat flags This was part of D27325. Reviewed by: kib Modified: head/lib/libc/sys/_umtx_op.2 Modified: head/lib/libc/sys/_umtx_op.2 == --- head/lib/libc/sys/_umtx_op.2Wed Dec 9 02:59:24 2020 (r368478) +++ head/lib/libc/sys/_umtx_op.2Wed Dec 9 03:20:51 2020 (r368479) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 16, 2020 +.Dd November 23, 2020 .Dt _UMTX_OP 2 .Os .Sh NAME @@ -1272,6 +1272,79 @@ See .Sx ROBUST UMUTEXES subsection for details. .El +.Pp +The +.Fa op +argument may be a bitwise OR of a single command from above with one or more of +the following flags: +.Bl -tag -width indent +.It Dv UMTX_OP__I386 +Request i386 ABI compatibility from the native +.Nm +system call. +Specifically, this implies that: +.Bl -hang -offset indent +.It +.Fa obj +arguments that point to a word, point to a 32-bit integer. +.It +The +.Dv UMTX_OP_NWAKE_PRIVATE +.Fa obj +argument is a pointer to an array of 32-bit pointers. +.It +The +.Dv m_rb_lnk +member of +.Vt struct umutex +is a 32-bit pointer. +.It +.Vt struct timespec +uses a 32-bit time_t. +.El +.Pp +.Dv UMTX_OP__32BIT +has no effect if this flag is set. +This flag is valid for all architectures, but it is ignored on i386. +.It Dv UMTX_OP__32BIT +Request non-i386, 32-bit ABI compatibility from the native +.Nm +system call. +Specifically, this implies that: +.Bl -hang -offset indent +.It +.Fa obj +arguments that point to a word, point to a 32-bit integer. +.It +The +.Dv UMTX_OP_NWAKE_PRIVATE +.Fa obj +argument is a pointer to an array of 32-bit pointers. +.It +The +.Dv m_rb_lnk +member of +.Vt struct umutex +is a 32-bit pointer. +.It +.Vt struct timespec +uses a 64-bit time_t. +.El +.Pp +This flag has no effect if +.Dv UMTX_OP__I386 +is set. +This flag is valid for all architectures. +.El +.Pp +Note that if any 32-bit ABI compatibility is being requested, then care must be +taken with robust lists. +A single thread may not mix 32-bit compatible robust lists with native +robust lists. +The first +.Dv UMTX_OP_ROBUST_LISTS +call in a given thread determines which ABI that thread will use for robust +lists going forward. .Sh RETURN VALUES If successful, all requests, except ___ 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"
Re: svn commit: r368439 - head/share/mk
On Tue, Dec 8, 2020 at 8:05 AM Kyle Evans wrote: > > Author: kevans > Date: Tue Dec 8 14:05:25 2020 > New Revision: 368439 > URL: https://svnweb.freebsd.org/changeset/base/368439 > > Log: > src.opts.mk: switch to bsdgrep as /usr/bin/grep > > [.. snip ...] > > I have some WIP to make bsdgrep faster, but do not consider it a blocker > when compared to the pros of switching now (aforementioned bugs, licensing). > > [.. snip ...] I was asked to collect some stats from that patch to speed up bsdgrep; while the patch isn't ready yet, I decided to do a (really really) rough comparison between gnugrep/bsdgrep as well to follow-up on the speed aspect and perhaps provide a baseline. You can view the results of those comparisons (user time(1) output), which felt 'representative enough' of the difference, here: https://people.freebsd.org/~kevans/stable/grep-stats.txt Some notes, to help with interpretation: - This hardware is not great - All runs were doing a recursive grep from the root of a non-active base/head checkout, -I was not specified, in search of instances of the same pattern (but actually literal) - ${grep}-non == ${grep} -r 'closefrom' . - ${grep}-n == ${grep} -nr 'closefrom' . - ${grep}-c8 == ${grep} -rC8 'closefrom' . The sampling was low enough quality that we can probably just discard all of this, but I found the final two comparisons (gnugrep vs. gnugrep -n vs. gnugrep -C8 and bsdgrep vs. bsdgrep -n vs. bsdgrep -C8) interesting enough that I decided to share this despite the quality. Here are the key points that I find interesting: gnugrep sees a pretty significant difference from the baseline to either of the other two modes. This was expected to some extent- both -n and -C8 will imply some level of line tracking when you're taking the chunked search approach, as you need to count lines even in chunks that don't have any matches for -n and you might even need to do the same for -C8. I think the much smaller difference between the gnugrep baseline and -C8 indicates that they probably don't take the simple/slow approach of counting all newlines to determine that you have 8 and where the 8th prior started, but instead wait for a match then start backtracking. The surprising part about the bsdgrep comparison was that there is significant slowdown when we're checking context. There is almost certainly room for improvement there. Thanks, Kyle Evans ___ 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: r368462 - head/sys/kern
Author: kevans Date: Tue Dec 8 18:47:22 2020 New Revision: 368462 URL: https://svnweb.freebsd.org/changeset/base/368462 Log: cpuset_set{affinity,domain}: do not allow empty masks cpuset_modify() would not currently catch this, because it only checks that the new mask is a subset of the root set and circumvents the EDEADLK check in cpuset_testupdate(). This change both directly validates the mask coming in since we can trivially detect an empty mask, and it updates cpuset_testupdate to catch stuff like this going forward by always ensuring we don't end up with an empty mask. The check_mask argument has been renamed because the 'check' verbiage does not imply to me that it's actually doing a different operation. We're either augmenting the existing mask, or we are replacing it entirely. Reported by: syzbot+4e3b1009de98d2fab...@syzkaller.appspotmail.com Discussed with: andrew Reviewed by: andrew, markj MFC after:1 week Differential Revision:https://reviews.freebsd.org/D27511 Modified: head/sys/kern/kern_cpuset.c Modified: head/sys/kern/kern_cpuset.c == --- head/sys/kern/kern_cpuset.c Tue Dec 8 18:45:47 2020(r368461) +++ head/sys/kern/kern_cpuset.c Tue Dec 8 18:47:22 2020(r368462) @@ -633,7 +633,7 @@ domainset_shadow(const struct domainset *pdomain, * empty as well as RDONLY flags. */ static int -cpuset_testupdate(struct cpuset *set, cpuset_t *mask, int check_mask) +cpuset_testupdate(struct cpuset *set, cpuset_t *mask, int augment_mask) { struct cpuset *nset; cpuset_t newmask; @@ -642,13 +642,14 @@ cpuset_testupdate(struct cpuset *set, cpuset_t *mask, mtx_assert(&cpuset_lock, MA_OWNED); if (set->cs_flags & CPU_SET_RDONLY) return (EPERM); - if (check_mask) { - if (!CPU_OVERLAP(&set->cs_mask, mask)) - return (EDEADLK); + if (augment_mask) { CPU_COPY(&set->cs_mask, &newmask); CPU_AND(&newmask, mask); } else CPU_COPY(mask, &newmask); + + if (CPU_EMPTY(&newmask)) + return (EDEADLK); error = 0; LIST_FOREACH(nset, &set->cs_children, cs_siblings) if ((error = cpuset_testupdate(nset, &newmask, 1)) != 0) @@ -723,7 +724,7 @@ out: */ static int cpuset_testupdate_domain(struct cpuset *set, struct domainset *dset, -struct domainset *orig, int *count, int check_mask) +struct domainset *orig, int *count, int augment_mask __unused) { struct cpuset *nset; struct domainset *domain; @@ -2001,6 +2002,10 @@ kern_cpuset_setaffinity(struct thread *td, cpulevel_t goto out; } } + if (CPU_EMPTY(mask)) { + error = EDEADLK; + goto out; + } switch (level) { case CPU_LEVEL_ROOT: case CPU_LEVEL_CPUSET: @@ -2254,6 +2259,10 @@ kern_cpuset_setdomain(struct thread *td, cpulevel_t le error = EINVAL; goto out; } + } + if (DOMAINSET_EMPTY(mask)) { + error = EDEADLK; + goto out; } DOMAINSET_COPY(mask, &domain.ds_mask); domain.ds_policy = policy; ___ 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: r368461 - head/sys/kern
Author: kevans Date: Tue Dec 8 18:45:47 2020 New Revision: 368461 URL: https://svnweb.freebsd.org/changeset/base/368461 Log: kern: cpuset: resolve race between cpuset_lookup/cpuset_rel The race plays out like so between threads A and B: 1. A ref's cpuset 10 2. B does a lookup of cpuset 10, grabs the cpuset lock and searches cpuset_ids 3. A rel's cpuset 10 and observes the last ref, waits on the cpuset lock while B is still searching and not yet ref'd 4. B ref's cpuset 10 and drops the cpuset lock 5. A proceeds to free the cpuset out from underneath B Resolve the race by only releasing the last reference under the cpuset lock. Thread A now picks up the spinlock and observes that the cpuset has been revived, returning immediately for B to deal with later. Reported by: syzbot+92dff413e201164c7...@syzkaller.appspotmail.com Reviewed by: markj MFC after:1 week Differential Revision:https://reviews.freebsd.org/D27498 Modified: head/sys/kern/kern_cpuset.c Modified: head/sys/kern/kern_cpuset.c == --- head/sys/kern/kern_cpuset.c Tue Dec 8 18:44:06 2020(r368460) +++ head/sys/kern/kern_cpuset.c Tue Dec 8 18:45:47 2020(r368461) @@ -207,9 +207,13 @@ cpuset_rel(struct cpuset *set) { cpusetid_t id; - if (refcount_release(&set->cs_ref) == 0) + if (refcount_release_if_not_last(&set->cs_ref)) return; mtx_lock_spin(&cpuset_lock); + if (!refcount_release(&set->cs_ref)) { + mtx_unlock_spin(&cpuset_lock); + return; + } LIST_REMOVE(set, cs_siblings); id = set->cs_id; if (id != CPUSET_INVALID) @@ -229,9 +233,13 @@ static void cpuset_rel_defer(struct setlist *head, struct cpuset *set) { - if (refcount_release(&set->cs_ref) == 0) + if (refcount_release_if_not_last(&set->cs_ref)) return; mtx_lock_spin(&cpuset_lock); + if (!refcount_release(&set->cs_ref)) { + mtx_unlock_spin(&cpuset_lock); + return; + } LIST_REMOVE(set, cs_siblings); if (set->cs_id != CPUSET_INVALID) LIST_REMOVE(set, cs_link); ___ 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: r368460 - head/sys/kern
Author: kevans Date: Tue Dec 8 18:44:06 2020 New Revision: 368460 URL: https://svnweb.freebsd.org/changeset/base/368460 Log: kern: cpuset: plug a unr leak cpuset_rel_defer() is supposed to be functionally equivalent to cpuset_rel() but with anything that might sleep deferred until cpuset_rel_complete -- this setup is used specifically for cpuset_setproc. Add in the missing unr free to match cpuset_rel. This fixes a leak that was observed when I wrote a small userland application to try and debug another issue, which effectively did: cpuset(&newid); cpuset(&scratch); newid gets leaked when scratch is created; it's off the list, so there's no mechanism for anything else to relinquish it. A more realistic reproducer would likely be a process that inherits some cpuset that it's the only ref for, but it creates a new one to modify. Alternatively, administratively reassigning a process' cpuset that it's the last ref for will have the same effect. Discovered through D27498. MFC after:1 week Modified: head/sys/kern/kern_cpuset.c Modified: head/sys/kern/kern_cpuset.c == --- head/sys/kern/kern_cpuset.c Tue Dec 8 18:28:49 2020(r368459) +++ head/sys/kern/kern_cpuset.c Tue Dec 8 18:44:06 2020(r368460) @@ -246,9 +246,14 @@ cpuset_rel_defer(struct setlist *head, struct cpuset * static void cpuset_rel_complete(struct cpuset *set) { + cpusetid_t id; + + id = set->cs_id; LIST_REMOVE(set, cs_link); cpuset_rel(set->cs_parent); uma_zfree(cpuset_zone, set); + if (id != CPUSET_INVALID) + free_unr(cpuset_unr, id); } /* ___ 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: r368440 - head/share/man/man5
Author: kevans Date: Tue Dec 8 14:05:54 2020 New Revision: 368440 URL: https://svnweb.freebsd.org/changeset/base/368440 Log: src.conf(5): regen after r368439 (WITH_BSD_GREP default) Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 == --- head/share/man/man5/src.conf.5 Tue Dec 8 14:05:25 2020 (r368439) +++ head/share/man/man5/src.conf.5 Tue Dec 8 14:05:54 2020 (r368440) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd November 13, 2020 +.Dd December 8, 2020 .Dt SRC.CONF 5 .Os .Sh NAME @@ -222,8 +222,8 @@ and related programs. .It Va WITHOUT_BSD_CPIO Set to not build the BSD licensed version of cpio based on .Xr libarchive 3 . -.It Va WITH_BSD_GREP -Install BSD-licensed grep as '[ef]grep' instead of GNU grep. +.It Va WITHOUT_BSD_GREP +Install GNU grep as '[ef]grep' instead of BSD grep. .It Va WITHOUT_BSNMP Set to not build or install .Xr bsnmpd 1 @@ -680,10 +680,6 @@ Set to not build GNU .It Va WITHOUT_GNU_GREP Set to not build GNU .Xr grep 1 . -.It Va WITH_GNU_GREP_COMPAT -Set this option to include GNU extensions in -.Xr bsdgrep 1 -by linking against libgnuregex. .It Va WITHOUT_GOOGLETEST Set to neither build nor install .Lb libgmock , ___ 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: r368439 - head/share/mk
Author: kevans Date: Tue Dec 8 14:05:25 2020 New Revision: 368439 URL: https://svnweb.freebsd.org/changeset/base/368439 Log: src.opts.mk: switch to bsdgrep as /usr/bin/grep This has been years in the making, and we all knew it was bound to happen some day. Switch to the BSDL grep implementation now that it's been a little more thoroughly tested and theoretically supports all of the extensions that gnugrep in base had with our libregex(3). Folks shouldn't really notice much from this update; bsdgrep is slower than gnugrep, but this is currently the price to pay for fewer bugs. Those dissatisfied with the speed of grep and in need of a faster implementation should check out what textproc/ripgrep and textproc/the_silver_searcher can do for them. I have some WIP to make bsdgrep faster, but do not consider it a blocker when compared to the pros of switching now (aforementioned bugs, licensing). PR: 228798 (exp-run) PR: 128645, 156704, 166842, 166862, 180937, 193835, 201650 PR: 232565, 242308, 246000, 251081, 191086, 194397 Relnotes: yes, please Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk == --- head/share/mk/src.opts.mk Tue Dec 8 08:20:30 2020(r368438) +++ head/share/mk/src.opts.mk Tue Dec 8 14:05:25 2020(r368439) @@ -68,6 +68,7 @@ __DEFAULT_YES_OPTIONS = \ BOOTPARAMD \ BOOTPD \ BSD_CPIO \ +BSD_GREP \ BSDINSTALL \ BSNMP \ BZIP2 \ @@ -203,7 +204,6 @@ __DEFAULT_YES_OPTIONS = \ __DEFAULT_NO_OPTIONS = \ BEARSSL \ BHYVE_SNAPSHOT \ -BSD_GREP \ CLANG_EXTRAS \ CLANG_FORMAT \ DTRACE_TESTS \ ___ 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"
Re: svn commit: r368005 - in head: lib/libprocstat share/man/man4 sys/opencrypto sys/sys tools/tools/crypto usr.bin/procstat
On Mon, Dec 7, 2020 at 2:41 PM John Baldwin wrote: > > On 12/7/20 12:37 PM, Kyle Evans wrote: > > On Mon, Dec 7, 2020 at 2:36 PM John Baldwin wrote: > >> > >> qemu-user uses this flag? What on earth can it be using it for? > >> > > > > It was faithfully responding that it wasn't implemented to any > > target-application usage, apparently. :-) > > I mean, it is only a flag in the struct kinfo_file flags field. Even > if it is doing some kind of compat shim for kinfo_file it should just > copy the flags field across, not be checking any of the bits. Does it > try to log the type of a file descriptor in debug traces perhaps? > Apparently we were just that convinced we needed to enumerate the values we didn't have to touch, see: https://github.com/seanbruno/qemu-bsd-user/pull/150/files -> it was actually CRIOGET that we referenced for the sole purpose of declaring it unsupported. ___ 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"
Re: svn commit: r368005 - in head: lib/libprocstat share/man/man4 sys/opencrypto sys/sys tools/tools/crypto usr.bin/procstat
On Mon, Dec 7, 2020 at 2:36 PM John Baldwin wrote: > > On 12/7/20 11:11 AM, Kyle Evans wrote: > > On Mon, Dec 7, 2020 at 12:58 PM John Baldwin wrote: > >> > >> On 12/6/20 8:51 PM, Steve Wills wrote: > >>> Hi, > >>> > >>> On 11/24/20 7:10 PM, John Baldwin wrote: > >>>> Author: jhb > >>>> Date: Wed Nov 25 00:10:54 2020 > >>>> New Revision: 368005 > >>>> URL: https://svnweb.freebsd.org/changeset/base/368005 > >>>> > >>>> Log: > >>>>Remove the cloned file descriptors for /dev/crypto. > >>>> > >>> > >>> Would this change warrant a bump of __FreeBSD_version? I only noticed > >>> because PR 251470 (radare2 not building due to KF_TYPE_CRYPTO). > >> > >> Hmm, perhaps so, though ports could also use #ifdef KF_TYPE_CRYPTO (and > >> that is probably preferred for anything using C). Looks like we haven't > >> yet had another bump of __FreeBSD_version so I can do that. > >> > > > > There's surely a better way, but this version bump would've actually > > been really handy for detecting the resulting qemu-user-static > > fallout. The build was broken for about ~9 days, neither the official > > builder or my local builder felt compelled to rebuild it absent the > > bump because I had just built it a couple revisions prior. =-( > > > > I'm kind of leaning towards trying to shoehorn a qemu-user-static > > build into ci.f.o somewhere, though, since it's used as a part of > > producing some of the weekly snapshot images and digs pretty deeply in > > other areas. I've got a Cirrus config for qemu-user-static and Cirrus > > builds it regularly for me, but that's not so helpful when the image > > it builds against is also tied to the weekly snapshot process. > > qemu-user uses this flag? What on earth can it be using it for? > It was faithfully responding that it wasn't implemented to any target-application usage, apparently. :-) ___ 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"
Re: svn commit: r368005 - in head: lib/libprocstat share/man/man4 sys/opencrypto sys/sys tools/tools/crypto usr.bin/procstat
On Mon, Dec 7, 2020 at 12:58 PM John Baldwin wrote: > > On 12/6/20 8:51 PM, Steve Wills wrote: > > Hi, > > > > On 11/24/20 7:10 PM, John Baldwin wrote: > >> Author: jhb > >> Date: Wed Nov 25 00:10:54 2020 > >> New Revision: 368005 > >> URL: https://svnweb.freebsd.org/changeset/base/368005 > >> > >> Log: > >>Remove the cloned file descriptors for /dev/crypto. > >> > > > > Would this change warrant a bump of __FreeBSD_version? I only noticed > > because PR 251470 (radare2 not building due to KF_TYPE_CRYPTO). > > Hmm, perhaps so, though ports could also use #ifdef KF_TYPE_CRYPTO (and > that is probably preferred for anything using C). Looks like we haven't > yet had another bump of __FreeBSD_version so I can do that. > There's surely a better way, but this version bump would've actually been really handy for detecting the resulting qemu-user-static fallout. The build was broken for about ~9 days, neither the official builder or my local builder felt compelled to rebuild it absent the bump because I had just built it a couple revisions prior. =-( I'm kind of leaning towards trying to shoehorn a qemu-user-static build into ci.f.o somewhere, though, since it's used as a part of producing some of the weekly snapshot images and digs pretty deeply in other areas. I've got a Cirrus config for qemu-user-static and Cirrus builds it regularly for me, but that's not so helpful when the image it builds against is also tied to the weekly snapshot process. Thanks, Kyle Evans ___ 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: r368392 - head/usr.bin/grep
Author: kevans Date: Sun Dec 6 17:45:42 2020 New Revision: 368392 URL: https://svnweb.freebsd.org/changeset/base/368392 Log: bsdgrep: don't link against libregex for bootstrap r368355 removed the GNU_GREP_COMPAT knob (off by default) and forgot that bsdgrep may be built/used for bootstrap on some systems. All base uses should strive to use only POSIX-compliant expressions anyways and we haven't had libregex by default here up to this point, so just don't do that if we're bootstrapping. Note that the resulting binary has the wrong `grep -V` information as it falsely claims to be GNU compatible, but it is only for bootstrap. Reported by: GitHub cross-builds via yuripv Modified: head/usr.bin/grep/Makefile Modified: head/usr.bin/grep/Makefile == --- head/usr.bin/grep/Makefile Sun Dec 6 17:44:28 2020(r368391) +++ head/usr.bin/grep/Makefile Sun Dec 6 17:45:42 2020(r368392) @@ -60,7 +60,9 @@ MLINKS+= grep.1 egrep.1 \ grep.1 rgrep.1 .endif +.if !defined(BOOTSTRAPPING) LIBADD+= regex +.endif HAS_TESTS= SUBDIR.${MK_TESTS}+= tests ___ 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: r368388 - head/sbin/bectl
Author: kevans Date: Sun Dec 6 15:58:50 2020 New Revision: 368388 URL: https://svnweb.freebsd.org/changeset/base/368388 Log: bectl: simplify the tail end of the jail cmd This has already confused me once (and I'm pretty sure I wrote it), so let's clarify: unjailing after the command has completed will only happen if we're interactive and -U has not been specified. This just folds two conditionals together to make it obvious how -b/-U interact with each other. MFC after:3 days Modified: head/sbin/bectl/bectl_jail.c Modified: head/sbin/bectl/bectl_jail.c == --- head/sbin/bectl/bectl_jail.cSun Dec 6 11:49:21 2020 (r368387) +++ head/sbin/bectl/bectl_jail.cSun Dec 6 15:58:50 2020 (r368388) @@ -356,10 +356,8 @@ bectl_cmd_jail(int argc, char *argv[]) } free(jargv); - if (!interactive) - return (0); - - if (unjail) { + /* Non-interactive (-b) mode means the jail sticks around. */ + if (interactive && unjail) { /* * We're not checking the jail id result here because in the * case of invalid param, or last command in jail was an error ___ 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: r368371 - in head/contrib/netbsd-tests/lib/libc/regex: . data
Author: kevans Date: Sat Dec 5 14:38:46 2020 New Revision: 368371 URL: https://svnweb.freebsd.org/changeset/base/368371 Log: libc: regex: partial revert of r368358 Part of the libregex functionality leaked into the tests it shares with the standard regex(3). Introduce a P flag to set the REG_POSIX cflag to indicate that libc regex should effectively do nothing while libregex should specifically run it in non-extended mode. This unbreaks the libc/regex test run. Reported by: Jenkins Modified: head/contrib/netbsd-tests/lib/libc/regex/README head/contrib/netbsd-tests/lib/libc/regex/data/meta.in head/contrib/netbsd-tests/lib/libc/regex/main.c Modified: head/contrib/netbsd-tests/lib/libc/regex/README == --- head/contrib/netbsd-tests/lib/libc/regex/README Sat Dec 5 14:06:01 2020(r368370) +++ head/contrib/netbsd-tests/lib/libc/regex/README Sat Dec 5 14:38:46 2020(r368371) @@ -28,6 +28,7 @@ The full list of flags: $REG_NOTEOL #REG_STARTEND (see below) pREG_PEND + PREG_POSIX For REG_STARTEND, the start/end offsets are those of the substring enclosed in (). Modified: head/contrib/netbsd-tests/lib/libc/regex/data/meta.in == --- head/contrib/netbsd-tests/lib/libc/regex/data/meta.in Sat Dec 5 14:06:01 2020(r368370) +++ head/contrib/netbsd-tests/lib/libc/regex/data/meta.in Sat Dec 5 14:38:46 2020(r368371) @@ -5,7 +5,7 @@ a\*c& a*c a*c a\\b & a\b a\b a\\\*b & a\*ba\*b # Begin FreeBSD -a\bc & abc +a\bc &CP EESCAPE # End FreeBSD a\ &C EESCAPE a\\bc & a\bca\bc Modified: head/contrib/netbsd-tests/lib/libc/regex/main.c == --- head/contrib/netbsd-tests/lib/libc/regex/main.c Sat Dec 5 14:06:01 2020(r368370) +++ head/contrib/netbsd-tests/lib/libc/regex/main.c Sat Dec 5 14:38:46 2020(r368371) @@ -338,7 +338,7 @@ options(int type, char *s) { char *p; int o = (type == 'c') ? copts : eopts; - const char *legal = (type == 'c') ? "bisnmp" : "^$#tl"; + const char *legal = (type == 'c') ? "bisnmpP" : "^$#tl"; for (p = s; *p != '\0'; p++) if (strchr(legal, *p) != NULL) @@ -361,6 +361,9 @@ options(int type, char *s) break; case 'p': o |= REG_PEND; + break; + case 'P': + o |= REG_POSIX; break; case '^': o |= REG_NOTBOL; ___ 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: r368359 - head/lib/libc/regex
Author: kevans Date: Sat Dec 5 03:18:48 2020 New Revision: 368359 URL: https://svnweb.freebsd.org/changeset/base/368359 Log: libc: regex: retire internal EMPTBR ("Empty branch present") It was realized just a little too late that this was a hack that belonged in individual regex(3)-using applications. It was surrounded in NOTYET and not implemented in the engine, so remove it. Modified: head/lib/libc/regex/regcomp.c head/lib/libc/regex/regex2.h Modified: head/lib/libc/regex/regcomp.c == --- head/lib/libc/regex/regcomp.c Sat Dec 5 03:16:05 2020 (r368358) +++ head/lib/libc/regex/regcomp.c Sat Dec 5 03:18:48 2020 (r368359) @@ -691,15 +691,9 @@ static bool p_branch_empty(struct parse *p, struct branchc *bc) { -#if defined(LIBREGEX) && defined(NOTYET) - if (bc->outer) - p->g->iflags |= EMPTBR; - return (true); -#else (void)bc; SETERROR(REG_EMPTY); return (false); -#endif } /* Modified: head/lib/libc/regex/regex2.h == --- head/lib/libc/regex/regex2.hSat Dec 5 03:16:05 2020 (r368358) +++ head/lib/libc/regex/regex2.hSat Dec 5 03:18:48 2020 (r368359) @@ -186,7 +186,6 @@ struct re_guts { # define USEBOL 01 /* used ^ */ # define USEEOL 02 /* used $ */ # define BAD 04 /* something wrong */ -# define EMPTBR 010 /* empty branch present */ int nbol; /* number of ^ used */ int neol; /* number of $ used */ char *must; /* match must contain this string */ ___ 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: r368358 - in head: contrib/netbsd-tests/lib/libc/regex/data lib/libc/regex lib/libregex/tests
Author: kevans Date: Sat Dec 5 03:16:05 2020 New Revision: 368358 URL: https://svnweb.freebsd.org/changeset/base/368358 Log: libregex: implement \b and \B (word boundary, not word boundary) This is the last of the needed GNU expressions before we can unleash bsdgrep by default. \b is effectively an agnostic equivalent of \< and \>, while \B will match every space that isn't making a transition from nonchar -> char or char -> nonchar. Modified: head/contrib/netbsd-tests/lib/libc/regex/data/meta.in head/lib/libc/regex/engine.c head/lib/libc/regex/regcomp.c head/lib/libc/regex/regex2.h head/lib/libregex/tests/gnuext.in Modified: head/contrib/netbsd-tests/lib/libc/regex/data/meta.in == --- head/contrib/netbsd-tests/lib/libc/regex/data/meta.in Sat Dec 5 03:13:47 2020(r368357) +++ head/contrib/netbsd-tests/lib/libc/regex/data/meta.in Sat Dec 5 03:16:05 2020(r368358) @@ -5,7 +5,7 @@ a\*c& a*c a*c a\\b & a\b a\b a\\\*b & a\*ba\*b # Begin FreeBSD -a\bc &C EESCAPE +a\bc & abc # End FreeBSD a\ &C EESCAPE a\\bc & a\bca\bc Modified: head/lib/libc/regex/engine.c == --- head/lib/libc/regex/engine.cSat Dec 5 03:13:47 2020 (r368357) +++ head/lib/libc/regex/engine.cSat Dec 5 03:16:05 2020 (r368358) @@ -118,6 +118,7 @@ static states step(struct re_guts *g, sopno start, sop #defineBOW (BOL-4) #defineEOW (BOL-5) #defineBADCHAR (BOL-6) +#defineNWBND (BOL-7) #defineNONCHAR(c) ((c) <= OUT) /* sflags */ #defineSBOS0x0001 @@ -463,6 +464,8 @@ dissect(struct match *m, case OEOW: case OBOS: case OEOS: + case OWBND: + case ONWBND: break; case OANY: case OANYOF: @@ -691,6 +694,21 @@ backref(struct match *m, else return(NULL); break; + case OWBND: + if (ISBOW(m, sp) || ISEOW(m, sp)) + { /* yes */ } + else + return(NULL); + break; + case ONWBND: + if (((sp == m->beginp) && !ISWORD(*sp)) || + (sp == m->endp && !ISWORD(*(sp - 1 + { /* yes, beginning/end of subject */ } + else if (ISWORD(*(sp - 1)) == ISWORD(*sp)) + { /* yes, beginning/end of subject */ } + else + return(NULL); + break; case OBOW: if (ISBOW(m, sp)) { /* yes */ } @@ -916,6 +934,17 @@ walk(struct match *m, const char *start, const char *s st = step(m->g, startst, stopst, st, flagch, st, sflags); SP("sboweow", st, c); } + if (lastc != OUT && c != OUT && + ISWORD(lastc) == ISWORD(c)) { + flagch = NWBND; + } else if ((lastc == OUT && !ISWORD(c)) || + (c == OUT && !ISWORD(lastc))) { + flagch = NWBND; + } + if (flagch == NWBND) { + st = step(m->g, startst, stopst, st, flagch, st, sflags); + SP("snwbnd", st, c); + } /* are we done? */ if (ISSET(st, stopst)) { @@ -1016,6 +1045,14 @@ step(struct re_guts *g, case OEOW: if (ch == EOW) FWD(aft, bef, 1); + break; + case OWBND: + if (ch == BOW || ch == EOW) + FWD(aft, bef, 1); + break; + case ONWBND: + if (ch == NWBND) + FWD(aft, aft, 1); break; case OANY: if (!NONCHAR(ch)) Modified: head/lib/libc/regex/regcomp.c == --- head/lib/libc/regex/regcomp.c Sat Dec 5 03:13:47 2020 (r368357) +++ head/lib/libc/regex/regcomp.c Sat Dec 5 03:16:05 2020 (r368358) @@ -486,6 +486,12 @@ p_ere_exp(struct parse *p, struct branchc *bc) case '\'': EMIT(OEOS, 0); break; + case
svn commit: r368357 - in head/lib: libc/regex libregex/tests
Author: kevans Date: Sat Dec 5 03:13:47 2020 New Revision: 368357 URL: https://svnweb.freebsd.org/changeset/base/368357 Log: libregex: implement \` and \' (begin-of-subj, end-of-subj) These are GNU extensions, generally equivalent to ^ and $ except that the new syntax will not match beginning of line after the first in a multi-line expression or the end of line before absolute last in a multi-line expression. Modified: head/lib/libc/regex/engine.c head/lib/libc/regex/regcomp.c head/lib/libc/regex/regex2.h head/lib/libregex/tests/gnuext.in Modified: head/lib/libc/regex/engine.c == --- head/lib/libc/regex/engine.cSat Dec 5 02:23:11 2020 (r368356) +++ head/lib/libc/regex/engine.cSat Dec 5 03:13:47 2020 (r368357) @@ -109,7 +109,7 @@ static int matcher(struct re_guts *g, const char *stri static const char *dissect(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst); static const char *backref(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst, sopno lev, int); static const char *walk(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst, bool fast); -static states step(struct re_guts *g, sopno start, sopno stop, states bef, wint_t ch, states aft); +static states step(struct re_guts *g, sopno start, sopno stop, states bef, wint_t ch, states aft, int sflags); #define MAX_RECURSION 100 #defineBOL (OUT-1) #defineEOL (BOL-1) @@ -119,6 +119,10 @@ static states step(struct re_guts *g, sopno start, sop #defineEOW (BOL-5) #defineBADCHAR (BOL-6) #defineNONCHAR(c) ((c) <= OUT) +/* sflags */ +#defineSBOS0x0001 +#defineSEOS0x0002 + #ifdef REDEBUG static void print(struct match *m, const char *caption, states st, int ch, FILE *d); #endif @@ -457,6 +461,8 @@ dissect(struct match *m, case OEOL: case OBOW: case OEOW: + case OBOS: + case OEOS: break; case OANY: case OANYOF: @@ -657,6 +663,18 @@ backref(struct match *m, if (wc == BADCHAR || !CHIN(cs, wc)) return(NULL); break; + case OBOS: + if (sp == m->beginp && (m->eflags & REG_NOTBOL) == 0) + { /* yes */ } + else + return(NULL); + break; + case OEOS: + if (sp == m->endp && (m->eflags & REG_NOTEOL) == 0) + { /* yes */ } + else + return(NULL); + break; case OBOL: if ((sp == m->beginp && !(m->eflags®_NOTBOL)) || (sp > m->offp && sp < m->endp && @@ -819,15 +837,16 @@ walk(struct match *m, const char *start, const char *s wint_t c; wint_t lastc; /* previous c */ wint_t flagch; - int i; + int i, sflags; const char *matchp; /* last p at which a match ended */ size_t clen; + sflags = 0; AT("slow", start, stop, startst, stopst); CLEAR(st); SET1(st, startst); SP("sstart", st, *p); - st = step(m->g, startst, stopst, st, NOTHING, st); + st = step(m->g, startst, stopst, st, NOTHING, st, sflags); if (fast) ASSIGN(fresh, st); matchp = NULL; @@ -844,6 +863,7 @@ walk(struct match *m, const char *start, const char *s for (;;) { /* next character */ lastc = c; + sflags = 0; if (p == m->endp) { c = OUT; clen = 0; @@ -866,9 +886,20 @@ walk(struct match *m, const char *start, const char *s flagch = (flagch == BOL) ? BOLEOL : EOL; i += m->g->neol; } + if (lastc == OUT && (m->eflags & REG_NOTBOL) == 0) { + sflags |= SBOS; + /* Step one more for BOS. */ + i++; + } + if (c == OUT && (m->eflags & REG_NOTEOL) == 0) { + sflags |= SEOS; + /* Step one more for EOS. */ + i++; + } if (i != 0) { for (; i > 0; i--) - st = step(m->g, startst, stopst, st, flagch, st); + st = step(m->g, startst, stopst, st, flagch, st, + sflags); SP("sboleol", st, c); } @@ -882,7
svn commit: r368356 - head/lib/libc/regex
Author: kevans Date: Sat Dec 5 02:23:11 2020 New Revision: 368356 URL: https://svnweb.freebsd.org/changeset/base/368356 Log: libc: regex: factor out ISBOW/ISEOW macros These will be reused for \b (word boundary, which matches both sides). No functional change. Modified: head/lib/libc/regex/engine.c Modified: head/lib/libc/regex/engine.c == --- head/lib/libc/regex/engine.cSat Dec 5 02:21:58 2020 (r368355) +++ head/lib/libc/regex/engine.cSat Dec 5 02:23:11 2020 (r368356) @@ -589,6 +589,17 @@ dissect(struct match *m, return(sp); } +#defineISBOW(m, sp)\ +(sp < m->endp && ISWORD(*sp) &&\ +((sp == m->beginp && !(m->eflags®_NOTBOL)) || \ +(sp > m->offp && !ISWORD(*(sp-1) +#defineISEOW(m, sp)\ +(((sp == m->endp && !(m->eflags®_NOTEOL)) ||\ +(sp < m->endp && *sp == '\n' &&\ +(m->g->cflags®_NEWLINE)) || \ +(sp < m->endp && !ISWORD(*sp)) ) &&\ +(sp > m->beginp && ISWORD(*(sp-1 \ + /* - backref - figure out what matched what, figuring in back references == static const char *backref(struct match *m, const char *start, \ @@ -663,19 +674,13 @@ backref(struct match *m, return(NULL); break; case OBOW: - if (sp < m->endp && ISWORD(*sp) && - ((sp == m->beginp && !(m->eflags®_NOTBOL)) || - (sp > m->offp && !ISWORD(*(sp-1) + if (ISBOW(m, sp)) { /* yes */ } else return(NULL); break; case OEOW: - if (( (sp == m->endp && !(m->eflags®_NOTEOL)) || - (sp < m->endp && *sp == '\n' && - (m->g->cflags®_NEWLINE)) || - (sp < m->endp && !ISWORD(*sp)) ) && - (sp > m->beginp && ISWORD(*(sp-1))) ) + if (ISEOW(m, sp)) { /* yes */ } else return(NULL); ___ 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: r368355 - in head: share/mk tools/build/options usr.bin/grep
Author: kevans Date: Sat Dec 5 02:21:58 2020 New Revision: 368355 URL: https://svnweb.freebsd.org/changeset/base/368355 Log: Retire GNU_GREP_COMPAT knob This was introduced and then disabled by default primarily to avoid dealing with bugs in libgnuregex. rS363823 switched to using libregex for it, so let's just rip the option out now so we can make sure we're getting tested with libregex via bsdgrep. Reviewed by: emaste Differential Revision:https://reviews.freebsd.org/D27476 Deleted: head/tools/build/options/WITHOUT_GNU_GREP_COMPAT head/tools/build/options/WITH_GNU_GREP_COMPAT Modified: head/share/mk/src.opts.mk head/usr.bin/grep/Makefile head/usr.bin/grep/grep.c Modified: head/share/mk/src.opts.mk == --- head/share/mk/src.opts.mk Sat Dec 5 00:33:28 2020(r368354) +++ head/share/mk/src.opts.mk Sat Dec 5 02:21:58 2020(r368355) @@ -208,7 +208,6 @@ __DEFAULT_NO_OPTIONS = \ CLANG_FORMAT \ DTRACE_TESTS \ EXPERIMENTAL \ -GNU_GREP_COMPAT \ HESIOD \ LIBSOFT \ LOADER_FIREWIRE \ Modified: head/usr.bin/grep/Makefile == --- head/usr.bin/grep/Makefile Sat Dec 5 00:33:28 2020(r368354) +++ head/usr.bin/grep/Makefile Sat Dec 5 02:21:58 2020(r368355) @@ -60,10 +60,7 @@ MLINKS+= grep.1 egrep.1 \ grep.1 rgrep.1 .endif -.if ${MK_GNU_GREP_COMPAT} != "no" -CFLAGS+= -DWITH_GNU_COMPAT LIBADD+= regex -.endif HAS_TESTS= SUBDIR.${MK_TESTS}+= tests Modified: head/usr.bin/grep/grep.c == --- head/usr.bin/grep/grep.cSat Dec 5 00:33:28 2020(r368354) +++ head/usr.bin/grep/grep.cSat Dec 5 02:21:58 2020(r368355) @@ -62,8 +62,7 @@ const char*errstr[] = { /* 5*/ "\t[--context[=num]] [--directories=action] [--label] [--line-buffered]\n", /* 6*/ "\t[--null] [pattern] [file ...]\n", /* 7*/ "Binary file %s matches\n", -/* 8*/ "%s (BSD grep) %s\n", -/* 9*/ "%s (BSD grep, GNU compatible) %s\n", +/* 8*/ "%s (BSD grep, GNU compatible) %s\n", }; /* Flags passed to regcomp() and regexec() */ @@ -555,11 +554,7 @@ main(int argc, char *argv[]) filebehave = FILE_MMAP; break; case 'V': -#ifdef WITH_GNU_COMPAT - printf(errstr[9], getprogname(), VERSION); -#else printf(errstr[8], getprogname(), VERSION); -#endif exit(0); case 'v': vflag = true; ___ 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: r368333 - head/gnu/lib
Author: kevans Date: Fri Dec 4 15:21:12 2020 New Revision: 368333 URL: https://svnweb.freebsd.org/changeset/base/368333 Log: gnu: don't build libgnuregex for WITH_GNU_GREP_COMPAT bsdgrep switched over to libregex back in r363823 to fill WITH_GNU_GREP_COMPAT, since libgnuregex in base is quite buggy and libregex is somewhat functional. Don't build libgnuregex on our account, please. Modified: head/gnu/lib/Makefile Modified: head/gnu/lib/Makefile == --- head/gnu/lib/Makefile Fri Dec 4 15:09:42 2020(r368332) +++ head/gnu/lib/Makefile Fri Dec 4 15:21:12 2020(r368333) @@ -6,8 +6,7 @@ SUBDIR= SUBDIR.${MK_DIALOG}+= libdialog SUBDIR.${MK_TESTS}+= tests -.if ${MK_GNU_GREP} != "no" || ${MK_GNU_GREP_COMPAT} != "no" || \ -${MK_GDB} != "no" +.if ${MK_GNU_GREP} != "no" || ${MK_GDB} != "no" SUBDIR+= libregex .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"
Re: svn commit: r368326 - head/sys/kern
On Thu, Dec 3, 2020 at 10:40 PM Kyle Evans wrote: > > Author: kevans > Date: Fri Dec 4 04:39:48 2020 > New Revision: 368326 > URL: https://svnweb.freebsd.org/changeset/base/368326 > > Log: > kern: soclose: don't sleep on SO_LINGER w/ timeout=0 > > This is a valid scenario that's handled in the various protocol layers where > it makes sense (e.g., tcp_disconnect and sctp_disconnect). Given that it > indicates we should immediately drop the connection, it makes little sense > to sleep on it. > > This could lead to panics with INVARIANTS. On non-INVARIANTS kernels, this > could result in the thread hanging until a signal interrupts it if the > protocol does not mark the socket as disconnected for whatever reason. > > Reported by: syzbot+e625d92c1dd74e402...@syzkaller.appspotmail.com > Reviewed by: glebius, markj > MFC after:1 week > Differential Revision:https://reviews.freebsd.org/D27407 > It occurred to me as I was glancing over the diff one more time pre-commit that this panic must have been in SCTP, because TCP will always soisdisconnected() the socket in this case while SCTP will not. This is arguably a bug in SCTP that should also be fixed, but I consider the below to still be a valid and better behavior than wedging a userland process due to a minor oversight like this when the behavior of so_linger == 0 is pretty well understood. > Modified: > head/sys/kern/uipc_socket.c > > Modified: head/sys/kern/uipc_socket.c > == > --- head/sys/kern/uipc_socket.c Fri Dec 4 02:37:33 2020(r368325) > +++ head/sys/kern/uipc_socket.c Fri Dec 4 04:39:48 2020(r368326) > @@ -1192,7 +1192,8 @@ soclose(struct socket *so) > goto drop; > } > } > - if (so->so_options & SO_LINGER) { > + > + if ((so->so_options & SO_LINGER) != 0 && so->so_linger != 0) { > if ((so->so_state & SS_ISDISCONNECTING) && > (so->so_state & SS_NBIO)) > goto drop; ___ 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: r368326 - head/sys/kern
Author: kevans Date: Fri Dec 4 04:39:48 2020 New Revision: 368326 URL: https://svnweb.freebsd.org/changeset/base/368326 Log: kern: soclose: don't sleep on SO_LINGER w/ timeout=0 This is a valid scenario that's handled in the various protocol layers where it makes sense (e.g., tcp_disconnect and sctp_disconnect). Given that it indicates we should immediately drop the connection, it makes little sense to sleep on it. This could lead to panics with INVARIANTS. On non-INVARIANTS kernels, this could result in the thread hanging until a signal interrupts it if the protocol does not mark the socket as disconnected for whatever reason. Reported by: syzbot+e625d92c1dd74e402...@syzkaller.appspotmail.com Reviewed by: glebius, markj MFC after:1 week Differential Revision:https://reviews.freebsd.org/D27407 Modified: head/sys/kern/uipc_socket.c Modified: head/sys/kern/uipc_socket.c == --- head/sys/kern/uipc_socket.c Fri Dec 4 02:37:33 2020(r368325) +++ head/sys/kern/uipc_socket.c Fri Dec 4 04:39:48 2020(r368326) @@ -1192,7 +1192,8 @@ soclose(struct socket *so) goto drop; } } - if (so->so_options & SO_LINGER) { + + if ((so->so_options & SO_LINGER) != 0 && so->so_linger != 0) { if ((so->so_state & SS_ISDISCONNECTING) && (so->so_state & SS_NBIO)) goto drop; ___ 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: r368325 - in stable/12: lib/libc/sys lib/libthr/tests sys/kern
Author: kevans Date: Fri Dec 4 02:37:33 2020 New Revision: 368325 URL: https://svnweb.freebsd.org/changeset/base/368325 Log: MFC r367742-r367743: _umtx_op: documentation and compat32 fix r367742: _umtx_op: document UMTX_OP_SEM2_WAIT copyout behavior This clever technique to get a time remaining back was added to support sem_clockwait_np. Reviewed by: kib, vangyzen Differential Revision:https://reviews.freebsd.org/D27160 r367743: _umtx_op: fix a compat32 bug in UMTX_OP_NWAKE_PRIVATE Specifically, if we're waking up some value n > BATCH_SIZE, then the copyin(9) is wrong on the second iteration due to upp being the wrong type. upp is currently a uint32_t**, so upp + pos advances it by twice as many elements as it should (host pointer size vs. compat32 pointer size). Fix it by just making upp a uint32_t*; it's still technically a double pointer, but the distinction doesn't matter all that much here since we're just doing arithmetic on it. Add a test case that demonstrates the problem, placed with the libthr tests since one messing with _umtx_op should be running these tests. Running under compat32, the new test case will hang as threads after the first 128 get missed in the wake. it's not immediately clear how to hit it in practice, since pthread_cond_broadcast() uses a smaller (sleepq batch?) size observed to be around ~50 -- I did not spend much time digging into it. The uintptr_t change makes no functional difference, but i've tossed it in since it's more accurate (semantically). Added: stable/12/lib/libthr/tests/umtx_op_test.c - copied unchanged from r367743, head/lib/libthr/tests/umtx_op_test.c Modified: stable/12/lib/libc/sys/_umtx_op.2 stable/12/lib/libthr/tests/Makefile stable/12/sys/kern/kern_umtx.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/sys/_umtx_op.2 == --- stable/12/lib/libc/sys/_umtx_op.2 Fri Dec 4 02:28:45 2020 (r368324) +++ stable/12/lib/libc/sys/_umtx_op.2 Fri Dec 4 02:37:33 2020 (r368325) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 13, 2017 +.Dd November 16, 2020 .Dt _UMTX_OP 2 .Os .Sh NAME @@ -1101,6 +1101,15 @@ The arguments to the request are: .It Fa obj Pointer to the semaphore (of type .Vt struct _usem2 ) . +.It Fa uaddr +Size of the memory passed in via the +.Fa uaddr2 +argument. +.It Fa uaddr2 +Optional pointer to a structure of type +.Vt struct _umtx_time , +which may be followed by a structure of type +.Vt struct timespec . .El .Pp Put the requesting thread onto a sleep queue if the semaphore counter @@ -1124,6 +1133,18 @@ An unblocked signal delivered during such wait results interruption and .Er EINTR error. +.Pp +If +.Dv UMTX_ABSTIME +was not set, and the operation was interrupted and the caller passed in a +.Fa uaddr2 +large enough to hold a +.Vt struct timespec +following the initial +.Vt struct _umtx_time , +then the +.Vt struct timespec +is updated to contain the unslept amount. .It Dv UMTX_OP_SEM2_WAKE Wake up waiters on semaphore lock. The arguments to the request are: Modified: stable/12/lib/libthr/tests/Makefile == --- stable/12/lib/libthr/tests/Makefile Fri Dec 4 02:28:45 2020 (r368324) +++ stable/12/lib/libthr/tests/Makefile Fri Dec 4 02:37:33 2020 (r368325) @@ -33,6 +33,8 @@ NETBSD_ATF_TESTS_SH+= cancel_test NETBSD_ATF_TESTS_SH+= exit_test NETBSD_ATF_TESTS_SH+= resolv_test +ATF_TESTS_C+= umtx_op_test + LIBADD+= pthread LIBADD.fpu_test+= m LIBADD.sem_test+= rt Copied: stable/12/lib/libthr/tests/umtx_op_test.c (from r367743, head/lib/libthr/tests/umtx_op_test.c) == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/lib/libthr/tests/umtx_op_test.c Fri Dec 4 02:37:33 2020 (r368325, copy of r367743, head/lib/libthr/tests/umtx_op_test.c) @@ -0,0 +1,108 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020 Kyle Evans + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
svn commit: r368324 - stable/12/sys/kern
Author: kevans Date: Fri Dec 4 02:28:45 2020 New Revision: 368324 URL: https://svnweb.freebsd.org/changeset/base/368324 Log: MFC r368009-r368010: kern: cpuset: minor improvements r368009: kern: cpuset: allow cpuset_create() to take an allocated *setp Currently, it must always allocate a new set to be used for passing to _cpuset_create, but it doesn't have to. This is purely kern_cpuset.c internal and it's sparsely used, so just change it to use *setp if it's not-NULL and modify the two consumers to pass in the address of a NULL cpuset. This paves the way for consumers that want the unr allocation without the possibility of sleeping as long as they've done their due diligence to ensure that the mask will properly apply atop the supplied parent (i.e. avoiding the free_unr() in the last failure path). r368010: kern: cpuset: rename _cpuset_create() to cpuset_init() cpuset_init() is better descriptor for what the function actually does. The name was previously taken by a sysinit that setup cpuset_zero's mask from all_cpus, it was removed in r331698 before stable/12 branched. A comment referencing the removed sysinit has now also been removed, since the setup previously done was moved into cpuset_thread0(). Modified: stable/12/sys/kern/kern_cpuset.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_cpuset.c == --- stable/12/sys/kern/kern_cpuset.cFri Dec 4 02:20:41 2020 (r368323) +++ stable/12/sys/kern/kern_cpuset.cFri Dec 4 02:28:45 2020 (r368324) @@ -287,12 +287,12 @@ cpuset_lookup(cpusetid_t setid, struct thread *td) } /* - * Create a set in the space provided in 'set' with the provided parameters. + * Initialize a set in the space provided in 'set' with the provided parameters. * The set is returned with a single ref. May return EDEADLK if the set * will have no valid cpu based on restrictions from the parent. */ static int -_cpuset_create(struct cpuset *set, struct cpuset *parent, +cpuset_init(struct cpuset *set, struct cpuset *parent, const cpuset_t *mask, struct domainset *domain, cpusetid_t id) { @@ -326,6 +326,10 @@ _cpuset_create(struct cpuset *set, struct cpuset *pare * Create a new non-anonymous set with the requested parent and mask. May * return failures if the mask is invalid or a new number can not be * allocated. + * + * If *setp is not NULL, then it will be used as-is. The caller must take + * into account that *setp will be inserted at the head of cpuset_ids and + * plan any potentially conflicting cs_link usage accordingly. */ static int cpuset_create(struct cpuset **setp, struct cpuset *parent, const cpuset_t *mask) @@ -333,16 +337,22 @@ cpuset_create(struct cpuset **setp, struct cpuset *par struct cpuset *set; cpusetid_t id; int error; + bool dofree; id = alloc_unr(cpuset_unr); if (id == -1) return (ENFILE); - *setp = set = uma_zalloc(cpuset_zone, M_WAITOK | M_ZERO); - error = _cpuset_create(set, parent, mask, NULL, id); + dofree = (*setp == NULL); + if (*setp != NULL) + set = *setp; + else + *setp = set = uma_zalloc(cpuset_zone, M_WAITOK | M_ZERO); + error = cpuset_init(set, parent, mask, NULL, id); if (error == 0) return (0); free_unr(cpuset_unr, id); - uma_zfree(cpuset_zone, set); + if (dofree) + uma_zfree(cpuset_zone, set); return (error); } @@ -978,7 +988,7 @@ cpuset_shadow(struct cpuset *set, struct cpuset **nset else d = set->cs_domain; nset = LIST_FIRST(cpusets); - error = _cpuset_create(nset, parent, mask, d, CPUSET_INVALID); + error = cpuset_init(nset, parent, mask, d, CPUSET_INVALID); if (error == 0) { LIST_REMOVE(nset, cs_link); *nsetp = nset; @@ -1458,9 +1468,7 @@ domainset_zero(void) * sets: * * 0 - The root set which should represent all valid processors in the - * system. It is initially created with a mask of all processors - * because we don't know what processors are valid until cpuset_init() - * runs. This set is immutable. + * system. This set is immutable. * 1 - The default set which all processes are a member of until changed. * This allows an administrator to move all threads off of given cpus to * dedicate them to high priority tasks or save power etc. @@ -1497,14 +1505,14 @@ cpuset_thread0(void) * Now derive a default (1), modifiable set from that to give out. */ set = uma_zalloc(cpuset_zone, M_WAITOK | M_ZERO); - error = _cpuset_create(set, cpuset_zero, NULL, NULL, 1); + error = cpuset_init(set, cpuset_zero, NULL, NULL, 1); KASSERT(error == 0, ("Error creating default set: %
svn commit: r368323 - stable/12/sys/kern
Author: kevans Date: Fri Dec 4 02:20:41 2020 New Revision: 368323 URL: https://svnweb.freebsd.org/changeset/base/368323 Log: MFC r368006: kern: never restart syscalls calling closefp(), e.g. close(2) All paths leading into closefp() will either replace or remove the fd from the filedesc table, and closefp() will call fo_close methods that can and do currently sleep without regard for the possibility of an ERESTART. This can be dangerous in multithreaded applications as another thread could have opened another file in its place that is subsequently operated on upon restart. The following are seemingly the only ones that will pass back ERESTART in-tree: - sockets (SO_LINGER) - fusefs - nfsclient Modified: stable/12/sys/kern/kern_descrip.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_descrip.c == --- stable/12/sys/kern/kern_descrip.c Fri Dec 4 02:19:45 2020 (r368322) +++ stable/12/sys/kern/kern_descrip.c Fri Dec 4 02:20:41 2020 (r368323) @@ -1223,6 +1223,15 @@ closefp(struct filedesc *fdp, int fd, struct file *fp, FILEDESC_XUNLOCK(fdp); error = closef(fp, td); + + /* +* All paths leading up to closefp() will have already removed or +* replaced the fd in the filedesc table, so a restart would not +* operate on the same file. +*/ + if (error == ERESTART) + error = EINTR; + if (holdleaders) { FILEDESC_XLOCK(fdp); fdp->fd_holdleaderscount--; ___ 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: r368322 - stable/12/sys/kern
Author: kevans Date: Fri Dec 4 02:19:45 2020 New Revision: 368322 URL: https://svnweb.freebsd.org/changeset/base/368322 Log: MFC r367944: cpuset_setproc: use the appropriate parent for new anon. sets As far as I can tell, this has been the case since initially committed in 2008. cpuset_setproc is the executor of cpuset reassignment; note this excerpt from the description: * 1) Set is non-null. This reparents all anonymous sets to the provided *set and replaces all non-anonymous td_cpusets with the provided set. However, reviewing cpuset_setproc_setthread() for some jail related work unearthed the error: if tdset was not anonymous, we were replacing it with `set`. If it was anonymous, then we'd rebase it onto `set` (i.e. copy the thread's mask over and AND it with `set`) but give the new anonymous set the original tdset as the parent (i.e. the base of the set we're supposed to be leaving behind). The primary visible consequences were that: 1.) cpuset_getid() following such assignment returns the wrong result, the setid that we left behind rather than the one we joined. 2.) When a process attached to the jail, the base set of any anonymous threads was a set outside of the jail. This was initially bundled in D27298, but it's a minor fix that's fairly easy to verify the correctness of. A test is included in D27307 ("badparent"), which demonstrates the issue with, effectively: osetid = cpuset_getid() newsetid = cpuset() cpuset_setaffinity(thread) cpuset_setid(osetid) cpuset_getid(thread) -> observe that it matches newsetid instead of osetid. Modified: stable/12/sys/kern/kern_cpuset.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_cpuset.c == --- stable/12/sys/kern/kern_cpuset.cFri Dec 4 02:18:40 2020 (r368321) +++ stable/12/sys/kern/kern_cpuset.cFri Dec 4 02:19:45 2020 (r368322) @@ -1095,7 +1095,7 @@ cpuset_setproc_setthread(struct cpuset *tdset, struct if (error) return (error); - return cpuset_shadow(tdset, nsetp, &mask, &domain, freelist, + return cpuset_shadow(set, nsetp, &mask, &domain, freelist, domainlist); } ___ 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: r368321 - stable/12/sys/kern
Author: kevans Date: Fri Dec 4 02:18:40 2020 New Revision: 368321 URL: https://svnweb.freebsd.org/changeset/base/368321 Log: MFC r368116: kern: cpuset: drop the lock to allocate domainsets Restructure the loop a little bit to make it a little more clear how it really operates: we never allocate any domains at the beginning of the first iteration, and it will run until we've satisfied the amount we need or we encounter an error. The lock is now taken outside of the loop to make stuff inside the loop easier to evaluate w.r.t. locking. This fixes it to not try and allocate any domains for the freelist under the spinlock, which would have happened before if we needed any new domains. Modified: stable/12/sys/kern/kern_cpuset.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_cpuset.c == --- stable/12/sys/kern/kern_cpuset.cFri Dec 4 01:11:09 2020 (r368320) +++ stable/12/sys/kern/kern_cpuset.cFri Dec 4 02:18:40 2020 (r368321) @@ -784,14 +784,11 @@ cpuset_modify_domain(struct cpuset *set, struct domain return (EPERM); domainset_freelist_init(&domains, 0); domain = domainset_create(domain); - ndomains = needed = 0; - do { - if (ndomains < needed) { - domainset_freelist_add(&domains, needed - ndomains); - ndomains = needed; - } + ndomains = 0; + + mtx_lock_spin(&cpuset_lock); + for (;;) { root = cpuset_getroot(set); - mtx_lock_spin(&cpuset_lock); dset = root->cs_domain; /* * Verify that we have access to this set of domains. @@ -816,7 +813,15 @@ cpuset_modify_domain(struct cpuset *set, struct domain &needed, 0); if (error) goto out; - } while (ndomains < needed); + if (ndomains >= needed) + break; + + /* Dropping the lock; we'll need to re-evaluate again. */ + mtx_unlock_spin(&cpuset_lock); + domainset_freelist_add(&domains, needed - ndomains); + ndomains = needed; + mtx_lock_spin(&cpuset_lock); + } dset = set->cs_domain; cpuset_update_domain(set, domain, dset, &domains); out: ___ 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"
Re: svn commit: r368197 - head/sbin/bectl
On Wed, Dec 2, 2020 at 1:12 PM Gleb Smirnoff wrote: > > Kyle, > > On Wed, Dec 02, 2020 at 12:08:43PM -0600, Kyle Evans wrote: > K> > K> This should be gated on !cmd->silent, because some paths have > K> > K> consumers that are specifically designed to not have to deal with > K> > K> redirecting stderr. It was quite intentional that this didn't > K> > K> previously print anything. > K> > > K> > AFAIK, the only command that has cmd->silent is "check". > K> > > K> > I can't agree that it should suppress stderr in case of libbe_init() > K> > failure. Failure of the library is something different to failed > K> > check of current system. It is permanent failure, meaning that command > K> > is being with incorrect root argument or ZFS is missing at all. Pretty > K> > much the same as using bectl with incorrect arguments or options. > K> > > K> > K> The sole purpose of `bectl check` is to weed out if bectl will work > K> (i.e. if libbe_init succeeds) so that scripts like freebsd-update can > K> determine if they're running on a system or with a root (`bectl -r`) > K> that can work with boot environments. It is not meant to give > K> diagnostics like that upon failure, its sole purpose is to know if > K> your script should proceed with doing bectl-y things safely or if it > K> will just be fraught with peril. > > Understood. Sorry for my mistake. Is this patch a correct one? > > Index: bectl.c > === > --- bectl.c (revision 368197) > +++ bectl.c (working copy) > @@ -585,8 +585,9 @@ main(int argc, char *argv[]) > } > > if ((be = libbe_init(root)) == NULL) { > - fprintf(stderr, "libbe_init(\"%s\") failed.\n", > - root != NULL ? root : ""); > + if (!cmd->silent) > + fprintf(stderr, "libbe_init(\"%s\") failed.\n", > + root != NULL ? root : ""); > return (-1); > } > Yup, looks good to me! Thanks! :-) ___ 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"
Re: svn commit: r368197 - head/sbin/bectl
On Wed, Dec 2, 2020 at 12:02 PM Gleb Smirnoff wrote: > > Kyle, > > On Mon, Nov 30, 2020 at 08:28:58PM -0600, Kyle Evans wrote: > K> > Log: > K> > Print at least something when failing. > K> > > K> > Modified: > K> > head/sbin/bectl/bectl.c > K> > > K> > Modified: head/sbin/bectl/bectl.c > K> > > == > K> > --- head/sbin/bectl/bectl.c Mon Nov 30 20:58:42 2020(r368196) > K> > +++ head/sbin/bectl/bectl.c Mon Nov 30 21:05:31 2020(r368197) > K> > @@ -584,8 +584,11 @@ main(int argc, char *argv[]) > K> > return (usage(false)); > K> > } > K> > > K> > - if ((be = libbe_init(root)) == NULL) > K> > + if ((be = libbe_init(root)) == NULL) { > K> > + fprintf(stderr, "libbe_init(\"%s\") failed.\n", > K> > + root != NULL ? root : ""); > K> > return (-1); > K> > + } > K> > > K> > libbe_print_on_error(be, !cmd->silent); > K> > > K> > K> This should be gated on !cmd->silent, because some paths have > K> consumers that are specifically designed to not have to deal with > K> redirecting stderr. It was quite intentional that this didn't > K> previously print anything. > > AFAIK, the only command that has cmd->silent is "check". > > I can't agree that it should suppress stderr in case of libbe_init() > failure. Failure of the library is something different to failed > check of current system. It is permanent failure, meaning that command > is being with incorrect root argument or ZFS is missing at all. Pretty > much the same as using bectl with incorrect arguments or options. > Hi, The sole purpose of `bectl check` is to weed out if bectl will work (i.e. if libbe_init succeeds) so that scripts like freebsd-update can determine if they're running on a system or with a root (`bectl -r`) that can work with boot environments. It is not meant to give diagnostics like that upon failure, its sole purpose is to know if your script should proceed with doing bectl-y things safely or if it will just be fraught with peril. Thanks, Kyle Evans ___ 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"
Re: svn commit: r368163 - in head: sbin/ifconfig sys/dev/if_wg sys/dev/if_wg/include sys/dev/if_wg/include/crypto sys/dev/if_wg/include/sys sys/dev/if_wg/include/zinc sys/dev/if_wg/module sys/dev/if_w
On Tue, Dec 1, 2020 at 7:39 AM O. Hartmann wrote: > > On Sun, 29 Nov 2020 19:38:04 + (UTC) > Matt Macy wrote: > > > Author: mmacy > > Date: Sun Nov 29 19:38:03 2020 > > New Revision: 368163 > > URL: https://svnweb.freebsd.org/changeset/base/368163 > > > > Log: > > Import kernel WireGuard support > > > > Data path largely shared with the OpenBSD implementation by > > Matt Dunwoodie > > > > Reviewed by:gre...@freebsd.org > > MFC after: 1 month > > Sponsored by: Rubicon LLC, (Netgate) > > Differential Revision: https://reviews.freebsd.org/D26137 > > > > [... snip ...] > > "make installkernel" fails for me in a non-DEBUG environment with the error > shown below. Recent CURRENT source tree is r368226, failing systems are > running > at r368055 or r368226. > > [...] > > ===> i2c/cyapa (install) > --- realinstall_subdir_if_wg --- > install -T dbg -o root -g wheel -m 555 if_wg.ko.debug > /usr/lib/debug/boot/kernel/ install: /usr/lib/debug/boot/kernel/: No such file > or directory --- realinstall_subdir_iflib --- > --- _kmodinstall --- > --- realinstall_subdir_if_wg --- > *** [_kmodinstall] Error code 71 > > make[4]: stopped in /usr/src/sys/modules/if_wg > 1 error > > make[4]: stopped in /usr/src/sys/modules/if_wg > --- realinstall_subdir_iflib --- > install -T release -o root -g wheel -m 555 iflib.ko /boot/kernel/ > --- realinstall_subdir_if_wg --- > --- realinstall_subdir_geom --- > --- realinstall_subdir_iflib --- > --- realinstall_subdir_i2c --- > *** [modules-install] Error code 2 > > [...] Go to sys/modules/if_wg/Makefile and rip out the DEBUG_FLAGS line, this should fix it. ___ 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"
Re: svn commit: r368197 - head/sbin/bectl
On Mon, Nov 30, 2020 at 3:05 PM Gleb Smirnoff wrote: > > Author: glebius > Date: Mon Nov 30 21:05:31 2020 > New Revision: 368197 > URL: https://svnweb.freebsd.org/changeset/base/368197 > > Log: > Print at least something when failing. > > Modified: > head/sbin/bectl/bectl.c > > Modified: head/sbin/bectl/bectl.c > == > --- head/sbin/bectl/bectl.c Mon Nov 30 20:58:42 2020(r368196) > +++ head/sbin/bectl/bectl.c Mon Nov 30 21:05:31 2020(r368197) > @@ -584,8 +584,11 @@ main(int argc, char *argv[]) > return (usage(false)); > } > > - if ((be = libbe_init(root)) == NULL) > + if ((be = libbe_init(root)) == NULL) { > + fprintf(stderr, "libbe_init(\"%s\") failed.\n", > + root != NULL ? root : ""); > return (-1); > + } > > libbe_print_on_error(be, !cmd->silent); > This should be gated on !cmd->silent, because some paths have consumers that are specifically designed to not have to deal with redirecting stderr. It was quite intentional that this didn't previously print anything. Thanks, Kyle Evans ___ 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: r368116 - head/sys/kern
Author: kevans Date: Sat Nov 28 01:21:11 2020 New Revision: 368116 URL: https://svnweb.freebsd.org/changeset/base/368116 Log: kern: cpuset: drop the lock to allocate domainsets Restructure the loop a little bit to make it a little more clear how it really operates: we never allocate any domains at the beginning of the first iteration, and it will run until we've satisfied the amount we need or we encounter an error. The lock is now taken outside of the loop to make stuff inside the loop easier to evaluate w.r.t. locking. This fixes it to not try and allocate any domains for the freelist under the spinlock, which would have happened before if we needed any new domains. Reported by: syzbot+6743fa07b9b7528dc...@syzkaller.appspotmail.com Reviewed by: markj MFC after:3 days Differential Revision:https://reviews.freebsd.org/D27371 Modified: head/sys/kern/kern_cpuset.c Modified: head/sys/kern/kern_cpuset.c == --- head/sys/kern/kern_cpuset.c Sat Nov 28 01:16:59 2020(r368115) +++ head/sys/kern/kern_cpuset.c Sat Nov 28 01:21:11 2020(r368116) @@ -794,14 +794,11 @@ cpuset_modify_domain(struct cpuset *set, struct domain return (EPERM); domainset_freelist_init(&domains, 0); domain = domainset_create(domain); - ndomains = needed = 0; - do { - if (ndomains < needed) { - domainset_freelist_add(&domains, needed - ndomains); - ndomains = needed; - } + ndomains = 0; + + mtx_lock_spin(&cpuset_lock); + for (;;) { root = cpuset_getroot(set); - mtx_lock_spin(&cpuset_lock); dset = root->cs_domain; /* * Verify that we have access to this set of domains. @@ -826,7 +823,15 @@ cpuset_modify_domain(struct cpuset *set, struct domain &needed, 0); if (error) goto out; - } while (ndomains < needed); + if (ndomains >= needed) + break; + + /* Dropping the lock; we'll need to re-evaluate again. */ + mtx_unlock_spin(&cpuset_lock); + domainset_freelist_add(&domains, needed - ndomains); + ndomains = needed; + mtx_lock_spin(&cpuset_lock); + } dset = set->cs_domain; cpuset_update_domain(set, domain, dset, &domains); out: ___ 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: r368011 - head/sys/kern
Author: kevans Date: Wed Nov 25 03:14:25 2020 New Revision: 368011 URL: https://svnweb.freebsd.org/changeset/base/368011 Log: kern: cpuset: properly rebase when attaching to a jail The current logic is a fine choice for a system administrator modifying process cpusets or a process creating a new cpuset(2), but not ideal for processes attaching to a jail. Currently, when a process attaches to a jail, it does exactly what any other process does and loses any mask it might have applied in the process of doing so because cpuset_setproc() is entirely based around the assumption that non-anonymous cpusets in the process can be replaced with the new parent set. This approach slightly improves the jail attach integration by modifying cpuset_setproc() callers to indicate if they should rebase their cpuset to the indicated set or not (i.e. cpuset_setproc_update_set). If we're rebasing and the process currently has a cpuset assigned that is not the containing jail's root set, then we will now create a new base set for it hanging off the jail's root with the existing mask applied instead of using the jail's root set as the new base set. Note that the common case will be that the process doesn't have a cpuset within the jail root, but the system root can freely assign a cpuset from a jail to a process outside of the jail with no restriction. We assume that that may have happened or that it could happen due to a race when we drop the proc lock, so we must recheck both within the loop to gather up sufficient freed cpusets and after the loop. To recap, here's how it worked before in all cases: 0 4 <-- jail 0 4 <-- jail / process | | 1 -> 1 | 3 <-- process Here's how it works now: 0 4 <-- jail 0 4 <-- jail || | 1 -> 1 5 <-- process | 3 <-- process or 0 4 <-- jail 0 4 <-- jail / process || 1 <-- process -> 1 More importantly, in both cases, the attaching process still retains the mask it had prior to attaching or the attach fails with EDEADLK if it's left with no CPUs to run on or the domain policy is incompatible. The author of this patch considers this almost a security feature, because a MAC policy could grant PRIV_JAIL_ATTACH to an unprivileged user that's restricted to some subset of available CPUs the ability to attach to a jail, which might lift the user's restrictions if they attach to a jail with a wider mask. In most cases, it's anticipated that admins will use this to be able to, for example, `cpuset -c -l 1 jail -c path=/ command=/long/running/cmd`, and avoid the need for contortions to spawn a command inside a jail with a more limited cpuset than the jail. Reviewed by: jamie MFC after:1 month (maybe) Differential Revision:https://reviews.freebsd.org/D27298 Modified: head/sys/kern/kern_cpuset.c Modified: head/sys/kern/kern_cpuset.c == --- head/sys/kern/kern_cpuset.c Wed Nov 25 02:12:24 2020(r368010) +++ head/sys/kern/kern_cpuset.c Wed Nov 25 03:14:25 2020(r368011) @@ -1104,14 +1104,63 @@ cpuset_setproc_setthread(struct cpuset *tdset, struct domainlist); } +static int +cpuset_setproc_newbase(struct thread *td, struct cpuset *set, +struct cpuset *nroot, struct cpuset **nsetp, +struct setlist *cpusets, struct domainlist *domainlist) +{ + struct domainset ndomain; + cpuset_t nmask; + struct cpuset *pbase; + int error; + + pbase = cpuset_getbase(td->td_cpuset); + + /* Copy process mask, then further apply the new root mask. */ + CPU_COPY(&pbase->cs_mask, &nmask); + CPU_AND(&nmask, &nroot->cs_mask); + + domainset_copy(pbase->cs_domain, &ndomain); + DOMAINSET_AND(&ndomain.ds_mask, &set->cs_domain->ds_mask); + + /* Policy is too restrictive, will not work. */ + if (CPU_EMPTY(&nmask) || DOMAINSET_EMPTY(&ndomain.ds_mask)) + return (EDEADLK); + + /* +* Remove pbase from the freelist in advance, it'll be pushed to +* cpuset_ids on success. We assume here that cpuset_create() will not +* touch pbase on failure, and we just enqueue it back to the freelist +* to remain in a consistent state. +*/ + pbase = LIST_FIRST(cpusets); + LIST_REMOVE(pbase, cs_link); + error = cpuset_create(&pbase, set, &nmask); + if (error != 0) { + LIST_INSERT_HEAD(cpusets, pbase, cs_link); + return (error); + } + + /* Duplicates some work from above... oh well. */ + pbase->cs_domain = domainset_shadow(set->cs_domain, &ndomain, + domainlist); +
svn commit: r368010 - head/sys/kern
Author: kevans Date: Wed Nov 25 02:12:24 2020 New Revision: 368010 URL: https://svnweb.freebsd.org/changeset/base/368010 Log: kern: cpuset: rename _cpuset_create() to cpuset_init() cpuset_init() is better descriptor for what the function actually does. The name was previously taken by a sysinit that setup cpuset_zero's mask from all_cpus, it was removed in r331698 before stable/12 branched. A comment referencing the removed sysinit has now also been removed, since the setup previously done was moved into cpuset_thread0(). Suggested by: markj MFC after:1 week Modified: head/sys/kern/kern_cpuset.c Modified: head/sys/kern/kern_cpuset.c == --- head/sys/kern/kern_cpuset.c Wed Nov 25 01:42:32 2020(r368009) +++ head/sys/kern/kern_cpuset.c Wed Nov 25 02:12:24 2020(r368010) @@ -287,12 +287,12 @@ cpuset_lookup(cpusetid_t setid, struct thread *td) } /* - * Create a set in the space provided in 'set' with the provided parameters. + * Initialize a set in the space provided in 'set' with the provided parameters. * The set is returned with a single ref. May return EDEADLK if the set * will have no valid cpu based on restrictions from the parent. */ static int -_cpuset_create(struct cpuset *set, struct cpuset *parent, +cpuset_init(struct cpuset *set, struct cpuset *parent, const cpuset_t *mask, struct domainset *domain, cpusetid_t id) { @@ -347,7 +347,7 @@ cpuset_create(struct cpuset **setp, struct cpuset *par set = *setp; else *setp = set = uma_zalloc(cpuset_zone, M_WAITOK | M_ZERO); - error = _cpuset_create(set, parent, mask, NULL, id); + error = cpuset_init(set, parent, mask, NULL, id); if (error == 0) return (0); free_unr(cpuset_unr, id); @@ -983,7 +983,7 @@ cpuset_shadow(struct cpuset *set, struct cpuset **nset else d = set->cs_domain; nset = LIST_FIRST(cpusets); - error = _cpuset_create(nset, parent, mask, d, CPUSET_INVALID); + error = cpuset_init(nset, parent, mask, d, CPUSET_INVALID); if (error == 0) { LIST_REMOVE(nset, cs_link); *nsetp = nset; @@ -1463,9 +1463,7 @@ domainset_zero(void) * sets: * * 0 - The root set which should represent all valid processors in the - * system. It is initially created with a mask of all processors - * because we don't know what processors are valid until cpuset_init() - * runs. This set is immutable. + * system. This set is immutable. * 1 - The default set which all processes are a member of until changed. * This allows an administrator to move all threads off of given cpus to * dedicate them to high priority tasks or save power etc. @@ -1502,14 +1500,14 @@ cpuset_thread0(void) * Now derive a default (1), modifiable set from that to give out. */ set = uma_zalloc(cpuset_zone, M_WAITOK | M_ZERO); - error = _cpuset_create(set, cpuset_zero, NULL, NULL, 1); + error = cpuset_init(set, cpuset_zero, NULL, NULL, 1); KASSERT(error == 0, ("Error creating default set: %d\n", error)); cpuset_default = set; /* * Create the kernel set (2). */ set = uma_zalloc(cpuset_zone, M_WAITOK | M_ZERO); - error = _cpuset_create(set, cpuset_zero, NULL, NULL, 2); + error = cpuset_init(set, cpuset_zero, NULL, NULL, 2); KASSERT(error == 0, ("Error creating kernel set: %d\n", error)); set->cs_domain = &domainset2; cpuset_kernel = set; ___ 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: r368009 - head/sys/kern
Author: kevans Date: Wed Nov 25 01:42:32 2020 New Revision: 368009 URL: https://svnweb.freebsd.org/changeset/base/368009 Log: kern: cpuset: allow cpuset_create() to take an allocated *setp Currently, it must always allocate a new set to be used for passing to _cpuset_create, but it doesn't have to. This is purely kern_cpuset.c internal and it's sparsely used, so just change it to use *setp if it's not-NULL and modify the two consumers to pass in the address of a NULL cpuset. This paves the way for consumers that want the unr allocation without the possibility of sleeping as long as they've done their due diligence to ensure that the mask will properly apply atop the supplied parent (i.e. avoiding the free_unr() in the last failure path). Reviewed by: jamie, markj MFC after:1 week Differential Revision:https://reviews.freebsd.org/D27297 Modified: head/sys/kern/kern_cpuset.c Modified: head/sys/kern/kern_cpuset.c == --- head/sys/kern/kern_cpuset.c Wed Nov 25 01:31:00 2020(r368008) +++ head/sys/kern/kern_cpuset.c Wed Nov 25 01:42:32 2020(r368009) @@ -326,6 +326,10 @@ _cpuset_create(struct cpuset *set, struct cpuset *pare * Create a new non-anonymous set with the requested parent and mask. May * return failures if the mask is invalid or a new number can not be * allocated. + * + * If *setp is not NULL, then it will be used as-is. The caller must take + * into account that *setp will be inserted at the head of cpuset_ids and + * plan any potentially conflicting cs_link usage accordingly. */ static int cpuset_create(struct cpuset **setp, struct cpuset *parent, const cpuset_t *mask) @@ -333,16 +337,22 @@ cpuset_create(struct cpuset **setp, struct cpuset *par struct cpuset *set; cpusetid_t id; int error; + bool dofree; id = alloc_unr(cpuset_unr); if (id == -1) return (ENFILE); - *setp = set = uma_zalloc(cpuset_zone, M_WAITOK | M_ZERO); + dofree = (*setp == NULL); + if (*setp != NULL) + set = *setp; + else + *setp = set = uma_zalloc(cpuset_zone, M_WAITOK | M_ZERO); error = _cpuset_create(set, parent, mask, NULL, id); if (error == 0) return (0); free_unr(cpuset_unr, id); - uma_zfree(cpuset_zone, set); + if (dofree) + uma_zfree(cpuset_zone, set); return (error); } @@ -1552,16 +1562,17 @@ cpuset_create_root(struct prison *pr, struct cpuset ** KASSERT(pr != NULL, ("[%s:%d] invalid pr", __func__, __LINE__)); KASSERT(setp != NULL, ("[%s:%d] invalid setp", __func__, __LINE__)); - error = cpuset_create(setp, pr->pr_cpuset, &pr->pr_cpuset->cs_mask); + set = NULL; + error = cpuset_create(&set, pr->pr_cpuset, &pr->pr_cpuset->cs_mask); if (error) return (error); - KASSERT(*setp != NULL, ("[%s:%d] cpuset_create returned invalid data", + KASSERT(set != NULL, ("[%s:%d] cpuset_create returned invalid data", __func__, __LINE__)); /* Mark the set as root. */ - set = *setp; set->cs_flags |= CPU_SET_ROOT; + *setp = set; return (0); } @@ -1618,6 +1629,7 @@ sys_cpuset(struct thread *td, struct cpuset_args *uap) thread_lock(td); root = cpuset_refroot(td->td_cpuset); thread_unlock(td); + set = NULL; error = cpuset_create(&set, root, &root->cs_mask); cpuset_rel(root); if (error) ___ 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: r368006 - head/sys/kern
Author: kevans Date: Wed Nov 25 01:08:57 2020 New Revision: 368006 URL: https://svnweb.freebsd.org/changeset/base/368006 Log: kern: never restart syscalls calling closefp(), e.g. close(2) All paths leading into closefp() will either replace or remove the fd from the filedesc table, and closefp() will call fo_close methods that can and do currently sleep without regard for the possibility of an ERESTART. This can be dangerous in multithreaded applications as another thread could have opened another file in its place that is subsequently operated on upon restart. The following are seemingly the only ones that will pass back ERESTART in-tree: - sockets (SO_LINGER) - fusefs - nfsclient Reviewed by: jilles, kib MFC after:1 week Differential Revision:https://reviews.freebsd.org/D27310 Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c == --- head/sys/kern/kern_descrip.cWed Nov 25 00:10:54 2020 (r368005) +++ head/sys/kern/kern_descrip.cWed Nov 25 01:08:57 2020 (r368006) @@ -1279,6 +1279,15 @@ closefp(struct filedesc *fdp, int fd, struct file *fp, FILEDESC_XUNLOCK(fdp); error = closef(fp, td); + + /* +* All paths leading up to closefp() will have already removed or +* replaced the fd in the filedesc table, so a restart would not +* operate on the same file. +*/ + if (error == ERESTART) + error = EINTR; + if (holdleaders) { FILEDESC_XLOCK(fdp); fdp->fd_holdleaderscount--; ___ 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: r367944 - head/sys/kern
Author: kevans Date: Mon Nov 23 02:49:53 2020 New Revision: 367944 URL: https://svnweb.freebsd.org/changeset/base/367944 Log: cpuset_setproc: use the appropriate parent for new anonymous sets As far as I can tell, this has been the case since initially committed in 2008. cpuset_setproc is the executor of cpuset reassignment; note this excerpt from the description: * 1) Set is non-null. This reparents all anonymous sets to the provided *set and replaces all non-anonymous td_cpusets with the provided set. However, reviewing cpuset_setproc_setthread() for some jail related work unearthed the error: if tdset was not anonymous, we were replacing it with `set`. If it was anonymous, then we'd rebase it onto `set` (i.e. copy the thread's mask over and AND it with `set`) but give the new anonymous set the original tdset as the parent (i.e. the base of the set we're supposed to be leaving behind). The primary visible consequences were that: 1.) cpuset_getid() following such assignment returns the wrong result, the setid that we left behind rather than the one we joined. 2.) When a process attached to the jail, the base set of any anonymous threads was a set outside of the jail. This was initially bundled in D27298, but it's a minor fix that's fairly easy to verify the correctness of. A test is included in D27307 ("badparent"), which demonstrates the issue with, effectively: osetid = cpuset_getid() newsetid = cpuset() cpuset_setaffinity(thread) cpuset_setid(osetid) cpuset_getid(thread) -> observe that it matches newsetid instead of osetid. MFC after:1 week Modified: head/sys/kern/kern_cpuset.c Modified: head/sys/kern/kern_cpuset.c == --- head/sys/kern/kern_cpuset.c Mon Nov 23 00:58:14 2020(r367943) +++ head/sys/kern/kern_cpuset.c Mon Nov 23 02:49:53 2020(r367944) @@ -1090,7 +1090,7 @@ cpuset_setproc_setthread(struct cpuset *tdset, struct if (error) return (error); - return cpuset_shadow(tdset, nsetp, &mask, &domain, freelist, + return cpuset_shadow(set, nsetp, &mask, &domain, freelist, domainlist); } ___ 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: r367943 - in head/sys: compat/freebsd32 kern
Author: kevans Date: Mon Nov 23 00:58:14 2020 New Revision: 367943 URL: https://svnweb.freebsd.org/changeset/base/367943 Log: freebsd32: take the _umtx_op struct definitions back Providing these in freebsd32.h facilitates local testing/measuring of the structs rather than forcing one to locally recreate them. Sanity checking offsets/sizes remains in kern_umtx.c where these are typically used. Modified: head/sys/compat/freebsd32/freebsd32.h head/sys/kern/kern_umtx.c Modified: head/sys/compat/freebsd32/freebsd32.h == --- head/sys/compat/freebsd32/freebsd32.h Mon Nov 23 00:33:06 2020 (r367942) +++ head/sys/compat/freebsd32/freebsd32.h Mon Nov 23 00:58:14 2020 (r367943) @@ -94,6 +94,27 @@ struct itimerval32 { struct timeval32 it_value; }; +struct umtx_time32 { + struct timespec32 _timeout; + uint32_t_flags; + uint32_t_clockid; +}; + +struct umtx_robust_lists_params_compat32 { + uint32_trobust_list_offset; + uint32_trobust_priv_list_offset; + uint32_trobust_inact_offset; +}; + +struct umutex32 { + volatile __lwpid_t m_owner;/* Owner of the mutex */ + __uint32_t m_flags;/* Flags of the mutex */ + __uint32_t m_ceilings[2]; /* Priority protect ceiling */ + __uint32_t m_rb_lnk; /* Robust linkage */ + __uint32_t m_pad; + __uint32_t m_spare[2]; +}; + #define FREEBSD4_MFSNAMELEN16 #define FREEBSD4_MNAMELEN (88 - 2 * sizeof(int32_t)) Modified: head/sys/kern/kern_umtx.c == --- head/sys/kern/kern_umtx.c Mon Nov 23 00:33:06 2020(r367942) +++ head/sys/kern/kern_umtx.c Mon Nov 23 00:58:14 2020(r367943) @@ -232,27 +232,6 @@ struct umtx_copyops { const bool compat32; }; -struct umtx_time32 { - struct timespec32 _timeout; - uint32_t_flags; - uint32_t_clockid; -}; - -struct umtx_robust_lists_params_compat32 { - uint32_trobust_list_offset; - uint32_trobust_priv_list_offset; - uint32_trobust_inact_offset; -}; - -struct umutex32 { - volatile __lwpid_t m_owner;/* Owner of the mutex */ - __uint32_t m_flags;/* Flags of the mutex */ - __uint32_t m_ceilings[2]; /* Priority protect ceiling */ - __uint32_t m_rb_lnk; /* Robust linkage */ - __uint32_t m_pad; - __uint32_t m_spare[2]; -}; - _Static_assert(sizeof(struct umutex) == sizeof(struct umutex32), "umutex32"); _Static_assert(__offsetof(struct umutex, m_spare[0]) == __offsetof(struct umutex32, m_spare[0]), "m_spare32"); ___ 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: r367942 - head/sys/kern
Author: kevans Date: Mon Nov 23 00:33:06 2020 New Revision: 367942 URL: https://svnweb.freebsd.org/changeset/base/367942 Log: kern: dup: do not assume oldfde is valid oldfde may be invalidated if the table has grown due to the operation that we're performing, either via fdalloc() or a direct fdgrowtable_exp(). This was technically OK before rS367927 because the old table remained valid until the filedesc became unused, but now it may be freed immediately if it's an unshared table in a single-threaded process, so it is no longer a good assumption to make. This fixes dup/dup2 invocations that grow the file table; in the initial report, it manifested as a kernel panic in devel/gmake's configure script. Reported by: Guy Yur Reviewed by: rew Differential Revision:https://reviews.freebsd.org/D27319 Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c == --- head/sys/kern/kern_descrip.cSun Nov 22 20:21:10 2020 (r367941) +++ head/sys/kern/kern_descrip.cMon Nov 23 00:33:06 2020 (r367942) @@ -870,7 +870,7 @@ kern_dup(struct thread *td, u_int mode, int flags, int struct filedesc *fdp; struct filedescent *oldfde, *newfde; struct proc *p; - struct file *delfp; + struct file *delfp, *oldfp; u_long *oioctls, *nioctls; int error, maxfd; @@ -910,7 +910,8 @@ kern_dup(struct thread *td, u_int mode, int flags, int } oldfde = &fdp->fd_ofiles[old]; - if (!fhold(oldfde->fde_file)) + oldfp = oldfde->fde_file; + if (!fhold(oldfp)) goto unlock; /* @@ -922,14 +923,14 @@ kern_dup(struct thread *td, u_int mode, int flags, int case FDDUP_NORMAL: case FDDUP_FCNTL: if ((error = fdalloc(td, new, &new)) != 0) { - fdrop(oldfde->fde_file, td); + fdrop(oldfp, td); goto unlock; } break; case FDDUP_MUSTREPLACE: /* Target file descriptor must exist. */ if (fget_locked(fdp, new) == NULL) { - fdrop(oldfde->fde_file, td); + fdrop(oldfp, td); goto unlock; } break; @@ -948,7 +949,7 @@ kern_dup(struct thread *td, u_int mode, int flags, int error = racct_set_unlocked(p, RACCT_NOFILE, new + 1); if (error != 0) { error = EMFILE; - fdrop(oldfde->fde_file, td); + fdrop(oldfp, td); goto unlock; } } @@ -963,6 +964,12 @@ kern_dup(struct thread *td, u_int mode, int flags, int } KASSERT(old != new, ("new fd is same as old")); + + /* Refetch oldfde because the table may have grown and old one freed. */ + oldfde = &fdp->fd_ofiles[old]; + KASSERT(oldfp == oldfde->fde_file, + ("fdt_ofiles shift from growth observed at fd %d", + old)); newfde = &fdp->fd_ofiles[new]; delfp = newfde->fde_file; ___ 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"
Re: svn commit: r367928 - in head/sys: compat/freebsd32 kern sys
On Sun, Nov 22, 2020 at 1:55 AM Konstantin Belousov wrote: > > On Sun, Nov 22, 2020 at 05:34:51AM +, Kyle Evans wrote: > > Author: kevans > > Date: Sun Nov 22 05:34:51 2020 > > New Revision: 367928 > > URL: https://svnweb.freebsd.org/changeset/base/367928 > > > > Log: > > _umtx_op: move compat32 definitions back in > > > > These are reasonably compact, and a future commit will blur the compat32 > > lines by supporting 32-bit operations with the native _umtx_op. > > I do not mind much about placement of the compat32 syscall stubs, but I > did suggested and liked move of the compat32 structures definitions into > freebsd32.h. > > They are actually useful that way, at least allowing me to write some > (private) > tests in the past. Ah, sure, sorry- this doesn't force us to re-add implementation details to other headers, so I don't see any problem. I will move just the struct definitions back shortly. ___ 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"
Re: svn commit: r367927 - in head: sys/kern tests/sys/kern
On Sun, Nov 22, 2020 at 11:25 AM Kyle Evans wrote: > > On Sun, Nov 22, 2020 at 10:36 AM Kyle Evans wrote: > > > > On Sun, Nov 22, 2020 at 9:54 AM Guy Yur wrote: > > > > > > On 22/11/20 7:00 am, Robert Wing wrote: > > > > Author: rew > > > > Date: Sun Nov 22 05:00:28 2020 > > > > New Revision: 367927 > > > > URL: https://svnweb.freebsd.org/changeset/base/367927 > > > > > > > > Log: > > > >fd: free old file descriptor tables when not shared > > > > > > > >During the life of a process, new file descriptor tables may be > > > > allocated. When > > > >a new table is allocated, the old table is placed in a free list and > > > > held onto > > > >until all processes referencing them exit. > > > > > > > >When a new file descriptor table is allocated, the old file > > > > descriptor table > > > >can be freed when the current process has a single-thread and the > > > > file > > > >descriptor table is not being shared with any other processes. > > > > > > > >Reviewed by:kevans > > > >Approved by:kevans (mentor) > > > >Differential Revision: https://reviews.freebsd.org/D18617 > > > > > > > > Added: > > > >head/tests/sys/kern/fdgrowtable_test.c (contents, props changed) > > > > Modified: > > > >head/sys/kern/kern_descrip.c > > > >head/tests/sys/kern/Makefile > > > > > > Hi, > > > > > > I am getting a kernel panic with this commit when building > > > devel/gmake port and it runs dup2 test in configure script. > > > > > > panic: fc_ioctls != NULL, but fc_nioctls=-16162 > > > ... > > > #10 0x80655c72 in vpanic (fmt=, ap=) > > > at /usr/src/sys/kern/kern_shutdown.c:907 > > > #11 0x80655a03 in panic ( > > > fmt=0x80eb2b78 "헝\200\377\377\377\377") > > > at /usr/src/sys/kern/kern_shutdown.c:843 > > > #12 0x805fff9a in filecaps_copy_prep (src=) > > > at /usr/src/sys/kern/kern_descrip.c:1629 > > > #13 kern_dup (td=, mode=, flags=0, > > > old=, new=256) at /usr/src/sys/kern/kern_descrip.c:970 > > > #14 0x8094a5de in syscallenter (td=) > > > at /usr/src/sys/amd64/amd64/../../kern/subr_syscall.c:189 > > > #15 amd64_syscall (td=0xfe00513f8500, traced=0) > > > at /usr/src/sys/amd64/amd64/trap.c:1156 > > > > > > > > > Simplified test program that causes panic: > > > #include > > > #include > > > > > > int main () > > > { > > >int bad_fd = INT_MAX; > > >dup2 (1, 1); > > >close (0); > > >dup2 (0, 0); > > >dup2 (2, bad_fd); > > >dup2 (2, -1); > > >dup2 (2, 255); > > >dup2 (2, 256); > > >return 0; > > > } > > > > > > > Whoops. =\ > > > > It looks like kern_dup grows the file table but assumes that it can > > continue using oldfe that it fetched from the now-freed table. I > > suspect we just need to refetch oldfde after the grow operation, and > > it might be a good idea (under INVARIANTS) to grab the fp from oldfde > > before we grow the table and assert that the new entry we fetch is the > > same underlying file. > > > > I can confirm that the below fixes it and no other growth spots keep > pointers into the old table around, I'll give it a little bit for any > objections to be raised then commit. > Bah, sorry, this still isn't right. The other paths may grow the table via fdalloc(). I'll throw up a review for this shortly. ___ 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"
Re: svn commit: r367927 - in head: sys/kern tests/sys/kern
On Sun, Nov 22, 2020 at 10:36 AM Kyle Evans wrote: > > On Sun, Nov 22, 2020 at 9:54 AM Guy Yur wrote: > > > > On 22/11/20 7:00 am, Robert Wing wrote: > > > Author: rew > > > Date: Sun Nov 22 05:00:28 2020 > > > New Revision: 367927 > > > URL: https://svnweb.freebsd.org/changeset/base/367927 > > > > > > Log: > > >fd: free old file descriptor tables when not shared > > > > > >During the life of a process, new file descriptor tables may be > > > allocated. When > > >a new table is allocated, the old table is placed in a free list and > > > held onto > > >until all processes referencing them exit. > > > > > >When a new file descriptor table is allocated, the old file descriptor > > > table > > >can be freed when the current process has a single-thread and the file > > >descriptor table is not being shared with any other processes. > > > > > >Reviewed by:kevans > > >Approved by:kevans (mentor) > > >Differential Revision: https://reviews.freebsd.org/D18617 > > > > > > Added: > > >head/tests/sys/kern/fdgrowtable_test.c (contents, props changed) > > > Modified: > > >head/sys/kern/kern_descrip.c > > >head/tests/sys/kern/Makefile > > > > Hi, > > > > I am getting a kernel panic with this commit when building > > devel/gmake port and it runs dup2 test in configure script. > > > > panic: fc_ioctls != NULL, but fc_nioctls=-16162 > > ... > > #10 0x80655c72 in vpanic (fmt=, ap=) > > at /usr/src/sys/kern/kern_shutdown.c:907 > > #11 0x80655a03 in panic ( > > fmt=0x80eb2b78 "헝\200\377\377\377\377") > > at /usr/src/sys/kern/kern_shutdown.c:843 > > #12 0x805fff9a in filecaps_copy_prep (src=) > > at /usr/src/sys/kern/kern_descrip.c:1629 > > #13 kern_dup (td=, mode=, flags=0, > > old=, new=256) at /usr/src/sys/kern/kern_descrip.c:970 > > #14 0x8094a5de in syscallenter (td=) > > at /usr/src/sys/amd64/amd64/../../kern/subr_syscall.c:189 > > #15 amd64_syscall (td=0xfe00513f8500, traced=0) > > at /usr/src/sys/amd64/amd64/trap.c:1156 > > > > > > Simplified test program that causes panic: > > #include > > #include > > > > int main () > > { > >int bad_fd = INT_MAX; > >dup2 (1, 1); > >close (0); > >dup2 (0, 0); > >dup2 (2, bad_fd); > >dup2 (2, -1); > >dup2 (2, 255); > >dup2 (2, 256); > >return 0; > > } > > > > Whoops. =\ > > It looks like kern_dup grows the file table but assumes that it can > continue using oldfe that it fetched from the now-freed table. I > suspect we just need to refetch oldfde after the grow operation, and > it might be a good idea (under INVARIANTS) to grab the fp from oldfde > before we grow the table and assert that the new entry we fetch is the > same underlying file. > I can confirm that the below fixes it and no other growth spots keep pointers into the old table around, I'll give it a little bit for any objections to be raised then commit. diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index b5680bd79e1..1a3a5cafbea 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -936,6 +936,12 @@ kern_dup(struct thread *td, u_int mode, int flags, int old, int new) break; case FDDUP_FIXED: if (new >= fdp->fd_nfiles) { +#ifdef INVARIANTS + struct file *ofp; + + ofp = oldfde->fde_file; +#endif + /* * The resource limits are here instead of e.g. * fdalloc(), because the file descriptor table may be @@ -955,6 +961,11 @@ kern_dup(struct thread *td, u_int mode, int flags, int old, int new) } #endif fdgrowtable_exp(fdp, new + 1); + /* Refetch; old entry may be invalid. */ + oldfde = &fdp->fd_ofiles[old]; + KASSERT(ofp == oldfde->fde_file, + ("fdt_ofiles shift from growth observed at fd %d", + old)); } if (!fdisused(fdp, new)) fdused(fdp, new); ___ 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"
Re: svn commit: r367927 - in head: sys/kern tests/sys/kern
On Sun, Nov 22, 2020 at 9:54 AM Guy Yur wrote: > > On 22/11/20 7:00 am, Robert Wing wrote: > > Author: rew > > Date: Sun Nov 22 05:00:28 2020 > > New Revision: 367927 > > URL: https://svnweb.freebsd.org/changeset/base/367927 > > > > Log: > >fd: free old file descriptor tables when not shared > > > >During the life of a process, new file descriptor tables may be > > allocated. When > >a new table is allocated, the old table is placed in a free list and > > held onto > >until all processes referencing them exit. > > > >When a new file descriptor table is allocated, the old file descriptor > > table > >can be freed when the current process has a single-thread and the file > >descriptor table is not being shared with any other processes. > > > >Reviewed by:kevans > >Approved by:kevans (mentor) > >Differential Revision: https://reviews.freebsd.org/D18617 > > > > Added: > >head/tests/sys/kern/fdgrowtable_test.c (contents, props changed) > > Modified: > >head/sys/kern/kern_descrip.c > >head/tests/sys/kern/Makefile > > Hi, > > I am getting a kernel panic with this commit when building > devel/gmake port and it runs dup2 test in configure script. > > panic: fc_ioctls != NULL, but fc_nioctls=-16162 > ... > #10 0x80655c72 in vpanic (fmt=, ap=) > at /usr/src/sys/kern/kern_shutdown.c:907 > #11 0x80655a03 in panic ( > fmt=0x80eb2b78 "헝\200\377\377\377\377") > at /usr/src/sys/kern/kern_shutdown.c:843 > #12 0x805fff9a in filecaps_copy_prep (src=) > at /usr/src/sys/kern/kern_descrip.c:1629 > #13 kern_dup (td=, mode=, flags=0, > old=, new=256) at /usr/src/sys/kern/kern_descrip.c:970 > #14 0x8094a5de in syscallenter (td=) > at /usr/src/sys/amd64/amd64/../../kern/subr_syscall.c:189 > #15 amd64_syscall (td=0xfe00513f8500, traced=0) > at /usr/src/sys/amd64/amd64/trap.c:1156 > > > Simplified test program that causes panic: > #include > #include > > int main () > { >int bad_fd = INT_MAX; >dup2 (1, 1); >close (0); >dup2 (0, 0); >dup2 (2, bad_fd); >dup2 (2, -1); >dup2 (2, 255); >dup2 (2, 256); >return 0; > } > Whoops. =\ It looks like kern_dup grows the file table but assumes that it can continue using oldfe that it fetched from the now-freed table. I suspect we just need to refetch oldfde after the grow operation, and it might be a good idea (under INVARIANTS) to grab the fp from oldfde before we grow the table and assert that the new entry we fetch is the same underlying file. Thanks, Kyle Evans ___ 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"
Re: svn commit: r367929 - head/sys/dev/isp
On Sat, Nov 21, 2020 at 11:43 PM Alexander Motin wrote: > > Author: mav > Date: Sun Nov 22 05:42:52 2020 > New Revision: 367929 > URL: https://svnweb.freebsd.org/changeset/base/367929 > > Log: > Fix build after 367926. > > Option ISP_TARGET_MODE is evil. > The LINT build appears to be broken following these, see: https://ci.freebsd.org/job/FreeBSD-head-amd64-LINT/18514/console 09:02:49 --- isp_freebsd.o --- 09:02:49 /workspace/src/sys/dev/isp/isp_freebsd.c:1483:26: error: more '%' conversions than data arguments [-Werror,-Wformat] 09:02:49 KASSERT(atp == NULL, ("%s: atp is not NULL on noresrc!\n")); 09:02:49~^ ___ 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"
Re: svn commit: r367930 - in head/sys: kern sys
On Sat, Nov 21, 2020 at 11:47 PM Kyle Evans wrote: > > Author: kevans > Date: Sun Nov 22 05:47:45 2020 > New Revision: 367930 > URL: https://svnweb.freebsd.org/changeset/base/367930 > > Log: > [2/2] _umtx_op: introduce 32-bit/i386 flags for operations > > This patch takes advantage of the consolidation that happened to provide two > flags that can be used with the native _umtx_op(2): UMTX_OP___32BIT and > UMTX_OP__I386. > > UMTX_OP__32BIT iindicates that we are being provided with 32-bit structures. > Note that this flag alone indicates a 64bit time_t, since this is the > majority case. > > UMTX_OP__I386 has been provided so that we can emulate i386 as well, > regardless of whether the host is amd64 or not. > > Both imply a different set of copyops in sysumtx_op. freebsd32__umtx_op > simply ignores the flags, since it's already doing a 32-bit operation and > it's unlikely we'll be running an emulator under compat32. Future work > could consider it, but the author sees little benefit. > > This will be used by qemu-bsd-user to pass on all _umtx_op calls to the > native interface as long as the host/target endianness matches, effectively > eliminating most if not all of the remaining unresolved deadlocks for most. > > This version changed a fair amount from what was under review, mostly in > response to refactoring of the prereq reorganization and battle-testing > it with qemu-bsd-user. The main changes are as follows: > > 1.) The i386 flag got renamed to omit '32BIT' since this is redundant. > 2.) The flags are now properly handled on 32-bit platforms to emulate other > 32-bit platforms. > 3.) Robust list handling was fixed, and the 32-bit functionality that was > previously gated by COMPAT_FREEBSD32 is now unconditional. > 4.) Robust list handling was also improved, including the error reported > when a process has already registered 32-bit ABI lists and also > detecting if native robust lists have already been registered. Both > scenarios now return EBUSY rather than EINVAL, because the input is > technically valid but we're too busy with another ABI's lists. > > libsysdecode/kdump/truss support will go into review soon-ish, along with > the associated manpage update. > > Reviewed by: kib (earlier version) > MFC after:3 weeks > Differential Revision: https://reviews.freebsd.org/D27223 ___ 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: r367930 - in head/sys: kern sys
Author: kevans Date: Sun Nov 22 05:47:45 2020 New Revision: 367930 URL: https://svnweb.freebsd.org/changeset/base/367930 Log: [2/2] _umtx_op: introduce 32-bit/i386 flags for operations This patch takes advantage of the consolidation that happened to provide two flags that can be used with the native _umtx_op(2): UMTX_OP___32BIT and UMTX_OP__I386. UMTX_OP__32BIT iindicates that we are being provided with 32-bit structures. Note that this flag alone indicates a 64bit time_t, since this is the majority case. UMTX_OP__I386 has been provided so that we can emulate i386 as well, regardless of whether the host is amd64 or not. Both imply a different set of copyops in sysumtx_op. freebsd32__umtx_op simply ignores the flags, since it's already doing a 32-bit operation and it's unlikely we'll be running an emulator under compat32. Future work could consider it, but the author sees little benefit. This will be used by qemu-bsd-user to pass on all _umtx_op calls to the native interface as long as the host/target endianness matches, effectively eliminating most if not all of the remaining unresolved deadlocks for most. This version changed a fair amount from what was under review, mostly in response to refactoring of the prereq reorganization and battle-testing it with qemu-bsd-user. The main changes are as follows: 1.) The i386 flag got renamed to omit '32BIT' since this is redundant. 2.) The flags are now properly handled on 32-bit platforms to emulate other 32-bit platforms. 3.) Robust list handling was fixed, and the 32-bit functionality that was previously gated by COMPAT_FREEBSD32 is now unconditional. 4.) Robust list handling was also improved, including the error reported when a process has already registered 32-bit ABI lists and also detecting if native robust lists have already been registered. Both scenarios now return EBUSY rather than EINVAL, because the input is technically valid but we're too busy with another ABI's lists. libsysdecode/kdump/truss support will go into review soon-ish, along with the associated manpage update. Reviewed by: kib (earlier version) MFC after:3 weeks Modified: head/sys/kern/kern_umtx.c head/sys/sys/umtx.h Modified: head/sys/kern/kern_umtx.c == --- head/sys/kern/kern_umtx.c Sun Nov 22 05:42:52 2020(r367929) +++ head/sys/kern/kern_umtx.c Sun Nov 22 05:47:45 2020(r367930) @@ -75,8 +75,8 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef COMPAT_FREEBSD32 #include +#ifdef COMPAT_FREEBSD32 #include #endif @@ -232,7 +232,6 @@ struct umtx_copyops { const bool compat32; }; -#ifdef COMPAT_FREEBSD32 struct umtx_time32 { struct timespec32 _timeout; uint32_t_flags; @@ -257,7 +256,6 @@ struct umutex32 { _Static_assert(sizeof(struct umutex) == sizeof(struct umutex32), "umutex32"); _Static_assert(__offsetof(struct umutex, m_spare[0]) == __offsetof(struct umutex32, m_spare[0]), "m_spare32"); -#endif int umtx_shm_vnobj_persistent = 0; SYSCTL_INT(_kern_ipc, OID_AUTO, umtx_vnode_persistent, CTLFLAG_RWTUN, @@ -4167,6 +4165,15 @@ __umtx_op_robust_lists(struct thread *td, struct _umtx struct umtx_robust_lists_params rb; int error; + if (ops->compat32) { + if ((td->td_pflags2 & TDP2_COMPAT32RB) == 0 && + (td->td_rb_list != 0 || td->td_rbp_list != 0 || + td->td_rb_inact != 0)) + return (EBUSY); + } else if ((td->td_pflags2 & TDP2_COMPAT32RB) != 0) { + return (EBUSY); + } + bzero(&rb, sizeof(rb)); error = ops->copyin_robust_lists(uap->uaddr1, uap->val, &rb); if (error != 0) @@ -4174,8 +4181,6 @@ __umtx_op_robust_lists(struct thread *td, struct _umtx if (ops->compat32) td->td_pflags2 |= TDP2_COMPAT32RB; - else if ((td->td_pflags2 & TDP2_COMPAT32RB) != 0) - return (EINVAL); td->td_rb_list = rb.robust_list_offset; td->td_rbp_list = rb.robust_priv_list_offset; @@ -4183,11 +4188,70 @@ __umtx_op_robust_lists(struct thread *td, struct _umtx return (0); } -#ifdef COMPAT_FREEBSD32 +#if defined(__i386__) || defined(__amd64__) +/* + * Provide the standard 32-bit definitions for x86, since native/compat32 use a + * 32-bit time_t there. Other architectures just need the i386 definitions + * along with their standard compat32. + */ +struct timespecx32 { + int64_t tv_sec; + int32_t tv_nsec; +}; + +struct umtx_timex32 { + struct timespecx32 _timeout; + uint32_t_flags; + uint32_t_clockid; +}; + +#ifndef __i386__ +#definetimespeci386timespec32 +#defineumtx_timei386 umtx_time32 +#endi
svn commit: r367928 - in head/sys: compat/freebsd32 kern sys
Author: kevans Date: Sun Nov 22 05:34:51 2020 New Revision: 367928 URL: https://svnweb.freebsd.org/changeset/base/367928 Log: _umtx_op: move compat32 definitions back in These are reasonably compact, and a future commit will blur the compat32 lines by supporting 32-bit operations with the native _umtx_op. Modified: head/sys/compat/freebsd32/freebsd32.h head/sys/compat/freebsd32/freebsd32_misc.c head/sys/kern/kern_umtx.c head/sys/sys/syscallsubr.h head/sys/sys/umtx.h Modified: head/sys/compat/freebsd32/freebsd32.h == --- head/sys/compat/freebsd32/freebsd32.h Sun Nov 22 05:00:28 2020 (r367927) +++ head/sys/compat/freebsd32/freebsd32.h Sun Nov 22 05:34:51 2020 (r367928) @@ -94,27 +94,6 @@ struct itimerval32 { struct timeval32 it_value; }; -struct umtx_time32 { - struct timespec32 _timeout; - uint32_t_flags; - uint32_t_clockid; -}; - -struct umtx_robust_lists_params_compat32 { - uint32_trobust_list_offset; - uint32_trobust_priv_list_offset; - uint32_trobust_inact_offset; -}; - -struct umutex32 { - volatile __lwpid_t m_owner;/* Owner of the mutex */ - __uint32_t m_flags;/* Flags of the mutex */ - __uint32_t m_ceilings[2]; /* Priority protect ceiling */ - __uint32_t m_rb_lnk; /* Robust linkage */ - __uint32_t m_pad; - __uint32_t m_spare[2]; -}; - #define FREEBSD4_MFSNAMELEN16 #define FREEBSD4_MNAMELEN (88 - 2 * sizeof(int32_t)) Modified: head/sys/compat/freebsd32/freebsd32_misc.c == --- head/sys/compat/freebsd32/freebsd32_misc.c Sun Nov 22 05:00:28 2020 (r367927) +++ head/sys/compat/freebsd32/freebsd32_misc.c Sun Nov 22 05:34:51 2020 (r367928) @@ -3766,11 +3766,3 @@ freebsd32_sched_rr_get_interval(struct thread *td, } return (error); } - -int -freebsd32__umtx_op(struct thread *td, struct freebsd32__umtx_op_args *uap) -{ - - return (kern__umtx_op(td, uap->obj, uap->op, uap->val, uap->uaddr, - uap->uaddr2, &umtx_native_ops32)); -} Modified: head/sys/kern/kern_umtx.c == --- head/sys/kern/kern_umtx.c Sun Nov 22 05:00:28 2020(r367927) +++ head/sys/kern/kern_umtx.c Sun Nov 22 05:34:51 2020(r367928) @@ -219,7 +219,41 @@ struct abs_timeout { struct timespec end; }; +struct umtx_copyops { + int (*copyin_timeout)(const void *uaddr, struct timespec *tsp); + int (*copyin_umtx_time)(const void *uaddr, size_t size, + struct _umtx_time *tp); + int (*copyin_robust_lists)(const void *uaddr, size_t size, + struct umtx_robust_lists_params *rbp); + int (*copyout_timeout)(void *uaddr, size_t size, + struct timespec *tsp); + const size_ttimespec_sz; + const size_tumtx_time_sz; + const bool compat32; +}; + #ifdef COMPAT_FREEBSD32 +struct umtx_time32 { + struct timespec32 _timeout; + uint32_t_flags; + uint32_t_clockid; +}; + +struct umtx_robust_lists_params_compat32 { + uint32_trobust_list_offset; + uint32_trobust_priv_list_offset; + uint32_trobust_inact_offset; +}; + +struct umutex32 { + volatile __lwpid_t m_owner;/* Owner of the mutex */ + __uint32_t m_flags;/* Flags of the mutex */ + __uint32_t m_ceilings[2]; /* Priority protect ceiling */ + __uint32_t m_rb_lnk; /* Robust linkage */ + __uint32_t m_pad; + __uint32_t m_spare[2]; +}; + _Static_assert(sizeof(struct umutex) == sizeof(struct umutex32), "umutex32"); _Static_assert(__offsetof(struct umutex, m_spare[0]) == __offsetof(struct umutex32, m_spare[0]), "m_spare32"); @@ -4291,7 +4325,7 @@ const struct umtx_copyops umtx_native_ops32 = { }; #endif -int +static int kern__umtx_op(struct thread *td, void *obj, int op, unsigned long val, void *uaddr1, void *uaddr2, const struct umtx_copyops *ops) { @@ -4315,6 +4349,16 @@ sys__umtx_op(struct thread *td, struct _umtx_op_args * return (kern__umtx_op(td, uap->obj, uap->op, uap->val, uap->uaddr1, uap->uaddr2, &umtx_native_ops)); } + +#ifdef COMPAT_FREEBSD32 +int +freebsd32__umtx_op(struct thread *td, struct freebsd32__umtx_op_args *uap) +{ + + return (kern__umtx_op(td, uap->obj, uap->op, uap->val, uap->uaddr, + uap->uaddr2, &umtx_native_ops32)); +} +#endif void umtx_thread_init(struct thread *td) Modified: head/sys/sys/syscallsubr.h ===
Re: svn commit: r367744 - in head/sys: compat/freebsd32 kern sys
On Tue, Nov 17, 2020 at 1:51 PM Brooks Davis wrote: > > On Tue, Nov 17, 2020 at 11:59:50AM -0600, Kyle Evans wrote: > > On Tue, Nov 17, 2020 at 11:11 AM Brooks Davis wrote: > > > > > > On Tue, Nov 17, 2020 at 03:36:58AM +, Kyle Evans wrote: > > > > Modified: head/sys/compat/freebsd32/freebsd32.h > > > > == > > > > --- head/sys/compat/freebsd32/freebsd32.h Tue Nov 17 03:34:01 2020 > > > > (r367743) > > > > +++ head/sys/compat/freebsd32/freebsd32.h Tue Nov 17 03:36:58 2020 > > > > (r367744) > > > > @@ -94,6 +94,27 @@ struct itimerval32 { > > > > struct timeval32 it_value; > > > > }; > > > > > > > > +struct umtx_time32 { > > > > + struct timespec32 _timeout; > > > > + uint32_t_flags; > > > > + uint32_t_clockid; > > > > +}; > > > > + > > > > +struct umtx_robust_lists_params_compat32 { > > > > + uint32_trobust_list_offset; > > > > + uint32_trobust_priv_list_offset; > > > > + uint32_trobust_inact_offset; > > > > +}; > > > > + > > > > +struct umutex32 { > > > > + volatile __lwpid_t m_owner;/* Owner of the mutex */ > > > > + __uint32_t m_flags;/* Flags of the mutex */ > > > > + __uint32_t m_ceilings[2]; /* Priority protect > > > > ceiling */ > > > > + __uint32_t m_rb_lnk; /* Robust linkage */ > > > > + __uint32_t m_pad; > > > > + __uint32_t m_spare[2]; > > > > +}; > > > > + > > > > #define FREEBSD4_MFSNAMELEN 16 > > > > #define FREEBSD4_MNAMELEN(88 - 2 * sizeof(int32_t)) > > > > > > > > > > > > Modified: head/sys/compat/freebsd32/freebsd32_misc.c > > > > == > > > > --- head/sys/compat/freebsd32/freebsd32_misc.cTue Nov 17 > > > > 03:34:01 2020(r367743) > > > > +++ head/sys/compat/freebsd32/freebsd32_misc.cTue Nov 17 > > > > 03:36:58 2020(r367744) > > > > @@ -84,6 +84,7 @@ __FBSDID("$FreeBSD$"); > > > > #include > > > > #include > > > > #include > > > > +#include > > > > #include > > > > #include > > > > #include > > > > @@ -3764,4 +3765,12 @@ freebsd32_sched_rr_get_interval(struct thread > > > > *td, > > > > error = copyout(&ts32, uap->interval, sizeof(ts32)); > > > > } > > > > return (error); > > > > +} > > > > + > > > > +int > > > > +freebsd32__umtx_op(struct thread *td, struct freebsd32__umtx_op_args > > > > *uap) > > > > +{ > > > > + > > > > + return (kern__umtx_op(td, uap->obj, uap->op, uap->val, uap->uaddr, > > > > + uap->uaddr2, &umtx_native_ops32)); > > > > } > > > > > > > > > > Putting any of this under compat/freebsd32 seems like a somewhat > > > odd choice since all the work is done in kern_umtx.h. In CheriBSD, > > > everything just lives there so nothing has to be exposed in headers. > > > > > > > I have no strong opinion here -- my initial impression of the > > suggestion to move the struct definitions into freebsd32 was that: > > > > 1.) One can then quickly reference the definition of, e.g., timespec32 > > when I'm looking at a umtx_time32, and > > 2.) It'd be 'cleaner', requiring less #ifdef soup in kern_umtx.c > > > > The follow-up patch muddies the waters a lot, as we end up using the > > compat32 definitions on all 64-bit platforms anyways even without > > compat32. I don't object to moving any/all of this back, if you think > > that's better. > > (1) makes sense to me. I'm less convinced of (2) especially given the > followup. As a rule, I've been removing compat bits from headers when > they only need to be defined in a single .c file. If nothing else, I > don't like that it presents a somewhat-false implication that the > interfaces are public (and there have been quite a few cases where they > weren't correctly guarded with _KERNEL). > Sure- I've got this queued up: https://people.freebsd.org/~kevans/umtx32.diff -> the next diff in line will immediately remove that first COMPAT_FREEBSD32 block after umtx_copyops is defined. Thanks, Kyle Evans ___ 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: r367783 - head/sys/kern
Author: kevans Date: Wed Nov 18 03:30:31 2020 New Revision: 367783 URL: https://svnweb.freebsd.org/changeset/base/367783 Log: _umtx_op: fix robust lists after r367744 A copy-pasto left us copying in 24-bytes at the address of the rb pointer instead of the intended target. Reported by: sig...@gmail.com Sighing: kevans Modified: head/sys/kern/kern_umtx.c Modified: head/sys/kern/kern_umtx.c == --- head/sys/kern/kern_umtx.c Wed Nov 18 02:54:05 2020(r367782) +++ head/sys/kern/kern_umtx.c Wed Nov 18 03:30:31 2020(r367783) @@ -3431,7 +3431,7 @@ umtx_copyin_robust_lists(const void *uaddr, size_t siz if (size > sizeof(*rb)) return (EINVAL); - return (copyin(uaddr, &rb, size)); + return (copyin(uaddr, rb, size)); } static int ___ 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"
Re: svn commit: r367744 - in head/sys: compat/freebsd32 kern sys
On Tue, Nov 17, 2020 at 11:11 AM Brooks Davis wrote: > > On Tue, Nov 17, 2020 at 03:36:58AM +, Kyle Evans wrote: > > Modified: head/sys/compat/freebsd32/freebsd32.h > > == > > --- head/sys/compat/freebsd32/freebsd32.h Tue Nov 17 03:34:01 2020 > > (r367743) > > +++ head/sys/compat/freebsd32/freebsd32.h Tue Nov 17 03:36:58 2020 > > (r367744) > > @@ -94,6 +94,27 @@ struct itimerval32 { > > struct timeval32 it_value; > > }; > > > > +struct umtx_time32 { > > + struct timespec32 _timeout; > > + uint32_t_flags; > > + uint32_t_clockid; > > +}; > > + > > +struct umtx_robust_lists_params_compat32 { > > + uint32_trobust_list_offset; > > + uint32_trobust_priv_list_offset; > > + uint32_trobust_inact_offset; > > +}; > > + > > +struct umutex32 { > > + volatile __lwpid_t m_owner;/* Owner of the mutex */ > > + __uint32_t m_flags;/* Flags of the mutex */ > > + __uint32_t m_ceilings[2]; /* Priority protect ceiling */ > > + __uint32_t m_rb_lnk; /* Robust linkage */ > > + __uint32_t m_pad; > > + __uint32_t m_spare[2]; > > +}; > > + > > #define FREEBSD4_MFSNAMELEN 16 > > #define FREEBSD4_MNAMELEN(88 - 2 * sizeof(int32_t)) > > > > > > Modified: head/sys/compat/freebsd32/freebsd32_misc.c > > == > > --- head/sys/compat/freebsd32/freebsd32_misc.cTue Nov 17 03:34:01 > > 2020(r367743) > > +++ head/sys/compat/freebsd32/freebsd32_misc.cTue Nov 17 03:36:58 > > 2020(r367744) > > @@ -84,6 +84,7 @@ __FBSDID("$FreeBSD$"); > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -3764,4 +3765,12 @@ freebsd32_sched_rr_get_interval(struct thread *td, > > error = copyout(&ts32, uap->interval, sizeof(ts32)); > > } > > return (error); > > +} > > + > > +int > > +freebsd32__umtx_op(struct thread *td, struct freebsd32__umtx_op_args *uap) > > +{ > > + > > + return (kern__umtx_op(td, uap->obj, uap->op, uap->val, uap->uaddr, > > + uap->uaddr2, &umtx_native_ops32)); > > } > > > > Putting any of this under compat/freebsd32 seems like a somewhat > odd choice since all the work is done in kern_umtx.h. In CheriBSD, > everything just lives there so nothing has to be exposed in headers. > I have no strong opinion here -- my initial impression of the suggestion to move the struct definitions into freebsd32 was that: 1.) One can then quickly reference the definition of, e.g., timespec32 when I'm looking at a umtx_time32, and 2.) It'd be 'cleaner', requiring less #ifdef soup in kern_umtx.c The follow-up patch muddies the waters a lot, as we end up using the compat32 definitions on all 64-bit platforms anyways even without compat32. I don't object to moving any/all of this back, if you think that's better. Thanks, Kyle Evans ___ 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: r367746 - head/sys/kern
Author: kevans Date: Tue Nov 17 04:22:10 2020 New Revision: 367746 URL: https://svnweb.freebsd.org/changeset/base/367746 Log: Fix !COMPAT_FREEBSD32 kernel build One of the last shifts inadvertently moved these static assertions out of a COMPAT_FREEBSD32 block, which the relevant definitions are limited to. Fix it. Pointy hat: kevans Modified: head/sys/kern/kern_umtx.c Modified: head/sys/kern/kern_umtx.c == --- head/sys/kern/kern_umtx.c Tue Nov 17 04:06:35 2020(r367745) +++ head/sys/kern/kern_umtx.c Tue Nov 17 04:22:10 2020(r367746) @@ -219,9 +219,11 @@ struct abs_timeout { struct timespec end; }; +#ifdef COMPAT_FREEBSD32 _Static_assert(sizeof(struct umutex) == sizeof(struct umutex32), "umutex32"); _Static_assert(__offsetof(struct umutex, m_spare[0]) == __offsetof(struct umutex32, m_spare[0]), "m_spare32"); +#endif int umtx_shm_vnobj_persistent = 0; SYSCTL_INT(_kern_ipc, OID_AUTO, umtx_vnode_persistent, CTLFLAG_RWTUN, ___ 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: r367745 - head/sys/sys
Author: kevans Date: Tue Nov 17 04:06:35 2020 New Revision: 367745 URL: https://svnweb.freebsd.org/changeset/base/367745 Log: sys/proc.h: improve comment for new TDP2 flag This was suggested by kib and integrated locally, but somehow did not make it into the committed version. Modified: head/sys/sys/proc.h Modified: head/sys/sys/proc.h == --- head/sys/sys/proc.h Tue Nov 17 03:36:58 2020(r367744) +++ head/sys/sys/proc.h Tue Nov 17 04:06:35 2020(r367745) @@ -519,7 +519,7 @@ do { \ #defineTDP_SIGFASTPENDING 0x8000 /* Pending signal due to sigfastblock */ #defineTDP2_SBPAGES0x0001 /* Owns sbusy on some pages */ -#defineTDP2_COMPAT32RB 0x0002 /* compat32 robust lists */ +#defineTDP2_COMPAT32RB 0x0002 /* compat32 ABI for robust lists */ /* * Reasons that the current thread can not be run yet. ___ 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: r367744 - in head/sys: compat/freebsd32 kern sys
Author: kevans Date: Tue Nov 17 03:36:58 2020 New Revision: 367744 URL: https://svnweb.freebsd.org/changeset/base/367744 Log: umtx_op: reduce redundancy required for compat32 All of the compat32 variants are substantially the same, save for copyin/copyout (mostly). Apply the same kind of technique used with kevent here by having the syscall routines supply a umtx_copyops describing the operations needed. umtx_copyops carries the bare minimum needed- size of timespec and _umtx_time are used for determining if copyout is needed in the sem2_wait case. Reviewed by: kib MFC after:1 week Differential Revision:https://reviews.freebsd.org/D27222 Modified: head/sys/compat/freebsd32/freebsd32.h head/sys/compat/freebsd32/freebsd32_misc.c head/sys/kern/kern_umtx.c head/sys/sys/proc.h head/sys/sys/syscallsubr.h head/sys/sys/umtx.h Modified: head/sys/compat/freebsd32/freebsd32.h == --- head/sys/compat/freebsd32/freebsd32.h Tue Nov 17 03:34:01 2020 (r367743) +++ head/sys/compat/freebsd32/freebsd32.h Tue Nov 17 03:36:58 2020 (r367744) @@ -94,6 +94,27 @@ struct itimerval32 { struct timeval32 it_value; }; +struct umtx_time32 { + struct timespec32 _timeout; + uint32_t_flags; + uint32_t_clockid; +}; + +struct umtx_robust_lists_params_compat32 { + uint32_trobust_list_offset; + uint32_trobust_priv_list_offset; + uint32_trobust_inact_offset; +}; + +struct umutex32 { + volatile __lwpid_t m_owner;/* Owner of the mutex */ + __uint32_t m_flags;/* Flags of the mutex */ + __uint32_t m_ceilings[2]; /* Priority protect ceiling */ + __uint32_t m_rb_lnk; /* Robust linkage */ + __uint32_t m_pad; + __uint32_t m_spare[2]; +}; + #define FREEBSD4_MFSNAMELEN16 #define FREEBSD4_MNAMELEN (88 - 2 * sizeof(int32_t)) Modified: head/sys/compat/freebsd32/freebsd32_misc.c == --- head/sys/compat/freebsd32/freebsd32_misc.c Tue Nov 17 03:34:01 2020 (r367743) +++ head/sys/compat/freebsd32/freebsd32_misc.c Tue Nov 17 03:36:58 2020 (r367744) @@ -84,6 +84,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -3764,4 +3765,12 @@ freebsd32_sched_rr_get_interval(struct thread *td, error = copyout(&ts32, uap->interval, sizeof(ts32)); } return (error); +} + +int +freebsd32__umtx_op(struct thread *td, struct freebsd32__umtx_op_args *uap) +{ + + return (kern__umtx_op(td, uap->obj, uap->op, uap->val, uap->uaddr, + uap->uaddr2, &umtx_native_ops32)); } Modified: head/sys/kern/kern_umtx.c == --- head/sys/kern/kern_umtx.c Tue Nov 17 03:34:01 2020(r367743) +++ head/sys/kern/kern_umtx.c Tue Nov 17 03:36:58 2020(r367744) @@ -219,20 +219,9 @@ struct abs_timeout { struct timespec end; }; -#ifdef COMPAT_FREEBSD32 -struct umutex32 { - volatile __lwpid_t m_owner;/* Owner of the mutex */ - __uint32_t m_flags;/* Flags of the mutex */ - __uint32_t m_ceilings[2]; /* Priority protect ceiling */ - __uint32_t m_rb_lnk; /* Robust linkage */ - __uint32_t m_pad; - __uint32_t m_spare[2]; -}; - _Static_assert(sizeof(struct umutex) == sizeof(struct umutex32), "umutex32"); _Static_assert(__offsetof(struct umutex, m_spare[0]) == __offsetof(struct umutex32, m_spare[0]), "m_spare32"); -#endif int umtx_shm_vnobj_persistent = 0; SYSCTL_INT(_kern_ipc, OID_AUTO, umtx_vnode_persistent, CTLFLAG_RWTUN, @@ -3400,11 +3389,11 @@ do_sem2_wake(struct thread *td, struct _usem2 *sem) } inline int -umtx_copyin_timeout(const void *addr, struct timespec *tsp) +umtx_copyin_timeout(const void *uaddr, struct timespec *tsp) { int error; - error = copyin(addr, tsp, sizeof(struct timespec)); + error = copyin(uaddr, tsp, sizeof(*tsp)); if (error == 0) { if (tsp->tv_sec < 0 || tsp->tv_nsec >= 10 || @@ -3415,16 +3404,16 @@ umtx_copyin_timeout(const void *addr, struct timespec } static inline int -umtx_copyin_umtx_time(const void *addr, size_t size, struct _umtx_time *tp) +umtx_copyin_umtx_time(const void *uaddr, size_t size, struct _umtx_time *tp) { int error; - if (size <= sizeof(struct timespec)) { + if (size <= sizeof(tp->_timeout)) { tp->_clockid = CLOCK_REALTIME; tp->_flags = 0; - error = copyin(addr, &tp->_timeout, sizeof
svn commit: r367743 - in head: lib/libthr/tests sys/kern
Author: kevans Date: Tue Nov 17 03:34:01 2020 New Revision: 367743 URL: https://svnweb.freebsd.org/changeset/base/367743 Log: _umtx_op: fix a compat32 bug in UMTX_OP_NWAKE_PRIVATE Specifically, if we're waking up some value n > BATCH_SIZE, then the copyin(9) is wrong on the second iteration due to upp being the wrong type. upp is currently a uint32_t**, so upp + pos advances it by twice as many elements as it should (host pointer size vs. compat32 pointer size). Fix it by just making upp a uint32_t*; it's still technically a double pointer, but the distinction doesn't matter all that much here since we're just doing arithmetic on it. Add a test case that demonstrates the problem, placed with the libthr tests since one messing with _umtx_op should be running these tests. Running under compat32, the new test case will hang as threads after the first 128 get missed in the wake. it's not immediately clear how to hit it in practice, since pthread_cond_broadcast() uses a smaller (sleepq batch?) size observed to be around ~50 -- I did not spend much time digging into it. The uintptr_t change makes no functional difference, but i've tossed it in since it's more accurate (semantically). Reported by: Andrew Gierth (andrew_tao173.riddles.org.uk, inspection) Reviewed by: kib MFC after:1 week Differential Revision:https://reviews.freebsd.org/D27231 Added: head/lib/libthr/tests/umtx_op_test.c (contents, props changed) Modified: head/lib/libthr/tests/Makefile head/sys/kern/kern_umtx.c Modified: head/lib/libthr/tests/Makefile == --- head/lib/libthr/tests/Makefile Tue Nov 17 03:26:56 2020 (r367742) +++ head/lib/libthr/tests/Makefile Tue Nov 17 03:34:01 2020 (r367743) @@ -35,6 +35,8 @@ NETBSD_ATF_TESTS_SH+= cancel_test NETBSD_ATF_TESTS_SH+= exit_test NETBSD_ATF_TESTS_SH+= resolv_test +ATF_TESTS_C+= umtx_op_test + LIBADD+= pthread LIBADD.fpu_test+= m LIBADD.sem_test+= rt Added: head/lib/libthr/tests/umtx_op_test.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libthr/tests/umtx_op_test.cTue Nov 17 03:34:01 2020 (r367743) @@ -0,0 +1,108 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020 Kyle Evans + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include + +#include + +/* + * This is an implementation detail of _umtx_op(2), pulled from + * sys/kern/kern_umtx.c. The relevant bug observed that requests above the + * batch side would not function as intended, so it's important that this + * reflects the BATCH_SIZE configured there. + */ +#defineUMTX_OP_BATCH_SIZE 128 +#define THREAD_COUNT ((UMTX_OP_BATCH_SIZE * 3) / 2) + +static pthread_mutex_t static_mutex = PTHREAD_MUTEX_INITIALIZER; + +static int batched_waiting; + +static void * +batching_threadfunc(void *arg) +{ + + pthread_mutex_lock(&static_mutex); + ++batched_waiting; + pthread_mutex_unlock(&static_mutex); + _umtx_op(arg, UMTX_OP_WAIT_UINT_PRIVATE, 0, NULL, NULL); + + return (NULL); +} + +ATF_TC(batching); +ATF_TC_HEAD(batching, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Checks batching of UMTX_OP_NWAKE_PRIVATE"); +} +ATF_TC_BODY(batching, tc) +{ + uintptr_t addrs[THREAD_COUNT]; + uint32_t vals[THREAD_COU
svn commit: r367742 - head/lib/libc/sys
Author: kevans Date: Tue Nov 17 03:26:56 2020 New Revision: 367742 URL: https://svnweb.freebsd.org/changeset/base/367742 Log: _umtx_op: document UMTX_OP_SEM2_WAIT copyout behavior This clever technique to get a time remaining back was added to support sem_clockwait_np. Reviewed by: kib, vangyzen MFC after:1 week Differential Revision:https://reviews.freebsd.org/D27160 Modified: head/lib/libc/sys/_umtx_op.2 Modified: head/lib/libc/sys/_umtx_op.2 == --- head/lib/libc/sys/_umtx_op.2Tue Nov 17 02:18:34 2020 (r367741) +++ head/lib/libc/sys/_umtx_op.2Tue Nov 17 03:26:56 2020 (r367742) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 13, 2017 +.Dd November 16, 2020 .Dt _UMTX_OP 2 .Os .Sh NAME @@ -1101,6 +1101,15 @@ The arguments to the request are: .It Fa obj Pointer to the semaphore (of type .Vt struct _usem2 ) . +.It Fa uaddr +Size of the memory passed in via the +.Fa uaddr2 +argument. +.It Fa uaddr2 +Optional pointer to a structure of type +.Vt struct _umtx_time , +which may be followed by a structure of type +.Vt struct timespec . .El .Pp Put the requesting thread onto a sleep queue if the semaphore counter @@ -1124,6 +1133,18 @@ An unblocked signal delivered during such wait results interruption and .Er EINTR error. +.Pp +If +.Dv UMTX_ABSTIME +was not set, and the operation was interrupted and the caller passed in a +.Fa uaddr2 +large enough to hold a +.Vt struct timespec +following the initial +.Vt struct _umtx_time , +then the +.Vt struct timespec +is updated to contain the unslept amount. .It Dv UMTX_OP_SEM2_WAKE Wake up waiters on semaphore lock. The arguments to the request are: ___ 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: r367699 - stable/12/sys/kern
Author: kevans Date: Sat Nov 14 20:45:12 2020 New Revision: 367699 URL: https://svnweb.freebsd.org/changeset/base/367699 Log: MFC r366231: Address whitespace nits in subr_rtc.c These were separated out from a nearby patch from Andrew Gierth. Modified: stable/12/sys/kern/subr_rtc.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/subr_rtc.c == --- stable/12/sys/kern/subr_rtc.c Sat Nov 14 20:44:34 2020 (r367698) +++ stable/12/sys/kern/subr_rtc.c Sat Nov 14 20:45:12 2020 (r367699) @@ -164,7 +164,7 @@ clock_dbgprint_hdr(device_t dev, int rw) getnanotime(&now); device_printf(dev, "%s at ", (rw & CLOCK_DBG_READ) ? "read " : "write"); clock_print_ts(&now, 9); - printf(": "); + printf(": "); } void @@ -241,7 +241,7 @@ clock_register_flags(device_t clockdev, long resolutio } sx_xunlock(&rtc_list_lock); - device_printf(clockdev, + device_printf(clockdev, "registered as a time-of-day clock, resolution %d.%6.6ds\n", newrtc->resolution / 100, newrtc->resolution % 100); } ___ 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: r367698 - stable/12/release/packages
Author: kevans Date: Sat Nov 14 20:44:34 2020 New Revision: 367698 URL: https://svnweb.freebsd.org/changeset/base/367698 Log: MFC r365883: pkgbase: use consistent annotation for object keys Everywhere else we use objects ("scripts", generally) we do specify the optional colon. Be consistent and do the same for directories. PR: 249273 Modified: stable/12/release/packages/runtime.ucl Directory Properties: stable/12/ (props changed) Modified: stable/12/release/packages/runtime.ucl == --- stable/12/release/packages/runtime.ucl Sat Nov 14 19:56:11 2020 (r367697) +++ stable/12/release/packages/runtime.ucl Sat Nov 14 20:44:34 2020 (r367698) @@ -30,7 +30,7 @@ deps: { version: "%VERSION%" } } -directories { +directories: { /dev = "y"; /tmp = "y"; } ___ 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: r367688 - head
Author: kevans Date: Sat Nov 14 18:06:35 2020 New Revision: 367688 URL: https://svnweb.freebsd.org/changeset/base/367688 Log: Makefile: re-wordsmith the blurb about xtoolchain ports The new version only includes a specific version once, and uses the one that's currently advised by tinderbox: -gcc6. It also advises just installing the pkg, but mentions in a side-note at the end where to find the source in the ports tree. Reviewed by: jrtc27 Suggested by: jhb (use default from tinderbox) Differential Revision:https://reviews.freebsd.org/D26820 Modified: head/Makefile Modified: head/Makefile == --- head/Makefile Sat Nov 14 18:01:14 2020(r367687) +++ head/Makefile Sat Nov 14 18:06:35 2020(r367688) @@ -89,14 +89,16 @@ # 10. `reboot' # 11. `make delete-old-libs' (in case no 3rd party program uses them anymore) # -# For individuals wanting to build from source with GCC from ports, first build -# or install an appropriate flavor of devel/freebsd-gcc9. The packages produced -# by this port are named "${TARGET_ARCH}-gcc9" -- note that not all -# architectures supported by FreeBSD have an external gcc toolchain available. +# For individuals wanting to build from source with GCC from ports, first +# install the appropriate GCC cross toolchain package: +# `pkg install ${TARGET_ARCH}-gccN` # -# Once the appropriate freebsd-gcc package is installed, simply pass -# CROSS_TOOLCHAIN=${TARGET_ARCH}-gcc9 while building with the above steps, -# e.g., `make buildworld CROSS_TOOLCHAIN=amd64-gcc9`. +# Once you have installed the necessary cross toolchain, simply pass +# CROSS_TOOLCHAIN=${TARGET_ARCH}-gccN while building with the above steps, +# e.g., `make buildworld CROSS_TOOLCHAIN=amd64-gcc6`. +# +# The ${TARGET_ARCH}-gccN packages are provided as flavors of the +# devel/freebsd-gccN ports. # # See src/UPDATING `COMMON ITEMS' for more complete information. # ___ 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"
Re: svn commit: r367678 - head/usr.sbin/freebsd-update
On Sat, Nov 14, 2020 at 11:20 AM Mateusz Piotrowski <0...@freebsd.org> wrote: > > Hello Rodney, > > On 11/14/20 4:59 PM, Rodney W. Grimes wrote: > >> Author: 0mp (doc,ports committer) > >> Date: Sat Nov 14 13:07:41 2020 > >> New Revision: 367678 > >> URL: https://svnweb.freebsd.org/changeset/base/367678 > >> > >> Log: > >>Document the PAGER environment variable > >> > >>Sometimes users want to use freebsd-update(8) in a non-interactive way > >> and > >>what they often miss is that they have to set PAGER to cat(1) in order > >> to > >>avoid interactive prompts from less(1). > > Which was caused by the change of invoking more(1) as less(1) causing > > this regression, as when invoked as more(1) it falls off the end of > > empty input and causes no such interactive prompt. > > > > Setting PAGER to more(1) also fixes this. > > Mmm, I'm not sure if that would work. If I run "jot 1000 | more" in my > terminal I still get an > interactive prompt. Could it be that you are referring to a different more(1) > implementation? I'm > clearly missing something. > more(1) is more or less like `less -E`, which is a default PAGER I had advocated for back when it changed. It can be mostly non-interactive as long as your diffs are small, but it's definitely much less painful. ___ 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: r367684 - stable/12/sys/kern
Author: kevans Date: Sat Nov 14 15:33:39 2020 New Revision: 367684 URL: https://svnweb.freebsd.org/changeset/base/367684 Log: MFC r367604: umtx: drop incorrect timespec32 definition This works for amd64, but none others -- drop it, because we already have a proper definition in sys/compat/freebsd32/freebsd32.h that correctly uses time32_t. Modified: stable/12/sys/kern/kern_umtx.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_umtx.c == --- stable/12/sys/kern/kern_umtx.c Sat Nov 14 15:26:18 2020 (r367683) +++ stable/12/sys/kern/kern_umtx.c Sat Nov 14 15:33:39 2020 (r367684) @@ -76,6 +76,7 @@ __FBSDID("$FreeBSD$"); #include #ifdef COMPAT_FREEBSD32 +#include #include #endif @@ -4121,11 +4122,6 @@ sys__umtx_op(struct thread *td, struct _umtx_op_args * } #ifdef COMPAT_FREEBSD32 - -struct timespec32 { - int32_t tv_sec; - int32_t tv_nsec; -}; struct umtx_time32 { struct timespec32 timeout; ___ 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: r367683 - stable/12/lib/libbe
Author: kevans Date: Sat Nov 14 15:26:18 2020 New Revision: 367683 URL: https://svnweb.freebsd.org/changeset/base/367683 Log: MFC r366819: libbe(3): const'ify a couple arguments libbe will never need to mutate these as we either process them into a local buffer or we just don't touch them and write to a separate out argument. Modified: stable/12/lib/libbe/be.h stable/12/lib/libbe/be_access.c stable/12/lib/libbe/be_info.c stable/12/lib/libbe/libbe.3 Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libbe/be.h == --- stable/12/lib/libbe/be.hSat Nov 14 15:21:20 2020(r367682) +++ stable/12/lib/libbe/be.hSat Nov 14 15:26:18 2020(r367683) @@ -111,8 +111,8 @@ typedef enum { BE_MNT_DEEP = 1 << 1, } be_mount_opt_t; -int be_mount(libbe_handle_t *, char *, char *, int, char *); -int be_unmount(libbe_handle_t *, char *, int); +int be_mount(libbe_handle_t *, const char *, const char *, int, char *); +int be_unmount(libbe_handle_t *, const char *, int); int be_mounted_at(libbe_handle_t *, const char *path, nvlist_t *); /* Error related functions: be_error.c */ @@ -124,7 +124,7 @@ void libbe_print_on_error(libbe_handle_t *, bool); int be_root_concat(libbe_handle_t *, const char *, char *); int be_validate_name(libbe_handle_t * __unused, const char *); int be_validate_snap(libbe_handle_t *, const char *); -int be_exists(libbe_handle_t *, char *); +int be_exists(libbe_handle_t *, const char *); int be_export(libbe_handle_t *, const char *, int fd); int be_import(libbe_handle_t *, const char *, int fd); Modified: stable/12/lib/libbe/be_access.c == --- stable/12/lib/libbe/be_access.c Sat Nov 14 15:21:20 2020 (r367682) +++ stable/12/lib/libbe/be_access.c Sat Nov 14 15:26:18 2020 (r367683) @@ -232,8 +232,8 @@ be_mounted_at(libbe_handle_t *lbh, const char *path, n * usage */ int -be_mount(libbe_handle_t *lbh, char *bootenv, char *mountpoint, int flags, -char *result_loc) +be_mount(libbe_handle_t *lbh, const char *bootenv, const char *mountpoint, +int flags, char *result_loc) { char be[BE_MAXPATHLEN]; char mnt_temp[BE_MAXPATHLEN]; @@ -288,7 +288,7 @@ be_mount(libbe_handle_t *lbh, char *bootenv, char *mou * usage */ int -be_unmount(libbe_handle_t *lbh, char *bootenv, int flags) +be_unmount(libbe_handle_t *lbh, const char *bootenv, int flags) { int err; char be[BE_MAXPATHLEN]; Modified: stable/12/lib/libbe/be_info.c == --- stable/12/lib/libbe/be_info.c Sat Nov 14 15:21:20 2020 (r367682) +++ stable/12/lib/libbe/be_info.c Sat Nov 14 15:26:18 2020 (r367683) @@ -294,7 +294,7 @@ be_prop_list_free(nvlist_t *be_list) * Usage */ int -be_exists(libbe_handle_t *lbh, char *be) +be_exists(libbe_handle_t *lbh, const char *be) { char buf[BE_MAXPATHLEN]; Modified: stable/12/lib/libbe/libbe.3 == --- stable/12/lib/libbe/libbe.3 Sat Nov 14 15:21:20 2020(r367682) +++ stable/12/lib/libbe/libbe.3 Sat Nov 14 15:26:18 2020(r367683) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 16, 2019 +.Dd November 14, 2020 .Dt LIBBE 3 .Os .Sh NAME @@ -93,13 +93,13 @@ .\"BE_MNT_DEEP = 1 << 1, .\" } be_mount_opt_t .Ft int -.Fn be_mount "libbe_handle_t *hdl" "char *be_name" "char *mntpoint" "int flags" "char *result" +.Fn be_mount "libbe_handle_t *hdl" "const char *be_name" "const char *mntpoint" "int flags" "char *result" .Pp .Ft int .Fn be_mounted_at "libbe_handle_t *hdl" "const char *path" "nvlist_t *details" .Pp .Ft int -.Fn be_unmount "libbe_handle_t *hdl" "char *be_name" "int flags" +.Fn be_unmount "libbe_handle_t *hdl" "const char *be_name" "int flags" .Pp .Ft int .Fn libbe_errno "libbe_handle_t *hdl" @@ -120,7 +120,7 @@ .Fn be_validate_snap "libbe_handle_t *hdl" "const char *snap" .Pp .Ft int -.Fn be_exists "libbe_handle_t *hdl" "char *be_name" +.Fn be_exists "libbe_handle_t *hdl" "const char *be_name" .Pp .Ft int .Fn be_export "libbe_handle_t *hdl" "const char *be_name" "int fd" ___ 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: r367682 - in stable/12: lib/libbe tools/build/mk
Author: kevans Date: Sat Nov 14 15:21:20 2020 New Revision: 367682 URL: https://svnweb.freebsd.org/changeset/base/367682 Log: MFC r366820-r366821: libbe(3) documentation improvements r366820: libbe(3): document be_snapshot() While toying around with lua bindings for libbe(3), I discovered that I apparently never documented this, despite having documented be_is_auto_snapshot_name that references it. r366821: libbe(3): install MLINKS for all of the functions provided Modified: stable/12/lib/libbe/Makefile stable/12/lib/libbe/libbe.3 stable/12/tools/build/mk/OptionalObsoleteFiles.inc Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libbe/Makefile == --- stable/12/lib/libbe/MakefileSat Nov 14 15:19:36 2020 (r367681) +++ stable/12/lib/libbe/MakefileSat Nov 14 15:21:20 2020 (r367682) @@ -12,6 +12,41 @@ SHLIB_MINOR= 0 SRCS= be.c be_access.c be_error.c be_info.c INCS= be.h MAN= libbe.3 +MLINKS+= libbe.3 be_activate.3 +MLINKS+= libbe.3 be_active_name.3 +MLINKS+= libbe.3 be_active_path.3 +MLINKS+= libbe.3 be_create_depth.3 +MLINKS+= libbe.3 be_create_from_existing_snap.3 +MLINKS+= libbe.3 be_create_from_existing.3 +MLINKS+= libbe.3 be_create.3 +MLINKS+= libbe.3 be_deactivate.3 +MLINKS+= libbe.3 be_destroy.3 +MLINKS+= libbe.3 be_exists.3 +MLINKS+= libbe.3 be_export.3 +MLINKS+= libbe.3 be_get_bootenv_props.3 +MLINKS+= libbe.3 be_get_dataset_props.3 +MLINKS+= libbe.3 be_get_dataset_snapshots.3 +MLINKS+= libbe.3 be_import.3 +MLINKS+= libbe.3 be_is_auto_snapshot_name.3 +MLINKS+= libbe.3 be_mount.3 +MLINKS+= libbe.3 be_mounted_at.3 +MLINKS+= libbe.3 be_nextboot_name.3 +MLINKS+= libbe.3 be_nextboot_path.3 +MLINKS+= libbe.3 be_nicenum.3 +MLINKS+= libbe.3 be_prop_list_alloc.3 +MLINKS+= libbe.3 be_prop_list_free.3 +MLINKS+= libbe.3 be_rename.3 +MLINKS+= libbe.3 be_root_concat.3 +MLINKS+= libbe.3 be_root_path.3 +MLINKS+= libbe.3 be_snapshot.3 +MLINKS+= libbe.3 be_unmount.3 +MLINKS+= libbe.3 be_validate_name.3 +MLINKS+= libbe.3 be_validate_snap.3 +MLINKS+= libbe.3 libbe_close.3 +MLINKS+= libbe.3 libbe_errno.3 +MLINKS+= libbe.3 libbe_error_description.3 +MLINKS+= libbe.3 libbe_init.3 +MLINKS+= libbe.3 libbe_print_on_error.3 WARNS?=2 IGNORE_PRAGMA= yes Modified: stable/12/lib/libbe/libbe.3 == --- stable/12/lib/libbe/libbe.3 Sat Nov 14 15:19:36 2020(r367681) +++ stable/12/lib/libbe/libbe.3 Sat Nov 14 15:21:20 2020(r367682) @@ -58,6 +58,9 @@ .Ft const char * Ns .Fn be_root_path "libbe_handle_t *hdl" .Pp +.Ft int Ns +.Fn be_snapshot "libbe_handle_t *hdl" "const char *be_name" "const char *snap_name" "bool recursive" "char *result" +.Pp .Ft bool Ns .Fn be_is_auto_snapshot_name "libbe_handle_t *hdl" "const char *snap" .Pp @@ -214,6 +217,30 @@ active on reboot. The .Fn be_root_path function returns the boot environment root path. +.Pp +The +.Fn be_snapshot +function creates a snapshot of +.Fa be_name +named +.Fa snap_name . +A +.Dv NULL +.Fa snap_name +may be used, indicating that +.Fn be_snaphot +should derive the snapshot name from the current date and time. +If +.Fa recursive +is set, then +.Fn be_snapshot +will recursively snapshot the dataset. +If +.Fa result +is not +.Dv NULL , +then it will be populated with the final +.Dq Fa be_name Ns @ Ns Fa snap_name . .Pp The .Fn be_is_auto_snapshot_name Modified: stable/12/tools/build/mk/OptionalObsoleteFiles.inc == --- stable/12/tools/build/mk/OptionalObsoleteFiles.inc Sat Nov 14 15:19:36 2020(r367681) +++ stable/12/tools/build/mk/OptionalObsoleteFiles.inc Sat Nov 14 15:21:20 2020(r367682) @@ -1394,6 +1394,41 @@ OLD_LIBS+=usr/lib32/libzpool.so.2 OLD_FILES+=usr/sbin/zfsd OLD_FILES+=usr/sbin/zhack OLD_FILES+=usr/sbin/zdb +OLD_FILES+=usr/share/man/man3/be_activate.3.gz +OLD_FILES+=usr/share/man/man3/be_active_name.3.gz +OLD_FILES+=usr/share/man/man3/be_active_path.3.gz +OLD_FILES+=usr/share/man/man3/be_create_depth.3.gz +OLD_FILES+=usr/share/man/man3/be_create_from_existing_snap.3.gz +OLD_FILES+=usr/share/man/man3/be_create_from_existing.3.gz +OLD_FILES+=usr/share/man/man3/be_create.3.gz +OLD_FILES+=usr/share/man/man3/be_deactivate.3.gz +OLD_FILES+=usr/share/man/man3/be_destroy.3.gz +OLD_FILES+=usr/share/man/man3/be_exists.3.gz +OLD_FILES+=usr/share/man/man3/be_export.3.gz +OLD_FILES+=usr/share/man/man3/be_get_bootenv_props.3.gz +OLD_FILES+=usr/share/man/man3/be_get_dataset_props.3.gz +OLD_FILES+=usr/share/man/man3/be_get_dataset_snapshots.3.gz +OLD_FILES+=usr/share/man/man3
svn commit: r367681 - in stable/12/contrib/lua: . doc src
Author: kevans Date: Sat Nov 14 15:19:36 2020 New Revision: 367681 URL: https://svnweb.freebsd.org/changeset/base/367681 Log: MFC r366769: MFC r366760: lua: update to 5.3.6 This release contains some minor bugfixes; notably: - 2x minor Makefile fixes (not used in base) - Long brackets with a huge number of '=' overflow some internal buffer arithmetic. - Joining an upvalue with itself can cause a use-after-free crash. See here for examples: http://www.lua.org/bugs.html#5.3.5 Modified: stable/12/contrib/lua/Makefile stable/12/contrib/lua/README stable/12/contrib/lua/doc/contents.html stable/12/contrib/lua/doc/manual.html stable/12/contrib/lua/doc/readme.html stable/12/contrib/lua/src/Makefile stable/12/contrib/lua/src/lapi.c stable/12/contrib/lua/src/lauxlib.c stable/12/contrib/lua/src/lcode.c stable/12/contrib/lua/src/ldebug.c stable/12/contrib/lua/src/liolib.c stable/12/contrib/lua/src/llex.c stable/12/contrib/lua/src/lobject.c stable/12/contrib/lua/src/lparser.c stable/12/contrib/lua/src/lua.h stable/12/contrib/lua/src/lundump.c Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/lua/Makefile == --- stable/12/contrib/lua/Makefile Sat Nov 14 14:50:34 2020 (r367680) +++ stable/12/contrib/lua/Makefile Sat Nov 14 15:19:36 2020 (r367681) @@ -46,7 +46,7 @@ TO_MAN= lua.1 luac.1 # Lua version and release. V= 5.3 -R= $V.4 +R= $V.6 # Targets start here. all: $(PLAT) Modified: stable/12/contrib/lua/README == --- stable/12/contrib/lua/READMESat Nov 14 14:50:34 2020 (r367680) +++ stable/12/contrib/lua/READMESat Nov 14 15:19:36 2020 (r367681) @@ -1,5 +1,5 @@ -This is Lua 5.3.5, released on 26 Jun 2018. +This is Lua 5.3.6, released on 14 Sep 2020. For installation instructions, license details, and further information about Lua, see doc/readme.html. Modified: stable/12/contrib/lua/doc/contents.html == --- stable/12/contrib/lua/doc/contents.html Sat Nov 14 14:50:34 2020 (r367680) +++ stable/12/contrib/lua/doc/contents.html Sat Nov 14 15:19:36 2020 (r367681) @@ -32,7 +32,7 @@ For a complete introduction to Lua programming, see th -Copyright © 2015–2018 Lua.org, PUC-Rio. +Copyright © 2015–2020 Lua.org, PUC-Rio. Freely available under the terms of the http://www.lua.org/license.html";>Lua license. @@ -318,6 +318,37 @@ Freely available under the terms of the utf8.len utf8.offset +metamethods + +__add +__band +__bnot +__bor +__bxor +__call +__concat +__div +__eq +__gc +__idiv +__index +__le +__len +__lt +__metatable +__mod +__mode +__mul +__name +__newindex +__pairs +__pow +__shl +__shr +__sub +__tostring +__unm + environmentvariables LUA_CPATH @@ -609,10 +640,10 @@ Freely available under the terms of the Last update: -Mon Jun 18 22:56:06 -03 2018 +Tue Aug 25 13:45:14 UTC 2020 Modified: stable/12/contrib/lua/doc/manual.html == --- stable/12/contrib/lua/doc/manual.html Sat Nov 14 14:50:34 2020 (r367680) +++ stable/12/contrib/lua/doc/manual.html Sat Nov 14 15:19:36 2020 (r367681) @@ -19,7 +19,7 @@ by Roberto Ierusalimschy, Luiz Henrique de Figueiredo, -Copyright © 2015–2018 Lua.org, PUC-Rio. +Copyright © 2015–2020 Lua.org, PUC-Rio. Freely available under the terms of the http://www.lua.org/license.html";>Lua license. @@ -10972,10 +10972,10 @@ and LiteralString, see §3.1.) Last update: -Tue Jun 26 13:16:37 -03 2018 +Tue Jul 14 10:32:39 UTC 2020 Modified: stable/12/contrib/lua/doc/readme.html == --- stable/12/contrib/lua/doc/readme.html Sat Nov 14 14:50:34 2020 (r367680) +++ stable/12/contrib/lua/doc/readme.html Sat Nov 14 15:19:36 2020 (r367681) @@ -107,7 +107,7 @@ Here are the details. Open a terminal window and move to -the top-level directory, which is named lua-5.3.5. +the top-level directory, which is named lua-5.3.6. The Makefile there controls both the build process and the installation process. @@ -328,7 +328,7 @@ For details, see http://www.lua.org/license.html";>this. -Copyright © 1994–2017 Lua.org, PUC-Rio. +Copyright © 1994–2020 Lua.org, PUC-Rio. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -355,10 +355,10 @@ THE SOFTWARE. Last update: -Mon Jun 18 22:57:33 -03 2018 +Tue Jul 14 10:33:01 UTC 2020 Modified: stable/12/contrib/lua/src/Makefile == --- stable/12/contrib/lua/src/Makefile Sat Nov 14 14:50:34 2020
svn commit: r367667 - stable/12/lib/libc/stdlib
Author: kevans Date: Sat Nov 14 02:11:56 2020 New Revision: 367667 URL: https://svnweb.freebsd.org/changeset/base/367667 Log: MFC r366770: libc: typo fix (s/involes/involves) Modified: stable/12/lib/libc/stdlib/bsearch.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/stdlib/bsearch.c == --- stable/12/lib/libc/stdlib/bsearch.c Sat Nov 14 02:11:04 2020 (r367666) +++ stable/12/lib/libc/stdlib/bsearch.c Sat Nov 14 02:11:56 2020 (r367667) @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); * is odd, moving left simply involves halving lim: e.g., when lim * is 5 we look at item 2, so we change lim to 2 so that we will * look at items 0 & 1. If lim is even, the same applies. If lim - * is odd, moving right again involes halving lim, this time moving + * is odd, moving right again involves halving lim, this time moving * the base up one item past p: e.g., when lim is 5 we change base * to item 3 and make lim 2 so that we will look at items 3 and 4. * If lim is even, however, we have to shrink it by one before ___ 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: r367666 - in stable/12: . stand/lua
, err = processFile(brand) + if not res then + -- This fallback should go away after FreeBSD 13. + try_include('brand-' .. brand) + -- If the fallback also failed, print whatever error + -- we encountered in the original processing. + if branddefs[brand] == nil then + print(err) + return nil + end + end + branddef = branddefs[brand] end @@ -86,7 +126,18 @@ local function getLogodef(logo) -- Try to pull it in if logodef == nil then - try_include('logo-' .. logo) + local res, err = processFile(logo) + if not res then + -- This fallback should go away after FreeBSD 13. + try_include('logo-' .. logo) + -- If the fallback also failed, print whatever error + -- we encountered in the original processing. + if logodefs[logo] == nil then + print(err) + return nil + end + end + logodef = logodefs[logo] end @@ -364,6 +415,8 @@ drawer.default_bw_logodef = 'orbbw' -- drawer module in case it's a filesystem issue. drawer.default_fallback_logodef = 'none' +-- These should go away after FreeBSD 13; only available for backwards +-- compatibility with old logo- files. function drawer.addBrand(name, def) branddefs[name] = def end Copied: stable/12/stand/lua/gfx-beastie.lua (from r366435, head/stand/lua/gfx-beastie.lua) == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/stand/lua/gfx-beastie.lua Sat Nov 14 02:11:04 2020 (r367666, copy of r366435, head/stand/lua/gfx-beastie.lua) @@ -0,0 +1,55 @@ +-- +-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD +-- +-- Copyright (c) 2018 Kyle Evans +-- +-- Redistribution and use in source and binary forms, with or without +-- modification, are permitted provided that the following conditions +-- are met: +-- 1. Redistributions of source code must retain the above copyright +--notice, this list of conditions and the following disclaimer. +-- 2. Redistributions in binary form must reproduce the above copyright +--notice, this list of conditions and the following disclaimer in the +--documentation and/or other materials provided with the distribution. +-- +-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +-- SUCH DAMAGE. +-- +-- $FreeBSD$ +-- + +return { + logo = { + graphic = { + " \027[31m,,", + " /()`", + " \\ \\___ / |", + " /- \027[37m_\027[31m `-/ '", + " (\027[37m/\\/ \\\027[31m \\ /\\", + " \027[37m/ / |\027[31m `\\", + " \027[34mO O \027[37m) \027[31m/|", + " \027[37m`-^--'\027[31m`< '", + "(_.) _ ) /", + " `.___/`/", + " `-' /", + " \027[33m<.\027[31m __ / __ \\", + " \027[33m<|\027[31mO)))\027[33m==\027[31m) \\) /\027[33m|", + " \027[33m<'\027[31m`--' `.__,' \\", + " ||", + "\\ / /\\", + " \027[36m__\027[31m( (_ / \\__/", + " \027[36m,' ,-' |", +
svn commit: r367665 - stable/12
Author: kevans Date: Sat Nov 14 02:03:34 2020 New Revision: 367665 URL: https://svnweb.freebsd.org/changeset/base/367665 Log: MFC r366275: Makefile.inc1: sysent: parallel subordinate sysent targets makesyscalls.lua (and indeed makesyscalls.sh) are both safe to be run in parallel, so let's do it. This is a trivial difference because runtime per-target is pretty small, but I like seeing it run in parallel when my muscle memory types `make -sj4`. Modified: stable/12/Makefile.inc1 Directory Properties: stable/12/ (props changed) Modified: stable/12/Makefile.inc1 == --- stable/12/Makefile.inc1 Sat Nov 14 02:00:50 2020(r367664) +++ stable/12/Makefile.inc1 Sat Nov 14 02:03:34 2020(r367665) @@ -1475,9 +1475,13 @@ _sysent_dirs+= sys/amd64/linux \ sys/amd64/linux32 \ sys/arm64/linux \ sys/i386/linux + sysent: .PHONY .for _dir in ${_sysent_dirs} +sysent-${_dir}: .PHONY ${_+_}${MAKE} -C ${.CURDIR}/${_dir} sysent + +sysent: sysent-${_dir} .endfor # ___ 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: r367664 - stable/12/usr.sbin/ngctl
Author: kevans Date: Sat Nov 14 02:00:50 2020 New Revision: 367664 URL: https://svnweb.freebsd.org/changeset/base/367664 Log: MFC r366430: ngctl: add -c (compact output) for the dot command The output of "ngctl dot" is suitable for small netgraph networks. Even moderate complex netgraph setups (about a dozen nodes) are hard to understand from the .dot output, because each node and each hook are shown as a full blown structure. This patch allows to generate much more compact output and graphs by omitting the extra structures for the individual hooks. Instead the names of the hooks are labels to the edges. Modified: stable/12/usr.sbin/ngctl/dot.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/ngctl/dot.c == --- stable/12/usr.sbin/ngctl/dot.c Sat Nov 14 01:58:33 2020 (r367663) +++ stable/12/usr.sbin/ngctl/dot.c Sat Nov 14 02:00:50 2020 (r367664) @@ -2,6 +2,7 @@ /* * dot.c * + * Copyright (c) 2019 Lutz Donnerhacke * Copyright (c) 2004 Brian Fundakowski Feldman * Copyright (c) 1996-1999 Whistle Communications, Inc. * All rights reserved. @@ -53,9 +54,11 @@ static int DotCmd(int ac, char **av); const struct ngcmd dot_cmd = { DotCmd, - "dot [outputfile]", + "dot [-c] [outputfile]", "Produce a GraphViz (.dot) of the entire netgraph.", - "If no outputfile is specified, stdout will be assumed.", + "If no outputfile is specified, stdout will be assumed." + " The optional -c argument generates a graph without separate" + " structures for edge names. Such a graph is more compact.", { "graphviz", "confdot" } }; @@ -66,12 +69,16 @@ DotCmd(int ac, char **av) struct namelist *nlist; FILE *f = stdout; int ch; + int compact = 0; u_int i; /* Get options */ optind = 1; - while ((ch = getopt(ac, av, "")) != -1) { + while ((ch = getopt(ac, av, "c")) != -1) { switch (ch) { + case 'c': + compact = 1; + break; case '?': default: return (CMDRTN_USAGE); @@ -109,9 +116,14 @@ DotCmd(int ac, char **av) } nlist = (struct namelist *)nlresp->data; - fprintf(f, "graph netgraph {\n"); - /* TODO: implement rank = same or subgraphs at some point */ - fprintf(f, "\tedge [ weight = 1.0 ];\n"); + if (compact) { + fprintf(f, "digraph netgraph {\n"); + fprintf(f, "\tedge [ dir = \"none\", fontsize = 10 ];\n"); + } else { + fprintf(f, "graph netgraph {\n"); + /* TODO: implement rank = same or subgraphs at some point */ + fprintf(f, "\tedge [ weight = 1.0 ];\n"); + } fprintf(f, "\tnode [ shape = record, fontsize = 12 ] {\n"); for (i = 0; i < nlist->numnames; i++) fprintf(f, "\t\t\"%jx\" [ label = \"{%s:|{%s|[%jx]:}}\" ];\n", @@ -159,30 +171,40 @@ DotCmd(int ac, char **av) continue; } - fprintf(f, "\tnode [ shape = octagon, fontsize = 10 ] {\n"); - for (j = 0; j < ninfo->hooks; j++) - fprintf(f, "\t\t\"%jx.%s\" [ label = \"%s\" ];\n", - (uintmax_t)nlist->nodeinfo[i].id, - hlist->link[j].ourhook, hlist->link[j].ourhook); - fprintf(f, "\t};\n"); + if (!compact) { + fprintf(f, "\tnode [ shape = octagon, fontsize = 10 ] {\n"); + for (j = 0; j < ninfo->hooks; j++) + fprintf(f, "\t\t\"%jx.%s\" [ label = \"%s\" ];\n", + (uintmax_t)nlist->nodeinfo[i].id, + hlist->link[j].ourhook, hlist->link[j].ourhook); + fprintf(f, "\t};\n"); - fprintf(f, "\t{\n\t\tedge [ weight = 2.0, style = bold ];\n"); - for (j = 0; j < ninfo->hooks; j++) - fprintf(f, "\t\t\"%jx\" -- \"%jx.%s\";\n", - (uintmax_t)nlist->nodeinfo[i].id, - (uintmax_t)nlist->nodeinfo[i].id, - hlist->link[j].ourhook); - fprintf(f, "\t};\n"); + fprintf(f, "\t{\n\t\tedge [ weight = 2.0, style = bold ];\n"); + for (j = 0; j < ninfo->hooks; j++) + fprintf(f, "\t\t\"%jx\" -- \"%jx.%s\";\n", + (uintmax_t)nlist->nodeinfo[i].id, + (uintmax_t)nlist->nodeinfo[i].id, + hlist->link[j].ourhook); + fprintf(f, "\t};\n"); + } for (j = 0; j
svn commit: r367663 - stable/12/sys/dev/vt
Author: kevans Date: Sat Nov 14 01:58:33 2020 New Revision: 367663 URL: https://svnweb.freebsd.org/changeset/base/367663 Log: MFC r367448: vt: resolve conflict between VT_ALT_TO_ESC_HACK and DBG When using the ALT+CTRL+ESC sequence to break into kdb, the keyboard is completely borked when you return. watch(8) shows that it's working, but it's inserting escape sequences. Further investigation revealed that VT_ALT_TO_ESC_HACK is the default and directly conflicts with this sequence, so upon return from the debugger ALKED is set. If they triggered the break to debugger, it's safe to assume they didn't mean to use VT_ALT_TO_ESC_HACK, so just unset it to reduce the surprise when the keyboard seems non-functional upon return. Modified: stable/12/sys/dev/vt/vt_core.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/vt/vt_core.c == --- stable/12/sys/dev/vt/vt_core.c Sat Nov 14 01:55:54 2020 (r367662) +++ stable/12/sys/dev/vt/vt_core.c Sat Nov 14 01:58:33 2020 (r367663) @@ -725,13 +725,22 @@ vt_scroll(struct vt_window *vw, int offset, int whence } static int -vt_machine_kbdevent(int c) +vt_machine_kbdevent(struct vt_device *vd, int c) { switch (c) { case SPCLKEY | DBG: /* kbdmap(5) keyword `debug`. */ - if (vt_kbd_debug) + if (vt_kbd_debug) { kdb_enter(KDB_WHY_BREAK, "manual escape to debugger"); +#if VT_ALT_TO_ESC_HACK + /* +* There's an unfortunate conflict between SPCLKEY|DBG +* and VT_ALT_TO_ESC_HACK. Just assume they didn't mean +* it if we got to here. +*/ + vd->vd_kbstate &= ~ALKED; +#endif + } return (1); case SPCLKEY | HALT: /* kbdmap(5) keyword `halt`. */ if (vt_kbd_halt) @@ -864,7 +873,7 @@ vt_processkey(keyboard_t *kbd, struct vt_device *vd, i return (0); #endif - if (vt_machine_kbdevent(c)) + if (vt_machine_kbdevent(vd, c)) return (0); if (vw->vw_flags & VWF_SCROLL) { ___ 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"