svn commit: r326457 - head/usr.sbin/efidp
Author: imp Date: Sat Dec 2 07:29:07 2017 New Revision: 326457 URL: https://svnweb.freebsd.org/changeset/base/326457 Log: Read multiple lines when parsing the data. Allow multiple device paths to be read when formatting device paths. Set the upper limit to 64k (most of these paths are < 64 bytes). Sponsored by: Netflix Modified: head/usr.sbin/efidp/efidp.c Modified: head/usr.sbin/efidp/efidp.c == --- head/usr.sbin/efidp/efidp.c Sat Dec 2 06:23:02 2017(r326456) +++ head/usr.sbin/efidp/efidp.c Sat Dec 2 07:29:07 2017(r326457) @@ -38,6 +38,8 @@ __FBSDID("$FreeBSD$"); #include #include +#define MAXSIZE 65536 /* Everyting will be smaller than this, most 1000x smaller */ + /* options descriptor */ static struct option longopts[] = { { "format", no_argument,NULL, 'f' }, @@ -63,18 +65,16 @@ read_file(int fd, void **rv) off_t off; ssize_t red; - len = 4096; + len = MAXSIZE; off = 0; retval = malloc(len); do { red = read(fd, retval + off, len - off); + if (red == 0) + break; off += red; - if (red < (ssize_t)(len - off)) + if (off == (off_t)len) break; - len *= 2; - retval = reallocf(retval, len); - if (retval == NULL) - return -1; } while (1); *rv = retval; @@ -112,44 +112,62 @@ parse_args(int argc, char **argv) } } +static char * +trim(char *s) +{ + char *t; + + while (isspace(*s)) + s++; + t = s + strlen(s) - 1; + while (t > s && isspace(*t)) + *t-- = '\0'; + return s; +} + int main(int argc, char **argv) { - void *data; - ssize_t len; + char buffer[MAXSIZE]; parse_args(argc, argv); - len = read_file(STDIN_FILENO, ); - if (len == -1) - err(1, "read"); if (flag_format) { - char buffer[4096]; ssize_t fmtlen; + ssize_t len; + void *data; + size_t dplen; + const_efidp dp; - fmtlen = efidp_format_device_path(buffer, sizeof(buffer), - (const_efidp)data, len); - if (fmtlen > 0) - printf("%s\n", buffer); + len = read_file(STDIN_FILENO, ); + if (len == -1) + err(1, "read"); + dp = (const_efidp)data; + while (len > 0) { + dplen = efidp_size(dp); + fmtlen = efidp_format_device_path(buffer, sizeof(buffer), + dp, dplen); + if (fmtlen > 0) + printf("%s\n", buffer); + len -= dplen; + dp = (const_efidp)((const char *)dp + dplen); + } free(data); } else if (flag_parse) { efidp dp; ssize_t dplen; - char *str, *walker; + char *walker; - dplen = 8192; + dplen = MAXSIZE; dp = malloc(dplen); - str = realloc(data, len + 1); - if (str == NULL || dp == NULL) + if (dp == NULL) errx(1, "Can't allocate memory."); - str[len] = '\0'; - walker = str; - while (isspace(*walker)) - walker++; - dplen = efidp_parse_device_path(walker, dp, dplen); - if (dplen == -1) - errx(1, "Can't parse %s", walker); - write(STDOUT_FILENO, dp, dplen); + while (fgets(buffer, sizeof(buffer), stdin)) { + walker= trim(buffer); + dplen = efidp_parse_device_path(walker, dp, dplen); + if (dplen == -1) + errx(1, "Can't parse %s", walker); + write(STDOUT_FILENO, dp, dplen); + } free(dp); - free(str); } } ___ 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: r326459 - head/usr.sbin/efidp
Author: imp Date: Sat Dec 2 07:29:24 2017 New Revision: 326459 URL: https://svnweb.freebsd.org/changeset/base/326459 Log: Add -u (--to-unix) and -e (--to-efi) to convert unix or efi paths to the other. Sponsored by: Netflix Modified: head/usr.sbin/efidp/Makefile head/usr.sbin/efidp/efidp.8 head/usr.sbin/efidp/efidp.c Modified: head/usr.sbin/efidp/Makefile == --- head/usr.sbin/efidp/MakefileSat Dec 2 07:29:19 2017 (r326458) +++ head/usr.sbin/efidp/MakefileSat Dec 2 07:29:24 2017 (r326459) @@ -3,6 +3,6 @@ PROG= efidp MAN= efidp.8 -LIBADD= efivar +LIBADD= efivar geom .include Modified: head/usr.sbin/efidp/efidp.8 == --- head/usr.sbin/efidp/efidp.8 Sat Dec 2 07:29:19 2017(r326458) +++ head/usr.sbin/efidp/efidp.8 Sat Dec 2 07:29:24 2017(r326459) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 21, 2017 +.Dd December 1, 2017 .Dt EFIDP 8 .Os .Sh NAME @@ -46,15 +46,24 @@ Specification. .Bl -tag -width 20m .It Fl f Fl -format Formats a binary UEFI Device Path into its canonical UTF-8 textual form. -A binary Device Path can be no longer than 8192 bytes. -The textual form must fit into 4096 bytes. +A binary Device Path can be no longer than 65536 bytes. +The textual form must fit into 65536 bytes. +Multiple binary device paths may be specified. .It Fl p Fl -parse Parses a UEFI Device Path UTF-8 specification and outputs the binary Device Path form. Only one device path is parsed, even if there are multiple present in the input. Leading white space is ignored. -The resulting binary Device Path can be no longer than 8192 bytes. +The resulting binary Device Path can be no longer than 65536 bytes. +Multiple lines may be specified. +Each one will be translated. +.It Fl e Fl --to-efi +Translate a Unix file path to an EFI Device Path. +The output is the textual representation of the EFI Device Path. +.It Fl u Fl --to-unix +Translate an EFI device path to a Unix file path. +The input is the textual representation of the EFI Device Path. .El .Sh SEE ALSO Appendix A of the UEFI specification has the format for GUIDs. Modified: head/usr.sbin/efidp/efidp.c == --- head/usr.sbin/efidp/efidp.c Sat Dec 2 07:29:19 2017(r326458) +++ head/usr.sbin/efidp/efidp.c Sat Dec 2 07:29:24 2017(r326459) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -42,19 +43,21 @@ __FBSDID("$FreeBSD$"); /* options descriptor */ static struct option longopts[] = { + { "to-unix",no_argument,NULL, 'u' }, + { "to-efi", no_argument,NULL, 'e' }, { "format", no_argument,NULL, 'f' }, { "parse", no_argument,NULL, 'p' }, { NULL, 0, NULL, 0 } }; -static int flag_format, flag_parse; +static int flag_format, flag_parse, flag_unix, flag_efi; static void usage(void) { - errx(1, "efidp [-fp]"); + errx(1, "efidp [-efpu]"); } static ssize_t @@ -86,15 +89,21 @@ parse_args(int argc, char **argv) { int ch; - while ((ch = getopt_long(argc, argv, "fp", + while ((ch = getopt_long(argc, argv, "efpu", longopts, NULL)) != -1) { switch (ch) { + case 'e': + flag_efi++; + break; case 'f': flag_format++; break; case 'p': flag_parse++; break; + case 'u': + flag_unix++; + break; default: usage(); } @@ -105,7 +114,7 @@ parse_args(int argc, char **argv) if (argc >= 1) usage(); - if (flag_parse + flag_format != 1) { + if (flag_parse + flag_format + flag_efi + flag_unix != 1) { warnx("Can only use one of -p (--parse), " "and -f (--format)"); usage(); @@ -125,49 +134,115 @@ trim(char *s) return s; } -int -main(int argc, char **argv) +static void +unix_to_efi(void) { char buffer[MAXSIZE]; + char efi[MAXSIZE]; + efidp dp; + char *walker; + int rv; - parse_args(argc, argv); - if (flag_format) { - ssize_t fmtlen; - ssize_t len; - void *data; - size_t dplen; - const_efidp dp; - - len = read_file(STDIN_FILENO, ); - if (len == -1) - err(1, "read"); -
svn commit: r326458 - head/lib/libefivar
Author: imp Date: Sat Dec 2 07:29:19 2017 New Revision: 326458 URL: https://svnweb.freebsd.org/changeset/base/326458 Log: Create a function to translate UEFI paths to unix paths efivar_device_path_to_unix_path translates from UEFI to Unix efivar_unix_path_to_device_path translates from Unix to UEFI At present, only HD() device types are supported (both GPT and MBR). CdRom and floppy devices aren't supported. ZFS isn't supported because there's no way in the UEFI standard to specify a ZFS datastore. Network devices aren't supported either. Three forms of Unix path are accepted: /path/to/file (for a mounted filesystem), //path/to/file (uses the EFI partition on the same disk as /), and dev:/path/to/file (for unmounted filesystem). Two forms are produced (the first and last). Sponsored by: Netflix Added: head/lib/libefivar/efivar-dp-xlate.c (contents, props changed) Modified: head/lib/libefivar/Makefile head/lib/libefivar/efivar-dp-format.c head/lib/libefivar/efivar-dp.h Modified: head/lib/libefivar/Makefile == --- head/lib/libefivar/Makefile Sat Dec 2 07:29:07 2017(r326457) +++ head/lib/libefivar/Makefile Sat Dec 2 07:29:19 2017(r326458) @@ -35,6 +35,7 @@ PACKAGE=lib${LIB} LIB= efivar SRCS= efivar.c efichar.c efivar-dp-format.c \ efivar-dp-parse.c \ + efivar-dp-xlate.c \ uefi-guid.c uefi-dputil.c INCS= efivar.h efivar-dp.h SHLIB_MAJOR= 1 Modified: head/lib/libefivar/efivar-dp-format.c == --- head/lib/libefivar/efivar-dp-format.c Sat Dec 2 07:29:07 2017 (r326457) +++ head/lib/libefivar/efivar-dp-format.c Sat Dec 2 07:29:19 2017 (r326458) @@ -2432,7 +2432,7 @@ efidp_format_device_path(char *buf, size_t len, const_ } ssize_t -efidp_format_device_path_node(char *buf, size_t len, const_efidp dp, ssize_t max) +efidp_format_device_path_node(char *buf, size_t len, const_efidp dp) { char *str; ssize_t retval; @@ -2453,4 +2453,15 @@ efidp_size(const_efidp dp) { return GetDevicePathSize(__DECONST(EFI_DEVICE_PATH_PROTOCOL *, dp)); +} + +char * +efidp_extract_file_path(const_efidp dp) +{ + const FILEPATH_DEVICE_PATH *fp; + char *name = NULL; + + fp = (const void *)dp; + ucs2_to_utf8(fp->PathName, ); + return name; } Added: head/lib/libefivar/efivar-dp-xlate.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libefivar/efivar-dp-xlate.cSat Dec 2 07:29:19 2017 (r326458) @@ -0,0 +1,715 @@ +/*- + * Copyright (c) 2017 Netflix, Inc. + * 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 + *in this position and unchanged. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#undef MAX +#undef MIN + +#include +#include +#include +#include +#include +#include +#include + +#include "efichar.h" + +#include "efi-osdep.h" +#include "efivar-dp.h" + +#include "uefi-dplib.h" + +#define MAX_DP_SANITY 4096/* Biggest device path in bytes */ +#define MAX_DP_TEXT_LEN4096/* Longest string rep of dp */ + +#defineG_PART "PART" +#defineG_LABEL "LABEL" +#define G_DISK "DISK" + +static const char * +geom_pp_attr(struct gmesh *mesh, struct gprovider *pp, const char *attr) +{ + struct gconfig *conf; + + LIST_FOREACH(conf, >lg_config, lg_config) { + if (strcmp(conf->lg_name, attr) != 0) +
Re: svn commit: r326454 - in head/sys: conf dev/bwn gnu/dev/bwn/phy_n modules/bwn modules/bwn_pci
On Dec 1, 2017 8:21 PM, "Landon J. Fuller"wrote: Author: landonf Date: Sat Dec 2 02:21:27 2017 New Revision: 326454 URL: https://svnweb.freebsd.org/changeset/base/326454 Log: Introduce bwn(4) support for the bhnd(4) bus. Currently, bwn(4) relies on the siba_bwn(4) bus driver to provide support for the on-chip SSB interconnect found in Broadcom's older PCI(e) Wi-Fi adapters. Non-PCI Wi-Fi adapters, as well as the newer BCMA interconnect found in post-2009 Broadcom Wi-Fi hardware, are not supported by siba_bwn(4). The bhnd(4) bus driver (also used by the FreeBSD/MIPS Broadcom port) provides a unified kernel interface to a superset of the hardware supported by siba_bwn; by attaching bwn(4) via bhnd(4), we can support both modern PCI(e) Wi-Fi devices based on the BCMA backplane interconnect, as well as Broadcom MIPS WiSoCs that include a D11 MAC core directly attached to their SSB or BCMA backplane. This diff introduces opt-in bwn(4) support for bhnd(4) by providing: - A small bwn(4) driver subclass, if_bwn_bhnd, that attaches via bhnd(4) instead of siba_bwn(4). - A bhndb(4)-based PCI host bridge driver, if_bwn_pci, that optionally probes at a higher priority than the siba_bwn(4) PCI driver. - A set of compatibility shims that perform translation of bwn(4)'s siba_bwn function calls into their bhnd(9) API equivalents when bwn(4) is attached via a bhnd(4) bus parent. When bwn(4) is attached via siba_bwn(4), all siba_bwn function calls are simply passed through to their original implementations. To test bwn(4) with bhnd(4), place the following lines in loader.conf(5): hw.bwn_pci.preferred="1" if_bwn_pci_load="YES bwn_v4_ucode_load="YES" bwn_v4_lp_ucode_load="YES" To verify that bwn(4) is using bhnd(4), you can check dmesg: bwn0: ... on bhnd0 ... or devinfo(8): pcib2 pci2 bwn_pci0 bhndb0 bhnd0 bwn0 ... bwn(4)/bhnd(4) has been tested for regressions with most chipsets currently supported by bwn(4), including: - BCM4312 - BCM4318 - BCM4321 With minimal changes to the DMA code (not included in this commit), I was also able to test support for newer BCMA devices by bringing up basic working Wi-Fi on two previously unsupported, BCMA-based N-PHY chipsets: - BCM43224 - BCM43225 Hi, I'm pretty sure we've discussed this, but I don't recall to what detail that was- I recall that the 4313 is BCMA, but does it have one of the PHYs that we support already? If so, I'll happily test there. Thanks, Kyle Evans ___ 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: r326456 - head/etc
Author: eadler Date: Sat Dec 2 06:23:02 2017 New Revision: 326456 URL: https://svnweb.freebsd.org/changeset/base/326456 Log: pf.os: Add OpenBSD:6.1 Obtained From: OpenBSD Modified: head/etc/pf.os Modified: head/etc/pf.os == --- head/etc/pf.os Sat Dec 2 06:05:03 2017(r326455) +++ head/etc/pf.os Sat Dec 2 06:23:02 2017(r326456) @@ -1,5 +1,5 @@ # $FreeBSD$ -# $OpenBSD: pf.os,v 1.26 2012/08/03 12:25:16 jsg Exp $ +# $OpenBSD: pf.os,v 1.27 2016/09/03 17:08:57 sthen Exp $ # passive OS fingerprinting # - # @@ -314,6 +314,9 @@ S22:64:1:52:M*,N,N,S,N,W0: Linux:2.2:ts:Linux 2.2 w/o 16384:64:1:64:M*,N,N,S,N,W3,N,N,T: OpenBSD:4.9::OpenBSD 4.9 16384:64:0:64:M*,N,N,S,N,W3,N,N,T: OpenBSD:4.9:no-df:OpenBSD 4.9 (scrub no-df) + +16384:64:1:64:M*,N,N,S,N,W6,N,N,T: OpenBSD:6.1::OpenBSD 6.1 +16384:64:0:64:M*,N,N,S,N,W6,N,N,T: OpenBSD:6.1:no-df:OpenBSD 6.1 (scrub no-df) # - DragonFly BSD - ___ 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: r326455 - head/usr.bin/dc
Author: asomers Date: Sat Dec 2 06:05:03 2017 New Revision: 326455 URL: https://svnweb.freebsd.org/changeset/base/326455 Log: Reap dead code usr.bin/dc/inout.c Reap some dead code that was killed back in 2003 in OpenBSD, in version 1.8 of this file. MFC after:3 weeks Modified: head/usr.bin/dc/inout.c Modified: head/usr.bin/dc/inout.c == --- head/usr.bin/dc/inout.c Sat Dec 2 02:21:27 2017(r326454) +++ head/usr.bin/dc/inout.c Sat Dec 2 06:05:03 2017(r326455) @@ -216,12 +216,7 @@ readnumber(struct source *src, u_int base) n->scale++; bn_check(BN_mul_word(n->number, base)); - -#if 0 - /* work around a bug in BN_add_word: 0 += 0 is buggy */ - if (v > 0) -#endif - bn_check(BN_add_word(n->number, v)); + bn_check(BN_add_word(n->number, v)); } if (base != 10) { scale_number(n->number, n->scale); ___ 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: r326454 - in head/sys: conf dev/bwn gnu/dev/bwn/phy_n modules/bwn modules/bwn_pci
Author: landonf Date: Sat Dec 2 02:21:27 2017 New Revision: 326454 URL: https://svnweb.freebsd.org/changeset/base/326454 Log: Introduce bwn(4) support for the bhnd(4) bus. Currently, bwn(4) relies on the siba_bwn(4) bus driver to provide support for the on-chip SSB interconnect found in Broadcom's older PCI(e) Wi-Fi adapters. Non-PCI Wi-Fi adapters, as well as the newer BCMA interconnect found in post-2009 Broadcom Wi-Fi hardware, are not supported by siba_bwn(4). The bhnd(4) bus driver (also used by the FreeBSD/MIPS Broadcom port) provides a unified kernel interface to a superset of the hardware supported by siba_bwn; by attaching bwn(4) via bhnd(4), we can support both modern PCI(e) Wi-Fi devices based on the BCMA backplane interconnect, as well as Broadcom MIPS WiSoCs that include a D11 MAC core directly attached to their SSB or BCMA backplane. This diff introduces opt-in bwn(4) support for bhnd(4) by providing: - A small bwn(4) driver subclass, if_bwn_bhnd, that attaches via bhnd(4) instead of siba_bwn(4). - A bhndb(4)-based PCI host bridge driver, if_bwn_pci, that optionally probes at a higher priority than the siba_bwn(4) PCI driver. - A set of compatibility shims that perform translation of bwn(4)'s siba_bwn function calls into their bhnd(9) API equivalents when bwn(4) is attached via a bhnd(4) bus parent. When bwn(4) is attached via siba_bwn(4), all siba_bwn function calls are simply passed through to their original implementations. To test bwn(4) with bhnd(4), place the following lines in loader.conf(5): hw.bwn_pci.preferred="1" if_bwn_pci_load="YES bwn_v4_ucode_load="YES" bwn_v4_lp_ucode_load="YES" To verify that bwn(4) is using bhnd(4), you can check dmesg: bwn0: ... on bhnd0 ... or devinfo(8): pcib2 pci2 bwn_pci0 bhndb0 bhnd0 bwn0 ... bwn(4)/bhnd(4) has been tested for regressions with most chipsets currently supported by bwn(4), including: - BCM4312 - BCM4318 - BCM4321 With minimal changes to the DMA code (not included in this commit), I was also able to test support for newer BCMA devices by bringing up basic working Wi-Fi on two previously unsupported, BCMA-based N-PHY chipsets: - BCM43224 - BCM43225 Approved by: adrian (mentor, implicit) Sponsored by: The FreeBSD Foundation & Plausible Labs Differential Revision:https://reviews.freebsd.org/D13041 Added: head/sys/dev/bwn/if_bwn_bhnd.c (contents, props changed) head/sys/dev/bwn/if_bwn_siba.c (contents, props changed) head/sys/dev/bwn/if_bwn_siba.h (contents, props changed) head/sys/dev/bwn/if_bwn_siba_compat.c (contents, props changed) head/sys/dev/bwn/if_bwn_siba_compat.h (contents, props changed) Deleted: head/sys/dev/bwn/bwn_mac.c Modified: head/sys/conf/files head/sys/conf/options head/sys/dev/bwn/if_bwn.c head/sys/dev/bwn/if_bwn_pci.c head/sys/dev/bwn/if_bwn_pcivar.h head/sys/dev/bwn/if_bwn_phy_common.c head/sys/dev/bwn/if_bwn_phy_g.c head/sys/dev/bwn/if_bwn_phy_lp.c head/sys/dev/bwn/if_bwn_phy_n.c head/sys/dev/bwn/if_bwn_util.c head/sys/dev/bwn/if_bwnvar.h head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_ppr.c head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_tables.c head/sys/gnu/dev/bwn/phy_n/if_bwn_radio_2055.c head/sys/gnu/dev/bwn/phy_n/if_bwn_radio_2056.c head/sys/gnu/dev/bwn/phy_n/if_bwn_radio_2057.c head/sys/modules/bwn/Makefile head/sys/modules/bwn_pci/Makefile Modified: head/sys/conf/files == --- head/sys/conf/files Sat Dec 2 01:42:07 2017(r326453) +++ head/sys/conf/files Sat Dec 2 02:21:27 2017(r326454) @@ -1312,15 +1312,17 @@ dev/bwi/if_bwi_pci.coptional bwi pci # XXX Work around clang warnings, until maintainer approves fix. dev/bwn/if_bwn.c optional bwn siba_bwn \ compile-with "${NORMAL_C} ${NO_WSOMETIMES_UNINITIALIZED}" -dev/bwn/if_bwn_pci.c optional bwn pci bhnd +dev/bwn/if_bwn_bhnd.c optional bwn bhnd +dev/bwn/if_bwn_pci.c optional bwn pci bhnd bhndb dev/bwn/if_bwn_phy_common.coptional bwn siba_bwn dev/bwn/if_bwn_phy_g.c optional bwn siba_bwn \ compile-with "${NORMAL_C} ${NO_WSOMETIMES_UNINITIALIZED} ${NO_WCONSTANT_CONVERSION}" dev/bwn/if_bwn_phy_lp.coptional bwn siba_bwn \ compile-with "${NORMAL_C} ${NO_WSOMETIMES_UNINITIALIZED}" dev/bwn/if_bwn_phy_n.c optional bwn siba_bwn +dev/bwn/if_bwn_siba.c optional bwn siba_bwn +dev/bwn/if_bwn_siba_compat.c optional bwn bhnd !bwn_use_siba dev/bwn/if_bwn_util.c optional bwn siba_bwn -dev/bwn/bwn_mac.c optional bwn bhnd dev/cardbus/cardbus.c optional cardbus dev/cardbus/cardbus_cis.c optional
svn commit: r326453 - head/sys/powerpc/mpc85xx
Author: jhibbits Date: Sat Dec 2 01:42:07 2017 New Revision: 326453 URL: https://svnweb.freebsd.org/changeset/base/326453 Log: Override memattr for mmap on the Freescale DIU driver The Display Interface Unit (DIU) uses main memory for the framebuffer, which is already mapped as cache coherent physical memory. Prevent mmap() from using its own attributes which may otherwise conflict. Modified: head/sys/powerpc/mpc85xx/fsl_diu.c Modified: head/sys/powerpc/mpc85xx/fsl_diu.c == --- head/sys/powerpc/mpc85xx/fsl_diu.c Sat Dec 2 01:10:45 2017 (r326452) +++ head/sys/powerpc/mpc85xx/fsl_diu.c Sat Dec 2 01:42:07 2017 (r326453) @@ -414,6 +414,8 @@ diu_attach(device_t dev) sc->sc_info.fb_vbase = (intptr_t)contigmalloc(sc->sc_info.fb_size, M_DEVBUF, M_ZERO, 0, BUS_SPACE_MAXADDR_32BIT, PAGE_SIZE, 0); sc->sc_info.fb_pbase = (intptr_t)vtophys(sc->sc_info.fb_vbase); + sc->sc_info.fb_flags = FB_FLAG_MEMATTR; + sc->sc_info.fb_memattr = VM_MEMATTR_DEFAULT; /* Gamma table is 3 consecutive segments of 256 bytes. */ sc->sc_gamma = contigmalloc(3 * 256, M_DEVBUF, 0, 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: r326452 - head/sys/dev/bhnd/cores/pmu
Author: landonf Date: Sat Dec 2 01:10:45 2017 New Revision: 326452 URL: https://svnweb.freebsd.org/changeset/base/326452 Log: bhnd_pmu(4): Do not leak our chipc provider reference or clkctl state in failure paths of bhnd_pmu_attach() Approved by: adrian (mentor, implicit) Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/bhnd/cores/pmu/bhnd_pmu.c Modified: head/sys/dev/bhnd/cores/pmu/bhnd_pmu.c == --- head/sys/dev/bhnd/cores/pmu/bhnd_pmu.c Sat Dec 2 01:07:41 2017 (r326451) +++ head/sys/dev/bhnd/cores/pmu/bhnd_pmu.c Sat Dec 2 01:10:45 2017 (r326452) @@ -133,33 +133,14 @@ bhnd_pmu_attach(device_t dev, struct bhnd_resource *re return (ENXIO); } - /* Allocate our own core clkctl state directly; we use this to wait on -* PMU state transitions, avoiding a cyclic dependency between bhnd(4)'s -* clkctl handling and registration of this device as a PMU */ - sc->clkctl = bhnd_alloc_core_clkctl(core, dev, sc->res, BHND_CLK_CTL_ST, - BHND_PMU_MAX_TRANSITION_DLY); - if (sc->clkctl == NULL) { - device_printf(sc->dev, "failed to allocate clkctl for %s\n", - device_get_nameunit(core)); - return (ENOMEM); - } - /* Fetch chip and board info */ sc->cid = *bhnd_get_chipid(core); - if ((error = bhnd_read_board_info(core, >board))) { device_printf(sc->dev, "error fetching board info: %d\n", error); return (ENXIO); } - /* Locate ChipCommon device */ - sc->chipc_dev = bhnd_retain_provider(dev, BHND_SERVICE_CHIPC); - if (sc->chipc_dev == NULL) { - device_printf(sc->dev, "chipcommon device not found\n"); - return (ENXIO); - } - /* Initialize query state */ error = bhnd_pmu_query_init(>query, dev, sc->cid, _pmu_res_io, sc); @@ -170,6 +151,26 @@ bhnd_pmu_attach(device_t dev, struct bhnd_resource *re BPMU_LOCK_INIT(sc); + /* Allocate our own core clkctl state directly; we use this to wait on +* PMU state transitions, avoiding a cyclic dependency between bhnd(4)'s +* clkctl handling and registration of this device as a PMU */ + sc->clkctl = bhnd_alloc_core_clkctl(core, dev, sc->res, BHND_CLK_CTL_ST, + BHND_PMU_MAX_TRANSITION_DLY); + if (sc->clkctl == NULL) { + device_printf(sc->dev, "failed to allocate clkctl for %s\n", + device_get_nameunit(core)); + error = ENOMEM; + goto failed; + } + + /* Locate ChipCommon device */ + sc->chipc_dev = bhnd_retain_provider(dev, BHND_SERVICE_CHIPC); + if (sc->chipc_dev == NULL) { + device_printf(sc->dev, "chipcommon device not found\n"); + error = ENXIO; + goto failed; + } + /* Initialize PMU */ if ((error = bhnd_pmu_init(sc))) { device_printf(sc->dev, "PMU init failed: %d\n", error); @@ -204,8 +205,14 @@ bhnd_pmu_attach(device_t dev, struct bhnd_resource *re failed: BPMU_LOCK_DESTROY(sc); bhnd_pmu_query_fini(>query); - bhnd_free_core_clkctl(sc->clkctl); - bhnd_release_provider(sc->dev, sc->chipc_dev, BHND_SERVICE_CHIPC); + + if (sc->clkctl != NULL) + bhnd_free_core_clkctl(sc->clkctl); + + if (sc->chipc_dev != NULL) { + bhnd_release_provider(sc->dev, sc->chipc_dev, + BHND_SERVICE_CHIPC); + } return (error); } ___ 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: r326451 - head/sys/dev/bhnd/bhndb
Author: landonf Date: Sat Dec 2 01:07:41 2017 New Revision: 326451 URL: https://svnweb.freebsd.org/changeset/base/326451 Log: bhndb(4): Fix leak of child devices and MSI vectors. - Add missing call to device_delete_children() in bhndb_detach(), without which we're left with stale child devices on module unload. - Pass the parent PCI device to pci_release_msi(), not the bhndb_pci(4) child. Approved by: adrian (mentor, implicit) Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/bhnd/bhndb/bhndb.c head/sys/dev/bhnd/bhndb/bhndb_pci.c Modified: head/sys/dev/bhnd/bhndb/bhndb.c == --- head/sys/dev/bhnd/bhndb/bhndb.c Sat Dec 2 00:52:59 2017 (r326450) +++ head/sys/dev/bhnd/bhndb/bhndb.c Sat Dec 2 01:07:41 2017 (r326451) @@ -639,6 +639,10 @@ bhndb_generic_detach(device_t dev) if ((error = bus_generic_detach(dev))) return (error); + /* Delete children */ + if ((error = device_delete_children(dev))) + return (error); + /* Clean up our service registry */ if ((error = bhnd_service_registry_fini(>services))) return (error); Modified: head/sys/dev/bhnd/bhndb/bhndb_pci.c == --- head/sys/dev/bhnd/bhndb/bhndb_pci.c Sat Dec 2 00:52:59 2017 (r326450) +++ head/sys/dev/bhnd/bhndb/bhndb_pci.c Sat Dec 2 01:07:41 2017 (r326451) @@ -303,8 +303,10 @@ bhndb_pci_alloc_msi(struct bhndb_pci_softc *sc, int *m return (error); } - if (count < BHNDB_PCI_MSI_COUNT) + if (count < BHNDB_PCI_MSI_COUNT) { + pci_release_msi(sc->parent); return (ENXIO); + } *msi_count = count; return (0); @@ -412,7 +414,7 @@ cleanup: bhndb_free_intr_isrc(sc->isrc); if (sc->msi_count > 0) - pci_release_msi(dev); + pci_release_msi(sc->parent); if (cores != NULL) free(cores, M_BHND); @@ -449,7 +451,7 @@ bhndb_pci_detach(device_t dev) /* Release MSI interrupts */ if (sc->msi_count > 0) - pci_release_msi(dev); + pci_release_msi(sc->parent); /* Disable PCI bus mastering */ pci_disable_busmaster(sc->parent); ___ 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: r326450 - head/sys/dev/bhnd/cores/chipc
Author: landonf Date: Sat Dec 2 00:52:59 2017 New Revision: 326450 URL: https://svnweb.freebsd.org/changeset/base/326450 Log: bhnd_chipc(4): Break cyclic references to the ChipCommon device bhnd_chipc's children may hold strong provider references to their parent; we must detach any children before attempting to deregister the bhnd_chipc device as a bus service provider. Approved by: adrian (mentor, implicit) Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/bhnd/cores/chipc/chipc.c Modified: head/sys/dev/bhnd/cores/chipc/chipc.c == --- head/sys/dev/bhnd/cores/chipc/chipc.c Sat Dec 2 00:09:58 2017 (r326449) +++ head/sys/dev/bhnd/cores/chipc/chipc.c Sat Dec 2 00:52:59 2017 (r326450) @@ -245,10 +245,10 @@ chipc_detach(device_t dev) sc = device_get_softc(dev); - if ((error = bhnd_deregister_provider(dev, BHND_SERVICE_ANY))) + if ((error = bus_generic_detach(dev))) return (error); - if ((error = bus_generic_detach(dev))) + if ((error = bhnd_deregister_provider(dev, BHND_SERVICE_ANY))) return (error); chipc_release_region(sc, sc->core_region, RF_ALLOCATED|RF_ACTIVE); ___ 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: r326449 - head/sys/dev/bhnd/bhndb
Author: landonf Date: Sat Dec 2 00:09:58 2017 New Revision: 326449 URL: https://svnweb.freebsd.org/changeset/base/326449 Log: bhndb(4): Fix incorrect assertion in bhndb_deregister_intr_handler(). When deregistered, a handler should be in an 'active' state. Approved by: adrian (mentor, implicit) Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/bhnd/bhndb/bhndb_subr.c Modified: head/sys/dev/bhnd/bhndb/bhndb_subr.c == --- head/sys/dev/bhnd/bhndb/bhndb_subr.cSat Dec 2 00:07:37 2017 (r326448) +++ head/sys/dev/bhnd/bhndb/bhndb_subr.cSat Dec 2 00:09:58 2017 (r326449) @@ -957,7 +957,7 @@ void bhndb_deregister_intr_handler(struct bhndb_resources *br, struct bhndb_intr_handler *ih) { - KASSERT(!ih->ih_active, ("duplicate deregistration of interrupt " + KASSERT(ih->ih_active, ("duplicate deregistration of interrupt " "handler %p", ih->ih_cookiep)); KASSERT(bhndb_find_intr_handler(br, ih) == ih, ___ 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: r326445 - head/stand/libsa
Author: imp Date: Sat Dec 2 00:07:19 2017 New Revision: 326445 URL: https://svnweb.freebsd.org/changeset/base/326445 Log: Fix random() and srandom() prototypes to match the standard. These prototypes were needlessly different from the standard. Fix them to be the same, and fix the surrounding code after the changes. Sponsored by: Netflix Modified: head/stand/libsa/libstand.3 head/stand/libsa/random.c head/stand/libsa/stand.h Modified: head/stand/libsa/libstand.3 == --- head/stand/libsa/libstand.3 Sat Dec 2 00:07:14 2017(r326444) +++ head/stand/libsa/libstand.3 Sat Dec 2 00:07:19 2017(r326445) @@ -169,10 +169,10 @@ may be used to prevent a variable being unset. .Xc .It Xo .Ft void -.Fn srandom "unsigned long seed" +.Fn srandom "unsigned int seed" .Xc .It Xo -.Ft "unsigned long" +.Ft "long" .Fn random void .Xc .It Xo Modified: head/stand/libsa/random.c == --- head/stand/libsa/random.c Sat Dec 2 00:07:14 2017(r326444) +++ head/stand/libsa/random.c Sat Dec 2 00:07:19 2017(r326445) @@ -34,12 +34,12 @@ __FBSDID("$FreeBSD$"); #include -static u_long randseed = 1; +static long randseed = 1; void -srandom(seed) - u_long seed; +srandom(unsigned int seed) { + randseed = seed; } @@ -48,8 +48,8 @@ srandom(seed) * and whatever else we might use it for. The result is uniform on * [0, 2^31 - 1]. */ -u_long -random() +long +random(void) { long x, hi, lo, t; Modified: head/stand/libsa/stand.h == --- head/stand/libsa/stand.hSat Dec 2 00:07:14 2017(r326444) +++ head/stand/libsa/stand.hSat Dec 2 00:07:19 2017(r326445) @@ -281,7 +281,7 @@ extern ssize_t read(int, void *, size_t); extern ssize_t write(int, void *, size_t); extern struct dirent *readdirfd(int); -extern voidsrandom(u_long seed); +extern voidsrandom(unsigned int); extern u_long random(void); /* imports from stdlib, locally modified */ ___ 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: r326446 - head/stand/userboot/test
Author: imp Date: Sat Dec 2 00:07:25 2017 New Revision: 326446 URL: https://svnweb.freebsd.org/changeset/base/326446 Log: Undefine _STANDALONE since this is test code. This is unsastifying, but since we sadly only have one test, put this in as a stopgap. Sponsored by: Netflix Modified: head/stand/userboot/test/Makefile Modified: head/stand/userboot/test/Makefile == --- head/stand/userboot/test/Makefile Sat Dec 2 00:07:19 2017 (r326445) +++ head/stand/userboot/test/Makefile Sat Dec 2 00:07:25 2017 (r326446) @@ -9,6 +9,6 @@ MK_SSP= no PROG= test INTERNALPROG= -CFLAGS+= -I${BOOTSRC}/userboot +CFLAGS+= -I${BOOTSRC}/userboot -U_STANDALONE .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: r326447 - in head/stand/mips/beri: boot2 common loader
Author: imp Date: Sat Dec 2 00:07:31 2017 New Revision: 326447 URL: https://svnweb.freebsd.org/changeset/base/326447 Log: Tweaks to the beri boot loader so that it builds w/o warnings. Sponsored by: Netflix Modified: head/stand/mips/beri/boot2/Makefile head/stand/mips/beri/boot2/boot2.c head/stand/mips/beri/common/altera_jtag_uart.c head/stand/mips/beri/loader/Makefile head/stand/mips/beri/loader/devicename.c head/stand/mips/beri/loader/exec.c head/stand/mips/beri/loader/loader.h Modified: head/stand/mips/beri/boot2/Makefile == --- head/stand/mips/beri/boot2/Makefile Sat Dec 2 00:07:25 2017 (r326446) +++ head/stand/mips/beri/boot2/Makefile Sat Dec 2 00:07:31 2017 (r326447) @@ -47,9 +47,7 @@ MAN= AFLAGS=-G0 -CFLAGS+= -I${.CURDIR}\ - -I${LDRSRC} \ - -D_KERNEL \ +CFLAGS+= -I${LDRSRC} \ -Wall \ -G0 \ -fno-pic -mno-abicalls \ Modified: head/stand/mips/beri/boot2/boot2.c == --- head/stand/mips/beri/boot2/boot2.c Sat Dec 2 00:07:25 2017 (r326446) +++ head/stand/mips/beri/boot2/boot2.c Sat Dec 2 00:07:31 2017 (r326447) @@ -500,7 +500,7 @@ parse() */ unit = q[len-1]; if (unit < '0' || unit > '9') { - printf("Invalid device: invalid unit\n", q, + printf("Invalid device: invalid unit %c\n", unit); return (-1); } Modified: head/stand/mips/beri/common/altera_jtag_uart.c == --- head/stand/mips/beri/common/altera_jtag_uart.c Sat Dec 2 00:07:25 2017(r326446) +++ head/stand/mips/beri/common/altera_jtag_uart.c Sat Dec 2 00:07:31 2017(r326447) @@ -131,13 +131,6 @@ uart_control_write(uint32_t v) } static int -uart_writable(void) -{ - - return ((uart_control_read() & ALTERA_JTAG_UART_CONTROL_WSPACE) != 0); -} - -static int uart_readable(void) { uint32_t v; Modified: head/stand/mips/beri/loader/Makefile == --- head/stand/mips/beri/loader/MakefileSat Dec 2 00:07:25 2017 (r326446) +++ head/stand/mips/beri/loader/MakefileSat Dec 2 00:07:31 2017 (r326447) @@ -67,7 +67,7 @@ SRCS+=altera_jtag_uart.c \ # Since we don't have a backward compatibility issue, default to this on BERI. CFLAGS+= -DBOOT_PROMPT_123 -HELP_FILES+= help.mips +HELP_FILES+= ${.CURDIR}/help.mips # Always add MI sources .include "${BOOTSRC}/loader.mk" Modified: head/stand/mips/beri/loader/devicename.c == --- head/stand/mips/beri/loader/devicename.cSat Dec 2 00:07:25 2017 (r326446) +++ head/stand/mips/beri/loader/devicename.cSat Dec 2 00:07:31 2017 (r326447) @@ -88,7 +88,7 @@ beri_arch_parsedev(struct disk_devdesc **dev, const ch struct disk_devdesc *idev; struct devsw *dv; inti, unit, err; -const char *cp; +char *cp; const char *np; /* minimum length check */ @@ -130,8 +130,10 @@ beri_arch_parsedev(struct disk_devdesc **dev, const ch goto fail; } } else { - cp = np; + err = EUNIT; + goto fail; } + if (*cp && (*cp != ':')) { err = EINVAL; goto fail; Modified: head/stand/mips/beri/loader/exec.c == --- head/stand/mips/beri/loader/exec.c Sat Dec 2 00:07:25 2017 (r326446) +++ head/stand/mips/beri/loader/exec.c Sat Dec 2 00:07:31 2017 (r326447) @@ -119,7 +119,7 @@ beri_elf64_exec(struct preloaded_file *fp) * least bootinfop. */ (*entry)(boot2_argc, (register_t)boot2_argv, (register_t)boot2_envv, - ); + (register_t)); panic("exec returned"); } Modified: head/stand/mips/beri/loader/loader.h == --- head/stand/mips/beri/loader/loader.hSat Dec 2 00:07:25 2017 (r326446) +++ head/stand/mips/beri/loader/loader.hSat Dec 2 00:07:31 2017 (r326447) @@ -41,6 +41,7 @@ extern struct devswberi_cfi_disk; extern struct devsw beri_sdcard_disk; /* devicename.c */ +struct env_var; int
svn commit: r326444 - head/stand/geli
Author: imp Date: Sat Dec 2 00:07:14 2017 New Revision: 326444 URL: https://svnweb.freebsd.org/changeset/base/326444 Log: Move geli to common DO32 stuff define DO32 since this is only build in amd64/i386 Remove files not needed. Sponsored by: Netflix Modified: head/stand/geli/Makefile Modified: head/stand/geli/Makefile == --- head/stand/geli/MakefileSat Dec 2 00:07:09 2017(r326443) +++ head/stand/geli/MakefileSat Dec 2 00:07:14 2017(r326444) @@ -2,6 +2,7 @@ # libgeliboot MAN= +DO32=1 .include MK_SSP=no @@ -11,18 +12,7 @@ INTERNALLIB= MK_PROFILE=no NO_PIC= -.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" -CFLAGS+=-march=i386 -.endif -.if ${MACHINE_ARCH} == "amd64" -CFLAGS+=-m32 -.endif - WARNS?=0 - -# string functions from libc -.PATH: ${SRCTOP}/lib/libc/string -SRCS+= bcmp.c bcopy.c bzero.c # Our password input method SRCS+= pwgets.c ___ 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: r326448 - in head: stand stand/geli stand/i386/gptboot stand/i386/libi386 stand/i386/zfsboot stand/libsa stand/zfs sys/cddl/boot/zfs
Author: imp Date: Sat Dec 2 00:07:37 2017 New Revision: 326448 URL: https://svnweb.freebsd.org/changeset/base/326448 Log: Fix all warnings related to geli and ZFS support on x86. Default WARNS to 0 still, since there's still some warnings on other architectures. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D13301 Modified: head/stand/defs.mk head/stand/geli/Makefile head/stand/geli/geliboot.c head/stand/i386/gptboot/gptboot.c head/stand/i386/libi386/biosdisk.c head/stand/i386/zfsboot/zfsboot.c head/stand/libsa/Makefile head/stand/zfs/zfsimpl.c head/sys/cddl/boot/zfs/zfssubr.c Modified: head/stand/defs.mk == --- head/stand/defs.mk Sat Dec 2 00:07:31 2017(r326447) +++ head/stand/defs.mk Sat Dec 2 00:07:37 2017(r326448) @@ -2,6 +2,8 @@ .include +WARNS?=0 + .if !defined(__BOOT_DEFS_MK__) __BOOT_DEFS_MK__=${MFILE} Modified: head/stand/geli/Makefile == --- head/stand/geli/MakefileSat Dec 2 00:07:31 2017(r326447) +++ head/stand/geli/MakefileSat Dec 2 00:07:37 2017(r326448) @@ -12,8 +12,6 @@ INTERNALLIB= MK_PROFILE=no NO_PIC= -WARNS?=0 - # Our password input method SRCS+= pwgets.c Modified: head/stand/geli/geliboot.c == --- head/stand/geli/geliboot.c Sat Dec 2 00:07:31 2017(r326447) +++ head/stand/geli/geliboot.c Sat Dec 2 00:07:37 2017(r326448) @@ -222,7 +222,7 @@ geli_taste(int read_func(void *vdev, void *priv, off_t */ static int geli_attach(struct geli_entry *ge, struct dsk *dskp, const char *passphrase, -const u_char *mkeyp) +u_char *mkeyp) { u_char key[G_ELI_USERKEYLEN], mkey[G_ELI_DATAIVKEYLEN], *mkp; u_int keynum; @@ -248,7 +248,7 @@ geli_attach(struct geli_entry *ge, struct dsk *dskp, c } else if (geli_e->md.md_iterations == 0) { g_eli_crypto_hmac_update(, geli_e->md.md_salt, sizeof(geli_e->md.md_salt)); - g_eli_crypto_hmac_update(, passphrase, + g_eli_crypto_hmac_update(, (const uint8_t *)passphrase, strlen(passphrase)); } else if (geli_e->md.md_iterations > 0) { printf("Calculating GELI Decryption Key disk%dp%d @ %d" @@ -294,7 +294,7 @@ found_key: /* * The encryption key is: ekey = HMAC_SHA512(Data-Key, 0x10) */ - g_eli_crypto_hmac(mkp, G_ELI_MAXKEYLEN, "\x10", 1, + g_eli_crypto_hmac(mkp, G_ELI_MAXKEYLEN, (const uint8_t *)"\x10", 1, geli_e->sc.sc_ekey, 0); } explicit_bzero(mkey, sizeof(mkey)); Modified: head/stand/i386/gptboot/gptboot.c == --- head/stand/i386/gptboot/gptboot.c Sat Dec 2 00:07:31 2017 (r326447) +++ head/stand/i386/gptboot/gptboot.c Sat Dec 2 00:07:37 2017 (r326448) @@ -32,6 +32,10 @@ __FBSDID("$FreeBSD$"); #include +/* Forward declared to avoid warnings -- these shouldn't be needed */ +int strcasecmp(const char *s1, const char *s2); +void explicit_bzero(void *b, size_t len); + #include "bootargs.h" #include "lib.h" #include "rbx.h" @@ -254,7 +258,7 @@ gptinit(void) #ifdef LOADER_GELI_SUPPORT if (geli_taste(vdev_read, , (gpttable[curent].ent_lba_end - gpttable[curent].ent_lba_start)) == 0) { - if (geli_havekey() != 0 && geli_passphrase(, + if (geli_havekey() != 0 && geli_passphrase(gelipw, dsk.unit, 'p', curent + 1, ) != 0) { printf("%s: unable to decrypt GELI key\n", BOOTPROG); return (-1); @@ -265,6 +269,8 @@ gptinit(void) dsk_meta = 0; return (0); } + +int main(void); int main(void) Modified: head/stand/i386/libi386/biosdisk.c == --- head/stand/i386/libi386/biosdisk.c Sat Dec 2 00:07:31 2017 (r326447) +++ head/stand/i386/libi386/biosdisk.c Sat Dec 2 00:07:37 2017 (r326448) @@ -146,8 +146,7 @@ enum isgeli { }; static enum isgeli geli_status[MAXBDDEV][MAXTBLENTS]; -int bios_read(void *vdev __unused, struct dsk *priv, off_t off, char *buf, -size_t bytes); +int bios_read(void *, void *, off_t off, void *buf, size_t bytes); #endif /* LOADER_GELI_SUPPORT */ struct devsw biosdisk = { @@ -482,10 +481,10 @@ bd_open(struct open_file *f, ...) /* Use the cached passphrase */ bcopy(passphrase, , GELI_PW_MAXLEN); } - if (geli_passphrase(, dskp.unit, 'p', + if
svn commit: r326443 - in head: stand/geli sys/geom/eli sys/opencrypto sys/sys
Author: imp Date: Sat Dec 2 00:07:09 2017 New Revision: 326443 URL: https://svnweb.freebsd.org/changeset/base/326443 Log: We don't need both _STAND and _STANDALONE. There's more places that use _STANDALONE, so change the former to the latter. Sponsored by: Netflix Modified: head/stand/geli/Makefile head/sys/geom/eli/pkcs5v2.c head/sys/opencrypto/xform_userland.h head/sys/sys/errno.h Modified: head/stand/geli/Makefile == --- head/stand/geli/MakefileSat Dec 2 00:07:04 2017(r326442) +++ head/stand/geli/MakefileSat Dec 2 00:07:09 2017(r326443) @@ -45,7 +45,6 @@ SRCS+=rijndael-alg-fst.c rijndael-api-fst.c rijndael # local GELI Implementation .PATH: ${SYSDIR}/geom/eli -CFLAGS+= -D_STAND SRCS+= geliboot_crypto.c g_eli_hmac.c g_eli_key.c g_eli_key_cache.c pkcs5v2.c # aes Modified: head/sys/geom/eli/pkcs5v2.c == --- head/sys/geom/eli/pkcs5v2.c Sat Dec 2 00:07:04 2017(r326442) +++ head/sys/geom/eli/pkcs5v2.c Sat Dec 2 00:07:09 2017(r326443) @@ -89,7 +89,7 @@ pkcs5v2_genkey(uint8_t *key, unsigned keylen, const ui } #ifndef _KERNEL -#ifndef _STAND +#ifndef _STANDALONE /* * Return the number of microseconds needed for 'interations' iterations. */ @@ -127,5 +127,5 @@ pkcs5v2_calculate(int usecs) } return (((intmax_t)iterations * (intmax_t)usecs) / v); } -#endif /* !_STAND */ +#endif /* !_STANDALONE */ #endif /* !_KERNEL */ Modified: head/sys/opencrypto/xform_userland.h == --- head/sys/opencrypto/xform_userland.hSat Dec 2 00:07:04 2017 (r326442) +++ head/sys/opencrypto/xform_userland.hSat Dec 2 00:07:09 2017 (r326443) @@ -34,7 +34,7 @@ #define KMALLOC(size, type, flags) malloc(size, type, flags) #define KFREE(ptr, type) free(ptr, type) #else /* not _KERNEL */ -#ifdef _STAND +#ifdef _STANDALONE #include #else /* !_STAND */ #include Modified: head/sys/sys/errno.h == --- head/sys/sys/errno.hSat Dec 2 00:07:04 2017(r326442) +++ head/sys/sys/errno.hSat Dec 2 00:07:09 2017(r326443) @@ -40,7 +40,7 @@ #ifndef _SYS_ERRNO_H_ #define _SYS_ERRNO_H_ -#if !defined(_KERNEL) && !defined(_STAND) +#if !defined(_KERNEL) && !defined(_STANDALONE) #include __BEGIN_DECLS int * __error(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: r326441 - in head/stand: . libsa mips/beri/boot2
Author: imp Date: Sat Dec 2 00:06:58 2017 New Revision: 326441 URL: https://svnweb.freebsd.org/changeset/base/326441 Log: Minor flags cleanup Move kernel includes and libsa includes together at the top of defs.mk Move all machine specific defines from Makefile.inc to their friends in defs.mk. Add comments and remove now useless junk after the move. Sponsored by: Netflix Modified: head/stand/Makefile.inc head/stand/defs.mk head/stand/libsa/Makefile head/stand/mips/beri/boot2/Makefile Modified: head/stand/Makefile.inc == --- head/stand/Makefile.inc Sat Dec 2 00:06:52 2017(r326440) +++ head/stand/Makefile.inc Sat Dec 2 00:06:58 2017(r326441) @@ -1,53 +1,3 @@ # $FreeBSD$ .include "defs.mk" - -.if !defined(__BOOT_MAKEFILE_INC__) -__BOOT_MAKEFILE_INC__=${MFILE} - -CFLAGS+=-I${SASRC} - -SSP_CFLAGS= - -# Add in the no float / no SIMD stuff and announce we're freestanding -# aarch64 and riscv don't have -msoft-float, but all others do. riscv -# currently has no /boot/loader, but may soon. -CFLAGS+= -ffreestanding ${CFLAGS_NO_SIMD} -.if ${MACHINE_CPUARCH} == "aarch64" -CFLAGS+= -mgeneral-regs-only -.elif ${MACHINE_CPUARCH} != "riscv" -CFLAGS+= -msoft-float -.endif - -.if ${MACHINE_CPUARCH} == "i386" || (${MACHINE_CPUARCH} == "amd64" && ${DO32:U0} == 1) -CFLAGS+= -march=i386 -CFLAGS.gcc+= -mpreferred-stack-boundary=2 -.endif - - -.if ${MACHINE_CPUARCH} == "arm" -# Do not generate movt/movw, because the relocation fixup for them does not -# translate to the -Bsymbolic -pie format required by self_reloc() in loader(8). -# Also, the fpu is not available in a standalone environment. -.if ${COMPILER_VERSION} < 30800 -CFLAGS.clang+= -mllvm -arm-use-movt=0 -.else -CFLAGS.clang+= -mno-movt -.endif -CFLAGS.clang+= -mfpu=none -.endif - -# The boot loader build uses dd status=none, where possible, for reproducible -# build output (since performance varies from run to run). Trouble is that -# option was recently (10.3) added to FreeBSD and is non-standard. Only use it -# when this test succeeds rather than require dd to be a bootstrap tool. -DD_NOSTATUS!=(dd status=none count=0 2> /dev/null && echo status=none) || true -DD=dd ${DD_NOSTATUS} - -.if ${MK_LOADER_FORCE_LE} != "no" -.if ${MACHINE_ARCH} == "powerpc64" -CFLAGS+= -mlittle-endian -.endif -.endif - -.endif Modified: head/stand/defs.mk == --- head/stand/defs.mk Sat Dec 2 00:06:52 2017(r326440) +++ head/stand/defs.mk Sat Dec 2 00:06:58 2017(r326441) @@ -39,6 +39,8 @@ LIBSA32= ${BOOTOBJ}/libsa32/libsa32.a .endif # Standard options: +CFLAGS+= -I${SASRC} +CFLAGS+= -I${SYSDIR} # Filesystem support .if ${LOADER_CD9660_SUPPORT:Uno} == "yes" @@ -104,7 +106,7 @@ LIBGELIBOOT=${BOOTOBJ}/geli/libgeliboot.a .endif .endif -CFLAGS+= -I${SYSDIR} +# Machine specific flags for all builds here # All PowerPC builds are 32 bit. We have no 64-bit loaders on powerpc # or powerpc64. @@ -120,6 +122,49 @@ CFLAGS+= -m32 -mcpu=i386 # LD_FLAGS is passed directly to ${LD}, not via ${CC}: LD_FLAGS+= -m elf_i386_fbsd AFLAGS+= --32 +.endif + +SSP_CFLAGS= + +# Add in the no float / no SIMD stuff and announce we're freestanding +# aarch64 and riscv don't have -msoft-float, but all others do. riscv +# currently has no /boot/loader, but may soon. +CFLAGS+= -ffreestanding ${CFLAGS_NO_SIMD} +.if ${MACHINE_CPUARCH} == "aarch64" +CFLAGS+= -mgeneral-regs-only +.elif ${MACHINE_CPUARCH} != "riscv" +CFLAGS+= -msoft-float +.endif + +.if ${MACHINE_CPUARCH} == "i386" || (${MACHINE_CPUARCH} == "amd64" && ${DO32:U0} == 1) +CFLAGS+= -march=i386 +CFLAGS.gcc+= -mpreferred-stack-boundary=2 +.endif + + +.if ${MACHINE_CPUARCH} == "arm" +# Do not generate movt/movw, because the relocation fixup for them does not +# translate to the -Bsymbolic -pie format required by self_reloc() in loader(8). +# Also, the fpu is not available in a standalone environment. +.if ${COMPILER_VERSION} < 30800 +CFLAGS.clang+= -mllvm -arm-use-movt=0 +.else +CFLAGS.clang+= -mno-movt +.endif +CFLAGS.clang+= -mfpu=none +.endif + +# The boot loader build uses dd status=none, where possible, for reproducible +# build output (since performance varies from run to run). Trouble is that +# option was recently (10.3) added to FreeBSD and is non-standard. Only use it +# when this test succeeds rather than require dd to be a bootstrap tool. +DD_NOSTATUS!=(dd status=none count=0 2> /dev/null && echo status=none) || true +DD=dd ${DD_NOSTATUS} + +.if ${MK_LOADER_FORCE_LE} != "no" +.if ${MACHINE_ARCH} == "powerpc64" +CFLAGS+= -mlittle-endian +.endif .endif # Make sure we use the machine link we're about to create Modified: head/stand/libsa/Makefile
svn commit: r326440 - in head/stand: efi/boot1 i386/gptboot powerpc/boot1.chrp sparc64/boot1
Author: imp Date: Sat Dec 2 00:06:52 2017 New Revision: 326440 URL: https://svnweb.freebsd.org/changeset/base/326440 Log: Remove stale dependency on ufsread.c Remove the now-useless dependency on ufsread.c. In some cases, it was on the wrong file. But in all cases, we now automatically generate .depend files, so we don't need it explicitly. Sponsored by: Netflix Modified: head/stand/efi/boot1/Makefile head/stand/i386/gptboot/Makefile head/stand/powerpc/boot1.chrp/Makefile head/stand/sparc64/boot1/Makefile Modified: head/stand/efi/boot1/Makefile == --- head/stand/efi/boot1/Makefile Fri Dec 1 22:52:45 2017 (r326439) +++ head/stand/efi/boot1/Makefile Sat Dec 2 00:06:52 2017 (r326440) @@ -106,8 +106,6 @@ boot1.efi: ${PROG} -j .rela.dyn -j .reloc -j .eh_frame \ --output-target=${EFI_TARGET} ${.ALLSRC} ${.TARGET} -boot1.o: ${SASRC}/ufsread.c - # The following inserts our objects into a template FAT file system # created by generate-fat.sh Modified: head/stand/i386/gptboot/Makefile == --- head/stand/i386/gptboot/MakefileFri Dec 1 22:52:45 2017 (r326439) +++ head/stand/i386/gptboot/MakefileSat Dec 2 00:06:52 2017 (r326440) @@ -67,8 +67,6 @@ gptboot.bin: gptboot.out gptboot.out: ${BTXCRT} gptboot.o sio.o crc32.o drv.o cons.o ${OPENCRYPTO_XTS} ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBGELIBOOT} ${LIBSA32} -gptboot.o: ${SASRC}/ufsread.c - .include # XXX: clang integrated-as doesn't grok .codeNN directives yet Modified: head/stand/powerpc/boot1.chrp/Makefile == --- head/stand/powerpc/boot1.chrp/Makefile Fri Dec 1 22:52:45 2017 (r326439) +++ head/stand/powerpc/boot1.chrp/Makefile Sat Dec 2 00:06:52 2017 (r326440) @@ -34,7 +34,5 @@ boot1.hfs: boot1.elf bootinfo.txt CLEANFILES+= boot1.hfs -boot1.o: ${SASRC}/ufsread.c - .include Modified: head/stand/sparc64/boot1/Makefile == --- head/stand/sparc64/boot1/Makefile Fri Dec 1 22:52:45 2017 (r326439) +++ head/stand/sparc64/boot1/Makefile Sat Dec 2 00:06:52 2017 (r326440) @@ -27,6 +27,4 @@ ${FILES}: boot1.aout boot1.aout: boot1.elf elf2aout -o ${.TARGET} ${.ALLSRC} -boot1.o: ${SASRC}/ufsread.c - .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: r326442 - in head/stand: . powerpc/boot1.chrp
Author: imp Date: Sat Dec 2 00:07:04 2017 New Revision: 326442 URL: https://svnweb.freebsd.org/changeset/base/326442 Log: Cleanup CFALGS usage here Only define the CFLAGS we need. SSP_CFLAGS is now defined globally, no need to define it here. Define -D_STANDALONE globally for src/stand builds. Sponsored by: Netflix Modified: head/stand/defs.mk head/stand/powerpc/boot1.chrp/Makefile Modified: head/stand/defs.mk == --- head/stand/defs.mk Sat Dec 2 00:06:58 2017(r326441) +++ head/stand/defs.mk Sat Dec 2 00:07:04 2017(r326442) @@ -39,7 +39,7 @@ LIBSA32= ${BOOTOBJ}/libsa32/libsa32.a .endif # Standard options: -CFLAGS+= -I${SASRC} +CFLAGS+= -I${SASRC} -D_STANDALONE CFLAGS+= -I${SYSDIR} # Filesystem support Modified: head/stand/powerpc/boot1.chrp/Makefile == --- head/stand/powerpc/boot1.chrp/Makefile Sat Dec 2 00:06:58 2017 (r326441) +++ head/stand/powerpc/boot1.chrp/Makefile Sat Dec 2 00:07:04 2017 (r326442) @@ -2,8 +2,6 @@ .include -SSP_CFLAGS= - PROG= boot1.elf NEWVERSWHAT="Open Firmware boot block" ${MACHINE_ARCH} INSTALLFLAGS= -b @@ -13,7 +11,7 @@ SRCS= boot1.c ashldi3.c syncicache.c MAN= -CFLAGS= -I${LDRSRC} -I${SYSDIR} -I${SASRC} -D_STANDALONE +CFLAGS+=-I${LDRSRC} LDFLAGS=-nostdlib -static -Wl,-N .PATH: ${SYSDIR}/libkern ${SRCTOP}/lib/libc/powerpc/gen ${.CURDIR} ___ 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: r326439 - head/lib/libc/sys
Author: imp Date: Fri Dec 1 22:52:45 2017 New Revision: 326439 URL: https://svnweb.freebsd.org/changeset/base/326439 Log: Fix missing .Dd bump Modified: head/lib/libc/sys/mknod.2 Modified: head/lib/libc/sys/mknod.2 == --- head/lib/libc/sys/mknod.2 Fri Dec 1 22:51:02 2017(r326438) +++ head/lib/libc/sys/mknod.2 Fri Dec 1 22:52:45 2017(r326439) @@ -28,7 +28,7 @@ .\" @(#)mknod.28.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd January 16, 2011 +.Dd December 1, 2017 .Dt MKNOD 2 .Os .Sh NAME ___ 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: r326438 - head/sys/kern
Author: markj Date: Fri Dec 1 22:51:02 2017 New Revision: 326438 URL: https://svnweb.freebsd.org/changeset/base/326438 Log: Plug a name cache lock leak. Reviewed by: mjg MFC after:1 week Sponsored by: Dell EMC Isilon Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c == --- head/sys/kern/vfs_cache.c Fri Dec 1 22:48:20 2017(r326437) +++ head/sys/kern/vfs_cache.c Fri Dec 1 22:51:02 2017(r326438) @@ -1162,6 +1162,8 @@ retry_dotdot: SDT_PROBE3(vfs, namecache, lookup, miss, dvp, "..", NULL); mtx_unlock(dvlp); + if (dvlp2 != NULL) + mtx_unlock(dvlp2); return (0); } if ((ncp->nc_flag & NCF_ISDOTDOT) != 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: r326437 - in head/lib/libc: gen sys
Author: imp Date: Fri Dec 1 22:48:20 2017 New Revision: 326437 URL: https://svnweb.freebsd.org/changeset/base/326437 Log: Correct history for Unix 2nd Edition through 6th Edition for the system calls. Man pages are missing for v2 and v5, so any entries for those versions were inferred by new implementations of these functions in libc. Obtained from: http://www.tuhs.org/cgi-bin/utree.pl Modified: head/lib/libc/gen/signal.3 head/lib/libc/sys/dup.2 head/lib/libc/sys/getuid.2 head/lib/libc/sys/kill.2 head/lib/libc/sys/mknod.2 head/lib/libc/sys/pipe.2 head/lib/libc/sys/profil.2 head/lib/libc/sys/ptrace.2 head/lib/libc/sys/setuid.2 head/lib/libc/sys/sync.2 Modified: head/lib/libc/gen/signal.3 == --- head/lib/libc/gen/signal.3 Fri Dec 1 22:38:28 2017(r326436) +++ head/lib/libc/gen/signal.3 Fri Dec 1 22:48:20 2017(r326437) @@ -28,7 +28,7 @@ .\" @(#)signal.3 8.3 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd June 7, 2004 +.Dd December 1, 2017 .Dt SIGNAL 3 .Os .Sh NAME @@ -263,6 +263,10 @@ or .Xr tty 4 .Sh HISTORY The +.Fn signal +function appeared in +.At v4 . +The current .Nm facility appeared in .Bx 4.0 . Modified: head/lib/libc/sys/dup.2 == --- head/lib/libc/sys/dup.2 Fri Dec 1 22:38:28 2017(r326436) +++ head/lib/libc/sys/dup.2 Fri Dec 1 22:48:20 2017(r326437) @@ -28,7 +28,7 @@ .\" @(#)dup.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 1, 2013 +.Dd December 1, 2017 .Dt DUP 2 .Os .Sh NAME @@ -163,7 +163,9 @@ system calls are expected to conform to .Sh HISTORY The .Fn dup -and +function appeared in +.At v3 . +The .Fn dup2 -functions appeared in +function appeared in .At v7 . Modified: head/lib/libc/sys/getuid.2 == --- head/lib/libc/sys/getuid.2 Fri Dec 1 22:38:28 2017(r326436) +++ head/lib/libc/sys/getuid.2 Fri Dec 1 22:48:20 2017(r326437) @@ -88,4 +88,4 @@ function appeared in The .Fn geteuid function appeared in -.At v7 . +.At v4 . Modified: head/lib/libc/sys/kill.2 == --- head/lib/libc/sys/kill.2Fri Dec 1 22:38:28 2017(r326436) +++ head/lib/libc/sys/kill.2Fri Dec 1 22:48:20 2017(r326437) @@ -28,7 +28,7 @@ .\" @(#)kill.2 8.3 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd March 15, 2012 +.Dd December 1, 2017 .Dt KILL 2 .Os .Sh NAME @@ -150,7 +150,11 @@ The system call is expected to conform to .St -p1003.1-90 . .Sh HISTORY -The +A version of the .Fn kill function appeared in -.At v7 . +.At v3 . +The signal number was added to the +.Fn kill +function in +.At v4 . Modified: head/lib/libc/sys/mknod.2 == --- head/lib/libc/sys/mknod.2 Fri Dec 1 22:38:28 2017(r326436) +++ head/lib/libc/sys/mknod.2 Fri Dec 1 22:48:20 2017(r326437) @@ -175,7 +175,7 @@ system call follows The Open Group Extended API Set 2 The .Fn mknod function appeared in -.At v6 . +.At v4 . The .Fn mknodat system call appeared in Modified: head/lib/libc/sys/pipe.2 == --- head/lib/libc/sys/pipe.2Fri Dec 1 22:38:28 2017(r326436) +++ head/lib/libc/sys/pipe.2Fri Dec 1 22:48:20 2017(r326437) @@ -28,7 +28,7 @@ .\" @(#)pipe.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd July 20, 2016 +.Dd December 1, 2017 .Dt PIPE 2 .Os .Sh NAME Modified: head/lib/libc/sys/profil.2 == --- head/lib/libc/sys/profil.2 Fri Dec 1 22:38:28 2017(r326436) +++ head/lib/libc/sys/profil.2 Fri Dec 1 22:48:20 2017(r326437) @@ -31,7 +31,7 @@ .\"@(#)profil.28.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd December 1, 2017 .Dt PROFIL 2 .Os .Sh NAME @@ -109,7 +109,7 @@ contains an invalid address. The .Fn profil function appeared in -.At v7 . +.At v6 . .Sh BUGS This routine should be named .Fn profile . Modified: head/lib/libc/sys/ptrace.2 == --- head/lib/libc/sys/ptrace.2 Fri Dec 1 22:38:28 2017(r326436) +++ head/lib/libc/sys/ptrace.2 Fri Dec 1 22:48:20 2017(r326437) @@ -2,7 +2,7 @@ .\"$NetBSD: ptrace.2,v 1.2 1995/02/27 12:35:37 cgd Exp $ .\" .\" This file is in the public domain. -.Dd September 14, 2017 +.Dd December 1, 2017 .Dt PTRACE 2 .Os .Sh NAME @@ -1105,4 +1105,4 @@ holds the minimum buffer size required on return. The .Fn ptrace function appeared in -.At v7 . +.At v6 . Modified: head/lib/libc/sys/setuid.2
svn commit: r326436 - head/usr.bin/vmstat
Author: kib Date: Fri Dec 1 22:38:28 2017 New Revision: 326436 URL: https://svnweb.freebsd.org/changeset/base/326436 Log: vmstat: fix style(9) violations and bump WARNS. Based on the patch by:Pawel BiernackiSponsored by: Mysterious Code Ltd. (Pawel), The FreeBSD Foundation (me) MFC after:1 week Differential revision:https://reviews.freebsd.org/D13228 Modified: head/usr.bin/vmstat/Makefile head/usr.bin/vmstat/vmstat.c Modified: head/usr.bin/vmstat/Makefile == --- head/usr.bin/vmstat/MakefileFri Dec 1 22:26:36 2017 (r326435) +++ head/usr.bin/vmstat/MakefileFri Dec 1 22:38:28 2017 (r326436) @@ -5,6 +5,6 @@ PROG= vmstat MAN= vmstat.8 LIBADD=devstat kvm memstat xo util -WARNS?=1 +WARNS?=6 .include Modified: head/usr.bin/vmstat/vmstat.c == --- head/usr.bin/vmstat/vmstat.cFri Dec 1 22:26:36 2017 (r326435) +++ head/usr.bin/vmstat/vmstat.cFri Dec 1 22:38:28 2017 (r326436) @@ -85,50 +85,38 @@ __FBSDID("$FreeBSD$"); static char da[] = "da"; +enum x_stats { X_SUM, X_HZ, X_STATHZ, X_NCHSTATS, X_INTRNAMES, X_SINTRNAMES, +X_INTRCNT, X_SINTRCNT, X_DEFICIT, X_REC, X_PGIN, X_XSTATS }; + static struct nlist namelist[] = { -#define X_SUM 0 - { "_vm_cnt" }, -#define X_HZ 1 - { "_hz" }, -#define X_STATHZ 2 - { "_stathz" }, -#define X_NCHSTATS 3 - { "_nchstats" }, -#defineX_INTRNAMES 4 - { "_intrnames" }, -#defineX_SINTRNAMES5 - { "_sintrnames" }, -#defineX_INTRCNT 6 - { "_intrcnt" }, -#defineX_SINTRCNT 7 - { "_sintrcnt" }, + [X_SUM] = { .n_name = "_vm_cnt", }, + [X_HZ] = { .n_name = "_hz", }, + [X_STATHZ] = { .n_name = "_stathz", }, + [X_NCHSTATS] = { .n_name = "_nchstats", }, + [X_INTRNAMES] = { .n_name = "_intrnames", }, + [X_SINTRNAMES] = { .n_name = "_sintrnames", }, + [X_INTRCNT] = { .n_name = "_intrcnt", }, + [X_SINTRCNT] = { .n_name = "_sintrcnt", }, #ifdef notyet -#defineX_DEFICIT XXX - { "_deficit" }, -#define X_REC XXX - { "_rectime" }, -#define X_PGIN XXX - { "_pgintime" }, -#defineX_XSTATSXXX - { "_xstats" }, -#define X_END XXX -#else -#define X_END 8 + [X_DEFICIT] = { .n_name = "_deficit", }, + [X_REC] = { .n_name = "_rectime", }, + [X_PGIN] = { .n_name = "_pgintime", }, + [X_XSTATS] = { .n_name = "_xstats", }, #endif - { "" }, + { .n_name = NULL, }, }; -static struct statinfo cur, last; -static int num_devices, maxshowdevs; -static long generation; -static struct device_selection *dev_select; -static int num_selected; static struct devstat_match *matches; -static int num_matches = 0; -static int num_devices_specified, num_selections; -static long select_generation; -static char **specified_devices; +static struct device_selection *dev_select; +static struct statinfo cur, last; static devstat_select_mode select_mode; +static size_t size_cp_times; +static long *cur_cp_times, *last_cp_times; +static long generation, select_generation; +static int hz, hdrcnt, maxshowdevs; +static int num_devices, num_devices_specified; +static int num_matches, num_selected, num_selections; +static char **specified_devices; static struct __vmmeter { uint64_t v_swtch; @@ -183,7 +171,7 @@ static struct __vmmeter { } sum, osum; #defineVMSTAT_DEFAULT_LINES20 /* Default number of `winlines'. */ -volatile sig_atomic_t wresized;/* Tty resized, when non-zero. */ +static volatile sig_atomic_t wresized; /* Tty resized when non-zero. */ static int winlines = VMSTAT_DEFAULT_LINES; /* Current number of tty rows. */ static int aflag; @@ -191,7 +179,7 @@ static int nflag; static int Pflag; static int hflag; -static kvm_t *kd; +static kvm_t *kd; #defineFORKSTAT0x01 #defineINTRSTAT0x02 @@ -199,11 +187,11 @@ static kvm_t *kd; #defineSUMSTAT 0x08 #defineTIMESTAT0x10 #defineVMSTAT 0x20 -#define ZMEMSTAT 0x40 +#defineZMEMSTAT0x40 #defineOBJSTAT 0x80 static voidcpustats(void); -static voidpcpustats(int, u_long, int); +static voidpcpustats(u_long, int); static voiddevstats(void); static voiddoforkst(void); static voiddointr(unsigned int, int); @@ -214,7 +202,6 @@ static void domemstat_malloc(void); static voiddomemstat_zone(void); static voidkread(int, void *, size_t); static voidkreado(int, void *, size_t, size_t); -static char*kgetstr(const char *); static
svn commit: r326435 - head/lib/libc/sys
Author: imp Date: Fri Dec 1 22:26:36 2017 New Revision: 326435 URL: https://svnweb.freebsd.org/changeset/base/326435 Log: Mark all the system calls that were in 1st Edition Unix as such in the HISTORY section. Note: Any system calls that were added prior to v7, but after v1 weren't changed. Obtained from: http://www.tuhs.org/cgi-bin/utree.pl?file=V1/man/man2 Modified: head/lib/libc/sys/chdir.2 head/lib/libc/sys/chmod.2 head/lib/libc/sys/chown.2 head/lib/libc/sys/close.2 head/lib/libc/sys/fork.2 head/lib/libc/sys/getuid.2 head/lib/libc/sys/link.2 head/lib/libc/sys/mkdir.2 head/lib/libc/sys/mount.2 head/lib/libc/sys/open.2 head/lib/libc/sys/read.2 head/lib/libc/sys/setuid.2 head/lib/libc/sys/stat.2 head/lib/libc/sys/unlink.2 head/lib/libc/sys/wait.2 head/lib/libc/sys/write.2 Modified: head/lib/libc/sys/chdir.2 == --- head/lib/libc/sys/chdir.2 Fri Dec 1 21:44:23 2017(r326434) +++ head/lib/libc/sys/chdir.2 Fri Dec 1 22:26:36 2017(r326435) @@ -28,7 +28,7 @@ .\" @(#)chdir.28.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd December 11, 1993 +.Dd December 1, 2017 .Dt CHDIR 2 .Os .Sh NAME @@ -125,7 +125,7 @@ system call is expected to conform to The .Fn chdir system call appeared in -.At v7 . +.At v1 . The .Fn fchdir system call appeared in Modified: head/lib/libc/sys/chmod.2 == --- head/lib/libc/sys/chmod.2 Fri Dec 1 21:44:23 2017(r326434) +++ head/lib/libc/sys/chmod.2 Fri Dec 1 22:26:36 2017(r326435) @@ -28,7 +28,7 @@ .\" @(#)chmod.28.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd December 1, 2013 +.Dd December 1, 2017 .Dt CHMOD 2 .Os .Sh NAME @@ -312,7 +312,7 @@ system call is expected to conform to The .Fn chmod function appeared in -.At v7 . +.At v1 . The .Fn fchmod system call appeared in Modified: head/lib/libc/sys/chown.2 == --- head/lib/libc/sys/chown.2 Fri Dec 1 21:44:23 2017(r326434) +++ head/lib/libc/sys/chown.2 Fri Dec 1 22:26:36 2017(r326435) @@ -28,7 +28,7 @@ .\" @(#)chown.28.4 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd April 10, 2008 +.Dd December 1, 2017 .Dt CHOWN 2 .Os .Sh NAME @@ -246,7 +246,7 @@ system call follows The Open Group Extended API Set 2 The .Fn chown function appeared in -.At v7 . +.At v1 . The .Fn fchown system call appeared in Modified: head/lib/libc/sys/close.2 == --- head/lib/libc/sys/close.2 Fri Dec 1 21:44:23 2017(r326434) +++ head/lib/libc/sys/close.2 Fri Dec 1 22:26:36 2017(r326435) @@ -28,7 +28,7 @@ .\" @(#)close.28.2 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd September 11, 2013 +.Dd December 1, 2017 .Dt CLOSE 2 .Os .Sh NAME @@ -141,4 +141,4 @@ system call is expected to conform to The .Fn close function appeared in -.At v7 . +.At v1 . Modified: head/lib/libc/sys/fork.2 == --- head/lib/libc/sys/fork.2Fri Dec 1 21:44:23 2017(r326434) +++ head/lib/libc/sys/fork.2Fri Dec 1 22:26:36 2017(r326435) @@ -28,7 +28,7 @@ .\"@(#)fork.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd May 1, 2015 +.Dd December 1, 2017 .Dt FORK 2 .Os .Sh NAME @@ -145,4 +145,4 @@ There is insufficient swap space for the new process. The .Fn fork function appeared in -.At v6 . +.At v1 . Modified: head/lib/libc/sys/getuid.2 == --- head/lib/libc/sys/getuid.2 Fri Dec 1 21:44:23 2017(r326434) +++ head/lib/libc/sys/getuid.2 Fri Dec 1 22:26:36 2017(r326435) @@ -28,7 +28,7 @@ .\" @(#)getuid.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd December 15, 2015 +.Dd December 1, 2017 .Dt GETUID 2 .Os .Sh NAME @@ -83,7 +83,9 @@ system calls are expected to conform to .Sh HISTORY The .Fn getuid -and +function appeared in +.At v1 . +The .Fn geteuid -functions appeared in +function appeared in .At v7 . Modified: head/lib/libc/sys/link.2 == --- head/lib/libc/sys/link.2Fri Dec 1 21:44:23 2017(r326434) +++ head/lib/libc/sys/link.2Fri Dec 1 22:26:36 2017(r326435) @@ -28,7 +28,7 @@ .\" @(#)link.2 8.3 (Berkeley) 1/12/94 .\" $FreeBSD$ .\" -.Dd April 10, 2008 +.Dd December 1, 2017 .Dt LINK 2 .Os .Sh NAME @@ -275,7 +275,7 @@ system call follows The Open Group Extended API Set 2 The .Fn link function appeared in -.At v7 . +.At v1 . The .Fn linkat system call appeared in Modified: head/lib/libc/sys/mkdir.2 ==
svn commit: r326434 - head/usr.bin/fmt
Author: eadler Date: Fri Dec 1 21:44:23 2017 New Revision: 326434 URL: https://svnweb.freebsd.org/changeset/base/326434 Log: fmt(1): Fix usage of Nm macro Modified: head/usr.bin/fmt/fmt.1 Modified: head/usr.bin/fmt/fmt.1 == --- head/usr.bin/fmt/fmt.1 Fri Dec 1 20:51:08 2017(r326433) +++ head/usr.bin/fmt/fmt.1 Fri Dec 1 21:44:23 2017(r326434) @@ -30,14 +30,14 @@ .\" .\" Modified by Gareth McCaughan to describe the new version of `fmt' .\" rather than the old one. -.Dd August 2, 2004 +.Dd December 1, 2017 .Dt FMT 1 .Os .Sh NAME .Nm fmt .Nd simple text formatter .Sh SYNOPSIS -.Nm fmt +.Nm .Op Fl cmnps .Op Fl d Ar chars .Op Fl l Ar num ___ 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: r326433 - head/sys/arm/allwinner
Author: kevans Date: Fri Dec 1 20:51:08 2017 New Revision: 326433 URL: https://svnweb.freebsd.org/changeset/base/326433 Log: a10_gpio: Add support for more modern pin configuration a10_gpio previously accepted only {allwinner,}drive and {allwinner,}pull for drive/bias setting, while newer DTS is using drive-strength and bias-{disable,pull-up,pull-down} properties. Accept these properties as well. Additionally make bias and drive strength optional rather than required; not setting them should just indicate that we do not need to configure these properties. Tested on:BananaPi-M3 (a83t) Reviewed by: manu Approved by: emaste (implicit) Obtained from:NetBSD (partially) Differential Revision:https://reviews.freebsd.org/D13284 Modified: head/sys/arm/allwinner/a10_gpio.c Modified: head/sys/arm/allwinner/a10_gpio.c == --- head/sys/arm/allwinner/a10_gpio.c Fri Dec 1 17:58:20 2017 (r326432) +++ head/sys/arm/allwinner/a10_gpio.c Fri Dec 1 20:51:08 2017 (r326433) @@ -203,6 +203,11 @@ struct a10_gpio_softc { #defineA10_GPIO_GP_INT_STA 0x214 #defineA10_GPIO_GP_INT_DEB 0x218 +static char *a10_gpio_parse_function(phandle_t node); +static const char **a10_gpio_parse_pins(phandle_t node, int *pins_nb); +static uint32_t a10_gpio_parse_bias(phandle_t node); +static int a10_gpio_parse_drive_strength(phandle_t node, uint32_t *drive); + static int a10_gpio_pin_get(device_t dev, uint32_t pin, unsigned int *value); static int a10_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value); static int a10_gpio_pin_get_locked(struct a10_gpio_softc *sc, uint32_t pin, unsigned int *value); @@ -278,6 +283,9 @@ a10_gpio_set_pud(struct a10_gpio_softc *sc, uint32_t p { uint32_t bank, offset, val; + if (a10_gpio_get_pud(sc, pin) == state) + return; + /* Must be called with lock held. */ A10_GPIO_LOCK_ASSERT(sc); @@ -313,6 +321,9 @@ a10_gpio_set_drv(struct a10_gpio_softc *sc, uint32_t p { uint32_t bank, offset, val; + if (a10_gpio_get_drv(sc, pin) == drive) + return; + /* Must be called with lock held. */ A10_GPIO_LOCK_ASSERT(sc); @@ -541,7 +552,76 @@ a10_gpio_pin_get_locked(struct a10_gpio_softc *sc,uint return (0); } +static char * +a10_gpio_parse_function(phandle_t node) +{ + char *function; + + if (OF_getprop_alloc(node, "function", sizeof(*function), + (void **)) != -1) + return (function); + if (OF_getprop_alloc(node, "allwinner,function", sizeof(*function), + (void **)) != -1) + return (function); + + return (NULL); +} + +static const char ** +a10_gpio_parse_pins(phandle_t node, int *pins_nb) +{ + const char **pinlist; + + *pins_nb = ofw_bus_string_list_to_array(node, "pins", ); + if (*pins_nb > 0) + return (pinlist); + + *pins_nb = ofw_bus_string_list_to_array(node, "allwinner,pins", + ); + if (*pins_nb > 0) + return (pinlist); + + return (NULL); +} + +static uint32_t +a10_gpio_parse_bias(phandle_t node) +{ + uint32_t bias; + + if (OF_getencprop(node, "pull", , sizeof(bias)) != -1) + return (bias); + if (OF_getencprop(node, "allwinner,pull", , sizeof(bias)) != -1) + return (bias); + if (OF_hasprop(node, "bias-disable")) + return (A10_GPIO_NONE); + if (OF_hasprop(node, "bias-pull-up")) + return (A10_GPIO_PULLUP); + if (OF_hasprop(node, "bias-pull-down")) + return (A10_GPIO_PULLDOWN); + + return (A10_GPIO_NONE); +} + static int +a10_gpio_parse_drive_strength(phandle_t node, uint32_t *drive) +{ + uint32_t drive_str; + + if (OF_getencprop(node, "drive", drive, sizeof(*drive)) != -1) + return (0); + if (OF_getencprop(node, "allwinner,drive", drive, sizeof(*drive)) != -1) + return (0); + if (OF_getencprop(node, "drive-strength", _str, + sizeof(drive_str)) != -1) { + *drive = (drive_str / 10) - 1; + return (0); + } + + return (1); +} + +static int a10_gpio_pin_get(device_t dev, uint32_t pin, unsigned int *val) { struct a10_gpio_softc *sc; @@ -682,46 +762,29 @@ aw_fdt_configure_pins(device_t dev, phandle_t cfgxref) char *pin_function = NULL; uint32_t pin_drive, pin_pull; int pins_nb, pin_num, pin_func, i, ret; + bool set_drive; sc = device_get_softc(dev); node = OF_node_from_xref(cfgxref); ret = 0; + set_drive = false; /* Getting all prop for configuring pins */ - pins_nb = ofw_bus_string_list_to_array(node, "pins", ); - if (pins_nb <= 0) { - pins_nb =
svn commit: r326432 - head/sys/net
Author: shurd Date: Fri Dec 1 17:58:20 2017 New Revision: 326432 URL: https://svnweb.freebsd.org/changeset/base/326432 Log: Add support for SIOCGIFXMEDIA to iflib SIOCGIFXMEDIA is required for extended ethernet media types, but iflib did not support it. Reported by: Bhargava Chenna MarreddySponsored by: Limelight Networks Differential Revision:https://reviews.freebsd.org/D13312 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c == --- head/sys/net/iflib.cFri Dec 1 17:15:13 2017(r326431) +++ head/sys/net/iflib.cFri Dec 1 17:58:20 2017(r326432) @@ -3912,6 +3912,7 @@ iflib_if_ioctl(if_t ifp, u_long command, caddr_t data) CTX_UNLOCK(ctx); /* falls thru */ case SIOCGIFMEDIA: + case SIOCGIFXMEDIA: err = ifmedia_ioctl(ifp, ifr, >ifc_media, command); break; case SIOCGI2C: ___ 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: r326431 - stable/11/sys/boot/common
Author: emaste Date: Fri Dec 1 17:15:13 2017 New Revision: 326431 URL: https://svnweb.freebsd.org/changeset/base/326431 Log: MFC r324703: loader.mk: clean md.o even if MD_IMAGE_SIZE not defined We don't normally provide special handling for optionally-included src files, but md.o depends on both md.c and the value of ${MD_IMAGE_SIZE}. Previously if one built with MD_IMAGE_SIZE, executed "make clean", and then built with a different MD_IMAGE_SIZE md.o would not be rebuilt. Reported by: Zakary Nafziger Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/boot/common/Makefile.inc Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/common/Makefile.inc == --- stable/11/sys/boot/common/Makefile.inc Fri Dec 1 11:32:05 2017 (r326430) +++ stable/11/sys/boot/common/Makefile.inc Fri Dec 1 17:15:13 2017 (r326431) @@ -50,6 +50,8 @@ SRCS+= bcache.c .if defined(MD_IMAGE_SIZE) CFLAGS+= -DMD_IMAGE_SIZE=${MD_IMAGE_SIZE} SRCS+= md.c +.else +CLEANFILES+= md.o .endif # Machine-independant ISA PnP ___ 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: r326430 - head/bin/ps
Author: trasz Date: Fri Dec 1 11:32:05 2017 New Revision: 326430 URL: https://svnweb.freebsd.org/changeset/base/326430 Log: Add "vmaddr" ps(1) keyword. Obtained from:CheriBSD MFC after:2 weeks Sponsored by: DARPA, AFRL Modified: head/bin/ps/keyword.c head/bin/ps/ps.1 Modified: head/bin/ps/keyword.c == --- head/bin/ps/keyword.c Fri Dec 1 11:18:19 2017(r326429) +++ head/bin/ps/keyword.c Fri Dec 1 11:32:05 2017(r326430) @@ -225,6 +225,8 @@ static VAR var[] = { {"usertime", "USERTIME", NULL, "user-time", USER, usertime, 0, CHAR, NULL, 0}, {"usrpri", "", "upr", NULL, 0, NULL, 0, CHAR, NULL, 0}, + {"vmaddr", "VMADDR", NULL, "vmspace-address", 0, kvar, KOFF(ki_vmspace), + KPTR, "lx", 0}, {"vsize", "", "vsz", NULL, 0, NULL, 0, CHAR, NULL, 0}, {"vsz", "VSZ", NULL, "virtual-size", 0, vsize, 0, CHAR, NULL, 0}, {"wchan", "WCHAN", NULL, "wait-channel", LJUST, wchan, 0, CHAR, NULL, Modified: head/bin/ps/ps.1 == --- head/bin/ps/ps.1Fri Dec 1 11:18:19 2017(r326429) +++ head/bin/ps/ps.1Fri Dec 1 11:32:05 2017(r326430) @@ -29,7 +29,7 @@ .\" @(#)ps.1 8.3 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd October 9, 2017 +.Dd December 1, 2017 .Dt PS 1 .Os .Sh NAME @@ -710,6 +710,8 @@ process pointer user name (from UID) .It Cm usertime accumulated user CPU time +.It Cm vmaddr +vmspace pointer .It Cm vsz virtual size in Kbytes (alias .Cm vsize ) ___ 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: r326429 - head/sys/kern
Author: kib Date: Fri Dec 1 11:18:19 2017 New Revision: 326429 URL: https://svnweb.freebsd.org/changeset/base/326429 Log: Destroy seltd st_mtx and st_wait in seltdfini(). A correct destruction is important for WITNESS(4) and LOCK_PROFILING(9). Submitted by: Sebastian HuberMFC after:1 week Modified: head/sys/kern/sys_generic.c Modified: head/sys/kern/sys_generic.c == --- head/sys/kern/sys_generic.c Fri Dec 1 11:14:13 2017(r326428) +++ head/sys/kern/sys_generic.c Fri Dec 1 11:18:19 2017(r326429) @@ -1884,6 +1884,8 @@ seltdfini(struct thread *td) if (stp->st_free2) uma_zfree(selfd_zone, stp->st_free2); td->td_sel = NULL; + cv_destroy(>st_wait); + mtx_destroy(>st_mtx); free(stp, M_SELECT); } ___ 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: r326428 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: avg Date: Fri Dec 1 11:14:13 2017 New Revision: 326428 URL: https://svnweb.freebsd.org/changeset/base/326428 Log: MFC r326070: zfs_write: fix problem with writes appearing to succeed when over quota The problem happens when the writes have offsets and sizes aligned with a filesystem's recordsize (maximum block size). In this scenario dmu_tx_assign() would fail because of being over the quota, but the uio would already be modified in the code path where we copy data from the uio into a borrowed ARC buffer. That makes an appearance of a partial write, so zfs_write() would return success and the uio would be modified consistently with writing a single block. That bug can result in a data loss because the writes over the quota would appear to succeed while the actual data is being discarded. This commit fixes the bug by ensuring that the uio is not changed until after all error checks are done. To achieve that the code now uses uiocopy() + uioskip() as in the original illumos design. We can do that now that uiocopy() has been updated in r326067 to use vn_io_fault_uiomove(). Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c == --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Dec 1 11:13:58 2017(r326427) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Dec 1 11:14:13 2017(r326428) @@ -1036,31 +1036,18 @@ zfs_write(vnode_t *vp, uio_t *uio, int ioflag, cred_t * holding up the transaction if the data copy hangs * up on a pagefault (e.g., from an NFS server mapping). */ -#ifdef illumos size_t cbytes; -#endif abuf = dmu_request_arcbuf(sa_get_db(zp->z_sa_hdl), max_blksz); ASSERT(abuf != NULL); ASSERT(arc_buf_size(abuf) == max_blksz); -#ifdef illumos if (error = uiocopy(abuf->b_data, max_blksz, UIO_WRITE, uio, )) { dmu_return_arcbuf(abuf); break; } ASSERT(cbytes == max_blksz); -#else - ssize_t resid = uio->uio_resid; - error = vn_io_fault_uiomove(abuf->b_data, max_blksz, uio); - if (error != 0) { - uio->uio_offset -= resid - uio->uio_resid; - uio->uio_resid = resid; - dmu_return_arcbuf(abuf); - break; - } -#endif } /* @@ -1138,10 +1125,8 @@ zfs_write(vnode_t *vp, uio_t *uio, int ioflag, cred_t dmu_assign_arcbuf(sa_get_db(zp->z_sa_hdl), woff, abuf, tx); } -#ifdef illumos ASSERT(tx_bytes <= uio->uio_resid); uioskip(uio, tx_bytes); -#endif } if (tx_bytes && vn_has_cached_data(vp)) { update_pages(vp, woff, tx_bytes, zfsvfs->z_os, ___ 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: r326427 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: avg Date: Fri Dec 1 11:13:58 2017 New Revision: 326427 URL: https://svnweb.freebsd.org/changeset/base/326427 Log: MFC r326070: zfs_write: fix problem with writes appearing to succeed when over quota The problem happens when the writes have offsets and sizes aligned with a filesystem's recordsize (maximum block size). In this scenario dmu_tx_assign() would fail because of being over the quota, but the uio would already be modified in the code path where we copy data from the uio into a borrowed ARC buffer. That makes an appearance of a partial write, so zfs_write() would return success and the uio would be modified consistently with writing a single block. That bug can result in a data loss because the writes over the quota would appear to succeed while the actual data is being discarded. This commit fixes the bug by ensuring that the uio is not changed until after all error checks are done. To achieve that the code now uses uiocopy() + uioskip() as in the original illumos design. We can do that now that uiocopy() has been updated in r326067 to use vn_io_fault_uiomove(). Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c == --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Dec 1 11:11:25 2017(r326426) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Dec 1 11:13:58 2017(r326427) @@ -1036,31 +1036,18 @@ zfs_write(vnode_t *vp, uio_t *uio, int ioflag, cred_t * holding up the transaction if the data copy hangs * up on a pagefault (e.g., from an NFS server mapping). */ -#ifdef illumos size_t cbytes; -#endif abuf = dmu_request_arcbuf(sa_get_db(zp->z_sa_hdl), max_blksz); ASSERT(abuf != NULL); ASSERT(arc_buf_size(abuf) == max_blksz); -#ifdef illumos if (error = uiocopy(abuf->b_data, max_blksz, UIO_WRITE, uio, )) { dmu_return_arcbuf(abuf); break; } ASSERT(cbytes == max_blksz); -#else - ssize_t resid = uio->uio_resid; - error = vn_io_fault_uiomove(abuf->b_data, max_blksz, uio); - if (error != 0) { - uio->uio_offset -= resid - uio->uio_resid; - uio->uio_resid = resid; - dmu_return_arcbuf(abuf); - break; - } -#endif } /* @@ -1138,10 +1125,8 @@ zfs_write(vnode_t *vp, uio_t *uio, int ioflag, cred_t dmu_assign_arcbuf(sa_get_db(zp->z_sa_hdl), woff, abuf, tx); } -#ifdef illumos ASSERT(tx_bytes <= uio->uio_resid); uioskip(uio, tx_bytes); -#endif } if (tx_bytes && vn_has_cached_data(vp)) { update_pages(vp, woff, tx_bytes, zfsvfs->z_os, ___ 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: r326426 - stable/10/sys/cddl/compat/opensolaris/kern
Author: avg Date: Fri Dec 1 11:11:25 2017 New Revision: 326426 URL: https://svnweb.freebsd.org/changeset/base/326426 Log: MFC r326067: make illumos uiocopy use vn_io_fault_uiomove Modified: stable/10/sys/cddl/compat/opensolaris/kern/opensolaris_uio.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/compat/opensolaris/kern/opensolaris_uio.c == --- stable/10/sys/cddl/compat/opensolaris/kern/opensolaris_uio.cFri Dec 1 11:06:51 2017(r326425) +++ stable/10/sys/cddl/compat/opensolaris/kern/opensolaris_uio.cFri Dec 1 11:11:25 2017(r326426) @@ -42,6 +42,7 @@ #include #include +#include /* * same as uiomove() but doesn't modify uio structure. @@ -50,63 +51,42 @@ int uiocopy(void *p, size_t n, enum uio_rw rw, struct uio *uio, size_t *cbytes) { - struct iovec *iov; - ulong_t cnt; - int error, iovcnt; + struct iovec small_iovec[1]; + struct uio small_uio_clone; + struct uio *uio_clone; + int error; - iovcnt = uio->uio_iovcnt; - *cbytes = 0; - - for (iov = uio->uio_iov; n > 0 && iovcnt > 0; iov++, iovcnt--) { - cnt = MIN(iov->iov_len, n); - if (cnt == 0) - continue; - - switch (uio->uio_segflg) { - case UIO_USERSPACE: - if (rw == UIO_READ) - error = copyout(p, iov->iov_base, cnt); - else - error = copyin(iov->iov_base, p, cnt); - if (error) - return (error); - break; - case UIO_SYSSPACE: - if (uio->uio_rw == UIO_READ) - bcopy(p, iov->iov_base, cnt); - else - bcopy(iov->iov_base, p, cnt); - break; - } - - p = (caddr_t)p + cnt; - n -= cnt; - *cbytes += cnt; + ASSERT3U(uio->uio_rw, ==, rw); + if (uio->uio_iovcnt == 1) { + small_uio_clone = *uio; + small_iovec[0] = *uio->uio_iov; + small_uio_clone.uio_iov = small_iovec; + uio_clone = _uio_clone; + } else { + uio_clone = cloneuio(uio); } - return (0); + + error = vn_io_fault_uiomove(p, n, uio_clone); + *cbytes = uio->uio_resid - uio_clone->uio_resid; + if (uio_clone != _uio_clone) + free(uio_clone, M_IOV); + return (error); } /* * Drop the next n chars out of *uiop. */ void -uioskip(uio_t *uiop, size_t n) +uioskip(uio_t *uio, size_t n) { - if (n > uiop->uio_resid) + enum uio_seg segflg; + + /* For the full compatibility with illumos. */ + if (n > uio->uio_resid) return; - while (n != 0) { - register iovec_t*iovp = uiop->uio_iov; - register size_t niovb = MIN(iovp->iov_len, n); - if (niovb == 0) { - uiop->uio_iov++; - uiop->uio_iovcnt--; - continue; - } - iovp->iov_base += niovb; - uiop->uio_loffset += niovb; - iovp->iov_len -= niovb; - uiop->uio_resid -= niovb; - n -= niovb; - } + segflg = uio->uio_segflg; + uio->uio_segflg = UIO_NOCOPY; + uiomove(NULL, n, uio->uio_rw, uio); + uio->uio_segflg = segflg; } ___ 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: r326425 - stable/11/sys/cddl/compat/opensolaris/kern
Author: avg Date: Fri Dec 1 11:06:51 2017 New Revision: 326425 URL: https://svnweb.freebsd.org/changeset/base/326425 Log: MFC r326067: make illumos uiocopy use vn_io_fault_uiomove Modified: stable/11/sys/cddl/compat/opensolaris/kern/opensolaris_uio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/compat/opensolaris/kern/opensolaris_uio.c == --- stable/11/sys/cddl/compat/opensolaris/kern/opensolaris_uio.cFri Dec 1 10:53:08 2017(r326424) +++ stable/11/sys/cddl/compat/opensolaris/kern/opensolaris_uio.cFri Dec 1 11:06:51 2017(r326425) @@ -42,6 +42,7 @@ #include #include +#include /* * same as uiomove() but doesn't modify uio structure. @@ -50,63 +51,42 @@ int uiocopy(void *p, size_t n, enum uio_rw rw, struct uio *uio, size_t *cbytes) { - struct iovec *iov; - ulong_t cnt; - int error, iovcnt; + struct iovec small_iovec[1]; + struct uio small_uio_clone; + struct uio *uio_clone; + int error; - iovcnt = uio->uio_iovcnt; - *cbytes = 0; - - for (iov = uio->uio_iov; n > 0 && iovcnt > 0; iov++, iovcnt--) { - cnt = MIN(iov->iov_len, n); - if (cnt == 0) - continue; - - switch (uio->uio_segflg) { - case UIO_USERSPACE: - if (rw == UIO_READ) - error = copyout(p, iov->iov_base, cnt); - else - error = copyin(iov->iov_base, p, cnt); - if (error) - return (error); - break; - case UIO_SYSSPACE: - if (uio->uio_rw == UIO_READ) - bcopy(p, iov->iov_base, cnt); - else - bcopy(iov->iov_base, p, cnt); - break; - } - - p = (caddr_t)p + cnt; - n -= cnt; - *cbytes += cnt; + ASSERT3U(uio->uio_rw, ==, rw); + if (uio->uio_iovcnt == 1) { + small_uio_clone = *uio; + small_iovec[0] = *uio->uio_iov; + small_uio_clone.uio_iov = small_iovec; + uio_clone = _uio_clone; + } else { + uio_clone = cloneuio(uio); } - return (0); + + error = vn_io_fault_uiomove(p, n, uio_clone); + *cbytes = uio->uio_resid - uio_clone->uio_resid; + if (uio_clone != _uio_clone) + free(uio_clone, M_IOV); + return (error); } /* * Drop the next n chars out of *uiop. */ void -uioskip(uio_t *uiop, size_t n) +uioskip(uio_t *uio, size_t n) { - if (n > uiop->uio_resid) + enum uio_seg segflg; + + /* For the full compatibility with illumos. */ + if (n > uio->uio_resid) return; - while (n != 0) { - register iovec_t*iovp = uiop->uio_iov; - register size_t niovb = MIN(iovp->iov_len, n); - if (niovb == 0) { - uiop->uio_iov++; - uiop->uio_iovcnt--; - continue; - } - iovp->iov_base += niovb; - uiop->uio_loffset += niovb; - iovp->iov_len -= niovb; - uiop->uio_resid -= niovb; - n -= niovb; - } + segflg = uio->uio_segflg; + uio->uio_segflg = UIO_NOCOPY; + uiomove(NULL, n, uio->uio_rw, uio); + uio->uio_segflg = segflg; } ___ 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: r326424 - head/sys/vm
Author: kib Date: Fri Dec 1 10:53:08 2017 New Revision: 326424 URL: https://svnweb.freebsd.org/changeset/base/326424 Log: Add comment for vm_map_find_min(). Reviewed by: alc Sponsored by: The FreeBSD Foundation MFC after:3 days X-Differential revision: https://reviews.freebsd.org/D13155 Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c == --- head/sys/vm/vm_map.cFri Dec 1 10:25:52 2017(r326423) +++ head/sys/vm/vm_map.cFri Dec 1 10:53:08 2017(r326424) @@ -1558,6 +1558,18 @@ again: return (result); } +/* + * vm_map_find_min() is a variant of vm_map_find() that takes an + * additional parameter (min_addr) and treats the given address + * (*addr) differently. Specifically, it treats *addr as a hint + * and not as the minimum address where the mapping is created. + * + * This function works in two phases. First, it tries to + * allocate above the hint. If that fails and the hint is + * greater than min_addr, it performs a second pass, replacing + * the hint with min_addr as the minimum address for the + * allocation. + */ int vm_map_find_min(vm_map_t map, vm_object_t object, vm_ooffset_t offset, vm_offset_t *addr, vm_size_t length, vm_offset_t min_addr, ___ 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: r326423 - head/lib/libproc/tests
Author: ed Date: Fri Dec 1 10:25:52 2017 New Revision: 326423 URL: https://svnweb.freebsd.org/changeset/base/326423 Log: Eliminate the last user of basename_r() in the base system. In this case it's fairly easy to make use of basename(). Modified: head/lib/libproc/tests/proc_test.c Modified: head/lib/libproc/tests/proc_test.c == --- head/lib/libproc/tests/proc_test.c Fri Dec 1 09:59:42 2017 (r326422) +++ head/lib/libproc/tests/proc_test.c Fri Dec 1 10:25:52 2017 (r326423) @@ -105,7 +105,7 @@ static void verify_bkpt(struct proc_handle *phdl, GElf_Sym *sym, const char *symname, const char *mapname) { - char mapbname[MAXPATHLEN], *name; + char *name, *mapname_copy, *mapbname; GElf_Sym tsym; prmap_t *map; size_t namesz; @@ -147,9 +147,11 @@ verify_bkpt(struct proc_handle *phdl, GElf_Sym *sym, c map = proc_addr2map(phdl, addr); ATF_REQUIRE_MSG(map != NULL, "failed to look up map for address 0x%lx", addr); - basename_r(map->pr_mapname, mapbname); + mapname_copy = strdup(map->pr_mapname); + mapbname = basename(mapname_copy); ATF_REQUIRE_EQ_MSG(strcmp(mapname, mapbname), 0, "expected map name '%s' doesn't match '%s'", mapname, mapbname); + free(mapname_copy); } ATF_TC(map_alias_name2map); ___ 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: r326422 - head/sys/netipsec
Author: ae Date: Fri Dec 1 09:59:42 2017 New Revision: 326422 URL: https://svnweb.freebsd.org/changeset/base/326422 Log: Do better cleaning in key_destroy() for VIMAGE case. SPDB was cleaned using TAILQ_CONCAT() instead of calling key_unlink() for each SP, thus we need to properly clean lists in each bucket of V_sphashtbl to avoid panic in hashdestroy() when INVARIANTS is enabled. Do the same for V_acqaddrhashtbl and V_acqseqhashtbl. When we are called in DEFAULT_VNET, destroy also all global locks and drain key_timer callout. Reported by: kp Tested by:kp MFC after:1 week Modified: head/sys/netipsec/key.c Modified: head/sys/netipsec/key.c == --- head/sys/netipsec/key.c Fri Dec 1 06:37:12 2017(r326421) +++ head/sys/netipsec/key.c Fri Dec 1 09:59:42 2017(r326422) @@ -8147,7 +8147,10 @@ key_destroy(void) TAILQ_CONCAT(, _sptree[i], chain); TAILQ_CONCAT(, _sptree_ifnet[i], chain); } + for (i = 0; i < V_sphash_mask + 1; i++) + LIST_INIT(_sphashtbl[i]); SPTREE_WUNLOCK(); + sp = TAILQ_FIRST(); while (sp != NULL) { nextsp = TAILQ_NEXT(sp, chain); @@ -8198,6 +8201,10 @@ key_destroy(void) free(acq, M_IPSEC_SAQ); acq = nextacq; } + for (i = 0; i < V_acqaddrhash_mask + 1; i++) + LIST_INIT(_acqaddrhashtbl[i]); + for (i = 0; i < V_acqseqhash_mask + 1; i++) + LIST_INIT(_acqseqhashtbl[i]); ACQ_UNLOCK(); SPACQ_LOCK(); @@ -8213,6 +8220,18 @@ key_destroy(void) hashdestroy(V_acqaddrhashtbl, M_IPSEC_SAQ, V_acqaddrhash_mask); hashdestroy(V_acqseqhashtbl, M_IPSEC_SAQ, V_acqseqhash_mask); uma_zdestroy(V_key_lft_zone); + + if (!IS_DEFAULT_VNET(curvnet)) + return; +#ifndef IPSEC_DEBUG2 + callout_drain(_timer); +#endif + XFORMS_LOCK_DESTROY(); + SPTREE_LOCK_DESTROY(); + REGTREE_LOCK_DESTROY(); + SAHTREE_LOCK_DESTROY(); + ACQ_LOCK_DESTROY(); + SPACQ_LOCK_DESTROY(); } #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: r326421 - head/stand/efi/libefi
Author: tsoome Date: Fri Dec 1 06:37:12 2017 New Revision: 326421 URL: https://svnweb.freebsd.org/changeset/base/326421 Log: loader.efi: efipart should exclude iPXE stub block protocol iPXE does insert stub BLOCK IO protocol handle to rework other issues, this handle is not usable as it does not provide actual implementation. We can detect this situation by checking and validating the BlockSize property, so this update does make sure we have BlockSize at least 512B and its value is power of 2. PR: 223969 Reported by: Jeff Pieper Reviewed by: imp Differential Revision:https://reviews.freebsd.org/D13297 Modified: head/stand/efi/libefi/efipart.c Modified: head/stand/efi/libefi/efipart.c == --- head/stand/efi/libefi/efipart.c Fri Dec 1 05:57:05 2017 (r326420) +++ head/stand/efi/libefi/efipart.c Fri Dec 1 06:37:12 2017 (r326421) @@ -257,6 +257,14 @@ efipart_hdd(EFI_DEVICE_PATH *dp) !blkio->Media->MediaPresent) { return (false); } + + /* +* We assume the block size 512 or greater power of 2. +*/ + if (blkio->Media->BlockSize < 512 || + !powerof2(blkio->Media->BlockSize)) { + return (false); + } } return (true); } ___ 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"