Re: svn commit: r359374 - in head: . share/man/man4 share/man/man7 share/man/man9 sys/crypto/aesni sys/crypto/armv8 sys/crypto/blake2 sys/crypto/ccp sys/crypto/via sys/dev/cesa sys/dev/cxgbe sys/dev/c
Alexey Dokuchaev wrote this message on Mon, Apr 13, 2020 at 04:32 +: > On Sun, Apr 12, 2020 at 01:08:49PM -0700, Xin Li via svn-src-all wrote: > > On 3/27/20 11:25 AM, John Baldwin wrote: > > > - Drivers no longer register a list of supported algorithms. [...] > > > > For user-visible interface, it seems like we are essentially treating > > "accelerated software" like AES-NI the same way of plain software. For > > example, geom_eli would now say: > > > > GEOM_ELI: Encryption: AES-XTS 128 > > GEOM_ELI: Crypto: software > > > > Instead of: > > > > GEOM_ELI: Encryption: AES-XTS 128 > > GEOM_ELI: Crypto: hardware > > > > [...] and it's much easier for system administrators if we expose the > > fact that they are using some kind of acceleration than asking them to > > run DTrace etc. to find out. Personally, I think it's probably better > > to change the notion to either "accelerated" (by either hardware or > > software) and "software"... > > +1 for "accelerated" vs. "software". For most users "accelerated" would > mean AES-NI (dedicated crypto cards are not as common), and since most > modern CPUs have those, not being able to easily distinguish between that > and "pure software" (unaccelerated) mode is rather frustrating. Yeah, w/o a differentiation, people can't tell if the aesni.ko module was loaded or not... I use this to make sure things will go fast.. If I see software, I know it'll be slow... -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." ___ 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: r359374 - in head: . share/man/man4 share/man/man7 share/man/man9 sys/crypto/aesni sys/crypto/armv8 sys/crypto/blake2 sys/crypto/ccp sys/crypto/via sys/dev/cesa sys/dev/cxgbe sys/dev/c
On Sun, Apr 12, 2020 at 01:08:49PM -0700, Xin Li via svn-src-all wrote: > On 3/27/20 11:25 AM, John Baldwin wrote: > > - Drivers no longer register a list of supported algorithms. [...] > > For user-visible interface, it seems like we are essentially treating > "accelerated software" like AES-NI the same way of plain software. For > example, geom_eli would now say: > > GEOM_ELI: Encryption: AES-XTS 128 > GEOM_ELI: Crypto: software > > Instead of: > > GEOM_ELI: Encryption: AES-XTS 128 > GEOM_ELI: Crypto: hardware > > [...] and it's much easier for system administrators if we expose the > fact that they are using some kind of acceleration than asking them to > run DTrace etc. to find out. Personally, I think it's probably better > to change the notion to either "accelerated" (by either hardware or > software) and "software"... +1 for "accelerated" vs. "software". For most users "accelerated" would mean AES-NI (dedicated crypto cards are not as common), and since most modern CPUs have those, not being able to easily distinguish between that and "pure software" (unaccelerated) mode is rather frustrating. ./danfe ___ 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: r359843 - in stable: 11/sys/dev/mii 12/sys/dev/mii
Author: jhibbits Date: Mon Apr 13 00:50:35 2020 New Revision: 359843 URL: https://svnweb.freebsd.org/changeset/base/359843 Log: MFC r359756: Add support for BCM54618SE PHY Sponsored by: Juniper Networks, Inc Modified: stable/12/sys/dev/mii/brgphy.c stable/12/sys/dev/mii/miidevs Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/dev/mii/brgphy.c stable/11/sys/dev/mii/miidevs Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/dev/mii/brgphy.c == --- stable/12/sys/dev/mii/brgphy.c Mon Apr 13 00:38:02 2020 (r359842) +++ stable/12/sys/dev/mii/brgphy.c Mon Apr 13 00:50:35 2020 (r359843) @@ -152,6 +152,7 @@ static const struct mii_phydesc brgphys[] = { #ifdef notyet /* better handled by ukphy(4) until WARs are implemented */ MII_PHY_DESC(BROADCOM2, BCM5785), #endif + MII_PHY_DESC(BROADCOM3, BCM54618SE), MII_PHY_DESC(BROADCOM3, BCM5717C), MII_PHY_DESC(BROADCOM3, BCM5719C), MII_PHY_DESC(BROADCOM3, BCM5720C), Modified: stable/12/sys/dev/mii/miidevs == --- stable/12/sys/dev/mii/miidevs Mon Apr 13 00:38:02 2020 (r359842) +++ stable/12/sys/dev/mii/miidevs Mon Apr 13 00:50:35 2020 (r359843) @@ -190,6 +190,7 @@ model BROADCOM2 BCM5784 0x003a BCM5784 10/100/1000bas model BROADCOM2 BCM5709C 0x003c BCM5709 10/100/1000baseT PHY model BROADCOM2 BCM57610x003d BCM5761 10/100/1000baseT PHY model BROADCOM2 BCM5709S 0x003f BCM5709S/5720S 1000/2500baseSX PHY +model BROADCOM3 BCM54618SE 0x000d BCM54618SE 10/100/1000BASE-T PHY model BROADCOM3 BCM57780 0x0019 BCM57780 1000BASE-T media interface model BROADCOM3 BCM5717C 0x0020 BCM5717C 1000BASE-T media interface model BROADCOM3 BCM5719C 0x0022 BCM5719C 1000BASE-T media interface ___ 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: r359843 - in stable: 11/sys/dev/mii 12/sys/dev/mii
Author: jhibbits Date: Mon Apr 13 00:50:35 2020 New Revision: 359843 URL: https://svnweb.freebsd.org/changeset/base/359843 Log: MFC r359756: Add support for BCM54618SE PHY Sponsored by: Juniper Networks, Inc Modified: stable/11/sys/dev/mii/brgphy.c stable/11/sys/dev/mii/miidevs Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/dev/mii/brgphy.c stable/12/sys/dev/mii/miidevs Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/dev/mii/brgphy.c == --- stable/11/sys/dev/mii/brgphy.c Mon Apr 13 00:38:02 2020 (r359842) +++ stable/11/sys/dev/mii/brgphy.c Mon Apr 13 00:50:35 2020 (r359843) @@ -150,6 +150,7 @@ static const struct mii_phydesc brgphys[] = { #ifdef notyet /* better handled by ukphy(4) until WARs are implemented */ MII_PHY_DESC(BROADCOM2, BCM5785), #endif + MII_PHY_DESC(BROADCOM3, BCM54618SE), MII_PHY_DESC(BROADCOM3, BCM5717C), MII_PHY_DESC(BROADCOM3, BCM5719C), MII_PHY_DESC(BROADCOM3, BCM5720C), Modified: stable/11/sys/dev/mii/miidevs == --- stable/11/sys/dev/mii/miidevs Mon Apr 13 00:38:02 2020 (r359842) +++ stable/11/sys/dev/mii/miidevs Mon Apr 13 00:50:35 2020 (r359843) @@ -190,6 +190,7 @@ model BROADCOM2 BCM5784 0x003a BCM5784 10/100/1000bas model BROADCOM2 BCM5709C 0x003c BCM5709 10/100/1000baseT PHY model BROADCOM2 BCM57610x003d BCM5761 10/100/1000baseT PHY model BROADCOM2 BCM5709S 0x003f BCM5709S/5720S 1000/2500baseSX PHY +model BROADCOM3 BCM54618SE 0x000d BCM54618SE 10/100/1000BASE-T PHY model BROADCOM3 BCM57780 0x0019 BCM57780 1000BASE-T media interface model BROADCOM3 BCM5717C 0x0020 BCM5717C 1000BASE-T media interface model BROADCOM3 BCM5719C 0x0022 BCM5719C 1000BASE-T media interface ___ 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: r359842 - stable/12/sys/kern
Author: emaste Date: Mon Apr 13 00:38:02 2020 New Revision: 359842 URL: https://svnweb.freebsd.org/changeset/base/359842 Log: MFC r359451: capabilities.conf: add info about capmode permitted syscalls Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/kern/capabilities.conf Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/capabilities.conf == --- stable/12/sys/kern/capabilities.confMon Apr 13 00:15:30 2020 (r359841) +++ stable/12/sys/kern/capabilities.confMon Apr 13 00:38:02 2020 (r359842) @@ -28,6 +28,11 @@ ## ## List of system calls enabled in capability mode, one name per line. ## +## System calls listed here operate either fully or partially in the absence +## of global namespaces or ambient authority. In capability mode system calls +## that operate only on global namespaces or require ambient authority have no +## utility and thus are not permitted. +## ## Notes: ## - sys_exit(2), abort2(2) and close(2) are very important. ## - Sorted alphabetically, please keep it that way. ___ 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: r359840 - head/sys/fs/nfs
Author: rmacklem Date: Mon Apr 13 00:07:37 2020 New Revision: 359840 URL: https://svnweb.freebsd.org/changeset/base/359840 Log: Delete the mbuf macros that were used for the Mac OS/X port. When the code was ported to Mac OS/X, mbuf handling functions were converted to using the Mac OS/X accessor functions. For FreeBSD, they are a simple set of macros in sys/fs/nfs/nfskpiport.h. Since r359757, r359780, r359785, r359810, r359811 have removed all uses of these macros, this patch deleted the macros from the .h files. My eventual goal is deleting nfskpiport.h, but that will take some more editting to replace uses of the remaining macros. Modified: head/sys/fs/nfs/nfskpiport.h head/sys/fs/nfs/nfsport.h Modified: head/sys/fs/nfs/nfskpiport.h == --- head/sys/fs/nfs/nfskpiport.hSun Apr 12 22:22:53 2020 (r359839) +++ head/sys/fs/nfs/nfskpiport.hMon Apr 13 00:07:37 2020 (r359840) @@ -44,15 +44,6 @@ typedef struct vnode * vnode_t; #definevnode_vtype(v) ((v)->v_type) typedef struct mbuf * mbuf_t; -#definembuf_freem(m) m_freem(m) -#definembuf_data(m)mtod((m), void *) -#definembuf_len(m) ((m)->m_len) -#definembuf_next(m)((m)->m_next) -#definembuf_setlen(m, l) ((m)->m_len = (l)) -#definembuf_setnext(m, p) ((m)->m_next = (p)) -#definembuf_pkthdr_len(m) ((m)->m_pkthdr.len) -#definembuf_pkthdr_setlen(m, l) ((m)->m_pkthdr.len = (l)) -#definembuf_pkthdr_setrcvif(m, p) ((m)->m_pkthdr.rcvif = (p)) /* * This stuff is needed by Darwin for handling the uio structure. Modified: head/sys/fs/nfs/nfsport.h == --- head/sys/fs/nfs/nfsport.h Sun Apr 12 22:22:53 2020(r359839) +++ head/sys/fs/nfs/nfsport.h Mon Apr 13 00:07:37 2020(r359840) @@ -172,7 +172,6 @@ MGETHDR((m), M_WAITOK, MT_DATA);\ } \ } while (0) -#defineNFSMTOD mtod /* * Client side constant for size of a lockowner name. ___ 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: r359839 - head/sys/sys
Author: kevans Date: Sun Apr 12 22:22:53 2020 New Revision: 359839 URL: https://svnweb.freebsd.org/changeset/base/359839 Log: Bump __FreeBSD_version after r359836, close_range(2) Reported by: cy Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h == --- head/sys/sys/param.hSun Apr 12 22:11:29 2020(r359838) +++ head/sys/sys/param.hSun Apr 12 22:22:53 2020(r359839) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300090 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300091 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, ___ 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: r359838 - in stable/12: etc/mtree sbin/nvmecontrol sbin/nvmecontrol/tests
Author: dab Date: Sun Apr 12 22:11:29 2020 New Revision: 359838 URL: https://svnweb.freebsd.org/changeset/base/359838 Log: MFC r359717: Add a basic test for nvmecontrol I recently made some bug fixes in nvmecontrol. It occurred to me that since nvmecontrol lacks any kyua tests, I should convert the informal testing I did into a more formal automated test. The test in this change should be considered just a starting point; it is neither complete nor thorough. While converting the test to ATF/kyua, I discovered a small bug in nvmecontrol; the nvmecontrol devlist command would always exit with an unsuccessful status. So I included the fix for that, too, so that the test won't fail. Sponsored by: Dell EMC Isilon Added: stable/12/sbin/nvmecontrol/tests/ - copied from r359717, head/sbin/nvmecontrol/tests/ Modified: stable/12/etc/mtree/BSD.tests.dist stable/12/sbin/nvmecontrol/Makefile stable/12/sbin/nvmecontrol/devlist.c Directory Properties: stable/12/ (props changed) Modified: stable/12/etc/mtree/BSD.tests.dist == --- stable/12/etc/mtree/BSD.tests.dist Sun Apr 12 21:23:51 2020 (r359837) +++ stable/12/etc/mtree/BSD.tests.dist Sun Apr 12 22:11:29 2020 (r359838) @@ -432,6 +432,8 @@ .. mdconfig .. +nvmecontrol +.. pfctl files .. Modified: stable/12/sbin/nvmecontrol/Makefile == --- stable/12/sbin/nvmecontrol/Makefile Sun Apr 12 21:23:51 2020 (r359837) +++ stable/12/sbin/nvmecontrol/Makefile Sun Apr 12 22:11:29 2020 (r359838) @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + PACKAGE=runtime PROG= nvmecontrol SRCS= comnd.c nvmecontrol.c @@ -11,6 +13,8 @@ MAN= nvmecontrol.8 LDFLAGS+= -rdynamic LIBADD+= util SUBDIR=modules +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests .PATH: ${SRCTOP}/sys/dev/nvme Modified: stable/12/sbin/nvmecontrol/devlist.c == --- stable/12/sbin/nvmecontrol/devlist.cSun Apr 12 21:23:51 2020 (r359837) +++ stable/12/sbin/nvmecontrol/devlist.cSun Apr 12 22:11:29 2020 (r359838) @@ -122,8 +122,10 @@ devlist(const struct cmd *f, int argc, char *argv[]) close(fd); } - if (found == 0) + if (found == 0) { printf("No NVMe controllers found.\n"); + exit(1); + } - exit(1); + exit(0); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r359836 - in head: include lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys tests/sys/file
In message <202004122123.03clnk82073...@repo.freebsd.org>, Kyle Evans writes: > Author: kevans > Date: Sun Apr 12 21:23:19 2020 > New Revision: 359836 > URL: https://svnweb.freebsd.org/changeset/base/359836 > > Log: > Implement a close_range(2) syscall > > close_range(min, max, flags) allows for a range of descriptors to be > closed. The Python folk have indicated that they would much prefer this > interface to closefrom(2), as the case may be that they/someone have specia > l > fds dup'd to higher in the range and they can't necessarily closefrom(min) > because they don't want to hit the upper range, but relocating them to lowe > r > isn't necessarily feasible. > > sys_closefrom has been rewritten to use kern_close_range() using ~0U to > indicate closing to the end of the range. This was chosen rather than > requiring callers of kern_close_range() to hold FILEDESC_SLOCK across the > call to kern_close_range for simplicity. > > The flags argument of close_range(2) is currently unused, so any flags set > is currently EINVAL. It was added to the interface in Linux so that future > flags could be added for, e.g., "halt on first error" and things of this > nature. > > This patch is based on a syscall of the same design that is expected to be > merged into Linux. > > Reviewed by:kib, markj, vangyzen (all slightly earlier revisions) > Differential Revision: https://reviews.freebsd.org/D21627 > > Modified: > head/include/unistd.h > head/lib/libc/sys/Makefile.inc > head/lib/libc/sys/Symbol.map > head/lib/libc/sys/closefrom.2 > head/sys/compat/freebsd32/syscalls.master > head/sys/kern/capabilities.conf > head/sys/kern/kern_descrip.c > head/sys/kern/syscalls.master > head/sys/sys/syscallsubr.h > head/tests/sys/file/closefrom_test.c A __FreeBSD_version bump should be for ports to test for. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r359837 - in head/sys: compat/freebsd32 kern sys
Author: kevans Date: Sun Apr 12 21:23:51 2020 New Revision: 359837 URL: https://svnweb.freebsd.org/changeset/base/359837 Log: sysent: re-roll after introduction of close_range in r359836 Modified: head/sys/compat/freebsd32/freebsd32_syscall.h head/sys/compat/freebsd32/freebsd32_syscalls.c head/sys/compat/freebsd32/freebsd32_sysent.c head/sys/compat/freebsd32/freebsd32_systrace_args.c head/sys/kern/init_sysent.c head/sys/kern/syscalls.c head/sys/kern/systrace_args.c head/sys/sys/syscall.h head/sys/sys/syscall.mk head/sys/sys/sysproto.h Modified: head/sys/compat/freebsd32/freebsd32_syscall.h == --- head/sys/compat/freebsd32/freebsd32_syscall.h Sun Apr 12 21:23:19 2020(r359836) +++ head/sys/compat/freebsd32/freebsd32_syscall.h Sun Apr 12 21:23:51 2020(r359837) @@ -501,4 +501,5 @@ #defineFREEBSD32_SYS_shm_rename572 #defineFREEBSD32_SYS_sigfastblock 573 #defineFREEBSD32_SYS___realpathat 574 -#defineFREEBSD32_SYS_MAXSYSCALL575 +#defineFREEBSD32_SYS_close_range 575 +#defineFREEBSD32_SYS_MAXSYSCALL576 Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c == --- head/sys/compat/freebsd32/freebsd32_syscalls.c Sun Apr 12 21:23:19 2020(r359836) +++ head/sys/compat/freebsd32/freebsd32_syscalls.c Sun Apr 12 21:23:51 2020(r359837) @@ -611,4 +611,5 @@ const char *freebsd32_syscallnames[] = { "shm_rename", /* 572 = shm_rename */ "sigfastblock", /* 573 = sigfastblock */ "__realpathat", /* 574 = __realpathat */ + "close_range", /* 575 = close_range */ }; Modified: head/sys/compat/freebsd32/freebsd32_sysent.c == --- head/sys/compat/freebsd32/freebsd32_sysent.cSun Apr 12 21:23:19 2020(r359836) +++ head/sys/compat/freebsd32/freebsd32_sysent.cSun Apr 12 21:23:51 2020(r359837) @@ -664,4 +664,5 @@ struct sysent freebsd32_sysent[] = { { AS(shm_rename_args), (sy_call_t *)sys_shm_rename, AUE_SHMRENAME, NULL, 0, 0, 0, SY_THR_STATIC }, /* 572 = shm_rename */ { AS(sigfastblock_args), (sy_call_t *)sys_sigfastblock, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 573 = sigfastblock */ { AS(__realpathat_args), (sy_call_t *)sys___realpathat, AUE_REALPATHAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 574 = __realpathat */ + { AS(close_range_args), (sy_call_t *)sys_close_range, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },/* 575 = close_range */ }; Modified: head/sys/compat/freebsd32/freebsd32_systrace_args.c == --- head/sys/compat/freebsd32/freebsd32_systrace_args.c Sun Apr 12 21:23:19 2020(r359836) +++ head/sys/compat/freebsd32/freebsd32_systrace_args.c Sun Apr 12 21:23:51 2020(r359837) @@ -3374,6 +3374,15 @@ systrace_args(int sysnum, void *params, uint64_t *uarg *n_args = 5; break; } + /* close_range */ + case 575: { + struct close_range_args *p = params; + uarg[0] = p->lowfd; /* u_int */ + uarg[1] = p->highfd; /* u_int */ + iarg[2] = p->flags; /* int */ + *n_args = 3; + break; + } default: *n_args = 0; break; @@ -9095,6 +9104,22 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; }; break; + /* close_range */ + case 575: + switch(ndx) { + case 0: + p = "u_int"; + break; + case 1: + p = "u_int"; + break; + case 2: + p = "int"; + break; + default: + break; + }; + break; default: break; }; @@ -10991,6 +11016,11 @@ systrace_return_setargdesc(int sysnum, int ndx, char * break; /* __realpathat */ case 574: + if (ndx == 0 || ndx == 1) + p = "int"; + break; + /* close_range */ + case 575: if (ndx == 0 || ndx == 1) p = "int"; break; Modified: head/sys/kern/init_sysent.c == --- head/sys/kern/init_sysent.c Sun Apr 12 21:23:19 2020(r359836) +++ head/sys/kern/init_sysent.c Sun Apr 12 21:23:51 2020
svn commit: r359836 - in head: include lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys tests/sys/file
Author: kevans Date: Sun Apr 12 21:23:19 2020 New Revision: 359836 URL: https://svnweb.freebsd.org/changeset/base/359836 Log: Implement a close_range(2) syscall close_range(min, max, flags) allows for a range of descriptors to be closed. The Python folk have indicated that they would much prefer this interface to closefrom(2), as the case may be that they/someone have special fds dup'd to higher in the range and they can't necessarily closefrom(min) because they don't want to hit the upper range, but relocating them to lower isn't necessarily feasible. sys_closefrom has been rewritten to use kern_close_range() using ~0U to indicate closing to the end of the range. This was chosen rather than requiring callers of kern_close_range() to hold FILEDESC_SLOCK across the call to kern_close_range for simplicity. The flags argument of close_range(2) is currently unused, so any flags set is currently EINVAL. It was added to the interface in Linux so that future flags could be added for, e.g., "halt on first error" and things of this nature. This patch is based on a syscall of the same design that is expected to be merged into Linux. Reviewed by: kib, markj, vangyzen (all slightly earlier revisions) Differential Revision:https://reviews.freebsd.org/D21627 Modified: head/include/unistd.h head/lib/libc/sys/Makefile.inc head/lib/libc/sys/Symbol.map head/lib/libc/sys/closefrom.2 head/sys/compat/freebsd32/syscalls.master head/sys/kern/capabilities.conf head/sys/kern/kern_descrip.c head/sys/kern/syscalls.master head/sys/sys/syscallsubr.h head/tests/sys/file/closefrom_test.c Modified: head/include/unistd.h == --- head/include/unistd.h Sun Apr 12 20:54:35 2020(r359835) +++ head/include/unistd.h Sun Apr 12 21:23:19 2020(r359836) @@ -494,6 +494,7 @@ struct crypt_data { int acct(const char *); int async_daemon(void); int check_utility_compat(const char *); +int close_range(unsigned int, unsigned int, int); ssize_t copy_file_range(int, off_t *, int, off_t *, size_t, unsigned int); const char * crypt_get_format(void); Modified: head/lib/libc/sys/Makefile.inc == --- head/lib/libc/sys/Makefile.inc Sun Apr 12 20:54:35 2020 (r359835) +++ head/lib/libc/sys/Makefile.inc Sun Apr 12 21:23:19 2020 (r359836) @@ -371,6 +371,7 @@ MLINKS+=chown.2 fchown.2 \ chown.2 lchown.2 MLINKS+=clock_gettime.2 clock_getres.2 \ clock_gettime.2 clock_settime.2 +MLINKS+=closefrom.2 close_range.2 MLINKS+=nanosleep.2 clock_nanosleep.2 MLINKS+=cpuset.2 cpuset_getid.2 \ cpuset.2 cpuset_setid.2 Modified: head/lib/libc/sys/Symbol.map == --- head/lib/libc/sys/Symbol.mapSun Apr 12 20:54:35 2020 (r359835) +++ head/lib/libc/sys/Symbol.mapSun Apr 12 21:23:19 2020 (r359836) @@ -403,6 +403,7 @@ FBSD_1.5 { FBSD_1.6 { __sysctlbyname; + close_range; copy_file_range; fhlink; fhlinkat; Modified: head/lib/libc/sys/closefrom.2 == --- head/lib/libc/sys/closefrom.2 Sun Apr 12 20:54:35 2020 (r359835) +++ head/lib/libc/sys/closefrom.2 Sun Apr 12 21:23:19 2020 (r359836) @@ -25,11 +25,12 @@ .\" .\" $FreeBSD$ .\" -.Dd June 12, 2009 +.Dd April 12, 2020 .Dt CLOSEFROM 2 .Os .Sh NAME -.Nm closefrom +.Nm closefrom , +.Nm close_range .Nd delete open file descriptors .Sh LIBRARY .Lb libc @@ -37,6 +38,8 @@ .In unistd.h .Ft void .Fn closefrom "int lowfd" +.Ft int +.Fn close_range "u_int lowfd" "u_int highfd" "int flags" .Sh DESCRIPTION The .Fn closefrom @@ -44,6 +47,40 @@ system call deletes all open file descriptors greater .Fa lowfd from the per-process object reference table. Any errors encountered while closing file descriptors are ignored. +.Pp +The +.Fn close_range +system call deletes all open file descriptors between +.Fa lowfd +and +.Fa highfd +inclusive, clamped to the range of open file descriptors. +Any errors encountered while closing file descriptors are ignored. +There are currently no defined +.Fa flags . +.Sh RETURN VALUES +Upon successful completion, +.Fn close_range +returns a value +of 0. +Otherwise, a value of -1 is returned and the global variable +.Va errno +is set to indicate the error. +.Sh ERRORS +The +.Fn close_range +system call +will fail if: +.Bl -tag -width Er +.It Bq Er EINVAL +The +.Fa highfd +argument is lower than the +.Fa lowfd +argument. +.It Bq Er EINVAL +An invalid flag was set. +.El .Sh SEE ALSO .Xr close 2 .Sh HISTORY Modified: head/sys/compat/freebsd32/syscalls.master
svn commit: r359835 - head/usr.sbin/bsdconfig
Author: crees (doc,ports committer) Date: Sun Apr 12 20:54:35 2020 New Revision: 359835 URL: https://svnweb.freebsd.org/changeset/base/359835 Log: Add mention of wireless option in bsdconfig Submitted by: debdrup Approved by: dteske (maintainer) Differential Revision:https://reviews.freebsd.org/D24378 Modified: head/usr.sbin/bsdconfig/bsdconfig.8 Modified: head/usr.sbin/bsdconfig/bsdconfig.8 == --- head/usr.sbin/bsdconfig/bsdconfig.8 Sun Apr 12 19:25:28 2020 (r359834) +++ head/usr.sbin/bsdconfig/bsdconfig.8 Sun Apr 12 20:54:35 2020 (r359835) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 5, 2013 +.Dd April 12, 2020 .Dt BSDCONFIG 8 .Os .Sh NAME @@ -148,8 +148,8 @@ Shortcut to the DNS Nameservers menu under networking. .It Cm netdev Shortcut to the Network Interfaces menu under networking. .It Cm networking -Utilities to set/change Hostname/Domain, Network Interfaces, Default -Router/Gateway, and DNS Nameservers. +Utilities to set/change Hostname/Domain, Network Interfaces, Wireless +Network, Default Router/Gateway, and DNS Nameservers. .It Cm packages Browse, install, uninstall, or re-install packaged software. .It Cm password @@ -209,6 +209,8 @@ Shortcut to the Delete Users menu under usermgmt. Shortcut to the Edit/View Users menu under usermgmt. .It Cm usermgmt Utilities to Add/Edit/View/Delete User Accounts. +.It Cm wireless +Shortcut to the Wireless Networks menu under networking. .El .Sh INTERNATIONALIZATION i18n features are built into ___ 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: r359374 - in head: . share/man/man4 share/man/man7 share/man/man9 sys/crypto/aesni sys/crypto/armv8 sys/crypto/blake2 sys/crypto/ccp sys/crypto/via sys/dev/cesa sys/dev/cxgbe sys/dev/c
On 3/27/20 11:25 AM, John Baldwin wrote: [...]> - Drivers no longer register a list of supported algorithms. This > doesn't quite work when you factor in modes (e.g. a driver might > support both AES-CBC and SHA2-256-HMAC separately but not combined > for ETA). Instead, a new 'crypto_probesession' method has been > added to the kobj interface for symmteric crypto drivers. This > method returns a negative value on success (similar to how > device_probe works) and the crypto framework uses this value to pick > the "best" driver. There are three constants for hardware > (e.g. ccr), accelerated software (e.g. aesni), and plain software > (cryptosoft) that give preference in that order. One effect of this > is that if you request only hardware when creating a new session, > you will no longer get a session using accelerated software. > Another effect is that the default setting to disallow software > crypto via /dev/crypto now disables accelerated software. For user-visible interface, it seems like we are essentially treating "accelerated software" like AES-NI the same way of plain software. For example, geom_eli would now say: GEOM_ELI: Encryption: AES-XTS 128 GEOM_ELI: Crypto: software Instead of: GEOM_ELI: Encryption: AES-XTS 128 GEOM_ELI: Crypto: hardware When AES-NI is used (which is because we only have two bits to represent hardware and software, and have gave neither bits clear with its own meaning (use specific driver)). If we are not going to add a new bit to represent accelerated software, why are they categorized as software providers? Technically, all these still requires hardware that implements the cryptographic primitives to work, and it's much easier for system administrators if we expose the fact that they are using some kind of acceleration than asking them to run DTrace etc. to find out. Personally, I think it's probably better to change the notion to either "accelerated" (by either hardware or software) and "software"... Cheers, ___ 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: r359834 - stable/12/usr.sbin/bhyve
Author: chuck Date: Sun Apr 12 19:25:28 2020 New Revision: 359834 URL: https://svnweb.freebsd.org/changeset/base/359834 Log: MFC r359367 bhyve: fix NVMe emulation update of SQHD Modified: stable/12/usr.sbin/bhyve/pci_nvme.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/bhyve/pci_nvme.c == --- stable/12/usr.sbin/bhyve/pci_nvme.c Sun Apr 12 19:21:44 2020 (r359833) +++ stable/12/usr.sbin/bhyve/pci_nvme.c Sun Apr 12 19:25:28 2020 (r359834) @@ -1152,7 +1152,8 @@ pci_nvme_handle_admin_cmd(struct pci_nvme_softc* sc, u cmd->opc)); pci_nvme_status_genc(, NVME_SC_INVALID_OPCODE); } - + sqhead = (sqhead + 1) % sq->size; + if (NVME_COMPLETION_VALID(compl)) { struct nvme_completion *cp; int phase; @@ -1169,7 +1170,6 @@ pci_nvme_handle_admin_cmd(struct pci_nvme_softc* sc, u cq->tail = (cq->tail + 1) % cq->size; } - sqhead = (sqhead + 1) % sq->size; } DPRINTF(("setting sqhead %u", sqhead)); @@ -1284,8 +1284,9 @@ pci_nvme_set_completion(struct pci_nvme_softc *sc, compl = >qbase[cq->tail]; - compl->sqhd = atomic_load_acq_short(>head); + compl->cdw0 = cdw0; compl->sqid = sqid; + compl->sqhd = atomic_load_acq_short(>head); compl->cid = cid; // toggle phase ___ 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: r359833 - stable/12/usr.sbin/bhyve
Author: chuck Date: Sun Apr 12 19:21:44 2020 New Revision: 359833 URL: https://svnweb.freebsd.org/changeset/base/359833 Log: MFC r359366 bhyve: fix NVMe emulation missed interrupts Modified: stable/12/usr.sbin/bhyve/pci_nvme.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/bhyve/pci_nvme.c == --- stable/12/usr.sbin/bhyve/pci_nvme.c Sun Apr 12 19:18:26 2020 (r359832) +++ stable/12/usr.sbin/bhyve/pci_nvme.c Sun Apr 12 19:21:44 2020 (r359833) @@ -1082,12 +1082,12 @@ pci_nvme_handle_admin_cmd(struct pci_nvme_softc* sc, u struct nvme_command *cmd; struct nvme_submission_queue *sq; struct nvme_completion_queue *cq; - int do_intr = 0; uint16_t sqhead; DPRINTF(("%s index %u", __func__, (uint32_t)value)); sq = >submit_queues[0]; + cq = >compl_queues[0]; sqhead = atomic_load_acq_short(>head); @@ -1106,44 +1106,44 @@ pci_nvme_handle_admin_cmd(struct pci_nvme_softc* sc, u switch (cmd->opc) { case NVME_OPC_DELETE_IO_SQ: DPRINTF(("%s command DELETE_IO_SQ", __func__)); - do_intr |= nvme_opc_delete_io_sq(sc, cmd, ); + nvme_opc_delete_io_sq(sc, cmd, ); break; case NVME_OPC_CREATE_IO_SQ: DPRINTF(("%s command CREATE_IO_SQ", __func__)); - do_intr |= nvme_opc_create_io_sq(sc, cmd, ); + nvme_opc_create_io_sq(sc, cmd, ); break; case NVME_OPC_DELETE_IO_CQ: DPRINTF(("%s command DELETE_IO_CQ", __func__)); - do_intr |= nvme_opc_delete_io_cq(sc, cmd, ); + nvme_opc_delete_io_cq(sc, cmd, ); break; case NVME_OPC_CREATE_IO_CQ: DPRINTF(("%s command CREATE_IO_CQ", __func__)); - do_intr |= nvme_opc_create_io_cq(sc, cmd, ); + nvme_opc_create_io_cq(sc, cmd, ); break; case NVME_OPC_GET_LOG_PAGE: DPRINTF(("%s command GET_LOG_PAGE", __func__)); - do_intr |= nvme_opc_get_log_page(sc, cmd, ); + nvme_opc_get_log_page(sc, cmd, ); break; case NVME_OPC_IDENTIFY: DPRINTF(("%s command IDENTIFY", __func__)); - do_intr |= nvme_opc_identify(sc, cmd, ); + nvme_opc_identify(sc, cmd, ); break; case NVME_OPC_ABORT: DPRINTF(("%s command ABORT", __func__)); - do_intr |= nvme_opc_abort(sc, cmd, ); + nvme_opc_abort(sc, cmd, ); break; case NVME_OPC_SET_FEATURES: DPRINTF(("%s command SET_FEATURES", __func__)); - do_intr |= nvme_opc_set_features(sc, cmd, ); + nvme_opc_set_features(sc, cmd, ); break; case NVME_OPC_GET_FEATURES: DPRINTF(("%s command GET_FEATURES", __func__)); - do_intr |= nvme_opc_get_features(sc, cmd, ); + nvme_opc_get_features(sc, cmd, ); break; case NVME_OPC_ASYNC_EVENT_REQUEST: DPRINTF(("%s command ASYNC_EVENT_REQ", __func__)); /* XXX dont care, unhandled for now - do_intr |= nvme_opc_async_event_req(sc, cmd, ); + nvme_opc_async_event_req(sc, cmd, ); */ compl.status = NVME_NO_STATUS; break; @@ -1151,15 +1151,12 @@ pci_nvme_handle_admin_cmd(struct pci_nvme_softc* sc, u WPRINTF(("0x%x command is not implemented", cmd->opc)); pci_nvme_status_genc(, NVME_SC_INVALID_OPCODE); - do_intr |= 1; } if (NVME_COMPLETION_VALID(compl)) { struct nvme_completion *cp; int phase; - cq = >compl_queues[0]; - cp = &(cq->qbase)[cq->tail]; cp->cdw0 = compl.cdw0; cp->sqid = 0; @@ -1179,7 +1176,7 @@ pci_nvme_handle_admin_cmd(struct pci_nvme_softc* sc, u atomic_store_short(>head, sqhead); atomic_store_int(>busy, 0); - if (do_intr) + if (cq->head != cq->tail) pci_generate_msix(sc->nsc_pi, 0); } @@ -1275,7 +1272,6 @@ pci_nvme_set_completion(struct pci_nvme_softc *sc, { struct
svn commit: r359832 - stable/12/usr.sbin/bhyve
Author: chuck Date: Sun Apr 12 19:18:26 2020 New Revision: 359832 URL: https://svnweb.freebsd.org/changeset/base/359832 Log: MFC r359365 bhyve: use STAILQ in NVMe emulation Modified: stable/12/usr.sbin/bhyve/pci_nvme.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/bhyve/pci_nvme.c == --- stable/12/usr.sbin/bhyve/pci_nvme.c Sun Apr 12 19:14:27 2020 (r359831) +++ stable/12/usr.sbin/bhyve/pci_nvme.c Sun Apr 12 19:18:26 2020 (r359832) @@ -185,7 +185,7 @@ struct pci_nvme_blockstore { struct pci_nvme_ioreq { struct pci_nvme_softc *sc; - struct pci_nvme_ioreq *next; + STAILQ_ENTRY(pci_nvme_ioreq) link; struct nvme_submission_queue *nvme_sq; uint16_tsqid; @@ -240,7 +240,7 @@ struct pci_nvme_softc { uint32_tnum_squeues; struct pci_nvme_ioreq *ioreqs; - struct pci_nvme_ioreq *ioreqs_free; /* free list of ioreqs */ + STAILQ_HEAD(, pci_nvme_ioreq) ioreqs_free; /* free list of ioreqs */ uint32_tpending_ios; uint32_tioslots; sem_t iosemlock; @@ -1318,8 +1318,7 @@ pci_nvme_release_ioreq(struct pci_nvme_softc *sc, stru pthread_mutex_lock(>mtx); - req->next = sc->ioreqs_free; - sc->ioreqs_free = req; + STAILQ_INSERT_TAIL(>ioreqs_free, req, link); sc->pending_ios--; /* when no more IO pending, can set to ready if device reset/enabled */ @@ -1340,12 +1339,10 @@ pci_nvme_get_ioreq(struct pci_nvme_softc *sc) sem_wait(>iosemlock); pthread_mutex_lock(>mtx); - req = sc->ioreqs_free; + req = STAILQ_FIRST(>ioreqs_free); assert(req != NULL); + STAILQ_REMOVE_HEAD(>ioreqs_free, link); - sc->ioreqs_free = req->next; - - req->next = NULL; req->sc = sc; sc->pending_ios++; @@ -2150,14 +2147,13 @@ pci_nvme_init(struct vmctx *ctx, struct pci_devinst *p else error = 0; + STAILQ_INIT(>ioreqs_free); sc->ioreqs = calloc(sc->ioslots, sizeof(struct pci_nvme_ioreq)); for (int i = 0; i < sc->ioslots; i++) { - if (i < (sc->ioslots-1)) - sc->ioreqs[i].next = >ioreqs[i+1]; + STAILQ_INSERT_TAIL(>ioreqs_free, >ioreqs[i], link); pthread_mutex_init(>ioreqs[i].mtx, NULL); pthread_cond_init(>ioreqs[i].cv, NULL); } - sc->ioreqs_free = sc->ioreqs; sc->intr_coales_aggr_thresh = 1; pci_set_cfgdata16(pi, PCIR_DEVICE, 0x0A0A); ___ 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: r359831 - stable/12/usr.sbin/bhyve
Author: chuck Date: Sun Apr 12 19:14:27 2020 New Revision: 359831 URL: https://svnweb.freebsd.org/changeset/base/359831 Log: MFC r359364 bhyve: implement NVMe deallocate command Modified: stable/12/usr.sbin/bhyve/pci_nvme.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/bhyve/pci_nvme.c == --- stable/12/usr.sbin/bhyve/pci_nvme.c Sun Apr 12 19:02:34 2020 (r359830) +++ stable/12/usr.sbin/bhyve/pci_nvme.c Sun Apr 12 19:14:27 2020 (r359831) @@ -180,6 +180,7 @@ struct pci_nvme_blockstore { uint32_tsectsz; uint32_tsectsz_bits; uint64_teui64; + uint32_tdeallocate:1; }; struct pci_nvme_ioreq { @@ -209,6 +210,15 @@ struct pci_nvme_ioreq { struct ioveciovpadding[NVME_MAX_BLOCKIOVS-BLOCKIF_IOV_MAX]; }; +enum nvme_dsm_type { + /* Dataset Management bit in ONCS reflects backing storage capability */ + NVME_DATASET_MANAGEMENT_AUTO, + /* Unconditionally set Dataset Management bit in ONCS */ + NVME_DATASET_MANAGEMENT_ENABLE, + /* Unconditionally clear Dataset Management bit in ONCS */ + NVME_DATASET_MANAGEMENT_DISABLE, +}; + struct pci_nvme_softc { struct pci_devinst *nsc_pi; @@ -246,6 +256,8 @@ struct pci_nvme_softc { uint32_tintr_coales_aggr_time; /* 0x08: uS to delay intr */ uint32_tintr_coales_aggr_thresh; /* 0x08: compl-Q entries */ uint32_tasync_ev_config; /* 0x0B: async event config */ + + enum nvme_dsm_type dataset_management; }; @@ -285,6 +297,9 @@ static void pci_nvme_io_partial(struct blockif_req *br ((NVME_STATUS_SCT_MASK << NVME_STATUS_SCT_SHIFT) |\ (NVME_STATUS_SC_MASK << NVME_STATUS_SC_SHIFT)) +#define NVME_ONCS_DSM (NVME_CTRLR_DATA_ONCS_DSM_MASK << \ + NVME_CTRLR_DATA_ONCS_DSM_SHIFT) + static __inline void cpywithpad(char *dst, size_t dst_size, const char *src, char pad) { @@ -363,6 +378,19 @@ pci_nvme_init_ctrldata(struct pci_nvme_softc *sc) (4 << NVME_CTRLR_DATA_CQES_MIN_SHIFT); cd->nn = 1; /* number of namespaces */ + cd->oncs = 0; + switch (sc->dataset_management) { + case NVME_DATASET_MANAGEMENT_AUTO: + if (sc->nvstore.deallocate) + cd->oncs |= NVME_ONCS_DSM; + break; + case NVME_DATASET_MANAGEMENT_ENABLE: + cd->oncs |= NVME_ONCS_DSM; + break; + default: + break; + } + cd->fna = 0x03; cd->power_state[0].mp = 10; @@ -429,6 +457,9 @@ pci_nvme_init_nsdata(struct pci_nvme_softc *sc, nd->ncap = nd->nsze; nd->nuse = nd->nsze; + if (nvstore->type == NVME_STOR_BLOCKIF) + nvstore->deallocate = blockif_candelete(nvstore->ctx); + nd->nlbaf = 0; /* NLBAF is a 0's based value (i.e. 1 LBA Format) */ nd->flbas = 0; @@ -1339,7 +1370,7 @@ pci_nvme_io_done(struct blockif_req *br, int err) uint16_t code, status; DPRINTF(("%s error %d %s", __func__, err, strerror(err))); - + /* TODO return correct error */ code = err ? NVME_SC_DATA_TRANSFER_ERROR : NVME_SC_SUCCESS; pci_nvme_status_genc(, code); @@ -1358,7 +1389,128 @@ pci_nvme_io_partial(struct blockif_req *br, int err) pthread_cond_signal(>cv); } +static void +pci_nvme_dealloc_sm(struct blockif_req *br, int err) +{ + struct pci_nvme_ioreq *req = br->br_param; + struct pci_nvme_softc *sc = req->sc; + bool done = true; + uint16_t status; + if (err) { + pci_nvme_status_genc(, NVME_SC_INTERNAL_DEVICE_ERROR); + } else if ((req->prev_gpaddr + 1) == (req->prev_size)) { + pci_nvme_status_genc(, NVME_SC_SUCCESS); + } else { + struct iovec *iov = req->io_req.br_iov; + + req->prev_gpaddr++; + iov += req->prev_gpaddr; + + /* The iov_* values already include the sector size */ + req->io_req.br_offset = (off_t)iov->iov_base; + req->io_req.br_resid = iov->iov_len; + if (blockif_delete(sc->nvstore.ctx, >io_req)) { + pci_nvme_status_genc(, + NVME_SC_INTERNAL_DEVICE_ERROR); + } else + done = false; + } + + if (done) { + pci_nvme_set_completion(sc, req->nvme_sq, req->sqid, + req->cid, 0, status, 0); + pci_nvme_release_ioreq(sc, req); + } +} + +static int +nvme_opc_dataset_mgmt(struct pci_nvme_softc *sc, +struct nvme_command *cmd, +struct pci_nvme_blockstore *nvstore, +struct pci_nvme_ioreq *req, +uint16_t *status) +{ + int err = -1; + + if ((sc->ctrldata.oncs & NVME_ONCS_DSM) == 0) { +
svn commit: r359830 - stable/12/usr.sbin/bhyve
Author: chuck Date: Sun Apr 12 19:02:34 2020 New Revision: 359830 URL: https://svnweb.freebsd.org/changeset/base/359830 Log: MFC r359363 bhyve: refactor NVMe namespace initialization Modified: stable/12/usr.sbin/bhyve/pci_nvme.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/bhyve/pci_nvme.c == --- stable/12/usr.sbin/bhyve/pci_nvme.c Sun Apr 12 18:04:20 2020 (r359829) +++ stable/12/usr.sbin/bhyve/pci_nvme.c Sun Apr 12 19:02:34 2020 (r359830) @@ -421,20 +421,21 @@ crc16(uint16_t crc, const void *buffer, unsigned int l static void pci_nvme_init_nsdata(struct pci_nvme_softc *sc, struct nvme_namespace_data *nd, uint32_t nsid, -uint64_t eui64) +struct pci_nvme_blockstore *nvstore) { - nd->nsze = sc->nvstore.size / sc->nvstore.sectsz; + /* Get capacity and block size information from backing store */ + nd->nsze = nvstore->size / nvstore->sectsz; nd->ncap = nd->nsze; nd->nuse = nd->nsze; - /* Get LBA and backstore information from backing store */ nd->nlbaf = 0; /* NLBAF is a 0's based value (i.e. 1 LBA Format) */ nd->flbas = 0; /* Create an EUI-64 if user did not provide one */ - if (eui64 == 0) { + if (nvstore->eui64 == 0) { char *data = NULL; + uint64_t eui64 = nvstore->eui64; asprintf(, "%s%u%u%u", vmname, sc->nsc_pi->pi_bus, sc->nsc_pi->pi_slot, sc->nsc_pi->pi_func); @@ -443,12 +444,12 @@ pci_nvme_init_nsdata(struct pci_nvme_softc *sc, eui64 = OUI_FREEBSD_NVME_LOW | crc16(0, data, strlen(data)); free(data); } - eui64 = (eui64 << 16) | (nsid & 0x); + nvstore->eui64 = (eui64 << 16) | (nsid & 0x); } - be64enc(nd->eui64, eui64); + be64enc(nd->eui64, nvstore->eui64); /* LBA data-sz = 2^lbads */ - nd->lbaf[0] = sc->nvstore.sectsz_bits << NVME_NS_DATA_LBAF_LBADS_SHIFT; + nd->lbaf[0] = nvstore->sectsz_bits << NVME_NS_DATA_LBAF_LBADS_SHIFT; } static void @@ -2031,7 +2032,7 @@ pci_nvme_init(struct vmctx *ctx, struct pci_devinst *p pci_nvme_reset(sc); pci_nvme_init_ctrldata(sc); - pci_nvme_init_nsdata(sc, >nsdata, 1, sc->nvstore.eui64); + pci_nvme_init_nsdata(sc, >nsdata, 1, >nvstore); pci_nvme_init_logpages(sc); pci_lintr_request(pi); ___ 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: r359829 - in head/sys: amd64/conf conf
Author: cem Date: Sun Apr 12 18:04:20 2020 New Revision: 359829 URL: https://svnweb.freebsd.org/changeset/base/359829 Log: Add queue(2) debug macros as build options Add QUEUE_MACRO_DEBUG_TRACE and QUEUE_MACRO_DEBUG_TRASH as proper kernel options. While here, alpha-sort the debug section of sys/conf/options. Enable QUEUE_MACRO_DEBUG_TRASH in amd64 GENERIC (but not GENERIC-NODEBUG) kernels. It is similar in nature and cost to other use-after-free pointer trashing we do in GENERIC. It is probably reasonable to enable in any arch GENERIC kernel that defines INVARIANTS. Modified: head/sys/amd64/conf/GENERIC head/sys/amd64/conf/GENERIC-NODEBUG head/sys/conf/NOTES head/sys/conf/options Modified: head/sys/amd64/conf/GENERIC == --- head/sys/amd64/conf/GENERIC Sun Apr 12 16:13:05 2020(r359828) +++ head/sys/amd64/conf/GENERIC Sun Apr 12 18:04:20 2020(r359829) @@ -96,6 +96,7 @@ options GDB # Support remote GDB. optionsDEADLKRES # Enable the deadlock resolver optionsINVARIANTS # Enable calls of extra sanity checking optionsINVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS +optionsQUEUE_MACRO_DEBUG_TRASH # Trash queue(2) internal pointers on invalidation optionsWITNESS # Enable checks to detect deadlocks and cycles optionsWITNESS_SKIPSPIN# Don't run witness on spinlocks for speed optionsMALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones Modified: head/sys/amd64/conf/GENERIC-NODEBUG == --- head/sys/amd64/conf/GENERIC-NODEBUG Sun Apr 12 16:13:05 2020 (r359828) +++ head/sys/amd64/conf/GENERIC-NODEBUG Sun Apr 12 18:04:20 2020 (r359829) @@ -40,3 +40,4 @@ nooptions FULL_BUF_TRACKING nooptions COVERAGE nooptions KCOV nooptions MALLOC_DEBUG_MAXZONES +nooptions QUEUE_MACRO_DEBUG_TRASH Modified: head/sys/conf/NOTES == --- head/sys/conf/NOTES Sun Apr 12 16:13:05 2020(r359828) +++ head/sys/conf/NOTES Sun Apr 12 18:04:20 2020(r359829) @@ -414,6 +414,18 @@ optionsDDB_NUMSYM optionsGDB # +# Trashes list pointers when they become invalid (i.e., the element is +# removed from a list). Relatively inexpensive to enable. +# +optionsQUEUE_MACRO_DEBUG_TRASH + +# +# Stores information about the last caller to modify the list object +# in the list object. Requires additional memory overhead. +# +optionsQUEUE_MACRO_DEBUG_TRACE + +# # SYSCTL_DEBUG enables a 'sysctl' debug tree that can be used to dump the # contents of the registered sysctl nodes on the console. It is disabled by # default because it generates excessively verbose console output that can Modified: head/sys/conf/options == --- head/sys/conf/options Sun Apr 12 16:13:05 2020(r359828) +++ head/sys/conf/options Sun Apr 12 18:04:20 2020(r359829) @@ -55,17 +55,19 @@ DDB_CAPTURE_DEFAULTBUFSIZE opt_ddb.h DDB_CAPTURE_MAXBUFSIZE opt_ddb.h DDB_CTFopt_ddb.h DDB_NUMSYM opt_ddb.h +EARLY_PRINTF opt_global.h FULL_BUF_TRACKING opt_global.h GDB KDBopt_global.h KDB_TRACE opt_kdb.h KDB_UNATTENDED opt_kdb.h KLD_DEBUG opt_kld.h +NUM_CORE_FILES opt_global.h +QUEUE_MACRO_DEBUG_TRACEopt_global.h +QUEUE_MACRO_DEBUG_TRASHopt_global.h SYSCTL_DEBUG opt_sysctl.h -EARLY_PRINTF opt_global.h TEXTDUMP_PREFERRED opt_ddb.h TEXTDUMP_VERBOSE opt_ddb.h -NUM_CORE_FILES opt_global.h TSLOG opt_global.h TSLOGSIZE opt_global.h ___ 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: r359809 - head/sys/netinet
Hi Michael, On Sun, Apr 12, 2020 at 2:33 AM Michael Tuexen wrote: > Yes. What I meant is that in the stream scheduler code (sctp_ss_functions.c) > the pattern is > > TAILQ_REMOVE(>ss_data.out.list, sp, ss_next); > sp->ss_next.tqe_next = NULL; > sp->ss_next.tqe_prev = NULL; > > which I think is OK, since I'm clearing the pointers related to the remove > operation. Do you agree? It is harmless in the sense that it is not a functional change, but I wouldn't suggest doing so. First, in the location modified, TAILQ_INSERT immediately subsequent will just overwrite the NULLs. The compiler almost certainly just optimizes this out. (If you used TAILQ_CONCAT instead, you can avoid rewriting the pointer chain in the linked list entirely and only update heads/tails.) (By the way, I was mistaken about the queue.h TRASH feature being included in INVARIANTS kernels — it is instead governed by QUEUE_MACRO_DEBUG_TRASH. IMO, we should go ahead and enabled QUEUE_MACRO_DEBUG_TRASH in GENERIC/INVARIANTS — unlike "TRACE," TRASH is inexpensive — and it catches use-after-frees.) Second, generally one should not manipulate the implementation details of sys/queue.h directly. In QUEUE_MACRO_DEBUG_TRASH kernels, the REMOVE operation already stores bogus values in these pointers ("TRASHIT()"). > I totally agree. I'm actually adding more INVARIANTS checks to the SCTP > code to catch more places where the code does not behave as expected when > running syzkaller (more on the API testing) and ossfuzz (for the userland > stack, more on the packet injection side). So you will see more panics > when using INVARIANTS, for example, now in the timer code. But this points > me to places I need to look at. That's good to hear. I agree it is good to assert/panic more in INVARIANTS, when invariants are violated — it's why we have it :-). > > In this use, consider using > > 'TAILQ_CONCAT(>asoc.strmout[i].outqueue, [i].outqueue, > > next)' instead of the loop construct. > > Thanks for the hint. Wasn't aware of it and didn't consider it more moving > over a queue. No problem. It is often useful to manipulate entire lists cheaply rather than individual elements. Another common pattern is: under a lock, TAILQ_SWAP the lock-protected list to an initialized (empty) stack list-head, drop the lock, and clean up the list outside the lock. Best, Conrad ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r359828 - head/tests/sys/netinet
Author: kp Date: Sun Apr 12 16:13:05 2020 New Revision: 359828 URL: https://svnweb.freebsd.org/changeset/base/359828 Log: carp tests: Basic functionality test Set up three vnet jails, bridged together. Run carp between two of them. Attempt to provoke locking / epoch issues. Reviewed by: mav (previous version), melifaro, asomers Differential Revision:https://reviews.freebsd.org/D24303 Added: head/tests/sys/netinet/carp.sh (contents, props changed) Modified: head/tests/sys/netinet/Makefile Modified: head/tests/sys/netinet/Makefile == --- head/tests/sys/netinet/Makefile Sun Apr 12 16:09:21 2020 (r359827) +++ head/tests/sys/netinet/Makefile Sun Apr 12 16:13:05 2020 (r359828) @@ -9,7 +9,7 @@ ATF_TESTS_C=ip_reass_test \ so_reuseport_lb_test \ socket_afinet -ATF_TESTS_SH= fibs_test redirect divert forward output +ATF_TESTS_SH= carp fibs_test redirect divert forward output PROGS= udp_dontroute tcp_user_cookie Added: head/tests/sys/netinet/carp.sh == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netinet/carp.sh Sun Apr 12 16:13:05 2020 (r359828) @@ -0,0 +1,152 @@ +# $FreeBSD$ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2020 Kristof Provost +# +# 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. + +. $(atf_get_srcdir)/../common/vnet.subr + +is_master() +{ + jail=$1 + itf=$2 + + jexec ${jail} ifconfig ${itf} | grep carp | grep MASTER +} + +wait_for_carp() +{ + jail1=$1 + itf1=$2 + jail2=$3 + itf2=$4 + + while [ -z "$(is_master ${jail1} ${itf1})" ] && + [ -z "$(is_master ${jail2} ${itf2})" ]; do + sleep 1 + done +} + +atf_test_case "basic_v4" "cleanup" +basic_v4_head() +{ + atf_set descr 'Basic CARP test (IPv4)' + atf_set require.user root +} + +basic_v4_body() +{ + if ! kldstat -q -m carp; then + atf_skip "This test requires carp" + fi + + vnet_init + bridge=$(vnet_mkbridge) + epair_one=$(vnet_mkepair) + epair_two=$(vnet_mkepair) + + vnet_mkjail carp_basic_v4_one ${bridge} ${epair_one}a ${epair_two}a + vnet_mkjail carp_basic_v4_two ${epair_one}b + vnet_mkjail carp_basic_v4_three ${epair_two}b + + jexec carp_basic_v4_one ifconfig ${bridge} 192.0.2.4/29 up + jexec carp_basic_v4_one ifconfig ${bridge} addm ${epair_one}a \ + addm ${epair_two}a + jexec carp_basic_v4_one ifconfig ${epair_one}a up + jexec carp_basic_v4_one ifconfig ${epair_two}a up + + jexec carp_basic_v4_two ifconfig ${epair_one}b 192.0.2.202/29 up + jexec carp_basic_v4_two ifconfig ${epair_one}b add vhid 1 192.0.2.1/29 + + jexec carp_basic_v4_three ifconfig ${epair_two}b 192.0.2.203/29 up + jexec carp_basic_v4_three ifconfig ${epair_two}b add vhid 1 \ + 192.0.2.1/29 + + wait_for_carp carp_basic_v4_two ${epair_one}b \ + carp_basic_v4_three ${epair_two}b + + atf_check -s exit:0 -o ignore jexec carp_basic_v4_one \ + ping -c 3 192.0.2.1 +} + +basic_v4_cleanup() +{ + vnet_cleanup +} + +atf_test_case "basic_v6" "cleanup" +basic_v6_head() +{ + atf_set descr 'Basic CARP test (IPv6)' + atf_set require.user root +} + +basic_v6_body() +{ + if ! kldstat -q -m carp; then + atf_skip "This test requires carp" + fi + + vnet_init + bridge=$(vnet_mkbridge) + epair_one=$(vnet_mkepair) + epair_two=$(vnet_mkepair)
svn commit: r359827 - head/sys/netinet
Author: kp Date: Sun Apr 12 16:09:21 2020 New Revision: 359827 URL: https://svnweb.freebsd.org/changeset/base/359827 Log: carp: Widen epoch coverage Fix panics related to calling code which expects to be running inside the NET_EPOCH from outside that epoch. This leads to panics (with INVARIANTS) such as this one: panic: Assertion in_epoch(net_epoch_preempt) failed at /usr/src/sys/netinet/if_ether.c:373 cpuid = 7 time = 1586095719 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfe0090819700 vpanic() at vpanic+0x182/frame 0xfe0090819750 panic() at panic+0x43/frame 0xfe00908197b0 arprequest_internal() at arprequest_internal+0x59e/frame 0xfe00908198c0 arp_announce_ifaddr() at arp_announce_ifaddr+0x20/frame 0xfe00908198e0 carp_master_down_locked() at carp_master_down_locked+0x10d/frame 0xfe0090819910 carp_master_down() at carp_master_down+0x79/frame 0xfe0090819940 softclock_call_cc() at softclock_call_cc+0x13f/frame 0xfe00908199f0 softclock() at softclock+0x7c/frame 0xfe0090819a20 ithread_loop() at ithread_loop+0x279/frame 0xfe0090819ab0 fork_exit() at fork_exit+0x80/frame 0xfe0090819af0 fork_trampoline() at fork_trampoline+0xe/frame 0xfe0090819af0 --- trap 0, rip = 0, rsp = 0, rbp = 0 --- Widen the NET_EPOCH to cover the relevant (callback / task) code. Differential Revision:https://reviews.freebsd.org/D24302 Modified: head/sys/netinet/ip_carp.c Modified: head/sys/netinet/ip_carp.c == --- head/sys/netinet/ip_carp.c Sun Apr 12 16:06:59 2020(r359826) +++ head/sys/netinet/ip_carp.c Sun Apr 12 16:09:21 2020(r359827) @@ -817,7 +817,9 @@ static void carp_send_ad_all(void *ctx __unused, int pending __unused) { struct carp_softc *sc; + struct epoch_tracker et; + NET_EPOCH_ENTER(et); mtx_lock(_mtx); LIST_FOREACH(sc, _list, sc_next) if (sc->sc_state == MASTER) { @@ -828,6 +830,7 @@ carp_send_ad_all(void *ctx __unused, int pending __unu CARP_UNLOCK(sc); } mtx_unlock(_mtx); + NET_EPOCH_EXIT(et); } /* Send a periodic advertisement, executed in callout context. */ @@ -835,12 +838,15 @@ static void carp_send_ad(void *v) { struct carp_softc *sc = v; + struct epoch_tracker et; + NET_EPOCH_ENTER(et); CARP_LOCK_ASSERT(sc); CURVNET_SET(sc->sc_carpdev->if_vnet); carp_send_ad_locked(sc); CURVNET_RESTORE(); CARP_UNLOCK(sc); + NET_EPOCH_EXIT(et); } static void @@ -907,12 +913,12 @@ carp_send_ad_locked(struct carp_softc *sc) { struct carp_header ch; struct timeval tv; - struct epoch_tracker et; struct ifaddr *ifa; struct carp_header *ch_ptr; struct mbuf *m; int len, advskew; + NET_EPOCH_ASSERT(); CARP_LOCK_ASSERT(sc); advskew = DEMOTE_ADVSKEW(sc); @@ -976,10 +982,8 @@ carp_send_ad_locked(struct carp_softc *sc) CARPSTATS_INC(carps_opackets); - NET_EPOCH_ENTER(et); carp_send_ad_error(sc, ip_output(m, NULL, NULL, IP_RAWOUTPUT, >sc_carpdev->if_carp->cif_imo, NULL)); - NET_EPOCH_EXIT(et); } #endif /* INET */ #ifdef INET6 @@ -1037,10 +1041,8 @@ carp_send_ad_locked(struct carp_softc *sc) CARPSTATS_INC(carps_opackets6); - NET_EPOCH_ENTER(et); carp_send_ad_error(sc, ip6_output(m, NULL, NULL, 0, >sc_carpdev->if_carp->cif_im6o, NULL, NULL)); - NET_EPOCH_EXIT(et); } #endif /* INET6 */ @@ -1130,6 +1132,8 @@ carp_send_arp(struct carp_softc *sc) struct ifaddr *ifa; struct in_addr addr; + NET_EPOCH_ASSERT(); + CARP_FOREACH_IFA(sc, ifa) { if (ifa->ifa_addr->sa_family != AF_INET) continue; @@ -1258,7 +1262,9 @@ static void carp_master_down(void *v) { struct carp_softc *sc = v; + struct epoch_tracker et; + NET_EPOCH_ENTER(et); CARP_LOCK_ASSERT(sc); CURVNET_SET(sc->sc_carpdev->if_vnet); @@ -1268,12 +1274,14 @@ carp_master_down(void *v) CURVNET_RESTORE(); CARP_UNLOCK(sc); + NET_EPOCH_EXIT(et); } static void carp_master_down_locked(struct carp_softc *sc, const char *reason) { + NET_EPOCH_ASSERT(); CARP_LOCK_ASSERT(sc); switch (sc->sc_state) { ___ 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: r359826 - head/contrib/llvm-project/clang/lib/CodeGen
Author: dim Date: Sun Apr 12 16:06:59 2020 New Revision: 359826 URL: https://svnweb.freebsd.org/changeset/base/359826 Log: Merge commit 30588a739 from llvm git (by Erich Keane): Make target features check work with ctor and dtor- The problem was reported in PR45468, applying target features to an always_inline constructor/destructor runs afoul of GlobalDecl construction assert when checking for target-feature compatibility. The core problem is fixed by using the version of the check that takes a FunctionDecl rather than the GlobalDecl. However, while writing the test, I discovered that source locations weren't properly set for this check on ctors/dtors. This patch also fixes constructors and CALLED destructors. Unfortunately, it doesn't seem too possible to get a meaningful source location for a 'cleanup' destructor, so those are still 'frontend' level errors unfortunately. A fixme was added to the test to cover that situation. This should fix 'Assertion failed: (!isa(D) && "Use other ctor with ctor decls!"), function Init, file /usr/src/contrib/llvm-project/clang/include/clang/AST/GlobalDecl.h, line 45' when compiling the security/botan2 port. PR: 245550 MFC after:6 weeks X-MFC-With: 358851 Modified: head/contrib/llvm-project/clang/lib/CodeGen/CGClass.cpp head/contrib/llvm-project/clang/lib/CodeGen/CGExprCXX.cpp head/contrib/llvm-project/clang/lib/CodeGen/CodeGenFunction.cpp Modified: head/contrib/llvm-project/clang/lib/CodeGen/CGClass.cpp == --- head/contrib/llvm-project/clang/lib/CodeGen/CGClass.cpp Sun Apr 12 15:30:00 2020(r359825) +++ head/contrib/llvm-project/clang/lib/CodeGen/CGClass.cpp Sun Apr 12 16:06:59 2020(r359826) @@ -2157,7 +2157,7 @@ void CodeGenFunction::EmitCXXConstructorCall(const CXX const CGFunctionInfo = CGM.getTypes().arrangeCXXConstructorCall( Args, D, Type, ExtraArgs.Prefix, ExtraArgs.Suffix, PassPrototypeArgs); CGCallee Callee = CGCallee::forDirect(CalleePtr, GlobalDecl(D, Type)); - EmitCall(Info, Callee, ReturnValueSlot(), Args); + EmitCall(Info, Callee, ReturnValueSlot(), Args, nullptr, Loc); // Generate vtable assumptions if we're constructing a complete object // with a vtable. We don't do this for base subobjects for two reasons: Modified: head/contrib/llvm-project/clang/lib/CodeGen/CGExprCXX.cpp == --- head/contrib/llvm-project/clang/lib/CodeGen/CGExprCXX.cpp Sun Apr 12 15:30:00 2020(r359825) +++ head/contrib/llvm-project/clang/lib/CodeGen/CGExprCXX.cpp Sun Apr 12 16:06:59 2020(r359826) @@ -112,7 +112,8 @@ RValue CodeGenFunction::EmitCXXDestructorCall( commonEmitCXXMemberOrOperatorCall(*this, DtorDecl, This, ImplicitParam, ImplicitParamTy, CE, Args, nullptr); return EmitCall(CGM.getTypes().arrangeCXXStructorDeclaration(Dtor), Callee, - ReturnValueSlot(), Args); + ReturnValueSlot(), Args, nullptr, + CE ? CE->getExprLoc() : SourceLocation{}); } RValue CodeGenFunction::EmitCXXPseudoDestructorExpr( @@ -380,7 +381,7 @@ RValue CodeGenFunction::EmitCXXMemberOrOperatorMemberC IsArrow ? Base->getType()->getPointeeType() : Base->getType(); EmitCXXDestructorCall(GD, Callee, This.getPointer(*this), ThisTy, /*ImplicitParam=*/nullptr, -/*ImplicitParamTy=*/QualType(), nullptr); +/*ImplicitParamTy=*/QualType(), CE); } return RValue::get(nullptr); } Modified: head/contrib/llvm-project/clang/lib/CodeGen/CodeGenFunction.cpp == --- head/contrib/llvm-project/clang/lib/CodeGen/CodeGenFunction.cpp Sun Apr 12 15:30:00 2020(r359825) +++ head/contrib/llvm-project/clang/lib/CodeGen/CodeGenFunction.cpp Sun Apr 12 16:06:59 2020(r359826) @@ -2324,8 +2324,7 @@ void CodeGenFunction::checkTargetFeatures(SourceLocati SmallVector ReqFeatures; llvm::StringMap CalleeFeatureMap; -CGM.getContext().getFunctionFeatureMap(CalleeFeatureMap, - GlobalDecl(TargetDecl)); +CGM.getContext().getFunctionFeatureMap(CalleeFeatureMap, TargetDecl); for (const auto : ParsedAttr.Features) { if (F[0] == '+' && CalleeFeatureMap.lookup(F.substr(1))) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r359825 - stable/12/usr.sbin/bhyve
Author: chuck Date: Sun Apr 12 15:30:00 2020 New Revision: 359825 URL: https://svnweb.freebsd.org/changeset/base/359825 Log: MFC r359362 bhyve: refactor NVMe PRP memcpy Modified: stable/12/usr.sbin/bhyve/pci_nvme.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/bhyve/pci_nvme.c == --- stable/12/usr.sbin/bhyve/pci_nvme.c Sun Apr 12 15:16:34 2020 (r359824) +++ stable/12/usr.sbin/bhyve/pci_nvme.c Sun Apr 12 15:30:00 2020 (r359825) @@ -140,6 +140,11 @@ enum nvme_cmd_cdw11 { NVME_CMD_CDW11_IV = 0x, }; +enum nvme_copy_dir { + NVME_COPY_TO_PRP, + NVME_COPY_FROM_PRP, +}; + #defineNVME_CQ_INTEN 0x01 #defineNVME_CQ_INTCOAL 0x02 @@ -545,10 +550,10 @@ pci_nvme_init_controller(struct vmctx *ctx, struct pci } static int -nvme_prp_memcpy(struct vmctx *ctx, uint64_t prp1, uint64_t prp2, uint8_t *src, - size_t len) +nvme_prp_memcpy(struct vmctx *ctx, uint64_t prp1, uint64_t prp2, uint8_t *b, + size_t len, enum nvme_copy_dir dir) { - uint8_t *dst; + uint8_t *p; size_t bytes; if (len > (8 * 1024)) { @@ -559,14 +564,17 @@ nvme_prp_memcpy(struct vmctx *ctx, uint64_t prp1, uint bytes = PAGE_SIZE - (prp1 & PAGE_MASK); bytes = MIN(bytes, len); - dst = vm_map_gpa(ctx, prp1, bytes); - if (dst == NULL) { + p = vm_map_gpa(ctx, prp1, bytes); + if (p == NULL) { return (-1); } - memcpy(dst, src, bytes); + if (dir == NVME_COPY_TO_PRP) + memcpy(p, b, bytes); + else + memcpy(b, p, bytes); - src += bytes; + b += bytes; len -= bytes; if (len == 0) { @@ -575,12 +583,15 @@ nvme_prp_memcpy(struct vmctx *ctx, uint64_t prp1, uint len = MIN(len, PAGE_SIZE); - dst = vm_map_gpa(ctx, prp2, len); - if (dst == NULL) { + p = vm_map_gpa(ctx, prp2, len); + if (p == NULL) { return (-1); } - memcpy(dst, src, len); + if (dir == NVME_COPY_TO_PRP) + memcpy(p, b, len); + else + memcpy(b, p, len); return (0); } @@ -726,16 +737,19 @@ nvme_opc_get_log_page(struct pci_nvme_softc* sc, struc switch (logpage) { case NVME_LOG_ERROR: nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, command->prp1, - command->prp2, (uint8_t *)>err_log, logsize); + command->prp2, (uint8_t *)>err_log, logsize, + NVME_COPY_TO_PRP); break; case NVME_LOG_HEALTH_INFORMATION: /* TODO: present some smart info */ nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, command->prp1, - command->prp2, (uint8_t *)>health_log, logsize); + command->prp2, (uint8_t *)>health_log, logsize, + NVME_COPY_TO_PRP); break; case NVME_LOG_FIRMWARE_SLOT: nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, command->prp1, - command->prp2, (uint8_t *)>fw_log, logsize); + command->prp2, (uint8_t *)>fw_log, logsize, + NVME_COPY_TO_PRP); break; default: WPRINTF(("%s get log page %x command not supported", @@ -760,12 +774,14 @@ nvme_opc_identify(struct pci_nvme_softc* sc, struct nv switch (command->cdw10 & 0xFF) { case 0x00: /* return Identify Namespace data structure */ nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, command->prp1, - command->prp2, (uint8_t *)>nsdata, sizeof(sc->nsdata)); + command->prp2, (uint8_t *)>nsdata, sizeof(sc->nsdata), + NVME_COPY_TO_PRP); break; case 0x01: /* return Identify Controller data structure */ nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, command->prp1, command->prp2, (uint8_t *)>ctrldata, - sizeof(sc->ctrldata)); + sizeof(sc->ctrldata), + NVME_COPY_TO_PRP); break; case 0x02: /* list of 1024 active NSIDs > CDW1.NSID */ dest = vm_map_gpa(sc->nsc_pi->pi_vmctx, command->prp1, ___ 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: r359824 - head/usr.bin/netstat
Author: melifaro Date: Sun Apr 12 15:16:34 2020 New Revision: 359824 URL: https://svnweb.freebsd.org/changeset/base/359824 Log: Fix string format error missed in r359823. Modified: head/usr.bin/netstat/nhops.c Modified: head/usr.bin/netstat/nhops.c == --- head/usr.bin/netstat/nhops.cSun Apr 12 14:30:00 2020 (r359823) +++ head/usr.bin/netstat/nhops.cSun Apr 12 15:16:34 2020 (r359824) @@ -219,7 +219,7 @@ nhop_map_update(struct nhop_map *map, uint32_t idx, ch sz = new_size * (sizeof(struct nhop_entry)); if ((map->ptr = realloc(map->ptr, sz)) == NULL) - errx(2, "realloc(%lu) failed", sz); + errx(2, "realloc(%zu) failed", sz); memset(>ptr[map->size], 0, (new_size - map->size) * sizeof(struct nhop_entry)); map->size = new_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: r359823 - in head: etc/mtree include lib/libc/gen sys/conf sys/net sys/net/route sys/netinet sys/netinet6 sys/sys usr.bin/netstat
Author: melifaro Date: Sun Apr 12 14:30:00 2020 New Revision: 359823 URL: https://svnweb.freebsd.org/changeset/base/359823 Log: Introduce nexthop objects and new routing KPI. This is the foundational change for the routing subsytem rearchitecture. More details and goals are available in https://reviews.freebsd.org/D24141 . This patch introduces concept of nexthop objects and new nexthop-based routing KPI. Nexthops are objects, containing all necessary information for performing the packet output decision. Output interface, mtu, flags, gw address goes there. For most of the cases, these objects will serve the same role as the struct rtentry is currently serving. Typically there will be low tens of such objects for the router even with multiple BGP full-views, as these objects will be shared between routing entries. This allows to store more information in the nexthop. New KPI: struct nhop_object *fib4_lookup(uint32_t fibnum, struct in_addr dst, uint32_t scopeid, uint32_t flags, uint32_t flowid); struct nhop_object *fib6_lookup(uint32_t fibnum, const struct in6_addr *dst6, uint32_t scopeid, uint32_t flags, uint32_t flowid); These 2 function are intended to replace all all flavours of rtalloc[1]<_ign><_fib>, mpath functions and the previous fib[46]-generation functions. Upon successful lookup, they return nexthop object which is guaranteed to exist within current NET_EPOCH. If longer lifetime is desired, one can specify NHR_REF as a flag and get a referenced version of the nexthop. Reference semantic closely resembles rtentry one, allowing sed-style conversion. Additionally, another 2 functions are introduced to support uRPF functionality inside variety of our firewalls. Their primary goal is to hide the multipath implementation details inside the routing subsystem, greatly simplifying firewalls implementation: int fib4_lookup_urpf(uint32_t fibnum, struct in_addr dst, uint32_t scopeid, uint32_t flags, const struct ifnet *src_if); int fib6_lookup_urpf(uint32_t fibnum, const struct in6_addr *dst6, uint32_t scopeid, uint32_t flags, const struct ifnet *src_if); All functions have a separate scopeid argument, paving way to eliminating IPv6 scope embedding and allowing to support IPv4 link-locals in the future. Structure changes: * rtentry gets new 'rt_nhop' pointer, slightly growing the overall size. * rib_head gets new 'rnh_preadd' callback pointer, slightly growing overall sz. Old KPI: During the transition state old and new KPI will coexists. As there are another 4-5 decent-sized conversion patches, it will probably take a couple of weeks. To support both KPIs, fields not required by the new KPI (most of rtentry) has to be kept, resulting in the temporary size increase. Once conversion is finished, rtentry will notably shrink. More details: * architectural overview: https://reviews.freebsd.org/D24141 * list of the next changes: https://reviews.freebsd.org/D24232 Reviewed by: ae,glebius(initial version) Differential Revision:https://reviews.freebsd.org/D24232 Added: head/sys/net/route/ head/sys/net/route/nhop.c (contents, props changed) head/sys/net/route/nhop.h (contents, props changed) head/sys/net/route/nhop_ctl.c (contents, props changed) head/sys/net/route/nhop_utils.c (contents, props changed) head/sys/net/route/nhop_utils.h (contents, props changed) head/sys/net/route/nhop_var.h (contents, props changed) head/sys/net/route/route_ctl.c (contents, props changed) head/sys/net/route/route_helpers.c (contents, props changed) head/sys/net/route/shared.h (contents, props changed) head/usr.bin/netstat/common.c (contents, props changed) head/usr.bin/netstat/common.h (contents, props changed) head/usr.bin/netstat/nhops.c (contents, props changed) Modified: head/etc/mtree/BSD.include.dist head/include/Makefile head/lib/libc/gen/sysctl.3 head/sys/conf/files head/sys/net/radix_mpath.c head/sys/net/radix_mpath.h head/sys/net/route.c head/sys/net/route.h head/sys/net/route_var.h head/sys/net/rtsock.c head/sys/netinet/in_fib.c head/sys/netinet/in_fib.h head/sys/netinet/in_rmx.c head/sys/netinet6/in6_fib.c head/sys/netinet6/in6_fib.h head/sys/netinet6/in6_rmx.c head/sys/sys/socket.h head/usr.bin/netstat/Makefile head/usr.bin/netstat/main.c head/usr.bin/netstat/netstat.h head/usr.bin/netstat/route.c Modified: head/etc/mtree/BSD.include.dist == --- head/etc/mtree/BSD.include.dist Sun Apr 12 09:31:36 2020 (r359822) +++ head/etc/mtree/BSD.include.dist Sun Apr 12 14:30:00 2020 (r359823) @@ -208,6 +208,8 @@ net altq .. +route +.. .. net80211 .. Modified: head/include/Makefile
Re: svn commit: r359809 - head/sys/netinet
> On 11. Apr 2020, at 23:35, Conrad Meyer wrote: > > Hi Michael, > > On Sat, Apr 11, 2020 at 1:37 PM Michael Tuexen wrote: >> >> Author: tuexen >> Date: Sat Apr 11 20:36:54 2020 >> New Revision: 359809 >> URL: https://svnweb.freebsd.org/changeset/base/359809 >> >> Log: >> Zero out pointers for consistency. >> >> This was found by running syzkaller on an INVARIANTS kernel. > Hi Conrad, > For consistency? If syzkaller found something due to INVARIANTS Yes. What I meant is that in the stream scheduler code (sctp_ss_functions.c) the pattern is TAILQ_REMOVE(>ss_data.out.list, sp, ss_next); sp->ss_next.tqe_next = NULL; sp->ss_next.tqe_prev = NULL; which I think is OK, since I'm clearing the pointers related to the remove operation. Do you agree? While looking at the code TAILQ_FOREACH_SAFE(sp, [i].outqueue, next, nsp) { TAILQ_REMOVE([i].outqueue, sp, next); TAILQ_INSERT_TAIL(>asoc.strmout[i].outqueue, sp, next); } I observed that I don't clear the pointers after the remove operation. The intended change was adding sp->next.tqe_next = NULL; sp->next.tqe_prev = NULL; which I guess would be fine. Do you agree? Due to a copy/paste error the change was (but not intended) adding sp->ss_next.tqe_next = NULL; sp->ss_next.tqe_prev = NULL; Unfortunately testing this incorrect and unintended fix, resolved the kernel panic. BTW, the intended fix doesn't fix the panic. Therefore I've reverted the fix: https://svnweb.freebsd.org/changeset/base/359822 Thanks a lot for making me aware of my mistake! > sys/queue.h debugging trashing the pointer values, masking them by > writing zeroes doesn't help. Generally, defeating the kernel's > INVARIANTS system is not wise or useful. I totally agree. I'm actually adding more INVARIANTS checks to the SCTP code to catch more places where the code does not behave as expected when running syzkaller (more on the API testing) and ossfuzz (for the userland stack, more on the packet injection side). So you will see more panics when using INVARIANTS, for example, now in the timer code. But this points me to places I need to look at. > > In this use, consider using > 'TAILQ_CONCAT(>asoc.strmout[i].outqueue, [i].outqueue, > next)' instead of the loop construct. Thanks for the hint. Wasn't aware of it and didn't consider it more moving over a queue. Best regards Michael > > Conrad ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r359822 - head/sys/netinet
Author: tuexen Date: Sun Apr 12 09:31:36 2020 New Revision: 359822 URL: https://svnweb.freebsd.org/changeset/base/359822 Log: Revert https://svnweb.freebsd.org/changeset/base/359809 The intended change was sp->next.tqe_next = NULL; sp->next.tqe_prev = NULL; which doesn't fix the issue I'm seeing and the committed fix is not the intended fix due to copy-and-paste. Thanks a lot to Conrad Meyer for making me aware of the problem. Reported by: cem Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c == --- head/sys/netinet/sctp_output.c Sun Apr 12 06:01:03 2020 (r359821) +++ head/sys/netinet/sctp_output.c Sun Apr 12 09:31:36 2020 (r359822) @@ -12275,8 +12275,6 @@ sctp_send_str_reset_req(struct sctp_tcb *stcb, /* now anything on those queues? */ TAILQ_FOREACH_SAFE(sp, [i].outqueue, next, nsp) { TAILQ_REMOVE([i].outqueue, sp, next); - sp->ss_next.tqe_next = NULL; - sp->ss_next.tqe_prev = NULL; TAILQ_INSERT_TAIL(>asoc.strmout[i].outqueue, sp, next); } ___ 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"