svn commit: r361239 - head
Author: kevans Date: Tue May 19 03:19:01 2020 New Revision: 361239 URL: https://svnweb.freebsd.org/changeset/base/361239 Log: Belated RELNOTES entry for r361238 This may get revised later if the larger change lands, but we should note this. Modified: head/RELNOTES Modified: head/RELNOTES == --- head/RELNOTES Tue May 19 02:41:05 2020(r361238) +++ head/RELNOTES Tue May 19 03:19:01 2020(r361239) @@ -10,6 +10,9 @@ newline. Entries should be separated by a newline. Changes to this file should not be MFCed. +r361238: + ZFS will now reject read(2) of a dirfd with EISDIR. + r360920,r360923,r360924,r360927,r360928,r360931,r360933,r360936: Remove support for ARC4, Blowfish, Cast, DES, Triple DES, MD5, MD5-KPDK, MD5-HMAC, SHA1-KPDK, and Skipjack algorithms from ___ 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: r361238 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: kevans Date: Tue May 19 02:41:05 2020 New Revision: 361238 URL: https://svnweb.freebsd.org/changeset/base/361238 Log: zfs: reject read(2) of a dirfd with EISDIR This is independent of the recently-discussed global change, which is still in review/discussion stage. This is effectively a measure for consistency in the ZFS world, where FreeBSD was the only platform (as far as I could find) that allowed this. What ZFS exposes is decidedly not useful for any real purposes, to paraphrase (hopefully faithfully) jhb's findings when exploring this: The size of a directory in ZFS is the number of directory entries within. When reading a directory, you would instead get the leading part of its raw contents; the amount you get being dictated by the "size," i.e. number of directory entries. There's decidedly (luckily) no stack disclosure happening here, though the behavior is bizarre and almost certainly a historical accident. This change has already been upstreamed to OpenZFS. MFC after:1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue May 19 02:07:08 2020(r361237) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue May 19 02:41:05 2020(r361238) @@ -646,6 +646,12 @@ zfs_read(vnode_t *vp, uio_t *uio, int ioflag, cred_t * ZFS_ENTER(zfsvfs); ZFS_VERIFY_ZP(zp); + /* We don't copy out anything useful for directories. */ + if (vp->v_type == VDIR) { + ZFS_EXIT(zfsvfs); + return (SET_ERROR(EISDIR)); + } + if (zp->z_pflags & ZFS_AV_QUARANTINED) { ZFS_EXIT(zfsvfs); return (SET_ERROR(EACCES)); ___ 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: r361237 - head/tests/sys/netinet
Author: lwhsu Date: Tue May 19 02:07:08 2020 New Revision: 361237 URL: https://svnweb.freebsd.org/changeset/base/361237 Log: Temporarily disable test case causes kernel panic in CI: - sys.netinet.so_reuseport_lb_test.basic_ipv6 PR: 246560 Sponsored by: The FreeBSD Foundation Modified: head/tests/sys/netinet/so_reuseport_lb_test.c Modified: head/tests/sys/netinet/so_reuseport_lb_test.c == --- head/tests/sys/netinet/so_reuseport_lb_test.c Tue May 19 01:43:00 2020(r361236) +++ head/tests/sys/netinet/so_reuseport_lb_test.c Tue May 19 02:07:08 2020(r361237) @@ -188,6 +188,9 @@ ATF_TC_BODY(basic_ipv6, tc) int error, sds[16]; uint16_t port; + if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) + atf_tc_skip("https://bugs.freebsd.org/246560;); + sds[0] = lb_listen_socket(PF_INET6, SOCK_NONBLOCK); memset(, 0, sizeof(addr)); ___ 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: r361232 - head/sys/powerpc/aim
Author: jhibbits Date: Tue May 19 01:06:31 2020 New Revision: 361232 URL: https://svnweb.freebsd.org/changeset/base/361232 Log: powerpc/mmu: Don't use the cache instructions to zero pages A page (even physmem) can be marked as cache-inhibited. Attempting to use 'dcbz' to zero a page mapped cache-inhibited triggers an alignment exception, which is fatal in kernel. This was seen when testing hardware acceleration with X on POWER9. At some point in the future, this should be changed to a more straight forward zero loop instead of bzero(), and a similar change be made to the other pmaps. Reported by: pkubaj@ Modified: head/sys/powerpc/aim/mmu_radix.c Modified: head/sys/powerpc/aim/mmu_radix.c == --- head/sys/powerpc/aim/mmu_radix.cTue May 19 01:05:13 2020 (r361231) +++ head/sys/powerpc/aim/mmu_radix.cTue May 19 01:06:31 2020 (r361232) @@ -909,10 +909,8 @@ static void pagezero(vm_offset_t va) { va = trunc_page(va); - int off; - for (off = 0; off < PAGE_SIZE; off += cacheline_size) - __asm __volatile("dcbz 0,%0" :: "r"(va + off)); + bzero((void *)va, PAGE_SIZE); } static uint64_t ___ 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: r361231 - head/sys/netinet
Author: karels Date: Tue May 19 01:05:13 2020 New Revision: 361231 URL: https://svnweb.freebsd.org/changeset/base/361231 Log: Fix NULL-pointer bug from r361228. Note that in_pcb_lport and in_pcb_lport_dest can be called with a NULL local address for IPv6 sockets; handle it. Found by syzkaller. Reported by: cem MFC after:1 month Modified: head/sys/netinet/in_pcb.c Modified: head/sys/netinet/in_pcb.c == --- head/sys/netinet/in_pcb.c Tue May 19 00:15:19 2020(r361230) +++ head/sys/netinet/in_pcb.c Tue May 19 01:05:13 2020(r361231) @@ -615,6 +615,7 @@ in_pcbbind(struct inpcb *inp, struct sockaddr *nam, st * Assign a local port like in_pcb_lport(), but also used with connect() * and a foreign address and port. If fsa is non-NULL, choose a local port * that is unused with those, otherwise one that is completely unused. + * lsa can be NULL for IPv6. */ int in_pcb_lport_dest(struct inpcb *inp, struct sockaddr *lsa, u_short *lportp, @@ -692,14 +693,17 @@ in_pcb_lport_dest(struct inpcb *inp, struct sockaddr * #ifdef INET laddr.s_addr = INADDR_ANY; if ((inp->inp_vflag & (INP_IPV4|INP_IPV6)) == INP_IPV4) { - laddr = ((struct sockaddr_in *)lsa)->sin_addr; + if (lsa != NULL) + laddr = ((struct sockaddr_in *)lsa)->sin_addr; if (fsa != NULL) faddr = ((struct sockaddr_in *)fsa)->sin_addr; } #endif #ifdef INET6 - if (lsa->sa_family == AF_INET6) { - laddr6 = &((struct sockaddr_in6 *)lsa)->sin6_addr; + laddr6 = NULL; + if ((inp->inp_vflag & INP_IPV6) != 0) { + if (lsa != NULL) + laddr6 = &((struct sockaddr_in6 *)lsa)->sin6_addr; if (fsa != NULL) faddr6 = &((struct sockaddr_in6 *)fsa)->sin6_addr; } ___ 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: r361230 - head/contrib/blacklist/bin
Author: emaste Date: Tue May 19 00:15:19 2020 New Revision: 361230 URL: https://svnweb.freebsd.org/changeset/base/361230 Log: blacklistd.conf.5: typo/grammar fixes PR: 246467 Submitted by: Mike Lempriere Modified: head/contrib/blacklist/bin/blacklistd.conf.5 Modified: head/contrib/blacklist/bin/blacklistd.conf.5 == --- head/contrib/blacklist/bin/blacklistd.conf.5Mon May 18 23:43:48 2020(r361229) +++ head/contrib/blacklist/bin/blacklistd.conf.5Tue May 19 00:15:19 2020(r361230) @@ -125,18 +125,18 @@ The second field is the socket .Dv dgram , or numeric. The third field is the -.Va prococol : +.Va protocol : .Dv tcp , .Dv udp , .Dv tcp6 , .Dv udp6 , or numeric. -The fourth file is the effective user +The fourth field is the effective user .Va ( owner ) of the daemon process reporting the event, either as a username or a userid. .Pp -The rest of the fields are controlling the behavior of the filter. +The rest of the fields control the behavior of the filter. .Pp The .Va name ___ 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: r361229 - head/tests/sys/geom/class/multipath
Author: lwhsu Date: Mon May 18 23:43:48 2020 New Revision: 361229 URL: https://svnweb.freebsd.org/changeset/base/361229 Log: Revert 357780, `dtrace -c` has been fixed in head` PR: 244053 Sponsored by: The FreeBSD Foundation Modified: head/tests/sys/geom/class/multipath/failloop.sh Modified: head/tests/sys/geom/class/multipath/failloop.sh == --- head/tests/sys/geom/class/multipath/failloop.sh Mon May 18 22:53:12 2020(r361228) +++ head/tests/sys/geom/class/multipath/failloop.sh Mon May 18 23:43:48 2020(r361229) @@ -36,10 +36,6 @@ failloop_head() } failloop_body() { - if [ "$(atf_config_get ci false)" = "true" ]; then - atf_skip "https://bugs.freebsd.org/244053; - fi - sysctl -n kern.geom.notaste > kern.geom.notaste.txt load_gnop load_gmultipath ___ 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: r361228 - in head/sys: netinet netinet6
Author: karels Date: Mon May 18 22:53:12 2020 New Revision: 361228 URL: https://svnweb.freebsd.org/changeset/base/361228 Log: Allow TCP to reuse local port with different destinations Previously, tcp_connect() would bind a local port before connecting, forcing the local port to be unique across all outgoing TCP connections for the address family. Instead, choose a local port after selecting the destination and the local address, requiring only that the tuple is unique and does not match a wildcard binding. Reviewed by: tuexen (rscheff, rrs previous version) MFC after:1 month Sponsored by: Forcepoint LLC Differential Revision:https://reviews.freebsd.org/D24781 Modified: head/sys/netinet/in_pcb.c head/sys/netinet/in_pcb.h head/sys/netinet/tcp_usrreq.c head/sys/netinet6/in6_pcb.c head/sys/netinet6/in6_pcb.h Modified: head/sys/netinet/in_pcb.c == --- head/sys/netinet/in_pcb.c Mon May 18 19:48:38 2020(r361227) +++ head/sys/netinet/in_pcb.c Mon May 18 22:53:12 2020(r361228) @@ -610,13 +610,15 @@ in_pcbbind(struct inpcb *inp, struct sockaddr *nam, st } #endif +#if defined(INET) || defined(INET6) /* - * Select a local port (number) to use. + * Assign a local port like in_pcb_lport(), but also used with connect() + * and a foreign address and port. If fsa is non-NULL, choose a local port + * that is unused with those, otherwise one that is completely unused. */ -#if defined(INET) || defined(INET6) int -in_pcb_lport(struct inpcb *inp, struct in_addr *laddrp, u_short *lportp, -struct ucred *cred, int lookupflags) +in_pcb_lport_dest(struct inpcb *inp, struct sockaddr *lsa, u_short *lportp, +struct sockaddr *fsa, u_short fport, struct ucred *cred, int lookupflags) { struct inpcbinfo *pcbinfo; struct inpcb *tmpinp; @@ -624,8 +626,11 @@ in_pcb_lport(struct inpcb *inp, struct in_addr *laddrp int count, dorandom, error; u_short aux, first, last, lport; #ifdef INET - struct in_addr laddr; + struct in_addr laddr, faddr; #endif +#ifdef INET6 + struct in6_addr *laddr6, *faddr6; +#endif pcbinfo = inp->inp_pcbinfo; @@ -685,15 +690,22 @@ in_pcb_lport(struct inpcb *inp, struct in_addr *laddrp } #ifdef INET - /* Make the compiler happy. */ - laddr.s_addr = 0; + laddr.s_addr = INADDR_ANY; if ((inp->inp_vflag & (INP_IPV4|INP_IPV6)) == INP_IPV4) { - KASSERT(laddrp != NULL, ("%s: laddrp NULL for v4 inp %p", - __func__, inp)); - laddr = *laddrp; + laddr = ((struct sockaddr_in *)lsa)->sin_addr; + if (fsa != NULL) + faddr = ((struct sockaddr_in *)fsa)->sin_addr; } #endif - tmpinp = NULL; /* Make compiler happy. */ +#ifdef INET6 + if (lsa->sa_family == AF_INET6) { + laddr6 = &((struct sockaddr_in6 *)lsa)->sin6_addr; + if (fsa != NULL) + faddr6 = &((struct sockaddr_in6 *)fsa)->sin6_addr; + } +#endif + + tmpinp = NULL; lport = *lportp; if (dorandom) @@ -709,30 +721,62 @@ in_pcb_lport(struct inpcb *inp, struct in_addr *laddrp *lastport = first; lport = htons(*lastport); + if (fsa != NULL) { + +#ifdef INET + if (lsa->sa_family == AF_INET) { + tmpinp = in_pcblookup_hash_locked(pcbinfo, + faddr, fport, laddr, lport, lookupflags, + NULL); + } +#endif #ifdef INET6 - if ((inp->inp_vflag & INP_IPV6) != 0) - tmpinp = in6_pcblookup_local(pcbinfo, - >in6p_laddr, lport, lookupflags, cred); + if (lsa->sa_family == AF_INET6) { + tmpinp = in6_pcblookup_hash_locked(pcbinfo, + faddr6, fport, laddr6, lport, lookupflags, + NULL); + } #endif + } else { +#ifdef INET6 + if ((inp->inp_vflag & INP_IPV6) != 0) + tmpinp = in6_pcblookup_local(pcbinfo, + >in6p_laddr, lport, lookupflags, cred); +#endif #if defined(INET) && defined(INET6) - else + else #endif #ifdef INET - tmpinp = in_pcblookup_local(pcbinfo, laddr, - lport, lookupflags, cred); + tmpinp = in_pcblookup_local(pcbinfo, laddr, + lport, lookupflags, cred); #endif + } } while (tmpinp != NULL); -#ifdef INET - if ((inp->inp_vflag & (INP_IPV4|INP_IPV6)) == INP_IPV4) -
Re: svn commit: r361136 - head/sys/fs/ext2fs
... On 17/05/2020 09:52, Fedor Uporov wrote: Author: fsu Date: Sun May 17 14:52:54 2020 New Revision: 361136 URL: https://svnweb.freebsd.org/changeset/base/361136 Log: Add BE architectures support. Author of most initial version: pfg (https://reviews.freebsd.org/D23259) Reviewed by:pfg MFC after: 3 months Differential Revision:https://reviews.freebsd.org/D24685 Thanks so much for finishing off my initial code and for testing in PPC! Pedro. ___ 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: r361209 - head/sys/netinet
> On 18. May 2020, at 23:09, Ian Lepore wrote: > > On Mon, 2020-05-18 at 23:01 +0200, Michael Tuexen wrote: >>> On 18. May 2020, at 22:48, Ian Lepore wrote: >>> >>> On Mon, 2020-05-18 at 22:43 +0200, Michael Tuexen wrote: > Sure. You can certainly ignore user reports corresponding to > bogus > flags, though, and encourage use of various flags. I could, but decided to improve the situation for some people, but wasn't realising that I made it worse for others. Sorry about that. >>> >>> I'm trying to figure out why your original commit was a problem. I >>> understand why it was questioned, but once the answer came out, >>> it's >>> clear that the code you originally committed does what it's >>> supposed to >>> without any harmful side effects. Sure, freebsd doesn't strictly >>> need >> >> I guess the point Conrad is making, that on FreeBSD the check is not >> needed, since the call can not fail. So the FreeBSD code base would >> not >> be consistent: within the SCTP related code the return code is >> checked, >> in the other code it is not. >>> it, but the code is shared among projects, so what's the harm in >>> the >>> extra check that helps other projects sharing the code? It's >>> certainly >>> a lot less confusion and code clutter than any of the "remedies" >>> that >>> have been discussed. >> >> Yepp, sharing code between platforms makes things harder. Running the >> same >> code in kernel land and userland does not make it simpler. Different >> groups >> have different opinions/styles/... >> >> I'll revert the commit tomorrow and a variadic macros >> SCTP_SNPRINTF(), which >> will map on FreeBSD to snprintf() and on the other platforms will do >> the check. >> >> If the build problem comes up on FreeBSD userland (and I have no idea >> if that >> is the case, since I don't know how Firefox / Chrome are build on >> FreeBSD), >> I leave it up to the port maintainer of the application to deal with >> it. >> >> Best regards >> Michael >>> >>> -- Ian >>> >> >> > > Well it seems to me you're being asked to do a lot of extra work that > has the final result of making the code LESS clear and MORE complex, > because of one person's opinion. I'm actually a bit tempted to Yes, it is one person. But it is one person who thinks the change is bad enough that he needs to speak up. So I think this has to be addressed. > complain about the change, because to me it reduces rather than > improves code quality. Well, we have abstracted from FreeBSD specifics by using macros in other cases as well. Adding another macro will make reading a bit harder and you have to lookup the platform specific implementation of the code to figure out what is going on, but that way, I guess, people will get a result they can live with. Best regards Michael > > -- 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"
Re: svn commit: r361209 - head/sys/netinet
On Mon, 2020-05-18 at 23:01 +0200, Michael Tuexen wrote: > > On 18. May 2020, at 22:48, Ian Lepore wrote: > > > > On Mon, 2020-05-18 at 22:43 +0200, Michael Tuexen wrote: > > > > Sure. You can certainly ignore user reports corresponding to > > > > bogus > > > > flags, though, and encourage use of various flags. > > > > > > I could, but decided to improve the situation for some people, > > > but > > > wasn't realising that I made it worse for others. Sorry about > > > that. > > > > I'm trying to figure out why your original commit was a problem. I > > understand why it was questioned, but once the answer came out, > > it's > > clear that the code you originally committed does what it's > > supposed to > > without any harmful side effects. Sure, freebsd doesn't strictly > > need > > I guess the point Conrad is making, that on FreeBSD the check is not > needed, since the call can not fail. So the FreeBSD code base would > not > be consistent: within the SCTP related code the return code is > checked, > in the other code it is not. > > it, but the code is shared among projects, so what's the harm in > > the > > extra check that helps other projects sharing the code? It's > > certainly > > a lot less confusion and code clutter than any of the "remedies" > > that > > have been discussed. > > Yepp, sharing code between platforms makes things harder. Running the > same > code in kernel land and userland does not make it simpler. Different > groups > have different opinions/styles/... > > I'll revert the commit tomorrow and a variadic macros > SCTP_SNPRINTF(), which > will map on FreeBSD to snprintf() and on the other platforms will do > the check. > > If the build problem comes up on FreeBSD userland (and I have no idea > if that > is the case, since I don't know how Firefox / Chrome are build on > FreeBSD), > I leave it up to the port maintainer of the application to deal with > it. > > Best regards > Michael > > > > -- Ian > > > > Well it seems to me you're being asked to do a lot of extra work that has the final result of making the code LESS clear and MORE complex, because of one person's opinion. I'm actually a bit tempted to complain about the change, because to me it reduces rather than improves code quality. -- 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"
Re: svn commit: r361209 - head/sys/netinet
> On 18. May 2020, at 22:48, Ian Lepore wrote: > > On Mon, 2020-05-18 at 22:43 +0200, Michael Tuexen wrote: >>> Sure. You can certainly ignore user reports corresponding to bogus >>> flags, though, and encourage use of various flags. >> >> I could, but decided to improve the situation for some people, but >> wasn't realising that I made it worse for others. Sorry about that. > > I'm trying to figure out why your original commit was a problem. I > understand why it was questioned, but once the answer came out, it's > clear that the code you originally committed does what it's supposed to > without any harmful side effects. Sure, freebsd doesn't strictly need I guess the point Conrad is making, that on FreeBSD the check is not needed, since the call can not fail. So the FreeBSD code base would not be consistent: within the SCTP related code the return code is checked, in the other code it is not. > it, but the code is shared among projects, so what's the harm in the > extra check that helps other projects sharing the code? It's certainly > a lot less confusion and code clutter than any of the "remedies" that > have been discussed. Yepp, sharing code between platforms makes things harder. Running the same code in kernel land and userland does not make it simpler. Different groups have different opinions/styles/... I'll revert the commit tomorrow and a variadic macros SCTP_SNPRINTF(), which will map on FreeBSD to snprintf() and on the other platforms will do the check. If the build problem comes up on FreeBSD userland (and I have no idea if that is the case, since I don't know how Firefox / Chrome are build on FreeBSD), I leave it up to the port maintainer of the application to deal with it. Best regards Michael > > -- 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"
Re: svn commit: r361209 - head/sys/netinet
On Mon, 2020-05-18 at 22:43 +0200, Michael Tuexen wrote: > > Sure. You can certainly ignore user reports corresponding to bogus > > flags, though, and encourage use of various flags. > > I could, but decided to improve the situation for some people, but > wasn't realising that I made it worse for others. Sorry about that. I'm trying to figure out why your original commit was a problem. I understand why it was questioned, but once the answer came out, it's clear that the code you originally committed does what it's supposed to without any harmful side effects. Sure, freebsd doesn't strictly need it, but the code is shared among projects, so what's the harm in the extra check that helps other projects sharing the code? It's certainly a lot less confusion and code clutter than any of the "remedies" that have been discussed. -- 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"
Re: svn commit: r361209 - head/sys/netinet
> On 18. May 2020, at 22:17, Conrad Meyer wrote: > > Hi Michael, > > On Mon, May 18, 2020 at 12:05 PM Michael Tuexen wrote: >> >>> On 18. May 2020, at 20:23, Conrad Meyer wrote: >> >>> If truncation is intended, the GCC warning is spurious. Given how >>> often snprintf is used in this way, I wonder if it would make sense to >>> just disable it across the entire tree. Regardless, IMO it makes >> >> The issue wasn't reported against the kernel code, but running the code >> in userland. I don't really control the flags people are using. > > Sure. You can certainly ignore user reports corresponding to bogus > flags, though, and encourage use of various flags. I could, but decided to improve the situation for some people, but wasn't realising that I made it worse for others. Sorry about that. > >> OK. I'll revert this change and replace it upstream by something like >> >> #if defined(__FreeBSD_) >>snprintf(msg, sizeof(msg), "Never sent serial number %8.8x", >> serial_num) >> #else >>if (snprintf(msg, sizeof(msg), "Never sent serial number %8.8x", >> serial_num) < 0) { >>msg[0] = '\0'; >>} >> #endif > > This seems like a messy solution. I'd suggest either putting > unconditional "msg[0] = '\0';" before snprintf() invocations, or That would assume that in case of an error the first byte is overwitten. > defining an snprintf wrapper function for non-FreeBSD platforms and > using it universally. Yeah, one can use a Macro SCTP_SNPRINTF(). Let me see... > >> I don't know if other platforms guarantee that snprintf() can't fail. >> If it fails, the stack would send out un-initialized stack memory on >> the network. > > Sure, that's a good concern. That said, > > Glibc: > https://github.com/bminor/glibc/blob/5f72f9800b250410cad3abfeeb09469ef12b2438/libio/vsnprintf.c#L93-L114 > (always nul terminates) > MS: > https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/snprintf-snprintf-snprintf-l-snwprintf-snwprintf-l?view=vs-2019 > ("The snprintf function always stores a terminating null character…") > OpenBSD: > https://github.com/openbsd/src/blob/master/lib/libc/stdio/vsnprintf.c#L60-L63 > (always nul terminates) > NetBSD: > https://github.com/NetBSD/src/blob/trunk/lib/libc/stdio/vsnprintf.c#L97-L101 > (always nul terminates) > Linux (kernel): > https://elixir.bootlin.com/linux/latest/source/lib/vsprintf.c#L2645 > (always nul terminates) > > None of these are conditional on error status. > > The only exception I found is musl libc, and in that it is a case you > cannot encounter here (size > INT_MAX). Arguably this is a bug in > musl libc. I did not dive deeper into musl and determine whether > other errors were nul terminated or not. > > Conrad > > P.S., It seems dubious to be sending diagnostic formatted error > messages out across the network. It was and still is very helpful when debuging interop problems if you only have access to a tracefile and can't change the running code. Like people asking you why is your implementation sending back an ABORT when it sees this packet. Best regards Michael ___ 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: r361209 - head/sys/netinet
Hi Michael, On Mon, May 18, 2020 at 12:05 PM Michael Tuexen wrote: > > > On 18. May 2020, at 20:23, Conrad Meyer wrote: > > > If truncation is intended, the GCC warning is spurious. Given how > > often snprintf is used in this way, I wonder if it would make sense to > > just disable it across the entire tree. Regardless, IMO it makes > > The issue wasn't reported against the kernel code, but running the code > in userland. I don't really control the flags people are using. Sure. You can certainly ignore user reports corresponding to bogus flags, though, and encourage use of various flags. > OK. I'll revert this change and replace it upstream by something like > > #if defined(__FreeBSD_) > snprintf(msg, sizeof(msg), "Never sent serial number %8.8x", > serial_num) > #else > if (snprintf(msg, sizeof(msg), "Never sent serial number %8.8x", > serial_num) < 0) { > msg[0] = '\0'; > } > #endif This seems like a messy solution. I'd suggest either putting unconditional "msg[0] = '\0';" before snprintf() invocations, or defining an snprintf wrapper function for non-FreeBSD platforms and using it universally. > I don't know if other platforms guarantee that snprintf() can't fail. > If it fails, the stack would send out un-initialized stack memory on > the network. Sure, that's a good concern. That said, Glibc: https://github.com/bminor/glibc/blob/5f72f9800b250410cad3abfeeb09469ef12b2438/libio/vsnprintf.c#L93-L114 (always nul terminates) MS: https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/snprintf-snprintf-snprintf-l-snwprintf-snwprintf-l?view=vs-2019 ("The snprintf function always stores a terminating null character…") OpenBSD: https://github.com/openbsd/src/blob/master/lib/libc/stdio/vsnprintf.c#L60-L63 (always nul terminates) NetBSD: https://github.com/NetBSD/src/blob/trunk/lib/libc/stdio/vsnprintf.c#L97-L101 (always nul terminates) Linux (kernel): https://elixir.bootlin.com/linux/latest/source/lib/vsprintf.c#L2645 (always nul terminates) None of these are conditional on error status. The only exception I found is musl libc, and in that it is a case you cannot encounter here (size > INT_MAX). Arguably this is a bug in musl libc. I did not dive deeper into musl and determine whether other errors were nul terminated or not. Conrad P.S., It seems dubious to be sending diagnostic formatted error messages out across the network. ___ 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: r361227 - head/sys/netinet
Author: tuexen Date: Mon May 18 19:48:38 2020 New Revision: 361227 URL: https://svnweb.freebsd.org/changeset/base/361227 Log: Remove assignment without effect. MFC after:3 days Modified: head/sys/netinet/sctp_auth.c Modified: head/sys/netinet/sctp_auth.c == --- head/sys/netinet/sctp_auth.cMon May 18 19:35:46 2020 (r361226) +++ head/sys/netinet/sctp_auth.cMon May 18 19:48:38 2020 (r361227) @@ -658,7 +658,6 @@ sctp_free_hmaclist(sctp_hmaclist_t *list) { if (list != NULL) { SCTP_FREE(list, SCTP_M_AUTH_HL); - list = NULL; } } ___ 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: r361226 - head/sys/netinet
Author: tuexen Date: Mon May 18 19:35:46 2020 New Revision: 361226 URL: https://svnweb.freebsd.org/changeset/base/361226 Log: Don't check an unsigned variable for being negative. MFC after:3 days. Modified: head/sys/netinet/sctp_usrreq.c Modified: head/sys/netinet/sctp_usrreq.c == --- head/sys/netinet/sctp_usrreq.c Mon May 18 19:23:01 2020 (r361225) +++ head/sys/netinet/sctp_usrreq.c Mon May 18 19:35:46 2020 (r361226) @@ -1042,7 +1042,7 @@ sctp_fill_up_addresses_vrf(struct sctp_inpcb *inp, struct sctp_vrf *vrf; actual = 0; - if (limit <= 0) + if (limit == 0) return (actual); if (stcb) { ___ 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: r361225 - head/sys/netinet
Author: tuexen Date: Mon May 18 19:23:01 2020 New Revision: 361225 URL: https://svnweb.freebsd.org/changeset/base/361225 Log: Remove redundant assignment. MFC after:3 days Modified: head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctputil.c == --- head/sys/netinet/sctputil.c Mon May 18 18:42:43 2020(r361224) +++ head/sys/netinet/sctputil.c Mon May 18 19:23:01 2020(r361225) @@ -1144,7 +1144,6 @@ sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb asoc->sctp_cmt_on_off = inp->sctp_cmt_on_off; asoc->ecn_supported = inp->ecn_supported; asoc->prsctp_supported = inp->prsctp_supported; - asoc->idata_supported = inp->idata_supported; asoc->auth_supported = inp->auth_supported; asoc->asconf_supported = inp->asconf_supported; asoc->reconfig_supported = inp->reconfig_supported; ___ 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: r361209 - head/sys/netinet
> On 18. May 2020, at 20:23, Conrad Meyer wrote: > > On Mon, May 18, 2020 at 10:35 AM Michael Tuexen wrote: >> >>> On 18. May 2020, at 17:38, Conrad Meyer wrote: >>> >>> These changes are a bit odd. The only reason a standards-compliant >>> snprintf() would fail to nul-terminate a buffer is if the provided >>> buffer had length zero. Since this is not the case in any of these >>> uses, I wonder why this revision was made? Does a SCTP downstream >> >> when compiling the code in userland with gcc 10, it warns that >> the output might be truncated. That is true and intended. >> So checking that the call doesn't fail silences this warning and >> ensures the code works in case snprintf() returns an error. I don't >> see in the POSIX specification a statement limiting the case where >> it could fail. >> >>> have a broken snprintf implementation, and if so, wouldn't it make >>> more sense to create a standards-compliant portability shim for that >>> platform instead of this more invasive change? >> >> If you want, I can revert the change and use the code only on non-FreeBSD >> platforms. > > Hi Michael, > > If truncation is intended, the GCC warning is spurious. Given how > often snprintf is used in this way, I wonder if it would make sense to > just disable it across the entire tree. Regardless, IMO it makes The issue wasn't reported against the kernel code, but running the code in userland. I don't really control the flags people are using. > sense to disable the warning, rather than make these changes to check > for errors that can't happen. It does not even "fix" the thing GCC is OK. I'll revert this change and replace it upstream by something like #if defined(__FreeBSD_) snprintf(msg, sizeof(msg), "Never sent serial number %8.8x", serial_num) #else if (snprintf(msg, sizeof(msg), "Never sent serial number %8.8x", serial_num) < 0) { msg[0] = '\0'; } #endif I don't know if other platforms guarantee that snprintf() can't fail. If it fails, the stack would send out un-initialized stack memory on the network. > warning about, since we aren't testing for truncation at all; it's > just a warning defeat mechanism. -Wno- is a better warning-defeat > mechanism. > > Re: documentation of snprintf nul-termination, I would look at this > part of the FreeBSD manual page: > > The snprintf() and vsnprintf() functions will write at most size-1 of the > characters printed into the output string (the size'th character then > gets the terminating ‘\0’); if the return value is greater than or equal > to the size argument, the string was too short and some of the printed > characters were discarded. The output is always null-terminated, unless > size is 0. > > Note the last sentence especially. As far as error conditions, those > are canonically documented in the ERRORS section of the manual page > rather than RETURN VALUES. For whatever reason, mdoc(7) standard puts > EXAMPLES between the two sections, and additionally snprintf.3 has a > non-standard COMPATIBILITY section between the two, so they are not > directly adjacent. Here's that section, though: > > ERRORS > In addition to the errors documented for the write(2) system call, the > printf() family of functions may fail if: > > [EILSEQ] An invalid wide character code was encountered. > > [ENOMEM] Insufficient storage space is available. > > [EOVERFLOW]The size argument exceeds INT_MAX + 1, or the return >value would be too large to be represented by an int. > > The section is unfortunately generalized and non-specific; snprintf > probably cannot fail with ENOMEM, for example, nor write(2) errors. > But EOVERFLOW is well-documented. > > Re: POSIX definition, POSIX is not the canonical definition of > snprintf; the C standard is. C (2018) reads: > >> If n is zero, nothing shall be written and s may be a null pointer. >> Otherwise, output bytes beyond the n-1st shall be discarded instead of being >> written to the array, and a null byte is written at the end of the bytes >> actually written into the array. > > Emphasis on the last clause. (POSIX uses the exact same language.) > As far as conditions where snprintf may fail, POSIX only defines a > single case (covered in snprintf.3 above): > >> The snprintf() function shall fail if: [EOVERFLOW], The value of n is >> greater than INT_MAX. > > That is not the case in any of these invocations. Just to be clear: My problem is NOT that the output is not zero terminated. I use snprintf() in a way that it is, if it does not fail. I was just adding protection code for the case it fails and leaves the buffer uninitialized. since I don't want so sent out uninitialized stack memory. I learnt that on FreeBSD this is not a problem and I'll remove that protection code for this platform. Best regards Michael > > Probably snprintf(9) should be specifically
svn commit: r361224 - head/sys/netinet
Author: tuexen Date: Mon May 18 18:42:43 2020 New Revision: 361224 URL: https://svnweb.freebsd.org/changeset/base/361224 Log: Cleanup, no functional change intended. MFC after:3 days Modified: head/sys/netinet/sctp_pcb.c Modified: head/sys/netinet/sctp_pcb.c == --- head/sys/netinet/sctp_pcb.c Mon May 18 18:36:32 2020(r361223) +++ head/sys/netinet/sctp_pcb.c Mon May 18 18:42:43 2020(r361224) @@ -5203,16 +5203,12 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tc SCTP_FREE_SHOULD_USE_GRACEFUL_CLOSE, SCTP_CALLED_DIRECTLY_NOCMPSET); SCTP_INP_DECR_REF(inp); - goto out_of; } else { /* The socket is still open. */ SCTP_INP_DECR_REF(inp); + SCTP_INP_RUNLOCK(inp); } } - if (from_inpcbfree == SCTP_NORMAL_PROC) { - SCTP_INP_RUNLOCK(inp); - } -out_of: /* destroyed the asoc */ #ifdef SCTP_LOG_CLOSING sctp_log_closing(inp, NULL, 11); ___ 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: r361223 - head/tests/sys/fs/fusefs
Author: asomers Date: Mon May 18 18:36:32 2020 New Revision: 361223 URL: https://svnweb.freebsd.org/changeset/base/361223 Log: fusefs: fix intermittency in some ENOENT tests When a FUSE operation other than LOOKUP returns ENOENT, the kernel will reclaim that vnode, resuling in a FUSE_FORGET being sent a short while later. Many of the ENOENT tests weren't expecting those FUSE_FORGET operations. They usually passed by luck since FUSE_FORGET is often delayed. This commit adds appropriate expectations. MFC after:2 weeks Modified: head/tests/sys/fs/fusefs/getattr.cc head/tests/sys/fs/fusefs/open.cc head/tests/sys/fs/fusefs/opendir.cc Modified: head/tests/sys/fs/fusefs/getattr.cc == --- head/tests/sys/fs/fusefs/getattr.cc Mon May 18 18:32:58 2020 (r361222) +++ head/tests/sys/fs/fusefs/getattr.cc Mon May 18 18:36:32 2020 (r361223) @@ -32,6 +32,8 @@ extern "C" { #include + +#include } #include "mockfs.hh" @@ -172,7 +174,10 @@ TEST_F(Getattr, enoent) const char RELPATH[] = "some_file.txt"; struct stat sb; const uint64_t ino = 42; + sem_t sem; + ASSERT_EQ(0, sem_init(, 0, 0)) << strerror(errno); + expect_lookup(RELPATH, ino, S_IFREG | 0644, 0, 1, 0, 0); EXPECT_CALL(*m_mock, process( ResultOf([](auto in) { @@ -181,8 +186,15 @@ TEST_F(Getattr, enoent) }, Eq(true)), _) ).WillOnce(Invoke(ReturnErrno(ENOENT))); + // Since FUSE_GETATTR returns ENOENT, the kernel will reclaim the vnode + // and send a FUSE_FORGET + expect_forget(ino, 1, ); + EXPECT_NE(0, stat(FULLPATH, )); EXPECT_EQ(ENOENT, errno); + + sem_wait(); + sem_destroy(); } TEST_F(Getattr, ok) Modified: head/tests/sys/fs/fusefs/open.cc == --- head/tests/sys/fs/fusefs/open.ccMon May 18 18:32:58 2020 (r361222) +++ head/tests/sys/fs/fusefs/open.ccMon May 18 18:36:32 2020 (r361223) @@ -32,7 +32,9 @@ extern "C" { #include + #include +#include } #include "mockfs.hh" @@ -105,7 +107,10 @@ TEST_F(Open, enoent) const char FULLPATH[] = "mountpoint/some_file.txt"; const char RELPATH[] = "some_file.txt"; uint64_t ino = 42; + sem_t sem; + ASSERT_EQ(0, sem_init(, 0, 0)) << strerror(errno); + expect_lookup(RELPATH, ino, S_IFREG | 0644, 0, 1); EXPECT_CALL(*m_mock, process( ResultOf([=](auto in) { @@ -114,8 +119,15 @@ TEST_F(Open, enoent) }, Eq(true)), _) ).WillOnce(Invoke(ReturnErrno(ENOENT))); + // Since FUSE_OPEN returns ENOENT, the kernel will reclaim the vnode + // and send a FUSE_FORGET + expect_forget(ino, 1, ); + ASSERT_EQ(-1, open(FULLPATH, O_RDONLY)); EXPECT_EQ(ENOENT, errno); + + sem_wait(); + sem_destroy(); } /* Modified: head/tests/sys/fs/fusefs/opendir.cc == --- head/tests/sys/fs/fusefs/opendir.cc Mon May 18 18:32:58 2020 (r361222) +++ head/tests/sys/fs/fusefs/opendir.cc Mon May 18 18:36:32 2020 (r361223) @@ -32,7 +32,9 @@ extern "C" { #include + #include +#include } #include "mockfs.hh" @@ -82,12 +84,21 @@ TEST_F(Opendir, enoent) const char FULLPATH[] = "mountpoint/some_dir"; const char RELPATH[] = "some_dir"; uint64_t ino = 42; + sem_t sem; + ASSERT_EQ(0, sem_init(, 0, 0)) << strerror(errno); + expect_lookup(RELPATH, ino); expect_opendir(ino, O_RDONLY, ReturnErrno(ENOENT)); + // Since FUSE_OPENDIR returns ENOENT, the kernel will reclaim the vnode + // and send a FUSE_FORGET + expect_forget(ino, 1, ); ASSERT_EQ(-1, open(FULLPATH, O_DIRECTORY)); EXPECT_EQ(ENOENT, errno); + + sem_wait(); + sem_destroy(); } /* ___ 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: r361222 - head/sys/netinet
Author: tuexen Date: Mon May 18 18:32:58 2020 New Revision: 361222 URL: https://svnweb.freebsd.org/changeset/base/361222 Log: Avoid an integer underflow. MFC after:3 days Modified: head/sys/netinet/sctp_asconf.c Modified: head/sys/netinet/sctp_asconf.c == --- head/sys/netinet/sctp_asconf.c Mon May 18 18:27:10 2020 (r361221) +++ head/sys/netinet/sctp_asconf.c Mon May 18 18:32:58 2020 (r361222) @@ -1797,9 +1797,9 @@ sctp_handle_asconf_ack(struct mbuf *m, int offset, } /* switch */ /* update remaining ASCONF-ACK message length to process */ - ack_length -= SCTP_SIZE32(param_length); - if (ack_length <= 0) { - /* no more data in the mbuf chain */ + if (ack_length > SCTP_SIZE32(param_length)) { + ack_length -= SCTP_SIZE32(param_length); + } else { break; } offset += SCTP_SIZE32(param_length); ___ 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: r361221 - head/sys/netinet
Author: tuexen Date: Mon May 18 18:27:10 2020 New Revision: 361221 URL: https://svnweb.freebsd.org/changeset/base/361221 Log: Remove redundant check. MFC after:3 days Modified: head/sys/netinet/sctp_asconf.c Modified: head/sys/netinet/sctp_asconf.c == --- head/sys/netinet/sctp_asconf.c Mon May 18 16:47:44 2020 (r361220) +++ head/sys/netinet/sctp_asconf.c Mon May 18 18:27:10 2020 (r361221) @@ -3026,10 +3026,6 @@ sctp_check_address_list_ep(struct sctp_tcb *stcb, stru "check_addr_list_ep: laddr->ifa is NULL"); continue; } - if (laddr->ifa == NULL) { - SCTPDBG(SCTP_DEBUG_ASCONF1, "check_addr_list_ep: laddr->ifa->ifa_addr is NULL"); - continue; - } /* do i have it implicitly? */ if (sctp_cmpaddr(>ifa->address.sa, init_addr)) { continue; ___ 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: r361209 - head/sys/netinet
On Mon, May 18, 2020 at 10:35 AM Michael Tuexen wrote: > > > On 18. May 2020, at 17:38, Conrad Meyer wrote: > > > > These changes are a bit odd. The only reason a standards-compliant > > snprintf() would fail to nul-terminate a buffer is if the provided > > buffer had length zero. Since this is not the case in any of these > > uses, I wonder why this revision was made? Does a SCTP downstream > > when compiling the code in userland with gcc 10, it warns that > the output might be truncated. That is true and intended. > So checking that the call doesn't fail silences this warning and > ensures the code works in case snprintf() returns an error. I don't > see in the POSIX specification a statement limiting the case where > it could fail. > > > have a broken snprintf implementation, and if so, wouldn't it make > > more sense to create a standards-compliant portability shim for that > > platform instead of this more invasive change? > > If you want, I can revert the change and use the code only on non-FreeBSD > platforms. Hi Michael, If truncation is intended, the GCC warning is spurious. Given how often snprintf is used in this way, I wonder if it would make sense to just disable it across the entire tree. Regardless, IMO it makes sense to disable the warning, rather than make these changes to check for errors that can't happen. It does not even "fix" the thing GCC is warning about, since we aren't testing for truncation at all; it's just a warning defeat mechanism. -Wno- is a better warning-defeat mechanism. Re: documentation of snprintf nul-termination, I would look at this part of the FreeBSD manual page: The snprintf() and vsnprintf() functions will write at most size-1 of the characters printed into the output string (the size'th character then gets the terminating ‘\0’); if the return value is greater than or equal to the size argument, the string was too short and some of the printed characters were discarded. The output is always null-terminated, unless size is 0. Note the last sentence especially. As far as error conditions, those are canonically documented in the ERRORS section of the manual page rather than RETURN VALUES. For whatever reason, mdoc(7) standard puts EXAMPLES between the two sections, and additionally snprintf.3 has a non-standard COMPATIBILITY section between the two, so they are not directly adjacent. Here's that section, though: ERRORS In addition to the errors documented for the write(2) system call, the printf() family of functions may fail if: [EILSEQ] An invalid wide character code was encountered. [ENOMEM] Insufficient storage space is available. [EOVERFLOW]The size argument exceeds INT_MAX + 1, or the return value would be too large to be represented by an int. The section is unfortunately generalized and non-specific; snprintf probably cannot fail with ENOMEM, for example, nor write(2) errors. But EOVERFLOW is well-documented. Re: POSIX definition, POSIX is not the canonical definition of snprintf; the C standard is. C (2018) reads: > If n is zero, nothing shall be written and s may be a null pointer. > Otherwise, output bytes beyond the n-1st shall be discarded instead of being > written to the array, and a null byte is written at the end of the bytes > actually written into the array. Emphasis on the last clause. (POSIX uses the exact same language.) As far as conditions where snprintf may fail, POSIX only defines a single case (covered in snprintf.3 above): > The snprintf() function shall fail if: [EOVERFLOW], The value of n is greater > than INT_MAX. That is not the case in any of these invocations. Probably snprintf(9) should be specifically documented; printf(9) does not cover it yet. This is a documentation gap. Additionally, the COMPATIBILITY section of snprintf.3 should probably be moved to STANDARDS (to help move ERRORS and RETURN VALUES closer together). Finally, it might be nice to have kernel snprintf(9) _Static_assert that the provided length is shorter than INT_MAX (when it is a compiler constant, and detect non-constant cases at runtime). Currently, snprintf(9) fails to detect buffers that would produce a result which overflows. Best regards, Conrad ___ 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: r361209 - head/sys/netinet
> On 18. May 2020, at 17:48, Conrad Meyer wrote: > > (In fact, I don't believe snprintf(9) can return a negative value at > all. And snprintf(3) will only do so in some special circumstances > for features snprintf(9) does not support: buffer size or formatted > result longer than INT_MAX; invalid *nn$ field width or precision > specifiers. I don't think either case applies to these strings, > although I did not read all of them thoroughly.) I have no problem to revert this change for FreeBSD if it is there impossible (and hopefully gcc 10 knows about this in case someone builds the userland stack with gcc 10 on FreeBSD). In the posix specification I don't see this. For FreeBSD, it would be great to update the man page, which currently states RETURN VALUES These functions return the number of characters printed (not including the trailing `\0' used to end output to strings), except for snprintf() and vsnprintf(), which return the number of characters that would have been printed if the size were unlimited (again, not including the final `\0'). These functions return a negative value if an error occurs. So it would be great to be specific about when an error occurs in the last sentence. Best regards Michael > > On Mon, May 18, 2020 at 8:38 AM Conrad Meyer wrote: >> >> Hi Michael, >> >> These changes are a bit odd. The only reason a standards-compliant >> snprintf() would fail to nul-terminate a buffer is if the provided >> buffer had length zero. Since this is not the case in any of these >> uses, I wonder why this revision was made? Does a SCTP downstream >> have a broken snprintf implementation, and if so, wouldn't it make >> more sense to create a standards-compliant portability shim for that >> platform instead of this more invasive change? >> >> FreeBSD's snprintf(9) does not have this bug, nor does its snprintf(3). >> >> Best regards, >> Conrad >> >> On Mon, May 18, 2020 at 3:07 AM Michael Tuexen wrote: >>> >>> Author: tuexen >>> Date: Mon May 18 10:07:01 2020 >>> New Revision: 361209 >>> URL: https://svnweb.freebsd.org/changeset/base/361209 >>> >>> Log: >>> Handle failures of snprintf(). >>> >>> MFC after:3 days >>> >>> Modified: >>> head/sys/netinet/sctp_asconf.c >>> head/sys/netinet/sctp_indata.c >>> head/sys/netinet/sctp_input.c >>> head/sys/netinet/sctp_output.c >>> head/sys/netinet/sctp_pcb.c >>> >>> Modified: head/sys/netinet/sctp_asconf.c >>> == >>> --- head/sys/netinet/sctp_asconf.c Mon May 18 09:46:51 2020 >>> (r361208) >>> +++ head/sys/netinet/sctp_asconf.c Mon May 18 10:07:01 2020 >>> (r361209) >>> @@ -1706,8 +1706,9 @@ sctp_handle_asconf_ack(struct mbuf *m, int offset, >>>char msg[SCTP_DIAG_INFO_LEN]; >>> >>>SCTPDBG(SCTP_DEBUG_ASCONF1, "handle_asconf_ack: got >>> unexpected next serial number! Aborting asoc!\n"); >>> - snprintf(msg, sizeof(msg), "Never sent serial number %8.8x", >>> - serial_num); >>> + if (snprintf(msg, sizeof(msg), "Never sent serial number >>> %8.8x", serial_num) < 0) { >>> + msg[0] = '\0'; >>> + } >>>op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, >>> msg); >>>sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, >>> SCTP_SO_NOT_LOCKED); >>>*abort_no_unlock = 1; >>> >>> Modified: head/sys/netinet/sctp_indata.c >>> == >>> --- head/sys/netinet/sctp_indata.c Mon May 18 09:46:51 2020 >>> (r361208) >>> +++ head/sys/netinet/sctp_indata.c Mon May 18 10:07:01 2020 >>> (r361209) >>> @@ -434,22 +434,26 @@ sctp_abort_in_reasm(struct sctp_tcb *stcb, >>>struct mbuf *oper; >>> >>>if (stcb->asoc.idata_supported) { >>> - snprintf(msg, sizeof(msg), >>> + if (snprintf(msg, sizeof(msg), >>>"Reass %x,CF:%x,TSN=%8.8x,SID=%4.4x,FSN=%8.8x,MID:%8.8x", >>>opspot, >>>control->fsn_included, >>>chk->rec.data.tsn, >>>chk->rec.data.sid, >>> - chk->rec.data.fsn, chk->rec.data.mid); >>> + chk->rec.data.fsn, chk->rec.data.mid) < 0) { >>> + msg[0] = '\0'; >>> + } >>>} else { >>> - snprintf(msg, sizeof(msg), >>> + if (snprintf(msg, sizeof(msg), >>>"Reass %x,CI:%x,TSN=%8.8x,SID=%4.4x,FSN=%4.4x,SSN:%4.4x", >>>opspot, >>>control->fsn_included, >>>chk->rec.data.tsn, >>>chk->rec.data.sid, >>>chk->rec.data.fsn, >>> - (uint16_t)chk->rec.data.mid); >>> +
Re: svn commit: r361209 - head/sys/netinet
> On 18. May 2020, at 17:38, Conrad Meyer wrote: > > Hi Michael, > > These changes are a bit odd. The only reason a standards-compliant > snprintf() would fail to nul-terminate a buffer is if the provided > buffer had length zero. Since this is not the case in any of these > uses, I wonder why this revision was made? Does a SCTP downstream Hi Conrad, when compiling the code in userland with gcc 10, it warns that the output might be truncated. That is true and intended. So checking that the call doesn't fail silences this warning and ensures the code works in case snprintf() returns an error. I don't see in the POSIX specification a statement limiting the case where it could fail. > have a broken snprintf implementation, and if so, wouldn't it make > more sense to create a standards-compliant portability shim for that > platform instead of this more invasive change? If you want, I can revert the change and use the code only on non-FreeBSD platforms. Best regards Michael > > FreeBSD's snprintf(9) does not have this bug, nor does its snprintf(3). > > Best regards, > Conrad > > On Mon, May 18, 2020 at 3:07 AM Michael Tuexen wrote: >> >> Author: tuexen >> Date: Mon May 18 10:07:01 2020 >> New Revision: 361209 >> URL: https://svnweb.freebsd.org/changeset/base/361209 >> >> Log: >> Handle failures of snprintf(). >> >> MFC after:3 days >> >> Modified: >> head/sys/netinet/sctp_asconf.c >> head/sys/netinet/sctp_indata.c >> head/sys/netinet/sctp_input.c >> head/sys/netinet/sctp_output.c >> head/sys/netinet/sctp_pcb.c >> >> Modified: head/sys/netinet/sctp_asconf.c >> == >> --- head/sys/netinet/sctp_asconf.c Mon May 18 09:46:51 2020 >> (r361208) >> +++ head/sys/netinet/sctp_asconf.c Mon May 18 10:07:01 2020 >> (r361209) >> @@ -1706,8 +1706,9 @@ sctp_handle_asconf_ack(struct mbuf *m, int offset, >>char msg[SCTP_DIAG_INFO_LEN]; >> >>SCTPDBG(SCTP_DEBUG_ASCONF1, "handle_asconf_ack: got >> unexpected next serial number! Aborting asoc!\n"); >> - snprintf(msg, sizeof(msg), "Never sent serial number %8.8x", >> - serial_num); >> + if (snprintf(msg, sizeof(msg), "Never sent serial number >> %8.8x", serial_num) < 0) { >> + msg[0] = '\0'; >> + } >>op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, >> msg); >>sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, >> SCTP_SO_NOT_LOCKED); >>*abort_no_unlock = 1; >> >> Modified: head/sys/netinet/sctp_indata.c >> == >> --- head/sys/netinet/sctp_indata.c Mon May 18 09:46:51 2020 >> (r361208) >> +++ head/sys/netinet/sctp_indata.c Mon May 18 10:07:01 2020 >> (r361209) >> @@ -434,22 +434,26 @@ sctp_abort_in_reasm(struct sctp_tcb *stcb, >>struct mbuf *oper; >> >>if (stcb->asoc.idata_supported) { >> - snprintf(msg, sizeof(msg), >> + if (snprintf(msg, sizeof(msg), >>"Reass %x,CF:%x,TSN=%8.8x,SID=%4.4x,FSN=%8.8x,MID:%8.8x", >>opspot, >>control->fsn_included, >>chk->rec.data.tsn, >>chk->rec.data.sid, >> - chk->rec.data.fsn, chk->rec.data.mid); >> + chk->rec.data.fsn, chk->rec.data.mid) < 0) { >> + msg[0] = '\0'; >> + } >>} else { >> - snprintf(msg, sizeof(msg), >> + if (snprintf(msg, sizeof(msg), >>"Reass %x,CI:%x,TSN=%8.8x,SID=%4.4x,FSN=%4.4x,SSN:%4.4x", >>opspot, >>control->fsn_included, >>chk->rec.data.tsn, >>chk->rec.data.sid, >>chk->rec.data.fsn, >> - (uint16_t)chk->rec.data.mid); >> + (uint16_t)chk->rec.data.mid) < 0) { >> + msg[0] = '\0'; >> + } >>} >>oper = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); >>sctp_m_freem(chk->data); >> @@ -533,15 +537,19 @@ sctp_queue_data_to_stream(struct sctp_tcb *stcb, >> */ >>TAILQ_INSERT_HEAD(>inqueue, control, next_instrm); >>if (asoc->idata_supported) { >> - snprintf(msg, sizeof(msg), "Delivered MID=%8.8x, got >> TSN=%8.8x, SID=%4.4x, MID=%8.8x", >> + if (snprintf(msg, sizeof(msg), "Delivered MID=%8.8x, >> got TSN=%8.8x, SID=%4.4x, MID=%8.8x", >>strm->last_mid_delivered, control->sinfo_tsn, >> - control->sinfo_stream, control->mid); >> + control->sinfo_stream, control->mid) < 0) { >> +
svn commit: r361220 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: jhb Date: Mon May 18 16:47:44 2020 New Revision: 361220 URL: https://svnweb.freebsd.org/changeset/base/361220 Log: Correct the order of arguments to copyin() for Q_SETQUOTA. MFC after:2 weeks Sponsored by: DARPA Differential Revision:https://reviews.freebsd.org/D24656 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.cMon May 18 16:33:32 2020(r361219) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.cMon May 18 16:47:44 2020(r361220) @@ -267,7 +267,7 @@ zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *ar vfs_unbusy(vfsp); break; case Q_SETQUOTA: - error = copyin(, arg, sizeof(dqblk)); + error = copyin(arg, , sizeof(dqblk)); if (error == 0) error = zfs_set_userquota(zfsvfs, quota_type, "", id, dbtob(dqblk.dqb_bhardlimit)); ___ 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: r361218 - head/contrib/binutils/gas
Author: emaste Date: Mon May 18 16:07:14 2020 New Revision: 361218 URL: https://svnweb.freebsd.org/changeset/base/361218 Log: GNU as: move deprecation message after option parsing Some cmake test parses the output of the first line of as --version, and emits an error if it does not contain some expected strings: Checking whether the ASM compiler is GNU using "--version" did not match "(GNU assembler)|(GCC)|(Free Software Foundation)" Emit the deprecation message later, after parsing argv and thus --version. PR: 246540 Reported by: dch Sponsored by: The FreeBSD Foundation Modified: head/contrib/binutils/gas/as.c Modified: head/contrib/binutils/gas/as.c == --- head/contrib/binutils/gas/as.c Mon May 18 15:59:17 2020 (r361217) +++ head/contrib/binutils/gas/as.c Mon May 18 16:07:14 2020 (r361218) @@ -1089,7 +1089,6 @@ main (int argc, char ** argv) expandargv (, ); START_PROGRESS (myname, 0); - fprintf (stderr, _("warning: as 2.17.50 is deprecated in FreeBSD and will be removed\n")); #ifndef OBJ_DEFAULT_OUTPUT_FILE_NAME #define OBJ_DEFAULT_OUTPUT_FILE_NAME "a.out" @@ -1109,6 +1108,7 @@ main (int argc, char ** argv) /* Call parse_args before any of the init/begin functions so that switches like --hash-size can be honored. */ parse_args (, ); + fprintf (stderr, _("warning: GNU as %s is deprecated and will be removed\n"), BFD_VERSION_STRING); symbol_begin (); frag_init (); subsegs_begin (); ___ 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: r361209 - head/sys/netinet
(In fact, I don't believe snprintf(9) can return a negative value at all. And snprintf(3) will only do so in some special circumstances for features snprintf(9) does not support: buffer size or formatted result longer than INT_MAX; invalid *nn$ field width or precision specifiers. I don't think either case applies to these strings, although I did not read all of them thoroughly.) On Mon, May 18, 2020 at 8:38 AM Conrad Meyer wrote: > > Hi Michael, > > These changes are a bit odd. The only reason a standards-compliant > snprintf() would fail to nul-terminate a buffer is if the provided > buffer had length zero. Since this is not the case in any of these > uses, I wonder why this revision was made? Does a SCTP downstream > have a broken snprintf implementation, and if so, wouldn't it make > more sense to create a standards-compliant portability shim for that > platform instead of this more invasive change? > > FreeBSD's snprintf(9) does not have this bug, nor does its snprintf(3). > > Best regards, > Conrad > > On Mon, May 18, 2020 at 3:07 AM Michael Tuexen wrote: > > > > Author: tuexen > > Date: Mon May 18 10:07:01 2020 > > New Revision: 361209 > > URL: https://svnweb.freebsd.org/changeset/base/361209 > > > > Log: > > Handle failures of snprintf(). > > > > MFC after:3 days > > > > Modified: > > head/sys/netinet/sctp_asconf.c > > head/sys/netinet/sctp_indata.c > > head/sys/netinet/sctp_input.c > > head/sys/netinet/sctp_output.c > > head/sys/netinet/sctp_pcb.c > > > > Modified: head/sys/netinet/sctp_asconf.c > > == > > --- head/sys/netinet/sctp_asconf.c Mon May 18 09:46:51 2020 > > (r361208) > > +++ head/sys/netinet/sctp_asconf.c Mon May 18 10:07:01 2020 > > (r361209) > > @@ -1706,8 +1706,9 @@ sctp_handle_asconf_ack(struct mbuf *m, int offset, > > char msg[SCTP_DIAG_INFO_LEN]; > > > > SCTPDBG(SCTP_DEBUG_ASCONF1, "handle_asconf_ack: got > > unexpected next serial number! Aborting asoc!\n"); > > - snprintf(msg, sizeof(msg), "Never sent serial number %8.8x", > > - serial_num); > > + if (snprintf(msg, sizeof(msg), "Never sent serial number > > %8.8x", serial_num) < 0) { > > + msg[0] = '\0'; > > + } > > op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, > > msg); > > sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, > > SCTP_SO_NOT_LOCKED); > > *abort_no_unlock = 1; > > > > Modified: head/sys/netinet/sctp_indata.c > > == > > --- head/sys/netinet/sctp_indata.c Mon May 18 09:46:51 2020 > > (r361208) > > +++ head/sys/netinet/sctp_indata.c Mon May 18 10:07:01 2020 > > (r361209) > > @@ -434,22 +434,26 @@ sctp_abort_in_reasm(struct sctp_tcb *stcb, > > struct mbuf *oper; > > > > if (stcb->asoc.idata_supported) { > > - snprintf(msg, sizeof(msg), > > + if (snprintf(msg, sizeof(msg), > > "Reass > > %x,CF:%x,TSN=%8.8x,SID=%4.4x,FSN=%8.8x,MID:%8.8x", > > opspot, > > control->fsn_included, > > chk->rec.data.tsn, > > chk->rec.data.sid, > > - chk->rec.data.fsn, chk->rec.data.mid); > > + chk->rec.data.fsn, chk->rec.data.mid) < 0) { > > + msg[0] = '\0'; > > + } > > } else { > > - snprintf(msg, sizeof(msg), > > + if (snprintf(msg, sizeof(msg), > > "Reass > > %x,CI:%x,TSN=%8.8x,SID=%4.4x,FSN=%4.4x,SSN:%4.4x", > > opspot, > > control->fsn_included, > > chk->rec.data.tsn, > > chk->rec.data.sid, > > chk->rec.data.fsn, > > - (uint16_t)chk->rec.data.mid); > > + (uint16_t)chk->rec.data.mid) < 0) { > > + msg[0] = '\0'; > > + } > > } > > oper = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); > > sctp_m_freem(chk->data); > > @@ -533,15 +537,19 @@ sctp_queue_data_to_stream(struct sctp_tcb *stcb, > > */ > > TAILQ_INSERT_HEAD(>inqueue, control, next_instrm); > > if (asoc->idata_supported) { > > - snprintf(msg, sizeof(msg), "Delivered MID=%8.8x, > > got TSN=%8.8x, SID=%4.4x, MID=%8.8x", > > + if (snprintf(msg, sizeof(msg), "Delivered > > MID=%8.8x, got TSN=%8.8x, SID=%4.4x, MID=%8.8x", > > strm->last_mid_delivered, control->sinfo_tsn, > > - control->sinfo_stream, control->mid); > > +
Re: svn commit: r361209 - head/sys/netinet
Hi Michael, These changes are a bit odd. The only reason a standards-compliant snprintf() would fail to nul-terminate a buffer is if the provided buffer had length zero. Since this is not the case in any of these uses, I wonder why this revision was made? Does a SCTP downstream have a broken snprintf implementation, and if so, wouldn't it make more sense to create a standards-compliant portability shim for that platform instead of this more invasive change? FreeBSD's snprintf(9) does not have this bug, nor does its snprintf(3). Best regards, Conrad On Mon, May 18, 2020 at 3:07 AM Michael Tuexen wrote: > > Author: tuexen > Date: Mon May 18 10:07:01 2020 > New Revision: 361209 > URL: https://svnweb.freebsd.org/changeset/base/361209 > > Log: > Handle failures of snprintf(). > > MFC after:3 days > > Modified: > head/sys/netinet/sctp_asconf.c > head/sys/netinet/sctp_indata.c > head/sys/netinet/sctp_input.c > head/sys/netinet/sctp_output.c > head/sys/netinet/sctp_pcb.c > > Modified: head/sys/netinet/sctp_asconf.c > == > --- head/sys/netinet/sctp_asconf.c Mon May 18 09:46:51 2020 > (r361208) > +++ head/sys/netinet/sctp_asconf.c Mon May 18 10:07:01 2020 > (r361209) > @@ -1706,8 +1706,9 @@ sctp_handle_asconf_ack(struct mbuf *m, int offset, > char msg[SCTP_DIAG_INFO_LEN]; > > SCTPDBG(SCTP_DEBUG_ASCONF1, "handle_asconf_ack: got > unexpected next serial number! Aborting asoc!\n"); > - snprintf(msg, sizeof(msg), "Never sent serial number %8.8x", > - serial_num); > + if (snprintf(msg, sizeof(msg), "Never sent serial number > %8.8x", serial_num) < 0) { > + msg[0] = '\0'; > + } > op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, > msg); > sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, > SCTP_SO_NOT_LOCKED); > *abort_no_unlock = 1; > > Modified: head/sys/netinet/sctp_indata.c > == > --- head/sys/netinet/sctp_indata.c Mon May 18 09:46:51 2020 > (r361208) > +++ head/sys/netinet/sctp_indata.c Mon May 18 10:07:01 2020 > (r361209) > @@ -434,22 +434,26 @@ sctp_abort_in_reasm(struct sctp_tcb *stcb, > struct mbuf *oper; > > if (stcb->asoc.idata_supported) { > - snprintf(msg, sizeof(msg), > + if (snprintf(msg, sizeof(msg), > "Reass %x,CF:%x,TSN=%8.8x,SID=%4.4x,FSN=%8.8x,MID:%8.8x", > opspot, > control->fsn_included, > chk->rec.data.tsn, > chk->rec.data.sid, > - chk->rec.data.fsn, chk->rec.data.mid); > + chk->rec.data.fsn, chk->rec.data.mid) < 0) { > + msg[0] = '\0'; > + } > } else { > - snprintf(msg, sizeof(msg), > + if (snprintf(msg, sizeof(msg), > "Reass %x,CI:%x,TSN=%8.8x,SID=%4.4x,FSN=%4.4x,SSN:%4.4x", > opspot, > control->fsn_included, > chk->rec.data.tsn, > chk->rec.data.sid, > chk->rec.data.fsn, > - (uint16_t)chk->rec.data.mid); > + (uint16_t)chk->rec.data.mid) < 0) { > + msg[0] = '\0'; > + } > } > oper = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); > sctp_m_freem(chk->data); > @@ -533,15 +537,19 @@ sctp_queue_data_to_stream(struct sctp_tcb *stcb, > */ > TAILQ_INSERT_HEAD(>inqueue, control, next_instrm); > if (asoc->idata_supported) { > - snprintf(msg, sizeof(msg), "Delivered MID=%8.8x, got > TSN=%8.8x, SID=%4.4x, MID=%8.8x", > + if (snprintf(msg, sizeof(msg), "Delivered MID=%8.8x, > got TSN=%8.8x, SID=%4.4x, MID=%8.8x", > strm->last_mid_delivered, control->sinfo_tsn, > - control->sinfo_stream, control->mid); > + control->sinfo_stream, control->mid) < 0) { > + msg[0] = '\0'; > + } > } else { > - snprintf(msg, sizeof(msg), "Delivered SSN=%4.4x, got > TSN=%8.8x, SID=%4.4x, SSN=%4.4x", > + if (snprintf(msg, sizeof(msg), "Delivered SSN=%4.4x, > got TSN=%8.8x, SID=%4.4x, SSN=%4.4x", > (uint16_t)strm->last_mid_delivered, > control->sinfo_tsn, > control->sinfo_stream, > - (uint16_t)control->mid); > + (uint16_t)control->mid) < 0)
svn commit: r361216 - head/usr.sbin/acpi/acpidump
Author: andrew Date: Mon May 18 15:05:59 2020 New Revision: 361216 URL: https://svnweb.freebsd.org/changeset/base/361216 Log: Allow the FACS and XFACS to be zero in acpidump. These are allowed to be zero when the hardware reduced APCI flag is set Sponsored by: Innovate UK Differential Revision:https://reviews.freebsd.org/D23207 Modified: head/usr.sbin/acpi/acpidump/acpi.c Modified: head/usr.sbin/acpi/acpidump/acpi.c == --- head/usr.sbin/acpi/acpidump/acpi.c Mon May 18 15:03:52 2020 (r361215) +++ head/usr.sbin/acpi/acpidump/acpi.c Mon May 18 15:05:59 2020 (r361216) @@ -245,6 +245,7 @@ acpi_handle_fadt(ACPI_TABLE_HEADER *sdp) ACPI_TABLE_HEADER *dsdp; ACPI_TABLE_FACS *facs; ACPI_TABLE_FADT *fadt; + vm_offset_t addr; int fadt_revision; fadt = (ACPI_TABLE_FADT *)sdp; @@ -252,12 +253,17 @@ acpi_handle_fadt(ACPI_TABLE_HEADER *sdp) fadt_revision = acpi_get_fadt_revision(fadt); if (fadt_revision == 1) - facs = (ACPI_TABLE_FACS *)acpi_map_sdt(fadt->Facs); + addr = fadt->Facs; else - facs = (ACPI_TABLE_FACS *)acpi_map_sdt(fadt->XFacs); - if (memcmp(facs->Signature, ACPI_SIG_FACS, 4) != 0 || facs->Length < 64) - errx(1, "FACS is corrupt"); - acpi_print_facs(facs); + addr = fadt->XFacs; + if (addr != 0) { + facs = (ACPI_TABLE_FACS *)acpi_map_sdt(addr); + + if (memcmp(facs->Signature, ACPI_SIG_FACS, 4) != 0 || + facs->Length < 64) + errx(1, "FACS is corrupt"); + acpi_print_facs(facs); + } if (fadt_revision == 1) dsdp = (ACPI_TABLE_HEADER *)acpi_map_sdt(fadt->Dsdt); ___ 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: r361215 - head/usr.sbin/bhyve
Author: afedorov Date: Mon May 18 15:03:52 2020 New Revision: 361215 URL: https://svnweb.freebsd.org/changeset/base/361215 Log: bhyve(8): Add the netgraph network backend decription to the manpage. Reviewed by: vmaffione, bcr Approved by: vmaffione (mentor) Sponsored by: vstack.com Differential Revision:https://reviews.freebsd.org/D24846 Modified: head/usr.sbin/bhyve/bhyve.8 Modified: head/usr.sbin/bhyve/bhyve.8 == --- head/usr.sbin/bhyve/bhyve.8 Mon May 18 15:02:15 2020(r361214) +++ head/usr.sbin/bhyve/bhyve.8 Mon May 18 15:03:52 2020(r361215) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 5, 2020 +.Dd May 18, 2020 .Dt BHYVE 8 .Os .Sh NAME @@ -291,10 +291,11 @@ If is not specified, the device emulation has no backend and can be considered unconnected. .Pp -Network devices: +Network backends: .Bl -tag -width 10n .It Ar tapN Ns Oo , Ns Ar mac=xx:xx:xx:xx:xx:xx Oc Ns Oo , Ns Ar mtu=N Oc .It Ar vmnetN Ns Oo , Ns Ar mac=xx:xx:xx:xx:xx:xx Oc Ns Oo , Ns Ar mtu=N Oc +.It Ar netgraph,path=ADDRESS,peerhook=HOOK Ns Oo , Ns Ar socket=NAME Oc Ns Oo , Ns Ar hook=HOOK Oc Ns Oo , Ns Ar mac=xx:xx:xx:xx:xx:xx Oc Ns Oo , Ns Ar mtu=N Oc .Pp If .Ar mac @@ -310,6 +311,27 @@ With virtio-net devices, the .Ar mtu parameter can be specified to inform the guest about the largest MTU that should be allowed, expressed in bytes. +.Pp +With netgraph backend, the +.Ar path +and +.Ar peerhook +parameters must be specified to set the destination node and corresponding hook. +The optional parameters +.Ar socket +and +.Ar hook +may be used to set the +.Xr ng_socket 4 +node name and source hook. +The +.Ar ADDRESS , +.Ar HOOK +and +.Ar NAME +must comply with +.Xr netgraph 4 +addressing rules. .El .Pp Block storage devices: @@ -670,6 +692,8 @@ bhyve -c 2 -m 4G -w -H \\ .Ed .Sh SEE ALSO .Xr bhyve 4 , +.Xr netgraph 4 , +.Xr ng_socket 4 , .Xr nmdm 4 , .Xr vmm 4 , .Xr ethers 5 , ___ 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: r361214 - head/sys/netinet
Author: tuexen Date: Mon May 18 15:02:15 2020 New Revision: 361214 URL: https://svnweb.freebsd.org/changeset/base/361214 Log: Fix logical condition by looking at usecs. This issue was found by cpp-check running on the userland stack. MFC after:3 days Modified: head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctputil.c == --- head/sys/netinet/sctputil.c Mon May 18 15:00:18 2020(r361213) +++ head/sys/netinet/sctputil.c Mon May 18 15:02:15 2020(r361214) @@ -2933,7 +2933,7 @@ sctp_calculate_rto(struct sctp_tcb *stcb, (void)SCTP_GETTIME_TIMEVAL(); } if ((old->tv_sec > now.tv_sec) || - ((old->tv_sec == now.tv_sec) && (old->tv_sec > now.tv_sec))) { + ((old->tv_sec == now.tv_sec) && (old->tv_usec > now.tv_usec))) { /* The starting point is in the future. */ 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: r361213 - head/sys/netinet
Author: tuexen Date: Mon May 18 15:00:18 2020 New Revision: 361213 URL: https://svnweb.freebsd.org/changeset/base/361213 Log: Whitespace change. MFC after:3 days Modified: head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctputil.c == --- head/sys/netinet/sctputil.c Mon May 18 14:38:27 2020(r361212) +++ head/sys/netinet/sctputil.c Mon May 18 15:00:18 2020(r361213) @@ -1560,8 +1560,8 @@ select_a_new_ep: iteration_count = 0; } KASSERT(it->inp == it->stcb->sctp_ep, - ("%s: stcb %p does not belong to inp %p, but inp %p", -__func__, it->stcb, it->inp, it->stcb->sctp_ep)); + ("%s: stcb %p does not belong to inp %p, but inp %p", + __func__, it->stcb, it->inp, it->stcb->sctp_ep)); /* run function on this one */ (*it->function_assoc) (it->inp, it->stcb, it->pointer, it->val); ___ 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: r361210 - head/contrib/netbsd-tests/lib/libexecinfo
Author: lwhsu Date: Mon May 18 12:36:28 2020 New Revision: 361210 URL: https://svnweb.freebsd.org/changeset/base/361210 Log: Temporarily disable failing case in CI of amd64: - lib.libexecinfo.backtrace_test.backtrace_fmt_basic PR: 246537 Sponsored by: The FreeBSD Foundation Modified: head/contrib/netbsd-tests/lib/libexecinfo/t_backtrace.c Modified: head/contrib/netbsd-tests/lib/libexecinfo/t_backtrace.c == --- head/contrib/netbsd-tests/lib/libexecinfo/t_backtrace.c Mon May 18 10:07:01 2020(r361209) +++ head/contrib/netbsd-tests/lib/libexecinfo/t_backtrace.c Mon May 18 12:36:28 2020(r361210) @@ -151,6 +151,11 @@ ATF_TC_HEAD(backtrace_fmt_basic, tc) ATF_TC_BODY(backtrace_fmt_basic, tc) { +#if defined(__amd64__) + if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) + atf_tc_skip("https://bugs.freebsd.org/246537;); +#endif + myfunc(12); if (prevent_inline) ___ 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: r361209 - head/sys/netinet
Author: tuexen Date: Mon May 18 10:07:01 2020 New Revision: 361209 URL: https://svnweb.freebsd.org/changeset/base/361209 Log: Handle failures of snprintf(). MFC after:3 days Modified: head/sys/netinet/sctp_asconf.c head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_input.c head/sys/netinet/sctp_output.c head/sys/netinet/sctp_pcb.c Modified: head/sys/netinet/sctp_asconf.c == --- head/sys/netinet/sctp_asconf.c Mon May 18 09:46:51 2020 (r361208) +++ head/sys/netinet/sctp_asconf.c Mon May 18 10:07:01 2020 (r361209) @@ -1706,8 +1706,9 @@ sctp_handle_asconf_ack(struct mbuf *m, int offset, char msg[SCTP_DIAG_INFO_LEN]; SCTPDBG(SCTP_DEBUG_ASCONF1, "handle_asconf_ack: got unexpected next serial number! Aborting asoc!\n"); - snprintf(msg, sizeof(msg), "Never sent serial number %8.8x", - serial_num); + if (snprintf(msg, sizeof(msg), "Never sent serial number %8.8x", serial_num) < 0) { + msg[0] = '\0'; + } op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); *abort_no_unlock = 1; Modified: head/sys/netinet/sctp_indata.c == --- head/sys/netinet/sctp_indata.c Mon May 18 09:46:51 2020 (r361208) +++ head/sys/netinet/sctp_indata.c Mon May 18 10:07:01 2020 (r361209) @@ -434,22 +434,26 @@ sctp_abort_in_reasm(struct sctp_tcb *stcb, struct mbuf *oper; if (stcb->asoc.idata_supported) { - snprintf(msg, sizeof(msg), + if (snprintf(msg, sizeof(msg), "Reass %x,CF:%x,TSN=%8.8x,SID=%4.4x,FSN=%8.8x,MID:%8.8x", opspot, control->fsn_included, chk->rec.data.tsn, chk->rec.data.sid, - chk->rec.data.fsn, chk->rec.data.mid); + chk->rec.data.fsn, chk->rec.data.mid) < 0) { + msg[0] = '\0'; + } } else { - snprintf(msg, sizeof(msg), + if (snprintf(msg, sizeof(msg), "Reass %x,CI:%x,TSN=%8.8x,SID=%4.4x,FSN=%4.4x,SSN:%4.4x", opspot, control->fsn_included, chk->rec.data.tsn, chk->rec.data.sid, chk->rec.data.fsn, - (uint16_t)chk->rec.data.mid); + (uint16_t)chk->rec.data.mid) < 0) { + msg[0] = '\0'; + } } oper = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); sctp_m_freem(chk->data); @@ -533,15 +537,19 @@ sctp_queue_data_to_stream(struct sctp_tcb *stcb, */ TAILQ_INSERT_HEAD(>inqueue, control, next_instrm); if (asoc->idata_supported) { - snprintf(msg, sizeof(msg), "Delivered MID=%8.8x, got TSN=%8.8x, SID=%4.4x, MID=%8.8x", + if (snprintf(msg, sizeof(msg), "Delivered MID=%8.8x, got TSN=%8.8x, SID=%4.4x, MID=%8.8x", strm->last_mid_delivered, control->sinfo_tsn, - control->sinfo_stream, control->mid); + control->sinfo_stream, control->mid) < 0) { + msg[0] = '\0'; + } } else { - snprintf(msg, sizeof(msg), "Delivered SSN=%4.4x, got TSN=%8.8x, SID=%4.4x, SSN=%4.4x", + if (snprintf(msg, sizeof(msg), "Delivered SSN=%4.4x, got TSN=%8.8x, SID=%4.4x, SSN=%4.4x", (uint16_t)strm->last_mid_delivered, control->sinfo_tsn, control->sinfo_stream, - (uint16_t)control->mid); + (uint16_t)control->mid) < 0) { + msg[0] = '\0'; + } } op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_2; @@ -648,9 +656,10 @@ sctp_queue_data_to_stream(struct sctp_tcb *stcb, * to put it on the queue. */ if (sctp_place_control_in_stream(strm, asoc, control)) { - snprintf(msg, sizeof(msg), - "Queue to str MID: %u duplicate", - control->mid); + if (snprintf(msg, sizeof(msg), + "Queue to str MID: %u duplicate", control->mid) < 0) { + msg[0] =