svn commit: r360428 - head/sbin/fsck_msdosfs

2020-04-27 Thread Xin LI
Author: delphij
Date: Tue Apr 28 05:10:34 2020
New Revision: 360428
URL: https://svnweb.freebsd.org/changeset/base/360428

Log:
  Do not overflow when calculating file system size.
  
  Reported by:  Hyeongseok Kim 
  Reviewed by:  cem, Hyeongseok Kim
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D24603

Modified:
  head/sbin/fsck_msdosfs/check.c

Modified: head/sbin/fsck_msdosfs/check.c
==
--- head/sbin/fsck_msdosfs/check.c  Tue Apr 28 03:43:55 2020
(r360427)
+++ head/sbin/fsck_msdosfs/check.c  Tue Apr 28 05:10:34 2020
(r360428)
@@ -54,6 +54,8 @@ checkfilesys(const char *fname)
int finish_dosdirsection=0;
int mod = 0;
int ret = 8;
+   int64_t freebytes;
+   int64_t badbytes;
 
rdonly = alwaysno;
if (!preen)
@@ -129,37 +131,33 @@ checkfilesys(const char *fname)
mod |= FSERROR;
}
 
+   freebytes = (int64_t)boot.NumFree * boot.ClusterSize;
+   badbytes = (int64_t)boot.NumBad * boot.ClusterSize;
+
 #ifdef HAVE_LIBUTIL_H
char freestr[7], badstr[7];
 
-   int64_t freebytes = boot.NumFree * boot.ClusterSize;
humanize_number(freestr, sizeof(freestr), freebytes, "",
HN_AUTOSCALE, HN_DECIMAL | HN_IEC_PREFIXES);
if (boot.NumBad) {
-   int64_t badbytes = boot.NumBad * boot.ClusterSize;
-
humanize_number(badstr, sizeof(badstr), badbytes, "",
HN_AUTOSCALE, HN_B | HN_DECIMAL | HN_IEC_PREFIXES);
 
pwarn("%d files, %sB free (%d clusters), %sB bad (%d 
clusters)\n",
- boot.NumFiles,
- freestr, boot.NumFree,
+ boot.NumFiles, freestr, boot.NumFree,
  badstr, boot.NumBad);
} else {
pwarn("%d files, %sB free (%d clusters)\n",
- boot.NumFiles,
- freestr, boot.NumFree);
+ boot.NumFiles, freestr, boot.NumFree);
}
 #else
if (boot.NumBad)
-   pwarn("%d files, %d KiB free (%d clusters), %d KiB bad (%d 
clusters)\n",
- boot.NumFiles,
- boot.NumFree * boot.ClusterSize / 1024, boot.NumFree,
- boot.NumBad * boot.ClusterSize / 1024, boot.NumBad);
+   pwarn("%d files, %jd KiB free (%d clusters), %jd KiB bad (%d 
clusters)\n",
+ boot.NumFiles, (intmax_t)freebytes / 1024, boot.NumFree,
+ (intmax_t)badbytes / 1024, boot.NumBad);
else
-   pwarn("%d files, %d KiB free (%d clusters)\n",
- boot.NumFiles,
- boot.NumFree * boot.ClusterSize / 1024, boot.NumFree);
+   pwarn("%d files, %jd KiB free (%d clusters)\n",
+ boot.NumFiles, (intmax_t)freebytes / 1024, boot.NumFree);
 #endif
 
if (mod && (mod & FSERROR) == 0) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r360427 - head/stand/lua

2020-04-27 Thread Kyle Evans
Author: kevans
Date: Tue Apr 28 03:43:55 2020
New Revision: 360427
URL: https://svnweb.freebsd.org/changeset/base/360427

Log:
  config.lua(8): catch up to recently added hooks
  
  While we're here, let's stylize these as functions instead of just raw text.
  A future change may allow arbitrary data arguments to be passed some of
  these, and the distinction is useful.

Modified:
  head/stand/lua/config.lua.8

Modified: head/stand/lua/config.lua.8
==
--- head/stand/lua/config.lua.8 Tue Apr 28 02:13:59 2020(r360426)
+++ head/stand/lua/config.lua.8 Tue Apr 28 03:43:55 2020(r360427)
@@ -180,8 +180,10 @@ commands.
 The following hooks are defined in
 .Nm :
 .Bl -tag -width "config.reloaded" -offset indent
-.It config.loaded
-.It config.reloaded
+.It Fn config.loaded
+.It Fn config.reloaded
+.It Fn kernel.loaded
+.It Fn modules.loaded
 .El
 .Sh SEE ALSO
 .Xr loader.conf 5 ,
___
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: r360425 - head/stand/lua

2020-04-27 Thread Kyle Evans
Author: kevans
Date: Tue Apr 28 02:13:17 2020
New Revision: 360425
URL: https://svnweb.freebsd.org/changeset/base/360425

Log:
  config.lua(8): "may should" is not proper grammar
  
  Reported by:  rpokala
  X-MFC-With:   r360421

Modified:
  head/stand/lua/config.lua.8

Modified: head/stand/lua/config.lua.8
==
--- head/stand/lua/config.lua.8 Tue Apr 28 02:11:02 2020(r360424)
+++ head/stand/lua/config.lua.8 Tue Apr 28 02:13:17 2020(r360425)
@@ -64,7 +64,7 @@ Process
 .Ev files
 as if it were
 .Ev loader_conf_files .
-The caller may should pass in a table as the
+The caller should pass in a table as the
 .Ev loaded_files
 argument, which uses filenames as keys and any non-nil value to indicate that
 the file named by the key has been loaded.
___
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: r360424 - in head/sys/fs: nfs nfsclient

2020-04-27 Thread Rick Macklem
Author: rmacklem
Date: Tue Apr 28 02:11:02 2020
New Revision: 360424
URL: https://svnweb.freebsd.org/changeset/base/360424

Log:
  Get rid of uio_XXX macros used for the Mac OS/X port.
  
  The NFS code had a bunch of Mac OS/X accessor functions named uio_XXX
  left over from the port to Mac OS/X. Since that port is long forgotten,
  replace the calls with the code generated by the FreeBSD macros for these
  in nfskpiport.h. This allows the macros to be deleted from nfskpiport.h
  and I think makes the code more readable.
  
  This patch should not result in any semantic change.

Modified:
  head/sys/fs/nfs/nfskpiport.h
  head/sys/fs/nfsclient/nfs_clrpcops.c

Modified: head/sys/fs/nfs/nfskpiport.h
==
--- head/sys/fs/nfs/nfskpiport.hTue Apr 28 02:08:55 2020
(r360423)
+++ head/sys/fs/nfs/nfskpiport.hTue Apr 28 02:11:02 2020
(r360424)
@@ -43,20 +43,4 @@ typedef struct vnode *   vnode_t;
 #definevnode_mount(v)  ((v)->v_mount)
 #definevnode_vtype(v)  ((v)->v_type)
 
-/*
- * This stuff is needed by Darwin for handling the uio structure.
- */
-#defineuio_uio_resid(p)((p)->uio_resid)
-#defineuio_uio_resid_add(p, v) ((p)->uio_resid += (v))
-#defineuio_uio_resid_set(p, v) ((p)->uio_resid = (v))
-#defineuio_iov_base(p) ((p)->uio_iov->iov_base)
-#defineuio_iov_base_add(p, v)  do {
\
-   char *pp;   \
-   pp = (char *)(p)->uio_iov->iov_base;\
-   pp += (v);  \
-   (p)->uio_iov->iov_base = (void *)pp;\
-} while (0)
-#defineuio_iov_len(p)  ((p)->uio_iov->iov_len)
-#defineuio_iov_len_add(p, v)   ((p)->uio_iov->iov_len += (v))
-
 #endif /* _NFS_NFSKPIPORT_H */

Modified: head/sys/fs/nfsclient/nfs_clrpcops.c
==
--- head/sys/fs/nfsclient/nfs_clrpcops.cTue Apr 28 02:08:55 2020
(r360423)
+++ head/sys/fs/nfsclient/nfs_clrpcops.cTue Apr 28 02:11:02 2020
(r360424)
@@ -1617,7 +1617,7 @@ nfsrpc_readrpc(vnode_t vp, struct uio *uiop, struct uc
off_t tmp_off;
 
*attrflagp = 0;
-   tsiz = uio_uio_resid(uiop);
+   tsiz = uiop->uio_resid;
tmp_off = uiop->uio_offset + tsiz;
NFSLOCKMNT(nmp);
if (tmp_off > nmp->nm_maxfilesize || tmp_off < uiop->uio_offset) {
@@ -1793,7 +1793,7 @@ nfsrpc_writerpc(vnode_t vp, struct uio *uiop, int *iom
 
KASSERT(uiop->uio_iovcnt == 1, ("nfs: writerpc iovcnt > 1"));
*attrflagp = 0;
-   tsiz = uio_uio_resid(uiop);
+   tsiz = uiop->uio_resid;
tmp_off = uiop->uio_offset + tsiz;
NFSLOCKMNT(nmp);
if (tmp_off > nmp->nm_maxfilesize || tmp_off < uiop->uio_offset) {
@@ -1878,9 +1878,10 @@ nfsrpc_writerpc(vnode_t vp, struct uio *uiop, int *iom
 * back.
 */
uiop->uio_offset -= len;
-   uio_uio_resid_add(uiop, len);
-   uio_iov_base_add(uiop, -len);
-   uio_iov_len_add(uiop, len);
+   uiop->uio_resid += len;
+   uiop->uio_iov->iov_base =
+   (char *)uiop->uio_iov->iov_base - len;
+   uiop->uio_iov->iov_len += len;
}
if (nd->nd_flag & (ND_NFSV3 | ND_NFSV4)) {
error = nfscl_wcc_data(nd, vp, nap, attrflagp,
@@ -1898,10 +1899,12 @@ nfsrpc_writerpc(vnode_t vp, struct uio *uiop, int *iom
goto nfsmout;
} else if (rlen < len) {
backup = len - rlen;
-   uio_iov_base_add(uiop, -(backup));
-   uio_iov_len_add(uiop, backup);
+   uiop->uio_iov->iov_base =
+   (char *)uiop->uio_iov->iov_base -
+   backup;
+   uiop->uio_iov->iov_len += backup;
uiop->uio_offset -= backup;
-   uio_uio_resid_add(uiop, backup);
+   uiop->uio_resid += backup;
len = rlen;
}
commit = fxdr_unsigned(int, *tl++);
@@ -2925,7 +2928,7 @@ nfsrpc_readdir(vnode_t vp, struct uio *uiop, nfsuint64
size_t tresid;
 
KASSERT(uiop->uio_iovcnt == 1 &&
-   (uio_uio_resid(uiop) & (DIRBLKSIZ - 1)) == 0,
+

svn commit: r360423 - head/stand/lua

2020-04-27 Thread Kyle Evans
Author: kevans
Date: Tue Apr 28 02:08:55 2020
New Revision: 360423
URL: https://svnweb.freebsd.org/changeset/base/360423

Log:
  lualoader: cli: clobber loader_conf_files before proceeding
  
  This makes sure that config.readConfFiles doesn't see a stale
  loader_conf_files from before, in case the newly loaded file doesn't set it.
  
  MFC after:3 days

Modified:
  head/stand/lua/cli.lua

Modified: head/stand/lua/cli.lua
==
--- head/stand/lua/cli.lua  Tue Apr 28 02:04:51 2020(r360422)
+++ head/stand/lua/cli.lua  Tue Apr 28 02:08:55 2020(r360423)
@@ -127,6 +127,9 @@ end
 
 cli['read-conf'] = function(...)
local _, argv = cli.arguments(...)
+   -- Don't trigger a reload of previously loaded loader_conf_files, in
+   -- case this config file doesn't set it.
+   loader.setenv("loader_conf_files", "")
config.readConfFiles(assert(core.popFrontTable(argv)), {})
 end
 
___
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: r360422 - head/stand/lua

2020-04-27 Thread Kyle Evans
Author: kevans
Date: Tue Apr 28 02:04:51 2020
New Revision: 360422
URL: https://svnweb.freebsd.org/changeset/base/360422

Log:
  lualoader: cli: add read-conf
  
  This is a straightforward match to the command used by many in forthloader;
  it uses the newly-exported config.readConfFiles() to make sure that any
  loader_conf_files gets done as appropriate.
  
  PR:   244640
  Submitted by: Olivier Certner 
  MFC after:3 days

Modified:
  head/stand/lua/cli.lua

Modified: head/stand/lua/cli.lua
==
--- head/stand/lua/cli.lua  Tue Apr 28 02:03:03 2020(r360421)
+++ head/stand/lua/cli.lua  Tue Apr 28 02:04:51 2020(r360422)
@@ -125,6 +125,11 @@ cli['boot-conf'] = function(...)
core.autoboot(argstr)
 end
 
+cli['read-conf'] = function(...)
+   local _, argv = cli.arguments(...)
+   config.readConfFiles(assert(core.popFrontTable(argv)), {})
+end
+
 cli['reload-conf'] = function(...)
config.reload()
 end
___
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: r360421 - head/stand/lua

2020-04-27 Thread Kyle Evans
Author: kevans
Date: Tue Apr 28 02:03:03 2020
New Revision: 360421
URL: https://svnweb.freebsd.org/changeset/base/360421

Log:
  lualoader: config: start exporting readConfFiles
  
  In the process, change it slightly: readConfFiles will take a string like
  loader_conf_files in addition to the loaded_files table that it normally
  takes. This is to facilitate the addition of a read-conf CLI command, which
  will just pass in the single file to read and an empty table.
  
  MFC after:3 days

Modified:
  head/stand/lua/config.lua
  head/stand/lua/config.lua.8

Modified: head/stand/lua/config.lua
==
--- head/stand/lua/config.lua   Tue Apr 28 01:39:34 2020(r360420)
+++ head/stand/lua/config.lua   Tue Apr 28 02:03:03 2020(r360421)
@@ -340,38 +340,6 @@ local function loadModule(mod, silent)
return status
 end
 
-local function readConfFiles(loaded_files)
-   local f = loader.getenv("loader_conf_files")
-   if f ~= nil then
-   local prefiles = f
-   for name in f:gmatch("([%w%p]+)%s*") do
-   if loaded_files[name] ~= nil then
-   goto continue
-   end
-
-   print("Loading " .. name)
-   -- These may or may not exist, and that's ok. Do a
-   -- silent parse so that we complain on parse errors but
-   -- not for them simply not existing.
-   if not config.processFile(name, true) then
-   print(MSG_FAILPARSECFG:format(name))
-   end
-
-   loaded_files[name] = true
-   local newfiles = loader.getenv("loader_conf_files")
-   if prefiles ~= newfiles then
-   -- Recurse; process the new files immediately.
-   -- If we come back and it turns out we've
-   -- already loaded the rest of what was in the
-   -- original loader_conf_files, no big deal.
-   readConfFiles(loaded_files)
-   prefiles = newfiles
-   end
-   ::continue::
-   end
-   end
-end
-
 local function readFile(name, silent)
local f = io.open(name)
if f == nil then
@@ -492,6 +460,40 @@ function config.parse(text)
return status
 end
 
+function config.readConfFiles(files, loaded_files)
+   if files ~= nil then
+   -- The caller may not have passed in loader_conf_files; we could
+   -- have instead gotten some other string of files.  We don't
+   -- want to trigger any redundant re-read/loads based on this.
+   local prefiles = loader.getenv("loader_conf_files")
+   for name in files:gmatch("([%w%p]+)%s*") do
+   if loaded_files[name] ~= nil then
+   goto continue
+   end
+
+   print("Loading " .. name)
+   -- These may or may not exist, and that's ok. Do a
+   -- silent parse so that we complain on parse errors but
+   -- not for them simply not existing.
+   if not config.processFile(name, true) then
+   print(MSG_FAILPARSECFG:format(name))
+   end
+
+   loaded_files[name] = true
+   local newfiles = loader.getenv("loader_conf_files")
+   if prefiles ~= newfiles then
+   -- Recurse; process the new files immediately.
+   -- If we come back and it turns out we've
+   -- already loaded the rest of what was in the
+   -- original loader_conf_files, no big deal.
+   config.readConfFiles(newfiles, loaded_files)
+   prefiles = newfiles
+   end
+   ::continue::
+   end
+   end
+end
+
 -- other_kernel is optionally the name of a kernel to load, if not the default
 -- or autoloaded default from the module_path
 function config.loadKernel(other_kernel)
@@ -605,7 +607,7 @@ function config.load(file, reloading)
end
 
local loaded_files = {file = true}
-   readConfFiles(loaded_files)
+   config.readConfFiles(loader.getenv("loader_conf_files"), loaded_files)
 
checkNextboot()
 

Modified: head/stand/lua/config.lua.8
==
--- head/stand/lua/config.lua.8 Tue Apr 28 01:39:34 2020(r360420)
+++ head/stand/lua/config.lua.8 Tue Apr 28 02:03:03 2020(r360421)

svn commit: r360420 - head/stand/lua

2020-04-27 Thread Kyle Evans
Author: kevans
Date: Tue Apr 28 01:39:34 2020
New Revision: 360420
URL: https://svnweb.freebsd.org/changeset/base/360420

Log:
  lualoader config: don't call loader.getenv() as much
  
  We don't actually need to fetch loader_conf_files as much as we do; we've
  already fetched it once at the beginning, we only really need to fetch it
  again after each file we've processed. If it changes, then we can stash that
  off into our local prefiles.
  
  While here, drop a note about the recursion so that I stop trying to
  change it. It may very well make redundant some of the work we're doing, but
  that's OK.
  
  MFC after:3 days

Modified:
  head/stand/lua/config.lua

Modified: head/stand/lua/config.lua
==
--- head/stand/lua/config.lua   Tue Apr 28 00:44:05 2020(r360419)
+++ head/stand/lua/config.lua   Tue Apr 28 01:39:34 2020(r360420)
@@ -343,13 +343,12 @@ end
 local function readConfFiles(loaded_files)
local f = loader.getenv("loader_conf_files")
if f ~= nil then
+   local prefiles = f
for name in f:gmatch("([%w%p]+)%s*") do
if loaded_files[name] ~= nil then
goto continue
end
 
-   local prefiles = loader.getenv("loader_conf_files")
-
print("Loading " .. name)
-- These may or may not exist, and that's ok. Do a
-- silent parse so that we complain on parse errors but
@@ -361,7 +360,12 @@ local function readConfFiles(loaded_files)
loaded_files[name] = true
local newfiles = loader.getenv("loader_conf_files")
if prefiles ~= newfiles then
+   -- Recurse; process the new files immediately.
+   -- If we come back and it turns out we've
+   -- already loaded the rest of what was in the
+   -- original loader_conf_files, no big deal.
readConfFiles(loaded_files)
+   prefiles = newfiles
end
::continue::
end
___
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: r360418 - head/sys/sys

2020-04-27 Thread John Baldwin
Author: jhb
Date: Tue Apr 28 00:06:49 2020
New Revision: 360418
URL: https://svnweb.freebsd.org/changeset/base/360418

Log:
  Bump __FreeBSD_version for KTLS RX support.

Modified:
  head/sys/sys/param.h

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hMon Apr 27 23:59:42 2020(r360417)
+++ head/sys/sys/param.hTue Apr 28 00:06:49 2020(r360418)
@@ -60,7 +60,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1300092  /* Master, propagated to newvers */
+#define __FreeBSD_version 1300093  /* 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: r360417 - head/sys/dev/cxgbe/tom

2020-04-27 Thread John Baldwin
Author: jhb
Date: Mon Apr 27 23:59:42 2020
New Revision: 360417
URL: https://svnweb.freebsd.org/changeset/base/360417

Log:
  Add support for KTLS RX over TOE to T6.
  
  This largely reuses the TLS TOE support added in r330884.  However,
  this uses the KTLS framework in upstream OpenSSL rather than requiring
  Chelsio-specific patches to OpenSSL.  As with the existing TLS TOE
  support, use of RX offload requires setting the tls_rx_ports sysctl.
  
  Reviewed by:  np
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D24453

Modified:
  head/sys/dev/cxgbe/tom/t4_tls.c
  head/sys/dev/cxgbe/tom/t4_tom.c
  head/sys/dev/cxgbe/tom/t4_tom.h

Modified: head/sys/dev/cxgbe/tom/t4_tls.c
==
--- head/sys/dev/cxgbe/tom/t4_tls.c Mon Apr 27 23:55:09 2020
(r360416)
+++ head/sys/dev/cxgbe/tom/t4_tls.c Mon Apr 27 23:59:42 2020
(r360417)
@@ -379,7 +379,7 @@ prepare_rxkey_wr(struct tls_keyctx *kwr, struct tls_ke
int proto_ver = kctx->proto_ver;
 
kwr->u.rxhdr.flitcnt_hmacctrl =
-   ((kctx->tx_key_info_size >> 4) << 3) | kctx->hmac_ctrl;
+   ((kctx->rx_key_info_size >> 4) << 3) | kctx->hmac_ctrl;
 
kwr->u.rxhdr.protover_ciphmode =
V_TLS_KEYCTX_TX_WR_PROTOVER(get_proto_ver(proto_ver)) |
@@ -408,7 +408,7 @@ prepare_rxkey_wr(struct tls_keyctx *kwr, struct tls_ke
   (IPAD_SIZE + OPAD_SIZE));
} else {
memcpy(kwr->keys.edkey, kctx->rx.key,
-  (kctx->tx_key_info_size - SALT_SIZE));
+  (kctx->rx_key_info_size - SALT_SIZE));
memcpy(kwr->u.rxhdr.rxsalt, kctx->rx.salt, SALT_SIZE);
}
 }
@@ -674,6 +674,13 @@ program_key_context(struct tcpcb *tp, struct toepcb *t
 
if ((G_KEY_GET_LOC(k_ctx->l_p_key) == KEY_WRITE_RX) ||
(tls_ofld->key_location == TLS_SFO_WR_CONTEXTLOC_DDR)) {
+
+   /*
+* XXX: The userland library sets tx_key_info_size, not
+* rx_key_info_size.
+*/
+   k_ctx->rx_key_info_size = k_ctx->tx_key_info_size;
+
error = tls_program_key_id(toep, k_ctx);
if (error) {
/* XXX: Only clear quiesce for KEY_WRITE_RX? */
@@ -866,31 +873,37 @@ t4_ctloutput_tls(struct socket *so, struct sockopt *so
 
 #ifdef KERN_TLS
 static void
-init_ktls_key_context(struct ktls_session *tls, struct tls_key_context *k_ctx)
+init_ktls_key_context(struct ktls_session *tls, struct tls_key_context *k_ctx,
+int direction)
 {
struct auth_hash *axf;
-   u_int mac_key_size;
-   char *hash;
+   u_int key_info_size, mac_key_size;
+   char *hash, *key;
 
-   k_ctx->l_p_key = V_KEY_GET_LOC(KEY_WRITE_TX);
-   if (tls->params.tls_vminor == TLS_MINOR_VER_ONE)
-   k_ctx->proto_ver = SCMD_PROTO_VERSION_TLS_1_1;
-   else
-   k_ctx->proto_ver = SCMD_PROTO_VERSION_TLS_1_2;
+   k_ctx->l_p_key = V_KEY_GET_LOC(direction == KTLS_TX ? KEY_WRITE_TX :
+   KEY_WRITE_RX);
+   k_ctx->proto_ver = tls->params.tls_vmajor << 8 | tls->params.tls_vminor;
k_ctx->cipher_secret_size = tls->params.cipher_key_len;
-   k_ctx->tx_key_info_size = sizeof(struct tx_keyctx_hdr) +
+   key_info_size = sizeof(struct tx_keyctx_hdr) +
k_ctx->cipher_secret_size;
-   memcpy(k_ctx->tx.key, tls->params.cipher_key,
-   tls->params.cipher_key_len);
-   hash = k_ctx->tx.key + tls->params.cipher_key_len;
+   if (direction == KTLS_TX)
+   key = k_ctx->tx.key;
+   else
+   key = k_ctx->rx.key;
+   memcpy(key, tls->params.cipher_key, tls->params.cipher_key_len);
+   hash = key + tls->params.cipher_key_len;
if (tls->params.cipher_algorithm == CRYPTO_AES_NIST_GCM_16) {
k_ctx->state.auth_mode = SCMD_AUTH_MODE_GHASH;
k_ctx->state.enc_mode = SCMD_CIPH_MODE_AES_GCM;
k_ctx->iv_size = 4;
k_ctx->mac_first = 0;
k_ctx->hmac_ctrl = SCMD_HMAC_CTRL_NOP;
-   k_ctx->tx_key_info_size += GMAC_BLOCK_LEN;
-   memcpy(k_ctx->tx.salt, tls->params.iv, SALT_SIZE);
+   key_info_size += GMAC_BLOCK_LEN;
+   k_ctx->mac_secret_size = 0;
+   if (direction == KTLS_TX)
+   memcpy(k_ctx->tx.salt, tls->params.iv, SALT_SIZE);
+   else
+   memcpy(k_ctx->rx.salt, tls->params.iv, SALT_SIZE);
t4_init_gmac_hash(tls->params.cipher_key,
tls->params.cipher_key_len, hash);
} else {
@@ -917,29 +930,38 @@ init_ktls_key_context(struct ktls_session *tls, struct
k_ctx->iv_size = 8; /* for CBC, iv is 16B, unit of 2B */
k_ctx->mac_first = 1;
k_ctx->hmac_ctrl = SCM

svn commit: r360416 - head/sys/kern

2020-04-27 Thread Rick Macklem
Author: rmacklem
Date: Mon Apr 27 23:55:09 2020
New Revision: 360416
URL: https://svnweb.freebsd.org/changeset/base/360416

Log:
  Fix sosend_generic() so that it can handle a list of ext_pgs mbufs.
  
  Without this patch, sosend_generic() will try to use top->m_pkthdr.len,
  assuming that the first mbuf has a pkthdr.
  When a list of ext_pgs mbufs is passed in, the first mbuf is not a
  pkthdr and cannot be post-r359919.  As such, the value of top->m_pkthdr.len
  is bogus (0 for my testing).
  This patch fixes sosend_generic() to handle this case, calculating the
  total length via m_length() for this case.
  
  There is currently nothing that hands a list of ext_pgs mbufs to
  sosend_generic(), but the nfs-over-tls kernel RPC code in
  projects/nfs-over-tls will do that and was used to test this patch.
  
  Reviewed by:  gallatin
  Differential Revision:https://reviews.freebsd.org/D24568

Modified:
  head/sys/kern/uipc_socket.c

Modified: head/sys/kern/uipc_socket.c
==
--- head/sys/kern/uipc_socket.c Mon Apr 27 23:49:13 2020(r360415)
+++ head/sys/kern/uipc_socket.c Mon Apr 27 23:55:09 2020(r360416)
@@ -1557,8 +1557,10 @@ sosend_generic(struct socket *so, struct sockaddr *add
 #endif
if (uio != NULL)
resid = uio->uio_resid;
-   else
+   else if ((top->m_flags & M_PKTHDR) != 0)
resid = top->m_pkthdr.len;
+   else
+   resid = m_length(top, NULL);
/*
 * In theory resid should be unsigned.  However, space must be
 * signed, as it might be less than 0 if we over-committed, and we
___
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: r360415 - in stable/11: lib/libc/gen lib/libc/net lib/libc/rpc sys/dev/ocs_fc sys/net80211

2020-04-27 Thread Brooks Davis
Author: brooks
Date: Mon Apr 27 23:49:13 2020
New Revision: 360415
URL: https://svnweb.freebsd.org/changeset/base/360415

Log:
  MFC r359978:
  
  Fix -Wvoid-pointer-to-enum-cast warnings.
  
  This pattern is used in callbacks with void * data arguments and seems
  both relatively uncommon and relatively harmless.  Silence the warning
  by casting through uintptr_t.
  
  This warning is on by default in Clang 11.
  
  Reviewed by:  arichardson
  Obtained from:CheriBSD (partial)
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D24425

Modified:
  stable/11/lib/libc/gen/getgrent.c
  stable/11/lib/libc/gen/getpwent.c
  stable/11/lib/libc/net/gethostnamadr.c
  stable/11/lib/libc/net/getnetnamadr.c
  stable/11/lib/libc/net/getprotoent.c
  stable/11/lib/libc/net/getservent.c
  stable/11/lib/libc/rpc/getrpcent.c
  stable/11/sys/dev/ocs_fc/ocs_device.c
  stable/11/sys/net80211/ieee80211_output.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/gen/getgrent.c
==
--- stable/11/lib/libc/gen/getgrent.c   Mon Apr 27 23:47:40 2020
(r360414)
+++ stable/11/lib/libc/gen/getgrent.c   Mon Apr 27 23:49:13 2020
(r360415)
@@ -164,7 +164,7 @@ grp_id_func(char *buffer, size_t *buffer_size, va_list
enum nss_lookup_type lookup_type;
 
 
-   lookup_type = (enum nss_lookup_type)cache_mdata;
+   lookup_type = (enum nss_lookup_type)(uintptr_t)cache_mdata;
switch (lookup_type) {
case nss_lt_name:
name = va_arg(ap, char *);
@@ -218,7 +218,7 @@ grp_marshal_func(char *buffer, size_t *buffer_size, vo
size_t desired_size, size, mem_size;
char *p, **mem;
 
-   switch ((enum nss_lookup_type)cache_mdata) {
+   switch ((enum nss_lookup_type)(uintptr_t)cache_mdata) {
case nss_lt_name:
name = va_arg(ap, char *);
break;
@@ -313,7 +313,7 @@ grp_unmarshal_func(char *buffer, size_t buffer_size, v
char *p;
char **mem;
 
-   switch ((enum nss_lookup_type)cache_mdata) {
+   switch ((enum nss_lookup_type)(uintptr_t)cache_mdata) {
case nss_lt_name:
name = va_arg(ap, char *);
break;
@@ -804,7 +804,7 @@ files_setgrent(void *retval, void *mdata, va_list ap)
rv = files_getstate(&st);
if (rv != 0) 
return (NS_UNAVAIL);
-   switch ((enum constants)mdata) {
+   switch ((enum constants)(uintptr_t)mdata) {
case SETGRENT:
stayopen = va_arg(ap, int);
if (st->fp != NULL)
@@ -840,7 +840,7 @@ files_group(void *retval, void *mdata, va_list ap)
 
name = NULL;
gid = (gid_t)-1;
-   how = (enum nss_lookup_type)mdata;
+   how = (enum nss_lookup_type)(uintptr_t)mdata;
switch (how) {
case nss_lt_name:
name = va_arg(ap, const char *);
@@ -1087,7 +1087,7 @@ nis_group(void *retval, void *mdata, va_list ap)

name = NULL;
gid = (gid_t)-1;
-   how = (enum nss_lookup_type)mdata;
+   how = (enum nss_lookup_type)(uintptr_t)mdata;
switch (how) {
case nss_lt_name:
name = va_arg(ap, const char *);
@@ -1246,7 +1246,7 @@ compat_setgrent(void *retval, void *mdata, va_list ap)
rv = compat_getstate(&st);
if (rv != 0)
return (NS_UNAVAIL);
-   switch ((enum constants)mdata) {
+   switch ((enum constants)(uintptr_t)mdata) {
case SETGRENT:
stayopen = va_arg(ap, int);
if (st->fp != NULL)
@@ -1314,7 +1314,7 @@ compat_group(void *retval, void *mdata, va_list ap)
 
name = NULL;
gid = (gid_t)-1;
-   how = (enum nss_lookup_type)mdata;
+   how = (enum nss_lookup_type)(uintptr_t)mdata;
switch (how) {
case nss_lt_name:
name = va_arg(ap, const char *);

Modified: stable/11/lib/libc/gen/getpwent.c
==
--- stable/11/lib/libc/gen/getpwent.c   Mon Apr 27 23:47:40 2020
(r360414)
+++ stable/11/lib/libc/gen/getpwent.c   Mon Apr 27 23:49:13 2020
(r360415)
@@ -211,7 +211,7 @@ pwd_id_func(char *buffer, size_t *buffer_size, va_list
int res = NS_UNAVAIL;
enum nss_lookup_type lookup_type;
 
-   lookup_type = (enum nss_lookup_type)cache_mdata;
+   lookup_type = (enum nss_lookup_type)(uintptr_t)cache_mdata;
switch (lookup_type) {
case nss_lt_name:
name = va_arg(ap, char *);
@@ -265,7 +265,7 @@ pwd_marshal_func(char *buffer, size_t *buffer_size, vo
size_t desired_size, size;
char *p;
 
-   switch ((enum nss_lookup_type)cache_mdata) {
+   switch ((enum nss_lookup_type)(uintptr_t)cache_mdata) {
case nss_lt_name:
name = va_arg(ap, char *);
break;
@@

svn commit: r360414 - in stable/12: lib/libc/gen lib/libc/net lib/libc/rpc sys/dev/ocs_fc sys/net80211

2020-04-27 Thread Brooks Davis
Author: brooks
Date: Mon Apr 27 23:47:40 2020
New Revision: 360414
URL: https://svnweb.freebsd.org/changeset/base/360414

Log:
  MFC r359978:
  
  Fix -Wvoid-pointer-to-enum-cast warnings.
  
  This pattern is used in callbacks with void * data arguments and seems
  both relatively uncommon and relatively harmless.  Silence the warning
  by casting through uintptr_t.
  
  This warning is on by default in Clang 11.
  
  Reviewed by:  arichardson
  Obtained from:CheriBSD (partial)
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D24425

Modified:
  stable/12/lib/libc/gen/getgrent.c
  stable/12/lib/libc/gen/getpwent.c
  stable/12/lib/libc/net/gethostnamadr.c
  stable/12/lib/libc/net/getnetnamadr.c
  stable/12/lib/libc/net/getprotoent.c
  stable/12/lib/libc/net/getservent.c
  stable/12/lib/libc/rpc/getrpcent.c
  stable/12/sys/dev/ocs_fc/ocs_device.c
  stable/12/sys/net80211/ieee80211_output.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libc/gen/getgrent.c
==
--- stable/12/lib/libc/gen/getgrent.c   Mon Apr 27 23:43:17 2020
(r360413)
+++ stable/12/lib/libc/gen/getgrent.c   Mon Apr 27 23:47:40 2020
(r360414)
@@ -166,7 +166,7 @@ grp_id_func(char *buffer, size_t *buffer_size, va_list
enum nss_lookup_type lookup_type;
 
 
-   lookup_type = (enum nss_lookup_type)cache_mdata;
+   lookup_type = (enum nss_lookup_type)(uintptr_t)cache_mdata;
switch (lookup_type) {
case nss_lt_name:
name = va_arg(ap, char *);
@@ -220,7 +220,7 @@ grp_marshal_func(char *buffer, size_t *buffer_size, vo
size_t desired_size, size, mem_size;
char *p, **mem;
 
-   switch ((enum nss_lookup_type)cache_mdata) {
+   switch ((enum nss_lookup_type)(uintptr_t)cache_mdata) {
case nss_lt_name:
name = va_arg(ap, char *);
break;
@@ -315,7 +315,7 @@ grp_unmarshal_func(char *buffer, size_t buffer_size, v
char *p;
char **mem;
 
-   switch ((enum nss_lookup_type)cache_mdata) {
+   switch ((enum nss_lookup_type)(uintptr_t)cache_mdata) {
case nss_lt_name:
name = va_arg(ap, char *);
break;
@@ -804,7 +804,7 @@ files_setgrent(void *retval, void *mdata, va_list ap)
rv = files_getstate(&st);
if (rv != 0) 
return (NS_UNAVAIL);
-   switch ((enum constants)mdata) {
+   switch ((enum constants)(uintptr_t)mdata) {
case SETGRENT:
stayopen = va_arg(ap, int);
if (st->fp != NULL)
@@ -841,7 +841,7 @@ files_group(void *retval, void *mdata, va_list ap)
fresh = 0;
name = NULL;
gid = (gid_t)-1;
-   how = (enum nss_lookup_type)mdata;
+   how = (enum nss_lookup_type)(uintptr_t)mdata;
switch (how) {
case nss_lt_name:
name = va_arg(ap, const char *);
@@ -1094,7 +1094,7 @@ nis_group(void *retval, void *mdata, va_list ap)

name = NULL;
gid = (gid_t)-1;
-   how = (enum nss_lookup_type)mdata;
+   how = (enum nss_lookup_type)(uintptr_t)mdata;
switch (how) {
case nss_lt_name:
name = va_arg(ap, const char *);
@@ -1253,7 +1253,7 @@ compat_setgrent(void *retval, void *mdata, va_list ap)
rv = compat_getstate(&st);
if (rv != 0)
return (NS_UNAVAIL);
-   switch ((enum constants)mdata) {
+   switch ((enum constants)(uintptr_t)mdata) {
case SETGRENT:
stayopen = va_arg(ap, int);
if (st->fp != NULL)
@@ -1322,7 +1322,7 @@ compat_group(void *retval, void *mdata, va_list ap)
fresh = 0;
name = NULL;
gid = (gid_t)-1;
-   how = (enum nss_lookup_type)mdata;
+   how = (enum nss_lookup_type)(uintptr_t)mdata;
switch (how) {
case nss_lt_name:
name = va_arg(ap, const char *);

Modified: stable/12/lib/libc/gen/getpwent.c
==
--- stable/12/lib/libc/gen/getpwent.c   Mon Apr 27 23:43:17 2020
(r360413)
+++ stable/12/lib/libc/gen/getpwent.c   Mon Apr 27 23:47:40 2020
(r360414)
@@ -213,7 +213,7 @@ pwd_id_func(char *buffer, size_t *buffer_size, va_list
int res = NS_UNAVAIL;
enum nss_lookup_type lookup_type;
 
-   lookup_type = (enum nss_lookup_type)cache_mdata;
+   lookup_type = (enum nss_lookup_type)(uintptr_t)cache_mdata;
switch (lookup_type) {
case nss_lt_name:
name = va_arg(ap, char *);
@@ -267,7 +267,7 @@ pwd_marshal_func(char *buffer, size_t *buffer_size, vo
size_t desired_size, size;
char *p;
 
-   switch ((enum nss_lookup_type)cache_mdata) {
+   switch ((enum nss_lookup_type)(uintptr_t)cache_mdata) {
case nss_lt_name:
name = va_arg(ap, 

svn commit: r360410 - head/sys/cam/ata

2020-04-27 Thread Warner Losh
Author: imp
Date: Mon Apr 27 23:43:04 2020
New Revision: 360410
URL: https://svnweb.freebsd.org/changeset/base/360410

Log:
  Add flags sysctl to ada
  
  Report the ada device flags like we do the da devices. No booleans
  have (yet) been converted, but iomapped and rotating are planned.

Modified:
  head/sys/cam/ata/ata_da.c

Modified: head/sys/cam/ata/ata_da.c
==
--- head/sys/cam/ata/ata_da.c   Mon Apr 27 23:39:32 2020(r360409)
+++ head/sys/cam/ata/ata_da.c   Mon Apr 27 23:43:04 2020(r360410)
@@ -111,6 +111,31 @@ typedef enum {
ADA_FLAG_CAN_NCQ_TRIM   = 0x0040,   /* CAN_TRIM also set */
ADA_FLAG_PIM_ATA_EXT= 0x0080
 } ada_flags;
+#define ADA_FLAG_STRING\
+   "\020"  \
+   "\002CAN_48BIT" \
+   "\003CAN_FLUSHCACHE"\
+   "\004CAN_NCQ"   \
+   "\005CAN_DMA"   \
+   "\006NEED_OTAG" \
+   "\007WAS_OTAG"  \
+   "\010CAN_TRIM"  \
+   "\011OPEN"  \
+   "\012SCTX_INIT" \
+   "\013CAN_CFA"   \
+   "\014CAN_POWERMGT"  \
+   "\015CAN_DMA48" \
+   "\016CAN_LOG"   \
+   "\017CAN_IDLOG" \
+   "\020CAN_SUPCAP"\
+   "\021CAN_ZONE"  \
+   "\022CAN_WCACHE"\
+   "\023CAN_RAHEAD"\
+   "\024PROBED"\
+   "\025ANNOUNCED" \
+   "\026DIRTY" \
+   "\027CAN_NCQ_TRIM"  \
+   "\030PIM_ATA_EXT"
 
 typedef enum {
ADA_Q_NONE  = 0x00,
@@ -806,8 +831,9 @@ static  periph_oninv_t  adaoninvalidate;
 static periph_dtor_t   adacleanup;
 static voidadaasync(void *callback_arg, u_int32_t code,
struct cam_path *path, void *arg);
-static int adazonemodesysctl(SYSCTL_HANDLER_ARGS);
+static int adaflagssysctl(SYSCTL_HANDLER_ARGS);
 static int adazonesupsysctl(SYSCTL_HANDLER_ARGS);
+static int adazonesupsysctl(SYSCTL_HANDLER_ARGS);
 static voidadasysctlinit(void *context, int pending);
 static int adagetattr(struct bio *bp);
 static voidadasetflags(struct ada_softc *softc,
@@ -1518,6 +1544,10 @@ adasysctlinit(void *context, int pending)
SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO,
"max_seq_zones", CTLFLAG_RD, &softc->max_seq_zones,
"Maximum Number of Open Sequential Write Required Zones");
+   SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree),
+   OID_AUTO, "flags", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE,
+   softc, 0, adaflagssysctl, "A",
+   "Flags for drive");
 
 #ifdef CAM_TEST_FAILURE
/*
@@ -1624,6 +1654,24 @@ adadeletemethodsysctl(SYSCTL_HANDLER_ARGS)
return (0);
}
return (EINVAL);
+}
+
+static int
+adaflagssysctl(SYSCTL_HANDLER_ARGS)
+{
+   struct sbuf sbuf;
+   struct ada_softc *softc = arg1;
+   int error;
+
+   sbuf_new_for_sysctl(&sbuf, NULL, 0, req);
+   if (softc->flags != 0)
+   sbuf_printf(&sbuf, "0x%b", (unsigned)softc->flags, 
ADA_FLAG_STRING);
+   else
+   sbuf_printf(&sbuf, "0");
+   error = sbuf_finish(&sbuf);
+   sbuf_delete(&sbuf);
+
+   return (error);
 }
 
 static void
___
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: r360413 - head/sys/cam/nvme

2020-04-27 Thread Warner Losh
Author: imp
Date: Mon Apr 27 23:43:17 2020
New Revision: 360413
URL: https://svnweb.freebsd.org/changeset/base/360413

Log:
  Export the nda device's flags as a sysctl.

Modified:
  head/sys/cam/nvme/nvme_da.c

Modified: head/sys/cam/nvme/nvme_da.c
==
--- head/sys/cam/nvme/nvme_da.c Mon Apr 27 23:43:12 2020(r360412)
+++ head/sys/cam/nvme/nvme_da.c Mon Apr 27 23:43:17 2020(r360413)
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #endif /* _KERNEL */
@@ -75,6 +76,11 @@ typedef enum {
NDA_FLAG_DIRTY  = 0x0002,
NDA_FLAG_SCTX_INIT  = 0x0004,
 } nda_flags;
+#define NDA_FLAG_STRING\
+   "\020"  \
+   "\001OPEN"  \
+   "\002DIRTY" \
+   "\003SCTX_INIT"
 
 typedef enum {
NDA_Q_4K   = 0x01,
@@ -144,6 +150,7 @@ static  periph_init_t   ndainit;
 static voidndaasync(void *callback_arg, u_int32_t code,
struct cam_path *path, void *arg);
 static voidndasysctlinit(void *context, int pending);
+static int ndaflagssysctl(SYSCTL_HANDLER_ARGS);
 static periph_ctor_t   ndaregister;
 static periph_dtor_t   ndacleanup;
 static periph_start_t  ndastart;
@@ -659,6 +666,11 @@ ndasysctlinit(void *context, int pending)
OID_AUTO, "rotating", CTLFLAG_RD, &nda_rotating_media, 1,
"Rotating media");
 
+   SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree),
+   OID_AUTO, "flags", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE,
+   softc, 0, ndaflagssysctl, "A",
+   "Flags for drive");
+
 #ifdef CAM_IO_STATS
softc->sysctl_stats_tree = SYSCTL_ADD_NODE(&softc->sysctl_stats_ctx,
SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "stats",
@@ -696,6 +708,24 @@ ndasysctlinit(void *context, int pending)
softc->sysctl_tree);
 
cam_periph_release(periph);
+}
+
+static int
+ndaflagssysctl(SYSCTL_HANDLER_ARGS)
+{
+   struct sbuf sbuf;
+   struct nda_softc *softc = arg1;
+   int error;
+
+   sbuf_new_for_sysctl(&sbuf, NULL, 0, req);
+   if (softc->flags != 0)
+   sbuf_printf(&sbuf, "0x%b", (unsigned)softc->flags, 
NDA_FLAG_STRING);
+   else
+   sbuf_printf(&sbuf, "0");
+   error = sbuf_finish(&sbuf);
+   sbuf_delete(&sbuf);
+
+   return (error);
 }
 
 static int
___
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: r360411 - head/sys/cam/ata

2020-04-27 Thread Warner Losh
Author: imp
Date: Mon Apr 27 23:43:08 2020
New Revision: 360411
URL: https://svnweb.freebsd.org/changeset/base/360411

Log:
  Convert unmappedio over to a flag.
  
  Make unmappedio a flag. Move it to the flags definition. Add compat
  sysctl for it.

Modified:
  head/sys/cam/ata/ata_da.c

Modified: head/sys/cam/ata/ata_da.c
==
--- head/sys/cam/ata/ata_da.c   Mon Apr 27 23:43:04 2020(r360410)
+++ head/sys/cam/ata/ata_da.c   Mon Apr 27 23:43:08 2020(r360411)
@@ -109,7 +109,8 @@ typedef enum {
ADA_FLAG_ANNOUNCED  = 0x0010,
ADA_FLAG_DIRTY  = 0x0020,
ADA_FLAG_CAN_NCQ_TRIM   = 0x0040,   /* CAN_TRIM also set */
-   ADA_FLAG_PIM_ATA_EXT= 0x0080
+   ADA_FLAG_PIM_ATA_EXT= 0x0080,
+   ADA_FLAG_UNMAPPEDIO = 0x0100
 } ada_flags;
 #define ADA_FLAG_STRING\
"\020"  \
@@ -135,7 +136,8 @@ typedef enum {
"\025ANNOUNCED" \
"\026DIRTY" \
"\027CAN_NCQ_TRIM"  \
-   "\030PIM_ATA_EXT"
+   "\030PIM_ATA_EXT"   \
+   "\031UNMAPPEDIO"
 
 typedef enum {
ADA_Q_NONE  = 0x00,
@@ -264,7 +266,6 @@ struct ada_softc {
int  trim_max_ranges;
int  read_ahead;
int  write_cache;
-   int  unmappedio;
int  rotating;
 #ifdef CAM_TEST_FAILURE
int  force_read_error;
@@ -831,6 +832,7 @@ static  periph_oninv_t  adaoninvalidate;
 static periph_dtor_t   adacleanup;
 static voidadaasync(void *callback_arg, u_int32_t code,
struct cam_path *path, void *arg);
+static int adabitsysctl(SYSCTL_HANDLER_ARGS);
 static int adaflagssysctl(SYSCTL_HANDLER_ARGS);
 static int adazonesupsysctl(SYSCTL_HANDLER_ARGS);
 static int adazonesupsysctl(SYSCTL_HANDLER_ARGS);
@@ -1515,9 +1517,6 @@ adasysctlinit(void *context, int pending)
OID_AUTO, "write_cache", CTLFLAG_RW | CTLFLAG_MPSAFE,
&softc->write_cache, 0, "Enable disk write cache.");
SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree),
-   OID_AUTO, "unmapped_io", CTLFLAG_RD | CTLFLAG_MPSAFE,
-   &softc->unmappedio, 0, "Unmapped I/O leaf");
-   SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree),
OID_AUTO, "rotating", CTLFLAG_RD | CTLFLAG_MPSAFE,
&softc->rotating, 0, "Rotating media");
SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree),
@@ -1548,6 +1547,10 @@ adasysctlinit(void *context, int pending)
OID_AUTO, "flags", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE,
softc, 0, adaflagssysctl, "A",
"Flags for drive");
+   SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree),
+   OID_AUTO, "unmapped_io", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE,
+   &softc->flags, (u_int)ADA_FLAG_UNMAPPEDIO, adabitsysctl, "I",
+   "Unmapped I/O support *DEPRECATED* gone in FreeBSD 14");
 
 #ifdef CAM_TEST_FAILURE
/*
@@ -1657,6 +1660,21 @@ adadeletemethodsysctl(SYSCTL_HANDLER_ARGS)
 }
 
 static int
+adabitsysctl(SYSCTL_HANDLER_ARGS)
+{
+   u_int *flags = arg1;
+   u_int test = arg2;
+   int tmpout, error;
+
+   tmpout = !!(*flags & test);
+   error = SYSCTL_OUT(req, &tmpout, sizeof(tmpout));
+   if (error || !req->newptr)
+   return (error);
+
+   return (EPERM);
+}
+
+static int
 adaflagssysctl(SYSCTL_HANDLER_ARGS)
 {
struct sbuf sbuf;
@@ -3459,7 +3477,7 @@ adasetgeom(struct ada_softc *softc, struct ccb_getdev 
softc->disk->d_delmaxsize = maxio;
if ((softc->cpi.hba_misc & PIM_UNMAPPED) != 0) {
d_flags |= DISKFLAG_UNMAPPED_BIO;
-   softc->unmappedio = 1;
+   softc->flags |= ADA_FLAG_UNMAPPEDIO;
}
softc->disk->d_flags = d_flags;
strlcpy(softc->disk->d_descr, cgd->ident_data.model,
___
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: r360412 - head/sys/cam/ata

2020-04-27 Thread Warner Losh
Author: imp
Date: Mon Apr 27 23:43:12 2020
New Revision: 360412
URL: https://svnweb.freebsd.org/changeset/base/360412

Log:
  Convert rotating to a flag bit.
  
  Move rotating to a flag bit. Add bit definitions for it. Create a
  compat sysctl for it.

Modified:
  head/sys/cam/ata/ata_da.c

Modified: head/sys/cam/ata/ata_da.c
==
--- head/sys/cam/ata/ata_da.c   Mon Apr 27 23:43:08 2020(r360411)
+++ head/sys/cam/ata/ata_da.c   Mon Apr 27 23:43:12 2020(r360412)
@@ -110,7 +110,8 @@ typedef enum {
ADA_FLAG_DIRTY  = 0x0020,
ADA_FLAG_CAN_NCQ_TRIM   = 0x0040,   /* CAN_TRIM also set */
ADA_FLAG_PIM_ATA_EXT= 0x0080,
-   ADA_FLAG_UNMAPPEDIO = 0x0100
+   ADA_FLAG_UNMAPPEDIO = 0x0100,
+   ADA_FLAG_ROTATING   = 0x0200
 } ada_flags;
 #define ADA_FLAG_STRING\
"\020"  \
@@ -137,7 +138,8 @@ typedef enum {
"\026DIRTY" \
"\027CAN_NCQ_TRIM"  \
"\030PIM_ATA_EXT"   \
-   "\031UNMAPPEDIO"
+   "\031UNMAPPEDIO"\
+   "\032ROTATING"
 
 typedef enum {
ADA_Q_NONE  = 0x00,
@@ -266,7 +268,6 @@ struct ada_softc {
int  trim_max_ranges;
int  read_ahead;
int  write_cache;
-   int  rotating;
 #ifdef CAM_TEST_FAILURE
int  force_read_error;
int  force_write_error;
@@ -1516,9 +1517,6 @@ adasysctlinit(void *context, int pending)
SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree),
OID_AUTO, "write_cache", CTLFLAG_RW | CTLFLAG_MPSAFE,
&softc->write_cache, 0, "Enable disk write cache.");
-   SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree),
-   OID_AUTO, "rotating", CTLFLAG_RD | CTLFLAG_MPSAFE,
-   &softc->rotating, 0, "Rotating media");
SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree),
OID_AUTO, "zone_mode",
CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT,
@@ -1551,6 +1549,10 @@ adasysctlinit(void *context, int pending)
OID_AUTO, "unmapped_io", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE,
&softc->flags, (u_int)ADA_FLAG_UNMAPPEDIO, adabitsysctl, "I",
"Unmapped I/O support *DEPRECATED* gone in FreeBSD 14");
+   SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree),
+   OID_AUTO, "rotating", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE,
+   &softc->flags, (u_int)ADA_FLAG_ROTATING, adabitsysctl, "I",
+   "Rotating media *DEPRECATED* gone in FreeBSD 14");
 
 #ifdef CAM_TEST_FAILURE
/*
@@ -1873,11 +1875,12 @@ adaregister(struct cam_periph *periph, void *arg)
 
/* Disable queue sorting for non-rotational media by default. */
if (cgd->ident_data.media_rotation_rate == ATA_RATE_NON_ROTATING) {
-   softc->rotating = 0;
+   softc->flags &= ~ADA_FLAG_ROTATING;
} else {
-   softc->rotating = 1;
+   softc->flags |= ADA_FLAG_ROTATING;
}
-   cam_iosched_set_sort_queue(softc->cam_iosched,  softc->rotating ? -1 : 
0);
+   cam_iosched_set_sort_queue(softc->cam_iosched,
+   (softc->flags & ADA_FLAG_ROTATING) ? -1 : 0);
softc->disk = disk_alloc();
adasetgeom(softc, cgd);
softc->disk->d_devstat = devstat_new_entry(periph->periph_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: r360409 - head/sys/cam/scsi

2020-04-27 Thread Warner Losh
Author: imp
Date: Mon Apr 27 23:39:32 2020
New Revision: 360409
URL: https://svnweb.freebsd.org/changeset/base/360409

Log:
  Change the flags back to an enum
  
  This was changed in the review process for the flags sysctl. The
  reasons for the change are no longer valid as the code changed after
  that. Cast the one place where it might make a difference (but I don't
  think it does).  This restores the ability to see flags for softc in
  gdb.

Modified:
  head/sys/cam/scsi/scsi_da.c

Modified: head/sys/cam/scsi/scsi_da.c
==
--- head/sys/cam/scsi/scsi_da.c Mon Apr 27 23:17:19 2020(r360408)
+++ head/sys/cam/scsi/scsi_da.c Mon Apr 27 23:39:32 2020(r360409)
@@ -342,7 +342,7 @@ struct da_softc {
LIST_HEAD(, ccb_hdr) pending_ccbs;
int  refcount;  /* Active xpt_action() calls */
da_state state;
-   u_intflags;
+   da_flags flags;
da_quirks quirks;
int  minimum_cmd_size;
int  error_inject;
@@ -2646,7 +2646,7 @@ daflagssysctl(SYSCTL_HANDLER_ARGS)
 
sbuf_new_for_sysctl(&sbuf, NULL, 0, req);
if (softc->flags != 0)
-   sbuf_printf(&sbuf, "0x%b", softc->flags, DA_FLAG_STRING);
+   sbuf_printf(&sbuf, "0x%b", (unsigned)softc->flags, 
DA_FLAG_STRING);
else
sbuf_printf(&sbuf, "0");
error = sbuf_finish(&sbuf);
___
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: r360408 - in head: share/man/man4 sys/dev/cxgbe/tom sys/kern sys/netinet sys/sys

2020-04-27 Thread John Baldwin
Author: jhb
Date: Mon Apr 27 23:17:19 2020
New Revision: 360408
URL: https://svnweb.freebsd.org/changeset/base/360408

Log:
  Initial support for kernel offload of TLS receive.
  
  - Add a new TCP_RXTLS_ENABLE socket option to set the encryption and
authentication algorithms and keys as well as the initial sequence
number.
  
  - When reading from a socket using KTLS receive, applications must use
recvmsg().  Each successful call to recvmsg() will return a single
TLS record.  A new TCP control message, TLS_GET_RECORD, will contain
the TLS record header of the decrypted record.  The regular message
buffer passed to recvmsg() will receive the decrypted payload.  This
is similar to the interface used by Linux's KTLS RX except that
Linux does not return the full TLS header in the control message.
  
  - Add plumbing to the TOE KTLS interface to request either transmit
or receive KTLS sessions.
  
  - When a socket is using receive KTLS, redirect reads from
soreceive_stream() into soreceive_generic().
  
  - Note that this interface is currently only defined for TLS 1.1 and
1.2, though I believe we will be able to reuse the same interface
and structures for 1.3.

Modified:
  head/share/man/man4/tcp.4
  head/sys/dev/cxgbe/tom/t4_tom.c
  head/sys/kern/uipc_ktls.c
  head/sys/kern/uipc_socket.c
  head/sys/netinet/tcp.h
  head/sys/netinet/tcp_offload.c
  head/sys/netinet/tcp_offload.h
  head/sys/netinet/tcp_usrreq.c
  head/sys/netinet/toecore.c
  head/sys/netinet/toecore.h
  head/sys/sys/ktls.h

Modified: head/share/man/man4/tcp.4
==
--- head/share/man/man4/tcp.4   Mon Apr 27 22:50:08 2020(r360407)
+++ head/share/man/man4/tcp.4   Mon Apr 27 23:17:19 2020(r360408)
@@ -34,7 +34,7 @@
 .\" From: @(#)tcp.48.1 (Berkeley) 6/5/93
 .\" $FreeBSD$
 .\"
-.Dd April 16, 2020
+.Dd April 27, 2020
 .Dt TCP 4
 .Os
 .Sh NAME
@@ -319,14 +319,11 @@ control message.
 The payload of this control message is a single byte holding the desired
 TLS record type.
 .Pp
-Data read from this socket will still be encrypted and must be parsed by
-a TLS-aware consumer.
-.Pp
-At present, only a single key may be set on a socket.
+At present, only a single transmit key may be set on a socket.
 As such, users of this option must disable rekeying.
 .It Dv TCP_TXTLS_MODE
-The integer argument can be used to get or set the current TLS mode of a
-socket.
+The integer argument can be used to get or set the current TLS transmit mode
+of a socket.
 Setting the mode can only used to toggle between software and NIC TLS after
 TLS has been initially enabled via the
 .Dv TCP_TXTLS_ENABLE
@@ -344,6 +341,33 @@ TLS records are encrypted by the network interface car
 .It Dv TCP_TLS_MODE_TOE
 TLS records are encrypted by the NIC using a TCP offload engine (TOE).
 .El
+.It Dv TCP_RXTLS_ENABLE
+Enable in-kernel TLS for data read from this socket.
+The
+.Vt struct tls_so_enable
+argument defines the encryption and authentication algorithms and keys
+used to decrypt the socket data.
+.Pp
+Each received TLS record must be read from the socket using
+.Xr recvmsg 2 .
+Each received TLS record will contain a
+.Dv TLS_GET_RECORD
+control message along with the decrypted payload.
+The control message contains a
+.Vt struct tls_get_record
+which includes fields from the TLS record header.
+If a corrupted TLS record is received,
+recvmsg 2
+will fail with
+.Dv EBADMSG .
+.Pp
+At present, only a single receive key may be set on a socket.
+As such, users of this option must disable rekeying.
+.It Dv TCP_RXTLS_MODE
+The integer argument can be used to get the current TLS receive mode
+of a socket.
+The available modes are the same as for
+.Dv TCP_TXTLS_MODE .
 .El
 .Pp
 The option level for the

Modified: head/sys/dev/cxgbe/tom/t4_tom.c
==
--- head/sys/dev/cxgbe/tom/t4_tom.c Mon Apr 27 22:50:08 2020
(r360407)
+++ head/sys/dev/cxgbe/tom/t4_tom.c Mon Apr 27 23:17:19 2020
(r360408)
@@ -40,6 +40,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#ifdef KERN_TLS
+#include 
+#endif
 #include 
 #include 
 #include 
@@ -814,12 +817,15 @@ t4_tcp_info(struct toedev *tod, struct tcpcb *tp, stru
 #ifdef KERN_TLS
 static int
 t4_alloc_tls_session(struct toedev *tod, struct tcpcb *tp,
-struct ktls_session *tls)
+struct ktls_session *tls, int direction)
 {
struct toepcb *toep = tp->t_toe;
 
INP_WLOCK_ASSERT(tp->t_inpcb);
MPASS(tls != NULL);
+
+   if (direction != KTLS_TX)
+   return (EOPNOTSUPP);
 
return (tls_alloc_ktls(toep, tls));
 }

Modified: head/sys/kern/uipc_ktls.c
==
--- head/sys/kern/uipc_ktls.c   Mon Apr 27 22:50:08 2020(r360407)
+++ head/sys/kern/uipc_ktls.c   Mon Apr 27 23:17:19 2020  

svn commit: r360407 - in stable: 11/usr.bin/diff 11/usr.bin/diff/tests 12/usr.bin/diff 12/usr.bin/diff/tests

2020-04-27 Thread Kyle Evans
Author: kevans
Date: Mon Apr 27 22:50:08 2020
New Revision: 360407
URL: https://svnweb.freebsd.org/changeset/base/360407

Log:
  MFC r357875: diff: fix segfault with --tabsize and no/malformed argument
  
  --tabsize was previously listed as optional_argument, but didn't account for
  the optionality of it in the argument handling. This is irrelevant -- the
  manpage doesn't indicate that the argument is optional, and indeed there's
  no clear interpretation of omitting the argument because there's no other
  side effect of --tabsize.
  
  The "malformed" argument part of the header on this message is simply
  referring to usage like this:
  
  % diff --tabsize 4 A B
  
  With an optional_argument, the argument must be attached to the parameter
  directly (e.g. --tabsize=4), so the argument is effectively NULL with the
  above invocation as if no argument had been passed.
  
  PR:   243974

Modified:
  stable/11/usr.bin/diff/diff.1
  stable/11/usr.bin/diff/diff.c
  stable/11/usr.bin/diff/tests/diff_test.sh
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/usr.bin/diff/diff.1
  stable/12/usr.bin/diff/diff.c
  stable/12/usr.bin/diff/tests/diff_test.sh
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/usr.bin/diff/diff.1
==
--- stable/11/usr.bin/diff/diff.1   Mon Apr 27 22:43:24 2020
(r360406)
+++ stable/11/usr.bin/diff/diff.1   Mon Apr 27 22:50:08 2020
(r360407)
@@ -30,7 +30,7 @@
 .\" @(#)diff.1 8.1 (Berkeley) 6/30/93
 .\" $FreeBSD$
 .\"
-.Dd August 18, 2018
+.Dd April 27, 2020
 .Dt DIFF 1
 .Os
 .Sh NAME
@@ -60,7 +60,7 @@
 .Op Fl -starting-file
 .Op Fl -speed-large-files
 .Op Fl -strip-trailing-cr
-.Op Fl -tabsize
+.Op Fl -tabsize Ar number
 .Op Fl -text
 .Op Fl -unified
 .Op Fl I Ar pattern | Fl -ignore-matching-lines Ar pattern
@@ -88,7 +88,7 @@
 .Op Fl -speed-large-files
 .Op Fl -starting-file
 .Op Fl -strip-trailing-cr
-.Op Fl -tabsize
+.Op Fl -tabsize Ar number
 .Op Fl -text
 .Fl C Ar number | -context Ar number
 .Ar file1 file2
@@ -113,7 +113,7 @@
 .Op Fl -speed-large-files
 .Op Fl -starting-file
 .Op Fl -strip-trailing-cr
-.Op Fl -tabsize
+.Op Fl -tabsize Ar number
 .Op Fl -text
 .Fl D Ar string | Fl -ifdef Ar string
 .Ar file1 file2
@@ -139,7 +139,7 @@
 .Op Fl -speed-large-files
 .Op Fl -starting-file
 .Op Fl -strip-trailing-cr
-.Op Fl -tabsize
+.Op Fl -tabsize Ar number
 .Op Fl -text
 .Fl U Ar number | Fl -unified Ar number
 .Ar file1 file2
@@ -170,7 +170,7 @@
 .Op Fl -show-c-function
 .Op Fl -speed-large-files
 .Op Fl -strip-trailing-cr
-.Op Fl -tabsize
+.Op Fl -tabsize Ar number
 .Op Fl -text
 .Op Fl -unidirectional-new-file
 .Op Fl -unified

Modified: stable/11/usr.bin/diff/diff.c
==
--- stable/11/usr.bin/diff/diff.c   Mon Apr 27 22:43:24 2020
(r360406)
+++ stable/11/usr.bin/diff/diff.c   Mon Apr 27 22:50:08 2020
(r360407)
@@ -90,7 +90,7 @@ static struct option longopts[] = {
{ "no-ignore-file-name-case",   no_argument,NULL,   
OPT_NO_IGN_FN_CASE },
{ "normal", no_argument,NULL,   
OPT_NORMAL },
{ "strip-trailing-cr",  no_argument,NULL,   
OPT_STRIPCR },
-   { "tabsize",optional_argument,  NULL,   
OPT_TSIZE },
+   { "tabsize",required_argument,  NULL,   
OPT_TSIZE },
{ "changed-group-format",   required_argument,  NULL,   
OPT_CHANGED_GROUP_FORMAT},
{ NULL, 0,  0,  '\0'}
 };

Modified: stable/11/usr.bin/diff/tests/diff_test.sh
==
--- stable/11/usr.bin/diff/tests/diff_test.sh   Mon Apr 27 22:43:24 2020
(r360406)
+++ stable/11/usr.bin/diff/tests/diff_test.sh   Mon Apr 27 22:50:08 2020
(r360407)
@@ -10,6 +10,7 @@ atf_test_case side_by_side
 atf_test_case brief_format
 atf_test_case b230049
 atf_test_case Bflag
+atf_test_case tabsize
 
 simple_body()
 {
@@ -166,6 +167,16 @@ Bflag_body()
atf_check -s exit:1 -o file:"$(atf_get_srcdir)/Bflag_F.out" diff -B E F
 }
 
+tabsize_body()
+{
+   printf "\tA\n" > A
+   printf "\tB\n" > B
+
+   atf_check -s exit:1 \
+   -o inline:"1c1\n<  A\n---\n>  B\n" \
+   diff -t --tabsize 1 A B
+}
+
 atf_init_test_cases()
 {
atf_add_test_case simple
@@ -178,4 +189,5 @@ atf_init_test_cases()
atf_add_test_case brief_format
atf_add_test_case b230049
atf_add_test_case Bflag
+   atf_add_test_case tabsize
 }
___
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.

svn commit: r360407 - in stable: 11/usr.bin/diff 11/usr.bin/diff/tests 12/usr.bin/diff 12/usr.bin/diff/tests

2020-04-27 Thread Kyle Evans
Author: kevans
Date: Mon Apr 27 22:50:08 2020
New Revision: 360407
URL: https://svnweb.freebsd.org/changeset/base/360407

Log:
  MFC r357875: diff: fix segfault with --tabsize and no/malformed argument
  
  --tabsize was previously listed as optional_argument, but didn't account for
  the optionality of it in the argument handling. This is irrelevant -- the
  manpage doesn't indicate that the argument is optional, and indeed there's
  no clear interpretation of omitting the argument because there's no other
  side effect of --tabsize.
  
  The "malformed" argument part of the header on this message is simply
  referring to usage like this:
  
  % diff --tabsize 4 A B
  
  With an optional_argument, the argument must be attached to the parameter
  directly (e.g. --tabsize=4), so the argument is effectively NULL with the
  above invocation as if no argument had been passed.
  
  PR:   243974

Modified:
  stable/12/usr.bin/diff/diff.1
  stable/12/usr.bin/diff/diff.c
  stable/12/usr.bin/diff/tests/diff_test.sh
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/usr.bin/diff/diff.1
  stable/11/usr.bin/diff/diff.c
  stable/11/usr.bin/diff/tests/diff_test.sh
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/usr.bin/diff/diff.1
==
--- stable/12/usr.bin/diff/diff.1   Mon Apr 27 22:43:24 2020
(r360406)
+++ stable/12/usr.bin/diff/diff.1   Mon Apr 27 22:50:08 2020
(r360407)
@@ -30,7 +30,7 @@
 .\" @(#)diff.1 8.1 (Berkeley) 6/30/93
 .\" $FreeBSD$
 .\"
-.Dd February 7, 2020
+.Dd April 27, 2020
 .Dt DIFF 1
 .Os
 .Sh NAME
@@ -60,7 +60,7 @@
 .Op Fl -starting-file
 .Op Fl -speed-large-files
 .Op Fl -strip-trailing-cr
-.Op Fl -tabsize
+.Op Fl -tabsize Ar number
 .Op Fl -text
 .Op Fl -unified
 .Op Fl I Ar pattern | Fl -ignore-matching-lines Ar pattern
@@ -88,7 +88,7 @@
 .Op Fl -speed-large-files
 .Op Fl -starting-file
 .Op Fl -strip-trailing-cr
-.Op Fl -tabsize
+.Op Fl -tabsize Ar number
 .Op Fl -text
 .Fl C Ar number | -context Ar number
 .Ar file1 file2
@@ -113,7 +113,7 @@
 .Op Fl -speed-large-files
 .Op Fl -starting-file
 .Op Fl -strip-trailing-cr
-.Op Fl -tabsize
+.Op Fl -tabsize Ar number
 .Op Fl -text
 .Fl D Ar string | Fl -ifdef Ar string
 .Ar file1 file2
@@ -139,7 +139,7 @@
 .Op Fl -speed-large-files
 .Op Fl -starting-file
 .Op Fl -strip-trailing-cr
-.Op Fl -tabsize
+.Op Fl -tabsize Ar number
 .Op Fl -text
 .Fl U Ar number | Fl -unified Ar number
 .Ar file1 file2
@@ -170,7 +170,7 @@
 .Op Fl -show-c-function
 .Op Fl -speed-large-files
 .Op Fl -strip-trailing-cr
-.Op Fl -tabsize
+.Op Fl -tabsize Ar number
 .Op Fl -text
 .Op Fl -unidirectional-new-file
 .Op Fl -unified
@@ -192,7 +192,7 @@
 .Op --no-ignore-file-name-case
 .Op --strip-trailing-cr
 .Op --suppress-common-lines
-.Op --tabsize
+.Op --tabsize Ar number
 .Op --text
 .Op --width
 .Fl y | Fl -side-by-side

Modified: stable/12/usr.bin/diff/diff.c
==
--- stable/12/usr.bin/diff/diff.c   Mon Apr 27 22:43:24 2020
(r360406)
+++ stable/12/usr.bin/diff/diff.c   Mon Apr 27 22:50:08 2020
(r360407)
@@ -93,7 +93,7 @@ static struct option longopts[] = {
{ "no-ignore-file-name-case",   no_argument,NULL,   
OPT_NO_IGN_FN_CASE },
{ "normal", no_argument,NULL,   
OPT_NORMAL },
{ "strip-trailing-cr",  no_argument,NULL,   
OPT_STRIPCR },
-   { "tabsize",optional_argument,  NULL,   
OPT_TSIZE },
+   { "tabsize",required_argument,  NULL,   
OPT_TSIZE },
{ "changed-group-format",   required_argument,  NULL,   
OPT_CHANGED_GROUP_FORMAT},
{ "suppress-common-lines",  no_argument,NULL,   
OPT_SUPPRESS_COMMON },
{ NULL, 0,  0,  '\0'}

Modified: stable/12/usr.bin/diff/tests/diff_test.sh
==
--- stable/12/usr.bin/diff/tests/diff_test.sh   Mon Apr 27 22:43:24 2020
(r360406)
+++ stable/12/usr.bin/diff/tests/diff_test.sh   Mon Apr 27 22:50:08 2020
(r360407)
@@ -10,6 +10,7 @@ atf_test_case side_by_side
 atf_test_case brief_format
 atf_test_case b230049
 atf_test_case Bflag
+atf_test_case tabsize
 atf_test_case conflicting_format
 
 simple_body()
@@ -163,6 +164,16 @@ Bflag_body()
atf_check -s exit:1 -o file:"$(atf_get_srcdir)/Bflag_F.out" diff -B E F
 }
 
+tabsize_body()
+{
+   printf "\tA\n" > A
+   printf "\tB\n" > B
+
+   atf_check -s exit:1 \
+   -o inline:"1c1\n<  A\n---\n>  B\n" \
+   diff -t --tabsize 1 A B
+}
+
 conflicting_format_body()
 {
printf "\tA\n" > A
@@ -189,5 +200,6 @@ atf_init_test_cases()
atf_add_te

svn commit: r360406 - in stable: 11/lib/libc/sys 12/lib/libc/sys

2020-04-27 Thread Kyle Evans
Author: kevans
Date: Mon Apr 27 22:43:24 2020
New Revision: 360406
URL: https://svnweb.freebsd.org/changeset/base/360406

Log:
  MFC r360182-r360183: kqueue(2): add note about EV_RECEIPT
  
  r360182:
  kqueue(2): add a note about EV_RECEIPT
  
  In the below-referenced PR, a case is attached of a simple reproducer that
  exhibits suboptimal behavior: EVFILT_READ and EVFILT_WRITE being set in the
  same kevent(2) call will only honor the first one. This is, in-fact, how
  it's supposed to work.
  
  A read of the manpage leads me to believe we could be more clear about this;
  right now there's a logical leap to make in the relevant statement: "When
  passed as input, it forces EV_ERROR to always be returned." -- the logical
  leap being that this indicates the caller should have allocated space for
  the change to be returned with EV_ERROR indicated in the events, or
  subsequent filters will get dropped on the floor.
  
  Another possible workaround that accomplishes similar effect without needing
  space for all events is just setting EV_RECEIPT on the final change being
  passed in; if any errored before it, the kqueue would not be drained. If we
  made it to the final change with EV_RECEIPT set, then we would return that
  one with EV_ERROR and still not drain the kqueue. This would seem to not be
  all that advisable.
  
  r360183:
  kqueue(2): de-vandalize the random sentence in the middle
  
  A last minute change appears to have inadvertently vandalized unrelated
  parts of the manpage with the date. =-(
  
  PR:   229741

Modified:
  stable/11/lib/libc/sys/kqueue.2
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/lib/libc/sys/kqueue.2
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/lib/libc/sys/kqueue.2
==
--- stable/11/lib/libc/sys/kqueue.2 Mon Apr 27 22:34:45 2020
(r360405)
+++ stable/11/lib/libc/sys/kqueue.2 Mon Apr 27 22:43:24 2020
(r360406)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 27, 2018
+.Dd April 21, 2020
 .Dt KQUEUE 2
 .Os
 .Sh NAME
@@ -220,6 +220,11 @@ to always be returned.
 When a filter is successfully added the
 .Va data
 field will be zero.
+Note that if this flag is encountered and there is no remaining space in
+.Fa eventlist
+to hold the
+.Dv EV_ERROR
+event, then subsequent changes will not get processed.
 .It Dv EV_ONESHOT
 Causes the event to return only the first occurrence of the filter
 being triggered.
___
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: r360406 - in stable: 11/lib/libc/sys 12/lib/libc/sys

2020-04-27 Thread Kyle Evans
Author: kevans
Date: Mon Apr 27 22:43:24 2020
New Revision: 360406
URL: https://svnweb.freebsd.org/changeset/base/360406

Log:
  MFC r360182-r360183: kqueue(2): add note about EV_RECEIPT
  
  r360182:
  kqueue(2): add a note about EV_RECEIPT
  
  In the below-referenced PR, a case is attached of a simple reproducer that
  exhibits suboptimal behavior: EVFILT_READ and EVFILT_WRITE being set in the
  same kevent(2) call will only honor the first one. This is, in-fact, how
  it's supposed to work.
  
  A read of the manpage leads me to believe we could be more clear about this;
  right now there's a logical leap to make in the relevant statement: "When
  passed as input, it forces EV_ERROR to always be returned." -- the logical
  leap being that this indicates the caller should have allocated space for
  the change to be returned with EV_ERROR indicated in the events, or
  subsequent filters will get dropped on the floor.
  
  Another possible workaround that accomplishes similar effect without needing
  space for all events is just setting EV_RECEIPT on the final change being
  passed in; if any errored before it, the kqueue would not be drained. If we
  made it to the final change with EV_RECEIPT set, then we would return that
  one with EV_ERROR and still not drain the kqueue. This would seem to not be
  all that advisable.
  
  r360183:
  kqueue(2): de-vandalize the random sentence in the middle
  
  A last minute change appears to have inadvertently vandalized unrelated
  parts of the manpage with the date. =-(
  
  PR:   229741

Modified:
  stable/12/lib/libc/sys/kqueue.2
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/lib/libc/sys/kqueue.2
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/lib/libc/sys/kqueue.2
==
--- stable/12/lib/libc/sys/kqueue.2 Mon Apr 27 22:34:45 2020
(r360405)
+++ stable/12/lib/libc/sys/kqueue.2 Mon Apr 27 22:43:24 2020
(r360406)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 27, 2018
+.Dd April 21, 2020
 .Dt KQUEUE 2
 .Os
 .Sh NAME
@@ -233,6 +233,11 @@ to always be returned.
 When a filter is successfully added the
 .Va data
 field will be zero.
+Note that if this flag is encountered and there is no remaining space in
+.Fa eventlist
+to hold the
+.Dv EV_ERROR
+event, then subsequent changes will not get processed.
 .It Dv EV_ONESHOT
 Causes the event to return only the first occurrence of the filter
 being triggered.
___
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: r360405 - stable/11/usr.bin/diff

2020-04-27 Thread Kyle Evans
Author: kevans
Date: Mon Apr 27 22:34:45 2020
New Revision: 360405
URL: https://svnweb.freebsd.org/changeset/base/360405

Log:
  MFC r356723-r356725: diff(1) return value checks
  
  r356723:
  mkstemp returns -1
  
  r356724:
  asprintf returns -1, not an arbitrary value < 0. Also upon error the
  (very sloppy specification) leaves an undefined value in *ret, so it is
  wrong to inspect it, the error condition is enough.
  
  r356725:
  When system calls indicate an error they return -1, not some arbitrary
  value < 0.  errno is only updated in this case.

Modified:
  stable/11/usr.bin/diff/diff.c
  stable/11/usr.bin/diff/diffreg.c
  stable/11/usr.bin/diff/xmalloc.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/diff/diff.c
==
--- stable/11/usr.bin/diff/diff.c   Mon Apr 27 22:33:32 2020
(r360404)
+++ stable/11/usr.bin/diff/diff.c   Mon Apr 27 22:34:45 2020
(r360405)
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff.c,v 1.65 2015/12/29 19:04:46 gsoares Exp $   */
+/* $OpenBSD: diff.c,v 1.67 2019/06/28 13:35:00 deraadt Exp $   */
 
 /*
  * Copyright (c) 2003 Todd C. Miller 
@@ -316,12 +316,12 @@ main(int argc, char **argv)
} else {
if (S_ISDIR(stb1.st_mode)) {
argv[0] = splice(argv[0], argv[1]);
-   if (stat(argv[0], &stb1) < 0)
+   if (stat(argv[0], &stb1) == -1)
err(2, "%s", argv[0]);
}
if (S_ISDIR(stb2.st_mode)) {
argv[1] = splice(argv[1], argv[0]);
-   if (stat(argv[1], &stb2) < 0)
+   if (stat(argv[1], &stb2) == -1)
err(2, "%s", argv[1]);
}
print_status(diffreg(argv[0], argv[1], dflags, 1), argv[0],

Modified: stable/11/usr.bin/diff/diffreg.c
==
--- stable/11/usr.bin/diff/diffreg.cMon Apr 27 22:33:32 2020
(r360404)
+++ stable/11/usr.bin/diff/diffreg.cMon Apr 27 22:34:45 2020
(r360405)
@@ -1,4 +1,4 @@
-/* $OpenBSD: diffreg.c,v 1.91 2016/03/01 20:57:35 natano Exp $ */
+/* $OpenBSD: diffreg.c,v 1.93 2019/06/28 13:35:00 deraadt Exp $*/
 
 /*
  * Copyright (C) Caldera International Inc.  2001-2002.
@@ -287,7 +287,7 @@ diffreg(char *file1, char *file2, int flags, int capsi
else {
if (!S_ISREG(stb1.st_mode)) {
if ((f1 = opentemp(file1)) == NULL ||
-   fstat(fileno(f1), &stb1) < 0) {
+   fstat(fileno(f1), &stb1) == -1) {
warn("%s", file1);
status |= 2;
goto closem;
@@ -308,7 +308,7 @@ diffreg(char *file1, char *file2, int flags, int capsi
else {
if (!S_ISREG(stb2.st_mode)) {
if ((f2 = opentemp(file2)) == NULL ||
-   fstat(fileno(f2), &stb2) < 0) {
+   fstat(fileno(f2), &stb2) == -1) {
warn("%s", file2);
status |= 2;
goto closem;
@@ -515,12 +515,12 @@ opentemp(const char *f)
 
if (strcmp(f, "-") == 0)
ifd = STDIN_FILENO;
-   else if ((ifd = open(f, O_RDONLY, 0644)) < 0)
+   else if ((ifd = open(f, O_RDONLY, 0644)) == -1)
return (NULL);
 
(void)strlcpy(tempfile, _PATH_TMP "/diff.", sizeof(tempfile));
 
-   if ((ofd = mkstemp(tempfile)) < 0) {
+   if ((ofd = mkstemp(tempfile)) == -1) {
close(ifd);
return (NULL);
}
@@ -1011,7 +1011,7 @@ preadline(int fd, size_t rlen, off_t off)
ssize_t nr;
 
line = xmalloc(rlen + 1);
-   if ((nr = pread(fd, line, rlen, off)) < 0)
+   if ((nr = pread(fd, line, rlen, off)) == -1)
err(2, "preadline");
if (nr > 0 && line[nr-1] == '\n')
nr--;

Modified: stable/11/usr.bin/diff/xmalloc.c
==
--- stable/11/usr.bin/diff/xmalloc.cMon Apr 27 22:33:32 2020
(r360404)
+++ stable/11/usr.bin/diff/xmalloc.cMon Apr 27 22:34:45 2020
(r360405)
@@ -1,4 +1,4 @@
-/* $OpenBSD: xmalloc.c,v 1.9 2015/11/17 18:25:02 tobias Exp $ */
+/* $OpenBSD: xmalloc.c,v 1.10 2019/06/28 05:44:09 deraadt Exp $ */
 /*
  * Author: Tatu Ylonen 
  * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland
@@ -81,7 +81,7 @@ xasprintf(char **ret, const char *fmt, ...)
i = vasprintf(ret, fmt, ap);
va_end(ap);
 
-   if (i < 0 || *ret == NULL)
+   if (i == -1)
err(2, "xasprintf");
 
return i;
_

svn commit: r360404 - stable/12/usr.bin/diff

2020-04-27 Thread Kyle Evans
Author: kevans
Date: Mon Apr 27 22:33:32 2020
New Revision: 360404
URL: https://svnweb.freebsd.org/changeset/base/360404

Log:
  MFC r356723-r356725, r357649, r357652: diff(1) catch-up
  
  r356723:
  mkstemp returns -1
  
  r356724:
  asprintf returns -1, not an arbitrary value < 0. Also upon error the
  (very sloppy specification) leaves an undefined value in *ret, so it is
  wrong to inspect it, the error condition is enough.
  
  r356725:
  When system calls indicate an error they return -1, not some arbitrary
  value < 0.  errno is only updated in this case.
  
  r357649:
  Update diff(1) TODO removing what has been implemented
  
  r357652:
  Fix most of the style warnings

Modified:
  stable/12/usr.bin/diff/TODO
  stable/12/usr.bin/diff/diff.1
  stable/12/usr.bin/diff/diff.c
  stable/12/usr.bin/diff/diffreg.c
  stable/12/usr.bin/diff/xmalloc.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.bin/diff/TODO
==
--- stable/12/usr.bin/diff/TODO Mon Apr 27 22:32:16 2020(r360403)
+++ stable/12/usr.bin/diff/TODO Mon Apr 27 22:33:32 2020(r360404)
@@ -1,9 +1,3 @@
--y:
-  * soc implemented it via calling sdiff directly, but some options are
-  incompatible so it is fragile
-  * just recommend the user to run sdiff directly and do not implement it
-  * make a libsdiff and use that directly to avoid duplicating the code
-
 to be implemented:
 --horizon-lines
 --ignore-tab-expansion
@@ -13,5 +7,3 @@ Will probably be not implemented:
 --GTYPE-group-format (partially implement - minimal)
 --LTYPE-line-format
 --help (We have a manpage already)
---suppress-common-lines: depends on -y (won't be implemented, as it conflicts
-the way sdiff expects it and in any case we have sdiff for that feature)

Modified: stable/12/usr.bin/diff/diff.1
==
--- stable/12/usr.bin/diff/diff.1   Mon Apr 27 22:32:16 2020
(r360403)
+++ stable/12/usr.bin/diff/diff.1   Mon Apr 27 22:33:32 2020
(r360404)
@@ -30,7 +30,7 @@
 .\" @(#)diff.1 8.1 (Berkeley) 6/30/93
 .\" $FreeBSD$
 .\"
-.Dd February 07, 2020
+.Dd February 7, 2020
 .Dt DIFF 1
 .Os
 .Sh NAME
@@ -232,7 +232,7 @@ are marked with
 those added to
 .Ar file2
 are marked
-.Sq \+\ \& .
+.Sq +\ \& .
 Lines which are changed from one file to the other are marked in
 both files with
 .Sq !\ \& .
@@ -300,11 +300,12 @@ However, unlike with
 all lines to be changed (added and/or removed) are present in
 a single section.
 .It Fl y Fl -side-by-side
-Output in two columns with a marker between them. The marker can be one 
+Output in two columns with a marker between them.
+The marker can be one
 of the following:
 .Pp
 .Bl -tag -width Ds -offset indent -compact
-.It space 
+.It space
 Corresponding lines are identical.
 .It '|'
 Corresponding lines are different.
@@ -318,9 +319,7 @@ Files differ and only the second file contains the lin
 Comparison options:
 .Bl -tag -width Ds
 .It Fl a -text
-Treat all files as
-.Tn ASCII
-text.
+Treat all files as ASCII text.
 Normally
 .Nm
 will simply print
@@ -394,7 +393,8 @@ will compare equal to
 .It Fl W Ar number Fl -width Ar number
 Output at most
 .Ar number
-columns when using side by side format. The default value is 130.
+columns when using side by side format.
+The default value is 130.
 .It Fl -changed-group-format Ar GFMT
 Format input groups in the provided
 .Pp
@@ -473,9 +473,8 @@ Binary files which differ,
 common subdirectories, and files which appear in only one directory
 are described as such.
 In directory mode only regular files and directories are compared.
-If a non-regular file such as a device special file or
-.Tn FIFO
-is encountered, a diagnostic message is printed.
+If a non-regular file such as a device special file or FIFO is encountered,
+a diagnostic message is printed.
 .Pp
 If only one of
 .Ar file1
@@ -596,7 +595,7 @@ pairs (where num1 = num2) are abbreviated as a single
 number.
 .Sh FILES
 .Bl -tag -width /tmp/diff. -compact
-.It Pa /tmp/diff. Ns Ar 
+.It Pa /tmp/diff.
 Temporary file used when comparing a device or the standard input.
 Note that the temporary file is unlinked as soon as it is created
 so it will not show up in a directory listing.

Modified: stable/12/usr.bin/diff/diff.c
==
--- stable/12/usr.bin/diff/diff.c   Mon Apr 27 22:32:16 2020
(r360403)
+++ stable/12/usr.bin/diff/diff.c   Mon Apr 27 22:33:32 2020
(r360404)
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff.c,v 1.65 2015/12/29 19:04:46 gsoares Exp $   */
+/* $OpenBSD: diff.c,v 1.67 2019/06/28 13:35:00 deraadt Exp $   */
 
 /*
  * Copyright (c) 2003 Todd C. Miller 
@@ -357,12 +357,12 @@ main(int argc, char **argv)
} else {
if (S_ISDIR(stb1.st_mode)) {
argv[0]

svn commit: r360403 - in stable/12/usr.bin/diff: . tests

2020-04-27 Thread Kyle Evans
Author: kevans
Date: Mon Apr 27 22:32:16 2020
New Revision: 360403
URL: https://svnweb.freebsd.org/changeset/base/360403

Log:
  MFC r360125: diff(1): reject conflicting formatting options
  
  This matches GNU diff(1) behavior and, more importantly, eliminates any
  source of confusion if multiple formatting options are specified.
  
  Note that the committed diff differs slightly from the submitted: I've
  modified it so that we initialize diff_format to something that isn't an
  accepted format option so that we can also reject --normal -c and -c
  --normal, which would've otherwise been accepted because the default was
  --normal. After option parsing we default it to D_NORMAL if it's still
  unset.
  
  PR:   243975

Modified:
  stable/12/usr.bin/diff/diff.c
  stable/12/usr.bin/diff/diff.h
  stable/12/usr.bin/diff/tests/diff_test.sh
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.bin/diff/diff.c
==
--- stable/12/usr.bin/diff/diff.c   Mon Apr 27 22:31:42 2020
(r360402)
+++ stable/12/usr.bin/diff/diff.c   Mon Apr 27 22:32:16 2020
(r360403)
@@ -100,6 +100,7 @@ static struct option longopts[] = {
 };
 
 void usage(void) __dead2;
+void conflicting_format(void) __dead2;
 void push_excludes(char *);
 void push_ignore_pats(char *);
 void read_excludes_file(char *file);
@@ -120,7 +121,7 @@ main(int argc, char **argv)
prevoptind = 1;
newarg = 1;
diff_context = 3;
-   diff_format = 0;
+   diff_format = D_UNSET;
while ((ch = getopt_long(argc, argv, OPTIONS, longopts, NULL)) != -1) {
switch (ch) {
case '0': case '1': case '2': case '3': case '4':
@@ -141,6 +142,8 @@ main(int argc, char **argv)
break;
case 'C':
case 'c':
+   if (diff_format != D_UNSET)
+   conflicting_format();
cflag = 1;
diff_format = D_CONTEXT;
if (optarg != NULL) {
@@ -154,13 +157,19 @@ main(int argc, char **argv)
dflags |= D_MINIMAL;
break;
case 'D':
+   if (diff_format != D_UNSET)
+   conflicting_format();
diff_format = D_IFDEF;
ifdefname = optarg;
break;
case 'e':
+   if (diff_format != D_UNSET)
+   conflicting_format();
diff_format = D_EDIT;
break;
case 'f':
+   if (diff_format != D_UNSET)
+   conflicting_format();
diff_format = D_REVERSE;
break;
case 'H':
@@ -193,10 +202,12 @@ main(int argc, char **argv)
Nflag = 1;
break;
case 'n':
+   if (diff_format != D_UNSET)
+   conflicting_format();
diff_format = D_NREVERSE;
break;
case 'p':
-   if (diff_format == 0)
+   if (diff_format == D_UNSET)
diff_format = D_CONTEXT;
dflags |= D_PROTOTYPE;
break;
@@ -207,6 +218,8 @@ main(int argc, char **argv)
rflag = 1;
break;
case 'q':
+   if (diff_format != D_UNSET)
+   conflicting_format();
diff_format = D_BRIEF;
break;
case 'S':
@@ -223,6 +236,8 @@ main(int argc, char **argv)
break;
case 'U':
case 'u':
+   if (diff_format != D_UNSET)
+   conflicting_format();
diff_format = D_UNIFIED;
if (optarg != NULL) {
l = strtol(optarg, &ep, 10);
@@ -249,9 +264,13 @@ main(int argc, char **argv)
push_excludes(optarg);
break;
case 'y':
+   if (diff_format != D_UNSET)
+   conflicting_format();
diff_format = D_SIDEBYSIDE;
break;
case OPT_CHANGED_GROUP_FORMAT:
+   if (diff_format != D_UNSET)
+   conflicting_format();
diff_format = D_GFORMAT;
group_format = optarg;
break;
@@ -264,6 +283,8 @@ main(int argc, char **argv)
ignor

svn commit: r360402 - in head/sys: kern netinet sys

2020-04-27 Thread John Baldwin
Author: jhb
Date: Mon Apr 27 22:31:42 2020
New Revision: 360402
URL: https://svnweb.freebsd.org/changeset/base/360402

Log:
  Add the initial sequence number to the TLS enable socket option.
  
  This will be needed for KTLS RX.
  
  Reviewed by:  gallatin
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D24451

Modified:
  head/sys/kern/uipc_ktls.c
  head/sys/netinet/tcp_usrreq.c
  head/sys/sys/ktls.h

Modified: head/sys/kern/uipc_ktls.c
==
--- head/sys/kern/uipc_ktls.c   Mon Apr 27 22:29:24 2020(r360401)
+++ head/sys/kern/uipc_ktls.c   Mon Apr 27 22:31:42 2020(r360402)
@@ -957,6 +957,7 @@ ktls_enable_tx(struct socket *so, struct tls_enable *e
}
 
SOCKBUF_LOCK(&so->so_snd);
+   so->so_snd.sb_tls_seqno = be64dec(en->rec_seq);
so->so_snd.sb_tls_info = tls;
if (tls->mode != TCP_TLS_MODE_SW)
so->so_snd.sb_flags |= SB_TLS_IFNET;

Modified: head/sys/netinet/tcp_usrreq.c
==
--- head/sys/netinet/tcp_usrreq.c   Mon Apr 27 22:29:24 2020
(r360401)
+++ head/sys/netinet/tcp_usrreq.c   Mon Apr 27 22:31:42 2020
(r360402)
@@ -1823,6 +1823,37 @@ CTASSERT(TCP_CA_NAME_MAX <= TCP_LOG_ID_LEN);
 CTASSERT(TCP_LOG_REASON_LEN <= TCP_LOG_ID_LEN);
 #endif
 
+#ifdef KERN_TLS
+static int
+copyin_tls_enable(struct sockopt *sopt, struct tls_enable *tls)
+{
+   struct tls_enable_v0 tls_v0;
+   int error;
+
+   if (sopt->sopt_valsize == sizeof(tls_v0)) {
+   error = sooptcopyin(sopt, &tls_v0, sizeof(tls_v0),
+   sizeof(tls_v0));
+   if (error)
+   return (error);
+   memset(tls, 0, sizeof(*tls));
+   tls->cipher_key = tls_v0.cipher_key;
+   tls->iv = tls_v0.iv;
+   tls->auth_key = tls_v0.auth_key;
+   tls->cipher_algorithm = tls_v0.cipher_algorithm;
+   tls->cipher_key_len = tls_v0.cipher_key_len;
+   tls->iv_len = tls_v0.iv_len;
+   tls->auth_algorithm = tls_v0.auth_algorithm;
+   tls->auth_key_len = tls_v0.auth_key_len;
+   tls->flags = tls_v0.flags;
+   tls->tls_vmajor = tls_v0.tls_vmajor;
+   tls->tls_vminor = tls_v0.tls_vminor;
+   return (0);
+   }
+
+   return (sooptcopyin(sopt, tls, sizeof(*tls), sizeof(*tls)));
+}
+#endif
+
 int
 tcp_default_ctloutput(struct socket *so, struct sockopt *sopt, struct inpcb 
*inp, struct tcpcb *tp)
 {
@@ -2034,8 +2065,7 @@ unlock_and_done:
 #ifdef KERN_TLS
case TCP_TXTLS_ENABLE:
INP_WUNLOCK(inp);
-   error = sooptcopyin(sopt, &tls, sizeof(tls),
-   sizeof(tls));
+   error = copyin_tls_enable(sopt, &tls);
if (error)
break;
error = ktls_enable_tx(so, &tls);

Modified: head/sys/sys/ktls.h
==
--- head/sys/sys/ktls.h Mon Apr 27 22:29:24 2020(r360401)
+++ head/sys/sys/ktls.h Mon Apr 27 22:31:42 2020(r360402)
@@ -99,6 +99,22 @@ struct tls_mac_data {
 #defineTLS_MINOR_VER_THREE 4   /* 3, 4 */
 
 /* For TCP_TXTLS_ENABLE */
+#ifdef _KERNEL
+struct tls_enable_v0 {
+   const uint8_t *cipher_key;
+   const uint8_t *iv;  /* Implicit IV. */
+   const uint8_t *auth_key;
+   int cipher_algorithm;   /* e.g. CRYPTO_AES_CBC */
+   int cipher_key_len;
+   int iv_len;
+   int auth_algorithm; /* e.g. CRYPTO_SHA2_256_HMAC */
+   int auth_key_len;
+   int flags;
+   uint8_t tls_vmajor;
+   uint8_t tls_vminor;
+};
+#endif
+
 struct tls_enable {
const uint8_t *cipher_key;
const uint8_t *iv;  /* Implicit IV. */
@@ -111,6 +127,7 @@ struct tls_enable {
int flags;
uint8_t tls_vmajor;
uint8_t tls_vminor;
+   uint8_t rec_seq[8];
 };
 
 struct tls_session_params {
___
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: r360401 - in stable/12: stand/defaults sys/kern sys/sys

2020-04-27 Thread Kyle Evans
Author: kevans
Date: Mon Apr 27 22:29:24 2020
New Revision: 360401
URL: https://svnweb.freebsd.org/changeset/base/360401

Log:
  MFC r359953, r359980, r35: hostuuid preload
  
  r359953:
  kern uuid: break format validation out into a separate KPI
  
  This new KPI, validate_uuid, strictly validates the formatting of the input
  UUID and, optionally, populates a given struct uuid.
  
  As noted in the header, the key differences are that the new KPI won't
  recognize an empty string as a nil UUID and it won't do any kind of semantic
  validation on it. Also key is that populating a struct uuid is optional, so
  the caller doesn't necessarily need to allocate a bogus one on the stack
  just to validate the string.
  
  This KPI has specifically been broken out in support of D24288, which will
  preload /etc/hostid in loader so that early boot hostuuid users (e.g.
  anything that calls ether_gen_addr) can have a valid hostuuid to work with
  once it's been stashed in /etc/hostid.
  
  r359980:
  validate_uuid: absorb the rest of parse_uuid with a flags arg
  
  This makes the naming annoyance (validate_uuid vs. parse_uuid) less of an
  issue and centralizes all of the functionality into the new KPI while still
  making the extra validation optional. The end-result is all the same as far
  as hostuuid validation-only goes.
  
  r35:
  Preload hostuuid for early-boot use
  
  prison0's hostuuid will get set by the hostid rc script, either after
  generating it and saving it to /etc/hostid or by simply reading /etc/hostid.
  
  Some things (e.g. arbitrary MAC address generation) may use the hostuuid as
  a factor in early boot, so providing a way to read /etc/hostid (if it's
  available) and using it before userland starts up is desirable. The code is
  written such that the preload doesn't *have* to be /etc/hostid, thus not
  assuming that there will be newline at the end of the buffer or even the
  exact shape of the newline. White trailing whitespace/non-printables
  trimmed, the result will be validated as a valid uuid before it's used for
  early boot purposes.
  
  The preload can be turned off with hostuuid_load="NO" in /boot/loader.conf,
  just as other preloads; it's worth noting that this is a 37-byte file, the
  overhead is believed to be generally minimal.
  
  It doesn't seem necessary at this time to be concerned with kern.hostid.
  
  One does wonder if we should consider validating hostuuids coming in
  via jail_set(2); some bits seem to care about uuid form and we bother
  validating format of smbios-provided uuid and in-fact whatever uuid comes
  from /etc/hostid.

Modified:
  stable/12/stand/defaults/loader.conf
  stable/12/sys/kern/kern_jail.c
  stable/12/sys/kern/kern_uuid.c
  stable/12/sys/sys/uuid.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/defaults/loader.conf
==
--- stable/12/stand/defaults/loader.confMon Apr 27 22:27:46 2020
(r360400)
+++ stable/12/stand/defaults/loader.confMon Apr 27 22:29:24 2020
(r360401)
@@ -33,6 +33,11 @@ bitmap_type="splash_image_data" # and place it on the 
 screensave_load="NO"   # Set to YES to load a screensaver module
 screensave_name="green_saver"  # Set to the name of the screensaver module
 
+###  Early hostid configuration 
+hostuuid_load="YES"
+hostuuid_name="/etc/hostid"
+hostuuid_type="hostuuid"
+
 ###  Random number generator configuration  ##
 # See rc.conf(5). The entropy_boot_file config variable must agree with the
 # settings below.

Modified: stable/12/sys/kern/kern_jail.c
==
--- stable/12/sys/kern/kern_jail.c  Mon Apr 27 22:27:46 2020
(r360400)
+++ stable/12/sys/kern/kern_jail.c  Mon Apr 27 22:29:24 2020
(r360401)
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -61,6 +62,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -75,6 +77,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #defineDEFAULT_HOSTUUID"----"
+#definePRISON0_HOSTUUID_MODULE "hostuuid"
 
 MALLOC_DEFINE(M_PRISON, "prison", "Prison structures");
 static MALLOC_DEFINE(M_PRISON_RACCT, "prison_racct", "Prison racct 
structures");
@@ -214,10 +217,38 @@ static unsigned jail_max_af_ips = 255;
 void
 prison0_init(void)
 {
+   uint8_t *file, *data;
+   size_t size;
 
prison0.pr_cpuset = cpuset_ref(thread0.td_cpuset);
prison0.pr_osreldate = osreldate;
strlcpy(prison0.pr_osrelease, osrelease, sizeof(prison0.pr_osrelease));
+
+   /* If we have a preloaded hostuuid, use it. */
+   file = preload_search_by_type(PRISON0_HOSTUUID_MODULE);
+   if (file != NULL) {
+   data = 

svn commit: r360400 - in stable: 11/sys/sys 12/sys/sys

2020-04-27 Thread Kyle Evans
Author: kevans
Date: Mon Apr 27 22:27:46 2020
New Revision: 360400
URL: https://svnweb.freebsd.org/changeset/base/360400

Log:
  MFC r359954: sys/types.h: adjust #endif comment to match reality

Modified:
  stable/12/sys/sys/types.h
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/sys/types.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/sys/sys/types.h
==
--- stable/12/sys/sys/types.h   Mon Apr 27 22:27:35 2020(r360399)
+++ stable/12/sys/sys/types.h   Mon Apr 27 22:27:46 2020(r360400)
@@ -302,7 +302,7 @@ typedef _Bool   bool;
 
 #define offsetof(type, field) __offsetof(type, field)
 
-#endif /* !_KERNEL */
+#endif /* _KERNEL */
 
 /*
  * The following are all things that really shouldn't exist in this header,
___
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: r360400 - in stable: 11/sys/sys 12/sys/sys

2020-04-27 Thread Kyle Evans
Author: kevans
Date: Mon Apr 27 22:27:46 2020
New Revision: 360400
URL: https://svnweb.freebsd.org/changeset/base/360400

Log:
  MFC r359954: sys/types.h: adjust #endif comment to match reality

Modified:
  stable/11/sys/sys/types.h
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/sys/sys/types.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/sys/sys/types.h
==
--- stable/11/sys/sys/types.h   Mon Apr 27 22:27:35 2020(r360399)
+++ stable/11/sys/sys/types.h   Mon Apr 27 22:27:46 2020(r360400)
@@ -291,7 +291,7 @@ typedef _Bool   bool;
 
 #define offsetof(type, field) __offsetof(type, field)
 
-#endif /* !_KERNEL */
+#endif /* _KERNEL */
 
 /*
  * The following are all things that really shouldn't exist in this header,
___
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: r360399 - head/usr.sbin/bhyve

2020-04-27 Thread John Baldwin
Author: jhb
Date: Mon Apr 27 22:27:35 2020
New Revision: 360399
URL: https://svnweb.freebsd.org/changeset/base/360399

Log:
  Update the cached MSI state when any MSI capability register is written.
  
  bhyve uses cached copies of the MSI capability registers to generate
  MSI interrupts for device models.  Previously, these cached fields
  were only set when the MSI capability control register was updated.
  The Linux kernel recently adopted a change to deal with races in MSI
  interrupt delivery that writes to the MSI capability address and data
  registers to alter the destination of MSI interrupts without writing
  to the MSI capability control register.  bhyve was not updating its
  cached registers for these writes and continued to send interrupts
  with the old data value to the old address.  Fix this by recomputing
  the cached values for every write to any MSI capability register.
  
  Reported by:  Jason Tubnor, Ryan Moeller
  Reported by:  Marc Dionne (bisected the Linux kernel commit)
  Reviewed by:  grehan
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D24593

Modified:
  head/usr.sbin/bhyve/pci_emul.c

Modified: head/usr.sbin/bhyve/pci_emul.c
==
--- head/usr.sbin/bhyve/pci_emul.c  Mon Apr 27 22:02:44 2020
(r360398)
+++ head/usr.sbin/bhyve/pci_emul.c  Mon Apr 27 22:27:35 2020
(r360399)
@@ -915,26 +915,26 @@ msicap_cfgwrite(struct pci_devinst *pi, int capoff, in
msgctrl &= ~rwmask;
msgctrl |= val & rwmask;
val = msgctrl;
+   }
+   CFGWRITE(pi, offset, val, bytes);
 
-   addrlo = pci_get_cfgdata32(pi, capoff + 4);
-   if (msgctrl & PCIM_MSICTRL_64BIT)
-   msgdata = pci_get_cfgdata16(pi, capoff + 12);
-   else
-   msgdata = pci_get_cfgdata16(pi, capoff + 8);
+   msgctrl = pci_get_cfgdata16(pi, capoff + 2);
+   addrlo = pci_get_cfgdata32(pi, capoff + 4);
+   if (msgctrl & PCIM_MSICTRL_64BIT)
+   msgdata = pci_get_cfgdata16(pi, capoff + 12);
+   else
+   msgdata = pci_get_cfgdata16(pi, capoff + 8);
 
-   mme = msgctrl & PCIM_MSICTRL_MME_MASK;
-   pi->pi_msi.enabled = msgctrl & PCIM_MSICTRL_MSI_ENABLE ? 1 : 0;
-   if (pi->pi_msi.enabled) {
-   pi->pi_msi.addr = addrlo;
-   pi->pi_msi.msg_data = msgdata;
-   pi->pi_msi.maxmsgnum = 1 << (mme >> 4);
-   } else {
-   pi->pi_msi.maxmsgnum = 0;
-   }
-   pci_lintr_update(pi);
+   mme = msgctrl & PCIM_MSICTRL_MME_MASK;
+   pi->pi_msi.enabled = msgctrl & PCIM_MSICTRL_MSI_ENABLE ? 1 : 0;
+   if (pi->pi_msi.enabled) {
+   pi->pi_msi.addr = addrlo;
+   pi->pi_msi.msg_data = msgdata;
+   pi->pi_msi.maxmsgnum = 1 << (mme >> 4);
+   } else {
+   pi->pi_msi.maxmsgnum = 0;
}
-
-   CFGWRITE(pi, offset, val, bytes);
+   pci_lintr_update(pi);
 }
 
 void
___
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: r360398 - head/sys/net

2020-04-27 Thread Eric Joyner
Author: erj
Date: Mon Apr 27 22:02:44 2020
New Revision: 360398
URL: https://svnweb.freebsd.org/changeset/base/360398

Log:
  iflib: Stop interface before (un)registering VLAN
  
  This patch is intended to solve a specific problem that iavf(4)
  encounters, but what it does can be extended to solve other issues.
  
  To summarize the iavf(4) issue, if the PF driver configures VLAN
  anti-spoof, then the VF driver needs to make sure no untagged traffic is
  sent if a VLAN is configured, and vice-versa. This can be an issue when
  a VLAN is being registered or unregistered, e.g. when a packet may be on
  the ring with a VLAN in it, but the VLANs are being unregistered. This
  can cause that tagged packet to go out and cause an MDD event.
  
  To fix this, include a new interface-dependent function that drivers can
  implement named IFDI_NEEDS_RESTART(). Right now, this function is called
  in iflib_vlan_unregister/register() to determine whether the interface
  needs to be stopped and started when a VLAN is registered or
  unregistered. The default return value of IFDI_NEEDS_RESTART() is true,
  so this fixes the MDD problem that iavf(4) encounters, since the
  interface rings are flushed during a stop/init.
  
  A future change to iavf(4) will implement that function just in case the
  default value changes, and to make it explicit that this interface reset
  is required when a VLAN is added or removed.
  
  Reviewed by:  gallatin@
  MFC after:1 week
  Sponsored by: Intel Corporation
  Differential Revision:https://reviews.freebsd.org/D22086

Modified:
  head/sys/net/ifdi_if.m
  head/sys/net/iflib.c
  head/sys/net/iflib.h

Modified: head/sys/net/ifdi_if.m
==
--- head/sys/net/ifdi_if.m  Mon Apr 27 21:51:22 2020(r360397)
+++ head/sys/net/ifdi_if.m  Mon Apr 27 22:02:44 2020(r360398)
@@ -169,6 +169,12 @@ CODE {
}
return (0);
}
+
+   static bool
+   null_needs_restart(if_ctx_t _ctx __unused, enum iflib_restart_event 
_event __unused)
+   {
+   return (true);
+   }
 };
 
 #
@@ -456,3 +462,8 @@ METHOD int sysctl_int_delay {
 METHOD void debug {
if_ctx_t _ctx;
 } DEFAULT null_void_op;
+
+METHOD bool needs_restart {
+   if_ctx_t _ctx;
+   enum iflib_restart_event _event;
+} DEFAULT null_needs_restart;

Modified: head/sys/net/iflib.c
==
--- head/sys/net/iflib.cMon Apr 27 21:51:22 2020(r360397)
+++ head/sys/net/iflib.cMon Apr 27 22:02:44 2020(r360398)
@@ -4308,10 +4308,13 @@ iflib_vlan_register(void *arg, if_t ifp, uint16_t vtag
return;
 
CTX_LOCK(ctx);
+   /* Driver may need all untagged packets to be flushed */
+   if (IFDI_NEEDS_RESTART(ctx, IFLIB_RESTART_VLAN_CONFIG))
+   iflib_stop(ctx);
IFDI_VLAN_REGISTER(ctx, vtag);
-   /* Re-init to load the changes */
-   if (if_getcapenable(ifp) & IFCAP_VLAN_HWFILTER)
-   iflib_if_init_locked(ctx);
+   /* Re-init to load the changes, if required */
+   if (IFDI_NEEDS_RESTART(ctx, IFLIB_RESTART_VLAN_CONFIG))
+   iflib_init_locked(ctx);
CTX_UNLOCK(ctx);
 }
 
@@ -4327,10 +4330,13 @@ iflib_vlan_unregister(void *arg, if_t ifp, uint16_t vt
return;
 
CTX_LOCK(ctx);
+   /* Driver may need all tagged packets to be flushed */
+   if (IFDI_NEEDS_RESTART(ctx, IFLIB_RESTART_VLAN_CONFIG))
+   iflib_stop(ctx);
IFDI_VLAN_UNREGISTER(ctx, vtag);
-   /* Re-init to load the changes */
-   if (if_getcapenable(ifp) & IFCAP_VLAN_HWFILTER)
-   iflib_if_init_locked(ctx);
+   /* Re-init to load the changes, if required */
+   if (IFDI_NEEDS_RESTART(ctx, IFLIB_RESTART_VLAN_CONFIG))
+   iflib_init_locked(ctx);
CTX_UNLOCK(ctx);
 }
 

Modified: head/sys/net/iflib.h
==
--- head/sys/net/iflib.hMon Apr 27 21:51:22 2020(r360397)
+++ head/sys/net/iflib.hMon Apr 27 22:02:44 2020(r360398)
@@ -377,6 +377,15 @@ typedef enum {
 #defineIFLIB_SINGLE_IRQ_RX_ONLY0x4
 
 /*
+ * These enum values are used in iflib_needs_restart to indicate to iflib
+ * functions whether or not the interface needs restarting when certain events
+ * happen.
+ */
+enum iflib_restart_event {
+   IFLIB_RESTART_VLAN_CONFIG,
+};
+
+/*
  * field accessors
  */
 void *iflib_get_softc(if_ctx_t ctx);
___
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: r360397 - in head/sys: conf riscv/conf

2020-04-27 Thread John Baldwin
Author: jhb
Date: Mon Apr 27 21:51:22 2020
New Revision: 360397
URL: https://svnweb.freebsd.org/changeset/base/360397

Log:
  Retire the GENERICSF kernel config.
  
  Now that hw.machine_arch handles soft-float vs hard-float there is no
  longer a reason for this config.
  
  Submitted by: mhorne (kern.mk hunk)
  Reviewed by:  imp (earlier version), kp
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D24544

Deleted:
  head/sys/riscv/conf/GENERICSF
Modified:
  head/sys/conf/Makefile.riscv
  head/sys/conf/kern.mk

Modified: head/sys/conf/Makefile.riscv
==
--- head/sys/conf/Makefile.riscvMon Apr 27 21:44:02 2020
(r360396)
+++ head/sys/conf/Makefile.riscvMon Apr 27 21:51:22 2020
(r360397)
@@ -19,7 +19,7 @@
 #
 
 # Which version of config(8) is required.
-%VERSREQ=  600017
+%VERSREQ=  600012
 
 .if !defined(S)
 S= ../../..

Modified: head/sys/conf/kern.mk
==
--- head/sys/conf/kern.mk   Mon Apr 27 21:44:02 2020(r360396)
+++ head/sys/conf/kern.mk   Mon Apr 27 21:51:22 2020(r360397)
@@ -150,11 +150,7 @@ INLINE_LIMIT?= 8000
 # code model as "medium" and "medany" respectively.
 #
 .if ${MACHINE_CPUARCH} == "riscv"
-.if ${MACHINE_ARCH:Mriscv*sf}
-CFLAGS+=   -march=rv64imac
-.else
 CFLAGS+=   -march=rv64imafdc
-.endif
 CFLAGS+=   -mabi=lp64
 CFLAGS.clang+= -mcmodel=medium
 CFLAGS.gcc+=   -mcmodel=medany
___
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: r360396 - head/release/tools

2020-04-27 Thread Colin Percival
Author: cperciva
Date: Mon Apr 27 21:44:02 2020
New Revision: 360396
URL: https://svnweb.freebsd.org/changeset/base/360396

Log:
  Set use_nvd=0 in EC2 AMIs.
  
  FreeBSD is in the process of switching from nvd(4) to nda(4) as the disk
  device front-end to NVMe. Changing the default in the kernel is tricky
  since existing systems may have /dev/nvd* hard-coded e.g. in /etc/fstab;
  however, there's no reason to not change the default in HEAD for *new*
  systems.
  
  At present I have no intention of MFCing this to stable branches, since
  someone might reasonably expect scripts they use for launching and
  configuring FreeBSD 12.1 instances to work with FreeBSD 12.2 AMIs, for
  example.
  
  Reviewed by:  gjb, imp
  Relnotes: NVMe disks in EC2 instances launched from 13.0 and later
now show up as nda(4) devices.
  Differential Revision:https://reviews.freebsd.org/D24583

Modified:
  head/release/tools/ec2.conf

Modified: head/release/tools/ec2.conf
==
--- head/release/tools/ec2.conf Mon Apr 27 21:41:00 2020(r360395)
+++ head/release/tools/ec2.conf Mon Apr 27 21:44:02 2020(r360396)
@@ -98,6 +98,10 @@ vm_extra_pre_umount() {
# Load the kernel module for the Amazon "Elastic Network Adapter"
echo 'if_ena_load="YES"' >> ${DESTDIR}/boot/loader.conf
 
+   # Use the "nda" driver for accessing NVMe disks rather than the
+   # historical "nvd" driver.
+   echo 'hw.nvme.use_nvd="0"' >> ${DESTDIR}/boot/loader.conf
+
# Disable ChallengeResponseAuthentication according to EC2
# requirements.
sed -i '' -e \
___
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: r360395 - in stable: 11/secure/caroot/trusted 12/secure/caroot/trusted

2020-04-27 Thread Kyle Evans
Author: kevans
Date: Mon Apr 27 21:41:00 2020
New Revision: 360395
URL: https://svnweb.freebsd.org/changeset/base/360395

Log:
  MFC r353095, r355376: add root bundle
  
  r353095:
  caroot: commit initial bundle
  
  Interested users can blacklist any/all of these with certctl(8), examples:
  
  - mv /usr/share/certs/trusted/... /usr/share/certs/blacklisted/...; \
  certctl rehash
  - certctl blacklist /usr/share/certs/trusted/*; \
  certctl rehash
  
  Certs can be easily examined after installation with `certctl list`, and
  certctl blacklist will accept the hashed filename as output by list or as
  seen in /etc/ssl/certs
  
  r355376:
  caroot update to latest tip: one (1) addition, none (0) removed
  
  Added:
  - Entrust Root Certification Authority - G4
  
  Relnotes: yes, please

Added:
  stable/12/secure/caroot/trusted/ACCVRAIZ1.pem
 - copied unchanged from r353095, head/secure/caroot/trusted/ACCVRAIZ1.pem
  stable/12/secure/caroot/trusted/AC_RAIZ_FNMT-RCM.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/AC_RAIZ_FNMT-RCM.pem
  stable/12/secure/caroot/trusted/Actalis_Authentication_Root_CA.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/Actalis_Authentication_Root_CA.pem
  stable/12/secure/caroot/trusted/AddTrust_External_Root.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/AddTrust_External_Root.pem
  stable/12/secure/caroot/trusted/AddTrust_Low-Value_Services_Root.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/AddTrust_Low-Value_Services_Root.pem
  stable/12/secure/caroot/trusted/AffirmTrust_Commercial.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/AffirmTrust_Commercial.pem
  stable/12/secure/caroot/trusted/AffirmTrust_Networking.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/AffirmTrust_Networking.pem
  stable/12/secure/caroot/trusted/AffirmTrust_Premium.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/AffirmTrust_Premium.pem
  stable/12/secure/caroot/trusted/AffirmTrust_Premium_ECC.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/AffirmTrust_Premium_ECC.pem
  stable/12/secure/caroot/trusted/Amazon_Root_CA_1.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/Amazon_Root_CA_1.pem
  stable/12/secure/caroot/trusted/Amazon_Root_CA_2.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/Amazon_Root_CA_2.pem
  stable/12/secure/caroot/trusted/Amazon_Root_CA_3.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/Amazon_Root_CA_3.pem
  stable/12/secure/caroot/trusted/Amazon_Root_CA_4.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/Amazon_Root_CA_4.pem
  stable/12/secure/caroot/trusted/Atos_TrustedRoot_2011.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/Atos_TrustedRoot_2011.pem
  
stable/12/secure/caroot/trusted/Autoridad_de_Certificacion_Firmaprofesional_CIF_A62634068.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/Autoridad_de_Certificacion_Firmaprofesional_CIF_A62634068.pem
  stable/12/secure/caroot/trusted/Baltimore_CyberTrust_Root.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/Baltimore_CyberTrust_Root.pem
  stable/12/secure/caroot/trusted/Buypass_Class_2_Root_CA.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/Buypass_Class_2_Root_CA.pem
  stable/12/secure/caroot/trusted/Buypass_Class_3_Root_CA.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/Buypass_Class_3_Root_CA.pem
  stable/12/secure/caroot/trusted/CA_Disig_Root_R2.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/CA_Disig_Root_R2.pem
  stable/12/secure/caroot/trusted/CFCA_EV_ROOT.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/CFCA_EV_ROOT.pem
  stable/12/secure/caroot/trusted/COMODO_Certification_Authority.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/COMODO_Certification_Authority.pem
  stable/12/secure/caroot/trusted/COMODO_ECC_Certification_Authority.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/COMODO_ECC_Certification_Authority.pem
  stable/12/secure/caroot/trusted/COMODO_RSA_Certification_Authority.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/COMODO_RSA_Certification_Authority.pem
  stable/12/secure/caroot/trusted/Camerfirma_Chambers_of_Commerce_Root.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/Camerfirma_Chambers_of_Commerce_Root.pem
  stable/12/secure/caroot/trusted/Camerfirma_Global_Chambersign_Root.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/Camerfirma_Global_Chambersign_Root.pem
  stable/12/secure/caroot/trusted/Certigna.pem
 - copied unchanged from r353095, head/secure/caroot/trusted/Certigna.pem
  stable/12/secure/caroot/trusted/Certigna_Root_CA.pem
 - copied unchanged from r353095, 
head

svn commit: r360395 - in stable: 11/secure/caroot/trusted 12/secure/caroot/trusted

2020-04-27 Thread Kyle Evans
Author: kevans
Date: Mon Apr 27 21:41:00 2020
New Revision: 360395
URL: https://svnweb.freebsd.org/changeset/base/360395

Log:
  MFC r353095, r355376: add root bundle
  
  r353095:
  caroot: commit initial bundle
  
  Interested users can blacklist any/all of these with certctl(8), examples:
  
  - mv /usr/share/certs/trusted/... /usr/share/certs/blacklisted/...; \
  certctl rehash
  - certctl blacklist /usr/share/certs/trusted/*; \
  certctl rehash
  
  Certs can be easily examined after installation with `certctl list`, and
  certctl blacklist will accept the hashed filename as output by list or as
  seen in /etc/ssl/certs
  
  r355376:
  caroot update to latest tip: one (1) addition, none (0) removed
  
  Added:
  - Entrust Root Certification Authority - G4
  
  Relnotes: yes, please

Added:
  stable/11/secure/caroot/trusted/ACCVRAIZ1.pem
 - copied unchanged from r353095, head/secure/caroot/trusted/ACCVRAIZ1.pem
  stable/11/secure/caroot/trusted/AC_RAIZ_FNMT-RCM.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/AC_RAIZ_FNMT-RCM.pem
  stable/11/secure/caroot/trusted/Actalis_Authentication_Root_CA.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/Actalis_Authentication_Root_CA.pem
  stable/11/secure/caroot/trusted/AddTrust_External_Root.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/AddTrust_External_Root.pem
  stable/11/secure/caroot/trusted/AddTrust_Low-Value_Services_Root.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/AddTrust_Low-Value_Services_Root.pem
  stable/11/secure/caroot/trusted/AffirmTrust_Commercial.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/AffirmTrust_Commercial.pem
  stable/11/secure/caroot/trusted/AffirmTrust_Networking.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/AffirmTrust_Networking.pem
  stable/11/secure/caroot/trusted/AffirmTrust_Premium.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/AffirmTrust_Premium.pem
  stable/11/secure/caroot/trusted/AffirmTrust_Premium_ECC.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/AffirmTrust_Premium_ECC.pem
  stable/11/secure/caroot/trusted/Amazon_Root_CA_1.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/Amazon_Root_CA_1.pem
  stable/11/secure/caroot/trusted/Amazon_Root_CA_2.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/Amazon_Root_CA_2.pem
  stable/11/secure/caroot/trusted/Amazon_Root_CA_3.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/Amazon_Root_CA_3.pem
  stable/11/secure/caroot/trusted/Amazon_Root_CA_4.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/Amazon_Root_CA_4.pem
  stable/11/secure/caroot/trusted/Atos_TrustedRoot_2011.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/Atos_TrustedRoot_2011.pem
  
stable/11/secure/caroot/trusted/Autoridad_de_Certificacion_Firmaprofesional_CIF_A62634068.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/Autoridad_de_Certificacion_Firmaprofesional_CIF_A62634068.pem
  stable/11/secure/caroot/trusted/Baltimore_CyberTrust_Root.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/Baltimore_CyberTrust_Root.pem
  stable/11/secure/caroot/trusted/Buypass_Class_2_Root_CA.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/Buypass_Class_2_Root_CA.pem
  stable/11/secure/caroot/trusted/Buypass_Class_3_Root_CA.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/Buypass_Class_3_Root_CA.pem
  stable/11/secure/caroot/trusted/CA_Disig_Root_R2.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/CA_Disig_Root_R2.pem
  stable/11/secure/caroot/trusted/CFCA_EV_ROOT.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/CFCA_EV_ROOT.pem
  stable/11/secure/caroot/trusted/COMODO_Certification_Authority.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/COMODO_Certification_Authority.pem
  stable/11/secure/caroot/trusted/COMODO_ECC_Certification_Authority.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/COMODO_ECC_Certification_Authority.pem
  stable/11/secure/caroot/trusted/COMODO_RSA_Certification_Authority.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/COMODO_RSA_Certification_Authority.pem
  stable/11/secure/caroot/trusted/Camerfirma_Chambers_of_Commerce_Root.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/Camerfirma_Chambers_of_Commerce_Root.pem
  stable/11/secure/caroot/trusted/Camerfirma_Global_Chambersign_Root.pem
 - copied unchanged from r353095, 
head/secure/caroot/trusted/Camerfirma_Global_Chambersign_Root.pem
  stable/11/secure/caroot/trusted/Certigna.pem
 - copied unchanged from r353095, head/secure/caroot/trusted/Certigna.pem
  stable/11/secure/caroot/trusted/Certigna_Root_CA.pem
 - copied unchanged from r353095, 
head

svn commit: r360394 - in stable: 11/usr.sbin/freebsd-update 12/usr.sbin/freebsd-update

2020-04-27 Thread Kyle Evans
Author: kevans
Date: Mon Apr 27 21:39:01 2020
New Revision: 360394
URL: https://svnweb.freebsd.org/changeset/base/360394

Log:
  MFC r360287: freebsd-update: rehash certs
  
  With the inclusion of caroot bits, we'll need to also rehash on update as we
  do in mergemaster/etcupdate.
  
  If certctl's installed on the system, just unconditionally rehash. This
  isn't an expensive operation, and we can refine it to compare
  INDEX-{OLD,NEW} later if we really want to.

Modified:
  stable/11/usr.sbin/freebsd-update/freebsd-update.sh
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/usr.sbin/freebsd-update/freebsd-update.sh
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/usr.sbin/freebsd-update/freebsd-update.sh
==
--- stable/11/usr.sbin/freebsd-update/freebsd-update.sh Mon Apr 27 21:19:46 
2020(r360393)
+++ stable/11/usr.sbin/freebsd-update/freebsd-update.sh Mon Apr 27 21:39:01 
2020(r360394)
@@ -2876,7 +2876,7 @@ install_delete () {
rm newfiles killfiles
 }
 
-# Install new files, delete old files, and update linker.hints
+# Install new files, delete old files, and update generated files
 install_files () {
# If we haven't already dealt with the kernel, deal with it.
if ! [ -f $1/kerneldone ]; then
@@ -2943,6 +2943,11 @@ Kernel updates have been installed.  Please reboot and
grep -vE '^[^|]*/lib/[^|]*\.so\.[0-9]+\|' > INDEX-NEW
install_from_index INDEX-NEW || return 1
install_delete INDEX-OLD INDEX-NEW || return 1
+
+   # Rehash certs if we actually have certctl installed.
+   if which certctl>/dev/null; then
+   env DESTDIR=${BASEDIR} certctl rehash
+   fi
 
# Rebuild generated pwd files.
if [ ${BASEDIR}/etc/master.passwd -nt ${BASEDIR}/etc/spwd.db ] 
||
___
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: r360394 - in stable: 11/usr.sbin/freebsd-update 12/usr.sbin/freebsd-update

2020-04-27 Thread Kyle Evans
Author: kevans
Date: Mon Apr 27 21:39:01 2020
New Revision: 360394
URL: https://svnweb.freebsd.org/changeset/base/360394

Log:
  MFC r360287: freebsd-update: rehash certs
  
  With the inclusion of caroot bits, we'll need to also rehash on update as we
  do in mergemaster/etcupdate.
  
  If certctl's installed on the system, just unconditionally rehash. This
  isn't an expensive operation, and we can refine it to compare
  INDEX-{OLD,NEW} later if we really want to.

Modified:
  stable/12/usr.sbin/freebsd-update/freebsd-update.sh
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/usr.sbin/freebsd-update/freebsd-update.sh
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/usr.sbin/freebsd-update/freebsd-update.sh
==
--- stable/12/usr.sbin/freebsd-update/freebsd-update.sh Mon Apr 27 21:19:46 
2020(r360393)
+++ stable/12/usr.sbin/freebsd-update/freebsd-update.sh Mon Apr 27 21:39:01 
2020(r360394)
@@ -2876,7 +2876,7 @@ install_delete () {
rm newfiles killfiles
 }
 
-# Install new files, delete old files, and update linker.hints
+# Install new files, delete old files, and update generated files
 install_files () {
# If we haven't already dealt with the kernel, deal with it.
if ! [ -f $1/kerneldone ]; then
@@ -2943,6 +2943,11 @@ Kernel updates have been installed.  Please reboot and
grep -vE '^[^|]*/lib/[^|]*\.so\.[0-9]+\|' > INDEX-NEW
install_from_index INDEX-NEW || return 1
install_delete INDEX-OLD INDEX-NEW || return 1
+
+   # Rehash certs if we actually have certctl installed.
+   if which certctl>/dev/null; then
+   env DESTDIR=${BASEDIR} certctl rehash
+   fi
 
# Rebuild generated pwd files.
if [ ${BASEDIR}/etc/master.passwd -nt ${BASEDIR}/etc/spwd.db ] 
||
___
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: r360393 - stable/12/tests/sys/kern

2020-04-27 Thread John Baldwin
Author: jhb
Date: Mon Apr 27 21:19:46 2020
New Revision: 360393
URL: https://svnweb.freebsd.org/changeset/base/360393

Log:
  MFC 350014: Add a test for PT_GET_SC_ARGS.

Modified:
  stable/12/tests/sys/kern/ptrace_test.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/tests/sys/kern/ptrace_test.c
==
--- stable/12/tests/sys/kern/ptrace_test.c  Mon Apr 27 20:37:11 2020
(r360392)
+++ stable/12/tests/sys/kern/ptrace_test.c  Mon Apr 27 21:19:46 2020
(r360393)
@@ -3927,6 +3927,86 @@ ATF_TC_BODY(ptrace__PT_LWPINFO_stale_siginfo, tc)
 }
 
 /*
+ * A simple test of PT_GET_SC_ARGS.
+ */
+ATF_TC_WITHOUT_HEAD(ptrace__syscall_args);
+ATF_TC_BODY(ptrace__syscall_args, tc)
+{
+   struct ptrace_lwpinfo pl;
+   pid_t fpid, wpid;
+   register_t args[2];
+   int events, status;
+
+   ATF_REQUIRE((fpid = fork()) != -1);
+   if (fpid == 0) {
+   trace_me();
+   kill(getpid(), 0);
+   exit(1);
+   }
+
+   /* The first wait() should report the stop from SIGSTOP. */
+   wpid = waitpid(fpid, &status, 0);
+   ATF_REQUIRE(wpid == fpid);
+   ATF_REQUIRE(WIFSTOPPED(status));
+   ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP);
+
+   /*
+* Continue the process ignoring the signal, but enabling
+* syscall entry traps.
+*/
+   ATF_REQUIRE(ptrace(PT_TO_SCE, fpid, (caddr_t)1, 0) == 0);
+
+   /*
+* The next stop should be the syscall entry from getpid().
+*/
+   wpid = waitpid(fpid, &status, 0);
+   ATF_REQUIRE(wpid == fpid);
+   ATF_REQUIRE(WIFSTOPPED(status));
+   ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+
+   ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
+   ATF_REQUIRE(pl.pl_flags & PL_FLAG_SCE);
+   ATF_REQUIRE(pl.pl_syscall_code == SYS_getpid);
+
+   ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+
+   /*
+* The next stop should be the syscall entry from kill().
+*/
+   wpid = waitpid(fpid, &status, 0);
+   ATF_REQUIRE(wpid == fpid);
+   ATF_REQUIRE(WIFSTOPPED(status));
+   ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP);
+
+   ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1);
+   ATF_REQUIRE(pl.pl_flags & PL_FLAG_SCE);
+   ATF_REQUIRE(pl.pl_syscall_code == SYS_kill);
+   ATF_REQUIRE(pl.pl_syscall_narg == 2);
+
+   ATF_REQUIRE(ptrace(PT_GET_SC_ARGS, wpid, (caddr_t)args,
+   sizeof(args)) != -1);
+   ATF_REQUIRE(args[0] == wpid);
+   ATF_REQUIRE(args[1] == 0);
+
+   /* Disable syscall tracing and continue the child to let it exit. */
+   ATF_REQUIRE(ptrace(PT_GET_EVENT_MASK, fpid, (caddr_t)&events,
+   sizeof(events)) == 0);
+   events &= ~PTRACE_SYSCALL;
+   ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, fpid, (caddr_t)&events,
+   sizeof(events)) == 0);
+   ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0);
+
+   /* The last event should be for the child process's exit. */
+   wpid = waitpid(fpid, &status, 0);
+   ATF_REQUIRE(WIFEXITED(status));
+   ATF_REQUIRE(WEXITSTATUS(status) == 1);
+
+   wpid = wait(&status);
+   ATF_REQUIRE(wpid == -1);
+   ATF_REQUIRE(errno == ECHILD);
+}
+
+/*
  * Verify that when the process is traced that it isn't reparent
  * to the init process when we close all process descriptors.
  */
@@ -4041,6 +4121,7 @@ ATF_TP_ADD_TCS(tp)
ATF_TP_ADD_TC(tp, ptrace__PT_CONTINUE_different_thread);
 #endif
ATF_TP_ADD_TC(tp, ptrace__PT_LWPINFO_stale_siginfo);
+   ATF_TP_ADD_TC(tp, ptrace__syscall_args);
ATF_TP_ADD_TC(tp, ptrace__proc_reparent);
 
return (atf_no_error());
___
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: r360392 - in stable/12/sys: amd64/amd64 amd64/ia32 arm/arm arm64/arm64 i386/i386 kern mips/mips powerpc/powerpc riscv/riscv sparc64/sparc64

2020-04-27 Thread John Baldwin
Author: jhb
Date: Mon Apr 27 20:37:11 2020
New Revision: 360392
URL: https://svnweb.freebsd.org/changeset/base/360392

Log:
  MFC 350013: Don't pass error from syscallenter() to syscallret().
  
  syscallret() doesn't use error anymore.  Fix a few other places to permit
  removing the return value from syscallenter() entirely.
  - Remove a duplicated assertion from arm's syscall().
  - Use td_errno for amd64_syscall_ret_flush_l1d.

Modified:
  stable/12/sys/amd64/amd64/trap.c
  stable/12/sys/amd64/ia32/ia32_syscall.c
  stable/12/sys/arm/arm/syscall.c
  stable/12/sys/arm64/arm64/trap.c
  stable/12/sys/i386/i386/trap.c
  stable/12/sys/kern/subr_syscall.c
  stable/12/sys/mips/mips/trap.c
  stable/12/sys/powerpc/powerpc/trap.c
  stable/12/sys/riscv/riscv/trap.c
  stable/12/sys/sparc64/sparc64/trap.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/amd64/amd64/trap.c
==
--- stable/12/sys/amd64/amd64/trap.cMon Apr 27 19:49:35 2020
(r360391)
+++ stable/12/sys/amd64/amd64/trap.cMon Apr 27 20:37:11 2020
(r360392)
@@ -1156,7 +1156,6 @@ SYSCTL_PROC(_machdep, OID_AUTO, syscall_ret_flush_l1d,
 void
 amd64_syscall(struct thread *td, int traced)
 {
-   int error;
ksiginfo_t ksi;
 
 #ifdef DIAGNOSTIC
@@ -1165,7 +1164,7 @@ amd64_syscall(struct thread *td, int traced)
/* NOT REACHED */
}
 #endif
-   error = syscallenter(td);
+   syscallenter(td);
 
/*
 * Traced syscall.
@@ -1190,7 +1189,7 @@ amd64_syscall(struct thread *td, int traced)
syscallname(td->td_proc, td->td_sa.code),
td->td_md.md_invl_gen.gen));
 
-   syscallret(td, error);
+   syscallret(td);
 
/*
 * If the user-supplied value of %rip is not a canonical
@@ -1203,5 +1202,5 @@ amd64_syscall(struct thread *td, int traced)
if (__predict_false(td->td_frame->tf_rip >= VM_MAXUSER_ADDRESS))
set_pcb_flags(td->td_pcb, PCB_FULL_IRET);
 
-   amd64_syscall_ret_flush_l1d_inline(error);
+   amd64_syscall_ret_flush_l1d_inline(td->td_errno);
 }

Modified: stable/12/sys/amd64/ia32/ia32_syscall.c
==
--- stable/12/sys/amd64/ia32/ia32_syscall.c Mon Apr 27 19:49:35 2020
(r360391)
+++ stable/12/sys/amd64/ia32/ia32_syscall.c Mon Apr 27 20:37:11 2020
(r360392)
@@ -209,14 +209,13 @@ ia32_syscall(struct trapframe *frame)
 {
struct thread *td;
register_t orig_tf_rflags;
-   int error;
ksiginfo_t ksi;
 
orig_tf_rflags = frame->tf_rflags;
td = curthread;
td->td_frame = frame;
 
-   error = syscallenter(td);
+   syscallenter(td);
 
/*
 * Traced syscall.
@@ -230,8 +229,8 @@ ia32_syscall(struct trapframe *frame)
trapsignal(td, &ksi);
}
 
-   syscallret(td, error);
-   amd64_syscall_ret_flush_l1d(error);
+   syscallret(td);
+   amd64_syscall_ret_flush_l1d(td->td_errno);
 }
 
 static void

Modified: stable/12/sys/arm/arm/syscall.c
==
--- stable/12/sys/arm/arm/syscall.c Mon Apr 27 19:49:35 2020
(r360391)
+++ stable/12/sys/arm/arm/syscall.c Mon Apr 27 20:37:11 2020
(r360392)
@@ -143,14 +143,10 @@ cpu_fetch_syscall_args(struct thread *td)
 static void
 syscall(struct thread *td, struct trapframe *frame)
 {
-   int error;
 
td->td_sa.nap = 4;
-
-   error = syscallenter(td);
-   KASSERT(error != 0 || td->td_ar == NULL,
-   ("returning from syscall with td_ar set!"));
-   syscallret(td, error);
+   syscallenter(td);
+   syscallret(td);
 }
 
 void

Modified: stable/12/sys/arm64/arm64/trap.c
==
--- stable/12/sys/arm64/arm64/trap.cMon Apr 27 19:49:35 2020
(r360391)
+++ stable/12/sys/arm64/arm64/trap.cMon Apr 27 20:37:11 2020
(r360392)
@@ -138,11 +138,10 @@ cpu_fetch_syscall_args(struct thread *td)
 static void
 svc_handler(struct thread *td, struct trapframe *frame)
 {
-   int error;
 
if ((frame->tf_esr & ESR_ELx_ISS_MASK) == 0) {
-   error = syscallenter(td);
-   syscallret(td, error);
+   syscallenter(td);
+   syscallret(td);
} else {
call_trapsignal(td, SIGILL, ILL_ILLOPN, (void *)frame->tf_elr);
userret(td, frame);

Modified: stable/12/sys/i386/i386/trap.c
==
--- stable/12/sys/i386/i386/trap.c  Mon Apr 27 19:49:35 2020
(r360391)
+++ stable/12/sys/i386/i386/trap.c  Mon Apr 27 20:37:11 2020
(r360392)
@@ -1127,7 +1127,6 @@ syscall(struct trapframe *frame)
 {
struct thread *td;
regi

svn commit: r360391 - in stable/12: gnu/usr.bin/gdb share/mk sys/conf

2020-04-27 Thread Kyle Evans
Author: kevans
Date: Mon Apr 27 19:49:35 2020
New Revision: 360391
URL: https://svnweb.freebsd.org/changeset/base/360391

Log:
  MFC r359702, r359774: enforce -fno-common for userland/kernel src builds
  
  r359702:
  Add -fno-common to all userland/kernel src builds
  
  -fno-common will become the default in GCC10/LLVM11. Plenty of work has been
  put in to make sure our world builds are no -fno-common clean, so let's slap
  the build with this until it becomes the compiler default to ensure we don't
  regress.
  
  At this time, we will not be enforcing -fno-common on ports builds. I
  suspect most ports will be or quickly become -fno-common clean as they're
  naturally built against compilers that default to it, so this will hopefully
  become a non-issue in due time. The exception to this, which is actually the
  status quo, is that kmods built from ports will continue to build with
  -fno-common.
  
  As of the time of writing, I intend to also make stable/12 -fno-common
  clean. What's been done will be MFC'd to stable/11 if it's easily applicable
  and/or not much work to massage it into being functional, but I anticipate
  adding -fcommon to stable/11 builds to maintain its ability to be built with
  newer compilers for the rest of its lifetime instead of putting in a third
  branch's worth of effort.
  
  r359774:
  userland build: replace -fno-common with ${CFCOMMONFLAG}
  
  This change allows any downstream or otherwise consumer to easily override
  the new -fno-common default on a temporary basis without having to hack into
  src.sys.mk, and also makes it a bit easier to search for these specific
  cases where -fno-common must be overridden with -fcommon or else the build
  will fail.
  
  The gdb build, the only program requiring -fcommon on head/, is switched
  over as an example usage. It will need it on all branches, so this does not
  harm future mergability.

Modified:
  stable/12/gnu/usr.bin/gdb/Makefile.inc
  stable/12/share/mk/src.sys.mk
  stable/12/sys/conf/kern.pre.mk
  stable/12/sys/conf/kmod.mk
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/gnu/usr.bin/gdb/Makefile.inc
==
--- stable/12/gnu/usr.bin/gdb/Makefile.inc  Mon Apr 27 19:29:48 2020
(r360390)
+++ stable/12/gnu/usr.bin/gdb/Makefile.inc  Mon Apr 27 19:49:35 2020
(r360391)
@@ -50,7 +50,7 @@ CFLAGS+= -I${SYSROOT:U${DESTDIR}}/${INCLUDEDIR}/edit
 # Some bits here currently rely on some of the linker-merging magic that 
happens
 # with -fcommon.  While this is the default right now, explicitly set -fcommon
 # so that it continues to build when the default flips.
-CFLAGS+= -fcommon
+CFCOMMONFLAG= -fcommon
 
 GENSRCS+= nm.h tm.h
 

Modified: stable/12/share/mk/src.sys.mk
==
--- stable/12/share/mk/src.sys.mk   Mon Apr 27 19:29:48 2020
(r360390)
+++ stable/12/share/mk/src.sys.mk   Mon Apr 27 19:49:35 2020
(r360391)
@@ -34,6 +34,12 @@ __postrcconf_${var}:=${MK_${var}:U-}${WITHOUT_${var}:
 .endif # SRCCONF
 .endif
 
+# The following should be removed no earlier than LLVM11 being imported into 
the
+# tree, to ensure we don't regress the build.  LLVM11 and GCC10 will switch the
+# default over to -fno-common, making this redundant.
+CFCOMMONFLAG?= -fno-common
+CFLAGS+=   ${CFCOMMONFLAG}
+
 # tempting, but bsd.compiler.mk causes problems this early
 # probably need to remove dependence on bsd.own.mk 
 #.include "src.opts.mk"

Modified: stable/12/sys/conf/kern.pre.mk
==
--- stable/12/sys/conf/kern.pre.mk  Mon Apr 27 19:29:48 2020
(r360390)
+++ stable/12/sys/conf/kern.pre.mk  Mon Apr 27 19:49:35 2020
(r360391)
@@ -86,7 +86,7 @@ CFLAGS_PARAM_LARGE_FUNCTION_GROWTH?=1000
 .if ${MACHINE_CPUARCH} == "mips"
 CFLAGS_ARCH_PARAMS?=--param max-inline-insns-single=1000 
-DMACHINE_ARCH='"${MACHINE_ARCH}"'
 .endif
-CFLAGS.gcc+= -fno-common -fms-extensions -finline-limit=${INLINE_LIMIT}
+CFLAGS.gcc+= -fms-extensions -finline-limit=${INLINE_LIMIT}
 CFLAGS.gcc+= --param inline-unit-growth=${CFLAGS_PARAM_INLINE_UNIT_GROWTH}
 CFLAGS.gcc+= --param 
large-function-growth=${CFLAGS_PARAM_LARGE_FUNCTION_GROWTH}
 CFLAGS.gcc+= -fms-extensions
@@ -98,6 +98,10 @@ WERROR?= -Wno-error
 .else
 WERROR?=   -Werror
 .endif
+# The following should be removed no earlier than LLVM11 being imported into 
the
+# tree, to ensure we don't regress the build.  LLVM11 and GCC10 will switch the
+# default over to -fno-common, making this redundant.
+CFLAGS+=   -fno-common
 
 # XXX LOCORE means "don't declare C stuff" not "for locore.s".
 ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS} 
${ASM_CFLAGS.${.IMPSRC:T}} 

Modified: stable/12/sys/conf/kmod.mk
==
--- s

svn commit: r360390 - in stable: 11/usr.sbin/adduser 12/usr.sbin/adduser

2020-04-27 Thread Kyle Evans
Author: kevans
Date: Mon Apr 27 19:29:48 2020
New Revision: 360390
URL: https://svnweb.freebsd.org/changeset/base/360390

Log:
  MFC r359642: adduser: allow standard IFS characters in passwords
  
  Notably, the default IFS contains space/tab, thus any leading/trailing
  whitespace characters tend to be removed.
  
  Set IFS= for just the read lines to mitigate this, allowing the user to be
  less surprised when their leading/trailing spaces weren't actually captured
  in the password as they are with other means of setting a user's password.
  
  PR:   245342

Modified:
  stable/12/usr.sbin/adduser/adduser.sh
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/usr.sbin/adduser/adduser.sh
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/usr.sbin/adduser/adduser.sh
==
--- stable/12/usr.sbin/adduser/adduser.sh   Mon Apr 27 18:07:38 2020
(r360389)
+++ stable/12/usr.sbin/adduser/adduser.sh   Mon Apr 27 19:29:48 2020
(r360390)
@@ -733,10 +733,10 @@ input_interactive() {
trap 'stty echo; exit' 0 1 2 3 15
stty -echo
echo -n "Enter password: "
-   read -r upass
+   IFS= read -r upass
echo''
echo -n "Enter password again: "
-   read -r _passconfirm
+   IFS= read -r _passconfirm
echo ''
stty echo
# if user entered a blank password
___
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: r360390 - in stable: 11/usr.sbin/adduser 12/usr.sbin/adduser

2020-04-27 Thread Kyle Evans
Author: kevans
Date: Mon Apr 27 19:29:48 2020
New Revision: 360390
URL: https://svnweb.freebsd.org/changeset/base/360390

Log:
  MFC r359642: adduser: allow standard IFS characters in passwords
  
  Notably, the default IFS contains space/tab, thus any leading/trailing
  whitespace characters tend to be removed.
  
  Set IFS= for just the read lines to mitigate this, allowing the user to be
  less surprised when their leading/trailing spaces weren't actually captured
  in the password as they are with other means of setting a user's password.
  
  PR:   245342

Modified:
  stable/11/usr.sbin/adduser/adduser.sh
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/usr.sbin/adduser/adduser.sh
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/usr.sbin/adduser/adduser.sh
==
--- stable/11/usr.sbin/adduser/adduser.sh   Mon Apr 27 18:07:38 2020
(r360389)
+++ stable/11/usr.sbin/adduser/adduser.sh   Mon Apr 27 19:29:48 2020
(r360390)
@@ -733,10 +733,10 @@ input_interactive() {
trap 'stty echo; exit' 0 1 2 3 15
stty -echo
echo -n "Enter password: "
-   read -r upass
+   IFS= read -r upass
echo''
echo -n "Enter password again: "
-   read -r _passconfirm
+   IFS= read -r _passconfirm
echo ''
stty echo
# if user entered a blank password
___
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: r360388 - head/sys/dev/iscsi_initiator

2020-04-27 Thread John Baldwin
Author: jhb
Date: Mon Apr 27 18:04:42 2020
New Revision: 360388
URL: https://svnweb.freebsd.org/changeset/base/360388

Log:
  Don't run strcmp() against strings stored in user memory.
  
  Instead, copy the strings into a temporary buffer on the stack and
  run strcmp on the copies.
  
  Reviewed by:  brooks, kib
  Obtained from:CheriBSD
  MFC after:1 week
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D24567

Modified:
  head/sys/dev/iscsi_initiator/isc_subr.c

Modified: head/sys/dev/iscsi_initiator/isc_subr.c
==
--- head/sys/dev/iscsi_initiator/isc_subr.c Mon Apr 27 17:55:40 2020
(r360387)
+++ head/sys/dev/iscsi_initiator/isc_subr.c Mon Apr 27 18:04:42 2020
(r360388)
@@ -97,6 +97,9 @@ i_crc32c(const void *buf, size_t size, uint32_t crc)
 int
 i_setopt(isc_session_t *sp, isc_opt_t *opt)
 {
+ char buf[16];
+ int error;
+
  if(opt->maxRecvDataSegmentLength > 0) {
  sp->opt.maxRecvDataSegmentLength = opt->maxRecvDataSegmentLength;
  sdebug(2, "maxRecvDataSegmentLength=%d", 
sp->opt.maxRecvDataSegmentLength);
@@ -138,15 +141,21 @@ i_setopt(isc_session_t *sp, isc_opt_t *opt)
  }
 
  if(opt->headerDigest != NULL) {
- sdebug(2, "opt.headerDigest='%s'", opt->headerDigest);
- if(strcmp(opt->headerDigest, "CRC32C") == 0) {
+ error = copyinstr(opt->headerDigest, buf, sizeof(buf), NULL);
+ if (error != 0)
+  return (error);
+ sdebug(2, "opt.headerDigest='%s'", buf);
+ if(strcmp(buf, "CRC32C") == 0) {
   sp->hdrDigest = (digest_t *)i_crc32c;
   sdebug(2, "opt.headerDigest set");
  }
  }
  if(opt->dataDigest != NULL) {
- sdebug(2, "opt.dataDigest='%s'", opt->headerDigest);
- if(strcmp(opt->dataDigest, "CRC32C") == 0) {
+ error = copyinstr(opt->dataDigest, buf, sizeof(buf), NULL);
+ if (error != 0)
+  return (error);
+ sdebug(2, "opt.dataDigest='%s'", opt->dataDigest);
+ if(strcmp(buf, "CRC32C") == 0) {
   sp->dataDigest = (digest_t *)i_crc32c;
   sdebug(2, "opt.dataDigest set");
  }
___
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: r360387 - in head/sys: kern riscv/include riscv/riscv

2020-04-27 Thread John Baldwin
Author: jhb
Date: Mon Apr 27 17:55:40 2020
New Revision: 360387
URL: https://svnweb.freebsd.org/changeset/base/360387

Log:
  Improve MACHINE_ARCH handling for hard vs soft-float on RISC-V.
  
  For userland, MACHINE_ARCH reflects the current ABI via preprocessor
  directives.  For the kernel, the hw.machine_arch sysctl uses the ELF
  header flags of the current process to select the correct MACHINE_ARCH
  value.
  
  Reviewed by:  imp, kp
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D24543

Modified:
  head/sys/kern/kern_mib.c
  head/sys/riscv/include/param.h
  head/sys/riscv/riscv/elf_machdep.c

Modified: head/sys/kern/kern_mib.c
==
--- head/sys/kern/kern_mib.cMon Apr 27 17:53:38 2020(r360386)
+++ head/sys/kern/kern_mib.cMon Apr 27 17:55:40 2020(r360387)
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 

Modified: head/sys/riscv/include/param.h
==
--- head/sys/riscv/include/param.h  Mon Apr 27 17:53:38 2020
(r360386)
+++ head/sys/riscv/include/param.h  Mon Apr 27 17:55:40 2020
(r360387)
@@ -46,18 +46,16 @@
 #defineMACHINE "riscv"
 #endif
 #ifndef MACHINE_ARCH
-/*
- * Check to see if we're building with hardware floating instructions
- * allowed. We check this instead of hard vs soft float ABI because we build 
the
- * kernel with soft float ABI to avoid hard float instruction generation. If
- * we ever allow a 'soft ABI but with hard floats' userland, then we'll need
- * to rethink this.
- */
-#ifdef __riscv_flen
-#defineMACHINE_ARCH"riscv64"
-#else
+
+/* Always use the hard-float arch for the kernel. */
+#if !defined(_KERNEL) && defined(__riscv_float_abi_soft)
 #defineMACHINE_ARCH"riscv64sf"
+#else
+#defineMACHINE_ARCH"riscv64"
 #endif
+#endif
+#ifdef _KERNEL
+#defineMACHINE_ARCHES  "riscv64 riscv64sf"
 #endif
 
 #ifdef SMP

Modified: head/sys/riscv/riscv/elf_machdep.c
==
--- head/sys/riscv/riscv/elf_machdep.c  Mon Apr 27 17:53:38 2020
(r360386)
+++ head/sys/riscv/riscv/elf_machdep.c  Mon Apr 27 17:55:40 2020
(r360387)
@@ -58,6 +58,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+static const char *riscv_machine_arch(struct proc *p);
+
 u_long elf_hwcap;
 
 struct sysentvec elf64_freebsd_sysvec = {
@@ -94,8 +96,19 @@ struct sysentvec elf64_freebsd_sysvec = {
.sv_thread_detach = NULL,
.sv_trap= NULL,
.sv_hwcap   = &elf_hwcap,
+   .sv_machine_arch = riscv_machine_arch,
 };
 INIT_SYSENTVEC(elf64_sysvec, &elf64_freebsd_sysvec);
+
+static const char *
+riscv_machine_arch(struct proc *p)
+{
+
+   if ((p->p_elf_flags & EF_RISCV_FLOAT_ABI_MASK) ==
+   EF_RISCV_FLOAT_ABI_SOFT)
+   return (MACHINE_ARCH "sf");
+   return (MACHINE_ARCH);
+}
 
 static Elf64_Brandinfo freebsd_brand_info = {
.brand  = ELFOSABI_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: r360386 - in head/sys: kern sys

2020-04-27 Thread John Baldwin
Author: jhb
Date: Mon Apr 27 17:53:38 2020
New Revision: 360386
URL: https://svnweb.freebsd.org/changeset/base/360386

Log:
  Extend support in sysctls for supporting multiple native ABIs.
  
  This extends some of the changes in place to support reporting support
  for 32-bit ABIs to permit reporting hard-float vs soft-float ABIs.
  
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D24542

Modified:
  head/sys/kern/kern_mib.c
  head/sys/sys/sysent.h

Modified: head/sys/kern/kern_mib.c
==
--- head/sys/kern/kern_mib.cMon Apr 27 16:30:29 2020(r360385)
+++ head/sys/kern/kern_mib.cMon Apr 27 17:53:38 2020(r360386)
@@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -252,39 +253,49 @@ SYSCTL_PROC(_hw, OID_AUTO, pagesizes,
 sysctl_hw_pagesizes, "LU",
 "Supported page sizes");
 
-#ifdef SCTL_MASK32
 int adaptive_machine_arch = 1;
 SYSCTL_INT(_debug, OID_AUTO, adaptive_machine_arch, CTLFLAG_RW,
 &adaptive_machine_arch, 1,
 "Adapt reported machine architecture to the ABI of the binary");
+
+static const char *
+proc_machine_arch(struct proc *p)
+{
+
+   if (p->p_sysent->sv_machine_arch != NULL)
+   return (p->p_sysent->sv_machine_arch(p));
+#ifdef COMPAT_FREEBSD32
+   if (SV_PROC_FLAG(p, SV_ILP32))
+   return (MACHINE_ARCH32);
 #endif
+   return (MACHINE_ARCH);
+}
 
 static int
 sysctl_hw_machine_arch(SYSCTL_HANDLER_ARGS)
 {
-   int error;
-   static const char machine_arch[] = MACHINE_ARCH;
-#ifdef SCTL_MASK32
-   static const char machine_arch32[] = MACHINE_ARCH32;
+   const char *machine_arch;
 
-   if ((req->flags & SCTL_MASK32) != 0 && adaptive_machine_arch)
-   error = SYSCTL_OUT(req, machine_arch32, sizeof(machine_arch32));
+   if (adaptive_machine_arch)
+   machine_arch = proc_machine_arch(curproc);
else
-#endif
-   error = SYSCTL_OUT(req, machine_arch, sizeof(machine_arch));
-   return (error);
-
+   machine_arch = MACHINE_ARCH;
+   return (SYSCTL_OUT(req, machine_arch, strlen(machine_arch) + 1));
 }
 SYSCTL_PROC(_hw, HW_MACHINE_ARCH, machine_arch, CTLTYPE_STRING | CTLFLAG_RD |
 CTLFLAG_MPSAFE, NULL, 0, sysctl_hw_machine_arch, "A",
 "System architecture");
 
-SYSCTL_STRING(_kern, OID_AUTO, supported_archs, CTLFLAG_RD | CTLFLAG_MPSAFE,
+#ifndef MACHINE_ARCHES
 #ifdef COMPAT_FREEBSD32
-MACHINE_ARCH " " MACHINE_ARCH32, 0, "Supported architectures for 
binaries");
+#defineMACHINE_ARCHES  MACHINE_ARCH " " MACHINE_ARCH32
 #else
-MACHINE_ARCH, 0, "Supported architectures for binaries");
+#defineMACHINE_ARCHES  MACHINE_ARCH
 #endif
+#endif
+
+SYSCTL_STRING(_kern, OID_AUTO, supported_archs, CTLFLAG_RD | CTLFLAG_MPSAFE,
+MACHINE_ARCHES, 0, "Supported architectures for binaries");
 
 static int
 sysctl_hostname(SYSCTL_HANDLER_ARGS)

Modified: head/sys/sys/sysent.h
==
--- head/sys/sys/sysent.h   Mon Apr 27 16:30:29 2020(r360385)
+++ head/sys/sys/sysent.h   Mon Apr 27 17:53:38 2020(r360386)
@@ -94,6 +94,7 @@ struct sysent {   /* system call table */
 #endif
 
 struct image_params;
+struct proc;
 struct __sigset;
 struct trapframe;
 struct vnode;
@@ -144,6 +145,7 @@ struct sysentvec {
int (*sv_trap)(struct thread *);
u_long  *sv_hwcap;  /* Value passed in AT_HWCAP. */
u_long  *sv_hwcap2; /* Value passed in AT_HWCAP2. */
+   const char  *(*sv_machine_arch)(struct proc *);
 };
 
 #defineSV_ILP320x000100/* 32-bit executable. */
___
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: r360385 - head/sys/netinet

2020-04-27 Thread Randall Stewart
Author: rrs
Date: Mon Apr 27 16:30:29 2020
New Revision: 360385
URL: https://svnweb.freebsd.org/changeset/base/360385

Log:
  This change does a small prepratory step in getting the
  latest rack and bbr in from the NF repo. When those come
  in the OOB data handling will be fixed where Skyzaller crashes.
  
  Differential Revision:https://reviews.freebsd.org/D24575

Modified:
  head/sys/netinet/tcp.h
  head/sys/netinet/tcp_log_buf.h
  head/sys/netinet/tcp_subr.c
  head/sys/netinet/tcp_var.h

Modified: head/sys/netinet/tcp.h
==
--- head/sys/netinet/tcp.h  Mon Apr 27 16:12:32 2020(r360384)
+++ head/sys/netinet/tcp.h  Mon Apr 27 16:30:29 2020(r360385)
@@ -181,6 +181,9 @@ struct tcphdr {
 #defineTCP_CONGESTION  64  /* get/set congestion control algorithm 
*/
 #defineTCP_CCALGOOPT   65  /* get/set cc algorithm specific 
options */
 #define TCP_DELACK 72  /* socket option for delayed ack */
+#define TCP_FIN_IS_RST 73  /* A fin from the peer is treated has a RST */
+#define TCP_LOG_LIMIT  74  /* Limit to number of records in tcp-log */
+#define TCP_SHARED_CWND_ALLOWED 75 /* Use of a shared cwnd is allowed */
 #defineTCP_KEEPINIT128 /* N, time to establish connection */
 #defineTCP_KEEPIDLE256 /* L,N,X start keeplives after this 
period */
 #defineTCP_KEEPINTVL   512 /* L,N interval between keepalives */
@@ -190,10 +193,11 @@ struct tcphdr {
 #defineTCP_PCAP_IN 4096/* number of input packets to keep */
 #define TCP_FUNCTION_BLK 8192  /* Set the tcp function pointers to the 
specified stack */
 /* Options for Rack and BBR */
+#define TCP_RACK_MBUF_QUEUE   1050 /* Do we allow mbuf queuing if supported */
 #define TCP_RACK_PROP1051 /* RACK proportional rate reduction (bool) */
 #define TCP_RACK_TLP_REDUCE   1052 /* RACK TLP cwnd reduction (bool) */
 #define TCP_RACK_PACE_REDUCE  1053 /* RACK Pacing reduction factor (divisor) */
-#define TCP_RACK_PACE_MAX_SEG 1054 /* Max segments in a pace */
+#define TCP_RACK_PACE_MAX_SEG 1054 /* Max TSO size we will send  */
 #define TCP_RACK_PACE_ALWAYS  1055 /* Use the always pace method */
 #define TCP_RACK_PROP_RATE1056 /* The proportional reduction rate */
 #define TCP_RACK_PRR_SENDALOT 1057 /* Allow PRR to send more than one seg */
@@ -236,7 +240,7 @@ struct tcphdr {
 #define TCP_RACK_IDLE_REDUCE_HIGH 1092  /* Reduce the highest cwnd seen to IW 
on idle */
 #define TCP_RACK_MIN_PACE  1093/* Do we enforce rack min pace time */
 #define TCP_RACK_MIN_PACE_SEG  1094/* If so what is the seg threshould */
-#define TCP_RACK_GP_INCREASE   1094/* After 4.1 its the GP increase */
+#define TCP_RACK_GP_INCREASE   1094/* After 4.1 its the GP increase in 
older rack */
 #define TCP_RACK_TLP_USE   1095
 #define TCP_BBR_ACK_COMP_ALG   1096/* Not used */
 #define TCP_BBR_TMR_PACE_OH1096/* Recycled in 4.2 */
@@ -248,7 +252,8 @@ struct tcphdr {
 #define TCP_BBR_PROBE_RTT_GAIN 1101
 #define TCP_BBR_PROBE_RTT_LEN  1102
 #define TCP_BBR_SEND_IWND_IN_TSO 1103  /* Do we burst out whole iwin size 
chunks at start? */
-#define TCP_BBR_USE_RACK_CHEAT 1104/* Do we use the rack cheat for pacing 
rxt's */
+#define TCP_BBR_USE_RACK_RR 1104   /* Do we use the rack rapid recovery 
for pacing rxt's */
+#define TCP_BBR_USE_RACK_CHEAT TCP_BBR_USE_RACK_RR /* Compat. */
 #define TCP_BBR_HDWR_PACE  1105/* Enable/disable hardware pacing */
 #define TCP_BBR_UTTER_MAX_TSO  1106/* Do we enforce an utter max TSO size 
*/
 #define TCP_BBR_EXTRA_STATE1107/* Special exit-persist catch up */
@@ -256,6 +261,24 @@ struct tcphdr {
 #define TCP_BBR_MIN_TOPACEOUT  1109/* Do we suspend pacing until */
 #define TCP_BBR_TSTMP_RAISES   1110/* Can a timestamp measurement raise 
the b/w */
 #define TCP_BBR_POLICER_DETECT /* Turn on/off google mode policer 
detection */
+#define TCP_BBR_RACK_INIT_RATE 1112/* Set an initial pacing rate for when 
we have no b/w in kbits per sec */
+#define TCP_RACK_RR_CONF   1113 /* Rack rapid recovery configuration 
control*/
+#define TCP_RACK_CHEAT_NOT_CONF_RATE TCP_RACK_RR_CONF
+#define TCP_RACK_GP_INCREASE_CA   1114 /* GP increase for Congestion Avoidance 
*/
+#define TCP_RACK_GP_INCREASE_SS   1115 /* GP increase for Slow Start */
+#define TCP_RACK_GP_INCREASE_REC  1116 /* GP increase for Recovery */
+#define TCP_RACK_FORCE_MSEG1117/* Override to use the user set max-seg 
value */
+#define TCP_RACK_PACE_RATE_CA  1118 /* Pacing rate for Congestion Avoidance */
+#define TCP_RACK_PACE_RATE_SS  1119 /* Pacing rate for Slow Start */
+#define TCP_RACK_PACE_RATE_REC  1120 /* Pacing rate for Recovery */
+#define TCP_NO_PRR 1122 /* If pacing, don't use prr  */
+#define TCP_RACK_NONRXT_CFG_RATE 1123 /* In recovery does a non-rxt use the 
cfg rate */
+#define TCP_SHARED_CWND_ENABLE   

svn commit: r360384 - head/lib/libc/sys

2020-04-27 Thread Mark Johnston
Author: markj
Date: Mon Apr 27 16:12:32 2020
New Revision: 360384
URL: https://svnweb.freebsd.org/changeset/base/360384

Log:
  Document handling of connection-mode sockets by sendto(2).
  
  sendto(2), sendmsg(2) and sendmmsg(2) return ENOTCONN if a destination
  address is specified and the socket is not connected and the socket
  protocol does not automatically connect ("implied connect").  Document
  that.  Also document the fact that the destination address is ignored
  for connection-mode sockets if the socket is already connected.
  
  PR:   245817
  Submitted by: Erik Inge Bolsø 
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D24530

Modified:
  head/lib/libc/sys/send.2

Modified: head/lib/libc/sys/send.2
==
--- head/lib/libc/sys/send.2Mon Apr 27 16:11:59 2020(r360383)
+++ head/lib/libc/sys/send.2Mon Apr 27 16:12:32 2020(r360384)
@@ -28,7 +28,7 @@
 .\" From: @(#)send.2   8.2 (Berkeley) 2/21/94
 .\" $FreeBSD$
 .\"
-.Dd January 4, 2019
+.Dd April 27, 2020
 .Dt SEND 2
 .Os
 .Sh NAME
@@ -69,18 +69,35 @@ The
 function
 may be used only when the socket is in a
 .Em connected
-state, while
+state.
+The functions
 .Fn sendto ,
 .Fn sendmsg
 and
 .Fn sendmmsg
-may be used at any time.
+may be used at any time if the socket is connectionless-mode.
+If the socket is connection-mode, the protocol
+must support implied connect (currently
+.Xr tcp 4
+is the only protocol with support) or the socket must be in a
+connected state before use.
 .Pp
 The address of the target is given by
 .Fa to
 with
 .Fa tolen
-specifying its size.
+specifying its size, or the equivalent
+.Fa msg_name
+and
+.Fa msg_namelen
+in
+.Fa struct msghdr .
+If the socket is in a connected state, the target address passed to
+.Fn sendto ,
+.Fn sendmsg
+or
+.Fn sendmmsg
+is ignored.
 The length of the message is given by
 .Fa len .
 If the message is too long to pass atomically through the
@@ -195,6 +212,8 @@ An invalid descriptor was specified.
 The destination address is a broadcast address, and
 .Dv SO_BROADCAST
 has not been set on the socket.
+.It Bq Er ENOTCONN
+The socket is connection-mode but is not connected.
 .It Bq Er ENOTSOCK
 The argument
 .Fa s
@@ -242,6 +261,7 @@ This typically means that the socket
 is not connected.
 .El
 .Sh SEE ALSO
+.Xr connect 2 ,
 .Xr fcntl 2 ,
 .Xr getsockopt 2 ,
 .Xr recv 2 ,
___
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: r360383 - stable/12/usr.bin/systat

2020-04-27 Thread Kyle Evans
Author: kevans
Date: Mon Apr 27 16:11:59 2020
New Revision: 360383
URL: https://svnweb.freebsd.org/changeset/base/360383

Log:
  MFC r340361, r345804: catch up on systat in head/
  
  [Neither of these originally mine, but the latter commit referenced
  fixes an -fno-common issue and the former is a bugfix]
  
  r340361:
  Fix printing of 64-bit counters on 32-bit ppc platforms.
  
  Several statistic counters are uint64_t values and are printed by systat
  using %lu. This results in displaying wrong numbers. Use PRIu64 instead.
  While there, print variables of size_t using %zd.
  
  r345804:
  systat -zarc to display disk activities like -vm
  
  PR:   213310

Modified:
  stable/12/usr.bin/systat/devs.c
  stable/12/usr.bin/systat/devs.h
  stable/12/usr.bin/systat/iostat.c
  stable/12/usr.bin/systat/swap.c
  stable/12/usr.bin/systat/systat.h
  stable/12/usr.bin/systat/vmstat.c
  stable/12/usr.bin/systat/zarc.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.bin/systat/devs.c
==
--- stable/12/usr.bin/systat/devs.c Mon Apr 27 16:09:03 2020
(r360382)
+++ stable/12/usr.bin/systat/devs.c Mon Apr 27 16:11:59 2020
(r360383)
@@ -2,6 +2,7 @@
  * SPDX-License-Identifier: BSD-3-Clause
  *
  * Copyright (c) 1998 Kenneth D. Merry.
+ *   2015 Yoshihiro Ota
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -69,7 +70,6 @@ static const char sccsid[] = "@(#)disks.c 8.1 (Berkele
 #include 
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -84,6 +84,8 @@ typedef enum {
DS_MATCHTYPE_PATTERN
 } last_match_type;
 
+struct statinfo cur_dev, last_dev, run_dev;
+
 last_match_type last_type;
 struct device_selection *dev_select;
 long generation;
@@ -101,10 +103,8 @@ static int dsselect(const char *args, devstat_select_m
int maxshowdevs, struct statinfo *s1);
 
 int
-dsinit(int maxshowdevs, struct statinfo *s1, struct statinfo *s2 __unused,
-   struct statinfo *s3 __unused)
+dsinit(int maxshowdevs)
 {
-
/*
 * Make sure that the userland devstat version matches the kernel
 * devstat version.  If not, exit and print a message informing
@@ -113,6 +113,18 @@ dsinit(int maxshowdevs, struct statinfo *s1, struct st
if (devstat_checkversion(NULL) < 0)
errx(1, "%s", devstat_errbuf);
 
+   if( cur_dev.dinfo ) // init was alreay ran
+   return(1);
+
+   if ((num_devices = devstat_getnumdevs(NULL)) < 0) {
+   warnx("%s", devstat_errbuf);
+   return(0);
+   }
+
+   cur_dev.dinfo = calloc(1, sizeof(struct devinfo));
+   last_dev.dinfo = calloc(1, sizeof(struct devinfo));
+   run_dev.dinfo = calloc(1, sizeof(struct devinfo));
+
generation = 0;
num_devices = 0;
num_selected = 0;
@@ -120,11 +132,11 @@ dsinit(int maxshowdevs, struct statinfo *s1, struct st
select_generation = 0;
last_type = DS_MATCHTYPE_NONE;
 
-   if (devstat_getdevs(NULL, s1) == -1)
+   if (devstat_getdevs(NULL, &cur_dev) == -1)
errx(1, "%s", devstat_errbuf);
 
-   num_devices = s1->dinfo->numdevs;
-   generation = s1->dinfo->generation;
+   num_devices = cur_dev.dinfo->numdevs;
+   generation = cur_dev.dinfo->generation;
 
dev_select = NULL;
 
@@ -134,13 +146,31 @@ dsinit(int maxshowdevs, struct statinfo *s1, struct st
 * or 1.  If we get back -1, though, there is an error.
 */
if (devstat_selectdevs(&dev_select, &num_selected, &num_selections,
-   &select_generation, generation, s1->dinfo->devices, num_devices,
+   &select_generation, generation, cur_dev.dinfo->devices, num_devices,
NULL, 0, NULL, 0, DS_SELECT_ADD, maxshowdevs, 0) == -1)
errx(1, "%d %s", __LINE__, devstat_errbuf);
 
return(1);
 }
 
+
+void
+dsgetinfo(struct statinfo* dev)
+{
+   switch (devstat_getdevs(NULL, dev)) {
+   case -1:
+   errx(1, "%s", devstat_errbuf);
+   break;
+   case 1:
+   num_devices = dev->dinfo->numdevs;
+   generation = dev->dinfo->generation;
+   cmdkre("refresh", NULL);
+   break;
+   default:
+   break;
+   }
+}
+
 int
 dscmd(const char *cmd, const char *args, int maxshowdevs, struct statinfo *s1)
 {
@@ -330,4 +360,84 @@ dsselect(const char *args, devstat_select_mode select_
return(2);
}
return(1);
+}
+
+
+void
+dslabel(int maxdrives, int diskcol, int diskrow)
+{
+   int i, j;
+
+   mvprintw(diskrow, diskcol, "Disks");
+   mvprintw(diskrow + 1, diskcol, "KB/t");
+   mvprintw(diskrow + 2, diskcol, "tps");
+   mvprintw(diskrow + 3, diskcol, "MB/s");
+   mvprintw(diskrow + 4, diskcol, "%%busy");
+   /*
+

svn commit: r360382 - stable/12/contrib/dtc

2020-04-27 Thread Kyle Evans
Author: kevans
Date: Mon Apr 27 16:09:03 2020
New Revision: 360382
URL: https://svnweb.freebsd.org/changeset/base/360382

Log:
  dtc: fix the -fno-common build
  
  This is a direct commit to stable/12, as GPL dtc has been removed in head.
  
  -fno-common will become the default in GCC10/LLVM11.

Modified:
  stable/12/contrib/dtc/dtc-lexer.l

Modified: stable/12/contrib/dtc/dtc-lexer.l
==
--- stable/12/contrib/dtc/dtc-lexer.l   Mon Apr 27 15:59:34 2020
(r360381)
+++ stable/12/contrib/dtc/dtc-lexer.l   Mon Apr 27 16:09:03 2020
(r360382)
@@ -42,7 +42,7 @@ LINECOMMENT   "//".*\n
 YY_BUFFER_STATE include_stack[MAX_INCLUDE_NESTING];
 int include_stack_pointer = 0;
 
-YYLTYPE yylloc;
+extern YYLTYPE yylloc;
 extern bool treesource_error;
 
 /* CAUTION: this will stop working if we ever use yyless() or yyunput() */
___
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: r360381 - in head/tests/sys: fifo kern/pipe

2020-04-27 Thread Mark Johnston
Author: markj
Date: Mon Apr 27 15:59:34 2020
New Revision: 360381
URL: https://svnweb.freebsd.org/changeset/base/360381

Log:
  Add some regression tests for read and write kevents on pipes.
  
  Submitted by: Jan Kokemüller 
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D24528

Added:
  head/tests/sys/fifo/fifo_kqueue.c   (contents, props changed)
  head/tests/sys/kern/pipe/pipe_kqueue_test.c   (contents, props changed)
Modified:
  head/tests/sys/fifo/Makefile
  head/tests/sys/kern/pipe/Makefile

Modified: head/tests/sys/fifo/Makefile
==
--- head/tests/sys/fifo/MakefileMon Apr 27 15:59:19 2020
(r360380)
+++ head/tests/sys/fifo/MakefileMon Apr 27 15:59:34 2020
(r360381)
@@ -4,6 +4,7 @@ TESTSDIR=   ${TESTSBASE}/sys/fifo
 
 PLAIN_TESTS_C+=fifo_create
 PLAIN_TESTS_C+=fifo_io
+ATF_TESTS_C+=  fifo_kqueue
 PLAIN_TESTS_C+=fifo_misc
 PLAIN_TESTS_C+=fifo_open
 

Added: head/tests/sys/fifo/fifo_kqueue.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tests/sys/fifo/fifo_kqueue.c   Mon Apr 27 15:59:34 2020
(r360381)
@@ -0,0 +1,430 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2020 Jan Kokemüller
+ *
+ * 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 
+
+ATF_TC_WITHOUT_HEAD(fifo_kqueue__writes);
+ATF_TC_BODY(fifo_kqueue__writes, tc)
+{
+   int p[2] = { -1, -1 };
+
+   ATF_REQUIRE(mkfifo("testfifo", 0600) == 0);
+
+   ATF_REQUIRE((p[0] = open("testfifo",
+   O_RDONLY | O_CLOEXEC | O_NONBLOCK)) >= 0);
+   ATF_REQUIRE((p[1] = open("testfifo",
+   O_WRONLY | O_CLOEXEC | O_NONBLOCK)) >= 0);
+
+   int kq = kqueue();
+   ATF_REQUIRE(kq >= 0);
+
+   struct kevent kev[32];
+   EV_SET(&kev[0], p[1], EVFILT_WRITE, EV_ADD | EV_CLEAR, 0, 0, 0);
+   EV_SET(&kev[1], p[1], EVFILT_READ, EV_ADD | EV_CLEAR, 0, 0, 0);
+
+   ATF_REQUIRE(kevent(kq, kev, 2, NULL, 0, NULL) == 0);
+
+   /* A new writer should immediately get a EVFILT_WRITE event. */
+
+   ATF_REQUIRE(kevent(kq, NULL, 0, kev, nitems(kev),
+   &(struct timespec) { 0, 0 }) == 1);
+   ATF_REQUIRE(kev[0].ident == (uintptr_t)p[1]);
+   ATF_REQUIRE(kev[0].filter == EVFILT_WRITE);
+   ATF_REQUIRE(kev[0].flags == EV_CLEAR);
+   ATF_REQUIRE(kev[0].fflags == 0);
+   ATF_REQUIRE(kev[0].data == 16384);
+   ATF_REQUIRE(kev[0].udata == 0);
+
+   /* Filling up the pipe should make the EVFILT_WRITE disappear. */
+
+   char c = 0;
+   ssize_t r;
+   while ((r = write(p[1], &c, 1)) == 1) {
+   }
+   ATF_REQUIRE(r < 0);
+   ATF_REQUIRE(errno == EAGAIN || errno == EWOULDBLOCK);
+
+   ATF_REQUIRE(kevent(kq, NULL, 0, kev, nitems(kev),
+   &(struct timespec) { 0, 0 }) == 0);
+
+   /* Reading (PIPE_BUF - 1) bytes will not trigger a EVFILT_WRITE yet. */
+
+   for (int i = 0; i < PIPE_BUF - 1; ++i) {
+   ATF_REQUIRE(read(p[0], &c, 1) == 1);
+   }
+
+   ATF_REQUIRE(kevent(kq, NULL, 0, kev, nitems(kev),
+   &(struct timespec) { 0, 0 }) == 0);
+
+   /* Reading one additional byte triggers the EVFILT_WRITE. */
+
+   ATF_REQUIRE(read(p[0], &c, 1) == 1);
+
+   ATF_REQUIRE(kevent(kq, NULL, 0, kev, nitems(kev),
+   &(struct timespec) { 0, 0 }) == 1);
+   ATF_REQUIRE(kev[0].ident == (uint

svn commit: r360380 - in head: lib/libc/sys sys/kern

2020-04-27 Thread Mark Johnston
Author: markj
Date: Mon Apr 27 15:59:19 2020
New Revision: 360380
URL: https://svnweb.freebsd.org/changeset/base/360380

Log:
  Fix handling of EV_EOF for named pipes.
  
  Contrary to the kevent man page, EV_EOF on a fifo is not cleared by
  EV_CLEAR.  Modify the read and write filters to clear EV_EOF when the
  fifo's PIPE_EOF flag is clear, and update the man page to document the
  new behaviour.
  
  Modify the write filter to return the amount of buffer space available
  even if no readers are present.  This matches the behaviour for sockets.
  
  When reading from a pipe, only call pipeselwakeup() if some data was
  actually read.  This prevents the continuous re-triggering of a
  EVFILT_READ event on EOF when in edge-triggered mode.
  
  PR:   203366, 224615
  Submitted by: Jan Kokemüller 
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D24528

Modified:
  head/lib/libc/sys/kqueue.2
  head/sys/kern/sys_pipe.c

Modified: head/lib/libc/sys/kqueue.2
==
--- head/lib/libc/sys/kqueue.2  Mon Apr 27 15:59:07 2020(r360379)
+++ head/lib/libc/sys/kqueue.2  Mon Apr 27 15:59:19 2020(r360380)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 21, 2020
+.Dd April 27, 2020
 .Dt KQUEUE 2
 .Os
 .Sh NAME
@@ -323,8 +323,7 @@ When the last writer disconnects, the filter will set
 .Dv EV_EOF
 in
 .Va flags .
-This may be cleared by passing in
-.Dv EV_CLEAR ,
+This will be cleared by the filter when a new writer connects,
 at which point the
 filter will resume waiting for data to become available before
 returning.
@@ -343,9 +342,10 @@ For sockets, pipes
 and fifos,
 .Va data
 will contain the amount of space remaining in the write buffer.
-The filter will set EV_EOF when the reader disconnects, and for
-the fifo case, this may be cleared by use of
-.Dv EV_CLEAR .
+The filter will set
+.Dv EV_EOF
+when the reader disconnects, and for the fifo case, this will be cleared
+when a new reader connects.
 Note that this filter is not supported for vnodes or BPF devices.
 .Pp
 For sockets, the low water mark and socket error handling is

Modified: head/sys/kern/sys_pipe.c
==
--- head/sys/kern/sys_pipe.cMon Apr 27 15:59:07 2020(r360379)
+++ head/sys/kern/sys_pipe.cMon Apr 27 15:59:19 2020(r360380)
@@ -824,7 +824,12 @@ unlocked_error:
}
}
 
-   if ((rpipe->pipe_buffer.size - rpipe->pipe_buffer.cnt) >= PIPE_BUF)
+   /*
+* Only wake up writers if there was actually something read.
+* Otherwise, when calling read(2) at EOF, a spurious wakeup occurs.
+*/
+   if (nread > 0 &&
+   rpipe->pipe_buffer.size - rpipe->pipe_buffer.cnt >= PIPE_BUF)
pipeselwakeup(rpipe);
 
PIPE_UNLOCK(rpipe);
@@ -1726,48 +1731,54 @@ filt_pipedetach(struct knote *kn)
 static int
 filt_piperead(struct knote *kn, long hint)
 {
+   struct file *fp = kn->kn_fp;
struct pipe *rpipe = kn->kn_hook;
-   struct pipe *wpipe = rpipe->pipe_peer;
-   int ret;
 
PIPE_LOCK_ASSERT(rpipe, MA_OWNED);
kn->kn_data = rpipe->pipe_buffer.cnt;
if (kn->kn_data == 0)
kn->kn_data = rpipe->pipe_map.cnt;
 
-   if ((rpipe->pipe_state & PIPE_EOF) ||
-   wpipe->pipe_present != PIPE_ACTIVE ||
-   (wpipe->pipe_state & PIPE_EOF)) {
+   if ((rpipe->pipe_state & PIPE_EOF) != 0 &&
+   ((rpipe->pipe_state & PIPE_NAMED) == 0 ||
+   fp->f_pipegen != rpipe->pipe_wgen)) {
kn->kn_flags |= EV_EOF;
return (1);
}
-   ret = kn->kn_data > 0;
-   return ret;
+   kn->kn_flags &= ~EV_EOF;
+   return (kn->kn_data > 0);
 }
 
 /*ARGSUSED*/
 static int
 filt_pipewrite(struct knote *kn, long hint)
 {
-   struct pipe *wpipe;
+   struct pipe *wpipe = kn->kn_hook;
 
/*
 * If this end of the pipe is closed, the knote was removed from the
 * knlist and the list lock (i.e., the pipe lock) is therefore not held.
 */
-   wpipe = kn->kn_hook;
+   if (wpipe->pipe_present == PIPE_ACTIVE ||
+   (wpipe->pipe_state & PIPE_NAMED) != 0) {
+   PIPE_LOCK_ASSERT(wpipe, MA_OWNED);
+
+   if (wpipe->pipe_state & PIPE_DIRECTW) {
+   kn->kn_data = 0;
+   } else if (wpipe->pipe_buffer.size > 0) {
+   kn->kn_data = wpipe->pipe_buffer.size -
+   wpipe->pipe_buffer.cnt;
+   } else {
+   kn->kn_data = PIPE_BUF;
+   }
+   }
+
if (wpipe->pipe_present != PIPE_ACTIVE ||
(wpipe->pipe_state & PIPE_EOF)) {
-   kn->kn_data = 0;
kn->kn_flags |= EV_EOF;
return (1);
}
-   PIPE_LOCK_ASSERT(wpipe, MA_OWNED);

svn commit: r360379 - in head/sys: fs/fifofs kern

2020-04-27 Thread Mark Johnston
Author: markj
Date: Mon Apr 27 15:59:07 2020
New Revision: 360379
URL: https://svnweb.freebsd.org/changeset/base/360379

Log:
  Call pipeselwakeup() after toggling PIPE_EOF.
  
  This ensures that pipe_poll() and the pipe kqueue filters observe
  PIPE_EOF and set EV_EOF accordingly.  As a result an extra call to
  knote() after setting PIPE_EOF is unnecessary.
  
  Submitted by: Jan Kokemüller 
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D24528

Modified:
  head/sys/fs/fifofs/fifo_vnops.c
  head/sys/kern/sys_pipe.c

Modified: head/sys/fs/fifofs/fifo_vnops.c
==
--- head/sys/fs/fifofs/fifo_vnops.c Mon Apr 27 15:58:55 2020
(r360378)
+++ head/sys/fs/fifofs/fifo_vnops.c Mon Apr 27 15:59:07 2020
(r360379)
@@ -174,8 +174,10 @@ fifo_open(ap)
fip->fi_rgen++;
if (fip->fi_readers == 1) {
fpipe->pipe_state &= ~PIPE_EOF;
-   if (fip->fi_writers > 0)
+   if (fip->fi_writers > 0) {
wakeup(&fip->fi_writers);
+   pipeselwakeup(fpipe);
+   }
}
fp->f_pipegen = fpipe->pipe_wgen - fip->fi_writers;
}
@@ -190,8 +192,10 @@ fifo_open(ap)
fip->fi_wgen++;
if (fip->fi_writers == 1) {
fpipe->pipe_state &= ~PIPE_EOF;
-   if (fip->fi_readers > 0)
+   if (fip->fi_readers > 0) {
wakeup(&fip->fi_readers);
+   pipeselwakeup(fpipe);
+   }
}
}
if ((ap->a_mode & O_NONBLOCK) == 0) {
@@ -210,6 +214,7 @@ fifo_open(ap)
fpipe->pipe_state |= PIPE_EOF;
if (fpipe->pipe_state & PIPE_WANTW)
wakeup(fpipe);
+   pipeselwakeup(fpipe);
PIPE_UNLOCK(fpipe);
fifo_cleanup(vp);
}
@@ -238,6 +243,7 @@ fifo_open(ap)
if (fpipe->pipe_state & PIPE_WANTR)
wakeup(fpipe);
fpipe->pipe_wgen++;
+   pipeselwakeup(fpipe);
PIPE_UNLOCK(fpipe);
fifo_cleanup(vp);
}

Modified: head/sys/kern/sys_pipe.c
==
--- head/sys/kern/sys_pipe.cMon Apr 27 15:58:55 2020(r360378)
+++ head/sys/kern/sys_pipe.cMon Apr 27 15:59:07 2020(r360379)
@@ -1606,8 +1606,6 @@ pipeclose(struct pipe *cpipe)
pipelock(cpipe, 0);
pp = cpipe->pipe_pair;
 
-   pipeselwakeup(cpipe);
-
/*
 * If the other side is blocked, wake it up saying that
 * we want to close it down.
@@ -1621,16 +1619,16 @@ pipeclose(struct pipe *cpipe)
pipelock(cpipe, 0);
}
 
+   pipeselwakeup(cpipe);
+
/*
 * Disconnect from peer, if any.
 */
ppipe = cpipe->pipe_peer;
if (ppipe->pipe_present == PIPE_ACTIVE) {
-   pipeselwakeup(ppipe);
-
ppipe->pipe_state |= PIPE_EOF;
wakeup(ppipe);
-   KNOTE_LOCKED(&ppipe->pipe_sel.si_note, 0);
+   pipeselwakeup(ppipe);
}
 
/*
___
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: r360378 - head/sys/kern

2020-04-27 Thread Mark Johnston
Author: markj
Date: Mon Apr 27 15:58:55 2020
New Revision: 360378
URL: https://svnweb.freebsd.org/changeset/base/360378

Log:
  Avoid returning POLLIN if the pipe descriptor is not open for reading.
  
  Submitted by: Jan Kokemüller 
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D24528

Modified:
  head/sys/kern/sys_pipe.c

Modified: head/sys/kern/sys_pipe.c
==
--- head/sys/kern/sys_pipe.cMon Apr 27 14:35:39 2020(r360377)
+++ head/sys/kern/sys_pipe.cMon Apr 27 15:58:55 2020(r360378)
@@ -1430,7 +1430,8 @@ pipe_poll(struct file *fp, int events, struct ucred *a
 
if ((events & POLLINIGNEOF) == 0) {
if (rpipe->pipe_state & PIPE_EOF) {
-   revents |= (events & (POLLIN | POLLRDNORM));
+   if (fp->f_flag & FREAD)
+   revents |= (events & (POLLIN | POLLRDNORM));
if (wpipe->pipe_present != PIPE_ACTIVE ||
(wpipe->pipe_state & PIPE_EOF))
revents |= POLLHUP;
___
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: r360377 - in head/sys/dev/mlx5: . mlx5_en

2020-04-27 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 27 14:35:39 2020
New Revision: 360377
URL: https://svnweb.freebsd.org/changeset/base/360377

Log:
  Add support for reading temperature in mlx5en(4).
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_en/en.h
  head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  head/sys/dev/mlx5/mlx5_ifc.h

Modified: head/sys/dev/mlx5/mlx5_en/en.h
==
--- head/sys/dev/mlx5/mlx5_en/en.h  Mon Apr 27 14:03:24 2020
(r360376)
+++ head/sys/dev/mlx5/mlx5_en/en.h  Mon Apr 27 14:35:39 2020
(r360377)
@@ -728,6 +728,8 @@ struct mlx5e_params_ethtool {
u16 fec_avail_50x[MLX5E_MAX_FEC_50X];
u32 fec_mode_active;
u32 hw_mtu_msb;
+   s32 hw_val_temp[MLX5_MAX_TEMPERATURE];
+   u32 hw_num_temp;
 };
 
 struct mlx5e_cq {
@@ -1199,6 +1201,7 @@ void  mlx5e_update_sq_inline(struct mlx5e_sq *sq);
 void   mlx5e_refresh_sq_inline(struct mlx5e_priv *priv);
 intmlx5e_update_buf_lossy(struct mlx5e_priv *priv);
 intmlx5e_fec_update(struct mlx5e_priv *priv);
+intmlx5e_hw_temperature_update(struct mlx5e_priv *priv);
 
 if_snd_tag_alloc_t mlx5e_ul_snd_tag_alloc;
 if_snd_tag_modify_t mlx5e_ul_snd_tag_modify;

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Mon Apr 27 14:03:24 2020
(r360376)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Mon Apr 27 14:35:39 2020
(r360377)
@@ -821,6 +821,65 @@ mlx5e_cable_length_handler(SYSCTL_HANDLER_ARGS)
return (error);
 }
 
+static int
+mlx5e_hw_temperature_handler(SYSCTL_HANDLER_ARGS)
+{
+   struct mlx5e_priv *priv = arg1;
+   int err;
+
+   PRIV_LOCK(priv);
+   err = SYSCTL_OUT(req, priv->params_ethtool.hw_val_temp,
+   sizeof(priv->params_ethtool.hw_val_temp[0]) *
+   priv->params_ethtool.hw_num_temp);
+   if (err == 0 && req->newptr != NULL)
+   err = EOPNOTSUPP;
+   PRIV_UNLOCK(priv);
+   return (err);
+}
+
+int
+mlx5e_hw_temperature_update(struct mlx5e_priv *priv)
+{
+   int err;
+   u32 x;
+
+   if (priv->params_ethtool.hw_num_temp == 0) {
+   u32 out_cap[MLX5_ST_SZ_DW(mtcap)] = {};
+   const int sz_cap = MLX5_ST_SZ_BYTES(mtcap);
+   u32 value;
+
+   err = -mlx5_core_access_reg(priv->mdev, NULL, 0, out_cap, 
sz_cap,
+   MLX5_ACCESS_REG_SUMMARY_CTRL_ID_MTCAP, 0, 0);
+   if (err)
+   goto done;
+   value = MLX5_GET(mtcap, out_cap, sensor_count);
+   if (value == 0)
+   return (0);
+   if (value > MLX5_MAX_TEMPERATURE)
+   value = MLX5_MAX_TEMPERATURE;
+   /* update number of temperature sensors */
+   priv->params_ethtool.hw_num_temp = value;
+   }
+
+   for (x = 0; x != priv->params_ethtool.hw_num_temp; x++) {
+   u32 out_sensor[MLX5_ST_SZ_DW(mtmp_reg)] = {};
+   const int sz_sensor = MLX5_ST_SZ_BYTES(mtmp_reg);
+
+   MLX5_SET(mtmp_reg, out_sensor, sensor_index, x);
+
+   err = -mlx5_core_access_reg(priv->mdev, out_sensor, sz_sensor,
+   out_sensor, sz_sensor,
+   MLX5_ACCESS_REG_SUMMARY_CTRL_ID_MTMP, 0, 0);
+   if (err)
+   goto done;
+   /* convert from 0.125 celcius to millicelcius */
+   priv->params_ethtool.hw_val_temp[x] =
+   (s16)MLX5_GET(mtmp_reg, out_sensor, temperature) * 125;
+   }
+done:
+   return (err);
+}
+
 #defineMLX5_PARAM_OFFSET(n)\
 __offsetof(struct mlx5e_priv, params_ethtool.n)
 
@@ -1562,5 +1621,13 @@ mlx5e_create_ethtool(struct mlx5e_priv *priv)
CTLTYPE_UINT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
priv, 0, mlx5e_cable_length_handler, "IU",
"Set cable length in meters for xoff threshold 
calculation");
+   }
+
+   if (mlx5e_hw_temperature_update(priv) == 0) {
+   SYSCTL_ADD_PROC(&priv->sysctl_ctx, 
SYSCTL_CHILDREN(priv->sysctl_ifnet),
+   OID_AUTO, "hw_temperature",
+   CTLTYPE_S32 | CTLFLAG_RD | CTLFLAG_MPSAFE,
+   priv, 0, mlx5e_hw_temperature_handler, "I",
+   "HW temperature in millicelcius");
}
 }

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cMon Apr 27 14:03:24 2020
(r360376)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cMon Apr 27 14:35:39 2020
(r360377)
@@ -1042,6 +1042,15 @@ free_out:
  

svn commit: r360376 - stable/12/sbin/nvmecontrol

2020-04-27 Thread Alexander Motin
Author: mav
Date: Mon Apr 27 14:03:24 2020
New Revision: 360376
URL: https://svnweb.freebsd.org/changeset/base/360376

Log:
  MFC r360123: Allow namespace-id specification where it makes sense.
  
  It makes tool more convenient to not require user to explicitly convert
  namespace device name into controller device name.  There should be no
  changes to already existing syntaxes.

Modified:
  stable/12/sbin/nvmecontrol/firmware.c
  stable/12/sbin/nvmecontrol/ns.c
  stable/12/sbin/nvmecontrol/power.c
  stable/12/sbin/nvmecontrol/reset.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/nvmecontrol/firmware.c
==
--- stable/12/sbin/nvmecontrol/firmware.c   Mon Apr 27 14:02:24 2020
(r360375)
+++ stable/12/sbin/nvmecontrol/firmware.c   Mon Apr 27 14:03:24 2020
(r360376)
@@ -80,7 +80,7 @@ static const struct opts firmware_opts[] = {
 #undef OPT
 
 static const struct args firmware_args[] = {
-   { arg_string, &opt.dev, "controller-id" },
+   { arg_string, &opt.dev, "controller-id|namespace-id" },
{ arg_none, NULL, NULL },
 };
 
@@ -226,6 +226,7 @@ firmware(const struct cmd *f, int argc, char *argv[])
int activate_action, reboot_required;
charprompt[64];
void*buf = NULL;
+   char*path;
int32_t size = 0, nsid;
uint16_toacs_fw;
uint8_t fw_slot1_ro, fw_num_slots;
@@ -262,13 +263,12 @@ firmware(const struct cmd *f, int argc, char *argv[])
}
 
open_dev(opt.dev, &fd, 1, 1);
-
-   /* Check that a controller (and not a namespace) was specified. */
-   get_nsid(fd, NULL, &nsid);
+   get_nsid(fd, &path, &nsid);
if (nsid != 0) {
close(fd);
-   arg_help(argc, argv, f);
+   open_dev(path, &fd, 1, 1);
}
+   free(path);
 
read_controller_data(fd, &cdata);
 

Modified: stable/12/sbin/nvmecontrol/ns.c
==
--- stable/12/sbin/nvmecontrol/ns.c Mon Apr 27 14:02:24 2020
(r360375)
+++ stable/12/sbin/nvmecontrol/ns.c Mon Apr 27 14:03:24 2020
(r360376)
@@ -79,7 +79,7 @@ static struct active_options {
 };
 
 static const struct args active_args[] = {
-   { arg_string, &active_opt.dev, "controller-id" },
+   { arg_string, &active_opt.dev, "controller-id|namespace-id" },
{ arg_none, NULL, NULL },
 };
 
@@ -112,7 +112,7 @@ static struct controllers_options {
 };
 
 static const struct args controllers_args[] = {
-   { arg_string, &controllers_opt.dev, "controller-id" },
+   { arg_string, &controllers_opt.dev, "controller-id|namespace-id" },
{ arg_none, NULL, NULL },
 };
 
@@ -178,7 +178,7 @@ static const struct opts create_opts[] = {
 };
 
 static const struct args create_args[] = {
-   { arg_string, &create_opt.dev, "controller-id" },
+   { arg_string, &create_opt.dev, "controller-id|namespace-id" },
{ arg_none, NULL, NULL },
 };
 
@@ -208,7 +208,7 @@ static const struct opts delete_opts[] = {
 };
 
 static const struct args delete_args[] = {
-   { arg_string, &delete_opt.dev, "controller-id" },
+   { arg_string, &delete_opt.dev, "controller-id|namespace-id" },
{ arg_none, NULL, NULL },
 };
 
@@ -242,7 +242,7 @@ static const struct opts attach_opts[] = {
 };
 
 static const struct args attach_args[] = {
-   { arg_string, &attach_opt.dev, "controller-id" },
+   { arg_string, &attach_opt.dev, "controller-id|namespace-id" },
{ arg_none, NULL, NULL },
 };
 
@@ -272,7 +272,7 @@ static const struct opts attached_opts[] = {
 };
 
 static const struct args attached_args[] = {
-   { arg_string, &attached_opt.dev, "controller-id" },
+   { arg_string, &attached_opt.dev, "controller-id|namespace-id" },
{ arg_none, NULL, NULL },
 };
 
@@ -306,7 +306,7 @@ static const struct opts detach_opts[] = {
 };
 
 static const struct args detach_args[] = {
-   { arg_string, &detach_opt.dev, "controller-id" },
+   { arg_string, &detach_opt.dev, "controller-id|namespace-id" },
{ arg_none, NULL, NULL },
 };
 
@@ -344,7 +344,7 @@ static const struct opts identify_opts[] = {
 };
 
 static const struct args identify_args[] = {
-   { arg_string, &identify_opt.dev, "controller-id" },
+   { arg_string, &identify_opt.dev, "controller-id|namespace-id" },
{ arg_none, NULL, NULL },
 };
 
@@ -399,13 +399,28 @@ static void
 nsactive(const struct cmd *f, int argc, char *argv[])
 {
struct nvme_pt_command  pt;
+   struct nvme_controller_data cd;
int fd, i;
+   char*path;
+   uint32_t nsid;
uint32_t list[1024];
 
if (arg_parse(argc, argv, f

svn commit: r360375 - stable/12/sbin/nvmecontrol

2020-04-27 Thread Alexander Motin
Author: mav
Date: Mon Apr 27 14:02:24 2020
New Revision: 360375
URL: https://svnweb.freebsd.org/changeset/base/360375

Log:
  MFC r360117: Open device with O_RDONLY when command is non-invasive.
  
  This allows to use some of the subcommands against mounted nvd devices.

Modified:
  stable/12/sbin/nvmecontrol/identify.c
  stable/12/sbin/nvmecontrol/logpage.c
  stable/12/sbin/nvmecontrol/ns.c
  stable/12/sbin/nvmecontrol/nsid.c
  stable/12/sbin/nvmecontrol/nvmecontrol.c
  stable/12/sbin/nvmecontrol/nvmecontrol.h
  stable/12/sbin/nvmecontrol/resv.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/nvmecontrol/identify.c
==
--- stable/12/sbin/nvmecontrol/identify.c   Mon Apr 27 13:54:00 2020
(r360374)
+++ stable/12/sbin/nvmecontrol/identify.c   Mon Apr 27 14:02:24 2020
(r360375)
@@ -241,7 +241,7 @@ identify(const struct cmd *f, int argc, char *argv[])
if (arg_parse(argc, argv, f))
return;
 
-   open_dev(opt.dev, &fd, 1, 1);
+   open_dev(opt.dev, &fd, 0, 1);
get_nsid(fd, &path, &nsid);
if (nsid != 0) {
/*
@@ -251,7 +251,7 @@ identify(const struct cmd *f, int argc, char *argv[])
 * the IDENTIFY command itself.
 */
close(fd);
-   open_dev(path, &fd, 1, 1);
+   open_dev(path, &fd, 0, 1);
}
free(path);
if (opt.nsid != NONE)

Modified: stable/12/sbin/nvmecontrol/logpage.c
==
--- stable/12/sbin/nvmecontrol/logpage.cMon Apr 27 13:54:00 2020
(r360374)
+++ stable/12/sbin/nvmecontrol/logpage.cMon Apr 27 14:02:24 2020
(r360375)
@@ -687,13 +687,13 @@ logpage(const struct cmd *f, int argc, char *argv[])
fprintf(stderr, "Missing page_id (-p).\n");
arg_help(argc, argv, f);
}
-   open_dev(opt.dev, &fd, 1, 1);
+   open_dev(opt.dev, &fd, 0, 1);
get_nsid(fd, &path, &nsid);
if (nsid == 0) {
nsid = NVME_GLOBAL_NAMESPACE_TAG;
} else {
close(fd);
-   open_dev(path, &fd, 1, 1);
+   open_dev(path, &fd, 0, 1);
}
free(path);
 

Modified: stable/12/sbin/nvmecontrol/ns.c
==
--- stable/12/sbin/nvmecontrol/ns.c Mon Apr 27 13:54:00 2020
(r360374)
+++ stable/12/sbin/nvmecontrol/ns.c Mon Apr 27 14:02:24 2020
(r360375)
@@ -404,7 +404,7 @@ nsactive(const struct cmd *f, int argc, char *argv[])
 
if (arg_parse(argc, argv, f))
return;
-   open_dev(active_opt.dev, &fd, 1, 1);
+   open_dev(active_opt.dev, &fd, 0, 1);
 
memset(&pt, 0, sizeof(pt));
pt.cmd.opc = NVME_OPC_IDENTIFY;
@@ -435,7 +435,7 @@ nsallocated(const struct cmd *f, int argc, char *argv[
 
if (arg_parse(argc, argv, f))
return;
-   open_dev(active_opt.dev, &fd, 1, 1);
+   open_dev(active_opt.dev, &fd, 0, 1);
read_controller_data(fd, &cd);
 
/* Check that controller can execute this command. */
@@ -472,7 +472,7 @@ nscontrollers(const struct cmd *f, int argc, char *arg
 
if (arg_parse(argc, argv, f))
return;
-   open_dev(controllers_opt.dev, &fd, 1, 1);
+   open_dev(controllers_opt.dev, &fd, 0, 1);
read_controller_data(fd, &cd);
 
/* Check that controller can execute this command. */
@@ -781,7 +781,7 @@ nsattached(const struct cmd *f, int argc, char *argv[]
fprintf(stderr, "No valid NSID specified\n");
arg_help(argc, argv, f);
}
-   open_dev(attached_opt.dev, &fd, 1, 1);
+   open_dev(attached_opt.dev, &fd, 0, 1);
read_controller_data(fd, &cd);
 
/* Check that controller can execute this command. */
@@ -825,7 +825,7 @@ nsidentify(const struct cmd *f, int argc, char *argv[]
fprintf(stderr, "No valid NSID specified\n");
arg_help(argc, argv, f);
}
-   open_dev(identify_opt.dev, &fd, 1, 1);
+   open_dev(identify_opt.dev, &fd, 0, 1);
read_controller_data(fd, &cd);
 
/* Check that controller can execute this command. */

Modified: stable/12/sbin/nvmecontrol/nsid.c
==
--- stable/12/sbin/nvmecontrol/nsid.c   Mon Apr 27 13:54:00 2020
(r360374)
+++ stable/12/sbin/nvmecontrol/nsid.c   Mon Apr 27 14:02:24 2020
(r360375)
@@ -73,7 +73,7 @@ gnsid(const struct cmd *f, int argc, char *argv[])
if (arg_parse(argc, argv, f))
return;
 
-   open_dev(nsid_opt.dev, &fd, 1, 1);
+   open_dev(nsid_opt.dev, &fd, 0, 1);
get_nsid(fd, &path, &nsid);
close(fd);
printf("%s\t%u\n", 

svn commit: r360374 - in head/sys: kern sys

2020-04-27 Thread Mateusz Guzik
Author: mjg
Date: Mon Apr 27 13:54:00 2020
New Revision: 360374
URL: https://svnweb.freebsd.org/changeset/base/360374

Log:
  pwd: unbreak repeated calls to set_rootvnode
  
  Prior to the change the once set pointer would never be updated.
  
  Unbreaks reboot -r.
  
  Reported by:  Ross Gohlke

Modified:
  head/sys/kern/kern_descrip.c
  head/sys/kern/vfs_mountroot.c
  head/sys/sys/filedesc.h

Modified: head/sys/kern/kern_descrip.c
==
--- head/sys/kern/kern_descrip.cMon Apr 27 13:26:43 2020
(r360373)
+++ head/sys/kern/kern_descrip.cMon Apr 27 13:54:00 2020
(r360374)
@@ -3475,6 +3475,27 @@ pwd_ensure_dirs(void)
pwd_drop(oldpwd);
 }
 
+void
+pwd_set_rootvnode(void)
+{
+   struct filedesc *fdp;
+   struct pwd *oldpwd, *newpwd;
+
+   fdp = curproc->p_fd;
+
+   newpwd = pwd_alloc();
+   FILEDESC_XLOCK(fdp);
+   oldpwd = FILEDESC_XLOCKED_LOAD_PWD(fdp);
+   vrefact(rootvnode);
+   newpwd->pwd_cdir = rootvnode;
+   vrefact(rootvnode);
+   newpwd->pwd_rdir = rootvnode;
+   pwd_fill(oldpwd, newpwd);
+   pwd_set(fdp, newpwd);
+   FILEDESC_XUNLOCK(fdp);
+   pwd_drop(oldpwd);
+}
+
 /*
  * Scan all active processes and prisons to see if any of them have a current
  * or root directory of `olddp'. If so, replace them with the new mount point.

Modified: head/sys/kern/vfs_mountroot.c
==
--- head/sys/kern/vfs_mountroot.c   Mon Apr 27 13:26:43 2020
(r360373)
+++ head/sys/kern/vfs_mountroot.c   Mon Apr 27 13:54:00 2020
(r360374)
@@ -243,7 +243,7 @@ set_rootvnode(void)
 
VOP_UNLOCK(rootvnode);
 
-   pwd_ensure_dirs();
+   pwd_set_rootvnode();
 }
 
 static int

Modified: head/sys/sys/filedesc.h
==
--- head/sys/sys/filedesc.h Mon Apr 27 13:26:43 2020(r360373)
+++ head/sys/sys/filedesc.h Mon Apr 27 13:54:00 2020(r360374)
@@ -298,6 +298,7 @@ fd_modified(struct filedesc *fdp, int fd, seqc_t seqc)
 void   pwd_chdir(struct thread *td, struct vnode *vp);
 intpwd_chroot(struct thread *td, struct vnode *vp);
 void   pwd_ensure_dirs(void);
+void   pwd_set_rootvnode(void);
 
 struct pwd *pwd_hold_filedesc(struct filedesc *fdp);
 struct pwd *pwd_hold(struct thread *td);
___
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: r360373 - head/sys/dev/iwm

2020-04-27 Thread Mark Johnston
Author: markj
Date: Mon Apr 27 13:26:43 2020
New Revision: 360373
URL: https://svnweb.freebsd.org/changeset/base/360373

Log:
  iwm: Print the command code for any unhandled commands.
  
  Reported by:  Marc Veldman 
  MFC after:1 week

Modified:
  head/sys/dev/iwm/if_iwm.c

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Mon Apr 27 10:00:46 2020(r360372)
+++ head/sys/dev/iwm/if_iwm.c   Mon Apr 27 13:26:43 2020(r360373)
@@ -5623,9 +5623,8 @@ iwm_handle_rxb(struct iwm_softc *sc, struct mbuf *m)
 
default:
device_printf(sc->sc_dev,
-   "frame %d/%d %x UNHANDLED (this should "
-   "not happen)\n", qid & ~0x80, idx,
-   pkt->len_n_flags);
+   "code %x, frame %d/%d %x unhandled\n",
+   code, qid & ~0x80, idx, pkt->len_n_flags);
break;
}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r360372 - head/sys/netgraph

2020-04-27 Thread Aleksandr Fedorov
Author: afedorov
Date: Mon Apr 27 10:00:46 2020
New Revision: 360372
URL: https://svnweb.freebsd.org/changeset/base/360372

Log:
  ng_eiface: fix kernel panic due to the racecondition in ng_eiface shutdown.
  
  PR:   244247
  Reported by:  Vladislav V. Prodan 
  Reviewed by:  vmaffione, lutz_donnerhacke.de
  Approved by:  vmaffione (mentor)
  Sponsored by: vstack.com
  Differential Revision:https://reviews.freebsd.org/D24557

Modified:
  head/sys/netgraph/ng_eiface.c

Modified: head/sys/netgraph/ng_eiface.c
==
--- head/sys/netgraph/ng_eiface.c   Mon Apr 27 09:45:19 2020
(r360371)
+++ head/sys/netgraph/ng_eiface.c   Mon Apr 27 10:00:46 2020
(r360372)
@@ -623,8 +623,8 @@ ng_eiface_rmnode(node_p node)
 * hence we have to change the current vnet context here.
 */
CURVNET_SET_QUIET(ifp->if_vnet);
-   ifmedia_removeall(&priv->media);
ether_ifdetach(ifp);
+   ifmedia_removeall(&priv->media);
if_free(ifp);
CURVNET_RESTORE();
free_unr(V_ng_eiface_unit, priv->unit);
___
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: r360371 - stable/12/lib/libc/sys

2020-04-27 Thread Mateusz Piotrowski
Author: 0mp (doc,ports committer)
Date: Mon Apr 27 09:45:19 2020
New Revision: 360371
URL: https://svnweb.freebsd.org/changeset/base/360371

Log:
  MFC 360284:
  
  Fix a typo
  
  Reported by:  pstef

Modified:
  stable/12/lib/libc/sys/procctl.2
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libc/sys/procctl.2
==
--- stable/12/lib/libc/sys/procctl.2Mon Apr 27 09:44:37 2020
(r360370)
+++ stable/12/lib/libc/sys/procctl.2Mon Apr 27 09:45:19 2020
(r360371)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 31, 2019
+.Dd April 25, 2020
 .Dt PROCCTL 2
 .Os
 .Sh NAME
@@ -631,7 +631,7 @@ or invalid signal number.
 .El
 .Sh SEE ALSO
 .Xr dtrace 1 ,
-.Xr cap_enter 2,
+.Xr cap_enter 2 ,
 .Xr kill 2 ,
 .Xr ktrace 2 ,
 .Xr ptrace 2 ,
___
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: r360370 - stable/11/lib/libc/sys

2020-04-27 Thread Mateusz Piotrowski
Author: 0mp (doc,ports committer)
Date: Mon Apr 27 09:44:37 2020
New Revision: 360370
URL: https://svnweb.freebsd.org/changeset/base/360370

Log:
  MFC 360284:
  
  Fix a typo
  
  Reported by:  pstef

Modified:
  stable/11/lib/libc/sys/procctl.2
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/sys/procctl.2
==
--- stable/11/lib/libc/sys/procctl.2Mon Apr 27 09:13:22 2020
(r360369)
+++ stable/11/lib/libc/sys/procctl.2Mon Apr 27 09:44:37 2020
(r360370)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 31, 2019
+.Dd April 25, 2020
 .Dt PROCCTL 2
 .Os
 .Sh NAME
@@ -591,7 +591,7 @@ or invalid signal number.
 .El
 .Sh SEE ALSO
 .Xr dtrace 1 ,
-.Xr cap_enter 2,
+.Xr cap_enter 2 ,
 .Xr kill 2 ,
 .Xr ktrace 2 ,
 .Xr ptrace 2 ,
___
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: r360369 - head/usr.sbin/bluetooth/hccontrol

2020-04-27 Thread Takanori Watanabe
Author: takawata
Date: Mon Apr 27 09:13:22 2020
New Revision: 360369
URL: https://svnweb.freebsd.org/changeset/base/360369

Log:
  Resolve vendor id to string.

Modified:
  head/usr.sbin/bluetooth/hccontrol/node.c

Modified: head/usr.sbin/bluetooth/hccontrol/node.c
==
--- head/usr.sbin/bluetooth/hccontrol/node.cMon Apr 27 05:35:26 2020
(r360368)
+++ head/usr.sbin/bluetooth/hccontrol/node.cMon Apr 27 09:13:22 2020
(r360369)
@@ -267,7 +267,8 @@ static int  hci_dump_adv(uint8_t *data, int length)
case 0xff:
if (elemlen < 2)
break;
-   printf("Vendor:%04x:", data[0]|data[1]<<8);
+   printf("Vendor:%s:",
+  hci_manufacturer2str(data[0]|data[1]<<8));
for (i = 2; i < MIN(length,elemlen); i++) {
printf("%02x ",data[i]);
}
___
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"