svn commit: r362363 - head/sys/vm
Author: markj Date: Fri Jun 19 04:18:20 2020 New Revision: 362363 URL: https://svnweb.freebsd.org/changeset/base/362363 Log: Restore a check unintentionally dropped in r362361. MFC with: r362361 Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c == --- head/sys/vm/vm_map.cFri Jun 19 04:09:35 2020(r362362) +++ head/sys/vm/vm_map.cFri Jun 19 04:18:20 2020(r362363) @@ -1616,7 +1616,7 @@ vm_map_insert(vm_map_t map, vm_object_t object, vm_oof /* * Check that the start and end points are not bogus. */ - if (!vm_map_range_valid(map, start, end)) + if (start == end || !vm_map_range_valid(map, start, end)) return (KERN_INVALID_ADDRESS); /* ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362362 - head/share/man/man4
Author: imp Date: Fri Jun 19 04:09:35 2020 New Revision: 362362 URL: https://svnweb.freebsd.org/changeset/base/362362 Log: The actual name for MMCCAM sd block devices is sdda. Pointed out by: kibab@ Modified: head/share/man/man4/scsi.4 Modified: head/share/man/man4/scsi.4 == --- head/share/man/man4/scsi.4 Fri Jun 19 03:32:04 2020(r362361) +++ head/share/man/man4/scsi.4 Fri Jun 19 04:09:35 2020(r362362) @@ -24,7 +24,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd June 6, 2020 +.Dd June 18, 2020 .Dt CAM 4 .Os .Sh NAME @@ -330,7 +330,7 @@ SCSI or SAS device, or devices that accept SCSI CDBs f ATA or SATA device .It Xr nda 4 NVME device -.It Xr mda 4 +.It Xr sdda 4 An SD or MMC block storage device. .El .Pp @@ -441,7 +441,7 @@ for details. .Xr ada 4 , .Xr da 4 , .Xr nda 4 , -.\" .Xr mda 4 , +.\" .Xr sdda 4 , .Xr pass 4 , .Xr sa 4 .Pp ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362361 - in head/sys: compat/linuxkpi/common/src vm
Author: markj Date: Fri Jun 19 03:32:04 2020 New Revision: 362361 URL: https://svnweb.freebsd.org/changeset/base/362361 Log: Add a helper function for validating VA ranges. Functions which take untrusted user ranges must validate against the bounds of the map, and also check for wraparound. Instead of having the same logic duplicated in a number of places, add a function to check. Reviewed by: dougm, kib Sponsored by: The FreeBSD Foundation MFC after:1 week Differential Revision:https://reviews.freebsd.org/D25328 Modified: head/sys/compat/linuxkpi/common/src/linux_page.c head/sys/vm/vm_fault.c head/sys/vm/vm_map.c head/sys/vm/vm_map.h head/sys/vm/vm_mmap.c Modified: head/sys/compat/linuxkpi/common/src/linux_page.c == --- head/sys/compat/linuxkpi/common/src/linux_page.cFri Jun 19 03:31:46 2020(r362360) +++ head/sys/compat/linuxkpi/common/src/linux_page.cFri Jun 19 03:32:04 2020(r362361) @@ -222,7 +222,7 @@ __get_user_pages_fast(unsigned long start, int nr_page va = start; map = >td_proc->p_vmspace->vm_map; end = start + (((size_t)nr_pages) << PAGE_SHIFT); - if (start < vm_map_min(map) || end > vm_map_max(map)) + if (!vm_map_range_valid(map, start, end)) return (-EINVAL); prot = write ? (VM_PROT_READ | VM_PROT_WRITE) : VM_PROT_READ; for (count = 0, mp = pages, va = start; va < end; Modified: head/sys/vm/vm_fault.c == --- head/sys/vm/vm_fault.c Fri Jun 19 03:31:46 2020(r362360) +++ head/sys/vm/vm_fault.c Fri Jun 19 03:32:04 2020(r362361) @@ -1713,10 +1713,7 @@ vm_fault_quick_hold_pages(vm_map_t map, vm_offset_t ad end = round_page(addr + len); addr = trunc_page(addr); - /* -* Check for illegal addresses. -*/ - if (addr < vm_map_min(map) || addr > end || end > vm_map_max(map)) + if (!vm_map_range_valid(map, addr, end)) return (-1); if (atop(end - addr) > max_count) Modified: head/sys/vm/vm_map.c == --- head/sys/vm/vm_map.cFri Jun 19 03:31:46 2020(r362360) +++ head/sys/vm/vm_map.cFri Jun 19 03:32:04 2020(r362361) @@ -1616,8 +1616,7 @@ vm_map_insert(vm_map_t map, vm_object_t object, vm_oof /* * Check that the start and end points are not bogus. */ - if (start < vm_map_min(map) || end > vm_map_max(map) || - start >= end) + if (!vm_map_range_valid(map, start, end)) return (KERN_INVALID_ADDRESS); /* @@ -2161,9 +2160,7 @@ again: goto done; } } else if ((cow & MAP_REMAP) != 0) { - if (*addr < vm_map_min(map) || - *addr + length > vm_map_max(map) || - *addr + length <= length) { + if (!vm_map_range_valid(map, *addr, *addr + length)) { rv = KERN_INVALID_ADDRESS; goto done; } @@ -4324,9 +4321,8 @@ vm_map_stack_locked(vm_map_t map, vm_offset_t addrbos, KASSERT(orient != (MAP_STACK_GROWS_DOWN | MAP_STACK_GROWS_UP), ("bi-dir stack")); - if (addrbos < vm_map_min(map) || - addrbos + max_ssize > vm_map_max(map) || - addrbos + max_ssize <= addrbos) + if (max_ssize == 0 || + !vm_map_range_valid(map, addrbos, addrbos + max_ssize)) return (KERN_INVALID_ADDRESS); sgp = ((curproc->p_flag2 & P2_STKGAP_DISABLE) != 0 || (curproc->p_fctl0 & NT_FREEBSD_FCTL_STKGAP_DISABLE) != 0) ? 0 : Modified: head/sys/vm/vm_map.h == --- head/sys/vm/vm_map.hFri Jun 19 03:31:46 2020(r362360) +++ head/sys/vm/vm_map.hFri Jun 19 03:32:04 2020(r362361) @@ -255,6 +255,17 @@ vm_map_modflags(vm_map_t map, vm_flags_t set, vm_flags { map->flags = (map->flags | set) & ~clear; } + +static inline bool +vm_map_range_valid(vm_map_t map, vm_offset_t start, vm_offset_t end) +{ + if (end < start) + return (false); + if (start < vm_map_min(map) || end > vm_map_max(map)) + return (false); + return (true); +} + #endif /* KLD_MODULE */ #endif /* _KERNEL */ Modified: head/sys/vm/vm_mmap.c == --- head/sys/vm/vm_mmap.c Fri Jun 19 03:31:46 2020(r362360) +++ head/sys/vm/vm_mmap.c Fri Jun 19 03:32:04 2020(r362361) @@ -342,11 +342,8 @@ kern_mmap_req(struct thread *td, const struct mmap_req return (EINVAL); /* Address range must
svn commit: r362360 - head/sys/vm
Author: markj Date: Fri Jun 19 03:31:46 2020 New Revision: 362360 URL: https://svnweb.freebsd.org/changeset/base/362360 Log: Fix a double object unlock in vm_object_backing_collapse_wait(). Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D25327 Modified: head/sys/vm/vm_object.c Modified: head/sys/vm/vm_object.c == --- head/sys/vm/vm_object.c Fri Jun 19 01:04:25 2020(r362359) +++ head/sys/vm/vm_object.c Fri Jun 19 03:31:46 2020(r362360) @@ -864,7 +864,6 @@ vm_object_backing_collapse_wait(vm_object_t object) VM_OBJECT_WLOCK(backing_object); if ((backing_object->flags & (OBJ_DEAD | OBJ_COLLAPSING)) == 0) break; - VM_OBJECT_WUNLOCK(object); vm_object_pip_sleep(backing_object, "vmbckwait"); counter_u64_add(object_collapse_waits, 1); VM_OBJECT_WLOCK(object); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362359 - head/sys/ufs/ffs
Author: mckusick Date: Fri Jun 19 01:04:25 2020 New Revision: 362359 URL: https://svnweb.freebsd.org/changeset/base/362359 Log: The binary representation of the superblock (the fs structure) is written out verbatim to the disk: see ffs_sbput() in sys/ufs/ffs/ffs_subr.c. It contains a pointer to the fs_summary_info structure. This pointer value inadvertently causes garbage to be stored. It is garbage because the pointer to the fs_summary_info structure is the address the then current stack or heap. Although a mere pointer does not reveal anything useful (like a part of a private key) to an attacker, garbage output deteriorates reproducibility. This commit zeros out the pointer to the fs_summary_info structure before writing the out the superblock. Reviewed by: kib Tested by:Peter Holm PR: 246983 Sponsored by: Netflix Modified: head/sys/ufs/ffs/ffs_subr.c head/sys/ufs/ffs/ffs_vfsops.c Modified: head/sys/ufs/ffs/ffs_subr.c == --- head/sys/ufs/ffs/ffs_subr.c Fri Jun 19 01:02:53 2020(r362358) +++ head/sys/ufs/ffs/ffs_subr.c Fri Jun 19 01:04:25 2020(r362359) @@ -50,7 +50,6 @@ uint32_t ffs_calc_sbhash(struct fs *); struct malloc_type; #define UFS_MALLOC(size, type, flags) malloc(size) #define UFS_FREE(ptr, type) free(ptr) -#define UFS_TIME time(NULL) /* * Request standard superblock location in ffs_sbget */ @@ -78,7 +77,6 @@ struct malloc_type; #define UFS_MALLOC(size, type, flags) malloc(size, type, flags) #define UFS_FREE(ptr, type) free(ptr, type) -#define UFS_TIME time_second #endif /* _KERNEL */ @@ -349,11 +347,24 @@ ffs_sbput(void *devfd, struct fs *fs, off_t loc, } } fs->fs_fmod = 0; - fs->fs_time = UFS_TIME; +#ifndef _KERNEL + { + struct fs_summary_info *fs_si; + + fs->fs_time = time(NULL); + /* Clear the pointers for the duration of writing. */ + fs_si = fs->fs_si; + fs->fs_si = NULL; + fs->fs_ckhash = ffs_calc_sbhash(fs); + error = (*writefunc)(devfd, loc, fs, fs->fs_sbsize); + fs->fs_si = fs_si; + } +#else /* _KERNEL */ + fs->fs_time = time_second; fs->fs_ckhash = ffs_calc_sbhash(fs); - if ((error = (*writefunc)(devfd, loc, fs, fs->fs_sbsize)) != 0) - return (error); - return (0); + error = (*writefunc)(devfd, loc, fs, fs->fs_sbsize); +#endif /* _KERNEL */ + return (error); } /* Modified: head/sys/ufs/ffs/ffs_vfsops.c == --- head/sys/ufs/ffs/ffs_vfsops.c Fri Jun 19 01:02:53 2020 (r362358) +++ head/sys/ufs/ffs/ffs_vfsops.c Fri Jun 19 01:04:25 2020 (r362359) @@ -2293,6 +2293,7 @@ ffs_use_bwrite(void *devfd, off_t loc, void *buf, int bcopy((caddr_t)fs, bp->b_data, (u_int)fs->fs_sbsize); fs = (struct fs *)bp->b_data; ffs_oldfscompat_write(fs, ump); + fs->fs_si = NULL; /* Recalculate the superblock hash */ fs->fs_ckhash = ffs_calc_sbhash(fs); if (devfdp->suspended) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362358 - in head: sbin/newfs stand/libsa sys/geom/journal sys/geom/label sys/ufs/ffs usr.sbin/fstyp usr.sbin/quot
Author: mckusick Date: Fri Jun 19 01:02:53 2020 New Revision: 362358 URL: https://svnweb.freebsd.org/changeset/base/362358 Log: Move the pointers stored in the superblock into a separate fs_summary_info structure. This change was originally done by the CheriBSD project as they need larger pointers that do not fit in the existing superblock. This cleanup of the superblock eases the task of the commit that immediately follows this one. Suggested by: brooks Reviewed by: kib PR: 246983 Sponsored by: Netflix Modified: head/sbin/newfs/mkfs.c head/stand/libsa/ufs.c head/sys/geom/journal/g_journal_ufs.c head/sys/geom/label/g_label_ufs.c head/sys/ufs/ffs/ffs_snapshot.c head/sys/ufs/ffs/ffs_subr.c head/sys/ufs/ffs/ffs_vfsops.c head/sys/ufs/ffs/fs.h head/usr.sbin/fstyp/ufs.c head/usr.sbin/quot/quot.c Modified: head/sbin/newfs/mkfs.c == --- head/sbin/newfs/mkfs.c Fri Jun 19 00:45:29 2020(r362357) +++ head/sbin/newfs/mkfs.c Fri Jun 19 01:02:53 2020(r362358) @@ -134,6 +134,10 @@ mkfs(struct partition *pp, char *fsys) utime = 10; else time(); + if ((sblock.fs_si = malloc(sizeof(struct fs_summary_info))) == NULL) { + printf("Superblock summary info allocation failed.\n"); + exit(18); + } sblock.fs_old_flags = FS_FLAGS_UPDATED; sblock.fs_flags = 0; if (Uflag) @@ -548,6 +552,10 @@ restart: } } } + /* +* Reference the summary information so it will also be written. +*/ + sblock.fs_csp = fscs; if (!Nflag && sbput(disk.d_fd, _fs, 0) != 0) err(1, "sbput: %s", disk.d_error); if (Xflag == 1) { @@ -611,10 +619,6 @@ restart: printf("** Exiting on Xflag 3\n"); exit(0); } - /* -* Reference the summary information so it will also be written. -*/ - sblock.fs_csp = fscs; if (sbput(disk.d_fd, _fs, 0) != 0) err(1, "sbput: %s", disk.d_error); /* Modified: head/stand/libsa/ufs.c == --- head/stand/libsa/ufs.c Fri Jun 19 00:45:29 2020(r362357) +++ head/stand/libsa/ufs.c Fri Jun 19 01:02:53 2020(r362358) @@ -678,7 +678,11 @@ out: if (rc) { if (fp->f_buf) free(fp->f_buf); - free(fp->f_fs); + if (fp->f_fs != NULL) { + free(fp->f_fs->fs_csp); + free(fp->f_fs->fs_si); + free(fp->f_fs); + } free(fp); } return (rc); @@ -723,7 +727,11 @@ ufs_close(f) } if (fp->f_buf) free(fp->f_buf); - free(fp->f_fs); + if (fp->f_fs != NULL) { + free(fp->f_fs->fs_csp); + free(fp->f_fs->fs_si); + free(fp->f_fs); + } free(fp); return (0); } Modified: head/sys/geom/journal/g_journal_ufs.c == --- head/sys/geom/journal/g_journal_ufs.c Fri Jun 19 00:45:29 2020 (r362357) +++ head/sys/geom/journal/g_journal_ufs.c Fri Jun 19 01:02:53 2020 (r362358) @@ -68,6 +68,7 @@ g_journal_ufs_clean(struct mount *mp) static void g_journal_ufs_dirty(struct g_consumer *cp) { + struct fs_summary_info *fs_si; struct fs *fs; int error; @@ -83,8 +84,12 @@ g_journal_ufs_dirty(struct g_consumer *cp) GJ_DEBUG(0, "clean=%d flags=0x%x", fs->fs_clean, fs->fs_flags); fs->fs_clean = 0; fs->fs_flags |= FS_NEEDSFSCK | FS_UNCLEAN; + fs_si = fs->fs_si; + fs->fs_si = NULL; error = ffs_sbput(cp, fs, fs->fs_sblockloc, g_use_g_write_data); + fs->fs_si = fs_si; g_free(fs->fs_csp); + g_free(fs->fs_si); g_free(fs); if (error != 0) { GJ_DEBUG(0, "Cannot mark file system %s as dirty " Modified: head/sys/geom/label/g_label_ufs.c == --- head/sys/geom/label/g_label_ufs.c Fri Jun 19 00:45:29 2020 (r362357) +++ head/sys/geom/label/g_label_ufs.c Fri Jun 19 01:02:53 2020 (r362358) @@ -122,6 +122,7 @@ g_label_ufs_taste_common(struct g_consumer *cp, char * } out: g_free(fs->fs_csp); + g_free(fs->fs_si); g_free(fs); } Modified: head/sys/ufs/ffs/ffs_snapshot.c == --- head/sys/ufs/ffs/ffs_snapshot.c Fri Jun 19 00:45:29 2020 (r362357) +++ head/sys/ufs/ffs/ffs_snapshot.c Fri Jun 19 01:02:53 2020 (r362358) @@
svn commit: r362353 - in head/sys: arm64/broadcom/genet dev/mii
Author: karels Date: Thu Jun 18 23:57:10 2020 New Revision: 362353 URL: https://svnweb.freebsd.org/changeset/base/362353 Log: Add support for bcm54213PE in brgphy. This chip is used in the Rasperry Pi 4, and is supported by the if_genet driver. Currently we use the ukphy mii driver, this patch switches over to the brgphy mii driver instead. To support the rgmii-rxid phy mode, which is now the default in the Linux dtb, we add support for clock skewing. These changes are taken from OpenBSD and NetBSD, except for the bailout in brgphy_bcm54xx_clock_delay() in rgmii mode, which was found necessary after testing. Submitted by: Robert Crowston, crowston at protomail.com Differential Revision:https://reviews.freebsd.org/D25251 Modified: head/sys/arm64/broadcom/genet/if_genet.c head/sys/dev/mii/brgphy.c head/sys/dev/mii/brgphyreg.h head/sys/dev/mii/miidevs head/sys/dev/mii/miivar.h Modified: head/sys/arm64/broadcom/genet/if_genet.c == --- head/sys/arm64/broadcom/genet/if_genet.cThu Jun 18 23:31:56 2020 (r362352) +++ head/sys/arm64/broadcom/genet/if_genet.cThu Jun 18 23:57:10 2020 (r362353) @@ -237,7 +237,7 @@ gen_attach(device_t dev) { struct ether_addr eaddr; struct gen_softc *sc; - int major, minor, error; + int major, minor, error, mii_flags; bool eaddr_found; sc = device_get_softc(dev); @@ -315,9 +315,24 @@ gen_attach(device_t dev) if_setcapenable(sc->ifp, if_getcapabilities(sc->ifp)); /* Attach MII driver */ + mii_flags = 0; + switch (sc->phy_mode) + { + case MII_CONTYPE_RGMII_ID: + mii_flags |= MIIF_RX_DELAY | MIIF_TX_DELAY; + break; + case MII_CONTYPE_RGMII_RXID: + mii_flags |= MIIF_RX_DELAY; + break; + case MII_CONTYPE_RGMII_TXID: + mii_flags |= MIIF_TX_DELAY; + break; + default: + break; + } error = mii_attach(dev, >miibus, sc->ifp, gen_media_change, gen_media_status, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, - MIIF_DOPAUSE); + mii_flags); if (error != 0) { device_printf(dev, "cannot attach PHY\n"); goto fail; @@ -371,6 +386,7 @@ gen_get_phy_mode(device_t dev) switch (type) { case MII_CONTYPE_RGMII: + case MII_CONTYPE_RGMII_ID: case MII_CONTYPE_RGMII_RXID: case MII_CONTYPE_RGMII_TXID: sc->phy_mode = type; @@ -791,10 +807,17 @@ gen_init_locked(struct gen_softc *sc) if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) return; - if (sc->phy_mode == MII_CONTYPE_RGMII || - sc->phy_mode == MII_CONTYPE_RGMII_RXID) - WR4(sc, GENET_SYS_PORT_CTRL, - GENET_SYS_PORT_MODE_EXT_GPHY); + switch (sc->phy_mode) + { + case MII_CONTYPE_RGMII: + case MII_CONTYPE_RGMII_ID: + case MII_CONTYPE_RGMII_RXID: + case MII_CONTYPE_RGMII_TXID: + WR4(sc, GENET_SYS_PORT_CTRL, GENET_SYS_PORT_MODE_EXT_GPHY); + break; + default: + WR4(sc, GENET_SYS_PORT_CTRL, 0); + } gen_set_enaddr(sc); @@ -1649,6 +1672,8 @@ gen_update_link_locked(struct gen_softc *sc) val |= GENET_EXT_RGMII_OOB_RGMII_MODE_EN; if (sc->phy_mode == MII_CONTYPE_RGMII) val |= GENET_EXT_RGMII_OOB_ID_MODE_DISABLE; + else + val &= ~GENET_EXT_RGMII_OOB_ID_MODE_DISABLE; WR4(sc, GENET_EXT_RGMII_OOB_CTRL, val); val = RD4(sc, GENET_UMAC_CMD); Modified: head/sys/dev/mii/brgphy.c == --- head/sys/dev/mii/brgphy.c Thu Jun 18 23:31:56 2020(r362352) +++ head/sys/dev/mii/brgphy.c Thu Jun 18 23:57:10 2020(r362353) @@ -115,6 +115,7 @@ static void brgphy_fixup_ber_bug(struct mii_softc *); static voidbrgphy_fixup_crc_bug(struct mii_softc *); static voidbrgphy_fixup_jitter_bug(struct mii_softc *); static voidbrgphy_ethernet_wirespeed(struct mii_softc *); +static voidbrgphy_bcm54xx_clock_delay(struct mii_softc *); static voidbrgphy_jumbo_settings(struct mii_softc *, u_long); static const struct mii_phydesc brgphys[] = { @@ -158,6 +159,7 @@ static const struct mii_phydesc brgphys[] = { MII_PHY_DESC(BROADCOM3, BCM5720C), MII_PHY_DESC(BROADCOM3, BCM57765), MII_PHY_DESC(BROADCOM3, BCM57780), + MII_PHY_DESC(BROADCOM4, BCM54213PE), MII_PHY_DESC(BROADCOM4, BCM5725C), MII_PHY_DESC(xxBROADCOM_ALT1, BCM5906), MII_PHY_END @@ -414,6 +416,12 @@ brgphy_service(struct mii_softc *sc, struct mii_data * break; } break; +
svn commit: r362348 - head/sbin/umount
Author: 0mp (doc,ports committer) Date: Thu Jun 18 23:12:55 2020 New Revision: 362348 URL: https://svnweb.freebsd.org/changeset/base/362348 Log: Document that umount -A does not unmount /dev Reported by: kaktus Reviewed by: kaktus MFC after:1 week Differential Revision:https://reviews.freebsd.org/D25351 Modified: head/sbin/umount/umount.8 Modified: head/sbin/umount/umount.8 == --- head/sbin/umount/umount.8 Thu Jun 18 23:07:58 2020(r362347) +++ head/sbin/umount/umount.8 Thu Jun 18 23:12:55 2020(r362348) @@ -28,7 +28,7 @@ .\" @(#)umount.8 8.2 (Berkeley) 5/8/95 .\" $FreeBSD$ .\" -.Dd April 14, 2020 +.Dd June 19, 2020 .Dt UMOUNT 8 .Os .Sh NAME @@ -69,8 +69,11 @@ All the file systems described in .Xr fstab 5 are unmounted. .It Fl A -All the currently mounted file systems except -the root are unmounted. +All the currently mounted file systems are unmounted, +except for those mounted at +.Pa / +or +.Pa /dev . .It Fl F Ar fstab Specify the .Pa fstab ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362347 - head/libexec/rtld-elf
Author: kib Date: Thu Jun 18 23:07:58 2020 New Revision: 362347 URL: https://svnweb.freebsd.org/changeset/base/362347 Log: rtld: Apply relro to itself. Reviewed by: emaste Sponsored by: The FreeBSD Foundation MFC after:1 week Differential revision:https://reviews.freebsd.org/D25319 Modified: head/libexec/rtld-elf/rtld.c Modified: head/libexec/rtld-elf/rtld.c == --- head/libexec/rtld-elf/rtld.cThu Jun 18 23:06:05 2020 (r362346) +++ head/libexec/rtld-elf/rtld.cThu Jun 18 23:07:58 2020 (r362347) @@ -2280,6 +2280,7 @@ init_rtld(caddr_t mapbase, Elf_Auxinfo **aux_info) obj_rtld.path = xstrdup(ld_path_rtld); parse_rtld_phdr(_rtld); +obj_enforce_relro(_rtld); r_debug.r_brk = r_debug_state; r_debug.r_state = RT_CONSISTENT; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362346 - head/libexec/rtld-elf
Author: kib Date: Thu Jun 18 23:06:05 2020 New Revision: 362346 URL: https://svnweb.freebsd.org/changeset/base/362346 Log: rtld: Parse own phdr and notes. Reviewed by: emaste Sponsored by: The FreeBSD Foundation MFC after:1 week Differential revision:https://reviews.freebsd.org/D25319 Modified: head/libexec/rtld-elf/rtld.c Modified: head/libexec/rtld-elf/rtld.c == --- head/libexec/rtld-elf/rtld.cThu Jun 18 22:10:06 2020 (r362345) +++ head/libexec/rtld-elf/rtld.cThu Jun 18 23:06:05 2020 (r362346) @@ -2182,6 +2182,34 @@ process_z(Obj_Entry *root) } } } + +static void +parse_rtld_phdr(Obj_Entry *obj) +{ + const Elf_Phdr *ph; + Elf_Addr note_start, note_end; + + obj->stack_flags = PF_X | PF_R | PF_W; + for (ph = obj->phdr; (const char *)ph < (const char *)obj->phdr + + obj->phsize; ph++) { + switch (ph->p_type) { + case PT_GNU_STACK: + obj->stack_flags = ph->p_flags; + break; + case PT_GNU_RELRO: + obj->relro_page = obj->relocbase + + trunc_page(ph->p_vaddr); + obj->relro_size = round_page(ph->p_memsz); + break; + case PT_NOTE: + note_start = (Elf_Addr)obj->relocbase + ph->p_vaddr; + note_end = note_start + ph->p_filesz; + digest_notes(obj, note_start, note_end); + break; + } + } +} + /* * Initialize the dynamic linker. The argument is the address at which * the dynamic linker has been mapped into memory. The primary task of @@ -2250,6 +2278,8 @@ init_rtld(caddr_t mapbase, Elf_Auxinfo **aux_info) /* Replace the path with a dynamically allocated copy. */ obj_rtld.path = xstrdup(ld_path_rtld); + +parse_rtld_phdr(_rtld); r_debug.r_brk = r_debug_state; r_debug.r_state = RT_CONSISTENT; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362343 - in head/sys: kern sys
Author: kaktus Date: Thu Jun 18 21:42:54 2020 New Revision: 362343 URL: https://svnweb.freebsd.org/changeset/base/362343 Log: hw.bus.info: rework handler hw.bus.info was added in r68522 as a node, but there was never anything connected "behind" it. Its only purpose is to return a struct u_businfo. The only in-base consumer are devinfo(3)/devinfo(8). Rewrite the handler as SYSCTL_PROC and mark it as MPSAFE and read-only as there never was a writable path. Reviewed by: kib Approved by: kib (mentor) Sponsored by: Mysterious Code Ltd. Differential Revision:https://reviews.freebsd.org/D25321 Modified: head/sys/kern/subr_bus.c head/sys/sys/sysctl.h Modified: head/sys/kern/subr_bus.c == --- head/sys/kern/subr_bus.cThu Jun 18 20:49:56 2020(r362342) +++ head/sys/kern/subr_bus.cThu Jun 18 21:42:54 2020(r362343) @@ -5454,7 +5454,7 @@ print_devclass_list(void) */ static int -sysctl_bus(SYSCTL_HANDLER_ARGS) +sysctl_bus_info(SYSCTL_HANDLER_ARGS) { struct u_businfoubus; @@ -5463,7 +5463,8 @@ sysctl_bus(SYSCTL_HANDLER_ARGS) return (SYSCTL_OUT(req, , sizeof(ubus))); } -SYSCTL_NODE(_hw_bus, OID_AUTO, info, CTLFLAG_RW | CTLFLAG_NEEDGIANT, sysctl_bus, +SYSCTL_PROC(_hw_bus, OID_AUTO, info, CTLTYPE_STRUCT | CTLFLAG_RD | +CTLFLAG_MPSAFE, NULL, 0, sysctl_bus_info, "S,u_businfo", "bus-related data"); static int @@ -,7 +5556,8 @@ bus_data_generation_check(int generation) void bus_data_generation_update(void) { - bus_data_generation++; + + atomic_add_int(_data_generation, 1); } int Modified: head/sys/sys/sysctl.h == --- head/sys/sys/sysctl.h Thu Jun 18 20:49:56 2020(r362342) +++ head/sys/sys/sysctl.h Thu Jun 18 21:42:54 2020(r362343) @@ -1122,7 +1122,6 @@ SYSCTL_DECL(_dev); SYSCTL_DECL(_hw); SYSCTL_DECL(_hw_bus); SYSCTL_DECL(_hw_bus_devices); -SYSCTL_DECL(_hw_bus_info); SYSCTL_DECL(_machdep); SYSCTL_DECL(_machdep_mitigations); SYSCTL_DECL(_user); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r362285 - head/sys/dev/pci
On Thu, 18 Jun 2020 at 08:48, Jessica Clarke wrote: > > On 18 Jun 2020, at 13:23, Ed Maste wrote: > > On Wed, 17 Jun 2020 at 15:56, Andrew Turner wrote: > >> > >> Author: andrew > >> Date: Wed Jun 17 19:56:17 2020 > >> New Revision: 362285 > >> URL: https://svnweb.freebsd.org/changeset/base/362285 > >> > >> Log: > >> Clean up the pci host generic driver > > ... > >> > >> + /* Translate the address from a PCI address to a physical address > >> */ > >> + switch (type) { > >> + case SYS_RES_IOPORT: > >> + case SYS_RES_MEMORY: > >> + found = false; > >> + for (i = 0; i < MAX_RANGES_TUPLES; i++) { > >> + pci_base = sc->ranges[i].pci_base; > >> + phys_base = sc->ranges[i].phys_base; > >> + size = sc->ranges[i].size; > >> + > >> + if (start < pci_base || start >= pci_base + size) > >> + continue; > > > > Should the second condition be end instead? markj had this comment on > > the old version in review D20884. > > The code previously had: > > > if ((rman_get_start(r) >= pci_base) && (rman_get_start(r) < (pci_base + > > size))) > > found = 1; > > break; > > } > > The new code is just the inverted form of that. Yes; Mark made the comment (that the 2nd rman_get_start should be rman_get_end) about the previous version of the code but no change was made. I believe that comment still applies. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362342 - head/sys/compat/linux
Author: kib Date: Thu Jun 18 20:49:56 2020 New Revision: 362342 URL: https://svnweb.freebsd.org/changeset/base/362342 Log: Fix execution of linux binary from multithreaded non-Linux process. If multithreaded non-Linux process execs Linux binary, then non-Linux threads different from the one that execing are cleared by single-threading at boundary, and then terminating them in post_execve(). Since at that time the process is already switched to linux ABI, linuxolator is involved in the thread clearing on boundary, but cannot find the emul data. Handle it by pre-creating emuldata for all threads in the execing process. Also remove a code in linux_proc_exec() handler that cleared emul data for other threads when execing from multithreaded Linux process. It is excessive. PR: 247020 Reported by: Martin FIlla Reported by: Henrique L. Amorim, Independent Security Researcher Reported by: Rodrigo Rubira Branco (BSDaemon), Amazon Web Services Reviewed by: markj Tested by:trasz Sponsored by: The FreeBSD Foundation MFC after:1 week Differential revision:https://reviews.freebsd.org/D25293 Modified: head/sys/compat/linux/linux_emul.c Modified: head/sys/compat/linux/linux_emul.c == --- head/sys/compat/linux/linux_emul.c Thu Jun 18 20:41:43 2020 (r362341) +++ head/sys/compat/linux/linux_emul.c Thu Jun 18 20:49:56 2020 (r362342) @@ -291,22 +291,13 @@ linux_common_execve(struct thread *td, struct image_ar void linux_proc_exec(void *arg __unused, struct proc *p, struct image_params *imgp) { - struct thread *td = curthread; + struct thread *td; struct thread *othertd; #if defined(__amd64__) struct linux_pemuldata *pem; #endif - /* -* In a case of execing from Linux binary properly detach -* other threads from the user space. -*/ - if (__predict_false(SV_PROC_ABI(p) == SV_ABI_LINUX)) { - FOREACH_THREAD_IN_PROC(p, othertd) { - if (td != othertd) - (p->p_sysent->sv_thread_detach)(othertd); - } - } + td = curthread; /* * In a case of execing to Linux binary we create Linux @@ -314,11 +305,32 @@ linux_proc_exec(void *arg __unused, struct proc *p, st */ if (__predict_false((imgp->sysent->sv_flags & SV_ABI_MASK) == SV_ABI_LINUX)) { - - if (SV_PROC_ABI(p) == SV_ABI_LINUX) + if (SV_PROC_ABI(p) == SV_ABI_LINUX) { + /* +* Process already was under Linuxolator +* before exec. Update emuldata to reflect +* single-threaded cleaned state after exec. +*/ linux_proc_init(td, NULL, 0); - else + } else { + /* +* We are switching the process to Linux emulator. +*/ linux_proc_init(td, td, 0); + + /* +* Create a transient td_emuldata for all suspended +* threads, so that p->p_sysent->sv_thread_detach() == +* linux_thread_detach() can find expected but unused +* emuldata. +*/ + FOREACH_THREAD_IN_PROC(td->td_proc, othertd) { + if (othertd != td) { + linux_proc_init(td, othertd, + LINUX_CLONE_THREAD); + } + } + } #if defined(__amd64__) /* * An IA32 executable which has executable stack will have the ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362341 - head/contrib/llvm-project/llvm/lib/Analysis
Author: dim Date: Thu Jun 18 20:41:43 2020 New Revision: 362341 URL: https://svnweb.freebsd.org/changeset/base/362341 Log: Merge commit 0cecafd647cc from llvm git (by Alina Sbirlea): [BasicAA] Make BasicAA a cfg pass. Summary: Part of the changes in D44564 made BasicAA not CFG only due to it using PhiAnalysisValues which may have values invalidated. Subsequent patches (rL340613) appear to have addressed this limitation. BasicAA should not be invalidated by non-CFG-altering passes. A concrete example is MemCpyOpt which preserves CFG, but we are testing it invalidates BasicAA. llvm-dev RFC: https://groups.google.com/forum/#!topic/llvm-dev/eSPXuWnNfzM Reviewers: john.brawn, sebpop, hfinkel, brzycki Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D74353 This fixes an issue with clang's -fintegrated-cc1 feature, which could make it output slightly different assembly code, depending on the way it was invoked. In r361755 we attempted to work around it by disabling the integrated cc1 stage, but it did not solve the root cause for all situations. Extensive testing and bisecting showed that the above change finally makes the output deterministic, even if -fintegrated-cc1 is on. Reported by: Fabian Keil PR: 246630 MFC after:3 days Modified: head/contrib/llvm-project/llvm/lib/Analysis/BasicAliasAnalysis.cpp Modified: head/contrib/llvm-project/llvm/lib/Analysis/BasicAliasAnalysis.cpp == --- head/contrib/llvm-project/llvm/lib/Analysis/BasicAliasAnalysis.cpp Thu Jun 18 20:25:42 2020(r362340) +++ head/contrib/llvm-project/llvm/lib/Analysis/BasicAliasAnalysis.cpp Thu Jun 18 20:41:43 2020(r362341) @@ -2059,12 +2059,13 @@ char BasicAAWrapperPass::ID = 0; void BasicAAWrapperPass::anchor() {} INITIALIZE_PASS_BEGIN(BasicAAWrapperPass, "basicaa", - "Basic Alias Analysis (stateless AA impl)", false, true) + "Basic Alias Analysis (stateless AA impl)", true, true) INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker) INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass) INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass) +INITIALIZE_PASS_DEPENDENCY(PhiValuesWrapperPass) INITIALIZE_PASS_END(BasicAAWrapperPass, "basicaa", -"Basic Alias Analysis (stateless AA impl)", false, true) +"Basic Alias Analysis (stateless AA impl)", true, true) FunctionPass *llvm::createBasicAAWrapperPass() { return new BasicAAWrapperPass(); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362338 - in head: share/man/man4 sys/conf sys/kern sys/netinet sys/netinet6 sys/netipsec sys/netpfil/pf
Author: markj Date: Thu Jun 18 19:32:34 2020 New Revision: 362338 URL: https://svnweb.freebsd.org/changeset/base/362338 Log: Add the SCTP_SUPPORT kernel option. This is in preparation for enabling a loadable SCTP stack. Analogous to IPSEC/IPSEC_SUPPORT, the SCTP_SUPPORT kernel option must be configured in order to support a loadable SCTP implementation. Discussed with: tuexen MFC after:2 weeks Sponsored by: The FreeBSD Foundation Modified: head/share/man/man4/sctp.4 head/sys/conf/NOTES head/sys/conf/options head/sys/kern/uipc_socket.c head/sys/netinet/in_proto.c head/sys/netinet/ip_divert.c head/sys/netinet/ip_output.c head/sys/netinet/sctp_crc32.c head/sys/netinet/sctp_crc32.h head/sys/netinet6/in6_proto.c head/sys/netinet6/ip6_forward.c head/sys/netinet6/ip6_output.c head/sys/netipsec/ipsec_output.c head/sys/netpfil/pf/pf.c Modified: head/share/man/man4/sctp.4 == --- head/share/man/man4/sctp.4 Thu Jun 18 19:16:03 2020(r362337) +++ head/share/man/man4/sctp.4 Thu Jun 18 19:32:34 2020(r362338) @@ -26,13 +26,16 @@ .\" .\" $FreeBSD$ .\" -.Dd January 4, 2020 +.Dd June 18, 2020 .Dt SCTP 4 .Os .Sh NAME .Nm sctp .Nd Internet Stream Control Transmission Protocol .Sh SYNOPSIS +.Cd "options SCTP" +.Cd "options SCTP_SUPPORT" +.Pp .In sys/types.h .In sys/socket.h .In netinet/sctp.h Modified: head/sys/conf/NOTES == --- head/sys/conf/NOTES Thu Jun 18 19:16:03 2020(r362337) +++ head/sys/conf/NOTES Thu Jun 18 19:32:34 2020(r362338) @@ -697,7 +697,12 @@ optionsLIBALIAS # the V6 and V4.. since an association can span # both a V6 and V4 address at the SAME time :-) # +# The SCTP_SUPPORT option does not enable SCTP, but provides the necessary +# support for loading SCTP as a loadable kernel module. +# optionsSCTP +optionsSCTP_SUPPORT + # There are bunches of options: # this one turns on all sorts of # nastily printing that you can @@ -710,6 +715,7 @@ options SCTP # bits and prints.. which makes the code run # faster.. if you are not debugging don't use. optionsSCTP_DEBUG + # # All that options after that turn on specific types of # logging. You can monitor CWND growth, flight size @@ -732,7 +738,6 @@ options SCTP_MBCNT_LOGGING optionsSCTP_PACKET_LOGGING optionsSCTP_LTRACE_CHUNKS optionsSCTP_LTRACE_ERRORS - # altq(9). Enable the base part of the hooks with the ALTQ option. # Individual disciplines must be built into the base system and can not be Modified: head/sys/conf/options == --- head/sys/conf/options Thu Jun 18 19:16:03 2020(r362337) +++ head/sys/conf/options Thu Jun 18 19:32:34 2020(r362338) @@ -476,6 +476,7 @@ XBONEHACK # SCTP # SCTP opt_sctp.h +SCTP_SUPPORT opt_sctp.h SCTP_DEBUG opt_sctp.h # Enable debug printfs SCTP_LOCK_LOGGING opt_sctp.h # Log to KTR lock activity SCTP_MBUF_LOGGING opt_sctp.h # Log to KTR general mbuf aloc/free Modified: head/sys/kern/uipc_socket.c == --- head/sys/kern/uipc_socket.c Thu Jun 18 19:16:03 2020(r362337) +++ head/sys/kern/uipc_socket.c Thu Jun 18 19:32:34 2020(r362338) @@ -793,7 +793,7 @@ sonewconn(struct socket *head, int connstatus) return (so); } -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) /* * Socket part of sctp_peeloff(). Detach a new socket from an * association. The new socket is returned with a reference. Modified: head/sys/netinet/in_proto.c == --- head/sys/netinet/in_proto.c Thu Jun 18 19:16:03 2020(r362337) +++ head/sys/netinet/in_proto.c Thu Jun 18 19:32:34 2020(r362338) @@ -94,7 +94,7 @@ static struct pr_usrreqs nousrreqs; #include #include #include -#endif /* SCTP */ +#endif FEATURE(inet, "Internet Protocol version 4"); @@ -324,7 +324,7 @@ SYSCTL_NODE(_net_inet, IPPROTO_UDP, udp, CTLFLAG_RW | "UDP"); SYSCTL_NODE(_net_inet, IPPROTO_TCP, tcp, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, "TCP"); -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) SYSCTL_NODE(_net_inet, IPPROTO_SCTP, sctp, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, "SCTP"); #endif Modified: head/sys/netinet/ip_divert.c == --- head/sys/netinet/ip_divert.cThu Jun 18 19:16:03 2020 (r362337) +++ head/sys/netinet/ip_divert.cThu Jun 18 19:32:34 2020 (r362338) @@ -69,7 +69,7 @@ __FBSDID("$FreeBSD$"); #include #include #endif -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT)
svn commit: r362337 - head/sys/dev/nvme
Author: mav Date: Thu Jun 18 19:16:03 2020 New Revision: 362337 URL: https://svnweb.freebsd.org/changeset/base/362337 Log: Make polled request timeout less invasive. Instead of panic after one second of polling, make the normal timeout handler to activate, reset the controller and abort the outstanding requests. If all of it won't happen within 10 seconds then something in the driver is likely stuck bad and panic is the only way out. In particular this fixed device hot unplug during execution of those polled commands, allowing clean device detach instead of panic. MFC after:1 week Sponsored by: iXsystems, Inc. Modified: head/sys/dev/nvme/nvme_ctrlr.c head/sys/dev/nvme/nvme_private.h head/sys/dev/nvme/nvme_qpair.c Modified: head/sys/dev/nvme/nvme_ctrlr.c == --- head/sys/dev/nvme/nvme_ctrlr.c Thu Jun 18 19:03:20 2020 (r362336) +++ head/sys/dev/nvme/nvme_ctrlr.c Thu Jun 18 19:16:03 2020 (r362337) @@ -520,7 +520,7 @@ nvme_ctrlr_create_qpairs(struct nvme_controller *ctrlr } status.done = 0; - nvme_ctrlr_cmd_create_io_sq(qpair->ctrlr, qpair, + nvme_ctrlr_cmd_create_io_sq(ctrlr, qpair, nvme_completion_poll_cb, ); nvme_completion_poll(); if (nvme_completion_is_error()) { Modified: head/sys/dev/nvme/nvme_private.h == --- head/sys/dev/nvme/nvme_private.hThu Jun 18 19:03:20 2020 (r362336) +++ head/sys/dev/nvme/nvme_private.hThu Jun 18 19:16:03 2020 (r362337) @@ -463,20 +463,22 @@ int nvme_detach(device_t dev); * Wait for a command to complete using the nvme_completion_poll_cb. * Used in limited contexts where the caller knows it's OK to block * briefly while the command runs. The ISR will run the callback which - * will set status->done to true.usually within microseconds. A 1s - * pause means something is seriously AFU and we should panic to - * provide the proper context to diagnose. + * will set status->done to true, usually within microseconds. If not, + * then after one second timeout handler should reset the controller + * and abort all outstanding requests including this polled one. If + * still not after ten seconds, then something is wrong with the driver, + * and panic is the only way to recover. */ static __inline void nvme_completion_poll(struct nvme_completion_poll_status *status) { - int sanity = hz * 1; + int sanity = hz * 10; while (!atomic_load_acq_int(>done) && --sanity > 0) pause("nvme", 1); if (sanity <= 0) - panic("NVME polled command failed to complete within 1s."); + panic("NVME polled command failed to complete within 10s."); } static __inline void Modified: head/sys/dev/nvme/nvme_qpair.c == --- head/sys/dev/nvme/nvme_qpair.c Thu Jun 18 19:03:20 2020 (r362336) +++ head/sys/dev/nvme/nvme_qpair.c Thu Jun 18 19:16:03 2020 (r362337) @@ -956,6 +956,7 @@ nvme_qpair_submit_tracker(struct nvme_qpair *qpair, st { struct nvme_request *req; struct nvme_controller *ctrlr; + int timeout; mtx_assert(>lock, MA_OWNED); @@ -964,9 +965,14 @@ nvme_qpair_submit_tracker(struct nvme_qpair *qpair, st qpair->act_tr[tr->cid] = tr; ctrlr = qpair->ctrlr; - if (req->timeout) - callout_reset_on(>timer, ctrlr->timeout_period * hz, - nvme_timeout, tr, qpair->cpu); + if (req->timeout) { + if (req->cb_fn == nvme_completion_poll_cb) + timeout = hz; + else + timeout = ctrlr->timeout_period * hz; + callout_reset_on(>timer, timeout, nvme_timeout, tr, + qpair->cpu); + } /* Copy the command from the tracker to the submission queue. */ memcpy(>cmd[qpair->sq_tail], >cmd, sizeof(req->cmd)); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362336 - head/lib/libc/sys
Author: 0mp (doc,ports committer) Date: Thu Jun 18 19:03:20 2020 New Revision: 362336 URL: https://svnweb.freebsd.org/changeset/base/362336 Log: Fix a typo in cpuset_getdomain.2 PR: 247385 Reported by: Paul Floyd MFC after:1 week Modified: head/lib/libc/sys/cpuset_getdomain.2 Modified: head/lib/libc/sys/cpuset_getdomain.2 == --- head/lib/libc/sys/cpuset_getdomain.2Thu Jun 18 18:18:09 2020 (r362335) +++ head/lib/libc/sys/cpuset_getdomain.2Thu Jun 18 19:03:20 2020 (r362336) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Mar 19, 2018 +.Dd June 18, 2020 .Dt CPUSET_GETDOMAIN 2 .Os .Sh NAME @@ -37,7 +37,7 @@ .In sys/param.h .In sys/domainset.h .Ft int -.Fn cpuset_getdomain "cpulevel_t level" "cpuwhich_t which" "id_t id" "size_t setsize" "domainet_t *mask" "int *policy" +.Fn cpuset_getdomain "cpulevel_t level" "cpuwhich_t which" "id_t id" "size_t setsize" "domainset_t *mask" "int *policy" .Ft int .Fn cpuset_setdomain "cpulevel_t level" "cpuwhich_t which" "id_t id" "size_t setsize" "const domainset_t *mask" "int policy" .Sh DESCRIPTION ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362334 - head/contrib/flex
Author: jkim Date: Thu Jun 18 18:16:13 2020 New Revision: 362334 URL: https://svnweb.freebsd.org/changeset/base/362334 Log: Remove the unnecessary configure.ac. Deleted: head/contrib/flex/configure.ac ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362333 - in head: contrib/flex contrib/flex/src usr.bin/lex usr.bin/lex/lib
Author: jkim Date: Thu Jun 18 18:09:16 2020 New Revision: 362333 URL: https://svnweb.freebsd.org/changeset/base/362333 Log: MFV: r362286 Merge flex 2.6.4. Added: head/contrib/flex/README.md - copied unchanged from r362286, vendor/flex/dist/README.md head/contrib/flex/configure.ac - copied unchanged from r362286, vendor/flex/dist/configure.ac head/contrib/flex/src/ head/contrib/flex/src/FlexLexer.h - copied, changed from r362332, head/contrib/flex/FlexLexer.h head/contrib/flex/src/buf.c - copied, changed from r362332, head/contrib/flex/buf.c head/contrib/flex/src/ccl.c - copied, changed from r362332, head/contrib/flex/ccl.c head/contrib/flex/src/dfa.c - copied, changed from r362332, head/contrib/flex/dfa.c head/contrib/flex/src/ecs.c - copied, changed from r362332, head/contrib/flex/ecs.c head/contrib/flex/src/filter.c - copied, changed from r362332, head/contrib/flex/filter.c head/contrib/flex/src/flex.skl - copied, changed from r362332, head/contrib/flex/flex.skl head/contrib/flex/src/flexdef.h - copied, changed from r362332, head/contrib/flex/flexdef.h head/contrib/flex/src/flexint.h - copied, changed from r362332, head/contrib/flex/flexint.h head/contrib/flex/src/gen.c - copied, changed from r362332, head/contrib/flex/gen.c head/contrib/flex/src/libmain.c - copied, changed from r362332, head/contrib/flex/libmain.c head/contrib/flex/src/libyywrap.c - copied, changed from r362332, head/contrib/flex/libyywrap.c head/contrib/flex/src/main.c - copied, changed from r362332, head/contrib/flex/main.c head/contrib/flex/src/misc.c - copied, changed from r362332, head/contrib/flex/misc.c head/contrib/flex/src/mkskel.sh - copied, changed from r362332, head/contrib/flex/mkskel.sh head/contrib/flex/src/nfa.c - copied, changed from r362332, head/contrib/flex/nfa.c head/contrib/flex/src/options.c - copied, changed from r362332, head/contrib/flex/options.c head/contrib/flex/src/options.h - copied, changed from r362332, head/contrib/flex/options.h head/contrib/flex/src/parse.y - copied, changed from r362332, head/contrib/flex/parse.y head/contrib/flex/src/regex.c - copied, changed from r362332, head/contrib/flex/regex.c head/contrib/flex/src/scan.l - copied, changed from r362332, head/contrib/flex/scan.l head/contrib/flex/src/scanflags.c - copied, changed from r362332, head/contrib/flex/scanflags.c head/contrib/flex/src/scanopt.c - copied, changed from r362332, head/contrib/flex/scanopt.c head/contrib/flex/src/scanopt.h - copied, changed from r362332, head/contrib/flex/scanopt.h head/contrib/flex/src/sym.c - copied, changed from r362332, head/contrib/flex/sym.c head/contrib/flex/src/tables.c - copied, changed from r362332, head/contrib/flex/tables.c head/contrib/flex/src/tables.h - copied, changed from r362332, head/contrib/flex/tables.h head/contrib/flex/src/tables_shared.c - copied, changed from r362332, head/contrib/flex/tables_shared.c head/contrib/flex/src/tables_shared.h - copied unchanged from r362332, head/contrib/flex/tables_shared.h head/contrib/flex/src/tblcmp.c - copied, changed from r362332, head/contrib/flex/tblcmp.c head/contrib/flex/src/version.h - copied unchanged from r362332, head/contrib/flex/version.h head/contrib/flex/src/yylex.c - copied, changed from r362332, head/contrib/flex/yylex.c Deleted: head/contrib/flex/FlexLexer.h head/contrib/flex/README head/contrib/flex/buf.c head/contrib/flex/ccl.c head/contrib/flex/dfa.c head/contrib/flex/ecs.c head/contrib/flex/filter.c head/contrib/flex/flex.skl head/contrib/flex/flexdef.h head/contrib/flex/flexint.h head/contrib/flex/gen.c head/contrib/flex/libmain.c head/contrib/flex/libyywrap.c head/contrib/flex/main.c head/contrib/flex/misc.c head/contrib/flex/mkskel.sh head/contrib/flex/nfa.c head/contrib/flex/options.c head/contrib/flex/options.h head/contrib/flex/parse.y head/contrib/flex/regex.c head/contrib/flex/scan.l head/contrib/flex/scanflags.c head/contrib/flex/scanopt.c head/contrib/flex/scanopt.h head/contrib/flex/sym.c head/contrib/flex/tables.c head/contrib/flex/tables.h head/contrib/flex/tables_shared.c head/contrib/flex/tables_shared.h head/contrib/flex/tblcmp.c head/contrib/flex/version.h head/contrib/flex/yylex.c Modified: head/contrib/flex/ChangeLog head/contrib/flex/NEWS head/usr.bin/lex/Makefile head/usr.bin/lex/config.h head/usr.bin/lex/initparse.c head/usr.bin/lex/initparse.h head/usr.bin/lex/initscan.c head/usr.bin/lex/initskel.c head/usr.bin/lex/lex.1 head/usr.bin/lex/lib/Makefile head/usr.bin/lex/version.awk Directory Properties: head/contrib/flex/ (props changed) Modified: head/contrib/flex/ChangeLog == ---
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-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r362126 - head/sys/vm
On 6/17/20 5:48 PM, Conrad Meyer wrote: > 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. 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. -- John Baldwin ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362332 - head/lib/libc/net
Author: tuexen Date: Thu Jun 18 16:22:09 2020 New Revision: 362332 URL: https://svnweb.freebsd.org/changeset/base/362332 Log: Whitespace changes, not functional change intended. MFC after:1 week Modified: head/lib/libc/net/sctp_sys_calls.c Modified: head/lib/libc/net/sctp_sys_calls.c == --- head/lib/libc/net/sctp_sys_calls.c Thu Jun 18 15:44:40 2020 (r362331) +++ head/lib/libc/net/sctp_sys_calls.c Thu Jun 18 16:22:09 2020 (r362332) @@ -100,7 +100,7 @@ sctp_getaddrlen(sa_family_t family) int sctp_connectx(int sd, const struct sockaddr *addrs, int addrcnt, -sctp_assoc_t * id) +sctp_assoc_t *id) { char *buf; int i, ret, *aa; @@ -159,9 +159,9 @@ sctp_connectx(int sd, const struct sockaddr *addrs, in aa = (int *)buf; *aa = addrcnt; ret = setsockopt(sd, IPPROTO_SCTP, SCTP_CONNECT_X, (void *)buf, - (socklen_t) len); + (socklen_t)len); if ((ret == 0) && (id != NULL)) { - *id = *(sctp_assoc_t *) buf; + *id = *(sctp_assoc_t *)buf; } free(buf); return (ret); @@ -269,7 +269,7 @@ sctp_bindx(int sd, struct sockaddr *addrs, int addrcnt } } if (setsockopt(sd, IPPROTO_SCTP, flags, gaddrs, - (socklen_t) argsz) != 0) { + (socklen_t)argsz) != 0) { free(gaddrs); return (-1); } @@ -280,7 +280,7 @@ sctp_bindx(int sd, struct sockaddr *addrs, int addrcnt } int -sctp_opt_info(int sd, sctp_assoc_t id, int opt, void *arg, socklen_t * size) +sctp_opt_info(int sd, sctp_assoc_t id, int opt, void *arg, socklen_t *size) { if (arg == NULL) { errno = EINVAL; @@ -409,13 +409,13 @@ sctp_getpaddrs(int sd, sctp_assoc_t id, struct sockadd return (-1); } asoc = id; - opt_len = (socklen_t) sizeof(sctp_assoc_t); + opt_len = (socklen_t)sizeof(sctp_assoc_t); if (getsockopt(sd, IPPROTO_SCTP, SCTP_GET_REMOTE_ADDR_SIZE, , _len) != 0) { return (-1); } /* size required is returned in 'asoc' */ - opt_len = (socklen_t) ((size_t)asoc + sizeof(sctp_assoc_t)); + opt_len = (socklen_t)((size_t)asoc + sizeof(sctp_assoc_t)); addrs = calloc(1, (size_t)opt_len); if (addrs == NULL) { errno = ENOMEM; @@ -465,7 +465,7 @@ sctp_getladdrs(int sd, sctp_assoc_t id, struct sockadd return (-1); } size_of_addresses = 0; - opt_len = (socklen_t) sizeof(int); + opt_len = (socklen_t)sizeof(int); if (getsockopt(sd, IPPROTO_SCTP, SCTP_GET_LOCAL_ADDR_SIZE, _of_addresses, _len) != 0) { errno = ENOMEM; @@ -475,7 +475,7 @@ sctp_getladdrs(int sd, sctp_assoc_t id, struct sockadd errno = ENOTCONN; return (-1); } - opt_len = (socklen_t) (size_of_addresses + sizeof(sctp_assoc_t)); + opt_len = (socklen_t)(size_of_addresses + sizeof(sctp_assoc_t)); addrs = calloc(1, (size_t)opt_len); if (addrs == NULL) { errno = ENOMEM; @@ -586,6 +586,7 @@ sctp_sendmsg(int s, } who = (struct sockaddr *) } + iov.iov_base = (char *)data; iov.iov_len = len; @@ -632,7 +633,7 @@ sctp_getassocid(int sd, struct sockaddr *sa) if (getsockopt(sd, IPPROTO_SCTP, SCTP_GET_PEER_ADDR_INFO, , ) != 0) { /* We depend on the fact that 0 can never be returned */ - return ((sctp_assoc_t) 0); + return ((sctp_assoc_t)0); } return (sp.spinfo_assoc_id); } @@ -748,7 +749,7 @@ sctp_sendx(int sd, const void *msg, size_t msg_len, aa++; memcpy((caddr_t)aa, addrs, (size_t)(len - sizeof(int))); ret = setsockopt(sd, IPPROTO_SCTP, SCTP_CONNECT_X_DELAYED, (void *)buf, - (socklen_t) len); + (socklen_t)len); free(buf); if (ret != 0) { @@ -766,7 +767,7 @@ continue_send: sinfo->sinfo_assoc_id = sctp_getassocid(sd, addrs); if (sinfo->sinfo_assoc_id == 0) { (void)setsockopt(sd, IPPROTO_SCTP, SCTP_CONNECT_X_COMPLETE, (void *)addrs, - (socklen_t) addrs->sa_len); + (socklen_t)addrs->sa_len); errno = ENOENT; return (-1); } @@ -774,7 +775,7 @@ continue_send: saved_errno = errno; if (no_end_cx == 0) (void)setsockopt(sd, IPPROTO_SCTP, SCTP_CONNECT_X_COMPLETE, (void *)addrs, - (socklen_t) addrs->sa_len); + (socklen_t)addrs->sa_len); errno = saved_errno; return (ret); @@ -808,7 +809,7 @@ sctp_recvmsg(int s, void *dbuf, size_t len,
svn commit: r362330 - head/tests/sys/audit
Author: trasz Date: Thu Jun 18 15:41:16 2020 New Revision: 362330 URL: https://svnweb.freebsd.org/changeset/base/362330 Log: Make audit tests depend on /dev/auditpipe. This should fix some 416 failing tests on armv7: https://ci.freebsd.org/job/FreeBSD-head-armv7-test/lastCompletedBuild/testReport/ Reviewed by: asomers MFC after:2 weeks Sponsored by: DARPA Differential Revision:https://reviews.freebsd.org/D25144 Modified: head/tests/sys/audit/Makefile Modified: head/tests/sys/audit/Makefile == --- head/tests/sys/audit/Makefile Thu Jun 18 15:15:04 2020 (r362329) +++ head/tests/sys/audit/Makefile Thu Jun 18 15:41:16 2020 (r362330) @@ -49,7 +49,7 @@ SRCS.miscellaneous+= utils.c TEST_METADATA+= timeout="30" TEST_METADATA+= required_user="root" TEST_METADATA+= is_exclusive="true" -TEST_METADATA+=required_files="/etc/rc.d/auditd" +TEST_METADATA+=required_files="/etc/rc.d/auditd /dev/auditpipe" WARNS?=6 ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362328 - head/usr.bin/split
Author: fernape (ports committer) Date: Thu Jun 18 15:14:10 2020 New Revision: 362328 URL: https://svnweb.freebsd.org/changeset/base/362328 Log: split(1): Add EXAMPLES section Add EXAMPLES covering -d, -n and -p Include small explanation about the size of the chunks for the -n option Approved by: 0mp Differential Revision:https://reviews.freebsd.org/D25198 Modified: head/usr.bin/split/split.1 Modified: head/usr.bin/split/split.1 == --- head/usr.bin/split/split.1 Thu Jun 18 13:19:56 2020(r362327) +++ head/usr.bin/split/split.1 Thu Jun 18 15:14:10 2020(r362328) @@ -122,6 +122,12 @@ lines in length. Split file into .Ar chunk_count smaller files. +The first n - 1 files will be of size (size of +.Ar file +/ +.Ar chunk_count +) +and the last file will contain the remaining bytes. .It Fl p Ar pattern The file is split whenever an input line matches .Ar pattern , @@ -164,6 +170,36 @@ as described in .Xr environ 7 . .Sh EXIT STATUS .Ex -std +.Sh EXAMPLES +Split input into as many files as needed, so that each file contains at most 2 +lines: +.Bd -literal -offset indent +$ echo -e "first line\\nsecond line\\nthird line\\nforth line" | split -l2 +.Ed +.Pp +Split input in chunks of 10 bytes using numeric prefixes for file names. +This generates two files of 10 bytes (x00 and x01) and a third file (x02) with the +remaining 2 bytes: +.Bd -literal -offset indent +$ echo -e "This is 22 bytes long" | split -d -b10 +.Ed +.Pp +Split input generating 6 files: +.Bd -literal -offset indent +echo -e "This is 22 bytes long" | split -n 6 +.Ed +.Pp +Split input creating a new file every time a line matches the regular expression +for a +.Dq t +followed by either +.Dq a +or +.Dq u +thus creating two files: +.Bd -literal -offset indent +$ echo -e "stack\\nstock\\nstuck\\nanother line" | split -p 't[au]' +.Ed .Sh SEE ALSO .Xr csplit 1 , .Xr re_format 7 ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r345726 - head/sys/dev/xen/blkfront
On Sat, Mar 30, 2019 at 07:20:28AM +, Pawel Jakub Dawidek wrote: > Author: pjd > Date: Sat Mar 30 07:20:28 2019 > New Revision: 345726 > URL: https://svnweb.freebsd.org/changeset/base/345726 > > Log: > Implement support for online disk capacity changes. > > Obtained from: Fudo Security > Tested in: AWS This breaks on i386 because the size of sectors is not wide enough and the calculation of d_mediasize is truncated. The fix is in r361579. Roger. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362327 - in head/usr.bin: banner basename limits vmstat
Author: gbe (doc committer) Date: Thu Jun 18 13:19:56 2020 New Revision: 362327 URL: https://svnweb.freebsd.org/changeset/base/362327 Log: Add HISTORY sections to banner(6), basename(1), limits(1) and vmstat(8) Reviewed by: bcr (mentor) Approved by: bcr (mentor) MFC after:7 days Differential Revision:https://reviews.freebsd.org/D25019 Modified: head/usr.bin/banner/banner.6 head/usr.bin/basename/basename.1 head/usr.bin/limits/limits.1 head/usr.bin/vmstat/vmstat.8 Modified: head/usr.bin/banner/banner.6 == --- head/usr.bin/banner/banner.6Thu Jun 18 13:13:04 2020 (r362326) +++ head/usr.bin/banner/banner.6Thu Jun 18 13:19:56 2020 (r362327) @@ -28,7 +28,7 @@ .\"From: @(#)banner.6 8.2 (Berkeley) 4/29/95 .\" $FreeBSD$ .\" -.Dd January 26, 2005 +.Dd May 26, 2020 .Dt BANNER 6 .Os .Sh NAME @@ -60,6 +60,11 @@ Change the output from a width of 132 to .Ar width , suitable for a narrow terminal. .El +.Sh HISTORY +The +.Nm +utility first appeared in +.Bx 4.4 . .Sh AUTHORS .An Mark Horton .Sh BUGS Modified: head/usr.bin/basename/basename.1 == --- head/usr.bin/basename/basename.1Thu Jun 18 13:13:04 2020 (r362326) +++ head/usr.bin/basename/basename.1Thu Jun 18 13:19:56 2020 (r362327) @@ -31,7 +31,7 @@ .\" @(#)basename.1 8.2 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd April 18, 1994 +.Dd May 26, 2020 .Dt BASENAME 1 .Os .Sh NAME @@ -111,3 +111,10 @@ and utilities are expected to be .St -p1003.2 compatible. +.Sh HISTORY +The +.Nm +and +.Nm dirname +utilities first appeared in +.Bx 4.4 . Modified: head/usr.bin/limits/limits.1 == --- head/usr.bin/limits/limits.1Thu Jun 18 13:13:04 2020 (r362326) +++ head/usr.bin/limits/limits.1Thu Jun 18 13:19:56 2020 (r362327) @@ -19,7 +19,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 13, 2018 +.Dd May 26, 2020 .Dt LIMITS 1 .Os .Sh NAME @@ -387,6 +387,16 @@ will be whatever the executed program returns. .Xr login.conf 5 , .Xr rctl 8 , .Xr sysctl 8 +.Sh HISTORY +The +.Nm +utility first appeared in +.Fx 2.1.7 . +.Sh AUTHORS +The +.Nm +utility was written by +.An David Nugent Aq Mt dav...@freebsd.org . .Sh BUGS The .Nm Modified: head/usr.bin/vmstat/vmstat.8 == --- head/usr.bin/vmstat/vmstat.8Thu Jun 18 13:13:04 2020 (r362326) +++ head/usr.bin/vmstat/vmstat.8Thu Jun 18 13:19:56 2020 (r362327) @@ -28,7 +28,7 @@ .\"@(#)vmstat.88.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd January 18, 2018 +.Dd May 26, 2020 .Dt VMSTAT 8 .Os .Sh NAME @@ -385,6 +385,11 @@ statistics every second. .Pp The sections starting with ``Interpreting system activity'' in .%T "Installing and Operating 4.3BSD" . +.Sh HISTORY +The +.Nm +utility first appeared in +.Bx 4.3 . .Sh BUGS The .Fl c ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362326 - head/lib/libc/stdio
Author: gbe (doc committer) Date: Thu Jun 18 13:13:04 2020 New Revision: 362326 URL: https://svnweb.freebsd.org/changeset/base/362326 Log: fgetln(3): Add a Caveats Section Reviewed by: yuripv, bcr (mentor) Approved by: bcr (mentror) Obtained from:OpenBSD MFC after:7 days Differential Revision:https://reviews.freebsd.org/D24916 Modified: head/lib/libc/stdio/fgetln.3 Modified: head/lib/libc/stdio/fgetln.3 == --- head/lib/libc/stdio/fgetln.3Thu Jun 18 12:29:24 2020 (r362325) +++ head/lib/libc/stdio/fgetln.3Thu Jun 18 13:13:04 2020 (r362326) @@ -28,7 +28,7 @@ .\" @(#)fgetln.3 8.3 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd February 15, 2016 +.Dd June 11, 2020 .Dt FGETLN 3 .Os .Sh NAME @@ -126,3 +126,33 @@ The .Fn fgetln function first appeared in .Bx 4.4 . +.Sh CAVEATS +Since the returned buffer is not a C string (it is not NUL terminated), a +common practice is to replace the newline character with +.Sq \e0 . +However, if the last line in a file does not contain a newline, +the returned text won't contain a newline either. +The following code demonstrates how to deal with this problem by allocating a +temporary buffer: +.Bd -literal + char *buf, *lbuf; + size_t len; + + lbuf = NULL; + while ((buf = fgetln(fp, )) != NULL) { + if (buf[len - 1] == '\en') + buf[len - 1] = '\e0'; + else { + /* EOF without EOL, copy and add the NUL */ + if ((lbuf = malloc(len + 1)) == NULL) + err(1, NULL); + memcpy(lbuf, buf, len); + lbuf[len] = '\e0'; + buf = lbuf; + } + printf("%s\en", buf); + } + free(lbuf); + if (ferror(fp)) + err(1, "fgetln"); +.Ed ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r362285 - head/sys/dev/pci
On 18 Jun 2020, at 13:23, Ed Maste wrote: > On Wed, 17 Jun 2020 at 15:56, Andrew Turner wrote: >> >> Author: andrew >> Date: Wed Jun 17 19:56:17 2020 >> New Revision: 362285 >> URL: https://svnweb.freebsd.org/changeset/base/362285 >> >> Log: >> Clean up the pci host generic driver > ... >> >> + /* Translate the address from a PCI address to a physical address */ >> + switch (type) { >> + case SYS_RES_IOPORT: >> + case SYS_RES_MEMORY: >> + found = false; >> + for (i = 0; i < MAX_RANGES_TUPLES; i++) { >> + pci_base = sc->ranges[i].pci_base; >> + phys_base = sc->ranges[i].phys_base; >> + size = sc->ranges[i].size; >> + >> + if (start < pci_base || start >= pci_base + size) >> + continue; > > Should the second condition be end instead? markj had this comment on > the old version in review D20884. The code previously had: > if ((rman_get_start(r) >= pci_base) && (rman_get_start(r) < (pci_base + > size))) > found = 1; > break; > } The new code is just the inverted form of that. Jess ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362325 - head/usr.sbin/efivar
Author: 0mp (doc,ports committer) Date: Thu Jun 18 12:29:24 2020 New Revision: 362325 URL: https://svnweb.freebsd.org/changeset/base/362325 Log: Fix the --guid flag description MFC after:2 weeks Modified: head/usr.sbin/efivar/efivar.8 Modified: head/usr.sbin/efivar/efivar.8 == --- head/usr.sbin/efivar/efivar.8 Thu Jun 18 11:18:26 2020 (r362324) +++ head/usr.sbin/efivar/efivar.8 Thu Jun 18 12:29:24 2020 (r362325) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 6, 2019 +.Dd June 18, 2020 .Dt EFIVAR 8 .Os .Sh NAME @@ -132,9 +132,10 @@ may be specified. Interpret the variables printed as UEFI device paths and print the UEFI standard string representation. .It Fl g Fl -guid -flag is specified, guids are converted to names if they are known (and -show up in -.Fl -list-guids ). +Convert GUIDs to names if they are known +.Po and show them up in +.Fl -list-guids +.Pc . .It Fl H Fl -hex List variable data as a hex dump. .It Fl L Fl -list-guids ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r362285 - head/sys/dev/pci
On Wed, 17 Jun 2020 at 15:56, Andrew Turner wrote: > > Author: andrew > Date: Wed Jun 17 19:56:17 2020 > New Revision: 362285 > URL: https://svnweb.freebsd.org/changeset/base/362285 > > Log: > Clean up the pci host generic driver ... > > + /* Translate the address from a PCI address to a physical address */ > + switch (type) { > + case SYS_RES_IOPORT: > + case SYS_RES_MEMORY: > + found = false; > + for (i = 0; i < MAX_RANGES_TUPLES; i++) { > + pci_base = sc->ranges[i].pci_base; > + phys_base = sc->ranges[i].phys_base; > + size = sc->ranges[i].size; > + > + if (start < pci_base || start >= pci_base + size) > + continue; Should the second condition be end instead? markj had this comment on the old version in review D20884. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r362318 - head/usr.bin/tee
On 6/18/20 2:32 PM, Fernando Apesteguía wrote: > On Thu, Jun 18, 2020 at 12:56 PM Yuri Pankov wrote: >> >> Fernando Apesteguía wrote: >>> Author: fernape (ports committer) >>> Date: Thu Jun 18 10:48:37 2020 >>> New Revision: 362318 >>> URL: https://svnweb.freebsd.org/changeset/base/362318 >>> >>> Log: >>>tee(1): Add EXAMPLES section [...] >>> +Send echoed message both to stdout and to the greetings file: >> >> Should this be like the following, at least to get the filename right? >> >> Send echoed message both to stdout and to the file >> .Pa greetings.txt : > > It is probably better. > > I'm not a src/docs committer. Do you want me to create a new review for this? Please do, feel free to add me as a reviewer :) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r362318 - head/usr.bin/tee
On Thu, Jun 18, 2020 at 12:56 PM Yuri Pankov wrote: > > Fernando Apesteguía wrote: > > Author: fernape (ports committer) > > Date: Thu Jun 18 10:48:37 2020 > > New Revision: 362318 > > URL: https://svnweb.freebsd.org/changeset/base/362318 > > > > Log: > >tee(1): Add EXAMPLES section > > > >Probably the simplest one ever. > > > >Approved by: gbe@, 0mp@ > >Differential Revision: https://reviews.freebsd.org/D25206 > > > > Modified: > >head/usr.bin/tee/tee.1 > > > > Modified: head/usr.bin/tee/tee.1 > > == > > --- head/usr.bin/tee/tee.1Thu Jun 18 10:47:30 2020(r362317) > > +++ head/usr.bin/tee/tee.1Thu Jun 18 10:48:37 2020(r362318) > > @@ -31,7 +31,7 @@ > > .\" @(#)tee.1 8.1 (Berkeley) 6/6/93 > > .\" $FreeBSD$ > > .\" > > -.Dd November 13, 2007 > > +.Dd June 18, 2020 > > .Dt TEE 1 > > .Os > > .Sh NAME > > @@ -74,6 +74,12 @@ except in the event of the > > option. > > .Sh EXIT STATUS > > .Ex -std > > +.Sh EXAMPLES > > +Send echoed message both to stdout and to the greetings file: > > Should this be like the following, at least to get the filename right? > > Send echoed message both to stdout and to the file > .Pa greetings.txt : It is probably better. I'm not a src/docs committer. Do you want me to create a new review for this? > > > +.Bd -literal -offset indent > > +$ echo "Hello" | tee greetings.txt > > +Hello > > +.Ed > > .Sh STANDARDS > > The > > .Nm > > > ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362324 - head/usr.bin/fstat
Author: 0mp (doc,ports committer) Date: Thu Jun 18 11:18:26 2020 New Revision: 362324 URL: https://svnweb.freebsd.org/changeset/base/362324 Log: Clean up and improve manual page for fuser(1) - Mention option's arguments in the list of options (so that now we mention "-N system" instead of just "-N"). - Stylize signals and other constants like O_APPEND with Dv. - Sort options. - Change indentation width for readability. - Fix a couple of typos. - Sort symbols list. - Use Sy instead of Cm for symbols. They are not command modifiers. - Use Ex -std in the EXIT STATUS section for consistency with other manual pages. - Use Ql instead of Dq Li for inline code examples as Li has recently been deprecated by mdoc. Reviewed by: bcr MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D25332 Modified: head/usr.bin/fstat/fuser.1 Modified: head/usr.bin/fstat/fuser.1 == --- head/usr.bin/fstat/fuser.1 Thu Jun 18 10:55:46 2020(r362323) +++ head/usr.bin/fstat/fuser.1 Thu Jun 18 11:18:26 2020(r362324) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 13, 2011 +.Dd June 18, 2020 .Dt FUSER 1 .Os .Sh NAME @@ -57,63 +57,63 @@ utility will also look through mmapped files. The following options are available: .Bl -tag -width indent .It Fl c -Treat files as mount point and report on any files open in the file system. +Treat files as mount points and report on any files open in the file system. .It Fl f The report must be only for named files. .It Fl k Send signal to reported processes -.Pq SIGKILL by default . -.It Fl m -Search through mmapped files too. -.It Fl u -Write the user name associated with each process to stderr. -.It Fl M +.Pq Dv SIGKILL No by default . +.It Fl M Ar core Extract values associated with the name list from the specified core instead of the default .Pa /dev/kmem . -.It Fl N +.It Fl m +Search through mmapped files too. +.It Fl N Ar system Extract the name list from the specified system instead of the default, which is the kernel image the system has booted from. -.It Fl s -Use given signal name instead of default SIGKILL. +.It Fl s Ar signal +Use given signal name instead of default +.Dv SIGKILL . +.It Fl u +Write the user name associated with each process to stderr. .El .Pp -The following symbols, written to stderr will indicate how files is used: -.Bl -tag -width MOUNT -.It Cm r -The file is the root directory of the process. -.It Cm c -The file is the current workdir directory of the process. -.It Cm j -The file is the jail-root of the process. -.It Cm t -The file is the kernel tracing file for the process. -.It Cm x -The file is executable text of the process. -.It Cm y -The process use this file as its controlling tty. -.It Cm m -The file is mmapped. -.It Cm w -The file is open for writing. -.It Cm a +The following symbols, written to stderr will indicate how files are used: +.Pp +.Bl -tag -width indent -compact +.It Sy a The file is open as append only -.Pq O_APPEND was specified . -.It Cm d +.Pq Dv O_APPEND No was specified . +.It Sy c +The file is the current workdir directory of the process. +.It Sy d The process bypasses fs cache while writing to this file -.Pq O_DIRECT was specified . -.It Cm s -Shared lock is hold. -.It Cm e +.Pq Dv O_DIRECT No was specified . +.It Sy e Exclusive lock is hold. +.It Sy j +The file is the jail root of the process. +.It Sy m +The file is mmapped. +.It Sy r +The file is the root directory of the process. +.It Sy s +Shared lock is hold. +.It Sy t +The file is the kernel tracing file for the process. +.It Sy w +The file is open for writing. +.It Sy x +The file is executable text of the process. +.It Sy y +The process uses this file as its controlling tty. .El .Sh EXIT STATUS -The -.Nm -utility returns 0 on successful completion and >0 otherwise. +.Ex -std .Sh EXAMPLES -The command: -.Dq Li "fuser -fu ." +The command +.Ql "fuser -fu \&." writes to standard output the process IDs of processes that are using the current directory and writes to stderr an indication of how those processes are using the directory and user names associated with the processes that are using ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r362318 - head/usr.bin/tee
Fernando Apesteguía wrote: Author: fernape (ports committer) Date: Thu Jun 18 10:48:37 2020 New Revision: 362318 URL: https://svnweb.freebsd.org/changeset/base/362318 Log: tee(1): Add EXAMPLES section Probably the simplest one ever. Approved by: gbe@, 0mp@ Differential Revision: https://reviews.freebsd.org/D25206 Modified: head/usr.bin/tee/tee.1 Modified: head/usr.bin/tee/tee.1 == --- head/usr.bin/tee/tee.1 Thu Jun 18 10:47:30 2020(r362317) +++ head/usr.bin/tee/tee.1 Thu Jun 18 10:48:37 2020(r362318) @@ -31,7 +31,7 @@ .\" @(#)tee.18.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd November 13, 2007 +.Dd June 18, 2020 .Dt TEE 1 .Os .Sh NAME @@ -74,6 +74,12 @@ except in the event of the option. .Sh EXIT STATUS .Ex -std +.Sh EXAMPLES +Send echoed message both to stdout and to the greetings file: Should this be like the following, at least to get the filename right? Send echoed message both to stdout and to the file .Pa greetings.txt : +.Bd -literal -offset indent +$ echo "Hello" | tee greetings.txt +Hello +.Ed .Sh STANDARDS The .Nm ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362321 - head/usr.sbin/periodic
Author: 0mp (doc,ports committer) Date: Thu Jun 18 10:52:51 2020 New Revision: 362321 URL: https://svnweb.freebsd.org/changeset/base/362321 Log: Improve periodic(8) manual page presentation - Update synopsis to present all available arguments. - Consistently call the argument specifying an arbitrary directory a "directory". - Do not put macros into -width argument to Bl. They do not expand there. - Stylize command modifiers like "daily" with Cm instead of Pa. While technically periodic(8) operates on directories with such names, it is confusing from the perspective of the manual page reader as Pa and Ar are stylized the same way. Also, I cannot recall a single manual page where Pa would be used to describe the syntax of command-line arguments. MFC after:2 weeks Modified: head/usr.sbin/periodic/periodic.8 Modified: head/usr.sbin/periodic/periodic.8 == --- head/usr.sbin/periodic/periodic.8 Thu Jun 18 10:50:59 2020 (r362320) +++ head/usr.sbin/periodic/periodic.8 Thu Jun 18 10:52:51 2020 (r362321) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 20, 2016 +.Dd June 18, 2020 .Dt PERIODIC 8 .Os .Sh NAME @@ -32,7 +32,10 @@ .Nd run periodic system functions .Sh SYNOPSIS .Nm -.Ar directory ... +.Sm off +.Cm daily | weekly | monthly | security | Ar directory +.Sm on +.Ar ... .Sh DESCRIPTION The .Nm @@ -42,22 +45,22 @@ to execute shell scripts located in the specified directory. .Pp One or more of the following arguments must be specified: -.Bl -tag -width ".Pa monthly" -.It Pa daily +.Bl -tag -width "directory" +.It Cm daily Perform the standard daily periodic executable run. This usually occurs early in the morning (local time). -.It Pa weekly +.It Cm weekly Perform the standard weekly periodic executable run. This usually occurs very early on Saturday mornings. -.It Pa monthly +.It Cm monthly Perform the standard monthly periodic executable run. This usually occurs on the first day of the month. -.It Pa security +.It Cm security Perform the standard daily security checks. This is usually spawned by the -.Pa daily +.Cm daily run. -.It Ar path +.It Ar directory An arbitrary directory containing a set of executables to be run. .El .Pp ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362318 - head/usr.bin/tee
Author: fernape (ports committer) Date: Thu Jun 18 10:48:37 2020 New Revision: 362318 URL: https://svnweb.freebsd.org/changeset/base/362318 Log: tee(1): Add EXAMPLES section Probably the simplest one ever. Approved by: gbe@, 0mp@ Differential Revision:https://reviews.freebsd.org/D25206 Modified: head/usr.bin/tee/tee.1 Modified: head/usr.bin/tee/tee.1 == --- head/usr.bin/tee/tee.1 Thu Jun 18 10:47:30 2020(r362317) +++ head/usr.bin/tee/tee.1 Thu Jun 18 10:48:37 2020(r362318) @@ -31,7 +31,7 @@ .\" @(#)tee.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd November 13, 2007 +.Dd June 18, 2020 .Dt TEE 1 .Os .Sh NAME @@ -74,6 +74,12 @@ except in the event of the option. .Sh EXIT STATUS .Ex -std +.Sh EXAMPLES +Send echoed message both to stdout and to the greetings file: +.Bd -literal -offset indent +$ echo "Hello" | tee greetings.txt +Hello +.Ed .Sh STANDARDS The .Nm ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362299 - head/usr.bin/lockf
Author: fernape (ports committer) Date: Thu Jun 18 08:31:04 2020 New Revision: 362299 URL: https://svnweb.freebsd.org/changeset/base/362299 Log: lockf(1): Add EXAMPLES section * Add pretty small EXAMPLES section * While here, fix a warning in line 98 (new sentence in new line) Approved by: bcr@ Differential Revision:https://reviews.freebsd.org/D25205 Modified: head/usr.bin/lockf/lockf.1 Modified: head/usr.bin/lockf/lockf.1 == --- head/usr.bin/lockf/lockf.1 Thu Jun 18 08:26:26 2020(r362298) +++ head/usr.bin/lockf/lockf.1 Thu Jun 18 08:31:04 2020(r362299) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 7, 1998 +.Dd June 18, 2020 .Dt LOCKF 1 .Os .Sh NAME @@ -95,7 +95,8 @@ Causes .Nm to fail if the specified lock .Ar file -does not exist. If +does not exist. +If .Fl n is not specified, .Nm @@ -160,6 +161,25 @@ The did not exit normally, but may have been signaled or stopped. .El +.Sh EXAMPLES +The first job takes a lock and sleeps for 5 seconds in the background. +The second job tries to get the lock and timeouts after 1 second (PID numbers +will differ): +.Bd -literal -offset indent +$ lockf mylock sleep 5 & lockf -t 1 mylock echo "Success" +[1] 94410 +lockf: mylock: already locked +.Ed +.Pp +The first job takes a lock and sleeps for 1 second in the background. +The second job waits up to 5 seconds to take the lock and echoes the message on +success (PID numbers will differ): +.Bd -literal -offset indent +$ lockf mylock sleep 1 & lockf -t 5 mylock echo "Success" +[1] 19995 +Success +[1]+ Donelockf mylock sleep 1 +.Ed .Sh SEE ALSO .Xr flock 2 , .Xr lockf 3 , ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362298 - head/usr.bin/nl
Author: fernape (ports committer) Date: Thu Jun 18 08:26:26 2020 New Revision: 362298 URL: https://svnweb.freebsd.org/changeset/base/362298 Log: nl(1): Add EXAMPLES section Add EXAMPLES section covering flags -b[ap] -n -i -s -v Approved by: bcr@ Differential Revision:Add EXAMPLES section covering flags -b[ap] -n -i -s -v Modified: head/usr.bin/nl/nl.1 Modified: head/usr.bin/nl/nl.1 == --- head/usr.bin/nl/nl.1Thu Jun 18 07:35:18 2020(r362297) +++ head/usr.bin/nl/nl.1Thu Jun 18 08:26:26 2020(r362298) @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd May 4, 2014 +.Dd June 18, 2020 .Dt NL 1 .Os .Sh NAME @@ -230,6 +230,42 @@ as described in .Xr environ 7 . .Sh EXIT STATUS .Ex -std +.Sh EXAMPLES +Number all non-blank lines: +.Bd -literal -offset indent +$ echo -e "This is\\n\\n\\na simple text" | nl + 1 This is + + + 2 a simple text +.Ed +.Pp +Number all lines including blank ones, with right justified line numbers with +leading zeroes, starting at 2, with increment of 2 and a custom multi-character +separator: +.Bd -literal -offset indent +$ echo -e "This\\nis\\nan\\n\\n\\nexample" | nl -ba -n rz -i2 -s "->" -v2 +02->This +04->is +06->an +08-> +10-> +12->example +.Ed +.Pp +Number lines matching regular expression for an +.Em i +.No followed by either +.Em m +.No or +.Em n +.Bd -literal -offset indent +$ echo -e "This is\\na simple text\\nwith multiple\\nlines" | nl -bp'i[mn]' +This is + 1 a simple text +with multiple + 2 lines +.Ed .Sh SEE ALSO .Xr jot 1 , .Xr pr 1 ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362295 - head/sys/dev/pci
Author: andrew Date: Thu Jun 18 06:21:00 2020 New Revision: 362295 URL: https://svnweb.freebsd.org/changeset/base/362295 Log: Stop assuming we can print rman_res_t with %lx This is not the case on armv6 and armv7, where we also build this driver. Fix by casting through uintmax_t and using %jx. Sponsored by: Innovate UK Modified: head/sys/dev/pci/pci_host_generic.c Modified: head/sys/dev/pci/pci_host_generic.c == --- head/sys/dev/pci/pci_host_generic.c Thu Jun 18 06:12:06 2020 (r362294) +++ head/sys/dev/pci/pci_host_generic.c Thu Jun 18 06:21:00 2020 (r362295) @@ -386,9 +386,10 @@ pci_host_generic_core_alloc_resource(device_t dev, dev } if (!found) { device_printf(dev, - "Failed to allocate %s resource %lx-%lx for %s\n", + "Failed to allocate %s resource %jx-%jx for %s\n", type == SYS_RES_IOPORT ? "IOPORT" : "MEMORY", - start, end, device_get_nameunit(child)); + (uintmax_t)start, (uintmax_t)end, + device_get_nameunit(child)); return (NULL); } break; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362294 - head/sys/dev/sound/pci/hda
Author: avg Date: Thu Jun 18 06:12:06 2020 New Revision: 362294 URL: https://svnweb.freebsd.org/changeset/base/362294 Log: hdac_intr_handler: keep working until global interrupt status clears It is plausible that the hardware interrupts a host only when GIS goes from zero to one. GIS is formed by OR-ing multiple hardware statuses, so it's possible that a previously cleared status gets set again while another status has not been cleared yet. Thus, there will be no new interrupt as GIS always stayed set. If we don't re-examine GIS then we can leave it set and never get another interrupt again. Without this change I frequently saw a problem where snd_hda would stop working. Setting dev.hdac.1.polling=1 would bring it back to life and afterwards I could set polling back to zero. Sometimes the problem started right after a boot, sometimes it happened after resuming from S3, frequently it would occur when sound output and input are active concurrently (such as during conferencing). I looked at HDAC_INTSTS while the sound was not working and I saw that both HDAC_INTSTS_GIS and HDAC_INTSTS_CIS were set, but there were no interrupts. I have collected some statistics over a period of several days about how many loops (calls to hdac_one_intr) the new code did for a single interrupt: ++--+ |Loops |Times Happened| ++--+ |0 |301 | |1 |12857746 | |2 |280 | |3 |2 | |4+ |0 | ++--+ I believe that previously the sound would get stuck each time we had to loop more than once. The tested hardware is: hdac1: mem 0xfe68-0xfe687fff at device 0.6 on pci4 hdacc1: at cad 0 on hdac1 No objections:mav MFC after:5 weeks Differential Revision: https://reviews.freebsd.org/D25128 Modified: head/sys/dev/sound/pci/hda/hdac.c Modified: head/sys/dev/sound/pci/hda/hdac.c == --- head/sys/dev/sound/pci/hda/hdac.c Wed Jun 17 23:41:04 2020 (r362293) +++ head/sys/dev/sound/pci/hda/hdac.c Thu Jun 18 06:12:06 2020 (r362294) @@ -303,30 +303,13 @@ hdac_config_fetch(struct hdac_softc *sc, uint32_t *on, } } -/ - * void hdac_intr_handler(void *) - * - * Interrupt handler. Processes interrupts received from the hdac. - / static void -hdac_intr_handler(void *context) +hdac_one_intr(struct hdac_softc *sc, uint32_t intsts) { - struct hdac_softc *sc; device_t dev; - uint32_t intsts; uint8_t rirbsts; int i; - sc = (struct hdac_softc *)context; - hdac_lock(sc); - - /* Do we have anything to do? */ - intsts = HDAC_READ_4(>mem, HDAC_INTSTS); - if ((intsts & HDAC_INTSTS_GIS) == 0) { - hdac_unlock(sc); - return; - } - /* Was this a controller interrupt? */ if (intsts & HDAC_INTSTS_CIS) { rirbsts = HDAC_READ_1(>mem, HDAC_RIRBSTS); @@ -346,16 +329,45 @@ hdac_intr_handler(void *context) if ((intsts & (1 << i)) == 0) continue; HDAC_WRITE_1(>mem, (i << 5) + HDAC_SDSTS, - HDAC_SDSTS_DESE | HDAC_SDSTS_FIFOE | HDAC_SDSTS_BCIS ); + HDAC_SDSTS_DESE | HDAC_SDSTS_FIFOE | HDAC_SDSTS_BCIS); if ((dev = sc->streams[i].dev) != NULL) { HDAC_STREAM_INTR(dev, sc->streams[i].dir, sc->streams[i].stream); } } } +} - HDAC_WRITE_4(>mem, HDAC_INTSTS, intsts); - hdac_unlock(sc); +/ + * void hdac_intr_handler(void *) + * + * Interrupt handler. Processes interrupts received from the hdac. + / +static void +hdac_intr_handler(void *context) +{ + struct hdac_softc *sc; + uint32_t intsts; + + sc = (struct hdac_softc *)context; + + /* +* Loop until HDAC_INTSTS_GIS gets clear. +* It is plausible that hardware interrupts a host only when GIS goes +* from zero to one. GIS is formed by OR-ing multiple hardware +* statuses, so it's possible that a previously cleared status gets set +* again while another status has not been cleared yet. Thus, there +* will be no new interrupt as GIS always stayed set. If we don't +* re-examine GIS then we can leave it set and never get an interrupt +* again. +*/ + intsts = HDAC_READ_4(>mem,