svn commit: r343930 - head/sbin/sysctl

2019-02-08 Thread Guangyuan Yang
Author: ygy (doc committer)
Date: Sat Feb  9 04:36:02 2019
New Revision: 343930
URL: https://svnweb.freebsd.org/changeset/base/343930

Log:
  Remove -R option which was added to sysctl(8) man page per r244106, but it is 
not implemented.
  
  MFC after:3 days
  Submitted by: Alfonso Siciliano 
  Reviewed by:  0mp, imp
  Differential Revision:https://reviews.freebsd.org/D19012

Modified:
  head/sbin/sysctl/sysctl.8

Modified: head/sbin/sysctl/sysctl.8
==
--- head/sbin/sysctl/sysctl.8   Sat Feb  9 03:56:48 2019(r343929)
+++ head/sbin/sysctl/sysctl.8   Sat Feb  9 04:36:02 2019(r343930)
@@ -28,7 +28,7 @@
 .\"From: @(#)sysctl.8  8.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd September 24, 2018
+.Dd February 8, 2019
 .Dt SYSCTL 8
 .Os
 .Sh NAME
@@ -36,13 +36,13 @@
 .Nd get or set kernel state
 .Sh SYNOPSIS
 .Nm
-.Op Fl bdehiNnoRTtqx
+.Op Fl bdehiNnoTtqWx
 .Op Fl B Ar bufsize
 .Op Fl f Ar filename
 .Ar name Ns Op = Ns Ar value Ns Op , Ns Ar value
 .Ar ...
 .Nm
-.Op Fl bdehNnoRTtqx
+.Op Fl bdehNnoTtqWx
 .Op Fl B Ar bufsize
 .Fl a
 .Sh DESCRIPTION
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343929 - head/sys/vm

2019-02-08 Thread Konstantin Belousov
Author: kib
Date: Sat Feb  9 03:56:48 2019
New Revision: 343929
URL: https://svnweb.freebsd.org/changeset/base/343929

Log:
  i386: honor kern.elf32.read_exec for ommap(2) and break(2), as already
  done on amd64.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/vm/vm_mmap.c
  head/sys/vm/vm_unix.c

Modified: head/sys/vm/vm_mmap.c
==
--- head/sys/vm/vm_mmap.c   Sat Feb  9 03:51:51 2019(r343928)
+++ head/sys/vm/vm_mmap.c   Sat Feb  9 03:56:48 2019(r343929)
@@ -414,12 +414,10 @@ ommap(struct thread *td, struct ommap_args *uap)
 #defineOMAP_FIXED  0x0100
 
prot = cvtbsdprot[uap->prot & 0x7];
-#ifdef COMPAT_FREEBSD32
-#if defined(__amd64__)
+#if (defined(COMPAT_FREEBSD32) && defined(__amd64__)) || defined(__i386__)
if (i386_read_exec && SV_PROC_FLAG(td->td_proc, SV_ILP32) &&
prot != 0)
prot |= PROT_EXEC;
-#endif
 #endif
flags = 0;
if (uap->flags & OMAP_ANON)

Modified: head/sys/vm/vm_unix.c
==
--- head/sys/vm/vm_unix.c   Sat Feb  9 03:51:51 2019(r343928)
+++ head/sys/vm/vm_unix.c   Sat Feb  9 03:56:48 2019(r343929)
@@ -180,11 +180,9 @@ kern_break(struct thread *td, uintptr_t *addr)
}
 #endif
prot = VM_PROT_RW;
-#ifdef COMPAT_FREEBSD32
-#if defined(__amd64__)
+#if (defined(COMPAT_FREEBSD32) && defined(__amd64__)) || defined(__i386__)
if (i386_read_exec && SV_PROC_FLAG(td->td_proc, SV_ILP32))
prot |= VM_PROT_EXECUTE;
-#endif
 #endif
rv = vm_map_insert(map, NULL, 0, old, new, prot, VM_PROT_ALL, 
0);
if (rv != KERN_SUCCESS) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343928 - in head/sys: compat/freebsd32 sys vm

2019-02-08 Thread Konstantin Belousov
Author: kib
Date: Sat Feb  9 03:51:51 2019
New Revision: 343928
URL: https://svnweb.freebsd.org/changeset/base/343928

Log:
  Normalize the declaration of i386_read_exec variable.
  
  It is currently re-declared in sys/sysent.h which is a wrong place for
  MD variable.  Which causes redeclaration error with gcc when
  sys/sysent.h and machine/md_var.h are included both.
  
  Remove it from sys/sysent.h and instead include machine/md_var.h when
  needed, under #ifdef for both i386 and amd64.
  
  Reported and tested by:   bde
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/compat/freebsd32/freebsd32_misc.c
  head/sys/sys/sysent.h
  head/sys/vm/vm_mmap.c
  head/sys/vm/vm_unix.c

Modified: head/sys/compat/freebsd32/freebsd32_misc.c
==
--- head/sys/compat/freebsd32/freebsd32_misc.c  Sat Feb  9 03:00:00 2019
(r343927)
+++ head/sys/compat/freebsd32/freebsd32_misc.c  Sat Feb  9 03:51:51 2019
(r343928)
@@ -106,6 +106,9 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#ifdef __amd64__
+#include 
+#endif
 
 #include 
 

Modified: head/sys/sys/sysent.h
==
--- head/sys/sys/sysent.h   Sat Feb  9 03:00:00 2019(r343927)
+++ head/sys/sys/sysent.h   Sat Feb  9 03:51:51 2019(r343928)
@@ -163,10 +163,6 @@ extern struct sysentvec aout_sysvec;
 extern struct sysent sysent[];
 extern const char *syscallnames[];
 
-#if defined(__amd64__)
-extern int i386_read_exec;
-#endif
-
 #defineNO_SYSCALL (-1)
 
 struct module;

Modified: head/sys/vm/vm_mmap.c
==
--- head/sys/vm/vm_mmap.c   Sat Feb  9 03:00:00 2019(r343927)
+++ head/sys/vm/vm_mmap.c   Sat Feb  9 03:51:51 2019(r343928)
@@ -74,6 +74,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#if defined(__amd64__) || defined(__i386__) /* for i386_read_exec */
+#include 
+#endif
 
 #include 
 #include 

Modified: head/sys/vm/vm_unix.c
==
--- head/sys/vm/vm_unix.c   Sat Feb  9 03:00:00 2019(r343927)
+++ head/sys/vm/vm_unix.c   Sat Feb  9 03:51:51 2019(r343928)
@@ -55,6 +55,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#if defined(__amd64__) || defined(__i386__) /* for i386_read_exec */
+#include 
+#endif
 
 #include 
 #include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343927 - head/sys/netgraph

2019-02-08 Thread Gleb Smirnoff
Author: glebius
Date: Sat Feb  9 03:00:00 2019
New Revision: 343927
URL: https://svnweb.freebsd.org/changeset/base/343927

Log:
  Remove remnants of byte order manipulation, back when FreeBSD stack
  stored packets in host byte order.

Modified:
  head/sys/netgraph/ng_ipfw.c

Modified: head/sys/netgraph/ng_ipfw.c
==
--- head/sys/netgraph/ng_ipfw.c Sat Feb  9 02:10:03 2019(r343926)
+++ head/sys/netgraph/ng_ipfw.c Sat Feb  9 03:00:00 2019(r343927)
@@ -288,7 +288,6 @@ static int
 ng_ipfw_input(struct mbuf **m0, int dir, struct ip_fw_args *fwa, int tee)
 {
struct mbuf *m;
-   struct ip *ip;
hook_p  hook;
int error = 0;
 
@@ -329,8 +328,6 @@ ng_ipfw_input(struct mbuf **m0, int dir, struct ip_fw_
if (m->m_len < sizeof(struct ip) &&
(m = m_pullup(m, sizeof(struct ip))) == NULL)
return (EINVAL);
-
-   ip = mtod(m, struct ip *);
 
NG_SEND_DATA_ONLY(error, hook, m);
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343924 - head/share/mk

2019-02-08 Thread Justin Hibbits
Author: jhibbits
Date: Sat Feb  9 02:04:27 2019
New Revision: 343924
URL: https://svnweb.freebsd.org/changeset/base/343924

Log:
  Correct the CPU target for powerpcspe
  
  The MPC8540 is actually e500v1, which doesn't have double-precision floating
  point support.  The 8548 does, so use that as the CPU target.
  
  MFC after:2 weeks

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

Modified: head/share/mk/bsd.cpu.mk
==
--- head/share/mk/bsd.cpu.mkSat Feb  9 01:49:53 2019(r343923)
+++ head/share/mk/bsd.cpu.mkSat Feb  9 02:04:27 2019(r343924)
@@ -135,7 +135,7 @@ _CPUCFLAGS = -Wa,-me500 -msoft-float
 _CPUCFLAGS = -mcpu=${CPUTYPE} -mno-powerpc64
 .  endif
 . elif ${MACHINE_ARCH} == "powerpcspe"
-_CPUCFLAGS = -Wa,-me500 -mspe=yes -mabi=spe -mfloat-gprs=double
+_CPUCFLAGS = -Wa,-me500 -mspe=yes -mabi=spe -mfloat-gprs=double -mcpu=8548
 . elif ${MACHINE_ARCH} == "powerpc64"
 _CPUCFLAGS = -mcpu=${CPUTYPE}
 . elif ${MACHINE_CPUARCH} == "mips"
@@ -362,7 +362,7 @@ CFLAGS += -mfloat-abi=softfp
 .endif
 
 .if ${MACHINE_ARCH} == "powerpcspe"
-CFLAGS += -mcpu=8540 -Wa,-me500 -mspe=yes -mabi=spe -mfloat-gprs=double
+CFLAGS += -mcpu=8548 -Wa,-me500 -mspe=yes -mabi=spe -mfloat-gprs=double
 .endif
 
 .if ${MACHINE_CPUARCH} == "riscv"
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343923 - head/sys/dev/cxgbe

2019-02-08 Thread Navdeep Parhar
Author: np
Date: Sat Feb  9 01:49:53 2019
New Revision: 343923
URL: https://svnweb.freebsd.org/changeset/base/343923

Log:
  cxgbe(4): Delay the panic due to a fatal error by 30s.
  
  This lets information logged by the interrupt handler reach the system
  log before the system goes down.

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

Modified: head/sys/dev/cxgbe/t4_main.c
==
--- head/sys/dev/cxgbe/t4_main.cFri Feb  8 23:03:28 2019
(r343922)
+++ head/sys/dev/cxgbe/t4_main.cSat Feb  9 01:49:53 2019
(r343923)
@@ -556,7 +556,7 @@ SYSCTL_INT(_hw_cxgbe, OID_AUTO, pcie_relaxed_ordering,
 
 static int t4_panic_on_fatal_err = 0;
 SYSCTL_INT(_hw_cxgbe, OID_AUTO, panic_on_fatal_err, CTLFLAG_RDTUN,
-_panic_on_fatal_err, 0, "panic on fatal firmware errors");
+_panic_on_fatal_err, 0, "panic on fatal errors");
 
 #ifdef TCP_OFFLOAD
 /*
@@ -2562,6 +2562,16 @@ vcxgbe_detach(device_t dev)
return (0);
 }
 
+static struct callout fatal_callout;
+
+static void
+delayed_panic(void *arg)
+{
+   struct adapter *sc = arg;
+
+   panic("%s: panic on fatal error", device_get_nameunit(sc->dev));
+}
+
 void
 t4_fatal_err(struct adapter *sc, bool fw_error)
 {
@@ -2569,9 +2579,6 @@ t4_fatal_err(struct adapter *sc, bool fw_error)
t4_shutdown_adapter(sc);
log(LOG_ALERT, "%s: encountered fatal error, adapter stopped.\n",
device_get_nameunit(sc->dev));
-   if (t4_panic_on_fatal_err)
-   panic("panic requested on fatal error");
-
if (fw_error) {
ASSERT_SYNCHRONIZED_OP(sc);
sc->flags |= ADAP_ERR;
@@ -2580,6 +2587,12 @@ t4_fatal_err(struct adapter *sc, bool fw_error)
sc->flags |= ADAP_ERR;
ADAPTER_UNLOCK(sc);
}
+
+   if (t4_panic_on_fatal_err) {
+   log(LOG_ALERT, "%s: panic on fatal error after 30s",
+   device_get_nameunit(sc->dev));
+   callout_reset(_callout, hz * 30, delayed_panic, sc);
+   }
 }
 
 void
@@ -10685,6 +10698,7 @@ mod_event(module_t mod, int cmd, void *arg)
do_smt_write_rpl);
sx_init(_list_lock, "T4/T5 adapters");
SLIST_INIT(_list);
+   callout_init(_callout, 1);
 #ifdef TCP_OFFLOAD
sx_init(_uld_list_lock, "T4/T5 ULDs");
SLIST_INIT(_uld_list);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343922 - head/sbin/dhclient

2019-02-08 Thread Jilles Tjoelker
Author: jilles
Date: Fri Feb  8 23:03:28 2019
New Revision: 343922
URL: https://svnweb.freebsd.org/changeset/base/343922

Log:
  dhclient: Return non-zero status when script exits due to a signal
  
  r343896 made it such that a non-zero exit status was passed through, but was
  still wrong if the script exits on a signal. POSIX does not say what the
  WEXITSTATUS macro returns in this case and in practice 0 is a common value.
  
  Instead, translate the wait status into 8 bits the same way as the shell
  calculates $?.
  
  Reviewed by:  kib, Nash Kaminski
  MFC after:1 week

Modified:
  head/sbin/dhclient/dhclient.c

Modified: head/sbin/dhclient/dhclient.c
==
--- head/sbin/dhclient/dhclient.c   Fri Feb  8 22:10:40 2019
(r343921)
+++ head/sbin/dhclient/dhclient.c   Fri Feb  8 23:03:28 2019
(r343922)
@@ -2348,7 +2348,8 @@ priv_script_go(void)
if (ip)
script_flush_env(ip->client);
 
-   return WEXITSTATUS(wstatus);
+   return (WIFEXITED(wstatus) ?
+   WEXITSTATUS(wstatus) : 128 + WTERMSIG(wstatus));
 }
 
 void
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343921 - head/usr.sbin/pw

2019-02-08 Thread Benedict Reuschling
Author: bcr (doc committer)
Date: Fri Feb  8 22:10:40 2019
New Revision: 343921
URL: https://svnweb.freebsd.org/changeset/base/343921

Log:
  Add an example to pw.8 about how to add an existing user to a group.
  
  Instead of using pw to modify group membership, users often edit
  /etc/group by hand, which is discouraged.  Provide an example of
  adding a user to the wheel group, which is a common use case.
  I'm using a different user here as in the previous example as that
  deleted the user (although the examples don't necessarily have to
  be followed in order).
  
  Reviewed by:  rgrimes,0mp
  Approved by:  0mp
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D19123

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

Modified: head/usr.sbin/pw/pw.8
==
--- head/usr.sbin/pw/pw.8   Fri Feb  8 20:42:49 2019(r343920)
+++ head/usr.sbin/pw/pw.8   Fri Feb  8 22:10:40 2019(r343921)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 10, 2017
+.Dd February 8, 2019
 .Dt PW 8
 .Os
 .Sh NAME
@@ -978,6 +978,12 @@ pw useradd -n gsmith -c "Glurmo Smith" -s /bin/csh -m 
 Delete the gsmith user and their home directory, including contents.
 .Bd -literal -offset indent
 pw userdel -n gsmith -r
+.Ed
+.Pp
+Add the existing user jsmith to the wheel group,
+in addition to the other groups jsmith is already a member of.
+.Bd -literal -offset indent
+pw groupmod wheel -m jsmith
 .Ed
 .Sh EXIT STATUS
 The
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343920 - head/sys/netinet/cc

2019-02-08 Thread Michael Tuexen
Author: tuexen
Date: Fri Feb  8 20:42:49 2019
New Revision: 343920
URL: https://svnweb.freebsd.org/changeset/base/343920

Log:
  Ensure that when using the TCP CDG congestion control and setting the
  sysctl variable net.inet.tcp.cc.cdg.smoothing_factor to 0, the smoothing
  is disabled. Without this patch, a division by zero orrurs.
  
  PR:   193762
  Reviewed by:  lstewart@, rrs@
  MFC after:3 days
  Sponsored by: Netflix, Inc.
  Differential Revision:https://reviews.freebsd.org/D19071

Modified:
  head/sys/netinet/cc/cc_cdg.c

Modified: head/sys/netinet/cc/cc_cdg.c
==
--- head/sys/netinet/cc/cc_cdg.cFri Feb  8 20:34:47 2019
(r343919)
+++ head/sys/netinet/cc/cc_cdg.cFri Feb  8 20:42:49 2019
(r343920)
@@ -592,7 +592,11 @@ cdg_ack_received(struct cc_var *ccv, uint16_t ack_type
qdiff_min = ((long)(cdg_data->minrtt_in_rtt -
cdg_data->minrtt_in_prevrtt) << D_P_E );
 
-   calc_moving_average(cdg_data, qdiff_max, qdiff_min);
+   if (cdg_data->sample_q_size == 0) {
+   cdg_data->max_qtrend = qdiff_max;
+   cdg_data->min_qtrend = qdiff_min;
+   } else
+   calc_moving_average(cdg_data, qdiff_max, 
qdiff_min);
 
/* Probabilistic backoff with respect to gradient. */
if (slowstart && qdiff_min > 0)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343919 - head/sys/dev/e1000

2019-02-08 Thread Patrick Kelsey
Author: pkelsey
Date: Fri Feb  8 20:34:47 2019
New Revision: 343919
URL: https://svnweb.freebsd.org/changeset/base/343919

Log:
  Fix em(4) interrupt routing
  
  When configured with more tx queues than rx queues,
  em_if_msix_intr_assign() was incorrectly routing the tx event
  interrupts.
  
  Reviewed by:  erj, marius
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D19070

Modified:
  head/sys/dev/e1000/if_em.c

Modified: head/sys/dev/e1000/if_em.c
==
--- head/sys/dev/e1000/if_em.c  Fri Feb  8 19:19:31 2019(r343918)
+++ head/sys/dev/e1000/if_em.c  Fri Feb  8 20:34:47 2019(r343919)
@@ -1996,7 +1996,7 @@ em_if_msix_intr_assign(if_ctx_t ctx, int msix)
>rx_queues[i % adapter->rx_num_queues].que_irq,
IFLIB_INTR_TX, tx_que, tx_que->me, buf);
 
-   tx_que->msix = (vector % adapter->tx_num_queues);
+   tx_que->msix = (vector % adapter->rx_num_queues);
 
/*
 * Set the bit to enable interrupt
@@ -2009,9 +2009,9 @@ em_if_msix_intr_assign(if_ctx_t ctx, int msix)
adapter->ims |= tx_que->eims;
adapter->ivars |= (8 | tx_que->msix) << (8 + (i * 4));
} else if (adapter->hw.mac.type == e1000_82575) {
-   tx_que->eims = E1000_EICR_TX_QUEUE0 << (i %  
adapter->tx_num_queues);
+   tx_que->eims = E1000_EICR_TX_QUEUE0 << i;
} else {
-   tx_que->eims = 1 << (i %  adapter->tx_num_queues);
+   tx_que->eims = 1 << i;
}
}
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343918 - head/libexec/rc/rc.d

2019-02-08 Thread Colin Percival
Author: cperciva
Date: Fri Feb  8 19:19:31 2019
New Revision: 343918
URL: https://svnweb.freebsd.org/changeset/base/343918

Log:
  Teach /etc/rc.d/growfs how to handle systems running ZFS.
  
  There are many cases which this code does not handle (e.g. ZFS mirrors)
  but the code can handle the single-disk case -- so it's enough to take
  care of the "disk image which gets booted into a VM with a larger than
  expected disk" case for which this firstboot script was created.
  
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D19095

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

Modified: head/libexec/rc/rc.d/growfs
==
--- head/libexec/rc/rc.d/growfs Fri Feb  8 18:31:54 2019(r343917)
+++ head/libexec/rc/rc.d/growfs Fri Feb  8 19:19:31 2019(r343918)
@@ -49,7 +49,20 @@ rcvar="growfs_enable"
 growfs_start ()
 {
echo "Growing root partition to fill device"
-   rootdev=$(df / | tail -n 1 | awk '{ sub("/dev/", "", $1); print $1 }')
+   FSTYPE=$(mount -p | awk '{ if ( $2 == "/") { print $3 }}')
+   FSDEV=$(mount -p | awk '{ if ( $2 == "/") { print $1 }}')
+   case "$FSTYPE" in
+   ufs)
+   rootdev=${FSDEV#/dev/}
+   ;;
+   zfs)
+   pool=${FSDEV%%/*}
+   rootdev=$(zpool list -v $pool | tail -n 1 | awk '{ print $1 }')
+   ;;
+   *)
+   echo "Don't know how to grow root filesystem type: $FSTYPE"
+   return
+   esac
if [ x"$rootdev" = x"${rootdev%/*}" ]; then
# raw device
rawdev="$rootdev"
@@ -91,7 +104,14 @@ growfs_start ()
}
 }' dev="$rawdev"
gpart commit "$rootdev"
-   growfs -y /dev/"$rootdev"
+   case "$FSTYPE" in
+   ufs)
+   growfs -y /dev/"$rootdev"
+   ;;
+   zfs)
+   zpool online -e $pool $rootdev
+   ;;
+   esac
 }
 
 load_rc_config $name
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343917 - in head: contrib/netbsd-tests/lib/libm lib/msun/tests

2019-02-08 Thread Dimitry Andric
Author: dim
Date: Fri Feb  8 18:31:54 2019
New Revision: 343917
URL: https://svnweb.freebsd.org/changeset/base/343917

Log:
  Amend r343442, by only expecting the lib.msun.cbrt_test.cbrtl_powl and
  trig_test.reduction test cases to fail, if the fixes from r343916 have
  not yet been applied to the base compiler.
  
  Reported by:lwhsu
  PR:   234040
  Upstream PR:  https://bugs.llvm.org/show_bug.cgi?id=40206
  MFC after:1 week

Modified:
  head/contrib/netbsd-tests/lib/libm/t_cbrt.c
  head/lib/msun/tests/trig_test.c

Modified: head/contrib/netbsd-tests/lib/libm/t_cbrt.c
==
--- head/contrib/netbsd-tests/lib/libm/t_cbrt.c Fri Feb  8 18:24:53 2019
(r343916)
+++ head/contrib/netbsd-tests/lib/libm/t_cbrt.c Fri Feb  8 18:31:54 2019
(r343917)
@@ -268,7 +268,8 @@ ATF_TC_BODY(cbrtl_powl, tc)
long double y, z;
size_t i;
 
-#if defined(__amd64__) && defined(__clang__) && __clang_major__ >= 7
+#if defined(__amd64__) && defined(__clang__) && __clang_major__ >= 7 && \
+__FreeBSD_cc_version < 132
atf_tc_expect_fail("test fails with clang 7+ - bug 234040");
 #endif
 

Modified: head/lib/msun/tests/trig_test.c
==
--- head/lib/msun/tests/trig_test.c Fri Feb  8 18:24:53 2019
(r343916)
+++ head/lib/msun/tests/trig_test.c Fri Feb  8 18:31:54 2019
(r343917)
@@ -160,7 +160,8 @@ ATF_TC_BODY(reduction, tc)
 
unsigned i;
 
-#if defined(__amd64__) && defined(__clang__) && __clang_major__ >= 7
+#if defined(__amd64__) && defined(__clang__) && __clang_major__ >= 7 && \
+__FreeBSD_cc_version < 132
atf_tc_expect_fail("test fails with clang 7+ - bug 234040");
 #endif
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343916 - in head: contrib/llvm/lib/Target/X86 lib/clang

2019-02-08 Thread Dimitry Andric
Author: dim
Date: Fri Feb  8 18:24:53 2019
New Revision: 343916
URL: https://svnweb.freebsd.org/changeset/base/343916

Log:
  Pull in r352607 from upstream llvm trunk (by Craig Topper):
  
[X86] Add FPSW as a Def on some FP instructions that were missing it.
  
  Pull in r353141 from upstream llvm trunk (by Craig Topper):
  
[X86] Connect the default fpsr and dirflag clobbers in inline
assembly to the registers we have defined for them.
  
Summary:
We don't currently map these constraints to physical register numbers
so they don't make it to the MachineIR representation of inline
assembly.
  
This could have problems for proper dependency tracking in the
machine schedulers though I don't have a test case that shows that.
  
Reviewers: rnk
  
Reviewed By: rnk
  
Subscribers: eraman, llvm-commits
  
Tags: #llvm
  
Differential Revision: https://reviews.llvm.org/D57641
  
  Pull in r353489 from upstream llvm trunk (by Craig Topper):
  
[X86] Add FPCW as a register and start using it as an implicit use on
floating point instructions.
  
Summary:
FPCW contains the rounding mode control which we manipulate to
implement fp to integer conversion by changing the roudning mode,
storing the value to the stack, and then changing the rounding mode
back. Because we didn't model FPCW and its dependency chain, other
instructions could be scheduled into the middle of the sequence.
  
This patch introduces the register and adds it as an implciit def of
FLDCW and implicit use of the FP binary arithmetic instructions and
store instructions. There are more instructions that need to be
updated, but this is a good start. I believe this fixes at least the
reduced test case from PR40529.
  
Reviewers: RKSimon, spatel, rnk, efriedma, andrew.w.kaylor
  
Subscribers: dim, llvm-commits
  
Tags: #llvm
  
Differential Revision: https://reviews.llvm.org/D57735
  
  These should fix a problem in clang 7.0 where it would sometimes emit
  long double floating point instructions in a slightly wrong order,
  leading to failures in our libm tests.  In particular, the cbrt_test
  test case 'cbrtl_powl' and the trig_test test case 'reduction'.
  
  Also bump __FreeBSD_cc_version, to be able to detect this in our test
  suite.
  
  Reported by:lwhsu
  PR:   234040
  Upstream PR:  https://bugs.llvm.org/show_bug.cgi?id=40206
  MFC after:1 week

Modified:
  head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp
  head/contrib/llvm/lib/Target/X86/X86InstrFPStack.td
  head/contrib/llvm/lib/Target/X86/X86RegisterInfo.cpp
  head/contrib/llvm/lib/Target/X86/X86RegisterInfo.td
  head/lib/clang/freebsd_cc_version.h

Modified: head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp
==
--- head/contrib/llvm/lib/Target/X86/X86ISelLowering.cppFri Feb  8 
17:57:39 2019(r343915)
+++ head/contrib/llvm/lib/Target/X86/X86ISelLowering.cppFri Feb  8 
18:24:53 2019(r343916)
@@ -40619,6 +40619,20 @@ X86TargetLowering::getRegForInlineAsmConstraint(const 
   return Res;
 }
 
+// dirflag -> DF
+if (StringRef("{dirflag}").equals_lower(Constraint)) {
+  Res.first = X86::DF;
+  Res.second = ::DFCCRRegClass;
+  return Res;
+}
+
+// fpsr -> FPSW
+if (StringRef("{fpsr}").equals_lower(Constraint)) {
+  Res.first = X86::FPSW;
+  Res.second = ::FPCCRRegClass;
+  return Res;
+}
+
 // 'A' means [ER]AX + [ER]DX.
 if (Constraint == "A") {
   if (Subtarget.is64Bit()) {

Modified: head/contrib/llvm/lib/Target/X86/X86InstrFPStack.td
==
--- head/contrib/llvm/lib/Target/X86/X86InstrFPStack.td Fri Feb  8 17:57:39 
2019(r343915)
+++ head/contrib/llvm/lib/Target/X86/X86InstrFPStack.td Fri Feb  8 18:24:53 
2019(r343916)
@@ -230,7 +230,7 @@ def _FI32m  : FPI<0xDA, fp, (outs), (ins i32mem:$src),
 } // mayLoad = 1, hasSideEffects = 1
 }
 
-let Defs = [FPSW] in {
+let Defs = [FPSW], Uses = [FPCW] in {
 // FPBinary_rr just defines pseudo-instructions, no need to set a scheduling
 // resources.
 let hasNoSchedulingInfo = 1 in {
@@ -267,7 +267,7 @@ class FPrST0PInst
 // NOTE: GAS and apparently all other AT style assemblers have a broken 
notion
 // of some of the 'reverse' forms of the fsub and fdiv instructions.  As such,
 // we have to put some 'r's in and take them out of weird places.
-let SchedRW = [WriteFAdd] in {
+let SchedRW = [WriteFAdd], Defs = [FPSW], Uses = [FPCW] in {
 def ADD_FST0r   : FPST0rInst ;
 def ADD_FrST0   : FPrST0Inst ;
 def ADD_FPrST0  : FPrST0PInst;
@@ -278,16 +278,16 @@ def SUB_FST0r   : FPST0rInst ;
 def SUBR_FrST0  : FPrST0Inst ;
 def SUBR_FPrST0 : FPrST0PInst;
 } // SchedRW
-let SchedRW = [WriteFCom] in {
+let SchedRW = [WriteFCom], Defs = [FPSW], Uses = [FPCW] in {
 def 

svn commit: r343915 - in head: share/misc usr.bin/calendar/calendars

2019-02-08 Thread Kai Knoblich
Author: kai (ports committer)
Date: Fri Feb  8 17:57:39 2019
New Revision: 343915
URL: https://svnweb.freebsd.org/changeset/base/343915

Log:
  Add myself to committers-ports.dot and calendar.freebsd
  
  Reviewed by:  miwi (mentor)
  Approved by:  miwi (mentor)
  Differential Revision:https://reviews.freebsd.org/D19119

Modified:
  head/share/misc/committers-ports.dot
  head/usr.bin/calendar/calendars/calendar.freebsd

Modified: head/share/misc/committers-ports.dot
==
--- head/share/misc/committers-ports.dotFri Feb  8 16:38:30 2019
(r343914)
+++ head/share/misc/committers-ports.dotFri Feb  8 17:57:39 2019
(r343915)
@@ -150,6 +150,7 @@ jsa [label="Joseph S. Atkinson\n...@freebsd.org\n2010/
 jsm [label="Jesper Schmitz Mouridsen\n...@freebsd.org\n2018/06/30"]
 junovitch [label="Jason Unovitch\njunovi...@freebsd.org\n2015/07/27"]
 jylefort [label="Jean-Yves Lefort\njylef...@freebsd.org\n2005/04/12"]
+kai [label="Kai Knoblich\n...@freebsd.org\n2019/02/01"]
 kami [label="Dominic Fandrey\nk...@freebsd.org\n2014/09/09"]
 kbowling [label="Kevin Bowling\nkbowl...@freebsd.org\n2018/09/02"]
 kevlo [label="Kevin Lo\nke...@freebsd.org\n2003/02/21"]
@@ -476,6 +477,8 @@ jadawin -> wen
 
 joerg -> netchild
 
+joneum -> kai
+
 jrm -> dch
 jrm -> jwb
 
@@ -573,6 +576,7 @@ miwi -> gahr
 miwi -> jhixson
 miwi -> joneum
 miwi -> jsm
+miwi -> kai
 miwi -> kmoore
 miwi -> lme
 miwi -> makc
@@ -714,6 +718,7 @@ tcberner -> yuri
 tcberner -> fernape
 tcberner -> arrowd
 tcberner -> rigoletto
+tcberner -> kai
 
 thierry -> jadawin
 thierry -> riggs

Modified: head/usr.bin/calendar/calendars/calendar.freebsd
==
--- head/usr.bin/calendar/calendars/calendar.freebsdFri Feb  8 16:38:30 
2019(r343914)
+++ head/usr.bin/calendar/calendars/calendar.freebsdFri Feb  8 17:57:39 
2019(r343915)
@@ -170,6 +170,7 @@
 04/29  Adam Weinberger  born in Berkeley, California, 
United States, 1980
 04/29  Eric Anholt  born in Portland, Oregon, United 
States, 1983
 05/01  Randall Stewart  born in Spokane, Washington, United 
States, 1959
+05/02  Kai Knoblich  born in Hannover, Niedersachsen, 
Germany, 1982
 05/02  Danilo G. Baio  born in Maringa, Parana, Brazil, 1986
 05/02  Wojciech A. Koszek  born in Czestochowa, Poland, 
1987
 05/03  Brian Dean  born in Elkins, West Virginia, United 
States, 1966
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343913 - head/sys/kern

2019-02-08 Thread Andrew Turner
Author: andrew
Date: Fri Feb  8 16:18:17 2019
New Revision: 343913
URL: https://svnweb.freebsd.org/changeset/base/343913

Log:
  Fix the spelling of cov_unregister_pc.
  
  When unregistering kcov from the coverage interface we should use the
  unregister function, not the register function.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/kern/kern_kcov.c

Modified: head/sys/kern/kern_kcov.c
==
--- head/sys/kern/kern_kcov.c   Fri Feb  8 16:05:38 2019(r343912)
+++ head/sys/kern/kern_kcov.c   Fri Feb  8 16:18:17 2019(r343913)
@@ -469,8 +469,8 @@ kcov_ioctl(struct cdev *dev, u_long cmd, caddr_t data,
KASSERT(active_count > 0, ("%s: Open count is zero", __func__));
active_count--;
if (active_count == 0) {
-   cov_register_pc(_pc);
-   cov_register_cmp(_cmp);
+   cov_unregister_pc();
+   cov_unregister_cmp();
}
 
td->td_kcov_info = NULL;
@@ -505,8 +505,8 @@ kcov_thread_dtor(void *arg __unused, struct thread *td
KASSERT(active_count > 0, ("%s: Open count is zero", __func__));
active_count--;
if (active_count == 0) {
-   cov_register_pc(_pc);
-   cov_register_cmp(_cmp);
+   cov_unregister_pc();
+   cov_unregister_cmp();
}
td->td_kcov_info = NULL;
if (info->state != KCOV_STATE_DYING) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343912 - head/sys/dev/pms/freebsd/driver/common

2019-02-08 Thread Tycho Nightingale
Author: tychon
Date: Fri Feb  8 16:05:38 2019
New Revision: 343912
URL: https://svnweb.freebsd.org/changeset/base/343912

Log:
  pms(4) should use bus_get_dma_tag() to get parent tag.
  
  Reviewed by:  imp
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/dev/pms/freebsd/driver/common/lxutil.c

Modified: head/sys/dev/pms/freebsd/driver/common/lxutil.c
==
--- head/sys/dev/pms/freebsd/driver/common/lxutil.c Fri Feb  8 14:56:28 
2019(r343911)
+++ head/sys/dev/pms/freebsd/driver/common/lxutil.c Fri Feb  8 16:05:38 
2019(r343912)
@@ -63,7 +63,7 @@ STATIC agBOOLEAN agtiapi_typhAlloc( ag_card_info_t *th
   struct agtiapi_softc *pmsc = thisCardInst->pCard;
   int wait = 0;
 
-  if( bus_dma_tag_create( agNULL,  // parent
+  if( bus_dma_tag_create( bus_get_dma_tag(pmsc->my_dev), // parent
   32,  // alignment
   0,   // boundary
   BUS_SPACE_MAXADDR,   // lowaddr
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r343896 - head/sbin/dhclient

2019-02-08 Thread Konstantin Belousov
On Fri, Feb 08, 2019 at 02:23:01PM +0100, Jilles Tjoelker wrote:
> On Fri, Feb 08, 2019 at 07:36:08AM +, Konstantin Belousov wrote:
> > Author: kib
> > Date: Fri Feb  8 07:36:08 2019
> > New Revision: 343896
> > URL: https://svnweb.freebsd.org/changeset/base/343896
> 
> > Log:
> >   Correctly return exit status from the exited process.
> 
> >   This is also OpenBSD rev. 1.117, as pointed out by
> >   Ryan Moeller .
> 
> >   Submitted by: Nash Kaminski 
> >   MFC after:1 week
> 
> > Modified:
> >   head/sbin/dhclient/dhclient.c
> 
> > Modified: head/sbin/dhclient/dhclient.c
> > ==
> > --- head/sbin/dhclient/dhclient.c   Fri Feb  8 06:19:28 2019
> > (r343895)
> > +++ head/sbin/dhclient/dhclient.c   Fri Feb  8 07:36:08 2019
> > (r343896)
> > @@ -2348,7 +2348,7 @@ priv_script_go(void)
> > if (ip)
> > script_flush_env(ip->client);
> >  
> > -   return (wstatus & 0xff);
> > +   return WEXITSTATUS(wstatus);
> >  }
> >  
> >  void
> 
> This is probably a big improvement in practice, but it is still wrong if
> the script exits on a signal. POSIX does not say what the WEXITSTATUS
> macro returns in this case and in practice 0 is a common value. Perhaps
> you want
> 
> return WIFEXITED(wstatus) ? WEXITSTATUS(wstatus) : 128 + WTERMSIG(wstatus);
> 
> imitating what the shell does to translate a wait status into 8 bits?

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


svn commit: r343911 - head/stand/efi/libefi

2019-02-08 Thread Marcin Wojtas
Author: mw
Date: Fri Feb  8 14:56:28 2019
New Revision: 343911
URL: https://svnweb.freebsd.org/changeset/base/343911

Log:
  Allow reading the UEFI variable size
  
  When loading bigger variables form UEFI it is necessary to know their
  size beforehand, so that an appropriate amount of memory can be
  allocated. The easiest way to do this is to try to read the variable
  with buffer size equal 0, expecting EFI_BUFFER_TOO_SMALL error to be
  returned. Allow such possible approach in efi_getenv routine.
  
  Extracted from a bigger patch as suggested by imp.
  
  Submitted by: Kornel Duleba 
  Obtained from: Semihalf
  Sponsored by: Stormshield

Modified:
  head/stand/efi/libefi/efienv.c

Modified: head/stand/efi/libefi/efienv.c
==
--- head/stand/efi/libefi/efienv.c  Fri Feb  8 14:32:27 2019
(r343910)
+++ head/stand/efi/libefi/efienv.c  Fri Feb  8 14:56:28 2019
(r343911)
@@ -48,7 +48,7 @@ efi_getenv(EFI_GUID *g, const char *v, void *data, siz
return (EFI_OUT_OF_RESOURCES);
dl = *len;
rv = RS->GetVariable(uv, g, , , data);
-   if (rv == EFI_SUCCESS)
+   if (rv == EFI_SUCCESS || rv == EFI_BUFFER_TOO_SMALL)
*len = dl;
free(uv);
return (rv);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343909 - head/usr.bin/newkey

2019-02-08 Thread Andriy Voskoboinyk
Author: avos
Date: Fri Feb  8 14:31:44 2019
New Revision: 343909
URL: https://svnweb.freebsd.org/changeset/base/343909

Log:
  newkey(8): fix 'tmpname' memory leak (always) and input file descriptor leak
  when output file cannot be opened
  
  PR:   201732
  Reported by:  David Binderman 
  MFC after:1 week

Modified:
  head/usr.bin/newkey/update.c

Modified: head/usr.bin/newkey/update.c
==
--- head/usr.bin/newkey/update.cFri Feb  8 14:27:25 2019
(r343908)
+++ head/usr.bin/newkey/update.cFri Feb  8 14:31:44 2019
(r343909)
@@ -266,11 +266,14 @@ localupdate(char *name, char *filename, u_int op, u_in
sprintf(tmpname, "%s.tmp", filename);
rf = fopen(filename, "r");
if (rf == NULL) {
-   return (ERR_READ);
+   err = ERR_READ;
+   goto cleanup;
}
wf = fopen(tmpname, "w");
if (wf == NULL) {
-   return (ERR_WRITE);
+   fclose(rf);
+   err = ERR_WRITE;
+   goto cleanup;
}
err = -1;
while (fgets(line, sizeof (line), rf)) {
@@ -310,13 +313,18 @@ localupdate(char *name, char *filename, u_int op, u_in
fclose(rf);
if (err == 0) {
if (rename(tmpname, filename) < 0) {
-   return (ERR_DBASE);
+   err = ERR_DBASE;
+   goto cleanup;
}
} else {
if (unlink(tmpname) < 0) {
-   return (ERR_DBASE);
+   err = ERR_DBASE;
+   goto cleanup;
}
}
+
+cleanup:
+   free(tmpname);
return (err);
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r343896 - head/sbin/dhclient

2019-02-08 Thread Nash Kaminski
I would be in favor of Jilles' implementation as well, since fundamentally
dhclient just tests for zero/nonzero exit status and therefore what is
critical is making sure such status is nonzero in *any* failure case of
dhclient-script, including abnormal termination via signal.

- Nash

On Fri, Feb 8, 2019, 7:23 AM Jilles Tjoelker  On Fri, Feb 08, 2019 at 07:36:08AM +, Konstantin Belousov wrote:
> > Author: kib
> > Date: Fri Feb  8 07:36:08 2019
> > New Revision: 343896
> > URL: https://svnweb.freebsd.org/changeset/base/343896
>
> > Log:
> >   Correctly return exit status from the exited process.
>
> >   This is also OpenBSD rev. 1.117, as pointed out by
> >   Ryan Moeller .
>
> >   Submitted by:   Nash Kaminski 
> >   MFC after:  1 week
>
> > Modified:
> >   head/sbin/dhclient/dhclient.c
>
> > Modified: head/sbin/dhclient/dhclient.c
> >
> ==
> > --- head/sbin/dhclient/dhclient.c Fri Feb  8 06:19:28 2019
> (r343895)
> > +++ head/sbin/dhclient/dhclient.c Fri Feb  8 07:36:08 2019
> (r343896)
> > @@ -2348,7 +2348,7 @@ priv_script_go(void)
> >   if (ip)
> >   script_flush_env(ip->client);
> >
> > - return (wstatus & 0xff);
> > + return WEXITSTATUS(wstatus);
> >  }
> >
> >  void
>
> This is probably a big improvement in practice, but it is still wrong if
> the script exits on a signal. POSIX does not say what the WEXITSTATUS
> macro returns in this case and in practice 0 is a common value. Perhaps
> you want
>
> return WIFEXITED(wstatus) ? WEXITSTATUS(wstatus) : 128 + WTERMSIG(wstatus);
>
> imitating what the shell does to translate a wait status into 8 bits?
>
> --
> Jilles Tjoelker
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343906 - head/usr.sbin/newsyslog

2019-02-08 Thread David Bright
Author: dab
Date: Fri Feb  8 13:54:16 2019
New Revision: 343906
URL: https://svnweb.freebsd.org/changeset/base/343906

Log:
  Fix several Coverity-detected issues in newsyslog.
  
  - CID 1394815, CID 1305673: Dereference before null check - memory was
allocated and the allocation checked for NULL with a call to errx()
if it failed. Code below that was guaranteed that the pointer was
non-NULL, but there was another check for NULL at the exit of the
function (after the memory had already been referenced). Eliminate
the useless NULL check.
  
  - CID 1007454, CID 1007453: Resource leak - The result of a strdup()
was stored in a global variable and not freed before program exit.
  
  - CID 1007452: Resource leak - Storage intended to be allocated and
returned to the caller was never freed. This was the result of a
regression in the function signature introduced in r208648 (2010)
(thanks for that find, @cem!). Fixed by altering the function
signature and passing the allocated memory to the caller as
intended. This also fixes PR158794.
  
  - CID 1008620: Logically dead code in newsyslog.c - This was a direct
result of CID 1007452. Since the memory allocated as described there
was not returned to the caller, a subsequent check for the memory
having been allocated was dead code. Returning the memory
re-animates the code that is the subject of this CID.
  
  - CID 1006131: Unused value - in parsing a configuration file, a
pointer to the end of the last field was saved, but not used after
that. Rewrite to use the pointer value. This could have been fixed
by avoiding the assignment altogether, but this solutions more
closely follows the pattern used in the preceding code.
  
  PR:   158794
  Reported by:  Coverity, Ken-ichi EZURA  (PR158794)
  Reviewed by:  cem, markj
  MFC after:1 week
  Sponsored by: Dell EMC Isilon

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

Modified: head/usr.sbin/newsyslog/newsyslog.c
==
--- head/usr.sbin/newsyslog/newsyslog.c Fri Feb  8 13:10:45 2019
(r343905)
+++ head/usr.sbin/newsyslog/newsyslog.c Fri Feb  8 13:54:16 2019
(r343906)
@@ -253,7 +253,7 @@ static const char *path_syslogpid = _PATH_SYSLOGPID;
 
 static struct cflist *get_worklist(char **files);
 static void parse_file(FILE *cf, struct cflist *work_p, struct cflist *glob_p,
-   struct conf_entry *defconf_p, struct ilist *inclist);
+   struct conf_entry **defconf, struct ilist *inclist);
 static void add_to_queue(const char *fname, struct ilist *inclist);
 static char *sob(char *p);
 static char *son(char *p);
@@ -374,6 +374,8 @@ main(int argc, char **argv)
 
while (wait(NULL) > 0 || errno == EINTR)
;
+   free(timefnamefmt);
+   free(requestor);
return (0);
 }
 
@@ -841,7 +843,7 @@ get_worklist(char **files)
 
if (verbose)
printf("Processing %s\n", inc->file);
-   parse_file(f, filelist, globlist, defconf, );
+   parse_file(f, filelist, globlist, , );
(void) fclose(f);
}
 
@@ -858,7 +860,6 @@ get_worklist(char **files)
if (defconf != NULL)
free_entry(defconf);
return (filelist);
-   /* NOTREACHED */
}
 
/*
@@ -915,7 +916,7 @@ get_worklist(char **files)
 * for a "glob" entry which does match.
 */
gmatch = 0;
-   if (verbose > 2 && globlist != NULL)
+   if (verbose > 2)
printf("\t+ Checking globs for %s\n", *given);
STAILQ_FOREACH(ent, globlist, cf_nextp) {
fnres = fnmatch(ent->log, *given, FNM_PATHNAME);
@@ -1046,7 +1047,7 @@ expand_globs(struct cflist *work_p, struct cflist *glo
  */
 static void
 parse_file(FILE *cf, struct cflist *work_p, struct cflist *glob_p,
-struct conf_entry *defconf_p, struct ilist *inclist)
+struct conf_entry **defconf_p, struct ilist *inclist)
 {
char line[BUFSIZ], *parse, *q;
char *cp, *errline, *group;
@@ -1137,12 +1138,12 @@ parse_file(FILE *cf, struct cflist *work_p, struct cfl
working = init_entry(q, NULL);
if (strcasecmp(DEFAULT_MARKER, q) == 0) {
special = 1;
-   if (defconf_p != NULL) {
+   if (*defconf_p != NULL) {
warnx("Ignoring duplicate entry for %s!", q);
free_entry(working);
continue;
}
-   defconf_p = working;
+   *defconf_p = working;
}
 
q = parse = missing_field(sob(parse + 1), errline);
@@ -1357,7 +1358,8 @@ no_trimat:
 

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

2019-02-08 Thread David Bright
On Feb 8, 2019, at 7:54 AM, David Bright  wrote:
> 
> Author: dab
> Date: Fri Feb  8 13:54:16 2019
> New Revision: 343906
> URL: https://svnweb.freebsd.org/changeset/base/343906
> 
> Log:
>  Fix several Coverity-detected issues in newsyslog.

Oops:

Differential Revision:  https://reviews.freebsd.org/D19105


-- 
David Bright
d...@freebsd.org


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


Re: svn commit: r343896 - head/sbin/dhclient

2019-02-08 Thread Jilles Tjoelker
On Fri, Feb 08, 2019 at 07:36:08AM +, Konstantin Belousov wrote:
> Author: kib
> Date: Fri Feb  8 07:36:08 2019
> New Revision: 343896
> URL: https://svnweb.freebsd.org/changeset/base/343896

> Log:
>   Correctly return exit status from the exited process.

>   This is also OpenBSD rev. 1.117, as pointed out by
>   Ryan Moeller .

>   Submitted by:   Nash Kaminski 
>   MFC after:  1 week

> Modified:
>   head/sbin/dhclient/dhclient.c

> Modified: head/sbin/dhclient/dhclient.c
> ==
> --- head/sbin/dhclient/dhclient.c Fri Feb  8 06:19:28 2019
> (r343895)
> +++ head/sbin/dhclient/dhclient.c Fri Feb  8 07:36:08 2019
> (r343896)
> @@ -2348,7 +2348,7 @@ priv_script_go(void)
>   if (ip)
>   script_flush_env(ip->client);
>  
> - return (wstatus & 0xff);
> + return WEXITSTATUS(wstatus);
>  }
>  
>  void

This is probably a big improvement in practice, but it is still wrong if
the script exits on a signal. POSIX does not say what the WEXITSTATUS
macro returns in this case and in practice 0 is a common value. Perhaps
you want

return WIFEXITED(wstatus) ? WEXITSTATUS(wstatus) : 128 + WTERMSIG(wstatus);

imitating what the shell does to translate a wait status into 8 bits?

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


svn commit: r343905 - head/usr.sbin/bluetooth/sdpd

2019-02-08 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Feb  8 13:10:45 2019
New Revision: 343905
URL: https://svnweb.freebsd.org/changeset/base/343905

Log:
  Improve Bluetooth device discovery support for Android and Microsoft devices.
  
  Tested using the virtual_bt_speaker(8) tool from the virtual_oss(8)
  project at github.com.
  
  PR:   210089
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/usr.sbin/bluetooth/sdpd/ssar.c

Modified: head/usr.sbin/bluetooth/sdpd/ssar.c
==
--- head/usr.sbin/bluetooth/sdpd/ssar.c Fri Feb  8 11:49:59 2019
(r343904)
+++ head/usr.sbin/bluetooth/sdpd/ssar.c Fri Feb  8 13:10:45 2019
(r343905)
@@ -47,6 +47,131 @@ int32_t server_prepare_attr_list(provider_p const prov
uint8_t *rsp, uint8_t const * const rsp_end);
 
 /*
+ * Scan an attribute for matching UUID.
+ */
+static int
+server_search_uuid_sub(uint8_t *buf, uint8_t const * const eob, const 
uint128_t *uuid)
+{
+int128_t duuid;
+uint32_t value;
+uint8_t type;
+
+while (buf < eob) {
+
+SDP_GET8(type, buf);
+
+switch (type) {
+case SDP_DATA_UUID16:
+if (buf + 2 > eob)
+continue;
+SDP_GET16(value, buf);
+
+memcpy(, _base, sizeof(duuid));
+duuid.b[2] = value >> 8 & 0xff;
+duuid.b[3] = value & 0xff;
+
+if (memcmp(, uuid, sizeof(duuid)) == 0)
+return (0);
+break;
+case SDP_DATA_UUID32:
+if (buf + 4 > eob)
+continue;
+SDP_GET32(value, buf);
+memcpy(, _base, sizeof(duuid));
+duuid.b[0] = value >> 24 & 0xff;
+duuid.b[1] = value >> 16 & 0xff;
+duuid.b[2] = value >> 8 & 0xff;
+duuid.b[3] = value & 0xff;
+
+if (memcmp(, uuid, sizeof(duuid)) == 0)
+return (0);
+break;
+case SDP_DATA_UUID128:
+if (buf + 16 > eob)
+continue;
+SDP_GET_UUID128(, buf);
+
+if (memcmp(, uuid, sizeof(duuid)) == 0)
+return (0);
+break;
+case SDP_DATA_UINT8:
+case SDP_DATA_INT8:
+case SDP_DATA_SEQ8:
+buf++;
+break;
+case SDP_DATA_UINT16:
+case SDP_DATA_INT16:
+case SDP_DATA_SEQ16:
+buf += 2;
+break;
+case SDP_DATA_UINT32:
+case SDP_DATA_INT32:
+case SDP_DATA_SEQ32:
+buf += 4;
+break;
+case SDP_DATA_UINT64:
+case SDP_DATA_INT64:
+buf += 8;
+break;
+case SDP_DATA_UINT128:
+case SDP_DATA_INT128:
+buf += 16;
+break;
+case SDP_DATA_STR8:
+if (buf + 1 > eob)
+continue;
+SDP_GET8(value, buf);
+buf += value;
+break;
+case SDP_DATA_STR16:
+if (buf + 2 > eob)
+continue;
+SDP_GET16(value, buf);
+if (value > (eob - buf))
+return (1);
+buf += value;
+break;
+case SDP_DATA_STR32:
+if (buf + 4 > eob)
+continue;
+SDP_GET32(value, buf);
+if (value > (eob - buf))
+return (1);
+buf += value;
+break;
+case SDP_DATA_BOOL:
+buf += 1;
+break;
+default:
+return (1);
+}
+}
+return (1);
+}
+
+/*
+ * Search a provider for matching UUID in its attributes.
+ */
+static int
+server_search_uuid(provider_p const provider, const uint128_t *uuid)
+{
+uint8_t buffer[256];
+const attr_t *attr;
+int len;
+
+for (attr = provider->profile->attrs; attr->create != NULL; attr++) {
+
+len = attr->create(buffer, buffer + sizeof(buffer),
+

svn commit: r343904 - head/share/misc

2019-02-08 Thread Sergey Kandaurov
Author: pluknet
Date: Fri Feb  8 11:49:59 2019
New Revision: 343904
URL: https://svnweb.freebsd.org/changeset/base/343904

Log:
  Add macOS 10.14.

Modified:
  head/share/misc/bsd-family-tree

Modified: head/share/misc/bsd-family-tree
==
--- head/share/misc/bsd-family-tree Fri Feb  8 10:31:45 2019
(r343903)
+++ head/share/misc/bsd-family-tree Fri Feb  8 11:49:59 2019
(r343904)
@@ -374,8 +374,8 @@ FreeBSD 5.2   |  | |  
  ||   | |  |   |   |
  ||   | |  |   |   DragonFly 5.2.2
  | FreeBSD| |  NetBSD 7.2  |   |
- |   11.2 | |  |   |   |
- || |  |  OpenBSD 6.4  |
+ |   11.2   macOS   |  |   |   |
+ |  10.14   |  |  OpenBSD 6.4  |
  || |  |   |   DragonFly 5.4.0
  *--FreeBSD   | |  v   |   |
  |   12.0 | |  |   DragonFly 5.4.1
@@ -756,6 +756,7 @@ DragonFly 5.2.2 2018-06-18 [DFB]
 FreeBSD 11.2   2018-06-27 [FBD]
 NetBSD 8.0 2018-07-17 [NBD]
 NetBSD 7.2 2018-08-29 [NBD]
+macOS 10.142018-09-24 [APL]
 OpenBSD 6.42018-10-18 [OBD]
 DragonFly 5.4.02018-12-03 [DFB]
 FreeBSD 12.0   2018-12-11 [FBD]
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r325728 - head/lib/libkvm

2019-02-08 Thread Bruce Evans

On Wed, 6 Feb 2019, Will Andrews wrote:


On Tue, Feb 5, 2019 at 10:25 AM Bruce Evans  wrote:


Signed kp_offset seems wrong.  Apart from it not reaching the top of 64-
bit address spaces, adding unsigned kp_len to it gives an unsigned type.


It's appropriate, because in this context, we return page information
including addresses that would be valid pointer references, but are not
included in the core file.  Minidumps omit large numbers of physical pages,
so calls to kvm_walk_pages() will generate large numbers of kvm_page
instances that have an offset of -1.


off_t was already used internally for the return type of _kvm_pt_find().
.offset is initalized to _kvm_pt_find() using especially large style
bugs (most of _kvm_visit_cb() is written in an initalizer).

off_t is very inappropriate for small offsets from C pointers.  ptrdiff_t
would be right for that, except C99 mis-specify by only requiring it to
hold up to +-65535, so on perverse implementations with ptrdiff_t = int17_t,
subtraction of pointers into an object with more than 65535 elements gives
undefined behaviour.  In practice, ptrdiff_t is not perversely implemented
but system code like vm can't use it because it only covers half the address
space.

kvm should uses its own type for this so as to not have to worry about
signedness problems or the bloat of off_t or the unportability of ptrdiff_t.

I rather like APIs which abuse the sign bit for an out of band error
value, but this is not very appropriate.  time_t is such an API, if
it is broken to POSIX spec (not opaque) and is signed (because buggy
code expects that).  But only bad code compares with -1.  The error
value is (time_t)-1, as sometimes needed in implementations where
time_t is unsigned.  Not quite similarly for mmap().  Its error value
is MMAP_FAILED which is (void *)-1 in FreeBSD.  Both of these values
may be in band.  -1 is 1 before the Epoch in a time_t.  POSIX doesn;t
require this to work, but some libraries support it.  C99 and POSIX
are missing the specifications of errno necessary to detect if an
in-band error value is an error for these functions and most others.
off_t is signed, so an uncast -1 works right as an error value for
lseek().  This is not a feature.  -1 is in band for lseek() on devices
on 64-bit arches on FreeBSD (this is a POSIX extension.  IIRC, POSIX
allows anything for devices).

The magic -1's for time_t and mmap() are at least documented.  struct
kvm_page and its member 'offset' and kvm_walk_pages() are undocumented.

I think time_t and mmap() were misdesigned originally but were improved
a little by specifying a cast or a macro.  MMAP_FAILED can't be just
(void *)-1 on systems where the compiler objects to this case.

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


svn commit: r343899 - head/sys/fs/nullfs

2019-02-08 Thread Konstantin Belousov
Author: kib
Date: Fri Feb  8 08:20:18 2019
New Revision: 343899
URL: https://svnweb.freebsd.org/changeset/base/343899

Log:
  Un null_vptocnp(), cache vp->v_mount and use it for null_nodeget() call.
  
  The vp vnode is unlocked during the execution of the VOP method and
  can be reclaimed, zeroing vp->v_data.  Caching allows to use the
  correct mount point.
  
  Reported and tested by:   pho
  PR: 235549
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/fs/nullfs/null_vnops.c

Modified: head/sys/fs/nullfs/null_vnops.c
==
--- head/sys/fs/nullfs/null_vnops.c Fri Feb  8 08:17:31 2019
(r343898)
+++ head/sys/fs/nullfs/null_vnops.c Fri Feb  8 08:20:18 2019
(r343899)
@@ -870,11 +870,14 @@ null_vptocnp(struct vop_vptocnp_args *ap)
struct vnode **dvp = ap->a_vpp;
struct vnode *lvp, *ldvp;
struct ucred *cred = ap->a_cred;
+   struct mount *mp;
int error, locked;
 
locked = VOP_ISLOCKED(vp);
lvp = NULLVPTOLOWERVP(vp);
vhold(lvp);
+   mp = vp->v_mount;
+   vfs_ref(mp);
VOP_UNLOCK(vp, 0); /* vp is held by vn_vptocnp_locked that called us */
ldvp = lvp;
vref(lvp);
@@ -882,6 +885,7 @@ null_vptocnp(struct vop_vptocnp_args *ap)
vdrop(lvp);
if (error != 0) {
vn_lock(vp, locked | LK_RETRY);
+   vfs_rel(mp);
return (ENOENT);
}
 
@@ -893,9 +897,10 @@ null_vptocnp(struct vop_vptocnp_args *ap)
if (error != 0) {
vrele(ldvp);
vn_lock(vp, locked | LK_RETRY);
+   vfs_rel(mp);
return (ENOENT);
}
-   error = null_nodeget(vp->v_mount, ldvp, dvp);
+   error = null_nodeget(mp, ldvp, dvp);
if (error == 0) {
 #ifdef DIAGNOSTIC
NULLVPTOLOWERVP(*dvp);
@@ -903,6 +908,7 @@ null_vptocnp(struct vop_vptocnp_args *ap)
VOP_UNLOCK(*dvp, 0); /* keep reference on *dvp */
}
vn_lock(vp, locked | LK_RETRY);
+   vfs_rel(mp);
return (error);
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343898 - head/sys/fs/nullfs

2019-02-08 Thread Konstantin Belousov
Author: kib
Date: Fri Feb  8 08:17:31 2019
New Revision: 343898
URL: https://svnweb.freebsd.org/changeset/base/343898

Log:
  Before using VTONULL(), check that the covered vnode belongs to nullfs.
  
  Reported and tested by:   pho
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/fs/nullfs/null_vfsops.c

Modified: head/sys/fs/nullfs/null_vfsops.c
==
--- head/sys/fs/nullfs/null_vfsops.cFri Feb  8 08:15:29 2019
(r343897)
+++ head/sys/fs/nullfs/null_vfsops.cFri Feb  8 08:17:31 2019
(r343898)
@@ -145,10 +145,13 @@ nullfs_mount(struct mount *mp)
/*
 * Check multi null mount to avoid `lock against myself' panic.
 */
-   if (lowerrootvp == VTONULL(mp->mnt_vnodecovered)->null_lowervp) {
-   NULLFSDEBUG("nullfs_mount: multi null mount?\n");
-   vput(lowerrootvp);
-   return (EDEADLK);
+   if (mp->mnt_vnodecovered->v_op == _vnodeops) {
+   nn = VTONULL(mp->mnt_vnodecovered);
+   if (nn == NULL || lowerrootvp == nn->null_lowervp) {
+   NULLFSDEBUG("nullfs_mount: multi null mount?\n");
+   vput(lowerrootvp);
+   return (EDEADLK);
+   }
}
 
xmp = (struct null_mount *) malloc(sizeof(struct null_mount),
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343897 - head/sys/fs/nullfs

2019-02-08 Thread Konstantin Belousov
Author: kib
Date: Fri Feb  8 08:15:29 2019
New Revision: 343897
URL: https://svnweb.freebsd.org/changeset/base/343897

Log:
  Some style for nullfs_mount().  Also use bool type for isvnunlocked.
  
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/fs/nullfs/null_vfsops.c

Modified: head/sys/fs/nullfs/null_vfsops.c
==
--- head/sys/fs/nullfs/null_vfsops.cFri Feb  8 07:36:08 2019
(r343896)
+++ head/sys/fs/nullfs/null_vfsops.cFri Feb  8 08:15:29 2019
(r343897)
@@ -74,13 +74,14 @@ static vfs_extattrctl_t nullfs_extattrctl;
 static int
 nullfs_mount(struct mount *mp)
 {
-   int error = 0;
struct vnode *lowerrootvp, *vp;
struct vnode *nullm_rootvp;
struct null_mount *xmp;
+   struct null_node *nn;
+   struct nameidata nd, *ndp;
char *target;
-   int isvnunlocked = 0, len;
-   struct nameidata nd, *ndp = 
+   int error, len;
+   bool isvnunlocked;
 
NULLFSDEBUG("nullfs_mount(mp = %p)\n", (void *)mp);
 
@@ -110,14 +111,18 @@ nullfs_mount(struct mount *mp)
/*
 * Unlock lower node to avoid possible deadlock.
 */
-   if ((mp->mnt_vnodecovered->v_op == _vnodeops) &&
+   if (mp->mnt_vnodecovered->v_op == _vnodeops &&
VOP_ISLOCKED(mp->mnt_vnodecovered) == LK_EXCLUSIVE) {
VOP_UNLOCK(mp->mnt_vnodecovered, 0);
-   isvnunlocked = 1;
+   isvnunlocked = true;
+   } else {
+   isvnunlocked = false;
}
+
/*
 * Find lower node
 */
+   ndp = 
NDINIT(ndp, LOOKUP, FOLLOW|LOCKLEAF, UIO_SYSSPACE, target, curthread);
error = namei(ndp);
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"