svn commit: r328773 - head/sys/vm
Author: kib Date: Fri Feb 2 11:56:30 2018 New Revision: 328773 URL: https://svnweb.freebsd.org/changeset/base/328773 Log: On pageout, in vnode generic pager, for partially dirty page, only clear dirty bits for completely invalid blocks. Otherwise we might not write out the last chunk that is shorter than 512 bytes, if the file end is not aligned on disk block boundary. This become important after the r324794. PR: 225586 Reported by: tris_v...@hotmail.com Tested by:pho Sponsored by: The FreeBSD Foundation MFC after:3 days Modified: head/sys/vm/vnode_pager.c Modified: head/sys/vm/vnode_pager.c == --- head/sys/vm/vnode_pager.c Fri Feb 2 07:55:31 2018(r328772) +++ head/sys/vm/vnode_pager.c Fri Feb 2 11:56:30 2018(r328773) @@ -1266,6 +1266,8 @@ vnode_pager_generic_putpages(struct vnode *vp, vm_page maxsize = object->un_pager.vnp.vnp_size - poffset; ncount = btoc(maxsize); if ((pgoff = (int)maxsize & PAGE_MASK) != 0) { + pgoff = roundup2(pgoff, DEV_BSIZE); + /* * If the object is locked and the following * conditions hold, then the page's dirty ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r328776 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: avg Date: Fri Feb 2 12:57:33 2018 New Revision: 328776 URL: https://svnweb.freebsd.org/changeset/base/328776 Log: ZFS ARC: restore illumos uses of 'needfree' that were removed in r325851 This is purely a cosmetic change to have a more complete copy of ifdef-ed out illumos code. MFC after:1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Fri Feb 2 12:52:42 2018(r328775) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Fri Feb 2 12:57:33 2018(r328776) @@ -4236,6 +4236,7 @@ arc_available_memory(void) free_memory_reason_t r = FMR_UNKNOWN; #ifdef _KERNEL +#ifdef __FreeBSD__ /* * Cooperate with pagedaemon when it's time for it to scan * and reclaim some pages. @@ -4246,7 +4247,15 @@ arc_available_memory(void) r = FMR_LOTSFREE; } -#ifdef illumos +#else + if (needfree > 0) { + n = PAGESIZE * (-needfree); + if (n < lowest) { + lowest = n; + r = FMR_NEEDFREE; + } + } + /* * check that we're out of range of the pageout scanner. It starts to * schedule paging if freemem is less than lotsfree and needfree. @@ -4289,7 +4298,7 @@ arc_available_memory(void) r = FMR_PAGES_PP_MAXIMUM; } -#endif /* illumos */ +#endif /* __FreeBSD__ */ #if defined(__i386) || !defined(UMA_MD_SMALL_ALLOC) /* * If we're on an i386 platform, it's possible that we'll exhaust the @@ -4482,6 +4491,11 @@ arc_reclaim_thread(void *dummy __unused) int64_t to_free = (arc_c >> arc_shrink_shift) - free_memory; if (to_free > 0) { +#ifdef _KERNEL +#ifdef illumos + to_free = MAX(to_free, ptob(needfree)); +#endif +#endif arc_shrink(to_free); } } else if (free_memory < arc_c >> arc_no_grow_shift) { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r328774 - head/sys/kern
Author: hselasky Date: Fri Feb 2 12:42:46 2018 New Revision: 328774 URL: https://svnweb.freebsd.org/changeset/base/328774 Log: Slightly bump the maximum OID path for loading tunable SYSCTLs. Coming updates to the mlx5en(4) driver will require this. MFC after:1 week Sponsored by: Mellanox Technologies Modified: head/sys/kern/kern_sysctl.c Modified: head/sys/kern/kern_sysctl.c == --- head/sys/kern/kern_sysctl.c Fri Feb 2 11:56:30 2018(r328773) +++ head/sys/kern/kern_sysctl.c Fri Feb 2 12:42:46 2018(r328774) @@ -190,7 +190,7 @@ sysctl_load_tunable_by_oid_locked(struct sysctl_oid *o struct sysctl_req req; struct sysctl_oid *curr; char *penv = NULL; - char path[64]; + char path[96]; ssize_t rem = sizeof(path); ssize_t len; uint8_t val_8; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r328779 - in head/stand: common forth
Author: imp Date: Fri Feb 2 15:01:33 2018 New Revision: 328779 URL: https://svnweb.freebsd.org/changeset/base/328779 Log: Retire pnp.4th and the code needed only for 4th words used here. This has never been installed. It was added to the tree disconnected to the build in FreeBSD 5 (17 years ago) and has never been used as far as I can tell. The desired improvements never really happened (despite a couple minor cleanups along the way). It's relevance is long past, so better to retire it. Deleted: head/stand/forth/pnp.4th Modified: head/stand/common/pnp.c Modified: head/stand/common/pnp.c == --- head/stand/common/pnp.c Fri Feb 2 14:47:25 2018(r328778) +++ head/stand/common/pnp.c Fri Feb 2 15:01:33 2018(r328779) @@ -17,9 +17,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifdef BOOT_FORTH -#include "ficl.h" -#endif static struct pnpinfo_stql pnp_devices; static int pnp_devices_initted = 0; @@ -187,50 +184,3 @@ pnp_eisaformat(u_int8_t *data) idbuf[7] = 0; return(idbuf); } - -#ifdef BOOT_FORTH -void -ficlPnpdevices(FICL_VM *pVM) -{ - static int pnp_devices_initted = 0; -#if FICL_ROBUST > 1 - vmCheckStack(pVM, 0, 1); -#endif - - if(!pnp_devices_initted) { - STAILQ_INIT(_devices); - pnp_devices_initted = 1; - } - - stackPushPtr(pVM->pStack, _devices); - - return; -} - -void -ficlPnphandlers(FICL_VM *pVM) -{ -#if FICL_ROBUST > 1 - vmCheckStack(pVM, 0, 1); -#endif - - stackPushPtr(pVM->pStack, pnphandlers); - - return; -} - -/* - * Glue function to add the appropriate forth words to access pnp BIOS - * functionality. - */ -static void ficlCompilePnp(FICL_SYSTEM *pSys) -{ -FICL_DICT *dp = pSys->dp; -assert (dp); - -dictAppendWord(dp, "pnpdevices",ficlPnpdevices, FW_DEFAULT); -dictAppendWord(dp, "pnphandlers",ficlPnphandlers, FW_DEFAULT); -} - -FICL_COMPILE_SET(ficlCompilePnp); -#endif ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r328780 - in head: . stand/efi/libefi stand/forth
Author: imp Date: Fri Feb 2 15:01:44 2018 New Revision: 328780 URL: https://svnweb.freebsd.org/changeset/base/328780 Log: These 4th words were an attempt to allow integration into the boot loader scripts. However, that path won't be taken after all it seems. Remove this code before it decays into uselessness. Also remove build dependencies on forth no longer needed. Modified: head/ObsoleteFiles.inc head/stand/efi/libefi/Makefile head/stand/efi/libefi/env.c head/stand/forth/Makefile head/stand/forth/loader.4th Modified: head/ObsoleteFiles.inc == --- head/ObsoleteFiles.inc Fri Feb 2 15:01:33 2018(r328779) +++ head/ObsoleteFiles.inc Fri Feb 2 15:01:44 2018(r328780) @@ -38,6 +38,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20180201: Obsolete forth files +OLD_FILES+=boot/efi.4th + # 20180114: new clang import which bumps version from 5.0.1 to 6.0.0. OLD_FILES+=usr/lib/clang/5.0.1/include/sanitizer/allocator_interface.h OLD_FILES+=usr/lib/clang/5.0.1/include/sanitizer/asan_interface.h Modified: head/stand/efi/libefi/Makefile == --- head/stand/efi/libefi/Makefile Fri Feb 2 15:01:33 2018 (r328779) +++ head/stand/efi/libefi/Makefile Fri Feb 2 15:01:44 2018 (r328780) @@ -2,10 +2,6 @@ .include -.if ${MK_FORTH} != "no" -.include "${BOOTSRC}/ficl.mk" -.endif - LIB= efi WARNS?=2 Modified: head/stand/efi/libefi/env.c == --- head/stand/efi/libefi/env.c Fri Feb 2 15:01:33 2018(r328779) +++ head/stand/efi/libefi/env.c Fri Feb 2 15:01:44 2018(r328780) @@ -34,9 +34,6 @@ __FBSDID("$FreeBSD$"); #include #include #include "bootstrap.h" -#ifdef BOOT_FORTH -#include "ficl.h" -#endif /* * Simple wrappers to the underlying UEFI functions. @@ -375,160 +372,3 @@ command_efi_unset(int argc, char *argv[]) } return (CMD_OK); } - -#ifdef BOOT_FORTH -/* - * FreeBSD's loader interaction words and extras - * - * efi-setenv ( value n name n guid n attr -- 0 | -1) - * efi-getenv ( guid n addr n -- addr' n' | -1 ) - * efi-unsetenv ( name n guid n'' -- ) - */ - -/* - * efi-setenv - * efi-setenv ( value n name n guid n attr -- 0 | -1) - * - * Set environment variables using the SetVariable EFI runtime service. - * - * Value and guid are passed through in binary form (so guid needs to be - * converted to binary form from its string form). Name is converted from - * ASCII to CHAR16. Since ficl doesn't have support for internationalization, - * there's no native CHAR16 interface provided. - * - * attr is an int in the bitmask of the following attributes for this variable. - * - * 1 Non volatile - * 2 Boot service access - * 4 Run time access - * (corresponding to the same bits in the UEFI spec). - */ -static void -ficlEfiSetenv(FICL_VM *pVM) -{ - char*value = NULL, *guid = NULL; - CHAR16 *name = NULL; - int i; - char*namep, *valuep, *guidp; - int names, values, guids, attr; - EFI_STATUS status; - uuid_t u; - uint32_t ustatus; - boolerror = true; - -#if FICL_ROBUST > 1 - vmCheckStack(pVM, 6, 0); -#endif - attr = stackPopINT(pVM->pStack); - guids = stackPopINT(pVM->pStack); - guidp = (char*)stackPopPtr(pVM->pStack); - names = stackPopINT(pVM->pStack); - namep = (char*)stackPopPtr(pVM->pStack); - values = stackPopINT(pVM->pStack); - valuep = (char*)stackPopPtr(pVM->pStack); - - guid = (char*)ficlMalloc(guids); - if (guid == NULL) - goto out; - memcpy(guid, guidp, guids); - uuid_from_string(guid, , ); - if (ustatus != uuid_s_ok) { - stackPushINT(pVM->pStack, -1); - goto out; - } - - name = ficlMalloc((names + 1) * sizeof(CHAR16)); - if (name == NULL) - goto out; - for (i = 0; i < names; i++) - name[i] = namep[i]; - name[names] = 0; - - value = ficlMalloc(values + 1); - if (value == NULL) - goto out; - memcpy(value, valuep, values); - - status = efi_set_variable(name, (EFI_GUID *), attr, values, value); - if (status == EFI_SUCCESS) - stackPushINT(pVM->pStack, 0); - else - stackPushINT(pVM->pStack, -1); - error = false; -out: - ficlFree(name); - ficlFree(value); - ficlFree(guid); - - if (error == true) - vmThrowErr(pVM, "Error: out of memory"); -} - -static void -ficlEfiGetenv(FICL_VM *pVM) -{ - char*name, *value; - char*namep; - int names; - -#if FICL_ROBUST > 1 - vmCheckStack(pVM, 2, 2); -#endif - names =
svn commit: r328782 - head/stand
Author: imp Date: Fri Feb 2 15:01:54 2018 New Revision: 328782 URL: https://svnweb.freebsd.org/changeset/base/328782 Log: Now that we no longer conditionally compile some files outside of ficl with BOOT_FORTH, retire it from here. Modified: head/stand/ficl.mk Modified: head/stand/ficl.mk == --- head/stand/ficl.mk Fri Feb 2 15:01:49 2018(r328781) +++ head/stand/ficl.mk Fri Feb 2 15:01:54 2018(r328782) @@ -17,5 +17,4 @@ CFLAGS+= -fPIC .endif CFLAGS+= -I${FICLSRC} -I${FICLSRC}/${FICL_CPUARCH} -I${LDRSRC} -CFLAGS+= -DBOOT_FORTH CFLAGS+= -DBF_DICTSIZE=15000 ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r328781 - in head: . stand/forth stand/i386/libi386
Author: imp Date: Fri Feb 2 15:01:49 2018 New Revision: 328781 URL: https://svnweb.freebsd.org/changeset/base/328781 Log: Remove pcibios forth support. I had thought that this would be useful. However it was committed too late, and wound up being unused. It's in the way of future work now, so retire it rather than bring it forward. Deleted: head/stand/forth/pcibios.4th Modified: head/ObsoleteFiles.inc head/stand/forth/Makefile head/stand/i386/libi386/biospci.c Modified: head/ObsoleteFiles.inc == --- head/ObsoleteFiles.inc Fri Feb 2 15:01:44 2018(r328780) +++ head/ObsoleteFiles.inc Fri Feb 2 15:01:49 2018(r328781) @@ -40,6 +40,7 @@ # 20180201: Obsolete forth files OLD_FILES+=boot/efi.4th +OLD_FILES+=boot/pcibios.4th # 20180114: new clang import which bumps version from 5.0.1 to 6.0.0. OLD_FILES+=usr/lib/clang/5.0.1/include/sanitizer/allocator_interface.h Modified: head/stand/forth/Makefile == --- head/stand/forth/Makefile Fri Feb 2 15:01:44 2018(r328780) +++ head/stand/forth/Makefile Fri Feb 2 15:01:49 2018(r328781) @@ -29,7 +29,6 @@ FILES+= logo-orbbw.4th FILES+=menu.4th FILES+=menu-commands.4th FILES+=menusets.4th -FILES+=pcibios.4th FILES+=screen.4th FILES+=shortcuts.4th FILES+=support.4th Modified: head/stand/i386/libi386/biospci.c == --- head/stand/i386/libi386/biospci.c Fri Feb 2 15:01:44 2018 (r328780) +++ head/stand/i386/libi386/biospci.c Fri Feb 2 15:01:49 2018 (r328781) @@ -38,9 +38,6 @@ __FBSDID("$FreeBSD$"); #include #include #include "libi386.h" -#ifdef BOOT_FORTH -#include "ficl.h" -#endif /* * Stupid PCI BIOS interface doesn't let you simply enumerate everything @@ -406,183 +403,3 @@ biospci_locator(int8_t bus, uint8_t device, uint8_t fu return ((bus << 8) | ((device & 0x1f) << 3) | (function & 0x7)); } - -/* - * Counts the number of instances of devid we have in the system, as least as - * far as the PCI BIOS is able to tell. - */ -static int -biospci_count_device_type(uint32_t devid) -{ - int i; - - for (i = 0; 1; i++) { - v86.ctl = V86_FLAGS; - v86.addr = PCI_INT; - v86.eax = FIND_PCI_DEVICE; - v86.edx = devid & 0x; /* EDX - Vendor ID */ - v86.ecx = (devid >> 16) & 0x; /* ECX - Device ID */ - v86.esi = i; - v86int(); - if (V86_CY(v86.efl) || (v86.eax & 0xff00)) - break; - - } - return i; -} - -#ifdef BOOT_FORTH -/* - * pcibios-device-count (devid -- count) - * - * Returns the PCI BIOS' count of how many devices matching devid are in the system. - * devid is the 32-bit vendor + device. - */ -static void -ficlPciBiosCountDevices(FICL_VM *pVM) -{ -uint32_t devid; -int i; - -devid = stackPopINT(pVM->pStack); - -i = biospci_count_device_type(devid); - -stackPushINT(pVM->pStack, i); -} - -/* - * pcibios-write-config (locator offset width value -- ) - * - * Writes the specified config register. - * Locator is bus << 8 | device << 3 | fuction - * offset is the pci config register - * width is 0 for byte, 1 for word, 2 for dword - * value is the value to write - */ -static void -ficlPciBiosWriteConfig(FICL_VM *pVM) -{ -uint32_t value, width, offset, locator; - -value = stackPopINT(pVM->pStack); -width = stackPopINT(pVM->pStack); -offset = stackPopINT(pVM->pStack); -locator = stackPopINT(pVM->pStack); - -biospci_write_config(locator, offset, width, value); -} - -/* - * pcibios-read-config (locator offset width -- value) - * - * Reads the specified config register. - * Locator is bus << 8 | device << 3 | fuction - * offset is the pci config register - * width is 0 for byte, 1 for word, 2 for dword - * value is the value to read from the register - */ -static void -ficlPciBiosReadConfig(FICL_VM *pVM) -{ -uint32_t value, width, offset, locator; - -width = stackPopINT(pVM->pStack); -offset = stackPopINT(pVM->pStack); -locator = stackPopINT(pVM->pStack); - -biospci_read_config(locator, offset, width, ); - -stackPushINT(pVM->pStack, value); -} - -/* - * pcibios-find-devclass (class index -- locator) - * - * Finds the index'th instance of class in the pci tree. - * must be an exact match. - * class is the class to search for. - * index 0..N (set to 0, increment until error) - * - * Locator is bus << 8 | device << 3 | fuction (or -1 on error) - */ -static void -ficlPciBiosFindDevclass(FICL_VM *pVM) -{ -uint32_t index, class, locator; - -index = stackPopINT(pVM->pStack); -class = stackPopINT(pVM->pStack); - -if
svn commit: r328795 - head/share/examples/bhyve
Author: rgrimes Date: Fri Feb 2 17:52:09 2018 New Revision: 328795 URL: https://svnweb.freebsd.org/changeset/base/328795 Log: Fold constants and unify vnc variable names. Approved by: grehan (mentor) MFC after:3 days Modified: head/share/examples/bhyve/vmrun.sh Modified: head/share/examples/bhyve/vmrun.sh == --- head/share/examples/bhyve/vmrun.sh Fri Feb 2 17:08:39 2018 (r328794) +++ head/share/examples/bhyve/vmrun.sh Fri Feb 2 17:52:09 2018 (r328795) @@ -39,9 +39,14 @@ DEFAULT_TAPDEV=tap0 DEFAULT_CONSOLE=stdio DEFAULT_NIC=virtio-net +DEFAULT_DISK=virtio-blk DEFAULT_VIRTIO_DISK="./diskdev" DEFAULT_ISOFILE="./release.iso" +DEFAULT_VNCHOST="127.0.0.1" +DEFAULT_VNCPORT=5900 +DEFAULT_VNCSIZE="w=1024,h=768" + errmsg() { echo "*** $1" } @@ -62,7 +67,7 @@ usage() { echo "" echo " -h: display this help message" echo " -a: force memory mapped local APIC access" - echo " -A: use AHCI disk emulation instead of virtio" + echo " -A: use AHCI disk emulation instead of ${DEFAULT_DISK}" echo " -c: number of virtual cpus (default: ${DEFAULT_CPUS})" echo " -C: console device (default: ${DEFAULT_CONSOLE})" echo " -d: virtio diskdev file (default: ${DEFAULT_VIRTIO_DISK})" @@ -70,7 +75,7 @@ usage() { echo " -E: Use UEFI mode" echo " -f: Use a specific UEFI firmware" echo " -F: Use a custom UEFI GOP framebuffer size" \ - "(default: w=1024,h=768)" + "(default: ${DEFAULT_VNCSIZE}" echo " -g: listen for connection from kgdb at " echo " -H: host filesystem to export to the loader" echo " -i: force boot of the Installation CDROM image" @@ -78,13 +83,13 @@ usage() { "(default: ${DEFAULT_ISOFILE})" echo " -l: the OS loader to use (default: /boot/userboot.so)" echo " -L: IP address for UEFI GOP VNC server" \ - "(default: 127.0.0.1)" + "(default: ${DEFAULT_VNCHOST}" echo " -m: memory size (default: ${DEFAULT_MEMSIZE})" echo " -n: network adapter emulation type" \ "(default: ${DEFAULT_NIC})" echo " -p: pass-through a host PCI device at bus/slot/func" \ "(e.g. 10/0/0)" - echo " -P: UEFI GOP VNC port (default: 5900)" + echo " -P: UEFI GOP VNC port (default: ${DEFAULT_VNCPORT})" echo " -t: tap device for virtio-net (default: $DEFAULT_TAPDEV)" echo " -T: Enable tablet device (for UEFI GOP)" echo " -u: RTC keeps UTC time" @@ -114,7 +119,7 @@ cpus=${DEFAULT_CPUS} nic=${DEFAULT_NIC} tap_total=0 disk_total=0 -disk_emulation="virtio-blk" +disk_emulation=${DEFAULT_DISK} gdbport=0 loader_opt="" bhyverun_opt="-H -A -P" @@ -124,9 +129,9 @@ pass_total=0 efi_mode=0 efi_firmware="/usr/local/share/uefi-firmware/BHYVE_UEFI.fd" vncwait="" -vnchost="127.0.0.1" -vncport=5900 -fbsize="w=1024,h=768" +vnchost=${DEFAULT_VNCHOST} +vncport=${DEFAULT_VNCPORT} +vncsize=${DEFAULT_VNCSIZE} tablet="" while getopts aAc:C:d:e:Ef:F:g:hH:iI:l:m:n:p:P:t:Tuvw c ; do @@ -160,7 +165,7 @@ while getopts aAc:C:d:e:Ef:F:g:hH:iI:l:m:n:p:P:t:Tuvw efi_firmware="${OPTARG}" ;; F) - fbsize="${OPTARG}" + vncsize="${OPTARG}" ;; g) gdbport=${OPTARG} @@ -356,7 +361,7 @@ while [ 1 ]; do efiargs="" if [ ${efi_mode} -gt 0 ]; then efiargs="-s 29,fbuf,tcp=${vnchost}:${vncport}," - efiargs="${efiargs}${fbsize}${vncwait}" + efiargs="${efiargs}${vncsize}${vncwait}" efiargs="${efiargs} -l bootrom,${efi_firmware}" efiargs="${efiargs} ${tablet}" fi ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r328783 - in head/stand: . arm/uboot efi/loader i386/loader mips/beri/loader mips/uboot powerpc/kboot powerpc/ofw powerpc/uboot sparc64/loader userboot/userboot
Author: imp Date: Fri Feb 2 15:40:49 2018 New Revision: 328783 URL: https://svnweb.freebsd.org/changeset/base/328783 Log: Invent new LDR_INTERP for the loader interpreter to use. Use this in preference to LIBFICL{,32}. LIBFICL{,32} are now always defined, but LDR_INTERP{,32} is defined empty when building w/o forth (aka the simple interpreter) and defined to LIBFICL{,32} when we are building forth. Modified: head/stand/arm/uboot/Makefile head/stand/efi/loader/Makefile head/stand/i386/loader/Makefile head/stand/loader.mk head/stand/mips/beri/loader/Makefile head/stand/mips/uboot/Makefile head/stand/powerpc/kboot/Makefile head/stand/powerpc/ofw/Makefile head/stand/powerpc/uboot/Makefile head/stand/sparc64/loader/Makefile head/stand/userboot/userboot/Makefile Modified: head/stand/arm/uboot/Makefile == --- head/stand/arm/uboot/Makefile Fri Feb 2 15:01:54 2018 (r328782) +++ head/stand/arm/uboot/Makefile Fri Feb 2 15:40:49 2018 (r328783) @@ -41,8 +41,8 @@ LDFLAGS+= -Wl,-znotext CFLAGS+= -fPIC -DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA} -LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA} +DPADD= ${LDR_INTERP} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA} +LDADD= ${LDR_INTERP} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA} OBJS+= ${SRCS:N*.h:R:S/$/.o/g} Modified: head/stand/efi/loader/Makefile == --- head/stand/efi/loader/Makefile Fri Feb 2 15:01:54 2018 (r328782) +++ head/stand/efi/loader/Makefile Fri Feb 2 15:40:49 2018 (r328783) @@ -119,8 +119,8 @@ loader.efi: ${PROG} LIBEFI=${BOOTOBJ}/efi/libefi/libefi.a -DPADD= ${LIBFICL} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBZFSBOOT} ${LIBSA} \ +DPADD= ${LDR_INTERP} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBZFSBOOT} ${LIBSA} \ ${LDSCRIPT} -LDADD= ${LIBFICL} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBZFSBOOT} ${LIBSA} +LDADD= ${LDR_INTERP} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBZFSBOOT} ${LIBSA} .include Modified: head/stand/i386/loader/Makefile == --- head/stand/i386/loader/Makefile Fri Feb 2 15:01:54 2018 (r328782) +++ head/stand/i386/loader/Makefile Fri Feb 2 15:40:49 2018 (r328783) @@ -71,8 +71,8 @@ FILESMODE_${LOADER}= ${BINMODE} -b # XXX crt0.o needs to be first for pxeboot(8) to work OBJS= ${BTXCRT} -DPADD= ${LIBFICL32} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSA32} -LDADD= ${LIBFICL32} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSA32} +DPADD= ${LDR_INTERP32} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSA32} +LDADD= ${LDR_INTERP32} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSA32} .if ${MACHINE_CPUARCH} == "amd64" CFLAGS+= -DLOADER_PREFER_AMD64 Modified: head/stand/loader.mk == --- head/stand/loader.mkFri Feb 2 15:01:54 2018(r328782) +++ head/stand/loader.mkFri Feb 2 15:40:49 2018(r328783) @@ -128,14 +128,15 @@ LIBZFSBOOT= ${BOOTOBJ}/zfs/libzfsboot.a .endif .endif -# NB: The makefiles depend on these being empty when we don't build forth. -.if ${MK_FORTH} != "no" LIBFICL= ${BOOTOBJ}/ficl/libficl.a .if ${MACHINE} == "i386" LIBFICL32= ${LIBFICL} .else LIBFICL32= ${BOOTOBJ}/ficl32/libficl.a .endif +.if ${MK_FORTH} != no +LDR_INTERP=${LIBFICL} +LDR_INTERP32= ${LIBFICL32} .endif CLEANFILES+= vers.c Modified: head/stand/mips/beri/loader/Makefile == --- head/stand/mips/beri/loader/MakefileFri Feb 2 15:01:54 2018 (r328782) +++ head/stand/mips/beri/loader/MakefileFri Feb 2 15:40:49 2018 (r328783) @@ -87,8 +87,8 @@ LDFLAGS+= -static \ -L${.CURDIR}\ -e __start -DPADD= ${LIBFICL} ${LIBSA} -LDADD= ${LIBFICL} ${LIBSA} +DPADD= ${LDR_INTERP} ${LIBSA} +LDADD= ${LDR_INTERP} ${LIBSA} .if defined(LOADER_USB_SUPPORT) # Do garbage collection Modified: head/stand/mips/uboot/Makefile == --- head/stand/mips/uboot/Makefile Fri Feb 2 15:01:54 2018 (r328782) +++ head/stand/mips/uboot/Makefile Fri Feb 2 15:40:49 2018 (r328783) @@ -35,8 +35,8 @@ LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.${MA .include "${BOOTSRC}/uboot.mk" -DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA}
svn commit: r328785 - head/lib/libc/stdlib
Author: emaste Date: Fri Feb 2 16:47:32 2018 New Revision: 328785 URL: https://svnweb.freebsd.org/changeset/base/328785 Log: Use standard 2-clause license where copyright is held by the FreeBSD Foundation Modified: head/lib/libc/stdlib/strtold.c Modified: head/lib/libc/stdlib/strtold.c == --- head/lib/libc/stdlib/strtold.c Fri Feb 2 16:35:17 2018 (r328784) +++ head/lib/libc/stdlib/strtold.c Fri Feb 2 16:47:32 2018 (r328785) @@ -1,11 +1,12 @@ /*- - * SPDX-License-Identifier: BSD-3-Clause + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2011 The FreeBSD Foundation + * Copyright (C) 2011 The FreeBSD Foundation * All rights reserved. - * Portions of this software were developed by David Chisnall - * under sponsorship from the FreeBSD Foundation. * + * This software was developed by David Chisnall under sponsorship from the + * FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -14,14 +15,11 @@ * 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. - * 3. Neither the name of the University nor the names of its contributors - *may be used to endorse or promote products derived from this software - *without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r328799 - in head/sys: compat/freebsd32 kern
Author: brooks Date: Fri Feb 2 18:03:12 2018 New Revision: 328799 URL: https://svnweb.freebsd.org/changeset/base/328799 Log: Add kern.ipc.{msqids,semsegs,sema} sysctls for FreeBSD32. Stop leaking kernel pointers though theses sysctls and make sure that the padding in the structures is zeroed on allocation to avoid other leaks. Reviewed by: gordon, kib Obtained from:CheriBSD MFC after:1 week Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D13459 Modified: head/sys/compat/freebsd32/freebsd32_ipc.h head/sys/kern/sysv_msg.c head/sys/kern/sysv_sem.c head/sys/kern/sysv_shm.c Modified: head/sys/compat/freebsd32/freebsd32_ipc.h == --- head/sys/compat/freebsd32/freebsd32_ipc.h Fri Feb 2 18:02:06 2018 (r328798) +++ head/sys/compat/freebsd32/freebsd32_ipc.h Fri Feb 2 18:03:12 2018 (r328799) @@ -49,6 +49,18 @@ struct semid_ds32 { int32_t sem_ctime; }; +#ifdef _KERNEL +struct semid_kernel32 { + /* Data structure exposed to user space. */ + struct semid_ds32 u; + + /* Kernel-private components of the semaphore. */ + int32_t label; + int32_t cred; +}; +#endif /* _KERNEL */ + + union semun32 { int val; uint32_tbuf; @@ -69,6 +81,17 @@ struct msqid_ds32 { int32_t msg_ctime; }; +#ifdef _KERNEL +struct msqid_kernel32 { + /* Data structure exposed to user space. */ + struct msqid_ds32 u; + + /* Kernel-private components of the message queue. */ + uint32_tlabel; + uint32_tcred; +}; +#endif + struct shmid_ds32 { struct ipc_perm32 shm_perm; int32_t shm_segsz; @@ -79,6 +102,15 @@ struct shmid_ds32 { int32_t shm_dtime; int32_t shm_ctime; }; + +#ifdef _KERNEL +struct shmid_kernel32 { + struct shmid_ds32u; + int32_t *object; + int32_t *label; + int32_t *cred; +}; +#endif struct shm_info32 { int32_t used_ids; Modified: head/sys/kern/sysv_msg.c == --- head/sys/kern/sysv_msg.cFri Feb 2 18:02:06 2018(r328798) +++ head/sys/kern/sysv_msg.cFri Feb 2 18:03:12 2018(r328799) @@ -229,7 +229,7 @@ msginit() msgmaps = malloc(sizeof(struct msgmap) * msginfo.msgseg, M_MSG, M_WAITOK); msghdrs = malloc(sizeof(struct msg) * msginfo.msgtql, M_MSG, M_WAITOK); msqids = malloc(sizeof(struct msqid_kernel) * msginfo.msgmni, M_MSG, - M_WAITOK); + M_WAITOK | M_ZERO); /* * msginfo.msgssz should be a power of two for efficiency reasons. @@ -1418,7 +1418,12 @@ static int sysctl_msqids(SYSCTL_HANDLER_ARGS) { struct msqid_kernel tmsqk; +#ifdef COMPAT_FREEBSD32 + struct msqid_kernel32 tmsqk32; +#endif struct prison *pr, *rpr; + void *outaddr; + size_t outsize; int error, i; pr = req->td->td_ucred->cr_prison; @@ -1435,7 +1440,40 @@ sysctl_msqids(SYSCTL_HANDLER_ARGS) tmsqk.u.msg_perm.key = IPC_PRIVATE; } mtx_unlock(_mtx); - error = SYSCTL_OUT(req, , sizeof(tmsqk)); +#ifdef COMPAT_FREEBSD32 + if (SV_CURPROC_FLAG(SV_ILP32)) { + bzero(, sizeof(tmsqk32)); + freebsd32_ipcperm_out(_perm, + _perm); + /* Don't copy u.msg_first or u.msg_last */ + CP(tmsqk, tmsqk32, u.msg_cbytes); + CP(tmsqk, tmsqk32, u.msg_qnum); + CP(tmsqk, tmsqk32, u.msg_qbytes); + CP(tmsqk, tmsqk32, u.msg_lspid); + CP(tmsqk, tmsqk32, u.msg_lrpid); + CP(tmsqk, tmsqk32, u.msg_stime); + CP(tmsqk, tmsqk32, u.msg_rtime); + CP(tmsqk, tmsqk32, u.msg_ctime); + /* Don't copy label or cred */ + outaddr = + outsize = sizeof(tmsqk32); + } else +#endif + { + /* Don't leak kernel pointers */ + tmsqk.u.msg_first = NULL; + tmsqk.u.msg_last = NULL; + tmsqk.label = NULL; + tmsqk.cred = NULL; + /* +* XXX: some padding also exists, but we take care to +* allocate our pool of msqid_kernel structs with +* zeroed memory so this should be OK. +*/ + outaddr = +
svn commit: r328784 - head/share/examples/bhyve
Author: rgrimes Date: Fri Feb 2 16:35:17 2018 New Revision: 328784 URL: https://svnweb.freebsd.org/changeset/base/328784 Log: Clean up long lines. Approved by: grehan (mentor) MFC after:3 days Modified: head/share/examples/bhyve/vmrun.sh Modified: head/share/examples/bhyve/vmrun.sh == --- head/share/examples/bhyve/vmrun.sh Fri Feb 2 15:40:49 2018 (r328783) +++ head/share/examples/bhyve/vmrun.sh Fri Feb 2 16:35:17 2018 (r328784) @@ -244,7 +244,8 @@ fi if [ ${efi_mode} -gt 0 ]; then if [ ! -f ${efi_firmware} ]; then - echo "Error: EFI Firmware ${efi_firmware} doesn't exist. Try: pkg install uefi-edk2-bhyve" + echo "Error: EFI Firmware ${efi_firmware} doesn't exist." \ + "Try: pkg install uefi-edk2-bhyve" exit 1 fi fi @@ -281,7 +282,8 @@ while [ 1 ]; do file -s ${first_diskdev} | grep "boot sector" > /dev/null rc=$? if [ $rc -ne 0 ]; then - file -s ${first_diskdev} | grep ": Unix Fast File sys" > /dev/null + file -s ${first_diskdev} | \ + grep ": Unix Fast File sys" > /dev/null rc=$? fi if [ $rc -ne 0 ]; then @@ -312,8 +314,8 @@ while [ 1 ]; do fi if [ ${efi_mode} -eq 0 ]; then - ${LOADER} -c ${console} -m ${memsize} ${BOOTDISKS} ${loader_opt} \ - ${vmname} + ${LOADER} -c ${console} -m ${memsize} ${BOOTDISKS} \ + ${loader_opt} ${vmname} bhyve_exit=$? if [ $bhyve_exit -ne 0 ]; then break @@ -353,7 +355,8 @@ while [ 1 ]; do efiargs="" if [ ${efi_mode} -gt 0 ]; then - efiargs="-s 29,fbuf,tcp=${vnchost}:${vncport},${fbsize}${vncwait}" + efiargs="-s 29,fbuf,tcp=${vnchost}:${vncport}," + efiargs="${efiargs}${fbsize}${vncwait}" efiargs="${efiargs} -l bootrom,${efi_firmware}" efiargs="${efiargs} ${tablet}" fi ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r328803 - head/sbin/dhclient
Author: oshogbo Date: Fri Feb 2 18:11:56 2018 New Revision: 328803 URL: https://svnweb.freebsd.org/changeset/base/328803 Log: Use daemonfd(3) in the dhclient(8). Reviewed by: brooks@ Differential Revision:https://reviews.freebsd.org/D13603 Modified: head/sbin/dhclient/dhclient.c Modified: head/sbin/dhclient/dhclient.c == --- head/sbin/dhclient/dhclient.c Fri Feb 2 18:10:45 2018 (r328802) +++ head/sbin/dhclient/dhclient.c Fri Feb 2 18:11:56 2018 (r328803) @@ -2430,7 +2430,7 @@ go_daemon(void) /* Stop logging to stderr... */ log_perror = 0; - if (daemon(1, 1) == -1) + if (daemonfd(-1, nullfd) == -1) error("daemon"); cap_rights_init(); @@ -2443,11 +2443,7 @@ go_daemon(void) } } - /* we are chrooted, daemon(3) fails to open /dev/null */ if (nullfd != -1) { - dup2(nullfd, STDIN_FILENO); - dup2(nullfd, STDOUT_FILENO); - dup2(nullfd, STDERR_FILENO); close(nullfd); nullfd = -1; } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r328808 - head/stand/libsa
Author: imp Date: Fri Feb 2 21:18:32 2018 New Revision: 328808 URL: https://svnweb.freebsd.org/changeset/base/328808 Log: Implement strcoll as strcmp. Modified: head/stand/libsa/stand.h Modified: head/stand/libsa/stand.h == --- head/stand/libsa/stand.hFri Feb 2 21:00:06 2018(r328807) +++ head/stand/libsa/stand.hFri Feb 2 21:18:32 2018(r328808) @@ -68,6 +68,7 @@ /* this header intentionally exports NULL from */ #include +#define strcoll(a, b) strcmp((a), (b)) #define CHK(fmt, args...) printf("%s(%d): " fmt "\n", __func__, __LINE__ , ##args) #define PCHK(fmt, args...) {printf("%s(%d): " fmt "\n", __func__, __LINE__ , ##args); getchar();} ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r328813 - head/lib/libufs
Author: mckusick Date: Fri Feb 2 22:06:15 2018 New Revision: 328813 URL: https://svnweb.freebsd.org/changeset/base/328813 Log: In the sbwrite(3) function, ensure that the file descriptor has been upgraded to writable. Reported by: Kyle EvansModified: head/lib/libufs/sblock.c Modified: head/lib/libufs/sblock.c == --- head/lib/libufs/sblock.cFri Feb 2 22:05:36 2018(r328812) +++ head/lib/libufs/sblock.cFri Feb 2 22:06:15 2018(r328813) @@ -96,8 +96,15 @@ int sbwrite(struct uufsd *disk, int all) { struct fs *fs; + int rv; ERROR(disk, NULL); + + rv = ufs_disk_write(disk); + if (rv == -1) { + ERROR(disk, "failed to open disk for writing"); + return (-1); + } fs = >d_fs; if ((errno = sbput(disk->d_fd, fs, all ? fs->fs_ncg : 0)) != 0) { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r328426 - in head: lib/libufs sbin/clri sbin/dump sbin/fsck_ffs sbin/fsirand sbin/growfs sbin/newfs sbin/quotacheck stand/libsa sys/geom sys/geom/journal sys/geom/label sys/ufs/ffs usr
On Thu, Jan 25, 2018 at 6:58 PM, Kirk McKusickwrote: > Author: mckusick > Date: Fri Jan 26 00:58:32 2018 > New Revision: 328426 > URL: https://svnweb.freebsd.org/changeset/base/328426 > > Log: > Refactoring of reading and writing of the UFS/FFS superblock. > Specifically reading is done if ffs_sbget() and writing is done > in ffs_sbput(). These functions are exported to libufs via the > sbget() and sbput() functions which then used in the various > filesystem utilities. This work is in preparation for adding > subperblock check hashes. > > No functional change intended. > > Reviewed by: kib Hi, This change seems to have had some unintended side-effect: $ mdconfig -a -t swap -s 10M $ newfs /dev/md0 $ tunefs -L BUG /dev/md0 This results in a "failed to write superblock." crochet's method of building images also fails with a "failed to write superblock." ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r328810 - head/usr.bin/clang/lld
Author: emaste Date: Fri Feb 2 21:52:00 2018 New Revision: 328810 URL: https://svnweb.freebsd.org/changeset/base/328810 Log: ld.lld.1: miscellaneous style improvements Submitted by: wblock in review D13813 Modified: head/usr.bin/clang/lld/ld.lld.1 Modified: head/usr.bin/clang/lld/ld.lld.1 == --- head/usr.bin/clang/lld/ld.lld.1 Fri Feb 2 21:25:32 2018 (r328809) +++ head/usr.bin/clang/lld/ld.lld.1 Fri Feb 2 21:52:00 2018 (r328810) @@ -36,7 +36,7 @@ .Op Ar options .Ar objfile ... .Sh DESCRIPTION -A linker takes one or more object, archive and library files, and combines +A linker takes one or more object, archive, and library files, and combines them into an output file (an executable, a shared library, or another object file). It relocates code and data from the input files and resolves symbol @@ -47,7 +47,7 @@ is a drop-in replacement for the GNU BFD and gold link It accepts most of the same command line arguments and linker scripts as GNU linkers. .Pp -The following options are available: +These options are available: .Bl -tag -width indent .It Fl -allow-multiple-definition Allow multiple definitions. @@ -218,7 +218,7 @@ Include hotness information in the optimization remark .It Fl O Ar value Optimize output file size. .It Fl o Ar path -Write the output executable, library or object to +Write the output executable, library, or object to .Ar path . If not specified, .Dv a.out @@ -333,7 +333,7 @@ Read a version script. .It Fl V , Fl -version Display the version number and exit. .It Fl v -Display the version number, and proceed with linking if object files are +Display the version number and proceed with linking if object files are specified. .It Fl -warn-common Warn about duplicate common symbols. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r328812 - head/sys/dev/etherswitch/arswitch
Author: adrian Date: Fri Feb 2 22:05:36 2018 New Revision: 328812 URL: https://svnweb.freebsd.org/changeset/base/328812 Log: [arswitch] begin tidying up the learning and ATU management, introduce ATU APIs. * Refactor the initial learning configuration (port learning, address expiry, handling address moving between ports, etc, etc) into a separate HAL routine * and ensure that it's consistent between switch chips - the AR8216,8316,724x,9331 SoCs all share the same switch code. * .. the AR8327 needs doing - the defaults seem OK for now * .. the AR9340 is different but it's also programmed now. * Add support for flushing a single port worth of ATU entries * Add support for fetching the ATU table from AR8216 and derived chips Tested: * AR9344, Carambola 2 TODO: * Further testing on other chips * Add AR9340 support * Add AR8327 support Modified: head/sys/dev/etherswitch/arswitch/arswitch.c head/sys/dev/etherswitch/arswitch/arswitch_7240.c head/sys/dev/etherswitch/arswitch/arswitch_8316.c head/sys/dev/etherswitch/arswitch/arswitch_8327.c head/sys/dev/etherswitch/arswitch/arswitch_9340.c head/sys/dev/etherswitch/arswitch/arswitchreg.h head/sys/dev/etherswitch/arswitch/arswitchvar.h Modified: head/sys/dev/etherswitch/arswitch/arswitch.c == --- head/sys/dev/etherswitch/arswitch/arswitch.cFri Feb 2 21:57:00 2018(r328811) +++ head/sys/dev/etherswitch/arswitch/arswitch.cFri Feb 2 22:05:36 2018(r328812) @@ -289,16 +289,34 @@ ar8xxx_port_init(struct arswitch_softc *sc, int port) } static int -ar8xxx_atu_flush(struct arswitch_softc *sc) +ar8xxx_atu_wait_ready(struct arswitch_softc *sc) { int ret; + ARSWITCH_LOCK_ASSERT(sc, MA_OWNED); + ret = arswitch_waitreg(sc->sc_dev, AR8216_REG_ATU, AR8216_ATU_ACTIVE, 0, 1000); + return (ret); +} + +/* + * Flush all ATU entries. + */ +static int +ar8xxx_atu_flush(struct arswitch_softc *sc) +{ + int ret; + + ARSWITCH_LOCK_ASSERT(sc, MA_OWNED); + + DPRINTF(sc, ARSWITCH_DBG_ATU, "%s: flushing all ports\n", __func__); + + ret = ar8xxx_atu_wait_ready(sc); if (ret) device_printf(sc->sc_dev, "%s: waitreg failed\n", __func__); @@ -310,7 +328,166 @@ ar8xxx_atu_flush(struct arswitch_softc *sc) return (ret); } +/* + * Flush ATU entries for a single port. + */ static int +ar8xxx_atu_flush_port(struct arswitch_softc *sc, int port) +{ + int ret, val; + + DPRINTF(sc, ARSWITCH_DBG_ATU, "%s: flushing port %d\n", __func__, + port); + + ARSWITCH_LOCK_ASSERT(sc, MA_OWNED); + + /* Flush unicast entries on port */ + val = AR8216_ATU_OP_FLUSH_UNICAST; + + /* TODO: bit 4 indicates whether to flush dynamic (0) or static (1) */ + + /* Which port */ + val |= SM(port, AR8216_ATU_PORT_NUM); + + ret = ar8xxx_atu_wait_ready(sc); + if (ret) + device_printf(sc->sc_dev, "%s: waitreg failed\n", __func__); + + if (!ret) + arswitch_writereg(sc->sc_dev, + AR8216_REG_ATU, + val | AR8216_ATU_ACTIVE); + + return (ret); +} + +/* + * XXX TODO: flush a single MAC address. + */ + +/* + * Fetch a single entry from the ATU. + */ +static int +ar8xxx_atu_fetch_table(struct arswitch_softc *sc, etherswitch_atu_entry_t *e, +int atu_fetch_op) +{ + uint32_t ret0, ret1, ret2, val; + + ARSWITCH_LOCK_ASSERT(sc, MA_OWNED); + + switch (atu_fetch_op) { + case 0: + /* Initialise things for the first fetch */ + + DPRINTF(sc, ARSWITCH_DBG_ATU, "%s: initializing\n", __func__); + (void) ar8xxx_atu_wait_ready(sc); + + arswitch_writereg(sc->sc_dev, + AR8216_REG_ATU, AR8216_ATU_OP_GET_NEXT); + arswitch_writereg(sc->sc_dev, + AR8216_REG_ATU_DATA, 0); + arswitch_writereg(sc->sc_dev, + AR8216_REG_ATU_CTRL2, 0); + + return (0); + case 1: + DPRINTF(sc, ARSWITCH_DBG_ATU, "%s: reading next\n", __func__); + /* +* Attempt to read the next address entry; don't modify what +* is there in AT_ADDR{4,5} as its used for the next fetch +*/ + (void) ar8xxx_atu_wait_ready(sc); + + /* Begin the next read event; not modifying anything */ + val = arswitch_readreg(sc->sc_dev, AR8216_REG_ATU); + val |= AR8216_ATU_ACTIVE; + arswitch_writereg(sc->sc_dev, AR8216_REG_ATU, val); + + /* Wait for it to complete */ + (void) ar8xxx_atu_wait_ready(sc); + + /* Fetch the ethernet address and ATU status */ + ret0 =
svn commit: r328806 - head/stand/ofw/common
Author: imp Date: Fri Feb 2 19:42:02 2018 New Revision: 328806 URL: https://svnweb.freebsd.org/changeset/base/328806 Log: We need more heap space to properly load newer powerpc kernels. PR: 225323 Modified: head/stand/ofw/common/main.c Modified: head/stand/ofw/common/main.c == --- head/stand/ofw/common/main.cFri Feb 2 18:38:29 2018 (r328805) +++ head/stand/ofw/common/main.cFri Feb 2 19:42:02 2018 (r328806) @@ -42,7 +42,7 @@ u_int32_t acells, scells; static char bootargs[128]; -#defineHEAP_SIZE 0x10 +#defineHEAP_SIZE 0x80 #define OF_puts(fd, text) OF_write(fd, text, strlen(text)) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r328814 - head/sys/dev/etherswitch/arswitch
Author: adrian Date: Fri Feb 2 22:08:03 2018 New Revision: 328814 URL: https://svnweb.freebsd.org/changeset/base/328814 Log: [arswitch] Stub out the ATU table dump in AR9340 switches until I implement this. Modified: head/sys/dev/etherswitch/arswitch/arswitch_9340.c Modified: head/sys/dev/etherswitch/arswitch/arswitch_9340.c == --- head/sys/dev/etherswitch/arswitch/arswitch_9340.c Fri Feb 2 22:06:15 2018(r328813) +++ head/sys/dev/etherswitch/arswitch/arswitch_9340.c Fri Feb 2 22:08:03 2018(r328814) @@ -183,6 +183,16 @@ ar9340_hw_global_setup(struct arswitch_softc *sc) return (0); } +static int +ar9340_atu_fetch_table(struct arswitch_softc *sc, etherswitch_atu_entry_t *e, +int atu_fetch_op) +{ + + /* XXX TODO */ + return (ENXIO); +} + + /* * The AR9340 switch probes (almost) the same as the AR7240 on-chip switch. * @@ -213,6 +223,7 @@ ar9340_attach(struct arswitch_softc *sc) sc->hal.arswitch_hw_setup = ar9340_hw_setup; sc->hal.arswitch_hw_global_setup = ar9340_hw_global_setup; sc->hal.arswitch_atu_learn_default = ar9340_atu_learn_default; + sc->hal.arswitch_atu_fetch_table = ar9340_atu_fetch_table; /* Set the switch vlan capabilities. */ sc->info.es_vlan_caps = ETHERSWITCH_VLAN_DOT1Q | ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r328815 - head/sbin/etherswitchcfg
Author: adrian Date: Fri Feb 2 22:08:35 2018 New Revision: 328815 URL: https://svnweb.freebsd.org/changeset/base/328815 Log: [etherswitchcfg] add atu flush and atu dump commands. Extend the argc/argv handling to include variable length commands (like flush all, flush port X). Modified: head/sbin/etherswitchcfg/etherswitchcfg.c Modified: head/sbin/etherswitchcfg/etherswitchcfg.c == --- head/sbin/etherswitchcfg/etherswitchcfg.c Fri Feb 2 22:08:03 2018 (r328814) +++ head/sbin/etherswitchcfg/etherswitchcfg.c Fri Feb 2 22:08:35 2018 (r328815) @@ -63,7 +63,8 @@ enum cmdmode { MODE_CONFIG, MODE_VLANGROUP, MODE_REGISTER, - MODE_PHYREG + MODE_PHYREG, + MODE_ATU }; struct cfg { @@ -79,9 +80,9 @@ struct cfg { struct cmds { enum cmdmodemode; - const char *name; - int args; - void(*f)(struct cfg *, char *argv[]); + const char *name; + int args; + int (*f)(struct cfg *, int argc, char *argv[]); }; static struct cmds cmds[]; @@ -166,12 +167,15 @@ write_phyregister(struct cfg *cfg, int phy, int reg, i err(EX_OSERR, "ioctl(IOETHERSWITCHSETPHYREG)"); } -static void -set_port_vid(struct cfg *cfg, char *argv[]) +static int +set_port_vid(struct cfg *cfg, int argc, char *argv[]) { int v; etherswitch_port_t p; - + + if (argc < 2) + return (-1); + v = strtol(argv[1], NULL, 0); if (v < 0 || v > IEEE802DOT1Q_VID_MAX) errx(EX_USAGE, "pvid must be between 0 and %d", @@ -183,16 +187,20 @@ set_port_vid(struct cfg *cfg, char *argv[]) p.es_pvid = v; if (ioctl(cfg->fd, IOETHERSWITCHSETPORT, ) != 0) err(EX_OSERR, "ioctl(IOETHERSWITCHSETPORT)"); + return (0); } -static void -set_port_flag(struct cfg *cfg, char *argv[]) +static int +set_port_flag(struct cfg *cfg, int argc, char *argv[]) { char *flag; int n; uint32_t f; etherswitch_port_t p; + if (argc < 1) + return (-1); + n = 0; f = 0; flag = argv[0]; @@ -224,15 +232,19 @@ set_port_flag(struct cfg *cfg, char *argv[]) p.es_flags |= f; if (ioctl(cfg->fd, IOETHERSWITCHSETPORT, ) != 0) err(EX_OSERR, "ioctl(IOETHERSWITCHSETPORT)"); + return (0); } -static void -set_port_media(struct cfg *cfg, char *argv[]) +static int +set_port_media(struct cfg *cfg, int argc, char *argv[]) { etherswitch_port_t p; int ifm_ulist[IFMEDIAREQ_NULISTENTRIES]; int subtype; - + + if (argc < 2) + return (-1); + bzero(, sizeof(p)); p.es_port = cfg->unit; p.es_ifmr.ifm_ulist = ifm_ulist; @@ -240,21 +252,25 @@ set_port_media(struct cfg *cfg, char *argv[]) if (ioctl(cfg->fd, IOETHERSWITCHGETPORT, ) != 0) err(EX_OSERR, "ioctl(IOETHERSWITCHGETPORT)"); if (p.es_ifmr.ifm_count == 0) - return; + return (0); subtype = get_media_subtype(IFM_TYPE(ifm_ulist[0]), argv[1]); p.es_ifr.ifr_media = (p.es_ifmr.ifm_current & IFM_IMASK) | IFM_TYPE(ifm_ulist[0]) | subtype; if (ioctl(cfg->fd, IOETHERSWITCHSETPORT, ) != 0) err(EX_OSERR, "ioctl(IOETHERSWITCHSETPORT)"); + return (0); } -static void -set_port_mediaopt(struct cfg *cfg, char *argv[]) +static int +set_port_mediaopt(struct cfg *cfg, int argc, char *argv[]) { etherswitch_port_t p; int ifm_ulist[IFMEDIAREQ_NULISTENTRIES]; int options; - + + if (argc < 2) + return (-1); + bzero(, sizeof(p)); p.es_port = cfg->unit; p.es_ifmr.ifm_ulist = ifm_ulist; @@ -271,15 +287,19 @@ set_port_mediaopt(struct cfg *cfg, char *argv[]) p.es_ifr.ifr_media |= options; if (ioctl(cfg->fd, IOETHERSWITCHSETPORT, ) != 0) err(EX_OSERR, "ioctl(IOETHERSWITCHSETPORT)"); + return (0); } -static void -set_port_led(struct cfg *cfg, char *argv[]) +static int +set_port_led(struct cfg *cfg, int argc, char *argv[]) { etherswitch_port_t p; int led; int i; - + + if (argc < 3) + return (-1); + bzero(, sizeof(p)); p.es_port = cfg->unit; if (ioctl(cfg->fd, IOETHERSWITCHGETPORT, ) != 0) @@ -303,14 +323,19 @@ set_port_led(struct cfg *cfg, char *argv[]) if (ioctl(cfg->fd, IOETHERSWITCHSETPORT, ) != 0) err(EX_OSERR, "ioctl(IOETHERSWITCHSETPORT)"); + + return (0); } -static void -set_vlangroup_vid(struct cfg *cfg, char *argv[]) +static int +set_vlangroup_vid(struct cfg *cfg, int argc, char *argv[]) { int v; etherswitch_vlangroup_t vg; +
svn commit: r328816 - head/share/mk
Author: arichardson Date: Fri Feb 2 22:09:36 2018 New Revision: 328816 URL: https://svnweb.freebsd.org/changeset/base/328816 Log: Revert r326375 since the warning has been turned off by default in clang See https://reviews.llvm.org/D41512 and https://reviews.llvm.org/rL322901 Approved By: brooks (mentor) Differential Revision: https://reviews.freebsd.org/D14171 Modified: head/share/mk/bsd.sys.mk Modified: head/share/mk/bsd.sys.mk == --- head/share/mk/bsd.sys.mkFri Feb 2 22:08:35 2018(r328815) +++ head/share/mk/bsd.sys.mkFri Feb 2 22:09:36 2018(r328816) @@ -71,9 +71,6 @@ CWARNFLAGS.clang+=-Wno-empty-body -Wno-string-plus-in .if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 30400 CWARNFLAGS.clang+= -Wno-unused-const-variable .endif -.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 6 -CWARNFLAGS.clang+= -Wno-error=tautological-constant-compare -.endif .endif # WARNS <= 6 .if ${WARNS} <= 3 CWARNFLAGS.clang+= -Wno-tautological-compare -Wno-unused-value\ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r328818 - head/bin/sh
Author: jilles Date: Fri Feb 2 22:53:58 2018 New Revision: 328818 URL: https://svnweb.freebsd.org/changeset/base/328818 Log: sh: Refactor job status printing, preparing for -o pipefail and similar No functional change is intended. Modified: head/bin/sh/jobs.c Modified: head/bin/sh/jobs.c == --- head/bin/sh/jobs.c Fri Feb 2 22:28:12 2018(r328817) +++ head/bin/sh/jobs.c Fri Feb 2 22:53:58 2018(r328818) @@ -362,7 +362,7 @@ showjob(struct job *jp, int mode) const char *statestr, *coredump; struct procstat *ps; struct job *j; - int col, curr, i, jobno, prev, procno; + int col, curr, i, jobno, prev, procno, status; char c; procno = (mode == SHOWJOBS_PGIDS) ? 1 : jp->nprocs; @@ -376,11 +376,12 @@ showjob(struct job *jp, int mode) } #endif coredump = ""; - ps = jp->ps + jp->nprocs - 1; + status = jp->ps[jp->nprocs - 1].status; if (jp->state == 0) { statestr = "Running"; #if JOBS } else if (jp->state == JOBSTOPPED) { + ps = jp->ps + jp->nprocs - 1; while (!WIFSTOPPED(ps->status) && ps > jp->ps) ps--; if (WIFSTOPPED(ps->status)) @@ -391,20 +392,20 @@ showjob(struct job *jp, int mode) if (statestr == NULL) statestr = "Suspended"; #endif - } else if (WIFEXITED(ps->status)) { - if (WEXITSTATUS(ps->status) == 0) + } else if (WIFEXITED(status)) { + if (WEXITSTATUS(status) == 0) statestr = "Done"; else { fmtstr(statebuf, sizeof(statebuf), "Done(%d)", - WEXITSTATUS(ps->status)); + WEXITSTATUS(status)); statestr = statebuf; } } else { - i = WTERMSIG(ps->status); + i = WTERMSIG(status); statestr = strsignal(i); if (statestr == NULL) statestr = "Unknown signal"; - if (WCOREDUMP(ps->status)) + if (WCOREDUMP(status)) coredump = " (core dumped)"; } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r328823 - head/sys/dev/etherswitch/arswitch
Author: adrian Date: Sat Feb 3 00:59:08 2018 New Revision: 328823 URL: https://svnweb.freebsd.org/changeset/base/328823 Log: [arswitch] add initial functionality for AR8327 ATU management. * Add the bulk of the ATU table read function * Correct how the ATU function and WAIT bits work TODO: * more testing, figure out how the multi-vlan table stuff works and push that up to userspace Modified: head/sys/dev/etherswitch/arswitch/arswitch_8327.c head/sys/dev/etherswitch/arswitch/arswitchreg.h Modified: head/sys/dev/etherswitch/arswitch/arswitch_8327.c == --- head/sys/dev/etherswitch/arswitch/arswitch_8327.c Fri Feb 2 23:34:33 2018(r328822) +++ head/sys/dev/etherswitch/arswitch/arswitch_8327.c Sat Feb 3 00:59:08 2018(r328823) @@ -1100,16 +1100,78 @@ ar8327_atu_flush_port(struct arswitch_softc *sc, int p return (ret); } +/* + * Fetch a single entry from the ATU. + */ static int ar8327_atu_fetch_table(struct arswitch_softc *sc, etherswitch_atu_entry_t *e, int atu_fetch_op) { + uint32_t ret0, ret1, ret2, val; - /* XXX TODO */ - return (ENXIO); -} + ARSWITCH_LOCK_ASSERT(sc, MA_OWNED); + switch (atu_fetch_op) { + case 0: + /* Initialise things for the first fetch */ + DPRINTF(sc, ARSWITCH_DBG_ATU, "%s: initializing\n", __func__); + (void) ar8327_atu_wait_ready(sc); + + arswitch_writereg(sc->sc_dev, + AR8327_REG_ATU_FUNC, AR8327_ATU_FUNC_OP_GET_NEXT); + arswitch_writereg(sc->sc_dev, AR8327_REG_ATU_DATA0, 0); + arswitch_writereg(sc->sc_dev, AR8327_REG_ATU_DATA1, 0); + arswitch_writereg(sc->sc_dev, AR8327_REG_ATU_DATA2, 0); + + return (0); + case 1: + DPRINTF(sc, ARSWITCH_DBG_ATU, "%s: reading next\n", __func__); + /* +* Attempt to read the next address entry; don't modify what +* is there in these registers as its used for the next fetch +*/ + (void) ar8327_atu_wait_ready(sc); + + /* Begin the next read event; not modifying anything */ + val = arswitch_readreg(sc->sc_dev, AR8327_REG_ATU_FUNC); + val |= AR8327_ATU_FUNC_BUSY; + arswitch_writereg(sc->sc_dev, AR8327_REG_ATU_FUNC, val); + + /* Wait for it to complete */ + (void) ar8327_atu_wait_ready(sc); + + /* Fetch the ethernet address and ATU status */ + ret0 = arswitch_readreg(sc->sc_dev, AR8327_REG_ATU_DATA0); + ret1 = arswitch_readreg(sc->sc_dev, AR8327_REG_ATU_DATA1); + ret2 = arswitch_readreg(sc->sc_dev, AR8327_REG_ATU_DATA2); + + /* If the status is zero, then we're done */ + if (MS(ret2, AR8327_ATU_FUNC_DATA2_STATUS) == 0) + return (-1); + + /* MAC address */ + e->es_macaddr[5] = MS(ret1, AR8327_ATU_DATA1_MAC_ADDR5); + e->es_macaddr[4] = MS(ret1, AR8327_ATU_DATA1_MAC_ADDR4); + e->es_macaddr[3] = MS(ret0, AR8327_ATU_DATA0_MAC_ADDR3); + e->es_macaddr[2] = MS(ret0, AR8327_ATU_DATA0_MAC_ADDR2); + e->es_macaddr[1] = MS(ret0, AR8327_ATU_DATA0_MAC_ADDR1); + e->es_macaddr[0] = MS(ret0, AR8327_ATU_DATA0_MAC_ADDR0); + + /* Bitmask of ports this entry is for */ + e->es_portmask = MS(ret1, AR8327_ATU_DATA1_DEST_PORT); + + /* TODO: other flags that are interesting */ + + DPRINTF(sc, ARSWITCH_DBG_ATU, "%s: MAC %6D portmask 0x%08x\n", + __func__, + e->es_macaddr, ":", e->es_portmask); + return (0); + default: + return (-1); + } + return (-1); +} static int ar8327_flush_dot1q_vlan(struct arswitch_softc *sc) { Modified: head/sys/dev/etherswitch/arswitch/arswitchreg.h == --- head/sys/dev/etherswitch/arswitch/arswitchreg.h Fri Feb 2 23:34:33 2018(r328822) +++ head/sys/dev/etherswitch/arswitch/arswitchreg.h Sat Feb 3 00:59:08 2018(r328823) @@ -485,11 +485,42 @@ #defineAR8327_PORT_VLAN1_OUT_MODE_UNTOUCH 3 #defineAR8327_REG_ATU_DATA00x600 +#defineAR8327_ATU_DATA0_MAC_ADDR3 BITS(0, 8) +#defineAR8327_ATU_DATA0_MAC_ADDR3_S0 +#defineAR8327_ATU_DATA0_MAC_ADDR2 BITS(8, 8) +#defineAR8327_ATU_DATA0_MAC_ADDR2_S8 +#defineAR8327_ATU_DATA0_MAC_ADDR1 BITS(16, 8) +#defineAR8327_ATU_DATA0_MAC_ADDR1_S16 +#defineAR8327_ATU_DATA0_MAC_ADDR0
svn commit: r328817 - in head: contrib/llvm/include/llvm contrib/llvm/include/llvm/CodeGen contrib/llvm/lib/CodeGen contrib/llvm/lib/CodeGen/SelectionDAG contrib/llvm/lib/Target/AMDGPU contrib/llvm...
Author: dim Date: Fri Feb 2 22:28:12 2018 New Revision: 328817 URL: https://svnweb.freebsd.org/changeset/base/328817 Log: Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to 6.0.0 (branches/release_60 r324090). This introduces retpoline support, with the -mretpoline flag. The upstream initial commit message (r323155 by Chandler Carruth) contains quite a bit of explanation. Quoting: Introduce the "retpoline" x86 mitigation technique for variant #2 of the speculative execution vulnerabilities disclosed today, specifically identified by CVE-2017-5715, "Branch Target Injection", and is one of the two halves to Spectre. Summary: First, we need to explain the core of the vulnerability. Note that this is a very incomplete description, please see the Project Zero blog post for details: https://googleprojectzero.blogspot.com/2018/01/reading-privileged-memory-with-side.html The basis for branch target injection is to direct speculative execution of the processor to some "gadget" of executable code by poisoning the prediction of indirect branches with the address of that gadget. The gadget in turn contains an operation that provides a side channel for reading data. Most commonly, this will look like a load of secret data followed by a branch on the loaded value and then a load of some predictable cache line. The attacker then uses timing of the processors cache to determine which direction the branch took *in the speculative execution*, and in turn what one bit of the loaded value was. Due to the nature of these timing side channels and the branch predictor on Intel processors, this allows an attacker to leak data only accessible to a privileged domain (like the kernel) back into an unprivileged domain. The goal is simple: avoid generating code which contains an indirect branch that could have its prediction poisoned by an attacker. In many cases, the compiler can simply use directed conditional branches and a small search tree. LLVM already has support for lowering switches in this way and the first step of this patch is to disable jump-table lowering of switches and introduce a pass to rewrite explicit indirectbr sequences into a switch over integers. However, there is no fully general alternative to indirect calls. We introduce a new construct we call a "retpoline" to implement indirect calls in a non-speculatable way. It can be thought of loosely as a trampoline for indirect calls which uses the RET instruction on x86. Further, we arrange for a specific call->ret sequence which ensures the processor predicts the return to go to a controlled, known location. The retpoline then "smashes" the return address pushed onto the stack by the call with the desired target of the original indirect call. The result is a predicted return to the next instruction after a call (which can be used to trap speculative execution within an infinite loop) and an actual indirect branch to an arbitrary address. On 64-bit x86 ABIs, this is especially easily done in the compiler by using a guaranteed scratch register to pass the target into this device. For 32-bit ABIs there isn't a guaranteed scratch register and so several different retpoline variants are introduced to use a scratch register if one is available in the calling convention and to otherwise use direct stack push/pop sequences to pass the target address. This "retpoline" mitigation is fully described in the following blog post: https://support.google.com/faqs/answer/7625886 We also support a target feature that disables emission of the retpoline thunk by the compiler to allow for custom thunks if users want them. These are particularly useful in environments like kernels that routinely do hot-patching on boot and want to hot-patch their thunk to different code sequences. They can write this custom thunk and use `-mretpoline-external-thunk` *in addition* to `-mretpoline`. In this case, on x86-64 thu thunk names must be: ``` __llvm_external_retpoline_r11 ``` or on 32-bit: ``` __llvm_external_retpoline_eax __llvm_external_retpoline_ecx __llvm_external_retpoline_edx __llvm_external_retpoline_push ``` And the target of the retpoline is passed in the named register, or in the case of the `push` suffix on the top of the stack via a `pushl` instruction. There is one other important source of indirect branches in x86 ELF binaries: the PLT. These patches also include support for LLD to generate PLT entries that perform a retpoline-style indirection. The only other indirect branches remaining that we are aware of are from precompiled runtimes (such as crt0.o and similar). The ones we have found are not really
Re: svn commit: r328536 - in head/stand: common powerpc/kboot
On 29 January 2018 at 04:24, Wojciech Macekwrote: > Author: wma > Date: Mon Jan 29 09:24:28 2018 > New Revision: 328536 > URL: https://svnweb.freebsd.org/changeset/base/328536 > > Log: > loader: support for mixed-endianness ELF/loader and POWER8 In r328536 I've committed royger's band-aid to fix kernel symbol loading, and hope that you can revisit it with a proper fix in short order. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r328821 - head/sbin/newfs
Author: mckusick Date: Fri Feb 2 23:26:52 2018 New Revision: 328821 URL: https://svnweb.freebsd.org/changeset/base/328821 Log: Check and report error returns from sbput(3) calls. Convert to using cgput(3) for writing cylinder groups. Check and report error returns from cgput(3). Submitted by: Bruce EvansModified: head/sbin/newfs/mkfs.c Modified: head/sbin/newfs/mkfs.c == --- head/sbin/newfs/mkfs.c Fri Feb 2 23:22:58 2018(r328820) +++ head/sbin/newfs/mkfs.c Fri Feb 2 23:26:52 2018(r328821) @@ -101,7 +101,6 @@ static void iput(union dinode *, ino_t); static int makedir(struct direct *, int); static void setblock(struct fs *, unsigned char *, int); static void wtfs(ufs2_daddr_t, int, char *); -static void cgckhash(struct cg *); static u_int32_t newfs_random(void); void @@ -520,24 +519,27 @@ restart: * Wipe out old UFS1 superblock(s) if necessary. */ if (!Nflag && Oflag != 1 && realsectorsize <= SBLOCK_UFS1) { - i = bread(, part_ofs + SBLOCK_UFS1 / disk.d_bsize, chdummy, SBLOCKSIZE); + i = bread(, part_ofs + SBLOCK_UFS1 / disk.d_bsize, chdummy, + SBLOCKSIZE); if (i == -1) - err(1, "can't read old UFS1 superblock: %s", disk.d_error); + err(1, "can't read old UFS1 superblock: %s", + disk.d_error); if (fsdummy.fs_magic == FS_UFS1_MAGIC) { fsdummy.fs_magic = 0; bwrite(, part_ofs + SBLOCK_UFS1 / disk.d_bsize, chdummy, SBLOCKSIZE); for (cg = 0; cg < fsdummy.fs_ncg; cg++) { - if (fsbtodb(, cgsblock(, cg)) > fssize) + if (fsbtodb(, cgsblock(, cg)) > + fssize) break; bwrite(, part_ofs + fsbtodb(, cgsblock(, cg)), chdummy, SBLOCKSIZE); } } } - if (!Nflag) - sbput(disk.d_fd, _fs, 0); + if (!Nflag && sbput(disk.d_fd, _fs, 0) != 0) + err(1, "sbput: %s", disk.d_error); if (Xflag == 1) { printf("** Exiting on Xflag 1\n"); exit(0); @@ -555,10 +557,9 @@ restart: i = 0; width = charsperline(); /* -* Allocate space for cylinder group map and -* two sets of inode blocks. +* Allocate space for two sets of inode blocks. */ - iobufsize = 3 * sblock.fs_bsize; + iobufsize = 2 * sblock.fs_bsize; if ((iobuf = calloc(1, iobufsize)) == 0) { printf("Cannot allocate I/O buffer\n"); exit(38); @@ -604,7 +605,8 @@ restart: * Reference the summary information so it will also be written. */ sblock.fs_csp = fscs; - sbput(disk.d_fd, _fs, 0); + if (sbput(disk.d_fd, _fs, 0) != 0) + err(1, "sbput: %s", disk.d_error); /* * For UFS1 filesystems with a blocksize of 64K, the first * alternate superblock resides at the location used for @@ -788,7 +790,6 @@ initcg(int cylno, time_t utime) } } *cs = acg.cg_cs; - cgckhash(); /* * Write out the duplicate super block. Then write the cylinder * group map and two blocks worth of inodes in a single write. @@ -796,11 +797,12 @@ initcg(int cylno, time_t utime) savedactualloc = sblock.fs_sblockactualloc; sblock.fs_sblockactualloc = dbtob(fsbtodb(, cgsblock(, cylno))); - sbput(disk.d_fd, _fs, 0); + if (sbput(disk.d_fd, _fs, 0) != 0) + err(1, "sbput: %s", disk.d_error); sblock.fs_sblockactualloc = savedactualloc; + if (cgput(, ) != 0) + err(1, "initcg: cgput: %s", disk.d_error); start = 0; - bcopy((char *), [start], sblock.fs_cgsize); - start += sblock.fs_bsize; dp1 = (struct ufs1_dinode *)([start]); dp2 = (struct ufs2_dinode *)([start]); for (i = 0; i < acg.cg_initediblk; i++) { @@ -812,7 +814,7 @@ initcg(int cylno, time_t utime) dp2++; } } - wtfs(fsbtodb(, cgtod(, cylno)), iobufsize, iobuf); + wtfs(fsbtodb(, cgimin(, cylno)), iobufsize, iobuf); /* * For the old file system, we have to initialize all the inodes. */ @@ -1008,10 +1010,8 @@ goth: for (i = frag; i < sblock.fs_frag; i++) setbit(cg_blksfree(), d + i); } - /* XXX cgwrite(, 0)??? */ - cgckhash(); - wtfs(fsbtodb(, cgtod(, 0)), sblock.fs_cgsize, - (char *)); + if (cgput(, ) != 0) +
svn commit: r328822 - head/usr.sbin/makefs/tests
Author: brooks Date: Fri Feb 2 23:34:33 2018 New Revision: 328822 URL: https://svnweb.freebsd.org/changeset/base/328822 Log: Check for cd9660 support before attempting to mount created images This extends the set in r316028 to allow all tests to pass or be skipped on a system without cd9660 support. A better approach using tar is possible, but this works today. Obtained from:CheriBSD Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D10516 Modified: head/usr.sbin/makefs/tests/makefs_cd9660_tests.sh Modified: head/usr.sbin/makefs/tests/makefs_cd9660_tests.sh == --- head/usr.sbin/makefs/tests/makefs_cd9660_tests.sh Fri Feb 2 23:26:52 2018(r328821) +++ head/usr.sbin/makefs/tests/makefs_cd9660_tests.sh Fri Feb 2 23:34:33 2018(r328822) @@ -96,8 +96,6 @@ D_flag_cleanup() atf_test_case F_flag cleanup F_flag_body() { - check_cd9660_support - create_test_inputs atf_check -e empty -o save:$TEST_SPEC_FILE -s exit:0 \ @@ -106,6 +104,7 @@ F_flag_body() atf_check -e empty -o empty -s exit:0 \ $MAKEFS -F $TEST_SPEC_FILE -M 1m $TEST_IMAGE $TEST_INPUTS_DIR + check_cd9660_support mount_image check_base_iso9660_image_contents } @@ -117,8 +116,6 @@ F_flag_cleanup() atf_test_case from_mtree_spec_file cleanup from_mtree_spec_file_body() { - check_cd9660_support - create_test_inputs atf_check -e empty -o save:$TEST_SPEC_FILE -s exit:0 \ @@ -128,6 +125,7 @@ from_mtree_spec_file_body() $MAKEFS $TEST_IMAGE $TEST_SPEC_FILE cd - + check_cd9660_support mount_image check_base_iso9660_image_contents } @@ -139,8 +137,6 @@ from_mtree_spec_file_cleanup() atf_test_case from_multiple_dirs cleanup from_multiple_dirs_body() { - check_cd9660_support - test_inputs_dir2=$TMPDIR/inputs2 create_test_inputs @@ -152,6 +148,7 @@ from_multiple_dirs_body() atf_check -e empty -o empty -s exit:0 \ $MAKEFS $TEST_IMAGE $TEST_INPUTS_DIR $test_inputs_dir2 + check_cd9660_support mount_image check_base_iso9660_image_contents -d $test_inputs_dir2 } @@ -163,13 +160,12 @@ from_multiple_dirs_cleanup() atf_test_case from_single_dir cleanup from_single_dir_body() { - check_cd9660_support - create_test_inputs atf_check -e empty -o empty -s exit:0 \ $MAKEFS $TEST_IMAGE $TEST_INPUTS_DIR + check_cd9660_support mount_image check_base_iso9660_image_contents } @@ -190,6 +186,7 @@ o_flag_allow_deep_trees_body() atf_check -e empty -o empty -s exit:0 \ $MAKEFS -o allow-deep-trees $TEST_IMAGE $TEST_INPUTS_DIR + check_cd9660_support mount_image check_base_iso9660_image_contents } @@ -213,6 +210,7 @@ o_flag_allow_max_name_body() atf_check -e empty -o empty -s exit:0 \ $MAKEFS -o allow-max-name $TEST_IMAGE $TEST_INPUTS_DIR + check_cd9660_support mount_image check_base_iso9660_image_contents } @@ -231,6 +229,7 @@ o_flag_isolevel_1_body() atf_check -e empty -o empty -s exit:0 \ $MAKEFS -o isolevel=1 $TEST_IMAGE $TEST_INPUTS_DIR + check_cd9660_support mount_image check_base_iso9660_image_contents } @@ -247,6 +246,7 @@ o_flag_isolevel_2_body() atf_check -e empty -o empty -s exit:0 \ $MAKEFS -o isolevel=2 $TEST_IMAGE $TEST_INPUTS_DIR + check_cd9660_support mount_image check_base_iso9660_image_contents } @@ -267,6 +267,8 @@ o_flag_isolevel_3_body() else atf_check -e empty -o empty -s exit:0 \ $MAKEFS -o isolevel=3 $TEST_IMAGE $TEST_INPUTS_DIR + + check_cd9660_support mount_image check_base_iso9660_image_contents fi @@ -334,6 +336,7 @@ o_flag_rockridge_body() atf_check -e empty -o empty -s exit:0 \ $MAKEFS -o rockridge $TEST_IMAGE $TEST_INPUTS_DIR + check_cd9660_support mount_image check_image_contents -X .rr_moved @@ -365,6 +368,7 @@ o_flag_rockridge_dev_nodes_body() atf_check -e empty -o empty -s exit:0 \ $MAKEFS -o rockridge $TEST_IMAGE $TEST_INPUTS_DIR + check_cd9660_support mount_image check_image_contents } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r328826 - head/stand/common
Author: emaste Date: Sat Feb 3 01:23:48 2018 New Revision: 328826 URL: https://svnweb.freebsd.org/changeset/base/328826 Log: Make cross-endian loader changes apply only to powerpc The cross-endian loader change in r328536 (review D12422) broke symbol loading on (at least) amd64 kernels. Temporarily paper over the issue by restricting the cross-endian support to only powerpc, until a proper fix arrives. Submitted by: royger Modified: head/stand/common/load_elf.c Modified: head/stand/common/load_elf.c == --- head/stand/common/load_elf.cSat Feb 3 01:20:01 2018 (r328825) +++ head/stand/common/load_elf.cSat Feb 3 01:23:48 2018 (r328826) @@ -127,7 +127,10 @@ __elfN(load_elf_header)(char *filename, elf_file_t ef) goto error; } +#ifdef __powerpc__ /* +* XXX: should be in a separate helper. +* * Fixup ELF endianness. * * The Xhdr structure was loaded using block read call to @@ -179,6 +182,7 @@ __elfN(load_elf_header)(char *filename, elf_file_t ef) ehdr->e_shnum = le16toh(ehdr->e_shnum); ehdr->e_shstrndx = le16toh(ehdr->e_shstrndx); } +#endif if (ehdr->e_version != EV_CURRENT || ehdr->e_machine != ELF_TARG_MACH) { /* Machine ? */ err = EFTYPE; @@ -375,15 +379,6 @@ __elfN(loadimage)(struct preloaded_file *fp, elf_file_ u_int fpcopy; Elf_Symsym; Elf_Addr p_start, p_end; -#if __ELF_WORD_SIZE == 64 -uint64_t scr_ssym; -uint64_t scr_esym; -uint64_t scr; -#else -uint32_t scr_ssym; -uint32_t scr_esym; -uint32_t scr; -#endif dp = NULL; shdr = NULL; @@ -458,7 +453,10 @@ __elfN(loadimage)(struct preloaded_file *fp, elf_file_ phdr = (Elf_Phdr *)(ef->firstpage + ehdr->e_phoff); for (i = 0; i < ehdr->e_phnum; i++) { +#ifdef __powerpc__ /* +* XXX: should be in a seprate helper. +* * Fixup ELF endianness. * * The Xhdr structure was loaded using block read call to @@ -505,6 +503,7 @@ __elfN(loadimage)(struct preloaded_file *fp, elf_file_ phdr[i].p_align = le32toh(phdr[i].p_align); } } +#endif /* We want to load PT_LOAD segments only.. */ if (phdr[i].p_type != PT_LOAD) @@ -581,7 +580,10 @@ __elfN(loadimage)(struct preloaded_file *fp, elf_file_ goto nosyms; } +#ifdef __powerpc__ /* + * XXX: should be in a seprate helper. + * * Fixup ELF endianness. * * The Xhdr structure was loaded using block read call to @@ -634,6 +636,8 @@ __elfN(loadimage)(struct preloaded_file *fp, elf_file_ } } } +#endif + file_addmetadata(fp, MODINFOMD_SHDR, chunk, shdr); /* @@ -712,16 +716,15 @@ __elfN(loadimage)(struct preloaded_file *fp, elf_file_ size = shdr[i].sh_size; #if defined(__powerpc__) #if __ELF_WORD_SIZE == 64 - scr = htobe64(size); + size = htobe64(size); #else - scr = htobe32(size); + size = htobe32(size); #endif -#else - scr = size; #endif - archsw.arch_copyin(, lastaddr, sizeof(scr)); - lastaddr += sizeof(scr); + archsw.arch_copyin(, lastaddr, sizeof(size)); + lastaddr += sizeof(size); + #ifdef ELF_VERBOSE printf("\n%s: 0x%jx@0x%jx -> 0x%jx-0x%jx", secname, (uintmax_t)shdr[i].sh_size, (uintmax_t)shdr[i].sh_offset, @@ -762,19 +765,16 @@ __elfN(loadimage)(struct preloaded_file *fp, elf_file_ #if defined(__powerpc__) /* On PowerPC we always need to provide BE data to the kernel */ #if __ELF_WORD_SIZE == 64 -scr_ssym = htobe64((uint64_t)ssym); -scr_esym = htobe64((uint64_t)esym); +ssym = htobe64((uint64_t)ssym); +esym = htobe64((uint64_t)esym); #else -scr_ssym = htobe32((uint32_t)ssym); -scr_esym = htobe32((uint32_t)esym); +ssym = htobe32((uint32_t)ssym); +esym = htobe32((uint32_t)esym); #endif -#else -scr_ssym = ssym; -scr_esym = esym; #endif -file_addmetadata(fp, MODINFOMD_SSYM, sizeof(scr_ssym), _ssym); -file_addmetadata(fp, MODINFOMD_ESYM, sizeof(scr_esym), _esym); +file_addmetadata(fp, MODINFOMD_SSYM, sizeof(ssym), ); +file_addmetadata(fp, MODINFOMD_ESYM, sizeof(esym), ); nosyms: printf("\n"); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"