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, ); - else + if (!stripped) digestresult = copy(from_fd, from_name, to_fd, tempcopy ? tempfile : to_name, from_sb.st_size); } ___ 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: 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, ) == 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, ) == 0); + ATF_REQUIRE(sb.st_size == 2 * sizeof(buf)); close(fd); } ___ 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: 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(>shm_rl, 0, OFF_MAX, >shm_mtx); } else { rl_cookie = rangelock_wlock(>shm_rl, uio->uio_offset, - uio->uio_offset + uio->uio_resid, >shm_mtx); + size, >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(>shm_rl, rl_cookie, >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, _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-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: 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, ); + 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, + ); /* -* 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(); 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) + if
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-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: 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-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: 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-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: 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 @@
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: 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-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: 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(>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-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: r363031 - in head: contrib/bmake contrib/bmake/lst.lib contrib/bmake/mk contrib/bmake/mk/sys contrib/bmake/unit-tests usr.bin/bmake (make now broken)
Mark Millard wrote: > > though the one in ports is real issue: > > > > $ make config > > make: "/usr/ports/Mk/bsd.port.mk" line 2096: warning: String comparison > > operator should be either == or != > > make: "/usr/ports/Mk/bsd.port.mk" line 2096: Malformed conditional > > (defined(MAKE_JOBS_NUMBER_LIMIT) && ( ${MAKE_JOBS_NUMBER_LIMIT} < > > ${_MAKE_JOBS_NUMBER} )) The above should be equivalent to V42 = 42 .if defined(V69) && ( ${V69} < ${V42} ) .endif which in a unit-test works just fine. Same goes for the warnings in bsd.compiler.mk ;-( ___ 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: 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(, "%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, , ); + error = getaddrinfo(host, hport, , ); 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(, "%.*s", (int)(p - host), host); + + if (*p != ':') { + s_asprintf(, "%s", port); + break; + } + + pstr = ++p; + SCAN(p, buf+len, isdigit(*p)); + if (p > pstr && (p - pstr) < 6) { + s_asprintf(, "%.*s", + (int)(p - pstr), pstr); + break; + } + + /* Invalid port; don't recurse */ + free(nhost); + nhost = NULL; + } break; } for (i = 0; actually_arin[i] != NULL; i++) { if (strncmp(buf,
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-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: 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-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: 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", , 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 hdr; +
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 = >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 = >strmin[sid]; + if (!TAILQ_EMPTY(>uno_inqueue)) { + sctp_flush_reassm_for_str_seq(stcb, asoc, strm, TAILQ_FIRST(>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 = >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, >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, >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(>uno_inqueue)) { + sctp_flush_reassm_for_str_seq(stcb, asoc, strm, TAILQ_FIRST(>uno_inqueue), ordered, new_cum_tsn); + } + } } TAILQ_FOREACH(control, >sctp_ep->read_queue, next) { if ((control->sinfo_stream == sid) && ___ 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: 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, , 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, , 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, , ) != 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, , 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, , , 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, , 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-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: 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-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: 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, >geom, geom) { sc = gp->softc; if (sc == NULL) ___ 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"