svn commit: r368744 - in head: share/man/man9 sys/fs/nfs

2020-12-17 Thread Brooks Davis
Author: brooks
Date: Thu Dec 17 21:58:10 2020
New Revision: 368744
URL: https://svnweb.freebsd.org/changeset/base/368744

Log:
  VFS_QUOTACTL: Remove needless casts of arg
  
  The argument is a void * so there's no need to cast it to caddr_t.
  
  Update documentation to match function decleration.
  
  Reviewed by:  freqlabs
  Obtained from:CheriBSD
  MFC after:1 week
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D27093

Modified:
  head/share/man/man9/VFS_QUOTACTL.9
  head/sys/fs/nfs/nfs_commonsubs.c

Modified: head/share/man/man9/VFS_QUOTACTL.9
==
--- head/share/man/man9/VFS_QUOTACTL.9  Thu Dec 17 21:54:25 2020
(r368743)
+++ head/share/man/man9/VFS_QUOTACTL.9  Thu Dec 17 21:58:10 2020
(r368744)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 23, 2009
+.Dd December 17, 2020
 .Dt VFS_QUOTACTL 9
 .Os
 .Sh NAME
@@ -39,7 +39,7 @@
 .In sys/mount.h
 .In sys/vnode.h
 .Ft int
-.Fn VFS_QUOTACTL "struct mount *mp" "int cmds" "uid_t uid" "caddr_t arg"
+.Fn VFS_QUOTACTL "struct mount *mp" "int cmds" "uid_t uid" "void *arg"
 .Sh DESCRIPTION
 Implement file system quotas.
 See

Modified: head/sys/fs/nfs/nfs_commonsubs.c
==
--- head/sys/fs/nfs/nfs_commonsubs.cThu Dec 17 21:54:25 2020
(r368743)
+++ head/sys/fs/nfs/nfs_commonsubs.cThu Dec 17 21:58:10 2020
(r368744)
@@ -1903,7 +1903,7 @@ nfsv4_loadattr(struct nfsrv_descript *nd, vnode_t vp,
savuid = p->p_cred->p_ruid;
p->p_cred->p_ruid = cred->cr_uid;
if (!VFS_QUOTACTL(vp->v_mount,QCMD(Q_GETQUOTA,
-   USRQUOTA), cred->cr_uid, (caddr_t)))
+   USRQUOTA), cred->cr_uid, ))
freenum = min(dqb.dqb_bhardlimit, freenum);
p->p_cred->p_ruid = savuid;
 #endif /* QUOTA */
@@ -1932,7 +1932,7 @@ nfsv4_loadattr(struct nfsrv_descript *nd, vnode_t vp,
savuid = p->p_cred->p_ruid;
p->p_cred->p_ruid = cred->cr_uid;
if (!VFS_QUOTACTL(vp->v_mount,QCMD(Q_GETQUOTA,
-   USRQUOTA), cred->cr_uid, (caddr_t)))
+   USRQUOTA), cred->cr_uid, ))
freenum = min(dqb.dqb_bsoftlimit, freenum);
p->p_cred->p_ruid = savuid;
 #endif /* QUOTA */
@@ -1958,7 +1958,7 @@ nfsv4_loadattr(struct nfsrv_descript *nd, vnode_t vp,
savuid = p->p_cred->p_ruid;
p->p_cred->p_ruid = cred->cr_uid;
if (!VFS_QUOTACTL(vp->v_mount,QCMD(Q_GETQUOTA,
-   USRQUOTA), cred->cr_uid, (caddr_t)))
+   USRQUOTA), cred->cr_uid, ))
freenum = dqb.dqb_curblocks;
p->p_cred->p_ruid = savuid;
 #endif /* QUOTA */
@@ -2704,7 +2704,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd, struct mount
savuid = p->p_cred->p_ruid;
p->p_cred->p_ruid = cred->cr_uid;
if (!VFS_QUOTACTL(mp, QCMD(Q_GETQUOTA,USRQUOTA),
-   cred->cr_uid, (caddr_t)))
+   cred->cr_uid, ))
freenum = min(dqb.dqb_isoftlimit-dqb.dqb_curinodes,
freenum);
p->p_cred->p_ruid = savuid;
@@ -2811,7 +2811,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd, struct mount
savuid = p->p_cred->p_ruid;
p->p_cred->p_ruid = cred->cr_uid;
if (!VFS_QUOTACTL(mp, QCMD(Q_GETQUOTA,USRQUOTA),
-   cred->cr_uid, (caddr_t)))
+   cred->cr_uid, ))
freenum = min(dqb.dqb_bhardlimit, freenum);
p->p_cred->p_ruid = savuid;
 #endif /* QUOTA */
@@ -2835,7 +2835,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd, struct mount
savuid = p->p_cred->p_ruid;
p->p_cred->p_ruid = cred->cr_uid;
if (!VFS_QUOTACTL(mp, QCMD(Q_GETQUOTA,USRQUOTA),
-   cred->cr_uid, (caddr_t)))
+   cred->cr_uid, ))
freenum = min(dqb.dqb_bsoftlimit, freenum);
p->p_cred->p_ruid = savuid;
 #endif /* QUOTA */
@@ -2856,7 +2856,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd, struct mount
savuid = p->p_cred->p_ruid;
p->p_cred->p_ruid = cred->cr_uid;
if (!VFS_QUOTACTL(mp, QCMD(Q_GETQUOTA,USRQUOTA),
-   cred->cr_uid, 

svn commit: r368709 - head/sys/conf

2020-12-16 Thread Brooks Davis
Author: brooks
Date: Thu Dec 17 00:00:21 2020
New Revision: 368709
URL: https://svnweb.freebsd.org/changeset/base/368709

Log:
  newvers.sh: Speed up git_tree_modified
  
  We're looking for file content differences, so ask the question of git
  more directly. This helps a lot, saving tens of thousands of fork()s,
  when the builder and editor see different stat() results (e.g., UIDs),
  as they might with containers.
  
  Submitted by: Nathaniel Wesley Filardo 
  Reviewed by:  bdrewery, emaste, imp
  Obtained from:CheriBSD
  MFC after:3 days
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D27646

Modified:
  head/sys/conf/newvers.sh

Modified: head/sys/conf/newvers.sh
==
--- head/sys/conf/newvers.shWed Dec 16 22:25:40 2020(r368708)
+++ head/sys/conf/newvers.shThu Dec 17 00:00:21 2020(r368709)
@@ -162,29 +162,7 @@ findvcs()
 
 git_tree_modified()
 {
-   # git diff-index lists both files that are known to have changes as
-   # well as those with metadata that does not match what is recorded in
-   # git's internal state.  The latter case is indicated by an all-zero
-   # destination file hash.
-
-   local fifo
-
-   fifo=$(mktemp -u)
-   mkfifo -m 600 $fifo || exit 1
-   $git_cmd --work-tree=${VCSTOP} diff-index HEAD > $fifo &
-   while read smode dmode ssha dsha status file; do
-   if ! expr $dsha : '^00*$' >/dev/null; then
-   rm $fifo
-   return 0
-   fi
-   if ! $git_cmd --work-tree=${VCSTOP} diff --quiet -- "${file}"; 
then
-   rm $fifo
-   return 0
-   fi
-   done < $fifo
-   # No files with content differences.
-   rm $fifo
-   return 1
+   $git_cmd "--work-tree=${VCSTOP}" -c core.checkStat=minimal -c 
core.fileMode=off diff --quiet
 }
 
 LC_ALL=C; export LC_ALL
___
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: r368672 - svnadmin/conf

2020-12-15 Thread Brooks Davis
Author: brooks
Date: Tue Dec 15 18:51:11 2020
New Revision: 368672
URL: https://svnweb.freebsd.org/changeset/base/368672

Log:
  Release jrtc27 from mentorship
  
  Approved by:  jhb (co-mentor)

Modified:
  svnadmin/conf/mentors

Modified: svnadmin/conf/mentors
==
--- svnadmin/conf/mentors   Tue Dec 15 18:46:23 2020(r368671)
+++ svnadmin/conf/mentors   Tue Dec 15 18:51:11 2020(r368672)
@@ -17,7 +17,6 @@ bryanvgrehan
 gordon delphij Co-mentor: emaste
 jceel  trasz
 jkhrwatson
-jrtc27 brooks  Co-mentor: jhb
 kadesaiken Co-mentor: scottl, ambrisko
 mjoras rstone
 nick   philip  Co-mentor: kp
___
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: r368671 - in head/sys: dev/hme modules/hme

2020-12-15 Thread Brooks Davis
Author: brooks
Date: Tue Dec 15 18:46:23 2020
New Revision: 368671
URL: https://svnweb.freebsd.org/changeset/base/368671

Log:
  hme(4): remove stray directories
  
  Sponsored by:  DARPA
  Differential Revision:https://reviews.freebsd.org/D27526

Deleted:
  head/sys/dev/hme/
  head/sys/modules/hme/
___
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: r368670 - head/tools/kerneldoc/subsys

2020-12-15 Thread Brooks Davis
Author: brooks
Date: Tue Dec 15 18:44:41 2020
New Revision: 368670
URL: https://svnweb.freebsd.org/changeset/base/368670

Log:
  Remove Doxyfiles for removed drivers
  
  Reported by:  emaste

Deleted:
  head/tools/kerneldoc/subsys/Doxyfile-dev_auxio
  head/tools/kerneldoc/subsys/Doxyfile-dev_bktr
  head/tools/kerneldoc/subsys/Doxyfile-dev_bm
  head/tools/kerneldoc/subsys/Doxyfile-dev_cs
  head/tools/kerneldoc/subsys/Doxyfile-dev_cy
  head/tools/kerneldoc/subsys/Doxyfile-dev_de
  head/tools/kerneldoc/subsys/Doxyfile-dev_ed
  head/tools/kerneldoc/subsys/Doxyfile-dev_ep
  head/tools/kerneldoc/subsys/Doxyfile-dev_ex
  head/tools/kerneldoc/subsys/Doxyfile-dev_fe
  head/tools/kerneldoc/subsys/Doxyfile-dev_hme
  head/tools/kerneldoc/subsys/Doxyfile-dev_nand
  head/tools/kerneldoc/subsys/Doxyfile-dev_pcn
  head/tools/kerneldoc/subsys/Doxyfile-dev_rc
  head/tools/kerneldoc/subsys/Doxyfile-dev_rp
  head/tools/kerneldoc/subsys/Doxyfile-dev_sf
  head/tools/kerneldoc/subsys/Doxyfile-dev_sio
  head/tools/kerneldoc/subsys/Doxyfile-dev_sn
  head/tools/kerneldoc/subsys/Doxyfile-dev_tl
  head/tools/kerneldoc/subsys/Doxyfile-dev_trm
  head/tools/kerneldoc/subsys/Doxyfile-dev_tx
  head/tools/kerneldoc/subsys/Doxyfile-dev_txp
  head/tools/kerneldoc/subsys/Doxyfile-dev_vx
  head/tools/kerneldoc/subsys/Doxyfile-dev_wb
  head/tools/kerneldoc/subsys/Doxyfile-dev_xe
___
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: r368650 - in stable/11: share/man/man4 sys/dev/if_ndis

2020-12-14 Thread Brooks Davis
Author: brooks
Date: Mon Dec 14 22:53:19 2020
New Revision: 368650
URL: https://svnweb.freebsd.org/changeset/base/368650

Log:
  MFC r368561:
  
  ndis(4): expand deprecation to the whole driver
  
  nids(4) was a clever idea in the early 2000's when the market was
  flooded with 10/100 NICs with Windows-only drivers, but that hasn't been
  the case for ages and the driver has had no meaningful maintenance in
  ages. It only supports Windows-XP era drivers.
  
  Reviewed by:  imp, bcr
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D27527

Modified:
  stable/11/share/man/man4/ndis.4
  stable/11/sys/dev/if_ndis/if_ndis_pccard.c
  stable/11/sys/dev/if_ndis/if_ndis_pci.c
  stable/11/sys/dev/if_ndis/if_ndis_usb.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man4/ndis.4
==
--- stable/11/share/man/man4/ndis.4 Mon Dec 14 22:52:29 2020
(r368649)
+++ stable/11/share/man/man4/ndis.4 Mon Dec 14 22:53:19 2020
(r368650)
@@ -120,6 +120,9 @@ driver-specific registry keys to control the media set
 which can be configured via the
 .Xr sysctl 8
 command.
+.Sh DEPRECATION NOTICE
+This driver is scheduled for removal prior to the release of
+.Fx 13.0
 .Sh DIAGNOSTICS
 .Bl -diag
 .It "ndis%d: watchdog timeout"

Modified: stable/11/sys/dev/if_ndis/if_ndis_pccard.c
==
--- stable/11/sys/dev/if_ndis/if_ndis_pccard.c  Mon Dec 14 22:52:29 2020
(r368649)
+++ stable/11/sys/dev/if_ndis/if_ndis_pccard.c  Mon Dec 14 22:53:19 2020
(r368650)
@@ -301,6 +301,8 @@ ndis_attach_pccard(dev)
}
 
error = ndis_attach(dev);
+   if (error == 0)
+   gone_in_dev(dev, 13, "ndis removed");
 
 fail:
return(error);

Modified: stable/11/sys/dev/if_ndis/if_ndis_pci.c
==
--- stable/11/sys/dev/if_ndis/if_ndis_pci.c Mon Dec 14 22:52:29 2020
(r368649)
+++ stable/11/sys/dev/if_ndis/if_ndis_pci.c Mon Dec 14 22:53:19 2020
(r368650)
@@ -335,6 +335,9 @@ ndis_attach_pci(dev)
sc->ndis_devidx = devidx;
 
error = ndis_attach(dev);
+   if (error == 0)
+   gone_in_dev(dev, 13, "ndis removed");
+
 
 fail:
return(error);

Modified: stable/11/sys/dev/if_ndis/if_ndis_usb.c
==
--- stable/11/sys/dev/if_ndis/if_ndis_usb.c Mon Dec 14 22:52:29 2020
(r368649)
+++ stable/11/sys/dev/if_ndis/if_ndis_usb.c Mon Dec 14 22:53:19 2020
(r368650)
@@ -196,6 +196,8 @@ ndisusb_attach(device_t self)
if (ndis_attach(self) != 0)
return (ENXIO);
 
+   gone_in_dev(self, 13, "ndis removed");
+
return (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: r368646 - in stable/12: share/man/man4 sys/dev/if_ndis

2020-12-14 Thread Brooks Davis
Author: brooks
Date: Mon Dec 14 22:07:07 2020
New Revision: 368646
URL: https://svnweb.freebsd.org/changeset/base/368646

Log:
  MFC r368561:
  
  ndis(4): expand deprecation to the whole driver
  
  nids(4) was a clever idea in the early 2000's when the market was
  flooded with 10/100 NICs with Windows-only drivers, but that hasn't been
  the case for ages and the driver has had no meaningful maintenance in
  ages. It only supports Windows-XP era drivers.
  
  Reviewed by:  imp, bcr
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D27527

Modified:
  stable/12/share/man/man4/ndis.4
  stable/12/sys/dev/if_ndis/if_ndis_pccard.c
  stable/12/sys/dev/if_ndis/if_ndis_pci.c
  stable/12/sys/dev/if_ndis/if_ndis_usb.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/man/man4/ndis.4
==
--- stable/12/share/man/man4/ndis.4 Mon Dec 14 22:03:13 2020
(r368645)
+++ stable/12/share/man/man4/ndis.4 Mon Dec 14 22:07:07 2020
(r368646)
@@ -121,7 +121,7 @@ which can be configured via the
 .Xr sysctl 8
 command.
 .Sh DEPRECATION NOTICE
-The PC Card attachment of this driver is scheduled for removal prior to the 
release of
+This driver is scheduled for removal prior to the release of
 .Fx 13.0
 .Sh DIAGNOSTICS
 .Bl -diag

Modified: stable/12/sys/dev/if_ndis/if_ndis_pccard.c
==
--- stable/12/sys/dev/if_ndis/if_ndis_pccard.c  Mon Dec 14 22:03:13 2020
(r368645)
+++ stable/12/sys/dev/if_ndis/if_ndis_pccard.c  Mon Dec 14 22:07:07 2020
(r368646)
@@ -304,7 +304,7 @@ ndis_attach_pccard(dev)
 
error = ndis_attach(dev);
if (error == 0)
-   gone_in_dev(dev, 13, "pccard removed");
+   gone_in_dev(dev, 13, "ndis removed");
 
 fail:
return(error);

Modified: stable/12/sys/dev/if_ndis/if_ndis_pci.c
==
--- stable/12/sys/dev/if_ndis/if_ndis_pci.c Mon Dec 14 22:03:13 2020
(r368645)
+++ stable/12/sys/dev/if_ndis/if_ndis_pci.c Mon Dec 14 22:07:07 2020
(r368646)
@@ -337,6 +337,9 @@ ndis_attach_pci(dev)
sc->ndis_devidx = devidx;
 
error = ndis_attach(dev);
+   if (error == 0)
+   gone_in_dev(dev, 13, "ndis removed");
+
 
 fail:
return(error);

Modified: stable/12/sys/dev/if_ndis/if_ndis_usb.c
==
--- stable/12/sys/dev/if_ndis/if_ndis_usb.c Mon Dec 14 22:03:13 2020
(r368645)
+++ stable/12/sys/dev/if_ndis/if_ndis_usb.c Mon Dec 14 22:07:07 2020
(r368646)
@@ -198,6 +198,8 @@ ndisusb_attach(device_t self)
if (ndis_attach(self) != 0)
return (ENXIO);
 
+   gone_in_dev(self, 13, "ndis removed");
+
return (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: r368645 - stable/11/sys/net

2020-12-14 Thread Brooks Davis
Author: brooks
Date: Mon Dec 14 22:03:13 2020
New Revision: 368645
URL: https://svnweb.freebsd.org/changeset/base/368645

Log:
  MFC r368543:
  
  style(9): Correct whitespace in struct definitions
  
  struct ifconf and struct ifreq use the odd style "structfoo".
  struct ifdrv seems to have tried to follow this but was committed with
  spaces in place of most tabs resulting in "structifdrv".

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

Modified: stable/11/sys/net/if.h
==
--- stable/11/sys/net/if.h  Mon Dec 14 21:56:15 2020(r368644)
+++ stable/11/sys/net/if.h  Mon Dec 14 22:03:13 2020(r368645)
@@ -380,7 +380,7 @@ struct ifreq_buffer {
  * definitions which begin with ifr_name.  The
  * remainder may be interface specific.
  */
-struct ifreq {
+struct ifreq {
charifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */
union {
struct  sockaddr ifru_addr;
@@ -454,11 +454,11 @@ struct ifmediareq {
int *ifm_ulist; /* media words */
 };
 
-struct  ifdrv {
-   charifd_name[IFNAMSIZ]; /* if name, e.g. "en0" */
-   unsigned long   ifd_cmd;
-   size_t  ifd_len;
-   void*ifd_data;
+struct ifdrv {
+   charifd_name[IFNAMSIZ]; /* if name, e.g. "en0" */
+   unsigned long   ifd_cmd;
+   size_t  ifd_len;
+   void*ifd_data;
 };
 
 /* 
@@ -480,7 +480,7 @@ struct ifstat {
  * for machine (useful for programs which
  * must know all networks accessible).
  */
-struct ifconf {
+struct ifconf {
int ifc_len;/* size of associated buffer */
union {
caddr_t ifcu_buf;
___
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: r368644 - stable/12/sys/net

2020-12-14 Thread Brooks Davis
Author: brooks
Date: Mon Dec 14 21:56:15 2020
New Revision: 368644
URL: https://svnweb.freebsd.org/changeset/base/368644

Log:
  MFC r368543:
  
  style(9): Correct whitespace in struct definitions
  
  struct ifconf and struct ifreq use the odd style "structfoo".
  struct ifdrv seems to have tried to follow this but was committed with
  spaces in place of most tabs resulting in "structifdrv".

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

Modified: stable/12/sys/net/if.h
==
--- stable/12/sys/net/if.h  Mon Dec 14 21:20:55 2020(r368643)
+++ stable/12/sys/net/if.h  Mon Dec 14 21:56:15 2020(r368644)
@@ -389,7 +389,7 @@ struct ifreq_buffer {
  * definitions which begin with ifr_name.  The
  * remainder may be interface specific.
  */
-struct ifreq {
+struct ifreq {
charifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */
union {
struct  sockaddr ifru_addr;
@@ -463,11 +463,11 @@ struct ifmediareq {
int *ifm_ulist; /* media words */
 };
 
-struct  ifdrv {
-   charifd_name[IFNAMSIZ]; /* if name, e.g. "en0" */
-   unsigned long   ifd_cmd;
-   size_t  ifd_len;
-   void*ifd_data;
+struct ifdrv {
+   charifd_name[IFNAMSIZ]; /* if name, e.g. "en0" */
+   unsigned long   ifd_cmd;
+   size_t  ifd_len;
+   void*ifd_data;
 };
 
 /* 
@@ -489,7 +489,7 @@ struct ifstat {
  * for machine (useful for programs which
  * must know all networks accessible).
  */
-struct ifconf {
+struct ifconf {
int ifc_len;/* size of associated buffer */
union {
caddr_t ifcu_buf;
___
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: r368561 - in head: share/man/man4 sys/dev/if_ndis

2020-12-11 Thread Brooks Davis
Author: brooks
Date: Fri Dec 11 21:51:50 2020
New Revision: 368561
URL: https://svnweb.freebsd.org/changeset/base/368561

Log:
  ndis(4): expand deprecation to the whole driver
  
  nids(4) was a clever idea in the early 2000's when the market was
  flooded with 10/100 NICs with Windows-only drivers, but that hasn't been
  the case for ages and the driver has had no meaningful maintenance in
  ages. It only supports Windows-XP era drivers.
  
  Reviewed by:  imp, bcr
  MFC after:3 days
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D27527

Modified:
  head/share/man/man4/ndis.4
  head/sys/dev/if_ndis/if_ndis_pccard.c
  head/sys/dev/if_ndis/if_ndis_pci.c
  head/sys/dev/if_ndis/if_ndis_usb.c

Modified: head/share/man/man4/ndis.4
==
--- head/share/man/man4/ndis.4  Fri Dec 11 21:43:44 2020(r368560)
+++ head/share/man/man4/ndis.4  Fri Dec 11 21:51:50 2020(r368561)
@@ -121,7 +121,7 @@ which can be configured via the
 .Xr sysctl 8
 command.
 .Sh DEPRECATION NOTICE
-The PC Card attachment of this driver is scheduled for removal prior to the 
release of
+This driver is scheduled for removal prior to the release of
 .Fx 13.0
 .Sh DIAGNOSTICS
 .Bl -diag

Modified: head/sys/dev/if_ndis/if_ndis_pccard.c
==
--- head/sys/dev/if_ndis/if_ndis_pccard.c   Fri Dec 11 21:43:44 2020
(r368560)
+++ head/sys/dev/if_ndis/if_ndis_pccard.c   Fri Dec 11 21:51:50 2020
(r368561)
@@ -304,7 +304,7 @@ ndis_attach_pccard(dev)
 
error = ndis_attach(dev);
if (error == 0)
-   gone_in_dev(dev, 13, "pccard removed");
+   gone_in_dev(dev, 13, "ndis removed");
 
 fail:
return(error);

Modified: head/sys/dev/if_ndis/if_ndis_pci.c
==
--- head/sys/dev/if_ndis/if_ndis_pci.c  Fri Dec 11 21:43:44 2020
(r368560)
+++ head/sys/dev/if_ndis/if_ndis_pci.c  Fri Dec 11 21:51:50 2020
(r368561)
@@ -337,6 +337,9 @@ ndis_attach_pci(dev)
sc->ndis_devidx = devidx;
 
error = ndis_attach(dev);
+   if (error == 0)
+   gone_in_dev(dev, 13, "ndis removed");
+
 
 fail:
return(error);

Modified: head/sys/dev/if_ndis/if_ndis_usb.c
==
--- head/sys/dev/if_ndis/if_ndis_usb.c  Fri Dec 11 21:43:44 2020
(r368560)
+++ head/sys/dev/if_ndis/if_ndis_usb.c  Fri Dec 11 21:51:50 2020
(r368561)
@@ -199,6 +199,8 @@ ndisusb_attach(device_t self)
if (ndis_attach(self) != 0)
return (ENXIO);
 
+   gone_in_dev(self, 13, "ndis removed");
+
return (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: r368560 - head

2020-12-11 Thread Brooks Davis
Author: brooks
Date: Fri Dec 11 21:43:44 2020
New Revision: 368560
URL: https://svnweb.freebsd.org/changeset/base/368560

Log:
  Note removal of hme(4)
  
  Sponsored by: DARPA

Modified:
  head/RELNOTES

Modified: head/RELNOTES
==
--- head/RELNOTES   Fri Dec 11 21:40:38 2020(r368559)
+++ head/RELNOTES   Fri Dec 11 21:43:44 2020(r368560)
@@ -10,6 +10,9 @@ newline.  Entries should be separated by a newline.
 
 Changes to this file should not be MFCed.
 
+r368559:
+   The hme(4) driver was removed.
+
 r367660:
Fixes the case where gssd will not startup because /usr is a separate
local file system that is not yet mounted.  It does not fix the case
___
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: r368559 - in head: . share/man/man4 sys/amd64/conf sys/conf sys/dev/hme sys/dev/sk sys/i386/conf sys/modules sys/modules/hme sys/netpfil/pf

2020-12-11 Thread Brooks Davis
Author: brooks
Date: Fri Dec 11 21:40:38 2020
New Revision: 368559
URL: https://svnweb.freebsd.org/changeset/base/368559

Log:
  hme(4): Remove as previous announced
  
  The hme (Happy Meal Ethernet) driver was the onboard NIC in most
  supported sparc64 platforms. A few PCI NICs do exist, but we have seen
  no evidence of use on non-sparc systems.
  
  Reviewed by:  imp, emaste, bcr
  Sponsored by: DARPA

Deleted:
  head/share/man/man4/hme.4
  head/sys/dev/hme/if_hme.c
  head/sys/dev/hme/if_hme_pci.c
  head/sys/dev/hme/if_hmereg.h
  head/sys/dev/hme/if_hmevar.h
  head/sys/modules/hme/Makefile
Modified:
  head/ObsoleteFiles.inc
  head/share/man/man4/Makefile
  head/share/man/man4/altq.4
  head/share/man/man4/miibus.4
  head/share/man/man4/vlan.4
  head/sys/amd64/conf/GENERIC
  head/sys/conf/NOTES
  head/sys/conf/files
  head/sys/dev/sk/if_sk.c
  head/sys/i386/conf/GENERIC
  head/sys/modules/Makefile
  head/sys/netpfil/pf/pf.c

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Fri Dec 11 20:01:45 2020(r368558)
+++ head/ObsoleteFiles.inc  Fri Dec 11 21:40:38 2020(r368559)
@@ -36,6 +36,9 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20201211: hme(4) removed
+OLD_FILES+=usr/share/man/man4/hme.4.gz
+OLD_FILES+=usr/share/man/man4/if_hme.4.gz
 # 20201124: ping6(8) was merged into ping(8)
 OLD_FILES+=usr/lib/debug/sbin/ping6.debug
 OLD_FILES+=usr/share/man/man8/ping6.8.gz

Modified: head/share/man/man4/Makefile
==
--- head/share/man/man4/MakefileFri Dec 11 20:01:45 2020
(r368558)
+++ head/share/man/man4/MakefileFri Dec 11 21:40:38 2020
(r368559)
@@ -180,7 +180,6 @@ MAN=aac.4 \
gre.4 \
h_ertt.4 \
hifn.4 \
-   hme.4 \
hpet.4 \
${_hpt27xx.4} \
${_hptiop.4} \
@@ -665,7 +664,6 @@ MLINKS+=gpio.4 gpiobus.4
 MLINKS+=gpioths.4 dht11.4
 MLINKS+=gpioths.4 dht22.4
 MLINKS+=gre.4 if_gre.4
-MLINKS+=hme.4 if_hme.4
 MLINKS+=hpet.4 acpi_hpet.4
 MLINKS+=${_hptrr.4} ${_rr232x.4}
 MLINKS+=${_attimer.4} ${_i8254.4}

Modified: head/share/man/man4/altq.4
==
--- head/share/man/man4/altq.4  Fri Dec 11 20:01:45 2020(r368558)
+++ head/share/man/man4/altq.4  Fri Dec 11 21:40:38 2020(r368559)
@@ -148,7 +148,6 @@ They have been applied to the following hardware drive
 .Xr et 4 ,
 .Xr fxp 4 ,
 .Xr gem 4 ,
-.Xr hme 4 ,
 .Xr igb 4 ,
 .Xr ixgbe 4 ,
 .Xr jme 4 ,

Modified: head/share/man/man4/miibus.4
==
--- head/share/man/man4/miibus.4Fri Dec 11 20:01:45 2020
(r368558)
+++ head/share/man/man4/miibus.4Fri Dec 11 21:40:38 2020
(r368559)
@@ -77,8 +77,6 @@ Agere ET1310 Gigabit Ethernet
 Intel EtherExpress PRO/100B
 .It Xr gem 4
 Sun ERI, Sun GEM and Apple GMAC Ethernet
-.It Xr hme 4
-Sun HME Ethernet
 .It Xr jme 4
 JMicron JMC250 Gigabit/JMC260 Fast Ethernet
 .It Xr lge 4
@@ -157,7 +155,6 @@ but as a result are not well behaved newbus device dri
 .Xr et 4 ,
 .Xr fxp 4 ,
 .Xr gem 4 ,
-.Xr hme 4 ,
 .Xr jme 4 ,
 .Xr lge 4 ,
 .Xr msk 4 ,

Modified: head/share/man/man4/vlan.4
==
--- head/share/man/man4/vlan.4  Fri Dec 11 20:01:45 2020(r368558)
+++ head/share/man/man4/vlan.4  Fri Dec 11 21:40:38 2020(r368559)
@@ -172,7 +172,6 @@ These interfaces natively support long frames for
 .Xr fwe 4 ,
 .Xr fxp 4 ,
 .Xr gem 4 ,
-.Xr hme 4 ,
 .Xr le 4 ,
 .Xr nfe 4 ,
 .Xr rl 4 ,

Modified: head/sys/amd64/conf/GENERIC
==
--- head/sys/amd64/conf/GENERIC Fri Dec 11 20:01:45 2020(r368558)
+++ head/sys/amd64/conf/GENERIC Fri Dec 11 21:40:38 2020(r368559)
@@ -271,7 +271,6 @@ device  dc  # DEC/Intel 
21143 and various workalikes
 device et  # Agere ET1310 10/100/Gigabit Ethernet
 device fxp # Intel EtherExpress PRO/100B (82557, 
82558)
 device gem # Sun GEM/Sun ERI/Apple GMAC
-device hme # Sun HME (Happy Meal Ethernet)
 device jme # JMicron JMC250 Gigabit/JMC260 Fast 
Ethernet
 device lge # Level 1 LXT1001 gigabit Ethernet
 device msk # Marvell/SysKonnect Yukon II Gigabit 
Ethernet

Modified: head/sys/conf/NOTES
==
--- head/sys/conf/NOTES Fri Dec 11 20:01:45 2020(r368558)
+++ head/sys/conf/NOTES Fri Dec 11 21:40:38 2020(r368559)
@@ -1867,7 +1867,6 @@ devicexmphy   # XaQti XMAC II
 # 

svn commit: r368543 - head/sys/net

2020-12-10 Thread Brooks Davis
Author: brooks
Date: Fri Dec 11 01:00:07 2020
New Revision: 368543
URL: https://svnweb.freebsd.org/changeset/base/368543

Log:
  style(9): Correct whitespace in struct definitions
  
  struct ifconf and struct ifreq use the odd style "structfoo".
  struct ifdrv seems to have tried to follow this but was committed with
  spaces in place of most tabs resulting in "structifdrv".
  
  MFC after:3 days

Modified:
  head/sys/net/if.h

Modified: head/sys/net/if.h
==
--- head/sys/net/if.h   Fri Dec 11 00:42:53 2020(r368542)
+++ head/sys/net/if.h   Fri Dec 11 01:00:07 2020(r368543)
@@ -393,7 +393,7 @@ struct ifreq_buffer {
  * definitions which begin with ifr_name.  The
  * remainder may be interface specific.
  */
-struct ifreq {
+struct ifreq {
charifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */
union {
struct  sockaddr ifru_addr;
@@ -467,11 +467,11 @@ struct ifmediareq {
int *ifm_ulist; /* media words */
 };
 
-struct  ifdrv {
-   charifd_name[IFNAMSIZ]; /* if name, e.g. "en0" */
-   unsigned long   ifd_cmd;
-   size_t  ifd_len;
-   void*ifd_data;
+struct ifdrv {
+   charifd_name[IFNAMSIZ]; /* if name, e.g. "en0" */
+   unsigned long   ifd_cmd;
+   size_t  ifd_len;
+   void*ifd_data;
 };
 
 /* 
@@ -493,7 +493,7 @@ struct ifstat {
  * for machine (useful for programs which
  * must know all networks accessible).
  */
-struct ifconf {
+struct ifconf {
int ifc_len;/* size of associated buffer */
union {
caddr_t ifcu_buf;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r367813 - head/lib/libutil

2020-11-18 Thread Brooks Davis
On Thu, Nov 19, 2020 at 12:05:51AM +0100, Stefan Esser wrote:
> Am 18.11.20 um 23:14 schrieb Jessica Clarke:
> > On 18 Nov 2020, at 21:52, Stefan Esser  wrote:
> >> Am 18.11.20 um 22:15 schrieb Jessica Clarke:
> >>> On 18 Nov 2020, at 19:44, Stefan E??er  wrote:
>  +/*
>  + * Check for some other thread already having
>  + * set localbase - this should use atomic ops.
>  + * The amount of memory allocated above may leak,
>  + * if a parallel update in another thread is not
>  + * detected and the non-NULL pointer is overwritten.
>  + */
> >>> Why was this committed with a known racy/leaky implementation?
> >>
> >> Because the alternatives that I offered for discussion were
> >> less acceptable.
> > 
> > That has no bearing over whether this one is.
> 
> Three alternatives have been discussed:
> 
> 1) static buffer of size MAXPATHLEN
> 2) dynamically allocated buffer (as committed)
> 3) dynamically allocated buffer filled by a constructor
> 
> 1) has been rejected, since it adds 1 KB of bss to each program
> that is linked with libutil, whether it uses getlocalbase() or
> not.
> 
> 3) has been rejected since it causes 1 getenv() and 2 sysctl()
> calls when the program linked with libutil starts, independently
> of whether getlocalbase() is used or not.
> 
> 2) has been selected, since it is only called when needed and it
> does not pre-allocate a large buffer.
> 
> Which other alternative do you want to suggest?
> 
> Did you have a look at the review announced on the -current list
> and mentioned in the commit?
> 
> >>> What happens if I set the value with a sysctl and call this?
> >>
> >> You'll get the value set with sysctl, unless overridden by the
> >> environment variable. There is a window of a few nano-seconds
> >> where a thread executing in parallel on another core might be
> >> able to set the localbase variable (between the test for NULL
> >> in this function and the assignment to it). The value that will
> >> be returned by either thread will be identical, so there is no
> >> risk of corruption of the result.
> > 
> > But if I call getlocalbase, then set it via sysctl, then call
> > getlocalbase again, I see the old value. If, however, I omit the first
> > getlocalbase, I see the new value. This differs from how getenv/setenv
> > of the value work, where you always see the up-to-date value. Maybe you
> > think that's a feature, but it's something to watch out for and
> > explicitly call out in the documentation.
> 
> Actual programs call getlocalbase() exactly once and create the
> required pathes from the value returned.
> 
> It is possible to copy the value from the environment to a buffer,
> but at added complexity and introducing another race condition.
> 
> The program itself might have modified its environment and then
> use an inconsistent value when it calls getlocalbase() again
> thereafter. But why would you want to do this - it seems to be
> a complicated way lof foot-shooting to me.
> 
> I'm not a native speaker of English and not best qualified to
> clearly express this in the man-page. Feel free to commit any
> clarification or suggest an addition for me to commit.
> 
> > You also misunderstand all the subtleties of multithreading here. There
> > are no acquire/release pairs so it is entirely legal for Thread 2 to
> > read Thread 1's initialised value for localbase before the contents of
> > it are visible (i.e. the pointer is initialised but the data is
> > garbage).
> 
> Yes, and thread 2's value will be identical to the one from
> thread 1, just in a different heap location, unless there is a
> write to the sysctl variable in the kernel at just the same
> time. And you cannot protect against this race and you'll get
> either the old or new value.
> 
> > The `(volatile const char*)localbase` cast is also a complete waste of
> > time. You probably meant to write `(const char * volatile)localbase`
> > but even then that does nothing useful as the cast is too late. What
> > you really were trying to write was
> > `*(const char * volatile *)`, but you need proper atomics
> > anyway for this to be safe.
> 
> I was not sure about the correct volatile declaration, I've got
> to admit. It was in the review and I did not get any comments
> regarding that specific modifier. The goal was to enforce the
> access to the localbase pointer in memory after returning from
> the sysctl to shorten the window.
> 
> Perhaps I should just have completely ignore any multi-threading
> issues and accepted that an overlapping execution of this function
> would allocate multiple sysctl destination buffers but loose all
> references but one in the assignment to localbase.
> 
> It will not happen in practice, it just does not make sense to
> call this function more than once in a program.
> 
> >> This unlikely case may actually leak a heap allocated string
> >> of 

Re: svn commit: r367744 - in head/sys: compat/freebsd32 kern sys

2020-11-17 Thread Brooks Davis
On Tue, Nov 17, 2020 at 11:59:50AM -0600, Kyle Evans wrote:
> On Tue, Nov 17, 2020 at 11:11 AM Brooks Davis  wrote:
> >
> > On Tue, Nov 17, 2020 at 03:36:58AM +, Kyle Evans wrote:
> > > Modified: head/sys/compat/freebsd32/freebsd32.h
> > > ==
> > > --- head/sys/compat/freebsd32/freebsd32.h Tue Nov 17 03:34:01 2020
> > > (r367743)
> > > +++ head/sys/compat/freebsd32/freebsd32.h Tue Nov 17 03:36:58 2020
> > > (r367744)
> > > @@ -94,6 +94,27 @@ struct itimerval32 {
> > >   struct timeval32 it_value;
> > >  };
> > >
> > > +struct umtx_time32 {
> > > + struct  timespec32  _timeout;
> > > + uint32_t_flags;
> > > + uint32_t_clockid;
> > > +};
> > > +
> > > +struct umtx_robust_lists_params_compat32 {
> > > + uint32_trobust_list_offset;
> > > + uint32_trobust_priv_list_offset;
> > > + uint32_trobust_inact_offset;
> > > +};
> > > +
> > > +struct umutex32 {
> > > + volatile __lwpid_t  m_owner;/* Owner of the mutex */
> > > + __uint32_t  m_flags;/* Flags of the mutex */
> > > + __uint32_t  m_ceilings[2];  /* Priority protect ceiling 
> > > */
> > > + __uint32_t  m_rb_lnk;   /* Robust linkage */
> > > + __uint32_t  m_pad;
> > > + __uint32_t  m_spare[2];
> > > +};
> > > +
> > >  #define FREEBSD4_MFSNAMELEN  16
> > >  #define FREEBSD4_MNAMELEN(88 - 2 * sizeof(int32_t))
> > >
> > >
> > > Modified: head/sys/compat/freebsd32/freebsd32_misc.c
> > > ==
> > > --- head/sys/compat/freebsd32/freebsd32_misc.cTue Nov 17 03:34:01 
> > > 2020(r367743)
> > > +++ head/sys/compat/freebsd32/freebsd32_misc.cTue Nov 17 03:36:58 
> > > 2020(r367744)
> > > @@ -84,6 +84,7 @@ __FBSDID("$FreeBSD$");
> > >  #include 
> > >  #include 
> > >  #include 
> > > +#include 
> > >  #include 
> > >  #include 
> > >  #include 
> > > @@ -3764,4 +3765,12 @@ freebsd32_sched_rr_get_interval(struct thread *td,
> > >   error = copyout(, uap->interval, sizeof(ts32));
> > >   }
> > >   return (error);
> > > +}
> > > +
> > > +int
> > > +freebsd32__umtx_op(struct thread *td, struct freebsd32__umtx_op_args 
> > > *uap)
> > > +{
> > > +
> > > + return (kern__umtx_op(td, uap->obj, uap->op, uap->val, uap->uaddr,
> > > + uap->uaddr2, _native_ops32));
> > >  }
> > >
> >
> > Putting any of this under compat/freebsd32 seems like a somewhat
> > odd choice since all the work is done in kern_umtx.h.  In CheriBSD,
> > everything just lives there so nothing has to be exposed in headers.
> >
> 
> I have no strong opinion here -- my initial impression of the
> suggestion to move the struct definitions into freebsd32 was that:
> 
> 1.) One can then quickly reference the definition of, e.g., timespec32
> when I'm looking at a umtx_time32, and
> 2.) It'd be 'cleaner', requiring less #ifdef soup in kern_umtx.c
> 
> The follow-up patch muddies the waters a lot, as we end up using the
> compat32 definitions on all 64-bit platforms anyways even without
> compat32. I don't object to moving any/all of this back, if you think
> that's better.

(1) makes sense to me.  I'm less convinced of (2) especially given the
followup.  As a rule, I've been removing compat bits from headers when
they only need to be defined in a single .c file.  If nothing else, I
don't like that it presents a somewhat-false implication that the
interfaces are public (and there have been quite a few cases where they
weren't correctly guarded with _KERNEL).

-- Brooks


signature.asc
Description: PGP signature


Re: svn commit: r367744 - in head/sys: compat/freebsd32 kern sys

2020-11-17 Thread Brooks Davis
On Tue, Nov 17, 2020 at 03:36:58AM +, Kyle Evans wrote:
> Modified: head/sys/compat/freebsd32/freebsd32.h
> ==
> --- head/sys/compat/freebsd32/freebsd32.h Tue Nov 17 03:34:01 2020
> (r367743)
> +++ head/sys/compat/freebsd32/freebsd32.h Tue Nov 17 03:36:58 2020
> (r367744)
> @@ -94,6 +94,27 @@ struct itimerval32 {
>   struct timeval32 it_value;
>  };
>  
> +struct umtx_time32 {
> + struct  timespec32  _timeout;
> + uint32_t_flags;
> + uint32_t_clockid;
> +};
> +
> +struct umtx_robust_lists_params_compat32 {
> + uint32_trobust_list_offset;
> + uint32_trobust_priv_list_offset;
> + uint32_trobust_inact_offset;
> +};
> +
> +struct umutex32 {
> + volatile __lwpid_t  m_owner;/* Owner of the mutex */
> + __uint32_t  m_flags;/* Flags of the mutex */
> + __uint32_t  m_ceilings[2];  /* Priority protect ceiling */
> + __uint32_t  m_rb_lnk;   /* Robust linkage */
> + __uint32_t  m_pad;
> + __uint32_t  m_spare[2];
> +};
> +
>  #define FREEBSD4_MFSNAMELEN  16
>  #define FREEBSD4_MNAMELEN(88 - 2 * sizeof(int32_t))
>  
> 
> Modified: head/sys/compat/freebsd32/freebsd32_misc.c
> ==
> --- head/sys/compat/freebsd32/freebsd32_misc.cTue Nov 17 03:34:01 
> 2020(r367743)
> +++ head/sys/compat/freebsd32/freebsd32_misc.cTue Nov 17 03:36:58 
> 2020(r367744)
> @@ -84,6 +84,7 @@ __FBSDID("$FreeBSD$");
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -3764,4 +3765,12 @@ freebsd32_sched_rr_get_interval(struct thread *td,
>   error = copyout(, uap->interval, sizeof(ts32));
>   }
>   return (error);
> +}
> +
> +int
> +freebsd32__umtx_op(struct thread *td, struct freebsd32__umtx_op_args *uap)
> +{
> +
> + return (kern__umtx_op(td, uap->obj, uap->op, uap->val, uap->uaddr,
> + uap->uaddr2, _native_ops32));
>  }
> 

Putting any of this under compat/freebsd32 seems like a somewhat
odd choice since all the work is done in kern_umtx.h.  In CheriBSD,
everything just lives there so nothing has to be exposed in headers.

-- Brooks


signature.asc
Description: PGP signature


svn commit: r367735 - head/share/mk

2020-11-16 Thread Brooks Davis
Author: brooks
Date: Mon Nov 16 19:15:11 2020
New Revision: 367735
URL: https://svnweb.freebsd.org/changeset/base/367735

Log:
  Add a guard for broken SUBDIR.${MK_FOO} use
  
  Check for the variable SUBDIR. and error as it usually means someone
  forgot to include src.opts.mk.
  
  This guard from CheriBSD found the bugs in r367655 and r367728.
  
  Reviewed by:  bdrewery, arichardson
  Obtained from:CheriBSD
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D27211

Modified:
  head/share/mk/bsd.subdir.mk

Modified: head/share/mk/bsd.subdir.mk
==
--- head/share/mk/bsd.subdir.mk Mon Nov 16 18:41:49 2020(r367734)
+++ head/share/mk/bsd.subdir.mk Mon Nov 16 19:15:11 2020(r367735)
@@ -127,6 +127,12 @@ SUBDIR:=${SUBDIR} ${SUBDIR.yes} ${SUBDIR.yes.yes}
 SUBDIR:=${SUBDIR:u}
 .endif
 
+.if defined(SUBDIR.)
+.error ${.CURDIR}: Found variable SUBDIR. with value "${SUBDIR.}". This was \
+probably caused by using SUBDIR.$${MK_FOO} without including \
+ or by using an invalid $${MK_FOO} option.
+.endif
+
 # Subdir code shared among 'make ', 'make ' and 
SUBDIR_PARALLEL.
 _SUBDIR_SH=\
if test -d ${.CURDIR}/$${dir}.${MACHINE_ARCH}; then \
___
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: r367728 - in head: cddl/usr.bin/ztest usr.sbin/praudit

2020-11-16 Thread Brooks Davis
Author: brooks
Date: Mon Nov 16 17:20:35 2020
New Revision: 367728
URL: https://svnweb.freebsd.org/changeset/base/367728

Log:
  Add missing includes of src.opts.mk
  
  Without this "SUBDIR.${MK_TESTS}=tests" would always expand to
  "SUBDIR.=tests" resulting in the tests not being built.
  
  Sponsored by: DARPA

Modified:
  head/cddl/usr.bin/ztest/Makefile
  head/usr.sbin/praudit/Makefile

Modified: head/cddl/usr.bin/ztest/Makefile
==
--- head/cddl/usr.bin/ztest/MakefileMon Nov 16 16:53:46 2020
(r367727)
+++ head/cddl/usr.bin/ztest/MakefileMon Nov 16 17:20:35 2020
(r367728)
@@ -1,5 +1,7 @@
 # $FreeBSD$
 
+.include 
+
 ZFSTOP=${SRCTOP}/sys/contrib/openzfs
 
 .PATH: ${ZFSTOP}/cmd/ztest

Modified: head/usr.sbin/praudit/Makefile
==
--- head/usr.sbin/praudit/Makefile  Mon Nov 16 16:53:46 2020
(r367727)
+++ head/usr.sbin/praudit/Makefile  Mon Nov 16 17:20:35 2020
(r367728)
@@ -2,6 +2,8 @@
 # $FreeBSD$
 #
 
+.include 
+
 OPENBSMDIR=${SRCTOP}/contrib/openbsm
 .PATH: ${OPENBSMDIR}/bin/praudit
 
___
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: r367655 - head/lib/libbsnmp

2020-11-13 Thread Brooks Davis
Author: brooks
Date: Fri Nov 13 23:18:04 2020
New Revision: 367655
URL: https://svnweb.freebsd.org/changeset/base/367655

Log:
  Add missing src.opts.mk include
  
  This was missed in r364221 so tests were not built.
  
  Reviewed by:  bdrewery
  Obtained from:CheriBSD
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D27210

Modified:
  head/lib/libbsnmp/Makefile

Modified: head/lib/libbsnmp/Makefile
==
--- head/lib/libbsnmp/Makefile  Fri Nov 13 22:45:26 2020(r367654)
+++ head/lib/libbsnmp/Makefile  Fri Nov 13 23:18:04 2020(r367655)
@@ -1,5 +1,7 @@
 # $FreeBSD$
 
+.include 
+
 SUBDIR=libbsnmp
 SUBDIR.${MK_TESTS}+= tests
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r367601 - stable/11/sys/kern

2020-11-11 Thread Brooks Davis
Author: brooks
Date: Wed Nov 11 22:00:30 2020
New Revision: 367601
URL: https://svnweb.freebsd.org/changeset/base/367601

Log:
  MFC r367302:
  
  sysvshm: pass relevant uap members as arguments
  
  Alter shmget_allocate_segment and shmget_existing to take the values
  they want from struct shmget_args rather than passing the struct
  around.  In general, uap structures should only be the interface to
  sys_ functions.
  
  This makes one small functional change and records the allocated space
  rather than the requested space.  If this turns out to be a problem (e.g.
  if software tries to find undersized segments by exact size rather than
  using keys), we can correct that easily.
  
  Reviewed by:  kib
  Obtained from:CheriBSD
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D27077

Modified:
  stable/11/sys/kern/sysv_shm.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/sysv_shm.c
==
--- stable/11/sys/kern/sysv_shm.c   Wed Nov 11 21:59:39 2020
(r367600)
+++ stable/11/sys/kern/sysv_shm.c   Wed Nov 11 22:00:30 2020
(r367601)
@@ -102,11 +102,6 @@ FEATURE(sysv_shm, "System V shared memory segments sup
 
 static MALLOC_DEFINE(M_SHM, "shm", "SVID compatible shared memory segments");
 
-static int shmget_allocate_segment(struct thread *td,
-struct shmget_args *uap, int mode);
-static int shmget_existing(struct thread *td, struct shmget_args *uap,
-int mode, int segnum);
-
 #defineSHMSEG_FREE 0x0200
 #defineSHMSEG_REMOVED  0x0400
 #defineSHMSEG_ALLOCATED0x0800
@@ -125,6 +120,10 @@ static void shm_deallocate_segment(struct shmid_kernel
 static int shm_find_segment_by_key(struct prison *, key_t);
 static struct shmid_kernel *shm_find_segment(struct prison *, int, bool);
 static int shm_delete_mapping(struct vmspace *vm, struct shmmap_state *);
+static int shmget_allocate_segment(struct thread *td, key_t key, size_t size,
+int mode);
+static int shmget_existing(struct thread *td, size_t size, int shmflg,
+int mode, int segnum);
 static void shmrealloc(void);
 static int shminit(void);
 static int sysvshm_modload(struct module *, int, void *);
@@ -643,7 +642,7 @@ done:
 
 
 static int
-shmget_existing(struct thread *td, struct shmget_args *uap, int mode,
+shmget_existing(struct thread *td, size_t size, int shmflg, int mode,
 int segnum)
 {
struct shmid_kernel *shmseg;
@@ -655,35 +654,34 @@ shmget_existing(struct thread *td, struct shmget_args 
KASSERT(segnum >= 0 && segnum < shmalloced,
("segnum %d shmalloced %d", segnum, shmalloced));
shmseg = [segnum];
-   if ((uap->shmflg & (IPC_CREAT | IPC_EXCL)) == (IPC_CREAT | IPC_EXCL))
+   if ((shmflg & (IPC_CREAT | IPC_EXCL)) == (IPC_CREAT | IPC_EXCL))
return (EEXIST);
 #ifdef MAC
-   error = mac_sysvshm_check_shmget(td->td_ucred, shmseg, uap->shmflg);
+   error = mac_sysvshm_check_shmget(td->td_ucred, shmseg, shmflg);
if (error != 0)
return (error);
 #endif
-   if (uap->size != 0 && uap->size > shmseg->u.shm_segsz)
+   if (size != 0 && size > shmseg->u.shm_segsz)
return (EINVAL);
td->td_retval[0] = IXSEQ_TO_IPCID(segnum, shmseg->u.shm_perm);
return (0);
 }
 
 static int
-shmget_allocate_segment(struct thread *td, struct shmget_args *uap, int mode)
+shmget_allocate_segment(struct thread *td, key_t key, size_t size, int mode)
 {
struct ucred *cred = td->td_ucred;
struct shmid_kernel *shmseg;
vm_object_t shm_object;
int i, segnum;
-   size_t size;
 
SYSVSHM_ASSERT_LOCKED();
 
-   if (uap->size < shminfo.shmmin || uap->size > shminfo.shmmax)
+   if (size < shminfo.shmmin || size > shminfo.shmmax)
return (EINVAL);
if (shm_nused >= shminfo.shmmni) /* Any shmids left? */
return (ENOSPC);
-   size = round_page(uap->size);
+   size = round_page(size);
if (shm_committed + btoc(size) > shminfo.shmall)
return (ENOMEM);
if (shm_last_free < 0) {
@@ -744,10 +742,10 @@ shmget_allocate_segment(struct thread *td, struct shmg
shmseg->u.shm_perm.cuid = shmseg->u.shm_perm.uid = cred->cr_uid;
shmseg->u.shm_perm.cgid = shmseg->u.shm_perm.gid = cred->cr_gid;
shmseg->u.shm_perm.mode = (mode & ACCESSPERMS) | SHMSEG_ALLOCATED;
-   shmseg->u.shm_perm.key = uap->key;
+   shmseg->u.shm_perm.key = key;
shmseg->u.shm_perm.seq = (shmseg->u.shm_perm.seq + 1) & 0x7fff;
shmseg->cred = crhold(cred);
-   shmseg->u.shm_segsz = uap->size;
+   shmseg->u.shm_segsz = size;
shmseg->u.shm_cpid = td->td_proc->p_pid;
shmseg->u.shm_lpid = shmseg->u.shm_nattch = 0;
shmseg->u.shm_atime = shmseg->u.shm_dtime = 0;
@@ -780,16 +778,18 @@ 

Re: svn commit: r367577 - in head: share/mk sys/conf tools/build/options

2020-11-10 Thread Brooks Davis
On Tue, Nov 10, 2020 at 02:44:45PM -0500, Shawn Webb wrote:
> On Tue, Nov 10, 2020 at 07:17:29PM +0000, Brooks Davis wrote:
> > On Tue, Nov 10, 2020 at 07:15:14PM +0000, Brooks Davis wrote:
> > > Author: brooks
> > > Date: Tue Nov 10 19:15:13 2020
> > > New Revision: 367577
> > > URL: https://svnweb.freebsd.org/changeset/base/367577
> > > 
> > > Log:
> > >   Support initializing stack variables on function entry
> > >   
> > >   There are two options:
> > >- WITH_INIT_ALL_ZERO: Zero all variables on the stack.
> > >- WITH_INIT_ALL_PATTERN: Initialize variables with well-defined 
> > > patterns.
> > >   
> > >   The exact pattern are a compiler implementation detail and vary by type.
> > >   They are somewhat documented in the LLVM commit message:
> > >   https://reviews.llvm.org/rL349442
> > >   I've used WITH_INIT_ALL_* to match Microsoft's InitAll feature rather
> > >   than naming them after the LLVM specific compiler flags.
> > >   
> > >   In a range of consumer products, options like these are used in
> > >   both debug and production builds with debugs builds using patterns
> > >   (intended to provoke crashes on use of uninitialized values) and
> > >   production using zeros (deemed more likely to lead to harmless
> > >   misbehavior or NULL-pointer dereferences).
> > 
> > We've tested this extensively in CheriBSD on RISC-V, in the wild it's
> > probably most tested on Arm64 and x86.
> > 
> > Despite the silly compiler flag you'll spot in the code, the zeroing
> > option isn't going away in practice as Apple, Google, and Microsoft all
> > ship with this feature in some of their products.
> 
> HardenedBSD's testing of this last year on amd64 have (privately)
> shown the feature to really hinder performance on more complex
> applications (like when applied to clang/lld). A build of base
> without init all zero applied to clang/lld would take around 1.5
> hours on my system. A build with it applied to clang/lld took around
> four hours, if my memory serves correctly. I would probably advise
> against applying it system-wide. But YMMV.

I agree a more nuanced approach is likely useful in practice, but this
does work and is part of the configuration we shipped for DARPA's FETT bug
bounty.  Hopefully this provides a starting point for further
exploration.

-- Brooks


signature.asc
Description: PGP signature


Re: svn commit: r367577 - in head: share/mk sys/conf tools/build/options

2020-11-10 Thread Brooks Davis
Sorry about that.  I've fixed it in r367579.

-- Brooks

On Tue, Nov 10, 2020 at 12:46:45PM -0800, Matthew Macy wrote:
> These flags aren't defined by default when building external kernel modules:
> 
> gmake[2]: Entering directory '/usr/home/matt/devel/ZoF/module'
> env -u MAKEFLAGS make -C /home/matt/devel/ZoF/module -f Makefile.bsd -w
> make[3]: Entering directory `/home/matt/devel/ZoF/module'
> make[3]: "/usr/home/matt/devel/freebsd/sys/conf/kern.mk" line 233:
> Malformed conditional (${MK_INIT_ALL_ZERO} == "yes")
> make[3]: Fatal errors encountered -- cannot continue
> make[3]: stopped in /home/matt/devel/ZoF/module
> gmake[2]: *** [Makefile:53: modules-FreeBSD] Error 1
> gmake[2]: Leaving directory '/usr/home/matt/devel/ZoF/module'
> 
> On Tue, Nov 10, 2020 at 11:15 AM Brooks Davis  wrote:
> >
> > Author: brooks
> > Date: Tue Nov 10 19:15:13 2020
> > New Revision: 367577
> > URL: https://svnweb.freebsd.org/changeset/base/367577
> >
> > Log:
> >   Support initializing stack variables on function entry
> >
> >   There are two options:
> >- WITH_INIT_ALL_ZERO: Zero all variables on the stack.
> >- WITH_INIT_ALL_PATTERN: Initialize variables with well-defined patterns.
> >
> >   The exact pattern are a compiler implementation detail and vary by type.
> >   They are somewhat documented in the LLVM commit message:
> >   https://reviews.llvm.org/rL349442
> >   I've used WITH_INIT_ALL_* to match Microsoft's InitAll feature rather
> >   than naming them after the LLVM specific compiler flags.
> >
> >   In a range of consumer products, options like these are used in
> >   both debug and production builds with debugs builds using patterns
> >   (intended to provoke crashes on use of uninitialized values) and
> >   production using zeros (deemed more likely to lead to harmless
> >   misbehavior or NULL-pointer dereferences).
> >
> >   Reviewed by:  emaste
> >   Obtained from:CheriBSD
> >   Sponsored by: DARPA
> >   Differential Revision:https://reviews.freebsd.org/D27131
> >
> > Added:
> >   head/tools/build/options/WITH_INIT_ALL_PATTERN   (contents, props changed)
> >   head/tools/build/options/WITH_INIT_ALL_ZERO   (contents, props changed)
> > Modified:
> >   head/share/mk/bsd.compiler.mk
> >   head/share/mk/bsd.lib.mk
> >   head/share/mk/bsd.opts.mk
> >   head/share/mk/bsd.prog.mk
> >   head/sys/conf/kern.mk
> >
> > Modified: head/share/mk/bsd.compiler.mk
> > ==
> > --- head/share/mk/bsd.compiler.mk   Tue Nov 10 19:09:35 2020
> > (r367576)
> > +++ head/share/mk/bsd.compiler.mk   Tue Nov 10 19:15:13 2020
> > (r367577)
> > @@ -24,6 +24,7 @@
> >  # - c++11: supports full (or nearly full) C++11 programming 
> > environment.
> >  # - retpoline: supports the retpoline speculative execution vulnerability
> >  #  mitigation.
> > +# - init-all:  supports stack variable initialization.
> >  #
> >  # These variables with an X_ prefix will also be provided if XCC is set.
> >  #
> > @@ -214,7 +215,7 @@ ${X_}COMPILER_FEATURES= c++11 c++14
> >  ${X_}COMPILER_FEATURES+=   c++17
> >  .endif
> >  .if ${${X_}COMPILER_TYPE} == "clang"
> > -${X_}COMPILER_FEATURES+=   retpoline
> > +${X_}COMPILER_FEATURES+=   retpoline init-all
> >  .endif
> >
> >  .else
> >
> > Modified: head/share/mk/bsd.lib.mk
> > ==
> > --- head/share/mk/bsd.lib.mkTue Nov 10 19:09:35 2020(r367576)
> > +++ head/share/mk/bsd.lib.mkTue Nov 10 19:15:13 2020(r367577)
> > @@ -85,6 +85,25 @@ LDFLAGS+= -Wl,-zretpolineplt
> >  .endif
> >  .endif
> >
> > +# Initialize stack variables on function entry
> > +.if ${MK_INIT_ALL_ZERO} == "yes"
> > +.if ${COMPILER_FEATURES:Minit-all}
> > +CFLAGS+= -ftrivial-auto-var-init=zero \
> > +
> > -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
> > +CXXFLAGS+= -ftrivial-auto-var-init=zero \
> > +
> > -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
> > +.else
> > +.warning InitAll (zeros) requested but not support by compiler
> > +.endif
> > +.elif ${MK_INIT_ALL_PATTERN} == "yes"
> > +.if ${COMPILER_FEATURES:Minit-all}
> > +CFLAGS+= -ftrivial-auto-var-init=pattern
> > +CXXFLAGS+= -ftrivi

svn commit: r367579 - head/sys/conf

2020-11-10 Thread Brooks Davis
Author: brooks
Date: Tue Nov 10 21:12:32 2020
New Revision: 367579
URL: https://svnweb.freebsd.org/changeset/base/367579

Log:
  Be more tolerant of share/mk and kern.mk mismatch
  
  When building out-of-tree modules, it appears that the system share/mk
  is used, but sys/conf/kern.mk is used.  That results in MK_INIT_ALL_ZERO
  being undefined.  In the interest of maximum compatability, check
  that MK_INIT_ALL_* and COMPILER_FEATURES are defined before comparing
  their values.
  
  Reported by:  mmacy
  Sponsored by: DARPA

Modified:
  head/sys/conf/kern.mk

Modified: head/sys/conf/kern.mk
==
--- head/sys/conf/kern.mk   Tue Nov 10 19:54:39 2020(r367578)
+++ head/sys/conf/kern.mk   Tue Nov 10 21:12:32 2020(r367579)
@@ -230,15 +230,15 @@ CFLAGS+=  -mretpoline
 #
 # Initialize stack variables on function entry
 #
-.if ${MK_INIT_ALL_ZERO} == "yes"
-.if ${COMPILER_FEATURES:Minit-all}
+.if defined(MK_INIT_ALL_ZERO) && ${MK_INIT_ALL_ZERO} == "yes"
+.if defined(COMPILER_FEATURES) && ${COMPILER_FEATURES:Minit-all}
 CFLAGS+= -ftrivial-auto-var-init=zero \
 -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
 .else
 .warning InitAll (zeros) requested but not support by compiler
 .endif
-.elif ${MK_INIT_ALL_PATTERN} == "yes"
-.if ${COMPILER_FEATURES:Minit-all}
+.elif defined(MK_INIT_ALL_PATTERN) && ${MK_INIT_ALL_PATTERN} == "yes"
+.if defined(COMPILER_FEATURES) && ${COMPILER_FEATURES:Minit-all}
 CFLAGS+= -ftrivial-auto-var-init=pattern
 .else
 .warning InitAll (pattern) requested but not support by compiler
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r367577 - in head: share/mk sys/conf tools/build/options

2020-11-10 Thread Brooks Davis
On Tue, Nov 10, 2020 at 07:15:14PM +, Brooks Davis wrote:
> Author: brooks
> Date: Tue Nov 10 19:15:13 2020
> New Revision: 367577
> URL: https://svnweb.freebsd.org/changeset/base/367577
> 
> Log:
>   Support initializing stack variables on function entry
>   
>   There are two options:
>- WITH_INIT_ALL_ZERO: Zero all variables on the stack.
>- WITH_INIT_ALL_PATTERN: Initialize variables with well-defined patterns.
>   
>   The exact pattern are a compiler implementation detail and vary by type.
>   They are somewhat documented in the LLVM commit message:
>   https://reviews.llvm.org/rL349442
>   I've used WITH_INIT_ALL_* to match Microsoft's InitAll feature rather
>   than naming them after the LLVM specific compiler flags.
>   
>   In a range of consumer products, options like these are used in
>   both debug and production builds with debugs builds using patterns
>   (intended to provoke crashes on use of uninitialized values) and
>   production using zeros (deemed more likely to lead to harmless
>   misbehavior or NULL-pointer dereferences).

We've tested this extensively in CheriBSD on RISC-V, in the wild it's
probably most tested on Arm64 and x86.

Despite the silly compiler flag you'll spot in the code, the zeroing
option isn't going away in practice as Apple, Google, and Microsoft all
ship with this feature in some of their products.

-- Brooks


signature.asc
Description: PGP signature


svn commit: r367577 - in head: share/mk sys/conf tools/build/options

2020-11-10 Thread Brooks Davis
Author: brooks
Date: Tue Nov 10 19:15:13 2020
New Revision: 367577
URL: https://svnweb.freebsd.org/changeset/base/367577

Log:
  Support initializing stack variables on function entry
  
  There are two options:
   - WITH_INIT_ALL_ZERO: Zero all variables on the stack.
   - WITH_INIT_ALL_PATTERN: Initialize variables with well-defined patterns.
  
  The exact pattern are a compiler implementation detail and vary by type.
  They are somewhat documented in the LLVM commit message:
  https://reviews.llvm.org/rL349442
  I've used WITH_INIT_ALL_* to match Microsoft's InitAll feature rather
  than naming them after the LLVM specific compiler flags.
  
  In a range of consumer products, options like these are used in
  both debug and production builds with debugs builds using patterns
  (intended to provoke crashes on use of uninitialized values) and
  production using zeros (deemed more likely to lead to harmless
  misbehavior or NULL-pointer dereferences).
  
  Reviewed by:  emaste
  Obtained from:CheriBSD
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D27131

Added:
  head/tools/build/options/WITH_INIT_ALL_PATTERN   (contents, props changed)
  head/tools/build/options/WITH_INIT_ALL_ZERO   (contents, props changed)
Modified:
  head/share/mk/bsd.compiler.mk
  head/share/mk/bsd.lib.mk
  head/share/mk/bsd.opts.mk
  head/share/mk/bsd.prog.mk
  head/sys/conf/kern.mk

Modified: head/share/mk/bsd.compiler.mk
==
--- head/share/mk/bsd.compiler.mk   Tue Nov 10 19:09:35 2020
(r367576)
+++ head/share/mk/bsd.compiler.mk   Tue Nov 10 19:15:13 2020
(r367577)
@@ -24,6 +24,7 @@
 # - c++11: supports full (or nearly full) C++11 programming environment.
 # - retpoline: supports the retpoline speculative execution vulnerability
 #  mitigation.
+# - init-all:  supports stack variable initialization.
 #
 # These variables with an X_ prefix will also be provided if XCC is set.
 #
@@ -214,7 +215,7 @@ ${X_}COMPILER_FEATURES= c++11 c++14
 ${X_}COMPILER_FEATURES+=   c++17
 .endif
 .if ${${X_}COMPILER_TYPE} == "clang"
-${X_}COMPILER_FEATURES+=   retpoline
+${X_}COMPILER_FEATURES+=   retpoline init-all
 .endif
 
 .else

Modified: head/share/mk/bsd.lib.mk
==
--- head/share/mk/bsd.lib.mkTue Nov 10 19:09:35 2020(r367576)
+++ head/share/mk/bsd.lib.mkTue Nov 10 19:15:13 2020(r367577)
@@ -85,6 +85,25 @@ LDFLAGS+= -Wl,-zretpolineplt
 .endif
 .endif
 
+# Initialize stack variables on function entry
+.if ${MK_INIT_ALL_ZERO} == "yes"
+.if ${COMPILER_FEATURES:Minit-all}
+CFLAGS+= -ftrivial-auto-var-init=zero \
+-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
+CXXFLAGS+= -ftrivial-auto-var-init=zero \
+-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
+.else
+.warning InitAll (zeros) requested but not support by compiler
+.endif
+.elif ${MK_INIT_ALL_PATTERN} == "yes"
+.if ${COMPILER_FEATURES:Minit-all}
+CFLAGS+= -ftrivial-auto-var-init=pattern
+CXXFLAGS+= -ftrivial-auto-var-init=pattern
+.else
+.warning InitAll (pattern) requested but not support by compiler
+.endif
+.endif
+
 .if ${MK_DEBUG_FILES} != "no" && empty(DEBUG_FLAGS:M-g) && \
 empty(DEBUG_FLAGS:M-gdwarf*)
 CFLAGS+= ${DEBUG_FILES_CFLAGS}

Modified: head/share/mk/bsd.opts.mk
==
--- head/share/mk/bsd.opts.mk   Tue Nov 10 19:09:35 2020(r367576)
+++ head/share/mk/bsd.opts.mk   Tue Nov 10 19:15:13 2020(r367577)
@@ -71,6 +71,8 @@ __DEFAULT_NO_OPTIONS = \
 BIND_NOW \
 CCACHE_BUILD \
 CTF \
+INIT_ALL_PATTERN \
+INIT_ALL_ZERO \
 INSTALL_AS_USER \
 PIE \
 RETPOLINE \
@@ -84,6 +86,10 @@ __DEFAULT_DEPENDENT_OPTIONS = \
 
 
 .include 
+
+.if ${MK_INIT_ALL_PATTERN} == "yes" && ${MK_INIT_ALL_ZERO} == "yes"
+.error WITH_INIT_ALL_PATTERN and WITH_INIT_ALL_ZERO are mutually exclusive.
+.endif
 
 #
 # Supported NO_* options (if defined, MK_* will be forced to "no",

Modified: head/share/mk/bsd.prog.mk
==
--- head/share/mk/bsd.prog.mk   Tue Nov 10 19:09:35 2020(r367576)
+++ head/share/mk/bsd.prog.mk   Tue Nov 10 19:15:13 2020(r367577)
@@ -60,6 +60,25 @@ LDFLAGS+= -Wl,-zretpolineplt
 .endif
 .endif
 
+# Initialize stack variables on function entry
+.if ${MK_INIT_ALL_ZERO} == "yes"
+.if ${COMPILER_FEATURES:Minit-all}
+CFLAGS+= -ftrivial-auto-var-init=zero \
+-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
+CXXFLAGS+= -ftrivial-auto-var-init=zero \
+-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
+.else
+.warning InitAll (zeros) requested but not support by compiler
+.endif
+.elif ${MK_INIT_ALL_PATTERN} == 

svn commit: r367571 - stable/12/sys/kern

2020-11-10 Thread Brooks Davis
Author: brooks
Date: Tue Nov 10 18:07:13 2020
New Revision: 367571
URL: https://svnweb.freebsd.org/changeset/base/367571

Log:
  MFC r367302:
  
  sysvshm: pass relevant uap members as arguments
  
  Alter shmget_allocate_segment and shmget_existing to take the values
  they want from struct shmget_args rather than passing the struct
  around.  In general, uap structures should only be the interface to
  sys_ functions.
  
  This makes one small functional change and records the allocated space
  rather than the requested space.  If this turns out to be a problem
  (e.g. if software tries to find undersized segments by exact size
  rather than using keys), we can correct that easily.
  
  Reviewed by:  kib
  Obtained from:CheriBSD
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D27077

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

Modified: stable/12/sys/kern/sysv_shm.c
==
--- stable/12/sys/kern/sysv_shm.c   Tue Nov 10 18:05:17 2020
(r367570)
+++ stable/12/sys/kern/sysv_shm.c   Tue Nov 10 18:07:13 2020
(r367571)
@@ -111,11 +111,6 @@ FEATURE(sysv_shm, "System V shared memory segments sup
 
 static MALLOC_DEFINE(M_SHM, "shm", "SVID compatible shared memory segments");
 
-static int shmget_allocate_segment(struct thread *td,
-struct shmget_args *uap, int mode);
-static int shmget_existing(struct thread *td, struct shmget_args *uap,
-int mode, int segnum);
-
 #defineSHMSEG_FREE 0x0200
 #defineSHMSEG_REMOVED  0x0400
 #defineSHMSEG_ALLOCATED0x0800
@@ -134,6 +129,10 @@ static void shm_deallocate_segment(struct shmid_kernel
 static int shm_find_segment_by_key(struct prison *, key_t);
 static struct shmid_kernel *shm_find_segment(struct prison *, int, bool);
 static int shm_delete_mapping(struct vmspace *vm, struct shmmap_state *);
+static int shmget_allocate_segment(struct thread *td, key_t key, size_t size,
+int mode);
+static int shmget_existing(struct thread *td, size_t size, int shmflg,
+int mode, int segnum);
 static void shmrealloc(void);
 static int shminit(void);
 static int sysvshm_modload(struct module *, int, void *);
@@ -659,7 +658,7 @@ done:
 
 
 static int
-shmget_existing(struct thread *td, struct shmget_args *uap, int mode,
+shmget_existing(struct thread *td, size_t size, int shmflg, int mode,
 int segnum)
 {
struct shmid_kernel *shmseg;
@@ -671,35 +670,34 @@ shmget_existing(struct thread *td, struct shmget_args 
KASSERT(segnum >= 0 && segnum < shmalloced,
("segnum %d shmalloced %d", segnum, shmalloced));
shmseg = [segnum];
-   if ((uap->shmflg & (IPC_CREAT | IPC_EXCL)) == (IPC_CREAT | IPC_EXCL))
+   if ((shmflg & (IPC_CREAT | IPC_EXCL)) == (IPC_CREAT | IPC_EXCL))
return (EEXIST);
 #ifdef MAC
-   error = mac_sysvshm_check_shmget(td->td_ucred, shmseg, uap->shmflg);
+   error = mac_sysvshm_check_shmget(td->td_ucred, shmseg, shmflg);
if (error != 0)
return (error);
 #endif
-   if (uap->size != 0 && uap->size > shmseg->u.shm_segsz)
+   if (size != 0 && size > shmseg->u.shm_segsz)
return (EINVAL);
td->td_retval[0] = IXSEQ_TO_IPCID(segnum, shmseg->u.shm_perm);
return (0);
 }
 
 static int
-shmget_allocate_segment(struct thread *td, struct shmget_args *uap, int mode)
+shmget_allocate_segment(struct thread *td, key_t key, size_t size, int mode)
 {
struct ucred *cred = td->td_ucred;
struct shmid_kernel *shmseg;
vm_object_t shm_object;
int i, segnum;
-   size_t size;
 
SYSVSHM_ASSERT_LOCKED();
 
-   if (uap->size < shminfo.shmmin || uap->size > shminfo.shmmax)
+   if (size < shminfo.shmmin || size > shminfo.shmmax)
return (EINVAL);
if (shm_nused >= shminfo.shmmni) /* Any shmids left? */
return (ENOSPC);
-   size = round_page(uap->size);
+   size = round_page(size);
if (shm_committed + btoc(size) > shminfo.shmall)
return (ENOMEM);
if (shm_last_free < 0) {
@@ -760,10 +758,10 @@ shmget_allocate_segment(struct thread *td, struct shmg
shmseg->u.shm_perm.cuid = shmseg->u.shm_perm.uid = cred->cr_uid;
shmseg->u.shm_perm.cgid = shmseg->u.shm_perm.gid = cred->cr_gid;
shmseg->u.shm_perm.mode = (mode & ACCESSPERMS) | SHMSEG_ALLOCATED;
-   shmseg->u.shm_perm.key = uap->key;
+   shmseg->u.shm_perm.key = key;
shmseg->u.shm_perm.seq = (shmseg->u.shm_perm.seq + 1) & 0x7fff;
shmseg->cred = crhold(cred);
-   shmseg->u.shm_segsz = uap->size;
+   shmseg->u.shm_segsz = size;
shmseg->u.shm_cpid = td->td_proc->p_pid;
shmseg->u.shm_lpid = shmseg->u.shm_nattch = 0;
shmseg->u.shm_atime = shmseg->u.shm_dtime = 0;
@@ -796,16 +794,18 @@ 

svn commit: r367315 - stable/11/lib/libc/tests/ssp

2020-11-03 Thread Brooks Davis
Author: brooks
Date: Tue Nov  3 23:30:11 2020
New Revision: 367315
URL: https://svnweb.freebsd.org/changeset/base/367315

Log:
  MFC r367121:
  
  Disable ssp raw test without ASAN
  
  r366981 disabled ASAN when it might not be reliable (with an external
  compiler), but this test is broken without ASAN so disable it completely
  in that case.
  
  PR:   250706
  Reviewed by:  emaste, lwhsu
  Differential Revision:https://reviews.freebsd.org/D26982

Modified:
  stable/11/lib/libc/tests/ssp/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/tests/ssp/Makefile
==
--- stable/11/lib/libc/tests/ssp/Makefile   Tue Nov  3 23:29:07 2020
(r367314)
+++ stable/11/lib/libc/tests/ssp/Makefile   Tue Nov  3 23:30:11 2020
(r367315)
@@ -33,7 +33,7 @@ PROGS+=   h_memset
 # probably needs to be fixed as it's currently hardcoded.
 #
 # sanitizer is not tested or supported for ARM right now. sbruno
-.if ${COMPILER_TYPE} == "clang" && !defined(_SKIP_BUILD) && \
+.if ${COMPILER_TYPE} == "clang" && ${CC} == "cc" && !defined(_SKIP_BUILD) && \
 (!defined(_RECURSING_PROGS) || ${PROG} == "h_raw")
 .if !defined(_CLANG_RESOURCE_DIR)
 _CLANG_RESOURCE_DIR!=  ${CC:N${CCACHE_BIN}} -print-resource-dir
___
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: r367314 - stable/12/lib/libc/tests/ssp

2020-11-03 Thread Brooks Davis
Author: brooks
Date: Tue Nov  3 23:29:07 2020
New Revision: 367314
URL: https://svnweb.freebsd.org/changeset/base/367314

Log:
  MFC r367121:
  
  Disable ssp raw test without ASAN
  
  r366981 disabled ASAN when it might not be reliable (with an external
  compiler), but this test is broken without ASAN so disable it completely
  in that case.
  
  PR:   250706
  Reviewed by:  emaste, lwhsu
  Differential Revision:https://reviews.freebsd.org/D26982

Modified:
  stable/12/lib/libc/tests/ssp/Makefile
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libc/tests/ssp/Makefile
==
--- stable/12/lib/libc/tests/ssp/Makefile   Tue Nov  3 23:27:24 2020
(r367313)
+++ stable/12/lib/libc/tests/ssp/Makefile   Tue Nov  3 23:29:07 2020
(r367314)
@@ -33,7 +33,7 @@ PROGS+=   h_memset
 # probably needs to be fixed as it's currently hardcoded.
 #
 # sanitizer is not tested or supported for ARM right now. sbruno
-.if ${COMPILER_TYPE} == "clang" && !defined(_SKIP_BUILD) && \
+.if ${COMPILER_TYPE} == "clang" && ${CC} == "cc" && !defined(_SKIP_BUILD) && \
 (!defined(_RECURSING_PROGS) || ${PROG} == "h_raw")
 .if !defined(_CLANG_RESOURCE_DIR)
 _CLANG_RESOURCE_DIR!=  ${CC:N${CCACHE_BIN}} -print-resource-dir
___
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: r367313 - stable/11/contrib/sendmail/include/sm/os

2020-11-03 Thread Brooks Davis
Author: brooks
Date: Tue Nov  3 23:27:24 2020
New Revision: 367313
URL: https://svnweb.freebsd.org/changeset/base/367313

Log:
  MFC r367063:
  
  Key decleration of union semun on src version
  
  __FreeBSD__ is defined by the compiler derived from the triple.  When
  building FreeBSD 11 on a FreeBSD 12 with a CROSS_TOOLCHAIN=llvm10,
  __FreeBSD__ was set to 12 when building lib32 (for some reason no triple
  is being passed which seems to mean that we're taking default values
  from the build system).  This in turn meant we end up with a double
  decleration of union semun which is a build error.
  
  Reviewed by:  gshapiro, dim
  Differential Revision:https://reviews.freebsd.org/D26902

Modified:
  stable/11/contrib/sendmail/include/sm/os/sm_os_freebsd.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/sendmail/include/sm/os/sm_os_freebsd.h
==
--- stable/11/contrib/sendmail/include/sm/os/sm_os_freebsd.hTue Nov  3 
23:26:26 2020(r367312)
+++ stable/11/contrib/sendmail/include/sm/os/sm_os_freebsd.hTue Nov  3 
23:27:24 2020(r367313)
@@ -32,8 +32,8 @@
 # define SM_CONF_SHM   1
 #endif
 #ifndef SM_CONF_SEM
-# if __FreeBSD__ > 11
-#  define SM_CONF_SEM  2 /* union semun is now longer available by default */
+# if __FreeBSD_version >= 1200059
+#  define SM_CONF_SEM  2 /* union semun is no longer declared by default */
 # else
 #  define SM_CONF_SEM  1
 # endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r367312 - stable/12/contrib/sendmail/include/sm/os

2020-11-03 Thread Brooks Davis
Author: brooks
Date: Tue Nov  3 23:26:26 2020
New Revision: 367312
URL: https://svnweb.freebsd.org/changeset/base/367312

Log:
  MFC r367063:
  
  Key decleration of union semun on src version
  
  __FreeBSD__ is defined by the compiler derived from the triple.  When
  building FreeBSD 11 on a FreeBSD 12 with a CROSS_TOOLCHAIN=llvm10,
  __FreeBSD__ was set to 12 when building lib32 (for some reason no triple
  is being passed which seems to mean that we're taking default values
  from the build system).  This in turn meant we end up with a double
  decleration of union semun which is a build error.
  
  Reviewed by:  gshapiro, dim
  Differential Revision:https://reviews.freebsd.org/D26902

Modified:
  stable/12/contrib/sendmail/include/sm/os/sm_os_freebsd.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/contrib/sendmail/include/sm/os/sm_os_freebsd.h
==
--- stable/12/contrib/sendmail/include/sm/os/sm_os_freebsd.hTue Nov  3 
22:53:23 2020(r367311)
+++ stable/12/contrib/sendmail/include/sm/os/sm_os_freebsd.hTue Nov  3 
23:26:26 2020(r367312)
@@ -32,8 +32,8 @@
 # define SM_CONF_SHM   1
 #endif
 #ifndef SM_CONF_SEM
-# if __FreeBSD__ > 11
-#  define SM_CONF_SEM  2 /* union semun is now longer available by default */
+# if __FreeBSD_version >= 1200059
+#  define SM_CONF_SEM  2 /* union semun is no longer declared by default */
 # else
 #  define SM_CONF_SEM  1
 # endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r367302 - head/sys/kern

2020-11-03 Thread Brooks Davis
Author: brooks
Date: Tue Nov  3 19:14:03 2020
New Revision: 367302
URL: https://svnweb.freebsd.org/changeset/base/367302

Log:
  sysvshm: pass relevant uap members as arguments
  
  Alter shmget_allocate_segment and shmget_existing to take the values
  they want from struct shmget_args rather than passing the struct
  around.  In general, uap structures should only be the interface to
  sys_ functions.
  
  This makes on small functional change and records the allocated space
  rather than the requested space.  If this turns out to be a problem (e.g.
  if software tries to find undersized segments by exact size rather than
  using keys), we can correct that easily.
  
  Reviewed by:  kib
  Obtained from:CheriBSD
  MFC after:1 week
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D27077

Modified:
  head/sys/kern/sysv_shm.c

Modified: head/sys/kern/sysv_shm.c
==
--- head/sys/kern/sysv_shm.cTue Nov  3 19:12:33 2020(r367301)
+++ head/sys/kern/sysv_shm.cTue Nov  3 19:14:03 2020(r367302)
@@ -111,11 +111,6 @@ FEATURE(sysv_shm, "System V shared memory segments sup
 
 static MALLOC_DEFINE(M_SHM, "shm", "SVID compatible shared memory segments");
 
-static int shmget_allocate_segment(struct thread *td,
-struct shmget_args *uap, int mode);
-static int shmget_existing(struct thread *td, struct shmget_args *uap,
-int mode, int segnum);
-
 #defineSHMSEG_FREE 0x0200
 #defineSHMSEG_REMOVED  0x0400
 #defineSHMSEG_ALLOCATED0x0800
@@ -134,6 +129,10 @@ static void shm_deallocate_segment(struct shmid_kernel
 static int shm_find_segment_by_key(struct prison *, key_t);
 static struct shmid_kernel *shm_find_segment(struct prison *, int, bool);
 static int shm_delete_mapping(struct vmspace *vm, struct shmmap_state *);
+static int shmget_allocate_segment(struct thread *td, key_t key, size_t size,
+int mode);
+static int shmget_existing(struct thread *td, size_t size, int shmflg,
+int mode, int segnum);
 static void shmrealloc(void);
 static int shminit(void);
 static int sysvshm_modload(struct module *, int, void *);
@@ -659,7 +658,7 @@ done:
 }
 
 static int
-shmget_existing(struct thread *td, struct shmget_args *uap, int mode,
+shmget_existing(struct thread *td, size_t size, int shmflg, int mode,
 int segnum)
 {
struct shmid_kernel *shmseg;
@@ -671,35 +670,34 @@ shmget_existing(struct thread *td, struct shmget_args 
KASSERT(segnum >= 0 && segnum < shmalloced,
("segnum %d shmalloced %d", segnum, shmalloced));
shmseg = [segnum];
-   if ((uap->shmflg & (IPC_CREAT | IPC_EXCL)) == (IPC_CREAT | IPC_EXCL))
+   if ((shmflg & (IPC_CREAT | IPC_EXCL)) == (IPC_CREAT | IPC_EXCL))
return (EEXIST);
 #ifdef MAC
-   error = mac_sysvshm_check_shmget(td->td_ucred, shmseg, uap->shmflg);
+   error = mac_sysvshm_check_shmget(td->td_ucred, shmseg, shmflg);
if (error != 0)
return (error);
 #endif
-   if (uap->size != 0 && uap->size > shmseg->u.shm_segsz)
+   if (size != 0 && size > shmseg->u.shm_segsz)
return (EINVAL);
td->td_retval[0] = IXSEQ_TO_IPCID(segnum, shmseg->u.shm_perm);
return (0);
 }
 
 static int
-shmget_allocate_segment(struct thread *td, struct shmget_args *uap, int mode)
+shmget_allocate_segment(struct thread *td, key_t key, size_t size, int mode)
 {
struct ucred *cred = td->td_ucred;
struct shmid_kernel *shmseg;
vm_object_t shm_object;
int i, segnum;
-   size_t size;
 
SYSVSHM_ASSERT_LOCKED();
 
-   if (uap->size < shminfo.shmmin || uap->size > shminfo.shmmax)
+   if (size < shminfo.shmmin || size > shminfo.shmmax)
return (EINVAL);
if (shm_nused >= shminfo.shmmni) /* Any shmids left? */
return (ENOSPC);
-   size = round_page(uap->size);
+   size = round_page(size);
if (shm_committed + btoc(size) > shminfo.shmall)
return (ENOMEM);
if (shm_last_free < 0) {
@@ -755,10 +753,10 @@ shmget_allocate_segment(struct thread *td, struct shmg
shmseg->u.shm_perm.cuid = shmseg->u.shm_perm.uid = cred->cr_uid;
shmseg->u.shm_perm.cgid = shmseg->u.shm_perm.gid = cred->cr_gid;
shmseg->u.shm_perm.mode = (mode & ACCESSPERMS) | SHMSEG_ALLOCATED;
-   shmseg->u.shm_perm.key = uap->key;
+   shmseg->u.shm_perm.key = key;
shmseg->u.shm_perm.seq = (shmseg->u.shm_perm.seq + 1) & 0x7fff;
shmseg->cred = crhold(cred);
-   shmseg->u.shm_segsz = uap->size;
+   shmseg->u.shm_segsz = size;
shmseg->u.shm_cpid = td->td_proc->p_pid;
shmseg->u.shm_lpid = shmseg->u.shm_nattch = 0;
shmseg->u.shm_atime = shmseg->u.shm_dtime = 0;
@@ -791,16 +789,18 @@ sys_shmget(struct thread *td, struct shmget_args *uap)
mode = 

svn commit: r367145 - in stable/11/sys: cam dev/nvme kern sys ufs/ffs

2020-10-29 Thread Brooks Davis
Author: brooks
Date: Thu Oct 29 22:00:15 2020
New Revision: 367145
URL: https://svnweb.freebsd.org/changeset/base/367145

Log:
  MFC r366911:
  
  vmapbuf: don't smuggle address or length in buf
  
  Instead, add arguments to vmapbuf.  Since this argument is
  always a pointer use a type of void * and cast to vm_offset_t in
  vmapbuf.  (In CheriBSD we've altered vm_fault_quick_hold_pages to
  take a pointer and check its bounds.)
  
  In no other situtation does b_data contain a user pointer and vmapbuf
  replaces b_data with the actual mapping.
  
  Suggested by: jhb
  Reviewed by:  imp, jhb
  Obtained from:CheriBSD
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D26784

Modified:
  stable/11/sys/cam/cam_periph.c
  stable/11/sys/dev/nvme/nvme_ctrlr.c
  stable/11/sys/kern/vfs_bio.c
  stable/11/sys/sys/buf.h
  stable/11/sys/ufs/ffs/ffs_rawread.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/cam_periph.c
==
--- stable/11/sys/cam/cam_periph.c  Thu Oct 29 18:43:37 2020
(r367144)
+++ stable/11/sys/cam/cam_periph.c  Thu Oct 29 22:00:15 2020
(r367145)
@@ -930,12 +930,6 @@ cam_periph_mapmem(union ccb *ccb, struct cam_periph_ma
 */
mapinfo->bp[i] = getpbuf(NULL);
 
-   /* put our pointer in the data slot */
-   mapinfo->bp[i]->b_data = *data_ptrs[i];
-
-   /* set the transfer length, we know it's < MAXPHYS */
-   mapinfo->bp[i]->b_bufsize = lengths[i];
-
/* set the direction */
mapinfo->bp[i]->b_iocmd = (dirs[i] == CAM_DIR_OUT) ?
BIO_WRITE : BIO_READ;
@@ -948,7 +942,7 @@ cam_periph_mapmem(union ccb *ccb, struct cam_periph_ma
 * into a larger area of VM, or if userland races against
 * vmapbuf() after the useracc() check.
 */
-   if (vmapbuf(mapinfo->bp[i], 1) < 0) {
+   if (vmapbuf(mapinfo->bp[i], *data_ptrs[i], lengths[i], 1) < 0) {
relpbuf(mapinfo->bp[i], NULL);
goto fail;
}

Modified: stable/11/sys/dev/nvme/nvme_ctrlr.c
==
--- stable/11/sys/dev/nvme/nvme_ctrlr.c Thu Oct 29 18:43:37 2020
(r367144)
+++ stable/11/sys/dev/nvme/nvme_ctrlr.c Thu Oct 29 22:00:15 2020
(r367145)
@@ -988,10 +988,8 @@ nvme_ctrlr_passthrough_cmd(struct nvme_controller *ctr
 */
PHOLD(curproc);
buf = getpbuf(NULL);
-   buf->b_data = pt->buf;
-   buf->b_bufsize = pt->len;
buf->b_iocmd = pt->is_read ? BIO_READ : BIO_WRITE;
-   if (vmapbuf(buf, 1) < 0) {
+   if (vmapbuf(buf, pt->buf, pt->len, 1) < 0) {
ret = EFAULT;
goto err;
}

Modified: stable/11/sys/kern/vfs_bio.c
==
--- stable/11/sys/kern/vfs_bio.cThu Oct 29 18:43:37 2020
(r367144)
+++ stable/11/sys/kern/vfs_bio.cThu Oct 29 22:00:15 2020
(r367145)
@@ -4577,22 +4577,21 @@ vm_hold_free_pages(struct buf *bp, int newbsize)
  * This function only works with pager buffers.
  */
 int
-vmapbuf(struct buf *bp, int mapbuf)
+vmapbuf(struct buf *bp, void *uaddr, size_t len, int mapbuf)
 {
vm_prot_t prot;
int pidx;
 
-   if (bp->b_bufsize < 0)
-   return (-1);
prot = VM_PROT_READ;
if (bp->b_iocmd == BIO_READ)
prot |= VM_PROT_WRITE;  /* Less backwards than it looks */
if ((pidx = vm_fault_quick_hold_pages(>p_vmspace->vm_map,
-   (vm_offset_t)bp->b_data, bp->b_bufsize, prot, bp->b_pages,
+   (vm_offset_t)uaddr, len, prot, bp->b_pages,
btoc(MAXPHYS))) < 0)
return (-1);
+   bp->b_bufsize = len;
bp->b_npages = pidx;
-   bp->b_offset = ((vm_offset_t)bp->b_data) & PAGE_MASK;
+   bp->b_offset = ((vm_offset_t)uaddr) & PAGE_MASK;
if (mapbuf || !unmapped_buf_allowed) {
pmap_qenter((vm_offset_t)bp->b_kvabase, bp->b_pages, pidx);
bp->b_data = bp->b_kvabase + bp->b_offset;

Modified: stable/11/sys/sys/buf.h
==
--- stable/11/sys/sys/buf.h Thu Oct 29 18:43:37 2020(r367144)
+++ stable/11/sys/sys/buf.h Thu Oct 29 22:00:15 2020(r367145)
@@ -533,7 +533,7 @@ voidvfs_bio_set_flags(struct buf *bp, int ioflags);
 void   vfs_bio_set_valid(struct buf *, int base, int size);
 void   vfs_busy_pages(struct buf *, int clear_modify);
 void   

svn commit: r367140 - in stable/12/sys: cam dev/nvme kern sys ufs/ffs

2020-10-29 Thread Brooks Davis
Author: brooks
Date: Thu Oct 29 18:29:22 2020
New Revision: 367140
URL: https://svnweb.freebsd.org/changeset/base/367140

Log:
  MFC r366911:
  
  vmapbuf: don't smuggle address or length in buf
  
  Instead, add arguments to vmapbuf.  Since this argument is
  always a pointer use a type of void * and cast to vm_offset_t in
  vmapbuf.  (In CheriBSD we've altered vm_fault_quick_hold_pages to
  take a pointer and check its bounds.)
  
  In no other situtation does b_data contain a user pointer and vmapbuf
  replaces b_data with the actual mapping.
  
  Suggested by: jhb
  Reviewed by:  imp, jhb
  Obtained from:CheriBSD
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D26784

Modified:
  stable/12/sys/cam/cam_periph.c
  stable/12/sys/dev/nvme/nvme_ctrlr.c
  stable/12/sys/kern/vfs_bio.c
  stable/12/sys/sys/buf.h
  stable/12/sys/ufs/ffs/ffs_rawread.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cam/cam_periph.c
==
--- stable/12/sys/cam/cam_periph.c  Thu Oct 29 15:44:44 2020
(r367139)
+++ stable/12/sys/cam/cam_periph.c  Thu Oct 29 18:29:22 2020
(r367140)
@@ -959,12 +959,6 @@ cam_periph_mapmem(union ccb *ccb, struct cam_periph_ma
 */
mapinfo->bp[i] = getpbuf(NULL);
 
-   /* put our pointer in the data slot */
-   mapinfo->bp[i]->b_data = *data_ptrs[i];
-
-   /* set the transfer length, we know it's < MAXPHYS */
-   mapinfo->bp[i]->b_bufsize = lengths[i];
-
/* set the direction */
mapinfo->bp[i]->b_iocmd = (dirs[i] == CAM_DIR_OUT) ?
BIO_WRITE : BIO_READ;
@@ -977,7 +971,7 @@ cam_periph_mapmem(union ccb *ccb, struct cam_periph_ma
 * into a larger area of VM, or if userland races against
 * vmapbuf() after the useracc() check.
 */
-   if (vmapbuf(mapinfo->bp[i], 1) < 0) {
+   if (vmapbuf(mapinfo->bp[i], *data_ptrs[i], lengths[i], 1) < 0) {
relpbuf(mapinfo->bp[i], NULL);
goto fail;
}

Modified: stable/12/sys/dev/nvme/nvme_ctrlr.c
==
--- stable/12/sys/dev/nvme/nvme_ctrlr.c Thu Oct 29 15:44:44 2020
(r367139)
+++ stable/12/sys/dev/nvme/nvme_ctrlr.c Thu Oct 29 18:29:22 2020
(r367140)
@@ -1232,10 +1232,8 @@ nvme_ctrlr_passthrough_cmd(struct nvme_controller *ctr
 */
PHOLD(curproc);
buf = getpbuf(NULL);
-   buf->b_data = pt->buf;
-   buf->b_bufsize = pt->len;
buf->b_iocmd = pt->is_read ? BIO_READ : BIO_WRITE;
-   if (vmapbuf(buf, 1) < 0) {
+   if (vmapbuf(buf, pt->buf, pt->len, 1) < 0) {
ret = EFAULT;
goto err;
}

Modified: stable/12/sys/kern/vfs_bio.c
==
--- stable/12/sys/kern/vfs_bio.cThu Oct 29 15:44:44 2020
(r367139)
+++ stable/12/sys/kern/vfs_bio.cThu Oct 29 18:29:22 2020
(r367140)
@@ -4912,22 +4912,21 @@ vm_hold_free_pages(struct buf *bp, int newbsize)
  * This function only works with pager buffers.
  */
 int
-vmapbuf(struct buf *bp, int mapbuf)
+vmapbuf(struct buf *bp, void *uaddr, size_t len, int mapbuf)
 {
vm_prot_t prot;
int pidx;
 
-   if (bp->b_bufsize < 0)
-   return (-1);
prot = VM_PROT_READ;
if (bp->b_iocmd == BIO_READ)
prot |= VM_PROT_WRITE;  /* Less backwards than it looks */
if ((pidx = vm_fault_quick_hold_pages(>p_vmspace->vm_map,
-   (vm_offset_t)bp->b_data, bp->b_bufsize, prot, bp->b_pages,
+   (vm_offset_t)uaddr, len, prot, bp->b_pages,
btoc(MAXPHYS))) < 0)
return (-1);
+   bp->b_bufsize = len;
bp->b_npages = pidx;
-   bp->b_offset = ((vm_offset_t)bp->b_data) & PAGE_MASK;
+   bp->b_offset = ((vm_offset_t)uaddr) & PAGE_MASK;
if (mapbuf || !unmapped_buf_allowed) {
pmap_qenter((vm_offset_t)bp->b_kvabase, bp->b_pages, pidx);
bp->b_data = bp->b_kvabase + bp->b_offset;

Modified: stable/12/sys/sys/buf.h
==
--- stable/12/sys/sys/buf.h Thu Oct 29 15:44:44 2020(r367139)
+++ stable/12/sys/sys/buf.h Thu Oct 29 18:29:22 2020(r367140)
@@ -560,7 +560,7 @@ voidvfs_bio_set_flags(struct buf *bp, int ioflags);
 void   vfs_bio_set_valid(struct buf *, int base, int size);
 void   vfs_busy_pages(struct buf *, int clear_modify);
 void   

svn commit: r367121 - head/lib/libc/tests/ssp

2020-10-28 Thread Brooks Davis
Author: brooks
Date: Wed Oct 28 23:10:54 2020
New Revision: 367121
URL: https://svnweb.freebsd.org/changeset/base/367121

Log:
  Disable ssp raw test without ASAN
  
  r366981 disabled ASAN when it might not be reliable (with an external
  compiler), but this test is broken without ASAN so disable it completely
  in that case.
  
  PR:   250706
  Reviewed by:  emaste, lwhsu
  Differential Revision:https://reviews.freebsd.org/D26982

Modified:
  head/lib/libc/tests/ssp/Makefile

Modified: head/lib/libc/tests/ssp/Makefile
==
--- head/lib/libc/tests/ssp/MakefileWed Oct 28 22:12:47 2020
(r367120)
+++ head/lib/libc/tests/ssp/MakefileWed Oct 28 23:10:54 2020
(r367121)
@@ -33,7 +33,7 @@ PROGS+=   h_memset
 # probably needs to be fixed as it's currently hardcoded.
 #
 # sanitizer is not tested or supported for ARM right now. sbruno
-.if ${COMPILER_TYPE} == "clang" && !defined(_SKIP_BUILD) && \
+.if ${COMPILER_TYPE} == "clang" && ${CC} == "cc" && !defined(_SKIP_BUILD) && \
 (!defined(_RECURSING_PROGS) || ${PROG} == "h_raw")
 .if !defined(_CLANG_RESOURCE_DIR)
 _CLANG_RESOURCE_DIR!=  ${CC:N${CCACHE_BIN}} -print-resource-dir
___
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: r367063 - head/contrib/sendmail/include/sm/os

2020-10-26 Thread Brooks Davis
Author: brooks
Date: Mon Oct 26 17:52:28 2020
New Revision: 367063
URL: https://svnweb.freebsd.org/changeset/base/367063

Log:
  Key decleration of union semun on src version
  
  __FreeBSD__ is defined by the compiler derived from the triple. When
  building FreeBSD 11 on a FreeBSD 12 with a CROSS_TOOLCHAIN=llvm10,
  __FreeBSD__ was set to 12 when building lib32 (for some reason no triple
  is being passed which seems to mean that we're taking default values
  from the build system).  This in turn meant we end up with a double
  decleration of union semun which is a build error.
  
  Reviewed by:  gshapiro, dim
  Differential Revision:https://reviews.freebsd.org/D26902

Modified:
  head/contrib/sendmail/include/sm/os/sm_os_freebsd.h

Modified: head/contrib/sendmail/include/sm/os/sm_os_freebsd.h
==
--- head/contrib/sendmail/include/sm/os/sm_os_freebsd.h Mon Oct 26 17:50:34 
2020(r367062)
+++ head/contrib/sendmail/include/sm/os/sm_os_freebsd.h Mon Oct 26 17:52:28 
2020(r367063)
@@ -32,8 +32,8 @@
 # define SM_CONF_SHM   1
 #endif
 #ifndef SM_CONF_SEM
-# if __FreeBSD__ > 11
-#  define SM_CONF_SEM  2 /* union semun is now longer available by default */
+# if __FreeBSD_version >= 1200059
+#  define SM_CONF_SEM  2 /* union semun is no longer declared by default */
 # else
 #  define SM_CONF_SEM  1
 # endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r367062 - stable/11/lib/libc/tests/ssp

2020-10-26 Thread Brooks Davis
Author: brooks
Date: Mon Oct 26 17:50:34 2020
New Revision: 367062
URL: https://svnweb.freebsd.org/changeset/base/367062

Log:
  MFC r366981:
  
  Only use ASAN when using the in-tree compiler
  
  When building FreeBSD 11 on a FreeBSD 12 system with
  CROSS_TOOLCHAIN=llvm10 we end up trying to link against the packaged
  version of the sanitizer library.  This resulted in a requirement for
  getentropy(3) which is not present in FreeBSD 11.
  
  Reviewed by:  emaste
  Differential Revision:https://reviews.freebsd.org/D26903

Modified:
  stable/11/lib/libc/tests/ssp/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/tests/ssp/Makefile
==
--- stable/11/lib/libc/tests/ssp/Makefile   Mon Oct 26 17:47:42 2020
(r367061)
+++ stable/11/lib/libc/tests/ssp/Makefile   Mon Oct 26 17:50:34 2020
(r367062)
@@ -6,7 +6,9 @@ NO_WERROR=
 WARNS?=2
 
 CFLAGS.h_raw+= -fstack-protector-all -Wstack-protector
-.if ${COMPILER_TYPE} == "clang"
+.if ${COMPILER_TYPE} == "clang" && ${CC} == "cc"
+# Only use -fsanitize=bounds when using the in-tree compiler.  Otherwise
+# we may link to a sanitizer library targeted at a newer kernel/libc.
 CFLAGS.h_raw+= -fsanitize=bounds
 .elif ${COMPILER_TYPE} == "gcc"
 CFLAGS.h_raw+= --param ssp-buffer-size=1
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r367061 - stable/12/lib/libc/tests/ssp

2020-10-26 Thread Brooks Davis
Author: brooks
Date: Mon Oct 26 17:47:42 2020
New Revision: 367061
URL: https://svnweb.freebsd.org/changeset/base/367061

Log:
  MFC r366981:
  
  Only use ASAN when using the in-tree compiler
  
  When building FreeBSD 11 on a FreeBSD 12 system with
  CROSS_TOOLCHAIN=llvm10 we end up trying to link against the packaged
  version of the sanitizer library.  This resulted in a requirement for
  getentropy(3) which is not present in FreeBSD 11.
  
  Reviewed by:  emaste
  Differential Revision:https://reviews.freebsd.org/D26903

Modified:
  stable/12/lib/libc/tests/ssp/Makefile
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libc/tests/ssp/Makefile
==
--- stable/12/lib/libc/tests/ssp/Makefile   Mon Oct 26 17:30:17 2020
(r367060)
+++ stable/12/lib/libc/tests/ssp/Makefile   Mon Oct 26 17:47:42 2020
(r367061)
@@ -6,7 +6,9 @@ NO_WERROR=
 WARNS?=2
 
 CFLAGS.h_raw+= -fstack-protector-all -Wstack-protector
-.if ${COMPILER_TYPE} == "clang"
+.if ${COMPILER_TYPE} == "clang" && ${CC} == "cc"
+# Only use -fsanitize=bounds when using the in-tree compiler.  Otherwise
+# we may link to a sanitizer library targeted at a newer kernel/libc.
 CFLAGS.h_raw+= -fsanitize=bounds
 .elif ${COMPILER_TYPE} == "gcc"
 CFLAGS.h_raw+= --param ssp-buffer-size=1
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366981 - head/lib/libc/tests/ssp

2020-10-23 Thread Brooks Davis
Author: brooks
Date: Fri Oct 23 22:27:45 2020
New Revision: 366981
URL: https://svnweb.freebsd.org/changeset/base/366981

Log:
  Only use ASAN when using the in-tree compiler
  
  When building FreeBSD 11 on a FreeBSD 12 system with
  CROSS_TOOLCHAIN=llvm10 we end up trying to link against the packaged
  version of the sanitizer library.  This resulted in a requirement for
  getentropy(3) which is not present in FreeBSD 11.
  
  Reviewed by:  emaste
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D26903

Modified:
  head/lib/libc/tests/ssp/Makefile

Modified: head/lib/libc/tests/ssp/Makefile
==
--- head/lib/libc/tests/ssp/MakefileFri Oct 23 21:27:48 2020
(r366980)
+++ head/lib/libc/tests/ssp/MakefileFri Oct 23 22:27:45 2020
(r366981)
@@ -6,7 +6,9 @@ NO_WERROR=
 WARNS?=2
 
 CFLAGS.h_raw+= -fstack-protector-all -Wstack-protector
-.if ${COMPILER_TYPE} == "clang"
+.if ${COMPILER_TYPE} == "clang" && ${CC} == "cc"
+# Only use -fsanitize=bounds when using the in-tree compiler.  Otherwise
+# we may link to a sanitizer library targeted at a newer kernel/libc.
 CFLAGS.h_raw+= -fsanitize=bounds
 .elif ${COMPILER_TYPE} == "gcc"
 CFLAGS.h_raw+= --param ssp-buffer-size=1
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366940 - stable/11/lib/libgssapi

2020-10-22 Thread Brooks Davis
Author: brooks
Date: Thu Oct 22 16:41:13 2020
New Revision: 366940
URL: https://svnweb.freebsd.org/changeset/base/366940

Log:
  MFC r366671:
  
  libgssapi: modernize static string array use
  
  Use designated initializers to document positions in the arrays rather
  than requiring counting. Use nitems() rather than rolling it by hand to
  count elements.
  
  Also, passify a Clang 12 warning about suspcious string concatenation
  within an array initializer by adding parentheses.
  
  Reviewed by:  emaste
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D26592

Modified:
  stable/11/lib/libgssapi/gss_display_status.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libgssapi/gss_display_status.c
==
--- stable/11/lib/libgssapi/gss_display_status.cThu Oct 22 16:29:21 
2020(r366939)
+++ stable/11/lib/libgssapi/gss_display_status.cThu Oct 22 16:41:13 
2020(r366940)
@@ -90,6 +90,7 @@
  * SUCH DAMAGE. 
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -103,17 +104,15 @@ static const char *
 calling_error(OM_uint32 v)
 {
 static const char *msgs[] = {
-   NULL,   /* 0 */
-   "A required input parameter could not be read.", /*  */
-   "A required output parameter could not be written.", /*  */
-   "A parameter was malformed"
+   [0] = "",
+   [1] = "A required input parameter could not be read.",
+   [2] = "A required output parameter could not be written.",
+   [3] = "A parameter was malformed",
 };
 
 v >>= GSS_C_CALLING_ERROR_OFFSET;
 
-if (v == 0)
-   return "";
-else if (v >= sizeof(msgs)/sizeof(*msgs))
+if (v >= nitems(msgs))
return "unknown calling error";
 else
return msgs[v];
@@ -123,31 +122,31 @@ static const char *
 routine_error(OM_uint32 v)
 {
 static const char *msgs[] = {
-   "Function completed successfully",  /* 0 */
-   "An unsupported mechanism was requested",
-   "An invalid name was supplied",
-   "A supplied name was of an unsupported type",
-   "Incorrect channel bindings were supplied",
-   "An invalid status code was supplied",
-   "A token had an invalid MIC",
-   "No credentials were supplied, "
-   "or the credentials were unavailable or inaccessible.",
-   "No context has been established",
-   "A token was invalid",
-   "A credential was invalid",
-   "The referenced credentials have expired",
-   "The context has expired",
-   "Miscellaneous failure (see text)",
-   "The quality-of-protection requested could not be provide",
-   "The operation is forbidden by local security policy",
-   "The operation or option is not available",
-   "The requested credential element already exists",
-   "The provided name was not a mechanism name.",
+   [0] = "Function completed successfully",
+   [1] = "An unsupported mechanism was requested",
+   [2] = "An invalid name was supplied",
+   [3] = "A supplied name was of an unsupported type",
+   [4] = "Incorrect channel bindings were supplied",
+   [5] = "An invalid status code was supplied",
+   [6] = "A token had an invalid MIC",
+   [7] = ("No credentials were supplied, "
+   "or the credentials were unavailable or inaccessible."),
+   [8] = "No context has been established",
+   [9] = "A token was invalid",
+   [10] = "A credential was invalid",
+   [11] =  "The referenced credentials have expired",
+   [12] = "The context has expired",
+   [13] = "Miscellaneous failure (see text)",
+   [14] = "The quality-of-protection requested could not be provide",
+   [15] = "The operation is forbidden by local security policy",
+   [16] = "The operation or option is not available",
+   [17] = "The requested credential element already exists",
+   [18] = "The provided name was not a mechanism name.",
 };
 
 v >>= GSS_C_ROUTINE_ERROR_OFFSET;
 
-if (v >= sizeof(msgs)/sizeof(*msgs))
+if (v >= nitems(msgs))
return "unknown routine error";
 else
return msgs[v];
@@ -157,17 +156,17 @@ static const char *
 supplementary_error(OM_uint32 v)
 {
 static const char *msgs[] = {
-   "normal completion",
-   "continuation call to routine required",
-   "duplicate per-message token detected",
-   "timed-out per-message token detected",
-   "reordered (early) per-message token detected",
-   "skipped predecessor token(s) detected"
+   [0] = "normal completion",
+   [1] = "continuation call to routine required",
+   [2] = "duplicate per-message token detected",
+   [3] = "timed-out per-message token detected",
+   [4] = "reordered (early) per-message token detected",
+   [5] = "skipped predecessor token(s) detected",
 };
 
 v >>= 

svn commit: r366939 - stable/11/sys/kern

2020-10-22 Thread Brooks Davis
Author: brooks
Date: Thu Oct 22 16:29:21 2020
New Revision: 366939
URL: https://svnweb.freebsd.org/changeset/base/366939

Log:
  MFC r366731:
  
  physio: Don't store user addresses in bio_data
  
  Only assign the address from the iovec to bio_data if it is a kernel
  address.  This was the single place where bio_data stored (however
  briefly) a userspace pointer.
  
  Reviewed by:  imp, markj
  Obtained from:CheriBSD
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D26783

Modified:
  stable/11/sys/kern/kern_physio.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/kern_physio.c
==
--- stable/11/sys/kern/kern_physio.cThu Oct 22 16:27:24 2020
(r366938)
+++ stable/11/sys/kern/kern_physio.cThu Oct 22 16:29:21 2020
(r366939)
@@ -43,7 +43,7 @@ physio(struct cdev *dev, struct uio *uio, int ioflag)
struct buf *pbuf;
struct bio *bp;
struct vm_page **pages;
-   caddr_t sa;
+   char *base, *sa;
u_int iolen, poff;
int error, i, npages, maxpages;
vm_prot_t prot;
@@ -136,7 +136,7 @@ physio(struct cdev *dev, struct uio *uio, int ioflag)
curthread->td_ru.ru_oublock++;
}
bp->bio_offset = uio->uio_offset;
-   bp->bio_data = uio->uio_iov[i].iov_base;
+   base = uio->uio_iov[i].iov_base;
bp->bio_length = uio->uio_iov[i].iov_len;
if (bp->bio_length > dev->si_iosize_max)
bp->bio_length = dev->si_iosize_max;
@@ -149,13 +149,13 @@ physio(struct cdev *dev, struct uio *uio, int ioflag)
 * larger than MAXPHYS - PAGE_SIZE must be
 * page aligned or it will be fragmented.
 */
-   poff = (vm_offset_t)bp->bio_data & PAGE_MASK;
+   poff = (vm_offset_t)base & PAGE_MASK;
if (pbuf && bp->bio_length + poff > pbuf->b_kvasize) {
if (dev->si_flags & SI_NOSPLIT) {
uprintf("%s: request ptr %p is not "
"on a page boundary; cannot split "
"request\n", devtoname(dev),
-   bp->bio_data);
+   base);
error = EFBIG;
goto doerror;
}
@@ -170,7 +170,7 @@ physio(struct cdev *dev, struct uio *uio, int ioflag)
if (pages) {
if ((npages = vm_fault_quick_hold_pages(
>p_vmspace->vm_map,
-   (vm_offset_t)bp->bio_data, bp->bio_length,
+   (vm_offset_t)base, bp->bio_length,
prot, pages, maxpages)) < 0) {
error = EFAULT;
goto doerror;
@@ -186,7 +186,8 @@ physio(struct cdev *dev, struct uio *uio, int ioflag)
bp->bio_data = unmapped_buf;
bp->bio_flags |= BIO_UNMAPPED;
}
-   }
+   } else
+   bp->bio_data = base;
 
csw->d_strategy(bp);
if (uio->uio_rw == UIO_READ)
___
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: r366938 - stable/12/sys/kern

2020-10-22 Thread Brooks Davis
Author: brooks
Date: Thu Oct 22 16:27:24 2020
New Revision: 366938
URL: https://svnweb.freebsd.org/changeset/base/366938

Log:
  MFC r366731:
  
  physio: Don't store user addresses in bio_data
  
  Only assign the address from the iovec to bio_data if it is a kernel
  address.  This was the single place where bio_data stored (however
  briefly) a userspace pointer.
  
  Reviewed by:  imp, markj
  Obtained from:CheriBSD
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D26783

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

Modified: stable/12/sys/kern/kern_physio.c
==
--- stable/12/sys/kern/kern_physio.cThu Oct 22 15:23:41 2020
(r366937)
+++ stable/12/sys/kern/kern_physio.cThu Oct 22 16:27:24 2020
(r366938)
@@ -45,7 +45,7 @@ physio(struct cdev *dev, struct uio *uio, int ioflag)
struct buf *pbuf;
struct bio *bp;
struct vm_page **pages;
-   caddr_t sa;
+   char *base, *sa;
u_int iolen, poff;
int error, i, npages, maxpages;
vm_prot_t prot;
@@ -140,7 +140,7 @@ physio(struct cdev *dev, struct uio *uio, int ioflag)
curthread->td_ru.ru_oublock++;
}
bp->bio_offset = uio->uio_offset;
-   bp->bio_data = uio->uio_iov[i].iov_base;
+   base = uio->uio_iov[i].iov_base;
bp->bio_length = uio->uio_iov[i].iov_len;
if (bp->bio_length > dev->si_iosize_max)
bp->bio_length = dev->si_iosize_max;
@@ -153,13 +153,13 @@ physio(struct cdev *dev, struct uio *uio, int ioflag)
 * larger than MAXPHYS - PAGE_SIZE must be
 * page aligned or it will be fragmented.
 */
-   poff = (vm_offset_t)bp->bio_data & PAGE_MASK;
+   poff = (vm_offset_t)base & PAGE_MASK;
if (pbuf && bp->bio_length + poff > pbuf->b_kvasize) {
if (dev->si_flags & SI_NOSPLIT) {
uprintf("%s: request ptr %p is not "
"on a page boundary; cannot split "
"request\n", devtoname(dev),
-   bp->bio_data);
+   base);
error = EFBIG;
goto doerror;
}
@@ -174,7 +174,7 @@ physio(struct cdev *dev, struct uio *uio, int ioflag)
if (pages) {
if ((npages = vm_fault_quick_hold_pages(
>p_vmspace->vm_map,
-   (vm_offset_t)bp->bio_data, bp->bio_length,
+   (vm_offset_t)base, bp->bio_length,
prot, pages, maxpages)) < 0) {
error = EFAULT;
goto doerror;
@@ -190,7 +190,8 @@ physio(struct cdev *dev, struct uio *uio, int ioflag)
bp->bio_data = unmapped_buf;
bp->bio_flags |= BIO_UNMAPPED;
}
-   }
+   } else
+   bp->bio_data = base;
 
csw->d_strategy(bp);
if (uio->uio_rw == UIO_READ)
___
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: r366912 - stable/12/lib/libgssapi

2020-10-21 Thread Brooks Davis
Author: brooks
Date: Wed Oct 21 16:04:57 2020
New Revision: 366912
URL: https://svnweb.freebsd.org/changeset/base/366912

Log:
  MFC r366671:
  
  libgssapi: modernize static string array use
  
  Use designated initializers to document positions in the arrays rather
  than requiring counting. Use nitems() rather than rolling it by hand to
  count elements.
  
  Also, passify a Clang 12 warning about suspcious string concatenation
  within an array initializer by adding parentheses.
  
  Reviewed by:  emaste
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D26592

Modified:
  stable/12/lib/libgssapi/gss_display_status.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libgssapi/gss_display_status.c
==
--- stable/12/lib/libgssapi/gss_display_status.cWed Oct 21 16:00:15 
2020(r366911)
+++ stable/12/lib/libgssapi/gss_display_status.cWed Oct 21 16:04:57 
2020(r366912)
@@ -92,6 +92,7 @@
  * SUCH DAMAGE. 
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -105,17 +106,15 @@ static const char *
 calling_error(OM_uint32 v)
 {
 static const char *msgs[] = {
-   NULL,   /* 0 */
-   "A required input parameter could not be read.", /*  */
-   "A required output parameter could not be written.", /*  */
-   "A parameter was malformed"
+   [0] = "",
+   [1] = "A required input parameter could not be read.",
+   [2] = "A required output parameter could not be written.",
+   [3] = "A parameter was malformed",
 };
 
 v >>= GSS_C_CALLING_ERROR_OFFSET;
 
-if (v == 0)
-   return "";
-else if (v >= sizeof(msgs)/sizeof(*msgs))
+if (v >= nitems(msgs))
return "unknown calling error";
 else
return msgs[v];
@@ -125,31 +124,31 @@ static const char *
 routine_error(OM_uint32 v)
 {
 static const char *msgs[] = {
-   "Function completed successfully",  /* 0 */
-   "An unsupported mechanism was requested",
-   "An invalid name was supplied",
-   "A supplied name was of an unsupported type",
-   "Incorrect channel bindings were supplied",
-   "An invalid status code was supplied",
-   "A token had an invalid MIC",
-   "No credentials were supplied, "
-   "or the credentials were unavailable or inaccessible.",
-   "No context has been established",
-   "A token was invalid",
-   "A credential was invalid",
-   "The referenced credentials have expired",
-   "The context has expired",
-   "Miscellaneous failure (see text)",
-   "The quality-of-protection requested could not be provide",
-   "The operation is forbidden by local security policy",
-   "The operation or option is not available",
-   "The requested credential element already exists",
-   "The provided name was not a mechanism name.",
+   [0] = "Function completed successfully",
+   [1] = "An unsupported mechanism was requested",
+   [2] = "An invalid name was supplied",
+   [3] = "A supplied name was of an unsupported type",
+   [4] = "Incorrect channel bindings were supplied",
+   [5] = "An invalid status code was supplied",
+   [6] = "A token had an invalid MIC",
+   [7] = ("No credentials were supplied, "
+   "or the credentials were unavailable or inaccessible."),
+   [8] = "No context has been established",
+   [9] = "A token was invalid",
+   [10] = "A credential was invalid",
+   [11] =  "The referenced credentials have expired",
+   [12] = "The context has expired",
+   [13] = "Miscellaneous failure (see text)",
+   [14] = "The quality-of-protection requested could not be provide",
+   [15] = "The operation is forbidden by local security policy",
+   [16] = "The operation or option is not available",
+   [17] = "The requested credential element already exists",
+   [18] = "The provided name was not a mechanism name.",
 };
 
 v >>= GSS_C_ROUTINE_ERROR_OFFSET;
 
-if (v >= sizeof(msgs)/sizeof(*msgs))
+if (v >= nitems(msgs))
return "unknown routine error";
 else
return msgs[v];
@@ -159,17 +158,17 @@ static const char *
 supplementary_error(OM_uint32 v)
 {
 static const char *msgs[] = {
-   "normal completion",
-   "continuation call to routine required",
-   "duplicate per-message token detected",
-   "timed-out per-message token detected",
-   "reordered (early) per-message token detected",
-   "skipped predecessor token(s) detected"
+   [0] = "normal completion",
+   [1] = "continuation call to routine required",
+   [2] = "duplicate per-message token detected",
+   [3] = "timed-out per-message token detected",
+   [4] = "reordered (early) per-message token detected",
+   [5] = "skipped predecessor token(s) detected",
 };
 
 v >>= 

svn commit: r366911 - in head/sys: cam dev/nvme kern sys ufs/ffs

2020-10-21 Thread Brooks Davis
Author: brooks
Date: Wed Oct 21 16:00:15 2020
New Revision: 366911
URL: https://svnweb.freebsd.org/changeset/base/366911

Log:
  vmapbuf: don't smuggle address or length in buf
  
  Instead, add arguments to vmapbuf.  Since this argument is
  always a pointer use a type of void * and cast to vm_offset_t in
  vmapbuf.  (In CheriBSD we've altered vm_fault_quick_hold_pages to
  take a pointer and check its bounds.)
  
  In no other situtation does b_data contain a user pointer and vmapbuf
  replaces b_data with the actual mapping.
  
  Suggested by: jhb
  Reviewed by:  imp, jhb
  Obtained from:CheriBSD
  MFC after:1 week
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D26784

Modified:
  head/sys/cam/cam_periph.c
  head/sys/dev/nvme/nvme_ctrlr.c
  head/sys/kern/vfs_bio.c
  head/sys/sys/buf.h
  head/sys/ufs/ffs/ffs_rawread.c

Modified: head/sys/cam/cam_periph.c
==
--- head/sys/cam/cam_periph.c   Wed Oct 21 15:06:44 2020(r366910)
+++ head/sys/cam/cam_periph.c   Wed Oct 21 16:00:15 2020(r366911)
@@ -955,18 +955,12 @@ cam_periph_mapmem(union ccb *ccb, struct cam_periph_ma
 */
mapinfo->bp[i] = uma_zalloc(pbuf_zone, M_WAITOK);
 
-   /* put our pointer in the data slot */
-   mapinfo->bp[i]->b_data = *data_ptrs[i];
-
-   /* set the transfer length, we know it's < MAXPHYS */
-   mapinfo->bp[i]->b_bufsize = lengths[i];
-
/* set the direction */
mapinfo->bp[i]->b_iocmd = (dirs[i] == CAM_DIR_OUT) ?
BIO_WRITE : BIO_READ;
 
/* Map the buffer into kernel memory. */
-   if (vmapbuf(mapinfo->bp[i], 1) < 0) {
+   if (vmapbuf(mapinfo->bp[i], *data_ptrs[i], lengths[i], 1) < 0) {
uma_zfree(pbuf_zone, mapinfo->bp[i]);
goto fail;
}

Modified: head/sys/dev/nvme/nvme_ctrlr.c
==
--- head/sys/dev/nvme/nvme_ctrlr.c  Wed Oct 21 15:06:44 2020
(r366910)
+++ head/sys/dev/nvme/nvme_ctrlr.c  Wed Oct 21 16:00:15 2020
(r366911)
@@ -1268,10 +1268,8 @@ nvme_ctrlr_passthrough_cmd(struct nvme_controller *ctr
 */
PHOLD(curproc);
buf = uma_zalloc(pbuf_zone, M_WAITOK);
-   buf->b_data = pt->buf;
-   buf->b_bufsize = pt->len;
buf->b_iocmd = pt->is_read ? BIO_READ : BIO_WRITE;
-   if (vmapbuf(buf, 1) < 0) {
+   if (vmapbuf(buf, pt->buf, pt->len, 1) < 0) {
ret = EFAULT;
goto err;
}

Modified: head/sys/kern/vfs_bio.c
==
--- head/sys/kern/vfs_bio.c Wed Oct 21 15:06:44 2020(r366910)
+++ head/sys/kern/vfs_bio.c Wed Oct 21 16:00:15 2020(r366911)
@@ -4907,22 +4907,21 @@ vm_hold_free_pages(struct buf *bp, int newbsize)
  * This function only works with pager buffers.
  */
 int
-vmapbuf(struct buf *bp, int mapbuf)
+vmapbuf(struct buf *bp, void *uaddr, size_t len, int mapbuf)
 {
vm_prot_t prot;
int pidx;
 
-   if (bp->b_bufsize < 0)
-   return (-1);
prot = VM_PROT_READ;
if (bp->b_iocmd == BIO_READ)
prot |= VM_PROT_WRITE;  /* Less backwards than it looks */
if ((pidx = vm_fault_quick_hold_pages(>p_vmspace->vm_map,
-   (vm_offset_t)bp->b_data, bp->b_bufsize, prot, bp->b_pages,
+   (vm_offset_t)uaddr, len, prot, bp->b_pages,
btoc(MAXPHYS))) < 0)
return (-1);
+   bp->b_bufsize = len;
bp->b_npages = pidx;
-   bp->b_offset = ((vm_offset_t)bp->b_data) & PAGE_MASK;
+   bp->b_offset = ((vm_offset_t)uaddr) & PAGE_MASK;
if (mapbuf || !unmapped_buf_allowed) {
pmap_qenter((vm_offset_t)bp->b_kvabase, bp->b_pages, pidx);
bp->b_data = bp->b_kvabase + bp->b_offset;

Modified: head/sys/sys/buf.h
==
--- head/sys/sys/buf.h  Wed Oct 21 15:06:44 2020(r366910)
+++ head/sys/sys/buf.h  Wed Oct 21 16:00:15 2020(r366911)
@@ -575,7 +575,7 @@ voidvfs_bio_set_flags(struct buf *bp, int ioflags);
 void   vfs_bio_set_valid(struct buf *, int base, int size);
 void   vfs_busy_pages(struct buf *, int clear_modify);
 void   vfs_unbusy_pages(struct buf *);
-intvmapbuf(struct buf *, int);
+intvmapbuf(struct buf *, void *, size_t, int);
 void   vunmapbuf(struct buf *);
 void   brelvp(struct buf *);
 void   bgetvp(struct vnode *, struct buf *);

Modified: head/sys/ufs/ffs/ffs_rawread.c

svn commit: r366731 - head/sys/kern

2020-10-15 Thread Brooks Davis
Author: brooks
Date: Thu Oct 15 17:05:21 2020
New Revision: 366731
URL: https://svnweb.freebsd.org/changeset/base/366731

Log:
  physio: Don't store user addresses in bio_data
  
  Only assign the address from the iovec to bio_data if it is a kernel
  address.  This was the single place where bio_data stored (however
  briefly) a userspace pointer.
  
  Reviewed by:  imp, markj
  Obtained from:CheriBSD
  MFC after:1 week
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D26783

Modified:
  head/sys/kern/kern_physio.c

Modified: head/sys/kern/kern_physio.c
==
--- head/sys/kern/kern_physio.c Thu Oct 15 15:36:08 2020(r366730)
+++ head/sys/kern/kern_physio.c Thu Oct 15 17:05:21 2020(r366731)
@@ -45,7 +45,7 @@ physio(struct cdev *dev, struct uio *uio, int ioflag)
struct buf *pbuf;
struct bio *bp;
struct vm_page **pages;
-   caddr_t sa;
+   char *base, *sa;
u_int iolen, poff;
int error, i, npages, maxpages;
vm_prot_t prot;
@@ -140,7 +140,7 @@ physio(struct cdev *dev, struct uio *uio, int ioflag)
curthread->td_ru.ru_oublock++;
}
bp->bio_offset = uio->uio_offset;
-   bp->bio_data = uio->uio_iov[i].iov_base;
+   base = uio->uio_iov[i].iov_base;
bp->bio_length = uio->uio_iov[i].iov_len;
if (bp->bio_length > dev->si_iosize_max)
bp->bio_length = dev->si_iosize_max;
@@ -153,13 +153,13 @@ physio(struct cdev *dev, struct uio *uio, int ioflag)
 * larger than MAXPHYS - PAGE_SIZE must be
 * page aligned or it will be fragmented.
 */
-   poff = (vm_offset_t)bp->bio_data & PAGE_MASK;
+   poff = (vm_offset_t)base & PAGE_MASK;
if (pbuf && bp->bio_length + poff > pbuf->b_kvasize) {
if (dev->si_flags & SI_NOSPLIT) {
uprintf("%s: request ptr %p is not "
"on a page boundary; cannot split "
"request\n", devtoname(dev),
-   bp->bio_data);
+   base);
error = EFBIG;
goto doerror;
}
@@ -174,7 +174,7 @@ physio(struct cdev *dev, struct uio *uio, int ioflag)
if (pages) {
if ((npages = vm_fault_quick_hold_pages(
>p_vmspace->vm_map,
-   (vm_offset_t)bp->bio_data, bp->bio_length,
+   (vm_offset_t)base, bp->bio_length,
prot, pages, maxpages)) < 0) {
error = EFAULT;
goto doerror;
@@ -190,7 +190,8 @@ physio(struct cdev *dev, struct uio *uio, int ioflag)
bp->bio_data = unmapped_buf;
bp->bio_flags |= BIO_UNMAPPED;
}
-   }
+   } else
+   bp->bio_data = base;
 
csw->d_strategy(bp);
if (uio->uio_rw == UIO_READ)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r366697 - head/usr.bin/xinstall

2020-10-14 Thread Brooks Davis
On Wed, Oct 14, 2020 at 02:40:42PM +0100, Jessica Clarke wrote:
> On 14 Oct 2020, at 14:28, Mateusz Guzik  wrote:
> > 
> > This should use copy_file_range (also available on Linux).
> 
> I assume this is a bootstrap tool and hence the system OS and version
> is relevant. macOS does not have copy_file_range, and FreeBSD only has
> it in -CURRENT so that would break building on 11.x and 12.x. So any
> use would need to be guarded by preprocessor checks (and there are
> still actively-supported Linux distributions out there that are based
> on too-old versions of the kernel and/or glibc to include it).
> 
> (FYI macOS's equivalent is copyfile(3)... maybe one day it will adopt
> the copy_file_range(2) interface too)

copyfile has different semantics, not the least of which is supporting
file clones.  Once ZFS grows file clone support it would be nice if install
supported them as well.  I'd love to only pay the inode cost for
installed files when I'm just building a disk image.

-- Brooks


signature.asc
Description: PGP signature


svn commit: r366684 - head/share/mk

2020-10-13 Thread Brooks Davis
Author: brooks
Date: Tue Oct 13 20:04:13 2020
New Revision: 366684
URL: https://svnweb.freebsd.org/changeset/base/366684

Log:
  Remove --ld-path=* from _LDFLAGS
  
  It makes no sense to pass --ld-path to direct ${LD} invocations.
  
  This was missed in r366270 due to not doing a clean build.

Modified:
  head/share/mk/sys.mk

Modified: head/share/mk/sys.mk
==
--- head/share/mk/sys.mkTue Oct 13 19:42:22 2020(r366683)
+++ head/share/mk/sys.mkTue Oct 13 20:04:13 2020(r366684)
@@ -240,7 +240,7 @@ LFLAGS  ?=
 # compiler driver flags (e.g. -mabi=*) that conflict with flags to LD.
 LD ?=  ld
 LDFLAGS?=
-_LDFLAGS   =   ${LDFLAGS:S/-Wl,//g:N-mabi=*:N-fuse-ld=*}
+_LDFLAGS   =   ${LDFLAGS:S/-Wl,//g:N-mabi=*:N-fuse-ld=*:N--ld-path=*}
 
 MAKE   ?=  make
 
___
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: r366671 - head/lib/libgssapi

2020-10-13 Thread Brooks Davis
Author: brooks
Date: Tue Oct 13 17:14:30 2020
New Revision: 366671
URL: https://svnweb.freebsd.org/changeset/base/366671

Log:
  libgssapi: modernize static string array use
  
  Use designated initializers to document positions in the arrays rather
  than requiring counting. Use nitems() rather than rolling it by hand to
  count elements.
  
  Also, passify a Clang 12 warning about suspcious string concatenation
  within an array initializer by adding parentheses.
  
  Reviewed by:  emaste
  MFC after:1 week
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D26592

Modified:
  head/lib/libgssapi/gss_display_status.c

Modified: head/lib/libgssapi/gss_display_status.c
==
--- head/lib/libgssapi/gss_display_status.c Tue Oct 13 16:51:05 2020
(r366670)
+++ head/lib/libgssapi/gss_display_status.c Tue Oct 13 17:14:30 2020
(r366671)
@@ -92,6 +92,7 @@
  * SUCH DAMAGE. 
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -105,17 +106,15 @@ static const char *
 calling_error(OM_uint32 v)
 {
 static const char *msgs[] = {
-   NULL,   /* 0 */
-   "A required input parameter could not be read.", /*  */
-   "A required output parameter could not be written.", /*  */
-   "A parameter was malformed"
+   [0] = "",
+   [1] = "A required input parameter could not be read.",
+   [2] = "A required output parameter could not be written.",
+   [3] = "A parameter was malformed",
 };
 
 v >>= GSS_C_CALLING_ERROR_OFFSET;
 
-if (v == 0)
-   return "";
-else if (v >= sizeof(msgs)/sizeof(*msgs))
+if (v >= nitems(msgs))
return "unknown calling error";
 else
return msgs[v];
@@ -125,31 +124,31 @@ static const char *
 routine_error(OM_uint32 v)
 {
 static const char *msgs[] = {
-   "Function completed successfully",  /* 0 */
-   "An unsupported mechanism was requested",
-   "An invalid name was supplied",
-   "A supplied name was of an unsupported type",
-   "Incorrect channel bindings were supplied",
-   "An invalid status code was supplied",
-   "A token had an invalid MIC",
-   "No credentials were supplied, "
-   "or the credentials were unavailable or inaccessible.",
-   "No context has been established",
-   "A token was invalid",
-   "A credential was invalid",
-   "The referenced credentials have expired",
-   "The context has expired",
-   "Miscellaneous failure (see text)",
-   "The quality-of-protection requested could not be provide",
-   "The operation is forbidden by local security policy",
-   "The operation or option is not available",
-   "The requested credential element already exists",
-   "The provided name was not a mechanism name.",
+   [0] = "Function completed successfully",
+   [1] = "An unsupported mechanism was requested",
+   [2] = "An invalid name was supplied",
+   [3] = "A supplied name was of an unsupported type",
+   [4] = "Incorrect channel bindings were supplied",
+   [5] = "An invalid status code was supplied",
+   [6] = "A token had an invalid MIC",
+   [7] = ("No credentials were supplied, "
+   "or the credentials were unavailable or inaccessible."),
+   [8] = "No context has been established",
+   [9] = "A token was invalid",
+   [10] = "A credential was invalid",
+   [11] =  "The referenced credentials have expired",
+   [12] = "The context has expired",
+   [13] = "Miscellaneous failure (see text)",
+   [14] = "The quality-of-protection requested could not be provide",
+   [15] = "The operation is forbidden by local security policy",
+   [16] = "The operation or option is not available",
+   [17] = "The requested credential element already exists",
+   [18] = "The provided name was not a mechanism name.",
 };
 
 v >>= GSS_C_ROUTINE_ERROR_OFFSET;
 
-if (v >= sizeof(msgs)/sizeof(*msgs))
+if (v >= nitems(msgs))
return "unknown routine error";
 else
return msgs[v];
@@ -159,17 +158,17 @@ static const char *
 supplementary_error(OM_uint32 v)
 {
 static const char *msgs[] = {
-   "normal completion",
-   "continuation call to routine required",
-   "duplicate per-message token detected",
-   "timed-out per-message token detected",
-   "reordered (early) per-message token detected",
-   "skipped predecessor token(s) detected"
+   [0] = "normal completion",
+   [1] = "continuation call to routine required",
+   [2] = "duplicate per-message token detected",
+   [3] = "timed-out per-message token detected",
+   [4] = "reordered (early) per-message token detected",
+   [5] = "skipped predecessor token(s) detected",
 };
 
 v >>= GSS_C_SUPPLEMENTARY_OFFSET;
 
-if (v >= sizeof(msgs)/sizeof(*msgs))
+ 

svn commit: r366273 - head/share/mk

2020-09-29 Thread Brooks Davis
Author: brooks
Date: Tue Sep 29 23:48:05 2020
New Revision: 366273
URL: https://svnweb.freebsd.org/changeset/base/366273

Log:
  Hoist comment on fixup of ld path
  
  Reported by:  jrtc27
  Differential Revision:https://reviews.freebsd.org/D26591

Modified:
  head/share/mk/bsd.sys.mk

Modified: head/share/mk/bsd.sys.mk
==
--- head/share/mk/bsd.sys.mkTue Sep 29 23:35:46 2020(r366272)
+++ head/share/mk/bsd.sys.mkTue Sep 29 23:48:05 2020(r366273)
@@ -297,10 +297,10 @@ CFLAGS+=  ERROR-tried-to-rebuild-during-make-install
 .if ${LD} != "ld" && (${CC:[1]:H} != ${LD:[1]:H} || ${LD:[1]:T} != "ld")
 # Add -fuse-ld=${LD} if $LD is in a different directory or not called "ld".
 .if ${COMPILER_TYPE} == "clang"
+# Note: Clang does not like relative paths for ld so we map ld.lld -> lld.
 .if ${COMPILER_VERSION} >= 12
 LDFLAGS+=  --ld-path=${LD:[1]:S/^ld.//1W}
 .else
-# Note: Clang does not like relative paths in -fuse-ld so we map ld.lld -> lld.
 LDFLAGS+=  -fuse-ld=${LD:[1]:S/^ld.//1W}
 .endif
 .else
___
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: r366270 - head/share/mk

2020-09-29 Thread Brooks Davis
Author: brooks
Date: Tue Sep 29 22:30:15 2020
New Revision: 366270
URL: https://svnweb.freebsd.org/changeset/base/366270

Log:
  Prefer --ld-path=/path/to/ld on clang >= 12
  
  Clang 12 warns about passing a path to -fuse-ld and -Werror makes that
  an error preventing building world without this change.
  
  Reviewed by:  arichardson, emaste
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D26591

Modified:
  head/share/mk/bsd.sys.mk

Modified: head/share/mk/bsd.sys.mk
==
--- head/share/mk/bsd.sys.mkTue Sep 29 21:51:32 2020(r366269)
+++ head/share/mk/bsd.sys.mkTue Sep 29 22:30:15 2020(r366270)
@@ -296,10 +296,13 @@ CFLAGS+=  ERROR-tried-to-rebuild-during-make-install
 # Please keep this if in sync with kern.mk
 .if ${LD} != "ld" && (${CC:[1]:H} != ${LD:[1]:H} || ${LD:[1]:T} != "ld")
 # Add -fuse-ld=${LD} if $LD is in a different directory or not called "ld".
-# Note: Clang 12+ will prefer --ld-path= over -fuse-ld=.
 .if ${COMPILER_TYPE} == "clang"
+.if ${COMPILER_VERSION} >= 12
+LDFLAGS+=  --ld-path=${LD:[1]:S/^ld.//1W}
+.else
 # Note: Clang does not like relative paths in -fuse-ld so we map ld.lld -> lld.
 LDFLAGS+=  -fuse-ld=${LD:[1]:S/^ld.//1W}
+.endif
 .else
 # GCC does not support an absolute path for -fuse-ld so we just print this
 # warning instead and let the user add the required symlinks.
___
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: r365864 - stable/11/sys/kern

2020-09-17 Thread Brooks Davis
Author: brooks
Date: Thu Sep 17 23:14:17 2020
New Revision: 365864
URL: https://svnweb.freebsd.org/changeset/base/365864

Log:
  MFC r365284:
  
  Always report ENOSYS in init
  
  While rare, encountering an unimplemented system call early in init is
  catastrophic and difficult to debug.  Even after a SIGSYS handler is
  registered, such configurations are problematic.  As such, always report
  such events for pid 1 (following kern.lognosys if non-zero).
  
  Reviewed by:  kevans, imp
  Obtained from:CheriBSD (plus suggestions from kevans)
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D26288

Modified:
  stable/11/sys/kern/kern_sig.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/kern_sig.c
==
--- stable/11/sys/kern/kern_sig.c   Thu Sep 17 22:29:38 2020
(r365863)
+++ stable/11/sys/kern/kern_sig.c   Thu Sep 17 23:14:17 2020
(r365864)
@@ -3731,7 +3731,8 @@ nosys(struct thread *td, struct nosys_args *args)
uprintf("pid %d comm %s: nosys %d\n", p->p_pid, p->p_comm,
td->td_sa.code);
}
-   if (kern_lognosys == 2 || kern_lognosys == 3) {
+   if (kern_lognosys == 2 || kern_lognosys == 3 ||
+   (p->p_pid == 1 && (kern_lognosys & 3) == 0)) {
printf("pid %d comm %s: nosys %d\n", p->p_pid, p->p_comm,
td->td_sa.code);
}
___
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: r365545 - stable/12/sys/kern

2020-09-09 Thread Brooks Davis
Author: brooks
Date: Wed Sep  9 23:11:55 2020
New Revision: 365545
URL: https://svnweb.freebsd.org/changeset/base/365545

Log:
  MFC r365284:
  
  Always report ENOSYS in init
  
  While rare, encountering an unimplemented system call early in init is
  catastrophic and difficult to debug.  Even after a SIGSYS handler is
  registered, such configurations are problematic.  As such, always report
  such events for pid 1 (following kern.lognosys if non-zero).
  
  Reviewed by:  kevans, imp
  Obtained from:CheriBSD (plus suggestions from kevans)
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D26288

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

Modified: stable/12/sys/kern/kern_sig.c
==
--- stable/12/sys/kern/kern_sig.c   Wed Sep  9 23:06:35 2020
(r365544)
+++ stable/12/sys/kern/kern_sig.c   Wed Sep  9 23:11:55 2020
(r365545)
@@ -3760,7 +3760,8 @@ nosys(struct thread *td, struct nosys_args *args)
uprintf("pid %d comm %s: nosys %d\n", p->p_pid, p->p_comm,
td->td_sa.code);
}
-   if (kern_lognosys == 2 || kern_lognosys == 3) {
+   if (kern_lognosys == 2 || kern_lognosys == 3 ||
+   (p->p_pid == 1 && (kern_lognosys & 3) == 0)) {
printf("pid %d comm %s: nosys %d\n", p->p_pid, p->p_comm,
td->td_sa.code);
}
___
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: r365534 - stable/11/sbin/init

2020-09-09 Thread Brooks Davis
Author: brooks
Date: Wed Sep  9 22:40:39 2020
New Revision: 365534
URL: https://svnweb.freebsd.org/changeset/base/365534

Log:
  MFC r365279:
  
  Remove risky compatability with old kernels
  
  The badsys() handler for SIGSYS was added as a transtion aid for kernels
  lacking sysctl() in 1993.  It is unsafe and unsound so remove it rather
  than running the risk of a privilege-dropping system call being silently
  omitted.
  
  This partially reverts SCCSID 6.12 (Berkeley) 03/03/93 "add code to
  change the system security level".
  
  Reviewed by:  mckusick, imp, kevans
  Obtained from:CheriBSD
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D26289

Modified:
  stable/11/sbin/init/init.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/init/init.c
==
--- stable/11/sbin/init/init.c  Wed Sep  9 22:40:14 2020(r365533)
+++ stable/11/sbin/init/init.c  Wed Sep  9 22:40:39 2020(r365534)
@@ -104,7 +104,6 @@ static void stall(const char *, ...) __printflike(1, 2
 static void warning(const char *, ...) __printflike(1, 2);
 static void emergency(const char *, ...) __printflike(1, 2);
 static void disaster(int);
-static void badsys(int);
 static void revoke_ttys(void);
 static int  runshutdown(void);
 static char *strk(char *);
@@ -305,9 +304,8 @@ invalid:
 * We catch or block signals rather than ignore them,
 * so that they get reset on exec.
 */
-   handle(badsys, SIGSYS, 0);
-   handle(disaster, SIGABRT, SIGFPE, SIGILL, SIGSEGV, SIGBUS, SIGXCPU,
-   SIGXFSZ, 0);
+   handle(disaster, SIGABRT, SIGFPE, SIGILL, SIGSEGV, SIGBUS, SIGSYS,
+   SIGXCPU, SIGXFSZ, 0);
handle(transition_handler, SIGHUP, SIGINT, SIGEMT, SIGTERM, SIGTSTP,
SIGUSR1, SIGUSR2, 0);
handle(alrm_handler, SIGALRM, 0);
@@ -502,22 +500,6 @@ emergency(const char *message, ...)
 
vsyslog(LOG_EMERG, message, ap);
va_end(ap);
-}
-
-/*
- * Catch a SIGSYS signal.
- *
- * These may arise if a system does not support sysctl.
- * We tolerate up to 25 of these, then throw in the towel.
- */
-static void
-badsys(int sig)
-{
-   static int badcount = 0;
-
-   if (badcount++ < 25)
-   return;
-   disaster(sig);
 }
 
 /*
___
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: r365519 - stable/12/sbin/init

2020-09-09 Thread Brooks Davis
Author: brooks
Date: Wed Sep  9 21:57:55 2020
New Revision: 365519
URL: https://svnweb.freebsd.org/changeset/base/365519

Log:
  MFC r365279:
  
  Remove risky compatability with old kernels
  
  The badsys() handler for SIGSYS was added as a transtion aid for kernels
  lacking sysctl() in 1993.  It is unsafe and unsound so remove it rather
  than running the risk of a privilege-dropping system call being silently
  omitted.
  
  This partially reverts SCCSID 6.12 (Berkeley) 03/03/93 "add code to
  change the system security level".
  
  Reviewed by:  mckusick, imp, kevans
  Obtained from:CheriBSD
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D26289

Modified:
  stable/12/sbin/init/init.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/init/init.c
==
--- stable/12/sbin/init/init.c  Wed Sep  9 21:50:24 2020(r365518)
+++ stable/12/sbin/init/init.c  Wed Sep  9 21:57:55 2020(r365519)
@@ -106,7 +106,6 @@ static void stall(const char *, ...) __printflike(1, 2
 static void warning(const char *, ...) __printflike(1, 2);
 static void emergency(const char *, ...) __printflike(1, 2);
 static void disaster(int);
-static void badsys(int);
 static void revoke_ttys(void);
 static int  runshutdown(void);
 static char *strk(char *);
@@ -307,9 +306,8 @@ invalid:
 * We catch or block signals rather than ignore them,
 * so that they get reset on exec.
 */
-   handle(badsys, SIGSYS, 0);
-   handle(disaster, SIGABRT, SIGFPE, SIGILL, SIGSEGV, SIGBUS, SIGXCPU,
-   SIGXFSZ, 0);
+   handle(disaster, SIGABRT, SIGFPE, SIGILL, SIGSEGV, SIGBUS, SIGSYS,
+   SIGXCPU, SIGXFSZ, 0);
handle(transition_handler, SIGHUP, SIGINT, SIGEMT, SIGTERM, SIGTSTP,
SIGUSR1, SIGUSR2, SIGWINCH, 0);
handle(alrm_handler, SIGALRM, 0);
@@ -504,22 +502,6 @@ emergency(const char *message, ...)
 
vsyslog(LOG_EMERG, message, ap);
va_end(ap);
-}
-
-/*
- * Catch a SIGSYS signal.
- *
- * These may arise if a system does not support sysctl.
- * We tolerate up to 25 of these, then throw in the towel.
- */
-static void
-badsys(int sig)
-{
-   static int badcount = 0;
-
-   if (badcount++ < 25)
-   return;
-   disaster(sig);
 }
 
 /*
___
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: r365344 - head/sys/riscv/riscv

2020-09-04 Thread Brooks Davis
Author: brooks
Date: Fri Sep  4 21:55:22 2020
New Revision: 365344
URL: https://svnweb.freebsd.org/changeset/base/365344

Log:
  Round TF_SIZE up to the stack alignment (16-bytes).
  
  The kernel adjusts the stack by TF_SIZE and the RISC-V ABI requires
  that it remain 16-byte aligned.
  
  Reported by:  CHERI, jrtc27
  Reviewed by:  mhorne
  Obtained from:CheriBSD
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D26328

Modified:
  head/sys/riscv/riscv/genassym.c

Modified: head/sys/riscv/riscv/genassym.c
==
--- head/sys/riscv/riscv/genassym.c Fri Sep  4 21:48:36 2020
(r365343)
+++ head/sys/riscv/riscv/genassym.c Fri Sep  4 21:55:22 2020
(r365344)
@@ -87,7 +87,7 @@ ASSYM(TD_FRAME, offsetof(struct thread, td_frame));
 ASSYM(TD_MD, offsetof(struct thread, td_md));
 ASSYM(TD_LOCK, offsetof(struct thread, td_lock));
 
-ASSYM(TF_SIZE, sizeof(struct trapframe));
+ASSYM(TF_SIZE, roundup2(sizeof(struct trapframe), STACKALIGNBYTES + 1));
 ASSYM(TF_RA, offsetof(struct trapframe, tf_ra));
 ASSYM(TF_SP, offsetof(struct trapframe, tf_sp));
 ASSYM(TF_GP, offsetof(struct trapframe, tf_gp));
___
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: r365342 - head/libexec/rtld-elf/riscv

2020-09-04 Thread Brooks Davis
Author: brooks
Date: Fri Sep  4 21:46:10 2020
New Revision: 365342
URL: https://svnweb.freebsd.org/changeset/base/365342

Log:
  Maintain a stack alignment of 16-bytes.
  
  This violated the RISC-V 64-bit ABI.  On CheriBSD this manifested as
  a trap when attempting to store 16-byte aligned types while zeroing
  the stack.
  
  Reported by:  CHERI, jrtc27
  Reviewed by:  mhorne, br
  Obtained from:CheriBSD
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D26327

Modified:
  head/libexec/rtld-elf/riscv/rtld_start.S

Modified: head/libexec/rtld-elf/riscv/rtld_start.S
==
--- head/libexec/rtld-elf/riscv/rtld_start.SFri Sep  4 21:34:47 2020
(r365341)
+++ head/libexec/rtld-elf/riscv/rtld_start.SFri Sep  4 21:46:10 2020
(r365342)
@@ -64,7 +64,8 @@ END(.rtld_start)
  */
 ENTRY(_rtld_bind_start)
/* Save the arguments and ra */
-   addisp, sp, -(8 * 17)
+   /* We require 17 dwords, but the stack must be aligned to 16-bytes */
+   addisp, sp, -(8 * 18)
sd  a0, (8 * 0)(sp)
sd  a1, (8 * 1)(sp)
sd  a2, (8 * 2)(sp)
@@ -122,7 +123,7 @@ ENTRY(_rtld_bind_start)
fld fa6, (8 * 15)(sp)
fld fa7, (8 * 16)(sp)
 #endif
-   addisp, sp, (8 * 17)
+   addisp, sp, (8 * 18)
 
/* Call into the correct function */
jr  t0
___
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: r365284 - head/sys/kern

2020-09-02 Thread Brooks Davis
Author: brooks
Date: Wed Sep  2 23:17:33 2020
New Revision: 365284
URL: https://svnweb.freebsd.org/changeset/base/365284

Log:
  Always report ENOSYS in init
  
  While rare, encountering an unimplemented system call early in init is
  catastrophic and difficult to debug.  Even after a SIGSYS handler is
  registered, such configurations are problematic.  As such, always report
  such events for pid 1 (following kern.lognosys if non-zero).
  
  Reviewed by:  kevans, imp
  Obtained from:CheriBSD (plus suggestions from kevans)
  MFC after:1 week
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D26288

Modified:
  head/sys/kern/kern_sig.c

Modified: head/sys/kern/kern_sig.c
==
--- head/sys/kern/kern_sig.cWed Sep  2 22:27:30 2020(r365283)
+++ head/sys/kern/kern_sig.cWed Sep  2 23:17:33 2020(r365284)
@@ -3794,7 +3794,8 @@ nosys(struct thread *td, struct nosys_args *args)
uprintf("pid %d comm %s: nosys %d\n", p->p_pid, p->p_comm,
td->td_sa.code);
}
-   if (kern_lognosys == 2 || kern_lognosys == 3) {
+   if (kern_lognosys == 2 || kern_lognosys == 3 ||
+   (p->p_pid == 1 && (kern_lognosys & 3) == 0)) {
printf("pid %d comm %s: nosys %d\n", p->p_pid, p->p_comm,
td->td_sa.code);
}
___
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: r365279 - head/sbin/init

2020-09-02 Thread Brooks Davis
Author: brooks
Date: Wed Sep  2 21:14:36 2020
New Revision: 365279
URL: https://svnweb.freebsd.org/changeset/base/365279

Log:
  Remove risky compatability with old kernels
  
  The badsys() handler for SIGSYS was added as a transtion aid for kernels
  lacking sysctl() in 1993.  It is unsafe and unsound so remove it rather
  than running the risk of a privilege-dropping system call being silently
  omitted.
  
  This partially reverts SCCSID 6.12 (Berkeley) 03/03/93 "add code to
  change the system security level".
  
  Reviewed by:  mckusick, imp, kevans
  Obtained from:CheriBSD
  MFC after:1 week
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D26289

Modified:
  head/sbin/init/init.c

Modified: head/sbin/init/init.c
==
--- head/sbin/init/init.c   Wed Sep  2 20:43:08 2020(r365278)
+++ head/sbin/init/init.c   Wed Sep  2 21:14:36 2020(r365279)
@@ -106,7 +106,6 @@ static void stall(const char *, ...) __printflike(1, 2
 static void warning(const char *, ...) __printflike(1, 2);
 static void emergency(const char *, ...) __printflike(1, 2);
 static void disaster(int);
-static void badsys(int);
 static void revoke_ttys(void);
 static int  runshutdown(void);
 static char *strk(char *);
@@ -307,9 +306,8 @@ invalid:
 * We catch or block signals rather than ignore them,
 * so that they get reset on exec.
 */
-   handle(badsys, SIGSYS, 0);
-   handle(disaster, SIGABRT, SIGFPE, SIGILL, SIGSEGV, SIGBUS, SIGXCPU,
-   SIGXFSZ, 0);
+   handle(disaster, SIGABRT, SIGFPE, SIGILL, SIGSEGV, SIGBUS, SIGSYS,
+   SIGXCPU, SIGXFSZ, 0);
handle(transition_handler, SIGHUP, SIGINT, SIGEMT, SIGTERM, SIGTSTP,
SIGUSR1, SIGUSR2, SIGWINCH, 0);
handle(alrm_handler, SIGALRM, 0);
@@ -504,22 +502,6 @@ emergency(const char *message, ...)
 
vsyslog(LOG_EMERG, message, ap);
va_end(ap);
-}
-
-/*
- * Catch a SIGSYS signal.
- *
- * These may arise if a system does not support sysctl.
- * We tolerate up to 25 of these, then throw in the towel.
- */
-static void
-badsys(int sig)
-{
-   static int badcount = 0;
-
-   if (badcount++ < 25)
-   return;
-   disaster(sig);
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r364781 - in head/sys: conf modules/zfs

2020-08-25 Thread Brooks Davis
On Tue, Aug 25, 2020 at 07:04:54PM +, Brandon Bergren wrote:
> Author: bdragon
> Date: Tue Aug 25 19:04:54 2020
> New Revision: 364781
> URL: https://svnweb.freebsd.org/changeset/base/364781
> 
> Log:
>   [PowerPC] More preemptive powerpcspe ZFS build fixes
>   
>   I went through the merge and found the rest of the instances where
>   ${MACHINE_ARCH} == "powerpc" was being used to detect 32-bit and adjusted
>   the rest of the instances to also check for powerpcspe.
>   
>   mips32* will probably want to do the same.
>   
>   Sponsored by:   Tag1 Consulting, Inc.
> 
> Modified:
>   head/sys/conf/kern.pre.mk
>   head/sys/modules/zfs/Makefile
> 
> Modified: head/sys/conf/kern.pre.mk
> ==
> --- head/sys/conf/kern.pre.mk Tue Aug 25 18:54:10 2020(r364780)
> +++ head/sys/conf/kern.pre.mk Tue Aug 25 19:04:54 2020(r364781)
> @@ -257,7 +257,7 @@ ZFS_CFLAGS+= -DHAVE_AVX2 -DHAVE_AVX -D__x86_64 -DHAVE_
>  .endif
>  
>  .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \
> - ${MACHINE_ARCH} == "arm"
> + ${MACHINE_ARCH} == "powerpcspe" || ${MACHINE_ARCH} == "arm"
>  ZFS_CFLAGS+= -DBITS_PER_LONG=32
>  .else
>  ZFS_CFLAGS+= -DBITS_PER_LONG=64

In CheriBSD we've added a MACHINE_ABI variable that could be used to
simplify this mess of checks.

https://github.com/CTSRD-CHERI/cheribsd/blob/5ee735e5f8ef7268731359a2d8a9a8218df2d23f/share/mk/bsd.cpu.mk#L478

As currently implemented you'd use:

.if ${MACHINE_ABI:Mptr64}

There's be a argument for adding long32 and long64 for to avoid
conflating long and pointer size.

-- Brooks


signature.asc
Description: PGP signature


svn commit: r364087 - stable/12/sys/vm

2020-08-10 Thread Brooks Davis
Author: brooks
Date: Mon Aug 10 18:26:18 2020
New Revision: 364087
URL: https://svnweb.freebsd.org/changeset/base/364087

Log:
  MFC r363966:
  
  Preserve ASLR vm_map flags across fork
  
  In the most common case (fork+execve) this doesn't matter, but further
  attempts to apply entropy would fail in (e.g.) a pre-fork server.
  
  Reported by:  Alfredo Mazzinghi
  Reviewed by:  kib, markj
  Obtained from:CheriBSD
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D25966

Modified:
  stable/12/sys/vm/vm_map.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/vm/vm_map.c
==
--- stable/12/sys/vm/vm_map.c   Mon Aug 10 18:11:00 2020(r364086)
+++ stable/12/sys/vm/vm_map.c   Mon Aug 10 18:26:18 2020(r364087)
@@ -3932,6 +3932,7 @@ vmspace_fork(struct vmspace *vm1, vm_ooffset_t *fork_c
}
 
new_map->anon_loc = old_map->anon_loc;
+   new_map->flags |= old_map->flags & (MAP_ASLR | MAP_ASLR_IGNSTART);
 
old_entry = old_map->header.next;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r363966 - head/sys/vm

2020-08-06 Thread Brooks Davis
On Thu, Aug 06, 2020 at 04:20:21PM +, Brooks Davis wrote:
> Author: brooks
> Date: Thu Aug  6 16:20:20 2020
> New Revision: 363966
> URL: https://svnweb.freebsd.org/changeset/base/363966
> 
> Log:
>   Preserve ASLR vm_map flags across fork
>   
>   In the most common case (fork+execve) this doesn't matter, but further
>   attempts to apply entropy would fail in (e.g.) a pre-fork server.
>   
>   Reported by:Alfredo Mazzinghi
>   Reviewed by:kib, markj
>   Obtained from:  CheriBSD
>   MFC after:  3 days
>   Differential Revision:  https://reviews.freebsd.org/D25966

For the record, ASLR is off by default so there will not be a security
advisory on this issue.  If there are enough users who are concerned
about this we will consider an eratta notice for 12.1.

-- Brooks


signature.asc
Description: PGP signature


svn commit: r363966 - head/sys/vm

2020-08-06 Thread Brooks Davis
Author: brooks
Date: Thu Aug  6 16:20:20 2020
New Revision: 363966
URL: https://svnweb.freebsd.org/changeset/base/363966

Log:
  Preserve ASLR vm_map flags across fork
  
  In the most common case (fork+execve) this doesn't matter, but further
  attempts to apply entropy would fail in (e.g.) a pre-fork server.
  
  Reported by:  Alfredo Mazzinghi
  Reviewed by:  kib, markj
  Obtained from:CheriBSD
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D25966

Modified:
  head/sys/vm/vm_map.c

Modified: head/sys/vm/vm_map.c
==
--- head/sys/vm/vm_map.cThu Aug  6 16:14:43 2020(r363965)
+++ head/sys/vm/vm_map.cThu Aug  6 16:20:20 2020(r363966)
@@ -4109,6 +4109,7 @@ vmspace_fork(struct vmspace *vm1, vm_ooffset_t *fork_c
}
 
new_map->anon_loc = old_map->anon_loc;
+   new_map->flags |= old_map->flags & (MAP_ASLR | MAP_ASLR_IGNSTART);
 
VM_MAP_ENTRY_FOREACH(old_entry, old_map) {
if ((old_entry->eflags & MAP_ENTRY_IS_SUB_MAP) != 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: r363709 - stable/11/sys/kern

2020-07-30 Thread Brooks Davis
Author: brooks
Date: Thu Jul 30 17:18:42 2020
New Revision: 363709
URL: https://svnweb.freebsd.org/changeset/base/363709

Log:
  MFC r363438:
  
  Use SI_ORDER_(FOURTH|FIFTH) rather than bespoke versions.
  
  No functional change.
  
  When these SYSINITs were added these macros didn't exist.
  
  Reviewed by:  imp
  Obtained from:CheriBSD
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D25758

Modified:
  stable/11/sys/kern/init_main.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/init_main.c
==
--- stable/11/sys/kern/init_main.c  Thu Jul 30 15:50:51 2020
(r363708)
+++ stable/11/sys/kern/init_main.c  Thu Jul 30 17:18:42 2020
(r363709)
@@ -370,18 +370,18 @@ SYSINIT(version, SI_SUB_COPYRIGHT, SI_ORDER_THIRD, pri
 #ifdef WITNESS
 static char wit_warn[] =
  "WARNING: WITNESS option enabled, expect reduced performance.\n";
-SYSINIT(witwarn, SI_SUB_COPYRIGHT, SI_ORDER_THIRD + 1,
+SYSINIT(witwarn, SI_SUB_COPYRIGHT, SI_ORDER_FOURTH,
print_caddr_t, wit_warn);
-SYSINIT(witwarn2, SI_SUB_LAST, SI_ORDER_THIRD + 1,
+SYSINIT(witwarn2, SI_SUB_LAST, SI_ORDER_FOURTH,
print_caddr_t, wit_warn);
 #endif
 
 #ifdef DIAGNOSTIC
 static char diag_warn[] =
  "WARNING: DIAGNOSTIC option enabled, expect reduced performance.\n";
-SYSINIT(diagwarn, SI_SUB_COPYRIGHT, SI_ORDER_THIRD + 2,
+SYSINIT(diagwarn, SI_SUB_COPYRIGHT, SI_ORDER_FIFTH,
 print_caddr_t, diag_warn);
-SYSINIT(diagwarn2, SI_SUB_LAST, SI_ORDER_THIRD + 2,
+SYSINIT(diagwarn2, SI_SUB_LAST, SI_ORDER_FIFTH,
 print_caddr_t, diag_warn);
 #endif
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r363625 - stable/12/usr.sbin/mountd

2020-07-30 Thread Brooks Davis
On Thu, Jul 30, 2020 at 03:48:34PM +, Rick Macklem wrote:
> Rick Macklem wrote:
> >Ian Lepore wrote:
> >>On Thu, 2020-07-30 at 01:52 +, Rick Macklem wrote:
> >>> Brooks Davis wrote:
> >>> > Author: brooks
> >>> > Date: Mon Jul 27 23:18:14 2020
> >>> > New Revision: 363625
> >>> > URL: https://svnweb.freebsd.org/changeset/base/363625
> >>> >
> >>> > Log:
> >>> >  MFC r363439:
> >>> >
> >>> >  Correct a type-mismatch between xdr_long and the variable "bad".
> >>> >
> >>> > [...]
> >>> --> I can't see how the xdr.c code would work for a machine that is
> >>> BIG_ENDIAN and where "long" is 64bits, but we don't have any of
> >>> those.
> >>>
> >>
> >>mips64 and powerpc64 are both big endian with 64-bit long.
> >Oops, I didn't know that. In the past, I've run PowerPC and MIPS, but thought
> >they both were little endian. (I recall the arches can be run either way.)
> >
> >Anyhow, take a look at head/lib/libc/xdr/xdr.c and it looks to me like it
> >has been broken "forever" (ever since we stopped using a K compiler
> >that would have always made "long" 32bits).
> OK, I took another look at xdr.c and it isn't broken as I thought.
> 
> xdr_long() takes a "long *" argument ("long" in Sun XDR is 32bits),
> but then it only passes it as an argument to XDR_PUTLONG(), which is actually
> a call to xdrmem_putlong_aligned() or xdrmem_putlong_unaligned().
> For xdrmem_putlong_aligned(), the line is:
>*(u_int32_t *)xdrs->x_private = htonl((u_int32_t)*lp);
>   --> where lp is a "long *"
> 
> I'll admit I'm not 100% sure if "(u_int32_t)*lp" gets the correct 32bits of a 
> 64bit
> long pointer for all arches? (I'm not very good at knowing what type casts 
> do.)
> If this is the equivalent of "u_int32_t t; t = *lp; htonl(t); then I think 
> the code is ok?
> (At least it makes it clear that it is using 32bits of the value pointed to 
> by the
>  argument.)
> 
> For xdrmem_putlong_unaligned(), it does the same thing via:
> u_int32_t l;
> ?.
> l = htonl((u_int32_t)*lp);
> 
> --> At least the man page for xdr_long() should be clarified to note it
>   puts a 32bit quantity on the wire.
> 
> >If anyone has either of these and can set up an NFS server on one of
> >them and then try and do an NFSv3 mount that is not allowed, it would
> >be interesting to see the packet trace and if the MNT RPC fails, because
> >it looks like it will put the high order 32bits on the wire and they'll
> >always be 0?
> It would still be interesting to test this on a 64bit big endian, but so long 
> as
> the above cast works, it does look like it works for all arches.
> 
> >Just to clarify. The behaviour wasn't broken by this commit. I just
> >don't see how the commit fixes anything?
> My mistake. Sorry for the noise.
> 
> I now think the commit is correct since it uses "*lp" to get the value before
> casting it down to 32bits. Passing in an "int *" was incorrect.
> 
> The code does seem to handle "long *" for 64bit arches, although it
> only puts 32bits "on-the-wire".
> 
> rick, who was confused because he knew there was only supposed to be
> 32bits go on the wire.

Thank you for all the analysis.  I'd initially changed all the uses
of bad to use xdr_int(), but switched to this "fix" because it's what
NetBSD and OpenBSD have been using for over a decade (and there was
less churn).  I'm happy to flip it the other way if that seems more
correct/less confusing.

The previous code does in fact cause a 64-bit load of a pointer to an
int on 64-bit platforms.  I hit this in CheriBSD because that pointer
had 4-byte bounds.

-- Brooks


signature.asc
Description: PGP signature


svn commit: r363676 - stable/12/sys/kern

2020-07-29 Thread Brooks Davis
Author: brooks
Date: Wed Jul 29 22:10:25 2020
New Revision: 363676
URL: https://svnweb.freebsd.org/changeset/base/363676

Log:
  MFC r363438:
  
  Use SI_ORDER_(FOURTH|FIFTH) rather than bespoke versions.
  
  No functional change.
  
  When these SYSINITs were added these macros didn't exist.
  
  Reviewed by:  imp
  Obtained from:CheriBSD
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D25758

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

Modified: stable/12/sys/kern/init_main.c
==
--- stable/12/sys/kern/init_main.c  Wed Jul 29 22:08:54 2020
(r363675)
+++ stable/12/sys/kern/init_main.c  Wed Jul 29 22:10:25 2020
(r363676)
@@ -367,18 +367,18 @@ SYSINIT(version, SI_SUB_COPYRIGHT, SI_ORDER_THIRD, pri
 #ifdef WITNESS
 static char wit_warn[] =
  "WARNING: WITNESS option enabled, expect reduced performance.\n";
-SYSINIT(witwarn, SI_SUB_COPYRIGHT, SI_ORDER_THIRD + 1,
+SYSINIT(witwarn, SI_SUB_COPYRIGHT, SI_ORDER_FOURTH,
print_caddr_t, wit_warn);
-SYSINIT(witwarn2, SI_SUB_LAST, SI_ORDER_THIRD + 1,
+SYSINIT(witwarn2, SI_SUB_LAST, SI_ORDER_FOURTH,
print_caddr_t, wit_warn);
 #endif
 
 #ifdef DIAGNOSTIC
 static char diag_warn[] =
  "WARNING: DIAGNOSTIC option enabled, expect reduced performance.\n";
-SYSINIT(diagwarn, SI_SUB_COPYRIGHT, SI_ORDER_THIRD + 2,
+SYSINIT(diagwarn, SI_SUB_COPYRIGHT, SI_ORDER_FIFTH,
 print_caddr_t, diag_warn);
-SYSINIT(diagwarn2, SI_SUB_LAST, SI_ORDER_THIRD + 2,
+SYSINIT(diagwarn2, SI_SUB_LAST, SI_ORDER_FIFTH,
 print_caddr_t, diag_warn);
 #endif
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r363673 - stable/11/usr.sbin/mountd

2020-07-29 Thread Brooks Davis
Author: brooks
Date: Wed Jul 29 20:31:11 2020
New Revision: 363673
URL: https://svnweb.freebsd.org/changeset/base/363673

Log:
  MFC r363435:
  
  Avoid reading one byte before the path buffer.
  
  This happens when there's only one component (e.g. "/foo"). This
  (mostly-harmless) bug has been present since June 1990 when it was
  commited to mountd.c SCCS version 5.9.
  
  Note: the bug is on the second changed line, the first line is changed
  for visual consistency.
  
  Reviewed by:  cem, emaste, mckusick, rmacklem
  Reported by:  CHERI
  Obtained from:CheriBSD
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D25759

Modified:
  stable/11/usr.sbin/mountd/mountd.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/mountd/mountd.c
==
--- stable/11/usr.sbin/mountd/mountd.c  Wed Jul 29 20:30:15 2020
(r363672)
+++ stable/11/usr.sbin/mountd/mountd.c  Wed Jul 29 20:31:11 2020
(r363673)
@@ -3142,9 +3142,9 @@ do_mount(struct exportlist *ep, struct grouplist *grp,
goto error_exit;
}
/* back up over the last component */
-   while (*cp == '/' && cp > dirp)
+   while (cp > dirp && *cp == '/')
cp--;
-   while (*(cp - 1) != '/' && cp > dirp)
+   while (cp > dirp && *(cp - 1) != '/')
cp--;
if (cp == dirp) {
if (debug)
___
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: r363672 - stable/12/usr.sbin/mountd

2020-07-29 Thread Brooks Davis
Author: brooks
Date: Wed Jul 29 20:30:15 2020
New Revision: 363672
URL: https://svnweb.freebsd.org/changeset/base/363672

Log:
  MFC r363435:
  
  Avoid reading one byte before the path buffer.
  
  This happens when there's only one component (e.g. "/foo"). This
  (mostly-harmless) bug has been present since June 1990 when it was
  commited to mountd.c SCCS version 5.9.
  
  Note: the bug is on the second changed line, the first line is changed
  for visual consistency.
  
  Reviewed by:  cem, emaste, mckusick, rmacklem
  Reported by:  CHERI
  Obtained from:CheriBSD
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D25759

Modified:
  stable/12/usr.sbin/mountd/mountd.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/mountd/mountd.c
==
--- stable/12/usr.sbin/mountd/mountd.c  Wed Jul 29 19:38:49 2020
(r363671)
+++ stable/12/usr.sbin/mountd/mountd.c  Wed Jul 29 20:30:15 2020
(r363672)
@@ -3140,9 +3140,9 @@ do_mount(struct exportlist *ep, struct grouplist *grp,
goto error_exit;
}
/* back up over the last component */
-   while (*cp == '/' && cp > dirp)
+   while (cp > dirp && *cp == '/')
cp--;
-   while (*(cp - 1) != '/' && cp > dirp)
+   while (cp > dirp && *(cp - 1) != '/')
cp--;
if (cp == dirp) {
if (debug)
___
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: r363626 - stable/11/usr.sbin/mountd

2020-07-27 Thread Brooks Davis
Author: brooks
Date: Mon Jul 27 23:19:46 2020
New Revision: 363626
URL: https://svnweb.freebsd.org/changeset/base/363626

Log:
  MFC r363439:
  
  Correct a type-mismatch between xdr_long and the variable "bad".
  
  Way back in r28911 (August 1997, CVS rev 1.22) we imported a NetBSD
  information leak fix via OpenBSD.  Unfortunatly we failed to track the
  followup commit that fixed the type of the error code.  Apply the change
  from int to long now.
  
  Reviewed by:  emaste
  Reported by:  CHERI
  Obtained from:CheriBSD
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D25779

Modified:
  stable/11/usr.sbin/mountd/mountd.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/mountd/mountd.c
==
--- stable/11/usr.sbin/mountd/mountd.c  Mon Jul 27 23:18:14 2020
(r363625)
+++ stable/11/usr.sbin/mountd/mountd.c  Mon Jul 27 23:19:46 2020
(r363626)
@@ -1085,7 +1085,8 @@ mntsrv(struct svc_req *rqstp, SVCXPRT *transp)
struct sockaddr *saddr;
u_short sport;
char rpcpath[MNTPATHLEN + 1], dirpath[MAXPATHLEN];
-   int bad = 0, defset, hostset;
+   int defset, hostset;
+   long bad = 0;
sigset_t sighup_mask;
int numsecflavors, *secflavorsp;
 
___
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: r363625 - stable/12/usr.sbin/mountd

2020-07-27 Thread Brooks Davis
Author: brooks
Date: Mon Jul 27 23:18:14 2020
New Revision: 363625
URL: https://svnweb.freebsd.org/changeset/base/363625

Log:
  MFC r363439:
  
  Correct a type-mismatch between xdr_long and the variable "bad".
  
  Way back in r28911 (August 1997, CVS rev 1.22) we imported a NetBSD
  information leak fix via OpenBSD.  Unfortunatly we failed to track the
  followup commit that fixed the type of the error code.  Apply the change
  from int to long now.
  
  Reviewed by:  emaste
  Reported by:  CHERI
  Obtained from:CheriBSD
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D25779

Modified:
  stable/12/usr.sbin/mountd/mountd.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/mountd/mountd.c
==
--- stable/12/usr.sbin/mountd/mountd.c  Mon Jul 27 21:19:41 2020
(r363624)
+++ stable/12/usr.sbin/mountd/mountd.c  Mon Jul 27 23:18:14 2020
(r363625)
@@ -1087,7 +1087,8 @@ mntsrv(struct svc_req *rqstp, SVCXPRT *transp)
struct sockaddr *saddr;
u_short sport;
char rpcpath[MNTPATHLEN + 1], dirpath[MAXPATHLEN];
-   int bad = 0, defset, hostset;
+   int defset, hostset;
+   long bad = 0;
sigset_t sighup_mask;
int numsecflavors, *secflavorsp;
 
___
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: r363439 - head/usr.sbin/mountd

2020-07-22 Thread Brooks Davis
Author: brooks
Date: Wed Jul 22 23:39:58 2020
New Revision: 363439
URL: https://svnweb.freebsd.org/changeset/base/363439

Log:
  Correct a type-mismatch between xdr_long and the variable "bad".
  
  Way back in r28911 (August 1997, CVS rev 1.22) we imported a NetBSD
  information leak fix via OpenBSD.  Unfortunatly we failed to track the
  followup commit that fixed the type of the error code.  Apply the change
  from int to long now.
  
  Reviewed by:  emaste
  Found by: CHERI
  Obtained from:CheriBSD
  MFC after:3 days
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D25779

Modified:
  head/usr.sbin/mountd/mountd.c

Modified: head/usr.sbin/mountd/mountd.c
==
--- head/usr.sbin/mountd/mountd.c   Wed Jul 22 23:35:41 2020
(r363438)
+++ head/usr.sbin/mountd/mountd.c   Wed Jul 22 23:39:58 2020
(r363439)
@@ -1091,7 +1091,8 @@ mntsrv(struct svc_req *rqstp, SVCXPRT *transp)
struct sockaddr *saddr;
u_short sport;
char rpcpath[MNTPATHLEN + 1], dirpath[MAXPATHLEN];
-   int bad = 0, defset, hostset;
+   int defset, hostset;
+   long bad = 0;
sigset_t sighup_mask;
int numsecflavors, *secflavorsp;
 
___
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: r363438 - head/sys/kern

2020-07-22 Thread Brooks Davis
Author: brooks
Date: Wed Jul 22 23:35:41 2020
New Revision: 363438
URL: https://svnweb.freebsd.org/changeset/base/363438

Log:
  Use SI_ORDER_(FOURTH|FIFTH) rather than bespoke versions.
  
  No functional change.
  
  When these SYSINITs were added these macros didn't exist.
  
  Reviewed by:  imp
  Obtained from:CheriBSD
  MFC after:1 week
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D25758

Modified:
  head/sys/kern/init_main.c

Modified: head/sys/kern/init_main.c
==
--- head/sys/kern/init_main.c   Wed Jul 22 23:33:37 2020(r363437)
+++ head/sys/kern/init_main.c   Wed Jul 22 23:35:41 2020(r363438)
@@ -372,18 +372,18 @@ SYSINIT(version, SI_SUB_COPYRIGHT, SI_ORDER_THIRD, pri
 #ifdef WITNESS
 static char wit_warn[] =
  "WARNING: WITNESS option enabled, expect reduced performance.\n";
-SYSINIT(witwarn, SI_SUB_COPYRIGHT, SI_ORDER_THIRD + 1,
+SYSINIT(witwarn, SI_SUB_COPYRIGHT, SI_ORDER_FOURTH,
print_caddr_t, wit_warn);
-SYSINIT(witwarn2, SI_SUB_LAST, SI_ORDER_THIRD + 1,
+SYSINIT(witwarn2, SI_SUB_LAST, SI_ORDER_FOURTH,
print_caddr_t, wit_warn);
 #endif
 
 #ifdef DIAGNOSTIC
 static char diag_warn[] =
  "WARNING: DIAGNOSTIC option enabled, expect reduced performance.\n";
-SYSINIT(diagwarn, SI_SUB_COPYRIGHT, SI_ORDER_THIRD + 2,
+SYSINIT(diagwarn, SI_SUB_COPYRIGHT, SI_ORDER_FIFTH,
 print_caddr_t, diag_warn);
-SYSINIT(diagwarn2, SI_SUB_LAST, SI_ORDER_THIRD + 2,
+SYSINIT(diagwarn2, SI_SUB_LAST, SI_ORDER_FIFTH,
 print_caddr_t, diag_warn);
 #endif
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r363435 - head/usr.sbin/mountd

2020-07-22 Thread Brooks Davis
Author: brooks
Date: Wed Jul 22 21:44:51 2020
New Revision: 363435
URL: https://svnweb.freebsd.org/changeset/base/363435

Log:
  Avoid reading one byte before the path buffer.
  
  This happens when there's only one component (e.g. "/foo"). This
  (mostly-harmless) bug has been present since June 1990 when it was
  commited to mountd.c SCCS version 5.9.
  
  Note: the bug is on the second changed line, the first line is changed
  for visual consistency.
  
  Reviewed by:  cem, emaste, mckusick, rmacklem
  Found with:   CHERI
  Obtained from:CheriBSD
  MFC after:1 week
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D25759

Modified:
  head/usr.sbin/mountd/mountd.c

Modified: head/usr.sbin/mountd/mountd.c
==
--- head/usr.sbin/mountd/mountd.c   Wed Jul 22 21:30:18 2020
(r363434)
+++ head/usr.sbin/mountd/mountd.c   Wed Jul 22 21:44:51 2020
(r363435)
@@ -3155,9 +3155,9 @@ do_mount(struct exportlist *ep, struct grouplist *grp,
goto error_exit;
}
/* back up over the last component */
-   while (*cp == '/' && cp > dirp)
+   while (cp > dirp && *cp == '/')
cp--;
-   while (*(cp - 1) != '/' && cp > dirp)
+   while (cp > dirp && *(cp - 1) != '/')
cp--;
if (cp == dirp) {
if (debug)
___
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: r363434 - stable/11/lib/libc/gen

2020-07-22 Thread Brooks Davis
Author: brooks
Date: Wed Jul 22 21:30:18 2020
New Revision: 363434
URL: https://svnweb.freebsd.org/changeset/base/363434

Log:
  MFC r363228:
  
  Don't imply that all action values can be OR'd.
  
  This is neither POSIX compliant nor what the implementation does.
  This could be allowed by changing the value of TCSAFLUSH from 2 to 3,
  but that doesn't seem worthwhile after 25+ years.
  
  Reviewed by:  imp
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D25659

Modified:
  stable/11/lib/libc/gen/tcsetattr.3
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/gen/tcsetattr.3
==
--- stable/11/lib/libc/gen/tcsetattr.3  Wed Jul 22 21:17:02 2020
(r363433)
+++ stable/11/lib/libc/gen/tcsetattr.3  Wed Jul 22 21:30:18 2020
(r363434)
@@ -28,7 +28,7 @@
 .\"@(#)tcsetattr.3 8.3 (Berkeley) 1/2/94
 .\" $FreeBSD$
 .\"
-.Dd January 2, 1994
+.Dd July 15, 2020
 .Dt TCSETATTR 3
 .Os
 .Sh NAME
@@ -221,8 +221,7 @@ termios structure referenced by
 .Fa tp .
 The
 .Fa action
-argument is created by
-.Em or Ns 'ing
+argument is one of
 the following values, as specified in the include file
 .In termios.h .
 .Bl -tag -width "TCSADRAIN"
@@ -240,18 +239,20 @@ The change occurs after all output written to
 .Fa fd
 has been transmitted to the terminal.
 Additionally, any input that has been received but not read is discarded.
-.It Fa TCSASOFT
-If this value is
-.Em or Ns 'ed
-into the
+.El
+.Pp
+The
 .Fa action
-value, the values of the
+may be modified by
+.Em or Ns 'ing
+in
+.Fa TCSASOFT
+which causes the values of the
 .Va c_cflag ,
 .Va c_ispeed ,
 and
 .Va c_ospeed
-fields are ignored.
-.El
+fields to be ignored.
 .Pp
 The 0 baud rate is used to terminate the connection.
 If 0 is specified as the output speed to the function
___
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: r363432 - stable/12/lib/libc/gen

2020-07-22 Thread Brooks Davis
Author: brooks
Date: Wed Jul 22 21:06:32 2020
New Revision: 363432
URL: https://svnweb.freebsd.org/changeset/base/363432

Log:
  MFC r363228:
  
  Don't imply that all action values can be OR'd.
  
  This is neither POSIX compliant nor what the implementation does.
  This could be allowed by changing the value of TCSAFLUSH from 2 to 3,
  but that doesn't seem worthwhile after 25+ years.
  
  Reviewed by:  imp
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D25659

Modified:
  stable/12/lib/libc/gen/tcsetattr.3
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libc/gen/tcsetattr.3
==
--- stable/12/lib/libc/gen/tcsetattr.3  Wed Jul 22 20:15:21 2020
(r363431)
+++ stable/12/lib/libc/gen/tcsetattr.3  Wed Jul 22 21:06:32 2020
(r363432)
@@ -28,7 +28,7 @@
 .\"@(#)tcsetattr.3 8.3 (Berkeley) 1/2/94
 .\" $FreeBSD$
 .\"
-.Dd January 2, 1994
+.Dd July 15, 2020
 .Dt TCSETATTR 3
 .Os
 .Sh NAME
@@ -221,8 +221,7 @@ termios structure referenced by
 .Fa tp .
 The
 .Fa action
-argument is created by
-.Em or Ns 'ing
+argument is one of
 the following values, as specified in the include file
 .In termios.h .
 .Bl -tag -width "TCSADRAIN"
@@ -240,18 +239,20 @@ The change occurs after all output written to
 .Fa fd
 has been transmitted to the terminal.
 Additionally, any input that has been received but not read is discarded.
-.It Fa TCSASOFT
-If this value is
-.Em or Ns 'ed
-into the
+.El
+.Pp
+The
 .Fa action
-value, the values of the
+may be modified by
+.Em or Ns 'ing
+in
+.Fa TCSASOFT
+which causes the values of the
 .Va c_cflag ,
 .Va c_ispeed ,
 and
 .Va c_ospeed
-fields are ignored.
-.El
+fields to be ignored.
 .Pp
 The 0 baud rate is used to terminate the connection.
 If 0 is specified as the output speed to the function
___
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: r363228 - head/lib/libc/gen

2020-07-15 Thread Brooks Davis
Author: brooks
Date: Wed Jul 15 17:05:37 2020
New Revision: 363228
URL: https://svnweb.freebsd.org/changeset/base/363228

Log:
  Don't imply that all action values can be OR'd.
  
  This is neither POSIX compliant nor what the implementation does.
  This could be allowed by changing the value of TCSAFLUSH from 2 to 3,
  but that doesn't seem worthwhile after 25+ years.
  
  Reviewed by:  imp
  MFC after:1 week
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D25659

Modified:
  head/lib/libc/gen/tcsetattr.3

Modified: head/lib/libc/gen/tcsetattr.3
==
--- head/lib/libc/gen/tcsetattr.3   Wed Jul 15 16:12:00 2020
(r363227)
+++ head/lib/libc/gen/tcsetattr.3   Wed Jul 15 17:05:37 2020
(r363228)
@@ -28,7 +28,7 @@
 .\"@(#)tcsetattr.3 8.3 (Berkeley) 1/2/94
 .\" $FreeBSD$
 .\"
-.Dd January 2, 1994
+.Dd July 15, 2020
 .Dt TCSETATTR 3
 .Os
 .Sh NAME
@@ -221,8 +221,7 @@ termios structure referenced by
 .Fa t .
 The
 .Fa action
-argument is created by
-.Em or Ns 'ing
+argument is one of
 the following values, as specified in the include file
 .In termios.h .
 .Bl -tag -width "TCSADRAIN"
@@ -240,18 +239,20 @@ The change occurs after all output written to
 .Fa fd
 has been transmitted to the terminal.
 Additionally, any input that has been received but not read is discarded.
-.It Fa TCSASOFT
-If this value is
-.Em or Ns 'ed
-into the
+.El
+.Pp
+The
 .Fa action
-value, the values of the
+may be modified by
+.Em or Ns 'ing
+in
+.Fa TCSASOFT
+which causes the values of the
 .Va c_cflag ,
 .Va c_ispeed ,
 and
 .Va c_ospeed
-fields are ignored.
-.El
+fields to be ignored.
 .Pp
 The 0 baud rate is used to terminate the connection.
 If 0 is specified as the output speed to the function
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r363172 - head/contrib/bc/src

2020-07-14 Thread Brooks Davis
On Tue, Jul 14, 2020 at 05:02:18AM +, Adrian Chadd wrote:
> Author: adrian
> Date: Tue Jul 14 05:02:18 2020
> New Revision: 363172
> URL: https://svnweb.freebsd.org/changeset/base/363172
> 
> Log:
>   [bc] Fix a "maybe uninitialized" compiler warning under mips-gcc-6.3.0.
>   
>   I guess this didn't like the case statements.. ? But this does quieten
>   the compiler error.

IMO it would be better to disable this warning for this (old) compiler
on this file rather than making a change here (in general we should be
removing these sorts of changes).  That being said, we need to write
down some guidance on this so we have a clear set of principles and we
can figure out how we decided which compilers are on which side of the
line.

-- Brooks


signature.asc
Description: PGP signature


svn commit: r363050 - stable/11/cddl/contrib/opensolaris/tools/ctf/cvt

2020-07-09 Thread Brooks Davis
Author: brooks
Date: Thu Jul  9 17:12:22 2020
New Revision: 363050
URL: https://svnweb.freebsd.org/changeset/base/363050

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

Modified:
  stable/11/cddl/contrib/opensolaris/tools/ctf/cvt/iidesc.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/cddl/contrib/opensolaris/tools/ctf/cvt/iidesc.c
==
--- stable/11/cddl/contrib/opensolaris/tools/ctf/cvt/iidesc.c   Thu Jul  9 
17:10:18 2020(r363049)
+++ stable/11/cddl/contrib/opensolaris/tools/ctf/cvt/iidesc.c   Thu Jul  9 
17:12:22 2020(r363050)
@@ -179,7 +179,7 @@ int
 iidesc_count_type(void *data, void *private)
 {
iidesc_t *ii = data;
-   iitype_t match = (iitype_t)private;
+   iitype_t match = (iitype_t)(uintptr_t)private;
 
return (ii->ii_type == match);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r363048 - stable/12/cddl/contrib/opensolaris/tools/ctf/cvt

2020-07-09 Thread Brooks Davis
Author: brooks
Date: Thu Jul  9 16:58:53 2020
New Revision: 363048
URL: https://svnweb.freebsd.org/changeset/base/363048

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

Modified:
  stable/12/cddl/contrib/opensolaris/tools/ctf/cvt/iidesc.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/cddl/contrib/opensolaris/tools/ctf/cvt/iidesc.c
==
--- stable/12/cddl/contrib/opensolaris/tools/ctf/cvt/iidesc.c   Thu Jul  9 
16:28:13 2020(r363047)
+++ stable/12/cddl/contrib/opensolaris/tools/ctf/cvt/iidesc.c   Thu Jul  9 
16:58:53 2020(r363048)
@@ -179,7 +179,7 @@ int
 iidesc_count_type(void *data, void *private)
 {
iidesc_t *ii = data;
-   iitype_t match = (iitype_t)private;
+   iitype_t match = (iitype_t)(uintptr_t)private;
 
return (ii->ii_type == match);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r362979 - head/cddl/contrib/opensolaris/tools/ctf/cvt

2020-07-06 Thread Brooks Davis
Author: brooks
Date: Mon Jul  6 22:39:42 2020
New Revision: 362979
URL: https://svnweb.freebsd.org/changeset/base/362979

Log:
  Fix a Wvoid-pointer-to-enum-cast warning missed in r359978.
  
  This pattern is used in callbacks with void * data arguments and seems
  both relatively uncommon and relatively harmless.  Silence the warning
  by casting through uintptr_t.
  
  This warning is on by default in Clang 11.
  
  MFC after:3 days
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D24425

Modified:
  head/cddl/contrib/opensolaris/tools/ctf/cvt/iidesc.c

Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/iidesc.c
==
--- head/cddl/contrib/opensolaris/tools/ctf/cvt/iidesc.cMon Jul  6 
21:39:14 2020(r362978)
+++ head/cddl/contrib/opensolaris/tools/ctf/cvt/iidesc.cMon Jul  6 
22:39:42 2020(r362979)
@@ -179,7 +179,7 @@ int
 iidesc_count_type(void *data, void *private)
 {
iidesc_t *ii = data;
-   iitype_t match = (iitype_t)private;
+   iitype_t match = (iitype_t)(uintptr_t)private;
 
return (ii->ii_type == match);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r361683 - head/usr.sbin/certctl

2020-06-01 Thread Brooks Davis
On Sun, May 31, 2020 at 08:37:41PM -0500, Kyle Evans wrote:
> n Sun, May 31, 2020 at 8:25 PM Kyle Evans  wrote:
> >
> > Author: kevans
> > Date: Mon Jun  1 01:25:19 2020
> > New Revision: 361683
> > URL: https://svnweb.freebsd.org/changeset/base/361683
> >
> > Log:
> >   certctl: fix test syntax
> >
> >   test doesn't understand &&, but it does understand -a.
> >
> >   MFC after:1 week
> >
> 
> Sorry, this was a pretty low-quality commit message; && is a shell
> construct, so the previous version lead to a lot of spam as the [
> invocation was split and the ] terminator lost.

I'm pretty sure this was a result of my failing to test sufficiently
after a merge conflict when committing.  Sorry about that.

-- Brooks


signature.asc
Description: PGP signature


svn commit: r361397 - head/usr.sbin/certctl

2020-05-22 Thread Brooks Davis
Author: brooks
Date: Fri May 22 17:45:07 2020
New Revision: 361397
URL: https://svnweb.freebsd.org/changeset/base/361397

Log:
  Add an unprivileged mode where calls to install are passed appropriate
  flags.  For ease of integration, use the same flags as install:
  
   -U   unprivileged mode
   -D  Specify DESTDIR (overrides the environment)
   -M  Full path to METALOG file
  
  Reviewed by:  kevans
  Obtained from:CheriBSD
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D24932

Modified:
  head/usr.sbin/certctl/certctl.8
  head/usr.sbin/certctl/certctl.sh

Modified: head/usr.sbin/certctl/certctl.8
==
--- head/usr.sbin/certctl/certctl.8 Fri May 22 17:30:36 2020
(r361396)
+++ head/usr.sbin/certctl/certctl.8 Fri May 22 17:45:07 2020
(r361397)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 19, 2019
+.Dd May 22, 2020
 .Dt CERTCTL 8
 .Os
 .Sh NAME
@@ -40,7 +40,9 @@
 .Op Fl v
 .Ic blacklisted
 .Nm
-.Op Fl nv
+.Op Fl nUv
+.Op Fl D Ar destdir
+.Op Fl M Ar metalog
 .Ic rehash
 .Nm
 .Op Fl nv
@@ -56,10 +58,17 @@ applications that use OpenSSL.
 .Pp
 Flags:
 .Bl -tag -width 4n
+.It Fl D Ar destdir
+Specify the DESTDIR (overriding values from the environment).
+.It Fl M Ar metalog
+Specify the path of the METALOG file (default: $DESTDIR/METALOG).
 .It Fl n
 No-Op mode, do not actually perform any actions.
 .It Fl v
 be verbose, print details about actions before performing them.
+.It Fl U
+Unprivileged mode, do not change the ownership of created links.
+Do record the ownership in the METALOG file.
 .El
 .Pp
 Primary command functions:

Modified: head/usr.sbin/certctl/certctl.sh
==
--- head/usr.sbin/certctl/certctl.shFri May 22 17:30:36 2020
(r361396)
+++ head/usr.sbin/certctl/certctl.shFri May 22 17:45:07 2020
(r361397)
@@ -30,10 +30,6 @@
  CONFIGURATION
 
 : ${DESTDIR:=}
-: 
${TRUSTPATH:=${DESTDIR}/usr/share/certs/trusted:${DESTDIR}/usr/local/share/certs:${DESTDIR}/usr/local/etc/ssl/certs}
-: 
${BLACKLISTPATH:=${DESTDIR}/usr/share/certs/blacklisted:${DESTDIR}/usr/local/etc/ssl/blacklisted}
-: ${CERTDESTDIR:=${DESTDIR}/etc/ssl/certs}
-: ${BLACKLISTDESTDIR:=${DESTDIR}/etc/ssl/blacklisted}
 : ${FILEPAT:="\.pem$|\.crt$|\.cer$|\.crl$|\.0$"}
 : ${VERBOSE:=0}
 
@@ -42,6 +38,7 @@
 SCRIPTNAME="${0##*/}"
 ERRORS=0
 NOOP=0
+UNPRIV=0
 
  FUNCTIONS
 
@@ -69,7 +66,7 @@ create_trusted_link()
return 1
fi
[ $VERBOSE -gt 0 ] && echo "Adding $hash.0 to trust store"
-   [ $NOOP -eq 0 ] && install -lrs $(realpath "$1") "$CERTDESTDIR/$hash.0"
+   [ $NOOP -eq 0 ] && install ${INSTALLFLAGS} -lrs $(realpath "$1") 
"$CERTDESTDIR/$hash.0"
 }
 
 create_blacklisted()
@@ -88,7 +85,7 @@ create_blacklisted()
return
fi
[ $VERBOSE -gt 0 ] && echo "Adding $filename to blacklist"
-   [ $NOOP -eq 0 ] && install -lrs "$srcfile" "$BLACKLISTDESTDIR/$filename"
+   [ $NOOP -eq 0 ] && install ${INSTALLFLAGS} -lrs "$srcfile" 
"$BLACKLISTDESTDIR/$filename"
 }
 
 do_scan()
@@ -105,7 +102,7 @@ do_scan()
[ -d "$CPATH" ] || continue
echo "Scanning $CPATH for certificates..."
for CFILE in $(ls -1 "${CPATH}" | grep -Ee "${FILEPAT}"); do
-   [ -e "$CPATH/$CFILE" ] || continue
+   [ -e "$CPATH/$CFILE" && $UNPRIV -eq 0 ] || continue
[ $VERBOSE -gt 0 ] && echo "Reading $CFILE"
"$CFUNC" "$CPATH/$CFILE"
done
@@ -209,7 +206,7 @@ usage()
echo "  List trusted certificates"
echo "  $SCRIPTNAME [-v] blacklisted"
echo "  List blacklisted certificates"
-   echo "  $SCRIPTNAME [-nv] rehash"
+   echo "  $SCRIPTNAME [-nUv] [-D ] [-M ] rehash"
echo "  Generate hash links for all certificates"
echo "  $SCRIPTNAME [-nv] blacklist "
echo "  Add  to the list of blacklisted certificates"
@@ -220,13 +217,24 @@ usage()
 
  MAIN
 
-while getopts nv flag; do
+while getopts D:M:nUv flag; do
case "$flag" in
+   D) DESTDIR=${OPTARG} ;;
+   M) METALOG=${OPTARG} ;;
n) NOOP=1 ;;
+   U) UNPRIV=1 ;;
v) VERBOSE=$(( $VERBOSE + 1 )) ;;
esac
 done
 shift $(( $OPTIND - 1 ))
+
+: ${METALOG:=${DESTDIR}/METALOG}
+INSTALLFLAGS=
+[ $UNPRIV -eq 1 ] && INSTALLFLAGS=-U -M ${METALOG} -D ${DESTDIR}
+: 
${TRUSTPATH:=${DESTDIR}/usr/share/certs/trusted:${DESTDIR}/usr/local/share/certs:${DESTDIR}/usr/local/etc/ssl/certs}
+: 
${BLACKLISTPATH:=${DESTDIR}/usr/share/certs/blacklisted:${DESTDIR}/usr/local/etc/ssl/blacklisted}
+: 

Re: svn commit: r360833 - head

2020-05-20 Thread Brooks Davis
On Tue, May 12, 2020 at 10:16:03PM +, Brooks Davis wrote:
> On Mon, May 11, 2020 at 01:45:14PM -0500, Kyle Evans wrote:
> > On Mon, May 11, 2020 at 1:10 PM Brooks Davis  wrote:
> > >
> > > On Sat, May 09, 2020 at 02:01:29AM +, Kyle Evans wrote:
> > > > Author: kevans
> > > > Date: Sat May  9 02:01:29 2020
> > > > New Revision: 360833
> > > > URL: https://svnweb.freebsd.org/changeset/base/360833
> > > >
> > > > Log:
> > > >   installworld: attempt a certctl rehash at the tail end
> > > >
> > > >   This can be run as root or normal user with no problem; if they hadn't
> > > >   twisted the WITHOUT_CAROOT knob, we'll attempt to use the host 
> > > > certctl to
> > > >   rehash the DESTDIR. This would allow one to build systems 
> > > > WITHOUT_OPENSSL +
> > > >   WITH_CAROOT with a populated /etc/ssl that they can then use with an
> > > >   appropriate *ssl from somewhere else.
> > > >
> > > >   Cross-builds are fine because this will always use the host certctl, 
> > > > or just
> > > >   nag if it's missing and it wasn't a WITHOUT_CAROOT build.
> > > >
> > > >   MFC after:  1 week
> > > >   Differential Revision:  https://reviews.freebsd.org/D24641
> > > >
> > > > Modified:
> > > >   head/Makefile.inc1
> > > >
> > > > Modified: head/Makefile.inc1
> > > > ==
> > > > --- head/Makefile.inc1Sat May  9 01:48:08 2020(r360832)
> > > > +++ head/Makefile.inc1Sat May  9 02:01:29 2020(r360833)
> > > > @@ -1403,6 +1403,16 @@ distributeworld installworld stageworld: 
> > > > _installcheck
> > > >   ${DESTDIR}/${DISTDIR}/${dist}.debug.meta
> > > >  .endfor
> > > >  .endif
> > > > +.elif make(installworld) && ${MK_CAROOT} != "no"
> > > > + # We could make certctl a bootstrap tool, but it requires OpenSSL 
> > > > and
> > > > + # friends, which we likely don't want.  We'll rehash on a 
> > > > best-effort
> > > > + # basis, otherwise we'll just mention that we're not doing it to 
> > > > raise
> > > > + # awareness.
> > > > + @if which certctl>/dev/null; then \
> > > > + certctl rehash \
> > >
> > > Does this update METALOG with the added links?
> > >
> > > It seems a little weird to rely on DESTDIR from the environment.
> > >
> > > In general I'm not enthusiastic about additions to installworld that do
> > > anything other than copying files, creating links, etc in simple ways.
> > 
> > I will happily back this out if I can get some qualified eyes to
> > review/improve it. It does not update METALOG, and it probably should.
> > Agreed on DESTDIR. As for point #3, I guess we can continue spreading
> > `certctl rehash` all over the tree in various points that may need it;
> > the release(7) scripts will need to be done if we don't do it here at
> > a minimum, and I haven't put much thought into it beyond that.
> 
> I'm not in a rush to back this out given that it's solving a real
> problem, but lets talk about improvements.
> 
> I kind of feel like this belongs in distribution (which I think would
> deal with release scripts) or in etcupdate/mergemaster, but I'm not
> sure either of those are correct.  I'd be happy to review changes to
> update the METALOG (I guess we'd extend certctl with an option to do
> that?)  I think that's the most important things because we really
> should be routinely validating that DESTDIR only contains things in the
> METALOG.  A quick and dirty fix for the DESTDIR weirdness might be adding
> "env DESTDIR=${DESTDIR}" so it's explicit.

I did discover that this is causing me a minor hassle downstream in
CheriBSD.  Our crossbuild tool (cheribuild) checks for files not in
the METALOG and prompts to ask if they should be included when run
interactively.  This means all my disk image builds now stall unless I
remember to wait until I'm past that stage.

Without addressing the question of which stage (if any) the certctl
rehash should take place in, I have a potential fix for the failure to
handle METALOG files in https://reviews.freebsd.org/D24932.  It needs
some documentation updates before it can land, but I think it's
complete.

-- Brooks


signature.asc
Description: PGP signature


Re: svn commit: r360833 - head

2020-05-14 Thread Brooks Davis
On Tue, May 12, 2020 at 09:01:33PM -0500, Kyle Evans wrote:
> On Tue, May 12, 2020 at 5:16 PM Brooks Davis  wrote:
> >
> > On Mon, May 11, 2020 at 01:45:14PM -0500, Kyle Evans wrote:
> > > On Mon, May 11, 2020 at 1:10 PM Brooks Davis  wrote:
> > > >
> > > > On Sat, May 09, 2020 at 02:01:29AM +, Kyle Evans wrote:
> > > > > Author: kevans
> > > > > Date: Sat May  9 02:01:29 2020
> > > > > New Revision: 360833
> > > > > URL: https://svnweb.freebsd.org/changeset/base/360833
> > > > >
> > > > > Log:
> > > > >   installworld: attempt a certctl rehash at the tail end
> > > > >
> > > > >   This can be run as root or normal user with no problem; if they 
> > > > > hadn't
> > > > >   twisted the WITHOUT_CAROOT knob, we'll attempt to use the host 
> > > > > certctl to
> > > > >   rehash the DESTDIR. This would allow one to build systems 
> > > > > WITHOUT_OPENSSL +
> > > > >   WITH_CAROOT with a populated /etc/ssl that they can then use with an
> > > > >   appropriate *ssl from somewhere else.
> > > > >
> > > > >   Cross-builds are fine because this will always use the host 
> > > > > certctl, or just
> > > > >   nag if it's missing and it wasn't a WITHOUT_CAROOT build.
> > > > >
> > > > >   MFC after:  1 week
> > > > >   Differential Revision:  https://reviews.freebsd.org/D24641
> > > > >
> > > > > Modified:
> > > > >   head/Makefile.inc1
> > > > >
> > > > > Modified: head/Makefile.inc1
> > > > > ==
> > > > > --- head/Makefile.inc1Sat May  9 01:48:08 2020
> > > > > (r360832)
> > > > > +++ head/Makefile.inc1Sat May  9 02:01:29 2020
> > > > > (r360833)
> > > > > @@ -1403,6 +1403,16 @@ distributeworld installworld stageworld: 
> > > > > _installcheck
> > > > >   ${DESTDIR}/${DISTDIR}/${dist}.debug.meta
> > > > >  .endfor
> > > > >  .endif
> > > > > +.elif make(installworld) && ${MK_CAROOT} != "no"
> > > > > + # We could make certctl a bootstrap tool, but it requires 
> > > > > OpenSSL and
> > > > > + # friends, which we likely don't want.  We'll rehash on a 
> > > > > best-effort
> > > > > + # basis, otherwise we'll just mention that we're not doing it 
> > > > > to raise
> > > > > + # awareness.
> > > > > + @if which certctl>/dev/null; then \
> > > > > + certctl rehash \
> > > >
> > > > Does this update METALOG with the added links?
> > > >
> > > > It seems a little weird to rely on DESTDIR from the environment.
> > > >
> > > > In general I'm not enthusiastic about additions to installworld that do
> > > > anything other than copying files, creating links, etc in simple ways.
> > >
> > > I will happily back this out if I can get some qualified eyes to
> > > review/improve it. It does not update METALOG, and it probably should.
> > > Agreed on DESTDIR. As for point #3, I guess we can continue spreading
> > > `certctl rehash` all over the tree in various points that may need it;
> > > the release(7) scripts will need to be done if we don't do it here at
> > > a minimum, and I haven't put much thought into it beyond that.
> >
> > I'm not in a rush to back this out given that it's solving a real
> > problem, but lets talk about improvements.
> >
> > I kind of feel like this belongs in distribution (which I think would
> > deal with release scripts) or in etcupdate/mergemaster, but I'm not
> > sure either of those are correct.  I'd be happy to review changes to
> > update the METALOG (I guess we'd extend certctl with an option to do
> > that?)  I think that's the most important things because we really
> > should be routinely validating that DESTDIR only contains things in the
> > METALOG.  A quick and dirty fix for the DESTDIR weirdness might be adding
> > "env DESTDIR=${DESTDIR}" so it's explicit.
> >
> 
> Got it- not an egregious enough violation to promptly back out, but we
> will work towards a better solution.
> 
> For the larger picture, d

Re: svn commit: r360833 - head

2020-05-12 Thread Brooks Davis
On Mon, May 11, 2020 at 01:45:14PM -0500, Kyle Evans wrote:
> On Mon, May 11, 2020 at 1:10 PM Brooks Davis  wrote:
> >
> > On Sat, May 09, 2020 at 02:01:29AM +, Kyle Evans wrote:
> > > Author: kevans
> > > Date: Sat May  9 02:01:29 2020
> > > New Revision: 360833
> > > URL: https://svnweb.freebsd.org/changeset/base/360833
> > >
> > > Log:
> > >   installworld: attempt a certctl rehash at the tail end
> > >
> > >   This can be run as root or normal user with no problem; if they hadn't
> > >   twisted the WITHOUT_CAROOT knob, we'll attempt to use the host certctl 
> > > to
> > >   rehash the DESTDIR. This would allow one to build systems 
> > > WITHOUT_OPENSSL +
> > >   WITH_CAROOT with a populated /etc/ssl that they can then use with an
> > >   appropriate *ssl from somewhere else.
> > >
> > >   Cross-builds are fine because this will always use the host certctl, or 
> > > just
> > >   nag if it's missing and it wasn't a WITHOUT_CAROOT build.
> > >
> > >   MFC after:  1 week
> > >   Differential Revision:  https://reviews.freebsd.org/D24641
> > >
> > > Modified:
> > >   head/Makefile.inc1
> > >
> > > Modified: head/Makefile.inc1
> > > ==
> > > --- head/Makefile.inc1Sat May  9 01:48:08 2020(r360832)
> > > +++ head/Makefile.inc1Sat May  9 02:01:29 2020(r360833)
> > > @@ -1403,6 +1403,16 @@ distributeworld installworld stageworld: 
> > > _installcheck
> > >   ${DESTDIR}/${DISTDIR}/${dist}.debug.meta
> > >  .endfor
> > >  .endif
> > > +.elif make(installworld) && ${MK_CAROOT} != "no"
> > > + # We could make certctl a bootstrap tool, but it requires OpenSSL 
> > > and
> > > + # friends, which we likely don't want.  We'll rehash on a 
> > > best-effort
> > > + # basis, otherwise we'll just mention that we're not doing it to 
> > > raise
> > > + # awareness.
> > > + @if which certctl>/dev/null; then \
> > > + certctl rehash \
> >
> > Does this update METALOG with the added links?
> >
> > It seems a little weird to rely on DESTDIR from the environment.
> >
> > In general I'm not enthusiastic about additions to installworld that do
> > anything other than copying files, creating links, etc in simple ways.
> 
> I will happily back this out if I can get some qualified eyes to
> review/improve it. It does not update METALOG, and it probably should.
> Agreed on DESTDIR. As for point #3, I guess we can continue spreading
> `certctl rehash` all over the tree in various points that may need it;
> the release(7) scripts will need to be done if we don't do it here at
> a minimum, and I haven't put much thought into it beyond that.

I'm not in a rush to back this out given that it's solving a real
problem, but lets talk about improvements.

I kind of feel like this belongs in distribution (which I think would
deal with release scripts) or in etcupdate/mergemaster, but I'm not
sure either of those are correct.  I'd be happy to review changes to
update the METALOG (I guess we'd extend certctl with an option to do
that?)  I think that's the most important things because we really
should be routinely validating that DESTDIR only contains things in the
METALOG.  A quick and dirty fix for the DESTDIR weirdness might be adding
"env DESTDIR=${DESTDIR}" so it's explicit.

> The close-to-infuriating part of the caroot project has been that it's
> incredibly hard to get almost anyone else (with some obvious
> exceptions) to do more than informal discussion on the matter; actual
> review, in particular, is difficult to obtain.

Thanks for doing all this work!  I'm afraid the whole thing gives me
third-rail vibes (not the idea or the implementation, but the potential
for things to go wrong) so I've veered away from the larger reviews. :(

-- Brooks


signature.asc
Description: PGP signature


Re: svn commit: r360833 - head

2020-05-11 Thread Brooks Davis
On Sat, May 09, 2020 at 02:01:29AM +, Kyle Evans wrote:
> Author: kevans
> Date: Sat May  9 02:01:29 2020
> New Revision: 360833
> URL: https://svnweb.freebsd.org/changeset/base/360833
> 
> Log:
>   installworld: attempt a certctl rehash at the tail end
>   
>   This can be run as root or normal user with no problem; if they hadn't
>   twisted the WITHOUT_CAROOT knob, we'll attempt to use the host certctl to
>   rehash the DESTDIR. This would allow one to build systems WITHOUT_OPENSSL +
>   WITH_CAROOT with a populated /etc/ssl that they can then use with an
>   appropriate *ssl from somewhere else.
>   
>   Cross-builds are fine because this will always use the host certctl, or just
>   nag if it's missing and it wasn't a WITHOUT_CAROOT build.
>   
>   MFC after:  1 week
>   Differential Revision:  https://reviews.freebsd.org/D24641
> 
> Modified:
>   head/Makefile.inc1
> 
> Modified: head/Makefile.inc1
> ==
> --- head/Makefile.inc1Sat May  9 01:48:08 2020(r360832)
> +++ head/Makefile.inc1Sat May  9 02:01:29 2020(r360833)
> @@ -1403,6 +1403,16 @@ distributeworld installworld stageworld: _installcheck
>   ${DESTDIR}/${DISTDIR}/${dist}.debug.meta
>  .endfor
>  .endif
> +.elif make(installworld) && ${MK_CAROOT} != "no"
> + # We could make certctl a bootstrap tool, but it requires OpenSSL and
> + # friends, which we likely don't want.  We'll rehash on a best-effort
> + # basis, otherwise we'll just mention that we're not doing it to raise
> + # awareness.
> + @if which certctl>/dev/null; then \
> + certctl rehash \

Does this update METALOG with the added links?

It seems a little weird to rely on DESTDIR from the environment.

In general I'm not enthusiastic about additions to installworld that do
anything other than copying files, creating links, etc in simple ways.

-- Brooks


signature.asc
Description: PGP signature


svn commit: r360695 - stable/11/sys/mips/mips

2020-05-06 Thread Brooks Davis
Author: brooks
Date: Wed May  6 17:42:36 2020
New Revision: 360695
URL: https://svnweb.freebsd.org/changeset/base/360695

Log:
  MFC r359974:
  
  Don't directly access userspace memory.
  
  Rather then using the racy useracc() followed by direct access to
  userspace memory, perform a copyin() and use the result if it succeeds.
  
  Reviewed by:  jhb
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D24410

Modified:
  stable/11/sys/mips/mips/trap.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/mips/mips/trap.c
==
--- stable/11/sys/mips/mips/trap.c  Wed May  6 17:35:42 2020
(r360694)
+++ stable/11/sys/mips/mips/trap.c  Wed May  6 17:42:36 2020
(r360695)
@@ -1443,7 +1443,7 @@ log_illegal_instruction(const char *msg, struct trapfr
 {
pt_entry_t *ptep;
pd_entry_t *pdep;
-   unsigned int *addr;
+   unsigned int *addr, instr[4];
struct thread *td;
struct proc *p;
register_t pc;
@@ -1470,17 +1470,16 @@ log_illegal_instruction(const char *msg, struct trapfr
 * Dump a few words around faulting instruction, if the addres is
 * valid.
 */
-   if (!(pc & 3) &&
-   useracc((caddr_t)(intptr_t)pc, sizeof(int) * 4, VM_PROT_READ)) {
+   addr = (unsigned int *)(intptr_t)pc;
+   if ((pc & 3) == 0 && copyin(addr, instr, sizeof(instr)) == 0) {
/* dump page table entry for faulting instruction */
log(LOG_ERR, "Page table info for pc address %#jx: pde = %p, 
pte = %#jx\n",
(intmax_t)pc, (void *)(intptr_t)*pdep, (uintmax_t)(ptep ? 
*ptep : 0));
 
-   addr = (unsigned int *)(intptr_t)pc;
log(LOG_ERR, "Dumping 4 words starting at pc address %p: \n",
addr);
log(LOG_ERR, "%08x %08x %08x %08x\n",
-   addr[0], addr[1], addr[2], addr[3]);
+   instr[0], instr[1], instr[2], instr[3]);
} else {
log(LOG_ERR, "pc address %#jx is inaccessible, pde = %p, pte = 
%#jx\n",
(intmax_t)pc, (void *)(intptr_t)*pdep, (uintmax_t)(ptep ? 
*ptep : 0));
@@ -1492,7 +1491,7 @@ log_bad_page_fault(char *msg, struct trapframe *frame,
 {
pt_entry_t *ptep;
pd_entry_t *pdep;
-   unsigned int *addr;
+   unsigned int *addr, instr[4];
struct thread *td;
struct proc *p;
char *read_or_write;
@@ -1540,18 +1539,18 @@ log_bad_page_fault(char *msg, struct trapframe *frame,
 * Dump a few words around faulting instruction, if the addres is
 * valid.
 */
-   if (!(pc & 3) && (pc != frame->badvaddr) &&
-   (trap_type != T_BUS_ERR_IFETCH) &&
-   useracc((caddr_t)(intptr_t)pc, sizeof(int) * 4, VM_PROT_READ)) {
+   addr = (unsigned int *)(intptr_t)pc;
+   if ((pc & 3) == 0 && pc != frame->badvaddr &&
+   trap_type != T_BUS_ERR_IFETCH &&
+   copyin((caddr_t)(intptr_t)pc, instr, sizeof(instr)) == 0) {
/* dump page table entry for faulting instruction */
log(LOG_ERR, "Page table info for pc address %#jx: pde = %p, 
pte = %#jx\n",
(intmax_t)pc, (void *)(intptr_t)*pdep, (uintmax_t)(ptep ? 
*ptep : 0));
 
-   addr = (unsigned int *)(intptr_t)pc;
log(LOG_ERR, "Dumping 4 words starting at pc address %p: \n",
addr);
log(LOG_ERR, "%08x %08x %08x %08x\n",
-   addr[0], addr[1], addr[2], addr[3]);
+   instr[0], instr[1], instr[2], instr[3]);
} else {
log(LOG_ERR, "pc address %#jx is inaccessible, pde = %p, pte = 
%#jx\n",
(intmax_t)pc, (void *)(intptr_t)*pdep, (uintmax_t)(ptep ? 
*ptep : 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: r360693 - stable/12/sys/mips/mips

2020-05-06 Thread Brooks Davis
Author: brooks
Date: Wed May  6 17:12:26 2020
New Revision: 360693
URL: https://svnweb.freebsd.org/changeset/base/360693

Log:
  MFC r359974:
  
  Don't directly access userspace memory.
  
  Rather then using the racy useracc() followed by direct access to
  userspace memory, perform a copyin() and use the result if it succeeds.
  
  Reviewed by:  jhb
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D24410

Modified:
  stable/12/sys/mips/mips/trap.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/mips/mips/trap.c
==
--- stable/12/sys/mips/mips/trap.c  Wed May  6 15:24:31 2020
(r360692)
+++ stable/12/sys/mips/mips/trap.c  Wed May  6 17:12:26 2020
(r360693)
@@ -1404,7 +1404,7 @@ log_illegal_instruction(const char *msg, struct trapfr
 {
pt_entry_t *ptep;
pd_entry_t *pdep;
-   unsigned int *addr;
+   unsigned int *addr, instr[4];
struct thread *td;
struct proc *p;
register_t pc;
@@ -1431,17 +1431,16 @@ log_illegal_instruction(const char *msg, struct trapfr
 * Dump a few words around faulting instruction, if the addres is
 * valid.
 */
-   if (!(pc & 3) &&
-   useracc((caddr_t)(intptr_t)pc, sizeof(int) * 4, VM_PROT_READ)) {
+   addr = (unsigned int *)(intptr_t)pc;
+   if ((pc & 3) == 0 && copyin(addr, instr, sizeof(instr)) == 0) {
/* dump page table entry for faulting instruction */
log(LOG_ERR, "Page table info for pc address %#jx: pde = %p, 
pte = %#jx\n",
(intmax_t)pc, (void *)(intptr_t)*pdep, (uintmax_t)(ptep ? 
*ptep : 0));
 
-   addr = (unsigned int *)(intptr_t)pc;
log(LOG_ERR, "Dumping 4 words starting at pc address %p: \n",
addr);
log(LOG_ERR, "%08x %08x %08x %08x\n",
-   addr[0], addr[1], addr[2], addr[3]);
+   instr[0], instr[1], instr[2], instr[3]);
} else {
log(LOG_ERR, "pc address %#jx is inaccessible, pde = %p, pte = 
%#jx\n",
(intmax_t)pc, (void *)(intptr_t)*pdep, (uintmax_t)(ptep ? 
*ptep : 0));
@@ -1453,7 +1452,7 @@ log_bad_page_fault(char *msg, struct trapframe *frame,
 {
pt_entry_t *ptep;
pd_entry_t *pdep;
-   unsigned int *addr;
+   unsigned int *addr, instr[4];
struct thread *td;
struct proc *p;
char *read_or_write;
@@ -1501,18 +1500,18 @@ log_bad_page_fault(char *msg, struct trapframe *frame,
 * Dump a few words around faulting instruction, if the addres is
 * valid.
 */
-   if (!(pc & 3) && (pc != frame->badvaddr) &&
-   (trap_type != T_BUS_ERR_IFETCH) &&
-   useracc((caddr_t)(intptr_t)pc, sizeof(int) * 4, VM_PROT_READ)) {
+   addr = (unsigned int *)(intptr_t)pc;
+   if ((pc & 3) == 0 && pc != frame->badvaddr &&
+   trap_type != T_BUS_ERR_IFETCH &&
+   copyin((caddr_t)(intptr_t)pc, instr, sizeof(instr)) == 0) {
/* dump page table entry for faulting instruction */
log(LOG_ERR, "Page table info for pc address %#jx: pde = %p, 
pte = %#jx\n",
(intmax_t)pc, (void *)(intptr_t)*pdep, (uintmax_t)(ptep ? 
*ptep : 0));
 
-   addr = (unsigned int *)(intptr_t)pc;
log(LOG_ERR, "Dumping 4 words starting at pc address %p: \n",
addr);
log(LOG_ERR, "%08x %08x %08x %08x\n",
-   addr[0], addr[1], addr[2], addr[3]);
+   instr[0], instr[1], instr[2], instr[3]);
} else {
log(LOG_ERR, "pc address %#jx is inaccessible, pde = %p, pte = 
%#jx\n",
(intmax_t)pc, (void *)(intptr_t)*pdep, (uintmax_t)(ptep ? 
*ptep : 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: r360635 - in head/contrib/jemalloc: . include/jemalloc

2020-05-04 Thread Brooks Davis
Author: brooks
Date: Mon May  4 17:16:30 2020
New Revision: 360635
URL: https://svnweb.freebsd.org/changeset/base/360635

Log:
  Set LG_VADDR to 48 on RISC-V.
  
  The Sv48 PTE format is the largest currently defined address space for
  RISC-V. It makes no sense to define a larger size and doing so (at
  least for 64-bits) forces rtrees down a slow path.
  
  Reviewed by:  vangyzen, jhb, mhorne
  Obtained from:CheriBSD
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D24658

Modified:
  head/contrib/jemalloc/FREEBSD-diffs
  head/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h

Modified: head/contrib/jemalloc/FREEBSD-diffs
==
--- head/contrib/jemalloc/FREEBSD-diffs Mon May  4 16:50:01 2020
(r360634)
+++ head/contrib/jemalloc/FREEBSD-diffs Mon May  4 17:16:30 2020
(r360635)
@@ -233,7 +233,7 @@ index ..b752b0e7
 +#  define LG_SIZEOF_PTR   2
 +#endif
 +#ifdef __riscv
-+#  define LG_VADDR64
++#  define LG_VADDR48
 +#  define LG_SIZEOF_PTR   3
 +#endif
 +

Modified: head/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h
==
--- head/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h   Mon May  4 
16:50:01 2020(r360634)
+++ head/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h   Mon May  4 
17:16:30 2020(r360635)
@@ -68,7 +68,7 @@
 #  define LG_SIZEOF_PTR2
 #endif
 #ifdef __riscv
-#  define LG_VADDR 64
+#  define LG_VADDR 48
 #  define LG_SIZEOF_PTR3
 #endif
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r360451 - in stable/11/sys: amd64/linux amd64/linux32 compat/freebsd32 compat/linux dev/ipmi dev/mpr dev/mps dev/mpt i386/linux kern sys

2020-04-28 Thread Brooks Davis
Author: brooks
Date: Tue Apr 28 20:14:38 2020
New Revision: 360451
URL: https://svnweb.freebsd.org/changeset/base/360451

Log:
  MFC r359937:
  
  Centralize compatability translation macros.
  
  Copy the CP, PTRIN, etc macros from freebsd32.h into a sys/abi_compat.h
  and replace existing definitation with includes where required. This
  eliminates duplicate code and allows Linux and FreeBSD compatability
  headers to be included in the same files.
  
  Obtained from:CheriBSD
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D24275

Added:
  stable/11/sys/sys/abi_compat.h
 - copied unchanged from r359937, head/sys/sys/abi_compat.h
Modified:
  stable/11/sys/amd64/linux/linux.h
  stable/11/sys/amd64/linux32/linux.h
  stable/11/sys/compat/freebsd32/freebsd32.h
  stable/11/sys/compat/linux/linux_ioctl.c
  stable/11/sys/compat/linux/linux_timer.h
  stable/11/sys/dev/ipmi/ipmi.c
  stable/11/sys/dev/mpr/mpr_user.c
  stable/11/sys/dev/mps/mps_user.c
  stable/11/sys/dev/mpt/mpt_user.c
  stable/11/sys/i386/linux/linux.h
  stable/11/sys/kern/sysv_sem.c
  stable/11/sys/kern/sysv_shm.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/amd64/linux/linux.h
==
--- stable/11/sys/amd64/linux/linux.h   Tue Apr 28 20:00:17 2020
(r360450)
+++ stable/11/sys/amd64/linux/linux.h   Tue Apr 28 20:14:38 2020
(r360451)
@@ -32,6 +32,8 @@
 #ifndef _AMD64_LINUX_H_
 #define_AMD64_LINUX_H_
 
+#include 
+
 #include 
 #include 
 
@@ -47,14 +49,6 @@ extern u_char linux_debug_map[];
 #defineLMSG(fmt)   "linux(%ld/%ld): "fmt"\n",  
\
(long)td->td_proc->p_pid, (long)td->td_tid
 #defineLINUX_DTRACElinuxulator
-
-#definePTRIN(v)(void *)(v)
-#definePTROUT(v)   (uintptr_t)(v)
-
-#defineCP(src,dst,fld) do { (dst).fld = (src).fld; } while (0)
-#defineCP2(src,dst,sfld,dfld) do { (dst).dfld = (src).sfld; } while (0)
-#definePTRIN_CP(src,dst,fld) \
-   do { (dst).fld = PTRIN((src).fld); } while (0)
 
 /*
  * Provide a separate set of types for the Linux types.

Modified: stable/11/sys/amd64/linux32/linux.h
==
--- stable/11/sys/amd64/linux32/linux.h Tue Apr 28 20:00:17 2020
(r360450)
+++ stable/11/sys/amd64/linux32/linux.h Tue Apr 28 20:14:38 2020
(r360451)
@@ -33,6 +33,8 @@
 #ifndef _AMD64_LINUX_H_
 #define_AMD64_LINUX_H_
 
+#include 
+
 #include 
 #include 
 
@@ -58,14 +60,6 @@ extern u_char linux_debug_map[];
 #defineLINUX32_MAXDSIZ (512 * 1024 * 1024) /* 512MB */
 #defineLINUX32_MAXSSIZ (64 * 1024 * 1024)  /* 64MB */
 #defineLINUX32_MAXVMEM 0   /* Unlimited */
-
-#definePTRIN(v)(void *)(uintptr_t)(v)
-#definePTROUT(v)   (l_uintptr_t)(uintptr_t)(v)
-
-#defineCP(src,dst,fld) do { (dst).fld = (src).fld; } while (0)
-#defineCP2(src,dst,sfld,dfld) do { (dst).dfld = (src).sfld; } while (0)
-#definePTRIN_CP(src,dst,fld) \
-   do { (dst).fld = PTRIN((src).fld); } while (0)
 
 /*
  * Provide a separate set of types for the Linux types.

Modified: stable/11/sys/compat/freebsd32/freebsd32.h
==
--- stable/11/sys/compat/freebsd32/freebsd32.h  Tue Apr 28 20:00:17 2020
(r360450)
+++ stable/11/sys/compat/freebsd32/freebsd32.h  Tue Apr 28 20:14:38 2020
(r360451)
@@ -29,19 +29,11 @@
 #ifndef _COMPAT_FREEBSD32_FREEBSD32_H_
 #define _COMPAT_FREEBSD32_FREEBSD32_H_
 
+#include 
 #include 
 #include 
 #include 
 
-#define PTRIN(v)   (void *)(uintptr_t) (v)
-#define PTROUT(v)  (u_int32_t)(uintptr_t) (v)
-
-#define CP(src,dst,fld) do { (dst).fld = (src).fld; } while (0)
-#define PTRIN_CP(src,dst,fld) \
-   do { (dst).fld = PTRIN((src).fld); } while (0)
-#define PTROUT_CP(src,dst,fld) \
-   do { (dst).fld = PTROUT((src).fld); } while (0)
-
 /*
  * Being a newer port, 32-bit FreeBSD/MIPS uses 64-bit time_t.
  */
@@ -55,37 +47,21 @@ struct timeval32 {
time32_t tv_sec;
int32_t tv_usec;
 };
-#define TV_CP(src,dst,fld) do {\
-   CP((src).fld,(dst).fld,tv_sec); \
-   CP((src).fld,(dst).fld,tv_usec);\
-} while (0)
 
 struct timespec32 {
time32_t tv_sec;
int32_t tv_nsec;
 };
-#define TS_CP(src,dst,fld) do {\
-   CP((src).fld,(dst).fld,tv_sec); \
-   CP((src).fld,(dst).fld,tv_nsec);\
-} while (0)
 
 struct itimerspec32 {
struct timespec32  it_interval;
struct timespec32  it_value;
 };
-#define ITS_CP(src, dst) do {  \
-   TS_CP((src), (dst), it_interval);   \
-   TS_CP((src), 

svn commit: r360446 - in stable/12/sys: amd64/linux amd64/linux32 arm64/linux compat/freebsd32 compat/linux dev/ipmi dev/mpr dev/mps dev/mpt i386/linux kern sys

2020-04-28 Thread Brooks Davis
Author: brooks
Date: Tue Apr 28 17:59:37 2020
New Revision: 360446
URL: https://svnweb.freebsd.org/changeset/base/360446

Log:
  MFC r359937:
  
  Centralize compatability translation macros.
  
  Copy the CP, PTRIN, etc macros from freebsd32.h into a sys/abi_compat.h
  and replace existing definitation with includes where required. This
  eliminates duplicate code and allows Linux and FreeBSD compatability
  headers to be included in the same files.
  
  Obtained from:CheriBSD
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D24275

Added:
  stable/12/sys/sys/abi_compat.h
 - copied unchanged from r359937, head/sys/sys/abi_compat.h
Modified:
  stable/12/sys/amd64/linux/linux.h
  stable/12/sys/amd64/linux32/linux.h
  stable/12/sys/arm64/linux/linux.h
  stable/12/sys/compat/freebsd32/freebsd32.h
  stable/12/sys/compat/linux/linux_ioctl.c
  stable/12/sys/compat/linux/linux_timer.h
  stable/12/sys/dev/ipmi/ipmi.c
  stable/12/sys/dev/mpr/mpr_user.c
  stable/12/sys/dev/mps/mps_user.c
  stable/12/sys/dev/mpt/mpt_user.c
  stable/12/sys/i386/linux/linux.h
  stable/12/sys/kern/sysv_sem.c
  stable/12/sys/kern/sysv_shm.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/amd64/linux/linux.h
==
--- stable/12/sys/amd64/linux/linux.h   Tue Apr 28 16:09:28 2020
(r360445)
+++ stable/12/sys/amd64/linux/linux.h   Tue Apr 28 17:59:37 2020
(r360446)
@@ -32,6 +32,8 @@
 #ifndef _AMD64_LINUX_H_
 #define_AMD64_LINUX_H_
 
+#include 
+
 #include 
 #include 
 
@@ -47,14 +49,6 @@ extern u_char linux_debug_map[];
 #defineLMSG(fmt)   "linux(%ld/%ld): "fmt"\n",  
\
(long)td->td_proc->p_pid, (long)td->td_tid
 #defineLINUX_DTRACElinuxulator
-
-#definePTRIN(v)(void *)(v)
-#definePTROUT(v)   (uintptr_t)(v)
-
-#defineCP(src,dst,fld) do { (dst).fld = (src).fld; } while (0)
-#defineCP2(src,dst,sfld,dfld) do { (dst).dfld = (src).sfld; } while (0)
-#definePTRIN_CP(src,dst,fld) \
-   do { (dst).fld = PTRIN((src).fld); } while (0)
 
 /*
  * Provide a separate set of types for the Linux types.

Modified: stable/12/sys/amd64/linux32/linux.h
==
--- stable/12/sys/amd64/linux32/linux.h Tue Apr 28 16:09:28 2020
(r360445)
+++ stable/12/sys/amd64/linux32/linux.h Tue Apr 28 17:59:37 2020
(r360446)
@@ -35,6 +35,8 @@
 #ifndef _AMD64_LINUX_H_
 #define_AMD64_LINUX_H_
 
+#include 
+
 #include 
 #include 
 
@@ -60,14 +62,6 @@ extern u_char linux_debug_map[];
 #defineLINUX32_MAXDSIZ (512 * 1024 * 1024) /* 512MB */
 #defineLINUX32_MAXSSIZ (64 * 1024 * 1024)  /* 64MB */
 #defineLINUX32_MAXVMEM 0   /* Unlimited */
-
-#definePTRIN(v)(void *)(uintptr_t)(v)
-#definePTROUT(v)   (l_uintptr_t)(uintptr_t)(v)
-
-#defineCP(src,dst,fld) do { (dst).fld = (src).fld; } while (0)
-#defineCP2(src,dst,sfld,dfld) do { (dst).dfld = (src).sfld; } while (0)
-#definePTRIN_CP(src,dst,fld) \
-   do { (dst).fld = PTRIN((src).fld); } while (0)
 
 /*
  * Provide a separate set of types for the Linux types.

Modified: stable/12/sys/arm64/linux/linux.h
==
--- stable/12/sys/arm64/linux/linux.h   Tue Apr 28 16:09:28 2020
(r360445)
+++ stable/12/sys/arm64/linux/linux.h   Tue Apr 28 17:59:37 2020
(r360446)
@@ -31,6 +31,8 @@
 #ifndef _ARM64_LINUX_H_
 #define_ARM64_LINUX_H_
 
+#include 
+
 #include 
 #include 
 
@@ -43,14 +45,6 @@ extern u_char linux_debug_map[];
 #defineLMSG(fmt)   "linux(%ld/%ld): "fmt"\n",  
\
(long)td->td_proc->p_pid, (long)td->td_tid
 #defineLINUX_DTRACElinuxulator
-
-#definePTRIN(v)(void *)(v)
-#definePTROUT(v)   (uintptr_t)(v)
-
-#defineCP(src,dst,fld) do { (dst).fld = (src).fld; } while (0)
-#defineCP2(src,dst,sfld,dfld) do { (dst).dfld = (src).sfld; } while (0)
-#definePTRIN_CP(src,dst,fld) \
-   do { (dst).fld = PTRIN((src).fld); } while (0)
 
 /* Provide a separate set of types for the Linux types */
 typedef int32_tl_int;

Modified: stable/12/sys/compat/freebsd32/freebsd32.h
==
--- stable/12/sys/compat/freebsd32/freebsd32.h  Tue Apr 28 16:09:28 2020
(r360445)
+++ stable/12/sys/compat/freebsd32/freebsd32.h  Tue Apr 28 17:59:37 2020
(r360446)
@@ -31,19 +31,11 @@
 #ifndef _COMPAT_FREEBSD32_FREEBSD32_H_
 #define _COMPAT_FREEBSD32_FREEBSD32_H_
 
+#include 
 #include 
 #include 
 #include 
 
-#define PTRIN(v)   

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();
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();
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();
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();
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, char 

svn commit: r360225 - in stable/11/sys: compat/freebsd32 kern

2020-04-23 Thread Brooks Davis
Author: brooks
Date: Thu Apr 23 17:46:29 2020
New Revision: 360225
URL: https://svnweb.freebsd.org/changeset/base/360225

Log:
  MFC r359938:
  
  Remove bogus use of useracc() in (clock_)nanosleep.
  
  There's no point in pre-checking that we can access the user's rmtp
  pointer before we do it in copyout().
  
  While here, improve style(9) compliance.
  
  Reviewed by:  imp
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D24409

Modified:
  stable/11/sys/compat/freebsd32/freebsd32_misc.c
  stable/11/sys/kern/kern_time.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/freebsd32/freebsd32_misc.c
==
--- stable/11/sys/compat/freebsd32/freebsd32_misc.c Thu Apr 23 17:30:03 
2020(r360224)
+++ stable/11/sys/compat/freebsd32/freebsd32_misc.c Thu Apr 23 17:46:29 
2020(r360225)
@@ -2325,7 +2325,7 @@ freebsd32_user_clock_nanosleep(struct thread *td, cloc
 {
struct timespec32 rmt32, rqt32;
struct timespec rmt, rqt;
-   int error;
+   int error, error2;
 
error = copyin(ua_rqtp, , sizeof(rqt32));
if (error)
@@ -2334,18 +2334,13 @@ freebsd32_user_clock_nanosleep(struct thread *td, cloc
CP(rqt32, rqt, tv_sec);
CP(rqt32, rqt, tv_nsec);
 
-   if (ua_rmtp != NULL && (flags & TIMER_ABSTIME) == 0 &&
-   !useracc(ua_rmtp, sizeof(rmt32), VM_PROT_WRITE))
-   return (EFAULT);
error = kern_clock_nanosleep(td, clock_id, flags, , );
if (error == EINTR && ua_rmtp != NULL && (flags & TIMER_ABSTIME) == 0) {
-   int error2;
-
CP(rmt, rmt32, tv_sec);
CP(rmt, rmt32, tv_nsec);
 
error2 = copyout(, ua_rmtp, sizeof(rmt32));
-   if (error2)
+   if (error2 != 0)
error = error2;
}
return (error);

Modified: stable/11/sys/kern/kern_time.c
==
--- stable/11/sys/kern/kern_time.c  Thu Apr 23 17:30:03 2020
(r360224)
+++ stable/11/sys/kern/kern_time.c  Thu Apr 23 17:46:29 2020
(r360225)
@@ -613,20 +613,15 @@ user_clock_nanosleep(struct thread *td, clockid_t cloc
 const struct timespec *ua_rqtp, struct timespec *ua_rmtp)
 {
struct timespec rmt, rqt;
-   int error;
+   int error, error2;
 
error = copyin(ua_rqtp, , sizeof(rqt));
if (error)
return (error);
-   if (ua_rmtp != NULL && (flags & TIMER_ABSTIME) == 0 &&
-   !useracc(ua_rmtp, sizeof(rmt), VM_PROT_WRITE))
-   return (EFAULT);
error = kern_clock_nanosleep(td, clock_id, flags, , );
if (error == EINTR && ua_rmtp != NULL && (flags & TIMER_ABSTIME) == 0) {
-   int error2;
-
error2 = copyout(, ua_rmtp, sizeof(rmt));
-   if (error2)
+   if (error2 != 0)
error = error2;
}
return (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: r360200 - in stable/12/sys: compat/freebsd32 kern

2020-04-22 Thread Brooks Davis
Author: brooks
Date: Wed Apr 22 17:14:02 2020
New Revision: 360200
URL: https://svnweb.freebsd.org/changeset/base/360200

Log:
  MFC r359938:
  
  Remove bogus use of useracc() in (clock_)nanosleep.
  
  There's no point in pre-checking that we can access the user's rmtp
  pointer before we do it in copyout().
  
  While here, improve style(9) compliance.
  
  Reviewed by:  imp
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D24409

Modified:
  stable/12/sys/compat/freebsd32/freebsd32_misc.c
  stable/12/sys/kern/kern_time.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/compat/freebsd32/freebsd32_misc.c
==
--- stable/12/sys/compat/freebsd32/freebsd32_misc.c Wed Apr 22 17:04:31 
2020(r360199)
+++ stable/12/sys/compat/freebsd32/freebsd32_misc.c Wed Apr 22 17:14:02 
2020(r360200)
@@ -2648,7 +2648,7 @@ freebsd32_user_clock_nanosleep(struct thread *td, cloc
 {
struct timespec32 rmt32, rqt32;
struct timespec rmt, rqt;
-   int error;
+   int error, error2;
 
error = copyin(ua_rqtp, , sizeof(rqt32));
if (error)
@@ -2657,18 +2657,13 @@ freebsd32_user_clock_nanosleep(struct thread *td, cloc
CP(rqt32, rqt, tv_sec);
CP(rqt32, rqt, tv_nsec);
 
-   if (ua_rmtp != NULL && (flags & TIMER_ABSTIME) == 0 &&
-   !useracc(ua_rmtp, sizeof(rmt32), VM_PROT_WRITE))
-   return (EFAULT);
error = kern_clock_nanosleep(td, clock_id, flags, , );
if (error == EINTR && ua_rmtp != NULL && (flags & TIMER_ABSTIME) == 0) {
-   int error2;
-
CP(rmt, rmt32, tv_sec);
CP(rmt, rmt32, tv_nsec);
 
error2 = copyout(, ua_rmtp, sizeof(rmt32));
-   if (error2)
+   if (error2 != 0)
error = error2;
}
return (error);

Modified: stable/12/sys/kern/kern_time.c
==
--- stable/12/sys/kern/kern_time.c  Wed Apr 22 17:04:31 2020
(r360199)
+++ stable/12/sys/kern/kern_time.c  Wed Apr 22 17:14:02 2020
(r360200)
@@ -622,20 +622,15 @@ user_clock_nanosleep(struct thread *td, clockid_t cloc
 const struct timespec *ua_rqtp, struct timespec *ua_rmtp)
 {
struct timespec rmt, rqt;
-   int error;
+   int error, error2;
 
error = copyin(ua_rqtp, , sizeof(rqt));
if (error)
return (error);
-   if (ua_rmtp != NULL && (flags & TIMER_ABSTIME) == 0 &&
-   !useracc(ua_rmtp, sizeof(rmt), VM_PROT_WRITE))
-   return (EFAULT);
error = kern_clock_nanosleep(td, clock_id, flags, , );
if (error == EINTR && ua_rmtp != NULL && (flags & TIMER_ABSTIME) == 0) {
-   int error2;
-
error2 = copyout(, ua_rmtp, sizeof(rmt));
-   if (error2)
+   if (error2 != 0)
error = error2;
}
return (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: r360024 - in head/sys: amd64/linux amd64/linux32 arm64/linux compat/freebsd32 i386/linux kern powerpc/powerpc sys

2020-04-16 Thread Brooks Davis
Author: brooks
Date: Thu Apr 16 21:53:17 2020
New Revision: 360024
URL: https://svnweb.freebsd.org/changeset/base/360024

Log:
  Convert canary, execpathp, and pagesizes to pointers.
  
  Use AUXARGS_ENTRY_PTR to export these pointers.  This is a followup to
  r359987 and r359988.
  
  Reviewed by:  jhb
  Obtained from:CheriBSD
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D24446

Modified:
  head/sys/amd64/linux/linux_sysvec.c
  head/sys/amd64/linux32/linux32_sysvec.c
  head/sys/arm64/linux/linux_sysvec.c
  head/sys/compat/freebsd32/freebsd32_misc.c
  head/sys/i386/linux/linux_sysvec.c
  head/sys/kern/imgact_elf.c
  head/sys/kern/kern_exec.c
  head/sys/powerpc/powerpc/elf_common.c
  head/sys/sys/imgact.h

Modified: head/sys/amd64/linux/linux_sysvec.c
==
--- head/sys/amd64/linux/linux_sysvec.c Thu Apr 16 20:46:35 2020
(r360023)
+++ head/sys/amd64/linux/linux_sysvec.c Thu Apr 16 21:53:17 2020
(r360024)
@@ -254,9 +254,9 @@ linux_copyout_auxargs(struct image_params *imgp, uintp
AUXARGS_ENTRY(pos, AT_EGID, imgp->proc->p_ucred->cr_svgid);
AUXARGS_ENTRY(pos, LINUX_AT_SECURE, issetugid);
AUXARGS_ENTRY(pos, LINUX_AT_PLATFORM, PTROUT(linux_platform));
-   AUXARGS_ENTRY(pos, LINUX_AT_RANDOM, imgp->canary);
+   AUXARGS_ENTRY_PTR(pos, LINUX_AT_RANDOM, imgp->canary);
if (imgp->execpathp != 0)
-   AUXARGS_ENTRY(pos, LINUX_AT_EXECFN, imgp->execpathp);
+   AUXARGS_ENTRY_PTR(pos, LINUX_AT_EXECFN, imgp->execpathp);
if (args->execfd != -1)
AUXARGS_ENTRY(pos, AT_EXECFD, args->execfd);
AUXARGS_ENTRY(pos, AT_NULL, 0);
@@ -315,8 +315,8 @@ linux_copyout_strings(struct image_params *imgp, uintp
if (execpath_len != 0) {
destp -= execpath_len;
destp = rounddown2(destp, sizeof(void *));
-   imgp->execpathp = destp;
-   error = copyout(imgp->execpath, (void *)destp, execpath_len);
+   imgp->execpathp = (void *)destp;
+   error = copyout(imgp->execpath, imgp->execpathp, execpath_len);
if (error != 0)
return (error);
}
@@ -324,8 +324,8 @@ linux_copyout_strings(struct image_params *imgp, uintp
/* Prepare the canary for SSP. */
arc4rand(canary, sizeof(canary), 0);
destp -= roundup(sizeof(canary), sizeof(void *));
-   imgp->canary = destp;
-   error = copyout(canary, (void *)destp, sizeof(canary));
+   imgp->canary = (void *)destp;
+   error = copyout(canary, imgp->canary, sizeof(canary));
if (error != 0)
return (error);
 

Modified: head/sys/amd64/linux32/linux32_sysvec.c
==
--- head/sys/amd64/linux32/linux32_sysvec.c Thu Apr 16 20:46:35 2020
(r360023)
+++ head/sys/amd64/linux32/linux32_sysvec.c Thu Apr 16 21:53:17 2020
(r360024)
@@ -742,8 +742,8 @@ linux_copyout_strings(struct image_params *imgp, uintp
if (execpath_len != 0) {
destp -= execpath_len;
destp = rounddown2(destp, sizeof(uint32_t));
-   imgp->execpathp = destp;
-   error = copyout(imgp->execpath, (void *)destp, execpath_len);
+   imgp->execpathp = (void *)destp;
+   error = copyout(imgp->execpath, imgp->execpathp, execpath_len);
if (error != 0)
return (error);
}
@@ -751,8 +751,8 @@ linux_copyout_strings(struct image_params *imgp, uintp
/* Prepare the canary for SSP. */
arc4rand(canary, sizeof(canary), 0);
destp -= roundup(sizeof(canary), sizeof(uint32_t));
-   imgp->canary = destp;
-   error = copyout(canary, (void *)destp, sizeof(canary));
+   imgp->canary = (void *)destp;
+   error = copyout(canary, imgp->canary, sizeof(canary));
if (error != 0)
return (error);
 

Modified: head/sys/arm64/linux/linux_sysvec.c
==
--- head/sys/arm64/linux/linux_sysvec.c Thu Apr 16 20:46:35 2020
(r360023)
+++ head/sys/arm64/linux/linux_sysvec.c Thu Apr 16 21:53:17 2020
(r360024)
@@ -180,9 +180,9 @@ linux_copyout_auxargs(struct image_params *imgp, uintp
 #if 0  /* LINUXTODO: implement arm64 LINUX_AT_PLATFORM */
AUXARGS_ENTRY(pos, LINUX_AT_PLATFORM, PTROUT(linux_platform));
 #endif
-   AUXARGS_ENTRY(pos, LINUX_AT_RANDOM, imgp->canary);
+   AUXARGS_ENTRY_PTR(pos, LINUX_AT_RANDOM, imgp->canary);
if (imgp->execpathp != 0)
-   AUXARGS_ENTRY(pos, LINUX_AT_EXECFN, imgp->execpathp);
+   AUXARGS_ENTRY_PTR(pos, LINUX_AT_EXECFN, imgp->execpathp);
if (args->execfd != -1)
AUXARGS_ENTRY(pos, AT_EXECFD, args->execfd);

svn commit: r360015 - head/sys/kern

2020-04-16 Thread Brooks Davis
Author: brooks
Date: Thu Apr 16 17:24:13 2020
New Revision: 360015
URL: https://svnweb.freebsd.org/changeset/base/360015

Log:
  style(9): end continued line with operator.

Modified:
  head/sys/kern/kern_sysctl.c

Modified: head/sys/kern/kern_sysctl.c
==
--- head/sys/kern/kern_sysctl.c Thu Apr 16 17:20:18 2020(r360014)
+++ head/sys/kern/kern_sysctl.c Thu Apr 16 17:24:13 2020(r360015)
@@ -1655,8 +1655,8 @@ sysctl_handle_string(SYSCTL_HANDLER_ARGS)
 * string.  In ddb, don't worry about trying to make a malloced
 * snapshot.
 */
-   if ((oidp->oid_kind & (CTLFLAG_WR | CTLFLAG_TUN)) == 0 || arg2 == 0
-   || kdb_active) {
+   if ((oidp->oid_kind & (CTLFLAG_WR | CTLFLAG_TUN)) == 0 ||
+   arg2 == 0 || kdb_active) {
arg2 = strlen((char *)arg1) + 1;
ro_string = 1;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r360004 - head/sys/i386/i386

2020-04-16 Thread Brooks Davis
On Thu, Apr 16, 2020 at 05:27:14AM +, Scott Long wrote:
> Author: scottl
> Date: Thu Apr 16 05:27:13 2020
> New Revision: 360004
> URL: https://svnweb.freebsd.org/changeset/base/360004
> 
> Log:
>   Fix ps_strings type change for i386

Thanks for the fix.  I did do a make tinderbox, but missed this failure
due to an unrelated riscv failure.

-- Brooks


signature.asc
Description: PGP signature


svn commit: r359991 - head/lib/libc/gen

2020-04-15 Thread Brooks Davis
Author: brooks
Date: Wed Apr 15 20:28:20 2020
New Revision: 359991
URL: https://svnweb.freebsd.org/changeset/base/359991

Log:
  Attempt to use AT_PS_STRINGS to get the ps_strings pointer.
  
  This saves a system call and avoids one of the (relatively rare) cases
  of the kernel exporting pointers via sysctl.
  
  As a temporary measure, keep the sysctl support to allow limited
  compatability with old kernels.
  
  Fail gracefully if ps_strings can't be found (should never happen).
  
  Reviewed by:  kib
  Obtained from:CheriBSD
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D24407

Modified:
  head/lib/libc/gen/setproctitle.c

Modified: head/lib/libc/gen/setproctitle.c
==
--- head/lib/libc/gen/setproctitle.cWed Apr 15 20:26:41 2020
(r359990)
+++ head/lib/libc/gen/setproctitle.cWed Apr 15 20:28:20 2020
(r359991)
@@ -20,6 +20,7 @@ __FBSDID("$FreeBSD$");
 
 #include "namespace.h"
 #include 
+#include 
 #include 
 #include 
 
@@ -112,6 +113,10 @@ setproctitle_internal(const char *fmt, va_list ap)
/* Nothing to restore */
return (NULL);
 
+   if (ps_strings == NULL)
+   (void)_elf_aux_info(AT_PS_STRINGS, _strings,
+   sizeof(ps_strings));
+
if (ps_strings == NULL) {
len = sizeof(ul_ps_strings);
if (sysctlbyname("kern.ps_strings", _ps_strings, , NULL,
@@ -119,6 +124,9 @@ setproctitle_internal(const char *fmt, va_list ap)
return (NULL);
ps_strings = (struct ps_strings *)ul_ps_strings;
}
+
+   if (ps_strings == NULL)
+   return (NULL);
 
/*
 * PS_STRINGS points to zeroed memory on a style #2 kernel.
___
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: r359990 - head/lib/libc/gen

2020-04-15 Thread Brooks Davis
Author: brooks
Date: Wed Apr 15 20:26:41 2020
New Revision: 359990
URL: https://svnweb.freebsd.org/changeset/base/359990

Log:
  Support AT_PS_STRINGS in _elf_aux_info().
  
  This will be used by setproctitle().
  
  Reviewed by:  kib
  Obtained from:CheriBSD
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D24407

Modified:
  head/lib/libc/gen/auxv.c

Modified: head/lib/libc/gen/auxv.c
==
--- head/lib/libc/gen/auxv.cWed Apr 15 20:25:38 2020(r359989)
+++ head/lib/libc/gen/auxv.cWed Apr 15 20:26:41 2020(r359990)
@@ -70,7 +70,7 @@ static pthread_once_t aux_once = PTHREAD_ONCE_INIT;
 static int pagesize, osreldate, canary_len, ncpus, pagesizes_len, bsdflags;
 static int hwcap_present, hwcap2_present;
 static char *canary, *pagesizes, *execpath;
-static void *timekeep;
+static void *ps_strings, *timekeep;
 static u_long hwcap, hwcap2;
 
 #ifdef __powerpc__
@@ -135,6 +135,10 @@ init_aux(void)
case AT_TIMEKEEP:
timekeep = aux->a_un.a_ptr;
break;
+
+   case AT_PS_STRINGS:
+   ps_strings = aux->a_un.a_ptr;
+   break;
 #ifdef __powerpc__
/*
 * Since AT_STACKPROT is always set, and the common
@@ -334,6 +338,16 @@ _elf_aux_info(int aux, void *buf, int buflen)
if (buflen == sizeof(int)) {
*(int *)buf = bsdflags;
res = 0;
+   } else
+   res = EINVAL;
+   break;
+   case AT_PS_STRINGS:
+   if (buflen == sizeof(void *)) {
+   if (ps_strings != NULL) {
+   *(void **)buf = ps_strings;
+   res = 0;
+   } else
+   res = ENOENT;
} else
res = EINVAL;
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: r359989 - head/usr.bin/procstat

2020-04-15 Thread Brooks Davis
Author: brooks
Date: Wed Apr 15 20:25:38 2020
New Revision: 359989
URL: https://svnweb.freebsd.org/changeset/base/359989

Log:
  Add procstat support for AT_ flags added in r359988.
  
  This includes argc, argv, envc, envv, and ps_strings.
  
  Reviewed by:  kib
  Obtained from:CheriBSD
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D24407

Modified:
  head/usr.bin/procstat/procstat_auxv.c

Modified: head/usr.bin/procstat/procstat_auxv.c
==
--- head/usr.bin/procstat/procstat_auxv.c   Wed Apr 15 20:23:55 2020
(r359988)
+++ head/usr.bin/procstat/procstat_auxv.c   Wed Apr 15 20:25:38 2020
(r359989)
@@ -203,6 +203,36 @@ procstat_auxv(struct procstat *procstat, struct kinfo_
prefix, "AT_BSDFLAGS", (u_long)auxv[i].a_un.a_val);
break;
 #endif
+#ifdef AT_ARGC
+   case AT_ARGC:
+   xo_emit("{dw:/%s}{Lw:/%-16s/%s}{:AT_ARGC/%ld}\n",
+   prefix, "AT_ARGC", (long)auxv[i].a_un.a_val);
+   break;
+#endif
+#ifdef AT_ARGV
+   case AT_ARGV:
+   xo_emit("{dw:/%s}{Lw:/%-16s/%s}{:AT_ARGV/%p}\n",
+   prefix, "AT_ARGV", auxv[i].a_un.a_ptr);
+   break;
+#endif
+#ifdef AT_ENVC
+   case AT_ENVC:
+   xo_emit("{dw:/%s}{Lw:/%-16s/%s}{:AT_ENVC/%ld}\n",
+   prefix, "AT_ENVC", (long)auxv[i].a_un.a_val);
+   break;
+#endif
+#ifdef AT_ENVV
+   case AT_ENVV:
+   xo_emit("{dw:/%s}{Lw:/%-16s/%s}{:AT_ENVV/%p}\n",
+   prefix, "AT_ENVV", auxv[i].a_un.a_ptr);
+   break;
+#endif
+#ifdef AT_PS_STRINGS
+   case AT_PS_STRINGS:
+   xo_emit("{dw:/%s}{Lw:/%-16s/%s}{:AT_PS_STRINGS/%p}\n",
+   prefix, "AT_PS_STRINGS", auxv[i].a_un.a_ptr);
+   break;
+#endif
default:
xo_emit("{dw:/%s}{Lw:/%16ld/%ld}{:UNKNOWN/%#lx}\n",
prefix, auxv[i].a_type, auxv[i].a_un.a_val);
___
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: r359988 - in head/sys: compat/freebsd32 kern sys

2020-04-15 Thread Brooks Davis
Author: brooks
Date: Wed Apr 15 20:23:55 2020
New Revision: 359988
URL: https://svnweb.freebsd.org/changeset/base/359988

Log:
  Export argc, argv, envc, envv, and ps_strings in auxargs.
  
  This simplifies discovery of these values, potentially with reducing the
  number of syscalls we need to make at runtime.  Longer term, we wish to
  convert the startup process to pass an auxargs pointer to _start() and
  use that rather than walking off the end of envv.  This is cleaner,
  more C-friendly, and for systems with strong bounds (e.g. CHERI)
  necessary.
  
  Reviewed by:  kib
  Obtained from:CheriBSD
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D24407

Modified:
  head/sys/compat/freebsd32/freebsd32_misc.c
  head/sys/kern/imgact_elf.c
  head/sys/kern/kern_exec.c
  head/sys/sys/elf_common.h
  head/sys/sys/imgact.h

Modified: head/sys/compat/freebsd32/freebsd32_misc.c
==
--- head/sys/compat/freebsd32/freebsd32_misc.c  Wed Apr 15 20:21:30 2020
(r359987)
+++ head/sys/compat/freebsd32/freebsd32_misc.c  Wed Apr 15 20:23:55 2020
(r359988)
@@ -3237,6 +3237,7 @@ freebsd32_copyout_strings(struct image_params *imgp, u
/*
 * Fill in "ps_strings" struct for ps, w, etc.
 */
+   imgp->argv = vectp;
if (suword32(>ps_argvstr, (u_int32_t)(intptr_t)vectp) != 0 ||
suword32(>ps_nargvstr, argc) != 0)
return (EFAULT);
@@ -3256,6 +3257,7 @@ freebsd32_copyout_strings(struct image_params *imgp, u
if (suword32(vectp++, 0) != 0)
return (EFAULT);
 
+   imgp->envv = vectp;
if (suword32(>ps_envstr, (u_int32_t)(intptr_t)vectp) != 0 ||
suword32(>ps_nenvstr, envc) != 0)
return (EFAULT);

Modified: head/sys/kern/imgact_elf.c
==
--- head/sys/kern/imgact_elf.c  Wed Apr 15 20:21:30 2020(r359987)
+++ head/sys/kern/imgact_elf.c  Wed Apr 15 20:23:55 2020(r359988)
@@ -1374,6 +1374,11 @@ __elfN(freebsd_copyout_auxargs)(struct image_params *i
AUXARGS_ENTRY(pos, AT_HWCAP2, *imgp->sysent->sv_hwcap2);
AUXARGS_ENTRY(pos, AT_BSDFLAGS, __elfN(sigfastblock) ?
ELF_BSDF_SIGFASTBLK : 0);
+   AUXARGS_ENTRY(pos, AT_ARGC, imgp->args->argc);
+   AUXARGS_ENTRY_PTR(pos, AT_ARGV, imgp->argv);
+   AUXARGS_ENTRY(pos, AT_ENVC, imgp->args->envc);
+   AUXARGS_ENTRY_PTR(pos, AT_ENVV, imgp->envv);
+   AUXARGS_ENTRY_PTR(pos, AT_PS_STRINGS, imgp->ps_strings);
AUXARGS_ENTRY(pos, AT_NULL, 0);
 
free(imgp->auxargs, M_TEMP);

Modified: head/sys/kern/kern_exec.c
==
--- head/sys/kern/kern_exec.c   Wed Apr 15 20:21:30 2020(r359987)
+++ head/sys/kern/kern_exec.c   Wed Apr 15 20:23:55 2020(r359988)
@@ -1646,6 +1646,7 @@ exec_copyout_strings(struct image_params *imgp, uintpt
/*
 * Fill in "ps_strings" struct for ps, w, etc.
 */
+   imgp->argv = vectp;
if (suword(>ps_argvstr, (long)(intptr_t)vectp) != 0 ||
suword32(>ps_nargvstr, argc) != 0)
return (EFAULT);
@@ -1665,6 +1666,7 @@ exec_copyout_strings(struct image_params *imgp, uintpt
if (suword(vectp++, 0) != 0)
return (EFAULT);
 
+   imgp->envv = vectp;
if (suword(>ps_envstr, (long)(intptr_t)vectp) != 0 ||
suword32(>ps_nenvstr, envc) != 0)
return (EFAULT);

Modified: head/sys/sys/elf_common.h
==
--- head/sys/sys/elf_common.h   Wed Apr 15 20:21:30 2020(r359987)
+++ head/sys/sys/elf_common.h   Wed Apr 15 20:23:55 2020(r359988)
@@ -956,8 +956,13 @@ typedef struct {
 #defineAT_HWCAP25  /* CPU feature flags. */
 #defineAT_HWCAP2   26  /* CPU feature flags 2. */
 #defineAT_BSDFLAGS 27  /* ELF BSD Flags. */
+#defineAT_ARGC 28  /* Argument count */
+#defineAT_ARGV 29  /* Argument vector */
+#defineAT_ENVC 30  /* Environment count */
+#defineAT_ENVV 31  /* Environment vector */
+#defineAT_PS_STRINGS   32  /* struct ps_strings */
 
-#defineAT_COUNT28  /* Count of defined aux entry types. */
+#defineAT_COUNT33  /* Count of defined aux entry types. */
 
 /*
  * Relocation types.

Modified: head/sys/sys/imgact.h
==
--- head/sys/sys/imgact.h   Wed Apr 15 20:21:30 2020(r359987)
+++ head/sys/sys/imgact.h   Wed Apr 15 20:23:55 2020(r359988)
@@ -78,6 +78,8 @@ struct image_params {
void *ps_strings;   /* pointer to ps_string 

  1   2   3   4   5   6   7   8   9   10   >