svn commit: r351562 - head/sys/contrib/ipfilter/netinet

2019-08-27 Thread Cy Schubert
Author: cy
Date: Wed Aug 28 04:55:03 2019
New Revision: 351562
URL: https://svnweb.freebsd.org/changeset/base/351562

Log:
  Destroy the mutex in case of error.
  
  Obtained from:NetBSD ip_nat.c r1.7
  MFC after:3 days

Modified:
  head/sys/contrib/ipfilter/netinet/ip_nat.c

Modified: head/sys/contrib/ipfilter/netinet/ip_nat.c
==
--- head/sys/contrib/ipfilter/netinet/ip_nat.c  Wed Aug 28 04:54:26 2019
(r351561)
+++ head/sys/contrib/ipfilter/netinet/ip_nat.c  Wed Aug 28 04:55:03 2019
(r351562)
@@ -3078,7 +3078,7 @@ ipf_nat_newrdr(fin, nat, ni)
 /* creating a new NAT structure for a "RDR" rule (incoming NAT translation) */
 /* and (3) building that structure and putting it into the NAT table(s).*/
 /*  */
-/* NOTE: natsave should NOT be used top point back to an ipstate_t struct   */
+/* NOTE: natsave should NOT be used to point back to an ipstate_t struct*/
 /*   as it can result in memory being corrupted.*/
 /*  */
 nat_t *
@@ -3406,6 +3406,7 @@ ipf_nat_insert(softc, softn, nat)
u_int hv0, hv1;
u_int sp, dp;
ipnat_t *in;
+   int ret;
 
/*
 * Try and return an error as early as possible, so calculate the hash
@@ -3488,7 +3489,10 @@ ipf_nat_insert(softc, softn, nat)
nat->nat_mtu[1] = GETIFMTU_4(nat->nat_ifps[1]);
}
 
-   return ipf_nat_hashtab_add(softc, softn, nat);
+   ret = ipf_nat_hashtab_add(softc, softn, nat);
+   if (ret == -1)
+   MUTEX_DESTROY(&nat->nat_lock);
+   return ret;
 }
 
 
___
svn-src-all@freebsd.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: r351563 - head/sys/contrib/ipfilter/netinet

2019-08-27 Thread Cy Schubert
Author: cy
Date: Wed Aug 28 04:55:17 2019
New Revision: 351563
URL: https://svnweb.freebsd.org/changeset/base/351563

Log:
  Document ipf_nat_hashtab_add() return codes.
  
  MFC after:3 days

Modified:
  head/sys/contrib/ipfilter/netinet/ip_nat.c

Modified: head/sys/contrib/ipfilter/netinet/ip_nat.c
==
--- head/sys/contrib/ipfilter/netinet/ip_nat.c  Wed Aug 28 04:55:03 2019
(r351562)
+++ head/sys/contrib/ipfilter/netinet/ip_nat.c  Wed Aug 28 04:55:17 2019
(r351563)
@@ -3498,6 +3498,7 @@ ipf_nat_insert(softc, softn, nat)
 
 /*  */
 /* Function:ipf_nat_hashtab_add */
+/* Returns: int - 0 == sucess, -1 == failure*/
 /* Parameters:  softc(I) - pointer to soft context main structure   */
 /*  softn(I) - pointer to NAT context structure */
 /*  nat(I) - pointer to NAT structure   */
___
svn-src-all@freebsd.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: r351561 - head/sys/contrib/ipfilter/netinet

2019-08-27 Thread Cy Schubert
Author: cy
Date: Wed Aug 28 04:54:26 2019
New Revision: 351561
URL: https://svnweb.freebsd.org/changeset/base/351561

Log:
  Fixup typo in comment.
  
  Obtained from:NetBSD ip_nat.c r1.7
  MFC after:3 days

Modified:
  head/sys/contrib/ipfilter/netinet/ip_nat.c

Modified: head/sys/contrib/ipfilter/netinet/ip_nat.c
==
--- head/sys/contrib/ipfilter/netinet/ip_nat.c  Wed Aug 28 04:19:37 2019
(r351560)
+++ head/sys/contrib/ipfilter/netinet/ip_nat.c  Wed Aug 28 04:54:26 2019
(r351561)
@@ -3073,7 +3073,7 @@ ipf_nat_newrdr(fin, nat, ni)
 /* Attempts to create a new NAT entry.  Does not actually change the packet */
 /* in any way.  */
 /*  */
-/* This fucntion is in three main parts: (1) deal with creating a new NAT   */
+/* This function is in three main parts: (1) deal with creating a new NAT   */
 /* structure for a "MAP" rule (outgoing NAT translation); (2) deal with */
 /* creating a new NAT structure for a "RDR" rule (incoming NAT translation) */
 /* and (3) building that structure and putting it into the NAT table(s).*/
___
svn-src-all@freebsd.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: r351560 - in head: sys/fs/fuse tests/sys/fs/fusefs

2019-08-27 Thread Alan Somers
Author: asomers
Date: Wed Aug 28 04:19:37 2019
New Revision: 351560
URL: https://svnweb.freebsd.org/changeset/base/351560

Log:
  fusefs: Fix some bugs regarding the size of the LISTXATTR list
  
  * A small error in r338152 let to the returned size always being exactly
eight bytes too large.
  
  * The FUSE_LISTXATTR operation works like Linux's listxattr(2): if the
caller does not provide enough space, then the server should return ERANGE
rather than return a truncated list.  That's true even though in FUSE's
case the kernel doesn't provide space to the client at all; it simply
requests a maximum size for the list.  We previously weren't handling the
case where the server returns ERANGE even though the kernel requested as
much size as the server had told us it needs; that can happen due to a
race.
  
  * We also need to ensure that a pathological server that always returns
ERANGE no matter what size we request in FUSE_LISTXATTR won't cause an
infinite loop in the kernel.  As of this commit, it will instead cause an
infinite loop that exits and enters the kernel on each iteration, allowing
signals to be processed.
  
  Reviewed by:  cem
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D21287

Modified:
  head/sys/fs/fuse/fuse_vnops.c
  head/tests/sys/fs/fusefs/mockfs.cc
  head/tests/sys/fs/fusefs/xattr.cc

Modified: head/sys/fs/fuse/fuse_vnops.c
==
--- head/sys/fs/fuse/fuse_vnops.c   Wed Aug 28 01:22:21 2019
(r351559)
+++ head/sys/fs/fuse/fuse_vnops.c   Wed Aug 28 04:19:37 2019
(r351560)
@@ -2225,6 +2225,20 @@ fuse_xattrlist_convert(char *prefix, const char *list,
 }
 
 /*
+ * List extended attributes
+ *
+ * The FUSE_LISTXATTR operation is based on Linux's listxattr(2) syscall, which
+ * has a number of differences compared to its FreeBSD equivalent,
+ * extattr_list_file:
+ *
+ * - FUSE_LISTXATTR returns all extended attributes across all namespaces,
+ *   whereas listxattr(2) only returns attributes for a single namespace
+ * - FUSE_LISTXATTR prepends each attribute name with "namespace."
+ * - If the provided buffer is not large enough to hold the result,
+ *   FUSE_LISTXATTR should return ERANGE, whereas listxattr is expected to
+ *   return as many results as will fit.
+ */
+/*
 struct vop_listextattr_args {
struct vop_generic_args a_gen;
struct vnode *a_vp;
@@ -2303,14 +2317,31 @@ fuse_vnop_listextattr(struct vop_listextattr_args *ap)
 */
fdisp_refresh_vp(&fdi, FUSE_LISTXATTR, vp, td, cred);
list_xattr_in = fdi.indata;
-   list_xattr_in->size = linux_list_len + sizeof(*list_xattr_out);
+   list_xattr_in->size = linux_list_len;
 
err = fdisp_wait_answ(&fdi);
-   if (err != 0)
+   if (err == ERANGE) {
+   /* 
+* Race detected.  The attribute list must've grown since the
+* first FUSE_LISTXATTR call.  Start over.  Go all the way back
+* to userland so we can process signals, if necessary, before
+* restarting.
+*/
+   err = ERESTART;
goto out;
+   } else if (err != 0)
+   goto out;
 
linux_list = fdi.answ;
-   linux_list_len = fdi.iosize;
+   /* FUSE doesn't allow the server to return more data than requested */
+   if (fdi.iosize > linux_list_len) {
+   printf("WARNING: FUSE protocol violation.  Server returned "
+   "more extended attribute data than requested; "
+   "should've returned ERANGE instead");
+   } else {
+   /* But returning less data is fine */
+   linux_list_len = fdi.iosize;
+   }
 
/*
 * Retrieve the BSD compatible list values.

Modified: head/tests/sys/fs/fusefs/mockfs.cc
==
--- head/tests/sys/fs/fusefs/mockfs.cc  Wed Aug 28 01:22:21 2019
(r351559)
+++ head/tests/sys/fs/fusefs/mockfs.cc  Wed Aug 28 04:19:37 2019
(r351560)
@@ -204,6 +204,9 @@ void MockFS::debug_request(const mockfs_buf_in &in)
case FUSE_LINK:
printf(" oldnodeid=%" PRIu64, in.body.link.oldnodeid);
break;
+   case FUSE_LISTXATTR:
+   printf(" size=%" PRIu32, in.body.listxattr.size);
+   break;
case FUSE_LOOKUP:
printf(" %s", in.body.lookup);
break;

Modified: head/tests/sys/fs/fusefs/xattr.cc
==
--- head/tests/sys/fs/fusefs/xattr.cc   Wed Aug 28 01:22:21 2019
(r351559)
+++ head/tests/sys/fs/fusefs/xattr.cc   Wed Aug 28 04:19:37 2019 

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

2019-08-27 Thread Mateusz Guzik
Author: mjg
Date: Wed Aug 28 01:22:21 2019
New Revision: 351559
URL: https://svnweb.freebsd.org/changeset/base/351559

Log:
  proc: remove zpfind
  
  It is not used by anything. If someone wants it back it should be 
reimplemented
  to use the proc hash.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/kern_proc.c
  head/sys/sys/proc.h

Modified: head/sys/kern/kern_proc.c
==
--- head/sys/kern/kern_proc.c   Tue Aug 27 22:21:18 2019(r351558)
+++ head/sys/kern/kern_proc.c   Wed Aug 28 01:22:21 2019(r351559)
@@ -1294,25 +1294,6 @@ pstats_free(struct pstats *ps)
free(ps, M_SUBPROC);
 }
 
-/*
- * Locate a zombie process by number
- */
-struct proc *
-zpfind(pid_t pid)
-{
-   struct proc *p;
-
-   sx_slock(&zombproc_lock);
-   LIST_FOREACH(p, &zombproc, p_list) {
-   if (p->p_pid == pid) {
-   PROC_LOCK(p);
-   break;
-   }
-   }
-   sx_sunlock(&zombproc_lock);
-   return (p);
-}
-
 #ifdef COMPAT_FREEBSD32
 
 /*

Modified: head/sys/sys/proc.h
==
--- head/sys/sys/proc.h Tue Aug 27 22:21:18 2019(r351558)
+++ head/sys/sys/proc.h Wed Aug 28 01:22:21 2019(r351559)
@@ -994,7 +994,6 @@ struct  proc *pfind(pid_t); /* Find process 
by id. */
 struct proc *pfind_any(pid_t); /* Find (zombie) process by id. */
 struct proc *pfind_any_locked(pid_t pid); /* Find process by id, locked. */
 struct pgrp *pgfind(pid_t);/* Find process group by id. */
-struct proc *zpfind(pid_t);/* Find zombie process by id. */
 void   pidhash_slockall(void); /* Shared lock all pid hash lists. */
 void   pidhash_sunlockall(void);   /* Shared unlock all pid hash lists. */
 
___
svn-src-all@freebsd.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: r351522 - in head: sbin/ifconfig share/man/man4 sys/conf sys/kern sys/modules sys/modules/ktls_ocf sys/net sys/netinet sys/netinet/tcp_stacks sys/netinet6 sys/opencrypto sys/sys tools/

2019-08-27 Thread John Baldwin
On 8/27/19 12:16 PM, John Baldwin wrote:
> On 8/27/19 10:05 AM, Peter Holm wrote:
>> On Tue, Aug 27, 2019 at 09:02:31AM -0700, John Baldwin wrote:
>>> On 8/27/19 7:39 AM, Peter Holm wrote:
>>>> On Tue, Aug 27, 2019 at 12:01:57AM +, John Baldwin wrote:
>>>>> Author: jhb
>>>>> Date: Tue Aug 27 00:01:56 2019
>>>>> New Revision: 351522
>>>>> URL: https://svnweb.freebsd.org/changeset/base/351522
>>>>>
>>>>> Log:
>>>>>   Add kernel-side support for in-kernel TLS.
>>>>>   
>>>>
>>>> Could this be yours?
>>>>
>>>> 20190827 15:55:34 all (496/668): sendfile12.sh
>>>> Aug 27 15:56:16 mercat1 kernel: pid 50036 (swap), jid 0, uid 0, was 
>>>> killed: out of swap space
>>>> panic: non-ext_pgs mbuf with TLS session
>>>
>>> Possibly, though if sfio was freed and marked with 0xdeadc0de junk, then it
>>> would trip over this assertion for any use-after-free.  I see in gdb that 
>>> you
>>> couldn't see sfio because of clang's poor debug info.  It would be really 
>>> good
>>> to try to find the contents of sfio to debug this further.
>>>
>>> You should be able to find it via 'bp->b_caller1' in frame 14:
>>>
>>> 'p *(struct sf_io *)bp->b_caller1'
>>>
>>
>> Here's a repeat where the involved files are compiled with "-O0":
>> https://people.freebsd.org/~pho/stress/log/jhb009.txt
> 
> Ok, it looks like sfio->tls is just not being initialized to NULL in the
> !KERN_TLS case and the malloc junk is leaking through (my fault):
> 
> (kgdb) p *(struct sf_io *)bp->b_caller1
> $5 = {nios = 0x0, error = 0x0, npages = 0x1, so = 0xf808898d, m = 
> 0xf808a3512200, tls = 0xdeadc0dedeadc0de, pa = 0xf804e6cdfc68}
> 
> Initially I thought about using M_ZERO, but we can just axe the 'tls'
> member of 'sfio' entirely in the !KERN_TLS case since it's a private
> structure.
> 
> Try this (untested) change):

I was able to verify this via Alan's test and have committed 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: r351558 - head/sys/kern

2019-08-27 Thread John Baldwin
Author: jhb
Date: Tue Aug 27 22:21:18 2019
New Revision: 351558
URL: https://svnweb.freebsd.org/changeset/base/351558

Log:
  Only define the 'tls' member of sfio in KERN_TLS is defined.
  
  This field was not initialized in the !KERN_TLS case triggering an
  assertion failure when using sendfile(2).
  
  Reported by:  pho, asomers
  Sponsored by: Netflix

Modified:
  head/sys/kern/kern_sendfile.c

Modified: head/sys/kern/kern_sendfile.c
==
--- head/sys/kern/kern_sendfile.c   Tue Aug 27 21:29:37 2019
(r351557)
+++ head/sys/kern/kern_sendfile.c   Tue Aug 27 22:21:18 2019
(r351558)
@@ -88,7 +88,9 @@ struct sf_io {
int npages;
struct socket   *so;
struct mbuf *m;
+#ifdef KERN_TLS
struct ktls_session *tls;
+#endif
vm_page_t   pa[];
 };
 
@@ -266,7 +268,7 @@ sendfile_iodone(void *arg, vm_page_t *pg, int count, i
if (!refcount_release(&sfio->nios))
return;
 
-#ifdef INVARIANTS
+#if defined(KERN_TLS) && defined(INVARIANTS)
if ((sfio->m->m_flags & M_EXT) != 0 &&
sfio->m->m_ext.ext_type == EXT_PGS)
KASSERT(sfio->tls == sfio->m->m_ext.ext_pgs->tls,
___
svn-src-all@freebsd.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: r351557 - head/sys/opencrypto

2019-08-27 Thread John Baldwin
Author: jhb
Date: Tue Aug 27 21:29:37 2019
New Revision: 351557
URL: https://svnweb.freebsd.org/changeset/base/351557

Log:
  Adjust the deprecated warnings for /dev/crypto to be less noisy.
  
  Warn when actual operations are performed instead of when sessions are
  created.  The /dev/crypto engine in OpenSSL 1.0.x tries to create
  sessions for all possible algorithms each time it is initialized
  resulting in spurious warnings.
  
  Reported by:  Mike Tancsa
  MFC after:3 days
  Sponsored by: Chelsio Communications

Modified:
  head/sys/opencrypto/cryptodev.c

Modified: head/sys/opencrypto/cryptodev.c
==
--- head/sys/opencrypto/cryptodev.c Tue Aug 27 20:51:17 2019
(r351556)
+++ head/sys/opencrypto/cryptodev.c Tue Aug 27 21:29:37 2019
(r351557)
@@ -391,8 +391,6 @@ cryptof_ioctl(
struct crypt_op copc;
struct crypt_kop kopc;
 #endif
-   static struct timeval arc4warn, blfwarn, castwarn, deswarn, md5warn;
-   static struct timeval skipwarn, tdeswarn;
 
switch (cmd) {
case CIOCGSESSION:
@@ -413,28 +411,18 @@ cryptof_ioctl(
case 0:
break;
case CRYPTO_DES_CBC:
-   if (ratecheck(&deswarn, &warninterval))
-   gone_in(13, "DES cipher via /dev/crypto");
txform = &enc_xform_des;
break;
case CRYPTO_3DES_CBC:
-   if (ratecheck(&tdeswarn, &warninterval))
-   gone_in(13, "3DES cipher via /dev/crypto");
txform = &enc_xform_3des;
break;
case CRYPTO_BLF_CBC:
-   if (ratecheck(&blfwarn, &warninterval))
-   gone_in(13, "Blowfish cipher via /dev/crypto");
txform = &enc_xform_blf;
break;
case CRYPTO_CAST_CBC:
-   if (ratecheck(&castwarn, &warninterval))
-   gone_in(13, "CAST128 cipher via /dev/crypto");
txform = &enc_xform_cast5;
break;
case CRYPTO_SKIPJACK_CBC:
-   if (ratecheck(&skipwarn, &warninterval))
-   gone_in(13, "Skipjack cipher via /dev/crypto");
txform = &enc_xform_skipjack;
break;
case CRYPTO_AES_CBC:
@@ -447,8 +435,6 @@ cryptof_ioctl(
txform = &enc_xform_null;
break;
case CRYPTO_ARC4:
-   if (ratecheck(&arc4warn, &warninterval))
-   gone_in(13, "ARC4 cipher via /dev/crypto");
txform = &enc_xform_arc4;
break;
case CRYPTO_CAMELLIA_CBC:
@@ -477,9 +463,6 @@ cryptof_ioctl(
case 0:
break;
case CRYPTO_MD5_HMAC:
-   if (ratecheck(&md5warn, &warninterval))
-   gone_in(13,
-   "MD5-HMAC authenticator via /dev/crypto");
thash = &auth_hash_hmac_md5;
break;
case CRYPTO_POLY1305:
@@ -815,6 +798,47 @@ cod_free(struct cryptop_data *cod)
free(cod, M_XDATA);
 }
 
+static void
+cryptodev_warn(struct csession *cse)
+{
+   static struct timeval arc4warn, blfwarn, castwarn, deswarn, md5warn;
+   static struct timeval skipwarn, tdeswarn;
+
+   switch (cse->cipher) {
+   case CRYPTO_DES_CBC:
+   if (ratecheck(&deswarn, &warninterval))
+   gone_in(13, "DES cipher via /dev/crypto");
+   break;
+   case CRYPTO_3DES_CBC:
+   if (ratecheck(&tdeswarn, &warninterval))
+   gone_in(13, "3DES cipher via /dev/crypto");
+   break;
+   case CRYPTO_BLF_CBC:
+   if (ratecheck(&blfwarn, &warninterval))
+   gone_in(13, "Blowfish cipher via /dev/crypto");
+   break;
+   case CRYPTO_CAST_CBC:
+   if (ratecheck(&castwarn, &warninterval))
+   gone_in(13, "CAST128 cipher via /dev/crypto");
+   break;
+   case CRYPTO_SKIPJACK_CBC:
+   if (ratecheck(&skipwarn, &warninterval))
+   gone_in(13, "Skipjack cipher via /dev/crypto");
+   break;
+   case CRYPTO_ARC4:
+   if (ratecheck(&arc4warn, &warninterval))
+   gone_in(13, "ARC4 cipher via /dev/crypto");
+   break;
+   }
+
+   switch (cse->mac) {
+   case CRYPTO_MD5_HMAC:
+   if (ratecheck(&md5warn, &warninterval))
+   gone_in(13, "MD5-HMAC authenticato

Re: svn commit: r351550 - head/sys/cam/scsi

2019-08-27 Thread Scott Long
Excellent work, thank you!

Scott


> On Aug 27, 2019, at 2:57 PM, Alexander Motin  wrote:
> 
> Some FreeNAS user reported panic after updating to newer version.  On
> the screenshot provided were several BUSY statuses for SATA disk on
> mps(4), followed by panic "Attempt to remove out-of-bounds index -1 from
> queue ...".  In his case I blame ancient LSI firmware or some broken
> hardware, but I was able to reproduce the panic on FreeBSD head debug
> kernel by hacking mps(4) driver to always report BUSY (appeared except
> IDENTIFY and REPORT LUNS).  To diagnose it I inserted assertion into
> xpt_free_ccb(), checking ccb->ccb_h.pinfo.index for values used for
> requests still in send queue.  Not sure it is to be persistent, but in
> this case it lead me directly to this place.
> 
> On 27.08.2019 16:23, Scott Long wrote:
>> This is very concerning, and I wonder if it’s the cause of the mystery 
>> use-after-free / double-complete that I’ve seen for years and have never 
>> been able to catch.  Can you say more about how you found it?
>> 
>> Scott
>> 
>> 
>>> On Aug 27, 2019, at 10:41 AM, Alexander Motin  wrote:
>>> 
>>> Author: mav
>>> Date: Tue Aug 27 16:41:06 2019
>>> New Revision: 351550
>>> URL: https://svnweb.freebsd.org/changeset/base/351550
>>> 
>>> Log:
>>> Always check cam_periph_error() status for ERESTART.
>>> 
>>> Even if we do not expect retries, we better be sure, since otherwise it
>>> may result in use after free kernel panic.  I've noticed that it retries
>>> SCSI_STATUS_BUSY even with SF_NO_RECOVERY | SF_NO_RETRY.
>>> 
>>> MFC after:  1 week
>>> Sponsored by:   iXsystems, Inc.
>>> 
>>> Modified:
>>> head/sys/cam/scsi/scsi_xpt.c
>>> 
>>> Modified: head/sys/cam/scsi/scsi_xpt.c
>>> ==
>>> --- head/sys/cam/scsi/scsi_xpt.cTue Aug 27 15:42:08 2019
>>> (r351549)
>>> +++ head/sys/cam/scsi/scsi_xpt.cTue Aug 27 16:41:06 2019
>>> (r351550)
>>> @@ -1684,8 +1684,9 @@ probe_device_check:
>>> case PROBE_TUR_FOR_NEGOTIATION:
>>> case PROBE_DV_EXIT:
>>> if (cam_ccb_status(done_ccb) != CAM_REQ_CMP) {
>>> -   cam_periph_error(done_ccb, 0,
>>> -   SF_NO_PRINT | SF_NO_RECOVERY | SF_NO_RETRY);
>>> +   if (cam_periph_error(done_ccb, 0, SF_NO_PRINT |
>>> +   SF_NO_RECOVERY | SF_NO_RETRY) == ERESTART)
>>> +   goto outr;
>>> }
>>> if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) {
>>> /* Don't wedge the queue */
>>> @@ -1735,8 +1736,9 @@ probe_device_check:
>>> struct ccb_scsiio *csio;
>>> 
>>> if (cam_ccb_status(done_ccb) != CAM_REQ_CMP) {
>>> -   cam_periph_error(done_ccb, 0,
>>> -   SF_NO_PRINT | SF_NO_RECOVERY | SF_NO_RETRY);
>>> +   if (cam_periph_error(done_ccb, 0, SF_NO_PRINT |
>>> +   SF_NO_RECOVERY | SF_NO_RETRY) == ERESTART)
>>> +   goto outr;
>>> }
>>> if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) {
>>> /* Don't wedge the queue */
>>> 
>> 
> 
> -- 
> Alexander Motin
> 

___
svn-src-all@freebsd.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: r351187 - head/sys/arm64/rockchip

2019-08-27 Thread Peter Jeremy
On 2019-Aug-27 11:56:38 +0200, Michal Meloun  wrote:
>
>
>On 25.08.2019 9:28, Peter Jeremy wrote:
>> On 2019-Aug-18 09:19:33 +, Michal Meloun 
>> wrote:
>>> Improve rk_pinctrl driver:
>> 
>> Sorry for the late notice but this breaks my Rock64 (RK3328).
>> 
>Sorry for late response.
>Seems like this is caused by unnoticed dependency between patches in
>my worktree, sorry for this. I hope that r351543 solves it.
>Can you, please, try r351543 on Rock64 because I haven't any rk3328
>based board for real test?

r351543 + r351551 fixes it for me.  Thanks for that.

-- 
Peter Jeremy


signature.asc
Description: PGP signature


Re: svn commit: r351550 - head/sys/cam/scsi

2019-08-27 Thread Alexander Motin
Some FreeNAS user reported panic after updating to newer version.  On
the screenshot provided were several BUSY statuses for SATA disk on
mps(4), followed by panic "Attempt to remove out-of-bounds index -1 from
queue ...".  In his case I blame ancient LSI firmware or some broken
hardware, but I was able to reproduce the panic on FreeBSD head debug
kernel by hacking mps(4) driver to always report BUSY (appeared except
IDENTIFY and REPORT LUNS).  To diagnose it I inserted assertion into
xpt_free_ccb(), checking ccb->ccb_h.pinfo.index for values used for
requests still in send queue.  Not sure it is to be persistent, but in
this case it lead me directly to this place.

On 27.08.2019 16:23, Scott Long wrote:
> This is very concerning, and I wonder if it’s the cause of the mystery 
> use-after-free / double-complete that I’ve seen for years and have never been 
> able to catch.  Can you say more about how you found it?
> 
> Scott
> 
> 
>> On Aug 27, 2019, at 10:41 AM, Alexander Motin  wrote:
>>
>> Author: mav
>> Date: Tue Aug 27 16:41:06 2019
>> New Revision: 351550
>> URL: https://svnweb.freebsd.org/changeset/base/351550
>>
>> Log:
>>  Always check cam_periph_error() status for ERESTART.
>>
>>  Even if we do not expect retries, we better be sure, since otherwise it
>>  may result in use after free kernel panic.  I've noticed that it retries
>>  SCSI_STATUS_BUSY even with SF_NO_RECOVERY | SF_NO_RETRY.
>>
>>  MFC after:  1 week
>>  Sponsored by:   iXsystems, Inc.
>>
>> Modified:
>>  head/sys/cam/scsi/scsi_xpt.c
>>
>> Modified: head/sys/cam/scsi/scsi_xpt.c
>> ==
>> --- head/sys/cam/scsi/scsi_xpt.c Tue Aug 27 15:42:08 2019
>> (r351549)
>> +++ head/sys/cam/scsi/scsi_xpt.c Tue Aug 27 16:41:06 2019
>> (r351550)
>> @@ -1684,8 +1684,9 @@ probe_device_check:
>>  case PROBE_TUR_FOR_NEGOTIATION:
>>  case PROBE_DV_EXIT:
>>  if (cam_ccb_status(done_ccb) != CAM_REQ_CMP) {
>> -cam_periph_error(done_ccb, 0,
>> -SF_NO_PRINT | SF_NO_RECOVERY | SF_NO_RETRY);
>> +if (cam_periph_error(done_ccb, 0, SF_NO_PRINT |
>> +SF_NO_RECOVERY | SF_NO_RETRY) == ERESTART)
>> +goto outr;
>>  }
>>  if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) {
>>  /* Don't wedge the queue */
>> @@ -1735,8 +1736,9 @@ probe_device_check:
>>  struct ccb_scsiio *csio;
>>
>>  if (cam_ccb_status(done_ccb) != CAM_REQ_CMP) {
>> -cam_periph_error(done_ccb, 0,
>> -SF_NO_PRINT | SF_NO_RECOVERY | SF_NO_RETRY);
>> +if (cam_periph_error(done_ccb, 0, SF_NO_PRINT |
>> +SF_NO_RECOVERY | SF_NO_RETRY) == ERESTART)
>> +goto outr;
>>  }
>>  if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) {
>>  /* Don't wedge the queue */
>>
> 

-- 
Alexander Motin
___
svn-src-all@freebsd.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: r351555 - head/sys/kern

2019-08-27 Thread Mateusz Guzik
On 8/27/19, Mateusz Guzik  wrote:
> Author: mjg
> Date: Tue Aug 27 20:30:56 2019
> New Revision: 351555
> URL: https://svnweb.freebsd.org/changeset/base/351555
>
> Log:
>   vfs: stop passing LK_INTERLOCK to VOP_UNLOCK
>
>   The plan is to drop the flags argument. There is also a temporary bug
>   now that nullfs ignores the flag.
>
>   Reviewed by:kib
>   Sponsored by:   The FreeBSD Foundation
>   Differential Revision:  https://reviews.freebsd.org/D21252
>

Ops. That's of course https://reviews.freebsd.org/D21426

> Modified:
>   head/sys/kern/vfs_subr.c
>
> Modified: head/sys/kern/vfs_subr.c
> ==
> --- head/sys/kern/vfs_subr.c  Tue Aug 27 20:11:45 2019(r351554)
> +++ head/sys/kern/vfs_subr.c  Tue Aug 27 20:30:56 2019(r351555)
> @@ -1034,8 +1034,8 @@ vlrureclaim(struct mount *mp, bool reclaim_nc_src,
> int
>   (vp->v_iflag & VI_FREE) != 0 ||
>   (vp->v_object != NULL &&
>   vp->v_object->resident_page_count > trigger)) {
> - VOP_UNLOCK(vp, LK_INTERLOCK);
> - vdrop(vp);
> + VOP_UNLOCK(vp, 0);
> + vdropl(vp);
>   goto next_iter_mntunlocked;
>   }
>   KASSERT((vp->v_iflag & VI_DOOMED) == 0,
> @@ -1398,7 +1398,8 @@ vtryrecycle(struct vnode *vp)
>*/
>   VI_LOCK(vp);
>   if (vp->v_usecount) {
> - VOP_UNLOCK(vp, LK_INTERLOCK);
> + VOP_UNLOCK(vp, 0);
> + VI_UNLOCK(vp);
>   vn_finished_write(vnmp);
>   CTR2(KTR_VFS,
>   "%s: impossible to recycle, %p is already referenced",
> @@ -1409,7 +1410,8 @@ vtryrecycle(struct vnode *vp)
>   counter_u64_add(recycles_count, 1);
>   vgonel(vp);
>   }
> - VOP_UNLOCK(vp, LK_INTERLOCK);
> + VOP_UNLOCK(vp, 0);
> + VI_UNLOCK(vp);
>   vn_finished_write(vnmp);
>   return (0);
>  }
> ___
> svn-src-all@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/svn-src-all
> To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
>


-- 
Mateusz Guzik 
___
svn-src-all@freebsd.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: r351556 - head/sys/fs/unionfs

2019-08-27 Thread Mateusz Guzik
Author: mjg
Date: Tue Aug 27 20:51:17 2019
New Revision: 351556
URL: https://svnweb.freebsd.org/changeset/base/351556

Log:
  unionfs: stop passing LK_INTERLOCK to VOP_UNLOCK
  
  This is part of the preparation to remove flags argument from VOP_UNLOCK.
  Also has a side effect of fixing stacking on top of nullfs broken by r351472.
  
  Reported by:  cy
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/fs/unionfs/union_vnops.c

Modified: head/sys/fs/unionfs/union_vnops.c
==
--- head/sys/fs/unionfs/union_vnops.c   Tue Aug 27 20:30:56 2019
(r351555)
+++ head/sys/fs/unionfs/union_vnops.c   Tue Aug 27 20:51:17 2019
(r351556)
@@ -1882,12 +1882,9 @@ unionfs_lock(struct vop_lock1_args *ap)
if (lvp != NULLVP) {
if (uvp != NULLVP && flags & LK_UPGRADE) {
/* Share Lock is once released and a deadlock is 
avoided.  */
-   VI_LOCK_FLAGS(uvp, MTX_DUPOK);
-   vholdl(uvp);
+   vholdnz(uvp);
uhold = 1;
-   VI_UNLOCK(vp);
-   VOP_UNLOCK(uvp, LK_RELEASE | LK_INTERLOCK);
-   VI_LOCK(vp);
+   VOP_UNLOCK(uvp, LK_RELEASE);
unp = VTOUNIONFS(vp);
if (unp == NULL) {
/* vnode is released. */
@@ -1978,7 +1975,6 @@ unionfs_unlock(struct vop_unlock_args *ap)
 {
int error;
int flags;
-   int mtxlkflag;
int uhold;
struct vnode   *vp;
struct vnode   *lvp;
@@ -1988,18 +1984,10 @@ unionfs_unlock(struct vop_unlock_args *ap)
KASSERT_UNIONFS_VNODE(ap->a_vp);
 
error = 0;
-   mtxlkflag = 0;
uhold = 0;
flags = ap->a_flags | LK_RELEASE;
vp = ap->a_vp;
 
-   if ((flags & LK_INTERLOCK) != 0)
-   mtxlkflag = 1;
-   else if (mtx_owned(VI_MTX(vp)) == 0) {
-   VI_LOCK(vp);
-   mtxlkflag = 2;
-   }
-
unp = VTOUNIONFS(vp);
if (unp == NULL)
goto unionfs_unlock_null_vnode;
@@ -2007,45 +1995,24 @@ unionfs_unlock(struct vop_unlock_args *ap)
uvp = unp->un_uppervp;
 
if (lvp != NULLVP) {
-   VI_LOCK_FLAGS(lvp, MTX_DUPOK);
-   flags |= LK_INTERLOCK;
-   vholdl(lvp);
-
-   VI_UNLOCK(vp);
-   ap->a_flags &= ~LK_INTERLOCK;
-
+   vholdnz(lvp);
error = VOP_UNLOCK(lvp, flags);
-
-   VI_LOCK(vp);
}
 
if (error == 0 && uvp != NULLVP) {
-   VI_LOCK_FLAGS(uvp, MTX_DUPOK);
-   flags |= LK_INTERLOCK;
-   vholdl(uvp);
+   vholdnz(uvp);
uhold = 1;
-
-   VI_UNLOCK(vp);
-   ap->a_flags &= ~LK_INTERLOCK;
-
error = VOP_UNLOCK(uvp, flags);
-
-   VI_LOCK(vp);
}
 
-   VI_UNLOCK(vp);
if (lvp != NULLVP)
vdrop(lvp);
if (uhold != 0)
vdrop(uvp);
-   if (mtxlkflag == 0)
-   VI_LOCK(vp);
 
return error;
 
 unionfs_unlock_null_vnode:
-   if (mtxlkflag == 2)
-   VI_UNLOCK(vp);
return (vop_stdunlock(ap));
 }
 
___
svn-src-all@freebsd.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: r351555 - head/sys/kern

2019-08-27 Thread Mateusz Guzik
Author: mjg
Date: Tue Aug 27 20:30:56 2019
New Revision: 351555
URL: https://svnweb.freebsd.org/changeset/base/351555

Log:
  vfs: stop passing LK_INTERLOCK to VOP_UNLOCK
  
  The plan is to drop the flags argument. There is also a temporary bug
  now that nullfs ignores the flag.
  
  Reviewed by:  kib
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D21252

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cTue Aug 27 20:11:45 2019(r351554)
+++ head/sys/kern/vfs_subr.cTue Aug 27 20:30:56 2019(r351555)
@@ -1034,8 +1034,8 @@ vlrureclaim(struct mount *mp, bool reclaim_nc_src, int
(vp->v_iflag & VI_FREE) != 0 ||
(vp->v_object != NULL &&
vp->v_object->resident_page_count > trigger)) {
-   VOP_UNLOCK(vp, LK_INTERLOCK);
-   vdrop(vp);
+   VOP_UNLOCK(vp, 0);
+   vdropl(vp);
goto next_iter_mntunlocked;
}
KASSERT((vp->v_iflag & VI_DOOMED) == 0,
@@ -1398,7 +1398,8 @@ vtryrecycle(struct vnode *vp)
 */
VI_LOCK(vp);
if (vp->v_usecount) {
-   VOP_UNLOCK(vp, LK_INTERLOCK);
+   VOP_UNLOCK(vp, 0);
+   VI_UNLOCK(vp);
vn_finished_write(vnmp);
CTR2(KTR_VFS,
"%s: impossible to recycle, %p is already referenced",
@@ -1409,7 +1410,8 @@ vtryrecycle(struct vnode *vp)
counter_u64_add(recycles_count, 1);
vgonel(vp);
}
-   VOP_UNLOCK(vp, LK_INTERLOCK);
+   VOP_UNLOCK(vp, 0);
+   VI_UNLOCK(vp);
vn_finished_write(vnmp);
return (0);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r351550 - head/sys/cam/scsi

2019-08-27 Thread Scott Long
This is very concerning, and I wonder if it’s the cause of the mystery 
use-after-free / double-complete that I’ve seen for years and have never been 
able to catch.  Can you say more about how you found it?

Scott


> On Aug 27, 2019, at 10:41 AM, Alexander Motin  wrote:
> 
> Author: mav
> Date: Tue Aug 27 16:41:06 2019
> New Revision: 351550
> URL: https://svnweb.freebsd.org/changeset/base/351550
> 
> Log:
>  Always check cam_periph_error() status for ERESTART.
> 
>  Even if we do not expect retries, we better be sure, since otherwise it
>  may result in use after free kernel panic.  I've noticed that it retries
>  SCSI_STATUS_BUSY even with SF_NO_RECOVERY | SF_NO_RETRY.
> 
>  MFC after:   1 week
>  Sponsored by:iXsystems, Inc.
> 
> Modified:
>  head/sys/cam/scsi/scsi_xpt.c
> 
> Modified: head/sys/cam/scsi/scsi_xpt.c
> ==
> --- head/sys/cam/scsi/scsi_xpt.c  Tue Aug 27 15:42:08 2019
> (r351549)
> +++ head/sys/cam/scsi/scsi_xpt.c  Tue Aug 27 16:41:06 2019
> (r351550)
> @@ -1684,8 +1684,9 @@ probe_device_check:
>   case PROBE_TUR_FOR_NEGOTIATION:
>   case PROBE_DV_EXIT:
>   if (cam_ccb_status(done_ccb) != CAM_REQ_CMP) {
> - cam_periph_error(done_ccb, 0,
> - SF_NO_PRINT | SF_NO_RECOVERY | SF_NO_RETRY);
> + if (cam_periph_error(done_ccb, 0, SF_NO_PRINT |
> + SF_NO_RECOVERY | SF_NO_RETRY) == ERESTART)
> + goto outr;
>   }
>   if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) {
>   /* Don't wedge the queue */
> @@ -1735,8 +1736,9 @@ probe_device_check:
>   struct ccb_scsiio *csio;
> 
>   if (cam_ccb_status(done_ccb) != CAM_REQ_CMP) {
> - cam_periph_error(done_ccb, 0,
> - SF_NO_PRINT | SF_NO_RECOVERY | SF_NO_RETRY);
> + if (cam_periph_error(done_ccb, 0, SF_NO_PRINT |
> + SF_NO_RECOVERY | SF_NO_RETRY) == ERESTART)
> + goto outr;
>   }
>   if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) {
>   /* Don't wedge the queue */
> 

___
svn-src-all@freebsd.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: r351554 - head/contrib/sendmail/src

2019-08-27 Thread Hiroki Sato
Author: hrs
Date: Tue Aug 27 20:11:45 2019
New Revision: 351554
URL: https://svnweb.freebsd.org/changeset/base/351554

Log:
  MFV r351553:
  
  Fix a problem which prevented -OServerSSLOptions or -OClientSSLOptions
  specified in the command-line option from working.
  
  This patch has been accepted by the upstream.
  
  Reviewed by and discussed with:   gshapiro

Modified:
  head/contrib/sendmail/src/conf.c
  head/contrib/sendmail/src/readcf.c
Directory Properties:
  head/contrib/sendmail/   (props changed)

Modified: head/contrib/sendmail/src/conf.c
==
--- head/contrib/sendmail/src/conf.cTue Aug 27 19:37:19 2019
(r351553)
+++ head/contrib/sendmail/src/conf.cTue Aug 27 20:11:45 2019
(r351554)
@@ -365,6 +365,20 @@ setdefaults(e)
TLS_Srv_Opts = TLS_I_SRV;
if (NULL == EVP_digest)
EVP_digest = EVP_md5();
+   Srv_SSL_Options = SSL_OP_ALL;
+   Clt_SSL_Options = SSL_OP_ALL
+# ifdef SSL_OP_NO_SSLv2
+   | SSL_OP_NO_SSLv2
+# endif
+# ifdef SSL_OP_NO_TICKET
+   | SSL_OP_NO_TICKET
+# endif
+   ;
+# ifdef SSL_OP_TLSEXT_PADDING
+   /* SSL_OP_TLSEXT_PADDING breaks compatibility with some sites */
+   Srv_SSL_Options &= ~SSL_OP_TLSEXT_PADDING;
+   Clt_SSL_Options &= ~SSL_OP_TLSEXT_PADDING;
+# endif /* SSL_OP_TLSEXT_PADDING */
 #endif /* STARTTLS */
 #ifdef HESIOD_INIT
HesiodContext = NULL;

Modified: head/contrib/sendmail/src/readcf.c
==
--- head/contrib/sendmail/src/readcf.c  Tue Aug 27 19:37:19 2019
(r351553)
+++ head/contrib/sendmail/src/readcf.c  Tue Aug 27 20:11:45 2019
(r351554)
@@ -159,22 +159,6 @@ readcf(cfname, safe, e)
FileName = cfname;
LineNumber = 0;
 
-#if STARTTLS
-   Srv_SSL_Options = SSL_OP_ALL;
-   Clt_SSL_Options = SSL_OP_ALL
-# ifdef SSL_OP_NO_SSLv2
-   | SSL_OP_NO_SSLv2
-# endif
-# ifdef SSL_OP_NO_TICKET
-   | SSL_OP_NO_TICKET
-# endif
-   ;
-# ifdef SSL_OP_TLSEXT_PADDING
-   /* SSL_OP_TLSEXT_PADDING breaks compatibility with some sites */
-   Srv_SSL_Options &= ~SSL_OP_TLSEXT_PADDING;
-   Clt_SSL_Options &= ~SSL_OP_TLSEXT_PADDING;
-# endif /* SSL_OP_TLSEXT_PADDING */
-#endif /* STARTTLS */
if (DontLockReadFiles)
sff |= SFF_NOLOCK;
cf = safefopen(cfname, O_RDONLY, 0444, sff);
___
svn-src-all@freebsd.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: r351553 - vendor/sendmail/dist/src

2019-08-27 Thread Hiroki Sato
Author: hrs
Date: Tue Aug 27 19:37:19 2019
New Revision: 351553
URL: https://svnweb.freebsd.org/changeset/base/351553

Log:
  Fix a problem which prevented -OServerSSLOptions or -OClientSSLOptions
  specified in the command-line option from working.
  
  This patch has been accepted by the upstream.
  
  Reviewed by and discussed with:   gshapiro

Modified:
  vendor/sendmail/dist/src/conf.c
  vendor/sendmail/dist/src/readcf.c

Modified: vendor/sendmail/dist/src/conf.c
==
--- vendor/sendmail/dist/src/conf.c Tue Aug 27 18:00:01 2019
(r351552)
+++ vendor/sendmail/dist/src/conf.c Tue Aug 27 19:37:19 2019
(r351553)
@@ -365,6 +365,20 @@ setdefaults(e)
TLS_Srv_Opts = TLS_I_SRV;
if (NULL == EVP_digest)
EVP_digest = EVP_md5();
+   Srv_SSL_Options = SSL_OP_ALL;
+   Clt_SSL_Options = SSL_OP_ALL
+# ifdef SSL_OP_NO_SSLv2
+   | SSL_OP_NO_SSLv2
+# endif
+# ifdef SSL_OP_NO_TICKET
+   | SSL_OP_NO_TICKET
+# endif
+   ;
+# ifdef SSL_OP_TLSEXT_PADDING
+   /* SSL_OP_TLSEXT_PADDING breaks compatibility with some sites */
+   Srv_SSL_Options &= ~SSL_OP_TLSEXT_PADDING;
+   Clt_SSL_Options &= ~SSL_OP_TLSEXT_PADDING;
+# endif /* SSL_OP_TLSEXT_PADDING */
 #endif /* STARTTLS */
 #ifdef HESIOD_INIT
HesiodContext = NULL;

Modified: vendor/sendmail/dist/src/readcf.c
==
--- vendor/sendmail/dist/src/readcf.c   Tue Aug 27 18:00:01 2019
(r351552)
+++ vendor/sendmail/dist/src/readcf.c   Tue Aug 27 19:37:19 2019
(r351553)
@@ -159,22 +159,6 @@ readcf(cfname, safe, e)
FileName = cfname;
LineNumber = 0;
 
-#if STARTTLS
-   Srv_SSL_Options = SSL_OP_ALL;
-   Clt_SSL_Options = SSL_OP_ALL
-# ifdef SSL_OP_NO_SSLv2
-   | SSL_OP_NO_SSLv2
-# endif
-# ifdef SSL_OP_NO_TICKET
-   | SSL_OP_NO_TICKET
-# endif
-   ;
-# ifdef SSL_OP_TLSEXT_PADDING
-   /* SSL_OP_TLSEXT_PADDING breaks compatibility with some sites */
-   Srv_SSL_Options &= ~SSL_OP_TLSEXT_PADDING;
-   Clt_SSL_Options &= ~SSL_OP_TLSEXT_PADDING;
-# endif /* SSL_OP_TLSEXT_PADDING */
-#endif /* STARTTLS */
if (DontLockReadFiles)
sff |= SFF_NOLOCK;
cf = safefopen(cfname, O_RDONLY, 0444, sff);
___
svn-src-all@freebsd.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: r351522 - in head: sbin/ifconfig share/man/man4 sys/conf sys/kern sys/modules sys/modules/ktls_ocf sys/net sys/netinet sys/netinet/tcp_stacks sys/netinet6 sys/opencrypto sys/sys tools/

2019-08-27 Thread John Baldwin
On 8/27/19 10:05 AM, Peter Holm wrote:
> On Tue, Aug 27, 2019 at 09:02:31AM -0700, John Baldwin wrote:
>> On 8/27/19 7:39 AM, Peter Holm wrote:
>>> On Tue, Aug 27, 2019 at 12:01:57AM +, John Baldwin wrote:
>>>> Author: jhb
>>>> Date: Tue Aug 27 00:01:56 2019
>>>> New Revision: 351522
>>>> URL: https://svnweb.freebsd.org/changeset/base/351522
>>>>
>>>> Log:
>>>>   Add kernel-side support for in-kernel TLS.
>>>>   
>>>
>>> Could this be yours?
>>>
>>> 20190827 15:55:34 all (496/668): sendfile12.sh
>>> Aug 27 15:56:16 mercat1 kernel: pid 50036 (swap), jid 0, uid 0, was killed: 
>>> out of swap space
>>> panic: non-ext_pgs mbuf with TLS session
>>
>> Possibly, though if sfio was freed and marked with 0xdeadc0de junk, then it
>> would trip over this assertion for any use-after-free.  I see in gdb that you
>> couldn't see sfio because of clang's poor debug info.  It would be really 
>> good
>> to try to find the contents of sfio to debug this further.
>>
>> You should be able to find it via 'bp->b_caller1' in frame 14:
>>
>> 'p *(struct sf_io *)bp->b_caller1'
>>
> 
> Here's a repeat where the involved files are compiled with "-O0":
> https://people.freebsd.org/~pho/stress/log/jhb009.txt

Ok, it looks like sfio->tls is just not being initialized to NULL in the
!KERN_TLS case and the malloc junk is leaking through (my fault):

(kgdb) p *(struct sf_io *)bp->b_caller1
$5 = {nios = 0x0, error = 0x0, npages = 0x1, so = 0xf808898d, m = 
0xf808a3512200, tls = 0xdeadc0dedeadc0de, pa = 0xf804e6cdfc68}

Initially I thought about using M_ZERO, but we can just axe the 'tls'
member of 'sfio' entirely in the !KERN_TLS case since it's a private
structure.

Try this (untested) change):

Index: kern_sendfile.c
===
--- kern_sendfile.c (revision 351522)
+++ kern_sendfile.c (working copy)
@@ -88,7 +88,9 @@ struct sf_io {
int npages;
struct socket   *so;
struct mbuf *m;
+#ifdef KERN_TLS
struct ktls_session *tls;
+#endif
vm_page_t   pa[];
 };
 
@@ -266,7 +268,7 @@ sendfile_iodone(void *arg, vm_page_t *pg, int coun
if (!refcount_release(&sfio->nios))
return;
 
-#ifdef INVARIANTS
+#if defined(KERN_TLS) && defined(INVARIANTS)
if ((sfio->m->m_flags & M_EXT) != 0 &&
sfio->m->m_ext.ext_type == EXT_PGS)
KASSERT(sfio->tls == sfio->m->m_ext.ext_pgs->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"


svn commit: r351552 - head/sys/arm64/rockchip

2019-08-27 Thread Emmanuel Vadot
Author: manu
Date: Tue Aug 27 18:00:01 2019
New Revision: 351552
URL: https://svnweb.freebsd.org/changeset/base/351552

Log:
  arm64: rk3399: pinctrl: Add gpio banks and fix iomux
  
  Since r351187 the pinctrl driver need to know the gpio bank as it
  directly attach the gpio driver to handle some setup that might
  be present in the dts, add the gpio banks table for rk3399.
  While here fix some IOMUX definition that prevented to boot
  on RK3399 as pinctrl wasn't configured correctly.
  
  Submitted by: mmel (original version)
  MFC after:2 weeks
  MFC With: r351187

Modified:
  head/sys/arm64/rockchip/rk_pinctrl.c

Modified: head/sys/arm64/rockchip/rk_pinctrl.c
==
--- head/sys/arm64/rockchip/rk_pinctrl.cTue Aug 27 17:59:09 2019
(r351551)
+++ head/sys/arm64/rockchip/rk_pinctrl.cTue Aug 27 18:00:01 2019
(r351552)
@@ -527,6 +527,14 @@ struct rk_pinctrl_conf rk3328_conf = {
.get_syscon = rk3328_get_syscon,
 };
 
+static struct rk_pinctrl_gpio rk3399_gpio_bank[] = {
+   RK_GPIO(0, "gpio0"),
+   RK_GPIO(1, "gpio1"),
+   RK_GPIO(2, "gpio2"),
+   RK_GPIO(3, "gpio3"),
+   RK_GPIO(4, "gpio4"),
+};
+
 static struct rk_pinctrl_bank rk3399_iomux_bank[] = {
/*bank sub  offs   nbits */
RK_IOMUX(0, 0, 0x, 2),
@@ -536,7 +544,7 @@ static struct rk_pinctrl_bank rk3399_iomux_bank[] = {
RK_IOMUX(1, 0, 0x0010, 2),
RK_IOMUX(1, 1, 0x0014, 2),
RK_IOMUX(1, 2, 0x0018, 2),
-   RK_IOMUX(1, 3, 0x000C, 2),
+   RK_IOMUX(1, 3, 0x001C, 2),
RK_IOMUX(2, 0, 0xE000, 2),
RK_IOMUX(2, 1, 0xE004, 2),
RK_IOMUX(2, 2, 0xE008, 2),
@@ -617,6 +625,8 @@ struct rk_pinctrl_conf rk3399_conf = {
.npin_fixup = nitems(rk3399_pin_fixup),
.pin_drive = rk3399_pin_drive,
.npin_drive = nitems(rk3399_pin_drive),
+   .gpio_bank = rk3399_gpio_bank,
+   .ngpio_bank = nitems(rk3399_gpio_bank),
.get_pd_offset = rk3399_get_pd_offset,
.get_syscon = rk3399_get_syscon,
 };
___
svn-src-all@freebsd.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: r351551 - head/sys/arm64/rockchip

2019-08-27 Thread Emmanuel Vadot
Author: manu
Date: Tue Aug 27 17:59:09 2019
New Revision: 351551
URL: https://svnweb.freebsd.org/changeset/base/351551

Log:
  arm64: rk3328: pinctrl: Add gpio banks and fix iomux
  
  Since r351187 the pinctrl driver need to know the gpio bank as it
  directly attach the gpio driver to handle some setup that might
  be present in the dts, add the gpio banks table for rk3328.
  While here fix some IOMUX definition that prevented to boot
  on RK3328 as pinctrl wasn't configured correctly.
  
  Submitted by: mmel (original version)
  MFC after:2 weeks
  MFC With: r351187

Modified:
  head/sys/arm64/rockchip/rk_pinctrl.c

Modified: head/sys/arm64/rockchip/rk_pinctrl.c
==
--- head/sys/arm64/rockchip/rk_pinctrl.cTue Aug 27 16:41:06 2019
(r351550)
+++ head/sys/arm64/rockchip/rk_pinctrl.cTue Aug 27 17:59:09 2019
(r351551)
@@ -384,6 +384,13 @@ struct rk_pinctrl_conf rk3288_conf = {
.get_syscon = rk3288_get_syscon,
 };
 
+static struct rk_pinctrl_gpio rk3328_gpio_bank[] = {
+   RK_GPIO(0, "gpio0"),
+   RK_GPIO(1, "gpio1"),
+   RK_GPIO(2, "gpio2"),
+   RK_GPIO(3, "gpio3"),
+};
+
 static struct rk_pinctrl_bank rk3328_iomux_bank[] = {
/*bank sub offs nbits */
RK_IOMUX(0, 0, 0x, 2),
@@ -394,18 +401,14 @@ static struct rk_pinctrl_bank rk3328_iomux_bank[] = {
RK_IOMUX(1, 1, 0x0014, 2),
RK_IOMUX(1, 2, 0x0018, 2),
RK_IOMUX(1, 3, 0x001C, 2),
-   RK_IOMUX(2, 0, 0xE000, 2),
-   RK_IOMUX(2, 1, 0xE004, 2),
-   RK_IOMUX(2, 2, 0xE008, 2),
-   RK_IOMUX(2, 3, 0xE00C, 2),
-   RK_IOMUX(3, 0, 0xE010, 2),
-   RK_IOMUX(3, 1, 0xE014, 2),
-   RK_IOMUX(3, 2, 0xE018, 2),
-   RK_IOMUX(3, 3, 0xE01C, 2),
-   RK_IOMUX(4, 0, 0xE020, 2),
-   RK_IOMUX(4, 1, 0xE024, 2),
-   RK_IOMUX(4, 2, 0xE028, 2),
-   RK_IOMUX(4, 3, 0xE02C, 2),
+   RK_IOMUX(2, 0, 0x0020, 2),
+   RK_IOMUX(2, 1, 0x0024, 3),
+   RK_IOMUX(2, 2, 0x002c, 3),
+   RK_IOMUX(2, 3, 0x0034, 2),
+   RK_IOMUX(3, 0, 0x0038, 3),
+   RK_IOMUX(3, 1, 0x0040, 3),
+   RK_IOMUX(3, 2, 0x0048, 2),
+   RK_IOMUX(3, 3, 0x004c, 2),
 };
 
 static struct rk_pinctrl_pin_fixup rk3328_pin_fixup[] = {
@@ -518,6 +521,8 @@ struct rk_pinctrl_conf rk3328_conf = {
.npin_fixup = nitems(rk3328_pin_fixup),
.pin_drive = rk3328_pin_drive,
.npin_drive = nitems(rk3328_pin_drive),
+   .gpio_bank = rk3328_gpio_bank,
+   .ngpio_bank = nitems(rk3328_gpio_bank),
.get_pd_offset = rk3328_get_pd_offset,
.get_syscon = rk3328_get_syscon,
 };
___
svn-src-all@freebsd.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: r351522 - in head: sbin/ifconfig share/man/man4 sys/conf sys/kern sys/modules sys/modules/ktls_ocf sys/net sys/netinet sys/netinet/tcp_stacks sys/netinet6 sys/opencrypto sys/sys tools/

2019-08-27 Thread Alan Somers
On Tue, Aug 27, 2019 at 11:05 AM Peter Holm  wrote:

> On Tue, Aug 27, 2019 at 09:02:31AM -0700, John Baldwin wrote:
> > On 8/27/19 7:39 AM, Peter Holm wrote:
> > > On Tue, Aug 27, 2019 at 12:01:57AM +, John Baldwin wrote:
> > >> Author: jhb
> > >> Date: Tue Aug 27 00:01:56 2019
> > >> New Revision: 351522
> > >> URL: https://svnweb.freebsd.org/changeset/base/351522
> > >>
> > >> Log:
> > >>   Add kernel-side support for in-kernel TLS.
> > >>
> > >
> > > Could this be yours?
> > >
> > > 20190827 15:55:34 all (496/668): sendfile12.sh
> > > Aug 27 15:56:16 mercat1 kernel: pid 50036 (swap), jid 0, uid 0, was
> killed: out of swap space
> > > panic: non-ext_pgs mbuf with TLS session
> >
> > Possibly, though if sfio was freed and marked with 0xdeadc0de junk, then
> it
> > would trip over this assertion for any use-after-free.  I see in gdb
> that you
> > couldn't see sfio because of clang's poor debug info.  It would be
> really good
> > to try to find the contents of sfio to debug this further.
> >
> > You should be able to find it via 'bp->b_caller1' in frame 14:
> >
> > 'p *(struct sf_io *)bp->b_caller1'
> >
>
> Here's a repeat where the involved files are compiled with "-O0":
> https://people.freebsd.org/~pho/stress/log/jhb009.txt
>
> Let me know if you need the kernel + core.
>
> - Peter
>

This panic is easily reproducible by the fusefs test suite.
$ cd /usr/tests/sys/fs/fusefs/
$ ./read --gtest_filter=Read.sendfile

panic: non-ext_pgs mbuf with TLS session
cpuid = 3
time = 1566926504
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame
0xfe0050bdc560
vpanic() at vpanic+0x19d/frame 0xfe0050bdc5b0
panic() at panic+0x43/frame 0xfe0050bdc610
sendfile_iodone() at sendfile_iodone+0x28e/frame 0xfe0050bdc660
vn_sendfile() at vn_sendfile+0x1598/frame 0xfe0050bdc8f0
sendfile() at sendfile+0x127/frame 0xfe0050bdc980
amd64_syscall() at amd64_syscall+0x2b9/frame 0xfe0050bdcab0
fast_syscall_common() at fast_syscall_common+0x101/frame 0xfe0050bdcab0
--- syscall (393, FreeBSD ELF64, sys_sendfile), rip = 0x80052d9ea, rsp =
0x7fffe5a8, rbp = 0x7fffe790 ---

-Alan
___
svn-src-all@freebsd.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: r351522 - in head: sbin/ifconfig share/man/man4 sys/conf sys/kern sys/modules sys/modules/ktls_ocf sys/net sys/netinet sys/netinet/tcp_stacks sys/netinet6 sys/opencrypto sys/sys tools/

2019-08-27 Thread Peter Holm
On Tue, Aug 27, 2019 at 09:02:31AM -0700, John Baldwin wrote:
> On 8/27/19 7:39 AM, Peter Holm wrote:
> > On Tue, Aug 27, 2019 at 12:01:57AM +, John Baldwin wrote:
> >> Author: jhb
> >> Date: Tue Aug 27 00:01:56 2019
> >> New Revision: 351522
> >> URL: https://svnweb.freebsd.org/changeset/base/351522
> >>
> >> Log:
> >>   Add kernel-side support for in-kernel TLS.
> >>   
> > 
> > Could this be yours?
> > 
> > 20190827 15:55:34 all (496/668): sendfile12.sh
> > Aug 27 15:56:16 mercat1 kernel: pid 50036 (swap), jid 0, uid 0, was killed: 
> > out of swap space
> > panic: non-ext_pgs mbuf with TLS session
> 
> Possibly, though if sfio was freed and marked with 0xdeadc0de junk, then it
> would trip over this assertion for any use-after-free.  I see in gdb that you
> couldn't see sfio because of clang's poor debug info.  It would be really good
> to try to find the contents of sfio to debug this further.
> 
> You should be able to find it via 'bp->b_caller1' in frame 14:
> 
> 'p *(struct sf_io *)bp->b_caller1'
> 

Here's a repeat where the involved files are compiled with "-O0":
https://people.freebsd.org/~pho/stress/log/jhb009.txt

Let me know if you need the kernel + core.

- Peter
___
svn-src-all@freebsd.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: r351550 - head/sys/cam/scsi

2019-08-27 Thread Alexander Motin
Author: mav
Date: Tue Aug 27 16:41:06 2019
New Revision: 351550
URL: https://svnweb.freebsd.org/changeset/base/351550

Log:
  Always check cam_periph_error() status for ERESTART.
  
  Even if we do not expect retries, we better be sure, since otherwise it
  may result in use after free kernel panic.  I've noticed that it retries
  SCSI_STATUS_BUSY even with SF_NO_RECOVERY | SF_NO_RETRY.
  
  MFC after:1 week
  Sponsored by: iXsystems, Inc.

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

Modified: head/sys/cam/scsi/scsi_xpt.c
==
--- head/sys/cam/scsi/scsi_xpt.cTue Aug 27 15:42:08 2019
(r351549)
+++ head/sys/cam/scsi/scsi_xpt.cTue Aug 27 16:41:06 2019
(r351550)
@@ -1684,8 +1684,9 @@ probe_device_check:
case PROBE_TUR_FOR_NEGOTIATION:
case PROBE_DV_EXIT:
if (cam_ccb_status(done_ccb) != CAM_REQ_CMP) {
-   cam_periph_error(done_ccb, 0,
-   SF_NO_PRINT | SF_NO_RECOVERY | SF_NO_RETRY);
+   if (cam_periph_error(done_ccb, 0, SF_NO_PRINT |
+   SF_NO_RECOVERY | SF_NO_RETRY) == ERESTART)
+   goto outr;
}
if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) {
/* Don't wedge the queue */
@@ -1735,8 +1736,9 @@ probe_device_check:
struct ccb_scsiio *csio;
 
if (cam_ccb_status(done_ccb) != CAM_REQ_CMP) {
-   cam_periph_error(done_ccb, 0,
-   SF_NO_PRINT | SF_NO_RECOVERY | SF_NO_RETRY);
+   if (cam_periph_error(done_ccb, 0, SF_NO_PRINT |
+   SF_NO_RECOVERY | SF_NO_RETRY) == ERESTART)
+   goto outr;
}
if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) {
/* Don't wedge the queue */
___
svn-src-all@freebsd.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: r351522 - in head: sbin/ifconfig share/man/man4 sys/conf sys/kern sys/modules sys/modules/ktls_ocf sys/net sys/netinet sys/netinet/tcp_stacks sys/netinet6 sys/opencrypto sys/sys tools/

2019-08-27 Thread John Baldwin
On 8/27/19 6:04 AM, Shawn Webb wrote:
> On Mon, Aug 26, 2019 at 05:14:42PM -0700, John Baldwin wrote:
>> On 8/26/19 5:01 PM, John Baldwin wrote:
>>> Author: jhb
>>> Date: Tue Aug 27 00:01:56 2019
>>> New Revision: 351522
>>> URL: https://svnweb.freebsd.org/changeset/base/351522
>>>
>>> Log:
>>>   Add kernel-side support for in-kernel TLS.
>>
>> The length of the commit message notwithstanding, there is still quite a bit
>> more work to do on this front.  Making use of KTLS requires an SSL library
>> that understands the new functionality, and for the full performance gain
>> you want an application that makes use of SSL_sendfile.  Netflix has both
>> of these in the form of patches to OpenSSL and nginx.  I'm currently working
>> on a patchset suitable for merging into upstream OpenSSL's master (the
>> Linux KTLS patches are merged into OpenSSL master already, so the FreeBSD
>> patches are fairly small).
> 
> Hey John,
> 
> Thanks a lot for working to get this in! I'm curious if there's any
> desire to help LibreSSL adopt same/similar patches as OpenSSL. Doing
> so would help LibreSSL on FreeBSD maintain feature parity with
> OpenSSL.

I do not have any plans to implement the needed changes in other SSL
implementations.  Others are free to work on it however.

-- 
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: r351522 - in head: sbin/ifconfig share/man/man4 sys/conf sys/kern sys/modules sys/modules/ktls_ocf sys/net sys/netinet sys/netinet/tcp_stacks sys/netinet6 sys/opencrypto sys/sys tools/

2019-08-27 Thread John Baldwin
On 8/27/19 7:39 AM, Peter Holm wrote:
> On Tue, Aug 27, 2019 at 12:01:57AM +, John Baldwin wrote:
>> Author: jhb
>> Date: Tue Aug 27 00:01:56 2019
>> New Revision: 351522
>> URL: https://svnweb.freebsd.org/changeset/base/351522
>>
>> Log:
>>   Add kernel-side support for in-kernel TLS.
>>   
> 
> Could this be yours?
> 
> 20190827 15:55:34 all (496/668): sendfile12.sh
> Aug 27 15:56:16 mercat1 kernel: pid 50036 (swap), jid 0, uid 0, was killed: 
> out of swap space
> panic: non-ext_pgs mbuf with TLS session

Possibly, though if sfio was freed and marked with 0xdeadc0de junk, then it
would trip over this assertion for any use-after-free.  I see in gdb that you
couldn't see sfio because of clang's poor debug info.  It would be really good
to try to find the contents of sfio to debug this further.

You should be able to find it via 'bp->b_caller1' in frame 14:

'p *(struct sf_io *)bp->b_caller1'

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

2019-08-27 Thread Mark Johnston
Author: markj
Date: Tue Aug 27 15:42:08 2019
New Revision: 351549
URL: https://svnweb.freebsd.org/changeset/base/351549

Log:
  Remove an extraneous + 1 in _domainset_create().
  
  DOMAINSET_FLS, like our fls(), is 1-indexed.
  
  Reported by:  alc
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/kern_cpuset.c

Modified: head/sys/kern/kern_cpuset.c
==
--- head/sys/kern/kern_cpuset.c Tue Aug 27 15:34:37 2019(r351548)
+++ head/sys/kern/kern_cpuset.c Tue Aug 27 15:42:08 2019(r351549)
@@ -457,7 +457,7 @@ static struct domainset *
 _domainset_create(struct domainset *domain, struct domainlist *freelist)
 {
struct domainset *ndomain;
-   int i, j, max;
+   int i, j;
 
KASSERT(domain->ds_cnt <= vm_ndomains,
("invalid domain count in domainset %p", domain));
@@ -476,8 +476,7 @@ _domainset_create(struct domainset *domain, struct dom
if (ndomain == NULL) {
LIST_INSERT_HEAD(&cpuset_domains, domain, ds_link);
domain->ds_cnt = DOMAINSET_COUNT(&domain->ds_mask);
-   max = DOMAINSET_FLS(&domain->ds_mask) + 1;
-   for (i = 0, j = 0; i < max; i++)
+   for (i = 0, j = 0; i < DOMAINSET_FLS(&domain->ds_mask); i++)
if (DOMAINSET_ISSET(i, &domain->ds_mask))
domain->ds_order[j++] = 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: r351548 - head/sbin/ping

2019-08-27 Thread Alan Somers
Author: asomers
Date: Tue Aug 27 15:34:37 2019
New Revision: 351548
URL: https://svnweb.freebsd.org/changeset/base/351548

Log:
  ping: raise WARNS level to 6
  
  Submitted by: Ján Sučan 
  MFC after:2 weeks
  Sponsored by: Google LLC (Google Summer of Code 2019)
  Differential Revision:https://reviews.freebsd.org/D21405

Modified:
  head/sbin/ping/Makefile

Modified: head/sbin/ping/Makefile
==
--- head/sbin/ping/Makefile Tue Aug 27 14:06:34 2019(r351547)
+++ head/sbin/ping/Makefile Tue Aug 27 15:34:37 2019(r351548)
@@ -9,7 +9,6 @@ SRCS=   ping.c utils.c
 MAN=   ping.8
 BINOWN=root
 BINMODE=4555
-WARNS?=3
 LIBADD=m
 
 .if ${MK_DYNAMICROOT} == "no"
___
svn-src-all@freebsd.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: r351522 - in head: sbin/ifconfig share/man/man4 sys/conf sys/kern sys/modules sys/modules/ktls_ocf sys/net sys/netinet sys/netinet/tcp_stacks sys/netinet6 sys/opencrypto sys/sys tools/

2019-08-27 Thread Peter Holm
On Tue, Aug 27, 2019 at 12:01:57AM +, John Baldwin wrote:
> Author: jhb
> Date: Tue Aug 27 00:01:56 2019
> New Revision: 351522
> URL: https://svnweb.freebsd.org/changeset/base/351522
> 
> Log:
>   Add kernel-side support for in-kernel TLS.
>   

Could this be yours?

20190827 15:55:34 all (496/668): sendfile12.sh
Aug 27 15:56:16 mercat1 kernel: pid 50036 (swap), jid 0, uid 0, was killed: out 
of swap space
panic: non-ext_pgs mbuf with TLS session
cpuid = 9
time = 1566914176
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfe0307ef4820
vpanic() at vpanic+0x19d/frame 0xfe0307ef4870
panic() at panic+0x43/frame 0xfe0307ef48d0
sendfile_iodone() at sendfile_iodone+0x28e/frame 0xfe0307ef4920
vnode_pager_generic_getpages_done_async() at 
vnode_pager_generic_getpages_done_async+0x3a/frame 0xfe0307ef4940
bufdone() at bufdone+0x70/frame 0xfe0307ef49c0
g_io_deliver() at g_io_deliver+0x298/frame 0xfe0307ef4a10
md_kthread() at md_kthread+0x266/frame 0xfe0307ef4a70
fork_exit() at fork_exit+0x84/frame 0xfe0307ef4ab0
fork_trampoline() at fork_trampoline+0xe/frame 0xfe0307ef4ab0

https://people.freebsd.org/~pho/stress/log/mjguzik014.txt

- Peter
___
svn-src-all@freebsd.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: r351547 - head/sys/kern

2019-08-27 Thread Mark Johnston
Author: markj
Date: Tue Aug 27 14:06:34 2019
New Revision: 351547
URL: https://svnweb.freebsd.org/changeset/base/351547

Log:
  Fix several logic issues in domainset_empty_vm().
  
  - Don't add 1 to the result of DOMAINSET_FLS.
  - Do not modify domainsets containing only empty domains.
  - Always flatten a _PREFER policy to _ROUNDROBIN if the preferred
domain is empty.  Previously we were doing this only when ds_cnt > 1.
  
  These bugs could cause hangs during boot if a VM domain is empty.
  
  Tested by:hselasky
  Reviewed by:  hselasky, kib
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D21420

Modified:
  head/sys/kern/kern_cpuset.c

Modified: head/sys/kern/kern_cpuset.c
==
--- head/sys/kern/kern_cpuset.c Tue Aug 27 14:04:32 2019(r351546)
+++ head/sys/kern/kern_cpuset.c Tue Aug 27 14:06:34 2019(r351547)
@@ -500,25 +500,31 @@ _domainset_create(struct domainset *domain, struct dom
 static bool
 domainset_empty_vm(struct domainset *domain)
 {
-   int i, j, max;
+   domainset_t empty;
+   int i, j;
 
-   max = DOMAINSET_FLS(&domain->ds_mask) + 1;
-   for (i = 0; i < max; i++)
-   if (DOMAINSET_ISSET(i, &domain->ds_mask) && VM_DOMAIN_EMPTY(i))
-   DOMAINSET_CLR(i, &domain->ds_mask);
+   DOMAINSET_ZERO(&empty);
+   for (i = 0; i < vm_ndomains; i++)
+   if (VM_DOMAIN_EMPTY(i))
+   DOMAINSET_SET(i, &empty);
+   if (DOMAINSET_SUBSET(&empty, &domain->ds_mask))
+   return (true);
+
+   /* Remove empty domains from the set and recompute. */
+   DOMAINSET_NAND(&domain->ds_mask, &empty);
domain->ds_cnt = DOMAINSET_COUNT(&domain->ds_mask);
-   max = DOMAINSET_FLS(&domain->ds_mask) + 1;
-   for (i = j = 0; i < max; i++) {
+   for (i = j = 0; i < DOMAINSET_FLS(&domain->ds_mask); i++)
if (DOMAINSET_ISSET(i, &domain->ds_mask))
domain->ds_order[j++] = i;
-   else if (domain->ds_policy == DOMAINSET_POLICY_PREFER &&
-   domain->ds_prefer == i && domain->ds_cnt > 1) {
-   domain->ds_policy = DOMAINSET_POLICY_ROUNDROBIN;
-   domain->ds_prefer = -1;
-   }
+
+   /* Convert a PREFER policy referencing an empty domain to RR. */
+   if (domain->ds_policy == DOMAINSET_POLICY_PREFER &&
+   DOMAINSET_ISSET(domain->ds_prefer, &empty)) {
+   domain->ds_policy = DOMAINSET_POLICY_ROUNDROBIN;
+   domain->ds_prefer = -1;
}
 
-   return (DOMAINSET_EMPTY(&domain->ds_mask));
+   return (false);
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351546 - head/sys/powerpc/booke

2019-08-27 Thread Justin Hibbits
Author: jhibbits
Date: Tue Aug 27 14:04:32 2019
New Revision: 351546
URL: https://svnweb.freebsd.org/changeset/base/351546

Log:
  Revert a part of r350883 that should never have gone in
  
  The wire_count change is not part of the unification, and doesn't even make
  sense.
  
  Reported by:  markj

Modified:
  head/sys/powerpc/booke/pmap.c

Modified: head/sys/powerpc/booke/pmap.c
==
--- head/sys/powerpc/booke/pmap.c   Tue Aug 27 13:55:45 2019
(r351545)
+++ head/sys/powerpc/booke/pmap.c   Tue Aug 27 14:04:32 2019
(r351546)
@@ -2807,7 +2807,7 @@ retry:
if (vm_page_pa_tryrelock(pmap, PTE_PA(pte), &pa))
goto retry;
m = PHYS_TO_VM_PAGE(PTE_PA(pte));
-   m->wire_count++;
+   vm_page_wire(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: r351545 - head/tests/sys/sys

2019-08-27 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Aug 27 13:55:45 2019
New Revision: 351545
URL: https://svnweb.freebsd.org/changeset/base/351545

Log:
  Fix build on 32 bit archs.

Modified:
  head/tests/sys/sys/qmath_test.c

Modified: head/tests/sys/sys/qmath_test.c
==
--- head/tests/sys/sys/qmath_test.c Tue Aug 27 11:46:22 2019
(r351544)
+++ head/tests/sys/sys/qmath_test.c Tue Aug 27 13:55:45 2019
(r351545)
@@ -448,10 +448,10 @@ ATF_TC_BODY(qfraci_s64q, tc)
maxe_dbl = fabs(1.0 / Q_NFBITS(a_s64q));
delta_dbl = fabs(r_dbl - Q_Q2D(r_s64q));
ATF_CHECK_MSG(delta_dbl <= maxe_dbl,
-   "\tQFRACI(%ld / %ld): |%10f - %10f| = %10f "
+   "\tQFRACI(%jd / %jd): |%10f - %10f| = %10f "
"(max err %f)\n",
-   a_int, b_int, Q_Q2D(r_s64q), r_dbl, delta_dbl,
-   maxe_dbl);
+   (intmax_t)a_int, (intmax_t)b_int, Q_Q2D(r_s64q),
+   r_dbl, delta_dbl, maxe_dbl);
}
 }
 
@@ -495,10 +495,10 @@ ATF_TC_BODY(qmuli_s64q, tc)
maxe_dbl = fabs((1.0 / Q_NFBITS(a_s64q)) * (double)b_int);
delta_dbl = fabs(r_dbl - Q_Q2D(r_s64q));
ATF_CHECK_MSG(delta_dbl <= maxe_dbl,
-   "\tQMULI(%ld * %ld): |%10f - %10f| = %10f "
+   "\tQMULI(%jd * %jd): |%10f - %10f| = %10f "
"(max err %f)\n",
-   a_int, b_int, Q_Q2D(r_s64q), r_dbl, delta_dbl,
-   maxe_dbl);
+   (intmax_t)(intmax_t)a_int, b_int, Q_Q2D(r_s64q),
+   r_dbl, delta_dbl, maxe_dbl);
}
 }
 
@@ -546,10 +546,10 @@ ATF_TC_BODY(qaddi_s64q, tc)
 #endif
delta_dbl = fabs(r_dbl - Q_Q2D(r_s64q));
ATF_CHECK_MSG(delta_dbl <= maxe_dbl,
-   "\tQADDI(%ld + %ld): |%10f - %10f| = %10f "
+   "\tQADDI(%jd + %jd): |%10f - %10f| = %10f "
"(max err %f)\n",
-   a_int, b_int, Q_Q2D(r_s64q), r_dbl, delta_dbl,
-   maxe_dbl);
+   (intmax_t)a_int, (intmax_t)b_int, Q_Q2D(r_s64q),
+   r_dbl, delta_dbl, maxe_dbl);
}
 }
 
@@ -594,10 +594,10 @@ ATF_TC_BODY(qsubi_s64q, tc)
 #endif
delta_dbl = fabs(r_dbl - Q_Q2D(r_s64q));
ATF_CHECK_MSG(delta_dbl <= maxe_dbl,
-   "\tQSUBI(%ld - %ld): |%10f - %10f| = %10f "
+   "\tQSUBI(%jd - %jd): |%10f - %10f| = %10f "
"(max err %f)\n",
-   a_int, b_int, Q_Q2D(r_s64q), r_dbl, delta_dbl,
-   maxe_dbl);
+   (intmax_t)a_int, (intmax_t)b_int, Q_Q2D(r_s64q),
+   r_dbl, delta_dbl, maxe_dbl);
}
 }
 
___
svn-src-all@freebsd.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: r351522 - in head: sbin/ifconfig share/man/man4 sys/conf sys/kern sys/modules sys/modules/ktls_ocf sys/net sys/netinet sys/netinet/tcp_stacks sys/netinet6 sys/opencrypto sys/sys tools/

2019-08-27 Thread Shawn Webb
On Mon, Aug 26, 2019 at 05:14:42PM -0700, John Baldwin wrote:
> On 8/26/19 5:01 PM, John Baldwin wrote:
> > Author: jhb
> > Date: Tue Aug 27 00:01:56 2019
> > New Revision: 351522
> > URL: https://svnweb.freebsd.org/changeset/base/351522
> > 
> > Log:
> >   Add kernel-side support for in-kernel TLS.
> 
> The length of the commit message notwithstanding, there is still quite a bit
> more work to do on this front.  Making use of KTLS requires an SSL library
> that understands the new functionality, and for the full performance gain
> you want an application that makes use of SSL_sendfile.  Netflix has both
> of these in the form of patches to OpenSSL and nginx.  I'm currently working
> on a patchset suitable for merging into upstream OpenSSL's master (the
> Linux KTLS patches are merged into OpenSSL master already, so the FreeBSD
> patches are fairly small).

Hey John,

Thanks a lot for working to get this in! I'm curious if there's any
desire to help LibreSSL adopt same/similar patches as OpenSSL. Doing
so would help LibreSSL on FreeBSD maintain feature parity with
OpenSSL.

I respect your opinion and would love to hear your thoughts.

Thanks,

-- 
Shawn Webb
Cofounder / Security Engineer
HardenedBSD

Tor-ified Signal:+1 443-546-8752
Tor+XMPP+OTR:latt...@is.a.hacker.sx
GPG Key ID:  0xFF2E67A277F8E1FA
GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9  3633 C85B 0AF8 AB23 0FB2


signature.asc
Description: PGP signature


svn commit: r351544 - in head: lib/msun/man share/man/man3 sys/sys tests/sys/sys

2019-08-27 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Aug 27 11:46:22 2019
New Revision: 351544
URL: https://svnweb.freebsd.org/changeset/base/351544

Log:
  Introduce , a fixed-point math library from Netflix.

  This makes it possible to perform mathematical operations
on
  fractional values without using floating point. It operates on Q
  numbers, which are integer-sized, opaque structures initialized
  to hold a chosen number of integer and fractional
bits.

  
  For a general description of the Q number system, see the "Fixed Point
  Representation & Fractional Math" whitepaper[1]; for the actual
  API see the qmath(3) man page.
  
  This is one of dependencies for the upcoming stats(3) framework[2]
  that will be applied to the TCP stack in a later commit.
  
  1. 
https://www.superkits.net/whitepapers/Fixed%20Point%20Representation%20&%20Fractional%20Math.pdf
  2. https://reviews.freebsd.org/D20477
  
  Reviewed by:  bcr (man pages, earlier version), sef (earlier version)
  Discussed with:   cem, dteske, imp, lstewart
  Sponsored By: Klara Inc, Netflix
  Obtained from:Netflix
  Differential Revision:https://reviews.freebsd.org/D20116

Added:
  head/share/man/man3/Q_FRAWMASK.3   (contents, props changed)
  head/share/man/man3/Q_IFRAWMASK.3   (contents, props changed)
  head/share/man/man3/Q_INI.3   (contents, props changed)
  head/share/man/man3/Q_IRAWMASK.3   (contents, props changed)
  head/share/man/man3/Q_QABS.3   (contents, props changed)
  head/share/man/man3/Q_QADDI.3   (contents, props changed)
  head/share/man/man3/Q_QADDQ.3   (contents, props changed)
  head/share/man/man3/Q_SIGNED.3   (contents, props changed)
  head/share/man/man3/Q_SIGNSHFT.3   (contents, props changed)
  head/share/man/man3/qmath.3   (contents, props changed)
  head/sys/sys/qmath.h   (contents, props changed)
  head/tests/sys/sys/qmath_test.c   (contents, props changed)
Modified:
  head/lib/msun/man/math.3
  head/share/man/man3/Makefile
  head/tests/sys/sys/Makefile

Modified: head/lib/msun/man/math.3
==
--- head/lib/msun/man/math.3Tue Aug 27 09:20:01 2019(r351543)
+++ head/lib/msun/man/math.3Tue Aug 27 11:46:22 2019(r351544)
@@ -217,6 +217,7 @@ rarely, and then only in very-close-to-halfway cases.
 .Xr complex 3 ,
 .Xr fenv 3 ,
 .Xr ieee 3 ,
+.Xr qmath 3 ,
 .Xr tgmath 3
 .Sh HISTORY
 A math library with many of the present functions appeared in

Modified: head/share/man/man3/Makefile
==
--- head/share/man/man3/MakefileTue Aug 27 09:20:01 2019
(r351543)
+++ head/share/man/man3/MakefileTue Aug 27 11:46:22 2019
(r351544)
@@ -13,6 +13,16 @@ MAN= assert.3 \
makedev.3 \
offsetof.3 \
${PTHREAD_MAN} \
+   Q_FRAWMASK.3 \
+   Q_IFRAWMASK.3 \
+   Q_INI.3 \
+   Q_IRAWMASK.3 \
+   Q_QABS.3 \
+   Q_QADDI.3 \
+   Q_QADDQ.3 \
+   Q_SIGNED.3 \
+   Q_SIGNSHFT.3 \
+   qmath.3 \
queue.3 \
sigevent.3 \
siginfo.3 \
@@ -72,6 +82,68 @@ MLINKS+= fpgetround.3 fpgetmask.3 \
 MLINKS+=   makedev.3 major.3 \
makedev.3 minor.3
 MLINKS+=   ${PTHREAD_MLINKS}
+MLINKS+=   Q_FRAWMASK.3 Q_GFRAW.3 \
+   Q_FRAWMASK.3 Q_GFABSVAL.3 \
+   Q_FRAWMASK.3 Q_GFVAL.3 \
+   Q_FRAWMASK.3 Q_SFVAL.3
+MLINKS+=   Q_IFRAWMASK.3 Q_IFVALIMASK.3 \
+   Q_IFRAWMASK.3 Q_IFVALFMASK.3 \
+   Q_IFRAWMASK.3 Q_GIFRAW.3 \
+   Q_IFRAWMASK.3 Q_GIFABSVAL.3 \
+   Q_IFRAWMASK.3 Q_GIFVAL.3 \
+   Q_IFRAWMASK.3 Q_SIFVAL.3 \
+   Q_IFRAWMASK.3 Q_SIFVALS.3
+MLINKS+=   Q_INI.3 Q_NCBITS.3 \
+   Q_INI.3 Q_BT.3 \
+   Q_INI.3 Q_TC.3 \
+   Q_INI.3 Q_NTBITS.3 \
+   Q_INI.3 Q_NFCBITS.3 \
+   Q_INI.3 Q_MAXNFBITS.3 \
+   Q_INI.3 Q_NFBITS.3 \
+   Q_INI.3 Q_NIBITS.3 \
+   Q_INI.3 Q_RPSHFT.3 \
+   Q_INI.3 Q_ABS.3 \
+   Q_INI.3 Q_MAXSTRLEN.3 \
+   Q_INI.3 Q_TOSTR.3 \
+   Q_INI.3 Q_SHL.3 \
+   Q_INI.3 Q_SHR.3 \
+   Q_INI.3 Q_DEBUG.3 \
+   Q_INI.3 Q_DFV2BFV.3
+MLINKS+=   Q_IRAWMASK.3 Q_GIRAW.3 \
+   Q_IRAWMASK.3 Q_GIABSVAL.3 \
+   Q_IRAWMASK.3 Q_GIVAL.3 \
+   Q_IRAWMASK.3 Q_SIVAL.3
+MLINKS+=   Q_QABS.3 Q_Q2D.3 \
+   Q_QABS.3 Q_Q2F.3
+MLINKS+=   Q_QADDI.3 Q_QDIVI.3 \
+   Q_QADDI.3 Q_QMULI.3 \
+   Q_QADDI.3 Q_QSUBI.3 \
+   Q_QADDI.3 Q_QFRACI.3 \
+   Q_QADDI.3 Q_QCPYVALI.3
+MLINKS+=   Q_QADDQ.3 Q_QDIVQ.3 \
+   Q_QADDQ.3 Q_QMULQ.3 \
+   Q_QADDQ.3 

Re: svn commit: r351187 - head/sys/arm64/rockchip

2019-08-27 Thread Michal Meloun



On 25.08.2019 9:28, Peter Jeremy wrote:
> On 2019-Aug-18 09:19:33 +, Michal Meloun 
> wrote:
>> Improve rk_pinctrl driver:
> 
> Sorry for the late notice but this breaks my Rock64 (RK3328).
> 
Sorry for late response.
Seems like this is caused by unnoticed dependency between patches in
my worktree, sorry for this. I hope that r351543 solves it.
Can you, please, try r351543 on Rock64 because I haven't any rk3328
based board for real test?
Thanks
Michal


> I'm using: U-Boot 2017.09-rockchip-ayufan-1035-gd646df03ac (Oct 26
> 2018 - 08:36:01 +)
> 
> At r351452, the kernel boot looks like: ... gic0:  Interrupt Controller> mem
> 0xff811000-0xff811fff,0xff812000-0xff813fff,0xff814000-0xff815fff,0xff816000-0xff817fff
> irq 48 on ofwbus0 gic0: pn 0x2, arch 0x2, rev 0x1, implementer
> 0x43b irqs 160 rk_pinctrl0:  on
> ofwbus0 rk_pinctrl0: Cannot attach GPIO subdevice: gpio0@ff21 
> rk_pinctrl0: Cannot attach GPIO subdevice: gpio1@ff22 
> rk_pinctrl0: Cannot attach GPIO subdevice: gpio2@ff23 
> rk_pinctrl0: Cannot attach GPIO subdevice: gpio3@ff24 panic:
> acquiring blockable sleep lock with spinlock or critical section
> held (sleep mutex) pmap @ /usr/src/sys/arm64/arm64/pmap.c:5819 
> cpuid = 0 time = 1 KDB: stack backtrace: db_trace_self() at
> db_trace_self_wrapper+0x28 pc = 0x0054c9ac  lr =
> 0x000e2908 sp = 0x00010100  fp =
> 0x00010310
> 
> db_trace_self_wrapper() at vpanic+0x18c pc = 0x000e2908  lr
> = 0x0027e848 sp = 0x00010320  fp =
> 0x000103c0
> 
> vpanic() at panic+0x44 pc = 0x0027e848  lr =
> 0x0027e5f8 sp = 0x000103d0  fp =
> 0x00010450
> 
> panic() at witness_checkorder+0xa80 pc = 0x0027e5f8  lr =
> 0x002e5348 sp = 0x00010460  fp =
> 0x000104d0
> 
> witness_checkorder() at __mtx_lock_flags+0xb0 pc =
> 0x002e5348  lr = 0x0025e574 sp = 0x000104e0
> fp = 0x00010520
> 
> __mtx_lock_flags() at pmap_fault+0x1bc pc = 0x0025e574  lr
> = 0x00566c00 sp = 0x00010530  fp =
> 0x00010550
> 
> pmap_fault() at data_abort+0xc0 pc = 0x00566c00  lr =
> 0x00568a68 sp = 0x00010560  fp =
> 0x00010610
> 
> data_abort() at do_el1h_sync+0x128 pc = 0x00568a68  lr =
> 0x005688a4 sp = 0x00010620  fp =
> 0x00010650
> 
> do_el1h_sync() at handle_el1h_sync+0x74 pc = 0x005688a4  lr
> = 0x0054f074 sp = 0x00010660  fp =
> 0x00010770
> 
> handle_el1h_sync() at simple_mfd_syscon_modify_4+0x60 pc =
> 0x0054f074  lr = 0x000fd334 sp = 0x00010780
> fp = 0x00010830
> 
> simple_mfd_syscon_modify_4() at rk_pinctrl_configure_pins+0x1b4 pc
> = 0x000fd334  lr = 0x005795fc sp =
> 0x00010840  fp = 0x000108c0
> 
> rk_pinctrl_configure_pins() at pinctrl_configure_children+0x120 pc
> = 0x005795fc  lr = 0x000fc4dc sp =
> 0x000108d0  fp = 0x00010950
> 
> pinctrl_configure_children() at fdt_pinctrl_configure_tree+0x20 pc
> = 0x000fc4dc  lr = 0x000fc3a8 sp =
> 0x00010960  fp = 0x00010970
> 
> fdt_pinctrl_configure_tree() at rk_pinctrl_attach+0x310 pc =
> 0x000fc3a8  lr = 0x00579414 sp = 0x00010980
> fp = 0x000109e0
> 
> rk_pinctrl_attach() at device_attach+0x3f4 pc = 0x00579414
> lr = 0x002b3f18 sp = 0x000109f0  fp =
> 0x00010a40
> 
> device_attach() at bus_generic_new_pass+0x12c pc =
> 0x002b3f18  lr = 0x002b5ccc sp = 0x00010a50
> fp = 0x00010a80
> 
> bus_generic_new_pass() at bus_generic_new_pass+0xe4 pc =
> 0x002b5ccc  lr = 0x002b5c84 sp = 0x00010a90
> fp = 0x00010ac0
> 
> bus_generic_new_pass() at bus_generic_new_pass+0xe4 pc =
> 0x002b5c84  lr = 0x002b5c84 sp = 0x00010ad0
> fp = 0x00010b00
> 
> bus_generic_new_pass() at bus_set_pass+0x8c pc = 0x002b5c84
> lr = 0x002b1674 sp = 0x00010b10  fp =
> 0x00010b40
> 
> bus_set_pass() at mi_startup+0x238 pc = 0x002b1674  lr =
> 0x00217b50 sp = 0x00010b50  fp =
> 0x00010bb0
> 
> mi_startup() at virtdone+0x54 pc = 0x00217b50  lr =
> 0x1084 sp = 0x00010bc0  fp =
> 0x 
> 
> When I revert r351187, I get: ... gic0:  Controller> mem
> 0xff811000-0xff811fff,0xff812000-0xff813fff,0xff814000-0xff815fff,0xff816000-0xff817fff
> irq 48 on ofwbus0 gic0: pn 0x2, arch 0x2, rev 0x1, implementer
> 0x43b irqs 160 rk_pinctrl0:  on
> ofwbus0 rk_i2c0:  mem 0xff16-0xff160fff irq 16 on
> ofwbus0 iicbus0:  on rk_i2c0 gpio0:  Bank controller> mem 0xff21-0xff2100ff irq 51 on rk_pinctrl0 
> gpiobus0:  on gpio0 gpio1:  controller> mem 0xff22-0xff2200ff irq 52 on rk_pinctrl0 
> gpiobus1:  on gpio1 gpio2:  controller> mem 0xff

svn commit: r351543 - head/sys/arm64/rockchip

2019-08-27 Thread Michal Meloun
Author: mmel
Date: Tue Aug 27 09:20:01 2019
New Revision: 351543
URL: https://svnweb.freebsd.org/changeset/base/351543

Log:
  Add support for RK3288 into existing RockChip drivers.
  This patch ensures only minimal level of compatibility necessary to boot
  on RK3288 based boards. GPIO and pinctrl interaction, missing in current
  implementation, will be improved by own patch in the near future.
  
  MFC after:2 weeks
  MFC with: r351452

Modified:
  head/sys/arm64/rockchip/if_dwc_rk.c
  head/sys/arm64/rockchip/rk_gpio.c
  head/sys/arm64/rockchip/rk_grf.c

Modified: head/sys/arm64/rockchip/if_dwc_rk.c
==
--- head/sys/arm64/rockchip/if_dwc_rk.c Tue Aug 27 08:28:38 2019
(r351542)
+++ head/sys/arm64/rockchip/if_dwc_rk.c Tue Aug 27 09:20:01 2019
(r351543)
@@ -65,6 +65,13 @@ __FBSDID("$FreeBSD$");
 #defineRK3328_GRF_MACPHY_CON3  0x0B0C
 #defineRK3328_GRF_MACPHY_STATUS0x0B10
 
+static struct ofw_compat_data compat_data[] = {
+   {"rockchip,rk3288-gmac", 1},
+   {"rockchip,rk3328-gmac", 1},
+   {"rockchip,rk3399-gmac", 1},
+   {NULL,   0}
+};
+
 #ifdef notyet
 static void
 rk3328_set_delays(struct syscon *grf, phandle_t node)
@@ -117,8 +124,7 @@ if_dwc_rk_probe(device_t dev)
 
if (!ofw_bus_status_okay(dev))
return (ENXIO);
-   if (!(ofw_bus_is_compatible(dev, "rockchip,rk3328-gmac") ||
- ofw_bus_is_compatible(dev, "rockchip,rk3399-gmac")))
+   if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
return (ENXIO);
device_set_desc(dev, "Rockchip Gigabit Ethernet Controller");
 

Modified: head/sys/arm64/rockchip/rk_gpio.c
==
--- head/sys/arm64/rockchip/rk_gpio.c   Tue Aug 27 08:28:38 2019
(r351542)
+++ head/sys/arm64/rockchip/rk_gpio.c   Tue Aug 27 09:20:01 2019
(r351543)
@@ -50,8 +50,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include "opt_soc.h"
-
 #include "gpio_if.h"
 
 #defineRK_GPIO_SWPORTA_DR  0x00/* Data register */
@@ -196,6 +194,7 @@ rk_gpio_pin_max(device_t dev, int *maxpin)
 {
 
/* Each bank have always 32 pins */
+   /* XXX not true*/
*maxpin = 32;
return (0);
 }
@@ -225,6 +224,7 @@ rk_gpio_pin_getflags(device_t dev, uint32_t pin, uint3
 
sc = device_get_softc(dev);
 
+   /* XXX Combine this with parent (pinctrl) */
RK_GPIO_LOCK(sc);
reg = RK_GPIO_READ(sc, RK_GPIO_SWPORTA_DDR);
RK_GPIO_UNLOCK(sc);
@@ -242,6 +242,7 @@ rk_gpio_pin_getcaps(device_t dev, uint32_t pin, uint32
 {
 
/* Caps are managed by the pinctrl device */
+   /* XXX Pass this to parent (pinctrl) */
*caps = 0;
return (0);
 }
@@ -254,6 +255,7 @@ rk_gpio_pin_setflags(device_t dev, uint32_t pin, uint3
 
sc = device_get_softc(dev);
 
+   /* XXX Combine this with parent (pinctrl) */
RK_GPIO_LOCK(sc);
 
reg = RK_GPIO_READ(sc, RK_GPIO_SWPORTA_DDR);
@@ -394,6 +396,14 @@ rk_gpio_map_gpios(device_t bus, phandle_t dev, phandle
return (0);
 }
 
+static phandle_t
+rk_gpio_get_node(device_t bus, device_t dev)
+{
+
+   /* We only have one child, the GPIO bus, which needs our own node. */
+   return (ofw_bus_get_node(bus));
+}
+
 static device_method_t rk_gpio_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, rk_gpio_probe),
@@ -414,6 +424,9 @@ static device_method_t rk_gpio_methods[] = {
DEVMETHOD(gpio_pin_config_32,   rk_gpio_pin_config_32),
DEVMETHOD(gpio_map_gpios,   rk_gpio_map_gpios),
 
+   /* ofw_bus interface */
+   DEVMETHOD(ofw_bus_get_node, rk_gpio_get_node),
+
DEVMETHOD_END
 };
 
@@ -425,5 +438,10 @@ static driver_t rk_gpio_driver = {
 
 static devclass_t rk_gpio_devclass;
 
+/*
+ * GPIO driver is always a child of rk_pinctrl driver and should be probed
+ * and attached within rk_pinctrl_attach function. Due to this, bus pass order
+ * must be same as bus pass order of rk_pinctrl driver.
+ */
 EARLY_DRIVER_MODULE(rk_gpio, simplebus, rk_gpio_driver,
-rk_gpio_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE);
+rk_gpio_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE);

Modified: head/sys/arm64/rockchip/rk_grf.c
==
--- head/sys/arm64/rockchip/rk_grf.cTue Aug 27 08:28:38 2019
(r351542)
+++ head/sys/arm64/rockchip/rk_grf.cTue Aug 27 09:20:01 2019
(r351543)
@@ -44,16 +44,11 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include "opt_soc.h"
-
 static struct ofw_compat_data compat_data[] = {
-#ifdef SOC_ROCKCHIP_RK3328
+   {"rockchip,rk3288-grf", 1},
{"rockchip,rk3328-grf", 1},
-#endif
-#ifdef SOC_ROCKCHIP_RK3399
{"rockchip,rk3399-grf", 1},
 

svn commit: r351542 - head/sys/kern

2019-08-27 Thread Konstantin Belousov
Author: kib
Date: Tue Aug 27 08:28:38 2019
New Revision: 351542
URL: https://svnweb.freebsd.org/changeset/base/351542

Log:
  vn_vget_ino_gen(): relock the lower vnode on error.
  
  The function' interface assumes that the lower vnode is passed and
  returned locked always.
  
  Reported and tested by:   pho
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/kern/vfs_vnops.c

Modified: head/sys/kern/vfs_vnops.c
==
--- head/sys/kern/vfs_vnops.c   Tue Aug 27 07:17:31 2019(r351541)
+++ head/sys/kern/vfs_vnops.c   Tue Aug 27 08:28:38 2019(r351542)
@@ -2097,7 +2097,7 @@ vn_vget_ino_gen(struct vnode *vp, vn_get_ino_t alloc, 
VOP_UNLOCK(vp, 0);
error = alloc(mp, alloc_arg, lkflags, rvp);
vfs_unbusy(mp);
-   if (*rvp != vp)
+   if (error != 0 || *rvp != vp)
vn_lock(vp, ltype | LK_RETRY);
if (vp->v_iflag & VI_DOOMED) {
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"


Re: svn commit: r351522 - in head: sbin/ifconfig share/man/man4 sys/conf sys/kern sys/modules sys/modules/ktls_ocf sys/net sys/netinet sys/netinet/tcp_stacks sys/netinet6 sys/opencrypto sys/sys tools/

2019-08-27 Thread Maxim Konovalov
On 27/08/2019 03:01, John Baldwin wrote:
> Author: jhb
> Date: Tue Aug 27 00:01:56 2019
> New Revision: 351522
> URL: https://svnweb.freebsd.org/changeset/base/351522
> 
> Log:
>   Add kernel-side support for in-kernel TLS.
>   
[...]
>   This patch is the culmination of years of work by several folks
>   including Scott Long and Randall Stewart for the original design and
>   implementation; Drew Gallatin for several optimizations including the
>   use of ext_pgs mbufs, the M_NOTREADY mechanism for TLS records
>   awaiting software encryption, and pluggable software crypto backends;
>   and John Baldwin for modifications to support hardware TLS offload.
>   
This is super-cool, gentlemen!  My congratulations with great job done.

-- 
Maxim Konovalov
___
svn-src-all@freebsd.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: r351541 - stable/12/sys/dev/sound/pci/hda

2019-08-27 Thread Marcelo Araujo
Author: araujo
Date: Tue Aug 27 07:17:31 2019
New Revision: 351541
URL: https://svnweb.freebsd.org/changeset/base/351541

Log:
  MFC r350433: Fix sound on headset jack for ALC255 and ALC256 codec.
  
  PR:   219350 [1], [2]
  Submitted by: Masachika ISHIZUKA (ish_at_amail.plala.or.jp) [1]
Neel Chauhan (neel_at_neelc.org) [2]
Yuri Momotyuk (yurkis_at_gmail.com) [3]
  Reported by:  miwi
  Reviewed by:  mav
  Obtained from:https://github.com/trueos/trueos/pull/279 [3]
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D19017

Modified:
  stable/12/sys/dev/sound/pci/hda/hdaa_patches.c
  stable/12/sys/dev/sound/pci/hda/hdac.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/sound/pci/hda/hdaa_patches.c
==
--- stable/12/sys/dev/sound/pci/hda/hdaa_patches.c  Tue Aug 27 04:19:40 
2019(r351540)
+++ stable/12/sys/dev/sound/pci/hda/hdaa_patches.c  Tue Aug 27 07:17:31 
2019(r351541)
@@ -425,12 +425,21 @@ hdac_pin_patch(struct hdaa_widget *w)
} else if (id == HDA_CODEC_ALC298 && subid == DELL_XPS9560_SUBVENDOR) {
switch (nid) {
case 24:
-   config  = 0x01a1913c;
+   config = 0x01a1913c;
break;
case 26:
-   config  = 0x01a1913d;
+   config = 0x01a1913d;
break;
}
+   } else if (id == HDA_CODEC_ALC256 && subid == DELL_I7577_SUBVENDOR ) {
+   switch (nid) {
+   case 20:
+   patch = "as=1 seq=0";
+   break;
+   case 33:
+   patch = "as=1 seq=15";
+   break;
+   }
}
 
if (patch != NULL)
@@ -768,6 +777,10 @@ hdaa_patch_direct(struct hdaa_devinfo *devinfo)
hdaa_write_coef(dev, 0x20, 0x07, 0x7cb);
}
break;
+   }
+   if (id == HDA_CODEC_ALC255 || id == HDA_CODEC_ALC256) {
+   val = hdaa_read_coef(dev, 0x20, 0x46);
+   hdaa_write_coef(dev, 0x20, 0x46, val|0x3000);
}
if (subid == APPLE_INTEL_MAC)
hda_command(dev, HDA_CMD_12BIT(0, devinfo->nid,

Modified: stable/12/sys/dev/sound/pci/hda/hdac.h
==
--- stable/12/sys/dev/sound/pci/hda/hdac.h  Tue Aug 27 04:19:40 2019
(r351540)
+++ stable/12/sys/dev/sound/pci/hda/hdac.h  Tue Aug 27 07:17:31 2019
(r351541)
@@ -203,6 +203,7 @@
 #define DELL_XPSM1210_SUBVENDORHDA_MODEL_CONSTRUCT(DELL, 0x01d7)
 #define DELL_OPLX745_SUBVENDOR HDA_MODEL_CONSTRUCT(DELL, 0x01da)
 #define DELL_XPS9560_SUBVENDOR HDA_MODEL_CONSTRUCT(DELL, 0x07be)
+#define DELL_I7577_SUBVENDOR   HDA_MODEL_CONSTRUCT(DELL, 0x0802)
 #define DELL_ALL_SUBVENDOR HDA_MODEL_CONSTRUCT(DELL, 0x)
 
 /* Clevo */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"