svn commit: r363069 - head/sys/kern
Author: mjg Date: Fri Jul 10 06:47:58 2020 New Revision: 363069 URL: https://svnweb.freebsd.org/changeset/base/363069 Log: vfs: depessimize getfsstat when only the count is requested This avoids relocking mountlist_mtx for each entry. Modified: head/sys/kern/vfs_syscalls.c Modified: head/sys/kern/vfs_syscalls.c == --- head/sys/kern/vfs_syscalls.cFri Jul 10 06:46:42 2020 (r363068) +++ head/sys/kern/vfs_syscalls.cFri Jul 10 06:47:58 2020 (r363069) @@ -441,7 +441,46 @@ restart: tofree = sfsp = *buf = malloc(maxcount * sizeof(struct statfs), M_STATFS, M_WAITOK); } + count = 0; + + /* +* If there is no target buffer they only want the count. +* +* This could be TAILQ_FOREACH but it is open-coded to match the original +* code below. +*/ + if (sfsp == NULL) { + mtx_lock(&mountlist_mtx); + for (mp = TAILQ_FIRST(&mountlist); mp != NULL; mp = nmp) { + if (prison_canseemount(td->td_ucred, mp) != 0) { + nmp = TAILQ_NEXT(mp, mnt_list); + continue; + } +#ifdef MAC + if (mac_mount_check_stat(td->td_ucred, mp) != 0) { + nmp = TAILQ_NEXT(mp, mnt_list); + continue; + } +#endif + count++; + nmp = TAILQ_NEXT(mp, mnt_list); + } + mtx_unlock(&mountlist_mtx); + *countp = count; + return (0); + } + + /* +* They want the entire thing. +* +* Short-circuit the corner case of no room for anything, avoids +* relocking below. +*/ + if (maxcount < 1) { + goto out; + } + mtx_lock(&mountlist_mtx); for (mp = TAILQ_FIRST(&mountlist); mp != NULL; mp = nmp) { if (prison_canseemount(td->td_ucred, mp) != 0) { @@ -473,53 +512,55 @@ restart: continue; } } - if (sfsp != NULL && count < maxcount) { - sp = &mp->mnt_stat; - /* -* If MNT_NOWAIT is specified, do not refresh -* the fsstat cache. -*/ - if (mode != MNT_NOWAIT) { - error = VFS_STATFS(mp, sp); - if (error != 0) { - mtx_lock(&mountlist_mtx); - nmp = TAILQ_NEXT(mp, mnt_list); - vfs_unbusy(mp); - continue; - } + sp = &mp->mnt_stat; + /* +* If MNT_NOWAIT is specified, do not refresh +* the fsstat cache. +*/ + if (mode != MNT_NOWAIT) { + error = VFS_STATFS(mp, sp); + if (error != 0) { + mtx_lock(&mountlist_mtx); + nmp = TAILQ_NEXT(mp, mnt_list); + vfs_unbusy(mp); + continue; } - if (priv_check_cred_vfs_generation(td->td_ucred)) { - sptmp = malloc(sizeof(struct statfs), M_STATFS, - M_WAITOK); - *sptmp = *sp; - sptmp->f_fsid.val[0] = sptmp->f_fsid.val[1] = 0; - prison_enforce_statfs(td->td_ucred, mp, sptmp); - sp = sptmp; - } else - sptmp = NULL; - if (bufseg == UIO_SYSSPACE) { - bcopy(sp, sfsp, sizeof(*sp)); - free(sptmp, M_STATFS); - } else /* if (bufseg == UIO_USERSPACE) */ { - error = copyout(sp, sfsp, sizeof(*sp)); - free(sptmp, M_STATFS); - if (error != 0) { - vfs_unbusy(mp); - return (error); - } + } + if (priv_check_cred_vfs_generation(td->td_ucred)) { + sptmp = malloc(sizeof(struct statfs), M_STATFS, + M_WAITOK); + *sptmp = *sp; + sptmp->f_fsid.val[0] = sptmp->f_fsid.val[1] = 0; + prison_enforce_statfs(td->td_ucred
svn commit: r363068 - head/sys/kern
Author: mjg Date: Fri Jul 10 06:46:42 2020 New Revision: 363068 URL: https://svnweb.freebsd.org/changeset/base/363068 Log: vfs: avoid spurious memcpy in vfs_statfs It is quite often called for the very same buffer. Modified: head/sys/kern/vfs_mount.c Modified: head/sys/kern/vfs_mount.c == --- head/sys/kern/vfs_mount.c Fri Jul 10 00:45:34 2020(r363067) +++ head/sys/kern/vfs_mount.c Fri Jul 10 06:46:42 2020(r363068) @@ -2173,7 +2173,8 @@ __vfs_statfs(struct mount *mp, struct statfs *sbp) * Filesystems only fill in part of the structure for updates, we * have to read the entirety first to get all content. */ - memcpy(sbp, &mp->mnt_stat, sizeof(*sbp)); + if (sbp != &mp->mnt_stat) + memcpy(sbp, &mp->mnt_stat, sizeof(*sbp)); /* * Set these in case the underlying filesystem fails to do so. ___ 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: r363067 - head/usr.bin/xinstall
Author: eugen Date: Fri Jul 10 00:45:34 2020 New Revision: 363067 URL: https://svnweb.freebsd.org/changeset/base/363067 Log: install(1): correction after r363064 Make it not break if STRIPBIN points to strip version without -o support. In that case, perform extra copy just like before r363064. MFC after:1 month X-MFC-With: 363064 Modified: head/usr.bin/xinstall/xinstall.c Modified: head/usr.bin/xinstall/xinstall.c == --- head/usr.bin/xinstall/xinstall.cFri Jul 10 00:45:16 2020 (r363066) +++ head/usr.bin/xinstall/xinstall.cFri Jul 10 00:45:34 2020 (r363067) @@ -863,7 +863,7 @@ install(const char *from_name, const char *to_name, u_ if (dostrip) stripped = strip(tempcopy ? tempfile : to_name, from_name, &digestresult); - else + if (!stripped) digestresult = copy(from_fd, from_name, to_fd, tempcopy ? tempfile : to_name, from_sb.st_size); } ___ 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: r363066 - in head: lib/libc/sys sys/compat/linux tests/sys/kern
Author: kevans Date: Fri Jul 10 00:45:16 2020 New Revision: 363066 URL: https://svnweb.freebsd.org/changeset/base/363066 Log: memfd_create: turn on SHM_GROW_ON_WRITE memfd_create fds will no longer require an ftruncate(2) to set the size; they'll grow (to the extent that it's possible) upon write(2)-like syscalls. Reviewed by: kib Differential Revision:https://reviews.freebsd.org/D25502 Modified: head/lib/libc/sys/shm_open.c head/sys/compat/linux/linux_file.c head/tests/sys/kern/memfd_test.c Modified: head/lib/libc/sys/shm_open.c == --- head/lib/libc/sys/shm_open.cFri Jul 10 00:43:45 2020 (r363065) +++ head/lib/libc/sys/shm_open.cFri Jul 10 00:45:16 2020 (r363066) @@ -84,7 +84,7 @@ memfd_create(const char *name, unsigned int flags) /* We've already validated that we're sufficiently sized. */ snprintf(memfd_name, NAME_MAX + 1, "%s%s", MEMFD_NAME_PREFIX, name); oflags = O_RDWR; - shmflags = 0; + shmflags = SHM_GROW_ON_WRITE; if ((flags & MFD_CLOEXEC) != 0) oflags |= O_CLOEXEC; if ((flags & MFD_ALLOW_SEALING) != 0) Modified: head/sys/compat/linux/linux_file.c == --- head/sys/compat/linux/linux_file.c Fri Jul 10 00:43:45 2020 (r363065) +++ head/sys/compat/linux/linux_file.c Fri Jul 10 00:45:16 2020 (r363066) @@ -1758,7 +1758,7 @@ linux_memfd_create(struct thread *td, struct linux_mem if ((flags & MFD_HUGETLB) != 0) return (ENOSYS); oflags = O_RDWR; - shmflags = 0; + shmflags = SHM_GROW_ON_WRITE; if ((flags & MFD_CLOEXEC) != 0) oflags |= O_CLOEXEC; if ((flags & MFD_ALLOW_SEALING) != 0) Modified: head/tests/sys/kern/memfd_test.c == --- head/tests/sys/kern/memfd_test.cFri Jul 10 00:43:45 2020 (r363065) +++ head/tests/sys/kern/memfd_test.cFri Jul 10 00:45:16 2020 (r363066) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -38,18 +39,26 @@ __FBSDID("$FreeBSD$"); ATF_TC_WITHOUT_HEAD(basic); ATF_TC_BODY(basic, tc) { + struct stat sb; int fd; char buf[8]; ATF_REQUIRE((fd = memfd_create("...", 0)) != -1); - /* File size should be initially 0 */ - ATF_REQUIRE(write(fd, buf, sizeof(buf)) == 0); + /* write(2) should grow us out automatically. */ + ATF_REQUIRE(write(fd, buf, sizeof(buf)) == sizeof(buf)); + ATF_REQUIRE(fstat(fd, &sb) == 0); + ATF_REQUIRE(sb.st_size == sizeof(buf)); /* ftruncate(2) must succeed without seals */ - ATF_REQUIRE(ftruncate(fd, sizeof(buf) - 1) == 0); + ATF_REQUIRE(ftruncate(fd, 2 * (sizeof(buf) - 1)) == 0); - ATF_REQUIRE(write(fd, buf, sizeof(buf)) == sizeof(buf) - 1); + /* write(2) again must not be limited by ftruncate(2) size. */ + ATF_REQUIRE(write(fd, buf, sizeof(buf)) == sizeof(buf)); + + /* Sanity check. */ + ATF_REQUIRE(fstat(fd, &sb) == 0); + ATF_REQUIRE(sb.st_size == 2 * sizeof(buf)); close(fd); } ___ 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: r363065 - in head/sys: kern sys
Author: kevans Date: Fri Jul 10 00:43:45 2020 New Revision: 363065 URL: https://svnweb.freebsd.org/changeset/base/363065 Log: shm_open2: Implement SHM_GROW_ON_WRITE Lack of SHM_GROW_ON_WRITE is actively breaking Python's memfd_create tests, so go ahead and implement it. A future change will make memfd_create always set SHM_GROW_ON_WRITE, to match Linux behavior and unbreak Python's tests on -CURRENT. Reviewed by: kib Differential Revision:https://reviews.freebsd.org/D25502 Modified: head/sys/kern/uipc_shm.c head/sys/sys/mman.h Modified: head/sys/kern/uipc_shm.c == --- head/sys/kern/uipc_shm.cFri Jul 10 00:24:42 2020(r363064) +++ head/sys/kern/uipc_shm.cFri Jul 10 00:43:45 2020(r363065) @@ -313,6 +313,7 @@ shm_write(struct file *fp, struct uio *uio, struct ucr struct shmfd *shmfd; void *rl_cookie; int error; + off_t size; shmfd = fp->f_data; #ifdef MAC @@ -321,17 +322,42 @@ shm_write(struct file *fp, struct uio *uio, struct ucr return (error); #endif foffset_lock_uio(fp, uio, flags); + if (uio->uio_resid > OFF_MAX - uio->uio_offset) { + /* +* Overflow is only an error if we're supposed to expand on +* write. Otherwise, we'll just truncate the write to the +* size of the file, which can only grow up to OFF_MAX. +*/ + if ((shmfd->shm_flags & SHM_GROW_ON_WRITE) != 0) { + foffset_unlock_uio(fp, uio, flags); + return (EFBIG); + } + + size = shmfd->shm_size; + } else { + size = uio->uio_offset + uio->uio_resid; + } if ((flags & FOF_OFFSET) == 0) { rl_cookie = rangelock_wlock(&shmfd->shm_rl, 0, OFF_MAX, &shmfd->shm_mtx); } else { rl_cookie = rangelock_wlock(&shmfd->shm_rl, uio->uio_offset, - uio->uio_offset + uio->uio_resid, &shmfd->shm_mtx); + size, &shmfd->shm_mtx); } - if ((shmfd->shm_seals & F_SEAL_WRITE) != 0) + if ((shmfd->shm_seals & F_SEAL_WRITE) != 0) { error = EPERM; - else - error = uiomove_object(shmfd->shm_object, shmfd->shm_size, uio); + } else { + error = 0; + if ((shmfd->shm_flags & SHM_GROW_ON_WRITE) != 0 && + size > shmfd->shm_size) { + VM_OBJECT_WLOCK(shmfd->shm_object); + error = shm_dotruncate_locked(shmfd, size, rl_cookie); + VM_OBJECT_WUNLOCK(shmfd->shm_object); + } + if (error == 0) + error = uiomove_object(shmfd->shm_object, + shmfd->shm_size, uio); + } rangelock_unlock(&shmfd->shm_rl, rl_cookie, &shmfd->shm_mtx); foffset_unlock_uio(fp, uio, flags); return (error); @@ -748,7 +774,7 @@ kern_shm_open2(struct thread *td, const char *userpath mode_t cmode; int error, fd, initial_seals; - if ((shmflags & ~SHM_ALLOW_SEALING) != 0) + if ((shmflags & ~(SHM_ALLOW_SEALING | SHM_GROW_ON_WRITE)) != 0) return (EINVAL); initial_seals = F_SEAL_SEAL; @@ -921,6 +947,7 @@ kern_shm_open2(struct thread *td, const char *userpath } } + shmfd->shm_flags = shmflags; finit(fp, FFLAGS(flags & O_ACCMODE), DTYPE_SHM, shmfd, &shm_ops); td->td_retval[0] = fd; Modified: head/sys/sys/mman.h == --- head/sys/sys/mman.h Fri Jul 10 00:24:42 2020(r363064) +++ head/sys/sys/mman.h Fri Jul 10 00:43:45 2020(r363065) @@ -190,6 +190,7 @@ * shmflags for shm_open2() */ #defineSHM_ALLOW_SEALING 0x0001 +#defineSHM_GROW_ON_WRITE 0x0002 /* * Flags for memfd_create(). @@ -278,6 +279,7 @@ struct shmfd { struct rangelock shm_rl; struct mtx shm_mtx; + int shm_flags; int shm_seals; }; #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: r363064 - head/usr.bin/xinstall
Author: eugen Date: Fri Jul 10 00:24:42 2020 New Revision: 363064 URL: https://svnweb.freebsd.org/changeset/base/363064 Log: Optimize install(1) a bit. Currently, "install -s -S" behaviour is inefficient for upgrade. First it finds that destination file already exists and copies source file to temporary file. Then it calls strip(1) with name of temporary file as single agrument and our strip(1) creates another temporary file in the /tmp (or TMPDIR) making another copy that is finally copied to DESTDIR third time. Meantime, strip(1) has an option "-o dst" to specify destination so install(1) is allowed to skip initial copying from obj to DESTDIR. This change makes it do so. Take a look at https://reviews.freebsd.org/D25551 for details and efficiency numbers (in short: upto 32% gained for installword). MFC after:1 month Differential Revision:https://reviews.freebsd.org/D25551 Modified: head/usr.bin/xinstall/xinstall.c Modified: head/usr.bin/xinstall/xinstall.c == --- head/usr.bin/xinstall/xinstall.cFri Jul 10 00:24:06 2020 (r363063) +++ head/usr.bin/xinstall/xinstall.cFri Jul 10 00:24:42 2020 (r363064) @@ -147,7 +147,7 @@ static void install_dir(char *); static voidmetadata_log(const char *, const char *, struct timespec *, const char *, const char *, off_t); static int parseid(const char *, id_t *); -static voidstrip(const char *); +static int strip(const char *, const char *, char **); static int trymmap(int); static voidusage(void); @@ -767,12 +767,13 @@ install(const char *from_name, const char *to_name, u_ { struct stat from_sb, temp_sb, to_sb; struct timespec tsb[2]; - int devnull, files_match, from_fd, serrno, target; + int devnull, files_match, from_fd, serrno, stripped, target; int tempcopy, temp_fd, to_fd; char backup[MAXPATHLEN], *p, pathbuf[MAXPATHLEN], tempfile[MAXPATHLEN]; char *digestresult; - files_match = 0; + digestresult = NULL; + files_match = stripped = 0; from_fd = -1; to_fd = -1; @@ -858,19 +859,24 @@ install(const char *from_name, const char *to_name, u_ (void)printf("install: %s -> %s\n", from_name, to_name); } - if (!devnull) - digestresult = copy(from_fd, from_name, to_fd, -tempcopy ? tempfile : to_name, from_sb.st_size); - else - digestresult = NULL; + if (!devnull) { + if (dostrip) + stripped = strip(tempcopy ? tempfile : to_name, +from_name, &digestresult); + else + digestresult = copy(from_fd, from_name, to_fd, + tempcopy ? tempfile : to_name, from_sb.st_size); + } } if (dostrip) { - strip(tempcopy ? tempfile : to_name); + if (!stripped) + (void)strip(tempcopy ? tempfile : to_name, NULL, + &digestresult); /* -* Re-open our fd on the target, in case we used a strip -* that does not work in-place -- like GNU binutils strip. +* Re-open our fd on the target, in case +* we did not strip in-place. */ close(to_fd); to_fd = open(tempcopy ? tempfile : to_name, O_RDONLY, 0); @@ -1057,7 +1063,9 @@ install(const char *from_name, const char *to_name, u_ /* * compare -- - * compare two files; non-zero means files differ + * Compare two files; non-zero means files differ. + * Compute digest and return its address in *dresp + * unless it points to pre-computed digest. */ static int compare(int from_fd, const char *from_name __unused, size_t from_len, @@ -1066,15 +1074,17 @@ compare(int from_fd, const char *from_name __unused, s { char *p, *q; int rv; - int done_compare; + int do_digest, done_compare; DIGEST_CTX ctx; rv = 0; if (from_len != to_len) return 1; + do_digest = (digesttype != DIGEST_NONE && dresp != NULL && + *dresp == NULL); if (from_len <= MAX_CMP_SIZE) { - if (dresp != NULL) + if (do_digest) digest_init(&ctx); done_compare = 0; if (trymmap(from_fd) && trymmap(to_fd)) { @@ -1090,7 +1100,7 @@ compare(int from_fd, const char *from_name __unused, s } rv = memcmp(p, q, from_len); - if (dresp != NULL) +
svn commit: r363063 - head/stand/defaults
Author: imp Date: Fri Jul 10 00:24:06 2020 New Revision: 363063 URL: https://svnweb.freebsd.org/changeset/base/363063 Log: Properly backout r362998 Correct a small mistake in r363060's backaout of r362998 by reverse-applying r362998 by hand to loader.conf. Differential Revision: https://reviews.freebsd.org/D25606 Modified: head/stand/defaults/loader.conf Modified: head/stand/defaults/loader.conf == --- head/stand/defaults/loader.conf Fri Jul 10 00:03:06 2020 (r363062) +++ head/stand/defaults/loader.conf Fri Jul 10 00:24:06 2020 (r363063) @@ -49,12 +49,12 @@ entropy_cache_type="boot_entropy_cache" # Required for # must not change value even if the # _name above does change! -### RAM Excludelist configuration -ram_excludelist_load="NO" # Set this to YES to load a file +### RAM Blacklist configuration +ram_blacklist_load="NO"# Set this to YES to load a file # containing a list of addresses to # exclude from the running system. -ram_excludeist_name="/boot/excludelist.txt" # Set this to the name of the file -ram_excludelist_type="ram_excludelist" # Required for the kernel to find +ram_blacklist_name="/boot/blacklist.txt" # Set this to the name of the file +ram_blacklist_type="ram_blacklist" # Required for the kernel to find # the blacklist module ### Microcode loading configuration ___ 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: r363060 - in head: stand/defaults sys/amd64/amd64 sys/powerpc/aim sys/vm
On Thu, Jul 9, 2020 at 4:54 PM Oliver Pinter wrote: > > > On Friday, July 10, 2020, Scott Long wrote: > >> Author: scottl >> Date: Thu Jul 9 22:38:36 2020 >> New Revision: 363060 >> URL: https://svnweb.freebsd.org/changeset/base/363060 >> >> Log: >> Revert r362998, r326999 while a better compatibility strategy is >> devised. >> >> Modified: >> head/stand/defaults/loader.conf >> head/sys/amd64/amd64/pmap.c >> head/sys/powerpc/aim/mmu_radix.c >> head/sys/vm/vm_page.c >> head/sys/vm/vm_page.h >> >> Modified: head/stand/defaults/loader.conf >> >> == >> --- head/stand/defaults/loader.conf Thu Jul 9 20:55:18 2020 >> (r363059) >> +++ head/stand/defaults/loader.conf Thu Jul 9 22:38:36 2020 >> (r363060) >> @@ -53,7 +53,7 @@ entropy_cache_type="boot_entropy_cache" # >> Required for >> ram_excludelist_load="NO" # Set this to YES to load a file >> # containing a list of addresses >> to >> # exclude from the running system. >> -ram_excludelist_name="/boot/excludelist.txt" # Set this to the name of >> the file >> +ram_excludeist_name="/boot/excludelist.txt" # Set this to the name of >> the file > > > Hi! > > This part of the revert seems still broken. > I think youre correct. Can you look at https://reviews.freebsd.org/D25606 please and let me know if you think that's right? Warner > > >> ram_excludelist_type="ram_excludelist" # Required for the kernel to find >> # the blacklist module >> >> >> Modified: head/sys/amd64/amd64/pmap.c >> >> == >> --- head/sys/amd64/amd64/pmap.c Thu Jul 9 20:55:18 2020(r363059) >> +++ head/sys/amd64/amd64/pmap.c Thu Jul 9 22:38:36 2020(r363060) >> @@ -2060,7 +2060,7 @@ pmap_init(void) >> int error, i, ret, skz63; >> >> /* L1TF, reserve page @0 unconditionally */ >> - vm_page_excludelist_add(0, bootverbose); >> + vm_page_blacklist_add(0, bootverbose); >> >> /* Detect bare-metal Skylake Server and Skylake-X. */ >> if (vm_guest == VM_GUEST_NO && cpu_vendor_id == CPU_VENDOR_INTEL >> && >> @@ -2081,7 +2081,7 @@ pmap_init(void) >> printf("SKZ63: skipping 4M RAM starting " >> "at physical 1G\n"); >> for (i = 0; i < atop(0x40); i++) { >> - ret = vm_page_excludelist_add(0x4000 + >> + ret = vm_page_blacklist_add(0x4000 + >> ptoa(i), FALSE); >> if (!ret && bootverbose) >> printf("page at %#lx already >> used\n", >> >> Modified: head/sys/powerpc/aim/mmu_radix.c >> >> == >> --- head/sys/powerpc/aim/mmu_radix.cThu Jul 9 20:55:18 2020 >> (r363059) >> +++ head/sys/powerpc/aim/mmu_radix.cThu Jul 9 22:38:36 2020 >> (r363060) >> @@ -3557,7 +3557,7 @@ mmu_radix_init() >> int error, i, pv_npg; >> >> /* L1TF, reserve page @0 unconditionally */ >> - vm_page_excludelist_add(0, bootverbose); >> + vm_page_blacklist_add(0, bootverbose); >> >> zone_radix_pgd = uma_zcache_create("radix_pgd_cache", >> RADIX_PGD_SIZE, NULL, NULL, >> >> Modified: head/sys/vm/vm_page.c >> >> == >> --- head/sys/vm/vm_page.c Thu Jul 9 20:55:18 2020(r363059) >> +++ head/sys/vm/vm_page.c Thu Jul 9 22:38:36 2020(r363060) >> @@ -155,11 +155,10 @@ vm_page_t vm_page_array; >> long vm_page_array_size; >> long first_page; >> >> -static TAILQ_HEAD(, vm_page) excludelist_head; >> -static int sysctl_vm_page_excludelist(SYSCTL_HANDLER_ARGS); >> -SYSCTL_PROC(_vm, OID_AUTO, page_excludelist, CTLTYPE_STRING | CTLFLAG_RD >> | >> -CTLFLAG_MPSAFE, NULL, 0, sysctl_vm_page_excludelist, "A", >> -"Blacklist pages"); >> +static TAILQ_HEAD(, vm_page) blacklist_head; >> +static int sysctl_vm_page_blacklist(SYSCTL_HANDLER_ARGS); >> +SYSCTL_PROC(_vm, OID_AUTO, page_blacklist, CTLTYPE_STRING | CTLFLAG_RD | >> +CTLFLAG_MPSAFE, NULL, 0, sysctl_vm_page_blacklist, "A", "Blacklist >> pages"); >> >> static uma_zone_t fakepg_zone; >> >> @@ -259,16 +258,16 @@ vm_set_page_size(void) >> } >> >> /* >> - * vm_page_excludelist_next: >> + * vm_page_blacklist_next: >> * >> - * Find the next entry in the provided string of excludelist >> + * Find the next entry in the provided string of blacklist >> * addresses. Entries are separated by space, comma, or newline. >> * If an invalid integer is encountered then the rest of the >> * string is skipped.
svn commit: r363062 - head/sys/sys
Author: kevans Date: Fri Jul 10 00:03:06 2020 New Revision: 363062 URL: https://svnweb.freebsd.org/changeset/base/363062 Log: shmfd: make shm_size a vm_ooffset_t On 32-bit platforms, this expands the shm_size to a 64-bit quantity and resolves a mismatch between the shmfd size and underlying vm_object size. The implementation did not account for this kind of mismatch. Reviewed by: kib MFC after:1 week Differential Revision:https://reviews.freebsd.org/D25602 Modified: head/sys/sys/mman.h Modified: head/sys/sys/mman.h == --- head/sys/sys/mman.h Thu Jul 9 23:01:36 2020(r363061) +++ head/sys/sys/mman.h Fri Jul 10 00:03:06 2020(r363062) @@ -254,7 +254,7 @@ typedef __size_tsize_t; struct file; struct shmfd { - size_t shm_size; + vm_ooffset_tshm_size; vm_object_t shm_object; int shm_refs; uid_t shm_uid; ___ 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: r363061 - in head/usr.sbin/wpa: hostapd wpa_supplicant
Author: cy Date: Thu Jul 9 23:01:36 2020 New Revision: 363061 URL: https://svnweb.freebsd.org/changeset/base/363061 Log: Enable support for IEEE 802.11N, 802.11W, 802.11AC and 802.11.AX to hostapd and wpa_supplicant. Submitted by: bz MFC after:2 weeks Relnotes: yes Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate") Modified: head/usr.sbin/wpa/hostapd/Makefile head/usr.sbin/wpa/wpa_supplicant/Makefile Modified: head/usr.sbin/wpa/hostapd/Makefile == --- head/usr.sbin/wpa/hostapd/Makefile Thu Jul 9 22:38:36 2020 (r363060) +++ head/usr.sbin/wpa/hostapd/Makefile Thu Jul 9 23:01:36 2020 (r363061) @@ -45,11 +45,15 @@ SRCS= accounting.c \ ieee802_11.c \ ieee802_11_auth.c \ ieee802_11_common.c \ + ieee802_11_he.c \ + ieee802_11_ht.c \ ieee802_11_shared.c \ + ieee802_11_vht.c \ ieee802_1x.c \ ip_addr.c \ l2_packet_freebsd.c \ main.c \ + mbo_ap.c \ ms_funcs.c \ neighbor_db.c \ os_unix.c \ @@ -103,6 +107,11 @@ CFLAGS+=-I${.CURDIR:H}/wpa_supplicant \ -DCONFIG_DRIVER_BSD \ -DCONFIG_DRIVER_RADIUS_ACL \ -DCONFIG_HS20 \ + -DCONFIG_MBO \ + -DCONFIG_IEEE80211N \ + -DCONFIG_IEEE80211W \ + -DCONFIG_IEEE80211AC \ + -DCONFIG_IEEE80211AX \ -DCONFIG_INTERWORKING \ -DCONFIG_PEERKEY \ -DCONFIG_RSN_PREAUTH \ Modified: head/usr.sbin/wpa/wpa_supplicant/Makefile == --- head/usr.sbin/wpa/wpa_supplicant/Makefile Thu Jul 9 22:38:36 2020 (r363060) +++ head/usr.sbin/wpa/wpa_supplicant/Makefile Thu Jul 9 23:01:36 2020 (r363061) @@ -42,6 +42,10 @@ CFLAGS+=-DCONFIG_BACKEND_FILE \ -DCONFIG_DRIVER_WIRED \ -DCONFIG_GAS \ -DCONFIG_IEEE80211R \ + -DCONFIG_IEEE80211N \ + -DCONFIG_IEEE80211W \ + -DCONFIG_IEEE80211AC \ + -DCONFIG_IEEE80211AX \ -DCONFIG_PEERKEY \ -DCONFIG_PRIVSEP \ -DCONFIG_SMARTCARD \ ___ 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: r363060 - in head: stand/defaults sys/amd64/amd64 sys/powerpc/aim sys/vm
On Friday, July 10, 2020, Scott Long wrote: > Author: scottl > Date: Thu Jul 9 22:38:36 2020 > New Revision: 363060 > URL: https://svnweb.freebsd.org/changeset/base/363060 > > Log: > Revert r362998, r326999 while a better compatibility strategy is devised. > > Modified: > head/stand/defaults/loader.conf > head/sys/amd64/amd64/pmap.c > head/sys/powerpc/aim/mmu_radix.c > head/sys/vm/vm_page.c > head/sys/vm/vm_page.h > > Modified: head/stand/defaults/loader.conf > > == > --- head/stand/defaults/loader.conf Thu Jul 9 20:55:18 2020 > (r363059) > +++ head/stand/defaults/loader.conf Thu Jul 9 22:38:36 2020 > (r363060) > @@ -53,7 +53,7 @@ entropy_cache_type="boot_entropy_cache" # > Required for > ram_excludelist_load="NO" # Set this to YES to load a file > # containing a list of addresses to > # exclude from the running system. > -ram_excludelist_name="/boot/excludelist.txt" # Set this to the name of > the file > +ram_excludeist_name="/boot/excludelist.txt" # Set this to the name of > the file Hi! This part of the revert seems still broken. > ram_excludelist_type="ram_excludelist" # Required for the kernel to find > # the blacklist module > > > Modified: head/sys/amd64/amd64/pmap.c > > == > --- head/sys/amd64/amd64/pmap.c Thu Jul 9 20:55:18 2020(r363059) > +++ head/sys/amd64/amd64/pmap.c Thu Jul 9 22:38:36 2020(r363060) > @@ -2060,7 +2060,7 @@ pmap_init(void) > int error, i, ret, skz63; > > /* L1TF, reserve page @0 unconditionally */ > - vm_page_excludelist_add(0, bootverbose); > + vm_page_blacklist_add(0, bootverbose); > > /* Detect bare-metal Skylake Server and Skylake-X. */ > if (vm_guest == VM_GUEST_NO && cpu_vendor_id == CPU_VENDOR_INTEL && > @@ -2081,7 +2081,7 @@ pmap_init(void) > printf("SKZ63: skipping 4M RAM starting " > "at physical 1G\n"); > for (i = 0; i < atop(0x40); i++) { > - ret = vm_page_excludelist_add(0x4000 + > + ret = vm_page_blacklist_add(0x4000 + > ptoa(i), FALSE); > if (!ret && bootverbose) > printf("page at %#lx already > used\n", > > Modified: head/sys/powerpc/aim/mmu_radix.c > > == > --- head/sys/powerpc/aim/mmu_radix.cThu Jul 9 20:55:18 2020 > (r363059) > +++ head/sys/powerpc/aim/mmu_radix.cThu Jul 9 22:38:36 2020 > (r363060) > @@ -3557,7 +3557,7 @@ mmu_radix_init() > int error, i, pv_npg; > > /* L1TF, reserve page @0 unconditionally */ > - vm_page_excludelist_add(0, bootverbose); > + vm_page_blacklist_add(0, bootverbose); > > zone_radix_pgd = uma_zcache_create("radix_pgd_cache", > RADIX_PGD_SIZE, NULL, NULL, > > Modified: head/sys/vm/vm_page.c > > == > --- head/sys/vm/vm_page.c Thu Jul 9 20:55:18 2020(r363059) > +++ head/sys/vm/vm_page.c Thu Jul 9 22:38:36 2020(r363060) > @@ -155,11 +155,10 @@ vm_page_t vm_page_array; > long vm_page_array_size; > long first_page; > > -static TAILQ_HEAD(, vm_page) excludelist_head; > -static int sysctl_vm_page_excludelist(SYSCTL_HANDLER_ARGS); > -SYSCTL_PROC(_vm, OID_AUTO, page_excludelist, CTLTYPE_STRING | CTLFLAG_RD | > -CTLFLAG_MPSAFE, NULL, 0, sysctl_vm_page_excludelist, "A", > -"Blacklist pages"); > +static TAILQ_HEAD(, vm_page) blacklist_head; > +static int sysctl_vm_page_blacklist(SYSCTL_HANDLER_ARGS); > +SYSCTL_PROC(_vm, OID_AUTO, page_blacklist, CTLTYPE_STRING | CTLFLAG_RD | > +CTLFLAG_MPSAFE, NULL, 0, sysctl_vm_page_blacklist, "A", "Blacklist > pages"); > > static uma_zone_t fakepg_zone; > > @@ -259,16 +258,16 @@ vm_set_page_size(void) > } > > /* > - * vm_page_excludelist_next: > + * vm_page_blacklist_next: > * > - * Find the next entry in the provided string of excludelist > + * Find the next entry in the provided string of blacklist > * addresses. Entries are separated by space, comma, or newline. > * If an invalid integer is encountered then the rest of the > * string is skipped. Updates the list pointer to the next > * character, or NULL if the string is exhausted or invalid. > */ > static vm_paddr_t > -vm_page_excludelist_next(char **list, char *end) > +vm_page_blacklist_next(char **list, char *end) > { > vm_paddr_t bad; > char *cp, *pos; > @@ -315,13 +314,13 @@ vm_page_
svn commit: r363060 - in head: stand/defaults sys/amd64/amd64 sys/powerpc/aim sys/vm
Author: scottl Date: Thu Jul 9 22:38:36 2020 New Revision: 363060 URL: https://svnweb.freebsd.org/changeset/base/363060 Log: Revert r362998, r326999 while a better compatibility strategy is devised. Modified: head/stand/defaults/loader.conf head/sys/amd64/amd64/pmap.c head/sys/powerpc/aim/mmu_radix.c head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/stand/defaults/loader.conf == --- head/stand/defaults/loader.conf Thu Jul 9 20:55:18 2020 (r363059) +++ head/stand/defaults/loader.conf Thu Jul 9 22:38:36 2020 (r363060) @@ -53,7 +53,7 @@ entropy_cache_type="boot_entropy_cache" # Required for ram_excludelist_load="NO" # Set this to YES to load a file # containing a list of addresses to # exclude from the running system. -ram_excludelist_name="/boot/excludelist.txt" # Set this to the name of the file +ram_excludeist_name="/boot/excludelist.txt" # Set this to the name of the file ram_excludelist_type="ram_excludelist" # Required for the kernel to find # the blacklist module Modified: head/sys/amd64/amd64/pmap.c == --- head/sys/amd64/amd64/pmap.c Thu Jul 9 20:55:18 2020(r363059) +++ head/sys/amd64/amd64/pmap.c Thu Jul 9 22:38:36 2020(r363060) @@ -2060,7 +2060,7 @@ pmap_init(void) int error, i, ret, skz63; /* L1TF, reserve page @0 unconditionally */ - vm_page_excludelist_add(0, bootverbose); + vm_page_blacklist_add(0, bootverbose); /* Detect bare-metal Skylake Server and Skylake-X. */ if (vm_guest == VM_GUEST_NO && cpu_vendor_id == CPU_VENDOR_INTEL && @@ -2081,7 +2081,7 @@ pmap_init(void) printf("SKZ63: skipping 4M RAM starting " "at physical 1G\n"); for (i = 0; i < atop(0x40); i++) { - ret = vm_page_excludelist_add(0x4000 + + ret = vm_page_blacklist_add(0x4000 + ptoa(i), FALSE); if (!ret && bootverbose) printf("page at %#lx already used\n", Modified: head/sys/powerpc/aim/mmu_radix.c == --- head/sys/powerpc/aim/mmu_radix.cThu Jul 9 20:55:18 2020 (r363059) +++ head/sys/powerpc/aim/mmu_radix.cThu Jul 9 22:38:36 2020 (r363060) @@ -3557,7 +3557,7 @@ mmu_radix_init() int error, i, pv_npg; /* L1TF, reserve page @0 unconditionally */ - vm_page_excludelist_add(0, bootverbose); + vm_page_blacklist_add(0, bootverbose); zone_radix_pgd = uma_zcache_create("radix_pgd_cache", RADIX_PGD_SIZE, NULL, NULL, Modified: head/sys/vm/vm_page.c == --- head/sys/vm/vm_page.c Thu Jul 9 20:55:18 2020(r363059) +++ head/sys/vm/vm_page.c Thu Jul 9 22:38:36 2020(r363060) @@ -155,11 +155,10 @@ vm_page_t vm_page_array; long vm_page_array_size; long first_page; -static TAILQ_HEAD(, vm_page) excludelist_head; -static int sysctl_vm_page_excludelist(SYSCTL_HANDLER_ARGS); -SYSCTL_PROC(_vm, OID_AUTO, page_excludelist, CTLTYPE_STRING | CTLFLAG_RD | -CTLFLAG_MPSAFE, NULL, 0, sysctl_vm_page_excludelist, "A", -"Blacklist pages"); +static TAILQ_HEAD(, vm_page) blacklist_head; +static int sysctl_vm_page_blacklist(SYSCTL_HANDLER_ARGS); +SYSCTL_PROC(_vm, OID_AUTO, page_blacklist, CTLTYPE_STRING | CTLFLAG_RD | +CTLFLAG_MPSAFE, NULL, 0, sysctl_vm_page_blacklist, "A", "Blacklist pages"); static uma_zone_t fakepg_zone; @@ -259,16 +258,16 @@ vm_set_page_size(void) } /* - * vm_page_excludelist_next: + * vm_page_blacklist_next: * - * Find the next entry in the provided string of excludelist + * Find the next entry in the provided string of blacklist * addresses. Entries are separated by space, comma, or newline. * If an invalid integer is encountered then the rest of the * string is skipped. Updates the list pointer to the next * character, or NULL if the string is exhausted or invalid. */ static vm_paddr_t -vm_page_excludelist_next(char **list, char *end) +vm_page_blacklist_next(char **list, char *end) { vm_paddr_t bad; char *cp, *pos; @@ -315,13 +314,13 @@ vm_page_excludelist_next(char **list, char *end) *list = cp; return (trunc_page(bad)); } - printf("Garbage in RAM excludelist, skipping\n"); + printf("Garbage in RAM blacklist, skipping\n"); *list = NULL; return (0); }
svn commit: r363059 - stable/11/usr.sbin/bhyve
Author: kaktus Date: Thu Jul 9 20:55:18 2020 New Revision: 363059 URL: https://svnweb.freebsd.org/changeset/base/363059 Log: MFC r362612 bhyve: allow for automatic destruction on power-off Modified: stable/11/usr.sbin/bhyve/bhyve.8 stable/11/usr.sbin/bhyve/bhyverun.c Modified: stable/11/usr.sbin/bhyve/bhyve.8 == --- stable/11/usr.sbin/bhyve/bhyve.8Thu Jul 9 20:54:16 2020 (r363058) +++ stable/11/usr.sbin/bhyve/bhyve.8Thu Jul 9 20:55:18 2020 (r363059) @@ -112,6 +112,8 @@ If a is specified more than once the last one has precedence. .It Fl C Include guest memory in core file. +.It Fl D +Destroy the VM on guest initiated power-off. .It Fl e Force .Nm Modified: stable/11/usr.sbin/bhyve/bhyverun.c == --- stable/11/usr.sbin/bhyve/bhyverun.c Thu Jul 9 20:54:16 2020 (r363058) +++ stable/11/usr.sbin/bhyve/bhyverun.c Thu Jul 9 20:55:18 2020 (r363059) @@ -171,6 +171,7 @@ char *guest_uuid_str; static int guest_vmexit_on_hlt, guest_vmexit_on_pause; static int virtio_msix = 1; static int x2apic_mode = 0;/* default is xAPIC */ +static int destroy_on_poweroff = 0; static int strictio; static int strictmsr = 1; @@ -210,7 +211,7 @@ usage(int code) { fprintf(stderr, - "Usage: %s [-abehuwxACHPSWY]\n" + "Usage: %s [-abehuwxACDHPSWY]\n" " %*s [-c [[cpus=]numcpus][,sockets=n][,cores=n][,threads=n]]\n" " %*s [-g ] [-l ]\n" " %*s [-m mem] [-p vcpu:hostcpu] [-s ] [-U uuid] \n" @@ -218,6 +219,7 @@ usage(int code) " -A: create ACPI tables\n" " -c: number of cpus and/or topology specification\n" " -C: include guest memory in core file\n" + " -D: destroy on power-off\n" " -e: exit on unhandled I/O access\n" " -g: gdb port\n" " -h: help\n" @@ -788,6 +790,8 @@ vmexit_suspend(struct vmctx *ctx, struct vm_exit *vmex case VM_SUSPEND_RESET: exit(0); case VM_SUSPEND_POWEROFF: + if (destroy_on_poweroff) + vm_destroy(ctx); exit(1); case VM_SUSPEND_HALT: exit(2); @@ -1021,7 +1025,7 @@ main(int argc, char *argv[]) rtc_localtime = 1; memflags = 0; - optstr = "abehuwxACHIPSWYp:g:c:s:m:l:U:"; + optstr = "abehuwxACDHIPSWYp:g:c:s:m:l:U:"; while ((c = getopt(argc, argv, optstr)) != -1) { switch (c) { case 'a': @@ -1032,6 +1036,9 @@ main(int argc, char *argv[]) break; case 'b': bvmcons = 1; + break; + case 'D': + destroy_on_poweroff = 1; break; case 'p': if (pincpu_parse(optarg) != 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: r363058 - stable/12/usr.sbin/bhyve
Author: kaktus Date: Thu Jul 9 20:54:16 2020 New Revision: 363058 URL: https://svnweb.freebsd.org/changeset/base/363058 Log: MFC r362612 bhyve: allow for automatic destruction on power-off Modified: stable/12/usr.sbin/bhyve/bhyve.8 stable/12/usr.sbin/bhyve/bhyverun.c Modified: stable/12/usr.sbin/bhyve/bhyve.8 == --- stable/12/usr.sbin/bhyve/bhyve.8Thu Jul 9 20:53:56 2020 (r363057) +++ stable/12/usr.sbin/bhyve/bhyve.8Thu Jul 9 20:54:16 2020 (r363058) @@ -113,6 +113,8 @@ If a is specified more than once the last one has precedence. .It Fl C Include guest memory in core file. +.It Fl D +Destroy the VM on guest initiated power-off. .It Fl e Force .Nm Modified: stable/12/usr.sbin/bhyve/bhyverun.c == --- stable/12/usr.sbin/bhyve/bhyverun.c Thu Jul 9 20:53:56 2020 (r363057) +++ stable/12/usr.sbin/bhyve/bhyverun.c Thu Jul 9 20:54:16 2020 (r363058) @@ -173,6 +173,7 @@ static int gdb_port = 0; static int guest_vmexit_on_hlt, guest_vmexit_on_pause; static int virtio_msix = 1; static int x2apic_mode = 0;/* default is xAPIC */ +static int destroy_on_poweroff = 0; static int strictio; static int strictmsr = 1; @@ -212,7 +213,7 @@ usage(int code) { fprintf(stderr, - "Usage: %s [-abehuwxACHPSWY]\n" + "Usage: %s [-abehuwxACDHPSWY]\n" " %*s [-c [[cpus=]numcpus][,sockets=n][,cores=n][,threads=n]]\n" " %*s [-g ] [-l ]\n" " %*s [-m mem] [-p vcpu:hostcpu] [-s ] [-U uuid] \n" @@ -220,6 +221,7 @@ usage(int code) " -A: create ACPI tables\n" " -c: number of cpus and/or topology specification\n" " -C: include guest memory in core file\n" + " -D: destroy on power-off\n" " -e: exit on unhandled I/O access\n" " -g: gdb port\n" " -h: help\n" @@ -761,6 +763,8 @@ vmexit_suspend(struct vmctx *ctx, struct vm_exit *vmex case VM_SUSPEND_RESET: exit(0); case VM_SUSPEND_POWEROFF: + if (destroy_on_poweroff) + vm_destroy(ctx); exit(1); case VM_SUSPEND_HALT: exit(2); @@ -1021,7 +1025,7 @@ main(int argc, char *argv[]) rtc_localtime = 1; memflags = 0; - optstr = "abehuwxACHIPSWYp:g:G:c:s:m:l:U:"; + optstr = "abehuwxACDHIPSWYp:g:G:c:s:m:l:U:"; while ((c = getopt(argc, argv, optstr)) != -1) { switch (c) { case 'a': @@ -1032,6 +1036,9 @@ main(int argc, char *argv[]) break; case 'b': bvmcons = 1; + break; + case 'D': + destroy_on_poweroff = 1; break; case 'p': if (pincpu_parse(optarg) != 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: r363057 - head/bin/sh
Author: jilles Date: Thu Jul 9 20:53:56 2020 New Revision: 363057 URL: https://svnweb.freebsd.org/changeset/base/363057 Log: sh: Do not ignore INTOFF during a trap INTOFF postpones SIGINT processing and INTON enables it again. This is important so an interactive shell can return to the top level prompt when Ctrl+C is pressed. Given that INTON is automatically done when a builtin completes, the part where onsig() ignores suppressint when in_dotrap is true is both unnecessary and unsafe. If the trap is for some other signal than SIGINT, arbitrary code could have been interrupted. Historically, INTOFF remained in effect for longer. Reviewed by: bdrewery MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D25270 Modified: head/bin/sh/trap.c Modified: head/bin/sh/trap.c == --- head/bin/sh/trap.c Thu Jul 9 19:11:57 2020(r363056) +++ head/bin/sh/trap.c Thu Jul 9 20:53:56 2020(r363057) @@ -382,12 +382,7 @@ onsig(int signo) { if (signo == SIGINT && trap[SIGINT] == NULL) { - /* -* The !in_dotrap here is safe. The only way we can arrive -* here with in_dotrap set is that a trap handler set SIGINT to -* SIG_DFL and killed itself. -*/ - if (suppressint && !in_dotrap) + if (suppressint) SET_PENDING_INT; else onint(); ___ 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: r363056 - stable/12/lib/libufs
Author: mckusick Date: Thu Jul 9 19:11:57 2020 New Revision: 363056 URL: https://svnweb.freebsd.org/changeset/base/363056 Log: MFC of 362560 Correctly describe libufs library sbget() and sbput() return values. Modified: stable/12/lib/libufs/sbread.3 Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libufs/sbread.3 == --- stable/12/lib/libufs/sbread.3 Thu Jul 9 18:34:54 2020 (r363055) +++ stable/12/lib/libufs/sbread.3 Thu Jul 9 19:11:57 2020 (r363056) @@ -109,28 +109,30 @@ function will write to all the alternate superblock lo .Fa all value is non-zero. .Sh RETURN VALUES -.Rv -std sbget sbput sbread sbwrite -.Sh ERRORS +.Rv -std sbread sbwrite The .Fn sbget and +.Fn sbput +functions return the value 0 if successful; +otherwise they return one of the errors described below. +.Sh ERRORS +The errors returned by +.Fn sbget +and .Fn sbread -functions may fail and set -.Va errno -for any of the errors specified for the library function +include any of the errors specified for the library function .Xr bread 3 . -Additionally, it may follow the +Additionally, they may follow the .Xr libufs 3 error methodologies in situations where no usable superblock could be found. .Pp -The +The errors returned by .Fn sbput and .Fn sbwrite -functions may fail and set -.Va errno -for any of the errors specified for the library function +include any of the errors specified for the library function .Xr bwrite 3 . .Sh SEE ALSO .Xr bread 3 , ___ 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: r363055 - in head: lib/libc/sys sys/kern
Author: markj Date: Thu Jul 9 18:34:54 2020 New Revision: 363055 URL: https://svnweb.freebsd.org/changeset/base/363055 Log: Apply the logic from r363051 to semctl(2) and __sem_base field. Reported by: Jeffball MFC after:1 week Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D25600 Modified: head/lib/libc/sys/semctl.2 head/sys/kern/sysv_sem.c Modified: head/lib/libc/sys/semctl.2 == --- head/lib/libc/sys/semctl.2 Thu Jul 9 17:43:25 2020(r363054) +++ head/lib/libc/sys/semctl.2 Thu Jul 9 18:34:54 2020(r363055) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 23, 2018 +.Dd July 9, 2020 .Dt SEMCTL 2 .Os .Sh NAME @@ -148,7 +148,6 @@ is defined as follows: .Bd -literal struct semid_ds { struct ipc_perm sem_perm; /* operation permission struct */ -struct sem *__sem_base; /* kernel data, don't use */ u_short sem_nsems; /* number of sems in set */ time_t sem_otime; /* last operation time */ time_t sem_ctime; /* last change time */ Modified: head/sys/kern/sysv_sem.c == --- head/sys/kern/sysv_sem.cThu Jul 9 17:43:25 2020(r363054) +++ head/sys/kern/sysv_sem.cThu Jul 9 18:34:54 2020(r363055) @@ -798,6 +798,13 @@ kern_semctl(struct thread *td, int semid, int semnum, bcopy(&semakptr->u, arg->buf, sizeof(struct semid_ds)); if (cred->cr_prison != semakptr->cred->cr_prison) arg->buf->sem_perm.key = IPC_PRIVATE; + + /* +* Try to hide the fact that the structure layout is shared by +* both the kernel and userland. This pointer is not useful to +* userspace. +*/ + arg->buf->__sem_base = NULL; break; case GETNCNT: ___ 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: r363054 - stable/12/bin/sh/tests
Author: jilles Date: Thu Jul 9 17:43:25 2020 New Revision: 363054 URL: https://svnweb.freebsd.org/changeset/base/363054 Log: MFC r362738: sh/tests: Re-enable bin.sh.execution.functional_test.bg12.0 PR: 247559 Modified: stable/12/bin/sh/tests/functional_test.sh Directory Properties: stable/12/ (props changed) Modified: stable/12/bin/sh/tests/functional_test.sh == --- stable/12/bin/sh/tests/functional_test.sh Thu Jul 9 17:42:31 2020 (r363053) +++ stable/12/bin/sh/tests/functional_test.sh Thu Jul 9 17:43:25 2020 (r363054) @@ -27,7 +27,6 @@ # $FreeBSD$ SRCDIR=$(atf_get_srcdir) -CATEGORY=$(basename ${SRCDIR}) check() { @@ -61,20 +60,7 @@ add_testcase() esac atf_test_case ${tc_escaped} - - if [ "$(atf_config_get ci false)" = "true" ]; then - case "${CATEGORY}/${tc}" in - execution/bg12.0) - eval "${tc_escaped}_body() { atf_skip 'https://bugs.freebsd.org/247559'; }" - ;; - *) - eval "${tc_escaped}_body() { check ${tc}; }" - ;; - esac - else - eval "${tc_escaped}_body() { check ${tc}; }" - fi - + eval "${tc_escaped}_body() { check ${tc}; }" atf_add_test_case ${tc_escaped} } ___ 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: r363053 - stable/12/bin/sh/tests/execution
Author: jilles Date: Thu Jul 9 17:42:31 2020 New Revision: 363053 URL: https://svnweb.freebsd.org/changeset/base/363053 Log: MFC r362737: sh/tests: Fix flaky execution/bg12.0 When job control is not enabled, the shell ignores SIGINT while waiting for a foreground process unless that process exits on SIGINT. In this case, the foreground process is sleep and it does not exit on SIGINT because the signal is only sent to the shell. Depending on order of events, this could cause the SIGINT to be unexpectedly ignored. On lightly loaded bare metal, the chance of this happening tends to be less than 0.01% but with higher loads and/or virtualization it becomes more likely. Starting the sleep in background and using the wait builtin ensures SIGINT will not be ignored. PR: 247559 Reported by: lwhsu Modified: stable/12/bin/sh/tests/execution/bg12.0 Directory Properties: stable/12/ (props changed) Modified: stable/12/bin/sh/tests/execution/bg12.0 == --- stable/12/bin/sh/tests/execution/bg12.0 Thu Jul 9 17:27:14 2020 (r363052) +++ stable/12/bin/sh/tests/execution/bg12.0 Thu Jul 9 17:42:31 2020 (r363053) @@ -4,7 +4,7 @@ T=`mktemp -d ${TMPDIR:-/tmp}/sh-test.` trap 'rm -rf $T' 0 cd $T || exit 3 mkfifo fifo1 -{ trap - INT; : >fifo1; sleep 5; exit 4; } & +{ trap - INT; : >fifo1; sleep 5 & wait; exit 4; } & : https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r363051 - in head: lib/libc/sys sys/kern
Author: markj Date: Thu Jul 9 17:26:49 2020 New Revision: 363051 URL: https://svnweb.freebsd.org/changeset/base/363051 Log: Avoid copying out kernel pointers from msgctl(IPC_STAT). While this behaviour is harmless, it is really just an artifact of the fact that the msgctl(2) implementation uses a user-visible structure as part of the internal implementation, so it is not deliberate and these pointers are not useful to userspace. Thus, NULL them out before copying out, and remove references to them from the manual page. Reported by: Jeffball Reviewed by: emaste, kib MFC after:1 week Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D25600 Modified: head/lib/libc/sys/msgctl.2 head/sys/kern/sysv_msg.c Modified: head/lib/libc/sys/msgctl.2 == --- head/lib/libc/sys/msgctl.2 Thu Jul 9 17:12:22 2020(r363050) +++ head/lib/libc/sys/msgctl.2 Thu Jul 9 17:26:49 2020(r363051) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\"/ -.Dd July 9, 2009 +.Dd July 9, 2020 .Dt MSGCTL 2 .Os .Sh NAME @@ -63,8 +63,6 @@ and contains (amongst others) the following members: .Bd -literal struct msqid_ds { struct ipc_perm msg_perm; /* msg queue permission bits */ - struct msg *__msg_first; /* kernel data, don't use */ - struct msg *__msg_last;/* kernel data, don't use */ msglen_t msg_cbytes;/* number of bytes in use on the queue */ msgqnum_t msg_qnum; /* number of msgs in the queue */ msglen_t msg_qbytes;/* max # of bytes on the queue */ Modified: head/sys/kern/sysv_msg.c == --- head/sys/kern/sysv_msg.cThu Jul 9 17:12:22 2020(r363050) +++ head/sys/kern/sysv_msg.cThu Jul 9 17:26:49 2020(r363051) @@ -613,6 +613,13 @@ kern_msgctl(struct thread *td, int msqid, int cmd, str *msqbuf = msqkptr->u; if (td->td_ucred->cr_prison != msqkptr->cred->cr_prison) msqbuf->msg_perm.key = IPC_PRIVATE; + + /* +* Try to hide the fact that the structure layout is shared by +* both the kernel and userland. These pointers are not useful +* to userspace. +*/ + msqbuf->__msg_first = msqbuf->__msg_last = NULL; break; default: ___ 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: r363052 - head/usr.bin/whois
Author: markj Date: Thu Jul 9 17:27:14 2020 New Revision: 363052 URL: https://svnweb.freebsd.org/changeset/base/363052 Log: whois: Handle referrals to rwhois servers. PR: 243862 Submitted by: b...@desync.com Differential Revision:https://reviews.freebsd.org/D25156 Modified: head/usr.bin/whois/whois.c Modified: head/usr.bin/whois/whois.c == --- head/usr.bin/whois/whois.c Thu Jul 9 17:26:49 2020(r363051) +++ head/usr.bin/whois/whois.c Thu Jul 9 17:27:14 2020(r363052) @@ -117,6 +117,7 @@ static struct { WHOIS_REFERRAL("Whois Server:"), WHOIS_REFERRAL("Registrar WHOIS Server:"), /* corporatedomains.com */ WHOIS_REFERRAL("ReferralServer: whois://"), /* ARIN */ + WHOIS_REFERRAL("ReferralServer: rwhois://"), /* ARIN */ WHOIS_REFERRAL("descr: region. Please query"), /* AfriNIC */ { NULL, 0 } }; @@ -156,10 +157,10 @@ reset_rir(void) { static const char *port = DEFAULT_PORT; static const char *choose_server(char *); -static struct addrinfo *gethostinfo(char const *host, int exitnoname); +static struct addrinfo *gethostinfo(const char *, const char *, int); static void s_asprintf(char **ret, const char *format, ...) __printflike(2, 3); static void usage(void); -static void whois(const char *, const char *, int); +static void whois(const char *, const char *, const char *, int); int main(int argc, char *argv[]) @@ -255,11 +256,11 @@ main(int argc, char *argv[]) if (country != NULL) { char *qnichost; s_asprintf(&qnichost, "%s%s", country, QNICHOST_TAIL); - whois(*argv, qnichost, flags); + whois(*argv, qnichost, port, flags); free(qnichost); } else whois(*argv, host != NULL ? host : - choose_server(*argv), flags); + choose_server(*argv), port, flags); reset_rir(); argv++; } @@ -283,7 +284,7 @@ choose_server(char *domain) } static struct addrinfo * -gethostinfo(char const *host, int exit_on_noname) +gethostinfo(const char *host, const char *hport, int exit_on_noname) { struct addrinfo hints, *res; int error; @@ -293,7 +294,7 @@ gethostinfo(char const *host, int exit_on_noname) hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; res = NULL; - error = getaddrinfo(host, port, &hints, &res); + error = getaddrinfo(host, hport, &hints, &res); if (error && (exit_on_noname || error != EAI_NONAME)) err(EX_NOHOST, "%s: %s", host, gai_strerror(error)); return (res); @@ -444,15 +445,15 @@ done: } static void -whois(const char *query, const char *hostname, int flags) +whois(const char *query, const char *hostname, const char *hostport, int flags) { FILE *fp; struct addrinfo *hostres; - char *buf, *host, *nhost, *p; + char *buf, *host, *nhost, *nport, *p; int comment, s, f; size_t len, i; - hostres = gethostinfo(hostname, 1); + hostres = gethostinfo(hostname, hostport, 1); s = connect_to_any_host(hostres); if (s == -1) err(EX_OSERR, "connect()"); @@ -532,14 +533,35 @@ whois(const char *query, const char *hostname, int fla SCAN(p, buf+len, *p == ' '); host = p; SCAN(p, buf+len, ishost(*p)); - if (p > host) + if (p > host) { + char *pstr; + s_asprintf(&nhost, "%.*s", (int)(p - host), host); + + if (*p != ':') { + s_asprintf(&nport, "%s", port); + break; + } + + pstr = ++p; + SCAN(p, buf+len, isdigit(*p)); + if (p > pstr && (p - pstr) < 6) { + s_asprintf(&nport, "%.*s", + (int)(p - pstr), pstr); + break; + } + + /* Invalid port; don't recurse */ + free(nhost); + nhost = NULL; + } break; } for (i = 0; actually_arin[i] != NULL; i++) {
svn commit: r363050 - stable/11/cddl/contrib/opensolaris/tools/ctf/cvt
Author: brooks Date: Thu Jul 9 17:12:22 2020 New Revision: 363050 URL: https://svnweb.freebsd.org/changeset/base/363050 Log: MFC r362979: Fix a -Wvoid-pointer-to-enum-cast warning missed in r359978. This pattern is used in callbacks with void * data arguments and seems both relatively uncommon and relatively harmless. Silence the warning by casting through uintptr_t. This warning is on by default in Clang 11. Sponsored by: DARPA Differential Revision:https://reviews.freebsd.org/D24425 Modified: stable/11/cddl/contrib/opensolaris/tools/ctf/cvt/iidesc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/tools/ctf/cvt/iidesc.c == --- stable/11/cddl/contrib/opensolaris/tools/ctf/cvt/iidesc.c Thu Jul 9 17:10:18 2020(r363049) +++ stable/11/cddl/contrib/opensolaris/tools/ctf/cvt/iidesc.c Thu Jul 9 17:12:22 2020(r363050) @@ -179,7 +179,7 @@ int iidesc_count_type(void *data, void *private) { iidesc_t *ii = data; - iitype_t match = (iitype_t)private; + iitype_t match = (iitype_t)(uintptr_t)private; return (ii->ii_type == match); } ___ 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: r363049 - stable/12/sys/x86/x86
Author: gallatin Date: Thu Jul 9 17:10:18 2020 New Revision: 363049 URL: https://svnweb.freebsd.org/changeset/base/363049 Log: MFC r362112 x86: Bump default msi/msix vector limit to 2048 Modified: stable/12/sys/x86/x86/msi.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/x86/x86/msi.c == --- stable/12/sys/x86/x86/msi.c Thu Jul 9 16:58:53 2020(r363048) +++ stable/12/sys/x86/x86/msi.c Thu Jul 9 17:10:18 2020(r363049) @@ -154,7 +154,7 @@ struct pic msi_pic = { u_int first_msi_irq; -u_int num_msi_irqs = 512; +u_int num_msi_irqs = 2048; SYSCTL_UINT(_machdep, OID_AUTO, num_msi_irqs, CTLFLAG_RDTUN, &num_msi_irqs, 0, "Number of IRQs reserved for MSI and MSI-X interrupts"); ___ 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: r363048 - stable/12/cddl/contrib/opensolaris/tools/ctf/cvt
Author: brooks Date: Thu Jul 9 16:58:53 2020 New Revision: 363048 URL: https://svnweb.freebsd.org/changeset/base/363048 Log: MFC r362979: Fix a -Wvoid-pointer-to-enum-cast warning missed in r359978. This pattern is used in callbacks with void * data arguments and seems both relatively uncommon and relatively harmless. Silence the warning by casting through uintptr_t. This warning is on by default in Clang 11. Sponsored by: DARPA Differential Revision:https://reviews.freebsd.org/D24425 Modified: stable/12/cddl/contrib/opensolaris/tools/ctf/cvt/iidesc.c Directory Properties: stable/12/ (props changed) Modified: stable/12/cddl/contrib/opensolaris/tools/ctf/cvt/iidesc.c == --- stable/12/cddl/contrib/opensolaris/tools/ctf/cvt/iidesc.c Thu Jul 9 16:28:13 2020(r363047) +++ stable/12/cddl/contrib/opensolaris/tools/ctf/cvt/iidesc.c Thu Jul 9 16:58:53 2020(r363048) @@ -179,7 +179,7 @@ int iidesc_count_type(void *data, void *private) { iidesc_t *ii = data; - iitype_t match = (iitype_t)private; + iitype_t match = (iitype_t)(uintptr_t)private; return (ii->ii_type == match); } ___ 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: r363031 - in head: contrib/bmake contrib/bmake/lst.lib contrib/bmake/mk contrib/bmake/mk/sys contrib/bmake/unit-tests usr.bin/bmake
Cy Schubert wrote: > [External Email. Be cautious of content] > > > In message <45359.1594266...@kaos.jnpr.net>, "Simon J. Gerraty" writes: > > Cy Schubert wrote: > > > This broke ports. > > > > I've reverted the change. > > > > Let me know if you still see issue. > > As I said in my email, all I did was revert cond.c, and that fixed it. You > don't need to revert the whole patch. Just revert cond.c and let NetBSD > know. Ah I missed that bit - rats. I think I've a fix for cond.c, but unfortunately I'm so far unable to construct a unit-test that triggers the problem. Even with bsd.compiler.mk I was unable to get it to fail in debugger, so added an abort and looked at the core file. The problem is in something like: .if 1 || ${something-complicated} > 0 the ${something-complicated} isn't resolved because we do not need to evaluate anything after '1', but the comparator check is still applied. Fix should be simple, but in unit-tests the above does not trigger the problem ;-) ___ 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: r363047 - in head/sys: arm/broadcom/bcm2835 conf
Author: andrew Date: Thu Jul 9 16:28:13 2020 New Revision: 363047 URL: https://svnweb.freebsd.org/changeset/base/363047 Log: Add a driver to talk to the Raspberry Pi firmware Communicating with the Raspberry Pi firmware is currently handled by each driver calling into the mbox driver, however the device tree is structured such that they should be calling into a firmware driver. Add a driver for this node with an interface to communicate to the firmware via the mbox interface. There is a sysctl to get the firmware revision. This is a unix date so can be parsed with: root@generic:~ # date -j -f '%s' sysctl -n dev.bcm2835_firmware.0.revision Tue Nov 19 16:40:28 UTC 2019 Reviewed by: manu Sponsored by: Innovate UK Differential Revision:https://reviews.freebsd.org/D25572 Added: head/sys/arm/broadcom/bcm2835/bcm2835_firmware.c (contents, props changed) head/sys/arm/broadcom/bcm2835/bcm2835_firmware.h (contents, props changed) Modified: head/sys/arm/broadcom/bcm2835/bcm2835_mbox_prop.h head/sys/arm/broadcom/bcm2835/files.bcm283x head/sys/conf/files.arm64 Added: head/sys/arm/broadcom/bcm2835/bcm2835_firmware.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/broadcom/bcm2835/bcm2835_firmware.cThu Jul 9 16:28:13 2020(r363047) @@ -0,0 +1,181 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020 Andrew Turner + * + * This work was supported by Innovate UK project 105694, "Digital Security + * by Design (DSbD) Technology Platform Prototype". + * + * 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 + +struct bcm2835_firmware_softc { + device_tsc_dev; + phandle_t sc_mbox; +}; + +static struct ofw_compat_data compat_data[] = { + {"raspberrypi,bcm2835-firmware",1}, + {NULL, 0} +}; + +static int sysctl_bcm2835_firmware_get_revision(SYSCTL_HANDLER_ARGS); + +static int +bcm2835_firmware_probe(device_t dev) +{ + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "BCM2835 Firmware"); + return (BUS_PROBE_DEFAULT); +} + +static int +bcm2835_firmware_attach(device_t dev) +{ + struct bcm2835_firmware_softc *sc; + struct sysctl_ctx_list *ctx; + struct sysctl_oid *tree_node; + struct sysctl_oid_list *tree; + phandle_t node, mbox; + int rv; + + sc = device_get_softc(dev); + sc->sc_dev = dev; + + node = ofw_bus_get_node(dev); + rv = OF_getencprop(node, "mboxes", &mbox, sizeof(mbox)); + if (rv <= 0) { + device_printf(dev, "can't read mboxes property\n"); + return (ENXIO); + } + sc->sc_mbox = mbox; + + OF_device_register_xref(OF_xref_from_node(node), dev); + + ctx = device_get_sysctl_ctx(sc->sc_dev); + tree_node = device_get_sysctl_tree(sc->sc_dev); + tree = SYSCTL_CHILDREN(tree_node); + SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "revision", + CTLTYPE_UINT | CTLFLAG_RD, sc, sizeof(*sc), + sysctl_bcm2835_firmware_get_revision, "IU", + "Firmware revision"); + return (0); +} + +int +bcm2835_firmware_property(device_t dev, uint32_t prop, void *data, size_t len) +{ + struct { + struct bcm2835_mbox_hdr hd
svn commit: r363046 - head/sys/netinet
Author: tuexen Date: Thu Jul 9 16:18:42 2020 New Revision: 363046 URL: https://svnweb.freebsd.org/changeset/base/363046 Log: Optimize flushing of receive queues. This addresses an issue found and reported for the userland stack in https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=21243 MFC after:1 week Modified: head/sys/netinet/sctp_indata.c Modified: head/sys/netinet/sctp_indata.c == --- head/sys/netinet/sctp_indata.c Thu Jul 9 14:42:41 2020 (r363045) +++ head/sys/netinet/sctp_indata.c Thu Jul 9 16:18:42 2020 (r363046) @@ -5411,11 +5411,9 @@ sctp_kick_prsctp_reorder_queue(struct sctp_tcb *stcb, static void sctp_flush_reassm_for_str_seq(struct sctp_tcb *stcb, -struct sctp_association *asoc, -uint16_t stream, uint32_t mid, int ordered, uint32_t cumtsn) +struct sctp_association *asoc, struct sctp_stream_in *strm, +struct sctp_queued_to_read *control, int ordered, uint32_t cumtsn) { - struct sctp_queued_to_read *control; - struct sctp_stream_in *strm; struct sctp_tmit_chunk *chk, *nchk; int cnt_removed = 0; @@ -5427,12 +5425,6 @@ sctp_flush_reassm_for_str_seq(struct sctp_tcb *stcb, * it can be delivered... But for now we just dump everything on the * queue. */ - strm = &asoc->strmin[stream]; - control = sctp_find_reasm_entry(strm, mid, ordered, asoc->idata_supported); - if (control == NULL) { - /* Not found */ - return; - } if (!asoc->idata_supported && !ordered && SCTP_TSN_GT(control->fsn_included, cumtsn)) { return; } @@ -5609,7 +5601,10 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb, /* Flush all the un-ordered data based on cum-tsn */ SCTP_INP_READ_LOCK(stcb->sctp_ep); for (sid = 0; sid < asoc->streamincnt; sid++) { - sctp_flush_reassm_for_str_seq(stcb, asoc, sid, 0, 0, new_cum_tsn); + strm = &asoc->strmin[sid]; + if (!TAILQ_EMPTY(&strm->uno_inqueue)) { + sctp_flush_reassm_for_str_seq(stcb, asoc, strm, TAILQ_FIRST(&strm->uno_inqueue), 0, new_cum_tsn); + } } SCTP_INP_READ_UNLOCK(stcb->sctp_ep); } @@ -5621,7 +5616,7 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb, if (m && fwd_sz) { /* New method. */ unsigned int num_str; - uint32_t mid, cur_mid; + uint32_t mid; uint16_t sid; uint16_t ordered, flags; struct sctp_strseq *stseq, strseqbuf; @@ -5688,8 +5683,24 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb, asoc->fragmented_delivery_inprogress = 0; } strm = &asoc->strmin[sid]; - for (cur_mid = strm->last_mid_delivered; SCTP_MID_GE(asoc->idata_supported, mid, cur_mid); cur_mid++) { - sctp_flush_reassm_for_str_seq(stcb, asoc, sid, cur_mid, ordered, new_cum_tsn); + if (ordered) { + TAILQ_FOREACH(control, &strm->inqueue, next_instrm) { + if (SCTP_MID_GE(asoc->idata_supported, mid, control->mid)) { + sctp_flush_reassm_for_str_seq(stcb, asoc, strm, control, ordered, new_cum_tsn); + } + } + } else { + if (asoc->idata_supported) { + TAILQ_FOREACH(control, &strm->uno_inqueue, next_instrm) { + if (SCTP_MID_GE(asoc->idata_supported, mid, control->mid)) { + sctp_flush_reassm_for_str_seq(stcb, asoc, strm, control, ordered, new_cum_tsn); + } + } + } else { + if (!TAILQ_EMPTY(&strm->uno_inqueue)) { + sctp_flush_reassm_for_str_seq(stcb, asoc, strm, TAILQ_FIRST(&strm->uno_inqueue), ordered, new_cum_tsn); + } + } } TAILQ_FOREACH(control, &stcb->sctp_ep->read_queue, next) { if ((control->sinfo_stream == sid) && ___ 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: r363045 - stable/12/sys/netinet
Author: markj Date: Thu Jul 9 14:42:41 2020 New Revision: 363045 URL: https://svnweb.freebsd.org/changeset/base/363045 Log: MFC r362497: Move the definition of SCTP's system_base_info into sctp_crc32.c. Modified: stable/12/sys/netinet/sctp_crc32.c stable/12/sys/netinet/sctp_pcb.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_crc32.c == --- stable/12/sys/netinet/sctp_crc32.c Thu Jul 9 14:18:14 2020 (r363044) +++ stable/12/sys/netinet/sctp_crc32.c Thu Jul 9 14:42:41 2020 (r363045) @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) #include #include #include @@ -116,6 +116,9 @@ sctp_calculate_cksum(struct mbuf *m, uint32_t offset) } #if defined(SCTP) || defined(SCTP_SUPPORT) + +VNET_DEFINE(struct sctp_base_info, system_base_info); + /* * Compute and insert the SCTP checksum in network byte order for a given * mbuf chain m which contains an SCTP packet starting at offset. @@ -126,10 +129,8 @@ sctp_delayed_cksum(struct mbuf *m, uint32_t offset) uint32_t checksum; checksum = sctp_calculate_cksum(m, offset); -#ifdef SCTP SCTP_STAT_DECR(sctps_sendhwcrc); SCTP_STAT_INCR(sctps_sendswcrc); -#endif offset += offsetof(struct sctphdr, checksum); if (offset + sizeof(uint32_t) > (uint32_t)(m->m_len)) { Modified: stable/12/sys/netinet/sctp_pcb.c == --- stable/12/sys/netinet/sctp_pcb.cThu Jul 9 14:18:14 2020 (r363044) +++ stable/12/sys/netinet/sctp_pcb.cThu Jul 9 14:42:41 2020 (r363045) @@ -57,9 +57,6 @@ __FBSDID("$FreeBSD$"); #include #include - -VNET_DEFINE(struct sctp_base_info, system_base_info); - /* FIX: we don't handle multiple link local scopes */ /* "scopeless" replacement IN6_ARE_ADDR_EQUAL */ #ifdef INET6 ___ 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: r363044 - stable/12/sys/conf
Author: markj Date: Thu Jul 9 14:18:14 2020 New Revision: 363044 URL: https://svnweb.freebsd.org/changeset/base/363044 Log: MFC r362614, r362618: Add SCTP_SUPPORT handling to config.mk. Modified: stable/12/sys/conf/config.mk stable/12/sys/conf/kern.opts.mk Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/conf/config.mk == --- stable/12/sys/conf/config.mkThu Jul 9 14:17:04 2020 (r363043) +++ stable/12/sys/conf/config.mkThu Jul 9 14:18:14 2020 (r363044) @@ -29,6 +29,10 @@ opt_printf.h: echo "#define PRINTF_BUFR_SIZE 128" > ${.TARGET} opt_scsi.h: echo "#define SCSI_DELAY 15000" > ${.TARGET} +.if ${MK_SCTP_SUPPORT} != "no" +opt_sctp.h: + @echo "#define SCTP_SUPPORT 1" > ${.TARGET} +.endif opt_wlan.h: echo "#define IEEE80211_DEBUG 1" > ${.TARGET} echo "#define IEEE80211_AMPDU_AGE 1" >> ${.TARGET} @@ -44,6 +48,9 @@ KERN_OPTS+= INET TCP_OFFLOAD .endif .if ${MK_INET6_SUPPORT} != "no" KERN_OPTS+= INET6 +.endif +.if ${MK_SCTP_SUPPORT} != "no" +KERN_OPTS+= SCTP_SUPPORT .endif .elif !defined(KERN_OPTS) KERN_OPTS!=cat ${KERNBUILDDIR}/opt*.h | awk '{print $$2;}' | sort -u Modified: stable/12/sys/conf/kern.opts.mk == --- stable/12/sys/conf/kern.opts.mk Thu Jul 9 14:17:04 2020 (r363043) +++ stable/12/sys/conf/kern.opts.mk Thu Jul 9 14:18:14 2020 (r363044) @@ -43,6 +43,7 @@ __DEFAULT_YES_OPTIONS = \ NETGRAPH \ PF \ REPRODUCIBLE_BUILD \ +SCTP_SUPPORT \ SOURCELESS_HOST \ SOURCELESS_UCODE \ 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: r363043 - stable/12/sbin/ipfw
Author: markj Date: Thu Jul 9 14:17:04 2020 New Revision: 363043 URL: https://svnweb.freebsd.org/changeset/base/363043 Log: MFC r362619: ipfw: Support the literal IPv6 address syntax in the fwd command. Modified: stable/12/sbin/ipfw/ipfw2.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/ipfw/ipfw2.c == --- stable/12/sbin/ipfw/ipfw2.c Thu Jul 9 13:19:00 2020(r363042) +++ stable/12/sbin/ipfw/ipfw2.c Thu Jul 9 14:17:04 2020(r363043) @@ -3990,8 +3990,7 @@ chkarg: * IPv4 a.b.c.d,port * IPv4 a.b.c.d:port * IPv6 w:x:y::z,port -* The ':' can only be used with hostname and IPv4 address. -* XXX-BZ Should we also support [w:x:y::z]:port? +* IPv6 [w:x:y::z]:port */ struct sockaddr_storage result; struct addrinfo *res; @@ -4001,33 +4000,45 @@ chkarg: NEED1("missing forward address[:port]"); - /* -* locate the address-port separator (':' or ',') -*/ - s = strchr(*av, ','); - if (s == NULL) { - /* Distinguish between IPv4:port and IPv6 cases. */ - s = strchr(*av, ':'); - if (s && strchr(s+1, ':')) - s = NULL; /* no port */ - } - - port_number = 0; - if (s != NULL) { - /* Terminate host portion and set s to start of port. */ - *(s++) = '\0'; - i = strtoport(s, &end, 0 /* base */, 0 /* proto */); - if (s == end) - errx(EX_DATAERR, - "illegal forwarding port ``%s''", s); - port_number = (u_short)i; - } - if (_substrcmp(*av, "tablearg") == 0) { family = PF_INET; ((struct sockaddr_in*)&result)->sin_addr.s_addr = INADDR_ANY; } else { + /* +* Are we an bracket-enclosed IPv6 address? +*/ + if (strchr(*av, '[')) + (*av)++; + + /* +* locate the address-port separator (':' or ',') +*/ + s = strchr(*av, ','); + if (s == NULL) { + s = strchr(*av, ']'); + /* Prevent erroneous parsing on brackets. */ + if (s != NULL) + *(s++) = '\0'; + else + s = *av; + + /* Distinguish between IPv4:port and IPv6 cases. */ + s = strchr(s, ':'); + if (s && strchr(s+1, ':')) + s = NULL; /* no port */ + } + + if (s != NULL) { + /* Terminate host portion and set s to start of port. */ + *(s++) = '\0'; + i = strtoport(s, &end, 0 /* base */, 0 /* proto */); + if (s == end) + errx(EX_DATAERR, + "illegal forwarding port ``%s''", s); + port_number = (u_short)i; + } + /* * Resolve the host name or address to a family and a * network representation of the address. ___ 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: r363042 - head/stand/libsa/zfs
Author: tsoome Date: Thu Jul 9 13:19:00 2020 New Revision: 363042 URL: https://svnweb.freebsd.org/changeset/base/363042 Log: loader: setting vdev size based on label asize is not working Because we need to read asize from vdev_tree. We also need to consider different vdev type difference. Reviewed by: allanjude Sponsored by: Netflix, Klara Inc. Differential Revision:https://reviews.freebsd.org/D25586 Modified: head/stand/libsa/zfs/zfsimpl.c Modified: head/stand/libsa/zfs/zfsimpl.c == --- head/stand/libsa/zfs/zfsimpl.c Thu Jul 9 11:06:29 2020 (r363041) +++ head/stand/libsa/zfs/zfsimpl.c Thu Jul 9 13:19:00 2020 (r363042) @@ -1586,6 +1586,57 @@ vdev_label_read(vdev_t *vd, int l, void *buf, uint64_t return (vdev_read_phys(vd, &bp, buf, off, size)); } +static uint64_t +vdev_get_label_asize(nvlist_t *nvl) +{ + nvlist_t *vdevs; + uint64_t asize; + const char *type; + int len; + + asize = 0; + /* Get vdev tree */ + if (nvlist_find(nvl, ZPOOL_CONFIG_VDEV_TREE, DATA_TYPE_NVLIST, + NULL, &vdevs, NULL) != 0) + return (asize); + + /* +* Get vdev type. We will calculate asize for raidz, mirror and disk. +* For raidz, the asize is raw size of all children. +*/ + if (nvlist_find(vdevs, ZPOOL_CONFIG_TYPE, DATA_TYPE_STRING, + NULL, &type, &len) != 0) + goto done; + + if (memcmp(type, VDEV_TYPE_MIRROR, len) != 0 && + memcmp(type, VDEV_TYPE_DISK, len) != 0 && + memcmp(type, VDEV_TYPE_RAIDZ, len) != 0) + goto done; + + if (nvlist_find(vdevs, ZPOOL_CONFIG_ASIZE, DATA_TYPE_UINT64, + NULL, &asize, NULL) != 0) + goto done; + + if (memcmp(type, VDEV_TYPE_RAIDZ, len) == 0) { + nvlist_t *kids; + int nkids; + + if (nvlist_find(vdevs, ZPOOL_CONFIG_CHILDREN, + DATA_TYPE_NVLIST_ARRAY, &nkids, &kids, NULL) != 0) { + asize = 0; + goto done; + } + + asize /= nkids; + nvlist_destroy(kids); + } + + asize += VDEV_LABEL_START_SIZE + VDEV_LABEL_END_SIZE; +done: + nvlist_destroy(vdevs); + return (asize); +} + static nvlist_t * vdev_label_read_config(vdev_t *vd, uint64_t txg) { @@ -1631,10 +1682,9 @@ vdev_label_read_config(vdev_t *vd, uint64_t txg) * Use asize from pool config. We need this * because we can get bad value from BIOS. */ - if (nvlist_find(nvl, ZPOOL_CONFIG_ASIZE, - DATA_TYPE_UINT64, NULL, &asize, NULL) == 0) { - vd->v_psize = asize + - VDEV_LABEL_START_SIZE + VDEV_LABEL_END_SIZE; + asize = vdev_get_label_asize(nvl); + if (asize != 0) { + vd->v_psize = asize; } } nvlist_destroy(tmp); ___ 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: r363041 - stable/11/sys/dev/mlx5/mlx5_core
Author: kib Date: Thu Jul 9 11:06:29 2020 New Revision: 363041 URL: https://svnweb.freebsd.org/changeset/base/363041 Log: MFC r362887: mlx5_core: remove unneccessary LFENCE instruction. Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c == --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c Thu Jul 9 10:54:00 2020 (r363040) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c Thu Jul 9 11:06:29 2020 (r363041) @@ -240,7 +240,7 @@ static int mlx5_eq_int(struct mlx5_core_dev *dev, stru * Make sure we read EQ entry contents after we've * checked the ownership bit. */ - rmb(); + atomic_thread_fence_acq(); mlx5_core_dbg(eq->dev, "eqn %d, eqe type %s\n", eq->eqn, eqe_type_str(eqe->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: r363040 - stable/12/sys/dev/mlx5/mlx5_core
Author: kib Date: Thu Jul 9 10:54:00 2020 New Revision: 363040 URL: https://svnweb.freebsd.org/changeset/base/363040 Log: MFC r362887: mlx5_core: remove unneccessary LFENCE instruction. Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c == --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c Thu Jul 9 10:52:02 2020 (r363039) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c Thu Jul 9 10:54:00 2020 (r363040) @@ -240,7 +240,7 @@ static int mlx5_eq_int(struct mlx5_core_dev *dev, stru * Make sure we read EQ entry contents after we've * checked the ownership bit. */ - rmb(); + atomic_thread_fence_acq(); mlx5_core_dbg(eq->dev, "eqn %d, eqe type %s\n", eq->eqn, eqe_type_str(eqe->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: r363039 - stable/12/sys/compat/linuxkpi/common/src
Author: kib Date: Thu Jul 9 10:52:02 2020 New Revision: 363039 URL: https://svnweb.freebsd.org/changeset/base/363039 Log: MFC r362886: linuxkpi: improvements for linux_pid_task() and linux_get_pid_task(). Modified: stable/12/sys/compat/linuxkpi/common/src/linux_current.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/src/linux_current.c == --- stable/12/sys/compat/linuxkpi/common/src/linux_current.cThu Jul 9 10:50:06 2020(r363038) +++ stable/12/sys/compat/linuxkpi/common/src/linux_current.cThu Jul 9 10:52:02 2020(r363039) @@ -155,65 +155,52 @@ linuxkpi_thread_dtor(void *arg __unused, struct thread put_task_struct(ts); } -struct task_struct * -linux_pid_task(pid_t pid) +static struct task_struct * +linux_get_pid_task_int(pid_t pid, const bool do_get) { struct thread *td; struct proc *p; + struct task_struct *ts; - /* try to find corresponding thread */ - td = tdfind(pid, -1); - if (td != NULL) { - struct task_struct *ts = td->td_lkpi_task; - PROC_UNLOCK(td->td_proc); - return (ts); - } - - /* try to find corresponding procedure */ - p = pfind(pid); - if (p != NULL) { - FOREACH_THREAD_IN_PROC(p, td) { - struct task_struct *ts = td->td_lkpi_task; - if (ts != NULL) { - PROC_UNLOCK(p); - return (ts); + if (pid > PID_MAX) { + /* try to find corresponding thread */ + td = tdfind(pid, -1); + if (td != NULL) { + ts = td->td_lkpi_task; + if (do_get && ts != NULL) + get_task_struct(ts); + PROC_UNLOCK(td->td_proc); + return (ts); + } + } else { + /* try to find corresponding procedure */ + p = pfind(pid); + if (p != NULL) { + FOREACH_THREAD_IN_PROC(p, td) { + ts = td->td_lkpi_task; + if (ts != NULL) { + if (do_get) + get_task_struct(ts); + PROC_UNLOCK(p); + return (ts); + } } + PROC_UNLOCK(p); } - PROC_UNLOCK(p); } return (NULL); } struct task_struct * -linux_get_pid_task(pid_t pid) +linux_pid_task(pid_t pid) { - struct thread *td; - struct proc *p; + return (linux_get_pid_task_int(pid, false)); +} - /* try to find corresponding thread */ - td = tdfind(pid, -1); - if (td != NULL) { - struct task_struct *ts = td->td_lkpi_task; - if (ts != NULL) - get_task_struct(ts); - PROC_UNLOCK(td->td_proc); - return (ts); - } - - /* try to find corresponding procedure */ - p = pfind(pid); - if (p != NULL) { - FOREACH_THREAD_IN_PROC(p, td) { - struct task_struct *ts = td->td_lkpi_task; - if (ts != NULL) { - get_task_struct(ts); - PROC_UNLOCK(p); - return (ts); - } - } - PROC_UNLOCK(p); - } - return (NULL); +struct task_struct * +linux_get_pid_task(pid_t pid) +{ + return (linux_get_pid_task_int(pid, true)); } bool ___ 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: r363038 - stable/12/sys/kern
Author: kib Date: Thu Jul 9 10:50:06 2020 New Revision: 363038 URL: https://svnweb.freebsd.org/changeset/base/363038 Log: MFC r362885: Use tdfind() in pget(). Modified: stable/12/sys/kern/kern_proc.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_proc.c == --- stable/12/sys/kern/kern_proc.c Thu Jul 9 09:33:32 2020 (r363037) +++ stable/12/sys/kern/kern_proc.c Thu Jul 9 10:50:06 2020 (r363038) @@ -370,29 +370,6 @@ pfind_any(pid_t pid) return (p); } -static struct proc * -pfind_tid_locked(pid_t tid) -{ - struct proc *p; - struct thread *td; - - sx_assert(&allproc_lock, SX_LOCKED); - FOREACH_PROC_IN_SYSTEM(p) { - PROC_LOCK(p); - if (p->p_state == PRS_NEW) { - PROC_UNLOCK(p); - continue; - } - FOREACH_THREAD_IN_PROC(p, td) { - if (td->td_tid == tid) - goto found; - } - PROC_UNLOCK(p); - } -found: - return (p); -} - /* * Locate a process group by number. * The caller must hold proctree_lock. @@ -420,23 +397,24 @@ int pget(pid_t pid, int flags, struct proc **pp) { struct proc *p; + struct thread *td1; int error; p = curproc; if (p->p_pid == pid) { PROC_LOCK(p); } else { - sx_slock(&allproc_lock); if (pid <= PID_MAX) { + sx_slock(&allproc_lock); p = pfind_locked(pid); if (p == NULL && (flags & PGET_NOTWEXIT) == 0) p = zpfind_locked(pid); + sx_sunlock(&allproc_lock); } else if ((flags & PGET_NOTID) == 0) { - p = pfind_tid_locked(pid); - } else { - p = NULL; + td1 = tdfind(pid, -1); + if (td1 != NULL) + p = td1->td_proc; } - sx_sunlock(&allproc_lock); if (p == NULL) return (ESRCH); if ((flags & PGET_CANSEE) != 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: r362962 - head/sys/net
On 2020-07-06 16:52, Mark Johnston wrote: Author: markj Date: Mon Jul 6 14:52:09 2020 New Revision: 362962 URL: https://svnweb.freebsd.org/changeset/base/362962 Log: iflib: Fix handling of mbuf cluster allocation failures. When refilling an rx freelist, make sure we only update the hardware producer index if at least one cluster was allocated. Otherwise the NIC is programmed to write a previously used cluster, typically resulting in a use-after-free when packet data is written by the hardware. Also make sure that we don't update the fragment index cursor if the last allocation attempt didn't succeed. For at least Intel drivers, iflib assumes that the consumer index and fragment index cursor stay in lockstep, but this assumption was violated in the face of cluster allocation failures. Hi Mark, Thanks for working on this. I can confirm the issue Mellanox has seen in this area is solved by your patch. --HPS ___ 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: r363037 - in stable/12: lib/libifconfig sbin/ifconfig sys/net
Author: freqlabs Date: Thu Jul 9 09:33:32 2020 New Revision: 363037 URL: https://svnweb.freebsd.org/changeset/base/363037 Log: MFC r362824: libifconfig: Add function to get bridge status The new function operates similarly to ifconfig_lagg_get_lagg_status and likewise is accompanied by a function to free the bridge status data structure. I have included in this patch the relocation of some strings describing STP parameters and the PV2ID macro from ifconfig into net/if_bridgevar.h as they are useful for consumers of libifconfig. Reviewed by:kp, melifaro, mmacy Relnotes: yes Differential Revision: https://reviews.freebsd.org/D25460 Added: stable/12/lib/libifconfig/libifconfig_bridge.c - copied unchanged from r362824, head/lib/libifconfig/libifconfig_bridge.c Modified: stable/12/lib/libifconfig/Makefile stable/12/lib/libifconfig/libifconfig.h stable/12/sbin/ifconfig/ifbridge.c stable/12/sys/net/if_bridgevar.h Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libifconfig/Makefile == --- stable/12/lib/libifconfig/Makefile Thu Jul 9 08:00:46 2020 (r363036) +++ stable/12/lib/libifconfig/Makefile Thu Jul 9 09:33:32 2020 (r363037) @@ -8,9 +8,14 @@ NO_PIC= SHLIBDIR?= /lib SHLIB_MAJOR= 1 -SRCS= libifconfig.c libifconfig_carp.c libifconfig_inet.c -SRCS+= libifconfig_inet6.c libifconfig_internal.c libifconfig_lagg.c -SRCS+= libifconfig_media.c +SRCS= libifconfig.c \ + libifconfig_bridge.c \ + libifconfig_carp.c \ + libifconfig_inet.c \ + libifconfig_inet6.c \ + libifconfig_internal.c \ + libifconfig_lagg.c \ + libifconfig_media.c INCSDIR= ${INCLUDEDIR} INCS= libifconfig.h Modified: stable/12/lib/libifconfig/libifconfig.h == --- stable/12/lib/libifconfig/libifconfig.h Thu Jul 9 08:00:46 2020 (r363036) +++ stable/12/lib/libifconfig/libifconfig.h Thu Jul 9 09:33:32 2020 (r363037) @@ -49,12 +49,23 @@ typedef struct ifconfig_handle ifconfig_handle_t; struct carpreq; struct ifaddrs; +struct ifbropreq; +struct ifbreq; struct in6_ndireq; struct lagg_reqall; struct lagg_reqflags; struct lagg_reqopts; struct lagg_reqport; +/** Stores extra info associated with a bridge(4) interface */ +struct ifconfig_bridge_status { + struct ifbropreq *params; /**< current operational parameters */ + struct ifbreq *members; /**< list of bridge members */ + size_t members_count; /**< how many member interfaces */ + uint32_t cache_size;/**< size of address cache */ + uint32_t cache_lifetime;/**< address cache entry lifetime */ +}; + struct ifconfig_capabilities { /** Current capabilities (ifconfig prints this as 'options')*/ int curcap; @@ -217,6 +228,16 @@ int ifconfig_inet_get_addrinfo(ifconfig_handle_t *h, int ifconfig_inet6_get_addrinfo(ifconfig_handle_t *h, const char *name, struct ifaddrs *ifa, struct ifconfig_inet6_addr *addr); +/** Retrieve additional information about a bridge(4) interface */ +int ifconfig_bridge_get_bridge_status(ifconfig_handle_t *h, +const char *name, struct ifconfig_bridge_status **bridge); + +/** Frees the structure returned by ifconfig_bridge_get_bridge_status. Does + * nothing if the argument is NULL + * @param bridge Pointer to the structure to free + */ +void ifconfig_bridge_free_bridge_status(struct ifconfig_bridge_status *bridge); + /** Retrieve additional information about a lagg(4) interface */ int ifconfig_lagg_get_lagg_status(ifconfig_handle_t *h, const char *name, struct ifconfig_lagg_status **lagg_status); @@ -225,8 +246,8 @@ int ifconfig_lagg_get_lagg_status(ifconfig_handle_t *h int ifconfig_lagg_get_laggport_status(ifconfig_handle_t *h, const char *name, struct lagg_reqport *rp); -/** Frees the structure returned by ifconfig_lagg_get_status. Does nothing if - * the argument is NULL +/** Frees the structure returned by ifconfig_lagg_get_lagg_status. Does + * nothing if the argument is NULL * @param laggstat Pointer to the structure to free */ void ifconfig_lagg_free_lagg_status(struct ifconfig_lagg_status *laggstat); Copied: stable/12/lib/libifconfig/libifconfig_bridge.c (from r362824, head/lib/libifconfig/libifconfig_bridge.c) == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/lib/libifconfig/libifconfig_bridge.c Thu Jul 9 09:33:32 2020(r363037, copy of r362824, head/lib/libifconfig/libifconfig_bridge.c) @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2020, Ryan Moeller + * + * Redistribution and
svn commit: r363036 - head/sys/geom/concat
Author: delphij Date: Thu Jul 9 08:00:46 2020 New Revision: 363036 URL: https://svnweb.freebsd.org/changeset/base/363036 Log: g_concat_find_device: trim /dev/ if it is present, like other GEOM classes. Reviewed by: cem MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D25596 Modified: head/sys/geom/concat/g_concat.c Modified: head/sys/geom/concat/g_concat.c == --- head/sys/geom/concat/g_concat.c Thu Jul 9 03:46:07 2020 (r363035) +++ head/sys/geom/concat/g_concat.c Thu Jul 9 08:00:46 2020 (r363036) @@ -897,6 +897,9 @@ g_concat_find_device(struct g_class *mp, const char *n struct g_concat_softc *sc; struct g_geom *gp; + if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0) + name += strlen(_PATH_DEV); + LIST_FOREACH(gp, &mp->geom, geom) { sc = gp->softc; if (sc == NULL) ___ 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"