svn commit: r340276 - in head: contrib/netbsd-tests/lib/libc/locale lib/libc/locale

2018-11-08 Thread Yuri Pankov
Author: yuripv
Date: Fri Nov  9 03:32:53 2018
New Revision: 340276
URL: https://svnweb.freebsd.org/changeset/base/340276

Log:
  Reset persistent mbstates when rune locale encoding changes.
  
  This was shown to be a problem by side effect of now-enabled test case,
  which was going through C, en_US.UTF-8, ja_JP.SJIS, and ja_JP.eucJP,
  and failing eventually as data in mbrtowc's mbstate, that was
  perfectly correct for en_US.UTF-8 was treated as incorrect for
  ja_JP.SJIS, failing the entire test case.
  
  This makes the persistent mbstates to be per ctype-component,
  and not per-locale so we could easily reset the mbstates when
  only LC_CTYPE is changed.
  
  Reviewed by:  bapt, pfg
  Approved by:  kib (mentor, implicit)
  Differential Revision:https://reviews.freebsd.org/D17796

Modified:
  head/contrib/netbsd-tests/lib/libc/locale/t_mbrtowc.c
  head/lib/libc/locale/cXXrtomb_iconv.h
  head/lib/libc/locale/mblen.c
  head/lib/libc/locale/mblocal.h
  head/lib/libc/locale/mbrlen.c
  head/lib/libc/locale/mbrtocXX_iconv.h
  head/lib/libc/locale/mbrtowc.c
  head/lib/libc/locale/mbsnrtowcs.c
  head/lib/libc/locale/mbsrtowcs.c
  head/lib/libc/locale/mbtowc.c
  head/lib/libc/locale/setrunelocale.c
  head/lib/libc/locale/wcrtomb.c
  head/lib/libc/locale/wcsnrtombs.c
  head/lib/libc/locale/wcsrtombs.c
  head/lib/libc/locale/wctomb.c
  head/lib/libc/locale/xlocale_private.h

Modified: head/contrib/netbsd-tests/lib/libc/locale/t_mbrtowc.c
==
--- head/contrib/netbsd-tests/lib/libc/locale/t_mbrtowc.c   Fri Nov  9 
00:46:50 2018(r340275)
+++ head/contrib/netbsd-tests/lib/libc/locale/t_mbrtowc.c   Fri Nov  9 
03:32:53 2018(r340276)
@@ -243,9 +243,6 @@ ATF_TC_BODY(mbrtowc_internal, tc)
 {
struct test *t;
 
-#ifdef __FreeBSD__
-   atf_tc_expect_fail("ja_* locale fails");
-#endif
for (t = [0]; t->data != NULL; ++t)
h_ctype2(t, false);
 }

Modified: head/lib/libc/locale/cXXrtomb_iconv.h
==
--- head/lib/libc/locale/cXXrtomb_iconv.h   Fri Nov  9 00:46:50 2018
(r340275)
+++ head/lib/libc/locale/cXXrtomb_iconv.h   Fri Nov  9 03:32:53 2018
(r340276)
@@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$");
 #include "../iconv/citrus_hash.h"
 #include "../iconv/citrus_module.h"
 #include "../iconv/citrus_iconv.h"
-#include "xlocale_private.h"
+#include "mblocal.h"
 
 typedef struct {
boolinitialized;
@@ -65,7 +65,7 @@ cXXrtomb_l(char * __restrict s, charXX_t c, mbstate_t 
 
FIX_LOCALE(locale);
if (ps == NULL)
-   ps = >cXXrtomb;
+   ps = &(XLOCALE_CTYPE(locale)->cXXrtomb);
cs = (_ConversionState *)ps;
handle = >iconv;
 

Modified: head/lib/libc/locale/mblen.c
==
--- head/lib/libc/locale/mblen.cFri Nov  9 00:46:50 2018
(r340275)
+++ head/lib/libc/locale/mblen.cFri Nov  9 03:32:53 2018
(r340276)
@@ -47,10 +47,11 @@ mblen_l(const char *s, size_t n, locale_t locale)
 
if (s == NULL) {
/* No support for state dependent encodings. */
-   locale->mblen = initial;
+   XLOCALE_CTYPE(locale)->mblen = initial;
return (0);
}
-   rval = XLOCALE_CTYPE(locale)->__mbrtowc(NULL, s, n, >mblen);
+   rval = XLOCALE_CTYPE(locale)->__mbrtowc(NULL, s, n,
+   &(XLOCALE_CTYPE(locale)->mblen));
if (rval == (size_t)-1 || rval == (size_t)-2)
return (-1);
return ((int)rval);

Modified: head/lib/libc/locale/mblocal.h
==
--- head/lib/libc/locale/mblocal.h  Fri Nov  9 00:46:50 2018
(r340275)
+++ head/lib/libc/locale/mblocal.h  Fri Nov  9 03:32:53 2018
(r340276)
@@ -60,6 +60,34 @@ struct xlocale_ctype {
size_t, size_t, mbstate_t * __restrict);
int __mb_cur_max;
int __mb_sb_limit;
+   /** Persistent state used by mblen() calls. */
+   __mbstate_t mblen;
+   /** Persistent state used by mbrlen() calls. */
+   __mbstate_t mbrlen;
+   /** Persistent state used by mbrtoc16() calls. */
+   __mbstate_t mbrtoc16;
+   /** Persistent state used by mbrtoc32() calls. */
+   __mbstate_t mbrtoc32;
+   /** Persistent state used by mbrtowc() calls. */
+   __mbstate_t mbrtowc;
+   /** Persistent state used by mbsnrtowcs() calls. */
+   __mbstate_t mbsnrtowcs;
+   /** Persistent state used by mbsrtowcs() calls. */
+   __mbstate_t mbsrtowcs;
+   /** Persistent state used by mbtowc() calls. */
+   __mbstate_t mbtowc;
+   /** Persistent state used by c16rtomb() calls. */
+   __mbstate_t c16rtomb;
+   /** Persistent state used by c32rtomb() 

svn commit: r340275 - head/sys/compat/freebsd32

2018-11-08 Thread Brooks Davis
Author: brooks
Date: Fri Nov  9 00:46:50 2018
New Revision: 340275
URL: https://svnweb.freebsd.org/changeset/base/340275

Log:
  Regen after r340274: Make freebsd32_utmx_op follow the freebsd32_foo
  convention.

Modified:
  head/sys/compat/freebsd32/freebsd32_proto.h
  head/sys/compat/freebsd32/freebsd32_syscall.h
  head/sys/compat/freebsd32/freebsd32_syscalls.c
  head/sys/compat/freebsd32/freebsd32_sysent.c
  head/sys/compat/freebsd32/freebsd32_systrace_args.c

Modified: head/sys/compat/freebsd32/freebsd32_proto.h
==
--- head/sys/compat/freebsd32/freebsd32_proto.h Fri Nov  9 00:46:10 2018
(r340274)
+++ head/sys/compat/freebsd32/freebsd32_proto.h Fri Nov  9 00:46:50 2018
(r340275)
@@ -350,7 +350,7 @@ struct freebsd32_ksem_timedwait_args {
 struct freebsd32_thr_suspend_args {
char timeout_l_[PADL_(const struct timespec32 *)]; const struct 
timespec32 * timeout; char timeout_r_[PADR_(const struct timespec32 *)];
 };
-struct freebsd32_umtx_op_args {
+struct freebsd32__umtx_op_args {
char obj_l_[PADL_(void *)]; void * obj; char obj_r_[PADR_(void *)];
char op_l_[PADL_(int)]; int op; char op_r_[PADR_(int)];
char val_l_[PADL_(u_long)]; u_long val; char val_r_[PADR_(u_long)];
@@ -776,7 +776,7 @@ int freebsd32_setcontext(struct thread *, struct freeb
 intfreebsd32_swapcontext(struct thread *, struct 
freebsd32_swapcontext_args *);
 intfreebsd32_ksem_timedwait(struct thread *, struct 
freebsd32_ksem_timedwait_args *);
 intfreebsd32_thr_suspend(struct thread *, struct 
freebsd32_thr_suspend_args *);
-intfreebsd32_umtx_op(struct thread *, struct freebsd32_umtx_op_args *);
+intfreebsd32__umtx_op(struct thread *, struct freebsd32__umtx_op_args *);
 intfreebsd32_thr_new(struct thread *, struct freebsd32_thr_new_args *);
 intfreebsd32_sigqueue(struct thread *, struct freebsd32_sigqueue_args *);
 intfreebsd32_kmq_open(struct thread *, struct freebsd32_kmq_open_args *);
@@ -1335,7 +1335,7 @@ int   freebsd11_freebsd32_mknodat(struct thread *, 
struc
 #defineFREEBSD32_SYS_AUE_freebsd32_swapcontext AUE_NULL
 #defineFREEBSD32_SYS_AUE_freebsd32_ksem_timedwait  AUE_SEMWAIT
 #defineFREEBSD32_SYS_AUE_freebsd32_thr_suspend AUE_NULL
-#defineFREEBSD32_SYS_AUE_freebsd32_umtx_op AUE_NULL
+#defineFREEBSD32_SYS_AUE_freebsd32__umtx_opAUE_NULL
 #defineFREEBSD32_SYS_AUE_freebsd32_thr_new AUE_THR_NEW
 #defineFREEBSD32_SYS_AUE_freebsd32_sigqueueAUE_NULL
 #defineFREEBSD32_SYS_AUE_freebsd32_kmq_openAUE_MQ_OPEN

Modified: head/sys/compat/freebsd32/freebsd32_syscall.h
==
--- head/sys/compat/freebsd32/freebsd32_syscall.h   Fri Nov  9 00:46:10 
2018(r340274)
+++ head/sys/compat/freebsd32/freebsd32_syscall.h   Fri Nov  9 00:46:50 
2018(r340275)
@@ -374,7 +374,7 @@
 #defineFREEBSD32_SYS_getaudit_addr 451
 #defineFREEBSD32_SYS_setaudit_addr 452
 #defineFREEBSD32_SYS_auditctl  453
-#defineFREEBSD32_SYS_freebsd32_umtx_op 454
+#defineFREEBSD32_SYS_freebsd32__umtx_op454
 #defineFREEBSD32_SYS_freebsd32_thr_new 455
 #defineFREEBSD32_SYS_freebsd32_sigqueue456
 #defineFREEBSD32_SYS_freebsd32_kmq_open457

Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c
==
--- head/sys/compat/freebsd32/freebsd32_syscalls.c  Fri Nov  9 00:46:10 
2018(r340274)
+++ head/sys/compat/freebsd32/freebsd32_syscalls.c  Fri Nov  9 00:46:50 
2018(r340275)
@@ -463,7 +463,7 @@ const char *freebsd32_syscallnames[] = {
"getaudit_addr",/* 451 = getaudit_addr */
"setaudit_addr",/* 452 = setaudit_addr */
"auditctl", /* 453 = auditctl */
-   "freebsd32_umtx_op",/* 454 = freebsd32_umtx_op */
+   "freebsd32__umtx_op",   /* 454 = freebsd32__umtx_op */
"freebsd32_thr_new",/* 455 = freebsd32_thr_new */
"freebsd32_sigqueue",   /* 456 = freebsd32_sigqueue */
"freebsd32_kmq_open",   /* 457 = freebsd32_kmq_open */

Modified: head/sys/compat/freebsd32/freebsd32_sysent.c
==
--- head/sys/compat/freebsd32/freebsd32_sysent.cFri Nov  9 00:46:10 
2018(r340274)
+++ head/sys/compat/freebsd32/freebsd32_sysent.cFri Nov  9 00:46:50 
2018(r340275)
@@ -510,7 +510,7 @@ struct sysent freebsd32_sysent[] = {
{ AS(getaudit_addr_args), (sy_call_t *)sys_getaudit_addr, 
AUE_GETAUDIT_ADDR, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },   /* 451 = 
getaudit_addr 

svn commit: r340274 - in head/sys: compat/freebsd32 kern

2018-11-08 Thread Brooks Davis
Author: brooks
Date: Fri Nov  9 00:46:10 2018
New Revision: 340274
URL: https://svnweb.freebsd.org/changeset/base/340274

Log:
  Make freebsd32_umtx_op follow the freebsd32_foo convention.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/compat/freebsd32/syscalls.master
  head/sys/kern/kern_umtx.c

Modified: head/sys/compat/freebsd32/syscalls.master
==
--- head/sys/compat/freebsd32/syscalls.master   Fri Nov  9 00:22:45 2018
(r340273)
+++ head/sys/compat/freebsd32/syscalls.master   Fri Nov  9 00:46:10 2018
(r340274)
@@ -821,7 +821,7 @@
struct auditinfo_addr *auditinfo_addr, \
u_int length); }
 453AUE_AUDITCTLNOPROTO { int auditctl(const char *path); }
-454AUE_NULLSTD { int freebsd32_umtx_op(void *obj, int op,\
+454AUE_NULLSTD { int freebsd32__umtx_op(void *obj, int op,\
u_long val, void *uaddr, \
void *uaddr2); }
 455AUE_THR_NEW STD { int freebsd32_thr_new(\

Modified: head/sys/kern/kern_umtx.c
==
--- head/sys/kern/kern_umtx.c   Fri Nov  9 00:22:45 2018(r340273)
+++ head/sys/kern/kern_umtx.c   Fri Nov  9 00:46:10 2018(r340274)
@@ -4351,7 +4351,7 @@ static const _umtx_op_func op_table_compat32[] = {
 };
 
 int
-freebsd32_umtx_op(struct thread *td, struct freebsd32_umtx_op_args *uap)
+freebsd32__umtx_op(struct thread *td, struct freebsd32__umtx_op_args *uap)
 {
 
if ((unsigned)uap->op < nitems(op_table_compat32)) {
___
svn-src-all@freebsd.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: r340273 - head/sys/compat/freebsd32

2018-11-08 Thread Brooks Davis
Author: brooks
Date: Fri Nov  9 00:22:45 2018
New Revision: 340273
URL: https://svnweb.freebsd.org/changeset/base/340273

Log:
  Regen after 340272: Make __sysctl follow the freebsd32_foo convention
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/compat/freebsd32/freebsd32_proto.h
  head/sys/compat/freebsd32/freebsd32_syscall.h
  head/sys/compat/freebsd32/freebsd32_syscalls.c
  head/sys/compat/freebsd32/freebsd32_sysent.c
  head/sys/compat/freebsd32/freebsd32_systrace_args.c

Modified: head/sys/compat/freebsd32/freebsd32_proto.h
==
--- head/sys/compat/freebsd32/freebsd32_proto.h Fri Nov  9 00:21:58 2018
(r340272)
+++ head/sys/compat/freebsd32/freebsd32_proto.h Fri Nov  9 00:22:45 2018
(r340273)
@@ -162,7 +162,7 @@ struct freebsd32_shmsys_args {
char a3_l_[PADL_(uint32_t)]; uint32_t a3; char a3_r_[PADR_(uint32_t)];
char a4_l_[PADL_(uint32_t)]; uint32_t a4; char a4_r_[PADR_(uint32_t)];
 };
-struct freebsd32_sysctl_args {
+struct freebsd32___sysctl_args {
char name_l_[PADL_(int *)]; int * name; char name_r_[PADR_(int *)];
char namelen_l_[PADL_(u_int)]; u_int namelen; char 
namelen_r_[PADR_(u_int)];
char old_l_[PADL_(void *)]; void * old; char old_r_[PADR_(void *)];
@@ -736,7 +736,7 @@ int freebsd32_sysarch(struct thread *, struct freebsd3
 intfreebsd32_semsys(struct thread *, struct freebsd32_semsys_args *);
 intfreebsd32_msgsys(struct thread *, struct freebsd32_msgsys_args *);
 intfreebsd32_shmsys(struct thread *, struct freebsd32_shmsys_args *);
-intfreebsd32_sysctl(struct thread *, struct freebsd32_sysctl_args *);
+intfreebsd32___sysctl(struct thread *, struct freebsd32___sysctl_args *);
 intfreebsd32_futimes(struct thread *, struct freebsd32_futimes_args *);
 intfreebsd32_msgsnd(struct thread *, struct freebsd32_msgsnd_args *);
 intfreebsd32_msgrcv(struct thread *, struct freebsd32_msgrcv_args *);
@@ -1282,7 +1282,7 @@ int   freebsd11_freebsd32_mknodat(struct thread *, 
struc
 #defineFREEBSD32_SYS_AUE_freebsd6_freebsd32_lseek  AUE_LSEEK
 #defineFREEBSD32_SYS_AUE_freebsd6_freebsd32_truncate   AUE_TRUNCATE
 #defineFREEBSD32_SYS_AUE_freebsd6_freebsd32_ftruncate  AUE_FTRUNCATE
-#defineFREEBSD32_SYS_AUE_freebsd32_sysctl  AUE_SYSCTL
+#defineFREEBSD32_SYS_AUE_freebsd32___sysctlAUE_SYSCTL
 #defineFREEBSD32_SYS_AUE_freebsd32_futimes AUE_FUTIMES
 #defineFREEBSD32_SYS_AUE_freebsd7_freebsd32_semctl AUE_SEMCTL
 #defineFREEBSD32_SYS_AUE_freebsd7_freebsd32_msgctl AUE_MSGCTL

Modified: head/sys/compat/freebsd32/freebsd32_syscall.h
==
--- head/sys/compat/freebsd32/freebsd32_syscall.h   Fri Nov  9 00:21:58 
2018(r340272)
+++ head/sys/compat/freebsd32/freebsd32_syscall.h   Fri Nov  9 00:22:45 
2018(r340273)
@@ -188,7 +188,7 @@
/* 199 is freebsd6 freebsd32_lseek */
/* 200 is freebsd6 freebsd32_truncate */
/* 201 is freebsd6 freebsd32_ftruncate */
-#defineFREEBSD32_SYS_freebsd32_sysctl  202
+#defineFREEBSD32_SYS_freebsd32___sysctl202
 #defineFREEBSD32_SYS_mlock 203
 #defineFREEBSD32_SYS_munlock   204
 #defineFREEBSD32_SYS_undelete  205

Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c
==
--- head/sys/compat/freebsd32/freebsd32_syscalls.c  Fri Nov  9 00:21:58 
2018(r340272)
+++ head/sys/compat/freebsd32/freebsd32_syscalls.c  Fri Nov  9 00:22:45 
2018(r340273)
@@ -211,7 +211,7 @@ const char *freebsd32_syscallnames[] = {
"compat6.freebsd32_lseek",  /* 199 = freebsd6 
freebsd32_lseek */
"compat6.freebsd32_truncate",   /* 200 = freebsd6 
freebsd32_truncate */
"compat6.freebsd32_ftruncate",  /* 201 = freebsd6 
freebsd32_ftruncate */
-   "freebsd32_sysctl", /* 202 = freebsd32_sysctl */
+   "freebsd32___sysctl",   /* 202 = freebsd32___sysctl */
"mlock",/* 203 = mlock */
"munlock",  /* 204 = munlock */
"undelete", /* 205 = undelete */

Modified: head/sys/compat/freebsd32/freebsd32_sysent.c
==
--- head/sys/compat/freebsd32/freebsd32_sysent.cFri Nov  9 00:21:58 
2018(r340272)
+++ head/sys/compat/freebsd32/freebsd32_sysent.cFri Nov  9 00:22:45 
2018(r340273)
@@ -258,7 +258,7 @@ struct sysent freebsd32_sysent[] = {
{ compat6(AS(freebsd6_freebsd32_lseek_args),freebsd32_lseek), 
AUE_LSEEK, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },   /* 

svn commit: r340272 - head/sys/compat/freebsd32

2018-11-08 Thread Brooks Davis
Author: brooks
Date: Fri Nov  9 00:21:58 2018
New Revision: 340272
URL: https://svnweb.freebsd.org/changeset/base/340272

Log:
  Make __sysctl follow the freebsd32_foo convention.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/compat/freebsd32/freebsd32_misc.c
  head/sys/compat/freebsd32/syscalls.master

Modified: head/sys/compat/freebsd32/freebsd32_misc.c
==
--- head/sys/compat/freebsd32/freebsd32_misc.c  Fri Nov  9 00:01:53 2018
(r340271)
+++ head/sys/compat/freebsd32/freebsd32_misc.c  Fri Nov  9 00:21:58 2018
(r340272)
@@ -2260,7 +2260,7 @@ freebsd11_freebsd32_fhstat(struct thread *td,
 #endif
 
 int
-freebsd32_sysctl(struct thread *td, struct freebsd32_sysctl_args *uap)
+freebsd32___sysctl(struct thread *td, struct freebsd32___sysctl_args *uap)
 {
int error, name[CTL_MAXNAME];
size_t j, oldlen;

Modified: head/sys/compat/freebsd32/syscalls.master
==
--- head/sys/compat/freebsd32/syscalls.master   Fri Nov  9 00:01:53 2018
(r340271)
+++ head/sys/compat/freebsd32/syscalls.master   Fri Nov  9 00:21:58 2018
(r340272)
@@ -386,7 +386,7 @@
uint32_t length2); }
 201AUE_FTRUNCATE   COMPAT6 { int freebsd32_ftruncate(int fd, int pad, \
uint32_t length1, uint32_t length2); }
-202AUE_SYSCTL  STD { int freebsd32_sysctl(int *name, \
+202AUE_SYSCTL  STD { int freebsd32___sysctl(int *name, \
u_int namelen, void *old, \
uint32_t *oldlenp, void *new, \
uint32_t newlen); }
___
svn-src-all@freebsd.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: r340271 - stable/12/sys/conf

2018-11-08 Thread Glen Barber
Author: gjb
Date: Fri Nov  9 00:01:53 2018
New Revision: 340271
URL: https://svnweb.freebsd.org/changeset/base/340271

Log:
  Update stable/12 from BETA3 to BETA4 as part of the 12.0-RELEASE
  cycle.
  
  Approved by:  re (implicit)
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/12/sys/conf/newvers.sh

Modified: stable/12/sys/conf/newvers.sh
==
--- stable/12/sys/conf/newvers.sh   Thu Nov  8 22:42:55 2018
(r340270)
+++ stable/12/sys/conf/newvers.sh   Fri Nov  9 00:01:53 2018
(r340271)
@@ -46,7 +46,7 @@
 
 TYPE="FreeBSD"
 REVISION="12.0"
-BRANCH="BETA3"
+BRANCH="BETA4"
 if [ -n "${BRANCH_OVERRIDE}" ]; then
BRANCH=${BRANCH_OVERRIDE}
 fi
___
svn-src-all@freebsd.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: r340231 - head/sys/kern

2018-11-08 Thread Konstantin Belousov
On Thu, Nov 08, 2018 at 02:35:50PM -0800, John Baldwin wrote:
> On 11/8/18 12:12 PM, Konstantin Belousov wrote:
> >> Regardless, for the purposes of this sysctl, is there any reason we can't
> >> just define it to 1 always now?  It is only honored if the architecture
> >> is using a shared page to hold the signal trampoline and only has an effect
> >> if the pmap honors VM_PROT_EXECUTE.  That would at least fix i386 with
> >> PAE to DTRT I think.
> > 
> > i386 PAE already handles it, see i386/initcpu.c:754.
> 
> I see.
> 
> > Unconditionally setting the vars to 1 would break any arch that
> > 1. does not allow to use shared page
> > 2. honors VM_PROT_EXEC in pmap
> > 3. not using local hacks for signal trampolines, like sparc64 does.
> > We might not have any such architecture now (ia64 certainly was such case).
> 
> 1. is not quite true.  We require both nxstack != 0 and sv_shared_obj != NULL
> before we honor PT_GNU_STACK.  So you'd have to have an arch that was using
> the shared page but insisted on not using the copy of the sigcode stored in
> the shared page and then 2) honors VM_PROT_EXECUTE.  This seems unlikely to
> be something we'd do in the future.

Still, the sysctl currently resembles the actual behaviour of the system.
If it is zero by default, it makes no sense to set it to one, because
system does not support nx stacks anyway.  Consider it not only as the
direction to operate, but also as the information to user.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340270 - in stable/11/sys: amd64/include arm/include arm64/include i386/include kern mips/include powerpc/include riscv/include sparc64/include x86/x86

2018-11-08 Thread John Baldwin
Author: jhb
Date: Thu Nov  8 22:42:55 2018
New Revision: 340270
URL: https://svnweb.freebsd.org/changeset/base/340270

Log:
  MFC 340164,340168,340170: Add custom cpu_lock_delay() for x86.
  
  340164:
  Add a KPI for the delay while spinning on a spin lock.
  
  Replace a call to DELAY(1) with a new cpu_lock_delay() KPI.  Currently
  cpu_lock_delay() is defined to DELAY(1) on all platforms.  However,
  platforms with a DELAY() implementation that uses spin locks should
  implement a custom cpu_lock_delay() doesn't use locks.
  
  340168:
  Add a delay_tsc() static function for when DELAY() uses the TSC.
  
  This uses slightly simpler logic than the existing code by using the
  full 64-bit counter and thus not having to worry about counter
  overflow.
  
  340170:
  Add a custom implementation of cpu_lock_delay() for x86.
  
  Avoid using DELAY() since it can try to use spin locks on CPUs without
  a P-state invariant TSC.  For cpu_lock_delay(), always use the TSC if
  it exists (even if it is not P-state invariant) to delay for a
  microsecond.  If the TSC does not exist, read from I/O port 0x84 to
  delay instead.
  
  PR:   228768

Modified:
  stable/11/sys/amd64/include/cpu.h
  stable/11/sys/arm/include/cpu.h
  stable/11/sys/arm64/include/cpu.h
  stable/11/sys/i386/include/cpu.h
  stable/11/sys/kern/kern_mutex.c
  stable/11/sys/mips/include/cpu.h
  stable/11/sys/powerpc/include/cpu.h
  stable/11/sys/riscv/include/cpu.h
  stable/11/sys/sparc64/include/cpu.h
  stable/11/sys/x86/x86/delay.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/amd64/include/cpu.h
==
--- stable/11/sys/amd64/include/cpu.h   Thu Nov  8 22:39:38 2018
(r340269)
+++ stable/11/sys/amd64/include/cpu.h   Thu Nov  8 22:42:55 2018
(r340270)
@@ -73,6 +73,7 @@ extern char   etext[];
 extern void (*vmm_resume_p)(void);
 
 void   cpu_halt(void);
+void   cpu_lock_delay(void);
 void   cpu_reset(void);
 void   fork_trampoline(void);
 void   swi_vm(void *);

Modified: stable/11/sys/arm/include/cpu.h
==
--- stable/11/sys/arm/include/cpu.h Thu Nov  8 22:39:38 2018
(r340269)
+++ stable/11/sys/arm/include/cpu.h Thu Nov  8 22:42:55 2018
(r340270)
@@ -61,6 +61,7 @@ get_cyclecount(void)
 #define cpu_getstack(td)   ((td)->td_frame->tf_usr_sp)
 #define cpu_setstack(td, sp)   ((td)->td_frame->tf_usr_sp = (sp))
 #define cpu_spinwait() /* nothing */
+#definecpu_lock_delay()DELAY(1)
 
 #define ARM_NVEC   8
 #define ARM_VEC_ALL0x

Modified: stable/11/sys/arm64/include/cpu.h
==
--- stable/11/sys/arm64/include/cpu.h   Thu Nov  8 22:39:38 2018
(r340269)
+++ stable/11/sys/arm64/include/cpu.h   Thu Nov  8 22:42:55 2018
(r340270)
@@ -51,6 +51,7 @@
 #definecpu_getstack(td)((td)->td_frame->tf_sp)
 #definecpu_setstack(td, sp)((td)->td_frame->tf_sp = (sp))
 #definecpu_spinwait()  __asm __volatile("yield" ::: "memory")
+#definecpu_lock_delay()DELAY(1)
 
 /* Extract CPU affinity levels 0-3 */
 #defineCPU_AFF0(mpidr) (u_int)(((mpidr) >> 0) & 0xff)

Modified: stable/11/sys/i386/include/cpu.h
==
--- stable/11/sys/i386/include/cpu.hThu Nov  8 22:39:38 2018
(r340269)
+++ stable/11/sys/i386/include/cpu.hThu Nov  8 22:42:55 2018
(r340270)
@@ -70,6 +70,7 @@ extern char   btext[];
 extern charetext[];
 
 void   cpu_halt(void);
+void   cpu_lock_delay(void);
 void   cpu_reset(void);
 void   fork_trampoline(void);
 void   swi_vm(void *);

Modified: stable/11/sys/kern/kern_mutex.c
==
--- stable/11/sys/kern/kern_mutex.c Thu Nov  8 22:39:38 2018
(r340269)
+++ stable/11/sys/kern/kern_mutex.c Thu Nov  8 22:42:55 2018
(r340270)
@@ -1204,7 +1204,7 @@ _mtx_lock_indefinite_check(struct mtx *m, struct lock_
 
ldap->spin_cnt++;
if (ldap->spin_cnt < 6000 || kdb_active || panicstr != NULL)
-   DELAY(1);
+   cpu_lock_delay();
else {
td = mtx_owner(m);
 

Modified: stable/11/sys/mips/include/cpu.h
==
--- stable/11/sys/mips/include/cpu.hThu Nov  8 22:39:38 2018
(r340269)
+++ stable/11/sys/mips/include/cpu.hThu Nov  8 22:42:55 2018
(r340270)
@@ -69,6 +69,7 @@
 #definecpu_getstack(td)((td)->td_frame->sp)
 #definecpu_setstack(td, nsp)   ((td)->td_frame->sp = (nsp))
 #definecpu_spinwait()  /* nothing */
+#definecpu_lock_delay()DELAY(1)
 
 

svn commit: r340269 - in stable/12/sys: amd64/include arm/include arm64/include i386/include kern mips/include powerpc/include riscv/include sparc64/include x86/x86

2018-11-08 Thread John Baldwin
Author: jhb
Date: Thu Nov  8 22:39:38 2018
New Revision: 340269
URL: https://svnweb.freebsd.org/changeset/base/340269

Log:
  MFC 340164,340168,340170: Add custom cpu_lock_delay() for x86.
  
  340164:
  Add a KPI for the delay while spinning on a spin lock.
  
  Replace a call to DELAY(1) with a new cpu_lock_delay() KPI.  Currently
  cpu_lock_delay() is defined to DELAY(1) on all platforms.  However,
  platforms with a DELAY() implementation that uses spin locks should
  implement a custom cpu_lock_delay() doesn't use locks.
  
  340168:
  Add a delay_tsc() static function for when DELAY() uses the TSC.
  
  This uses slightly simpler logic than the existing code by using the
  full 64-bit counter and thus not having to worry about counter
  overflow.
  
  340170:
  Add a custom implementation of cpu_lock_delay() for x86.
  
  Avoid using DELAY() since it can try to use spin locks on CPUs without
  a P-state invariant TSC.  For cpu_lock_delay(), always use the TSC if
  it exists (even if it is not P-state invariant) to delay for a
  microsecond.  If the TSC does not exist, read from I/O port 0x84 to
  delay instead.
  
  PR:   228768
  Approved by:  re (gjb)

Modified:
  stable/12/sys/amd64/include/cpu.h
  stable/12/sys/arm/include/cpu.h
  stable/12/sys/arm64/include/cpu.h
  stable/12/sys/i386/include/cpu.h
  stable/12/sys/kern/kern_mutex.c
  stable/12/sys/mips/include/cpu.h
  stable/12/sys/powerpc/include/cpu.h
  stable/12/sys/riscv/include/cpu.h
  stable/12/sys/sparc64/include/cpu.h
  stable/12/sys/x86/x86/delay.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/amd64/include/cpu.h
==
--- stable/12/sys/amd64/include/cpu.h   Thu Nov  8 21:58:51 2018
(r340268)
+++ stable/12/sys/amd64/include/cpu.h   Thu Nov  8 22:39:38 2018
(r340269)
@@ -77,6 +77,7 @@ extern char   etext[];
 extern void (*vmm_resume_p)(void);
 
 void   cpu_halt(void);
+void   cpu_lock_delay(void);
 void   cpu_reset(void);
 void   fork_trampoline(void);
 void   swi_vm(void *);

Modified: stable/12/sys/arm/include/cpu.h
==
--- stable/12/sys/arm/include/cpu.h Thu Nov  8 21:58:51 2018
(r340268)
+++ stable/12/sys/arm/include/cpu.h Thu Nov  8 22:39:38 2018
(r340269)
@@ -61,6 +61,7 @@ get_cyclecount(void)
 #define cpu_getstack(td)   ((td)->td_frame->tf_usr_sp)
 #define cpu_setstack(td, sp)   ((td)->td_frame->tf_usr_sp = (sp))
 #define cpu_spinwait() /* nothing */
+#definecpu_lock_delay()DELAY(1)
 
 #define ARM_NVEC   8
 #define ARM_VEC_ALL0x

Modified: stable/12/sys/arm64/include/cpu.h
==
--- stable/12/sys/arm64/include/cpu.h   Thu Nov  8 21:58:51 2018
(r340268)
+++ stable/12/sys/arm64/include/cpu.h   Thu Nov  8 22:39:38 2018
(r340269)
@@ -51,6 +51,7 @@
 #definecpu_getstack(td)((td)->td_frame->tf_sp)
 #definecpu_setstack(td, sp)((td)->td_frame->tf_sp = (sp))
 #definecpu_spinwait()  __asm __volatile("yield" ::: "memory")
+#definecpu_lock_delay()DELAY(1)
 
 /* Extract CPU affinity levels 0-3 */
 #defineCPU_AFF0(mpidr) (u_int)(((mpidr) >> 0) & 0xff)

Modified: stable/12/sys/i386/include/cpu.h
==
--- stable/12/sys/i386/include/cpu.hThu Nov  8 21:58:51 2018
(r340268)
+++ stable/12/sys/i386/include/cpu.hThu Nov  8 22:39:38 2018
(r340269)
@@ -72,6 +72,7 @@ extern char   btext[];
 extern charetext[];
 
 void   cpu_halt(void);
+void   cpu_lock_delay(void);
 void   cpu_reset(void);
 void   fork_trampoline(void);
 void   swi_vm(void *);

Modified: stable/12/sys/kern/kern_mutex.c
==
--- stable/12/sys/kern/kern_mutex.c Thu Nov  8 21:58:51 2018
(r340268)
+++ stable/12/sys/kern/kern_mutex.c Thu Nov  8 22:39:38 2018
(r340269)
@@ -1206,7 +1206,7 @@ _mtx_lock_indefinite_check(struct mtx *m, struct lock_
 
ldap->spin_cnt++;
if (ldap->spin_cnt < 6000 || kdb_active || panicstr != NULL)
-   DELAY(1);
+   cpu_lock_delay();
else {
td = mtx_owner(m);
 

Modified: stable/12/sys/mips/include/cpu.h
==
--- stable/12/sys/mips/include/cpu.hThu Nov  8 21:58:51 2018
(r340268)
+++ stable/12/sys/mips/include/cpu.hThu Nov  8 22:39:38 2018
(r340269)
@@ -71,6 +71,7 @@
 #definecpu_getstack(td)((td)->td_frame->sp)
 #definecpu_setstack(td, nsp)   ((td)->td_frame->sp = (nsp))
 #definecpu_spinwait()  /* nothing */
+#define

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

2018-11-08 Thread John Baldwin
On 11/8/18 12:12 PM, Konstantin Belousov wrote:
> On Thu, Nov 08, 2018 at 11:49:28AM -0800, John Baldwin wrote:
>> On 11/7/18 3:08 PM, Konstantin Belousov wrote:
>>> On Wed, Nov 07, 2018 at 01:35:57PM -0800, John Baldwin wrote:
 On 11/7/18 1:01 PM, Ed Schouten wrote:
> Op wo 7 nov. 2018 om 19:32 schreef John Baldwin :
>> Modified: head/sys/kern/imgact_elf.c
>> ==
>> --- head/sys/kern/imgact_elf.c  Wed Nov  7 18:29:54 2018(r340230)
>> +++ head/sys/kern/imgact_elf.c  Wed Nov  7 18:32:02 2018(r340231)
>> @@ -120,7 +120,8 @@ SYSCTL_INT(_debug, OID_AUTO, __elfN(legacy_coredump),
>>
>>  int __elfN(nxstack) =
>>  #if defined(__amd64__) || defined(__powerpc64__) /* both 64 and 32 bit 
>> */ || \
>> -(defined(__arm__) && __ARM_ARCH >= 7) || defined(__aarch64__)
>> +(defined(__arm__) && __ARM_ARCH >= 7) || defined(__aarch64__) || \
>> +defined(__riscv)
>> 1;
>>  #else
>> 0;
>
> Are we getting to the point that it might make sense to invert this
> logic, i.e., just list the architectures that require executable
> stacks?

 It's not clear.  The remaining set is i386 (should be able to use nxstack
 when using PAE and PG_NX is supported), MIPS (no X permission in PTEs),
 32-bit powerpc (no X permissions in PTEs AFAICT), and sparc64 (no X
 permissions in PTEs AFAICT).  For architectures without X ptes, removing
 VM_PROT_EXECUTE from the stack permissions is a no-op and would be
 harmless, so we could perhaps just default this to always on at this
 point?
>>> AFAIR sparc64 ABI defines its stack as nx always (and PTEs do allow to
>>> control exec permission).
>>
>> Hmm, I couldn't find any uses of VM_PROT_EXECUTE in pmap.c that seemed to
>> affect permissions.  There is a software TTE bit that is used to know which
>> address ranges require icache flushing, but it seems to only be used for
>> that.
> AFAIR TLB faults are software-assisted and there are different faults
> for instruction and data TLB fill. It seems that exception.S immu_miss
> handler checks the TD_EXEC software bit before loading TTE into
> instructions TLB.
> 
> Later versions of sparcv9 arch specification define optional hw
> execute bit in TTE.

Hummm, ok.

>> Regardless, for the purposes of this sysctl, is there any reason we can't
>> just define it to 1 always now?  It is only honored if the architecture
>> is using a shared page to hold the signal trampoline and only has an effect
>> if the pmap honors VM_PROT_EXECUTE.  That would at least fix i386 with
>> PAE to DTRT I think.
> 
> i386 PAE already handles it, see i386/initcpu.c:754.

I see.

> Unconditionally setting the vars to 1 would break any arch that
> 1. does not allow to use shared page
> 2. honors VM_PROT_EXEC in pmap
> 3. not using local hacks for signal trampolines, like sparc64 does.
> We might not have any such architecture now (ia64 certainly was such case).

1. is not quite true.  We require both nxstack != 0 and sv_shared_obj != NULL
before we honor PT_GNU_STACK.  So you'd have to have an arch that was using
the shared page but insisted on not using the copy of the sigcode stored in
the shared page and then 2) honors VM_PROT_EXECUTE.  This seems unlikely to
be something we'd do in the future.

-- 
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: r340268 - stable/11/sys/netinet

2018-11-08 Thread Glen Barber
Author: gjb
Date: Thu Nov  8 21:58:51 2018
New Revision: 340268
URL: https://svnweb.freebsd.org/changeset/base/340268

Log:
  MFC r340260 (emaste):
   Avoid buffer underwrite in icmp_error
  
   icmp_error allocates either an mbuf (with pkthdr) or a cluster depending
   on the size of data to be quoted in the ICMP reply, but the calculation
   failed to account for the additional padding that m_align may apply.
  
   Include the ip header in the size passed to m_align.  On 64-bit archs
   this will have the net effect of moving everything 4 bytes later in the
   mbuf or cluster.  This will result in slightly pessimal alignment for
   the ICMP data copy.
  
   Also add an assertion that we do not move m_data before the beginning of
   the mbuf or cluster.
  
  Approved by:  re (kib, insta-MFC)
  Security: CVE-2018-17156
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/sys/netinet/ip_icmp.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netinet/ip_icmp.c
==
--- stable/11/sys/netinet/ip_icmp.c Thu Nov  8 21:58:23 2018
(r340267)
+++ stable/11/sys/netinet/ip_icmp.c Thu Nov  8 21:58:51 2018
(r340268)
@@ -310,7 +310,8 @@ stdreply:   icmpelen = max(8, min(V_icmp_quotelen, ntohs
 #endif
icmplen = min(icmplen, M_TRAILINGSPACE(m) -
sizeof(struct ip) - ICMP_MINLEN);
-   m_align(m, ICMP_MINLEN + icmplen);
+   m_align(m, sizeof(struct ip) + ICMP_MINLEN + icmplen);
+   m->m_data += sizeof(struct ip);
m->m_len = ICMP_MINLEN + icmplen;
 
/* XXX MRT  make the outgoing packet use the same FIB
@@ -352,6 +353,8 @@ stdreply:   icmpelen = max(8, min(V_icmp_quotelen, ntohs
 * reply should bypass as well.
 */
m->m_flags |= n->m_flags & M_SKIP_FIREWALL;
+   KASSERT(M_LEADINGSPACE(m) >= sizeof(struct ip),
+   ("insufficient space for ip header"));
m->m_data -= sizeof(struct ip);
m->m_len += sizeof(struct ip);
m->m_pkthdr.len = m->m_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: r340267 - stable/12/sys/netinet

2018-11-08 Thread Glen Barber
Author: gjb
Date: Thu Nov  8 21:58:23 2018
New Revision: 340267
URL: https://svnweb.freebsd.org/changeset/base/340267

Log:
  MFC r340260 (emaste):
   Avoid buffer underwrite in icmp_error
  
   icmp_error allocates either an mbuf (with pkthdr) or a cluster depending
   on the size of data to be quoted in the ICMP reply, but the calculation
   failed to account for the additional padding that m_align may apply.
  
   Include the ip header in the size passed to m_align.  On 64-bit archs
   this will have the net effect of moving everything 4 bytes later in the
   mbuf or cluster.  This will result in slightly pessimal alignment for
   the ICMP data copy.
  
   Also add an assertion that we do not move m_data before the beginning of
   the mbuf or cluster.
  
  Approved by:  re (kib)
  Security: CVE-2018-17156
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/12/sys/netinet/ip_icmp.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/ip_icmp.c
==
--- stable/12/sys/netinet/ip_icmp.c Thu Nov  8 21:56:06 2018
(r340266)
+++ stable/12/sys/netinet/ip_icmp.c Thu Nov  8 21:58:23 2018
(r340267)
@@ -313,7 +313,8 @@ stdreply:   icmpelen = max(8, min(V_icmp_quotelen, ntohs
 #endif
icmplen = min(icmplen, M_TRAILINGSPACE(m) -
sizeof(struct ip) - ICMP_MINLEN);
-   m_align(m, ICMP_MINLEN + icmplen);
+   m_align(m, sizeof(struct ip) + ICMP_MINLEN + icmplen);
+   m->m_data += sizeof(struct ip);
m->m_len = ICMP_MINLEN + icmplen;
 
/* XXX MRT  make the outgoing packet use the same FIB
@@ -355,6 +356,8 @@ stdreply:   icmpelen = max(8, min(V_icmp_quotelen, ntohs
 * reply should bypass as well.
 */
m->m_flags |= n->m_flags & M_SKIP_FIREWALL;
+   KASSERT(M_LEADINGSPACE(m) >= sizeof(struct ip),
+   ("insufficient space for ip header"));
m->m_data -= sizeof(struct ip);
m->m_len += sizeof(struct ip);
m->m_pkthdr.len = m->m_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: r340266 - head/tests/sys/netpfil/pf

2018-11-08 Thread Kristof Provost
Author: kp
Date: Thu Nov  8 21:56:06 2018
New Revision: 340266
URL: https://svnweb.freebsd.org/changeset/base/340266

Log:
  pf tests: Test PR 183198
  
  Create a table which is only used inside an anchor, ensure that the
  table exists.
  
  PR:   183198
  MFC after:2 weeks

Added:
  head/tests/sys/netpfil/pf/anchor.sh   (contents, props changed)
Modified:
  head/tests/sys/netpfil/pf/Makefile

Modified: head/tests/sys/netpfil/pf/Makefile
==
--- head/tests/sys/netpfil/pf/Makefile  Thu Nov  8 21:54:40 2018
(r340265)
+++ head/tests/sys/netpfil/pf/Makefile  Thu Nov  8 21:56:06 2018
(r340266)
@@ -5,7 +5,8 @@ PACKAGE=tests
 TESTSDIR=   ${TESTSBASE}/sys/netpfil/pf
 TESTS_SUBDIRS+=ioctl
 
-ATF_TESTS_SH+= pass_block \
+ATF_TESTS_SH+= anchor \
+   pass_block \
forward \
fragmentation \
set_tos \

Added: head/tests/sys/netpfil/pf/anchor.sh
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tests/sys/netpfil/pf/anchor.sh Thu Nov  8 21:56:06 2018
(r340266)
@@ -0,0 +1,40 @@
+# $FreeBSD$
+
+. $(atf_get_srcdir)/utils.subr
+
+atf_test_case "pr183198" "cleanup"
+pr183198_head()
+{
+   atf_set descr 'Test tables referenced by rules in anchors'
+   atf_set require.user root
+}
+
+pr183198_body()
+{
+   pft_init
+
+   epair=$(pft_mkepair)
+   pft_mkjail alcatraz ${epair}b
+   jexec alcatraz pfctl -e
+
+   # Forward with pf enabled
+   pft_set_rules alcatraz  \
+   "table  { 10.0.0.1, 10.0.0.2, 10.0.0.3 }" \
+   "block in" \
+   "anchor \"epair\" on ${epair}b { \n\
+   pass in from  \n\
+   }"
+
+   atf_check -s exit:0 -o ignore jexec alcatraz pfctl -sr -a '*'
+   atf_check -s exit:0 -o ignore jexec alcatraz pfctl -t test -T show
+}
+
+pr183198_cleanup()
+{
+   pft_cleanup
+}
+
+atf_init_test_cases()
+{
+   atf_add_test_case "pr183198"
+}
___
svn-src-all@freebsd.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: r340265 - head/sys/netpfil/pf

2018-11-08 Thread Kristof Provost
Author: kp
Date: Thu Nov  8 21:54:40 2018
New Revision: 340265
URL: https://svnweb.freebsd.org/changeset/base/340265

Log:
  pf: Prevent tables referenced by rules in anchors from getting disabled.
  
  PR:   183198
  Obtained from:OpenBSD
  MFC after:2 weeks

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

Modified: head/sys/netpfil/pf/pf_table.c
==
--- head/sys/netpfil/pf/pf_table.c  Thu Nov  8 21:53:09 2018
(r340264)
+++ head/sys/netpfil/pf/pf_table.c  Thu Nov  8 21:54:40 2018
(r340265)
@@ -1754,6 +1754,7 @@ pfr_setflags_ktable(struct pfr_ktable *kt, int newf)
PF_RULES_WASSERT();
 
if (!(newf & PFR_TFLAG_REFERENCED) &&
+   !(newf & PFR_TFLAG_REFDANCHOR) &&
!(newf & PFR_TFLAG_PERSIST))
newf &= ~PFR_TFLAG_ACTIVE;
if (!(newf & PFR_TFLAG_ACTIVE))
___
svn-src-all@freebsd.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: r340264 - head/sbin/pfctl

2018-11-08 Thread Kristof Provost
Author: kp
Date: Thu Nov  8 21:53:09 2018
New Revision: 340264
URL: https://svnweb.freebsd.org/changeset/base/340264

Log:
  pfctl: Populate ifname in ifa_lookup()
  
  pfctl_adjust_skip_ifaces() relies on this name.
  
  MFC after:2 weeks

Modified:
  head/sbin/pfctl/pfctl_parser.c

Modified: head/sbin/pfctl/pfctl_parser.c
==
--- head/sbin/pfctl/pfctl_parser.c  Thu Nov  8 21:36:45 2018
(r340263)
+++ head/sbin/pfctl/pfctl_parser.c  Thu Nov  8 21:53:09 2018
(r340264)
@@ -1403,6 +1403,7 @@ ifa_lookup(const char *ifa_name, int flags)
set_ipmask(n, 128);
}
n->ifindex = p->ifindex;
+   n->ifname = strdup(p->ifname);
 
n->next = NULL;
n->tail = n;
___
svn-src-all@freebsd.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: r340263 - stable/12/sys/dev/ixl

2018-11-08 Thread Eric Joyner
Author: erj
Date: Thu Nov  8 21:36:45 2018
New Revision: 340263
URL: https://svnweb.freebsd.org/changeset/base/340263

Log:
  MFC r340256: ixl/iavf(4): Fix TSO offloads when TXCSUM is disabled
  
  Approved by: re (gjb@)

Modified:
  stable/12/sys/dev/ixl/if_iavf.c
  stable/12/sys/dev/ixl/if_ixl.c
  stable/12/sys/dev/ixl/ixl.h
  stable/12/sys/dev/ixl/ixl_txrx.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/ixl/if_iavf.c
==
--- stable/12/sys/dev/ixl/if_iavf.c Thu Nov  8 20:48:44 2018
(r340262)
+++ stable/12/sys/dev/ixl/if_iavf.c Thu Nov  8 21:36:45 2018
(r340263)
@@ -261,7 +261,7 @@ static struct if_shared_ctx iavf_sctx_init = {
.isc_vendor_info = iavf_vendor_info_array,
.isc_driver_version = IAVF_DRIVER_VERSION_STRING,
.isc_driver = _if_driver,
-   .isc_flags = IFLIB_NEED_SCRATCH | IFLIB_NEED_ZERO_CSUM | IFLIB_IS_VF,
+   .isc_flags = IFLIB_NEED_SCRATCH | IFLIB_NEED_ZERO_CSUM | 
IFLIB_TSO_INIT_IP | IFLIB_IS_VF,
 
.isc_nrxd_min = {IXL_MIN_RING},
.isc_ntxd_min = {IXL_MIN_RING},

Modified: stable/12/sys/dev/ixl/if_ixl.c
==
--- stable/12/sys/dev/ixl/if_ixl.c  Thu Nov  8 20:48:44 2018
(r340262)
+++ stable/12/sys/dev/ixl/if_ixl.c  Thu Nov  8 21:36:45 2018
(r340263)
@@ -323,7 +323,7 @@ static struct if_shared_ctx ixl_sctx_init = {
.isc_vendor_info = ixl_vendor_info_array,
.isc_driver_version = IXL_DRIVER_VERSION_STRING,
.isc_driver = _if_driver,
-   .isc_flags = IFLIB_NEED_SCRATCH | IFLIB_NEED_ZERO_CSUM | 
IFLIB_ADMIN_ALWAYS_RUN,
+   .isc_flags = IFLIB_NEED_SCRATCH | IFLIB_NEED_ZERO_CSUM | 
IFLIB_TSO_INIT_IP | IFLIB_ADMIN_ALWAYS_RUN,
 
.isc_nrxd_min = {IXL_MIN_RING},
.isc_ntxd_min = {IXL_MIN_RING},

Modified: stable/12/sys/dev/ixl/ixl.h
==
--- stable/12/sys/dev/ixl/ixl.h Thu Nov  8 20:48:44 2018(r340262)
+++ stable/12/sys/dev/ixl/ixl.h Thu Nov  8 21:36:45 2018(r340263)
@@ -258,6 +258,8 @@
(CSUM_IP_UDP|CSUM_IP6_UDP)
 #define IXL_CSUM_SCTP \
(CSUM_IP_SCTP|CSUM_IP6_SCTP)
+#define IXL_CSUM_IPV4 \
+   (CSUM_IP|CSUM_IP_TSO)
 
 /* Pre-11 counter(9) compatibility */
 #if __FreeBSD_version >= 1100036

Modified: stable/12/sys/dev/ixl/ixl_txrx.c
==
--- stable/12/sys/dev/ixl/ixl_txrx.cThu Nov  8 20:48:44 2018
(r340262)
+++ stable/12/sys/dev/ixl/ixl_txrx.cThu Nov  8 21:36:45 2018
(r340263)
@@ -225,7 +225,7 @@ ixl_tx_setup_offload(struct ixl_tx_queue *que,
switch (pi->ipi_etype) {
 #ifdef INET
case ETHERTYPE_IP:
-   if (pi->ipi_csum_flags & CSUM_IP)
+   if (pi->ipi_csum_flags & IXL_CSUM_IPV4)
*cmd |= I40E_TX_DESC_CMD_IIPT_IPV4_CSUM;
else
*cmd |= I40E_TX_DESC_CMD_IIPT_IPV4;
___
svn-src-all@freebsd.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: r340262 - head/sys/powerpc/powerpc

2018-11-08 Thread Justin Hibbits
Author: jhibbits
Date: Thu Nov  8 20:48:44 2018
New Revision: 340262
URL: https://svnweb.freebsd.org/changeset/base/340262

Log:
  powerpc64: Fix "show spr" command on ELFv2 kernels
  
  Summary: When compiling for ELFv2, it is necessary to adjust the offset to
  get_spr and factor in the function prologue to ensure the correct instruction 
is
  being edited.
  
  Test Plan:
  Before:
  ```
  db> show spr 110
  KDB: reentering
  KDB: stack backtrace:
  0xc00820fb96e0: at 0xc2bb2e34 = kdb_backtrace+0x68
  0xc00820fb97f0: at 0xc2bb3798 = kdb_reenter+0x54
  0xc00820fb9860: at 0xc2f87090 = trap+0x4e4
  0xc00820fb9990: at 0xc2f78a60 = powerpc_interrupt+0x110
  0xc00820fb9a20: kernel trap 0xe40 by 0xc2401978 = get_spr+0x8: 
srr1=0x90001032
  r1=0xc00820fb9cd0 cr=0x80009438 xer=0x2004 
ctr=0xc2f7b40c r2=0xc37fd000
  saved LR(0xfffb) is invalid.
  ```
  
  After:
  
  ```
  db> show spr 110
  SPR 272(110): c3cae900
  ```
  
  Submitted by: git_bdragon.rtk0.net
  Differential Revision: https://reviews.freebsd.org/D17813

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

Modified: head/sys/powerpc/powerpc/machdep.c
==
--- head/sys/powerpc/powerpc/machdep.c  Thu Nov  8 20:31:12 2018
(r340261)
+++ head/sys/powerpc/powerpc/machdep.c  Thu Nov  8 20:48:44 2018
(r340262)
@@ -530,6 +530,10 @@ DB_SHOW_COMMAND(spr, db_show_spr)
saved_sprno = sprno = (intptr_t) addr;
sprno = ((sprno & 0x3e0) >> 5) | ((sprno & 0x1f) << 5);
p = (uint32_t *)(void *)_spr;
+#if defined(_CALL_ELF) && _CALL_ELF == 2
+   /* Account for ELFv2 function prologue. */
+   p += 2;
+#endif
*p = (*p & ~0x001ff800) | (sprno << 11);
__syncicache(get_spr, cacheline_size);
spr = get_spr(sprno);
___
svn-src-all@freebsd.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: r340261 - head/sys/powerpc/powernv

2018-11-08 Thread Justin Hibbits
Author: jhibbits
Date: Thu Nov  8 20:31:12 2018
New Revision: 340261
URL: https://svnweb.freebsd.org/changeset/base/340261

Log:
  powerpc/powernv: Restrict the busdma tag to only POWER8
  
  It seems this tag is causing problems on POWER9 systems.  Since no POWER9 user
  has encountered the problem fixed by r339589 just restrict it to POWER8 for 
now.
  A better fix will likely be to update powerpc/busdma_machdep.c to handle the
  window correctly.
  
  Reported by:  mmacy, others

Modified:
  head/sys/powerpc/powernv/opal_pci.c

Modified: head/sys/powerpc/powernv/opal_pci.c
==
--- head/sys/powerpc/powernv/opal_pci.c Thu Nov  8 20:17:36 2018
(r340260)
+++ head/sys/powerpc/powernv/opal_pci.c Thu Nov  8 20:31:12 2018
(r340261)
@@ -433,20 +433,26 @@ opalpci_attach(device_t dev)
}
 
/* Create the parent DMA tag */
-   err = bus_dma_tag_create(bus_get_dma_tag(dev), /* parent */
-   1, 0,   /* alignment, bounds */
-   OPAL_PCI_BUS_SPACE_LOWADDR_32BIT,   /* lowaddr */
-   BUS_SPACE_MAXADDR_32BIT,/* highaddr */
-   NULL, NULL, /* filter, filterarg */
-   BUS_SPACE_MAXSIZE,  /* maxsize */
-   BUS_SPACE_UNRESTRICTED, /* nsegments */
-   BUS_SPACE_MAXSIZE,  /* maxsegsize */
-   0,  /* flags */
-   NULL, NULL, /* lockfunc, lockarg */
-   >ofw_sc.sc_dmat);
-   if (err != 0) {
-   device_printf(dev, "Failed to create DMA tag\n");
-   return (err);
+   /*
+* Constrain it to POWER8 PHB (ioda2) for now.  It seems to mess up on
+* POWER9 systems.
+*/
+   if (ofw_bus_is_compatible(dev, "ibm,ioda2-phb")) {
+   err = bus_dma_tag_create(bus_get_dma_tag(dev), /* parent */
+   1, 0,   /* alignment, bounds */
+   OPAL_PCI_BUS_SPACE_LOWADDR_32BIT,   /* lowaddr */
+   BUS_SPACE_MAXADDR_32BIT,/* highaddr */
+   NULL, NULL, /* filter, filterarg */
+   BUS_SPACE_MAXSIZE,  /* maxsize */
+   BUS_SPACE_UNRESTRICTED, /* nsegments */
+   BUS_SPACE_MAXSIZE,  /* maxsegsize */
+   0,  /* flags */
+   NULL, NULL, /* lockfunc, lockarg */
+   >ofw_sc.sc_dmat);
+   if (err != 0) {
+   device_printf(dev, "Failed to create DMA tag\n");
+   return (err);
+   }
}
 
/*
___
svn-src-all@freebsd.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: r340187 - head/sys/geom

2018-11-08 Thread Mark Linimon
On Wed, Nov 07, 2018 at 08:59:24AM -0800, Rodney W. Grimes wrote:
> freebsd-geom is also probably a pretty short list.

IMHO it's one of our mailing lists that became obsolete once the initial
work was done.  The bugbusters still assign to these lists, however.

ISTM that some of these assignee lists' recent archives contain only bug
assignments and spam :-/

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

2018-11-08 Thread Ed Maste
Author: emaste
Date: Thu Nov  8 20:17:36 2018
New Revision: 340260
URL: https://svnweb.freebsd.org/changeset/base/340260

Log:
  Avoid buffer underwrite in icmp_error
  
  icmp_error allocates either an mbuf (with pkthdr) or a cluster depending
  on the size of data to be quoted in the ICMP reply, but the calculation
  failed to account for the additional padding that m_align may apply.
  
  Include the ip header in the size passed to m_align.  On 64-bit archs
  this will have the net effect of moving everything 4 bytes later in the
  mbuf or cluster.  This will result in slightly pessimal alignment for
  the ICMP data copy.
  
  Also add an assertion that we do not move m_data before the beginning of
  the mbuf or cluster.
  
  Reported by:  A reddit user
  Reviewed by:  bz, jtl
  MFC after:3 days
  Security: CVE-2018-17156
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D17909

Modified:
  head/sys/netinet/ip_icmp.c

Modified: head/sys/netinet/ip_icmp.c
==
--- head/sys/netinet/ip_icmp.c  Thu Nov  8 19:56:45 2018(r340259)
+++ head/sys/netinet/ip_icmp.c  Thu Nov  8 20:17:36 2018(r340260)
@@ -320,7 +320,8 @@ stdreply:   icmpelen = max(8, min(V_icmp_quotelen, ntohs
 #endif
icmplen = min(icmplen, M_TRAILINGSPACE(m) -
sizeof(struct ip) - ICMP_MINLEN);
-   m_align(m, ICMP_MINLEN + icmplen);
+   m_align(m, sizeof(struct ip) + ICMP_MINLEN + icmplen);
+   m->m_data += sizeof(struct ip);
m->m_len = ICMP_MINLEN + icmplen;
 
/* XXX MRT  make the outgoing packet use the same FIB
@@ -362,6 +363,8 @@ stdreply:   icmpelen = max(8, min(V_icmp_quotelen, ntohs
 * reply should bypass as well.
 */
m->m_flags |= n->m_flags & M_SKIP_FIREWALL;
+   KASSERT(M_LEADINGSPACE(m) >= sizeof(struct ip),
+   ("insufficient space for ip header"));
m->m_data -= sizeof(struct ip);
m->m_len += sizeof(struct ip);
m->m_pkthdr.len = m->m_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"


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

2018-11-08 Thread Konstantin Belousov
On Thu, Nov 08, 2018 at 11:49:28AM -0800, John Baldwin wrote:
> On 11/7/18 3:08 PM, Konstantin Belousov wrote:
> > On Wed, Nov 07, 2018 at 01:35:57PM -0800, John Baldwin wrote:
> >> On 11/7/18 1:01 PM, Ed Schouten wrote:
> >>> Op wo 7 nov. 2018 om 19:32 schreef John Baldwin :
>  Modified: head/sys/kern/imgact_elf.c
>  ==
>  --- head/sys/kern/imgact_elf.c  Wed Nov  7 18:29:54 2018(r340230)
>  +++ head/sys/kern/imgact_elf.c  Wed Nov  7 18:32:02 2018(r340231)
>  @@ -120,7 +120,8 @@ SYSCTL_INT(_debug, OID_AUTO, __elfN(legacy_coredump),
> 
>   int __elfN(nxstack) =
>   #if defined(__amd64__) || defined(__powerpc64__) /* both 64 and 32 bit 
>  */ || \
>  -(defined(__arm__) && __ARM_ARCH >= 7) || defined(__aarch64__)
>  +(defined(__arm__) && __ARM_ARCH >= 7) || defined(__aarch64__) || \
>  +defined(__riscv)
>  1;
>   #else
>  0;
> >>>
> >>> Are we getting to the point that it might make sense to invert this
> >>> logic, i.e., just list the architectures that require executable
> >>> stacks?
> >>
> >> It's not clear.  The remaining set is i386 (should be able to use nxstack
> >> when using PAE and PG_NX is supported), MIPS (no X permission in PTEs),
> >> 32-bit powerpc (no X permissions in PTEs AFAICT), and sparc64 (no X
> >> permissions in PTEs AFAICT).  For architectures without X ptes, removing
> >> VM_PROT_EXECUTE from the stack permissions is a no-op and would be
> >> harmless, so we could perhaps just default this to always on at this
> >> point?
> > AFAIR sparc64 ABI defines its stack as nx always (and PTEs do allow to
> > control exec permission).
> 
> Hmm, I couldn't find any uses of VM_PROT_EXECUTE in pmap.c that seemed to
> affect permissions.  There is a software TTE bit that is used to know which
> address ranges require icache flushing, but it seems to only be used for
> that.
AFAIR TLB faults are software-assisted and there are different faults
for instruction and data TLB fill. It seems that exception.S immu_miss
handler checks the TD_EXEC software bit before loading TTE into
instructions TLB.

Later versions of sparcv9 arch specification define optional hw
execute bit in TTE.

> 
> Regardless, for the purposes of this sysctl, is there any reason we can't
> just define it to 1 always now?  It is only honored if the architecture
> is using a shared page to hold the signal trampoline and only has an effect
> if the pmap honors VM_PROT_EXECUTE.  That would at least fix i386 with
> PAE to DTRT I think.

i386 PAE already handles it, see i386/initcpu.c:754.

Unconditionally setting the vars to 1 would break any arch that
1. does not allow to use shared page
2. honors VM_PROT_EXEC in pmap
3. not using local hacks for signal trampolines, like sparc64 does.
We might not have any such architecture now (ia64 certainly was such case).
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340258 - in stable/12/sys: amd64/linux32 compat/linux

2018-11-08 Thread Tijl Coosemans
Author: tijl
Date: Thu Nov  8 19:56:29 2018
New Revision: 340258
URL: https://svnweb.freebsd.org/changeset/base/340258

Log:
  MFC r340181, r340185:
  
  On amd64 both Linux compat modules, linux.ko and linux64.ko, provide
  linux_ioctl_(un)register_handler that allows other driver modules to
  register ioctl handlers.  The ioctl syscall implementation in each Linux
  compat module iterates over the list of handlers and forwards the call to
  the appropriate driver.  Because the registration functions have the same
  name in each module it is not possible for a driver to support both 32 and
  64 bit linux compatibility.
  
  Move the list of ioctl handlers to linux_common.ko so it is shared by
  both Linux modules and all drivers receive both 32 and 64 bit ioctl calls
  with one registration.  These ioctl handlers normally forward the call
  to the FreeBSD ioctl handler which can handle both 32 and 64 bit.
  
  Keep the special COMPAT_LINUX32 ioctl handlers in linux.ko in a separate
  list for now and let the ioctl syscall iterate over that list first.
  Later, COMPAT_LINUX32 support can be added to the 64 bit ioctl handlers
  via a runtime check for ILP32 like is done for COMPAT_FREEBSD32 and then
  this separate list would disappear again.  That is a much bigger effort
  however and this commit is meant to be MFCable.
  
  This enables linux64 support in x11/nvidia-driver*.
  
  PR:   206711
  Reviewed by:  kib
  Approved by:  re (gjb)

Modified:
  stable/12/sys/amd64/linux32/linux32_sysvec.c
  stable/12/sys/compat/linux/linux_common.c
  stable/12/sys/compat/linux/linux_ioctl.c
  stable/12/sys/compat/linux/linux_ioctl.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/amd64/linux32/linux32_sysvec.c
==
--- stable/12/sys/amd64/linux32/linux32_sysvec.cThu Nov  8 19:50:23 
2018(r340257)
+++ stable/12/sys/amd64/linux32/linux32_sysvec.cThu Nov  8 19:56:29 
2018(r340258)
@@ -32,6 +32,8 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "opt_compat.h"
+
 #include 
 __FBSDID("$FreeBSD$");
 
@@ -1071,7 +1073,7 @@ linux_elf_modevent(module_t mod, int type, void *data)
error = EINVAL;
if (error == 0) {
SET_FOREACH(lihp, linux_ioctl_handler_set)
-   linux_ioctl_register_handler(*lihp);
+   linux32_ioctl_register_handler(*lihp);
LIST_INIT(_list);
mtx_init(_mtx, "ftllk", NULL, MTX_DEF);
stclohz = (stathz ? stathz : hz);
@@ -1093,7 +1095,7 @@ linux_elf_modevent(module_t mod, int type, void *data)
}
if (error == 0) {
SET_FOREACH(lihp, linux_ioctl_handler_set)
-   linux_ioctl_unregister_handler(*lihp);
+   linux32_ioctl_unregister_handler(*lihp);
mtx_destroy(_mtx);
if (bootverbose)
printf("Linux ELF exec handler removed\n");

Modified: stable/12/sys/compat/linux/linux_common.c
==
--- stable/12/sys/compat/linux/linux_common.c   Thu Nov  8 19:50:23 2018
(r340257)
+++ stable/12/sys/compat/linux/linux_common.c   Thu Nov  8 19:56:29 2018
(r340258)
@@ -35,9 +35,11 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
@@ -47,6 +49,11 @@ FEATURE(linuxulator_v4l2, "V4L2 ioctl wrapper support 
 MODULE_VERSION(linux_common, 1);
 
 SET_DECLARE(linux_device_handler_set, struct linux_device_handler);
+
+TAILQ_HEAD(, linux_ioctl_handler_element) linux_ioctl_handlers =
+TAILQ_HEAD_INITIALIZER(linux_ioctl_handlers);
+struct sx linux_ioctl_sx;
+SX_SYSINIT(linux_ioctl, _ioctl_sx, "Linux ioctl handlers");
 
 static eventhandler_tag linux_exec_tag;
 static eventhandler_tag linux_thread_dtor_tag;

Modified: stable/12/sys/compat/linux/linux_ioctl.c
==
--- stable/12/sys/compat/linux/linux_ioctl.cThu Nov  8 19:50:23 2018
(r340257)
+++ stable/12/sys/compat/linux/linux_ioctl.cThu Nov  8 19:56:29 2018
(r340258)
@@ -161,17 +161,19 @@ DATA_SET(linux_ioctl_handler_set, video2_handler);
 DATA_SET(linux_ioctl_handler_set, fbsd_usb);
 DATA_SET(linux_ioctl_handler_set, evdev_handler);
 
-struct handler_element
-{
-   TAILQ_ENTRY(handler_element) list;
-   int (*func)(struct thread *, struct linux_ioctl_args *);
-   int low, high, span;
-};
-
-static TAILQ_HEAD(, handler_element) handlers =
-TAILQ_HEAD_INITIALIZER(handlers);
+#ifdef __i386__
+static TAILQ_HEAD(, linux_ioctl_handler_element) 

svn commit: r340259 - in stable/11/sys: amd64/linux32 compat/linux

2018-11-08 Thread Tijl Coosemans
Author: tijl
Date: Thu Nov  8 19:56:45 2018
New Revision: 340259
URL: https://svnweb.freebsd.org/changeset/base/340259

Log:
  MFC r340181, r340185:
  
  On amd64 both Linux compat modules, linux.ko and linux64.ko, provide
  linux_ioctl_(un)register_handler that allows other driver modules to
  register ioctl handlers.  The ioctl syscall implementation in each Linux
  compat module iterates over the list of handlers and forwards the call to
  the appropriate driver.  Because the registration functions have the same
  name in each module it is not possible for a driver to support both 32 and
  64 bit linux compatibility.
  
  Move the list of ioctl handlers to linux_common.ko so it is shared by
  both Linux modules and all drivers receive both 32 and 64 bit ioctl calls
  with one registration.  These ioctl handlers normally forward the call
  to the FreeBSD ioctl handler which can handle both 32 and 64 bit.
  
  Keep the special COMPAT_LINUX32 ioctl handlers in linux.ko in a separate
  list for now and let the ioctl syscall iterate over that list first.
  Later, COMPAT_LINUX32 support can be added to the 64 bit ioctl handlers
  via a runtime check for ILP32 like is done for COMPAT_FREEBSD32 and then
  this separate list would disappear again.  That is a much bigger effort
  however and this commit is meant to be MFCable.
  
  This enables linux64 support in x11/nvidia-driver*.
  
  PR:   206711
  Reviewed by:  kib

Modified:
  stable/11/sys/amd64/linux32/linux32_sysvec.c
  stable/11/sys/compat/linux/linux_common.c
  stable/11/sys/compat/linux/linux_ioctl.c
  stable/11/sys/compat/linux/linux_ioctl.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/amd64/linux32/linux32_sysvec.c
==
--- stable/11/sys/amd64/linux32/linux32_sysvec.cThu Nov  8 19:56:29 
2018(r340258)
+++ stable/11/sys/amd64/linux32/linux32_sysvec.cThu Nov  8 19:56:45 
2018(r340259)
@@ -30,6 +30,8 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "opt_compat.h"
+
 #include 
 __FBSDID("$FreeBSD$");
 #include "opt_compat.h"
@@ -1134,7 +1136,7 @@ linux_elf_modevent(module_t mod, int type, void *data)
error = EINVAL;
if (error == 0) {
SET_FOREACH(lihp, linux_ioctl_handler_set)
-   linux_ioctl_register_handler(*lihp);
+   linux32_ioctl_register_handler(*lihp);
LIST_INIT(_list);
mtx_init(_mtx, "ftllk", NULL, MTX_DEF);
stclohz = (stathz ? stathz : hz);
@@ -1156,7 +1158,7 @@ linux_elf_modevent(module_t mod, int type, void *data)
}
if (error == 0) {
SET_FOREACH(lihp, linux_ioctl_handler_set)
-   linux_ioctl_unregister_handler(*lihp);
+   linux32_ioctl_unregister_handler(*lihp);
mtx_destroy(_mtx);
if (bootverbose)
printf("Linux ELF exec handler removed\n");

Modified: stable/11/sys/compat/linux/linux_common.c
==
--- stable/11/sys/compat/linux/linux_common.c   Thu Nov  8 19:56:29 2018
(r340258)
+++ stable/11/sys/compat/linux/linux_common.c   Thu Nov  8 19:56:45 2018
(r340259)
@@ -35,9 +35,11 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
@@ -47,6 +49,11 @@ FEATURE(linuxulator_v4l2, "V4L2 ioctl wrapper support 
 MODULE_VERSION(linux_common, 1);
 
 SET_DECLARE(linux_device_handler_set, struct linux_device_handler);
+
+TAILQ_HEAD(, linux_ioctl_handler_element) linux_ioctl_handlers =
+TAILQ_HEAD_INITIALIZER(linux_ioctl_handlers);
+struct sx linux_ioctl_sx;
+SX_SYSINIT(linux_ioctl, _ioctl_sx, "Linux ioctl handlers");
 
 static eventhandler_tag linux_exec_tag;
 static eventhandler_tag linux_thread_dtor_tag;

Modified: stable/11/sys/compat/linux/linux_ioctl.c
==
--- stable/11/sys/compat/linux/linux_ioctl.cThu Nov  8 19:56:29 2018
(r340258)
+++ stable/11/sys/compat/linux/linux_ioctl.cThu Nov  8 19:56:45 2018
(r340259)
@@ -161,17 +161,19 @@ DATA_SET(linux_ioctl_handler_set, video2_handler);
 DATA_SET(linux_ioctl_handler_set, fbsd_usb);
 DATA_SET(linux_ioctl_handler_set, evdev_handler);
 
-struct handler_element
-{
-   TAILQ_ENTRY(handler_element) list;
-   int (*func)(struct thread *, struct linux_ioctl_args *);
-   int low, high, span;
-};
-
-static TAILQ_HEAD(, handler_element) handlers =
-TAILQ_HEAD_INITIALIZER(handlers);
+#ifdef __i386__
+static TAILQ_HEAD(, linux_ioctl_handler_element) 

svn commit: r340257 - head/sys/netinet6

2018-11-08 Thread Eric van Gyzen
Author: vangyzen
Date: Thu Nov  8 19:50:23 2018
New Revision: 340257
URL: https://svnweb.freebsd.org/changeset/base/340257

Log:
  in6_ifattach_linklocal: handle immediate removal of the new LLA
  
  If another thread immediately removes the link-local address
  added by in6_update_ifa(), in6ifa_ifpforlinklocal() can return NULL,
  so the following assertion (or dereference) is wrong.
  Remove the assertion, and handle NULL somewhat better than panicking.
  This matches all of the other callers of in6_update_ifa().
  
  PR:   219250
  Reviewed by:  bz, dab (both an earlier version)
  MFC after:1 week
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D17898

Modified:
  head/sys/netinet6/in6_ifattach.c

Modified: head/sys/netinet6/in6_ifattach.c
==
--- head/sys/netinet6/in6_ifattach.cThu Nov  8 19:10:43 2018
(r340256)
+++ head/sys/netinet6/in6_ifattach.cThu Nov  8 19:50:23 2018
(r340257)
@@ -481,9 +481,16 @@ in6_ifattach_linklocal(struct ifnet *ifp, struct ifnet
return (-1);
}
 
-   ia = in6ifa_ifpforlinklocal(ifp, 0); /* ia must not be NULL */
-   KASSERT(ia != NULL, ("%s: ia == NULL, ifp=%p", __func__, ifp));
-
+   ia = in6ifa_ifpforlinklocal(ifp, 0);
+   if (ia == NULL) {
+   /*
+* Another thread removed the address that we just added.
+* This should be rare, but it happens.
+*/
+   nd6log((LOG_NOTICE, "%s: %s: new link-local address "
+   "disappeared\n", __func__, if_name(ifp)));
+   return (-1);
+   }
ifa_free(>ia_ifa);
 
/*
___
svn-src-all@freebsd.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: r340231 - head/sys/kern

2018-11-08 Thread John Baldwin
On 11/7/18 3:08 PM, Konstantin Belousov wrote:
> On Wed, Nov 07, 2018 at 01:35:57PM -0800, John Baldwin wrote:
>> On 11/7/18 1:01 PM, Ed Schouten wrote:
>>> Op wo 7 nov. 2018 om 19:32 schreef John Baldwin :
 Modified: head/sys/kern/imgact_elf.c
 ==
 --- head/sys/kern/imgact_elf.c  Wed Nov  7 18:29:54 2018(r340230)
 +++ head/sys/kern/imgact_elf.c  Wed Nov  7 18:32:02 2018(r340231)
 @@ -120,7 +120,8 @@ SYSCTL_INT(_debug, OID_AUTO, __elfN(legacy_coredump),

  int __elfN(nxstack) =
  #if defined(__amd64__) || defined(__powerpc64__) /* both 64 and 32 bit */ 
 || \
 -(defined(__arm__) && __ARM_ARCH >= 7) || defined(__aarch64__)
 +(defined(__arm__) && __ARM_ARCH >= 7) || defined(__aarch64__) || \
 +defined(__riscv)
 1;
  #else
 0;
>>>
>>> Are we getting to the point that it might make sense to invert this
>>> logic, i.e., just list the architectures that require executable
>>> stacks?
>>
>> It's not clear.  The remaining set is i386 (should be able to use nxstack
>> when using PAE and PG_NX is supported), MIPS (no X permission in PTEs),
>> 32-bit powerpc (no X permissions in PTEs AFAICT), and sparc64 (no X
>> permissions in PTEs AFAICT).  For architectures without X ptes, removing
>> VM_PROT_EXECUTE from the stack permissions is a no-op and would be
>> harmless, so we could perhaps just default this to always on at this
>> point?
> AFAIR sparc64 ABI defines its stack as nx always (and PTEs do allow to
> control exec permission).

Hmm, I couldn't find any uses of VM_PROT_EXECUTE in pmap.c that seemed to
affect permissions.  There is a software TTE bit that is used to know which
address ranges require icache flushing, but it seems to only be used for
that.

Regardless, for the purposes of this sysctl, is there any reason we can't
just define it to 1 always now?  It is only honored if the architecture
is using a shared page to hold the signal trampoline and only has an effect
if the pmap honors VM_PROT_EXECUTE.  That would at least fix i386 with
PAE to DTRT I think.

-- 
John Baldwin


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


Re: svn commit: r340242 - head

2018-11-08 Thread John Baldwin
On 11/7/18 4:35 PM, Brooks Davis wrote:
> Author: brooks
> Date: Thu Nov  8 00:35:00 2018
> New Revision: 340242
> URL: https://svnweb.freebsd.org/changeset/base/340242
> 
> Log:
>   Add a top-level make target to rebuild all sysent files.
>   
>   The sysent target is useful when changing makesyscalls.sh, when
>   making paired changes to syscalls.master files, or in a future where
>   freebsd32 sysent entries are built from the default syscalls.master.

+1

That qualifies for a free drink the next time we are colocated.  Thanks!

-- 
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: r340256 - head/sys/dev/ixl

2018-11-08 Thread Eric Joyner
Author: erj
Date: Thu Nov  8 19:10:43 2018
New Revision: 340256
URL: https://svnweb.freebsd.org/changeset/base/340256

Log:
  ixl/iavf(4): Fix TSO offloads when TXCSUM is disabled
  
  From Jake:
  The iflib stack does not disable TSO automatically when TXCSUM is
  disabled, instead assuming that the driver will correctly handle TSOs
  even when CSUM_IP is not set.
  
  This results in iflib calling ixl_isc_txd_encap with packets which have
  CSUM_IP_TSO, but do not have CSUM_IP or CSUM_IP_TCP set. Because of
  this, ixl_tx_setup_offload will not setup the IPv4 checksum offloading.
  
  This results in bad TSO packets being sent if a user disables TXCSUM
  without disabling TSO.
  
  Fix this by updating the ixl_tx_setup_offload function to check both
  CSUM_IP and CSUM_IP_TSO when deciding whether to enable IPv4 checksums.
  
  Once this is corrected, another issue for TSO packets is revealed. The
  driver sets IFLIB_NEED_ZERO_CSUM in order to enable a work around that
  causes the ip->sum field to be zero'd. This is necessary for ixl
  hardware to correctly perform TSOs.
  
  However, if TXCSUM is disabled, then the work around is not enabled, as
  CSUM_IP will not be set when the iflib stack checks to see if it should
  clear the sum field.
  
  Fix this by adding IFLIB_TSO_INIT_IP to the iflib flags for the iavf and
  ixl interface files.
  
  It is uncertain if the hardware needs IFLIB_NEED_ZERO_CSUM for any other
  case besides TSO, so leave that flag assigned. It may be worth
  investigating to see if this work around flag could be disabled in
  a future change.
  
  Once both of these changes are made, the ixl driver should correctly
  offload TSO packets when TSO4 offload is enabled, regardless of whether
  TXCSUM is enabled or disabled.
  
  Submitted by: Jacob Keller 
  Reviewed by:  erj@, shurd@
  MFC after:0 days
  Sponsored by: Intel Corporation
  Differential Revision:https://reviews.freebsd.org/D17900

Modified:
  head/sys/dev/ixl/if_iavf.c
  head/sys/dev/ixl/if_ixl.c
  head/sys/dev/ixl/ixl.h
  head/sys/dev/ixl/ixl_txrx.c

Modified: head/sys/dev/ixl/if_iavf.c
==
--- head/sys/dev/ixl/if_iavf.c  Thu Nov  8 17:20:00 2018(r340255)
+++ head/sys/dev/ixl/if_iavf.c  Thu Nov  8 19:10:43 2018(r340256)
@@ -260,7 +260,7 @@ static struct if_shared_ctx iavf_sctx_init = {
.isc_vendor_info = iavf_vendor_info_array,
.isc_driver_version = IAVF_DRIVER_VERSION_STRING,
.isc_driver = _if_driver,
-   .isc_flags = IFLIB_NEED_SCRATCH | IFLIB_NEED_ZERO_CSUM | IFLIB_IS_VF,
+   .isc_flags = IFLIB_NEED_SCRATCH | IFLIB_NEED_ZERO_CSUM | 
IFLIB_TSO_INIT_IP | IFLIB_IS_VF,
 
.isc_nrxd_min = {IXL_MIN_RING},
.isc_ntxd_min = {IXL_MIN_RING},

Modified: head/sys/dev/ixl/if_ixl.c
==
--- head/sys/dev/ixl/if_ixl.c   Thu Nov  8 17:20:00 2018(r340255)
+++ head/sys/dev/ixl/if_ixl.c   Thu Nov  8 19:10:43 2018(r340256)
@@ -323,7 +323,7 @@ static struct if_shared_ctx ixl_sctx_init = {
.isc_vendor_info = ixl_vendor_info_array,
.isc_driver_version = IXL_DRIVER_VERSION_STRING,
.isc_driver = _if_driver,
-   .isc_flags = IFLIB_NEED_SCRATCH | IFLIB_NEED_ZERO_CSUM | 
IFLIB_ADMIN_ALWAYS_RUN,
+   .isc_flags = IFLIB_NEED_SCRATCH | IFLIB_NEED_ZERO_CSUM | 
IFLIB_TSO_INIT_IP | IFLIB_ADMIN_ALWAYS_RUN,
 
.isc_nrxd_min = {IXL_MIN_RING},
.isc_ntxd_min = {IXL_MIN_RING},

Modified: head/sys/dev/ixl/ixl.h
==
--- head/sys/dev/ixl/ixl.h  Thu Nov  8 17:20:00 2018(r340255)
+++ head/sys/dev/ixl/ixl.h  Thu Nov  8 19:10:43 2018(r340256)
@@ -258,6 +258,8 @@
(CSUM_IP_UDP|CSUM_IP6_UDP)
 #define IXL_CSUM_SCTP \
(CSUM_IP_SCTP|CSUM_IP6_SCTP)
+#define IXL_CSUM_IPV4 \
+   (CSUM_IP|CSUM_IP_TSO)
 
 /* Pre-11 counter(9) compatibility */
 #if __FreeBSD_version >= 1100036

Modified: head/sys/dev/ixl/ixl_txrx.c
==
--- head/sys/dev/ixl/ixl_txrx.c Thu Nov  8 17:20:00 2018(r340255)
+++ head/sys/dev/ixl/ixl_txrx.c Thu Nov  8 19:10:43 2018(r340256)
@@ -225,7 +225,7 @@ ixl_tx_setup_offload(struct ixl_tx_queue *que,
switch (pi->ipi_etype) {
 #ifdef INET
case ETHERTYPE_IP:
-   if (pi->ipi_csum_flags & CSUM_IP)
+   if (pi->ipi_csum_flags & IXL_CSUM_IPV4)
*cmd |= I40E_TX_DESC_CMD_IIPT_IPV4_CSUM;
else
*cmd |= I40E_TX_DESC_CMD_IIPT_IPV4;
___
svn-src-all@freebsd.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: r340255 - head/sys/conf

2018-11-08 Thread Mark Johnston
Author: markj
Date: Thu Nov  8 17:20:00 2018
New Revision: 340255
URL: https://svnweb.freebsd.org/changeset/base/340255

Log:
  Use --work-tree instead of specifying an absolute path.
  
  Otherwise the diff command being run from outside the checkout resulted
  in warnings.
  
  Discussed with:   emaste
  X-MFC with:   r340083

Modified:
  head/sys/conf/newvers.sh

Modified: head/sys/conf/newvers.sh
==
--- head/sys/conf/newvers.shThu Nov  8 17:00:05 2018(r340254)
+++ head/sys/conf/newvers.shThu Nov  8 17:20:00 2018(r340255)
@@ -83,18 +83,17 @@ git_tree_modified()
# git's internal state.  The latter case is indicated by an all-zero
# destination file hash.
 
-   local fifo vcstop_abs
+   local fifo
 
fifo=$(mktemp -u)
mkfifo -m 600 $fifo
-   vcstop_abs=$(realpath $VCSTOP)
$git_cmd --work-tree=${VCSTOP} diff-index HEAD > $fifo &
while read smode dmode ssha dsha status file; do
if ! expr $dsha : '^00*$' >/dev/null; then
rm $fifo
return 0
fi
-   if ! $git_cmd diff --quiet -- "${vcstop_abs}/${file}"; then
+   if ! $git_cmd --work-tree=${VCSTOP} diff --quiet -- "${file}"; 
then
rm $fifo
return 0
fi
___
svn-src-all@freebsd.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: r340254 - head/usr.sbin/newsyslog/newsyslog.conf.d

2018-11-08 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Nov  8 17:00:05 2018
New Revision: 340254
URL: https://svnweb.freebsd.org/changeset/base/340254

Log:
  Put a size limit on the opensm.log and use bzip2(1).
  
  Discussed with:   markj@
  Sponsored by: Mellanox Technologies

Modified:
  head/usr.sbin/newsyslog/newsyslog.conf.d/opensm.conf

Modified: head/usr.sbin/newsyslog/newsyslog.conf.d/opensm.conf
==
--- head/usr.sbin/newsyslog/newsyslog.conf.d/opensm.confThu Nov  8 
16:23:09 2018(r340253)
+++ head/usr.sbin/newsyslog/newsyslog.conf.d/opensm.confThu Nov  8 
17:00:05 2018(r340254)
@@ -1,3 +1,3 @@
 # $FreeBSD$
 
-/var/log/opensm.log600  7  *   *   Z   
/var/run/opensm.pid 30
+/var/log/opensm.log600  7  1000*   J   
/var/run/opensm.pid 30
___
svn-src-all@freebsd.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: r340246 - head/usr.sbin/newsyslog

2018-11-08 Thread Mark Johnston
On Thu, Nov 08, 2018 at 05:24:49PM +0100, Hans Petter Selasky wrote:
> On 11/8/18 5:14 PM, Mark Johnston wrote:
> > On Thu, Nov 08, 2018 at 12:43:14PM +, Hans Petter Selasky wrote:
> >> Author: hselasky
> >> Date: Thu Nov  8 12:43:13 2018
> >> New Revision: 340246
> >> URL: https://svnweb.freebsd.org/changeset/base/340246
> >>
> >> Log:
> >>Add /var/log/opensm.log to list of rotating log files.
> >>
> >>MFC after:  3 days
> >>Sponsored by:   Mellanox Technologies
> >>
> >> Modified:
> >>head/usr.sbin/newsyslog/newsyslog.conf
> > 
> > There is already an usr.sbin/newsyslog/newsyslog.d/opensm.conf.
> > 
> Thank you. Do you have any objections adding a size limit for 
> opensm.conf, and also to use bzip2?

Nope.  I don't interact with opensm anymore though.

FWIW, opensm's logging can be quite verbose and I very often found
myself wanting to go back further than the log retention limit (which
was fairly small due to space constraints on OneFS).  I think switching
to bzip2 is a good idea, and the size limit you added looks reasonable.

> > Index: usr.sbin/newsyslog/newsyslog.conf.d/opensm.conf
> > ===
> > --- usr.sbin/newsyslog/newsyslog.conf.d/opensm.conf (revision 339922)
> > +++ usr.sbin/newsyslog/newsyslog.conf.d/opensm.conf (working copy)
> > @@ -1,3 +1,3 @@
> >  # $FreeBSD$
> >  
> > -/var/log/opensm.log600  7  *   *   Z   
> > /var/run/opensm.pid 30
> > +/var/log/opensm.log600  7  1000*   J   
> > /var/run/opensm.pid 30
> 
> --HPS
> 
> >>
> >> Modified: head/usr.sbin/newsyslog/newsyslog.conf
> >> ==
> >> --- head/usr.sbin/newsyslog/newsyslog.conf Thu Nov  8 09:45:13 2018
> >> (r340245)
> >> +++ head/usr.sbin/newsyslog/newsyslog.conf Thu Nov  8 12:43:13 2018
> >> (r340246)
> >> @@ -26,6 +26,7 @@
> >>   /var/log/maillog 640  7 *@T00  JC
> >>   /var/log/messages644  5 1000 @0101T JC
> >>   /var/log/monthly.log 640  12*$M1D0 JN
> >> +/var/log/opensm.log   644  3 1000 * J
> >>   /var/log/devd.log644  3 1000 * JC
> >>   /var/log/security600  101000 * JC
> >>   /var/log/utx.log 644  3 *@01T05 B
> >>
> > 
> > 
> 
___
svn-src-all@freebsd.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: r340242 - head

2018-11-08 Thread Brooks Davis
On Thu, Nov 08, 2018 at 06:23:55AM +, Bjoern A. Zeeb wrote:
> On 8 Nov 2018, at 0:35, Brooks Davis wrote:
> 
> > Author: brooks
> > Date: Thu Nov  8 00:35:00 2018
> > New Revision: 340242
> > URL: https://svnweb.freebsd.org/changeset/base/340242
> >
> > Log:
> >   Add a top-level make target to rebuild all sysent files.
> >
> >   The sysent target is useful when changing makesyscalls.sh, when
> >   making paired changes to syscalls.master files, or in a future where
> >   freebsd32 sysent entries are built from the default syscalls.master.
> >
> >   Reviewed by:  bdrewery
> >   Obtained from:CheriBSD
> >   Sponsored by: DARPA, AFRL
> >   Differential Revision:https://reviews.freebsd.org/D17899
> >
> > Modified:
> >   head/Makefile
> >   head/Makefile.inc1
> 
> I was wondering if the Makefile.inc1 parts shouldn???t mostly be in 
> sys/Makefile or similar rather than at the top-level?

It seemed like a tossup.  I picked Makefile.inc1 because I didn't want
to polute Makefile with a list of directories and because it makes sure
the right tools (bmake) are used.

-- Brooks


signature.asc
Description: PGP signature


Re: svn commit: r340246 - head/usr.sbin/newsyslog

2018-11-08 Thread Hans Petter Selasky

On 11/8/18 5:14 PM, Mark Johnston wrote:

On Thu, Nov 08, 2018 at 12:43:14PM +, Hans Petter Selasky wrote:

Author: hselasky
Date: Thu Nov  8 12:43:13 2018
New Revision: 340246
URL: https://svnweb.freebsd.org/changeset/base/340246

Log:
   Add /var/log/opensm.log to list of rotating log files.
   
   MFC after:		3 days

   Sponsored by:Mellanox Technologies

Modified:
   head/usr.sbin/newsyslog/newsyslog.conf


There is already an usr.sbin/newsyslog/newsyslog.d/opensm.conf.

Thank you. Do you have any objections adding a size limit for 
opensm.conf, and also to use bzip2?



Index: usr.sbin/newsyslog/newsyslog.conf.d/opensm.conf
===
--- usr.sbin/newsyslog/newsyslog.conf.d/opensm.conf (revision 339922)
+++ usr.sbin/newsyslog/newsyslog.conf.d/opensm.conf (working copy)
@@ -1,3 +1,3 @@
 # $FreeBSD$
 
-/var/log/opensm.log			600  7	*	*	Z	/var/run/opensm.pid	30

+/var/log/opensm.log600  7  1000*   J   
/var/run/opensm.pid 30


--HPS



Modified: head/usr.sbin/newsyslog/newsyslog.conf
==
--- head/usr.sbin/newsyslog/newsyslog.conf  Thu Nov  8 09:45:13 2018
(r340245)
+++ head/usr.sbin/newsyslog/newsyslog.conf  Thu Nov  8 12:43:13 2018
(r340246)
@@ -26,6 +26,7 @@
  /var/log/maillog  640  7 *@T00  JC
  /var/log/messages 644  5 1000 @0101T JC
  /var/log/monthly.log  640  12*$M1D0 JN
+/var/log/opensm.log644  3 1000 * J
  /var/log/devd.log 644  3 1000 * JC
  /var/log/security 600  101000 * JC
  /var/log/utx.log  644  3 *@01T05 B






___
svn-src-all@freebsd.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: r340253 - head/usr.sbin/newsyslog

2018-11-08 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Nov  8 16:23:09 2018
New Revision: 340253
URL: https://svnweb.freebsd.org/changeset/base/340253

Log:
  Revert r340246.
  
  Sponsored by: Mellanox Technologies

Modified:
  head/usr.sbin/newsyslog/newsyslog.conf

Modified: head/usr.sbin/newsyslog/newsyslog.conf
==
--- head/usr.sbin/newsyslog/newsyslog.conf  Thu Nov  8 15:12:36 2018
(r340252)
+++ head/usr.sbin/newsyslog/newsyslog.conf  Thu Nov  8 16:23:09 2018
(r340253)
@@ -26,7 +26,6 @@
 /var/log/maillog   640  7 *@T00  JC
 /var/log/messages  644  5 1000 @0101T JC
 /var/log/monthly.log   640  12*$M1D0 JN
-/var/log/opensm.log644  3 1000 * J
 /var/log/devd.log  644  3 1000 * JC
 /var/log/security  600  101000 * JC
 /var/log/utx.log   644  3 *@01T05 B
___
svn-src-all@freebsd.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: r340246 - head/usr.sbin/newsyslog

2018-11-08 Thread Mark Johnston
On Thu, Nov 08, 2018 at 12:43:14PM +, Hans Petter Selasky wrote:
> Author: hselasky
> Date: Thu Nov  8 12:43:13 2018
> New Revision: 340246
> URL: https://svnweb.freebsd.org/changeset/base/340246
> 
> Log:
>   Add /var/log/opensm.log to list of rotating log files.
>   
>   MFC after:  3 days
>   Sponsored by:   Mellanox Technologies
> 
> Modified:
>   head/usr.sbin/newsyslog/newsyslog.conf

There is already an usr.sbin/newsyslog/newsyslog.d/opensm.conf.

> 
> Modified: head/usr.sbin/newsyslog/newsyslog.conf
> ==
> --- head/usr.sbin/newsyslog/newsyslog.confThu Nov  8 09:45:13 2018
> (r340245)
> +++ head/usr.sbin/newsyslog/newsyslog.confThu Nov  8 12:43:13 2018
> (r340246)
> @@ -26,6 +26,7 @@
>  /var/log/maillog 640  7 *@T00  JC
>  /var/log/messages644  5 1000 @0101T JC
>  /var/log/monthly.log 640  12*$M1D0 JN
> +/var/log/opensm.log  644  3 1000 * J
>  /var/log/devd.log644  3 1000 * JC
>  /var/log/security600  101000 * JC
>  /var/log/utx.log 644  3 *@01T05 B
> 
___
svn-src-all@freebsd.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: r340252 - head/sys/amd64/amd64

2018-11-08 Thread Mateusz Guzik
Author: mjg
Date: Thu Nov  8 15:12:36 2018
New Revision: 340252
URL: https://svnweb.freebsd.org/changeset/base/340252

Log:
  amd64: align memset buffers to 16 bytes before using rep stos
  
  Both Intel manual and Agner Fog's docs suggest aligning to 16.
  
  See the review for benchmark results.
  
  Reviewed by:  kib (previous version)
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D17661

Modified:
  head/sys/amd64/amd64/support.S

Modified: head/sys/amd64/amd64/support.S
==
--- head/sys/amd64/amd64/support.S  Thu Nov  8 14:46:21 2018
(r340251)
+++ head/sys/amd64/amd64/support.S  Thu Nov  8 15:12:36 2018
(r340252)
@@ -515,24 +515,38 @@ END(memcpy_erms)
 1256:
movq%rdi,%r9
movq%r10,%rax
+   testl   $15,%edi
+   jnz 3f
+1:
 .if \erms == 1
rep
stosb
movq%r9,%rax
 .else
+   movq%rcx,%rdx
shrq$3,%rcx
rep
stosq
movq%r9,%rax
andl$7,%edx
-   jnz 1f
+   jnz 2f
POP_FRAME_POINTER
ret
-1:
+2:
movq%r10,-8(%rdi,%rdx)
 .endif
POP_FRAME_POINTER
ret
+   ALIGN_TEXT
+3:
+   movq%r10,(%rdi)
+   movq%r10,8(%rdi)
+   movq%rdi,%r8
+   andq$15,%r8
+   leaq-16(%rcx,%r8),%rcx
+   neg %r8
+   leaq16(%rdi,%r8),%rdi
+   jmp 1b
 .endm
 
 ENTRY(memset_std)
___
svn-src-all@freebsd.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: r340241 - head/sys/vm

2018-11-08 Thread Jonathan T. Looney
Nice find!

Jonathan

On Wed, Nov 7, 2018 at 6:28 PM Mark Johnston  wrote:

> Author: markj
> Date: Wed Nov  7 23:28:11 2018
> New Revision: 340241
> URL: https://svnweb.freebsd.org/changeset/base/340241
>
> Log:
>   Fix a use-after-free in swp_pager_meta_free().
>
>   This was introduced in r326329 and explains the crashes mentioned in
>   the commit log message for r339934.  In particular, on INVARIANTS
>   kernels, UMA trashing causes the loop to exit early, leaving swap
>   blocks behind when they should have been freed.  After r336984 this
>   became more problematic since new anonymous mappings were more
>   likely to reuse swapped-out subranges of existing VM objects, so faults
>   would trigger pageins of freed memory rather than returning zeroed
>   pages.
>
>   Reviewed by:  kib
>   MFC after:3 days
>   Sponsored by: The FreeBSD Foundation
>   Differential Revision:https://reviews.freebsd.org/D17897
>
> Modified:
>   head/sys/vm/swap_pager.c
>
> Modified: head/sys/vm/swap_pager.c
>
> ==
> --- head/sys/vm/swap_pager.cWed Nov  7 21:36:52 2018(r340240)
> +++ head/sys/vm/swap_pager.cWed Nov  7 23:28:11 2018(r340241)
> @@ -1972,13 +1972,13 @@ swp_pager_meta_free(vm_object_t object,
> vm_pindex_t pi
> swp_pager_update_freerange(_free, _free,
> sb->d[i]);
> sb->d[i] = SWAPBLK_NONE;
> }
> +   pindex = sb->p + SWAP_META_PAGES;
> if (swp_pager_swblk_empty(sb, 0, start) &&
> swp_pager_swblk_empty(sb, limit, SWAP_META_PAGES)) {
> SWAP_PCTRIE_REMOVE(>un_pager.swp.swp_blks,
> sb->p);
> uma_zfree(swblk_zone, sb);
> }
> -   pindex = sb->p + SWAP_META_PAGES;
> }
> swp_pager_freeswapspace(s_free, n_free);
>  }
>
>
___
svn-src-all@freebsd.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: r340251 - head/share/man/man4

2018-11-08 Thread Bjoern A. Zeeb
Author: bz
Date: Thu Nov  8 14:46:21 2018
New Revision: 340251
URL: https://svnweb.freebsd.org/changeset/base/340251

Log:
  Update rum(4) and run(4) man pages to reflect that newer versions
  of TP-LINK TL-WN321G are run(4) and not rum(4) anymore.
  
  Reported by:  J (tech-lists zyxst.net)
  MFC after:3 days

Modified:
  head/share/man/man4/rum.4
  head/share/man/man4/run.4

Modified: head/share/man/man4/rum.4
==
--- head/share/man/man4/rum.4   Thu Nov  8 14:21:25 2018(r340250)
+++ head/share/man/man4/rum.4   Thu Nov  8 14:46:21 2018(r340251)
@@ -16,7 +16,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 9, 2016
+.Dd November 8, 2018
 .Dt RUM 4
 .Os
 .Sh NAME
@@ -123,7 +123,7 @@ including:
 .It "Sitecom WL-113 ver 2" Ta USB
 .It "Sitecom WL-172" Ta USB
 .It "Sweex LW053" Ta USB
-.It "TP-LINK TL-WN321G" Ta USB
+.It "TP-LINK TL-WN321G v1/v2/v3" Ta USB
 .El
 .Sh EXAMPLES
 Join an existing BSS network (i.e., connect to an access point):

Modified: head/share/man/man4/run.4
==
--- head/share/man/man4/run.4   Thu Nov  8 14:21:25 2018(r340250)
+++ head/share/man/man4/run.4   Thu Nov  8 14:46:21 2018(r340251)
@@ -16,7 +16,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 10, 2018
+.Dd November 8, 2018
 .Dt RUN 4
 .Os
 .Sh NAME
@@ -176,6 +176,7 @@ driver supports the following wireless adapters:
 .It Sweex LW303
 .It Sweex LW313
 .It TP-LINK TL-WDN3200
+.It TP-LINK TL-WN321G v4
 .It TP-LINK TL-WN727N v3
 .It Unex DNUR-81
 .It Unex DNUR-82
___
svn-src-all@freebsd.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: r340250 - stable/12/sys/cam/scsi

2018-11-08 Thread Warner Losh
Author: imp
Date: Thu Nov  8 14:21:25 2018
New Revision: 340250
URL: https://svnweb.freebsd.org/changeset/base/340250

Log:
  MFC r340155: Assert locks held for async events.
  
  Approved by:  re@ (gjb)

Modified:
  stable/12/sys/cam/scsi/scsi_da.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cam/scsi/scsi_da.c
==
--- stable/12/sys/cam/scsi/scsi_da.cThu Nov  8 13:17:38 2018
(r340249)
+++ stable/12/sys/cam/scsi/scsi_da.cThu Nov  8 14:21:25 2018
(r340250)
@@ -2002,7 +2002,7 @@ daasync(void *callback_arg, u_int32_t code,
 
periph = (struct cam_periph *)callback_arg;
switch (code) {
-   case AC_FOUND_DEVICE:
+   case AC_FOUND_DEVICE:   /* callback to create periph, no locking yet */
{
struct ccb_getdev *cgd;
cam_status status;
@@ -2038,7 +2038,7 @@ daasync(void *callback_arg, u_int32_t code,
"due to status 0x%x\n", status);
return;
}
-   case AC_ADVINFO_CHANGED:
+   case AC_ADVINFO_CHANGED:/* Doesn't touch periph */
{
uintptr_t buftype;
 
@@ -2061,8 +2061,10 @@ daasync(void *callback_arg, u_int32_t code,
ccb = (union ccb *)arg;
 
/*
-* Handle all UNIT ATTENTIONs except our own,
-* as they will be handled by daerror().
+* Handle all UNIT ATTENTIONs except our own, as they will be
+* handled by daerror(). Since this comes from a different 
periph,
+* that periph's lock is held, not ours, so we have to take it 
ours
+* out to touch softc flags.
 */
if (xpt_path_periph(ccb->ccb_h.path) != periph &&
scsi_extract_sense_ccb(ccb,
@@ -2090,9 +2092,13 @@ daasync(void *callback_arg, u_int32_t code,
}
break;
}
-   case AC_SCSI_AEN:
+   case AC_SCSI_AEN:   /* Called for this path: periph locked 
*/
+   /*
+* Appears to be currently unused for SCSI devices, only ata 
SIMs
+* generate this.
+*/
+   cam_periph_assert(periph, MA_OWNED);
softc = (struct da_softc *)periph->softc;
-   cam_periph_lock(periph);
if (!cam_iosched_has_work_flags(softc->cam_iosched, 
DA_WORK_TUR) &&
(softc->flags & DA_FLAG_TUR_PENDING) == 0) {
if (da_periph_acquire(periph, DA_REF_TUR) == 0) {
@@ -2100,31 +2106,28 @@ daasync(void *callback_arg, u_int32_t code,
daschedule(periph);
}
}
-   cam_periph_unlock(periph);
/* FALLTHROUGH */
-   case AC_SENT_BDR:
-   case AC_BUS_RESET:
+   case AC_SENT_BDR:   /* Called for this path: periph locked 
*/
+   case AC_BUS_RESET:  /* Called for this path: periph locked 
*/
{
struct ccb_hdr *ccbh;
 
+   cam_periph_assert(periph, MA_OWNED);
softc = (struct da_softc *)periph->softc;
/*
 * Don't fail on the expected unit attention
 * that will occur.
 */
-   cam_periph_lock(periph);
softc->flags |= DA_FLAG_RETRY_UA;
LIST_FOREACH(ccbh, >pending_ccbs, periph_links.le)
ccbh->ccb_state |= DA_CCB_RETRY_UA;
-   cam_periph_unlock(periph);
break;
}
-   case AC_INQ_CHANGED:
-   cam_periph_lock(periph);
+   case AC_INQ_CHANGED:/* Called for this path: periph locked 
*/
+   cam_periph_assert(periph, MA_OWNED);
softc = (struct da_softc *)periph->softc;
softc->flags &= ~DA_FLAG_PROBED;
dareprobe(periph);
-   cam_periph_unlock(periph);
break;
default:
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: r340249 - head/sbin/ipfw

2018-11-08 Thread Eugene Grosbein
Author: eugen
Date: Thu Nov  8 13:17:38 2018
New Revision: 340249
URL: https://svnweb.freebsd.org/changeset/base/340249

Log:
  ipfw.8: fix small syntax error in an example
  
  MFC after:3 days

Modified:
  head/sbin/ipfw/ipfw.8

Modified: head/sbin/ipfw/ipfw.8
==
--- head/sbin/ipfw/ipfw.8   Thu Nov  8 12:46:47 2018(r340248)
+++ head/sbin/ipfw/ipfw.8   Thu Nov  8 13:17:38 2018(r340249)
@@ -4285,7 +4285,7 @@ In the following example per-interface firewall is cre
 .Pp
 The following example illustrate usage of flow tables:
 .Pp
-.Dl "ipfw table fl create type flow:flow:src-ip,proto,dst-ip,dst-port"
+.Dl "ipfw table fl create type flow:src-ip,proto,dst-ip,dst-port"
 .Dl "ipfw table fl add 2a02:6b8:77::88,tcp,2a02:6b8:77::99,80 11"
 .Dl "ipfw table fl add 10.0.0.1,udp,10.0.0.2,53 12"
 .Dl ".."
___
svn-src-all@freebsd.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: r340248 - head/sys/dev/sound/usb

2018-11-08 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Nov  8 12:46:47 2018
New Revision: 340248
URL: https://svnweb.freebsd.org/changeset/base/340248

Log:
  Don't read the USB audio sync endpoint when we don't use it to save
  isochronous bandwidth.
  
  MFC after:3 days
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/sound/usb/uaudio.c

Modified: head/sys/dev/sound/usb/uaudio.c
==
--- head/sys/dev/sound/usb/uaudio.c Thu Nov  8 12:45:28 2018
(r340247)
+++ head/sys/dev/sound/usb/uaudio.c Thu Nov  8 12:46:47 2018
(r340248)
@@ -100,7 +100,7 @@ static int uaudio_default_channels = 0; /* use 
defaul
 static int uaudio_buffer_ms = 8;
 
 #ifdef USB_DEBUG
-static int uaudio_debug = 0;
+static int uaudio_debug;
 
 static SYSCTL_NODE(_hw_usb, OID_AUTO, uaudio, CTLFLAG_RW, 0, "USB uaudio");
 
@@ -136,6 +136,8 @@ uaudio_buffer_ms_sysctl(SYSCTL_HANDLER_ARGS)
 SYSCTL_PROC(_hw_usb_uaudio, OID_AUTO, buffer_ms, CTLTYPE_INT | CTLFLAG_RWTUN,
 0, sizeof(int), uaudio_buffer_ms_sysctl, "I",
 "uaudio buffering delay from 2ms to 8ms");
+#else
+#defineuaudio_debug 0
 #endif
 
 #defineUAUDIO_NFRAMES  64  /* must be factor of 8 due 
HS-USB */
@@ -2161,6 +2163,14 @@ uaudio_chan_play_sync_callback(struct usb_xfer *xfer, 
break;
 
case USB_ST_SETUP:
+   /*
+* Check if the recording stream can be used as a
+* source of jitter information to save some
+* isochronous bandwidth:
+*/
+   if (ch->priv_sc->sc_rec_chan.num_alt != 0 &&
+   uaudio_debug == 0)
+   break;
usbd_xfer_set_frames(xfer, 1);
usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_framelen(xfer));
usbd_transfer_submit(xfer);
___
svn-src-all@freebsd.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: r340246 - head/usr.sbin/newsyslog

2018-11-08 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Nov  8 12:43:13 2018
New Revision: 340246
URL: https://svnweb.freebsd.org/changeset/base/340246

Log:
  Add /var/log/opensm.log to list of rotating log files.
  
  MFC after:3 days
  Sponsored by: Mellanox Technologies

Modified:
  head/usr.sbin/newsyslog/newsyslog.conf

Modified: head/usr.sbin/newsyslog/newsyslog.conf
==
--- head/usr.sbin/newsyslog/newsyslog.conf  Thu Nov  8 09:45:13 2018
(r340245)
+++ head/usr.sbin/newsyslog/newsyslog.conf  Thu Nov  8 12:43:13 2018
(r340246)
@@ -26,6 +26,7 @@
 /var/log/maillog   640  7 *@T00  JC
 /var/log/messages  644  5 1000 @0101T JC
 /var/log/monthly.log   640  12*$M1D0 JN
+/var/log/opensm.log644  3 1000 * J
 /var/log/devd.log  644  3 1000 * JC
 /var/log/security  600  101000 * JC
 /var/log/utx.log   644  3 *@01T05 B
___
svn-src-all@freebsd.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: r340245 - head/sbin/ping

2018-11-08 Thread Eugene Grosbein
Author: eugen
Date: Thu Nov  8 09:45:13 2018
New Revision: 340245
URL: https://svnweb.freebsd.org/changeset/base/340245

Log:
  ping(8): improve diagnostics in case of wrong arguments.
  
  For example, in case of super-user:
  $ sudo ping -s -64 127.0.0.1
  PING 127.0.0.1 (127.0.0.1): -64 data bytes
  ping: sendto: Invalid argument
  
  For unprivileged user:
  $ ping -s -64 127.0.0.1
  ping: packet size too large: 18446744073709551552 > 56: Operation not 
permitted
  
  Fix this by switching from strtoul() to strtol() for integer arguments
  and adding explicit checks for negative values.
  
  MFC after:1 month

Modified:
  head/sbin/ping/ping.c

Modified: head/sbin/ping/ping.c
==
--- head/sbin/ping/ping.c   Thu Nov  8 03:25:18 2018(r340244)
+++ head/sbin/ping/ping.c   Thu Nov  8 09:45:13 2018(r340245)
@@ -242,7 +242,8 @@ main(int argc, char *const *argv)
 #endif
struct sockaddr_in *to;
double t;
-   u_long alarmtimeout, ultmp;
+   u_long alarmtimeout;
+   long ltmp;
int almost_done, ch, df, hold, i, icmp_len, mib[4], preload;
int ssend_errno, srecv_errno, tos, ttl;
char ctrl[CMSG_SPACE(sizeof(struct timeval))];
@@ -311,12 +312,12 @@ main(int argc, char *const *argv)
options |= F_AUDIBLE;
break;
case 'c':
-   ultmp = strtoul(optarg, , 0);
-   if (*ep || ep == optarg || ultmp > LONG_MAX || !ultmp)
+   ltmp = strtol(optarg, , 0);
+   if (*ep || ep == optarg || ltmp > LONG_MAX || ltmp <=0)
errx(EX_USAGE,
"invalid count of packets to transmit: 
`%s'",
optarg);
-   npackets = ultmp;
+   npackets = ltmp;
break;
case 'D':
options |= F_HDRINCL;
@@ -334,46 +335,46 @@ main(int argc, char *const *argv)
setbuf(stdout, (char *)NULL);
break;
case 'G': /* Maximum packet size for ping sweep */
-   ultmp = strtoul(optarg, , 0);
-   if (*ep || ep == optarg)
+   ltmp = strtol(optarg, , 0);
+   if (*ep || ep == optarg || ltmp <= 0)
errx(EX_USAGE, "invalid packet size: `%s'",
optarg);
-   if (uid != 0 && ultmp > DEFDATALEN) {
+   if (uid != 0 && ltmp > DEFDATALEN) {
errno = EPERM;
err(EX_NOPERM,
-   "packet size too large: %lu > %u",
-   ultmp, DEFDATALEN);
+   "packet size too large: %ld > %u",
+   ltmp, DEFDATALEN);
}
options |= F_SWEEP;
-   sweepmax = ultmp;
+   sweepmax = ltmp;
break;
case 'g': /* Minimum packet size for ping sweep */
-   ultmp = strtoul(optarg, , 0);
-   if (*ep || ep == optarg)
+   ltmp = strtol(optarg, , 0);
+   if (*ep || ep == optarg || ltmp <= 0)
errx(EX_USAGE, "invalid packet size: `%s'",
optarg);
-   if (uid != 0 && ultmp > DEFDATALEN) {
+   if (uid != 0 && ltmp > DEFDATALEN) {
errno = EPERM;
err(EX_NOPERM,
-   "packet size too large: %lu > %u",
-   ultmp, DEFDATALEN);
+   "packet size too large: %ld > %u",
+   ltmp, DEFDATALEN);
}
options |= F_SWEEP;
-   sweepmin = ultmp;
+   sweepmin = ltmp;
break;
case 'h': /* Packet size increment for ping sweep */
-   ultmp = strtoul(optarg, , 0);
-   if (*ep || ep == optarg || ultmp < 1)
+   ltmp = strtol(optarg, , 0);
+   if (*ep || ep == optarg || ltmp < 1)
errx(EX_USAGE, "invalid increment size: `%s'",
optarg);
-   if (uid != 0 && ultmp > DEFDATALEN) {
+   if (uid != 0 && ltmp > DEFDATALEN) {
errno = EPERM;
err(EX_NOPERM,
-