Re: svn commit: r328492 - head/contrib/opie/libopie
On 01/27/18 20:42, Bruce Evans wrote: On Sat, 27 Jan 2018, Pedro Giffuni wrote: On 01/27/18 18:21, Bruce Evans wrote: On Sat, 27 Jan 2018, Dimitry Andric wrote: On 27 Jan 2018, at 23:20, Ed Schoutenwrote: * [... context lost to corruption of spaces which makes it unreadable] Wait... This may access utmp.ut_host one byte past the end and no longer guarantees that host is null-terminated, right? No, strncpy "copies at most len characters from src into dst". However, No, the change breaks the length so 1 byte past the end is accessed in implementations where ut_host is not guaranteed to be NUL terminated and the current instance of ut_host is not NUL terminated. The main change is in the sizeof(). Regularly you should use the size of destination not the source, and apparently GCC8 decided there was something to check there. That is the main breakage. Using the size of the destination is very wrong, since that size is intentionally 1 larger than the size of the source, to leave space for appending a NUL. I am considering reverting the change. Looking at other ways to get rid of the warning, please be patient. ... Looking in detail, upstream (which appears to have disappeared) does have the explicit NULL termination in our last import. For consistency and given that we already have a strlcpy in that code, we should use strlcpy() there. Every modern OS out there has strlcpy(3) and if not they can figure out what to do. strlcpy() still seems to be intentionally left out of glibc. glibc is not portable. I understand some systems that carry glibc also carry libbsd, or they can still use musl: https://github.com/esmil/musl/blob/master/src/string/strlcpy.c Pedro. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r328474 - head/sys/contrib/libnv
In message <20180127215658.GA75080@jarvis>, Mariusz Zaborski writes: > > > --ew6BAiZeqk4r7MaW > Content-Type: text/plain; charset=us-ascii > Content-Disposition: inline > Content-Transfer-Encoding: quoted-printable > > On Sat, Jan 27, 2018 at 07:32:39AM -0800, Cy Schubert wrote: > > In message <201801271258.w0rcwml0078...@repo.freebsd.org>, Mariusz Zabors= > ki=20 > > wri > > tes: > > > Author: oshogbo > > > Date: Sat Jan 27 12:58:21 2018 > > > New Revision: 328474 > > > URL: https://svnweb.freebsd.org/changeset/base/328474 > > > > > > Log: > > > Add SPDX tags for nv(9). > > > =20 > > > MFC after: 2 weeks > > > > > > Modified: > > > head/sys/contrib/libnv/cnvlist.c > > > head/sys/contrib/libnv/dnvlist.c > > > head/sys/contrib/libnv/nv_impl.h > > > head/sys/contrib/libnv/nvlist.c > > > head/sys/contrib/libnv/nvlist_impl.h > > > head/sys/contrib/libnv/nvpair.c > > > head/sys/contrib/libnv/nvpair_impl.h > > > > >=20 > > When was it decided to add SPDX to contrib? > The nv was development for and in FreeBSD. > First whole library was in lib/libnv. > Then the part which is also in the kernel was moved to sys/kern and sys/sys > directories. > The problem with that was that evrything in the sys/sys is instaled in > /usr/include and in the *_impl.h we have things that should not be accesibl= > e by > developers. > > This was the main reason of moving libnv to contrib file at the time. > If you have any other place where libnv can be kept I'm happy to move it. It's native to FreeBSD then and not an import through a vendor branch. That's what was led to understand. However this was not concern I had. As this is native FreeBSD code it should have SPDX tags. My concern about SPDX in contrib is MFV. I think we should encourage our upstream source providers to include SPDX tags in their code we import into the vendor branches. -- Cheers, Cy SchubertFreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r328492 - head/contrib/opie/libopie
On Sat, 27 Jan 2018, Pedro Giffuni wrote: On 01/27/18 18:21, Bruce Evans wrote: On Sat, 27 Jan 2018, Dimitry Andric wrote: On 27 Jan 2018, at 23:20, Ed Schoutenwrote: * [... context lost to corruption of spaces which makes it unreadable] Wait... This may access utmp.ut_host one byte past the end and no longer guarantees that host is null-terminated, right? No, strncpy "copies at most len characters from src into dst".?? However, No, the change breaks the length so 1 byte past the end is accessed in implementations where ut_host is not guaranteed to be NUL terminated and the current instance of ut_host is not NUL terminated. The main change is in the sizeof(). Regularly you should use the size of destination not the source, and apparently GCC8 decided there was something to check there. That is the main breakage. Using the size of the destination is very wrong, since that size is intentionally 1 larger than the size of the source, to leave space for appending a NUL. ... Looking in detail, upstream (which appears to have disappeared) does have the explicit NULL termination in our last import. For consistency and given that we already have a strlcpy in that code, we should use strlcpy() there. Every modern OS out there has strlcpy(3) and if not they can figure out what to do. strlcpy() still seems to be intentionally left out of glibc. Bruce___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r328504 - in head/stand: efi/fdt fdt uboot/fdt
Author: kevans Date: Sun Jan 28 01:22:15 2018 New Revision: 328504 URL: https://svnweb.freebsd.org/changeset/base/328504 Log: stand/fdt: Consolidate overlay handling a little further This should have been done as part of r327350, but due to lack of foresight it came later. In the different places we apply overlays, we duplicate the bits that check for fdt_overlays in the environment and supplement that with any other places we need to check for overlays to load. These "other places" will be loader specific and are not candidates for consolidation. Provide an fdt_load_dtb_overlays to capture the common logic, allow passing in an additional list of overlays to be loaded. This additional list of overlays is used in practice for ubldr to pull in any fdt_overlays passed to it from U-Boot environment, but it can be used for any other source of overlays. These additional overlays supplement loader.conf(5) fdt_overlays, rather than replace, so that we're not restricted to specifying overlays in only one place. This is a change from previous behavior where loader.conf(5) supplied fdt_overlays would cause us to ignore U-Boot environment, and this seems nonsensical- user should have sufficient control over both of these aspects, or lack of control for good reasons. A knob could be considered in the future to ignore U-Boot supplied overlays, but the supplemental treatment seems like a good start. Reviewed by: imp (earlier version), gonzo (earlier version) Differential Revision:https://reviews.freebsd.org/D13993 Modified: head/stand/efi/fdt/efi_fdt.c head/stand/fdt/fdt_loader_cmd.c head/stand/fdt/fdt_platform.h head/stand/uboot/fdt/uboot_fdt.c Modified: head/stand/efi/fdt/efi_fdt.c == --- head/stand/efi/fdt/efi_fdt.cSun Jan 28 00:27:51 2018 (r328503) +++ head/stand/efi/fdt/efi_fdt.cSun Jan 28 01:22:15 2018 (r328504) @@ -53,12 +53,7 @@ fdt_platform_load_dtb(void) return (1); printf("Using DTB provided by EFI at %p.\n", hdr); - s = getenv("fdt_overlays"); - if (s != NULL && *s != '\0') { - printf("Loading DTB overlays: '%s'\n", s); - fdt_load_dtb_overlays(s); - } - + fdt_load_dtb_overlays(NULL); return (0); } Modified: head/stand/fdt/fdt_loader_cmd.c == --- head/stand/fdt/fdt_loader_cmd.c Sun Jan 28 00:27:51 2018 (r328503) +++ head/stand/fdt/fdt_loader_cmd.c Sun Jan 28 01:22:15 2018 (r328504) @@ -76,6 +76,7 @@ static int fdt_load_dtb(vm_offset_t va); static void fdt_print_overlay_load_error(int err, const char *filename); static int fdt_cmd_nyi(int argc, char *argv[]); +static int fdt_load_dtb_overlays_string(const char * filenames); static int fdt_cmd_addr(int argc, char *argv[]); static int fdt_cmd_mkprop(int argc, char *argv[]); @@ -331,15 +332,15 @@ fdt_print_overlay_load_error(int err, const char *file } } -int -fdt_load_dtb_overlays(const char * filenames) +static int +fdt_load_dtb_overlays_string(const char * filenames) { char *names; char *name, *name_ext; char *comaptr; int err, namesz; - debugf("fdt_load_dtb_overlay(%s)\n", filenames); + debugf("fdt_load_dtb_overlays_string(%s)\n", filenames); names = strdup(filenames); if (names == NULL) @@ -829,6 +830,25 @@ fdt_fixup_stdout(const char *str) strlen((char *)) + 1); fdt_setprop(fdtp, no, "stdin", , strlen((char *)) + 1); + } +} + +void +fdt_load_dtb_overlays(const char *extras) +{ + const char *s; + + /* Any extra overlays supplied by pre-loader environment */ + if (extras != NULL && *extras != '\0') { + printf("Loading DTB overlays: '%s'\n", extras); + fdt_load_dtb_overlays_string(extras); + } + + /* Any overlays supplied by loader environment */ + s = getenv("fdt_overlays"); + if (s != NULL && *s != '\0') { + printf("Loading DTB overlays: '%s'\n", s); + fdt_load_dtb_overlays_string(s); } } Modified: head/stand/fdt/fdt_platform.h == --- head/stand/fdt/fdt_platform.h Sun Jan 28 00:27:51 2018 (r328503) +++ head/stand/fdt/fdt_platform.h Sun Jan 28 01:22:15 2018 (r328504) @@ -46,7 +46,7 @@ void fdt_fixup_stdout(const char *); void fdt_apply_overlays(void); int fdt_load_dtb_addr(struct fdt_header *); int fdt_load_dtb_file(const char *); -int fdt_load_dtb_overlays(const char *); +void fdt_load_dtb_overlays(const char *); int fdt_setup_fdtp(void); /* The platform library needs to implement these functions */ Modified:
Re: svn commit: r328492 - head/contrib/opie/libopie
On 01/27/18 18:21, Bruce Evans wrote: On Sat, 27 Jan 2018, Dimitry Andric wrote: On 27 Jan 2018, at 23:20, Ed Schoutenwrote: 2018-01-27 23:16 GMT+01:00 Pedro F. Giffuni : char host[sizeof(utmp.ut_host) + 1]; insecure = 1; - strncpy(host, utmp.ut_host, sizeof(utmp.ut_host)); - host[sizeof(utmp.ut_host)] = 0; + strncpy(host, utmp.ut_host, sizeof(host)); Wait... This may access utmp.ut_host one byte past the end and no longer guarantees that host is null-terminated, right? No, strncpy "copies at most len characters from src into dst". However, No, the change breaks the length so 1 byte past the end is accessed in implementations where ut_host is not guaranteed to be NUL terminated and the current instance of ut_host is not NUL terminated. The main change is in the sizeof(). Regularly you should use the size of destination not the source, and apparently GCC8 decided there was something to check there. if the length of the source is equal to or greater than len, the destination is *not* null terminated. This is likely why the "host[sizeof(utmp.ut_host)] = 0;" statement was added. This is why that statement was there. This change is not even wrong under FreeBSD, since ut_host and several other fields are guaranteed to be NUL terminated in the FreeBSD implementation. The code was correct and portable and the change just breaks its portability. The change was done for portability to GCC, or at least to fix a warning there. In any case, this is why strlcpy exists. :) Using strlcpy() in libopie would be another good unportabilization. contrib/opie never uses strlc*() except in 1 place previously unportabilized in r208586. That at least fixed 2 bugs (2 related off by 1 errors in the code intended to avoid buffer overruns, with the result that buffer overruns were limited to 1 byte). It moved the style bugs by changing hacking on the source string to use of strlcpy(). Looking in detail, upstream (which appears to have disappeared) does have the explicit NULL termination in our last import. For consistency and given that we already have a strlcpy in that code, we should use strlcpy() there. Every modern OS out there has strlcpy(3) and if not they can figure out what to do. Pedro. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r328486 - head/usr.bin/fortune/fortune
On 01/27/18 18:08, Ian Lepore wrote: On Sat, 2018-01-27 at 22:56 +, Conrad Meyer wrote: I donļæ½t think dragonfly has anything to do with this?ļæ½ļæ½If youļæ½re converting bool increments to setting true values in FreeBSD, use ļæ½true.ļæ½ļæ½ļæ½Thatļæ½s all there is to it. Best, Conrad style(9) emphasizes internal consistancy in several places. ļæ½The uppercase TRUE/FALSE is currently the style within that code, so it makes sense to stick with it. ļæ½If a (somewhat gratuitous) conversion to the new style is made, it should be a separate commit just for that, emphasizing that it changes just style and not functionality. Indeed. I didn't want to mix FALSE with false and TRUE with true so I did the change as is to make the diff smaller and still have everything look consistent. Further cleanups (DragonFly already did it) should be done in a different commit. I personally don't feel it's something important though. Pedro. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r328503 - stable/11/lib/libiconv_modules/ISO2022
Author: eadler Date: Sun Jan 28 00:27:51 2018 New Revision: 328503 URL: https://svnweb.freebsd.org/changeset/base/328503 Log: MFC r328222: iconv: adding missing break break is probably intended and correct, but has no correctness implications due to is94 => is96 Modified: stable/11/lib/libiconv_modules/ISO2022/citrus_iso2022.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libiconv_modules/ISO2022/citrus_iso2022.c == --- stable/11/lib/libiconv_modules/ISO2022/citrus_iso2022.c Sun Jan 28 00:26:05 2018(r328502) +++ stable/11/lib/libiconv_modules/ISO2022/citrus_iso2022.c Sun Jan 28 00:27:51 2018(r328503) @@ -774,6 +774,7 @@ asis: case CS94: if (!(is94(string[0] & 0x7f))) goto asis; + break; case CS96: if (!(is96(string[0] & 0x7f))) goto asis; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r328502 - stable/11/usr.bin/limits
Author: eadler Date: Sun Jan 28 00:26:05 2018 New Revision: 328502 URL: https://svnweb.freebsd.org/changeset/base/328502 Log: MFC r328212: limits(1): fix always true condition Modified: stable/11/usr.bin/limits/limits.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/limits/limits.c == --- stable/11/usr.bin/limits/limits.c Sat Jan 27 23:40:41 2018 (r328501) +++ stable/11/usr.bin/limits/limits.c Sun Jan 28 00:26:05 2018 (r328502) @@ -509,7 +509,7 @@ main(int argc, char *argv[]) for (rcswhich = 0; rcswhich < RLIM_NLIMITS; rcswhich++) { if (doall || num_limits == 0 || which_limits[rcswhich] != 0) { - if (which_limits[rcswhich] == ANY || which_limits[rcswhich]) + if (which_limits[rcswhich] == ANY) which_limits[rcswhich] = type; if (shellparm[shelltype].lprm[rcswhich].pfx) { if (shellparm[shelltype].both && limits[rcswhich].rlim_cur == limits[rcswhich].rlim_max) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r328486 - head/usr.bin/fortune/fortune
On Sat, 27 Jan 2018, Ian Lepore wrote: On Sat, 2018-01-27 at 22:56 +, Conrad Meyer wrote: I don?t think dragonfly has anything to do with this???If you?re converting bool increments to setting true values in FreeBSD, use ?true.???That?s all there is to it. style(9) emphasizes internal consistancy in several places. ?The uppercase TRUE/FALSE is currently the style within that code, so it makes sense to stick with it. ?If a (somewhat gratuitous) conversion to the new style is made, it should be a separate commit just for that, emphasizing that it changes just style and not functionality. fortune.c has already been churned and broken by gratuitous conversion to use bool. It used to use "#define bool short". It also defined its own TRUE and FALSE as 1 and 0. This was almost correct. The bools were sometimes set bogusly to TRUE using the PDP-11 micro-optimization of incrementing them (this can overflow in theory, but in practice it is hard to have enough command line args to overflow even short variables by incrementing them by 1 per arg). The `Debug' variable was tri-state, but its type was misspelled bool and it was bogusly initialized to FALSE. This was changed in r242576 by including , removing the private definition of bool, and changing the definitions of TRUE and FALSE to true and false. This did no good, but exposed the brokenness of 'Debug' and created mounds of style bugs (spelling true and false as TRUE and FALSE, and requiring more magic for the PDP-11ism's to work). r242577 increased the style bugs by using true and false directly in new code. 'Debug' was fixed in r243036. This commit is to remove the PDP11-isms. Although they work even better with real bools than with shorts (incrementing a bool clamps it to 1, but incrementing a short always increments it unless it overflows), they are larger obfuscations with bools than with shorts and some compilers apparently warn about them. This commit preserves the old style of using TRUE and FALSE instead of true and false. style(9) only mildly discourages converting old code to use bool ("may be converted if it is reasonable to"). It says that the spellings true and false are preferred, but should only say that the are preferred in code that uses bool. Bruce___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules
In message, Warner Losh writes: >> The moment the correct infrastructure appears on the RPi platform, >> if it ever does, I will change my driver to use that infrastructure. > >The root of the problem is that we have the right infrastructure... >Everywhere except RPi. It needs a proper pinmux/pinctl driver. That's the >next step in fixing this issue. If you don't want to be part of fixing >that, then get out of the way. My driver is not built into any kernels, you have to kldload it AND configure it via sysctls before it can possibly get in the way of anything, so yes: I am out of the way. >The next step, though, is to bring the RPI's infrastructure up to speed >with the rest of the arm ports... That's where time is best spent, >honestly. Fighting a never ending series of one-off kludges is doomed to >failure. I don't think the two evenings I spent in my lap measuring and figuring out what the datasheet didn't say and said wrong about the PWM hardware is a failure just because a couple of hardware unrelated lines of source code needs to be changed at a later date. >We're there on >boot on every other armv7/arm64 platform, just not there incrementally at >runtime. Some work would be needed to make that happen, but I think I have a >reasonable design that I've started to socialize... You're welcome to join in >in making it happen, if you like With the limited time I have available, I will. Poul-Henning -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 p...@freebsd.org | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r328501 - stable/11/usr.bin/limits
Author: eadler Date: Sat Jan 27 23:40:41 2018 New Revision: 328501 URL: https://svnweb.freebsd.org/changeset/base/328501 Log: MFC r328206: limits(1): add missing break Modified: stable/11/usr.bin/limits/limits.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/limits/limits.c == --- stable/11/usr.bin/limits/limits.c Sat Jan 27 23:20:01 2018 (r328500) +++ stable/11/usr.bin/limits/limits.c Sat Jan 27 23:40:41 2018 (r328501) @@ -608,6 +608,7 @@ resource_num(int which, int ch, const char *str) break; case 'w': case 'W': /* weeks */ tim *= (60L * 60L * 24L * 7L); + break; case 'y': case 'Y': /* Years */ tim *= (60L * 60L * 24L * 365L); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules
On Sat, Jan 27, 2018 at 4:14 PM, Poul-Henning Kampwrote: > > The moment the correct infrastructure appears on the RPi platform, > if it ever does, I will change my driver to use that infrastructure. > The root of the problem is that we have the right infrastructure... Everywhere except RPi. It needs a proper pinmux/pinctl driver. That's the next step in fixing this issue. If you don't want to be part of fixing that, then get out of the way. Embedded is different and we've had a decade now of increasing FDT use, and it works. The RPi port, sadly, didn't come with this, and we're paying the price now. In an ideal word, you could just enable the driver, have it attach, and have it's pins muxed properly by the infrastructure. We're there on boot on every other armv7/arm64 platform, just not there incrementally at runtime. Some work would be needed to make that happen, but I think I have a reasonable design that I've started to socialize... You're welcome to join in in making it happen, if you like The next step, though, is to bring the RPI's infrastructure up to speed with the rest of the arm ports... That's where time is best spent, honestly. Fighting a never ending series of one-off kludges is doomed to failure. Warner ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r328492 - head/contrib/opie/libopie
On Sat, 27 Jan 2018, Dimitry Andric wrote: On 27 Jan 2018, at 23:20, Ed Schoutenwrote: 2018-01-27 23:16 GMT+01:00 Pedro F. Giffuni : char host[sizeof(utmp.ut_host) + 1]; insecure = 1; - strncpy(host, utmp.ut_host, sizeof(utmp.ut_host)); - host[sizeof(utmp.ut_host)] = 0; + strncpy(host, utmp.ut_host, sizeof(host)); Wait... This may access utmp.ut_host one byte past the end and no longer guarantees that host is null-terminated, right? No, strncpy "copies at most len characters from src into dst". However, No, the change breaks the length so 1 byte past the end is accessed in implementations where ut_host is not guaranteed to be NUL terminated and the current instance of ut_host is not NUL terminated. if the length of the source is equal to or greater than len, the destination is *not* null terminated. This is likely why the "host[sizeof(utmp.ut_host)] = 0;" statement was added. This is why that statement was there. This change is not even wrong under FreeBSD, since ut_host and several other fields are guaranteed to be NUL terminated in the FreeBSD implementation. The code was correct and portable and the change just breaks its portability. In any case, this is why strlcpy exists. :) Using strlcpy() in libopie would be another good unportabilization. contrib/opie never uses strlc*() except in 1 place previously unportabilized in r208586. That at least fixed 2 bugs (2 related off by 1 errors in the code intended to avoid buffer overruns, with the result that buffer overruns were limited to 1 byte). It moved the style bugs by changing hacking on the source string to use of strlcpy(). Bruce ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r328500 - in stable/11/usr.bin/hexdump: . tests
Author: kevans Date: Sat Jan 27 23:20:01 2018 New Revision: 328500 URL: https://svnweb.freebsd.org/changeset/base/328500 Log: MFC r328188,r328189,r328200: Fix wrong output for multibyte corner cases MFC r328188: od(1): Fix wrong output for corner cases in multibyte locales. Restore the original character to print if we used the look-ahead buffer, but that didn't help -- we either got an illegal sequence or still can't complete. MFC r328189: od(1): Fix mis-patch from r328188 od_test.sh got duplicated erroneously when it was added in r328188. Dedup. MFC r328200: Silence the gcc warning: 'op' may be used uninitialized in this function PR: 224552 Added: stable/11/usr.bin/hexdump/tests/d_od_cflag_a.out - copied unchanged from r328188, head/usr.bin/hexdump/tests/d_od_cflag_a.out stable/11/usr.bin/hexdump/tests/d_od_cflag_b.out - copied unchanged from r328188, head/usr.bin/hexdump/tests/d_od_cflag_b.out stable/11/usr.bin/hexdump/tests/od_test.sh - copied, changed from r328188, head/usr.bin/hexdump/tests/od_test.sh Modified: stable/11/usr.bin/hexdump/conv.c stable/11/usr.bin/hexdump/tests/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/hexdump/conv.c == --- stable/11/usr.bin/hexdump/conv.cSat Jan 27 23:13:34 2018 (r328499) +++ stable/11/usr.bin/hexdump/conv.cSat Jan 27 23:20:01 2018 (r328500) @@ -54,7 +54,10 @@ conv_c(PR *pr, u_char *p, size_t bufsize) size_t clen, oclen; int converr, pad, width; u_char peekbuf[MB_LEN_MAX]; + u_char *op; + op = NULL; + if (pr->mbleft > 0) { str = "**"; pr->mbleft--; @@ -105,6 +108,15 @@ retry: else if (clen == (size_t)-1 || (clen == (size_t)-2 && p == peekbuf)) { memset(>mbstate, 0, sizeof(pr->mbstate)); + if (p == peekbuf) { + /* +* We peeked ahead, but that didn't help -- +* we either got an illegal sequence or still +* can't complete; restore original character. +*/ + oclen = 0; + p = op; + } wc = *p; clen = 1; converr = 1; @@ -114,6 +126,7 @@ retry: * can complete it. */ oclen = bufsize; + op = p; bufsize = peek(p = peekbuf, MB_CUR_MAX); goto retry; } @@ -126,7 +139,7 @@ retry: if (!odmode) { *pr->cchar = 'c'; (void)printf(pr->fmt, (int)wc); - } else { + } else { *pr->cchar = 'C'; assert(strcmp(pr->fmt, "%3C") == 0); width = wcwidth(wc); Modified: stable/11/usr.bin/hexdump/tests/Makefile == --- stable/11/usr.bin/hexdump/tests/MakefileSat Jan 27 23:13:34 2018 (r328499) +++ stable/11/usr.bin/hexdump/tests/MakefileSat Jan 27 23:20:01 2018 (r328500) @@ -2,7 +2,7 @@ PACKAGE= tests -ATF_TESTS_SH= hexdump_test +ATF_TESTS_SH= hexdump_test od_test ${PACKAGE}FILES+= d_hexdump_a.in ${PACKAGE}FILES+= d_hexdump_b.in @@ -27,5 +27,7 @@ ${PACKAGE}FILES+= d_hexdump_UCflag_c.out ${PACKAGE}FILES+= d_hexdump_xflag_a.out ${PACKAGE}FILES+= d_hexdump_xflag_b.out ${PACKAGE}FILES+= d_hexdump_xflag_c.out +${PACKAGE}FILES+= d_od_cflag_a.out +${PACKAGE}FILES+= d_od_cflag_b.out .include Copied: stable/11/usr.bin/hexdump/tests/d_od_cflag_a.out (from r328188, head/usr.bin/hexdump/tests/d_od_cflag_a.out) == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/usr.bin/hexdump/tests/d_od_cflag_a.outSat Jan 27 23:20:01 2018(r328500, copy of r328188, head/usr.bin/hexdump/tests/d_od_cflag_a.out) @@ -0,0 +1,3 @@ +000T e s t T e s t T e s t T e s 345 +020T e s t 345 +025 Copied: stable/11/usr.bin/hexdump/tests/d_od_cflag_b.out (from r328188, head/usr.bin/hexdump/tests/d_od_cflag_b.out) == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/usr.bin/hexdump/tests/d_od_cflag_b.outSat Jan 27 23:20:01 2018(r328500,
Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules
In message <20180127210801.37b8001125dd0a2c92372...@bidouilliste.com>, Emmanuel Vadot writes: > - We have a commiter that commited something for his own need: he >wanted to use the pwm on his rpi, coded a driver (this part is good) >but feel that the standard we were using was crap and commited his work >without talking with arm developper on what the proper way to do it was. First, as a general rule, I think you should leave it to me to express what I think and feel, because you truly suck at it. FDT may or may not be the right technology to use, I take no position on that, because I am not the one doing all the work to implement it, and I certainly don't propose to do the work to come up with an alternative. > - Now we have a crappy driver in the tree. 1. Hardly our first 2. "Crappy driver" is not pass/fail, we grade that on a curve. 3. You confuse "I don't like" with "crappy" > - We still have this driver that doesn't follow the standard we said we >want to adhere to. And part of that decision, clearly explained for all who participated in making it, was that we should time-warp back to FreeBSD 1.X where hardware changes always required a reboot ? Right, I didn't think so... Maybe we *also* need to make some decisions about *how* we want this FDT stuff to work for us in practice? My summary of the situation: Everybody I have communicated with over the last couple of months have given me clear indication that nothing significant will happen on the RPi platform, which people see as inferior and not worth the/any effort. I don't entirely agree about that, I think RPi is a platform we as project ignore at our peril, so I have started to do a little bit of an effort, as I find time and information for it. You keep yelling at me for not adhering to an entirely undocumented design vision, which we don't even have a single compliant reference platform for yet. The stuff (clock manager, pin manager, runtime overlays) you are upset about me not using, does not exist on the RPi platform in FreeBSD at this point in time, which is why I don't use them. There is no documentation anywhere to be found, how to implement these hypothetical pieces of code, which is why I don't implement them. I am quite tempted to quote Gen. Patton on you and say "Lead me, Follow me, or get out of my way", but that would be a bit too rude. Instead I will repeat what I have already said to you several times: The moment the correct infrastructure appears on the RPi platform, if it ever does, I will change my driver to use that infrastructure. Until then, you are wasting everybodys time pointing accusingly into your book of unwritten rules. Poul-Henning -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 p...@freebsd.org | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r328499 - in stable/11: etc/mtree share/man/man7 sys/boot/arm/uboot sys/boot/mips/uboot
Author: kevans Date: Sat Jan 27 23:13:34 2018 New Revision: 328499 URL: https://svnweb.freebsd.org/changeset/base/328499 Log: MFC (conceptually) r328107: Add /boot/overlays This is a direct commit to stable/11, due to path changes in HEAD. Diffs have been applied on top of stable/11, with exception to the change to forth/loader.conf. forth/loader.conf has seen additional changes in HEAD mthat are not being MFC'd to stable/11, so the addition of /boot/overlays to its module_path is not necessary. MFC r328107: stand: Add /boot/overlays for separation of overlays from DTB This matches directory structure used commonly in Linux-land, and it's cleaner than mixing overlays into the existing module paths. Overlays are still mixed in by specifying fdt_overlays in loader.conf(5). Modified: stable/11/etc/mtree/BSD.root.dist stable/11/share/man/man7/hier.7 stable/11/sys/boot/arm/uboot/loader.conf stable/11/sys/boot/mips/uboot/loader.conf Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/mtree/BSD.root.dist == --- stable/11/etc/mtree/BSD.root.dist Sat Jan 27 22:57:06 2018 (r328498) +++ stable/11/etc/mtree/BSD.root.dist Sat Jan 27 23:13:34 2018 (r328499) @@ -18,6 +18,8 @@ .. modules .. +overlays +.. zfs .. .. Modified: stable/11/share/man/man7/hier.7 == --- stable/11/share/man/man7/hier.7 Sat Jan 27 22:57:06 2018 (r328498) +++ stable/11/share/man/man7/hier.7 Sat Jan 27 23:13:34 2018 (r328499) @@ -28,7 +28,7 @@ .\"@(#)hier.7 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd April 6, 2017 +.Dd January 15, 2018 .Dt HIER 7 .Os .Sh NAME @@ -63,6 +63,11 @@ at boot time) and kernel modules third-party loadable kernel modules; see .Xr kldstat 8 +.It Pa overlays/ +Compiled flattened device tree (FDT) overlays; see +.Xr fdt 4 +and +.Xr dtc 1 .It Pa zfs/ .Xr zfs 8 zpool cache files Modified: stable/11/sys/boot/arm/uboot/loader.conf == --- stable/11/sys/boot/arm/uboot/loader.confSat Jan 27 22:57:06 2018 (r328498) +++ stable/11/sys/boot/arm/uboot/loader.confSat Jan 27 23:13:34 2018 (r328499) @@ -7,7 +7,7 @@ autoboot_delay=10 bootfile="kernel" # Kernel name (possibly absolute path) kernel="kernel"# /boot sub-directory containing kernel and modules loader_conf_files="/boot/loader.conf /boot/loader.conf.local" -module_path="/boot/kernel;/boot/modules;/boot/dtb" +module_path="/boot/kernel;/boot/modules;/boot/dtb;/boot/overlays" nextboot_conf="/boot/nextboot.conf" nextboot_enable="NO" verbose_loading="NO" Modified: stable/11/sys/boot/mips/uboot/loader.conf == --- stable/11/sys/boot/mips/uboot/loader.conf Sat Jan 27 22:57:06 2018 (r328498) +++ stable/11/sys/boot/mips/uboot/loader.conf Sat Jan 27 23:13:34 2018 (r328499) @@ -7,7 +7,7 @@ autoboot_delay=10 bootfile="kernel" # Kernel name (possibly absolute path) kernel="kernel"# /boot sub-directory containing kernel and modules loader_conf_files="/boot/loader.conf /boot/loader.conf.local" -module_path="/boot/kernel;/boot/modules;/boot/dtb" +module_path="/boot/kernel;/boot/modules;/boot/dtb;/boot/overlays" nextboot_conf="/boot/nextboot.conf" nextboot_enable="NO" verbose_loading="NO" ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r328489 - head/sys/conf
On Sat, Jan 27, 2018 at 12:47 PM, O. Hartmannwrote: > Am Sat, 27 Jan 2018 20:13:36 + (UTC) > "Jason A. Harmening" schrieb: > > > Author: jah > > Date: Sat Jan 27 20:13:36 2018 > > New Revision: 328489 > > URL: https://svnweb.freebsd.org/changeset/base/328489 > > > > Log: > > Remove system makefile path directives from env passed to > PORTS_MODULES step > > > > Previously, MAKESYSPATH as well as '-m' directives in MAKEFLAGS would > cause > > any port rebuilt during the PORTS_MODULES stage to consume system > makefiles > > from $(SRCROOT)/share/mk instead of those installed under > /usr/share/mk. > > For kernel modules that need to build against an updated src tree this > > makes sense; less so for or any userspace library or > utility > > the port may also happen to install. > > > > Before 11.0, this probably didn't matter much in practice. But the > addition > > of src.libnames.mk under $(SRCROOT)/share/mk in 11.0 breaks any > consumer of > > bsd.prog.mk and DPADD/LDADD during PORTS_MODULES. > > > > Address the build breakage by removing MAKESYSPATH and any occurrence > of > > '-m' from MAKEFLAGS in the environment created for the port build. > > Instead set SYSDIR so that any kmod built by the port will still > consume > > conf/kmod.mk from the updated src tree, assuming it uses > > > > Reviewed by:bdrewery > > MFC after: 2 weeks > > Differential Revision: https://reviews.freebsd.org/D13053 > > > > Modified: > > head/sys/conf/kern.post.mk > > > > Modified: head/sys/conf/kern.post.mk > > > == > > --- head/sys/conf/kern.post.mkSat Jan 27 19:23:42 2018 > (r328488) > > +++ head/sys/conf/kern.post.mkSat Jan 27 20:13:36 2018 > (r328489) > > @@ -69,6 +69,9 @@ PORTSMODULESENV=\ > > -u CC \ > > -u CXX \ > > -u CPP \ > > + -u MAKESYSPATH \ > > + MAKEFLAGS="${MAKEFLAGS:M*:tW:S/^-m /-m_/g:S/ -m / > -m_/g:tw:N-m_*}" \ > > + SYSDIR=${SYSDIR} \ > > PATH=${PATH}:${LOCALBASE}/bin:${LOCALBASE}/sbin \ > > SRC_BASE=${SRC_BASE} \ > > OSVERSION=${OSRELDATE} \ > > ___ > > svn-src-h...@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" > > This happens now if PORTS_MODULE=x11/nvidia-driver is defined in > /etc/src.conf: > > [...] > --- kernel-install --- > mkdir -p /boot/kernel > install -p -m 555 -o root -g wheel kernel /boot/kernel/ > --- ports-install --- > Variable OBJTOP is recursive. > > make[8]: stopped > in /usr/obj/usr/src/amd64.amd64/sys/FY/usr/ports/x11/nvidia- > driver/work/NVIDIA-FreeBSD-x86_64-387.34/src/nvidia > *** Error code 2 > > Stop. > make[7]: stopped > in /usr/obj/usr/src/amd64.amd64/sys/THOR/usr/ports/x11/nvidia- > driver/work/NVIDIA-FreeBSD-x86_64-387.34/src > *** Error code 1 > Hmm, I haven't been able to reproduce this locally so far. What command are you running? Can you post the contents of make.conf and src.conf ? > > -- > O. Hartmann > > Ich widerspreche der Nutzung oder Übermittlung meiner Daten für > Werbezwecke oder für die Markt- oder Meinungsforschung (§ 28 Abs. 4 BDSG). > ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r328486 - head/usr.bin/fortune/fortune
On Sat, 2018-01-27 at 22:56 +, Conrad Meyer wrote: > I don’t think dragonfly has anything to do with this? If you’re > converting > bool increments to setting true values in FreeBSD, use > “true.” That’s all > there is to it. > > Best, > Conrad style(9) emphasizes internal consistancy in several places. The uppercase TRUE/FALSE is currently the style within that code, so it makes sense to stick with it. If a (somewhat gratuitous) conversion to the new style is made, it should be a separate commit just for that, emphasizing that it changes just style and not functionality. -- Ian ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r328486 - head/usr.bin/fortune/fortune
On 01/27/18 17:56, Conrad Meyer wrote: I don’t think dragonfly has anything to do with this? If you’re converting bool increments to setting true values in FreeBSD, use “true.” That’s all there is to it. s/TRUE/true/ s/FALSE/false/ Then remove the two #defines for TRUE and FALSE, but I am on my way out, so feel free to do the change :). Pedro. Best, Conrad On Sat, Jan 27, 2018 at 1:44 PM Pedro Giffuni> wrote: Hi; On 01/27/18 14:56, Conrad Meyer wrote: > We can use 'true' and 'false' now. (style(9) also suggests using the > C99 names instead of TRUE/FALSE.) Yes, I noticed that change in DragonflyBSD but it is conceptually a different change and it deserves a different commit. Pedro. > On Sat, Jan 27, 2018 at 9:43 AM, Pedro F. Giffuni > wrote: >> Author: pfg >> Date: Sat Jan 27 17:43:09 2018 >> New Revision: 328486 >> URL: https://svnweb.freebsd.org/changeset/base/328486 >> >> Log: >> fortune(6): Fix gcc80 -Wbool-operation warnings. >> >> Hinted by: Dragonfly (git 4d1086765752f0569497d06460d95117c74f33ac) >> >> Modified: >> head/usr.bin/fortune/fortune/fortune.c >> >> Modified: head/usr.bin/fortune/fortune/fortune.c >> == >> --- head/usr.bin/fortune/fortune/fortune.c Sat Jan 27 17:24:59 2018 (r328485) >> +++ head/usr.bin/fortune/fortune/fortune.c Sat Jan 27 17:43:09 2018 (r328486) >> @@ -289,35 +289,35 @@ getargs(int argc, char *argv[]) >> #endif /* DEBUG */ >> switch(ch) { >> case 'a': /* any fortune */ >> - All_forts++; >> + All_forts = TRUE; >> break; >> #ifdef DEBUG >> case 'D': >> Debug++; >> break; >> #endif /* DEBUG */ >> - case 'e': >> - Equal_probs++; /* scatter un-allocted prob equally */ >> + case 'e': /* scatter un-allocted prob equally */ >> + Equal_probs = TRUE; >> break; >> case 'f': /* find fortune files */ >> - Find_files++; >> + Find_files = TRUE; >> break; >> case 'l': /* long ones only */ >> - Long_only++; >> + Long_only = TRUE; >> Short_only = FALSE; >> break; >> case 'o': /* offensive ones only */ >> - Offend++; >> + Offend = TRUE; >> break; >> case 's': /* short ones only */ >> - Short_only++; >> + Short_only = TRUE; >> Long_only = FALSE; >> break; >> case 'w': /* give time to read */ >> - Wait++; >> + Wait = TRUE; >> break; >> case 'm': /* dump out the fortunes */ >> - Match++; >> + Match = TRUE; >> pat = optarg; >> break; >> case 'i': /* case-insensitive match */ >> ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r328486 - head/usr.bin/fortune/fortune
I don’t think dragonfly has anything to do with this? If you’re converting bool increments to setting true values in FreeBSD, use “true.” That’s all there is to it. Best, Conrad On Sat, Jan 27, 2018 at 1:44 PM Pedro Giffuniwrote: > Hi; > > > On 01/27/18 14:56, Conrad Meyer wrote: > > We can use 'true' and 'false' now. (style(9) also suggests using the > > C99 names instead of TRUE/FALSE.) > > Yes, I noticed that change in DragonflyBSD but it is conceptually a > different change and it deserves a different commit. > > Pedro. > > > On Sat, Jan 27, 2018 at 9:43 AM, Pedro F. Giffuni > wrote: > >> Author: pfg > >> Date: Sat Jan 27 17:43:09 2018 > >> New Revision: 328486 > >> URL: https://svnweb.freebsd.org/changeset/base/328486 > >> > >> Log: > >>fortune(6): Fix gcc80 -Wbool-operation warnings. > >> > >>Hinted by:Dragonfly (git > 4d1086765752f0569497d06460d95117c74f33ac) > >> > >> Modified: > >>head/usr.bin/fortune/fortune/fortune.c > >> > >> Modified: head/usr.bin/fortune/fortune/fortune.c > >> > == > >> --- head/usr.bin/fortune/fortune/fortune.c Sat Jan 27 17:24:59 > 2018(r328485) > >> +++ head/usr.bin/fortune/fortune/fortune.c Sat Jan 27 17:43:09 > 2018(r328486) > >> @@ -289,35 +289,35 @@ getargs(int argc, char *argv[]) > >> #endif /* DEBUG */ > >> switch(ch) { > >> case 'a': /* any fortune */ > >> - All_forts++; > >> + All_forts = TRUE; > >> break; > >> #ifdef DEBUG > >> case 'D': > >> Debug++; > >> break; > >> #endif /* DEBUG */ > >> - case 'e': > >> - Equal_probs++; /* scatter un-allocted prob > equally */ > >> + case 'e': /* scatter un-allocted prob > equally */ > >> + Equal_probs = TRUE; > >> break; > >> case 'f': /* find fortune files */ > >> - Find_files++; > >> + Find_files = TRUE; > >> break; > >> case 'l': /* long ones only */ > >> - Long_only++; > >> + Long_only = TRUE; > >> Short_only = FALSE; > >> break; > >> case 'o': /* offensive ones only */ > >> - Offend++; > >> + Offend = TRUE; > >> break; > >> case 's': /* short ones only */ > >> - Short_only++; > >> + Short_only = TRUE; > >> Long_only = FALSE; > >> break; > >> case 'w': /* give time to read */ > >> - Wait++; > >> + Wait = TRUE; > >> break; > >> case 'm': /* dump out the > fortunes */ > >> - Match++; > >> + Match = TRUE; > >> pat = optarg; > >> break; > >> case 'i': /* case-insensitive > match */ > >> > > ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r328493 - head/lib/libthr/thread
For the record ... On 01/27/18 17:27, Pedro F. Giffuni wrote: Author: pfg Date: Sat Jan 27 22:27:55 2018 New Revision: 328493 URL: https://svnweb.freebsd.org/changeset/base/328493 Log: libthr: Fix missing break in switch. Hmm.. There is no "missing break" I just copy/pasted the Coverity report (a false positive). Sorry if that confused people. Pedro. This is also a warning in recent GCC with -Wimplicit-fallthrough. CID: 1356262 Obtained from: DragonFly (git 0f037c78 - partial) Modified: head/lib/libthr/thread/thr_printf.c Modified: head/lib/libthr/thread/thr_printf.c == --- head/lib/libthr/thread/thr_printf.c Sat Jan 27 22:16:19 2018 (r328492) +++ head/lib/libthr/thread/thr_printf.c Sat Jan 27 22:27:55 2018 (r328493) @@ -95,6 +95,7 @@ next: c = *fmt++; case 'p': pstr(fd, "0x"); islong = 1; + /* FALLTHROUGH */ case 'd': case 'u': case 'x': ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r328498 - head/lib/libcasper/services/cap_random
Author: oshogbo Date: Sat Jan 27 22:57:06 2018 New Revision: 328498 URL: https://svnweb.freebsd.org/changeset/base/328498 Log: Add cap_random.3 to build system. This should be done with r328494. Modified: head/lib/libcasper/services/cap_random/Makefile Modified: head/lib/libcasper/services/cap_random/Makefile == --- head/lib/libcasper/services/cap_random/Makefile Sat Jan 27 22:57:01 2018(r328497) +++ head/lib/libcasper/services/cap_random/Makefile Sat Jan 27 22:57:06 2018(r328498) @@ -21,4 +21,9 @@ LIBADD= nv CFLAGS+=-I${.CURDIR} +MAN+= cap_random.3 + +MLINKS+=cap_random.3 libcap_random.3 +MLINKS+=cap_random.3 cap_random_buf.3 + .include ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r328497 - head/sbin/pfctl
Author: pfg Date: Sat Jan 27 22:57:01 2018 New Revision: 328497 URL: https://svnweb.freebsd.org/changeset/base/328497 Log: pfctl(8): Fix two wrong conditions. Caught by gcc80's -Wtautological-compare option. MFC after:5 days Approved by: kp Obtained from:DragonFlyBSD (git e3cdbf6c) Differential Revision:https://reviews.freebsd.org/D14083 Modified: head/sbin/pfctl/pfctl_optimize.c Modified: head/sbin/pfctl/pfctl_optimize.c == --- head/sbin/pfctl/pfctl_optimize.cSat Jan 27 22:53:29 2018 (r328496) +++ head/sbin/pfctl/pfctl_optimize.cSat Jan 27 22:57:01 2018 (r328497) @@ -1092,7 +1092,7 @@ skip_cmp_dst_addr(struct pf_rule *a, struct pf_rule *b return (0); case PF_ADDR_DYNIFTL: if (strcmp(a->dst.addr.v.ifname, b->dst.addr.v.ifname) != 0 || - a->dst.addr.iflags != a->dst.addr.iflags || + a->dst.addr.iflags != b->dst.addr.iflags || memcmp(>dst.addr.v.a.mask, >dst.addr.v.a.mask, sizeof(a->dst.addr.v.a.mask))) return (1); @@ -1164,7 +1164,7 @@ skip_cmp_src_addr(struct pf_rule *a, struct pf_rule *b return (0); case PF_ADDR_DYNIFTL: if (strcmp(a->src.addr.v.ifname, b->src.addr.v.ifname) != 0 || - a->src.addr.iflags != a->src.addr.iflags || + a->src.addr.iflags != b->src.addr.iflags || memcmp(>src.addr.v.a.mask, >src.addr.v.a.mask, sizeof(a->src.addr.v.a.mask))) return (1); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r328496 - head/lib/libcasper/libcasper
Author: oshogbo Date: Sat Jan 27 22:53:29 2018 New Revision: 328496 URL: https://svnweb.freebsd.org/changeset/base/328496 Log: Fix caspermock - the cap_recv_nvlist should return nvlist. Modified: head/lib/libcasper/libcasper/libcasper.h Modified: head/lib/libcasper/libcasper/libcasper.h == --- head/lib/libcasper/libcasper/libcasper.hSat Jan 27 22:50:26 2018 (r328495) +++ head/lib/libcasper/libcasper/libcasper.hSat Jan 27 22:53:29 2018 (r328496) @@ -232,7 +232,7 @@ int cap_send_nvlist(const cap_channel_t *chan, const n #ifdef WITH_CASPER nvlist_t *cap_recv_nvlist(const cap_channel_t *chan, int flags); #else -#definecap_recv_nvlist(chan, flags)(0) +#definecap_recv_nvlist(chan, flags)(nvlist_create(flags)) #endif /* ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r328495 - stable/11/usr.bin/dtc
Author: kevans Date: Sat Jan 27 22:50:26 2018 New Revision: 328495 URL: https://svnweb.freebsd.org/changeset/base/328495 Log: MFC r320296, r328173: Update dtc(1) MFC r320296 (manu): dtc: Update to upstream 9ce35ff8 - Add "compatible with gpl dtc X.Y.Z" to version output so U-Boot doesn't complain - Fix cross reference node This fixes some Allwinner DTS (and probably others). MFC r328173: dtc(1): Update to upstream ea3c233 Highlights of this update: - /__local_fixups__ is now generated to be GPL dtc and libfdt compliant - Compiling with -@ will now cause dtc to assign phandles to all labelled nodes - /include/ and /incbin/ now handle absolute paths correctly - The manpage now has information about overlays, including how to apply them and how to generate them - Syntactic sugar for overlays is now supported, allowing an overlay DTS like: = /dts-v1/; /plugin/; { foo,status = "okay"; }; = to generate a fragment targetting <>. Modified: stable/11/usr.bin/dtc/Makefile stable/11/usr.bin/dtc/dtc.1 stable/11/usr.bin/dtc/dtc.cc stable/11/usr.bin/dtc/fdt.cc stable/11/usr.bin/dtc/fdt.hh stable/11/usr.bin/dtc/input_buffer.cc stable/11/usr.bin/dtc/input_buffer.hh Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/dtc/Makefile == --- stable/11/usr.bin/dtc/Makefile Sat Jan 27 22:49:34 2018 (r328494) +++ stable/11/usr.bin/dtc/Makefile Sat Jan 27 22:50:26 2018 (r328495) @@ -4,8 +4,6 @@ PROG_CXX=dtc SRCS= dtc.cc input_buffer.cc string.cc dtb.cc fdt.cc checking.cc MAN= dtc.1 -WARNS?=3 - CXXFLAGS+= -std=c++11 -fno-rtti -fno-exceptions NO_SHARED?=NO Modified: stable/11/usr.bin/dtc/dtc.1 == --- stable/11/usr.bin/dtc/dtc.1 Sat Jan 27 22:49:34 2018(r328494) +++ stable/11/usr.bin/dtc/dtc.1 Sat Jan 27 22:50:26 2018(r328495) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\"/ -.Dd January 1, 2013 +.Dd January 17, 2018 .Dt DTC 1 .Os .Sh NAME @@ -57,7 +57,7 @@ The .Nm utility converts flattened device tree (FDT) representations. - It is most commonly used to generate device tree blobs (DTB), the binary +It is most commonly used to generate device tree blobs (DTB), the binary representation of an FDT, from device tree sources (DTS), the ASCII text source representation. .Pp @@ -153,9 +153,9 @@ format for property values. These allow property value to be specified on the command line. .It Fl R Ar entries The number of empty reservation table entries to pad the table with. -This is -useful if you are generating a device tree blob for bootloader or similar that -needs to reserve some memory before passing control to the operating system. +This is useful if you are generating a device tree blob for bootloader or +similar that needs to reserve some memory before passing control to the +operating system. .It Fl S Ar bytes The minimum size in bytes of the blob. The blob will be padded after the strings table to ensure that it is the @@ -244,6 +244,54 @@ Checks that all .Va /delete-node/ statements refer to nodes that are merged. .El +.Sh OVERLAYS +The utility provides support for generating overlays, also known as plugins. +Overlays are a method of patching a base device tree that has been compiled with +the +.Fl @ +flag, with some limited support for patching device trees that were not compiled +with the +.Fl @ +flag. +.Pp +To denote that a DTS is intended to be used as an overlay, +.Va /plugin/; +should be included in the header, following any applicable +.Va /dts-v1/; +tag. +.Pp +Conventional overlays are crafted by creating +.Va fragment +nodes in a root. +Each fragment node must have either a +.Va target +property set to a label reference, or a +.Va target-path +string property set to a path. +It must then have an +.Va __overlay__ +child node, whose properties and child nodes are merged into the base device +tree when the overlay is applied. +.Pp +Much simpler syntactic sugar was later invented to simplify generating overlays. +Instead of creating targetted fragments manually, one can instead create a root +node that targets a label in the base node using the +.Va +syntax supported in conventional DTS. +This will indicate that a fragment should be generated for the node, with the +given +.Va label +being the target, and the properties and child nodes will be used as the +__overlay__. +.Pp +Both conventional overlays and the later-added syntactic sugar are supported. +.Pp +Overlay blobs can be applied at boot time by setting +.Va fdt_overlays +in +.Xr loader.conf 5 . +Multiple overlays may be specified, and they will be applied in the order given. +.El .Sh EXAMPLES The command: .Pp @@ -254,8 +302,7 @@ will generate a file from the device tree source .Pa device.dts and print
svn commit: r328494 - head/lib/libcasper/services/cap_random
Author: oshogbo Date: Sat Jan 27 22:49:34 2018 New Revision: 328494 URL: https://svnweb.freebsd.org/changeset/base/328494 Log: Document the random Casper service. Reviewed by: bcr@ Differential Revision:https://reviews.freebsd.org/D14072 Added: head/lib/libcasper/services/cap_random/cap_random.3 (contents, props changed) Added: head/lib/libcasper/services/cap_random/cap_random.3 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libcasper/services/cap_random/cap_random.3 Sat Jan 27 22:49:34 2018(r328494) @@ -0,0 +1,98 @@ +.\" Copyright (c) 2018 Mariusz Zaborski+.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\"notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\"notice, this list of conditions and the following disclaimer in the +.\"documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd January 27, 2018 +.Dt CAP_RANDOM 3 +.Os +.Sh NAME +.Nm cap_random_buf +.Nd "library for getting entropy in capability mode" +.Sh LIBRARY +.Lb libcap_random +.Sh SYNOPSIS +.In sys/nv.h +.In libcasper.h +.In casper/cap_random.h +.Ft "int" +.Fn cap_random_buf "cap_channel_t *chan" "void *buf" "size_t nbytes" +.Sh DESCRIPTION +The function +.Fn cap_random_buf +is equivalent to +.Xr arc4random_buf 3 +except that the connection to the +.Nm system.random +service needs to be provided. +.Sh EXAMPLES +The following example first opens a capability to casper and then uses this +capability to create the +.Nm system.random +casper service to obtain entropy. +.Bd -literal +cap_channel_t *capcas, *caprandom; +unsigned char buf[16]; +int i; + +/* Open capability to Casper. */ +capcas = cap_init(); +if (capcas == NULL) + err(1, "Unable to contact Casper"); + +/* Enter capability mode sandbox. */ +if (cap_enter() < 0 && errno != ENOSYS) + err(1, "Unable to enter capability mode"); + +/* Use Casper capability to create capability to the system.random service. */ +caprandom = cap_service_open(capcas, "system.random"); +if (caprandom == NULL) + err(1, "Unable to open system.random service"); + +/* Close Casper capability, we don't need it anymore. */ +cap_close(capcas); + +/* Obtain entropy. */ +if (cap_random_buf(caprandom, buf, sizeof(buf)) < 0) + err(1, "Unable to obtain entropy"); + +for (i = 0; i < sizeof(buf); i++) + printf("%.2x ", buf[i]); +printf("\\n"); +.Ed +.Sh SEE ALSO +.Xr cap_enter 2 , +.Xr arc4random_buf 3 , +.Xr err 3 , +.Xr nv 3 , +.Xr capsicum 4 +.Sh AUTHORS +The +.Nm cap_random +service was implemented by +.An Pawel Jakub Dawidek Aq Mt pa...@dawidek.net +under sponsorship from the FreeBSD Foundation. +.Pp +This manual page was written by +.An Mariusz Zaborski Aq Mt osho...@freebsd.org . ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r328492 - head/contrib/opie/libopie
2018-01-27 23:31 GMT+01:00 Dimitry Andric: > On 27 Jan 2018, at 23:20, Ed Schouten wrote: >> >> 2018-01-27 23:16 GMT+01:00 Pedro F. Giffuni : >>>char host[sizeof(utmp.ut_host) + 1]; >>>insecure = 1; >>> >>> - strncpy(host, utmp.ut_host, sizeof(utmp.ut_host)); >>> - host[sizeof(utmp.ut_host)] = 0; >>> + strncpy(host, utmp.ut_host, sizeof(host)); >> >> Wait... This may access utmp.ut_host one byte past the end and no >> longer guarantees that host is null-terminated, right? > > No, strncpy "copies at most len characters from src into dst". Substituting 'len', 'src' and 'dst' gives me: strncpy "copies at most 'sizeof(utmp.ut_host) + 1' characters from 'utmp.ut_host' into 'host'". As 'utmp.ut_host' is not guaranteed to be null-terminated by POSIX*, it can actually end up in the situation where it copies 'sizeof(utmp.ut_host) + 1' characters, which may leave 'host' unterminated. -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r328492 - head/contrib/opie/libopie
On 27 Jan 2018, at 23:20, Ed Schoutenwrote: > > 2018-01-27 23:16 GMT+01:00 Pedro F. Giffuni : >>char host[sizeof(utmp.ut_host) + 1]; >>insecure = 1; >> >> - strncpy(host, utmp.ut_host, sizeof(utmp.ut_host)); >> - host[sizeof(utmp.ut_host)] = 0; >> + strncpy(host, utmp.ut_host, sizeof(host)); > > Wait... This may access utmp.ut_host one byte past the end and no > longer guarantees that host is null-terminated, right? No, strncpy "copies at most len characters from src into dst". However, if the length of the source is equal to or greater than len, the destination is *not* null terminated. This is likely why the "host[sizeof(utmp.ut_host)] = 0;" statement was added. In any case, this is why strlcpy exists. :) -Dimitry signature.asc Description: Message signed with OpenPGP
svn commit: r328493 - head/lib/libthr/thread
Author: pfg Date: Sat Jan 27 22:27:55 2018 New Revision: 328493 URL: https://svnweb.freebsd.org/changeset/base/328493 Log: libthr: Fix missing break in switch. This is also a warning in recent GCC with -Wimplicit-fallthrough. CID: 1356262 Obtained from:DragonFly (git 0f037c78 - partial) Modified: head/lib/libthr/thread/thr_printf.c Modified: head/lib/libthr/thread/thr_printf.c == --- head/lib/libthr/thread/thr_printf.c Sat Jan 27 22:16:19 2018 (r328492) +++ head/lib/libthr/thread/thr_printf.c Sat Jan 27 22:27:55 2018 (r328493) @@ -95,6 +95,7 @@ next: c = *fmt++; case 'p': pstr(fd, "0x"); islong = 1; + /* FALLTHROUGH */ case 'd': case 'u': case 'x': ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r328492 - head/contrib/opie/libopie
Hi Pedro, 2018-01-27 23:16 GMT+01:00 Pedro F. Giffuni: > char host[sizeof(utmp.ut_host) + 1]; > insecure = 1; > > - strncpy(host, utmp.ut_host, sizeof(utmp.ut_host)); > - host[sizeof(utmp.ut_host)] = 0; > + strncpy(host, utmp.ut_host, sizeof(host)); Wait... This may access utmp.ut_host one byte past the end and no longer guarantees that host is null-terminated, right? -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r328492 - head/contrib/opie/libopie
Author: pfg Date: Sat Jan 27 22:16:19 2018 New Revision: 328492 URL: https://svnweb.freebsd.org/changeset/base/328492 Log: Fix gcc80 -Wsizeof-pointer-memaccess warning. Obtained from:DragonFlyBSD (git 56267d362d5769c8df07bf26d5e322610e0d24b4) Modified: head/contrib/opie/libopie/insecure.c Modified: head/contrib/opie/libopie/insecure.c == --- head/contrib/opie/libopie/insecure.cSat Jan 27 21:25:45 2018 (r328491) +++ head/contrib/opie/libopie/insecure.cSat Jan 27 22:16:19 2018 (r328492) @@ -135,8 +135,7 @@ int opieinsecure FUNCTION_NOARGS char host[sizeof(utmp.ut_host) + 1]; insecure = 1; - strncpy(host, utmp.ut_host, sizeof(utmp.ut_host)); - host[sizeof(utmp.ut_host)] = 0; + strncpy(host, utmp.ut_host, sizeof(host)); if (s = strchr(host, ':')) { int n = s - host; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r328474 - head/sys/contrib/libnv
On Sat, Jan 27, 2018 at 07:32:39AM -0800, Cy Schubert wrote: > In message <201801271258.w0rcwml0078...@repo.freebsd.org>, Mariusz Zaborski > wri > tes: > > Author: oshogbo > > Date: Sat Jan 27 12:58:21 2018 > > New Revision: 328474 > > URL: https://svnweb.freebsd.org/changeset/base/328474 > > > > Log: > > Add SPDX tags for nv(9). > > > > MFC after:2 weeks > > > > Modified: > > head/sys/contrib/libnv/cnvlist.c > > head/sys/contrib/libnv/dnvlist.c > > head/sys/contrib/libnv/nv_impl.h > > head/sys/contrib/libnv/nvlist.c > > head/sys/contrib/libnv/nvlist_impl.h > > head/sys/contrib/libnv/nvpair.c > > head/sys/contrib/libnv/nvpair_impl.h > > > > When was it decided to add SPDX to contrib? The nv was development for and in FreeBSD. First whole library was in lib/libnv. Then the part which is also in the kernel was moved to sys/kern and sys/sys directories. The problem with that was that evrything in the sys/sys is instaled in /usr/include and in the *_impl.h we have things that should not be accesible by developers. This was the main reason of moving libnv to contrib file at the time. If you have any other place where libnv can be kept I'm happy to move it. Thanks, -- Mariusz Zaborski oshogbo//vx | http://oshogbo.vexillium.org FreeBSD commiter| https://freebsd.org Software developer | http://wheelsystems.com If it's not broken, let's fix it till it is!!1 signature.asc Description: PGP signature
Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules
On Jan 27, 2018 2:32 PM, "Rodney W. Grimes"wrote: > On Sat, 27 Jan 2018 12:13:57 -0800 > Adrian Chadd wrote: > > > Hi, > > > > Find the middle ground. Don't dissuade the developer too much. > > This is what happened two years ago when I started hacking on the > allwinner SoCs : > > - I asked what should be done for bringing a new board > - andrew@ told me that we first need to switch to upstream dts and > update drivers. > - Guess what, I did that. Great, thats good co-operatation and communications, sometimes though it is not so smooth. The better we become at dealing with the not so smooth the faster forward progress can be made. The path we are on is the fastest. > > Here's an example: > > > > Make the driver follow DTS, allow a tunable/kenv check for it to > > override whether it needs to be in the DTS or not (the "keep phk happy > > for now" compromise) and have it default to obeying the device tree. > > > > That way phk is kept happy and the defaults are the same as normal-ish > > ARM /and/ you have a springboard to experiment with extending FDT > > overlays at runtime for people who wish to do so. > > I don't care about keeping phk@ (or any other developer) happy, we > have a standard, let's stick to it. *sigh* Let me ask you if you do not care about keeping any other developers happy, why should any of them be concerned about keeping you happy? We need to always try to find middle ground and co-operate in positive ways. On the "we have a standard" front, well when standards get in the way of forward progress they are often side stepped. Maybe this standard is not such a good standard and warts are going to form around it. I have seen some discusssion at least on ways to improve the current situation, hopefully someone takes them and runs with them. Others have pointed out they do not like the current model in that it gets in the way of developement progress. I can see this point. I can see phk's points, and I can see your points. IMHO if we shove the standard down our own throats we are in effect cutting our hands off in the process, not somethig we really want to do is it? It beats the chaos we had before where nothing was leveraged and everything was a custom hack. > > (I personally hate having to edit the dts/recompile/reboot for every > > test hardware change; it makes breadboarding things up kinda > > hilariously annoying.) > > Use overlays then. And if you don't want to reboot provide patch for > loading overlays at runtime. Are those the only solutions? Yes. Unless you show up with a boatload of work. There is a decade of history here that I'm loathe to just ignore. I have some WiP that will make things better, but it is complicated. You can't just enable the device. You have to change the pinctl stuff too. People saying just do this hack or that hack which ignores this will be ignored as their solution is incomplete (and basically useless). My advice is to see where we are once I find a few minutes to finish my WiP before pronouncing the right way forward. Or you can comment on the design I sent a week ago. Warner > > -adrian > Emmanuel Vadot -- Rod Grimes rgri...@freebsd.org ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r328486 - head/usr.bin/fortune/fortune
Hi; On 01/27/18 14:56, Conrad Meyer wrote: We can use 'true' and 'false' now. (style(9) also suggests using the C99 names instead of TRUE/FALSE.) Yes, I noticed that change in DragonflyBSD but it is conceptually a different change and it deserves a different commit. Pedro. On Sat, Jan 27, 2018 at 9:43 AM, Pedro F. Giffuniwrote: Author: pfg Date: Sat Jan 27 17:43:09 2018 New Revision: 328486 URL: https://svnweb.freebsd.org/changeset/base/328486 Log: fortune(6): Fix gcc80 -Wbool-operation warnings. Hinted by:Dragonfly (git 4d1086765752f0569497d06460d95117c74f33ac) Modified: head/usr.bin/fortune/fortune/fortune.c Modified: head/usr.bin/fortune/fortune/fortune.c == --- head/usr.bin/fortune/fortune/fortune.c Sat Jan 27 17:24:59 2018 (r328485) +++ head/usr.bin/fortune/fortune/fortune.c Sat Jan 27 17:43:09 2018 (r328486) @@ -289,35 +289,35 @@ getargs(int argc, char *argv[]) #endif /* DEBUG */ switch(ch) { case 'a': /* any fortune */ - All_forts++; + All_forts = TRUE; break; #ifdef DEBUG case 'D': Debug++; break; #endif /* DEBUG */ - case 'e': - Equal_probs++; /* scatter un-allocted prob equally */ + case 'e': /* scatter un-allocted prob equally */ + Equal_probs = TRUE; break; case 'f': /* find fortune files */ - Find_files++; + Find_files = TRUE; break; case 'l': /* long ones only */ - Long_only++; + Long_only = TRUE; Short_only = FALSE; break; case 'o': /* offensive ones only */ - Offend++; + Offend = TRUE; break; case 's': /* short ones only */ - Short_only++; + Short_only = TRUE; Long_only = FALSE; break; case 'w': /* give time to read */ - Wait++; + Wait = TRUE; break; case 'm': /* dump out the fortunes */ - Match++; + Match = TRUE; pat = optarg; break; case 'i': /* case-insensitive match */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules
> On Sat, 27 Jan 2018 12:13:57 -0800 > Adrian Chaddwrote: > > > Hi, > > > > Find the middle ground. Don't dissuade the developer too much. > > This is what happened two years ago when I started hacking on the > allwinner SoCs : > > - I asked what should be done for bringing a new board > - andrew@ told me that we first need to switch to upstream dts and > update drivers. > - Guess what, I did that. Great, thats good co-operatation and communications, sometimes though it is not so smooth. The better we become at dealing with the not so smooth the faster forward progress can be made. > > Here's an example: > > > > Make the driver follow DTS, allow a tunable/kenv check for it to > > override whether it needs to be in the DTS or not (the "keep phk happy > > for now" compromise) and have it default to obeying the device tree. > > > > That way phk is kept happy and the defaults are the same as normal-ish > > ARM /and/ you have a springboard to experiment with extending FDT > > overlays at runtime for people who wish to do so. > > I don't care about keeping phk@ (or any other developer) happy, we > have a standard, let's stick to it. *sigh* Let me ask you if you do not care about keeping any other developers happy, why should any of them be concerned about keeping you happy? We need to always try to find middle ground and co-operate in positive ways. On the "we have a standard" front, well when standards get in the way of forward progress they are often side stepped. Maybe this standard is not such a good standard and warts are going to form around it. I have seen some discusssion at least on ways to improve the current situation, hopefully someone takes them and runs with them. Others have pointed out they do not like the current model in that it gets in the way of developement progress. I can see this point. I can see phk's points, and I can see your points. IMHO if we shove the standard down our own throats we are in effect cutting our hands off in the process, not somethig we really want to do is it? > > (I personally hate having to edit the dts/recompile/reboot for every > > test hardware change; it makes breadboarding things up kinda > > hilariously annoying.) > > Use overlays then. And if you don't want to reboot provide patch for > loading overlays at runtime. Are those the only solutions? > > -adrian > Emmanuel Vadot -- Rod Grimes rgri...@freebsd.org ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r328491 - head/sys/contrib/libfdt
Author: kevans Date: Sat Jan 27 21:25:45 2018 New Revision: 328491 URL: https://svnweb.freebsd.org/changeset/base/328491 Log: MFV r328490: Update libfdt to github:f1879e1 Pulls in a patch, now upstreamed, from nwhitehorn to add limited read-only support for older (v2 and v3) FDT blobs. MFC after:1 week Modified: head/sys/contrib/libfdt/fdt.c head/sys/contrib/libfdt/fdt_overlay.c head/sys/contrib/libfdt/fdt_ro.c head/sys/contrib/libfdt/libfdt.h Directory Properties: head/sys/contrib/libfdt/ (props changed) Modified: head/sys/contrib/libfdt/fdt.c == --- head/sys/contrib/libfdt/fdt.c Sat Jan 27 21:22:10 2018 (r328490) +++ head/sys/contrib/libfdt/fdt.c Sat Jan 27 21:25:45 2018 (r328491) @@ -123,6 +123,9 @@ uint32_t fdt_next_tag(const void *fdt, int startoffset /* skip-name offset, length and value */ offset += sizeof(struct fdt_property) - FDT_TAGSIZE + fdt32_to_cpu(*lenp); + if (fdt_version(fdt) < 0x10 && fdt32_to_cpu(*lenp) >= 8 && + ((offset - fdt32_to_cpu(*lenp)) % 8) != 0) + offset += 4; break; case FDT_END: Modified: head/sys/contrib/libfdt/fdt_overlay.c == --- head/sys/contrib/libfdt/fdt_overlay.c Sat Jan 27 21:22:10 2018 (r328490) +++ head/sys/contrib/libfdt/fdt_overlay.c Sat Jan 27 21:25:45 2018 (r328491) @@ -1,3 +1,54 @@ +/* + * libfdt - Flat Device Tree manipulation + * Copyright (C) 2016 Free Electrons + * Copyright (C) 2016 NextThing Co. + * + * libfdt is dual licensed: you can use it either under the terms of + * the GPL, or the BSD license, at your option. + * + * a) This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + * MA 02110-1301 USA + * + * Alternatively, + * + * b) Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * 1. Redistributions of source code must retain the above + *copyright notice, this list of conditions and the following + *disclaimer. + * 2. Redistributions in binary form must reproduce the above + *copyright notice, this list of conditions and the following + *disclaimer in the documentation and/or other materials + *provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #include "libfdt_env.h" #include Modified: head/sys/contrib/libfdt/fdt_ro.c == --- head/sys/contrib/libfdt/fdt_ro.cSat Jan 27 21:22:10 2018 (r328490) +++ head/sys/contrib/libfdt/fdt_ro.cSat Jan 27 21:25:45 2018 (r328491) @@ -58,9 +58,10 @@ static int fdt_nodename_eq_(const void *fdt, int offset, const char *s, int len) { - const char *p = fdt_offset_ptr(fdt, offset + FDT_TAGSIZE, len+1); + int olen; + const char *p = fdt_get_name(fdt, offset, ); - if (!p) + if (!p || olen < len) /* short match */ return 0; @@ -233,16 +234,34 @@ int fdt_path_offset(const void *fdt, const char *path) const char *fdt_get_name(const void *fdt, int nodeoffset, int *len) {
svn commit: r328490 - vendor-sys/libfdt/dist
Author: kevans Date: Sat Jan 27 21:22:10 2018 New Revision: 328490 URL: https://svnweb.freebsd.org/changeset/base/328490 Log: Update libfdt to github:f1879e1 Pulls in a patch, now upstreamed, from nwhitehorn to add limited read-only support for older (v2 and v3) FDT blobs. Modified: vendor-sys/libfdt/dist/fdt.c vendor-sys/libfdt/dist/fdt_overlay.c vendor-sys/libfdt/dist/fdt_ro.c vendor-sys/libfdt/dist/libfdt.h Modified: vendor-sys/libfdt/dist/fdt.c == --- vendor-sys/libfdt/dist/fdt.cSat Jan 27 20:13:36 2018 (r328489) +++ vendor-sys/libfdt/dist/fdt.cSat Jan 27 21:22:10 2018 (r328490) @@ -123,6 +123,9 @@ uint32_t fdt_next_tag(const void *fdt, int startoffset /* skip-name offset, length and value */ offset += sizeof(struct fdt_property) - FDT_TAGSIZE + fdt32_to_cpu(*lenp); + if (fdt_version(fdt) < 0x10 && fdt32_to_cpu(*lenp) >= 8 && + ((offset - fdt32_to_cpu(*lenp)) % 8) != 0) + offset += 4; break; case FDT_END: Modified: vendor-sys/libfdt/dist/fdt_overlay.c == --- vendor-sys/libfdt/dist/fdt_overlay.cSat Jan 27 20:13:36 2018 (r328489) +++ vendor-sys/libfdt/dist/fdt_overlay.cSat Jan 27 21:22:10 2018 (r328490) @@ -1,3 +1,54 @@ +/* + * libfdt - Flat Device Tree manipulation + * Copyright (C) 2016 Free Electrons + * Copyright (C) 2016 NextThing Co. + * + * libfdt is dual licensed: you can use it either under the terms of + * the GPL, or the BSD license, at your option. + * + * a) This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + * MA 02110-1301 USA + * + * Alternatively, + * + * b) Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * 1. Redistributions of source code must retain the above + *copyright notice, this list of conditions and the following + *disclaimer. + * 2. Redistributions in binary form must reproduce the above + *copyright notice, this list of conditions and the following + *disclaimer in the documentation and/or other materials + *provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #include "libfdt_env.h" #include Modified: vendor-sys/libfdt/dist/fdt_ro.c == --- vendor-sys/libfdt/dist/fdt_ro.c Sat Jan 27 20:13:36 2018 (r328489) +++ vendor-sys/libfdt/dist/fdt_ro.c Sat Jan 27 21:22:10 2018 (r328490) @@ -58,9 +58,10 @@ static int fdt_nodename_eq_(const void *fdt, int offset, const char *s, int len) { - const char *p = fdt_offset_ptr(fdt, offset + FDT_TAGSIZE, len+1); + int olen; + const char *p = fdt_get_name(fdt, offset, ); - if (!p) + if (!p || olen < len) /* short match */ return 0; @@ -233,16 +234,34 @@ int fdt_path_offset(const void *fdt, const char *path) const char *fdt_get_name(const void *fdt, int nodeoffset, int *len) { const struct fdt_node_header *nh = fdt_offset_ptr_(fdt, nodeoffset); + const char *nameptr; int err;
Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules
Adrian Chadd (adrian.ch...@gmail.com) wrote: > Hi, > > Find the middle ground. Don't dissuade the developer too much. > > Here's an example: > > Make the driver follow DTS, allow a tunable/kenv check for it to > override whether it needs to be in the DTS or not (the "keep phk happy > for now" compromise) and have it default to obeying the device tree. > > That way phk is kept happy and the defaults are the same as normal-ish > ARM /and/ you have a springboard to experiment with extending FDT > overlays at runtime for people who wish to do so. This doesn't sound right. I'm 100% with manu@ on this: driver needs to be modified to follow DTS. A lot of work was spent to get FreeBSD FDT support consistent over multiple platforms and to make sure it conforms standard. When it comes to FDT support Pi port is inferior to the majority of platforms that have been added later. I bear a fair share of responsibility for this mess and it makes me appreciate all the effort spent on correcting the situation even more. Adding changes that violate standard and undermine all that work for the convenience of a single developer is plain wrong. If current framework is not good enough the way to go is to improve it, not hack around its limitations -- gonzo ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules
On Sat, 27 Jan 2018 12:13:57 -0800 Adrian Chaddwrote: > Hi, > > Find the middle ground. Don't dissuade the developer too much. This is what happened two years ago when I started hacking on the allwinner SoCs : - I asked what should be done for bringing a new board - andrew@ told me that we first need to switch to upstream dts and update drivers. - Guess what, I did that. > Here's an example: > > Make the driver follow DTS, allow a tunable/kenv check for it to > override whether it needs to be in the DTS or not (the "keep phk happy > for now" compromise) and have it default to obeying the device tree. > > That way phk is kept happy and the defaults are the same as normal-ish > ARM /and/ you have a springboard to experiment with extending FDT > overlays at runtime for people who wish to do so. I don't care about keeping phk@ (or any other developer) happy, we have a standard, let's stick to it. > (I personally hate having to edit the dts/recompile/reboot for every > test hardware change; it makes breadboarding things up kinda > hilariously annoying.) Use overlays then. And if you don't want to reboot provide patch for loading overlays at runtime. > -adrian -- Emmanuel Vadot ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r328489 - head/sys/conf
Am Sat, 27 Jan 2018 20:13:36 + (UTC) "Jason A. Harmening"schrieb: > Author: jah > Date: Sat Jan 27 20:13:36 2018 > New Revision: 328489 > URL: https://svnweb.freebsd.org/changeset/base/328489 > > Log: > Remove system makefile path directives from env passed to PORTS_MODULES step > > Previously, MAKESYSPATH as well as '-m' directives in MAKEFLAGS would cause > any port rebuilt during the PORTS_MODULES stage to consume system makefiles > from $(SRCROOT)/share/mk instead of those installed under /usr/share/mk. > For kernel modules that need to build against an updated src tree this > makes sense; less so for or any userspace library or utility > the port may also happen to install. > > Before 11.0, this probably didn't matter much in practice. But the addition > of src.libnames.mk under $(SRCROOT)/share/mk in 11.0 breaks any consumer of > bsd.prog.mk and DPADD/LDADD during PORTS_MODULES. > > Address the build breakage by removing MAKESYSPATH and any occurrence of > '-m' from MAKEFLAGS in the environment created for the port build. > Instead set SYSDIR so that any kmod built by the port will still consume > conf/kmod.mk from the updated src tree, assuming it uses > > Reviewed by:bdrewery > MFC after: 2 weeks > Differential Revision: https://reviews.freebsd.org/D13053 > > Modified: > head/sys/conf/kern.post.mk > > Modified: head/sys/conf/kern.post.mk > == > --- head/sys/conf/kern.post.mkSat Jan 27 19:23:42 2018 > (r328488) > +++ head/sys/conf/kern.post.mkSat Jan 27 20:13:36 2018 > (r328489) > @@ -69,6 +69,9 @@ PORTSMODULESENV=\ > -u CC \ > -u CXX \ > -u CPP \ > + -u MAKESYSPATH \ > + MAKEFLAGS="${MAKEFLAGS:M*:tW:S/^-m /-m_/g:S/ -m / -m_/g:tw:N-m_*}" \ > + SYSDIR=${SYSDIR} \ > PATH=${PATH}:${LOCALBASE}/bin:${LOCALBASE}/sbin \ > SRC_BASE=${SRC_BASE} \ > OSVERSION=${OSRELDATE} \ > ___ > svn-src-h...@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" This happens now if PORTS_MODULE=x11/nvidia-driver is defined in /etc/src.conf: [...] --- kernel-install --- mkdir -p /boot/kernel install -p -m 555 -o root -g wheel kernel /boot/kernel/ --- ports-install --- Variable OBJTOP is recursive. make[8]: stopped in /usr/obj/usr/src/amd64.amd64/sys/FY/usr/ports/x11/nvidia-driver/work/NVIDIA-FreeBSD-x86_64-387.34/src/nvidia *** Error code 2 Stop. make[7]: stopped in /usr/obj/usr/src/amd64.amd64/sys/THOR/usr/ports/x11/nvidia-driver/work/NVIDIA-FreeBSD-x86_64-387.34/src *** Error code 1 -- O. Hartmann Ich widerspreche der Nutzung oder Übermittlung meiner Daten für Werbezwecke oder für die Markt- oder Meinungsforschung (§ 28 Abs. 4 BDSG). pgpAuRP5P2NWc.pgp Description: OpenPGP digital signature
Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules
Hi, Find the middle ground. Don't dissuade the developer too much. Here's an example: Make the driver follow DTS, allow a tunable/kenv check for it to override whether it needs to be in the DTS or not (the "keep phk happy for now" compromise) and have it default to obeying the device tree. That way phk is kept happy and the defaults are the same as normal-ish ARM /and/ you have a springboard to experiment with extending FDT overlays at runtime for people who wish to do so. (I personally hate having to edit the dts/recompile/reboot for every test hardware change; it makes breadboarding things up kinda hilariously annoying.) -adrian ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r328489 - head/sys/conf
Author: jah Date: Sat Jan 27 20:13:36 2018 New Revision: 328489 URL: https://svnweb.freebsd.org/changeset/base/328489 Log: Remove system makefile path directives from env passed to PORTS_MODULES step Previously, MAKESYSPATH as well as '-m' directives in MAKEFLAGS would cause any port rebuilt during the PORTS_MODULES stage to consume system makefiles from $(SRCROOT)/share/mk instead of those installed under /usr/share/mk. For kernel modules that need to build against an updated src tree this makes sense; less so for or any userspace library or utility the port may also happen to install. Before 11.0, this probably didn't matter much in practice. But the addition of src.libnames.mk under $(SRCROOT)/share/mk in 11.0 breaks any consumer of bsd.prog.mk and DPADD/LDADD during PORTS_MODULES. Address the build breakage by removing MAKESYSPATH and any occurrence of '-m' from MAKEFLAGS in the environment created for the port build. Instead set SYSDIR so that any kmod built by the port will still consume conf/kmod.mk from the updated src tree, assuming it uses Reviewed by: bdrewery MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D13053 Modified: head/sys/conf/kern.post.mk Modified: head/sys/conf/kern.post.mk == --- head/sys/conf/kern.post.mk Sat Jan 27 19:23:42 2018(r328488) +++ head/sys/conf/kern.post.mk Sat Jan 27 20:13:36 2018(r328489) @@ -69,6 +69,9 @@ PORTSMODULESENV=\ -u CC \ -u CXX \ -u CPP \ + -u MAKESYSPATH \ + MAKEFLAGS="${MAKEFLAGS:M*:tW:S/^-m /-m_/g:S/ -m / -m_/g:tw:N-m_*}" \ + SYSDIR=${SYSDIR} \ PATH=${PATH}:${LOCALBASE}/bin:${LOCALBASE}/sbin \ SRC_BASE=${SRC_BASE} \ OSVERSION=${OSRELDATE} \ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r328257 - in head/sys: arm/broadcom/bcm2835 dts/arm modules
So, almost a week after this commit, let's recap. - phk@ commit an hack to allow the pwm driver on rpi to always attach even if it's not enabled in the dts. - I say to him that it's a really bad move and that he should use dtb overlays (which thanks to kevans@ are in a really better state now). - His answer is that as long as you don't set the pwm sysctls you will be fine (which is true) and that he want to be able to load dtb overlays without rebooting (or a way to modify the existing dtb loaded in the kernel). - I reply that changing the dtb should go with overlays and that nobody is working on loading overlays at runtime. - His reply starts with "That doesn't make *any* UX sense." - The "problem" is we (FreeBSD) choose to followed the standard that is Flattened Device Tree and stick to it for arm (at least) platform. - phk@ says that if a user kldload the pwm driver on a rpi the pwm subsystem should be in a usable state. And doesn't want to talk anymore ("Over). - jhb@ and imp@ talk about ways to improve the fdt subsystem. - ian@ point to phk@ that the 'status' line in the dts control more than a device but also pinmuxing (switching pins on the SoC to the correct function) and that is it done at startup and not at the driver attach. And that the rpi platform needs some love as it doesn't have a proper pinmux driver. - phk@ points out that there is no doc about doing a pinmux driver (which is true, unless you consider code as documentation or even help/advice from other arm developpers). But. - We still have this driver that doesn't follow the standard we said we want to adhere to. - Nobody except me explicitly request phk@ to revert his commit (which he didn't do). - One day after everything was back to normal and everybody forgot about this. So. - We have a commiter that commited something for his own need: he wanted to use the pwm on his rpi, coded a driver (this part is good) but feel that the standard we were using was crap and commited his work without talking with arm developper on what the proper way to do it was. - Even after some developpers point out that it wasn't the way to go he didn't revert his commit. And even he didn't say that he won't, his mail suggest that he will not. - Now we have a crappy driver in the tree. What's next ? Cheers, -- Emmanuel Vadot___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r328486 - head/usr.bin/fortune/fortune
We can use 'true' and 'false' now. (style(9) also suggests using the C99 names instead of TRUE/FALSE.) On Sat, Jan 27, 2018 at 9:43 AM, Pedro F. Giffuniwrote: > Author: pfg > Date: Sat Jan 27 17:43:09 2018 > New Revision: 328486 > URL: https://svnweb.freebsd.org/changeset/base/328486 > > Log: > fortune(6): Fix gcc80 -Wbool-operation warnings. > > Hinted by:Dragonfly (git 4d1086765752f0569497d06460d95117c74f33ac) > > Modified: > head/usr.bin/fortune/fortune/fortune.c > > Modified: head/usr.bin/fortune/fortune/fortune.c > == > --- head/usr.bin/fortune/fortune/fortune.c Sat Jan 27 17:24:59 2018 > (r328485) > +++ head/usr.bin/fortune/fortune/fortune.c Sat Jan 27 17:43:09 2018 > (r328486) > @@ -289,35 +289,35 @@ getargs(int argc, char *argv[]) > #endif /* DEBUG */ > switch(ch) { > case 'a': /* any fortune */ > - All_forts++; > + All_forts = TRUE; > break; > #ifdef DEBUG > case 'D': > Debug++; > break; > #endif /* DEBUG */ > - case 'e': > - Equal_probs++; /* scatter un-allocted prob equally */ > + case 'e': /* scatter un-allocted prob equally */ > + Equal_probs = TRUE; > break; > case 'f': /* find fortune files */ > - Find_files++; > + Find_files = TRUE; > break; > case 'l': /* long ones only */ > - Long_only++; > + Long_only = TRUE; > Short_only = FALSE; > break; > case 'o': /* offensive ones only */ > - Offend++; > + Offend = TRUE; > break; > case 's': /* short ones only */ > - Short_only++; > + Short_only = TRUE; > Long_only = FALSE; > break; > case 'w': /* give time to read */ > - Wait++; > + Wait = TRUE; > break; > case 'm': /* dump out the fortunes */ > - Match++; > + Match = TRUE; > pat = optarg; > break; > case 'i': /* case-insensitive match */ > ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r328488 - in head: contrib/traceroute usr.sbin/traceroute6
Author: tuexen Date: Sat Jan 27 19:23:42 2018 New Revision: 328488 URL: https://svnweb.freebsd.org/changeset/base/328488 Log: When using SCTP for sending probe packets, use INIT chunks for payloads larger than or equal to 32 bytes. For smaller probe packets, keep using SHUTDOWN-ACK chunks, possibly bundled with a PAD chunk. Packets with INIT chunks more likely pass through firewalls. Therefore, use them when possible. MFC after:1 week Modified: head/contrib/traceroute/traceroute.c head/usr.sbin/traceroute6/traceroute6.8 head/usr.sbin/traceroute6/traceroute6.c Modified: head/contrib/traceroute/traceroute.c == --- head/contrib/traceroute/traceroute.cSat Jan 27 18:24:13 2018 (r328487) +++ head/contrib/traceroute/traceroute.cSat Jan 27 19:23:42 2018 (r328488) @@ -221,6 +221,7 @@ static const char rcsid[] = #include #include #include +#include #include #include #include @@ -1570,26 +1571,71 @@ sctp_prep(struct outdata *outdata) { struct sctphdr *const sctp = (struct sctphdr *) outp; struct sctp_chunkhdr *chk; + struct sctp_init_chunk *init; + struct sctp_paramhdr *param; sctp->src_port = htons(ident); sctp->dest_port = htons(port + (fixedPort ? 0 : outdata->seq)); - sctp->v_tag = (sctp->src_port << 16) | sctp->dest_port; + if (protlen >= (int)(sizeof(struct sctphdr) + + sizeof(struct sctp_init_chunk))) { + sctp->v_tag = 0; + } else { + sctp->v_tag = (sctp->src_port << 16) | sctp->dest_port; + } sctp->checksum = htonl(0); - if (protlen >= - (int)(sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr))) { - chk = (struct sctp_chunkhdr *)(sctp + 1); - chk->chunk_type = SCTP_SHUTDOWN_ACK; - chk->chunk_flags = 0; - chk->chunk_length = htons(4); + if (protlen >= (int)(sizeof(struct sctphdr) + + sizeof(struct sctp_init_chunk))) { + /* +* Send a packet containing an INIT chunk. This works +* better in case of firewalls on the path, but +* results in a probe packet containing at least +* 32 bytes of payload. For shorter payloads, use +* SHUTDOWN-ACK chunks. +*/ + init = (struct sctp_init_chunk *)(sctp + 1); + init->ch.chunk_type = SCTP_INITIATION; + init->ch.chunk_flags = 0; + init->ch.chunk_length = htons((u_int16_t)(protlen - + sizeof(struct sctphdr))); + init->init.initiate_tag = (sctp->src_port << 16) | + sctp->dest_port; + init->init.a_rwnd = htonl(1500); + init->init.num_outbound_streams = htons(1); + init->init.num_inbound_streams = htons(1); + init->init.initial_tsn = htonl(0); + if (protlen >= (int)(sizeof(struct sctphdr) + + sizeof(struct sctp_init_chunk) + + sizeof(struct sctp_paramhdr))) { + param = (struct sctp_paramhdr *)(init + 1); + param->param_type = htons(SCTP_PAD); + param->param_length = + htons((u_int16_t)(protlen - + sizeof(struct sctphdr) - + sizeof(struct sctp_init_chunk))); + } + } else { + /* +* Send a packet containing a SHUTDOWN-ACK chunk, +* possibly followed by a PAD chunk. +*/ + if (protlen >= + (int)(sizeof(struct sctphdr) + + sizeof(struct sctp_chunkhdr))) { + chk = (struct sctp_chunkhdr *)(sctp + 1); + chk->chunk_type = SCTP_SHUTDOWN_ACK; + chk->chunk_flags = 0; + chk->chunk_length = htons(4); + } + if (protlen >= + (int)(sizeof(struct sctphdr) + + 2 * sizeof(struct sctp_chunkhdr))) { + chk = chk + 1; + chk->chunk_type = SCTP_PAD_CHUNK; + chk->chunk_flags = 0; + chk->chunk_length = htons(protlen - + (sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr))); + } } - if (protlen >= - (int)(sizeof(struct sctphdr) + 2 * sizeof(struct sctp_chunkhdr))) { - chk = chk + 1; - chk->chunk_type = SCTP_PAD_CHUNK; - chk->chunk_flags = 0; - chk->chunk_length = htons(protlen - - (sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr))); - } if (doipcksum) {
svn commit: r328487 - head/bin/pax
Author: pfg Date: Sat Jan 27 18:24:13 2018 New Revision: 328487 URL: https://svnweb.freebsd.org/changeset/base/328487 Log: pax(1): Honour the restrict in sigaction(). Use a setup_sig() helper and make it fail when either of sigaction fails. While there, do not leak fds for "." + minor cleanup. Obtained from:OpenBSD (through DragonFly git eca362d0f9bd086cc56d6b5bc4f03f09e040b9db) Modified: head/bin/pax/pax.c Modified: head/bin/pax/pax.c == --- head/bin/pax/pax.c Sat Jan 27 17:43:09 2018(r328486) +++ head/bin/pax/pax.c Sat Jan 27 18:24:13 2018(r328487) @@ -109,7 +109,7 @@ char*tempbase; /* basename of tempfile to use for mk /* * PAX - Portable Archive Interchange * - * A utility to read, write, and write lists of the members of archive + * A utility to read, write, and write lists of the members of archive * files and copy directory hierarchies. A variety of archive formats * are supported (some are described in POSIX 1003.1 10.1): * @@ -237,7 +237,7 @@ main(int argc, char *argv[]) /* * Keep a reference to cwd, so we can always come back home. */ - cwdfd = open(".", O_RDONLY); + cwdfd = open(".", O_RDONLY | O_CLOEXEC); if (cwdfd < 0) { syswarn(0, errno, "Can't open current working directory."); return(exit_val); @@ -249,7 +249,7 @@ main(int argc, char *argv[]) if ((tmpdir = getenv("TMPDIR")) == NULL || *tmpdir == '\0') tmpdir = _PATH_TMP; tdlen = strlen(tmpdir); - while(tdlen > 0 && tmpdir[tdlen - 1] == '/') + while (tdlen > 0 && tmpdir[tdlen - 1] == '/') tdlen--; tempfile = malloc(tdlen + 1 + sizeof(_TFILE_BASE)); if (tempfile == NULL) { @@ -271,7 +271,7 @@ main(int argc, char *argv[]) /* * select a primary operation mode */ - switch(act) { + switch (act) { case EXTRACT: extract(); break; @@ -325,6 +325,25 @@ sig_cleanup(int which_sig) } /* + * setup_sig() + * set a signal to be caught, but only if it isn't being ignored already + */ + +static int +setup_sig(int sig, const struct sigaction *n_hand) +{ + struct sigaction o_hand; + + if (sigaction(sig, NULL, _hand) < 0) + return (-1); + + if (o_hand.sa_handler == SIG_IGN) + return (0); + + return (sigaction(sig, n_hand, NULL)); +} + +/* * gen_init() * general setup routines. Not all are required, but they really help * when dealing with a medium to large sized archives. @@ -335,7 +354,6 @@ gen_init(void) { struct rlimit reslimit; struct sigaction n_hand; - struct sigaction o_hand; /* * Really needed to handle large archives. We can run out of memory for @@ -389,34 +407,16 @@ gen_init(void) n_hand.sa_flags = 0; n_hand.sa_handler = sig_cleanup; - if ((sigaction(SIGHUP, _hand, _hand) < 0) && - (o_hand.sa_handler == SIG_IGN) && - (sigaction(SIGHUP, _hand, _hand) < 0)) + if (setup_sig(SIGHUP, _hand) || + setup_sig(SIGTERM, _hand) || + setup_sig(SIGINT, _hand) || + setup_sig(SIGQUIT, _hand) || + setup_sig(SIGXCPU, _hand)) goto out; - if ((sigaction(SIGTERM, _hand, _hand) < 0) && - (o_hand.sa_handler == SIG_IGN) && - (sigaction(SIGTERM, _hand, _hand) < 0)) - goto out; - - if ((sigaction(SIGINT, _hand, _hand) < 0) && - (o_hand.sa_handler == SIG_IGN) && - (sigaction(SIGINT, _hand, _hand) < 0)) - goto out; - - if ((sigaction(SIGQUIT, _hand, _hand) < 0) && - (o_hand.sa_handler == SIG_IGN) && - (sigaction(SIGQUIT, _hand, _hand) < 0)) - goto out; - - if ((sigaction(SIGXCPU, _hand, _hand) < 0) && - (o_hand.sa_handler == SIG_IGN) && - (sigaction(SIGXCPU, _hand, _hand) < 0)) - goto out; - n_hand.sa_handler = SIG_IGN; - if ((sigaction(SIGPIPE, _hand, _hand) < 0) || - (sigaction(SIGXFSZ, _hand, _hand) < 0)) + if ((sigaction(SIGPIPE, _hand, NULL) < 0) || + (sigaction(SIGXFSZ, _hand, NULL) < 0)) goto out; return(0); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r328486 - head/usr.bin/fortune/fortune
Author: pfg Date: Sat Jan 27 17:43:09 2018 New Revision: 328486 URL: https://svnweb.freebsd.org/changeset/base/328486 Log: fortune(6): Fix gcc80 -Wbool-operation warnings. Hinted by:Dragonfly (git 4d1086765752f0569497d06460d95117c74f33ac) Modified: head/usr.bin/fortune/fortune/fortune.c Modified: head/usr.bin/fortune/fortune/fortune.c == --- head/usr.bin/fortune/fortune/fortune.c Sat Jan 27 17:24:59 2018 (r328485) +++ head/usr.bin/fortune/fortune/fortune.c Sat Jan 27 17:43:09 2018 (r328486) @@ -289,35 +289,35 @@ getargs(int argc, char *argv[]) #endif /* DEBUG */ switch(ch) { case 'a': /* any fortune */ - All_forts++; + All_forts = TRUE; break; #ifdef DEBUG case 'D': Debug++; break; #endif /* DEBUG */ - case 'e': - Equal_probs++; /* scatter un-allocted prob equally */ + case 'e': /* scatter un-allocted prob equally */ + Equal_probs = TRUE; break; case 'f': /* find fortune files */ - Find_files++; + Find_files = TRUE; break; case 'l': /* long ones only */ - Long_only++; + Long_only = TRUE; Short_only = FALSE; break; case 'o': /* offensive ones only */ - Offend++; + Offend = TRUE; break; case 's': /* short ones only */ - Short_only++; + Short_only = TRUE; Long_only = FALSE; break; case 'w': /* give time to read */ - Wait++; + Wait = TRUE; break; case 'm': /* dump out the fortunes */ - Match++; + Match = TRUE; pat = optarg; break; case 'i': /* case-insensitive match */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r328485 - stable/10/sys/dev/atkbdc
Author: dumbbell Date: Sat Jan 27 17:24:59 2018 New Revision: 328485 URL: https://svnweb.freebsd.org/changeset/base/328485 Log: psm: Log syncmask[1], not syncmask[0] twice MFC of: r328208 Modified: stable/10/sys/dev/atkbdc/psm.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/atkbdc/psm.c == --- stable/10/sys/dev/atkbdc/psm.c Sat Jan 27 17:24:27 2018 (r328484) +++ stable/10/sys/dev/atkbdc/psm.c Sat Jan 27 17:24:59 2018 (r328485) @@ -2411,7 +2411,7 @@ psmintr(void *arg) sc->flags &= ~PSM_NEED_SYNCBITS; VLOG(2, (LOG_DEBUG, "psmintr: Sync bytes now %04x,%04x\n", - sc->mode.syncmask[0], sc->mode.syncmask[0])); + sc->mode.syncmask[0], sc->mode.syncmask[1])); } else if ((c & sc->mode.syncmask[0]) != sc->mode.syncmask[1]) { VLOG(3, (LOG_DEBUG, "psmintr: out of sync " "(%04x != %04x) %d cmds since last error.\n", ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r328484 - stable/11/sys/dev/atkbdc
Author: dumbbell Date: Sat Jan 27 17:24:27 2018 New Revision: 328484 URL: https://svnweb.freebsd.org/changeset/base/328484 Log: psm: Log syncmask[1], not syncmask[0] twice MFC of: r328208 Modified: stable/11/sys/dev/atkbdc/psm.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/atkbdc/psm.c == --- stable/11/sys/dev/atkbdc/psm.c Sat Jan 27 16:56:54 2018 (r328483) +++ stable/11/sys/dev/atkbdc/psm.c Sat Jan 27 17:24:27 2018 (r328484) @@ -2978,7 +2978,7 @@ psmintr(void *arg) sc->flags &= ~PSM_NEED_SYNCBITS; VLOG(2, (LOG_DEBUG, "psmintr: Sync bytes now %04x,%04x\n", - sc->mode.syncmask[0], sc->mode.syncmask[0])); + sc->mode.syncmask[0], sc->mode.syncmask[1])); } else if ((sc->config & PSM_CONFIG_NOCHECKSYNC) == 0 && (c & sc->mode.syncmask[0]) != sc->mode.syncmask[1]) { VLOG(3, (LOG_DEBUG, "psmintr: out of sync " ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r328346 - in head/sys: fs/ext2fs ufs/ffs ufs/ufs
On 01/27/18 11:14, Warner Losh wrote: On Jan 27, 2018 8:17 AM, "Pedro Giffuni"> wrote: On 01/26/18 06:36, Bruce Evans wrote: On Thu, 25 Jan 2018, Pedro Giffuni wrote: On 25/01/2018 14:24, Bruce Evans wrote: ... This code only works because (if?) nfs is the only caller and nfs never passes insane values. I am starting to think that we should simply match uio_resid and set it to ssize_t. Returning the value to int is certainly not the solution. Of course using the correct type (int) is part of the solution. uio_must be checked before it is used for cookies, and after checking it, it is small so it fits easily in an int. It must also checked to be nonnegative, so that it doesn't suffer unsigned poisoning when it is promoted, so it would also fit in a u_int, but using u_int to store it is silly as using 1U instead of 1 for a count of 1. The bounds checking is something like: if (ap->uio_resid < 0) ap->uio_resid = 0; if (ap->a_ncookies != NULL) { if (ap->uio_resid >= 64 * 1024) ap->uio_resid = 64 * 1024; ncookies = ap->uio_resid; } This checks for negative values for all cases and converts to 0 (EOF) to preserve historical behaviour for the syscall case and to avoid overflow for the cookies case (in case the caller is buggy). The correct handling is to return EINVAL, but EOF is good enough. In the syscall case, uio_resid can be up to SSIZE_MAX, so don't check it or corrupt it by assigning it to an int or u_int. Limit uio_resid from above only in the cookies case. The final limit should be about 128K (whatever nfs uses) or maybe 1M. Don't return EINVAL above the limit, since nfs probably wouldn't know how to handle that (by retrying with a smaller size). Test its handling of short counts instead. It is expected than nfs asks for 128K and we supply at most 64K. The supply is always reduced at EOF. Hopefully nfs doesn't treat the short count as EOF. It should retry until we supply 0. Hmm ... We have never checked the upper bound there, which doesn't mean it was right. I found MAXPHYS, which seems a more reasonable limit used in the kernel for uio_resid. I am checking the patch compiles and doesn't give surprises. MAXPHYS is almost the right thing to check. There's per device limits for normal I/O, but that doesn't seem to be a strict limit for readdir. OK... new patch, this time again trying to sanitize only ncookies (which can be int or u_int, doesn't matter to me). Pedro. Index: sys/fs/ext2fs/ext2_lookup.c === --- sys/fs/ext2fs/ext2_lookup.c (revision 328478) +++ sys/fs/ext2fs/ext2_lookup.c (working copy) @@ -145,7 +145,7 @@ off_t offset, startoffset; size_t readcnt, skipcnt; ssize_t startresid; - u_int ncookies; + int ncookies; int DIRBLKSIZ = VTOI(ap->a_vp)->i_e2fs->e2fs_bsize; int error; @@ -152,7 +152,11 @@ if (uio->uio_offset < 0) return (EINVAL); ip = VTOI(vp); + if (uio->uio_resid < 0) + uio->uio_resid = 0; if (ap->a_ncookies != NULL) { + if (uio->uio_resid > MAXPHYS) + uio->uio_resid = MAXPHYS; ncookies = uio->uio_resid; if (uio->uio_offset >= ip->i_size) ncookies = 0; Index: sys/ufs/ufs/ufs_vnops.c === --- sys/ufs/ufs/ufs_vnops.c (revision 328478) +++ sys/ufs/ufs/ufs_vnops.c (working copy) @@ -2170,7 +2170,7 @@ off_t offset, startoffset; size_t readcnt, skipcnt; ssize_t startresid; - u_int ncookies; + int ncookies; int error; if (uio->uio_offset < 0) @@ -2178,7 +2178,11 @@ ip = VTOI(vp); if (ip->i_effnlink == 0) return (0); + if (uio->uio_resid < 0) + uio->uio_resid = 0; if (ap->a_ncookies != NULL) { + if (uio->uio_resid > MAXPHYS) + uio->uio_resid = MAXPHYS; ncookies = uio->uio_resid; if (uio->uio_offset >= ip->i_size) ncookies = 0; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r328479 - in head/sys: fs/ext2fs ufs/ufs
On Sat, 27 Jan 2018, Konstantin Belousov wrote: On Sat, Jan 27, 2018 at 03:33:52PM +, Pedro F. Giffuni wrote: Log: {ext2|ufs}_readdir: Set limit on valid ncookies values. Sanitize the values that will be assigned to ncookies so that we ensure they are sane and we can handle them. Let ncookies signed as it was before r328346. The valid range is such that unsigned values are not required and we are not able to avoid at least one cast anyways. Hinted by:bde Modified: head/sys/fs/ext2fs/ext2_lookup.c head/sys/ufs/ufs/ufs_vnops.c Modified: head/sys/fs/ext2fs/ext2_lookup.c == --- head/sys/fs/ext2fs/ext2_lookup.cSat Jan 27 13:46:55 2018 (r328478) +++ head/sys/fs/ext2fs/ext2_lookup.cSat Jan 27 15:33:52 2018 (r328479) @@ -145,14 +145,18 @@ ext2_readdir(struct vop_readdir_args *ap) off_t offset, startoffset; size_t readcnt, skipcnt; ssize_t startresid; - u_int ncookies; + int ncookies; int DIRBLKSIZ = VTOI(ap->a_vp)->i_e2fs->e2fs_bsize; int error; if (uio->uio_offset < 0) return (EINVAL); ip = VTOI(vp); + if (uio->uio_resid < 0) + uio->uio_resid = 0; if (ap->a_ncookies != NULL) { + if (uio->uio_resid > MAXPHYS) + uio->uio_resid = MAXPHYS; ncookies = uio->uio_resid; if (uio->uio_offset >= ip->i_size) ncookies = 0; Modified: head/sys/ufs/ufs/ufs_vnops.c ... You just break nfs server. Look at nfsrvd_readdir() call to VOP_READDIR. Almost all code which calls VOP_READDIR() memoize the value of uio_resid before and after the call and interpret the difference as the amount of data returned. We noticed in further discussion that there is likely to be a problem like that. Also, the instructions for testing this said to test nfs with a value of 64K and perhaps with smaller values, to see if its error handling can handle reduction of uio_resid. Any testing would have shown the problem. I said above that only nfs server is broken, because only the server uses cookies, otherwise your patch would break everything. My original patch have broke syscalls slightly too. In the syscall case, it only modifies uio_resid when that is negative. Spelling 0 as negative would be silly, but it has always worked, and fixing it up to 0 would break callers which memoized the negative value. I think we have use a local variable to hold a reduced resid. uio_resid can be updated just before returning. Or maybe just return EINVAL in the cookies case if uio_resid < 0 || uio_resid > MAX_SIZE_NOW_USED_BY_NFS (thiss essentially a check that nfs is the only caller and that it never asks for large sizes). I was trying to avoid the extra complexity. There are at about 13 file systems under sys/fs, and zfs under sys/cddl to fix. zfs_readdir() is quite broken (if there are any untrusted callers). It always malloc()s approx. (size_t)(int)uio_resid bytes. The casts can overflow in various ways. Some other file systems resuce this to the residual file size which tends to be small enough to fit in memory. zfs detects overrun (using KASSERT()) _after_ the overrun has occurred. The subsystems under sys/fs which mention ncookies are: - autofs: just for layering - cd9660: like zfs, except it has the wrong type (u_int) for the cookie count, and it has no KASSERT() at all, and it counts down the residual cookies quite differently - devfs: doesn't support cookies, but fakes them a little. No problem. - fdesc: doesn't support cookies. No problem. - fuse: doesn't support cookies. Doesn't even return a cookie count of 0 to advertize this like fdesc does. - msdosfs: like cd9660, except it counts down the residual cookies normally - smbfs: doesn't support cookies. Has some code to return EOPNOTSUPP if cookies are requested, but this is ifdefed out, so it is like fuse. - tmpfs: tmpfs_subr.c writes cookies and depends on the caller passing sane cookie pointer and count args. tmpfs_readdir() creates a cookie array with a size that seems to be for a whole directory (not limited by uio_resid). So nfs's saneness doesn't help here. I don't know how large tmpfs directories can be (can it be swap-backed with directories larger than memory?). - udf: like cd9660. - unionfs: does both layering and a malloc() to merge cookies. The size of this malloc() is unclear. Bruce ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r328483 - stable/11/share/termcap
Author: eadler Date: Sat Jan 27 16:56:54 2018 New Revision: 328483 URL: https://svnweb.freebsd.org/changeset/base/328483 Log: MFC r328209: termcap: add xterm-termite Modified: stable/11/share/termcap/termcap Directory Properties: stable/11/ (props changed) Modified: stable/11/share/termcap/termcap == --- stable/11/share/termcap/termcap Sat Jan 27 16:48:29 2018 (r328482) +++ stable/11/share/termcap/termcap Sat Jan 27 16:56:54 2018 (r328483) @@ -4662,6 +4662,27 @@ Eterm|Eterm Terminal Emulator (X11 Window System):\ :us=\E[4m:vb=\E[?5h\E[?5l:ve=\E[?25h:vi=\E[?25l:\ :ac=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~: +# Termcap for xterm-termite +xterm-termite|VTE-based terminal:\ +:NP:am:hs:mi:ms:ut:xn:\ +:Co#256:co#80:it#8:li#24:pa#32767:\ +:@7=\EOF:@8=\EOM:AB=\E[48;5;%dm:AF=\E[38;5;%dm:AL=\E[%dL:\ +:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:F1=\E[23~:F2=\E[24~:\ +:IC=\E[%d@:K2=\EOE:Km=\E[M:LE=\E[%dD:RA=\E[?7l:RI=\E[%dC:\ +:SA=\E[?7h:SF=\E[%dS:SR=\E[%dT:UP=\E[%dA:ZH=\E[3m:\ +:ZR=\E[23m:al=\E[L:bl=^G:bt=\E[Z:cb=\E[1K:cd=\E[J:ce=\E[K:\ +:ch=\E[%i%dG:cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:\ +:cs=\E[%i%d;%dr:cv=\E[%i%dd:dc=\E[P:dl=\E[M:do=^J:\ +:ds=\E]2;\007:ec=\E[%dX:ei=\E[4l:fs=^G:ho=\E[H:im=\E[4h:\ +:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\E[15~:k6=\E[17~:\ +:k7=\E[18~:k8=\E[19~:k9=\E[20~:k;=\E[21~:kB=\E[Z:kD=\E[3~:\ +:kI=\E[2~:kN=\E[6~:kP=\E[5~:kb=\177:kd=\EOB:ke=\E[?1l:\ +:kh=\EOH:kl=\EOD:kr=\EOC:ks=\E[?1h:ku=\EOA:le=^H:md=\E[1m:\ +:me=\E[m:mr=\E[7m:nd=\E[C:op=\E[39;49m:r1=\Ec:rc=\E8:\ +:sc=\E7:se=\E[27m:sf=^J:so=\E[7m:sr=\EM:ta=^I:te=\E[?1049l:\ +:ti=\E[?1049h:ts=\E]2;:u6=\E[%i%d;%dR:u7=\E[6n:ue=\E[24m:\ +:up=\E[A:us=\E[4m:ve=\E[?25h:vi=\E[?25l: + # # END OF TERMCAP # ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r328482 - stable/11/sys/dev/atkbdc
Author: dumbbell Date: Sat Jan 27 16:48:29 2018 New Revision: 328482 URL: https://svnweb.freebsd.org/changeset/base/328482 Log: psm: Don't try to detect trackpoint packets if the Elantech device has none This fixes a panic when `EVDEV_SUPPORT` is enabled: if a trackpoint packet was detected but there was no trackpoint, we still tried to emit an evdev event even though the associated relative evdev device (`evdev_r`) was not initialized. PR: 225339 MFC of: r328191 Modified: stable/11/sys/dev/atkbdc/psm.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/atkbdc/psm.c == --- stable/11/sys/dev/atkbdc/psm.c Sat Jan 27 16:36:06 2018 (r328481) +++ stable/11/sys/dev/atkbdc/psm.c Sat Jan 27 16:48:29 2018 (r328482) @@ -4187,7 +4187,7 @@ proc_elantech(struct psm_softc *sc, packetbuf_t *pb, m /* Determine packet format and do a sanity check for out of sync packets. */ if (ELANTECH_PKT_IS_DEBOUNCE(pb, sc->elanhw.hwversion)) pkt = ELANTECH_PKT_NOP; - else if (ELANTECH_PKT_IS_TRACKPOINT(pb)) + else if (sc->elanhw.hastrackpoint && ELANTECH_PKT_IS_TRACKPOINT(pb)) pkt = ELANTECH_PKT_TRACKPOINT; else switch (sc->elanhw.hwversion) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r328479 - in head/sys: fs/ext2fs ufs/ufs
On 01/27/18 11:03, Konstantin Belousov wrote: On Sat, Jan 27, 2018 at 03:33:52PM +, Pedro F. Giffuni wrote: Author: pfg Date: Sat Jan 27 15:33:52 2018 New Revision: 328479 URL: https://svnweb.freebsd.org/changeset/base/328479 Log: {ext2|ufs}_readdir: Set limit on valid ncookies values. Sanitize the values that will be assigned to ncookies so that we ensure they are sane and we can handle them. Let ncookies signed as it was before r328346. The valid range is such that unsigned values are not required and we are not able to avoid at least one cast anyways. Hinted by: bde Modified: head/sys/fs/ext2fs/ext2_lookup.c head/sys/ufs/ufs/ufs_vnops.c Modified: head/sys/fs/ext2fs/ext2_lookup.c == --- head/sys/fs/ext2fs/ext2_lookup.cSat Jan 27 13:46:55 2018 (r328478) +++ head/sys/fs/ext2fs/ext2_lookup.cSat Jan 27 15:33:52 2018 (r328479) @@ -145,14 +145,18 @@ ext2_readdir(struct vop_readdir_args *ap) off_t offset, startoffset; size_t readcnt, skipcnt; ssize_t startresid; - u_int ncookies; + int ncookies; int DIRBLKSIZ = VTOI(ap->a_vp)->i_e2fs->e2fs_bsize; int error; if (uio->uio_offset < 0) return (EINVAL); ip = VTOI(vp); + if (uio->uio_resid < 0) + uio->uio_resid = 0; if (ap->a_ncookies != NULL) { + if (uio->uio_resid > MAXPHYS) + uio->uio_resid = MAXPHYS; ncookies = uio->uio_resid; if (uio->uio_offset >= ip->i_size) ncookies = 0; Modified: head/sys/ufs/ufs/ufs_vnops.c == --- head/sys/ufs/ufs/ufs_vnops.cSat Jan 27 13:46:55 2018 (r328478) +++ head/sys/ufs/ufs/ufs_vnops.cSat Jan 27 15:33:52 2018 (r328479) @@ -2170,7 +2170,7 @@ ufs_readdir(ap) off_t offset, startoffset; size_t readcnt, skipcnt; ssize_t startresid; - u_int ncookies; + int ncookies; int error; if (uio->uio_offset < 0) @@ -2178,7 +2178,11 @@ ufs_readdir(ap) ip = VTOI(vp); if (ip->i_effnlink == 0) return (0); + if (uio->uio_resid < 0) + uio->uio_resid = 0; if (ap->a_ncookies != NULL) { + if (uio->uio_resid > MAXPHYS) + uio->uio_resid = MAXPHYS; You just break nfs server. Look at nfsrvd_readdir() call to VOP_READDIR. Almost all code which calls VOP_READDIR() memoize the value of uio_resid before and after the call and interpret the difference as the amount of data returned. I said above that only nfs server is broken, because only the server uses cookies, otherwise your patch would break everything. Ugh, yes .. I completely missed the fact that uio is a pointer to the real thing, not a local copy. This still should never go off limits but it is certainly wrong. I reverted it sorry. Pedro. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r328481 - stable/11/sys/dev/atkbdc
Author: dumbbell Date: Sat Jan 27 16:36:06 2018 New Revision: 328481 URL: https://svnweb.freebsd.org/changeset/base/328481 Log: psm: Skip sync check when `PSM_CONFIG_NOCHECKSYNC` is set In psmprobe(), we set the initial `syncmask` to the vendor default value if the `PSM_CONFIG_NOCHECKSYNC` bit is unset. However, we currently only set it for the Elantech touchpad later in psmattach(), thus `syncmask` is always configured. Now, we check `PSM_CONFIG_NOCHECKSYNC` and skip sync check if it is set. This fixes Elantech touchpad support for units which have `hascrc` set. To clarify that, when we log the `syncmask` and `syncbits` fields, also mention if they are actually used. Finally, when we set `PSM_CONFIG_NOCHECKSYNC`, clear `PSM_NEED_SYNCBITS` flag. PR: 225338 MFC of: r328190 Modified: stable/11/sys/dev/atkbdc/psm.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/atkbdc/psm.c == --- stable/11/sys/dev/atkbdc/psm.c Sat Jan 27 16:34:00 2018 (r328480) +++ stable/11/sys/dev/atkbdc/psm.c Sat Jan 27 16:36:06 2018 (r328481) @@ -1947,8 +1947,10 @@ psmattach(device_t dev) /* Elantech trackpad`s sync bit differs from touchpad`s one */ if (sc->hw.model == MOUSE_MODEL_ELANTECH && - (sc->elanhw.hascrc || sc->elanhw.hastrackpoint)) + (sc->elanhw.hascrc || sc->elanhw.hastrackpoint)) { sc->config |= PSM_CONFIG_NOCHECKSYNC; + sc->flags &= ~PSM_NEED_SYNCBITS; + } if (!verbose) printf("psm%d: model %s, device ID %d\n", @@ -1959,8 +1961,9 @@ psmattach(device_t dev) sc->hw.hwid >> 8, sc->hw.buttons); printf("psm%d: config:%08x, flags:%08x, packet size:%d\n", unit, sc->config, sc->flags, sc->mode.packetsize); - printf("psm%d: syncmask:%02x, syncbits:%02x\n", - unit, sc->mode.syncmask[0], sc->mode.syncmask[1]); + printf("psm%d: syncmask:%02x, syncbits:%02x%s\n", + unit, sc->mode.syncmask[0], sc->mode.syncmask[1], + sc->config & PSM_CONFIG_NOCHECKSYNC ? " (sync not checked)" : ""); } if (bootverbose) @@ -2976,7 +2979,8 @@ psmintr(void *arg) VLOG(2, (LOG_DEBUG, "psmintr: Sync bytes now %04x,%04x\n", sc->mode.syncmask[0], sc->mode.syncmask[0])); - } else if ((c & sc->mode.syncmask[0]) != sc->mode.syncmask[1]) { + } else if ((sc->config & PSM_CONFIG_NOCHECKSYNC) == 0 && + (c & sc->mode.syncmask[0]) != sc->mode.syncmask[1]) { VLOG(3, (LOG_DEBUG, "psmintr: out of sync " "(%04x != %04x) %d cmds since last error.\n", c & sc->mode.syncmask[0], sc->mode.syncmask[1], ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r328480 - in head/sys: fs/ext2fs ufs/ufs
Author: pfg Date: Sat Jan 27 16:34:00 2018 New Revision: 328480 URL: https://svnweb.freebsd.org/changeset/base/328480 Log: Revert r328479: {ext2|ufs}_readdir: Set limit on valid ncookies values. We aren't allowed to set resid like this. Pointed out by: kib, imp Modified: head/sys/fs/ext2fs/ext2_lookup.c head/sys/ufs/ufs/ufs_vnops.c Modified: head/sys/fs/ext2fs/ext2_lookup.c == --- head/sys/fs/ext2fs/ext2_lookup.cSat Jan 27 15:33:52 2018 (r328479) +++ head/sys/fs/ext2fs/ext2_lookup.cSat Jan 27 16:34:00 2018 (r328480) @@ -145,18 +145,14 @@ ext2_readdir(struct vop_readdir_args *ap) off_t offset, startoffset; size_t readcnt, skipcnt; ssize_t startresid; - int ncookies; + u_int ncookies; int DIRBLKSIZ = VTOI(ap->a_vp)->i_e2fs->e2fs_bsize; int error; if (uio->uio_offset < 0) return (EINVAL); ip = VTOI(vp); - if (uio->uio_resid < 0) - uio->uio_resid = 0; if (ap->a_ncookies != NULL) { - if (uio->uio_resid > MAXPHYS) - uio->uio_resid = MAXPHYS; ncookies = uio->uio_resid; if (uio->uio_offset >= ip->i_size) ncookies = 0; Modified: head/sys/ufs/ufs/ufs_vnops.c == --- head/sys/ufs/ufs/ufs_vnops.cSat Jan 27 15:33:52 2018 (r328479) +++ head/sys/ufs/ufs/ufs_vnops.cSat Jan 27 16:34:00 2018 (r328480) @@ -2170,7 +2170,7 @@ ufs_readdir(ap) off_t offset, startoffset; size_t readcnt, skipcnt; ssize_t startresid; - int ncookies; + u_int ncookies; int error; if (uio->uio_offset < 0) @@ -2178,11 +2178,7 @@ ufs_readdir(ap) ip = VTOI(vp); if (ip->i_effnlink == 0) return (0); - if (uio->uio_resid < 0) - uio->uio_resid = 0; if (ap->a_ncookies != NULL) { - if (uio->uio_resid > MAXPHYS) - uio->uio_resid = MAXPHYS; ncookies = uio->uio_resid; if (uio->uio_offset >= ip->i_size) ncookies = 0; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r328479 - in head/sys: fs/ext2fs ufs/ufs
You aren't allowed to set resid like this. Changes in resid indicate amount of I/O done. If you think it's bogus, you need to either return EINVAL or use a smaller value to figure out your buffer sizes. Thi s is bogus, please back it out. Warner On Jan 27, 2018 8:34 AM, "Pedro F. Giffuni"wrote: > Author: pfg > Date: Sat Jan 27 15:33:52 2018 > New Revision: 328479 > URL: https://svnweb.freebsd.org/changeset/base/328479 > > Log: > {ext2|ufs}_readdir: Set limit on valid ncookies values. > > Sanitize the values that will be assigned to ncookies so that we ensure > they are sane and we can handle them. > > Let ncookies signed as it was before r328346. The valid range is such > that unsigned values are not required and we are not able to avoid at > least one cast anyways. > > Hinted by:bde > > Modified: > head/sys/fs/ext2fs/ext2_lookup.c > head/sys/ufs/ufs/ufs_vnops.c > > Modified: head/sys/fs/ext2fs/ext2_lookup.c > > == > --- head/sys/fs/ext2fs/ext2_lookup.cSat Jan 27 13:46:55 2018 > (r328478) > +++ head/sys/fs/ext2fs/ext2_lookup.cSat Jan 27 15:33:52 2018 > (r328479) > @@ -145,14 +145,18 @@ ext2_readdir(struct vop_readdir_args *ap) > off_t offset, startoffset; > size_t readcnt, skipcnt; > ssize_t startresid; > - u_int ncookies; > + int ncookies; > int DIRBLKSIZ = VTOI(ap->a_vp)->i_e2fs->e2fs_bsize; > int error; > > if (uio->uio_offset < 0) > return (EINVAL); > ip = VTOI(vp); > + if (uio->uio_resid < 0) > + uio->uio_resid = 0; > if (ap->a_ncookies != NULL) { > + if (uio->uio_resid > MAXPHYS) > + uio->uio_resid = MAXPHYS; > ncookies = uio->uio_resid; > if (uio->uio_offset >= ip->i_size) > ncookies = 0; > > Modified: head/sys/ufs/ufs/ufs_vnops.c > > == > --- head/sys/ufs/ufs/ufs_vnops.cSat Jan 27 13:46:55 2018 > (r328478) > +++ head/sys/ufs/ufs/ufs_vnops.cSat Jan 27 15:33:52 2018 > (r328479) > @@ -2170,7 +2170,7 @@ ufs_readdir(ap) > off_t offset, startoffset; > size_t readcnt, skipcnt; > ssize_t startresid; > - u_int ncookies; > + int ncookies; > int error; > > if (uio->uio_offset < 0) > @@ -2178,7 +2178,11 @@ ufs_readdir(ap) > ip = VTOI(vp); > if (ip->i_effnlink == 0) > return (0); > + if (uio->uio_resid < 0) > + uio->uio_resid = 0; > if (ap->a_ncookies != NULL) { > + if (uio->uio_resid > MAXPHYS) > + uio->uio_resid = MAXPHYS; > ncookies = uio->uio_resid; > if (uio->uio_offset >= ip->i_size) > ncookies = 0; > > ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r328346 - in head/sys: fs/ext2fs ufs/ffs ufs/ufs
On Jan 27, 2018 8:17 AM, "Pedro Giffuni"wrote: On 01/26/18 06:36, Bruce Evans wrote: > On Thu, 25 Jan 2018, Pedro Giffuni wrote: > > On 25/01/2018 14:24, Bruce Evans wrote: >> >>> ... >>> This code only works because (if?) nfs is the only caller and nfs never >>> passes insane values. >>> >>> >> I am starting to think that we should simply match uio_resid and set it >> to ssize_t. >> Returning the value to int is certainly not the solution. >> > > Of course using the correct type (int) is part of the solution. > > uio_must be checked before it is used for cookies, and after checking it, > it > is small so it fits easily in an int. It must also checked to be > nonnegative, > so that it doesn't suffer unsigned poisoning when it is promoted, so it > would > also fit in a u_int, but using u_int to store it is silly as using 1U > instead > of 1 for a count of 1. > > The bounds checking is something like: > > if (ap->uio_resid < 0) > ap->uio_resid = 0; > if (ap->a_ncookies != NULL) { > if (ap->uio_resid >= 64 * 1024) > ap->uio_resid = 64 * 1024; > ncookies = ap->uio_resid; > } > > This checks for negative values for all cases and converts to 0 (EOF) to > preserve historical behaviour for the syscall case and to avoid overflow > for the cookies case (in case the caller is buggy). The correct handling > is to return EINVAL, but EOF is good enough. > > In the syscall case, uio_resid can be up to SSIZE_MAX, so don't check it > or corrupt it by assigning it to an int or u_int. > > Limit uio_resid from above only in the cookies case. The final limit > should > be about 128K (whatever nfs uses) or maybe 1M. Don't return EINVAL above > the limit, since nfs probably wouldn't know how to handle that (by retrying > with a smaller size). Test its handling of short counts instead. It is > expected than nfs asks for 128K and we supply at most 64K. The supply is > always reduced at EOF. Hopefully nfs doesn't treat the short count as EOF. > It should retry until we supply 0. > > Hmm ... We have never checked the upper bound there, which doesn't mean it was right. I found MAXPHYS, which seems a more reasonable limit used in the kernel for uio_resid. I am checking the patch compiles and doesn't give surprises. MAXPHYS is almost the right thing to check. There's per device limits for normal I/O, but that doesn't seem to be a strict limit for readdir. Warner Pedro. After limiting uio_resid, assign it to the int ncookies. > > This doesn't fix the abuse of the ncookies counter to hold the size of the > cookies array in bytes for this and the next couple of statements. > > Normally the bounds checking should be at the top level, with at most > KASSERT()s at lower levels, but here the levels are mixed, and it isn't > clear if kernel callers have already checked, and it doesn't cost much to > do much the same checking for the kernel callers as for the syscall callers. > > Perhaps the 128K limit is good for all cases (this depends on callers not > having buggy short count handling). Directories of this size are very > rare (don't forget to create very large ones when you test this). Doing > anything with directories of this size tends to be slow anyway, and the > slowness has nothing to do with reading only 128K instead of SSIZE_MAX > bytes at a time. > > readdir() in FreeBSD seems to use a read size of only PAGE_SIZE, except > in the unionfs case it seems to try to read the whole direction. It > malloc()s the buffer in both cases. Blindy malloc()ing or mmap()ing > a buffer large enough for a whole file or directory is no good, since > in theory even directory sizes can be much larger than memory. > > Bruce > > ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r328479 - in head/sys: fs/ext2fs ufs/ufs
On Sat, Jan 27, 2018 at 03:33:52PM +, Pedro F. Giffuni wrote: > Author: pfg > Date: Sat Jan 27 15:33:52 2018 > New Revision: 328479 > URL: https://svnweb.freebsd.org/changeset/base/328479 > > Log: > {ext2|ufs}_readdir: Set limit on valid ncookies values. > > Sanitize the values that will be assigned to ncookies so that we ensure > they are sane and we can handle them. > > Let ncookies signed as it was before r328346. The valid range is such > that unsigned values are not required and we are not able to avoid at > least one cast anyways. > > Hinted by: bde > > Modified: > head/sys/fs/ext2fs/ext2_lookup.c > head/sys/ufs/ufs/ufs_vnops.c > > Modified: head/sys/fs/ext2fs/ext2_lookup.c > == > --- head/sys/fs/ext2fs/ext2_lookup.c Sat Jan 27 13:46:55 2018 > (r328478) > +++ head/sys/fs/ext2fs/ext2_lookup.c Sat Jan 27 15:33:52 2018 > (r328479) > @@ -145,14 +145,18 @@ ext2_readdir(struct vop_readdir_args *ap) > off_t offset, startoffset; > size_t readcnt, skipcnt; > ssize_t startresid; > - u_int ncookies; > + int ncookies; > int DIRBLKSIZ = VTOI(ap->a_vp)->i_e2fs->e2fs_bsize; > int error; > > if (uio->uio_offset < 0) > return (EINVAL); > ip = VTOI(vp); > + if (uio->uio_resid < 0) > + uio->uio_resid = 0; > if (ap->a_ncookies != NULL) { > + if (uio->uio_resid > MAXPHYS) > + uio->uio_resid = MAXPHYS; > ncookies = uio->uio_resid; > if (uio->uio_offset >= ip->i_size) > ncookies = 0; > > Modified: head/sys/ufs/ufs/ufs_vnops.c > == > --- head/sys/ufs/ufs/ufs_vnops.c Sat Jan 27 13:46:55 2018 > (r328478) > +++ head/sys/ufs/ufs/ufs_vnops.c Sat Jan 27 15:33:52 2018 > (r328479) > @@ -2170,7 +2170,7 @@ ufs_readdir(ap) > off_t offset, startoffset; > size_t readcnt, skipcnt; > ssize_t startresid; > - u_int ncookies; > + int ncookies; > int error; > > if (uio->uio_offset < 0) > @@ -2178,7 +2178,11 @@ ufs_readdir(ap) > ip = VTOI(vp); > if (ip->i_effnlink == 0) > return (0); > + if (uio->uio_resid < 0) > + uio->uio_resid = 0; > if (ap->a_ncookies != NULL) { > + if (uio->uio_resid > MAXPHYS) > + uio->uio_resid = MAXPHYS; You just break nfs server. Look at nfsrvd_readdir() call to VOP_READDIR. Almost all code which calls VOP_READDIR() memoize the value of uio_resid before and after the call and interpret the difference as the amount of data returned. I said above that only nfs server is broken, because only the server uses cookies, otherwise your patch would break everything. > ncookies = uio->uio_resid; > if (uio->uio_offset >= ip->i_size) > ncookies = 0; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r328474 - head/sys/contrib/libnv
On 01/27/18 10:32, Cy Schubert wrote: In message <201801271258.w0rcwml0078...@repo.freebsd.org>, Mariusz Zaborski wri tes: Author: oshogbo Date: Sat Jan 27 12:58:21 2018 New Revision: 328474 URL: https://svnweb.freebsd.org/changeset/base/328474 Log: Add SPDX tags for nv(9). MFC after: 2 weeks Modified: head/sys/contrib/libnv/cnvlist.c head/sys/contrib/libnv/dnvlist.c head/sys/contrib/libnv/nv_impl.h head/sys/contrib/libnv/nvlist.c head/sys/contrib/libnv/nvlist_impl.h head/sys/contrib/libnv/nvpair.c head/sys/contrib/libnv/nvpair_impl.h When was it decided to add SPDX to contrib? We didn't, it's up to upstream, but being the author (of at least part of it) he can do what he wants ;). Pedro. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r328479 - in head/sys: fs/ext2fs ufs/ufs
Author: pfg Date: Sat Jan 27 15:33:52 2018 New Revision: 328479 URL: https://svnweb.freebsd.org/changeset/base/328479 Log: {ext2|ufs}_readdir: Set limit on valid ncookies values. Sanitize the values that will be assigned to ncookies so that we ensure they are sane and we can handle them. Let ncookies signed as it was before r328346. The valid range is such that unsigned values are not required and we are not able to avoid at least one cast anyways. Hinted by:bde Modified: head/sys/fs/ext2fs/ext2_lookup.c head/sys/ufs/ufs/ufs_vnops.c Modified: head/sys/fs/ext2fs/ext2_lookup.c == --- head/sys/fs/ext2fs/ext2_lookup.cSat Jan 27 13:46:55 2018 (r328478) +++ head/sys/fs/ext2fs/ext2_lookup.cSat Jan 27 15:33:52 2018 (r328479) @@ -145,14 +145,18 @@ ext2_readdir(struct vop_readdir_args *ap) off_t offset, startoffset; size_t readcnt, skipcnt; ssize_t startresid; - u_int ncookies; + int ncookies; int DIRBLKSIZ = VTOI(ap->a_vp)->i_e2fs->e2fs_bsize; int error; if (uio->uio_offset < 0) return (EINVAL); ip = VTOI(vp); + if (uio->uio_resid < 0) + uio->uio_resid = 0; if (ap->a_ncookies != NULL) { + if (uio->uio_resid > MAXPHYS) + uio->uio_resid = MAXPHYS; ncookies = uio->uio_resid; if (uio->uio_offset >= ip->i_size) ncookies = 0; Modified: head/sys/ufs/ufs/ufs_vnops.c == --- head/sys/ufs/ufs/ufs_vnops.cSat Jan 27 13:46:55 2018 (r328478) +++ head/sys/ufs/ufs/ufs_vnops.cSat Jan 27 15:33:52 2018 (r328479) @@ -2170,7 +2170,7 @@ ufs_readdir(ap) off_t offset, startoffset; size_t readcnt, skipcnt; ssize_t startresid; - u_int ncookies; + int ncookies; int error; if (uio->uio_offset < 0) @@ -2178,7 +2178,11 @@ ufs_readdir(ap) ip = VTOI(vp); if (ip->i_effnlink == 0) return (0); + if (uio->uio_resid < 0) + uio->uio_resid = 0; if (ap->a_ncookies != NULL) { + if (uio->uio_resid > MAXPHYS) + uio->uio_resid = MAXPHYS; ncookies = uio->uio_resid; if (uio->uio_offset >= ip->i_size) ncookies = 0; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r328474 - head/sys/contrib/libnv
In message <201801271258.w0rcwml0078...@repo.freebsd.org>, Mariusz Zaborski wri tes: > Author: oshogbo > Date: Sat Jan 27 12:58:21 2018 > New Revision: 328474 > URL: https://svnweb.freebsd.org/changeset/base/328474 > > Log: > Add SPDX tags for nv(9). > > MFC after: 2 weeks > > Modified: > head/sys/contrib/libnv/cnvlist.c > head/sys/contrib/libnv/dnvlist.c > head/sys/contrib/libnv/nv_impl.h > head/sys/contrib/libnv/nvlist.c > head/sys/contrib/libnv/nvlist_impl.h > head/sys/contrib/libnv/nvpair.c > head/sys/contrib/libnv/nvpair_impl.h > When was it decided to add SPDX to contrib? -- Cheers, Cy SchubertFreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r328346 - in head/sys: fs/ext2fs ufs/ffs ufs/ufs
On 01/26/18 06:36, Bruce Evans wrote: On Thu, 25 Jan 2018, Pedro Giffuni wrote: On 25/01/2018 14:24, Bruce Evans wrote: ... This code only works because (if?) nfs is the only caller and nfs never passes insane values. I am starting to think that we should simply match uio_resid and set it to ssize_t. Returning the value to int is certainly not the solution. Of course using the correct type (int) is part of the solution. uio_must be checked before it is used for cookies, and after checking it, it is small so it fits easily in an int. It must also checked to be nonnegative, so that it doesn't suffer unsigned poisoning when it is promoted, so it would also fit in a u_int, but using u_int to store it is silly as using 1U instead of 1 for a count of 1. The bounds checking is something like: if (ap->uio_resid < 0) ap->uio_resid = 0; if (ap->a_ncookies != NULL) { if (ap->uio_resid >= 64 * 1024) ap->uio_resid = 64 * 1024; ncookies = ap->uio_resid; } This checks for negative values for all cases and converts to 0 (EOF) to preserve historical behaviour for the syscall case and to avoid overflow for the cookies case (in case the caller is buggy). The correct handling is to return EINVAL, but EOF is good enough. In the syscall case, uio_resid can be up to SSIZE_MAX, so don't check it or corrupt it by assigning it to an int or u_int. Limit uio_resid from above only in the cookies case. The final limit should be about 128K (whatever nfs uses) or maybe 1M. Don't return EINVAL above the limit, since nfs probably wouldn't know how to handle that (by retrying with a smaller size). Test its handling of short counts instead. It is expected than nfs asks for 128K and we supply at most 64K. The supply is always reduced at EOF. Hopefully nfs doesn't treat the short count as EOF. It should retry until we supply 0. Hmm ... We have never checked the upper bound there, which doesn't mean it was right. I found MAXPHYS, which seems a more reasonable limit used in the kernel for uio_resid. I am checking the patch compiles and doesn't give surprises. Pedro. After limiting uio_resid, assign it to the int ncookies. This doesn't fix the abuse of the ncookies counter to hold the size of the cookies array in bytes for this and the next couple of statements. Normally the bounds checking should be at the top level, with at most KASSERT()s at lower levels, but here the levels are mixed, and it isn't clear if kernel callers have already checked, and it doesn't cost much to do much the same checking for the kernel callers as for the syscall callers. Perhaps the 128K limit is good for all cases (this depends on callers not having buggy short count handling). Directories of this size are very rare (don't forget to create very large ones when you test this). Doing anything with directories of this size tends to be slow anyway, and the slowness has nothing to do with reading only 128K instead of SSIZE_MAX bytes at a time. readdir() in FreeBSD seems to use a read size of only PAGE_SIZE, except in the unionfs case it seems to try to read the whole direction. It malloc()s the buffer in both cases. Blindy malloc()ing or mmap()ing a buffer large enough for a whole file or directory is no good, since in theory even directory sizes can be much larger than memory. Bruce ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r328478 - head/sys/netinet
Author: tuexen Date: Sat Jan 27 13:46:55 2018 New Revision: 328478 URL: https://svnweb.freebsd.org/changeset/base/328478 Log: Add constant for the PAD chunk as defined in RFC 4820. This will be used by traceroute and traceroute6 soon. MFC after:1 week Modified: head/sys/netinet/sctp_constants.h Modified: head/sys/netinet/sctp_constants.h == --- head/sys/netinet/sctp_constants.h Sat Jan 27 13:43:03 2018 (r328477) +++ head/sys/netinet/sctp_constants.h Sat Jan 27 13:46:55 2018 (r328478) @@ -420,6 +420,8 @@ __FBSDID("$FreeBSD$"); #define SCTP_RANDOM0x8002 #define SCTP_CHUNK_LIST0x8003 #define SCTP_HMAC_LIST 0x8004 +/* RFC 4820 */ +#define SCTP_PAD 0x8005 /* RFC 5061 */ #define SCTP_SUPPORTED_CHUNK_EXT 0x8008 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r328477 - head/sys/netinet
Author: tuexen Date: Sat Jan 27 13:43:03 2018 New Revision: 328477 URL: https://svnweb.freebsd.org/changeset/base/328477 Log: Update references in comments, since the IDs have become an RFC long time ago. Also cleanup whitespaces. No functional change. MFC after:1 week Modified: head/sys/netinet/sctp_constants.h Modified: head/sys/netinet/sctp_constants.h == --- head/sys/netinet/sctp_constants.h Sat Jan 27 13:34:14 2018 (r328476) +++ head/sys/netinet/sctp_constants.h Sat Jan 27 13:43:03 2018 (r328477) @@ -400,43 +400,32 @@ __FBSDID("$FreeBSD$"); #define SCTP_HOSTNAME_ADDRESS 0x000b #define SCTP_SUPPORTED_ADDRTYPE0x000c -/* draft-ietf-stewart-tsvwg-strreset-xxx */ +/* RFC 6525 */ #define SCTP_STR_RESET_OUT_REQUEST 0x000d #define SCTP_STR_RESET_IN_REQUEST 0x000e #define SCTP_STR_RESET_TSN_REQUEST 0x000f #define SCTP_STR_RESET_RESPONSE0x0010 #define SCTP_STR_RESET_ADD_OUT_STREAMS 0x0011 -#define SCTP_STR_RESET_ADD_IN_STREAMS 0x0012 +#define SCTP_STR_RESET_ADD_IN_STREAMS 0x0012 #define SCTP_MAX_RESET_PARAMS 2 -#define SCTP_STREAM_RESET_TSN_DELTA0x1000 +#define SCTP_STREAM_RESET_TSN_DELTA0x1000 /*0x4000 series*/ /*0x8000 series*/ #define SCTP_ECN_CAPABLE 0x8000 -/* draft-ietf-tsvwg-auth-xxx */ +/* RFC 4895 */ #define SCTP_RANDOM0x8002 #define SCTP_CHUNK_LIST0x8003 #define SCTP_HMAC_LIST 0x8004 -/* - * draft-ietf-tsvwg-addip-sctp-xx param=0x8008 len=0x Byte | Byte | Byte - * | Byte Byte | Byte ... - * - * Where each byte is a chunk type extension supported. For example, to support - * all chunks one would have (in hex): - * - * 80 01 00 09 C0 C1 80 81 82 00 00 00 - * - * Has the parameter. C0 = PR-SCTP(RFC3758) C1, 80 = ASCONF (addip draft) 81 - * = Packet Drop 82 = Stream Reset 83 = Authentication - */ -#define SCTP_SUPPORTED_CHUNK_EXT0x8008 +/* RFC 5061 */ +#define SCTP_SUPPORTED_CHUNK_EXT 0x8008 /*0xC000 series*/ #define SCTP_PRSCTP_SUPPORTED 0xc000 -/* draft-ietf-tsvwg-addip-sctp */ +/* RFC 5061 */ #define SCTP_ADD_IP_ADDRESS0xc001 #define SCTP_DEL_IP_ADDRESS0xc002 #define SCTP_ERROR_CAUSE_IND 0xc003 @@ -444,8 +433,8 @@ __FBSDID("$FreeBSD$"); #define SCTP_SUCCESS_REPORT0xc005 #define SCTP_ULP_ADAPTATION0xc006 /* behave-nat-draft */ -#define SCTP_HAS_NAT_SUPPORT0xc007 -#define SCTP_NAT_VTAGS 0xc008 +#define SCTP_HAS_NAT_SUPPORT 0xc007 +#define SCTP_NAT_VTAGS 0xc008 /* bits for TOS field */ #define SCTP_ECT0_BIT 0x02 @@ -624,7 +613,7 @@ __FBSDID("$FreeBSD$"); #define SCTP_RTO_INITIAL (3000) /* 3 sec in ms */ -#define SCTP_INP_KILL_TIMEOUT 20/* number of ms to retry kill of inpcb */ +#define SCTP_INP_KILL_TIMEOUT 20 /* number of ms to retry kill of inpcb */ #define SCTP_ASOC_KILL_TIMEOUT 10 /* number of ms to retry kill of inpcb */ #define SCTP_DEF_MAX_INIT 8 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r328476 - stable/10/contrib/tzdata
Author: philip Date: Sat Jan 27 13:34:14 2018 New Revision: 328476 URL: https://svnweb.freebsd.org/changeset/base/328476 Log: MFC r328055: Import tzdata 2018a MFC r328318: Import tzdata 2018c Replaced: stable/10/contrib/tzdata/pacificnew - copied unchanged from r328318, head/contrib/tzdata/pacificnew Modified: stable/10/contrib/tzdata/Makefile stable/10/contrib/tzdata/NEWS stable/10/contrib/tzdata/README stable/10/contrib/tzdata/africa stable/10/contrib/tzdata/asia stable/10/contrib/tzdata/australasia stable/10/contrib/tzdata/backzone stable/10/contrib/tzdata/europe stable/10/contrib/tzdata/leap-seconds.list stable/10/contrib/tzdata/leapseconds stable/10/contrib/tzdata/northamerica stable/10/contrib/tzdata/southamerica stable/10/contrib/tzdata/theory.html stable/10/contrib/tzdata/version stable/10/contrib/tzdata/zishrink.awk stable/10/contrib/tzdata/zone.tab stable/10/contrib/tzdata/zone1970.tab Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/tzdata/Makefile == --- stable/10/contrib/tzdata/Makefile Sat Jan 27 13:29:55 2018 (r328475) +++ stable/10/contrib/tzdata/Makefile Sat Jan 27 13:34:14 2018 (r328476) @@ -42,37 +42,64 @@ POSIXRULES= America/New_York # Also see TZDEFRULESTRING below, which takes effect only # if the time zone files cannot be accessed. -# Everything gets put in subdirectories of. . . -TOPDIR=/usr/local +# Installation locations. +# +# The defaults are suitable for Debian, except that if REDO is +# posix_right or right_posix then files that Debian puts under +# /usr/share/zoneinfo/posix and /usr/share/zoneinfo/right are instead +# put under /usr/share/zoneinfo-posix and /usr/share/zoneinfo-leaps, +# respectively. Problems with the Debian approach are discussed in +# the commentary for the right_posix rule (below). +# Destination directory, which can be used for staging. +# 'make DESTDIR=/stage install' installs under /stage (e.g., to +# /stage/etc/localtime instead of to /etc/localtime). Files under +# /stage are not intended to work as-is, but can be copied by hand to +# the root directory later. If DESTDIR is empty, 'make install' does +# not stage, but installs directly into production locations. +DESTDIR = + +# Everything is installed into subdirectories of TOPDIR, and used there. +# TOPDIR should be empty (meaning the root directory), +# or a directory name that does not end in "/". +# TOPDIR should be empty or an absolute name unless you're just testing. +TOPDIR = + +# The default local time zone is taken from the file TZDEFAULT. +TZDEFAULT = $(TOPDIR)/etc/localtime + +# The subdirectory containing installed program and data files, and +# likewise for installed files that can be shared among architectures. +# These should be relative file names. +USRDIR = usr +USRSHAREDIR = $(USRDIR)/share + # "Compiled" time zone information is placed in the "TZDIR" directory # (and subdirectories). -# Use an absolute path name for TZDIR unless you're just testing the software. # TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty. - TZDIR_BASENAME=zoneinfo -TZDIR= $(TOPDIR)/etc/$(TZDIR_BASENAME) +TZDIR = $(TOPDIR)/$(USRSHAREDIR)/$(TZDIR_BASENAME) -# Types to try, as an alternative to time_t. int64_t should be first. -TIME_T_ALTERNATIVES= int64_t int32_t uint32_t uint64_t +# The "tzselect" and (if you do "make INSTALL") "date" commands go in: +BINDIR = $(TOPDIR)/$(USRDIR)/bin -# The "tzselect", "zic", and "zdump" commands get installed in. . . +# The "zdump" command goes in: +ZDUMPDIR = $(BINDIR) -ETCDIR=$(TOPDIR)/etc +# The "zic" command goes in: +ZICDIR = $(TOPDIR)/$(USRDIR)/sbin -# If you "make INSTALL", the "date" command gets installed in. . . - -BINDIR=$(TOPDIR)/bin - # Manual pages go in subdirectories of. . . +MANDIR = $(TOPDIR)/$(USRSHAREDIR)/man -MANDIR=$(TOPDIR)/man - # Library functions are put in an archive in LIBDIR. +LIBDIR = $(TOPDIR)/$(USRDIR)/lib -LIBDIR=$(TOPDIR)/lib +# Types to try, as an alternative to time_t. int64_t should be first. +TIME_T_ALTERNATIVES = int64_t int32_t uint32_t uint64_t + # If you want only POSIX time, with time values interpreted as # seconds since the epoch (not counting leap seconds), use # REDO= posix_only @@ -105,11 +132,14 @@ REDO= posix_right TZDATA_TEXT= leapseconds tzdata.zi # For backward-compatibility links for old zone names, use +# BACKWARD= backward +# If you also want the link US/Pacific-New, even though it is confusing +# and is planned to be removed from the database eventually, use # BACKWARD= backward pacificnew # To omit these links, use # BACKWARD= -BACKWARD= backward pacificnew +BACKWARD= backward # If you want out-of-scope and
svn commit: r328475 - stable/11/contrib/tzdata
Author: philip Date: Sat Jan 27 13:29:55 2018 New Revision: 328475 URL: https://svnweb.freebsd.org/changeset/base/328475 Log: MFC r328055: Import tzdata 2018a MFC r328318: Import tzdata 2018c Replaced: stable/11/contrib/tzdata/pacificnew - copied unchanged from r328318, head/contrib/tzdata/pacificnew Modified: stable/11/contrib/tzdata/Makefile stable/11/contrib/tzdata/NEWS stable/11/contrib/tzdata/README stable/11/contrib/tzdata/africa stable/11/contrib/tzdata/asia stable/11/contrib/tzdata/australasia stable/11/contrib/tzdata/backzone stable/11/contrib/tzdata/europe stable/11/contrib/tzdata/leap-seconds.list stable/11/contrib/tzdata/leapseconds stable/11/contrib/tzdata/northamerica stable/11/contrib/tzdata/southamerica stable/11/contrib/tzdata/theory.html stable/11/contrib/tzdata/version stable/11/contrib/tzdata/zishrink.awk stable/11/contrib/tzdata/zone.tab stable/11/contrib/tzdata/zone1970.tab Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/tzdata/Makefile == --- stable/11/contrib/tzdata/Makefile Sat Jan 27 12:58:21 2018 (r328474) +++ stable/11/contrib/tzdata/Makefile Sat Jan 27 13:29:55 2018 (r328475) @@ -42,37 +42,64 @@ POSIXRULES= America/New_York # Also see TZDEFRULESTRING below, which takes effect only # if the time zone files cannot be accessed. -# Everything gets put in subdirectories of. . . -TOPDIR=/usr/local +# Installation locations. +# +# The defaults are suitable for Debian, except that if REDO is +# posix_right or right_posix then files that Debian puts under +# /usr/share/zoneinfo/posix and /usr/share/zoneinfo/right are instead +# put under /usr/share/zoneinfo-posix and /usr/share/zoneinfo-leaps, +# respectively. Problems with the Debian approach are discussed in +# the commentary for the right_posix rule (below). +# Destination directory, which can be used for staging. +# 'make DESTDIR=/stage install' installs under /stage (e.g., to +# /stage/etc/localtime instead of to /etc/localtime). Files under +# /stage are not intended to work as-is, but can be copied by hand to +# the root directory later. If DESTDIR is empty, 'make install' does +# not stage, but installs directly into production locations. +DESTDIR = + +# Everything is installed into subdirectories of TOPDIR, and used there. +# TOPDIR should be empty (meaning the root directory), +# or a directory name that does not end in "/". +# TOPDIR should be empty or an absolute name unless you're just testing. +TOPDIR = + +# The default local time zone is taken from the file TZDEFAULT. +TZDEFAULT = $(TOPDIR)/etc/localtime + +# The subdirectory containing installed program and data files, and +# likewise for installed files that can be shared among architectures. +# These should be relative file names. +USRDIR = usr +USRSHAREDIR = $(USRDIR)/share + # "Compiled" time zone information is placed in the "TZDIR" directory # (and subdirectories). -# Use an absolute path name for TZDIR unless you're just testing the software. # TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty. - TZDIR_BASENAME=zoneinfo -TZDIR= $(TOPDIR)/etc/$(TZDIR_BASENAME) +TZDIR = $(TOPDIR)/$(USRSHAREDIR)/$(TZDIR_BASENAME) -# Types to try, as an alternative to time_t. int64_t should be first. -TIME_T_ALTERNATIVES= int64_t int32_t uint32_t uint64_t +# The "tzselect" and (if you do "make INSTALL") "date" commands go in: +BINDIR = $(TOPDIR)/$(USRDIR)/bin -# The "tzselect", "zic", and "zdump" commands get installed in. . . +# The "zdump" command goes in: +ZDUMPDIR = $(BINDIR) -ETCDIR=$(TOPDIR)/etc +# The "zic" command goes in: +ZICDIR = $(TOPDIR)/$(USRDIR)/sbin -# If you "make INSTALL", the "date" command gets installed in. . . - -BINDIR=$(TOPDIR)/bin - # Manual pages go in subdirectories of. . . +MANDIR = $(TOPDIR)/$(USRSHAREDIR)/man -MANDIR=$(TOPDIR)/man - # Library functions are put in an archive in LIBDIR. +LIBDIR = $(TOPDIR)/$(USRDIR)/lib -LIBDIR=$(TOPDIR)/lib +# Types to try, as an alternative to time_t. int64_t should be first. +TIME_T_ALTERNATIVES = int64_t int32_t uint32_t uint64_t + # If you want only POSIX time, with time values interpreted as # seconds since the epoch (not counting leap seconds), use # REDO= posix_only @@ -105,11 +132,14 @@ REDO= posix_right TZDATA_TEXT= leapseconds tzdata.zi # For backward-compatibility links for old zone names, use +# BACKWARD= backward +# If you also want the link US/Pacific-New, even though it is confusing +# and is planned to be removed from the database eventually, use # BACKWARD= backward pacificnew # To omit these links, use # BACKWARD= -BACKWARD= backward pacificnew +BACKWARD= backward # If you want out-of-scope and
svn commit: r328474 - head/sys/contrib/libnv
Author: oshogbo Date: Sat Jan 27 12:58:21 2018 New Revision: 328474 URL: https://svnweb.freebsd.org/changeset/base/328474 Log: Add SPDX tags for nv(9). MFC after:2 weeks Modified: head/sys/contrib/libnv/cnvlist.c head/sys/contrib/libnv/dnvlist.c head/sys/contrib/libnv/nv_impl.h head/sys/contrib/libnv/nvlist.c head/sys/contrib/libnv/nvlist_impl.h head/sys/contrib/libnv/nvpair.c head/sys/contrib/libnv/nvpair_impl.h Modified: head/sys/contrib/libnv/cnvlist.c == --- head/sys/contrib/libnv/cnvlist.cSat Jan 27 12:55:34 2018 (r328473) +++ head/sys/contrib/libnv/cnvlist.cSat Jan 27 12:58:21 2018 (r328474) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2016 Adam Starak* All rights reserved. * Modified: head/sys/contrib/libnv/dnvlist.c == --- head/sys/contrib/libnv/dnvlist.cSat Jan 27 12:55:34 2018 (r328473) +++ head/sys/contrib/libnv/dnvlist.cSat Jan 27 12:58:21 2018 (r328474) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 The FreeBSD Foundation * All rights reserved. * Modified: head/sys/contrib/libnv/nv_impl.h == --- head/sys/contrib/libnv/nv_impl.hSat Jan 27 12:55:34 2018 (r328473) +++ head/sys/contrib/libnv/nv_impl.hSat Jan 27 12:58:21 2018 (r328474) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 The FreeBSD Foundation * Copyright (c) 2013-2015 Mariusz Zaborski * All rights reserved. Modified: head/sys/contrib/libnv/nvlist.c == --- head/sys/contrib/libnv/nvlist.c Sat Jan 27 12:55:34 2018 (r328473) +++ head/sys/contrib/libnv/nvlist.c Sat Jan 27 12:58:21 2018 (r328474) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2009-2013 The FreeBSD Foundation * Copyright (c) 2013-2015 Mariusz Zaborski * All rights reserved. Modified: head/sys/contrib/libnv/nvlist_impl.h == --- head/sys/contrib/libnv/nvlist_impl.hSat Jan 27 12:55:34 2018 (r328473) +++ head/sys/contrib/libnv/nvlist_impl.hSat Jan 27 12:58:21 2018 (r328474) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 The FreeBSD Foundation * Copyright (c) 2013-2015 Mariusz Zaborski * All rights reserved. Modified: head/sys/contrib/libnv/nvpair.c == --- head/sys/contrib/libnv/nvpair.c Sat Jan 27 12:55:34 2018 (r328473) +++ head/sys/contrib/libnv/nvpair.c Sat Jan 27 12:58:21 2018 (r328474) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2009-2013 The FreeBSD Foundation * Copyright (c) 2013-2015 Mariusz Zaborski * All rights reserved. Modified: head/sys/contrib/libnv/nvpair_impl.h == --- head/sys/contrib/libnv/nvpair_impl.hSat Jan 27 12:55:34 2018 (r328473) +++ head/sys/contrib/libnv/nvpair_impl.hSat Jan 27 12:58:21 2018 (r328474) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2009-2013 The FreeBSD Foundation * Copyright (c) 2013-2015 Mariusz Zaborski * All rights reserved. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r328473 - in head/lib/libcasper: libcasper services/cap_dns services/cap_dns/tests services/cap_grp services/cap_grp/tests services/cap_pwd services/cap_pwd/tests services/cap_random se...
Author: oshogbo Date: Sat Jan 27 12:55:34 2018 New Revision: 328473 URL: https://svnweb.freebsd.org/changeset/base/328473 Log: Add SPDX tags for libcasper(3) and services. MFC after:2 weeks Modified: head/lib/libcasper/libcasper/libcasper.c head/lib/libcasper/libcasper/libcasper.h head/lib/libcasper/libcasper/libcasper_impl.c head/lib/libcasper/libcasper/libcasper_impl.h head/lib/libcasper/libcasper/libcasper_service.c head/lib/libcasper/libcasper/libcasper_service.h head/lib/libcasper/libcasper/service.c head/lib/libcasper/libcasper/zygote.c head/lib/libcasper/libcasper/zygote.h head/lib/libcasper/services/cap_dns/cap_dns.c head/lib/libcasper/services/cap_dns/tests/dns_test.c head/lib/libcasper/services/cap_grp/cap_grp.c head/lib/libcasper/services/cap_grp/tests/grp_test.c head/lib/libcasper/services/cap_pwd/cap_pwd.c head/lib/libcasper/services/cap_pwd/tests/pwd_test.c head/lib/libcasper/services/cap_random/cap_random.c head/lib/libcasper/services/cap_sysctl/cap_sysctl.c head/lib/libcasper/services/cap_sysctl/tests/sysctl_test.c head/lib/libcasper/services/cap_syslog/cap_syslog.c Modified: head/lib/libcasper/libcasper/libcasper.c == --- head/lib/libcasper/libcasper/libcasper.cSat Jan 27 12:28:52 2018 (r328472) +++ head/lib/libcasper/libcasper/libcasper.cSat Jan 27 12:55:34 2018 (r328473) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2012-2013 The FreeBSD Foundation * Copyright (c) 2015 Mariusz Zaborski* All rights reserved. Modified: head/lib/libcasper/libcasper/libcasper.h == --- head/lib/libcasper/libcasper/libcasper.hSat Jan 27 12:28:52 2018 (r328472) +++ head/lib/libcasper/libcasper/libcasper.hSat Jan 27 12:55:34 2018 (r328473) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2012-2013 The FreeBSD Foundation * Copyright (c) 2015-2017 Mariusz Zaborski * All rights reserved. Modified: head/lib/libcasper/libcasper/libcasper_impl.c == --- head/lib/libcasper/libcasper/libcasper_impl.c Sat Jan 27 12:28:52 2018(r328472) +++ head/lib/libcasper/libcasper/libcasper_impl.c Sat Jan 27 12:55:34 2018(r328473) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 The FreeBSD Foundation * Copyright (c) 2015 Mariusz Zaborski * All rights reserved. Modified: head/lib/libcasper/libcasper/libcasper_impl.h == --- head/lib/libcasper/libcasper/libcasper_impl.h Sat Jan 27 12:28:52 2018(r328472) +++ head/lib/libcasper/libcasper/libcasper_impl.h Sat Jan 27 12:55:34 2018(r328473) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 The FreeBSD Foundation * Copyright (c) 2015 Mariusz Zaborski * All rights reserved. Modified: head/lib/libcasper/libcasper/libcasper_service.c == --- head/lib/libcasper/libcasper/libcasper_service.cSat Jan 27 12:28:52 2018(r328472) +++ head/lib/libcasper/libcasper/libcasper_service.cSat Jan 27 12:55:34 2018(r328473) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2012 The FreeBSD Foundation * Copyright (c) 2015 Mariusz Zaborski * Copyright (c) 2017 Robert N. M. Watson Modified: head/lib/libcasper/libcasper/libcasper_service.h == --- head/lib/libcasper/libcasper/libcasper_service.hSat Jan 27 12:28:52 2018(r328472) +++ head/lib/libcasper/libcasper/libcasper_service.hSat Jan 27 12:55:34 2018(r328473) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 The FreeBSD Foundation * Copyright (c) 2015 Mariusz Zaborski * All rights reserved. Modified: head/lib/libcasper/libcasper/service.c == --- head/lib/libcasper/libcasper/service.c Sat Jan 27 12:28:52 2018 (r328472) +++ head/lib/libcasper/libcasper/service.c Sat Jan 27 12:55:34 2018 (r328473) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2013 The FreeBSD Foundation * Copyright (c) 2015 Mariusz Zaborski * All rights reserved. Modified: head/lib/libcasper/libcasper/zygote.c
svn commit: r328472 - head/sys/geom/label
Author: oshogbo Date: Sat Jan 27 12:28:52 2018 New Revision: 328472 URL: https://svnweb.freebsd.org/changeset/base/328472 Log: Don't truncate name of glabel. If it's to long just report that. Reviewed by: trasz@ Differential Revision:https://reviews.freebsd.org/D13746 Modified: head/sys/geom/label/g_label.c Modified: head/sys/geom/label/g_label.c == --- head/sys/geom/label/g_label.c Sat Jan 27 11:54:51 2018 (r328471) +++ head/sys/geom/label/g_label.c Sat Jan 27 12:28:52 2018 (r328472) @@ -200,6 +200,7 @@ g_label_create(struct gctl_req *req, struct g_class *m struct g_provider *pp2; struct g_consumer *cp; char name[64]; + int n; g_topology_assert(); @@ -213,7 +214,12 @@ g_label_create(struct gctl_req *req, struct g_class *m } gp = NULL; cp = NULL; - snprintf(name, sizeof(name), "%s/%s", dir, label); + n = snprintf(name, sizeof(name), "%s/%s", dir, label); + if (n >= sizeof(name)) { + if (req != NULL) + gctl_error(req, "Label name %s is too long.", label); + return (NULL); + } LIST_FOREACH(gp, >geom, geom) { pp2 = LIST_FIRST(>provider); if (pp2 == NULL) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r328346 - in head/sys: fs/ext2fs ufs/ffs ufs/ufs
On Fri, 26 Jan 2018, Pedro Giffuni wrote: On 01/26/18 06:36, Bruce Evans wrote: On Thu, 25 Jan 2018, Pedro Giffuni wrote: On 25/01/2018 14:24, Bruce Evans wrote: ... This code only works because (if?) nfs is the only caller and nfs never passes insane values. I am starting to think that we should simply match uio_resid and set it to ssize_t. Returning the value to int is certainly not the solution. Of course using the correct type (int) is part of the solution. int *was* the correct type, now it doesn't cover all the range. int is the correct type. The range is small after range checking. u_int is an incorrect type. It can only hold SSIZE_MAX on __LP32_ arches, and that only after half-baked range checking for the lower limit only. ssize_t is an incorrect type. It can hold SSIZE_MAX on all arches, but that doesn't prevent various overflow bugs or requests to malloc() SSIZE_MAX (plus a little more for rounding up) bytes unless there is some range checking. Our problem is not really uio_*, our problem is ncookies and we only test that it is >0. Our problem is lack of understanding of lectures on C types and range checking. I think the attached patch, still keeping the unsigned ncookies, is sufficient. X Index: sys/fs/ext2fs/ext2_lookup.c X === X --- sys/fs/ext2fs/ext2_lookup.c (revision 328443) X +++ sys/fs/ext2fs/ext2_lookup.c (working copy) X @@ -153,7 +153,10 @@ X return (EINVAL); X ip = VTOI(vp); X if (ap->a_ncookies != NULL) { X - ncookies = uio->uio_resid; X + if (uio->uio_resid < 0) X + ncookies = 0; X + else X + ncookies = uio->uio_resid; This only avoids overflow for negative values. It doesn't limit uio_resid from above, so overflow on this assignment can occur on __LP64__ arches. Even on __LP32__ systems, SSIZE_MAX = 2G is too large to work. My patch limits uio_resid to avoid this and many other bugs. When overflow occurs, this gives the same bugs as before, but they are larger than I noticed before. E.g., uio->uio_resid == 1ULL << 32, then the overflow is to 0. There is no problem allocating a cookies array with 0 elements, but since you didn't adjust uio_resid it is inconsistent with ncookies. Without INVARIANTS, buffer overrun occurs when the first dirent is read and cookies[0] is modified to point to the dirent; then ncookies was decremented from 0 to -1, but after you broke its type it is decremented from 0 to UINT_MAX. With INVARIANTS, the bug is detected by a KASSERT() that ncookies > 0. X if (uio->uio_offset >= ip->i_size) X ncookies = 0; X else if (ip->i_size - uio->uio_offset < ncookies) When uio_resid is huge, that isn't usually a problem unless assigning it to ncookies gives a small value. Otherwise, ncookies is at least large here. Then it is usually larger than the residual file size, so it gets replaced by the residual file size. This is only too large to fit in memory if the residual file size is large. The bounds checking is something like: [... context lost to corruption of spaces to binary (UTF-8)) This checks for negative values for all cases and converts to 0 (EOF) to preserve historical behaviour for the syscall case and to avoid overflow for the cookies case (in case the caller is buggy).?? The correct handling is to return EINVAL, but EOF is good enough. This also touches uio_resid which is probably not good as it is used later on. Our job is not to "fix" the caller but only to apply a reasonable behavior. This indeed too fragile. I had throught that syscalls adjusted uio_resid at the end (so could adjust it at the beginning too). They actually just calculate nbytes = initial_uio_resid - final_uio_resid. But if you don't adjust uio_resid, then you get buffer overruns when there are more dirents than cookies. dirents are not malloc()ed, so there is no limit on them except uio_resid, the size that can be malloc()ed for cookies, and the residual file size. In the syscall case, uio_resid can be up to SSIZE_MAX, so don't check it or corrupt it by assigning it to an int or u_int. The minimal type conversion does not really involve corruption: ncookies is local and the caller will not perceive any change. The value is corrupted by blind assignmemt to an unrelated type. Bruce___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r328471 - head/lib/libcasper/services/cap_grp
Author: oshogbo Date: Sat Jan 27 11:54:51 2018 New Revision: 328471 URL: https://svnweb.freebsd.org/changeset/base/328471 Log: Document the grp Casper service. Reviewed by: brueffer@, bcr@ Differential Revision:https://reviews.freebsd.org/D13821 Added: head/lib/libcasper/services/cap_grp/cap_grp.3 (contents, props changed) Modified: head/lib/libcasper/services/cap_grp/Makefile Modified: head/lib/libcasper/services/cap_grp/Makefile == --- head/lib/libcasper/services/cap_grp/MakefileSat Jan 27 11:49:37 2018(r328470) +++ head/lib/libcasper/services/cap_grp/MakefileSat Jan 27 11:54:51 2018(r328471) @@ -24,4 +24,20 @@ CFLAGS+=-I${.CURDIR} HAS_TESTS= SUBDIR.${MK_TESTS}+= tests +MAN+= cap_grp.3 + +MLINKS+=cap_grp.3 libcap_grp.3 +MLINKS+=cap_grp.3 cap_getgrent.3 +MLINKS+=cap_grp.3 cap_getgrnam.3 +MLINKS+=cap_grp.3 cap_getgrgid.3 +MLINKS+=cap_grp.3 cap_getgrent_r.3 +MLINKS+=cap_grp.3 cap_getgrnam_r.3 +MLINKS+=cap_grp.3 cap_getgrgid_r.3 +MLINKS+=cap_grp.3 cap_setgroupent.3 +MLINKS+=cap_grp.3 cap_setgrent.3 +MLINKS+=cap_grp.3 cap_endgrent.3 +MLINKS+=cap_grp.3 cap_grp_limit_cmds.3 +MLINKS+=cap_grp.3 cap_grp_limit_fields.3 +MLINKS+=cap_grp.3 cap_grp_limit_groups.3 + .include Added: head/lib/libcasper/services/cap_grp/cap_grp.3 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libcasper/services/cap_grp/cap_grp.3 Sat Jan 27 11:54:51 2018(r328471) @@ -0,0 +1,228 @@ +.\" Copyright (c) 2018 Mariusz Zaborski+.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\"notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\"notice, this list of conditions and the following disclaimer in the +.\"documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd January 27, 2018 +.Dt CAP_GRP 3 +.Os +.Sh NAME +.Nm cap_getgrent , +.Nm cap_getgrnam , +.Nm cap_getgrgid , +.Nm cap_getgrent_r , +.Nm cap_getgrnam_r , +.Nm cap_getgrgid_r , +.Nm cap_setgroupent , +.Nm cap_setgrent , +.Nm cap_endgrent , +.Nm cap_grp_limit_cmds , +.Nm cap_grp_limit_fields , +.Nm cap_grp_limit_groups +.Nd "library for group database operations in capability mode" +.Sh LIBRARY +.Lb libcap_grp +.Sh SYNOPSIS +.In sys/nv.h +.In libcasper.h +.In casper/cap_grp.h +.Ft "struct group *" +.Fn cap_getgrent "cap_channel_t *chan" +.Ft "struct group *" +.Fn cap_getgrnam "cap_channel_t *chan" "const char *name" +.Ft "struct group *" +.Fn cap_getgrgid "cap_channel_t *chan" "gid_t gid" +.Ft "int" +.Fn cap_getgrent_r "cap_channel_t *chan" "struct group *grp" "char *buffer" "size_t bufsize" "struct group **result" +.Ft "int" +.Fn cap_getgrnam_r "cap_channel_t *chan" "const char *name" "struct group *grp" "char *buffer" "size_t bufsize" "struct group **result" +.Ft int +.Fn cap_getgrgid_r "cap_channel_t *chan" "gid_t gid" "struct group *grp" "char *buffer" "size_t bufsize" "struct group **result" +.Ft int +.Fn cap_setgroupent "cap_channel_t *chan" "int stayopen" +.Ft int +.Fn cap_setgrent "cap_channel_t *chan" +.Ft void +.Fn cap_endgrent "cap_channel_t *chan" +.Ft int +.Fn cap_grp_limit_cmds "cap_channel_t *chan" "const char * const *cmds" "size_t ncmds" +.Ft int +.Fn cap_grp_limit_fields "cap_channel_t *chan" "const char * const *fields" "size_t nfields" +.Ft int +.Fn cap_grp_limit_groups "cap_channel_t *chan" "const char * const *names" "size_t nnames" "gid_t *gids" "size_t ngids" +.Sh DESCRIPTION +The functions +.Fn cap_getgrent , +.Fn cap_getgrnam , +.Fn cap_getgrgid , +.Fn cap_getgrent_r , +.Fn cap_getgrnam_r , +.Fn cap_getgrgid_r , +.Fn cap_setgroupent , +.Fn cap_setgrent , +and +.Fn cap_endgrent +are respectively equivalent to +.Xr getgrent 3 , +.Xr getgrnam 3 ,
svn commit: r328470 - in head/sys: amd64/amd64 amd64/include i386/i386 x86/include x86/x86
Author: kib Date: Sat Jan 27 11:49:37 2018 New Revision: 328470 URL: https://svnweb.freebsd.org/changeset/base/328470 Log: Use PCID to optimize PTI. Use PCID to avoid complete TLB shootdown when switching between user and kernel mode with PTI enabled. I use the model close to what I read about KAISER, user-mode PCID has 1:1 correspondence to the kernel-mode PCID, by setting bit 11 in PCID. Full kernel-mode TLB shootdown is performed on context switches, since KVA TLB invalidation only works in the current pmap. User-mode part of TLB is flushed on the pmap activations as well. Similarly, IPI TLB shootdowns must handle both kernel and user address spaces for each address. Note that machines which implement PCID but do not have INVPCID instructions, cause the usual complications in the IPI handlers, due to the need to switch to the target PCID temporary. This is racy, but because for PCID/no-INVPCID we disable the interrupts in pmap_activate_sw(), IPI handler cannot see inconsistent state of CPU PCID vs PCPU pmap/kcr3/ucr3 pointers. On the other hand, on kernel/user switches, CR3_PCID_SAVE bit is set and we do not clear TLB. I can imagine alternative use of PCID, where there is only one PCID allocated for the kernel pmap. Then, there is no need to shootdown kernel TLB entries on context switch. But copyout(3) would need to either use method similar to proc_rwmem() to access the userspace data, or (in reverse) provide a temporal mapping for the kernel buffer into user mode PCID and use trampoline for copy. Reviewed by: markj (previous version) Tested by:pho Discussed with: alc (some aspects) Sponsored by: The FreeBSD Foundation MFC after:3 weeks Differential revision:https://reviews.freebsd.org/D13985 Modified: head/sys/amd64/amd64/apic_vector.S head/sys/amd64/amd64/mp_machdep.c head/sys/amd64/amd64/pmap.c head/sys/amd64/amd64/support.S head/sys/amd64/include/pmap.h head/sys/amd64/include/smp.h head/sys/i386/i386/pmap.c head/sys/i386/i386/vm_machdep.c head/sys/x86/include/x86_smp.h head/sys/x86/x86/mp_x86.c Modified: head/sys/amd64/amd64/apic_vector.S == --- head/sys/amd64/amd64/apic_vector.S Sat Jan 27 11:40:46 2018 (r328469) +++ head/sys/amd64/amd64/apic_vector.S Sat Jan 27 11:49:37 2018 (r328470) @@ -184,10 +184,14 @@ invltlb_ret: callinvltlb_pcid_handler jmp invltlb_ret - INTR_HANDLER invltlb_invpcid + INTR_HANDLER invltlb_invpcid_nopti callinvltlb_invpcid_handler jmp invltlb_ret + INTR_HANDLER invltlb_invpcid_pti + callinvltlb_invpcid_pti_handler + jmp invltlb_ret + /* * Single page TLB shootdown */ @@ -195,11 +199,27 @@ invltlb_ret: callinvlpg_handler jmp invltlb_ret + INTR_HANDLER invlpg_invpcid + callinvlpg_invpcid_handler + jmp invltlb_ret + + INTR_HANDLER invlpg_pcid + callinvlpg_pcid_handler + jmp invltlb_ret + /* * Page range TLB shootdown. */ INTR_HANDLER invlrng callinvlrng_handler + jmp invltlb_ret + + INTR_HANDLER invlrng_invpcid + callinvlrng_invpcid_handler + jmp invltlb_ret + + INTR_HANDLER invlrng_pcid + callinvlrng_pcid_handler jmp invltlb_ret /* Modified: head/sys/amd64/amd64/mp_machdep.c == --- head/sys/amd64/amd64/mp_machdep.c Sat Jan 27 11:40:46 2018 (r328469) +++ head/sys/amd64/amd64/mp_machdep.c Sat Jan 27 11:49:37 2018 (r328470) @@ -133,20 +133,30 @@ cpu_mp_start(void) /* Install an inter-CPU IPI for TLB invalidation */ if (pmap_pcid_enabled) { if (invpcid_works) { - setidt(IPI_INVLTLB, pti ? IDTVEC(invltlb_invpcid_pti) : - IDTVEC(invltlb_invpcid), SDT_SYSIGT, SEL_KPL, 0); + setidt(IPI_INVLTLB, pti ? + IDTVEC(invltlb_invpcid_pti_pti) : + IDTVEC(invltlb_invpcid_nopti), SDT_SYSIGT, + SEL_KPL, 0); + setidt(IPI_INVLPG, pti ? IDTVEC(invlpg_invpcid_pti) : + IDTVEC(invlpg_invpcid), SDT_SYSIGT, SEL_KPL, 0); + setidt(IPI_INVLRNG, pti ? IDTVEC(invlrng_invpcid_pti) : + IDTVEC(invlrng_invpcid), SDT_SYSIGT, SEL_KPL, 0); } else { setidt(IPI_INVLTLB, pti ? IDTVEC(invltlb_pcid_pti) : IDTVEC(invltlb_pcid), SDT_SYSIGT, SEL_KPL, 0); + setidt(IPI_INVLPG, pti ? IDTVEC(invlpg_pcid_pti) : + IDTVEC(invlpg_pcid), SDT_SYSIGT, SEL_KPL, 0); +
Re: svn commit: r328166 - in head/sys: amd64/amd64 x86/include x86/x86
On Sat, Jan 27, 2018 at 12:56:47AM -0800, Dexuan-BSD Cui wrote: > Hi, > Today I found the KPTI patch broke FreeBSD VM running on Hyper-V: the VM > can't boot due to: > > vmbus0: cannot find free IDT vector > > This is the related snippet: > > dev/hyperv/vmbus/vmbus.c: vmbus_intr_setup() -> lapic_ipi_alloc() fails: > > /* > * All Hyper-V ISR required resources are setup, now let's find a > * free IDT vector for Hyper-V ISR and set it up. > */ > sc->vmbus_idtvec = lapic_ipi_alloc(pti ? IDTVEC(vmbus_isr_pti) : > IDTVEC(vmbus_isr)); > if (sc->vmbus_idtvec < 0) { > device_printf(sc->vmbus_dev, "cannot find free IDT > vector\n"); > return ENXIO; > } > > Luckily for now I can work around this boot failure by adding vm.pmap.pti=0 > into /boot/loader.conf. > > Any suggestion? Try r328468. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r328166 - in head/sys: amd64/amd64 x86/include x86/x86
Hi, Today I found the KPTI patch broke FreeBSD VM running on Hyper-V: the VM can't boot due to: vmbus0: cannot find free IDT vector This is the related snippet: dev/hyperv/vmbus/vmbus.c: vmbus_intr_setup() -> lapic_ipi_alloc() fails: /* * All Hyper-V ISR required resources are setup, now let's find a * free IDT vector for Hyper-V ISR and set it up. */ sc->vmbus_idtvec = lapic_ipi_alloc(pti ? IDTVEC(vmbus_isr_pti) : IDTVEC(vmbus_isr)); if (sc->vmbus_idtvec < 0) { device_printf(sc->vmbus_dev, "cannot find free IDT vector\n"); return ENXIO; } Luckily for now I can work around this boot failure by adding vm.pmap.pti=0 into /boot/loader.conf. Any suggestion? Thanks! -- Dexuan On Fri, Jan 19, 2018 at 7:42 AM, Ed Mastewrote: > Author: emaste > Date: Fri Jan 19 15:42:34 2018 > New Revision: 328166 > URL: https://svnweb.freebsd.org/changeset/base/328166 > > Log: > Enable KPTI by default on amd64 for non-AMD CPUs > > Kernel Page Table Isolation (KPTI) was introduced in r328083 as a > mitigation for the 'Meltdown' vulnerability. AMD CPUs are not affected, > per https://www.amd.com/en/corporate/speculative-execution: > > We believe AMD processors are not susceptible due to our use of > privilege level protections within paging architecture and no > mitigation is required. > > Thus default KPTI to off for AMD CPUs, and to on for others. This may > be refined later as we obtain more specific information on the sets of > CPUs that are and are not affected. > > Submitted by: Mitchell Horne > Reviewed by: cem > Relnotes: Yes > Security: CVE-2017-5754 > Sponsored by: The FreeBSD Foundation > Differential Revision:https://reviews.freebsd.org/D13971 > > Modified: > head/sys/amd64/amd64/machdep.c > head/sys/x86/include/x86_var.h > head/sys/x86/x86/identcpu.c > > Modified: head/sys/amd64/amd64/machdep.c > > == > --- head/sys/amd64/amd64/machdep.c Fri Jan 19 15:32:27 2018 > (r328165) > +++ head/sys/amd64/amd64/machdep.c Fri Jan 19 15:42:34 2018 > (r328166) > @@ -1621,6 +1621,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) > mtx_init(_lock, "descriptor tables", NULL, MTX_DEF); > > /* exceptions */ > + pti = pti_get_default(); > TUNABLE_INT_FETCH("vm.pmap.pti", ); > > for (x = 0; x < NIDT; x++) > > Modified: head/sys/x86/include/x86_var.h > > == > --- head/sys/x86/include/x86_var.h Fri Jan 19 15:32:27 2018 > (r328165) > +++ head/sys/x86/include/x86_var.h Fri Jan 19 15:42:34 2018 > (r328166) > @@ -136,6 +136,7 @@ voidnmi_call_kdb_smp(u_int type, struct > trapframe *fr > void nmi_handle_intr(u_int type, struct trapframe *frame); > void pagecopy(void *from, void *to); > void printcpuinfo(void); > +intpti_get_default(void); > intuser_dbreg_trap(void); > intminidumpsys(struct dumperinfo *); > struct pcb *get_pcb_td(struct thread *td); > > Modified: head/sys/x86/x86/identcpu.c > > == > --- head/sys/x86/x86/identcpu.c Fri Jan 19 15:32:27 2018(r328165) > +++ head/sys/x86/x86/identcpu.c Fri Jan 19 15:42:34 2018(r328166) > @@ -1608,6 +1608,16 @@ finishidentcpu(void) > #endif > } > > +int > +pti_get_default(void) > +{ > + > + if (strcmp(cpu_vendor, AMD_VENDOR_ID) == 0) > + return (0); > + > + return (1); > +} > + > static u_int > find_cpu_vendor_id(void) > { > > ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r328469 - stable/11/sys/vm
Author: kib Date: Sat Jan 27 11:40:46 2018 New Revision: 328469 URL: https://svnweb.freebsd.org/changeset/base/328469 Log: MFC r328192: Assign map->header values to avoid boundary checks. Modified: stable/11/sys/vm/vm_map.c stable/11/sys/vm/vm_map.h stable/11/sys/vm/vm_mmap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_map.c == --- stable/11/sys/vm/vm_map.c Sat Jan 27 11:33:21 2018(r328468) +++ stable/11/sys/vm/vm_map.c Sat Jan 27 11:40:46 2018(r328469) @@ -998,12 +998,10 @@ vm_map_entry_link(vm_map_t map, "vm_map_entry_link: map %p, nentries %d, entry %p, after %p", map, map->nentries, entry, after_where); VM_MAP_ASSERT_LOCKED(map); - KASSERT(after_where == >header || - after_where->end <= entry->start, + KASSERT(after_where->end <= entry->start, ("vm_map_entry_link: prev end %jx new start %jx overlap", (uintmax_t)after_where->end, (uintmax_t)entry->start)); - KASSERT(after_where->next == >header || - entry->end <= after_where->next->start, + KASSERT(entry->end <= after_where->next->start, ("vm_map_entry_link: new end %jx next start %jx overlap", (uintmax_t)entry->end, (uintmax_t)after_where->next->start)); @@ -1025,8 +1023,7 @@ vm_map_entry_link(vm_map_t map, entry->right = map->root; entry->left = NULL; } - entry->adj_free = (entry->next == >header ? map->max_offset : - entry->next->start) - entry->end; + entry->adj_free = entry->next->start - entry->end; vm_map_entry_set_max_free(entry); map->root = entry; } @@ -1045,8 +1042,7 @@ vm_map_entry_unlink(vm_map_t map, else { root = vm_map_entry_splay(entry->start, entry->left); root->right = entry->right; - root->adj_free = (entry->next == >header ? map->max_offset : - entry->next->start) - root->end; + root->adj_free = entry->next->start - root->end; vm_map_entry_set_max_free(root); } map->root = root; @@ -1082,8 +1078,7 @@ vm_map_entry_resize_free(vm_map_t map, vm_map_entry_t if (entry != map->root) map->root = vm_map_entry_splay(entry->start, map->root); - entry->adj_free = (entry->next == >header ? map->max_offset : - entry->next->start) - entry->end; + entry->adj_free = entry->next->start - entry->end; vm_map_entry_set_max_free(entry); } @@ -1213,7 +1208,7 @@ vm_map_insert(vm_map_t map, vm_object_t object, vm_oof /* * Assert that the next entry doesn't overlap the end point. */ - if (prev_entry->next != >header && prev_entry->next->start < end) + if (prev_entry->next->start < end) return (KERN_NO_SPACE); if ((cow & MAP_CREATE_GUARD) != 0 && (object != NULL || @@ -2032,8 +2027,7 @@ vm_map_protect(vm_map_t map, vm_offset_t start, vm_off /* * Make a first pass to check for protection violations. */ - for (current = entry; current != >header && current->start < end; - current = current->next) { + for (current = entry; current->start < end; current = current->next) { if ((current->eflags & MAP_ENTRY_GUARD) != 0) continue; if (current->eflags & MAP_ENTRY_IS_SUB_MAP) { @@ -2051,8 +2045,7 @@ vm_map_protect(vm_map_t map, vm_offset_t start, vm_off * now will do cow due to allowed write (e.g. debugger sets * breakpoint on text segment) */ - for (current = entry; current != >header && current->start < end; - current = current->next) { + for (current = entry; current->start < end; current = current->next) { vm_map_clip_end(map, current, end); @@ -2106,8 +2099,7 @@ vm_map_protect(vm_map_t map, vm_offset_t start, vm_off * Go back and fix up protections. [Note that clipping is not * necessary the second time.] */ - for (current = entry; current != >header && current->start < end; - current = current->next) { + for (current = entry; current->start < end; current = current->next) { if ((current->eflags & MAP_ENTRY_GUARD) != 0) continue; @@ -2216,10 +2208,8 @@ vm_map_madvise( * We clip the vm_map_entry so that behavioral changes are * limited to the specified address range. */ - for (current = entry; -(current != >header) && (current->start < end); -current = current->next - ) { + for (current = entry; current->start < end; + current = current->next) { if
svn commit: r328468 - head/sys/x86/x86
Author: kib Date: Sat Jan 27 11:33:21 2018 New Revision: 328468 URL: https://svnweb.freebsd.org/changeset/base/328468 Log: Fix native_lapic_ipi_alloc(). When PTI is enabled, empty IDT slots point to rsvd_pti. Reported by: Dexuan-BSD CuiSponsored by: The FreeBSD Foundation MFC after:5 days Modified: head/sys/x86/x86/local_apic.c Modified: head/sys/x86/x86/local_apic.c == --- head/sys/x86/x86/local_apic.c Sat Jan 27 11:19:41 2018 (r328467) +++ head/sys/x86/x86/local_apic.c Sat Jan 27 11:33:21 2018 (r328468) @@ -2117,7 +2117,8 @@ native_lapic_ipi_alloc(inthand_t *ipifunc) for (idx = IPI_DYN_FIRST; idx <= IPI_DYN_LAST; idx++) { ip = [idx]; func = (ip->gd_hioffset << 16) | ip->gd_looffset; - if (func == (uintptr_t)(rsvd)) { + if ((!pti && func == (uintptr_t)(rsvd)) || + (pti && func == (uintptr_t)(rsvd_pti))) { vector = idx; setidt(vector, ipifunc, SDT_APIC, SEL_KPL, GSEL_APIC); break; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r328467 - in head/sys/arm: arm include
Author: mmel Date: Sat Jan 27 11:19:41 2018 New Revision: 328467 URL: https://svnweb.freebsd.org/changeset/base/328467 Log: Implement mitigation for Spectre version 2 attacks on ARMv7. Similarly as we already do for arm64, for mitigation is necessary to flush branch predictor when we: - do task switch - receive prefetch abort on non-userspace address The user can disable this mitigation by setting 'machdep.disable_bp_hardening' sysctl variable, or it can check actual system status by reading 'machdep.spectre_v2_safe' The situation is complicated by fact that: - for Cortex-A8, the BPIALL instruction is effectively NOP until the IBE bit in ACTLR is set. - for Cortex-A15, the BPIALL is always NOP. The branch predictor can be only flushed by doing ICIALLU with special bit (Enable invalidates of BTB) set in ACTLR. Since access to the ACTLR register is locked to secure monitor/firmware on most boards, they will also need update of firmware / U-boot. In worst case, when secure monitor is on-chip ROM (e.g. PandaBoard), the board is unfixable. MFC after:2 weeks Reviewed by: imp, emaste Differential Revision:https://reviews.freebsd.org/D13931 Modified: head/sys/arm/arm/cpuinfo.c head/sys/arm/arm/genassym.c head/sys/arm/arm/machdep.c head/sys/arm/arm/mp_machdep.c head/sys/arm/arm/swtch-v6.S head/sys/arm/arm/trap-v6.c head/sys/arm/include/cpuinfo.h head/sys/arm/include/pcpu.h Modified: head/sys/arm/arm/cpuinfo.c == --- head/sys/arm/arm/cpuinfo.c Sat Jan 27 09:49:47 2018(r328466) +++ head/sys/arm/arm/cpuinfo.c Sat Jan 27 11:19:41 2018(r328467) @@ -31,6 +31,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include @@ -40,6 +42,9 @@ __FBSDID("$FreeBSD$"); #if __ARM_ARCH >= 6 void reinit_mmu(uint32_t ttb, uint32_t aux_clr, uint32_t aux_set); + +int disable_bp_hardening; +int spectre_v2_safe = 1; #endif struct cpuinfo cpuinfo = @@ -255,6 +260,7 @@ cpuinfo_get_actlr_modifier(uint32_t *actlr_mask, uint3 if (cpuinfo.implementer == CPU_IMPLEMENTER_ARM) { switch (cpuinfo.part_number) { + case CPU_ARCH_CORTEX_A75: case CPU_ARCH_CORTEX_A73: case CPU_ARCH_CORTEX_A72: case CPU_ARCH_CORTEX_A57: @@ -337,5 +343,198 @@ cpuinfo_reinit_mmu(uint32_t ttb) actlr_set |= cpu_quirks_actlr_set; reinit_mmu(ttb, actlr_mask, actlr_set); } + +static bool +modify_actlr(uint32_t clear, uint32_t set) +{ + uint32_t reg, newreg; + + reg = cp15_actlr_get(); + newreg = reg; + newreg &= ~clear; + newreg |= set; + if (reg == newreg) + return (true); + cp15_actlr_set(newreg); + + reg = cp15_actlr_get(); + if (reg == newreg) + return (true); + return (false); +} + +/* Apply/restore BP hardening on current core. */ +static int +apply_bp_hardening(bool enable, int kind, bool actrl, uint32_t set_mask) +{ + if (enable) { + if (actrl && !modify_actlr(0, set_mask)) + return (-1); + PCPU_SET(bp_harden_kind, kind); + } else { + PCPU_SET(bp_harden_kind, PCPU_BP_HARDEN_KIND_NONE); + if (actrl) + modify_actlr(~0, PCPU_GET(original_actlr)); + spectre_v2_safe = 0; + } + return (0); +} + +static void +handle_bp_hardening(bool enable) +{ + int kind; + char *kind_str; + + kind = PCPU_BP_HARDEN_KIND_NONE; + /* +* Note: Access to ACTRL is locked to secure world on most boards. +* This means that full BP hardening depends on updated u-boot/firmware +* or is impossible at all (if secure monitor is in on-chip ROM). +*/ + if (cpuinfo.implementer == CPU_IMPLEMENTER_ARM) { + switch (cpuinfo.part_number) { + case CPU_ARCH_CORTEX_A8: + /* +* For Cortex-A8, IBE bit must be set otherwise +* BPIALL is effectively NOP. +* Unfortunately, Cortex-A is also affected by +* ARM erratum 687067 which causes non-working +* BPIALL if IBE bit is set and 'Instruction L1 System +* Array Debug Register 0' is not 0. +* This register is not reset on power-up and is +* accessible only from secure world, so we cannot do +* nothing (nor detect) to fix this issue. +* I afraid that on chip ROM based secure monitor on +* AM335x (BeagleBone) doesn't reset this debug +* register. +*/ + kind =
Re: svn commit: r328456 - head/share/man/man7
Indeed - but that one has been documented earlier, in r326502, by markj@. On 0126T1633, Conrad Meyer wrote: > This isn't quite right — it's now located in src/stand. > > On Fri, Jan 26, 2018 at 4:09 PM, Edward Tomasz Napierala >wrote: > > Author: trasz > > Date: Sat Jan 27 00:09:43 2018 > > New Revision: 328456 > > URL: https://svnweb.freebsd.org/changeset/base/328456 > > > > Log: > > Remove mention of sys/boot/ from hier(7), it doesn't exist anymore. > > > > MFC after:2 weeks > > > > Modified: > > head/share/man/man7/hier.7 > > > > Modified: head/share/man/man7/hier.7 > > == > > --- head/share/man/man7/hier.7 Fri Jan 26 23:56:07 2018(r328455) > > +++ head/share/man/man7/hier.7 Sat Jan 27 00:09:43 2018(r328456) > > @@ -28,7 +28,7 @@ > > .\"@(#)hier.7 8.1 (Berkeley) 6/5/93 > > .\" $FreeBSD$ > > .\" > > -.Dd January 15, 2018 > > +.Dd January 27, 2018 > > .Dt HIER 7 > > .Os > > .Sh NAME > > @@ -660,8 +660,6 @@ AMD64 architecture support > > ARM architecture support > > .It Pa arm64/ > > ARMv8 architecture support > > -.It Pa boot/ > > -bootloader code > > .It Pa cam/ > > .Xr cam 4 > > and > > ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r328466 - head/sys/arm64/arm64
Author: mmel Date: Sat Jan 27 09:49:47 2018 New Revision: 328466 URL: https://svnweb.freebsd.org/changeset/base/328466 Log: Fix pmap_fault(). - special fault handling for break-before-make mechanism should be also applied for instruction translation faults, not only for data translation faults. - since arm64_address_translate_...() functions are not atomic, use these with disabled interrupts. Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c == --- head/sys/arm64/arm64/pmap.c Sat Jan 27 07:41:31 2018(r328465) +++ head/sys/arm64/arm64/pmap.c Sat Jan 27 09:49:47 2018(r328466) @@ -4745,10 +4745,12 @@ int pmap_fault(pmap_t pmap, uint64_t esr, uint64_t far) { #ifdef SMP + register_t intr; uint64_t par; -#endif switch (ESR_ELx_EXCEPTION(esr)) { + case EXCP_INSN_ABORT_L: + case EXCP_INSN_ABORT: case EXCP_DATA_ABORT_L: case EXCP_DATA_ABORT: break; @@ -4756,7 +4758,7 @@ pmap_fault(pmap_t pmap, uint64_t esr, uint64_t far) return (KERN_FAILURE); } -#ifdef SMP + /* Data and insn aborts use same encoding for FCS field. */ PMAP_LOCK(pmap); switch (esr & ISS_DATA_DFSC_MASK) { case ISS_DATA_DFSC_TF_L0: @@ -4764,10 +4766,12 @@ pmap_fault(pmap_t pmap, uint64_t esr, uint64_t far) case ISS_DATA_DFSC_TF_L2: case ISS_DATA_DFSC_TF_L3: /* Ask the MMU to check the address */ + intr = intr_disable(); if (pmap == kernel_pmap) par = arm64_address_translate_s1e1r(far); else par = arm64_address_translate_s1e0r(far); + intr_restore(intr); /* * If the translation was successful the address was invalid ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r328464 - head/sys/cam/scsi
Author: scottl Date: Sat Jan 27 07:18:02 2018 New Revision: 328464 URL: https://svnweb.freebsd.org/changeset/base/328464 Log: Finish the incomplete move of CAM_PERIPH_PRINT(). Reported by: kevans Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c == --- head/sys/cam/scsi/scsi_da.c Sat Jan 27 06:31:14 2018(r328463) +++ head/sys/cam/scsi/scsi_da.c Sat Jan 27 07:18:02 2018(r328464) @@ -1510,8 +1510,10 @@ static const char *da_ref_text[] = { "max -- also bogus" }; +#define DA_PERIPH_PRINT(periph, msg, args...) \ + CAM_PERIPH_PRINT(periph, msg, ##args) #else -#define CAM_PERIPH_PRINT(p, msg, args...) +#define DA_PERIPH_PRINT(periph, msg, args...) #endif static inline void @@ -1527,7 +1529,7 @@ da_periph_hold(struct cam_periph *periph, int priority int err = cam_periph_hold(periph, priority); token_sanity(token); - CAM_PERIPH_PRINT(periph, "Holding device %s (%d): %d\n", + DA_PERIPH_PRINT(periph, "Holding device %s (%d): %d\n", da_ref_text[token], token, err); if (err == 0) { int cnt; @@ -1548,7 +1550,7 @@ da_periph_unhold(struct cam_periph *periph, da_ref_tok token_sanity(token); cam_periph_unhold(periph); - CAM_PERIPH_PRINT(periph, "Unholding device %s (%d)\n", + DA_PERIPH_PRINT(periph, "Unholding device %s (%d)\n", da_ref_text[token], token); cnt = atomic_fetchadd_int(>ref_flags[token], -1); if (cnt != 1) @@ -1561,7 +1563,7 @@ da_periph_acquire(struct cam_periph *periph, da_ref_to int err = cam_periph_acquire(periph); token_sanity(token); - CAM_PERIPH_PRINT(periph, "acquiring device %s (%d): %d\n", + DA_PERIPH_PRINT(periph, "acquiring device %s (%d): %d\n", da_ref_text[token], token, err); if (err == CAM_REQ_CMP) { int cnt; @@ -1582,7 +1584,7 @@ da_periph_release(struct cam_periph *periph, da_ref_to token_sanity(token); cam_periph_release(periph); - CAM_PERIPH_PRINT(periph, "releasing device %s (%d)\n", + DA_PERIPH_PRINT(periph, "releasing device %s (%d)\n", da_ref_text[token], token); cnt = atomic_fetchadd_int(>ref_flags[token], -1); if (cnt != 1) @@ -1597,7 +1599,7 @@ da_periph_release_locked(struct cam_periph *periph, da token_sanity(token); cam_periph_release_locked(periph); - CAM_PERIPH_PRINT(periph, "releasing device (locked) %s (%d)\n", + DA_PERIPH_PRINT(periph, "releasing device (locked) %s (%d)\n", da_ref_text[token], token); cnt = atomic_fetchadd_int(>ref_flags[token], -1); if (cnt != 1) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r328462 - stable/11/usr.bin/patch
Author: kevans Date: Sat Jan 27 06:20:27 2018 New Revision: 328462 URL: https://svnweb.freebsd.org/changeset/base/328462 Log: MFC r327826: patch(1): Don't check for NUL bytes in Plan A Plan A mmap()'s the entire input file and operates on it in memory. The map(2) call succeeded, so we shouldn't need to bother checking for the NUL byte as long as we're within our buffer space. This was clearly intentional to match "the behavior of the original code", but it creates a discrepancy between Plan A and Plan B that doesn't seem sensible and it's not inherently wrong to allow a NUL byte. This change was motivated by the gemspec in net/rubygem-grpc failing to patch, despite the patch being generated with diff, because a NUL byte was used as a delimiter in the header briefly in an otherwise text file. An alternative was considered: to fallback to plan B if plan A won't process the entire file due to a NUL byte, but I deemed this to be the better option since plan A isn't failing due to memory limitations and will fail later on if it's really dealing with a file it shouldn't be. Modified: stable/11/usr.bin/patch/inp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/patch/inp.c == --- stable/11/usr.bin/patch/inp.c Sat Jan 27 06:15:24 2018 (r328461) +++ stable/11/usr.bin/patch/inp.c Sat Jan 27 06:20:27 2018 (r328462) @@ -213,8 +213,11 @@ plan_a(const char *filename) /* now scan the buffer and build pointer array */ iline = 1; i_ptr[iline] = i_womp; - /* test for NUL too, to maintain the behavior of the original code */ - for (s = i_womp, i = 0; i < i_size && *s != '\0'; s++, i++) { + /* +* Testing for NUL here actively breaks files that innocently use NUL +* for other reasons. mmap(2) succeeded, just scan the whole buffer. +*/ + for (s = i_womp, i = 0; i < i_size; s++, i++) { if (*s == '\n') { if (iline == lines_allocated) { if (!reallocate_lines(_allocated)) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r328455 - in head/sys/cam: . scsi
On Fri, Jan 26, 2018 at 5:56 PM, Scott Longwrote: > Author: scottl > Date: Fri Jan 26 23:56:07 2018 > New Revision: 328455 > URL: https://svnweb.freebsd.org/changeset/base/328455 > > Log: > Move CAM_PERIPH_PRINT() to cam_periph.h > > Modified: > head/sys/cam/cam_periph.h > head/sys/cam/scsi/scsi_da.c > Hi, This seems to have broken the build, because [1] still exists and conflicts with the definition now in cam_periph.h. See [2] for the build log. Thanks, Kyle Evans [1] https://svnweb.freebsd.org/base/head/sys/cam/scsi/scsi_da.c?view=markup=328455#l1514 [2] https://ci.freebsd.org/job/FreeBSD-head-amd64-build/6960/console ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"