svn commit: r299522 - stable/10/share/man/man3
Author: kib Date: Thu May 12 06:55:42 2016 New Revision: 299522 URL: https://svnweb.freebsd.org/changeset/base/299522 Log: MFC r299115: Warn about consequences of suspending threads in arbitrary state of execution Modified: stable/10/share/man/man3/pthread_resume_np.3 stable/10/share/man/man3/pthread_suspend_all_np.3 stable/10/share/man/man3/pthread_suspend_np.3 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man3/pthread_resume_np.3 == --- stable/10/share/man/man3/pthread_resume_np.3Thu May 12 06:53:22 2016(r299521) +++ stable/10/share/man/man3/pthread_resume_np.3Thu May 12 06:55:42 2016(r299522) @@ -57,7 +57,7 @@ function will fail if: The value specified by the .Fa tid argument is invalid. -.It Bq ESRC +.It Bq Er ESRC No thread could be found corresponding to the thread ID specified by the .Fa tid argument. Modified: stable/10/share/man/man3/pthread_suspend_all_np.3 == --- stable/10/share/man/man3/pthread_suspend_all_np.3 Thu May 12 06:53:22 2016(r299521) +++ stable/10/share/man/man3/pthread_suspend_all_np.3 Thu May 12 06:55:42 2016(r299522) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 13, 2003 +.Dd May 5, 2016 .Dt PTHREAD_SUSPEND_ALL_NP 3 .Os .Sh NAME @@ -44,6 +44,13 @@ The only exception is the current thread the thread that called the .Fn pthread_suspend_all_np function. +.Pp +It is not safe for the caller of the +.Fn pthread_suspend_all_np +function to use any non-async signal safe functions, besides +.Xr pthread_resume_all_np 3 , +until threads are resumed, unless measures are taken to ensure +that all threads are suspended at safe points. .Sh SEE ALSO .Xr pthread_resume_all_np 3 , .Xr pthread_resume_np 3 , Modified: stable/10/share/man/man3/pthread_suspend_np.3 == --- stable/10/share/man/man3/pthread_suspend_np.3 Thu May 12 06:53:22 2016(r299521) +++ stable/10/share/man/man3/pthread_suspend_np.3 Thu May 12 06:55:42 2016(r299522) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 13, 2003 +.Dd May 5, 2016 .Dt PTHREAD_SUSPEND_NP 3 .Os .Sh NAME @@ -40,6 +40,13 @@ The .Fn pthread_suspend_np function, called on an active thread, causes it to suspend. +.Pp +It is not safe for the caller of the +.Fn pthread_suspend_np +function to use any non-async signal safe functions, except +.Xr pthread_resume_np 3 , +until suspended thread is resumed, unless measures are taken to ensure +that the thread is suspended at a safe point. .Sh RETURN VALUES If successful, .Fn pthread_suspend_np @@ -56,7 +63,7 @@ An attempt was made to suspend the curre The value specified by the .Fa tid argument is invalid. -.It Bq ESRC +.It Bq Er ESRC No thread could be found corresponding to the thread ID specified by the .Fa tid argument. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299521 - stable/10/lib/libthr/thread
Author: kib Date: Thu May 12 06:53:22 2016 New Revision: 299521 URL: https://svnweb.freebsd.org/changeset/base/299521 Log: MFC r299114: Do not leak THR_FLAGS_SUSPENDED from the previous suspend/resume cycle. PR: 209233 Modified: stable/10/lib/libthr/thread/thr_resume_np.c stable/10/lib/libthr/thread/thr_sig.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libthr/thread/thr_resume_np.c == --- stable/10/lib/libthr/thread/thr_resume_np.c Thu May 12 06:39:13 2016 (r299520) +++ stable/10/lib/libthr/thread/thr_resume_np.c Thu May 12 06:53:22 2016 (r299521) @@ -90,7 +90,7 @@ static void resume_common(struct pthread *thread) { /* Clear the suspend flag: */ - thread->flags &= ~THR_FLAGS_NEED_SUSPEND; + thread->flags &= ~(THR_FLAGS_NEED_SUSPEND | THR_FLAGS_SUSPENDED); thread->cycle++; _thr_umtx_wake(&thread->cycle, 1, 0); } Modified: stable/10/lib/libthr/thread/thr_sig.c == --- stable/10/lib/libthr/thread/thr_sig.c Thu May 12 06:39:13 2016 (r299520) +++ stable/10/lib/libthr/thread/thr_sig.c Thu May 12 06:53:22 2016 (r299521) @@ -373,8 +373,7 @@ check_suspend(struct pthread *curthread) */ curthread->critical_count++; THR_UMUTEX_LOCK(curthread, &(curthread)->lock); - while ((curthread->flags & (THR_FLAGS_NEED_SUSPEND | - THR_FLAGS_SUSPENDED)) == THR_FLAGS_NEED_SUSPEND) { + while ((curthread->flags & THR_FLAGS_NEED_SUSPEND) != 0) { curthread->cycle++; cycle = curthread->cycle; @@ -391,7 +390,6 @@ check_suspend(struct pthread *curthread) THR_UMUTEX_UNLOCK(curthread, &(curthread)->lock); _thr_umtx_wait_uint(&curthread->cycle, cycle, NULL, 0); THR_UMUTEX_LOCK(curthread, &(curthread)->lock); - curthread->flags &= ~THR_FLAGS_SUSPENDED; } THR_UMUTEX_UNLOCK(curthread, &(curthread)->lock); curthread->critical_count--; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299520 - head/lib/libfetch
Author: truckman Date: Thu May 12 06:39:13 2016 New Revision: 299520 URL: https://svnweb.freebsd.org/changeset/base/299520 Log: Use strlcpy() instead of strncpy() to copy the string returned by setlocale() so that static analyzers know that the string is NUL terminated. This was causing a false positive in Coverity even though the longest string returned by setlocale() is ENCODING_LEN (31) and we are copying into a 64 byte buffer. This change is also a bit of an optimization since we don't need the strncpy() feature of padding the rest of the destination buffer with NUL characters. Reported by: Coverity CID: 974654 Modified: head/lib/libfetch/http.c Modified: head/lib/libfetch/http.c == --- head/lib/libfetch/http.cThu May 12 06:20:26 2016(r299519) +++ head/lib/libfetch/http.cThu May 12 06:39:13 2016(r299520) @@ -875,7 +875,7 @@ http_parse_mtime(const char *p, time_t * char locale[64], *r; struct tm tm; - strncpy(locale, setlocale(LC_TIME, NULL), sizeof(locale)); + strlcpy(locale, setlocale(LC_TIME, NULL), sizeof(locale)); setlocale(LC_TIME, "C"); r = strptime(p, "%a, %d %b %Y %H:%M:%S GMT", &tm); /* ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299518 - head/sys/dev/sfxge/common
Author: arybchik Date: Thu May 12 06:20:26 2016 New Revision: 299518 URL: https://svnweb.freebsd.org/changeset/base/299518 Log: sfxge(4): update multicast filter insertion algorithm When the multicast filters we're allowed to insert are controlled by the hypervisor, it may be that we can insert some but not others. So we need to have fallbacks where we insert any filters we can without rolling back when one fails to insert. Submitted by: Mark Spender Sponsored by: Solarflare Communications, Inc. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D6318 Modified: head/sys/dev/sfxge/common/hunt_filter.c Modified: head/sys/dev/sfxge/common/hunt_filter.c == --- head/sys/dev/sfxge/common/hunt_filter.c Thu May 12 06:19:06 2016 (r299517) +++ head/sys/dev/sfxge/common/hunt_filter.c Thu May 12 06:20:26 2016 (r299518) @@ -1044,36 +1044,36 @@ fail1: } static __checkReturn efx_rc_t -ef10_filter_multicast_refresh( +ef10_filter_insert_multicast_list( __inefx_nic_t *enp, __inboolean_t mulcst, - __inboolean_t all_mulcst, __inboolean_t brdcst, __in_ecount(6*count)uint8_t const *addrs, __inuint32_t count, - __inefx_filter_flag_t filter_flags) + __inefx_filter_flag_t filter_flags, + __inboolean_t rollback) { ef10_filter_table_t *eftp = enp->en_filter.ef_ef10_filter_table; efx_filter_spec_t spec; uint8_t addr[6]; - unsigned i; + uint32_t i; + uint32_t filter_index; + uint32_t filter_count; efx_rc_t rc; - if (all_mulcst == B_TRUE) - goto use_mc_def; - if (mulcst == B_FALSE) count = 0; if (count + (brdcst ? 1 : 0) > EFX_ARRAY_SIZE(eftp->eft_mulcst_filter_indexes)) { - /* Too many MAC addresses; use unknown multicast filter */ - goto use_mc_def; + /* Too many MAC addresses */ + rc = EINVAL; + goto fail1; } /* Insert/renew multicast address list filters */ - eftp->eft_mulcst_filter_count = count; - for (i = 0; i < eftp->eft_mulcst_filter_count; i++) { + filter_count = 0; + for (i = 0; i < count; i++) { efx_filter_spec_init_rx(&spec, EFX_FILTER_PRI_AUTO, filter_flags, @@ -1084,16 +1084,21 @@ ef10_filter_multicast_refresh( &addrs[i * EFX_MAC_ADDR_LEN]); rc = ef10_filter_add_internal(enp, &spec, B_TRUE, - &eftp->eft_mulcst_filter_indexes[i]); - if (rc != 0) { - /* Rollback, then use unknown multicast filter */ + &filter_index); + + if (rc == 0) { + eftp->eft_mulcst_filter_indexes[filter_count] = + filter_index; + filter_count++; + } else if (rollback == B_TRUE) { + /* Only stop upon failure if told to rollback */ goto rollback; } + } if (brdcst == B_TRUE) { /* Insert/renew broadcast address filter */ - eftp->eft_mulcst_filter_count++; efx_filter_spec_init_rx(&spec, EFX_FILTER_PRI_AUTO, filter_flags, eftp->eft_default_rxq); @@ -1103,28 +1108,46 @@ ef10_filter_multicast_refresh( addr); rc = ef10_filter_add_internal(enp, &spec, B_TRUE, - &eftp->eft_mulcst_filter_indexes[ - eftp->eft_mulcst_filter_count - 1]); - if (rc != 0) { - /* Rollback, then use unknown multicast filter */ + &filter_index); + + if (rc == 0) { + eftp->eft_mulcst_filter_indexes[filter_count] = + filter_index; + filter_count++; + } else if (rollback == B_TRUE) { + /* Only stop upon failure if told to rollback */ goto rollback; } } + eftp->eft_mulcst_filter_count = filter_count; + return (0); rollback: - /* -* Rollback by removing any filters we have inserted -* before inserting the unknown multicast filter. -*/ + /* Remove any filters we have inserted */ + i = filter_count; while (i--) { (void) ef10_filter_delete_internal(enp,
svn commit: r299519 - head/sys/sys
Author: kib Date: Thu May 12 06:20:26 2016 New Revision: 299519 URL: https://svnweb.freebsd.org/changeset/base/299519 Log: Typo in comment. Modified: head/sys/sys/turnstile.h Modified: head/sys/sys/turnstile.h == --- head/sys/sys/turnstile.hThu May 12 06:20:26 2016(r299518) +++ head/sys/sys/turnstile.hThu May 12 06:20:26 2016(r299519) @@ -33,7 +33,7 @@ * Turnstile interface. Non-sleepable locks use a turnstile for the * queue of threads blocked on them when they are contested. Each * turnstile contains two sub-queues: one for threads waiting for a - * shared, or eread, lock, and one for threads waiting for an + * shared, or read, lock, and one for threads waiting for an * exclusive, or write, lock. * * A thread calls turnstile_chain_lock() to lock the turnstile chain ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299517 - head/sys/dev/sfxge/common
Author: arybchik Date: Thu May 12 06:19:06 2016 New Revision: 299517 URL: https://svnweb.freebsd.org/changeset/base/299517 Log: sfxge(4): cleanup: constify common code method tables Submitted by: Andy Moreton Sponsored by: Solarflare Communications, Inc. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D6317 Modified: head/sys/dev/sfxge/common/efx_ev.c head/sys/dev/sfxge/common/efx_filter.c head/sys/dev/sfxge/common/efx_impl.h head/sys/dev/sfxge/common/efx_intr.c head/sys/dev/sfxge/common/efx_lic.c head/sys/dev/sfxge/common/efx_mac.c head/sys/dev/sfxge/common/efx_mcdi.c head/sys/dev/sfxge/common/efx_mon.c head/sys/dev/sfxge/common/efx_nic.c head/sys/dev/sfxge/common/efx_nvram.c head/sys/dev/sfxge/common/efx_phy.c head/sys/dev/sfxge/common/efx_port.c head/sys/dev/sfxge/common/efx_rx.c head/sys/dev/sfxge/common/efx_tx.c head/sys/dev/sfxge/common/efx_vpd.c head/sys/dev/sfxge/common/hunt_mac.c head/sys/dev/sfxge/common/hunt_nic.c head/sys/dev/sfxge/common/siena_mac.c Modified: head/sys/dev/sfxge/common/efx_ev.c == --- head/sys/dev/sfxge/common/efx_ev.c Thu May 12 05:43:54 2016 (r299516) +++ head/sys/dev/sfxge/common/efx_ev.c Thu May 12 06:19:06 2016 (r299517) @@ -109,7 +109,7 @@ falconsiena_ev_qstats_update( #endif /* EFSYS_OPT_SIENA */ #if EFSYS_OPT_SIENA -static efx_ev_ops_t__efx_ev_siena_ops = { +static const efx_ev_ops_t __efx_ev_siena_ops = { falconsiena_ev_init,/* eevo_init */ falconsiena_ev_fini,/* eevo_fini */ falconsiena_ev_qcreate, /* eevo_qcreate */ @@ -124,7 +124,7 @@ static efx_ev_ops_t __efx_ev_siena_ops = #endif /* EFSYS_OPT_SIENA */ #if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD -static efx_ev_ops_t__efx_ev_ef10_ops = { +static const efx_ev_ops_t __efx_ev_ef10_ops = { ef10_ev_init, /* eevo_init */ ef10_ev_fini, /* eevo_fini */ ef10_ev_qcreate,/* eevo_qcreate */ @@ -143,7 +143,7 @@ static efx_ev_ops_t __efx_ev_ef10_ops = efx_ev_init( __inefx_nic_t *enp) { - efx_ev_ops_t *eevop; + const efx_ev_ops_t *eevop; efx_rc_t rc; EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); @@ -157,19 +157,19 @@ efx_ev_init( switch (enp->en_family) { #if EFSYS_OPT_SIENA case EFX_FAMILY_SIENA: - eevop = (efx_ev_ops_t *)&__efx_ev_siena_ops; + eevop = &__efx_ev_siena_ops; break; #endif /* EFSYS_OPT_SIENA */ #if EFSYS_OPT_HUNTINGTON case EFX_FAMILY_HUNTINGTON: - eevop = (efx_ev_ops_t *)&__efx_ev_ef10_ops; + eevop = &__efx_ev_ef10_ops; break; #endif /* EFSYS_OPT_HUNTINGTON */ #if EFSYS_OPT_MEDFORD case EFX_FAMILY_MEDFORD: - eevop = (efx_ev_ops_t *)&__efx_ev_ef10_ops; + eevop = &__efx_ev_ef10_ops; break; #endif /* EFSYS_OPT_MEDFORD */ @@ -203,7 +203,7 @@ fail1: efx_ev_fini( __inefx_nic_t *enp) { - efx_ev_ops_t *eevop = enp->en_eevop; + const efx_ev_ops_t *eevop = enp->en_eevop; EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_INTR); @@ -228,7 +228,7 @@ efx_ev_qcreate( __inuint32_t id, __deref_out efx_evq_t **eepp) { - efx_ev_ops_t *eevop = enp->en_eevop; + const efx_ev_ops_t *eevop = enp->en_eevop; efx_nic_cfg_t *encp = &(enp->en_nic_cfg); efx_evq_t *eep; efx_rc_t rc; @@ -272,7 +272,7 @@ efx_ev_qdestroy( __inefx_evq_t *eep) { efx_nic_t *enp = eep->ee_enp; - efx_ev_ops_t *eevop = enp->en_eevop; + const efx_ev_ops_t *eevop = enp->en_eevop; EFSYS_ASSERT3U(eep->ee_magic, ==, EFX_EVQ_MAGIC); @@ -291,7 +291,7 @@ efx_ev_qprime( __inunsigned int count) { efx_nic_t *enp = eep->ee_enp; - efx_ev_ops_t *eevop = enp->en_eevop; + const efx_ev_ops_t *eevop = enp->en_eevop; efx_rc_t rc; EFSYS_ASSERT3U(eep->ee_magic, ==, EFX_EVQ_MAGIC); @@ -383,7 +383,7 @@ efx_ev_qpost( __inuint16_t data) { efx_nic_t *enp = eep->ee_enp; - efx_ev_ops_t *eevop = enp->en_eevop; + const efx_ev_ops_t *eevop = enp->en_eevop; EFSYS_ASSERT3U(eep->ee_magic, ==, EFX_EVQ_MAGIC); @@ -399,7 +399,7 @@ efx_ev_qmoderate( __inunsigned int us) { efx_nic_t *enp = eep->ee_enp; - efx_ev_ops_t *eevop = enp->en_eevop; + const efx_ev_ops_t *eevop = enp->en_eevop; efx_rc_t rc; EFSYS_ASSERT3U(eep->ee_magic, ==, EFX_EVQ_MAGIC); @@ -421,7 +421,7 @@ efx_ev_qstats_update( __inout_ecount(EV_NQSTATS) efsys_stat_t *st
svn commit: r299516 - head/sbin/ping
Author: truckman Date: Thu May 12 05:43:54 2016 New Revision: 299516 URL: https://svnweb.freebsd.org/changeset/base/299516 Log: Check for socket creation success before calling bind(). Reported by: Coverity CID: 1194209 Modified: head/sbin/ping/ping.c Modified: head/sbin/ping/ping.c == --- head/sbin/ping/ping.c Thu May 12 05:12:24 2016(r299515) +++ head/sbin/ping/ping.c Thu May 12 05:43:54 2016(r299516) @@ -285,6 +285,16 @@ main(int argc, char *const *argv) err(EX_NOPERM, "setuid() failed"); uid = getuid(); + if (ssend < 0) { + errno = ssend_errno; + err(EX_OSERR, "ssend socket"); + } + + if (srecv < 0) { + errno = srecv_errno; + err(EX_OSERR, "srecv socket"); + } + alarmtimeout = df = preload = tos = 0; outpack = outpackhdr + sizeof(struct ip); @@ -625,16 +635,6 @@ main(int argc, char *const *argv) } #endif - if (ssend < 0) { - errno = ssend_errno; - err(EX_OSERR, "ssend socket"); - } - - if (srecv < 0) { - errno = srecv_errno; - err(EX_OSERR, "srecv socket"); - } - if (connect(ssend, (struct sockaddr *)&whereto, sizeof(whereto)) != 0) err(1, "connect"); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299515 - head/usr.sbin/rtadvd
Author: cem Date: Thu May 12 05:12:24 2016 New Revision: 299515 URL: https://svnweb.freebsd.org/changeset/base/299515 Log: rtadvd(8): Fix use-after-close in cm_handler_client cm_send() closes 'fd' on error. In that case, bail out early without trying to recv from or close 'fd' again. Reported by: Coverity CID: 1006078 Sponsored by: EMC / Isilon Storage Division Modified: head/usr.sbin/rtadvd/control_client.c Modified: head/usr.sbin/rtadvd/control_client.c == --- head/usr.sbin/rtadvd/control_client.c Thu May 12 05:03:12 2016 (r299514) +++ head/usr.sbin/rtadvd/control_client.c Thu May 12 05:12:24 2016 (r299515) @@ -92,9 +92,11 @@ cm_handler_client(int fd, int state, cha case CM_STATE_MSG_DISPATCH: cm->cm_version = CM_VERSION; error = cm_send(fd, buf); - if (error) + if (error) { syslog(LOG_WARNING, "<%s> cm_send()", __func__); + return (-1); + } state = CM_STATE_ACK_WAIT; break; case CM_STATE_ACK_WAIT: ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299514 - head/sys/fs/nfsserver
Author: cem Date: Thu May 12 05:03:12 2016 New Revision: 299514 URL: https://svnweb.freebsd.org/changeset/base/299514 Log: nfsd: Fix use-after-free in NFS4 lock test service Trivial use-after-free where stp was freed too soon in the non-error path. To fix, simply move its release to the end of the routine. Reported by: Coverity CID: 1006105 Sponsored by: EMC / Isilon Storage Division Modified: head/sys/fs/nfsserver/nfs_nfsdserv.c Modified: head/sys/fs/nfsserver/nfs_nfsdserv.c == --- head/sys/fs/nfsserver/nfs_nfsdserv.cThu May 12 04:54:32 2016 (r299513) +++ head/sys/fs/nfsserver/nfs_nfsdserv.cThu May 12 05:03:12 2016 (r299514) @@ -2437,8 +2437,6 @@ nfsrvd_lockt(struct nfsrv_descript *nd, if (!nd->nd_repstat) nd->nd_repstat = nfsrv_lockctrl(vp, &stp, &lop, &cf, clientid, &stateid, exp, nd, p); - if (stp) - FREE((caddr_t)stp, M_NFSDSTATE); if (nd->nd_repstat) { if (nd->nd_repstat == NFSERR_DENIED) { NFSM_BUILD(tl, u_int32_t *, 7 * NFSX_UNSIGNED); @@ -2460,6 +2458,8 @@ nfsrvd_lockt(struct nfsrv_descript *nd, } } vput(vp); + if (stp) + FREE((caddr_t)stp, M_NFSDSTATE); NFSEXITCODE2(0, nd); return (0); nfsmout: ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299513 - head/usr.sbin/rtadvd
Author: cem Date: Thu May 12 04:54:32 2016 New Revision: 299513 URL: https://svnweb.freebsd.org/changeset/base/299513 Log: rtadvd(8): Don't use-after-free This whole block of code as committed fully formed in r224144. I'm not really sure what the intent was, but it seems plausible that !persist ifis could need other member cleanup. Don't free the object until after we've finished cleaning its members. Reported by: Coverity CID: 1006079 Sponsored by: EMC / Isilon Storage Division Modified: head/usr.sbin/rtadvd/config.c Modified: head/usr.sbin/rtadvd/config.c == --- head/usr.sbin/rtadvd/config.c Thu May 12 04:28:22 2016 (r299512) +++ head/usr.sbin/rtadvd/config.c Thu May 12 04:54:32 2016 (r299513) @@ -234,7 +234,6 @@ rm_ifinfo(struct ifinfo *ifi) TAILQ_REMOVE(&ifilist, ifi, ifi_next); syslog(LOG_DEBUG, "<%s>: ifinfo (idx=%d) removed.", __func__, ifi->ifi_ifindex); - free(ifi); } else { /* recreate an empty entry */ update_persist_ifinfo(&ifilist, ifi->ifi_ifname); @@ -278,6 +277,8 @@ rm_ifinfo(struct ifinfo *ifi) } syslog(LOG_DEBUG, "<%s> leave (%s).", __func__, ifi->ifi_ifname); + if (!ifi->ifi_persist) + free(ifi); return (0); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299512 - head/sbin/dhclient
Author: cem Date: Thu May 12 04:28:22 2016 New Revision: 299512 URL: https://svnweb.freebsd.org/changeset/base/299512 Log: dhclient: Fix some trivial buffer overruns There was some confusion about how to limit a hardware address to at most 16 bytes. In some cases it would overrun a byte off the end of the array. Correct the types and rectify the overrun. Reported by: Coverity CIDs: 1008682, 1305550 Sponsored by: EMC / Isilon Storage Division Modified: head/sbin/dhclient/dhclient.c Modified: head/sbin/dhclient/dhclient.c == --- head/sbin/dhclient/dhclient.c Thu May 12 04:08:45 2016 (r299511) +++ head/sbin/dhclient/dhclient.c Thu May 12 04:28:22 2016 (r299512) @@ -56,6 +56,8 @@ #include __FBSDID("$FreeBSD$"); +#include + #include "dhcpd.h" #include "privsep.h" @@ -1570,16 +1572,18 @@ make_discover(struct interface_info *ip, } /* set unique client identifier */ - char client_ident[sizeof(struct hardware)]; + struct hardware client_ident; if (!options[DHO_DHCP_CLIENT_IDENTIFIER]) { - int hwlen = (ip->hw_address.hlen < sizeof(client_ident)-1) ? - ip->hw_address.hlen : sizeof(client_ident)-1; - client_ident[0] = ip->hw_address.htype; - memcpy(&client_ident[1], ip->hw_address.haddr, hwlen); + size_t hwlen = MIN(ip->hw_address.hlen, + sizeof(client_ident.haddr)); + client_ident.htype = ip->hw_address.htype; + client_ident.hlen = hwlen; + memcpy(client_ident.haddr, ip->hw_address.haddr, hwlen); options[DHO_DHCP_CLIENT_IDENTIFIER] = &option_elements[DHO_DHCP_CLIENT_IDENTIFIER]; - options[DHO_DHCP_CLIENT_IDENTIFIER]->value = client_ident; - options[DHO_DHCP_CLIENT_IDENTIFIER]->len = hwlen+1; - options[DHO_DHCP_CLIENT_IDENTIFIER]->buf_size = hwlen+1; + options[DHO_DHCP_CLIENT_IDENTIFIER]->value = (void *)&client_ident; + hwlen += offsetof(struct hardware, haddr); + options[DHO_DHCP_CLIENT_IDENTIFIER]->len = hwlen; + options[DHO_DHCP_CLIENT_IDENTIFIER]->buf_size = hwlen; options[DHO_DHCP_CLIENT_IDENTIFIER]->timeout = 0x; } @@ -1605,8 +1609,8 @@ make_discover(struct interface_info *ip, 0, sizeof(ip->client->packet.siaddr)); memset(&(ip->client->packet.giaddr), 0, sizeof(ip->client->packet.giaddr)); - memcpy(ip->client->packet.chaddr, - ip->hw_address.haddr, ip->hw_address.hlen); + memcpy(ip->client->packet.chaddr, ip->hw_address.haddr, + MIN(ip->hw_address.hlen, sizeof(ip->client->packet.chaddr))); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299511 - head/lib/libc/tests/stdio
Author: cem Date: Thu May 12 04:08:45 2016 New Revision: 299511 URL: https://svnweb.freebsd.org/changeset/base/299511 Log: print_positional_test: Fix misuse of wchar APIs These APIs take unit length, not byte length parameters. Reported by: Coverity CIDs: 1338543, 1338544, 1338545 Sponsored by: EMC / Isilon Storage Division Modified: head/lib/libc/tests/stdio/print_positional_test.c Modified: head/lib/libc/tests/stdio/print_positional_test.c == --- head/lib/libc/tests/stdio/print_positional_test.c Thu May 12 03:53:20 2016(r299510) +++ head/lib/libc/tests/stdio/print_positional_test.c Thu May 12 04:08:45 2016(r299511) @@ -32,6 +32,7 @@ #include __FBSDID("$FreeBSD$"); +#include #include #include #include @@ -94,7 +95,7 @@ ATF_TC_WITHOUT_HEAD(positional_wide); ATF_TC_BODY(positional_wide, tc) { - swprintf(wbuf1, sizeof wbuf1, + swprintf(wbuf1, nitems(wbuf1), L"|xx %1$s %2$s %3$s %4$s\n" "|xx %5$s %6$s %7$s %8$s\n" "|xx %9$s %10$s %11$s %12$s\n" @@ -117,7 +118,7 @@ ATF_TC_BODY(positional_wide, tc) "43", "44", 45, -1L, 1LL, -1, 1LL ); temp = correct; - mbsrtowcs(wbuf2, &temp, sizeof wbuf2, NULL); + mbsrtowcs(wbuf2, &temp, nitems(wbuf2), NULL); ATF_REQUIRE_MSG(wcscmp(wbuf1, wbuf2) == 0, "buffers didn't match"); } @@ -139,7 +140,7 @@ ATF_TC_BODY(positional_precision_wide, t swprintf(wbuf1, sizeof buf, L"%2$.*4$s %2$.*3$s %1$s", "BSD", "bsd", 2, 1); temp = correct2; - mbsrtowcs(wbuf2, &temp, sizeof wbuf2, NULL); + mbsrtowcs(wbuf2, &temp, nitems(wbuf2), NULL); ATF_REQUIRE_MSG(wcscmp(wbuf1, wbuf2) == 0, "buffers didn't match"); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299510 - head/lib/libmp
Author: cem Date: Thu May 12 03:53:20 2016 New Revision: 299510 URL: https://svnweb.freebsd.org/changeset/base/299510 Log: libmp: Fix trivial buffer overrun fgetln yields a non-NUL-terminated buffer and its length. This routine attempted to NUL-terminate it, but did not allocate space for the NUL. So, allocate space for the NUL. Reported by: Coverity CID: 1017457 Sponsored by: EMC / Isilon Storage Division Modified: head/lib/libmp/mpasbn.c Modified: head/lib/libmp/mpasbn.c == --- head/lib/libmp/mpasbn.c Thu May 12 03:49:05 2016(r299509) +++ head/lib/libmp/mpasbn.c Thu May 12 03:53:20 2016(r299510) @@ -286,10 +286,10 @@ mp_min(MINT *mp) line = fgetln(stdin, &linelen); if (line == NULL) MPERR(("min")); - nline = malloc(linelen); + nline = malloc(linelen + 1); if (nline == NULL) MPERR(("min")); - strncpy(nline, line, linelen); + memcpy(nline, line, linelen); nline[linelen] = '\0'; rmp = _dtom("min", nline); _movem("min", rmp, mp); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299509 - head/usr.bin/rpcgen
Author: cem Date: Thu May 12 03:49:05 2016 New Revision: 299509 URL: https://svnweb.freebsd.org/changeset/base/299509 Log: rpcgen(1): Tag crash() routine as __dead2 for static analyzers Suggested by: Coverity CID: 1305464 Sponsored by: EMC / Isilon Storage Division Modified: head/usr.bin/rpcgen/rpc_util.c head/usr.bin/rpcgen/rpc_util.h Modified: head/usr.bin/rpcgen/rpc_util.c == --- head/usr.bin/rpcgen/rpc_util.c Thu May 12 03:44:29 2016 (r299508) +++ head/usr.bin/rpcgen/rpc_util.c Thu May 12 03:49:05 2016 (r299509) @@ -261,7 +261,7 @@ error(const char *msg) * Something went wrong, unlink any files that we may have created and then * die. */ -void +void __dead2 crash(void) { int i; Modified: head/usr.bin/rpcgen/rpc_util.h == --- head/usr.bin/rpcgen/rpc_util.h Thu May 12 03:44:29 2016 (r299508) +++ head/usr.bin/rpcgen/rpc_util.h Thu May 12 03:49:05 2016 (r299509) @@ -152,7 +152,7 @@ extern pid_t childpid; * rpc_util routines */ void reinitialize(void); -void crash(void); +void crash(void) __dead2; void add_type(int len, const char *type); void storeval(list **lstp, definition *val); void *xmalloc(size_t size); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r299502 - head/lib/libc/tests/nss
On Wed, May 11, 2016 at 7:32 PM, Conrad E. Meyer wrote: > Author: cem > Date: Thu May 12 02:32:23 2016 > New Revision: 299502 > URL: https://svnweb.freebsd.org/changeset/base/299502 > > Log: > nss/gethostby_test: fix broken vector iteration of gethostbyaddr h_aliases > > h_aliases is a NULL-terminated rather than fixed-length array. nitems() is > not > a valid way to determine its end; instead, check for NULL. > > Reported by: Coverity > CID: 1346578 > Sponsored by: EMC / Isilon Storage Division > > Modified: > head/lib/libc/tests/nss/gethostby_test.c ugh... thanks... ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299508 - head/tests/sys/kern
Author: cem Date: Thu May 12 03:44:29 2016 New Revision: 299508 URL: https://svnweb.freebsd.org/changeset/base/299508 Log: kern_descrip_test: Fix trivial buffer overrun with readlink(2) Reported by: Coverity CID: 1229965, 1229972 Sponsored by: EMC / Isilon Storage Division Modified: head/tests/sys/kern/kern_descrip_test.c Modified: head/tests/sys/kern/kern_descrip_test.c == --- head/tests/sys/kern/kern_descrip_test.c Thu May 12 03:37:17 2016 (r299507) +++ head/tests/sys/kern/kern_descrip_test.c Thu May 12 03:44:29 2016 (r299508) @@ -27,6 +27,7 @@ #include __FBSDID("$FreeBSD$"); +#include #include #include #include @@ -170,7 +171,7 @@ ATF_TC_CLEANUP(kern_maxfiles__increase, char buf[80]; if ((n = readlink(VALUE, buf, sizeof(buf))) > 0) { - buf[n] = '\0'; + buf[MIN((size_t)n, sizeof(buf) - 1)] = '\0'; if (sscanf(buf, "%d", &oldmaxfiles) == 1) { oldlen = sizeof(oldmaxfiles); (void) sysctlbyname("kern.maxfiles", NULL, 0, ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299507 - head/usr.sbin/rtadvd
Author: cem Date: Thu May 12 03:37:17 2016 New Revision: 299507 URL: https://svnweb.freebsd.org/changeset/base/299507 Log: rtadvd(8): Fix a typo in full msg receive logic Check against the size of the struct, not the pointer. Previously, a message with a cm_len between 9 and 23 (inclusive) could cause int msglen to underflow and read(2) to be invoked with msglen size (implicitly cast to signed), overrunning the caller-provided buffer. All users of cm_recv() supply a stack buffer. On the other hand, the rtadvd control socket appears to only be writable by the owner, who is probably root. While here, correct some types to be size_t or ssize_t. Reported by: Coverity CID: 1008477 Security: unix socket remotes may overflow stack in rtadvd Sponsored by: EMC / Isilon Storage Division Modified: head/usr.sbin/rtadvd/control.c Modified: head/usr.sbin/rtadvd/control.c == --- head/usr.sbin/rtadvd/control.c Thu May 12 03:36:49 2016 (r299506) +++ head/usr.sbin/rtadvd/control.c Thu May 12 03:37:17 2016 (r299507) @@ -59,7 +59,7 @@ int cm_recv(int fd, char *buf) { - int n; + ssize_t n; struct ctrl_msg_hdr *cm; char *msg; struct pollfd pfds[1]; @@ -98,7 +98,7 @@ cm_recv(int fd, char *buf) } } - if (n != sizeof(*cm)) { + if (n != (ssize_t)sizeof(*cm)) { syslog(LOG_WARNING, "<%s> received a too small message.", __func__); goto cm_recv_err; @@ -123,11 +123,11 @@ cm_recv(int fd, char *buf) "<%s> ctrl msg received: type=%d", __func__, cm->cm_type); - if (cm->cm_len > sizeof(cm)) { - int msglen = cm->cm_len - sizeof(*cm); + if (cm->cm_len > sizeof(*cm)) { + size_t msglen = cm->cm_len - sizeof(*cm); syslog(LOG_DEBUG, - "<%s> ctrl msg has payload (len=%d)", __func__, + "<%s> ctrl msg has payload (len=%zu)", __func__, msglen); for (;;) { @@ -153,7 +153,7 @@ cm_recv(int fd, char *buf) } break; } - if (n != msglen) { + if (n != (ssize_t)msglen) { syslog(LOG_WARNING, "<%s> payload size mismatch.", __func__); goto cm_recv_err; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299506 - head/sys/dev/mxge
Author: sephe Date: Thu May 12 03:36:49 2016 New Revision: 299506 URL: https://svnweb.freebsd.org/changeset/base/299506 Log: mxge: Setup mbuf flowid before calling tcp_lro_rx(). Reviewed by: gallatin MFC after:1 week Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D6320 Modified: head/sys/dev/mxge/if_mxge.c Modified: head/sys/dev/mxge/if_mxge.c == --- head/sys/dev/mxge/if_mxge.c Thu May 12 03:29:29 2016(r299505) +++ head/sys/dev/mxge/if_mxge.c Thu May 12 03:36:49 2016(r299506) @@ -2702,8 +2702,12 @@ mxge_rx_done_big(struct mxge_slice_state if (eh->ether_type == htons(ETHERTYPE_VLAN)) { mxge_vlan_tag_remove(m, &csum); } + /* flowid only valid if RSS hashing is enabled */ + if (sc->num_slices > 1) { + m->m_pkthdr.flowid = (ss - sc->ss); + M_HASHTYPE_SET(m, M_HASHTYPE_OPAQUE); + } /* if the checksum is valid, mark it in the mbuf header */ - if ((ifp->if_capenable & (IFCAP_RXCSUM_IPV6 | IFCAP_RXCSUM)) && (0 == mxge_rx_csum(m, csum))) { /* Tell the stack that the checksum is good */ @@ -2716,11 +2720,6 @@ mxge_rx_done_big(struct mxge_slice_state return; #endif } - /* flowid only valid if RSS hashing is enabled */ - if (sc->num_slices > 1) { - m->m_pkthdr.flowid = (ss - sc->ss); - M_HASHTYPE_SET(m, M_HASHTYPE_OPAQUE); - } /* pass the frame up the stack */ (*ifp->if_input)(ifp, m); } @@ -2771,6 +2770,11 @@ mxge_rx_done_small(struct mxge_slice_sta if (eh->ether_type == htons(ETHERTYPE_VLAN)) { mxge_vlan_tag_remove(m, &csum); } + /* flowid only valid if RSS hashing is enabled */ + if (sc->num_slices > 1) { + m->m_pkthdr.flowid = (ss - sc->ss); + M_HASHTYPE_SET(m, M_HASHTYPE_OPAQUE); + } /* if the checksum is valid, mark it in the mbuf header */ if ((ifp->if_capenable & (IFCAP_RXCSUM_IPV6 | IFCAP_RXCSUM)) && (0 == mxge_rx_csum(m, csum))) { @@ -2784,11 +2788,6 @@ mxge_rx_done_small(struct mxge_slice_sta return; #endif } - /* flowid only valid if RSS hashing is enabled */ - if (sc->num_slices > 1) { - m->m_pkthdr.flowid = (ss - sc->ss); - M_HASHTYPE_SET(m, M_HASHTYPE_OPAQUE); - } /* pass the frame up the stack */ (*ifp->if_input)(ifp, m); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299505 - head/sys/dev/hyperv/storvsc
Author: sephe Date: Thu May 12 03:29:29 2016 New Revision: 299505 URL: https://svnweb.freebsd.org/changeset/base/299505 Log: hyperv/stor: Enable INQUIRY result check only on WIN10 like host systems On WIN8 like host systems, when rescan happens, the already installed disks seem to return random invalid results for INQUIRY. More investigation is under way to figure out why random invalid INQUIRY results are delivered to VM on WIN8 like host systems. Submitted by: Hongjiang Zhang Reviewed by: sephe MFC after:1 week Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D6316 Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c head/sys/dev/hyperv/storvsc/hv_vstorage.h Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c == --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cThu May 12 02:46:29 2016(r299504) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cThu May 12 03:29:29 2016(r299505) @@ -81,12 +81,6 @@ __FBSDID("$FreeBSD$"); #define BLKVSC_MAX_IO_REQUESTS STORVSC_MAX_IO_REQUESTS #define STORVSC_MAX_TARGETS(2) -#define STORVSC_WIN7_MAJOR 4 -#define STORVSC_WIN7_MINOR 2 - -#define STORVSC_WIN8_MAJOR 5 -#define STORVSC_WIN8_MINOR 1 - #define VSTOR_PKT_SIZE (sizeof(struct vstor_packet) - vmscsi_size_delta) #define HV_ALIGN(x, a) roundup2(x, a) @@ -207,7 +201,7 @@ static struct storvsc_driver_props g_drv * Sense buffer size changed in win8; have a run-time * variable to track the size we should use. */ -static int sense_buffer_size; +static int sense_buffer_size = PRE_WIN8_STORVSC_SENSE_BUFFER_SIZE; /* * The size of the vmscsi_request has changed in win8. The @@ -217,9 +211,46 @@ static int sense_buffer_size; * Track the correct size we need to apply. */ static int vmscsi_size_delta; +/* + * The storage protocol version is determined during the + * initial exchange with the host. It will indicate which + * storage functionality is available in the host. +*/ +static int vmstor_proto_version; + +struct vmstor_proto { +int proto_version; +int sense_buffer_size; +int vmscsi_size_delta; +}; -static int storvsc_current_major; -static int storvsc_current_minor; +static const struct vmstor_proto vmstor_proto_list[] = { +{ +VMSTOR_PROTOCOL_VERSION_WIN10, +POST_WIN7_STORVSC_SENSE_BUFFER_SIZE, +0 +}, +{ +VMSTOR_PROTOCOL_VERSION_WIN8_1, +POST_WIN7_STORVSC_SENSE_BUFFER_SIZE, +0 +}, +{ +VMSTOR_PROTOCOL_VERSION_WIN8, +POST_WIN7_STORVSC_SENSE_BUFFER_SIZE, +0 +}, +{ +VMSTOR_PROTOCOL_VERSION_WIN7, +PRE_WIN8_STORVSC_SENSE_BUFFER_SIZE, +sizeof(struct vmscsi_win8_extension), +}, +{ +VMSTOR_PROTOCOL_VERSION_WIN6, +PRE_WIN8_STORVSC_SENSE_BUFFER_SIZE, +sizeof(struct vmscsi_win8_extension), +} +}; /* static functions */ static int storvsc_probe(device_t dev); @@ -427,7 +458,7 @@ storvsc_send_multichannel_request(struct static int hv_storvsc_channel_init(struct hv_device *dev) { - int ret = 0; + int ret = 0, i; struct hv_storvsc_request *request; struct vstor_packet *vstor_packet; struct storvsc_softc *sc; @@ -476,19 +507,20 @@ hv_storvsc_channel_init(struct hv_device goto cleanup; } - /* reuse the packet for version range supported */ + for (i = 0; i < nitems(vmstor_proto_list); i++) { + /* reuse the packet for version range supported */ - memset(vstor_packet, 0, sizeof(struct vstor_packet)); - vstor_packet->operation = VSTOR_OPERATION_QUERYPROTOCOLVERSION; - vstor_packet->flags = REQUEST_COMPLETION_FLAG; + memset(vstor_packet, 0, sizeof(struct vstor_packet)); + vstor_packet->operation = VSTOR_OPERATION_QUERYPROTOCOLVERSION; + vstor_packet->flags = REQUEST_COMPLETION_FLAG; - vstor_packet->u.version.major_minor = - VMSTOR_PROTOCOL_VERSION(storvsc_current_major, storvsc_current_minor); + vstor_packet->u.version.major_minor = + vmstor_proto_list[i].proto_version; - /* revision is only significant for Windows guests */ - vstor_packet->u.version.revision = 0; + /* revision is only significant for Windows guests */ + vstor_packet->u.version.revision = 0; - ret = hv_vmbus_channel_send_packet( + ret = hv_vmbus_channel_send_packet( dev->channel, vstor_packet, VSTOR_PKT_SIZE, @@ -496,20 +528,34 @@ hv_storvs
svn commit: r299504 - head/sys/dev/sound/pci/hda
Author: cem Date: Thu May 12 02:46:29 2016 New Revision: 299504 URL: https://svnweb.freebsd.org/changeset/base/299504 Log: snd_hda(4): Don't pass bogus sizeof()s to unused sysctl arg2 parameter (again) More of the same sort of issue as r299503, just missed some sysctls added in a different place than the others. Reported by: Coverity CIDs: 1007692, 1009677, 1009678 Sponsored by: EMC / Isilon Storage Division Modified: head/sys/dev/sound/pci/hda/hdaa.c Modified: head/sys/dev/sound/pci/hda/hdaa.c == --- head/sys/dev/sound/pci/hda/hdaa.c Thu May 12 02:41:38 2016 (r299503) +++ head/sys/dev/sound/pci/hda/hdaa.c Thu May 12 02:46:29 2016 (r299504) @@ -1553,20 +1553,20 @@ hdaa_widget_parse(struct hdaa_widget *w) SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, buf, CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, - w, sizeof(w), hdaa_sysctl_caps, "A", "Node capabilities"); + w, 0, hdaa_sysctl_caps, "A", "Node capabilities"); if (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) { snprintf(buf, sizeof(buf), "nid%d_config", w->nid); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, buf, CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE, - &w->wclass.pin.newconf, sizeof(&w->wclass.pin.newconf), - hdaa_sysctl_config, "A", "Current pin configuration"); + &w->wclass.pin.newconf, 0, hdaa_sysctl_config, "A", + "Current pin configuration"); snprintf(buf, sizeof(buf), "nid%d_original", w->nid); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, buf, CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, - &w->wclass.pin.original, sizeof(&w->wclass.pin.original), - hdaa_sysctl_config, "A", "Original pin configuration"); + &w->wclass.pin.original, 0, hdaa_sysctl_config, "A", + "Original pin configuration"); } hdaa_lock(w->devinfo); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299503 - head/sys/dev/sound/pci/hda
Author: cem Date: Thu May 12 02:41:38 2016 New Revision: 299503 URL: https://svnweb.freebsd.org/changeset/base/299503 Log: snd_hda(4): Don't pass bogus sizeof()s to unused sysctl arg2 parameter None of the sysctl handlers in hdaa use the arg2 parameter, so just pass zero instead. Additionally, the sizes being passed in were suspect (size of the pointer rather than the value). Reported by: Coverity CIDs: 1007694, 1009679 Sponsored by: EMC / Isilon Storage Division Modified: head/sys/dev/sound/pci/hda/hdaa.c Modified: head/sys/dev/sound/pci/hda/hdaa.c == --- head/sys/dev/sound/pci/hda/hdaa.c Thu May 12 02:32:23 2016 (r299502) +++ head/sys/dev/sound/pci/hda/hdaa.c Thu May 12 02:41:38 2016 (r299503) @@ -6641,38 +6641,32 @@ hdaa_attach(device_t dev) SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "config", CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE, - &devinfo->newquirks, sizeof(&devinfo->newquirks), - hdaa_sysctl_quirks, "A", "Configuration options"); + &devinfo->newquirks, 0, hdaa_sysctl_quirks, "A", + "Configuration options"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "gpi_state", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, - devinfo, sizeof(devinfo), - hdaa_sysctl_gpi_state, "A", "GPI state"); + devinfo, 0, hdaa_sysctl_gpi_state, "A", "GPI state"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "gpio_state", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, - devinfo, sizeof(devinfo), - hdaa_sysctl_gpio_state, "A", "GPIO state"); + devinfo, 0, hdaa_sysctl_gpio_state, "A", "GPIO state"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "gpio_config", CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE, - devinfo, sizeof(devinfo), - hdaa_sysctl_gpio_config, "A", "GPIO configuration"); + devinfo, 0, hdaa_sysctl_gpio_config, "A", "GPIO configuration"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "gpo_state", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, - devinfo, sizeof(devinfo), - hdaa_sysctl_gpo_state, "A", "GPO state"); + devinfo, 0, hdaa_sysctl_gpo_state, "A", "GPO state"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "gpo_config", CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE, - devinfo, sizeof(devinfo), - hdaa_sysctl_gpo_config, "A", "GPO configuration"); + devinfo, 0, hdaa_sysctl_gpo_config, "A", "GPO configuration"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "reconfig", CTLTYPE_INT | CTLFLAG_RW, - dev, sizeof(dev), - hdaa_sysctl_reconfig, "I", "Reprocess configuration"); + dev, 0, hdaa_sysctl_reconfig, "I", "Reprocess configuration"); bus_generic_attach(dev); return (0); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299502 - head/lib/libc/tests/nss
Author: cem Date: Thu May 12 02:32:23 2016 New Revision: 299502 URL: https://svnweb.freebsd.org/changeset/base/299502 Log: nss/gethostby_test: fix broken vector iteration of gethostbyaddr h_aliases h_aliases is a NULL-terminated rather than fixed-length array. nitems() is not a valid way to determine its end; instead, check for NULL. Reported by: Coverity CID: 1346578 Sponsored by: EMC / Isilon Storage Division Modified: head/lib/libc/tests/nss/gethostby_test.c Modified: head/lib/libc/tests/nss/gethostby_test.c == --- head/lib/libc/tests/nss/gethostby_test.cThu May 12 02:05:50 2016 (r299501) +++ head/lib/libc/tests/nss/gethostby_test.cThu May 12 02:32:23 2016 (r299502) @@ -893,7 +893,7 @@ hostent_test_getnameinfo_eq(struct hoste printf("matched official hostname\n"); #endif } else { - for (i = 0; i < nitems(result->h_aliases); i++) { + for (i = 0; result->h_aliases[i] != NULL; i++) { printf("[%d] resolved: %s\n", i, result->h_aliases[i]); if (strcmp(result->h_aliases[i], ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299501 - head/usr.sbin/traceroute6
Author: pfg Date: Thu May 12 02:05:50 2016 New Revision: 299501 URL: https://svnweb.freebsd.org/changeset/base/299501 Log: traceroute6(8): use NULL instead of zero for initializing a pointer. Modified: head/usr.sbin/traceroute6/traceroute6.c Modified: head/usr.sbin/traceroute6/traceroute6.c == --- head/usr.sbin/traceroute6/traceroute6.c Thu May 12 02:02:16 2016 (r299500) +++ head/usr.sbin/traceroute6/traceroute6.c Thu May 12 02:05:50 2016 (r299501) @@ -342,7 +342,7 @@ struct ip6_rthdr *rth; #endif struct cmsghdr *cmsg; -char *source = 0; +char *source = NULL; char *hostname; u_long nprobes = 3; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299500 - head/usr.bin/chat
Author: pfg Date: Thu May 12 02:02:16 2016 New Revision: 299500 URL: https://svnweb.freebsd.org/changeset/base/299500 Log: chat(8): use NULL instead of zero for initializing a pointer. Modified: head/usr.bin/chat/chat.c Modified: head/usr.bin/chat/chat.c == --- head/usr.bin/chat/chat.cThu May 12 01:19:11 2016(r299499) +++ head/usr.bin/chat/chat.cThu May 12 02:02:16 2016(r299500) @@ -1401,7 +1401,7 @@ vfmtmsg(char *buf, int buflen, const cha } } } - str = 0; + str = NULL; base = 0; neg = 0; ++fmt; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299499 - head/sys/boot/common
Author: pfg Date: Thu May 12 01:19:11 2016 New Revision: 299499 URL: https://svnweb.freebsd.org/changeset/base/299499 Log: sys/boot/common: use of spaces vs. TAB. No functional change. Modified: head/sys/boot/common/interp_backslash.c head/sys/boot/common/interp_forth.c head/sys/boot/common/isapnp.c head/sys/boot/common/module.c Modified: head/sys/boot/common/interp_backslash.c == --- head/sys/boot/common/interp_backslash.c Thu May 12 00:46:38 2016 (r299498) +++ head/sys/boot/common/interp_backslash.c Thu May 12 01:19:11 2016 (r299499) @@ -21,7 +21,7 @@ __FBSDID("$FreeBSD$"); #include #include "bootstrap.h" -#define DIGIT(x) (isdigit(x) ? (x) - '0' : islower(x) ? (x) + 10 - 'a' : (x) + 10 - 'A') +#defineDIGIT(x) (isdigit(x) ? (x) - '0' : islower(x) ? (x) + 10 - 'a' : (x) + 10 - 'A') /* * backslash: Return malloc'd copy of str with all standard "backslash @@ -146,20 +146,20 @@ backslash(char *str) break; } } -else { -if (*str == '\\') { -seenbs = 1; -str++; -} + else { + if (*str == '\\') { + seenbs = 1; + str++; + } else new_str[i++] = *str++; -} + } } if (seenbs) { -/* - * The final character was a '\'. Put it in as a single backslash. - */ + /* +* The final character was a '\'. Put it in as a single backslash. +*/ new_str[i++] = '\\'; } new_str[i] = '\0'; Modified: head/sys/boot/common/interp_forth.c == --- head/sys/boot/common/interp_forth.c Thu May 12 00:46:38 2016 (r299498) +++ head/sys/boot/common/interp_forth.c Thu May 12 01:19:11 2016 (r299499) @@ -38,9 +38,9 @@ extern char bootprog_rev[]; /* #define BFORTH_DEBUG */ #ifdef BFORTH_DEBUG -# define DEBUG(fmt, args...) printf("%s: " fmt "\n" , __func__ , ## args) +#defineDEBUG(fmt, args...) printf("%s: " fmt "\n" , __func__ , ## args) #else -# define DEBUG(fmt, args...) +#defineDEBUG(fmt, args...) #endif /* Modified: head/sys/boot/common/isapnp.c == --- head/sys/boot/common/isapnp.c Thu May 12 00:46:38 2016 (r299498) +++ head/sys/boot/common/isapnp.c Thu May 12 01:19:11 2016 (r299499) @@ -37,8 +37,8 @@ __FBSDID("$FreeBSD$"); #include #include -#define inb(x) (archsw.arch_isainb((x))) -#define outb(x,y) (archsw.arch_isaoutb((x),(y))) +#defineinb(x) (archsw.arch_isainb((x))) +#defineoutb(x,y) (archsw.arch_isaoutb((x),(y))) static voidisapnp_write(int d, int r); static voidisapnp_send_Initiation_LFSR(void); @@ -49,7 +49,7 @@ static void isapnp_enumerate(void); /* PnP read data port */ intisapnp_readport = 0; -#define _PNP_ID_LEN9 +#define_PNP_ID_LEN 9 struct pnphandler isapnphandler = { @@ -129,20 +129,20 @@ isapnp_get_resource_info(u_int8_t *buffe u_char temp; for (i = 0; i < len; i++) { -outb(_PNP_ADDRESS, STATUS); -for (j = 0; j < 100; j++) { -if ((inb(isapnp_readport)) & 0x1) -break; -delay(1); -} -if (j == 100) { -printf("PnP device failed to report resource data\n"); -return(1); -} -outb(_PNP_ADDRESS, RESOURCE_DATA); -temp = inb(isapnp_readport); -if (buffer != NULL) -buffer[i] = temp; + outb(_PNP_ADDRESS, STATUS); + for (j = 0; j < 100; j++) { + if ((inb(isapnp_readport)) & 0x1) + break; + delay(1); + } + if (j == 100) { + printf("PnP device failed to report resource data\n"); + return(1); + } + outb(_PNP_ADDRESS, RESOURCE_DATA); + temp = inb(isapnp_readport); + if (buffer != NULL) + buffer[i] = temp; } return(0); } @@ -166,27 +166,27 @@ isapnp_scan_resdata(struct pnpinfo *pi) limit = 1000; while ((limit-- > 0) && !isapnp_get_resource_info(&tag, 1)) { -if (PNP_RES_TYPE(tag) == 0) { -/* Small resource */ -switch (PNP_SRES_NUM(tag)) { - -case COMP_DEVICE_ID: -/* Got a compatible device id resource */ -if (isapnp_get_resource_info(resinfo, PNP_SRES_LEN(tag))) + if (PNP_RES_TYPE(tag) == 0) { + /* Small resource */ + switch (PNP_SRES_NUM(tag)) { + + case COMP_DEVICE_ID: + /* Got a compatible device id resource */ + if (isapnp_get_resource_info(resinfo, PNP_SRES_LEN(tag)))
svn commit: r299498 - in stable/9/sys/geom: journal raid
Author: pfg Date: Thu May 12 00:46:38 2016 New Revision: 299498 URL: https://svnweb.freebsd.org/changeset/base/299498 Log: MFC r298755: sys/geom: spelling fixes. These affect debugging messages. Modified: stable/9/sys/geom/journal/g_journal.h stable/9/sys/geom/raid/g_raid_ctl.c stable/9/sys/geom/raid/md_ddf.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/geom/journal/g_journal.h == --- stable/9/sys/geom/journal/g_journal.h Thu May 12 00:45:57 2016 (r299497) +++ stable/9/sys/geom/journal/g_journal.h Thu May 12 00:46:38 2016 (r299498) @@ -224,7 +224,7 @@ struct g_journal_entry { #defineGJ_VALIDATE_OFFSET(offset, sc) do { \ if ((offset) + GJ_RECORD_MAX_SIZE(sc) >= (sc)->sc_jend) { \ (offset) = (sc)->sc_jstart; \ - GJ_DEBUG(2, "Starting from the begining (%s).", \ + GJ_DEBUG(2, "Starting from the beginning (%s).", \ (sc)->sc_name); \ } \ } while (0) Modified: stable/9/sys/geom/raid/g_raid_ctl.c == --- stable/9/sys/geom/raid/g_raid_ctl.c Thu May 12 00:45:57 2016 (r299497) +++ stable/9/sys/geom/raid/g_raid_ctl.c Thu May 12 00:46:38 2016 (r299498) @@ -117,7 +117,7 @@ g_raid_ctl_label(struct gctl_req *req, s } format = gctl_get_asciiparam(req, "arg0"); if (format == NULL) { - gctl_error(req, "No format recieved."); + gctl_error(req, "No format received."); return; } crstatus = g_raid_create_node_format(format, req, &geom); @@ -164,7 +164,7 @@ g_raid_ctl_stop(struct gctl_req *req, st } nodename = gctl_get_asciiparam(req, "arg0"); if (nodename == NULL) { - gctl_error(req, "No array name recieved."); + gctl_error(req, "No array name received."); return; } sc = g_raid_find_node(mp, nodename); @@ -204,7 +204,7 @@ g_raid_ctl_other(struct gctl_req *req, s } nodename = gctl_get_asciiparam(req, "arg0"); if (nodename == NULL) { - gctl_error(req, "No array name recieved."); + gctl_error(req, "No array name received."); return; } sc = g_raid_find_node(mp, nodename); Modified: stable/9/sys/geom/raid/md_ddf.c == --- stable/9/sys/geom/raid/md_ddf.c Thu May 12 00:45:57 2016 (r299497) +++ stable/9/sys/geom/raid/md_ddf.c Thu May 12 00:46:38 2016 (r299498) @@ -257,7 +257,7 @@ g_raid_md_ddf_print(struct ddf_meta *met printf("BBM Log %u:%u\n", GET32(meta, hdr->bbmlog_section), GET32(meta, hdr->bbmlog_length)); printf("Diagnostic Space %u:%u\n", GET32(meta, hdr->Diagnostic_Space), GET32(meta, hdr->Diagnostic_Space_Length)); printf("Vendor_Specific_Logs %u:%u\n", GET32(meta, hdr->Vendor_Specific_Logs), GET32(meta, hdr->Vendor_Specific_Logs_Length)); - printf(" Controler Data \n"); + printf(" Controller Data \n"); printf("Controller_GUID "); print_guid(meta->cdr->Controller_GUID); printf("\n"); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299497 - in stable/10/sys/geom: journal raid
Author: pfg Date: Thu May 12 00:45:57 2016 New Revision: 299497 URL: https://svnweb.freebsd.org/changeset/base/299497 Log: MFC r298755: sys/geom: spelling fixes. These affect debugging messages. Modified: stable/10/sys/geom/journal/g_journal.h stable/10/sys/geom/raid/g_raid_ctl.c stable/10/sys/geom/raid/md_ddf.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/geom/journal/g_journal.h == --- stable/10/sys/geom/journal/g_journal.h Wed May 11 23:39:39 2016 (r299496) +++ stable/10/sys/geom/journal/g_journal.h Thu May 12 00:45:57 2016 (r299497) @@ -224,7 +224,7 @@ struct g_journal_entry { #defineGJ_VALIDATE_OFFSET(offset, sc) do { \ if ((offset) + GJ_RECORD_MAX_SIZE(sc) >= (sc)->sc_jend) { \ (offset) = (sc)->sc_jstart; \ - GJ_DEBUG(2, "Starting from the begining (%s).", \ + GJ_DEBUG(2, "Starting from the beginning (%s).", \ (sc)->sc_name); \ } \ } while (0) Modified: stable/10/sys/geom/raid/g_raid_ctl.c == --- stable/10/sys/geom/raid/g_raid_ctl.cWed May 11 23:39:39 2016 (r299496) +++ stable/10/sys/geom/raid/g_raid_ctl.cThu May 12 00:45:57 2016 (r299497) @@ -117,7 +117,7 @@ g_raid_ctl_label(struct gctl_req *req, s } format = gctl_get_asciiparam(req, "arg0"); if (format == NULL) { - gctl_error(req, "No format recieved."); + gctl_error(req, "No format received."); return; } crstatus = g_raid_create_node_format(format, req, &geom); @@ -164,7 +164,7 @@ g_raid_ctl_stop(struct gctl_req *req, st } nodename = gctl_get_asciiparam(req, "arg0"); if (nodename == NULL) { - gctl_error(req, "No array name recieved."); + gctl_error(req, "No array name received."); return; } sc = g_raid_find_node(mp, nodename); @@ -204,7 +204,7 @@ g_raid_ctl_other(struct gctl_req *req, s } nodename = gctl_get_asciiparam(req, "arg0"); if (nodename == NULL) { - gctl_error(req, "No array name recieved."); + gctl_error(req, "No array name received."); return; } sc = g_raid_find_node(mp, nodename); Modified: stable/10/sys/geom/raid/md_ddf.c == --- stable/10/sys/geom/raid/md_ddf.cWed May 11 23:39:39 2016 (r299496) +++ stable/10/sys/geom/raid/md_ddf.cThu May 12 00:45:57 2016 (r299497) @@ -257,7 +257,7 @@ g_raid_md_ddf_print(struct ddf_meta *met printf("BBM Log %u:%u\n", GET32(meta, hdr->bbmlog_section), GET32(meta, hdr->bbmlog_length)); printf("Diagnostic Space %u:%u\n", GET32(meta, hdr->Diagnostic_Space), GET32(meta, hdr->Diagnostic_Space_Length)); printf("Vendor_Specific_Logs %u:%u\n", GET32(meta, hdr->Vendor_Specific_Logs), GET32(meta, hdr->Vendor_Specific_Logs_Length)); - printf(" Controler Data \n"); + printf(" Controller Data \n"); printf("Controller_GUID "); print_guid(meta->cdr->Controller_GUID); printf("\n"); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299496 - head/contrib/atf/atf-c/detail
Author: cem Date: Wed May 11 23:39:39 2016 New Revision: 299496 URL: https://svnweb.freebsd.org/changeset/base/299496 Log: atf map: Fix double-free in low memory error path If atf_list_append(, X, ) fails, X is freed. Don't free it again. If anyone wants to walk this patch upstream, be my guest. I literally cannot upstream it myself due to Google's stupid CLA. Reported by: Coverity CID: 979936 Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/atf/atf-c/detail/map.c Modified: head/contrib/atf/atf-c/detail/map.c == --- head/contrib/atf/atf-c/detail/map.c Wed May 11 23:25:59 2016 (r299495) +++ head/contrib/atf/atf-c/detail/map.c Wed May 11 23:39:39 2016 (r299496) @@ -360,7 +360,6 @@ atf_map_insert(atf_map_t *m, const char if (atf_is_error(err)) { if (managed) free(value); -free(me); } } } else { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299495 - head/crypto/heimdal/lib/krb5
Author: cem Date: Wed May 11 23:25:59 2016 New Revision: 299495 URL: https://svnweb.freebsd.org/changeset/base/299495 Log: libkrb5: Fix potential double-free If krb5_make_principal fails, tmp_creds.server may remain a pointer to freed memory and then be double-freed. After freeing it the first time, initialize it to NULL, which causes subsequent krb5_free_principal calls to do the right thing. Reported by: Coverity CID: 1273430 Sponsored by: EMC / Isilon Storage Division Modified: head/crypto/heimdal/lib/krb5/get_cred.c Modified: head/crypto/heimdal/lib/krb5/get_cred.c == --- head/crypto/heimdal/lib/krb5/get_cred.c Wed May 11 23:16:11 2016 (r299494) +++ head/crypto/heimdal/lib/krb5/get_cred.c Wed May 11 23:25:59 2016 (r299495) @@ -831,6 +831,7 @@ get_cred_kdc_capath_worker(krb5_context if(strcmp(tgt_inst, server_realm) == 0) break; krb5_free_principal(context, tmp_creds.server); + tmp_creds.server = NULL; ret = krb5_make_principal(context, &tmp_creds.server, tgt_inst, KRB5_TGS_NAME, server_realm, NULL); if(ret) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299494 - head/sys/kern
Author: cem Date: Wed May 11 23:16:11 2016 New Revision: 299494 URL: https://svnweb.freebsd.org/changeset/base/299494 Log: subr_vmem: Fix double-free in error case of vmem_create If vmem_init() fails, 'vm' is already destroyed and freed. Don't free it again. Reported by: Coverity CID: 1042110 Sponsored by: EMC / Isilon Storage Division Modified: head/sys/kern/subr_vmem.c Modified: head/sys/kern/subr_vmem.c == --- head/sys/kern/subr_vmem.c Wed May 11 23:00:12 2016(r299493) +++ head/sys/kern/subr_vmem.c Wed May 11 23:16:11 2016(r299494) @@ -1046,10 +1046,8 @@ vmem_create(const char *name, vmem_addr_ if (vm == NULL) return (NULL); if (vmem_init(vm, name, base, size, quantum, qcache_max, - flags) == NULL) { - free(vm, M_VMEM); + flags) == NULL) return (NULL); - } return (vm); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r299467 - in head: share/man/man9 sys/dev/pci
Backed out in r299493. Please re-commit after it compiles. Best, Conrad On Wed, May 11, 2016 at 2:50 PM, Jung-uk Kim wrote: > On 05/11/16 05:38 PM, Bjoern A. Zeeb wrote: >> >>> On 11 May 2016, at 17:07 , Andrew Turner wrote: >>> >>> Author: andrew >>> Date: Wed May 11 17:07:29 2016 >>> New Revision: 299467 >>> URL: https://svnweb.freebsd.org/changeset/base/299467 >>> >>> Log: >>> Add a new get_id interface to pci and pcib. This will allow us to both >>> detect failures, and get different PCI IDs. >>> >>> For the former the interface returns an int to signal an error. The ID is >>> returned at a uintptr_t * argument. >>> >>> For the latter there is a type argument that allows selecting the ID type. >>> This only specifies a single type, however a MSI type will be added >>> to handle the need to find the ID the hardware passes to the ARM GICv3 >>> interrupt controller. >>> >>> A follow up commit will be made to remove pci_get_rid. >>> >>> Reviewed by:jhb, rstone >>> Obtained from: ABT Systems Ltd >>> Sponsored by: The FreeBSD Foundation >>> Differential Revision: https://reviews.freebsd.org/D6239 >> >> Hi, seems gcc, I guess it is, doesn’t like your change: >> >> In file included from /scratch/tmp/bz/head.svn/sys/sparc64/isa/ofw_isa.c:78: >> ./pcib_if.h:166: warning: 'enum pci_id_type' declared inside parameter list >> ./pcib_if.h:166: warning: its scope is only this definition or declaration, >> which is probably not what you want >> ./pcib_if.h:169: warning: 'enum pci_id_type' declared inside parameter list >> ./pcib_if.h:169: error: parameter 3 ('type') has incomplete type >> ./pcib_if.h: In function 'PCIB_GET_ID': >> ./pcib_if.h:173: error: type of formal parameter 3 is incomplete > > Clang also fails: > > In file included from /usr/src/sys/dev/acpica/acpi_hpet.c:58: > ./pcib_if.h:165:61: error: declaration of 'enum pci_id_type' will not be > visible outside of this function [-Werror,-Wvisibility] > typedef int pcib_get_id_t(device_t pcib, device_t dev, enum pci_id_type > type, > ^ > ./pcib_if.h:169:38: error: declaration of 'enum pci_id_type' will not be > visible outside of this function [-Werror,-Wvisibility] > enum pci_id_type type, uintptr_t *id) > ^ > ./pcib_if.h:169:50: error: variable has incomplete type 'enum pci_id_type' > enum pci_id_type type, uintptr_t *id) > ^ > ./pcib_if.h:169:38: note: forward declaration of 'enum pci_id_type' > enum pci_id_type type, uintptr_t *id) > ^ > 3 errors generated. > > Jung-uk Kim > ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299493 - in head: share/man/man9 sys/dev/pci
Author: cem Date: Wed May 11 23:00:12 2016 New Revision: 299493 URL: https://svnweb.freebsd.org/changeset/base/299493 Log: Revert r299467 to fix the kernel build. $ svn merge -c -299467 . Approved by: build being broken for six hours Modified: head/share/man/man9/Makefile head/share/man/man9/pci.9 head/sys/dev/pci/pci.c head/sys/dev/pci/pci_if.m head/sys/dev/pci/pci_pci.c head/sys/dev/pci/pcib_if.m head/sys/dev/pci/pcib_private.h head/sys/dev/pci/pcib_support.c head/sys/dev/pci/pcivar.h Modified: head/share/man/man9/Makefile == --- head/share/man/man9/MakefileWed May 11 22:44:00 2016 (r299492) +++ head/share/man/man9/MakefileWed May 11 23:00:12 2016 (r299493) @@ -1290,7 +1290,6 @@ MLINKS+=pci.9 pci_alloc_msi.9 \ pci.9 pci_find_extcap.9 \ pci.9 pci_find_htcap.9 \ pci.9 pci_find_pcie_root_port.9 \ - pci.9 pci_get_id.9 \ pci.9 pci_get_max_read_req.9 \ pci.9 pci_get_powerstate.9 \ pci.9 pci_get_vpd_ident.9 \ Modified: head/share/man/man9/pci.9 == --- head/share/man/man9/pci.9 Wed May 11 22:44:00 2016(r299492) +++ head/share/man/man9/pci.9 Wed May 11 23:00:12 2016(r299493) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 11, 2016 +.Dd December 23, 2015 .Dt PCI 9 .Os .Sh NAME @@ -43,7 +43,6 @@ .Nm pci_find_extcap , .Nm pci_find_htcap , .Nm pci_find_pcie_root_port , -.Nm pci_get_id , .Nm pci_get_max_read_req , .Nm pci_get_powerstate , .Nm pci_get_vpd_ident , @@ -98,8 +97,6 @@ .Ft device_t .Fn pci_find_pcie_root_port "device_t dev" .Ft int -.Fn pci_get_id "device_t dev" "enum pci_id_type type" "uintptr_t *id" -.Ft int .Fn pci_get_max_read_req "device_t dev" .Ft int .Fn pci_get_powerstate "device_t dev" @@ -360,18 +357,6 @@ returns .Dv NULL . .Pp The -.Fn pci_get_id -function is used to read an identifier from a device. -The -.Fa type -flag is used to specify which identifier to read. -The following flags are supported: -.Bl -hang -width ".Dv PCI_ID_RID" -.It Dv PCI_ID_RID -Read the routing identifier for the device. -.El -.Pp -The .Fn pci_get_vpd_ident function is used to fetch a device's Vital Product Data .Pq VPD Modified: head/sys/dev/pci/pci.c == --- head/sys/dev/pci/pci.c Wed May 11 22:44:00 2016(r299492) +++ head/sys/dev/pci/pci.c Wed May 11 23:00:12 2016(r299493) @@ -122,8 +122,7 @@ static void pci_resume_msix(device_t de static int pci_remap_intr_method(device_t bus, device_t dev, u_int irq); -static int pci_get_id_method(device_t dev, device_t child, - enum pci_id_type type, uintptr_t *rid); +static uint16_tpci_get_rid_method(device_t dev, device_t child); static struct pci_devinfo * pci_fill_devinfo(device_t pcib, device_t bus, int d, int b, int s, int f, uint16_t vid, uint16_t did); @@ -191,7 +190,7 @@ static device_method_t pci_methods[] = { DEVMETHOD(pci_msix_count, pci_msix_count_method), DEVMETHOD(pci_msix_pba_bar, pci_msix_pba_bar_method), DEVMETHOD(pci_msix_table_bar, pci_msix_table_bar_method), - DEVMETHOD(pci_get_id, pci_get_id_method), + DEVMETHOD(pci_get_rid, pci_get_rid_method), DEVMETHOD(pci_alloc_devinfo,pci_alloc_devinfo_method), DEVMETHOD(pci_child_added, pci_child_added_method), #ifdef PCI_IOV @@ -5824,12 +5823,11 @@ pci_restore_state(device_t dev) pci_cfg_restore(dev, dinfo); } -static int -pci_get_id_method(device_t dev, device_t child, enum pci_id_type type, -uintptr_t *id) +static uint16_t +pci_get_rid_method(device_t dev, device_t child) { - return (PCIB_GET_ID(device_get_parent(dev), child, type, id)); + return (PCIB_GET_RID(device_get_parent(dev), child)); } /* Find the upstream port of a given PCI device in a root complex. */ Modified: head/sys/dev/pci/pci_if.m == --- head/sys/dev/pci/pci_if.m Wed May 11 22:44:00 2016(r299492) +++ head/sys/dev/pci/pci_if.m Wed May 11 23:00:12 2016(r299493) @@ -27,7 +27,6 @@ # #include -#include INTERFACE pci; @@ -209,11 +208,9 @@ METHOD int msix_table_bar { device_tchild; } DEFAULT null_msix_bar; -METHOD int get_id { +METHOD uint16_t get_rid { device_tdev; device_tchild; - enum pci_id_type type; - uintptr_t *id; }; METHOD struct pci_devinfo * alloc_devinfo { Modified: head/sys/dev/pci/pci_pci.c == --- head/sys/dev/pci/pci_pci.c Wed May 11 22:4
svn commit: r299492 - head/release/doc/en_US.ISO8859-1/relnotes
Author: skreuzer (doc,ports committer) Date: Wed May 11 22:44:00 2016 New Revision: 299492 URL: https://svnweb.freebsd.org/changeset/base/299492 Log: Document r298695, ntp updated to 4.2.8p7. Approved by: gjb@ (implicit with re@ hat on) Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml == --- head/release/doc/en_US.ISO8859-1/relnotes/article.xml Wed May 11 22:33:20 2016(r299491) +++ head/release/doc/en_US.ISO8859-1/relnotes/article.xml Wed May 11 22:44:00 2016(r299492) @@ -174,8 +174,8 @@ The MK_ARM_EABI &man.src.conf.5; option has been removed. - The ntp suite - has been updated to version 4.2.8p3. + The ntp suite + has been updated to version 4.2.8p7. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299491 - head/usr.sbin/route6d
Author: cem Date: Wed May 11 22:33:20 2016 New Revision: 299491 URL: https://svnweb.freebsd.org/changeset/base/299491 Log: route6d(8): Fix potential double-free In the case that the subsequent sysctl(3) call failed, 'buf' could be free(3)ed repeatedly. It isn't clear to me that that case is possible, but be clear and do the right thing in case it is. Reported by: Coverity CID: 272537 Sponsored by: EMC / Isilon Storage Division Modified: head/usr.sbin/route6d/route6d.c Modified: head/usr.sbin/route6d/route6d.c == --- head/usr.sbin/route6d/route6d.c Wed May 11 22:25:14 2016 (r299490) +++ head/usr.sbin/route6d/route6d.c Wed May 11 22:33:20 2016 (r299491) @@ -2598,8 +2598,10 @@ krtread(int again) sleep(1); retry++; errmsg = NULL; - if (buf) + if (buf) { free(buf); + buf = NULL; + } if (sysctl(mib, 6, NULL, &msize, NULL, 0) < 0) { errmsg = "sysctl estimate"; continue; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299490 - head/sbin/camcontrol
Author: cem Date: Wed May 11 22:25:14 2016 New Revision: 299490 URL: https://svnweb.freebsd.org/changeset/base/299490 Log: camcontrol(8): Fix another trivial double-free Reported by: Coverity CID: 1331222 Sponsored by: EMC / Isilon Storage Division Modified: head/sbin/camcontrol/fwdownload.c Modified: head/sbin/camcontrol/fwdownload.c == --- head/sbin/camcontrol/fwdownload.c Wed May 11 22:22:49 2016 (r299489) +++ head/sbin/camcontrol/fwdownload.c Wed May 11 22:25:14 2016 (r299490) @@ -488,6 +488,7 @@ fw_validate_ibm(struct cam_device *dev, CAM_EPF_ALL, stderr); cam_freeccb(ccb); + ccb = NULL; goto bailout; } @@ -549,7 +550,8 @@ fw_validate_ibm(struct cam_device *dev, fprintf(stdout, "Firmware file is valid for this drive.\n"); retval = 0; bailout: - cam_freeccb(ccb); + if (ccb != NULL) + cam_freeccb(ccb); return (retval); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299489 - head/sbin/camcontrol
Author: cem Date: Wed May 11 22:22:49 2016 New Revision: 299489 URL: https://svnweb.freebsd.org/changeset/base/299489 Log: camcontrol(8): Fix trival double-free Reported by: Coverity CID: 1331223 Sponsored by: EMC / Isilon Storage Division Modified: head/sbin/camcontrol/camcontrol.c Modified: head/sbin/camcontrol/camcontrol.c == --- head/sbin/camcontrol/camcontrol.c Wed May 11 22:13:50 2016 (r299488) +++ head/sbin/camcontrol/camcontrol.c Wed May 11 22:22:49 2016 (r299489) @@ -4994,6 +4994,7 @@ dev_has_vpd_page(struct cam_device *dev, if (cam_send_ccb(dev, ccb) < 0) { cam_freeccb(ccb); + ccb = NULL; retval = -1; goto bailout; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299488 - stable/9/bin/sh
Author: vangyzen Date: Wed May 11 22:13:50 2016 New Revision: 299488 URL: https://svnweb.freebsd.org/changeset/base/299488 Log: MFC r299035: sh: Handle empty hostname and $PWD when building prompt If the hostname is empty and \h is used in $PS1, the remainder of the prompt following \h will be empty. Likewise for $PWD and \w. Fix it. Modified: stable/9/bin/sh/parser.c Directory Properties: stable/9/bin/sh/ (props changed) Modified: stable/9/bin/sh/parser.c == --- stable/9/bin/sh/parser.cWed May 11 22:11:37 2016(r299487) +++ stable/9/bin/sh/parser.cWed May 11 22:13:50 2016(r299488) @@ -1982,8 +1982,9 @@ getprompt(void *unused __unused) gethostname(&ps[i], PROMPTLEN - i); /* Skip to end of hostname. */ trim = (*fmt == 'h') ? '.' : '\0'; - while ((ps[i+1] != '\0') && (ps[i+1] != trim)) + while ((ps[i] != '\0') && (ps[i] != trim)) i++; + --i; break; /* @@ -1995,7 +1996,7 @@ getprompt(void *unused __unused) case 'W': case 'w': pwd = lookupvar("PWD"); - if (pwd == NULL) + if (pwd == NULL || *pwd == '\0') pwd = "?"; if (*fmt == 'W' && *pwd == '/' && pwd[1] != '\0') ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299484 - head/usr.bin/random
Author: cem Date: Wed May 11 22:04:28 2016 New Revision: 299484 URL: https://svnweb.freebsd.org/changeset/base/299484 Log: random(6): Fix double-close In the case where a file lacks a trailing newline, there is some "evil" code to reverse goto the tokenizing code ("make_token") for the final token in the file. In this case, 'fd' is closed more than once. Use a negative sentinel value to guard close(2), preventing the double close. Ideally, this code would be restructured to avoid this ugly construction. Reported by: Coverity CID: 1006123 Sponsored by: EMC / Isilon Storage Division Modified: head/usr.bin/random/randomize_fd.c Modified: head/usr.bin/random/randomize_fd.c == --- head/usr.bin/random/randomize_fd.c Wed May 11 21:35:58 2016 (r299483) +++ head/usr.bin/random/randomize_fd.c Wed May 11 22:04:28 2016 (r299484) @@ -174,7 +174,7 @@ randomize_fd(int fd, int type, int uniqu if ((type == RANDOM_TYPE_LINES && buf[i] == '\n') || (type == RANDOM_TYPE_WORDS && isspace(buf[i])) || (eof && i == buflen - 1)) { - make_token: +make_token: if (numnode == RANDOM_MAX_PLUS1) { errno = EFBIG; err(1, "too many delimiters"); @@ -199,7 +199,10 @@ randomize_fd(int fd, int type, int uniqu } } - (void)close(fd); + if (fd >= 0) { + (void)close(fd); + fd = -1; + } /* Necessary evil to compensate for files that don't end with a newline */ if (bufc != i) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299487 - stable/10/bin/sh
Author: vangyzen Date: Wed May 11 22:11:37 2016 New Revision: 299487 URL: https://svnweb.freebsd.org/changeset/base/299487 Log: MFC r299035: sh: Handle empty hostname and $PWD when building prompt If the hostname is empty and \h is used in $PS1, the remainder of the prompt following \h will be empty. Likewise for $PWD and \w. Fix it. Modified: stable/10/bin/sh/parser.c Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/sh/parser.c == --- stable/10/bin/sh/parser.c Wed May 11 22:07:05 2016(r299486) +++ stable/10/bin/sh/parser.c Wed May 11 22:11:37 2016(r299487) @@ -1990,8 +1990,9 @@ getprompt(void *unused __unused) gethostname(&ps[i], PROMPTLEN - i); /* Skip to end of hostname. */ trim = (*fmt == 'h') ? '.' : '\0'; - while ((ps[i+1] != '\0') && (ps[i+1] != trim)) + while ((ps[i] != '\0') && (ps[i] != trim)) i++; + --i; break; /* @@ -2003,7 +2004,7 @@ getprompt(void *unused __unused) case 'W': case 'w': pwd = lookupvar("PWD"); - if (pwd == NULL) + if (pwd == NULL || *pwd == '\0') pwd = "?"; if (*fmt == 'W' && *pwd == '/' && pwd[1] != '\0') ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r299466 - head/contrib/bsnmp/snmpd
On Wed, May 11, 2016 at 10:06 AM, Conrad E. Meyer wrote: > Author: cem > Date: Wed May 11 17:06:03 2016 > New Revision: 299466 > URL: https://svnweb.freebsd.org/changeset/base/299466 > > Log: > bsnmpd: Fix size of trapsink::comm to match other community arrays > > This fixes a number of possible strcpy() buffer overruns between the various > community strings in trap.c. > > Reported by: Coverity > CIDs: 1006820, 1006821, 1006822 > Sponsored by: EMC / Isilon Storage Division Thanks! ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299486 - stable/9/sys/x86/acpica
Author: vangyzen Date: Wed May 11 22:07:05 2016 New Revision: 299486 URL: https://svnweb.freebsd.org/changeset/base/299486 Log: MFC r299004: Work around (ignore) broken SRAT tables Modified: stable/9/sys/x86/acpica/srat.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/x86/acpica/srat.c == --- stable/9/sys/x86/acpica/srat.c Wed May 11 22:06:28 2016 (r299485) +++ stable/9/sys/x86/acpica/srat.c Wed May 11 22:07:05 2016 (r299486) @@ -104,8 +104,12 @@ srat_parse_entry(ACPI_SUBTABLE_HEADER *e "enabled" : "disabled"); if (!(cpu->Flags & ACPI_SRAT_CPU_ENABLED)) break; - KASSERT(!cpus[cpu->ApicId].enabled, - ("Duplicate local APIC ID %u", cpu->ApicId)); + if (cpus[cpu->ApicId].enabled) { + printf("SRAT: Duplicate local APIC ID %u\n", + cpu->ApicId); + *(int *)arg = ENXIO; + break; + } cpus[cpu->ApicId].domain = domain; cpus[cpu->ApicId].enabled = 1; break; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299485 - stable/10/sys/x86/acpica
Author: vangyzen Date: Wed May 11 22:06:28 2016 New Revision: 299485 URL: https://svnweb.freebsd.org/changeset/base/299485 Log: MFC r299004: Work around (ignore) broken SRAT tables Modified: stable/10/sys/x86/acpica/srat.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/x86/acpica/srat.c == --- stable/10/sys/x86/acpica/srat.c Wed May 11 22:04:28 2016 (r299484) +++ stable/10/sys/x86/acpica/srat.c Wed May 11 22:06:28 2016 (r299485) @@ -108,8 +108,12 @@ srat_parse_entry(ACPI_SUBTABLE_HEADER *e "enabled" : "disabled"); if (!(cpu->Flags & ACPI_SRAT_CPU_ENABLED)) break; - KASSERT(!cpus[cpu->ApicId].enabled, - ("Duplicate local APIC ID %u", cpu->ApicId)); + if (cpus[cpu->ApicId].enabled) { + printf("SRAT: Duplicate local APIC ID %u\n", + cpu->ApicId); + *(int *)arg = ENXIO; + break; + } cpus[cpu->ApicId].domain = domain; cpus[cpu->ApicId].enabled = 1; break; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r299467 - in head: share/man/man9 sys/dev/pci
On 05/11/16 05:38 PM, Bjoern A. Zeeb wrote: > >> On 11 May 2016, at 17:07 , Andrew Turner wrote: >> >> Author: andrew >> Date: Wed May 11 17:07:29 2016 >> New Revision: 299467 >> URL: https://svnweb.freebsd.org/changeset/base/299467 >> >> Log: >> Add a new get_id interface to pci and pcib. This will allow us to both >> detect failures, and get different PCI IDs. >> >> For the former the interface returns an int to signal an error. The ID is >> returned at a uintptr_t * argument. >> >> For the latter there is a type argument that allows selecting the ID type. >> This only specifies a single type, however a MSI type will be added >> to handle the need to find the ID the hardware passes to the ARM GICv3 >> interrupt controller. >> >> A follow up commit will be made to remove pci_get_rid. >> >> Reviewed by:jhb, rstone >> Obtained from: ABT Systems Ltd >> Sponsored by: The FreeBSD Foundation >> Differential Revision: https://reviews.freebsd.org/D6239 > > Hi, seems gcc, I guess it is, doesn’t like your change: > > In file included from /scratch/tmp/bz/head.svn/sys/sparc64/isa/ofw_isa.c:78: > ./pcib_if.h:166: warning: 'enum pci_id_type' declared inside parameter list > ./pcib_if.h:166: warning: its scope is only this definition or declaration, > which is probably not what you want > ./pcib_if.h:169: warning: 'enum pci_id_type' declared inside parameter list > ./pcib_if.h:169: error: parameter 3 ('type') has incomplete type > ./pcib_if.h: In function 'PCIB_GET_ID': > ./pcib_if.h:173: error: type of formal parameter 3 is incomplete Clang also fails: In file included from /usr/src/sys/dev/acpica/acpi_hpet.c:58: ./pcib_if.h:165:61: error: declaration of 'enum pci_id_type' will not be visible outside of this function [-Werror,-Wvisibility] typedef int pcib_get_id_t(device_t pcib, device_t dev, enum pci_id_type type, ^ ./pcib_if.h:169:38: error: declaration of 'enum pci_id_type' will not be visible outside of this function [-Werror,-Wvisibility] enum pci_id_type type, uintptr_t *id) ^ ./pcib_if.h:169:50: error: variable has incomplete type 'enum pci_id_type' enum pci_id_type type, uintptr_t *id) ^ ./pcib_if.h:169:38: note: forward declaration of 'enum pci_id_type' enum pci_id_type type, uintptr_t *id) ^ 3 errors generated. Jung-uk Kim signature.asc Description: OpenPGP digital signature
Re: svn commit: r299467 - in head: share/man/man9 sys/dev/pci
> On 11 May 2016, at 17:07 , Andrew Turner wrote: > > Author: andrew > Date: Wed May 11 17:07:29 2016 > New Revision: 299467 > URL: https://svnweb.freebsd.org/changeset/base/299467 > > Log: > Add a new get_id interface to pci and pcib. This will allow us to both > detect failures, and get different PCI IDs. > > For the former the interface returns an int to signal an error. The ID is > returned at a uintptr_t * argument. > > For the latter there is a type argument that allows selecting the ID type. > This only specifies a single type, however a MSI type will be added > to handle the need to find the ID the hardware passes to the ARM GICv3 > interrupt controller. > > A follow up commit will be made to remove pci_get_rid. > > Reviewed by: jhb, rstone > Obtained from: ABT Systems Ltd > Sponsored by:The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D6239 Hi, seems gcc, I guess it is, doesn’t like your change: In file included from /scratch/tmp/bz/head.svn/sys/sparc64/isa/ofw_isa.c:78: ./pcib_if.h:166: warning: 'enum pci_id_type' declared inside parameter list ./pcib_if.h:166: warning: its scope is only this definition or declaration, which is probably not what you want ./pcib_if.h:169: warning: 'enum pci_id_type' declared inside parameter list ./pcib_if.h:169: error: parameter 3 ('type') has incomplete type ./pcib_if.h: In function 'PCIB_GET_ID': ./pcib_if.h:173: error: type of formal parameter 3 is incomplete ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299483 - stable/10/usr.sbin/pw
Author: markj Date: Wed May 11 21:35:58 2016 New Revision: 299483 URL: https://svnweb.freebsd.org/changeset/base/299483 Log: MFC r296300: Fix a typo that prevented pw(8) from setting a user's UID to 0. Modified: stable/10/usr.sbin/pw/pw_user.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/pw/pw_user.c == --- stable/10/usr.sbin/pw/pw_user.c Wed May 11 21:14:36 2016 (r299482) +++ stable/10/usr.sbin/pw/pw_user.c Wed May 11 21:35:58 2016 (r299483) @@ -1654,7 +1654,7 @@ pw_user_mod(int argc, char **argv, char } } - if (id > 0 && pwd->pw_uid != id) { + if (id >= 0 && pwd->pw_uid != id) { pwd->pw_uid = id; edited = true; if (pwd->pw_uid != 0 && strcmp(pwd->pw_name, "root") == 0) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299482 - head/sys/sys
Author: emaste Date: Wed May 11 21:14:36 2016 New Revision: 299482 URL: https://svnweb.freebsd.org/changeset/base/299482 Log: exec.h: Move PS_STRINGS define to kernel-only section The kern.ps_strings sysctl was introduced in r103767 and the last use of PS_STRINGS in userspace code was removed in r297888. PR: 208760 [exp-run] Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D5933 Modified: head/sys/sys/exec.h Modified: head/sys/sys/exec.h == --- head/sys/sys/exec.h Wed May 11 20:11:21 2016(r299481) +++ head/sys/sys/exec.h Wed May 11 21:14:36 2016(r299482) @@ -58,13 +58,6 @@ struct ps_strings { unsigned int ps_nenvstr; /* the number of environment strings */ }; -/* - * Address of ps_strings structure (in user space). - * Prefer the kern.ps_strings or kern.proc.ps_strings sysctls to this constant. - */ -#definePS_STRINGS (USRSTACK - sizeof(struct ps_strings)) -#define SPARE_USRSPACE 4096 - struct image_params; struct execsw { @@ -77,6 +70,13 @@ struct execsw { #ifdef _KERNEL #include +/* + * Address of ps_strings structure (in user space). + * Prefer the kern.ps_strings or kern.proc.ps_strings sysctls to this constant. + */ +#definePS_STRINGS (USRSTACK - sizeof(struct ps_strings)) +#defineSPARE_USRSPACE 4096 + int exec_map_first_page(struct image_params *); void exec_unmap_first_page(struct image_params *); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r299480 - head/secure/lib/libcrypto
On 05/11/16 04:43 PM, Ed Maste wrote: > On 11 May 2016 at 16:06, Jung-uk Kim wrote: >> Author: jkim >> Date: Wed May 11 20:06:23 2016 >> New Revision: 299480 >> URL: https://svnweb.freebsd.org/changeset/base/299480 >> > [...] >> ( echo '# $$'FreeBSD'$$' ;\ >> echo '# Do not modify. This file is auto-generated from >> ${.IMPSRC:T}.' ;\ >> echo '#ifdef PIC' ;\ >> - perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} -fpic -DPIC ;\ >> + env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} -fpic -DPIC ;\ >> echo '#else' ;\ >> - perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} ;\ >> + env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} ;\ > > One thing that occurred to me in the older PIC change here: perhaps we > should explicitly strip -fpic / -DPIC from the passed-in ${CFLAGS} for > the #else. It's unlikely, but possible, that a user could regenerate > the assembly files with -fpic set in CFLAGS. No user serviceable parts inside. ;-) Seriously, there's no need for overengineering this file. Jung-uk Kim signature.asc Description: OpenPGP digital signature
Re: svn commit: r299480 - head/secure/lib/libcrypto
On 11 May 2016 at 16:06, Jung-uk Kim wrote: > Author: jkim > Date: Wed May 11 20:06:23 2016 > New Revision: 299480 > URL: https://svnweb.freebsd.org/changeset/base/299480 > [...] > ( echo '# $$'FreeBSD'$$' ;\ > echo '# Do not modify. This file is auto-generated from > ${.IMPSRC:T}.' ;\ > echo '#ifdef PIC' ;\ > - perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} -fpic -DPIC ;\ > + env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} -fpic -DPIC ;\ > echo '#else' ;\ > - perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} ;\ > + env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} ;\ One thing that occurred to me in the older PIC change here: perhaps we should explicitly strip -fpic / -DPIC from the passed-in ${CFLAGS} for the #else. It's unlikely, but possible, that a user could regenerate the assembly files with -fpic set in CFLAGS. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r299389 - in head/secure/lib/libcrypto: . i386
On 05/11/16 03:56 AM, Konstantin Belousov wrote: > BTW, amd64 needs similar treatment. Amd64, due to presence of the > pc-relative data addressing mode, usually require relocations much less > than i386, but I think it is better to handle the amd64 variant now as > well. Unfortunately, we cannot do that easily because Perl scripts to generate amd64 assembly files do not take compiler options as an argument. :-( Jung-uk Kim signature.asc Description: OpenPGP digital signature
svn commit: r299481 - in head/secure/lib/libcrypto: amd64 i386
Author: jkim Date: Wed May 11 20:11:21 2016 New Revision: 299481 URL: https://svnweb.freebsd.org/changeset/base/299481 Log: Regen x86 assembly files for r299480. Modified: head/secure/lib/libcrypto/amd64/aes-x86_64.S head/secure/lib/libcrypto/amd64/aesni-gcm-x86_64.S head/secure/lib/libcrypto/amd64/aesni-mb-x86_64.S head/secure/lib/libcrypto/amd64/aesni-sha1-x86_64.S head/secure/lib/libcrypto/amd64/aesni-sha256-x86_64.S head/secure/lib/libcrypto/amd64/aesni-x86_64.S head/secure/lib/libcrypto/amd64/bsaes-x86_64.S head/secure/lib/libcrypto/amd64/cmll-x86_64.S head/secure/lib/libcrypto/amd64/ecp_nistz256-x86_64.S head/secure/lib/libcrypto/amd64/ghash-x86_64.S head/secure/lib/libcrypto/amd64/md5-x86_64.S head/secure/lib/libcrypto/amd64/rc4-md5-x86_64.S head/secure/lib/libcrypto/amd64/rc4-x86_64.S head/secure/lib/libcrypto/amd64/rsaz-avx2.S head/secure/lib/libcrypto/amd64/rsaz-x86_64.S head/secure/lib/libcrypto/amd64/sha1-mb-x86_64.S head/secure/lib/libcrypto/amd64/sha1-x86_64.S head/secure/lib/libcrypto/amd64/sha256-mb-x86_64.S head/secure/lib/libcrypto/amd64/sha256-x86_64.S head/secure/lib/libcrypto/amd64/sha512-x86_64.S head/secure/lib/libcrypto/amd64/vpaes-x86_64.S head/secure/lib/libcrypto/amd64/wp-x86_64.S head/secure/lib/libcrypto/amd64/x86_64-gf2m.S head/secure/lib/libcrypto/amd64/x86_64-mont.S head/secure/lib/libcrypto/amd64/x86_64-mont5.S head/secure/lib/libcrypto/amd64/x86_64cpuid.S head/secure/lib/libcrypto/i386/aes-586.S head/secure/lib/libcrypto/i386/aesni-x86.S head/secure/lib/libcrypto/i386/bf-586.S head/secure/lib/libcrypto/i386/bf-686.S head/secure/lib/libcrypto/i386/bn-586.S head/secure/lib/libcrypto/i386/cmll-x86.S head/secure/lib/libcrypto/i386/co-586.S head/secure/lib/libcrypto/i386/crypt586.S head/secure/lib/libcrypto/i386/des-586.S head/secure/lib/libcrypto/i386/ghash-x86.S head/secure/lib/libcrypto/i386/md5-586.S head/secure/lib/libcrypto/i386/rc4-586.S head/secure/lib/libcrypto/i386/rc5-586.S head/secure/lib/libcrypto/i386/rmd-586.S head/secure/lib/libcrypto/i386/sha1-586.S head/secure/lib/libcrypto/i386/sha256-586.S head/secure/lib/libcrypto/i386/sha512-586.S head/secure/lib/libcrypto/i386/vpaes-x86.S head/secure/lib/libcrypto/i386/wp-mmx.S head/secure/lib/libcrypto/i386/x86-gf2m.S head/secure/lib/libcrypto/i386/x86-mont.S head/secure/lib/libcrypto/i386/x86cpuid.S Modified: head/secure/lib/libcrypto/amd64/aes-x86_64.S == --- head/secure/lib/libcrypto/amd64/aes-x86_64.SWed May 11 20:06:23 2016(r299480) +++ head/secure/lib/libcrypto/amd64/aes-x86_64.SWed May 11 20:11:21 2016(r299481) @@ -1,4 +1,5 @@ - # $FreeBSD$ +# $FreeBSD$ +# Do not modify. This file is auto-generated from aes-x86_64.pl. .text .type _x86_64_AES_encrypt,@function .align 16 Modified: head/secure/lib/libcrypto/amd64/aesni-gcm-x86_64.S == --- head/secure/lib/libcrypto/amd64/aesni-gcm-x86_64.S Wed May 11 20:06:23 2016(r299480) +++ head/secure/lib/libcrypto/amd64/aesni-gcm-x86_64.S Wed May 11 20:11:21 2016(r299481) @@ -1,16 +1,755 @@ - # $FreeBSD$ +# $FreeBSD$ +# Do not modify. This file is auto-generated from aesni-gcm-x86_64.pl. .text -.globl aesni_gcm_encrypt -.type aesni_gcm_encrypt,@function -aesni_gcm_encrypt: - xorl%eax,%eax - .byte 0xf3,0xc3 -.size aesni_gcm_encrypt,.-aesni_gcm_encrypt +.type _aesni_ctr32_ghash_6x,@function +.align 32 +_aesni_ctr32_ghash_6x: + vmovdqu 32(%r11),%xmm2 + subq$6,%rdx + vpxor %xmm4,%xmm4,%xmm4 + vmovdqu 0-128(%rcx),%xmm15 + vpaddb %xmm2,%xmm1,%xmm10 + vpaddb %xmm2,%xmm10,%xmm11 + vpaddb %xmm2,%xmm11,%xmm12 + vpaddb %xmm2,%xmm12,%xmm13 + vpaddb %xmm2,%xmm13,%xmm14 + vpxor %xmm15,%xmm1,%xmm9 + vmovdqu %xmm4,16+8(%rsp) + jmp .Loop6x + +.align 32 +.Loop6x: + addl$100663296,%ebx + jc .Lhandle_ctr32 + vmovdqu 0-32(%r9),%xmm3 + vpaddb %xmm2,%xmm14,%xmm1 + vpxor %xmm15,%xmm10,%xmm10 + vpxor %xmm15,%xmm11,%xmm11 + +.Lresume_ctr32: + vmovdqu %xmm1,(%r8) + vpclmulqdq $0x10,%xmm3,%xmm7,%xmm5 + vpxor %xmm15,%xmm12,%xmm12 + vmovups 16-128(%rcx),%xmm2 + vpclmulqdq $0x01,%xmm3,%xmm7,%xmm6 + xorq%r12,%r12 + cmpq%r14,%r15 + + vaesenc %xmm2,%xmm9,%xmm9 + vmovdqu 48+8(%rsp),%xmm0 + vpxor %xmm15,%xmm13,%xmm13 + vpclmulqdq $0x00,%xmm3,%xmm7,%xmm1 + vaesenc %xmm2,%xmm10,%xmm10 + vpxor %xmm15,%xmm14,%xmm14 + setnc %r12b + vpclmulqdq $0x11,%xmm3,%xmm7,%xmm7 + vaesenc %xmm2,%xmm11,%xmm11 + vmovdqu 16-32(%r9),%xmm3 + negq%r12 + vaesenc %xmm2,%xmm12,%xmm12 + vpxor %xmm5,%xm
svn commit: r299480 - head/secure/lib/libcrypto
Author: jkim Date: Wed May 11 20:06:23 2016 New Revision: 299480 URL: https://svnweb.freebsd.org/changeset/base/299480 Log: Set CC environment variable for Perl scripts. This is for detecting assembler/compiler capabilities, e.g., AVX instructions. Modified: head/secure/lib/libcrypto/Makefile.asm Modified: head/secure/lib/libcrypto/Makefile.asm == --- head/secure/lib/libcrypto/Makefile.asm Wed May 11 19:59:05 2016 (r299479) +++ head/secure/lib/libcrypto/Makefile.asm Wed May 11 20:06:23 2016 (r299480) @@ -66,10 +66,10 @@ CLEANFILES= ${ASM} ${SHA_ASM:S/$/.s/} .pl.S: ( echo '# $$'FreeBSD'$$' ;\ echo '# Do not modify. This file is auto-generated from ${.IMPSRC:T}.' ;\ - perl ${.IMPSRC} elf ) > ${.TARGET} + env CC=cc perl ${.IMPSRC} elf ) > ${.TARGET} ${SHA_TMP}: ${SHA_SRC} - perl ${.ALLSRC} elf ${.TARGET} + env CC=cc perl ${.ALLSRC} elf ${.TARGET} .for s in ${SHA_ASM} ${s}.S: ${s}.s @@ -146,9 +146,9 @@ CLEANFILES= ${ASM} ( echo '# $$'FreeBSD'$$' ;\ echo '# Do not modify. This file is auto-generated from ${.IMPSRC:T}.' ;\ echo '#ifdef PIC' ;\ - perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} -fpic -DPIC ;\ + env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} -fpic -DPIC ;\ echo '#else' ;\ - perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} ;\ + env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} ;\ echo '#endif') |\ sed -E 's|(\.file[[:blank:]]+)".*"|\1"${.TARGET}"|' > ${.TARGET} .endif ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299479 - head/secure/lib/libcrypto
Author: jkim Date: Wed May 11 19:59:05 2016 New Revision: 299479 URL: https://svnweb.freebsd.org/changeset/base/299479 Log: Refine comments to add its origin. Modified: head/secure/lib/libcrypto/Makefile.asm Modified: head/secure/lib/libcrypto/Makefile.asm == --- head/secure/lib/libcrypto/Makefile.asm Wed May 11 18:48:47 2016 (r299478) +++ head/secure/lib/libcrypto/Makefile.asm Wed May 11 19:59:05 2016 (r299479) @@ -44,33 +44,39 @@ SRCS+= aesni-gcm-x86_64.pl ghash-x86_64. SRCS+= rc4-md5-x86_64.pl rc4-x86_64.pl # sha -SRCS+= sha1-mb-x86_64.pl sha1-x86_64.pl sha256-mb-x86_64.pl sha512-x86_64.pl +SRCS+= sha1-mb-x86_64.pl sha1-x86_64.pl sha256-mb-x86_64.pl # whrlpool SRCS+= wp-x86_64.pl -ASM= ${SRCS:S/.pl/.S/} -ASM+= sha256-x86_64.S x86_64cpuid.S +# cpuid +SRCS+= x86_64cpuid.pl -all: ${ASM} +SHA_ASM= sha256-x86_64 sha512-x86_64 +SHA_SRC= sha512-x86_64.pl +SHA_TMP= ${SHA_ASM:S/$/.s/} -CLEANFILES+= ${SRCS:M*.pl:S/.pl$/.cmt/} ${SRCS:M*.pl:S/.pl$/.S/} -CLEANFILES+= sha256-x86_64.cmt sha256-x86_64.S x86_64cpuid.cmt x86_64cpuid.S -.SUFFIXES: .pl .cmt +ASM= ${SRCS:R:S/$/.S/} ${SHA_ASM:S/$/.S/} -.pl.cmt: - ( cd `dirname ${.IMPSRC}`/.. ; perl ${.IMPSRC} ${.OBJDIR}/${.TARGET} ) +all: ${ASM} -.cmt.S: - ( echo '# $$'FreeBSD'$$' ;\ - echo ' # Do not modify. This file is auto-generated.' ;\ - cat ${.IMPSRC} ) > ${.TARGET} +CLEANFILES=${ASM} ${SHA_ASM:S/$/.s/} +.SUFFIXES: .pl -sha256-x86_64.cmt: sha512-x86_64.pl - ( cd `dirname ${.ALLSRC}`/.. ; perl ${.ALLSRC} ${.OBJDIR}/${.TARGET} ) +.pl.S: + ( echo '# $$'FreeBSD'$$' ;\ + echo '# Do not modify. This file is auto-generated from ${.IMPSRC:T}.' ;\ + perl ${.IMPSRC} elf ) > ${.TARGET} + +${SHA_TMP}: ${SHA_SRC} + perl ${.ALLSRC} elf ${.TARGET} -x86_64cpuid.cmt: x86_64cpuid.pl - ( cd `dirname ${.ALLSRC}` ; perl ${.ALLSRC} ${.OBJDIR}/${.TARGET} ) +.for s in ${SHA_ASM} +${s}.S: ${s}.s + ( echo '# $$'FreeBSD'$$' ;\ + echo ' # Do not modify. This file is auto-generated from ${SHA_SRC}.' ;\ + cat ${s}.s ) > ${.TARGET} +.endfor .elif ${MACHINE_CPUARCH} == "i386" @@ -129,16 +135,16 @@ SRCS+=wp-mmx.pl # cpuid SRCS+= x86cpuid.pl -ASM= ${SRCS:S/.pl/.S/} +ASM= ${SRCS:R:S/$/.S/} all: ${ASM} -CLEANFILES+= ${SRCS:M*.pl:S/.pl$/.S/} +CLEANFILES=${ASM} .SUFFIXES: .pl .pl.S: - ( echo '# $$'FreeBSD'$$' ;\ - echo ' # Do not modify. This file is auto-generated.' ;\ + ( echo '# $$'FreeBSD'$$' ;\ + echo '# Do not modify. This file is auto-generated from ${.IMPSRC:T}.' ;\ echo '#ifdef PIC' ;\ perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} -fpic -DPIC ;\ echo '#else' ;\ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299478 - in head/sys/arm64: arm64 include
Author: andrew Date: Wed May 11 18:48:47 2016 New Revision: 299478 URL: https://svnweb.freebsd.org/changeset/base/299478 Log: Call busdma_swi from swi_vm as is done from other architectures. Obtained from:ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/vm_machdep.c head/sys/arm64/include/md_var.h Modified: head/sys/arm64/arm64/vm_machdep.c == --- head/sys/arm64/arm64/vm_machdep.c Wed May 11 18:20:02 2016 (r299477) +++ head/sys/arm64/arm64/vm_machdep.c Wed May 11 18:48:47 2016 (r299478) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -256,5 +257,6 @@ void swi_vm(void *v) { - /* Nothing to do here - busdma bounce buffers are not implemented. */ + if (busdma_swi_pending != 0) + busdma_swi(); } Modified: head/sys/arm64/include/md_var.h == --- head/sys/arm64/include/md_var.h Wed May 11 18:20:02 2016 (r299477) +++ head/sys/arm64/include/md_var.h Wed May 11 18:48:47 2016 (r299478) @@ -41,6 +41,7 @@ extern int vm_page_dump_size; struct dumperinfo; +extern int busdma_swi_pending; void busdma_swi(void); void dump_add_page(vm_paddr_t); void dump_drop_page(vm_paddr_t); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299477 - in head/sys: arm/broadcom/bcm2835 arm/ti arm/ti/cpsw dev/fdt dev/gpio dev/ofw
Author: gonzo Date: Wed May 11 18:20:02 2016 New Revision: 299477 URL: https://svnweb.freebsd.org/changeset/base/299477 Log: Add OF_prop_free function as a counterpart for OF_*prop_alloc - Introduce new OF API function OF_prop_free to free memory allocated by OF_getprop_alloc and OF_getencprop_alloc. Current code just calls free(9) with M_OFWPROP memory class which assumes knowledge about OF_*prop_alloc functions' internals and leads to unneccessary code coupling - Convert some of the free(..., M_OFWPROP) instances to OF_prop_free Files affected by this commit are the ones I was able to test on real hardware. The rest of free(..., M_OFWPROP) instances will be handled with idividual maintainers Reviewed by: andrew Differential Revision:https://reviews.freebsd.org/D6315 Modified: head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c head/sys/arm/ti/cpsw/if_cpsw.c head/sys/arm/ti/ti_adc.c head/sys/arm/ti/ti_hwmods.c head/sys/arm/ti/ti_pinmux.c head/sys/dev/fdt/fdt_clock.c head/sys/dev/fdt/fdt_common.c head/sys/dev/fdt/fdt_pinctrl.c head/sys/dev/gpio/gpiokeys.c head/sys/dev/gpio/gpioled.c head/sys/dev/gpio/ofw_gpiobus.c head/sys/dev/ofw/openfirm.c head/sys/dev/ofw/openfirm.h Modified: head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c == --- head/sys/arm/broadcom/bcm2835/bcm2835_gpio.cWed May 11 18:03:51 2016(r299476) +++ head/sys/arm/broadcom/bcm2835/bcm2835_gpio.cWed May 11 18:20:02 2016(r299477) @@ -632,7 +632,7 @@ bcm_gpio_get_ro_pins(struct bcm_gpio_sof if (npins < 0) return (-1); if (npins == 0) { - free(pins, M_OFWPROP); + OF_prop_free(pins); return (0); } for (i = 0; i < npins; i++) @@ -660,7 +660,7 @@ bcm_gpio_get_ro_pins(struct bcm_gpio_sof printf("%d-%d.\n", range_start, range_stop); else printf("%d.\n", range_start); - free(pins, M_OFWPROP); + OF_prop_free(pins); return (0); } @@ -686,7 +686,7 @@ bcm_gpio_get_reserved_pins(struct bcm_gp return (-1); if (strcmp(name, "reserved") == 0) reserved = node; - free(name, M_OFWPROP); + OF_prop_free(name); node = OF_peer(node); } if (reserved == 0) Modified: head/sys/arm/ti/cpsw/if_cpsw.c == --- head/sys/arm/ti/cpsw/if_cpsw.c Wed May 11 18:03:51 2016 (r299476) +++ head/sys/arm/ti/cpsw/if_cpsw.c Wed May 11 18:20:02 2016 (r299477) @@ -727,10 +727,10 @@ cpsw_get_fdt_data(struct cpsw_softc *sc, if (OF_getprop_alloc(child, "name", 1, (void **)&name) < 0) continue; if (sscanf(name, "slave@%x", &mdio_child_addr) != 1) { - free(name, M_OFWPROP); + OF_prop_free(name); continue; } - free(name, M_OFWPROP); + OF_prop_free(name); if (mdio_child_addr != slave_mdio_addr[port]) continue; Modified: head/sys/arm/ti/ti_adc.c == --- head/sys/arm/ti/ti_adc.cWed May 11 18:03:51 2016(r299476) +++ head/sys/arm/ti/ti_adc.cWed May 11 18:20:02 2016(r299477) @@ -747,11 +747,11 @@ ti_adc_attach(device_t dev) device_printf(sc->sc_dev, "invalid nubmer of ti,wire-config: %d (should be %d)\n", nwire_configs, sc->sc_tsc_wires); - free(wire_configs, M_OFWPROP); + OF_prop_free(wire_configs); return (EINVAL); } err = ti_adc_config_wires(sc, wire_configs, nwire_configs); - free(wire_configs, M_OFWPROP); + OF_prop_free(wire_configs); if (err) return (EINVAL); } @@ -764,7 +764,7 @@ ti_adc_attach(device_t dev) if (sc->sc_adc_nchannels > 0) { for (i = 0; i < sc->sc_adc_nchannels; i++) sc->sc_adc_channels[i] = channels[i]; - free(channels, M_OFWPROP); + OF_prop_free(channels); } } Modified: head/sys/arm/ti/ti_hwmods.c == --- head/sys/arm/ti/ti_hwmods.c Wed May 11 18:03:51 2016(r299476) +++ head/sys/arm/ti/ti_hwmods.c Wed May 11 18:20:02 2016(r299477) @@ -134,7 +134,7 @@ ti_hwmods_get_clock(device_t dev) if (len > 0) device_printf(dev, "WARNING:
svn commit: r299476 - head/usr.bin/whois
Author: cem Date: Wed May 11 18:03:51 2016 New Revision: 299476 URL: https://svnweb.freebsd.org/changeset/base/299476 Log: whois(1): Fix potential double-close and logic mistakes Close the fd the poll error was detected on, rather than the last opened fd, to fix the double-close. Use -1 to make it explict which int variables no longer own socket file descriptors. Actually shrink, rather than grow, the poll timeout to match comment. Reported by: Coverity CID: 1304860, 1305616 Sponsored by: EMC / Isilon Storage Division Modified: head/usr.bin/whois/whois.c Modified: head/usr.bin/whois/whois.c == --- head/usr.bin/whois/whois.c Wed May 11 17:57:26 2016(r299475) +++ head/usr.bin/whois/whois.c Wed May 11 18:03:51 2016(r299476) @@ -316,6 +316,11 @@ connect_to_any_host(struct addrinfo *hos fds[i].fd = s; fds[i].events = POLLERR | POLLHUP | POLLIN | POLLOUT; + /* +* From here until a socket connects, the +* socket fd is owned by the fds[] poll array. +*/ + s = -1; count++; i++; } else { @@ -357,7 +362,7 @@ connect_to_any_host(struct addrinfo *hos * after a new host have been added. */ if (timeout >= 3) - timeout <<= 1; + timeout >>= 1; break; } else if (n < 0) { @@ -377,7 +382,7 @@ connect_to_any_host(struct addrinfo *hos fds[j].revents == 0) continue; if (fds[j].revents & ~(POLLIN | POLLOUT)) { - close(s); + close(fds[j].fd); fds[j].fd = -1; fds[j].events = 0; count--; @@ -385,6 +390,7 @@ connect_to_any_host(struct addrinfo *hos } else if (fds[j].revents & (POLLIN | POLLOUT)) { /* Connect succeeded. */ s = fds[j].fd; + fds[j].fd = -1; goto done; } @@ -401,7 +407,7 @@ connect_to_any_host(struct addrinfo *hos done: /* Close all watched fds except the succeeded one */ for (j = 0; j < i; j++) - if (fds[j].fd != s && fds[j].fd != -1) + if (fds[j].fd != -1) close(fds[j].fd); free(fds); return (s); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299474 - head/share/mk
Author: emaste Date: Wed May 11 17:55:09 2016 New Revision: 299474 URL: https://svnweb.freebsd.org/changeset/base/299474 Log: Deorbit ALLOW_SHARED_TEXTREL We want to avoid .text relocations in shared objects. libcrypto was the only consumer and it is now fixed (as of r299389). Remove the now-unused support for turning off the linker warning. Reviewed by: kib Differential Revision:https://reviews.freebsd.org/D6323 Modified: head/share/mk/bsd.lib.mk Modified: head/share/mk/bsd.lib.mk == --- head/share/mk/bsd.lib.mkWed May 11 17:52:06 2016(r299473) +++ head/share/mk/bsd.lib.mkWed May 11 17:55:09 2016(r299474) @@ -216,14 +216,12 @@ CLEANFILES+= ${SOBJS} _LIBS+=${SHLIB_NAME} SOLINKOPTS+= -shared -Wl,-x -.if !defined(ALLOW_SHARED_TEXTREL) .if defined(LD_FATAL_WARNINGS) && ${LD_FATAL_WARNINGS} == "no" SOLINKOPTS+= -Wl,--no-fatal-warnings .else SOLINKOPTS+= -Wl,--fatal-warnings .endif SOLINKOPTS+= -Wl,--warn-shared-textrel -.endif .if target(beforelinking) beforelinking: ${SOBJS} ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299475 - in head/sys: conf dev/gpio
Author: gonzo Date: Wed May 11 17:57:26 2016 New Revision: 299475 URL: https://svnweb.freebsd.org/changeset/base/299475 Log: Add gpiokeys driver gpiokey driver implements functional subset of gpiokeys device-tree bindings: https://www.kernel.org/doc/Documentation/devicetree/bindings/input/gpio-keys.txt It acts as a virtual keyboard, so keys are visible through kbdmux(4) Driver maps linux scancodes for most common keys to FreeBSD scancodes and also extends spec by introducing freebsd,code property to specify FreeBSD-native scancodes. Reviewed by: mmel, jmcneill Differential Revision:https://reviews.freebsd.org/D6279 Added: head/sys/dev/gpio/gpiokeys.c (contents, props changed) head/sys/dev/gpio/gpiokeys.h (contents, props changed) head/sys/dev/gpio/gpiokeys_codes.c (contents, props changed) Modified: head/sys/conf/files Modified: head/sys/conf/files == --- head/sys/conf/files Wed May 11 17:55:09 2016(r299474) +++ head/sys/conf/files Wed May 11 17:57:26 2016(r299475) @@ -1513,6 +1513,8 @@ dev/gem/if_gem.c optional gem dev/gem/if_gem_pci.c optional gem pci dev/gem/if_gem_sbus.c optional gem sbus dev/gpio/gpiobacklight.c optional gpiobacklight fdt +dev/gpio/gpiokeys.coptional gpiokeys fdt +dev/gpio/gpiokeys_codes.c optional gpiokeys fdt dev/gpio/gpiobus.c optional gpio \ dependency "gpiobus_if.h" dev/gpio/gpioc.c optional gpio \ Added: head/sys/dev/gpio/gpiokeys.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/gpio/gpiokeys.cWed May 11 17:57:26 2016 (r299475) @@ -0,0 +1,1006 @@ +/*- + * Copyright (c) 2015-2016 Oleksandr Tymoshenko + * 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 IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_platform.h" +#include "opt_kbd.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include + +#defineGPIOKEYS_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) +#defineGPIOKEYS_UNLOCK(_sc)mtx_unlock(&(_sc)->sc_mtx) +#defineGPIOKEYS_LOCK_INIT(_sc) \ + mtx_init(&_sc->sc_mtx, device_get_nameunit((_sc)->sc_dev), \ + "gpiokeys", MTX_DEF) +#defineGPIOKEYS_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->sc_mtx); +#defineGPIOKEYS_ASSERT_LOCKED(_sc) mtx_assert(&(_sc)->sc_mtx, MA_OWNED) + +#defineGPIOKEY_LOCK(_key) mtx_lock(&(_key)->mtx) +#defineGPIOKEY_UNLOCK(_key)mtx_unlock(&(_key)->mtx) +#defineGPIOKEY_LOCK_INIT(_key) \ + mtx_init(&(_key)->mtx, "gpiokey", "gpiokey", MTX_DEF) +#defineGPIOKEY_LOCK_DESTROY(_key) mtx_destroy(&(_key)->mtx); + +#defineKEY_PRESS 0 +#defineKEY_RELEASE 0x80 + +#defineSCAN_PRESS0 +#defineSCAN_RELEASE 0x80 +#defineSCAN_CHAR(c)((c) & 0x7f) + +#defineGPIOKEYS_GLOBAL_NMOD 8 /* units */ +#defineGPIOKEYS_GLOBAL_NKEYCODE 6 /* units */ +#defineGPIOKEYS_GLOBAL_IN_BUF_SIZE (2*(GPIOKEYS_GLOBAL_NMOD + (2*GPIOKEYS_GLOBAL_NKEYCODE))) /* bytes */ +#defineGPIOKEYS_GLOBAL_IN_BUF_FULL (GPIOKEYS_GLOBAL_IN_BUF_SIZE / 2) /*
Re: svn commit: r299473 - head/usr.bin/whois
This commit message should have said: "No functional change." (As opposed to the follow-up commit which will come shortly.) Thanks, Conrad On Wed, May 11, 2016 at 10:52 AM, Conrad E. Meyer wrote: > Author: cem > Date: Wed May 11 17:52:06 2016 > New Revision: 299473 > URL: https://svnweb.freebsd.org/changeset/base/299473 > > Log: > whois(1): Pull out async multiple host connection code into a routine > > This logic was added to the whois() function in r281959, but could easily be > its own routine. In this case, I think the abstraction makes both functions > easier to reason about. > > This precedes some Coverity-suggested cleanup. > > Sponsored by: EMC / Isilon Storage Division > > Modified: > head/usr.bin/whois/whois.c > > Modified: head/usr.bin/whois/whois.c > == > --- head/usr.bin/whois/whois.c Wed May 11 17:40:51 2016(r299472) > +++ head/usr.bin/whois/whois.c Wed May 11 17:52:06 2016(r299473) > @@ -285,19 +285,15 @@ s_asprintf(char **ret, const char *forma > va_end(ap); > } > > -static void > -whois(const char *query, const char *hostname, int flags) > +static int > +connect_to_any_host(struct addrinfo *hostres) > { > - FILE *fp; > - struct addrinfo *hostres, *res; > - char *buf, *host, *nhost, *p; > - int s = -1, f; > + struct addrinfo *res; > nfds_t i, j; > - size_t len, count; > + size_t count; > struct pollfd *fds; > - int timeout = 180; > + int timeout = 180, s = -1; > > - hostres = gethostinfo(hostname, 1); > for (res = hostres, count = 0; res; res = res->ai_next) > count++; > fds = calloc(count, sizeof(*fds)); > @@ -401,15 +397,29 @@ whois(const char *query, const char *hos > s = -1; > if (count == 0) > errno = ETIMEDOUT; > -done: > - if (s == -1) > - err(EX_OSERR, "connect()"); > > +done: > /* Close all watched fds except the succeeded one */ > for (j = 0; j < i; j++) > if (fds[j].fd != s && fds[j].fd != -1) > close(fds[j].fd); > free(fds); > + return (s); > +} > + > +static void > +whois(const char *query, const char *hostname, int flags) > +{ > + FILE *fp; > + struct addrinfo *hostres; > + char *buf, *host, *nhost, *p; > + int s, f; > + size_t len, i; > + > + hostres = gethostinfo(hostname, 1); > + s = connect_to_any_host(hostres); > + if (s == -1) > + err(EX_OSERR, "connect()"); > > /* Restore default blocking behavior. */ > if ((f = fcntl(s, F_GETFL)) == -1) > ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299473 - head/usr.bin/whois
Author: cem Date: Wed May 11 17:52:06 2016 New Revision: 299473 URL: https://svnweb.freebsd.org/changeset/base/299473 Log: whois(1): Pull out async multiple host connection code into a routine This logic was added to the whois() function in r281959, but could easily be its own routine. In this case, I think the abstraction makes both functions easier to reason about. This precedes some Coverity-suggested cleanup. Sponsored by: EMC / Isilon Storage Division Modified: head/usr.bin/whois/whois.c Modified: head/usr.bin/whois/whois.c == --- head/usr.bin/whois/whois.c Wed May 11 17:40:51 2016(r299472) +++ head/usr.bin/whois/whois.c Wed May 11 17:52:06 2016(r299473) @@ -285,19 +285,15 @@ s_asprintf(char **ret, const char *forma va_end(ap); } -static void -whois(const char *query, const char *hostname, int flags) +static int +connect_to_any_host(struct addrinfo *hostres) { - FILE *fp; - struct addrinfo *hostres, *res; - char *buf, *host, *nhost, *p; - int s = -1, f; + struct addrinfo *res; nfds_t i, j; - size_t len, count; + size_t count; struct pollfd *fds; - int timeout = 180; + int timeout = 180, s = -1; - hostres = gethostinfo(hostname, 1); for (res = hostres, count = 0; res; res = res->ai_next) count++; fds = calloc(count, sizeof(*fds)); @@ -401,15 +397,29 @@ whois(const char *query, const char *hos s = -1; if (count == 0) errno = ETIMEDOUT; -done: - if (s == -1) - err(EX_OSERR, "connect()"); +done: /* Close all watched fds except the succeeded one */ for (j = 0; j < i; j++) if (fds[j].fd != s && fds[j].fd != -1) close(fds[j].fd); free(fds); + return (s); +} + +static void +whois(const char *query, const char *hostname, int flags) +{ + FILE *fp; + struct addrinfo *hostres; + char *buf, *host, *nhost, *p; + int s, f; + size_t len, i; + + hostres = gethostinfo(hostname, 1); + s = connect_to_any_host(hostres); + if (s == -1) + err(EX_OSERR, "connect()"); /* Restore default blocking behavior. */ if ((f = fcntl(s, F_GETFL)) == -1) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299472 - head/share/mk
Author: bdrewery Date: Wed May 11 17:40:51 2016 New Revision: 299472 URL: https://svnweb.freebsd.org/changeset/base/299472 Log: DIRDEPS_BUILD: Exclude host tools for Makefile.depend.host as well. Sponsored by: EMC / Isilon Storage Division Modified: head/share/mk/local.gendirdeps.mk Modified: head/share/mk/local.gendirdeps.mk == --- head/share/mk/local.gendirdeps.mk Wed May 11 17:38:09 2016 (r299471) +++ head/share/mk/local.gendirdeps.mk Wed May 11 17:40:51 2016 (r299472) @@ -21,21 +21,26 @@ GENDIRDEPS_FILTER.host+= \ Ngnu/usr.bin/cc/* \ .endif -GENDIRDEPS_FILTER+= \ - Nlib/clang/include.host \ - Nusr.bin/addr2line.host \ - Nusr.bin/ar.host \ - Nusr.bin/clang/clang.host \ - Nusr.bin/elfcopy.host \ - Nusr.bin/elfdump.host \ - Nusr.bin/nm.host \ - Nusr.bin/readelf.host \ - Nusr.bin/size.host \ - Nusr.bin/strings.host \ - Nusr.bin/strip.host \ +GENDIRDEPS_FILTER_HOST_TOOLS+= \ + Nlib/clang/include \ + Nusr.bin/addr2line \ + Nusr.bin/ar \ + Nusr.bin/clang/clang \ + Nusr.bin/elfcopy \ + Nusr.bin/elfdump \ + Nusr.bin/nm \ + Nusr.bin/readelf \ + Nusr.bin/size \ + Nusr.bin/strings \ + Nusr.bin/strip \ Ngnu/usr.bin/cc* \ - Ngnu/usr.bin/binutils*.host \ + Ngnu/usr.bin/binutils* \ +.if ${MACHINE} != "host" +GENDIRDEPS_FILTER+=${GENDIRDEPS_FILTER_HOST_TOOLS:C,$,.host,} +.else +GENDIRDEPS_FILTER+=${GENDIRDEPS_FILTER_HOST_TOOLS} +.endif .endif GENDIRDEPS_FILTER+= ${GENDIRDEPS_FILTER.${MACHINE}:U} ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299471 - head/sys/dev/ida
Author: hselasky Date: Wed May 11 17:38:09 2016 New Revision: 299471 URL: https://svnweb.freebsd.org/changeset/base/299471 Log: Resolve LINT linking issue by renaming ida_init() to ida_setup(). The ida_init() symbol name is now taken for use by the LinuxKPI. Reported by: emaste @ Discussed with: mav @ Modified: head/sys/dev/ida/ida.c head/sys/dev/ida/ida_eisa.c head/sys/dev/ida/ida_pci.c head/sys/dev/ida/idavar.h Modified: head/sys/dev/ida/ida.c == --- head/sys/dev/ida/ida.c Wed May 11 17:27:27 2016(r299470) +++ head/sys/dev/ida/ida.c Wed May 11 17:38:09 2016(r299471) @@ -193,7 +193,7 @@ ida_alloc_qcbs(struct ida_softc *ida) } int -ida_init(struct ida_softc *ida) +ida_setup(struct ida_softc *ida) { struct ida_controller_info cinfo; device_t child; Modified: head/sys/dev/ida/ida_eisa.c == --- head/sys/dev/ida/ida_eisa.c Wed May 11 17:27:27 2016(r299470) +++ head/sys/dev/ida/ida_eisa.c Wed May 11 17:38:09 2016(r299471) @@ -333,7 +333,7 @@ ida_eisa_attach(device_t dev) return (ENOMEM); } - error = ida_init(ida); + error = ida_setup(ida); if (error) { ida_free(ida); return (error); Modified: head/sys/dev/ida/ida_pci.c == --- head/sys/dev/ida/ida_pci.c Wed May 11 17:27:27 2016(r299470) +++ head/sys/dev/ida/ida_pci.c Wed May 11 17:38:09 2016(r299471) @@ -294,7 +294,7 @@ ida_pci_attach(device_t dev) return (ENOMEM); } - error = ida_init(ida); + error = ida_setup(ida); if (error) { ida_free(ida); return (error); Modified: head/sys/dev/ida/idavar.h == --- head/sys/dev/ida/idavar.h Wed May 11 17:27:27 2016(r299470) +++ head/sys/dev/ida/idavar.h Wed May 11 17:38:09 2016(r299471) @@ -197,7 +197,7 @@ extern int ida_detach(device_t dev); extern struct ida_softc *ida_alloc(device_t dev, struct resource *regs, int regs_type, int regs_id, bus_dma_tag_t parent_dmat); extern void ida_free(struct ida_softc *ida); -extern int ida_init(struct ida_softc *ida); +extern int ida_setup(struct ida_softc *ida); extern int ida_command(struct ida_softc *ida, int command, void *data, int datasize, int drive, u_int32_t pblkno, int flags); extern void ida_submit_buf(struct ida_softc *ida, struct bio *bp); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r298512 - in head: . etc/rc.d
On Sat, Apr 23, 2016 at 01:24:45PM +, Baptiste Daroussin wrote: > Author: bapt > Date: Sat Apr 23 13:24:45 2016 > New Revision: 298512 > URL: https://svnweb.freebsd.org/changeset/base/298512 > > Log: > Remove mroute6d rc script > > It is directly available via ports (pim6dd which provides the needed rc > script) There are still references to this script in /etc/netstart, /etc/defaults/rc.conf and the rc.conf man page. Is this required for the port, or can they be removed too? > > Reported by:lme > Sponsored by: Essen Hackathon 2016 > > Deleted: > head/etc/rc.d/mroute6d > Modified: > head/ObsoleteFiles.inc > head/etc/rc.d/Makefile > head/etc/rc.d/NETWORKING ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299470 - head/usr.sbin/mixer
Author: cem Date: Wed May 11 17:27:27 2016 New Revision: 299470 URL: https://svnweb.freebsd.org/changeset/base/299470 Log: mixer(8): Style: Tag no-return usage() as __dead2 Coverity really should have figured this out from the exit(3) call at the end of the routine, but just make it explicit. No functional change. Reported by: Coverity CID: 1304866 (false positive double-close of 'baz') Sponsored by: EMC / Isilon Storage Division Modified: head/usr.sbin/mixer/mixer.c Modified: head/usr.sbin/mixer/mixer.c == --- head/usr.sbin/mixer/mixer.c Wed May 11 17:20:20 2016(r299469) +++ head/usr.sbin/mixer/mixer.c Wed May 11 17:27:27 2016(r299470) @@ -26,11 +26,11 @@ __FBSDID("$FreeBSD$"); static const char *names[SOUND_MIXER_NRDEVICES] = SOUND_DEVICE_NAMES; -static voidusage(int devmask, int recmask); +static voidusage(int devmask, int recmask) __dead2; static int res_name(const char *name, int mask); static voidprint_recsrc(int recsrc, int recmask, int sflag); -static void +static void __dead2 usage(int devmask, int recmask) { int i, n; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299469 - head/sys/compat/linuxkpi/common/src
Author: hselasky Date: Wed May 11 17:20:20 2016 New Revision: 299469 URL: https://svnweb.freebsd.org/changeset/base/299469 Log: Match Linux behaviour and iterate the IDR tree unlocked. The caller is responsible the IDR tree stays unmodified while iterating. MFC after:1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/src/linux_idr.c Modified: head/sys/compat/linuxkpi/common/src/linux_idr.c == --- head/sys/compat/linuxkpi/common/src/linux_idr.c Wed May 11 17:17:48 2016(r299468) +++ head/sys/compat/linuxkpi/common/src/linux_idr.c Wed May 11 17:20:20 2016(r299469) @@ -593,15 +593,11 @@ idr_for_each_layer(struct idr_layer *il, return (0); } +/* NOTE: It is not allowed to modify the IDR tree while it is being iterated */ int idr_for_each(struct idr *idp, int (*f)(int id, void *p, void *data), void *data) { - int err; - - mtx_lock(&idp->lock); - err = idr_for_each_layer(idp->top, idp->layers - 1, f, data); - mtx_unlock(&idp->lock); - return (err); + return (idr_for_each_layer(idp->top, idp->layers - 1, f, data)); } int ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299468 - head/sys/dev/cxgbe/iw_cxgbe
Author: hselasky Date: Wed May 11 17:17:48 2016 New Revision: 299468 URL: https://svnweb.freebsd.org/changeset/base/299468 Log: The idr_for_each() function is now part of the LinuxKPI. Use the LinuxKPI's idr_for_each() function instead of the local one to avoid compilation issues. Discussed with: np @ MFC after:1 week Modified: head/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Modified: head/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h == --- head/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Wed May 11 17:07:29 2016 (r299467) +++ head/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Wed May 11 17:17:48 2016 (r299468) @@ -1004,43 +1004,6 @@ gen_pool_destroy(struct gen_pool *gp) #define L1_CACHE_BYTES 32 #endif -static inline -int idr_for_each(struct idr *idp, - int (*fn)(int id, void *p, void *data), void *data) -{ -int n, id, max, error = 0; -struct idr_layer *p; -struct idr_layer *pa[MAX_LEVEL]; -struct idr_layer **paa = &pa[0]; - -n = idp->layers * IDR_BITS; -p = idp->top; -max = 1 << n; - -id = 0; -while (id < max) { -while (n > 0 && p) { -n -= IDR_BITS; -*paa++ = p; -p = p->ary[(id >> n) & IDR_MASK]; -} - -if (p) { -error = fn(id, (void *)p, data); -if (error) -break; -} - -id += 1 << n; -while (n < fls(id)) { -n += IDR_BITS; -p = *--paa; -} -} - -return error; -} - void c4iw_cm_init_cpl(struct adapter *); void c4iw_cm_term_cpl(struct adapter *); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299466 - head/contrib/bsnmp/snmpd
Author: cem Date: Wed May 11 17:06:03 2016 New Revision: 299466 URL: https://svnweb.freebsd.org/changeset/base/299466 Log: bsnmpd: Fix size of trapsink::comm to match other community arrays This fixes a number of possible strcpy() buffer overruns between the various community strings in trap.c. Reported by: Coverity CIDs: 1006820, 1006821, 1006822 Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/bsnmp/snmpd/snmpd.h Modified: head/contrib/bsnmp/snmpd/snmpd.h == --- head/contrib/bsnmp/snmpd/snmpd.hWed May 11 16:54:34 2016 (r299465) +++ head/contrib/bsnmp/snmpd/snmpd.hWed May 11 17:06:03 2016 (r299466) @@ -307,7 +307,7 @@ struct trapsink { struct asn_oid index; u_int status; int socket; - u_char comm[SNMP_COMMUNITY_MAXLEN]; + u_char comm[SNMP_COMMUNITY_MAXLEN + 1]; int version; }; enum { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299467 - in head: share/man/man9 sys/dev/pci
Author: andrew Date: Wed May 11 17:07:29 2016 New Revision: 299467 URL: https://svnweb.freebsd.org/changeset/base/299467 Log: Add a new get_id interface to pci and pcib. This will allow us to both detect failures, and get different PCI IDs. For the former the interface returns an int to signal an error. The ID is returned at a uintptr_t * argument. For the latter there is a type argument that allows selecting the ID type. This only specifies a single type, however a MSI type will be added to handle the need to find the ID the hardware passes to the ARM GICv3 interrupt controller. A follow up commit will be made to remove pci_get_rid. Reviewed by: jhb, rstone Obtained from:ABT Systems Ltd Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D6239 Modified: head/share/man/man9/Makefile head/share/man/man9/pci.9 head/sys/dev/pci/pci.c head/sys/dev/pci/pci_if.m head/sys/dev/pci/pci_pci.c head/sys/dev/pci/pcib_if.m head/sys/dev/pci/pcib_private.h head/sys/dev/pci/pcib_support.c head/sys/dev/pci/pcivar.h Modified: head/share/man/man9/Makefile == --- head/share/man/man9/MakefileWed May 11 17:06:03 2016 (r299466) +++ head/share/man/man9/MakefileWed May 11 17:07:29 2016 (r299467) @@ -1290,6 +1290,7 @@ MLINKS+=pci.9 pci_alloc_msi.9 \ pci.9 pci_find_extcap.9 \ pci.9 pci_find_htcap.9 \ pci.9 pci_find_pcie_root_port.9 \ + pci.9 pci_get_id.9 \ pci.9 pci_get_max_read_req.9 \ pci.9 pci_get_powerstate.9 \ pci.9 pci_get_vpd_ident.9 \ Modified: head/share/man/man9/pci.9 == --- head/share/man/man9/pci.9 Wed May 11 17:06:03 2016(r299466) +++ head/share/man/man9/pci.9 Wed May 11 17:07:29 2016(r299467) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 23, 2015 +.Dd May 11, 2016 .Dt PCI 9 .Os .Sh NAME @@ -43,6 +43,7 @@ .Nm pci_find_extcap , .Nm pci_find_htcap , .Nm pci_find_pcie_root_port , +.Nm pci_get_id , .Nm pci_get_max_read_req , .Nm pci_get_powerstate , .Nm pci_get_vpd_ident , @@ -97,6 +98,8 @@ .Ft device_t .Fn pci_find_pcie_root_port "device_t dev" .Ft int +.Fn pci_get_id "device_t dev" "enum pci_id_type type" "uintptr_t *id" +.Ft int .Fn pci_get_max_read_req "device_t dev" .Ft int .Fn pci_get_powerstate "device_t dev" @@ -357,6 +360,18 @@ returns .Dv NULL . .Pp The +.Fn pci_get_id +function is used to read an identifier from a device. +The +.Fa type +flag is used to specify which identifier to read. +The following flags are supported: +.Bl -hang -width ".Dv PCI_ID_RID" +.It Dv PCI_ID_RID +Read the routing identifier for the device. +.El +.Pp +The .Fn pci_get_vpd_ident function is used to fetch a device's Vital Product Data .Pq VPD Modified: head/sys/dev/pci/pci.c == --- head/sys/dev/pci/pci.c Wed May 11 17:06:03 2016(r299466) +++ head/sys/dev/pci/pci.c Wed May 11 17:07:29 2016(r299467) @@ -122,7 +122,8 @@ static void pci_resume_msix(device_t de static int pci_remap_intr_method(device_t bus, device_t dev, u_int irq); -static uint16_tpci_get_rid_method(device_t dev, device_t child); +static int pci_get_id_method(device_t dev, device_t child, + enum pci_id_type type, uintptr_t *rid); static struct pci_devinfo * pci_fill_devinfo(device_t pcib, device_t bus, int d, int b, int s, int f, uint16_t vid, uint16_t did); @@ -190,7 +191,7 @@ static device_method_t pci_methods[] = { DEVMETHOD(pci_msix_count, pci_msix_count_method), DEVMETHOD(pci_msix_pba_bar, pci_msix_pba_bar_method), DEVMETHOD(pci_msix_table_bar, pci_msix_table_bar_method), - DEVMETHOD(pci_get_rid, pci_get_rid_method), + DEVMETHOD(pci_get_id, pci_get_id_method), DEVMETHOD(pci_alloc_devinfo,pci_alloc_devinfo_method), DEVMETHOD(pci_child_added, pci_child_added_method), #ifdef PCI_IOV @@ -5823,11 +5824,12 @@ pci_restore_state(device_t dev) pci_cfg_restore(dev, dinfo); } -static uint16_t -pci_get_rid_method(device_t dev, device_t child) +static int +pci_get_id_method(device_t dev, device_t child, enum pci_id_type type, +uintptr_t *id) { - return (PCIB_GET_RID(device_get_parent(dev), child)); + return (PCIB_GET_ID(device_get_parent(dev), child, type, id)); } /* Find the upstream port of a given PCI device in a root complex. */ Modified: head/sys/dev/pci/pci_if.m == --- head/sys/dev/pci/pci_if.m Wed May 11 17:06:03 2016(r299466) +++ head/sys/dev/pci/pci_if.m
svn commit: r299465 - head/contrib/bsnmp/snmp_usm
Author: cem Date: Wed May 11 16:54:34 2016 New Revision: 299465 URL: https://svnweb.freebsd.org/changeset/base/299465 Log: bsnmp: Don't overrun privkey buffer by copying wrong size The 'priv_key' array is SNMP_PRIV_KEY_SIZ bytes, not SNMP_AUTH_KEY_SIZ. Reported by: Coverity CIDs: 1008326, 1009675 Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/bsnmp/snmp_usm/usm_snmp.c Modified: head/contrib/bsnmp/snmp_usm/usm_snmp.c == --- head/contrib/bsnmp/snmp_usm/usm_snmp.c Wed May 11 16:53:56 2016 (r299464) +++ head/contrib/bsnmp/snmp_usm/usm_snmp.c Wed May 11 16:54:34 2016 (r299465) @@ -360,7 +360,7 @@ op_usm_users(struct snmp_context *ctx, s case LEAF_usmUserPrivKeyChange: case LEAF_usmUserOwnPrivKeyChange: memcpy(uuser->suser.priv_key, ctx->scratch->ptr1, - SNMP_AUTH_KEY_SIZ); + SNMP_PRIV_KEY_SIZ); free(ctx->scratch->ptr1); break; case LEAF_usmUserPublic: ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299464 - head/secure/lib/libcrypto
Author: emaste Date: Wed May 11 16:53:56 2016 New Revision: 299464 URL: https://svnweb.freebsd.org/changeset/base/299464 Log: libcrypto: add "Do not modify" comment to generated source files Reviewed by: jkim Differential Revision:https://reviews.freebsd.org/D6237 Modified: head/secure/lib/libcrypto/Makefile.asm Modified: head/secure/lib/libcrypto/Makefile.asm == --- head/secure/lib/libcrypto/Makefile.asm Wed May 11 16:53:41 2016 (r299463) +++ head/secure/lib/libcrypto/Makefile.asm Wed May 11 16:53:56 2016 (r299464) @@ -62,7 +62,9 @@ CLEANFILES+= sha256-x86_64.cmt sha256-x8 ( cd `dirname ${.IMPSRC}`/.. ; perl ${.IMPSRC} ${.OBJDIR}/${.TARGET} ) .cmt.S: - ( echo '# $$'FreeBSD'$$'; cat ${.IMPSRC} ) > ${.TARGET} + ( echo '# $$'FreeBSD'$$' ;\ + echo ' # Do not modify. This file is auto-generated.' ;\ + cat ${.IMPSRC} ) > ${.TARGET} sha256-x86_64.cmt: sha512-x86_64.pl ( cd `dirname ${.ALLSRC}`/.. ; perl ${.ALLSRC} ${.OBJDIR}/${.TARGET} ) @@ -136,6 +138,7 @@ CLEANFILES+=${SRCS:M*.pl:S/.pl$/.S/} .pl.S: ( echo '# $$'FreeBSD'$$' ;\ + echo ' # Do not modify. This file is auto-generated.' ;\ echo '#ifdef PIC' ;\ perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} -fpic -DPIC ;\ echo '#else' ;\ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299463 - head/sys/arm64/arm64
Author: andrew Date: Wed May 11 16:53:41 2016 New Revision: 299463 URL: https://svnweb.freebsd.org/changeset/base/299463 Log: On arm64 always create a bus_dmamap_t object. This will be use to hold the list of memory that the kernel will need to sync when operating with a non-cache coherent DMA engine. Obtained from:ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/busdma_bounce.c Modified: head/sys/arm64/arm64/busdma_bounce.c == --- head/sys/arm64/arm64/busdma_bounce.cWed May 11 16:45:58 2016 (r299462) +++ head/sys/arm64/arm64/busdma_bounce.cWed May 11 16:53:41 2016 (r299463) @@ -122,11 +122,13 @@ struct bus_dmamap { bus_dmamap_callback_t *callback; void *callback_arg; STAILQ_ENTRY(bus_dmamap) links; + u_int flags; +#defineDMAMAP_COULD_BOUNCE (1 << 0) +#defineDMAMAP_FROM_DMAMEM (1 << 1) }; static STAILQ_HEAD(, bus_dmamap) bounce_map_waitinglist; static STAILQ_HEAD(, bus_dmamap) bounce_map_callbacklist; -static struct bus_dmamap nobounce_dmamap; static void init_bounce_pages(void *dummy); static int alloc_bounce_zone(bus_dma_tag_t dmat); @@ -248,6 +250,21 @@ out: return (error); } +static bus_dmamap_t +alloc_dmamap(int flags) +{ + bus_dmamap_t map; + + map = malloc(sizeof(*map), M_DEVBUF, flags | M_ZERO); + if (map == NULL) + return (NULL); + + /* Initialize the new map */ + STAILQ_INIT(&map->bpages); + + return (map); +} + /* * Allocate a handle for mapping from kva/uva/physical * address space into bus device space. @@ -271,6 +288,13 @@ bounce_bus_dmamap_create(bus_dma_tag_t d } } + *mapp = alloc_dmamap(M_NOWAIT); + if (*mapp == NULL) { + CTR3(KTR_BUSDMA, "%s: tag %p error %d", + __func__, dmat, ENOMEM); + return (ENOMEM); + } + /* * Bouncing might be required if the driver asks for an active * exclusion region, a data alignment that is stricter than 1, and/or @@ -279,21 +303,14 @@ bounce_bus_dmamap_create(bus_dma_tag_t d if (dmat->bounce_flags & BUS_DMA_COULD_BOUNCE) { /* Must bounce */ if (dmat->bounce_zone == NULL) { - if ((error = alloc_bounce_zone(dmat)) != 0) + if ((error = alloc_bounce_zone(dmat)) != 0) { + free(*mapp, M_DEVBUF); return (error); + } } bz = dmat->bounce_zone; - *mapp = (bus_dmamap_t)malloc(sizeof(**mapp), M_DEVBUF, - M_NOWAIT | M_ZERO); - if (*mapp == NULL) { - CTR3(KTR_BUSDMA, "%s: tag %p error %d", - __func__, dmat, ENOMEM); - return (ENOMEM); - } - - /* Initialize the new map */ - STAILQ_INIT(&((*mapp)->bpages)); + (*mapp)->flags = DMAMAP_COULD_BOUNCE; /* * Attempt to add pages to our pool on a per-instance @@ -321,11 +338,11 @@ bounce_bus_dmamap_create(bus_dma_tag_t d error = 0; } bz->map_count++; - } else { - *mapp = NULL; } if (error == 0) dmat->map_count++; + else + free(*mapp, M_DEVBUF); CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", __func__, dmat, dmat->common.flags, error); return (error); @@ -339,16 +356,20 @@ static int bounce_bus_dmamap_destroy(bus_dma_tag_t dmat, bus_dmamap_t map) { - if (map != NULL && map != &nobounce_dmamap) { - if (STAILQ_FIRST(&map->bpages) != NULL) { - CTR3(KTR_BUSDMA, "%s: tag %p error %d", - __func__, dmat, EBUSY); - return (EBUSY); - } - if (dmat->bounce_zone) - dmat->bounce_zone->map_count--; - free(map, M_DEVBUF); + /* Check we are destroying the correct map type */ + if ((map->flags & DMAMAP_FROM_DMAMEM) != 0) + panic("bounce_bus_dmamap_destroy: Invalid map freed\n"); + + if (STAILQ_FIRST(&map->bpages) != NULL) { + CTR3(KTR_BUSDMA, "%s: tag %p error %d", __func__, dmat, EBUSY); + return (EBUSY); + } + if (dmat->bounce_zone) { + KASSERT((map->flags & DMAMAP_COULD_BOUNCE) != 0, + ("%s: Bounce zone when cannot bounce", __func__)); + dmat->bounce_zone->map_count--; } + free(map, M_DEVBUF); dmat->map_count--; CTR2(KTR_BUSDMA, "%s: tag
svn commit: r299462 - head/secure/lib/libcrypto
Author: jkim Date: Wed May 11 16:45:58 2016 New Revision: 299462 URL: https://svnweb.freebsd.org/changeset/base/299462 Log: Enable linker error if libcrypto.so contains a relocation against text. It is position independent on all platforms since r299389. Submitted by: kib Modified: head/secure/lib/libcrypto/Makefile Modified: head/secure/lib/libcrypto/Makefile == --- head/secure/lib/libcrypto/Makefile Wed May 11 16:42:13 2016 (r299461) +++ head/secure/lib/libcrypto/Makefile Wed May 11 16:45:58 2016 (r299462) @@ -7,7 +7,6 @@ SUBDIR= engines LIB= crypto SHLIB_MAJOR= 8 -ALLOW_SHARED_TEXTREL= NO_LINT= ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299461 - head/usr.sbin/makefs/ffs
Author: cem Date: Wed May 11 16:42:13 2016 New Revision: 299461 URL: https://svnweb.freebsd.org/changeset/base/299461 Log: ffs_bswap: Copy one UFS dinode member at a time No functional change. Reported by: Coverity CIDs: 974635, 974636, 977396, 977397, 977398, 977399 Sponsored by: EMC / Isilon Storage Division Modified: head/usr.sbin/makefs/ffs/ffs_bswap.c Modified: head/usr.sbin/makefs/ffs/ffs_bswap.c == --- head/usr.sbin/makefs/ffs/ffs_bswap.cWed May 11 16:20:23 2016 (r299460) +++ head/usr.sbin/makefs/ffs/ffs_bswap.cWed May 11 16:42:13 2016 (r299461) @@ -135,7 +135,8 @@ ffs_dinode1_swap(struct ufs1_dinode *o, n->di_mtimensec = bswap32(o->di_mtimensec); n->di_ctime = bswap32(o->di_ctime); n->di_ctimensec = bswap32(o->di_ctimensec); - memcpy(n->di_db, o->di_db, (NDADDR + NIADDR) * sizeof(u_int32_t)); + memcpy(n->di_db, o->di_db, sizeof(n->di_db)); + memcpy(n->di_ib, o->di_ib, sizeof(n->di_ib)); n->di_flags = bswap32(o->di_flags); n->di_blocks = bswap32(o->di_blocks); n->di_gen = bswap32(o->di_gen); @@ -165,7 +166,9 @@ ffs_dinode2_swap(struct ufs2_dinode *o, n->di_kernflags = bswap32(o->di_kernflags); n->di_flags = bswap32(o->di_flags); n->di_extsize = bswap32(o->di_extsize); - memcpy(n->di_extb, o->di_extb, (NXADDR + NDADDR + NIADDR) * 8); + memcpy(n->di_extb, o->di_extb, sizeof(n->di_extb)); + memcpy(n->di_db, o->di_db, sizeof(n->di_db)); + memcpy(n->di_ib, o->di_ib, sizeof(n->di_ib)); } void ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299460 - head/sbin/fsck_ffs
Author: cem Date: Wed May 11 16:20:23 2016 New Revision: 299460 URL: https://svnweb.freebsd.org/changeset/base/299460 Log: fsck_ffs: Don't overrun mount device buffer Maybe this case is impossible. Either way, when attempting to "/dev/"-prefix a non-global device name, check that we do not overrun the f_mntfromname buffer. In this case, truncating (with strlcpy or similar) would not be useful, since the f_mntfromname result of getmntpt() is passed directly to open(2) later. Reported by: Coverity CID: 1006789 Sponsored by: EMC / Isilon Storage Division Modified: head/sbin/fsck_ffs/main.c Modified: head/sbin/fsck_ffs/main.c == --- head/sbin/fsck_ffs/main.c Wed May 11 16:05:32 2016(r299459) +++ head/sbin/fsck_ffs/main.c Wed May 11 16:20:23 2016(r299460) @@ -644,6 +644,9 @@ getmntpt(const char *name) statfsp = &mntbuf[i]; ddevname = statfsp->f_mntfromname; if (*ddevname != '/') { + if (strlen(_PATH_DEV) + strlen(ddevname) + 1 > + sizeof(statfsp->f_mntfromname)) + continue; strcpy(device, _PATH_DEV); strcat(device, ddevname); strcpy(statfsp->f_mntfromname, device); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299459 - head/sys/cddl/compat/opensolaris/sys
Author: cem Date: Wed May 11 16:05:32 2016 New Revision: 299459 URL: https://svnweb.freebsd.org/changeset/base/299459 Log: compat/opensolaris: Don't redefined off64_t if already defined A follow-up to r299456. Reported by: gjb Sponsored by: EMC / Isilon Storage Division Modified: head/sys/cddl/compat/opensolaris/sys/types.h Modified: head/sys/cddl/compat/opensolaris/sys/types.h == --- head/sys/cddl/compat/opensolaris/sys/types.hWed May 11 15:31:31 2016(r299458) +++ head/sys/cddl/compat/opensolaris/sys/types.hWed May 11 16:05:32 2016(r299459) @@ -52,7 +52,10 @@ typedef u_short ushort_t; typedef u_long ulong_t; typedef long long longlong_t; typedef unsigned long long u_longlong_t; +#ifndef_OFF64_T_DECLARED +#define_OFF64_T_DECLARED typedef off_t off64_t; +#endif typedef id_t taskid_t; typedef id_t projid_t; typedef id_t poolid_t; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299458 - head/usr.bin/gcore
Author: cem Date: Wed May 11 15:31:31 2016 New Revision: 299458 URL: https://svnweb.freebsd.org/changeset/base/299458 Log: Fix buffer overrun in gcore(1) NT_PRPSINFO Use size of destination buffer, rather than a constant that may or may not correspond to the source buffer, to restrict the length of copied strings. In particular, pr_fname has 16+1 characters but MAXCOMLEN is 18+1. Use strlcpy instead of strncpy to ensure the result is nul-terminated. This seems to be what is expected of these fields. Reported by: Coverity CIDs: 1011302, 1011378 Sponsored by: EMC / Isilon Storage Division Modified: head/usr.bin/gcore/elfcore.c Modified: head/usr.bin/gcore/elfcore.c == --- head/usr.bin/gcore/elfcore.cWed May 11 14:59:54 2016 (r299457) +++ head/usr.bin/gcore/elfcore.cWed May 11 15:31:31 2016 (r299458) @@ -560,8 +560,8 @@ elf_note_prpsinfo(void *arg, size_t *siz err(1, "kern.proc.pid.%u", pid); if (kip.ki_pid != pid) err(1, "kern.proc.pid.%u", pid); - strncpy(psinfo->pr_fname, kip.ki_comm, MAXCOMLEN); - strncpy(psinfo->pr_psargs, psinfo->pr_fname, PRARGSZ); + strlcpy(psinfo->pr_fname, kip.ki_comm, sizeof(psinfo->pr_fname)); + strlcpy(psinfo->pr_psargs, psinfo->pr_fname, sizeof(psinfo->pr_psargs)); *sizep = sizeof(*psinfo); return (psinfo); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r299444 - head/sys/dev/vnic
ooo! do you have any plans to integrate it into the kernel RSS options? -a On 11 May 2016 at 06:22, Zbigniew Bodek wrote: > Author: zbb > Date: Wed May 11 13:22:13 2016 > New Revision: 299444 > URL: https://svnweb.freebsd.org/changeset/base/299444 > > Log: > Add HW RSS support to VNIC driver > > Based on v1.0 driver provided by Cavium under BSD license. > Support in-hardware RSS to distribute IP, UDP and TCP traffic > among available RX Queues and hence multiple CPUs. > > Reviewed by: wma > Obtained from:Semihalf > Sponsored by: Cavium > Differential Revision: https://reviews.freebsd.org/D6230 > > Modified: > head/sys/dev/vnic/nic.h > head/sys/dev/vnic/nic_main.c > head/sys/dev/vnic/nicvf_main.c > head/sys/dev/vnic/nicvf_queues.c > > Modified: head/sys/dev/vnic/nic.h > == > --- head/sys/dev/vnic/nic.h Wed May 11 13:20:29 2016(r299443) > +++ head/sys/dev/vnic/nic.h Wed May 11 13:22:13 2016(r299444) > @@ -176,6 +176,24 @@ struct msix_entry { > #defineNIC_MAX_RSS_IDR_TBL_SIZE(1 << NIC_MAX_RSS_HASH_BITS) > #defineRSS_HASH_KEY_SIZE 5 /* 320 bit key */ > > +struct nicvf_rss_info { > + boolean_t enable; > +#defineRSS_L2_EXTENDED_HASH_ENA(1UL << 0) > +#defineRSS_IP_HASH_ENA (1UL << 1) > +#defineRSS_TCP_HASH_ENA(1UL << 2) > +#defineRSS_TCP_SYN_DIS (1UL << 3) > +#defineRSS_UDP_HASH_ENA(1UL << 4) > +#defineRSS_L4_EXTENDED_HASH_ENA(1UL << 5) > +#defineRSS_ROCE_ENA(1UL << 6) > +#defineRSS_L3_BI_DIRECTION_ENA (1UL << 7) > +#defineRSS_L4_BI_DIRECTION_ENA (1UL << 8) > + uint64_t cfg; > + uint8_t hash_bits; > + uint16_t rss_size; > + uint8_t ind_tbl[NIC_MAX_RSS_IDR_TBL_SIZE]; > + uint64_t key[RSS_HASH_KEY_SIZE]; > +}; > + > enum rx_stats_reg_offset { > RX_OCTS = 0x0, > RX_UCAST = 0x1, > @@ -285,6 +303,7 @@ struct nicvf { > boolean_t tns_mode:1; > boolean_t sqs_mode:1; > boolloopback_supported:1; > + struct nicvf_rss_info rss_info; > uint16_tmtu; > struct queue_set*qs; > uint8_t rx_queues; > > Modified: head/sys/dev/vnic/nic_main.c > == > --- head/sys/dev/vnic/nic_main.cWed May 11 13:20:29 2016 > (r299443) > +++ head/sys/dev/vnic/nic_main.cWed May 11 13:22:13 2016 > (r299444) > @@ -103,6 +103,7 @@ struct nicpf { > uint8_t duplex[MAX_LMAC]; > uint32_tspeed[MAX_LMAC]; > uint16_tcpi_base[MAX_NUM_VFS_SUPPORTED]; > + uint16_trssi_base[MAX_NUM_VFS_SUPPORTED]; > uint16_trss_ind_tbl_size; > > /* MSI-X */ > @@ -744,6 +745,58 @@ nic_config_cpi(struct nicpf *nic, struct > rssi = ((cpi - cpi_base) & 0x38) >> 3; > } > nic->cpi_base[cfg->vf_id] = cpi_base; > + nic->rssi_base[cfg->vf_id] = rssi_base; > +} > + > +/* Responsds to VF with its RSS indirection table size */ > +static void > +nic_send_rss_size(struct nicpf *nic, int vf) > +{ > + union nic_mbx mbx = {}; > + uint64_t *msg; > + > + msg = (uint64_t *)&mbx; > + > + mbx.rss_size.msg = NIC_MBOX_MSG_RSS_SIZE; > + mbx.rss_size.ind_tbl_size = nic->rss_ind_tbl_size; > + nic_send_msg_to_vf(nic, vf, &mbx); > +} > + > +/* > + * Receive side scaling configuration > + * configure: > + * - RSS index > + * - indir table i.e hash::RQ mapping > + * - no of hash bits to consider > + */ > +static void > +nic_config_rss(struct nicpf *nic, struct rss_cfg_msg *cfg) > +{ > + uint8_t qset, idx; > + uint64_t cpi_cfg, cpi_base, rssi_base, rssi; > + uint64_t idx_addr; > + > + idx = 0; > + rssi_base = nic->rssi_base[cfg->vf_id] + cfg->tbl_offset; > + > + rssi = rssi_base; > + qset = cfg->vf_id; > + > + for (; rssi < (rssi_base + cfg->tbl_len); rssi++) { > + nic_reg_write(nic, NIC_PF_RSSI_0_4097_RQ | (rssi << 3), > + (qset << 3) | (cfg->ind_tbl[idx] & 0x7)); > + idx++; > + } > + > + cpi_base = nic->cpi_base[cfg->vf_id]; > + if (pass1_silicon(nic->dev)) > + idx_addr = NIC_PF_CPI_0_2047_CFG; > + else > + idx_addr = NIC_PF_MPI_0_2047_CFG; > + cpi_cfg = nic_reg_read(nic, idx_addr | (cpi_base << 3)); > + cpi_cfg &= ~(0xFUL << 20); > + cpi_cfg |= (cfg->hash_bits << 20); > + nic_reg_write(nic, idx_addr | (cpi_base << 3), cpi_cfg); > } > > /* > @@ -896,6 +949,13 @@ nic_handle_mbx_int
Re: svn commit: r299427 - in head/sys/compat/linuxkpi/common: include/linux src
On 05/11/16 17:04, Ed Maste wrote: On 11 May 2016 at 06:40, Hans Petter Selasky wrote: Author: hselasky Date: Wed May 11 10:40:04 2016 New Revision: 299427 URL: https://svnweb.freebsd.org/changeset/base/299427 This broke (at least) sparc64 LINT kernel builds. linking kernel linux_idr.o: In function `ida_init': linux_idr.c:(.text+0x920): multiple definition of `ida_init' ida.o:ida.c:(.text+0x900): first defined here *** [kernel] Error code 1 I'll have a look at it. --HPS ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r299427 - in head/sys/compat/linuxkpi/common: include/linux src
On 11 May 2016 at 06:40, Hans Petter Selasky wrote: > Author: hselasky > Date: Wed May 11 10:40:04 2016 > New Revision: 299427 > URL: https://svnweb.freebsd.org/changeset/base/299427 This broke (at least) sparc64 LINT kernel builds. linking kernel linux_idr.o: In function `ida_init': linux_idr.c:(.text+0x920): multiple definition of `ida_init' ida.o:ida.c:(.text+0x900): first defined here *** [kernel] Error code 1 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299457 - head/sys/arm64/arm64
Author: andrew Date: Wed May 11 14:59:54 2016 New Revision: 299457 URL: https://svnweb.freebsd.org/changeset/base/299457 Log: Add data barriers to the arm64 bus_dmamap_sync function. We need these to ensure ordering between the CPU and device. As the CPU and DMA target may be in different shareability domains they need to be full system barriers. Obtained from:ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/busdma_bounce.c Modified: head/sys/arm64/arm64/busdma_bounce.c == --- head/sys/arm64/arm64/busdma_bounce.cWed May 11 14:38:27 2016 (r299456) +++ head/sys/arm64/arm64/busdma_bounce.cWed May 11 14:59:54 2016 (r299457) @@ -770,8 +770,11 @@ bounce_bus_dmamap_sync(bus_dma_tag_t dma struct bounce_page *bpage; vm_offset_t datavaddr, tempvaddr; - if (map == NULL || (bpage = STAILQ_FIRST(&map->bpages)) == NULL) + if (map == NULL || (bpage = STAILQ_FIRST(&map->bpages)) == NULL) { + /* Wait for any memory access to complete */ + dsb(sy); return; + } /* * XXX ARM64TODO: @@ -801,9 +804,19 @@ bounce_bus_dmamap_sync(bus_dma_tag_t dma bpage = STAILQ_NEXT(bpage, links); } dmat->bounce_zone->total_bounced++; + + /* +* Wait for the bcopy to complete before any DMA operations. +*/ + dsb(sy); } if ((op & BUS_DMASYNC_POSTREAD) != 0) { + /* +* Wait for any DMA operations to complete before the bcopy. +*/ + dsb(sy); + while (bpage != NULL) { tempvaddr = 0; datavaddr = bpage->datavaddr; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299456 - in head: include lib/libc/stdio
Author: cem Date: Wed May 11 14:38:27 2016 New Revision: 299456 URL: https://svnweb.freebsd.org/changeset/base/299456 Log: libc: Add fopencookie(3) wrapper around funopen(3) Reviewed by: jhb, oshogbo Sponsored by: EMC / Isilon Storage Division Differential Revision:https://reviews.freebsd.org/D6282 Added: head/lib/libc/stdio/fopencookie.3 (contents, props changed) head/lib/libc/stdio/fopencookie.c (contents, props changed) Modified: head/include/stdio.h head/lib/libc/stdio/Makefile.inc head/lib/libc/stdio/funopen.3 Modified: head/include/stdio.h == --- head/include/stdio.hWed May 11 14:37:33 2016(r299455) +++ head/include/stdio.hWed May 11 14:38:27 2016(r299456) @@ -58,6 +58,11 @@ typedef __ssize_t ssize_t; #endif #endif +#ifndef _OFF64_T_DECLARED +#define_OFF64_T_DECLARED +typedef__off_t off64_t; +#endif + #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE #ifndef _VA_LIST_DECLARED typedef__va_list va_list; @@ -427,6 +432,18 @@ FILE *funopen(const void *, #definefropen(cookie, fn) funopen(cookie, fn, 0, 0, 0) #definefwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0) +typedef ssize_t (cookie_read_function_t)(void *, char *, size_t); +typedef ssize_t (cookie_write_function_t)(void *, const char *, size_t); +typedef int (cookie_seek_function_t)(void *, off64_t *, int); +typedef int (cookie_close_function_t)(void *); +typedef struct { + cookie_read_function_t *read; + cookie_write_function_t *write; + cookie_seek_function_t *seek; + cookie_close_function_t *close; +} cookie_io_functions_t; +FILE *fopencookie(void *, const char *, cookie_io_functions_t); + /* * Portability hacks. See . */ Modified: head/lib/libc/stdio/Makefile.inc == --- head/lib/libc/stdio/Makefile.incWed May 11 14:37:33 2016 (r299455) +++ head/lib/libc/stdio/Makefile.incWed May 11 14:38:27 2016 (r299456) @@ -8,7 +8,8 @@ SRCS+= _flock_stub.c asprintf.c clrerr.c fclose.c fcloseall.c fdopen.c \ feof.c ferror.c fflush.c fgetc.c fgetln.c fgetpos.c fgets.c fgetwc.c \ fgetwln.c fgetws.c \ - fileno.c findfp.c flags.c fmemopen.c fopen.c fprintf.c fpurge.c \ + fileno.c findfp.c flags.c fmemopen.c fopen.c \ + fopencookie.c fprintf.c fpurge.c \ fputc.c fputs.c \ fputwc.c fputws.c fread.c freopen.c fscanf.c fseek.c fsetpos.c \ ftell.c funopen.c fvwrite.c fwalk.c fwide.c fwprintf.c fwscanf.c \ @@ -35,7 +36,7 @@ SYM_MAPS+=${LIBC_SRCTOP}/stdio/Symbol.m MAN+= fclose.3 ferror.3 fflush.3 fgetln.3 fgets.3 fgetwln.3 fgetws.3 \ flockfile.3 \ - fopen.3 fputs.3 \ + fopen.3 fopencookie.3 fputs.3 \ fputws.3 fread.3 fseek.3 funopen.3 fwide.3 getc.3 \ getline.3 getwc.3 mktemp.3 open_memstream.3 \ printf.3 printf_l.3 putc.3 putwc.3 remove.3 scanf.3 scanf_l.3 setbuf.3 \ Added: head/lib/libc/stdio/fopencookie.3 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/stdio/fopencookie.3 Wed May 11 14:38:27 2016 (r299456) @@ -0,0 +1,156 @@ +.\" Copyright (c) 2016, EMC / Isilon Storage Division +.\" 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 COPYRIGHT HOLDERS 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 COPYRIGHT HOLDERS OR +.\" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +.\" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +.\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +.\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd May 9, 2016 +.Dt FOPENCOOKIE 3 +.Os +.Sh NAME +.Nm fopencookie +.Nd open a stream +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS
svn commit: r299455 - head/lib/librpcsec_gss
Author: pfg Date: Wed May 11 14:37:33 2016 New Revision: 299455 URL: https://svnweb.freebsd.org/changeset/base/299455 Log: librpcsec_gss: remove redundant code. We have identical code no matter the expression behind the if. Avoid the desision altogether and keep doing what is expected. Reviewed by: dfr CID: 1305689 Modified: head/lib/librpcsec_gss/svc_rpcsec_gss.c Modified: head/lib/librpcsec_gss/svc_rpcsec_gss.c == --- head/lib/librpcsec_gss/svc_rpcsec_gss.c Wed May 11 13:53:29 2016 (r299454) +++ head/lib/librpcsec_gss/svc_rpcsec_gss.c Wed May 11 14:37:33 2016 (r299455) @@ -631,11 +631,6 @@ svc_rpc_gss_accept_sec_context(struct sv &ret_flags, &cred_lifetime, &client->cl_creds); - if (gr->gr_major == GSS_S_COMPLETE - || gr->gr_major == GSS_S_CONTINUE_NEEDED) { - client->cl_sname = sname; - break; - } client->cl_sname = sname; break; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299454 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: mav Date: Wed May 11 13:53:29 2016 New Revision: 299454 URL: https://svnweb.freebsd.org/changeset/base/299454 Log: MFV r299453: 6765 zfs_zaccess_delete() comments do not accurately reflect delete permissions for ACLs Reviewed by: Gordon Ross Reviewed by: Yuri Pankov Author: Kevin Crowe openzfs/openzfs@a40149b935cbbe87bf95e2cc44b3bc99d400513a Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Wed May 11 13:51:53 2016(r299453) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Wed May 11 13:53:29 2016(r299454) @@ -2538,8 +2538,10 @@ int zfs_write_implies_delete_child = 1; /* * Determine whether delete access should be granted. * - * The following chart is the recommended NFSv4 enforcement for - * ability to delete an object. + * The following chart outlines how we handle delete permissions which is + * how recent versions of windows (Windows 2008) handles it. The efficiency + * comes from not having to check the parent ACL where the object itself grants + * delete: * * --- * | Parent Dir | Target Object Permissions | @@ -2548,14 +2550,14 @@ int zfs_write_implies_delete_child = 1; * | | ACL Allows | ACL Denies| Delete | * | | Delete| Delete | unspecified| * --- - * | ACL Allows | Permit | Permit * | Permit | - * | DELETE_CHILD || || + * | ACL Allows| Permit | Deny *| Permit | + * | DELETE_CHILD || || * --- - * | ACL Denies | Permit * | Deny | Deny | - * | DELETE_CHILD || || + * | ACL Denies| Permit | Deny | Deny | + * | DELETE_CHILD || || * --- * | ACL specifies || || - * | only allow| Permit | Permit * | Permit | + * | only allow| Permit | Deny *| Permit | * | write and || || * | execute || || * --- @@ -2568,24 +2570,21 @@ int zfs_write_implies_delete_child = 1; * Re. execute permission on the directory: if that's missing, *the vnode lookup of the target will fail before we get here. * - * Re [*] in the table above: We are intentionally disregarding the - * NFSv4 committee recommendation for these three cells of the matrix - * because that recommendation conflicts with the behavior expected - * by Windows clients for ACL evaluation. See acl.h for notes on - * which ACE_... flags should be checked for which operations. - * Specifically, the NFSv4 committee recommendation is in conflict - * with the Windows interpretation of DENY ACEs, where DENY ACEs + * Re [*] in the table above: NFSv4 would normally Permit delete for + * these two cells of the matrix. + * See acl.h for notes on which ACE_... flags should be checked for which + * operations. Specifically, the NFSv4 committee recommendation is in + * conflict with the Windows interpretation of DENY ACEs, where DENY ACEs * should take precedence ahead of ALLOW ACEs. * - * This implementation takes a conservative approach by checking for - * DENY ACEs on both the target object and it's container; checking - * the ACE_DELETE on the target object, and ACE_DELETE_CHILD on the - * container. If a DENY ACE is found for either of those, delete - * access is denied. (Note that DENY ACEs are very rare.) - * - * Note that after these changes, entire the second row and the - * entire middle column of the table above change to Deny. - * Accordingly, the logic here is somewhat simplified. + * This implementation always consults the target object's ACL first. + * If a DENY ACE is present on the target object that specifies ACE_DELETE, + * delete access is denied. If an ALLOW ACE with ACE_DELETE is present on + * the target object, access is allowed. If and only if no entries with + * ACE_DELETE are present in the object's ACL, check the container's ACL + * for entries with ACE_DELETE_CHILD. + * + * A summary of the logic implemented from the table above is as follows: * * First check for DENY ACEs that apply. * If either target or container has a deny, EACCES. __
svn commit: r299453 - vendor-sys/illumos/dist/uts/common/fs/zfs
Author: mav Date: Wed May 11 13:51:53 2016 New Revision: 299453 URL: https://svnweb.freebsd.org/changeset/base/299453 Log: 6765 zfs_zaccess_delete() comments do not accurately reflect delete permissions for ACLs Reviewed by: Gordon Ross Reviewed by: Yuri Pankov Author: Kevin Crowe openzfs/openzfs@a40149b935cbbe87bf95e2cc44b3bc99d400513a Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_acl.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_acl.c == --- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_acl.c Wed May 11 13:50:34 2016(r299452) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_acl.c Wed May 11 13:51:53 2016(r299453) @@ -2516,8 +2516,10 @@ int zfs_write_implies_delete_child = 1; /* * Determine whether delete access should be granted. * - * The following chart is the recommended NFSv4 enforcement for - * ability to delete an object. + * The following chart outlines how we handle delete permissions which is + * how recent versions of windows (Windows 2008) handles it. The efficiency + * comes from not having to check the parent ACL where the object itself grants + * delete: * * --- * | Parent Dir | Target Object Permissions | @@ -2526,14 +2528,14 @@ int zfs_write_implies_delete_child = 1; * | | ACL Allows | ACL Denies| Delete | * | | Delete| Delete | unspecified| * --- - * | ACL Allows | Permit | Permit * | Permit | - * | DELETE_CHILD || || + * | ACL Allows| Permit | Deny *| Permit | + * | DELETE_CHILD || || * --- - * | ACL Denies | Permit * | Deny | Deny | - * | DELETE_CHILD || || + * | ACL Denies| Permit | Deny | Deny | + * | DELETE_CHILD || || * --- * | ACL specifies || || - * | only allow| Permit | Permit * | Permit | + * | only allow| Permit | Deny *| Permit | * | write and || || * | execute || || * --- @@ -2546,24 +2548,21 @@ int zfs_write_implies_delete_child = 1; * Re. execute permission on the directory: if that's missing, *the vnode lookup of the target will fail before we get here. * - * Re [*] in the table above: We are intentionally disregarding the - * NFSv4 committee recommendation for these three cells of the matrix - * because that recommendation conflicts with the behavior expected - * by Windows clients for ACL evaluation. See acl.h for notes on - * which ACE_... flags should be checked for which operations. - * Specifically, the NFSv4 committee recommendation is in conflict - * with the Windows interpretation of DENY ACEs, where DENY ACEs + * Re [*] in the table above: NFSv4 would normally Permit delete for + * these two cells of the matrix. + * See acl.h for notes on which ACE_... flags should be checked for which + * operations. Specifically, the NFSv4 committee recommendation is in + * conflict with the Windows interpretation of DENY ACEs, where DENY ACEs * should take precedence ahead of ALLOW ACEs. * - * This implementation takes a conservative approach by checking for - * DENY ACEs on both the target object and it's container; checking - * the ACE_DELETE on the target object, and ACE_DELETE_CHILD on the - * container. If a DENY ACE is found for either of those, delete - * access is denied. (Note that DENY ACEs are very rare.) - * - * Note that after these changes, entire the second row and the - * entire middle column of the table above change to Deny. - * Accordingly, the logic here is somewhat simplified. + * This implementation always consults the target object's ACL first. + * If a DENY ACE is present on the target object that specifies ACE_DELETE, + * delete access is denied. If an ALLOW ACE with ACE_DELETE is present on + * the target object, access is allowed. If and only if no entries with + * ACE_DELETE are present in the object's ACL, check the container's ACL + * for entries with ACE_DELETE_CHILD. + * + * A summary of the logic implemented from the table above is as follows: * * First check for DENY ACEs that apply. * If either target or container has a deny, EACCES. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscri
svn commit: r299452 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: mav Date: Wed May 11 13:50:34 2016 New Revision: 299452 URL: https://svnweb.freebsd.org/changeset/base/299452 Log: MFV r299451: 6764 zfs issues with inheritance flags during chmod(2) with aclmode=passthrough Reviewed by: Gordon Ross Reviewed by: Yuri Pankov Author: Albert Lee openzfs/openzfs@1bcf0d240bdebed61b4261f7c0ee323e07c8dfac Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Wed May 11 13:49:50 2016(r299451) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Wed May 11 13:50:34 2016(r299452) @@ -884,7 +884,6 @@ zfs_set_ace(zfs_acl_t *aclp, void *acep, /* * Determine mode of file based on ACL. - * Also, create FUIDs for any User/Group ACEs */ uint64_t zfs_mode_compute(uint64_t fmode, zfs_acl_t *aclp, @@ -910,11 +909,9 @@ zfs_mode_compute(uint64_t fmode, zfs_acl entry_type = (iflags & ACE_TYPE_FLAGS); /* -* Skip over owner@, group@ or everyone@ inherit only ACEs +* Skip over any inherit_only ACEs */ - if ((iflags & ACE_INHERIT_ONLY_ACE) && - (entry_type == ACE_OWNER || entry_type == ACE_EVERYONE || - entry_type == OWNING_GROUP)) + if (iflags & ACE_INHERIT_ONLY_ACE) continue; if (entry_type == ACE_OWNER || (entry_type == 0 && @@ -1330,7 +1327,8 @@ zfs_aclset_common(znode_t *zp, zfs_acl_t } static void -zfs_acl_chmod(vtype_t vtype, uint64_t mode, boolean_t trim, zfs_acl_t *aclp) +zfs_acl_chmod(vtype_t vtype, uint64_t mode, boolean_t split, boolean_t trim, +zfs_acl_t *aclp) { void*acep = NULL; uint64_twho; @@ -1375,15 +1373,27 @@ zfs_acl_chmod(vtype_t vtype, uint64_t mo while (acep = zfs_acl_next_ace(aclp, acep, &who, &access_mask, &iflags, &type)) { - uint16_t inherit_flags; - entry_type = (iflags & ACE_TYPE_FLAGS); - inherit_flags = (iflags & ALL_INHERIT); - - if ((entry_type == ACE_OWNER || entry_type == ACE_EVERYONE || - (entry_type == OWNING_GROUP)) && - ((inherit_flags & ACE_INHERIT_ONLY_ACE) == 0)) { - continue; + /* +* ACEs used to represent the file mode may be divided +* into an equivalent pair of inherit-only and regular +* ACEs, if they are inheritable. +* Skip regular ACEs, which are replaced by the new mode. +*/ + if (split && (entry_type == ACE_OWNER || + entry_type == OWNING_GROUP || + entry_type == ACE_EVERYONE)) { + if (!isdir || !(iflags & + (ACE_FILE_INHERIT_ACE|ACE_DIRECTORY_INHERIT_ACE))) + continue; + /* +* We preserve owner@, group@, or @everyone +* permissions, if they are inheritable, by +* copying them to inherit_only ACEs. This +* prevents inheritable permissions from being +* altered along with the file mode. +*/ + iflags |= ACE_INHERIT_ONLY_ACE; } /* @@ -1391,12 +1401,12 @@ zfs_acl_chmod(vtype_t vtype, uint64_t mo * the hints (which are later masked into the pflags) * so create knows to do inheritance. */ - if (isdir && (inherit_flags & + if (isdir && (iflags & (ACE_FILE_INHERIT_ACE|ACE_DIRECTORY_INHERIT_ACE))) aclp->z_hints |= ZFS_INHERIT_ACE; if ((type != ALLOW && type != DENY) || - (inherit_flags & ACE_INHERIT_ONLY_ACE)) { + (iflags & ACE_INHERIT_ONLY_ACE)) { switch (type) { case ACE_ACCESS_ALLOWED_OBJECT_ACE_TYPE: case ACE_ACCESS_DENIED_OBJECT_ACE_TYPE: @@ -1406,7 +1416,6 @@ zfs_acl_chmod(vtype_t vtype, uint64_t mo break; } } else { - /* * Limit permissions granted by ACEs to be no greater * than permissions of the requested group mode. @@ -1422,11 +1431,11 @@ zfs_acl_chmod(vtype_t vtype, uint64_t mo new_count++; new_bytes += ace_size; } - zfs
svn commit: r299451 - vendor-sys/illumos/dist/uts/common/fs/zfs
Author: mav Date: Wed May 11 13:49:50 2016 New Revision: 299451 URL: https://svnweb.freebsd.org/changeset/base/299451 Log: 6764 zfs issues with inheritance flags during chmod(2) with aclmode=passthrough Reviewed by: Gordon Ross Reviewed by: Yuri Pankov Author: Albert Lee openzfs/openzfs@1bcf0d240bdebed61b4261f7c0ee323e07c8dfac Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_acl.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_acl.c == --- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_acl.c Wed May 11 13:48:15 2016(r299450) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_acl.c Wed May 11 13:49:50 2016(r299451) @@ -887,7 +887,6 @@ zfs_set_ace(zfs_acl_t *aclp, void *acep, /* * Determine mode of file based on ACL. - * Also, create FUIDs for any User/Group ACEs */ uint64_t zfs_mode_compute(uint64_t fmode, zfs_acl_t *aclp, @@ -913,11 +912,9 @@ zfs_mode_compute(uint64_t fmode, zfs_acl entry_type = (iflags & ACE_TYPE_FLAGS); /* -* Skip over owner@, group@ or everyone@ inherit only ACEs +* Skip over any inherit_only ACEs */ - if ((iflags & ACE_INHERIT_ONLY_ACE) && - (entry_type == ACE_OWNER || entry_type == ACE_EVERYONE || - entry_type == OWNING_GROUP)) + if (iflags & ACE_INHERIT_ONLY_ACE) continue; if (entry_type == ACE_OWNER || (entry_type == 0 && @@ -1333,7 +1330,8 @@ zfs_aclset_common(znode_t *zp, zfs_acl_t } static void -zfs_acl_chmod(vtype_t vtype, uint64_t mode, boolean_t trim, zfs_acl_t *aclp) +zfs_acl_chmod(vtype_t vtype, uint64_t mode, boolean_t split, boolean_t trim, +zfs_acl_t *aclp) { void*acep = NULL; uint64_twho; @@ -1378,15 +1376,27 @@ zfs_acl_chmod(vtype_t vtype, uint64_t mo while (acep = zfs_acl_next_ace(aclp, acep, &who, &access_mask, &iflags, &type)) { - uint16_t inherit_flags; - entry_type = (iflags & ACE_TYPE_FLAGS); - inherit_flags = (iflags & ALL_INHERIT); - - if ((entry_type == ACE_OWNER || entry_type == ACE_EVERYONE || - (entry_type == OWNING_GROUP)) && - ((inherit_flags & ACE_INHERIT_ONLY_ACE) == 0)) { - continue; + /* +* ACEs used to represent the file mode may be divided +* into an equivalent pair of inherit-only and regular +* ACEs, if they are inheritable. +* Skip regular ACEs, which are replaced by the new mode. +*/ + if (split && (entry_type == ACE_OWNER || + entry_type == OWNING_GROUP || + entry_type == ACE_EVERYONE)) { + if (!isdir || !(iflags & + (ACE_FILE_INHERIT_ACE|ACE_DIRECTORY_INHERIT_ACE))) + continue; + /* +* We preserve owner@, group@, or @everyone +* permissions, if they are inheritable, by +* copying them to inherit_only ACEs. This +* prevents inheritable permissions from being +* altered along with the file mode. +*/ + iflags |= ACE_INHERIT_ONLY_ACE; } /* @@ -1394,12 +1404,12 @@ zfs_acl_chmod(vtype_t vtype, uint64_t mo * the hints (which are later masked into the pflags) * so create knows to do inheritance. */ - if (isdir && (inherit_flags & + if (isdir && (iflags & (ACE_FILE_INHERIT_ACE|ACE_DIRECTORY_INHERIT_ACE))) aclp->z_hints |= ZFS_INHERIT_ACE; if ((type != ALLOW && type != DENY) || - (inherit_flags & ACE_INHERIT_ONLY_ACE)) { + (iflags & ACE_INHERIT_ONLY_ACE)) { switch (type) { case ACE_ACCESS_ALLOWED_OBJECT_ACE_TYPE: case ACE_ACCESS_DENIED_OBJECT_ACE_TYPE: @@ -1409,7 +1419,6 @@ zfs_acl_chmod(vtype_t vtype, uint64_t mo break; } } else { - /* * Limit permissions granted by ACEs to be no greater * than permissions of the requested group mode. @@ -1425,11 +1434,11 @@ zfs_acl_chmod(vtype_t vtype, uint64_t mo new_count++; new_bytes += ace_size; } - zfs_set_ace(aclp, zacep, masks.owner, 0, -1, ACE_OWNER); + zfs_set_ace(aclp, zacep, masks.owner, ALLOW, -1, ACE_OWNER); zacep = (vo
svn commit: r299450 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: mav Date: Wed May 11 13:48:15 2016 New Revision: 299450 URL: https://svnweb.freebsd.org/changeset/base/299450 Log: MFV r299449: 6763 aclinherit=restricted masks inherited permissions by group perms (groupmask) Reviewed by: Gordon Ross Reviewed by: Yuri Pankov Author: Albert Lee openzfs/openzfs@eebb483d0cd68bdc4cf03c01fdeba9af160c17af Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Wed May 11 13:46:44 2016(r299449) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Wed May 11 13:48:15 2016(r299450) @@ -1408,11 +1408,10 @@ zfs_acl_chmod(vtype_t vtype, uint64_t mo } else { /* -* Limit permissions to be no greater than -* group permissions. -* The "aclinherit" and "aclmode" properties -* affect policy for create and chmod(2), -* respectively. +* Limit permissions granted by ACEs to be no greater +* than permissions of the requested group mode. +* Applies when the "aclmode" property is set to +* "groupmask". */ if ((type == ALLOW) && trim) access_mask &= masks.group; @@ -1730,7 +1729,7 @@ zfs_acl_ids_create(znode_t *dzp, int fla acl_ids->z_aclp->z_hints |= (vap->va_type == VDIR) ? ZFS_ACL_AUTO_INHERIT : 0; zfs_acl_chmod(vap->va_type, acl_ids->z_mode, - (zfsvfs->z_acl_inherit == ZFS_ACL_RESTRICTED), + (zfsvfs->z_acl_mode == ZFS_ACL_GROUPMASK), acl_ids->z_aclp); } } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299449 - vendor-sys/illumos/dist/uts/common/fs/zfs
Author: mav Date: Wed May 11 13:46:44 2016 New Revision: 299449 URL: https://svnweb.freebsd.org/changeset/base/299449 Log: 6763 aclinherit=restricted masks inherited permissions by group perms (groupmask) Reviewed by: Gordon Ross Reviewed by: Yuri Pankov Author: Albert Lee openzfs/openzfs@eebb483d0cd68bdc4cf03c01fdeba9af160c17af Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_acl.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_acl.c == --- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_acl.c Wed May 11 13:43:20 2016(r299448) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_acl.c Wed May 11 13:46:44 2016(r299449) @@ -1411,11 +1411,10 @@ zfs_acl_chmod(vtype_t vtype, uint64_t mo } else { /* -* Limit permissions to be no greater than -* group permissions. -* The "aclinherit" and "aclmode" properties -* affect policy for create and chmod(2), -* respectively. +* Limit permissions granted by ACEs to be no greater +* than permissions of the requested group mode. +* Applies when the "aclmode" property is set to +* "groupmask". */ if ((type == ALLOW) && trim) access_mask &= masks.group; @@ -1729,7 +1728,7 @@ zfs_acl_ids_create(znode_t *dzp, int fla acl_ids->z_aclp->z_hints |= (vap->va_type == VDIR) ? ZFS_ACL_AUTO_INHERIT : 0; zfs_acl_chmod(vap->va_type, acl_ids->z_mode, - (zfsvfs->z_acl_inherit == ZFS_ACL_RESTRICTED), + (zfsvfs->z_acl_mode == ZFS_ACL_GROUPMASK), acl_ids->z_aclp); } } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299447 - head/sys/dev/vnic
Author: zbb Date: Wed May 11 13:42:20 2016 New Revision: 299447 URL: https://svnweb.freebsd.org/changeset/base/299447 Log: Add support for MTU chaning and Jumbo frames to VNIC Enable previously added code for MTU handling (based on Cavium 1.0 driver released on BSD license). This commit enables possibility to change MTU on VNIC driver. Obtained from: Semihalf Sponsored by: Cavium Modified: head/sys/dev/vnic/nicvf_main.c Modified: head/sys/dev/vnic/nicvf_main.c == --- head/sys/dev/vnic/nicvf_main.c Wed May 11 13:38:29 2016 (r299446) +++ head/sys/dev/vnic/nicvf_main.c Wed May 11 13:42:20 2016 (r299447) @@ -138,6 +138,7 @@ static int nicvf_allocate_misc_interrupt static int nicvf_enable_misc_interrupt(struct nicvf *); static int nicvf_allocate_net_interrupts(struct nicvf *); static void nicvf_release_all_interrupts(struct nicvf *); +static int nicvf_update_hw_max_frs(struct nicvf *, int); static int nicvf_hw_set_mac_addr(struct nicvf *, uint8_t *); static void nicvf_config_cpi(struct nicvf *); static int nicvf_rss_init(struct nicvf *); @@ -362,7 +363,7 @@ nicvf_setup_ifnet(struct nicvf *nic) if_setcapabilities(ifp, 0); /* Set the default values */ - if_setcapabilitiesbit(ifp, IFCAP_VLAN_MTU, 0); + if_setcapabilitiesbit(ifp, IFCAP_VLAN_MTU | IFCAP_JUMBO_MTU, 0); if_setcapabilitiesbit(ifp, IFCAP_LRO, 0); if (nic->hw_tso) { /* TSO */ @@ -465,11 +466,16 @@ nicvf_if_ioctl(struct ifnet *ifp, u_long err = ether_ioctl(ifp, cmd, data); break; case SIOCSIFMTU: - /* -* ARM64TODO: Needs to be implemented. -* Currently ETHERMTU is set by default. -*/ - err = ether_ioctl(ifp, cmd, data); + if (ifr->ifr_mtu < NIC_HW_MIN_FRS || + ifr->ifr_mtu > NIC_HW_MAX_FRS) { + err = EINVAL; + } else { + NICVF_CORE_LOCK(nic); + err = nicvf_update_hw_max_frs(nic, ifr->ifr_mtu); + if (err == 0) + if_setmtu(ifp, ifr->ifr_mtu); + NICVF_CORE_UNLOCK(nic); + } break; case SIOCSIFFLAGS: NICVF_CORE_LOCK(nic); @@ -974,6 +980,18 @@ nicvf_handle_mbx_intr(struct nicvf *nic) } static int +nicvf_update_hw_max_frs(struct nicvf *nic, int mtu) +{ + union nic_mbx mbx = {}; + + mbx.frs.msg = NIC_MBOX_MSG_SET_MAX_FRS; + mbx.frs.max_frs = mtu; + mbx.frs.vf_id = nic->vf_id; + + return nicvf_send_msg_to_pf(nic, &mbx); +} + +static int nicvf_hw_set_mac_addr(struct nicvf *nic, uint8_t *hwaddr) { union nic_mbx mbx = {}; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299448 - in head/sys/cddl/contrib/opensolaris: common/acl uts/common/fs/zfs uts/common/sys
Author: mav Date: Wed May 11 13:43:20 2016 New Revision: 299448 URL: https://svnweb.freebsd.org/changeset/base/299448 Log: MFV r299442: 6762 POSIX write should imply DELETE_CHILD on directories - and some additional considerations Reviewed by: Gordon Ross Reviewed by: Yuri Pankov Author: Kevin Crowe openzfs/openzfs@d316fffc9c361532a482208561bbb614dac7f916 Modified: head/sys/cddl/contrib/opensolaris/common/acl/acl_common.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c head/sys/cddl/contrib/opensolaris/uts/common/sys/acl.h Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/common/acl/acl_common.c == --- head/sys/cddl/contrib/opensolaris/common/acl/acl_common.c Wed May 11 13:42:20 2016(r299447) +++ head/sys/cddl/contrib/opensolaris/common/acl/acl_common.c Wed May 11 13:43:20 2016(r299448) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright 2014 Nexenta Systems, Inc. All rights reserved. */ #include @@ -1580,7 +1580,8 @@ acl_trivial_access_masks(mode_t mode, bo uint32_t write_mask = ACE_WRITE_DATA|ACE_APPEND_DATA; uint32_t execute_mask = ACE_EXECUTE; - (void) isdir; /* will need this later */ + if (isdir) + write_mask |= ACE_DELETE_CHILD; masks->deny1 = 0; if (!(mode & S_IRUSR) && (mode & (S_IRGRP|S_IROTH))) @@ -1724,10 +1725,17 @@ ace_trivial_common(void *acep, int aclcn return (1); /* -* Delete permissions are never set by default +* Delete permission is never set by default +*/ + if (mask & ACE_DELETE) + return (1); + + /* +* Child delete permission should be accompanied by write */ - if (mask & (ACE_DELETE|ACE_DELETE_CHILD)) + if ((mask & ACE_DELETE_CHILD) && !(mask & ACE_WRITE_DATA)) return (1); + /* * only allow owner@ to have * write_acl/write_owner/write_attributes/write_xattr/ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Wed May 11 13:42:20 2016(r299447) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Wed May 11 13:43:20 2016(r299448) @@ -20,8 +20,8 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright 2014 Nexenta Systems, Inc. All rights reserved. */ #include @@ -2092,7 +2092,7 @@ zfs_zaccess_dataset_check(znode_t *zp, u * placed into the working_mode, giving the caller a mask of denied * accesses. Returns: * 0 if all AoI granted - * EACCESS if the denied mask is non-zero + * EACCES if the denied mask is non-zero * other error if abnormal failure (e.g., IO error) * * A secondary usage of the function is to determine if any of the @@ -2539,46 +2539,30 @@ zfs_zaccess_unix(znode_t *zp, mode_t mod return (zfs_zaccess(zp, v4_mode, 0, B_FALSE, cr)); } -static int -zfs_delete_final_check(znode_t *zp, znode_t *dzp, -mode_t available_perms, cred_t *cr) -{ - int error; - uid_t downer; - - downer = zfs_fuid_map_id(dzp->z_zfsvfs, dzp->z_uid, cr, ZFS_OWNER); - - error = secpolicy_vnode_access2(cr, ZTOV(dzp), - downer, available_perms, VWRITE|VEXEC); - - if (error == 0) - error = zfs_sticky_remove_access(dzp, zp, cr); - - return (error); -} +/* See zfs_zaccess_delete() */ +int zfs_write_implies_delete_child = 1; /* - * Determine whether Access should be granted/deny, without - * consulting least priv subsystem. + * Determine whether delete access should be granted. * * The following chart is the recommended NFSv4 enforcement for * ability to delete an object. * * --- - * | Parent Dir | Target Object Permissions | + * | Parent Dir | Target Object Permissions | * | permissions | | * --- * | | ACL Allows | ACL Denies| Delete | * | | Delete| Delete | unspecified| * --- - * | ACL Allows
svn commit: r299446 - head/sys/dev/vnic
Author: zbb Date: Wed May 11 13:38:29 2016 New Revision: 299446 URL: https://svnweb.freebsd.org/changeset/base/299446 Log: Fix deadlock in VNIC when using single CPU only Number of free Tx descriptors does not need to be locked since it can be modified atomically between SND and CQ tasks. It will also block Tx routine from sending packets while CQ will not be able to free descriptors. Obtained from:Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D6266 Modified: head/sys/dev/vnic/nicvf_queues.c Modified: head/sys/dev/vnic/nicvf_queues.c == --- head/sys/dev/vnic/nicvf_queues.cWed May 11 13:23:56 2016 (r299445) +++ head/sys/dev/vnic/nicvf_queues.cWed May 11 13:38:29 2016 (r299446) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -691,7 +692,7 @@ nicvf_rcv_pkt_handler(struct nicvf *nic, return (0); } -static int +static void nicvf_snd_pkt_handler(struct nicvf *nic, struct cmp_queue *cq, struct cqe_send_t *cqe_tx, int cqe_type) { @@ -702,15 +703,10 @@ nicvf_snd_pkt_handler(struct nicvf *nic, mbuf = NULL; sq = &nic->qs->sq[cqe_tx->sq_idx]; - /* Avoid blocking here since we hold a non-sleepable NICVF_CMP_LOCK */ - if (NICVF_TX_TRYLOCK(sq) == 0) - return (EAGAIN); hdr = (struct sq_hdr_subdesc *)GET_SQ_DESC(sq, cqe_tx->sqe_ptr); - if (hdr->subdesc_type != SQ_DESC_TYPE_HEADER) { - NICVF_TX_UNLOCK(sq); - return (0); - } + if (hdr->subdesc_type != SQ_DESC_TYPE_HEADER) + return; dprintf(nic->dev, "%s Qset #%d SQ #%d SQ ptr #%d subdesc count %d\n", @@ -728,9 +724,6 @@ nicvf_snd_pkt_handler(struct nicvf *nic, } nicvf_check_cqe_tx_errs(nic, cq, cqe_tx); - - NICVF_TX_UNLOCK(sq); - return (0); } static int @@ -788,16 +781,8 @@ nicvf_cq_intr_handler(struct nicvf *nic, work_done++; break; case CQE_TYPE_SEND: - cmp_err = nicvf_snd_pkt_handler(nic, cq, - (void *)cq_desc, CQE_TYPE_SEND); - if (__predict_false(cmp_err != 0)) { - /* -* Ups. Cannot finish now. -* Let's try again later. -*/ - goto done; - } - + nicvf_snd_pkt_handler(nic, cq, (void *)cq_desc, + CQE_TYPE_SEND); tx_done++; break; case CQE_TYPE_INVALID: @@ -1085,7 +1070,7 @@ nicvf_init_snd_queue(struct nicvf *nic, sq->desc = sq->dmem.base; sq->head = sq->tail = 0; - sq->free_cnt = q_len - 1; + atomic_store_rel_int(&sq->free_cnt, q_len - 1); sq->thresh = SND_QUEUE_THRESH; sq->idx = qidx; sq->nic = nic; @@ -1676,7 +1661,7 @@ nicvf_get_sq_desc(struct snd_queue *sq, int qentry; qentry = sq->tail; - sq->free_cnt -= desc_cnt; + atomic_subtract_int(&sq->free_cnt, desc_cnt); sq->tail += desc_cnt; sq->tail &= (sq->dmem.q_len - 1); @@ -1688,7 +1673,7 @@ static void nicvf_put_sq_desc(struct snd_queue *sq, int desc_cnt) { - sq->free_cnt += desc_cnt; + atomic_add_int(&sq->free_cnt, desc_cnt); sq->head += desc_cnt; sq->head &= (sq->dmem.q_len - 1); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299445 - head/sys/arm64/include
Author: zbb Date: Wed May 11 13:23:56 2016 New Revision: 299445 URL: https://svnweb.freebsd.org/changeset/base/299445 Log: Fix I/O coherence issues on ThunderX when SMP is disabled To maintain coherence between cache and DMA memory appropriate shareability flags need to be set in the PTE regardless of SMP option. Reviewed by: wma Obtained from:Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D6231 Modified: head/sys/arm64/include/pte.h Modified: head/sys/arm64/include/pte.h == --- head/sys/arm64/include/pte.hWed May 11 13:22:13 2016 (r299444) +++ head/sys/arm64/include/pte.hWed May 11 13:23:56 2016 (r299445) @@ -63,11 +63,7 @@ typedef uint64_tpt_entry_t; /* page ta #defineATTR_IDX(x) ((x) << 2) #defineATTR_IDX_MASK (7 << 2) -#ifdef SMP #defineATTR_DEFAULT(ATTR_AF | ATTR_SH(ATTR_SH_IS)) -#else -#defineATTR_DEFAULT(ATTR_AF) -#endif #defineATTR_DESCR_MASK 3 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299444 - head/sys/dev/vnic
Author: zbb Date: Wed May 11 13:22:13 2016 New Revision: 299444 URL: https://svnweb.freebsd.org/changeset/base/299444 Log: Add HW RSS support to VNIC driver Based on v1.0 driver provided by Cavium under BSD license. Support in-hardware RSS to distribute IP, UDP and TCP traffic among available RX Queues and hence multiple CPUs. Reviewed by: wma Obtained from:Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D6230 Modified: head/sys/dev/vnic/nic.h head/sys/dev/vnic/nic_main.c head/sys/dev/vnic/nicvf_main.c head/sys/dev/vnic/nicvf_queues.c Modified: head/sys/dev/vnic/nic.h == --- head/sys/dev/vnic/nic.h Wed May 11 13:20:29 2016(r299443) +++ head/sys/dev/vnic/nic.h Wed May 11 13:22:13 2016(r299444) @@ -176,6 +176,24 @@ struct msix_entry { #defineNIC_MAX_RSS_IDR_TBL_SIZE(1 << NIC_MAX_RSS_HASH_BITS) #defineRSS_HASH_KEY_SIZE 5 /* 320 bit key */ +struct nicvf_rss_info { + boolean_t enable; +#defineRSS_L2_EXTENDED_HASH_ENA(1UL << 0) +#defineRSS_IP_HASH_ENA (1UL << 1) +#defineRSS_TCP_HASH_ENA(1UL << 2) +#defineRSS_TCP_SYN_DIS (1UL << 3) +#defineRSS_UDP_HASH_ENA(1UL << 4) +#defineRSS_L4_EXTENDED_HASH_ENA(1UL << 5) +#defineRSS_ROCE_ENA(1UL << 6) +#defineRSS_L3_BI_DIRECTION_ENA (1UL << 7) +#defineRSS_L4_BI_DIRECTION_ENA (1UL << 8) + uint64_t cfg; + uint8_t hash_bits; + uint16_t rss_size; + uint8_t ind_tbl[NIC_MAX_RSS_IDR_TBL_SIZE]; + uint64_t key[RSS_HASH_KEY_SIZE]; +}; + enum rx_stats_reg_offset { RX_OCTS = 0x0, RX_UCAST = 0x1, @@ -285,6 +303,7 @@ struct nicvf { boolean_t tns_mode:1; boolean_t sqs_mode:1; boolloopback_supported:1; + struct nicvf_rss_info rss_info; uint16_tmtu; struct queue_set*qs; uint8_t rx_queues; Modified: head/sys/dev/vnic/nic_main.c == --- head/sys/dev/vnic/nic_main.cWed May 11 13:20:29 2016 (r299443) +++ head/sys/dev/vnic/nic_main.cWed May 11 13:22:13 2016 (r299444) @@ -103,6 +103,7 @@ struct nicpf { uint8_t duplex[MAX_LMAC]; uint32_tspeed[MAX_LMAC]; uint16_tcpi_base[MAX_NUM_VFS_SUPPORTED]; + uint16_trssi_base[MAX_NUM_VFS_SUPPORTED]; uint16_trss_ind_tbl_size; /* MSI-X */ @@ -744,6 +745,58 @@ nic_config_cpi(struct nicpf *nic, struct rssi = ((cpi - cpi_base) & 0x38) >> 3; } nic->cpi_base[cfg->vf_id] = cpi_base; + nic->rssi_base[cfg->vf_id] = rssi_base; +} + +/* Responsds to VF with its RSS indirection table size */ +static void +nic_send_rss_size(struct nicpf *nic, int vf) +{ + union nic_mbx mbx = {}; + uint64_t *msg; + + msg = (uint64_t *)&mbx; + + mbx.rss_size.msg = NIC_MBOX_MSG_RSS_SIZE; + mbx.rss_size.ind_tbl_size = nic->rss_ind_tbl_size; + nic_send_msg_to_vf(nic, vf, &mbx); +} + +/* + * Receive side scaling configuration + * configure: + * - RSS index + * - indir table i.e hash::RQ mapping + * - no of hash bits to consider + */ +static void +nic_config_rss(struct nicpf *nic, struct rss_cfg_msg *cfg) +{ + uint8_t qset, idx; + uint64_t cpi_cfg, cpi_base, rssi_base, rssi; + uint64_t idx_addr; + + idx = 0; + rssi_base = nic->rssi_base[cfg->vf_id] + cfg->tbl_offset; + + rssi = rssi_base; + qset = cfg->vf_id; + + for (; rssi < (rssi_base + cfg->tbl_len); rssi++) { + nic_reg_write(nic, NIC_PF_RSSI_0_4097_RQ | (rssi << 3), + (qset << 3) | (cfg->ind_tbl[idx] & 0x7)); + idx++; + } + + cpi_base = nic->cpi_base[cfg->vf_id]; + if (pass1_silicon(nic->dev)) + idx_addr = NIC_PF_CPI_0_2047_CFG; + else + idx_addr = NIC_PF_MPI_0_2047_CFG; + cpi_cfg = nic_reg_read(nic, idx_addr | (cpi_base << 3)); + cpi_cfg &= ~(0xFUL << 20); + cpi_cfg |= (cfg->hash_bits << 20); + nic_reg_write(nic, idx_addr | (cpi_base << 3), cpi_cfg); } /* @@ -896,6 +949,13 @@ nic_handle_mbx_intr(struct nicpf *nic, i case NIC_MBOX_MSG_CPI_CFG: nic_config_cpi(nic, &mbx.cpi_cfg); break; + case NIC_MBOX_MSG_RSS_SIZE: + nic_send_rss_size(nic, vf); + goto unlock; + case NIC_MBOX_MSG_RSS_CFG: + case NIC_MBOX_MSG_RSS_CFG_CONT: /* fall through */ + nic_config_rss(nic, &mbx.rss_c
svn commit: r299443 - head/sys/dev/vnic
Author: zbb Date: Wed May 11 13:20:29 2016 New Revision: 299443 URL: https://svnweb.freebsd.org/changeset/base/299443 Log: Bind CQ interrupts and tasks to separate CPUs in VNIC Delegate interrupts and completion tasks on separate CPUs for each VNIC. Reviewed by: wma Obtained from:Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D6229 Modified: head/sys/dev/vnic/nicvf_main.c head/sys/dev/vnic/nicvf_queues.h Modified: head/sys/dev/vnic/nicvf_main.c == --- head/sys/dev/vnic/nicvf_main.c Wed May 11 12:58:12 2016 (r299442) +++ head/sys/dev/vnic/nicvf_main.c Wed May 11 13:20:29 2016 (r299443) @@ -1296,6 +1296,7 @@ nicvf_release_net_interrupts(struct nicv static int nicvf_allocate_net_interrupts(struct nicvf *nic) { + u_int cpuid; int irq, rid; int qidx; int ret = 0; @@ -1332,6 +1333,20 @@ nicvf_allocate_net_interrupts(struct nic (irq - NICVF_INTR_ID_CQ), device_get_unit(nic->dev)); goto error; } + cpuid = (device_get_unit(nic->dev) * CMP_QUEUE_CNT) + qidx; + cpuid %= mp_ncpus; + /* +* Save CPU ID for later use when system-wide RSS is enabled. +* It will be used to pit the CQ task to the same CPU that got +* interrupted. +*/ + nic->qs->cq[qidx].cmp_cpuid = cpuid; + if (bootverbose) { + device_printf(nic->dev, "bind CQ%d IRQ to CPU%d\n", + qidx, cpuid); + } + /* Bind interrupts to the given CPU */ + bus_bind_intr(nic->dev, nic->msix_entries[irq].irq_res, cpuid); } /* Register RBDR interrupt */ Modified: head/sys/dev/vnic/nicvf_queues.h == --- head/sys/dev/vnic/nicvf_queues.hWed May 11 12:58:12 2016 (r299442) +++ head/sys/dev/vnic/nicvf_queues.hWed May 11 13:20:29 2016 (r299443) @@ -296,6 +296,7 @@ struct cmp_queue { struct task cmp_task; struct taskqueue*cmp_taskq; + u_int cmp_cpuid; /* CPU to which bind the CQ task */ void*desc; struct q_desc_mem dmem; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299442 - in vendor-sys/illumos/dist: common/acl uts/common/fs/zfs uts/common/sys
Author: mav Date: Wed May 11 12:58:12 2016 New Revision: 299442 URL: https://svnweb.freebsd.org/changeset/base/299442 Log: 6762 POSIX write should imply DELETE_CHILD on directories - and some additional considerations Reviewed by: Gordon Ross Reviewed by: Yuri Pankov Author: Kevin Crowe openzfs/openzfs@d316fffc9c361532a482208561bbb614dac7f916 Modified: vendor-sys/illumos/dist/common/acl/acl_common.c vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_acl.c vendor-sys/illumos/dist/uts/common/sys/acl.h Modified: vendor-sys/illumos/dist/common/acl/acl_common.c == --- vendor-sys/illumos/dist/common/acl/acl_common.c Wed May 11 12:54:00 2016(r299441) +++ vendor-sys/illumos/dist/common/acl/acl_common.c Wed May 11 12:58:12 2016(r299442) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright 2014 Nexenta Systems, Inc. All rights reserved. */ #include @@ -1575,7 +1575,8 @@ acl_trivial_access_masks(mode_t mode, bo uint32_t write_mask = ACE_WRITE_DATA|ACE_APPEND_DATA; uint32_t execute_mask = ACE_EXECUTE; - (void) isdir; /* will need this later */ + if (isdir) + write_mask |= ACE_DELETE_CHILD; masks->deny1 = 0; if (!(mode & S_IRUSR) && (mode & (S_IRGRP|S_IROTH))) @@ -1719,10 +1720,17 @@ ace_trivial_common(void *acep, int aclcn return (1); /* -* Delete permissions are never set by default +* Delete permission is never set by default +*/ + if (mask & ACE_DELETE) + return (1); + + /* +* Child delete permission should be accompanied by write */ - if (mask & (ACE_DELETE|ACE_DELETE_CHILD)) + if ((mask & ACE_DELETE_CHILD) && !(mask & ACE_WRITE_DATA)) return (1); + /* * only allow owner@ to have * write_acl/write_owner/write_attributes/write_xattr/ Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_acl.c == --- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_acl.c Wed May 11 12:54:00 2016(r299441) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_acl.c Wed May 11 12:58:12 2016(r299442) @@ -20,8 +20,8 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright 2014 Nexenta Systems, Inc. All rights reserved. */ #include @@ -2080,7 +2080,7 @@ zfs_zaccess_dataset_check(znode_t *zp, u * placed into the working_mode, giving the caller a mask of denied * accesses. Returns: * 0 if all AoI granted - * EACCESS if the denied mask is non-zero + * EACCES if the denied mask is non-zero * other error if abnormal failure (e.g., IO error) * * A secondary usage of the function is to determine if any of the @@ -2517,46 +2517,30 @@ zfs_zaccess_unix(znode_t *zp, mode_t mod return (zfs_zaccess(zp, v4_mode, 0, B_FALSE, cr)); } -static int -zfs_delete_final_check(znode_t *zp, znode_t *dzp, -mode_t available_perms, cred_t *cr) -{ - int error; - uid_t downer; - - downer = zfs_fuid_map_id(dzp->z_zfsvfs, dzp->z_uid, cr, ZFS_OWNER); - - error = secpolicy_vnode_access2(cr, ZTOV(dzp), - downer, available_perms, VWRITE|VEXEC); - - if (error == 0) - error = zfs_sticky_remove_access(dzp, zp, cr); - - return (error); -} +/* See zfs_zaccess_delete() */ +int zfs_write_implies_delete_child = 1; /* - * Determine whether Access should be granted/deny, without - * consulting least priv subsystem. + * Determine whether delete access should be granted. * * The following chart is the recommended NFSv4 enforcement for * ability to delete an object. * * --- - * | Parent Dir | Target Object Permissions | + * | Parent Dir | Target Object Permissions | * | permissions | | * --- * | | ACL Allows | ACL Denies| Delete | * | | Delete| Delete | unspecified| * --- - * | ACL Allows | Permit | Permit| Permit | - * | DELETE_CHILD | | + * | ACL Allows | Permit | Permit * | Permit | + * | DELE
svn commit: r299441 - in head/sys/cddl/contrib/opensolaris/uts/common: fs/zfs fs/zfs/sys sys/fs
Author: mav Date: Wed May 11 12:54:00 2016 New Revision: 299441 URL: https://svnweb.freebsd.org/changeset/base/299441 Log: MFV r299440: 6736 ZFS per-vdev ZAPs Reviewed by: Matthew Ahrens Reviewed by: John Kennedy Reviewed by: George Wilson Reviewed by: Don Brady Reviewed by: Dan McDonald Approved by: Richard Lowe Author: Joe Stein openzfs/openzfs@215198a6ad15cf4832370e2f19247abeb36b951a Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Wed May 11 12:50:58 2016(r299440) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Wed May 11 12:54:00 2016(r299441) @@ -1665,6 +1665,19 @@ spa_check_removed(vdev_t *vd) } } +static void +spa_config_valid_zaps(vdev_t *vd, vdev_t *mvd) +{ + ASSERT3U(vd->vdev_children, ==, mvd->vdev_children); + + vd->vdev_top_zap = mvd->vdev_top_zap; + vd->vdev_leaf_zap = mvd->vdev_leaf_zap; + + for (uint64_t i = 0; i < vd->vdev_children; i++) { + spa_config_valid_zaps(vd->vdev_child[i], mvd->vdev_child[i]); + } +} + /* * Validate the current config against the MOS config */ @@ -1768,16 +1781,25 @@ spa_config_valid(spa_t *spa, nvlist_t *c spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); vdev_reopen(rvd); - } else if (mtvd->vdev_islog) { + } else { + if (mtvd->vdev_islog) { + /* +* Load the slog device's state from the MOS +* config since it's possible that the label +* does not contain the most up-to-date +* information. +*/ + vdev_load_log_state(tvd, mtvd); + vdev_reopen(tvd); + } + /* -* Load the slog device's state from the MOS config -* since it's possible that the label does not -* contain the most up-to-date information. +* Per-vdev ZAP info is stored exclusively in the MOS. */ - vdev_load_log_state(tvd, mtvd); - vdev_reopen(tvd); + spa_config_valid_zaps(tvd, mtvd); } } + vdev_free(mrvd); spa_config_exit(spa, SCL_ALL, FTAG); @@ -2210,6 +2232,34 @@ spa_load(spa_t *spa, spa_load_state_t st } /* + * Count the number of per-vdev ZAPs associated with all of the vdevs in the + * vdev tree rooted in the given vd, and ensure that each ZAP is present in the + * spa's per-vdev ZAP list. + */ +static uint64_t +vdev_count_verify_zaps(vdev_t *vd) +{ + spa_t *spa = vd->vdev_spa; + uint64_t total = 0; + if (vd->vdev_top_zap != 0) { + total++; + ASSERT0(zap_lookup_int(spa->spa_meta_objset, + spa->spa_all_vdev_zaps, vd->vdev_top_zap)); + } + if (vd->vdev_leaf_zap != 0) { + total++; + ASSERT0(zap_lookup_int(spa->spa_meta_objset, + spa->spa_all_vdev_zaps, vd->vdev_leaf_zap)); + } + + for (uint64_t i = 0; i < vd->vdev_children; i++) { + total += vdev_count_verify_zaps(vd->vdev_child[i]); + } + + return (total); +} + +/* * Load an existing storage pool, using the pool's builtin spa_config as a * source of configuration information. */ @@ -2638,6 +2688,39 @@ spa_load_impl(spa_t *spa, uint64_t pool_ return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); /* +* Load the per-vdev ZAP map. If we have an older pool, this will not +* be present; in this case, defer its creation to a later time to +* avoid dirtying the MOS this early / out of sync context. See +* spa_sync_config_object. +*/ + + /* The sentinel is only available in the MOS config. */ + nvlist_t
svn commit: r299440 - in vendor-sys/illumos/dist/uts/common: fs/zfs fs/zfs/sys sys/fs
Author: mav Date: Wed May 11 12:50:58 2016 New Revision: 299440 URL: https://svnweb.freebsd.org/changeset/base/299440 Log: 6736 ZFS per-vdev ZAPs Reviewed by: Matthew Ahrens Reviewed by: John Kennedy Reviewed by: George Wilson Reviewed by: Don Brady Reviewed by: Dan McDonald Approved by: Richard Lowe Author: Joe Stein openzfs/openzfs@215198a6ad15cf4832370e2f19247abeb36b951a Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa_config.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_label.c vendor-sys/illumos/dist/uts/common/fs/zfs/zap.c vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c == --- vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Wed May 11 12:46:07 2016(r299439) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Wed May 11 12:50:58 2016(r299440) @@ -1610,6 +1610,19 @@ spa_check_removed(vdev_t *vd) } } +static void +spa_config_valid_zaps(vdev_t *vd, vdev_t *mvd) +{ + ASSERT3U(vd->vdev_children, ==, mvd->vdev_children); + + vd->vdev_top_zap = mvd->vdev_top_zap; + vd->vdev_leaf_zap = mvd->vdev_leaf_zap; + + for (uint64_t i = 0; i < vd->vdev_children; i++) { + spa_config_valid_zaps(vd->vdev_child[i], mvd->vdev_child[i]); + } +} + /* * Validate the current config against the MOS config */ @@ -1713,16 +1726,25 @@ spa_config_valid(spa_t *spa, nvlist_t *c spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); vdev_reopen(rvd); - } else if (mtvd->vdev_islog) { + } else { + if (mtvd->vdev_islog) { + /* +* Load the slog device's state from the MOS +* config since it's possible that the label +* does not contain the most up-to-date +* information. +*/ + vdev_load_log_state(tvd, mtvd); + vdev_reopen(tvd); + } + /* -* Load the slog device's state from the MOS config -* since it's possible that the label does not -* contain the most up-to-date information. +* Per-vdev ZAP info is stored exclusively in the MOS. */ - vdev_load_log_state(tvd, mtvd); - vdev_reopen(tvd); + spa_config_valid_zaps(tvd, mtvd); } } + vdev_free(mrvd); spa_config_exit(spa, SCL_ALL, FTAG); @@ -2140,6 +2162,34 @@ spa_load(spa_t *spa, spa_load_state_t st } /* + * Count the number of per-vdev ZAPs associated with all of the vdevs in the + * vdev tree rooted in the given vd, and ensure that each ZAP is present in the + * spa's per-vdev ZAP list. + */ +static uint64_t +vdev_count_verify_zaps(vdev_t *vd) +{ + spa_t *spa = vd->vdev_spa; + uint64_t total = 0; + if (vd->vdev_top_zap != 0) { + total++; + ASSERT0(zap_lookup_int(spa->spa_meta_objset, + spa->spa_all_vdev_zaps, vd->vdev_top_zap)); + } + if (vd->vdev_leaf_zap != 0) { + total++; + ASSERT0(zap_lookup_int(spa->spa_meta_objset, + spa->spa_all_vdev_zaps, vd->vdev_leaf_zap)); + } + + for (uint64_t i = 0; i < vd->vdev_children; i++) { + total += vdev_count_verify_zaps(vd->vdev_child[i]); + } + + return (total); +} + +/* * Load an existing storage pool, using the pool's builtin spa_config as a * source of configuration information. */ @@ -2568,6 +2618,39 @@ spa_load_impl(spa_t *spa, uint64_t pool_ return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); /* +* Load the per-vdev ZAP map. If we have an older pool, this will not +* be present; in this case, defer its creation to a later time to +* avoid dirtying the MOS this early / out of sync context. See +* spa_sync_config_object. +*/ + + /* The sentinel is only available in the MOS config. */ + nvlist_t *mos_config; + if (load_nvlist(spa, spa->spa_config_object, &mos_config) != 0) + return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); + + error = spa_dir_prop(spa, DMU_POOL_VDEV_ZAP_MAP,
svn commit: r299439 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: mav Date: Wed May 11 12:46:07 2016 New Revision: 299439 URL: https://svnweb.freebsd.org/changeset/base/299439 Log: MFV r299438: 6842 Fix empty xattr dir causing lockup Reviewed by: Brian Behlendorf Reviewed by: Dan McDonald Reviewed by: Matthew Ahrens Approved by: Robert Mustacchi Author: Chunwei Chen openzfs/openzfs@02525cd08fb3730fff3a69cb5376443d481f7839 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c Wed May 11 12:45:21 2016(r299438) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c Wed May 11 12:46:07 2016(r299439) @@ -575,7 +575,14 @@ zap_deref_leaf(zap_t *zap, uint64_t h, d ASSERT(zap->zap_dbuf == NULL || zap_f_phys(zap) == zap->zap_dbuf->db_data); - ASSERT3U(zap_f_phys(zap)->zap_magic, ==, ZAP_MAGIC); + + /* Reality check for corrupt zap objects (leaf or header). */ + if ((zap_f_phys(zap)->zap_block_type != ZBT_LEAF && + zap_f_phys(zap)->zap_block_type != ZBT_HEADER) || + zap_f_phys(zap)->zap_magic != ZAP_MAGIC) { + return (SET_ERROR(EIO)); + } + idx = ZAP_HASH_IDX(h, zap_f_phys(zap)->zap_ptrtbl.zt_shift); err = zap_idx_to_blk(zap, idx, &blk); if (err != 0) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c Wed May 11 12:45:21 2016(r299438) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c Wed May 11 12:46:07 2016(r299439) @@ -373,6 +373,9 @@ mzap_open(objset_t *os, uint64_t obj, dm zap_t *winner; zap_t *zap; int i; + uint64_t *zap_hdr = (uint64_t *)db->db_data; + uint64_t zap_block_type = zap_hdr[0]; + uint64_t zap_magic = zap_hdr[1]; ASSERT3U(MZAP_ENT_LEN, ==, sizeof (mzap_ent_phys_t)); @@ -383,9 +386,13 @@ mzap_open(objset_t *os, uint64_t obj, dm zap->zap_object = obj; zap->zap_dbuf = db; - if (*(uint64_t *)db->db_data != ZBT_MICRO) { + if (zap_block_type != ZBT_MICRO) { mutex_init(&zap->zap_f.zap_num_entries_mtx, 0, 0, 0); zap->zap_f.zap_block_shift = highbit64(db->db_size) - 1; + if (zap_block_type != ZBT_HEADER || zap_magic != ZAP_MAGIC) { + winner = NULL; /* No actual winner here... */ + goto handle_winner; + } } else { zap->zap_ismicro = TRUE; } @@ -398,14 +405,8 @@ mzap_open(objset_t *os, uint64_t obj, dm dmu_buf_init_user(&zap->zap_dbu, zap_evict, &zap->zap_dbuf); winner = dmu_buf_set_user(db, &zap->zap_dbu); - if (winner != NULL) { - rw_exit(&zap->zap_rwlock); - rw_destroy(&zap->zap_rwlock); - if (!zap->zap_ismicro) - mutex_destroy(&zap->zap_f.zap_num_entries_mtx); - kmem_free(zap, sizeof (zap_t)); - return (winner); - } + if (winner != NULL) + goto handle_winner; if (zap->zap_ismicro) { zap->zap_salt = zap_m_phys(zap)->mz_salt; @@ -457,6 +458,14 @@ mzap_open(objset_t *os, uint64_t obj, dm } rw_exit(&zap->zap_rwlock); return (zap); + +handle_winner: + rw_exit(&zap->zap_rwlock); + rw_destroy(&zap->zap_rwlock); + if (!zap->zap_ismicro) + mutex_destroy(&zap->zap_f.zap_num_entries_mtx); + kmem_free(zap, sizeof (zap_t)); + return (winner); } int @@ -483,8 +492,17 @@ zap_lockdir(objset_t *os, uint64_t obj, #endif zap = dmu_buf_get_user(db); - if (zap == NULL) + if (zap == NULL) { zap = mzap_open(os, obj, db); + if (zap == NULL) { + /* +* mzap_open() didn't like what it saw on-disk. +* Check for corruption! +*/ + dmu_buf_rele(db, NULL); + return (SET_ERROR(EIO)); + } + } /* * We're checking zap_ismicro without the lock held, in order to ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299438 - vendor-sys/illumos/dist/uts/common/fs/zfs
Author: mav Date: Wed May 11 12:45:21 2016 New Revision: 299438 URL: https://svnweb.freebsd.org/changeset/base/299438 Log: 6842 Fix empty xattr dir causing lockup Reviewed by: Brian Behlendorf Reviewed by: Dan McDonald Reviewed by: Matthew Ahrens Approved by: Robert Mustacchi Author: Chunwei Chen openzfs/openzfs@02525cd08fb3730fff3a69cb5376443d481f7839 Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zap.c vendor-sys/illumos/dist/uts/common/fs/zfs/zap_micro.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zap.c == --- vendor-sys/illumos/dist/uts/common/fs/zfs/zap.c Wed May 11 12:43:54 2016(r299437) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zap.c Wed May 11 12:45:21 2016(r299438) @@ -575,7 +575,14 @@ zap_deref_leaf(zap_t *zap, uint64_t h, d ASSERT(zap->zap_dbuf == NULL || zap_f_phys(zap) == zap->zap_dbuf->db_data); - ASSERT3U(zap_f_phys(zap)->zap_magic, ==, ZAP_MAGIC); + + /* Reality check for corrupt zap objects (leaf or header). */ + if ((zap_f_phys(zap)->zap_block_type != ZBT_LEAF && + zap_f_phys(zap)->zap_block_type != ZBT_HEADER) || + zap_f_phys(zap)->zap_magic != ZAP_MAGIC) { + return (SET_ERROR(EIO)); + } + idx = ZAP_HASH_IDX(h, zap_f_phys(zap)->zap_ptrtbl.zt_shift); err = zap_idx_to_blk(zap, idx, &blk); if (err != 0) Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zap_micro.c == --- vendor-sys/illumos/dist/uts/common/fs/zfs/zap_micro.c Wed May 11 12:43:54 2016(r299437) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zap_micro.c Wed May 11 12:45:21 2016(r299438) @@ -367,6 +367,9 @@ mzap_open(objset_t *os, uint64_t obj, dm zap_t *winner; zap_t *zap; int i; + uint64_t *zap_hdr = (uint64_t *)db->db_data; + uint64_t zap_block_type = zap_hdr[0]; + uint64_t zap_magic = zap_hdr[1]; ASSERT3U(MZAP_ENT_LEN, ==, sizeof (mzap_ent_phys_t)); @@ -377,9 +380,13 @@ mzap_open(objset_t *os, uint64_t obj, dm zap->zap_object = obj; zap->zap_dbuf = db; - if (*(uint64_t *)db->db_data != ZBT_MICRO) { + if (zap_block_type != ZBT_MICRO) { mutex_init(&zap->zap_f.zap_num_entries_mtx, 0, 0, 0); zap->zap_f.zap_block_shift = highbit64(db->db_size) - 1; + if (zap_block_type != ZBT_HEADER || zap_magic != ZAP_MAGIC) { + winner = NULL; /* No actual winner here... */ + goto handle_winner; + } } else { zap->zap_ismicro = TRUE; } @@ -392,14 +399,8 @@ mzap_open(objset_t *os, uint64_t obj, dm dmu_buf_init_user(&zap->zap_dbu, zap_evict, &zap->zap_dbuf); winner = dmu_buf_set_user(db, &zap->zap_dbu); - if (winner != NULL) { - rw_exit(&zap->zap_rwlock); - rw_destroy(&zap->zap_rwlock); - if (!zap->zap_ismicro) - mutex_destroy(&zap->zap_f.zap_num_entries_mtx); - kmem_free(zap, sizeof (zap_t)); - return (winner); - } + if (winner != NULL) + goto handle_winner; if (zap->zap_ismicro) { zap->zap_salt = zap_m_phys(zap)->mz_salt; @@ -446,6 +447,14 @@ mzap_open(objset_t *os, uint64_t obj, dm } rw_exit(&zap->zap_rwlock); return (zap); + +handle_winner: + rw_exit(&zap->zap_rwlock); + rw_destroy(&zap->zap_rwlock); + if (!zap->zap_ismicro) + mutex_destroy(&zap->zap_f.zap_num_entries_mtx); + kmem_free(zap, sizeof (zap_t)); + return (winner); } int @@ -472,8 +481,17 @@ zap_lockdir(objset_t *os, uint64_t obj, #endif zap = dmu_buf_get_user(db); - if (zap == NULL) + if (zap == NULL) { zap = mzap_open(os, obj, db); + if (zap == NULL) { + /* +* mzap_open() didn't like what it saw on-disk. +* Check for corruption! +*/ + dmu_buf_rele(db, NULL); + return (SET_ERROR(EIO)); + } + } /* * We're checking zap_ismicro without the lock held, in order to ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299437 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: mav Date: Wed May 11 12:43:54 2016 New Revision: 299437 URL: https://svnweb.freebsd.org/changeset/base/299437 Log: MFV r299436: 6843 Make xattr dir truncate and remove in one tx Reviewed by: Brian Behlendorf Reviewed by: Dan McDonald Reviewed by: Matthew Ahrens Approved by: Robert Mustacchi Author: Chunwei Chen openzfs/openzfs@399cc7d5d9aff97c714b708af3e3f0280ceab93f Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Wed May 11 12:39:53 2016(r299436) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Wed May 11 12:43:54 2016(r299437) @@ -611,19 +611,25 @@ zfs_rmnode(znode_t *zp) zfs_znode_free(zp); return; } - } - - /* -* Free up all the data in the file. -*/ - error = dmu_free_long_range(os, zp->z_id, 0, DMU_OBJECT_END); - if (error) { + } else { /* -* Not enough space. Leave the file in the unlinked set. +* Free up all the data in the file. We don't do this for +* XATTR directories because we need truncate and remove to be +* in the same tx, like in zfs_znode_delete(). Otherwise, if +* we crash here we'll end up with an inconsistent truncated +* zap object in the delete queue. Note a truncated file is +* harmless since it only contains user data. */ - zfs_znode_dmu_fini(zp); - zfs_znode_free(zp); - return; + error = dmu_free_long_range(os, zp->z_id, 0, DMU_OBJECT_END); + if (error) { + /* +* Not enough space. Leave the file in the unlinked +* set. +*/ + zfs_znode_dmu_fini(zp); + zfs_znode_free(zp); + return; + } } /* ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299436 - vendor-sys/illumos/dist/uts/common/fs/zfs
Author: mav Date: Wed May 11 12:39:53 2016 New Revision: 299436 URL: https://svnweb.freebsd.org/changeset/base/299436 Log: 6843 Make xattr dir truncate and remove in one tx Reviewed by: Brian Behlendorf Reviewed by: Dan McDonald Reviewed by: Matthew Ahrens Approved by: Robert Mustacchi Author: Chunwei Chen openzfs/openzfs@399cc7d5d9aff97c714b708af3e3f0280ceab93f Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_dir.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_dir.c == --- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_dir.c Wed May 11 12:38:07 2016(r299435) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_dir.c Wed May 11 12:39:53 2016(r299436) @@ -606,19 +606,25 @@ zfs_rmnode(znode_t *zp) zfs_znode_free(zp); return; } - } - - /* -* Free up all the data in the file. -*/ - error = dmu_free_long_range(os, zp->z_id, 0, DMU_OBJECT_END); - if (error) { + } else { /* -* Not enough space. Leave the file in the unlinked set. +* Free up all the data in the file. We don't do this for +* XATTR directories because we need truncate and remove to be +* in the same tx, like in zfs_znode_delete(). Otherwise, if +* we crash here we'll end up with an inconsistent truncated +* zap object in the delete queue. Note a truncated file is +* harmless since it only contains user data. */ - zfs_znode_dmu_fini(zp); - zfs_znode_free(zp); - return; + error = dmu_free_long_range(os, zp->z_id, 0, DMU_OBJECT_END); + if (error) { + /* +* Not enough space. Leave the file in the unlinked +* set. +*/ + zfs_znode_dmu_fini(zp); + zfs_znode_free(zp); + return; + } } /* ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"