svn commit: r356118 - in head/sys: conf contrib/ncsw/Peripherals/BM contrib/ncsw/Peripherals/QM
Author: bdragon Date: Fri Dec 27 05:01:13 2019 New Revision: 356118 URL: https://svnweb.freebsd.org/changeset/base/356118 Log: [PowerPC] Clang powerpcspe build fixes * Fix a couple of format errors. * Add some extra compiler flags needed to force clang to build SPE code. (These are temporary until the target triple is fixed) Modified: head/sys/conf/Makefile.powerpc head/sys/contrib/ncsw/Peripherals/BM/bm.h head/sys/contrib/ncsw/Peripherals/QM/qm.c Modified: head/sys/conf/Makefile.powerpc == --- head/sys/conf/Makefile.powerpc Fri Dec 27 04:52:17 2019 (r356117) +++ head/sys/conf/Makefile.powerpc Fri Dec 27 05:01:13 2019 (r356118) @@ -37,7 +37,9 @@ INCLUDES+= -I$S/contrib/libfdt .if "${MACHINE_ARCH}" == "powerpcspe" # Force __SPE__, since the builtin will be removed later with -mno-spe -CFLAGS+= -mabi=spe -D__SPE__ +CFLAGS.gcc+= -mabi=spe -D__SPE__ +CFLAGS.clang+= -mspe -D__SPE__ -m32 +HACK_EXTRA_FLAGS= -shared -m32 -mspe -D__SPE__ .endif CFLAGS+= -msoft-float CFLAGS.gcc+= -Wa,-many Modified: head/sys/contrib/ncsw/Peripherals/BM/bm.h == --- head/sys/contrib/ncsw/Peripherals/BM/bm.h Fri Dec 27 04:52:17 2019 (r356117) +++ head/sys/contrib/ncsw/Peripherals/BM/bm.h Fri Dec 27 05:01:13 2019 (r356118) @@ -395,7 +395,7 @@ static __inline__ uint32_t BmBpidGet(t_Bm *p_Bm, bool size, alignment, "BM BPID MEM"); -KASSERT(ans < UINT32_MAX, ("Oops, %lx > UINT32_MAX!\n", ans)); +KASSERT(ans < UINT32_MAX, ("Oops, %jx > UINT32_MAX!\n", (uintmax_t)ans)); return (uint32_t)ans; } Modified: head/sys/contrib/ncsw/Peripherals/QM/qm.c == --- head/sys/contrib/ncsw/Peripherals/QM/qm.c Fri Dec 27 04:52:17 2019 (r356117) +++ head/sys/contrib/ncsw/Peripherals/QM/qm.c Fri Dec 27 05:01:13 2019 (r356118) @@ -560,7 +560,7 @@ uint32_t QmFqidGet(t_Qm *p_Qm, uint32_t size, uint32_t "QM FQID MEM"); XX_UnlockIntrSpinlock(p_Qm->lock, intFlags); -KASSERT(ans < UINT32_MAX, ("Oops, %lx > UINT32_MAX!\n", ans)); +KASSERT(ans < UINT32_MAX, ("Oops, %jx > UINT32_MAX!\n", (uintmax_t)ans)); return (uint32_t)ans; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r356117 - head/sys/kern
Author: jhibbits Date: Fri Dec 27 04:52:17 2019 New Revision: 356117 URL: https://svnweb.freebsd.org/changeset/base/356117 Log: Fix the build from r356113. Types had changed from when the patch was first created, and a final build was not done pre-commit. Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c == --- head/sys/kern/imgact_elf.c Fri Dec 27 04:42:03 2019(r356116) +++ head/sys/kern/imgact_elf.c Fri Dec 27 04:52:17 2019(r356117) @@ -1353,7 +1353,7 @@ ret: #defineOLD_AT_COUNT27 /* Count of defined aux entry types. */ static int -__elfN(freebsd_fixup_old_auxargs)(register_t **stack_base, +__elfN(freebsd_fixup_old_auxargs)(uintptr_t *stack_base, struct image_params *imgp) { Elf_Auxargs *args = (Elf_Auxargs *)imgp->auxargs; @@ -1414,7 +1414,7 @@ __elfN(freebsd_fixup_old_auxargs)(register_t **stack_b base--; if (suword(base, imgp->args->argc) == -1) return (EFAULT); - *stack_base = (register_t *)base; + *stack_base = (uintptr_t)base; return (0); } #endif /* __powerpc__ */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r356116 - head
Author: jhibbits Date: Fri Dec 27 04:42:03 2019 New Revision: 356116 URL: https://svnweb.freebsd.org/changeset/base/356116 Log: Add a note to UPDATING on the move to clang for powerpc* Modified: head/UPDATING Modified: head/UPDATING == --- head/UPDATING Fri Dec 27 04:11:14 2019(r356115) +++ head/UPDATING Fri Dec 27 04:42:03 2019(r356116) @@ -27,6 +27,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: "ln -s 'abort:false,junk:false' /etc/malloc.conf".) 20191226: + Clang/LLVM is now the default compiler for all powerpc architectures. + LLD is now the default linker for powerpc64. The change for powerpc64 + also includes a change to the ELFv2 ABI, incompatible with the existing + ABI. + +20191226: Kernel-loadable random(4) modules are no longer unloadable. 20191222: ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r356115 - head/sys/dev/gpio
Author: brd Date: Fri Dec 27 04:11:14 2019 New Revision: 356115 URL: https://svnweb.freebsd.org/changeset/base/356115 Log: [gpioths] Fix GPIOTHS_DEBUG Chase the removal of dev from gpioths_dht_readbytes() in r355540. Reviewed by: ian Approved by: will (mentor) Differential Revision:https://reviews.freebsd.org/D22926 Modified: head/sys/dev/gpio/gpioths.c Modified: head/sys/dev/gpio/gpioths.c == --- head/sys/dev/gpio/gpioths.c Fri Dec 27 04:07:51 2019(r356114) +++ head/sys/dev/gpio/gpioths.c Fri Dec 27 04:11:14 2019(r356115) @@ -220,10 +220,10 @@ gpioths_dht_readbytes(struct gpioths_softc *sc) #ifdef GPIOTHS_DEBUG /* Debug bits */ for (i = 0; i < GPIOTHS_DHT_CYCLES; i++) - device_printf(dev, "%d: %d %d\n", i, calibrations[i], + device_printf(sc->dev, "%d: %d %d\n", i, calibrations[i], intervals[i]); - device_printf(dev, "len=%d, data=%x, crc=%x/%x\n", avglen, value, crc, + device_printf(sc->dev, "len=%d, data=%x, crc=%x/%x\n", avglen, value, crc, calc); #endif /* GPIOTHS_DEBUG */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r356114 - head/sys/conf
Author: bdragon Date: Fri Dec 27 04:07:51 2019 New Revision: 356114 URL: https://svnweb.freebsd.org/changeset/base/356114 Log: [PowerPC] Switch to PIC kernel modules on powerpc* To improve reliability of kernel modules after the clang switch, switch to -fPIC when building for now. This bypasses some limitations to the way clang and LLD handle relocations, and is a more robustly tested compilation regime than the "static shared object" mode that we were previously attempting to convince the compiler stack to use. The kernel linker was recently augmented to be able to handle this mode. Reviewed by: jhibbits Differential Revision:https://reviews.freebsd.org/D22798 Modified: head/sys/conf/kmod.mk Modified: head/sys/conf/kmod.mk == --- head/sys/conf/kmod.mk Fri Dec 27 04:07:03 2019(r356113) +++ head/sys/conf/kmod.mk Fri Dec 27 04:07:51 2019(r356114) @@ -132,7 +132,8 @@ CFLAGS+=${DEBUG_FLAGS} CFLAGS+= -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer .endif -.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "riscv" +.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "riscv" || \ +${MACHINE_CPUARCH} == "powerpc" CFLAGS+= -fPIC .endif ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r356113 - in head: libexec/rtld-elf sys/kern sys/sys
Author: jhibbits Date: Fri Dec 27 04:07:03 2019 New Revision: 356113 URL: https://svnweb.freebsd.org/changeset/base/356113 Log: Eliminate the last MI difference in AT_* definitions (for powerpc). Summary: As a transition aide, implement an alternative elfN_freebsd_fixup which is called for old powerpc binaries. Similarly, add a translation to rtld to convert old values to new ones (as expected by a new rtld). Translation of old<->new values is incomplete, but sufficient to allow an installworld of a new userspace from an old one when a new kernel is running. Test Plan: Someone needs to see how a new kernel/rtld/libc works with an old binary. If if works we can probalby ship this. If not we probalby need some more compat bits. Submitted by: brooks Reviewed by: jhibbits Differential Revision:https://reviews.freebsd.org/D20799 Modified: head/libexec/rtld-elf/rtld.c head/sys/kern/imgact_elf.c head/sys/sys/elf_common.h head/sys/sys/param.h Modified: head/libexec/rtld-elf/rtld.c == --- head/libexec/rtld-elf/rtld.cFri Dec 27 04:00:04 2019 (r356112) +++ head/libexec/rtld-elf/rtld.cFri Dec 27 04:07:03 2019 (r356113) @@ -382,6 +382,9 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entr caddr_t imgentry; char buf[MAXPATHLEN]; int argc, fd, i, phnum, rtld_argc; +#ifdef __powerpc__ +int old_auxv_format = 1; +#endif bool dir_enable, explicit_fd, search_in_path; /* @@ -407,7 +410,28 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entr for (auxp = aux; auxp->a_type != AT_NULL; auxp++) { if (auxp->a_type < AT_COUNT) aux_info[auxp->a_type] = auxp; +#ifdef __powerpc__ + if (auxp->a_type == 23) /* AT_STACKPROT */ + old_auxv_format = 0; +#endif } + +#ifdef __powerpc__ +if (old_auxv_format) { + /* Remap from old-style auxv numbers. */ + aux_info[23] = aux_info[21];/* AT_STACKPROT */ + aux_info[21] = aux_info[19];/* AT_PAGESIZESLEN */ + aux_info[19] = aux_info[17];/* AT_NCPUS */ + aux_info[17] = aux_info[15];/* AT_CANARYLEN */ + aux_info[15] = aux_info[13];/* AT_EXECPATH */ + aux_info[13] = NULL;/* AT_GID */ + + aux_info[20] = aux_info[18];/* AT_PAGESIZES */ + aux_info[18] = aux_info[16];/* AT_OSRELDATE */ + aux_info[16] = aux_info[14];/* AT_CANARY */ + aux_info[14] = NULL;/* AT_EGID */ +} +#endif /* Initialize and relocate ourselves. */ assert(aux_info[AT_BASE] != NULL); Modified: head/sys/kern/imgact_elf.c == --- head/sys/kern/imgact_elf.c Fri Dec 27 04:00:04 2019(r356112) +++ head/sys/kern/imgact_elf.c Fri Dec 27 04:07:03 2019(r356113) @@ -1323,6 +1323,102 @@ ret: #definesuword __CONCAT(suword, __ELF_WORD_SIZE) +#ifdef __powerpc__ +#defineOLD_AT_NULL AT_NULL +#defineOLD_AT_IGNORE AT_IGNORE +#defineOLD_AT_EXECFD AT_EXECFD +#defineOLD_AT_PHDR AT_PHDR +#defineOLD_AT_PHENTAT_PHENT +#defineOLD_AT_PHNUMAT_PHNUM +#defineOLD_AT_PAGESZ AT_PAGESZ +#defineOLD_AT_BASE AT_BASE +#defineOLD_AT_FLAGSAT_FLAGS +#defineOLD_AT_ENTRYAT_ENTRY +#defineOLD_AT_NOTELF AT_NOTELF +#defineOLD_AT_UID AT_UID +#defineOLD_AT_EUID AT_EUID +#defineOLD_AT_EXECPATH 13 +#defineOLD_AT_CANARY 14 +#defineOLD_AT_CANARYLEN15 +#defineOLD_AT_OSRELDATE16 +#defineOLD_AT_NCPUS17 +#defineOLD_AT_PAGESIZES18 +#defineOLD_AT_PAGESIZESLEN 19 +#defineOLD_AT_STACKPROT21 +#defineOLD_AT_TIMEKEEP AT_TIMEKEEP +#defineOLD_AT_EHDRFLAGSAT_EHDRFLAGS +#defineOLD_AT_HWCAPAT_HWCAP +#defineOLD_AT_HWCAP2 AT_HWCAP2 + +#defineOLD_AT_COUNT27 /* Count of defined aux entry types. */ + +static int +__elfN(freebsd_fixup_old_auxargs)(register_t **stack_base, +struct image_params *imgp) +{ + Elf_Auxargs *args = (Elf_Auxargs *)imgp->auxargs; + Elf_Auxinfo *argarray, *pos; + Elf_Addr *base, *auxbase; + int error; + + base = (Elf_Addr *)*stack_base; + auxbase = base + imgp->args->argc + 1 + imgp->args->envc + 1; + argarray = pos = malloc(OLD_AT_COUNT * sizeof(*pos), M_TEMP, + M_WAITOK | M_ZERO); + + if (args->execfd != -1) + AUXARGS_ENTRY(pos, OLD_AT_EXECFD, args->execfd); + AUXARGS_ENTRY(pos, OLD_AT_PHDR, args->phdr); + AUXARGS_ENTRY(pos, OLD_AT_PHENT,
svn commit: r356112 - in head/contrib/llvm-project: clang/lib/Basic/Targets llvm/lib/Target/PowerPC
Author: jhibbits Date: Fri Dec 27 04:00:04 2019 New Revision: 356112 URL: https://svnweb.freebsd.org/changeset/base/356112 Log: [PowerPC64] Starting from FreeBSD 13.0, default to ELFv2 ABI This changes the LLVM default powerpc64 ABI to ELFv2, if target OS is FreeBSD >= 13.0 This will also be sent upstream. Submitted by: alfredo.junior_eldorado.org.br Reviewed by: dim, luporl Relnotes: YES Differential Revision:https://reviews.freebsd.org/D20383 Modified: head/contrib/llvm-project/clang/lib/Basic/Targets/PPC.h head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp Modified: head/contrib/llvm-project/clang/lib/Basic/Targets/PPC.h == --- head/contrib/llvm-project/clang/lib/Basic/Targets/PPC.h Fri Dec 27 03:54:27 2019(r356111) +++ head/contrib/llvm-project/clang/lib/Basic/Targets/PPC.h Fri Dec 27 04:00:04 2019(r356112) @@ -375,12 +375,29 @@ class LLVM_LIBRARY_VISIBILITY PPC64TargetInfo : public IntMaxType = SignedLong; Int64Type = SignedLong; +if (Triple.getEnvironment() != llvm::Triple::UnknownEnvironment) { + switch (Triple.getEnvironment()){ +case llvm::Triple::ELFv1: + ABI = "elfv1"; + break; + default: + ABI = "elfv2"; + break; + } +} else { + if ((Triple.getOS() == llvm::Triple::FreeBSD) && + (Triple.getOSMajorVersion() < 13)) { +ABI = "elfv1"; + } else { +ABI = "elfv2"; + } +} + + if ((Triple.getArch() == llvm::Triple::ppc64le)) { resetDataLayout("e-m:e-i64:64-n32:64"); - ABI = "elfv2"; } else { resetDataLayout("E-m:e-i64:64-n32:64"); - ABI = Triple.getEnvironment() == llvm::Triple::ELFv2 ? "elfv2" : "elfv1"; } if (Triple.getOS() == llvm::Triple::AIX) Modified: head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp == --- head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp Fri Dec 27 03:54:27 2019(r356111) +++ head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp Fri Dec 27 04:00:04 2019(r356112) @@ -209,6 +209,20 @@ static PPCTargetMachine::PPCABI computeTargetABI(const if (TT.isMacOSX()) return PPCTargetMachine::PPC_ABI_UNKNOWN; + if (TT.isOSFreeBSD()) { +switch (TT.getArch()) { +case Triple::ppc64le: +case Triple::ppc64: + if (TT.getOSMajorVersion() >= 13) +return PPCTargetMachine::PPC_ABI_ELFv2; + else +return PPCTargetMachine::PPC_ABI_ELFv1; +case Triple::ppc: +default: + return PPCTargetMachine::PPC_ABI_UNKNOWN; +} + } + switch (TT.getArch()) { case Triple::ppc64le: return PPCTargetMachine::PPC_ABI_ELFv2; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r356111 - in head/share: man/man7 mk
Author: jhibbits Date: Fri Dec 27 03:54:27 2019 New Revision: 356111 URL: https://svnweb.freebsd.org/changeset/base/356111 Log: Use LLVM as default toolchain for all PowerPC targets This enables LLVM as the default compiler for powerpc, powerpc64, and powerpcspe, as well as LLD as the default linker for powerpc64. LLD is not yet ready for prime time for powerpc and powerpcspe, but work is continuing on it. Submitted by: alfredo.junior_eldorado.org.br Relnotes: YES Differential Revision:https://reviews.freebsd.org/D20378 Modified: head/share/man/man7/arch.7 head/share/mk/src.opts.mk Modified: head/share/man/man7/arch.7 == --- head/share/man/man7/arch.7 Fri Dec 27 03:00:18 2019(r356110) +++ head/share/man/man7/arch.7 Fri Dec 27 03:54:27 2019(r356111) @@ -323,9 +323,9 @@ This table shows the default tool chain for each archi .It mips64elTa GCC 4.2.1 Ta GNU ld 2.17.50 .It mips64elhf Ta GCC 4.2.1 Ta GNU ld 2.17.50 .It mips64hfTa GCC 4.2.1 Ta GNU ld 2.17.50 -.It powerpc Ta GCC 4.2.1 Ta GNU ld 2.17.50 -.It powerpcspe Ta GCC 4.2.1 Ta GNU ld 2.17.50 -.It powerpc64 Ta GCC 4.2.1 Ta GNU ld 2.17.50 +.It powerpc Ta Clang Ta GNU ld 2.17.50 +.It powerpcspe Ta Clang Ta GNU ld 2.17.50 +.It powerpc64 Ta Clang Ta lld .It riscv64 Ta GCC(1)Ta GNU ld(1) .It riscv64sf Ta GCC(1)Ta GNU ld(1) .It sparc64 Ta GCC 4.2.1 Ta GNU ld 2.17.50 @@ -339,7 +339,7 @@ Any CPU architectures not migrated by then may be removed from the tree after that date. Unless the make variable .Dv MAKE_OBSOLETE_GCC -is defined, make universe will not build mips, powerpc, nor sparc64 +is defined, make universe will not build mips or sparc64 architectures unless the xtoolchain binaries have been installed for the architecture. .Ss MACHINE_ARCH vs MACHINE_CPUARCH vs MACHINE Modified: head/share/mk/src.opts.mk == --- head/share/mk/src.opts.mk Fri Dec 27 03:00:18 2019(r356110) +++ head/share/mk/src.opts.mk Fri Dec 27 03:54:27 2019(r356111) @@ -305,7 +305,8 @@ __DEFAULT_NO_OPTIONS+=LLVM_TARGET_BPF # build Clang without using an external compiler. .if ${COMPILER_FEATURES:Mc++11} && (${__T} == "aarch64" || \ -${__T} == "amd64" || ${__TT} == "arm" || ${__T} == "i386") +${__T} == "amd64" || ${__TT} == "arm" || ${__T} == "i386" || \ +${__TT} == "powerpc") # Clang is enabled, and will be installed as the default /usr/bin/cc. __DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_IS_CC LLD __DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX GPL_DTC @@ -328,13 +329,13 @@ BROKEN_OPTIONS+=BINUTILS BINUTILS_BOOTSTRAP GCC GCC_BO BROKEN_OPTIONS+=OFED .endif .if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386" || \ -${__T:Mriscv*} != "" || ${__TT} == "mips" +${__TT} == "powerpc" || ${__T:Mriscv*} != "" || ${__TT} == "mips" __DEFAULT_YES_OPTIONS+=LLVM_LIBUNWIND .else __DEFAULT_NO_OPTIONS+=LLVM_LIBUNWIND .endif .if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "armv6" || \ -${__T} == "armv7" || ${__T} == "i386" +${__T} == "armv7" || ${__T} == "i386" || ${__T} == "powerpc64" __DEFAULT_YES_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD .else __DEFAULT_NO_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r356110 - in stable: 11/sys/arm/broadcom/bcm2835 11/sys/arm/freescale/imx 11/sys/arm/ti/am335x 11/sys/arm/versatile 11/sys/dev/terasic/mtl 11/sys/powerpc/ofw 12/sys/arm/broadcom/bcm2835...
Author: kevans Date: Fri Dec 27 03:00:18 2019 New Revision: 356110 URL: https://svnweb.freebsd.org/changeset/base/356110 Log: MFC r355936, r356045: remove unused kbd drivers r355936: Kill off dummy kbd drivers As far as I can tell, these are an artifact of times when linker sets couldn't be empty, otherwise the kernel build would fail due to unresolved symbols. hselasky fixed this in r268138, and I've audited the kbd portions to make sure nothing would blow up due to the empty linker set and successfully compiled+ran a kernel with no keyboard support at all. Kill them off now since they're no longer required. r356045: terasic_mtl: kill off final dummy keyboard driver The rest were removed in r355936, which speculated that the cause of this phenomenon was due to an inability to have an empty linker set. The comment included with this one shows that this was, in fact, not the reason. Regardless, syscons no longer seems to have an issue with not having any keyboard drivers and in-fact ignores the keyboard probe anyways. Modified: stable/12/sys/arm/broadcom/bcm2835/bcm2835_fb.c stable/12/sys/arm/freescale/imx/imx51_ipuv3.c stable/12/sys/arm/ti/am335x/am335x_lcd_syscons.c stable/12/sys/arm/versatile/versatile_clcd.c stable/12/sys/dev/terasic/mtl/terasic_mtl_syscons.c stable/12/sys/powerpc/ofw/ofw_syscons.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_fb.c stable/11/sys/arm/freescale/imx/imx51_ipuv3.c stable/11/sys/arm/ti/am335x/am335x_lcd_syscons.c stable/11/sys/arm/versatile/versatile_clcd.c stable/11/sys/dev/terasic/mtl/terasic_mtl_syscons.c stable/11/sys/powerpc/ofw/ofw_syscons.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/arm/broadcom/bcm2835/bcm2835_fb.c == --- stable/12/sys/arm/broadcom/bcm2835/bcm2835_fb.c Fri Dec 27 01:50:16 2019(r356109) +++ stable/12/sys/arm/broadcom/bcm2835/bcm2835_fb.c Fri Dec 27 03:00:18 2019(r356110) @@ -850,22 +850,3 @@ bcmfb_putm(video_adapter_t *adp, int x, int y, uint8_t return (0); } - -/* - * Define a stub keyboard driver in case one hasn't been - * compiled into the kernel - */ -#include -#include - -static int dummy_kbd_configure(int flags); - -keyboard_switch_t bcmdummysw; - -static int -dummy_kbd_configure(int flags) -{ - - return (0); -} -KEYBOARD_DRIVER(bcmdummy, bcmdummysw, dummy_kbd_configure); Modified: stable/12/sys/arm/freescale/imx/imx51_ipuv3.c == --- stable/12/sys/arm/freescale/imx/imx51_ipuv3.c Fri Dec 27 01:50:16 2019(r356109) +++ stable/12/sys/arm/freescale/imx/imx51_ipuv3.c Fri Dec 27 03:00:18 2019(r356110) @@ -878,22 +878,3 @@ ipu3fb_putm(video_adapter_t *adp, int x, int y, uint8_ return (0); } - -/* - * Define a stub keyboard driver in case one hasn't been - * compiled into the kernel - */ -#include -#include - -static int dummy_kbd_configure(int flags); - -keyboard_switch_t ipu3dummysw; - -static int -dummy_kbd_configure(int flags) -{ - - return (0); -} -KEYBOARD_DRIVER(ipu3dummy, ipu3dummysw, dummy_kbd_configure); Modified: stable/12/sys/arm/ti/am335x/am335x_lcd_syscons.c == --- stable/12/sys/arm/ti/am335x/am335x_lcd_syscons.cFri Dec 27 01:50:16 2019(r356109) +++ stable/12/sys/arm/ti/am335x/am335x_lcd_syscons.cFri Dec 27 03:00:18 2019(r356110) @@ -770,22 +770,3 @@ int am335x_lcd_syscons_setup(vm_offset_t vaddr, vm_pad return (0); } - -/* - * Define a stub keyboard driver in case one hasn't been - * compiled into the kernel - */ -#include -#include - -static int dummy_kbd_configure(int flags); - -keyboard_switch_t am335x_dummysw; - -static int -dummy_kbd_configure(int flags) -{ - - return (0); -} -KEYBOARD_DRIVER(am335x_dummy, am335x_dummysw, dummy_kbd_configure); Modified: stable/12/sys/arm/versatile/versatile_clcd.c == --- stable/12/sys/arm/versatile/versatile_clcd.cFri Dec 27 01:50:16 2019(r356109) +++ stable/12/sys/arm/versatile/versatile_clcd.cFri Dec 27 03:00:18 2019(r356110) @@ -920,22 +920,3 @@ versatilefb_putm(video_adapter_t *adp, int x, int y, u return (0); } - -/* - * Define a stub keyboard driver in case one hasn't been - * compiled into the kernel - */ -#include -#include - -static int dummy_kbd_configure(int flags); - -keyboard_switch_t bcmdummysw; - -static int -dummy_kbd_configure(int flags) -{ - - return (0); -} -KEYBOARD_DRIVER(bcmdummy, bcmdummysw, dummy_kbd_configure); Modified:
svn commit: r356110 - in stable: 11/sys/arm/broadcom/bcm2835 11/sys/arm/freescale/imx 11/sys/arm/ti/am335x 11/sys/arm/versatile 11/sys/dev/terasic/mtl 11/sys/powerpc/ofw 12/sys/arm/broadcom/bcm2835...
Author: kevans Date: Fri Dec 27 03:00:18 2019 New Revision: 356110 URL: https://svnweb.freebsd.org/changeset/base/356110 Log: MFC r355936, r356045: remove unused kbd drivers r355936: Kill off dummy kbd drivers As far as I can tell, these are an artifact of times when linker sets couldn't be empty, otherwise the kernel build would fail due to unresolved symbols. hselasky fixed this in r268138, and I've audited the kbd portions to make sure nothing would blow up due to the empty linker set and successfully compiled+ran a kernel with no keyboard support at all. Kill them off now since they're no longer required. r356045: terasic_mtl: kill off final dummy keyboard driver The rest were removed in r355936, which speculated that the cause of this phenomenon was due to an inability to have an empty linker set. The comment included with this one shows that this was, in fact, not the reason. Regardless, syscons no longer seems to have an issue with not having any keyboard drivers and in-fact ignores the keyboard probe anyways. Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_fb.c stable/11/sys/arm/freescale/imx/imx51_ipuv3.c stable/11/sys/arm/ti/am335x/am335x_lcd_syscons.c stable/11/sys/arm/versatile/versatile_clcd.c stable/11/sys/dev/terasic/mtl/terasic_mtl_syscons.c stable/11/sys/powerpc/ofw/ofw_syscons.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/arm/broadcom/bcm2835/bcm2835_fb.c stable/12/sys/arm/freescale/imx/imx51_ipuv3.c stable/12/sys/arm/ti/am335x/am335x_lcd_syscons.c stable/12/sys/arm/versatile/versatile_clcd.c stable/12/sys/dev/terasic/mtl/terasic_mtl_syscons.c stable/12/sys/powerpc/ofw/ofw_syscons.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_fb.c == --- stable/11/sys/arm/broadcom/bcm2835/bcm2835_fb.c Fri Dec 27 01:50:16 2019(r356109) +++ stable/11/sys/arm/broadcom/bcm2835/bcm2835_fb.c Fri Dec 27 03:00:18 2019(r356110) @@ -849,22 +849,3 @@ bcmfb_putm(video_adapter_t *adp, int x, int y, uint8_t return (0); } - -/* - * Define a stub keyboard driver in case one hasn't been - * compiled into the kernel - */ -#include -#include - -static int dummy_kbd_configure(int flags); - -keyboard_switch_t bcmdummysw; - -static int -dummy_kbd_configure(int flags) -{ - - return (0); -} -KEYBOARD_DRIVER(bcmdummy, bcmdummysw, dummy_kbd_configure); Modified: stable/11/sys/arm/freescale/imx/imx51_ipuv3.c == --- stable/11/sys/arm/freescale/imx/imx51_ipuv3.c Fri Dec 27 01:50:16 2019(r356109) +++ stable/11/sys/arm/freescale/imx/imx51_ipuv3.c Fri Dec 27 03:00:18 2019(r356110) @@ -876,22 +876,3 @@ ipu3fb_putm(video_adapter_t *adp, int x, int y, uint8_ return (0); } - -/* - * Define a stub keyboard driver in case one hasn't been - * compiled into the kernel - */ -#include -#include - -static int dummy_kbd_configure(int flags); - -keyboard_switch_t ipu3dummysw; - -static int -dummy_kbd_configure(int flags) -{ - - return (0); -} -KEYBOARD_DRIVER(ipu3dummy, ipu3dummysw, dummy_kbd_configure); Modified: stable/11/sys/arm/ti/am335x/am335x_lcd_syscons.c == --- stable/11/sys/arm/ti/am335x/am335x_lcd_syscons.cFri Dec 27 01:50:16 2019(r356109) +++ stable/11/sys/arm/ti/am335x/am335x_lcd_syscons.cFri Dec 27 03:00:18 2019(r356110) @@ -769,22 +769,3 @@ int am335x_lcd_syscons_setup(vm_offset_t vaddr, vm_pad return (0); } - -/* - * Define a stub keyboard driver in case one hasn't been - * compiled into the kernel - */ -#include -#include - -static int dummy_kbd_configure(int flags); - -keyboard_switch_t am335x_dummysw; - -static int -dummy_kbd_configure(int flags) -{ - - return (0); -} -KEYBOARD_DRIVER(am335x_dummy, am335x_dummysw, dummy_kbd_configure); Modified: stable/11/sys/arm/versatile/versatile_clcd.c == --- stable/11/sys/arm/versatile/versatile_clcd.cFri Dec 27 01:50:16 2019(r356109) +++ stable/11/sys/arm/versatile/versatile_clcd.cFri Dec 27 03:00:18 2019(r356110) @@ -921,22 +921,3 @@ versatilefb_putm(video_adapter_t *adp, int x, int y, u return (0); } - -/* - * Define a stub keyboard driver in case one hasn't been - * compiled into the kernel - */ -#include -#include - -static int dummy_kbd_configure(int flags); - -keyboard_switch_t bcmdummysw; - -static int -dummy_kbd_configure(int flags) -{ - - return (0); -} -KEYBOARD_DRIVER(bcmdummy, bcmdummysw, dummy_kbd_configure); Modified:
svn commit: r356109 - head/sys/vm
Author: jeff Date: Fri Dec 27 01:50:16 2019 New Revision: 356109 URL: https://svnweb.freebsd.org/changeset/base/356109 Log: Fix a pair of bugs introduced in r356002. When we reclaim physical pages we allocate them with VM_ALLOC_NOOBJ which means they are not busy. For now move the busy assert for the new page in vm_page_replace into the public api and out of the private api used by contig reclaim. Fix another issue where we would leak busy if the page could not be removed from pmap. Reported by: pho Discussed with: markj Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c == --- head/sys/vm/vm_page.c Fri Dec 27 01:36:53 2019(r356108) +++ head/sys/vm/vm_page.c Fri Dec 27 01:50:16 2019(r356109) @@ -1751,7 +1751,6 @@ vm_page_replace_hold(vm_page_t mnew, vm_object_t objec bool dropped; VM_OBJECT_ASSERT_WLOCKED(object); - vm_page_assert_xbusied(mnew); vm_page_assert_xbusied(mold); KASSERT(mnew->object == NULL && (mnew->ref_count & VPRC_OBJREF) == 0, ("vm_page_replace: page %p already in object", mnew)); @@ -1795,6 +1794,8 @@ vm_page_replace(vm_page_t mnew, vm_object_t object, vm vm_page_t mold) { + vm_page_assert_xbusied(mnew); + if (vm_page_replace_hold(mnew, object, pindex, mold)) vm_page_free(mold); } @@ -2793,6 +2794,7 @@ retry: */ if (object->ref_count != 0 && !vm_page_try_remove_all(m)) { + vm_page_xunbusy(m); vm_page_free(m_new); error = EBUSY; goto unlock; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r356108 - head/sys/geom/vinum
Author: mav Date: Fri Dec 27 01:36:53 2019 New Revision: 356108 URL: https://svnweb.freebsd.org/changeset/base/356108 Log: Reimplement gvinum orphanization. gvinum was the only GEOM class, using consumer nstart/nend fields. Making it do its own accounting for orphanization purposes allows in perspective to remove burden of that expensive for SMP accounting from GEOM. Also the previous implementation spinned in a tight event loop, waiting for all active BIOs to complete, while the new one knows exactly when it is possible to close the consumer. MFC after:1 month Sponsored by: iXsystems, Inc. Modified: head/sys/geom/vinum/geom_vinum.h head/sys/geom/vinum/geom_vinum_events.c head/sys/geom/vinum/geom_vinum_plex.c head/sys/geom/vinum/geom_vinum_raid5.c head/sys/geom/vinum/geom_vinum_var.h head/sys/geom/vinum/geom_vinum_volume.c Modified: head/sys/geom/vinum/geom_vinum.h == --- head/sys/geom/vinum/geom_vinum.hFri Dec 27 01:12:54 2019 (r356107) +++ head/sys/geom/vinum/geom_vinum.hFri Dec 27 01:36:53 2019 (r356108) @@ -127,6 +127,7 @@ voidgv_post_event(struct gv_softc *, int, void *, voi void gv_worker_exit(struct gv_softc *); struct gv_event *gv_get_event(struct gv_softc *); void gv_remove_event(struct gv_softc *, struct gv_event *); +void gv_drive_done(struct gv_drive *); void gv_drive_tasted(struct gv_softc *, struct g_provider *); void gv_drive_lost(struct gv_softc *, struct gv_drive *); void gv_setup_objects(struct gv_softc *); Modified: head/sys/geom/vinum/geom_vinum_events.c == --- head/sys/geom/vinum/geom_vinum_events.c Fri Dec 27 01:12:54 2019 (r356107) +++ head/sys/geom/vinum/geom_vinum_events.c Fri Dec 27 01:36:53 2019 (r356108) @@ -195,6 +195,20 @@ failed: } /* + * Count completed BIOs and handle orphanization when all are done. + */ +void +gv_drive_done(struct gv_drive *d) +{ + + KASSERT(d->active >= 0, ("Negative number of BIOs (%d)", d->active)); + if (--d->active == 0 && (d->flags & GV_DRIVE_ORPHANED)) { + d->flags &= ~GV_DRIVE_ORPHANED; + gv_post_event(d->vinumconf, GV_EVENT_DRIVE_LOST, d, NULL, 0, 0); + } +} + +/* * When losing a drive (e.g. hardware failure), we cut down the consumer * attached to the underlying device and bring the drive itself to a * "referenced" state so that normal tasting could bring it up cleanly if it @@ -214,10 +228,10 @@ gv_drive_lost(struct gv_softc *sc, struct gv_drive *d) cp = d->consumer; if (cp != NULL) { - if (cp->nstart != cp->nend) { - G_VINUM_DEBUG(0, "dead drive '%s' has still active " + if (d->active > 0) { + G_VINUM_DEBUG(2, "dead drive '%s' has still active " "requests, unable to detach consumer", d->name); - gv_post_event(sc, GV_EVENT_DRIVE_LOST, d, NULL, 0, 0); + d->flags |= GV_DRIVE_ORPHANED; return; } g_topology_lock(); Modified: head/sys/geom/vinum/geom_vinum_plex.c == --- head/sys/geom/vinum/geom_vinum_plex.c Fri Dec 27 01:12:54 2019 (r356107) +++ head/sys/geom/vinum/geom_vinum_plex.c Fri Dec 27 01:36:53 2019 (r356108) @@ -278,6 +278,7 @@ gv_plex_normal_request(struct gv_plex *p, struct bio * cbp->bio_data = addr; cbp->bio_done = gv_done; cbp->bio_caller1 = s; + s->drive_sc->active++; /* Store the sub-requests now and let others issue them. */ bioq_insert_tail(p->bqueue, cbp); @@ -580,10 +581,10 @@ gv_sync_request(struct gv_plex *from, struct gv_plex * return (ENOMEM); } bp->bio_length = length; - bp->bio_done = gv_done; + bp->bio_done = NULL; bp->bio_pflags |= GV_BIO_SYNCREQ; bp->bio_offset = offset; - bp->bio_caller1 = from; + bp->bio_caller1 = from; bp->bio_caller2 = to; bp->bio_cmd = type; if (data == NULL) @@ -694,7 +695,7 @@ gv_grow_request(struct gv_plex *p, off_t offset, off_t } bp->bio_cmd = type; - bp->bio_done = gv_done; + bp->bio_done = NULL; bp->bio_error = 0; bp->bio_caller1 = p; bp->bio_offset = offset; @@ -802,7 +803,7 @@ gv_init_request(struct gv_sd *s, off_t start, caddr_t } bp->bio_cmd = BIO_WRITE; bp->bio_data = data; - bp->bio_done = gv_done; + bp->bio_done = NULL; bp->bio_error = 0; bp->bio_length = length; bp->bio_pflags |= GV_BIO_INIT; @@ -819,6 +820,7 @@ gv_init_request(struct gv_sd *s, off_t start, caddr_t }
svn commit: r356107 - head/sys/net
Author: markj Date: Fri Dec 27 01:12:54 2019 New Revision: 356107 URL: https://svnweb.freebsd.org/changeset/base/356107 Log: Plug some ifaddr refcount leaks. - Only take an ifaddr ref in in rt_exportinfo() if the caller explicitly requests it. Take care to release it in this case. - Don't unconditionally take a ref in rtrequest1_fib(). rt_getifa_fib() will acquire a reference, in which case we would previously acquire two references. - Stop taking a reference in rtinit1() before calling rtrequest1_fib(). rtrequest1_fib() will acquire a reference for the RTM_ADD case. PR: 242746 Reviewed by: melifaro (previous version) Tested by:ghuckri...@blackberry.com MFC after:1 week Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D22912 Modified: head/sys/net/route.c Modified: head/sys/net/route.c == --- head/sys/net/route.cFri Dec 27 01:11:26 2019(r356106) +++ head/sys/net/route.cFri Dec 27 01:12:54 2019(r356107) @@ -833,7 +833,7 @@ rtrequest_fib(int req, * to reflect size of the provided buffer. if no NHR_COPY is specified, * point dst,netmask and gw @info fields to appropriate @rt values. * - * if @flags contains NHR_REF, do refcouting on rt_ifp. + * if @flags contains NHR_REF, do refcouting on rt_ifp and rt_ifa. * * Returns 0 on success. */ @@ -903,10 +903,9 @@ rt_exportinfo(struct rtentry *rt, struct rt_addrinfo * info->rti_flags = rt->rt_flags; info->rti_ifp = rt->rt_ifp; info->rti_ifa = rt->rt_ifa; - ifa_ref(info->rti_ifa); if (flags & NHR_REF) { - /* Do 'traditional' refcouting */ if_ref(info->rti_ifp); + ifa_ref(info->rti_ifa); } return (0); @@ -916,8 +915,8 @@ rt_exportinfo(struct rtentry *rt, struct rt_addrinfo * * Lookups up route entry for @dst in RIB database for fib @fibnum. * Exports entry data to @info using rt_exportinfo(). * - * if @flags contains NHR_REF, refcouting is performed on rt_ifp. - * All references can be released later by calling rib_free_info() + * If @flags contains NHR_REF, refcouting is performed on rt_ifp and rt_ifa. + * All references can be released later by calling rib_free_info(). * * Returns 0 on success. * Returns ENOENT for lookup failure, ENOMEM for export failure. @@ -963,6 +962,7 @@ void rib_free_info(struct rt_addrinfo *info) { + ifa_free(info->rti_ifa); if_rele(info->rti_ifp); } @@ -1631,9 +1631,12 @@ rtrequest1_fib(int req, struct rt_addrinfo *info, stru error = rt_getifa_fib(info, fibnum); if (error) return (error); + } else { + ifa_ref(info->rti_ifa); } rt = uma_zalloc(V_rtzone, M_NOWAIT); if (rt == NULL) { + ifa_free(info->rti_ifa); return (ENOBUFS); } rt->rt_flags = RTF_UP | flags; @@ -1642,6 +1645,7 @@ rtrequest1_fib(int req, struct rt_addrinfo *info, stru * Add the gateway. Possibly re-malloc-ing the storage for it. */ if ((error = rt_setgate(rt, dst, gateway)) != 0) { + ifa_free(info->rti_ifa); uma_zfree(V_rtzone, rt); return (error); } @@ -1665,7 +1669,6 @@ rtrequest1_fib(int req, struct rt_addrinfo *info, stru * examine the ifa and ifa->ifa_ifp if it so desires. */ ifa = info->rti_ifa; - ifa_ref(ifa); rt->rt_ifa = ifa; rt->rt_ifp = ifa->ifa_ifp; rt->rt_weight = 1; @@ -2108,7 +2111,6 @@ rtinit1(struct ifaddr *ifa, int cmd, int flags, int fi * Do the actual request */ bzero((caddr_t), sizeof(info)); - ifa_ref(ifa); info.rti_ifa = ifa; info.rti_flags = flags | (ifa->ifa_flags & ~IFA_RTSELF) | RTF_PINNED; @@ -2122,7 +2124,6 @@ rtinit1(struct ifaddr *ifa, int cmd, int flags, int fi info.rti_info[RTAX_GATEWAY] = ifa->ifa_addr; info.rti_info[RTAX_NETMASK] = netmask; error = rtrequest1_fib(cmd, , , fibnum); - if (error == 0 && rt != NULL) { /* * notify any listening routing agents of the change ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r356106 - head/lib/msun/bsdsrc
Author: pfg Date: Fri Dec 27 01:11:26 2019 New Revision: 356106 URL: https://svnweb.freebsd.org/changeset/base/356106 Log: msun: drop clause 3 from the Berkeley license. Per the University California Regents letter, drop the so-called "advertisement" clause. Discussed with: bde, kargl (2017) Differential Revision:https://reviews.freebsd.org/D22928 Modified: head/lib/msun/bsdsrc/b_exp.c head/lib/msun/bsdsrc/b_log.c head/lib/msun/bsdsrc/b_tgamma.c Modified: head/lib/msun/bsdsrc/b_exp.c == --- head/lib/msun/bsdsrc/b_exp.cFri Dec 27 00:49:49 2019 (r356105) +++ head/lib/msun/bsdsrc/b_exp.cFri Dec 27 01:11:26 2019 (r356106) @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-4-Clause + * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1985, 1993 * The Regents of the University of California. All rights reserved. @@ -12,11 +12,7 @@ * 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. All advertising materials mentioning features or use of this software - *must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors + * 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. * Modified: head/lib/msun/bsdsrc/b_log.c == --- head/lib/msun/bsdsrc/b_log.cFri Dec 27 00:49:49 2019 (r356105) +++ head/lib/msun/bsdsrc/b_log.cFri Dec 27 01:11:26 2019 (r356106) @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-4-Clause + * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -12,11 +12,7 @@ * 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. All advertising materials mentioning features or use of this software - *must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors + * 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. * Modified: head/lib/msun/bsdsrc/b_tgamma.c == --- head/lib/msun/bsdsrc/b_tgamma.c Fri Dec 27 00:49:49 2019 (r356105) +++ head/lib/msun/bsdsrc/b_tgamma.c Fri Dec 27 01:11:26 2019 (r356106) @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-4-Clause + * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -12,11 +12,7 @@ * 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. All advertising materials mentioning features or use of this software - *must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors + * 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. * ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r356105 - stable/12/sys/dev/mii
Author: markj Date: Fri Dec 27 00:49:49 2019 New Revision: 356105 URL: https://svnweb.freebsd.org/changeset/base/356105 Log: MFC r355941: mii(4): Fix ivars leak when the bus device or bus children detach. PR: 242727 Modified: stable/12/sys/dev/mii/mii.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mii/mii.c == --- stable/12/sys/dev/mii/mii.c Thu Dec 26 23:06:28 2019(r356104) +++ stable/12/sys/dev/mii/mii.c Fri Dec 27 00:49:49 2019(r356105) @@ -60,6 +60,7 @@ MODULE_VERSION(miibus, 1); #include "miibus_if.h" static device_attach_t miibus_attach; +static bus_child_detached_t miibus_child_detached; static bus_child_location_str_t miibus_child_location_str; static bus_child_pnpinfo_str_t miibus_child_pnpinfo_str; static device_detach_t miibus_detach; @@ -85,6 +86,7 @@ static device_method_t miibus_methods[] = { /* bus interface */ DEVMETHOD(bus_print_child, miibus_print_child), DEVMETHOD(bus_read_ivar,miibus_read_ivar), + DEVMETHOD(bus_child_detached, miibus_child_detached), DEVMETHOD(bus_child_pnpinfo_str, miibus_child_pnpinfo_str), DEVMETHOD(bus_child_location_str, miibus_child_location_str), DEVMETHOD(bus_hinted_child, miibus_hinted_child), @@ -160,13 +162,25 @@ static int miibus_detach(device_t dev) { struct mii_data *mii; + struct miibus_ivars *ivars; + ivars = device_get_ivars(dev); bus_generic_detach(dev); mii = device_get_softc(dev); ifmedia_removeall(>mii_media); + free(ivars, M_DEVBUF); mii->mii_ifp = NULL; return (0); +} + +static void +miibus_child_detached(device_t dev, device_t child) +{ + struct mii_attach_args *args; + + args = device_get_ivars(child); + free(args, M_DEVBUF); } static int ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r356104 - in head: contrib/llvm-project/clang/lib/AST contrib/llvm-project/compiler-rt/lib/builtins lib/libcompiler_rt
Author: jhibbits Date: Thu Dec 26 23:06:28 2019 New Revision: 356104 URL: https://svnweb.freebsd.org/changeset/base/356104 Log: [PowerPC] enable atomic.c in compiler_rt and do not check and forces lock/lock_free decisions in compiled time Summary: Enables atomic.c in compiler_rt and forces clang to not emit a call for runtime decision about lock/lock_free. At compiling time, if clang can't decide if atomic operation can be lock free, it emits calls to external functions like `__atomic_is_lock_free`, `__c11_atomic_is_lock_free` and `__atomic_always_lock_free`, postponing decision to a runtime check. According to LLVM code documentation, the mechanism exists due to differences between x86_64 processors that can't be decided at runtime. On PowerPC and PowerPCSPE (32 bits), we already know in advance it can't be lock free, so we force the decision at compile time and avoid having to implement it in an external library. This patch was made after 32 bit users testing the PowePC32 bit ISO reported llvm could not be compiled with in-base llvm due to `__atomic_load8` not implemented. Submitted by: alfredo.junior_eldorado.org.br Reviewed by: jhibbits, dim Differential Revision:https://reviews.freebsd.org/D22549 Modified: head/contrib/llvm-project/clang/lib/AST/ExprConstant.cpp head/contrib/llvm-project/compiler-rt/lib/builtins/atomic.c head/lib/libcompiler_rt/Makefile.inc Modified: head/contrib/llvm-project/clang/lib/AST/ExprConstant.cpp == --- head/contrib/llvm-project/clang/lib/AST/ExprConstant.cppThu Dec 26 22:49:19 2019(r356103) +++ head/contrib/llvm-project/clang/lib/AST/ExprConstant.cppThu Dec 26 23:06:28 2019(r356104) @@ -9896,6 +9896,13 @@ bool IntExprEvaluator::VisitBuiltinCallExpr(const Call } } +// Avoid emiting call for runtime decision on PowerPC 32-bit +// The lock free possibilities on this platform are covered by the lines +// above and we know in advance other cases require lock +if (Info.Ctx.getTargetInfo().getTriple().getArch() == llvm::Triple::ppc) { +return Success(0, E); +} + return BuiltinOp == Builtin::BI__atomic_always_lock_free ? Success(0, E) : Error(E); } Modified: head/contrib/llvm-project/compiler-rt/lib/builtins/atomic.c == --- head/contrib/llvm-project/compiler-rt/lib/builtins/atomic.c Thu Dec 26 22:49:19 2019(r356103) +++ head/contrib/llvm-project/compiler-rt/lib/builtins/atomic.c Thu Dec 26 23:06:28 2019(r356104) @@ -51,8 +51,8 @@ static const long SPINLOCK_MASK = SPINLOCK_COUNT - 1; #ifdef __FreeBSD__ #include -#include #include +#include #include typedef struct _usem Lock; __inline static void unlock(Lock *l) { @@ -117,13 +117,20 @@ static __inline Lock *lock_for_pointer(void *ptr) { return locks + (hash & SPINLOCK_MASK); } -/// Macros for determining whether a size is lock free. Clang can not yet -/// codegen __atomic_is_lock_free(16), so for now we assume 16-byte values are -/// not lock free. +/// Macros for determining whether a size is lock free. #define IS_LOCK_FREE_1 __c11_atomic_is_lock_free(1) #define IS_LOCK_FREE_2 __c11_atomic_is_lock_free(2) #define IS_LOCK_FREE_4 __c11_atomic_is_lock_free(4) + +/// 32 bit PowerPC doesn't support 8-byte lock_free atomics +#if !defined(__powerpc64__) && defined(__powerpc__) +#define IS_LOCK_FREE_8 0 +#else #define IS_LOCK_FREE_8 __c11_atomic_is_lock_free(8) +#endif + +/// Clang can not yet codegen __atomic_is_lock_free(16), so for now we assume +/// 16-byte values are not lock free. #define IS_LOCK_FREE_16 0 /// Macro that calls the compiler-generated lock-free versions of functions Modified: head/lib/libcompiler_rt/Makefile.inc == --- head/lib/libcompiler_rt/Makefile.incThu Dec 26 22:49:19 2019 (r356103) +++ head/lib/libcompiler_rt/Makefile.incThu Dec 26 23:06:28 2019 (r356104) @@ -205,6 +205,14 @@ CFLAGS+= -DEMIT_SYNC_ATOMICS SRCF+= stdatomic .endif + +.if "${COMPILER_TYPE}" == "clang" && \ +(${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpcspe") +SRCS+= atomic.c +CFLAGS.atomic.c+= -Wno-atomic-alignment +.endif + + .for file in ${SRCF} .if ${MACHINE_ARCH:Marmv[67]*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "") \ && exists(${CRTSRC}/${CRTARCH}/${file}vfp.S) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r356103 - head/usr.sbin/cron/cron
Author: kevans Date: Thu Dec 26 22:49:19 2019 New Revision: 356103 URL: https://svnweb.freebsd.org/changeset/base/356103 Log: cron(8): use proper variable to determine mailer process status While the mailer is normally opened/set if the mailto is set, this is not the case if the grandchild actually didn't produce any output. This change corrects the situation to only attempt to kill/close the mail process if it was actually opened in the first place. The reporter initially stumbled on the -n (suppress mail on success) flag leading to a SIGKILL of the process group, but simultaneously discovered/reported the behavior with !-n jobs if MAILTO was set and no output happened. All of these places that are checking mailto should actually be checking whether mail is set, so do that for consistency+correctness. This set of bugs were introduced by r352668. Submitted by: sig...@gmail.com Reported by: sig...@gmail.com Modified: head/usr.sbin/cron/cron/do_command.c Modified: head/usr.sbin/cron/cron/do_command.c == --- head/usr.sbin/cron/cron/do_command.cThu Dec 26 22:47:24 2019 (r356102) +++ head/usr.sbin/cron/cron/do_command.cThu Dec 26 22:49:19 2019 (r356103) @@ -460,6 +460,8 @@ child_process(e, u) _exit(ERROR_EXIT); } + mail = NULL; + ch = getc(in); if (ch != EOF) { Debug(DPROC|DEXT, @@ -531,7 +533,7 @@ child_process(e, u) while (EOF != (ch = getc(in))) { bytes++; - if (mailto) + if (mail) putc(ch, mail); } } @@ -555,12 +557,12 @@ child_process(e, u) */ if (WIFEXITED(waiter) && WEXITSTATUS(waiter) == 0 && (e->flags & MAIL_WHEN_ERR) == MAIL_WHEN_ERR - && mailto) { + && mail) { Debug(DPROC, ("[%d] %s executed successfully, mail suppressed\n", getpid(), "grandchild command job")) kill(mailpid, SIGKILL); (void)fclose(mail); - mailto = NULL; + mail = NULL; } @@ -568,7 +570,7 @@ child_process(e, u) * mailing... */ - if (mailto) { + if (mail) { Debug(DPROC, ("[%d] closing pipe to mail\n", getpid())) /* Note: the pclose will probably see ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r356102 - head/sys/powerpc/powerpc
Author: jhibbits Date: Thu Dec 26 22:47:24 2019 New Revision: 356102 URL: https://svnweb.freebsd.org/changeset/base/356102 Log: powerpc: Move ppc32_runtime_resolve() declaration to the right place The function is only used in 32-bit kernels, so move the declaration to !powerpc64. Modified: head/sys/powerpc/powerpc/elf32_machdep.c Modified: head/sys/powerpc/powerpc/elf32_machdep.c == --- head/sys/powerpc/powerpc/elf32_machdep.cThu Dec 26 22:33:20 2019 (r356101) +++ head/sys/powerpc/powerpc/elf32_machdep.cThu Dec 26 22:47:24 2019 (r356102) @@ -63,7 +63,6 @@ extern const char *freebsd32_syscallnames[]; static void ppc32_fixlimit(struct rlimit *rl, int which); -static void ppc32_runtime_resolve(void); static SYSCTL_NODE(_compat, OID_AUTO, ppc32, CTLFLAG_RW, 0, "32-bit mode"); @@ -75,6 +74,8 @@ SYSCTL_ULONG(_compat_ppc32, OID_AUTO, maxdsiz, CTLFLAG u_long ppc32_maxssiz = PPC32_MAXSSIZ; SYSCTL_ULONG(_compat_ppc32, OID_AUTO, maxssiz, CTLFLAG_RWTUN, _maxssiz, 0, ""); +#else +static void ppc32_runtime_resolve(void); #endif struct sysentvec elf32_freebsd_sysvec = { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r356101 - head/sbin/mount_nfs
Author: rmacklem Date: Thu Dec 26 22:33:20 2019 New Revision: 356101 URL: https://svnweb.freebsd.org/changeset/base/356101 Log: Fix mount_nfs to recognize the NFSv4 specific errors returned by nmount(2). When mount_nfs calls nmount(2), certain NFSv4 specific errors such as NFSERR_MINORVERMISMATCH can be returned. Without this patch, 10021 is reported as an unknown error. This is not particulcarily serious, but make it difficult for sysadmins to figure out why the mount attempt is failing. This patch uses nfsv4_errstr.h to convert 10021 and similar to error strings that can be printed out. A positive side effect of this patch is the removal of a reference to sys/nfsclient/nfs.h, which should no longer be used, since it is part of the old NFS client. This patch should only affect reporting of failed mount attempts and not the semantics of NFS mount attempts. Modified: head/sbin/mount_nfs/mount_nfs.c Modified: head/sbin/mount_nfs/mount_nfs.c == --- head/sbin/mount_nfs/mount_nfs.c Thu Dec 26 21:20:45 2019 (r356100) +++ head/sbin/mount_nfs/mount_nfs.c Thu Dec 26 22:33:20 2019 (r356101) @@ -61,7 +61,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include +#include #include @@ -155,7 +156,7 @@ main(int argc, char *argv[]) char *mntname, *p, *spec, *tmp; char mntpath[MAXPATHLEN], errmsg[255]; char hostname[MAXHOSTNAMELEN + 1], gssn[MAXHOSTNAMELEN + 50]; - const char *gssname; + const char *gssname, *nmount_errstr; iov = NULL; iovlen = 0; @@ -462,9 +463,14 @@ main(int argc, char *argv[]) build_iovec(, , "fspath", mntpath, (size_t)-1); build_iovec(, , "errmsg", errmsg, sizeof(errmsg)); - if (nmount(iov, iovlen, 0)) - err(1, "nmount: %s%s%s", mntpath, errmsg[0] ? ", " : "", - errmsg); + if (nmount(iov, iovlen, 0)) { + nmount_errstr = nfsv4_geterrstr(errno); + if (mountmode == V4 && nmount_errstr != NULL) + errx(1, "nmount: %s, %s", mntpath, nmount_errstr); + else + err(1, "nmount: %s%s%s", mntpath, errmsg[0] ? ", " : "", + errmsg); + } exit(0); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r356100 - head/contrib/llvm-project/llvm/lib/Target/PowerPC
Author: dim Date: Thu Dec 26 21:20:45 2019 New Revision: 356100 URL: https://svnweb.freebsd.org/changeset/base/356100 Log: Merge commit d3aeac8e2 from llvm git (by Justin Hibbits) [PowerPC] Only use PLT annotations if using PIC relocation model Summary: The default static (non-PIC, non-PIE) model for 32-bit powerpc does not use @PLT annotations and relocations in GCC. LLVM shouldn't use @PLT annotations either, because it breaks secure-PLT linking with (some versions of?) GNU LD. Update the available-externally.ll test to reflect that default mode should be the same as the static relocation, by using the same check prefix. Reviewed by:sfertile Differential Revision: https://reviews.llvm.org/D70570 Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D22913 Modified: head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp Modified: head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp == --- head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp Thu Dec 26 21:06:34 2019(r356099) +++ head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp Thu Dec 26 21:20:45 2019(r356100) @@ -4952,7 +4952,12 @@ PrepareCall(SelectionDAG , SDValue , SDValu if (auto *G = dyn_cast(Callee)) GV = G->getGlobal(); bool Local = TM.shouldAssumeDSOLocal(*Mod, GV); - bool UsePlt = !Local && Subtarget.isTargetELF() && !isPPC64; + // The PLT is only used in 32-bit ELF PIC mode. Attempting to use the PLT in + // a static relocation model causes some versions of GNU LD (2.17.50, at + // least) to force BSS-PLT, instead of secure-PLT, even if all objects are + // built with secure-PLT. + bool UsePlt = !Local && Subtarget.isTargetELF() && !isPPC64 && +Subtarget.getTargetMachine().getRelocationModel() == Reloc::PIC_; // If the callee is a GlobalAddress/ExternalSymbol node (quite common, // every direct call is) turn it into a TargetGlobalAddress / ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r356099 - head/sys/fs/nfs
Author: rmacklem Date: Thu Dec 26 21:06:34 2019 New Revision: 356099 URL: https://svnweb.freebsd.org/changeset/base/356099 Log: Change NFSv4.1 and NFSv4.2 error strings to start with lower case letter. r356084 added error strings for NFSv4.1 and NFSv4.2, with the first character capitalized. Since the other error strings were not capitalized and these strings would usually be imbedded in an error, I decided to make the first characters lower cased. No real effect but more consistent. Modified: head/sys/fs/nfs/nfsv4_errstr.h Modified: head/sys/fs/nfs/nfsv4_errstr.h == --- head/sys/fs/nfs/nfsv4_errstr.h Thu Dec 26 21:00:06 2019 (r356098) +++ head/sys/fs/nfs/nfsv4_errstr.h Thu Dec 26 21:06:34 2019 (r356099) @@ -85,54 +85,54 @@ static const char *nfsv4_errstr[NFSERR_XATTR2BIG - 100 "open file blocks op", "lockowner state revoked", "callback path down" - "Bad IO mode", - "Bad layout", - "Bad session digest", - "Bad session", - "Bad slot", - "Complete already", - "Not bound to session", - "Delegation already wanted", - "Back channel busy", - "Layout try later", - "Layout unavailable", - "No matching layout", - "Recall conflict", - "Unknown layout type", - "Sequence misordered", - "Sequence position", - "Request too big", - "Reply too big", - "Reply too big to cache", - "Retry uncached reply", - "Unsafe compound", - "Too many operations", - "Operation not in session", - "Hash algorithm unsupported", - "Unknown error", - "ClientID busy", + "bad IO mode", + "bad layout", + "bad session digest", + "bad session", + "bad slot", + "complete already", + "not bound to session", + "delegation already wanted", + "back channel busy", + "layout try later", + "layout unavailable", + "no matching layout", + "recall conflict", + "unknown layout type", + "sequence misordered", + "sequence position", + "request too big", + "reply too big", + "reply too big to cache", + "retry uncached reply", + "unsafe compound", + "too many operations", + "operation not in session", + "hash algorithm unsupported", + "unknown error", + "clientID busy", "pNFS IO hole", - "Sequence false retry", - "Bad high slot", - "Dead session", - "Encrypt algorithm unsupported", + "sequence false retry", + "bad high slot", + "dead session", + "encrypt algorithm unsupported", "pNFS no layout", - "Not only operation", - "Wrong credential", - "Wrong type", - "Directory delegation unavailable", - "Reject delegation", - "Return conflict", - "Delegation revoked", - "Partner not supported", - "Partner no auth", - "Union not supported", - "Offload denied", - "Wrong LFS", - "Bad label", - "Offload no request", - "No extended attribute", - "Extended attribute too big", + "not only operation", + "wrong credential", + "wrong type", + "directory delegation unavailable", + "reject delegation", + "return conflict", + "delegation revoked", + "partner not supported", + "partner no auth", + "union not supported", + "offload denied", + "wrong LFS", + "bad label", + "offload no request", + "no extended attribute", + "extended attribute too big", }; /* ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r356098 - head/sys/dev/pci
Author: scottl Date: Thu Dec 26 21:00:06 2019 New Revision: 356098 URL: https://svnweb.freebsd.org/changeset/base/356098 Log: Abstract the locking for PCIe hotplug. It still uses Giant so there's no functional change yet. Modified: head/sys/dev/pci/pci_pci.c head/sys/dev/pci/pcib_private.h Modified: head/sys/dev/pci/pci_pci.c == --- head/sys/dev/pci/pci_pci.c Thu Dec 26 19:41:09 2019(r356097) +++ head/sys/dev/pci/pci_pci.c Thu Dec 26 21:00:06 2019(r356098) @@ -1174,6 +1174,7 @@ pcib_pcie_intr_hotplug(void *arg) sc = arg; dev = sc->dev; + PCIB_HP_LOCK(sc); old_slot_sta = sc->pcie_slot_sta; sc->pcie_slot_sta = pcie_read_config(dev, PCIER_SLOT_STA, 2); @@ -1221,6 +1222,7 @@ pcib_pcie_intr_hotplug(void *arg) } pcib_pcie_hotplug_update(sc, 0, 0, true); + PCIB_HP_UNLOCK(sc); } static void @@ -1230,7 +1232,7 @@ pcib_pcie_hotplug_task(void *context, int pending) device_t dev; sc = context; - mtx_lock(); + PCIB_HP_LOCK(sc); dev = sc->dev; if (pcib_hotplug_present(sc) != 0) { if (sc->child == NULL) { @@ -1243,7 +1245,7 @@ pcib_pcie_hotplug_task(void *context, int pending) sc->child = NULL; } } - mtx_unlock(); + PCIB_HP_UNLOCK(sc); } static void @@ -1252,7 +1254,7 @@ pcib_pcie_ab_timeout(void *arg) struct pcib_softc *sc; sc = arg; - mtx_assert(, MA_OWNED); + PCIB_HP_LOCK_ASSERT(sc); if (sc->flags & PCIB_DETACH_PENDING) { sc->flags |= PCIB_DETACHING; sc->flags &= ~PCIB_DETACH_PENDING; @@ -1269,7 +1271,7 @@ pcib_pcie_cc_timeout(void *arg) sc = arg; dev = sc->dev; - mtx_assert(, MA_OWNED); + PCIB_HP_LOCK_ASSERT(sc); sta = pcie_read_config(dev, PCIER_SLOT_STA, 2); if (!(sta & PCIEM_SLOT_STA_CC)) { device_printf(dev, "HotPlug Command Timed Out\n"); @@ -1290,7 +1292,7 @@ pcib_pcie_dll_timeout(void *arg) sc = arg; dev = sc->dev; - mtx_assert(, MA_OWNED); + PCIB_HP_LOCK_ASSERT(sc); sta = pcie_read_config(dev, PCIER_LINK_STA, 2); if (!(sta & PCIEM_LINK_STA_DL_ACTIVE)) { device_printf(dev, @@ -1345,7 +1347,7 @@ pcib_alloc_pcie_irq(struct pcib_softc *sc) return (ENXIO); } - error = bus_setup_intr(dev, sc->pcie_irq, INTR_TYPE_MISC, + error = bus_setup_intr(dev, sc->pcie_irq, INTR_TYPE_MISC|INTR_MPSAFE, NULL, pcib_pcie_intr_hotplug, sc, >pcie_ihand); if (error) { device_printf(dev, "Failed to setup PCI-e interrupt handler\n"); @@ -1384,6 +1386,7 @@ pcib_setup_hotplug(struct pcib_softc *sc) callout_init(>pcie_cc_timer, 0); callout_init(>pcie_dll_timer, 0); TASK_INIT(>pcie_hp_task, 0, pcib_pcie_hotplug_task, sc); + sc->pcie_hp_lock = /* Allocate IRQ. */ if (pcib_alloc_pcie_irq(sc) != 0) Modified: head/sys/dev/pci/pcib_private.h == --- head/sys/dev/pci/pcib_private.h Thu Dec 26 19:41:09 2019 (r356097) +++ head/sys/dev/pci/pcib_private.h Thu Dec 26 21:00:06 2019 (r356098) @@ -141,7 +141,12 @@ struct pcib_softc struct callout pcie_ab_timer; struct callout pcie_cc_timer; struct callout pcie_dll_timer; +struct mtx *pcie_hp_lock; }; + +#define PCIB_HP_LOCK(sc) mtx_lock((sc)->pcie_hp_lock) +#define PCIB_HP_UNLOCK(sc) mtx_unlock((sc)->pcie_hp_lock) +#define PCIB_HP_LOCK_ASSERT(sc)mtx_assert((sc)->pcie_hp_lock, MA_OWNED) #definePCIB_SUPPORTED_ARI_VER 1 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r356097 - in head: share/man/man9 sys/compat/ndis sys/dev/oce sys/kern sys/libkern sys/sys
Author: cem Date: Thu Dec 26 19:41:09 2019 New Revision: 356097 URL: https://svnweb.freebsd.org/changeset/base/356097 Log: random(9): Deprecate random(9), remove meaningless srandom(9) srandom(9) is meaningless on SMP systems or any system with, say, interrupts. One could never rely on random(9) to produce a reproducible sequence of outputs on the basis of a specific srandom() seed because the global state was shared by all kernel contexts. As such, removing it is literally indistinguishable to random(9) consumers (as compared with retaining it). Mark random(9) as deprecated and slated for quick removal. This is not to say we intend to remove all fast, non-cryptographic PRNG(s) in the kernel. It/they just won't be random(9), as it exists today, in either name or implementation. Before random(9) is removed, a replacement will be provided and in-tree consumers will be converted. Note that despite the name, the random(9) interface does not bear any resemblance to random(3). Instead, it is the same crummy 1988 Park-Miller LCG used in libc rand(3). Modified: head/share/man/man9/random.9 head/sys/compat/ndis/subr_ntoskrnl.c head/sys/dev/oce/oce_mbox.c head/sys/kern/init_main.c head/sys/kern/subr_stats.c head/sys/libkern/random.c head/sys/sys/libkern.h Modified: head/share/man/man9/random.9 == --- head/share/man/man9/random.9Thu Dec 26 19:32:11 2019 (r356096) +++ head/share/man/man9/random.9Thu Dec 26 19:41:09 2019 (r356097) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" " -.Dd April 16, 2019 +.Dd December 26, 2019 .Dt RANDOM 9 .Os .Sh NAME @@ -36,8 +36,7 @@ .Nm is_random_seeded , .Nm random , .Nm read_random , -.Nm read_random_uio , -.Nm srandom +.Nm read_random_uio .Nd supply pseudo-random numbers .Sh SYNOPSIS .In sys/libkern.h @@ -57,8 +56,6 @@ .Fn read_random_uio "struct uio *uio" "bool nonblock" .Ss LEGACY ROUTINES .In sys/libkern.h -.Ft void -.Fn srandom "u_long seed" .Ft u_long .Fn random "void" .Sh DESCRIPTION @@ -134,19 +131,16 @@ Otherwise, this function may block interruptibly until If the function is interrupted before the random device is seeded, no data is returned. .Pp -The legacy -.Fn random -function will produce a sequence of numbers that can be duplicated by calling -.Fn srandom -with some constant as the -.Fa seed . -The legacy -.Fn srandom -function may be called with any -.Fa seed -value. +The deprecated +.Xr random 9 +function will produce a sequence of pseudorandom numbers using a similar weak +linear congruential generator as +.Xr rand 3 +(the 1988 Park-Miller LCG). +It is obsolete and scheduled to be removed in +.Fx 13.0 . It is strongly advised that the -.Fn random +.Xr random 9 function not be used to generate random numbers. See .Sx SECURITY CONSIDERATIONS . @@ -173,23 +167,6 @@ the number of bytes placed in .Fn read_random_uio returns zero when successful, otherwise an error code is returned. -.Pp -The legacy -.Fn random -function uses -a non-linear additive feedback random number generator -employing a default table -of size 31 -containing long integers -to return successive pseudo-random -numbers in the range from 0 to -.if t 2\u\s731\s10\d\(mi1. -.if n (2**31)\(mi1. -The period of this random number generator -is very large, -approximately -.if t 16\(mu(2\u\s731\s10\d\(mi1). -.if n 16*((2**31)\(mi1). .Sh ERRORS .Fn read_random_uio may fail if: @@ -212,8 +189,6 @@ wrote .Sh SECURITY CONSIDERATIONS Do not use .Fn random -or -.Fn srandom in new code. .Pp It is important to remember that the Modified: head/sys/compat/ndis/subr_ntoskrnl.c == --- head/sys/compat/ndis/subr_ntoskrnl.cThu Dec 26 19:32:11 2019 (r356096) +++ head/sys/compat/ndis/subr_ntoskrnl.cThu Dec 26 19:41:09 2019 (r356097) @@ -3195,10 +3195,8 @@ rand(void) } static void -srand(unsigned int seed) +srand(unsigned int seed __unused) { - - srandom(seed); } static uint8_t Modified: head/sys/dev/oce/oce_mbox.c == --- head/sys/dev/oce/oce_mbox.c Thu Dec 26 19:32:11 2019(r356096) +++ head/sys/dev/oce/oce_mbox.c Thu Dec 26 19:41:09 2019(r356097) @@ -859,7 +859,6 @@ oce_config_nic_rss(POCE_SOFTC sc, uint32_t if_id, uint fwcmd->params.req.if_id = LE_32(if_id); - srandom(arc4random()); /* random entropy seed */ read_random(fwcmd->params.req.hash, sizeof(fwcmd->params.req.hash)); rc = oce_rss_itbl_init(sc, fwcmd); Modified: head/sys/kern/init_main.c == --- head/sys/kern/init_main.c Thu Dec 26 19:32:11 2019(r356096) +++ head/sys/kern/init_main.c Thu Dec 26 19:41:09 2019(r356097) @@
svn commit: r356096 - in head: . sys/dev/random sys/sys
Author: cem Date: Thu Dec 26 19:32:11 2019 New Revision: 356096 URL: https://svnweb.freebsd.org/changeset/base/356096 Log: random(4): Simplify RANDOM_LOADABLE Simplify RANDOM_LOADABLE by removing the ability to unload a LOADABLE random(4) implementation. This allows one-time random module selection at boot, by loader(8). Swapping modules on the fly doesn't seem especially useful. This removes the need to hold a lock over the sleepable module calls read_random and read_random_uio. init/deinit have been pulled out of random_algorithm entirely. Algorithms can run their own sysinits to initialize; deinit is removed entirely, as algorithms can not be unloaded. Algorithms should initialize at SI_SUB_RANDOM:SI_ORDER_SECOND. In LOADABLE systems, algorithms install a pointer to their local random_algorithm context in p_random_alg_context at that time. Go ahead and const'ify random_algorithm objects; there is no need to mutate them at runtime. LOADABLE kernel NULL checks are removed from random_harvestq by ordering random_harvestq initialization at SI_SUB_RANDOM:SI_ORDER_THIRD, after algorithm init. Prior to random_harvestq init, hc_harvest_mask is zero and no events are forwarded to algorithms; after random_harvestq init, the relevant pointers will already have been installed. Remove the bulk of random_infra shim wrappers and instead expose the bare function pointers in sys/random.h. In LOADABLE systems, read_random(9) et al are just thin shim macros around invoking the associated function pointer. We do not provide a registration system but instead expect LOADABLE modules to register themselves at SI_SUB_RANDOM:SI_ORDER_SECOND. An example is provided in randomdev.c, as used in the random_fortuna.ko module. Approved by: csprng(markm) Discussed with: gordon Differential Revision:https://reviews.freebsd.org/D22512 Modified: head/UPDATING head/sys/dev/random/fortuna.c head/sys/dev/random/other_algorithm.c head/sys/dev/random/random_harvestq.c head/sys/dev/random/random_infra.c head/sys/dev/random/randomdev.c head/sys/dev/random/randomdev.h head/sys/sys/random.h Modified: head/UPDATING == --- head/UPDATING Thu Dec 26 18:59:43 2019(r356095) +++ head/UPDATING Thu Dec 26 19:32:11 2019(r356096) @@ -26,6 +26,9 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20191226: + Kernel-loadable random(4) modules are no longer unloadable. + 20191222: Clang, llvm, lld, lldb, compiler-rt, libc++, libunwind and openmp have been upgraded to 9.0.1. Please see the 20141231 entry below for Modified: head/sys/dev/random/fortuna.c == --- head/sys/dev/random/fortuna.c Thu Dec 26 18:59:43 2019 (r356095) +++ head/sys/dev/random/fortuna.c Thu Dec 26 19:32:11 2019 (r356096) @@ -261,15 +261,14 @@ static void random_fortuna_read(uint8_t *, size_t); static bool random_fortuna_seeded(void); static bool random_fortuna_seeded_internal(void); static void random_fortuna_process_event(struct harvest_event *); -static void random_fortuna_init_alg(void *); -static void random_fortuna_deinit_alg(void *); static void random_fortuna_reseed_internal(uint32_t *entropy_data, u_int blockcount); -struct random_algorithm random_alg_context = { +#ifdef RANDOM_LOADABLE +static +#endif +const struct random_algorithm random_alg_context = { .ra_ident = "Fortuna", - .ra_init_alg = random_fortuna_init_alg, - .ra_deinit_alg = random_fortuna_deinit_alg, .ra_pre_read = random_fortuna_pre_read, .ra_read = random_fortuna_read, .ra_seeded = random_fortuna_seeded, @@ -286,6 +285,10 @@ random_fortuna_init_alg(void *unused __unused) struct sysctl_oid *random_fortuna_o; #endif +#ifdef RANDOM_LOADABLE + p_random_alg_context = _alg_context; +#endif + RANDOM_RESEED_INIT_LOCK(); /* * Fortuna parameters. Do not adjust these unless you have @@ -330,18 +333,8 @@ random_fortuna_init_alg(void *unused __unused) fortuna_state.fs_counter = UINT128_ZERO; explicit_bzero(_state.fs_key, sizeof(fortuna_state.fs_key)); } - -/* ARGSUSED */ -static void -random_fortuna_deinit_alg(void *unused __unused) -{ - - RANDOM_RESEED_DEINIT_LOCK(); - explicit_bzero(_state, sizeof(fortuna_state)); -#ifdef _KERNEL - sysctl_ctx_free(_clist); -#endif -} +SYSINIT(random_alg, SI_SUB_RANDOM, SI_ORDER_SECOND, random_fortuna_init_alg, +NULL); /*- * FS - AddRandomEvent() Modified: head/sys/dev/random/other_algorithm.c ===
svn commit: r356095 - in stable: 11 12
Author: kevans Date: Thu Dec 26 18:59:43 2019 New Revision: 356095 URL: https://svnweb.freebsd.org/changeset/base/356095 Log: MFC r355806, r356091: double-registration of kbd drivers + revert This is a NOP, being recorded to reduce noise when reviewing follow-up in the affected drviers for MFC. Modified: Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: Directory Properties: stable/12/ (props changed) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r356095 - in stable: 11 12
Author: kevans Date: Thu Dec 26 18:59:43 2019 New Revision: 356095 URL: https://svnweb.freebsd.org/changeset/base/356095 Log: MFC r355806, r356091: double-registration of kbd drivers + revert This is a NOP, being recorded to reduce noise when reviewing follow-up in the affected drviers for MFC. Modified: Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: Directory Properties: stable/11/ (props changed) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r356094 - in head/sys: kern sys
Author: cem Date: Thu Dec 26 18:25:07 2019 New Revision: 356094 URL: https://svnweb.freebsd.org/changeset/base/356094 Log: gone_in(9): Trivial string grammar and style cleanups Modified: head/sys/kern/subr_bus.c head/sys/sys/systm.h Modified: head/sys/kern/subr_bus.c == --- head/sys/kern/subr_bus.cThu Dec 26 18:05:38 2019(r356093) +++ head/sys/kern/subr_bus.cThu Dec 26 18:25:07 2019(r356094) @@ -5971,7 +5971,7 @@ _gone_in(int major, const char *msg) gone_panic(major, P_OSREL_MAJOR(__FreeBSD_version), msg); if (P_OSREL_MAJOR(__FreeBSD_version) >= major) - printf("Obsolete code will removed soon: %s\n", msg); + printf("Obsolete code will be removed soon: %s\n", msg); else printf("Deprecated code (to be removed in FreeBSD %d): %s\n", major, msg); @@ -5984,7 +5984,7 @@ _gone_in_dev(device_t dev, int major, const char *msg) gone_panic(major, P_OSREL_MAJOR(__FreeBSD_version), msg); if (P_OSREL_MAJOR(__FreeBSD_version) >= major) device_printf(dev, - "Obsolete code will removed soon: %s\n", msg); + "Obsolete code will be removed soon: %s\n", msg); else device_printf(dev, "Deprecated code (to be removed in FreeBSD %d): %s\n", Modified: head/sys/sys/systm.h == --- head/sys/sys/systm.hThu Dec 26 18:05:38 2019(r356093) +++ head/sys/sys/systm.hThu Dec 26 18:25:07 2019(r356094) @@ -593,7 +593,7 @@ void _gone_in_dev(struct device *dev, int major, const #ifdef NO_OBSOLETE_CODE #define __gone_ok(m, msg) \ _Static_assert(m < P_OSREL_MAJOR(__FreeBSD_version)),\ - "Obsolete code" msg); + "Obsolete code: " msg); #else #define__gone_ok(m, msg) #endif ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r356093 - in stable/12/sys: modules/ipfw_nat64 netpfil/ipfw/nat64
Author: ae Date: Thu Dec 26 18:05:38 2019 New Revision: 356093 URL: https://svnweb.freebsd.org/changeset/base/356093 Log: MFC r355650: Follow RFC 4443 p2.2 and always use own addresses for reflected ICMPv6 datagrams. Previously destination address from original datagram was used. That looked confusing, especially in the traceroute6 output. Also honor IPSTEALTH kernel option and do TTL/HLIM decrementing only when stealth mode is disabled. Reported by:Marco van Tol Sponsored by: Yandex LLC Differential Revision: https://reviews.freebsd.org/D22631 Modified: stable/12/sys/modules/ipfw_nat64/Makefile stable/12/sys/netpfil/ipfw/nat64/nat64_translate.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/modules/ipfw_nat64/Makefile == --- stable/12/sys/modules/ipfw_nat64/Makefile Thu Dec 26 17:25:51 2019 (r356092) +++ stable/12/sys/modules/ipfw_nat64/Makefile Thu Dec 26 18:05:38 2019 (r356093) @@ -7,6 +7,7 @@ SRCS= ip_fw_nat64.c nat64_translate.c SRCS+= nat64clat.c nat64clat_control.c SRCS+= nat64lsn.c nat64lsn_control.c SRCS+= nat64stl.c nat64stl_control.c +SRCS+= opt_ipstealth.h CFLAGS+= -I${SRCTOP}/sys/contrib/ck/include Modified: stable/12/sys/netpfil/ipfw/nat64/nat64_translate.c == --- stable/12/sys/netpfil/ipfw/nat64/nat64_translate.c Thu Dec 26 17:25:51 2019(r356092) +++ stable/12/sys/netpfil/ipfw/nat64/nat64_translate.c Thu Dec 26 18:05:38 2019(r356093) @@ -29,6 +29,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_ipstealth.h" + #include #include #include @@ -101,14 +103,39 @@ static const struct nat64_methods nat64_direct = { .output = nat64_direct_output, .output_one = nat64_direct_output_one }; -VNET_DEFINE_STATIC(const struct nat64_methods *, nat64out) = _netisr; -#defineV_nat64out VNET(nat64out) +/* These variables should be initialized explicitly on module loading */ +VNET_DEFINE_STATIC(const struct nat64_methods *, nat64out); +VNET_DEFINE_STATIC(const int *, nat64ipstealth); +VNET_DEFINE_STATIC(const int *, nat64ip6stealth); +#defineV_nat64out VNET(nat64out) +#defineV_nat64ipstealthVNET(nat64ipstealth) +#defineV_nat64ip6stealth VNET(nat64ip6stealth) + +static const int stealth_on = 1; +#ifndef IPSTEALTH +static const int stealth_off = 0; +#endif + void nat64_set_output_method(int direct) { - V_nat64out = direct != 0 ? _direct: _netisr; + if (direct != 0) { + V_nat64out = _direct; +#ifdef IPSTEALTH + /* Honor corresponding variables, if IPSTEALTH is defined */ + V_nat64ipstealth = _ipstealth; + V_nat64ip6stealth = _ip6stealth; +#else + /* otherwise we need to decrement HLIM/TTL for direct case */ + V_nat64ipstealth = V_nat64ip6stealth = _off; +#endif + } else { + V_nat64out = _netisr; + /* Leave TTL/HLIM decrementing to forwarding code */ + V_nat64ipstealth = V_nat64ip6stealth = _on; + } } int @@ -486,8 +513,7 @@ nat64_init_ip4hdr(const struct ip6_hdr *ip6, const str ip->ip_tos = (ntohl(ip6->ip6_flow) >> 20) & 0xff; ip->ip_len = htons(sizeof(*ip) + plen); ip->ip_ttl = ip6->ip6_hlim; - /* Forwarding code will decrement TTL for netisr based output. */ - if (V_nat64out == _direct) + if (*V_nat64ip6stealth == 0) ip->ip_ttl -= IPV6_HLIMDEC; ip->ip_sum = 0; ip->ip_p = (proto == IPPROTO_ICMPV6) ? IPPROTO_ICMP: proto; @@ -623,18 +649,18 @@ nat64_icmp6_reflect(struct mbuf *m, uint8_t type, uint struct icmp6_hdr *icmp6; struct ip6_hdr *ip6, *oip6; struct mbuf *n; - int len, plen; + int len, plen, proto; len = 0; - plen = nat64_getlasthdr(m, ); - if (plen < 0) { + proto = nat64_getlasthdr(m, ); + if (proto < 0) { DPRINTF(DP_DROPS, "mbuf isn't contigious"); goto freeit; } /* * Do not send ICMPv6 in reply to ICMPv6 errors. */ - if (plen == IPPROTO_ICMPV6) { + if (proto == IPPROTO_ICMPV6) { if (m->m_len < len + sizeof(*icmp6)) { DPRINTF(DP_DROPS, "mbuf isn't contigious"); goto freeit; @@ -646,6 +672,21 @@ nat64_icmp6_reflect(struct mbuf *m, uint8_t type, uint "ICMPv6 errors"); goto freeit; } + /* +* If there are extra headers between IPv6 and ICMPv6, +* strip off them. +*/ + if (len > sizeof(struct ip6_hdr)) { + /* +
svn commit: r356092 - head/sys/dev/kbdmux
Author: kevans Date: Thu Dec 26 17:25:51 2019 New Revision: 356092 URL: https://svnweb.freebsd.org/changeset/base/356092 Log: kbdmux: simplify modevent handler In the event of a MOD_LOAD failure, MOD_UNLOAD will be invoked to unwind module load. Most of the reversion in MOD_LOAD can just be deferred to normal MOD_UNLOAD cleanup, rather than duplicating the effort. A NULL return of kbd_get_switch in the MOD_UNLOAD handler has been downgraded from a panic to a successful return, as that certainly just means that kbd_add_driver failed (not possible at the moment) and we have no work to do. Modified: head/sys/dev/kbdmux/kbdmux.c Modified: head/sys/dev/kbdmux/kbdmux.c == --- head/sys/dev/kbdmux/kbdmux.cThu Dec 26 17:09:36 2019 (r356091) +++ head/sys/dev/kbdmux/kbdmux.cThu Dec 26 17:25:51 2019 (r356092) @@ -1427,7 +1427,6 @@ kbdmux_modevent(module_t mod, int type, void *data) break; if ((sw = kbd_get_switch(KEYBOARD_NAME)) == NULL) { - kbd_delete_driver(_kbd_driver); error = ENXIO; break; } @@ -1435,33 +1434,25 @@ kbdmux_modevent(module_t mod, int type, void *data) kbd = NULL; if ((error = (*sw->probe)(0, NULL, 0)) != 0 || - (error = (*sw->init)(0, , NULL, 0)) != 0) { - kbd_delete_driver(_kbd_driver); + (error = (*sw->init)(0, , NULL, 0)) != 0) break; - } #ifdef KBD_INSTALL_CDEV if ((error = kbd_attach(kbd)) != 0) { (*sw->term)(kbd); - kbd_delete_driver(_kbd_driver); break; } #endif - if ((error = (*sw->enable)(kbd)) != 0) { - (*sw->disable)(kbd); -#ifdef KBD_INSTALL_CDEV - kbd_detach(kbd); -#endif - (*sw->term)(kbd); - kbd_delete_driver(_kbd_driver); + if ((error = (*sw->enable)(kbd)) != 0) break; - } break; case MOD_UNLOAD: - if ((sw = kbd_get_switch(KEYBOARD_NAME)) == NULL) - panic("kbd_get_switch(" KEYBOARD_NAME ") == NULL"); + if ((sw = kbd_get_switch(KEYBOARD_NAME)) == NULL) { + error = 0; + break; + } kbd = kbd_get_keyboard(kbd_find_keyboard(KEYBOARD_NAME, 0)); if (kbd != NULL) { @@ -1470,8 +1461,8 @@ kbdmux_modevent(module_t mod, int type, void *data) kbd_detach(kbd); #endif (*sw->term)(kbd); - kbd_delete_driver(_kbd_driver); } + kbd_delete_driver(_kbd_driver); error = 0; break; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r356091 - in head/sys/dev: adb gpio hyperv/input kbdmux usb/input vkbd
Author: kevans Date: Thu Dec 26 17:09:36 2019 New Revision: 356091 URL: https://svnweb.freebsd.org/changeset/base/356091 Log: Revert r355806: kbd drivers: don't double register keyboard drivers r356087 made it rather innocuous to double-register built-in keyboard drivers; we now set a flag to indicate that it's been registered and only act once on a registration anyways. There is no misleading here, as the follow-up kbd_delete_driver will actually remove the driver as needed now that the linker set isn't also consulted after kbdinit. Modified: head/sys/dev/adb/adb_kbd.c head/sys/dev/gpio/gpiokeys.c head/sys/dev/hyperv/input/hv_kbd.c head/sys/dev/kbdmux/kbdmux.c head/sys/dev/usb/input/ukbd.c head/sys/dev/vkbd/vkbd.c Modified: head/sys/dev/adb/adb_kbd.c == --- head/sys/dev/adb/adb_kbd.c Thu Dec 26 16:58:11 2019(r356090) +++ head/sys/dev/adb/adb_kbd.c Thu Dec 26 17:09:36 2019(r356091) @@ -850,15 +850,11 @@ akbd_modevent(module_t mod, int type, void *data) { switch (type) { case MOD_LOAD: -#ifdef KLD_MODULE kbd_add_driver(_kbd_driver); -#endif break; case MOD_UNLOAD: -#ifdef KLD_MODULE kbd_delete_driver(_kbd_driver); -#endif break; default: Modified: head/sys/dev/gpio/gpiokeys.c == --- head/sys/dev/gpio/gpiokeys.cThu Dec 26 16:58:11 2019 (r356090) +++ head/sys/dev/gpio/gpiokeys.cThu Dec 26 17:09:36 2019 (r356091) @@ -983,8 +983,6 @@ KEYBOARD_DRIVER(gpiokeys, gpiokeyssw, gpiokeys_configu static int gpiokeys_driver_load(module_t mod, int what, void *arg) { - -#ifdef KLD_MODULE switch (what) { case MOD_LOAD: kbd_add_driver(_kbd_driver); @@ -993,7 +991,6 @@ gpiokeys_driver_load(module_t mod, int what, void *arg kbd_delete_driver(_kbd_driver); break; } -#endif return (0); } Modified: head/sys/dev/hyperv/input/hv_kbd.c == --- head/sys/dev/hyperv/input/hv_kbd.c Thu Dec 26 16:58:11 2019 (r356090) +++ head/sys/dev/hyperv/input/hv_kbd.c Thu Dec 26 17:09:36 2019 (r356091) @@ -490,8 +490,6 @@ hv_kbd_intr(hv_kbd_sc *sc) int hvkbd_driver_load(module_t mod, int what, void *arg) { - -#ifdef KLD_MODULE switch (what) { case MOD_LOAD: kbd_add_driver(_kbd_driver); @@ -500,7 +498,6 @@ hvkbd_driver_load(module_t mod, int what, void *arg) kbd_delete_driver(_kbd_driver); break; } -#endif return (0); } Modified: head/sys/dev/kbdmux/kbdmux.c == --- head/sys/dev/kbdmux/kbdmux.cThu Dec 26 16:58:11 2019 (r356090) +++ head/sys/dev/kbdmux/kbdmux.cThu Dec 26 17:09:36 2019 (r356091) @@ -1423,15 +1423,11 @@ kbdmux_modevent(module_t mod, int type, void *data) switch (type) { case MOD_LOAD: -#ifdef KLD_MODULE if ((error = kbd_add_driver(_kbd_driver)) != 0) break; -#endif if ((sw = kbd_get_switch(KEYBOARD_NAME)) == NULL) { -#ifdef KLD_MODULE kbd_delete_driver(_kbd_driver); -#endif error = ENXIO; break; } @@ -1440,18 +1436,14 @@ kbdmux_modevent(module_t mod, int type, void *data) if ((error = (*sw->probe)(0, NULL, 0)) != 0 || (error = (*sw->init)(0, , NULL, 0)) != 0) { -#ifdef KLD_MODULE kbd_delete_driver(_kbd_driver); -#endif break; } #ifdef KBD_INSTALL_CDEV if ((error = kbd_attach(kbd)) != 0) { (*sw->term)(kbd); -#ifdef KLD_MODULE kbd_delete_driver(_kbd_driver); -#endif break; } #endif @@ -1462,9 +1454,7 @@ kbdmux_modevent(module_t mod, int type, void *data) kbd_detach(kbd); #endif (*sw->term)(kbd); -#ifdef KLD_MODULE kbd_delete_driver(_kbd_driver); -#endif break; } break; @@ -1480,9 +1470,7 @@ kbdmux_modevent(module_t mod, int type, void *data) kbd_detach(kbd); #endif (*sw->term)(kbd); -#ifdef KLD_MODULE kbd_delete_driver(_kbd_driver); -#endif } error = 0; break; Modified: head/sys/dev/usb/input/ukbd.c == --- head/sys/dev/usb/input/ukbd.c Thu Dec 26
svn commit: r356090 - stable/11/sys/dev/oce
Author: markj Date: Thu Dec 26 16:58:11 2019 New Revision: 356090 URL: https://svnweb.freebsd.org/changeset/base/356090 Log: MFC r356047: oce: Disallow the passthrough ioctl for unprivileged users. Modified: stable/11/sys/dev/oce/oce_if.c stable/11/sys/dev/oce/oce_if.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/oce/oce_if.c == --- stable/11/sys/dev/oce/oce_if.c Thu Dec 26 16:56:42 2019 (r356089) +++ stable/11/sys/dev/oce/oce_if.c Thu Dec 26 16:58:11 2019 (r356090) @@ -616,6 +616,9 @@ oce_ioctl(struct ifnet *ifp, u_long command, caddr_t d break; case SIOCGPRIVATE_0: + rc = priv_check(curthread, PRIV_DRIVER); + if (rc != 0) + break; rc = oce_handle_passthrough(ifp, data); break; default: Modified: stable/11/sys/dev/oce/oce_if.h == --- stable/11/sys/dev/oce/oce_if.h Thu Dec 26 16:56:42 2019 (r356089) +++ stable/11/sys/dev/oce/oce_if.h Thu Dec 26 16:58:11 2019 (r356090) @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r356089 - stable/12/sys/dev/oce
Author: markj Date: Thu Dec 26 16:56:42 2019 New Revision: 356089 URL: https://svnweb.freebsd.org/changeset/base/356089 Log: MFC r356047: oce: Disallow the passthrough ioctl for unprivileged users. Modified: stable/12/sys/dev/oce/oce_if.c stable/12/sys/dev/oce/oce_if.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/oce/oce_if.c == --- stable/12/sys/dev/oce/oce_if.c Thu Dec 26 15:47:19 2019 (r356088) +++ stable/12/sys/dev/oce/oce_if.c Thu Dec 26 16:56:42 2019 (r356089) @@ -620,6 +620,9 @@ oce_ioctl(struct ifnet *ifp, u_long command, caddr_t d break; case SIOCGPRIVATE_0: + rc = priv_check(curthread, PRIV_DRIVER); + if (rc != 0) + break; rc = oce_handle_passthrough(ifp, data); break; default: Modified: stable/12/sys/dev/oce/oce_if.h == --- stable/12/sys/dev/oce/oce_if.h Thu Dec 26 15:47:19 2019 (r356088) +++ stable/12/sys/dev/oce/oce_if.h Thu Dec 26 16:56:42 2019 (r356089) @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r356088 - head/sys/kern
Author: kevans Date: Thu Dec 26 15:47:19 2019 New Revision: 356088 URL: https://svnweb.freebsd.org/changeset/base/356088 Log: kern_cons: add a stub kbdinit for configs with no keyboard/console drivers A weak symbol here is decidedly cleaner than any #ifdef soup or relocating kbdinit, the former leading to maintenance required on addition of any console/keyboard drivers and the latter pushing kbd init bits away from where they're used. Modified: head/sys/kern/kern_cons.c Modified: head/sys/kern/kern_cons.c == --- head/sys/kern/kern_cons.c Thu Dec 26 15:21:34 2019(r356087) +++ head/sys/kern/kern_cons.c Thu Dec 26 15:47:19 2019(r356088) @@ -110,6 +110,19 @@ static struct consdev cons_consdev; DATA_SET(cons_set, cons_consdev); SET_DECLARE(cons_set, struct consdev); +/* + * Stub for configurations that don't actually have a keyboard driver. Inclusion + * of kbd.c is contingent on any number of keyboard/console drivers being + * present in the kernel; rather than trying to catch them all, we'll just + * maintain this weak kbdinit that will be overridden by the strong version in + * kbd.c if it's present. + */ +__weak_symbol void +kbdinit(void) +{ + +} + void cninit(void) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r356087 - in head/sys: dev/kbd kern
Author: kevans Date: Thu Dec 26 15:21:34 2019 New Revision: 356087 URL: https://svnweb.freebsd.org/changeset/base/356087 Log: kbd: merge linker set drivers into standard kbd driver list This leads to the revert of r355806; this reduces duplication in keyboard registration and driver switch lookup and leaves us with one authoritative source for currently registered drivers. The reduced duplication later is nice as we have more procedure involved in keyboard setup. keyboard_driver->flags is used to more quickly detect bogus adds/removes. From KPI consumers' perspective, nothing changes- kbd_add_driver of an already-registered driver will succeed, and a single kbd_delete_driver will later remove it as expected. In contrast to historical behavior, kbd_delete_driver on a driver registered via linker set will now actually de-register the driver so that it may not be used -- e.g. if kbdmux's MOD_LOAD handler fails somewhere. Detection for already-registered drivers in kbd_add_driver has improved, as the previous SLIST_NEXT(driver) != NULL check would not have caught a driver that's at the tail end. kbdinit is now called from cninit() rather than via SYSINIT so that keyboard drivers are available as early as console drivers. This is particularly important as cnprobe will, in both syscons and vt, attempt to do any early configuration of keyboard drivers built-in (see: kbd_configure). Reviewed by: imp (earlier version, pre-cninit change) Differential Revision:https://reviews.freebsd.org/D22835 Modified: head/sys/dev/kbd/kbd.c head/sys/dev/kbd/kbdreg.h head/sys/kern/kern_cons.c Modified: head/sys/dev/kbd/kbd.c == --- head/sys/dev/kbd/kbd.c Thu Dec 26 02:22:38 2019(r356086) +++ head/sys/dev/kbd/kbd.c Thu Dec 26 15:21:34 2019(r356087) @@ -70,7 +70,7 @@ static void genkbd_diag(keyboard_t *kbd, int level); static SLIST_HEAD(, keyboard_driver) keyboard_drivers = SLIST_HEAD_INITIALIZER(keyboard_drivers); -SET_DECLARE(kbddriver_set, const keyboard_driver_t); +SET_DECLARE(kbddriver_set, keyboard_driver_t); /* local arrays */ @@ -163,12 +163,18 @@ kbd_set_maps(keyboard_t *kbd, keymap_t *keymap, accent int kbd_add_driver(keyboard_driver_t *driver) { - if (SLIST_NEXT(driver, link)) - return (EINVAL); + + if ((driver->flags & KBDF_REGISTERED) != 0) + return (0); + + KASSERT(SLIST_NEXT(driver, link) == NULL, + ("%s: keyboard driver list garbage detected", __func__)); if (driver->kbdsw->get_fkeystr == NULL) driver->kbdsw->get_fkeystr = genkbd_get_fkeystr; if (driver->kbdsw->diag == NULL) driver->kbdsw->diag = genkbd_diag; + + driver->flags |= KBDF_REGISTERED; SLIST_INSERT_HEAD(_drivers, driver, link); return (0); } @@ -176,6 +182,11 @@ kbd_add_driver(keyboard_driver_t *driver) int kbd_delete_driver(keyboard_driver_t *driver) { + + if ((driver->flags & KBDF_REGISTERED) == 0) + return (EINVAL); + + driver->flags &= ~KBDF_REGISTERED; SLIST_REMOVE(_drivers, driver, keyboard_driver, link); SLIST_NEXT(driver, link) = NULL; return (0); @@ -185,7 +196,6 @@ kbd_delete_driver(keyboard_driver_t *driver) int kbd_register(keyboard_t *kbd) { - const keyboard_driver_t **list; const keyboard_driver_t *p; keyboard_t *mux; keyboard_info_t ki; @@ -226,24 +236,7 @@ kbd_register(keyboard_t *kbd) return (index); } } - SET_FOREACH(list, kbddriver_set) { - p = *list; - if (strcmp(p->name, kbd->kb_name) == 0) { - kbd->kb_drv = p; - keyboard[index] = kbd; - if (mux != NULL) { - bzero(, sizeof(ki)); - strcpy(ki.kb_name, kbd->kb_name); - ki.kb_unit = kbd->kb_unit; - - (void)kbdd_ioctl(mux, KBADDKBD, (caddr_t) ); - } - - return (index); - } - } - return (-1); } @@ -282,18 +275,12 @@ kbd_unregister(keyboard_t *kbd) keyboard_switch_t * kbd_get_switch(char *driver) { - const keyboard_driver_t **list; const keyboard_driver_t *p; SLIST_FOREACH(p, _drivers, link) { if (strcmp(p->name, driver) == 0) return (p->kbdsw); } - SET_FOREACH(list, kbddriver_set) { - p = *list; - if (strcmp(p->name, driver) == 0) - return (p->kbdsw); - } return (NULL); } @@ -435,18 +422,12 @@ kbd_get_keyboard(int index) int kbd_configure(int flags) { - const keyboard_driver_t **list;