svn commit: r329019 - head/stand/common
Author: imp Date: Thu Feb 8 17:07:27 2018 New Revision: 329019 URL: https://svnweb.freebsd.org/changeset/base/329019 Log: Move to tabs for indentation and to 8-space notches, per style(9). 4 space indentation with a mix of tabs and spaces is a hassle. Update to project-standard hard-tabs with 8-space indentation in these files. This matches the new code coming in better as well. Modified: head/stand/common/boot.c head/stand/common/interp_backslash.c head/stand/common/interp_parse.c Modified: head/stand/common/boot.c == --- head/stand/common/boot.cThu Feb 8 14:53:34 2018(r329018) +++ head/stand/common/boot.cThu Feb 8 17:07:27 2018(r329019) @@ -52,60 +52,60 @@ COMMAND_SET(boot, "boot", "boot a file or loaded kerne static int command_boot(int argc, char *argv[]) { -struct preloaded_file *fp; + struct preloaded_file *fp; -/* - * See if the user has specified an explicit kernel to boot. - */ -if ((argc > 1) && (argv[1][0] != '-')) { + /* +* See if the user has specified an explicit kernel to boot. +*/ + if ((argc > 1) && (argv[1][0] != '-')) { - /* XXX maybe we should discard everything and start again? */ - if (file_findfile(NULL, NULL) != NULL) { - snprintf(command_errbuf, sizeof(command_errbuf), - "can't boot '%s', kernel module already loaded", argv[1]); - return(CMD_ERROR); + /* XXX maybe we should discard everything and start again? */ + if (file_findfile(NULL, NULL) != NULL) { + snprintf(command_errbuf, sizeof(command_errbuf), + "can't boot '%s', kernel module already loaded", argv[1]); + return(CMD_ERROR); + } + + /* find/load the kernel module */ + if (mod_loadkld(argv[1], argc - 2, argv + 2) != 0) + return(CMD_ERROR); + /* we have consumed all arguments */ + argc = 1; } - /* find/load the kernel module */ - if (mod_loadkld(argv[1], argc - 2, argv + 2) != 0) - return(CMD_ERROR); - /* we have consumed all arguments */ - argc = 1; -} + /* +* See if there is a kernel module already loaded +*/ + if (file_findfile(NULL, NULL) == NULL) + if (loadakernel(0, argc - 1, argv + 1)) + /* we have consumed all arguments */ + argc = 1; -/* - * See if there is a kernel module already loaded - */ -if (file_findfile(NULL, NULL) == NULL) - if (loadakernel(0, argc - 1, argv + 1)) - /* we have consumed all arguments */ - argc = 1; + /* +* Loaded anything yet? +*/ + if ((fp = file_findfile(NULL, NULL)) == NULL) { + command_errmsg = "no bootable kernel"; + return(CMD_ERROR); + } -/* - * Loaded anything yet? - */ -if ((fp = file_findfile(NULL, NULL)) == NULL) { - command_errmsg = "no bootable kernel"; - return(CMD_ERROR); -} + /* +* If we were given arguments, discard any previous. +* XXX should we merge arguments? Hard to DWIM. +*/ + if (argc > 1) { + if (fp->f_args != NULL) + free(fp->f_args); + fp->f_args = unargv(argc - 1, argv + 1); + } -/* - * If we were given arguments, discard any previous. - * XXX should we merge arguments? Hard to DWIM. - */ -if (argc > 1) { - if (fp->f_args != NULL) - free(fp->f_args); - fp->f_args = unargv(argc - 1, argv + 1); -} + /* Hook for platform-specific autoloading of modules */ + if (archsw.arch_autoload() != 0) + return(CMD_ERROR); -/* Hook for platform-specific autoloading of modules */ -if (archsw.arch_autoload() != 0) + /* Call the exec handler from the loader matching the kernel */ + file_formats[fp->f_loader]->l_exec(fp); return(CMD_ERROR); - -/* Call the exec handler from the loader matching the kernel */ -file_formats[fp->f_loader]->l_exec(fp); -return(CMD_ERROR); } @@ -118,29 +118,29 @@ COMMAND_SET(autoboot, "autoboot", "boot automatically static int command_autoboot(int argc, char *argv[]) { -inthowlong; -char *cp, *prompt; + int howlong; + char*cp, *prompt; -prompt = NULL; -howlong = -1; -switch(argc) { -case 3: - prompt = argv[2]; - /* FALLTHROUGH */ -case 2: - howlong = strtol(argv[1], , 0); - if (*cp != 0) { - snprintf(command_errbuf, sizeof(command_errbuf), - "bad delay '%s'", argv[1]); - return(CMD_ERROR); + prompt = NULL; +
Re: svn commit: r328536 - in head/stand: common powerpc/kboot
Ping? Ed committed a band-aid, but we need to get this fixed. On Wed, Jan 31, 2018 at 03:20:46PM +, Roger Pau Monné wrote: > On Mon, Jan 29, 2018 at 09:24:28AM +, Wojciech Macek wrote: > > Modified: head/stand/common/load_elf.c > > == > > --- head/stand/common/load_elf.cMon Jan 29 09:21:08 2018 > > (r328535) > > +++ head/stand/common/load_elf.cMon Jan 29 09:24:28 2018 > > (r328536) > > @@ -29,6 +29,7 @@ > > __FBSDID("$FreeBSD$"); > > > > #include > > +#include > > #include > > #include > > #include > > @@ -118,15 +119,72 @@ __elfN(load_elf_header)(char *filename, elf_file_t ef) > > err = EFTYPE; > > goto error; > > } > > + > > if (ehdr->e_ident[EI_CLASS] != ELF_TARG_CLASS || /* Layout ? */ > > ehdr->e_ident[EI_DATA] != ELF_TARG_DATA || > > So here you force EI_DATA == ELF_TARG_DATA in order to continue... > > > - ehdr->e_ident[EI_VERSION] != EV_CURRENT || /* Version ? */ > > - ehdr->e_version != EV_CURRENT || > > - ehdr->e_machine != ELF_TARG_MACH) { /* Machine ? */ > > + ehdr->e_ident[EI_VERSION] != EV_CURRENT) /* Version ? */ { > > err = EFTYPE; > > goto error; > > } > > > > + /* > > +* Fixup ELF endianness. > > +* > > +* The Xhdr structure was loaded using block read call to > > +* optimize file accesses. It might happen, that the endianness > > +* of the system memory is different that endianness of > > +* the ELF header. > > +* Swap fields here to guarantee that Xhdr always contain > > +* valid data regardless of architecture. > > +*/ > > + if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB) { > > + ehdr->e_type = be16toh(ehdr->e_type); > > ... yet here you check for EI_DATA == ELFDATA2MSB which AFAICT it's not > possible given the check above, so the following if branch is dead > code. > > > + ehdr->e_machine = be16toh(ehdr->e_machine); > > + ehdr->e_version = be32toh(ehdr->e_version); > > + if (ehdr->e_ident[EI_CLASS] == ELFCLASS64) { > > + ehdr->e_entry = be64toh(ehdr->e_entry); > > + ehdr->e_phoff = be64toh(ehdr->e_phoff); > > + ehdr->e_shoff = be64toh(ehdr->e_shoff); > > + } else { > > + ehdr->e_entry = be32toh(ehdr->e_entry); > > + ehdr->e_phoff = be32toh(ehdr->e_phoff); > > + ehdr->e_shoff = be32toh(ehdr->e_shoff); > > + } > > + ehdr->e_flags = be32toh(ehdr->e_flags); > > + ehdr->e_ehsize = be16toh(ehdr->e_ehsize); > > + ehdr->e_phentsize = be16toh(ehdr->e_phentsize); > > + ehdr->e_phnum = be16toh(ehdr->e_phnum); > > + ehdr->e_shentsize = be16toh(ehdr->e_shentsize); > > + ehdr->e_shnum = be16toh(ehdr->e_shnum); > > + ehdr->e_shstrndx = be16toh(ehdr->e_shstrndx); > > + > > + } else { > > + ehdr->e_type = le16toh(ehdr->e_type); > > + ehdr->e_machine = le16toh(ehdr->e_machine); > > + ehdr->e_version = le32toh(ehdr->e_version); > > + if (ehdr->e_ident[EI_CLASS] == ELFCLASS64) { > > + ehdr->e_entry = le64toh(ehdr->e_entry); > > + ehdr->e_phoff = le64toh(ehdr->e_phoff); > > + ehdr->e_shoff = le64toh(ehdr->e_shoff); > > + } else { > > + ehdr->e_entry = le32toh(ehdr->e_entry); > > + ehdr->e_phoff = le32toh(ehdr->e_phoff); > > + ehdr->e_shoff = le32toh(ehdr->e_shoff); > > + } > > + ehdr->e_flags = le32toh(ehdr->e_flags); > > + ehdr->e_ehsize = le16toh(ehdr->e_ehsize); > > + ehdr->e_phentsize = le16toh(ehdr->e_phentsize); > > + ehdr->e_phnum = le16toh(ehdr->e_phnum); > > + ehdr->e_shentsize = le16toh(ehdr->e_shentsize); > > + ehdr->e_shnum = le16toh(ehdr->e_shnum); > > + ehdr->e_shstrndx = le16toh(ehdr->e_shstrndx); > > + } > > I think this chunk (and all the similar ones below) should be put on a > macro in order to avoid such big chunks of code repetition. It's also > fairly easy to forget to change one of the branches in the future. > > Roger. > ___ 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: r329022 - head/crypto/openssl/doc/man3
Author: jkim Date: Thu Feb 8 19:26:52 2018 New Revision: 329022 URL: https://svnweb.freebsd.org/changeset/base/329022 Log: MFV: r329021 Belatedly remove an empty directory. Deleted: head/crypto/openssl/doc/man3/ Modified: Directory Properties: head/crypto/openssl/ (props changed) ___ 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: r329024 - in head: . secure/lib/libcrypto secure/usr.bin/openssl secure/usr.bin/openssl/man
Author: jkim Date: Thu Feb 8 19:55:03 2018 New Revision: 329024 URL: https://svnweb.freebsd.org/changeset/base/329024 Log: Remove c_rehash(1) to not confuse users. We do not install the Perl script. MFC after:3 days Deleted: head/secure/usr.bin/openssl/man/c_rehash.1 Modified: head/ObsoleteFiles.inc head/secure/lib/libcrypto/Makefile.inc head/secure/usr.bin/openssl/Makefile.man Modified: head/ObsoleteFiles.inc == --- head/ObsoleteFiles.inc Thu Feb 8 19:28:51 2018(r329023) +++ head/ObsoleteFiles.inc Thu Feb 8 19:55:03 2018(r329024) @@ -38,6 +38,8 @@ # xargs -n1 | sort | uniq -d; # done +# 20180208: remove c_rehash(1) +OLD_FILES+=usr/share/openssl/man/man1/c_rehash.1.gz # 20180206: remove gdbtui OLD_FILES+=usr/bin/gdbtui # 20180201: Obsolete forth files Modified: head/secure/lib/libcrypto/Makefile.inc == --- head/secure/lib/libcrypto/Makefile.inc Thu Feb 8 19:28:51 2018 (r329023) +++ head/secure/lib/libcrypto/Makefile.inc Thu Feb 8 19:55:03 2018 (r329024) @@ -64,14 +64,11 @@ MANDIR= ${SHAREDIR}/openssl/man/man .if defined(LIB) _docs= ${LIB} -.if ${LIB} == ssl -_docs+=man3 -.endif _skip= SSLeay_version des_modes _sec= 3 .else _docs= apps -_skip= config +_skip= c_rehash config _sec= 1 .endif Modified: head/secure/usr.bin/openssl/Makefile.man == --- head/secure/usr.bin/openssl/Makefile.manThu Feb 8 19:28:51 2018 (r329023) +++ head/secure/usr.bin/openssl/Makefile.manThu Feb 8 19:55:03 2018 (r329024) @@ -2,7 +2,6 @@ # DO NOT EDIT: generated from man-makefile-update target MAN+= CA.pl.1 MAN+= asn1parse.1 -MAN+= c_rehash.1 MAN+= ca.1 MAN+= ciphers.1 MAN+= cms.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: r329023 - in head/sys: amd64/amd64 arm64/arm64 i386/i386 mips/mips powerpc/powerpc riscv/riscv sparc64/sparc64
Author: markj Date: Thu Feb 8 19:28:51 2018 New Revision: 329023 URL: https://svnweb.freebsd.org/changeset/base/329023 Log: Use vm_page_unwire_noq() instead of directly modifying page wire counts. No functional change intended. Reviewed by: alc, kib (previous revision) MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D14266 Modified: head/sys/amd64/amd64/pmap.c head/sys/amd64/amd64/uma_machdep.c head/sys/arm64/arm64/pmap.c head/sys/arm64/arm64/uma_machdep.c head/sys/i386/i386/pmap.c head/sys/mips/mips/pmap.c head/sys/mips/mips/uma_machdep.c head/sys/powerpc/powerpc/uma_machdep.c head/sys/riscv/riscv/pmap.c head/sys/sparc64/sparc64/vm_machdep.c Modified: head/sys/amd64/amd64/pmap.c == --- head/sys/amd64/amd64/pmap.c Thu Feb 8 19:26:52 2018(r329022) +++ head/sys/amd64/amd64/pmap.c Thu Feb 8 19:28:51 2018(r329023) @@ -2723,8 +2723,7 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, str /* Have to allocate a new pdp, recurse */ if (_pmap_allocpte(pmap, NUPDE + NUPDPE + pml4index, lockp) == NULL) { - --m->wire_count; - atomic_subtract_int(_cnt.v_wire_count, 1); + vm_page_unwire_noq(m); vm_page_free_zero(m); return (NULL); } @@ -2756,8 +2755,7 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, str /* Have to allocate a new pd, recurse */ if (_pmap_allocpte(pmap, NUPDE + pdpindex, lockp) == NULL) { - --m->wire_count; - atomic_subtract_int(_cnt.v_wire_count, 1); + vm_page_unwire_noq(m); vm_page_free_zero(m); return (NULL); } @@ -2770,9 +2768,7 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, str /* Have to allocate a new pd, recurse */ if (_pmap_allocpte(pmap, NUPDE + pdpindex, lockp) == NULL) { - --m->wire_count; - atomic_subtract_int(_cnt.v_wire_count, - 1); + vm_page_unwire_noq(m); vm_page_free_zero(m); return (NULL); } @@ -2904,18 +2900,16 @@ pmap_release(pmap_t pmap) pmap->pm_pml4[DMPML4I + i] = 0; pmap->pm_pml4[PML4PML4I] = 0; /* Recursive Mapping */ - m->wire_count--; - atomic_subtract_int(_cnt.v_wire_count, 1); + vm_page_unwire_noq(m); vm_page_free_zero(m); if (pmap->pm_pml4u != NULL) { m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pmap->pm_pml4u)); - m->wire_count--; - atomic_subtract_int(_cnt.v_wire_count, 1); + vm_page_unwire_noq(m); vm_page_free(m); } } - + static int kvm_size(SYSCTL_HANDLER_ARGS) { @@ -7711,10 +7705,8 @@ pmap_pti_free_page(vm_page_t m) { KASSERT(m->wire_count > 0, ("page %p not wired", m)); - m->wire_count--; - if (m->wire_count != 0) + if (!vm_page_unwire_noq(m)) return (false); - atomic_subtract_int(_cnt.v_wire_count, 1); vm_page_free_zero(m); return (true); } Modified: head/sys/amd64/amd64/uma_machdep.c == --- head/sys/amd64/amd64/uma_machdep.c Thu Feb 8 19:26:52 2018 (r329022) +++ head/sys/amd64/amd64/uma_machdep.c Thu Feb 8 19:28:51 2018 (r329023) @@ -74,7 +74,6 @@ uma_small_free(void *mem, vm_size_t size, u_int8_t fla pa = DMAP_TO_PHYS((vm_offset_t)mem); dump_drop_page(pa); m = PHYS_TO_VM_PAGE(pa); - m->wire_count--; + vm_page_unwire_noq(m); vm_page_free(m); - atomic_subtract_int(_cnt.v_wire_count, 1); } Modified: head/sys/arm64/arm64/pmap.c == --- head/sys/arm64/arm64/pmap.c Thu Feb 8 19:26:52 2018(r329022) +++ head/sys/arm64/arm64/pmap.c Thu Feb 8 19:28:51 2018(r329023) @@ -1362,12 +1362,7 @@ _pmap_unwire_l3(pmap_t pmap, vm_offset_t va, vm_page_t } pmap_invalidate_page(pmap, va); - /* -* This is a release store so that the ordinary store unmapping -* the page table page is globally performed before TLB shoot- -* down is begun. -*/ -
svn commit: r329033 - in head: contrib/llvm/tools/clang/lib/CodeGen sys/sys
Author: dim Date: Thu Feb 8 21:11:48 2018 New Revision: 329033 URL: https://svnweb.freebsd.org/changeset/base/329033 Log: Pull in r324594 from upstream clang trunk (by Alexander Ivchenko): Fix for #31362 - ms_abi is implemented incorrectly for values >=16 bytes. Summary: This patch is a fix for following issue: https://bugs.llvm.org/show_bug.cgi?id=31362 The problem was caused by front end lowering C calling conventions without taking into account calling conventions enforced by attribute. In this case win64cc was no correctly lowered on targets other than Windows. Reviewed By: rnk (Reid Kleckner) Differential Revision: https://reviews.llvm.org/D43016 Author: belickimThis fixes clang 6.0.0 assertions when building the emulators/wine and emulators/wine-devel ports, and should also make it use the correct Windows calling conventions. Bump __FreeBSD_version to make the fix easy to detect. PR: 224863 MFC after:3 months X-MFC-With: r327952 Modified: head/contrib/llvm/tools/clang/lib/CodeGen/TargetInfo.cpp head/sys/sys/param.h Modified: head/contrib/llvm/tools/clang/lib/CodeGen/TargetInfo.cpp == --- head/contrib/llvm/tools/clang/lib/CodeGen/TargetInfo.cppThu Feb 8 21:06:30 2018(r329032) +++ head/contrib/llvm/tools/clang/lib/CodeGen/TargetInfo.cppThu Feb 8 21:11:48 2018(r329033) @@ -3543,7 +3543,17 @@ ABIArgInfo X86_64ABIInfo::classifyRegCallStructType(Qu void X86_64ABIInfo::computeInfo(CGFunctionInfo ) const { - bool IsRegCall = FI.getCallingConvention() == llvm::CallingConv::X86_RegCall; + const unsigned CallingConv = FI.getCallingConvention(); + // It is possible to force Win64 calling convention on any x86_64 target by + // using __attribute__((ms_abi)). In such case to correctly emit Win64 + // compatible code delegate this call to WinX86_64ABIInfo::computeInfo. + if (CallingConv == llvm::CallingConv::Win64) { +WinX86_64ABIInfo Win64ABIInfo(CGT); +Win64ABIInfo.computeInfo(FI); +return; + } + + bool IsRegCall = CallingConv == llvm::CallingConv::X86_RegCall; // Keep track of the number of assigned registers. unsigned FreeIntRegs = IsRegCall ? 11 : 6; Modified: head/sys/sys/param.h == --- head/sys/sys/param.hThu Feb 8 21:06:30 2018(r329032) +++ head/sys/sys/param.hThu Feb 8 21:11:48 2018(r329033) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1200056 /* Master, propagated to newvers */ +#define __FreeBSD_version 1200057 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, ___ 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: r329025 - head/sys/nfs
Author: brooks Date: Thu Feb 8 20:09:42 2018 New Revision: 329025 URL: https://svnweb.freebsd.org/changeset/base/329025 Log: Modernize nfssvc(2) registartion. Use syscall_helper_register() to register syscalls and do it through the module interface rather than sysinit. This pattern is more common and easier to understand. Reviewed by: jhb Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D14232 Modified: head/sys/nfs/nfs_nfssvc.c Modified: head/sys/nfs/nfs_nfssvc.c == --- head/sys/nfs/nfs_nfssvc.c Thu Feb 8 19:55:03 2018(r329024) +++ head/sys/nfs/nfs_nfssvc.c Thu Feb 8 20:09:42 2018(r329025) @@ -56,9 +56,10 @@ __FBSDID("$FreeBSD$"); #include -static int nfssvc_offset = SYS_nfssvc; -static struct sysent nfssvc_prev_sysent; -MAKE_SYSENT(nfssvc); +static struct syscall_helper_data nfssvc_syscalls[] = { + SYSCALL_INIT_HELPER(nfssvc), + SYSCALL_INIT_LAST +}; /* * This tiny module simply handles the nfssvc() system call. The other @@ -119,16 +120,12 @@ sys_nfssvc(struct thread *td, struct nfssvc_args *uap) static int nfssvc_modevent(module_t mod, int type, void *data) { - static int registered; int error = 0; switch (type) { case MOD_LOAD: - error = syscall_register(_offset, _sysent, - _prev_sysent, SY_THR_STATIC_KLD); - if (error) - break; - registered = 1; + error = syscall_helper_register(nfssvc_syscalls, + SY_THR_STATIC_KLD); break; case MOD_UNLOAD: @@ -137,9 +134,7 @@ nfssvc_modevent(module_t mod, int type, void *data) error = EBUSY; break; } - if (registered) - syscall_deregister(_offset, _prev_sysent); - registered = 0; + syscall_helper_unregister(nfssvc_syscalls); break; default: error = EOPNOTSUPP; ___ 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: r329054 - head/stand/common
Author: imp Date: Fri Feb 9 00:36:55 2018 New Revision: 329054 URL: https://svnweb.freebsd.org/changeset/base/329054 Log: Set script.lang in the environment to either 'forth' or 'simple' to reflect what scripting language was compiled into the loader. I anticipate that being able to find this out quickly from the OK prompt will be useful in troubleshooting in the future. Modified: head/stand/common/interp_forth.c head/stand/common/interp_simple.c Modified: head/stand/common/interp_forth.c == --- head/stand/common/interp_forth.cFri Feb 9 00:13:05 2018 (r329053) +++ head/stand/common/interp_forth.cFri Feb 9 00:36:55 2018 (r329054) @@ -337,6 +337,7 @@ void interp_init(void) { + setenv("script.lang", "forth", 1); bf_init(); /* Read our default configuration. */ interp_include("/boot/loader.rc"); Modified: head/stand/common/interp_simple.c == --- head/stand/common/interp_simple.c Fri Feb 9 00:13:05 2018 (r329053) +++ head/stand/common/interp_simple.c Fri Feb 9 00:36:55 2018 (r329054) @@ -39,6 +39,7 @@ void interp_init(void) { + setenv("script.lang", "simple", 1); /* Read our default configuration. */ interp_include("/boot/loader.rc"); } ___ 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: r329052 - head/sbin/fsck_ffs
Author: mckusick Date: Thu Feb 8 23:14:24 2018 New Revision: 329052 URL: https://svnweb.freebsd.org/changeset/base/329052 Log: Include files missed in 329051. Modified: head/sbin/fsck_ffs/fsck.h head/sbin/fsck_ffs/globs.c head/sbin/fsck_ffs/main.c Modified: head/sbin/fsck_ffs/fsck.h == --- head/sbin/fsck_ffs/fsck.h Thu Feb 8 23:06:58 2018(r329051) +++ head/sbin/fsck_ffs/fsck.h Thu Feb 8 23:14:24 2018(r329052) @@ -315,6 +315,7 @@ extern int Zflag; /* zero empty data blocks */ extern int inoopt; /* trim out unused inodes */ extern charckclean;/* only do work if not cleanly unmounted */ extern int cvtlevel; /* convert to newer file system format */ +extern int ckhashadd; /* check hashes to be added */ extern int bkgrdcheck; /* determine if background check is possible */ extern int bkgrdsumadj;/* whether the kernel have ability to adjust superblock summary */ extern charusedsoftdep;/* just fix soft dependency inconsistencies */ Modified: head/sbin/fsck_ffs/globs.c == --- head/sbin/fsck_ffs/globs.c Thu Feb 8 23:06:58 2018(r329051) +++ head/sbin/fsck_ffs/globs.c Thu Feb 8 23:14:24 2018(r329052) @@ -87,6 +87,7 @@ int Zflag; /* zero empty data blocks */ intinoopt; /* trim out unused inodes */ char ckclean;/* only do work if not cleanly unmounted */ intcvtlevel; /* convert to newer file system format */ +intckhashadd; /* check hashes to be added */ intbkgrdcheck; /* determine if background check is possible */ intbkgrdsumadj;/* whether the kernel have ability to adjust superblock summary */ char usedsoftdep;/* just fix soft dependency inconsistencies */ Modified: head/sbin/fsck_ffs/main.c == --- head/sbin/fsck_ffs/main.c Thu Feb 8 23:06:58 2018(r329051) +++ head/sbin/fsck_ffs/main.c Thu Feb 8 23:14:24 2018(r329052) @@ -43,6 +43,7 @@ static char sccsid[] = "@(#)main.c8.6 (Berkeley) 5/14 #include __FBSDID("$FreeBSD$"); +#defineIN_RTLD /* So we pickup the P_OSREL defines */ #include #include #include @@ -440,7 +441,46 @@ checkfilesys(char *filesys) flush(fswritefd, ); fsmodified = ofsmodified; } - + /* +* If the filesystem was run on an old kernel that did not +* support check hashes, clear the check-hash flags so that +* we do not try to verify them. +*/ + if ((sblock.fs_flags & FS_METACKHASH) == 0) + sblock.fs_metackhash = 0; + /* +* If we are running on a kernel that can provide check hashes +* that are not yet enabled for the filesystem and we are +* running manually without the -y flag, offer to add any +* supported check hashes that are not already enabled. +*/ + ckhashadd = 0; + if (preen == 0 && yflag == 0 && sblock.fs_magic != FS_UFS1_MAGIC && + fswritefd != -1 && getosreldate() >= P_OSREL_CK_CYLGRP) { + if ((sblock.fs_metackhash & CK_CYLGRP) == 0 && + reply("ADD CYLINDER GROUP CHECK-HASH PROTECTION") != 0) + ckhashadd |= CK_CYLGRP; +#ifdef notyet + if ((sblock.fs_metackhash & CK_SUPERBLOCK) == 0 && + getosreldate() >= P_OSREL_CK_SUPERBLOCK && + reply("ADD SUPERBLOCK CHECK-HASH PROTECTION") != 0) + ckhashadd |= CK_SUPERBLOCK; + if ((sblock.fs_metackhash & CK_INODE) == 0 && + getosreldate() >= P_OSREL_CK_INODE && + reply("ADD INODE CHECK-HASH PROTECTION") != 0) + ckhashadd |= CK_INODE; + if ((sblock.fs_metackhash & CK_INDIR) == 0 && + getosreldate() >= P_OSREL_CK_INDIR && + reply("ADD INDIRECT BLOCK CHECK-HASH PROTECTION") != 0) + ckhashadd |= CK_INDIR; + if ((sblock.fs_metackhash & CK_DIR) == 0 && + getosreldate() >= P_OSREL_CK_DIR && + reply("ADD DIRECTORY CHECK-HASH PROTECTION") != 0) + ckhashadd |= CK_DIR; +#endif /* notyet */ + if (ckhashadd != 0) + sblock.fs_flags |= FS_METACKHASH; + } /* * Cleared if any questions answered no. Used to decide if * the superblock should be marked clean. ___ svn-src-head@freebsd.org mailing list
svn commit: r329051 - in head: sbin/dumpfs sbin/fsck_ffs sbin/newfs sys/ufs/ffs
Author: mckusick Date: Thu Feb 8 23:06:58 2018 New Revision: 329051 URL: https://svnweb.freebsd.org/changeset/base/329051 Log: The goal of this change is to prevent accidental foot shooting by folks running filesystems created on check-hash enabled kernels (which I will call "new") on a non-check-hash enabled kernels (which I will call "old). The idea here is to detect when a filesystem is run on an old kernel and flag the filesystem so that when it gets moved back to a new kernel, it will not start getting a slew of check-hash errors. Back when the UFS version 2 filesystem was created, it added a file flag FS_INDEXDIRS that was to be set on any filesystem that kept some sort of on-disk indexing for directories. The idea was precisely to solve the issue we have today. Specifically that a newer kernel that supported indexing would be able to tell that the filesystem had been run on an older non-indexing kernel and that the indexes should not be used until they had been rebuilt. Since we have never implemented on-disk directory indicies, the FS_INDEXDIRS flag is cleared every time any UFS version 2 filesystem ever created is mounted for writing. This commit repurposes the FS_INDEXDIRS flag as the FS_METACKHASH flag. Thus, the FS_METACKHASH is definitively known to have always been cleared. The FS_INDEXDIRS flag has been moved to a new block of flags that will always be cleared starting with this commit (until they get used to implement some future feature which needs to detect that the filesystem was mounted on a kernel that predates the new feature). If a filesystem with check-hashes enabled is mounted on an old kernel the FS_METACKHASH flag is cleared. When that filesystem is mounted on a new kernel it will see that the FS_METACKHASH has been cleared and clears all of the fs_metackhash flags. To get them re-enabled the user must run fsck (in interactive mode without the -y flag) which will ask for each supported check hash whether it should be rebuilt and enabled. When fsck is run in its default preen mode, it will just ignore the check hashes so they will remain disabled. The kernel has always disabled any check hash functions that it does not support, so as more types of check hashes are added, we will get a non-surprising result. Specifically if filesystems get moved to kernels supporting fewer of the check hashes, those that are not supported will be disabled. If the filesystem is moved back to a kernel with more of the check-hashes available and fsck is run interactively to rebuild them, then their checking will resume. Otherwise just the smaller subset will be checked. A side effect of this commit is that filesystems running with cylinder-group check hashes will stop having them checked until fsck is run to re-enable them (since none of them currently have the FS_METACKHASH flag set). So, if you want check hashes enabled on your filesystems after booting a kernel with these changes, you need to run fsck to enable them. Any newly created filesystems will have check hashes enabled. If in doubt as to whether you have check hashes emabled, run dumpfs and look at the list of enabled flags at the end of the superblock details. Modified: head/sbin/dumpfs/dumpfs.c head/sbin/fsck_ffs/pass5.c head/sbin/newfs/mkfs.c head/sys/ufs/ffs/ffs_vfsops.c head/sys/ufs/ffs/fs.h Modified: head/sbin/dumpfs/dumpfs.c == --- head/sbin/dumpfs/dumpfs.c Thu Feb 8 22:59:51 2018(r329050) +++ head/sbin/dumpfs/dumpfs.c Thu Feb 8 23:06:58 2018(r329051) @@ -257,9 +257,9 @@ dumpfs(const char *name) if (fsflags & FS_DOSOFTDEP) printf("soft-updates%s ", (fsflags & FS_SUJ) ? "+journal" : ""); if (fsflags & FS_NEEDSFSCK) - printf("needs fsck run "); + printf("needs-fsck-run "); if (fsflags & FS_INDEXDIRS) - printf("indexed directories "); + printf("indexed-directories "); if (fsflags & FS_ACLS) printf("acls "); if (fsflags & FS_MULTILABEL) @@ -267,31 +267,33 @@ dumpfs(const char *name) if (fsflags & FS_GJOURNAL) printf("gjournal "); if (fsflags & FS_FLAGS_UPDATED) - printf("fs_flags expanded "); + printf("fs_flags-expanded "); if (fsflags & FS_NFS4ACLS) printf("nfsv4acls "); if (fsflags & FS_TRIM) printf("trim "); - fsflags &= ~(FS_UNCLEAN | FS_DOSOFTDEP | FS_NEEDSFSCK | FS_INDEXDIRS | + fsflags &= ~(FS_UNCLEAN | FS_DOSOFTDEP | FS_NEEDSFSCK | FS_METACKHASH | FS_ACLS | FS_MULTILABEL | FS_GJOURNAL | FS_FLAGS_UPDATED | -FS_NFS4ACLS | FS_SUJ | FS_TRIM); +FS_NFS4ACLS | FS_SUJ | FS_TRIM | FS_INDEXDIRS); if
svn commit: r329058 - in head/sys: kern vm
Author: glebius Date: Fri Feb 9 04:45:39 2018 New Revision: 329058 URL: https://svnweb.freebsd.org/changeset/base/329058 Log: Fix boot_pages exhaustion on machines with many domains and cores, where size of UMA zone allocation is greater than page size. In this case zone of zones can not use UMA_MD_SMALL_ALLOC, and we need to postpone switch off of this zone from startup_alloc() until full launch of VM. o Always supply number of VM zones to uma_startup_count(). On machines with UMA_MD_SMALL_ALLOC ignore it completely, unless zsize goes over a page. In the latter case account VM zones for number of allocations from the zone of zones. o Rewrite startup_alloc() so that it will immediately switch off from itself any zone that is already capable of running real alloc. In worst case scenario we may leak a single page here. See comment in uma_startup_count(). o Hardcode call to uma_startup2() into vm_mem_init(). Otherwise some extra SYSINITs, e.g. vm_page_init() may sneak in before. o While here, remove uma_boot_pages_mtx. With recent changes to boot pages calculation, we are guaranteed to use all of the boot_pages in the early single threaded stage. Reported & tested by: mav Modified: head/sys/kern/kern_malloc.c head/sys/vm/uma_core.c head/sys/vm/vm_init.c head/sys/vm/vm_page.c Modified: head/sys/kern/kern_malloc.c == --- head/sys/kern/kern_malloc.c Fri Feb 9 03:07:12 2018(r329057) +++ head/sys/kern/kern_malloc.c Fri Feb 9 04:45:39 2018(r329058) @@ -96,8 +96,6 @@ __FBSDID("$FreeBSD$"); dtrace_malloc_probe_func_t dtrace_malloc_probe; #endif -extern voiduma_startup2(void); - #if defined(INVARIANTS) || defined(MALLOC_MAKE_FAILURES) ||\ defined(DEBUG_MEMGUARD) || defined(DEBUG_REDZONE) #defineMALLOC_DEBUG1 @@ -928,8 +926,6 @@ mallocinit(void *dummy) mtx_init(_mtx, "malloc", NULL, MTX_DEF); kmeminit(); - - uma_startup2(); if (kmem_zmax < PAGE_SIZE || kmem_zmax > KMEM_ZMAX) kmem_zmax = KMEM_ZMAX; Modified: head/sys/vm/uma_core.c == --- head/sys/vm/uma_core.c Fri Feb 9 03:07:12 2018(r329057) +++ head/sys/vm/uma_core.c Fri Feb 9 04:45:39 2018(r329058) @@ -134,13 +134,10 @@ static struct rwlock_padalign __exclusive_cache_line u /* * Pointer and counter to pool of pages, that is preallocated at - * startup to bootstrap UMA. Early zones continue to use the pool - * until it is depleted, so allocations may happen after boot, thus - * we need a mutex to protect it. + * startup to bootstrap UMA. */ static char *bootmem; static int boot_pages; -static struct mtx uma_boot_pages_mtx; static struct sx uma_drain_lock; @@ -1081,37 +1078,46 @@ startup_alloc(uma_zone_t zone, vm_size_t bytes, int do int pages; keg = zone_first_keg(zone); - pages = howmany(bytes, PAGE_SIZE); - KASSERT(pages > 0, ("startup_alloc can't reserve 0 pages\n")); /* -* Check our small startup cache to see if it has pages remaining. +* If we are in BOOT_BUCKETS or higher, than switch to real +* allocator. Zones with page sized slabs switch at BOOT_PAGEALLOC. */ - mtx_lock(_boot_pages_mtx); - if (pages <= boot_pages) { -#ifdef DIAGNOSTIC - printf("%s from \"%s\", %d boot pages left\n", __func__, - zone->uz_name, boot_pages); + switch (booted) { + case BOOT_COLD: + case BOOT_STRAPPED: + break; + case BOOT_PAGEALLOC: + if (keg->uk_ppera > 1) + break; + case BOOT_BUCKETS: + case BOOT_RUNNING: +#ifdef UMA_MD_SMALL_ALLOC + keg->uk_allocf = (keg->uk_ppera > 1) ? + page_alloc : uma_small_alloc; +#else + keg->uk_allocf = page_alloc; #endif - mem = bootmem; - boot_pages -= pages; - bootmem += pages * PAGE_SIZE; - mtx_unlock(_boot_pages_mtx); - *pflag = UMA_SLAB_BOOT; - return (mem); + return keg->uk_allocf(zone, bytes, domain, pflag, wait); } - mtx_unlock(_boot_pages_mtx); - if (booted < BOOT_PAGEALLOC) - panic("UMA zone \"%s\": Increase vm.boot_pages", zone->uz_name); + /* -* Now that we've booted reset these users to their real allocator. +* Check our small startup cache to see if it has pages remaining. */ -#ifdef UMA_MD_SMALL_ALLOC - keg->uk_allocf = (keg->uk_ppera > 1) ? page_alloc : uma_small_alloc; -#else - keg->uk_allocf = page_alloc; + pages = howmany(bytes,
svn commit: r329050 - in head/stand: . userboot/userboot
Author: imp Date: Thu Feb 8 22:59:51 2018 New Revision: 329050 URL: https://svnweb.freebsd.org/changeset/base/329050 Log: Fix build of userboot.so Since it's not possible to unset a variable easily, create a new variable 'PIC' to signal that we are creating a shared object that we want to install. defs.mk refains from defining NO_PIC and ITNERALLIB when PIC is defined. This unbreaks userboot.so building. Modified: head/stand/defs.mk head/stand/userboot/userboot/Makefile Modified: head/stand/defs.mk == --- head/stand/defs.mk Thu Feb 8 22:38:39 2018(r329049) +++ head/stand/defs.mk Thu Feb 8 22:59:51 2018(r329050) @@ -10,9 +10,11 @@ __BOOT_DEFS_MK__=${MFILE} MK_CTF=no MK_SSP=no MK_PROFILE=no -NO_PIC= MAN= +.if !defined(PIC) +NO_PIC= INTERNALLIB= +.endif BOOTSRC= ${SRCTOP}/stand EFISRC=${BOOTSRC}/efi Modified: head/stand/userboot/userboot/Makefile == --- head/stand/userboot/userboot/Makefile Thu Feb 8 22:38:39 2018 (r329049) +++ head/stand/userboot/userboot/Makefile Thu Feb 8 22:59:51 2018 (r329050) @@ -4,6 +4,7 @@ LOADER_MSDOS_SUPPORT?= yes LOADER_UFS_SUPPORT?= yes LOADER_CD9660_SUPPORT?=no LOADER_EXT2FS_SUPPORT?=no +PIC=yes .include ___ 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: r329053 - head/sys/netinet6
Author: vangyzen Date: Fri Feb 9 00:13:05 2018 New Revision: 329053 URL: https://svnweb.freebsd.org/changeset/base/329053 Log: Fix ICMPv6 redirects icmp6_redirect_input() validates that a redirect packet came from the current gateway for the respective destination. To do this, it compares the source address, which has an embedded scope zone id, to the next-hop address, which does not. If the address is link-local, which should be the case, the comparison fails and the redirect is ignored. Insert the scope zone id into the next-hop address so the comparison is accurate. Unsurprisingly, this fixes 35 UNH IPv6 conformance test cases. Submitted by: Farrell Woods(initial revision) Reviewed by: ae melifaro dab MFC after:1 week Relnotes: yes Sponsored by: Dell EMC Differential Revision:https://reviews.freebsd.org/D14254 Modified: head/sys/netinet6/icmp6.c Modified: head/sys/netinet6/icmp6.c == --- head/sys/netinet6/icmp6.c Thu Feb 8 23:14:24 2018(r329052) +++ head/sys/netinet6/icmp6.c Fri Feb 9 00:13:05 2018(r329053) @@ -2305,6 +2305,14 @@ icmp6_redirect_input(struct mbuf *m, int off) goto bad; } + /* +* Embed scope zone id into next hop address, since +* fib6_lookup_nh_basic() returns address without embedded +* scope zone id. +*/ + if (in6_setscope(_addr, m->m_pkthdr.rcvif, NULL)) + goto freeit; + if (IN6_ARE_ADDR_EQUAL(, _addr) == 0) { nd6log((LOG_ERR, "ICMP6 redirect rejected; " ___ 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: r329016 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: avg Date: Thu Feb 8 13:22:40 2018 New Revision: 329016 URL: https://svnweb.freebsd.org/changeset/base/329016 Log: remove a duplicate assignment There should be no functional change. MFC after:1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Feb 8 09:24:23 2018(r329015) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Feb 8 13:22:40 2018(r329016) @@ -4700,7 +4700,6 @@ zfs_putpages(struct vnode *vp, vm_page_t *ma, size_t l } if (zp->z_blksz < PAGE_SIZE) { - i = 0; for (i = 0; len > 0; off += tocopy, len -= tocopy, i++) { tocopy = len > PAGE_SIZE ? PAGE_SIZE : len; va = zfs_map_page(ma[i], ); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r329018 - in head: lib/libc/rpc usr.sbin/ypserv
Author: pfg Date: Thu Feb 8 14:53:34 2018 New Revision: 329018 URL: https://svnweb.freebsd.org/changeset/base/329018 Log: su_data: correct macro expansion. Protect su_data() users from strange macro expansion. Obtained from:linux libtirpc Modified: head/lib/libc/rpc/svc_dg.c head/usr.sbin/ypserv/yp_svc_udp.c Modified: head/lib/libc/rpc/svc_dg.c == --- head/lib/libc/rpc/svc_dg.c Thu Feb 8 14:39:07 2018(r329017) +++ head/lib/libc/rpc/svc_dg.c Thu Feb 8 14:53:34 2018(r329018) @@ -68,7 +68,7 @@ __FBSDID("$FreeBSD$"); #include "rpc_com.h" #include "mt_misc.h" -#definesu_data(xprt) ((struct svc_dg_data *)(xprt->xp_p2)) +#definesu_data(xprt) ((struct svc_dg_data *)((xprt)->xp_p2)) #definerpc_buffer(xprt) ((xprt)->xp_p1) #ifndef MAX Modified: head/usr.sbin/ypserv/yp_svc_udp.c == --- head/usr.sbin/ypserv/yp_svc_udp.c Thu Feb 8 14:39:07 2018 (r329017) +++ head/usr.sbin/ypserv/yp_svc_udp.c Thu Feb 8 14:53:34 2018 (r329018) @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include "yp_extern.h" -#define su_data(xprt) ((struct svc_dg_data *)(xprt->xp_p2)) +#definesu_data(xprt) ((struct svc_dg_data *)((xprt)->xp_p2)) /* * We need to be able to manually set the transaction ID in the ___ 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"