svn commit: r322074 - head/sys/boot/efi/libefi

2017-08-04 Thread Toomas Soome
Author: tsoome
Date: Sat Aug  5 05:20:03 2017
New Revision: 322074
URL: https://svnweb.freebsd.org/changeset/base/322074

Log:
  libefi/time.c cstyle cleanup
  
  libefi/time.c is mix of different styles, this update does cleanup.
  Also fix 0 versus NULL, and zero the tv structure for case we get error
  from UEFI firmware.
  
  Reviewed by:  imp
  Differential Revision:https://reviews.freebsd.org/D11861

Modified:
  head/sys/boot/efi/libefi/time.c

Modified: head/sys/boot/efi/libefi/time.c
==
--- head/sys/boot/efi/libefi/time.c Sat Aug  5 00:28:42 2017
(r322073)
+++ head/sys/boot/efi/libefi/time.c Sat Aug  5 05:20:03 2017
(r322074)
@@ -2,28 +2,28 @@
  * Copyright (c) 1999, 2000
  * Intel Corporation.
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * 1. Redistributions of source code must retain the above copyright
  *notice, this list of conditions and the following disclaimer.
- * 
+ *
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
- * 
+ *
  * 3. All advertising materials mentioning features or use of this software
  *must display the following acknowledgement:
- * 
+ *
  *This product includes software developed by Intel Corporation and
  *its contributors.
- * 
+ *
  * 4. Neither the name of Intel Corporation or its contributors may be
  *used to endorse or promote products derived from this software
  *without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION AND CONTRIBUTORS ``AS IS''
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -35,7 +35,7 @@
  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  * THE POSSIBILITY OF SUCH DAMAGE.
- * 
+ *
  */
 
 #include 
@@ -48,50 +48,51 @@ __FBSDID("$FreeBSD$");
 #include 
 
 /*
-// Accurate only for the past couple of centuries;
-// that will probably do.
-//
-// (#defines From FreeBSD 3.2 lib/libc/stdtime/tzfile.h)
-*/
+ * Accurate only for the past couple of centuries;
+ * that will probably do.
+ *
+ * (#defines From FreeBSD 3.2 lib/libc/stdtime/tzfile.h)
+ */
 
-#define isleap(y)  (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 
0))
-#define SECSPERHOUR ( 60*60 )
-#define SECSPERDAY (24 * SECSPERHOUR)
+#defineisleap(y)   (((y) % 4) == 0 && \
+   (((y) % 100) != 0 || ((y) % 400) == 0))
+#defineSECSPERHOUR (60*60)
+#defineSECSPERDAY  (24 * SECSPERHOUR)
 
 /*
-//  These arrays give the cumulative number of days up to the first of the
-//  month number used as the index (1 -> 12) for regular and leap years.
-//  The value at index 13 is for the whole year.
-*/
+ *  These arrays give the cumulative number of days up to the first of the
+ *  month number used as the index (1 -> 12) for regular and leap years.
+ *  The value at index 13 is for the whole year.
+ */
 static const time_t CumulativeDays[2][14] = {
-  {0,
-   0,
-   31,
-   31 + 28,
-   31 + 28 + 31,
-   31 + 28 + 31 + 30,
-   31 + 28 + 31 + 30 + 31,
-   31 + 28 + 31 + 30 + 31 + 30,
-   31 + 28 + 31 + 30 + 31 + 30 + 31,
-   31 + 28 + 31 + 30 + 31 + 30 + 31 + 31,
-   31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30,
-   31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31,
-   31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30,
-   31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + 31 },
-  {0,
-   0,
-   31,
-   31 + 29,
-   31 + 29 + 31,
-   31 + 29 + 31 + 30,
-   31 + 29 + 31 + 30 + 31,
-   31 + 29 + 31 + 30 + 31 + 30,
-   31 + 29 + 31 + 30 + 31 + 30 + 31,
-   31 + 29 + 31 + 30 + 31 + 30 + 31 + 31,
-   31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30,
-   31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31,
-   31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30,
-   31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + 31 }};
+   {0,
+   0,
+   31,
+   31 + 28,
+   31 + 28 + 31,
+   31 + 28 + 31 + 30,
+   31 + 28 + 31 + 30 + 31,
+   31 + 28 + 31 + 30 + 31 + 30,
+   31 + 28 + 31 + 30 + 31 + 30 + 31,
+   31 + 28 + 31 + 30 + 31 + 30 + 31 + 31,
+   31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30,
+   31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31,
+   31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30,
+   31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + 31 },
+   {0,
+   0,
+   31,
+   31 + 29,
+   31 + 29 + 31,
+   31 + 29 + 31 + 30,
+   31 + 29 + 

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

2017-08-04 Thread Warner Losh
On Fri, Aug 4, 2017 at 9:22 PM, Bruce Evans  wrote:

> On Fri, 4 Aug 2017, Alan Cox wrote:
>
> Log:
>>  In case readers are misled by expressions that combine multiplication and
>>  division, add parentheses to make the precedence explicit.
>>
>>  Submitted by:  Doug Moore 
>>  Requested by:  imp
>>  Reviewed by:   imp
>>  MFC after: 1 week
>>  X-MFC after:   r321840
>>  Differential Revision: https://reviews.freebsd.org/D11815
>>
>
> This obfuscates the necessary parentheses.
>
> Modified: head/sys/kern/subr_blist.c
>> ...
>> static inline daddr_t
>> radix_to_skip(daddr_t radix)
>> {
>>
>> return (radix /
>> -   (BLIST_BMAP_RADIX / BLIST_META_RADIX * (BLIST_META_RADIX -
>> 1)));
>> +   ((BLIST_BMAP_RADIX / BLIST_META_RADIX) * (BLIST_META_RADIX -
>> 1)));
>> }
>>
>
> Readers now have to do a more complete parse to find the interesting parts,
> and writers have to count to a large number to get the count right when
> the parantheses pile up at the right.
>
> This expression is relatively simple to parse to remove the obfuscation,
> but consider more complicated cases:
>
> (1)
> (a + b + c + d + e) + (f + g + h + i + j)
>
> in floating point so that addition is not associative and the order
> matters.
> The order is left to right in C, and this expression uses 2 sets of
> parentheses to not use left to right for all terms.  Full parentheses gives
> the good obfuscation:
>
> a + b) + c) + d) + e) + f + g) + h) + i) + j)
>
> (2) Similarly with +- instead of all +.  The order matters much more, but I
> don't remember ever seeing expressions with only +- being obfuscated by
> parentheses, except in floating point code where the author wants to
> emphasize the left to right evaluation.  I guess there are also examples
> with integer types.  Even with all + operations, the order is critical
> with plain ints, since different orders might cause overflow, and with
> mixed signed/unsigned/small/large integer types, the promotions depend
> on the order.
>
> (3) Similarly with */ instead of +-.  These are even more similar in
> programming uses than in math structures, since + is always associative
> and commutative in math structures, but it is not even commutative in
> programming.


You know, for this case, it's totally cool.

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

2017-08-04 Thread Bruce Evans

On Fri, 4 Aug 2017, Alan Cox wrote:


Log:
 In case readers are misled by expressions that combine multiplication and
 division, add parentheses to make the precedence explicit.

 Submitted by:  Doug Moore 
 Requested by:  imp
 Reviewed by:   imp
 MFC after: 1 week
 X-MFC after:   r321840
 Differential Revision: https://reviews.freebsd.org/D11815


This obfuscates the necessary parentheses.


Modified: head/sys/kern/subr_blist.c
...
static inline daddr_t
radix_to_skip(daddr_t radix)
{

return (radix /
-   (BLIST_BMAP_RADIX / BLIST_META_RADIX * (BLIST_META_RADIX - 1)));
+   ((BLIST_BMAP_RADIX / BLIST_META_RADIX) * (BLIST_META_RADIX - 1)));
}


Readers now have to do a more complete parse to find the interesting parts,
and writers have to count to a large number to get the count right when
the parantheses pile up at the right.

This expression is relatively simple to parse to remove the obfuscation,
but consider more complicated cases:

(1)
(a + b + c + d + e) + (f + g + h + i + j)

in floating point so that addition is not associative and the order matters.
The order is left to right in C, and this expression uses 2 sets of
parentheses to not use left to right for all terms.  Full parentheses gives
the good obfuscation:

a + b) + c) + d) + e) + f + g) + h) + i) + j)

(2) Similarly with +- instead of all +.  The order matters much more, but I
don't remember ever seeing expressions with only +- being obfuscated by
parentheses, except in floating point code where the author wants to
emphasize the left to right evaluation.  I guess there are also examples
with integer types.  Even with all + operations, the order is critical
with plain ints, since different orders might cause overflow, and with
mixed signed/unsigned/small/large integer types, the promotions depend
on the order.

(3) Similarly with */ instead of +-.  These are even more similar in
programming uses than in math structures, since + is always associative
and commutative in math structures, but it is not even commutative in
programming.

Bruce
___
svn-src-all@freebsd.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: r321920 - head/sys/sys

2017-08-04 Thread Bruce Evans

On Thu, 3 Aug 2017, Konstantin Belousov wrote:


On Thu, Aug 03, 2017 at 07:34:56PM +1000, Bruce Evans wrote:

I see another problem.  Masking with 0xf and casting to unsigned
are gratuitously different spellings for extracting the low 32 bits.
I prefer the cast.


Below is one more update.  I reformulated the man page text, but not too
deep.  Also I replaced masking with the cast.


OK.


diff --git a/sys/sys/types.h b/sys/sys/types.h
index 30a08724443..eacbc1ba0c4 100644
--- a/sys/sys/types.h
+++ b/sys/sys/types.h
@@ -364,9 +364,9 @@ __bitcount64(__uint64_t _x)

#include 

-#definemajor(x)((int)((dev_t)(x) >> 32)) /* major number */
-#defineminor(x)((int)((x) & 0x))   /* minor number */
-#definemakedev(x, y)   (((dev_t)(x) << 32) | (unsigned)(y)) /* create 
dev_t */
+#definemajor(x)((int)((dev_t)(x) >> 32))
+#defineminor(x)((int)(x))


Another nice simplification.  Strictly, it should be (int)(dev_t)(x) since
the pseudo-prototype says that the arg is converted to dev_t, but yesterday
I couldn't see any differences even for exotic x and exotic arches.

Today I can see some difference for exotic x and perverse implementations.
E.g., x with extra bits in a large signed integer type to invoke
implementation-defined behaviour, and a perverse implementation that
truncates to 0 for direct conversion to int but does the right thing
for indirect conversion).  But we depend on the implementation doing
the right thing for other casts to int.

Also, if dev_t == uintptr_t, it is valid for the caller to keep dev_t's
in void *'s internally but not to pass void * to minor() or major()
according to the prototype.  However, casting in the macros breaks the
warning for this.  I think pure macros should not cast their args or
pretend to have prototypes, but require callers to pass args of supported
types.  The old dev_t macros were closer to this -- they have expressions
like ((x) << 8) which will fail if x is not an integral type or give
wrong results ix x has extra bits.

POSIX had to fix related problems for the ntohl() family.  The result
seems to be that the APIs act as if they are functions.  So even if
they are implemented as macros, the macros can't just cast their args,
but must be wrapped by functions (which can be inline) to get less
forceful conversions.  FreeBSD's implementation does almost exactly
this.  It has to cast args for optimizing const args, but seems to get
this right by not casting in the non-const case.  However, I have
uncommitted "fixes" which do cast in the non-const case.  Apparently
my fixes are backwards.


+#definemakedev(x, y)   (((dev_t)(x) << 32) | (unsigned)(y))

/*
 * These declarations belong elsewhere, but are repeated here and in


Bruce
___
svn-src-all@freebsd.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: r321985 - head/sys/ofed/drivers/infiniband/core

2017-08-04 Thread Bruce Evans

On Fri, 4 Aug 2017, Colin Percival wrote:


On 08/03/17 23:28, Hans Petter Selasky wrote:

On 08/03/17 16:37, Conrad Meyer wrote:

Is it not important that the subtraction and result are evaluated
without truncation?


ticks is a circular counter. Assuming time = 0 and jiffies = -1U, then "delay"
becomes a very large negative value, because long is used, and the delay <= 0
check, is no longer working like expected.

Casting to "int" or truncating is the right thing to do in this case.


Signed integer overflow is undefined.  Using 'int' is liable to cause problems
after 2^32 ticks.


There is no (new) overflow here.  Converting a higher rank type to int has
implementation-defined behaviour.  I have yet to see an implementation that
defines its behaviour except in its source code, but all implementations
that I have seen do the right thing of truncating 2's complement integers.
Perverse implementations would produce specific garbage values or perhaps
rand().  They just have to document this.

'int overflows after 2^31-1 ticks if int is 32 bits.  It is using u_int that
is liable to cause problems after 2^32 ticks.  Using long and u_long causes
exactly the same problems if long is 32 bits.


Modified: head/sys/ofed/drivers/infiniband/core/addr.c
==
--- head/sys/ofed/drivers/infiniband/core/addr.cThu Aug  3 09:14:43
2017(r321984)
+++ head/sys/ofed/drivers/infiniband/core/addr.cThu Aug  3 09:18:25
2017(r321985)
@@ -187,10 +187,10 @@ EXPORT_SYMBOL(rdma_translate_ip);

  static void set_timeout(unsigned long time)
  {
-   unsigned long delay;
+   int delay;  /* under FreeBSD ticks are 32-bit */

 delay = time - jiffies;


There is no overflow here.  The RHS is calculated in u_long arithmetic which
has truncation instead of overflow.

First, jiffies is converted to u_long in a standards-defined way.  If
jiffies is non-negative, then its value is unchanged by the conversion.
I think jiffies can't be negative, but if it is then there are
complications -- the value must be changed; it is changed by adding a
multiple of ULONG_MAX which is normally 1, but it not easy to see that
the multiple is always 1 (if that uis the case).

Then the subtraction can't overflow, but it produces a garbage result
of time < jiffies.  As usual, using unsigned is a bug.  Here it breaks
calculations of negative differences.


-   if ((long)delay <= 0)
+   if (delay <= 0)
 delay = 1;


Then we cast to long in the old code, and assign the RHS to int in the
new code.  Both are implementation-defined.  The cast does nothing different
from assignment except it might change compiler warnings.

The old code seems to be correct enough.  Suppose time is 59 and jiffies
is 60.  Then time - jiffies is 0xLU on 32-bit systems and
0xLU on 64-bit systems.  If the implementation-defined
behaviour were documented, then we would know that the result of casting
either of these to long is -1L.  This is < 0, so delay gets fixed up to
+1.  Similarly with the new code -- the assignment converts the huge
unsigned values to -1.

Problems with the type mismatch might occur later, but I don't see any.
On 64-bit systems, the difference can be really huge without tripping
the (long)delay <= 0 test.  Above INT_MAX, later truncation to int in
APIs using ticks will give garbage (possibly 0 or negative).  I guess
that is the problem.  But even on 32-bit systems, the difference can
be INT_MAX and that seems too large to be correct.  If jiffies are
1/1000 seconds, then it is thewell-known magic number 24+ days.  User
code might generate that, but kernel driver code shouldn't.

Bruce
___
svn-src-all@freebsd.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: r322073 - head/sys/contrib/ipfilter/netinet

2017-08-04 Thread Cy Schubert
In message <201708050028.v750sgsj015...@repo.freebsd.org>, Cy Schubert 
writes:
> Author: cy
> Date: Sat Aug  5 00:28:42 2017
> New Revision: 322073
> URL: https://svnweb.freebsd.org/changeset/base/322073
> 
> Log:
>   Fix matchcing of NATed ICMP queries (resolving NATed MTU discovery).
>   
>   MFC after:  1 month

Obtained from: NetBSD r1.16
> 
> 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.cFri Aug  4 23:34:39 201
> 7 (r322072)
> +++ head/sys/contrib/ipfilter/netinet/ip_nat.cSat Aug  5 00:28:42 201
> 7 (r322073)
> @@ -4100,13 +4100,8 @@ ipf_nat_inlookup(fin, flags, p, src, mapdst)
>   dport = htons(fin->fin_data[1]);
>   break;
>   case IPPROTO_ICMP :
> - if (flags & IPN_ICMPERR) {
> - sport = fin->fin_data[1];
> - dport = 0;
> - } else {
> - dport = fin->fin_data[1];
> - sport = 0;
> - }
> + sport = 0;
> + dport = fin->fin_data[1];
>   break;
>   default :
>   sport = 0;
> @@ -4426,8 +4421,6 @@ ipf_nat_outlookup(fin, flags, p, src, dst)
>  
>   ifp = fin->fin_ifp;
>   sflags = flags & IPN_TCPUDPICMP;
> - sport = 0;
> - dport = 0;
>  
>   switch (p)
>   {
> @@ -4437,12 +4430,12 @@ ipf_nat_outlookup(fin, flags, p, src, dst)
>   dport = htons(fin->fin_data[1]);
>   break;
>   case IPPROTO_ICMP :
> - if (flags & IPN_ICMPERR)
> - sport = fin->fin_data[1];
> - else
> - dport = fin->fin_data[1];
> + sport = 0;
> + dport = fin->fin_data[1];
>   break;
>   default :
> + sport = 0;
> + dport = 0;
>   break;
>   }
>  

-- 
Cheers,
Cy Schubert 
FreeBSD UNIX:     Web:  http://www.FreeBSD.org

The need of the many outweighs the greed of the few.


___
svn-src-all@freebsd.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: r322073 - head/sys/contrib/ipfilter/netinet

2017-08-04 Thread Cy Schubert
Author: cy
Date: Sat Aug  5 00:28:42 2017
New Revision: 322073
URL: https://svnweb.freebsd.org/changeset/base/322073

Log:
  Fix matchcing of NATed ICMP queries (resolving NATed MTU discovery).
  
  MFC after:1 month

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  Fri Aug  4 23:34:39 2017
(r322072)
+++ head/sys/contrib/ipfilter/netinet/ip_nat.c  Sat Aug  5 00:28:42 2017
(r322073)
@@ -4100,13 +4100,8 @@ ipf_nat_inlookup(fin, flags, p, src, mapdst)
dport = htons(fin->fin_data[1]);
break;
case IPPROTO_ICMP :
-   if (flags & IPN_ICMPERR) {
-   sport = fin->fin_data[1];
-   dport = 0;
-   } else {
-   dport = fin->fin_data[1];
-   sport = 0;
-   }
+   sport = 0;
+   dport = fin->fin_data[1];
break;
default :
sport = 0;
@@ -4426,8 +4421,6 @@ ipf_nat_outlookup(fin, flags, p, src, dst)
 
ifp = fin->fin_ifp;
sflags = flags & IPN_TCPUDPICMP;
-   sport = 0;
-   dport = 0;
 
switch (p)
{
@@ -4437,12 +4430,12 @@ ipf_nat_outlookup(fin, flags, p, src, dst)
dport = htons(fin->fin_data[1]);
break;
case IPPROTO_ICMP :
-   if (flags & IPN_ICMPERR)
-   sport = fin->fin_data[1];
-   else
-   dport = fin->fin_data[1];
+   sport = 0;
+   dport = fin->fin_data[1];
break;
default :
+   sport = 0;
+   dport = 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: r322071 - stable/11/contrib/libarchive/libarchive

2017-08-04 Thread Martin Matuska
Author: mm
Date: Fri Aug  4 23:34:25 2017
New Revision: 322071
URL: https://svnweb.freebsd.org/changeset/base/322071

Log:
  MFH r321674:
  Sync libarchive with vendor.
  
  Relevant vendor changes:
PR #926: ensure ar strtab is null terminated
  
  PR:   220462

Modified:
  stable/11/contrib/libarchive/libarchive/archive_cryptor_private.h
  stable/11/contrib/libarchive/libarchive/archive_write_set_format_ar.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/libarchive/libarchive/archive_cryptor_private.h
==
--- stable/11/contrib/libarchive/libarchive/archive_cryptor_private.h   Fri Aug 
 4 23:04:24 2017(r322070)
+++ stable/11/contrib/libarchive/libarchive/archive_cryptor_private.h   Fri Aug 
 4 23:34:25 2017(r322071)
@@ -64,7 +64,7 @@ typedef struct {
 } archive_crypto_ctx;
 
 #elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H)
-#include 
+#include 
 
 /* Common in other bcrypt implementations, but missing from VS2008. */
 #ifndef BCRYPT_SUCCESS

Modified: stable/11/contrib/libarchive/libarchive/archive_write_set_format_ar.c
==
--- stable/11/contrib/libarchive/libarchive/archive_write_set_format_ar.c   
Fri Aug  4 23:04:24 2017(r322070)
+++ stable/11/contrib/libarchive/libarchive/archive_write_set_format_ar.c   
Fri Aug  4 23:34:25 2017(r322071)
@@ -374,13 +374,14 @@ archive_write_ar_data(struct archive_write *a, const v
return (ARCHIVE_WARN);
}
 
-   ar->strtab = (char *)malloc(s);
+   ar->strtab = (char *)malloc(s + 1);
if (ar->strtab == NULL) {
archive_set_error(>archive, ENOMEM,
"Can't allocate strtab buffer");
return (ARCHIVE_FATAL);
}
-   strncpy(ar->strtab, buff, s);
+   memcpy(ar->strtab, buff, s);
+   ar->strtab[s] = '\0';
ar->has_strtab = 1;
}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r322072 - stable/10/contrib/libarchive/libarchive

2017-08-04 Thread Martin Matuska
Author: mm
Date: Fri Aug  4 23:34:39 2017
New Revision: 322072
URL: https://svnweb.freebsd.org/changeset/base/322072

Log:
  MFH r321674:
  Sync libarchive with vendor.
  
  Relevant vendor changes:
PR #926: ensure ar strtab is null terminated
  
  PR:   220462

Modified:
  stable/10/contrib/libarchive/libarchive/archive_cryptor_private.h
  stable/10/contrib/libarchive/libarchive/archive_write_set_format_ar.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/contrib/libarchive/libarchive/archive_cryptor_private.h
==
--- stable/10/contrib/libarchive/libarchive/archive_cryptor_private.h   Fri Aug 
 4 23:34:25 2017(r322071)
+++ stable/10/contrib/libarchive/libarchive/archive_cryptor_private.h   Fri Aug 
 4 23:34:39 2017(r322072)
@@ -64,7 +64,7 @@ typedef struct {
 } archive_crypto_ctx;
 
 #elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H)
-#include 
+#include 
 
 /* Common in other bcrypt implementations, but missing from VS2008. */
 #ifndef BCRYPT_SUCCESS

Modified: stable/10/contrib/libarchive/libarchive/archive_write_set_format_ar.c
==
--- stable/10/contrib/libarchive/libarchive/archive_write_set_format_ar.c   
Fri Aug  4 23:34:25 2017(r322071)
+++ stable/10/contrib/libarchive/libarchive/archive_write_set_format_ar.c   
Fri Aug  4 23:34:39 2017(r322072)
@@ -374,13 +374,14 @@ archive_write_ar_data(struct archive_write *a, const v
return (ARCHIVE_WARN);
}
 
-   ar->strtab = (char *)malloc(s);
+   ar->strtab = (char *)malloc(s + 1);
if (ar->strtab == NULL) {
archive_set_error(>archive, ENOMEM,
"Can't allocate strtab buffer");
return (ARCHIVE_FATAL);
}
-   strncpy(ar->strtab, buff, s);
+   memcpy(ar->strtab, buff, s);
+   ar->strtab[s] = '\0';
ar->has_strtab = 1;
}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r322063 - stable/10/sys/amd64/amd64

2017-08-04 Thread Marius Strobl
Author: marius
Date: Fri Aug  4 21:38:34 2017
New Revision: 322063
URL: https://svnweb.freebsd.org/changeset/base/322063

Log:
  MFC: r290156, r318354
  
  pmap_change_attr: Only fixup DMAP for DMAPed ranges

Modified:
  stable/10/sys/amd64/amd64/pmap.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/amd64/pmap.c
==
--- stable/10/sys/amd64/amd64/pmap.cFri Aug  4 21:06:47 2017
(r322062)
+++ stable/10/sys/amd64/amd64/pmap.cFri Aug  4 21:38:34 2017
(r322063)
@@ -6559,7 +6559,7 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size
 */
for (tmpva = base; tmpva < base + size; ) {
pdpe = pmap_pdpe(kernel_pmap, tmpva);
-   if (*pdpe == 0)
+   if (pdpe == NULL || *pdpe == 0)
return (EINVAL);
if (*pdpe & PG_PS) {
/*
@@ -6632,7 +6632,8 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size
X86_PG_PDE_CACHE);
changed = TRUE;
}
-   if (tmpva >= VM_MIN_KERNEL_ADDRESS) {
+   if (tmpva >= VM_MIN_KERNEL_ADDRESS &&
+   (*pdpe & PG_PS_FRAME) < dmaplimit) {
if (pa_start == pa_end) {
/* Start physical address run. */
pa_start = *pdpe & PG_PS_FRAME;
@@ -6661,7 +6662,8 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size
X86_PG_PDE_CACHE);
changed = TRUE;
}
-   if (tmpva >= VM_MIN_KERNEL_ADDRESS) {
+   if (tmpva >= VM_MIN_KERNEL_ADDRESS &&
+   (*pde & PG_PS_FRAME) < dmaplimit) {
if (pa_start == pa_end) {
/* Start physical address run. */
pa_start = *pde & PG_PS_FRAME;
@@ -6688,7 +6690,8 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size
X86_PG_PTE_CACHE);
changed = TRUE;
}
-   if (tmpva >= VM_MIN_KERNEL_ADDRESS) {
+   if (tmpva >= VM_MIN_KERNEL_ADDRESS &&
+   (*pte & PG_FRAME) < dmaplimit) {
if (pa_start == pa_end) {
/* Start physical address run. */
pa_start = *pte & PG_FRAME;
___
svn-src-all@freebsd.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: r322062 - head/sbin/ifconfig

2017-08-04 Thread Matt Joras
Author: mjoras
Date: Fri Aug  4 21:06:47 2017
New Revision: 322062
URL: https://svnweb.freebsd.org/changeset/base/322062

Log:
  Selectively print "hwaddr" from ifconfig(8).
  
  ifconfig(8) printing the hwaddr is only really useful if it differs from
  the link layer address.
  
  Reported by:  jhb
  Reviewed by:  rpokala
  Approved by:  rstone (mentor)
  Differential Revision:https://reviews.freebsd.org/D11777

Modified:
  head/sbin/ifconfig/af_link.c

Modified: head/sbin/ifconfig/af_link.c
==
--- head/sbin/ifconfig/af_link.cFri Aug  4 20:24:23 2017
(r322061)
+++ head/sbin/ifconfig/af_link.cFri Aug  4 21:06:47 2017
(r322062)
@@ -108,7 +108,15 @@ link_status(int s __unused, const struct ifaddrs *ifa)
if (rc != 0) {
return;
}
-   if (memcmp(ifr.ifr_addr.sa_data, laggaddr, 
sdl->sdl_alen) == 0) {
+
+   /*
+* If this is definitely a lagg device or the hwaddr
+* matches the link addr, don't bother.
+*/
+   if (memcmp(ifr.ifr_addr.sa_data, laggaddr,
+   sdl->sdl_alen) == 0 ||
+   memcmp(ifr.ifr_addr.sa_data, LLADDR(sdl),
+   sdl->sdl_alen) == 0) {
return;
}
ether_format = ether_ntoa((const struct ether_addr *)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r322061 - stable/10/sys/net80211

2017-08-04 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Aug  4 20:24:23 2017
New Revision: 322061
URL: https://svnweb.freebsd.org/changeset/base/322061

Log:
  MFC r321838:
  sys/net8021: Add missing braces in setcurchan().
  
  Also fix some indentation.
  
  Obtained from:DragonFlyBSD (git c69e37d6)

Modified:
  stable/10/sys/net80211/ieee80211_ioctl.c
  stable/10/sys/net80211/ieee80211_mesh.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/net80211/ieee80211_ioctl.c
==
--- stable/10/sys/net80211/ieee80211_ioctl.cFri Aug  4 20:22:43 2017
(r322060)
+++ stable/10/sys/net80211/ieee80211_ioctl.cFri Aug  4 20:24:23 2017
(r322061)
@@ -1970,9 +1970,10 @@ setcurchan(struct ieee80211vap *vap, struct ieee80211_
/* XXX need state machine for other vap's to follow */
ieee80211_setcurchan(ic, vap->iv_des_chan);
vap->iv_bss->ni_chan = ic->ic_curchan;
-   } else
+   } else {
ic->ic_curchan = vap->iv_des_chan;
ic->ic_rt = ieee80211_get_ratetable(ic->ic_curchan);
+   }
} else {
/*
 * Need to go through the state machine in case we

Modified: stable/10/sys/net80211/ieee80211_mesh.c
==
--- stable/10/sys/net80211/ieee80211_mesh.c Fri Aug  4 20:22:43 2017
(r322060)
+++ stable/10/sys/net80211/ieee80211_mesh.c Fri Aug  4 20:24:23 2017
(r322061)
@@ -2653,7 +2653,7 @@ mesh_recv_action_meshgate(struct ieee80211_node *ni,
/* popagate only if decremented ttl >= 1 && forwarding is enabled */
if ((ie.gann_ttl - 1) < 1 && !(ms->ms_flags & IEEE80211_MESHFLAGS_FWD))
return 0;
-   pgann.gann_flags = ie.gann_flags; /* Reserved */
+   pgann.gann_flags = ie.gann_flags; /* Reserved */
pgann.gann_hopcount = ie.gann_hopcount + 1;
pgann.gann_ttl = ie.gann_ttl - 1;
IEEE80211_ADDR_COPY(pgann.gann_addr, ie.gann_addr);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r322060 - stable/11/sys/net80211

2017-08-04 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Aug  4 20:22:43 2017
New Revision: 322060
URL: https://svnweb.freebsd.org/changeset/base/322060

Log:
  MFC r321838:
  sys/net8021: Add missing braces in setcurchan().
  
  Also fix some indentation.
  
  Obtained from:DragonFlyBSD (git c69e37d6)

Modified:
  stable/11/sys/net80211/ieee80211_ioctl.c
  stable/11/sys/net80211/ieee80211_mesh.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/net80211/ieee80211_ioctl.c
==
--- stable/11/sys/net80211/ieee80211_ioctl.cFri Aug  4 18:02:54 2017
(r322059)
+++ stable/11/sys/net80211/ieee80211_ioctl.cFri Aug  4 20:22:43 2017
(r322060)
@@ -1964,9 +1964,10 @@ setcurchan(struct ieee80211vap *vap, struct ieee80211_
/* XXX need state machine for other vap's to follow */
ieee80211_setcurchan(ic, vap->iv_des_chan);
vap->iv_bss->ni_chan = ic->ic_curchan;
-   } else
+   } else {
ic->ic_curchan = vap->iv_des_chan;
ic->ic_rt = ieee80211_get_ratetable(ic->ic_curchan);
+   }
} else {
/*
 * Need to go through the state machine in case we

Modified: stable/11/sys/net80211/ieee80211_mesh.c
==
--- stable/11/sys/net80211/ieee80211_mesh.c Fri Aug  4 18:02:54 2017
(r322059)
+++ stable/11/sys/net80211/ieee80211_mesh.c Fri Aug  4 20:22:43 2017
(r322060)
@@ -2630,7 +2630,7 @@ mesh_recv_action_meshgate(struct ieee80211_node *ni,
/* popagate only if decremented ttl >= 1 && forwarding is enabled */
if ((ie.gann_ttl - 1) < 1 && !(ms->ms_flags & IEEE80211_MESHFLAGS_FWD))
return 0;
-   pgann.gann_flags = ie.gann_flags; /* Reserved */
+   pgann.gann_flags = ie.gann_flags; /* Reserved */
pgann.gann_hopcount = ie.gann_hopcount + 1;
pgann.gann_ttl = ie.gann_ttl - 1;
IEEE80211_ADDR_COPY(pgann.gann_addr, ie.gann_addr);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r321369 - in head: . contrib/compiler-rt/include/sanitizer contrib/compiler-rt/include/xray contrib/compiler-rt/lib/asan contrib/compiler-rt/lib/builtins contrib/compiler-rt/lib/builti

2017-08-04 Thread Dimitry Andric
On 4 Aug 2017, at 19:46, Ngie Cooper (yaneurabeya)  
wrote:
> 
>> On Jul 22, 2017, at 04:08, Dimitry Andric  wrote:
>> 
>> Author: dim
>> Date: Sat Jul 22 11:08:25 2017
>> New Revision: 321369
>> URL: https://svnweb.freebsd.org/changeset/base/321369
>> 
>> Log:
>> Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
>> 5.0.0 (trunk r308421).  Upstream has branched for the 5.0.0 release,
>> which should be in about a month.  Please report bugs and regressions,
>> so we can get them into the release.
>> 
>> Please note that from 3.5.0 onwards, clang, llvm and lldb require C++11
>> support to build; see UPDATING for more information.
>> 
>> MFC after:   2 months
> 
> Hi Dmitry,
>   This commit changed a lot of mergeinfo under contrib/ and sys/contrib 
> unnecessarily — could you please revert those changes before merging back to 
> ^/head next time?

I would probably have liked to, but every time I merge back stuff from a
project branch, Subversion dies in interesting ways, because some sort
of mergeinfo is missing.  I would rather not mess with the mergeinfo
properties it has automatically added, I have *very* bad experiences
with that.

Of course, mergeinfo can always be removed later on from head, if it is
absolutely necessary.  But I would rather not touch it at all.  If the
Subversion authors think some mergeinfo must be automatically added,
they are probably right?

-Dimitry



signature.asc
Description: Message signed with OpenPGP


Re: svn commit: r322029 - in head: usr.bin usr.sbin

2017-08-04 Thread John Baldwin
On Thursday, August 03, 2017 09:30:12 PM Jeremie Le Hen wrote:
> Author: jlh
> Date: Thu Aug  3 21:30:12 2017
> New Revision: 322029
> URL: https://svnweb.freebsd.org/changeset/base/322029
> 
> Log:
>   rwho/ruptime/rwhod shouldn't be gated by RCMDS.
>   
>   PR: 220953
>   Reported by:peter@
>   Differential Revision:  https://reviews.freebsd.org/D11743
> 
> Modified:
>   head/usr.bin/Makefile
>   head/usr.sbin/Makefile

Don't forget to update tools/build/mk/OptionalObsoleteFiles.inc so that 
'make delete-old' doesn't incorrectly remove these.

The /etc/rc.d/rwhod script is also curently conditional on rcmds
(see etc/rc.d/Makefile) as is the 140.clean-rwho periodic script
(see etc/periodic/daily/Makefile).

-- 
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: r322059 - head/usr.sbin/pmcstat

2017-08-04 Thread Konstantin Belousov
Author: kib
Date: Fri Aug  4 18:02:54 2017
New Revision: 322059
URL: https://svnweb.freebsd.org/changeset/base/322059

Log:
  Fix off by one in calculation of the number of buckets for the pc
  addresses.
  
  Reviewed by:  markj
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D11864

Modified:
  head/usr.sbin/pmcstat/pmcpl_gprof.c

Modified: head/usr.sbin/pmcstat/pmcpl_gprof.c
==
--- head/usr.sbin/pmcstat/pmcpl_gprof.c Fri Aug  4 17:41:49 2017
(r322058)
+++ head/usr.sbin/pmcstat/pmcpl_gprof.c Fri Aug  4 18:02:54 2017
(r322059)
@@ -468,8 +468,8 @@ pmcpl_gmon_process(struct pmcstat_process *pp, struct 
image, pmcid);
pgf->pgf_pmcid = pmcid;
assert(image->pi_end > image->pi_start);
-   pgf->pgf_nbuckets = (image->pi_end - image->pi_start) /
-   FUNCTION_ALIGNMENT; /* see  */
+   pgf->pgf_nbuckets = howmany(image->pi_end - image->pi_start,
+   FUNCTION_ALIGNMENT);/* see  */
pgf->pgf_ndatabytes = sizeof(struct gmonhdr) +
pgf->pgf_nbuckets * hc_sz;
pgf->pgf_nsamples = 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: r321369 - in head: . contrib/compiler-rt/include/sanitizer contrib/compiler-rt/include/xray contrib/compiler-rt/lib/asan contrib/compiler-rt/lib/builtins contrib/compiler-rt/lib/builti

2017-08-04 Thread Ngie Cooper (yaneurabeya)

> On Jul 22, 2017, at 04:08, Dimitry Andric  wrote:
> 
> Author: dim
> Date: Sat Jul 22 11:08:25 2017
> New Revision: 321369
> URL: https://svnweb.freebsd.org/changeset/base/321369
> 
> Log:
>  Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
>  5.0.0 (trunk r308421).  Upstream has branched for the 5.0.0 release,
>  which should be in about a month.  Please report bugs and regressions,
>  so we can get them into the release.
> 
>  Please note that from 3.5.0 onwards, clang, llvm and lldb require C++11
>  support to build; see UPDATING for more information.
> 
>  MFC after:   2 months

Hi Dmitry,
This commit changed a lot of mergeinfo under contrib/ and sys/contrib 
unnecessarily — could you please revert those changes before merging back to 
^/head next time?
Thank you!
-Ngie


signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r322056 - in head/sys/boot/efi: include libefi loader

2017-08-04 Thread Warner Losh
Author: imp
Date: Fri Aug  4 16:33:36 2017
New Revision: 322056
URL: https://svnweb.freebsd.org/changeset/base/322056

Log:
  Move EFI fmtdev functionality to libefi
  
  This patch moves code necessary for the fmtdev functionality from
  loader to libefi, allowing other applications to make use of it
  
  Submitted by: Eric McCorkle
  Differential Revision: https://reviews.freebsd.org/D11862

Added:
  head/sys/boot/efi/libefi/devicename.c   (contents, props changed)
 - copied, changed from r322055, head/sys/boot/efi/loader/devicename.c
Deleted:
  head/sys/boot/efi/loader/devicename.c
Modified:
  head/sys/boot/efi/include/efilib.h
  head/sys/boot/efi/libefi/Makefile
  head/sys/boot/efi/loader/Makefile
  head/sys/boot/efi/loader/loader_efi.h

Modified: head/sys/boot/efi/include/efilib.h
==
--- head/sys/boot/efi/include/efilib.h  Fri Aug  4 15:57:10 2017
(r322055)
+++ head/sys/boot/efi/include/efilib.h  Fri Aug  4 16:33:36 2017
(r322056)
@@ -64,6 +64,11 @@ pdinfo_list_t *efiblk_get_pdinfo_list(struct devsw *de
 
 void *efi_get_table(EFI_GUID *tbl);
 
+int efi_getdev(void **vdev, const char *devspec, const char **path);
+char *efi_fmtdev(void *vdev);
+int efi_setcurrdev(struct env_var *ev, int flags, const void *value);
+
+
 int efi_register_handles(struct devsw *, EFI_HANDLE *, EFI_HANDLE *, int);
 EFI_HANDLE efi_find_handle(struct devsw *, int);
 int efi_handle_lookup(EFI_HANDLE, struct devsw **, int *,  uint64_t *);

Modified: head/sys/boot/efi/libefi/Makefile
==
--- head/sys/boot/efi/libefi/Makefile   Fri Aug  4 15:57:10 2017
(r322055)
+++ head/sys/boot/efi/libefi/Makefile   Fri Aug  4 16:33:36 2017
(r322056)
@@ -12,7 +12,7 @@ INTERNALLIB=
 WARNS?=2
 
 SRCS=  delay.c devpath.c efi_console.c efinet.c efipart.c env.c errno.c \
-   handles.c wchar.c libefi.c efi_driver_utils.c efizfs.c
+   handles.c wchar.c libefi.c efi_driver_utils.c efizfs.c devicename.c
 
 .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
 SRCS+= time.c

Copied and modified: head/sys/boot/efi/libefi/devicename.c (from r322055, 
head/sys/boot/efi/loader/devicename.c)
==
--- head/sys/boot/efi/loader/devicename.c   Fri Aug  4 15:57:10 2017
(r322055, copy source)
+++ head/sys/boot/efi/libefi/devicename.c   Fri Aug  4 16:33:36 2017
(r322056)
@@ -41,8 +41,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include "loader_efi.h"
-
 static int efi_parsedev(struct devdesc **, const char *, const char **);
 
 /*

Modified: head/sys/boot/efi/loader/Makefile
==
--- head/sys/boot/efi/loader/Makefile   Fri Aug  4 15:57:10 2017
(r322055)
+++ head/sys/boot/efi/loader/Makefile   Fri Aug  4 16:33:36 2017
(r322056)
@@ -16,7 +16,6 @@ SRCS= autoload.c \
bootinfo.c \
conf.c \
copy.c \
-   devicename.c \
main.c \
self_reloc.c \
smbios.c \

Modified: head/sys/boot/efi/loader/loader_efi.h
==
--- head/sys/boot/efi/loader/loader_efi.h   Fri Aug  4 15:57:10 2017
(r322055)
+++ head/sys/boot/efi/loader/loader_efi.h   Fri Aug  4 16:33:36 2017
(r322056)
@@ -35,10 +35,6 @@
 
 intefi_autoload(void);
 
-intefi_getdev(void **vdev, const char *devspec, const char **path);
-char   *efi_fmtdev(void *vdev);
-intefi_setcurrdev(struct env_var *ev, int flags, const void *value);
-
 intefi_copy_init(void);
 
 ssize_tefi_copyin(const void *src, vm_offset_t dest, const size_t len);
___
svn-src-all@freebsd.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: r322055 - in head/sys/dev/cxgbe: . common

2017-08-04 Thread Navdeep Parhar
Author: np
Date: Fri Aug  4 15:57:10 2017
New Revision: 322055
URL: https://svnweb.freebsd.org/changeset/base/322055

Log:
  cxgbe(4): Allow the TOE timer tunables to be set with microsecond
  precision.  These timers are already displayed in microseconds in the
  sysctl MIB.  Add variables to track these tunables while here.
  
  MFC after:3 days
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/common/common.h
  head/sys/dev/cxgbe/t4_main.c

Modified: head/sys/dev/cxgbe/common/common.h
==
--- head/sys/dev/cxgbe/common/common.h  Fri Aug  4 14:24:24 2017
(r322054)
+++ head/sys/dev/cxgbe/common/common.h  Fri Aug  4 15:57:10 2017
(r322055)
@@ -501,13 +501,10 @@ static inline unsigned int dack_ticks_to_usec(const st
return (ticks << adap->params.tp.dack_re) / core_ticks_per_usec(adap);
 }
 
-static inline u_int ms_to_tcp_ticks(const struct adapter *adap, u_int ms)
+static inline u_int us_to_tcp_ticks(const struct adapter *adap, u_long us)
 {
-   u_long l;
 
-   l = (u_long)ms * adap->params.vpd.cclk >> adap->params.tp.tre;
-
-   return (l);
+   return (us * adap->params.vpd.cclk / 1000 >> adap->params.tp.tre);
 }
 
 void t4_set_reg_field(struct adapter *adap, unsigned int addr, u32 mask, u32 
val);

Modified: head/sys/dev/cxgbe/t4_main.c
==
--- head/sys/dev/cxgbe/t4_main.cFri Aug  4 14:24:24 2017
(r322054)
+++ head/sys/dev/cxgbe/t4_main.cFri Aug  4 15:57:10 2017
(r322055)
@@ -294,6 +294,51 @@ TUNABLE_INT("hw.cxgbe.nofldtxq_vi", _nofldtxq_vi);
 #define NOFLDRXQ_VI 1
 static int t4_nofldrxq_vi = -NOFLDRXQ_VI;
 TUNABLE_INT("hw.cxgbe.nofldrxq_vi", _nofldrxq_vi);
+
+/* 0 means chip/fw default, non-zero number is value in microseconds */
+static u_long t4_toe_keepalive_idle = 0;
+TUNABLE_ULONG("hw.cxgbe.toe.keepalive_idle", _toe_keepalive_idle);
+
+/* 0 means chip/fw default, non-zero number is value in microseconds */
+static u_long t4_toe_keepalive_interval = 0;
+TUNABLE_ULONG("hw.cxgbe.toe.keepalive_interval", _toe_keepalive_interval);
+
+/* 0 means chip/fw default, non-zero number is # of keepalives before abort */
+static int t4_toe_keepalive_count = 0;
+TUNABLE_INT("hw.cxgbe.toe.keepalive_count", _toe_keepalive_count);
+
+/* 0 means chip/fw default, non-zero number is value in microseconds */
+static u_long t4_toe_rexmt_min = 0;
+TUNABLE_ULONG("hw.cxgbe.toe.rexmt_min", _toe_rexmt_min);
+
+/* 0 means chip/fw default, non-zero number is value in microseconds */
+static u_long t4_toe_rexmt_max = 0;
+TUNABLE_ULONG("hw.cxgbe.toe.rexmt_max", _toe_rexmt_max);
+
+/* 0 means chip/fw default, non-zero number is # of rexmt before abort */
+static int t4_toe_rexmt_count = 0;
+TUNABLE_INT("hw.cxgbe.toe.rexmt_count", _toe_rexmt_count);
+
+/* -1 means chip/fw default, other values are raw backoff values to use */
+static int t4_toe_rexmt_backoff[16] = {
+   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
+};
+TUNABLE_INT("hw.cxgbe.toe.rexmt_backoff.0", _toe_rexmt_backoff[0]);
+TUNABLE_INT("hw.cxgbe.toe.rexmt_backoff.1", _toe_rexmt_backoff[1]);
+TUNABLE_INT("hw.cxgbe.toe.rexmt_backoff.2", _toe_rexmt_backoff[2]);
+TUNABLE_INT("hw.cxgbe.toe.rexmt_backoff.3", _toe_rexmt_backoff[3]);
+TUNABLE_INT("hw.cxgbe.toe.rexmt_backoff.4", _toe_rexmt_backoff[4]);
+TUNABLE_INT("hw.cxgbe.toe.rexmt_backoff.5", _toe_rexmt_backoff[5]);
+TUNABLE_INT("hw.cxgbe.toe.rexmt_backoff.6", _toe_rexmt_backoff[6]);
+TUNABLE_INT("hw.cxgbe.toe.rexmt_backoff.7", _toe_rexmt_backoff[7]);
+TUNABLE_INT("hw.cxgbe.toe.rexmt_backoff.8", _toe_rexmt_backoff[8]);
+TUNABLE_INT("hw.cxgbe.toe.rexmt_backoff.9", _toe_rexmt_backoff[9]);
+TUNABLE_INT("hw.cxgbe.toe.rexmt_backoff.10", _toe_rexmt_backoff[10]);
+TUNABLE_INT("hw.cxgbe.toe.rexmt_backoff.11", _toe_rexmt_backoff[11]);
+TUNABLE_INT("hw.cxgbe.toe.rexmt_backoff.12", _toe_rexmt_backoff[12]);
+TUNABLE_INT("hw.cxgbe.toe.rexmt_backoff.13", _toe_rexmt_backoff[13]);
+TUNABLE_INT("hw.cxgbe.toe.rexmt_backoff.14", _toe_rexmt_backoff[14]);
+TUNABLE_INT("hw.cxgbe.toe.rexmt_backoff.15", _toe_rexmt_backoff[15]);
 #endif
 
 #ifdef DEV_NETMAP
@@ -3611,62 +3656,70 @@ static int
 set_params__post_init(struct adapter *sc)
 {
uint32_t param, val;
+#ifdef TCP_OFFLOAD
int i, v, shift;
-   char s[32];
+#endif
 
/* ask for encapsulated CPLs */
param = FW_PARAM_PFVF(CPLFW4MSG_ENCAP);
val = 1;
(void)t4_set_params(sc, sc->mbox, sc->pf, 0, 1, , );
 
+#ifdef TCP_OFFLOAD
/*
 * Override the TOE timers with user provided tunables.  This is not the
 * recommended way to change the timers (the firmware config file is) so
 * these tunables are not documented.
 *
-* All the timer tunables are in milliseconds.
+* All the timer tunables are in microseconds.
 */
-   if 

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

2017-08-04 Thread Alan Cox
On 08/04/2017 02:57, Oliver Pinter wrote:
>
>
> On Friday, August 4, 2017, Alan Cox  > wrote:
>
> Author: alc
> Date: Fri Aug  4 04:23:23 2017
> New Revision: 322041
> URL: https://svnweb.freebsd.org/changeset/base/322041
> 
>
> Log:
>   In case readers are misled by expressions that combine
> multiplication and
>   division, add parentheses to make the precedence explicit.
>
>   Submitted by: Doug Moore >
>   Requested by: imp
>   Reviewed by:  imp
>   MFC after:1 week
>   X-MFC after:  r321840
>   Differential Revision:https://reviews.freebsd.org/D11815
> 
>
> Modified:
>   head/sys/kern/subr_blist.c
>
> Modified: head/sys/kern/subr_blist.c
> 
> ==
> --- head/sys/kern/subr_blist.c  Fri Aug  4 04:20:11 2017   
> (r322040)
> +++ head/sys/kern/subr_blist.c  Fri Aug  4 04:23:23 2017   
> (r322041)
> @@ -110,6 +110,7 @@ __FBSDID("$FreeBSD$");
>  #definebitcount64(x)   __bitcount64((uint64_t)(x))
>  #define malloc(a,b,c)  calloc(a, 1)
>  #define free(a,b)  free(a)
> +#define CTASSERT(expr)
>
>
> Is this dummy define intended? 
>  

Yes, it is for user-space, stand-alone compilation of this file.

>
>  #include 
>
> @@ -142,6 +143,8 @@ static void blst_radix_print(blmeta_t *scan,
> daddr_t b
>  static MALLOC_DEFINE(M_SWAP, "SWAP", "Swap space");
>  #endif
>
> +CTASSERT(BLIST_BMAP_RADIX % BLIST_META_RADIX == 0);
> +
>  /*
>   * For a subtree that can represent the state of up to 'radix'
> blocks, the
>   * number of leaf nodes of the subtree is
> L=radix/BLIST_BMAP_RADIX.  If 'm'
> @@ -151,17 +154,19 @@ static MALLOC_DEFINE(M_SWAP, "SWAP", "Swap
> space");
>   * in the 'meta' functions that process subtrees.  Since integer
> division
>   * discards remainders, we can express this computation as
>   * skip = (m * m**h) / (m - 1)
> - * skip = (m * radix / BLIST_BMAP_RADIX) / (m - 1)
> - * and if m divides BLIST_BMAP_RADIX, we can simplify further to
> - * skip = radix / (BLIST_BMAP_RADIX / m * (m - 1))
> - * so that a simple integer division is enough for the calculation.
> + * skip = (m * (radix / BLIST_BMAP_RADIX)) / (m - 1)
> + * and since m divides BLIST_BMAP_RADIX, we can simplify further to
> + * skip = (radix / (BLIST_BMAP_RADIX / m)) / (m - 1)
> + * skip = radix / ((BLIST_BMAP_RADIX / m) * (m - 1))
> + * so that simple integer division by a constant can safely be
> used for the
> + * calculation.
>   */
>  static inline daddr_t
>  radix_to_skip(daddr_t radix)
>  {
>
> return (radix /
> -   (BLIST_BMAP_RADIX / BLIST_META_RADIX *
> (BLIST_META_RADIX - 1)));
> +   ((BLIST_BMAP_RADIX / BLIST_META_RADIX) *
> (BLIST_META_RADIX - 1)));
>  }
>
>  /*
> ___
> svn-src-h...@freebsd.org  mailing list
> https://lists.freebsd.org/mailman/listinfo/svn-src-head
> 
> To unsubscribe, send any mail to
> "svn-src-head-unsubscr...@freebsd.org "
>

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r322029 - in head: usr.bin usr.sbin

2017-08-04 Thread Jeremie Le Hen
On Fri, Aug 4, 2017 at 12:42 AM, Ngie Cooper (yaneurabeya)
 wrote:
>
>> On Aug 3, 2017, at 14:30, Jeremie Le Hen  wrote:
>>
>> Author: jlh
>> Date: Thu Aug  3 21:30:12 2017
>> New Revision: 322029
>> URL: https://svnweb.freebsd.org/changeset/base/322029
>>
>> Log:
>>  rwho/ruptime/rwhod shouldn't be gated by RCMDS.
>
> The why in this commit and the next you made (r322031) would have 
> been incredibly helpful. If bugzilla disappears I only have the commit 
> history tracking the what.

I agree, I realized this only afterwards.  I don't know how to fix this though.

> Cheers,
> -Ngie



-- 
Jeremie Le Hen
j...@freebsd.org
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r322054 - head/lib/libutil

2017-08-04 Thread Mariusz Zaborski
Author: oshogbo
Date: Fri Aug  4 14:24:24 2017
New Revision: 322054
URL: https://svnweb.freebsd.org/changeset/base/322054

Log:
  Introduce the flopenat(3) function.
  
  Reviewed by:  des, emaste
  Differential Revision:https://reviews.freebsd.org/D11690

Modified:
  head/lib/libutil/Makefile
  head/lib/libutil/flopen.3
  head/lib/libutil/flopen.c
  head/lib/libutil/libutil.h

Modified: head/lib/libutil/Makefile
==
--- head/lib/libutil/Makefile   Fri Aug  4 13:08:45 2017(r322053)
+++ head/lib/libutil/Makefile   Fri Aug  4 14:24:24 2017(r322054)
@@ -35,6 +35,7 @@ MAN+= expand_number.3 flopen.3 fparseln.3 hexdump.3 \
property.3 pty.3 quotafile.3 realhostname.3 realhostname_sa.3 \
_secure_path.3 trimdomain.3 uucplock.3 pw_util.3
 MAN+=  login.conf.5
+MLINKS+=flopen.3 flopenat.3
 MLINKS+=kld.3 kld_isloaded.3 kld.3 kld_load.3
 MLINKS+=login_auth.3 auth_cat.3 login_auth.3 auth_checknologin.3
 MLINKS+=login_cap.3 login_close.3 login_cap.3 login_getcapbool.3 \

Modified: head/lib/libutil/flopen.3
==
--- head/lib/libutil/flopen.3   Fri Aug  4 13:08:45 2017(r322053)
+++ head/lib/libutil/flopen.3   Fri Aug  4 14:24:24 2017(r322054)
@@ -25,11 +25,12 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 6, 2009
+.Dd July 28, 2017
 .Dt FLOPEN 3
 .Os
 .Sh NAME
-.Nm flopen
+.Nm flopen ,
+.Nm flopenat
 .Nd "Reliably open and lock a file"
 .Sh LIBRARY
 .Lb libutil
@@ -40,6 +41,10 @@
 .Fn flopen "const char *path" "int flags"
 .Ft int
 .Fn flopen "const char *path" "int flags" "mode_t mode"
+.Ft int
+.Fn flopenat "int fd" "const char *path" "int flags"
+.Ft int
+.Fn flopenat "int fd" "const char *path" "int flags" "mode_t mode"
 .Sh DESCRIPTION
 The
 .Fn flopen
@@ -79,6 +84,27 @@ argument is required if
 .Va flags
 includes
 .Dv O_CREAT .
+.Pp
+The
+.Fn flopenat
+function is equivalent to the
+.Fn flopen
+function except in the case where the
+.Fa path
+specifies a relative path.
+In this case the file to be opened is determined relative to the directory
+associated with the file descriptor
+.Fa fd
+instead of the current working directory.
+If
+.Fn flopenat
+is passed the special value
+.Dv AT_FDCWD
+in the
+.Fa fd
+parameter, the current working directory is used
+and the behavior is identical to a call to
+.Fn flopen .
 .Sh RETURN VALUES
 If successful,
 .Fn flopen

Modified: head/lib/libutil/flopen.c
==
--- head/lib/libutil/flopen.c   Fri Aug  4 13:08:45 2017(r322053)
+++ head/lib/libutil/flopen.c   Fri Aug  4 14:24:24 2017(r322054)
@@ -45,8 +45,8 @@ __FBSDID("$FreeBSD$");
  * code's apparent simplicity; there would be no need for this function if it
  * was easy to get right.
  */
-int
-flopen(const char *path, int flags, ...)
+static int
+vflopenat(int dirfd, const char *path, int flags, va_list ap)
 {
int fd, operation, serrno, trunc;
struct stat sb, fsb;
@@ -58,11 +58,7 @@ flopen(const char *path, int flags, ...)
 
mode = 0;
if (flags & O_CREAT) {
-   va_list ap;
-
-   va_start(ap, flags);
mode = (mode_t)va_arg(ap, int); /* mode_t promoted to int */
-   va_end(ap);
}
 
 operation = LOCK_EX;
@@ -73,7 +69,7 @@ flopen(const char *path, int flags, ...)
flags &= ~O_TRUNC;
 
for (;;) {
-   if ((fd = open(path, flags, mode)) == -1)
+   if ((fd = openat(dirfd, path, flags, mode)) == -1)
/* non-existent or no access */
return (-1);
if (flock(fd, operation) == -1) {
@@ -83,7 +79,7 @@ flopen(const char *path, int flags, ...)
errno = serrno;
return (-1);
}
-   if (stat(path, ) == -1) {
+   if (fstatat(dirfd, path, , 0) == -1) {
/* disappeared from under our feet */
(void)close(fd);
continue;
@@ -122,4 +118,28 @@ flopen(const char *path, int flags, ...)
 #endif
return (fd);
}
+}
+
+int
+flopen(const char *path, int flags, ...)
+{
+   va_list ap;
+   int ret;
+
+   va_start(ap, flags);
+   ret = vflopenat(AT_FDCWD, path, flags, ap);
+   va_end(ap);
+   return (ret);
+}
+
+int
+flopenat(int dirfd, const char *path, int flags, ...)
+{
+   va_list ap;
+   int ret;
+
+   va_start(ap, flags);
+   ret = vflopenat(dirfd, path, flags, ap);
+   va_end(ap);
+   return (ret);
 }

Modified: head/lib/libutil/libutil.h
==
--- head/lib/libutil/libutil.h  Fri Aug  4 13:08:45 2017(r322053)
+++ head/lib/libutil/libutil.h  Fri Aug  4 14:24:24 2017

Re: svn commit: r321985 - head/sys/ofed/drivers/infiniband/core

2017-08-04 Thread Conrad Meyer
On Thu, Aug 3, 2017 at 11:40 PM, Colin Percival  wrote:
> On 08/03/17 23:28, Hans Petter Selasky wrote:
>> On 08/03/17 16:37, Conrad Meyer wrote:
>>> Is it not important that the subtraction and result are evaluated
>>> without truncation?
>>
>> ticks is a circular counter. Assuming time = 0 and jiffies = -1U, then 
>> "delay"
>> becomes a very large negative value, because long is used, and the delay <= 0
>> check, is no longer working like expected.
>>
>> Casting to "int" or truncating is the right thing to do in this case.
>
> Signed integer overflow is undefined.  Using 'int' is liable to cause problems
> after 2^32 ticks.

It is undefined in C, but defined in practice with -fwrapv, which the
kernel relies upon already.

Best,
Conrad
___
svn-src-all@freebsd.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: r322053 - head/sys/arm64/arm64

2017-08-04 Thread Andrew Turner
Author: andrew
Date: Fri Aug  4 13:08:45 2017
New Revision: 322053
URL: https://svnweb.freebsd.org/changeset/base/322053

Log:
  Start to teach the GICv3 driver about NUMA. On ThunderX we may have
  multiple ITS devices, however we only want a single ITS device to be
  configured on each CPU. To fix this only enable ITS when the node matches
  the CPUs node.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/arm64/arm64/gic_v3.c
  head/sys/arm64/arm64/gic_v3_fdt.c
  head/sys/arm64/arm64/gic_v3_var.h
  head/sys/arm64/arm64/gicv3_its.c

Modified: head/sys/arm64/arm64/gic_v3.c
==
--- head/sys/arm64/arm64/gic_v3.c   Fri Aug  4 12:57:24 2017
(r322052)
+++ head/sys/arm64/arm64/gic_v3.c   Fri Aug  4 13:08:45 2017
(r322053)
@@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$");
 #include "gic_v3_reg.h"
 #include "gic_v3_var.h"
 
+static bus_get_domain_t gic_v3_get_domain;
 static bus_read_ivar_t gic_v3_read_ivar;
 
 static pic_disable_intr_t gic_v3_disable_intr;
@@ -97,6 +98,7 @@ static device_method_t gic_v3_methods[] = {
DEVMETHOD(device_detach,gic_v3_detach),
 
/* Bus interface */
+   DEVMETHOD(bus_get_domain,   gic_v3_get_domain),
DEVMETHOD(bus_read_ivar,gic_v3_read_ivar),
 
/* Interrupt controller interface */
@@ -347,6 +349,19 @@ gic_v3_detach(device_t dev)
free(sc->gic_res, M_GIC_V3);
free(sc->gic_redists.regions, M_GIC_V3);
 
+   return (0);
+}
+
+static int
+gic_v3_get_domain(device_t dev, device_t child, int *domain)
+{
+   struct gic_v3_devinfo *di;
+
+   di = device_get_ivars(child);
+   if (di->gic_domain < 0)
+   return (ENOENT);
+
+   *domain = di->gic_domain;
return (0);
 }
 

Modified: head/sys/arm64/arm64/gic_v3_fdt.c
==
--- head/sys/arm64/arm64/gic_v3_fdt.c   Fri Aug  4 12:57:24 2017
(r322052)
+++ head/sys/arm64/arm64/gic_v3_fdt.c   Fri Aug  4 13:08:45 2017
(r322053)
@@ -186,6 +186,7 @@ error:
 
 /* OFW bus interface */
 struct gic_v3_ofw_devinfo {
+   struct gic_v3_devinfo   di_gic_dinfo;
struct ofw_bus_devinfo  di_dinfo;
struct resource_listdi_rl;
 };
@@ -281,6 +282,14 @@ gic_v3_ofw_bus_attach(device_t dev)
for (node = OF_child(parent); node > 0; node = OF_peer(node)) {
/* Allocate and populate devinfo. */
di = malloc(sizeof(*di), M_GIC_V3, M_WAITOK | M_ZERO);
+
+   /* Read the numa node, or -1 if there is none */
+   if (OF_getencprop(node, "numa-node-id",
+   >di_gic_dinfo.gic_domain,
+   sizeof(di->di_gic_dinfo.gic_domain)) <= 0) {
+   di->di_gic_dinfo.gic_domain = -1;
+   }
+
if (ofw_bus_gen_setup_devinfo(>di_dinfo, node)) {
if (bootverbose) {
device_printf(dev,

Modified: head/sys/arm64/arm64/gic_v3_var.h
==
--- head/sys/arm64/arm64/gic_v3_var.h   Fri Aug  4 12:57:24 2017
(r322052)
+++ head/sys/arm64/arm64/gic_v3_var.h   Fri Aug  4 13:08:45 2017
(r322053)
@@ -82,6 +82,11 @@ struct gic_v3_softc {
struct gic_v3_irqsrc*gic_irqs;
 };
 
+
+struct gic_v3_devinfo {
+   int gic_domain;
+};
+
 #define GIC_INTR_ISRC(sc, irq) (>gic_irqs[irq].gi_isrc)
 
 MALLOC_DECLARE(M_GIC_V3);

Modified: head/sys/arm64/arm64/gicv3_its.c
==
--- head/sys/arm64/arm64/gicv3_its.cFri Aug  4 12:57:24 2017
(r322052)
+++ head/sys/arm64/arm64/gicv3_its.cFri Aug  4 13:08:45 2017
(r322053)
@@ -576,6 +576,12 @@ its_init_cpu(device_t dev, struct gicv3_its_softc *sc)
uint64_t xbaser, tmp;
uint32_t ctlr;
u_int cpuid;
+   int domain;
+
+   if (bus_get_domain(dev, ) == 0) {
+   if (PCPU_GET(domain) != domain)
+   return (0);
+   }
 
gicv3 = device_get_parent(dev);
cpuid = PCPU_GET(cpuid);
___
svn-src-all@freebsd.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: r322052 - in head/crypto/openssh: . contrib/cygwin contrib/redhat contrib/suse openbsd-compat regress regress/unittests regress/unittests/conversion regress/unittests/match regress/unit...

2017-08-04 Thread Dag-Erling Smørgrav
Author: des
Date: Fri Aug  4 12:57:24 2017
New Revision: 322052
URL: https://svnweb.freebsd.org/changeset/base/322052

Log:
  Upgrade to OpenSSH 7.5p1.

Added:
  head/crypto/openssh/regress/unittests/conversion/
 - copied from r321987, 
vendor-crypto/openssh/dist/regress/unittests/conversion/
Deleted:
  head/crypto/openssh/auth1.c
Modified:
  head/crypto/openssh/ChangeLog
  head/crypto/openssh/INSTALL
  head/crypto/openssh/Makefile.in
  head/crypto/openssh/README
  head/crypto/openssh/auth-pam.c
  head/crypto/openssh/auth2-pubkey.c
  head/crypto/openssh/auth2.c
  head/crypto/openssh/channels.c
  head/crypto/openssh/channels.h
  head/crypto/openssh/clientloop.c
  head/crypto/openssh/compat.c
  head/crypto/openssh/config.h
  head/crypto/openssh/configure.ac
  head/crypto/openssh/contrib/cygwin/ssh-host-config
  head/crypto/openssh/contrib/redhat/openssh.spec
  head/crypto/openssh/contrib/suse/openssh.spec
  head/crypto/openssh/digest-openssl.c
  head/crypto/openssh/freebsd-configure.sh
  head/crypto/openssh/hostfile.c
  head/crypto/openssh/kex.c
  head/crypto/openssh/krl.c
  head/crypto/openssh/log.c
  head/crypto/openssh/match.c
  head/crypto/openssh/match.h
  head/crypto/openssh/misc.c
  head/crypto/openssh/monitor.c
  head/crypto/openssh/mux.c
  head/crypto/openssh/openbsd-compat/bsd-misc.c
  head/crypto/openssh/openbsd-compat/bsd-misc.h
  head/crypto/openssh/openbsd-compat/fmt_scaled.c
  head/crypto/openssh/packet.c
  head/crypto/openssh/packet.h
  head/crypto/openssh/pathnames.h
  head/crypto/openssh/readconf.c
  head/crypto/openssh/regress/Makefile
  head/crypto/openssh/regress/agent-getpeereid.sh
  head/crypto/openssh/regress/allow-deny-users.sh
  head/crypto/openssh/regress/cert-file.sh
  head/crypto/openssh/regress/forwarding.sh
  head/crypto/openssh/regress/integrity.sh
  head/crypto/openssh/regress/test-exec.sh
  head/crypto/openssh/regress/unittests/Makefile
  head/crypto/openssh/regress/unittests/match/tests.c
  head/crypto/openssh/regress/unittests/test_helper/test_helper.c
  head/crypto/openssh/regress/unittests/test_helper/test_helper.h
  head/crypto/openssh/regress/unittests/utf8/tests.c
  head/crypto/openssh/sandbox-seccomp-filter.c
  head/crypto/openssh/servconf.c
  head/crypto/openssh/serverloop.c
  head/crypto/openssh/session.c
  head/crypto/openssh/sftp-client.c
  head/crypto/openssh/sftp.c
  head/crypto/openssh/ssh-agent.c
  head/crypto/openssh/ssh-keygen.c
  head/crypto/openssh/ssh-keyscan.c
  head/crypto/openssh/ssh.c
  head/crypto/openssh/ssh_config
  head/crypto/openssh/ssh_config.5
  head/crypto/openssh/ssh_namespace.h
  head/crypto/openssh/sshconnect.c
  head/crypto/openssh/sshconnect1.c
  head/crypto/openssh/sshconnect2.c
  head/crypto/openssh/sshd.8
  head/crypto/openssh/sshd.c
  head/crypto/openssh/sshd_config
  head/crypto/openssh/sshd_config.5
  head/crypto/openssh/sshkey.c
  head/crypto/openssh/sshkey.h
  head/crypto/openssh/utf8.c
  head/crypto/openssh/version.h
Directory Properties:
  head/crypto/openssh/   (props changed)

Modified: head/crypto/openssh/ChangeLog
==
--- head/crypto/openssh/ChangeLog   Fri Aug  4 10:33:22 2017
(r322051)
+++ head/crypto/openssh/ChangeLog   Fri Aug  4 12:57:24 2017
(r322052)
@@ -1,3 +1,1174 @@
+commit d38f05dbdd291212bc95ea80648b72b7177e9f4e
+Author: Darren Tucker 
+Date:   Mon Mar 20 13:38:27 2017 +1100
+
+Add llabs() implementation.
+
+commit 72536316a219b7394996a74691a5d4ec197480f7
+Author: Damien Miller 
+Date:   Mon Mar 20 12:23:04 2017 +1100
+
+crank version numbers
+
+commit 3be52bc36bdfd24ded7e0f46999e7db520fb4e3f
+Author: d...@openbsd.org 
+Date:   Mon Mar 20 01:18:59 2017 +
+
+upstream commit
+
+openssh-7.5
+
+Upstream-ID: b8b9a4a949427c393cd868215e1724ceb3467ee5
+
+commit db84e52fe9cfad57f22e7e23c5fbf00092385129
+Author: Damien Miller 
+Date:   Mon Mar 20 12:07:20 2017 +1100
+
+I'm a doofus.
+
+Unbreak obvious syntax error.
+
+commit 89f04852db27643717c9c3a2b0dde97ae50099ee
+Author: Damien Miller 
+Date:   Mon Mar 20 11:53:34 2017 +1100
+
+on Cygwin, check paths from server for backslashes
+
+Pointed out by Jann Horn of Google Project Zero
+
+commit 7ef1f9bafc2cc8d97ff2fbd4f280002b6e8ea5d9
+Author: Damien Miller 
+Date:   Mon Mar 20 11:48:34 2017 +1100
+
+Yet another synonym for ASCII: "646"
+
+Used by NetBSD; this unbreaks mprintf() and friends there for the C
+locale (caught by dtucker@ and his menagerie of test systems).
+
+commit 9165abfea3f68a0c684a6ed2e575e59bc31a3a6b
+Author: Damien Miller 
+Date:   Mon Mar 20 09:58:34 2017 +1100
+
+create test mux socket in /tmp
+
+Creating the socket in $OBJ could blow past the (quite limited)
+path limit for Unix domain sockets. As a bandaid for bz#2660,
+reported by 

svn commit: r322051 - head/sys/arm64/arm64

2017-08-04 Thread Andrew Turner
Author: andrew
Date: Fri Aug  4 10:33:22 2017
New Revision: 322051
URL: https://svnweb.freebsd.org/changeset/base/322051

Log:
  Read the numa-node-id property from each CPU node. This will initially be
  used to support the dual package ThunderX where we need to send MSI/MSI-X
  interrupts to the same package as the device the interrupt came from.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/arm64/arm64/mp_machdep.c

Modified: head/sys/arm64/arm64/mp_machdep.c
==
--- head/sys/arm64/arm64/mp_machdep.c   Fri Aug  4 09:45:40 2017
(r322050)
+++ head/sys/arm64/arm64/mp_machdep.c   Fri Aug  4 10:33:22 2017
(r322051)
@@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$");
 
 #ifdef FDT
 #include 
+#include 
 #include 
 #endif
 
@@ -196,6 +197,10 @@ arm64_cpu_attach(device_t dev)
 
/* Set the device to start it later */
cpu_list[cpuid] = dev;
+
+   /* Try to read the numa node of this cpu */
+   OF_getencprop(ofw_bus_get_node(dev), "numa-node-id",
+   &__pcpu[cpuid].pc_domain, sizeof(__pcpu[cpuid].pc_domain));
 
return (0);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r322050 - head/sys/sys

2017-08-04 Thread Konstantin Belousov
Author: kib
Date: Fri Aug  4 09:45:40 2017
New Revision: 322050
URL: https://svnweb.freebsd.org/changeset/base/322050

Log:
  Relax visibility for some termios symbols.
  
  They are defined by XSI or newer SUS.
  This is a follow-up to r318780.
  
  Reported by:  jbeich
  Obtained from:DragonflyBSD commit e08b3836c962
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/sys/_termios.h

Modified: head/sys/sys/_termios.h
==
--- head/sys/sys/_termios.h Fri Aug  4 08:56:31 2017(r322049)
+++ head/sys/sys/_termios.h Fri Aug  4 09:45:40 2017(r322050)
@@ -91,8 +91,10 @@
 #defineICRNL   0x0100  /* map CR to NL (ala CRMOD) */
 #defineIXON0x0200  /* enable output flow control */
 #defineIXOFF   0x0400  /* enable input flow control */
-#if __BSD_VISIBLE
+#if __XSI_VISIBLE || __POSIX_VISIBLE >= 200809
 #defineIXANY   0x0800  /* any char will restart after 
stop */
+#endif
+#if __BSD_VISIBLE
 #defineIMAXBEL 0x2000  /* ring bell on input queue 
full */
 #endif
 
@@ -100,12 +102,16 @@
  * Output flags - software output processing
  */
 #defineOPOST   0x0001  /* enable following output 
processing */
-#if __BSD_VISIBLE
+#if __XSI_VISIBLE
 #defineONLCR   0x0002  /* map NL to CR-NL (ala CRMOD) 
*/
+#endif
+#if __BSD_VISIBLE
 #defineTABDLY  0x0004  /* tab delay mask */
 #defineTAB00x  /* no tab delay and 
expansion */
 #defineTAB30x0004  /* expand tabs to spaces */
 #defineONOEOT  0x0008  /* discard EOT's (^D) on 
output) */
+#endif
+#if __XSI_VISIBLE
 #defineOCRNL   0x0010  /* map CR to NL on output */
 #defineONOCR   0x0020  /* no CR output at column 0 */
 #defineONLRET  0x0040  /* NL performs CR function */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r322049 - head/share/man/man4

2017-08-04 Thread Brad Davis
Author: brd (doc,ports committer)
Date: Fri Aug  4 08:56:31 2017
New Revision: 322049
URL: https://svnweb.freebsd.org/changeset/base/322049

Log:
  Document usb verbosity levels
  
  Submitted by: Tom Jones 
  Approved by:  hselasky
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D11850

Modified:
  head/share/man/man4/ehci.4
  head/share/man/man4/ohci.4
  head/share/man/man4/ucom.4
  head/share/man/man4/ugen.4
  head/share/man/man4/uhci.4
  head/share/man/man4/uhid.4
  head/share/man/man4/ukbd.4
  head/share/man/man4/ums.4
  head/share/man/man4/uplcom.4
  head/share/man/man4/usb.4
  head/share/man/man4/xhci.4

Modified: head/share/man/man4/ehci.4
==
--- head/share/man/man4/ehci.4  Fri Aug  4 08:27:34 2017(r322048)
+++ head/share/man/man4/ehci.4  Fri Aug  4 08:56:31 2017(r322049)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 15, 2017
+.Dd August 3, 2017
 .Dt EHCI 4
 .Os
 .Sh NAME
@@ -69,16 +69,6 @@ but can be noticed since
 .Tn USB
 2.0 devices plugged in to the same
 connector appear to connect to different USB buses.
-.Sh SEE ALSO
-.Xr ohci 4 ,
-.Xr uhci 4 ,
-.Xr usb 4 ,
-.Xr xhci 4
-.Sh HISTORY
-The
-.Nm
-device driver first appeared in
-.Fx 5.1 .
 .Sh LOADER TUNABLES
 When the kernel has been compiled with
 .Cd options USB_DEBUG ,
@@ -98,4 +88,27 @@ The default value is 0 (off).
 .It Va hw.usb.ehci.no_hs
 This tunable disables USB devices to attach like HIGH-speed ones and will 
force all attached devices to attach to the FULL- or LOW-speed companion 
controller.
 The default value is 0 (off).
+.Sh MIB Variables
+The
+.Nm
+driver exposes the following variables in the
+.Va hw.usb.ehci
+branch of the
+.Xr sysctl 3
+MIB:
+.Bl -tag -width ".Va debug"
+.It Va debug
+Debug output level, where 0 is debugging disabled and larger values increase
+debug message verbosity.
+Default is 0.
 .El
+.Sh SEE ALSO
+.Xr ohci 4 ,
+.Xr uhci 4 ,
+.Xr usb 4 ,
+.Xr xhci 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 5.1 .

Modified: head/share/man/man4/ohci.4
==
--- head/share/man/man4/ohci.4  Fri Aug  4 08:27:34 2017(r322048)
+++ head/share/man/man4/ohci.4  Fri Aug  4 08:56:31 2017(r322049)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 23, 2005
+.Dd August 3, 2017
 .Dt OHCI 4
 .Os
 .Sh NAME
@@ -59,6 +59,19 @@ NVIDIA nForce3
 .It
 Sun PCIO-2 (RIO USB)
 .El
+.Sh MIB Variables
+The
+.Nm
+driver exposes the following variables in the
+.Va hw.usb.ohci
+branch of the
+.Xr sysctl 3
+MIB:
+.Bl -tag -width ".Va debug"
+.It Va debug
+Debug output level, where 0 is debugging disabled and larger values increase
+debug message verbosity.
+Default is 0.
 .Sh SEE ALSO
 .Xr ehci 4 ,
 .Xr uhci 4 ,

Modified: head/share/man/man4/ucom.4
==
--- head/share/man/man4/ucom.4  Fri Aug  4 08:27:34 2017(r322048)
+++ head/share/man/man4/ucom.4  Fri Aug  4 08:56:31 2017(r322049)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 26, 2017
+.Dd August 3, 2017
 .Dt UCOM 4
 .Os
 .Sh NAME
@@ -63,6 +63,21 @@ This means that normal programs such as
 or
 .Xr ppp 8
 can be used to access the device.
+.Sh MIB Variables
+The
+.Nm
+driver exposes the following variables in the
+.Va hw.usb.ucom
+branch of the
+.Xr sysctl 3
+MIB:
+.Bl -tag -width ".Va pps_mode"
+.It Va debug
+Debug output level, where 0 is debugging disabled and larger values increase
+debug message verbosity.
+Default is 0.
+.It Va pps_mode
+Enables and configure PPS capture mode as described below.
 .Sh Pulse Per Second (PPS) Timing Interface
 The
 .Nm

Modified: head/share/man/man4/ugen.4
==
--- head/share/man/man4/ugen.4  Fri Aug  4 08:27:34 2017(r322048)
+++ head/share/man/man4/ugen.4  Fri Aug  4 08:56:31 2017(r322049)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 16, 2014
+.Dd August 3, 2017
 .Dt UGEN 4
 .Os
 .Sh NAME
@@ -291,6 +291,19 @@ and
 .Va alt_index
 should be set to
 .Dv USB_CURRENT_ALT_INDEX .
+.Sh MIB Variables
+The
+.Nm
+driver exposes the following variables in the
+.Va hw.usb.ugen
+branch of the
+.Xr sysctl 3
+MIB:
+.Bl -tag -width ".Va debug"
+.It Va debug
+Debug output level, where 0 is debugging disabled and larger values increase
+debug message verbosity.
+Default is 0.
 .Sh FILES
 .Bl -tag -width ".Pa /dev/ugen Ns Ar N Ns Pa \&. Ns Ar E" -compact
 .It Pa /dev/ugen Ns Ar N Ns Pa \&. Ns Ar E

Modified: head/share/man/man4/uhci.4
==
--- head/share/man/man4/uhci.4  Fri Aug  4 08:27:34 2017(r322048)
+++ head/share/man/man4/uhci.4  Fri Aug  4 08:56:31 2017(r322049)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 20, 2005
+.Dd August 

svn commit: r322048 - stable/10/sys/ufs/ffs

2017-08-04 Thread Konstantin Belousov
Author: kib
Date: Fri Aug  4 08:27:34 2017
New Revision: 322048
URL: https://svnweb.freebsd.org/changeset/base/322048

Log:
  MFC r321349:
  Improve publication of the newly allocated snapdata.

Modified:
  stable/10/sys/ufs/ffs/ffs_snapshot.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/ufs/ffs/ffs_snapshot.c
==
--- stable/10/sys/ufs/ffs/ffs_snapshot.cFri Aug  4 08:26:19 2017
(r322047)
+++ stable/10/sys/ufs/ffs/ffs_snapshot.cFri Aug  4 08:27:34 2017
(r322048)
@@ -2643,8 +2643,8 @@ try_free_snapdata(struct vnode *devvp)
 static struct snapdata *
 ffs_snapdata_acquire(struct vnode *devvp)
 {
-   struct snapdata *nsn;
-   struct snapdata *sn;
+   struct snapdata *nsn, *sn;
+   int error;
 
/*
 * Allocate a free snapdata.  This is done before acquiring the
@@ -2652,23 +2652,37 @@ ffs_snapdata_acquire(struct vnode *devvp)
 * held.
 */
nsn = ffs_snapdata_alloc();
-   /*
-* If there snapshots already exist on this filesystem grab a
-* reference to the shared lock.  Otherwise this is the first
-* snapshot on this filesystem and we need to use our
-* pre-allocated snapdata.
-*/
-   VI_LOCK(devvp);
-   if (devvp->v_rdev->si_snapdata == NULL) {
-   devvp->v_rdev->si_snapdata = nsn;
-   nsn = NULL;
+
+   for (;;) {
+   VI_LOCK(devvp);
+   sn = devvp->v_rdev->si_snapdata;
+   if (sn == NULL) {
+   /*
+* This is the first snapshot on this
+* filesystem and we use our pre-allocated
+* snapdata.  Publish sn with the sn_lock
+* owned by us, to avoid the race.
+*/
+   error = lockmgr(>sn_lock, LK_EXCLUSIVE |
+   LK_NOWAIT, NULL);
+   if (error != 0)
+   panic("leaked sn, lockmgr error %d", error);
+   sn = devvp->v_rdev->si_snapdata = nsn;
+   VI_UNLOCK(devvp);
+   nsn = NULL;
+   break;
+   }
+
+   /*
+* There is a snapshots which already exists on this
+* filesystem, grab a reference to the common lock.
+*/
+   error = lockmgr(>sn_lock, LK_INTERLOCK |
+   LK_EXCLUSIVE | LK_SLEEPFAIL, VI_MTX(devvp));
+   if (error == 0)
+   break;
}
-   sn = devvp->v_rdev->si_snapdata;
-   /*
-* Acquire the snapshot lock.
-*/
-   lockmgr(>sn_lock,
-   LK_INTERLOCK | LK_EXCLUSIVE | LK_RETRY, VI_MTX(devvp));
+
/*
 * Free any unused snapdata.
 */
___
svn-src-all@freebsd.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: r322047 - stable/10/sys/ufs/ffs

2017-08-04 Thread Konstantin Belousov
Author: kib
Date: Fri Aug  4 08:26:19 2017
New Revision: 322047
URL: https://svnweb.freebsd.org/changeset/base/322047

Log:
  MFC r321348:
  Unlock correct lock in ffs_snapblkfree().

Modified:
  stable/10/sys/ufs/ffs/ffs_snapshot.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/ufs/ffs/ffs_snapshot.c
==
--- stable/10/sys/ufs/ffs/ffs_snapshot.cFri Aug  4 08:25:03 2017
(r322046)
+++ stable/10/sys/ufs/ffs/ffs_snapshot.cFri Aug  4 08:26:19 2017
(r322047)
@@ -1944,7 +1944,7 @@ retry:
 */
if (error != 0 && wkhd != NULL)
softdep_freework(wkhd);
-   lockmgr(vp->v_vnlock, LK_RELEASE, NULL);
+   lockmgr(>sn_lock, LK_RELEASE, NULL);
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: r322046 - stable/10/sys/ufs/ffs

2017-08-04 Thread Konstantin Belousov
Author: kib
Date: Fri Aug  4 08:25:03 2017
New Revision: 322046
URL: https://svnweb.freebsd.org/changeset/base/322046

Log:
  MFC r321347:
  Account for lock recursion when transfering snaplock to the vnode lock
  in ffs_snapremove().

Modified:
  stable/10/sys/ufs/ffs/ffs_snapshot.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/ufs/ffs/ffs_snapshot.c
==
--- stable/10/sys/ufs/ffs/ffs_snapshot.cFri Aug  4 08:20:26 2017
(r322045)
+++ stable/10/sys/ufs/ffs/ffs_snapshot.cFri Aug  4 08:25:03 2017
(r322046)
@@ -1607,7 +1607,7 @@ ffs_snapremove(vp)
struct buf *ibp;
struct fs *fs;
ufs2_daddr_t numblks, blkno, dblk;
-   int error, loc, last;
+   int error, i, last, loc;
struct snapdata *sn;
 
ip = VTOI(vp);
@@ -1627,10 +1627,14 @@ ffs_snapremove(vp)
ip->i_nextsnap.tqe_prev = 0;
VI_UNLOCK(devvp);
lockmgr(>v_lock, LK_EXCLUSIVE, NULL);
+   for (i = 0; i < sn->sn_lock.lk_recurse; i++)
+   lockmgr(>v_lock, LK_EXCLUSIVE, NULL);
KASSERT(vp->v_vnlock == >sn_lock,
("ffs_snapremove: lost lock mutation")); 
vp->v_vnlock = >v_lock;
VI_LOCK(devvp);
+   while (sn->sn_lock.lk_recurse > 0)
+   lockmgr(>sn_lock, LK_RELEASE, NULL);
lockmgr(>sn_lock, LK_RELEASE, NULL);
try_free_snapdata(devvp);
} 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: r322045 - stable/11/sys/ufs/ffs

2017-08-04 Thread Konstantin Belousov
Author: kib
Date: Fri Aug  4 08:20:26 2017
New Revision: 322045
URL: https://svnweb.freebsd.org/changeset/base/322045

Log:
  MFC r321349:
  Improve publication of the newly allocated snapdata.

Modified:
  stable/11/sys/ufs/ffs/ffs_snapshot.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/ufs/ffs/ffs_snapshot.c
==
--- stable/11/sys/ufs/ffs/ffs_snapshot.cFri Aug  4 08:18:17 2017
(r322044)
+++ stable/11/sys/ufs/ffs/ffs_snapshot.cFri Aug  4 08:20:26 2017
(r322045)
@@ -2647,8 +2647,8 @@ try_free_snapdata(struct vnode *devvp)
 static struct snapdata *
 ffs_snapdata_acquire(struct vnode *devvp)
 {
-   struct snapdata *nsn;
-   struct snapdata *sn;
+   struct snapdata *nsn, *sn;
+   int error;
 
/*
 * Allocate a free snapdata.  This is done before acquiring the
@@ -2656,23 +2656,37 @@ ffs_snapdata_acquire(struct vnode *devvp)
 * held.
 */
nsn = ffs_snapdata_alloc();
-   /*
-* If there snapshots already exist on this filesystem grab a
-* reference to the shared lock.  Otherwise this is the first
-* snapshot on this filesystem and we need to use our
-* pre-allocated snapdata.
-*/
-   VI_LOCK(devvp);
-   if (devvp->v_rdev->si_snapdata == NULL) {
-   devvp->v_rdev->si_snapdata = nsn;
-   nsn = NULL;
+
+   for (;;) {
+   VI_LOCK(devvp);
+   sn = devvp->v_rdev->si_snapdata;
+   if (sn == NULL) {
+   /*
+* This is the first snapshot on this
+* filesystem and we use our pre-allocated
+* snapdata.  Publish sn with the sn_lock
+* owned by us, to avoid the race.
+*/
+   error = lockmgr(>sn_lock, LK_EXCLUSIVE |
+   LK_NOWAIT, NULL);
+   if (error != 0)
+   panic("leaked sn, lockmgr error %d", error);
+   sn = devvp->v_rdev->si_snapdata = nsn;
+   VI_UNLOCK(devvp);
+   nsn = NULL;
+   break;
+   }
+
+   /*
+* There is a snapshots which already exists on this
+* filesystem, grab a reference to the common lock.
+*/
+   error = lockmgr(>sn_lock, LK_INTERLOCK |
+   LK_EXCLUSIVE | LK_SLEEPFAIL, VI_MTX(devvp));
+   if (error == 0)
+   break;
}
-   sn = devvp->v_rdev->si_snapdata;
-   /*
-* Acquire the snapshot lock.
-*/
-   lockmgr(>sn_lock,
-   LK_INTERLOCK | LK_EXCLUSIVE | LK_RETRY, VI_MTX(devvp));
+
/*
 * Free any unused snapdata.
 */
___
svn-src-all@freebsd.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: r322044 - stable/11/sys/ufs/ffs

2017-08-04 Thread Konstantin Belousov
Author: kib
Date: Fri Aug  4 08:18:17 2017
New Revision: 322044
URL: https://svnweb.freebsd.org/changeset/base/322044

Log:
  MFC r321348:
  Unlock correct lock in ffs_snapblkfree().

Modified:
  stable/11/sys/ufs/ffs/ffs_snapshot.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/ufs/ffs/ffs_snapshot.c
==
--- stable/11/sys/ufs/ffs/ffs_snapshot.cFri Aug  4 08:16:05 2017
(r322043)
+++ stable/11/sys/ufs/ffs/ffs_snapshot.cFri Aug  4 08:18:17 2017
(r322044)
@@ -1944,7 +1944,7 @@ retry:
 */
if (error != 0 && wkhd != NULL)
softdep_freework(wkhd);
-   lockmgr(vp->v_vnlock, LK_RELEASE, NULL);
+   lockmgr(>sn_lock, LK_RELEASE, NULL);
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: r322043 - stable/11/sys/ufs/ffs

2017-08-04 Thread Konstantin Belousov
Author: kib
Date: Fri Aug  4 08:16:05 2017
New Revision: 322043
URL: https://svnweb.freebsd.org/changeset/base/322043

Log:
  MFC r321347:
  Account for lock recursion when transfering snaplock to the vnode lock
  in ffs_snapremove().

Modified:
  stable/11/sys/ufs/ffs/ffs_snapshot.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/ufs/ffs/ffs_snapshot.c
==
--- stable/11/sys/ufs/ffs/ffs_snapshot.cFri Aug  4 08:12:19 2017
(r322042)
+++ stable/11/sys/ufs/ffs/ffs_snapshot.cFri Aug  4 08:16:05 2017
(r322043)
@@ -1607,7 +1607,7 @@ ffs_snapremove(vp)
struct buf *ibp;
struct fs *fs;
ufs2_daddr_t numblks, blkno, dblk;
-   int error, loc, last;
+   int error, i, last, loc;
struct snapdata *sn;
 
ip = VTOI(vp);
@@ -1627,10 +1627,14 @@ ffs_snapremove(vp)
ip->i_nextsnap.tqe_prev = 0;
VI_UNLOCK(devvp);
lockmgr(>v_lock, LK_EXCLUSIVE, NULL);
+   for (i = 0; i < sn->sn_lock.lk_recurse; i++)
+   lockmgr(>v_lock, LK_EXCLUSIVE, NULL);
KASSERT(vp->v_vnlock == >sn_lock,
("ffs_snapremove: lost lock mutation")); 
vp->v_vnlock = >v_lock;
VI_LOCK(devvp);
+   while (sn->sn_lock.lk_recurse > 0)
+   lockmgr(>sn_lock, LK_RELEASE, NULL);
lockmgr(>sn_lock, LK_RELEASE, NULL);
try_free_snapdata(devvp);
} 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: r322042 - stable/11/lib/libc/x86/sys

2017-08-04 Thread Konstantin Belousov
Author: kib
Date: Fri Aug  4 08:12:19 2017
New Revision: 322042
URL: https://svnweb.freebsd.org/changeset/base/322042

Log:
  MFC r321652:
  Simplify flow control.

Modified:
  stable/11/lib/libc/x86/sys/__vdso_gettc.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/x86/sys/__vdso_gettc.c
==
--- stable/11/lib/libc/x86/sys/__vdso_gettc.c   Fri Aug  4 04:23:23 2017
(r322041)
+++ stable/11/lib/libc/x86/sys/__vdso_gettc.c   Fri Aug  4 08:12:19 2017
(r322042)
@@ -146,25 +146,24 @@ __vdso_init_hpet(uint32_t u)
if (old_map != NULL)
return;
 
-   if (cap_getmode() == 0 && mode != 0)
-   goto fail;
+   /*
+* Explicitely check for the capability mode to avoid
+* triggering trap_enocap on the device open by absolute path.
+*/
+   if ((cap_getmode() == 0 && mode != 0) ||
+   (fd = _open(devname, O_RDONLY)) == -1) {
+   /* Prevent the caller from re-entering. */
+   atomic_cmpset_rel_ptr((volatile uintptr_t *)_dev_map[u],
+   (uintptr_t)old_map, (uintptr_t)MAP_FAILED);
+   return;
+   }
 
-   fd = _open(devname, O_RDONLY);
-   if (fd == -1)
-   goto fail;
-
new_map = mmap(NULL, PAGE_SIZE, PROT_READ, MAP_SHARED, fd, 0);
_close(fd);
if (atomic_cmpset_rel_ptr((volatile uintptr_t *)_dev_map[u],
(uintptr_t)old_map, (uintptr_t)new_map) == 0 &&
new_map != MAP_FAILED)
munmap((void *)new_map, PAGE_SIZE);
-
-   return;
-fail:
-   /* Prevent the caller from re-entering. */
-   atomic_cmpset_rel_ptr((volatile uintptr_t *)_dev_map[u],
-   (uintptr_t)old_map, (uintptr_t)MAP_FAILED);
 }
 
 #ifdef WANT_HYPERV
___
svn-src-all@freebsd.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: r322041 - head/sys/kern

2017-08-04 Thread Oliver Pinter
On Friday, August 4, 2017, Alan Cox  wrote:

> Author: alc
> Date: Fri Aug  4 04:23:23 2017
> New Revision: 322041
> URL: https://svnweb.freebsd.org/changeset/base/322041
>
> Log:
>   In case readers are misled by expressions that combine multiplication and
>   division, add parentheses to make the precedence explicit.
>
>   Submitted by: Doug Moore >
>   Requested by: imp
>   Reviewed by:  imp
>   MFC after:1 week
>   X-MFC after:  r321840
>   Differential Revision:https://reviews.freebsd.org/D11815
>
> Modified:
>   head/sys/kern/subr_blist.c
>
> Modified: head/sys/kern/subr_blist.c
> 
> ==
> --- head/sys/kern/subr_blist.c  Fri Aug  4 04:20:11 2017(r322040)
> +++ head/sys/kern/subr_blist.c  Fri Aug  4 04:23:23 2017(r322041)
> @@ -110,6 +110,7 @@ __FBSDID("$FreeBSD$");
>  #definebitcount64(x)   __bitcount64((uint64_t)(x))
>  #define malloc(a,b,c)  calloc(a, 1)
>  #define free(a,b)  free(a)
> +#define CTASSERT(expr)


Is this dummy define intended?


>
>  #include 
>
> @@ -142,6 +143,8 @@ static void blst_radix_print(blmeta_t *scan, daddr_t b
>  static MALLOC_DEFINE(M_SWAP, "SWAP", "Swap space");
>  #endif
>
> +CTASSERT(BLIST_BMAP_RADIX % BLIST_META_RADIX == 0);
> +
>  /*
>   * For a subtree that can represent the state of up to 'radix' blocks, the
>   * number of leaf nodes of the subtree is L=radix/BLIST_BMAP_RADIX.  If
> 'm'
> @@ -151,17 +154,19 @@ static MALLOC_DEFINE(M_SWAP, "SWAP", "Swap space");
>   * in the 'meta' functions that process subtrees.  Since integer division
>   * discards remainders, we can express this computation as
>   * skip = (m * m**h) / (m - 1)
> - * skip = (m * radix / BLIST_BMAP_RADIX) / (m - 1)
> - * and if m divides BLIST_BMAP_RADIX, we can simplify further to
> - * skip = radix / (BLIST_BMAP_RADIX / m * (m - 1))
> - * so that a simple integer division is enough for the calculation.
> + * skip = (m * (radix / BLIST_BMAP_RADIX)) / (m - 1)
> + * and since m divides BLIST_BMAP_RADIX, we can simplify further to
> + * skip = (radix / (BLIST_BMAP_RADIX / m)) / (m - 1)
> + * skip = radix / ((BLIST_BMAP_RADIX / m) * (m - 1))
> + * so that simple integer division by a constant can safely be used for
> the
> + * calculation.
>   */
>  static inline daddr_t
>  radix_to_skip(daddr_t radix)
>  {
>
> return (radix /
> -   (BLIST_BMAP_RADIX / BLIST_META_RADIX * (BLIST_META_RADIX -
> 1)));
> +   ((BLIST_BMAP_RADIX / BLIST_META_RADIX) * (BLIST_META_RADIX -
> 1)));
>  }
>
>  /*
> ___
> svn-src-h...@freebsd.org  mailing list
> https://lists.freebsd.org/mailman/listinfo/svn-src-head
> To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org
> "
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r321985 - head/sys/ofed/drivers/infiniband/core

2017-08-04 Thread Hans Petter Selasky

On 08/04/17 08:40, Colin Percival wrote:

Casting to "int" or truncating is the right thing to do in this case.

Signed integer overflow is undefined.  Using 'int' is liable to cause problems
after 2^32  ticks.



Hi,

If you check the code how this function is used, you'll see that the 
argument passed is computed from:


jiffies + n, where "n" is a relatively small value.

The <= 0 check is basically there to catch cases where the jiffies value 
has changed between the point where it was set and the point where the 
relative ticks timeout value "n" was extracted.


Basically the code is doing like this, reading the value of "jiffies" twice.

delay = (jiffies0 + n) - jiffies1;

if (delay <= 0)
delay = 1;

And then "delay" should be "int", because we are usually not dealing 
with timeouts greater than a few hundred seconds or so.


--HPS
___
svn-src-all@freebsd.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: r321985 - head/sys/ofed/drivers/infiniband/core

2017-08-04 Thread Colin Percival
On 08/03/17 23:28, Hans Petter Selasky wrote:
> On 08/03/17 16:37, Conrad Meyer wrote:
>> Is it not important that the subtraction and result are evaluated
>> without truncation?
> 
> ticks is a circular counter. Assuming time = 0 and jiffies = -1U, then "delay"
> becomes a very large negative value, because long is used, and the delay <= 0
> check, is no longer working like expected.
> 
> Casting to "int" or truncating is the right thing to do in this case.

Signed integer overflow is undefined.  Using 'int' is liable to cause problems
after 2^32 ticks.

Colin Percival

>>> Log:
>>>Ticks are 32-bit in FreeBSD.
>>>
>>>MFC after:3 days
>>>Sponsored by: Mellanox Technologies
>>>
>>> Modified:
>>>head/sys/ofed/drivers/infiniband/core/addr.c
>>>
>>> Modified: head/sys/ofed/drivers/infiniband/core/addr.c
>>> ==
>>> --- head/sys/ofed/drivers/infiniband/core/addr.cThu Aug  3 09:14:43
>>> 2017(r321984)
>>> +++ head/sys/ofed/drivers/infiniband/core/addr.cThu Aug  3 09:18:25
>>> 2017(r321985)
>>> @@ -187,10 +187,10 @@ EXPORT_SYMBOL(rdma_translate_ip);
>>>
>>>   static void set_timeout(unsigned long time)
>>>   {
>>> -   unsigned long delay;
>>> +   int delay;  /* under FreeBSD ticks are 32-bit */
>>>
>>>  delay = time - jiffies;
>>> -   if ((long)delay <= 0)
>>> +   if (delay <= 0)
>>>  delay = 1;
>>>
>>>  mod_delayed_work(addr_wq, , delay);

-- 
Colin Percival
Security Officer Emeritus, FreeBSD | The power to serve
Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid
___
svn-src-all@freebsd.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: r321985 - head/sys/ofed/drivers/infiniband/core

2017-08-04 Thread Hans Petter Selasky

On 08/03/17 16:37, Conrad Meyer wrote:

Hey Hans,

Is it not important that the subtraction and result are evaluated
without truncation?


Hi,

ticks is a circular counter. Assuming time = 0 and jiffies = -1U, then 
"delay" becomes a very large negative value, because long is used, and 
the delay <= 0 check, is no longer working like expected.


Casting to "int" or truncating is the right thing to do in this case.

--HPS



Thanks,
Conrad

On Thu, Aug 3, 2017 at 2:18 AM, Hans Petter Selasky
 wrote:

Author: hselasky
Date: Thu Aug  3 09:18:25 2017
New Revision: 321985
URL: https://svnweb.freebsd.org/changeset/base/321985

Log:
   Ticks are 32-bit in FreeBSD.

   MFC after:3 days
   Sponsored by: Mellanox Technologies

Modified:
   head/sys/ofed/drivers/infiniband/core/addr.c

Modified: head/sys/ofed/drivers/infiniband/core/addr.c
==
--- head/sys/ofed/drivers/infiniband/core/addr.cThu Aug  3 09:14:43 
2017(r321984)
+++ head/sys/ofed/drivers/infiniband/core/addr.cThu Aug  3 09:18:25 
2017(r321985)
@@ -187,10 +187,10 @@ EXPORT_SYMBOL(rdma_translate_ip);

  static void set_timeout(unsigned long time)
  {
-   unsigned long delay;
+   int delay;  /* under FreeBSD ticks are 32-bit */

 delay = time - jiffies;
-   if ((long)delay <= 0)
+   if (delay <= 0)
 delay = 1;

 mod_delayed_work(addr_wq, , delay);






___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"