Re: svn commit: r355045 - head/libexec/rtld-elf/powerpc
On Sun, Nov 24, 2019 at 04:35:29AM +, Justin Hibbits wrote: > Author: jhibbits > Date: Sun Nov 24 04:35:29 2019 > New Revision: 355045 > URL: https://svnweb.freebsd.org/changeset/base/355045 > > Log: > rtld/powerpc: Fix _rtld_bind_start for powerpcspe > > Summary: > We need to save off the full 64-bit register, not just the low 32 bits, > of all registers getting saved off in _rtld_bind_start. Additionally, > we need to save off the other SPE registers (SPEFSCR and accumulator), > so that their program state is not affected by the PLT resolver. Why do you need to save these registers ? Why would rtld touch them ? > > Reviewed by:bdragon > Differential Revision: https://reviews.freebsd.org/D22520 > > Modified: > head/libexec/rtld-elf/powerpc/rtld_start.S > > Modified: head/libexec/rtld-elf/powerpc/rtld_start.S > == > --- head/libexec/rtld-elf/powerpc/rtld_start.SSun Nov 24 02:27:50 > 2019(r355044) > +++ head/libexec/rtld-elf/powerpc/rtld_start.SSun Nov 24 04:35:29 > 2019(r355045) > @@ -30,6 +30,7 @@ > */ > > #include > +#include /* For SPR_SPEFSCR if needed. */ > > .extern _GLOBAL_OFFSET_TABLE_ > .extern _DYNAMIC > @@ -101,6 +102,20 @@ _ENTRY(.rtld_start) > li %r0,1 /* _exit() */ > sc > > +#ifdef __SPE__ > +/* stack space for 30 GPRs + SPEFSCR/ACC/lr/cr */ > +#define NREGS 31 > +#define GPRWIDTH8 > +#define FUDGE 4 /* Fudge factor for alignment */ > +#else > +/* stack space for 30 GPRs + lr/cr */ > +#define NREGS 30 > +#define GPRWIDTH4 > +#define FUDGE 0 > +#endif > +/* Stack frame needs the 12-byte ABI frame plus fudge factor. */ > +#define STACK_SIZE (NREGS * GPRWIDTH + 4 * 2 + 12 + FUDGE) > + > /* > * _rtld_bind_secureplt_start() > * > @@ -110,8 +125,12 @@ _ENTRY(.rtld_start) > * So for bss-plt, we multiply the index by 12 to get the offset. > */ > _ENTRY(_rtld_bind_secureplt_start) > - stwu%r1,-160(%r1) # stack space for 29 regs + r0/lr/cr > + stwu%r1,-STACK_SIZE(%r1) > +#ifdef __SPE__ > + evstdd %r0,24(%r1) > +#else > stw %r0,20(%r1) # save r0 > +#endif > > /* >* Instead of division which is costly we will use multiplicative > @@ -137,28 +156,113 @@ _ENTRY(_rtld_bind_secureplt_start) > .globl _rtld_bind > > _ENTRY(_rtld_bind_start) > - stwu%r1,-160(%r1) # stack space for 29 regs + r0/lr/cr > + stwu%r1,-STACK_SIZE(%r1) > +#ifdef __SPE__ > + evstdd %r0,24(%r1) > +#else > stw %r0,20(%r1) # save r0 > +#endif > 1: > mflr%r0 > stw %r0,16(%r1) # save lr > mfcr%r0 > stw %r0,12(%r1) # save cr > +#ifdef __SPE__ > + evstdd %r3, 32(%r1) > + evstdd %r4, 40(%r1) > + evstdd %r5, 48(%r1) > + evstdd %r6, 56(%r1) > + evstdd %r7, 64(%r1) > + evstdd %r8, 72(%r1) > + evstdd %r9, 80(%r1) > + evstdd %r10, 88(%r1) > + evstdd %r11, 96(%r1) > + evstdd %r12, 104(%r1) > + evstdd %r13, 112(%r1) > + evstdd %r14, 120(%r1) > + evstdd %r15, 128(%r1) > + evstdd %r16, 136(%r1) > + evstdd %r17, 144(%r1) > + evstdd %r18, 152(%r1) > + evstdd %r19, 160(%r1) > + evstdd %r20, 168(%r1) > + evstdd %r21, 176(%r1) > + evstdd %r22, 184(%r1) > + evstdd %r23, 192(%r1) > + evstdd %r24, 200(%r1) > + evstdd %r25, 208(%r1) > + evstdd %r26, 216(%r1) > + evstdd %r27, 224(%r1) > + evstdd %r28, 232(%r1) > + evstdd %r29, 240(%r1) > + evstdd %r30, 248(%r1) > + li %r3, 256 > + evstddx %r31, %r1, %r3 > + evxor %r0, %r0, %r0 > + li %r3, 264 > + evmwumiaa %r0, %r0, %r0 > + evstddx %r0, %r1, %r3 > + mfspr %r3, SPR_SPEFSCR > + stw %r3, 20(%r1) > +#else > stmw%r3,24(%r1) # save r3-r31 > +#endif > > mr %r3,%r12# obj > mulli %r4,%r11,12 # rela index * sizeof(Elf_Rela) > bl _rtld_bind # target addr = _rtld_bind(obj, reloff) > mtctr %r3 # move absolute target addr into ctr > > +#ifdef __SPE__ > + lwz %r3, 20(%r1) > + mtspr SPR_SPEFSCR, %r3 > + li %r3, 264 > + evlddx %r0, %r3, %r1 > + evmra %r0, %r0 > + evldd %r3, 32(%r1) > + evldd %r4, 40(%r1) > + evldd %r5, 48(%r1) > + evldd %r6, 56(%r1) > + evldd %r7, 64(%r1) > + evldd %r8, 72(%r1) > + evldd %r9, 80(%r1) > + evldd %r10, 88(%r1) > + evldd %r11, 96(%r1) > + evldd %r12, 104(%r1) > + evldd %r13, 112(%r1) > + evldd %r14, 120(%r1) > + evldd %r15, 128(%r1) > + evldd %r16, 136(%r1) > + evld
Re: svn commit: r355037 - head/sys/dev/pci
On Sat, Nov 23, 2019 at 11:43:52PM +, Warner Losh wrote: > Author: imp > Date: Sat Nov 23 23:43:52 2019 > New Revision: 355037 > URL: https://svnweb.freebsd.org/changeset/base/355037 > > Log: > Push Giant down one layer > > The /dev/pci device doesn't need GIANT, per se. However, one routine > that it calls, pci_find_dbsf implicitly does. It walks a list that can > change when PCI scans a new bus. With hotplug, this means we could > have a race with that scanning. To prevent that, take out Giant around > scanning the list. > > However, given that we have places in the tree that drop giant, if > held when we call into them, the whole use of Giant to protect newbus > may be less effective that we desire, so add a comment about why we're > talking it out, and we'll address the issue when we lock newbus with > something other than Giant. > > Modified: > head/sys/dev/pci/pci.c > head/sys/dev/pci/pci_user.c > > Modified: head/sys/dev/pci/pci.c > == > --- head/sys/dev/pci/pci.cSat Nov 23 23:41:21 2019(r355036) > +++ head/sys/dev/pci/pci.cSat Nov 23 23:43:52 2019(r355037) > @@ -445,18 +445,21 @@ pci_find_bsf(uint8_t bus, uint8_t slot, uint8_t func) > device_t > pci_find_dbsf(uint32_t domain, uint8_t bus, uint8_t slot, uint8_t func) > { > - struct pci_devinfo *dinfo; > + struct pci_devinfo *dinfo = NULL; > > + /* Giant because newbus is Giant locked revisit with newbus locking */ > + mtx_lock(&Giant); > STAILQ_FOREACH(dinfo, &pci_devq, pci_links) { > if ((dinfo->cfg.domain == domain) && > (dinfo->cfg.bus == bus) && > (dinfo->cfg.slot == slot) && > (dinfo->cfg.func == func)) { > - return (dinfo->cfg.dev); > + break; > } > } > + mtx_unlock(&Giant); > > - return (NULL); > + return (dinfo != NULL ? dinfo->cfg.dev : NULL); I do not think this change is correct. If the parallel hotplug, or rather, hot-unplug event occurs, then dinfo potentially becomes invalid right after the Giant unlock, which makes both this function and its callers to access freed memory. Having caller to lock a newbus lock around both the call and consumption of the returned data is required. > } > > /* Find a device_t by vendor/device ID */ > > Modified: head/sys/dev/pci/pci_user.c > == > --- head/sys/dev/pci/pci_user.c Sat Nov 23 23:41:21 2019 > (r355036) > +++ head/sys/dev/pci/pci_user.c Sat Nov 23 23:43:52 2019 > (r355037) > @@ -119,7 +119,7 @@ static d_ioctl_t pci_ioctl; > > struct cdevsw pcicdev = { > .d_version =D_VERSION, > - .d_flags = D_NEEDGIANT, > + .d_flags = 0, > .d_open = pci_open, > .d_close = pci_close, > .d_ioctl = pci_ioctl, ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355054 - head/sys/netpfil/pf
Author: kp Date: Sun Nov 24 13:53:36 2019 New Revision: 355054 URL: https://svnweb.freebsd.org/changeset/base/355054 Log: pf: Add endline to all DPFPRINTF() DPFPRINTF() doesn't automatically add an endline, so be consistent and always add it. Modified: head/sys/netpfil/pf/pf.c head/sys/netpfil/pf/pf_norm.c Modified: head/sys/netpfil/pf/pf.c == --- head/sys/netpfil/pf/pf.cSun Nov 24 12:35:16 2019(r355053) +++ head/sys/netpfil/pf/pf.cSun Nov 24 13:53:36 2019(r355054) @@ -3755,7 +3755,8 @@ pf_create_state(struct pf_rule *r, struct pf_rule *nr, &s->src, &s->dst, rewrite)) { /* This really shouldn't happen!!! */ DPFPRINTF(PF_DEBUG_URGENT, - ("pf_normalize_tcp_stateful failed on first pkt")); + ("pf_normalize_tcp_stateful failed on first " +"pkt\n")); pf_normalize_tcp_cleanup(s); pf_src_tree_remove_state(s); STATE_DEC_COUNTERS(s); Modified: head/sys/netpfil/pf/pf_norm.c == --- head/sys/netpfil/pf/pf_norm.c Sun Nov 24 12:35:16 2019 (r355053) +++ head/sys/netpfil/pf/pf_norm.c Sun Nov 24 13:53:36 2019 (r355054) @@ -550,25 +550,25 @@ pf_fillup_fragment(struct pf_fragment_cmp *key, struct /* No empty fragments. */ if (frent->fe_len == 0) { - DPFPRINTF(("bad fragment: len 0")); + DPFPRINTF(("bad fragment: len 0\n")); goto bad_fragment; } /* All fragments are 8 byte aligned. */ if (frent->fe_mff && (frent->fe_len & 0x7)) { - DPFPRINTF(("bad fragment: mff and len %d", frent->fe_len)); + DPFPRINTF(("bad fragment: mff and len %d\n", frent->fe_len)); goto bad_fragment; } /* Respect maximum length, IP_MAXPACKET == IPV6_MAXPACKET. */ if (frent->fe_off + frent->fe_len > IP_MAXPACKET) { - DPFPRINTF(("bad fragment: max packet %d", + DPFPRINTF(("bad fragment: max packet %d\n", frent->fe_off + frent->fe_len)); goto bad_fragment; } DPFPRINTF((key->frc_af == AF_INET ? - "reass frag %d @ %d-%d" : "reass frag %#08x @ %d-%d", + "reass frag %d @ %d-%d\n" : "reass frag %#08x @ %d-%d\n", key->frc_id, frent->fe_off, frent->fe_off + frent->fe_len)); /* Fully buffer all of the fragments in this fragment queue. */ @@ -642,7 +642,7 @@ pf_fillup_fragment(struct pf_fragment_cmp *key, struct precut = prev->fe_off + prev->fe_len - frent->fe_off; if (precut >= frent->fe_len) goto bad_fragment; - DPFPRINTF(("overlap -%d", precut)); + DPFPRINTF(("overlap -%d\n", precut)); m_adj(frent->fe_m, precut); frent->fe_off += precut; frent->fe_len -= precut; @@ -653,7 +653,7 @@ pf_fillup_fragment(struct pf_fragment_cmp *key, struct uint16_t aftercut; aftercut = frent->fe_off + frent->fe_len - after->fe_off; - DPFPRINTF(("adjust overlap %d", aftercut)); + DPFPRINTF(("adjust overlap %d\n", aftercut)); if (aftercut < after->fe_len) { m_adj(after->fe_m, aftercut); after->fe_off += aftercut; @@ -670,7 +670,7 @@ pf_fillup_fragment(struct pf_fragment_cmp *key, struct /* If part of the queue gets too long, there is not way to recover. */ if (pf_frent_insert(frag, frent, prev)) { - DPFPRINTF(("fragment queue limit exceeded")); + DPFPRINTF(("fragment queue limit exceeded\n")); goto bad_fragment; } @@ -744,7 +744,7 @@ pf_reassemble(struct mbuf **m0, struct ip *ip, int dir m = *m0 = NULL; if (frag->fr_holes) { - DPFPRINTF(("frag %d, holes %d", frag->fr_id, frag->fr_holes)); + DPFPRINTF(("frag %d, holes %d\n", frag->fr_id, frag->fr_holes)); return (PF_PASS); /* drop because *m0 is NULL, no error */ } @@ -771,7 +771,7 @@ pf_reassemble(struct mbuf **m0, struct ip *ip, int dir ip->ip_off &= ~(IP_MF|IP_OFFMASK); if (hdrlen + total > IP_MAXPACKET) { - DPFPRINTF(("drop: too big: %d", total)); + DPFPRINTF(("drop: too big: %d\n", total)); ip->ip_len = 0; REASON_SET(reason, PFRES_SHORT); /* PF_DROP requires a valid mbuf *m0 in pf_test() */ @@ -830,7 +830,8 @@ pf_reassemble6(struct mbuf **m0, struct ip6_hdr *ip6, m = *m0 = NULL; if (frag->fr_holes) { -
Re: svn commit: r355037 - head/sys/dev/pci
On Sun, Nov 24, 2019, 6:10 AM Konstantin Belousov wrote: > On Sat, Nov 23, 2019 at 11:43:52PM +, Warner Losh wrote: > > Author: imp > > Date: Sat Nov 23 23:43:52 2019 > > New Revision: 355037 > > URL: https://svnweb.freebsd.org/changeset/base/355037 > > > > Log: > > Push Giant down one layer > > > > The /dev/pci device doesn't need GIANT, per se. However, one routine > > that it calls, pci_find_dbsf implicitly does. It walks a list that can > > change when PCI scans a new bus. With hotplug, this means we could > > have a race with that scanning. To prevent that, take out Giant around > > scanning the list. > > > > However, given that we have places in the tree that drop giant, if > > held when we call into them, the whole use of Giant to protect newbus > > may be less effective that we desire, so add a comment about why we're > > talking it out, and we'll address the issue when we lock newbus with > > something other than Giant. > > > > Modified: > > head/sys/dev/pci/pci.c > > head/sys/dev/pci/pci_user.c > > > > Modified: head/sys/dev/pci/pci.c > > > == > > --- head/sys/dev/pci/pci.cSat Nov 23 23:41:21 2019(r355036) > > +++ head/sys/dev/pci/pci.cSat Nov 23 23:43:52 2019(r355037) > > @@ -445,18 +445,21 @@ pci_find_bsf(uint8_t bus, uint8_t slot, uint8_t > func) > > device_t > > pci_find_dbsf(uint32_t domain, uint8_t bus, uint8_t slot, uint8_t func) > > { > > - struct pci_devinfo *dinfo; > > + struct pci_devinfo *dinfo = NULL; > > > > + /* Giant because newbus is Giant locked revisit with newbus > locking */ > > + mtx_lock(&Giant); > > STAILQ_FOREACH(dinfo, &pci_devq, pci_links) { > > if ((dinfo->cfg.domain == domain) && > > (dinfo->cfg.bus == bus) && > > (dinfo->cfg.slot == slot) && > > (dinfo->cfg.func == func)) { > > - return (dinfo->cfg.dev); > > + break; > > } > > } > > + mtx_unlock(&Giant); > > > > - return (NULL); > > + return (dinfo != NULL ? dinfo->cfg.dev : NULL); > I do not think this change is correct. If the parallel hotplug, or > rather, hot-unplug event occurs, then dinfo potentially becomes invalid > right after the Giant unlock, which makes both this function and its > callers to access freed memory. Having caller to lock a newbus lock > around both the call and consumption of the returned data is required. There are many data lifetime issues. If anything the PCI user device calls drops Giant and then picks it back up again we are in the same boat... I totally agree this is a bad situation, but can only really be fixed by locking newbus with a different lock than Giant and likely using some kind of reference count for device_t that are handed out... In the mean time, I'll move giant back up into the ioctl routine and hope it isn't dropped by things it calls..m Warner > } > > > > /* Find a device_t by vendor/device ID */ > > > > Modified: head/sys/dev/pci/pci_user.c > > > == > > --- head/sys/dev/pci/pci_user.c Sat Nov 23 23:41:21 2019 > (r355036) > > +++ head/sys/dev/pci/pci_user.c Sat Nov 23 23:43:52 2019 > (r355037) > > @@ -119,7 +119,7 @@ static d_ioctl_t pci_ioctl; > > > > struct cdevsw pcicdev = { > > .d_version =D_VERSION, > > - .d_flags = D_NEEDGIANT, > > + .d_flags = 0, > > .d_open = pci_open, > > .d_close = pci_close, > > .d_ioctl = pci_ioctl, > ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355055 - head/tests/sys/sys
Author: lwhsu Date: Sun Nov 24 15:03:35 2019 New Revision: 355055 URL: https://svnweb.freebsd.org/changeset/base/355055 Log: Fix gcc build We have -Werror=strict-overflow so gcc complains: In file included from /tmp/obj/workspace/src/amd64.amd64/tmp/usr/include/bitstring.h:36:0, from /workspace/src/tests/sys/sys/bitstring_test.c:34: /workspace/src/tests/sys/sys/bitstring_test.c: In function 'bit_ffc_at_test': /workspace/src/sys/sys/bitstring.h:239:5: error: assuming signed overflow does not occur when assuming that (X + c) >= X is always true [-Werror=strict-overflow] if (_start >= _nbits) { ^ Disable assuming overflow of signed integer will never happen by specifying -fno-strict-overflow Sponsored by: The FreeBSD Foundation Modified: head/tests/sys/sys/Makefile Modified: head/tests/sys/sys/Makefile == --- head/tests/sys/sys/Makefile Sun Nov 24 13:53:36 2019(r355054) +++ head/tests/sys/sys/Makefile Sun Nov 24 15:03:35 2019(r355055) @@ -1,9 +1,15 @@ # $FreeBSD$ +.include + TESTSDIR= ${TESTSBASE}/sys/sys ATF_TESTS_C= arb_test bitstring_test qmath_test rb_test splay_test WARNS?=5 + +.if ${COMPILER_TYPE} == "gcc" +CFLAGS.bitstring_test= -fno-strict-overflow +.endif .include ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r355047 - head/libexec/rtld-elf/powerpc
On Sun, Nov 24, 2019, 00:43 Brandon Bergren wrote: > Author: bdragon > Date: Sun Nov 24 06:43:03 2019 > New Revision: 355047 > URL: https://svnweb.freebsd.org/changeset/base/355047 > > Log: > [PowerPC] Fix stack padding issue on ppc32. > > Four bytes of padding are needed in the regular powerpc case to bring the > stack frame size up to a multiple of 16 bytes to meet ABI requirements. > > Fixes odd hangs I was encountering during testing. > > Modified: > head/libexec/rtld-elf/powerpc/rtld_start.S > > Modified: head/libexec/rtld-elf/powerpc/rtld_start.S > > == > --- head/libexec/rtld-elf/powerpc/rtld_start.S Sun Nov 24 05:37:28 2019 > (r355046) > +++ head/libexec/rtld-elf/powerpc/rtld_start.S Sun Nov 24 06:43:03 2019 > (r355047) > @@ -111,7 +111,7 @@ _ENTRY(.rtld_start) > /* stack space for 30 GPRs + lr/cr */ > #defineNREGS 30 > #defineGPRWIDTH4 > -#defineFUDGE 0 > +#defineFUDGE 4 > #endif > /* Stack frame needs the 12-byte ABI frame plus fudge factor. */ > #defineSTACK_SIZE (NREGS * GPRWIDTH + 4 * 2 + 12 + FUDGE) > Oh right, ABI calls for 16-bye alignment. - Justin > ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355056 - in head/sys/dev: mpr mps
Author: imp Date: Sun Nov 24 15:24:05 2019 New Revision: 355056 URL: https://svnweb.freebsd.org/changeset/base/355056 Log: Fix leak in state machine for commands. When we get a device departed message from the firmware, we send a TARGET_REST to the device to let the firmware know we're done and as part of the recovery process. This will abort all the commands. While the documentation says the IOC is responsible for writing the completion message for all the commands pending with an aborted status, we sometimes have queued commands for the target that haven't been completed so are in the INQUEUE state. So, when we later complete the pending CCB as aborted, these commands are freed and we hit the "state not busy" panic. Elsewhere where we dequeue commands, we move the state to BUSY from INQUEUE. Do that here as well. In talking to Ken, Scott and Justin, they recommended a series of tests to see if this is 100% safe. Those tests are ongoing, but preliminary tests suggest this is safe as we see no duplicate completions when we hit this case at work. We have a machine that has a dodgy powersupply which usually doesn't apply power to a few drives, but sometimes does when the machine is under heavy load so we get a rash of the connect / disconnect messages over half an hour. Without this change, we'd see state not busy panic. With this change, the drives just annoyingly come and go without affecting the rest of the machine, but without a complete error injection test suite, it's hard to know if all edge cases are now covered or not. Discussed with: scottl, ken, gibbs Modified: head/sys/dev/mpr/mpr_sas.c head/sys/dev/mps/mps_sas.c Modified: head/sys/dev/mpr/mpr_sas.c == --- head/sys/dev/mpr/mpr_sas.c Sun Nov 24 15:03:35 2019(r355055) +++ head/sys/dev/mpr/mpr_sas.c Sun Nov 24 15:24:05 2019(r355056) @@ -624,6 +624,7 @@ mprsas_remove_device(struct mpr_softc *sc, struct mpr_ mpr_dprint(sc, MPR_XINFO, "Completing missed command %p\n", tm); ccb = tm->cm_complete_data; mprsas_set_ccbstatus(ccb, CAM_DEV_NOT_THERE); + tm->cm_state = MPR_CM_STATE_BUSY; mprsas_scsiio_complete(sc, tm); } } Modified: head/sys/dev/mps/mps_sas.c == --- head/sys/dev/mps/mps_sas.c Sun Nov 24 15:03:35 2019(r355055) +++ head/sys/dev/mps/mps_sas.c Sun Nov 24 15:24:05 2019(r355056) @@ -619,6 +619,7 @@ mpssas_remove_device(struct mps_softc *sc, struct mps_ mps_dprint(sc, MPS_XINFO, "Completing missed command %p\n", tm); ccb = tm->cm_complete_data; mpssas_set_ccbstatus(ccb, CAM_DEV_NOT_THERE); + tm->cm_state = MPS_CM_STATE_BUSY; mpssas_scsiio_complete(sc, tm); } } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355058 - in head/sys/dev: aac aacraid
Author: imp Date: Sun Nov 24 15:37:19 2019 New Revision: 355058 URL: https://svnweb.freebsd.org/changeset/base/355058 Log: Don't need giant for these drivers dev nodes. Also, Giant isn't required to busy / unbusy a device, so drop that too while I'm here. It's not done elsewhere in the tree and in the future will likely be handled by a node lock to ensure consistency. Leave Giant in place for attach and removing childing, as that's actually still needed, even if imperfect. Remove stale comment about contigmalloc taking Giant and calling w/o the lock held. Neither of these is still true. Modified: head/sys/dev/aac/aac.c head/sys/dev/aacraid/aacraid.c Modified: head/sys/dev/aac/aac.c == --- head/sys/dev/aac/aac.c Sun Nov 24 15:37:14 2019(r355057) +++ head/sys/dev/aac/aac.c Sun Nov 24 15:37:19 2019(r355058) @@ -215,7 +215,7 @@ static struct aac_mntinforesp * static struct cdevsw aac_cdevsw = { .d_version =D_VERSION, - .d_flags = D_NEEDGIANT, + .d_flags = 0, .d_open = aac_open, .d_ioctl = aac_ioctl, .d_poll = aac_poll, @@ -3210,9 +3210,7 @@ aac_cdevpriv_dtor(void *arg) sc = arg; fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); - mtx_lock(&Giant); device_unbusy(sc->aac_dev); - mtx_unlock(&Giant); } /* Modified: head/sys/dev/aacraid/aacraid.c == --- head/sys/dev/aacraid/aacraid.c Sun Nov 24 15:37:14 2019 (r355057) +++ head/sys/dev/aacraid/aacraid.c Sun Nov 24 15:37:19 2019 (r355058) @@ -218,7 +218,7 @@ static u_int32_t static struct cdevsw aacraid_cdevsw = { .d_version =D_VERSION, - .d_flags = D_NEEDGIANT, + .d_flags = 0, .d_open = aac_open, #if __FreeBSD_version < 702000 .d_close = aac_close, @@ -1044,9 +1044,7 @@ aac_command_thread(struct aac_softc *sc) "aacraid_aifthd", AAC_PERIODIC_INTERVAL * hz); /* -* First see if any FIBs need to be allocated. This needs -* to be called without the driver lock because contigmalloc -* will grab Giant, and would result in an LOR. +* First see if any FIBs need to be allocated. */ if ((sc->aifflags & AAC_AIFFLAGS_ALLOCFIBS) != 0) { aac_alloc_commands(sc); @@ -3090,9 +3088,7 @@ aac_cdevpriv_dtor(void *arg) sc = arg; fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); - mtx_lock(&Giant); device_unbusy(sc->aac_dev); - mtx_unlock(&Giant); } #else static int ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355057 - head/sys/dev/pci
Author: imp Date: Sun Nov 24 15:37:14 2019 New Revision: 355057 URL: https://svnweb.freebsd.org/changeset/base/355057 Log: Hoist locking giant back up into the ioctl handler Move the locking back into the ioctl handler. This "fixes" the race where we hve a hot plug event just after the dropping of Giant in pci_find_dbsf, assuming the driver doesn't then call anything that drops and picks up Giant again... It's a little safer since don't think it doesn't, but we lack the tools to know for sure. Modified: head/sys/dev/pci/pci.c head/sys/dev/pci/pci_user.c Modified: head/sys/dev/pci/pci.c == --- head/sys/dev/pci/pci.c Sun Nov 24 15:24:05 2019(r355056) +++ head/sys/dev/pci/pci.c Sun Nov 24 15:37:14 2019(r355057) @@ -447,8 +447,6 @@ pci_find_dbsf(uint32_t domain, uint8_t bus, uint8_t sl { struct pci_devinfo *dinfo = NULL; - /* Giant because newbus is Giant locked revisit with newbus locking */ - mtx_lock(&Giant); STAILQ_FOREACH(dinfo, &pci_devq, pci_links) { if ((dinfo->cfg.domain == domain) && (dinfo->cfg.bus == bus) && @@ -457,7 +455,6 @@ pci_find_dbsf(uint32_t domain, uint8_t bus, uint8_t sl break; } } - mtx_unlock(&Giant); return (dinfo != NULL ? dinfo->cfg.dev : NULL); } Modified: head/sys/dev/pci/pci_user.c == --- head/sys/dev/pci/pci_user.c Sun Nov 24 15:24:05 2019(r355056) +++ head/sys/dev/pci/pci_user.c Sun Nov 24 15:37:14 2019(r355057) @@ -965,6 +965,9 @@ pci_ioctl(struct cdev *dev, u_long cmd, caddr_t data, } + /* Giant because newbus is Giant locked revisit with newbus locking */ + mtx_lock(&Giant); + switch (cmd) { case PCIOCGETCONF: #ifdef COMPAT_FREEBSD32 @@ -1288,8 +1291,10 @@ getconfexit: case PCIOCBARMMAP: pbm = (struct pci_bar_mmap *)data; if ((flag & FWRITE) == 0 && - (pbm->pbm_flags & PCIIO_BAR_MMAP_RW) != 0) - return (EPERM); + (pbm->pbm_flags & PCIIO_BAR_MMAP_RW) != 0) { + error = EPERM; + break; + } pcidev = pci_find_dbsf(pbm->pbm_sel.pc_domain, pbm->pbm_sel.pc_bus, pbm->pbm_sel.pc_dev, pbm->pbm_sel.pc_func); @@ -1300,6 +1305,8 @@ getconfexit: error = ENOTTY; break; } + + mtx_unlock(&Giant); return (error); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r355045 - head/libexec/rtld-elf/powerpc
On Sun, Nov 24, 2019, at 7:04 AM, Konstantin Belousov wrote: > On Sun, Nov 24, 2019 at 04:35:29AM +, Justin Hibbits wrote: > > Author: jhibbits > > Date: Sun Nov 24 04:35:29 2019 > > New Revision: 355045 > > URL: https://svnweb.freebsd.org/changeset/base/355045 > > > > Log: > > rtld/powerpc: Fix _rtld_bind_start for powerpcspe > > > > Summary: > > We need to save off the full 64-bit register, not just the low 32 bits, > > of all registers getting saved off in _rtld_bind_start. Additionally, > > we need to save off the other SPE registers (SPEFSCR and accumulator), > > so that their program state is not affected by the PLT resolver. > Why do you need to save these registers ? Why would rtld touch them ? > Out of a need to make the binder as invisible as possible when interacting with code that may or may not be following the normal ABI rules regarding who is responsible for saving stuff. It's not just C code using it. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355059 - head/sys/dev/cxgbe
Author: np Date: Sun Nov 24 16:40:54 2019 New Revision: 355059 URL: https://svnweb.freebsd.org/changeset/base/355059 Log: cxgbe(4): sysctl to reset the temperature/voltage sensor. # sysctl dev...reset_sensor=1 # sysctl dev.t6nex.0.reset_sensor=1 MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/adapter.h == --- head/sys/dev/cxgbe/adapter.hSun Nov 24 15:37:19 2019 (r355058) +++ head/sys/dev/cxgbe/adapter.hSun Nov 24 16:40:54 2019 (r355059) @@ -917,6 +917,7 @@ struct adapter { int last_op_flags; int swintr; + int sensor_resets; struct callout ktls_tick; }; Modified: head/sys/dev/cxgbe/t4_main.c == --- head/sys/dev/cxgbe/t4_main.cSun Nov 24 15:37:19 2019 (r355058) +++ head/sys/dev/cxgbe/t4_main.cSun Nov 24 16:40:54 2019 (r355059) @@ -682,6 +682,7 @@ static int sysctl_autoneg(SYSCTL_HANDLER_ARGS); static int sysctl_handle_t4_reg64(SYSCTL_HANDLER_ARGS); static int sysctl_temperature(SYSCTL_HANDLER_ARGS); static int sysctl_vdd(SYSCTL_HANDLER_ARGS); +static int sysctl_reset_sensor(SYSCTL_HANDLER_ARGS); static int sysctl_loadavg(SYSCTL_HANDLER_ARGS); static int sysctl_cctrl(SYSCTL_HANDLER_ARGS); static int sysctl_cim_ibq_obq(SYSCTL_HANDLER_ARGS); @@ -6264,6 +6265,9 @@ t4_sysctls(struct adapter *sc) SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "temperature", CTLTYPE_INT | CTLFLAG_RD, sc, 0, sysctl_temperature, "I", "chip temperature (in Celsius)"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "reset_sensor", CTLTYPE_INT | + CTLFLAG_RW, sc, 0, sysctl_reset_sensor, "I", + "reset the chip's temperature sensor."); SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "loadavg", CTLTYPE_STRING | CTLFLAG_RD, sc, 0, sysctl_loadavg, "A", @@ -7452,6 +7456,36 @@ sysctl_vdd(SYSCTL_HANDLER_ARGS) } return (sysctl_handle_int(oidp, &sc->params.core_vdd, 0, req)); +} + +static int +sysctl_reset_sensor(SYSCTL_HANDLER_ARGS) +{ + struct adapter *sc = arg1; + int rc, v; + uint32_t param, val; + + v = sc->sensor_resets; + rc = sysctl_handle_int(oidp, &v, 0, req); + if (rc != 0 || req->newptr == NULL || v <= 0) + return (rc); + + if (sc->params.fw_vers < FW_VERSION32(1, 24, 7, 0) || + chip_id(sc) < CHELSIO_T5) + return (ENOTSUP); + + rc = begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, "t4srst"); + if (rc) + return (rc); + param = (V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | + V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_DIAG) | + V_FW_PARAMS_PARAM_Y(FW_PARAM_DEV_DIAG_RESET_TMP_SENSOR)); + val = 1; + rc = -t4_set_params(sc, sc->mbox, sc->pf, 0, 1, ¶m, &val); + end_synchronized_op(sc, 0); + if (rc == 0) + sc->sensor_resets++; + return (rc); } static int ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r355037 - head/sys/dev/pci
On Sun, Nov 24, 2019 at 07:37:01AM -0700, Warner Losh wrote: > On Sun, Nov 24, 2019, 6:10 AM Konstantin Belousov > wrote: > > > On Sat, Nov 23, 2019 at 11:43:52PM +, Warner Losh wrote: > > > Author: imp > > > Date: Sat Nov 23 23:43:52 2019 > > > New Revision: 355037 > > > URL: https://svnweb.freebsd.org/changeset/base/355037 > > > > > > Log: > > > Push Giant down one layer > > > > > > The /dev/pci device doesn't need GIANT, per se. However, one routine > > > that it calls, pci_find_dbsf implicitly does. It walks a list that can > > > change when PCI scans a new bus. With hotplug, this means we could > > > have a race with that scanning. To prevent that, take out Giant around > > > scanning the list. > > > > > > However, given that we have places in the tree that drop giant, if > > > held when we call into them, the whole use of Giant to protect newbus > > > may be less effective that we desire, so add a comment about why we're > > > talking it out, and we'll address the issue when we lock newbus with > > > something other than Giant. > > > > > > Modified: > > > head/sys/dev/pci/pci.c > > > head/sys/dev/pci/pci_user.c > > > > > > Modified: head/sys/dev/pci/pci.c > > > > > == > > > --- head/sys/dev/pci/pci.cSat Nov 23 23:41:21 2019(r355036) > > > +++ head/sys/dev/pci/pci.cSat Nov 23 23:43:52 2019(r355037) > > > @@ -445,18 +445,21 @@ pci_find_bsf(uint8_t bus, uint8_t slot, uint8_t > > func) > > > device_t > > > pci_find_dbsf(uint32_t domain, uint8_t bus, uint8_t slot, uint8_t func) > > > { > > > - struct pci_devinfo *dinfo; > > > + struct pci_devinfo *dinfo = NULL; > > > > > > + /* Giant because newbus is Giant locked revisit with newbus > > locking */ > > > + mtx_lock(&Giant); > > > STAILQ_FOREACH(dinfo, &pci_devq, pci_links) { > > > if ((dinfo->cfg.domain == domain) && > > > (dinfo->cfg.bus == bus) && > > > (dinfo->cfg.slot == slot) && > > > (dinfo->cfg.func == func)) { > > > - return (dinfo->cfg.dev); > > > + break; > > > } > > > } > > > + mtx_unlock(&Giant); > > > > > > - return (NULL); > > > + return (dinfo != NULL ? dinfo->cfg.dev : NULL); > > I do not think this change is correct. If the parallel hotplug, or > > rather, hot-unplug event occurs, then dinfo potentially becomes invalid > > right after the Giant unlock, which makes both this function and its > > callers to access freed memory. Having caller to lock a newbus lock > > around both the call and consumption of the returned data is required. > > > There are many data lifetime issues. If anything the PCI user device calls > drops Giant and then picks it back up again we are in the same boat... I > totally agree this is a bad situation, but can only really be fixed by > locking newbus with a different lock than Giant and likely using some kind > of reference count for device_t that are handed out... > > In the mean time, I'll move giant back up into the ioctl routine and hope > it isn't dropped by things it calls..m I think we can start at least by marking the Giant acqusitions that are related to newbus. I never saw anybody talking publically why the naive translation of newbus Giant into a sleepable lock, e.g. sx in exclusive mode, cannot work. From my memory, one of the big issues is that many sleeps done at probe/attach, need to drop the newbus lock. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r355045 - head/libexec/rtld-elf/powerpc
On Sun, Nov 24, 2019 at 10:32:23AM -0600, Brandon Bergren wrote: > On Sun, Nov 24, 2019, at 7:04 AM, Konstantin Belousov wrote: > > On Sun, Nov 24, 2019 at 04:35:29AM +, Justin Hibbits wrote: > > > Author: jhibbits > > > Date: Sun Nov 24 04:35:29 2019 > > > New Revision: 355045 > > > URL: https://svnweb.freebsd.org/changeset/base/355045 > > > > > > Log: > > > rtld/powerpc: Fix _rtld_bind_start for powerpcspe > > > > > > Summary: > > > We need to save off the full 64-bit register, not just the low 32 bits, > > > of all registers getting saved off in _rtld_bind_start. Additionally, > > > we need to save off the other SPE registers (SPEFSCR and accumulator), > > > so that their program state is not affected by the PLT resolver. > > Why do you need to save these registers ? Why would rtld touch them ? > > > Out of a need to make the binder as invisible as possible when interacting > with code that may or may not be following the normal ABI rules regarding who > is responsible for saving stuff. > > It's not just C code using it. This was not the question. If a register is saved at the bind entry, it means that it is used by rtld itself. I am surprised that rtld needs anything from SPE. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r355045 - head/libexec/rtld-elf/powerpc
On Sun, Nov 24, 2019, at 10:47 AM, Konstantin Belousov wrote: > On Sun, Nov 24, 2019 at 10:32:23AM -0600, Brandon Bergren wrote: > > On Sun, Nov 24, 2019, at 7:04 AM, Konstantin Belousov wrote: > > > On Sun, Nov 24, 2019 at 04:35:29AM +, Justin Hibbits wrote: > > > > Author: jhibbits > > > > Date: Sun Nov 24 04:35:29 2019 > > > > New Revision: 355045 > > > > URL: https://svnweb.freebsd.org/changeset/base/355045 > > > > > > > > Log: > > > > rtld/powerpc: Fix _rtld_bind_start for powerpcspe > > > > > > > > Summary: > > > > We need to save off the full 64-bit register, not just the low 32 > > > > bits, > > > > of all registers getting saved off in _rtld_bind_start. Additionally, > > > > we need to save off the other SPE registers (SPEFSCR and accumulator), > > > > so that their program state is not affected by the PLT resolver. > > > Why do you need to save these registers ? Why would rtld touch them ? > > > > > Out of a need to make the binder as invisible as possible when interacting > > with code that may or may not be following the normal ABI rules regarding > > who is responsible for saving stuff. > > > > It's not just C code using it. > This was not the question. If a register is saved at the bind entry, it > means that it is used by rtld itself. I am surprised that rtld needs > anything from SPE. You have a point there. It's possible it's just the r0 damage (from using it to touch the 64-bit SPRs) combined with the alignment problem was throwing off the testing, and we don't actually have to save the high word of everything and that the negative results during all the testing was all from having either the r0 issue OR the alignment issue when doing the test. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r355045 - head/libexec/rtld-elf/powerpc
On Sun, 24 Nov 2019 18:47:14 +0200 Konstantin Belousov wrote: > On Sun, Nov 24, 2019 at 10:32:23AM -0600, Brandon Bergren wrote: > > On Sun, Nov 24, 2019, at 7:04 AM, Konstantin Belousov wrote: > > > On Sun, Nov 24, 2019 at 04:35:29AM +, Justin Hibbits wrote: > > > > Author: jhibbits > > > > Date: Sun Nov 24 04:35:29 2019 > > > > New Revision: 355045 > > > > URL: https://svnweb.freebsd.org/changeset/base/355045 > > > > > > > > Log: > > > > rtld/powerpc: Fix _rtld_bind_start for powerpcspe > > > > > > > > Summary: > > > > We need to save off the full 64-bit register, not just the > > > > low 32 bits, of all registers getting saved off in > > > > _rtld_bind_start. Additionally, we need to save off the other > > > > SPE registers (SPEFSCR and accumulator), so that their program > > > > state is not affected by the PLT resolver. > > > Why do you need to save these registers ? Why would rtld touch > > > them ? > > Out of a need to make the binder as invisible as possible when > > interacting with code that may or may not be following the normal > > ABI rules regarding who is responsible for saving stuff. > > > > It's not just C code using it. > This was not the question. If a register is saved at the bind entry, > it means that it is used by rtld itself. I am surprised that rtld > needs anything from SPE. This puzzled us to no end when debugging. Brandon found that changes to SPEFSCR got stomped if done before a PLT resolution, which doesn't happen when LD_BIND_NOW=1 is used. Also, I found that sshd, when built with clang, would have a weird hang, which was also 'fixed' with LD_BIND_NOW=1. Tracing through the sshd problem, the values in question were stored in the nonvolatile registers, which shouldn't be clobbered by rtld. The SPEFSCR problem looks like the SPEFSCR was being reverted to a 'last known state in kernel', which I couldn't find a reason for. The swtch32.S code looks correct, as does save_vec() and enable_vec(). Unless I'm missing something there. I've gone over it at least a dozen times in the last week. The ACC register probably doesn't need to be touched, though. - Justin ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355060 - head/sys/amd64/include
Author: kib Date: Sun Nov 24 19:02:13 2019 New Revision: 355060 URL: https://svnweb.freebsd.org/changeset/base/355060 Log: amd64: assert that EARLY_COUNTER does not corrupt memory. Reviewed by: imp Sponsored by: The FreeBSD Foundation MFC after:1 week Differential revision:https://reviews.freebsd.org/D22514 Modified: head/sys/amd64/include/counter.h Modified: head/sys/amd64/include/counter.h == --- head/sys/amd64/include/counter.hSun Nov 24 16:40:54 2019 (r355059) +++ head/sys/amd64/include/counter.hSun Nov 24 19:02:13 2019 (r355060) @@ -82,6 +82,7 @@ static inline void counter_u64_add(counter_u64_t c, int64_t inc) { + KASSERT(IS_BSP() || c != EARLY_COUNTER, ("EARLY_COUNTER used on AP")); __asm __volatile("addq\t%1,%%gs:(%0)" : : "r" ((char *)c - (char *)&__pcpu[0]), "ri" (inc) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355061 - head/sys/fs/tmpfs
Author: kib Date: Sun Nov 24 19:06:38 2019 New Revision: 355061 URL: https://svnweb.freebsd.org/changeset/base/355061 Log: tmpfs: resolve deadlock between rename and unmount. Top-level kern_renameat() increases the writecount on the mount point, which, together with tmpfs unmount suspending the mount, already ensures that unmount cannot proceed while rename unlocks and relocks all operated vnodes. Remove vfs_busy() call from tmpfs_rename() which was done while holding a vnode lock, creating the deadlock. The only intent of the busy operation seems to be the prevention of unmount, which is already ensured. Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after:1 week Modified: head/sys/fs/tmpfs/tmpfs_vnops.c Modified: head/sys/fs/tmpfs/tmpfs_vnops.c == --- head/sys/fs/tmpfs/tmpfs_vnops.c Sun Nov 24 19:02:13 2019 (r355060) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Sun Nov 24 19:06:38 2019 (r355061) @@ -792,7 +792,6 @@ tmpfs_rename(struct vop_rename_args *v) struct vnode *tdvp = v->a_tdvp; struct vnode *tvp = v->a_tvp; struct componentname *tcnp = v->a_tcnp; - struct mount *mp = NULL; char *newname; struct tmpfs_dirent *de; struct tmpfs_mount *tmp; @@ -829,18 +828,10 @@ tmpfs_rename(struct vop_rename_args *v) */ if (fdvp != tdvp && fdvp != tvp) { if (vn_lock(fdvp, LK_EXCLUSIVE | LK_NOWAIT) != 0) { - mp = tdvp->v_mount; - error = vfs_busy(mp, 0); - if (error != 0) { - mp = NULL; - goto out; - } error = tmpfs_rename_relock(fdvp, &fvp, tdvp, &tvp, fcnp, tcnp); - if (error != 0) { - vfs_unbusy(mp); + if (error != 0) return (error); - } ASSERT_VOP_ELOCKED(fdvp, "tmpfs_rename: fdvp not locked"); ASSERT_VOP_ELOCKED(tdvp, @@ -1083,9 +1074,6 @@ out: /* Release source nodes. */ vrele(fdvp); vrele(fvp); - - if (mp != NULL) - vfs_unbusy(mp); return (error); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355062 - in head/sys: kern vm
Author: kib Date: Sun Nov 24 19:12:23 2019 New Revision: 355062 URL: https://svnweb.freebsd.org/changeset/base/355062 Log: Record part of the owner struct thread pointer into busy_lock. Record as much bits from curthread into busy_lock as fits. Low bits for struct thread * representation are zero due to struct and zone alignment, and they leave space for busy flags (perhaps except statically allocated thread0). Upper bits are not very interesting for assert, and in most practical situations recorded value should allow to manually identify the owner with certainity. Assert that unbusy is performed by the owner, except few places where unbusy is done in io completion handler. For this case, add _unchecked variants of asserts and unbusy primitives. Reviewed by: markj (previous version) Tested by:pho Sponsored by: The FreeBSD Foundation Differential revision:https://reviews.freebsd.org/D22298 Modified: head/sys/kern/kern_sendfile.c head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/sys/kern/kern_sendfile.c == --- head/sys/kern/kern_sendfile.c Sun Nov 24 19:06:38 2019 (r355061) +++ head/sys/kern/kern_sendfile.c Sun Nov 24 19:12:23 2019 (r355062) @@ -261,7 +261,7 @@ sendfile_iodone(void *arg, vm_page_t *pg, int count, i for (int i = 0; i < count; i++) if (pg[i] != bogus_page) - vm_page_xunbusy(pg[i]); + vm_page_xunbusy_unchecked(pg[i]); if (error) sfio->error = error; Modified: head/sys/vm/vm_page.c == --- head/sys/vm/vm_page.c Sun Nov 24 19:06:38 2019(r355061) +++ head/sys/vm/vm_page.c Sun Nov 24 19:12:23 2019(r355062) @@ -437,7 +437,7 @@ vm_page_init_marker(vm_page_t marker, int queue, uint1 bzero(marker, sizeof(*marker)); marker->flags = PG_MARKER; marker->aflags = aflags; - marker->busy_lock = VPB_SINGLE_EXCLUSIVER; + marker->busy_lock = VPB_CURTHREAD_EXCLUSIVE; marker->queue = queue; } @@ -939,18 +939,19 @@ vm_page_busy_downgrade(vm_page_t m) int vm_page_busy_tryupgrade(vm_page_t m) { - u_int x; + u_int ce, x; vm_page_assert_sbusied(m); x = m->busy_lock; + ce = VPB_CURTHREAD_EXCLUSIVE; for (;;) { if (VPB_SHARERS(x) > 1) return (0); KASSERT((x & ~VPB_BIT_WAITERS) == VPB_SHARERS_WORD(1), ("vm_page_busy_tryupgrade: invalid lock state")); if (!atomic_fcmpset_acq_int(&m->busy_lock, &x, - VPB_SINGLE_EXCLUSIVER | (x & VPB_BIT_WAITERS))) + ce | (x & VPB_BIT_WAITERS))) continue; return (1); } @@ -1108,7 +1109,7 @@ vm_page_tryxbusy(vm_page_t m) vm_object_t obj; if (atomic_cmpset_acq_int(&(m)->busy_lock, VPB_UNBUSIED, -VPB_SINGLE_EXCLUSIVER) == 0) +VPB_CURTHREAD_EXCLUSIVE) == 0) return (0); obj = m->object; @@ -1119,6 +1120,14 @@ vm_page_tryxbusy(vm_page_t m) return (1); } +static void +vm_page_xunbusy_hard_tail(vm_page_t m) +{ + atomic_store_rel_int(&m->busy_lock, VPB_UNBUSIED); + /* Wake the waiter. */ + wakeup(m); +} + /* * vm_page_xunbusy_hard: * @@ -1127,14 +1136,15 @@ vm_page_tryxbusy(vm_page_t m) void vm_page_xunbusy_hard(vm_page_t m) { - vm_page_assert_xbusied(m); + vm_page_xunbusy_hard_tail(m); +} - /* -* Wake the waiter. -*/ - atomic_store_rel_int(&m->busy_lock, VPB_UNBUSIED); - wakeup(m); +void +vm_page_xunbusy_hard_unchecked(vm_page_t m) +{ + vm_page_assert_xbusied_unchecked(m); + vm_page_xunbusy_hard_tail(m); } /* @@ -1228,7 +1238,7 @@ vm_page_initfake(vm_page_t m, vm_paddr_t paddr, vm_mem m->flags = PG_FICTITIOUS; /* Fictitious pages don't use "order" or "pool". */ m->oflags = VPO_UNMANAGED; - m->busy_lock = VPB_SINGLE_EXCLUSIVER; + m->busy_lock = VPB_CURTHREAD_EXCLUSIVE; /* Fictitious pages are unevictable. */ m->ref_count = 1; pmap_page_init(m); @@ -1318,7 +1328,7 @@ vm_page_readahead_finish(vm_page_t m) else vm_page_deactivate(m); vm_page_unlock(m); - vm_page_xunbusy(m); + vm_page_xunbusy_unchecked(m); } /* @@ -1967,7 +1977,7 @@ found: VPO_UNMANAGED : 0; m->busy_lock = VPB_UNBUSIED; if ((req & (VM_ALLOC_NOBUSY | VM_ALLOC_NOOBJ | VM_ALLOC_SBUSY)) == 0) - m->busy_lock = VPB_SINGLE_EXCLUSIVER; + m->busy_lock = VPB_CURTHREAD_EXCLUSIVE; if ((req & VM_ALLOC_SBUSY) != 0) m->busy_lock = VPB_SHARERS_WORD(1); if
svn commit: r355063 - head/share/misc
Author: eadler Date: Sun Nov 24 19:16:57 2019 New Revision: 355063 URL: https://svnweb.freebsd.org/changeset/base/355063 Log: bsd-family-tree: correct macOS release date Reported by: Herbert J. Skuhra Reported by: Maxim Konovalov Modified: head/share/misc/bsd-family-tree Modified: head/share/misc/bsd-family-tree == --- head/share/misc/bsd-family-tree Sun Nov 24 19:12:23 2019 (r355062) +++ head/share/misc/bsd-family-tree Sun Nov 24 19:16:57 2019 (r355063) @@ -795,7 +795,7 @@ DragonFly 5.6.1 2019-06-19 [DFB] FreeBSD 11.3 2019-07-09 [FBD] DragonFly 5.6.22019-08-11 [DFB] OpenBSD 6.62019-10-17 [OBD] -macOS 10.152019-10.29 [APL] +macOS 10.152019-10-07 [APL] macOS 10.15.1 2019-10-29 [APL] (security/critical release) FreeBSD 12.1 2019-11-04 [FBD] ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355064 - head/sys/vm
Author: kib Date: Sun Nov 24 19:18:12 2019 New Revision: 355064 URL: https://svnweb.freebsd.org/changeset/base/355064 Log: Ignore object->handle for OBJ_ANON objects. Note that the change in vm_object_collapse() is arguably a correctness fix. We must not collapse into content-identity carrying objects. Reviewed by: jeff Tested by:pho Sponsored by: The FreeBSD Foundation Differential revision:https://reviews.freebsd.org/D22467 Modified: head/sys/vm/vm_map.c head/sys/vm/vm_object.c Modified: head/sys/vm/vm_map.c == --- head/sys/vm/vm_map.cSun Nov 24 19:16:57 2019(r355063) +++ head/sys/vm/vm_map.cSun Nov 24 19:18:12 2019(r355064) @@ -3764,8 +3764,7 @@ vm_map_copy_entry( if ((src_object = src_entry->object.vm_object) != NULL) { VM_OBJECT_WLOCK(src_object); charged = ENTRY_CHARGED(src_entry); - if (src_object->handle == NULL && - (src_object->flags & OBJ_ANON) != 0) { + if ((src_object->flags & OBJ_ANON) != 0) { vm_object_collapse(src_object); if ((src_object->flags & OBJ_ONEMAPPING) != 0) { vm_object_split(src_entry); Modified: head/sys/vm/vm_object.c == --- head/sys/vm/vm_object.c Sun Nov 24 19:16:57 2019(r355063) +++ head/sys/vm/vm_object.c Sun Nov 24 19:18:12 2019(r355064) @@ -530,7 +530,7 @@ vm_object_vndeallocate(vm_object_t object) void vm_object_deallocate(vm_object_t object) { - vm_object_t temp; + vm_object_t robject, temp; bool released; while (object != NULL) { @@ -565,19 +565,17 @@ vm_object_deallocate(vm_object_t object) return; } else if (object->ref_count == 1) { if (object->shadow_count == 0 && - object->handle == NULL && (object->flags & OBJ_ANON) != 0) { vm_object_set_flag(object, OBJ_ONEMAPPING); - } else if ((object->shadow_count == 1) && - (object->handle == NULL) && - (object->flags & OBJ_ANON) != 0) { - vm_object_t robject; - + } else if (object->shadow_count == 1) { + KASSERT((object->flags & OBJ_ANON) != 0, + ("obj %p with shadow_count > 0 is not anon", + object)); robject = LIST_FIRST(&object->shadow_head); KASSERT(robject != NULL, - ("vm_object_deallocate: ref_count: %d, shadow_count: %d", -object->ref_count, -object->shadow_count)); + ("vm_object_deallocate: ref_count: %d, " + "shadow_count: %d", object->ref_count, + object->shadow_count)); KASSERT((robject->flags & OBJ_TMPFS_NODE) == 0, ("shadowed tmpfs v_object %p", object)); if (!VM_OBJECT_TRYWLOCK(robject)) { @@ -602,8 +600,7 @@ vm_object_deallocate(vm_object_t object) * deallocating its shadow. */ if ((robject->flags & - (OBJ_DEAD | OBJ_ANON)) == OBJ_ANON && - robject->handle == NULL) { + (OBJ_DEAD | OBJ_ANON)) == OBJ_ANON) { refcount_acquire(&robject->ref_count); retry: @@ -1302,7 +1299,7 @@ vm_object_shadow( * will be collapsed later. */ if (source != NULL && source->ref_count == 1 && - source->handle == NULL && (source->flags & OBJ_ANON) != 0) + (source->flags & OBJ_ANON) != 0) return; /* @@ -1751,10 +1748,8 @@ vm_object_collapse(vm_object_t object) if ((backing_object->flags & OBJ_ANON) == 0) break; VM_OBJECT_WLOCK(backing_object); - if (backing_object->handle != NULL || - (backing_object->flags & OBJ_DEAD) != 0 || - object->handle != NULL || - (object->flags & OBJ_DEAD) != 0) { + if ((backing_object->flags & OBJ_DEAD) != 0 || + (object->flags & (OBJ_DEAD | OBJ_ANON)) != OBJ_ANON) { VM_O
Re: svn commit: r355037 - head/sys/dev/pci
On Sun, Nov 24, 2019, 9:45 AM Konstantin Belousov wrote: > On Sun, Nov 24, 2019 at 07:37:01AM -0700, Warner Losh wrote: > > On Sun, Nov 24, 2019, 6:10 AM Konstantin Belousov > > wrote: > > > > > On Sat, Nov 23, 2019 at 11:43:52PM +, Warner Losh wrote: > > > > Author: imp > > > > Date: Sat Nov 23 23:43:52 2019 > > > > New Revision: 355037 > > > > URL: https://svnweb.freebsd.org/changeset/base/355037 > > > > > > > > Log: > > > > Push Giant down one layer > > > > > > > > The /dev/pci device doesn't need GIANT, per se. However, one > routine > > > > that it calls, pci_find_dbsf implicitly does. It walks a list that > can > > > > change when PCI scans a new bus. With hotplug, this means we could > > > > have a race with that scanning. To prevent that, take out Giant > around > > > > scanning the list. > > > > > > > > However, given that we have places in the tree that drop giant, if > > > > held when we call into them, the whole use of Giant to protect > newbus > > > > may be less effective that we desire, so add a comment about why > we're > > > > talking it out, and we'll address the issue when we lock newbus > with > > > > something other than Giant. > > > > > > > > Modified: > > > > head/sys/dev/pci/pci.c > > > > head/sys/dev/pci/pci_user.c > > > > > > > > Modified: head/sys/dev/pci/pci.c > > > > > > > > == > > > > --- head/sys/dev/pci/pci.cSat Nov 23 23:41:21 2019 > (r355036) > > > > +++ head/sys/dev/pci/pci.cSat Nov 23 23:43:52 2019 > (r355037) > > > > @@ -445,18 +445,21 @@ pci_find_bsf(uint8_t bus, uint8_t slot, uint8_t > > > func) > > > > device_t > > > > pci_find_dbsf(uint32_t domain, uint8_t bus, uint8_t slot, uint8_t > func) > > > > { > > > > - struct pci_devinfo *dinfo; > > > > + struct pci_devinfo *dinfo = NULL; > > > > > > > > + /* Giant because newbus is Giant locked revisit with newbus > > > locking */ > > > > + mtx_lock(&Giant); > > > > STAILQ_FOREACH(dinfo, &pci_devq, pci_links) { > > > > if ((dinfo->cfg.domain == domain) && > > > > (dinfo->cfg.bus == bus) && > > > > (dinfo->cfg.slot == slot) && > > > > (dinfo->cfg.func == func)) { > > > > - return (dinfo->cfg.dev); > > > > + break; > > > > } > > > > } > > > > + mtx_unlock(&Giant); > > > > > > > > - return (NULL); > > > > + return (dinfo != NULL ? dinfo->cfg.dev : NULL); > > > I do not think this change is correct. If the parallel hotplug, or > > > rather, hot-unplug event occurs, then dinfo potentially becomes invalid > > > right after the Giant unlock, which makes both this function and its > > > callers to access freed memory. Having caller to lock a newbus lock > > > around both the call and consumption of the returned data is required. > > > > > > There are many data lifetime issues. If anything the PCI user device > calls > > drops Giant and then picks it back up again we are in the same boat... I > > totally agree this is a bad situation, but can only really be fixed by > > locking newbus with a different lock than Giant and likely using some > kind > > of reference count for device_t that are handed out... > > > > In the mean time, I'll move giant back up into the ioctl routine and hope > > it isn't dropped by things it calls..m > > I think we can start at least by marking the Giant acqusitions that are > related to newbus. > > I never saw anybody talking publically why the naive translation of newbus > Giant into a sleepable lock, e.g. sx in exclusive mode, cannot work. From > my memory, one of the big issues is that many sleeps done at probe/attach, > need to drop the newbus lock. > If we are holding a topology lock, we can't drop it... otherwise someone else can acquire it and change things out from us... Also, locks are useless for device_t lifetimes. Too many places cache them in non obvious ways, so we need to add some kind of ref count. And since these relationships are often not parent / child, we'd likely need a spoilage call to release refs. You shouldn't complete your detaching if others holding references. Finally, we walk both up and down the tree. When I tried a super naive lock in the past, I ran into a bunch of LORs due to this. And what do you do if multiple nodes in the tree want to start a detach/delete at the same time? Or if there is a suspend going on at the same time... These are all solvable problems, but simply replacing giant with a sx lock won't solve them and may introduce issues because giant is special in many ways... it would, however, fix the one aspect of giant we don't want: random parts of the kernel dropping it. Warner > ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr..
svn commit: r355065 - head/sys/compat/linux
Author: wulf Date: Sun Nov 24 20:41:47 2019 New Revision: 355065 URL: https://svnweb.freebsd.org/changeset/base/355065 Log: Linux epoll: Don't deregister file descriptor after EPOLLONESHOT is fired Linux epoll does not remove descriptor after one-shot event has been triggered. Set EV_DISPATCH kqueue flag rather then EV_ONESHOT to get the same behavior. Required by Linux Steam client. PR: 240590 Reported by: Alex S Reviewed by: emaste, imp MFC after:1 week Differential Revision:https://reviews.freebsd.org/D22513 Modified: head/sys/compat/linux/linux_event.c Modified: head/sys/compat/linux/linux_event.c == --- head/sys/compat/linux/linux_event.c Sun Nov 24 19:18:12 2019 (r355064) +++ head/sys/compat/linux/linux_event.c Sun Nov 24 20:41:47 2019 (r355065) @@ -306,7 +306,7 @@ epoll_to_kevent(struct thread *td, struct file *epfp, /* flags related to how event is registered */ if ((levents & LINUX_EPOLLONESHOT) != 0) - *kev_flags |= EV_ONESHOT; + *kev_flags |= EV_DISPATCH; if ((levents & LINUX_EPOLLET) != 0) *kev_flags |= EV_CLEAR; if ((levents & LINUX_EPOLLERR) != 0) @@ -501,16 +501,17 @@ linux_epoll_ctl(struct thread *td, struct linux_epoll_ case LINUX_EPOLL_CTL_ADD: /* * kqueue_register() return ENOENT if event does not exists -* and the EV_ADD flag is not set. +* and the EV_ADD flag is not set. Reset EV_ENABLE flag to +* avoid accidental activation of fired oneshot events. */ - kev[0].flags &= ~EV_ADD; + kev[0].flags &= ~(EV_ADD | EV_ENABLE); error = kqfd_register(args->epfd, &kev[0], td, M_WAITOK); if (error != ENOENT) { error = EEXIST; goto leave0; } error = 0; - kev[0].flags |= EV_ADD; + kev[0].flags |= (EV_ADD | EV_ENABLE); break; case LINUX_EPOLL_CTL_DEL: ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355066 - head/sys/compat/linux
Author: wulf Date: Sun Nov 24 20:44:14 2019 New Revision: 355066 URL: https://svnweb.freebsd.org/changeset/base/355066 Log: Linux epoll: Check both read and write kqueue events existence in EPOLL_CTL_ADD Linux epoll EPOLL_CTL_ADD op handler should always check registration of both EVFILT_READ and EVFILT_WRITE kevents to deceide if supplied file descriptor fd is already registered with epoll instance. Reviewed by: emaste MFC after:1 week Differential Revision:https://reviews.freebsd.org/D22515 Modified: head/sys/compat/linux/linux_event.c Modified: head/sys/compat/linux/linux_event.c == --- head/sys/compat/linux/linux_event.c Sun Nov 24 20:41:47 2019 (r355065) +++ head/sys/compat/linux/linux_event.c Sun Nov 24 20:44:14 2019 (r355066) @@ -98,14 +98,16 @@ __attribute__((packed)) #defineLINUX_MAX_EVENTS(INT_MAX / sizeof(struct epoll_event)) static voidepoll_fd_install(struct thread *td, int fd, epoll_udata_t udata); -static int epoll_to_kevent(struct thread *td, struct file *epfp, - int fd, struct epoll_event *l_event, int *kev_flags, - struct kevent *kevent, int *nkevents); +static int epoll_to_kevent(struct thread *td, int fd, + struct epoll_event *l_event, struct kevent *kevent, + int *nkevents); static voidkevent_to_epoll(struct kevent *kevent, struct epoll_event *l_event); static int epoll_kev_copyout(void *arg, struct kevent *kevp, int count); static int epoll_kev_copyin(void *arg, struct kevent *kevp, int count); -static int epoll_delete_event(struct thread *td, struct file *epfp, - int fd, int filter); +static int epoll_register_kevent(struct thread *td, struct file *epfp, + int fd, int filter, unsigned int flags); +static int epoll_fd_registered(struct thread *td, struct file *epfp, + int fd); static int epoll_delete_all_events(struct thread *td, struct file *epfp, int fd); @@ -296,31 +298,31 @@ linux_epoll_create1(struct thread *td, struct linux_ep /* Structure converting function from epoll to kevent. */ static int -epoll_to_kevent(struct thread *td, struct file *epfp, -int fd, struct epoll_event *l_event, int *kev_flags, +epoll_to_kevent(struct thread *td, int fd, struct epoll_event *l_event, struct kevent *kevent, int *nkevents) { uint32_t levents = l_event->events; struct linux_pemuldata *pem; struct proc *p; + unsigned short kev_flags = EV_ADD | EV_ENABLE; /* flags related to how event is registered */ if ((levents & LINUX_EPOLLONESHOT) != 0) - *kev_flags |= EV_DISPATCH; + kev_flags |= EV_DISPATCH; if ((levents & LINUX_EPOLLET) != 0) - *kev_flags |= EV_CLEAR; + kev_flags |= EV_CLEAR; if ((levents & LINUX_EPOLLERR) != 0) - *kev_flags |= EV_ERROR; + kev_flags |= EV_ERROR; if ((levents & LINUX_EPOLLRDHUP) != 0) - *kev_flags |= EV_EOF; + kev_flags |= EV_EOF; /* flags related to what event is registered */ if ((levents & LINUX_EPOLL_EVRD) != 0) { - EV_SET(kevent++, fd, EVFILT_READ, *kev_flags, 0, 0, 0); + EV_SET(kevent++, fd, EVFILT_READ, kev_flags, 0, 0, 0); ++(*nkevents); } if ((levents & LINUX_EPOLL_EVWR) != 0) { - EV_SET(kevent++, fd, EVFILT_WRITE, *kev_flags, 0, 0, 0); + EV_SET(kevent++, fd, EVFILT_WRITE, kev_flags, 0, 0, 0); ++(*nkevents); } @@ -451,7 +453,6 @@ linux_epoll_ctl(struct thread *td, struct linux_epoll_ epoll_kev_copyin}; struct epoll_event le; cap_rights_t rights; - int kev_flags; int nchanges = 0; int error; @@ -484,9 +485,7 @@ linux_epoll_ctl(struct thread *td, struct linux_epoll_ ciargs.changelist = kev; if (args->op != LINUX_EPOLL_CTL_DEL) { - kev_flags = EV_ADD | EV_ENABLE; - error = epoll_to_kevent(td, epfp, args->fd, &le, - &kev_flags, kev, &nchanges); + error = epoll_to_kevent(td, args->fd, &le, kev, &nchanges); if (error != 0) goto leave0; } @@ -499,19 +498,10 @@ linux_epoll_ctl(struct thread *td, struct linux_epoll_ break; case LINUX_EPOLL_CTL_ADD: - /* -* kqueue_register() return ENOENT if event does not exists -* and the EV_ADD flag is not set. Reset EV_ENABLE flag to -* avoid accidental activation of fired oneshot events. -*/ - kev[0].flags &= ~(EV_ADD | EV_ENABLE); - error =
svn commit: r355067 - head/sys/compat/linux
Author: wulf Date: Sun Nov 24 20:47:40 2019 New Revision: 355067 URL: https://svnweb.freebsd.org/changeset/base/355067 Log: Linux epoll: Register events with zero event mask Such an events are legal and should be interpreted as EPOLLERR | EPOLLHUP. Register a disabled kqueue event in that case as we do not support EPOLLHUP yet. Required by Linux Steam client. PR: 240590 Reported by: Alex S Reviewed by: emaste MFC after:1 week Differential Revision:https://reviews.freebsd.org/D22516 Modified: head/sys/compat/linux/linux_event.c head/sys/compat/linux/linux_event.h Modified: head/sys/compat/linux/linux_event.c == --- head/sys/compat/linux/linux_event.c Sun Nov 24 20:44:14 2019 (r355066) +++ head/sys/compat/linux/linux_event.c Sun Nov 24 20:47:40 2019 (r355067) @@ -325,6 +325,11 @@ epoll_to_kevent(struct thread *td, int fd, struct epol EV_SET(kevent++, fd, EVFILT_WRITE, kev_flags, 0, 0, 0); ++(*nkevents); } + /* zero event mask is legal */ + if ((levents & (LINUX_EPOLL_EVRD | LINUX_EPOLL_EVWR)) == 0) { + EV_SET(kevent++, fd, EVFILT_READ, EV_ADD|EV_DISABLE, 0, 0, 0); + ++(*nkevents); + } if ((levents & ~(LINUX_EPOLL_EVSUP)) != 0) { p = td->td_proc; Modified: head/sys/compat/linux/linux_event.h == --- head/sys/compat/linux/linux_event.h Sun Nov 24 20:44:14 2019 (r355066) +++ head/sys/compat/linux/linux_event.h Sun Nov 24 20:47:40 2019 (r355067) @@ -45,10 +45,10 @@ #defineLINUX_EPOLLONESHOT 1u<<30 #defineLINUX_EPOLLET 1u<<31 -#defineLINUX_EPOLL_EVRD(LINUX_EPOLLIN|LINUX_EPOLLRDNORM \ - |LINUX_EPOLLHUP|LINUX_EPOLLERR|LINUX_EPOLLPRI) +#defineLINUX_EPOLL_EVRD(LINUX_EPOLLIN|LINUX_EPOLLRDNORM) #defineLINUX_EPOLL_EVWR(LINUX_EPOLLOUT|LINUX_EPOLLWRNORM) #defineLINUX_EPOLL_EVSUP (LINUX_EPOLLET|LINUX_EPOLLONESHOT \ + |LINUX_EPOLLHUP|LINUX_EPOLLERR|LINUX_EPOLLPRI \ |LINUX_EPOLL_EVRD|LINUX_EPOLL_EVWR|LINUX_EPOLLRDHUP) #defineLINUX_EPOLL_CTL_ADD 1 ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355068 - head/sys/compat/linux
Author: wulf Date: Sun Nov 24 20:51:09 2019 New Revision: 355068 URL: https://svnweb.freebsd.org/changeset/base/355068 Log: Linux epoll: Allow passing of any negative timeout value to epoll_wait Linux epoll allow passing of any negative timeout value to epoll_wait() to cause unbound blocking Reviewed by: emaste MFC after:1 week Differential Revision:https://reviews.freebsd.org/D22517 Modified: head/sys/compat/linux/linux_event.c Modified: head/sys/compat/linux/linux_event.c == --- head/sys/compat/linux/linux_event.c Sun Nov 24 20:47:40 2019 (r355067) +++ head/sys/compat/linux/linux_event.c Sun Nov 24 20:51:09 2019 (r355068) @@ -557,13 +557,13 @@ linux_epoll_wait_common(struct thread *td, int epfd, s return (error); if (epfp->f_type != DTYPE_KQUEUE) { error = EINVAL; - goto leave1; + goto leave; } if (uset != NULL) { error = kern_sigprocmask(td, SIG_SETMASK, uset, &omask, 0); if (error != 0) - goto leave1; + goto leave; td->td_pflags |= TDP_OLDMASK; /* * Make sure that ast() is called on return to @@ -581,11 +581,12 @@ linux_epoll_wait_common(struct thread *td, int epfd, s coargs.count = 0; coargs.error = 0; - if (timeout != -1) { - if (timeout < 0) { - error = EINVAL; - goto leave0; - } + /* +* Linux epoll_wait(2) man page states that timeout of -1 causes caller +* to block indefinitely. Real implementation does it if any negative +* timeout value is passed. +*/ + if (timeout >= 0) { /* Convert from milliseconds to timespec. */ ts.tv_sec = timeout / 1000; ts.tv_nsec = (timeout % 1000) * 100; @@ -605,11 +606,10 @@ linux_epoll_wait_common(struct thread *td, int epfd, s if (error == 0) td->td_retval[0] = coargs.count; -leave0: if (uset != NULL) error = kern_sigprocmask(td, SIG_SETMASK, &omask, NULL, 0); -leave1: +leave: fdrop(epfp, td); return (error); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r355024 - in head/sys: kern net sys
Sorry, should be: Differential Revision: https://reviews.freebsd.org/D22504 On Sat, Nov 23, 2019 at 2:57 AM Bjoern A. Zeeb wrote: > > On 22 Nov 2019, at 23:23, Conrad Meyer wrote: > > > Author: cem > > Date: Fri Nov 22 23:23:40 2019 > > New Revision: 355024 > > URL: https://svnweb.freebsd.org/changeset/base/355024 > > > > Log: > > Add explicit SI_SUB_EPOCH > > > > Add explicit SI_SUB_EPOCH, after SI_SUB_TASKQ and before SI_SUB_SMP > > (EARLY_AP_STARTUP). Rename existing "SI_SUB_TASKQ + 1" to > > SI_SUB_EPOCH. > > > > epoch(9) consumers cannot epoch_alloc() before > > SI_SUB_EPOCH:SI_ORDER_SECOND, > > but likely should allocate before SI_SUB_SMP. Prior to this change, > > consumers (well, epoch itself, and net/if.c) just open-coded the > > SI_SUB_TASKQ + 1 order to match epoch.c, but this was fragile. > > > > Reviewed by:mmacy > > Differential Revision: https://reviews.freebsd.org/D22503 > > That’s the wrong review URL? ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355069 - head/sys/arm/arm
Author: ian Date: Sun Nov 24 21:08:56 2019 New Revision: 355069 URL: https://svnweb.freebsd.org/changeset/base/355069 Log: When doing ARM stack unwinding as part of stack_save(9), do not search loaded modules (pass 0/false for the can_lock arg). Searching the unwind info in modules acquires an exclusive sxlock, and the stack(9) functions can be called in a context where unbounded sleeps are forbidden (such as from the witness checkorder code). Just ignoring the existence of modules in stack_save() is not ideal, so I'm looking for a better solution, but this commit will make it possible to boot an ARM kernel with WITNESS enabled again, until I get something better. PR: 242200 Modified: head/sys/arm/arm/stack_machdep.c Modified: head/sys/arm/arm/stack_machdep.c == --- head/sys/arm/arm/stack_machdep.cSun Nov 24 20:51:09 2019 (r355068) +++ head/sys/arm/arm/stack_machdep.cSun Nov 24 21:08:56 2019 (r355069) @@ -40,7 +40,7 @@ stack_capture(struct stack *st, struct unwind_state *s { stack_zero(st); - while (unwind_stack_one(state, 1) == 0) { + while (unwind_stack_one(state, 0) == 0) { if (stack_put(st, state->registers[PC]) == -1) break; } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r355055 - head/tests/sys/sys
Don't we already build with -fwrapv for this class of problem? The GCC docs claim that warning is only active when signed overflow is undefined. It seems that -fno-strict-overflow has similar semantics to -fwrapv, but we should probably be consistent about the flag we use. Also, if GCC is producing this warning, I think Clang needs the same flag. Best, Conrad On Sun, Nov 24, 2019 at 7:03 AM Li-Wen Hsu wrote: > > Author: lwhsu > Date: Sun Nov 24 15:03:35 2019 > New Revision: 355055 > URL: https://svnweb.freebsd.org/changeset/base/355055 > > Log: > Fix gcc build > > We have -Werror=strict-overflow so gcc complains: > > In file included from > /tmp/obj/workspace/src/amd64.amd64/tmp/usr/include/bitstring.h:36:0, >from /workspace/src/tests/sys/sys/bitstring_test.c:34: > /workspace/src/tests/sys/sys/bitstring_test.c: In function > 'bit_ffc_at_test': > /workspace/src/sys/sys/bitstring.h:239:5: error: assuming signed overflow > does not occur when assuming that (X + c) >= X is always true > [-Werror=strict-overflow] > if (_start >= _nbits) { >^ > > Disable assuming overflow of signed integer will never happen by specifying > -fno-strict-overflow > > Sponsored by: The FreeBSD Foundation > > Modified: > head/tests/sys/sys/Makefile > > Modified: head/tests/sys/sys/Makefile > == > --- head/tests/sys/sys/Makefile Sun Nov 24 13:53:36 2019(r355054) > +++ head/tests/sys/sys/Makefile Sun Nov 24 15:03:35 2019(r355055) > @@ -1,9 +1,15 @@ > # $FreeBSD$ > > +.include > + > TESTSDIR= ${TESTSBASE}/sys/sys > > ATF_TESTS_C= arb_test bitstring_test qmath_test rb_test splay_test > > WARNS?=5 > + > +.if ${COMPILER_TYPE} == "gcc" > +CFLAGS.bitstring_test= -fno-strict-overflow > +.endif > > .include ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355070 - head/sys/net
Author: bz Date: Sun Nov 24 23:21:47 2019 New Revision: 355070 URL: https://svnweb.freebsd.org/changeset/base/355070 Log: Allow kernel to compile without BPF. r297816 added some bpf magic for VIMAGE unconditionally which no longer allows kernels to compile without bpf (but with other networking). Add the missing ifdef checks and allow a kernel to compile without bpf again. PR: 242136 Reported by: dave mischler.com MFC after:2 weeks Modified: head/sys/net/if.c Modified: head/sys/net/if.c == --- head/sys/net/if.c Sun Nov 24 21:08:56 2019(r355069) +++ head/sys/net/if.c Sun Nov 24 23:21:47 2019(r355070) @@ -32,6 +32,7 @@ * $FreeBSD$ */ +#include "opt_bpf.h" #include "opt_inet6.h" #include "opt_inet.h" @@ -1260,16 +1261,20 @@ static void if_vmove(struct ifnet *ifp, struct vnet *new_vnet) { struct if_clone *ifc; +#ifdef DEV_BPF u_int bif_dlt, bif_hdrlen; +#endif void *old; int rc; +#ifdef DEV_BPF /* * if_detach_internal() will call the eventhandler to notify * interface departure. That will detach if_bpf. We need to * safe the dlt and hdrlen so we can re-attach it later. */ bpf_get_bp_params(ifp->if_bpf, &bif_dlt, &bif_hdrlen); +#endif /* * Detach from current vnet, but preserve LLADDR info, do not @@ -1316,8 +1321,10 @@ if_vmove(struct ifnet *ifp, struct vnet *new_vnet) if_attach_internal(ifp, 1, ifc); +#ifdef DEV_BPF if (ifp->if_bpf == NULL) bpfattach(ifp, bif_dlt, bif_hdrlen); +#endif CURVNET_RESTORE(); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355074 - head/sys/dev/ntb/ntb_hw
Author: mav Date: Mon Nov 25 01:00:51 2019 New Revision: 355074 URL: https://svnweb.freebsd.org/changeset/base/355074 Log: Report XLAT0 register for completeness. Modified: head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Modified: head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c == --- head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Mon Nov 25 00:34:59 2019 (r355073) +++ head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Mon Nov 25 01:00:51 2019 (r355074) @@ -2409,6 +2409,14 @@ intel_ntb_sysctl_init(struct ntb_softc *ntb) if (ntb->conn_type != NTB_CONN_B2B) return; + SYSCTL_ADD_PROC(ctx, regpar, OID_AUTO, "outgoing_xlat01l", + CTLFLAG_RD | CTLTYPE_OPAQUE, ntb, + NTB_REG_32 | XEON_B2B_XLAT_OFFSETL, + sysctl_handle_register, "IU", "Outgoing XLAT0L register"); + SYSCTL_ADD_PROC(ctx, regpar, OID_AUTO, "outgoing_xlat01u", + CTLFLAG_RD | CTLTYPE_OPAQUE, ntb, + NTB_REG_32 | XEON_B2B_XLAT_OFFSETU, + sysctl_handle_register, "IU", "Outgoing XLAT0U register"); SYSCTL_ADD_PROC(ctx, regpar, OID_AUTO, "outgoing_xlat23", CTLFLAG_RD | CTLTYPE_OPAQUE, ntb, NTB_REG_64 | ntb->bar_info[NTB_B2B_BAR_1].pbarxlat_off, ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355076 - head/sys/vm
Author: dougm Date: Mon Nov 25 02:19:47 2019 New Revision: 355076 URL: https://svnweb.freebsd.org/changeset/base/355076 Log: Where 'current' is used to index over vm_map entries, use 'entry'. Where 'entry' is used to identify the starting point for iteration, use 'first_entry'. These are the naming conventions used in most of the vm_map.c code. Where VM_MAP_ENTRY_FOREACH can be used, do so. Squeeze a few lines to fit in 80 columns. Where lines are being modified for these reasons, look to remove style(9) violations. Reviewed by: alc, markj Differential Revision: https://reviews.freebsd.org/D22458 Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c == --- head/sys/vm/vm_map.cMon Nov 25 01:32:50 2019(r355075) +++ head/sys/vm/vm_map.cMon Nov 25 02:19:47 2019(r355076) @@ -2093,14 +2093,15 @@ vm_map_merged_neighbor_dispose(vm_map_t map, vm_map_en * The map must be locked. */ void -vm_map_try_merge_entries(vm_map_t map, vm_map_entry_t prev, vm_map_entry_t entry) +vm_map_try_merge_entries(vm_map_t map, vm_map_entry_t prev_entry, +vm_map_entry_t entry) { VM_MAP_ASSERT_LOCKED(map); if ((entry->eflags & MAP_ENTRY_NOMERGE_MASK) == 0 && - vm_map_mergeable_neighbors(prev, entry)) { - vm_map_entry_unlink(map, prev, UNLINK_MERGE_NEXT); - vm_map_merged_neighbor_dispose(map, prev); + vm_map_mergeable_neighbors(prev_entry, entry)) { + vm_map_entry_unlink(map, prev_entry, UNLINK_MERGE_NEXT); + vm_map_merged_neighbor_dispose(map, prev_entry); } } @@ -2445,7 +2446,7 @@ int vm_map_protect(vm_map_t map, vm_offset_t start, vm_offset_t end, vm_prot_t new_prot, boolean_t set_max) { - vm_map_entry_t current, entry, in_tran, prev_entry; + vm_map_entry_t entry, first_entry, in_tran, prev_entry; vm_object_t obj; struct ucred *cred; vm_prot_t old_prot; @@ -2468,26 +2469,26 @@ again: VM_MAP_RANGE_CHECK(map, start, end); - if (!vm_map_lookup_entry(map, start, &entry)) - entry = vm_map_entry_succ(entry); + if (!vm_map_lookup_entry(map, start, &first_entry)) + first_entry = vm_map_entry_succ(first_entry); /* * Make a first pass to check for protection violations. */ - for (current = entry; current->start < end; - current = vm_map_entry_succ(current)) { - if ((current->eflags & MAP_ENTRY_GUARD) != 0) + for (entry = first_entry; entry->start < end; + entry = vm_map_entry_succ(entry)) { + if ((entry->eflags & MAP_ENTRY_GUARD) != 0) continue; - if (current->eflags & MAP_ENTRY_IS_SUB_MAP) { + if ((entry->eflags & MAP_ENTRY_IS_SUB_MAP) != 0) { vm_map_unlock(map); return (KERN_INVALID_ARGUMENT); } - if ((new_prot & current->max_protection) != new_prot) { + if ((new_prot & entry->max_protection) != new_prot) { vm_map_unlock(map); return (KERN_PROTECTION_FAILURE); } - if ((current->eflags & MAP_ENTRY_IN_TRANSITION) != 0) - in_tran = current; + if ((entry->eflags & MAP_ENTRY_IN_TRANSITION) != 0) + in_tran = entry; } /* @@ -2511,30 +2512,30 @@ again: * some may now be mergeable. */ rv = KERN_SUCCESS; - vm_map_clip_start(map, entry, start); - for (current = entry; current->start < end; - current = vm_map_entry_succ(current)) { + vm_map_clip_start(map, first_entry, start); + for (entry = first_entry; entry->start < end; + entry = vm_map_entry_succ(entry)) { + vm_map_clip_end(map, entry, end); - vm_map_clip_end(map, current, end); - if (set_max || - ((new_prot & ~(current->protection)) & VM_PROT_WRITE) == 0 || - ENTRY_CHARGED(current) || - (current->eflags & MAP_ENTRY_GUARD) != 0) { + ((new_prot & ~entry->protection) & VM_PROT_WRITE) == 0 || + ENTRY_CHARGED(entry) || + (entry->eflags & MAP_ENTRY_GUARD) != 0) { continue; } cred = curthread->td_ucred; - obj = current->object.vm_object; + obj = entry->object.vm_object; - if (obj == NULL || (current->eflags & MAP_ENTRY_NEEDS_COPY)) { - if (!swap_reserve(current->end - current->start)) { + if (obj == NULL || + (entry->eflags & MAP_ENTRY_NEEDS_COPY) != 0) { + if (!swap_reser
svn commit: r355082 - head/sys/vm
Author: jeff Date: Mon Nov 25 07:13:05 2019 New Revision: 355082 URL: https://svnweb.freebsd.org/changeset/base/355082 Log: Move anonymous object copying for fork into its own routine and so that we can avoid locking non-anonymous objects. Reviewed by: kib Differential Revision:https://reviews.freebsd.org/D22472 Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c == --- head/sys/vm/vm_map.cMon Nov 25 06:16:53 2019(r355081) +++ head/sys/vm/vm_map.cMon Nov 25 07:13:05 2019(r355082) @@ -3722,7 +3722,57 @@ vm_map_check_protection(vm_map_t map, vm_offset_t star return (TRUE); } + /* + * + * vm_map_copy_anon_object: + * + * Copies an anonymous object from an existing map entry to a + * new one. Carries forward the swap charge. May change the + * src object on return. + */ +static void +vm_map_copy_anon_object(vm_map_entry_t src_entry, vm_map_entry_t dst_entry, +vm_offset_t size, vm_ooffset_t *fork_charge) +{ + vm_object_t src_object; + struct ucred *cred; + int charged; + + src_object = src_entry->object.vm_object; + VM_OBJECT_WLOCK(src_object); + charged = ENTRY_CHARGED(src_entry); + vm_object_collapse(src_object); + if ((src_object->flags & OBJ_ONEMAPPING) != 0) { + vm_object_split(src_entry); + src_object = src_entry->object.vm_object; + } + vm_object_reference_locked(src_object); + vm_object_clear_flag(src_object, OBJ_ONEMAPPING); + if (src_entry->cred != NULL && + !(src_entry->eflags & MAP_ENTRY_NEEDS_COPY)) { + KASSERT(src_object->cred == NULL, + ("OVERCOMMIT: vm_map_copy_anon_entry: cred %p", +src_object)); + src_object->cred = src_entry->cred; + src_object->charge = size; + } + VM_OBJECT_WUNLOCK(src_object); + dst_entry->object.vm_object = src_object; + if (charged) { + cred = curthread->td_ucred; + crhold(cred); + dst_entry->cred = cred; + *fork_charge += size; + if (!(src_entry->eflags & MAP_ENTRY_NEEDS_COPY)) { + crhold(cred); + src_entry->cred = cred; + *fork_charge += size; + } + } +} + +/* * vm_map_copy_entry: * * Copies the contents of the source entry to the destination @@ -3739,8 +3789,6 @@ vm_map_copy_entry( vm_object_t src_object; vm_map_entry_t fake_entry; vm_offset_t size; - struct ucred *cred; - int charged; VM_MAP_ASSERT_LOCKED(dst_map); @@ -3766,39 +3814,14 @@ vm_map_copy_entry( */ size = src_entry->end - src_entry->start; if ((src_object = src_entry->object.vm_object) != NULL) { - VM_OBJECT_WLOCK(src_object); - charged = ENTRY_CHARGED(src_entry); if ((src_object->flags & OBJ_ANON) != 0) { - vm_object_collapse(src_object); - if ((src_object->flags & OBJ_ONEMAPPING) != 0) { - vm_object_split(src_entry); - src_object = - src_entry->object.vm_object; - } - } - vm_object_reference_locked(src_object); - vm_object_clear_flag(src_object, OBJ_ONEMAPPING); - if (src_entry->cred != NULL && - !(src_entry->eflags & MAP_ENTRY_NEEDS_COPY)) { - KASSERT(src_object->cred == NULL, - ("OVERCOMMIT: vm_map_copy_entry: cred %p", -src_object)); - src_object->cred = src_entry->cred; - src_object->charge = size; - } - VM_OBJECT_WUNLOCK(src_object); - dst_entry->object.vm_object = src_object; - if (charged) { - cred = curthread->td_ucred; - crhold(cred); - dst_entry->cred = cred; - *fork_charge += size; - if (!(src_entry->eflags & - MAP_ENTRY_NEEDS_COPY)) { - crhold(cred); - src_entry->cred = cred; - *fork_charge += size; - } + vm_map_copy_anon_object(src_entry, dst_entry, +
svn commit: r355083 - head/sys/kern
Author: rlibby Date: Mon Nov 25 07:38:27 2019 New Revision: 355083 URL: https://svnweb.freebsd.org/changeset/base/355083 Log: sysctl sysctls: wire old buf before output with sysctl lock Several sysctl sysctls output to a user buffer while holding a non-sleepable lock that protects the sysctl topology. They need to wire the output buffer, or else they may try to sleep on a page fault. Reviewed by: cem, markj Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D22528 Modified: head/sys/kern/kern_sysctl.c Modified: head/sys/kern/kern_sysctl.c == --- head/sys/kern/kern_sysctl.c Mon Nov 25 07:13:05 2019(r355082) +++ head/sys/kern/kern_sysctl.c Mon Nov 25 07:38:27 2019(r355083) @@ -1023,12 +1023,16 @@ sysctl_sysctl_name(SYSCTL_HANDLER_ARGS) { int *name = (int *) arg1; u_int namelen = arg2; - int error = 0; + int error; struct sysctl_oid *oid; struct sysctl_oid_list *lsp = &sysctl__children, *lsp2; struct rm_priotracker tracker; char buf[10]; + error = sysctl_wire_old_buffer(req, 0); + if (error) + return (error); + SYSCTL_RLOCK(&tracker); while (namelen) { if (!lsp) { @@ -1265,6 +1269,10 @@ sysctl_sysctl_oidfmt(SYSCTL_HANDLER_ARGS) struct rm_priotracker tracker; int error; + error = sysctl_wire_old_buffer(req, 0); + if (error) + return (error); + SYSCTL_RLOCK(&tracker); error = sysctl_find_oid(arg1, arg2, &oid, NULL, req); if (error) @@ -1294,6 +1302,10 @@ sysctl_sysctl_oiddescr(SYSCTL_HANDLER_ARGS) struct rm_priotracker tracker; int error; + error = sysctl_wire_old_buffer(req, 0); + if (error) + return (error); + SYSCTL_RLOCK(&tracker); error = sysctl_find_oid(arg1, arg2, &oid, NULL, req); if (error) @@ -1318,6 +1330,10 @@ sysctl_sysctl_oidlabel(SYSCTL_HANDLER_ARGS) struct sysctl_oid *oid; struct rm_priotracker tracker; int error; + + error = sysctl_wire_old_buffer(req, 0); + if (error) + return (error); SYSCTL_RLOCK(&tracker); error = sysctl_find_oid(arg1, arg2, &oid, NULL, req); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355084 - head/sys/vm
Author: rlibby Date: Mon Nov 25 07:38:31 2019 New Revision: 355084 URL: https://svnweb.freebsd.org/changeset/base/355084 Log: vm_object_collapse_scan_wait: drop locks before reacquiring Regression from r352174. In the vm_page_rename() failure case we forgot to unlock the vm object locks before sleeping and reacquiring them. Reviewed by: jeff Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D22542 Modified: head/sys/vm/vm_object.c Modified: head/sys/vm/vm_object.c == --- head/sys/vm/vm_object.c Mon Nov 25 07:38:27 2019(r355083) +++ head/sys/vm/vm_object.c Mon Nov 25 07:38:31 2019(r355084) @@ -1496,6 +1496,8 @@ vm_object_collapse_scan_wait(vm_object_t object, vm_pa return (next); /* The page is only NULL when rename fails. */ if (p == NULL) { + VM_OBJECT_WUNLOCK(object); + VM_OBJECT_WUNLOCK(backing_object); vm_radix_wait(); } else { if (p->object == object) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355085 - in head: contrib/expat contrib/expat/doc contrib/expat/examples contrib/expat/lib contrib/expat/tests contrib/expat/tests/benchmark contrib/expat/xmlwf lib/libexpat
Author: delphij Date: Mon Nov 25 07:48:16 2019 New Revision: 355085 URL: https://svnweb.freebsd.org/changeset/base/355085 Log: MFV r355071: libbsdxml (expat) 2.2.9. MFC after:2 weeks Relnotes: yes Added: head/contrib/expat/fix-xmltest-log.sh - copied unchanged from r355071, vendor/expat/dist/fix-xmltest-log.sh head/contrib/expat/xmlwf/xmlwf_helpgen.py - copied unchanged from r355071, vendor/expat/dist/xmlwf/xmlwf_helpgen.py head/contrib/expat/xmlwf/xmlwf_helpgen.sh - copied unchanged from r355071, vendor/expat/dist/xmlwf/xmlwf_helpgen.sh Modified: head/contrib/expat/Changes head/contrib/expat/FREEBSD-Xlist head/contrib/expat/Makefile.am head/contrib/expat/Makefile.in head/contrib/expat/README.md head/contrib/expat/configure.ac head/contrib/expat/doc/Makefile.am head/contrib/expat/doc/Makefile.in head/contrib/expat/doc/reference.html head/contrib/expat/examples/Makefile.in head/contrib/expat/examples/elements.c head/contrib/expat/examples/outline.c head/contrib/expat/expat_config.h.in head/contrib/expat/lib/Makefile.am head/contrib/expat/lib/Makefile.in head/contrib/expat/lib/asciitab.h head/contrib/expat/lib/expat.h head/contrib/expat/lib/expat_external.h head/contrib/expat/lib/iasciitab.h head/contrib/expat/lib/internal.h head/contrib/expat/lib/latin1tab.h head/contrib/expat/lib/nametab.h head/contrib/expat/lib/siphash.h head/contrib/expat/lib/utf8tab.h head/contrib/expat/lib/xmlparse.c head/contrib/expat/lib/xmlrole.c head/contrib/expat/lib/xmlrole.h head/contrib/expat/lib/xmltok.c head/contrib/expat/lib/xmltok.h head/contrib/expat/lib/xmltok_impl.c head/contrib/expat/lib/xmltok_impl.h head/contrib/expat/lib/xmltok_ns.c head/contrib/expat/test-driver-wrapper.sh head/contrib/expat/tests/Makefile.in head/contrib/expat/tests/benchmark/Makefile.in head/contrib/expat/tests/benchmark/benchmark.c head/contrib/expat/tests/chardata.c head/contrib/expat/tests/chardata.h head/contrib/expat/tests/memcheck.c head/contrib/expat/tests/memcheck.h head/contrib/expat/tests/minicheck.c head/contrib/expat/tests/minicheck.h head/contrib/expat/tests/runtests.c head/contrib/expat/tests/structdata.c head/contrib/expat/tests/structdata.h head/contrib/expat/tests/xmltest.sh head/contrib/expat/xmlwf/Makefile.am head/contrib/expat/xmlwf/Makefile.in head/contrib/expat/xmlwf/codepage.c head/contrib/expat/xmlwf/ct.c head/contrib/expat/xmlwf/filemap.h head/contrib/expat/xmlwf/readfilemap.c head/contrib/expat/xmlwf/unixfilemap.c head/contrib/expat/xmlwf/win32filemap.c head/contrib/expat/xmlwf/xmlfile.c head/contrib/expat/xmlwf/xmlfile.h head/contrib/expat/xmlwf/xmlmime.c head/contrib/expat/xmlwf/xmltchar.h head/contrib/expat/xmlwf/xmlwf.c head/lib/libexpat/expat_config.h head/lib/libexpat/libbsdxml.3 Directory Properties: head/contrib/expat/ (props changed) Modified: head/contrib/expat/Changes == --- head/contrib/expat/Changes Mon Nov 25 07:38:31 2019(r355084) +++ head/contrib/expat/Changes Mon Nov 25 07:48:16 2019(r355085) @@ -2,6 +2,162 @@ NOTE: We are looking for help with a few things: https://github.com/libexpat/libexpat/labels/help%20wanted If you can help, please get in touch. Thanks! +Release 2.2.9 Wed Septemper 25 2019 +Other changes: + examples: Drop executable bits from elements.c +#349 Windows: Change the name of the Windows DLLs from expat*.dll +to libexpat*.dll once more (regression from 2.2.8, first +fixed in 1.95.3, issue #61 on SourceForge today, +was issue #432456 back then); needs a fix due +case-insensitive file systems on Windows and the fact that +Perl's XML::Parser::Expat compiles into Expat.dll. +#347 Windows: Only define _CRT_RAND_S if not defined + Version info bumped from 7:10:6 to 7:11:6 + +Special thanks to: +Ben Wagner + +Release 2.2.8 Fri Septemper 13 2019 +Security fixes: + #317 #318 CVE-2019-15903 -- Fix heap overflow triggered by +XML_GetCurrentLineNumber (or XML_GetCurrentColumnNumber), +and deny internal entities closing the doctype; +fixed in commit c20b758c332d9a13afbbb276d30db1d183a85d43 + +Bug fixes: +#240 Fix cases where XML_StopParser did not have any effect +when called from inside of an end element handler +#341 xmlwf: Fix exit code for operation without "-d DIRECTORY"; +previously, only "-d DIRECTORY" would give you a proper +exit code: + # xmlwf -d . <<<'' 2>/dev/null ; echo $? + 2 + # xmlwf <<<'' 2>/dev/nu