Re: svn commit: r359374 - in head: . share/man/man4 share/man/man7 share/man/man9 sys/crypto/aesni sys/crypto/armv8 sys/crypto/blake2 sys/crypto/ccp sys/crypto/via sys/dev/cesa sys/dev/cxgbe sys/dev/c

2020-04-13 Thread John Baldwin
On 4/13/20 12:31 PM, Warner Losh wrote:
> On Mon, Apr 13, 2020 at 1:22 PM John-Mark Gurney  wrote:
> 
>> John Baldwin wrote this message on Mon, Apr 13, 2020 at 09:56 -0700:
>>> On 4/12/20 1:08 PM, Xin Li wrote:
>>>>
>>>>
>>>> On 3/27/20 11:25 AM, John Baldwin wrote:
>>>> [...]>   - Drivers no longer register a list of supported algorithms.
>> This
>>>>> doesn't quite work when you factor in modes (e.g. a driver might
>>>>> support both AES-CBC and SHA2-256-HMAC separately but not combined
>>>>> for ETA).  Instead, a new 'crypto_probesession' method has been
>>>>> added to the kobj interface for symmteric crypto drivers.  This
>>>>> method returns a negative value on success (similar to how
>>>>> device_probe works) and the crypto framework uses this value to
>> pick
>>>>> the "best" driver.  There are three constants for hardware
>>>>> (e.g. ccr), accelerated software (e.g. aesni), and plain software
>>>>> (cryptosoft) that give preference in that order.  One effect of
>> this
>>>>> is that if you request only hardware when creating a new session,
>>>>> you will no longer get a session using accelerated software.
>>>>> Another effect is that the default setting to disallow software
>>>>> crypto via /dev/crypto now disables accelerated software.
>>>>
>>>> For user-visible interface, it seems like we are essentially treating
>>>> "accelerated software" like AES-NI the same way of plain software.  For
>>>> example, geom_eli would now say:
>>>>
>>>> GEOM_ELI: Encryption: AES-XTS 128
>>>> GEOM_ELI: Crypto: software
>>>>
>>>> Instead of:
>>>>
>>>> GEOM_ELI: Encryption: AES-XTS 128
>>>> GEOM_ELI: Crypto: hardware
>>>>
>>>> When AES-NI is used (which is because we only have two bits to
>> represent
>>>> hardware and software, and have gave neither bits clear with its own
>>>> meaning (use specific driver)).
>>>>
>>>> If we are not going to add a new bit to represent accelerated software,
>>>> why are they categorized as software providers?  Technically, all these
>>>> still requires hardware that implements the cryptographic primitives to
>>>> work, and it's much easier for system administrators if we expose the
>>>> fact that they are using some kind of acceleration than asking them to
>>>> run DTrace etc. to find out.  Personally, I think it's probably better
>>>> to change the notion to either "accelerated" (by either hardware or
>>>> software) and "software"...
>>>
>>> The only case where this is visible is in fact GELI (there is no printf
>>> for IPsec or KTLS).  For /dev/crypto using aesni.ko is a bug, not a
>>> feature, as any such software would be much better off using AES-NI in
>>> userland instead of round-tripping through the kernel.  We could add a
>>> bit to appease the GELI printf, or we could just kill the GELI
>>> printf.  I think a more useful approach would probably be to kill the
>>> GELI printf and instead add something less GELI-specific such as
>>> counters of active sessions for the various cryptographic drivers that
>>> would show which drivers are in use for any in-kernel crypto.  This
>>> approach also lends itself to supporting a more flexible API where a
>>> single crypto session might be backed by multiple drivers where a
>>> binary hardware / software setting might not even make sense as you
>>> might have a mix.  (I know of other out-of-tree crypto use cases that
>>> experimented with splitting in-kernel crypto workloads between an
>>> async co-processor and AES-NI.)
>>
>> As long as there remains some what to warn the user that when they've
>> mounted a geli volume that they're using slow crypto, I'm fine...
>>
>> We have done a bad job on doing the right thing, and I'm afraid that
>> removing this print w/o doing something to address it will go from
>> FreeBSD already not doing the right thing, but to not allowing the user
>> to know that FreeBSD isn't doing the right thing.
>>
>> Even a simple print in the crypto driver when the processor supports
>> AES-NI, but the aesni module isn't loaded would be useful..
>>
>> Without the geli print, it's likely articles, like the recent A

Re: svn commit: r359374 - in head: . share/man/man4 share/man/man7 share/man/man9 sys/crypto/aesni sys/crypto/armv8 sys/crypto/blake2 sys/crypto/ccp sys/crypto/via sys/dev/cesa sys/dev/cxgbe sys/dev/c

2020-04-13 Thread John Baldwin
On 4/12/20 1:08 PM, Xin Li wrote:
> 
> 
> On 3/27/20 11:25 AM, John Baldwin wrote:
> [...]>   - Drivers no longer register a list of supported algorithms.  This
>> doesn't quite work when you factor in modes (e.g. a driver might
>> support both AES-CBC and SHA2-256-HMAC separately but not combined
>> for ETA).  Instead, a new 'crypto_probesession' method has been
>> added to the kobj interface for symmteric crypto drivers.  This
>> method returns a negative value on success (similar to how
>> device_probe works) and the crypto framework uses this value to pick
>> the "best" driver.  There are three constants for hardware
>> (e.g. ccr), accelerated software (e.g. aesni), and plain software
>> (cryptosoft) that give preference in that order.  One effect of this
>> is that if you request only hardware when creating a new session,
>> you will no longer get a session using accelerated software.
>> Another effect is that the default setting to disallow software
>> crypto via /dev/crypto now disables accelerated software.
> 
> For user-visible interface, it seems like we are essentially treating
> "accelerated software" like AES-NI the same way of plain software.  For
> example, geom_eli would now say:
> 
> GEOM_ELI: Encryption: AES-XTS 128
> GEOM_ELI: Crypto: software
> 
> Instead of:
> 
> GEOM_ELI: Encryption: AES-XTS 128
> GEOM_ELI: Crypto: hardware
> 
> When AES-NI is used (which is because we only have two bits to represent
> hardware and software, and have gave neither bits clear with its own
> meaning (use specific driver)).
> 
> If we are not going to add a new bit to represent accelerated software,
> why are they categorized as software providers?  Technically, all these
> still requires hardware that implements the cryptographic primitives to
> work, and it's much easier for system administrators if we expose the
> fact that they are using some kind of acceleration than asking them to
> run DTrace etc. to find out.  Personally, I think it's probably better
> to change the notion to either "accelerated" (by either hardware or
> software) and "software"...

The only case where this is visible is in fact GELI (there is no printf
for IPsec or KTLS).  For /dev/crypto using aesni.ko is a bug, not a
feature, as any such software would be much better off using AES-NI in
userland instead of round-tripping through the kernel.  We could add a
bit to appease the GELI printf, or we could just kill the GELI
printf.  I think a more useful approach would probably be to kill the
GELI printf and instead add something less GELI-specific such as
counters of active sessions for the various cryptographic drivers that
would show which drivers are in use for any in-kernel crypto.  This
approach also lends itself to supporting a more flexible API where a
single crypto session might be backed by multiple drivers where a
binary hardware / software setting might not even make sense as you
might have a mix.  (I know of other out-of-tree crypto use cases that
experimented with splitting in-kernel crypto workloads between an
async co-processor and AES-NI.)

Also, while AES-NI instructions are faster than plain C, they are still
very much software rather than an engine like QAT or ccr(4).  They run
synchronously using host CPU cycles rather than async on a separate
co-processor.  This means that if you tweak the various geli sysctls for
batching vs non-batching, etc. you need to make the same choices for
both accelerated software and "plain" software vs possibly different
choices for an async co-processor.

-- 
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: r359788 - head

2020-04-10 Thread John Baldwin
Author: jhb
Date: Fri Apr 10 23:13:29 2020
New Revision: 359788
URL: https://svnweb.freebsd.org/changeset/base/359788

Log:
  Document removal of deprecated algorithms for in-kernel GSS.

Modified:
  head/RELNOTES

Modified: head/RELNOTES
==
--- head/RELNOTES   Fri Apr 10 23:10:28 2020(r359787)
+++ head/RELNOTES   Fri Apr 10 23:13:29 2020(r359788)
@@ -10,6 +10,10 @@ newline.  Entries should be separated by a newline.
 
 Changes to this file should not be MFCed.
 
+r359786-r359787:
+   Remove support for DES, Triple DES, and RC4 from in-kernel GSS
+   authentication.
+
 r357627:
remove elf2aout.
 
___
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: r359787 - head/usr.sbin/gssd

2020-04-10 Thread John Baldwin
Author: jhb
Date: Fri Apr 10 23:10:28 2020
New Revision: 359787
URL: https://svnweb.freebsd.org/changeset/base/359787

Log:
  Remove the -o option from gssd(8).
  
  This uses DES and the kernel no longer supports DES for in-kernel GSS.
  
  Reviewed by:  kp
  Relnotes: yes
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D24345

Modified:
  head/usr.sbin/gssd/gssd.8
  head/usr.sbin/gssd/gssd.c

Modified: head/usr.sbin/gssd/gssd.8
==
--- head/usr.sbin/gssd/gssd.8   Fri Apr 10 23:08:41 2020(r359786)
+++ head/usr.sbin/gssd/gssd.8   Fri Apr 10 23:10:28 2020(r359787)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 7, 2013
+.Dd April 10 2020
 .Dt GSSD 8
 .Os
 .Sh NAME
@@ -35,7 +35,6 @@
 .Nm
 .Op Fl d
 .Op Fl h
-.Op Fl o
 .Op Fl v
 .Op Fl s Ar dir-list
 .Op Fl c Ar file-substring
@@ -61,10 +60,6 @@ gssname
 option for the
 .Xr mount_nfs 8
 command.
-.It Fl o
-Force use of DES and the associated old style GSS-API initialization token.
-This may be required to make kerberized NFS mounts work against some
-non-FreeBSD NFS servers.
 .It Fl v
 Run in verbose mode.
 In this mode,

Modified: head/usr.sbin/gssd/gssd.c
==
--- head/usr.sbin/gssd/gssd.c   Fri Apr 10 23:08:41 2020(r359786)
+++ head/usr.sbin/gssd/gssd.c   Fri Apr 10 23:10:28 2020(r359787)
@@ -77,7 +77,6 @@ int debug_level;
 static char ccfile_dirlist[PATH_MAX + 1], ccfile_substring[NAME_MAX + 1];
 static char pref_realm[1024];
 static int verbose;
-static int use_old_des;
 static int hostbased_initiator_cred;
 #ifndef WITHOUT_KERBEROS
 /* 1.2.752.43.13.14 */
@@ -125,7 +124,7 @@ main(int argc, char **argv)
pref_realm[0] = '\0';
debug = 0;
verbose = 0;
-   while ((ch = getopt(argc, argv, "dhovs:c:r:")) != -1) {
+   while ((ch = getopt(argc, argv, "dhvs:c:r:")) != -1) {
switch (ch) {
case 'd':
debug_level++;
@@ -142,17 +141,6 @@ main(int argc, char **argv)
" without MK_KERBEROS\n");
 #endif
break;
-   case 'o':
-#ifndef WITHOUT_KERBEROS
-   /*
-* Force use of DES and the old type of GSSAPI token.
-*/
-   use_old_des = 1;
-#else
-   errx(1, "This option not available when built"
-   " without MK_KERBEROS\n");
-#endif
-   break;
case 'v':
verbose = 1;
break;
@@ -483,44 +471,6 @@ gssd_init_sec_context_1_svc(init_sec_context_args *arg
}
gotcred = 0;
 
-#ifndef WITHOUT_KERBEROS
-   if (use_old_des != 0) {
-   if (cred == GSS_C_NO_CREDENTIAL) {
-   /* Acquire a credential for the uid. */
-   maj_stat = gssd_get_user_cred(_stat, argp->uid,
-   );
-   if (maj_stat == GSS_S_COMPLETE)
-   gotcred = 1;
-   else
-   gssd_verbose_out("gssd_init_sec_context: "
-   "get user cred failed uid=%d major=0x%x "
-   "minor=%d\n", (int)argp->uid,
-   (unsigned int)maj_stat, (int)min_stat);
-   }
-   if (cred != GSS_C_NO_CREDENTIAL) {
-   key_enctype = ETYPE_DES_CBC_CRC;
-   enctype[0] = (key_enctype >> 24) & 0xff;
-   enctype[1] = (key_enctype >> 16) & 0xff;
-   enctype[2] = (key_enctype >> 8) & 0xff;
-   enctype[3] = key_enctype & 0xff;
-   principal_desc.length = sizeof(enctype);
-   principal_desc.value = enctype;
-   result->major_status = gss_set_cred_option(
-   >minor_status, ,
-   GSS_KRB5_SET_ALLOWABLE_ENCTYPES_X,
-   _desc);
-   gssd_verbose_out("gssd_init_sec_context: set allowable "
-   "enctype major=0x%x minor=%d\n",
-   (unsigned int)result->major_status,
-   (int)result->minor_status);
-   if (result->major_status != GSS_S_COMPLETE) {
-   if (gotcred != 0)
-   gss_release_cred(_stat, );
-   return (TRUE);
-   }
-   }
-   }
-#endif
result->major_status = gss_init_sec_context(>minor_status,
cred, , name, argp->mech_type,
argp->req_flags, argp->time_req, 

svn commit: r359786 - in head/sys: conf kgssapi/krb5 modules/kgssapi_krb5

2020-04-10 Thread John Baldwin
Author: jhb
Date: Fri Apr 10 23:08:41 2020
New Revision: 359786
URL: https://svnweb.freebsd.org/changeset/base/359786

Log:
  Remove support for Kernel GSS algorithms deprecated in r348875.
  
  This removes support for using DES, Triple DES, and RC4.
  
  Reviewed by:  cem, kp
  Tested by:kp
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D24344

Deleted:
  head/sys/kgssapi/krb5/kcrypto_arcfour.c
  head/sys/kgssapi/krb5/kcrypto_des.c
  head/sys/kgssapi/krb5/kcrypto_des3.c
Modified:
  head/sys/conf/files
  head/sys/kgssapi/krb5/kcrypto.c
  head/sys/kgssapi/krb5/kcrypto.h
  head/sys/modules/kgssapi_krb5/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Fri Apr 10 22:42:14 2020(r359785)
+++ head/sys/conf/files Fri Apr 10 23:08:41 2020(r359786)
@@ -3945,9 +3945,6 @@ kgssapi/gssd_prot.c   optional kgssapi
 kgssapi/krb5/krb5_mech.c   optional kgssapi
 kgssapi/krb5/kcrypto.c optional kgssapi
 kgssapi/krb5/kcrypto_aes.c optional kgssapi
-kgssapi/krb5/kcrypto_arcfour.c optional kgssapi
-kgssapi/krb5/kcrypto_des.c optional kgssapi
-kgssapi/krb5/kcrypto_des3.coptional kgssapi
 kgssapi/kgss_if.m  optional kgssapi
 kgssapi/gsstest.c  optional kgssapi_debug
 # These files in libkern/ are those needed by all architectures.  Some

Modified: head/sys/kgssapi/krb5/kcrypto.c
==
--- head/sys/kgssapi/krb5/kcrypto.c Fri Apr 10 22:42:14 2020
(r359785)
+++ head/sys/kgssapi/krb5/kcrypto.c Fri Apr 10 23:08:41 2020
(r359786)
@@ -42,19 +42,10 @@ __FBSDID("$FreeBSD$");
 #include "kcrypto.h"
 
 static struct krb5_encryption_class *krb5_encryption_classes[] = {
-   _des_encryption_class,
-   _des3_encryption_class,
_aes128_encryption_class,
_aes256_encryption_class,
-   _arcfour_encryption_class,
-   _arcfour_56_encryption_class,
NULL
 };
-
-struct timeval krb5_warn_interval = { .tv_sec = 3600, .tv_usec = 0 };
-SYSCTL_TIMEVAL_SEC(_kern, OID_AUTO, kgssapi_warn_interval, CTLFLAG_RW,
-_warn_interval,
-"Delay in seconds between warnings of deprecated KGSSAPI crypto.");
 
 struct krb5_encryption_class *
 krb5_find_encryption_class(int etype)

Modified: head/sys/kgssapi/krb5/kcrypto.h
==
--- head/sys/kgssapi/krb5/kcrypto.h Fri Apr 10 22:42:14 2020
(r359785)
+++ head/sys/kgssapi/krb5/kcrypto.h Fri Apr 10 23:08:41 2020
(r359786)
@@ -95,13 +95,8 @@ struct krb5_key_state {
void*ks_priv;
 };
 
-extern struct krb5_encryption_class krb5_des_encryption_class;
-extern struct krb5_encryption_class krb5_des3_encryption_class;
 extern struct krb5_encryption_class krb5_aes128_encryption_class;
 extern struct krb5_encryption_class krb5_aes256_encryption_class;
-extern struct krb5_encryption_class krb5_arcfour_encryption_class;
-extern struct krb5_encryption_class krb5_arcfour_56_encryption_class;
-extern struct timeval krb5_warn_interval;
 
 static __inline void
 krb5_set_key(struct krb5_key_state *ks, const void *keydata)

Modified: head/sys/modules/kgssapi_krb5/Makefile
==
--- head/sys/modules/kgssapi_krb5/Makefile  Fri Apr 10 22:42:14 2020
(r359785)
+++ head/sys/modules/kgssapi_krb5/Makefile  Fri Apr 10 23:08:41 2020
(r359786)
@@ -5,10 +5,7 @@ KMOD=  kgssapi_krb5
 
 SRCS=  krb5_mech.c \
kcrypto.c \
-   kcrypto_des.c \
-   kcrypto_des3.c \
kcrypto_aes.c \
-   kcrypto_arcfour.c \
opt_inet6.h
 
 SRCS+= kgss_if.h gssd.h
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r359784 - in head/sys/dev/cxgbe: . crypto

2020-04-10 Thread John Baldwin
On 4/10/20 3:27 PM, John Baldwin wrote:
> Author: jhb
> Date: Fri Apr 10 22:27:45 2020
> New Revision: 359784
> URL: https://svnweb.freebsd.org/changeset/base/359784
> 
> Log:
>   Use both crypto engines on a T6.
>   
>   A T6 adapter contains two crypto engines on separate channels.  This
>   commit distributes sessions between the two engines.  Previously, only
>   the first engine was used.

In some simple benchmarks using KTLS with the traffic flowing over
one of the ports (cc0) of the same NIC ccr0 was on, throughput increased
from ~41 Gbps to 45 Gbps with this change (albeit with CPU usage increase
from 70% to 80%).

In addition, this commit adds a 'dev.ccr..port_mask' sysctl which
controls which ports are enabled for new sessions.  Setting this to '2'
during this test to force all crypto requests to use the crypto engine
associated with the channel for cc1 (which was not being used to send any
traffic) further increased the throughput to around 48 Gbps while using
the same amount of CPU.

-- 
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: r359784 - in head/sys/dev/cxgbe: . crypto

2020-04-10 Thread John Baldwin
Author: jhb
Date: Fri Apr 10 22:27:45 2020
New Revision: 359784
URL: https://svnweb.freebsd.org/changeset/base/359784

Log:
  Use both crypto engines on a T6.
  
  A T6 adapter contains two crypto engines on separate channels.  This
  commit distributes sessions between the two engines.  Previously, only
  the first engine was used.
  
  Reviewed by:  np
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D24347

Modified:
  head/sys/dev/cxgbe/adapter.h
  head/sys/dev/cxgbe/crypto/t4_crypto.c

Modified: head/sys/dev/cxgbe/adapter.h
==
--- head/sys/dev/cxgbe/adapter.hFri Apr 10 22:18:30 2020
(r359783)
+++ head/sys/dev/cxgbe/adapter.hFri Apr 10 22:27:45 2020
(r359784)
@@ -600,9 +600,7 @@ struct sge_rxq {
struct sge_fl fl;   /* MUST follow iq */
 
struct ifnet *ifp;  /* the interface this rxq belongs to */
-#if defined(INET) || defined(INET6)
struct lro_ctrl lro;/* LRO state */
-#endif
 
/* stats for common events first */
 

Modified: head/sys/dev/cxgbe/crypto/t4_crypto.c
==
--- head/sys/dev/cxgbe/crypto/t4_crypto.c   Fri Apr 10 22:18:30 2020
(r359783)
+++ head/sys/dev/cxgbe/crypto/t4_crypto.c   Fri Apr 10 22:27:45 2020
(r359784)
@@ -162,10 +162,18 @@ struct ccr_session_blkcipher {
char deckey[CHCR_AES_MAX_KEY_LEN];
 };
 
+struct ccr_port {
+   struct sge_wrq *txq;
+   struct sge_rxq *rxq;
+   int tx_channel_id;
+   u_int active_sessions;
+};
+
 struct ccr_session {
bool active;
int pending;
enum { HASH, HMAC, BLKCIPHER, ETA, GCM, CCM } mode;
+   struct ccr_port *port;
union {
struct ccr_session_hmac hmac;
struct ccr_session_gmac gmac;
@@ -178,11 +186,10 @@ struct ccr_softc {
struct adapter *adapter;
device_t dev;
uint32_t cid;
-   int tx_channel_id;
struct mtx lock;
bool detaching;
-   struct sge_wrq *txq;
-   struct sge_rxq *rxq;
+   struct ccr_port ports[MAX_NPORTS];
+   u_int port_mask;
 
/*
 * Pre-allocate S/G lists used when preparing a work request.
@@ -297,7 +304,8 @@ ccr_phys_dsgl_len(int nsegs)
 }
 
 static void
-ccr_write_phys_dsgl(struct ccr_softc *sc, void *dst, int nsegs)
+ccr_write_phys_dsgl(struct ccr_softc *sc, struct ccr_session *s, void *dst,
+int nsegs)
 {
struct sglist *sg;
struct cpl_rx_phys_dsgl *cpl;
@@ -316,7 +324,7 @@ ccr_write_phys_dsgl(struct ccr_softc *sc, void *dst, i
V_CPL_RX_PHYS_DSGL_PCITPHNTENB(0) | V_CPL_RX_PHYS_DSGL_DCAID(0) |
V_CPL_RX_PHYS_DSGL_NOOFSGENTR(nsegs));
cpl->rss_hdr_int.opcode = CPL_RX_PHYS_ADDR;
-   cpl->rss_hdr_int.qid = htobe16(sc->rxq->iq.abs_id);
+   cpl->rss_hdr_int.qid = htobe16(s->port->rxq->iq.abs_id);
cpl->rss_hdr_int.hash_val = 0;
sgl = (struct phys_sge_pairs *)(cpl + 1);
j = 0;
@@ -392,9 +400,9 @@ ccr_use_imm_data(u_int transhdr_len, u_int input_len)
 }
 
 static void
-ccr_populate_wreq(struct ccr_softc *sc, struct chcr_wr *crwr, u_int kctx_len,
-u_int wr_len, u_int imm_len, u_int sgl_len, u_int hash_size,
-struct cryptop *crp)
+ccr_populate_wreq(struct ccr_softc *sc, struct ccr_session *s,
+struct chcr_wr *crwr, u_int kctx_len, u_int wr_len, u_int imm_len,
+u_int sgl_len, u_int hash_size, struct cryptop *crp)
 {
u_int cctx_size, idata_len;
 
@@ -409,13 +417,13 @@ ccr_populate_wreq(struct ccr_softc *sc, struct chcr_wr
V_FW_CRYPTO_LOOKASIDE_WR_LEN16(wr_len / 16));
crwr->wreq.session_id = 0;
crwr->wreq.rx_chid_to_rx_q_id = htobe32(
-   V_FW_CRYPTO_LOOKASIDE_WR_RX_CHID(sc->tx_channel_id) |
+   V_FW_CRYPTO_LOOKASIDE_WR_RX_CHID(s->port->tx_channel_id) |
V_FW_CRYPTO_LOOKASIDE_WR_LCB(0) |
V_FW_CRYPTO_LOOKASIDE_WR_PHASH(0) |
V_FW_CRYPTO_LOOKASIDE_WR_IV(IV_NOP) |
V_FW_CRYPTO_LOOKASIDE_WR_FQIDX(0) |
V_FW_CRYPTO_LOOKASIDE_WR_TX_CH(0) |
-   V_FW_CRYPTO_LOOKASIDE_WR_RX_Q_ID(sc->rxq->iq.abs_id));
+   V_FW_CRYPTO_LOOKASIDE_WR_RX_Q_ID(s->port->rxq->iq.abs_id));
crwr->wreq.key_addr = 0;
crwr->wreq.pld_size_hash_size = htobe32(
V_FW_CRYPTO_LOOKASIDE_WR_PLD_SIZE(sgl_len) |
@@ -424,8 +432,9 @@ ccr_populate_wreq(struct ccr_softc *sc, struct chcr_wr
 
crwr->ulptx.cmd_dest = htobe32(V_ULPTX_CMD(ULP_TX_PKT) |
V_ULP_TXPKT_DATAMODIFY(0) |
-   V_ULP_TXPKT_CHANNELID(sc->tx_channel_id) | V_ULP_TXPKT_DEST(0) |
-   V_ULP_TXPKT_FID(sc->rxq->iq.abs_id) | V_ULP_TXPKT_RO(1));
+   V_ULP_TXPKT_CHANNELID(s->port->tx_channel_id) |
+   V_ULP_TXPKT_DEST(0) |
+   V_ULP_TXPKT_FID(s->port->rxq->iq.abs_id) | 

svn commit: r359570 - head/sys/opencrypto

2020-04-02 Thread John Baldwin
Author: jhb
Date: Thu Apr  2 17:22:16 2020
New Revision: 359570
URL: https://svnweb.freebsd.org/changeset/base/359570

Log:
  Avoid checking pointers that are never NULL.
  
  Coverity noted that cod pointer is always non-NULL at the end of
  cryptodev_aead().  While here, fix cryptodev_op() to match by making
  one earlier failure case before cod and crp are allocated just return
  directly.
  
  CID:  1422185
  Reported by:  Coverity

Modified:
  head/sys/opencrypto/cryptodev.c

Modified: head/sys/opencrypto/cryptodev.c
==
--- head/sys/opencrypto/cryptodev.c Thu Apr  2 16:55:28 2020
(r359569)
+++ head/sys/opencrypto/cryptodev.c Thu Apr  2 17:22:16 2020
(r359570)
@@ -915,8 +915,7 @@ cryptodev_op(
 
if (cop->mac && cse->hashsize == 0) {
SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__);
-   error = EINVAL;
-   goto bail;
+   return (EINVAL);
}
 
/*
@@ -1091,10 +1090,8 @@ again:
}
 
 bail:
-   if (crp)
-   crypto_freereq(crp);
-   if (cod)
-   cod_free(cod);
+   crypto_freereq(crp);
+   cod_free(cod);
 
return (error);
 }
@@ -1285,8 +1282,7 @@ again:
 
 bail:
crypto_freereq(crp);
-   if (cod)
-   cod_free(cod);
+   cod_free(cod);
 
return (error);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r359569 - head/sys/opencrypto

2020-04-02 Thread John Baldwin
Author: jhb
Date: Thu Apr  2 16:55:28 2020
New Revision: 359569
URL: https://svnweb.freebsd.org/changeset/base/359569

Log:
  Remove duplicate conditional.
  
  CID:  1422192
  Reported by:  Coverity

Modified:
  head/sys/opencrypto/crypto.c

Modified: head/sys/opencrypto/crypto.c
==
--- head/sys/opencrypto/crypto.cThu Apr  2 16:48:46 2020
(r359568)
+++ head/sys/opencrypto/crypto.cThu Apr  2 16:55:28 2020
(r359569)
@@ -722,8 +722,6 @@ alg_is_digest(int alg)
return (true);
if (alg >= CRYPTO_SHA2_256_HMAC && alg <= CRYPTO_SHA2_512_HMAC)
return (true);
-   if (alg >= CRYPTO_SHA2_256_HMAC && alg <= CRYPTO_SHA2_512_HMAC)
-   return (true);
if (alg == CRYPTO_AES_NIST_GMAC)
return (true);
if (alg >= CRYPTO_BLAKE2B && alg <= CRYPTO_BLAKE2S)
___
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: r359524 - head/sys/kgssapi/krb5

2020-04-02 Thread John Baldwin
Author: jhb
Date: Wed Apr  1 17:09:21 2020
New Revision: 359524
URL: https://svnweb.freebsd.org/changeset/base/359524

Log:
  Set crp_ilen for crypto requests.
  
  Assertions in crypto_dispatch() depend on this value being set to
  verify that payload and AAD regions are in bounds.  Also, requests
  that use a single kernel buffer rely on this to know how long the
  buffer is for bus_dma, etc.
  
  Reported by:  kp

Modified:
  head/sys/kgssapi/krb5/kcrypto_aes.c

Modified: head/sys/kgssapi/krb5/kcrypto_aes.c
==
--- head/sys/kgssapi/krb5/kcrypto_aes.c Wed Apr  1 17:08:55 2020
(r359523)
+++ head/sys/kgssapi/krb5/kcrypto_aes.c Wed Apr  1 17:09:21 2020
(r359524)
@@ -158,6 +158,7 @@ aes_encrypt_1(const struct krb5_key_state *ks, int buf
 
crp->crp_buf_type = buftype;
crp->crp_buf = buf;
+   crp->crp_ilen = skip + len;
crp->crp_opaque = as;
crp->crp_callback = aes_crypto_cb;
 
@@ -329,6 +330,7 @@ aes_checksum(const struct krb5_key_state *ks, int usag
crp->crp_flags = CRYPTO_F_CBIFSYNC;
crp->crp_buf_type = CRYPTO_BUF_MBUF;
crp->crp_mbuf = inout;
+   crp->crp_ilen = skip + inlen + 12;
crp->crp_opaque = as;
crp->crp_callback = aes_crypto_cb;
 
___
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: r359530 - in head: . lib/libsysdecode sys/amd64/amd64 sys/amd64/ia32 sys/arm/arm sys/arm64/arm64 sys/compat/ia32 sys/conf sys/fs/procfs sys/i386/i386 sys/kern sys/mips/mips sys/modules/...

2020-04-02 Thread John Baldwin
Author: jhb
Date: Wed Apr  1 19:22:09 2020
New Revision: 359530
URL: https://svnweb.freebsd.org/changeset/base/359530

Log:
  Retire procfs-based process debugging.
  
  Modern debuggers and process tracers use ptrace() rather than procfs
  for debugging.  ptrace() has a supserset of functionality available
  via procfs and new debugging features are only added to ptrace().
  While the two debugging services share some fields in struct proc,
  they each use dedicated fields and separate code.  This results in
  extra complexity to support a feature that hasn't been enabled in the
  default install for several years.
  
  PR:   244939 (exp-run)
  Reviewed by:  kib, mjg (earlier version)
  Relnotes: yes
  Differential Revision:https://reviews.freebsd.org/D23837

Deleted:
  head/sys/fs/procfs/procfs_ioctl.c
  head/sys/sys/pioctl.h
Modified:
  head/ObsoleteFiles.inc
  head/lib/libsysdecode/Makefile
  head/sys/amd64/amd64/trap.c
  head/sys/amd64/amd64/vm_machdep.c
  head/sys/amd64/ia32/ia32_reg.c
  head/sys/amd64/ia32/ia32_signal.c
  head/sys/amd64/ia32/ia32_syscall.c
  head/sys/arm/arm/syscall.c
  head/sys/arm64/arm64/trap.c
  head/sys/compat/ia32/ia32_sysvec.c
  head/sys/conf/files
  head/sys/fs/procfs/procfs.c
  head/sys/fs/procfs/procfs.h
  head/sys/i386/i386/trap.c
  head/sys/i386/i386/vm_machdep.c
  head/sys/kern/imgact_elf.c
  head/sys/kern/kern_exec.c
  head/sys/kern/kern_exit.c
  head/sys/kern/kern_fork.c
  head/sys/kern/kern_prot.c
  head/sys/kern/kern_sig.c
  head/sys/kern/kern_thread.c
  head/sys/kern/subr_syscall.c
  head/sys/kern/subr_trap.c
  head/sys/kern/sys_process.c
  head/sys/mips/mips/trap.c
  head/sys/modules/procfs/Makefile
  head/sys/powerpc/powerpc/trap.c
  head/sys/riscv/riscv/trap.c
  head/sys/sys/param.h
  head/sys/sys/proc.h

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Wed Apr  1 19:09:47 2020(r359529)
+++ head/ObsoleteFiles.inc  Wed Apr  1 19:22:09 2020(r359530)
@@ -36,6 +36,9 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20200401: Remove procfs-based process debugging
+OLD_FILES+=usr/include/sys/pioctl.h
+
 # 20200330: GDB_LIBEXEC option retired (always true)
 OLD_FILES+=usr/bin/gdb
 OLD_FILES+=usr/bin/gdbserver

Modified: head/lib/libsysdecode/Makefile
==
--- head/lib/libsysdecode/Makefile  Wed Apr  1 19:09:47 2020
(r359529)
+++ head/lib/libsysdecode/Makefile  Wed Apr  1 19:22:09 2020
(r359530)
@@ -119,11 +119,6 @@ CFLAGS+=-DPF
 # Workaround duplicate declarations in 
 CFLAGS.gcc.ioctl.c+= -Wno-redundant-decls
 
-# Ignore deprecation warning in 
-CFLAGS.clang.ioctl.c+= -Wno-\#warnings
-CFLAGS.gcc.ioctl.c+= -Wno-cpp
-
-CFLAGS.clang+= ${CFLAGS.clang.${.IMPSRC}}
 CFLAGS.gcc+=   ${CFLAGS.gcc.${.IMPSRC}}
 
 DEPENDOBJS+=   tables.h

Modified: head/sys/amd64/amd64/trap.c
==
--- head/sys/amd64/amd64/trap.c Wed Apr  1 19:09:47 2020(r359529)
+++ head/sys/amd64/amd64/trap.c Wed Apr  1 19:22:09 2020(r359530)
@@ -57,7 +57,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: head/sys/amd64/amd64/vm_machdep.c
==
--- head/sys/amd64/amd64/vm_machdep.c   Wed Apr  1 19:09:47 2020
(r359529)
+++ head/sys/amd64/amd64/vm_machdep.c   Wed Apr  1 19:22:09 2020
(r359530)
@@ -58,7 +58,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -198,15 +197,11 @@ cpu_fork(struct thread *td1, struct proc *p2, struct t
td2->td_frame->tf_rdx = 1;
 
/*
-* If the parent process has the trap bit set (i.e. a debugger had
-* single stepped the process to the system call), we need to clear
-* the trap flag from the new frame unless the debugger had set PF_FORK
-* on the parent.  Otherwise, the child will receive a (likely
-* unexpected) SIGTRAP when it executes the first instruction after
-* returning  to userland.
+* If the parent process has the trap bit set (i.e. a debugger
+* had single stepped the process to the system call), we need
+* to clear the trap flag from the new frame.
 */
-   if ((p1->p_pfsflags & PF_FORK) == 0)
-   td2->td_frame->tf_rflags &= ~PSL_T;
+   td2->td_frame->tf_rflags &= ~PSL_T;
 
/*
 * Set registers for trampoline to user mode.  Leave space for the

Modified: head/sys/amd64/ia32/ia32_reg.c
==
--- head/sys/amd64/ia32/ia32_reg.c  Wed Apr  1 19:09:47 2020
(r359529)
+++ head/sys/amd64/ia32/ia32_reg.c  Wed Apr  1 19:22:09 2020
(r359530)

Re: svn commit: r359459 - head/share/man/man5

2020-03-30 Thread John Baldwin
On 3/30/20 1:08 PM, Ed Maste wrote:
> Author: emaste
> Date: Mon Mar 30 20:08:26 2020
> New Revision: 359459
> URL: https://svnweb.freebsd.org/changeset/base/359459
> 
> Log:
>   regen src.conf.5 after WITHOUT_GDB_LIBEXEC removal r359454
>   
>   ... and a number of other changes since the last regen.

Hmm, 359454 was a markup fix to elf.5 and I haven't seen the commit to
actually remove GDB_LIBEXEC yet?

-- 
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: r359467 - head/lib/libc/sys

2020-03-30 Thread John Baldwin
Author: jhb
Date: Mon Mar 30 21:48:47 2020
New Revision: 359467
URL: https://svnweb.freebsd.org/changeset/base/359467

Log:
  Trim some duplicate EIO descriptions.
  
  While here, drop an extra conjunction from the list of error
  conditions for the remaining EIO description in symlink(2).
  
  Discussed with:   mckusick (trimming duplicates)
  MFC after:2 weeks

Modified:
  head/lib/libc/sys/mkfifo.2
  head/lib/libc/sys/symlink.2

Modified: head/lib/libc/sys/mkfifo.2
==
--- head/lib/libc/sys/mkfifo.2  Mon Mar 30 21:44:30 2020(r359466)
+++ head/lib/libc/sys/mkfifo.2  Mon Mar 30 21:48:47 2020(r359467)
@@ -130,10 +130,6 @@ which the fifo is being created has been exhausted.
 An
 .Tn I/O
 error occurred while making the directory entry or allocating the inode.
-.It Bq Er EIO
-An
-.Tn I/O
-error occurred while reading from or writing to the file system.
 .It Bq Er EINTEGRITY
 Corrupted data was detected while reading from the file system.
 .It Bq Er EFAULT

Modified: head/lib/libc/sys/symlink.2
==
--- head/lib/libc/sys/symlink.2 Mon Mar 30 21:44:30 2020(r359466)
+++ head/lib/libc/sys/symlink.2 Mon Mar 30 21:48:47 2020(r359467)
@@ -118,7 +118,7 @@ manual page for more information.
 .It Bq Er EIO
 An I/O error occurred while making the directory entry for
 .Fa name2 ,
-or allocating the inode for
+allocating the inode for
 .Fa name2 ,
 or writing out the link contents of
 .Fa name2 .
@@ -149,8 +149,6 @@ contain the symbolic link has been exhausted.
 .It Bq Er EDQUOT
 The user's quota of inodes on the file system on
 which the symbolic link is being created has been exhausted.
-.It Bq Er EIO
-An I/O error occurred while making the directory entry or allocating the inode.
 .It Bq Er EINTEGRITY
 Corrupted data was detected while reading from the file system.
 .It Bq Er EFAULT
___
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: r359465 - in head: lib/libc/sys share/man/man9

2020-03-30 Thread John Baldwin
Author: jhb
Date: Mon Mar 30 21:44:00 2020
New Revision: 359465
URL: https://svnweb.freebsd.org/changeset/base/359465

Log:
  Document EINTEGRITY errors for many system calls.
  
  EINTEGRITY was previously documented as a UFS-specific error for
  mount(2).  This documents EINTEGRITY as a filesystem-independent error
  that may be reported by the backing store of a filesystem.
  
  While here, document EIO as a filesystem-independent error for both
  mount(2) and posix_fadvise(2).  EIO was previously only documented for
  UFS for mount(2).
  
  Reviewed by:  mckusick
  Suggested by: mckusick
  MFC after:2 weeks
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D24168

Modified:
  head/lib/libc/sys/access.2
  head/lib/libc/sys/acct.2
  head/lib/libc/sys/bind.2
  head/lib/libc/sys/chdir.2
  head/lib/libc/sys/chflags.2
  head/lib/libc/sys/chmod.2
  head/lib/libc/sys/chown.2
  head/lib/libc/sys/chroot.2
  head/lib/libc/sys/copy_file_range.2
  head/lib/libc/sys/execve.2
  head/lib/libc/sys/fhlink.2
  head/lib/libc/sys/fhreadlink.2
  head/lib/libc/sys/fsync.2
  head/lib/libc/sys/getdirentries.2
  head/lib/libc/sys/getfh.2
  head/lib/libc/sys/getfsstat.2
  head/lib/libc/sys/ktrace.2
  head/lib/libc/sys/link.2
  head/lib/libc/sys/mkdir.2
  head/lib/libc/sys/mkfifo.2
  head/lib/libc/sys/mknod.2
  head/lib/libc/sys/mount.2
  head/lib/libc/sys/open.2
  head/lib/libc/sys/pathconf.2
  head/lib/libc/sys/posix_fadvise.2
  head/lib/libc/sys/posix_fallocate.2
  head/lib/libc/sys/quotactl.2
  head/lib/libc/sys/read.2
  head/lib/libc/sys/readlink.2
  head/lib/libc/sys/rename.2
  head/lib/libc/sys/rmdir.2
  head/lib/libc/sys/sendfile.2
  head/lib/libc/sys/stat.2
  head/lib/libc/sys/statfs.2
  head/lib/libc/sys/swapon.2
  head/lib/libc/sys/symlink.2
  head/lib/libc/sys/truncate.2
  head/lib/libc/sys/undelete.2
  head/lib/libc/sys/unlink.2
  head/lib/libc/sys/utimensat.2
  head/lib/libc/sys/utimes.2
  head/lib/libc/sys/write.2
  head/share/man/man9/VOP_COPY_FILE_RANGE.9
  head/share/man/man9/VOP_READDIR.9
  head/share/man/man9/VOP_READLINK.9
  head/share/man/man9/g_data.9

Modified: head/lib/libc/sys/access.2
==
--- head/lib/libc/sys/access.2  Mon Mar 30 21:42:46 2020(r359464)
+++ head/lib/libc/sys/access.2  Mon Mar 30 21:44:00 2020(r359465)
@@ -28,7 +28,7 @@
 .\" @(#)access.2   8.2 (Berkeley) 4/1/94
 .\" $FreeBSD$
 .\"
-.Dd November 11, 2018
+.Dd March 30, 2020
 .Dt ACCESS 2
 .Os
 .Sh NAME
@@ -175,6 +175,8 @@ argument
 points outside the process's allocated address space.
 .It Bq Er EIO
 An I/O error occurred while reading from or writing to the file system.
+.It Bq Er EINTEGRITY
+Corrupted data was detected while reading from the file system.
 .El
 .Pp
 Also, the

Modified: head/lib/libc/sys/acct.2
==
--- head/lib/libc/sys/acct.2Mon Mar 30 21:42:46 2020(r359464)
+++ head/lib/libc/sys/acct.2Mon Mar 30 21:44:00 2020(r359465)
@@ -28,7 +28,7 @@
 .\" @(#)acct.2 8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd April 17, 2004
+.Dd March 30, 2020
 .Dt ACCT 2
 .Os
 .Sh NAME
@@ -119,6 +119,8 @@ argument
 points outside the process's allocated address space.
 .It Bq Er EIO
 An I/O error occurred while reading from or writing to the file system.
+.It Bq Er EINTEGRITY
+Corrupted data was detected while reading from the file system.
 .El
 .Sh SEE ALSO
 .Xr acct 5 ,

Modified: head/lib/libc/sys/bind.2
==
--- head/lib/libc/sys/bind.2Mon Mar 30 21:42:46 2020(r359464)
+++ head/lib/libc/sys/bind.2Mon Mar 30 21:44:00 2020(r359465)
@@ -28,7 +28,7 @@
 .\" @(#)bind.2 8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd August 18, 2016
+.Dd March 30, 2020
 .Dt BIND 2
 .Os
 .Sh NAME
@@ -122,6 +122,8 @@ A prefix component of the path name does not exist.
 Too many symbolic links were encountered in translating the pathname.
 .It Bq Er EIO
 An I/O error occurred while making the directory entry or allocating the inode.
+.It Bq Er EINTEGRITY
+Corrupted data was detected while reading from the file system.
 .It Bq Er EROFS
 The name would reside on a read-only file system.
 .It Bq Er EISDIR

Modified: head/lib/libc/sys/chdir.2
==
--- head/lib/libc/sys/chdir.2   Mon Mar 30 21:42:46 2020(r359464)
+++ head/lib/libc/sys/chdir.2   Mon Mar 30 21:44:00 2020(r359465)
@@ -28,7 +28,7 @@
 .\" @(#)chdir.28.2 (Berkeley) 12/11/93
 .\" $FreeBSD$
 .\"
-.Dd December 1, 2017
+.Dd March 30, 2020
 .Dt CHDIR 2
 .Os
 .Sh NAME
@@ -96,6 +96,8 @@ argument
 points outside the process's allocated address space.
 .It Bq Er EIO
 An I/O error occurred while reading from or writing to the file system.
+.It Bq Er EINTEGRITY
+Corrupted 

Re: svn commit: r359374 - in head: . share/man/man4 share/man/man7 share/man/man9 sys/crypto/aesni sys/crypto/armv8 sys/crypto/blake2 sys/crypto/ccp sys/crypto/via sys/dev/cesa sys/dev/cxgbe sys/dev/c

2020-03-27 Thread John Baldwin
On 3/27/20 11:25 AM, John Baldwin wrote:
> Author: jhb
> Date: Fri Mar 27 18:25:23 2020
> New Revision: 359374
> URL: https://svnweb.freebsd.org/changeset/base/359374
> 
> Log:
>   Refactor driver and consumer interfaces for OCF (in-kernel crypto).

I have tested as much as I have accessible.  Someone did test cesa(4)
I believe and found it worked with cryptocheck but not IPsec.  I found
a bug in the hash handling related to IPsec that I fixed in cesa(4), but
the original submitter didn't retest.  kp@ has an out-of-tree driver that
he said works with these changes as well.

-- 
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: r359374 - in head: . share/man/man4 share/man/man7 share/man/man9 sys/crypto/aesni sys/crypto/armv8 sys/crypto/blake2 sys/crypto/ccp sys/crypto/via sys/dev/cesa sys/dev/cxgbe sys/dev/cx...

2020-03-27 Thread John Baldwin
Author: jhb
Date: Fri Mar 27 18:25:23 2020
New Revision: 359374
URL: https://svnweb.freebsd.org/changeset/base/359374

Log:
  Refactor driver and consumer interfaces for OCF (in-kernel crypto).
  
  - The linked list of cryptoini structures used in session
initialization is replaced with a new flat structure: struct
crypto_session_params.  This session includes a new mode to define
how the other fields should be interpreted.  Available modes
include:
  
- COMPRESS (for compression/decompression)
- CIPHER (for simply encryption/decryption)
- DIGEST (computing and verifying digests)
- AEAD (combined auth and encryption such as AES-GCM and AES-CCM)
- ETA (combined auth and encryption using encrypt-then-authenticate)
  
Additional modes could be added in the future (e.g. if we wanted to
support TLS MtE for AES-CBC in the kernel we could add a new mode
for that.  TLS modes might also affect how AAD is interpreted, etc.)
  
The flat structure also includes the key lengths and algorithms as
before.  However, code doesn't have to walk the linked list and
switch on the algorithm to determine which key is the auth key vs
encryption key.  The 'csp_auth_*' fields are always used for auth
keys and settings and 'csp_cipher_*' for cipher.  (Compression
algorithms are stored in csp_cipher_alg.)
  
  - Drivers no longer register a list of supported algorithms.  This
doesn't quite work when you factor in modes (e.g. a driver might
support both AES-CBC and SHA2-256-HMAC separately but not combined
for ETA).  Instead, a new 'crypto_probesession' method has been
added to the kobj interface for symmteric crypto drivers.  This
method returns a negative value on success (similar to how
device_probe works) and the crypto framework uses this value to pick
the "best" driver.  There are three constants for hardware
(e.g. ccr), accelerated software (e.g. aesni), and plain software
(cryptosoft) that give preference in that order.  One effect of this
is that if you request only hardware when creating a new session,
you will no longer get a session using accelerated software.
Another effect is that the default setting to disallow software
crypto via /dev/crypto now disables accelerated software.
  
Once a driver is chosen, 'crypto_newsession' is invoked as before.
  
  - Crypto operations are now solely described by the flat 'cryptop'
structure.  The linked list of descriptors has been removed.
  
A separate enum has been added to describe the type of data buffer
in use instead of using CRYPTO_F_* flags to make it easier to add
more types in the future if needed (e.g. wired userspace buffers for
zero-copy).  It will also make it easier to re-introduce separate
input and output buffers (in-kernel TLS would benefit from this).
  
Try to make the flags related to IV handling less insane:
  
- CRYPTO_F_IV_SEPARATE means that the IV is stored in the 'crp_iv'
  member of the operation structure.  If this flag is not set, the
  IV is stored in the data buffer at the 'crp_iv_start' offset.
  
- CRYPTO_F_IV_GENERATE means that a random IV should be generated
  and stored into the data buffer.  This cannot be used with
  CRYPTO_F_IV_SEPARATE.
  
If a consumer wants to deal with explicit vs implicit IVs, etc. it
can always generate the IV however it needs and store partial IVs in
the buffer and the full IV/nonce in crp_iv and set
CRYPTO_F_IV_SEPARATE.
  
The layout of the buffer is now described via fields in cryptop.
crp_aad_start and crp_aad_length define the boundaries of any AAD.
Previously with GCM and CCM you defined an auth crd with this range,
but for ETA your auth crd had to span both the AAD and plaintext
(and they had to be adjacent).
  
crp_payload_start and crp_payload_length define the boundaries of
the plaintext/ciphertext.  Modes that only do a single operation
(COMPRESS, CIPHER, DIGEST) should only use this region and leave the
AAD region empty.
  
If a digest is present (or should be generated), it's starting
location is marked by crp_digest_start.
  
Instead of using the CRD_F_ENCRYPT flag to determine the direction
of the operation, cryptop now includes an 'op' field defining the
operation to perform.  For digests I've added a new VERIFY digest
mode which assumes a digest is present in the input and fails the
request with EBADMSG if it doesn't match the internally-computed
digest.  GCM and CCM already assumed this, and the new AEAD mode
requires this for decryption.  The new ETA mode now also requires
this for decryption, so IPsec and GELI no longer do their own
authentication verification.  Simple DIGEST operations can also do
this, though there are no in-tree consumers.
  
To eventually support some refcounting to close races, the session

Re: svn commit: r359349 - head/gnu/usr.bin/binutils/ld

2020-03-27 Thread John Baldwin
On 3/27/20 9:54 AM, Brandon Bergren wrote:
> 
> 
> On Fri, Mar 27, 2020, at 11:40 AM, John Baldwin wrote:
>> On 3/26/20 6:12 PM, Brandon Bergren wrote:
>>> Author: bdragon
>>> Date: Fri Mar 27 01:12:11 2020
>>> New Revision: 359349
>>> URL: https://svnweb.freebsd.org/changeset/base/359349
>>>
>>> Log:
>>>   Now that there are no remaining users of ld.bfd, remove the ld subdir.
>>>
>>> Deleted:
>>>   head/gnu/usr.bin/binutils/ld/
>>
>> I think Ed mentioned some other cleanups to do as part of this change in
>> ObsoleteFiles.inc as well?
> 
> The problem is that they're still conditional on whether or not base/binutils 
> is installed, so they *have* to live in OptionalObsoleteFiles.inc as far as 
> I'm aware.

Nope.  We moved the GCC ones to ObsoleteFiles.inc and kept the conditionals
for the ports version in that file.

-- 
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"


Re: svn commit: r359349 - head/gnu/usr.bin/binutils/ld

2020-03-27 Thread John Baldwin
On 3/26/20 6:12 PM, Brandon Bergren wrote:
> Author: bdragon
> Date: Fri Mar 27 01:12:11 2020
> New Revision: 359349
> URL: https://svnweb.freebsd.org/changeset/base/359349
> 
> Log:
>   Now that there are no remaining users of ld.bfd, remove the ld subdir.
> 
> Deleted:
>   head/gnu/usr.bin/binutils/ld/

I think Ed mentioned some other cleanups to do as part of this change in
ObsoleteFiles.inc as well?

-- 
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: r359275 - head

2020-03-24 Thread John Baldwin
Author: jhb
Date: Tue Mar 24 18:16:02 2020
New Revision: 359275
URL: https://svnweb.freebsd.org/changeset/base/359275

Log:
  Disable rarely used architecture variants in make universe by default.
  
  If EXTRA_TARGETS is defined, build all supported architecture
  variants.  By default, build architecture variants needed to provide
  code coverage or that are commonly used.
  
  Use this to disable building of all the hard-float and little-endian
  MIPS architecture variants along with n32 by default.
  
  Reviewed by:  rpokala
  Discussed with:   imp, emaste
  Differential Revision:https://reviews.freebsd.org/D24178

Modified:
  head/Makefile

Modified: head/Makefile
==
--- head/Makefile   Tue Mar 24 17:54:34 2020(r359274)
+++ head/Makefile   Tue Mar 24 18:16:02 2020(r359275)
@@ -483,16 +483,17 @@ worlds: .PHONY
 .if make(universe) || make(universe_kernels) || make(tinderbox) || \
 make(targets) || make(universe-toolchain)
 #
-# Always build architectures supported by clang.  Only build architectures
-# only supported by GCC if a suitable toolchain is present or enabled.
-# In all cases, if the user specifies TARGETS on the command line,
-# honor that most of all.
+# Don't build rarely used architectures unless requested.
 #
+.if defined(EXTRA_TARGETS)
+EXTRA_ARCHES_mips= mipsel mipshf mipselhf mips64el mips64hf mips64elhf
+EXTRA_ARCHES_mips+=mipsn32
+.endif
 TARGETS?=amd64 arm arm64 i386 mips powerpc riscv
 _UNIVERSE_TARGETS= ${TARGETS}
 TARGET_ARCHES_arm?=armv6 armv7
 TARGET_ARCHES_arm64?=  aarch64
-TARGET_ARCHES_mips?=   mipsel mips mips64el mips64 mipsn32 mipselhf mipshf 
mips64elhf mips64hf
+TARGET_ARCHES_mips?=   mips mips64 ${EXTRA_ARCHES_mips}
 # powerpcspe excluded until clang fixed
 TARGET_ARCHES_powerpc?=powerpc powerpc64
 TARGET_ARCHES_riscv?=  riscv64 riscv64sf
___
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: r359263 - head/sys/geom/eli

2020-03-23 Thread John Baldwin
Author: jhb
Date: Mon Mar 23 21:26:32 2020
New Revision: 359263
URL: https://svnweb.freebsd.org/changeset/base/359263

Log:
  Use the newer EINTEGRITY error when authentication fails.
  
  GELI used to fail with EINVAL when a read request spanned a disk
  sector whose contents did not match the sector's authentication tag.
  The recently-added EINTEGRITY more closely matches to the error in
  this case.
  
  Reviewed by:  cem, mckusick
  MFC after:2 weeks
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D24131

Modified:
  head/sys/geom/eli/g_eli_integrity.c

Modified: head/sys/geom/eli/g_eli_integrity.c
==
--- head/sys/geom/eli/g_eli_integrity.c Mon Mar 23 21:21:38 2020
(r359262)
+++ head/sys/geom/eli/g_eli_integrity.c Mon Mar 23 21:26:32 2020
(r359263)
@@ -232,7 +232,7 @@ g_eli_auth_read_done(struct cryptop *crp)
bp->bio_driver2 = NULL;
if (bp->bio_error != 0) {
if (bp->bio_error == -1)
-   bp->bio_error = EINVAL;
+   bp->bio_error = EINTEGRITY;
else {
G_ELI_LOGREQ(0, bp,
"Crypto READ request failed (error=%d).",
___
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: r357614 - in head/sys: kern sys

2020-03-20 Thread John Baldwin
On 2/6/20 4:45 AM, Pawel Biernacki wrote:
> Author: kaktus
> Date: Thu Feb  6 12:45:58 2020
> New Revision: 357614
> URL: https://svnweb.freebsd.org/changeset/base/357614
> 
> Log:
>   sysctl(9): add CTLFLAG_NEEDGIANT flag
>   
>   Add CTLFLAG_NEEDGIANT flag (modelled after D_NEEDGIANT) that will be used to
>   mark sysctls that still require locking Giant.
>   
>   Rewrite sysctl_handle_string() to use internal locking instead of locking
>   Giant.

This broke CTLFLAG_RDTUN strings such as hw.cxgbe.config_file.  This is supposed
to be writable by setting the associated environment variable via loader.conf
or kenv:

>From sys/dev/cxgbe/t4_main.c:

/*
 * Configuration file.  All the _CF names here are special.
 */
#define DEFAULT_CF  "default"
#define BUILTIN_CF  "built-in"
#define FLASH_CF"flash"
#define UWIRE_CF"uwire"
#define FPGA_CF "fpga"
static char t4_cfg_file[32] = DEFAULT_CF;
SYSCTL_STRING(_hw_cxgbe, OID_AUTO, config_file, CTLFLAG_RDTUN, t4_cfg_file,
sizeof(t4_cfg_file), "Firmware configuration file");

However, CTLFLAG_RDTUN does not include CTLFLAG_WR, so when the kernel attempts
to "write" to this node (the "TUN" part) to apply the associated kenv variable
when loading the kernel module, your changes here now treat it as a ro_string
and set 'arg2' to the length of the actual string.  In my case I was setting
the value to a longer string that still fit in the allocated space, and the
value now fails to set giving me the following error on the console:

Setting sysctl hw.cxgbe.config_file failed: 22

You can reproduce by doing the following:

# kenv hw.cxgbe.config_file="kern_tls"
# kldload if_cxgbe

That should give you the error, and then checking the hw.cxgbe.config_file
sysctl afterwards will show "default" instead of "kern_tls".  Note that you
don't need any cxgbe hardware to reproduce this as a fix would result in
the value of the sysctl after the kldload being "kern_tls".

-- 
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"


Re: svn commit: r359053 - head/sys/kern

2020-03-17 Thread John Baldwin
On 3/17/20 3:36 PM, Ian Lepore wrote:
> On Tue, 2020-03-17 at 22:27 +, Conrad Meyer wrote:
>> Author: cem
>> Date: Tue Mar 17 22:27:16 2020
>> New Revision: 359053
>> URL: https://svnweb.freebsd.org/changeset/base/359053
>>
>> Log:
>>   Implement sysctl kern.boot_id
>>   
>>   Boot IDs are random, opaque 128-bit identifiers that distinguish distinct
>>   system boots.  A new ID is generated each time the system boots.  Unlike
>>   kern.boottime, the value is not modified by NTP adjustments.  It remains 
>> fixed
>>   until the machine is restarted.
>>   
>>   PR:244867
>>   Reported by:   Ricardo Fraile 
>>   MFC after: I do not intend to, but feel free
>>
>> Modified:
>>   head/sys/kern/kern_mib.c
>>
>> Modified: head/sys/kern/kern_mib.c
>> ==
>> --- head/sys/kern/kern_mib.c Tue Mar 17 21:29:03 2020(r359052)
>> +++ head/sys/kern/kern_mib.c Tue Mar 17 22:27:16 2020(r359053)
>> @@ -448,6 +448,32 @@ SYSCTL_PROC(_kern, KERN_HOSTID, hostid,
>>  CTLTYPE_ULONG | CTLFLAG_RW | CTLFLAG_PRISON | CTLFLAG_MPSAFE | 
>> CTLFLAG_CAPRD,
>>  NULL, 0, sysctl_hostid, "LU", "Host ID");
>>  
>> +static struct mtx bootid_lk;
>> +MTX_SYSINIT(bootid_lock, _lk, "bootid generator lock", MTX_DEF);
>> +
>> +static int
>> +sysctl_bootid(SYSCTL_HANDLER_ARGS)
>> +{
>> +static uint8_t boot_id[16];
>> +static bool initialized = false;
>> +
>> +mtx_lock(_lk);
>> +if (!initialized) {
>> +if (!is_random_seeded()) {
>> +mtx_unlock(_lk);
>> +return (ENXIO);
>> +}
>> +arc4random_buf(boot_id, sizeof(boot_id));
>> +initialized = true;
>> +}
>> +mtx_unlock(_lk);
>> +
>> +return (SYSCTL_OUT(req, boot_id, sizeof(boot_id)));
>> +}
>> +SYSCTL_PROC(_kern, OID_AUTO, boot_id,
>> +CTLTYPE_STRUCT | CTLFLAG_RD | CTLFLAG_MPSAFE | CTLFLAG_CAPRD,
>> +NULL, 0, sysctl_bootid, "", "Random boot ID");
>> +
>>  /*
>>   * The osrelease string is copied from the global (osrelease in vers.c) into
>>   * prison0 by a sysinit and is inherited by child jails if not changed at 
>> jail
> 
> This seems a bit complex.  Why run a sysinit to init a mutex so that
> you can safely do a lazy init of boot_id?  Seems like it would be much
> easier to just use a sysinit at SI_SUB_LAST to init boot_id before
> sysctl can reference it.

Presumably you may not have enough entropy by SI_SUB_LAST to generate it?

-- 
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: r359054 - head/lib/libsysdecode

2020-03-17 Thread John Baldwin
Author: jhb
Date: Tue Mar 17 23:22:07 2020
New Revision: 359054
URL: https://svnweb.freebsd.org/changeset/base/359054

Log:
  Fix the workaround to ignore the #warning for GCC.
  
  clang and gcc use different warning flags for #warning preprocessor
  directives.
  
  Reported by:  Jenkins
  MFC after:1 week

Modified:
  head/lib/libsysdecode/Makefile

Modified: head/lib/libsysdecode/Makefile
==
--- head/lib/libsysdecode/Makefile  Tue Mar 17 22:27:16 2020
(r359053)
+++ head/lib/libsysdecode/Makefile  Tue Mar 17 23:22:07 2020
(r359054)
@@ -119,10 +119,12 @@ CFLAGS+=-DPF
 # Workaround duplicate declarations in 
 CFLAGS.gcc.ioctl.c+= -Wno-redundant-decls
 
-CFLAGS.gcc+=   ${CFLAGS.gcc.${.IMPSRC}}
-
 # Ignore deprecation warning in 
-CFLAGS.ioctl.c+= -Wno-\#warnings
+CFLAGS.clang.ioctl.c+= -Wno-\#warnings
+CFLAGS.gcc.ioctl.c+= -Wno-cpp
+
+CFLAGS.clang+= ${CFLAGS.clang.${.IMPSRC}}
+CFLAGS.gcc+=   ${CFLAGS.gcc.${.IMPSRC}}
 
 DEPENDOBJS+=   tables.h
 tables.h: mktables
___
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: r359050 - head/tools/build/mk

2020-03-17 Thread John Baldwin
Author: jhb
Date: Tue Mar 17 21:11:38 2020
New Revision: 359050
URL: https://svnweb.freebsd.org/changeset/base/359050

Log:
  Add missing DTrace files for WITHOUT_CDDL=yes.
  
  Reviewed by:  dteske
  MFC after:1 week
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D24037

Modified:
  head/tools/build/mk/OptionalObsoleteFiles.inc

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==
--- head/tools/build/mk/OptionalObsoleteFiles.inc   Tue Mar 17 19:53:03 
2020(r359049)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Tue Mar 17 21:11:38 
2020(r359050)
@@ -1151,13 +1151,18 @@ OLD_FILES+=usr/lib/dtrace/drti.o
 OLD_FILES+=usr/lib/dtrace/errno.d
 OLD_FILES+=usr/lib/dtrace/io.d
 OLD_FILES+=usr/lib/dtrace/ip.d
+OLD_FILES+=usr/lib/dtrace/mbuf.d
 OLD_FILES+=usr/lib/dtrace/psinfo.d
 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
 OLD_FILES+=usr/lib/dtrace/regs_x86.d
 .endif
+OLD_FILES+=usr/lib/dtrace/sctp.d
+OLD_FILES+=usr/lib/dtrace/siftr.d
 OLD_FILES+=usr/lib/dtrace/signal.d
+OLD_FILES+=usr/lib/dtrace/socket.d
 OLD_FILES+=usr/lib/dtrace/tcp.d
 OLD_FILES+=usr/lib/dtrace/udp.d
+OLD_FILES+=usr/lib/dtrace/udplite.d
 OLD_FILES+=usr/lib/dtrace/unistd.d
 OLD_FILES+=usr/lib/libavl.a
 OLD_FILES+=usr/lib/libavl.so
@@ -1205,29 +1210,120 @@ OLD_LIBS+=usr/lib32/libuutil.so.2
 OLD_FILES+=usr/lib32/libuutil_p.a
 .endif
 OLD_LIBS+=lib/libdtrace.so.2
+OLD_FILES+=usr/libexec/dwatch/chmod
+OLD_FILES+=usr/libexec/dwatch/errno
+OLD_FILES+=usr/libexec/dwatch/fchmodat
+OLD_FILES+=usr/libexec/dwatch/io
+OLD_FILES+=usr/libexec/dwatch/io-done
+OLD_FILES+=usr/libexec/dwatch/io-start
+OLD_FILES+=usr/libexec/dwatch/ip
+OLD_FILES+=usr/libexec/dwatch/ip-receive
+OLD_FILES+=usr/libexec/dwatch/ip-send
+OLD_FILES+=usr/libexec/dwatch/kill
+OLD_FILES+=usr/libexec/dwatch/lchmod
+OLD_FILES+=usr/libexec/dwatch/nanosleep
+OLD_FILES+=usr/libexec/dwatch/open
+OLD_FILES+=usr/libexec/dwatch/openat
+OLD_FILES+=usr/libexec/dwatch/proc
+OLD_FILES+=usr/libexec/dwatch/proc-create
+OLD_FILES+=usr/libexec/dwatch/proc-exec
+OLD_FILES+=usr/libexec/dwatch/proc-exec-failure
+OLD_FILES+=usr/libexec/dwatch/proc-exec-success
+OLD_FILES+=usr/libexec/dwatch/proc-exit
+OLD_FILES+=usr/libexec/dwatch/proc-signal
+OLD_FILES+=usr/libexec/dwatch/proc-signal-clear
+OLD_FILES+=usr/libexec/dwatch/proc-signal-discard
+OLD_FILES+=usr/libexec/dwatch/proc-signal-send
+OLD_FILES+=usr/libexec/dwatch/proc-status
+OLD_FILES+=usr/libexec/dwatch/read
+OLD_FILES+=usr/libexec/dwatch/recv
+OLD_FILES+=usr/libexec/dwatch/recvfrom
+OLD_FILES+=usr/libexec/dwatch/recvmsg
+OLD_FILES+=usr/libexec/dwatch/rw
+OLD_FILES+=usr/libexec/dwatch/sched
+OLD_FILES+=usr/libexec/dwatch/sched-change-pri
+OLD_FILES+=usr/libexec/dwatch/sched-cpu
+OLD_FILES+=usr/libexec/dwatch/sched-dequeue
+OLD_FILES+=usr/libexec/dwatch/sched-enqueue
+OLD_FILES+=usr/libexec/dwatch/sched-exec
+OLD_FILES+=usr/libexec/dwatch/sched-lend-pri
+OLD_FILES+=usr/libexec/dwatch/sched-load-change
+OLD_FILES+=usr/libexec/dwatch/sched-off-cpu
+OLD_FILES+=usr/libexec/dwatch/sched-on-cpu
+OLD_FILES+=usr/libexec/dwatch/sched-preempt
+OLD_FILES+=usr/libexec/dwatch/sched-pri
+OLD_FILES+=usr/libexec/dwatch/sched-queue
+OLD_FILES+=usr/libexec/dwatch/sched-remain-cpu
+OLD_FILES+=usr/libexec/dwatch/sched-sleep
+OLD_FILES+=usr/libexec/dwatch/sched-surrender
+OLD_FILES+=usr/libexec/dwatch/sched-tick
+OLD_FILES+=usr/libexec/dwatch/sched-wakeup
+OLD_FILES+=usr/libexec/dwatch/send
+OLD_FILES+=usr/libexec/dwatch/sendmsg
+OLD_FILES+=usr/libexec/dwatch/sendrecv
+OLD_FILES+=usr/libexec/dwatch/sendto
+OLD_FILES+=usr/libexec/dwatch/systop
+OLD_FILES+=usr/libexec/dwatch/tcp
+OLD_FILES+=usr/libexec/dwatch/tcp-accept
+OLD_FILES+=usr/libexec/dwatch/tcp-accept-established
+OLD_FILES+=usr/libexec/dwatch/tcp-accept-refused
+OLD_FILES+=usr/libexec/dwatch/tcp-connect
+OLD_FILES+=usr/libexec/dwatch/tcp-connect-established
+OLD_FILES+=usr/libexec/dwatch/tcp-connect-refused
+OLD_FILES+=usr/libexec/dwatch/tcp-connect-request
+OLD_FILES+=usr/libexec/dwatch/tcp-established
+OLD_FILES+=usr/libexec/dwatch/tcp-init
+OLD_FILES+=usr/libexec/dwatch/tcp-io
+OLD_FILES+=usr/libexec/dwatch/tcp-receive
+OLD_FILES+=usr/libexec/dwatch/tcp-refused
+OLD_FILES+=usr/libexec/dwatch/tcp-send
+OLD_FILES+=usr/libexec/dwatch/tcp-state-change
+OLD_FILES+=usr/libexec/dwatch/tcp-status
+OLD_FILES+=usr/libexec/dwatch/udp
+OLD_FILES+=usr/libexec/dwatch/udp-receive
+OLD_FILES+=usr/libexec/dwatch/udp-send
+OLD_FILES+=usr/libexec/dwatch/udplite
+OLD_FILES+=usr/libexec/dwatch/udplite-receive
+OLD_FILES+=usr/libexec/dwatch/udplite-send
+OLD_FILES+=usr/libexec/dwatch/vop_create
+OLD_FILES+=usr/libexec/dwatch/vop_lookup
+OLD_FILES+=usr/libexec/dwatch/vop_mkdir
+OLD_FILES+=usr/libexec/dwatch/vop_mknod
+OLD_FILES+=usr/libexec/dwatch/vop_readdir
+OLD_FILES+=usr/libexec/dwatch/vop_remove
+OLD_FILES+=usr/libexec/dwatch/vop_rename

Re: svn commit: r359047 - in head: lib/libsysdecode sys/fs/procfs sys/sys

2020-03-17 Thread John Baldwin
On 3/17/20 11:44 AM, John Baldwin wrote:
> Author: jhb
> Date: Tue Mar 17 18:44:03 2020
> New Revision: 359047
> URL: https://svnweb.freebsd.org/changeset/base/359047
> 
> Log:
>   Mark procfs-based process debugging as deprecated for FreeBSD 13.
>   
>   Attempting to use ioctls on /proc//mem to control a process will
>   trigger warnings on the console.  The  include file will
>   also now emit a compile-time warning when used from userland.
>   
>   Reviewed by:emaste
>   MFC after:  1 week
>   Relnotes:   yes
>   Differential Revision:  https://reviews.freebsd.org/D23822

Missed:

PR: 244383 (exp-run)

I also didn't quite say why.  My original reason for why is that I have
some debugging changes in flight to try to fix spurious EINTR's that
break the GDB test suite (and we also have an open bug about spurious
errors for gcore and truss).  mjg@ wants to do this to remove overhead
from the syscall path.  Both of these reasons stem from the fact that
procfs debugging is not just a layer on top of ptrace but sits beside it
requiring duplicate checks in code, etc.  They reuse some, but not all,
of the same infrastructure.  At this point, ptrace() now provides a superset
of functionality relative to procfs, and that is only going to continue
going forward as only ptrace() based debugging has seen active work in
the past several years.

-- 
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: r359047 - in head: lib/libsysdecode sys/fs/procfs sys/sys

2020-03-17 Thread John Baldwin
Author: jhb
Date: Tue Mar 17 18:44:03 2020
New Revision: 359047
URL: https://svnweb.freebsd.org/changeset/base/359047

Log:
  Mark procfs-based process debugging as deprecated for FreeBSD 13.
  
  Attempting to use ioctls on /proc//mem to control a process will
  trigger warnings on the console.  The  include file will
  also now emit a compile-time warning when used from userland.
  
  Reviewed by:  emaste
  MFC after:1 week
  Relnotes: yes
  Differential Revision:https://reviews.freebsd.org/D23822

Modified:
  head/lib/libsysdecode/Makefile
  head/sys/fs/procfs/procfs_ioctl.c
  head/sys/sys/pioctl.h

Modified: head/lib/libsysdecode/Makefile
==
--- head/lib/libsysdecode/Makefile  Tue Mar 17 18:17:32 2020
(r359046)
+++ head/lib/libsysdecode/Makefile  Tue Mar 17 18:44:03 2020
(r359047)
@@ -121,6 +121,9 @@ CFLAGS.gcc.ioctl.c+= -Wno-redundant-decls
 
 CFLAGS.gcc+=   ${CFLAGS.gcc.${.IMPSRC}}
 
+# Ignore deprecation warning in 
+CFLAGS.ioctl.c+= -Wno-\#warnings
+
 DEPENDOBJS+=   tables.h
 tables.h: mktables
sh ${.CURDIR}/mktables ${SYSROOT:U${DESTDIR}}${INCLUDEDIR} ${.TARGET}

Modified: head/sys/fs/procfs/procfs_ioctl.c
==
--- head/sys/fs/procfs/procfs_ioctl.c   Tue Mar 17 18:17:32 2020
(r359046)
+++ head/sys/fs/procfs/procfs_ioctl.c   Tue Mar 17 18:44:03 2020
(r359047)
@@ -69,10 +69,53 @@ procfs_ioctl(PFS_IOCTL_ARGS)
 #ifdef COMPAT_FREEBSD6
int ival;
 #endif
+   static struct timeval lasttime;
+   static struct timeval interval = { .tv_sec = 1, .tv_usec = 0 };
 
KASSERT(p != NULL,
("%s() called without a process", __func__));
PROC_LOCK_ASSERT(p, MA_OWNED);
+
+   switch (cmd) {
+#if defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) || defined(COMPAT_43)
+   case _IOC(IOC_IN, 'p', 1, 0):
+#endif
+#ifdef COMPAT_FREEBSD6
+   case _IO('p', 1):
+#endif
+   case PIOCBIS:
+#if defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) || defined(COMPAT_43)
+   case _IOC(IOC_IN, 'p', 2, 0):
+#endif
+#ifdef COMPAT_FREEBSD6
+   case _IO('p', 2):
+#endif
+   case PIOCBIC:
+#if defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) || defined(COMPAT_43)
+   case _IOC(IOC_IN, 'p', 3, 0):
+#endif
+#ifdef COMPAT_FREEBSD6
+   case _IO('p', 3):
+#endif
+   case PIOCSFL:
+   case PIOCGFL:
+   case PIOCWAIT:
+   case PIOCSTATUS:
+#ifdef COMPAT_FREEBSD32
+   case PIOCWAIT32:
+   case PIOCSTATUS32:
+#endif
+#if defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) || defined(COMPAT_43)
+   case _IOC(IOC_IN, 'p', 5, 0):
+#endif
+#ifdef COMPAT_FREEBSD6
+   case _IO('p', 5):
+#endif
+   case PIOCCONT:
+   if (ratecheck(, ) != 0)
+   gone_in(13, "procfs-based process debugging");
+   break;
+   }
 
error = 0;
switch (cmd) {

Modified: head/sys/sys/pioctl.h
==
--- head/sys/sys/pioctl.h   Tue Mar 17 18:17:32 2020(r359046)
+++ head/sys/sys/pioctl.h   Tue Mar 17 18:44:03 2020(r359047)
@@ -41,6 +41,10 @@
 #ifndef _SYS_PIOCTL_H
 # define _SYS_PIOCTL_H
 
+#ifndef _KERNEL
+#warning " is deprecated, ptrace() should be used instead"
+#endif
+
 # include 
 
 struct procfs_status {
___
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: r358848 - in head/sys/amd64/vmm: intel io

2020-03-10 Thread John Baldwin
On 3/10/20 9:53 AM, Michael Reifenberger wrote:
> Author: mr
> Date: Tue Mar 10 16:53:49 2020
> New Revision: 358848
> URL: https://svnweb.freebsd.org/changeset/base/358848
> 
> Log:
>   Untangle TPR shadowing and APIC virtualization.
>   This speeds up Windows guests tremendously.
>   
>   The patch does:
>   Add a new tuneable 'hw.vmm.vmx.use_tpr_shadowing' to disable TLP shadowing.
>   Also add 'hw.vmm.vmx.cap.tpr_shadowing' to be able to query if TPR 
> shadowing is used.
>   
>   Detach the initialization of TPR shadowing from the initialization of APIC 
> virtualization.
>   APIC virtualization still needs TPR shadowing, but not vice versa.
>   Any CPU that supports APIC virtualization should also support TPR shadowing.
>   
>   When TPR shadowing is used, the APIC page of each vCPU is written to the 
> VMCS_VIRTUAL_APIC field of the VMCS
>   so that the CPU can write directly to the page without intercept.
>   
>   On vm exit, vlapic_update_ppr() is called to update the PPR.
>   
>   Submitted by:   Yamagi Burmeister
>   MFC after:  2 weeks
>   Differential Revision:  https://reviews.freebsd.org/D22942

Reviewed by:grehan

Also, it is still good form to wrap the commit logs to fit in
80 cols.

-- 
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"


Re: svn commit: r358789 - head/share/man/man7

2020-03-10 Thread John Baldwin
On 3/8/20 2:30 PM, Ed Maste wrote:
> Author: emaste
> Date: Sun Mar  8 21:30:55 2020
> New Revision: 358789
> URL: https://svnweb.freebsd.org/changeset/base/358789
> 
> Log:
>   arch.7: remove note about GCC 4.2.1 removal date
>   
>   GCC 4.2.1 was removed in r358454.
>   
>   Sponsored by:   The FreeBSD Foundation

Can you update the platforms page on the website as well?

-- 
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"


Re: svn commit: r358687 - head/libexec/tftpd/tests

2020-03-05 Thread John Baldwin
On 3/5/20 2:45 PM, Kyle Evans wrote:
> Author: kevans
> Date: Thu Mar  5 22:45:16 2020
> New Revision: 358687
> URL: https://svnweb.freebsd.org/changeset/base/358687
> 
> Log:
>   tftpd: tests: raise targeted cstd to c11
>   
>   r358556 added alignas() use to the functional tests, which isn't defined
>   until C11. Raise the -std to C11 to fix the build under freebsd-gcc{6,9}.
>   
>   Reported by:mhorne, Jenkins/CI

Thanks for fixing!

-- 
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"


Re: svn commit: r358561 - in head: . share/man/man5 share/man/man7 tools/build/options tools/tools/nanobsd/dhcpd tools/tools/nanobsd/embedded usr.bin usr.bin/calendar usr.bin/calendar/calendars usr.bi

2020-03-02 Thread John Baldwin
On 3/2/20 3:37 PM, Conrad Meyer wrote:
> Author: cem
> Date: Mon Mar  2 23:37:47 2020
> New Revision: 358561
> URL: https://svnweb.freebsd.org/changeset/base/358561
> 
> Log:
>   Fix typo in r278616
>   
>   FreeBSD isn't an encyclopedia.

This isn't a helpful log message, and you didn't post this for review, etc.
I actually use calendar in my .login, so it's not completely unused.  It was
a conscious decision, not a typo to keep calendar(1), and not one for you to
unilaterally revisit without at least some discussion.  I don't think we've
had any calendar CVEs or that it's been a maintenance burden?

-- 
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: r358556 - in head: libexec/tftpd libexec/tftpd/tests usr.bin/tftp

2020-03-02 Thread John Baldwin
Author: jhb
Date: Mon Mar  2 22:19:30 2020
New Revision: 358556
URL: https://svnweb.freebsd.org/changeset/base/358556

Log:
  Add support for the TFTP windowsize option described in RFC 7440.
  
  The windowsize option permits multiple blocks to be transmitted
  before the receiver sends an ACK improving throughput for larger
  files.
  
  Reviewed by:  asomers
  MFC after:2 weeks
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D23836

Modified:
  head/libexec/tftpd/tests/functional.c
  head/libexec/tftpd/tftp-file.c
  head/libexec/tftpd/tftp-file.h
  head/libexec/tftpd/tftp-options.c
  head/libexec/tftpd/tftp-options.h
  head/libexec/tftpd/tftp-transfer.c
  head/libexec/tftpd/tftp-utils.c
  head/libexec/tftpd/tftp-utils.h
  head/libexec/tftpd/tftpd.8
  head/usr.bin/tftp/main.c
  head/usr.bin/tftp/tftp.1

Modified: head/libexec/tftpd/tests/functional.c
==
--- head/libexec/tftpd/tests/functional.c   Mon Mar  2 21:19:51 2020
(r358555)
+++ head/libexec/tftpd/tests/functional.c   Mon Mar  2 22:19:30 2020
(r358556)
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -89,6 +90,13 @@ recv_ack(uint16_t blocknum)
RECV(hdr, NULL, 0);
 }
 
+static void
+recv_oack(const char *options, size_t options_len)
+{
+   char hdr[] = {0, 6};
+   RECV(hdr, options, options_len);
+}
+
 /*
  * Receive a data packet from tftpd
  * @param  blocknumExpected block number to be received
@@ -159,6 +167,11 @@ send_ack(uint16_t blocknum)
 
 }
 
+/*
+ * build an option string
+ */
+#define OPTION_STR(name, value)name "\000" value "\000"
+
 /* 
  * send a read request to tftpd.
  * @param  filenamefilename as a string, absolute or relative
@@ -166,6 +179,11 @@ send_ack(uint16_t blocknum)
  */
 #define SEND_RRQ(filename, mode) SEND_STR("\0\001" filename "\0" mode "\0")
 
+/*
+ * send a read request with options
+ */
+#define SEND_RRQ_OPT(filename, mode, options) SEND_STR("\0\001" filename "\0" 
mode "\000" options)
+
 /* 
  * send a write request to tftpd.
  * @param  filenamefilename as a string, absolute or relative
@@ -173,6 +191,11 @@ send_ack(uint16_t blocknum)
  */
 #define SEND_WRQ(filename, mode) SEND_STR("\0\002" filename "\0" mode "\0")
 
+/*
+ * send a write request with options
+ */
+#define SEND_WRQ_OPT(filename, mode, options) SEND_STR("\0\002" filename "\0" 
mode "\000" options)
+
 /* Define a test case, for both IPv4 and IPv6 */
 #define TFTPD_TC_DEFINE(name, head, ...) \
 static void \
@@ -573,6 +596,32 @@ TFTPD_TC_DEFINE(rrq_medium,)
 }
 
 /*
+ * Read a medium file with a window size of 2.
+ */
+TFTPD_TC_DEFINE(rrq_medium_window,)
+{
+   int fd;
+   size_t i;
+   uint32_t contents[192];
+   char options[] = OPTION_STR("windowsize", "2");
+
+   for (i = 0; i < nitems(contents); i++)
+   contents[i] = i;
+
+   fd = open("medium.txt", O_RDWR | O_CREAT, 0644);
+   ATF_REQUIRE(fd >= 0);
+   write_all(fd, contents, sizeof(contents));
+   close(fd);
+
+   SEND_RRQ_OPT("medium.txt", "octet", OPTION_STR("windowsize", "2"));
+   recv_oack(options, sizeof(options) - 1);
+   send_ack(0);
+   recv_data(1, (const char*)[0], 512);
+   recv_data(2, (const char*)[128], 256);
+   send_ack(2);
+}
+
+/*
  * Read a file in netascii format
  */
 TFTPD_TC_DEFINE(rrq_netascii,)
@@ -652,6 +701,59 @@ TFTPD_TC_DEFINE(rrq_small,)
 }
 
 /*
+ * Read a file following the example in RFC 7440.
+ */
+TFTPD_TC_DEFINE(rrq_window_rfc7440,)
+{
+   int fd;
+   size_t i;
+   char options[] = OPTION_STR("windowsize", "4");
+   alignas(uint32_t) char contents[13 * 512 - 4];
+   uint32_t *u32p;
+
+   u32p = (uint32_t *)contents;
+   for (i = 0; i < sizeof(contents) / sizeof(uint32_t); i++)
+   u32p[i] = i;
+
+   fd = open("rfc7440.txt", O_RDWR | O_CREAT, 0644);
+   ATF_REQUIRE(fd >= 0);
+   write_all(fd, contents, sizeof(contents));
+   close(fd);
+
+   SEND_RRQ_OPT("rfc7440.txt", "octet", OPTION_STR("windowsize", "4"));
+   recv_oack(options, sizeof(options) - 1);
+   send_ack(0);
+   recv_data(1, [0 * 512], 512);
+   recv_data(2, [1 * 512], 512);
+   recv_data(3, [2 * 512], 512);
+   recv_data(4, [3 * 512], 512);
+   send_ack(4);
+   recv_data(5, [4 * 512], 512);
+   recv_data(6, [5 * 512], 512);
+   recv_data(7, [6 * 512], 512);
+   recv_data(8, [7 * 512], 512);
+
+   /* ACK 5 as if 6-8 were dropped. */
+   send_ack(5);
+   recv_data(6, [5 * 512], 512);
+   recv_data(7, [6 * 512], 512);
+   recv_data(8, [7 * 512], 512);
+   recv_data(9, [8 * 512], 512);
+   send_ack(9);
+   recv_data(10, [9 * 512], 512);
+   recv_data(11, [10 * 512], 512);
+   recv_data(12, [11 * 512], 512);
+   recv_data(13, 

Re: svn commit: r358486 - head/sys/dev/bce

2020-03-02 Thread John Baldwin
On 3/1/20 9:27 AM, Warner Losh wrote:
> Author: imp
> Date: Sun Mar  1 17:27:30 2020
> New Revision: 358486
> URL: https://svnweb.freebsd.org/changeset/base/358486
> 
> Log:
>   Remove all the compatibility hacks for systems that predate FreeBSD 8. Some 
> of
>   these look to be cut and pasted from other drivers since this driver was
>   committed to FreeBSD 7-current and MFC'd to FreeBSD 6. The ones for FreeBSD 
> 4
>   and 5 likely never were working...

You'd be surprised.  I had to backport this to 4.x for Y!BSD, so I do suspect
the 4.x bits worked fine.  Good to clean out the cruft regardless.

-- 
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: r358415 - in head/sys/dev/cxgbe: . tom

2020-02-27 Thread John Baldwin
Author: jhb
Date: Fri Feb 28 00:42:27 2020
New Revision: 358415
URL: https://svnweb.freebsd.org/changeset/base/358415

Log:
  Rename TOE TLS stats from [rt]x_tls_* to [rt]x_toe_tls_*.
  
  This more clearly differentiates TLS records encrypted and decrypted
  in TOE connections from those encrypted via NIC TLS.
  
  MFC after:1 week
  Sponsored by: Chelsio Communications

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

Modified: head/sys/dev/cxgbe/adapter.h
==
--- head/sys/dev/cxgbe/adapter.hThu Feb 27 23:06:40 2020
(r358414)
+++ head/sys/dev/cxgbe/adapter.hFri Feb 28 00:42:27 2020
(r358415)
@@ -308,10 +308,10 @@ struct port_info {
struct port_stats stats;
u_int tnl_cong_drops;
u_int tx_parse_error;
-   u_long  tx_tls_records;
-   u_long  tx_tls_octets;
-   u_long  rx_tls_records;
-   u_long  rx_tls_octets;
+   u_long  tx_toe_tls_records;
+   u_long  tx_toe_tls_octets;
+   u_long  rx_toe_tls_records;
+   u_long  rx_toe_tls_octets;
 
struct callout tick;
 };

Modified: head/sys/dev/cxgbe/t4_main.c
==
--- head/sys/dev/cxgbe/t4_main.cThu Feb 27 23:06:40 2020
(r358414)
+++ head/sys/dev/cxgbe/t4_main.cFri Feb 28 00:42:27 2020
(r358415)
@@ -7047,17 +7047,17 @@ cxgbe_sysctls(struct port_info *pi)
 
 #undef SYSCTL_ADD_T4_PORTSTAT
 
-   SYSCTL_ADD_ULONG(ctx, children, OID_AUTO, "tx_tls_records",
-   CTLFLAG_RD, >tx_tls_records,
+   SYSCTL_ADD_ULONG(ctx, children, OID_AUTO, "tx_toe_tls_records",
+   CTLFLAG_RD, >tx_toe_tls_records,
"# of TOE TLS records transmitted");
-   SYSCTL_ADD_ULONG(ctx, children, OID_AUTO, "tx_tls_octets",
-   CTLFLAG_RD, >tx_tls_octets,
+   SYSCTL_ADD_ULONG(ctx, children, OID_AUTO, "tx_toe_tls_octets",
+   CTLFLAG_RD, >tx_toe_tls_octets,
"# of payload octets in transmitted TOE TLS records");
-   SYSCTL_ADD_ULONG(ctx, children, OID_AUTO, "rx_tls_records",
-   CTLFLAG_RD, >rx_tls_records,
+   SYSCTL_ADD_ULONG(ctx, children, OID_AUTO, "rx_toe_tls_records",
+   CTLFLAG_RD, >rx_toe_tls_records,
"# of TOE TLS records received");
-   SYSCTL_ADD_ULONG(ctx, children, OID_AUTO, "rx_tls_octets",
-   CTLFLAG_RD, >rx_tls_octets,
+   SYSCTL_ADD_ULONG(ctx, children, OID_AUTO, "rx_toe_tls_octets",
+   CTLFLAG_RD, >rx_toe_tls_octets,
"# of payload octets in received TOE TLS records");
 }
 

Modified: head/sys/dev/cxgbe/tom/t4_tls.c
==
--- head/sys/dev/cxgbe/tom/t4_tls.c Thu Feb 27 23:06:40 2020
(r358414)
+++ head/sys/dev/cxgbe/tom/t4_tls.c Fri Feb 28 00:42:27 2020
(r358415)
@@ -1559,8 +1559,8 @@ t4_push_tls_records(struct adapter *sc, struct toepcb 
}
toep->txsd_avail--;
 
-   atomic_add_long(>vi->pi->tx_tls_records, 1);
-   atomic_add_long(>vi->pi->tx_tls_octets, plen);
+   atomic_add_long(>vi->pi->tx_toe_tls_records, 1);
+   atomic_add_long(>vi->pi->tx_toe_tls_octets, plen);
 
t4_l2t_send(sc, wr, toep->l2te);
}
@@ -1862,8 +1862,8 @@ t4_push_ktls(struct adapter *sc, struct toepcb *toep, 
}
toep->txsd_avail--;
 
-   atomic_add_long(>vi->pi->tx_tls_records, 1);
-   atomic_add_long(>vi->pi->tx_tls_octets, m->m_len);
+   atomic_add_long(>vi->pi->tx_toe_tls_records, 1);
+   atomic_add_long(>vi->pi->tx_toe_tls_octets, m->m_len);
 
t4_l2t_send(sc, wr, toep->l2te);
}
@@ -1899,7 +1899,7 @@ do_tls_data(struct sge_iq *iq, const struct rss_header
m_adj(m, sizeof(*cpl));
len = m->m_pkthdr.len;
 
-   atomic_add_long(>vi->pi->rx_tls_octets, len);
+   atomic_add_long(>vi->pi->rx_toe_tls_octets, len);
 
KASSERT(len == G_CPL_TLS_DATA_LENGTH(be32toh(cpl->length_pkd)),
("%s: payload length mismatch", __func__));
@@ -1962,7 +1962,7 @@ do_rx_tls_cmp(struct sge_iq *iq, const struct rss_head
m_adj(m, sizeof(*cpl));
len = m->m_pkthdr.len;
 
-   atomic_add_long(>vi->pi->rx_tls_records, 1);
+   atomic_add_long(>vi->pi->rx_toe_tls_records, 1);
 
KASSERT(len == G_CPL_RX_TLS_CMP_LENGTH(be32toh(cpl->pdulength_length)),
("%s: payload length mismatch", __func__));
___
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: r358392 - head/share/man/man9

2020-02-27 Thread John Baldwin
On 2/27/20 7:30 AM, Warner Losh wrote:
> Author: imp
> Date: Thu Feb 27 15:30:13 2020
> New Revision: 358392
> URL: https://svnweb.freebsd.org/changeset/base/358392
> 
> Log:
>   _Static_assert is to be preferred to CTASSERT.
>   
>   Document the existing prefernce that _Static_assert be used in preference 
> to the
>   old CTASSERT we used to use for compile time assertions.

Actually, I think what we want to use is static_assert().  The intention in
userland C is that _Static_assert() is an internal keyword and 
adds static_assert() as an alias, similar to  defining alignas,
etc.  I think what we should do for the kernel is have  define
map static_assert to _Static_assert and replace existing _Static_assert
usage with the proper spelling.

-- 
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: r358394 - head/usr.sbin/bhyve

2020-02-27 Thread John Baldwin
Author: jhb
Date: Thu Feb 27 16:51:41 2020
New Revision: 358394
URL: https://svnweb.freebsd.org/changeset/base/358394

Log:
  Use stream_read() to read all 12 bytes of the RFB client version.
  
  read() can return a short read, whereas stream_read() waits until the
  full version string is read.
  
  Submitted by: Ka Ho Ng 
  Reviewed by:  grehan
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D23591

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

Modified: head/usr.sbin/bhyve/rfb.c
==
--- head/usr.sbin/bhyve/rfb.c   Thu Feb 27 15:34:30 2020(r358393)
+++ head/usr.sbin/bhyve/rfb.c   Thu Feb 27 16:51:41 2020(r358394)
@@ -76,6 +76,7 @@ static int rfb_debug = 0;
 #defineDPRINTF(params) if (rfb_debug) PRINTLN params
 #defineWPRINTF(params) PRINTLN params
 
+#define VERSION_LENGTH 12
 #define AUTH_LENGTH16
 #define PASSWD_LENGTH  8
 
@@ -769,7 +770,7 @@ rfb_handle(struct rfb_softc *rc, int cfd)
stream_write(cfd, vbuf, strlen(vbuf));
 
/* 1b. Read client version */
-   len = read(cfd, buf, sizeof(buf));
+   len = stream_read(cfd, buf, VERSION_LENGTH);
 
/* 2a. Send security type */
buf[0] = 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: r358346 - in head/libexec/rtld-elf: . rtld-libc

2020-02-26 Thread John Baldwin
On 2/26/20 10:49 AM, Warner Losh wrote:
> Author: imp
> Date: Wed Feb 26 18:49:25 2020
> New Revision: 358346
> URL: https://svnweb.freebsd.org/changeset/base/358346
> 
> Log:
>   Remove sparc64 specific parts of rtld-elf.
> 
> Modified:
>   head/libexec/rtld-elf/rtld-libc/Makefile.inc
>   head/libexec/rtld-elf/rtld.c
>   head/libexec/rtld-elf/rtld_tls.h

libexec/rtld-elf/sparc64?

-- 
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"


Re: svn commit: r358247 - in head/sys: conf riscv/include

2020-02-24 Thread John Baldwin
On 2/22/20 5:23 AM, Kristof Provost wrote:
> Author: kp
> Date: Sat Feb 22 13:23:27 2020
> New Revision: 358247
> URL: https://svnweb.freebsd.org/changeset/base/358247
> 
> Log:
>   riscv: Set MACHINE_ARCH correctly
>   
>   MACHINE_ARCH sets the hw.machine_arch sysctl in the kernel. In userspace
>   it sets MACHINE_ARCH in bmake, which bsd.cpu.mk uses to configure the
>   target ABI for ports.
>   
>   For riscv64sf builds (i.e. soft-float) that needs to be riscv64sf, but
>   the sysctl didn't reflect that. It is static.
>   
>   Set the define from the riscv makefile so that we correctly reflect our
>   actual build (i.e. riscv64 or riscv64sf), depending on what TARGET_ARCH
>   we were built with.
>   
>   That still doesn't satisfy userspace builds (e.g. bmake), so check if
>   we're building with a software-floating point toolchain there. That
>   check doesn't work in the kernel, because it never uses floating point.
>   
>   Reviewed by:philip (previous version), mhorne
>   Sponsored by:   Axiado
>   Differential Revision:  https://reviews.freebsd.org/D23741

I actually think this is kind of busted as the kernel is always the same,
and we have the same problem on MIPS which also already does this wrong.
I think instead we should treat soft-float as an alternate ABI (though
very light weight as it doesn't need a separate syscall handler, etc.) and
make the sysctl handler smart enough to return the right value based on the
ELF header of the binary.

I saw the later followup commit to add GENERICSF and I think that is possibly
even farther down the wrong path.  The kernel is _always_ soft-float in terms
of the ABI it is built with.  However, kernel with FPE support can run binaries
with either ABI.  It's true that on RISC-V there is not a nice way to detect
if the FPU is present (I haven't looked at OpenSBI, but the SBI used with bbl
doesn't provide misa to S-mode to know if it is present or not).  You could
just try to execute an FPU instruction during boot to see if you get an
illegal instruction fault (subject to your SBI choosing to emulate that).

-- 
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: r357891 - head/sys/dev/mlx5/mlx5_en

2020-02-13 Thread John Baldwin
Author: jhb
Date: Thu Feb 13 23:04:11 2020
New Revision: 357891
URL: https://svnweb.freebsd.org/changeset/base/357891

Log:
  Don't check the auth algorithm for GCM.
  
  The upstream OpenSSL changes only set the cipher for GCM since the
  authentication is redundant, and changes to OCF will soon remove the
  GCM authentication algorithm constants entirely for the same reason.
  In addition, ktls_create_session() already validates these fields and
  wouldn't pass down an invalid auth_algorithm value to any drivers or
  ktls backends.
  
  Reviewed by:  hselasky
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D23671

Modified:
  head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c  Thu Feb 13 22:55:45 2020
(r357890)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c  Thu Feb 13 23:04:11 2020
(r357891)
@@ -339,10 +339,6 @@ mlx5e_tls_snd_tag_alloc(struct ifnet *ifp,
case CRYPTO_AES_NIST_GCM_16:
switch (en->cipher_key_len) {
case 128 / 8:
-   if (en->auth_algorithm != CRYPTO_AES_128_NIST_GMAC) {
-   error = EINVAL;
-   goto failure;
-   }
if (en->tls_vminor == TLS_MINOR_VER_TWO) {
if (MLX5_CAP_TLS(priv->mdev, 
tls_1_2_aes_gcm_128) == 0) {
error = EPROTONOSUPPORT;
@@ -360,10 +356,6 @@ mlx5e_tls_snd_tag_alloc(struct ifnet *ifp,
break;
 
case 256 / 8:
-   if (en->auth_algorithm != CRYPTO_AES_256_NIST_GMAC) {
-   error = EINVAL;
-   goto failure;
-   }
if (en->tls_vminor == TLS_MINOR_VER_TWO) {
if (MLX5_CAP_TLS(priv->mdev, 
tls_1_2_aes_gcm_256) == 0) {
error = EPROTONOSUPPORT;
___
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: r357890 - in head/sys/dev/cxgbe: . crypto

2020-02-13 Thread John Baldwin
Author: jhb
Date: Thu Feb 13 22:55:45 2020
New Revision: 357890
URL: https://svnweb.freebsd.org/changeset/base/357890

Log:
  Remove the per-TXQ tls_wrs stat.
  
  It duplicated the kern_tls_records stat and was not conditional on NIC
  TLS being enabled.
  
  Reviewed by:  np
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D23670

Modified:
  head/sys/dev/cxgbe/adapter.h
  head/sys/dev/cxgbe/crypto/t4_kern_tls.c
  head/sys/dev/cxgbe/t4_main.c
  head/sys/dev/cxgbe/t4_sge.c

Modified: head/sys/dev/cxgbe/adapter.h
==
--- head/sys/dev/cxgbe/adapter.hThu Feb 13 22:22:55 2020
(r357889)
+++ head/sys/dev/cxgbe/adapter.hThu Feb 13 22:55:45 2020
(r357890)
@@ -574,7 +574,6 @@ struct sge_txq {
uint64_t txpkts0_pkts;  /* # of frames in type0 coalesced tx WRs */
uint64_t txpkts1_pkts;  /* # of frames in type1 coalesced tx WRs */
uint64_t raw_wrs;   /* # of raw work requests (alloc_wr_mbuf) */
-   uint64_t tls_wrs;   /* # of TLS work requests */
 
uint64_t kern_tls_records;
uint64_t kern_tls_short;

Modified: head/sys/dev/cxgbe/crypto/t4_kern_tls.c
==
--- head/sys/dev/cxgbe/crypto/t4_kern_tls.c Thu Feb 13 22:22:55 2020
(r357889)
+++ head/sys/dev/cxgbe/crypto/t4_kern_tls.c Thu Feb 13 22:55:45 2020
(r357890)
@@ -2082,7 +2082,6 @@ ktls_write_tls_wr(struct tlspcb *tlsp, struct sge_txq 
 
ndesc += howmany(wr_len, EQ_ESIZE);
MPASS(ndesc <= available);
-   txq->tls_wrs++;
 
txq->kern_tls_records++;
txq->kern_tls_octets += tlen - mtod(m_tls, vm_offset_t);

Modified: head/sys/dev/cxgbe/t4_main.c
==
--- head/sys/dev/cxgbe/t4_main.cThu Feb 13 22:22:55 2020
(r357889)
+++ head/sys/dev/cxgbe/t4_main.cThu Feb 13 22:55:45 2020
(r357890)
@@ -10359,7 +10359,6 @@ clear_stats(struct adapter *sc, u_int port_id)
txq->txpkts0_pkts = 0;
txq->txpkts1_pkts = 0;
txq->raw_wrs = 0;
-   txq->tls_wrs = 0;
txq->kern_tls_records = 0;
txq->kern_tls_short = 0;
txq->kern_tls_partial = 0;

Modified: head/sys/dev/cxgbe/t4_sge.c
==
--- head/sys/dev/cxgbe/t4_sge.c Thu Feb 13 22:22:55 2020(r357889)
+++ head/sys/dev/cxgbe/t4_sge.c Thu Feb 13 22:55:45 2020(r357890)
@@ -4204,8 +4204,6 @@ alloc_txq(struct vi_info *vi, struct sge_txq *txq, int
"# of frames tx'd using type1 txpkts work requests");
SYSCTL_ADD_UQUAD(>ctx, children, OID_AUTO, "raw_wrs", CTLFLAG_RD,
>raw_wrs, "# of raw work requests (non-packets)");
-   SYSCTL_ADD_UQUAD(>ctx, children, OID_AUTO, "tls_wrs", CTLFLAG_RD,
-   >tls_wrs, "# of TLS work requests (TLS records)");
 
 #ifdef KERN_TLS
if (sc->flags & KERN_TLS_OK) {
___
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: r357361 - in head/sys: kern sys ufs/ufs vm

2020-02-11 Thread John Baldwin
On 2/10/20 11:54 AM, Mateusz Guzik wrote:
> On 2/3/20, John Baldwin  wrote:
>> On 1/31/20 10:46 PM, Mateusz Guzik wrote:
>>> Author: mjg
>>> Date: Sat Feb  1 06:46:55 2020
>>> New Revision: 357361
>>> URL: https://svnweb.freebsd.org/changeset/base/357361
>>>
>>> Log:
>>>   vfs: replace VOP_MARKATIME with VOP_MMAPPED
>>>
>>>   The routine is only provided by ufs and is only used on mmap and exec.
>>>
>>>   Reviewed by:  kib
>>>   Differential Revision:https://reviews.freebsd.org/D23422
>>>
>>> Modified:
>>>   head/sys/kern/kern_exec.c
>>>   head/sys/kern/vfs_subr.c
>>>   head/sys/kern/vnode_if.src
>>>   head/sys/sys/vnode.h
>>>   head/sys/ufs/ufs/ufs_vnops.c
>>>   head/sys/vm/vm_mmap.c
>>>
>>> Modified: head/sys/ufs/ufs/ufs_vnops.c
>>> ==
>>> --- head/sys/ufs/ufs/ufs_vnops.cSat Feb  1 06:41:44 2020
>>> (r357360)
>>> +++ head/sys/ufs/ufs/ufs_vnops.cSat Feb  1 06:46:55 2020
>>> (r357361)
>>> @@ -108,7 +108,7 @@ static vop_getattr_tufs_getattr;
>>>  static vop_ioctl_t ufs_ioctl;
>>>  static vop_link_t  ufs_link;
>>>  static int ufs_makeinode(int mode, struct vnode *, struct vnode **,
>>> struct componentname *, const char *);
>>> -static vop_markatime_t ufs_markatime;
>>> +static vop_mmapped_t   ufs_mmapped;
>>>  static vop_mkdir_t ufs_mkdir;
>>>  static vop_mknod_t ufs_mknod;
>>>  static vop_open_t  ufs_open;
>>> @@ -676,19 +676,22 @@ out:
>>>  }
>>>  #endif /* UFS_ACL */
>>>
>>> -/*
>>> - * Mark this file's access time for update for vfs_mark_atime().  This
>>> - * is called from execve() and mmap().
>>> - */
>>
>> Why remove this comment rather than update it?  It is largely still
>> true and explains the purpose of the VOP (update the atime) which is
>> now no longer obvious from the name.
>>
> 
> I don't think a fs-specific implementation of a VOP is the right place to
> state where it is called from. I would argue the name could be better as
> the execve bit is definitely not obvious, but interested parties can
> always grep.

This (always grep) is why comments matter.  If we wanted people to just use
grep and always UTSL, we wouldn't bother having any comments at all.  One
of the purposes of comments is to allow a human reader to understand the code
in context without needing several different windows open to piece together
what is happening.  In particular, the comment gives a better hint as to
_why_ we are updating the atime.  The old name did a better job of this than
the new one which is more bland, but presumably you have future changes to
add that are beyond just changing the atime and that is why you renamed it?

-- 
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"


Re: svn commit: r357695 - in head: sys/kern sys/sys usr.bin/procstat

2020-02-11 Thread John Baldwin
On 2/10/20 11:15 AM, Konstantin Belousov wrote:
> On Mon, Feb 10, 2020 at 10:11:43AM -0800, John Baldwin wrote:
>> On 2/9/20 4:10 AM, Konstantin Belousov wrote:
>>> Author: kib
>>> Date: Sun Feb  9 12:10:37 2020
>>> New Revision: 357695
>>> URL: https://svnweb.freebsd.org/changeset/base/357695
>>>
>>> Log:
>>>   Add AT_BSDFLAGS auxv entry.
>>>   
>>>   The intent is to provide bsd-specific flags relevant to interpreter
>>>   and C runtime.  I did not want to reuse AT_FLAGS which is common ELF
>>>   auxv entry.
>>>   
>>>   Use bsdflags to report kernel support for sigfastblock(2).  This
>>>   allows rtld and libthr to safely infer the syscall presence without
>>>   SIGSYS.  The tunable kern.elf{32,64}.sigfastblock blocks reporting.
>>>   
>>>   Tested by:pho
>>>   Disscussed with:  cem, emaste, jilles
>>>   Sponsored by: The FreeBSD Foundation
>>>   Differential revision:https://reviews.freebsd.org/D12773
>>
>> I find adding a new auxv type curious.  The MIPS ABI doc says that
>> "bits under the 0xff00 mask are reserved for system semantics".
>> The powerpc and x86-64 docs don't define any bits at all.  In
>> practice I think we are free to use AT_FLAGS however we wish as no
>> use cases of "standard" bits have arisen since AT_FLAGS was first
>> defined.
> 
> So you would prefer to have me used AT_FLAGS for sigfastblock indicator ?
> I am feeling uncomfortable doing that.
> 
> My reasoning, to reformulate it from what I wrote in the commit message,
> is to not pollute neither compilation nor ABI namespace for bsd-specific
> flags.  AT_FLAGS was not touched by anybody and I do not want to open
> it for use, since ABI group my finally find some use for it.

I would bet money the ABI group will never use AT_FLAGS since they haven't
found a use yet.  That said, adding a new auxv vector isn't the end of the
world.  I'll work on a patch to GDB when I get some spare time.

-- 
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"


Re: svn commit: r357740 - head/usr.sbin/ntp

2020-02-10 Thread John Baldwin
On 2/10/20 9:17 AM, Warner Losh wrote:
> Author: imp
> Date: Mon Feb 10 17:17:03 2020
> New Revision: 357740
> URL: https://svnweb.freebsd.org/changeset/base/357740
> 
> Log:
>   Refresh architecture list with latest:
>   
>   Remove: sparc, sparc64 (twice), ia64, alpha
>   Add: riscv64
>   
>   Remove now-useless sparc64 ifdef
>   
>   Reivewed by: cy@, bcr@
>   Differential Revision: https://reviews.freebsd.org/D23593
> 
> Modified:
>   head/usr.sbin/ntp/config.h
> 
> Modified: head/usr.sbin/ntp/config.h
> ==
> --- head/usr.sbin/ntp/config.hMon Feb 10 17:16:59 2020
> (r357739)
> +++ head/usr.sbin/ntp/config.hMon Feb 10 17:17:03 2020
> (r357740)
> @@ -1578,11 +1578,7 @@
>  /* #undef STRERROR_R_CHAR_P */
>  
>  /* canonical system (cpu-vendor-os) of where we should run */
> -#if defined(__alpha__)
> -#define STR_SYSTEM "alpha-undermydesk-freebsd"
> -#elif defined(__sparc64__)
> -#define STR_SYSTEM "sparc64-undermydesk-freebsd"
> -#elif defined(__amd64__)
> +#if defined(__amd64__)
>  #define STR_SYSTEM "amd64-undermydesk-freebsd"
>  #elif defined(__powerpc64__)
>  #define STR_SYSTEM "powerpc64-undermydesk-freebsd"
> @@ -1596,12 +1592,8 @@
>  #define STR_SYSTEM "arm64-undermydesk-freebsd"
>  #elif defined(__arm__)
>  #define STR_SYSTEM "arm-undermydesk-freebsd"
> -#elif defined(__sparc64__)
> -#define STR_SYSTEM "sparc64-undermydesk-freebsd"
> -#elif defined(__sparc__)
> -#define STR_SYSTEM "sparc-undermydesk-freebsd"
> -#elif defined(__ia64__)
> -#define STR_SYSTEM "ia64-undermydesk-freebsd"
> +#elif defined(__riscv__)
> +#define STR_SYSTEM "riscv64-undermydesk-freebsd"

This should be __riscv (see arch(7))

-- 
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"


Re: svn commit: r357703 - head/share/mk

2020-02-10 Thread John Baldwin
On 2/9/20 10:53 AM, Kyle Evans wrote:
> Author: kevans
> Date: Sun Feb  9 18:53:53 2020
> New Revision: 357703
> URL: https://svnweb.freebsd.org/changeset/base/357703
> 
> Log:
>   mips: mark GOOGLETEST broken, due to no fault of its own
>   
>   As explained in the comment; GOOGLETEST cannot currently be compiled on any
>   mips variant at the moment due to the cross toolchain seemingly using the
>   wrong spec and not pulling in libgcc. We'll be fine when llvm 10 lands, at
>   which point this should be reverted most expeditiously.

Hmm, I thought you were going to do this for any external GCC?  It's also
broken on amd64, etc. as well when using external GCC.

-- 
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"


Re: svn commit: r357695 - in head: sys/kern sys/sys usr.bin/procstat

2020-02-10 Thread John Baldwin
On 2/9/20 4:10 AM, Konstantin Belousov wrote:
> Author: kib
> Date: Sun Feb  9 12:10:37 2020
> New Revision: 357695
> URL: https://svnweb.freebsd.org/changeset/base/357695
> 
> Log:
>   Add AT_BSDFLAGS auxv entry.
>   
>   The intent is to provide bsd-specific flags relevant to interpreter
>   and C runtime.  I did not want to reuse AT_FLAGS which is common ELF
>   auxv entry.
>   
>   Use bsdflags to report kernel support for sigfastblock(2).  This
>   allows rtld and libthr to safely infer the syscall presence without
>   SIGSYS.  The tunable kern.elf{32,64}.sigfastblock blocks reporting.
>   
>   Tested by:  pho
>   Disscussed with:cem, emaste, jilles
>   Sponsored by:   The FreeBSD Foundation
>   Differential revision:  https://reviews.freebsd.org/D12773

I find adding a new auxv type curious.  The MIPS ABI doc says that
"bits under the 0xff00 mask are reserved for system semantics".
The powerpc and x86-64 docs don't define any bits at all.  In
practice I think we are free to use AT_FLAGS however we wish as no
use cases of "standard" bits have arisen since AT_FLAGS was first
defined.

-- 
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: r357643 - head/lib/libc/riscv/gen

2020-02-06 Thread John Baldwin
Author: jhb
Date: Thu Feb  6 21:46:15 2020
New Revision: 357643
URL: https://svnweb.freebsd.org/changeset/base/357643

Log:
  Tidy the _set_tp function for RISC-V.
  
  - Use a constant for the offset instead of a magic number.
  - Use an addi instruction that writes to tp directly instead of a mv
that writes the result of a compiler-generated addi.
  
  Reviewed by:  mhorne
  MFC after:1 week
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D23521

Modified:
  head/lib/libc/riscv/gen/_set_tp.c

Modified: head/lib/libc/riscv/gen/_set_tp.c
==
--- head/lib/libc/riscv/gen/_set_tp.c   Thu Feb  6 21:01:19 2020
(r357642)
+++ head/lib/libc/riscv/gen/_set_tp.c   Thu Feb  6 21:46:15 2020
(r357643)
@@ -38,13 +38,14 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
-
 #include 
 
+/* NB: size of 'struct tcb'. */
+#defineTP_OFFSET   (sizeof(void *) * 2)
+
 void
 _set_tp(void *tp)
 {
 
-   __asm __volatile("mv  tp, %0" :: "r"((char*)tp + 0x10));
+   __asm __volatile("addi  tp, %0, %1" :: "r" (tp), "I" (TP_OFFSET));
 }
___
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: r357632 - head/sys/riscv/riscv

2020-02-06 Thread John Baldwin
Author: jhb
Date: Thu Feb  6 18:04:45 2020
New Revision: 357632
URL: https://svnweb.freebsd.org/changeset/base/357632

Log:
  Use the context created in makectx() for stack traces.
  
  Always use the kdb_thr_ctx() for db_trace_thread() as on other
  architectures.  Initialize pcb_ra to be the sepc from the saved
  trapframe rather than the saved ra to avoid skipping a frame.
  
  Reviewed by:  mhorne, br
  MFC after:1 week
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D23513

Modified:
  head/sys/riscv/riscv/db_trace.c
  head/sys/riscv/riscv/machdep.c

Modified: head/sys/riscv/riscv/db_trace.c
==
--- head/sys/riscv/riscv/db_trace.c Thu Feb  6 18:04:15 2020
(r357631)
+++ head/sys/riscv/riscv/db_trace.c Thu Feb  6 18:04:45 2020
(r357632)
@@ -130,15 +130,12 @@ db_trace_thread(struct thread *thr, int count)
struct unwind_state frame;
struct pcb *ctx;
 
-   if (thr != curthread) {
-   ctx = kdb_thr_ctx(thr);
+   ctx = kdb_thr_ctx(thr);
 
-   frame.sp = (uint64_t)ctx->pcb_sp;
-   frame.fp = (uint64_t)ctx->pcb_s[0];
-   frame.pc = (uint64_t)ctx->pcb_ra;
-   db_stack_trace_cmd();
-   } else
-   db_trace_self();
+   frame.sp = (uint64_t)ctx->pcb_sp;
+   frame.fp = (uint64_t)ctx->pcb_s[0];
+   frame.pc = (uint64_t)ctx->pcb_ra;
+   db_stack_trace_cmd();
return (0);
 }
 

Modified: head/sys/riscv/riscv/machdep.c
==
--- head/sys/riscv/riscv/machdep.c  Thu Feb  6 18:04:15 2020
(r357631)
+++ head/sys/riscv/riscv/machdep.c  Thu Feb  6 18:04:45 2020
(r357632)
@@ -571,7 +571,7 @@ makectx(struct trapframe *tf, struct pcb *pcb)
 
memcpy(pcb->pcb_s, tf->tf_s, sizeof(tf->tf_s));
 
-   pcb->pcb_ra = tf->tf_ra;
+   pcb->pcb_ra = tf->tf_sepc;
pcb->pcb_sp = tf->tf_sp;
pcb->pcb_gp = tf->tf_gp;
pcb->pcb_tp = tf->tf_tp;
___
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: r357630 - head/sys/riscv/riscv

2020-02-06 Thread John Baldwin
Author: jhb
Date: Thu Feb  6 18:02:38 2020
New Revision: 357630
URL: https://svnweb.freebsd.org/changeset/base/357630

Log:
  Fix DDB to unwind across exception frames.
  
  While here, add an extra line of information for exceptions and
  interrupts and compress the per-frame line down to one line to match
  other architectures.
  
  Reviewed by:  mhorne, br
  MFC after:1 week
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D23508

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

Modified: head/sys/riscv/riscv/db_trace.c
==
--- head/sys/riscv/riscv/db_trace.c Thu Feb  6 18:00:50 2020
(r357629)
+++ head/sys/riscv/riscv/db_trace.c Thu Feb  6 18:02:38 2020
(r357630)
@@ -2,6 +2,7 @@
  * Copyright (c) 2015 The FreeBSD Foundation
  * Copyright (c) 2016 Ruslan Bukin 
  * All rights reserved.
+ * Copyright (c) 2020 John Baldwin 
  *
  * Portions of this software were developed by Semihalf under
  * the sponsorship of the FreeBSD Foundation.
@@ -38,15 +39,18 @@
 
 #include 
 __FBSDID("$FreeBSD$");
+
 #include 
-#include 
 #include 
-#include 
+#include 
+
 #include 
 #include 
 
+#include 
 #include 
 #include 
+#include 
 
 void
 db_md_list_watchpoints()
@@ -80,9 +84,6 @@ db_stack_trace_cmd(struct unwind_state *frame)
while (1) {
pc = frame->pc;
 
-   if (unwind_frame(frame) < 0)
-   break;
-
sym = db_search_symbol(pc, DB_STGY_ANY, );
if (sym == C_DB_SYM_NULL) {
value = 0;
@@ -94,11 +95,32 @@ db_stack_trace_cmd(struct unwind_state *frame)
db_printsym(frame->pc, DB_STGY_PROC);
db_printf("\n");
 
-   db_printf("\t pc = 0x%016lx ra = 0x%016lx\n",
-   pc, frame->pc);
-   db_printf("\t sp = 0x%016lx fp = 0x%016lx\n",
-   frame->sp, frame->fp);
-   db_printf("\n");
+   if (strcmp(name, "cpu_exception_handler_supervisor") == 0 ||
+   strcmp(name, "cpu_exception_handler_user") == 0) {
+   struct trapframe *tf;
+
+   tf = (struct trapframe *)(uintptr_t)frame->sp;
+
+   if (tf->tf_scause & EXCP_INTR)
+   db_printf("--- interrupt %ld\n",
+   tf->tf_scause & EXCP_MASK);
+   else
+   db_printf("--- exception %ld, tval = %#lx\n",
+   tf->tf_scause & EXCP_MASK,
+   tf->tf_stval);
+   frame->sp = (uint64_t)tf->tf_sp;
+   frame->fp = (uint64_t)tf->tf_s[0];
+   frame->pc = (uint64_t)tf->tf_sepc;
+   if (!INKERNEL(frame->fp))
+   break;
+   continue;
+   }
+
+   if (strcmp(name, "fork_trampoline") == 0)
+   break;
+
+   if (unwind_frame(frame) < 0)
+   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: r357595 - head/sys/riscv/include

2020-02-05 Thread John Baldwin
Author: jhb
Date: Wed Feb  5 20:34:22 2020
New Revision: 357595
URL: https://svnweb.freebsd.org/changeset/base/357595

Log:
  Fix EXCP_MASK to include all relevant bits from scause.
  
  While cause codes higher than 16 are reserved, the exception code
  field of the register is defined to be all bits but the upper-most
  bit.
  
  Reviewed by:  mhorne
  MFC after:1 week
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D23510

Modified:
  head/sys/riscv/include/riscvreg.h

Modified: head/sys/riscv/include/riscvreg.h
==
--- head/sys/riscv/include/riscvreg.h   Wed Feb  5 20:32:37 2020
(r357594)
+++ head/sys/riscv/include/riscvreg.h   Wed Feb  5 20:34:22 2020
(r357595)
@@ -37,8 +37,7 @@
 #ifndef _MACHINE_RISCVREG_H_
 #define_MACHINE_RISCVREG_H_
 
-#defineEXCP_SHIFT  0
-#defineEXCP_MASK   (0xf << EXCP_SHIFT)
+#defineEXCP_MASK   (~EXCP_INTR)
 #defineEXCP_MISALIGNED_FETCH   0
 #defineEXCP_FAULT_FETCH1
 #defineEXCP_ILLEGAL_INSTRUCTION2
___
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: r357594 - head/sys/riscv/riscv

2020-02-05 Thread John Baldwin
Author: jhb
Date: Wed Feb  5 20:32:37 2020
New Revision: 357594
URL: https://svnweb.freebsd.org/changeset/base/357594

Log:
  Use csr_read() to read sstatus instead of inline assembly.
  
  While here, remove a local variable to avoid the CSR read in non-debug
  kernels.
  
  Reviewed by:  mhorne
  MFC after:1 week
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D23511

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

Modified: head/sys/riscv/riscv/trap.c
==
--- head/sys/riscv/riscv/trap.c Wed Feb  5 20:11:08 2020(r357593)
+++ head/sys/riscv/riscv/trap.c Wed Feb  5 20:32:37 2020(r357594)
@@ -245,12 +245,10 @@ void
 do_trap_supervisor(struct trapframe *frame)
 {
uint64_t exception;
-   uint64_t sstatus;
 
/* Ensure we came from supervisor mode, interrupts disabled */
-   __asm __volatile("csrr %0, sstatus" : "=" (sstatus));
-   KASSERT((sstatus & (SSTATUS_SPP | SSTATUS_SIE)) == SSTATUS_SPP,
-   ("We must came from S mode with interrupts disabled"));
+   KASSERT((csr_read(sstatus) & (SSTATUS_SPP | SSTATUS_SIE)) ==
+   SSTATUS_SPP, ("Came from S mode with interrupts enabled"));
 
exception = (frame->tf_scause & EXCP_MASK);
if (frame->tf_scause & EXCP_INTR) {
@@ -305,7 +303,6 @@ do_trap_user(struct trapframe *frame)
 {
uint64_t exception;
struct thread *td;
-   uint64_t sstatus;
struct pcb *pcb;
 
td = curthread;
@@ -313,9 +310,8 @@ do_trap_user(struct trapframe *frame)
pcb = td->td_pcb;
 
/* Ensure we came from usermode, interrupts disabled */
-   __asm __volatile("csrr %0, sstatus" : "=" (sstatus));
-   KASSERT((sstatus & (SSTATUS_SPP | SSTATUS_SIE)) == 0,
-   ("We must came from U mode with interrupts disabled"));
+   KASSERT((csr_read(sstatus) & (SSTATUS_SPP | SSTATUS_SIE)) == 0,
+   ("Came from U mode with interrupts enabled"));
 
exception = (frame->tf_scause & EXCP_MASK);
if (frame->tf_scause & EXCP_INTR) {
___
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: r357593 - head/sys/riscv/riscv

2020-02-05 Thread John Baldwin
Author: jhb
Date: Wed Feb  5 20:11:08 2020
New Revision: 357593
URL: https://svnweb.freebsd.org/changeset/base/357593

Log:
  Remove stale workaround for the htif console.
  
  In practice this discarded all characters entered at the DDB prompt.
  
  Reviewed by:  br
  MFC after:1 week
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D23509

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

Modified: head/sys/riscv/riscv/riscv_console.c
==
--- head/sys/riscv/riscv/riscv_console.cWed Feb  5 20:08:01 2020
(r357592)
+++ head/sys/riscv/riscv/riscv_console.cWed Feb  5 20:11:08 2020
(r357593)
@@ -206,20 +206,6 @@ riscv_cngetc(struct consdev *cp)
 {
int ch;
 
-#if defined(KDB)
-   /*
-* RISCVTODO: BBL polls for console data on timer interrupt,
-* but interrupts are turned off in KDB.
-* So we currently do not have console in KDB.
-*/
-   if (kdb_active) {
-   ch = sbi_console_getchar();
-   while (ch) {
-   ch = sbi_console_getchar();
-   }
-   }
-#endif
-
ch = sbi_console_getchar();
if (ch > 0 && ch < 0xff) {
 #if defined(KDB)
___
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: r357591 - head/sys/riscv/include

2020-02-05 Thread John Baldwin
Author: jhb
Date: Wed Feb  5 20:06:35 2020
New Revision: 357591
URL: https://svnweb.freebsd.org/changeset/base/357591

Log:
  Read the breakpoint instruction to determine its length in BKPT_SKIP.
  
  This fixes continuing from debug.kdb.enter=1 after enabling the use of
  compressed instructions since the compiler can emit the two byte
  c.ebreak instead of the 4 byte ebreak.
  
  Reviewed by:  br
  MFC after:1 week
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D23507

Modified:
  head/sys/riscv/include/db_machdep.h

Modified: head/sys/riscv/include/db_machdep.h
==
--- head/sys/riscv/include/db_machdep.h Wed Feb  5 19:39:48 2020
(r357590)
+++ head/sys/riscv/include/db_machdep.h Wed Feb  5 20:06:35 2020
(r357591)
@@ -53,8 +53,14 @@ typedef long db_expr_t;
 #defineBKPT_SIZE   (INSN_SIZE)
 #defineBKPT_SET(inst)  (BKPT_INST)
 
-#defineBKPT_SKIP do {  \
-   kdb_frame->tf_sepc += BKPT_SIZE;\
+#defineBKPT_SKIP do {  
\
+   uint32_t _instr;\
+   \
+   _instr = db_get_value(PC_REGS(), sizeof(uint32_t), FALSE);  \
+   if ((_instr & 0x3) == 0x3)  \
+   kdb_frame->tf_sepc += 4;/* ebreak */\
+   else\
+   kdb_frame->tf_sepc += 2;/* c.ebreak */  \
 } while (0)
 
 #definedb_clear_single_stepkdb_cpu_clear_singlestep
___
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: r357361 - in head/sys: kern sys ufs/ufs vm

2020-02-03 Thread John Baldwin
On 1/31/20 10:46 PM, Mateusz Guzik wrote:
> Author: mjg
> Date: Sat Feb  1 06:46:55 2020
> New Revision: 357361
> URL: https://svnweb.freebsd.org/changeset/base/357361
> 
> Log:
>   vfs: replace VOP_MARKATIME with VOP_MMAPPED
>   
>   The routine is only provided by ufs and is only used on mmap and exec.
>   
>   Reviewed by:kib
>   Differential Revision:  https://reviews.freebsd.org/D23422
> 
> Modified:
>   head/sys/kern/kern_exec.c
>   head/sys/kern/vfs_subr.c
>   head/sys/kern/vnode_if.src
>   head/sys/sys/vnode.h
>   head/sys/ufs/ufs/ufs_vnops.c
>   head/sys/vm/vm_mmap.c
> 
> Modified: head/sys/ufs/ufs/ufs_vnops.c
> ==
> --- head/sys/ufs/ufs/ufs_vnops.c  Sat Feb  1 06:41:44 2020
> (r357360)
> +++ head/sys/ufs/ufs/ufs_vnops.c  Sat Feb  1 06:46:55 2020
> (r357361)
> @@ -108,7 +108,7 @@ static vop_getattr_t  ufs_getattr;
>  static vop_ioctl_t   ufs_ioctl;
>  static vop_link_tufs_link;
>  static int ufs_makeinode(int mode, struct vnode *, struct vnode **, struct 
> componentname *, const char *);
> -static vop_markatime_t   ufs_markatime;
> +static vop_mmapped_t ufs_mmapped;
>  static vop_mkdir_t   ufs_mkdir;
>  static vop_mknod_t   ufs_mknod;
>  static vop_open_tufs_open;
> @@ -676,19 +676,22 @@ out:
>  }
>  #endif /* UFS_ACL */
>  
> -/*
> - * Mark this file's access time for update for vfs_mark_atime().  This
> - * is called from execve() and mmap().
> - */

Why remove this comment rather than update it?  It is largely still
true and explains the purpose of the VOP (update the atime) which is
now no longer obvious from the name.

-- 
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"


Re: svn commit: r357407 - head

2020-02-03 Thread John Baldwin
On 2/2/20 3:37 AM, Warner Losh wrote:
> Author: imp
> Date: Sun Feb  2 11:37:27 2020
> New Revision: 357407
> URL: https://svnweb.freebsd.org/changeset/base/357407
> 
> Log:
>   Per the firm plan, start to remove sparc64
>   
>   The sparc64 architecture is being removed from FreeBSD 13, starting
>   now. This removes it from the top level only. It is the only
>   architecture that didn't see substantial work after the call to get
>   things working with the external toolchain.
> 
> Modified:
>   head/Makefile
>   head/Makefile.inc1
> 
> Modified: head/Makefile.inc1
> ==
> --- head/Makefile.inc1Sun Feb  2 09:38:40 2020(r357406)
> +++ head/Makefile.inc1Sun Feb  2 11:37:27 2020(r357407)
> @@ -2915,14 +2912,10 @@ _cddl_lib_libctf= cddl/lib/libctf
>  _cddl_lib= cddl/lib
>  cddl/lib/libctf__L: lib/libz__L
>  .endif
> -# cddl/lib/libdtrace requires lib/libproc and lib/librtld_db; it's only built
> -# on select architectures though (see cddl/lib/Makefile)

The comment should stay, probably as:

# cddl/lib/libdtrace requires lib/libproc and lib/librtld_db

> -.if ${MACHINE_CPUARCH} != "sparc64"
>  _prebuild_libs+= lib/libprocstat lib/libproc lib/librtld_db
>  lib/libprocstat__L: lib/libelf__L lib/libkvm__L lib/libutil__L
>  lib/libproc__L: lib/libprocstat__L
>  lib/librtld_db__L: lib/libprocstat__L
> -.endif

-- 
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"


Re: svn commit: r357337 - head/sys/riscv/include

2020-01-31 Thread John Baldwin
On 1/31/20 1:17 PM, Conrad Meyer wrote:
> Hi John,
> 
> Isn't the 32-bit MSTATUS_SD and SSTATUS_SD also UB without explicit
> unsigned suffix?

Possibly, but I doubt we will have a 32-bit RISC-V port.  I'd
probably prefer to just use explicit hex values (0x8000, etc.)
since the compiler will always get those correct.

-- 
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: r357344 - head/sys/riscv/riscv

2020-01-31 Thread John Baldwin
Author: jhb
Date: Fri Jan 31 19:00:48 2020
New Revision: 357344
URL: https://svnweb.freebsd.org/changeset/base/357344

Log:
  Add stricter checks on user changes to SSTATUS.
  
  Rather than trying to blacklist which bits userland can't write to via
  sigreturn() or setcontext(), only permit changes to whitelisted bits.
  
  - Permit arbitrary writes to bits in the user-writable USTATUS
register that shadows SSTATUS.
  
  - Ignore changes in write-only bits maintained by the CPU.
  
  - Ignore the user-supplied value of the FS field used to track
floating point state and instead set it to a value matching the
actions taken by set_fpcontext().
  
  Discussed with:   mhorne
  MFC after:2 weeks
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D23338

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

Modified: head/sys/riscv/riscv/machdep.c
==
--- head/sys/riscv/riscv/machdep.c  Fri Jan 31 18:55:21 2020
(r357343)
+++ head/sys/riscv/riscv/machdep.c  Fri Jan 31 19:00:48 2020
(r357344)
@@ -368,11 +368,16 @@ set_mcontext(struct thread *td, mcontext_t *mcp)
tf = td->td_frame;
 
/*
-* Make sure the processor mode has not been tampered with and
-* interrupts have not been disabled.
-* Supervisor interrupts in user mode are always enabled.
+* Permit changes to the USTATUS bits of SSTATUS.
+*
+* Ignore writes to read-only bits (SD, XS).
+*
+* Ignore writes to the FS field as set_fpcontext() will set
+* it explicitly.
 */
-   if ((mcp->mc_gpregs.gp_sstatus & SSTATUS_SPP) != 0)
+   if (((mcp->mc_gpregs.gp_sstatus ^ tf->tf_sstatus) &
+   ~(SSTATUS_SD | SSTATUS_XS_MASK | SSTATUS_FS_MASK | SSTATUS_UPIE |
+   SSTATUS_UIE)) != 0)
return (EINVAL);
 
memcpy(tf->tf_t, mcp->mc_gpregs.gp_t, sizeof(tf->tf_t));
@@ -426,7 +431,12 @@ set_fpcontext(struct thread *td, mcontext_t *mcp)
 {
 #ifdef FPE
struct pcb *curpcb;
+#endif
 
+   td->td_frame->tf_sstatus &= ~SSTATUS_FS_MASK;
+   td->td_frame->tf_sstatus |= SSTATUS_FS_OFF;
+
+#ifdef FPE
critical_enter();
 
if ((mcp->mc_flags & _MC_FP_VALID) != 0) {
@@ -436,6 +446,7 @@ set_fpcontext(struct thread *td, mcontext_t *mcp)
sizeof(mcp->mc_fpregs));
curpcb->pcb_fcsr = mcp->mc_fpregs.fp_fcsr;
curpcb->pcb_fpflags = mcp->mc_fpregs.fp_flags & PCB_FP_USERMASK;
+   td->td_frame->tf_sstatus |= SSTATUS_FS_CLEAN;
}
 
critical_exit();
___
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: r357337 - head/sys/riscv/include

2020-01-31 Thread John Baldwin
Author: jhb
Date: Fri Jan 31 17:49:15 2020
New Revision: 357337
URL: https://svnweb.freebsd.org/changeset/base/357337

Log:
  Fix 64-bit value of SSTATUS_SD to use an unsigned long.
  
  While here, fix MSTATUS_SD to match SSTATUS_SD.
  
  Reviewed by:  mhorne
  MFC after:2 weeks
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D23434

Modified:
  head/sys/riscv/include/riscvreg.h

Modified: head/sys/riscv/include/riscvreg.h
==
--- head/sys/riscv/include/riscvreg.h   Fri Jan 31 17:40:41 2020
(r357336)
+++ head/sys/riscv/include/riscvreg.h   Fri Jan 31 17:49:15 2020
(r357337)
@@ -73,7 +73,7 @@
 #defineSSTATUS_XS_MASK (0x3 << SSTATUS_XS_SHIFT)
 #defineSSTATUS_SUM (1 << 18)
 #if __riscv_xlen == 64
-#defineSSTATUS_SD  (1 << 63)
+#defineSSTATUS_SD  (1ul << 63)
 #else
 #defineSSTATUS_SD  (1 << 31)
 #endif
@@ -110,8 +110,11 @@
 #define MSTATUS_VM_SV4810
 #define MSTATUS_VM_SV5711
 #define MSTATUS_VM_SV6412
-#defineMSTATUS32_SD(1 << 63)
-#defineMSTATUS64_SD(1 << 31)
+#if __riscv_xlen == 64
+#defineMSTATUS_SD  (1ul << 63)
+#else
+#defineMSTATUS_SD  (1 << 31)
+#endif
 
 #defineMSTATUS_PRV_U   0   /* user */
 #defineMSTATUS_PRV_S   1   /* supervisor */
___
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: r357313 - head/sys/riscv/riscv

2020-01-30 Thread John Baldwin
Author: jhb
Date: Thu Jan 30 22:19:48 2020
New Revision: 357313
URL: https://svnweb.freebsd.org/changeset/base/357313

Log:
  Trim duplicate CSR swaps from user exceptions.
  
  The stack pointer is swapped with the sscratch CSR just before the
  jump to cpu_exception_handler_user where the first instruction swaps
  it again.  The two swaps together are a no-op, but the csr swap
  instructions can be expensive (e.g. on Bluespec RISC-V cores csr swap
  instructions force a full pipeline stall).
  
  Reported by:  jrtc27
  Reviewed by:  br
  MFC after:2 weeks
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D23394

Modified:
  head/sys/riscv/riscv/exception.S

Modified: head/sys/riscv/riscv/exception.S
==
--- head/sys/riscv/riscv/exception.SThu Jan 30 20:05:05 2020
(r357312)
+++ head/sys/riscv/riscv/exception.SThu Jan 30 22:19:48 2020
(r357313)
@@ -208,7 +208,6 @@ ENTRY(cpu_exception_handler)
csrrw   sp, sscratch, sp
beqzsp, 1f
/* User mode detected */
-   csrrw   sp, sscratch, sp
j   cpu_exception_handler_user
 1:
/* Supervisor mode detected */
@@ -225,7 +224,6 @@ ENTRY(cpu_exception_handler_supervisor)
 END(cpu_exception_handler_supervisor)
 
 ENTRY(cpu_exception_handler_user)
-   csrrw   sp, sscratch, sp
save_registers 0
mv  a0, sp
call_C_LABEL(do_trap_user)
___
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: r357305 - in head/sys/riscv: include riscv

2020-01-30 Thread John Baldwin
Author: jhb
Date: Thu Jan 30 19:15:27 2020
New Revision: 357305
URL: https://svnweb.freebsd.org/changeset/base/357305

Log:
  Remove unused fields from struct pcb.
  
  cpu_switch/throw() and savectx() do not save or restore any values in
  these fields which mostly held non-callee-save registers.
  
  makectx() copied these fields from kdb_frame, but they weren't used
  except for PC_REGS using pcb_sepc.  Change PC_REGS to use
  kdb_frame->tf_sepc directly instead.
  
  Reviewed by:  br
  MFC after:2 weeks
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D23395

Modified:
  head/sys/riscv/include/db_machdep.h
  head/sys/riscv/include/pcb.h
  head/sys/riscv/riscv/genassym.c
  head/sys/riscv/riscv/machdep.c

Modified: head/sys/riscv/include/db_machdep.h
==
--- head/sys/riscv/include/db_machdep.h Thu Jan 30 18:49:19 2020
(r357304)
+++ head/sys/riscv/include/db_machdep.h Thu Jan 30 19:15:27 2020
(r357305)
@@ -47,7 +47,7 @@
 typedef vm_offset_tdb_addr_t;
 typedef long   db_expr_t;
 
-#definePC_REGS()   ((db_addr_t)kdb_thrctx->pcb_sepc)
+#definePC_REGS()   ((db_addr_t)kdb_frame->tf_sepc)
 
 #defineBKPT_INST   (0x00100073)
 #defineBKPT_SIZE   (INSN_SIZE)

Modified: head/sys/riscv/include/pcb.h
==
--- head/sys/riscv/include/pcb.hThu Jan 30 18:49:19 2020
(r357304)
+++ head/sys/riscv/include/pcb.hThu Jan 30 19:15:27 2020
(r357305)
@@ -46,15 +46,12 @@ struct pcb {
uint64_tpcb_sp; /* Stack pointer */
uint64_tpcb_gp; /* Global pointer */
uint64_tpcb_tp; /* Thread pointer */
-   uint64_tpcb_t[7];   /* Temporary registers */
uint64_tpcb_s[12];  /* Saved registers */
-   uint64_tpcb_a[8];   /* Argument registers */
uint64_tpcb_x[32][2];   /* Floating point registers */
uint64_tpcb_fcsr;   /* Floating point control reg */
uint64_tpcb_fpflags;/* Floating point flags */
 #definePCB_FP_STARTED  0x1
 #definePCB_FP_USERMASK 0x1
-   uint64_tpcb_sepc;   /* Supervisor exception pc */
vm_offset_t pcb_onfault;/* Copyinout fault handler */
 };
 

Modified: head/sys/riscv/riscv/genassym.c
==
--- head/sys/riscv/riscv/genassym.c Thu Jan 30 18:49:19 2020
(r357304)
+++ head/sys/riscv/riscv/genassym.c Thu Jan 30 19:15:27 2020
(r357305)
@@ -69,9 +69,7 @@ ASSYM(PCB_RA, offsetof(struct pcb, pcb_ra));
 ASSYM(PCB_SP, offsetof(struct pcb, pcb_sp));
 ASSYM(PCB_GP, offsetof(struct pcb, pcb_gp));
 ASSYM(PCB_TP, offsetof(struct pcb, pcb_tp));
-ASSYM(PCB_T, offsetof(struct pcb, pcb_t));
 ASSYM(PCB_S, offsetof(struct pcb, pcb_s));
-ASSYM(PCB_A, offsetof(struct pcb, pcb_a));
 ASSYM(PCB_X, offsetof(struct pcb, pcb_x));
 ASSYM(PCB_FCSR, offsetof(struct pcb, pcb_fcsr));
 

Modified: head/sys/riscv/riscv/machdep.c
==
--- head/sys/riscv/riscv/machdep.c  Thu Jan 30 18:49:19 2020
(r357304)
+++ head/sys/riscv/riscv/machdep.c  Thu Jan 30 19:15:27 2020
(r357305)
@@ -558,15 +558,12 @@ void
 makectx(struct trapframe *tf, struct pcb *pcb)
 {
 
-   memcpy(pcb->pcb_t, tf->tf_t, sizeof(tf->tf_t));
memcpy(pcb->pcb_s, tf->tf_s, sizeof(tf->tf_s));
-   memcpy(pcb->pcb_a, tf->tf_a, sizeof(tf->tf_a));
 
pcb->pcb_ra = tf->tf_ra;
pcb->pcb_sp = tf->tf_sp;
pcb->pcb_gp = tf->tf_gp;
pcb->pcb_tp = tf->tf_tp;
-   pcb->pcb_sepc = tf->tf_sepc;
 }
 
 void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r357302 - head/sys/kern

2020-01-30 Thread John Baldwin
Author: jhb
Date: Thu Jan 30 18:28:02 2020
New Revision: 357302
URL: https://svnweb.freebsd.org/changeset/base/357302

Log:
  Fix use of an uninitialized variable.
  
  ctx (and thus ctx.flags) is stack garbage at the start of this
  function, so initialize ctx.flags to an explicit value instead of
  using binary operations on the garbage.
  
  Reported by:  gcc9
  Reviewed by:  imp
  Differential Revision:https://reviews.freebsd.org/D23368

Modified:
  head/sys/kern/subr_stats.c

Modified: head/sys/kern/subr_stats.c
==
--- head/sys/kern/subr_stats.c  Thu Jan 30 18:12:41 2020(r357301)
+++ head/sys/kern/subr_stats.c  Thu Jan 30 18:28:02 2020(r357302)
@@ -1583,9 +1583,7 @@ stats_v1_blob_iter(struct statsblobv1 *sb, stats_v1_bl
int i, j, firstvoi;
 
ctx.usrctx = usrctx;
-   ctx.flags |= SB_IT_FIRST_CB;
-   ctx.flags &= ~(SB_IT_FIRST_VOI | SB_IT_LAST_VOI | SB_IT_FIRST_VOISTAT |
-   SB_IT_LAST_VOISTAT);
+   ctx.flags = SB_IT_FIRST_CB;
firstvoi = 1;
 
for (i = 0; i < NVOIS(sb); i++) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r357147 - head/sys/kern

2020-01-26 Thread John Baldwin
On 1/26/20 6:23 AM, John Baldwin wrote:
> Author: jhb
> Date: Sun Jan 26 14:23:27 2020
> New Revision: 357147
> URL: https://svnweb.freebsd.org/changeset/base/357147
> 
> Log:
>   Revert accidental change from r357146.

Oops, this was a different warning fix which I've opened a separate review for
(this one was found by gcc 9 instead of clang 10).

-- 
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: r357147 - head/sys/kern

2020-01-26 Thread John Baldwin
Author: jhb
Date: Sun Jan 26 14:23:27 2020
New Revision: 357147
URL: https://svnweb.freebsd.org/changeset/base/357147

Log:
  Revert accidental change from r357146.

Modified:
  head/sys/kern/subr_stats.c

Modified: head/sys/kern/subr_stats.c
==
--- head/sys/kern/subr_stats.c  Sun Jan 26 14:20:57 2020(r357146)
+++ head/sys/kern/subr_stats.c  Sun Jan 26 14:23:27 2020(r357147)
@@ -1583,7 +1583,9 @@ stats_v1_blob_iter(struct statsblobv1 *sb, stats_v1_bl
int i, j, firstvoi;
 
ctx.usrctx = usrctx;
-   ctx.flags = SB_IT_FIRST_CB;
+   ctx.flags |= SB_IT_FIRST_CB;
+   ctx.flags &= ~(SB_IT_FIRST_VOI | SB_IT_LAST_VOI | SB_IT_FIRST_VOISTAT |
+   SB_IT_LAST_VOISTAT);
firstvoi = 1;
 
for (i = 0; i < NVOIS(sb); i++) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r357146 - in head/sys: dev/mrsas dev/sound/pci kern

2020-01-26 Thread John Baldwin
Author: jhb
Date: Sun Jan 26 14:20:57 2020
New Revision: 357146
URL: https://svnweb.freebsd.org/changeset/base/357146

Log:
  Fix some misleading indentation warnings reported by recent clang.
  
  These should not be any functional change.  While the change in
  emul10kx-pcm.c looks like a real bug fix (as opposed to inconsistent
  whitespace), the extra statements were not harmful.
  
  Reviewed by:  kib
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D23363

Modified:
  head/sys/dev/mrsas/mrsas_cam.c
  head/sys/dev/sound/pci/emu10k1.c
  head/sys/dev/sound/pci/emu10kx-pcm.c
  head/sys/kern/subr_stats.c

Modified: head/sys/dev/mrsas/mrsas_cam.c
==
--- head/sys/dev/mrsas/mrsas_cam.c  Sun Jan 26 14:19:08 2020
(r357145)
+++ head/sys/dev/mrsas/mrsas_cam.c  Sun Jan 26 14:20:57 2020
(r357146)
@@ -1908,13 +1908,14 @@ mrsas_track_scsiio(struct mrsas_softc *sc, target_id_t
for (i = 0 ; i < sc->max_fw_cmds; i++) {
mpt_cmd = sc->mpt_cmd_list[i];
 
-   /*
-* Check if the target_id and bus_id is same as the timeout IO
-*/
-   if (mpt_cmd->ccb_ptr) {
-   /* bus_id = 1 denotes a VD */
-   if (bus_id == 1)
-   tgt_id = (mpt_cmd->ccb_ptr->ccb_h.target_id - 
(MRSAS_MAX_PD - 1));
+   /*
+* Check if the target_id and bus_id is same as the timeout IO
+*/
+   if (mpt_cmd->ccb_ptr) {
+   /* bus_id = 1 denotes a VD */
+   if (bus_id == 1)
+   tgt_id =
+   (mpt_cmd->ccb_ptr->ccb_h.target_id - 
(MRSAS_MAX_PD - 1));
 
if (mpt_cmd->ccb_ptr->cpi.bus_id == bus_id &&
mpt_cmd->ccb_ptr->ccb_h.target_id == tgt_id) {

Modified: head/sys/dev/sound/pci/emu10k1.c
==
--- head/sys/dev/sound/pci/emu10k1.cSun Jan 26 14:19:08 2020
(r357145)
+++ head/sys/dev/sound/pci/emu10k1.cSun Jan 26 14:20:57 2020
(r357146)
@@ -1257,11 +1257,12 @@ emu_intr(void *data)
 #endif
}
 
-   if (stat & EMU_IPR_MIDIRECVBUFE)
-   if (sc->mpu_intr) {
-   (sc->mpu_intr)(sc->mpu);
-   ack |= EMU_IPR_MIDIRECVBUFE | EMU_IPR_MIDITRANSBUFE;
-   }
+   if (stat & EMU_IPR_MIDIRECVBUFE) {
+   if (sc->mpu_intr) {
+   (sc->mpu_intr)(sc->mpu);
+   ack |= EMU_IPR_MIDIRECVBUFE | 
EMU_IPR_MIDITRANSBUFE;
+   }
+   }
if (stat & ~ack)
device_printf(sc->dev, "dodgy irq: %x (harmless)\n",
stat & ~ack);

Modified: head/sys/dev/sound/pci/emu10kx-pcm.c
==
--- head/sys/dev/sound/pci/emu10kx-pcm.cSun Jan 26 14:19:08 2020
(r357145)
+++ head/sys/dev/sound/pci/emu10kx-pcm.cSun Jan 26 14:20:57 2020
(r357146)
@@ -263,11 +263,12 @@ emu_dspmixer_uninit(struct snd_mixer *m)
 
/* drop submixer for AC97 codec */
sc = mix_getdevinfo(m);
-   if (sc->sm != NULL)
+   if (sc->sm != NULL) {
err = mixer_delete(sc->sm);
if (err)
return (err);
sc->sm = NULL;
+   }
return (0);
 }
 

Modified: head/sys/kern/subr_stats.c
==
--- head/sys/kern/subr_stats.c  Sun Jan 26 14:19:08 2020(r357145)
+++ head/sys/kern/subr_stats.c  Sun Jan 26 14:20:57 2020(r357146)
@@ -1583,9 +1583,7 @@ stats_v1_blob_iter(struct statsblobv1 *sb, stats_v1_bl
int i, j, firstvoi;
 
ctx.usrctx = usrctx;
-   ctx.flags |= SB_IT_FIRST_CB;
-   ctx.flags &= ~(SB_IT_FIRST_VOI | SB_IT_LAST_VOI | SB_IT_FIRST_VOISTAT |
-   SB_IT_LAST_VOISTAT);
+   ctx.flags = SB_IT_FIRST_CB;
firstvoi = 1;
 
for (i = 0; i < NVOIS(sb); i++) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r357145 - head/sys/conf

2020-01-26 Thread John Baldwin
Author: jhb
Date: Sun Jan 26 14:19:08 2020
New Revision: 357145
URL: https://svnweb.freebsd.org/changeset/base/357145

Log:
  Compile hack.c with normal CFLAGS + -shared -nostdlib.
  
  Originally, hack.c was compiled into a shard object with just -shared
  -nostdlib.  This assumed that ${CC} did not require any additional
  flags for ABIs, cross-building, etc.
  
  When kern.post.mk was created in r89509 by reducing duplication in
  kernel Makefile. files, the -shared flag was moved into a
  HACK_EXTRA_FLAGS variable so that sparc64 could override it with
  -Wl,-shared.  The sparc64 hack was removed in r111650, but
  HACK_EXTRA_FLAGS was left in place.  Over time, we have started
  support toolchains that require flags to support alternate ABIs on
  MIPS and PowerPC and started (ab)using HACK_EXTRA_FLAGS to set only
  those flags.
  
  I need to fix risc-v to pass -mno-relax to the hack.c build for lld in
  llvm 10, and the patches to support cross-build from non-FreeBSD hosts
  need to include -target for clang in CFLAGS for hack.c.  Rather than
  adding more hacks into HACK_EXTRA_FLAGS, just use the full set of
  CFLAGS with hack.c.
  
  Reviewed by:  kib, arichardson
  MFC after:1 month
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D23362

Modified:
  head/sys/conf/Makefile.mips
  head/sys/conf/Makefile.powerpc
  head/sys/conf/kern.post.mk

Modified: head/sys/conf/Makefile.mips
==
--- head/sys/conf/Makefile.mips Sun Jan 26 11:54:21 2020(r357144)
+++ head/sys/conf/Makefile.mips Sun Jan 26 14:19:08 2020(r357145)
@@ -50,12 +50,9 @@ ARCH_FLAGS+=-mabi=${MIPS_ABI}
 EXTRA_FLAGS=-fno-pic -mno-abicalls -G0 -DKERNLOADADDR=${KERNLOADADDR}
 EXTRA_FLAGS+=-${MIPS_ENDIAN}
 
-HACK_EXTRA_FLAGS=-shared
-
 # We add the -fno-pic flag to kernels because otherwise performance
 # is extremely poor, as well as -mno-abicalls to force no ABI usage.
 CFLAGS+=${EXTRA_FLAGS} $(ARCH_FLAGS)
-HACK_EXTRA_FLAGS+=${EXTRA_FLAGS} $(ARCH_FLAGS)
 TRAMP_ARCH_FLAGS?=$(ARCH_FLAGS)
 TRAMP_EXTRA_FLAGS=${EXTRA_FLAGS} ${TRAMP_ARCH_FLAGS}
 # Kernel code is always compiled with soft-float on MIPS

Modified: head/sys/conf/Makefile.powerpc
==
--- head/sys/conf/Makefile.powerpc  Sun Jan 26 11:54:21 2020
(r357144)
+++ head/sys/conf/Makefile.powerpc  Sun Jan 26 14:19:08 2020
(r357145)
@@ -39,7 +39,6 @@ INCLUDES+= -I$S/contrib/libfdt
 # Force __SPE__, since the builtin will be removed later with -mno-spe
 CFLAGS.gcc+= -mabi=spe -D__SPE__
 CFLAGS.clang+= -mspe -D__SPE__ -m32
-HACK_EXTRA_FLAGS= -shared -m32 -mspe -D__SPE__
 .endif
 CFLAGS+= -msoft-float
 CFLAGS.gcc+= -Wa,-many

Modified: head/sys/conf/kern.post.mk
==
--- head/sys/conf/kern.post.mk  Sun Jan 26 11:54:21 2020(r357144)
+++ head/sys/conf/kern.post.mk  Sun Jan 26 14:19:08 2020(r357145)
@@ -226,10 +226,9 @@ kernel-clean:
 # This is a hack.  BFD "optimizes" away dynamic mode if there are no
 # dynamic references.  We could probably do a '-Bforcedynamic' mode like
 # in the a.out ld.  For now, this works.
-HACK_EXTRA_FLAGS?= -shared
 hack.pico: Makefile
:> hack.c
-   ${CC} ${HACK_EXTRA_FLAGS} -nostdlib hack.c -o hack.pico
+   ${CC} -shared ${CFLAGS} -nostdlib hack.c -o hack.pico
rm -f hack.c
 
 offset.inc: $S/kern/genoffset.sh genoffset.o
___
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: r357051 - head/sys/dev/bge

2020-01-26 Thread John Baldwin
On 1/23/20 7:32 PM, Gleb Smirnoff wrote:
> On Thu, Jan 23, 2020 at 05:09:14PM -1000, Jeff Roberson wrote:
> J> While we don't have a policy strictly requiring reviews it is the norm to 
> J> have substantial changes socialized and reviewed.  I appreciate the work 
> J> that you are doing but it likely should've been discussed somewhere 
> J> more publicly.  I apologized if I missed it but I don't see reference to 
> J> anything.
> 
> That was https://reviews.freebsd.org/D23242

A review alone isn't sufficient for large, sweeping changes in my mind.
For major changes, a thread on arch@ or net@ or the like is probably more
appropriate.  You can include a link to a review or git branch, etc. in
that e-mail, but phabricator aren't as well suited to higher-level
design-review type discussion, more for implementation-review.
> J> Architecturally I am more concerned with the coarseness of net_epoch and 
> J> the duration of hold becoming a resource utilization problem in high 
> J> turn-over workloads.  Like short connection tcp.  Has anyone done 
> J> substantial testing here?  epoch as it is today will hold every free 
> J> callback for a minimum of several clock ticks and a maximum of 2x the 
> J> duration of the longest epoch section time.  With preemption, etc. this 
> J> could be 100s of ms of PCBs held.
> 
> We also are concerned about that theoretically. Haven't yet seen effect
> in practice, but our sessions are mostly longer living. First we have the
> tunable to limit batching. Second, there are some ideas on how to improve
> the garbage collector performance if it becomes an issue.

There are other workloads than Netflix. ;)  Verisign has incredibly short-lived
connections with very high turnover.  I think though that they have already
abandoned the in-tree network stack for a userland stack built on netmap.  
Still,
I think that there are probably other FreeBSD users that are probably somewhere
in the middle that shouldn't be ignored.

Packet batching would not be impossible by simply using m_nextpkt chains in
mbufs passed up to ether_input and having ether_input pass them in a loop to
the next higher loop (as a first step).  That would reduce unlock/lock 
operations
in drivers (for those still using locks on receive) as well as permitting
ether_input to process batches under a single epoch invocation.

-- 
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"


Re: svn commit: r357051 - head/sys/dev/bge

2020-01-26 Thread John Baldwin
On 1/23/20 9:15 PM, Gleb Smirnoff wrote:
> On Thu, Jan 23, 2020 at 06:18:15PM -1000, Jeff Roberson wrote:
> J> > That was https://reviews.freebsd.org/D23242
> J> 
> J> Ok thank you.  Can you tag commits so people can see the discussion?  Was 
> J> it in one I missed?  When I'm committing a long patch series I include the 
> J> link in all of them.
> 
> I probably now on will also include in every patch in a serie. I just
> dislike that first one (usually a preparation change) closes the review.

You can also add additional commits to a review via 'Edit related revisions'
in the web ui if you forget to tag a commit.

-- 
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: r357062 - head/share/man/man9

2020-01-23 Thread John Baldwin
Author: jhb
Date: Thu Jan 23 23:36:58 2020
New Revision: 357062
URL: https://svnweb.freebsd.org/changeset/base/357062

Log:
  Correct the return types of fueword*().
  
  MFC after:1 week
  Sponsored by: DARPA

Modified:
  head/share/man/man9/fetch.9

Modified: head/share/man/man9/fetch.9
==
--- head/share/man/man9/fetch.9 Thu Jan 23 22:13:41 2020(r357061)
+++ head/share/man/man9/fetch.9 Thu Jan 23 23:36:58 2020(r357062)
@@ -34,7 +34,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 17, 2018
+.Dd January 23, 2020
 .Dt FETCH 9
 .Os
 .Sh NAME
@@ -61,11 +61,11 @@
 .Fn fuword32 "volatile const void *base"
 .Ft int64_t
 .Fn fuword64 "volatile const void *base"
-.Ft long
+.Ft int
 .Fn fueword "volatile const void *base" "long *val"
-.Ft int32_t
+.Ft int
 .Fn fueword32 "volatile const void *base" "int32_t *val"
-.Ft int64_t
+.Ft int
 .Fn fueword64 "volatile const void *base" "int64_t *val"
 .In sys/resourcevar.h
 .Sh DESCRIPTION
___
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: r356996 - head

2020-01-22 Thread John Baldwin
Author: jhb
Date: Wed Jan 22 21:21:24 2020
New Revision: 356996
URL: https://svnweb.freebsd.org/changeset/base/356996

Log:
  Remove support for auto-selecting an external binutils.
  
  All of the in-tree architectures not supported by in-tree binutils are
  supported by lld, so the condition is now always false.  It also
  didn't fully work since the external binutils are installed into a
  directory that uses the host's OS version, not the target OS version.
  
  Reviewed by:  emaste, imp
  Differential Revision:https://reviews.freebsd.org/D23294

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Wed Jan 22 21:01:19 2020(r356995)
+++ head/Makefile.inc1  Wed Jan 22 21:21:24 2020(r356996)
@@ -180,24 +180,6 @@ MK_SYSTEM_LINKER=  no
 .if defined(CROSS_TOOLCHAIN_PREFIX)
 CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
 .endif
-# If we do not have a bootstrap binutils (because the in-tree one does not
-# support the target architecture), provide a default cross-binutils prefix.
-# This allows riscv64 builds, for example, to automatically use the
-# riscv64-binutils port or package.
-.if !make(showconfig) && !defined(_NO_INCLUDE_COMPILERMK)
-.if !empty(BROKEN_OPTIONS:MBINUTILS_BOOTSTRAP) && \
-${MK_LLD_BOOTSTRAP} == "no" && \
-!defined(CROSS_BINUTILS_PREFIX)
-CROSS_BINUTILS_PREFIX=/usr/local/${TARGET_TRIPLE}/bin/
-.if !exists(${CROSS_BINUTILS_PREFIX})
-.if !empty(BROKEN_OPTIONS:MGCC_BOOTSTRAP) && ${MK_CLANG_BOOTSTRAP} == "no"
-.error In-tree toolchain does not support the ${TARGET_ARCH} architecture. 
Install the ${TARGET_ARCH}-xtoolchain-gcc port or package or set 
CROSS_TOOLCHAIN_PREFIX.
-.else
-.error In-tree binutils does not support the ${TARGET_ARCH} architecture. 
Install the ${TARGET_ARCH}-binutils port or package or set 
CROSS_BINUTILS_PREFIX.
-.endif
-.endif
-.endif
-.endif
 XBINUTILS= AS AR LD NM OBJCOPY RANLIB SIZE STRINGS
 .for BINUTIL in ${XBINUTILS}
 .if defined(CROSS_BINUTILS_PREFIX) && \
___
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: r356911 - stable/12/sys/opencrypto

2020-01-20 Thread John Baldwin
Author: jhb
Date: Mon Jan 20 11:54:00 2020
New Revision: 356911
URL: https://svnweb.freebsd.org/changeset/base/356911

Log:
  MFC 356561: Add stricter checking on mac key lengths.
  
  Negative lengths are always invalid.  The key length should also
  be zero for hash algorithms that do not accept a key.
  
  admbugs:  949

Modified:
  stable/12/sys/opencrypto/cryptodev.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/opencrypto/cryptodev.c
==
--- stable/12/sys/opencrypto/cryptodev.cMon Jan 20 11:45:18 2020
(r356910)
+++ stable/12/sys/opencrypto/cryptodev.cMon Jan 20 11:54:00 2020
(r356911)
@@ -585,8 +585,8 @@ cryptof_ioctl(
if (thash) {
cria.cri_alg = thash->type;
cria.cri_klen = sop->mackeylen * 8;
-   if (thash->keysize != 0 &&
-   sop->mackeylen > thash->keysize) {
+   if (sop->mackeylen > thash->keysize ||
+   sop->mackeylen < 0) {
CRYPTDEB("invalid mac key length");
error = EINVAL;
SDT_PROBE1(opencrypto, dev, ioctl, error,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r356908 - in stable: 11/sys/opencrypto 12/sys/opencrypto

2020-01-20 Thread John Baldwin
Author: jhb
Date: Mon Jan 20 11:19:55 2020
New Revision: 356908
URL: https://svnweb.freebsd.org/changeset/base/356908

Log:
  MFC 356507,356520: Add a reference count to cryptodev sessions.
  
  356507:
  Add a reference count to cryptodev sessions.
  
  This prevents use-after-free races with crypto requests (which may
  sleep) and CIOCFSESSION as well as races from current CIOCFSESSION
  requests.
  
  356520:
  Remove no-longer-used function prototype.
  
  admbugs:  949
  Sponsored by: Chelsio Communications

Modified:
  stable/12/sys/opencrypto/cryptodev.c
Directory Properties:
  stable/12/   (props changed)

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

Modified: stable/12/sys/opencrypto/cryptodev.c
==
--- stable/12/sys/opencrypto/cryptodev.cMon Jan 20 09:16:06 2020
(r356907)
+++ stable/12/sys/opencrypto/cryptodev.cMon Jan 20 11:19:55 2020
(r356908)
@@ -266,6 +266,7 @@ crypt_kop_to_32(const struct crypt_kop *from, struct c
 struct csession {
TAILQ_ENTRY(csession) next;
crypto_session_t cses;
+   volatile u_int  refs;
u_int32_t   ses;
struct mtx  lock;   /* for op submission */
 
@@ -292,6 +293,7 @@ struct cryptop_data {
 struct fcrypt {
TAILQ_HEAD(csessionlist, csession) csessions;
int sesn;
+   struct mtx  lock;
 };
 
 static struct timeval warninterval = { .tv_sec = 60, .tv_usec = 0 };
@@ -323,8 +325,7 @@ static struct fileops cryptofops = {
 };
 
 static struct csession *csefind(struct fcrypt *, u_int);
-static int csedelete(struct fcrypt *, struct csession *);
-static struct csession *cseadd(struct fcrypt *, struct csession *);
+static bool csedelete(struct fcrypt *, u_int);
 static struct csession *csecreate(struct fcrypt *, crypto_session_t, caddr_t,
 u_int64_t, caddr_t, u_int64_t, u_int32_t, u_int32_t, struct enc_xform *,
 struct auth_hash *);
@@ -668,13 +669,10 @@ bail:
break;
case CIOCFSESSION:
ses = *(u_int32_t *)data;
-   cse = csefind(fcr, ses);
-   if (cse == NULL) {
+   if (!csedelete(fcr, ses)) {
SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__);
return (EINVAL);
}
-   csedelete(fcr, cse);
-   csefree(cse);
break;
case CIOCCRYPT:
 #ifdef COMPAT_FREEBSD32
@@ -691,6 +689,7 @@ bail:
return (EINVAL);
}
error = cryptodev_op(cse, cop, active_cred, td);
+   csefree(cse);
 #ifdef COMPAT_FREEBSD32
if (error == 0 && cmd == CIOCCRYPT32)
crypt_op_to_32(cop, data);
@@ -757,6 +756,7 @@ bail:
return (EINVAL);
}
error = cryptodev_aead(cse, caead, active_cred, td);
+   csefree(cse);
break;
default:
error = EINVAL;
@@ -1375,6 +1375,9 @@ cryptof_close(struct file *fp, struct thread *td)
 
while ((cse = TAILQ_FIRST(>csessions))) {
TAILQ_REMOVE(>csessions, cse, next);
+   KASSERT(cse->refs == 1,
+   ("%s: crypto session %p with %d refs", __func__, cse,
+   cse->refs));
csefree(cse);
}
free(fcr, M_XDATA);
@@ -1395,34 +1398,36 @@ csefind(struct fcrypt *fcr, u_int ses)
 {
struct csession *cse;
 
-   TAILQ_FOREACH(cse, >csessions, next)
-   if (cse->ses == ses)
+   mtx_lock(>lock);
+   TAILQ_FOREACH(cse, >csessions, next) {
+   if (cse->ses == ses) {
+   refcount_acquire(>refs);
+   mtx_unlock(>lock);
return (cse);
+   }
+   }
+   mtx_unlock(>lock);
return (NULL);
 }
 
-static int
-csedelete(struct fcrypt *fcr, struct csession *cse_del)
+static bool
+csedelete(struct fcrypt *fcr, u_int ses)
 {
struct csession *cse;
 
+   mtx_lock(>lock);
TAILQ_FOREACH(cse, >csessions, next) {
-   if (cse == cse_del) {
+   if (cse->ses == ses) {
TAILQ_REMOVE(>csessions, cse, next);
-   return (1);
+   mtx_unlock(>lock);
+   csefree(cse);
+   return (true);
}
}
-   return (0);
+   mtx_unlock(>lock);
+   return (false);
 }

-static struct csession *
-cseadd(struct fcrypt *fcr, struct csession *cse)
-{
-   TAILQ_INSERT_TAIL(>csessions, cse, next);
-   cse->ses = fcr->sesn++;
-   return (cse);
-}
-
 struct csession *
 csecreate(struct fcrypt *fcr, crypto_session_t cses, caddr_t key, u_int64_t 

svn commit: r356908 - in stable: 11/sys/opencrypto 12/sys/opencrypto

2020-01-20 Thread John Baldwin
Author: jhb
Date: Mon Jan 20 11:19:55 2020
New Revision: 356908
URL: https://svnweb.freebsd.org/changeset/base/356908

Log:
  MFC 356507,356520: Add a reference count to cryptodev sessions.
  
  356507:
  Add a reference count to cryptodev sessions.
  
  This prevents use-after-free races with crypto requests (which may
  sleep) and CIOCFSESSION as well as races from current CIOCFSESSION
  requests.
  
  356520:
  Remove no-longer-used function prototype.
  
  admbugs:  949
  Sponsored by: Chelsio Communications

Modified:
  stable/11/sys/opencrypto/cryptodev.c
Directory Properties:
  stable/11/   (props changed)

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

Modified: stable/11/sys/opencrypto/cryptodev.c
==
--- stable/11/sys/opencrypto/cryptodev.cMon Jan 20 09:16:06 2020
(r356907)
+++ stable/11/sys/opencrypto/cryptodev.cMon Jan 20 11:19:55 2020
(r356908)
@@ -268,6 +268,7 @@ crypt_kop_to_32(const struct crypt_kop *from, struct c
 struct csession {
TAILQ_ENTRY(csession) next;
u_int64_t   sid;
+   volatile u_int  refs;
u_int32_t   ses;
struct mtx  lock;   /* for op submission */
 
@@ -294,6 +295,7 @@ struct cryptop_data {
 struct fcrypt {
TAILQ_HEAD(csessionlist, csession) csessions;
int sesn;
+   struct mtx  lock;
 };
 
 static struct timeval warninterval = { .tv_sec = 60, .tv_usec = 0 };
@@ -325,8 +327,7 @@ static struct fileops cryptofops = {
 };
 
 static struct csession *csefind(struct fcrypt *, u_int);
-static int csedelete(struct fcrypt *, struct csession *);
-static struct csession *cseadd(struct fcrypt *, struct csession *);
+static int csedelete(struct fcrypt *, u_int);
 static struct csession *csecreate(struct fcrypt *, u_int64_t, caddr_t,
 u_int64_t, caddr_t, u_int64_t, u_int32_t, u_int32_t, struct enc_xform *,
 struct auth_hash *);
@@ -617,13 +618,9 @@ bail:
break;
case CIOCFSESSION:
ses = *(u_int32_t *)data;
-   cse = csefind(fcr, ses);
-   if (cse == NULL) {
+   error = csedelete(fcr, ses);
+   if (error != 0)
SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__);
-   return (EINVAL);
-   }
-   csedelete(fcr, cse);
-   error = csefree(cse);
break;
case CIOCCRYPT:
 #ifdef COMPAT_FREEBSD32
@@ -640,6 +637,7 @@ bail:
return (EINVAL);
}
error = cryptodev_op(cse, cop, active_cred, td);
+   (void)csefree(cse);
 #ifdef COMPAT_FREEBSD32
if (error == 0 && cmd == CIOCCRYPT32)
crypt_op_to_32(cop, data);
@@ -706,6 +704,7 @@ bail:
return (EINVAL);
}
error = cryptodev_aead(cse, caead, active_cred, td);
+   (void)csefree(cse);
break;
default:
error = EINVAL;
@@ -1323,6 +1322,9 @@ cryptof_close(struct file *fp, struct thread *td)
 
while ((cse = TAILQ_FIRST(>csessions))) {
TAILQ_REMOVE(>csessions, cse, next);
+   KASSERT(cse->refs == 1,
+   ("%s: crypto session %p with %d refs", __func__, cse,
+   cse->refs));
(void)csefree(cse);
}
free(fcr, M_XDATA);
@@ -1343,34 +1345,35 @@ csefind(struct fcrypt *fcr, u_int ses)
 {
struct csession *cse;
 
-   TAILQ_FOREACH(cse, >csessions, next)
-   if (cse->ses == ses)
+   mtx_lock(>lock);
+   TAILQ_FOREACH(cse, >csessions, next) {
+   if (cse->ses == ses) {
+   refcount_acquire(>refs);
+   mtx_unlock(>lock);
return (cse);
+   }
+   }
+   mtx_unlock(>lock);
return (NULL);
 }
 
 static int
-csedelete(struct fcrypt *fcr, struct csession *cse_del)
+csedelete(struct fcrypt *fcr, u_int ses)
 {
struct csession *cse;
 
+   mtx_lock(>lock);
TAILQ_FOREACH(cse, >csessions, next) {
-   if (cse == cse_del) {
+   if (cse->ses == ses) {
TAILQ_REMOVE(>csessions, cse, next);
-   return (1);
+   mtx_unlock(>lock);
+   return (csefree(cse));
}
}
-   return (0);
+   mtx_unlock(>lock);
+   return (EINVAL);
 }

-static struct csession *
-cseadd(struct fcrypt *fcr, struct csession *cse)
-{
-   TAILQ_INSERT_TAIL(>csessions, cse, next);
-   cse->ses = fcr->sesn++;
-   return (cse);
-}
-
 struct csession *
 csecreate(struct fcrypt *fcr, u_int64_t sid, caddr_t key, u_int64_t 

svn commit: r356875 - stable/11/share/man/man7

2020-01-18 Thread John Baldwin
Author: jhb
Date: Sat Jan 18 23:46:50 2020
New Revision: 356875
URL: https://svnweb.freebsd.org/changeset/base/356875

Log:
  MFC 356274: Some minor tweaks to arch(7).
  
  - Drop mention of _LP64.  FreeBSD's source generally uses __LP64__
instead of _LP64, and the relevant macros are better covered in the
"Predefined Macros" section.

Modified:
  stable/11/share/man/man7/arch.7
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man7/arch.7
==
--- stable/11/share/man/man7/arch.7 Sat Jan 18 23:46:30 2020
(r356874)
+++ stable/11/share/man/man7/arch.7 Sat Jan 18 23:46:50 2020
(r356875)
@@ -139,12 +139,6 @@ and
 are 8 bytes.
 .El
 .Pp
-Compilers define the
-.Dv _LP64
-symbol when compiling for an
-.Dv LP64
-ABI.
-.Pp
 Some machines support more that one
 .Fx
 ABI.
___
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: r356874 - stable/12/share/man/man7

2020-01-18 Thread John Baldwin
Author: jhb
Date: Sat Jan 18 23:46:30 2020
New Revision: 356874
URL: https://svnweb.freebsd.org/changeset/base/356874

Log:
  MFC 356274: Some minor tweaks to arch(7).
  
  - Drop mention of _LP64.  FreeBSD's source generally uses __LP64__
instead of _LP64, and the relevant macros are better covered in the
"Predefined Macros" section.
  - Fix a noun/verb disagreement.

Modified:
  stable/12/share/man/man7/arch.7
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/man/man7/arch.7
==
--- stable/12/share/man/man7/arch.7 Sat Jan 18 23:43:36 2020
(r356873)
+++ stable/12/share/man/man7/arch.7 Sat Jan 18 23:46:30 2020
(r356874)
@@ -140,12 +140,6 @@ and
 are 8 bytes.
 .El
 .Pp
-Compilers define the
-.Dv _LP64
-symbol when compiling for an
-.Dv LP64
-ABI.
-.Pp
 Some machines support more than one
 .Fx
 ABI.
@@ -401,7 +395,7 @@ These variables are not otherwise documented and are u
 in the build system.
 .Bl -tag -width "MACHINE_CPUARCH"
 .It Dv MACHINE
-Represent the hardware platform.
+Represents the hardware platform.
 This is the same as the native platform's
 .Xr uname 1
 .Fl m
___
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: r356872 - stable/12/share/man/man7

2020-01-18 Thread John Baldwin
Author: jhb
Date: Sat Jan 18 23:42:57 2020
New Revision: 356872
URL: https://svnweb.freebsd.org/changeset/base/356872

Log:
  MFC 356209: Formatting fixes for tables, no content changes.
  
  - Add missing .Pp after the end of some lists so that there is a blank
line before the subsequent paragraph.
  - Use a more typical '-tag' bullet list of the make variable descriptions
at the end.  This adds separation between bullets and is the formatting
typically used in manpages for this sort of list.

Modified:
  stable/12/share/man/man7/arch.7
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/man/man7/arch.7
==
--- stable/12/share/man/man7/arch.7 Sat Jan 18 23:30:42 2020
(r356871)
+++ stable/12/share/man/man7/arch.7 Sat Jan 18 23:42:57 2020
(r356872)
@@ -139,6 +139,7 @@ and
 .Vt void *
 are 8 bytes.
 .El
+.Pp
 Compilers define the
 .Dv _LP64
 symbol when compiling for an
@@ -162,6 +163,7 @@ Examples are:
 .It Dv powerpc64   Ta Dv powerpc
 .It Dv mips64* Ta Dv mips*
 .El
+.Pp
 .Dv aarch64
 currently does not support execution of
 .Dv armv6
@@ -181,6 +183,7 @@ On all supported architectures:
 .It float Ta 4
 .It double Ta 8
 .El
+.Pp
 Integers are represented in two's complement.
 Alignment of integer and pointer types is natural, that is,
 the address of the variable must be congruent to zero modulo the type size.
@@ -396,8 +399,9 @@ Most of the externally settable variables are defined 
 man page.
 These variables are not otherwise documented and are used extensively
 in the build system.
-.Bl -column -offset indent "Sy Variable" "Sy Meaning and usage"
-.It Dv MACHINE Represent the hardware platform.
+.Bl -tag -width "MACHINE_CPUARCH"
+.It Dv MACHINE
+Represent the hardware platform.
 This is the same as the native platform's
 .Xr uname 1
 .Fl m
@@ -432,7 +436,8 @@ Generally,
 .Dv MACHINE
 should only be used in src/sys and src/stand or in system imagers or
 installers.
-.It Dv MACHINE_ARCHRepresents the CPU processor architecture.
+.It Dv MACHINE_ARCH
+Represents the CPU processor architecture.
 This is the same as the native platforms
 .Xr uname 1
 .Fl p
@@ -463,7 +468,8 @@ It is unfortunate that amd64 specifies the 64-bit evol
 platform (it matches the 'first rule') as everybody else uses x86_64.
 There is no standard name for the processor: each OS selects its own
 conventions.
-.It Dv MACHINE_CPUARCH Represents the source location for a given
+.It Dv MACHINE_CPUARCH
+Represents the source location for a given
 .Dv MACHINE_ARCH .
 For example,
 .Dv MACHINE_CPUARCH
@@ -475,25 +481,29 @@ The FreeBSD source base supports amd64 and i386 with t
 distinct source bases living in subdirectories named amd64 and i386
 (though behind the scenes there's some sharing that fits into this
 framework).
-.It Dv CPUTYPE Sets the flavor of
+.It Dv CPUTYPE
+Sets the flavor of
 .Dv MACHINE_ARCH
 to build.
 It is used to optimize the build for a specific CPU / core that the
 binaries run on.
 Generally, this does not change the ABI, though it can be a fine line
 between optimization for specific cases.
-.It Dv TARGET  Used to set
+.It Dv TARGET
+Used to set
 .Dv MACHINE
 in the top level Makefile for cross building.
 Unused outside of that scope.
 It is not passed down to the rest of the build.
 Makefiles outside of the top level should not use it at all (though
 some have their own private copy for hysterical raisons).
-.It Dv TARGET_ARCH Used to set
+.It Dv TARGET_ARCH
+Used to set
 .Dv MACHINE_ARCH
 by the top level Makefile for cross building.
 Like
-.Dv TARGET , it is unused outside of that scope.
+.Dv TARGET ,
+it is unused outside of that scope.
 .El
 .Sh SEE ALSO
 .Xr src.conf 5 ,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r356873 - stable/11/share/man/man7

2020-01-18 Thread John Baldwin
Author: jhb
Date: Sat Jan 18 23:43:36 2020
New Revision: 356873
URL: https://svnweb.freebsd.org/changeset/base/356873

Log:
  MFC 356209: Formatting fixes for tables, no content changes.
  
  - Add missing .Pp after the end of some lists so that there is a blank
line before the subsequent paragraph.

Modified:
  stable/11/share/man/man7/arch.7
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man7/arch.7
==
--- stable/11/share/man/man7/arch.7 Sat Jan 18 23:42:57 2020
(r356872)
+++ stable/11/share/man/man7/arch.7 Sat Jan 18 23:43:36 2020
(r356873)
@@ -138,6 +138,7 @@ and
 .Vt void *
 are 8 bytes.
 .El
+.Pp
 Compilers define the
 .Dv _LP64
 symbol when compiling for an
@@ -161,6 +162,7 @@ Examples are:
 .It Dv powerpc64   Ta Dv powerpc
 .It Dv mips64* Ta Dv mips*
 .El
+.Pp
 .Dv aarch64
 currently does not support execution of
 .Dv armv6
@@ -178,6 +180,7 @@ On all supported architectures:
 .It float Ta 4
 .It double Ta 8
 .El
+.Pp
 Integers are represented in two's complement.
 Alignment of integer and pointer types is natural, that is,
 the address of the variable must be congruent to zero modulo the type size.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r356871 - in stable/12/share/man: man4 man9

2020-01-18 Thread John Baldwin
Author: jhb
Date: Sat Jan 18 23:30:42 2020
New Revision: 356871
URL: https://svnweb.freebsd.org/changeset/base/356871

Log:
  MFC 355866,355871: Update the crypto(4) and crypto(9) manpages.
  
  355866:
  Update the crypto(4) and crypto(9) manpages.
  
  There are probably bits that are still wrong, but this fixes some
  things at least:
  - Add named arguments to the functions in crypto(9).
  - Add missing algorithms.
  - Don't mention arguments that don't exist in crypto_register.
  - Add CIOGSESSION2.
  - Remove CIOCNFSESSION.
  - Clarify some stale language that assumed an fd had only one sesson.
  - Note that you have to use CRIOGET and add a note in BUGS lamenting
that one has to use CRIOGET.
  - Various other cleanups.
  
  355871:
  Bump Dd for changes in r355866.
  
  Sponsored by: Chelsio Communications

Modified:
  stable/12/share/man/man4/crypto.4
  stable/12/share/man/man9/crypto.9
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/man/man4/crypto.4
==
--- stable/12/share/man/man4/crypto.4   Sat Jan 18 23:26:15 2020
(r356870)
+++ stable/12/share/man/man4/crypto.4   Sat Jan 18 23:30:42 2020
(r356871)
@@ -60,7 +60,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 21, 2017
+.Dd December 17, 2019
 .Dt CRYPTO 4
 .Os
 .Sh NAME
@@ -78,7 +78,7 @@
 The
 .Nm
 driver gives user-mode applications access to hardware-accelerated
-cryptographic transforms, as implemented by the
+cryptographic transforms as implemented by the
 .Xr crypto 9
 in-kernel interface.
 .Pp
@@ -87,15 +87,15 @@ The
 special device provides an
 .Xr ioctl 2
 based interface.
-User-mode applications should open the special device,
+User-mode applications open the special device and
 then issue
 .Xr ioctl 2
 calls on the descriptor.
 User-mode access to
 .Pa /dev/crypto
-is controlled by three
+is controlled by two
 .Xr sysctl 8
-variables,
+variables:
 .Ic kern.userasymcrypto
 and
 .Ic kern.cryptodevallowsoft .
@@ -103,8 +103,8 @@ and
 The
 .Nm
 device provides two distinct modes of operation: one mode for
-symmetric-keyed cryptographic requests, and a second mode for
-both asymmetric-key (public-key/private-key) requests, and for
+symmetric-keyed cryptographic requests and digests, and a second mode for
+both asymmetric-key (public-key/private-key) requests and
 modular arithmetic (for Diffie-Hellman key exchange and other
 cryptographic protocols).
 The two modes are described separately below.
@@ -113,12 +113,22 @@ Regardless of whether symmetric-key or asymmetric-key 
 to be performed, use of the device requires a basic series of steps:
 .Bl -enum
 .It
-Open a file descriptor for the device.
-See
-.Xr open 2 .
+Open the
+.Pa /dev/crypto
+device.
 .It
-If any symmetric operation will be performed,
-create one session, with
+Create a new cryptography file descriptor via
+.Dv CRIOGET
+to use for all subsequent
+.Xr ioctl 2
+commands.
+.It
+Close the
+.Pa /dev/crypto
+device.
+.It
+If any symmetric-keyed cryptographic or digest operations will be performed,
+create a session with
 .Dv CIOCGSESSION .
 Most applications will require at least one symmetric session.
 Since cipher and MAC keys are tied to sessions, many
@@ -134,11 +144,13 @@ or
 .Dv CIOCKEY
 (asymmetric).
 .It
-Destroy one session with
+Optionally destroy a session with
 .Dv CIOCFSESSION .
 .It
-Close the device with
+Close the cryptography file descriptor with
 .Xr close 2 .
+This will automatically close any remaining sessions associated with the
+file desriptor.
 .El
 .Sh SYMMETRIC-KEY OPERATION
 The symmetric-key operation mode provides a context-based API
@@ -196,9 +208,9 @@ struct session_op {
 u_int32_t mac; /* e.g. CRYPTO_MD5_HMAC */
 
 u_int32_t keylen;  /* cipher key */
-void * key;
+const void *key;
 int mackeylen; /* mac key */
-void * mackey;
+const void *mackey;
 
 u_int32_t ses; /* returns: ses # */
 };
@@ -241,12 +253,36 @@ and the key value in the octets addressed by
 .Fa sessp-\*[Gt]mackeylen .
 .\"
 .Pp
-Support for a specific combination of fused privacy  and
+Support for a specific combination of fused privacy and
 integrity-check algorithms depends on whether the underlying
 hardware supports that combination.
 Not all combinations are supported
 by all hardware, even if the hardware supports each operation as a
 stand-alone non-fused operation.
+.It Dv CIOCGSESSION2 Fa struct session2_op *sessp
+.Bd -literal
+struct session2_op {
+u_int32_t cipher;  /* e.g. CRYPTO_DES_CBC */
+u_int32_t mac; /* e.g. CRYPTO_MD5_HMAC */
+
+u_int32_t keylen;  /* cipher key */
+const void *key;
+int mackeylen; /* mac key */
+const void *mackey;
+
+u_int32_t ses; /* returns: ses # */
+intcrid;   /* driver id + flags (rw) */
+intpad[4]; /* for future expansion */
+};
+
+.Ed
+This request is similar to CIOGSESSION except that
+.Fa 

svn commit: r356870 - stable/12/usr.sbin/bhyve

2020-01-18 Thread John Baldwin
Author: jhb
Date: Sat Jan 18 23:26:15 2020
New Revision: 356870
URL: https://svnweb.freebsd.org/changeset/base/356870

Log:
  MFC 355634: Emulate reads of the PCI command register for passthrough devices.
  
  VFs return zero for the memory enable bit even if it has been set by a
  prior write.  After r348779 this caused the annoying behavior that a
  guest OS would unintentionally disable memory decoding on a future
  read-modify-write operation on the command register.  Instead, return
  the shadow value of the command register for reads.  This ensures that
  the guest will only toggle the state of the memory enable bit when it
  specifically intends to do so.
  
  Sponsored by: Chelsio Communications

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

Modified: stable/12/usr.sbin/bhyve/pci_passthru.c
==
--- stable/12/usr.sbin/bhyve/pci_passthru.c Sat Jan 18 22:58:32 2020
(r356869)
+++ stable/12/usr.sbin/bhyve/pci_passthru.c Sat Jan 18 23:26:15 2020
(r356870)
@@ -806,6 +806,19 @@ passthru_cfgread(struct vmctx *ctx, int vcpu, struct p
}
 #endif
 
+   /*
+* Emulate the command register.  If a single read reads both the
+* command and status registers, read the status register from the
+* device's config space.
+*/
+   if (coff == PCIR_COMMAND) {
+   if (bytes <= 2)
+   return (-1);
+   *rv = pci_get_cfgdata16(pi, PCIR_COMMAND) << 16 |
+   read_config(>psc_sel, PCIR_STATUS, 2);
+   return (0);
+   }
+
/* Everything else just read from the device's config space */
*rv = read_config(>psc_sel, coff, bytes);
 
___
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: r356851 - stable/12

2020-01-17 Thread John Baldwin
Author: jhb
Date: Fri Jan 17 22:02:35 2020
New Revision: 356851
URL: https://svnweb.freebsd.org/changeset/base/356851

Log:
  MFC 353932: Strip "sf" suffix when generating a target triple.
  
  This fixes the target triple used when compiling riscv64sf with clang.
  
  Sponsored by: DARPA

Modified:
  stable/12/Makefile.inc1
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/Makefile.inc1
==
--- stable/12/Makefile.inc1 Fri Jan 17 21:57:05 2020(r356850)
+++ stable/12/Makefile.inc1 Fri Jan 17 22:02:35 2020(r356851)
@@ -126,9 +126,9 @@ TARGET_ABI= gnueabi
 .endif
 .endif
 MACHINE_ABI?=  unknown
-MACHINE_TRIPLE?=${MACHINE_ARCH:S/amd64/x86_64/:C/hf$//:S/mipsn32/mips64/}-${MACHINE_ABI}-freebsd12.1
+MACHINE_TRIPLE?=${MACHINE_ARCH:S/amd64/x86_64/:C/[hs]f$//:S/mipsn32/mips64/}-${MACHINE_ABI}-freebsd12.1
 TARGET_ABI?=   unknown
-TARGET_TRIPLE?=
${TARGET_ARCH:S/amd64/x86_64/:C/hf$//:S/mipsn32/mips64/}-${TARGET_ABI}-freebsd12.1
+TARGET_TRIPLE?=
${TARGET_ARCH:S/amd64/x86_64/:C/[hs]f$//:S/mipsn32/mips64/}-${TARGET_ABI}-freebsd12.1
 KNOWN_ARCHES?= aarch64/arm64 \
amd64 \
arm \
___
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: r356850 - stable/12/sys/riscv/include

2020-01-17 Thread John Baldwin
Author: jhb
Date: Fri Jan 17 21:57:05 2020
New Revision: 356850
URL: https://svnweb.freebsd.org/changeset/base/356850

Log:
  MFC 353931: Fix atomic_*cmpset32 on riscv64 with clang.
  
  The lr.w instruction used to read the value from memory sign-extends
  the value read from memory.  GCC sign-extends the 32-bit comparison
  value passed in whereas clang currently does not.  As a result, if the
  value being compared has the MSB set, the comparison fails for
  matching 32-bit values when compiled with clang.
  
  Use a cast to explicitly sign-extend the unsigned comparison value.
  This works with both GCC and clang.
  
  There is commentary in the RISC-V spec that suggests that GCC's
  approach is more correct, but it is not clear if the commentary in the
  RISC-V spec is binding.
  
  Sponsored by: DARPA

Modified:
  stable/12/sys/riscv/include/atomic.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/riscv/include/atomic.h
==
--- stable/12/sys/riscv/include/atomic.hFri Jan 17 21:39:28 2020
(r356849)
+++ stable/12/sys/riscv/include/atomic.hFri Jan 17 21:57:05 2020
(r356850)
@@ -116,7 +116,7 @@ atomic_cmpset_32(volatile uint32_t *p, uint32_t cmpval
"bnez %1, 0b\n"
"1:"
: "=" (tmp), "=" (res), "+A" (*p)
-   : "rJ" (cmpval), "rJ" (newval)
+   : "rJ" ((long)(int32_t)cmpval), "rJ" (newval)
: "memory");
 
return (!res);
@@ -141,7 +141,7 @@ atomic_fcmpset_32(volatile uint32_t *p, uint32_t *cmpv
"sw   %0, %3\n" /* Save old value */
"2:"
: "=" (tmp), "=" (res), "+A" (*p), "+A" (*cmpval)
-   : "rJ" (*cmpval), "rJ" (newval)
+   : "rJ" ((long)(int32_t)*cmpval), "rJ" (newval)
: "memory");
 
return (!res);
___
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: r356840 - head/sys/riscv/riscv

2020-01-17 Thread John Baldwin
Author: jhb
Date: Fri Jan 17 19:13:49 2020
New Revision: 356840
URL: https://svnweb.freebsd.org/changeset/base/356840

Log:
  Check for invalid sstatus values in set_mcontext().
  
  Previously, this check was only in sys_sigreturn() which meant that
  user applications could write invalid values to the register via
  setcontext() or swapcontext().
  
  Reviewed by:  mhorne
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D23219

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

Modified: head/sys/riscv/riscv/machdep.c
==
--- head/sys/riscv/riscv/machdep.c  Fri Jan 17 19:01:59 2020
(r356839)
+++ head/sys/riscv/riscv/machdep.c  Fri Jan 17 19:13:49 2020
(r356840)
@@ -367,6 +367,14 @@ set_mcontext(struct thread *td, mcontext_t *mcp)
 
tf = td->td_frame;
 
+   /*
+* Make sure the processor mode has not been tampered with and
+* interrupts have not been disabled.
+* Supervisor interrupts in user mode are always enabled.
+*/
+   if ((mcp->mc_gpregs.gp_sstatus & SSTATUS_SPP) != 0)
+   return (EINVAL);
+
memcpy(tf->tf_t, mcp->mc_gpregs.gp_t, sizeof(tf->tf_t));
memcpy(tf->tf_s, mcp->mc_gpregs.gp_s, sizeof(tf->tf_s));
memcpy(tf->tf_a, mcp->mc_gpregs.gp_a, sizeof(tf->tf_a));
@@ -523,21 +531,11 @@ struct sigreturn_args {
 int
 sys_sigreturn(struct thread *td, struct sigreturn_args *uap)
 {
-   uint64_t sstatus;
ucontext_t uc;
int error;
 
if (copyin(uap->sigcntxp, , sizeof(uc)))
return (EFAULT);
-
-   /*
-* Make sure the processor mode has not been tampered with and
-* interrupts have not been disabled.
-* Supervisor interrupts in user mode are always enabled.
-*/
-   sstatus = uc.uc_mcontext.mc_gpregs.gp_sstatus;
-   if ((sstatus & SSTATUS_SPP) != 0)
-   return (EINVAL);
 
error = set_mcontext(td, _mcontext);
if (error != 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: r356839 - in head/sys: arm64/arm64 riscv/riscv

2020-01-17 Thread John Baldwin
Author: jhb
Date: Fri Jan 17 19:01:59 2020
New Revision: 356839
URL: https://svnweb.freebsd.org/changeset/base/356839

Log:
  Save and restore floating point registers in get/set_mcontext().
  
  arm64 and riscv were only saving and restoring floating point
  registers for sendsig() and sys_sigreturn(), but not for getcontext(),
  setcontext(), and swapcontext().
  
  While here, remove an always-false check for uap being NULL from
  sys_sigreturn().
  
  Reviewed by:  br, mhorne
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D23218

Modified:
  head/sys/arm64/arm64/machdep.c
  head/sys/riscv/riscv/machdep.c

Modified: head/sys/arm64/arm64/machdep.c
==
--- head/sys/arm64/arm64/machdep.c  Fri Jan 17 17:57:34 2020
(r356838)
+++ head/sys/arm64/arm64/machdep.c  Fri Jan 17 19:01:59 2020
(r356839)
@@ -98,6 +98,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #endif
 
+static void get_fpcontext(struct thread *td, mcontext_t *mcp);
+static void set_fpcontext(struct thread *td, mcontext_t *mcp);
 
 enum arm64_bus arm64_bus_method = ARM64_BUS_NONE;
 
@@ -473,6 +475,7 @@ get_mcontext(struct thread *td, mcontext_t *mcp, int c
mcp->mc_gpregs.gp_sp = tf->tf_sp;
mcp->mc_gpregs.gp_lr = tf->tf_lr;
mcp->mc_gpregs.gp_elr = tf->tf_elr;
+   get_fpcontext(td, mcp);
 
return (0);
 }
@@ -495,6 +498,7 @@ set_mcontext(struct thread *td, mcontext_t *mcp)
tf->tf_lr = mcp->mc_gpregs.gp_lr;
tf->tf_elr = mcp->mc_gpregs.gp_elr;
tf->tf_spsr = mcp->mc_gpregs.gp_spsr;
+   set_fpcontext(td, mcp);
 
return (0);
 }
@@ -667,15 +671,12 @@ sys_sigreturn(struct thread *td, struct sigreturn_args
ucontext_t uc;
int error;
 
-   if (uap == NULL)
-   return (EFAULT);
if (copyin(uap->sigcntxp, , sizeof(uc)))
return (EFAULT);
 
error = set_mcontext(td, _mcontext);
if (error != 0)
return (error);
-   set_fpcontext(td, _mcontext);
 
/* Restore signal mask. */
kern_sigprocmask(td, SIG_SETMASK, _sigmask, NULL, 0);
@@ -747,7 +748,6 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask
/* Fill in the frame to copy out */
bzero(, sizeof(frame));
get_mcontext(td, _uc.uc_mcontext, 0);
-   get_fpcontext(td, _uc.uc_mcontext);
frame.sf_si = ksi->ksi_info;
frame.sf_uc.uc_sigmask = *mask;
frame.sf_uc.uc_stack = td->td_sigstk;

Modified: head/sys/riscv/riscv/machdep.c
==
--- head/sys/riscv/riscv/machdep.c  Fri Jan 17 17:57:34 2020
(r356838)
+++ head/sys/riscv/riscv/machdep.c  Fri Jan 17 19:01:59 2020
(r356839)
@@ -99,6 +99,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #endif
 
+static void get_fpcontext(struct thread *td, mcontext_t *mcp);
+static void set_fpcontext(struct thread *td, mcontext_t *mcp);
+
 struct pcpu __pcpu[MAXCPU];
 
 static struct trapframe proc0_tf;
@@ -352,6 +355,7 @@ get_mcontext(struct thread *td, mcontext_t *mcp, int c
mcp->mc_gpregs.gp_tp = tf->tf_tp;
mcp->mc_gpregs.gp_sepc = tf->tf_sepc;
mcp->mc_gpregs.gp_sstatus = tf->tf_sstatus;
+   get_fpcontext(td, mcp);
 
return (0);
 }
@@ -372,6 +376,7 @@ set_mcontext(struct thread *td, mcontext_t *mcp)
tf->tf_gp = mcp->mc_gpregs.gp_gp;
tf->tf_sepc = mcp->mc_gpregs.gp_sepc;
tf->tf_sstatus = mcp->mc_gpregs.gp_sstatus;
+   set_fpcontext(td, mcp);
 
return (0);
 }
@@ -522,8 +527,6 @@ sys_sigreturn(struct thread *td, struct sigreturn_args
ucontext_t uc;
int error;
 
-   if (uap == NULL)
-   return (EFAULT);
if (copyin(uap->sigcntxp, , sizeof(uc)))
return (EFAULT);
 
@@ -540,8 +543,6 @@ sys_sigreturn(struct thread *td, struct sigreturn_args
if (error != 0)
return (error);
 
-   set_fpcontext(td, _mcontext);
-
/* Restore signal mask. */
kern_sigprocmask(td, SIG_SETMASK, _sigmask, NULL, 0);
 
@@ -612,7 +613,6 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask
/* Fill in the frame to copy out */
bzero(, sizeof(frame));
get_mcontext(td, _uc.uc_mcontext, 0);
-   get_fpcontext(td, _uc.uc_mcontext);
frame.sf_si = ksi->ksi_info;
frame.sf_uc.uc_sigmask = *mask;
frame.sf_uc.uc_stack = td->td_sigstk;
___
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: r356831 - head/sys/powerpc/include

2020-01-17 Thread John Baldwin
On 1/17/20 6:43 AM, Leandro Lupori wrote:
> Author: luporl
> Date: Fri Jan 17 14:43:58 2020
> New Revision: 356831
> URL: https://svnweb.freebsd.org/changeset/base/356831
> 
> Log:
>   [PPC] Fix wrong comment
>   
>   pcb_context[20] holds r12-r31 and not r14-r31, as the comment said.

Thanks, this was the source of the kgdb bug I think. :)

-- 
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"


Re: svn commit: r356797 - head/share/mk

2020-01-16 Thread John Baldwin
On 1/16/20 9:27 AM, Ed Maste wrote:
> Author: emaste
> Date: Thu Jan 16 17:27:08 2020
> New Revision: 356797
> URL: https://svnweb.freebsd.org/changeset/base/356797
> 
> Log:
>   pkgbase: move profiling _p.a libs into -development packages
>   
>   Profiling library archives are part of the development environment; they
>   don't need to be in separate -profile packages.
>   
>   (In fact we can probably just eliminate the _p.a archives assuming that
>   profiling will be done using hwpmc etc., but that is a change for later.)

I would support having MK_PROFILE default to off for 13.  WITHOUT_PROFILE=yes
is something I've been adding to make.conf (or src.conf) for 2 decades.

The mcount-based stuff does not seem compelling compared to sampling via
hardware counters.  It also requires MD code that doesn't even work on
all platforms (e.g. I think the mcount bits for MIPS only work for o32
and are completely broken for n64).  Do we know if any other systems still
ship -pg libraries as an option?  Also, is anyone still using them?

-- 
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"


Re: svn commit: r356755 - in head/sys: net netinet netinet6 netpfil/ipfw/nat64 sys

2020-01-16 Thread John Baldwin
On 1/15/20 2:38 PM, Gleb Smirnoff wrote:
> On Wed, Jan 15, 2020 at 09:44:53AM -1000, Jeff Roberson wrote:
> J> On Wed, 15 Jan 2020, Gleb Smirnoff wrote:
> J> 
> J> > Author: glebius
> J> > Date: Wed Jan 15 06:05:20 2020
> J> > New Revision: 356755
> J> > URL: https://svnweb.freebsd.org/changeset/base/356755
> J> >
> J> > Log:
> J> >  Introduce NET_EPOCH_CALL() macro and use it everywhere where we free
> J> >  data based on the network epoch.   The macro reverses the argument
> J> >  order of epoch_call(9) - first function, then its argument. NFC
> J> 
> J> Is there some practical impact of changing the argument order or does it 
> J> just seem more natural to you?
> 
> It is just more natural. I'm suggesting to change prototype of epoch_call()
> to the same order as well.

+1 for fn, arg.

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

2020-01-14 Thread John Baldwin
Author: jhb
Date: Tue Jan 14 18:00:04 2020
New Revision: 356737
URL: https://svnweb.freebsd.org/changeset/base/356737

Log:
  Preserve the inherited value of the status register in cpu_set_upcall().
  
  Instead of re-deriving the value of SR using logic similar to
  exec_set_regs(), just inherit the value from the existing thread
  similar to fork().
  
  Reviewed by:  brooks
  Obtained from:CheriBSD
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D23059

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

Modified: head/sys/mips/mips/vm_machdep.c
==
--- head/sys/mips/mips/vm_machdep.c Tue Jan 14 17:56:54 2020
(r356736)
+++ head/sys/mips/mips/vm_machdep.c Tue Jan 14 18:00:04 2020
(r356737)
@@ -414,7 +414,7 @@ cpu_set_upcall(struct thread *td, void (*entry)(void *
 stack_t *stack)
 {
struct trapframe *tf;
-   register_t sp;
+   register_t sp, sr;
 
sp = (((intptr_t)stack->ss_sp + stack->ss_size) & ~(STACK_ALIGN - 1)) -
CALLFRAME_SIZ;
@@ -424,8 +424,10 @@ cpu_set_upcall(struct thread *td, void (*entry)(void *
 * function.
 */
tf = td->td_frame;
+   sr = tf->sr;
bzero(tf, sizeof(struct trapframe));
tf->sp = sp;
+   tf->sr = sr;
tf->pc = (register_t)(intptr_t)entry;
/* 
 * MIPS ABI requires T9 to be the same as PC 
@@ -434,18 +436,6 @@ cpu_set_upcall(struct thread *td, void (*entry)(void *
tf->t9 = (register_t)(intptr_t)entry; 
tf->a0 = (register_t)(intptr_t)arg;
 
-   /*
-* Keep interrupt mask
-*/
-   td->td_frame->sr = MIPS_SR_KSU_USER | MIPS_SR_EXL | MIPS_SR_INT_IE |
-   (mips_rd_status() & MIPS_SR_INT_MASK);
-#if defined(__mips_n32) 
-   td->td_frame->sr |= MIPS_SR_PX;
-#elif  defined(__mips_n64)
-   td->td_frame->sr |= MIPS_SR_PX | MIPS_SR_UX | MIPS_SR_KX;
-#endif
-/* tf->sr |= (ALL_INT_MASK & idle_mask) | SR_INT_ENAB; */
-   /**XXX the above may now be wrong -- mips2 implements this as panic */
/*
 * FREEBSD_DEVELOPERS_FIXME:
 * Setup any other CPU-Specific registers (Not MIPS Standard)
___
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: r356561 - head/sys/opencrypto

2020-01-09 Thread John Baldwin
Author: jhb
Date: Thu Jan  9 18:29:59 2020
New Revision: 356561
URL: https://svnweb.freebsd.org/changeset/base/356561

Log:
  Add stricter checking on mac key lengths.
  
  Negative lengths are always invalid.  The key length should also
  be zero for hash algorithms that do not accept a key.
  
  admbugs:  949
  Reported by:  Yuval Kanarenstein 
  Reviewed by:  cem
  MFC after:1 week
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D23094

Modified:
  head/sys/opencrypto/cryptodev.c

Modified: head/sys/opencrypto/cryptodev.c
==
--- head/sys/opencrypto/cryptodev.c Thu Jan  9 18:14:48 2020
(r356560)
+++ head/sys/opencrypto/cryptodev.c Thu Jan  9 18:29:59 2020
(r356561)
@@ -585,8 +585,8 @@ cryptof_ioctl(
if (thash) {
cria.cri_alg = thash->type;
cria.cri_klen = sop->mackeylen * 8;
-   if (thash->keysize != 0 &&
-   sop->mackeylen > thash->keysize) {
+   if (sop->mackeylen > thash->keysize ||
+   sop->mackeylen < 0) {
CRYPTDEB("invalid mac key length");
error = EINVAL;
SDT_PROBE1(opencrypto, dev, ioctl, error,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r356520 - head/sys/opencrypto

2020-01-08 Thread John Baldwin
Author: jhb
Date: Wed Jan  8 22:16:26 2020
New Revision: 356520
URL: https://svnweb.freebsd.org/changeset/base/356520

Log:
  Remove no-longer-used function prototype.
  
  Reported by:  amd64-gcc

Modified:
  head/sys/opencrypto/cryptodev.c

Modified: head/sys/opencrypto/cryptodev.c
==
--- head/sys/opencrypto/cryptodev.c Wed Jan  8 22:06:31 2020
(r356519)
+++ head/sys/opencrypto/cryptodev.c Wed Jan  8 22:16:26 2020
(r356520)
@@ -326,7 +326,6 @@ static struct fileops cryptofops = {
 
 static struct csession *csefind(struct fcrypt *, u_int);
 static bool csedelete(struct fcrypt *, u_int);
-static void cseadd(struct fcrypt *, struct csession *);
 static struct csession *csecreate(struct fcrypt *, crypto_session_t, caddr_t,
 u_int64_t, caddr_t, u_int64_t, u_int32_t, u_int32_t, struct enc_xform *,
 struct auth_hash *);
___
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: r356509 - head/sys/opencrypto

2020-01-08 Thread John Baldwin
Author: jhb
Date: Wed Jan  8 19:05:23 2020
New Revision: 356509
URL: https://svnweb.freebsd.org/changeset/base/356509

Log:
  Remove unneeded cdevsw methods and D_NEEDGIANT.
  
  Reviewed by:  kib
  MFC after:2 weeks
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D23079

Modified:
  head/sys/opencrypto/cryptodev.c

Modified: head/sys/opencrypto/cryptodev.c
==
--- head/sys/opencrypto/cryptodev.c Wed Jan  8 19:03:24 2020
(r356508)
+++ head/sys/opencrypto/cryptodev.c Wed Jan  8 19:05:23 2020
(r356509)
@@ -1473,24 +1473,6 @@ csefree(struct csession *cse)
 }
 
 static int
-cryptoopen(struct cdev *dev, int oflags, int devtype, struct thread *td)
-{
-   return (0);
-}
-
-static int
-cryptoread(struct cdev *dev, struct uio *uio, int ioflag)
-{
-   return (EIO);
-}
-
-static int
-cryptowrite(struct cdev *dev, struct uio *uio, int ioflag)
-{
-   return (EIO);
-}
-
-static int
 cryptoioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct 
thread *td)
 {
struct file *f;
@@ -1531,10 +1513,6 @@ cryptoioctl(struct cdev *dev, u_long cmd, caddr_t data
 
 static struct cdevsw crypto_cdevsw = {
.d_version =D_VERSION,
-   .d_flags =  D_NEEDGIANT,
-   .d_open =   cryptoopen,
-   .d_read =   cryptoread,
-   .d_write =  cryptowrite,
.d_ioctl =  cryptoioctl,
.d_name =   "crypto",
 };
___
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: r356508 - head/sys/opencrypto

2020-01-08 Thread John Baldwin
Author: jhb
Date: Wed Jan  8 19:03:24 2020
New Revision: 356508
URL: https://svnweb.freebsd.org/changeset/base/356508

Log:
  Use falloc_noinstall + finstall for crypto file descriptors.
  
  Reviewed by:  cem, kib
  MFC after:1 week
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D23078

Modified:
  head/sys/opencrypto/cryptodev.c

Modified: head/sys/opencrypto/cryptodev.c
==
--- head/sys/opencrypto/cryptodev.c Wed Jan  8 18:59:23 2020
(r356507)
+++ head/sys/opencrypto/cryptodev.c Wed Jan  8 19:03:24 2020
(r356508)
@@ -1499,20 +1499,21 @@ cryptoioctl(struct cdev *dev, u_long cmd, caddr_t data
 
switch (cmd) {
case CRIOGET:
+   error = falloc_noinstall(td, );
+   if (error)
+   break;
+
fcr = malloc(sizeof(struct fcrypt), M_XDATA, M_WAITOK | M_ZERO);
TAILQ_INIT(>csessions);
mtx_init(>lock, "fcrypt", NULL, MTX_DEF);
 
-   error = falloc(td, , , 0);
-
+   finit(f, FREAD | FWRITE, DTYPE_CRYPTO, fcr, );
+   error = finstall(td, f, , 0, NULL);
if (error) {
mtx_destroy(>lock);
free(fcr, M_XDATA);
-   return (error);
-   }
-   /* falloc automatically provides an extra reference to 'f'. */
-   finit(f, FREAD | FWRITE, DTYPE_CRYPTO, fcr, );
-   *(u_int32_t *)data = fd;
+   } else
+   *(uint32_t *)data = fd;
fdrop(f, td);
break;
case CRIOFINDDEV:
___
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: r356507 - head/sys/opencrypto

2020-01-08 Thread John Baldwin
Author: jhb
Date: Wed Jan  8 18:59:23 2020
New Revision: 356507
URL: https://svnweb.freebsd.org/changeset/base/356507

Log:
  Add a reference count to cryptodev sessions.
  
  This prevents use-after-free races with crypto requests (which may
  sleep) and CIOCFSESSION as well as races from current CIOCFSESSION
  requests.
  
  admbugs:  949
  Reported by:  Yuval Kanarenstein 
  Reviewed by:  cem
  MFC after:1 week
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D23077

Modified:
  head/sys/opencrypto/cryptodev.c

Modified: head/sys/opencrypto/cryptodev.c
==
--- head/sys/opencrypto/cryptodev.c Wed Jan  8 18:26:23 2020
(r356506)
+++ head/sys/opencrypto/cryptodev.c Wed Jan  8 18:59:23 2020
(r356507)
@@ -266,6 +266,7 @@ crypt_kop_to_32(const struct crypt_kop *from, struct c
 struct csession {
TAILQ_ENTRY(csession) next;
crypto_session_t cses;
+   volatile u_int  refs;
u_int32_t   ses;
struct mtx  lock;   /* for op submission */
 
@@ -292,6 +293,7 @@ struct cryptop_data {
 struct fcrypt {
TAILQ_HEAD(csessionlist, csession) csessions;
int sesn;
+   struct mtx  lock;
 };
 
 static struct timeval warninterval = { .tv_sec = 60, .tv_usec = 0 };
@@ -323,8 +325,8 @@ static struct fileops cryptofops = {
 };
 
 static struct csession *csefind(struct fcrypt *, u_int);
-static int csedelete(struct fcrypt *, struct csession *);
-static struct csession *cseadd(struct fcrypt *, struct csession *);
+static bool csedelete(struct fcrypt *, u_int);
+static void cseadd(struct fcrypt *, struct csession *);
 static struct csession *csecreate(struct fcrypt *, crypto_session_t, caddr_t,
 u_int64_t, caddr_t, u_int64_t, u_int32_t, u_int32_t, struct enc_xform *,
 struct auth_hash *);
@@ -668,13 +670,10 @@ bail:
break;
case CIOCFSESSION:
ses = *(u_int32_t *)data;
-   cse = csefind(fcr, ses);
-   if (cse == NULL) {
+   if (!csedelete(fcr, ses)) {
SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__);
return (EINVAL);
}
-   csedelete(fcr, cse);
-   csefree(cse);
break;
case CIOCCRYPT:
 #ifdef COMPAT_FREEBSD32
@@ -691,6 +690,7 @@ bail:
return (EINVAL);
}
error = cryptodev_op(cse, cop, active_cred, td);
+   csefree(cse);
 #ifdef COMPAT_FREEBSD32
if (error == 0 && cmd == CIOCCRYPT32)
crypt_op_to_32(cop, data);
@@ -757,6 +757,7 @@ bail:
return (EINVAL);
}
error = cryptodev_aead(cse, caead, active_cred, td);
+   csefree(cse);
break;
default:
error = EINVAL;
@@ -1375,6 +1376,9 @@ cryptof_close(struct file *fp, struct thread *td)
 
while ((cse = TAILQ_FIRST(>csessions))) {
TAILQ_REMOVE(>csessions, cse, next);
+   KASSERT(cse->refs == 1,
+   ("%s: crypto session %p with %d refs", __func__, cse,
+   cse->refs));
csefree(cse);
}
free(fcr, M_XDATA);
@@ -1395,34 +1399,36 @@ csefind(struct fcrypt *fcr, u_int ses)
 {
struct csession *cse;
 
-   TAILQ_FOREACH(cse, >csessions, next)
-   if (cse->ses == ses)
+   mtx_lock(>lock);
+   TAILQ_FOREACH(cse, >csessions, next) {
+   if (cse->ses == ses) {
+   refcount_acquire(>refs);
+   mtx_unlock(>lock);
return (cse);
+   }
+   }
+   mtx_unlock(>lock);
return (NULL);
 }
 
-static int
-csedelete(struct fcrypt *fcr, struct csession *cse_del)
+static bool
+csedelete(struct fcrypt *fcr, u_int ses)
 {
struct csession *cse;
 
+   mtx_lock(>lock);
TAILQ_FOREACH(cse, >csessions, next) {
-   if (cse == cse_del) {
+   if (cse->ses == ses) {
TAILQ_REMOVE(>csessions, cse, next);
-   return (1);
+   mtx_unlock(>lock);
+   csefree(cse);
+   return (true);
}
}
-   return (0);
+   mtx_unlock(>lock);
+   return (false);
 }

-static struct csession *
-cseadd(struct fcrypt *fcr, struct csession *cse)
-{
-   TAILQ_INSERT_TAIL(>csessions, cse, next);
-   cse->ses = fcr->sesn++;
-   return (cse);
-}
-
 struct csession *
 csecreate(struct fcrypt *fcr, crypto_session_t cses, caddr_t key, u_int64_t 
keylen,
 caddr_t mackey, u_int64_t mackeylen, u_int32_t cipher, u_int32_t mac,
@@ -1434,6 +1440,7 @@ csecreate(struct fcrypt *fcr, crypto_session_t cses, c

svn commit: r356504 - head/share/mk

2020-01-08 Thread John Baldwin
Author: jhb
Date: Wed Jan  8 17:49:34 2020
New Revision: 356504
URL: https://svnweb.freebsd.org/changeset/base/356504

Log:
  Add -mno-relax to CFLAGS in bsd.prog/lib.mk instead of bsd.cpu.mk.
  
  bsd.cpu.mk is included by bsd.init.mk before bsd.linker.mk, so it
  was always setting the flag since LINKER_FEATURES wasn't defined.
  
  Reported by:  mhorne
  Reviewed by:  imp, mhorne
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D23076

Modified:
  head/share/mk/bsd.cpu.mk
  head/share/mk/bsd.lib.mk
  head/share/mk/bsd.prog.mk

Modified: head/share/mk/bsd.cpu.mk
==
--- head/share/mk/bsd.cpu.mkWed Jan  8 17:37:20 2020(r356503)
+++ head/share/mk/bsd.cpu.mkWed Jan  8 17:49:34 2020(r356504)
@@ -375,10 +375,6 @@ CFLAGS += -march=rv64imac -mabi=lp64
 .else
 CFLAGS += -march=rv64imafdc -mabi=lp64d
 .endif
-
-.if ${LINKER_FEATURES:U:Mriscv-relaxations} == ""
-CFLAGS += -mno-relax
-.endif
 .endif
 
 # NB: COPTFLAGS is handled in /usr/src/sys/conf/kern.pre.mk

Modified: head/share/mk/bsd.lib.mk
==
--- head/share/mk/bsd.lib.mkWed Jan  8 17:37:20 2020(r356503)
+++ head/share/mk/bsd.lib.mkWed Jan  8 17:49:34 2020(r356504)
@@ -98,6 +98,10 @@ STATIC_CFLAGS+= -ftls-model=initial-exec
 STATIC_CXXFLAGS+= -ftls-model=initial-exec
 .endif
 
+.if ${MACHINE_CPUARCH} == "riscv" && ${LINKER_FEATURES:Mriscv-relaxations} == 
""
+CFLAGS += -mno-relax
+.endif
+
 .include 
 
 # prefer .s to a .c, add .po, remove stuff not used in the BSD libraries

Modified: head/share/mk/bsd.prog.mk
==
--- head/share/mk/bsd.prog.mk   Wed Jan  8 17:37:20 2020(r356503)
+++ head/share/mk/bsd.prog.mk   Wed Jan  8 17:49:34 2020(r356504)
@@ -57,6 +57,10 @@ LDFLAGS+= -Wl,-zretpolineplt
 .endif
 .endif
 
+.if ${MACHINE_CPUARCH} == "riscv" && ${LINKER_FEATURES:Mriscv-relaxations} == 
""
+CFLAGS += -mno-relax
+.endif
+
 .if defined(CRUNCH_CFLAGS)
 CFLAGS+=${CRUNCH_CFLAGS}
 .else
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r356502 - head

2020-01-08 Thread John Baldwin
Author: jhb
Date: Wed Jan  8 17:31:54 2020
New Revision: 356502
URL: https://svnweb.freebsd.org/changeset/base/356502

Log:
  Add notes for MAKE_OBSOLETE_GCC going away and riscv switching to clang/lld.

Modified:
  head/UPDATING

Modified: head/UPDATING
==
--- head/UPDATING   Wed Jan  8 17:31:18 2020(r356501)
+++ head/UPDATING   Wed Jan  8 17:31:54 2020(r356502)
@@ -26,6 +26,15 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW:
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
 
+20200108:
+   Clang/LLVM is now the default compiler and LLD the default
+   linker for riscv64.
+
+20200107:
+   make universe no longer uses GCC 4.2.1 on any architectures.
+   Architectures not supported by in-tree Clang/LLVM require an
+   external toolchain package.
+
 20200104:
GCC 4.2.1 is now not built by default, as part of the GCC 4.2.1
retirement plan.  Specifically, the GCC, GCC_BOOTSTRAP, and GNUCXX
___
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: r356501 - head/share/man/man7

2020-01-08 Thread John Baldwin
Author: jhb
Date: Wed Jan  8 17:31:18 2020
New Revision: 356501
URL: https://svnweb.freebsd.org/changeset/base/356501

Log:
  Remove a mention of MAKE_OBSOLETE_GCC.
  
  This should have been included in r356452.

Modified:
  head/share/man/man7/arch.7

Modified: head/share/man/man7/arch.7
==
--- head/share/man/man7/arch.7  Wed Jan  8 17:30:14 2020(r356500)
+++ head/share/man/man7/arch.7  Wed Jan  8 17:31:18 2020(r356501)
@@ -330,9 +330,7 @@ Note that GCC 4.2.1 is deprecated, and scheduled for r
 Any CPU architectures not migrated by then
 (to either base system Clang or external toolchain)
 may be removed from the tree after that date.
-Unless the make variable
-.Dv MAKE_OBSOLETE_GCC
-is defined, make universe will not build mips or sparc64
+make universe will not build mips or sparc64
 architectures unless the xtoolchain binaries have been installed for
 the architecture.
 .Ss MACHINE_ARCH vs MACHINE_CPUARCH vs MACHINE
___
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: r356499 - in head: . share/man/man7 share/mk

2020-01-08 Thread John Baldwin
Author: jhb
Date: Wed Jan  8 17:25:59 2020
New Revision: 356499
URL: https://svnweb.freebsd.org/changeset/base/356499

Log:
  Use clang and lld as the default toolchain for RISCV.
  
  - Enable clang and lld as system toolchains.
  - Don't use external GCC for universe by default.
  - Re-enable riscv64sf since it builds fine with clang + lld.
  
  Reviewed by:  emaste, mhorne
  Relnotes: yes
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D23089

Modified:
  head/Makefile
  head/share/man/man7/arch.7
  head/share/mk/src.opts.mk

Modified: head/Makefile
==
--- head/Makefile   Wed Jan  8 17:23:52 2020(r356498)
+++ head/Makefile   Wed Jan  8 17:25:59 2020(r356499)
@@ -495,23 +495,20 @@ TARGET_ARCHES_arm64?= aarch64
 TARGET_ARCHES_mips?=   mipsel mips mips64el mips64 mipsn32 mipselhf mipshf 
mips64elhf mips64hf
 # powerpcspe excluded until clang fixed
 TARGET_ARCHES_powerpc?=powerpc powerpc64
-# riscv64sf excluded due to PR 232085
-TARGET_ARCHES_riscv?=  riscv64
+TARGET_ARCHES_riscv?=  riscv64 riscv64sf
 .for target in ${TARGETS}
 TARGET_ARCHES_${target}?= ${target}
 .endfor
 
-MAKE_PARAMS_riscv?=CROSS_TOOLCHAIN=riscv64-gcc
 MAKE_PARAMS_mips?= CROSS_TOOLCHAIN=mips-gcc6
 MAKE_PARAMS_sparc64?=  CROSS_TOOLCHAIN=sparc64-gcc6
 
 TOOLCHAINS_mips=   mips-gcc6
-TOOLCHAINS_riscv=  riscv64-gcc
 TOOLCHAINS_sparc64=sparc64-gcc6
 
 # Remove architectures only supported by external toolchain from
 # universe if required toolchain packages are missing.
-.for target in mips riscv sparc64
+.for target in mips sparc64
 .if ${_UNIVERSE_TARGETS:M${target}}
 .for toolchain in ${TOOLCHAINS_${target}}
 .if !exists(/usr/local/share/toolchains/${toolchain}.mk)

Modified: head/share/man/man7/arch.7
==
--- head/share/man/man7/arch.7  Wed Jan  8 17:23:52 2020(r356498)
+++ head/share/man/man7/arch.7  Wed Jan  8 17:25:59 2020(r356499)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 5, 2020
+.Dd January 8, 2020
 .Dt ARCH 7
 .Os
 .Sh NAME
@@ -319,8 +319,8 @@ This table shows the default tool chain for each archi
 .It powerpc Ta Clang Ta GNU ld 2.17.50
 .It powerpcspe  Ta Clang Ta GNU ld 2.17.50
 .It powerpc64   Ta Clang Ta lld
-.It riscv64 Ta GCC(1)Ta GNU ld(1)
-.It riscv64sf   Ta GCC(1)Ta GNU ld(1)
+.It riscv64 Ta Clang Ta lld
+.It riscv64sf   Ta Clang Ta lld
 .It sparc64 Ta GCC(1)Ta GNU ld(1)
 .El
 .Pp

Modified: head/share/mk/src.opts.mk
==
--- head/share/mk/src.opts.mk   Wed Jan  8 17:23:52 2020(r356498)
+++ head/share/mk/src.opts.mk   Wed Jan  8 17:25:59 2020(r356499)
@@ -295,8 +295,7 @@ __DEFAULT_NO_OPTIONS+=LLVM_TARGET_BPF
 # If the compiler is not C++11 capable, disable Clang.  External toolchain will
 # be required.
 
-.if ${COMPILER_FEATURES:Mc++11} && (${__TT} != "mips" && \
-${__TT} != "riscv" && ${__TT} != "sparc64")
+.if ${COMPILER_FEATURES:Mc++11} && (${__TT} != "mips" && ${__TT} != "sparc64")
 # Clang is enabled, and will be installed as the default /usr/bin/cc.
 __DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_IS_CC LLD
 .elif ${COMPILER_FEATURES:Mc++11} && ${__T} != "sparc64"
@@ -323,7 +322,7 @@ __DEFAULT_YES_OPTIONS+=LLVM_LIBUNWIND
 __DEFAULT_NO_OPTIONS+=LLVM_LIBUNWIND
 .endif
 .if ${__TT} != "mips" && ${__T} != "powerpc" && ${__T} != "powerpcspe" && \
-${__TT} != "riscv" && ${__T} != "sparc64"
+${__T} != "sparc64"
 __DEFAULT_YES_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD
 .else
 __DEFAULT_NO_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD
___
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: r356481 - in head/sys: conf riscv/riscv

2020-01-07 Thread John Baldwin
Author: jhb
Date: Tue Jan  7 23:18:31 2020
New Revision: 356481
URL: https://svnweb.freebsd.org/changeset/base/356481

Log:
  Work around lld's inability to handle undefined weak symbols on risc-v.
  
  lld on RISC-V is not yet able to handle undefined weak symbols for
  non-PIC code in the code model (medany/medium) used by the RISC-V
  kernel.
  
  Both GCC and clang emit an auipc / addi pair of instructions to
  generate an address relative to the current PC with a 31-bit offset.
  Undefined weak symbols need to have an address of 0, but the kernel
  runs with PC values much greater than 2^31, so there is no way to
  construct a NULL pointer as a PC-relative value.  The bfd linker
  rewrites the instruction pair to use lui / addi with values of 0 to
  force a NULL pointer address.  (There are similar cases for 'ld'
  becoming auipc / ld that bfd rewrites to lui / ld with an address of
  0.)
  
  To work around this, compile the kernel with -fPIE when using lld.
  This does not make the kernel position-independent, but it does
  force the compiler to indirect address lookups through GOT entries
  (so auipc / ld against a GOT entry to fetch the address).  This
  adds extra memory indirections for global symbols, so should be
  disabled once lld is finally fixed.
  
  A few 'la' instructions in locore that depend on PC-relative
  addressing to load physical addresses before paging is enabled have to
  use auipc / addi and not indirect via GOT entries, so change those to
  use 'lla' which always uses auipc / addi for both PIC and non-PIC.
  
  Submitted by: jrtc27
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D23064

Modified:
  head/sys/conf/kern.pre.mk
  head/sys/riscv/riscv/locore.S

Modified: head/sys/conf/kern.pre.mk
==
--- head/sys/conf/kern.pre.mk   Tue Jan  7 23:10:38 2020(r356480)
+++ head/sys/conf/kern.pre.mk   Tue Jan  7 23:18:31 2020(r356481)
@@ -170,6 +170,17 @@ LDFLAGS+=  -z notext -z ifunc-noplt
 .endif
 .endif
 
+.if ${MACHINE_CPUARCH} == "riscv"
+# Hack: Work around undefined weak symbols being out of range when linking with
+# LLD (address is a PC-relative calculation, and BFD works around this by
+# rewriting the instructions to generate an absolute address of 0); -fPIE
+# avoids this since it uses the GOT for all extern symbols, which is overly
+# inefficient for us. Drop once undefined weak symbols work with medany.
+.if ${LINKER_TYPE} == "lld"
+CFLAGS+=   -fPIE
+.endif
+.endif
+
 NORMAL_C= ${CC} -c ${CFLAGS} ${WERROR} ${PROF} ${.IMPSRC}
 NORMAL_S= ${CC:N${CCACHE_BIN}} -c ${ASM_CFLAGS} ${WERROR} ${.IMPSRC}
 PROFILE_C= ${CC} -c ${CFLAGS} ${WERROR} ${.IMPSRC}

Modified: head/sys/riscv/riscv/locore.S
==
--- head/sys/riscv/riscv/locore.S   Tue Jan  7 23:10:38 2020
(r356480)
+++ head/sys/riscv/riscv/locore.S   Tue Jan  7 23:18:31 2020
(r356481)
@@ -54,7 +54,7 @@
.globl _start
 _start:
/* Get the physical address kernel loaded to */
-   la  t0, virt_map
+   lla t0, virt_map
ld  t1, 0(t0)
sub t1, t1, t0
li  t2, KERNBASE
@@ -66,7 +66,7 @@ _start:
 */
 
/* Pick a hart to run the boot process. */
-   la  t0, hart_lottery
+   lla t0, hart_lottery
li  t1, 1
amoadd.w t0, t1, 0(t0)
 
@@ -82,8 +82,8 @@ _start:
 */
 1:
/* Add L1 entry for kernel */
-   la  s1, pagetable_l1
-   la  s2, pagetable_l2/* Link to next level PN */
+   lla s1, pagetable_l1
+   lla s2, pagetable_l2/* Link to next level PN */
srlis2, s2, PAGE_SHIFT
 
li  a5, KERNBASE
@@ -100,7 +100,7 @@ _start:
sd  t6, (t0)
 
/* Level 2 superpages (512 x 2MiB) */
-   la  s1, pagetable_l2
+   lla s1, pagetable_l2
srlit4, s9, 21  /* Div physmem base by 2 MiB */
li  t2, 512 /* Build 512 entries */
add t3, t4, t2
@@ -116,8 +116,8 @@ _start:
bltut4, t3, 2b
 
/* Create an L1 page for early devmap */
-   la  s1, pagetable_l1
-   la  s2, pagetable_l2_devmap /* Link to next level PN */
+   lla s1, pagetable_l1
+   lla s2, pagetable_l2_devmap /* Link to next level PN */
srlis2, s2, PAGE_SHIFT
 
li  a5, (VM_MAX_KERNEL_ADDRESS - L2_SIZE)
@@ -134,7 +134,7 @@ _start:
sd  t6, (t0)
 
/* Create an L2 page superpage for DTB */
-   la  s1, pagetable_l2_devmap
+   lla s1, pagetable_l2_devmap
mv  s2, a1
srlis2, s2, PAGE_SHIFT
 
@@ -152,14 +152,14 @@ _start:
/* Page tables END */
 
/* Setup supervisor trap vector */
-   la  t0, va
+   lla t0, va
sub t0, t0, s9

svn commit: r356478 - head

2020-01-07 Thread John Baldwin
Author: jhb
Date: Tue Jan  7 21:56:28 2020
New Revision: 356478
URL: https://svnweb.freebsd.org/changeset/base/356478

Log:
  Don't fail universe kernel stage for TARGET_ARCHes without a kernel config.
  
  This fixes a regression in r356418 where the entire universe would
  fail early due to an undefined make target when a given TARGET_ARCH
  had no associated kernel configs.  This is true for all of the
  hard-float mips TARGET_ARCHes currently.
  
  Pointy hat to:me
  Reviewed by:  emaste
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D23071

Modified:
  head/Makefile

Modified: head/Makefile
==
--- head/Makefile   Tue Jan  7 21:56:20 2020(r356477)
+++ head/Makefile   Tue Jan  7 21:56:28 2020(r356478)
@@ -728,6 +728,7 @@ universe_kernconf_${TARGET}_${kernel}: .MAKE
 .endfor
 .for target_arch in ${TARGET_ARCHES_${TARGET}}
 universe_kernconfs: universe_kernconfs_${target_arch} .PHONY
+universe_kernconfs_${target_arch}:
 .endfor
 .endif # make(universe_kernels)
 universe: universe_epilogue
___
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: r356457 - head/tools/tools/crypto

2020-01-07 Thread John Baldwin
Author: jhb
Date: Tue Jan  7 17:07:58 2020
New Revision: 356457
URL: https://svnweb.freebsd.org/changeset/base/356457

Log:
  Various cleanups to cryptocheck.
  
  - Rename 'blkcipher' to 'cipher'.  Some of the ciphers being tested
are stream ciphers.
  - Rename 'authenc' to 'eta' as it is only testing ETA chained
operations and not other combination modes.
  - Add a notion of an OCF session and some helper routines to try to
reduce duplicated code.  This also uses a single session for both
encrypt and decrypt operations during a single test.
  - Add tests to ensure that AEAD algorithms fail decryption with
EBADMSG when given a corrupted tag.
  - Remove the transitional hack for COP_F_CIPHER_FIRST.
  - Update block comment to mention plain hashes.
  
  Reviewed by:  cem
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D22940

Modified:
  head/tools/tools/crypto/cryptocheck.c

Modified: head/tools/tools/crypto/cryptocheck.c
==
--- head/tools/tools/crypto/cryptocheck.c   Tue Jan  7 17:02:49 2020
(r356456)
+++ head/tools/tools/crypto/cryptocheck.c   Tue Jan  7 17:07:58 2020
(r356457)
@@ -73,41 +73,50 @@
  *
  * Supported algorithms:
  * all Run all tests
- * hmacRun all hmac tests
- * blkcipher   Run all block cipher tests
- * authenc Run all authenticated encryption tests
+ * hashRun all hash tests
+ * mac Run all mac tests
+ * cipher  Run all cipher tests
+ * eta Run all encrypt-then-authenticate tests
  * aeadRun all authenticated encryption with associated data
  * tests
  *
- * HMACs:
- * sha1sha1 hmac
- * sha256  256-bit sha2 hmac
- * sha384  384-bit sha2 hmac
- * sha512  512-bit sha2 hmac
+ * Hashes:
+ * sha1SHA-1
+ * sha224  224-bit SHA-2
+ * sha256  256-bit SHA-2
+ * sha384  384-bit SHA-2
+ * sha512  512-bit SHA-2
  * blake2b Blake2-B
  * blake2s Blake2-S
  *
- * Block Ciphers:
- * aes-cbc 128-bit aes cbc
- * aes-cbc192  192-bit aes cbc
- * aes-cbc256  256-bit aes cbc
- * aes-ctr 128-bit aes ctr
- * aes-ctr192  192-bit aes ctr
- * aes-ctr256  256-bit aes ctr
- * aes-xts 128-bit aes xts
- * aes-xts256  256-bit aes xts
+ * MACs:
+ * sha1hmacSHA-1 HMAC
+ * sha224hmac  224-bit SHA-2 HMAC
+ * sha256hmac  256-bit SHA-2 HMAC
+ * sha384hmac  384-bit SHA-2 HMAC
+ * sha512hmac  512-bit SHA-2 HMAC
+ *
+ * Ciphers:
+ * aes-cbc 128-bit AES-CBC
+ * aes-cbc192  192-bit AES-CBC
+ * aes-cbc256  256-bit AES-CBC
+ * aes-ctr 128-bit AES-CTR
+ * aes-ctr192  192-bit AES-CTR
+ * aes-ctr256  256-bit AES-CTR
+ * aes-xts 128-bit AES-XTS
+ * aes-xts256  256-bit AES-XTS
  * chacha20
  *
- * Authenticated Encryption:
- * +
+ * Encrypt then Authenticate:
+ * +
  *
  * Authenticated Encryption with Associated Data:
- * aes-gcm 128-bit aes gcm
- * aes-gcm192  192-bit aes gcm
- * aes-gcm256  256-bit aes gcm
- * aes-ccm 128-bit aes ccm
- * aes-ccm192  192-bit aes ccm
- * aes-ccm256  256-bit aes ccm
+ * aes-gcm 128-bit AES-GCM
+ * aes-gcm192  192-bit AES-GCM
+ * aes-gcm256  256-bit AES-GCM
+ * aes-ccm 128-bit AES-CCM
+ * aes-ccm192  192-bit AES-CCM
+ * aes-ccm256  256-bit AES-CCM
  */
 
 #include 
@@ -126,16 +135,17 @@
 
 #include 
 
-/* XXX: Temporary hack */
-#ifndef COP_F_CIPHER_FIRST
-#defineCOP_F_CIPHER_FIRST  0x0001  /* Cipher before MAC. */
-#endif
+struct ocf_session {
+   int fd;
+   int ses;
+   int crid;
+};
 
-struct alg {
+const struct alg {
const char *name;
int cipher;
int mac;
-   enum { T_HASH, T_HMAC, T_BLKCIPHER, T_AUTHENC, T_GCM, T_CCM } type;
+   enum { T_HASH, T_HMAC, T_CIPHER, T_ETA, T_AEAD } type;
const EVP_CIPHER *(*evp_cipher)(void);
const EVP_MD *(*evp_md)(void);
 } algs[] = {
@@ -163,41 +173,41 @@ struct alg {
  .evp_md = EVP_blake2b512 },
{ .name = "blake2s", .mac = CRYPTO_BLAKE2S, .type = T_HASH,
  .evp_md = EVP_blake2s256 },
-   { .name = "aes-cbc", .cipher = CRYPTO_AES_CBC, .type = T_BLKCIPHER,
+   { .name = "aes-cbc", .cipher = CRYPTO_AES_CBC, .type = T_CIPHER,
  .evp_cipher = EVP_aes_128_cbc },
-   { .name = "aes-cbc192", .cipher = CRYPTO_AES_CBC, .type = T_BLKCIPHER,
+   { .name = "aes-cbc192", .cipher = CRYPTO_AES_CBC, .type = T_CIPHER,
  .evp_cipher = EVP_aes_192_cbc },
-   { .name = "aes-cbc256", .cipher 

svn commit: r356452 - head

2020-01-07 Thread John Baldwin
Author: jhb
Date: Tue Jan  7 16:53:51 2020
New Revision: 356452
URL: https://svnweb.freebsd.org/changeset/base/356452

Log:
  Remove support for using GCC 4.2.1 from make tinderbox.
  
  Reviewed by:  emaste
  Differential Revision:https://reviews.freebsd.org/D23054

Modified:
  head/Makefile

Modified: head/Makefile
==
--- head/Makefile   Tue Jan  7 16:52:15 2020(r356451)
+++ head/Makefile   Tue Jan  7 16:53:51 2020(r356452)
@@ -6,9 +6,7 @@
 # universe- *Really* build *everything* (buildworld and
 #   all kernels on all architectures).  Define
 #   MAKE_JUST_KERNELS to only build kernels,
-#   MAKE_JUST_WORLDS to only build userland, and/or
-#   MAKE_OBSOLETE_GCC to also build architectures
-#   unsupported by clang using in-tree gcc.
+#   MAKE_JUST_WORLDS to only build userland.
 # tinderbox   - Same as universe, but presents a list of failed build
 #   targets and exits with an error if there were any.
 # buildworld  - Rebuild *everything*, including glue to help do
@@ -490,8 +488,7 @@ worlds: .PHONY
 # In all cases, if the user specifies TARGETS on the command line,
 # honor that most of all.
 #
-_OBSOLETE_GCC_TARGETS=mips sparc64
-TARGETS?=amd64 arm arm64 i386 powerpc riscv ${_OBSOLETE_GCC_TARGETS}
+TARGETS?=amd64 arm arm64 i386 mips powerpc riscv sparc64
 _UNIVERSE_TARGETS= ${TARGETS}
 TARGET_ARCHES_arm?=armv6 armv7
 TARGET_ARCHES_arm64?=  aarch64
@@ -505,21 +502,16 @@ TARGET_ARCHES_${target}?= ${target}
 .endfor
 
 MAKE_PARAMS_riscv?=CROSS_TOOLCHAIN=riscv64-gcc
-.if !defined(MAKE_OBSOLETE_GCC)
-OBSOLETE_GCC_TARGETS=${_OBSOLETE_GCC_TARGETS}
 MAKE_PARAMS_mips?= CROSS_TOOLCHAIN=mips-gcc6
 MAKE_PARAMS_sparc64?=  CROSS_TOOLCHAIN=sparc64-gcc6
-.endif
 
 TOOLCHAINS_mips=   mips-gcc6
 TOOLCHAINS_riscv=  riscv64-gcc
 TOOLCHAINS_sparc64=sparc64-gcc6
 
 # Remove architectures only supported by external toolchain from
-# universe if required toolchain packages are missing. riscv requires
-# an out-of-tree toolchain. When MAKE_OBSOLETE_GCC is not defined,
-# the same logic appleis to the obsolete gcc targets.
-.for target in riscv ${OBSOLETE_GCC_TARGETS}
+# universe if required toolchain packages are missing.
+.for target in mips riscv sparc64
 .if ${_UNIVERSE_TARGETS:M${target}}
 .for toolchain in ${TOOLCHAINS_${target}}
 .if !exists(/usr/local/share/toolchains/${toolchain}.mk)
___
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: r356420 - head/sys/mips/mips

2020-01-06 Thread John Baldwin
Author: jhb
Date: Mon Jan  6 18:02:02 2020
New Revision: 356420
URL: https://svnweb.freebsd.org/changeset/base/356420

Log:
  Simplify arguments to signal handlers on mips.
  
  - Use ksi_addr directly as si_addr in the siginfo instead of the
'badvaddr' register.
  - Remove a duplicate assignment of si_code.
  - Use ksi_addr as the 4th argument to the old-style handler instead of
'badvaddr'.
  
  Reviewed by:  brooks, kevans
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D23013

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

Modified: head/sys/mips/mips/pm_machdep.c
==
--- head/sys/mips/mips/pm_machdep.c Mon Jan  6 17:36:28 2020
(r356419)
+++ head/sys/mips/mips/pm_machdep.c Mon Jan  6 18:02:02 2020
(r356420)
@@ -147,12 +147,10 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask
/* fill siginfo structure */
sf.sf_si = ksi->ksi_info;
sf.sf_si.si_signo = sig;
-   sf.sf_si.si_code = ksi->ksi_code;
-   sf.sf_si.si_addr = (void*)(intptr_t)regs->badvaddr;
} else {
/* Old FreeBSD-style arguments. */
regs->a1 = ksi->ksi_code;
-   regs->a3 = regs->badvaddr;
+   regs->a3 = (uintptr_t)ksi->ksi_addr;
/* sf.sf_ahu.sf_handler = catcher; */
}
 
___
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: r356419 - head

2020-01-06 Thread John Baldwin
Author: jhb
Date: Mon Jan  6 17:36:28 2020
New Revision: 356419
URL: https://svnweb.freebsd.org/changeset/base/356419

Log:
  Enable powerpc in make tinderbox using clang instead of GCC.
  
  powerpcspe is disabled for now until clang/llvm issues with spe
  have been fixed.
  
  Reviewed by:  imp
  Differential Revision:https://reviews.freebsd.org/D23031

Modified:
  head/Makefile

Modified: head/Makefile
==
--- head/Makefile   Mon Jan  6 17:34:17 2020(r356418)
+++ head/Makefile   Mon Jan  6 17:36:28 2020(r356419)
@@ -491,15 +491,13 @@ worlds: .PHONY
 # honor that most of all.
 #
 _OBSOLETE_GCC_TARGETS=mips sparc64
-.if defined(MAKE_OBSOLETE_GCC)
-_OBSOLETE_GCC_TARGETS+=powerpc
-.endif
-TARGETS?=amd64 arm arm64 i386 riscv ${_OBSOLETE_GCC_TARGETS}
+TARGETS?=amd64 arm arm64 i386 powerpc riscv ${_OBSOLETE_GCC_TARGETS}
 _UNIVERSE_TARGETS= ${TARGETS}
 TARGET_ARCHES_arm?=armv6 armv7
 TARGET_ARCHES_arm64?=  aarch64
 TARGET_ARCHES_mips?=   mipsel mips mips64el mips64 mipsn32 mipselhf mipshf 
mips64elhf mips64hf
-TARGET_ARCHES_powerpc?=powerpc powerpc64 powerpcspe
+# powerpcspe excluded until clang fixed
+TARGET_ARCHES_powerpc?=powerpc powerpc64
 # riscv64sf excluded due to PR 232085
 TARGET_ARCHES_riscv?=  riscv64
 .for target in ${TARGETS}
@@ -510,12 +508,10 @@ MAKE_PARAMS_riscv?=   CROSS_TOOLCHAIN=riscv64-gcc
 .if !defined(MAKE_OBSOLETE_GCC)
 OBSOLETE_GCC_TARGETS=${_OBSOLETE_GCC_TARGETS}
 MAKE_PARAMS_mips?= CROSS_TOOLCHAIN=mips-gcc6
-MAKE_PARAMS_powerpc?=  CROSS_TOOLCHAIN=powerpc64-gcc6
 MAKE_PARAMS_sparc64?=  CROSS_TOOLCHAIN=sparc64-gcc6
 .endif
 
 TOOLCHAINS_mips=   mips-gcc6
-TOOLCHAINS_powerpc=powerpc64-gcc6
 TOOLCHAINS_riscv=  riscv64-gcc
 TOOLCHAINS_sparc64=sparc64-gcc6
 
___
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: r356418 - head

2020-01-06 Thread John Baldwin
Author: jhb
Date: Mon Jan  6 17:34:17 2020
New Revision: 356418
URL: https://svnweb.freebsd.org/changeset/base/356418

Log:
  Only build kernels for enabled TARGET_ARCHes in make universe/tinderbox.
  
  Previously, all of the kernels for a given TARGET were built if that
  target was enabled.  This was implemented by having each kernel built
  via a universe_kernconf_ target that was depended on by a
  universe_kernconfs target.  However, this meant that if one did a
  build with a limited set of TARGET_ARCH values for a given TARGET,
  kernels could be built for which we hadn't built a world or toolchain.
  For example, 'make TARGETS=mips TARGET_ARCHES_mips=mips64' would build
  mips32 kernels.
  
  Fix this by adding an extra layer of indirection in the kernel make
  targets.  universe_kernconf_ is now a dependency of a new
  universe_kernconfs_.  universe_kernconfs in turn depends
  on a list of universe_kernconfs_ values, but only the
  values enabled in TARGET_ARCHES_.
  
  Reviewed by:  imp
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D23031

Modified:
  head/Makefile

Modified: head/Makefile
==
--- head/Makefile   Mon Jan  6 15:29:14 2020(r356417)
+++ head/Makefile   Mon Jan  6 17:34:17 2020(r356418)
@@ -724,7 +724,7 @@ TARGET_ARCH_${kernel}!= cd ${KERNSRCDIR}/${TARGET}/con
 .if empty(TARGET_ARCH_${kernel})
 .error "Target architecture for ${TARGET}/conf/${kernel} unknown.  config(8) 
likely too old."
 .endif
-universe_kernconfs: universe_kernconf_${TARGET}_${kernel}
+universe_kernconfs_${TARGET_ARCH_${kernel}}: 
universe_kernconf_${TARGET}_${kernel}
 universe_kernconf_${TARGET}_${kernel}: .MAKE
@echo ">> ${TARGET}.${TARGET_ARCH_${kernel}} ${kernel} kernel started 
on `LC_ALL=C date`"
@(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
@@ -737,6 +737,9 @@ universe_kernconf_${TARGET}_${kernel}: .MAKE
(echo "${TARGET} ${kernel} kernel failed," \
"check _.${TARGET}.${kernel} for details"| ${MAKEFAIL}))
@echo ">> ${TARGET}.${TARGET_ARCH_${kernel}} ${kernel} kernel completed 
on `LC_ALL=C date`"
+.endfor
+.for target_arch in ${TARGET_ARCHES_${TARGET}}
+universe_kernconfs: universe_kernconfs_${target_arch} .PHONY
 .endfor
 .endif # make(universe_kernels)
 universe: universe_epilogue
___
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"


<    1   2   3   4   5   6   7   8   9   10   >