svn commit: r305675 - in stable: 10/sys/dev/hwpmc 11/sys/dev/hwpmc 9/sys/dev/hwpmc
Author: jhb Date: Fri Sep 9 21:19:31 2016 New Revision: 305675 URL: https://svnweb.freebsd.org/changeset/base/305675 Log: MFC 303720: Apply the fix from r232612 to fixed function counters. Modified: stable/10/sys/dev/hwpmc/hwpmc_core.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/dev/hwpmc/hwpmc_core.c stable/9/sys/dev/hwpmc/hwpmc_core.c Directory Properties: stable/11/ (props changed) stable/9/sys/ (props changed) Modified: stable/10/sys/dev/hwpmc/hwpmc_core.c == --- stable/10/sys/dev/hwpmc/hwpmc_core.cFri Sep 9 21:00:07 2016 (r305674) +++ stable/10/sys/dev/hwpmc/hwpmc_core.cFri Sep 9 21:19:31 2016 (r305675) @@ -364,7 +364,7 @@ iaf_read_pmc(int cpu, int ri, pmc_value_ if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) *v = iaf_perfctr_value_to_reload_count(tmp); else - *v = tmp; + *v = tmp & ((1ULL << core_iaf_width) - 1); PMCDBG4(MDP,REA,1, "iaf-read cpu=%d ri=%d msr=0x%x -> v=%jx", cpu, ri, IAF_RI_TO_MSR(ri), *v); ___ svn-src-stable-10@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10 To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"
svn commit: r305673 - in stable: 10/sys/amd64/vmm 11/sys/amd64/vmm
Author: jhb Date: Fri Sep 9 20:30:36 2016 New Revision: 305673 URL: https://svnweb.freebsd.org/changeset/base/305673 Log: MFC 303713: Correct assertion on vcpuid argument to vm_gpa_hold(). PR: 208168 Modified: stable/10/sys/amd64/vmm/vmm.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/amd64/vmm/vmm.c Directory Properties: stable/11/ (props changed) Modified: stable/10/sys/amd64/vmm/vmm.c == --- stable/10/sys/amd64/vmm/vmm.c Fri Sep 9 19:57:32 2016 (r305672) +++ stable/10/sys/amd64/vmm/vmm.c Fri Sep 9 20:30:36 2016 (r305673) @@ -918,7 +918,7 @@ vm_gpa_hold(struct vm *vm, int vcpuid, v * guaranteed if at least one vcpu is in the VCPU_FROZEN state. */ int state; - KASSERT(vcpuid >= -1 || vcpuid < VM_MAXCPU, ("%s: invalid vcpuid %d", + KASSERT(vcpuid >= -1 && vcpuid < VM_MAXCPU, ("%s: invalid vcpuid %d", __func__, vcpuid)); for (i = 0; i < VM_MAXCPU; i++) { if (vcpuid != -1 && vcpuid != i) ___ svn-src-stable-10@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10 To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"
svn commit: r305672 - in stable: 10/sys/amd64/include 10/sys/i386/include 10/sys/x86/x86 10/sys/x86/xen 11/sys/amd64/include 11/sys/i386/include 11/sys/x86/x86 11/sys/x86/xen
Author: jhb Date: Fri Sep 9 19:57:32 2016 New Revision: 305672 URL: https://svnweb.freebsd.org/changeset/base/305672 Log: MFC 304637: Fix build for !SMP kernels after the Xen MSIX workaround. Move msix_disable_migration under #ifdef SMP since it doesn't make sense for !SMP kernels. PR: 212014 Modified: stable/10/sys/amd64/include/intr_machdep.h stable/10/sys/i386/include/intr_machdep.h stable/10/sys/x86/x86/msi.c stable/10/sys/x86/xen/hvm.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/amd64/include/intr_machdep.h stable/11/sys/i386/include/intr_machdep.h stable/11/sys/x86/x86/msi.c stable/11/sys/x86/xen/hvm.c Directory Properties: stable/11/ (props changed) Modified: stable/10/sys/amd64/include/intr_machdep.h == --- stable/10/sys/amd64/include/intr_machdep.h Fri Sep 9 19:13:02 2016 (r305671) +++ stable/10/sys/amd64/include/intr_machdep.h Fri Sep 9 19:57:32 2016 (r305672) @@ -143,8 +143,9 @@ struct nmi_pcpu { extern struct mtx icu_lock; extern int elcr_found; - +#ifdef SMP extern int msix_disable_migration; +#endif #ifndef DEV_ATPIC void atpic_reset(void); Modified: stable/10/sys/i386/include/intr_machdep.h == --- stable/10/sys/i386/include/intr_machdep.h Fri Sep 9 19:13:02 2016 (r305671) +++ stable/10/sys/i386/include/intr_machdep.h Fri Sep 9 19:57:32 2016 (r305672) @@ -140,8 +140,9 @@ struct trapframe; extern struct mtx icu_lock; extern int elcr_found; - +#ifdef SMP extern int msix_disable_migration; +#endif #ifndef DEV_ATPIC void atpic_reset(void); Modified: stable/10/sys/x86/x86/msi.c == --- stable/10/sys/x86/x86/msi.c Fri Sep 9 19:13:02 2016(r305671) +++ stable/10/sys/x86/x86/msi.c Fri Sep 9 19:57:32 2016(r305672) @@ -135,6 +135,7 @@ struct pic msi_pic = { msi_enable_source msi_source_pending, NULL, NULL, msi_config_intr, msi_assign_cpu }; +#ifdef SMP /** * Xen hypervisors prior to 4.6.0 do not properly handle updates to * enabled MSI-X table entries. Allow migration of MSI-X interrupts @@ -148,6 +149,7 @@ int msix_disable_migration = -1; SYSCTL_INT(_machdep, OID_AUTO, disable_msix_migration, CTLFLAG_RDTUN, _disable_migration, 0, "Disable migration of MSI-X interrupts between CPUs"); +#endif static int msi_enabled; static int msi_last_irq; @@ -227,8 +229,10 @@ msi_assign_cpu(struct intsrc *isrc, u_in if (msi->msi_first != msi) return (EINVAL); +#ifdef SMP if (msix_disable_migration && msi->msi_msix) return (EINVAL); +#endif /* Store information to free existing irq. */ old_vector = msi->msi_vector; @@ -302,10 +306,12 @@ msi_init(void) return; } +#ifdef SMP if (msix_disable_migration == -1) { /* The default is to allow migration of MSI-X interrupts. */ msix_disable_migration = 0; } +#endif msi_enabled = 1; intr_register_pic(_pic); Modified: stable/10/sys/x86/xen/hvm.c == --- stable/10/sys/x86/xen/hvm.c Fri Sep 9 19:13:02 2016(r305671) +++ stable/10/sys/x86/xen/hvm.c Fri Sep 9 19:57:32 2016(r305672) @@ -394,6 +394,7 @@ xen_hvm_init_hypercall_stubs(void) printf("XEN: Hypervisor version %d.%d detected.\n", major, minor); +#ifdef SMP if (((major < 4) || (major == 4 && minor <= 5)) && msix_disable_migration == -1) { /* @@ -408,6 +409,7 @@ xen_hvm_init_hypercall_stubs(void) "Set machdep.msix_disable_migration=0 to forcefully enable it.\n"); msix_disable_migration = 1; } +#endif } /* ___ svn-src-stable-10@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10 To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"
svn commit: r305649 - stable/10/usr.sbin/portsnap/portsnap
Author: delphij Date: Fri Sep 9 06:59:49 2016 New Revision: 305649 URL: https://svnweb.freebsd.org/changeset/base/305649 Log: MFC r305469: Ensure that we always open only files that is named by explicitly using shell redirections instead of having gzip(1) to decide what file to open. Issue reported in the "non-cryptanalytic attacks against freebsd update components" anonymous gist. Reviewed by: allanjude, emaste Modified: stable/10/usr.sbin/portsnap/portsnap/portsnap.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/portsnap/portsnap/portsnap.sh == --- stable/10/usr.sbin/portsnap/portsnap/portsnap.shFri Sep 9 06:59:01 2016(r305648) +++ stable/10/usr.sbin/portsnap/portsnap/portsnap.shFri Sep 9 06:59:49 2016(r305649) @@ -646,7 +646,7 @@ fetch_index_sanity() { # Verify a list of files fetch_snapshot_verify() { while read F; do - if [ "`gunzip -c snap/${F} | ${SHA256} -q`" != ${F} ]; then + if [ "`gunzip -c < snap/${F}.gz | ${SHA256} -q`" != ${F} ]; then echo "snapshot corrupt." return 1 fi @@ -681,7 +681,7 @@ fetch_snapshot() { cut -f 2 -d '|' tINDEX.new | fetch_snapshot_verify || return 1 # Extract the index rm -f INDEX.new - gunzip -c snap/`look INDEX tINDEX.new | + gunzip -c < snap/`look INDEX tINDEX.new | cut -f 2 -d '|'`.gz > INDEX.new fetch_index_sanity || return 1 # Verify the snapshot contents @@ -777,7 +777,7 @@ fetch_update() { # Extract the index echo -n "Extracting index... " 1>${QUIETREDIR} - gunzip -c files/`look INDEX tINDEX.new | + gunzip -c < files/`look INDEX tINDEX.new | cut -f 2 -d '|'`.gz > INDEX.new fetch_index_sanity || return 1 @@ -897,7 +897,7 @@ extract_make_index() { echo -n "$1 not provided by portsnap server; " echo "$2 not being generated." else - gunzip -c "${WORKDIR}/files/`look $1 ${WORKDIR}/tINDEX | + gunzip -c < "${WORKDIR}/files/`look $1 ${WORKDIR}/tINDEX | cut -f 2 -d '|'`.gz" | cat - ${LOCALDESC} | ${MKINDEX} /dev/stdin > ${PORTSDIR}/$2 ___ svn-src-stable-10@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10 To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"
svn commit: r305645 - stable/10/sys/dev/usb/input
Author: hselasky Date: Fri Sep 9 06:38:13 2016 New Revision: 305645 URL: https://svnweb.freebsd.org/changeset/base/305645 Log: MFC r304571: Make the UKBD USB transfers double buffered and set them up one by one, so they are memory independent which allows for handling panics triggered by the keyboard driver itself, typically via CTRL+ALT+ESC sequences. Or if the USB keyboard driver was processing a key at the moment of panic. Allow UKBD to be attached while keyboard polling is active. Modified: stable/10/sys/dev/usb/input/ukbd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/input/ukbd.c == --- stable/10/sys/dev/usb/input/ukbd.c Fri Sep 9 06:36:43 2016 (r305644) +++ stable/10/sys/dev/usb/input/ukbd.c Fri Sep 9 06:38:13 2016 (r305645) @@ -111,7 +111,7 @@ TUNABLE_INT("hw.usb.ukbd.pollrate", #defineUKBD_NMOD 8 /* units */ #defineUKBD_NKEYCODE 6 /* units */ #defineUKBD_IN_BUF_SIZE (2*(UKBD_NMOD + (2*UKBD_NKEYCODE))) /* bytes */ -#defineUKBD_IN_BUF_FULL (UKBD_IN_BUF_SIZE / 2)/* bytes */ +#defineUKBD_IN_BUF_FULL ((UKBD_IN_BUF_SIZE / 2) - 1) /* bytes */ #defineUKBD_NFKEY(sizeof(fkey_tab)/sizeof(fkey_tab[0])) /* units */ #defineUKBD_BUFFER_SIZE 64/* bytes */ @@ -132,7 +132,8 @@ struct ukbd_data { }; enum { - UKBD_INTR_DT, + UKBD_INTR_DT_0, + UKBD_INTR_DT_1, UKBD_CTRL_LED, UKBD_N_TRANSFER, }; @@ -481,7 +482,8 @@ ukbd_get_key(struct ukbd_softc *sc, uint if (sc->sc_inputs == 0 && (sc->sc_flags & UKBD_FLAG_GONE) == 0) { /* start transfer, if not already started */ - usbd_transfer_start(sc->sc_xfer[UKBD_INTR_DT]); + usbd_transfer_start(sc->sc_xfer[UKBD_INTR_DT_0]); + usbd_transfer_start(sc->sc_xfer[UKBD_INTR_DT_1]); } if (sc->sc_flags & UKBD_FLAG_POLLING) @@ -957,7 +959,16 @@ ukbd_set_leds_callback(struct usb_xfer * static const struct usb_config ukbd_config[UKBD_N_TRANSFER] = { - [UKBD_INTR_DT] = { + [UKBD_INTR_DT_0] = { + .type = UE_INTERRUPT, + .endpoint = UE_ADDR_ANY, + .direction = UE_DIR_IN, + .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, + .bufsize = 0, /* use wMaxPacketSize */ + .callback = _intr_callback, + }, + + [UKBD_INTR_DT_1] = { .type = UE_INTERRUPT, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, @@ -1204,9 +1215,26 @@ ukbd_attach(device_t dev) usb_callout_init_mtx(>sc_callout, , 0); +#ifdef UKBD_NO_POLLING err = usbd_transfer_setup(uaa->device, >info.bIfaceIndex, sc->sc_xfer, ukbd_config, UKBD_N_TRANSFER, sc, ); +#else + /* +* Setup the UKBD USB transfers one by one, so they are memory +* independent which allows for handling panics triggered by +* the keyboard driver itself, typically via CTRL+ALT+ESC +* sequences. Or if the USB keyboard driver was processing a +* key at the moment of panic. +*/ + for (n = 0; n != UKBD_N_TRANSFER; n++) { + err = usbd_transfer_setup(uaa->device, + >info.bIfaceIndex, sc->sc_xfer + n, ukbd_config + n, + 1, sc, ); + if (err) + break; + } +#endif if (err) { DPRINTF("error=%s\n", usbd_errstr(err)); @@ -1298,11 +1326,13 @@ ukbd_attach(device_t dev) rate = 1000 / rate; /* set new polling interval in ms */ - usbd_xfer_set_interval(sc->sc_xfer[UKBD_INTR_DT], rate); + usbd_xfer_set_interval(sc->sc_xfer[UKBD_INTR_DT_0], rate); + usbd_xfer_set_interval(sc->sc_xfer[UKBD_INTR_DT_1], rate); } #endif /* start the keyboard */ - usbd_transfer_start(sc->sc_xfer[UKBD_INTR_DT]); + usbd_transfer_start(sc->sc_xfer[UKBD_INTR_DT_0]); + usbd_transfer_start(sc->sc_xfer[UKBD_INTR_DT_1]); return (0); /* success */ @@ -1328,7 +1358,8 @@ ukbd_detach(device_t dev) /* kill any stuck keys */ if (sc->sc_flags & UKBD_FLAG_ATTACHED) { /* stop receiving events from the USB keyboard */ - usbd_transfer_stop(sc->sc_xfer[UKBD_INTR_DT]); + usbd_transfer_stop(sc->sc_xfer[UKBD_INTR_DT_0]); + usbd_transfer_stop(sc->sc_xfer[UKBD_INTR_DT_1]); /* release all leftover keys, if any */ memset(>sc_ndata, 0, sizeof(sc->sc_ndata)); @@ -1993,7 +2024,7 @@ ukbd_poll(keyboard_t *kbd, int on) */ if (on) sc->sc_polling++; -
svn commit: r305641 - stable/10/lib/libusb
Author: hselasky Date: Fri Sep 9 06:27:25 2016 New Revision: 305641 URL: https://svnweb.freebsd.org/changeset/base/305641 Log: MFC r305284: Fix array size issue when using the pre-scaling feature for ISOCHRONOUS USB transfers. Make sure enough length and buffer pointers are allocated when setting up the libusb transfer structure to support the maximum number of frames the kernel can handle. Modified: stable/10/lib/libusb/libusb20.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libusb/libusb20.c == --- stable/10/lib/libusb/libusb20.c Fri Sep 9 06:25:40 2016 (r305640) +++ stable/10/lib/libusb/libusb20.c Fri Sep 9 06:27:25 2016 (r305641) @@ -176,6 +176,12 @@ libusb20_tr_open_stream(struct libusb20_ return (LIBUSB20_ERROR_BUSY); if (MaxFrameCount & LIBUSB20_MAX_FRAME_PRE_SCALE) { MaxFrameCount &= ~LIBUSB20_MAX_FRAME_PRE_SCALE; + /* +* The kernel can setup 8 times more frames when +* pre-scaling ISOCHRONOUS transfers. Make sure the +* length and pointer buffers are big enough: +*/ + MaxFrameCount *= 8; pre_scale = 1; } else { pre_scale = 0; @@ -200,8 +206,13 @@ libusb20_tr_open_stream(struct libusb20_ } memset(xfer->ppBuffer, 0, size); - error = xfer->pdev->methods->tr_open(xfer, MaxBufSize, - MaxFrameCount, ep_no, stream_id, pre_scale); + if (pre_scale) { + error = xfer->pdev->methods->tr_open(xfer, MaxBufSize, + MaxFrameCount / 8, ep_no, stream_id, 1); + } else { + error = xfer->pdev->methods->tr_open(xfer, MaxBufSize, + MaxFrameCount, ep_no, stream_id, 0); + } if (error) { free(xfer->ppBuffer); ___ svn-src-stable-10@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10 To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"