svn commit: r272597 - head/sys/cam/ctl
Author: mav Date: Mon Oct 6 07:01:32 2014 New Revision: 272597 URL: https://svnweb.freebsd.org/changeset/base/272597 Log: Fix length of Extended INQUIRY Data VPD page. MFC after:3 days Modified: head/sys/cam/ctl/ctl.c Modified: head/sys/cam/ctl/ctl.c == --- head/sys/cam/ctl/ctl.c Mon Oct 6 06:20:35 2014(r272596) +++ head/sys/cam/ctl/ctl.c Mon Oct 6 07:01:32 2014(r272597) @@ -9912,9 +9912,7 @@ ctl_inquiry_evpd_eid(struct ctl_scsiio * lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - data_len = sizeof(struct scsi_vpd_mode_page_policy) + - sizeof(struct scsi_vpd_mode_page_policy_descr); - + data_len = sizeof(struct scsi_vpd_extended_inquiry_data); ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); eid_ptr = (struct scsi_vpd_extended_inquiry_data *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r272598 - in head: cddl/contrib/opensolaris/cmd/zdb sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys
Author: delphij Date: Mon Oct 6 07:03:17 2014 New Revision: 272598 URL: https://svnweb.freebsd.org/changeset/base/272598 Log: MFV r272585: Split the godfather zio into CPU number's to reduce lock contention. Illumos issue: 5176 lock contention on godfather zio MFC after:2 weeks Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c == --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Oct 6 07:01:32 2014 (r272597) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Oct 6 07:03:17 2014 (r272598) @@ -2594,10 +2594,12 @@ dump_block_stats(spa_t *spa) * all async I/Os to complete. */ if (dump_opt['c']) { - (void) zio_wait(spa->spa_async_zio_root); - spa->spa_async_zio_root = zio_root(spa, NULL, NULL, - ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE | - ZIO_FLAG_GODFATHER); + for (int i = 0; i < max_ncpus; i++) { + (void) zio_wait(spa->spa_async_zio_root[i]); + spa->spa_async_zio_root[i] = zio_root(spa, NULL, NULL, + ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE | + ZIO_FLAG_GODFATHER); + } } if (zcb.zcb_haderrors) { Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Mon Oct 6 07:01:32 2014(r272597) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Mon Oct 6 07:03:17 2014(r272598) @@ -1277,7 +1277,9 @@ spa_unload(spa_t *spa) * Wait for any outstanding async I/O to complete. */ if (spa->spa_async_zio_root != NULL) { - (void) zio_wait(spa->spa_async_zio_root); + for (int i = 0; i < max_ncpus; i++) + (void) zio_wait(spa->spa_async_zio_root[i]); + kmem_free(spa->spa_async_zio_root, max_ncpus * sizeof (void *)); spa->spa_async_zio_root = NULL; } @@ -2213,8 +2215,13 @@ spa_load_impl(spa_t *spa, uint64_t pool_ /* * Create "The Godfather" zio to hold all async IOs */ - spa->spa_async_zio_root = zio_root(spa, NULL, NULL, - ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE | ZIO_FLAG_GODFATHER); + spa->spa_async_zio_root = kmem_alloc(max_ncpus * sizeof (void *), + KM_SLEEP); + for (int i = 0; i < max_ncpus; i++) { + spa->spa_async_zio_root[i] = zio_root(spa, NULL, NULL, + ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE | + ZIO_FLAG_GODFATHER); + } /* * Parse the configuration into a vdev tree. We explicitly set the @@ -3567,8 +3574,13 @@ spa_create(const char *pool, nvlist_t *n /* * Create "The Godfather" zio to hold all async IOs */ - spa->spa_async_zio_root = zio_root(spa, NULL, NULL, - ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE | ZIO_FLAG_GODFATHER); + spa->spa_async_zio_root = kmem_alloc(max_ncpus * sizeof (void *), + KM_SLEEP); + for (int i = 0; i < max_ncpus; i++) { + spa->spa_async_zio_root[i] = zio_root(spa, NULL, NULL, + ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE | + ZIO_FLAG_GODFATHER); + } /* * Create the root vdev. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Mon Oct 6 07:01:32 2014(r272597) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Mon Oct 6 07:03:17 2014(r272598) @@ -206,7 +206,8 @@ struct spa { uint64_tspa_failmode; /* failure mode for the pool */ uint64_tspa_delegation; /* delegation on/off */ list_t spa_config_list;/* previous cache file(s) */ - zio_t *spa_async_zio_root;/* root of all async I/O */ + /* per-CPU array of root of async I/O: */ + zio_t **spa_async_zio_root; zio_t *spa_suspend_zio_root; /* root of all suspended I/O */ kmutex_tspa_suspend_lock; /* protects suspend_zio_root */ kcondvar_t spa_suspend_cv; /* notification of resume
svn commit: r272599 - head/cddl/contrib/opensolaris/cmd/zdb
Author: delphij Date: Mon Oct 6 07:09:47 2014 New Revision: 272599 URL: https://svnweb.freebsd.org/changeset/base/272599 Log: MFV r272588: Handle old format deadlist. Illumos issue: 5178 zdb -v on old-format pool fails in dump_deadlist() MFC after:2 weeks Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c == --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Oct 6 07:03:17 2014 (r272598) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Oct 6 07:09:47 2014 (r272599) @@ -1461,6 +1461,11 @@ dump_deadlist(dsl_deadlist_t *dl) if (dump_opt['d'] < 3) return; + if (dl->dl_oldfmt) { + dump_bpobj(&dl->dl_bpobj, "old-format deadlist", 0); + return; + } + zdb_nicenum(dl->dl_phys->dl_used, bytes); zdb_nicenum(dl->dl_phys->dl_comp, comp); zdb_nicenum(dl->dl_phys->dl_uncomp, uncomp); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r272600 - head/sys/fs/devfs
Author: mjg Date: Mon Oct 6 07:22:48 2014 New Revision: 272600 URL: https://svnweb.freebsd.org/changeset/base/272600 Log: devfs: tidy up after 272596 This moves a var to an if statement, no functional changes. MFC after:1 week Modified: head/sys/fs/devfs/devfs_vnops.c Modified: head/sys/fs/devfs/devfs_vnops.c == --- head/sys/fs/devfs/devfs_vnops.c Mon Oct 6 07:09:47 2014 (r272599) +++ head/sys/fs/devfs/devfs_vnops.c Mon Oct 6 07:22:48 2014 (r272600) @@ -545,8 +545,8 @@ devfs_close(struct vop_close_args *ap) * if the reference count is 2 (this last descriptor * plus the session), release the reference from the session. */ - oldvp = NULL; if (td && vp == td->td_proc->p_session->s_ttyvp) { + oldvp = NULL; sx_xlock(&proctree_lock); if (vp == td->td_proc->p_session->s_ttyvp) { SESS_LOCK(td->td_proc->p_session); @@ -561,9 +561,9 @@ devfs_close(struct vop_close_args *ap) SESS_UNLOCK(td->td_proc->p_session); } sx_xunlock(&proctree_lock); + if (oldvp != NULL) + vrele(oldvp); } - if (oldvp != NULL) - vrele(oldvp); /* * We do not want to really close the device if it * is still in use unless we are trying to close it ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r272601 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: delphij Date: Mon Oct 6 07:29:17 2014 New Revision: 272601 URL: https://svnweb.freebsd.org/changeset/base/272601 Log: MFV r272591: Use loaned ARC buffer for zfs receive to avoid copy. Illumos issue: 5162 zfs recv should use loaned arc buffer to avoid copy MFC after:2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Mon Oct 6 07:22:48 2014(r272600) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Mon Oct 6 07:29:17 2014(r272601) @@ -1332,7 +1332,14 @@ dmu_assign_arcbuf(dmu_buf_t *handle, uin rw_exit(&dn->dn_struct_rwlock); DB_DNODE_EXIT(dbuf); - if (offset == db->db.db_offset && blksz == db->db.db_size) { + /* +* We can only assign if the offset is aligned, the arc buf is the +* same size as the dbuf, and the dbuf is not metadata. It +* can't be metadata because the loaned arc buf comes from the +* user-data kmem arena. +*/ + if (offset == db->db.db_offset && blksz == db->db.db_size && + DBUF_GET_BUFC_TYPE(db) == ARC_BUFC_DATA) { dbuf_assign_arcbuf(db, buf, tx); dbuf_rele(db, FTAG); } else { Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Mon Oct 6 07:22:48 2014(r272600) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Mon Oct 6 07:29:17 2014(r272601) @@ -1273,18 +1273,20 @@ restore_bytes(struct restorearg *ra, voi } static void * -restore_read(struct restorearg *ra, int len) +restore_read(struct restorearg *ra, int len, char *buf) { - void *rv; int done = 0; + if (buf == NULL) + buf = ra->buf; + /* some things will require 8-byte alignment, so everything must */ ASSERT0(len % 8); while (done < len) { ssize_t resid; - ra->err = restore_bytes(ra, (caddr_t)ra->buf + done, + ra->err = restore_bytes(ra, buf + done, len - done, ra->voff, &resid); if (resid == len - done) @@ -1296,12 +1298,11 @@ restore_read(struct restorearg *ra, int } ASSERT3U(done, ==, len); - rv = ra->buf; if (ra->byteswap) - fletcher_4_incremental_byteswap(rv, len, &ra->cksum); + fletcher_4_incremental_byteswap(buf, len, &ra->cksum); else - fletcher_4_incremental_native(rv, len, &ra->cksum); - return (rv); + fletcher_4_incremental_native(buf, len, &ra->cksum); + return (buf); } static void @@ -1416,7 +1417,7 @@ restore_object(struct restorearg *ra, ob return (SET_ERROR(EINVAL)); if (drro->drr_bonuslen) { - data = restore_read(ra, P2ROUNDUP(drro->drr_bonuslen, 8)); + data = restore_read(ra, P2ROUNDUP(drro->drr_bonuslen, 8), NULL); if (ra->err != 0) return (ra->err); } @@ -1513,19 +1514,30 @@ restore_write(struct restorearg *ra, obj !DMU_OT_IS_VALID(drrw->drr_type)) return (SET_ERROR(EINVAL)); - data = restore_read(ra, drrw->drr_length); - if (data == NULL) - return (ra->err); - if (dmu_object_info(os, drrw->drr_object, NULL) != 0) return (SET_ERROR(EINVAL)); + dmu_buf_t *bonus; + if (dmu_bonus_hold(os, drrw->drr_object, FTAG, &bonus) != 0) + return (SET_ERROR(EINVAL)); + + arc_buf_t *abuf = dmu_request_arcbuf(bonus, drrw->drr_length); + + data = restore_read(ra, drrw->drr_length, abuf->b_data); + if (data == NULL) { + dmu_return_arcbuf(abuf); + dmu_buf_rele(bonus, FTAG); + return (ra->err); + } + tx = dmu_tx_create(os); dmu_tx_hold_write(tx, drrw->drr_object, drrw->drr_offset, drrw->drr_length); err = dmu_tx_assign(tx, TXG_WAIT); if (err != 0) { + dmu_return_arcbuf(abuf); + dmu_buf_rele(bonus, FTAG); dmu_tx_abort(tx); return (err); } @@ -1534,9 +1546,9 @@ restore_write(struct restorearg *ra, obj DMU_OT_BYTESWAP(drrw->drr_type); dmu_ot_byteswap[byteswap].ob_func(data, drrw->drr_length); } - dmu_write(os, drrw->drr_object, - drrw->drr_offset, drrw->drr_length
svn commit: r272602 - head/sys/dev/uart
Author: ganbold Date: Mon Oct 6 09:00:53 2014 New Revision: 272602 URL: https://svnweb.freebsd.org/changeset/base/272602 Log: Use documented compat string for msm uart. Whilst here use tab instead of spaces. Approved by:stas (mentor) Modified: head/sys/dev/uart/uart_bus_fdt.c Modified: head/sys/dev/uart/uart_bus_fdt.c == --- head/sys/dev/uart/uart_bus_fdt.cMon Oct 6 07:29:17 2014 (r272601) +++ head/sys/dev/uart/uart_bus_fdt.cMon Oct 6 09:00:53 2014 (r272602) @@ -84,7 +84,7 @@ static struct ofw_compat_data compat_dat {"fsl,imx21-uart", (uintptr_t)&uart_imx_class}, {"fsl,mvf600-uart", (uintptr_t)&uart_vybrid_class}, {"lpc,uart",(uintptr_t)&uart_lpc_class}, -{"qcom,uart-dm",(uintptr_t)&uart_msm_class}, + {"qcom,msm-uartdm", (uintptr_t)&uart_msm_class}, {"ti,ns16550", (uintptr_t)&uart_ti8250_class}, {"ns16550", (uintptr_t)&uart_ns8250_class}, {NULL, (uintptr_t)NULL}, ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r272605 - head/sys/conf
Author: andrew Date: Mon Oct 6 09:52:28 2014 New Revision: 272605 URL: https://svnweb.freebsd.org/changeset/base/272605 Log: Disable generating vfp and NEON instructions in the arm kernel. Modified: head/sys/conf/Makefile.arm Modified: head/sys/conf/Makefile.arm == --- head/sys/conf/Makefile.arm Mon Oct 6 09:46:21 2014(r272604) +++ head/sys/conf/Makefile.arm Mon Oct 6 09:52:28 2014(r272605) @@ -42,6 +42,9 @@ STRIP_FLAGS = -S # We don't support gcc's thump interwork stuff, so disable it CFLAGS.gcc += -mno-thumb-interwork +# We generally don't want fpu instructions in the kernel. +CFLAGS.clang += -mfpu=none + .if !empty(DDB_ENABLED) CFLAGS += -funwind-tables # clang requires us to tell it to emit assembly with unwind information ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r272606 - head/sys/dev/ahci
Author: mav Date: Mon Oct 6 10:58:54 2014 New Revision: 272606 URL: https://svnweb.freebsd.org/changeset/base/272606 Log: Use r271207 optimization only for MSI-enabled HBAs. It was found that VirtualBox' AHCI does not allow nterrupt to be cleared before the interrupt status register is read, causing interrupt storm. AHCI specification allows to skip this register use when multi-vector MSI is enabled and so interrupting port is known. For single-vector MSI that is not stated explicitly, but if the port is only one, it is obviously known too. Modified: head/sys/dev/ahci/ahci.c Modified: head/sys/dev/ahci/ahci.c == --- head/sys/dev/ahci/ahci.cMon Oct 6 09:52:28 2014(r272605) +++ head/sys/dev/ahci/ahci.cMon Oct 6 10:58:54 2014(r272606) @@ -360,7 +360,7 @@ ahci_setup_interrupt(device_t dev) for (i = 0; i < ctlr->numirqs; i++) { ctlr->irqs[i].ctlr = ctlr; ctlr->irqs[i].r_irq_rid = i + (ctlr->msi ? 1 : 0); - if (ctlr->channels == 1 && !ctlr->ccc) + if (ctlr->channels == 1 && !ctlr->ccc && ctlr->msi) ctlr->irqs[i].mode = AHCI_IRQ_MODE_ONE; else if (ctlr->numirqs == 1 || i >= ctlr->channels || (ctlr->ccc && i == ctlr->cccv)) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r272607 - head/sbin/ipfw
Author: melifaro Date: Mon Oct 6 11:00:47 2014 New Revision: 272607 URL: https://svnweb.freebsd.org/changeset/base/272607 Log: Improve "reserved keywords" hack: we can't easily predict (in current parsing model) if the keyword is ipfw(8) reserved keyword or port name. Checking proto database via getprotobyname() consumes a lot of CPU and leads to tens of seconds for parsing large ruleset. Use list of reserved keywords and check them as pre-requisite before doing getprotobyname(). Obtained from:Yandex LLC Modified: head/sbin/ipfw/ipfw2.c Modified: head/sbin/ipfw/ipfw2.c == --- head/sbin/ipfw/ipfw2.c Mon Oct 6 10:58:54 2014(r272606) +++ head/sbin/ipfw/ipfw2.c Mon Oct 6 11:00:47 2014(r272607) @@ -2904,13 +2904,34 @@ add_dstip(ipfw_insn *cmd, char *av, int return cmd; } +static struct _s_x f_reserved_keywords[] = { + { "altq", TOK_OR }, + { "//", TOK_OR }, + { "diverted", TOK_OR }, + { "dst-port", TOK_OR }, + { "src-port", TOK_OR }, + { "established",TOK_OR }, + { "keep-state", TOK_OR }, + { "frag", TOK_OR }, + { "icmptypes", TOK_OR }, + { "in", TOK_OR }, + { "out",TOK_OR }, + { "ip6",TOK_OR }, + { "any",TOK_OR }, + { "to", TOK_OR }, + { "via",TOK_OR }, + { "{", TOK_OR }, + { NULL, 0 } /* terminator */ +}; + static ipfw_insn * add_ports(ipfw_insn *cmd, char *av, u_char proto, int opcode, int cblen) { - /* XXX "any" is trapped before. Perhaps "to" */ - if (_substrcmp(av, "any") == 0) { - return NULL; - } else if (fill_newports((ipfw_insn_u16 *)cmd, av, proto, cblen)) { + + if (match_token(f_reserved_keywords, av) != -1) + return (NULL); + + if (fill_newports((ipfw_insn_u16 *)cmd, av, proto, cblen)) { /* XXX todo: check that we have a protocol with ports */ cmd->opcode = opcode; return cmd; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r272609 - head/sys/netpfil/ipfw
Author: melifaro Date: Mon Oct 6 11:15:11 2014 New Revision: 272609 URL: https://svnweb.freebsd.org/changeset/base/272609 Log: Fix O_TCPOPTS processing. Obtained from:luigi Modified: head/sys/netpfil/ipfw/ip_fw2.c Modified: head/sys/netpfil/ipfw/ip_fw2.c == --- head/sys/netpfil/ipfw/ip_fw2.c Mon Oct 6 11:05:56 2014 (r272608) +++ head/sys/netpfil/ipfw/ip_fw2.c Mon Oct 6 11:15:11 2014 (r272609) @@ -1722,9 +1722,13 @@ do { \ break; case O_TCPOPTS: - PULLUP_LEN(hlen, ulp, (TCP(ulp)->th_off << 2)); - match = (proto == IPPROTO_TCP && offset == 0 && - tcpopts_match(TCP(ulp), cmd)); + if (proto == IPPROTO_TCP && ulp != NULL) { + PULLUP_LEN(hlen, ulp, + (TCP(ulp)->th_off << 2)); + match = (proto == IPPROTO_TCP && + offset == 0 && + tcpopts_match(TCP(ulp), cmd)); + } break; case O_TCPSEQ: ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r272613 - head/sys/cam/ctl
Author: mav Date: Mon Oct 6 12:20:46 2014 New Revision: 272613 URL: https://svnweb.freebsd.org/changeset/base/272613 Log: Add support for MaxBurstLength and Expected Data transfer Length parameters. Before this change target could send R2T request for write transfer of any size, that could violate iSCSI RFC, which allows initiator to limit maximum R2T size by negotiating MaxBurstLength connection parameter. Also report an error in case of write underflow, when initiator provides less data than initiator expects. Previously in such case our target sent R2T request for non-existing data, violating the RFC, and confusing some initiators. SCSI specs don't explicitly define how write underflows should be handled and there are different oppinions, but reporting error is hopefully better then violating iSCSI RFC with unpredictable results. MFC after:2 weeks Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c head/sys/cam/ctl/ctl_frontend_iscsi.h Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c == --- head/sys/cam/ctl/ctl_frontend_iscsi.c Mon Oct 6 12:08:47 2014 (r272612) +++ head/sys/cam/ctl/ctl_frontend_iscsi.c Mon Oct 6 12:20:46 2014 (r272613) @@ -154,6 +154,8 @@ static uint32_t cfiscsi_lun_map(void *ar static int cfiscsi_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td); static voidcfiscsi_datamove(union ctl_io *io); +static voidcfiscsi_datamove_in(union ctl_io *io); +static voidcfiscsi_datamove_out(union ctl_io *io); static voidcfiscsi_done(union ctl_io *io); static boolcfiscsi_pdu_update_cmdsn(const struct icl_pdu *request); static voidcfiscsi_pdu_handle_nop_out(struct icl_pdu *request); @@ -824,7 +826,7 @@ cfiscsi_handle_data_segment(struct icl_p return (true); } - if (io->scsiio.ext_data_filled == io->scsiio.kern_data_len && + if (io->scsiio.ext_data_filled == cdw->cdw_r2t_end && (bhsdo->bhsdo_flags & BHSDO_FLAGS_F) == 0) { CFISCSI_SESSION_WARN(cs, "got the final packet without " "the F flag; flags = 0x%x; dropping connection", @@ -834,7 +836,7 @@ cfiscsi_handle_data_segment(struct icl_p return (true); } - if (io->scsiio.ext_data_filled != io->scsiio.kern_data_len && + if (io->scsiio.ext_data_filled != cdw->cdw_r2t_end && (bhsdo->bhsdo_flags & BHSDO_FLAGS_F) != 0) { if ((request->ip_bhs->bhs_opcode & ~ISCSI_BHS_OPCODE_IMMEDIATE) == ISCSI_BHS_OPCODE_SCSI_DATA_OUT) { @@ -842,7 +844,7 @@ cfiscsi_handle_data_segment(struct icl_p "transmitted size was %zd bytes instead of %d; " "dropping connection", (size_t)io->scsiio.ext_data_filled, - io->scsiio.kern_data_len); + cdw->cdw_r2t_end); ctl_set_data_phase_error(&io->scsiio); cfiscsi_session_terminate(cs); return (true); @@ -855,7 +857,7 @@ cfiscsi_handle_data_segment(struct icl_p } } - if (io->scsiio.ext_data_filled == io->scsiio.kern_data_len) { + if (io->scsiio.ext_data_filled == cdw->cdw_r2t_end) { #if 0 CFISCSI_SESSION_DEBUG(cs, "no longer expecting Data-Out with target " "transfer tag 0x%x", cdw->cdw_target_transfer_tag); @@ -911,8 +913,13 @@ cfiscsi_pdu_handle_data_out(struct icl_p CFISCSI_SESSION_LOCK(cs); TAILQ_REMOVE(&cs->cs_waiting_for_data_out, cdw, cdw_next); CFISCSI_SESSION_UNLOCK(cs); + done = (io->scsiio.ext_data_filled != cdw->cdw_r2t_end || + io->scsiio.ext_data_filled == io->scsiio.kern_data_len); uma_zfree(cfiscsi_data_wait_zone, cdw); - io->scsiio.be_move_done(io); + if (done) + io->scsiio.be_move_done(io); + else + cfiscsi_datamove_out(io); } icl_pdu_free(request); @@ -2567,6 +2574,8 @@ cfiscsi_datamove_out(union ctl_io *io) const struct iscsi_bhs_scsi_command *bhssc; struct iscsi_bhs_r2t *bhsr2t; struct cfiscsi_data_wait *cdw; + struct ctl_sg_entry ctl_sg_entry, *ctl_sglist; + uint32_t expected_len, r2t_off, r2t_len; uint32_t target_transfer_tag; bool done; @@ -2585,9 +2594,16 @@ cfiscsi_datamove_out(union ctl_io *io) PDU_TOTAL_TRANSFER_LEN(request) = io->scsiio.kern_total_len; /* -* We hadn't received anything during this datamove yet. +* Report write underflow as error since CTL and backends don't +* really support it, and SCSI does not tell how to do it right. */
svn commit: r272614 - head/sys/netpfil/ipfw
Author: melifaro Date: Mon Oct 6 12:29:06 2014 New Revision: 272614 URL: https://svnweb.freebsd.org/changeset/base/272614 Log: Improve r272609 (O_TCPOPTS). MFC after:3 dayes Modified: head/sys/netpfil/ipfw/ip_fw2.c Modified: head/sys/netpfil/ipfw/ip_fw2.c == --- head/sys/netpfil/ipfw/ip_fw2.c Mon Oct 6 12:20:46 2014 (r272613) +++ head/sys/netpfil/ipfw/ip_fw2.c Mon Oct 6 12:29:06 2014 (r272614) @@ -1722,12 +1722,10 @@ do { \ break; case O_TCPOPTS: - if (proto == IPPROTO_TCP && ulp != NULL) { + if (proto == IPPROTO_TCP && offset == 0 && ulp){ PULLUP_LEN(hlen, ulp, (TCP(ulp)->th_off << 2)); - match = (proto == IPPROTO_TCP && - offset == 0 && - tcpopts_match(TCP(ulp), cmd)); + match = tcpopts_match(TCP(ulp), cmd); } break; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r272649 - head/contrib/byacc
Author: rodrigc Date: Mon Oct 6 14:43:02 2014 New Revision: 272649 URL: https://svnweb.freebsd.org/changeset/base/272649 Log: MFV: use calloc in get_line() when allocating line to ensure it is fully initialized, fixes a later uninitialized value in copy_param() (FreeBSD #193499). PR: 193499 Submitted by: Thomas E. Dickey Modified: head/contrib/byacc/CHANGES head/contrib/byacc/defs.h head/contrib/byacc/reader.c Modified: head/contrib/byacc/CHANGES == --- head/contrib/byacc/CHANGES Mon Oct 6 14:39:45 2014(r272648) +++ head/contrib/byacc/CHANGES Mon Oct 6 14:43:02 2014(r272649) @@ -1,3 +1,9 @@ +2014-10-02 Thomas E. Dickey + + * reader.c, defs.h: + use calloc in get_line() when allocating line to ensure it is fully initialized, + fixes a later uninitialized value in copy_param() (FreeBSD #193499). + 2014-07-15 Thomas E. Dickey * aclocal.m4: resync with my-autoconf (no change to configure script) Modified: head/contrib/byacc/defs.h == --- head/contrib/byacc/defs.h Mon Oct 6 14:39:45 2014(r272648) +++ head/contrib/byacc/defs.h Mon Oct 6 14:43:02 2014(r272649) @@ -157,6 +157,7 @@ #define CALLOC(k,n)(calloc((size_t)(k),(size_t)(n))) #defineFREE(x) (free((char*)(x))) #define MALLOC(n) (malloc((size_t)(n))) +#define TCMALLOC(t,n) ((t*) calloc((size_t)(n), sizeof(t))) #define TMALLOC(t,n) ((t*) malloc((size_t)(n) * sizeof(t))) #defineNEW(t) ((t*)allocate(sizeof(t))) #defineNEW2(n,t) ((t*)allocate(((size_t)(n)*sizeof(t Modified: head/contrib/byacc/reader.c == --- head/contrib/byacc/reader.c Mon Oct 6 14:39:45 2014(r272648) +++ head/contrib/byacc/reader.c Mon Oct 6 14:43:02 2014(r272649) @@ -125,7 +125,7 @@ get_line(void) if (line) FREE(line); linesize = LINESIZE + 1; - line = TMALLOC(char, linesize); + line = TCMALLOC(char, linesize); NO_SPACE(line); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r272649 - head/contrib/byacc
On Mon, Oct 06, 2014 at 02:43:02PM +, Craig Rodrigues wrote: > Author: rodrigc > Date: Mon Oct 6 14:43:02 2014 > New Revision: 272649 > URL: https://svnweb.freebsd.org/changeset/base/272649 > > Log: > MFV: >use calloc in get_line() when allocating line to ensure it is fully > initialized, >fixes a later uninitialized value in copy_param() (FreeBSD #193499). > > PR: 193499 > Submitted by: Thomas E. Dickey > Why a direct commit instead of a proper import of 20141005 version? it would have imho been better, simpler and easier to maintain. regards, Bapt pgpcA9Zye0Zq3.pgp Description: PGP signature
svn commit: r272650 - head/sys/cam/ctl
Author: mav Date: Mon Oct 6 14:52:04 2014 New Revision: 272650 URL: https://svnweb.freebsd.org/changeset/base/272650 Log: Set CAM_SIM_QUEUED flag before calling ctl_queue() to avoid race. PR: 194128 Submitted by: Scott M. Ferris MFC after:3 days Sponsored by: EMC/Isilon Storage Division Modified: head/sys/cam/ctl/ctl_frontend_cam_sim.c Modified: head/sys/cam/ctl/ctl_frontend_cam_sim.c == --- head/sys/cam/ctl/ctl_frontend_cam_sim.c Mon Oct 6 14:43:02 2014 (r272649) +++ head/sys/cam/ctl/ctl_frontend_cam_sim.c Mon Oct 6 14:52:04 2014 (r272650) @@ -609,14 +609,16 @@ cfcs_action(struct cam_sim *sim, union c bcopy(csio->cdb_io.cdb_bytes, io->scsiio.cdb, io->scsiio.cdb_len); + ccb->ccb_h.status |= CAM_SIM_QUEUED; err = ctl_queue(io); if (err != CTL_RETVAL_COMPLETE) { printf("%s: func %d: error %d returned by " "ctl_queue()!\n", __func__, ccb->ccb_h.func_code, err); ctl_free_io(io); - } else { - ccb->ccb_h.status |= CAM_SIM_QUEUED; + ccb->ccb_h.status = CAM_REQ_INVALID; + xpt_done(ccb); + return; } break; } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r272653 - head/contrib/tcpdump
Author: luigi Date: Mon Oct 6 15:03:08 2014 New Revision: 272653 URL: https://svnweb.freebsd.org/changeset/base/272653 Log: Fix comment and sort rights by name MFC after:3 days Modified: head/contrib/tcpdump/tcpdump.c Modified: head/contrib/tcpdump/tcpdump.c == --- head/contrib/tcpdump/tcpdump.c Mon Oct 6 14:57:26 2014 (r272652) +++ head/contrib/tcpdump/tcpdump.c Mon Oct 6 15:03:08 2014 (r272653) @@ -1534,11 +1534,11 @@ main(int argc, char **argv) static const unsigned long cmds[] = { BIOCGSTATS }; /* -* the various libpcap devices use a combination of -* read (bpf), ioctl (bpf, netmap), poll (netmap) -* so we add the relevant access rights. +* The various libpcap devices use a combination of +* read (bpf), ioctl (bpf, netmap), poll (netmap). +* Grant the relevant access rights, sorted by name. */ - cap_rights_init(&rights, CAP_IOCTL, CAP_READ, CAP_EVENT); + cap_rights_init(&rights, CAP_EVENT, CAP_IOCTL, CAP_READ); if (cap_rights_limit(pcap_fileno(pd), &rights) < 0 && errno != ENOSYS) { error("unable to limit pcap descriptor"); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r272655 - in head/contrib/byacc: . package package/debian package/pkgsrc test test/btyacc test/yacc
Author: bapt Date: Mon Oct 6 15:12:59 2014 New Revision: 272655 URL: https://svnweb.freebsd.org/changeset/base/272655 Log: Import byacc 20141005 from vendor Added: head/contrib/byacc/test/btyacc/btyacc_demo2.error - copied unchanged from r272652, vendor/byacc/dist/test/btyacc/btyacc_demo2.error head/contrib/byacc/test/btyacc/btyacc_demo2.output - copied unchanged from r272652, vendor/byacc/dist/test/btyacc/btyacc_demo2.output head/contrib/byacc/test/btyacc/btyacc_demo2.tab.c - copied unchanged from r272652, vendor/byacc/dist/test/btyacc/btyacc_demo2.tab.c head/contrib/byacc/test/btyacc/btyacc_demo2.tab.h - copied unchanged from r272652, vendor/byacc/dist/test/btyacc/btyacc_demo2.tab.h head/contrib/byacc/test/btyacc/btyacc_destroy1.error - copied unchanged from r272652, vendor/byacc/dist/test/btyacc/btyacc_destroy1.error head/contrib/byacc/test/btyacc/btyacc_destroy1.output - copied unchanged from r272652, vendor/byacc/dist/test/btyacc/btyacc_destroy1.output head/contrib/byacc/test/btyacc/btyacc_destroy1.tab.c - copied unchanged from r272652, vendor/byacc/dist/test/btyacc/btyacc_destroy1.tab.c head/contrib/byacc/test/btyacc/btyacc_destroy1.tab.h - copied unchanged from r272652, vendor/byacc/dist/test/btyacc/btyacc_destroy1.tab.h head/contrib/byacc/test/btyacc/btyacc_destroy2.error - copied unchanged from r272652, vendor/byacc/dist/test/btyacc/btyacc_destroy2.error head/contrib/byacc/test/btyacc/btyacc_destroy2.output - copied unchanged from r272652, vendor/byacc/dist/test/btyacc/btyacc_destroy2.output head/contrib/byacc/test/btyacc/btyacc_destroy2.tab.c - copied unchanged from r272652, vendor/byacc/dist/test/btyacc/btyacc_destroy2.tab.c head/contrib/byacc/test/btyacc/btyacc_destroy2.tab.h - copied unchanged from r272652, vendor/byacc/dist/test/btyacc/btyacc_destroy2.tab.h head/contrib/byacc/test/btyacc/btyacc_destroy3.error - copied unchanged from r272652, vendor/byacc/dist/test/btyacc/btyacc_destroy3.error head/contrib/byacc/test/btyacc/btyacc_destroy3.output - copied unchanged from r272652, vendor/byacc/dist/test/btyacc/btyacc_destroy3.output head/contrib/byacc/test/btyacc/btyacc_destroy3.tab.c - copied unchanged from r272652, vendor/byacc/dist/test/btyacc/btyacc_destroy3.tab.c head/contrib/byacc/test/btyacc/btyacc_destroy3.tab.h - copied unchanged from r272652, vendor/byacc/dist/test/btyacc/btyacc_destroy3.tab.h head/contrib/byacc/test/btyacc_destroy1.y - copied unchanged from r272652, vendor/byacc/dist/test/btyacc_destroy1.y head/contrib/byacc/test/btyacc_destroy2.y - copied unchanged from r272652, vendor/byacc/dist/test/btyacc_destroy2.y head/contrib/byacc/test/btyacc_destroy3.y - copied unchanged from r272652, vendor/byacc/dist/test/btyacc_destroy3.y Modified: head/contrib/byacc/CHANGES head/contrib/byacc/MANIFEST head/contrib/byacc/VERSION head/contrib/byacc/aclocal.m4 head/contrib/byacc/btyaccpar.c head/contrib/byacc/closure.c head/contrib/byacc/config.sub head/contrib/byacc/configure head/contrib/byacc/defs.h head/contrib/byacc/lalr.c head/contrib/byacc/main.c head/contrib/byacc/output.c head/contrib/byacc/package/byacc.spec head/contrib/byacc/package/debian/changelog head/contrib/byacc/package/mingw-byacc.spec head/contrib/byacc/package/pkgsrc/Makefile head/contrib/byacc/reader.c head/contrib/byacc/test/btyacc/btyacc_calc1.tab.c head/contrib/byacc/test/btyacc/btyacc_demo.tab.c head/contrib/byacc/test/btyacc/calc.tab.c head/contrib/byacc/test/btyacc/calc1.tab.c head/contrib/byacc/test/btyacc/calc2.tab.c head/contrib/byacc/test/btyacc/calc3.tab.c head/contrib/byacc/test/btyacc/code_calc.code.c head/contrib/byacc/test/btyacc/code_calc.tab.c head/contrib/byacc/test/btyacc/code_error.code.c head/contrib/byacc/test/btyacc/code_error.tab.c head/contrib/byacc/test/btyacc/empty.tab.c head/contrib/byacc/test/btyacc/err_inherit1.tab.c head/contrib/byacc/test/btyacc/err_inherit2.tab.c head/contrib/byacc/test/btyacc/err_inherit3.tab.c head/contrib/byacc/test/btyacc/err_inherit4.tab.c head/contrib/byacc/test/btyacc/err_inherit5.tab.c head/contrib/byacc/test/btyacc/err_syntax1.tab.c head/contrib/byacc/test/btyacc/err_syntax10.tab.c head/contrib/byacc/test/btyacc/err_syntax11.tab.c head/contrib/byacc/test/btyacc/err_syntax12.tab.c head/contrib/byacc/test/btyacc/err_syntax13.tab.c head/contrib/byacc/test/btyacc/err_syntax14.tab.c head/contrib/byacc/test/btyacc/err_syntax15.tab.c head/contrib/byacc/test/btyacc/err_syntax16.tab.c head/contrib/byacc/test/btyacc/err_syntax17.tab.c head/contrib/byacc/test/btyacc/err_syntax18.tab.c head/contrib/byacc/test/btyacc/err_syntax19.tab.c head/contrib/byacc/test/btyacc/err_syntax2.tab.c head/contrib/byacc/test/btyacc/err_syntax20.tab.c head/contrib/byacc/test/btyacc/err_syntax21.tab.c head/contrib/byacc/test/btyacc/err_syntax22.tab.
svn commit: r272658 - head/sys/i386/i386
Author: jhb Date: Mon Oct 6 15:43:57 2014 New Revision: 272658 URL: https://svnweb.freebsd.org/changeset/base/272658 Log: Call initializecpucache() on the BSP for i386 in the !XEN case. This was my bug in r271409 that I noticed while reviewing r272492. Modified: head/sys/i386/i386/machdep.c Modified: head/sys/i386/i386/machdep.c == --- head/sys/i386/i386/machdep.cMon Oct 6 15:24:04 2014 (r272657) +++ head/sys/i386/i386/machdep.cMon Oct 6 15:43:57 2014 (r272658) @@ -3326,9 +3326,7 @@ init386(first) setidt(IDT_GP, &IDTVEC(prot), SDT_SYS386TGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); initializecpu();/* Initialize CPU registers */ -#ifdef PC98 initializecpucache(); -#endif /* make an initial tss so cpu can get interrupt stack on syscall! */ /* Note: -16 is so we can grow the trapframe if we came from vm86 */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r272659 - in head: contrib/libpcap lib/libpcap
Author: luigi Date: Mon Oct 6 15:48:28 2014 New Revision: 272659 URL: https://svnweb.freebsd.org/changeset/base/272659 Log: Add netmap support to libpcap. Tcpdump and other native pcap application can now run directly on netmap ports using netmap:foo or valeXX:YY device names. Modifications to existing code are small and trivial, the netmap-specific code is all in a new file. Please be aware that in netmap mode the physical interface is disconnected from the host stack, so libpcap will steal the traffic not just make a copy. For the full version of the code (including linux and autotools support) see https://code.google.com/p/netmap-libpcap/ MFC after:3 days Added: head/lib/libpcap/pcap-netmap.c (contents, props changed) Modified: head/contrib/libpcap/inet.c head/contrib/libpcap/pcap.c head/lib/libpcap/Makefile head/lib/libpcap/config.h Modified: head/contrib/libpcap/inet.c == --- head/contrib/libpcap/inet.c Mon Oct 6 15:43:57 2014(r272658) +++ head/contrib/libpcap/inet.c Mon Oct 6 15:48:28 2014(r272659) @@ -737,6 +737,10 @@ pcap_lookupnet(device, netp, maskp, errb #ifdef PCAP_SUPPORT_USB || strstr(device, "usbmon") != NULL #endif +#ifdef PCAP_SUPPORT_NETMAP + || !strncmp(device, "netmap:", 7) + || !strncmp(device, "vale", 4) +#endif #ifdef HAVE_SNF_API || strstr(device, "snf") != NULL #endif Modified: head/contrib/libpcap/pcap.c == --- head/contrib/libpcap/pcap.c Mon Oct 6 15:43:57 2014(r272658) +++ head/contrib/libpcap/pcap.c Mon Oct 6 15:48:28 2014(r272659) @@ -106,6 +106,10 @@ static const char rcsid[] _U_ = #include "pcap-netfilter-linux.h" #endif +#ifdef PCAP_SUPPORT_NETMAP +pcap_t* pcap_netmap_create(const char *device, char *ebuf, int *is_ours); +#endif + int pcap_not_initialized(pcap_t *pcap) { @@ -301,6 +305,9 @@ struct capture_source_type { int (*findalldevs_op)(pcap_if_t **, char *); pcap_t *(*create_op)(const char *, char *, int *); } capture_source_types[] = { +#ifdef PCAP_SUPPORT_NETMAP + { NULL, pcap_netmap_create }, +#endif #ifdef HAVE_DAG_API { dag_findalldevs, dag_create }, #endif Modified: head/lib/libpcap/Makefile == --- head/lib/libpcap/Makefile Mon Oct 6 15:43:57 2014(r272658) +++ head/lib/libpcap/Makefile Mon Oct 6 15:48:28 2014(r272659) @@ -7,6 +7,7 @@ SHLIBDIR?= /lib LIB= pcap SRCS= grammar.y tokdefs.h version.h pcap-bpf.c \ + pcap-netmap.c \ pcap.c pcap-common.c inet.c fad-getad.c gencode.c optimize.c nametoaddr.c \ etherent.c savefile.c bpf_filter.c bpf_image.c bpf_dump.c \ scanner.l sf-pcap.c sf-pcap-ng.c version.c Modified: head/lib/libpcap/config.h == --- head/lib/libpcap/config.h Mon Oct 6 15:43:57 2014(r272658) +++ head/lib/libpcap/config.h Mon Oct 6 15:48:28 2014(r272659) @@ -271,6 +271,9 @@ /* target host supports USB sniffing */ /* #undef PCAP_SUPPORT_USB */ +/* target host supports netmap */ +#define PCAP_SUPPORT_NETMAP 1 + /* include ACN support */ /* #undef SITA */ Added: head/lib/libpcap/pcap-netmap.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libpcap/pcap-netmap.c Mon Oct 6 15:48:28 2014 (r272659) @@ -0,0 +1,283 @@ +/* + * Copyright (C) 2014 Luigi Rizzo. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING I
Re: svn commit: r272596 - head/sys/fs/devfs
On Monday, October 06, 2014 06:20:36 AM Mateusz Guzik wrote: > Author: mjg > Date: Mon Oct 6 06:20:35 2014 > New Revision: 272596 > URL: https://svnweb.freebsd.org/changeset/base/272596 > > Log: > devfs: don't take proctree_lock unconditionally in devfs_close > > MFC after: 1 week Just for my sanity: What keeps td->td_proc->p_session static in this case so that it is safe to dereference it? Specifically, if you are preempted after reading p_session but before you then read s_ttyvp, what prevents a race with another thread changing the session of td->td_proc? -- John Baldwin ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r272666 - head/sys/x86/x86
Author: jhb Date: Mon Oct 6 18:11:05 2014 New Revision: 272666 URL: https://svnweb.freebsd.org/changeset/base/272666 Log: Fix build for i386 kernels with out 'I686_CPU'. PR: 193660 Submitted by: hol...@freyther.de Modified: head/sys/x86/x86/local_apic.c Modified: head/sys/x86/x86/local_apic.c == --- head/sys/x86/x86/local_apic.c Mon Oct 6 17:27:49 2014 (r272665) +++ head/sys/x86/x86/local_apic.c Mon Oct 6 18:11:05 2014 (r272666) @@ -1366,7 +1366,7 @@ apic_init(void *dummy __unused) printf("APIC: Using the %s enumerator.\n", best_enum->apic_name); -#ifndef __amd64__ +#ifdef I686_CPU /* * To work around an errata, we disable the local APIC on some * CPUs during early startup. We need to turn the local APIC back ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r272668 - head/usr.sbin/nscd
Author: jhb Date: Mon Oct 6 18:16:45 2014 New Revision: 272668 URL: https://svnweb.freebsd.org/changeset/base/272668 Log: Properly set the timeout in a query_state. The global query_timeout configuration value is an integer count of seconds, it is not a timeval. Using memcpy() to copy a timeval from it put garbage into the tv_usec field. PR: 194025 Submitted by: David Shane Holden MFC after:1 week Modified: head/usr.sbin/nscd/query.c Modified: head/usr.sbin/nscd/query.c == --- head/usr.sbin/nscd/query.c Mon Oct 6 18:15:13 2014(r272667) +++ head/usr.sbin/nscd/query.c Mon Oct 6 18:16:45 2014(r272668) @@ -1253,8 +1253,8 @@ init_query_state(int sockfd, size_t keve retval->read_func = query_socket_read; get_time_func(&retval->creation_time); - memcpy(&retval->timeout, &s_configuration->query_timeout, - sizeof(struct timeval)); + retval->timeout.tv_sec = s_configuration->query_timeout; + retval->timeout.tv_usec = 0; TRACE_OUT(init_query_state); return (retval); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r272670 - in head/sys/amd64: include vmm vmm/intel
Author: neel Date: Mon Oct 6 20:48:01 2014 New Revision: 272670 URL: https://svnweb.freebsd.org/changeset/base/272670 Log: Inject #UD into the guest when it executes either 'MONITOR' or 'MWAIT'. The hypervisor hides the MONITOR/MWAIT capability by unconditionally setting CPUID.01H:ECX[3] to 0 so the guest should not expect these instructions to be present anyways. Discussed with: grehan Modified: head/sys/amd64/include/vmm.h head/sys/amd64/vmm/intel/vmx.c head/sys/amd64/vmm/vmm.c Modified: head/sys/amd64/include/vmm.h == --- head/sys/amd64/include/vmm.hMon Oct 6 20:38:55 2014 (r272669) +++ head/sys/amd64/include/vmm.hMon Oct 6 20:48:01 2014 (r272670) @@ -485,6 +485,8 @@ enum vm_exitcode { VM_EXITCODE_SUSPENDED, VM_EXITCODE_INOUT_STR, VM_EXITCODE_TASK_SWITCH, + VM_EXITCODE_MONITOR, + VM_EXITCODE_MWAIT, VM_EXITCODE_MAX }; Modified: head/sys/amd64/vmm/intel/vmx.c == --- head/sys/amd64/vmm/intel/vmx.c Mon Oct 6 20:38:55 2014 (r272669) +++ head/sys/amd64/vmm/intel/vmx.c Mon Oct 6 20:48:01 2014 (r272670) @@ -81,6 +81,8 @@ __FBSDID("$FreeBSD$"); #definePROCBASED_CTLS_ONE_SETTING \ (PROCBASED_SECONDARY_CONTROLS | \ +PROCBASED_MWAIT_EXITING| \ +PROCBASED_MONITOR_EXITING | \ PROCBASED_IO_EXITING | \ PROCBASED_MSR_BITMAPS | \ PROCBASED_CTLS_WINDOW_SETTING | \ @@ -2373,6 +2375,12 @@ vmx_exit_process(struct vmx *vmx, int vc case EXIT_REASON_XSETBV: handled = vmx_emulate_xsetbv(vmx, vcpu, vmexit); break; + case EXIT_REASON_MONITOR: + vmexit->exitcode = VM_EXITCODE_MONITOR; + break; + case EXIT_REASON_MWAIT: + vmexit->exitcode = VM_EXITCODE_MWAIT; + break; default: vmm_stat_incr(vmx->vm, vcpu, VMEXIT_UNKNOWN, 1); break; Modified: head/sys/amd64/vmm/vmm.c == --- head/sys/amd64/vmm/vmm.cMon Oct 6 20:38:55 2014(r272669) +++ head/sys/amd64/vmm/vmm.cMon Oct 6 20:48:01 2014(r272670) @@ -1481,6 +1481,10 @@ restart: case VM_EXITCODE_INOUT_STR: error = vm_handle_inout(vm, vcpuid, vme, &retu); break; + case VM_EXITCODE_MONITOR: + case VM_EXITCODE_MWAIT: + vm_inject_ud(vm, vcpuid); + break; default: retu = true;/* handled in userland */ break; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r272671 - head/cddl/contrib/opensolaris/lib/libdtrace/common
Author: markj Date: Mon Oct 6 21:52:40 2014 New Revision: 272671 URL: https://svnweb.freebsd.org/changeset/base/272671 Log: Treat D keywords as identifiers in certain postfix expressions. This allows one to, for example, access the "provider" field of a struct g_consumer, even though "provider" is a D keyword. PR: 169657 MFC after:2 months Discussed with: Bryan Cantrill Sponsored by: EMC / Isilon Storage Division Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_grammar.y Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_grammar.y == --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_grammar.y Mon Oct 6 20:48:01 2014(r272670) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_grammar.y Mon Oct 6 21:52:40 2014(r272671) @@ -207,6 +207,8 @@ %type unary_operator %type struct_or_union +%type dtrace_keyword_ident + %% dtrace_program: d_expression DT_TOK_EOF { return (dt_node_root($1)); } @@ -391,12 +393,18 @@ postfix_expression: | postfix_expression DT_TOK_DOT DT_TOK_TNAME { $$ = OP2(DT_TOK_DOT, $1, dt_node_ident($3)); } + | postfix_expression DT_TOK_DOT dtrace_keyword_ident { + $$ = OP2(DT_TOK_DOT, $1, dt_node_ident($3)); + } | postfix_expression DT_TOK_PTR DT_TOK_IDENT { $$ = OP2(DT_TOK_PTR, $1, dt_node_ident($3)); } | postfix_expression DT_TOK_PTR DT_TOK_TNAME { $$ = OP2(DT_TOK_PTR, $1, dt_node_ident($3)); } + | postfix_expression DT_TOK_PTR dtrace_keyword_ident { + $$ = OP2(DT_TOK_PTR, $1, dt_node_ident($3)); + } | postfix_expression DT_TOK_ADDADD { $$ = OP1(DT_TOK_POSTINC, $1); } @@ -411,6 +419,10 @@ postfix_expression: DT_TOK_TNAME DT_TOK_RPAR { $$ = dt_node_offsetof($3, $5); } + | DT_TOK_OFFSETOF DT_TOK_LPAR type_name DT_TOK_COMMA + dtrace_keyword_ident DT_TOK_RPAR { + $$ = dt_node_offsetof($3, $5); + } | DT_TOK_XLATE DT_TOK_LT type_name DT_TOK_GT DT_TOK_LPAR expression DT_TOK_RPAR { $$ = OP2(DT_TOK_XLATE, dt_node_type($3), $6); @@ -835,4 +847,15 @@ function_parameters: | parameter_type_list { $$ = $1; } ; +dtrace_keyword_ident: + DT_KEY_PROBE { $$ = DUP("probe"); } + | DT_KEY_PROVIDER { $$ = DUP("provider"); } + | DT_KEY_SELF { $$ = DUP("self"); } + | DT_KEY_STRING { $$ = DUP("string"); } + | DT_TOK_STRINGOF { $$ = DUP("stringof"); } + | DT_KEY_USERLAND { $$ = DUP("userland"); } + | DT_TOK_XLATE { $$ = DUP("xlate"); } + | DT_KEY_XLATOR { $$ = DUP("translator"); } + ; + %% ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r272562 - head/lib/libc/stdtime
On Sun, 2014-10-05 at 07:29 +, Andrey A. Chernov wrote: > Author: ache > Date: Sun Oct 5 07:29:50 2014 > New Revision: 272562 > URL: https://svnweb.freebsd.org/changeset/base/272562 > > Log: > 1) For %Z format, understand "UTC" name too. > 2) Return NULL if timegm() fails, because it means we can convert > what we have in GMT to local time needed. > > Modified: > head/lib/libc/stdtime/strptime.c > > Modified: head/lib/libc/stdtime/strptime.c > == > --- head/lib/libc/stdtime/strptime.c Sun Oct 5 07:27:05 2014 > (r272561) > +++ head/lib/libc/stdtime/strptime.c Sun Oct 5 07:29:50 2014 > (r272562) > @@ -552,7 +552,8 @@ label: > strncpy(zonestr, buf, cp - buf); > zonestr[cp - buf] = '\0'; > tzset(); > - if (0 == strcmp(zonestr, "GMT")) { > + if (0 == strcmp(zonestr, "GMT") || > + 0 == strcmp(zonestr, "UTC")) { > *GMTp = 1; > } else if (0 == strcmp(zonestr, tzname[0])) { > tm->tm_isdst = 0; > @@ -674,6 +675,9 @@ strptime_l(const char * __restrict buf, > ret = _strptime(buf, fmt, tm, &gmt, loc); > if (ret && gmt) { > time_t t = timegm(tm); > + > + if (t == -1) > + return (NULL); > localtime_r(&t, tm); > } > > Using -1 as an error indicator in time conversions has drawbacks (your change doesn't make it any better or worse, I'm just whining in general)... revolution > date -ujf "%Y-%m-%dT%H:%M:%S" +%s 1970-01-01T0:0:0 0 revolution > date -ujf "%Y-%m-%dT%H:%M:%S" +%s 1969-12-31T23:59:58 -2 revolution > date -ujf "%Y-%m-%dT%H:%M:%S" +%s 1969-12-31T23:59:59 date: nonexistent time If timegm() and mktime() were to set errno in addition to returning -1, strptime() (and others) could use that to see the difference between errors and the second immediately before the epoch. I'm not sure of the standards-related implications of those routines setting errno though. -- Ian ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r272596 - head/sys/fs/devfs
On Mon, Oct 06, 2014 at 11:37:32AM -0400, John Baldwin wrote: > On Monday, October 06, 2014 06:20:36 AM Mateusz Guzik wrote: > > Author: mjg > > Date: Mon Oct 6 06:20:35 2014 > > New Revision: 272596 > > URL: https://svnweb.freebsd.org/changeset/base/272596 > > > > Log: > > devfs: don't take proctree_lock unconditionally in devfs_close > > > > MFC after:1 week > > Just for my sanity: > > What keeps td->td_proc->p_session static in this case so that it is safe to > dereference it? Specifically, if you are preempted after reading p_session > but before you then read s_ttyvp, what prevents a race with another thread > changing the session of td->td_proc? > Right, it's buggy. Turns out devfs was quite liberal in relation to that even prior to my change. How about: diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index d7009a4..a480e4f 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -499,6 +499,7 @@ devfs_access(struct vop_access_args *ap) { struct vnode *vp = ap->a_vp; struct devfs_dirent *de; + struct proc *p; int error; de = vp->v_data; @@ -511,11 +512,14 @@ devfs_access(struct vop_access_args *ap) return (0); if (error != EACCES) return (error); + p = ap->a_td->td_proc; /* We do, however, allow access to the controlling terminal */ - if (!(ap->a_td->td_proc->p_flag & P_CONTROLT)) + if (!(p->p_flag & P_CONTROLT)) return (error); - if (ap->a_td->td_proc->p_session->s_ttydp == de->de_cdp) - return (0); + PROC_LOCK(p); + if (p->p_session->s_ttydp == de->de_cdp) + error = 0; + PROC_UNLOCK(p); return (error); } @@ -525,6 +529,7 @@ devfs_close(struct vop_close_args *ap) { struct vnode *vp = ap->a_vp, *oldvp; struct thread *td = ap->a_td; + struct proc *p; struct cdev *dev = vp->v_rdev; struct cdevsw *dsw; int vp_locked, error, ref; @@ -545,24 +550,30 @@ devfs_close(struct vop_close_args *ap) * if the reference count is 2 (this last descriptor * plus the session), release the reference from the session. */ - if (td && vp == td->td_proc->p_session->s_ttyvp) { - oldvp = NULL; - sx_xlock(&proctree_lock); - if (vp == td->td_proc->p_session->s_ttyvp) { - SESS_LOCK(td->td_proc->p_session); - VI_LOCK(vp); - if (count_dev(dev) == 2 && - (vp->v_iflag & VI_DOOMED) == 0) { - td->td_proc->p_session->s_ttyvp = NULL; - td->td_proc->p_session->s_ttydp = NULL; - oldvp = vp; + if (td != NULL) { + p = td->td_proc; + PROC_LOCK(p); + if (vp == p->p_session->s_ttyvp) { + PROC_UNLOCK(p); + oldvp = NULL; + sx_xlock(&proctree_lock); + if (vp == p->p_session->s_ttyvp) { + SESS_LOCK(p->p_session); + VI_LOCK(vp); + if (count_dev(dev) == 2 && + (vp->v_iflag & VI_DOOMED) == 0) { + p->p_session->s_ttyvp = NULL; + p->p_session->s_ttydp = NULL; + oldvp = vp; + } + VI_UNLOCK(vp); + SESS_UNLOCK(p->p_session); } - VI_UNLOCK(vp); - SESS_UNLOCK(td->td_proc->p_session); - } - sx_xunlock(&proctree_lock); - if (oldvp != NULL) - vrele(oldvp); + sx_xunlock(&proctree_lock); + if (oldvp != NULL) + vrele(oldvp); + } else + PROC_UNLOCK(p); } /* * We do not want to really close the device if it @@ -814,6 +825,7 @@ devfs_prison_check(struct devfs_dirent *de, struct thread *td) { struct cdev_priv *cdp; struct ucred *dcr; + struct proc *p; int error; cdp = de->de_cdp; @@ -827,10 +839,13 @@ devfs_prison_check(struct devfs_dirent *de, struct thread *td) if (error == 0) return (0); /* We do, however, allow access to the controlling terminal */ - if (!(td->td_proc->p_flag & P_CONTROLT)) + p = td->td_proc; + if (!(p->p_flag & P_CONTROLT)) return (error); - if (td->td_proc->p_session->s_ttydp == cdp) - return (0); + PROC_LOCK(p); + if (p->p_session->s_ttydp == c
Re: svn commit: r272659 - in head: contrib/libpcap lib/libpcap
Luigi Rizzo wrote this message on Mon, Oct 06, 2014 at 15:48 +: > Author: luigi > Date: Mon Oct 6 15:48:28 2014 > New Revision: 272659 > URL: https://svnweb.freebsd.org/changeset/base/272659 > > Log: > Add netmap support to libpcap. Tcpdump and other native pcap application > can now > run directly on netmap ports using netmap:foo or valeXX:YY device names. > Modifications to existing code are small and trivial, the netmap-specific > code is all in a new file. > > Please be aware that in netmap mode the physical interface is disconnected > from > the host stack, so libpcap will steal the traffic not just make a copy. > > For the full version of the code (including linux and autotools support) see > https://code.google.com/p/netmap-libpcap/ > > MFC after: 3 days Please update man page before merging... Specificly w/ the warning about stealing the traffic, but also include general use too... Thanks. -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r272673 - in head: include lib/libc/string sys/conf sys/libkern sys/sys
Author: delphij Date: Tue Oct 7 04:54:11 2014 New Revision: 272673 URL: https://svnweb.freebsd.org/changeset/base/272673 Log: Add explicit_bzero(3) and its kernel counterpart. Obtained from:OpenBSD MFC after:2 weeks Added: head/lib/libc/string/explicit_bzero.c (contents, props changed) head/sys/libkern/explicit_bzero.c (contents, props changed) Modified: head/include/strings.h head/lib/libc/string/Makefile.inc head/lib/libc/string/Symbol.map head/lib/libc/string/bzero.3 head/sys/conf/files head/sys/sys/systm.h Modified: head/include/strings.h == --- head/include/strings.h Mon Oct 6 23:17:01 2014(r272672) +++ head/include/strings.h Tue Oct 7 04:54:11 2014(r272673) @@ -43,6 +43,9 @@ intbcmp(const void *, const void *, si voidbcopy(const void *, void *, size_t); /* LEGACY */ voidbzero(void *, size_t); /* LEGACY */ #endif +#if __BSD_VISIBLE +voidexplicit_bzero(void *, size_t); +#endif #if __XSI_VISIBLE int ffs(int) __pure2; #endif Modified: head/lib/libc/string/Makefile.inc == --- head/lib/libc/string/Makefile.inc Mon Oct 6 23:17:01 2014 (r272672) +++ head/lib/libc/string/Makefile.inc Tue Oct 7 04:54:11 2014 (r272673) @@ -6,7 +6,8 @@ CFLAGS+= -I${LIBC_SRCTOP}/locale # machine-independent string sources -MISRCS+=bcmp.c bcopy.c bzero.c ffs.c ffsl.c ffsll.c fls.c flsl.c flsll.c \ +MISRCS+=bcmp.c bcopy.c bzero.c explicit_bzero.c \ + ffs.c ffsl.c ffsll.c fls.c flsl.c flsll.c \ memccpy.c memchr.c memrchr.c memcmp.c \ memcpy.c memmem.c memmove.c memset.c \ stpcpy.c stpncpy.c strcasecmp.c \ Modified: head/lib/libc/string/Symbol.map == --- head/lib/libc/string/Symbol.map Mon Oct 6 23:17:01 2014 (r272672) +++ head/lib/libc/string/Symbol.map Tue Oct 7 04:54:11 2014 (r272673) @@ -100,6 +100,10 @@ FBSD_1.3 { wcwidth_l; }; +FBSD_1.4 { + explicit_bzero; +}; + FBSDprivate_1.0 { __strtok_r; }; Modified: head/lib/libc/string/bzero.3 == --- head/lib/libc/string/bzero.3Mon Oct 6 23:17:01 2014 (r272672) +++ head/lib/libc/string/bzero.3Tue Oct 7 04:54:11 2014 (r272673) @@ -35,7 +35,8 @@ .Dt BZERO 3 .Os .Sh NAME -.Nm bzero +.Nm bzero , +.Nm explicit_bzero .Nd write zeroes to a byte string .Sh LIBRARY .Lb libc @@ -43,6 +44,8 @@ .In strings.h .Ft void .Fn bzero "void *b" "size_t len" +.Ft void +.Fn explicit_bzero "void *b" "size_t len" .Sh DESCRIPTION The .Fn bzero @@ -56,6 +59,12 @@ If is zero, .Fn bzero does nothing. +.Pp +The +.Fn explicit_bzero +variant behaves the same, but will not be removed by a compiler's dead store +optimization pass, making it useful for clearing sensitive memory such as a +password. .Sh SEE ALSO .Xr memset 3 , .Xr swab 3 @@ -72,3 +81,10 @@ before it was moved to for .St -p1003.1-2001 compliance. +.Pp +The +.Fn explicit_bzero +function first appeared in +.Ox 5.5 +and +.Fx 11.0 . Added: head/lib/libc/string/explicit_bzero.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/string/explicit_bzero.c Tue Oct 7 04:54:11 2014 (r272673) @@ -0,0 +1,22 @@ +/* $OpenBSD: explicit_bzero.c,v 1.3 2014/06/21 02:34:26 matthew Exp $ */ +/* + * Public domain. + * Written by Matthew Dempsky. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +__attribute__((weak)) void +__explicit_bzero_hook(void *buf, size_t len) +{ +} + +void +explicit_bzero(void *buf, size_t len) +{ + memset(buf, 0, len); + __explicit_bzero_hook(buf, len); +} Modified: head/sys/conf/files == --- head/sys/conf/files Mon Oct 6 23:17:01 2014(r272672) +++ head/sys/conf/files Tue Oct 7 04:54:11 2014(r272673) @@ -3163,6 +3163,7 @@ libkern/arc4random.c standard libkern/bcd.c standard libkern/bsearch.c standard libkern/crc32.cstandard +libkern/explicit_bzero.c standard libkern/fnmatch.c standard libkern/iconv.coptional libiconv libkern/iconv_converter_if.m optional libiconv Added: head/sys/libkern/explicit_bzero.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/libkern/explicit_bzero.c Tue Oct 7 04:54:11 2014 (r272673) @@ -0,0 +1,24 @@ +/* $OpenBSD: explicit_bzero.c,v 1.
svn commit: r272674 - head/sys/sys
Author: delphij Date: Tue Oct 7 04:54:47 2014 New Revision: 272674 URL: https://svnweb.freebsd.org/changeset/base/272674 Log: Bump __FreeBSD_version for the addition of explicit_bzero(3). Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h == --- head/sys/sys/param.hTue Oct 7 04:54:11 2014(r272673) +++ head/sys/sys/param.hTue Oct 7 04:54:47 2014(r272674) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1100036 /* Master, propagated to newvers */ +#define __FreeBSD_version 1100037 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r272675 - head/lib/libc/string
Author: delphij Date: Tue Oct 7 04:59:11 2014 New Revision: 272675 URL: https://svnweb.freebsd.org/changeset/base/272675 Log: Add MLINK for explicit_bzero(3) and bump .Dd date. MFC after:2 weeks Modified: head/lib/libc/string/Makefile.inc head/lib/libc/string/bzero.3 Modified: head/lib/libc/string/Makefile.inc == --- head/lib/libc/string/Makefile.inc Tue Oct 7 04:54:47 2014 (r272674) +++ head/lib/libc/string/Makefile.inc Tue Oct 7 04:59:11 2014 (r272675) @@ -36,6 +36,7 @@ MAN+= bcmp.3 bcopy.3 bstring.3 bzero.3 f strspn.3 strstr.3 strtok.3 strxfrm.3 swab.3 wcscoll.3 wcstok.3 \ wcswidth.3 wcsxfrm.3 wmemchr.3 +MLINKS+=bzero.3 explicit_bzero.3 MLINKS+=ffs.3 ffsl.3 \ ffs.3 ffsll.3 \ ffs.3 fls.3 \ Modified: head/lib/libc/string/bzero.3 == --- head/lib/libc/string/bzero.3Tue Oct 7 04:54:47 2014 (r272674) +++ head/lib/libc/string/bzero.3Tue Oct 7 04:59:11 2014 (r272675) @@ -31,7 +31,7 @@ .\"@(#)bzero.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd October 6, 2014 .Dt BZERO 3 .Os .Sh NAME ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r272562 - head/lib/libc/stdtime
On 07.10.2014 2:45, Ian Lepore wrote: > Using -1 as an error indicator in time conversions has drawbacks (your > change doesn't make it any better or worse, I'm just whining in > general)... > > revolution > date -ujf "%Y-%m-%dT%H:%M:%S" +%s 1970-01-01T0:0:0 > 0 > revolution > date -ujf "%Y-%m-%dT%H:%M:%S" +%s 1969-12-31T23:59:58 > -2 > revolution > date -ujf "%Y-%m-%dT%H:%M:%S" +%s 1969-12-31T23:59:59 > date: nonexistent time > > If timegm() and mktime() were to set errno in addition to returning -1, > strptime() (and others) could use that to see the difference between > errors and the second immediately before the epoch. I'm not sure of the > standards-related implications of those routines setting errno though. POSIX, Base Specs, Issue 7, mktime says: "If the time since the Epoch cannot be represented, the function shall return the value (time_t)−1 and set errno to indicate the error. ... [EOVERFLOW] The result cannot be represented." But we don't set EOVERFLOW inside timegm or mktime... About negative time_t values, POSIX, Seconds Since the Epoch, says: "...is related to a time represented as seconds since the Epoch... If the year is <1970 or the value is negative, the relationship is undefined." So, we are free to either treat all negative values as errors or set EOVERFLOW in our time functions and add a check to every lib & program since nobody checks it. I'll think about this place more.. -- http://ache.vniz.net/ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r272678 - head/lib/libc/stdtime
Author: ache Date: Tue Oct 7 06:02:08 2014 New Revision: 272678 URL: https://svnweb.freebsd.org/changeset/base/272678 Log: Back out timegm error check from r272562. POSIX treats negative time_t as undefined (i.e. may be valid too, depends on system's policy we don't have) and we don't set EOVERFLOW in mktime/timegm as POSIX requires to surely distinguish -1 return as valid negative time from -1 as error return. Modified: head/lib/libc/stdtime/strptime.c Modified: head/lib/libc/stdtime/strptime.c == --- head/lib/libc/stdtime/strptime.cTue Oct 7 06:00:32 2014 (r272677) +++ head/lib/libc/stdtime/strptime.cTue Oct 7 06:02:08 2014 (r272678) @@ -676,8 +676,6 @@ strptime_l(const char * __restrict buf, if (ret && gmt) { time_t t = timegm(tm); - if (t == -1) - return (NULL); localtime_r(&t, tm); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r272679 - head/lib/libc/stdtime
Author: ache Date: Tue Oct 7 06:34:05 2014 New Revision: 272679 URL: https://svnweb.freebsd.org/changeset/base/272679 Log: 1) Fix the case we have less arguments for format string than we expected. 2) Return error on unsupported format specs. (both according to POSIX) PR: 93197 Modified: head/lib/libc/stdtime/strptime.c Modified: head/lib/libc/stdtime/strptime.c == --- head/lib/libc/stdtime/strptime.cTue Oct 7 06:02:08 2014 (r272678) +++ head/lib/libc/stdtime/strptime.cTue Oct 7 06:34:05 2014 (r272679) @@ -103,9 +103,6 @@ _strptime(const char *buf, const char *f ptr = fmt; while (*ptr != 0) { - if (*buf == 0) - break; - c = *ptr++; if (c != '%') { @@ -123,7 +120,6 @@ _strptime(const char *buf, const char *f label: c = *ptr++; switch (c) { - case 0: case '%': if (*buf++ != '%') return (NULL); @@ -600,6 +596,9 @@ label: while (isspace_l((unsigned char)*buf, locale)) buf++; break; + + default: + return (NULL); } } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"