svn commit: r368587 - head/sys/dev/amdtemp
Author: cem Date: Sat Dec 12 19:43:38 2020 New Revision: 368587 URL: https://svnweb.freebsd.org/changeset/base/368587 Log: amdtemp(4): Add missing Family 17h models Add missing model numbers M20h (Dali, Zen1), M60H (Renoir, Zen2), and M90H (Van Gogh, Zen2). Submitted by: Greg V Modified: head/sys/dev/amdtemp/amdtemp.c Modified: head/sys/dev/amdtemp/amdtemp.c == --- head/sys/dev/amdtemp/amdtemp.c Sat Dec 12 19:34:12 2020 (r368586) +++ head/sys/dev/amdtemp/amdtemp.c Sat Dec 12 19:43:38 2020 (r368587) @@ -811,11 +811,12 @@ amdtemp_probe_ccd_sensors17h(device_t dev, uint32_t mo uint32_t maxreg; switch (model) { - case 0x00 ... 0x1f: /* Zen1, Zen+ */ + case 0x00 ... 0x2f: /* Zen1, Zen+ */ maxreg = 4; break; - case 0x30 ... 0x3f: /* Zen2 TR/EPYC */ - case 0x70 ... 0x7f: /* Zen2 Ryzen */ + case 0x30 ... 0x3f: /* Zen2 TR (Castle Peak)/EPYC (Rome) */ + case 0x60 ... 0x7f: /* Zen2 Ryzen (Renoir APU, Matisse) */ + case 0x90 ... 0x9f: /* Zen2 Ryzen (Van Gogh APU) */ maxreg = 8; _Static_assert((int)NUM_CCDS >= 8, ""); 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: r368586 - in head/sys/dev: amdsmn amdtemp
Author: cem Date: Sat Dec 12 19:34:12 2020 New Revision: 368586 URL: https://svnweb.freebsd.org/changeset/base/368586 Log: amdsmn(4), amdtemp(4): add support for Family 19h (Zen 3) Zen 3 "Vermeer" support, tested on Ryzen 9 5950X. Model numbers from https://en.wikichip.org/wiki/amd/cpuid "Extended Model" column. Submitted by: Greg V Differential Revision:https://reviews.freebsd.org/D27552 Modified: head/sys/dev/amdsmn/amdsmn.c head/sys/dev/amdtemp/amdtemp.c Modified: head/sys/dev/amdsmn/amdsmn.c == --- head/sys/dev/amdsmn/amdsmn.cSat Dec 12 18:34:15 2020 (r368585) +++ head/sys/dev/amdsmn/amdsmn.cSat Dec 12 19:34:12 2020 (r368586) @@ -59,7 +59,7 @@ __FBSDID("$FreeBSD$"); #definePCI_DEVICE_ID_AMD_15H_M60H_ROOT 0x1576 #definePCI_DEVICE_ID_AMD_17H_ROOT 0x1450 #definePCI_DEVICE_ID_AMD_17H_M10H_ROOT 0x15d0 -#definePCI_DEVICE_ID_AMD_17H_M30H_ROOT 0x1480 /* Also M70H. */ +#definePCI_DEVICE_ID_AMD_17H_M30H_ROOT 0x1480 /* Also M70H, F19H M00H/M20H */ #definePCI_DEVICE_ID_AMD_17H_M60H_ROOT 0x1630 struct pciid; @@ -187,6 +187,7 @@ amdsmn_probe(device_t dev) switch (family) { case 0x15: case 0x17: + case 0x19: break; default: return (ENXIO); Modified: head/sys/dev/amdtemp/amdtemp.c == --- head/sys/dev/amdtemp/amdtemp.c Sat Dec 12 18:34:15 2020 (r368585) +++ head/sys/dev/amdtemp/amdtemp.c Sat Dec 12 19:34:12 2020 (r368586) @@ -106,7 +106,7 @@ struct amdtemp_softc { #defineDEVICEID_AMD_MISC16_M30H0x1583 #defineDEVICEID_AMD_HOSTB17H_ROOT 0x1450 #defineDEVICEID_AMD_HOSTB17H_M10H_ROOT 0x15d0 -#defineDEVICEID_AMD_HOSTB17H_M30H_ROOT 0x1480 /* Also M70h. */ +#defineDEVICEID_AMD_HOSTB17H_M30H_ROOT 0x1480 /* Also M70H, F19H M00H/M20H */ #defineDEVICEID_AMD_HOSTB17H_M60H_ROOT 0x1630 static const struct amdtemp_product { @@ -207,6 +207,7 @@ static int32_t amdtemp_gettemp(device_t dev, amdsensor static int32_t amdtemp_gettemp15hm60h(device_t dev, amdsensor_t sensor); static int32_t amdtemp_gettemp17h(device_t dev, amdsensor_t sensor); static voidamdtemp_probe_ccd_sensors17h(device_t dev, uint32_t model); +static voidamdtemp_probe_ccd_sensors19h(device_t dev, uint32_t model); static int amdtemp_sysctl(SYSCTL_HANDLER_ARGS); static device_method_t amdtemp_methods[] = { @@ -294,6 +295,7 @@ amdtemp_probe(device_t dev) case 0x15: case 0x16: case 0x17: + case 0x19: break; default: return (ENXIO); @@ -451,6 +453,7 @@ amdtemp_attach(device_t dev) sc->sc_gettemp = amdtemp_gettemp; break; case 0x17: + case 0x19: sc->sc_ntemps = 1; sc->sc_gettemp = amdtemp_gettemp17h; needsmn = true; @@ -509,6 +512,8 @@ amdtemp_attach(device_t dev) if (family == 0x17) amdtemp_probe_ccd_sensors17h(dev, model); + else if (family == 0x19) + amdtemp_probe_ccd_sensors19h(dev, model); else if (sc->sc_ntemps > 1) { SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(sysctlnode), @@ -773,28 +778,13 @@ amdtemp_gettemp17h(device_t dev, amdsensor_t sensor) } static void -amdtemp_probe_ccd_sensors17h(device_t dev, uint32_t model) +amdtemp_probe_ccd_sensors(device_t dev, uint32_t maxreg) { char sensor_name[16], sensor_descr[32]; struct amdtemp_softc *sc; - uint32_t maxreg, i, val; + uint32_t i, val; int error; - switch (model) { - case 0x00 ... 0x1f: /* Zen1, Zen+ */ - maxreg = 4; - break; - case 0x30 ... 0x3f: /* Zen2 TR/Epyc */ - case 0x70 ... 0x7f: /* Zen2 Ryzen */ - maxreg = 8; - _Static_assert((int)NUM_CCDS >= 8, ""); - break; - default: - device_printf(dev, - "Unrecognized Family 17h Model: %02xh\n", model); - return; - } - sc = device_get_softc(dev); for (i = 0; i < maxreg; i++) { error = amdsmn_read(sc->sc_smn, AMDTEMP_17H_CCD_TMP_BASE + @@ -813,4 +803,47 @@ amdtemp_probe_ccd_sensors17h(device_t dev, uint32_t mo sensor_name, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, dev, CCD_BASE + i, amdtemp_sysctl, "IK", sensor_descr); } +} + +static void +amdtemp_probe_ccd_sensors17h(device_t dev, uint32_t model) +{ + uint32_t maxreg; + + switch (model) { + case 0x00 ... 0x1f: /* Zen1, Zen+ */ + maxreg = 4; +
svn commit: r368374 - head/sys/dev/atkbdc
Author: cem Date: Sat Dec 5 22:04:30 2020 New Revision: 368374 URL: https://svnweb.freebsd.org/changeset/base/368374 Log: atkbd(4): Just use nitems() for quirk enumeration Reviewed by: imp, wulf X-MFC-With: r368365 Differential Revision:https://reviews.freebsd.org/D27489 Modified: head/sys/dev/atkbdc/atkbdc.c Modified: head/sys/dev/atkbdc/atkbdc.c == --- head/sys/dev/atkbdc/atkbdc.cSat Dec 5 19:44:00 2020 (r368373) +++ head/sys/dev/atkbdc/atkbdc.cSat Dec 5 22:04:30 2020 (r368374) @@ -119,7 +119,6 @@ static struct atkbdc_quirks quirks[] = { KBDC_QUIRK_RESET_AFTER_PROBE | KBDC_QUIRK_SETLEDS_ON_INIT}, /* KBDC hangs on Lenovo X120e and X121e after disabling AUX MUX */ {NULL, "LENOVO", NULL, KBDC_QUIRK_DISABLE_MUX_PROBE}, -{NULL, NULL, NULL, 0} }; #define QUIRK_STR_MATCH(s1, s2) (s1 == NULL || \ @@ -133,8 +132,7 @@ atkbdc_getquirks(void) char* maker = kern_getenv("smbios.system.maker"); char* product = kern_getenv("smbios.system.product"); -for (i=0; quirks[i].bios_vendor != NULL || quirks[i].maker != NULL || - quirks[i].product != NULL; ++i) +for (i = 0; i < nitems(quirks); i++) if (QUIRK_STR_MATCH(quirks[i].bios_vendor, bios_vendor) && QUIRK_STR_MATCH(quirks[i].maker, maker) && QUIRK_STR_MATCH(quirks[i].product, product)) ___ 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: r368354 - in head: lib/libc/powerpc lib/libc/powerpc64 lib/libc/powerpc64/sys lib/libthr/arch/i386/i386 lib/msun/i387 libexec/rtld-elf/aarch64 libexec/rtld-elf/powerpc libexec/rtld-elf/...
Author: cem Date: Sat Dec 5 00:33:28 2020 New Revision: 368354 URL: https://svnweb.freebsd.org/changeset/base/368354 Log: Add CFI start/end proc directives to arm64, i386, and ppc Follow-up to r353959 and r368070: do the same for other architectures. arm32 already seems to use its own .fnstart/.fnend directives, which appear to be ARM-specific variants of the same thing. Likewise, MIPS uses .frame directives. Reviewed by: arichardson Differential Revision:https://reviews.freebsd.org/D27387 Modified: head/lib/libc/powerpc/SYS.h head/lib/libc/powerpc64/SYS.h head/lib/libc/powerpc64/sys/cerror.S head/lib/libthr/arch/i386/i386/_umtx_op_err.S head/lib/msun/i387/e_logf.S head/lib/msun/i387/e_remainderl.S head/lib/msun/i387/e_sqrtl.S head/lib/msun/i387/s_llrintl.S head/lib/msun/i387/s_logbl.S head/lib/msun/i387/s_lrintl.S head/lib/msun/i387/s_remquol.S head/lib/msun/i387/s_rintl.S head/libexec/rtld-elf/aarch64/rtld_start.S head/libexec/rtld-elf/powerpc/rtld_start.S head/libexec/rtld-elf/powerpc64/rtld_start.S head/stand/libsa/powerpc/_setjmp.S head/stand/powerpc/kboot/host_syscall.S head/stand/powerpc/uboot/start.S head/sys/arm64/include/asm.h head/sys/arm64/linux/linux_locore.asm head/sys/arm64/linux/linux_support.s head/sys/crypto/des/arch/i386/des_enc.S head/sys/i386/bios/smapi_bios.S head/sys/i386/include/asm.h head/sys/powerpc/aim/locore.S head/sys/powerpc/aim/locore64.S head/sys/powerpc/aim/trap_subr64.S head/sys/powerpc/booke/locore.S head/sys/powerpc/booke/trap_subr.S head/sys/powerpc/include/asm.h head/sys/powerpc/mambo/mambocall.S head/sys/powerpc/ofw/ofwcall32.S head/sys/powerpc/ofw/ofwcall64.S head/sys/powerpc/powernv/opalcall.S head/sys/powerpc/powerpc/cpu_subr64.S head/sys/powerpc/powerpc/setjmp.S head/sys/powerpc/powerpc/support.S head/sys/powerpc/powerpc/swtch32.S head/sys/powerpc/powerpc/swtch64.S head/sys/powerpc/ps3/ps3-hvcall.S head/sys/powerpc/pseries/phyp-hvcall.S Modified: head/lib/libc/powerpc/SYS.h == --- head/lib/libc/powerpc/SYS.h Fri Dec 4 21:51:47 2020(r368353) +++ head/lib/libc/powerpc/SYS.h Sat Dec 5 00:33:28 2020(r368354) @@ -58,7 +58,8 @@ ENTRY(__sys_##name); \ WEAK_REFERENCE(__sys_##name, _##name); \ _SYSCALL(name); \ bnslr; \ - b CNAME(HIDENAME(cerror)) + b CNAME(HIDENAME(cerror));\ +END(__sys_##name) #defineRSYSCALL(name) \ .text; \ @@ -68,4 +69,5 @@ ENTRY(__sys_##name); \ WEAK_REFERENCE(__sys_##name, _##name); \ _SYSCALL(name); \ bnslr; \ - b CNAME(HIDENAME(cerror)) + b CNAME(HIDENAME(cerror));\ +END(__sys_##name) Modified: head/lib/libc/powerpc64/SYS.h == --- head/lib/libc/powerpc64/SYS.h Fri Dec 4 21:51:47 2020 (r368353) +++ head/lib/libc/powerpc64/SYS.h Sat Dec 5 00:33:28 2020 (r368354) @@ -74,7 +74,8 @@ ENTRY(__sys_##name); \ addi%r1,%r1,48; \ ld %r0,16(%r1);\ mtlr%r0;\ - blr; + blr;\ +END(__sys_##name) #defineRSYSCALL(name) \ .text; \ @@ -93,4 +94,5 @@ ENTRY(__sys_##name); \ addi%r1,%r1,48; \ ld %r0,16(%r1);\ mtlr%r0;\ - blr; + blr;\ +END(__sys_##name) Modified: head/lib/libc/powerpc64/sys/cerror.S == --- head/lib/libc/powerpc64/sys/cerror.SFri Dec 4 21:51:47 2020 (r368353) +++ head/lib/libc/powerpc64/sys/cerror.SSat Dec 5 00:33:28 2020 (r368354) @@ -56,5 +56,6 @@ ENTRY_NOPROF(HIDENAME(cerror)) li %r3,-1 li %r4,-1 blr +END(HIDENAME(cerror)) .section .note.GNU-stack,"",%progbits Modified: head/lib/libthr/arch/i386/i386/_umtx_op_err.S
svn commit: r367817 - head/sys/fs/msdosfs
Author: cem Date: Wed Nov 18 20:20:03 2020 New Revision: 367817 URL: https://svnweb.freebsd.org/changeset/base/367817 Log: msdosfs(5): Fix debug-only format string No functional change; MSDOSFS_DEBUG isn't a real build option, so this isn't covered by LINT kernels. Modified: head/sys/fs/msdosfs/msdosfs_vfsops.c Modified: head/sys/fs/msdosfs/msdosfs_vfsops.c == --- head/sys/fs/msdosfs/msdosfs_vfsops.cWed Nov 18 20:00:55 2020 (r367816) +++ head/sys/fs/msdosfs/msdosfs_vfsops.cWed Nov 18 20:20:03 2020 (r367817) @@ -792,7 +792,7 @@ msdosfs_unmount(struct mount *mp, int mntflags) printf("freef %p, freeb %p, mount %p\n", TAILQ_NEXT(vp, v_vnodelist), vp->v_vnodelist.tqe_prev, vp->v_mount); - printf("cleanblkhd %p, dirtyblkhd %p, numoutput %ld, type %d\n", + printf("cleanblkhd %p, dirtyblkhd %p, numoutput %d, type %d\n", TAILQ_FIRST(>v_bufobj.bo_clean.bv_hd), TAILQ_FIRST(>v_bufobj.bo_dirty.bv_hd), vp->v_bufobj.bo_numoutput, vp->v_type); ___ 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: r367778 - in head/sys: compat/linux kern sys
Author: cem Date: Tue Nov 17 21:20:11 2020 New Revision: 367778 URL: https://svnweb.freebsd.org/changeset/base/367778 Log: linux(4) clone(2): Correctly handle CLONE_FS and CLONE_FILES The two flags are distinct and it is impossible to correctly handle clone(2) without the assistance of fork1(). This change depends on the pwddesc split introduced in r36. I've added a fork_req flag, FR2_SHARE_PATHS, which indicates that p_pd should be treated the opposite way p_fd is (based on RFFDG flag). This is a little ugly, but the benefit is that existing RFFDG API is preserved. Holding FR2_SHARE_PATHS disabled, RFFDG indicates both p_fd and p_pd are copied, while !RFFDG indicates both should be cloned. In Chrome, clone(2) is used with CLONE_FS, without CLONE_FILES, and expects independent fd tables. The previous conflation of CLONE_FS and CLONE_FILES was introduced in r163371 (2006). Discussed with: markj, trasz (earlier version) Differential Revision:https://reviews.freebsd.org/D27016 Modified: head/sys/compat/linux/linux_fork.c head/sys/kern/kern_fork.c head/sys/sys/proc.h Modified: head/sys/compat/linux/linux_fork.c == --- head/sys/compat/linux/linux_fork.c Tue Nov 17 21:14:13 2020 (r36) +++ head/sys/compat/linux/linux_fork.c Tue Nov 17 21:20:11 2020 (r367778) @@ -131,12 +131,13 @@ static int linux_clone_proc(struct thread *td, struct linux_clone_args *args) { struct fork_req fr; - int error, ff = RFPROC | RFSTOPPED; + int error, ff = RFPROC | RFSTOPPED, f2; struct proc *p2; struct thread *td2; int exit_signal; struct linux_emuldata *em; + f2 = 0; exit_signal = args->flags & 0x00ff; if (LINUX_SIG_VALID(exit_signal)) { exit_signal = linux_to_bsd_signal(exit_signal); @@ -147,14 +148,14 @@ linux_clone_proc(struct thread *td, struct linux_clone ff |= RFMEM; if (args->flags & LINUX_CLONE_SIGHAND) ff |= RFSIGSHARE; - /* -* XXX: In Linux, sharing of fs info (chroot/cwd/umask) -* and open files is independent. In FreeBSD, its in one -* structure but in reality it does not cause any problems -* because both of these flags are usually set together. -*/ - if (!(args->flags & (LINUX_CLONE_FILES | LINUX_CLONE_FS))) + if (args->flags & LINUX_CLONE_FILES) { + if (!(args->flags & LINUX_CLONE_FS)) + f2 |= FR2_SHARE_PATHS; + } else { ff |= RFFDG; + if (args->flags & LINUX_CLONE_FS) + f2 |= FR2_SHARE_PATHS; + } if (args->flags & LINUX_CLONE_PARENT_SETTID) if (args->parent_tidptr == NULL) @@ -165,6 +166,7 @@ linux_clone_proc(struct thread *td, struct linux_clone bzero(, sizeof(fr)); fr.fr_flags = ff; + fr.fr_flags2 = f2; fr.fr_procp = error = fork1(td, ); if (error) Modified: head/sys/kern/kern_fork.c == --- head/sys/kern/kern_fork.c Tue Nov 17 21:14:13 2020(r36) +++ head/sys/kern/kern_fork.c Tue Nov 17 21:20:11 2020(r367778) @@ -414,11 +414,17 @@ do_fork(struct thread *td, struct fork_req *fr, struct fd = fdinit(p1->p_fd, false, NULL); fdtol = NULL; } else if (fr->fr_flags & RFFDG) { - pd = pdcopy(p1->p_pd); + if (fr->fr_flags2 & FR2_SHARE_PATHS) + pd = pdshare(p1->p_pd); + else + pd = pdcopy(p1->p_pd); fd = fdcopy(p1->p_fd); fdtol = NULL; } else { - pd = pdshare(p1->p_pd); + if (fr->fr_flags2 & FR2_SHARE_PATHS) + pd = pdcopy(p1->p_pd); + else + pd = pdshare(p1->p_pd); fd = fdshare(p1->p_fd); if (p1->p_fdtol == NULL) p1->p_fdtol = filedesc_to_leader_alloc(NULL, NULL, Modified: head/sys/sys/proc.h == --- head/sys/sys/proc.h Tue Nov 17 21:14:13 2020(r36) +++ head/sys/sys/proc.h Tue Nov 17 21:20:11 2020(r367778) @@ -1017,7 +1017,8 @@ structfork_req { int fr_pd_flags; struct filecaps *fr_pd_fcaps; int fr_flags2; -#defineFR2_DROPSIG_CAUGHT 0x1 /* Drop caught non-DFL signals */ +#defineFR2_DROPSIG_CAUGHT 0x0001 /* Drop caught non-DFL signals */ +#defineFR2_SHARE_PATHS 0x0002 /* Invert sense of RFFDG for paths */ }; /* ___ svn-src-all@freebsd.org mailing
svn commit: r367777 - in head: lib/libkvm lib/libprocstat sys/compat/cloudabi sys/fs/fuse sys/fs/unionfs sys/kern sys/sys
Author: cem Date: Tue Nov 17 21:14:13 2020 New Revision: 36 URL: https://svnweb.freebsd.org/changeset/base/36 Log: Split out cwd/root/jail, cmask state from filedesc table No functional change intended. Tracking these structures separately for each proc enables future work to correctly emulate clone(2) in linux(4). __FreeBSD_version is bumped (to 1300130) for consumption by, e.g., lsof. Reviewed by: kib Discussed with: markj, mjg Differential Revision:https://reviews.freebsd.org/D27037 Modified: head/lib/libkvm/kvm_proc.c head/lib/libprocstat/libprocstat.c head/sys/compat/cloudabi/cloudabi_file.c head/sys/fs/fuse/fuse_internal.c head/sys/fs/fuse/fuse_vnops.c head/sys/fs/unionfs/union_subr.c head/sys/kern/imgact_elf.c head/sys/kern/init_main.c head/sys/kern/kern_descrip.c head/sys/kern/kern_exec.c head/sys/kern/kern_exit.c head/sys/kern/kern_fork.c head/sys/kern/kern_proc.c head/sys/kern/kern_thread.c head/sys/kern/uipc_mqueue.c head/sys/kern/uipc_sem.c head/sys/kern/uipc_shm.c head/sys/kern/uipc_usrreq.c head/sys/kern/vfs_syscalls.c head/sys/sys/filedesc.h head/sys/sys/param.h head/sys/sys/proc.h head/sys/sys/user.h Modified: head/lib/libkvm/kvm_proc.c == --- head/lib/libkvm/kvm_proc.c Tue Nov 17 20:01:21 2020(r367776) +++ head/lib/libkvm/kvm_proc.c Tue Nov 17 21:14:13 2020(r36) @@ -221,6 +221,7 @@ kvm_proclist(kvm_t *kd, int what, int arg, struct proc kp->ki_tracep = proc.p_tracevp; kp->ki_textvp = proc.p_textvp; kp->ki_fd = proc.p_fd; + kp->ki_pd = proc.p_pd; kp->ki_vmspace = proc.p_vmspace; if (proc.p_sigacts != NULL) { if (KREAD(kd, (u_long)proc.p_sigacts, )) { Modified: head/lib/libprocstat/libprocstat.c == --- head/lib/libprocstat/libprocstat.c Tue Nov 17 20:01:21 2020 (r367776) +++ head/lib/libprocstat/libprocstat.c Tue Nov 17 21:14:13 2020 (r36) @@ -460,6 +460,7 @@ procstat_getfiles_kvm(struct procstat *procstat, struc { struct file file; struct filedesc filed; + struct pwddesc pathsd; struct fdescenttbl *fdt; struct pwd pwd; unsigned long pwd_addr; @@ -484,15 +485,20 @@ procstat_getfiles_kvm(struct procstat *procstat, struc kd = procstat->kd; if (kd == NULL) return (NULL); - if (kp->ki_fd == NULL) + if (kp->ki_fd == NULL || kp->ki_pd == NULL) return (NULL); if (!kvm_read_all(kd, (unsigned long)kp->ki_fd, , sizeof(filed))) { warnx("can't read filedesc at %p", (void *)kp->ki_fd); return (NULL); } + if (!kvm_read_all(kd, (unsigned long)kp->ki_pd, , + sizeof(pathsd))) { + warnx("can't read pwddesc at %p", (void *)kp->ki_pd); + return (NULL); + } haspwd = false; - pwd_addr = (unsigned long)(FILEDESC_KVM_LOAD_PWD()); + pwd_addr = (unsigned long)(PWDDESC_KVM_LOAD_PWD()); if (pwd_addr != 0) { if (!kvm_read_all(kd, pwd_addr, , sizeof(pwd))) { warnx("can't read fd_pwd at %p", (void *)pwd_addr); @@ -2086,18 +2092,18 @@ procstat_freegroups(struct procstat *procstat __unused static int procstat_getumask_kvm(kvm_t *kd, struct kinfo_proc *kp, unsigned short *maskp) { - struct filedesc fd; + struct pwddesc pd; assert(kd != NULL); assert(kp != NULL); - if (kp->ki_fd == NULL) + if (kp->ki_pd == NULL) return (-1); - if (!kvm_read_all(kd, (unsigned long)kp->ki_fd, , sizeof(fd))) { - warnx("can't read filedesc at %p for pid %d", kp->ki_fd, + if (!kvm_read_all(kd, (unsigned long)kp->ki_pd, , sizeof(pd))) { + warnx("can't read pwddesc at %p for pid %d", kp->ki_pd, kp->ki_pid); return (-1); } - *maskp = fd.fd_cmask; + *maskp = pd.pd_cmask; return (0); } Modified: head/sys/compat/cloudabi/cloudabi_file.c == --- head/sys/compat/cloudabi/cloudabi_file.cTue Nov 17 20:01:21 2020 (r367776) +++ head/sys/compat/cloudabi/cloudabi_file.cTue Nov 17 21:14:13 2020 (r36) @@ -265,7 +265,7 @@ cloudabi_sys_file_open(struct thread *td, } NDINIT_ATRIGHTS(, LOOKUP, FOLLOW, UIO_SYSSPACE, path, uap->dirfd.fd, , td); - error = vn_open(, , 0777 & ~td->td_proc->p_fd->fd_cmask, fp); + error = vn_open(, , 0777 & ~td->td_proc->p_pd->pd_cmask, fp); cloudabi_freestr(path); if (error != 0) { /* Custom operations provided. */
svn commit: r367776 - in head: share/man/man4 sys/compat/linux sys/kern sys/sys
Author: cem Date: Tue Nov 17 20:01:21 2020 New Revision: 367776 URL: https://svnweb.freebsd.org/changeset/base/367776 Log: unix(4): Enhance LOCAL_CREDS_PERSISTENT ABI As this ABI is still fresh (r367287), let's correct some mistakes now: - Version the structure to allow for future changes - Include sender's pid in control message structure - Use a distinct control message type from the cmsgcred / sockcred mess Discussed with: kib, markj, trasz Differential Revision:https://reviews.freebsd.org/D27084 Modified: head/share/man/man4/unix.4 head/sys/compat/linux/linux_socket.c head/sys/kern/uipc_usrreq.c head/sys/sys/socket.h Modified: head/share/man/man4/unix.4 == --- head/share/man/man4/unix.4 Tue Nov 17 19:56:47 2020(r367775) +++ head/share/man/man4/unix.4 Tue Nov 17 20:01:21 2020(r367776) @@ -28,7 +28,7 @@ .\" @(#)unix.4 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd November 2, 2020 +.Dd November 9, 2020 .Dt UNIX 4 .Os .Sh NAME @@ -295,6 +295,41 @@ except that socket credentials are passed on every rea or .Dv SOCK_SEQPACKET socket, instead of just the first read. +Additionally, the +.Va msg_control +field in the +.Vt msghdr +structure points to a buffer that contains a +.Vt cmsghdr +structure followed by a variable length +.Vt sockcred2 +structure, defined in +.In sys/socket.h +as follows: +.Bd -literal +struct sockcred2 { + int sc_version; /* version of this structure */ + pid_tsc_pid; /* PID of sending process */ + uid_tsc_uid; /* real user id */ + uid_tsc_euid;/* effective user id */ + gid_tsc_gid; /* real group id */ + gid_tsc_egid;/* effective group id */ + int sc_ngroups; /* number of supplemental groups */ + gid_tsc_groups[1]; /* variable length */ +}; +.Ed +.Pp +The current version is zero. +.Pp +The +.Vt cmsghdr +fields have the following values: +.Bd -literal +cmsg_len = CMSG_LEN(SOCKCRED2SIZE(ngroups)) +cmsg_level = SOL_SOCKET +cmsg_type = SCM_CREDS2 +.Ed +.Pp The .Dv LOCAL_CREDS and Modified: head/sys/compat/linux/linux_socket.c == --- head/sys/compat/linux/linux_socket.cTue Nov 17 19:56:47 2020 (r367775) +++ head/sys/compat/linux/linux_socket.cTue Nov 17 20:01:21 2020 (r367776) @@ -644,6 +644,8 @@ bsd_to_linux_cmsg_type(int cmsg_type) return (LINUX_SCM_RIGHTS); case SCM_CREDS: return (LINUX_SCM_CREDENTIALS); + case SCM_CREDS2: + return (LINUX_SCM_CREDENTIALS); case SCM_TIMESTAMP: return (LINUX_SCM_TIMESTAMP); } @@ -1508,6 +1510,7 @@ linux_recvmsg_common(struct thread *td, l_int s, struc { struct cmsghdr *cm; struct cmsgcred *cmcred; + struct sockcred2 *scred; struct l_cmsghdr *linux_cmsg = NULL; struct l_ucred linux_ucred; socklen_t datalen, maxlen, outlen; @@ -1627,6 +1630,16 @@ linux_recvmsg_common(struct thread *td, l_int s, struc linux_ucred.pid = cmcred->cmcred_pid; linux_ucred.uid = cmcred->cmcred_uid; linux_ucred.gid = cmcred->cmcred_gid; + data = _ucred; + datalen = sizeof(linux_ucred); + break; + + case SCM_CREDS2: + scred = data; + bzero(_ucred, sizeof(linux_ucred)); + linux_ucred.pid = scred->sc_pid; + linux_ucred.uid = scred->sc_uid; + linux_ucred.gid = scred->sc_gid; data = _ucred; datalen = sizeof(linux_ucred); break; Modified: head/sys/kern/uipc_usrreq.c == --- head/sys/kern/uipc_usrreq.c Tue Nov 17 19:56:47 2020(r367775) +++ head/sys/kern/uipc_usrreq.c Tue Nov 17 20:01:21 2020(r367776) @@ -308,7 +308,7 @@ static int unp_internalize(struct mbuf **, struct thre static voidunp_internalize_fp(struct file *); static int unp_externalize(struct mbuf *, struct mbuf **, int); static int unp_externalize_fp(struct file *); -static struct mbuf *unp_addsockcred(struct thread *, struct mbuf *); +static struct mbuf *unp_addsockcred(struct thread *, struct mbuf *, int); static voidunp_process_defers(void * __unused, int); static void @@ -1043,7 +1043,8 @@ uipc_send(struct socket *so, int flags, struct mbuf *m } if (unp2->unp_flags & UNP_WANTCRED_MASK) - control =
svn commit: r367775 - head/sys/compat/linprocfs
Author: cem Date: Tue Nov 17 19:56:47 2020 New Revision: 367775 URL: https://svnweb.freebsd.org/changeset/base/367775 Log: linprocfs(5): Add rudimentary /proc//mountinfo This is used by some Linux programs using filehandles (r367773) to locate the mountpoint for a given fsid. Differential Revision:https://reviews.freebsd.org/D27136 Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c == --- head/sys/compat/linprocfs/linprocfs.c Tue Nov 17 19:53:59 2020 (r367774) +++ head/sys/compat/linprocfs/linprocfs.c Tue Nov 17 19:56:47 2020 (r367775) @@ -403,24 +403,85 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) } #endif /* __i386__ || __amd64__ */ +static const char *path_slash_sys = "/sys"; +static const char *fstype_sysfs = "sysfs"; + +static int +_mtab_helper(const struct pfs_node *pn, const struct statfs *sp, +const char **mntfrom, const char **mntto, const char **fstype) +{ + /* determine device name */ + *mntfrom = sp->f_mntfromname; + + /* determine mount point */ + *mntto = sp->f_mntonname; + + /* determine fs type */ + *fstype = sp->f_fstypename; + if (strcmp(*fstype, pn->pn_info->pi_name) == 0) + *mntfrom = *fstype = "proc"; + else if (strcmp(*fstype, "procfs") == 0) + return (ECANCELED); + + if (strcmp(*fstype, "autofs") == 0) { + /* +* FreeBSD uses eg "map -hosts", whereas Linux +* expects just "-hosts". +*/ + if (strncmp(*mntfrom, "map ", 4) == 0) + *mntfrom += 4; + } + + if (strcmp(*fstype, "linsysfs") == 0) { + *mntfrom = path_slash_sys; + *fstype = fstype_sysfs; + } else { + /* For Linux msdosfs is called vfat */ + if (strcmp(*fstype, "msdosfs") == 0) + *fstype = "vfat"; + } + return (0); +} + +static void +_sbuf_mntoptions_helper(struct sbuf *sb, uint64_t f_flags) +{ + sbuf_cat(sb, (f_flags & MNT_RDONLY) ? "ro" : "rw"); +#define ADD_OPTION(opt, name) \ + if (f_flags & (opt)) sbuf_cat(sb, "," name); + ADD_OPTION(MNT_SYNCHRONOUS, "sync"); + ADD_OPTION(MNT_NOEXEC, "noexec"); + ADD_OPTION(MNT_NOSUID, "nosuid"); + ADD_OPTION(MNT_UNION, "union"); + ADD_OPTION(MNT_ASYNC, "async"); + ADD_OPTION(MNT_SUIDDIR, "suiddir"); + ADD_OPTION(MNT_NOSYMFOLLOW, "nosymfollow"); + ADD_OPTION(MNT_NOATIME, "noatime"); +#undef ADD_OPTION +} + /* - * Filler function for proc/mtab + * Filler function for proc/mtab and proc//mounts. * - * This file doesn't exist in Linux' procfs, but is included here so + * /proc/mtab doesn't exist in Linux' procfs, but is included here so * users can symlink /compat/linux/etc/mtab to /proc/mtab */ static int linprocfs_domtab(PFS_FILL_ARGS) { struct nameidata nd; - const char *lep; - char *dlep, *flep, *mntto, *mntfrom, *fstype; + const char *lep, *mntto, *mntfrom, *fstype; + char *dlep, *flep; size_t lep_len; int error; struct statfs *buf, *sp; size_t count; /* resolve symlinks etc. in the emulation tree prefix */ + /* +* Ideally, this would use the current chroot rather than some +* hardcoded path. +*/ NDINIT(, LOOKUP, FOLLOW, UIO_SYSSPACE, linux_emul_path, td); flep = NULL; error = namei(); @@ -442,55 +503,112 @@ linprocfs_domtab(PFS_FILL_ARGS) } for (sp = buf; count > 0; sp++, count--) { - /* determine device name */ - mntfrom = sp->f_mntfromname; + error = _mtab_helper(pn, sp, , , ); + if (error != 0) { + MPASS(error == ECANCELED); + continue; + } /* determine mount point */ - mntto = sp->f_mntonname; if (strncmp(mntto, lep, lep_len) == 0 && mntto[lep_len] == '/') mntto += lep_len; - /* determine fs type */ - fstype = sp->f_fstypename; - if (strcmp(fstype, pn->pn_info->pi_name) == 0) - mntfrom = fstype = "proc"; - else if (strcmp(fstype, "procfs") == 0) - continue; + sbuf_printf(sb, "%s %s %s ", mntfrom, mntto, fstype); + _sbuf_mntoptions_helper(sb, sp->f_flags); + /* a real Linux mtab will also show NFS options */ + sbuf_printf(sb, " 0 0\n"); + } - if (strcmp(fstype, "autofs") == 0) { - /* -* FreeBSD uses eg "map -hosts", whereas Linux -
svn commit: r367774 - in head/sys: amd64/linux amd64/linux32 arm64/linux i386/linux
Author: cem Date: Tue Nov 17 19:53:59 2020 New Revision: 367774 URL: https://svnweb.freebsd.org/changeset/base/367774 Log: 'make sysent' for r367773 X-MFC-With: r367773 Modified: head/sys/amd64/linux/linux_proto.h head/sys/amd64/linux/linux_sysent.c head/sys/amd64/linux/linux_systrace_args.c head/sys/amd64/linux32/linux32_proto.h head/sys/amd64/linux32/linux32_sysent.c head/sys/amd64/linux32/linux32_systrace_args.c head/sys/arm64/linux/linux_proto.h head/sys/arm64/linux/linux_sysent.c head/sys/arm64/linux/linux_systrace_args.c head/sys/i386/linux/linux_proto.h head/sys/i386/linux/linux_sysent.c head/sys/i386/linux/linux_systrace_args.c Modified: head/sys/amd64/linux/linux_proto.h == --- head/sys/amd64/linux/linux_proto.h Tue Nov 17 19:51:47 2020 (r367773) +++ head/sys/amd64/linux/linux_proto.h Tue Nov 17 19:53:59 2020 (r367774) @@ -1143,10 +1143,16 @@ struct linux_prlimit64_args { char old_l_[PADL_(struct rlimit *)]; struct rlimit * old; char old_r_[PADR_(struct rlimit *)]; }; struct linux_name_to_handle_at_args { - register_t dummy; + char dirfd_l_[PADL_(l_int)]; l_int dirfd; char dirfd_r_[PADR_(l_int)]; + char name_l_[PADL_(const char *)]; const char * name; char name_r_[PADR_(const char *)]; + char handle_l_[PADL_(struct l_file_handle *)]; struct l_file_handle * handle; char handle_r_[PADR_(struct l_file_handle *)]; + char mnt_id_l_[PADL_(l_int *)]; l_int * mnt_id; char mnt_id_r_[PADR_(l_int *)]; + char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)]; }; struct linux_open_by_handle_at_args { - register_t dummy; + char mountdirfd_l_[PADL_(l_int)]; l_int mountdirfd; char mountdirfd_r_[PADR_(l_int)]; + char handle_l_[PADL_(struct l_file_handle *)]; struct l_file_handle * handle; char handle_r_[PADR_(struct l_file_handle *)]; + char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)]; }; struct linux_clock_adjtime_args { register_t dummy; Modified: head/sys/amd64/linux/linux_sysent.c == --- head/sys/amd64/linux/linux_sysent.c Tue Nov 17 19:51:47 2020 (r367773) +++ head/sys/amd64/linux/linux_sysent.c Tue Nov 17 19:53:59 2020 (r367774) @@ -320,8 +320,8 @@ struct sysent linux_sysent[] = { { .sy_narg = 0, .sy_call = (sy_call_t *)linux_fanotify_init, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 300 = linux_fanotify_init */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_fanotify_mark, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 301 = linux_fanotify_mark */ { .sy_narg = AS(linux_prlimit64_args), .sy_call = (sy_call_t *)linux_prlimit64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC },/* 302 = linux_prlimit64 */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_name_to_handle_at, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 303 = linux_name_to_handle_at */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_open_by_handle_at, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 304 = linux_open_by_handle_at */ + { .sy_narg = AS(linux_name_to_handle_at_args), .sy_call = (sy_call_t *)linux_name_to_handle_at, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC },/* 303 = linux_name_to_handle_at */ + { .sy_narg = AS(linux_open_by_handle_at_args), .sy_call = (sy_call_t *)linux_open_by_handle_at, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC },/* 304 = linux_open_by_handle_at */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_adjtime, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 305 = linux_clock_adjtime */ { .sy_narg = AS(linux_syncfs_args), .sy_call = (sy_call_t *)linux_syncfs, .sy_auevent = AUE_SYNC, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 306 = linux_syncfs */ { .sy_narg = AS(linux_sendmmsg_args), .sy_call = (sy_call_t *)linux_sendmmsg, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 307 = linux_sendmmsg */ Modified: head/sys/amd64/linux/linux_systrace_args.c == --- head/sys/amd64/linux/linux_systrace_args.c Tue Nov 17 19:51:47 2020 (r367773) +++ head/sys/amd64/linux/linux_systrace_args.c Tue Nov 17 19:53:59 2020 (r367774) @@ -2321,12 +2321,22 @@ systrace_args(int sysnum, void *params, uint64_t *uarg } /* linux_name_to_handle_at */ case 303: { - *n_args = 0; + struct linux_name_to_handle_at_args *p = params; + iarg[0] = p->dirfd; /* l_int */ + uarg[1] = (intptr_t) p->name;
svn commit: r367773 - in head/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux kern sys
Author: cem Date: Tue Nov 17 19:51:47 2020 New Revision: 367773 URL: https://svnweb.freebsd.org/changeset/base/367773 Log: linux(4): Implement name_to_handle_at(), open_by_handle_at() They are similar to our getfhat(2) and fhopen(2) syscalls. Differential Revision:https://reviews.freebsd.org/D27111 Modified: head/sys/amd64/linux/syscalls.master head/sys/amd64/linux32/syscalls.master head/sys/arm64/linux/syscalls.master head/sys/compat/linux/linux_dummy.c head/sys/compat/linux/linux_file.c head/sys/compat/linux/linux_file.h head/sys/i386/linux/syscalls.master head/sys/kern/vfs_syscalls.c head/sys/sys/syscallsubr.h Modified: head/sys/amd64/linux/syscalls.master == --- head/sys/amd64/linux/syscalls.masterTue Nov 17 18:28:20 2020 (r367772) +++ head/sys/amd64/linux/syscalls.masterTue Nov 17 19:51:47 2020 (r367773) @@ -1792,10 +1792,20 @@ } ; Linux 2.6.39 (glibc 2.14): 303AUE_NULLSTD { - int linux_name_to_handle_at(void); + int linux_name_to_handle_at( + l_int dirfd, + const char *name, + struct l_file_handle *handle, + l_int *mnt_id, + l_int flags + ); } 304AUE_NULLSTD { - int linux_open_by_handle_at(void); + int linux_open_by_handle_at( + l_int mountdirfd, + struct l_file_handle *handle, + l_int flags + ); } 305AUE_NULLSTD { int linux_clock_adjtime(void); Modified: head/sys/amd64/linux32/syscalls.master == --- head/sys/amd64/linux32/syscalls.master Tue Nov 17 18:28:20 2020 (r367772) +++ head/sys/amd64/linux32/syscalls.master Tue Nov 17 19:51:47 2020 (r367773) @@ -1916,10 +1916,20 @@ } ; Linux 2.6.39: 341AUE_NULLSTD { - int linux_name_to_handle_at(void); + int linux_name_to_handle_at( + l_int dirfd, + const char *name, + struct l_file_handle *handle, + l_int *mnt_id, + l_int flags + ); } 342AUE_NULLSTD { - int linux_open_by_handle_at(void); + int linux_open_by_handle_at( + l_int mountdirfd, + struct l_file_handle *handle, + l_int flags + ); } 343AUE_NULLSTD { int linux_clock_adjtime(void); Modified: head/sys/arm64/linux/syscalls.master == --- head/sys/arm64/linux/syscalls.masterTue Nov 17 18:28:20 2020 (r367772) +++ head/sys/arm64/linux/syscalls.masterTue Nov 17 19:51:47 2020 (r367773) @@ -1473,10 +1473,20 @@ int linux_fanotify_mark(void); } 264AUE_NULLSTD { - int linux_name_to_handle_at(void); + int linux_name_to_handle_at( + l_int dirfd, + const char *name, + struct l_file_handle *handle, + l_int *mnt_id, + l_int flags + ); } 265AUE_NULLSTD { - int linux_open_by_handle_at(void); + int linux_open_by_handle_at( + l_int mountdirfd, + struct l_file_handle *handle, + l_int flags + ); } 266AUE_NULLSTD { int linux_clock_adjtime(void); Modified: head/sys/compat/linux/linux_dummy.c == --- head/sys/compat/linux/linux_dummy.c Tue Nov 17 18:28:20 2020 (r367772) +++ head/sys/compat/linux/linux_dummy.c Tue Nov 17 19:51:47 2020 (r367773) @@ -101,8 +101,6 @@ DUMMY(perf_event_open); DUMMY(fanotify_init); DUMMY(fanotify_mark); /* Linux 2.6.39: */ -DUMMY(name_to_handle_at); -DUMMY(open_by_handle_at); DUMMY(clock_adjtime); /* Linux 3.0: */ DUMMY(setns); Modified: head/sys/compat/linux/linux_file.c == --- head/sys/compat/linux/linux_file.c Tue Nov 17 18:28:20 2020 (r367772) +++ head/sys/compat/linux/linux_file.c Tue Nov 17 19:51:47 2020 (r367773) @@ -121,13 +121,9 @@ linux_creat(struct thread *td, struct linux_creat_args #endif static int -linux_common_open(struct thread *td, int dirfd, const char *path, int l_flags, -int mode, enum uio_seg seg) +linux_common_openflags(int l_flags) { - struct proc *p = td->td_proc; - struct file
Re: svn commit: r367631 - in head/sys: kern sys
Hi Konstantin, On Fri, Nov 13, 2020 at 1:32 AM Konstantin Belousov wrote: > > Author: kib > Date: Fri Nov 13 09:31:57 2020 > New Revision: 367631 > URL: https://svnweb.freebsd.org/changeset/base/367631 > > Log: > Implement vn_lock_pair(). > > Modified: head/sys/kern/vfs_vnops.c > == > --- head/sys/kern/vfs_vnops.c Fri Nov 13 02:05:45 2020(r367630) > +++ head/sys/kern/vfs_vnops.c Fri Nov 13 09:31:57 2020(r367631) > @@ -3317,4 +3325,92 @@ vn_fallocate(struct file *fp, off_t offset, off_t len, > ... > + > +static void > +vn_lock_pair_pause(const char *wmesg) > +{ > + atomic_add_long(_lock_pair_pause_cnt, 1); > + pause(wmesg, prng32_bounded(hz / 10)); > +} This function is called when the try-lock of the second lock in the pair (either order) fails. The back-off period is up to 100ms, expected average 50ms. That seems really high? Separately: prng32_bounded() may return 0, which is transparently converted to the equivalent of 1 by pause_sbt(9). This means a 1 tick pause is marginally more likely than any other possible duration. It probably doesn't matter. Thanks, Conrad > + > +/* > + * Lock pair of vnodes vp1, vp2, avoiding lock order reversal. > + * vp1_locked indicates whether vp1 is exclusively locked; if not, vp1 > + * must be unlocked. Same for vp2 and vp2_locked. One of the vnodes > + * can be NULL. > + * > + * The function returns with both vnodes exclusively locked, and > + * guarantees that it does not create lock order reversal with other > + * threads during its execution. Both vnodes could be unlocked > + * temporary (and reclaimed). > + */ > +void > +vn_lock_pair(struct vnode *vp1, bool vp1_locked, struct vnode *vp2, > +bool vp2_locked) > +{ > + int error; > + > + if (vp1 == NULL && vp2 == NULL) > + return; > + if (vp1 != NULL) { > + if (vp1_locked) > + ASSERT_VOP_ELOCKED(vp1, "vp1"); > + else > + ASSERT_VOP_UNLOCKED(vp1, "vp1"); > + } else { > + vp1_locked = true; > + } > + if (vp2 != NULL) { > + if (vp2_locked) > + ASSERT_VOP_ELOCKED(vp2, "vp2"); > + else > + ASSERT_VOP_UNLOCKED(vp2, "vp2"); > + } else { > + vp2_locked = true; > + } > + if (!vp1_locked && !vp2_locked) { > + vn_lock(vp1, LK_EXCLUSIVE | LK_RETRY); > + vp1_locked = true; > + } > + > + for (;;) { > + if (vp1_locked && vp2_locked) > + break; > + if (vp1_locked && vp2 != NULL) { > + if (vp1 != NULL) { > + error = VOP_LOCK1(vp2, LK_EXCLUSIVE | > LK_NOWAIT, > + __FILE__, __LINE__); > + if (error == 0) > + break; > + VOP_UNLOCK(vp1); > + vp1_locked = false; > + vn_lock_pair_pause("vlp1"); (Pause called here and in similar elided case for vp2 -> vp1 below.) > + } > + vn_lock(vp2, LK_EXCLUSIVE | LK_RETRY); > + vp2_locked = true; > + } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r367433 - in head/sys: compat/linux conf
Author: cem Date: Fri Nov 6 22:04:57 2020 New Revision: 367433 URL: https://svnweb.freebsd.org/changeset/base/367433 Log: linux(4): Fix loadable modules after r367395 Move dtrace SDT definitions into linux_common module code. Also, build linux_dummy.c into the linux_common kld -- we don't need separate versions of these stubs for 32- and 64-bit emulation. Reported by: several PR: 250897 Discussed with: emaste, trasz Tested by:John Kennedy, Yasuhiro KIMURA, Oleg Sidorkin X-MFC-With: r367395 Differential Revision:https://reviews.freebsd.org/D27124 Modified: head/sys/compat/linux/linux_common.c head/sys/compat/linux/linux_dummy.c head/sys/compat/linux/linux_misc.c head/sys/conf/files.i386 Modified: head/sys/compat/linux/linux_common.c == --- head/sys/compat/linux/linux_common.cFri Nov 6 21:33:59 2020 (r367432) +++ head/sys/compat/linux/linux_common.cFri Nov 6 22:04:57 2020 (r367433) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -48,6 +49,20 @@ FEATURE(linuxulator_v4l, "V4L ioctl wrapper support in FEATURE(linuxulator_v4l2, "V4L2 ioctl wrapper support in the linuxulator"); MODULE_VERSION(linux_common, 1); + +/** + * Special DTrace provider for the linuxulator. + * + * In this file we define the provider for the entire linuxulator. All + * modules (= files of the linuxulator) use it. + * + * We define a different name depending on the emulated bitsize, see + * ../..//linux{,32}/linux.h, e.g.: + * native bitsize = linuxulator + * amd64, 32bit emulation = linuxulator32 + */ +LIN_SDT_PROVIDER_DEFINE(linuxulator); +LIN_SDT_PROVIDER_DEFINE(linuxulator32); SET_DECLARE(linux_device_handler_set, struct linux_device_handler); Modified: head/sys/compat/linux/linux_dummy.c == --- head/sys/compat/linux/linux_dummy.c Fri Nov 6 21:33:59 2020 (r367432) +++ head/sys/compat/linux/linux_dummy.c Fri Nov 6 22:04:57 2020 (r367433) @@ -29,21 +29,19 @@ #include __FBSDID("$FreeBSD$"); -#include "opt_compat.h" - #include #include #include #include #include -#ifdef COMPAT_LINUX32 -#include -#include -#else +/* + * Including linux vs linux32 here is arbitrary -- the syscall args structures + * (proto.h) are not dereferenced by the DUMMY stub implementations, and + * suitable for use by both native and compat32 entrypoints. + */ #include #include -#endif #include #include Modified: head/sys/compat/linux/linux_misc.c == --- head/sys/compat/linux/linux_misc.c Fri Nov 6 21:33:59 2020 (r367432) +++ head/sys/compat/linux/linux_misc.c Fri Nov 6 22:04:57 2020 (r367433) @@ -99,19 +99,6 @@ __FBSDID("$FreeBSD$"); #include #include -/** - * Special DTrace provider for the linuxulator. - * - * In this file we define the provider for the entire linuxulator. All - * modules (= files of the linuxulator) use it. - * - * We define a different name depending on the emulated bitsize, see - * ../..//linux{,32}/linux.h, e.g.: - * native bitsize = linuxulator - * amd64, 32bit emulation = linuxulator32 - */ -LIN_SDT_PROVIDER_DEFINE(LINUX_DTRACE); - int stclohz; /* Statistics clock frequency */ static unsigned int linux_to_bsd_resource[LINUX_RLIM_NLIMITS] = { Modified: head/sys/conf/files.i386 == --- head/sys/conf/files.i386Fri Nov 6 21:33:59 2020(r367432) +++ head/sys/conf/files.i386Fri Nov 6 22:04:57 2020(r367433) @@ -52,6 +52,7 @@ cddl/dev/dtrace/i386/dtrace_asm.S optional dtrace co cddl/dev/dtrace/i386/dtrace_subr.c optional dtrace compile-with "${DTRACE_C}" compat/linprocfs/linprocfs.c optional linprocfs compat/linsysfs/linsysfs.c optional linsysfs +compat/linux/linux_common.coptional compat_linux compat/linux/linux_dummy.c optional compat_linux compat/linux/linux_event.c optional compat_linux compat/linux/linux_emul.c optional compat_linux ___ 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: r367395 - in head/sys: amd64/linux amd64/linux32 arm64/linux compat/linux conf i386/linux modules/linux modules/linux64 modules/linux_common x86/linux
Author: cem Date: Thu Nov 5 19:30:31 2020 New Revision: 367395 URL: https://svnweb.freebsd.org/changeset/base/367395 Log: linux(4): Deduplicate unimpl/dummy syscall handlers No functional change. Reviewed by: emaste, trasz Differential Revision:https://reviews.freebsd.org/D27099 Added: head/sys/amd64/linux/linux_dummy_machdep.c - copied, changed from r367394, head/sys/amd64/linux/linux_dummy.c head/sys/arm64/linux/linux_dummy_machdep.c - copied, changed from r367394, head/sys/arm64/linux/linux_dummy.c head/sys/compat/linux/linux_dummy.c - copied, changed from r367393, head/sys/arm64/linux/linux_dummy.c head/sys/i386/linux/linux_dummy_machdep.c - copied, changed from r367394, head/sys/i386/linux/linux_dummy.c head/sys/x86/linux/ head/sys/x86/linux/linux_dummy_x86.c (contents, props changed) - copied, changed from r367393, head/sys/amd64/linux/linux_dummy.c Deleted: head/sys/amd64/linux/linux_dummy.c head/sys/arm64/linux/linux_dummy.c head/sys/i386/linux/linux_dummy.c Modified: head/sys/amd64/linux32/linux32_dummy.c head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/modules/linux/Makefile head/sys/modules/linux64/Makefile head/sys/modules/linux_common/Makefile Copied and modified: head/sys/amd64/linux/linux_dummy_machdep.c (from r367394, head/sys/amd64/linux/linux_dummy.c) == --- head/sys/amd64/linux/linux_dummy.c Thu Nov 5 18:10:03 2020 (r367394, copy source) +++ head/sys/amd64/linux/linux_dummy_machdep.c Thu Nov 5 19:30:31 2020 (r367395) @@ -43,146 +43,32 @@ __FBSDID("$FreeBSD$"); /* DTrace init */ LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); -UNIMPLEMENTED(afs_syscall); -UNIMPLEMENTED(create_module); /* Added in Linux 1.0 removed in 2.6. */ -UNIMPLEMENTED(epoll_ctl_old); -UNIMPLEMENTED(epoll_wait_old); -UNIMPLEMENTED(get_kernel_syms);/* Added in Linux 1.0 removed in 2.6. */ +/* + * Before adding new stubs to this file, please check if a stub can be added to + * the machine-independent code in sys/compat/linux/linux_dummy.c (or + * sys/x86/linux/linux_dummy_x86.c). + */ + UNIMPLEMENTED(get_thread_area); -UNIMPLEMENTED(getpmsg); -UNIMPLEMENTED(nfsservctl); /* Added in Linux 2.2 removed in 3.1. */ -UNIMPLEMENTED(putpmsg); -UNIMPLEMENTED(query_module); /* Added in Linux 2.2 removed in 2.6. */ -UNIMPLEMENTED(tuxcall); -UNIMPLEMENTED(security); UNIMPLEMENTED(set_thread_area); UNIMPLEMENTED(uselib); -UNIMPLEMENTED(vserver); -DUMMY(setfsuid); -DUMMY(setfsgid); -DUMMY(sysfs); -DUMMY(vhangup); DUMMY(modify_ldt); -DUMMY(pivot_root); -DUMMY(adjtimex); -DUMMY(swapoff); -DUMMY(init_module); + DUMMY(ioperm); -DUMMY(delete_module); -DUMMY(quotactl); -DUMMY(readahead); DUMMY(io_setup); DUMMY(io_destroy); DUMMY(io_getevents); DUMMY(io_submit); DUMMY(io_cancel); -DUMMY(lookup_dcookie); -DUMMY(remap_file_pages); -DUMMY(restart_syscall); -DUMMY(semtimedop); -DUMMY(mbind); -DUMMY(get_mempolicy); -DUMMY(set_mempolicy); DUMMY(mq_open); DUMMY(mq_unlink); DUMMY(mq_timedsend); DUMMY(mq_timedreceive); DUMMY(mq_notify); DUMMY(mq_getsetattr); -DUMMY(kexec_load); -/* Linux 2.6.11: */ -DUMMY(add_key); -DUMMY(request_key); -DUMMY(keyctl); -/* Linux 2.6.13: */ -DUMMY(ioprio_set); -DUMMY(ioprio_get); -DUMMY(inotify_init); -DUMMY(inotify_add_watch); -DUMMY(inotify_rm_watch); -/* Linux 2.6.16: */ -DUMMY(migrate_pages); -DUMMY(unshare); -/* Linux 2.6.17: */ -DUMMY(tee); -DUMMY(vmsplice); -/* Linux 2.6.18: */ -DUMMY(move_pages); -/* Linux 2.6.22: */ -DUMMY(signalfd); -/* Linux 2.6.27: */ -DUMMY(signalfd4); -DUMMY(inotify_init1); -/* Linux 2.6.31: */ -DUMMY(perf_event_open); -/* Linux 2.6.36: */ -DUMMY(fanotify_init); -DUMMY(fanotify_mark); -/* Linux 2.6.39: */ -DUMMY(name_to_handle_at); -DUMMY(open_by_handle_at); -DUMMY(clock_adjtime); -/* Linux 3.0: */ -DUMMY(setns); -/* Linux 3.2: */ -DUMMY(process_vm_readv); -DUMMY(process_vm_writev); -/* Linux 3.5: */ -DUMMY(kcmp); -/* Linux 3.8: */ -DUMMY(finit_module); -DUMMY(sched_setattr); -DUMMY(sched_getattr); +DUMMY(readahead); +DUMMY(restart_syscall); +DUMMY(semtimedop); /* Linux 3.15: */ DUMMY(kexec_file_load); -/* Linux 3.17: */ -DUMMY(seccomp); -/* Linux 3.18: */ -DUMMY(bpf); -/* Linux 3.19: */ -DUMMY(execveat); -/* Linux 4.2: */ -DUMMY(userfaultfd); -/* Linux 4.3: */ -DUMMY(membarrier); -/* Linux 4.4: */ -DUMMY(mlock2); -/* Linux 4.6: */ -DUMMY(preadv2); -DUMMY(pwritev2); -/* Linux 4.8: */ -DUMMY(pkey_mprotect); -DUMMY(pkey_alloc); -DUMMY(pkey_free); -/* Linux 4.11: */ -DUMMY(statx); -/* Linux 4.18: */ -DUMMY(io_pgetevents); -DUMMY(rseq); -/* Linux 5.0: */ -DUMMY(pidfd_send_signal); -DUMMY(io_uring_setup); -DUMMY(io_uring_enter); -DUMMY(io_uring_register); - -#define DUMMY_XATTR(s) \ -int\ -linux_ ## s ## xattr( \ -struct thread
svn commit: r367362 - in head/sys: compat/linprocfs fs/pseudofs
Author: cem Date: Thu Nov 5 06:48:51 2020 New Revision: 367362 URL: https://svnweb.freebsd.org/changeset/base/367362 Log: Add sbuf streaming mode to pseudofs(9), use in linprocfs(5) Add a pseudofs node flag 'PFS_AUTODRAIN', which automatically emits sbuf contents to the caller when the sbuf buffer fills. This is only permissible if the corresponding PFS node fill function can sleep whenever it appends to the sbuf. linprocfs' /proc/self/maps node happens to meet this requirement. Streaming out the file as it is composed avoids truncating the output and also avoids preallocating a very large buffer. Reviewed by: markj; earlier version: emaste, kib, trasz Differential Revision:https://reviews.freebsd.org/D27047 Modified: head/sys/compat/linprocfs/linprocfs.c head/sys/fs/pseudofs/pseudofs.h head/sys/fs/pseudofs/pseudofs_vnops.c Modified: head/sys/compat/linprocfs/linprocfs.c == --- head/sys/compat/linprocfs/linprocfs.c Thu Nov 5 04:19:48 2020 (r367361) +++ head/sys/compat/linprocfs/linprocfs.c Thu Nov 5 06:48:51 2020 (r367362) @@ -1252,10 +1252,6 @@ linprocfs_doprocmaps(PFS_FILL_ARGS) *name ? " " : " ", name ); - if (error == -1) { - linux_msg(td, "cannot fill /proc/self/maps; " - "consider bumping PFS_MAXBUFSIZ"); - } if (freename) free(freename, M_TEMP); vm_map_lock_read(map); @@ -1890,7 +1886,7 @@ linprocfs_init(PFS_INIT_ARGS) pfs_create_link(dir, "exe", _doprocfile, NULL, _notsystem, NULL, 0); pfs_create_file(dir, "maps", _doprocmaps, - NULL, NULL, NULL, PFS_RD); + NULL, NULL, NULL, PFS_RD | PFS_AUTODRAIN); pfs_create_file(dir, "mem", _doprocmem, procfs_attr_rw, _candebug, NULL, PFS_RDWR | PFS_RAW); pfs_create_file(dir, "mounts", _domtab, Modified: head/sys/fs/pseudofs/pseudofs.h == --- head/sys/fs/pseudofs/pseudofs.h Thu Nov 5 04:19:48 2020 (r367361) +++ head/sys/fs/pseudofs/pseudofs.h Thu Nov 5 06:48:51 2020 (r367362) @@ -78,6 +78,7 @@ typedef enum { #define PFS_RAW(PFS_RAWRD|PFS_RAWWR) #define PFS_PROCDEP0x0010 /* process-dependent */ #define PFS_NOWAIT 0x0020 /* allow malloc to fail */ +#define PFS_AUTODRAIN 0x0040 /* sbuf_print can sleep to drain */ /* * Data structures Modified: head/sys/fs/pseudofs/pseudofs_vnops.c == --- head/sys/fs/pseudofs/pseudofs_vnops.c Thu Nov 5 04:19:48 2020 (r367361) +++ head/sys/fs/pseudofs/pseudofs_vnops.c Thu Nov 5 06:48:51 2020 (r367362) @@ -623,6 +623,50 @@ pfs_open(struct vop_open_args *va) PFS_RETURN (0); } +struct sbuf_seek_helper { + off_t skip_bytes; + struct uio *uio; +}; + +static int +pfs_sbuf_uio_drain(void *arg, const char *data, int len) +{ + struct sbuf_seek_helper *ssh; + struct uio *uio; + int error, skipped; + + ssh = arg; + uio = ssh->uio; + skipped = 0; + + /* Need to discard first uio_offset bytes. */ + if (ssh->skip_bytes > 0) { + if (ssh->skip_bytes >= len) { + ssh->skip_bytes -= len; + return (len); + } + + data += ssh->skip_bytes; + len -= ssh->skip_bytes; + skipped = ssh->skip_bytes; + ssh->skip_bytes = 0; + } + + error = uiomove(__DECONST(void *, data), len, uio); + if (error != 0) + return (-error); + + /* +* The fill function has more to emit, but the reader is finished. +* This is similar to the truncated read case for non-draining PFS +* sbufs, and should be handled appropriately in fill-routines. +*/ + if (uio->uio_resid == 0) + return (-ENOBUFS); + + return (skipped + len); +} + /* * Read from a file */ @@ -636,7 +680,8 @@ pfs_read(struct vop_read_args *va) struct proc *proc; struct sbuf *sb = NULL; int error, locked; - off_t buflen; + off_t buflen, buflim; + struct sbuf_seek_helper ssh; PFS_TRACE(("%s", pn->pn_name)); pfs_assert_not_owned(pn); @@ -678,16 +723,30 @@ pfs_read(struct vop_read_args *va) error = EINVAL; goto ret; } - buflen = uio->uio_offset + uio->uio_resid; - if (buflen > PFS_MAXBUFSIZ) - buflen = PFS_MAXBUFSIZ; + buflen = uio->uio_offset + uio->uio_resid + 1; + if (pn->pn_flags & PFS_AUTODRAIN) + /* +
svn commit: r367303 - head/sys/compat/linux
Author: cem Date: Tue Nov 3 19:50:42 2020 New Revision: 367303 URL: https://svnweb.freebsd.org/changeset/base/367303 Log: linux(4): Improve netlink diagnostics Add some missing netlink_family definitions and produce vaguely human-readable error messages for those definitions, like we used to do for just ROUTE and KOBJECT_UEVENTS. Additionally, if we know it's a netfilter socket but didn't find it in the table, fall back to printing that instead of the generic handler ("socket domain 16, ..."). No change to the emulator correctness, just mildly improved diagnostics for gaps. Modified: head/sys/compat/linux/linux.h head/sys/compat/linux/linux_socket.c Modified: head/sys/compat/linux/linux.h == --- head/sys/compat/linux/linux.h Tue Nov 3 19:14:03 2020 (r367302) +++ head/sys/compat/linux/linux.h Tue Nov 3 19:50:42 2020 (r367303) @@ -60,8 +60,14 @@ struct l_sockaddr { #defineLINUX_AF_INET6 10 #defineLINUX_AF_NETLINK16 -#defineLINUX_NETLINK_ROUTE 0 -#defineLINUX_NETLINK_UEVENT15 +#defineLINUX_NETLINK_ROUTE 0 +#defineLINUX_NETLINK_SOCK_DIAG 4 +#defineLINUX_NETLINK_NFLOG 5 +#defineLINUX_NETLINK_SELINUX 7 +#defineLINUX_NETLINK_AUDIT 9 +#defineLINUX_NETLINK_FIB_LOOKUP10 +#defineLINUX_NETLINK_NETFILTER 12 +#defineLINUX_NETLINK_KOBJECT_UEVENT15 /* * net device flags Modified: head/sys/compat/linux/linux_socket.c == --- head/sys/compat/linux/linux_socket.cTue Nov 3 19:14:03 2020 (r367302) +++ head/sys/compat/linux/linux_socket.cTue Nov 3 19:50:42 2020 (r367303) @@ -502,6 +502,17 @@ goout: return (error); } +static const char *linux_netlink_names[] = { + [LINUX_NETLINK_ROUTE] = "ROUTE", + [LINUX_NETLINK_SOCK_DIAG] = "SOCK_DIAG", + [LINUX_NETLINK_NFLOG] = "NFLOG", + [LINUX_NETLINK_SELINUX] = "SELINUX", + [LINUX_NETLINK_AUDIT] = "AUDIT", + [LINUX_NETLINK_FIB_LOOKUP] = "FIB_LOOKUP", + [LINUX_NETLINK_NETFILTER] = "NETFILTER", + [LINUX_NETLINK_KOBJECT_UEVENT] = "KOBJECT_UEVENT", +}; + int linux_socket(struct thread *td, struct linux_socket_args *args) { @@ -516,22 +527,29 @@ linux_socket(struct thread *td, struct linux_socket_ar return (retval_socket); domain = linux_to_bsd_domain(args->domain); if (domain == -1) { - if (args->domain == LINUX_AF_NETLINK && - args->protocol == LINUX_NETLINK_ROUTE) { - linux_msg(curthread, - "unsupported socket(AF_NETLINK, %d, NETLINK_ROUTE)", type); - return (EAFNOSUPPORT); + /* Mask off SOCK_NONBLOCK / CLOEXEC for error messages. */ + type = args->type & LINUX_SOCK_TYPE_MASK; + if (args->domain == LINUX_AF_NETLINK) { + const char *nl_name; + + if (args->protocol >= 0 && + args->protocol < nitems(linux_netlink_names)) + nl_name = linux_netlink_names[args->protocol]; + else + nl_name = NULL; + if (nl_name != NULL) + linux_msg(curthread, + "unsupported socket(AF_NETLINK, %d, " + "NETLINK_%s)", type, nl_name); + else + linux_msg(curthread, + "unsupported socket(AF_NETLINK, %d, %d)", + type, args->protocol); + } else { + linux_msg(curthread, "unsupported socket domain %d, " + "type %d, protocol %d", args->domain, type, + args->protocol); } - - if (args->domain == LINUX_AF_NETLINK && - args->protocol == LINUX_NETLINK_UEVENT) { - linux_msg(curthread, - "unsupported socket(AF_NETLINK, %d, NETLINK_UEVENT)", type); - return (EAFNOSUPPORT); - } - - linux_msg(curthread, "unsupported socket domain %d, type %d, protocol %d", - args->domain, args->type & LINUX_SOCK_TYPE_MASK, args->protocol); return (EAFNOSUPPORT); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r367288 - head/sys/compat/linux
No, not as far as I can tell. On Mon, Nov 2, 2020 at 5:48 PM Andrew Gallatin wrote: > > On 11/2/20 8:19 PM, Conrad Meyer wrote: > > > > Log: > >linux(4): Emulate Linux SOL_SOCKET:SO_PASSCRED > > > >This is required by some major linux applications, such as Chrome and > >Firefox. (As well as Electron-using applications, which are essentially > >a bundled version of Chrome.) > > > > Awesome! Does this get electron apps working? > > Drew ___ 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: r367290 - head/sys/compat/linux
Author: cem Date: Tue Nov 3 02:10:54 2020 New Revision: 367290 URL: https://svnweb.freebsd.org/changeset/base/367290 Log: linux(4) prctl(2): Implement PR_[GS]ET_DUMPABLE Proxy the flag to the roughly analogous FreeBSD procctl 'TRACE'. TRACE-disabled processes are not coredumped, and Linux !DUMPABLE processes can not be ptraced. There are some additional semantics around ownership of files in the /proc/[pid] pseudo-filesystem, which we do not attempt to emulate correctly at this time. Reviewed by: markj (earlier version) Differential Revision:https://reviews.freebsd.org/D27015 Modified: head/sys/compat/linux/linux_misc.c head/sys/compat/linux/linux_misc.h Modified: head/sys/compat/linux/linux_misc.c == --- head/sys/compat/linux/linux_misc.c Tue Nov 3 01:38:16 2020 (r367289) +++ head/sys/compat/linux/linux_misc.c Tue Nov 3 02:10:54 2020 (r367290) @@ -1937,7 +1937,7 @@ linux_prctl(struct thread *td, struct linux_prctl_args int error = 0, max_size; struct proc *p = td->td_proc; char comm[LINUX_MAX_COMM_LEN]; - int pdeath_signal; + int pdeath_signal, trace_state; switch (args->option) { case LINUX_PR_SET_PDEATHSIG: @@ -1955,10 +1955,46 @@ linux_prctl(struct thread *td, struct linux_prctl_args return (copyout(_signal, (void *)(register_t)args->arg2, sizeof(pdeath_signal))); + /* +* In Linux, this flag controls if set[gu]id processes can coredump. +* There are additional semantics imposed on processes that cannot +* coredump: +* - Such processes can not be ptraced. +* - There are some semantics around ownership of process-related files +* in the /proc namespace. +* +* In FreeBSD, we can (and by default, do) disable setuid coredump +* system-wide with 'sugid_coredump.' We control tracability on a +* per-process basis with the procctl PROC_TRACE (=> P2_NOTRACE flag). +* By happy coincidence, P2_NOTRACE also prevents coredumping. So the +* procctl is roughly analogous to Linux's DUMPABLE. +* +* So, proxy these knobs to the corresponding PROC_TRACE setting. +*/ + case LINUX_PR_GET_DUMPABLE: + error = kern_procctl(td, P_PID, p->p_pid, PROC_TRACE_STATUS, + _state); + if (error != 0) + return (error); + td->td_retval[0] = (trace_state != -1); + return (0); case LINUX_PR_SET_DUMPABLE: - linux_msg(td, "unsupported prctl PR_SET_DUMPABLE"); - error = EINVAL; - break; + /* +* It is only valid for userspace to set one of these two +* flags, and only one at a time. +*/ + switch (args->arg2) { + case LINUX_SUID_DUMP_DISABLE: + trace_state = PROC_TRACE_CTL_DISABLE_EXEC; + break; + case LINUX_SUID_DUMP_USER: + trace_state = PROC_TRACE_CTL_ENABLE; + break; + default: + return (EINVAL); + } + return (kern_procctl(td, P_PID, p->p_pid, PROC_TRACE_CTL, + _state)); case LINUX_PR_GET_KEEPCAPS: /* * Indicate that we always clear the effective and Modified: head/sys/compat/linux/linux_misc.h == --- head/sys/compat/linux/linux_misc.h Tue Nov 3 01:38:16 2020 (r367289) +++ head/sys/compat/linux/linux_misc.h Tue Nov 3 02:10:54 2020 (r367290) @@ -50,6 +50,7 @@ * Second arg is a ptr to return the * signal. */ +#defineLINUX_PR_GET_DUMPABLE 3 #defineLINUX_PR_SET_DUMPABLE 4 #defineLINUX_PR_GET_KEEPCAPS 7 /* Get drop capabilities on setuid */ #defineLINUX_PR_SET_KEEPCAPS 8 /* Set drop capabilities on setuid */ @@ -61,6 +62,11 @@ #defineLINUX_PR_SET_PTRACER1499557217 #defineLINUX_MAX_COMM_LEN 16 /* Maximum length of the process name. */ + +/* For GET/SET DUMPABLE */ +#defineLINUX_SUID_DUMP_DISABLE 0 /* Don't coredump setuid processes. */ +#defineLINUX_SUID_DUMP_USER1 /* Dump as user of process. */ +#defineLINUX_SUID_DUMP_ROOT2 /* Dump as root. */ #defineLINUX_MREMAP_MAYMOVE1 #defineLINUX_MREMAP_FIXED 2 ___ svn-src-all@freebsd.org mailing list
svn commit: r367288 - head/sys/compat/linux
Author: cem Date: Tue Nov 3 01:19:13 2020 New Revision: 367288 URL: https://svnweb.freebsd.org/changeset/base/367288 Log: linux(4): Emulate Linux SOL_SOCKET:SO_PASSCRED This is required by some major linux applications, such as Chrome and Firefox. (As well as Electron-using applications, which are essentially a bundled version of Chrome.) Reviewed by: markj Differential Revision:https://reviews.freebsd.org/D27012 Modified: head/sys/compat/linux/linux_socket.c Modified: head/sys/compat/linux/linux_socket.c == --- head/sys/compat/linux/linux_socket.cTue Nov 3 01:17:45 2020 (r367287) +++ head/sys/compat/linux/linux_socket.cTue Nov 3 01:19:13 2020 (r367288) @@ -222,6 +222,8 @@ linux_to_bsd_so_sockopt(int opt) return (SO_LINGER); case LINUX_SO_REUSEPORT: return (SO_REUSEPORT_LB); + case LINUX_SO_PASSCRED: + return (LOCAL_CREDS_PERSISTENT); case LINUX_SO_PEERCRED: return (LOCAL_PEERCRED); case LINUX_SO_RCVLOWAT: @@ -1445,6 +1447,9 @@ linux_setsockopt(struct thread *td, struct linux_setso case SOL_SOCKET: name = linux_to_bsd_so_sockopt(args->optname); switch (name) { + case LOCAL_CREDS_PERSISTENT: + level = SOL_LOCAL; + break; case SO_RCVTIMEO: /* FALLTHROUGH */ case SO_SNDTIMEO: @@ -1522,6 +1527,9 @@ linux_getsockopt(struct thread *td, struct linux_getso case SOL_SOCKET: name = linux_to_bsd_so_sockopt(args->optname); switch (name) { + case LOCAL_CREDS_PERSISTENT: + level = SOL_LOCAL; + break; case SO_RCVTIMEO: /* FALLTHROUGH */ case SO_SNDTIMEO: ___ 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: r367287 - in head: share/man/man4 sys/kern sys/sys
Author: cem Date: Tue Nov 3 01:17:45 2020 New Revision: 367287 URL: https://svnweb.freebsd.org/changeset/base/367287 Log: unix(4): Add SOL_LOCAL:LOCAL_CREDS_PERSISTENT This option is intended to be semantically identical to Linux's SOL_SOCKET:SO_PASSCRED. For now, it is mutually exclusive with the pre-existing sockopt SOL_LOCAL:LOCAL_CREDS. Reviewed by: markj (penultimate version) Differential Revision:https://reviews.freebsd.org/D27011 Modified: head/share/man/man4/unix.4 head/sys/kern/uipc_usrreq.c head/sys/sys/un.h head/sys/sys/unpcb.h Modified: head/share/man/man4/unix.4 == --- head/share/man/man4/unix.4 Tue Nov 3 01:10:27 2020(r367286) +++ head/share/man/man4/unix.4 Tue Nov 3 01:17:45 2020(r367287) @@ -28,7 +28,7 @@ .\" @(#)unix.4 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd August 3, 2020 +.Dd November 2, 2020 .Dt UNIX 4 .Os .Sh NAME @@ -201,7 +201,7 @@ which can be set with .Xr setsockopt 2 and tested with .Xr getsockopt 2 : -.Bl -tag -width ".Dv LOCAL_CONNWAIT" +.Bl -tag -width ".Dv LOCAL_CREDS_PERSISTENT" .It Dv LOCAL_CREDS This option may be enabled on .Dv SOCK_DGRAM , @@ -287,6 +287,19 @@ such as error messages. Therefore, a message accompanied by a particular .Fa sc_euid value should not be trusted as being from that user. +.It Dv LOCAL_CREDS_PERSISTENT +This option is similar to +.Dv LOCAL_CREDS , +except that socket credentials are passed on every read from a +.Dv SOCK_STREAM +or +.Dv SOCK_SEQPACKET +socket, instead of just the first read. +The +.Dv LOCAL_CREDS +and +.Dv LOCAL_CREDS_PERSISTENT +options are mutually exclusive. .It Dv LOCAL_CONNWAIT Used with .Dv SOCK_STREAM Modified: head/sys/kern/uipc_usrreq.c == --- head/sys/kern/uipc_usrreq.c Tue Nov 3 01:10:27 2020(r367286) +++ head/sys/kern/uipc_usrreq.c Tue Nov 3 01:17:45 2020(r367287) @@ -1040,7 +1040,7 @@ uipc_send(struct socket *so, int flags, struct mbuf *m break; } - if (unp2->unp_flags & UNP_WANTCRED) + if (unp2->unp_flags & UNP_WANTCRED_MASK) control = unp_addsockcred(td, control); if (unp->unp_addr != NULL) from = (struct sockaddr *)unp->unp_addr; @@ -1094,12 +1094,13 @@ uipc_send(struct socket *so, int flags, struct mbuf *m break; } SOCKBUF_LOCK(>so_rcv); - if (unp2->unp_flags & UNP_WANTCRED) { + if (unp2->unp_flags & UNP_WANTCRED_MASK) { /* -* Credentials are passed only once on SOCK_STREAM -* and SOCK_SEQPACKET. +* Credentials are passed only once on SOCK_STREAM and +* SOCK_SEQPACKET (LOCAL_CREDS => WANTCRED_ONESHOT), or +* forever (LOCAL_CREDS_PERSISTENT => WANTCRED_ALWAYS). */ - unp2->unp_flags &= ~UNP_WANTCRED; + unp2->unp_flags &= ~UNP_WANTCRED_ONESHOT; control = unp_addsockcred(td, control); } @@ -1405,10 +1406,16 @@ uipc_ctloutput(struct socket *so, struct sockopt *sopt case LOCAL_CREDS: /* Unlocked read. */ - optval = unp->unp_flags & UNP_WANTCRED ? 1 : 0; + optval = unp->unp_flags & UNP_WANTCRED_ONESHOT ? 1 : 0; error = sooptcopyout(sopt, , sizeof(optval)); break; + case LOCAL_CREDS_PERSISTENT: + /* Unlocked read. */ + optval = unp->unp_flags & UNP_WANTCRED_ALWAYS ? 1 : 0; + error = sooptcopyout(sopt, , sizeof(optval)); + break; + case LOCAL_CONNWAIT: /* Unlocked read. */ optval = unp->unp_flags & UNP_CONNWAIT ? 1 : 0; @@ -1424,28 +1431,38 @@ uipc_ctloutput(struct socket *so, struct sockopt *sopt case SOPT_SET: switch (sopt->sopt_name) { case LOCAL_CREDS: + case LOCAL_CREDS_PERSISTENT: case LOCAL_CONNWAIT: error = sooptcopyin(sopt, , sizeof(optval), sizeof(optval)); if (error) break; -#defineOPTSET(bit) do { \ +#defineOPTSET(bit, exclusive) do { \ UNP_PCB_LOCK(unp); \ - if (optval) \ -
svn commit: r367286 - head/sys/compat/linux
Author: cem Date: Tue Nov 3 01:10:27 2020 New Revision: 367286 URL: https://svnweb.freebsd.org/changeset/base/367286 Log: linux(4): style: Eliminate dead 'break' after 'return' No functional change. Modified: head/sys/compat/linux/linux_misc.c Modified: head/sys/compat/linux/linux_misc.c == --- head/sys/compat/linux/linux_misc.c Mon Nov 2 21:47:34 2020 (r367285) +++ head/sys/compat/linux/linux_misc.c Tue Nov 3 01:10:27 2020 (r367286) @@ -1955,7 +1955,6 @@ linux_prctl(struct thread *td, struct linux_prctl_args return (copyout(_signal, (void *)(register_t)args->arg2, sizeof(pdeath_signal))); - break; case LINUX_PR_SET_DUMPABLE: linux_msg(td, "unsupported prctl PR_SET_DUMPABLE"); error = EINVAL; ___ 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: r367279 - head/sys/compat/linux
Author: cem Date: Mon Nov 2 18:45:43 2020 New Revision: 367279 URL: https://svnweb.freebsd.org/changeset/base/367279 Log: linux(4): Quiesce unrecognized ioctl warning for F2FS query On Linux, sqlite probes for underlying F2FS filesystems that support certain kinds of atomic update with this ioctl. The expected result on non-F2FS filesystem (i.e., all FreeBSD filesystems) is any error value. Minimally implement the ioctl and avoid the warning message. (This shows up in Linux Chrome, which embeds sqlite.) Reviewed by: emaste, trasz Differential Revision:https://reviews.freebsd.org/D27050 Modified: head/sys/compat/linux/linux_ioctl.c head/sys/compat/linux/linux_ioctl.h Modified: head/sys/compat/linux/linux_ioctl.c == --- head/sys/compat/linux/linux_ioctl.c Mon Nov 2 18:45:15 2020 (r367278) +++ head/sys/compat/linux/linux_ioctl.c Mon Nov 2 18:45:43 2020 (r367279) @@ -3631,6 +3631,7 @@ linux_ioctl_fallback(struct thread *td, struct linux_i switch (args->cmd & 0x) { case LINUX_BTRFS_IOC_CLONE: + case LINUX_F2FS_IOC_GET_FEATURES: case LINUX_FS_IOC_FIEMAP: return (ENOTSUP); Modified: head/sys/compat/linux/linux_ioctl.h == --- head/sys/compat/linux/linux_ioctl.h Mon Nov 2 18:45:15 2020 (r367278) +++ head/sys/compat/linux/linux_ioctl.h Mon Nov 2 18:45:43 2020 (r367279) @@ -707,6 +707,11 @@ #define LINUX_IOCTL_VIDEO2_MIN LINUX_VIDIOC_QUERYCAP #define LINUX_IOCTL_VIDEO2_MAX LINUX_VIDIOC_UNSUBSCRIBE_EVENT +#defineLINUX_F2FS_IOC_GET_FEATURES 0xf50c /* 0x8004f50c */ + +#defineLINUX_IOCTL_F2FS_MIN0xf500 +#defineLINUX_IOCTL_F2FS_MAXLINUX_F2FS_IOC_GET_FEATURES + /* * Our libusb(8) calls emulated within linux(4). */ ___ 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: r367278 - head/sys/compat/linux
Author: cem Date: Mon Nov 2 18:45:15 2020 New Revision: 367278 URL: https://svnweb.freebsd.org/changeset/base/367278 Log: linux(4): Deduplicate ioctl range construction with a helper macro No functional change. Reviewed by: emaste, trasz Differential Revision:https://reviews.freebsd.org/D27049 Modified: head/sys/compat/linux/linux_ioctl.c head/sys/compat/linux/linux_ioctl.h Modified: head/sys/compat/linux/linux_ioctl.c == --- head/sys/compat/linux/linux_ioctl.c Mon Nov 2 18:23:50 2020 (r367277) +++ head/sys/compat/linux/linux_ioctl.c Mon Nov 2 18:45:15 2020 (r367278) @@ -102,70 +102,35 @@ __FBSDID("$FreeBSD$"); CTASSERT(LINUX_IFNAMSIZ == IFNAMSIZ); -static linux_ioctl_function_t linux_ioctl_cdrom; -static linux_ioctl_function_t linux_ioctl_vfat; -static linux_ioctl_function_t linux_ioctl_console; -static linux_ioctl_function_t linux_ioctl_hdio; -static linux_ioctl_function_t linux_ioctl_disk; -static linux_ioctl_function_t linux_ioctl_socket; -static linux_ioctl_function_t linux_ioctl_sound; -static linux_ioctl_function_t linux_ioctl_termio; -static linux_ioctl_function_t linux_ioctl_private; -static linux_ioctl_function_t linux_ioctl_drm; -static linux_ioctl_function_t linux_ioctl_sg; -static linux_ioctl_function_t linux_ioctl_v4l; -static linux_ioctl_function_t linux_ioctl_v4l2; -static linux_ioctl_function_t linux_ioctl_special; -static linux_ioctl_function_t linux_ioctl_fbsd_usb; -static linux_ioctl_function_t linux_ioctl_evdev; -static linux_ioctl_function_t linux_ioctl_kcov; +#defineDEFINE_LINUX_IOCTL_SET(shortname, SHORTNAME)\ +static linux_ioctl_function_t linux_ioctl_ ## shortname; \ +static struct linux_ioctl_handler shortname ## _handler = {\ + .func = linux_ioctl_ ## shortname, \ + .low = LINUX_IOCTL_ ## SHORTNAME ## _MIN, \ + .high = LINUX_IOCTL_ ## SHORTNAME ## _MAX, \ +}; \ +DATA_SET(linux_ioctl_handler_set, shortname ## _handler) -static struct linux_ioctl_handler cdrom_handler = -{ linux_ioctl_cdrom, LINUX_IOCTL_CDROM_MIN, LINUX_IOCTL_CDROM_MAX }; -static struct linux_ioctl_handler vfat_handler = -{ linux_ioctl_vfat, LINUX_IOCTL_VFAT_MIN, LINUX_IOCTL_VFAT_MAX }; -static struct linux_ioctl_handler console_handler = -{ linux_ioctl_console, LINUX_IOCTL_CONSOLE_MIN, LINUX_IOCTL_CONSOLE_MAX }; -static struct linux_ioctl_handler hdio_handler = -{ linux_ioctl_hdio, LINUX_IOCTL_HDIO_MIN, LINUX_IOCTL_HDIO_MAX }; -static struct linux_ioctl_handler disk_handler = -{ linux_ioctl_disk, LINUX_IOCTL_DISK_MIN, LINUX_IOCTL_DISK_MAX }; -static struct linux_ioctl_handler socket_handler = -{ linux_ioctl_socket, LINUX_IOCTL_SOCKET_MIN, LINUX_IOCTL_SOCKET_MAX }; -static struct linux_ioctl_handler sound_handler = -{ linux_ioctl_sound, LINUX_IOCTL_SOUND_MIN, LINUX_IOCTL_SOUND_MAX }; -static struct linux_ioctl_handler private_handler = -{ linux_ioctl_private, LINUX_IOCTL_PRIVATE_MIN, LINUX_IOCTL_PRIVATE_MAX }; -static struct linux_ioctl_handler drm_handler = -{ linux_ioctl_drm, LINUX_IOCTL_DRM_MIN, LINUX_IOCTL_DRM_MAX }; -static struct linux_ioctl_handler sg_handler = -{ linux_ioctl_sg, LINUX_IOCTL_SG_MIN, LINUX_IOCTL_SG_MAX }; -static struct linux_ioctl_handler video_handler = -{ linux_ioctl_v4l, LINUX_IOCTL_VIDEO_MIN, LINUX_IOCTL_VIDEO_MAX }; -static struct linux_ioctl_handler video2_handler = -{ linux_ioctl_v4l2, LINUX_IOCTL_VIDEO2_MIN, LINUX_IOCTL_VIDEO2_MAX }; -static struct linux_ioctl_handler fbsd_usb = -{ linux_ioctl_fbsd_usb, FBSD_LUSB_MIN, FBSD_LUSB_MAX }; -static struct linux_ioctl_handler evdev_handler = -{ linux_ioctl_evdev, LINUX_IOCTL_EVDEV_MIN, LINUX_IOCTL_EVDEV_MAX }; -static struct linux_ioctl_handler kcov_handler = -{ linux_ioctl_kcov, LINUX_KCOV_MIN, LINUX_KCOV_MAX }; +DEFINE_LINUX_IOCTL_SET(cdrom, CDROM); +DEFINE_LINUX_IOCTL_SET(vfat, VFAT); +DEFINE_LINUX_IOCTL_SET(console, CONSOLE); +DEFINE_LINUX_IOCTL_SET(hdio, HDIO); +DEFINE_LINUX_IOCTL_SET(disk, DISK); +DEFINE_LINUX_IOCTL_SET(socket, SOCKET); +DEFINE_LINUX_IOCTL_SET(sound, SOUND); +DEFINE_LINUX_IOCTL_SET(termio, TERMIO); +DEFINE_LINUX_IOCTL_SET(private, PRIVATE); +DEFINE_LINUX_IOCTL_SET(drm, DRM); +DEFINE_LINUX_IOCTL_SET(sg, SG); +DEFINE_LINUX_IOCTL_SET(v4l, VIDEO); +DEFINE_LINUX_IOCTL_SET(v4l2, VIDEO2); +DEFINE_LINUX_IOCTL_SET(fbsd_usb, FBSD_LUSB); +DEFINE_LINUX_IOCTL_SET(evdev, EVDEV); +DEFINE_LINUX_IOCTL_SET(kcov, KCOV); -DATA_SET(linux_ioctl_handler_set, cdrom_handler); -DATA_SET(linux_ioctl_handler_set, vfat_handler); -DATA_SET(linux_ioctl_handler_set, console_handler); -DATA_SET(linux_ioctl_handler_set, hdio_handler); -DATA_SET(linux_ioctl_handler_set, disk_handler); -DATA_SET(linux_ioctl_handler_set, socket_handler); -DATA_SET(linux_ioctl_handler_set, sound_handler); -DATA_SET(linux_ioctl_handler_set, private_handler);
svn commit: r367267 - head/sys/compat/linux
Author: cem Date: Mon Nov 2 06:16:11 2020 New Revision: 367267 URL: https://svnweb.freebsd.org/changeset/base/367267 Log: linux(4): Disambiguate identical ioctl errors in distinct paths And stop truncating the full ioctl number in the error message. Reviewed by: emaste Differential Revision:https://reviews.freebsd.org/D27048 Modified: head/sys/compat/linux/linux_ioctl.c Modified: head/sys/compat/linux/linux_ioctl.c == --- head/sys/compat/linux/linux_ioctl.c Mon Nov 2 01:34:58 2020 (r367266) +++ head/sys/compat/linux/linux_ioctl.c Mon Nov 2 06:16:11 2020 (r367267) @@ -275,8 +275,8 @@ linux_ioctl_hdio(struct thread *td, struct linux_ioctl default: /* XXX */ linux_msg(td, - "ioctl fd=%d, cmd=0x%x ('%c',%d) is not implemented", - args->fd, (int)(args->cmd & 0x), + "%s fd=%d, cmd=0x%x ('%c',%d) is not implemented", + __func__, args->fd, args->cmd, (int)(args->cmd & 0xff00) >> 8, (int)(args->cmd & 0xff)); break; @@ -3670,8 +3670,8 @@ linux_ioctl_fallback(struct thread *td, struct linux_i return (ENOTSUP); default: - linux_msg(td, "ioctl fd=%d, cmd=0x%x ('%c',%d) is not implemented", - args->fd, (int)(args->cmd & 0x), + linux_msg(td, "%s fd=%d, cmd=0x%x ('%c',%d) is not implemented", + __func__, args->fd, args->cmd, (int)(args->cmd & 0xff00) >> 8, (int)(args->cmd & 0xff)); 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: r367190 - head/sys/compat/linux
Author: cem Date: Sat Oct 31 01:12:35 2020 New Revision: 367190 URL: https://svnweb.freebsd.org/changeset/base/367190 Log: linux(4): Add missing clone(2) flags Modified: head/sys/compat/linux/linux_misc.h Modified: head/sys/compat/linux/linux_misc.h == --- head/sys/compat/linux/linux_misc.h Fri Oct 30 22:00:35 2020 (r367189) +++ head/sys/compat/linux/linux_misc.h Sat Oct 31 01:12:35 2020 (r367190) @@ -97,13 +97,25 @@ extern const char *linux_kplatform; #defineLINUX_CLONE_FILES 0x0400 #defineLINUX_CLONE_SIGHAND 0x0800 #defineLINUX_CLONE_PID 0x1000 /* No longer exist in Linux */ +#defineLINUX_CLONE_PTRACE 0x2000 #defineLINUX_CLONE_VFORK 0x4000 #defineLINUX_CLONE_PARENT 0x8000 #defineLINUX_CLONE_THREAD 0x0001 +#defineLINUX_CLONE_NEWNS 0x0002 /* New mount NS */ +#defineLINUX_CLONE_SYSVSEM 0x0004 #defineLINUX_CLONE_SETTLS 0x0008 #defineLINUX_CLONE_PARENT_SETTID 0x0010 #defineLINUX_CLONE_CHILD_CLEARTID 0x0020 +#defineLINUX_CLONE_DETACHED0x0040 /* Unused */ +#defineLINUX_CLONE_UNTRACED0x0080 #defineLINUX_CLONE_CHILD_SETTID0x0100 +#defineLINUX_CLONE_NEWCGROUP 0x0200 /* New cgroup NS */ +#defineLINUX_CLONE_NEWUTS 0x0400 +#defineLINUX_CLONE_NEWIPC 0x0800 +#defineLINUX_CLONE_NEWUSER 0x1000 +#defineLINUX_CLONE_NEWPID 0x2000 +#defineLINUX_CLONE_NEWNET 0x4000 +#defineLINUX_CLONE_IO 0x8000 /* Scheduling policies */ #defineLINUX_SCHED_OTHER 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: r367182 - head/sys/compat/linux
Author: cem Date: Fri Oct 30 19:02:59 2020 New Revision: 367182 URL: https://svnweb.freebsd.org/changeset/base/367182 Log: linux(4): Quiesce warning about madvise(..., -1) This API misuse is intended to produce an error value to detect certain bogus stub implementations of MADV_WIPEONFORK. We don't need to log a warning about it. Example: https://boringssl.googlesource.com/boringssl/+/ad5582985cc6b89d0e7caf0d9cc7e301de61cf66%5E%21/ Reviewed by: emaste, trasz Differential Revision:https://reviews.freebsd.org/D27017 Modified: head/sys/compat/linux/linux_mmap.c Modified: head/sys/compat/linux/linux_mmap.c == --- head/sys/compat/linux/linux_mmap.c Fri Oct 30 19:00:42 2020 (r367181) +++ head/sys/compat/linux/linux_mmap.c Fri Oct 30 19:02:59 2020 (r367182) @@ -394,6 +394,16 @@ linux_madvise_common(struct thread *td, uintptr_t addr case LINUX_MADV_SOFT_OFFLINE: linux_msg(curthread, "unsupported madvise MADV_SOFT_OFFLINE"); return (EINVAL); + case -1: + /* +* -1 is sometimes used as a dummy value to detect simplistic +* madvise(2) stub implementations. This safeguard is used by +* BoringSSL, for example, before assuming MADV_WIPEONFORK is +* safe to use. Don't produce an "unsupported" error message +* for this special dummy value, which is unlikely to be used +* by any new advisory behavior feature. +*/ + return (EINVAL); default: linux_msg(curthread, "unsupported madvise behav %d", behav); return (EINVAL); ___ 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: r367181 - in head/sys/ufs: ffs ufs
Author: cem Date: Fri Oct 30 19:00:42 2020 New Revision: 367181 URL: https://svnweb.freebsd.org/changeset/base/367181 Log: UFS2: Fix DoS due to corrupted extattrfile Prior versions of FreeBSD (11.x) may have produced a corrupt extattr file. (Specifically, r312416 accidentally fixed this defect by removing a strcpy.) CURRENT FreeBSD supports disk images from those prior versions of FreeBSD. Validate the internal structure as soon as we read it in from disk, to prevent these extattr files from causing invariants violations and DoS. Attempting to access the extattr portion of these files results in EINTEGRITY. At this time, the only way to repair files damaged in this way is to copy the contents to another file and move it over the original. PR: 244089 Reported by: Andrea Venturoli Reviewed by: kib Discussed with: mckusick (earlier draft) Security: no Differential Revision:https://reviews.freebsd.org/D27010 Modified: head/sys/ufs/ffs/ffs_vnops.c head/sys/ufs/ufs/extattr.h Modified: head/sys/ufs/ffs/ffs_vnops.c == --- head/sys/ufs/ffs/ffs_vnops.cFri Oct 30 18:55:08 2020 (r367180) +++ head/sys/ufs/ffs/ffs_vnops.cFri Oct 30 19:00:42 2020 (r367181) @@ -1200,9 +1200,8 @@ ffs_findextattr(u_char *ptr, u_int length, int nspace, eap = (struct extattr *)ptr; eaend = (struct extattr *)(ptr + length); for (; eap < eaend; eap = EXTATTR_NEXT(eap)) { - /* make sure this entry is complete */ - if (EXTATTR_NEXT(eap) > eaend) - break; + KASSERT(EXTATTR_NEXT(eap) <= eaend, + ("extattr next %p beyond %p", EXTATTR_NEXT(eap), eaend)); if (eap->ea_namespace != nspace || eap->ea_namelength != nlen || memcmp(eap->ea_name, name, nlen) != 0) continue; @@ -1216,8 +1215,9 @@ ffs_findextattr(u_char *ptr, u_int length, int nspace, } static int -ffs_rdextattr(u_char **p, struct vnode *vp, struct thread *td, int extra) +ffs_rdextattr(u_char **p, struct vnode *vp, struct thread *td) { + const struct extattr *eap, *eaend, *eapnext; struct inode *ip; struct ufs2_dinode *dp; struct fs *fs; @@ -1231,10 +1231,10 @@ ffs_rdextattr(u_char **p, struct vnode *vp, struct thr fs = ITOFS(ip); dp = ip->i_din2; easize = dp->di_extsize; - if ((uoff_t)easize + extra > UFS_NXADDR * fs->fs_bsize) + if ((uoff_t)easize > UFS_NXADDR * fs->fs_bsize) return (EFBIG); - eae = malloc(easize + extra, M_TEMP, M_WAITOK); + eae = malloc(easize, M_TEMP, M_WAITOK); liovec.iov_base = eae; liovec.iov_len = easize; @@ -1249,8 +1249,18 @@ ffs_rdextattr(u_char **p, struct vnode *vp, struct thr error = ffs_extread(vp, , IO_EXT | IO_SYNC); if (error) { free(eae, M_TEMP); - return(error); + return (error); } + /* Validate disk xattrfile contents. */ + for (eap = (void *)eae, eaend = (void *)(eae + easize); eap < eaend; + eap = eapnext) { + eapnext = EXTATTR_NEXT(eap); + /* Bogusly short entry or bogusly long entry. */ + if (eap->ea_length < sizeof(*eap) || eapnext > eaend) { + free(eae, M_TEMP); + return (EINTEGRITY); + } + } *p = eae; return (0); } @@ -1300,7 +1310,7 @@ ffs_open_ea(struct vnode *vp, struct ucred *cred, stru return (0); } dp = ip->i_din2; - error = ffs_rdextattr(>i_ea_area, vp, td, 0); + error = ffs_rdextattr(>i_ea_area, vp, td); if (error) { ffs_unlock_ea(vp); return (error); @@ -1606,9 +1616,8 @@ vop_listextattr { eap = (struct extattr *)ip->i_ea_area; eaend = (struct extattr *)(ip->i_ea_area + ip->i_ea_len); for (; error == 0 && eap < eaend; eap = EXTATTR_NEXT(eap)) { - /* make sure this entry is complete */ - if (EXTATTR_NEXT(eap) > eaend) - break; + KASSERT(EXTATTR_NEXT(eap) <= eaend, + ("extattr next %p beyond %p", EXTATTR_NEXT(eap), eaend)); if (eap->ea_namespace != ap->a_attrnamespace) continue; Modified: head/sys/ufs/ufs/extattr.h == --- head/sys/ufs/ufs/extattr.h Fri Oct 30 18:55:08 2020(r367180) +++ head/sys/ufs/ufs/extattr.h Fri Oct 30 19:00:42 2020(r367181) @@ -95,7 +95,7 @@ struct extattr { * content referenced by eap. */ #defineEXTATTR_NEXT(eap) \ - ((struct extattr *)(((u_char *)(eap)) + (eap)->ea_length)) + ((struct extattr
svn commit: r366622 - in head: lib/libc/gen sys/amd64/amd64 sys/arm/arm sys/arm64/arm64 sys/compat/ia32 sys/dev/random/fenestrasX sys/i386/i386 sys/kern sys/mips/mips sys/powerpc/powerpc sys/riscv/...
Author: cem Date: Sat Oct 10 21:52:00 2020 New Revision: 366622 URL: https://svnweb.freebsd.org/changeset/base/366622 Log: random(4) FenestrasX: Push root seed version to arc4random(3) Push the root seed version to userspace through the VDSO page, if the RANDOM_FENESTRASX algorithm is enabled. Otherwise, there is no functional change. The mechanism can be disabled with debug.fxrng_vdso_enable=0. arc4random(3) obtains a pointer to the root seed version published by the kernel in the shared page at allocation time. Like arc4random(9), it maintains its own per-process copy of the seed version corresponding to the root seed version at the time it last rekeyed. On read requests, the process seed version is compared with the version published in the shared page; if they do not match, arc4random(3) reseeds from the kernel before providing generated output. This change does not implement the FenestrasX concept of PCPU userspace generators seeded from a per-process base generator. That change is left for future discussion/work. Reviewed by: kib (previous version) Approved by: csprng (me -- only touching FXRNG here) Differential Revision:https://reviews.freebsd.org/D22839 Modified: head/lib/libc/gen/arc4random.c head/lib/libc/gen/arc4random.h head/lib/libc/gen/auxv.c head/sys/amd64/amd64/elf_machdep.c head/sys/arm/arm/elf_machdep.c head/sys/arm64/arm64/elf32_machdep.c head/sys/arm64/arm64/elf_machdep.c head/sys/compat/ia32/ia32_sysvec.c head/sys/dev/random/fenestrasX/fx_brng.c head/sys/dev/random/fenestrasX/fx_main.c head/sys/i386/i386/elf_machdep.c head/sys/kern/imgact_elf.c head/sys/kern/kern_sharedpage.c head/sys/mips/mips/elf_machdep.c head/sys/mips/mips/freebsd32_machdep.c head/sys/powerpc/powerpc/elf32_machdep.c head/sys/powerpc/powerpc/elf64_machdep.c head/sys/riscv/riscv/elf_machdep.c head/sys/sys/elf_common.h head/sys/sys/sysent.h head/sys/sys/vdso.h Modified: head/lib/libc/gen/arc4random.c == --- head/lib/libc/gen/arc4random.c Sat Oct 10 21:48:06 2020 (r366621) +++ head/lib/libc/gen/arc4random.c Sat Oct 10 21:52:00 2020 (r366622) @@ -27,6 +27,9 @@ __FBSDID("$FreeBSD$"); #include "namespace.h" +#if defined(__FreeBSD__) +#include +#endif #include #include #include @@ -68,6 +71,9 @@ static struct _rs { static struct _rsx { chacha_ctx rs_chacha; /* chacha context for random keystream */ u_char rs_buf[RSBUFSZ];/* keystream blocks */ +#ifdef __FreeBSD__ + uint32_trs_seed_generation; /* 32-bit userspace RNG version */ +#endif } *rsx; static inline int _rs_allocate(struct _rs **, struct _rsx **); @@ -96,11 +102,43 @@ _rs_stir(void) { u_char rnd[KEYSZ + IVSZ]; +#if defined(__FreeBSD__) + bool need_init; + + /* +* De-couple allocation (which locates the vdso_fxrngp pointer in +* auxinfo) from initialization. This allows us to read the root seed +* version before we fetch system entropy, maintaining the invariant +* that the PRF was seeded with entropy from rs_seed_generation or a +* later generation. But never seeded from an earlier generation. +* This invariant prevents us from missing a root reseed event. +*/ + need_init = false; + if (rs == NULL) { + if (_rs_allocate(, ) == -1) + abort(); + need_init = true; + } + /* +* Transition period: new userspace on old kernel. This should become +* a hard error at some point, if the scheme is adopted. +*/ + if (vdso_fxrngp != NULL) + rsx->rs_seed_generation = + fxrng_load_acq_generation(_fxrngp->fx_generation32); +#endif + if (getentropy(rnd, sizeof rnd) == -1) _getentropy_fail(); +#if !defined(__FreeBSD__) if (!rs) _rs_init(rnd, sizeof(rnd)); +#else /* __FreeBSD__ */ + assert(rs != NULL); + if (need_init) + _rs_init(rnd, sizeof(rnd)); +#endif else _rs_rekey(rnd, sizeof(rnd)); explicit_bzero(rnd, sizeof(rnd)); /* discard source seed */ Modified: head/lib/libc/gen/arc4random.h == --- head/lib/libc/gen/arc4random.h Sat Oct 10 21:48:06 2020 (r366621) +++ head/lib/libc/gen/arc4random.h Sat Oct 10 21:52:00 2020 (r366622) @@ -24,10 +24,34 @@ /* * Stub functions for portability. */ +#include +#include #include +#include /* for sys/vdso.h only. */ +#include +#include +#include +#include #include +#include +#include +/* + * The kernel root seed version is a 64-bit counter, but we truncate it to a + * 32-bit value in userspace for the convenience of
svn commit: r366621 - in head/sys: dev/random dev/random/fenestrasX libkern sys
m/fenestrasX/fx_priv.hSat Oct 10 21:48:06 2020 (r366621) @@ -46,4 +46,3 @@ #endif extern struct fxrng_buffered_rng fxrng_root; -extern uint64_t __read_mostly fxrng_root_generation; Added: head/sys/dev/random/fenestrasX/fx_pub.h == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/random/fenestrasX/fx_pub.h Sat Oct 10 21:48:06 2020 (r366621) @@ -0,0 +1,53 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Conrad Meyer + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ +#pragma once + +#include + +/* + * The root BRNG seed version, or generation. + * + * FenestrasX-aware downstream CSPRNGs (i.e., arc4random(9)) should track the + * generation number they seeded from, using the read_random_key(9) API below. + * If their current seed version is older than the root generation, they should + * reseed before producing output. + * + * The variable is read-only outside of the fenestrasX implementation and + * should be accessed using 'atomic_load_acq_64(_root_generation)'. + * Reseeds are extremely infrequent, so callers may wish to hint to the + * compiler that a matching generation is the expected case, with + * __predict_true() or __predict_false(). + */ +extern uint64_t __read_mostly fxrng_root_generation; + +/* + * A routine for generating seed/key material + * Bypasses random(4) for now, but conceivably could be incorporated into that. + */ +void read_random_key(void *buf, size_t nbytes, uint64_t *seed_version_out); Modified: head/sys/dev/random/randomdev.c == --- head/sys/dev/random/randomdev.c Sat Oct 10 21:45:59 2020 (r366620) +++ head/sys/dev/random/randomdev.c Sat Oct 10 21:48:06 2020 (r366621) @@ -373,8 +373,10 @@ randomdev_unblock(void) selwakeuppri(, PUSER); wakeup(p_random_alg_context); printf("random: unblocking device.\n"); +#ifndef RANDOM_FENESTRASX /* Do random(9) a favour while we are about it. */ (void)atomic_cmpset_int(_iniseed_state, ARC4_ENTR_NONE, ARC4_ENTR_HAVE); +#endif } /* ARGSUSED */ Modified: head/sys/libkern/arc4random.c == --- head/sys/libkern/arc4random.c Sat Oct 10 21:45:59 2020 (r366620) +++ head/sys/libkern/arc4random.c Sat Oct 10 21:48:06 2020 (r366621) @@ -40,10 +40,14 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include #include #include -#include +#ifdef RANDOM_FENESTRASX +#include +#endif #defineCHACHA20_RESEED_BYTES 65536 #defineCHACHA20_RESEED_SECONDS 300 @@ -52,7 +56,9 @@ __FBSDID("$FreeBSD$"); CTASSERT(CHACHA20_KEYBYTES*8 >= CHACHA_MINKEYLEN); +#ifndef RANDOM_FENESTRASX int arc4rand_iniseed_state = ARC4_ENTR_NONE; +#endif MALLOC_DEFINE(M_CHACHA20RANDOM, "chacha20random", "chacha20random structures"); @@ -62,6 +68,9 @@ struct chacha20_s { time_t t_reseed; u_int8_t m_buffer[CHACHA20_BUFFER_SIZE]; struct chacha_ctx ctx; +#ifdef RANDOM_FENESTRASX + uint64_t seed_version; +#endif } __aligned(CACHE_LINE_SIZE); static struct chacha20_s *chacha20inst = NULL; @@ -79,7 +88,10 @@ chacha20_randomstir(struct chacha20_s *chacha20) { struct timeval tv_now; u_int8_t key[CHACHA20_KEYBYTES]; +#ifdef RANDOM_FENESTRASX + uint64_t seed_version; +#else if (__predict_false(random_bypass_before_seeding && !is_random_seeded())) {
svn commit: r366620 - in head/sys: conf dev/random/fenestrasX
pio dev/re/if_re.c optional re Modified: head/sys/conf/options == --- head/sys/conf/options Sat Oct 10 18:22:12 2020(r366619) +++ head/sys/conf/options Sat Oct 10 21:45:59 2020(r366620) @@ -966,6 +966,8 @@ RACCT_DEFAULT_TO_DISABLED opt_global.h RCTL opt_global.h # Random number generator(s) +# Alternative RNG algorithm. +RANDOM_FENESTRASX opt_global.h # With this, no entropy processor is loaded, but the entropy # harvesting infrastructure is present. This means an entropy # processor may be loaded as a module. Added: head/sys/dev/random/fenestrasX/fx_brng.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/random/fenestrasX/fx_brng.cSat Oct 10 21:45:59 2020 (r366620) @@ -0,0 +1,295 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Conrad Meyer + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include +#include +#include + +/* + * Implementation of a buffered RNG, described in § 1.2-1.4 of the whitepaper. + */ + +/* + * Initialize a buffered rng instance (either the static root instance, or a + * per-cpu instance on the heap. Both should be zero initialized before this + * routine. + */ +void +fxrng_brng_init(struct fxrng_buffered_rng *rng) +{ + fxrng_rng_init(>brng_rng, rng == _root); + + /* I.e., the buffer is empty. */ + rng->brng_avail_idx = sizeof(rng->brng_buffer); + + /* +* It is fine and correct for brng_generation and brng_buffer to be +* zero values. +* +* brng_prf and brng_generation must be initialized later. +* Initialization is special for the root BRNG. PCPU child instances +* use fxrng_brng_produce_seed_data_internal() below. +*/ +} + +/* + * Directly reseed the root BRNG from a first-time entropy source, + * incorporating the existing BRNG state. The main motivation for doing so "is + * to ensure that as soon as an entropy source produces data, PRNG output + * depends on the data from that source." (§ 3.1) + * + * The root BRNG is locked on entry and initial keying (brng_generation > 0) + * has already been performed. The root BRNG is unlocked on return. + */ +void +fxrng_brng_src_reseed(const struct harvest_event *event) +{ + struct fxrng_buffered_rng *rng; + + rng = _root; + FXRNG_BRNG_ASSERT(rng); + ASSERT_DEBUG(rng->brng_generation > 0, "root RNG not seeded"); + + fxrng_rng_src_reseed(>brng_rng, event); + FXRNG_BRNG_ASSERT(rng); + + /* +* Bump root generation (which is costly) to force downstream BRNGs to +* reseed and quickly incorporate the new entropy. The intuition is +* that this tradeoff is worth it because new sources show up extremely +* rarely (limiting cost) and if they can contribute any entropy to a +* weak state, we want to propagate it to all generators ASAP. +*/ + rng->brng_generation++; + atomic_store_rel_64(_root_generation, rng->brng_generation); + FXRNG_BRNG_UNLOCK(rng); +} + +/* + * Reseed a brng from some amount of pooled entropy (determined in fx_pool.c by + * fxent_timer_reseed_npools). For initial seeding, we pool entropy in a + * single pool and use this API as well (fxrng_alg_seeded). + */ +void +fxr
svn commit: r366521 - head/usr.sbin/bhyveload
Author: cem Date: Wed Oct 7 20:31:13 2020 New Revision: 366521 URL: https://svnweb.freebsd.org/changeset/base/366521 Log: bhyveload(8): Implement loader_callbacks::diskwrite The method was optional prior to r365938, which made it mandatory but did add any test that an implementation provides the method nor implement it for bhyveload. The code path might not be hit unless the user's loader was configured to write to a file on disk, such as with nextboot(8). Reviewed by: grehan, tsoome Approved by: bhyve X-MFC-With: r365938 Differential Revision:https://reviews.freebsd.org/D26710 Modified: head/usr.sbin/bhyveload/bhyveload.c Modified: head/usr.sbin/bhyveload/bhyveload.c == --- head/usr.sbin/bhyveload/bhyveload.c Wed Oct 7 20:09:26 2020 (r366520) +++ head/usr.sbin/bhyveload/bhyveload.c Wed Oct 7 20:31:13 2020 (r366521) @@ -300,11 +300,11 @@ cb_stat(void *arg, void *h, struct stat *sbp) static int cb_diskread(void *arg, int unit, uint64_t from, void *to, size_t size, - size_t *resid) +size_t *resid) { ssize_t n; - if (unit < 0 || unit >= ndisks ) + if (unit < 0 || unit >= ndisks) return (EIO); n = pread(disk_fd[unit], to, size, from); if (n < 0) @@ -314,6 +314,21 @@ cb_diskread(void *arg, int unit, uint64_t from, void * } static int +cb_diskwrite(void *arg, int unit, uint64_t offset, void *src, size_t size, +size_t *resid) +{ + ssize_t n; + + if (unit < 0 || unit >= ndisks) + return (EIO); + n = pwrite(disk_fd[unit], src, size, offset); + if (n < 0) + return (errno); + *resid = size - n; + return (0); +} + +static int cb_diskioctl(void *arg, int unit, u_long cmd, void *data) { struct stat sb; @@ -611,6 +626,7 @@ static struct loader_callbacks cb = { .stat = cb_stat, .diskread = cb_diskread, + .diskwrite = cb_diskwrite, .diskioctl = cb_diskioctl, .copyin = cb_copyin, ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r366291 - head/sys/gdb
On Wed, Sep 30, 2020 at 7:56 AM Conrad Meyer wrote: > Author: cem > Date: Wed Sep 30 14:55:54 2020 > New Revision: 366291 > URL: https://svnweb.freebsd.org/changeset/base/366291 > > Log: > gdb(4): Don't escape GDB special characters at application layer > > In r351368, we introduced this XML- and GDB-encoded data. The protocol > 'offset' should reflex the logical XML data offset, but unfortunately we typo: should _reflect_ > counted the GDB escapes as well. ___ 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: r366291 - head/sys/gdb
Author: cem Date: Wed Sep 30 14:55:54 2020 New Revision: 366291 URL: https://svnweb.freebsd.org/changeset/base/366291 Log: gdb(4): Don't escape GDB special characters at application layer In r351368, we introduced this XML- and GDB-encoded data. The protocol 'offset' should reflex the logical XML data offset, but unfortunately we counted the GDB escapes as well. In fact, we cannot safely do GDB character escaping at this layer at all, because we don't know what will be flushed in a packet. It is bogus to send only the first character of a two-character escape sequence. This patch "corrects" the problem by squashing these characters in the transmitted XML document. It would be nice to transmit the characters faithfully, but that is a more complicated change. Thread names are a nice convenience feature for the GDB client, but one can always inspect td_name or p_comm directly to find the true name. Reported by: Ka Ho Ng Tested by:Ka Ho Ng Reviewed by: emaste, markj, rlibby Differential Revision:https://reviews.freebsd.org/D26599 Modified: head/sys/gdb/gdb_main.c Modified: head/sys/gdb/gdb_main.c == --- head/sys/gdb/gdb_main.c Wed Sep 30 13:33:28 2020(r366290) +++ head/sys/gdb/gdb_main.c Wed Sep 30 14:55:54 2020(r366291) @@ -361,9 +361,7 @@ init_qXfer_ctx(struct qXfer_context *qx, uintmax_t len } /* - * dst must be 2x strlen(max_src) + 1. - * - * Squashes invalid XML characters down to _. Sorry. Then escapes for GDB. + * Squashes special XML and GDB characters down to _. Sorry. */ static void qXfer_escape_xmlattr_str(char *dst, size_t dstlen, const char *src) @@ -384,8 +382,18 @@ qXfer_escape_xmlattr_str(char *dst, size_t dstlen, con /* GDB escape. */ if (strchr(forbidden, c) != NULL) { + /* +* It would be nice to escape these properly, but to do +* it correctly we need to escape them in the transmit +* layer, potentially doubling our buffer requirements. +* For now, avoid breaking the protocol by squashing +* them to underscore. +*/ +#if 0 *dst++ = '}'; c ^= 0x20; +#endif + c = '_'; } *dst++ = c; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r366136 - in head/sys/dev: amdsmn amdtemp
Author: cem Date: Fri Sep 25 04:16:28 2020 New Revision: 366136 URL: https://svnweb.freebsd.org/changeset/base/366136 Log: amdtemp(4), amdsmn(4): Attach to Ryzen 4000 APU (Zen 2, "Renoir") PR: 249864 Reported by: Florian Millet Tested by:Florian Millet Modified: head/sys/dev/amdsmn/amdsmn.c head/sys/dev/amdtemp/amdtemp.c Modified: head/sys/dev/amdsmn/amdsmn.c == --- head/sys/dev/amdsmn/amdsmn.cFri Sep 25 01:16:01 2020 (r366135) +++ head/sys/dev/amdsmn/amdsmn.cFri Sep 25 04:16:28 2020 (r366136) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2017-2019 Conrad Meyer + * Copyright (c) 2017-2020 Conrad Meyer * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$"); #definePCI_DEVICE_ID_AMD_17H_ROOT 0x1450 #definePCI_DEVICE_ID_AMD_17H_M10H_ROOT 0x15d0 #definePCI_DEVICE_ID_AMD_17H_M30H_ROOT 0x1480 /* Also M70H. */ +#definePCI_DEVICE_ID_AMD_17H_M60H_ROOT 0x1630 struct pciid; struct amdsmn_softc { @@ -94,6 +95,12 @@ static const struct pciid { { .amdsmn_vendorid = CPU_VENDOR_AMD, .amdsmn_deviceid = PCI_DEVICE_ID_AMD_17H_M30H_ROOT, + .amdsmn_addr_reg = F17H_SMN_ADDR_REG, + .amdsmn_data_reg = F17H_SMN_DATA_REG, + }, + { + .amdsmn_vendorid = CPU_VENDOR_AMD, + .amdsmn_deviceid = PCI_DEVICE_ID_AMD_17H_M60H_ROOT, .amdsmn_addr_reg = F17H_SMN_ADDR_REG, .amdsmn_data_reg = F17H_SMN_DATA_REG, }, Modified: head/sys/dev/amdtemp/amdtemp.c == --- head/sys/dev/amdtemp/amdtemp.c Fri Sep 25 01:16:01 2020 (r366135) +++ head/sys/dev/amdtemp/amdtemp.c Fri Sep 25 04:16:28 2020 (r366136) @@ -107,6 +107,7 @@ struct amdtemp_softc { #defineDEVICEID_AMD_HOSTB17H_ROOT 0x1450 #defineDEVICEID_AMD_HOSTB17H_M10H_ROOT 0x15d0 #defineDEVICEID_AMD_HOSTB17H_M30H_ROOT 0x1480 /* Also M70h. */ +#defineDEVICEID_AMD_HOSTB17H_M60H_ROOT 0x1630 static const struct amdtemp_product { uint16_tamdtemp_vendorid; @@ -130,6 +131,7 @@ static const struct amdtemp_product { { VENDORID_AMD, DEVICEID_AMD_HOSTB17H_ROOT, false }, { VENDORID_AMD, DEVICEID_AMD_HOSTB17H_M10H_ROOT, false }, { VENDORID_AMD, DEVICEID_AMD_HOSTB17H_M30H_ROOT, false }, + { VENDORID_AMD, DEVICEID_AMD_HOSTB17H_M60H_ROOT, false }, }; /* ___ 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: r366078 - head/sbin/reboot
Author: cem Date: Wed Sep 23 17:04:27 2020 New Revision: 366078 URL: https://svnweb.freebsd.org/changeset/base/366078 Log: nextboot(8): Fix behavior on non-ZFS /boot systems Fix unquoted test for an empty value, which broke nextboot(8) on non-ZFS /boot systems after r365938. Discussed with: allanjude, tsoome X-MFC-With: r365938 Modified: head/sbin/reboot/nextboot.sh Modified: head/sbin/reboot/nextboot.sh == --- head/sbin/reboot/nextboot.shWed Sep 23 14:52:43 2020 (r366077) +++ head/sbin/reboot/nextboot.shWed Sep 23 17:04:27 2020 (r366078) @@ -116,7 +116,7 @@ set -e nextboot_tmp=$(mktemp $(dirname ${nextboot_file})/nextboot.XX) -if [ -n ${zfs} ]; then +if [ -n "${zfs}" ]; then zfsbootcfg -z ${zfs} -n freebsd:nvstore -k nextboot_enable -v YES cat >> ${nextboot_tmp} << EOF $kenv ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r365984 - head/usr.bin/calendar/calendars
Big ol plus one from me. On Mon, Sep 21, 2020 at 4:16 PM Cy Schubert wrote: > > In message <202009212255.08lmtpsp078...@repo.freebsd.org>, Greg Lehey > writes: > > Author: grog > > Date: Mon Sep 21 22:55:51 2020 > > New Revision: 365984 > > URL: https://svnweb.freebsd.org/changeset/base/365984 > > > > Log: > > Remove claim that Allied Forces created "West Germany" in 1953. I can > > find no historic substantiation for such a claim. The Federal > > Republic of Germany was created by Germans on 23 May 1949, as also > > noted in this file. > > > > Modified: > > head/usr.bin/calendar/calendars/calendar.history > > > > Modified: head/usr.bin/calendar/calendars/calendar.history > > = > > = > > --- head/usr.bin/calendar/calendars/calendar.history Mon Sep 21 22:52:57 > > 202 > > 0 (r365983) > > +++ head/usr.bin/calendar/calendars/calendar.history Mon Sep 21 22:55:51 > > 202 > > 0 (r365984) > > @@ -521,7 +521,6 @@ > > 09/20Magellan leaves Spain on the first Round the World passage, > > 151 > > 9 > > 09/20The Roxy Theater opens in Hollywood, 1973 > > 09/21J. R. R. Tolkien's The Hobbit is published, 1937 > > -09/22Allied forces form the independent nation West Germany, 1953 > > 09/22US President Lincoln issues the Emancipation Proclamation, > > 1862 > > 09/22Special prosecutor Leon Jeworski subpoenas US President Nixon, > > 1974 > > 09/22The first Soviet atomic bomb explodes, 1949 > > > > Does this file still need to be in FreeBSD? It may have been a novelty back > in the day but IMO calendar.history has nothing to do with BSD, computers > or anything else of interest to FreeBSD. At the very least this file should > be moved to ports or better yet, removed entirely. I simply don't see the > point of it being in the tree and distributed with an O/S, any O/S. > > > -- > Cheers, > Cy Schubert > FreeBSD UNIX: Web: https://FreeBSD.org > NTP: Web: https://nwtime.org > > The need of the many outweighs the greed of the few. > > ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r364786 - head/sys/vm
Author: cem Date: Tue Aug 25 21:36:56 2020 New Revision: 364786 URL: https://svnweb.freebsd.org/changeset/base/364786 Log: vm_pageout: Scale worker threads with CPUs Autoscale vm_pageout worker threads from r364129 with CPU count. The default is arbitrarily chosen to be 16 CPUs per worker thread, but can be adjusted with the vm.pageout_cpus_per_thread tunable. There will never be less than 1 thread per populated NUMA domain, and the previous arbitrary upper limit (at most ncpus/2 threads per NUMA domain) is preserved. Care is taken to gracefully handle asymmetric NUMA nodes, such as empty node systems (e.g., AMD 2990WX) and systems with nodes of varying size (e.g., some larger >20 core Intel Haswell/Broadwell Xeon). Reviewed by: kib, markj Sponsored by: Isilon Differential Revision:https://reviews.freebsd.org/D26152 Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c == --- head/sys/vm/vm_pageout.cTue Aug 25 21:07:27 2020(r364785) +++ head/sys/vm/vm_pageout.cTue Aug 25 21:36:56 2020(r364786) @@ -165,11 +165,10 @@ SYSCTL_INT(_vm, OID_AUTO, pageout_update_period, CTLFLAG_RWTUN, _pageout_update_period, 0, "Maximum active LRU update period"); -/* Access with get_pageout_threads_per_domain(). */ -static int pageout_threads_per_domain = 1; -SYSCTL_INT(_vm, OID_AUTO, pageout_threads_per_domain, CTLFLAG_RDTUN, -_threads_per_domain, 0, -"Number of worker threads comprising each per-domain pagedaemon"); +static int pageout_cpus_per_thread = 16; +SYSCTL_INT(_vm, OID_AUTO, pageout_cpus_per_thread, CTLFLAG_RDTUN, +_cpus_per_thread, 0, +"Number of CPUs per pagedaemon worker thread"); SYSCTL_INT(_vm, OID_AUTO, lowmem_period, CTLFLAG_RWTUN, _period, 0, "Low memory callback period"); @@ -2200,38 +2199,38 @@ vm_pageout_helper(void *arg) } static int -get_pageout_threads_per_domain(void) +get_pageout_threads_per_domain(const struct vm_domain *vmd) { - static bool resolved = false; - int half_cpus_per_dom; + unsigned total_pageout_threads, eligible_cpus, domain_cpus; - /* -* This is serialized externally by the sorted autoconfig portion of -* boot. -*/ - if (__predict_true(resolved)) - return (pageout_threads_per_domain); + if (VM_DOMAIN_EMPTY(vmd->vmd_domain)) + return (0); /* * Semi-arbitrarily constrain pagedaemon threads to less than half the -* total number of threads in the system as an insane upper limit. +* total number of CPUs in the system as an upper limit. */ - half_cpus_per_dom = howmany(mp_ncpus / vm_ndomains, 2); + if (pageout_cpus_per_thread < 2) + pageout_cpus_per_thread = 2; + else if (pageout_cpus_per_thread > mp_ncpus) + pageout_cpus_per_thread = mp_ncpus; - if (pageout_threads_per_domain < 1) { - printf("Invalid tuneable vm.pageout_threads_per_domain value: " - "%d out of valid range: [1-%d]; clamping to 1\n", - pageout_threads_per_domain, half_cpus_per_dom); - pageout_threads_per_domain = 1; - } else if (pageout_threads_per_domain > half_cpus_per_dom) { - printf("Invalid tuneable vm.pageout_threads_per_domain value: " - "%d out of valid range: [1-%d]; clamping to %d\n", - pageout_threads_per_domain, half_cpus_per_dom, - half_cpus_per_dom); - pageout_threads_per_domain = half_cpus_per_dom; - } - resolved = true; - return (pageout_threads_per_domain); + total_pageout_threads = howmany(mp_ncpus, pageout_cpus_per_thread); + domain_cpus = CPU_COUNT(_domain[vmd->vmd_domain]); + + /* Pagedaemons are not run in empty domains. */ + eligible_cpus = mp_ncpus; + for (unsigned i = 0; i < vm_ndomains; i++) + if (VM_DOMAIN_EMPTY(i)) + eligible_cpus -= CPU_COUNT(_domain[i]); + + /* +* Assign a portion of the total pageout threads to this domain +* corresponding to the fraction of pagedaemon-eligible CPUs in the +* domain. In asymmetric NUMA systems, domains with more CPUs may be +* allocated more threads than domains with fewer CPUs. +*/ + return (howmany(total_pageout_threads * domain_cpus, eligible_cpus)); } /* @@ -2288,7 +2287,7 @@ vm_pageout_init_domain(int domain) "pidctrl", CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, ""); pidctrl_init_sysctl(>vmd_pid, SYSCTL_CHILDREN(oid)); - vmd->vmd_inactive_threads = get_pageout_threads_per_domain(); + vmd->vmd_inactive_threads = get_pageout_threads_per_domain(vmd); } static void @@ -2343,7 +2342,6 @@ vm_pageout(void) p = curproc; td =
svn commit: r364358 - head/sys/gdb
Author: cem Date: Tue Aug 18 20:59:10 2020 New Revision: 364358 URL: https://svnweb.freebsd.org/changeset/base/364358 Log: gdb(4): Support empty qSupported queries Technically a client may send a qSupported query without specifying any client features. We should respond with our supported list in that case instead of bailing with error. Reported by: rlibby Reviewed by: emaste, rlibby, vangyzen Sponsored by: Isilon Differential Revision:https://reviews.freebsd.org/D26115 Modified: head/sys/gdb/gdb_main.c Modified: head/sys/gdb/gdb_main.c == --- head/sys/gdb/gdb_main.c Tue Aug 18 20:41:03 2020(r364357) +++ head/sys/gdb/gdb_main.c Tue Aug 18 20:59:10 2020(r364358) @@ -204,8 +204,14 @@ gdb_do_qsupported(uint32_t *feat) /* Parse supported host features */ *feat = 0; - if (gdb_rx_char() != ':') + switch (gdb_rx_char()) { + case ':': + break; + case EOF: + goto nofeatures; + default: goto error; + } while (gdb_rxsz > 0) { tok = gdb_rxp; @@ -250,6 +256,7 @@ gdb_do_qsupported(uint32_t *feat) *feat |= BIT(i); } +nofeatures: /* Send a supported feature list back */ gdb_tx_begin(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: r364316 - in head: lib/geom/part sys/geom/part sys/sys/disk
Author: cem Date: Mon Aug 17 17:07:05 2020 New Revision: 364316 URL: https://svnweb.freebsd.org/changeset/base/364316 Log: gpart(8): Recognize apple-zfs and solaris-reserved partition ids Introduce G_PART_ALIAS_SOLARIS_RESERVED, GPT_ENT_TYPE_SOLARIS_RESERVED et al., to make gpart show output more convenient on systems with illumos/openindiana disks visible. Submitted by: Juraj Lutter Reviewed by: bcr(manpages), delphij, myself Differential Revision:https://reviews.freebsd.org/D26012 Modified: head/lib/geom/part/gpart.8 head/sys/geom/part/g_part.c head/sys/geom/part/g_part.h head/sys/geom/part/g_part_gpt.c head/sys/sys/disk/gpt.h Modified: head/lib/geom/part/gpart.8 == --- head/lib/geom/part/gpart.8 Mon Aug 17 16:51:21 2020(r364315) +++ head/lib/geom/part/gpart.8 Mon Aug 17 17:07:05 2020(r364316) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 23, 2019 +.Dd August 17, 2020 .Dt GPART 8 .Os .Sh NAME @@ -312,7 +312,7 @@ option. The partition cannot be actively used by the kernel. .Pp The -.cm delete +.Cm delete command accepts these options: .Bl -tag -width 10n .It Fl f Ar flags @@ -755,6 +755,15 @@ for MBR, for APM and .Qq Li "!55465300--11aa-aa11-00306543ecac" for GPT. +.It Cm apple-zfs +An Apple Mac OS X partition that contains a ZFS volume. +The scheme-specific type is +.Qq Li "!6a898cc3-1dd2-11b2-99a6-080020736631" +for GPT. The same GUID is being used also for +.Sy illumos/Solaris /usr partition . +See +.Sx CAVEATS +section below. .It Cm dragonfly-label32 A DragonFlyBSD partition subdivided into filesystems with a .Bx @@ -920,8 +929,48 @@ notably those made by IBM. The scheme-specific types are .Qq Li "!65" for MBR and -.Qq Li "!0x9e1a2d38-c612-4316-aa26-8b49521e5a8b" +.Qq Li "!9e1a2d38-c612-4316-aa26-8b49521e5a8b" for GPT. +.It Cm solaris-boot +A illumos/Solaris partition dedicated to boot loader. +The scheme-specific type is +.Qq Li "!6a82cb45-1dd2-11b2-99a6-080020736631" +for GPT. +.It Cm solaris-root +A illumos/Solaris partition dedicated to root filesystem. +The scheme-specific type is +.Qq Li "!6a85cf4d-1dd2-11b2-99a6-080020736631" +for GPT. +.It Cm solaris-swap +A illumos/Solaris partition dedicated to swap. +The scheme-specific type is +.Qq Li "!6a87c46f-1dd2-11b2-99a6-080020736631" +for GPT. +.It Cm solaris-backup +A illumos/Solaris partition dedicated to backup. +The scheme-specific type is +.Qq Li "!6a8b642b-1dd2-11b2-99a6-080020736631" +for GPT. +.It Cm solaris-var +A illumos/Solaris partition dedicated to /var filesystem. +The scheme-specific type is +.Qq Li "!6a8ef2e9-1dd2-11b2-99a6-080020736631" +for GPT. +.It Cm solaris-home +A illumos/Solaris partition dedicated to /home filesystem. +The scheme-specific type is +.Qq Li "!6a90ba39-1dd2-11b2-99a6-080020736631" +for GPT. +.It Cm solaris-altsec +A illumos/Solaris partition dedicated to alternate sector. +The scheme-specific type is +.Qq Li "!6a9283a5-1dd2-11b2-99a6-080020736631" +for GPT. +.It Cm solaris-reserved +A illumos/Solaris partition dedicated to reserved space. +The scheme-specific type is +.Qq Li "!6a945a3b-1dd2-11b2-99a6-080020736631" +for GPT. .It Cm vmware-vmfs A partition that contains a VMware File System (VMFS). The scheme-specific types are @@ -1466,3 +1515,8 @@ utility appeared in .Fx 7.0 . .Sh AUTHORS .An Marcel Moolenaar Aq Mt mar...@freebsd.org +.Sh CAVEATS +Partition type +.Em apple-zfs +(6a898cc3-1dd2-11b2-99a6-080020736631) is also being used +on illumos/Solaris platforms for ZFS volumes. Modified: head/sys/geom/part/g_part.c == --- head/sys/geom/part/g_part.c Mon Aug 17 16:51:21 2020(r364315) +++ head/sys/geom/part/g_part.c Mon Aug 17 17:07:05 2020(r364316) @@ -76,6 +76,7 @@ struct g_part_alias_list { { "apple-raid-offline", G_PART_ALIAS_APPLE_RAID_OFFLINE }, { "apple-tv-recovery", G_PART_ALIAS_APPLE_TV_RECOVERY }, { "apple-ufs", G_PART_ALIAS_APPLE_UFS }, + { "apple-zfs", G_PART_ALIAS_APPLE_ZFS }, { "bios-boot", G_PART_ALIAS_BIOS_BOOT }, { "chromeos-firmware", G_PART_ALIAS_CHROMEOS_FIRMWARE }, { "chromeos-kernel", G_PART_ALIAS_CHROMEOS_KERNEL }, @@ -122,6 +123,14 @@ struct g_part_alias_list { { "ntfs", G_PART_ALIAS_MS_NTFS }, { "openbsd-data", G_PART_ALIAS_OPENBSD_DATA }, { "prep-boot", G_PART_ALIAS_PREP_BOOT }, +{ "solaris-boot", G_PART_ALIAS_SOLARIS_BOOT }, +{ "solaris-root", G_PART_ALIAS_SOLARIS_ROOT }, +{ "solaris-swap", G_PART_ALIAS_SOLARIS_SWAP }, +{ "solaris-backup", G_PART_ALIAS_SOLARIS_BACKUP }, +{ "solaris-var", G_PART_ALIAS_SOLARIS_VAR }, +{ "solaris-home", G_PART_ALIAS_SOLARIS_HOME }, +{ "solaris-altsec", G_PART_ALIAS_SOLARIS_ALTSEC }, + { "solaris-reserved", G_PART_ALIAS_SOLARIS_RESERVED }, {
svn commit: r364261 - head/sys/kern
Author: cem Date: Sat Aug 15 19:45:50 2020 New Revision: 364261 URL: https://svnweb.freebsd.org/changeset/base/364261 Log: witness(4): Print stack of prior observed lock order on reversal The first time Witness observes a lock order between two locks, it records the caller's stack. On detected reversal, print out that previous observed stack. It is quite possible that the reported "LOR" is the correct ordering, and the violation was the observed earlier ordering. Reviewed by: mjg Differential Revision:https://reviews.freebsd.org/D26070 Modified: head/sys/kern/subr_witness.c Modified: head/sys/kern/subr_witness.c == --- head/sys/kern/subr_witness.cSat Aug 15 18:46:26 2020 (r364260) +++ head/sys/kern/subr_witness.cSat Aug 15 19:45:50 2020 (r364261) @@ -338,6 +338,7 @@ static void witness_ddb_display_list(int(*prnt)(const static voidwitness_ddb_level_descendants(struct witness *parent, int l); static voidwitness_ddb_list(struct thread *td); #endif +static voidwitness_enter_debugger(const char *msg); static voidwitness_debugger(int cond, const char *msg); static voidwitness_free(struct witness *m); static struct witness *witness_get(void); @@ -358,6 +359,8 @@ static struct witness_lock_order_data *witness_lock_or static voidwitness_list_lock(struct lock_instance *instance, int (*prnt)(const char *fmt, ...)); static int witness_output(const char *fmt, ...) __printflike(1, 2); +static int witness_output_drain(void *arg __unused, const char *data, + int len); static int witness_voutput(const char *fmt, va_list ap) __printflike(1, 0); static voidwitness_setflag(struct lock_object *lock, int flag, int set); @@ -1281,6 +1284,8 @@ witness_checkorder(struct lock_object *lock, int flags for (j = 0, lle = lock_list; lle != NULL; lle = lle->ll_next) { for (i = lle->ll_count - 1; i >= 0; i--, j++) { + struct stack pstack; + bool pstackv, trace; MPASS(j < LOCK_CHILDCOUNT * LOCK_NCHILDREN); lock1 = >ll_children[i]; @@ -1367,6 +1372,19 @@ witness_checkorder(struct lock_object *lock, int flags */ if (blessed(w, w1)) goto out; + + trace = atomic_load_int(_trace); + if (trace) { + struct witness_lock_order_data *data; + + pstackv = false; + data = witness_lock_order_get(w, w1); + if (data != NULL) { + stack_copy(>wlod_stack, + ); + pstackv = true; + } + } mtx_unlock_spin(_mtx); #ifdef WITNESS_NO_VNODE @@ -1413,28 +1431,60 @@ witness_checkorder(struct lock_object *lock, int flags i--; } while (i >= 0); if (i < 0) { - witness_output(" 1st %p %s (%s) @ %s:%d\n", + witness_output(" 1st %p %s (%s, %s) @ %s:%d\n", lock1->li_lock, lock1->li_lock->lo_name, - w1->w_name, fixup_filename(lock1->li_file), + w1->w_name, w1->w_class->lc_name, + fixup_filename(lock1->li_file), lock1->li_line); - witness_output(" 2nd %p %s (%s) @ %s:%d\n", lock, - lock->lo_name, w->w_name, - fixup_filename(file), line); + witness_output(" 2nd %p %s (%s, %s) @ %s:%d\n", + lock, lock->lo_name, w->w_name, + w->w_class->lc_name, fixup_filename(file), + line); } else { - witness_output(" 1st %p %s (%s) @ %s:%d\n", + struct witness *w2 = lock2->li_lock->lo_witness; + + witness_output(" 1st %p %s (%s, %s) @ %s:%d\n", lock2->li_lock, lock2->li_lock->lo_name, - lock2->li_lock->lo_witness->w_name, + w2->w_name, w2->w_class->lc_name, fixup_filename(lock2->li_file), lock2->li_line); - witness_output(" 2nd %p %s (%s) @
svn commit: r364260 - head/sys/contrib/pcg-c/include
Author: cem Date: Sat Aug 15 18:46:26 2020 New Revision: 364260 URL: https://svnweb.freebsd.org/changeset/base/364260 Log: pcg-c: Add 'static' to inline function definitions Make the inlines static to avoid kernel build failure with Clang 11 on i386. (The issue was not observed with Clang 10, currently in tree; reproduction depends on compiler inlining choices.) The compiler may choose not to inline 'bare' C inlines, and in that case expects a symbol of the same name will be available. It does not automatically define that symbol at use, because of traditional C linking semantics. (In contrast, C++ does define it, and then deduplicates redundant definitions at link). As we do not instantiate the C99 inline ('extern inline ...;'), the linker errors with "undefined symbol." Reported by: dim Tested by:dim Fixes:r364219 Modified: head/sys/contrib/pcg-c/include/pcg_variants.h Modified: head/sys/contrib/pcg-c/include/pcg_variants.h == --- head/sys/contrib/pcg-c/include/pcg_variants.h Sat Aug 15 17:18:36 2020(r364259) +++ head/sys/contrib/pcg-c/include/pcg_variants.h Sat Aug 15 18:46:26 2020(r364260) @@ -53,7 +53,7 @@ extern "C" { * Rotate helper functions. */ -inline uint8_t pcg_rotr_8(uint8_t value, unsigned int rot) +static inline uint8_t pcg_rotr_8(uint8_t value, unsigned int rot) { /* Unfortunately, clang is kinda pathetic when it comes to properly * recognizing idiomatic rotate code, so for clang we actually provide @@ -67,7 +67,7 @@ inline uint8_t pcg_rotr_8(uint8_t value, unsigned int #endif } -inline uint16_t pcg_rotr_16(uint16_t value, unsigned int rot) +static inline uint16_t pcg_rotr_16(uint16_t value, unsigned int rot) { #if PCG_USE_INLINE_ASM && defined(__clang__) && (defined(__x86_64__) || defined(__i386__)) __asm__ ("rorw %%cl, %0" : "=r" (value) : "0" (value), "c" (rot)); @@ -77,7 +77,7 @@ inline uint16_t pcg_rotr_16(uint16_t value, unsigned i #endif } -inline uint32_t pcg_rotr_32(uint32_t value, unsigned int rot) +static inline uint32_t pcg_rotr_32(uint32_t value, unsigned int rot) { #if PCG_USE_INLINE_ASM && defined(__clang__) && (defined(__x86_64__) || defined(__i386__)) __asm__ ("rorl %%cl, %0" : "=r" (value) : "0" (value), "c" (rot)); @@ -87,7 +87,7 @@ inline uint32_t pcg_rotr_32(uint32_t value, unsigned i #endif } -inline uint64_t pcg_rotr_64(uint64_t value, unsigned int rot) +static inline uint64_t pcg_rotr_64(uint64_t value, unsigned int rot) { #if 0 && PCG_USE_INLINE_ASM && defined(__clang__) && (defined(__x86_64__) || defined(__i386__)) /* For whatever reason, clang actually *does* generate rotq by @@ -100,7 +100,7 @@ inline uint64_t pcg_rotr_64(uint64_t value, unsigned i } #if PCG_HAS_128BIT_OPS -inline pcg128_t pcg_rotr_128(pcg128_t value, unsigned int rot) +static inline pcg128_t pcg_rotr_128(pcg128_t value, unsigned int rot) { return (value >> rot) | (value << ((- rot) & 127)); } @@ -112,24 +112,24 @@ inline pcg128_t pcg_rotr_128(pcg128_t value, unsigned /* XSH RS */ -inline uint8_t pcg_output_xsh_rs_16_8(uint16_t state) +static inline uint8_t pcg_output_xsh_rs_16_8(uint16_t state) { return (uint8_t)(((state >> 7u) ^ state) >> ((state >> 14u) + 3u)); } -inline uint16_t pcg_output_xsh_rs_32_16(uint32_t state) +static inline uint16_t pcg_output_xsh_rs_32_16(uint32_t state) { return (uint16_t)(((state >> 11u) ^ state) >> ((state >> 30u) + 11u)); } -inline uint32_t pcg_output_xsh_rs_64_32(uint64_t state) +static inline uint32_t pcg_output_xsh_rs_64_32(uint64_t state) { return (uint32_t)(((state >> 22u) ^ state) >> ((state >> 61u) + 22u)); } #if PCG_HAS_128BIT_OPS -inline uint64_t pcg_output_xsh_rs_128_64(pcg128_t state) +static inline uint64_t pcg_output_xsh_rs_128_64(pcg128_t state) { return (uint64_t)(((state >> 43u) ^ state) >> ((state >> 124u) + 45u)); } @@ -137,23 +137,23 @@ inline uint64_t pcg_output_xsh_rs_128_64(pcg128_t stat /* XSH RR */ -inline uint8_t pcg_output_xsh_rr_16_8(uint16_t state) +static inline uint8_t pcg_output_xsh_rr_16_8(uint16_t state) { return pcg_rotr_8(((state >> 5u) ^ state) >> 5u, state >> 13u); } -inline uint16_t pcg_output_xsh_rr_32_16(uint32_t state) +static inline uint16_t pcg_output_xsh_rr_32_16(uint32_t state) { return pcg_rotr_16(((state >> 10u) ^ state) >> 12u, state >> 28u); } -inline uint32_t pcg_output_xsh_rr_64_32(uint64_t state) +static inline uint32_t pcg_output_xsh_rr_64_32(uint64_t state) { return pcg_rotr_32(((state >> 18u) ^ state) >> 27u, state >> 59u); } #if PCG_HAS_128BIT_OPS -inline uint64_t pcg_output_xsh_rr_128_64(pcg128_t state) +static inline uint64_t pcg_output_xsh_rr_128_64(pcg128_t state) { return pcg_rotr_64(((state >> 35u) ^ state) >> 58u, state >> 122u); } @@ -161,25 +161,25 @@ inline uint64_t
svn commit: r364237 - head/sys/vm
Author: cem Date: Fri Aug 14 18:48:48 2020 New Revision: 364237 URL: https://svnweb.freebsd.org/changeset/base/364237 Log: vm_pageout: Correct threshold calculation on single-CPU systems Reported by: Michael Butler X-MFC-With: r364129 Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c == --- head/sys/vm/vm_pageout.cFri Aug 14 16:44:10 2020(r364236) +++ head/sys/vm/vm_pageout.cFri Aug 14 18:48:48 2020(r364237) @@ -2216,7 +2216,7 @@ get_pageout_threads_per_domain(void) * Semi-arbitrarily constrain pagedaemon threads to less than half the * total number of threads in the system as an insane upper limit. */ - half_cpus_per_dom = (mp_ncpus / vm_ndomains) / 2; + half_cpus_per_dom = howmany(mp_ncpus / vm_ndomains, 2); if (pageout_threads_per_domain < 1) { printf("Invalid tuneable vm.pageout_threads_per_domain value: " ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r364219 - in head: share/man/man9 sys/conf sys/contrib/pcg-c/include sys/kern sys/libkern sys/sys
On Thu, Aug 13, 2020 at 2:06 PM Mateusz Guzik wrote: > > I have trouble deciphering. Is this callable from interrupt context? > If not, the code should assert it's not executing in one. If yes, it > should probably just sched_pin. It is not callable from interrupt context. If you know a way to assert that, I'd love to add it. I was unable to find a way in MI code to assert on that condition, which is predominantly in MD code Best, Conrad > On 8/13/20, Conrad Meyer wrote: > > Author: cem > > Date: Thu Aug 13 20:48:14 2020 > > New Revision: 364219 > > URL: https://svnweb.freebsd.org/changeset/base/364219 > > > > Log: > > Add prng(9) API ___ 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: r364219 - in head: share/man/man9 sys/conf sys/contrib/pcg-c/include sys/kern sys/libkern sys/sys
Author: cem Date: Thu Aug 13 20:48:14 2020 New Revision: 364219 URL: https://svnweb.freebsd.org/changeset/base/364219 Log: Add prng(9) API Add prng(9) as a replacement for random(9) in the kernel. There are two major differences from random(9) and random(3): - General prng(9) APIs (prng32(9), etc) do not guarantee an implementation or particular sequence; they should not be used for repeatable simulations. - However, specific named API families are also exposed (for now: PCG), and those are expected to be repeatable (when so-guaranteed by the named algorithm). Some minor differences from random(3) and earlier random(9): - PRNG state for the general prng(9) APIs is per-CPU; this eliminates contention on PRNG state in SMP workloads. Each PCPU generator in an SMP system produces a unique sequence. - Better statistical properties than the Park-Miller ("minstd") PRNG (longer period, uniform distribution in all bits, passes BigCrush/PractRand analysis). - Faster than Park-Miller ("minstd") PRNG -- no division is required to step PCG-family PRNGs. For now, random(9) becomes a thin shim around prng32(). Eventually I would like to mechanically switch consumers over to the explicit API. Reviewed by: kib, markj (previous version both) Discussed with: markm Differential Revision:https://reviews.freebsd.org/D25916 Added: head/share/man/man9/prng.9 (contents, props changed) head/sys/kern/subr_prng.c (contents, props changed) head/sys/sys/prng.h (contents, props changed) Modified: head/share/man/man9/Makefile head/sys/conf/files head/sys/contrib/pcg-c/include/pcg_variants.h head/sys/libkern/random.c Modified: head/share/man/man9/Makefile == --- head/share/man/man9/MakefileThu Aug 13 20:28:35 2020 (r364218) +++ head/share/man/man9/MakefileThu Aug 13 20:48:14 2020 (r364219) @@ -272,6 +272,7 @@ MAN=accept_filter.9 \ printf.9 \ prison_check.9 \ priv.9 \ + prng.9 \ proc_rwmem.9 \ pseudofs.9 \ psignal.9 \ @@ -1745,6 +1746,10 @@ MLINKS+=printf.9 log.9 \ printf.9 uprintf.9 MLINKS+=priv.9 priv_check.9 \ priv.9 priv_check_cred.9 +MLINKS+=prng.9 prng32.9 \ + prng.9 prng32_bounded.9 \ + prng.9 prng64.9 \ + prng.9 prng64_bounded.9 MLINKS+=proc_rwmem.9 proc_readmem.9 \ proc_rwmem.9 proc_writemem.9 MLINKS+=psignal.9 gsignal.9 \ Added: head/share/man/man9/prng.9 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man9/prng.9 Thu Aug 13 20:48:14 2020(r364219) @@ -0,0 +1,99 @@ +.\"- +.\" Copyright 2020 Conrad Meyer . All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\"notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\"notice, this list of conditions and the following disclaimer in the +.\"documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd August 5, 2020 +.Dt PRNG 9 +.Os +.Sh NAME +.Nm prng +.Nd "Kernel pseudo-random number generators" +.Sh SYNOPSIS +.In sys/prng.h +.Ft uint32_t +.Fn prng32 void +.Ft uint32_t +.Fn prng32_bounded "uint32_t bound" +.Ft uint64_t +.Fn prng64 void +.Ft uint64_t +.Fn prng64_bounded "uint64_t bound" +.Sh DESCRIPTION +.Ss GENERIC PRNG ROUTINES +.Nm +is a family of fast, +.Em non-cryptographic +pseudo-random number generators. +Unlike +.Xr random 9 , +.Fn prng32 , +.Fn prng32_bounded , +.Fn prng64 , +and +.Fn prng64_bounded +avoid share
svn commit: r364135 - in head/sys: fs/devfs kern
Author: cem Date: Wed Aug 12 00:32:31 2020 New Revision: 364135 URL: https://svnweb.freebsd.org/changeset/base/364135 Log: devfs: Abstract locking assertions The conversion was largely mechanical: sed(1) with: -e 's|mtx_assert(, MA_OWNED)|dev_lock_assert_locked()|g' -e 's|mtx_assert(, MA_NOTOWNED)|dev_lock_assert_unlocked()|g' The definitions of these abstractions in fs/devfs/devfs_int.h are the only non-mechanical change. No functional change. Modified: head/sys/fs/devfs/devfs_devs.c head/sys/fs/devfs/devfs_int.h head/sys/kern/kern_conf.c Modified: head/sys/fs/devfs/devfs_devs.c == --- head/sys/fs/devfs/devfs_devs.c Wed Aug 12 00:21:30 2020 (r364134) +++ head/sys/fs/devfs/devfs_devs.c Wed Aug 12 00:32:31 2020 (r364135) @@ -156,7 +156,7 @@ devfs_dev_exists(const char *name) { struct cdev_priv *cdp; - mtx_assert(, MA_OWNED); + dev_lock_assert_locked(); TAILQ_FOREACH(cdp, _list, cdp_list) { if ((cdp->cdp_flags & CDP_ACTIVE) == 0) @@ -707,7 +707,7 @@ devfs_create(struct cdev *dev) { struct cdev_priv *cdp; - mtx_assert(, MA_OWNED); + dev_lock_assert_locked(); cdp = cdev2priv(dev); cdp->cdp_flags |= CDP_ACTIVE; cdp->cdp_inode = alloc_unrl(devfs_inos); @@ -721,7 +721,7 @@ devfs_destroy(struct cdev *dev) { struct cdev_priv *cdp; - mtx_assert(, MA_OWNED); + dev_lock_assert_locked(); cdp = cdev2priv(dev); cdp->cdp_flags &= ~CDP_ACTIVE; devfs_generation++; Modified: head/sys/fs/devfs/devfs_int.h == --- head/sys/fs/devfs/devfs_int.h Wed Aug 12 00:21:30 2020 (r364134) +++ head/sys/fs/devfs/devfs_int.h Wed Aug 12 00:32:31 2020 (r364135) @@ -95,6 +95,9 @@ extern struct sx clone_drain_lock; extern struct mtx cdevpriv_mtx; extern TAILQ_HEAD(cdev_priv_list, cdev_priv) cdevp_list; +#definedev_lock_assert_locked()mtx_assert(, MA_OWNED) +#definedev_lock_assert_unlocked() mtx_assert(, MA_NOTOWNED) + #endif /* _KERNEL */ #endif /* !_FS_DEVFS_DEVFS_INT_H_ */ Modified: head/sys/kern/kern_conf.c == --- head/sys/kern/kern_conf.c Wed Aug 12 00:21:30 2020(r364134) +++ head/sys/kern/kern_conf.c Wed Aug 12 00:32:31 2020(r364135) @@ -88,7 +88,7 @@ dev_unlock_and_free(void) struct cdev_priv *cdp; struct cdevsw *csw; - mtx_assert(, MA_OWNED); + dev_lock_assert_locked(); /* * Make the local copy of the list heads while the dev_mtx is @@ -116,7 +116,7 @@ dev_free_devlocked(struct cdev *cdev) { struct cdev_priv *cdp; - mtx_assert(, MA_OWNED); + dev_lock_assert_locked(); cdp = cdev2priv(cdev); KASSERT((cdp->cdp_flags & CDP_UNREF_DTR) == 0, ("destroy_dev() was not called after delist_dev(%p)", cdev)); @@ -127,7 +127,7 @@ static void cdevsw_free_devlocked(struct cdevsw *csw) { - mtx_assert(, MA_OWNED); + dev_lock_assert_locked(); SLIST_INSERT_HEAD(_gt_post_list, csw, d_postfree_list); } @@ -142,7 +142,7 @@ void dev_ref(struct cdev *dev) { - mtx_assert(, MA_NOTOWNED); + dev_lock_assert_unlocked(); mtx_lock(); dev->si_refcount++; mtx_unlock(); @@ -152,7 +152,7 @@ void dev_refl(struct cdev *dev) { - mtx_assert(, MA_OWNED); + dev_lock_assert_locked(); dev->si_refcount++; } @@ -161,7 +161,7 @@ dev_rel(struct cdev *dev) { int flag = 0; - mtx_assert(, MA_NOTOWNED); + dev_lock_assert_unlocked(); dev_lock(); dev->si_refcount--; KASSERT(dev->si_refcount >= 0, @@ -181,7 +181,7 @@ dev_refthread(struct cdev *dev, int *ref) struct cdevsw *csw; struct cdev_priv *cdp; - mtx_assert(, MA_NOTOWNED); + dev_lock_assert_unlocked(); if ((dev->si_flags & SI_ETERNAL) != 0) { *ref = 0; return (dev->si_devsw); @@ -208,7 +208,7 @@ devvn_refthread(struct vnode *vp, struct cdev **devp, struct cdev_priv *cdp; struct cdev *dev; - mtx_assert(, MA_NOTOWNED); + dev_lock_assert_unlocked(); if ((vp->v_vflag & VV_ETERNALDEV) != 0) { dev = vp->v_rdev; if (dev == NULL) @@ -249,7 +249,7 @@ void dev_relthread(struct cdev *dev, int ref) { - mtx_assert(, MA_NOTOWNED); + dev_lock_assert_unlocked(); if (!ref) return; KASSERT(dev->si_threadcount > 0, @@ -570,7 +570,7 @@ newdev(struct make_dev_args *args, struct cdev *si) struct cdev *si2; struct cdevsw *csw; - mtx_assert(, MA_OWNED); + dev_lock_assert_locked();
Re: svn commit: r364129 - head/sys/vm
Done in r364134. On Tue, Aug 11, 2020 at 3:31 PM Mark Johnston wrote: > > On Tue, Aug 11, 2020 at 03:21:31PM -0700, Conrad Meyer wrote: > > Hi Konstantin, Mark (raised the same question), > > > > On Tue, Aug 11, 2020 at 2:32 PM Konstantin Belousov > > wrote: > > > > > > On Tue, Aug 11, 2020 at 08:37:45PM +, Conrad Meyer wrote: > > > > Author: cem > > > > Date: Tue Aug 11 20:37:45 2020 > > > > New Revision: 364129 > > > > URL: https://svnweb.freebsd.org/changeset/base/364129 > > > > > > > > Log: > > > > Add support for multithreading the inactive queue pageout within a > > > > domain. > > > > ... > > > > @@ -2488,7 +2488,7 @@ vm_page_zone_import(void *arg, void **store, int > > > > cnt, > > > >* main purpose is to replenish the store of free pages. > > > >*/ > > > > if (vmd->vmd_severeset || curproc == pageproc || > > > > - !_vm_domain_allocate(vmd, VM_ALLOC_NORMAL, cnt)) > > > > + !_vm_domain_allocate(vmd, VM_ALLOC_SYSTEM, cnt)) > > > > > > Why this change needed ? > > > > The change was inherited from Jeff, along with the rest of it. I > > don't know why he changed it, but it does seem orthogonal to the rest > > of the revision. This part is nonessential as far as I know, and > > could be backed out. > > To me it doesn't make sense. The difference between VM_ALLOC_NORMAL and > _SYSTEM is that they use different thresholds for the free page count > before deciding whether to continue the allocation. The _NORMAL > threshold is higher than the _SYSTEM threshold, but both are smaller > than the "severe" threshold at which we set vmd_severeset. In other > words, if the free page count is such that a _NORMAL allocation would > fail but a _SYSTEM allocation would succeed, then vmd_severeset would be > set and we'd never get to the _vmd_domain_allocate() call to begin with. > > So, I think this part of the change should be reverted. Even if the > analysis is incorrect, it's logically separate from the rest of the > diff. Prior to r355003 it made more sense, but per that commit it can > be harmful to populate the per-CPU page caches when the system is > severely short on free pages, so I would disagree with it anyway without > more testing. ___ 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: r364134 - head/sys/vm
Author: cem Date: Wed Aug 12 00:21:30 2020 New Revision: 364134 URL: https://svnweb.freebsd.org/changeset/base/364134 Log: Back out unrelated change Reported by: kib, markj X-MFC-With: r364129 Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c == --- head/sys/vm/vm_page.c Tue Aug 11 23:36:38 2020(r364133) +++ head/sys/vm/vm_page.c Wed Aug 12 00:21:30 2020(r364134) @@ -2488,7 +2488,7 @@ vm_page_zone_import(void *arg, void **store, int cnt, * main purpose is to replenish the store of free pages. */ if (vmd->vmd_severeset || curproc == pageproc || - !_vm_domain_allocate(vmd, VM_ALLOC_SYSTEM, cnt)) + !_vm_domain_allocate(vmd, VM_ALLOC_NORMAL, cnt)) return (0); domain = vmd->vmd_domain; vm_domain_free_lock(vmd); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r364129 - head/sys/vm
Hi Konstantin, Mark (raised the same question), On Tue, Aug 11, 2020 at 2:32 PM Konstantin Belousov wrote: > > On Tue, Aug 11, 2020 at 08:37:45PM +, Conrad Meyer wrote: > > Author: cem > > Date: Tue Aug 11 20:37:45 2020 > > New Revision: 364129 > > URL: https://svnweb.freebsd.org/changeset/base/364129 > > > > Log: > > Add support for multithreading the inactive queue pageout within a domain. > > ... > > @@ -2488,7 +2488,7 @@ vm_page_zone_import(void *arg, void **store, int cnt, > >* main purpose is to replenish the store of free pages. > >*/ > > if (vmd->vmd_severeset || curproc == pageproc || > > - !_vm_domain_allocate(vmd, VM_ALLOC_NORMAL, cnt)) > > + !_vm_domain_allocate(vmd, VM_ALLOC_SYSTEM, cnt)) > > Why this change needed ? The change was inherited from Jeff, along with the rest of it. I don't know why he changed it, but it does seem orthogonal to the rest of the revision. This part is nonessential as far as I know, and could be backed out. Best, Conrad ___ 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: r364130 - head/sys/sys
Author: cem Date: Tue Aug 11 20:42:21 2020 New Revision: 364130 URL: https://svnweb.freebsd.org/changeset/base/364130 Log: smp.h: Reconcile definition and declaration of smp_ncpus The variable is defined unconditionally; declare it unconditionally as well. It is already initialized to the correct value (1) for !SMP builds. No functional change. Modified: head/sys/sys/smp.h Modified: head/sys/sys/smp.h == --- head/sys/sys/smp.h Tue Aug 11 20:37:45 2020(r364129) +++ head/sys/sys/smp.h Tue Aug 11 20:42:21 2020(r364130) @@ -154,7 +154,6 @@ struct cpu_group *smp_topo_2level(int l2share, int l2c struct cpu_group *smp_topo_find(struct cpu_group *top, int cpu); extern void (*cpustop_restartfunc)(void); -extern int smp_cpus; /* The suspend/resume cpusets are x86 only, but minimize ifdefs. */ extern volatile cpuset_t resuming_cpus;/* woken up cpus in suspend pen */ extern volatile cpuset_t started_cpus; /* cpus to let out of stop pen */ @@ -169,6 +168,7 @@ extern u_int mp_maxid; extern int mp_maxcpus; extern int mp_ncores; extern int mp_ncpus; +extern int smp_cpus; extern volatile int smp_started; extern int smp_threads_per_core; ___ 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: r364129 - head/sys/vm
Author: cem Date: Tue Aug 11 20:37:45 2020 New Revision: 364129 URL: https://svnweb.freebsd.org/changeset/base/364129 Log: Add support for multithreading the inactive queue pageout within a domain. In very high throughput workloads, the inactive scan can become overwhelmed as you have many cores producing pages and a single core freeing. Since Mark's introduction of batched pagequeue operations, we can now run multiple inactive threads working on independent batches. To avoid confusing the pid and other control algorithms, I (Jeff) do this in a mpi-like fan out and collect model that is driven from the primary page daemon. It decides whether the shortfall can be overcome with a single thread and if not dispatches multiple threads and waits for their results. The heuristic is based on timing the pageout activity and averaging a pages-per-second variable which is exponentially decayed. This is visible in sysctl and may be interesting for other purposes. I (Jeff) have verified that this does indeed double our paging throughput when used with two threads. With four we tend to run into other contention problems. For now I would like to commit this infrastructure with only a single thread enabled. The number of worker threads per domain can be controlled with the 'vm.pageout_threads_per_domain' tunable. Submitted by: jeff (earlier version) Discussed with: markj Tested by:pho Sponsored by: probably Netflix (based on contemporary commits) Differential Revision:https://reviews.freebsd.org/D21629 Modified: head/sys/vm/vm_meter.c head/sys/vm/vm_page.c head/sys/vm/vm_page.h head/sys/vm/vm_pageout.c head/sys/vm/vm_pagequeue.h Modified: head/sys/vm/vm_meter.c == --- head/sys/vm/vm_meter.c Tue Aug 11 17:54:10 2020(r364128) +++ head/sys/vm/vm_meter.c Tue Aug 11 20:37:45 2020(r364129) @@ -552,6 +552,9 @@ vm_domain_stats_init(struct vm_domain *vmd, struct sys SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, "free_severe", CTLFLAG_RD, >vmd_free_severe, 0, "Severe free pages"); + SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, + "inactive_pps", CTLFLAG_RD, >vmd_inactive_pps, 0, + "inactive pages freed/second"); } Modified: head/sys/vm/vm_page.c == --- head/sys/vm/vm_page.c Tue Aug 11 17:54:10 2020(r364128) +++ head/sys/vm/vm_page.c Tue Aug 11 20:37:45 2020(r364129) @@ -421,7 +421,7 @@ sysctl_vm_page_blacklist(SYSCTL_HANDLER_ARGS) * In principle, this function only needs to set the flag PG_MARKER. * Nonetheless, it write busies the page as a safety precaution. */ -static void +void vm_page_init_marker(vm_page_t marker, int queue, uint16_t aflags) { @@ -2488,7 +2488,7 @@ vm_page_zone_import(void *arg, void **store, int cnt, * main purpose is to replenish the store of free pages. */ if (vmd->vmd_severeset || curproc == pageproc || - !_vm_domain_allocate(vmd, VM_ALLOC_NORMAL, cnt)) + !_vm_domain_allocate(vmd, VM_ALLOC_SYSTEM, cnt)) return (0); domain = vmd->vmd_domain; vm_domain_free_lock(vmd); Modified: head/sys/vm/vm_page.h == --- head/sys/vm/vm_page.h Tue Aug 11 17:54:10 2020(r364128) +++ head/sys/vm/vm_page.h Tue Aug 11 20:37:45 2020(r364129) @@ -630,6 +630,7 @@ vm_page_t vm_page_find_least(vm_object_t, vm_pindex_t) void vm_page_free_invalid(vm_page_t); vm_page_t vm_page_getfake(vm_paddr_t paddr, vm_memattr_t memattr); void vm_page_initfake(vm_page_t m, vm_paddr_t paddr, vm_memattr_t memattr); +void vm_page_init_marker(vm_page_t marker, int queue, uint16_t aflags); int vm_page_insert (vm_page_t, vm_object_t, vm_pindex_t); void vm_page_invalid(vm_page_t m); void vm_page_launder(vm_page_t m); Modified: head/sys/vm/vm_pageout.c == --- head/sys/vm/vm_pageout.cTue Aug 11 17:54:10 2020(r364128) +++ head/sys/vm/vm_pageout.cTue Aug 11 20:37:45 2020(r364129) @@ -82,6 +82,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -163,6 +164,12 @@ SYSCTL_INT(_vm, OID_AUTO, panic_on_oom, SYSCTL_INT(_vm, OID_AUTO, pageout_update_period, CTLFLAG_RWTUN, _pageout_update_period, 0, "Maximum active LRU update period"); + +/* Access with get_pageout_threads_per_domain(). */ +static int pageout_threads_per_domain = 1; +SYSCTL_INT(_vm, OID_AUTO, pageout_threads_per_domain, CTLFLAG_RDTUN, +_threads_per_domain, 0, +"Number of worker threads comprising each per-domain pagedaemon"); SYSCTL_INT(_vm,
svn commit: r363770 - head/sys/kern
Author: cem Date: Sun Aug 2 16:34:27 2020 New Revision: 363770 URL: https://svnweb.freebsd.org/changeset/base/363770 Log: Unlocked getblk: Fix new false-positive assertion A free buf's lock may be held (temporarily) due to unlocked lookup, so buf_alloc() must acquire it without LK_NOWAIT. The unlocked getblk path should unlock it promptly once it realizes the identity does not match the buffer it was searching for. Reported by: gallatin Reviewed by: kib Tested by:pho X-MFC-With: r363482 Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D25914 Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c == --- head/sys/kern/vfs_bio.c Sun Aug 2 04:25:36 2020(r363769) +++ head/sys/kern/vfs_bio.c Sun Aug 2 16:34:27 2020(r363770) @@ -1637,7 +1637,7 @@ static struct buf * buf_alloc(struct bufdomain *bd) { struct buf *bp; - int freebufs; + int freebufs, error; /* * We can only run out of bufs in the buf zone if the average buf @@ -1660,8 +1660,10 @@ buf_alloc(struct bufdomain *bd) if (freebufs == bd->bd_lofreebuffers) bufspace_daemon_wakeup(bd); - if (BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWAIT, NULL) != 0) - panic("getnewbuf_empty: Locked buf %p on free queue.", bp); + error = BUF_LOCK(bp, LK_EXCLUSIVE, NULL); + KASSERT(error == 0, ("%s: BUF_LOCK on free buf %p: %d.", __func__, bp, + error)); + (void)error; KASSERT(bp->b_vp == NULL, ("bp: %p still has vnode %p.", bp, bp->b_vp)); ___ 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: r363722 - head/sys/kern
Author: cem Date: Fri Jul 31 00:13:40 2020 New Revision: 363722 URL: https://svnweb.freebsd.org/changeset/base/363722 Log: getblk: Remove a non-sensical LK_NOWAIT | LK_SLEEPFAIL No functional change. LK_SLEEPFAIL implies a behavior that is only possible if the lock operation can sleep. LK_NOWAIT prevents the lock operation from sleeping. Discussed with: kib Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c == --- head/sys/kern/vfs_bio.c Fri Jul 31 00:07:01 2020(r363721) +++ head/sys/kern/vfs_bio.c Fri Jul 31 00:13:40 2020(r363722) @@ -3887,10 +3887,8 @@ loop: * Buffer is in-core. If the buffer is not busy nor managed, * it must be on a queue. */ - lockflags = LK_EXCLUSIVE | LK_SLEEPFAIL | LK_INTERLOCK; - - if ((flags & GB_LOCK_NOWAIT) != 0) - lockflags |= LK_NOWAIT; + lockflags = LK_EXCLUSIVE | LK_INTERLOCK | + ((flags & GB_LOCK_NOWAIT) ? LK_NOWAIT : LK_SLEEPFAIL); error = BUF_TIMELOCK(bp, lockflags, BO_LOCKPTR(bo), "getblk", slpflag, slptimeo); ___ 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: r363721 - head/sys/kern
Author: cem Date: Fri Jul 31 00:07:01 2020 New Revision: 363721 URL: https://svnweb.freebsd.org/changeset/base/363721 Log: getblk: Avoid sleeping on wrong buf in lockless path If the buffer identity changed during lookup, sleeping could introduce a lock order reversal. Since we do not know if the identity changed until we get the lock, we must try-lock (LK_NOWAIT) only. EINTR and ERESTART error handling becomes irrelevant, as we no longer sleep. Reported by: kib Reviewed by: kib X-MFC-With: r363482 Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D25898 Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c == --- head/sys/kern/vfs_bio.c Thu Jul 30 23:54:25 2020(r363720) +++ head/sys/kern/vfs_bio.c Fri Jul 31 00:07:01 2020(r363721) @@ -3844,7 +3844,7 @@ getblkx(struct vnode *vp, daddr_t blkno, daddr_t dblkn struct buf *bp; struct bufobj *bo; daddr_t d_blkno; - int bsize, error, maxsize, vmio, lockflags; + int bsize, error, maxsize, vmio; off_t offset; CTR3(KTR_BUF, "getblk(%p, %ld, %d)", vp, (long)blkno, size); @@ -3865,14 +3865,9 @@ getblkx(struct vnode *vp, daddr_t blkno, daddr_t dblkn if (bp == NULL) goto newbuf_unlocked; - lockflags = LK_EXCLUSIVE | LK_SLEEPFAIL | - ((flags & GB_LOCK_NOWAIT) ? LK_NOWAIT : 0); - - error = BUF_TIMELOCK(bp, lockflags, NULL, "getblku", slpflag, - slptimeo); - if (error == EINTR || error == ERESTART) - return (error); - else if (error != 0) + error = BUF_TIMELOCK(bp, LK_EXCLUSIVE | LK_NOWAIT, NULL, "getblku", 0, + 0); + if (error != 0) goto loop; /* Verify buf identify has not changed since lookup. */ @@ -3886,6 +3881,8 @@ loop: BO_RLOCK(bo); bp = gbincore(bo, blkno); if (bp != NULL) { + int lockflags; + /* * Buffer is in-core. If the buffer is not busy nor managed, * it must be on a queue. ___ 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: r363720 - head/sys/contrib/pcg-c
Author: cem Date: Thu Jul 30 23:54:25 2020 New Revision: 363720 URL: https://svnweb.freebsd.org/changeset/base/363720 Log: Import PCG-C into sys/contrib The intended (future) use is to provide fast pseudo-random numbers in non- cryptographic applications. Added: head/sys/contrib/pcg-c/ - copied from r363718, vendor/pcg-c/20190718-83252d9/ ___ 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: r363718 - vendor/pcg-c/20190718-83252d9
Author: cem Date: Thu Jul 30 23:20:09 2020 New Revision: 363718 URL: https://svnweb.freebsd.org/changeset/base/363718 Log: Tag PCG-C master 2019-07-18 83252d9 Added: vendor/pcg-c/20190718-83252d9/ - copied from r363717, vendor/pcg-c/dist/ ___ 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: r363717 - in vendor/pcg-c: . dist dist/include
Author: cem Date: Thu Jul 30 23:17:30 2020 New Revision: 363717 URL: https://svnweb.freebsd.org/changeset/base/363717 Log: Import PCG-C master, 2019-07-18 (83252d9c23df9c82ecb42210afed61a7b42402d7) Added: vendor/pcg-c/ vendor/pcg-c/dist/ vendor/pcg-c/dist/include/ vendor/pcg-c/dist/include/pcg_variants.h (contents, props changed) Added: vendor/pcg-c/dist/include/pcg_variants.h == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/pcg-c/dist/include/pcg_variants.hThu Jul 30 23:17:30 2020 (r363717) @@ -0,0 +1,2544 @@ +/* + * PCG Random Number Generation for C. + * + * Copyright 2014-2019 Melissa O'Neill , + * and the PCG Project contributors. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + * + * Licensed under the Apache License, Version 2.0 (provided in + * LICENSE-APACHE.txt and at http://www.apache.org/licenses/LICENSE-2.0) + * or under the MIT license (provided in LICENSE-MIT.txt and at + * http://opensource.org/licenses/MIT), at your option. This file may not + * be copied, modified, or distributed except according to those terms. + * + * Distributed on an "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND, either + * express or implied. See your chosen license for details. + * + * For additional information about the PCG random number generation scheme, + * visit http://www.pcg-random.org/. + */ + +/* + * This code is derived from the canonical C++ PCG implementation, which + * has many additional features and is preferable if you can use C++ in + * your project. + * + * Much of the derivation was performed mechanically. In particular, the + * output functions were generated by compiling the C++ output functions + * into LLVM bitcode and then transforming that using the LLVM C backend + * (from https://github.com/draperlaboratory/llvm-cbe), and then + * postprocessing and hand editing the output. + * + * Much of the remaining code was generated by C-preprocessor metaprogramming. + */ + +#ifndef PCG_VARIANTS_H_INCLUDED +#define PCG_VARIANTS_H_INCLUDED 1 + +#include + +#if __SIZEOF_INT128__ +typedef __uint128_t pcg128_t; +#define PCG_128BIT_CONSTANT(high,low) \ +pcg128_t)high) << 64) + low) +#define PCG_HAS_128BIT_OPS 1 +#endif + +#if __GNUC_GNU_INLINE__ && !defined(__cplusplus) +#error Nonstandard GNU inlining semantics. Compile with -std=c99 or better. +/* We could instead use macros PCG_INLINE and PCG_EXTERN_INLINE + but better to just reject ancient C code. */ +#endif + +#if __cplusplus +extern "C" { +#endif + +/* + * Rotate helper functions. + */ + +inline uint8_t pcg_rotr_8(uint8_t value, unsigned int rot) +{ +/* Unfortunately, clang is kinda pathetic when it comes to properly + * recognizing idiomatic rotate code, so for clang we actually provide + * assembler directives (enabled with PCG_USE_INLINE_ASM). Boo, hiss. + */ +#if PCG_USE_INLINE_ASM && __clang__ && (__x86_64__ || __i386__) +asm ("rorb %%cl, %0" : "=r" (value) : "0" (value), "c" (rot)); +return value; +#else +return (value >> rot) | (value << ((- rot) & 7)); +#endif +} + +inline uint16_t pcg_rotr_16(uint16_t value, unsigned int rot) +{ +#if PCG_USE_INLINE_ASM && __clang__ && (__x86_64__ || __i386__) +asm ("rorw %%cl, %0" : "=r" (value) : "0" (value), "c" (rot)); +return value; +#else +return (value >> rot) | (value << ((- rot) & 15)); +#endif +} + +inline uint32_t pcg_rotr_32(uint32_t value, unsigned int rot) +{ +#if PCG_USE_INLINE_ASM && __clang__ && (__x86_64__ || __i386__) +asm ("rorl %%cl, %0" : "=r" (value) : "0" (value), "c" (rot)); +return value; +#else +return (value >> rot) | (value << ((- rot) & 31)); +#endif +} + +inline uint64_t pcg_rotr_64(uint64_t value, unsigned int rot) +{ +#if 0 && PCG_USE_INLINE_ASM && __clang__ && __x86_64__ +/* For whatever reason, clang actually *does* generate rotq by + itself, so we don't need this code. */ +asm ("rorq %%cl, %0" : "=r" (value) : "0" (value), "c" (rot)); +return value; +#else +return (value >> rot) | (value << ((- rot) & 63)); +#endif +} + +#if PCG_HAS_128BIT_OPS +inline pcg128_t pcg_rotr_128(pcg128_t value, unsigned int rot) +{ +return (value >> rot) | (value << ((- rot) & 127)); +} +#endif + +/* + * Output functions. These are the core of the PCG generation scheme. + */ + +/* XSH RS */ + +inline uint8_t pcg_output_xsh_rs_16_8(uint16_t state) +{ +return (uint8_t)(((state >> 7u) ^ state) >> ((state >> 14u) + 3u)); +} + +inline uint16_t pcg_output_xsh_rs_32_16(uint32_t state) +{ +return (uint16_t)(((state >> 11u) ^ state) >> ((state >> 30u) + 11u)); +} + +inline uint32_t pcg_output_xsh_rs_64_32(uint64_t state) +{ + +return (uint32_t)(((state >> 22u) ^ state) >> ((state >> 61u) + 22u)); +} + +#if PCG_HAS_128BIT_OPS +inline uint64_t pcg_output_xsh_rs_128_64(pcg128_t state) +{ +return
Re: svn commit: r363482 - in head/sys: kern sys
Hi Konstantin, On Tue, Jul 28, 2020 at 11:42 AM Konstantin Belousov wrote: > > On Fri, Jul 24, 2020 at 05:34:05PM +, Conrad Meyer wrote: > > ... > > --- head/sys/kern/vfs_bio.c Fri Jul 24 17:32:10 2020(r363481) > > +++ head/sys/kern/vfs_bio.c Fri Jul 24 17:34:04 2020(r363482) > > @@ -3849,7 +3849,7 @@ getblkx(struct vnode *vp, daddr_t blkno, daddr_t dblkn > > ... > > + /* Attempt lockless lookup first. */ > > + bp = gbincore_unlocked(bo, blkno); > > + if (bp == NULL) > > + goto newbuf_unlocked; > > + > > + lockflags = LK_EXCLUSIVE | LK_SLEEPFAIL | > > + ((flags & GB_LOCK_NOWAIT) ? LK_NOWAIT : 0); > > + > > + error = BUF_TIMELOCK(bp, lockflags, NULL, "getblku", slpflag, > > + slptimeo); > I realized that this is not safe. There is an ordering between buffer > types that defines which order buffer locks should obey. For instance, > on UFS the critical order is inode buffer -> snaplk -> cg buffer, or > data block -> indirect data block. Since buffer identity can change under > us, we might end up waiting for a lock of type that is incompatible with > the currently owned lock. > > I think the easiest fix is to use LK_NOWAIT always, after all it is lockless > path. ERESTART/EINTR checks below than can be removed. Thanks, that makes sense to me. Please see https://reviews.freebsd.org/D25898 . (For the UFS scenario, I think this requires an on-disk sector changing identity from one kind to another? I believe lblknos are mostly statically typed in UFS, but it could happen with data blocks and indirect blocks? Of course, UFS is not the only filesystem.) Best regards, Conrad ___ 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: r363483 - head/sys/kern
Author: cem Date: Fri Jul 24 17:34:44 2020 New Revision: 363483 URL: https://svnweb.freebsd.org/changeset/base/363483 Log: Use gbincore_unlocked for unprotected incore() Reviewed by: markj Sponsored by: Isilon Differential Revision:https://reviews.freebsd.org/D25790 Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c == --- head/sys/kern/vfs_bio.c Fri Jul 24 17:34:04 2020(r363482) +++ head/sys/kern/vfs_bio.c Fri Jul 24 17:34:44 2020(r363483) @@ -3576,12 +3576,7 @@ flushbufqueues(struct vnode *lvp, struct bufdomain *bd struct buf * incore(struct bufobj *bo, daddr_t blkno) { - struct buf *bp; - - BO_RLOCK(bo); - bp = gbincore(bo, blkno); - BO_RUNLOCK(bo); - return (bp); + return (gbincore_unlocked(bo, blkno)); } /* ___ 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: r363482 - in head/sys: kern sys
Author: cem Date: Fri Jul 24 17:34:04 2020 New Revision: 363482 URL: https://svnweb.freebsd.org/changeset/base/363482 Log: Add unlocked/SMR fast path to getblk() Convert the bufobj tries to an SMR zone/PCTRIE and add a gbincore_unlocked() API wrapping this functionality. Use it for a fast path in getblkx(), falling back to locked lookup if we raced a thread changing the buf's identity. Reported by: Attilio Reviewed by: kib, markj Testing: pho (in progress) Sponsored by: Isilon Differential Revision:https://reviews.freebsd.org/D25782 Modified: head/sys/kern/vfs_bio.c head/sys/kern/vfs_subr.c head/sys/sys/buf.h Modified: head/sys/kern/vfs_bio.c == --- head/sys/kern/vfs_bio.c Fri Jul 24 17:32:10 2020(r363481) +++ head/sys/kern/vfs_bio.c Fri Jul 24 17:34:04 2020(r363482) @@ -3849,7 +3849,7 @@ getblkx(struct vnode *vp, daddr_t blkno, daddr_t dblkn struct buf *bp; struct bufobj *bo; daddr_t d_blkno; - int bsize, error, maxsize, vmio; + int bsize, error, maxsize, vmio, lockflags; off_t offset; CTR3(KTR_BUF, "getblk(%p, %ld, %d)", vp, (long)blkno, size); @@ -3864,11 +3864,33 @@ getblkx(struct vnode *vp, daddr_t blkno, daddr_t dblkn bo = >v_bufobj; d_blkno = dblkno; + + /* Attempt lockless lookup first. */ + bp = gbincore_unlocked(bo, blkno); + if (bp == NULL) + goto newbuf_unlocked; + + lockflags = LK_EXCLUSIVE | LK_SLEEPFAIL | + ((flags & GB_LOCK_NOWAIT) ? LK_NOWAIT : 0); + + error = BUF_TIMELOCK(bp, lockflags, NULL, "getblku", slpflag, + slptimeo); + if (error == EINTR || error == ERESTART) + return (error); + else if (error != 0) + goto loop; + + /* Verify buf identify has not changed since lookup. */ + if (bp->b_bufobj == bo && bp->b_lblkno == blkno) + goto foundbuf_fastpath; + + /* It changed, fallback to locked lookup. */ + BUF_UNLOCK_RAW(bp); + loop: BO_RLOCK(bo); bp = gbincore(bo, blkno); if (bp != NULL) { - int lockflags; /* * Buffer is in-core. If the buffer is not busy nor managed, * it must be on a queue. @@ -3890,8 +3912,10 @@ loop: /* We timed out or were interrupted. */ else if (error != 0) return (error); + +foundbuf_fastpath: /* If recursed, assume caller knows the rules. */ - else if (BUF_LOCKRECURSED(bp)) + if (BUF_LOCKRECURSED(bp)) goto end; /* @@ -3989,6 +4013,7 @@ loop: * buffer is also considered valid (not marked B_INVAL). */ BO_RUNLOCK(bo); +newbuf_unlocked: /* * If the user does not want us to create the buffer, bail out * here. Modified: head/sys/kern/vfs_subr.c == --- head/sys/kern/vfs_subr.cFri Jul 24 17:32:10 2020(r363481) +++ head/sys/kern/vfs_subr.cFri Jul 24 17:34:04 2020(r363482) @@ -234,6 +234,7 @@ static struct mtx __exclusive_cache_line vnode_list_mt struct nfs_public nfs_pub; static uma_zone_t buf_trie_zone; +static smr_t buf_trie_smr; /* Zone for allocation of new vnodes - used exclusively by getnewvnode() */ static uma_zone_t vnode_zone; @@ -491,17 +492,16 @@ static int vnsz2log; static void * buf_trie_alloc(struct pctrie *ptree) { - - return uma_zalloc(buf_trie_zone, M_NOWAIT); + return (uma_zalloc_smr(buf_trie_zone, M_NOWAIT)); } static void buf_trie_free(struct pctrie *ptree, void *node) { - - uma_zfree(buf_trie_zone, node); + uma_zfree_smr(buf_trie_zone, node); } -PCTRIE_DEFINE(BUF, buf, b_lblkno, buf_trie_alloc, buf_trie_free); +PCTRIE_DEFINE_SMR(BUF, buf, b_lblkno, buf_trie_alloc, buf_trie_free, +buf_trie_smr); /* * Initialize the vnode management data structures. @@ -675,7 +675,8 @@ vntblinit(void *dummy __unused) */ buf_trie_zone = uma_zcreate("BUF TRIE", pctrie_node_size(), NULL, NULL, pctrie_zone_init, NULL, UMA_ALIGN_PTR, - UMA_ZONE_NOFREE); + UMA_ZONE_NOFREE | UMA_ZONE_SMR); + buf_trie_smr = uma_zone_get_smr(buf_trie_zone); uma_prealloc(buf_trie_zone, nbuf); vnodes_created = counter_u64_alloc(M_WAITOK); @@ -2330,7 +2331,25 @@ gbincore(struct bufobj *bo, daddr_t lblkno) bp = BUF_PCTRIE_LOOKUP(>bo_clean.bv_root, lblkno); if (bp != NULL) return (bp); - return BUF_PCTRIE_LOOKUP(>bo_dirty.bv_root, lblkno); + return (BUF_PCTRIE_LOOKUP(>bo_dirty.bv_root, lblkno)); +} + +/* + * Look up a buf using the buffer tries,
svn commit: r363481 - in head/sys: kern sys
Author: cem Date: Fri Jul 24 17:32:10 2020 New Revision: 363481 URL: https://svnweb.freebsd.org/changeset/base/363481 Log: Use SMR to provide safe unlocked lookup for pctries from SMR zones Adapt r358130, for the almost identical vm_radix, to the pctrie subsystem. Like that change, the tree is kept correct for readers with store barriers and careful ordering. Existing locks serialize writers. Add a PCTRIE_DEFINE_SMR() wrapper that takes an additional smr_t parameter and instantiates a FOO_PCTRIE_LOOKUP_UNLOCKED() function, in addition to the usual definitions created by PCTRIE_DEFINE(). Interface consumers will be introduced in later commits. As future work, it might be nice to add vm_radix algorithms missing from generic pctrie to the pctrie interface, and then adapt vm_radix to use pctrie. Reported by: Attilio Reviewed by: markj Sponsored by: Isilon Differential Revision:https://reviews.freebsd.org/D25781 Modified: head/sys/kern/subr_pctrie.c head/sys/sys/pctrie.h Modified: head/sys/kern/subr_pctrie.c == --- head/sys/kern/subr_pctrie.c Fri Jul 24 17:28:24 2020(r363480) +++ head/sys/kern/subr_pctrie.c Fri Jul 24 17:32:10 2020(r363481) @@ -55,6 +55,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include /* smr.h depends on struct thread. */ +#include +#include #ifdef DDB #include @@ -72,18 +75,27 @@ __FBSDID("$FreeBSD$"); #definePCTRIE_UNITLEVEL(lev) \ ((uint64_t)1 << ((lev) * PCTRIE_WIDTH)) +struct pctrie_node; +typedef SMR_POINTER(struct pctrie_node *) smr_pctnode_t; + struct pctrie_node { - uint64_t pn_owner; /* Owner of record. */ - uint16_t pn_count; /* Valid children. */ - uint16_t pn_clev; /* Current level. */ - void*pn_child[PCTRIE_COUNT];/* Child nodes. */ + uint64_tpn_owner; /* Owner of record. */ + uint16_tpn_count; /* Valid children. */ + uint8_t pn_clev;/* Current level. */ + int8_t pn_last;/* Zero last ptr. */ + smr_pctnode_t pn_child[PCTRIE_COUNT]; /* Child nodes. */ }; +enum pctrie_access { PCTRIE_SMR, PCTRIE_LOCKED, PCTRIE_UNSERIALIZED }; + +static __inline void pctrie_node_store(smr_pctnode_t *p, void *val, +enum pctrie_access access); + /* * Allocate a node. Pre-allocation should ensure that the request * will always be satisfied. */ -static __inline struct pctrie_node * +static struct pctrie_node * pctrie_node_get(struct pctrie *ptree, pctrie_alloc_t allocfn, uint64_t owner, uint16_t count, uint16_t clevel) { @@ -92,10 +104,20 @@ pctrie_node_get(struct pctrie *ptree, pctrie_alloc_t a node = allocfn(ptree); if (node == NULL) return (NULL); + + /* +* We want to clear the last child pointer after the final section +* has exited so lookup can not return false negatives. It is done +* here because it will be cache-cold in the dtor callback. +*/ + if (node->pn_last != 0) { + pctrie_node_store(>pn_child[node->pn_last - 1], NULL, + PCTRIE_UNSERIALIZED); + node->pn_last = 0; + } node->pn_owner = owner; node->pn_count = count; node->pn_clev = clevel; - return (node); } @@ -104,7 +126,7 @@ pctrie_node_get(struct pctrie *ptree, pctrie_alloc_t a */ static __inline void pctrie_node_put(struct pctrie *ptree, struct pctrie_node *node, -pctrie_free_t freefn) +pctrie_free_t freefn, int8_t last) { #ifdef INVARIANTS int slot; @@ -112,10 +134,14 @@ pctrie_node_put(struct pctrie *ptree, struct pctrie_no KASSERT(node->pn_count == 0, ("pctrie_node_put: node %p has %d children", node, node->pn_count)); - for (slot = 0; slot < PCTRIE_COUNT; slot++) - KASSERT(node->pn_child[slot] == NULL, - ("pctrie_node_put: node %p has a child", node)); + for (slot = 0; slot < PCTRIE_COUNT; slot++) { + if (slot == last) + continue; + KASSERT(smr_unserialized_load(>pn_child[slot], true) == + NULL, ("pctrie_node_put: node %p has a child", node)); + } #endif + node->pn_last = last + 1; freefn(ptree, node); } @@ -144,23 +170,58 @@ pctrie_trimkey(uint64_t index, uint16_t level) } /* - * Get the root node for a tree. + * Fetch a node pointer from a slot. */ static __inline struct pctrie_node * -pctrie_getroot(struct pctrie *ptree) +pctrie_node_load(smr_pctnode_t *p, smr_t smr, enum pctrie_access access) { + switch
svn commit: r363266 - in head/sys: amd64/amd64 i386/i386 mips/mips powerpc/aim powerpc/booke
Author: cem Date: Thu Jul 16 23:29:26 2020 New Revision: 363266 URL: https://svnweb.freebsd.org/changeset/base/363266 Log: Revert r240317 to prevent leaking pmap entries Subsequent to r240317, kmem_free() was replaced with kva_free() (r254025). kva_free() releases the KVA allocation for the mapped region, but no longer clears the pmap (pagetable) entries. An affected pmap_unmapdev operation would leave the still-pmap'd VA space free for allocation by other KVA consumers. However, this bug easily avoided notice for ~7 years because most devices (1) never call pmap_unmapdev and (2) on amd64, mostly fit within the DMAP and do not need KVA allocations. Other affected arch are less popular: i386, MIPS, and PowerPC. Arm64, arm32, and riscv are not affected. Reported by: Don Morris Submitted by: Don Morris (amd64 part) Reviewed by: kib, markj, Don (!amd64 parts) MFC after:I don't intend to, but you might want to Sponsored by: Dell Isilon Differential Revision:https://reviews.freebsd.org/D25689 Modified: head/sys/amd64/amd64/pmap.c head/sys/i386/i386/pmap.c head/sys/mips/mips/pmap.c head/sys/powerpc/aim/mmu_oea.c head/sys/powerpc/aim/mmu_oea64.c head/sys/powerpc/aim/mmu_radix.c head/sys/powerpc/booke/pmap.c Modified: head/sys/amd64/amd64/pmap.c == --- head/sys/amd64/amd64/pmap.c Thu Jul 16 23:05:18 2020(r363265) +++ head/sys/amd64/amd64/pmap.c Thu Jul 16 23:29:26 2020(r363266) @@ -8279,8 +8279,10 @@ pmap_unmapdev(vm_offset_t va, vm_size_t size) return; } } - if (pmap_initialized) + if (pmap_initialized) { + pmap_qremove(va, atop(size)); kva_free(va, size); + } } /* Modified: head/sys/i386/i386/pmap.c == --- head/sys/i386/i386/pmap.c Thu Jul 16 23:05:18 2020(r363265) +++ head/sys/i386/i386/pmap.c Thu Jul 16 23:29:26 2020(r363266) @@ -5538,8 +5538,10 @@ __CONCAT(PMTYPE, unmapdev)(vm_offset_t va, vm_size_t s return; } } - if (pmap_initialized) + if (pmap_initialized) { + pmap_qremove(va, atop(size)); kva_free(va, size); + } } /* Modified: head/sys/mips/mips/pmap.c == --- head/sys/mips/mips/pmap.c Thu Jul 16 23:05:18 2020(r363265) +++ head/sys/mips/mips/pmap.c Thu Jul 16 23:29:26 2020(r363266) @@ -3264,6 +3264,7 @@ pmap_unmapdev(vm_offset_t va, vm_size_t size) base = trunc_page(va); offset = va & PAGE_MASK; size = roundup(size + offset, PAGE_SIZE); + pmap_qremove(base, atop(size)); kva_free(base, size); #endif } Modified: head/sys/powerpc/aim/mmu_oea.c == --- head/sys/powerpc/aim/mmu_oea.c Thu Jul 16 23:05:18 2020 (r363265) +++ head/sys/powerpc/aim/mmu_oea.c Thu Jul 16 23:29:26 2020 (r363266) @@ -2673,6 +2673,7 @@ moea_unmapdev(vm_offset_t va, vm_size_t size) base = trunc_page(va); offset = va & PAGE_MASK; size = roundup(offset + size, PAGE_SIZE); + moea_qremove(base, atop(size)); kva_free(base, size); } } Modified: head/sys/powerpc/aim/mmu_oea64.c == --- head/sys/powerpc/aim/mmu_oea64.cThu Jul 16 23:05:18 2020 (r363265) +++ head/sys/powerpc/aim/mmu_oea64.cThu Jul 16 23:29:26 2020 (r363266) @@ -2869,6 +2869,7 @@ moea64_unmapdev(vm_offset_t va, vm_size_t size) offset = va & PAGE_MASK; size = roundup2(offset + size, PAGE_SIZE); + moea64_qremove(base, atop(size)); kva_free(base, size); } Modified: head/sys/powerpc/aim/mmu_radix.c == --- head/sys/powerpc/aim/mmu_radix.cThu Jul 16 23:05:18 2020 (r363265) +++ head/sys/powerpc/aim/mmu_radix.cThu Jul 16 23:29:26 2020 (r363266) @@ -5846,8 +5846,10 @@ mmu_radix_unmapdev(vm_offset_t va, vm_size_t size) size = round_page(offset + size); va = trunc_page(va); - if (pmap_initialized) + if (pmap_initialized) { + mmu_radix_qremove(va, atop(size)); kva_free(va, size); + } } static __inline void Modified: head/sys/powerpc/booke/pmap.c == --- head/sys/powerpc/booke/pmap.c Thu Jul 16 23:05:18 2020 (r363265) +++ head/sys/powerpc/booke/pmap.c Thu Jul 16 23:29:26 2020 (r363266) @@ -2322,6 +2322,7 @@
Re: svn commit: r363125 - head/sys/compat/linux
Hi Alexander, On Sun, Jul 12, 2020 at 2:51 AM Alexander Leidinger wrote: > > Author: netchild > Date: Sun Jul 12 09:51:09 2020 > New Revision: 363125 > URL: https://svnweb.freebsd.org/changeset/base/363125 > > Log: > Implement CLOCK_MONOTONIC_RAW (linux >= 2.6.28). > > It is documented as a raw hardware-based clock not subject to NTP or > incremental adjustments. With this "not as precise as CLOCK_MONOTONIC" > description in mind, map it to our CLOCK_MONOTNIC_FAST (the same > mapping as for the linux CLOCK_MONOTONIC_COARSE). Can you point at the documentation suggesting CLOCK_MONOTONIC_RAW is any less precise than CLOCK_MONOTONIC? I'm looking at the Linux manual page and it does not seem to contain any language to that effect. > This is needed for the webcomponent of steam (chromium) and some > other steam component or game. > > The linux-steam-utils port contains a LD_PRELOAD based fix for this. > There this is mapped to CLOCK_MONOTONIC. > As an untrained ear/eye (= the majority of people) is normaly not > noticing a difference of jitter in the 10-20 ms range, specially > if you don't pay attention like for example in a browser session > while watching a video stream, the mapping to CLOCK_MONOTONIC_FAST > seems more appropriate than to CLOCK_MONOTONIC. I don't know how these programs use the clock, but 10-20 ms of jitter in the UI is noticeable to even casual users. (In FreeBSD these functions are purportedly accurate to 1 timer tick, which is 1ms on HZ=1000 (amd64) — much better than 10-20ms.) However, I'm concerned this is still insufficient precision compared with the documented behavior of the Linux functions. I think regular CLOCK_MONOTONIC is the closest thing we've got to Linux's CLOCK_MONOTONIC_RAW. The Linux analog of _FAST is _COARSE. Best, Conrad ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r362936 - head/sbin/newfs_msdos
Hi Xin Li, Maybe we can use C11 static_assert instead of the CTASSERT array mechanism? Best, Conrad On Sat, Jul 4, 2020 at 11:37 Xin LI wrote: > Author: delphij > Date: Sat Jul 4 18:37:04 2020 > New Revision: 362936 > URL: https://svnweb.freebsd.org/changeset/base/362936 > > Log: > Gather writes to larger chunks (MAXPHYS) instead of issuing them in > sectors. > > On my SanDisk Cruzer Blade 16GB USB stick this made formatting much > faster: > > x before > + after > > +--+ > |+ >| > |+ > x | > |+ > x x| > |A > MA|| > > +--+ > N Min MaxMedian Avg > Stddev > x 3 15.89 16.3816 16.09 > 0.2570992 > + 3 0.32 0.37 0.350.3467 > 0.025166115 > Difference at 95.0% confidence > -15.7433 +/- 0.414029 > -97.8455% +/- 0.25668% > (Student's t, pooled s = 0.182665) > > Reviewed by: emaste > MFC after:2 weeks > Differential Revision:https://reviews.freebsd.org/D24508 > > Modified: > head/sbin/newfs_msdos/mkfs_msdos.c > > Modified: head/sbin/newfs_msdos/mkfs_msdos.c > > == > --- head/sbin/newfs_msdos/mkfs_msdos.c Sat Jul 4 18:01:29 2020 > (r362935) > +++ head/sbin/newfs_msdos/mkfs_msdos.c Sat Jul 4 18:37:04 2020 > (r362936) > @@ -64,6 +64,7 @@ static const char rcsid[] = > > #defineDOSMAGIC 0xaa55/* DOS magic number */ > #defineMINBPS512 /* minimum bytes per sector */ > +#defineMAXBPS4096 /* maximum bytes per sector */ > #defineMAXSPC128 /* maximum sectors per cluster */ > #defineMAXNFT16/* maximum number of FATs */ > #defineDEFBLK4096 /* default block size */ > @@ -77,6 +78,25 @@ static const char rcsid[] = > #defineMAXCLS16 0xfff4U /* maximum FAT16 clusters */ > #defineMAXCLS32 0xff4U/* maximum FAT32 clusters */ > > +#ifndefCTASSERT > +#defineCTASSERT(x) _CTASSERT(x, __LINE__) > +#define_CTASSERT(x, y) __CTASSERT(x, y) > +#define__CTASSERT(x, y)typedef char __assert_ ## y [(x) ? > 1 : -1] > +#endif > + > +/* > + * For better performance, we want to write larger chunks instead of > + * individual sectors (the size can only be 512, 1024, 2048 or 4096 > + * bytes). Assert that MAXPHYS can always hold an integer number of > + * sectors by asserting that both are power of two numbers and the > + * MAXPHYS is greater than MAXBPS. > + */ > +CTASSERT(powerof2(MAXPHYS)); > +CTASSERT(powerof2(MAXBPS)); > +CTASSERT(MAXPHYS > MAXBPS); > + > +const static ssize_t chunksize = MAXPHYS; > + > #definemincls(fat) ((fat) == 12 ? MINCLS12 : \ > (fat) == 16 ? MINCLS16 : \ > MINCLS32) > @@ -243,6 +263,7 @@ mkfs_msdos(const char *fname, const char *dtype, const > struct bsx *bsx; > struct de *de; > u_int8_t *img; > +u_int8_t *physbuf, *physbuf_end; > const char *bname; > ssize_t n; > time_t now; > @@ -252,7 +273,7 @@ mkfs_msdos(const char *fname, const char *dtype, const > int fd, fd1, rv; > struct msdos_options o = *op; > > -img = NULL; > +physbuf = NULL; > rv = -1; > fd = fd1 = -1; > > @@ -343,15 +364,13 @@ mkfs_msdos(const char *fname, const char *dtype, > const > bpb.bpbSecPerClust = 64;/* otherwise 32k */ > } > } > -if (!powerof2(bpb.bpbBytesPerSec)) { > - warnx("bytes/sector (%u) is not a power of 2", bpb.bpbBytesPerSec); > +if (bpb.bpbBytesPerSec < MINBPS || > +bpb.bpbBytesPerSec > MAXBPS || > + !powerof2(bpb.bpbBytesPerSec)) { > + warnx("Invalid bytes/sector (%u): must be 512, 1024, 2048 or 4096", > + bpb.bpbBytesPerSec); > goto done; > } > -if (bpb.bpbBytesPerSec < MINBPS) { > - warnx("bytes/sector (%u) is too small; minimum is %u", > -bpb.bpbBytesPerSec, MINBPS); > - goto done; > -} > > if (o.volume_label && !oklabel(o.volume_label)) { > warnx("%s: bad volume label", o.volume_label); > @@ -621,11 +640,14 @@ mkfs_msdos(const char *fname, const char *dtype, > const > tm = localtime(); > } > > - > - if (!(img = malloc(bpb.bpbBytesPerSec))) { > + physbuf = malloc(chunksize); > + if (physbuf == NULL) { > warn(NULL); > goto done; > } > + physbuf_end = physbuf + chunksize; > + img = physbuf; > + > dir = bpb.bpbResSectors + (bpb.bpbFATsecs ? bpb.bpbFATsecs : >bpb.bpbBigFATsecs) * bpb.bpbFATs; >
svn commit: r362913 - in head/sys: amd64/amd64 amd64/include crypto/aesni crypto/blake2
Author: cem Date: Fri Jul 3 14:54:46 2020 New Revision: 362913 URL: https://svnweb.freebsd.org/changeset/base/362913 Log: Add domain policy allocation for amd64 fpu_kern_ctx Like other types of allocation, fpu_kern_ctx are frequently allocated per-cpu. Provide the API and sketch some example consumers. fpu_kern_alloc_ctx_domain() preferentially allocates memory from the provided domain, and falls back to other domains if that one is empty (DOMAINSET_PREF(domain) policy). Maybe it makes more sense to just shove one of these in the DPCPU area sooner or later -- left for future work. Reviewed by: markj Differential Revision:https://reviews.freebsd.org/D22053 Modified: head/sys/amd64/amd64/fpu.c head/sys/amd64/include/fpu.h head/sys/crypto/aesni/aesni.c head/sys/crypto/blake2/blake2_cryptodev.c Modified: head/sys/amd64/amd64/fpu.c == --- head/sys/amd64/amd64/fpu.c Fri Jul 3 11:46:42 2020(r362912) +++ head/sys/amd64/amd64/fpu.c Fri Jul 3 14:54:46 2020(r362913) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1030,17 +1031,31 @@ struct fpu_kern_ctx { char hwstate1[]; }; +static inline size_t __pure2 +fpu_kern_alloc_sz(u_int max_est) +{ + return (sizeof(struct fpu_kern_ctx) + XSAVE_AREA_ALIGN + max_est); +} + +static inline int __pure2 +fpu_kern_malloc_flags(u_int fpflags) +{ + return (((fpflags & FPU_KERN_NOWAIT) ? M_NOWAIT : M_WAITOK) | M_ZERO); +} + struct fpu_kern_ctx * -fpu_kern_alloc_ctx(u_int flags) +fpu_kern_alloc_ctx_domain(int domain, u_int flags) { - struct fpu_kern_ctx *res; - size_t sz; + return (malloc_domainset(fpu_kern_alloc_sz(cpu_max_ext_state_size), + M_FPUKERN_CTX, DOMAINSET_PREF(domain), + fpu_kern_malloc_flags(flags))); +} - sz = sizeof(struct fpu_kern_ctx) + XSAVE_AREA_ALIGN + - cpu_max_ext_state_size; - res = malloc(sz, M_FPUKERN_CTX, ((flags & FPU_KERN_NOWAIT) ? - M_NOWAIT : M_WAITOK) | M_ZERO); - return (res); +struct fpu_kern_ctx * +fpu_kern_alloc_ctx(u_int flags) +{ + return (malloc(fpu_kern_alloc_sz(cpu_max_ext_state_size), + M_FPUKERN_CTX, fpu_kern_malloc_flags(flags))); } void Modified: head/sys/amd64/include/fpu.h == --- head/sys/amd64/include/fpu.hFri Jul 3 11:46:42 2020 (r362912) +++ head/sys/amd64/include/fpu.hFri Jul 3 14:54:46 2020 (r362913) @@ -71,6 +71,7 @@ int fputrap_sse(void); intfputrap_x87(void); void fpuuserinited(struct thread *td); struct fpu_kern_ctx *fpu_kern_alloc_ctx(u_int flags); +struct fpu_kern_ctx *fpu_kern_alloc_ctx_domain(int domain, u_int flags); void fpu_kern_free_ctx(struct fpu_kern_ctx *ctx); void fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, u_int flags); Modified: head/sys/crypto/aesni/aesni.c == --- head/sys/crypto/aesni/aesni.c Fri Jul 3 11:46:42 2020 (r362912) +++ head/sys/crypto/aesni/aesni.c Fri Jul 3 14:54:46 2020 (r362913) @@ -180,7 +180,12 @@ aesni_attach(device_t dev) M_WAITOK|M_ZERO); CPU_FOREACH(i) { - ctx_fpu[i] = fpu_kern_alloc_ctx(0); +#ifdef __amd64__ + ctx_fpu[i] = fpu_kern_alloc_ctx_domain( + pcpu_find(i)->pc_domain, FPU_KERN_NORMAL); +#else + ctx_fpu[i] = fpu_kern_alloc_ctx(FPU_KERN_NORMAL); +#endif mtx_init(_mtx[i], "anifpumtx", NULL, MTX_DEF|MTX_NEW); } Modified: head/sys/crypto/blake2/blake2_cryptodev.c == --- head/sys/crypto/blake2/blake2_cryptodev.c Fri Jul 3 11:46:42 2020 (r362912) +++ head/sys/crypto/blake2/blake2_cryptodev.c Fri Jul 3 14:54:46 2020 (r362913) @@ -142,7 +142,12 @@ blake2_attach(device_t dev) M_WAITOK | M_ZERO); CPU_FOREACH(i) { - ctx_fpu[i] = fpu_kern_alloc_ctx(0); +#ifdef __amd64__ + ctx_fpu[i] = fpu_kern_alloc_ctx_domain( + pcpu_find(i)->pc_domain, FPU_KERN_NORMAL); +#else + ctx_fpu[i] = fpu_kern_alloc_ctx(FPU_KERN_NORMAL); +#endif mtx_init(_mtx[i], "bl2fpumtx", NULL, MTX_DEF | MTX_NEW); } ___ 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: r362823 - in head/sys: amd64/conf conf geom/part i386/conf
Author: cem Date: Wed Jul 1 02:16:36 2020 New Revision: 362823 URL: https://svnweb.freebsd.org/changeset/base/362823 Log: geom(4): Kill GEOM_PART_EBR_COMPAT option Take advantage of Warner's nice new real GEOM aliasing system and use it for aliased partition names that actually work. Our canonical EBR partition name is the weird, not-default-on-x86-prior-to- this-revision "da1p4+1234." However, if compatibility mode (tunable kern.geom.part.ebr.compat_aliases) is enabled (1, default), we continue to provide the alias names like "da1p5" in addition to the weird canonical names. Naming partition providers was just one aspect of the COMPAT knob; in addition it limited mutability, in part because it did not preserve existing EBR header content aside from that of LBA 0. This change saves the EBR header for LBA 0, as well as for every EBR partition encountered. That way, when we write out the EBR partition table on modification, we can restore any bootloader or other metadata in both LBA0 (the first data-containing EBR may start after 0) as well as every logical EBR we read from the disk, and only update the geometry metadata and linked list pointers that describe the actual partitioning. (This change does not add support for the 'bootcode' verb to EBR.) PR: 232463 Reported by: Manish Jain Discussed with: ae (no objection) Relnotes: maybe Differential Revision:https://reviews.freebsd.org/D24939 Modified: head/sys/amd64/conf/DEFAULTS head/sys/conf/NOTES head/sys/conf/options head/sys/geom/part/g_part_ebr.c head/sys/i386/conf/DEFAULTS Modified: head/sys/amd64/conf/DEFAULTS == --- head/sys/amd64/conf/DEFAULTSWed Jul 1 02:13:16 2020 (r362822) +++ head/sys/amd64/conf/DEFAULTSWed Jul 1 02:16:36 2020 (r362823) @@ -18,7 +18,6 @@ deviceuart_ns8250 # Default partitioning schemes optionsGEOM_PART_BSD optionsGEOM_PART_EBR -optionsGEOM_PART_EBR_COMPAT optionsGEOM_PART_MBR optionsGEOM_PART_GPT Modified: head/sys/conf/NOTES == --- head/sys/conf/NOTES Wed Jul 1 02:13:16 2020(r362822) +++ head/sys/conf/NOTES Wed Jul 1 02:16:36 2020(r362823) @@ -171,7 +171,6 @@ options GEOM_PART_APM # Apple partitioning optionsGEOM_PART_BSD # BSD disklabel optionsGEOM_PART_BSD64 # BSD disklabel64 optionsGEOM_PART_EBR # Extended Boot Records -optionsGEOM_PART_EBR_COMPAT# Backward compatible partition names optionsGEOM_PART_GPT # GPT partitioning optionsGEOM_PART_LDM # Logical Disk Manager optionsGEOM_PART_MBR # MBR partitioning Modified: head/sys/conf/options == --- head/sys/conf/options Wed Jul 1 02:13:16 2020(r362822) +++ head/sys/conf/options Wed Jul 1 02:16:36 2020(r362823) @@ -125,7 +125,6 @@ GEOM_PART_APM opt_geom.h GEOM_PART_BSD opt_geom.h GEOM_PART_BSD64opt_geom.h GEOM_PART_EBR opt_geom.h -GEOM_PART_EBR_COMPAT opt_geom.h GEOM_PART_GPT opt_geom.h GEOM_PART_LDM opt_geom.h GEOM_PART_MBR opt_geom.h Modified: head/sys/geom/part/g_part_ebr.c == --- head/sys/geom/part/g_part_ebr.c Wed Jul 1 02:13:16 2020 (r362822) +++ head/sys/geom/part/g_part_ebr.c Wed Jul 1 02:16:36 2020 (r362823) @@ -52,40 +52,48 @@ __FBSDID("$FreeBSD$"); FEATURE(geom_part_ebr, "GEOM partitioning class for extended boot records support"); -#if defined(GEOM_PART_EBR_COMPAT) FEATURE(geom_part_ebr_compat, "GEOM EBR partitioning class: backward-compatible partition names"); -#endif +SYSCTL_DECL(_kern_geom_part); +static SYSCTL_NODE(_kern_geom_part, OID_AUTO, ebr, CTLFLAG_RW | CTLFLAG_MPSAFE, +0, "GEOM_PART_EBR Extended Boot Record"); + +static bool compat_aliases = true; +SYSCTL_BOOL(_kern_geom_part_ebr, OID_AUTO, compat_aliases, +CTLFLAG_RDTUN, _aliases, 0, +"Set non-zero to enable EBR compatibility alias names (e.g., ada0p5)"); + +#defineEBRNAMFMT "+%08u" #defineEBRSIZE 512 struct g_part_ebr_table { struct g_part_table base; -#ifndef GEOM_PART_EBR_COMPAT - u_char ebr[EBRSIZE]; -#endif + u_char lba0_ebr[EBRSIZE]; }; struct g_part_ebr_entry { struct g_part_entry base; struct dos_partitionent; + u_char ebr[EBRSIZE]; + u_int ebr_compat_idx; }; static int g_part_ebr_add(struct g_part_table *, struct g_part_entry *, struct g_part_parms *); +static void
svn commit: r362818 - in head/secure/lib: libcrypto libssl
Author: cem Date: Wed Jul 1 00:59:28 2020 New Revision: 362818 URL: https://svnweb.freebsd.org/changeset/base/362818 Log: Replace OPENSSL_NO_SSL3_METHODs with dummies SSLv3 has been deprecated since 2015 (and broken since 2014: "POODLE"); it should not have shipped in FreeBSD 11 (2016) or 12 (2018). No one should use it, and if they must, they can use some implementation outside of base. There are three symbols removed with OPENSSL_NO_SSL3_METHOD: SSLv3_client_method SSLv3_method SSLv3_server_method These symbols exist to request an explicit SSLv3 connection to a server. There is no good reason for an application to link or invoke these symbols instead of TLS_method(), et al (née SSLv23_method, et al). Applications that do so have broken cryptography. Define these symbols for some pedantic definition of ABI stability, but remove the functionality again (r361392) after r362620. Reviewed by: gordon, jhb (earlier-but-equivalent version both) Discussed with: bjk, kib Differential Revision:https://reviews.freebsd.org/D25493 Added: head/secure/lib/libssl/dummy_abi.c (contents, props changed) Modified: head/secure/lib/libcrypto/opensslconf.h.in head/secure/lib/libssl/Makefile Modified: head/secure/lib/libcrypto/opensslconf.h.in == --- head/secure/lib/libcrypto/opensslconf.h.in Wed Jul 1 00:33:16 2020 (r362817) +++ head/secure/lib/libcrypto/opensslconf.h.in Wed Jul 1 00:59:28 2020 (r362818) @@ -79,6 +79,9 @@ extern "C" { #ifndef OPENSSL_NO_SSL3 # define OPENSSL_NO_SSL3 #endif +#ifndef OPENSSL_NO_SSL3_METHOD +# define OPENSSL_NO_SSL3_METHOD +#endif #ifndef OPENSSL_NO_UBSAN # define OPENSSL_NO_UBSAN #endif Modified: head/secure/lib/libssl/Makefile == --- head/secure/lib/libssl/Makefile Wed Jul 1 00:33:16 2020 (r362817) +++ head/secure/lib/libssl/Makefile Wed Jul 1 00:59:28 2020 (r362818) @@ -22,6 +22,8 @@ SRCS+=ssl3_record.c ssl3_record_tls13.c SRCS+= extensions.c extensions_clnt.c extensions_cust.c extensions_srvr.c SRCS+= statem.c statem_clnt.c statem_dtls.c statem_lib.c statem_srvr.c +SRCS+= dummy_abi.c + LIBADD=crypto CFLAGS+= -I${LCRYPTO_SRC}/ssl Added: head/secure/lib/libssl/dummy_abi.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/secure/lib/libssl/dummy_abi.c Wed Jul 1 00:59:28 2020 (r362818) @@ -0,0 +1,46 @@ +/* This file is in the public domain. */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include + +static inline void +__SSLv3_dummy_method_impl(void) +{ + static const char warning[] = "SSLv3 use is deprecated.\n"; + static bool once = false; + + if (once) + return; + + once = true; + write(STDERR_FILENO, warning, sizeof(warning) - 1); +} + +const SSL_METHOD * +__SSLv3_method_fbsd12(void) +{ + __SSLv3_dummy_method_impl(); + return (NULL); +} +__sym_compat(SSLv3_method, __SSLv3_method_fbsd12, OPENSSL_1_1_0); + +const SSL_METHOD * +__SSLv3_client_method_fbsd12(void) +{ + __SSLv3_dummy_method_impl(); + return (NULL); +} +__sym_compat(SSLv3_client_method, __SSLv3_client_method_fbsd12, OPENSSL_1_1_0); + +const SSL_METHOD * +__SSLv3_server_method_fbsd12(void) +{ + __SSLv3_dummy_method_impl(); + return (NULL); +} +__sym_compat(SSLv3_server_method, __SSLv3_server_method_fbsd12, OPENSSL_1_1_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: r362784 - head/sys/vm
Author: cem Date: Mon Jun 29 16:54:00 2020 New Revision: 362784 URL: https://svnweb.freebsd.org/changeset/base/362784 Log: vm: Add missing WITNESS warnings for M_WAITOK allocation vm_map_clip_{end,start} and lookup_clip_start allocate memory M_WAITOK for !system_map vm_maps. Add WITNESS warning annotation for !system_map callers who may be holding non-sleepable locks. Reviewed by: markj Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D25283 Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c == --- head/sys/vm/vm_map.cMon Jun 29 15:15:14 2020(r362783) +++ head/sys/vm/vm_map.cMon Jun 29 16:54:00 2020(r362784) @@ -2379,6 +2379,11 @@ vm_map_clip_start(vm_map_t map, vm_map_entry_t entry, { vm_map_entry_t new_entry; + if (!map->system_map) + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, + "%s: map %p entry %p start 0x%jx", __func__, map, entry, + (uintmax_t)start); + if (start <= entry->start) return; @@ -2409,6 +2414,11 @@ vm_map_lookup_clip_start(vm_map_t map, vm_offset_t sta { vm_map_entry_t entry; + if (!map->system_map) + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, + "%s: map %p start 0x%jx prev %p", __func__, map, + (uintmax_t)start, prev_entry); + if (vm_map_lookup_entry(map, start, prev_entry)) { entry = *prev_entry; vm_map_clip_start(map, entry, start); @@ -2430,6 +2440,11 @@ vm_map_clip_end(vm_map_t map, vm_map_entry_t entry, vm { vm_map_entry_t new_entry; + if (!map->system_map) + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, + "%s: map %p entry %p end 0x%jx", __func__, map, entry, + (uintmax_t)end); + if (end >= entry->end) return; @@ -3725,6 +3740,7 @@ vm_map_delete(vm_map_t map, vm_offset_t start, vm_offs vm_map_entry_t entry, next_entry; VM_MAP_ASSERT_LOCKED(map); + if (start == end) return (KERN_SUCCESS); ___ 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: r362600 - in head: sys/amd64/include sys/amd64/vmm usr.sbin/bhyve
Author: cem Date: Thu Jun 25 00:18:42 2020 New Revision: 362600 URL: https://svnweb.freebsd.org/changeset/base/362600 Log: bhyve(8): For prototyping, reattempt decode in userspace If userspace has a newer bhyve than the kernel, it may be able to decode and emulate some instructions vmm.ko is unaware of. In this scenario, reset decoder state and try again. Reviewed by: grehan Differential Revision:https://reviews.freebsd.org/D24464 Modified: head/sys/amd64/include/vmm.h head/sys/amd64/include/vmm_instruction_emul.h head/sys/amd64/vmm/vmm_instruction_emul.c head/usr.sbin/bhyve/bhyverun.c Modified: head/sys/amd64/include/vmm.h == --- head/sys/amd64/include/vmm.hThu Jun 25 00:09:43 2020 (r362599) +++ head/sys/amd64/include/vmm.hThu Jun 25 00:18:42 2020 (r362600) @@ -546,6 +546,9 @@ _Static_assert(_Alignof(struct vie_op) == 2, "ABI"); struct vie { uint8_t inst[VIE_INST_SIZE];/* instruction bytes */ uint8_t num_valid; /* size of the instruction */ + +/* The following fields are all zeroed upon restart. */ +#definevie_startzero num_processed uint8_t num_processed; uint8_t addrsize:4, opsize:4; /* address and operand sizes */ Modified: head/sys/amd64/include/vmm_instruction_emul.h == --- head/sys/amd64/include/vmm_instruction_emul.h Thu Jun 25 00:09:43 2020(r362599) +++ head/sys/amd64/include/vmm_instruction_emul.h Thu Jun 25 00:18:42 2020(r362600) @@ -105,6 +105,7 @@ int vm_gla2gpa_nofault(struct vm *vm, int vcpuid, stru uint64_t gla, int prot, uint64_t *gpa, int *is_fault); #endif /* _KERNEL */ +void vie_restart(struct vie *vie); void vie_init(struct vie *vie, const char *inst_bytes, int inst_length); /* Modified: head/sys/amd64/vmm/vmm_instruction_emul.c == --- head/sys/amd64/vmm/vmm_instruction_emul.c Thu Jun 25 00:09:43 2020 (r362599) +++ head/sys/amd64/vmm/vmm_instruction_emul.c Thu Jun 25 00:18:42 2020 (r362600) @@ -53,7 +53,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include #defineKASSERT(exp,msg)assert((exp)) @@ -1990,22 +1992,36 @@ vie_calculate_gla(enum vm_cpu_mode cpu_mode, enum vm_r return (0); } +/* + * Prepare a partially decoded vie for a 2nd attempt. + */ void -vie_init(struct vie *vie, const char *inst_bytes, int inst_length) +vie_restart(struct vie *vie) { - KASSERT(inst_length >= 0 && inst_length <= VIE_INST_SIZE, - ("%s: invalid instruction length (%d)", __func__, inst_length)); + _Static_assert( + offsetof(struct vie, inst) < offsetof(struct vie, vie_startzero) && + offsetof(struct vie, num_valid) < offsetof(struct vie, vie_startzero), + "restart should not erase instruction length or contents"); - bzero(vie, sizeof(struct vie)); + memset((char *)vie + offsetof(struct vie, vie_startzero), 0, + sizeof(*vie) - offsetof(struct vie, vie_startzero)); vie->base_register = VM_REG_LAST; vie->index_register = VM_REG_LAST; vie->segment_register = VM_REG_LAST; +} - if (inst_length) { - bcopy(inst_bytes, vie->inst, inst_length); - vie->num_valid = inst_length; - } +void +vie_init(struct vie *vie, const char *inst_bytes, int inst_length) +{ + KASSERT(inst_length >= 0 && inst_length <= VIE_INST_SIZE, + ("%s: invalid instruction length (%d)", __func__, inst_length)); + + vie_restart(vie); + memset(vie->inst, 0, sizeof(vie->inst)); + if (inst_length != 0) + memcpy(vie->inst, inst_bytes, inst_length); + vie->num_valid = inst_length; } #ifdef _KERNEL Modified: head/usr.sbin/bhyve/bhyverun.c == --- head/usr.sbin/bhyve/bhyverun.c Thu Jun 25 00:09:43 2020 (r362599) +++ head/usr.sbin/bhyve/bhyverun.c Thu Jun 25 00:18:42 2020 (r362600) @@ -80,6 +80,7 @@ __FBSDID("$FreeBSD$"); #ifndef WITHOUT_CAPSICUM #include #endif +#include #include #include "bhyverun.h" @@ -746,12 +747,26 @@ vmexit_mtrap(struct vmctx *ctx, struct vm_exit *vmexit static int vmexit_inst_emul(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu) { - int err, i; + int err, i, cs_d; struct vie *vie; + enum vm_cpu_mode mode; stats.vmexit_inst_emul++; vie = >u.inst_emul.vie; + if (!vie->decoded) { + /* +* Attempt to decode in userspace as a fallback. This allows +* updating instruction decode in
svn commit: r362596 - head
Author: cem Date: Wed Jun 24 23:22:36 2020 New Revision: 362596 URL: https://svnweb.freebsd.org/changeset/base/362596 Log: Clang-format: Avoid hardcoded LLVM include-order style Reported by: emaste Modified: head/.clang-format Modified: head/.clang-format == --- head/.clang-format Wed Jun 24 22:42:46 2020(r362595) +++ head/.clang-format Wed Jun 24 23:22:36 2020(r362596) @@ -134,6 +134,12 @@ IncludeCategories: - Regex: '^\".*\.h\"' Priority: 10 SortPriority: 100 +# LLVM's header include ordering style is almost the exact opposite of ours. +# Unfortunately, they have hard-coded their preferences into clang-format. +# Clobbering this regular expression to avoid matching prevents non-system +# headers from being forcibly moved to the top of the include list. +# http://llvm.org/docs/CodingStandards.html#include-style +IncludeIsMainRegex: 'BLAH_DONT_MATCH_ANYTHING' SortIncludes: true KeepEmptyLinesAtTheStartOfBlocks: true TypenameMacros: ___ 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: r362595 - head
Author: cem Date: Wed Jun 24 22:42:46 2020 New Revision: 362595 URL: https://svnweb.freebsd.org/changeset/base/362595 Log: Update .clang-format type and foreach macros lists No functional change. Reviewed by: markj Differential Revision:https://reviews.freebsd.org/D25429 Modified: head/.clang-format Modified: head/.clang-format == --- head/.clang-format Wed Jun 24 20:23:37 2020(r362594) +++ head/.clang-format Wed Jun 24 22:42:46 2020(r362595) @@ -29,30 +29,53 @@ CompactNamespaces: true DerivePointerAlignment: false DisableFormat: false ForEachMacros: + - ARB_ARRFOREACH + - ARB_ARRFOREACH_REVWCOND + - ARB_ARRFOREACH_REVERSE + - ARB_FOREACH + - ARB_FOREACH_FROM + - ARB_FOREACH_SAFE + - ARB_FOREACH_REVERSE + - ARB_FOREACH_REVERSE_FROM + - ARB_FOREACH_REVERSE_SAFE + - CPU_FOREACH + - FOREACH_THREAD_IN_PROC + - FOREACH_PROC_IN_SYSTEM + - FOREACH_PRISON_CHILD + - FOREACH_PRISON_DESCENDANT + - FOREACH_PRISON_DESCENDANT_LOCKED + - FOREACH_PRISON_DESCENDANT_LOCKED_LEVEL + - MNT_VNODE_FOREACH_ALL + - MNT_VNODE_FOREACH_ACTIVE + - RB_FOREACH + - RB_FOREACH_FROM + - RB_FOREACH_SAFE + - RB_FOREACH_REVERSE + - RB_FOREACH_REVERSE_FROM + - RB_FOREACH_REVERSE_SAFE - SLIST_FOREACH + - SLIST_FOREACH_FROM + - SLIST_FOREACH_FROM_SAFE - SLIST_FOREACH_SAFE + - SLIST_FOREACH_PREVPTR + - SPLAY_FOREACH - LIST_FOREACH + - LIST_FOREACH_FROM + - LIST_FOREACH_FROM_SAFE - LIST_FOREACH_SAFE - STAILQ_FOREACH + - STAILQ_FOREACH_FROM + - STAILQ_FOREACH_FROM_SAFE - STAILQ_FOREACH_SAFE - TAILQ_FOREACH - - TAILQ_FOREACH_SAFE + - TAILQ_FOREACH_FROM + - TAILQ_FOREACH_FROM_SAFE - TAILQ_FOREACH_REVERSE + - TAILQ_FOREACH_REVERSE_FROM + - TAILQ_FOREACH_REVERSE_FROM_SAFE - TAILQ_FOREACH_REVERSE_SAFE - - RB_FOREACH - - RB_FOREACH_SAFE - - RB_FOREACH_FROM - - RB_FOREACH_REVERSE - - RB_FOREACH_REVERSE_FROM - - RB_FOREACH_REVERSE_SAFE - - FOREACH_THREAD_IN_PROC - - FOREACH_PROC_IN_SYSTEM - - FOREACH_PRISON_CHILD - - FOREACH_PRISON_DESCENDANT - - FOREACH_PRISON_DESCENDANT_LOCKED - - FOREACH_PRISON_DESCENDANT_LOCKED_LEVEL - - MNT_VNODE_FOREACH_ALL - - MNT_VNODE_FOREACH_ACTIVE + - TAILQ_FOREACH_SAFE + - VM_MAP_ENTRY_FOREACH IndentCaseLabels: false IndentPPDirectives: None Language: Cpp @@ -113,12 +136,35 @@ IncludeCategories: SortPriority: 100 SortIncludes: true KeepEmptyLinesAtTheStartOfBlocks: true -# The options below will only be supported starting with clang 9.0: -# TODO-CLANG-9: TypenameMacros: -# TODO-CLANG-9: - SLIST_HEAD -# TODO-CLANG-9: - SLIST_ENTRY -# TODO-CLANG-9: - TAILQ_ENTRY -# TODO-CLANG-9: - TAILQ_HEAD -# TODO-CLANG-9: - STAILQ_ENTRY -# TODO-CLANG-9: - STAILQ_HEAD -... +TypenameMacros: + - ARB_ELMTYPE + - ARB_HEAD + - ARB8_HEAD + - ARB16_HEAD + - ARB32_HEAD + - ARB_ENTRY + - ARB8_ENTRY + - ARB16_ENTRY + - ARB32_ENTRY + - LIST_CLASS_ENTRY + - LIST_CLASS_HEAD + - LIST_ENTRY + - LIST_HEAD + - QUEUE_TYPEOF + - RB_ENTRY + - RB_HEAD + - SLIST_CLASS_HEAD + - SLIST_CLASS_ENTRY + - SLIST_HEAD + - SLIST_ENTRY + - SMR_POINTER + - SPLAY_ENTRY + - SPLAY_HEAD + - STAILQ_CLASS_ENTRY + - STAILQ_CLASS_HEAD + - STAILQ_ENTRY + - STAILQ_HEAD + - TAILQ_CLASS_ENTRY + - TAILQ_CLASS_HEAD + - TAILQ_ENTRY + - TAILQ_HEAD ___ 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: r362590 - head
Author: cem Date: Wed Jun 24 18:40:43 2020 New Revision: 362590 URL: https://svnweb.freebsd.org/changeset/base/362590 Log: Update .clang-format with style(9) header-sorting Thanks to work done in the NetBSD clang-format project. No functional change. Reviewed by: markj Differential Revision:https://reviews.freebsd.org/D25428 Modified: head/.clang-format Modified: head/.clang-format == --- head/.clang-format Wed Jun 24 17:54:24 2020(r362589) +++ head/.clang-format Wed Jun 24 18:40:43 2020(r362590) @@ -64,7 +64,54 @@ TabWidth: 8 ColumnLimit: 80 UseTab: Always SpaceAfterCStyleCast: false -SortIncludes: false +IncludeBlocks: Regroup +IncludeCategories: + - Regex: '^\"opt_.*\.h\"' +Priority: 1 +SortPriority: 10 + - Regex: '^' +Priority: 2 +SortPriority: 20 + - Regex: '^' +Priority: 2 +SortPriority: 21 + - Regex: '^' +Priority: 2 +SortPriority: 22 + - Regex: '^' +Priority: 3 +SortPriority: 30 + - Regex: '^https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r362588 - head/share/man/man5
Author: cem Date: Wed Jun 24 17:31:21 2020 New Revision: 362588 URL: https://svnweb.freebsd.org/changeset/base/362588 Log: Regenerate src.conf.5 after r362587 Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 == --- head/share/man/man5/src.conf.5 Wed Jun 24 17:03:42 2020 (r362587) +++ head/share/man/man5/src.conf.5 Wed Jun 24 17:31:21 2020 (r362588) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd June 6, 2020 +.Dd June 24, 2020 .Dt SRC.CONF 5 .Os .Sh NAME @@ -321,6 +321,8 @@ When set, it enforces these options: .It .Va WITHOUT_CLANG_EXTRAS .It +.Va WITHOUT_CLANG_FORMAT +.It .Va WITHOUT_CLANG_FULL .It .Va WITHOUT_LLVM_COV @@ -333,6 +335,8 @@ enabled unless an alternate compiler is provided via X .It Va WITH_CLANG_EXTRAS Set to build additional clang and llvm tools, such as bugpoint and clang-format. +.It Va WITH_CLANG_FORMAT +Set to build clang-format. .It Va WITHOUT_CLANG_FULL Set to avoid building the ARCMigrate, Rewriter and StaticAnalyzer components of the Clang C/C++ compiler. @@ -441,6 +445,8 @@ When set, it enforces these options: .It .Va WITHOUT_CLANG_EXTRAS .It +.Va WITHOUT_CLANG_FORMAT +.It .Va WITHOUT_CLANG_FULL .It .Va WITHOUT_DTRACE_TESTS @@ -1623,6 +1629,8 @@ When set, it enforces these options: .Va WITHOUT_CLANG .It .Va WITHOUT_CLANG_EXTRAS +.It +.Va WITHOUT_CLANG_FORMAT .It .Va WITHOUT_CLANG_FULL .It ___ 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: r362587 - in head: . lib/clang/libclang share/mk targets/pseudo/bootstrap-tools targets/pseudo/clang tools/build/mk tools/build/options usr.bin/clang
Author: cem Date: Wed Jun 24 17:03:42 2020 New Revision: 362587 URL: https://svnweb.freebsd.org/changeset/base/362587 Log: Add WITH_CLANG_FORMAT option clang-format is enabled conditional on either WITH_CLANG_EXTRAS or WITH_CLANG_FORMAT. Some sources in libclang are build conditional on either rule, and obviously the clang-format binary itself depends on the rule. clang-format could still use a manual page. Reviewed by: emaste Differential Revision:https://reviews.freebsd.org/D25427 Added: head/tools/build/options/WITH_CLANG_FORMAT (contents, props changed) Modified: head/Makefile.inc1 head/lib/clang/libclang/Makefile head/share/mk/src.opts.mk head/targets/pseudo/bootstrap-tools/Makefile head/targets/pseudo/clang/Makefile.depend head/tools/build/mk/OptionalObsoleteFiles.inc head/usr.bin/clang/Makefile Modified: head/Makefile.inc1 == --- head/Makefile.inc1 Wed Jun 24 16:17:58 2020(r362586) +++ head/Makefile.inc1 Wed Jun 24 17:03:42 2020(r362587) @@ -676,7 +676,7 @@ BSARGS= DESTDIR= \ MK_HTML=no NO_LINT=yes MK_MAN=no \ -DNO_PIC MK_PROFILE=no -DNO_SHARED \ -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \ - MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \ + MK_CLANG_EXTRAS=no MK_CLANG_FORMAT=no MK_CLANG_FULL=no \ MK_LLDB=no MK_RETPOLINE=no MK_TESTS=no \ MK_INCLUDES=yes @@ -697,7 +697,7 @@ TMAKE= \ SSP_CFLAGS= \ -DNO_LINT \ -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \ - MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \ + MK_CLANG_EXTRAS=no MK_CLANG_FORMAT=no MK_CLANG_FULL=no \ MK_LLDB=no MK_RETPOLINE=no MK_TESTS=no # cross-tools stage @@ -2577,6 +2577,7 @@ NXBMAKEARGS+= \ SSP_CFLAGS= \ MK_CASPER=no \ MK_CLANG_EXTRAS=no \ + MK_CLANG_FORMAT=no \ MK_CLANG_FULL=no \ MK_CTF=no \ MK_DEBUG_FILES=no \ Modified: head/lib/clang/libclang/Makefile == --- head/lib/clang/libclang/MakefileWed Jun 24 16:17:58 2020 (r362586) +++ head/lib/clang/libclang/MakefileWed Jun 24 17:03:42 2020 (r362587) @@ -22,7 +22,7 @@ SRCDIR= clang/lib # Explanation of different SRCS variants below: # SRCS_MIN:always required, even for bootstrap -# SRCS_EXT:required for MK_CLANG_EXTRAS +# SRCS_EXT:required for MK_CLANG_EXTRAS || MK_CLANG_FORMAT # SRCS_FUL:required for MK_CLANG_FULL # SRCS_LDB:required for MK_LLDB @@ -686,7 +686,7 @@ SRCS_MIN+= Tooling/RefactoringCallbacks.cpp SRCS_MIN+= Tooling/Tooling.cpp SRCS_ALL+= ${SRCS_MIN} -.if ${MK_CLANG_EXTRAS} != "no" +.if ${MK_CLANG_EXTRAS} != "no" || ${MK_CLANG_FORMAT} != "no" SRCS_ALL+= ${SRCS_EXT} .endif .if ${MK_CLANG_FULL} != "no" Modified: head/share/mk/src.opts.mk == --- head/share/mk/src.opts.mk Wed Jun 24 16:17:58 2020(r362586) +++ head/share/mk/src.opts.mk Wed Jun 24 17:03:42 2020(r362587) @@ -202,6 +202,7 @@ __DEFAULT_NO_OPTIONS = \ BHYVE_SNAPSHOT \ BSD_GREP \ CLANG_EXTRAS \ +CLANG_FORMAT \ DTRACE_TESTS \ EXPERIMENTAL \ GNU_GREP_COMPAT \ @@ -482,6 +483,7 @@ MK_LLDB:= no .if ${MK_CLANG} == "no" MK_CLANG_EXTRAS:= no +MK_CLANG_FORMAT:= no MK_CLANG_FULL:= no MK_LLVM_COV:= no .endif Modified: head/targets/pseudo/bootstrap-tools/Makefile == --- head/targets/pseudo/bootstrap-tools/MakefileWed Jun 24 16:17:58 2020(r362586) +++ head/targets/pseudo/bootstrap-tools/MakefileWed Jun 24 17:03:42 2020(r362587) @@ -43,7 +43,7 @@ BSARGS= DESTDIR= \ MK_HTML=no NO_LINT=yes MK_MAN=no \ -DNO_PIC MK_PROFILE=no -DNO_SHARED \ -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \ - MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \ + MK_CLANG_EXTRAS=no MK_CLANG_FORMAT=no MK_CLANG_FULL=no \ MK_LLDB=no MK_TESTS=no \ MK_INCLUDES=yes Modified: head/targets/pseudo/clang/Makefile.depend == --- head/targets/pseudo/clang/Makefile.depend Wed Jun 24 16:17:58 2020 (r362586) +++ head/targets/pseudo/clang/Makefile.depend Wed Jun 24 17:03:42 2020 (r362587) @@ -42,7 +42,6 @@ DIRDEPS+= \ .if ${MK_CLANG_EXTRAS} == "yes" DIRDEPS+= \ usr.bin/clang/bugpoint \ - usr.bin/clang/clang-format \ usr.bin/clang/llc \ usr.bin/clang/lli \ usr.bin/clang/llvm-ar \ @@ -69,6 +68,10 @@ DIRDEPS+= \ usr.bin/clang/llvm-xray \
svn commit: r362549 - head/sys/conf
Author: cem Date: Tue Jun 23 18:25:31 2020 New Revision: 362549 URL: https://svnweb.freebsd.org/changeset/base/362549 Log: kmod.mk: Don't split out debug symbols if requested Ports bsd.kmod.mk explicitly sets MK_KERNEL_SYMBOLS=no to prevent auto- splitting of debuginfo from kernel modules. If that knob is set, don't split out a .ko.debug and .ko from .ko.full; just generate a .ko with debuginfo and leave it be. Otherwise, with DEBUG_FLAGS set and MK_KERNEL_SYMBOLS=no, we would helpfully strip out the debuginfo from the .ko.full and then not install it. That is not the desired result a WITH_DEBUG port kmod build. Reviewed by: emaste, jhb Differential Revision:https://reviews.freebsd.org/D24835 Modified: head/sys/conf/kmod.mk Modified: head/sys/conf/kmod.mk == --- head/sys/conf/kmod.mk Tue Jun 23 18:24:15 2020(r362548) +++ head/sys/conf/kmod.mk Tue Jun 23 18:25:31 2020(r362549) @@ -215,7 +215,7 @@ OBJS+= ${SRCS:N*.h:R:S/$/.o/g} PROG= ${KMOD}.ko .endif -.if !defined(DEBUG_FLAGS) +.if !defined(DEBUG_FLAGS) || ${MK_KERNEL_SYMBOLS} == "no" FULLPROG= ${PROG} .else FULLPROG= ${PROG}.full @@ -319,7 +319,7 @@ ${_ILINKS}: CLEANFILES+= ${PROG} ${KMOD}.kld ${OBJS} -.if defined(DEBUG_FLAGS) +.if defined(DEBUG_FLAGS) && ${MK_KERNEL_SYMBOLS} != "no" CLEANFILES+= ${FULLPROG} ${PROG}.debug .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: r362545 - head/usr.bin/sort
Author: cem Date: Tue Jun 23 16:43:48 2020 New Revision: 362545 URL: https://svnweb.freebsd.org/changeset/base/362545 Log: sort(1): Fix two wchar-related bugs in radixsort Sort(1)'s radixsort implementation was broken for multibyte LC_CTYPEs in at least two ways: * In actual radix sort, it would only bucket the least significant byte from each wchar, ignoring the 24 most-significant bits of each unicode character. * In degenerate cases / "fast paths," it would fall back to another sorting algorithm (default: mergesort) with a bogus comparator offset. The string comparison functions in sort(1) take an offset in units of the operating character size. However, radixsort was passing an offset in units of bytes. The byte offset must be divided by sizeof(wchar_t). This revision addresses both discovered issues. Some example testcases: $ (echo 耳 ; echo 脳 ; echo 耳) | \ LC_CTYPE=ja_JP.UTF-8 LC_COLLATE=C LANG=C sort --radixsort --debug $ (echo 耳 ; echo 脳 ; echo 耳) | \ LC_CTYPE=C LC_COLLATE=C LANG=C sort --radixsort --debug $ (for i in $(jot 34); do echo 耳; echo 脳; echo 脴; done) | \ LC_CTYPE=ja_JP.UTF-8 LC_COLLATE=C LANG=C sort --radixsort --debug PR: 247494 Reported by: knu MFC after:I do not intend to, but parties interested in stable might want to Modified: head/usr.bin/sort/radixsort.c Modified: head/usr.bin/sort/radixsort.c == --- head/usr.bin/sort/radixsort.c Tue Jun 23 16:29:59 2020 (r362544) +++ head/usr.bin/sort/radixsort.c Tue Jun 23 16:43:48 2020 (r362545) @@ -258,14 +258,28 @@ add_leaf(struct sort_level *sl, struct sort_list_item static inline int get_wc_index(struct sort_list_item *sli, size_t level) { + const size_t wcfact = (MB_CUR_MAX == 1) ? 1 : sizeof(wchar_t); const struct key_value *kv; const struct bwstring *bws; kv = get_key_from_keys_array(>ka, 0); bws = kv->k; - if ((BWSLEN(bws) > level)) - return (unsigned char) BWS_GET(bws,level); + if ((BWSLEN(bws) * wcfact > level)) { + wchar_t res; + + /* +* Sort wchar strings a byte at a time, rather than a single +* byte from each wchar. +*/ + res = (wchar_t)BWS_GET(bws, level / wcfact); + /* Sort most-significant byte first. */ + if (level % wcfact < wcfact - 1) + res = (res >> (8 * (wcfact - 1 - (level % wcfact; + + return (res & 0xff); + } + return (-1); } @@ -317,6 +331,7 @@ free_sort_level(struct sort_level *sl) static void run_sort_level_next(struct sort_level *sl) { + const size_t wcfact = (MB_CUR_MAX == 1) ? 1 : sizeof(wchar_t); struct sort_level *slc; size_t i, sln, tosort_num; @@ -333,8 +348,16 @@ run_sort_level_next(struct sort_level *sl) sort_left_dec(1); goto end; case (2): + /* +* Radixsort only processes a single byte at a time. In wchar +* mode, this can be a subset of the length of a character. +* list_coll_offset() offset is in units of wchar, not bytes. +* So to calculate the offset, we must divide by +* sizeof(wchar_t) and round down to the index of the first +* character this level references. +*/ if (list_coll_offset(&(sl->tosort[0]), &(sl->tosort[1]), - sl->level) > 0) { + sl->level / wcfact) > 0) { sl->sorted[sl->start_position++] = sl->tosort[1]; sl->sorted[sl->start_position] = sl->tosort[0]; } else { @@ -348,7 +371,13 @@ run_sort_level_next(struct sort_level *sl) if (TINY_NODE(sl) || (sl->level > 15)) { listcoll_t func; - func = get_list_call_func(sl->level); + /* +* Collate comparison offset is in units of +* character-width, so we must divide the level (bytes) +* by operating character width (wchar_t or char). See +* longer comment above. +*/ + func = get_list_call_func(sl->level / wcfact); sl->leaves = sl->tosort; sl->leaves_num = sl->tosort_num; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r362447 - head/sbin/dump
Author: cem Date: Sat Jun 20 20:14:50 2020 New Revision: 362447 URL: https://svnweb.freebsd.org/changeset/base/362447 Log: dump(8): Reapply slightly modified r362422 Go ahead and replace the distasteful slave language for worker processes with the straightforward description, "worker(s)." Modified: head/sbin/dump/tape.c Modified: head/sbin/dump/tape.c == --- head/sbin/dump/tape.c Sat Jun 20 20:10:42 2020(r362446) +++ head/sbin/dump/tape.c Sat Jun 20 20:14:50 2020(r362447) @@ -75,19 +75,19 @@ static char *nexttape; static FILE *popenfp = NULL; static int atomic(ssize_t (*)(), int, char *, int); -static void doslave(int, int); -static void enslave(void); +static void worker(int, int); +static void enworker(void); static void flushtape(void); static void killall(void); static void rollforward(void); /* * Concurrent dump mods (Caltech) - disk block reading and tape writing - * are exported to several slave processes. While one slave writes the + * are exported to several worker processes. While one worker writes the * tape, the others read disk blocks; they pass control of the tape in * a ring via signals. The parent process traverses the file system and - * sends writeheader()'s and lists of daddr's to the slaves via pipes. - * The following structure defines the instruction packets sent to slaves. + * sends writeheader()'s and lists of daddr's to the workers via pipes. + * The following structure defines the instruction packets sent to workers. */ struct req { ufs2_daddr_t dblk; @@ -95,20 +95,20 @@ struct req { }; static int reqsiz; -#define SLAVES 3 /* 1 slave writing, 1 reading, 1 for slack */ -static struct slave { +#define WORKERS 3 /* 1 worker writing, 1 reading, 1 for slack */ +static struct worker { int64_t tapea; /* header number at start of this chunk */ int64_t firstrec; /* record number of this block */ int count; /* count to next header (used for TS_TAPE */ /* after EOT) */ int inode; /* inode that we are currently dealing with */ - int fd; /* FD for this slave */ - int pid;/* PID for this slave */ - int sent; /* 1 == we've sent this slave requests */ + int fd; /* FD for this worker */ + int pid;/* PID for this worker */ + int sent; /* 1 == we've sent this worker requests */ char (*tblock)[TP_BSIZE]; /* buffer for data blocks */ struct req *req;/* buffer for requests */ -} slaves[SLAVES+1]; -static struct slave *slp; +} workers[WORKERS+1]; +static struct worker *mlp; static char(*nextblock)[TP_BSIZE]; @@ -116,9 +116,9 @@ static int master; /* pid of master, for sending error static int tenths; /* length of tape used per block written */ static volatile sig_atomic_t caught; /* have we caught the signal to proceed? */ static volatile sig_atomic_t ready; /* reached the lock point without having */ - /* received the SIGUSR2 signal from the prev slave? */ + /* received the SIGUSR2 signal from the prev worker? */ static jmp_buf jmpbuf; /* where to jump to if we are ready when the */ - /* SIGUSR2 arrives from the previous slave */ + /* SIGUSR2 arrives from the previous worker */ int alloctape(void) @@ -143,20 +143,20 @@ alloctape(void) * packets, so flushtape() can write them together with one write(). * Align tape buffer on page boundary to speed up tape write(). */ - for (i = 0; i <= SLAVES; i++) { + for (i = 0; i <= WORKERS; i++) { buf = (char *) malloc((unsigned)(reqsiz + writesize + pgoff + TP_BSIZE)); if (buf == NULL) return(0); - slaves[i].tblock = (char (*)[TP_BSIZE]) + workers[i].tblock = (char (*)[TP_BSIZE]) (((long)[ntrec + 1] + pgoff) &~ pgoff); - slaves[i].req = (struct req *)slaves[i].tblock - ntrec - 1; + workers[i].req = (struct req *)workers[i].tblock - ntrec - 1; } - slp = [0]; - slp->count = 1; - slp->tapea = 0; - slp->firstrec = 0; - nextblock = slp->tblock; + mlp = [0]; + mlp->count = 1; + mlp->tapea = 0; + mlp->firstrec = 0; + nextblock = mlp->tblock; return(1); } @@ -164,8 +164,8 @@ void writerec(char *dp, int isspcl) { - slp->req[trecno].dblk = (ufs2_daddr_t)0; - slp->req[trecno].count = 1; + mlp->req[trecno].dblk = (ufs2_daddr_t)0; + mlp->req[trecno].count = 1; /* Can't do a structure assignment due to alignment problems */
svn commit: r362439 - head/sys/dev/oce
Author: cem Date: Sat Jun 20 17:22:46 2020 New Revision: 362439 URL: https://svnweb.freebsd.org/changeset/base/362439 Log: oce(4): Account and trace mbufs before handing to hw Once tx mbufs have been handed to hardware, nothing serializes the tx path against completion and potential use-after-free of the outbound mbuf. Perform accounting and BPF tap before queueing to hardware to avoid this race. Submitted by: Steve Wirtz Reviewed by: markj, rstone Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D25364 Modified: head/sys/dev/oce/oce_if.c Modified: head/sys/dev/oce/oce_if.c == --- head/sys/dev/oce/oce_if.c Sat Jun 20 15:44:15 2020(r362438) +++ head/sys/dev/oce/oce_if.c Sat Jun 20 17:22:46 2020(r362439) @@ -1225,6 +1225,11 @@ retry: */ oce_is_pkt_dest_bmc(sc, m, , _new); + if_inc_counter(sc->ifp, IFCOUNTER_OBYTES, m->m_pkthdr.len); + if (m->m_flags & M_MCAST) + if_inc_counter(sc->ifp, IFCOUNTER_OMCASTS, 1); + ETHER_BPF_MTAP(sc->ifp, m); + OCE_WRITE_REG32(sc, db, wq->db_offset, reg_value); } else if (rc == EFBIG) { @@ -1400,7 +1405,7 @@ oce_start(struct ifnet *ifp) if (!sc->link_status) return; - do { + while (true) { IF_DEQUEUE(>ifp->if_snd, m); if (m == NULL) break; @@ -1417,12 +1422,7 @@ oce_start(struct ifnet *ifp) } break; } - if (m != NULL) - ETHER_BPF_MTAP(ifp, m); - - } while (TRUE); - - return; + } } @@ -1500,10 +1500,6 @@ oce_multiq_transmit(struct ifnet *ifp, struct mbuf *m, break; } drbr_advance(ifp, br); - if_inc_counter(ifp, IFCOUNTER_OBYTES, next->m_pkthdr.len); - if (next->m_flags & M_MCAST) - if_inc_counter(ifp, IFCOUNTER_OMCASTS, 1); - ETHER_BPF_MTAP(ifp, next); } return 0; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r362126 - head/sys/vm
On Thu, Jun 18, 2020 at 10:19 AM John Baldwin wrote: > > On 6/17/20 5:48 PM, Conrad Meyer wrote: > > db_printf checks the pager, via db_putc. > > It doesn't break out of the loops for you though (e.g. via setjmp or the > like). Commands still have to check db_pager_quit directly if they wish > to abort early to honor a user entering 'q' at the pager prompt. It does for Ctrl-C, but not 'q', true. It could easily do the same for 'q' as Ctrl-C: db_error(NULL) => kdb_reenter_silent(). ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r362126 - head/sys/vm
On Wed, Jun 17, 2020 at 10:50 AM John Baldwin wrote: > > On 6/12/20 3:33 PM, Conrad Meyer wrote: > > On Fri, Jun 12, 2020 at 2:53 PM Eric van Gyzen wrote: > >> Honor db_pager_quit in some vm_object ddb commands > >> > >> These can be rather verbose. > > > > We also have this (?)hack in OneFS, which eliminates the need for > > every debug function to check the db_pager globals: > > > > https://people.freebsd.org/~cem/db_pager.patch > > > > I'm not sure how objectionable it is. > > I don't think this addresses that. I think this patch makes printf turn > into db_printf when a function is invoked from DDB which is orthogonal. > db_printf() itself doesn't check the pager. db_printf checks the pager, via db_putc. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r362253 - head/sys/vm
On Wed, Jun 17, 2020 at 4:04 AM Konstantin Belousov wrote: > > On Tue, Jun 16, 2020 at 10:53:56PM +, Conrad Meyer wrote: > > Author: cem > > Date: Tue Jun 16 22:53:56 2020 > > New Revision: 362253 > > URL: https://svnweb.freebsd.org/changeset/base/362253 > > > > Log: > > vm: Drop vm_map_clip_{start,end} macro wrappers > > > > No functional change. > > > > Reviewed by:dougm, markj > > Sponsored by: Dell EMC Isilon > > Differential Revision: https://reviews.freebsd.org/D25282 > > I would highly appreciate if you revert this commit. > It conflicts with https://reviews.freebsd.org/D24652, which must revert your > change to remain functional. > I probably should not allowed that review to rott silently. Initially, I took a similar approach — converting the macros to inline functions. It was suggested in the review to just merge them, as they were both relatively small. I have a follow-up patch which will add a small amount of code to the former macros. (D25283) I don't think there is any functional reason your patch cannot be rebased over this change. You could choose to merge _vm_map_clip_start and vm_map_clip_start (and same for end) in your patch; nothing invokes the underscore variants except the wrappers. You could also choose to re-split the routines, although I'm not sure why. Either option seems acceptable to me. Best, Conrad ___ 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: r362253 - head/sys/vm
Author: cem Date: Tue Jun 16 22:53:56 2020 New Revision: 362253 URL: https://svnweb.freebsd.org/changeset/base/362253 Log: vm: Drop vm_map_clip_{start,end} macro wrappers No functional change. Reviewed by: dougm, markj Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D25282 Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c == --- head/sys/vm/vm_map.cTue Jun 16 21:30:30 2020(r362252) +++ head/sys/vm/vm_map.cTue Jun 16 22:53:56 2020(r362253) @@ -2377,24 +2377,17 @@ vm_map_entry_clone(vm_map_t map, vm_map_entry_t entry) * the specified address; if necessary, * it splits the entry into two. */ -#define vm_map_clip_start(map, entry, startaddr) \ -{ \ - if (startaddr > entry->start) \ - _vm_map_clip_start(map, entry, startaddr); \ -} - -/* - * This routine is called only when it is known that - * the entry must be split. - */ static inline void -_vm_map_clip_start(vm_map_t map, vm_map_entry_t entry, vm_offset_t start) +vm_map_clip_start(vm_map_t map, vm_map_entry_t entry, vm_offset_t start) { vm_map_entry_t new_entry; + if (start <= entry->start) + return; + VM_MAP_ASSERT_LOCKED(map); KASSERT(entry->end > start && entry->start < start, - ("_vm_map_clip_start: invalid clip of entry %p", entry)); + ("%s: invalid clip of entry %p", __func__, entry)); new_entry = vm_map_entry_clone(map, entry); @@ -2435,24 +2428,17 @@ vm_map_lookup_clip_start(vm_map_t map, vm_offset_t sta * the specified address; if necessary, * it splits the entry into two. */ -#define vm_map_clip_end(map, entry, endaddr) \ -{ \ - if ((endaddr) < (entry->end)) \ - _vm_map_clip_end((map), (entry), (endaddr)); \ -} - -/* - * This routine is called only when it is known that - * the entry must be split. - */ static inline void -_vm_map_clip_end(vm_map_t map, vm_map_entry_t entry, vm_offset_t end) +vm_map_clip_end(vm_map_t map, vm_map_entry_t entry, vm_offset_t end) { vm_map_entry_t new_entry; + if (end >= entry->end) + return; + VM_MAP_ASSERT_LOCKED(map); KASSERT(entry->start < end && entry->end > end, - ("_vm_map_clip_end: invalid clip of entry %p", entry)); + ("%s: invalid clip of entry %p", __func__, entry)); new_entry = vm_map_entry_clone(map, entry); ___ 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: r362142 - head/sys/net80211
Author: cem Date: Sat Jun 13 03:16:09 2020 New Revision: 362142 URL: https://svnweb.freebsd.org/changeset/base/362142 Log: Fix !DEBUGNET build after r362138 X-MFC-With: r362138 Modified: head/sys/net80211/ieee80211_freebsd.c head/sys/net80211/ieee80211_freebsd.h Modified: head/sys/net80211/ieee80211_freebsd.c == --- head/sys/net80211/ieee80211_freebsd.c Sat Jun 13 03:04:40 2020 (r362141) +++ head/sys/net80211/ieee80211_freebsd.c Sat Jun 13 03:16:09 2020 (r362142) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include Modified: head/sys/net80211/ieee80211_freebsd.h == --- head/sys/net80211/ieee80211_freebsd.h Sat Jun 13 03:04:40 2020 (r362141) +++ head/sys/net80211/ieee80211_freebsd.h Sat Jun 13 03:16:09 2020 (r362142) @@ -40,9 +40,7 @@ #include #include -#ifdef DEBUGNET #include -#endif /* * Common state locking definitions. ___ 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: r362141 - head/sys/kern
Author: cem Date: Sat Jun 13 03:04:40 2020 New Revision: 362141 URL: https://svnweb.freebsd.org/changeset/base/362141 Log: Flip kern.tty_info_kstacks on by default It's a useful debug aid for anyone using Ctrl-T today, and doesn't seem to be widely known. So, enable it out of the box to help people find it. It's a tunable and sysctl, so if you don't like it, it's easy to disable locally. If people really hate it, we can always flip it back. Reported by: Daniel O'Connor Modified: head/sys/kern/tty_info.c Modified: head/sys/kern/tty_info.c == --- head/sys/kern/tty_info.cSat Jun 13 02:24:35 2020(r362140) +++ head/sys/kern/tty_info.cSat Jun 13 03:04:40 2020(r362141) @@ -239,7 +239,7 @@ sbuf_tty_drain(void *a, const char *d, int len) } #ifdef STACK -static bool tty_info_kstacks = false; +static bool tty_info_kstacks = true; SYSCTL_BOOL(_kern, OID_AUTO, tty_info_kstacks, CTLFLAG_RWTUN, _info_kstacks, 0, "Enable printing kernel stack(9) traces on ^T (tty info)"); ___ 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: r362138 - head/sys/net80211
Author: cem Date: Sat Jun 13 00:59:36 2020 New Revision: 362138 URL: https://svnweb.freebsd.org/changeset/base/362138 Log: net80211: Add framework for debugnet(4) support Allow net80211 drivers to register a small vtable of debugnet-related methods. This is not a functional change. Driver support is needed, similar to debugnet(4) for wired NICs. Reviewed by: adrian, markj (earlier version both) Differential Revision:https://reviews.freebsd.org/D17308 Modified: head/sys/net80211/ieee80211_freebsd.c head/sys/net80211/ieee80211_freebsd.h head/sys/net80211/ieee80211_var.h Modified: head/sys/net80211/ieee80211_freebsd.c == --- head/sys/net80211/ieee80211_freebsd.c Fri Jun 12 23:43:44 2020 (r362137) +++ head/sys/net80211/ieee80211_freebsd.c Sat Jun 13 00:59:36 2020 (r362138) @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$"); #include #include +DEBUGNET_DEFINE(ieee80211); SYSCTL_NODE(_net, OID_AUTO, wlan, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "IEEE 80211 parameters"); @@ -111,7 +112,14 @@ wlan_clone_create(struct if_clone *ifc, int unit, cadd cp.icp_flags & IEEE80211_CLONE_MACADDR ? cp.icp_macaddr : ic->ic_macaddr); - return (vap == NULL ? EIO : 0); + if (vap == NULL) + return (EIO); + +#ifdef DEBUGNET + if (ic->ic_debugnet_meth != NULL) + DEBUGNET_SET(vap->iv_ifp, ieee80211); +#endif + return (0); } static void @@ -1046,6 +1054,54 @@ ieee80211_get_vap_ifname(struct ieee80211vap *vap) return "(none)"; return vap->iv_ifp->if_xname; } + +#ifdef DEBUGNET +static void +ieee80211_debugnet_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize) +{ + struct ieee80211vap *vap; + struct ieee80211com *ic; + + vap = if_getsoftc(ifp); + ic = vap->iv_ic; + + IEEE80211_LOCK(ic); + ic->ic_debugnet_meth->dn8_init(ic, nrxr, ncl, clsize); + IEEE80211_UNLOCK(ic); +} + +static void +ieee80211_debugnet_event(struct ifnet *ifp, enum debugnet_ev ev) +{ + struct ieee80211vap *vap; + struct ieee80211com *ic; + + vap = if_getsoftc(ifp); + ic = vap->iv_ic; + + IEEE80211_LOCK(ic); + ic->ic_debugnet_meth->dn8_event(ic, ev); + IEEE80211_UNLOCK(ic); +} + +static int +ieee80211_debugnet_transmit(struct ifnet *ifp, struct mbuf *m) +{ + return (ieee80211_vap_transmit(ifp, m)); +} + +static int +ieee80211_debugnet_poll(struct ifnet *ifp, int count) +{ + struct ieee80211vap *vap; + struct ieee80211com *ic; + + vap = if_getsoftc(ifp); + ic = vap->iv_ic; + + return (ic->ic_debugnet_meth->dn8_poll(ic, count)); +} +#endif /* * Module glue. Modified: head/sys/net80211/ieee80211_freebsd.h == --- head/sys/net80211/ieee80211_freebsd.h Fri Jun 12 23:43:44 2020 (r362137) +++ head/sys/net80211/ieee80211_freebsd.h Sat Jun 13 00:59:36 2020 (r362138) @@ -40,6 +40,10 @@ #include #include +#ifdef DEBUGNET +#include +#endif + /* * Common state locking definitions. */ @@ -492,6 +496,36 @@ typedef int ieee80211_ioctl_setfunc(struct ieee80211va struct ieee80211req *); SET_DECLARE(ieee80211_ioctl_setset, ieee80211_ioctl_setfunc); #defineIEEE80211_IOCTL_SET(_name, _set) TEXT_SET(ieee80211_ioctl_setset, _set) + +#ifdef DEBUGNET +typedef void debugnet80211_init_t(struct ieee80211com *, int *nrxr, int *ncl, +int *clsize); +typedef void debugnet80211_event_t(struct ieee80211com *, enum debugnet_ev); +typedef int debugnet80211_poll_t(struct ieee80211com *, int); + +struct debugnet80211_methods { + debugnet80211_init_t*dn8_init; + debugnet80211_event_t *dn8_event; + debugnet80211_poll_t*dn8_poll; +}; + +#defineDEBUGNET80211_DEFINE(driver) \ + static debugnet80211_init_t driver##_debugnet80211_init; \ + static debugnet80211_event_t driver##_debugnet80211_event; \ + static debugnet80211_poll_t driver##_debugnet80211_poll; \ + \ + static struct debugnet80211_methods driver##_debugnet80211_methods = { \ + .dn8_init = driver##_debugnet80211_init, \ + .dn8_event = driver##_debugnet80211_event, \ + .dn8_poll = driver##_debugnet80211_poll, \ + } +#define DEBUGNET80211_SET(ic, driver) \ + (ic)->ic_debugnet_meth = ##_debugnet80211_methods +#else +#define DEBUGNET80211_DEFINE(driver) +#define DEBUGNET80211_SET(ic, driver) +#endif /* DEBUGNET */ + #endif /* _KERNEL */ /* XXX this
Re: svn commit: r362126 - head/sys/vm
On Fri, Jun 12, 2020 at 2:53 PM Eric van Gyzen wrote: > Honor db_pager_quit in some vm_object ddb commands > > These can be rather verbose. We also have this (?)hack in OneFS, which eliminates the need for every debug function to check the db_pager globals: https://people.freebsd.org/~cem/db_pager.patch I'm not sure how objectionable it is. ___ 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: r361900 - head/sbin/reboot
Author: cem Date: Mon Jun 8 00:46:19 2020 New Revision: 361900 URL: https://svnweb.freebsd.org/changeset/base/361900 Log: x86 boot.8: Remove obsolescent non-loader x86 boot documentation x86 boot uses loader(8) and the boot2-direct-to-kernel process is not supported. Remove the documentation, which doesn't document a working process and leads to confusion. PR: 247074 Reported by: Alex K. Modified: head/sbin/reboot/boot_i386.8 Modified: head/sbin/reboot/boot_i386.8 == --- head/sbin/reboot/boot_i386.8Mon Jun 8 00:20:15 2020 (r361899) +++ head/sbin/reboot/boot_i386.8Mon Jun 8 00:46:19 2020 (r361900) @@ -36,7 +36,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 19, 2019 +.Dd June 7, 2020 .Dt BOOT 8 i386 .Os .Sh NAME @@ -61,31 +61,13 @@ That process is described in .Xr uefi 8 . .Pp -By default, a three-stage bootstrap is employed, and control is -automatically passed from the boot blocks (bootstrap stages one and -two) to a separate third-stage bootstrap program, +A three-stage bootstrap is employed. +Control is passed from the boot blocks (bootstrap stages one and two) to a +third-stage bootstrap program, .Xr loader 8 . This third stage provides more sophisticated control over the booting process than it is possible to achieve in the boot blocks, which are constrained by occupying limited fixed space on a given disk or slice. -.Pp -However, it is possible to dispense with the third stage altogether, -either by specifying a kernel name in the boot block parameter -file, -.Pa /boot.config , -or, unless option -.Fl n -is set, by hitting a key during a brief pause (while one of the characters -.Sy - , -.Sy \e , -.Sy \&| , -or -.Sy / -is displayed) before -.Xr loader 8 -is invoked. -Booting will also be attempted at stage two, if the -third stage cannot be loaded. .Pp The remainder of this subsection deals only with the boot blocks. The ___ 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: r361870 - in head/sys/geom: . label
Author: cem Date: Sat Jun 6 14:19:16 2020 New Revision: 361870 URL: https://svnweb.freebsd.org/changeset/base/361870 Log: Revert r361838 Reported by: delphij Modified: head/sys/geom/geom_dev.c head/sys/geom/label/g_label.c Modified: head/sys/geom/geom_dev.c == --- head/sys/geom/geom_dev.cSat Jun 6 07:13:06 2020(r361869) +++ head/sys/geom/geom_dev.cSat Jun 6 14:19:16 2020(r361870) @@ -336,20 +336,9 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp, struct cdev *dev, *adev; char buf[SPECNAMELEN + 6]; struct make_dev_args args; - bool retaste; g_trace(G_T_TOPOLOGY, "dev_taste(%s,%s)", mp->name, pp->name); g_topology_assert(); - /* Only one geom_dev per provider. */ - LIST_FOREACH(cp, >consumers, consumers) { - if (cp->geom->class != mp || (cp->flags & G_CF_SPOILED)) - continue; - gp = cp->geom; - sc = cp->private; - dev = sc->sc_dev; - retaste = true; - goto aliases; - } gp = g_new_geomf(mp, "%s", pp->name); sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO); mtx_init(>sc_mtx, "g_dev", NULL, MTX_DEF); @@ -391,8 +380,6 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp, g_dev_attrchanged(cp, "GEOM::physpath"); snprintf(buf, sizeof(buf), "cdev=%s", gp->name); devctl_notify_f("GEOM", "DEV", "CREATE", buf, M_WAITOK); - retaste = false; -aliases: /* * Now add all the aliases for this drive */ @@ -400,16 +387,8 @@ aliases: error = make_dev_alias_p(MAKEDEV_CHECKNAME | MAKEDEV_WAITOK, , dev, "%s", gap->ga_alias); if (error) { - /* -* With aliases added after initial taste, we don't -* know which aliases are new in this retaste, so we -* try to create all of them. EEXIST is expected and -* silently ignored or else this becomes really spammy. -*/ - if (error != EEXIST || !retaste) - printf("%s: make_dev_alias_p() failed (name=%s," - " error=%d)\n", __func__, gap->ga_alias, - error); + printf("%s: make_dev_alias_p() failed (name=%s, error=%d)\n", + __func__, gap->ga_alias, error); continue; } snprintf(buf, sizeof(buf), "cdev=%s", gap->ga_alias); Modified: head/sys/geom/label/g_label.c == --- head/sys/geom/label/g_label.c Sat Jun 6 07:13:06 2020 (r361869) +++ head/sys/geom/label/g_label.c Sat Jun 6 14:19:16 2020 (r361870) @@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -345,16 +344,18 @@ g_label_taste(struct g_class *mp, struct g_provider *p { struct g_label_metadata md; struct g_consumer *cp; - struct g_class *clsp; struct g_geom *gp; int i; - bool changed; g_trace(G_T_TOPOLOGY, "%s(%s, %s)", __func__, mp->name, pp->name); g_topology_assert(); G_LABEL_DEBUG(2, "Tasting %s.", pp->name); + /* Skip providers that are already open for writing. */ + if (pp->acw > 0) + return (NULL); + if (strcmp(pp->geom->class->name, mp->name) == 0) return (NULL); @@ -390,16 +391,9 @@ g_label_taste(struct g_class *mp, struct g_provider *p if (md.md_provsize != pp->mediasize) break; - /* Skip providers that are already open for writing. */ - if (pp->acw > 0) { - g_access(cp, -1, 0, 0); - goto end; - } - g_label_create(NULL, mp, pp, md.md_label, G_LABEL_DIR, pp->mediasize - pp->sectorsize); } while (0); - changed = false; for (i = 0; g_labels[i] != NULL; i++) { char label[128]; @@ -411,28 +405,8 @@ g_label_taste(struct g_class *mp, struct g_provider *p g_topology_lock(); if (label[0] == '\0') continue; - if (!g_label_is_name_ok(label)) { - G_LABEL_DEBUG(0, - "%s contains suspicious label, skipping.", - pp->name); - G_LABEL_DEBUG(1, "%s suspicious label is: %s", - pp->name, label); - continue; - } - g_provider_add_alias(pp,
svn commit: r361838 - in head/sys/geom: . label
Author: cem Date: Fri Jun 5 16:12:21 2020 New Revision: 361838 URL: https://svnweb.freebsd.org/changeset/base/361838 Log: geom_label: Use provider aliasing to alias upstream geoms For synthetic aliases (just pseudonyms inferred from metadata like GPT or UFS labels, GPT UUIDs, etc), use the GEOM provider aliasing system to create a symlink to the real device instead of creating an independent device. This makes it more clear which labels and devices correspond, and we can safely have multiple labels to a single device accessed at once. The confusingly named geom_label on-disk construct continues to behave identically to how it did before. This requires teaching GEOM's provider aliasing about the possibility that aliases might be added later in time, and GEOM's devfs interaction layer not to worry about existing aliases during retaste. Discussed with: imp Relnotes: sure, if we don't end up reverting it Differential Revision:https://reviews.freebsd.org/D24968 Modified: head/sys/geom/geom_dev.c head/sys/geom/label/g_label.c Modified: head/sys/geom/geom_dev.c == --- head/sys/geom/geom_dev.cFri Jun 5 16:05:09 2020(r361837) +++ head/sys/geom/geom_dev.cFri Jun 5 16:12:21 2020(r361838) @@ -336,9 +336,20 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp, struct cdev *dev, *adev; char buf[SPECNAMELEN + 6]; struct make_dev_args args; + bool retaste; g_trace(G_T_TOPOLOGY, "dev_taste(%s,%s)", mp->name, pp->name); g_topology_assert(); + /* Only one geom_dev per provider. */ + LIST_FOREACH(cp, >consumers, consumers) { + if (cp->geom->class != mp || (cp->flags & G_CF_SPOILED)) + continue; + gp = cp->geom; + sc = cp->private; + dev = sc->sc_dev; + retaste = true; + goto aliases; + } gp = g_new_geomf(mp, "%s", pp->name); sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO); mtx_init(>sc_mtx, "g_dev", NULL, MTX_DEF); @@ -380,6 +391,8 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp, g_dev_attrchanged(cp, "GEOM::physpath"); snprintf(buf, sizeof(buf), "cdev=%s", gp->name); devctl_notify_f("GEOM", "DEV", "CREATE", buf, M_WAITOK); + retaste = false; +aliases: /* * Now add all the aliases for this drive */ @@ -387,8 +400,16 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp, error = make_dev_alias_p(MAKEDEV_CHECKNAME | MAKEDEV_WAITOK, , dev, "%s", gap->ga_alias); if (error) { - printf("%s: make_dev_alias_p() failed (name=%s, error=%d)\n", - __func__, gap->ga_alias, error); + /* +* With aliases added after initial taste, we don't +* know which aliases are new in this retaste, so we +* try to create all of them. EEXIST is expected and +* silently ignored or else this becomes really spammy. +*/ + if (error != EEXIST || !retaste) + printf("%s: make_dev_alias_p() failed (name=%s," + " error=%d)\n", __func__, gap->ga_alias, + error); continue; } snprintf(buf, sizeof(buf), "cdev=%s", gap->ga_alias); Modified: head/sys/geom/label/g_label.c == --- head/sys/geom/label/g_label.c Fri Jun 5 16:05:09 2020 (r361837) +++ head/sys/geom/label/g_label.c Fri Jun 5 16:12:21 2020 (r361838) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -344,18 +345,16 @@ g_label_taste(struct g_class *mp, struct g_provider *p { struct g_label_metadata md; struct g_consumer *cp; + struct g_class *clsp; struct g_geom *gp; int i; + bool changed; g_trace(G_T_TOPOLOGY, "%s(%s, %s)", __func__, mp->name, pp->name); g_topology_assert(); G_LABEL_DEBUG(2, "Tasting %s.", pp->name); - /* Skip providers that are already open for writing. */ - if (pp->acw > 0) - return (NULL); - if (strcmp(pp->geom->class->name, mp->name) == 0) return (NULL); @@ -391,9 +390,16 @@ g_label_taste(struct g_class *mp, struct g_provider *p if (md.md_provsize != pp->mediasize) break; + /* Skip providers that are already open for writing. */ + if (pp->acw > 0) { + g_access(cp, -1, 0,
svn commit: r361837 - head/sys/geom
Author: cem Date: Fri Jun 5 16:05:09 2020 New Revision: 361837 URL: https://svnweb.freebsd.org/changeset/base/361837 Log: geom: Don't re-add duplicate aliases Reviewed by: imp (informal +1; extracted from phab 24968) Modified: head/sys/geom/geom_subr.c Modified: head/sys/geom/geom_subr.c == --- head/sys/geom/geom_subr.c Fri Jun 5 15:09:02 2020(r361836) +++ head/sys/geom/geom_subr.c Fri Jun 5 16:05:09 2020(r361837) @@ -652,6 +652,15 @@ g_provider_add_alias(struct g_provider *pp, const char sbuf_vprintf(sb, fmt, ap); va_end(ap); sbuf_finish(sb); + + LIST_FOREACH(gap, >aliases, ga_next) { + if (strcmp(gap->ga_alias, sbuf_data(sb)) != 0) + continue; + /* Don't re-add the same alias. */ + sbuf_delete(sb); + return; + } + gap = g_malloc(sizeof(*gap) + sbuf_len(sb) + 1, M_WAITOK | M_ZERO); memcpy((char *)(gap + 1), sbuf_data(sb), sbuf_len(sb)); sbuf_delete(sb); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r361791 - head/etc/mtree
On Thu, Jun 4, 2020 at 9:04 AM Conrad Meyer wrote: > 750 is no more restrictive than defaults for the rest of the open source > Unix-alike world. In particular, Ben Woods surveyed DragonFly, NetBSD, > OpenBSD, ArchLinux, CentOS, Debian, Fedora, Slackware, and Ubuntu. None > have a > world-readable /root by default. A minor correction: NetBSD does have a world-readable /root by default. The rest do not. Conrad ___ 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: r361791 - head/etc/mtree
Author: cem Date: Thu Jun 4 16:04:19 2020 New Revision: 361791 URL: https://svnweb.freebsd.org/changeset/base/361791 Log: Restrict default /root permissions Remove world-readability from the root directory. Sensitive information may be stored in /root and we diverge here from normative administrative practice, as well as installation defaults of other Unix-alikes. The wheel group is still permitted to read the directory. 750 is no more restrictive than defaults for the rest of the open source Unix-alike world. In particular, Ben Woods surveyed DragonFly, NetBSD, OpenBSD, ArchLinux, CentOS, Debian, Fedora, Slackware, and Ubuntu. None have a world-readable /root by default. Submitted by: Gordon Bergling Reviewed by: ian, myself Discussed with: emaste (informal approval) Relnotes: sure? Differential Revision:https://reviews.freebsd.org/D23392 Modified: head/etc/mtree/BSD.root.dist Modified: head/etc/mtree/BSD.root.dist == --- head/etc/mtree/BSD.root.distThu Jun 4 14:44:44 2020 (r361790) +++ head/etc/mtree/BSD.root.distThu Jun 4 16:04:19 2020 (r361791) @@ -117,7 +117,7 @@ .. rescue .. -root +rootmode=0750 .. sbin .. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r361783 - head/usr.bin/killall
On Thu, Jun 4, 2020 at 3:43 AM Eugene Grosbein wrote: > > 04.06.2020 11:29, Benjamin Kaduk wrote: > > --- head/usr.bin/killall/killall.1Thu Jun 4 02:36:41 2020 > > (r361782) > > +++ head/usr.bin/killall/killall.1Thu Jun 4 04:29:43 2020 > > (r361783) > > @@ -145,6 +145,50 @@ utility exits 0 if some processes have been found and > > signalled successfully. > > Otherwise, a status of 1 will be > > returned. > > +.Sh EXAMPLES > > +Send > > +.Dv SIGTERM > > +to all firefox processes: > > +.Bd -literal -offset indent > > +killall firefox > > +.Ed > > +.Pp > > +Send > > +.Dv SIGTERM > > +to firefox processes belonging to > > +.Va USER : > > +.Bd -literal -offset indent > > +killall -u ${USER} firefox > > +.Ed > > +.Pp > > +Stop all firefox processes: > > +.Bd -literal -offset indent > > +killall -SIGSTOP firefox > > +.Ed > > +.Pp > > +Resume firefox processes: > > +.Bd -literal -offset indent > > +killall -SIGCONT firefox > > +.Ed > > +.Pp > > +Show what would be done to firefox processes, but do not actually signal > > them: > > +.Bd -literal -offset indent > > +killall -s firefox > > +.Ed > > "Firefox" is a trade mark (type of intellectual property) of Mozilla > Foundation. > Is it OK for us to use this name such way? Yes. You can of course refer to trademarks in writing, or else no one could write news or blog about Firefox™, Chrome™, Windows™, Linux™, or even FreeBSD™. There is no likelihood of confusion with the firefox product or dilution of the trademark, and the use is non-commerical. Conrad ___ 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: r361635 - head/sys/geom/part
Author: cem Date: Fri May 29 19:44:18 2020 New Revision: 361635 URL: https://svnweb.freebsd.org/changeset/base/361635 Log: geom_part: Dispatch to partitions to create providers and aliases This allows partitions to create additional aliases of their own. The default method implementations preserve the existing behavior. No functional change. Reviewed by: imp Differential Revision:https://reviews.freebsd.org/D24938 Modified: head/sys/geom/part/g_part.c head/sys/geom/part/g_part_if.m Modified: head/sys/geom/part/g_part.c == --- head/sys/geom/part/g_part.c Fri May 29 19:29:10 2020(r361634) +++ head/sys/geom/part/g_part.c Fri May 29 19:44:18 2020(r361635) @@ -469,7 +469,6 @@ g_part_new_provider(struct g_geom *gp, struct g_part_t { struct g_consumer *cp; struct g_provider *pp; - struct sbuf *sb; struct g_geom_alias *gap; off_t offset; @@ -481,11 +480,7 @@ g_part_new_provider(struct g_geom *gp, struct g_part_t entry->gpe_offset = offset; if (entry->gpe_pp == NULL) { - sb = sbuf_new_auto(); - G_PART_FULLNAME(table, entry, sb, gp->name); - sbuf_finish(sb); - entry->gpe_pp = g_new_providerf(gp, "%s", sbuf_data(sb)); - sbuf_delete(sb); + entry->gpe_pp = G_PART_NEW_PROVIDER(table, gp, entry, gp->name); /* * If our parent provider had any aliases, then copy them to our * provider so when geom DEV tastes things later, they will be @@ -493,13 +488,8 @@ g_part_new_provider(struct g_geom *gp, struct g_part_t * place of the geom's name we use to create the provider. The * kobj interface that generates names makes this awkward. */ - LIST_FOREACH(gap, >aliases, ga_next) { - sb = sbuf_new_auto(); - G_PART_FULLNAME(table, entry, sb, gap->ga_alias); - sbuf_finish(sb); - g_provider_add_alias(entry->gpe_pp, "%s", sbuf_data(sb)); - sbuf_delete(sb); - } + LIST_FOREACH(gap, >aliases, ga_next) + G_PART_ADD_ALIAS(table, entry->gpe_pp, entry, gap->ga_alias); entry->gpe_pp->flags |= G_PF_DIRECT_SEND | G_PF_DIRECT_RECEIVE; entry->gpe_pp->private = entry; /* Close the circle. */ } Modified: head/sys/geom/part/g_part_if.m == --- head/sys/geom/part/g_part_if.m Fri May 29 19:29:10 2020 (r361634) +++ head/sys/geom/part/g_part_if.m Fri May 29 19:44:18 2020 (r361635) @@ -52,6 +52,34 @@ CODE { G_PART_NAME(table, entry, buf, sizeof(buf))); } + static struct g_provider * + default_new_provider(struct g_part_table *table, struct g_geom *gp, + struct g_part_entry *entry, const char *pfx) + { + struct g_provider *ret; + struct sbuf *sb; + + sb = sbuf_new_auto(); + G_PART_FULLNAME(table, entry, sb, pfx); + sbuf_finish(sb); + ret = g_new_providerf(gp, "%s", sbuf_data(sb)); + sbuf_delete(sb); + return (ret); + } + + static void + default_add_alias(struct g_part_table *table, struct g_provider *pp, + struct g_part_entry *entry, const char *pfx) + { + struct sbuf *sb; + + sb = sbuf_new_auto(); + G_PART_FULLNAME(table, entry, sb, pfx); + sbuf_finish(sb); + g_provider_add_alias(pp, "%s", sbuf_data(sb)); + sbuf_delete(sb); + } + static int default_precheck(struct g_part_table *t __unused, enum g_part_ctl r __unused, struct g_part_parms *p __unused) @@ -88,6 +116,15 @@ METHOD int add { struct g_part_parms *gpp; }; +# add_alias() - Create aliases for the partition's provider with the given +# alias prefixes. +METHOD void add_alias { + struct g_part_table *table; + struct g_provider *pp; + struct g_part_entry *entry; + const char *pfx; +} DEFAULT default_add_alias; + # bootcode() - scheme specific processing for the bootcode verb. METHOD int bootcode { struct g_part_table *table; @@ -144,6 +181,14 @@ METHOD int modify { struct g_part_entry *entry; struct g_part_parms *gpp; }; + +# new_provider() - Create the partition's provider(s). +METHOD struct g_provider * new_provider { + struct g_part_table *table; + struct g_geom *gp; + struct g_part_entry *entry; + const char *pfx; +} DEFAULT default_new_provider; # resize() - scheme specific processing for the resize
svn commit: r361540 - in head/sys/x86: include x86
Author: cem Date: Tue May 26 23:12:57 2020 New Revision: 361540 URL: https://svnweb.freebsd.org/changeset/base/361540 Log: x86: Detect new feature bits Fix an off-by-one in AVX512VPOPCNTDQ identification. That was actually the TME bit. Reported by: debdrup Modified: head/sys/x86/include/specialreg.h head/sys/x86/x86/identcpu.c Modified: head/sys/x86/include/specialreg.h == --- head/sys/x86/include/specialreg.h Tue May 26 22:41:12 2020 (r361539) +++ head/sys/x86/include/specialreg.h Tue May 26 23:12:57 2020 (r361540) @@ -396,6 +396,7 @@ #defineAMDFEID_IBRS_ALWAYSON 0x0001 #defineAMDFEID_STIBP_ALWAYSON 0x0002 #defineAMDFEID_PREFER_IBRS 0x0004 +#defineAMDFEID_PPIN0x0080 #defineAMDFEID_SSBD0x0100 /* SSBD via MSRC001_011F instead of MSR 0x48: */ #defineAMDFEID_VIRT_SSBD 0x0200 @@ -459,7 +460,9 @@ #defineCPUID_STDEXT2_VPCLMULQDQ0x0400 #defineCPUID_STDEXT2_AVX512VNNI0x0800 #defineCPUID_STDEXT2_AVX512BITALG 0x1000 +#defineCPUID_STDEXT2_TME 0x2000 #defineCPUID_STDEXT2_AVX512VPOPCNTDQ 0x4000 +#defineCPUID_STDEXT2_LA57 0x0001 #defineCPUID_STDEXT2_RDPID 0x0040 #defineCPUID_STDEXT2_CLDEMOTE 0x0200 #defineCPUID_STDEXT2_MOVDIRI 0x0800 @@ -472,6 +475,7 @@ */ #defineCPUID_STDEXT3_AVX5124VNNIW 0x0004 #defineCPUID_STDEXT3_AVX5124FMAPS 0x0008 +#defineCPUID_STDEXT3_FSRM 0x0010 #defineCPUID_STDEXT3_AVX512VP2INTERSECT0x0100 #defineCPUID_STDEXT3_MD_CLEAR 0x0400 #defineCPUID_STDEXT3_TSXFA 0x2000 Modified: head/sys/x86/x86/identcpu.c == --- head/sys/x86/x86/identcpu.c Tue May 26 22:41:12 2020(r361539) +++ head/sys/x86/x86/identcpu.c Tue May 26 23:12:57 2020(r361540) @@ -1008,7 +1008,9 @@ printcpuinfo(void) "\013VPCLMULQDQ" "\014AVX512VNNI" "\015AVX512BITALG" - "\016AVX512VPOPCNTDQ" + "\016TME" + "\017AVX512VPOPCNTDQ" + "\021LA57" "\027RDPID" "\032CLDEMOTE" "\034MOVDIRI" @@ -1095,6 +1097,7 @@ printcpuinfo(void) "\021IBRS_ALWAYSON" "\022STIBP_ALWAYSON" "\023PREFER_IBRS" + "\030PPIN" "\031SSBD" "\032VIRT_SSBD" "\033SSB_NO" ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r361466 - in head: sys/amd64/amd64 sys/arm/arm sys/arm64/arm64 sys/conf sys/fs/fuse sys/fs/unionfs sys/i386/i386 sys/kern sys/mips/mips sys/powerpc/powerpc sys/riscv/riscv sys/sys tools...
Author: cem Date: Mon May 25 16:40:48 2020 New Revision: 361466 URL: https://svnweb.freebsd.org/changeset/base/361466 Log: copystr(9): Move to deprecate (attempt #2) This reapplies logical r360944 and r360946 (reverting r360955), with fixed copystr() stand-in replacement macro. Eventually the goal is to convert consumers and kill the macro, but for a first step it helps if the macro is correct. Prior commit message: Unlike the other copy*() functions, it does not serve to copy from one address space to another or protect against potential faults. It's just an older incarnation of the now-more-common strlcpy(). Add a coccinelle script to tools/ which can be used to mechanically convert existing instances where replacement with strlcpy is trivial. In the two cases which matched, fuse_vfsops.c and union_vfsops.c, the code was further refactored manually to simplify. Replace the declaration of copystr() in systm.h with a small macro wrapper around strlcpy (with correction from brooks@ -- thanks). Remove N redundant MI implementations of copystr. For MIPS, this entailed inlining the assembler copystr into the only consumer, copyinstr, and making the latter a leaf function. Reviewed by: jhb (earlier version) Discussed with: brooks (thanks!) Differential Revision:https://reviews.freebsd.org/D24672 Added: head/tools/coccinelle/ head/tools/coccinelle/copystr9.cocci (contents, props changed) Deleted: head/sys/arm64/arm64/copystr.c head/sys/powerpc/powerpc/copystr.c head/sys/riscv/riscv/copystr.c Modified: head/sys/amd64/amd64/support.S head/sys/arm/arm/copystr.S head/sys/conf/files.arm64 head/sys/conf/files.powerpc head/sys/conf/files.riscv head/sys/fs/fuse/fuse_vfsops.c head/sys/fs/unionfs/union_vfsops.c head/sys/i386/i386/support.s head/sys/kern/subr_csan.c head/sys/mips/mips/support.S head/sys/sys/systm.h Modified: head/sys/amd64/amd64/support.S == --- head/sys/amd64/amd64/support.S Mon May 25 16:06:30 2020 (r361465) +++ head/sys/amd64/amd64/support.S Mon May 25 16:40:48 2020 (r361466) @@ -1417,43 +1417,6 @@ copyinstr_toolong: jmp cpystrflt_x /* - * copystr(from, to, maxlen, int *lencopied) - * %rdi, %rsi, %rdx, %rcx - */ -ENTRY(copystr) - PUSH_FRAME_POINTER - movq%rdx,%r8/* %r8 = maxlen */ - - incq%rdx -1: - decq%rdx - jz 4f - movb(%rdi),%al - movb%al,(%rsi) - incq%rsi - incq%rdi - testb %al,%al - jnz 1b - - /* Success -- 0 byte reached */ - decq%rdx - xorl%eax,%eax -2: - testq %rcx,%rcx - jz 3f - /* set *lencopied and return %rax */ - subq%rdx,%r8 - movq%r8,(%rcx) -3: - POP_FRAME_POINTER - ret -4: - /* rdx is zero -- return ENAMETOOLONG */ - movl$ENAMETOOLONG,%eax - jmp 2b -END(copystr) - -/* * Handling of special amd64 registers and descriptor tables etc */ /* void lgdt(struct region_descriptor *rdp); */ Modified: head/sys/arm/arm/copystr.S == --- head/sys/arm/arm/copystr.S Mon May 25 16:06:30 2020(r361465) +++ head/sys/arm/arm/copystr.S Mon May 25 16:40:48 2020(r361466) @@ -60,39 +60,6 @@ __FBSDID("$FreeBSD$"); ldr tmp, .Lpcb #endif -/* - * r0 - from - * r1 - to - * r2 - maxlens - * r3 - lencopied - * - * Copy string from r0 to r1 - */ -ENTRY(copystr) - stmfd sp!, {r4-r5}/* stack is 8 byte aligned */ - teq r2, #0x - mov r5, #0x - moveq r0, #ENAMETOOLONG - beq 2f - -1: ldrbr4, [r0], #0x0001 - add r5, r5, #0x0001 - teq r4, #0x - strbr4, [r1], #0x0001 - teqne r5, r2 - bne 1b - - teq r4, #0x - moveq r0, #0x - movne r0, #ENAMETOOLONG - -2: teq r3, #0x - strne r5, [r3] - - ldmfd sp!, {r4-r5}/* stack is 8 byte aligned */ - RET -END(copystr) - #define SAVE_REGS stmfd sp!, {r4-r6} #define RESTORE_REGS ldmfd sp!, {r4-r6} Modified: head/sys/conf/files.arm64 == --- head/sys/conf/files.arm64 Mon May 25 16:06:30 2020(r361465) +++ head/sys/conf/files.arm64 Mon May 25 16:40:48 2020(r361466) @@ -134,7 +134,6 @@ arm64/arm64/busdma_machdep.cstandard arm64/arm64/bzero.Sstandard arm64/arm64/clock.cstandard arm64/arm64/copyinout.Sstandard -arm64/arm64/copystr.c standard arm64/arm64/cpu_errata.c standard
svn commit: r361427 - head/sys/contrib/zstd/lib/common
Author: cem Date: Sat May 23 23:10:03 2020 New Revision: 361427 URL: https://svnweb.freebsd.org/changeset/base/361427 Log: Unbreak ARM64 kernel build after r361426 X-MFC-With: r361426 Modified: head/sys/contrib/zstd/lib/common/zstd_internal.h Modified: head/sys/contrib/zstd/lib/common/zstd_internal.h == --- head/sys/contrib/zstd/lib/common/zstd_internal.hSat May 23 21:23:46 2020(r361426) +++ head/sys/contrib/zstd/lib/common/zstd_internal.hSat May 23 23:10:03 2020(r361427) @@ -19,7 +19,7 @@ /*-* * Dependencies ***/ -#ifdef __aarch64__ +#if defined(__aarch64__) && !defined(_KERNEL) #include #endif #include "compiler.h" @@ -228,7 +228,7 @@ static const U32 OF_defaultNormLog = OF_DEFAULTNORMLOG * Shared functions to include for inlining */ static void ZSTD_copy8(void* dst, const void* src) { -#ifdef __aarch64__ +#if defined(__aarch64__) && !defined(_KERNEL) vst1_u8((uint8_t*)dst, vld1_u8((const uint8_t*)src)); #else memcpy(dst, src, 8); @@ -237,7 +237,7 @@ static void ZSTD_copy8(void* dst, const void* src) { #define COPY8(d,s) { ZSTD_copy8(d,s); d+=8; s+=8; } static void ZSTD_copy16(void* dst, const void* src) { -#ifdef __aarch64__ +#if defined(__aarch64__) && !defined(_KERNEL) vst1q_u8((uint8_t*)dst, vld1q_u8((const uint8_t*)src)); #else memcpy(dst, src, 16); ___ 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: r361426 - in head: lib/libzstd sys/conf sys/contrib/zstd sys/contrib/zstd/contrib sys/contrib/zstd/contrib/docker sys/contrib/zstd/contrib/experimental_dict_builders/benchmarkDictBuilde...
Author: cem Date: Sat May 23 21:23:46 2020 New Revision: 361426 URL: https://svnweb.freebsd.org/changeset/base/361426 Log: Update to Zstandard 1.4.5 As usual, the full release notes are found on Github: https://github.com/facebook/zstd/releases/tag/v1.4.5 Notable changes include: * Improved decompress performance on amd64 and arm (5-10% and 15-50%, respectively). * '--patch-from' zstd(1) CLI option, which provides something like a very fast version of bspatch(1) with slightly worse compression. See release notes. In this update, I dropped the 3-year old -O0 workaround for an LLVM ARM bug; the bug was fixed in LLVM SVN in 2017, but we didn't remove this workaround from our tree until now. MFC after:I won't, but feel free Relnotes: yes Added: head/sys/contrib/zstd/lib/compress/zstd_compress_superblock.c - copied unchanged from r361425, vendor/zstd/dist/lib/compress/zstd_compress_superblock.c head/sys/contrib/zstd/lib/compress/zstd_compress_superblock.h - copied unchanged from r361425, vendor/zstd/dist/lib/compress/zstd_compress_superblock.h Deleted: head/sys/contrib/zstd/contrib/cleanTabs head/sys/contrib/zstd/contrib/docker/Dockerfile head/sys/contrib/zstd/contrib/docker/README.md head/sys/contrib/zstd/contrib/experimental_dict_builders/benchmarkDictBuilder/Makefile head/sys/contrib/zstd/contrib/experimental_dict_builders/benchmarkDictBuilder/README.md head/sys/contrib/zstd/contrib/experimental_dict_builders/benchmarkDictBuilder/benchmark.c head/sys/contrib/zstd/contrib/experimental_dict_builders/benchmarkDictBuilder/dictBuilder.h head/sys/contrib/zstd/contrib/experimental_dict_builders/benchmarkDictBuilder/test.sh head/sys/contrib/zstd/contrib/experimental_dict_builders/fastCover/Makefile head/sys/contrib/zstd/contrib/experimental_dict_builders/fastCover/README.md head/sys/contrib/zstd/contrib/experimental_dict_builders/fastCover/fastCover.c head/sys/contrib/zstd/contrib/experimental_dict_builders/fastCover/fastCover.h head/sys/contrib/zstd/contrib/experimental_dict_builders/fastCover/main.c head/sys/contrib/zstd/contrib/experimental_dict_builders/fastCover/test.sh head/sys/contrib/zstd/contrib/experimental_dict_builders/randomDictBuilder/Makefile head/sys/contrib/zstd/contrib/experimental_dict_builders/randomDictBuilder/README.md head/sys/contrib/zstd/contrib/experimental_dict_builders/randomDictBuilder/io.c head/sys/contrib/zstd/contrib/experimental_dict_builders/randomDictBuilder/io.h head/sys/contrib/zstd/contrib/experimental_dict_builders/randomDictBuilder/main.c head/sys/contrib/zstd/contrib/experimental_dict_builders/randomDictBuilder/random.c head/sys/contrib/zstd/contrib/experimental_dict_builders/randomDictBuilder/random.h head/sys/contrib/zstd/contrib/experimental_dict_builders/randomDictBuilder/test.sh head/sys/contrib/zstd/contrib/gen_html/Makefile head/sys/contrib/zstd/contrib/gen_html/README.md head/sys/contrib/zstd/contrib/gen_html/gen-zstd-manual.sh head/sys/contrib/zstd/contrib/gen_html/gen_html.cpp head/sys/contrib/zstd/contrib/largeNbDicts/Makefile head/sys/contrib/zstd/contrib/largeNbDicts/README.md head/sys/contrib/zstd/contrib/largeNbDicts/largeNbDicts.c head/sys/contrib/zstd/contrib/premake/premake4.lua head/sys/contrib/zstd/contrib/premake/zstd.lua head/sys/contrib/zstd/contrib/pzstd/BUCK head/sys/contrib/zstd/contrib/pzstd/ErrorHolder.h head/sys/contrib/zstd/contrib/pzstd/Logging.h head/sys/contrib/zstd/contrib/pzstd/Makefile head/sys/contrib/zstd/contrib/pzstd/Options.cpp head/sys/contrib/zstd/contrib/pzstd/Options.h head/sys/contrib/zstd/contrib/pzstd/Pzstd.cpp head/sys/contrib/zstd/contrib/pzstd/Pzstd.h head/sys/contrib/zstd/contrib/pzstd/README.md head/sys/contrib/zstd/contrib/pzstd/SkippableFrame.cpp head/sys/contrib/zstd/contrib/pzstd/SkippableFrame.h head/sys/contrib/zstd/contrib/pzstd/images/Cspeed.png head/sys/contrib/zstd/contrib/pzstd/images/Dspeed.png head/sys/contrib/zstd/contrib/pzstd/main.cpp head/sys/contrib/zstd/contrib/pzstd/test/BUCK head/sys/contrib/zstd/contrib/pzstd/test/OptionsTest.cpp head/sys/contrib/zstd/contrib/pzstd/test/PzstdTest.cpp head/sys/contrib/zstd/contrib/pzstd/test/RoundTrip.h head/sys/contrib/zstd/contrib/pzstd/test/RoundTripTest.cpp head/sys/contrib/zstd/contrib/pzstd/utils/BUCK head/sys/contrib/zstd/contrib/pzstd/utils/Buffer.h head/sys/contrib/zstd/contrib/pzstd/utils/FileSystem.h head/sys/contrib/zstd/contrib/pzstd/utils/Likely.h head/sys/contrib/zstd/contrib/pzstd/utils/Range.h head/sys/contrib/zstd/contrib/pzstd/utils/ResourcePool.h head/sys/contrib/zstd/contrib/pzstd/utils/ScopeGuard.h head/sys/contrib/zstd/contrib/pzstd/utils/ThreadPool.h head/sys/contrib/zstd/contrib/pzstd/utils/WorkQueue.h head/sys/contrib/zstd/contrib/pzstd/utils/test/BUCK head/sys/contrib/zstd/contrib/pzstd/utils/test/BufferTest.cpp
svn commit: r361425 - head/sys/contrib/zstd
Author: cem Date: Sat May 23 20:39:36 2020 New Revision: 361425 URL: https://svnweb.freebsd.org/changeset/base/361425 Log: contrib/zstd: Revise Xlist for 1.4.5 import Modified: head/sys/contrib/zstd/FREEBSD-Xlist Modified: head/sys/contrib/zstd/FREEBSD-Xlist == --- head/sys/contrib/zstd/FREEBSD-Xlist Sat May 23 20:38:30 2020 (r361424) +++ head/sys/contrib/zstd/FREEBSD-Xlist Sat May 23 20:39:36 2020 (r361425) @@ -2,11 +2,11 @@ $FreeBSD$ .circleci .cirrus.yml +.github .gitignore .travis.yml build -contrib/linux-kernel -contrib/single_file_decoder -contrib/VS2005 +contrib lib/dll programs/windres +tests ___ 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: r361424 - in vendor/zstd/1.4.5: . contrib contrib/docker contrib/experimental_dict_builders/benchmarkDictBuilder contrib/experimental_dict_builders/fastCover contrib/experimental_dict_b...
Author: cem Date: Sat May 23 20:38:30 2020 New Revision: 361424 URL: https://svnweb.freebsd.org/changeset/base/361424 Log: Tag Zstd 1.4.5 Added: vendor/zstd/1.4.5/ - copied from r361422, vendor/zstd/dist/ vendor/zstd/1.4.5/lib/compress/zstd_compress_superblock.c - copied unchanged from r361423, vendor/zstd/dist/lib/compress/zstd_compress_superblock.c vendor/zstd/1.4.5/lib/compress/zstd_compress_superblock.h - copied unchanged from r361423, vendor/zstd/dist/lib/compress/zstd_compress_superblock.h Replaced: vendor/zstd/1.4.5/CHANGELOG - copied unchanged from r361423, vendor/zstd/dist/CHANGELOG vendor/zstd/1.4.5/CONTRIBUTING.md - copied unchanged from r361423, vendor/zstd/dist/CONTRIBUTING.md vendor/zstd/1.4.5/Makefile - copied unchanged from r361423, vendor/zstd/dist/Makefile vendor/zstd/1.4.5/README.md - copied unchanged from r361423, vendor/zstd/dist/README.md vendor/zstd/1.4.5/TESTING.md - copied unchanged from r361423, vendor/zstd/dist/TESTING.md vendor/zstd/1.4.5/appveyor.yml - copied unchanged from r361423, vendor/zstd/dist/appveyor.yml vendor/zstd/1.4.5/doc/educational_decoder/Makefile - copied unchanged from r361423, vendor/zstd/dist/doc/educational_decoder/Makefile vendor/zstd/1.4.5/doc/educational_decoder/README.md - copied unchanged from r361423, vendor/zstd/dist/doc/educational_decoder/README.md vendor/zstd/1.4.5/doc/educational_decoder/harness.c - copied unchanged from r361423, vendor/zstd/dist/doc/educational_decoder/harness.c vendor/zstd/1.4.5/doc/educational_decoder/zstd_decompress.c - copied unchanged from r361423, vendor/zstd/dist/doc/educational_decoder/zstd_decompress.c vendor/zstd/1.4.5/doc/educational_decoder/zstd_decompress.h - copied unchanged from r361423, vendor/zstd/dist/doc/educational_decoder/zstd_decompress.h vendor/zstd/1.4.5/doc/zstd_compression_format.md - copied unchanged from r361423, vendor/zstd/dist/doc/zstd_compression_format.md vendor/zstd/1.4.5/doc/zstd_manual.html - copied unchanged from r361423, vendor/zstd/dist/doc/zstd_manual.html vendor/zstd/1.4.5/examples/Makefile - copied unchanged from r361423, vendor/zstd/dist/examples/Makefile vendor/zstd/1.4.5/examples/common.h - copied unchanged from r361423, vendor/zstd/dist/examples/common.h vendor/zstd/1.4.5/examples/dictionary_compression.c - copied unchanged from r361423, vendor/zstd/dist/examples/dictionary_compression.c vendor/zstd/1.4.5/examples/dictionary_decompression.c - copied unchanged from r361423, vendor/zstd/dist/examples/dictionary_decompression.c vendor/zstd/1.4.5/examples/multiple_simple_compression.c - copied unchanged from r361423, vendor/zstd/dist/examples/multiple_simple_compression.c vendor/zstd/1.4.5/examples/multiple_streaming_compression.c - copied unchanged from r361423, vendor/zstd/dist/examples/multiple_streaming_compression.c vendor/zstd/1.4.5/examples/simple_compression.c - copied unchanged from r361423, vendor/zstd/dist/examples/simple_compression.c vendor/zstd/1.4.5/examples/simple_decompression.c - copied unchanged from r361423, vendor/zstd/dist/examples/simple_decompression.c vendor/zstd/1.4.5/examples/streaming_compression.c - copied unchanged from r361423, vendor/zstd/dist/examples/streaming_compression.c vendor/zstd/1.4.5/examples/streaming_decompression.c - copied unchanged from r361423, vendor/zstd/dist/examples/streaming_decompression.c vendor/zstd/1.4.5/examples/streaming_memory_usage.c - copied unchanged from r361423, vendor/zstd/dist/examples/streaming_memory_usage.c vendor/zstd/1.4.5/lib/Makefile - copied unchanged from r361423, vendor/zstd/dist/lib/Makefile vendor/zstd/1.4.5/lib/README.md - copied unchanged from r361423, vendor/zstd/dist/lib/README.md vendor/zstd/1.4.5/lib/common/bitstream.h - copied unchanged from r361423, vendor/zstd/dist/lib/common/bitstream.h vendor/zstd/1.4.5/lib/common/compiler.h - copied unchanged from r361423, vendor/zstd/dist/lib/common/compiler.h vendor/zstd/1.4.5/lib/common/cpu.h - copied unchanged from r361423, vendor/zstd/dist/lib/common/cpu.h vendor/zstd/1.4.5/lib/common/debug.c - copied unchanged from r361423, vendor/zstd/dist/lib/common/debug.c vendor/zstd/1.4.5/lib/common/debug.h - copied unchanged from r361423, vendor/zstd/dist/lib/common/debug.h vendor/zstd/1.4.5/lib/common/entropy_common.c - copied unchanged from r361423, vendor/zstd/dist/lib/common/entropy_common.c vendor/zstd/1.4.5/lib/common/error_private.c - copied unchanged from r361423, vendor/zstd/dist/lib/common/error_private.c vendor/zstd/1.4.5/lib/common/error_private.h - copied unchanged from r361423, vendor/zstd/dist/lib/common/error_private.h vendor/zstd/1.4.5/lib/common/fse.h - copied unchanged from r361423, vendor/zstd/dist/lib/common/fse.h vendor/zstd/1.4.5/lib/common/fse_decompress.c
svn commit: r361423 - in vendor/zstd/dist: . contrib contrib/docker contrib/experimental_dict_builders/benchmarkDictBuilder contrib/experimental_dict_builders/fastCover contrib/experimental_dict_bu...
Author: cem Date: Sat May 23 20:37:33 2020 New Revision: 361423 URL: https://svnweb.freebsd.org/changeset/base/361423 Log: Import Zstd 1.4.5 Added: vendor/zstd/dist/lib/compress/zstd_compress_superblock.c (contents, props changed) vendor/zstd/dist/lib/compress/zstd_compress_superblock.h (contents, props changed) Deleted: vendor/zstd/dist/contrib/cleanTabs vendor/zstd/dist/contrib/docker/Dockerfile vendor/zstd/dist/contrib/docker/README.md vendor/zstd/dist/contrib/experimental_dict_builders/benchmarkDictBuilder/Makefile vendor/zstd/dist/contrib/experimental_dict_builders/benchmarkDictBuilder/README.md vendor/zstd/dist/contrib/experimental_dict_builders/benchmarkDictBuilder/benchmark.c vendor/zstd/dist/contrib/experimental_dict_builders/benchmarkDictBuilder/dictBuilder.h vendor/zstd/dist/contrib/experimental_dict_builders/benchmarkDictBuilder/test.sh vendor/zstd/dist/contrib/experimental_dict_builders/fastCover/Makefile vendor/zstd/dist/contrib/experimental_dict_builders/fastCover/README.md vendor/zstd/dist/contrib/experimental_dict_builders/fastCover/fastCover.c vendor/zstd/dist/contrib/experimental_dict_builders/fastCover/fastCover.h vendor/zstd/dist/contrib/experimental_dict_builders/fastCover/main.c vendor/zstd/dist/contrib/experimental_dict_builders/fastCover/test.sh vendor/zstd/dist/contrib/experimental_dict_builders/randomDictBuilder/Makefile vendor/zstd/dist/contrib/experimental_dict_builders/randomDictBuilder/README.md vendor/zstd/dist/contrib/experimental_dict_builders/randomDictBuilder/io.c vendor/zstd/dist/contrib/experimental_dict_builders/randomDictBuilder/io.h vendor/zstd/dist/contrib/experimental_dict_builders/randomDictBuilder/main.c vendor/zstd/dist/contrib/experimental_dict_builders/randomDictBuilder/random.c vendor/zstd/dist/contrib/experimental_dict_builders/randomDictBuilder/random.h vendor/zstd/dist/contrib/experimental_dict_builders/randomDictBuilder/test.sh vendor/zstd/dist/contrib/gen_html/Makefile vendor/zstd/dist/contrib/gen_html/README.md vendor/zstd/dist/contrib/gen_html/gen-zstd-manual.sh vendor/zstd/dist/contrib/gen_html/gen_html.cpp vendor/zstd/dist/contrib/largeNbDicts/Makefile vendor/zstd/dist/contrib/largeNbDicts/README.md vendor/zstd/dist/contrib/largeNbDicts/largeNbDicts.c vendor/zstd/dist/contrib/premake/premake4.lua vendor/zstd/dist/contrib/premake/zstd.lua vendor/zstd/dist/contrib/pzstd/BUCK vendor/zstd/dist/contrib/pzstd/ErrorHolder.h vendor/zstd/dist/contrib/pzstd/Logging.h vendor/zstd/dist/contrib/pzstd/Makefile vendor/zstd/dist/contrib/pzstd/Options.cpp vendor/zstd/dist/contrib/pzstd/Options.h vendor/zstd/dist/contrib/pzstd/Pzstd.cpp vendor/zstd/dist/contrib/pzstd/Pzstd.h vendor/zstd/dist/contrib/pzstd/README.md vendor/zstd/dist/contrib/pzstd/SkippableFrame.cpp vendor/zstd/dist/contrib/pzstd/SkippableFrame.h vendor/zstd/dist/contrib/pzstd/images/Cspeed.png vendor/zstd/dist/contrib/pzstd/images/Dspeed.png vendor/zstd/dist/contrib/pzstd/main.cpp vendor/zstd/dist/contrib/pzstd/test/BUCK vendor/zstd/dist/contrib/pzstd/test/OptionsTest.cpp vendor/zstd/dist/contrib/pzstd/test/PzstdTest.cpp vendor/zstd/dist/contrib/pzstd/test/RoundTrip.h vendor/zstd/dist/contrib/pzstd/test/RoundTripTest.cpp vendor/zstd/dist/contrib/pzstd/utils/BUCK vendor/zstd/dist/contrib/pzstd/utils/Buffer.h vendor/zstd/dist/contrib/pzstd/utils/FileSystem.h vendor/zstd/dist/contrib/pzstd/utils/Likely.h vendor/zstd/dist/contrib/pzstd/utils/Range.h vendor/zstd/dist/contrib/pzstd/utils/ResourcePool.h vendor/zstd/dist/contrib/pzstd/utils/ScopeGuard.h vendor/zstd/dist/contrib/pzstd/utils/ThreadPool.h vendor/zstd/dist/contrib/pzstd/utils/WorkQueue.h vendor/zstd/dist/contrib/pzstd/utils/test/BUCK vendor/zstd/dist/contrib/pzstd/utils/test/BufferTest.cpp vendor/zstd/dist/contrib/pzstd/utils/test/RangeTest.cpp vendor/zstd/dist/contrib/pzstd/utils/test/ResourcePoolTest.cpp vendor/zstd/dist/contrib/pzstd/utils/test/ScopeGuardTest.cpp vendor/zstd/dist/contrib/pzstd/utils/test/ThreadPoolTest.cpp vendor/zstd/dist/contrib/pzstd/utils/test/WorkQueueTest.cpp vendor/zstd/dist/contrib/seekable_format/examples/Makefile vendor/zstd/dist/contrib/seekable_format/examples/parallel_compression.c vendor/zstd/dist/contrib/seekable_format/examples/parallel_processing.c vendor/zstd/dist/contrib/seekable_format/examples/seekable_compression.c vendor/zstd/dist/contrib/seekable_format/examples/seekable_decompression.c vendor/zstd/dist/contrib/seekable_format/examples/seekable_decompression_mem.c vendor/zstd/dist/contrib/seekable_format/zstd_seekable.h vendor/zstd/dist/contrib/seekable_format/zstd_seekable_compression_format.md vendor/zstd/dist/contrib/seekable_format/zstdseek_compress.c vendor/zstd/dist/contrib/seekable_format/zstdseek_decompress.c vendor/zstd/dist/contrib/snap/snapcraft.yaml vendor/zstd/dist/tests/Makefile vendor/zstd/dist/tests/README.md