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

2020-04-15 Thread Scott Long
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

Modified:
  head/sys/i386/i386/machdep.c

Modified: head/sys/i386/i386/machdep.c
==
--- head/sys/i386/i386/machdep.cThu Apr 16 04:17:06 2020
(r360003)
+++ head/sys/i386/i386/machdep.cThu Apr 16 05:27:13 2020
(r360004)
@@ -1171,7 +1171,7 @@ exec_setregs(struct thread *td, struct image_params *i
regs->tf_cs = _ucodesel;
 
/* PS_STRINGS value for BSD/OS binaries.  It is 0 for non-BSD/OS. */
-   regs->tf_ebx = imgp->ps_strings;
+   regs->tf_ebx = (register_t)imgp->ps_strings;
 
 /*
  * Reset the hardware debug registers if they were in use.
___
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: r360003 - head/usr.sbin/mpsutil

2020-04-15 Thread Scott Long
Author: scottl
Date: Thu Apr 16 04:17:06 2020
New Revision: 360003
URL: https://svnweb.freebsd.org/changeset/base/360003

Log:
  Add support for some IOCFacts fields that are available with mpr (12Gb)
  controllers.  It's ugly due to the single codebase for mpr and mps and
  not being able to share their respective headers.

Modified:
  head/usr.sbin/mpsutil/mps_show.c

Modified: head/usr.sbin/mpsutil/mps_show.c
==
--- head/usr.sbin/mpsutil/mps_show.cThu Apr 16 03:33:46 2020
(r360002)
+++ head/usr.sbin/mpsutil/mps_show.cThu Apr 16 04:17:06 2020
(r360003)
@@ -201,6 +201,7 @@ static int
 show_iocfacts(int ac, char **av)
 {
MPI2_IOC_FACTS_REPLY *facts;
+   uint8_t *fb;
char tmpbuf[128];
int error, fd;
 
@@ -217,6 +218,8 @@ show_iocfacts(int ac, char **av)
return (errno);
}
 
+   fb = (uint8_t *)facts;
+
 #define IOCCAP "\3ScsiTaskFull" "\4DiagTrace" "\5SnapBuf" "\6ExtBuf" \
 "\7EEDP" "\10BiDirTarg" "\11Multicast" "\14TransRetry" "\15IR" \
 "\16EventReplay" "\17RaidAccel" "\20MSIXIndex" "\21HostDisc" \
@@ -250,6 +253,8 @@ show_iocfacts(int ac, char **av)
facts->FWVersion.Struct.Major, facts->FWVersion.Struct.Minor,
facts->FWVersion.Struct.Unit, facts->FWVersion.Struct.Dev);
printf(" IOCRequestFrameSize: %d\n", facts->IOCRequestFrameSize);
+   if (is_mps == 0)
+   printf(" MaxChainSegmentSize: %d\n", (uint16_t)(fb[0x26]));
printf("   MaxInitiators: %d\n", facts->MaxInitiators);
printf("  MaxTargets: %d\n", facts->MaxTargets);
printf(" MaxSasExpanders: %d\n", facts->MaxSasExpanders);
@@ -267,6 +272,8 @@ show_iocfacts(int ac, char **av)
printf("MaxDevHandle: %d\n", facts->MaxDevHandle);
printf("MaxPersistentEntries: %d\n", facts->MaxPersistentEntries);
printf("MinDevHandle: %d\n", facts->MinDevHandle);
+   if (is_mps == 0)
+   printf(" CurrentHostPageSize: %d\n", (uint8_t)(fb[0x3e]));
 
free(facts);
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: r360002 - head/usr.sbin/mpsutil

2020-04-15 Thread Scott Long
Author: scottl
Date: Thu Apr 16 03:33:46 2020
New Revision: 360002
URL: https://svnweb.freebsd.org/changeset/base/360002

Log:
  Don't keep a private copy of mpr_ioctl.h and mps_ioctl.h, since they
  easily get out of sync with the real files from the driver.

Deleted:
  head/usr.sbin/mpsutil/mpr_ioctl.h
  head/usr.sbin/mpsutil/mps_ioctl.h
Modified:
  head/usr.sbin/mpsutil/mps_cmd.c

Modified: head/usr.sbin/mpsutil/mps_cmd.c
==
--- head/usr.sbin/mpsutil/mps_cmd.c Thu Apr 16 03:28:28 2020
(r360001)
+++ head/usr.sbin/mpsutil/mps_cmd.c Thu Apr 16 03:33:46 2020
(r360002)
@@ -39,12 +39,6 @@ __RCSID("$FreeBSD$");
 #include 
 #include 
 #include 
-#if 0
-#include 
-#else
-#include "mps_ioctl.h"
-#include "mpr_ioctl.h"
-#endif
 #include 
 #include 
 
@@ -56,6 +50,8 @@ __RCSID("$FreeBSD$");
 #include 
 
 #include "mpsutil.h"
+#include 
+#include 
 
 #ifndef USE_MPT_IOCTLS
 #define USE_MPT_IOCTLS
___
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: r360001 - in head/sys/dev: mpr mps

2020-04-15 Thread Scott Long
Author: scottl
Date: Thu Apr 16 03:28:28 2020
New Revision: 360001
URL: https://svnweb.freebsd.org/changeset/base/360001

Log:
  Add a small hack to the ioctl header files so that both mpr and mps can
  be included.  This isn't a great solution, but fixing it correctly is a
  bigger task and this is the lesser of the existing evils.

Modified:
  head/sys/dev/mpr/mpr_ioctl.h
  head/sys/dev/mps/mps_ioctl.h

Modified: head/sys/dev/mpr/mpr_ioctl.h
==
--- head/sys/dev/mpr/mpr_ioctl.hThu Apr 16 03:23:19 2020
(r36)
+++ head/sys/dev/mpr/mpr_ioctl.hThu Apr 16 03:28:28 2020
(r360001)
@@ -363,6 +363,7 @@ typedef struct mpr_btdh_mapping
 #defineMPRIO_RAID_ACTION   _IOWR('M', 205, struct mpr_raid_action)
 #defineMPRIO_MPR_COMMAND   _IOWR('M', 210, struct mpr_usr_command)
 
+#ifndef MPTIOCTL
 #defineMPTIOCTL('I')
 #defineMPTIOCTL_GET_ADAPTER_DATA   _IOWR(MPTIOCTL, 1,\
 struct mpr_adapter_data)
@@ -385,5 +386,6 @@ typedef struct mpr_btdh_mapping
 struct mpr_reg_access)
 #defineMPTIOCTL_BTDH_MAPPING   _IOWR(MPTIOCTL, 11,\
 struct mpr_btdh_mapping)
+#endif /* MPTIOCTL */
 
 #endif /* !_MPR_IOCTL_H_ */

Modified: head/sys/dev/mps/mps_ioctl.h
==
--- head/sys/dev/mps/mps_ioctl.hThu Apr 16 03:23:19 2020
(r36)
+++ head/sys/dev/mps/mps_ioctl.hThu Apr 16 03:28:28 2020
(r360001)
@@ -364,6 +364,7 @@ typedef struct mps_btdh_mapping
 #defineMPSIO_RAID_ACTION   _IOWR('M', 205, struct mps_raid_action)
 #defineMPSIO_MPS_COMMAND   _IOWR('M', 210, struct mps_usr_command)
 
+#ifndef MPTIOCTL
 #defineMPTIOCTL('I')
 #defineMPTIOCTL_GET_ADAPTER_DATA   _IOWR(MPTIOCTL, 1,\
 struct mps_adapter_data)
@@ -386,5 +387,6 @@ typedef struct mps_btdh_mapping
 struct mps_reg_access)
 #defineMPTIOCTL_BTDH_MAPPING   _IOWR(MPTIOCTL, 11,\
 struct mps_btdh_mapping)
+#endif /* MPTIOCTL */
 
 #endif /* !_MPS_IOCTL_H_ */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r360000 - head/usr.sbin/mailwrapper

2020-04-15 Thread Xin LI
Author: delphij
Date: Thu Apr 16 03:23:19 2020
New Revision: 36
URL: https://svnweb.freebsd.org/changeset/base/36

Log:
  Sync with NetBSD/OpenBSD.

Modified:
  head/usr.sbin/mailwrapper/mailwrapper.8

Modified: head/usr.sbin/mailwrapper/mailwrapper.8
==
--- head/usr.sbin/mailwrapper/mailwrapper.8 Thu Apr 16 00:54:06 2020
(r35)
+++ head/usr.sbin/mailwrapper/mailwrapper.8 Thu Apr 16 03:23:19 2020
(r36)
@@ -1,5 +1,5 @@
-.\"$OpenBSD: mailwrapper.8,v 1.10 2009/02/07 16:58:23 martynas Exp $
-.\"$NetBSD: mailwrapper.8,v 1.11 2002/02/08 01:38:50 ross Exp $
+.\"$OpenBSD: mailwrapper.8,v 1.12 2014/03/27 22:34:42 jmc Exp $
+.\"$NetBSD: mailwrapper.8,v 1.16 2014/09/19 16:05:55 wiz Exp $
 .\" $FreeBSD$
 .\"
 .\" Copyright (c) 1998
@@ -31,42 +31,58 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd August 27, 2014
+.Dd October 29, 2014
 .Dt MAILWRAPPER 8
 .Os
 .Sh NAME
 .Nm mailwrapper
-.Nd invoke appropriate MTA software based on configuration file
+.Nd invoke appropriate
+.Tn MTA
+software based on configuration file
 .Sh SYNOPSIS
 Special.
 See below.
 .Sh DESCRIPTION
-At one time, the only Mail Transfer Agent (MTA) software easily available
-was
-.Xr sendmail 8 .
-As a result of this, most Mail User Agents (MUAs) such as
-.Xr mail 1
-had the path and calling conventions expected by
-.Xr sendmail 8
-compiled in.
+Once upon time, the only Mail Transfer Agent
+.Pq Tn MTA
+software easily available was
+.Dq sendmail .
+This famous
+.Tn MTA
+was written by
+.An Eric Allman
+and first appeared in
+.Bx 4.1 .
+The legacy of this
+.Tn MTA
+affected most Mail User Agents
+.Pq Tn MUAs
+such as
+.Xr mail 1 ;
+the path and calling conventions expected by
+.Dq sendmail
+were compiled in.
 .Pp
-Times have changed, however.
+But times changed.
 On a modern
-.Ux
-system, the administrator may wish to use one of several
-available MTAs.
+.Fx
+system, the administrator may wish to use one of several available
+.Tn MTAs .
 .Pp
-It would be difficult to modify all MUA software typically available
-on a system, so most of the authors of alternative MTAs have written
-their front end message submission programs so that they use the same
-calling conventions as
-.Xr sendmail 8
-and may be put into place instead of
-.Xr sendmail 8
-in
-.Pa /usr/sbin/sendmail .
+It would be difficult to modify all
+.Tn MUA
+software typically available on a system,
+so most of the authors of alternative
+.Tn MTAs
+have written their front end message submission programs
+that may appear in the place of
+.Pa /usr/sbin/sendmail ,
+but still follow the same calling conventions as
+.Dq sendmail .
 .Pp
-.Xr sendmail 8
+The
+.Dq sendmail
+.Tn MTA
 also typically has aliases named
 .Xr mailq 1
 and
@@ -79,45 +95,52 @@ is
 or
 .Dq newaliases
 and behaves appropriately.
-Typically, replacement MTAs provide similar
-functionality, either through a program that also switches behavior
-based on calling name, or through a set of programs that provide
-similar functionality.
+Typically, replacement
+.Tn MTAs
+provide similar functionality, either through a program that also
+switches behavior based on calling name, or through a set of programs
+that provide similar functionality.
 .Pp
-Although having drop-in replacements for
-.Xr sendmail 8
-helps in installing alternative MTAs, it essentially makes the
-configuration of the system depend on hand installing new programs in
+Although having replacement programs that plug replace
+.Dq sendmail
+helps in installing alternative
+.Tn MTAs ,
+it essentially makes the configuration of the system depend
+on hand installing new programs in
 .Pa /usr .
 This leads to configuration problems for many administrators, since
-they may wish to install a new MTA without altering the system
-provided
+they may wish to install a new
+.Tn MTA
+without altering the system provided
 .Pa /usr .
 (This may be, for example, to avoid having upgrade problems when a new
 version of the system is installed over the old.)
 They may also have a shared
 .Pa /usr
-among several
-machines, and may wish to avoid placing implicit configuration
-information in a read-only
+among several machines, and may wish to avoid placing
+implicit configuration information in a read-only
 .Pa /usr .
 .Pp
 The
 .Nm
-utility is designed to replace
+program is designed to replace
 .Pa /usr/sbin/sendmail
-and to invoke an appropriate MTA instead of
-.Xr sendmail 8
+and to invoke an appropriate
+.Tn MTA
 based on configuration information placed in
 .Pa ${LOCALBASE}/etc/mail/mailer.conf
 falling back on
 .Pa /etc/mail/mailer.conf .
-This permits the administrator to configure which MTA is to be invoked on
+This permits the administrator to configure which
+.Tn MTA
+is to be invoked on
 the system at run time.
 .Pp
 Other 

Re: svn commit: r359985 - stable/12/sys/dev/atkbdc

2020-04-15 Thread Warner Losh
On Wed, Apr 15, 2020, 6:51 PM Rodney W. Grimes 
wrote:

> [ Charset UTF-8 unsupported, converting... ]
> > Author: zeising (doc,ports committer)
> > Date: Wed Apr 15 19:47:19 2020
> > New Revision: 359985
> > URL: https://svnweb.freebsd.org/changeset/base/359985
> >
> > Log:
> >   MFC r348873: Enable touch and trackpads by default
> >
> >   Enable synaptics and elantech touchpads, as well as IBM/Lenovo
> TrackPoints
> >   by default, instead of having users find and toggle a loader tunable.
> >   This makes things like two finger scroll and other modern features
> work out
> >   of the box with X.  By enabling these settings by default, we get a
> better
> >   desktop experience in X, since xserver and evdev can make use of the
> more
> >   advanced synaptics and elantech features.
> >
> >   Approved by:imp
>
> RELNOTES: Y?
>

Yea. This is a release notes item.

Warner

>
> > Modified:
> >   stable/12/sys/dev/atkbdc/psm.c
> > Directory Properties:
> >   stable/12/   (props changed)
> >
> > Modified: stable/12/sys/dev/atkbdc/psm.c
> >
> ==
> > --- stable/12/sys/dev/atkbdc/psm.cWed Apr 15 19:33:42 2020
> (r359984)
> > +++ stable/12/sys/dev/atkbdc/psm.cWed Apr 15 19:47:19 2020
> (r359985)
> > @@ -513,9 +513,9 @@ static devclass_t psm_devclass;
> >  /* Tunables */
> >  static int tap_enabled = -1;
> >  static int verbose = PSM_DEBUG;
> > -static int synaptics_support = 0;
> > -static int trackpoint_support = 0;
> > -static int elantech_support = 0;
> > +static int synaptics_support = 1;
> > +static int trackpoint_support = 1;
> > +static int elantech_support = 1;
> >
> >  /* for backward compatibility */
> >  #define  OLD_MOUSE_GETHWINFO _IOR('M', 1, old_mousehw_t)
> >
>
> --
> Rod Grimes
> rgri...@freebsd.org
>
___
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: r359999 - in head: stand/defaults sys/kern

2020-04-15 Thread Kyle Evans
Author: kevans
Date: Thu Apr 16 00:54:06 2020
New Revision: 35
URL: https://svnweb.freebsd.org/changeset/base/35

Log:
  Preload hostuuid for early-boot use
  
  prison0's hostuuid will get set by the hostid rc script, either after
  generating it and saving it to /etc/hostid or by simply reading /etc/hostid.
  
  Some things (e.g. arbitrary MAC address generation) may use the hostuuid as
  a factor in early boot, so providing a way to read /etc/hostid (if it's
  available) and using it before userland starts up is desirable. The code is
  written such that the preload doesn't *have* to be /etc/hostid, thus not
  assuming that there will be newline at the end of the buffer or even the
  exact shape of the newline. White trailing whitespace/non-printables
  trimmed, the result will be validated as a valid uuid before it's used for
  early boot purposes.
  
  The preload can be turned off with hostuuid_load="NO" in /boot/loader.conf,
  just as other preloads; it's worth noting that this is a 37-byte file, the
  overhead is believed to be generally minimal.
  
  It doesn't seem necessary at this time to be concerned with kern.hostid.
  
  One does wonder if we should consider validating hostuuids coming in
  via jail_set(2); some bits seem to care about uuid form and we bother
  validating format of smbios-provided uuid and in-fact whatever uuid comes
  from /etc/hostid.
  
  Reviewed by:  karels, delphij, jamie
  MFC after:1 week (don't preload by default, probably)
  Differential Revision:https://reviews.freebsd.org/D24288

Modified:
  head/stand/defaults/loader.conf
  head/sys/kern/kern_jail.c

Modified: head/stand/defaults/loader.conf
==
--- head/stand/defaults/loader.conf Wed Apr 15 23:00:35 2020
(r359998)
+++ head/stand/defaults/loader.conf Thu Apr 16 00:54:06 2020
(r35)
@@ -33,6 +33,11 @@ bitmap_type="splash_image_data" # and place it on the 
 screensave_load="NO"   # Set to YES to load a screensaver module
 screensave_name="green_saver"  # Set to the name of the screensaver module
 
+###  Early hostid configuration 
+hostuuid_load="YES"
+hostuuid_name="/etc/hostid"
+hostuuid_type="hostuuid"
+
 ###  Random number generator configuration  ##
 # See rc.conf(5). The entropy_boot_file config variable must agree with the
 # settings below.

Modified: head/sys/kern/kern_jail.c
==
--- head/sys/kern/kern_jail.c   Wed Apr 15 23:00:35 2020(r359998)
+++ head/sys/kern/kern_jail.c   Thu Apr 16 00:54:06 2020(r35)
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -61,6 +62,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -75,6 +77,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #defineDEFAULT_HOSTUUID"----"
+#definePRISON0_HOSTUUID_MODULE "hostuuid"
 
 MALLOC_DEFINE(M_PRISON, "prison", "Prison structures");
 static MALLOC_DEFINE(M_PRISON_RACCT, "prison_racct", "Prison racct 
structures");
@@ -218,10 +221,38 @@ static unsigned jail_max_af_ips = 255;
 void
 prison0_init(void)
 {
+   uint8_t *file, *data;
+   size_t size;
 
prison0.pr_cpuset = cpuset_ref(thread0.td_cpuset);
prison0.pr_osreldate = osreldate;
strlcpy(prison0.pr_osrelease, osrelease, sizeof(prison0.pr_osrelease));
+
+   /* If we have a preloaded hostuuid, use it. */
+   file = preload_search_by_type(PRISON0_HOSTUUID_MODULE);
+   if (file != NULL) {
+   data = preload_fetch_addr(file);
+   size = preload_fetch_size(file);
+   if (data != NULL) {
+   /*
+* The preloaded data may include trailing whitespace, 
almost
+* certainly a newline; skip over any whitespace or
+* non-printable characters to be safe.
+*/
+   while (size > 0 && data[size - 1] <= 0x20) {
+   data[size--] = '\0';
+   }
+   if (validate_uuid(data, size, NULL, 0) == 0) {
+   (void)strlcpy(prison0.pr_hostuuid, data,
+   size + 1);
+   } else if (bootverbose) {
+   printf("hostuuid: preload data malformed: '%s'",
+   data);
+   }
+   }
+   }
+   if (bootverbose)
+   printf("hostuuid: using %s\n", prison0.pr_hostuuid);
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any 

Re: svn commit: r359985 - stable/12/sys/dev/atkbdc

2020-04-15 Thread Rodney W. Grimes
[ Charset UTF-8 unsupported, converting... ]
> Author: zeising (doc,ports committer)
> Date: Wed Apr 15 19:47:19 2020
> New Revision: 359985
> URL: https://svnweb.freebsd.org/changeset/base/359985
> 
> Log:
>   MFC r348873: Enable touch and trackpads by default
>   
>   Enable synaptics and elantech touchpads, as well as IBM/Lenovo TrackPoints
>   by default, instead of having users find and toggle a loader tunable.
>   This makes things like two finger scroll and other modern features work out
>   of the box with X.  By enabling these settings by default, we get a better
>   desktop experience in X, since xserver and evdev can make use of the more
>   advanced synaptics and elantech features.
>   
>   Approved by:imp

RELNOTES: Y?

> Modified:
>   stable/12/sys/dev/atkbdc/psm.c
> Directory Properties:
>   stable/12/   (props changed)
> 
> Modified: stable/12/sys/dev/atkbdc/psm.c
> ==
> --- stable/12/sys/dev/atkbdc/psm.cWed Apr 15 19:33:42 2020
> (r359984)
> +++ stable/12/sys/dev/atkbdc/psm.cWed Apr 15 19:47:19 2020
> (r359985)
> @@ -513,9 +513,9 @@ static devclass_t psm_devclass;
>  /* Tunables */
>  static int tap_enabled = -1;
>  static int verbose = PSM_DEBUG;
> -static int synaptics_support = 0;
> -static int trackpoint_support = 0;
> -static int elantech_support = 0;
> +static int synaptics_support = 1;
> +static int trackpoint_support = 1;
> +static int elantech_support = 1;
>  
>  /* for backward compatibility */
>  #define  OLD_MOUSE_GETHWINFO _IOR('M', 1, old_mousehw_t)
> 

-- 
Rod Grimes rgri...@freebsd.org
___
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: r359987 - in head/sys: amd64/ia32 amd64/linux32 compat/freebsd32 kern sys

2020-04-15 Thread Kyle Evans
On Wed, Apr 15, 2020 at 3:21 PM Brooks Davis  wrote:
>
> Author: brooks
> Date: Wed Apr 15 20:21:30 2020
> New Revision: 359987
> URL: https://svnweb.freebsd.org/changeset/base/359987
>
> Log:
>   Make ps_strings in struct image_params into a pointer.
>
>   This is a prepratory commit for D24407.
>
>   Reviewed by:  kib
>   Obtained from:CheriBSD
>   Sponsored by: DARPA
>

This seems to have missed just one spot over in i386 machdep bits
(reported by CI, masked by earlier-in-the-build breakage):

18:28:51 /usr/src/sys/i386/i386/machdep.c:1174:15: error: incompatible
pointer to integer conversion assigning to 'int' from 'void *'
[-Werror,-Wint-conversion]
18:28:51 regs->tf_ebx = imgp->ps_strings;
18:28:51  ^ 

Thanks,

Kyle Evans
___
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: r359997 - head/sys/x86/x86

2020-04-15 Thread Konstantin Belousov
Author: kib
Date: Wed Apr 15 22:28:51 2020
New Revision: 359997
URL: https://svnweb.freebsd.org/changeset/base/359997

Log:
  Improve TSC calibration logic.
  
  Stop attempting to use FADT legacy hardware flag, it is almost always
  a lie.
  
  Instead, unless user explicitly disabled the calibration, calibrate
  against 8254 ISA clock.  Then, obtain the rough value of the expected
  TSC frequency from CPUID leafs 0x15/0x16 or even from the CPU
  marketing name string.  If calibration results look unbelievably bogus
  comparing with CPUID leafs report, use CPUID one.
  
  Intel does not recommend to use CPUID leaf 0x16 for the value of the
  system time frequency, indeed the error there might be up to 1% which
  e.g. makes ntpd give up.  If ISA clock is present, we win, if not, we
  get some frequency that allows the machine to boot without enormous
  delay.
  
  Next improvement would be to use HPET for re-calibration if we decided
  that ISA clock gives bogus results, after HPETs are enumerated. This
  is a much bigger change since we probably would need to re-evaluate
  some constants depending on TSC frequency.
  
  Reviewed by:  emaste, jhb, scottl
  Tested by:scottl
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks
  Differential revision:https://reviews.freebsd.org/D24426

Modified:
  head/sys/x86/x86/tsc.c

Modified: head/sys/x86/x86/tsc.c
==
--- head/sys/x86/x86/tsc.c  Wed Apr 15 22:27:24 2020(r359996)
+++ head/sys/x86/x86/tsc.c  Wed Apr 15 22:28:51 2020(r359997)
@@ -83,8 +83,8 @@ SYSCTL_INT(_machdep, OID_AUTO, disable_tsc, CTLFLAG_RD
 "Disable x86 Time Stamp Counter");
 
 static int tsc_skip_calibration;
-SYSCTL_INT(_machdep, OID_AUTO, disable_tsc_calibration, CTLFLAG_RDTUN |
-CTLFLAG_NOFETCH, _skip_calibration, 0,
+SYSCTL_INT(_machdep, OID_AUTO, disable_tsc_calibration, CTLFLAG_RDTUN,
+_skip_calibration, 0,
 "Disable TSC frequency calibration");
 
 static void tsc_freq_changed(void *arg, const struct cf_level *level,
@@ -230,7 +230,6 @@ probe_tsc_freq(void)
 {
uint64_t tmp_freq, tsc1, tsc2;
int no_cpuid_override;
-   uint16_t bootflags;
 
if (cpu_power_ecx & CPUID_PERF_STAT) {
/*
@@ -287,30 +286,13 @@ probe_tsc_freq(void)
break;
}
 
-   if (!TUNABLE_INT_FETCH("machdep.disable_tsc_calibration",
-   _skip_calibration)) {
-   /*
-* User did not give the order about calibration.
-* If he did, we do not try to guess.
-*
-* Otherwise, if ACPI FADT reports that the platform
-* is legacy-free and CPUID provides TSC frequency,
-* use it.  The calibration could fail anyway since
-* ISA timer can be absent or power gated.
-*/
-   if (acpi_get_fadt_bootflags() &&
-   (bootflags & ACPI_FADT_LEGACY_DEVICES) == 0 &&
-   tsc_freq_cpuid(_freq)) {
-   printf("Skipping TSC calibration since no legacy "
-   "devices reported by FADT and CPUID works\n");
-   tsc_skip_calibration = 1;
-   }
-   }
if (tsc_skip_calibration) {
if (tsc_freq_cpuid(_freq))
tsc_freq = tmp_freq;
else if (cpu_vendor_id == CPU_VENDOR_INTEL)
tsc_freq_intel();
+   if (tsc_freq == 0)
+   tsc_disabled = 1;
} else {
if (bootverbose)
printf("Calibrating TSC clock ... ");
@@ -324,8 +306,9 @@ probe_tsc_freq(void)
 * the frequency reported by CPUID 0x15/0x16 leafs
 * differ significantly, this probably means that
 * calibration is bogus.  It happens on machines
-* without 8254 timer and with BIOS not properly
-* reporting it in FADT boot flags.
+* without 8254 timer.  The BIOS rarely properly
+* reports it in FADT boot flags, so just compare the
+* frequencies directly.
 */
if (tsc_freq_cpuid(_freq) && qabs(tsc_freq - tmp_freq) >
uqmin(tsc_freq, tmp_freq)) {
___
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: r359995 - in head/sys/fs: nfsclient nfsserver

2020-04-15 Thread Rick Macklem
Author: rmacklem
Date: Wed Apr 15 21:27:52 2020
New Revision: 359995
URL: https://svnweb.freebsd.org/changeset/base/359995

Log:
  Fix the NFSv4.2 extended attribute support for remove extended attrbute.
  
  I missed the "atomic" field of the RemoveExtendedAttribute operation's
  reply when I implemented it. It worked between FreeBSD client and server,
  since it was missed for both, but it did not conform to RFC 8276.
  This patch adds the field for both client and server.
  
  Thanks go to Frank for doing interoperability testing of the extended
  attribute support against patches for Linux.
  
  Submitted by: Frank van der Linden 
  Reported by:  Frank van der Linden 

Modified:
  head/sys/fs/nfsclient/nfs_clrpcops.c
  head/sys/fs/nfsserver/nfs_nfsdserv.c

Modified: head/sys/fs/nfsclient/nfs_clrpcops.c
==
--- head/sys/fs/nfsclient/nfs_clrpcops.cWed Apr 15 21:06:38 2020
(r359994)
+++ head/sys/fs/nfsclient/nfs_clrpcops.cWed Apr 15 21:27:52 2020
(r359995)
@@ -8432,7 +8432,7 @@ nfsrpc_rmextattr(vnode_t vp, const char *name, struct 
return (error);
if (nd->nd_repstat == 0) {
/* Just skip over the reply and Getattr op status. */
-   NFSM_DISSECT(tl, uint32_t *, 2 * NFSX_HYPER + 2 *
+   NFSM_DISSECT(tl, uint32_t *, 2 * NFSX_HYPER + 3 *
NFSX_UNSIGNED);
error = nfsm_loadattr(nd, nap);
if (error == 0)

Modified: head/sys/fs/nfsserver/nfs_nfsdserv.c
==
--- head/sys/fs/nfsserver/nfs_nfsdserv.cWed Apr 15 21:06:38 2020
(r359994)
+++ head/sys/fs/nfsserver/nfs_nfsdserv.cWed Apr 15 21:27:52 2020
(r359995)
@@ -5729,7 +5729,8 @@ nfsrvd_rmxattr(struct nfsrv_descript *nd, __unused int
if (nd->nd_repstat == 0)
nd->nd_repstat = nfsvno_getattr(vp, , nd, p, 1, );
if (nd->nd_repstat == 0) {
-   NFSM_BUILD(tl, uint32_t *, 2 * NFSX_HYPER);
+   NFSM_BUILD(tl, uint32_t *, 2 * NFSX_HYPER + NFSX_UNSIGNED);
+   *tl++ = newnfs_true;
txdr_hyper(ova.na_filerev, tl); tl += 2;
txdr_hyper(nva.na_filerev, tl);
}
___
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: r359981 - head/contrib/llvm-project/llvm/lib/Target/PowerPC

2020-04-15 Thread Dimitry Andric
On 15 Apr 2020, at 21:10, Cy Schubert  wrote:
> 
> In message <202004151843.03fihi1w031...@repo.freebsd.org>, Dimitry Andric
> writes:
>> Author: dim
>> Date: Wed Apr 15 18:43:44 2020
>> New Revision: 359981
>> URL: https://svnweb.freebsd.org/changeset/base/359981
>> 
>> Log:
>>  Revert commit a9ad65a2b from llvm git (by Nemanja Ivanovic):
...
> 
> I'm seeing this on amd64:
> 
> --- Target/PowerPC/PPCSubtarget.o ---
> /opt/src/svn-current/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCSubtarget.cpp:103:3:
>  error: use of undeclared identifier 'AllowsUnalignedFPAccess'
>  AllowsUnalignedFPAccess = false;
>  ^

Yeah sorry, this should be fixed by r359994. Upstream did a follow-up
commit adding exactly that line, which I've also reverted.

-Dimitry



signature.asc
Description: Message signed with OpenPGP


svn commit: r359994 - head/contrib/llvm-project/llvm/lib/Target/PowerPC

2020-04-15 Thread Dimitry Andric
Author: dim
Date: Wed Apr 15 21:06:38 2020
New Revision: 359994
URL: https://svnweb.freebsd.org/changeset/base/359994

Log:
  Revert commit b6cf400aa fro llvm git (by Nemanja Ivanovic):
  
Fix bots after a9ad65a2b34f
  
In the last commit, I neglected to initialize the new subtarget
feature I added which caused failures on a few bots. This should fix
that.
  
  This unbreaks the build after r359981, which reverted upstream commit
  a9ad65a2b34f.
  
  Reported by:  jhibbits (and jenkins :)
  MFC after:6 weeks
  X-MFC-With:   358851

Modified:
  head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCSubtarget.cpp

Modified: head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCSubtarget.cpp
==
--- head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCSubtarget.cpp  Wed Apr 
15 21:05:38 2020(r359993)
+++ head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCSubtarget.cpp  Wed Apr 
15 21:06:38 2020(r359994)
@@ -100,7 +100,6 @@ void PPCSubtarget::initializeEnvironment() {
   IsPPC6xx = false;
   IsE500 = false;
   FeatureMFTB = false;
-  AllowsUnalignedFPAccess = false;
   DeprecatedDST = false;
   HasLazyResolverStubs = false;
   HasICBT = false;
___
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: r359993 - head/sys/crypto/via

2020-04-15 Thread John Baldwin
Author: jhb
Date: Wed Apr 15 21:05:38 2020
New Revision: 359993
URL: https://svnweb.freebsd.org/changeset/base/359993

Log:
  Use crypto_contiguous_subsegment().
  
  This driver used a home-rolled version that predated the function and
  didn't support mbufs.

Modified:
  head/sys/crypto/via/padlock_cipher.c

Modified: head/sys/crypto/via/padlock_cipher.c
==
--- head/sys/crypto/via/padlock_cipher.cWed Apr 15 20:33:09 2020
(r359992)
+++ head/sys/crypto/via/padlock_cipher.cWed Apr 15 21:05:38 2020
(r359993)
@@ -169,27 +169,9 @@ padlock_cipher_alloc(struct cryptop *crp, int *allocat
 {
u_char *addr;
 
-   switch (crp->crp_buf_type) {
-   case CRYPTO_BUF_MBUF:
-   break;
-   case CRYPTO_BUF_UIO: {
-   struct uio *uio;
-   struct iovec *iov;
-
-   uio = crp->crp_uio;
-   if (uio->uio_iovcnt != 1)
-   break;
-   iov = uio->uio_iov;
-   addr = (u_char *)iov->iov_base + crp->crp_payload_start;
-   if (((uintptr_t)addr & 0xf) != 0) /* 16 bytes aligned? */
-   break;
-   *allocated = 0;
-   return (addr);
-   }
-   case CRYPTO_BUF_CONTIG:
-   addr = (u_char *)crp->crp_buf + crp->crp_payload_start;
-   if (((uintptr_t)addr & 0xf) != 0) /* 16 bytes aligned? */
-   break;
+   addr = crypto_contiguous_subsegment(crp, crp->crp_payload_start,
+   crp->crp_payload_length);
+   if (((uintptr_t)addr & 0xf) == 0) { /* 16 bytes aligned? */
*allocated = 0;
return (addr);
}
___
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: r359992 - head/sys/powerpc/aim

2020-04-15 Thread Alfredo Dal'Ava Junior
Author: alfredo
Date: Wed Apr 15 20:33:09 2020
New Revision: 359992
URL: https://svnweb.freebsd.org/changeset/base/359992

Log:
  powerpc: autosize bpvo based on physical memory
  
  Default moea64_bpvo_pool_size 327680 was insufficient for initial
  memory mapping at boot time on systems with, for example, 64G and
  no huge pages enabled.
  
  Submitted by: Andre Silva 
  Reviewed by:  jhibbits, alfredo
  Approved by:  jhibbits (mentor)
  Sponsored by: Eldorado Research Institute (eldorado.org.br)
  Differential Revision:https://reviews.freebsd.org/D24102

Modified:
  head/sys/powerpc/aim/mmu_oea64.c

Modified: head/sys/powerpc/aim/mmu_oea64.c
==
--- head/sys/powerpc/aim/mmu_oea64.cWed Apr 15 20:28:20 2020
(r359991)
+++ head/sys/powerpc/aim/mmu_oea64.cWed Apr 15 20:33:09 2020
(r359992)
@@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -184,10 +185,12 @@ uma_zone_tmoea64_pvo_zone; /* zone for pvo 
entries */
 
 static struct  pvo_entry *moea64_bpvo_pool;
 static int moea64_bpvo_pool_index = 0;
-static int moea64_bpvo_pool_size = 327680;
+static int moea64_bpvo_pool_size = 0;
 SYSCTL_INT(_machdep, OID_AUTO, moea64_allocated_bpvo_entries, CTLFLAG_RD, 
 _bpvo_pool_index, 0, "");
 
+#defineBPVO_POOL_SIZE  327680 /* Sensible historical default value */
+#defineBPVO_POOL_EXPANSION_FACTOR  3
 #defineVSID_NBPW   (sizeof(u_int32_t) * 8)
 #ifdef __powerpc64__
 #defineNVSIDS  (NPMAPS * 16)
@@ -916,6 +919,20 @@ moea64_mid_bootstrap(mmu_t mmup, vm_offset_t kernelsta
 * Initialise the bootstrap pvo pool.
 */
TUNABLE_INT_FETCH("machdep.moea64_bpvo_pool_size", 
_bpvo_pool_size);
+   if (moea64_bpvo_pool_size == 0) {
+   if (!hw_direct_map)
+   moea64_bpvo_pool_size = ((ptoa((uintmax_t)physmem) * 
sizeof(struct vm_page)) /
+   (PAGE_SIZE * PAGE_SIZE)) * 
BPVO_POOL_EXPANSION_FACTOR;
+   else
+   moea64_bpvo_pool_size = BPVO_POOL_SIZE;
+   }
+
+   if (boothowto & RB_VERBOSE) {
+   printf("mmu_oea64: bpvo pool entries = %d, bpvo pool size = %ju 
MB\n",
+   moea64_bpvo_pool_size,
+   moea64_bpvo_pool_size*sizeof(struct pvo_entry) / 1048576);
+   }
+
moea64_bpvo_pool = (struct pvo_entry *)moea64_bootstrap_alloc(
moea64_bpvo_pool_size*sizeof(struct pvo_entry), PAGE_SIZE);
moea64_bpvo_pool_index = 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: 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 

svn commit: r359987 - in head/sys: amd64/ia32 amd64/linux32 compat/freebsd32 kern sys

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

Log:
  Make ps_strings in struct image_params into a pointer.
  
  This is a prepratory commit for D24407.
  
  Reviewed by:  kib
  Obtained from:CheriBSD
  Sponsored by: DARPA

Modified:
  head/sys/amd64/ia32/ia32_signal.c
  head/sys/amd64/linux32/linux32_sysvec.c
  head/sys/compat/freebsd32/freebsd32_misc.c
  head/sys/kern/imgact_aout.c
  head/sys/kern/kern_exec.c
  head/sys/sys/imgact.h

Modified: head/sys/amd64/ia32/ia32_signal.c
==
--- head/sys/amd64/ia32/ia32_signal.c   Wed Apr 15 20:19:59 2020
(r359986)
+++ head/sys/amd64/ia32/ia32_signal.c   Wed Apr 15 20:21:30 2020
(r359987)
@@ -961,7 +961,7 @@ ia32_setregs(struct thread *td, struct image_params *i
regs->tf_rflags = PSL_USER | saved_rflags;
regs->tf_ss = _udatasel;
regs->tf_cs = _ucode32sel;
-   regs->tf_rbx = imgp->ps_strings;
+   regs->tf_rbx = (register_t)imgp->ps_strings;
regs->tf_ds = _udatasel;
regs->tf_es = _udatasel;
regs->tf_fs = _ufssel;

Modified: head/sys/amd64/linux32/linux32_sysvec.c
==
--- head/sys/amd64/linux32/linux32_sysvec.c Wed Apr 15 20:19:59 2020
(r359986)
+++ head/sys/amd64/linux32/linux32_sysvec.c Wed Apr 15 20:21:30 2020
(r359987)
@@ -708,7 +708,7 @@ linux_exec_setregs(struct thread *td, struct image_par
regs->tf_ss = _udatasel;
regs->tf_flags = TF_HASSEGS;
regs->tf_cs = _ucode32sel;
-   regs->tf_rbx = imgp->ps_strings;
+   regs->tf_rbx = (register_t)imgp->ps_strings;
 
fpstate_drop(td);
 

Modified: head/sys/compat/freebsd32/freebsd32_misc.c
==
--- head/sys/compat/freebsd32/freebsd32_misc.c  Wed Apr 15 20:19:59 2020
(r359986)
+++ head/sys/compat/freebsd32/freebsd32_misc.c  Wed Apr 15 20:21:30 2020
(r359987)
@@ -3137,6 +3137,7 @@ freebsd32_copyout_strings(struct image_params *imgp, u
execpath_len = 0;
arginfo = (struct freebsd32_ps_strings *)curproc->p_sysent->
sv_psstrings;
+   imgp->ps_strings = arginfo;
if (imgp->proc->p_sysent->sv_sigcode_base == 0)
szsigcode = *(imgp->proc->p_sysent->sv_szsigcode);
else

Modified: head/sys/kern/imgact_aout.c
==
--- head/sys/kern/imgact_aout.c Wed Apr 15 20:19:59 2020(r359986)
+++ head/sys/kern/imgact_aout.c Wed Apr 15 20:21:30 2020(r359987)
@@ -200,7 +200,7 @@ exec_aout_imgact(struct image_params *imgp)
file_offset = 0;
/* Pass PS_STRINGS for BSD/OS binaries only. */
if (N_GETMID(*a_out) == MID_ZERO)
-   imgp->ps_strings = aout_sysvec.sv_psstrings;
+   imgp->ps_strings = (void *)aout_sysvec.sv_psstrings;
break;
default:
/* NetBSD compatibility */

Modified: head/sys/kern/kern_exec.c
==
--- head/sys/kern/kern_exec.c   Wed Apr 15 20:19:59 2020(r359986)
+++ head/sys/kern/kern_exec.c   Wed Apr 15 20:21:30 2020(r359987)
@@ -1546,6 +1546,7 @@ exec_copyout_strings(struct image_params *imgp, uintpt
p = imgp->proc;
szsigcode = 0;
arginfo = (struct ps_strings *)p->p_sysent->sv_psstrings;
+   imgp->ps_strings = arginfo;
if (p->p_sysent->sv_sigcode_base == 0) {
if (p->p_sysent->sv_szsigcode != NULL)
szsigcode = *(p->p_sysent->sv_szsigcode);

Modified: head/sys/sys/imgact.h
==
--- head/sys/sys/imgact.h   Wed Apr 15 20:19:59 2020(r359986)
+++ head/sys/sys/imgact.h   Wed Apr 15 20:21:30 2020(r359987)
@@ -75,7 +75,7 @@ struct image_params {
char *interpreter_name; /* name of the interpreter */
void *auxargs;  /* ELF Auxinfo structure pointer */
struct sf_buf *firstpage;   /* first page that we mapped */
-   unsigned long ps_strings; /* PS_STRINGS for BSD/OS binaries */
+   void *ps_strings;   /* pointer to ps_string (user space) */
struct image_args *args;/* system call arguments */
struct sysentvec *sysent;   /* system entry vector */
char *execpath;
___
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: r359986 - head/sys/sys

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

Log:
  Introduce an AUXARGS_ENTRY_PTR() macro.
  
  As the name implys, it uses the a_ptr member of the auxarg entry (except
  in compat32 where it uses a_val).  This is more correct and required for
  systems where a_val is not the same size or hardware type as a_ptr (e.g.
  CHERI).
  
  This is a prepratory commit for D24407.
  
  Reviewed by:  kib
  Obtained from:CheriBSD
  Sponsored by: DARPA

Modified:
  head/sys/sys/imgact_elf.h

Modified: head/sys/sys/imgact_elf.h
==
--- head/sys/sys/imgact_elf.h   Wed Apr 15 19:47:19 2020(r359985)
+++ head/sys/sys/imgact_elf.h   Wed Apr 15 20:19:59 2020(r359986)
@@ -39,6 +39,13 @@
 
 #defineAUXARGS_ENTRY(pos, id, val) \
 {(pos)->a_type = (id); (pos)->a_un.a_val = (val); (pos)++;}
+#if (defined(__LP64__) && __ELF_WORD_SIZE == 32)
+#defineAUXARGS_ENTRY_PTR(pos, id, ptr) \
+{(pos)->a_type = (id); (pos)->a_un.a_val = (uintptr_t)(ptr); (pos)++;}
+#else
+#defineAUXARGS_ENTRY_PTR(pos, id, ptr) \
+{(pos)->a_type = (id); (pos)->a_un.a_ptr = (ptr); (pos)++;}
+#endif
 
 struct image_params;
 struct thread;
___
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: r359985 - stable/12/sys/dev/atkbdc

2020-04-15 Thread Niclas Zeising
Author: zeising (doc,ports committer)
Date: Wed Apr 15 19:47:19 2020
New Revision: 359985
URL: https://svnweb.freebsd.org/changeset/base/359985

Log:
  MFC r348873: Enable touch and trackpads by default
  
  Enable synaptics and elantech touchpads, as well as IBM/Lenovo TrackPoints
  by default, instead of having users find and toggle a loader tunable.
  This makes things like two finger scroll and other modern features work out
  of the box with X.  By enabling these settings by default, we get a better
  desktop experience in X, since xserver and evdev can make use of the more
  advanced synaptics and elantech features.
  
  Approved by:  imp

Modified:
  stable/12/sys/dev/atkbdc/psm.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/atkbdc/psm.c
==
--- stable/12/sys/dev/atkbdc/psm.c  Wed Apr 15 19:33:42 2020
(r359984)
+++ stable/12/sys/dev/atkbdc/psm.c  Wed Apr 15 19:47:19 2020
(r359985)
@@ -513,9 +513,9 @@ static devclass_t psm_devclass;
 /* Tunables */
 static int tap_enabled = -1;
 static int verbose = PSM_DEBUG;
-static int synaptics_support = 0;
-static int trackpoint_support = 0;
-static int elantech_support = 0;
+static int synaptics_support = 1;
+static int trackpoint_support = 1;
+static int elantech_support = 1;
 
 /* for backward compatibility */
 #defineOLD_MOUSE_GETHWINFO _IOR('M', 1, old_mousehw_t)
___
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: r359984 - head

2020-04-15 Thread John Baldwin
Author: jhb
Date: Wed Apr 15 19:33:42 2020
New Revision: 359984
URL: https://svnweb.freebsd.org/changeset/base/359984

Log:
  Document removal of deprecated algorithms from geli(4).

Modified:
  head/RELNOTES

Modified: head/RELNOTES
==
--- head/RELNOTES   Wed Apr 15 19:28:51 2020(r359983)
+++ head/RELNOTES   Wed Apr 15 19:33:42 2020(r359984)
@@ -10,6 +10,10 @@ newline.  Entries should be separated by a newline.
 
 Changes to this file should not be MFCed.
 
+r359945:
+   Remove support for Triple DES, Blowfish, and MD5 HMAC from
+   geli(4).
+
 r359786-r359787:
Remove support for DES, Triple DES, and RC4 from in-kernel GSS
authentication.
___
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: r359983 - head/sys/dev/cxgbe/tom

2020-04-15 Thread John Baldwin
Author: jhb
Date: Wed Apr 15 19:28:51 2020
New Revision: 359983
URL: https://svnweb.freebsd.org/changeset/base/359983

Log:
  Set inp_flowid's for TOE connections.
  
  KTLS uses the flowid to distribute software encryption tasks among its
  pool of worker threads.  Without this change, all software KTLS
  requests for TOE sockets ended up on the first worker thread.
  
  Note that the flowid for TOE sockets created via connect() is not a
  hash of the 4-tuple, but is instead the id of the TOE pcb (tid).  The
  flowid of TOE sockets created from TOE listen sockets do use the
  4-tuple RSS hash as the flowid since the firmware provides the hash in
  the message containing the original SYN.
  
  Reviewed by:  np (earlier version)
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D24348

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

Modified: head/sys/dev/cxgbe/tom/t4_connect.c
==
--- head/sys/dev/cxgbe/tom/t4_connect.c Wed Apr 15 19:23:53 2020
(r359982)
+++ head/sys/dev/cxgbe/tom/t4_connect.c Wed Apr 15 19:28:51 2020
(r359983)
@@ -101,6 +101,8 @@ do_act_establish(struct sge_iq *iq, const struct rss_h
 
make_established(toep, be32toh(cpl->snd_isn) - 1,
be32toh(cpl->rcv_isn) - 1, cpl->tcp_opt);
+   inp->inp_flowtype = M_HASHTYPE_OPAQUE;
+   inp->inp_flowid = tid;
 
if (ulp_mode(toep) == ULP_MODE_TLS)
tls_establish(toep);

Modified: head/sys/dev/cxgbe/tom/t4_listen.c
==
--- head/sys/dev/cxgbe/tom/t4_listen.c  Wed Apr 15 19:23:53 2020
(r359982)
+++ head/sys/dev/cxgbe/tom/t4_listen.c  Wed Apr 15 19:28:51 2020
(r359983)
@@ -946,9 +946,7 @@ t4_offload_socket(struct toedev *tod, void *arg, struc
 {
struct adapter *sc = tod->tod_softc;
struct synq_entry *synqe = arg;
-#ifdef INVARIANTS
struct inpcb *inp = sotoinpcb(so);
-#endif
struct toepcb *toep = synqe->toep;
 
NET_EPOCH_ASSERT(); /* prevents bad race with accept() */
@@ -962,6 +960,9 @@ t4_offload_socket(struct toedev *tod, void *arg, struc
toep->flags |= TPF_CPL_PENDING;
update_tid(sc, synqe->tid, toep);
synqe->flags |= TPF_SYNQE_EXPANDED;
+   inp->inp_flowtype = (inp->inp_vflag & INP_IPV6) ?
+   M_HASHTYPE_RSS_TCP_IPV6 : M_HASHTYPE_RSS_TCP_IPV4;
+   inp->inp_flowid = synqe->rss_hash;
 }
 
 static void
@@ -1299,6 +1300,8 @@ found:
NET_EPOCH_EXIT(et);
REJECT_PASS_ACCEPT_REQ(true);
}
+   MPASS(rss->hash_type == RSS_HASH_TCP);
+   synqe->rss_hash = be32toh(rss->hash_val);
atomic_store_int(>ok_to_respond, 0);
 
init_conn_params(vi, , , so, >tcpopt, e->idx,

Modified: head/sys/dev/cxgbe/tom/t4_tom.h
==
--- head/sys/dev/cxgbe/tom/t4_tom.h Wed Apr 15 19:23:53 2020
(r359982)
+++ head/sys/dev/cxgbe/tom/t4_tom.h Wed Apr 15 19:28:51 2020
(r359983)
@@ -242,6 +242,7 @@ struct synq_entry {
uint32_t iss;
uint32_t irs;
uint32_t ts;
+   uint32_t rss_hash;
__be16 tcp_opt; /* from cpl_pass_establish */
struct toepcb *toep;
 
___
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: r359982 - head/sys/dev/cxgbe/tom

2020-04-15 Thread John Baldwin
Author: jhb
Date: Wed Apr 15 19:23:53 2020
New Revision: 359982
URL: https://svnweb.freebsd.org/changeset/base/359982

Log:
  Clear CPL_GET_TCB_RPL handler on module unload.
  
  This fixes a panic when unloading and reloading t4_tom.ko since the
  old pointer is still stored when t4_tom_load tries to set it.
  
  Reviewed by:  np
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D24358

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

Modified: head/sys/dev/cxgbe/tom/t4_tom.c
==
--- head/sys/dev/cxgbe/tom/t4_tom.c Wed Apr 15 18:43:44 2020
(r359981)
+++ head/sys/dev/cxgbe/tom/t4_tom.c Wed Apr 15 19:23:53 2020
(r359982)
@@ -1895,6 +1895,7 @@ t4_tom_mod_unload(void)
t4_uninit_listen_cpl_handlers();
t4_uninit_cpl_io_handlers();
t4_register_shared_cpl_handler(CPL_L2T_WRITE_RPL, NULL, CPL_COOKIE_TOM);
+   t4_register_cpl_handler(CPL_GET_TCB_RPL, NULL);
 
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"


Re: svn commit: r359981 - head/contrib/llvm-project/llvm/lib/Target/PowerPC

2020-04-15 Thread Cy Schubert
In message <202004151843.03fihi1w031...@repo.freebsd.org>, Dimitry Andric 
write
s:
> Author: dim
> Date: Wed Apr 15 18:43:44 2020
> New Revision: 359981
> URL: https://svnweb.freebsd.org/changeset/base/359981
>
> Log:
>   Revert commit a9ad65a2b from llvm git (by Nemanja Ivanovic):
>   
> [PowerPC] Change default for unaligned FP access for older subtargets
>   
> This is a fix for https://bugs.llvm.org/show_bug.cgi?id=40554
>   
> Some CPU's trap to the kernel on unaligned floating point access and
> there are kernels that do not handle the interrupt. The program then
> fails with a SIGBUS according to the PR. This just switches the
> default for unaligned access to only allow it on recent server CPUs
> that are known to allow this.
>   
> Differential revision: https://reviews.llvm.org/D71954
>   
>   This upstream commit causes a compiler hang when building certain ports
>   (e.g. security/nss, multimedia/x264) for powerpc64.  The hang has been
>   reported in https://bugs.llvm.org/show_bug.cgi?id=45186, but in the mean
>   time it is more convenient to revert the commit.
>   
>   Requested by:   jhibbits
>   MFC after:  6 weeks
>   X-MFC-With: 358851
>
> Modified:
>   head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPC.td
>   head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
>   head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCSubtarget.h
>
> Modified: head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPC.td
> =
> =
> --- head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPC.td  Wed Apr 15 18:3
> 9:12 2020 (r359980)
> +++ head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPC.td  Wed Apr 15 18:4
> 3:44 2020 (r359981)
> @@ -166,9 +166,6 @@ def FeatureHTM : SubtargetFeature<"htm", "HasHTM", "tr
>"Enable Hardware Transactional Memory inst
> ructions">;
>  def FeatureMFTB   : SubtargetFeature<"", "FeatureMFTB", "true",
>  "Implement mftb using the mfspr inst
> ruction">;
> -def FeatureUnalignedFloats :
> -  SubtargetFeature<"allow-unaligned-fp-access", "AllowsUnalignedFPAccess",
> -   "true", "CPU does not trap on unaligned FP access">;
>  def FeaturePPCPreRASched:
>SubtargetFeature<"ppc-prera-sched", "UsePPCPreRASchedStrategy", "true",
> "Use PowerPC pre-RA scheduling strategy">;
> @@ -255,8 +252,7 @@ def ProcessorFeatures {
>FeatureExtDiv,
>FeatureMFTB,
>DeprecatedDST,
> -  FeatureTwoConstNR,
> -  FeatureUnalignedFloats];
> +  FeatureTwoConstNR];
>list P7SpecificFeatures = [];
>list P7Features =
>  !listconcat(P7InheritableFeatures, P7SpecificFeatures);
>
> Modified: head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.c
> pp
> =
> =
> --- head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
>   Wed Apr 15 18:39:12 2020(r359980)
> +++ head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
>   Wed Apr 15 18:43:44 2020(r359981)
> @@ -15251,9 +15251,6 @@ bool PPCTargetLowering::allowsMisalignedMemoryAccesse
> s
>if (!VT.isSimple())
>  return false;
>  
> -  if (VT.isFloatingPoint() && !Subtarget.allowsUnalignedFPAccess())
> -return false;
> -
>if (VT.getSimpleVT().isVector()) {
>  if (Subtarget.hasVSX()) {
>if (VT != MVT::v2f64 && VT != MVT::v2i64 &&
>
> Modified: head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCSubtarget.h
> =
> =
> --- head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCSubtarget.h  Wed Apr
>  15 18:39:12 2020 (r359980)
> +++ head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCSubtarget.h  Wed Apr
>  15 18:43:44 2020 (r359981)
> @@ -124,7 +124,6 @@ class PPCSubtarget : public PPCGenSubtargetInfo { (pro
>bool IsPPC4xx;
>bool IsPPC6xx;
>bool FeatureMFTB;
> -  bool AllowsUnalignedFPAccess;
>bool DeprecatedDST;
>bool HasLazyResolverStubs;
>bool IsLittleEndian;
> @@ -275,7 +274,6 @@ class PPCSubtarget : public PPCGenSubtargetInfo { (pro
>bool vectorsUseTwoUnits() const {return VectorsUseTwoUnits; }
>bool isE500() const { return IsE500; }
>bool isFeatureMFTB() const { return FeatureMFTB; }
> -  bool allowsUnalignedFPAccess() const { return AllowsUnalignedFPAccess; }
>bool isDeprecatedDST() const { return DeprecatedDST; }
>bool hasICBT() const { return HasICBT; }
>bool hasInvariantFunctionDescriptors() const {
>

I'm seeing 

svn commit: r359981 - head/contrib/llvm-project/llvm/lib/Target/PowerPC

2020-04-15 Thread Dimitry Andric
Author: dim
Date: Wed Apr 15 18:43:44 2020
New Revision: 359981
URL: https://svnweb.freebsd.org/changeset/base/359981

Log:
  Revert commit a9ad65a2b from llvm git (by Nemanja Ivanovic):
  
[PowerPC] Change default for unaligned FP access for older subtargets
  
This is a fix for https://bugs.llvm.org/show_bug.cgi?id=40554
  
Some CPU's trap to the kernel on unaligned floating point access and
there are kernels that do not handle the interrupt. The program then
fails with a SIGBUS according to the PR. This just switches the
default for unaligned access to only allow it on recent server CPUs
that are known to allow this.
  
Differential revision: https://reviews.llvm.org/D71954
  
  This upstream commit causes a compiler hang when building certain ports
  (e.g. security/nss, multimedia/x264) for powerpc64.  The hang has been
  reported in https://bugs.llvm.org/show_bug.cgi?id=45186, but in the mean
  time it is more convenient to revert the commit.
  
  Requested by: jhibbits
  MFC after:6 weeks
  X-MFC-With:   358851

Modified:
  head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPC.td
  head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
  head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCSubtarget.h

Modified: head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPC.td
==
--- head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPC.tdWed Apr 15 
18:39:12 2020(r359980)
+++ head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPC.tdWed Apr 15 
18:43:44 2020(r359981)
@@ -166,9 +166,6 @@ def FeatureHTM : SubtargetFeature<"htm", "HasHTM", "tr
   "Enable Hardware Transactional Memory 
instructions">;
 def FeatureMFTB   : SubtargetFeature<"", "FeatureMFTB", "true",
 "Implement mftb using the mfspr 
instruction">;
-def FeatureUnalignedFloats :
-  SubtargetFeature<"allow-unaligned-fp-access", "AllowsUnalignedFPAccess",
-   "true", "CPU does not trap on unaligned FP access">;
 def FeaturePPCPreRASched:
   SubtargetFeature<"ppc-prera-sched", "UsePPCPreRASchedStrategy", "true",
"Use PowerPC pre-RA scheduling strategy">;
@@ -255,8 +252,7 @@ def ProcessorFeatures {
   FeatureExtDiv,
   FeatureMFTB,
   DeprecatedDST,
-  FeatureTwoConstNR,
-  FeatureUnalignedFloats];
+  FeatureTwoConstNR];
   list P7SpecificFeatures = [];
   list P7Features =
 !listconcat(P7InheritableFeatures, P7SpecificFeatures);

Modified: head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
==
--- head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp   
Wed Apr 15 18:39:12 2020(r359980)
+++ head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp   
Wed Apr 15 18:43:44 2020(r359981)
@@ -15251,9 +15251,6 @@ bool PPCTargetLowering::allowsMisalignedMemoryAccesses
   if (!VT.isSimple())
 return false;
 
-  if (VT.isFloatingPoint() && !Subtarget.allowsUnalignedFPAccess())
-return false;
-
   if (VT.getSimpleVT().isVector()) {
 if (Subtarget.hasVSX()) {
   if (VT != MVT::v2f64 && VT != MVT::v2i64 &&

Modified: head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCSubtarget.h
==
--- head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCSubtarget.hWed Apr 
15 18:39:12 2020(r359980)
+++ head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCSubtarget.hWed Apr 
15 18:43:44 2020(r359981)
@@ -124,7 +124,6 @@ class PPCSubtarget : public PPCGenSubtargetInfo { (pro
   bool IsPPC4xx;
   bool IsPPC6xx;
   bool FeatureMFTB;
-  bool AllowsUnalignedFPAccess;
   bool DeprecatedDST;
   bool HasLazyResolverStubs;
   bool IsLittleEndian;
@@ -275,7 +274,6 @@ class PPCSubtarget : public PPCGenSubtargetInfo { (pro
   bool vectorsUseTwoUnits() const {return VectorsUseTwoUnits; }
   bool isE500() const { return IsE500; }
   bool isFeatureMFTB() const { return FeatureMFTB; }
-  bool allowsUnalignedFPAccess() const { return AllowsUnalignedFPAccess; }
   bool isDeprecatedDST() const { return DeprecatedDST; }
   bool hasICBT() const { return HasICBT; }
   bool hasInvariantFunctionDescriptors() const {
___
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: r359980 - in head/sys: kern sys

2020-04-15 Thread Kyle Evans
Author: kevans
Date: Wed Apr 15 18:39:12 2020
New Revision: 359980
URL: https://svnweb.freebsd.org/changeset/base/359980

Log:
  validate_uuid: absorb the rest of parse_uuid with a flags arg
  
  This makes the naming annoyance (validate_uuid vs. parse_uuid) less of an
  issue and centralizes all of the functionality into the new KPI while still
  making the extra validation optional. The end-result is all the same as far
  as hostuuid validation-only goes.

Modified:
  head/sys/kern/kern_uuid.c
  head/sys/sys/uuid.h

Modified: head/sys/kern/kern_uuid.c
==
--- head/sys/kern/kern_uuid.c   Wed Apr 15 18:27:28 2020(r359979)
+++ head/sys/kern/kern_uuid.c   Wed Apr 15 18:39:12 2020(r359980)
@@ -382,13 +382,21 @@ be_uuid_dec(void const *buf, struct uuid *uuid)
 }
 
 int
-validate_uuid(const char *str, size_t size, struct uuid *uuid)
+validate_uuid(const char *str, size_t size, struct uuid *uuid, int flags)
 {
u_int c[11];
int n;
 
-   if (size == 0 || *str == '\0')
+   if (size == 0 || *str == '\0') {
+   /* An empty string may represent a nil UUID. */
+   if ((flags & VUUIDF_EMPTYOK) != 0) {
+   if (uuid != NULL)
+   bzero(uuid, sizeof(*uuid));
+   return (0);
+   }
+
return (EINVAL);
+   }
 
/* The UUID string representation has a fixed length. */
if (size != 36)
@@ -421,30 +429,21 @@ validate_uuid(const char *str, size_t size, struct uui
uuid->node[n] = c[n + 5];
}
 
-   return (0);
+   if ((flags & VUUIDF_CHECKSEMANTICS) == 0)
+   return (0);
+
+   return (((c[3] & 0x80) != 0x00 &&   /* variant 0? */
+   (c[3] & 0xc0) != 0x80 &&/* variant 1? */
+   (c[3] & 0xe0) != 0xc0) ? EINVAL : 0);   /* variant 2? */
 }
 
+#defineVUUIDF_PARSEFLAGS   (VUUIDF_EMPTYOK | VUUIDF_CHECKSEMANTICS)
+
 int
 parse_uuid(const char *str, struct uuid *uuid)
 {
-   unsigned int clock_seq;
-   int ret;
 
-   /* An empty string represents a nil UUID. */
-   if (*str == '\0') {
-   bzero(uuid, sizeof(*uuid));
-   return (0);
-   }
-
-   ret = validate_uuid(str, strlen(str), uuid);
-   if (ret != 0)
-   return (ret);
-
-   /* Check semantics... */
-   clock_seq = uuid->clock_seq_hi_and_reserved;
-   return (((clock_seq & 0x80) != 0x00 &&  /* variant 0? */
-   (clock_seq & 0xc0) != 0x80 &&   /* variant 1? */
-   (clock_seq & 0xe0) != 0xc0) ? EINVAL : 0);  /* variant 2? */
+   return (validate_uuid(str, strlen(str), uuid, VUUIDF_PARSEFLAGS));
 }
 
 int

Modified: head/sys/sys/uuid.h
==
--- head/sys/sys/uuid.h Wed Apr 15 18:27:28 2020(r359979)
+++ head/sys/sys/uuid.h Wed Apr 15 18:39:12 2020(r359980)
@@ -68,20 +68,18 @@ int printf_uuid(struct uuid *);
 int sbuf_printf_uuid(struct sbuf *, struct uuid *);
 
 /*
- * There are a few key differences between validate_uuid and parse_uuid:
- *
- * - The struct uuid * parameter to validate_uuid is optional, so the caller
- *can simply validate UUID format without doing anything with the result.
- * - validate_uuid will not pass an empty string as a valid UUID, as it doesn't
- *strictly meet the formatting requirements.  parse_uuid will accept an
- *empty string and zero out the uuid struct accordingly.
- * - parse_uuid does additional semantic checks on clock_seq_hi_and_reserved
- *that validate_uuid will not do.
- *
- * validate_uuid is intended to strictly check that it's a well-formed uuid.
+ * validate_uuid will, with no flags passed, validate only the format of the
+ * passed in UUID.  Flags below are available to give it part of or all of the
+ * functionality that parse_uuid has traditionally had: acknowledging an empty
+ * string as valid, and checking the semantics of the UUID as well.
  */
-int validate_uuid(const char *, size_t, struct uuid *);
+int validate_uuid(const char *, size_t, struct uuid *, int);
 int parse_uuid(const char *, struct uuid *);
+
+/* Flags to validate_uuid(). */
+#defineVUUIDF_EMPTYOK  0x0001
+#defineVUUIDF_CHECKSEMANTICS   0x0002
+
 int uuidcmp(const struct uuid *, const struct uuid *);
 
 void be_uuid_dec(void const *buf, struct uuid *uuid);
___
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: r359945 - in head: lib/geom/eli sys/geom/eli

2020-04-15 Thread Kyle Evans
On Wed, Apr 15, 2020 at 1:24 PM John Baldwin  wrote:
>
> On 4/15/20 10:55 AM, Kyle Evans wrote:
> > On Tue, Apr 14, 2020 at 7:15 PM John Baldwin  wrote:
> >>
> >> Author: jhb
> >> Date: Wed Apr 15 00:14:50 2020
> >> New Revision: 359945
> >> URL: https://svnweb.freebsd.org/changeset/base/359945
> >>
> >> Log:
> >>   Remove support for geli(4) algorithms deprecated in r348206.
> >>
> >>   This removes support for reading and writing volumes using the
> >>   following algorithms:
> >>
> >>   - Triple DES
> >>   - Blowfish
> >>   - MD5 HMAC integrity
> >>
> >>   In addition, this commit adds an explicit whitelist of supported
> >>   algorithms to give a better error message when an invalid or
> >>   unsupported algorithm is used by an existing volume.
> >>
> >>   Reviewed by:  cem
> >>   Sponsored by: Chelsio Communications
> >>   Differential Revision:https://reviews.freebsd.org/D24343
> >>
> >> Modified:
> >>   head/lib/geom/eli/geli.8
> >>   head/lib/geom/eli/geom_eli.c
> >>   head/sys/geom/eli/g_eli.c
> >>   head/sys/geom/eli/g_eli.h
> >>   head/sys/geom/eli/g_eli_crypto.c
> >>   head/sys/geom/eli/g_eli_ctl.c
> >>
> >> [... snip ...]
> >> @@ -522,6 +506,36 @@ eli_metadata_dump(const struct g_eli_metadata *md)
> >> printf("  MD5 hash: %s\n", str);
> >>  }
> >>
> >> +#ifdef _KERNEL
> >> +static bool
> >> +eli_metadata_crypto_supported(const struct g_eli_metadata *md)
> >> +{
> >> +
> >> +   switch (md->md_ealgo) {
> >> +   case CRYPTO_NULL_CBC:
> >> +   case CRYPTO_AES_CBC:
> >> +   case CRYPTO_CAMELLIA_CBC:
> >> +   case CRYPTO_AES_XTS:
> >> +   break;
> >> +   default:
> >> +   return (false);
> >> +   }
> >> +   if (md->md_flags & G_ELI_FLAG_AUTH) {
> >> +   switch (md->md_aalgo) {
> >> +   case CRYPTO_SHA1_HMAC:
> >> +   case CRYPTO_RIPEMD160_HMAC:
> >> +   case CRYPTO_SHA2_256_HMAC:
> >> +   case CRYPTO_SHA2_384_HMAC:
> >> +   case CRYPTO_SHA2_512_HMAC:
> >> +   break;
> >> +   default:
> >> +   return (false);
> >> +   }
> >> +   }
> >> +   return (true);
> >> +}
> >> +#endif
> >> +
> >>  static __inline u_int
> >>  g_eli_keylen(u_int algo, u_int keylen)
> >>  {
> >> [... snip ...]
> >
> > eli_metadata_crypto_supported is defined here, but unused in most
> > compilation units that include g_eli.h, resulting in some amount of
> > noise:
> >
> > In file included from /usr/src/sys/geom/eli/g_eli_crypto.c:46:
> > /usr/src/sys/geom/eli/g_eli.h:511:1: warning: unused function
> > 'eli_metadata_crypto_supported' [-Wunused-function]
> > eli_metadata_crypto_supported(const struct g_eli_metadata *md)
> >
> > (repeat for g_eli_hmac.c, g_eli_integrity.c, g_eli_key.c,
> > g_eli_key_cache.c, g_eli_privacy.c, pkcs5v2.c)
> >
> > Given that it's probably not in danger of silently going away and not
> > getting removed, any objection to marking it __unused to squelch the 
> > warnings?
>
> Oh, rather, I should mark it __inline.  There are several other functions
> in g_eli.h that are similarly not always used, but they are marked __inline
> which is how they avoid the warning.
>

Works for me. =-) Thanks!
___
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: r359979 - head/sys/geom/eli

2020-04-15 Thread John Baldwin
Author: jhb
Date: Wed Apr 15 18:27:28 2020
New Revision: 359979
URL: https://svnweb.freebsd.org/changeset/base/359979

Log:
  Mark eli_metadata_crypto_supported inline.
  
  This quiets warnings about it not being always used.
  
  Reported by:  kevans

Modified:
  head/sys/geom/eli/g_eli.h

Modified: head/sys/geom/eli/g_eli.h
==
--- head/sys/geom/eli/g_eli.h   Wed Apr 15 18:15:58 2020(r359978)
+++ head/sys/geom/eli/g_eli.h   Wed Apr 15 18:27:28 2020(r359979)
@@ -507,7 +507,7 @@ eli_metadata_dump(const struct g_eli_metadata *md)
 }
 
 #ifdef _KERNEL
-static bool
+static __inline bool
 eli_metadata_crypto_supported(const struct g_eli_metadata *md)
 {
 
___
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: r359945 - in head: lib/geom/eli sys/geom/eli

2020-04-15 Thread John Baldwin
On 4/15/20 10:55 AM, Kyle Evans wrote:
> On Tue, Apr 14, 2020 at 7:15 PM John Baldwin  wrote:
>>
>> Author: jhb
>> Date: Wed Apr 15 00:14:50 2020
>> New Revision: 359945
>> URL: https://svnweb.freebsd.org/changeset/base/359945
>>
>> Log:
>>   Remove support for geli(4) algorithms deprecated in r348206.
>>
>>   This removes support for reading and writing volumes using the
>>   following algorithms:
>>
>>   - Triple DES
>>   - Blowfish
>>   - MD5 HMAC integrity
>>
>>   In addition, this commit adds an explicit whitelist of supported
>>   algorithms to give a better error message when an invalid or
>>   unsupported algorithm is used by an existing volume.
>>
>>   Reviewed by:  cem
>>   Sponsored by: Chelsio Communications
>>   Differential Revision:https://reviews.freebsd.org/D24343
>>
>> Modified:
>>   head/lib/geom/eli/geli.8
>>   head/lib/geom/eli/geom_eli.c
>>   head/sys/geom/eli/g_eli.c
>>   head/sys/geom/eli/g_eli.h
>>   head/sys/geom/eli/g_eli_crypto.c
>>   head/sys/geom/eli/g_eli_ctl.c
>>
>> [... snip ...]
>> @@ -522,6 +506,36 @@ eli_metadata_dump(const struct g_eli_metadata *md)
>> printf("  MD5 hash: %s\n", str);
>>  }
>>
>> +#ifdef _KERNEL
>> +static bool
>> +eli_metadata_crypto_supported(const struct g_eli_metadata *md)
>> +{
>> +
>> +   switch (md->md_ealgo) {
>> +   case CRYPTO_NULL_CBC:
>> +   case CRYPTO_AES_CBC:
>> +   case CRYPTO_CAMELLIA_CBC:
>> +   case CRYPTO_AES_XTS:
>> +   break;
>> +   default:
>> +   return (false);
>> +   }
>> +   if (md->md_flags & G_ELI_FLAG_AUTH) {
>> +   switch (md->md_aalgo) {
>> +   case CRYPTO_SHA1_HMAC:
>> +   case CRYPTO_RIPEMD160_HMAC:
>> +   case CRYPTO_SHA2_256_HMAC:
>> +   case CRYPTO_SHA2_384_HMAC:
>> +   case CRYPTO_SHA2_512_HMAC:
>> +   break;
>> +   default:
>> +   return (false);
>> +   }
>> +   }
>> +   return (true);
>> +}
>> +#endif
>> +
>>  static __inline u_int
>>  g_eli_keylen(u_int algo, u_int keylen)
>>  {
>> [... snip ...]
> 
> eli_metadata_crypto_supported is defined here, but unused in most
> compilation units that include g_eli.h, resulting in some amount of
> noise:
> 
> In file included from /usr/src/sys/geom/eli/g_eli_crypto.c:46:
> /usr/src/sys/geom/eli/g_eli.h:511:1: warning: unused function
> 'eli_metadata_crypto_supported' [-Wunused-function]
> eli_metadata_crypto_supported(const struct g_eli_metadata *md)
> 
> (repeat for g_eli_hmac.c, g_eli_integrity.c, g_eli_key.c,
> g_eli_key_cache.c, g_eli_privacy.c, pkcs5v2.c)
> 
> Given that it's probably not in danger of silently going away and not
> getting removed, any objection to marking it __unused to squelch the warnings?

Oh, rather, I should mark it __inline.  There are several other functions
in g_eli.h that are similarly not always used, but they are marked __inline
which is how they avoid the warning.

-- 
John Baldwin
___
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: r359978 - in head: lib/libc/gen lib/libc/net lib/libc/rpc sys/dev/ocs_fc sys/net80211

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

Log:
  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)
  MFC after:1 week
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D24425

Modified:
  head/lib/libc/gen/getgrent.c
  head/lib/libc/gen/getpwent.c
  head/lib/libc/net/gethostnamadr.c
  head/lib/libc/net/getnetnamadr.c
  head/lib/libc/net/getprotoent.c
  head/lib/libc/net/getservent.c
  head/lib/libc/rpc/getrpcent.c
  head/sys/dev/ocs_fc/ocs_device.c
  head/sys/net80211/ieee80211_output.c

Modified: head/lib/libc/gen/getgrent.c
==
--- head/lib/libc/gen/getgrent.cWed Apr 15 17:11:44 2020
(r359977)
+++ head/lib/libc/gen/getgrent.cWed Apr 15 18:15:58 2020
(r359978)
@@ -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: head/lib/libc/gen/getpwent.c
==
--- head/lib/libc/gen/getpwent.cWed Apr 15 17:11:44 2020
(r359977)
+++ head/lib/libc/gen/getpwent.cWed Apr 15 18:15:58 2020
(r359978)
@@ -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 *);
break;
@@ -370,7 +370,7 @@ pwd_unmarshal_func(char *buffer, size_t buffer_size, v
 

Re: svn commit: r359945 - in head: lib/geom/eli sys/geom/eli

2020-04-15 Thread Kyle Evans
On Tue, Apr 14, 2020 at 7:15 PM John Baldwin  wrote:
>
> Author: jhb
> Date: Wed Apr 15 00:14:50 2020
> New Revision: 359945
> URL: https://svnweb.freebsd.org/changeset/base/359945
>
> Log:
>   Remove support for geli(4) algorithms deprecated in r348206.
>
>   This removes support for reading and writing volumes using the
>   following algorithms:
>
>   - Triple DES
>   - Blowfish
>   - MD5 HMAC integrity
>
>   In addition, this commit adds an explicit whitelist of supported
>   algorithms to give a better error message when an invalid or
>   unsupported algorithm is used by an existing volume.
>
>   Reviewed by:  cem
>   Sponsored by: Chelsio Communications
>   Differential Revision:https://reviews.freebsd.org/D24343
>
> Modified:
>   head/lib/geom/eli/geli.8
>   head/lib/geom/eli/geom_eli.c
>   head/sys/geom/eli/g_eli.c
>   head/sys/geom/eli/g_eli.h
>   head/sys/geom/eli/g_eli_crypto.c
>   head/sys/geom/eli/g_eli_ctl.c
>
> [... snip ...]
> @@ -522,6 +506,36 @@ eli_metadata_dump(const struct g_eli_metadata *md)
> printf("  MD5 hash: %s\n", str);
>  }
>
> +#ifdef _KERNEL
> +static bool
> +eli_metadata_crypto_supported(const struct g_eli_metadata *md)
> +{
> +
> +   switch (md->md_ealgo) {
> +   case CRYPTO_NULL_CBC:
> +   case CRYPTO_AES_CBC:
> +   case CRYPTO_CAMELLIA_CBC:
> +   case CRYPTO_AES_XTS:
> +   break;
> +   default:
> +   return (false);
> +   }
> +   if (md->md_flags & G_ELI_FLAG_AUTH) {
> +   switch (md->md_aalgo) {
> +   case CRYPTO_SHA1_HMAC:
> +   case CRYPTO_RIPEMD160_HMAC:
> +   case CRYPTO_SHA2_256_HMAC:
> +   case CRYPTO_SHA2_384_HMAC:
> +   case CRYPTO_SHA2_512_HMAC:
> +   break;
> +   default:
> +   return (false);
> +   }
> +   }
> +   return (true);
> +}
> +#endif
> +
>  static __inline u_int
>  g_eli_keylen(u_int algo, u_int keylen)
>  {
> [... snip ...]

eli_metadata_crypto_supported is defined here, but unused in most
compilation units that include g_eli.h, resulting in some amount of
noise:

In file included from /usr/src/sys/geom/eli/g_eli_crypto.c:46:
/usr/src/sys/geom/eli/g_eli.h:511:1: warning: unused function
'eli_metadata_crypto_supported' [-Wunused-function]
eli_metadata_crypto_supported(const struct g_eli_metadata *md)

(repeat for g_eli_hmac.c, g_eli_integrity.c, g_eli_key.c,
g_eli_key_cache.c, g_eli_privacy.c, pkcs5v2.c)

Given that it's probably not in danger of silently going away and not
getting removed, any objection to marking it __unused to squelch the warnings?

Thanks,

Kyle Evans
___
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: r359977 - head/usr.sbin/nologin

2020-04-15 Thread Mateusz Piotrowski
Author: 0mp (doc,ports committer)
Date: Wed Apr 15 17:11:44 2020
New Revision: 359977
URL: https://svnweb.freebsd.org/changeset/base/359977

Log:
  Fix a typo
  
  Reported by:  rgrimes
  MFC with: 359967

Modified:
  head/usr.sbin/nologin/nologin.8

Modified: head/usr.sbin/nologin/nologin.8
==
--- head/usr.sbin/nologin/nologin.8 Wed Apr 15 16:55:38 2020
(r359976)
+++ head/usr.sbin/nologin/nologin.8 Wed Apr 15 17:11:44 2020
(r359977)
@@ -46,7 +46,7 @@ When executed,
 .Nm
 first writes about the login attempt to
 .Xr syslog 3
-and then a displays a message that an account is not available.
+and then displays a message that an account is not available.
 .Pp
 To disable all logins,
 investigate
___
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: r359967 - head/usr.sbin/nologin

2020-04-15 Thread Mateusz Piotrowski

Hi,

On 4/15/20 7:00 PM, Rodney W. Grimes wrote:

Author: 0mp (doc,ports committer)
Date: Wed Apr 15 13:13:46 2020
New Revision: 359967
URL: https://svnweb.freebsd.org/changeset/base/359967

Log:
   Document the exit status and the stdout message of nologin(8)
   
   Reviewed by:	debdrup (earlier version)

   MFC after:   2 weeks
   Differential Revision:   https://reviews.freebsd.org/D24196

Modified:
   head/usr.sbin/nologin/nologin.8

Modified: head/usr.sbin/nologin/nologin.8

...

+When executed,
+.Nm
+first writes about the login attempt to
+.Xr syslog 3
+and then a displays a message that an account is not available.

This needs some wordsmithing, extra "a" needs removed.

and then displays a message that an account is not available.


Nice catch! I'll fix it right away, thanks a lot, Rodney.

Cheers,

Mateusz

___
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: r359967 - head/usr.sbin/nologin

2020-04-15 Thread Rodney W. Grimes
> Author: 0mp (doc,ports committer)
> Date: Wed Apr 15 13:13:46 2020
> New Revision: 359967
> URL: https://svnweb.freebsd.org/changeset/base/359967
> 
> Log:
>   Document the exit status and the stdout message of nologin(8)
>   
>   Reviewed by:debdrup (earlier version)
>   MFC after:  2 weeks
>   Differential Revision:  https://reviews.freebsd.org/D24196
> 
> Modified:
>   head/usr.sbin/nologin/nologin.8
> 
> Modified: head/usr.sbin/nologin/nologin.8
> ==
> --- head/usr.sbin/nologin/nologin.8   Wed Apr 15 13:06:55 2020
> (r359966)
> +++ head/usr.sbin/nologin/nologin.8   Wed Apr 15 13:13:46 2020
> (r359967)
> @@ -28,7 +28,7 @@
>  .\" @(#)nologin.88.1 (Berkeley) 6/19/93
>  .\" $FreeBSD$
>  .\"
> -.Dd June 19, 1993
> +.Dd April 15, 2020
>  .Dt NOLOGIN 8
>  .Os
>  .Sh NAME
> @@ -39,14 +39,31 @@
>  .Sh DESCRIPTION
>  The
>  .Nm
> -utility displays a message that an account is not available and
> -exits non-zero.
> -It is intended as a replacement shell field for accounts that
> +is intended as a replacement shell field for accounts that
>  have been disabled.
>  .Pp
> +When executed,
> +.Nm
> +first writes about the login attempt to
> +.Xr syslog 3
> +and then a displays a message that an account is not available.

This needs some wordsmithing, extra "a" needs removed.

and then displays a message that an account is not available.

> +.Pp
>  To disable all logins,
>  investigate
>  .Xr nologin 5 .
> +.Sh EXIT STATUS
> +The
> +.Nm
> +utility always exits non-zero.
> +.Sh EXAMPLES
> +Here is a demonstration of executing
> +.Nm :
> +.Bd -literal -offset 4n
> +$ nologin
> +This account is currently not available.
> +$ tail -n 1 /var/log/messages
> +Mar 30 21:53:07 example.org nologin[65992]: Attempted login by beastie on 
> /dev/pts/18
> +.Ed
>  .Sh SEE ALSO
>  .Xr login 1 ,
>  .Xr nologin 5
> 

-- 
Rod Grimes rgri...@freebsd.org
___
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: r359976 - head/sys/kern

2020-04-15 Thread Pawel Biernacki
Author: kaktus
Date: Wed Apr 15 16:55:38 2020
New Revision: 359976
URL: https://svnweb.freebsd.org/changeset/base/359976

Log:
  sysctl_handle_string: Put logical or in parentheses.
  
  Reported by:  rdivacky
  Approved by:  kib (mentor)
  Pointy-hat to:kaktus

Modified:
  head/sys/kern/kern_sysctl.c

Modified: head/sys/kern/kern_sysctl.c
==
--- head/sys/kern/kern_sysctl.c Wed Apr 15 16:33:55 2020(r359975)
+++ head/sys/kern/kern_sysctl.c Wed Apr 15 16:55:38 2020(r359976)
@@ -1655,7 +1655,7 @@ 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
+   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: r359949 - head/usr.sbin/bhyve

2020-04-15 Thread Ian Lepore
On Wed, 2020-04-15 at 08:30 -0400, Shawn Webb wrote:
> On Wed, Apr 15, 2020 at 01:58:51AM +, Conrad Meyer wrote:
> > Author: cem
> > Date: Wed Apr 15 01:58:51 2020
> > New Revision: 359949
> > URL: https://svnweb.freebsd.org/changeset/base/359949
> > 
> > Log:
> >   bhyve(8): Add bootrom allocation abstraction
> >   
> >   To allow more general use of the bootrom region, separate initialization 
> > from
> >   allocation, and allocation from loading a file.
> >   
> >   The bootrom segment is the high 16MB of the low 4GB region.
> >   
> >   Each allocation in the segment creates a new mapping with specified 
> > protection.
> >   By default, allocation begins at the low end of the range.  However, the
> >   BOOTROM_ALLOC_TOP flag is provided to locate a provided bootrom in the 
> > high
> >   region it is expected to be in.
> >   
> >   The existing ROM-file loading code is refactored to use the new interface.
> >   
> >   Reviewed by:  grehan (earlier version)
> >   Differential Revision:https://reviews.freebsd.org/D24422
> 
> Hey Conrad,
> 
> Is there any way you'd have a change of heart and support MFC'ing? I'm
> sure many people, including myself, would be ever so grateful not to
> have to maintain their own MFC's of your work.
> 
> Thanks,
> 

There are multiple people involved in maintaining bhyve, you can ask
any of them (or, really, any committer at all) to MFC things.

-- Ian


___
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: r359974 - head/sys/mips/mips

2020-04-15 Thread Brooks Davis
Author: brooks
Date: Wed Apr 15 16:33:27 2020
New Revision: 359974
URL: https://svnweb.freebsd.org/changeset/base/359974

Log:
  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
  MFC after:3 weeks
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D24410

Modified:
  head/sys/mips/mips/trap.c

Modified: head/sys/mips/mips/trap.c
==
--- head/sys/mips/mips/trap.c   Wed Apr 15 14:07:33 2020(r359973)
+++ head/sys/mips/mips/trap.c   Wed Apr 15 16:33:27 2020(r359974)
@@ -1402,7 +1402,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;
@@ -1429,17 +1429,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));
@@ -1451,7 +1450,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;
@@ -1499,18 +1498,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: r359975 - head/sys/kern

2020-04-15 Thread Pawel Biernacki
Author: kaktus
Date: Wed Apr 15 16:33:55 2020
New Revision: 359975
URL: https://svnweb.freebsd.org/changeset/base/359975

Log:
  sysctl(9): fix handling string tunables.
  
  r357614 changed internals of handling string sysctls, and inadvertently
  broke setting string tunables.  Take them into account.
  
  PR:   245463
  Reported by:  jhb, np
  Reviewed by:  imp, jhb, kib
  Approved by:  kib (mentor)
  Differential Revision:https://reviews.freebsd.org/D24429

Modified:
  head/sys/kern/kern_sysctl.c

Modified: head/sys/kern/kern_sysctl.c
==
--- head/sys/kern/kern_sysctl.c Wed Apr 15 16:33:27 2020(r359974)
+++ head/sys/kern/kern_sysctl.c Wed Apr 15 16:33:55 2020(r359975)
@@ -1648,13 +1648,15 @@ sysctl_handle_string(SYSCTL_HANDLER_ARGS)
int error = 0, ro_string = 0;
 
/*
-* If the sysctl isn't writable, microoptimise and treat it as a
-* const string.
+* If the sysctl isn't writable and isn't a preallocated tunable that
+* can be modified by kenv(2), microoptimise and treat it as a
+* read-only string.
 * A zero-length buffer indicates a fixed size read-only
 * string.  In ddb, don't worry about trying to make a malloced
 * snapshot.
 */
-   if (!(oidp->oid_kind & CTLFLAG_WR) || 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;
}
@@ -1697,8 +1699,7 @@ sysctl_handle_string(SYSCTL_HANDLER_ARGS)
arg2 = req->newlen - req->newidx;
tmparg = malloc(arg2, M_SYSCTLTMP, M_WAITOK);
 
-   error = copyin((const char *)req->newptr + req->newidx,
-   tmparg, arg2);
+   error = SYSCTL_IN(req, tmparg, arg2);
if (error) {
free(tmparg, M_SYSCTLTMP);
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"


Re: svn commit: r359949 - head/usr.sbin/bhyve

2020-04-15 Thread Conrad Meyer
No.

On Wed, Apr 15, 2020 at 05:30 Shawn Webb  wrote:

> On Wed, Apr 15, 2020 at 01:58:51AM +, Conrad Meyer wrote:
> > Author: cem
> > Date: Wed Apr 15 01:58:51 2020
> > New Revision: 359949
> > URL: https://svnweb.freebsd.org/changeset/base/359949
> >
> > Log:
> >   bhyve(8): Add bootrom allocation abstraction
> >
> >   To allow more general use of the bootrom region, separate
> initialization from
> >   allocation, and allocation from loading a file.
> >
> >   The bootrom segment is the high 16MB of the low 4GB region.
> >
> >   Each allocation in the segment creates a new mapping with specified
> protection.
> >   By default, allocation begins at the low end of the range.  However,
> the
> >   BOOTROM_ALLOC_TOP flag is provided to locate a provided bootrom in the
> high
> >   region it is expected to be in.
> >
> >   The existing ROM-file loading code is refactored to use the new
> interface.
> >
> >   Reviewed by:grehan (earlier version)
> >   Differential Revision:  https://reviews.freebsd.org/D24422
>
> Hey Conrad,
>
> Is there any way you'd have a change of heart and support MFC'ing? I'm
> sure many people, including myself, would be ever so grateful not to
> have to maintain their own MFC's of your work.
>
> Thanks,
>
> --
> Shawn Webb
> Cofounder / Security Engineer
> HardenedBSD
>
> GPG Key ID:  0xFF2E67A277F8E1FA
> GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9  3633 C85B 0AF8 AB23 0FB2
>
> https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc
>
___
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: r359945 - in head: lib/geom/eli sys/geom/eli

2020-04-15 Thread John Baldwin
On 4/14/20 5:22 PM, Alan Somers wrote:
> On Tue, Apr 14, 2020 at 6:15 PM John Baldwin  wrote:
> 
>> Author: jhb
>> Date: Wed Apr 15 00:14:50 2020
>> New Revision: 359945
>> URL: https://svnweb.freebsd.org/changeset/base/359945
>>
>> Log:
>>   Remove support for geli(4) algorithms deprecated in r348206.
>>
>>   This removes support for reading and writing volumes using the
>>   following algorithms:
>>
>>   - Triple DES
>>   - Blowfish
>>   - MD5 HMAC integrity
>>
>>   In addition, this commit adds an explicit whitelist of supported
>>   algorithms to give a better error message when an invalid or
>>   unsupported algorithm is used by an existing volume.
>>
>>   Reviewed by:  cem
>>   Sponsored by: Chelsio Communications
>>   Differential Revision:https://reviews.freebsd.org/D24343
>>
> 
> Why remove read-only support?  That will make it much harder to convert old
> volumes.

The goal is to remove the actual crypto code (and drivers that only
implement old algorithms).  Read-only support means you still have to
support the algorithm.  12.x already refuses to create new volumes
with these algorithms but permits access to existing ones.

-- 
John Baldwin
___
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: r359973 - head/libexec/rc/rc.d

2020-04-15 Thread Mateusz Piotrowski
Author: 0mp (doc,ports committer)
Date: Wed Apr 15 14:07:33 2020
New Revision: 359973
URL: https://svnweb.freebsd.org/changeset/base/359973

Log:
  sshd: Warn about missing ssh-keygen only when necessary
  
  The sshd service is using ssh-keygen to generate missing SSH keys.
  If ssh-keygen is missing, it prints the following message:
  
  > /etc/rc.d/sshd: WARNING: /usr/bin/ssh-keygen does not exist.
  
  It makes sense when the key is not generated yet and
  cannot be created because ssh-keygen is missing.
  
  The problem is that even if the key is present on the host,
  the sshd service would still warn about missing ssh-keygen
  (even though it does not need it).
  
  Reviewed by:  emaste
  Approved by:  emaste (src)
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D23911

Modified:
  head/libexec/rc/rc.d/sshd

Modified: head/libexec/rc/rc.d/sshd
==
--- head/libexec/rc/rc.d/sshd   Wed Apr 15 13:59:51 2020(r359972)
+++ head/libexec/rc/rc.d/sshd   Wed Apr 15 14:07:33 2020(r359973)
@@ -45,18 +45,19 @@ sshd_keygen_alg()
;;
esac
 
+   if [ -f "${keyfile}" ] ; then
+   info "$ALG host key exists."
+   return 0
+   fi
+
if [ ! -x /usr/bin/ssh-keygen ] ; then
warn "/usr/bin/ssh-keygen does not exist."
return 1
fi
 
-   if [ -f "${keyfile}" ] ; then
-   info "$ALG host key exists."
-   else
-   echo "Generating $ALG host key."
-   /usr/bin/ssh-keygen -q -t $alg -f "$keyfile" -N ""
-   /usr/bin/ssh-keygen -l -f "$keyfile.pub"
-   fi
+   echo "Generating $ALG host key."
+   /usr/bin/ssh-keygen -q -t $alg -f "$keyfile" -N ""
+   /usr/bin/ssh-keygen -l -f "$keyfile.pub"
 }
 
 sshd_keygen()
___
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: r359972 - stable/12/sys/dev/ahci

2020-04-15 Thread Alexander Motin
Author: mav
Date: Wed Apr 15 13:59:51 2020
New Revision: 359972
URL: https://svnweb.freebsd.org/changeset/base/359972

Log:
  MFC r359499: Add ID for JMicron JMB582/JMB585 AHCI controller.
  
  JMB582 has 2 6Gbps SATA ports and PCIe 3.0 x1.
  JMB585 has 5 6Gbps SATA ports and PCIe 3.0 x2.
  
  Both chips support AHCI v1.31, Port Multiplier with FBS and 8 MSI vectors.

Modified:
  stable/12/sys/dev/ahci/ahci.c
  stable/12/sys/dev/ahci/ahci.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/ahci/ahci.c
==
--- stable/12/sys/dev/ahci/ahci.c   Wed Apr 15 13:59:09 2020
(r359971)
+++ stable/12/sys/dev/ahci/ahci.c   Wed Apr 15 13:59:51 2020
(r359972)
@@ -141,7 +141,27 @@ int
 ahci_ctlr_reset(device_t dev)
 {
struct ahci_controller *ctlr = device_get_softc(dev);
+   uint32_t v;
int timeout;
+
+   /* BIOS/OS Handoff */
+   if ((ATA_INL(ctlr->r_mem, AHCI_VS) >= 0x00010200) &&
+   (ATA_INL(ctlr->r_mem, AHCI_CAP2) & AHCI_CAP2_BOH) &&
+   ((v = ATA_INL(ctlr->r_mem, AHCI_BOHC)) & AHCI_BOHC_OOS) == 0) {
+
+   /* Request OS ownership. */
+   ATA_OUTL(ctlr->r_mem, AHCI_BOHC, v | AHCI_BOHC_OOS);
+
+   /* Wait up to 2s for BIOS ownership release. */
+   for (timeout = 0; timeout < 80; timeout++) {
+   DELAY(25000);
+   v = ATA_INL(ctlr->r_mem, AHCI_BOHC);
+   if ((v & AHCI_BOHC_BOS) == 0)
+   break;
+   if ((v & AHCI_BOHC_BB) == 0)
+   break;
+   }
+   }
 
/* Enable AHCI mode */
ATA_OUTL(ctlr->r_mem, AHCI_GHC, AHCI_GHC_AE);

Modified: stable/12/sys/dev/ahci/ahci.h
==
--- stable/12/sys/dev/ahci/ahci.h   Wed Apr 15 13:59:09 2020
(r359971)
+++ stable/12/sys/dev/ahci/ahci.h   Wed Apr 15 13:59:51 2020
(r359972)
@@ -214,6 +214,13 @@
 #defineAHCI_CAP2_SADM  0x0010
 #defineAHCI_CAP2_DESO  0x0020
 
+#define AHCI_BOHC   0x28
+#defineAHCI_BOHC_BOS   0x0001
+#defineAHCI_BOHC_OOS   0x0002
+#defineAHCI_BOHC_SOOE  0x0004
+#defineAHCI_BOHC_OOC   0x0008
+#defineAHCI_BOHC_BB0x0010
+
 #define AHCI_VSCAP  0xa4
 #define AHCI_OFFSET 0x100
 #define AHCI_STEP   0x80
___
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: r359971 - stable/11/sys/dev/ahci

2020-04-15 Thread Alexander Motin
Author: mav
Date: Wed Apr 15 13:59:09 2020
New Revision: 359971
URL: https://svnweb.freebsd.org/changeset/base/359971

Log:
  MFC r359499: Add ID for JMicron JMB582/JMB585 AHCI controller.
  
  JMB582 has 2 6Gbps SATA ports and PCIe 3.0 x1.
  JMB585 has 5 6Gbps SATA ports and PCIe 3.0 x2.
  
  Both chips support AHCI v1.31, Port Multiplier with FBS and 8 MSI vectors.

Modified:
  stable/11/sys/dev/ahci/ahci_pci.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/ahci/ahci_pci.c
==
--- stable/11/sys/dev/ahci/ahci_pci.c   Wed Apr 15 13:58:42 2020
(r359970)
+++ stable/11/sys/dev/ahci/ahci_pci.c   Wed Apr 15 13:59:09 2020
(r359971)
@@ -247,6 +247,7 @@ static const struct {
{0x2365197b, 0x00, "JMicron JMB365",AHCI_Q_NOFORCE},
{0x2366197b, 0x00, "JMicron JMB366",AHCI_Q_NOFORCE},
{0x2368197b, 0x00, "JMicron JMB368",AHCI_Q_NOFORCE},
+   {0x0585197b, 0x00, "JMicron JMB58x",0},
{0x61ab, 0x00, "Marvell 88SE6111",  AHCI_Q_NOFORCE | AHCI_Q_NOPMP |
AHCI_Q_1CH | AHCI_Q_EDGEIS},
{0x612111ab, 0x00, "Marvell 88SE6121",  AHCI_Q_NOFORCE | AHCI_Q_NOPMP |
@@ -401,6 +402,7 @@ ahci_probe(device_t dev)
 !(ahci_ids[i].quirks & AHCI_Q_NOFORCE {
/* Do not attach JMicrons with single PCI function. */
if (pci_get_vendor(dev) == 0x197b &&
+   (ahci_ids[i].quirks & AHCI_Q_NOFORCE) &&
(pci_read_config(dev, 0xdf, 1) & 0x40) == 0)
return (ENXIO);
snprintf(buf, sizeof(buf), "%s AHCI SATA controller",
___
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: r359970 - stable/12/sys/dev/ahci

2020-04-15 Thread Alexander Motin
Author: mav
Date: Wed Apr 15 13:58:42 2020
New Revision: 359970
URL: https://svnweb.freebsd.org/changeset/base/359970

Log:
  MFC r359499: Add ID for JMicron JMB582/JMB585 AHCI controller.
  
  JMB582 has 2 6Gbps SATA ports and PCIe 3.0 x1.
  JMB585 has 5 6Gbps SATA ports and PCIe 3.0 x2.
  
  Both chips support AHCI v1.31, Port Multiplier with FBS and 8 MSI vectors.

Modified:
  stable/12/sys/dev/ahci/ahci_pci.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/ahci/ahci_pci.c
==
--- stable/12/sys/dev/ahci/ahci_pci.c   Wed Apr 15 13:35:28 2020
(r359969)
+++ stable/12/sys/dev/ahci/ahci_pci.c   Wed Apr 15 13:58:42 2020
(r359970)
@@ -247,6 +247,7 @@ static const struct {
{0x2365197b, 0x00, "JMicron JMB365",AHCI_Q_NOFORCE},
{0x2366197b, 0x00, "JMicron JMB366",AHCI_Q_NOFORCE},
{0x2368197b, 0x00, "JMicron JMB368",AHCI_Q_NOFORCE},
+   {0x0585197b, 0x00, "JMicron JMB58x",0},
{0x61ab, 0x00, "Marvell 88SE6111",  AHCI_Q_NOFORCE | AHCI_Q_NOPMP |
AHCI_Q_1CH | AHCI_Q_EDGEIS},
{0x612111ab, 0x00, "Marvell 88SE6121",  AHCI_Q_NOFORCE | AHCI_Q_NOPMP |
@@ -399,6 +400,7 @@ ahci_probe(device_t dev)
 !(ahci_ids[i].quirks & AHCI_Q_NOFORCE {
/* Do not attach JMicrons with single PCI function. */
if (pci_get_vendor(dev) == 0x197b &&
+   (ahci_ids[i].quirks & AHCI_Q_NOFORCE) &&
(pci_read_config(dev, 0xdf, 1) & 0x40) == 0)
return (ENXIO);
snprintf(buf, sizeof(buf), "%s AHCI SATA controller",
___
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: r359969 - head/sys/arm/allwinner

2020-04-15 Thread Emmanuel Vadot
Author: manu
Date: Wed Apr 15 13:35:28 2020
New Revision: 359969
URL: https://svnweb.freebsd.org/changeset/base/359969

Log:
  arm: allwinner: aw_sid: Fix thermal calibration size for A64
  
  This fixes the aw_thermal driver on A64 SoC.
  
  MFC after:1 month
  X-MFC-With:   r359935

Modified:
  head/sys/arm/allwinner/aw_sid.c

Modified: head/sys/arm/allwinner/aw_sid.c
==
--- head/sys/arm/allwinner/aw_sid.c Wed Apr 15 13:20:51 2020
(r359968)
+++ head/sys/arm/allwinner/aw_sid.c Wed Apr 15 13:35:28 2020
(r359969)
@@ -104,7 +104,7 @@ static struct aw_sid_efuse a64_efuses[] = {
.desc = "Thermal Sensor Calibration Data",
.base = EFUSE_OFFSET,
.offset = 0x34,
-   .size = 6,
+   .size = 8,
.id = AW_SID_FUSE_THSSENSOR,
.public = true,
},
___
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: r359968 - head/sys/kern

2020-04-15 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Apr 15 13:20:51 2020
New Revision: 359968
URL: https://svnweb.freebsd.org/changeset/base/359968

Log:
  Cast all ioctl command arguments through uint32_t internally.
  
  Hide debug print showing use of sign extended ioctl command argument
  under INVARIANTS. The print is available to all and can easily fill
  up the logs.
  
  No functional change intended.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/kern/sys_generic.c

Modified: head/sys/kern/sys_generic.c
==
--- head/sys/kern/sys_generic.c Wed Apr 15 13:13:46 2020(r359967)
+++ head/sys/kern/sys_generic.c Wed Apr 15 13:20:51 2020(r359968)
@@ -652,18 +652,19 @@ int
 sys_ioctl(struct thread *td, struct ioctl_args *uap)
 {
u_char smalldata[SYS_IOCTL_SMALL_SIZE] __aligned(SYS_IOCTL_SMALL_ALIGN);
-   u_long com;
+   uint32_t com;
int arg, error;
u_int size;
caddr_t data;
 
+#ifdef INVARIANTS
if (uap->com > 0x) {
printf(
"WARNING pid %d (%s): ioctl sign-extension ioctl %lx\n",
td->td_proc->p_pid, td->td_name, uap->com);
-   uap->com &= 0x;
}
-   com = uap->com;
+#endif
+   com = (uint32_t)uap->com;
 
/*
 * Interpret high order word to find amount of data to be
___
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: r359967 - head/usr.sbin/nologin

2020-04-15 Thread Mateusz Piotrowski
Author: 0mp (doc,ports committer)
Date: Wed Apr 15 13:13:46 2020
New Revision: 359967
URL: https://svnweb.freebsd.org/changeset/base/359967

Log:
  Document the exit status and the stdout message of nologin(8)
  
  Reviewed by:  debdrup (earlier version)
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D24196

Modified:
  head/usr.sbin/nologin/nologin.8

Modified: head/usr.sbin/nologin/nologin.8
==
--- head/usr.sbin/nologin/nologin.8 Wed Apr 15 13:06:55 2020
(r359966)
+++ head/usr.sbin/nologin/nologin.8 Wed Apr 15 13:13:46 2020
(r359967)
@@ -28,7 +28,7 @@
 .\" @(#)nologin.8  8.1 (Berkeley) 6/19/93
 .\" $FreeBSD$
 .\"
-.Dd June 19, 1993
+.Dd April 15, 2020
 .Dt NOLOGIN 8
 .Os
 .Sh NAME
@@ -39,14 +39,31 @@
 .Sh DESCRIPTION
 The
 .Nm
-utility displays a message that an account is not available and
-exits non-zero.
-It is intended as a replacement shell field for accounts that
+is intended as a replacement shell field for accounts that
 have been disabled.
 .Pp
+When executed,
+.Nm
+first writes about the login attempt to
+.Xr syslog 3
+and then a displays a message that an account is not available.
+.Pp
 To disable all logins,
 investigate
 .Xr nologin 5 .
+.Sh EXIT STATUS
+The
+.Nm
+utility always exits non-zero.
+.Sh EXAMPLES
+Here is a demonstration of executing
+.Nm :
+.Bd -literal -offset 4n
+$ nologin
+This account is currently not available.
+$ tail -n 1 /var/log/messages
+Mar 30 21:53:07 example.org nologin[65992]: Attempted login by beastie on 
/dev/pts/18
+.Ed
 .Sh SEE ALSO
 .Xr login 1 ,
 .Xr nologin 5
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r359966 - head/sys/ofed/drivers/infiniband/core

2020-04-15 Thread Alexander V. Chernikov
Author: melifaro
Date: Wed Apr 15 13:06:55 2020
New Revision: 359966
URL: https://svnweb.freebsd.org/changeset/base/359966

Log:
  Convert OFED rtable interactions to the new routing KPI.
  
  Reviewed by:  hselasky
  Differential Revision:https://reviews.freebsd.org/D24387

Modified:
  head/sys/ofed/drivers/infiniband/core/ib_addr.c
  head/sys/ofed/drivers/infiniband/core/ib_cma.c

Modified: head/sys/ofed/drivers/infiniband/core/ib_addr.c
==
--- head/sys/ofed/drivers/infiniband/core/ib_addr.c Wed Apr 15 13:02:13 
2020(r359965)
+++ head/sys/ofed/drivers/infiniband/core/ib_addr.c Wed Apr 15 13:06:55 
2020(r359966)
@@ -44,14 +44,17 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #include "core_priv.h"
 
@@ -275,11 +278,13 @@ static int addr4_resolve(struct sockaddr_in *src_in,
struct sockaddr_in dst_tmp = *dst_in;
in_port_t src_port;
struct sockaddr *saddr = NULL;
-   struct rtentry *rte;
+   struct nhop_object *nh;
struct ifnet *ifp;
int error;
int type;
 
+   NET_EPOCH_ASSERT();
+
/* set VNET, if any */
CURVNET_SET(addr->net);
 
@@ -293,8 +298,7 @@ static int addr4_resolve(struct sockaddr_in *src_in,
type |= ADDR_DST_ANY;
 
/*
-* Make sure the socket address length field
-* is set, else rtalloc1() will fail.
+* Make sure the socket address length field is set.
 */
dst_tmp.sin_len = sizeof(dst_tmp);
 
@@ -303,16 +307,11 @@ static int addr4_resolve(struct sockaddr_in *src_in,
case ADDR_VALID:
case ADDR_SRC_ANY:
/* regular destination route lookup */
-   rte = rtalloc1((struct sockaddr *)_tmp, 1, 0);
-   if (rte == NULL) {
+   nh = fib4_lookup(RT_DEFAULT_FIB, dst_tmp.sin_addr,0,NHR_NONE,0);
+   if (nh == NULL) {
error = EHOSTUNREACH;
goto done;
-   } else if (rte->rt_ifp == NULL || RT_LINK_IS_UP(rte->rt_ifp) == 
0) {
-   RTFREE_LOCKED(rte);
-   error = EHOSTUNREACH;
-   goto done;
}
-   RT_UNLOCK(rte);
break;
default:
error = ENETUNREACH;
@@ -332,14 +331,14 @@ static int addr4_resolve(struct sockaddr_in *src_in,
/* check source interface */
if (ifp == NULL) {
error = ENETUNREACH;
-   goto error_rt_free;
+   goto done;
} else if (ifp->if_flags & IFF_LOOPBACK) {
/*
 * Source address cannot be a loopback device.
 */
error = EHOSTUNREACH;
goto error_put_ifp;
-   } else if (rte->rt_ifp->if_flags & IFF_LOOPBACK) {
+   } else if (nh->nh_ifp->if_flags & IFF_LOOPBACK) {
if (memcmp(_in->sin_addr, _in->sin_addr,
sizeof(src_in->sin_addr))) {
/*
@@ -352,9 +351,9 @@ static int addr4_resolve(struct sockaddr_in *src_in,
}
/* get destination network interface from route */
dev_put(ifp);
-   ifp = rte->rt_ifp;
+   ifp = nh->nh_ifp;
dev_hold(ifp);
-   } else if (ifp != rte->rt_ifp) {
+   } else if (ifp != nh->nh_ifp) {
/*
 * Source and destination interfaces are
 * different.
@@ -365,13 +364,13 @@ static int addr4_resolve(struct sockaddr_in *src_in,
break;
case ADDR_SRC_ANY:
/* check for loopback device */
-   if (rte->rt_ifp->if_flags & IFF_LOOPBACK)
+   if (nh->nh_ifp->if_flags & IFF_LOOPBACK)
saddr = (struct sockaddr *)_tmp;
else
-   saddr = rte->rt_ifa->ifa_addr;
+   saddr = nh->nh_ifa->ifa_addr;
 
/* get destination network interface from route */
-   ifp = rte->rt_ifp;
+   ifp = nh->nh_ifp;
dev_hold(ifp);
break;
default:
@@ -386,7 +385,7 @@ static int addr4_resolve(struct sockaddr_in *src_in,
ifp->if_addrlen, MAX_ADDR_LEN);
error = 0;
} else if (IN_MULTICAST(ntohl(dst_tmp.sin_addr.s_addr))) {
-   bool is_gw = (rte->rt_flags & RTF_GATEWAY) != 0;
+   bool is_gw = (nh->nh_flags & NHF_GATEWAY) != 0;
error = addr_resolve_multi(edst, 

svn commit: r359965 - head/sys/dev/mmc

2020-04-15 Thread Emmanuel Vadot
Author: manu
Date: Wed Apr 15 13:02:13 2020
New Revision: 359965
URL: https://svnweb.freebsd.org/changeset/base/359965

Log:
  mmc_fdt_helpers: Do not schedule a card detection is there is no cd gpio
  
  If the fdt node doesn't have a cd-gpios properties or if the node is set
  as non-removable we do not init the card detection timeout task as it is
  useless so don't schedule it too.
  
  MFC after:1 month
  X-MFC-With:   r359924

Modified:
  head/sys/dev/mmc/mmc_fdt_helpers.c

Modified: head/sys/dev/mmc/mmc_fdt_helpers.c
==
--- head/sys/dev/mmc/mmc_fdt_helpers.c  Wed Apr 15 13:00:48 2020
(r359964)
+++ head/sys/dev/mmc/mmc_fdt_helpers.c  Wed Apr 15 13:02:13 2020
(r359965)
@@ -217,7 +217,7 @@ cd_card_task(void *arg, int pending __unused)
 /*
  * Card detect setup.
  */
-static void
+static bool
 cd_setup(struct mmc_fdt_helper *helper, phandle_t node)
 {
int pincaps;
@@ -233,7 +233,7 @@ cd_setup(struct mmc_fdt_helper *helper, phandle_t node
helper->cd_disabled = true;
if (bootverbose)
device_printf(dev, "Non-removable media\n");
-   return;
+   return (false);
}
 
/*
@@ -246,14 +246,14 @@ cd_setup(struct mmc_fdt_helper *helper, phandle_t node
 */
if (gpio_pin_get_by_ofw_property(dev, node, "cd-gpios",
>cd_pin))
-   return;
+   return (false);
 
if (gpio_pin_getcaps(helper->cd_pin, ) != 0 ||
!(pincaps & GPIO_PIN_INPUT)) {
device_printf(dev, "Cannot read card-detect gpio pin; "
"setting card-always-present flag.\n");
helper->cd_disabled = true;
-   return;
+   return (false);
}
 
/*
@@ -313,6 +313,8 @@ without_interrupts:
device_get_nameunit(helper->cd_pin->dev), 
helper->cd_pin->pin,
cd_mode_str);
}
+
+   return (true);
 }
 
 /*
@@ -354,14 +356,16 @@ mmc_fdt_gpio_setup(device_t dev, phandle_t node, struc
 
helper->dev = dev;
helper->cd_handler = handler;
-   cd_setup(helper, node);
wp_setup(helper, node);
 
-   /* 
-* Schedule a card detection
-*/
-   taskqueue_enqueue_timeout_sbt(taskqueue_swi_giant,
-   >cd_delayed_task, mstosbt(500), 0, C_PREL(2));
+   if (cd_setup(helper, node)) {
+   /* 
+* Schedule a card detection
+*/
+   taskqueue_enqueue_timeout_sbt(taskqueue_swi_giant,
+   >cd_delayed_task, mstosbt(500), 0, C_PREL(2));
+   }
+
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: r359964 - head/sys/netpfil/pf

2020-04-15 Thread Alexander V. Chernikov
Author: melifaro
Date: Wed Apr 15 13:00:48 2020
New Revision: 359964
URL: https://svnweb.freebsd.org/changeset/base/359964

Log:
  Convert pf rtable checks to the new routing KPI.
  
  Switch uRPF to use specific fib(9)-provided uRPF.
  Switch MSS calculation to the latest fib(9) kpi.
  
  Reviewed by:  kp
  Differential Revision:https://reviews.freebsd.org/D24386

Modified:
  head/sys/netpfil/pf/pf.c

Modified: head/sys/netpfil/pf/pf.c
==
--- head/sys/netpfil/pf/pf.cWed Apr 15 12:56:05 2020(r359963)
+++ head/sys/netpfil/pf/pf.cWed Apr 15 13:00:48 2020(r359964)
@@ -69,7 +69,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
@@ -3176,31 +3176,32 @@ pf_get_mss(struct mbuf *m, int off, u_int16_t th_off, 
 static u_int16_t
 pf_calc_mss(struct pf_addr *addr, sa_family_t af, int rtableid, u_int16_t 
offer)
 {
-#ifdef INET
-   struct nhop4_basic  nh4;
-#endif /* INET */
+   struct nhop_object *nh;
 #ifdef INET6
-   struct nhop6_basic  nh6;
struct in6_addr dst6;
uint32_tscopeid;
 #endif /* INET6 */
int  hlen = 0;
uint16_t mss = 0;
 
+   NET_EPOCH_ASSERT();
+
switch (af) {
 #ifdef INET
case AF_INET:
hlen = sizeof(struct ip);
-   if (fib4_lookup_nh_basic(rtableid, addr->v4, 0, 0, ) == 0)
-   mss = nh4.nh_mtu - hlen - sizeof(struct tcphdr);
+   nh = fib4_lookup(rtableid, addr->v4, 0, 0, 0);
+   if (nh != NULL)
+   mss = nh->nh_mtu - hlen - sizeof(struct tcphdr);
break;
 #endif /* INET */
 #ifdef INET6
case AF_INET6:
hlen = sizeof(struct ip6_hdr);
in6_splitscope(>v6, , );
-   if (fib6_lookup_nh_basic(rtableid, , scopeid, 0,0,)==0)
-   mss = nh6.nh_mtu - hlen - sizeof(struct tcphdr);
+   nh = fib6_lookup(rtableid, , scopeid, 0, 0);
+   if (nh != NULL)
+   mss = nh->nh_mtu - hlen - sizeof(struct tcphdr);
break;
 #endif /* INET6 */
}
@@ -5338,122 +5339,12 @@ pf_pull_hdr(struct mbuf *m, int off, void *p, int len,
return (p);
 }
 
-#ifdef RADIX_MPATH
-static int
-pf_routable_oldmpath(struct pf_addr *addr, sa_family_t af, struct pfi_kif *kif,
-int rtableid)
-{
-   struct radix_node_head  *rnh;
-   struct sockaddr_in  *dst;
-   int  ret = 1;
-   int  check_mpath;
-#ifdef INET6
-   struct sockaddr_in6 *dst6;
-   struct route_in6 ro;
-#else
-   struct route ro;
-#endif
-   struct radix_node   *rn;
-   struct rtentry  *rt;
-   struct ifnet*ifp;
-
-   check_mpath = 0;
-   /* XXX: stick to table 0 for now */
-   rnh = rt_tables_get_rnh(0, af);
-   if (rnh != NULL && rn_mpath_capable(rnh))
-   check_mpath = 1;
-   bzero(, sizeof(ro));
-   switch (af) {
-   case AF_INET:
-   dst = satosin(_dst);
-   dst->sin_family = AF_INET;
-   dst->sin_len = sizeof(*dst);
-   dst->sin_addr = addr->v4;
-   break;
-#ifdef INET6
-   case AF_INET6:
-   /*
-* Skip check for addresses with embedded interface scope,
-* as they would always match anyway.
-*/
-   if (IN6_IS_SCOPE_EMBED(>v6))
-   goto out;
-   dst6 = (struct sockaddr_in6 *)_dst;
-   dst6->sin6_family = AF_INET6;
-   dst6->sin6_len = sizeof(*dst6);
-   dst6->sin6_addr = addr->v6;
-   break;
-#endif /* INET6 */
-   default:
-   return (0);
-   }
-
-   /* Skip checks for ipsec interfaces */
-   if (kif != NULL && kif->pfik_ifp->if_type == IFT_ENC)
-   goto out;
-
-   switch (af) {
-#ifdef INET6
-   case AF_INET6:
-   in6_rtalloc_ign(, 0, rtableid);
-   break;
-#endif
-#ifdef INET
-   case AF_INET:
-   in_rtalloc_ign((struct route *), 0, rtableid);
-   break;
-#endif
-   }
-
-   if (ro.ro_rt != NULL) {
-   /* No interface given, this is a no-route check */
-   if (kif == NULL)
-   goto out;
-
-   if (kif->pfik_ifp == NULL) {
-   ret = 0;
-   goto out;
-   }
-
-   /* Perform uRPF check if passed input interface */
-   ret = 0;
-   rn = (struct radix_node *)ro.ro_rt;
-   do {
-   rt = (struct rtentry *)rn;
-   ifp = rt->rt_ifp;
-
-   if 

svn commit: r359963 - head/sys/netinet6

2020-04-15 Thread Alexander V. Chernikov
Author: melifaro
Date: Wed Apr 15 12:56:05 2020
New Revision: 359963
URL: https://svnweb.freebsd.org/changeset/base/359963

Log:
  Convert ip6_forward() to the new routing KPI.
  
  Update ip6_forward() internals to use deembedded IPv6 addresses
   to simplify calls to the new KPI and prepare for the future
   scope-embedding cleanup.
  
  Add in6_get_unicast_scopeid() and in6_set_unicast_scopeid() scopeid
   operation functions tailored for unicast processing.
  
  Reviewed by:  ae
  Differential Revision:https://reviews.freebsd.org/D24334

Modified:
  head/sys/netinet6/ip6_forward.c
  head/sys/netinet6/scope6.c
  head/sys/netinet6/scope6_var.h

Modified: head/sys/netinet6/ip6_forward.c
==
--- head/sys/netinet6/ip6_forward.c Wed Apr 15 10:20:18 2020
(r359962)
+++ head/sys/netinet6/ip6_forward.c Wed Apr 15 12:56:05 2020
(r359963)
@@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -65,6 +66,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -90,14 +92,13 @@ void
 ip6_forward(struct mbuf *m, int srcrt)
 {
struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *);
-   struct sockaddr_in6 *dst = NULL;
-   struct rtentry *rt = NULL;
-   struct route_in6 rin6;
+   struct sockaddr_in6 dst;
+   struct nhop_object *nh = NULL;
int error, type = 0, code = 0;
struct mbuf *mcopy = NULL;
struct ifnet *origifp;  /* maybe unnecessary */
u_int32_t inzone, outzone;
-   struct in6_addr src_in6, dst_in6, odst;
+   struct in6_addr odst;
struct m_tag *fwd_tag;
char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN];
 
@@ -165,18 +166,27 @@ ip6_forward(struct mbuf *m, int srcrt)
/* No IPsec processing required */
}
 #endif
+   /*
+* ip6_forward() operates with IPv6 addresses with deembedded scope.
+*
+* There are 3 sources of IPv6 destination address:
+*
+* 1) ip6_input(), where ip6_dst contains deembedded address.
+*   In order to deal with forwarding of link-local packets,
+*   calculate the scope based on input interface (RFC 4007, clause 9).
+* 2) packet filters changing ip6_dst directly. It would embed scope
+*   for LL addresses, so in6_localip() performs properly.
+* 3) packet filters attaching PACKET_TAG_IPFORWARD would embed
+*   scope for the nexthop.
+*/
+   bzero(, sizeof(struct sockaddr_in6));
+   dst.sin6_family = AF_INET6;
+   dst.sin6_addr = ip6->ip6_dst;
+   dst.sin6_scope_id = in6_get_unicast_scopeid(>ip6_dst, 
m->m_pkthdr.rcvif);
 again:
-   bzero(, sizeof(struct route_in6));
-   dst = (struct sockaddr_in6 *)_dst;
-   dst->sin6_len = sizeof(struct sockaddr_in6);
-   dst->sin6_family = AF_INET6;
-   dst->sin6_addr = ip6->ip6_dst;
-again2:
-   rin6.ro_rt = in6_rtalloc1((struct sockaddr *)dst, 0, 0, M_GETFIB(m));
-   rt = rin6.ro_rt;
-   if (rin6.ro_rt != NULL)
-   RT_UNLOCK(rin6.ro_rt);
-   else {
+   nh = fib6_lookup(M_GETFIB(m), _addr, dst.sin6_scope_id,
+   NHR_REF, m->m_pkthdr.flowid);
+   if (nh == NULL) {
IP6STAT_INC(ip6s_noroute);
in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_noroute);
if (mcopy) {
@@ -191,26 +201,15 @@ again2:
 * destination for the reason that the destination is beyond the scope
 * of the source address, discard the packet and return an icmp6
 * destination unreachable error with Code 2 (beyond scope of source
-* address).  We use a local copy of ip6_src, since in6_setscope()
-* will possibly modify its first argument.
+* address).
 * [draft-ietf-ipngwg-icmp-v3-04.txt, Section 3.1]
 */
-   src_in6 = ip6->ip6_src;
-   if (in6_setscope(_in6, rt->rt_ifp, )) {
-   /* XXX: this should not happen */
-   IP6STAT_INC(ip6s_cantforward);
-   IP6STAT_INC(ip6s_badscope);
-   goto bad;
-   }
-   if (in6_setscope(_in6, m->m_pkthdr.rcvif, )) {
-   IP6STAT_INC(ip6s_cantforward);
-   IP6STAT_INC(ip6s_badscope);
-   goto bad;
-   }
+   outzone = in6_get_unicast_scopeid(>ip6_src, nh->nh_ifp);
+   inzone = in6_get_unicast_scopeid(>ip6_src, m->m_pkthdr.rcvif);
if (inzone != outzone) {
IP6STAT_INC(ip6s_cantforward);
IP6STAT_INC(ip6s_badscope);
-   in6_ifstat_inc(rt->rt_ifp, ifs6_in_discard);
+   in6_ifstat_inc(nh->nh_ifp, ifs6_in_discard);
 
if (V_ip6_log_time + V_ip6_log_interval < time_uptime) {
V_ip6_log_time = time_uptime;
@@ -220,7 +219,7 @@ again2:

Re: svn commit: r359949 - head/usr.sbin/bhyve

2020-04-15 Thread Shawn Webb
On Wed, Apr 15, 2020 at 01:58:51AM +, Conrad Meyer wrote:
> Author: cem
> Date: Wed Apr 15 01:58:51 2020
> New Revision: 359949
> URL: https://svnweb.freebsd.org/changeset/base/359949
> 
> Log:
>   bhyve(8): Add bootrom allocation abstraction
>   
>   To allow more general use of the bootrom region, separate initialization 
> from
>   allocation, and allocation from loading a file.
>   
>   The bootrom segment is the high 16MB of the low 4GB region.
>   
>   Each allocation in the segment creates a new mapping with specified 
> protection.
>   By default, allocation begins at the low end of the range.  However, the
>   BOOTROM_ALLOC_TOP flag is provided to locate a provided bootrom in the high
>   region it is expected to be in.
>   
>   The existing ROM-file loading code is refactored to use the new interface.
>   
>   Reviewed by:grehan (earlier version)
>   Differential Revision:  https://reviews.freebsd.org/D24422

Hey Conrad,

Is there any way you'd have a change of heart and support MFC'ing? I'm
sure many people, including myself, would be ever so grateful not to
have to maintain their own MFC's of your work.

Thanks,

-- 
Shawn Webb
Cofounder / Security Engineer
HardenedBSD

GPG Key ID:  0xFF2E67A277F8E1FA
GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9  3633 C85B 0AF8 AB23 0FB2
https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc


signature.asc
Description: PGP signature


svn commit: r359962 - head/usr.bin/calendar/calendars

2020-04-15 Thread Hiroki Tagato
Author: tagattie (ports committer)
Date: Wed Apr 15 10:20:18 2020
New Revision: 359962
URL: https://svnweb.freebsd.org/changeset/base/359962

Log:
  Add my birthday
  
  Approved by:  ehaupt (mentor)

Modified:
  head/usr.bin/calendar/calendars/calendar.freebsd

Modified: head/usr.bin/calendar/calendars/calendar.freebsd
==
--- head/usr.bin/calendar/calendars/calendar.freebsdWed Apr 15 08:18:28 
2020(r359961)
+++ head/usr.bin/calendar/calendars/calendar.freebsdWed Apr 15 10:20:18 
2020(r359962)
@@ -457,6 +457,7 @@
 12/05  Ivan Voras  born in Slavonski Brod, Croatia, 1981
 12/06  Stefan Farfeleder  born in Wien, Austria, 1980
 12/08  Michael Tuexen  born in Oldenburg, Germany, 1966
+12/10  Hiroki Tagato  born in Shiga, Japan, 1971
 12/11  Ganael Laplanche  born in Reims, France, 1980
 12/11  Koichiro Iwao  born in Oita, Japan, 1987
 12/15  James FitzGibbon  born in Amersham, Buckinghamshire, 
United Kingdom, 1974
___
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: r359961 - head

2020-04-15 Thread Jung-uk Kim
Author: jkim
Date: Wed Apr 15 08:18:28 2020
New Revision: 359961
URL: https://svnweb.freebsd.org/changeset/base/359961

Log:
  Do not attempt to remove backward compatibility timezones.
  
  Since r359736, these timezones are unconditionally installed.

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Wed Apr 15 08:11:19 2020(r359960)
+++ head/ObsoleteFiles.inc  Wed Apr 15 08:18:28 2020(r359961)
@@ -1685,8 +1685,6 @@ OLD_FILES+=lib/casper/libcap_sysctl.so.1
 # 20190509: tests/sys/opencrypto requires the net/py-dpkt package.
 OLD_FILES+=usr/tests/sys/opencrypto/dpkt.py
 OLD_FILES+=usr/tests/sys/opencrypto/dpkt.pyc
-# 20190326: tzdata 2019a import
-OLD_FILES+=usr/share/zoneinfo/Etc/UCT
 # 20190304: new libc++ import which bumps version from 7.0.1 to 8.0.0.
 OLD_FILES+=usr/include/c++/v1/experimental/dynarray
 # 20190304: new clang import which bumps version from 7.0.1 to 8.0.0.
@@ -5499,8 +5497,6 @@ OLD_FILES+=usr/lib32/libheimsqlite.a
 OLD_FILES+=usr/lib32/libheimsqlite.so
 OLD_LIBS+=usr/lib32/libheimsqlite.so.11
 OLD_FILES+=usr/lib32/libheimsqlite_p.a
-# 20150518: tzdata2015c update
-OLD_FILES+=usr/share/zoneinfo/America/Montreal
 # 20150506
 OLD_FILES+=usr/share/man/man9/NDHASGIANT.9.gz
 # 20150504
@@ -6004,10 +6000,6 @@ OLD_FILES+=etc/rc.d/hv_kvpd
 OLD_LIBS+=usr/lib/libnv.so.0
 # 20140829: rc.d/kerberos removed
 OLD_FILES+=etc/rc.d/kerberos
-# 20140827: tzdata2014f import
-OLD_FILES+=usr/share/zoneinfo/Asia/Chongqing
-OLD_FILES+=usr/share/zoneinfo/Asia/Harbin
-OLD_FILES+=usr/share/zoneinfo/Asia/Kashgar
 # 20140814: libopie version bump
 OLD_LIBS+=usr/lib/libopie.so.7
 OLD_LIBS+=usr/lib32/libopie.so.7
@@ -6298,9 +6290,6 @@ OLD_FILES+=usr/share/man/man2/extattr_get_list.2.gz
 # 20131107: example files removed
 OLD_FILES+=usr/share/examples/libusb20/aux.c
 OLD_FILES+=usr/share/examples/libusb20/aux.h
-# 20131105: tzdata 2013h import
-OLD_FILES+=usr/share/zoneinfo/America/Shiprock
-OLD_FILES+=usr/share/zoneinfo/Antarctica/South_Pole
 # 20131103: WITH_LIBICONV_COMPAT removal
 OLD_FILES+=usr/include/_libiconv_compat.h
 OLD_FILES+=usr/lib/libiconv.a
@@ -7243,9 +7232,6 @@ OLD_FILES+=usr/share/man/man3/ascftime.3.gz
 OLD_FILES+=usr/share/man/man3/cfree.3.gz
 OLD_FILES+=usr/share/man/man3/cftime.3.gz
 OLD_FILES+=usr/share/man/man3/getpw.3.gz
-# 20100801: tzdata2010k import
-OLD_FILES+=usr/share/zoneinfo/Pacific/Ponape
-OLD_FILES+=usr/share/zoneinfo/Pacific/Truk
 # 20100725: acpi_aiboost(4) removal.
 OLD_FILES+=usr/share/man/man4/acpi_aiboost.4.gz
 # 20100724: nfsclient/nfs_lock.h moved to nfs/nfs_lock.h
@@ -7922,8 +7908,6 @@ OLD_FILES+=usr/include/pccard/cis.h
 OLD_DIRS+=usr/include/pccard
 # 20090203: adding_user.8 moved to adding_user.7
 OLD_FILES+=usr/share/man/man8/adding_user.8.gz
-# 20090122: tzdata2009a import
-OLD_FILES+=usr/share/zoneinfo/Asia/Katmandu
 # 20090102: file 4.26 import
 OLD_FILES+=usr/share/misc/magic.mime
 OLD_FILES+=usr/share/misc/magic.mime.mgc
@@ -8156,9 +8140,6 @@ OLD_FILES+=usr/sbin/pkg_check
 OLD_FILES+=usr/sbin/pkg_sign
 OLD_FILES+=usr/share/man/man1/pkg_check.1.gz
 OLD_FILES+=usr/share/man/man1/pkg_sign.1.gz
-# 20080325: tzdata2008b import
-OLD_FILES+=usr/share/zoneinfo/Asia/Calcutta
-OLD_FILES+=usr/share/zoneinfo/Asia/Saigon
 # 20080314: stack_print(9) mlink fixed
 OLD_FILES+=usr/share/man/man9/stack_printf.9.gz
 # 20080312: libkse removal
@@ -10371,19 +10352,6 @@ OLD_FILES+=usr/share/misc/nslookup.help
 OLD_FILES+=usr/share/sendmail/cf/feature/nodns.m4
 OLD_FILES+=usr/share/syscons/keymaps/lat-amer.kbd
 OLD_FILES+=usr/share/vi/catalog/ru_SU.KOI8-R
-OLD_FILES+=usr/share/zoneinfo/Africa/Timbuktu
-OLD_FILES+=usr/share/zoneinfo/Africa/Asmera
-OLD_FILES+=usr/share/zoneinfo/America/Buenos_Aires
-OLD_FILES+=usr/share/zoneinfo/America/Cordoba
-OLD_FILES+=usr/share/zoneinfo/America/Jujuy
-OLD_FILES+=usr/share/zoneinfo/America/Catamarca
-OLD_FILES+=usr/share/zoneinfo/America/Mendoza
-OLD_FILES+=usr/share/zoneinfo/America/Indianapolis
-OLD_FILES+=usr/share/zoneinfo/America/Louisville
-OLD_FILES+=usr/share/zoneinfo/America/Argentina/ComodRivadavia
-OLD_FILES+=usr/share/zoneinfo/Atlantic/Faeroe
-OLD_FILES+=usr/share/zoneinfo/Europe/Belfast
-OLD_FILES+=usr/share/zoneinfo/Pacific/Yap
 OLD_FILES+=usr/share/zoneinfo/SystemV/YST9
 OLD_FILES+=usr/share/zoneinfo/SystemV/PST8
 OLD_FILES+=usr/share/zoneinfo/SystemV/EST5EDT
___
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: r359960 - stable/12/lib/geom/eli

2020-04-15 Thread Mateusz Piotrowski
Author: 0mp (doc,ports committer)
Date: Wed Apr 15 08:11:19 2020
New Revision: 359960
URL: https://svnweb.freebsd.org/changeset/base/359960

Log:
  MFC 359125:
  
  Document geli(8) loader variables conventions
  
  The geli(8) manual page has an example for preloading keyfiles during boot.
  There is no detail though on how the lookup of these variables actually
  works.
  
  Let's document that the name of a device does not have to be a part
  of the variable.
  
  PR:   243261
  Submitted by: johan...@jo-t.de
  Approved by:  bcr (mentor)
  Differential Revision:https://reviews.freebsd.org/D24114

Modified:
  stable/12/lib/geom/eli/geli.8
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/geom/eli/geli.8
==
--- stable/12/lib/geom/eli/geli.8   Wed Apr 15 05:55:14 2020
(r359959)
+++ stable/12/lib/geom/eli/geli.8   Wed Apr 15 08:11:19 2020
(r359960)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 23, 2019
+.Dd March 19, 2020
 .Dt GELI 8
 .Os
 .Sh NAME
@@ -988,6 +988,35 @@ geli_da1s3a_keyfile_load="YES"
 geli_da1s3a_keyfile_type="da1s3a:geli_keyfile"
 geli_da1s3a_keyfile_name="/boot/keys/da1s3a.key"
 .Ed
+.Pp
+By convention, these loader variables are called
+.Sm off
+.Va geli_ No < Ar device No > Va _load .
+.Sm on
+However, the actual name prefix before
+.Va _load , _type ,
+or
+.Va _name
+does not matter.
+At boot time, the
+.Nm
+module searches through all
+.Sm off
+.No < Va prefix No > Va _type No -like
+.Sm on
+variables that have a value of
+.Sm off
+.Dq < Ar device No > :geli_keyfile .
+.Sm on
+The paths to keyfiles are then extracted from
+.Sm off
+.No < Ar prefix No > Va _name
+.Sm on
+variables.
+In the example above,
+.Ar prefix
+is
+.Dq Li geli_da1s3a_keyfile .
 .Pp
 Not only configure encryption, but also data integrity verification using
 .Nm HMAC/SHA256 .
___
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"