svn commit: r309394 - head/sys/netpfil/pf
Author: marcel Date: Fri Dec 2 06:15:59 2016 New Revision: 309394 URL: https://svnweb.freebsd.org/changeset/base/309394 Log: Fix use-after-free bugs in pfsync(4) Use after free happens for state that is deleted. The reference count is what prevents the state from being freed. When the state is dequeued, the reference count is dropped and the memory freed. We can't dereference the next pointer or re-queue the state. MFC after:1 week Differential Revision:https://reviews.freebsd.org/D8671 Modified: head/sys/netpfil/pf/if_pfsync.c Modified: head/sys/netpfil/pf/if_pfsync.c == --- head/sys/netpfil/pf/if_pfsync.c Fri Dec 2 06:07:27 2016 (r309393) +++ head/sys/netpfil/pf/if_pfsync.c Fri Dec 2 06:15:59 2016 (r309394) @@ -1509,7 +1509,7 @@ pfsync_sendout(int schedswi) struct ip *ip; struct pfsync_header *ph; struct pfsync_subheader *subh; - struct pf_state *st; + struct pf_state *st, *st_next; struct pfsync_upd_req_item *ur; int offset; int q, count = 0; @@ -1559,7 +1559,7 @@ pfsync_sendout(int schedswi) offset += sizeof(*subh); count = 0; - TAILQ_FOREACH(st, &sc->sc_qs[q], sync_list) { + TAILQ_FOREACH_SAFE(st, &sc->sc_qs[q], sync_list, st_next) { KASSERT(st->sync_state == q, ("%s: st->sync_state == q", __func__)); @@ -1931,6 +1931,8 @@ pfsync_delete_state(struct pf_state *st) if (sc->sc_len == PFSYNC_MINPKT) callout_reset(&sc->sc_tmo, 1 * hz, pfsync_timeout, V_pfsyncif); + pf_ref_state(st); + switch (st->sync_state) { case PFSYNC_S_INS: /* We never got to tell the world so just forget about it. */ @@ -1950,6 +1952,9 @@ pfsync_delete_state(struct pf_state *st) default: panic("%s: unexpected sync state %d", __func__, st->sync_state); } + + pf_release_state(st); + PFSYNC_UNLOCK(sc); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r309393 - head/usr.sbin/ypldap
Forgot MFC after two weeks in my last two commits, so noted in my todo list. Br, 2016-12-02 14:07 GMT+08:00 Marcelo Araujo : > Author: araujo > Date: Fri Dec 2 06:07:27 2016 > New Revision: 309393 > URL: https://svnweb.freebsd.org/changeset/base/309393 > > Log: > Use memset(3) instead of bzero(3). > > Obtained from:OpenBSD (r1.12, r1.20, r1.18 and r1.37) > > Modified: > head/usr.sbin/ypldap/ldapclient.c > head/usr.sbin/ypldap/yp.c > head/usr.sbin/ypldap/ypldap.c > head/usr.sbin/ypldap/ypldap_dns.c > > Modified: head/usr.sbin/ypldap/ldapclient.c > > == > --- head/usr.sbin/ypldap/ldapclient.c Fri Dec 2 05:49:22 2016 > (r309392) > +++ head/usr.sbin/ypldap/ldapclient.c Fri Dec 2 06:07:27 2016 > (r309393) > @@ -363,7 +363,7 @@ ldapclient(int pipe_main2client[2]) > return (pid); > } > > - bzero(&env, sizeof(env)); > + memset(&env, 0, sizeof(env)); > TAILQ_INIT(&env.sc_idms); > > if ((pw = getpwnam(YPLDAP_USER)) == NULL) > @@ -437,7 +437,7 @@ client_build_req(struct idm *idm, struct > char**ldap_attrs; > int i, k; > > - bzero(ir, sizeof(*ir)); > + memset(ir, 0, sizeof(*ir)); > for (i = min_attr; i < max_attr; i++) { > if (idm->idm_flags & F_FIXED_ATTR(i)) { > if (strlcat(ir->ir_line, idm->idm_attrs[i], > @@ -594,7 +594,7 @@ client_try_idm(struct env *env, struct i > aldap_freemsg(m); > } > > - bzero(attrs, sizeof(attrs)); > + memset(attrs, 0, sizeof(attrs)); > for (i = 0, j = 0; i < ATTR_MAX; i++) { > if (idm->idm_flags & F_FIXED_ATTR(i)) > continue; > @@ -611,7 +611,7 @@ client_try_idm(struct env *env, struct i > idm->idm_filters[FILTER_USER], 0, ATTR_MAX, IMSG_PW_ENTRY) == > -1) > goto bad; > > - bzero(attrs, sizeof(attrs)); > + memset(attrs, 0, sizeof(attrs)); > for (i = ATTR_GR_MIN, j = 0; i < ATTR_GR_MAX; i++) { > if (idm->idm_flags & F_FIXED_ATTR(i)) > continue; > > Modified: head/usr.sbin/ypldap/yp.c > > == > --- head/usr.sbin/ypldap/yp.c Fri Dec 2 05:49:22 2016(r309392) > +++ head/usr.sbin/ypldap/yp.c Fri Dec 2 06:07:27 2016(r309393) > @@ -342,7 +342,7 @@ ypproc_match_2_svc(ypreq_key *arg, struc > log_debug("argument too long"); > return (NULL); > } > - bzero(key, sizeof(key)); > + memset(key, 0, sizeof(key)); > (void)strncpy(key, arg->key.keydat_val, arg->key.keydat_len); > > if (strcmp(arg->map, "passwd.byname") == 0 || > @@ -486,7 +486,7 @@ ypproc_next_2_svc(ypreq_key *arg, struct > > if (strcmp(arg->map, "passwd.byname") == 0 || > strcmp(arg->map, "master.passwd.byname") == 0) { > - bzero(key, sizeof(key)); > + memset(key, 0, sizeof(key)); > (void)strncpy(key, arg->key.keydat_val, > arg->key.keydat_len); > ukey.ue_line = key; > @@ -517,7 +517,7 @@ ypproc_next_2_svc(ypreq_key *arg, struct > > > } else if (strcmp(arg->map, "group.byname") == 0) { > - bzero(key, sizeof(key)); > + memset(key, 0, sizeof(key)); > (void)strncpy(key, arg->key.keydat_val, > arg->key.keydat_len); > > @@ -567,7 +567,7 @@ ypproc_master_2_svc(ypreq_nokey *arg, st > static struct ypresp_master res; > static char master[YPMAXPEER + 1]; > > - bzero(&res, sizeof(res)); > + memset(&res, 0, sizeof(res)); > if (yp_valid_domain(arg->domain, (struct ypresp_val *)&res) == -1) > return (&res); > > @@ -620,7 +620,7 @@ yp_make_val(struct ypresp_val *res, char > { > static char buf[LINE_WIDTH]; > > - bzero(buf, sizeof(buf)); > + memset(buf, 0, sizeof(buf)); > > if (replacecolon) > line[strlen(line)] = ':'; > @@ -640,8 +640,8 @@ yp_make_keyval(struct ypresp_key_val *re > static char keybuf[YPMAXRECORD+1]; > static char buf[LINE_WIDTH]; > > - bzero(keybuf, sizeof(keybuf)); > - bzero(buf, sizeof(buf)); > + memset(keybuf, 0, sizeof(keybuf)); > + memset(buf, 0, sizeof(buf)); > > (void)strlcpy(keybuf, key, sizeof(keybuf)); > res->key.keydat_len = strlen(keybuf); > > Modified: head/usr.sbin/ypldap/ypldap.c > > == > --- head/usr.sbin/ypldap/ypldap.c Fri Dec 2 05:49:22 2016 > (r309392) > +++ head/usr.sbin/ypldap/ypldap.c Fri Dec 2 06:07:27 2016 > (r309393) > @@ -609,7 +609,7 @@ main(int argc, char *argv[]) > #warning disabling privilege revocation
svn commit: r309393 - head/usr.sbin/ypldap
Author: araujo Date: Fri Dec 2 06:07:27 2016 New Revision: 309393 URL: https://svnweb.freebsd.org/changeset/base/309393 Log: Use memset(3) instead of bzero(3). Obtained from:OpenBSD (r1.12, r1.20, r1.18 and r1.37) Modified: head/usr.sbin/ypldap/ldapclient.c head/usr.sbin/ypldap/yp.c head/usr.sbin/ypldap/ypldap.c head/usr.sbin/ypldap/ypldap_dns.c Modified: head/usr.sbin/ypldap/ldapclient.c == --- head/usr.sbin/ypldap/ldapclient.c Fri Dec 2 05:49:22 2016 (r309392) +++ head/usr.sbin/ypldap/ldapclient.c Fri Dec 2 06:07:27 2016 (r309393) @@ -363,7 +363,7 @@ ldapclient(int pipe_main2client[2]) return (pid); } - bzero(&env, sizeof(env)); + memset(&env, 0, sizeof(env)); TAILQ_INIT(&env.sc_idms); if ((pw = getpwnam(YPLDAP_USER)) == NULL) @@ -437,7 +437,7 @@ client_build_req(struct idm *idm, struct char**ldap_attrs; int i, k; - bzero(ir, sizeof(*ir)); + memset(ir, 0, sizeof(*ir)); for (i = min_attr; i < max_attr; i++) { if (idm->idm_flags & F_FIXED_ATTR(i)) { if (strlcat(ir->ir_line, idm->idm_attrs[i], @@ -594,7 +594,7 @@ client_try_idm(struct env *env, struct i aldap_freemsg(m); } - bzero(attrs, sizeof(attrs)); + memset(attrs, 0, sizeof(attrs)); for (i = 0, j = 0; i < ATTR_MAX; i++) { if (idm->idm_flags & F_FIXED_ATTR(i)) continue; @@ -611,7 +611,7 @@ client_try_idm(struct env *env, struct i idm->idm_filters[FILTER_USER], 0, ATTR_MAX, IMSG_PW_ENTRY) == -1) goto bad; - bzero(attrs, sizeof(attrs)); + memset(attrs, 0, sizeof(attrs)); for (i = ATTR_GR_MIN, j = 0; i < ATTR_GR_MAX; i++) { if (idm->idm_flags & F_FIXED_ATTR(i)) continue; Modified: head/usr.sbin/ypldap/yp.c == --- head/usr.sbin/ypldap/yp.c Fri Dec 2 05:49:22 2016(r309392) +++ head/usr.sbin/ypldap/yp.c Fri Dec 2 06:07:27 2016(r309393) @@ -342,7 +342,7 @@ ypproc_match_2_svc(ypreq_key *arg, struc log_debug("argument too long"); return (NULL); } - bzero(key, sizeof(key)); + memset(key, 0, sizeof(key)); (void)strncpy(key, arg->key.keydat_val, arg->key.keydat_len); if (strcmp(arg->map, "passwd.byname") == 0 || @@ -486,7 +486,7 @@ ypproc_next_2_svc(ypreq_key *arg, struct if (strcmp(arg->map, "passwd.byname") == 0 || strcmp(arg->map, "master.passwd.byname") == 0) { - bzero(key, sizeof(key)); + memset(key, 0, sizeof(key)); (void)strncpy(key, arg->key.keydat_val, arg->key.keydat_len); ukey.ue_line = key; @@ -517,7 +517,7 @@ ypproc_next_2_svc(ypreq_key *arg, struct } else if (strcmp(arg->map, "group.byname") == 0) { - bzero(key, sizeof(key)); + memset(key, 0, sizeof(key)); (void)strncpy(key, arg->key.keydat_val, arg->key.keydat_len); @@ -567,7 +567,7 @@ ypproc_master_2_svc(ypreq_nokey *arg, st static struct ypresp_master res; static char master[YPMAXPEER + 1]; - bzero(&res, sizeof(res)); + memset(&res, 0, sizeof(res)); if (yp_valid_domain(arg->domain, (struct ypresp_val *)&res) == -1) return (&res); @@ -620,7 +620,7 @@ yp_make_val(struct ypresp_val *res, char { static char buf[LINE_WIDTH]; - bzero(buf, sizeof(buf)); + memset(buf, 0, sizeof(buf)); if (replacecolon) line[strlen(line)] = ':'; @@ -640,8 +640,8 @@ yp_make_keyval(struct ypresp_key_val *re static char keybuf[YPMAXRECORD+1]; static char buf[LINE_WIDTH]; - bzero(keybuf, sizeof(keybuf)); - bzero(buf, sizeof(buf)); + memset(keybuf, 0, sizeof(keybuf)); + memset(buf, 0, sizeof(buf)); (void)strlcpy(keybuf, key, sizeof(keybuf)); res->key.keydat_len = strlen(keybuf); Modified: head/usr.sbin/ypldap/ypldap.c == --- head/usr.sbin/ypldap/ypldap.c Fri Dec 2 05:49:22 2016 (r309392) +++ head/usr.sbin/ypldap/ypldap.c Fri Dec 2 06:07:27 2016 (r309393) @@ -609,7 +609,7 @@ main(int argc, char *argv[]) #warning disabling privilege revocation in debug mode #endif - bzero(&tv, sizeof(tv)); + memset(&tv, 0, sizeof(tv)); evtimer_set(&ev_timer, main_init_timer, &env); evtimer_add(&ev_timer, &tv); Modified: head/usr.sbin/ypldap/ypldap_dns.c ==
svn commit: r309392 - head/usr.sbin/ypldap
Author: araujo Date: Fri Dec 2 05:49:22 2016 New Revision: 309392 URL: https://svnweb.freebsd.org/changeset/base/309392 Log: String terminators are called NUL, not NULL, also the variable mentioned in the comment is p and not u. Obtained from:OpenBSD (r1.34) Modified: head/usr.sbin/ypldap/aldap.c Modified: head/usr.sbin/ypldap/aldap.c == --- head/usr.sbin/ypldap/aldap.cFri Dec 2 05:47:52 2016 (r309391) +++ head/usr.sbin/ypldap/aldap.cFri Dec 2 05:49:22 2016 (r309392) @@ -1206,7 +1206,7 @@ isu8cont(unsigned char c) /* * Parse a LDAP value * notes: - * the argument u should be a NULL terminated sequence of ASCII bytes. + * the argument p should be a NUL-terminated sequence of ASCII bytes. */ char * parseval(char *p, size_t len) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r309300 - in head: contrib/libarchive contrib/libarchive/libarchive contrib/libarchive/libarchive/test contrib/libarchive/tar/test lib/libarchive/tests
In message <201612020225.ub22piql039...@slippy.cwsent.com>, Cy Schubert writes: > In message <201611292214.uatmegqh079...@repo.freebsd.org>, Martin Matuska > write > s: > > Author: mm > > Date: Tue Nov 29 22:14:42 2016 > > New Revision: 309300 > > URL: https://svnweb.freebsd.org/changeset/base/309300 > > > > Log: > > MFV r309299: > > Sync libarchive with vendor. > > > > Important vendor bugfixes (relevant to FreeBSD): > > #821: tar -P cannot extract hardlinks through symlinks > > #825: Add sanity check of tar "uid, "gid" and "mtime" fields > > > > PR: 213255 > > Reported by: Tijl Coosemans > > MFC after:1 week > > > > Added: > > head/contrib/libarchive/libarchive/test/test_compat_gtar_2.tar.uu > > - copied unchanged from r309299, vendor/libarchive/dist/libarchive/tes > t/ > > test_compat_gtar_2.tar.uu > > head/contrib/libarchive/libarchive/test/test_compat_star_acl_posix1e.c > > - copied unchanged from r309299, vendor/libarchive/dist/libarchive/tes > t/ > > test_compat_star_acl_posix1e.c > > head/contrib/libarchive/libarchive/test/test_compat_star_acl_posix1e.tar. > uu > > - copied unchanged from r309299, vendor/libarchive/dist/libarchive/tes > t/ > > test_compat_star_acl_posix1e.tar.uu > > head/contrib/libarchive/libarchive/test/test_read_format_raw.bufr.uu > > - copied unchanged from r309299, vendor/libarchive/dist/libarchive/tes > t/ > > test_read_format_raw.bufr.uu > > Modified: > > head/contrib/libarchive/NEWS > > head/contrib/libarchive/libarchive/archive_acl.c > > head/contrib/libarchive/libarchive/archive_entry.c > > head/contrib/libarchive/libarchive/archive_entry.h > > head/contrib/libarchive/libarchive/archive_entry_acl.3 > > head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c > > head/contrib/libarchive/libarchive/archive_read_support_filter_xz.c > > head/contrib/libarchive/libarchive/archive_read_support_format_tar.c > > head/contrib/libarchive/libarchive/archive_read_support_format_xar.c > > head/contrib/libarchive/libarchive/archive_write_disk_posix.c > > head/contrib/libarchive/libarchive/test/test_compat_gtar.c > > head/contrib/libarchive/libarchive/test/test_read_format_raw.c > > head/contrib/libarchive/libarchive/test/test_sparse_basic.c > > head/contrib/libarchive/tar/test/test_symlink_dir.c > > head/lib/libarchive/tests/Makefile > > Directory Properties: > > head/contrib/libarchive/ (props changed) > > > [...] > > Modified: head/contrib/libarchive/libarchive/archive_read_support_format_ta > r. > > c > > === > == > > = > > --- head/contrib/libarchive/libarchive/archive_read_support_format_tar.c > > Tue Nov 29 21:53:16 2016(r309299) > > +++ head/contrib/libarchive/libarchive/archive_read_support_format_tar.c > > Tue Nov 29 22:14:42 2016(r309300) > > @@ -294,6 +294,46 @@ archive_read_format_tar_cleanup(struct a > > return (ARCHIVE_OK); > > } > > > > +static int > > +validate_number_field(const char* p_field, size_t i_size) > > +{ > > + unsigned char marker = (unsigned char)p_field[0]; > > + /* octal? */ > > + if ((marker >= '0' && marker <= '7') || marker == ' ') { > > + size_t i = 0; > > + int octal_found = 0; > > + for (i = 0; i < i_size; ++i) { > > + switch (p_field[i]) > > + { > > + case ' ': /* skip any leading spaces and trailing space > > */ > > + if (octal_found == 0 || i == i_size - 1) { > > + continue; > > + } > > + break; > > + case '\0': /* null is allowed only at the end */ > > + if (i != i_size - 1) { > > + return 0; > > + } > > + break; > > + /* rest must be octal digits */ > > + case '0': case '1': case '2': case '3': > > + case '4': case '5': case '6': case '7': > > + ++octal_found; > > + break; > > + } > > + } > > + return octal_found > 0; > > + } > > + /* base 256 (i.e. binary number) */ > > + else if (marker == 128 || marker == 255 || marker == 0) { > > + /* nothing to check */ > > + return 1; > > + } > > + /* not a number field */ > > + else { > > + return 0; > > + } > > +} > > > > static int > > archive_read_format_tar_bid(struct archive_read *a, int best_bid) > > @@ -346,23 +386,23 @@ archive_read_format_tar_bid(struct archi > > return (0); > > bid += 2; /* 6 bits of variation in an 8-bit field leaves 2 bits. */ > > > > - /* Sanity check: Look at first byte of mode field. */ > > - switch (255 &
Re: svn commit: r309300 - in head: contrib/libarchive contrib/libarchive/libarchive contrib/libarchive/libarchive/test contrib/libarchive/tar/test lib/libarchive/tests
In message <201611292214.uatmegqh079...@repo.freebsd.org>, Martin Matuska write s: > Author: mm > Date: Tue Nov 29 22:14:42 2016 > New Revision: 309300 > URL: https://svnweb.freebsd.org/changeset/base/309300 > > Log: > MFV r309299: > Sync libarchive with vendor. > > Important vendor bugfixes (relevant to FreeBSD): > #821: tar -P cannot extract hardlinks through symlinks > #825: Add sanity check of tar "uid, "gid" and "mtime" fields > > PR: 213255 > Reported by:Tijl Coosemans > MFC after: 1 week > > Added: > head/contrib/libarchive/libarchive/test/test_compat_gtar_2.tar.uu > - copied unchanged from r309299, vendor/libarchive/dist/libarchive/test/ > test_compat_gtar_2.tar.uu > head/contrib/libarchive/libarchive/test/test_compat_star_acl_posix1e.c > - copied unchanged from r309299, vendor/libarchive/dist/libarchive/test/ > test_compat_star_acl_posix1e.c > head/contrib/libarchive/libarchive/test/test_compat_star_acl_posix1e.tar.uu > - copied unchanged from r309299, vendor/libarchive/dist/libarchive/test/ > test_compat_star_acl_posix1e.tar.uu > head/contrib/libarchive/libarchive/test/test_read_format_raw.bufr.uu > - copied unchanged from r309299, vendor/libarchive/dist/libarchive/test/ > test_read_format_raw.bufr.uu > Modified: > head/contrib/libarchive/NEWS > head/contrib/libarchive/libarchive/archive_acl.c > head/contrib/libarchive/libarchive/archive_entry.c > head/contrib/libarchive/libarchive/archive_entry.h > head/contrib/libarchive/libarchive/archive_entry_acl.3 > head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c > head/contrib/libarchive/libarchive/archive_read_support_filter_xz.c > head/contrib/libarchive/libarchive/archive_read_support_format_tar.c > head/contrib/libarchive/libarchive/archive_read_support_format_xar.c > head/contrib/libarchive/libarchive/archive_write_disk_posix.c > head/contrib/libarchive/libarchive/test/test_compat_gtar.c > head/contrib/libarchive/libarchive/test/test_read_format_raw.c > head/contrib/libarchive/libarchive/test/test_sparse_basic.c > head/contrib/libarchive/tar/test/test_symlink_dir.c > head/lib/libarchive/tests/Makefile > Directory Properties: > head/contrib/libarchive/ (props changed) > [...] > Modified: head/contrib/libarchive/libarchive/archive_read_support_format_tar. > c > = > = > --- head/contrib/libarchive/libarchive/archive_read_support_format_tar.c > Tue Nov 29 21:53:16 2016(r309299) > +++ head/contrib/libarchive/libarchive/archive_read_support_format_tar.c > Tue Nov 29 22:14:42 2016(r309300) > @@ -294,6 +294,46 @@ archive_read_format_tar_cleanup(struct a > return (ARCHIVE_OK); > } > > +static int > +validate_number_field(const char* p_field, size_t i_size) > +{ > + unsigned char marker = (unsigned char)p_field[0]; > + /* octal? */ > + if ((marker >= '0' && marker <= '7') || marker == ' ') { > + size_t i = 0; > + int octal_found = 0; > + for (i = 0; i < i_size; ++i) { > + switch (p_field[i]) > + { > + case ' ': /* skip any leading spaces and trailing space > */ > + if (octal_found == 0 || i == i_size - 1) { > + continue; > + } > + break; > + case '\0': /* null is allowed only at the end */ > + if (i != i_size - 1) { > + return 0; > + } > + break; > + /* rest must be octal digits */ > + case '0': case '1': case '2': case '3': > + case '4': case '5': case '6': case '7': > + ++octal_found; > + break; > + } > + } > + return octal_found > 0; > + } > + /* base 256 (i.e. binary number) */ > + else if (marker == 128 || marker == 255 || marker == 0) { > + /* nothing to check */ > + return 1; > + } > + /* not a number field */ > + else { > + return 0; > + } > +} > > static int > archive_read_format_tar_bid(struct archive_read *a, int best_bid) > @@ -346,23 +386,23 @@ archive_read_format_tar_bid(struct archi > return (0); > bid += 2; /* 6 bits of variation in an 8-bit field leaves 2 bits. */ > > - /* Sanity check: Look at first byte of mode field. */ > - switch (255 & (unsigned)header->mode[0]) { > - case 0: case 255: > - /* Base-256 value: No further verification possible! */ > - break; > - case ' ': /* Not recommended, but not illegal, either. */ > - break; > - case '0':
svn commit: r309382 - head/usr.bin/indent
Author: pfg Date: Fri Dec 2 01:52:32 2016 New Revision: 309382 URL: https://svnweb.freebsd.org/changeset/base/309382 Log: indent(1): Do not define opchar unless it will be used. "opchar" is only used once depending on "undef" macro being defined. Conditionalize it in the same way. Submitted by: Piotr Sephaniak Modified: head/usr.bin/indent/lexi.c Modified: head/usr.bin/indent/lexi.c == --- head/usr.bin/indent/lexi.c Fri Dec 2 01:38:40 2016(r309381) +++ head/usr.bin/indent/lexi.c Fri Dec 2 01:52:32 2016(r309382) @@ -57,7 +57,9 @@ __FBSDID("$FreeBSD$"); #include "indent.h" #define alphanum 1 +#ifdef undef #define opchar 3 +#endif struct templ { const char *rwd; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r309380 - head/usr.bin/indent
Author: pfg Date: Fri Dec 2 01:25:51 2016 New Revision: 309380 URL: https://svnweb.freebsd.org/changeset/base/309380 Log: indent(1): Fix indent's confusion about custom FreeBSD macros. Teach indent(1) about storage-class specifiers. Don't assume "in_parameter_declaration" state if "in_decl" hasn't been set. Don't set "in_decl" for storage-class specifiers. That set of changes helps with recognizing the difference between file scope declarations like this: static LIST_HEAD(, alq) ald_active; static int ald_shuttingdown = 0; struct thread *ald_thread; and old style function declarators like this: static int do_execve(td, args, mac_p) struct thread *td; struct image_args *args; struct mac *mac_p; { Unfortunately, at the same time this change makes indent(1) require explicit int in declarations like "static a;", in order to understand that it's part of a declaration. On the other hand, declarations like in the first example are no longer indented as if ald_shuttingdown and ald_thread were parameters of a function named LIST_HEAD. Submitted by: Piotr Stefaniak Modified: head/usr.bin/indent/indent.c head/usr.bin/indent/indent_codes.h head/usr.bin/indent/lexi.c Modified: head/usr.bin/indent/indent.c == --- head/usr.bin/indent/indent.cFri Dec 2 00:23:10 2016 (r309379) +++ head/usr.bin/indent/indent.cFri Dec 2 01:25:51 2016 (r309380) @@ -920,8 +920,11 @@ check_type: } goto copy_id; /* move the token into line */ - case decl: /* we have a declaration type (int, register, -* etc.) */ + case storage: + prefix_blankline_requested = 0; + goto copy_id; + + case decl: /* we have a declaration type (int, etc.) */ parse(decl);/* let parser worry about indentation */ if (ps.last_token == rparen && ps.tos <= 1) { ps.in_parameter_declaration = 1; Modified: head/usr.bin/indent/indent_codes.h == --- head/usr.bin/indent/indent_codes.h Fri Dec 2 00:23:10 2016 (r309379) +++ head/usr.bin/indent/indent_codes.h Fri Dec 2 01:25:51 2016 (r309380) @@ -69,3 +69,4 @@ #define elsehead 31 #define period 32 #define strpfx 33 +#define storage34 Modified: head/usr.bin/indent/lexi.c == --- head/usr.bin/indent/lexi.c Fri Dec 2 00:23:10 2016(r309379) +++ head/usr.bin/indent/lexi.c Fri Dec 2 01:25:51 2016(r309380) @@ -70,6 +70,7 @@ struct templ { */ struct templ specials[] = { +{"auto", 10}, {"break", 9}, {"case", 8}, {"char", 4}, @@ -79,7 +80,7 @@ struct templ specials[] = {"double", 4}, {"else", 6}, {"enum", 3}, -{"extern", 4}, +{"extern", 10}, {"float", 4}, {"for", 5}, {"global", 4}, @@ -88,14 +89,14 @@ struct templ specials[] = {"int", 4}, {"long", 4}, {"offsetof", 1}, -{"register", 4}, +{"register", 10}, {"return", 9}, {"short", 4}, {"sizeof", 2}, -{"static", 4}, +{"static", 10}, {"struct", 3}, {"switch", 7}, -{"typedef", 4}, +{"typedef", 10}, {"union", 3}, {"unsigned", 4}, {"void", 4}, @@ -312,6 +313,9 @@ lexi(void) case 6: /* do, else */ return (sp_nparen); + case 10:/* storage class specifier */ + return (storage); + default:/* all others are treated like any other * identifier */ return (ident); @@ -323,7 +327,8 @@ lexi(void) if (*tp++ == ')' && (*tp == ';' || *tp == ',')) goto not_proc; strncpy(ps.procname, token, sizeof ps.procname - 1); - ps.in_parameter_declaration = 1; + if (ps.in_decl) + ps.in_parameter_declaration = 1; rparen_count = 1; not_proc:; } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r309351 - head/etc/defaults
+1 for reverting it from now (from the causer of the pain...) -a On 1 December 2016 at 13:41, Warner Losh wrote: > On Thu, Dec 1, 2016 at 9:48 AM, hiren panchasara > wrote: >> On 12/01/16 at 04:35P, Warner Losh wrote: >>> Author: imp >>> Date: Thu Dec 1 04:35:43 2016 >>> New Revision: 309351 >>> URL: https://svnweb.freebsd.org/changeset/base/309351 >>> >>> Log: >>> Revert the 'performance' setting to 'NONE' from C2. >> >> Just a note that this commit reverts r282110. > > Yea, it's good for laptops, bad for servers. At least there's some > Intel CPUs that this causes corruption with USB. That's being sorted > out, but until that's done we need to fail more safe for our primary > market. > > Warner > ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r309364 - head/usr.bin/locale
On Thu, 1 Dec 2016, Eric van Gyzen wrote: Log: locale: fix buffer management Also, handle signed and unsigned chars, and more gracefully handle invalid input. Submitted by: bde in response to r309331 MFC after: 1 week Sponsored by: Dell EMC Thanks. Modified: head/usr.bin/locale/locale.c == --- head/usr.bin/locale/locale.cThu Dec 1 15:46:26 2016 (r309363) +++ head/usr.bin/locale/locale.cThu Dec 1 16:54:02 2016 (r309364) @@ -495,29 +495,29 @@ format_grouping(const char *binary) { static char rval[64]; const char *cp; - size_t len; + size_t roff; + int len; ... + if (*cp < 0) + break; /* garbage input */ + len = snprintf(&rval[roff], sizeof(rval) - roff, "%u;", *cp); + if (len < 0 || (unsigned)len >= sizeof(rval) - roff) + break; /* insufficient space for output */ I don't like casting len to fix compiler warnings, and intentionally left out this cast. len < 0 ensures that there is no sign extension bug or dependency on sign extension bugs. snprintf() returns < 0 if an encoding error occurs, and the check is mainly to detect this unlikely error (the comment is too short to describe this), but the check also allows compilers to easily see that there is no sign extension bug and only low-quality ones warn. I used the bogus type size_t instead of int for roff since I didn't want to fight possible compiler warnings about sign extension in the expression sizeof(rval) - roff. Here it is not so easy to see that roff <= sizeof(rval). You didn't do anything to avoid bad -Wtautological-compare compiler warnings for (*cp < 0). I think such warnings occur at high WARNS on arches with unsigned char. These warnings are bad since the comparison is only tautological on some arches so it is not really tautological. Avoiding it requires code like '#if CHAR_MIN < 0', but that is equally tautological and only escapes the warning because cpp expressions are weaker than C expressions. clang -Wall -Wtautological-compare doesn't actually warn for either (*cp < 0) (where cp is unsigned char *) or (1 < 0). gcc-4.2.1 -Wall warns for the former but not for the latter. This seems sort of backwards, but ISTR discussions in gcc lists ~20 years ago about it being intentional. Warning for (1 < 0) mainly breaks conditional compilation where the condtions are intentially written using C const expressions instead of cpp expressions since cpp is harder to work with. (*cp < 0) is more likely to be a bug. Bruce ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r309344 - head/lib/libutil
On Thu, Dec 1, 2016 at 10:32 AM, Ian Lepore wrote: ... > And how is that a bad thing, compared to the prior situation? Insult > has been removed and information has been added. You complain that the > information that was added was incomplete. Well, there is one person > who could fix that, and he has apparently chosen not to. So perhaps > your ongoing complaint should be directed accordingly. Maybe. But this is a useless bikeshed. I've said my piece. -Ngie ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
回复
回复 ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r309374 - in head: sbin/camcontrol sys/cam/scsi
Author: ken Date: Thu Dec 1 22:20:27 2016 New Revision: 309374 URL: https://svnweb.freebsd.org/changeset/base/309374 Log: Add SCSI REPORT TIMESTAMP and SET TIMESTAMP support. This adds support to camcontrol(8) and libcam(3) for getting and setting the time on SCSI protocol drives. This is more commonly found on tape drives, but is a SPC (SCSI Primary Commands) command, and may be found on any device that speaks SCSI. The new camcontrol timestamp subcommand allows getting the current device time or setting the time to the current system time or any arbitrary time. sbin/camcontrol/Makefile: Add timestamp.c. sbin/camcontrol/camcontrol.8: Document the new timestamp subcommand. sbin/camcontrol/camcontrol.c: Add the timestamp subcommand to camcontrol. sbin/camcontrol/camcontrol.h: Add the timestamp() function prototype. sbin/camcontrol/timestamp.c: Timestamp setting and reporting functionality. sys/cam/scsi/scsi_all.c: Add two new CCB building functions, scsi_set_timestamp() and scsi_report_timestamp(). Also, add a new helper function, scsi_create_timestamp(). sys/cam/scsi/scsi_all.h: Add CDB and parameter data for the the set and report timestamp commands. Add function declarations for the new CCB building and helper functions. Submitted by: Sam Klopsch Sponsored by: Spectra Logic MFC After:2 weeks Added: head/sbin/camcontrol/timestamp.c (contents, props changed) Modified: head/sbin/camcontrol/Makefile head/sbin/camcontrol/camcontrol.8 head/sbin/camcontrol/camcontrol.c head/sbin/camcontrol/camcontrol.h head/sys/cam/scsi/scsi_all.c head/sys/cam/scsi/scsi_all.h Modified: head/sbin/camcontrol/Makefile == --- head/sbin/camcontrol/Makefile Thu Dec 1 22:12:58 2016 (r309373) +++ head/sbin/camcontrol/Makefile Thu Dec 1 22:20:27 2016 (r309374) @@ -4,7 +4,7 @@ PACKAGE=runtime PROG= camcontrol SRCS= camcontrol.c util.c .if !defined(RELEASE_CRUNCH) -SRCS+= attrib.c epc.c fwdownload.c modeedit.c persist.c progress.c zone.c +SRCS+= attrib.c epc.c fwdownload.c modeedit.c persist.c progress.c timestamp.c zone.c .else CFLAGS+= -DMINIMALISTIC .endif Modified: head/sbin/camcontrol/camcontrol.8 == --- head/sbin/camcontrol/camcontrol.8 Thu Dec 1 22:12:58 2016 (r309373) +++ head/sbin/camcontrol/camcontrol.8 Thu Dec 1 22:20:27 2016 (r309374) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 16, 2016 +.Dd November 30, 2016 .Dt CAMCONTROL 8 .Os .Sh NAME @@ -343,6 +343,11 @@ .Op Fl S Ar power_src .Op Fl T Ar timer .Nm +.Ic timestamp +.Op device id +.Op generic args +.Ao Fl r Oo Ns Fl f Ar format | Fl m | Fl U Oc | Fl s Ao Fl f Ar format Fl T Ar time | Fl U Ac Ac +.Nm .Ic help .Sh DESCRIPTION The @@ -2417,6 +2422,54 @@ supports, and a number of parameters abo whether it is enabled and what the timer value is. .El .El +.It Ic timestamp +Issue REPORT TIMESTAMP or SET TIMESTAMP +.Tn SCSI +commands. Either the +.Fl r +option or the +.Fl s +option must be specified. +.Bl -tag -width 6n +.It Fl r +Report the device's timestamp. +If no more arguments are specified, the timestamp will be reported using +the national representation of the date and time, followed by the time +zone. +.Bl -tag -width 9n +.It Fl f Ar format +Specify the strftime format string, as documented in strftime(3), to be used +to format the reported timestamp. +.It Fl m +Report the timestamp as milliseconds since the epoch. +.It Fl U +Report the timestamp using the national representation of the date and +time, but override the system time zone and use UTC instead. +.El +.El +.Bl -tag -width 6n +.It Fl s +Set the device's timestamp. Either the +.Fl f +and +.Fl T +options or the +.Fl U +option must be specified. +.Bl -tag -width 9n +.It Fl f Ar format +Specify the strptime format string, as documented in strptime(3). +The time must also be specified with the +.Fl T +option. +.It Fl T +Provide the time in the format specified with the +.Fl f +option. +.It Fl U +Set the timestamp to the host system's time in UTC. +.El +.El .It Ic help Print out verbose usage information. .El @@ -2730,6 +2783,18 @@ camcontrol epc ada0 -c list Display the ATA Power Conditions log (Log Address 0x08) for drive .Pa ada0 . +.Pp +.Bd -literal -offset indent +camcontrol timestamp sa0 -s -f "%A %c" \e + -T "Wednesday Wed Oct 26 21:43:57 2016" +.Ed +.Pp +Set the timestamp of drive +.Pa sa0 +using a +.Xr strptime 3 +format string followed by a time string +that was created using this format string. .Sh SEE ALSO .Xr cam 3 , .Xr cam_cdbparse 3 , Modified: head/sbin/camcontrol/camcontrol.c == --- head/sbin
svn commit: r309373 - in head: contrib/netbsd-tests/lib/libc/sys lib/libc/tests/sys
Author: bdrewery Date: Thu Dec 1 22:12:58 2016 New Revision: 309373 URL: https://svnweb.freebsd.org/changeset/base/309373 Log: Fix setrlimit_test:setrlimit_memlock when the system has exceeded vm.max_wired. This uses the same fix as r294894 did for the mlock test. The code from that commit is moved into a common object file which PROGS supports building first. Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D8689 Added: head/lib/libc/tests/sys/mlock_helper.c (contents, props changed) Modified: head/contrib/netbsd-tests/lib/libc/sys/t_mlock.c head/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c head/lib/libc/tests/sys/Makefile Modified: head/contrib/netbsd-tests/lib/libc/sys/t_mlock.c == --- head/contrib/netbsd-tests/lib/libc/sys/t_mlock.cThu Dec 1 21:08:42 2016(r309372) +++ head/contrib/netbsd-tests/lib/libc/sys/t_mlock.cThu Dec 1 22:12:58 2016(r309373) @@ -50,86 +50,13 @@ __RCSID("$NetBSD: t_mlock.c,v 1.6 2016/0 #include #define _KMEMUSER #include + +void set_vm_max_wired(int); +void restore_vm_max_wired(void); #endif static long page = 0; -#ifdef __FreeBSD__ -#defineVM_MAX_WIRED "vm.max_wired" - -static void -vm_max_wired_sysctl(int *old_value, int *new_value) -{ - size_t old_len; - size_t new_len = (new_value == NULL ? 0 : sizeof(int)); - - if (old_value == NULL) - printf("Setting the new value to %d\n", *new_value); - else { - ATF_REQUIRE_MSG(sysctlbyname(VM_MAX_WIRED, NULL, &old_len, - new_value, new_len) == 0, - "sysctlbyname(%s) failed: %s", VM_MAX_WIRED, strerror(errno)); - } - - ATF_REQUIRE_MSG(sysctlbyname(VM_MAX_WIRED, old_value, &old_len, - new_value, new_len) == 0, - "sysctlbyname(%s) failed: %s", VM_MAX_WIRED, strerror(errno)); - - if (old_value != NULL) - printf("Saved the old value (%d)\n", *old_value); -} - -static void -set_vm_max_wired(int new_value) -{ - FILE *fp; - int old_value; - - fp = fopen(VM_MAX_WIRED, "w"); - if (fp == NULL) { - atf_tc_skip("could not open %s for writing: %s", - VM_MAX_WIRED, strerror(errno)); - return; - } - - vm_max_wired_sysctl(&old_value, NULL); - - ATF_REQUIRE_MSG(fprintf(fp, "%d", old_value) > 0, - "saving %s failed", VM_MAX_WIRED); - - fclose(fp); - - vm_max_wired_sysctl(NULL, &new_value); -} - -static void -restore_vm_max_wired(void) -{ - FILE *fp; - int saved_max_wired; - - fp = fopen(VM_MAX_WIRED, "r"); - if (fp == NULL) { - perror("fopen failed\n"); - return; - } - - if (fscanf(fp, "%d", &saved_max_wired) != 1) { - perror("fscanf failed\n"); - fclose(fp); - return; - } - - fclose(fp); - printf("old value in %s: %d\n", VM_MAX_WIRED, saved_max_wired); - - if (saved_max_wired == 0) /* This will cripple the test host */ - return; - - vm_max_wired_sysctl(NULL, &saved_max_wired); -} -#endif - ATF_TC(mlock_clip); ATF_TC_HEAD(mlock_clip, tc) { Modified: head/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c == --- head/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.cThu Dec 1 21:08:42 2016(r309372) +++ head/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.cThu Dec 1 22:12:58 2016(r309373) @@ -50,6 +50,11 @@ __RCSID("$NetBSD: t_setrlimit.c,v 1.5 20 #include #include +#ifdef __FreeBSD__ +void set_vm_max_wired(int); +void restore_vm_max_wired(void); +#endif + static void sighandler(int); static const char path[] = "setrlimit"; @@ -235,10 +240,18 @@ sighandler(int signo) _exit(EXIT_SUCCESS); } +#ifdef __FreeBSD__ +ATF_TC_WITH_CLEANUP(setrlimit_memlock); +#else ATF_TC(setrlimit_memlock); +#endif ATF_TC_HEAD(setrlimit_memlock, tc) { atf_tc_set_md_var(tc, "descr", "Test setrlimit(2), RLIMIT_MEMLOCK"); +#ifdef __FreeBSD__ + atf_tc_set_md_var(tc, "require.config", "allow_sysctl_side_effects"); + atf_tc_set_md_var(tc, "require.user", "root"); +#endif } ATF_TC_BODY(setrlimit_memlock, tc) @@ -249,6 +262,11 @@ ATF_TC_BODY(setrlimit_memlock, tc) pid_t pid; int sta; +#ifdef __FreeBSD__ + /* Set max_wired really really high to avoid EAGAIN */ + set_vm_max_wired(INT_MAX); +#endif + page = sysconf(_SC_PAGESIZE); ATF_REQUIRE(page >= 0); @@ -292,6 +310,14 @@ ATF_TC_BODY(setrlimit_memlock, tc) atf_tc_fail("RLIMIT_MEMLOCK not enforced"); } +#ifdef __FreeBSD__ +ATF_TC_CLEANUP(setrlimit_memlock, tc) +{ + + restore_vm_max_wired(); +} +#endif + ATF_TC(s
Re: svn commit: r309351 - head/etc/defaults
On Thu, Dec 1, 2016 at 9:48 AM, hiren panchasara wrote: > On 12/01/16 at 04:35P, Warner Losh wrote: >> Author: imp >> Date: Thu Dec 1 04:35:43 2016 >> New Revision: 309351 >> URL: https://svnweb.freebsd.org/changeset/base/309351 >> >> Log: >> Revert the 'performance' setting to 'NONE' from C2. > > Just a note that this commit reverts r282110. Yea, it's good for laptops, bad for servers. At least there's some Intel CPUs that this causes corruption with USB. That's being sorted out, but until that's done we need to fail more safe for our primary market. Warner ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r309372 - head/sys/sys
Author: rstone Date: Thu Dec 1 21:08:42 2016 New Revision: 309372 URL: https://svnweb.freebsd.org/changeset/base/309372 Log: Fix a false positive in a buf_ring assert buf_ring contains an assert that checks whether an item being enqueued already exists on the ring. There is a subtle bug in this assert. An item can be returned by a peek() function and freed, and then the consumer thread can be preempted before calling advance(). If this happens the item appears to still be on the queue, but another thread may allocate the item from the free pool and wind up trying to enqueue it again, causing the assert to trigger incorrectly. Fix this by skipping the head of the consumer's portion of the ring, as this index is what will be returned by peek(). Sponsored by: Dell EMC Isilon MFC After:1 week Differential Revision:https://reviews.freebsd.org/D8685 Reviewed by: hselasky Modified: head/sys/sys/buf_ring.h Modified: head/sys/sys/buf_ring.h == --- head/sys/sys/buf_ring.h Thu Dec 1 20:36:48 2016(r309371) +++ head/sys/sys/buf_ring.h Thu Dec 1 21:08:42 2016(r309372) @@ -67,11 +67,13 @@ buf_ring_enqueue(struct buf_ring *br, vo uint32_t prod_head, prod_next, cons_tail; #ifdef DEBUG_BUFRING int i; - for (i = br->br_cons_head; i != br->br_prod_head; -i = ((i + 1) & br->br_cons_mask)) - if(br->br_ring[i] == buf) - panic("buf=%p already enqueue at %d prod=%d cons=%d", - buf, i, br->br_prod_tail, br->br_cons_tail); + if (br->br_cons_head != br->br_prod_head) { + for (i = (br->br_cons_head + 1) & br->br_cons_mask; i != br->br_prod_head; + i = ((i + 1) & br->br_cons_mask)) + if(br->br_ring[i] == buf) + panic("buf=%p already enqueue at %d prod=%d cons=%d", + buf, i, br->br_prod_tail, br->br_cons_tail); + } #endif critical_enter(); do { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r309369 - head/lib/libstand
Author: tsoome Date: Thu Dec 1 19:19:20 2016 New Revision: 309369 URL: https://svnweb.freebsd.org/changeset/base/309369 Log: libstand: dosfs cstyle cleanup for return keyword. Reviewed by: bapt, imp, allanjude Approved by: imp (mentor), allanjude (mentor) Differential Revision:https://reviews.freebsd.org/D8678 Modified: head/lib/libstand/dosfs.c Modified: head/lib/libstand/dosfs.c == --- head/lib/libstand/dosfs.c Thu Dec 1 19:06:09 2016(r309368) +++ head/lib/libstand/dosfs.c Thu Dec 1 19:19:20 2016(r309369) @@ -204,7 +204,7 @@ dos_mount(DOS_FS *fs, struct open_file * if (buf != NULL) free(buf); (void)dosunmount(fs); -return(err); +return (err); } free(buf); @@ -219,7 +219,7 @@ dos_mount(DOS_FS *fs, struct open_file * fs->root.dex.h_clus[0] = (fs->rdcl >> 16) & 0xff; fs->root.dex.h_clus[1] = (fs->rdcl >> 24) & 0xff; } -return 0; +return (0); } /* @@ -231,10 +231,10 @@ dos_unmount(DOS_FS *fs) int err; if (fs->links) -return(EBUSY); +return (EBUSY); if ((err = dosunmount(fs))) -return(err); -return 0; +return (err); +return (0); } /* @@ -244,7 +244,7 @@ static int dosunmount(DOS_FS *fs) { free(fs); -return(0); +return (0); } /* @@ -285,7 +285,7 @@ dos_open(const char *path, struct open_f fd->f_fsdata = (void *)f; out: -return(err); +return (err); } /* @@ -307,7 +307,7 @@ dos_read(struct open_file *fd, void *buf twiddle(4); nb = (u_int)nbyte; if ((size = fsize(f->fs, &f->de)) == -1) - return EINVAL; + return (EINVAL); if (nb > (n = size - f->offset)) nb = n; off = f->offset; @@ -344,7 +344,7 @@ dos_read(struct open_file *fd, void *buf out: if (resid) *resid = nbyte - nb + cnt; -return(err); +return (err); } /* @@ -370,16 +370,16 @@ dos_seek(struct open_file *fd, off_t off break; default: errno = EINVAL; - return(-1); + return (-1); } off += offset; if (off < 0 || off > size) { errno = EINVAL; -return(-1); +return (-1); } f->offset = (u_int)off; f->c = 0; -return(off); +return (off); } /* @@ -394,7 +394,7 @@ dos_close(struct open_file *fd) f->fs->links--; free(f); dos_unmount(fs); -return 0; +return (0); } /* @@ -411,7 +411,7 @@ dos_stat(struct open_file *fd, struct st sb->st_uid = 0; sb->st_gid = 0; if ((sb->st_size = fsize(f->fs, &f->de)) == -1) - return EINVAL; + return (EINVAL); return (0); } @@ -501,7 +501,7 @@ dos_readdir(struct open_file *fd, struct d->d_reclen = sizeof(*d); d->d_type = (dd.de.attr & FA_DIR) ? DT_DIR : DT_REG; memcpy(d->d_name, fn, sizeof(d->d_name)); -return(0); +return (0); } /* @@ -516,41 +516,41 @@ parsebs(DOS_FS *fs, DOS_BS *bs) bs->jmp[0] != 0xe9 && (bs->jmp[0] != 0xeb || bs->jmp[2] != 0x90)) || bs->bpb.media < 0xf0) -return EINVAL; +return (EINVAL); if (cv2(bs->bpb.secsiz) != SECSIZ) -return EINVAL; +return (EINVAL); if (!(fs->spc = bs->bpb.spc) || fs->spc & (fs->spc - 1)) -return EINVAL; +return (EINVAL); fs->bsize = secbyt(fs->spc); fs->bshift = ffs(fs->bsize) - 1; if ((fs->spf = cv2(bs->bpb.spf))) { if (bs->bpb.fats != 2) -return EINVAL; +return (EINVAL); if (!(fs->dirents = cv2(bs->bpb.dirents))) -return EINVAL; +return (EINVAL); } else { if (!(fs->spf = cv4(bs->bpb.lspf))) -return EINVAL; +return (EINVAL); if (!bs->bpb.fats || bs->bpb.fats > 16) -return EINVAL; +return (EINVAL); if ((fs->rdcl = cv4(bs->bpb.rdcl)) < LOCLUS) -return EINVAL; +return (EINVAL); } if (!(fs->lsnfat = cv2(bs->bpb.ressec))) -return EINVAL; +return (EINVAL); fs->lsndir = fs->lsnfat + fs->spf * bs->bpb.fats; fs->lsndta = fs->lsndir + entsec(fs->dirents); if (!(sc = cv2(bs->bpb.secs)) && !(sc = cv4(bs->bpb.lsecs))) -return EINVAL; +return (EINVAL); if (fs->lsndta > sc) -return EINVAL; +return (EINVAL); if ((fs->xclus = secblk(fs, sc - fs->lsndta) + 1) < LOCLUS) -return EINVAL; +return (EINVAL); fs->fatsz = fs->dirents ? fs->xclus < 0xff6 ? 12 : 16 : 32; sc = (secbyt(fs->spf) << 1) / (fs->fatsz >> 2) - 1; if (fs->xclus > sc) fs->xclus = sc; -return 0; +return (0); } /* @@ -575,17 +575,17 @@ namede(DOS_FS *fs, const char *path, DOS if (!(s = strchr(path, '/'))) s = strchr(path, 0); if ((n = s - path) > 255) -
Re: svn commit: r309344 - head/lib/libutil
On Thu, 2016-12-01 at 09:33 -0800, Ngie Cooper (yaneurabeya) wrote: > > > > On Dec 1, 2016, at 9:01 AM, Mark Linimon > > wrote: > > > > On Thu, Dec 01, 2016 at 09:32:07AM -0700, Ian Lepore wrote: > > > > > > On Wed, 2016-11-30 at 19:07 -0800, Ngie Cooper wrote: > > > > > > > > Really?? I wish you hadn't added me to this list.. I don't in > > > > any way > > > > endorse the way that you went about dealing with this > > > > disagreement. > > > Really? Well then feel free to ADD my name to the list of people > > > who > > > found that comment, and the subsequent non-response to the > > > complaints > > > about it, completely inappropriate. > > I expressed an opinion on an IRC channel that I found the comment > > offensive. > > > > But I would rather my permission had been asked ahead of time > > before > > having that comment attached to a public commit log. I think this > > is > > part of the point that ngie is trying to make. > > > > I'm well-known for my wish that core took a more active, public, > > stance > > on such matters, but I think here that two wrongs may not have made > > a > > right. > Yes. > > And more importantly, the new comment doesn’t tell me *why* I > shouldn’t use FD_CLOEXEC. The owness is still on the reader to figure > out why using `fcntl(fd, F_SETFD, FD_CLOEXEC)` is wrong. > > All the new commit does is makes the commit that des@ made more > palatable and benign to readers. And how is that a bad thing, compared to the prior situation? Insult has been removed and information has been added. You complain that the information that was added was incomplete. Well, there is one person who could fix that, and he has apparently chosen not to. So perhaps your ongoing complaint should be directed accordingly. -- Ian ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r309367 - head/usr.bin/locale
Author: vangyzen Date: Thu Dec 1 17:36:31 2016 New Revision: 309367 URL: https://svnweb.freebsd.org/changeset/base/309367 Log: locale: enable more warnings; fix them Do not set WARNS, so it gets the current default of 6. Fix the warnings by sprinkling static, const, or strdup. Make some constant data tables const. Fix whitespace. MFC after:1 week Sponsored by: Dell EMC Modified: head/usr.bin/locale/Makefile head/usr.bin/locale/locale.c Modified: head/usr.bin/locale/Makefile == --- head/usr.bin/locale/MakefileThu Dec 1 17:28:45 2016 (r309366) +++ head/usr.bin/locale/MakefileThu Dec 1 17:36:31 2016 (r309367) @@ -1,7 +1,6 @@ # $FreeBSD$ PROG= locale -WARNS?=3 CFLAGS+= -I${.CURDIR}/../../lib/libc/locale .include Modified: head/usr.bin/locale/locale.c == --- head/usr.bin/locale/locale.cThu Dec 1 17:28:45 2016 (r309366) +++ head/usr.bin/locale/locale.cThu Dec 1 17:36:31 2016 (r309367) @@ -57,8 +57,8 @@ void list_charmaps(void); void list_locales(void); const char *lookup_localecat(int); char *kwval_lconv(int); -intkwval_lookup(char *, char **, int *, int *); -void showdetails(char *); +intkwval_lookup(const char *, char **, int *, int *); +void showdetails(const char *); void showkeywordslist(char *substring); void showlocale(void); void usage(void); @@ -66,13 +66,12 @@ voidusage(void); /* Global variables */ static StringList *locales = NULL; -intall_locales = 0; -intall_charmaps = 0; -intprt_categories = 0; -intprt_keywords = 0; -intmore_params = 0; +static int all_locales = 0; +static int all_charmaps = 0; +static int prt_categories = 0; +static int prt_keywords = 0; -struct _lcinfo { +static const struct _lcinfo { const char *name; int id; } lcinfo [] = { @@ -110,7 +109,7 @@ struct _lcinfo { #defineKW_INT_P_SIGN_POSN (KW_ZERO+21) #defineKW_INT_N_SIGN_POSN (KW_ZERO+22) -struct _kwinfo { +static const struct _kwinfo { const char *name; int isstr; /* true - string, false - number */ int catid; /* LC_* */ @@ -224,7 +223,7 @@ struct _kwinfo { }; #defineNKWINFO (nitems(kwinfo)) -const char *boguslocales[] = { "UTF-8" }; +static const char *boguslocales[] = { "UTF-8" }; #defineNBOGUS (nitems(boguslocales)) int @@ -296,7 +295,7 @@ main(int argc, char *argv[]) } else { uint i; for (i = 0; i < nitems(kwinfo); i++) - showdetails ((char *)kwinfo [i].name); + showdetails(kwinfo[i].name); } exit(0); } @@ -341,7 +340,7 @@ list_locales(void) static int scmp(const void *s1, const void *s2) { - return strcmp(*(const char **)s1, *(const char **)s2); + return strcmp(*(const char * const *)s1, *(const char * const *)s2); } /* @@ -378,7 +377,7 @@ list_charmaps(void) /* add US-ASCII, if not yet added */ if (sl_find(charmaps, "US-ASCII") == NULL) - sl_add(charmaps, "US-ASCII"); + sl_add(charmaps, strdup("US-ASCII")); /* sort the list */ qsort(charmaps->sl_str, charmaps->sl_cur, sizeof(char *), scmp); @@ -437,10 +436,10 @@ init_locales_list(void) * we also list 'C' for constistency */ if (sl_find(locales, "POSIX") == NULL) - sl_add(locales, "POSIX"); + sl_add(locales, strdup("POSIX")); if (sl_find(locales, "C") == NULL) - sl_add(locales, "C"); + sl_add(locales, strdup("C")); /* make output nicer, sort the list */ qsort(locales->sl_str, locales->sl_cur, sizeof(char *), scmp); @@ -606,7 +605,7 @@ kwval_lconv(int id) * keyword value and properties lookup */ int -kwval_lookup(char *kwname, char **kwval, int *cat, int *isstr) +kwval_lookup(const char *kwname, char **kwval, int *cat, int *isstr) { int rval; size_t i; @@ -634,7 +633,7 @@ kwval_lookup(char *kwname, char **kwval, * command line options specified. */ void -showdetails(char *kw) +showdetails(const char *kw) { int isstr, cat, tmpval; char*kwval; @@ -649,9 +648,9 @@ showdetails(char *kw) } if (prt_categories) { - if (prt_keywords) + if (prt_keywords) printf("%-20s ", lookup_localecat(cat)); - else + else printf("%-20s\t%s\n", kw, lookup_localecat(cat)); } ___ svn-src-head@freebsd.org mailing list
Re: svn commit: r309344 - head/lib/libutil
> On Dec 1, 2016, at 9:01 AM, Mark Linimon wrote: > > On Thu, Dec 01, 2016 at 09:32:07AM -0700, Ian Lepore wrote: >> On Wed, 2016-11-30 at 19:07 -0800, Ngie Cooper wrote: >>> Really?? I wish you hadn't added me to this list.. I don't in any way >>> endorse the way that you went about dealing with this disagreement. >> >> Really? Well then feel free to ADD my name to the list of people who >> found that comment, and the subsequent non-response to the complaints >> about it, completely inappropriate. > > I expressed an opinion on an IRC channel that I found the comment > offensive. > > But I would rather my permission had been asked ahead of time before > having that comment attached to a public commit log. I think this is > part of the point that ngie is trying to make. > > I'm well-known for my wish that core took a more active, public, stance > on such matters, but I think here that two wrongs may not have made a > right. Yes. And more importantly, the new comment doesn’t tell me *why* I shouldn’t use FD_CLOEXEC. The owness is still on the reader to figure out why using `fcntl(fd, F_SETFD, FD_CLOEXEC)` is wrong. All the new commit does is makes the commit that des@ made more palatable and benign to readers. Thanks, -Ngie ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r309366 - head/lib/libcapsicum
Author: cem Date: Thu Dec 1 17:28:45 2016 New Revision: 309366 URL: https://svnweb.freebsd.org/changeset/base/309366 Log: capsicum_helpers: Squash errors from closed fds Squash EBADF from closed stdin, stdout, or stderr in caph_limit_stdio(). Any program used during special shell scripts may commonly be forked from a parent process with closed standard stream. Do the common sense thing for this common use. Reported by: Iblis Lin Reviewed by: oshogbo@ (earlier version) Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D8657 Modified: head/lib/libcapsicum/capsicum_helpers.h Modified: head/lib/libcapsicum/capsicum_helpers.h == --- head/lib/libcapsicum/capsicum_helpers.h Thu Dec 1 17:26:37 2016 (r309365) +++ head/lib/libcapsicum/capsicum_helpers.h Thu Dec 1 17:28:45 2016 (r309366) @@ -94,12 +94,12 @@ caph_limit_stdout(void) static __inline int caph_limit_stdio(void) { + const int iebadf = CAPH_IGNORE_EBADF; - if (caph_limit_stdin() == -1 || caph_limit_stdout() == -1 || - caph_limit_stderr() == -1) { + if (caph_limit_stream(STDIN_FILENO, CAPH_READ | iebadf) == -1 || + caph_limit_stream(STDOUT_FILENO, CAPH_WRITE | iebadf) == -1 || + caph_limit_stream(STDERR_FILENO, CAPH_WRITE | iebadf) == -1) return (-1); - } - return (0); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r309365 - head/sys/vm
Author: alc Date: Thu Dec 1 17:26:37 2016 New Revision: 309365 URL: https://svnweb.freebsd.org/changeset/base/309365 Log: During vm_page_cache()'s call to vm_radix_insert(), if vm_page_alloc() was called to allocate a new page of radix trie nodes, there could be a call to vm_radix_remove() on the same trie (of PG_CACHED pages) as the in-progress vm_radix_insert(). With the removal of PG_CACHED pages, we can simplify vm_radix_insert() and vm_radix_remove() by removing the flags on the root of the trie that were used to detect this case and the code for restarting vm_radix_insert() when it happened. Reviewed by: kib, markj Tested by:pho Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D8664 Modified: head/sys/vm/_vm_radix.h head/sys/vm/vm_object.c head/sys/vm/vm_radix.c Modified: head/sys/vm/_vm_radix.h == --- head/sys/vm/_vm_radix.h Thu Dec 1 16:54:02 2016(r309364) +++ head/sys/vm/_vm_radix.h Thu Dec 1 17:26:37 2016(r309365) @@ -36,12 +36,8 @@ */ struct vm_radix { uintptr_t rt_root; - uint8_t rt_flags; }; -#defineRT_INSERT_INPROG0x01 -#defineRT_TRIE_MODIFIED0x02 - #ifdef _KERNEL static __inline boolean_t Modified: head/sys/vm/vm_object.c == --- head/sys/vm/vm_object.c Thu Dec 1 16:54:02 2016(r309364) +++ head/sys/vm/vm_object.c Thu Dec 1 17:26:37 2016(r309365) @@ -205,7 +205,6 @@ vm_object_zinit(void *mem, int size, int object->type = OBJT_DEAD; object->ref_count = 0; object->rtree.rt_root = 0; - object->rtree.rt_flags = 0; object->paging_in_progress = 0; object->resident_page_count = 0; object->shadow_count = 0; Modified: head/sys/vm/vm_radix.c == --- head/sys/vm/vm_radix.c Thu Dec 1 16:54:02 2016(r309364) +++ head/sys/vm/vm_radix.c Thu Dec 1 17:26:37 2016(r309365) @@ -341,8 +341,6 @@ vm_radix_insert(struct vm_radix *rtree, index = page->pindex; -restart: - /* * The owner of record for root is not really important because it * will never be used. @@ -360,32 +358,10 @@ restart: panic("%s: key %jx is already present", __func__, (uintmax_t)index); clev = vm_radix_keydiff(m->pindex, index); - - /* -* During node allocation the trie that is being -* walked can be modified because of recursing radix -* trie operations. -* If this is the case, the recursing functions signal -* such situation and the insert operation must -* start from scratch again. -* The freed radix node will then be in the UMA -* caches very likely to avoid the same situation -* to happen. -*/ - rtree->rt_flags |= RT_INSERT_INPROG; tmp = vm_radix_node_get(vm_radix_trimkey(index, clev + 1), 2, clev); - rtree->rt_flags &= ~RT_INSERT_INPROG; - if (tmp == NULL) { - rtree->rt_flags &= ~RT_TRIE_MODIFIED; + if (tmp == NULL) return (ENOMEM); - } - if ((rtree->rt_flags & RT_TRIE_MODIFIED) != 0) { - rtree->rt_flags &= ~RT_TRIE_MODIFIED; - tmp->rn_count = 0; - vm_radix_node_put(tmp); - goto restart; - } *parentp = tmp; vm_radix_addpage(tmp, index, clev, page); vm_radix_addpage(tmp, m->pindex, clev, m); @@ -409,21 +385,9 @@ restart: */ newind = rnode->rn_owner; clev = vm_radix_keydiff(newind, index); - - /* See the comments above. */ - rtree->rt_flags |= RT_INSERT_INPROG; tmp = vm_radix_node_get(vm_radix_trimkey(index, clev + 1), 2, clev); - rtree->rt_flags &= ~RT_INSERT_INPROG; - if (tmp == NULL) { - rtree->rt_flags &= ~RT_TRIE_MODIFIED; + if (tmp == NULL) return (ENOMEM); - } - if ((rtree->rt_flags & RT_TRIE_MODIFIED) != 0) { - rtree->rt_flags &= ~RT_TRIE_MODIFIED; - tmp->rn_count = 0; - vm_radix_node_put(tmp); - goto restart; - } *parentp =
Re: svn commit: r309344 - head/lib/libutil
On Thu, Dec 01, 2016 at 09:32:07AM -0700, Ian Lepore wrote: > On Wed, 2016-11-30 at 19:07 -0800, Ngie Cooper wrote: > > Really?? I wish you hadn't added me to this list.. I don't in any way > > endorse the way that you went about dealing with this disagreement. > > Really? Well then feel free to ADD my name to the list of people who > found that comment, and the subsequent non-response to the complaints > about it, completely inappropriate. I expressed an opinion on an IRC channel that I found the comment offensive. But I would rather my permission had been asked ahead of time before having that comment attached to a public commit log. I think this is part of the point that ngie is trying to make. I'm well-known for my wish that core took a more active, public, stance on such matters, but I think here that two wrongs may not have made a right. mcl ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r309331 - head/usr.bin/locale
On 11/30/2016 18:19, Bruce Evans wrote: > On Wed, 30 Nov 2016, Eric van Gyzen wrote: > >> Log: >> Include limits.h for CHAR_MAX >> >> This was needed on stable/10. Apparently, sys/param.h supplies CHAR_MAX >> on head. Include limits.h anyway, for consistency, and because C >> says so. > > sys/param.actually supplies CHAR_MAX (undocumented namespace pollution) in > all versions of FreeBSD. Yes, I was too terse. I meant, locale.c gets CHAR_MAX from sys/param.h on head (and 11), but does not include sys/param.h on 10. > Untested fixes and cleanups: > > Y diff -u2 locale.c~ locale.c Thanks. Committed. Eric ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r309351 - head/etc/defaults
On 12/01/16 at 08:48P, hiren panchasara wrote: > On 12/01/16 at 04:35P, Warner Losh wrote: > > Author: imp > > Date: Thu Dec 1 04:35:43 2016 > > New Revision: 309351 > > URL: https://svnweb.freebsd.org/changeset/base/309351 > > > > Log: > > Revert the 'performance' setting to 'NONE' from C2. > > Just a note that this commit reverts r282110. Ah, my bad. performance_cx_lowest has more history than that. :-) (HIGH -> Cmax -> C2 -> NONE) Cheers, Hiren pgppfedJR0kE5.pgp Description: PGP signature
svn commit: r309364 - head/usr.bin/locale
Author: vangyzen Date: Thu Dec 1 16:54:02 2016 New Revision: 309364 URL: https://svnweb.freebsd.org/changeset/base/309364 Log: locale: fix buffer management Also, handle signed and unsigned chars, and more gracefully handle invalid input. Submitted by: bde in response to r309331 MFC after:1 week Sponsored by: Dell EMC Modified: head/usr.bin/locale/locale.c Modified: head/usr.bin/locale/locale.c == --- head/usr.bin/locale/locale.cThu Dec 1 15:46:26 2016 (r309363) +++ head/usr.bin/locale/locale.cThu Dec 1 16:54:02 2016 (r309364) @@ -495,29 +495,29 @@ format_grouping(const char *binary) { static char rval[64]; const char *cp; - size_t len; + size_t roff; + int len; rval[0] = '\0'; + roff = 0; for (cp = binary; *cp != '\0'; ++cp) { - char group[sizeof("127;")]; - snprintf(group, sizeof(group), "%hhd;", *cp); - len = strlcat(rval, group, sizeof(rval)); - if (len >= sizeof(rval)) { - len = sizeof(rval) - 1; - break; - } - if (*cp == CHAR_MAX) { - break; - } + if (*cp < 0) + break; /* garbage input */ + len = snprintf(&rval[roff], sizeof(rval) - roff, "%u;", *cp); + if (len < 0 || (unsigned)len >= sizeof(rval) - roff) + break; /* insufficient space for output */ + roff += len; + if (*cp == CHAR_MAX) + break; /* special termination */ } - /* Remove the trailing ';'. */ - rval[len - 1] = '\0'; + /* Truncate at the last successfully snprintf()ed semicolon. */ + if (roff != 0) + rval[roff - 1] = '\0'; - return (rval); + return (&rval[0]); } - /* * keyword value lookup helper (via localeconv()) */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r309351 - head/etc/defaults
On 12/01/16 at 04:35P, Warner Losh wrote: > Author: imp > Date: Thu Dec 1 04:35:43 2016 > New Revision: 309351 > URL: https://svnweb.freebsd.org/changeset/base/309351 > > Log: > Revert the 'performance' setting to 'NONE' from C2. Just a note that this commit reverts r282110. Cheers, Hiren pgpg5ixLSD8tO.pgp Description: PGP signature
Re: svn commit: r309344 - head/lib/libutil
On Wed, 2016-11-30 at 19:07 -0800, Ngie Cooper wrote: > > > > On Nov 30, 2016, at 18:21, Conrad E. Meyer wrote: > > > > Author: cem > > Date: Thu Dec 1 02:21:36 2016 > > New Revision: 309344 > > URL: https://svnweb.freebsd.org/changeset/base/309344 > > > > Log: > > Remove a death threat from the FreeBSD sources > > > > Reported by:koobs@, araujo@, linimon@, bjk@, emaste@, jhb@, > > ngie@, cem@ > > Maintainer timeout:des@ > Really?? I wish you hadn't added me to this list.. I don't in any way > endorse the way that you went about dealing with this disagreement. > You kind of just pissed all over what des@ did out of spite. > > Really? Well then feel free to ADD my name to the list of people who found that comment, and the subsequent non-response to the complaints about it, completely inappropriate. -- Ian > > > > > > Modified: > > head/lib/libutil/flopen.c > > > > Modified: head/lib/libutil/flopen.c > > === > > === > > --- head/lib/libutil/flopen.cThu Dec 1 01:56:34 > > 2016(r309343) > > +++ head/lib/libutil/flopen.cThu Dec 1 02:21:36 > > 2016(r309344) > > @@ -40,10 +40,10 @@ __FBSDID("$FreeBSD$"); > > /* > > * Reliably open and lock a file. > > * > > - * DO NOT, UNDER PAIN OF DEATH, modify this code without first > > reading the > > - * revision history and discussing your changes with > org>. > > - * Don't be fooled by the code's apparent simplicity; there would > > be no > > - * need for this function if it was as easy to get right as you > > think. > > + * Please do not modify this code without first reading the > > revision history > > + * and discussing your changes with . Don't be > > fooled by the > > + * code's apparent simplicity; there would be no need for this > > function if it > > + * was easy to get right. > > */ > > int > > flopen(const char *path, int flags, ...) > > @@ -108,7 +108,11 @@ flopen(const char *path, int flags, ...) > > errno = serrno; > > return (-1); > > } > > -#ifdef DONT_EVEN_THINK_ABOUT_IT > > +/* > > + * The following change is provided as a specific example > > to > > + * avoid. > > + */ > > +#if 0 > > if (fcntl(fd, F_SETFD, FD_CLOEXEC) != 0) { > > serrno = errno; > > (void)close(fd); > > > ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r309350 - head/etc
On Thu, 2016-12-01 at 04:35 +, Warner Losh wrote: > Author: imp > Date: Thu Dec 1 04:35:41 2016 > New Revision: 309350 > URL: https://svnweb.freebsd.org/changeset/base/309350 > > Log: > If the kenv variable rc_debug is set, turn on rc_debug. > > Modified: > head/etc/rc.subr > > Modified: head/etc/rc.subr > = > = > --- head/etc/rc.subr Thu Dec 1 04:35:38 2016(r309349) > +++ head/etc/rc.subr Thu Dec 1 04:35:41 2016(r309350) > @@ -2119,6 +2119,12 @@ _echoonce() > esac > } > > +# If the loader env variable rc.debug is set, turn on debugging. > rc.conf will > +# still override this, but /etc/defaults/rc.conf.a > +if kenv -q rc.debug > /dev/null ; then > + rc_debug=YES > +fi > + > fi # [ -z "${_rc_subr_loaded}" ] > > _rc_subr_loaded=: > The commit message says rc_debug but the env var in your code is rc.debug. I think rc_debug would be better -- easier than remembering two different names for the same functionality. BTW, thanks for this, it's a great idea. -- Ian ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r309363 - in head: contrib/libarchive/libarchive contrib/libarchive/libarchive/test contrib/libarchive/tar contrib/libarchive/tar/test lib/libarchive/tests
Author: mm Date: Thu Dec 1 15:46:26 2016 New Revision: 309363 URL: https://svnweb.freebsd.org/changeset/base/309363 Log: MFC r309362: Sync libarchive with vendor. Small improvements, style fixes, bugfixes. Restores compatibility with tar archives created with Perl Archive::Tar (1) MFC after:1 week Reported by: Matthew Seaman (1) Added: head/contrib/libarchive/libarchive/test/test_compat_perl_archive_tar.c - copied unchanged from r309362, vendor/libarchive/dist/libarchive/test/test_compat_perl_archive_tar.c head/contrib/libarchive/libarchive/test/test_compat_perl_archive_tar.tar.uu - copied unchanged from r309362, vendor/libarchive/dist/libarchive/test/test_compat_perl_archive_tar.tar.uu Modified: head/contrib/libarchive/libarchive/archive.h head/contrib/libarchive/libarchive/archive_read_support_format_mtree.c head/contrib/libarchive/libarchive/archive_read_support_format_tar.c head/contrib/libarchive/tar/creation_set.c head/contrib/libarchive/tar/test/main.c head/contrib/libarchive/tar/test/test_copy.c head/contrib/libarchive/tar/write.c head/lib/libarchive/tests/Makefile Directory Properties: head/contrib/libarchive/ (props changed) Modified: head/contrib/libarchive/libarchive/archive.h == --- head/contrib/libarchive/libarchive/archive.hThu Dec 1 15:39:33 2016(r309362) +++ head/contrib/libarchive/libarchive/archive.hThu Dec 1 15:46:26 2016(r309363) @@ -562,7 +562,7 @@ __LA_DECL la_int64_t archive_read_head * we cannot say whether there are encrypted entries, then * ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW is returned. * In general, this function will return values below zero when the - * reader is uncertain or totally uncapable of encryption support. + * reader is uncertain or totally incapable of encryption support. * When this function returns 0 you can be sure that the reader * supports encryption detection but no encrypted entries have * been found yet. @@ -984,12 +984,12 @@ __LA_DECL int archive_read_disk_can_desc __LA_DECL int archive_read_disk_current_filesystem(struct archive *); __LA_DECL int archive_read_disk_current_filesystem_is_synthetic(struct archive *); __LA_DECL int archive_read_disk_current_filesystem_is_remote(struct archive *); -/* Request that the access time of the entry visited by travesal be restored. */ +/* Request that the access time of the entry visited by traversal be restored. */ __LA_DECL int archive_read_disk_set_atime_restored(struct archive *); /* * Set behavior. The "flags" argument selects optional behavior. */ -/* Request that the access time of the entry visited by travesal be restored. +/* Request that the access time of the entry visited by traversal be restored. * This is the same as archive_read_disk_set_atime_restored. */ #defineARCHIVE_READDISK_RESTORE_ATIME (0x0001) /* Default: Do not skip an entry which has nodump flags. */ @@ -1124,7 +1124,7 @@ __LA_DECL int archive_match_time_exclude /* * Flags to tell a matching type of time stamps. These are used for - * following functinos. + * following functions. */ /* Time flag: mtime to be tested. */ #define ARCHIVE_MATCH_MTIME(0x0100) @@ -1144,7 +1144,7 @@ __LA_DECL int archive_match_include_date const char *_datestr); __LA_DECL int archive_match_include_date_w(struct archive *, int _flag, const wchar_t *_datestr); -/* Set inclusion time by a particluar file. */ +/* Set inclusion time by a particular file. */ __LA_DECL int archive_match_include_file_time(struct archive *, int _flag, const char *_pathname); __LA_DECL int archive_match_include_file_time_w(struct archive *, Modified: head/contrib/libarchive/libarchive/archive_read_support_format_mtree.c == --- head/contrib/libarchive/libarchive/archive_read_support_format_mtree.c Thu Dec 1 15:39:33 2016(r309362) +++ head/contrib/libarchive/libarchive/archive_read_support_format_mtree.c Thu Dec 1 15:46:26 2016(r309363) @@ -75,6 +75,8 @@ __FBSDID("$FreeBSD$"); #defineMTREE_HAS_OPTIONAL 0x0800 #defineMTREE_HAS_NOCHANGE 0x1000 /* FreeBSD specific */ +#defineMTREE_HASHTABLE_SIZE 1024 + struct mtree_option { struct mtree_option *next; char *value; @@ -86,6 +88,8 @@ struct mtree_entry { char *name; char full; char used; + unsigned int name_hash; + struct mtree_entry *hashtable_next; }; struct mtree { @@ -98,6 +102,7 @@ struct mtree { const char *archive_format_name; struct mtree_entry *entries; struct mtree_entry *this_entry; + struct mtree_entry *entry_hashtable[MTREE_HASHTABLE_SIZE];
svn commit: r309361 - head/sys/x86/cpufreq
Author: danfe (ports committer) Date: Thu Dec 1 14:31:05 2016 New Revision: 309361 URL: https://svnweb.freebsd.org/changeset/base/309361 Log: - Mention mismatching numbers in MSR vs. ACPI _PSS count warning: seeing actual numbers would help debugging (also, `MSR' and `ACPI' are standard abbreviations and thus should be properly capitalized) - Rephrase unsupported AMD CPUs message and wrap as an overly long line: `sorry' 1) is wrongly spelled after period (starts with a small letter) and 2) carries emotional "tinge" that is unnecessary and even bogus in debug message; `implemented' is not the best word as `supported' suits better in this context - Improve readability when reporting resulted P-state transition (debug) Approved by: jhb Modified: head/sys/x86/cpufreq/hwpstate.c Modified: head/sys/x86/cpufreq/hwpstate.c == --- head/sys/x86/cpufreq/hwpstate.c Thu Dec 1 14:28:37 2016 (r309360) +++ head/sys/x86/cpufreq/hwpstate.c Thu Dec 1 14:31:05 2016 (r309361) @@ -198,7 +198,7 @@ hwpstate_goto_pstate(device_t dev, int p } DELAY(100); } - HWPSTATE_DEBUG(dev, "result P%d-state on cpu%d\n", + HWPSTATE_DEBUG(dev, "result: P%d-state on cpu%d\n", (int)msr, PCPU_GET(cpuid)); if (msr != id) { HWPSTATE_DEBUG(dev, "error: loop is not enough.\n"); @@ -367,7 +367,8 @@ hwpstate_probe(device_t dev) */ msr = rdmsr(MSR_AMD_10H_11H_LIMIT); if (sc->cfnum != 1 + AMD_10H_11H_GET_PSTATE_MAX_VAL(msr)) { - HWPSTATE_DEBUG(dev, "msr and acpi _PSS count mismatch.\n"); + HWPSTATE_DEBUG(dev, "MSR (%jd) and ACPI _PSS (%d)" + " count mismatch\n", (intmax_t)msr, sc->cfnum); error = TRUE; } } @@ -427,7 +428,8 @@ hwpstate_get_info_from_msr(device_t dev) hwpstate_set[i].freq = (100 * (fid + 0x10)) >> did; break; default: - HWPSTATE_DEBUG(dev, "get_info_from_msr: AMD family 0x%02x CPU's are not implemented yet. sorry.\n", family); + HWPSTATE_DEBUG(dev, "get_info_from_msr: AMD family" + " 0x%02x CPUs are not supported yet\n", family); return (ENXIO); } hwpstate_set[i].pstate_id = i; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r309360 - head/sys/boot/common
Author: emaste Date: Thu Dec 1 14:28:37 2016 New Revision: 309360 URL: https://svnweb.freebsd.org/changeset/base/309360 Log: EFI loaders: parse rela relocations on amd64 Prior to this change the loader self relocation code interpreted amd64's rela relocations as if they were rel relocations, discarding the addend. This "works" because GNU ld 2.17.50 stores the addend value in both the r_addend field of the relocation (as expected) and at the target of the relocation. Other linkers, and possibly other versions of GNU ld, won't have this behaviour, so interpret the relocations correctly. Reported by: George Rimar Reviewed by: andrew MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D8681 Modified: head/sys/boot/common/self_reloc.c Modified: head/sys/boot/common/self_reloc.c == --- head/sys/boot/common/self_reloc.c Thu Dec 1 12:32:52 2016 (r309359) +++ head/sys/boot/common/self_reloc.c Thu Dec 1 14:28:37 2016 (r309360) @@ -31,7 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include -#if defined(__aarch64__) +#if defined(__aarch64__) || defined(__amd64__) #defineElfW_RelElf64_Rela #defineElfW_DynElf64_Dyn #defineELFW_R_TYPE ELF64_R_TYPE @@ -40,10 +40,6 @@ __FBSDID("$FreeBSD$"); #defineElfW_RelElf32_Rel #defineElfW_DynElf32_Dyn #defineELFW_R_TYPE ELF32_R_TYPE -#elif defined(__amd64__) -#defineElfW_RelElf64_Rel -#defineElfW_DynElf64_Dyn -#defineELFW_R_TYPE ELF64_R_TYPE #else #error architecture not supported #endif @@ -99,7 +95,9 @@ self_reloc(Elf_Addr baseaddr, ElfW_Dyn * } /* -* Perform the actual relocation. +* Perform the actual relocation. We rely on the object having been +* linked at 0, so that the difference between the load and link +* address is the same as the load address. */ for (; relsz > 0; relsz -= relent) { switch (ELFW_R_TYPE(rel->r_info)) { @@ -110,12 +108,7 @@ self_reloc(Elf_Addr baseaddr, ElfW_Dyn * case RELOC_TYPE_RELATIVE: newaddr = (Elf_Addr *)(rel->r_offset + baseaddr); #ifdef ELF_RELA - /* -* For R_AARCH64_RELATIVE we need to calculate the -* delta between the address we are run from and the -* address we are linked at. As the latter is 0 we -* just use the address we are run from for this. -*/ + /* Addend relative to the base address. */ *newaddr = baseaddr + rel->r_addend; #else /* Address relative to the base address. */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r309357 - head/usr.sbin/i2c
Author: n_hibma Date: Thu Dec 1 09:14:58 2016 New Revision: 309357 URL: https://svnweb.freebsd.org/changeset/base/309357 Log: Speling fixes and fix line endings for err_msg output. In some cases there was not \n, in other cases there was. Modified: head/usr.sbin/i2c/i2c.c Modified: head/usr.sbin/i2c/i2c.c == --- head/usr.sbin/i2c/i2c.c Thu Dec 1 07:50:44 2016(r309356) +++ head/usr.sbin/i2c/i2c.c Thu Dec 1 09:14:58 2016(r309357) @@ -310,7 +310,7 @@ i2c_write(char *dev, struct options i2c_ error = ioctl(fd, I2CWRITE, &cmd); free(buf); if (error == -1) { - err_msg = "ioctl: error when write offset"; + err_msg = "ioctl: error writing offset"; goto err1; } } @@ -335,7 +335,7 @@ i2c_write(char *dev, struct options i2c_ cmd.last = 0; error = ioctl(fd, I2CWRITE, &cmd); if (error == -1) { - err_msg = "ioctl: error when write"; + err_msg = "ioctl: error writing"; goto err1; } break; @@ -350,7 +350,7 @@ i2c_write(char *dev, struct options i2c_ error = ioctl(fd, I2CWRITE, &cmd); free(buf); if (error == -1) { - err_msg = "ioctl: error when write offset"; + err_msg = "ioctl: error writing offset"; goto err1; } } @@ -371,7 +371,7 @@ i2c_write(char *dev, struct options i2c_ cmd.last = 0; error = ioctl(fd, I2CWRITE, &cmd); if (error == -1) { - err_msg = "ioctl: error when write"; + err_msg = "ioctl: error writing"; goto err1; } break; @@ -394,7 +394,7 @@ i2c_write(char *dev, struct options i2c_ error = ioctl(fd, I2CWRITE, &cmd); free(buf); if (error == -1) { - err_msg = "ioctl: error when write"; + err_msg = "ioctl: error writing"; goto err1; } break; @@ -416,7 +416,7 @@ err1: fprintf(stderr, "error sending stop condtion\n"); err2: if (err_msg) - fprintf(stderr, "%s", err_msg); + fprintf(stderr, "%s\n", err_msg); close(fd); return (1); @@ -458,7 +458,7 @@ i2c_read(char *dev, struct options i2c_o error = ioctl(fd, I2CWRITE, &cmd); free(buf); if (error == -1) { - err_msg = "ioctl: error when write offset"; + err_msg = "ioctl: error writing offset"; goto err1; } @@ -466,7 +466,7 @@ i2c_read(char *dev, struct options i2c_o cmd.slave = i2c_opt.addr; error = ioctl(fd, I2CSTOP, &cmd); if (error == -1) { - err_msg = "error sending stop condtion\n"; + err_msg = "error sending stop condtion"; goto err2; } } @@ -491,7 +491,7 @@ i2c_read(char *dev, struct options i2c_o } error = ioctl(fd, I2CSTOP, &cmd); if (error == -1) { - err_msg = "error sending stop condtion\n"; + err_msg = "error sending stop condtion"; goto err2; } @@ -513,7 +513,7 @@ err1: fprintf(stderr, "error sending stop condtion\n"); err2: if (err_msg) - fprintf(stderr, "%s", err_msg); + fprintf(stderr, "%s\n", err_msg); close(fd); return (1); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r309356 - in head/contrib/subversion: . subversion/include subversion/include/private subversion/libsvn_client subversion/libsvn_fs_fs subversion/libsvn_fs_x subversion/libsvn_ra_serf s...
Author: peter Date: Thu Dec 1 07:50:44 2016 New Revision: 309356 URL: https://svnweb.freebsd.org/changeset/base/309356 Log: Update from subversion 1.9.4 to 1.9.5. This includes a security fix for a component that we do not build, and two potentially useful client side fixes for reintegrate merges and tree conflict handling. See CHANGES for full details. Modified: head/contrib/subversion/CHANGES head/contrib/subversion/README head/contrib/subversion/build-outputs.mk head/contrib/subversion/configure head/contrib/subversion/configure.ac head/contrib/subversion/get-deps.sh head/contrib/subversion/subversion/include/private/svn_sqlite.h head/contrib/subversion/subversion/include/svn_version.h head/contrib/subversion/subversion/libsvn_client/merge.c head/contrib/subversion/subversion/libsvn_fs_fs/cached_data.c head/contrib/subversion/subversion/libsvn_fs_fs/caching.c head/contrib/subversion/subversion/libsvn_fs_fs/fs.c head/contrib/subversion/subversion/libsvn_fs_fs/fs_fs.c head/contrib/subversion/subversion/libsvn_fs_fs/low_level.c head/contrib/subversion/subversion/libsvn_fs_fs/pack.c head/contrib/subversion/subversion/libsvn_fs_fs/pack.h head/contrib/subversion/subversion/libsvn_fs_fs/rep-cache-db.h head/contrib/subversion/subversion/libsvn_fs_fs/rep-cache.c head/contrib/subversion/subversion/libsvn_fs_fs/rep-cache.h head/contrib/subversion/subversion/libsvn_fs_fs/transaction.c head/contrib/subversion/subversion/libsvn_fs_fs/tree.c head/contrib/subversion/subversion/libsvn_fs_x/rep-cache-db.h head/contrib/subversion/subversion/libsvn_ra_serf/xml.c head/contrib/subversion/subversion/libsvn_repos/reporter.c head/contrib/subversion/subversion/libsvn_repos/repos.c head/contrib/subversion/subversion/libsvn_subr/config_file.c head/contrib/subversion/subversion/libsvn_subr/deprecated.c head/contrib/subversion/subversion/libsvn_subr/gpg_agent.c head/contrib/subversion/subversion/libsvn_subr/internal_statements.h head/contrib/subversion/subversion/libsvn_subr/sqlite.c head/contrib/subversion/subversion/libsvn_subr/sysinfo.c head/contrib/subversion/subversion/libsvn_subr/win32_crashrpt.c head/contrib/subversion/subversion/libsvn_subr/xml.c head/contrib/subversion/subversion/libsvn_wc/conflicts.c head/contrib/subversion/subversion/libsvn_wc/update_editor.c head/contrib/subversion/subversion/libsvn_wc/wc-checks.h head/contrib/subversion/subversion/libsvn_wc/wc-metadata.h head/contrib/subversion/subversion/libsvn_wc/wc-queries.h head/contrib/subversion/subversion/svn/info-cmd.c head/contrib/subversion/subversion/svn/merge-cmd.c head/contrib/subversion/subversion/svnserve/serve.c Directory Properties: head/contrib/subversion/ (props changed) Modified: head/contrib/subversion/CHANGES == --- head/contrib/subversion/CHANGES Thu Dec 1 07:46:24 2016 (r309355) +++ head/contrib/subversion/CHANGES Thu Dec 1 07:50:44 2016 (r309356) @@ -1,3 +1,54 @@ +Version 1.9.5 +(29 Nov 2016, from /branches/1.9.x) +http://svn.apache.org/repos/asf/subversion/tags/1.9.5 + + User-visible changes: + - Client-side bugfixes: +* fix accessing non-existent paths during reintegrate merge (r1766699 et al) +* fix handling of newly secured subdirectories in working copy (r1724448) +* info: remove trailing whitespace in --show-item=revision (issue #4660) +* fix recording wrong revisions for tree conflicts (r1734106) +* gpg-agent: improve discovery of gpg-agent sockets (r1766327) +* gpg-agent: fix file descriptor leak (r1766323) +* resolve: fix --accept=mine-full for binary files (issue #4647) +* merge: fix possible crash (issue #4652) +* resolve: fix possible crash (r1748514) +* fix potential crash in Win32 crash reporter (r1663253 et al) + + - Server-side bugfixes: +* fsfs: fix "offset too large" error during pack (issue #4657) +* svnserve: enable hook script environments (r1769152) +* fsfs: fix possible data reconstruction error (issue #4658) +* fix source of spurious 'incoming edit' tree conflicts (r1770108) +* fsfs: improve caching for large directories (r1721285) +* fsfs: fix crash when encountering all-zero checksums (r1759686) +* fsfs: fix potential source of repository corruptions (r1756266) +* mod_dav_svn: fix excessive memory usage with mod_headers/mod_deflate + (issue #3084) +* mod_dav_svn: reduce memory usage during GET requests (r1757529 et al) +* fsfs: fix unexpected "database is locked" errors (r1741096 et al) +* fsfs: fix opening old repositories without db/format files (r1720015) + + - Client-side and server-side bugfixes: +* fix possible crash when reading invalid configuration files (r1715777) + + - Bindings bugfixes: +* swig-pl: do not corrupt "{DATE}" revision variable (r1767768) +* javahl: fix temporary accepting SSL server certific