svn commit: r340148 - stable/11/sys/dev/e1000

2018-11-04 Thread Matt Macy
Author: mmacy
Date: Mon Nov  5 06:59:41 2018
New Revision: 340148
URL: https://svnweb.freebsd.org/changeset/base/340148

Log:
  e1000: Don't use 9k jumbo clusters
  
  Backported to 11-STABLE from 12-CURRENT.
  Avoids the issue with 9k jumbo cluster fragmentation
  by maxing out at page size jumbo clusters for RX mbufs.
  
  Submitted by: Ryan Moeller
  Reviewed by:  erj@
  Differential Revision:https://reviews.freebsd.org/D16534

Modified:
  stable/11/sys/dev/e1000/if_em.c
  stable/11/sys/dev/e1000/if_igb.c

Modified: stable/11/sys/dev/e1000/if_em.c
==
--- stable/11/sys/dev/e1000/if_em.c Mon Nov  5 01:53:20 2018
(r340147)
+++ stable/11/sys/dev/e1000/if_em.c Mon Nov  5 06:59:41 2018
(r340148)
@@ -1429,10 +1429,15 @@ em_init_locked(struct adapter *adapter)
*/
if (adapter->hw.mac.max_frame_size <= 2048)
adapter->rx_mbuf_sz = MCLBYTES;
+#ifndef CONTIGMALLOC_WORKS
+   else
+   adapter->rx_mbuf_sz = MJUMPAGESIZE;
+#else
else if (adapter->hw.mac.max_frame_size <= 4096)
adapter->rx_mbuf_sz = MJUMPAGESIZE;
else
adapter->rx_mbuf_sz = MJUM9BYTES;
+#endif
 
/* Prepare receive descriptors and buffers */
if (em_setup_receive_structures(adapter)) {

Modified: stable/11/sys/dev/e1000/if_igb.c
==
--- stable/11/sys/dev/e1000/if_igb.cMon Nov  5 01:53:20 2018
(r340147)
+++ stable/11/sys/dev/e1000/if_igb.cMon Nov  5 06:59:41 2018
(r340148)
@@ -1324,10 +1324,15 @@ igb_init_locked(struct adapter *adapter)
*/
if (adapter->max_frame_size <= 2048)
adapter->rx_mbuf_sz = MCLBYTES;
+#ifndef CONTIGMALLOC_WORKS
+   else
+   adapter->rx_mbuf_sz = MJUMPAGESIZE;
+#else
else if (adapter->max_frame_size <= 4096)
adapter->rx_mbuf_sz = MJUMPAGESIZE;
else
adapter->rx_mbuf_sz = MJUM9BYTES;
+#endif
 
/* Prepare receive descriptors and buffers */
if (igb_setup_receive_structures(adapter)) {
___
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: r340147 - head/sys/powerpc/powerpc

2018-11-04 Thread Justin Hibbits
Author: jhibbits
Date: Mon Nov  5 01:53:20 2018
New Revision: 340147
URL: https://svnweb.freebsd.org/changeset/base/340147

Log:
  powerpc/SMP: Don't spam the console with AP bringup messages
  
  Especially on new POWER9 systems, the console can be filled with
  
SMP: AP CPU #XX launched
  
  messages.  This can also slow down the console printing.  Instead, do what
  x86 now does, as of r35, and print it all on one line, unless
  bootverbose is set.

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

Modified: head/sys/powerpc/powerpc/mp_machdep.c
==
--- head/sys/powerpc/powerpc/mp_machdep.c   Mon Nov  5 00:20:58 2018
(r340146)
+++ head/sys/powerpc/powerpc/mp_machdep.c   Mon Nov  5 01:53:20 2018
(r340147)
@@ -100,7 +100,11 @@ machdep_ap_bootstrap(void)
/* Serialize console output and AP count increment */
mtx_lock_spin(_boot_mtx);
ap_awake++;
-   printf("SMP: AP CPU #%d launched\n", PCPU_GET(cpuid));
+   if (bootverbose)
+   printf("SMP: AP CPU #%d launched\n", PCPU_GET(cpuid));
+   else
+   printf("%s%d%s", ap_awake == 2 ? "Launching APs: " : "",
+   PCPU_GET(cpuid), ap_awake == mp_ncpus ? "\n" : " ");
mtx_unlock_spin(_boot_mtx);
 
while(smp_started == 0)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340146 - in head: lib usr.sbin

2018-11-04 Thread Kyle Evans
Author: kevans
Date: Mon Nov  5 00:20:58 2018
New Revision: 340146
URL: https://svnweb.freebsd.org/changeset/base/340146

Log:
  Move pmc* bits behind MK_PMC to fix WITHOUT_PMC build
  
  No objection from:mmacy
  MFC after:3 days

Modified:
  head/lib/Makefile
  head/usr.sbin/Makefile

Modified: head/lib/Makefile
==
--- head/lib/Makefile   Sun Nov  4 23:28:56 2018(r340145)
+++ head/lib/Makefile   Mon Nov  5 00:20:58 2018(r340146)
@@ -70,8 +70,6 @@ SUBDIR=   ${SUBDIR_BOOTSTRAP} \
libpathconv \
libpcap \
libpjdlog \
-   libpmc \
-   libpmcstat \
${_libproc} \
libprocstat \
libregex \
@@ -200,6 +198,7 @@ _libdl= libdl
 .endif
 
 SUBDIR.${MK_OPENSSL}+= libmp
+SUBDIR.${MK_PMC}+= libpmc libpmcstat
 SUBDIR.${MK_RADIUS_SUPPORT}+=  libradius
 SUBDIR.${MK_SENDMAIL}+=libmilter libsm libsmdb libsmutil
 SUBDIR.${MK_TELNET}+=  libtelnet

Modified: head/usr.sbin/Makefile
==
--- head/usr.sbin/Makefile  Sun Nov  4 23:28:56 2018(r340145)
+++ head/usr.sbin/Makefile  Mon Nov  5 00:20:58 2018(r340146)
@@ -59,9 +59,6 @@ SUBDIR=   adduser \
nologin \
pciconf \
periodic \
-   pmcannotate \
-   pmccontrol \
-   pmcstat \
pnfsdscopymr \
pnfsdsfile \
pnfsdskill \
@@ -191,7 +188,7 @@ SUBDIR.${MK_PKGBOOTSTRAP}+= pkg
 .if ${COMPILER_FEATURES:Mc++11}
 SUBDIR.${MK_PMC}+= pmc
 .endif
-SUBDIR.${MK_PMC}+= pmcstudy
+SUBDIR.${MK_PMC}+= pmcannotate pmccontrol pmcstat pmcstudy
 SUBDIR.${MK_PORTSNAP}+=portsnap
 SUBDIR.${MK_PPP}+= ppp
 SUBDIR.${MK_QUOTAS}+=  edquota
___
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: r340145 - in stable/11/sys: arm/at91 arm/cavium/cns11xx arm/nvidia arm/xscale/i8134x arm/xscale/ixp425 arm/xscale/pxa dev/acpica dev/uart mips/adm5120 mips/alchemy mips/atheros mips/bro...

2018-11-04 Thread Matt Macy
Author: mmacy
Date: Sun Nov  4 23:28:56 2018
New Revision: 340145
URL: https://svnweb.freebsd.org/changeset/base/340145

Log:
  Backport of r338074 - generalize uart_bus_probe and add SNPS support to x86
  
  Submitted by: Rajesh Kumar
  Differential Revision:https://reviews.freebsd.org/D17381

Added:
  stable/11/sys/dev/uart/uart_cpu_acpi.h   (contents, props changed)
  stable/11/sys/pc98/include/acpica_machdep.h   (contents, props changed)
Modified:
  stable/11/sys/arm/at91/uart_bus_at91usart.c
  stable/11/sys/arm/cavium/cns11xx/uart_bus_ec.c
  stable/11/sys/arm/nvidia/tegra_uart.c
  stable/11/sys/arm/xscale/i8134x/uart_bus_i81342.c
  stable/11/sys/arm/xscale/ixp425/uart_bus_ixp425.c
  stable/11/sys/arm/xscale/pxa/uart_bus_pxa.c
  stable/11/sys/dev/acpica/acpi.c
  stable/11/sys/dev/uart/uart.h
  stable/11/sys/dev/uart/uart_bus.h
  stable/11/sys/dev/uart/uart_bus_acpi.c
  stable/11/sys/dev/uart/uart_bus_ebus.c
  stable/11/sys/dev/uart/uart_bus_fdt.c
  stable/11/sys/dev/uart/uart_bus_isa.c
  stable/11/sys/dev/uart/uart_bus_pccard.c
  stable/11/sys/dev/uart/uart_bus_pci.c
  stable/11/sys/dev/uart/uart_bus_puc.c
  stable/11/sys/dev/uart/uart_bus_scc.c
  stable/11/sys/dev/uart/uart_core.c
  stable/11/sys/dev/uart/uart_cpu.h
  stable/11/sys/dev/uart/uart_cpu_fdt.c
  stable/11/sys/dev/uart/uart_cpu_fdt.h
  stable/11/sys/dev/uart/uart_dev_ns8250.c
  stable/11/sys/dev/uart/uart_dev_pl011.c
  stable/11/sys/dev/uart/uart_dev_snps.c
  stable/11/sys/mips/adm5120/uart_bus_adm5120.c
  stable/11/sys/mips/alchemy/uart_bus_alchemy.c
  stable/11/sys/mips/atheros/uart_bus_ar71xx.c
  stable/11/sys/mips/atheros/uart_bus_ar933x.c
  stable/11/sys/mips/broadcom/uart_bus_chipc.c
  stable/11/sys/mips/cavium/uart_bus_octeonusart.c
  stable/11/sys/mips/idt/uart_bus_rc32434.c
  stable/11/sys/mips/malta/uart_bus_maltausart.c
  stable/11/sys/mips/rmi/uart_bus_xlr_iodi.c
  stable/11/sys/mips/rt305x/uart_bus_rt305x.c
  stable/11/sys/modules/uart/Makefile
  stable/11/sys/powerpc/psim/uart_iobus.c
  stable/11/sys/sparc64/pci/sbbc.c

Modified: stable/11/sys/arm/at91/uart_bus_at91usart.c
==
--- stable/11/sys/arm/at91/uart_bus_at91usart.c Sun Nov  4 22:13:22 2018
(r340144)
+++ stable/11/sys/arm/at91/uart_bus_at91usart.c Sun Nov  4 23:28:56 2018
(r340145)
@@ -104,7 +104,7 @@ usart_at91_probe(device_t dev)
sc->sc_class = _usart_class;
if (sc->sc_class->uc_rclk == 0)
sc->sc_class->uc_rclk = at91_master_clock;
-   return (uart_bus_probe(dev, 0, 0, 0, device_get_unit(dev)));
+   return (uart_bus_probe(dev, 0, 0, 0, 0, device_get_unit(dev), 0));
 }
 
 

Modified: stable/11/sys/arm/cavium/cns11xx/uart_bus_ec.c
==
--- stable/11/sys/arm/cavium/cns11xx/uart_bus_ec.c  Sun Nov  4 22:13:22 
2018(r340144)
+++ stable/11/sys/arm/cavium/cns11xx/uart_bus_ec.c  Sun Nov  4 23:28:56 
2018(r340145)
@@ -69,7 +69,7 @@ uart_ec_probe(device_t dev)
 
sc = device_get_softc(dev);
sc->sc_class = _ns8250_class;
-   status = uart_bus_probe(dev, EC_UART_REGSHIFT, EC_UART_CLOCK, 0, 0);
+   status = uart_bus_probe(dev, EC_UART_REGSHIFT, 0, EC_UART_CLOCK, 0, 0, 
0);
return (status);
 }
 

Modified: stable/11/sys/arm/nvidia/tegra_uart.c
==
--- stable/11/sys/arm/nvidia/tegra_uart.c   Sun Nov  4 22:13:22 2018
(r340144)
+++ stable/11/sys/arm/nvidia/tegra_uart.c   Sun Nov  4 23:28:56 2018
(r340145)
@@ -217,7 +217,7 @@ tegra_uart_probe(device_t dev)
device_printf(dev, "Cannot enable UART clock: %d\n", rv);
return (ENXIO);
}
-   return (uart_bus_probe(dev, shift, (int)freq, 0, 0));
+   return (uart_bus_probe(dev, shift, 0, (int)freq, 0, 0, 0));
 }
 
 static int
@@ -248,4 +248,4 @@ static driver_t tegra_uart_driver = {
 };
 
 DRIVER_MODULE(tegra_uart, simplebus,  tegra_uart_driver, uart_devclass,
-0, 0);
\ No newline at end of file
+0, 0);

Modified: stable/11/sys/arm/xscale/i8134x/uart_bus_i81342.c
==
--- stable/11/sys/arm/xscale/i8134x/uart_bus_i81342.c   Sun Nov  4 22:13:22 
2018(r340144)
+++ stable/11/sys/arm/xscale/i8134x/uart_bus_i81342.c   Sun Nov  4 23:28:56 
2018(r340145)
@@ -83,7 +83,7 @@ uart_i81342_probe(device_t dev)
0x40 | 0x10);
 bus_release_resource(dev, sc->sc_rtype, sc->sc_rrid, sc->sc_rres);
 
-   err = uart_bus_probe(dev, 2, 4000, 0, device_get_unit(dev));
+   err = uart_bus_probe(dev, 2, 0, 4000, 0, device_get_unit(dev), 0);
sc->sc_rxfifosz = sc->sc_txfifosz = 1;
return (err);
 }

Modified: stable/11/sys/arm/xscale/ixp425/uart_bus_ixp425.c

svn commit: r340144 - in head: lib/libc/locale share/ctypedef tools/tools/locale tools/tools/locale/tools

2018-11-04 Thread Yuri Pankov
Author: yuripv
Date: Sun Nov  4 22:13:22 2018
New Revision: 340144
URL: https://svnweb.freebsd.org/changeset/base/340144

Log:
  Add hybrid C.UTF-8 locale being identical to default C locale except
  that it uses the same ctype maps and functions as other UTF-8 locales.
  
  Reviewed by:  bapt, cem, eadler
  Approved by:  kib (mentor, implicit)
  Differential Revision:https://reviews.freebsd.org/D17833

Added:
  head/share/ctypedef/C.UTF-8.src
 - copied unchanged from r340143, head/share/ctypedef/en_US.UTF-8.src
Deleted:
  head/share/ctypedef/en_US.UTF-8.src
Modified:
  head/lib/libc/locale/collate.c
  head/lib/libc/locale/ldpart.c
  head/share/ctypedef/Makefile
  head/tools/tools/locale/Makefile
  head/tools/tools/locale/tools/cldr2def.pl

Modified: head/lib/libc/locale/collate.c
==
--- head/lib/libc/locale/collate.c  Sun Nov  4 20:26:29 2018
(r340143)
+++ head/lib/libc/locale/collate.c  Sun Nov  4 22:13:22 2018
(r340144)
@@ -84,7 +84,8 @@ destruct_collate(void *t)
 void *
 __collate_load(const char *encoding, __unused locale_t unused)
 {
-   if (strcmp(encoding, "C") == 0 || strcmp(encoding, "POSIX") == 0) {
+   if (strcmp(encoding, "C") == 0 || strcmp(encoding, "POSIX") == 0 ||
+   strncmp(encoding, "C.", 2) == 0) {
return &__xlocale_C_collate;
}
struct xlocale_collate *table = calloc(sizeof(struct xlocale_collate), 
1);
@@ -122,7 +123,8 @@ __collate_load_tables_l(const char *encoding, struct x
table->__collate_load_error = 1;
 
/* 'encoding' must be already checked. */
-   if (strcmp(encoding, "C") == 0 || strcmp(encoding, "POSIX") == 0) {
+   if (strcmp(encoding, "C") == 0 || strcmp(encoding, "POSIX") == 0 ||
+   strncmp(encoding, "C.", 2) == 0) {
return (_LDP_CACHE);
}
 

Modified: head/lib/libc/locale/ldpart.c
==
--- head/lib/libc/locale/ldpart.c   Sun Nov  4 20:26:29 2018
(r340143)
+++ head/lib/libc/locale/ldpart.c   Sun Nov  4 22:13:22 2018
(r340144)
@@ -63,7 +63,8 @@ __part_load_locale(const char *name,
size_t  namesize, bufsize;
 
/* 'name' must be already checked. */
-   if (strcmp(name, "C") == 0 || strcmp(name, "POSIX") == 0) {
+   if (strcmp(name, "C") == 0 || strcmp(name, "POSIX") == 0 ||
+   strncmp(name, "C.", 2) == 0) {
*using_locale = 0;
return (_LDP_CACHE);
}

Copied: head/share/ctypedef/C.UTF-8.src (from r340143, 
head/share/ctypedef/en_US.UTF-8.src)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/ctypedef/C.UTF-8.src Sun Nov  4 22:13:22 2018
(r340144, copy of r340143, head/share/ctypedef/en_US.UTF-8.src)
@@ -0,0 +1,6372 @@
+# Warning: Do not edit. This file is automatically generated from the
+# tools in /usr/src/tools/tools/locale. The data is obtained from the
+# CLDR project, obtained from http://cldr.unicode.org/
+# -
+
+comment_char *
+escape_char /
+
+LC_CTYPE
+
+**
+* 0x - 0x007F Basic Latin
+* 0x0080 - 0x00FF Latin-1 Supplement
+* 0x0100 - 0x017F Latin Extended-A
+* 0x0180 - 0x024F Latin Extended-B
+* 0x0250 - 0x02AF IPA Extensions
+* 0x1D00 - 0x1D7F Phonetic Extensions
+* 0x1D80 - 0x1DBF Phonetic Extensions Supplement
+* 0x1E00 - 0x1EFF Latin Extended Additional
+* 0x2150 - 0x218F Number Forms (partial - Roman Numerals)
+* 0x2C60 - 0x2C7F Latin Extended-C
+* 0xA720 - 0xA7FF Latin Extended-D
+* 0xAB30 - 0xAB6F Latin Extended-E
+* 0xFB00 - 0xFF4F Alphabetic Presentation Forms (partial)
+* 0xFF00 - 0xFFEF Halfwidth and Fullwidth Forms (partial)
+**
+upper  ;...;;/
+   
;...;;/
+   ;...;;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   ;/
+   
;...;;/
+   
;...;;/
+   ;/
+   ;/
+   ;...;;/
+   ;/
+   ;/
+   ;/
+   ;/
+   

Re: svn commit: r339609 - in head/release: amd64 i386 powerpc sparc64

2018-11-04 Thread Oliver Pinter
On 10/22/18, Ed Maste  wrote:
> Author: emaste
> Date: Mon Oct 22 19:39:20 2018
> New Revision: 339609
> URL: https://svnweb.freebsd.org/changeset/base/339609
>
> Log:
>   release: set -e to exit on error in iso image scripts
>
>   Reviewed by:gjb
>   Differential Revision:  https://reviews.freebsd.org/D17651
>
> Modified:
>   head/release/amd64/mkisoimages.sh
>   head/release/i386/mkisoimages.sh
>   head/release/powerpc/mkisoimages.sh
>   head/release/sparc64/mkisoimages.sh
>
> Modified: head/release/amd64/mkisoimages.sh

This commit catches an warning / error in cd generation for amd64,
with this error:

>>> Installing everything completed on Mon Oct 22 18:07:00 UTC 2018
--
1+0 records in
1+0 records out
4096 bytes transferred in 0.000197 secs (20757002 bytes/sec)
200+0 records in
200+0 records out
819200 bytes transferred in 0.020971 secs (39064121 bytes/sec)
newfs_msdos: cannot get number of sectors per track: Operation not supported
newfs_msdos: cannot get number of heads: Operation not supported
newfs_msdos: trim 25 sectors to adjust to a multiple of 63
/dev/md0: 1532 sectors in 1532 FAT12 clusters (512 bytes/cluster)
BytesPerSec=512 SecPerClust=1 ResSectors=1 FATs=2 RootDirEnts=512
Sectors=1575 Media=0xf8 FATsecs=5 SecPerTrack=63 Heads=1 HiddenSecs=0
cp: chown: efi/efi/boot/bootx64.efi: Invalid argument
1+0 records in
1+0 records out

The last working cd generation was before this commit:
https://jenkins.hardenedbsd.org/jenkins/job/HardenedBSD-CURRENT-amd64/1361/console

And after this commit it breaks on the above line:
https://jenkins.hardenedbsd.org/jenkins/job/HardenedBSD-CURRENT-amd64/

in ${SRCTOP}/release/amd64/mkisoimages.sh the -p option can't work
when you copy to a FAT FS, so the easiest fix would be to remove the
-p option from cp's line.
Other problem with a script after the set -e changes, that if
something fails, no one cleans up the created md devices.


> ==
> --- head/release/amd64/mkisoimages.sh Mon Oct 22 18:41:22 2018
> (r339608)
> +++ head/release/amd64/mkisoimages.sh Mon Oct 22 19:39:20 2018
> (r339609)
> @@ -23,6 +23,8 @@
>  # extra-bits-dir, if provided, contains additional files to be merged
>  # into base-bits-dir as part of making the image.
>
> +set -e
> +
>  if [ -z $ETDUMP ]; then
>   ETDUMP=etdump
>  fi
>
> Modified: head/release/i386/mkisoimages.sh
> ==
> --- head/release/i386/mkisoimages.sh  Mon Oct 22 18:41:22 2018
> (r339608)
> +++ head/release/i386/mkisoimages.sh  Mon Oct 22 19:39:20 2018
> (r339609)
> @@ -23,6 +23,8 @@
>  # extra-bits-dir, if provided, contains additional files to be merged
>  # into base-bits-dir as part of making the image.
>
> +set -e
> +
>  if [ "$1" = "-b" ]; then
>   # This is highly x86-centric and will be used directly below.
>   bootable="-o bootimage=i386;$4/boot/cdboot -o no-emul-boot"
>
> Modified: head/release/powerpc/mkisoimages.sh
> ==
> --- head/release/powerpc/mkisoimages.sh   Mon Oct 22 18:41:22 2018
> (r339608)
> +++ head/release/powerpc/mkisoimages.sh   Mon Oct 22 19:39:20 2018
> (r339609)
> @@ -23,6 +23,7 @@
>  # extra-bits-dir, if provided, contains additional files to be merged
>  # into base-bits-dir as part of making the image.
>
> +set -e
>
>  if [ "$1" = "-b" ]; then
>   bootable=1
>
> Modified: head/release/sparc64/mkisoimages.sh
> ==
> --- head/release/sparc64/mkisoimages.sh   Mon Oct 22 18:41:22 2018
> (r339608)
> +++ head/release/sparc64/mkisoimages.sh   Mon Oct 22 19:39:20 2018
> (r339609)
> @@ -22,6 +22,8 @@
>  # resulting ISO image, base-bits-dir contains the image contents and
>  # extra-bits-dir, if provided, contains additional files to be merged
>  # into base-bits-dir as part of making the image.
> +set -e
> +
>  if [ $# -lt 3 ]; then
>   echo "Usage: $0 [-b] image-label image-name base-bits-dir
> [extra-bits-dir]" > /dev/stderr
>   exit 1
> ___
> svn-src-h...@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/svn-src-head
> To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340143 - head/sbin/ping

2018-11-04 Thread Mariusz Zaborski
Author: oshogbo
Date: Sun Nov  4 20:26:29 2018
New Revision: 340143
URL: https://svnweb.freebsd.org/changeset/base/340143

Log:
  ping: simplify use of Casper
  
  There is no need to check if capdns is NULL.
  If we will build the system without casper all cap_gethostaddr will be
  replaced by the standard functions.

Modified:
  head/sbin/ping/ping.c

Modified: head/sbin/ping/ping.c
==
--- head/sbin/ping/ping.c   Sun Nov  4 19:43:59 2018(r340142)
+++ head/sbin/ping/ping.c   Sun Nov  4 20:26:29 2018(r340143)
@@ -566,11 +566,7 @@ main(int argc, char *const *argv)
if (inet_aton(source, _in.sin_addr) != 0) {
shostname = source;
} else {
-   if (capdns != NULL)
-   hp = cap_gethostbyname2(capdns, source,
-   AF_INET);
-   else
-   hp = gethostbyname2(source, AF_INET);
+   hp = cap_gethostbyname2(capdns, source, AF_INET);
if (!hp)
errx(EX_NOHOST, "cannot resolve %s: %s",
source, hstrerror(h_errno));
@@ -598,10 +594,7 @@ main(int argc, char *const *argv)
if (inet_aton(target, >sin_addr) != 0) {
hostname = target;
} else {
-   if (capdns != NULL)
-   hp = cap_gethostbyname2(capdns, target, AF_INET);
-   else
-   hp = gethostbyname2(target, AF_INET);
+   hp = cap_gethostbyname2(capdns, target, AF_INET);
if (!hp)
errx(EX_NOHOST, "cannot resolve %s: %s",
target, hstrerror(h_errno));
@@ -1693,10 +1686,7 @@ pr_addr(struct in_addr ina)
if (options & F_NUMERIC)
return inet_ntoa(ina);
 
-   if (capdns != NULL)
-   hp = cap_gethostbyaddr(capdns, (char *), 4, AF_INET);
-   else
-   hp = gethostbyaddr((char *), 4, AF_INET);
+   hp = cap_gethostbyaddr(capdns, (char *), 4, AF_INET);
 
if (hp == NULL)
return inet_ntoa(ina);
___
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: r340142 - head/lib/libcasper/services/cap_grp

2018-11-04 Thread Mariusz Zaborski
Author: oshogbo
Date: Sun Nov  4 19:43:59 2018
New Revision: 340142
URL: https://svnweb.freebsd.org/changeset/base/340142

Log:
  libcasper: using explicit_bzero in cap_grp service
  
  Please notice that we still don't clean information in nvlist structures.
  
  Submitted by: David CARLIER 
  Differential Revision:https://reviews.freebsd.org/D16777

Modified:
  head/lib/libcasper/services/cap_grp/cap_grp.c

Modified: head/lib/libcasper/services/cap_grp/cap_grp.c
==
--- head/lib/libcasper/services/cap_grp/cap_grp.c   Sun Nov  4 19:38:54 
2018(r340141)
+++ head/lib/libcasper/services/cap_grp/cap_grp.c   Sun Nov  4 19:43:59 
2018(r340142)
@@ -157,7 +157,7 @@ group_unpack(const nvlist_t *nvl, struct group *grp, c
if (!nvlist_exists_string(nvl, "gr_name"))
return (EINVAL);
 
-   memset(grp, 0, sizeof(*grp));
+   explicit_bzero(grp, sizeof(*grp));
 
error = group_unpack_string(nvl, "gr_name", >gr_name, ,
);
___
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: r340141 - in head/lib/libcasper/services/cap_dns: . tests

2018-11-04 Thread Mariusz Zaborski
Author: oshogbo
Date: Sun Nov  4 19:38:54 2018
New Revision: 340141
URL: https://svnweb.freebsd.org/changeset/base/340141

Log:
  libcasper: fix limitations in dns service
  
  The getaddrinfo(3) and gethostbyname(3) are used to return the address for a
  given hostname. The getnameinfo(3) and gethostbyaddr(3) are used to return
  hostname for a given address. Right now in casper, we have two limitations:
  - NAME which allows resolving DNS names.
  - ADDR which allows to do revert DNS lookups.
  
  Before this change the rights was mixed up:
  NAME - getnameinfo(3) and gethostbyname(3)
  ADDR - gethostbyaddr(3) and getaddrinfo(3)
  
  Which no matters on limitation allowed us to resolve DNS names and do DNS
  lookups basically by using a different set of functions.
  
  Now the NAME type allows getaddrinfo(3) and gethostbyname (3)functions,
  and the ADDR names allow to use gethostbyaddr(3) and getnameinfo(3) functions.
  
  Reviewed by:  pjd, bcr
  MFC after:3 weeks
  Discussed with:   hrs
  Differential Revision:https://reviews.freebsd.org/D16930

Modified:
  head/lib/libcasper/services/cap_dns/cap_dns.3
  head/lib/libcasper/services/cap_dns/cap_dns.c
  head/lib/libcasper/services/cap_dns/tests/dns_test.c

Modified: head/lib/libcasper/services/cap_dns/cap_dns.3
==
--- head/lib/libcasper/services/cap_dns/cap_dns.3   Sun Nov  4 19:31:44 
2018(r340140)
+++ head/lib/libcasper/services/cap_dns/cap_dns.3   Sun Nov  4 19:38:54 
2018(r340141)
@@ -134,19 +134,21 @@ or
 .Dv NAME .
 The
 .Dv ADDR
-means that functions
-.Fn cap_gethostbyname ,
-.Fn cap_gethostbyname2
+means that reverse DNS lookups are allowed with
+.Fn cap_getnameinfo
 and
 .Fn cap_gethostbyaddr
-are allowed.
+functions.
 In case when
 .Va type
 is set to
 .Dv NAME
-the
-.Fn cap_getnameinfo
-function is allowed.
+the name resolution is allowed with
+.Fn cap_getaddrinfo ,
+.Fn cap_gethostbyname ,
+and
+.Fn cap_gethostbyname2
+functions.
 .It family ( NV_TYPE_NUMBER )
 The
 .Va family

Modified: head/lib/libcasper/services/cap_dns/cap_dns.c
==
--- head/lib/libcasper/services/cap_dns/cap_dns.c   Sun Nov  4 19:31:44 
2018(r340140)
+++ head/lib/libcasper/services/cap_dns/cap_dns.c   Sun Nov  4 19:38:54 
2018(r340141)
@@ -524,7 +524,7 @@ dns_getnameinfo(const nvlist_t *limits, const nvlist_t
socklen_t salen;
int error, flags;
 
-   if (!dns_allowed_type(limits, "NAME"))
+   if (!dns_allowed_type(limits, "ADDR"))
return (NO_RECOVERY);
 
error = 0;
@@ -617,7 +617,7 @@ dns_getaddrinfo(const nvlist_t *limits, const nvlist_t
unsigned int ii;
int error, family, n;
 
-   if (!dns_allowed_type(limits, "ADDR"))
+   if (!dns_allowed_type(limits, "NAME"))
return (NO_RECOVERY);
 
hostname = dnvlist_get_string(nvlin, "hostname", NULL);

Modified: head/lib/libcasper/services/cap_dns/tests/dns_test.c
==
--- head/lib/libcasper/services/cap_dns/tests/dns_test.cSun Nov  4 
19:31:44 2018(r340140)
+++ head/lib/libcasper/services/cap_dns/tests/dns_test.cSun Nov  4 
19:38:54 2018(r340141)
@@ -393,7 +393,8 @@ main(void)
CHECK(cap_dns_family_limit(capdns, families, 2) == 0);
 
CHECK(runtest(capdns) ==
-   (GETHOSTBYNAME | GETHOSTBYNAME2_AF_INET | GETHOSTBYNAME2_AF_INET6));
+   (GETHOSTBYNAME | GETHOSTBYNAME2_AF_INET | GETHOSTBYNAME2_AF_INET6 |
+   GETADDRINFO_AF_INET | GETADDRINFO_AF_INET6));
 
cap_close(capdns);
 
@@ -419,9 +420,7 @@ main(void)
CHECK(cap_dns_family_limit(capdns, families, 2) == 0);
 
CHECK(runtest(capdns) ==
-   (GETHOSTBYADDR_AF_INET | GETHOSTBYADDR_AF_INET6 |
-   GETADDRINFO_AF_INET | GETADDRINFO_AF_INET6));
-
+   (GETHOSTBYADDR_AF_INET | GETHOSTBYADDR_AF_INET6));
cap_close(capdns);
 
/*
@@ -512,7 +511,8 @@ main(void)
CHECK(cap_dns_family_limit(capdns, families, 1) == -1 &&
errno == ENOTCAPABLE);
 
-   CHECK(runtest(capdns) == (GETHOSTBYNAME | GETHOSTBYNAME2_AF_INET));
+   CHECK(runtest(capdns) ==
+   (GETHOSTBYNAME | GETHOSTBYNAME2_AF_INET | GETADDRINFO_AF_INET));
 
cap_close(capdns);
 
@@ -548,7 +548,8 @@ main(void)
CHECK(cap_dns_family_limit(capdns, families, 1) == -1 &&
errno == ENOTCAPABLE);
 
-   CHECK(runtest(capdns) == GETHOSTBYNAME2_AF_INET6);
+   CHECK(runtest(capdns) ==
+   (GETHOSTBYNAME2_AF_INET6 | GETADDRINFO_AF_INET6));
 
cap_close(capdns);
 
@@ -584,7 +585,7 @@ main(void)
CHECK(cap_dns_family_limit(capdns, families, 1) == -1 &&
errno == ENOTCAPABLE);
 
-   CHECK(runtest(capdns) == (GETHOSTBYADDR_AF_INET | 

svn commit: r340140 - head/lib/libcasper/services/cap_dns

2018-11-04 Thread Mariusz Zaborski
Author: oshogbo
Date: Sun Nov  4 19:31:44 2018
New Revision: 340140
URL: https://svnweb.freebsd.org/changeset/base/340140

Log:
  libcasper: Update example in man page to use cap_getnameinfo function.
  
  Reviewed by:  hrs
  Differential Revision:https://reviews.freebsd.org/D16931

Modified:
  head/lib/libcasper/services/cap_dns/cap_dns.3

Modified: head/lib/libcasper/services/cap_dns/cap_dns.3
==
--- head/lib/libcasper/services/cap_dns/cap_dns.3   Sun Nov  4 19:29:19 
2018(r340139)
+++ head/lib/libcasper/services/cap_dns/cap_dns.3   Sun Nov  4 19:31:44 
2018(r340140)
@@ -160,19 +160,22 @@ capability to create the
 casper service and uses it to resolve an IP address.
 .Bd -literal
 cap_channel_t *capcas, *capdns;
-const char *typelimit = "ADDR";
-int familylimit;
+int familylimit, error;
 const char *ipstr = "127.0.0.1";
-struct in_addr ip;
-struct hostent *hp;
+const char *typelimit = "ADDR";
+char hname[NI_MAXHOST];
+struct addrinfo hints, *res;
 
 /* Open capability to Casper. */
 capcas = cap_init();
 if (capcas == NULL)
err(1, "Unable to contact Casper");
 
+/* Cache NLA for gai_strerror. */
+caph_cache_catpages();
+
 /* Enter capability mode sandbox. */
-if (cap_enter() < 0 && errno != ENOSYS)
+if (caph_enter() < 0)
err(1, "Unable to enter capability mode");
 
 /* Use Casper capability to create capability to the system.dns service. */
@@ -183,28 +186,34 @@ if (capdns == NULL)
 /* Close Casper capability, we don't need it anymore. */
 cap_close(capcas);
 
-/* Limit system.dns to reverse DNS lookups. */
-if (cap_dns_type_limit(capdns, , 1) < 0)
-   err(1, "Unable to limit access to the system.dns service");
-
 /* Limit system.dns to reserve IPv4 addresses */
 familylimit = AF_INET;
 if (cap_dns_family_limit(capdns, , 1) < 0)
err(1, "Unable to limit access to the system.dns service");
 
-/* Convert IP address in C-string to in_addr. */
-if (!inet_aton(ipstr, ))
-   errx(1, "Unable to parse IP address %s.", ipstr);
+/* Convert IP address in C-string to struct sockaddr. */
+memset(, 0, sizeof(hints));
+hints.ai_family = familylimit;
+hints.ai_flags = AI_NUMERICHOST;
+error = cap_getaddrinfo(capdns, ipstr, NULL, , );
+if (error != 0)
+   errx(1, "cap_getaddrinfo(): %s: %s", ipstr, gai_strerror(error));
 
+/* Limit system.dns to reverse DNS lookups. */
+if (cap_dns_type_limit(capdns, , 1) < 0)
+   err(1, "Unable to limit access to the system.dns service");
+
 /* Find hostname for the given IP address. */
-hp = cap_gethostbyaddr(capdns, (const void *), sizeof(ip), AF_INET);
-if (hp == NULL)
-   errx(1, "No name associated with %s.", ipstr);
+error = cap_getnameinfo(capdns, res->ai_addr, res->ai_addrlen, hname, 
sizeof(hname),
+NULL, 0, 0);
+if (error != 0)
+   errx(1, "cap_getnameinfo(): %s: %s", ipstr, gai_strerror(error));
 
-printf("Name associated with %s is %s.\\n", ipstr, hp->h_name);
+printf("Name associated with %s is %s.\\n", ipstr, hname);
 .Ed
 .Sh SEE ALSO
 .Xr cap_enter 2 ,
+.Xr caph_enter 3 ,
 .Xr err 3 ,
 .Xr gethostbyaddr 3 ,
 .Xr gethostbyname 3 ,
___
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: r340139 - head/lib/libcasper/services/cap_dns

2018-11-04 Thread Mariusz Zaborski
Author: oshogbo
Date: Sun Nov  4 19:29:19 2018
New Revision: 340139
URL: https://svnweb.freebsd.org/changeset/base/340139

Log:
  libcasper: Document the cap_getaddrinfo and cap_getnameinfo functions
  
  Reviewed by:  hrs
  Differential Revision:https://reviews.freebsd.org/D16929

Modified:
  head/lib/libcasper/services/cap_dns/Makefile
  head/lib/libcasper/services/cap_dns/cap_dns.3

Modified: head/lib/libcasper/services/cap_dns/Makefile
==
--- head/lib/libcasper/services/cap_dns/MakefileSun Nov  4 19:24:49 
2018(r340138)
+++ head/lib/libcasper/services/cap_dns/MakefileSun Nov  4 19:29:19 
2018(r340139)
@@ -30,6 +30,7 @@ MLINKS+=cap_dns.3 libcap_dns.3
 MLINKS+=cap_dns.3 cap_gethostbyname.3
 MLINKS+=cap_dns.3 cap_gethostbyname2.3
 MLINKS+=cap_dns.3 cap_gethostbyaddr.3
+MLINKS+=cap_dns.3 cap_getaddrinfo.3
 MLINKS+=cap_dns.3 cap_getnameinfo.3
 MLINKS+=cap_dns.3 cap_dns_type_limit.3
 MLINKS+=cap_dns.3 cap_dns_family_limit.3

Modified: head/lib/libcasper/services/cap_dns/cap_dns.3
==
--- head/lib/libcasper/services/cap_dns/cap_dns.3   Sun Nov  4 19:24:49 
2018(r340138)
+++ head/lib/libcasper/services/cap_dns/cap_dns.3   Sun Nov  4 19:29:19 
2018(r340139)
@@ -24,14 +24,15 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 18, 2018
+.Dd November 4, 2018
 .Dt CAP_DNS 3
 .Os
 .Sh NAME
+.Nm cap_getaddrinfo ,
+.Nm cap_getnameinfo ,
 .Nm cap_gethostbyname ,
 .Nm cap_gethostbyname2 ,
 .Nm cap_gethostbyaddr ,
-.Nm cap_getnameinfo ,
 .Nm cap_dns_type_limit ,
 .Nm cap_dns_family_limit
 .Nd "library for getting network host entry in capability mode"
@@ -41,6 +42,10 @@
 .In sys/nv.h
 .In libcasper.h
 .In casper/cap_dns.h
+.Ft int
+.Fn cap_getaddrinfo "cap_channel_t *chan" "const char *hostname" "const char 
*servname" "const struct addrinfo *hints" "struct addrinfo **res"
+.Ft int
+.Fn cap_getnameinfo "cap_channel_t *chan" "const struct sockaddr *sa" 
"socklen_t salen" "char *host" "size_t hostlen" "char *serv" "size_t servlen" 
"int flags"
 .Ft "struct hostent *"
 .Fn cap_gethostbyname "const cap_channel_t *chan" "const char *name"
 .Ft "struct hostent *"
@@ -48,12 +53,23 @@
 .Ft "struct hostent *"
 .Fn cap_gethostbyaddr "const cap_channel_t *chan" "const void *addr" 
"socklen_t len" "int af"
 .Ft "int"
-.Fn cap_getnameinfo "const cap_channel_t *chan" "const void *name" "int 
namelen"
-.Ft "int"
 .Fn cap_dns_type_limit "cap_channel_t *chan" "const char * const *types" 
"size_t ntypes"
 .Ft "int"
 .Fn cap_dns_family_limit "const cap_channel_t *chan" "const int *families" 
"size_t nfamilies"
 .Sh DESCRIPTION
+.Bf -symbolic
+The
+.Fn cap_getaddrinfo ,
+and
+.Fn cap_getnameinfo ,
+functions are preferred over the
+.Fn cap_gethostbyname ,
+.Fn cap_gethostbyname2 ,
+and
+.Fn cap_gethostbyaddr
+functions.
+.Ef
+.Pp
 The functions
 .Fn cap_gethostbyname ,
 .Fn cap_gethostbyname2 ,
___
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: r340138 - in head: bin/dd sbin/dhclient sbin/md5 usr.bin/cmp usr.bin/diff usr.bin/diff3 usr.bin/elfdump usr.bin/indent usr.bin/jot usr.bin/ktrdump usr.bin/lam usr.bin/rwho usr.bin/tee u...

2018-11-04 Thread Mariusz Zaborski
Author: oshogbo
Date: Sun Nov  4 19:24:49 2018
New Revision: 340138
URL: https://svnweb.freebsd.org/changeset/base/340138

Log:
  capsicum: use a new capsicum helpers in tools
  
  Use caph_{rights,ioctls,fcntls}_limit to simplify the code.

Modified:
  head/bin/dd/dd.c
  head/sbin/dhclient/bpf.c
  head/sbin/dhclient/dhclient.c
  head/sbin/md5/md5.c
  head/usr.bin/cmp/cmp.c
  head/usr.bin/diff/diffreg.c
  head/usr.bin/diff3/diff3.c
  head/usr.bin/elfdump/elfdump.c
  head/usr.bin/indent/indent.c
  head/usr.bin/jot/jot.c
  head/usr.bin/ktrdump/ktrdump.c
  head/usr.bin/lam/lam.c
  head/usr.bin/rwho/rwho.c
  head/usr.bin/tee/tee.c
  head/usr.bin/uniq/uniq.c
  head/usr.bin/units/units.c
  head/usr.bin/write/write.c
  head/usr.sbin/rwhod/rwhod.c

Modified: head/bin/dd/dd.c
==
--- head/bin/dd/dd.cSun Nov  4 19:21:12 2018(r340137)
+++ head/bin/dd/dd.cSun Nov  4 19:24:49 2018(r340138)
@@ -157,7 +157,7 @@ setup(void)
getfdtype();
 
cap_rights_init(, CAP_READ, CAP_SEEK);
-   if (cap_rights_limit(in.fd, ) == -1 && errno != ENOSYS)
+   if (caph_rights_limit(in.fd, ) == -1)
err(1, "unable to limit capability rights");
 
if (files_cnt > 1 && !(in.flags & ISTAPE))
@@ -188,10 +188,9 @@ setup(void)
 
getfdtype();
 
-   if (cap_rights_limit(out.fd, ) == -1 && errno != ENOSYS)
+   if (caph_rights_limit(out.fd, ) == -1)
err(1, "unable to limit capability rights");
-   if (cap_ioctls_limit(out.fd, cmds, nitems(cmds)) == -1 &&
-   errno != ENOSYS)
+   if (caph_ioctls_limit(out.fd, cmds, nitems(cmds)) == -1)
err(1, "unable to limit capability rights");
 
if (in.fd != STDIN_FILENO && out.fd != STDIN_FILENO) {

Modified: head/sbin/dhclient/bpf.c
==
--- head/sbin/dhclient/bpf.cSun Nov  4 19:21:12 2018(r340137)
+++ head/sbin/dhclient/bpf.cSun Nov  4 19:24:49 2018(r340138)
@@ -57,6 +57,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+
 #define BPF_FORMAT "/dev/bpf%d"
 
 /*
@@ -164,7 +166,7 @@ if_register_send(struct interface_info *info)
error("Cannot lock bpf");
 
cap_rights_init(, CAP_WRITE);
-   if (cap_rights_limit(info->wfdesc, ) < 0 && errno != ENOSYS)
+   if (caph_rights_limit(info->wfdesc, ) < 0)
error("Can't limit bpf descriptor: %m");
 
/*
@@ -270,9 +272,9 @@ if_register_receive(struct interface_info *info)
error("Cannot lock bpf");
 
cap_rights_init(, CAP_IOCTL, CAP_EVENT, CAP_READ);
-   if (cap_rights_limit(info->rfdesc, ) < 0 && errno != ENOSYS)
+   if (caph_rights_limit(info->rfdesc, ) < 0)
error("Can't limit bpf descriptor: %m");
-   if (cap_ioctls_limit(info->rfdesc, cmds, 2) < 0 && errno != ENOSYS)
+   if (caph_ioctls_limit(info->rfdesc, cmds, 2) < 0)
error("Can't limit ioctls for bpf descriptor: %m");
 }
 

Modified: head/sbin/dhclient/dhclient.c
==
--- head/sbin/dhclient/dhclient.c   Sun Nov  4 19:21:12 2018
(r340137)
+++ head/sbin/dhclient/dhclient.c   Sun Nov  4 19:24:49 2018
(r340138)
@@ -512,7 +512,7 @@ main(int argc, char *argv[])
close(pipe_fd[0]);
privfd = pipe_fd[1];
cap_rights_init(, CAP_READ, CAP_WRITE);
-   if (cap_rights_limit(privfd, ) < 0 && errno != ENOSYS)
+   if (caph_rights_limit(privfd, ) < 0)
error("can't limit private descriptor: %m");
 
if ((fd = open(path_dhclient_db, O_RDONLY|O_EXLOCK|O_CREAT, 0)) == -1)
@@ -526,7 +526,7 @@ main(int argc, char *argv[])
if (shutdown(routefd, SHUT_WR) < 0)
error("can't shutdown route socket: %m");
cap_rights_init(, CAP_EVENT, CAP_READ);
-   if (cap_rights_limit(routefd, ) < 0 && errno != ENOSYS)
+   if (caph_rights_limit(routefd, ) < 0)
error("can't limit route socket: %m");
 
endpwent();
@@ -1928,12 +1928,10 @@ rewrite_client_leases(void)
error("can't create %s: %m", path_dhclient_db);
cap_rights_init(, CAP_FCNTL, CAP_FSTAT, CAP_FSYNC,
CAP_FTRUNCATE, CAP_SEEK, CAP_WRITE);
-   if (cap_rights_limit(fileno(leaseFile), ) < 0 &&
-   errno != ENOSYS) {
+   if (caph_rights_limit(fileno(leaseFile), ) < 0) {
error("can't limit lease descriptor: %m");
}
-   if (cap_fcntls_limit(fileno(leaseFile), CAP_FCNTL_GETFL) < 0 &&
-   errno != ENOSYS) {
+   if (caph_fcntls_limit(fileno(leaseFile), CAP_FCNTL_GETFL) < 0) {
error("can't limit lease descriptor fcntls: %m");
}
} else {
@@ 

svn commit: r340137 - head/libexec/rtld-elf

2018-11-04 Thread Ed Maste
Author: emaste
Date: Sun Nov  4 19:21:12 2018
New Revision: 340137
URL: https://svnweb.freebsd.org/changeset/base/340137

Log:
  rtld: move relro enforcement after ifunc processing
  
  Previously the combination of relro (implicit), -z now and ifunc use
  resulted in a segfault when applying ifuncs after relro (test binary
  here just calls amd64_get_fsbase()):
  
  | % env LD_DEBUG=1 libexec/rtld-elf/obj/ld-elf.so.1 a.out
  | ...
  | enforcing main obj relro
  | ...
  | resolving ifuncs
  | reloc_jmpslot: *0x203198 = 0x189368ea4570
  | zsh: bus error (core dumped)  LD_DEBUG=1 obj/ld-elf.so.1 ~/a.out
  
  Reported by:  Shawn Webb
  Reviewed by:  kib
  Sponsored by: The FreeBSD Foundation

Modified:
  head/libexec/rtld-elf/rtld.c

Modified: head/libexec/rtld-elf/rtld.c
==
--- head/libexec/rtld-elf/rtld.cSun Nov  4 19:11:32 2018
(r340136)
+++ head/libexec/rtld-elf/rtld.cSun Nov  4 19:21:12 2018
(r340137)
@@ -700,10 +700,6 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entr
 if (do_copy_relocations(obj_main) == -1)
rtld_die();
 
-dbg("enforcing main obj relro");
-if (obj_enforce_relro(obj_main) == -1)
-   rtld_die();
-
 if (getenv(_LD("DUMP_REL_POST")) != NULL) {
dump_relocations(obj_main);
exit (0);
@@ -737,6 +733,10 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entr
 if (resolve_objects_ifunc(obj_main,
   ld_bind_now != NULL && *ld_bind_now != '\0', SYMLOOK_EARLY,
   NULL) == -1)
+   rtld_die();
+
+dbg("enforcing main obj relro");
+if (obj_enforce_relro(obj_main) == -1)
rtld_die();
 
 if (!obj_main->crt_no_init) {
___
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: r340136 - head/sys/arm/include

2018-11-04 Thread Konstantin Belousov
Author: kib
Date: Sun Nov  4 19:11:32 2018
New Revision: 340136
URL: https://svnweb.freebsd.org/changeset/base/340136

Log:
  Move the fixed base for PIE loading on arm.
  
  Existing base causes conflicts for direct execution of ld-elf.so.1
  because default linking base for non-PIE binaries is 0x1.
  
  Reported and tested by:   Mark Millard 
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/arm/include/elf.h

Modified: head/sys/arm/include/elf.h
==
--- head/sys/arm/include/elf.h  Sun Nov  4 19:10:44 2018(r340135)
+++ head/sys/arm/include/elf.h  Sun Nov  4 19:11:32 2018(r340136)
@@ -84,7 +84,7 @@ __ElfType(Auxinfo);
  */
 #defineMAGIC_TRAMP_NUMBER  0x5c03
 
-#defineET_DYN_LOAD_ADDR0x12000
+#defineET_DYN_LOAD_ADDR0x50
 
 /* Flags passed in AT_HWCAP. */
 #defineHWCAP_SWP   0x0001  /* Unsupported, never 
set.*/
___
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: r340135 - in head: share/man/man4 sys/netgraph

2018-11-04 Thread Eugene Grosbein
Author: eugen
Date: Sun Nov  4 19:10:44 2018
New Revision: 340135
URL: https://svnweb.freebsd.org/changeset/base/340135

Log:
  Make ng_pptpgre(8) netgraph node be able to restore order for packets
  reordered in transit instead of dropping them altogether.
  It uses sequence numbers of PPtPGRE packets.
  
  A set of new sysctl(8) added to control this ability or disable it:
  
  net.graph.pptpgre.reorder_max (1) defines maximum length of node's
  private reorder queue used to keep data waiting for late packets.
  Zero value disables reordering. Default value 1 allows the node to restore
  the order for two packets swapped in transit. Greater values allow the node
  to deliver packets being late after more packets in sequence
  at cost of increased kernel memory usage.
  
  net.graph.pptpgre.reorder_timeout (1) defines time value in miliseconds
  used to wait for late packets. It may be useful to increase this
  if reordering spot is distant.
  
  MFC after:1 month

Modified:
  head/share/man/man4/ng_pptpgre.4
  head/sys/netgraph/ng_pptpgre.c
  head/sys/netgraph/ng_pptpgre.h

Modified: head/share/man/man4/ng_pptpgre.4
==
--- head/share/man/man4/ng_pptpgre.4Sun Nov  4 18:52:59 2018
(r340134)
+++ head/share/man/man4/ng_pptpgre.4Sun Nov  4 19:10:44 2018
(r340135)
@@ -35,7 +35,7 @@
 .\" $FreeBSD$
 .\" $Whistle: ng_pptpgre.8,v 1.2 1999/12/08 00:20:53 archie Exp $
 .\"
-.Dd November 13, 2012
+.Dd November 4, 2018
 .Dt NG_PPTPGRE 4
 .Os
 .Sh NAME
@@ -141,11 +141,33 @@ This command atomically gets and resets the node stati
 This node shuts down upon receipt of a
 .Dv NGM_SHUTDOWN
 control message, or when both hooks have been disconnected.
+.Sh SYSCTL VARIABLES
+A set of
+.Xr sysctl 8
+variables controls ability of this node to deal with some
+amount of packet reorder that sometimes happens in transit.
+Packet reorder results in packet drops (unless the order is restored)
+as PPP protocol can not deliver reordered data.
+These variables are shown below together
+with their default value and meaning:
+.Bl -tag -width indent
+.It Va net.graph.pptpgre.reorder_max: 1
+Defines maximum length of node's private reorder queue
+used to keep data waiting for late packets.
+Zero value disables reordering.
+Default value allows the node to restore the order for two packets swapped
+in transit.
+Greater values allow the node to deliver packets being late after more
+packets in sequence at cost of increased kernel memory usage.
+.It Va net.graph.pptpgre.reorder_timeout: 1
+Defines time value in miliseconds used to wait for late packets.
+.El
 .Sh SEE ALSO
 .Xr netgraph 4 ,
 .Xr ng_ksocket 4 ,
 .Xr ng_ppp 4 ,
-.Xr ngctl 8
+.Xr ngctl 8 ,
+.Xr sysctl 8
 .Rs
 .%A K. Hamzeh
 .%A G. Pall

Modified: head/sys/netgraph/ng_pptpgre.c
==
--- head/sys/netgraph/ng_pptpgre.c  Sun Nov  4 18:52:59 2018
(r340134)
+++ head/sys/netgraph/ng_pptpgre.c  Sun Nov  4 19:10:44 2018
(r340135)
@@ -64,6 +64,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -124,6 +125,8 @@ typedef u_int64_t   pptptime_t;
 #define PPTP_MIN_TIMEOUT   (PPTP_TIME_SCALE / 83)  /* 12 milliseconds */
 #define PPTP_MAX_TIMEOUT   (3 * PPTP_TIME_SCALE)   /* 3 seconds */
 
+#define PPTP_REORDER_TIMEOUT   1
+
 /* When we receive a packet, we wait to see if there's an outgoing packet
we can piggy-back the ACK off of. These parameters determine the mimimum
and maxmimum length of time we're willing to wait in order to do that.
@@ -142,6 +145,34 @@ typedef u_int64_t  pptptime_t;
 #define SESSHASHSIZE   0x0020
 #define SESSHASH(x)(((x) ^ ((x) >> 8)) & (SESSHASHSIZE - 1))
 
+SYSCTL_NODE(_net_graph, OID_AUTO, pptpgre, CTLFLAG_RW, 0, "PPTPGRE");
+
+/*
+ * Reorder queue maximum length. Zero disables reorder.
+ *
+ * The node may keep reorder_max queue entries per session
+ * if reorder is enabled, plus allocate one more for short time.
+ *
+ * Be conservative in memory consumption by default.
+ * Lots of sessions with large queues can overflow M_NETGRAPH zone.
+ */
+static int reorder_max = 1; /* reorder up to two swapped packets in a row */
+SYSCTL_UINT(_net_graph_pptpgre, OID_AUTO, reorder_max, CTLFLAG_RWTUN,
+   _max, 0, "Reorder queue maximum length");
+
+static int reorder_timeout = PPTP_REORDER_TIMEOUT;
+SYSCTL_UINT(_net_graph_pptpgre, OID_AUTO, reorder_timeout, CTLFLAG_RWTUN,
+   _timeout, 0, "Reorder timeout is milliseconds");
+
+/* Packet reorder FIFO queue */
+struct ng_pptpgre_roq {
+   SLIST_ENTRY(ng_pptpgre_roq)  next;  /* next entry of the queue */
+   item_p  item;   /* netgraph item */
+   u_int32_t   seq;/* packet sequence number */
+};
+SLIST_HEAD(ng_pptpgre_roq_head, ng_pptpgre_roq);
+typedef struct ng_pptpgre_roq_head roqh;
+
 

svn commit: r340134 - head/lib/libcapsicum

2018-11-04 Thread Mariusz Zaborski
Author: oshogbo
Date: Sun Nov  4 18:52:59 2018
New Revision: 340134
URL: https://svnweb.freebsd.org/changeset/base/340134

Log:
  Fix a recusive call introduce in the r340130.

Modified:
  head/lib/libcapsicum/capsicum_helpers.h

Modified: head/lib/libcapsicum/capsicum_helpers.h
==
--- head/lib/libcapsicum/capsicum_helpers.h Sun Nov  4 18:24:11 2018
(r340133)
+++ head/lib/libcapsicum/capsicum_helpers.h Sun Nov  4 18:52:59 2018
(r340134)
@@ -160,7 +160,7 @@ static __inline int
 caph_fcntls_limit(int fd, uint32_t fcntlrights)
 {
 
-   if (caph_fcntls_limit(fd, fcntlrights) < 0 && errno != ENOSYS)
+   if (cap_fcntls_limit(fd, fcntlrights) < 0 && errno != ENOSYS)
return (-1);
 
return (0);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r340133 - head/contrib/expat/lib

2018-11-04 Thread Mariusz Zaborski
On Sun, Nov 04, 2018 at 06:24:11PM +, Mariusz Zaborski wrote:
> Author: oshogbo
> Date: Sun Nov  4 18:24:11 2018
> New Revision: 340133
> URL: https://svnweb.freebsd.org/changeset/base/340133
> 
> Log:
>   Un-break build libexpact.
>   
>   The writeRandomBytes_arc4random is not used if the arc4random_buf
>   is available. This caused compiler to throw warnings which are treated as
>   an error in libexpact.
>   
>   Approved by:vangyzen
s/expact/expat/g
Sorry for that.

Thanks,
-- 
Mariusz Zaborski
oshogbo//vx | http://oshogbo.vexillium.org
FreeBSD committer   | https://freebsd.org
Software developer  | http://wheelsystems.com
If it's not broken, let's fix it till it is!!1


signature.asc
Description: PGP signature


svn commit: r340133 - head/contrib/expat/lib

2018-11-04 Thread Mariusz Zaborski
Author: oshogbo
Date: Sun Nov  4 18:24:11 2018
New Revision: 340133
URL: https://svnweb.freebsd.org/changeset/base/340133

Log:
  Un-break build libexpact.
  
  The writeRandomBytes_arc4random is not used if the arc4random_buf
  is available. This caused compiler to throw warnings which are treated as
  an error in libexpact.
  
  Approved by:  vangyzen

Modified:
  head/contrib/expat/lib/xmlparse.c

Modified: head/contrib/expat/lib/xmlparse.c
==
--- head/contrib/expat/lib/xmlparse.c   Sun Nov  4 17:56:16 2018
(r340132)
+++ head/contrib/expat/lib/xmlparse.c   Sun Nov  4 18:24:11 2018
(r340133)
@@ -747,7 +747,7 @@ writeRandomBytes_dev_urandom(void * target, size_t cou
 #endif  /* ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM) */
 
 
-#if defined(HAVE_ARC4RANDOM)
+#if defined(HAVE_ARC4RANDOM) && ! defined(HAVE_ARC4RANDOM_BUF)
 
 static void
 writeRandomBytes_arc4random(void * target, size_t count) {
@@ -765,7 +765,7 @@ writeRandomBytes_arc4random(void * target, size_t coun
   }
 }
 
-#endif  /* defined(HAVE_ARC4RANDOM) */
+#endif  /* defined(HAVE_ARC4RANDOM) && ! defined(HAVE_ARC4RANDOM_BUF) */
 
 
 #ifdef _WIN32
___
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: r340132 - in head: bin/ed share/man/man5 share/mk tools/build/options

2018-11-04 Thread Conrad Meyer
Author: cem
Date: Sun Nov  4 17:56:16 2018
New Revision: 340132
URL: https://svnweb.freebsd.org/changeset/base/340132

Log:
  Drop ed(1) "crypto"
  
  You should not be using DES.  You should not have been using DES for the
  past 30 years.
  
  The ed DES-CBC scheme lacked several desirable properties of a sealed
  document system, even ignoring DES itself.  In particular, it did not
  provide the "integrity" cryptographic property (detection of tampering), and
  it treated ASCII passwords as 64-bit keys (instead of using a KDF like
  scrypt or PBKDF2).
  
  Some general approaches ed(1) users might consider to replace the removed
  DES mode:
  
  1. Full disk encryption with something like AES-XTS.  This is easy to
  conceptualize, design, and implement, and it provides confidentiality for
  data at rest.  Like CBC, it lacks tampering protection.  Examples include
  GELI, LUKS, FileVault2.
  
  2. Encrypted overlay ("stackable") filesystems (EncFS, PEFS?, CryptoFS,
  others).
  
  3. Native encryption at the filesystem layer.  Ext4/F2FS, ZFS, APFS, and
  NTFS all have some flavor of this.
  
  4. Storing your files unencrypted.  It's not like DES was doing you much
  good.
  
  If you have DES-CBC scrambled files produced by ed(1) prior to this change,
  you may decrypt them with:
  
openssl des-cbc -d -iv 0 -K  -in  -out 
  
  Reviewed by:  allanjude, bapt, emaste
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D17829

Deleted:
  head/bin/ed/cbc.c
  head/tools/build/options/WITHOUT_ED_CRYPTO
Modified:
  head/bin/ed/Makefile
  head/bin/ed/POSIX
  head/bin/ed/README
  head/bin/ed/ed.1
  head/bin/ed/ed.h
  head/bin/ed/io.c
  head/bin/ed/main.c
  head/share/man/man5/src.conf.5
  head/share/mk/src.opts.mk

Modified: head/bin/ed/Makefile
==
--- head/bin/ed/MakefileSun Nov  4 17:56:09 2018(r340131)
+++ head/bin/ed/MakefileSun Nov  4 17:56:16 2018(r340132)
@@ -4,13 +4,8 @@
 
 PACKAGE=runtime
 PROG=  ed
-SRCS=  buf.c cbc.c glbl.c io.c main.c re.c sub.c undo.c
+SRCS=  buf.c glbl.c io.c main.c re.c sub.c undo.c
 LINKS= ${BINDIR}/ed ${BINDIR}/red
 MLINKS=ed.1 red.1
-
-.if ${MK_OPENSSL} != "no" && ${MK_ED_CRYPTO} != "no"
-CFLAGS+=-DDES
-LIBADD=crypto
-.endif
 
 .include 

Modified: head/bin/ed/POSIX
==
--- head/bin/ed/POSIX   Sun Nov  4 17:56:09 2018(r340131)
+++ head/bin/ed/POSIX   Sun Nov  4 17:56:16 2018(r340132)
@@ -25,29 +25,20 @@ EXTENSIONS
iv) `z' for scrolling through the buffer, and
v) BSD line addressing syntax (i.e., `^' and `%')  is recognized.
 
-2) If crypt(3) is available, files can be read and written using DES
-   encryption.  The `x' command prompts the user to enter a key used for
-   encrypting/ decrypting subsequent reads and writes.  If only a newline
-   is entered as the key, then encryption is disabled.  Otherwise, a key
-   is read in the same manner as a password entry.  The key remains in
-   effect until encryption is disabled.  For more information on the
-   encryption algorithm, see the bdes(1) man page.  Encryption/decryption
-   should be fully compatible with SunOS des(1).
-
-3) The POSIX interactive global commands `G' and `V' are extended to 
+2) The POSIX interactive global commands `G' and `V' are extended to 
support multiple commands, including `a', `i' and `c'.  The command
format is the same as for the global commands `g' and `v', i.e., one
command per line with each line, except for the last, ending in a
backslash (\).
 
-4) An extension to the POSIX file commands `E', `e', `r', `W' and `w' is
+3) An extension to the POSIX file commands `E', `e', `r', `W' and `w' is
that  arguments are processed for backslash escapes, i.e.,  any
character preceded by a backslash is interpreted literally.  If the
first unescaped character of a  argument is a bang (!), then the
rest of the line is interpreted as a shell command, and no escape
processing is performed by ed.
 
-5) For SunOS ed(1) compatibility, ed runs in restricted mode if invoked
+4) For SunOS ed(1) compatibility, ed runs in restricted mode if invoked
as red.  This limits editing of files in the local directory only and
prohibits shell commands.
 

Modified: head/bin/ed/README
==
--- head/bin/ed/README  Sun Nov  4 17:56:09 2018(r340131)
+++ head/bin/ed/README  Sun Nov  4 17:56:16 2018(r340132)
@@ -9,7 +9,6 @@ compile with little trouble.  Otherwise, the macros SP
 should be redefined to disable interrupts.
 
 The following compiler directives are recognized:
-DES- to add encryption support (requires crypt(3))
 NO_REALLOC_NULL- if realloc(3) does not accept a NULL pointer
 BACKWARDS  - for 

svn commit: r340130 - head/lib/libcapsicum

2018-11-04 Thread Mariusz Zaborski
Author: oshogbo
Date: Sun Nov  4 17:22:58 2018
New Revision: 340130
URL: https://svnweb.freebsd.org/changeset/base/340130

Log:
  libcapsicum: Introduce caph_{rights,ioctls,fcntls}_limit
  
  The idea behind those functions is not to force consumers to remember that 
there
  is a need to check errno on failure. We already have a caph_enter(3) function
  which does the same for cap_enter(2).
  
  MFC after:2 weeks

Modified:
  head/lib/libcapsicum/Makefile
  head/lib/libcapsicum/capsicum_helpers.3
  head/lib/libcapsicum/capsicum_helpers.h

Modified: head/lib/libcapsicum/Makefile
==
--- head/lib/libcapsicum/Makefile   Sun Nov  4 17:12:53 2018
(r340129)
+++ head/lib/libcapsicum/Makefile   Sun Nov  4 17:22:58 2018
(r340130)
@@ -8,6 +8,7 @@ MAN+=   capsicum_helpers.3
 
 MLINKS+=capsicum_helpers.3 caph_enter.3
 MLINKS+=capsicum_helpers.3 caph_enter_casper.3
+MLINKS+=capsicum_helpers.3 caph_rights_limit.3
 MLINKS+=capsicum_helpers.3 caph_limit_stream.3
 MLINKS+=capsicum_helpers.3 caph_limit_stdin.3
 MLINKS+=capsicum_helpers.3 caph_limit_stderr.3

Modified: head/lib/libcapsicum/capsicum_helpers.3
==
--- head/lib/libcapsicum/capsicum_helpers.3 Sun Nov  4 17:12:53 2018
(r340129)
+++ head/lib/libcapsicum/capsicum_helpers.3 Sun Nov  4 17:22:58 2018
(r340130)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 18, 2018
+.Dd November 4, 2018
 .Dt CAPSICUM_HELPERS 3
 .Os
 .Sh NAME
@@ -34,7 +34,12 @@
 .Nm caph_limit_stdout ,
 .Nm caph_limit_stdio ,
 .Nm caph_cache_tzdata ,
-.Nm caph_cache_catpages
+.Nm caph_cache_catpages ,
+.Nm caph_enter ,
+.Nm caph_enter_casper ,
+.Nm caph_rights_limit ,
+.Nm caph_ioctls_limit ,
+.Nm caph_fcntls_limit
 .Nd "set of the capsicum helpers, part of the libcapsicum"
 .Sh LIBRARY
 .Lb libcapsicum
@@ -45,8 +50,12 @@
 .Ft int
 .Fn caph_enter_casper "void"
 .Ft int
-.Fn caph_limit_stream "int fd" "int flags"
+.Fn caph_rights_limit "inf fd" "const cap_righst_t *rights"
 .Ft int
+.Fn caph_ioctls_limit "inf fd" "const unsigned long *cmds" "size_t ncmds"
+.Ft int
+.Fn caph_fcntls_limit "inf fd" "uint32_t fcntlrights"
+.Ft int
 .Fn caph_limit_stdin "void"
 .Ft int
 .Fn caph_limit_stderr "void"
@@ -60,9 +69,17 @@
 .Fn caph_cache_catpages "void"
 .Sh DESCRIPTION
 The
-.Nm caph_enter
-is equivalent to the
-.Xr cap_enter 2
+.Nm caph_enter ,
+.Nm caph_rights_limit ,
+.Nm caph_ioctls_limit
+and
+.Nm caph_fcntls_limit
+are respectively equivalent to
+.Xr cap_enter 2 ,
+.Xr cap_rights_limit 2 ,
+.Xr cap_ioctls_limit 2
+and
+.Xr cap_fcntls_limit 2 ,
 it returns success when the kernel is built without support of the capability
 mode.
 .Pp
@@ -125,4 +142,5 @@ among others.
 .Ed
 .Sh SEE ALSO
 .Xr cap_enter 2 ,
+.Xr cap_rights_limit 2 ,
 .Xr rights 4

Modified: head/lib/libcapsicum/capsicum_helpers.h
==
--- head/lib/libcapsicum/capsicum_helpers.h Sun Nov  4 17:12:53 2018
(r340129)
+++ head/lib/libcapsicum/capsicum_helpers.h Sun Nov  4 17:22:58 2018
(r340130)
@@ -136,6 +136,35 @@ caph_enter(void)
return (0);
 }
 
+static __inline int
+caph_rights_limit(int fd, const cap_rights_t *rights)
+{
+
+   if (cap_rights_limit(fd, rights) < 0 && errno != ENOSYS)
+   return (-1);
+
+   return (0);
+}
+
+static __inline int
+caph_ioctls_limit(int fd, const unsigned long *cmds, size_t ncmds)
+{
+
+   if (cap_ioctls_limit(fd, cmds, ncmds) < 0 && errno != ENOSYS)
+   return (-1);
+
+   return (0);
+}
+
+static __inline int
+caph_fcntls_limit(int fd, uint32_t fcntlrights)
+{
+
+   if (caph_fcntls_limit(fd, fcntlrights) < 0 && errno != ENOSYS)
+   return (-1);
+
+   return (0);
+}
 
 static __inline int
 caph_enter_casper(void)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340129 - head/sys/kern

2018-11-04 Thread Mariusz Zaborski
Author: oshogbo
Date: Sun Nov  4 17:12:53 2018
New Revision: 340129
URL: https://svnweb.freebsd.org/changeset/base/340129

Log:
  capsicum: allow ppoll(2) in capability mode
  
  We already allow to use poll(2). There is no reason to disallow ppoll(2).
  
  PR:   232495
  Submitted by: Stefan Grundmann 
  Reviewed by:  cem, oshogbo
  MFC after:2 weeks

Modified:
  head/sys/kern/capabilities.conf

Modified: head/sys/kern/capabilities.conf
==
--- head/sys/kern/capabilities.conf Sun Nov  4 16:58:55 2018
(r340128)
+++ head/sys/kern/capabilities.conf Sun Nov  4 17:12:53 2018
(r340129)
@@ -486,9 +486,9 @@ pipe2
 
 ##
 ## Allow poll(2), which will be scoped by capability rights.
-## XXXRW: We don't yet do that scoping.
 ##
 poll
+ppoll
 
 ##
 ## Allow I/O-related file descriptors, subject to capability rights.
___
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: r340128 - head/usr.bin/man

2018-11-04 Thread Yuri Pankov
Author: yuripv
Date: Sun Nov  4 16:58:55 2018
New Revision: 340128
URL: https://svnweb.freebsd.org/changeset/base/340128

Log:
  Teach man(1) about C.UTF-8.
  
  While here, use LANG as the proper source to select man pages 
language/encoding,
  falling back to LC_CTYPE.
  
  Reviewed by:  bapt
  Approved by:  kib (mentor, implicit)
  Differential Revision:https://reviews.freebsd.org/D17835

Modified:
  head/usr.bin/man/man.sh

Modified: head/usr.bin/man/man.sh
==
--- head/usr.bin/man/man.sh Sun Nov  4 16:08:59 2018(r340127)
+++ head/usr.bin/man/man.sh Sun Nov  4 16:58:55 2018(r340128)
@@ -662,6 +662,7 @@ man_setup_width() {
 # Setup necessary locale variables.
 man_setup_locale() {
local lang_cc
+   local locstr
 
locpaths='.'
man_charset='US-ASCII'
@@ -670,18 +671,25 @@ man_setup_locale() {
if [ -n "$oflag" ]; then
decho 'Using non-localized manpages'
else
-   # Use the locale tool to give us the proper LC_CTYPE
+   # Use the locale tool to give us proper locale information
eval $( $LOCALE )
 
-   case "$LC_CTYPE" in
+   if [ -n "$LANG" ]; then
+   locstr=$LANG
+   else
+   locstr=$LC_CTYPE
+   fi
+
+   case "$locstr" in
C)  ;;
+   C.UTF-8);;
POSIX)  ;;
[a-z][a-z]_[A-Z][A-Z]\.*)
-   lang_cc="${LC_CTYPE%.*}"
-   man_lang="${LC_CTYPE%_*}"
+   lang_cc="${locstr%.*}"
+   man_lang="${locstr%_*}"
man_country="${lang_cc#*_}"
-   man_charset="${LC_CTYPE#*.}"
-   locpaths="$LC_CTYPE"
+   man_charset="${locstr#*.}"
+   locpaths="$locstr"
locpaths="$locpaths:$man_lang.$man_charset"
if [ "$man_lang" != "en" ]; then
locpaths="$locpaths:en.$man_charset"
___
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: r340127 - in head: contrib/expat contrib/expat/doc contrib/expat/examples contrib/expat/lib contrib/expat/tests contrib/expat/tests/benchmark contrib/expat/xmlwf lib/libexpat

2018-11-04 Thread Eric van Gyzen
Author: vangyzen
Date: Sun Nov  4 16:08:59 2018
New Revision: 340127
URL: https://svnweb.freebsd.org/changeset/base/340127

Log:
  Update expat to 2.2.6
  
  Update contrib/expat by merging from the vendor branch.
  
  Update expat_config.h manually, using
  make -C /usr/ports/textproc/expat2 configure
  as a baseline.
  
  MFC after:1 month
  Relnotes: yes
  Security: yes; see contrib/expat/Changes since 2.2.0
  Sponsored by: Dell EMC Isilon

Added:
  head/contrib/expat/AUTHORS
 - copied unchanged from r340088, vendor/expat/dist/AUTHORS
  head/contrib/expat/Makefile.am
 - copied unchanged from r340088, vendor/expat/dist/Makefile.am
  head/contrib/expat/README.md
 - copied unchanged from r340088, vendor/expat/dist/README.md
  head/contrib/expat/doc/Makefile.am
 - copied unchanged from r340088, vendor/expat/dist/doc/Makefile.am
  head/contrib/expat/doc/Makefile.in
 - copied unchanged from r340088, vendor/expat/dist/doc/Makefile.in
  head/contrib/expat/examples/Makefile.am
 - copied unchanged from r340088, vendor/expat/dist/examples/Makefile.am
  head/contrib/expat/examples/Makefile.in
 - copied unchanged from r340088, vendor/expat/dist/examples/Makefile.in
  head/contrib/expat/lib/Makefile.am
 - copied unchanged from r340088, vendor/expat/dist/lib/Makefile.am
  head/contrib/expat/lib/Makefile.in
 - copied unchanged from r340088, vendor/expat/dist/lib/Makefile.in
  head/contrib/expat/lib/loadlibrary.c
 - copied unchanged from r340088, vendor/expat/dist/lib/loadlibrary.c
  head/contrib/expat/lib/siphash.h
 - copied unchanged from r340088, vendor/expat/dist/lib/siphash.h
  head/contrib/expat/run.sh.in
 - copied unchanged from r340088, vendor/expat/dist/run.sh.in
  head/contrib/expat/test-driver-wrapper.sh
 - copied unchanged from r340088, vendor/expat/dist/test-driver-wrapper.sh
  head/contrib/expat/tests/Makefile.am
 - copied unchanged from r340088, vendor/expat/dist/tests/Makefile.am
  head/contrib/expat/tests/Makefile.in
 - copied unchanged from r340088, vendor/expat/dist/tests/Makefile.in
  head/contrib/expat/tests/benchmark/Makefile.am
 - copied unchanged from r340088, 
vendor/expat/dist/tests/benchmark/Makefile.am
  head/contrib/expat/tests/benchmark/Makefile.in
 - copied unchanged from r340088, 
vendor/expat/dist/tests/benchmark/Makefile.in
  head/contrib/expat/tests/benchmark/benchmark.sln
 - copied unchanged from r340088, 
vendor/expat/dist/tests/benchmark/benchmark.sln
  head/contrib/expat/tests/memcheck.c
 - copied unchanged from r340088, vendor/expat/dist/tests/memcheck.c
  head/contrib/expat/tests/memcheck.h
 - copied unchanged from r340088, vendor/expat/dist/tests/memcheck.h
  head/contrib/expat/tests/runtests.sln
 - copied unchanged from r340088, vendor/expat/dist/tests/runtests.sln
  head/contrib/expat/tests/structdata.c
 - copied unchanged from r340088, vendor/expat/dist/tests/structdata.c
  head/contrib/expat/tests/structdata.h
 - copied unchanged from r340088, vendor/expat/dist/tests/structdata.h
  head/contrib/expat/tests/udiffer.py
 - copied unchanged from r340088, vendor/expat/dist/tests/udiffer.py
  head/contrib/expat/tests/xmltest.log.expected
 - copied unchanged from r340088, 
vendor/expat/dist/tests/xmltest.log.expected
  head/contrib/expat/xmlwf/Makefile.am
 - copied unchanged from r340088, vendor/expat/dist/xmlwf/Makefile.am
  head/contrib/expat/xmlwf/Makefile.in
 - copied unchanged from r340088, vendor/expat/dist/xmlwf/Makefile.in
Deleted:
  head/contrib/expat/MANIFEST
  head/contrib/expat/README
Modified:
  head/contrib/expat/COPYING   (contents, props changed)
  head/contrib/expat/Changes   (contents, props changed)
  head/contrib/expat/FREEBSD-Xlist   (contents, props changed)
  head/contrib/expat/Makefile.in   (contents, props changed)
  head/contrib/expat/configure.ac   (contents, props changed)
  head/contrib/expat/doc/reference.html   (contents, props changed)
  head/contrib/expat/doc/xmlwf.1   (contents, props changed)
  head/contrib/expat/doc/xmlwf.xml   (contents, props changed)
  head/contrib/expat/examples/elements.c   (contents, props changed)
  head/contrib/expat/examples/outline.c   (contents, props changed)
  head/contrib/expat/expat_config.h.in   (contents, props changed)
  head/contrib/expat/lib/ascii.h   (contents, props changed)
  head/contrib/expat/lib/asciitab.h   (contents, props changed)
  head/contrib/expat/lib/expat.h   (contents, props changed)
  head/contrib/expat/lib/expat_external.h   (contents, props changed)
  head/contrib/expat/lib/iasciitab.h   (contents, props changed)
  head/contrib/expat/lib/internal.h   (contents, props changed)
  head/contrib/expat/lib/latin1tab.h   (contents, props changed)
  head/contrib/expat/lib/nametab.h   (contents, props changed)
  head/contrib/expat/lib/utf8tab.h   (contents, props changed)
  head/contrib/expat/lib/xmlparse.c   (contents, props changed)
  head/contrib/expat/lib/xmlrole.c   

svn commit: r340122 - in vendor/lld/dist-release_70: COFF ELF test/COFF test/ELF test/ELF/linkerscript

2018-11-04 Thread Dimitry Andric
Author: dim
Date: Sun Nov  4 14:42:21 2018
New Revision: 340122
URL: https://svnweb.freebsd.org/changeset/base/340122

Log:
  Vendor import of lld release_70 branch r346007:
  https://llvm.org/svn/llvm-project/lld/branches/release_70@346007

Added:
  vendor/lld/dist-release_70/test/COFF/arm64-localimport-align.s   (contents, 
props changed)
  vendor/lld/dist-release_70/test/ELF/linkerscript/memory-include.test
  vendor/lld/dist-release_70/test/ELF/linkerscript/output-section-include.test
  vendor/lld/dist-release_70/test/ELF/linkerscript/section-include.test
  vendor/lld/dist-release_70/test/ELF/local-ver-preemptible.s   (contents, 
props changed)
  vendor/lld/dist-release_70/test/ELF/relocatable-rel-iplt.s   (contents, props 
changed)
Modified:
  vendor/lld/dist-release_70/COFF/Chunks.h
  vendor/lld/dist-release_70/ELF/ScriptParser.cpp
  vendor/lld/dist-release_70/ELF/Symbols.cpp
  vendor/lld/dist-release_70/ELF/Writer.cpp

Modified: vendor/lld/dist-release_70/COFF/Chunks.h
==
--- vendor/lld/dist-release_70/COFF/Chunks.hSun Nov  4 14:42:17 2018
(r340121)
+++ vendor/lld/dist-release_70/COFF/Chunks.hSun Nov  4 14:42:21 2018
(r340122)
@@ -345,7 +345,9 @@ class ImportThunkChunkARM64 : public Chunk { (private)
 // See comments for DefinedLocalImport class.
 class LocalImportChunk : public Chunk {
 public:
-  explicit LocalImportChunk(Defined *S) : Sym(S) {}
+  explicit LocalImportChunk(Defined *S) : Sym(S) {
+Alignment = Config->is64() ? 8 : 4;
+  }
   size_t getSize() const override;
   void getBaserels(std::vector *Res) override;
   void writeTo(uint8_t *Buf) const override;

Modified: vendor/lld/dist-release_70/ELF/ScriptParser.cpp
==
--- vendor/lld/dist-release_70/ELF/ScriptParser.cpp Sun Nov  4 14:42:17 
2018(r340121)
+++ vendor/lld/dist-release_70/ELF/ScriptParser.cpp Sun Nov  4 14:42:21 
2018(r340122)
@@ -497,6 +497,9 @@ void ScriptParser::readSections() {
   for (BaseCommand *Cmd : readOverlay())
 V.push_back(Cmd);
   continue;
+} else if (Tok == "INCLUDE") {
+  readInclude();
+  continue;
 }
 
 if (BaseCommand *Cmd = readAssignment(Tok))
@@ -778,6 +781,8 @@ OutputSection *ScriptParser::readOutputSectionDescript
   Cmd->Filler = readFill();
 } else if (Tok == "SORT") {
   readSort();
+} else if (Tok == "INCLUDE") {
+  readInclude();
 } else if (peek() == "(") {
   Cmd->SectionCommands.push_back(readInputSectionDescription(Tok));
 } else {
@@ -1404,7 +1409,11 @@ uint64_t ScriptParser::readMemoryAssignment(StringRef 
 void ScriptParser::readMemory() {
   expect("{");
   while (!errorCount() && !consume("}")) {
-StringRef Name = next();
+StringRef Tok = next();
+if (Tok == "INCLUDE") {
+  readInclude();
+  continue;
+}
 
 uint32_t Flags = 0;
 uint32_t NegFlags = 0;
@@ -1419,10 +1428,9 @@ void ScriptParser::readMemory() {
 uint64_t Length = readMemoryAssignment("LENGTH", "len", "l");
 
 // Add the memory region to the region map.
-MemoryRegion *MR =
-make(Name, Origin, Length, Flags, NegFlags);
-if (!Script->MemoryRegions.insert({Name, MR}).second)
-  setError("region '" + Name + "' already defined");
+MemoryRegion *MR = make(Tok, Origin, Length, Flags, 
NegFlags);
+if (!Script->MemoryRegions.insert({Tok, MR}).second)
+  setError("region '" + Tok + "' already defined");
   }
 }
 

Modified: vendor/lld/dist-release_70/ELF/Symbols.cpp
==
--- vendor/lld/dist-release_70/ELF/Symbols.cpp  Sun Nov  4 14:42:17 2018
(r340121)
+++ vendor/lld/dist-release_70/ELF/Symbols.cpp  Sun Nov  4 14:42:21 2018
(r340122)
@@ -209,7 +209,7 @@ uint8_t Symbol::computeBinding() const {
 return Binding;
   if (Visibility != STV_DEFAULT && Visibility != STV_PROTECTED)
 return STB_LOCAL;
-  if (VersionId == VER_NDX_LOCAL && isDefined())
+  if (VersionId == VER_NDX_LOCAL && isDefined() && !IsPreemptible)
 return STB_LOCAL;
   if (!Config->GnuUnique && Binding == STB_GNU_UNIQUE)
 return STB_GLOBAL;

Modified: vendor/lld/dist-release_70/ELF/Writer.cpp
==
--- vendor/lld/dist-release_70/ELF/Writer.cpp   Sun Nov  4 14:42:17 2018
(r340121)
+++ vendor/lld/dist-release_70/ELF/Writer.cpp   Sun Nov  4 14:42:21 2018
(r340122)
@@ -874,7 +874,7 @@ void PhdrEntry::add(OutputSection *Sec) {
 // need these symbols, since IRELATIVE relocs are resolved through GOT
 // and PLT. For details, see http://www.airs.com/blog/archives/403.
 template  void Writer::addRelIpltSymbols() {
-  if (needsInterpSection())
+  if (Config->Relocatable || needsInterpSection())
 return;
   StringRef S = Config->IsRela ? 

svn commit: r340121 - vendor/libc++/libc++-release_70-r346007

2018-11-04 Thread Dimitry Andric
Author: dim
Date: Sun Nov  4 14:42:17 2018
New Revision: 340121
URL: https://svnweb.freebsd.org/changeset/base/340121

Log:
  Tag libc++ release_70 branch r346007.

Added:
  vendor/libc++/libc++-release_70-r346007/
 - copied from r340120, vendor/libc++/dist-release_70/
___
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: r340124 - vendor/lldb/lldb-release_70-r346007

2018-11-04 Thread Dimitry Andric
Author: dim
Date: Sun Nov  4 14:42:30 2018
New Revision: 340124
URL: https://svnweb.freebsd.org/changeset/base/340124

Log:
  Tag lldb release_70 branch r346007.

Added:
  vendor/lldb/lldb-release_70-r346007/
 - copied from r340123, vendor/lldb/dist-release_70/
___
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: r340123 - vendor/lld/lld-release_70-r346007

2018-11-04 Thread Dimitry Andric
Author: dim
Date: Sun Nov  4 14:42:25 2018
New Revision: 340123
URL: https://svnweb.freebsd.org/changeset/base/340123

Log:
  Tag lld release_70 branch r346007.

Added:
  vendor/lld/lld-release_70-r346007/
 - copied from r340122, vendor/lld/dist-release_70/
___
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: r340120 - vendor/compiler-rt/compiler-rt-release_70-r346007

2018-11-04 Thread Dimitry Andric
Author: dim
Date: Sun Nov  4 14:42:13 2018
New Revision: 340120
URL: https://svnweb.freebsd.org/changeset/base/340120

Log:
  Tag compiler-rt release_70 branch r346007.

Added:
  vendor/compiler-rt/compiler-rt-release_70-r346007/
 - copied from r340119, vendor/compiler-rt/dist-release_70/
___
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: r340118 - in vendor/clang/dist-release_70: bindings/python/tests/cindex include/clang/AST include/clang/Driver include/clang/Sema lib/Basic lib/CodeGen lib/Driver lib/Driver/ToolChains ...

2018-11-04 Thread Dimitry Andric
Author: dim
Date: Sun Nov  4 14:42:02 2018
New Revision: 340118
URL: https://svnweb.freebsd.org/changeset/base/340118

Log:
  Vendor import of clang release_70 branch r346007:
  https://llvm.org/svn/llvm-project/cfe/branches/release_70@346007

Added:
  vendor/clang/dist-release_70/test/PCH/Inputs/pch-through-use3c.cpp   
(contents, props changed)
  vendor/clang/dist-release_70/test/PCH/Inputs/pch-through3c.h   (contents, 
props changed)
  vendor/clang/dist-release_70/test/PCH/pch-through3c.cpp   (contents, props 
changed)
Modified:
  
vendor/clang/dist-release_70/bindings/python/tests/cindex/test_code_completion.py
  vendor/clang/dist-release_70/include/clang/AST/Decl.h
  vendor/clang/dist-release_70/include/clang/Driver/Options.td
  vendor/clang/dist-release_70/include/clang/Sema/Sema.h
  vendor/clang/dist-release_70/lib/Basic/Version.cpp
  vendor/clang/dist-release_70/lib/CodeGen/CGBuiltin.cpp
  vendor/clang/dist-release_70/lib/Driver/Driver.cpp
  vendor/clang/dist-release_70/lib/Driver/ToolChains/Gnu.cpp
  vendor/clang/dist-release_70/lib/Sema/SemaDecl.cpp
  vendor/clang/dist-release_70/lib/Sema/SemaOverload.cpp
  vendor/clang/dist-release_70/lib/Sema/SemaTemplate.cpp
  vendor/clang/dist-release_70/test/CodeGen/attr-target-mv.c
  vendor/clang/dist-release_70/test/CodeGen/builtin-cpu-supports.c
  vendor/clang/dist-release_70/test/Driver/cl-options.c
  vendor/clang/dist-release_70/test/Driver/cl-pch.cpp
  vendor/clang/dist-release_70/test/Driver/linux-ld.c
  vendor/clang/dist-release_70/test/SemaCXX/cxx1y-deduced-return-type.cpp
  vendor/clang/dist-release_70/test/SemaCXX/friend.cpp

Modified: 
vendor/clang/dist-release_70/bindings/python/tests/cindex/test_code_completion.py
==
--- 
vendor/clang/dist-release_70/bindings/python/tests/cindex/test_code_completion.py
   Sun Nov  4 14:41:54 2018(r340117)
+++ 
vendor/clang/dist-release_70/bindings/python/tests/cindex/test_code_completion.py
   Sun Nov  4 14:42:02 2018(r340118)
@@ -61,11 +61,11 @@ void f(P x, Q y) {
 cr = tu.codeComplete('fake.cpp', 12, 5, unsaved_files=files)
 
 expected = [
-  "{'const', TypedText} || Priority: 40 || Availability: Available || 
Brief comment: None",
-  "{'volatile', TypedText} || Priority: 40 || Availability: Available 
|| Brief comment: None",
+  "{'const', TypedText} || Priority: 50 || Availability: Available || 
Brief comment: None",
+  "{'volatile', TypedText} || Priority: 50 || Availability: Available 
|| Brief comment: None",
   "{'operator', TypedText} || Priority: 40 || Availability: Available 
|| Brief comment: None",
-  "{'P', TypedText} | {'::', Text} || Priority: 75 || Availability: 
Available || Brief comment: None",
-  "{'Q', TypedText} | {'::', Text} || Priority: 75 || Availability: 
Available || Brief comment: None"
+  "{'P', TypedText} || Priority: 50 || Availability: Available || 
Brief comment: None",
+  "{'Q', TypedText} || Priority: 50 || Availability: Available || 
Brief comment: None"
 ]
 self.check_completion_results(cr, expected)
 

Modified: vendor/clang/dist-release_70/include/clang/AST/Decl.h
==
--- vendor/clang/dist-release_70/include/clang/AST/Decl.h   Sun Nov  4 
14:41:54 2018(r340117)
+++ vendor/clang/dist-release_70/include/clang/AST/Decl.h   Sun Nov  4 
14:42:02 2018(r340118)
@@ -2269,8 +2269,7 @@ class FunctionDecl : public DeclaratorDecl, public Dec
   unsigned getMinRequiredArguments() const;
 
   QualType getReturnType() const {
-assert(getType()->getAs() && "Expected a FunctionType!");
-return getType()->getAs()->getReturnType();
+return getType()->castAs()->getReturnType();
   }
 
   /// Attempt to compute an informative source range covering the
@@ -2278,14 +2277,22 @@ class FunctionDecl : public DeclaratorDecl, public Dec
   /// limited representation in the AST.
   SourceRange getReturnTypeSourceRange() const;
 
+  /// Get the declared return type, which may differ from the actual return
+  /// type if the return type is deduced.
+  QualType getDeclaredReturnType() const {
+auto *TSI = getTypeSourceInfo();
+QualType T = TSI ? TSI->getType() : getType();
+return T->castAs()->getReturnType();
+  }
+
   /// Attempt to compute an informative source range covering the
   /// function exception specification, if any.
   SourceRange getExceptionSpecSourceRange() const;
 
   /// Determine the type of an expression that calls this function.
   QualType getCallResultType() const {
-assert(getType()->getAs() && "Expected a FunctionType!");
-return 
getType()->getAs()->getCallResultType(getASTContext());
+return getType()->castAs()->getCallResultType(
+getASTContext());
   }
 
   /// Returns the WarnUnusedResultAttr that is either declared on this

Modified: 

svn commit: r340119 - vendor/clang/clang-release_70-r346007

2018-11-04 Thread Dimitry Andric
Author: dim
Date: Sun Nov  4 14:42:09 2018
New Revision: 340119
URL: https://svnweb.freebsd.org/changeset/base/340119

Log:
  Tag clang release_70 branch r346007.

Added:
  vendor/clang/clang-release_70-r346007/
 - copied from r340118, vendor/clang/dist-release_70/
___
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: r340117 - vendor/llvm/llvm-release_70-r346007

2018-11-04 Thread Dimitry Andric
Author: dim
Date: Sun Nov  4 14:41:54 2018
New Revision: 340117
URL: https://svnweb.freebsd.org/changeset/base/340117

Log:
  Tag llvm release_70 branch r346007.

Added:
  vendor/llvm/llvm-release_70-r346007/
 - copied from r340116, vendor/llvm/dist-release_70/
___
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: r340116 - in vendor/llvm/dist-release_70: . include/llvm/Transforms/Utils lib/Analysis lib/CodeGen/AsmPrinter lib/Target/X86 lib/Transforms/IPO lib/Transforms/Scalar lib/Transforms/Util...

2018-11-04 Thread Dimitry Andric
Author: dim
Date: Sun Nov  4 14:41:47 2018
New Revision: 340116
URL: https://svnweb.freebsd.org/changeset/base/340116

Log:
  Vendor import of llvm release_70 branch r346007:
  https://llvm.org/svn/llvm-project/llvm/branches/release_70@346007

Added:
  vendor/llvm/dist-release_70/test/CodeGen/X86/pr38803.ll
  
vendor/llvm/dist-release_70/test/ThinLTO/X86/Inputs/globals-import-blockaddr.ll
  vendor/llvm/dist-release_70/test/ThinLTO/X86/globals-import-blockaddr.ll
  vendor/llvm/dist-release_70/test/Transforms/InstCombine/pr39177.ll
  vendor/llvm/dist-release_70/utils/lit/lit/builtin_commands/__init__.py   
(contents, props changed)
Modified:
  vendor/llvm/dist-release_70/CMakeLists.txt
  vendor/llvm/dist-release_70/include/llvm/Transforms/Utils/BuildLibCalls.h
  vendor/llvm/dist-release_70/lib/Analysis/ModuleSummaryAnalysis.cpp
  vendor/llvm/dist-release_70/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
  vendor/llvm/dist-release_70/lib/Target/X86/X86DomainReassignment.cpp
  vendor/llvm/dist-release_70/lib/Target/X86/X86ISelLowering.cpp
  vendor/llvm/dist-release_70/lib/Target/X86/X86InstrInfo.cpp
  vendor/llvm/dist-release_70/lib/Transforms/IPO/FunctionImport.cpp
  vendor/llvm/dist-release_70/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
  vendor/llvm/dist-release_70/lib/Transforms/Utils/BuildLibCalls.cpp
  vendor/llvm/dist-release_70/test/CodeGen/X86/known-signbits-vector.ll
  vendor/llvm/dist-release_70/tools/llvm-xray/xray-account.cpp
  vendor/llvm/dist-release_70/utils/lit/lit/__init__.py

Modified: vendor/llvm/dist-release_70/CMakeLists.txt
==
--- vendor/llvm/dist-release_70/CMakeLists.txt  Sun Nov  4 14:11:38 2018
(r340115)
+++ vendor/llvm/dist-release_70/CMakeLists.txt  Sun Nov  4 14:41:47 2018
(r340116)
@@ -29,7 +29,7 @@ if(NOT DEFINED LLVM_VERSION_MINOR)
   set(LLVM_VERSION_MINOR 0)
 endif()
 if(NOT DEFINED LLVM_VERSION_PATCH)
-  set(LLVM_VERSION_PATCH 0)
+  set(LLVM_VERSION_PATCH 1)
 endif()
 if(NOT DEFINED LLVM_VERSION_SUFFIX)
   set(LLVM_VERSION_SUFFIX "")

Modified: 
vendor/llvm/dist-release_70/include/llvm/Transforms/Utils/BuildLibCalls.h
==
--- vendor/llvm/dist-release_70/include/llvm/Transforms/Utils/BuildLibCalls.h   
Sun Nov  4 14:11:38 2018(r340115)
+++ vendor/llvm/dist-release_70/include/llvm/Transforms/Utils/BuildLibCalls.h   
Sun Nov  4 14:41:47 2018(r340116)
@@ -29,6 +29,7 @@ namespace llvm {
   ///
   /// Returns true if any attributes were set and false otherwise.
   bool inferLibFuncAttributes(Function , const TargetLibraryInfo );
+  bool inferLibFuncAttributes(Module *M, StringRef Name, const 
TargetLibraryInfo );
 
   /// Check whether the overloaded unary floating point function
   /// corresponding to \a Ty is available.

Modified: vendor/llvm/dist-release_70/lib/Analysis/ModuleSummaryAnalysis.cpp
==
--- vendor/llvm/dist-release_70/lib/Analysis/ModuleSummaryAnalysis.cpp  Sun Nov 
 4 14:11:38 2018(r340115)
+++ vendor/llvm/dist-release_70/lib/Analysis/ModuleSummaryAnalysis.cpp  Sun Nov 
 4 14:41:47 2018(r340116)
@@ -74,9 +74,17 @@ cl::opt ,
  SmallPtrSet ) {
+  bool HasBlockAddress = false;
   SmallVector Worklist;
   Worklist.push_back(CurUser);
 
@@ -92,8 +100,10 @@ static void findRefEdges(ModuleSummaryIndex , co
   const User *Operand = dyn_cast(OI);
   if (!Operand)
 continue;
-  if (isa(Operand))
+  if (isa(Operand)) {
+HasBlockAddress = true;
 continue;
+  }
   if (auto *GV = dyn_cast(Operand)) {
 // We have a reference to a global value. This should be added to
 // the reference set unless it is a callee. Callees are handled
@@ -105,6 +115,7 @@ static void findRefEdges(ModuleSummaryIndex , co
   Worklist.push_back(Operand);
 }
   }
+  return HasBlockAddress;
 }
 
 static CalleeInfo::HotnessType getHotness(uint64_t ProfileCount,
@@ -369,7 +380,7 @@ computeVariableSummary(ModuleSummaryIndex , cons
DenseSet ) {
   SetVector RefEdges;
   SmallPtrSet Visited;
-  findRefEdges(Index, , RefEdges, Visited);
+  bool HasBlockAddress = findRefEdges(Index, , RefEdges, Visited);
   bool NonRenamableLocal = isNonRenamableLocal(V);
   GlobalValueSummary::GVFlags Flags(V.getLinkage(), NonRenamableLocal,
 /* Live = */ false, V.isDSOLocal());
@@ -377,6 +388,8 @@ computeVariableSummary(ModuleSummaryIndex , cons
   llvm::make_unique(Flags, RefEdges.takeVector());
   if (NonRenamableLocal)
 CantBePromoted.insert(V.getGUID());
+  if (HasBlockAddress)
+GVarSummary->setNotEligibleToImport();
   Index.addGlobalValueSummary(V, std::move(GVarSummary));
 }
 

Modified: vendor/llvm/dist-release_70/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

svn commit: r340115 - head/lib/msun/man

2018-11-04 Thread Mateusz Piotrowski
Author: 0mp (ports committer)
Date: Sun Nov  4 14:11:38 2018
New Revision: 340115
URL: https://svnweb.freebsd.org/changeset/base/340115

Log:
  csqrt(3): Fix some typos in the manual page
  
  Submitted by: Steve Kargl 
  Reviewed by:  eadler
  Approved by:krion (mentor, implicit), mat (mentor, implicit)
  Differential Revision:https://reviews.freebsd.org/D17831

Modified:
  head/lib/msun/man/csqrt.3

Modified: head/lib/msun/man/csqrt.3
==
--- head/lib/msun/man/csqrt.3   Sun Nov  4 10:14:08 2018(r340114)
+++ head/lib/msun/man/csqrt.3   Sun Nov  4 14:11:38 2018(r340115)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 30, 2008
+.Dd November 4, 2018
 .Dt CSQRT 3
 .Os
 .Sh NAME
@@ -78,7 +78,7 @@ k + \*(Na*I   \*(Na + \*(Na*I \&
 .Pp
 For numbers with negative imaginary parts, the above special cases
 apply given the identity:
-.Dl csqrt(conj(z) = conj(sqrt(z))
+.Dl csqrt(conj(z)) = conj(csqrt(z))
 Note that the sign of \*(Na is indeterminate.
 Also, if the real or imaginary part of the input is finite and
 an \*(Na is generated, an invalid exception will be thrown.
___
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: r340114 - head/etc

2018-11-04 Thread Baptiste Daroussin
Author: bapt
Date: Sun Nov  4 10:14:08 2018
New Revision: 340114
URL: https://svnweb.freebsd.org/changeset/base/340114

Log:
  Simplify NLS alias handling by using native make(1) multi variable for loops

Deleted:
  head/etc/nls.alias
Modified:
  head/etc/Makefile

Modified: head/etc/Makefile
==
--- head/etc/Makefile   Sun Nov  4 06:59:13 2018(r340113)
+++ head/etc/Makefile   Sun Nov  4 10:14:08 2018(r340114)
@@ -4,6 +4,8 @@
 .include 
 
 FILESGROUPS=   FILES
+NLS_ALIASES=   POSIX C \
+   en_US.US_ASCII C
 
 # No need as it is empty and just causes rebuilds since this file does so much.
 UPDATE_DEPENDFILE= no
@@ -182,11 +184,9 @@ distrib-dirs: ${MTREES:N/*} distrib-cleanup .PHONY
 .endfor
 .endif
 .if ${MK_NLS} != "no"
-   set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \
-   while [ $$# -gt 0 ] ; do \
-   ${INSTALL_SYMLINK} "$$2" "${DESTDIR}${SHAREDIR}/nls/$$1"; \
-   shift; shift; \
-   done
+.for alias nls in ${NLS_ALIASES}
+   ${INSTALL_SYMLINK} "${nls}" "${DESTDIR}${SHAREDIR}/nls/${alias}"
+.endfor
 .endif
 
 etc-examples: ${META_DEPS}
___
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: r340113 - head/etc

2018-11-04 Thread Baptiste Daroussin
Author: bapt
Date: Sun Nov  4 06:59:13 2018
New Revision: 340113
URL: https://svnweb.freebsd.org/changeset/base/340113

Log:
  Fix bad copy/paste

Modified:
  head/etc/Makefile

Modified: head/etc/Makefile
==
--- head/etc/Makefile   Sun Nov  4 06:47:21 2018(r340112)
+++ head/etc/Makefile   Sun Nov  4 06:59:13 2018(r340113)
@@ -165,7 +165,7 @@ distrib-dirs: ${MTREES:N/*} distrib-cleanup .PHONY
${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \
${MTREE_FILTER} $$m | \
${MTREE_CMD} -deU ${MTREE_FSCHG} ${MTREE_FOLLOWS_SYMLINKS} \
-   -p $$d; \
+   -p $$d
 .endfor
 .if defined(NO_ROOT)
 .for _m _d in ${MTREES}
@@ -178,7 +178,7 @@ distrib-dirs: ${MTREES:N/*} distrib-cleanup .PHONY
"sed s#^\.#.$$d# | ${METALOG.add}" ; \
${MTREE_FILTER} $$m | \
${MTREE_CMD:N-W} -C -K all | sed s#^\.#.$$d# | \
-   ${METALOG.add} ; \
+   ${METALOG.add}
 .endfor
 .endif
 .if ${MK_NLS} != "no"
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340112 - head/etc

2018-11-04 Thread Baptiste Daroussin
Author: bapt
Date: Sun Nov  4 06:47:21 2018
New Revision: 340112
URL: https://svnweb.freebsd.org/changeset/base/340112

Log:
  Simplify a bit distrib-dirs target
  
  Reviewed by:  bdrewery
  Differential Revision:https://reviews.freebsd.org/D3915

Modified:
  head/etc/Makefile

Modified: head/etc/Makefile
==
--- head/etc/Makefile   Sun Nov  4 06:39:01 2018(r340111)
+++ head/etc/Makefile   Sun Nov  4 06:47:21 2018(r340112)
@@ -157,35 +157,29 @@ distrib-cleanup: .PHONY
done
 
 distrib-dirs: ${MTREES:N/*} distrib-cleanup .PHONY
-   @set ${MTREES}; \
-   while test $$# -ge 2; do \
-   m=${.CURDIR}/$$1; \
-   shift; \
-   d=${DESTDIR}$$1; \
-   shift; \
-   test -d $$d || mkdir -p $$d; \
-   ${ECHO} ${MTREE_CMD} -deU ${MTREE_FSCHG} \
-   ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \
-   ${MTREE_FILTER} $$m | \
-   ${MTREE_CMD} -deU ${MTREE_FSCHG} ${MTREE_FOLLOWS_SYMLINKS} \
-   -p $$d; \
-   done; true
+.for _m _d in ${MTREES}
+   @m=${.CURDIR}/${_m}; \
+   d=${DESTDIR}${_d}; \
+   test -d $$d || mkdir -p $$d; \
+   ${ECHO} ${MTREE_CMD} -deU ${MTREE_FSCHG} \
+   ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \
+   ${MTREE_FILTER} $$m | \
+   ${MTREE_CMD} -deU ${MTREE_FSCHG} ${MTREE_FOLLOWS_SYMLINKS} \
+   -p $$d; \
+.endfor
 .if defined(NO_ROOT)
-   @set ${MTREES}; \
-   while test $$# -ge 2; do \
-   m=${.CURDIR}/$$1; \
-   shift; \
-   d=$$1; \
-   test "$$d" == "/" && d=""; \
-   d=${DISTBASE}$$d; \
-   shift; \
-   test -d ${DESTDIR}/$$d || mkdir -p ${DESTDIR}/$$d; \
-   ${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K all | " \
-   "sed s#^\.#.$$d# | ${METALOG.add}" ; \
-   ${MTREE_FILTER} $$m | \
-   ${MTREE_CMD:N-W} -C -K all | sed s#^\.#.$$d# | \
-   ${METALOG.add} ; \
-   done; true
+.for _m _d in ${MTREES}
+   @m=${.CURDIR}/${_m}; \
+   d=${_d}; \
+   test "$$d" == "/" && d=""; \
+   d=${DISTBASE}$$d; \
+   test -d ${DESTDIR}/$$d || mkdir -p ${DESTDIR}/$$d; \
+   ${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K all | " \
+   "sed s#^\.#.$$d# | ${METALOG.add}" ; \
+   ${MTREE_FILTER} $$m | \
+   ${MTREE_CMD:N-W} -C -K all | sed s#^\.#.$$d# | \
+   ${METALOG.add} ; \
+.endfor
 .endif
 .if ${MK_NLS} != "no"
set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \
___
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: r340111 - head/usr.sbin/nfsd

2018-11-04 Thread Baptiste Daroussin
Author: bapt
Date: Sun Nov  4 06:39:01 2018
New Revision: 340111
URL: https://svnweb.freebsd.org/changeset/base/340111

Log:
  nfsd: Factorize code
  
  Factorize code by using struct sockaddr_storage to handle both ipv6 and ipv4
  
  Discussed with:   rmacklem
  Reviewed by:  manu
  MFC after:1 month
  Sponsored by: Gandi.net
  Differential Revision:https://reviews.freebsd.org/D13223

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

Modified: head/usr.sbin/nfsd/nfsd.c
==
--- head/usr.sbin/nfsd/nfsd.c   Sun Nov  4 06:35:48 2018(r340110)
+++ head/usr.sbin/nfsd/nfsd.c   Sun Nov  4 06:39:01 2018(r340111)
@@ -160,10 +160,8 @@ main(int argc, char **argv)
struct addrinfo *ai_udp, *ai_tcp, *ai_udp6, *ai_tcp6, hints;
struct netconfig *nconf_udp, *nconf_tcp, *nconf_udp6, *nconf_tcp6;
struct netbuf nb_udp, nb_tcp, nb_udp6, nb_tcp6;
-   struct sockaddr_in inetpeer;
-   struct sockaddr_in6 inet6peer;
+   struct sockaddr_storage peer;
fd_set ready, sockbits;
-   fd_set v4bits, v6bits;
int ch, connect_type_cnt, i, maxsock, msgsock;
socklen_t len;
int on = 1, unregister, reregister, sock;
@@ -480,8 +478,6 @@ main(int argc, char **argv)
}
 
(void)signal(SIGUSR1, cleanup);
-   FD_ZERO();
-   FD_ZERO();
FD_ZERO();
  
rpcbregcnt = 0;
@@ -663,7 +659,6 @@ main(int argc, char **argv)
}
freeaddrinfo(ai_tcp);
FD_SET(tcpsock, );
-   FD_SET(tcpsock, ); 
maxsock = tcpsock;
connect_type_cnt++;
}
@@ -742,7 +737,6 @@ main(int argc, char **argv)
}
freeaddrinfo(ai_tcp6);
FD_SET(tcp6sock, );
-   FD_SET(tcp6sock, );
if (maxsock < tcp6sock)
maxsock = tcp6sock;
connect_type_cnt++;
@@ -816,52 +810,25 @@ main(int argc, char **argv)
}
for (tcpsock = 0; tcpsock <= maxsock; tcpsock++) {
if (FD_ISSET(tcpsock, )) {
-   if (FD_ISSET(tcpsock, )) {
-   len = sizeof(inetpeer);
-   if ((msgsock = accept(tcpsock,
-   (struct sockaddr *), 
)) < 0) {
-   error = errno;
-   syslog(LOG_ERR, "accept failed: 
%m");
-   if (error == ECONNABORTED ||
-   error == EINTR)
-   continue;
-   nfsd_exit(1);
-   }
-   memset(inetpeer.sin_zero, 0,
-   sizeof(inetpeer.sin_zero));
-   if (setsockopt(msgsock, SOL_SOCKET,
-   SO_KEEPALIVE, (char *), 
sizeof(on)) < 0)
-   syslog(LOG_ERR,
-   "setsockopt SO_KEEPALIVE: 
%m");
-   addsockargs.sock = msgsock;
-   addsockargs.name = (caddr_t)
-   addsockargs.namelen = len;
-   nfssvc(nfssvc_addsock, );
-   (void)close(msgsock);
-   } else if (FD_ISSET(tcpsock, )) {
-   len = sizeof(inet6peer);
-   if ((msgsock = accept(tcpsock,
-   (struct sockaddr *),
-   )) < 0) {
-   error = errno;
-   syslog(LOG_ERR,
-"accept failed: %m");
-   if (error == ECONNABORTED ||
-   error == EINTR)
-   continue;
-   nfsd_exit(1);
-   }
-   if (setsockopt(msgsock, SOL_SOCKET,
-   SO_KEEPALIVE, (char *),
-   sizeof(on)) < 0)
-

svn commit: r340110 - head/sbin/ipfw

2018-11-04 Thread Eugene Grosbein
Author: eugen
Date: Sun Nov  4 06:35:48 2018
New Revision: 340110
URL: https://svnweb.freebsd.org/changeset/base/340110

Log:
  ipfw(8): clarify layer2 processing abilities
  
  Make it clear that ipfw action set for layer2 frames it a bit limited.
  
  PR:   59835
  Reviewed by:  yuripv
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D17719

Modified:
  head/sbin/ipfw/ipfw.8

Modified: head/sbin/ipfw/ipfw.8
==
--- head/sbin/ipfw/ipfw.8   Sun Nov  4 06:25:07 2018(r340109)
+++ head/sbin/ipfw/ipfw.8   Sun Nov  4 06:35:48 2018(r340110)
@@ -511,6 +511,27 @@ ipfw add 10 skipto 4000 all from any to any layer2 out
 .Pp
 (yes, at the moment there is no way to differentiate between
 ether_demux and bdg_forward).
+.Pp
+Also note that only actions
+.Cm allow,
+.Cm deny,
+.Cm netgraph,
+.Cm ngtee
+and related to
+.Cm dummynet
+are processed for
+.Cm layer2
+frames and all other actions act as if they were
+.Cm allow
+for such frames.
+Full set of actions is supported for IP packets without
+.Cm layer2
+headers only.
+For example,
+.Cm divert
+action does not divert
+.Cm layer2
+frames.
 .Sh SYNTAX
 In general, each keyword or argument must be provided as
 a separate command line argument, with no leading or trailing
___
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: r340109 - stable/12/sys/netinet

2018-11-04 Thread Bjoern A. Zeeb
Author: bz
Date: Sun Nov  4 06:25:07 2018
New Revision: 340109
URL: https://svnweb.freebsd.org/changeset/base/340109

Log:
  MFC r340009:
  
carpstats are the last virtualised variable in the file and end up at the
end of the vnet_set.  The generated code uses an absolute relocation at
one byte beyond the end of the carpstats array.  This means the relocation
for the vnet does not happen for carpstats initialisation and as a result
the kernel panics on module load.
  
This problem has only been observed with carp and only on i386.
We considered various possible solutions including using linker scripts
to add padding to all kernel modules for pcpu and vnet sections.
  
While the symbols (by chance) stay in the order of appearance in the file
adding an unused non-file-local variable at the end of the file will extend
the size of set_vnet and hence make the absolute relocation for carpstats
work (think of this as a single-module set_vnet padding).
  
This is a (tmporary) hack.  It is the least intrusive one as we need a
timely solution for the upcoming release.  We will revisit the problem in
HEAD.  For a lot more information and the possible alternate solutions
please see the PR and the references therein.
  
  PR:   230857
  Approved by:  re (kib)

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

Modified: stable/12/sys/netinet/ip_carp.c
==
--- stable/12/sys/netinet/ip_carp.c Sun Nov  4 06:24:27 2018
(r340108)
+++ stable/12/sys/netinet/ip_carp.c Sun Nov  4 06:25:07 2018
(r340109)
@@ -2176,6 +2176,21 @@ static struct protosw in6_carp_protosw = {
 };
 #endif
 
+#ifdef VIMAGE
+#if defined(__i386__)
+/*
+ * XXX This is a hack to work around an absolute relocation outside
+ * set_vnet by one (on the stop symbol) for carpstats.  Add a dummy variable
+ * to the end of the file in the hope that the linker will just keep the
+ * order (as it seems to do at the moment).  It is understood to be fragile.
+ * See PR 230857 for a longer discussion of the problem and the referenced
+ * review for possible alternate solutions.  Each is a hack; we just need
+ * the least intrusive one for the next release.
+ */
+VNET_DEFINE(char, carp_zzz) = 0xde;
+#endif
+#endif
+
 static void
 carp_mod_cleanup(void)
 {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340108 - in head: lib/libpmc lib/libpmc/pmu-events lib/libpmc/pmu-events/arch/x86/amdfam17h sys/dev/hwpmc

2018-11-04 Thread Matt Macy
Author: mmacy
Date: Sun Nov  4 06:24:27 2018
New Revision: 340108
URL: https://svnweb.freebsd.org/changeset/base/340108

Log:
  Add aditional counter descriptions to AMD 0x17
  
  Submitted by: Somalapuram Amaranath
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D17401

Added:
  head/lib/libpmc/pmu-events/arch/x86/amdfam17h/data-fabric.json   (contents, 
props changed)
  head/lib/libpmc/pmu-events/arch/x86/amdfam17h/l3cache.json   (contents, props 
changed)
Modified:
  head/lib/libpmc/libpmc_pmu_util.c
  head/lib/libpmc/pmu-events/jevents.c
  head/sys/dev/hwpmc/hwpmc_amd.c
  head/sys/dev/hwpmc/hwpmc_amd.h

Modified: head/lib/libpmc/libpmc_pmu_util.c
==
--- head/lib/libpmc/libpmc_pmu_util.c   Sun Nov  4 00:32:28 2018
(r340107)
+++ head/lib/libpmc/libpmc_pmu_util.c   Sun Nov  4 06:24:27 2018
(r340108)
@@ -146,6 +146,8 @@ pmu_alias_get(const char *name)
 struct pmu_event_desc {
uint64_t ped_period;
uint64_t ped_offcore_rsp;
+   uint64_t ped_l3_thread;
+   uint64_t ped_l3_slice;
uint32_t ped_event;
uint32_t ped_frontend;
uint32_t ped_ldlat;
@@ -270,6 +272,10 @@ pmu_parse_event(struct pmu_event_desc *ped, const char
ped->ped_ch_mask = strtol(value, NULL, 16);
else if (strcmp(key, "config1") == 0)
ped->ped_config1 = strtol(value, NULL, 16);
+   else if (strcmp(key, "l3_thread_mask") == 0)
+   ped->ped_l3_thread = strtol(value, NULL, 16);
+   else if (strcmp(key, "l3_slice_mask") == 0)
+   ped->ped_l3_slice = strtol(value, NULL, 16);
else {
debug = getenv("PMUDEBUG");
if (debug != NULL && strcmp(debug, "true") == 0 && 
value != NULL)
@@ -407,33 +413,50 @@ pmc_pmu_print_counter_full(const char *ev)
 }
 
 static int
-pmc_pmu_amd_pmcallocate(const char *event_name __unused, struct 
pmc_op_pmcallocate *pm,
+pmc_pmu_amd_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm,
struct pmu_event_desc *ped)
 {
struct pmc_md_amd_op_pmcallocate *amd;
+   const struct pmu_event *pe;
+   int idx = -1;
 
amd = >pm_md.pm_amd;
-   amd->pm_amd_config = AMD_PMC_TO_EVENTMASK(ped->ped_event);
if (ped->ped_umask > 0) {
pm->pm_caps |= PMC_CAP_QUALIFIER;
amd->pm_amd_config |= AMD_PMC_TO_UNITMASK(ped->ped_umask);
}
pm->pm_class = PMC_CLASS_K8;
+   pe = pmu_event_get(NULL, event_name, );
 
-   if ((pm->pm_caps & (PMC_CAP_USER|PMC_CAP_SYSTEM)) == 0 ||
-   (pm->pm_caps & (PMC_CAP_USER|PMC_CAP_SYSTEM)) ==
-   (PMC_CAP_USER|PMC_CAP_SYSTEM))
-   amd->pm_amd_config |= (AMD_PMC_USR | AMD_PMC_OS);
-   else if (pm->pm_caps & PMC_CAP_USER)
-   amd->pm_amd_config |= AMD_PMC_USR;
-   else if (pm->pm_caps & PMC_CAP_SYSTEM)
-   amd->pm_amd_config |= AMD_PMC_OS;
-   if (ped->ped_edge)
-   amd->pm_amd_config |= AMD_PMC_EDGE;
-   if (ped->ped_inv)
-   amd->pm_amd_config |= AMD_PMC_EDGE;
-   if (pm->pm_caps & PMC_CAP_INTERRUPT)
-   amd->pm_amd_config |= AMD_PMC_INT;
+   if (strcmp("l3cache", pe->topic) == 0){
+   amd->pm_amd_config |= AMD_PMC_TO_EVENTMASK(ped->ped_event);
+   amd->pm_amd_sub_class = PMC_AMD_SUB_CLASS_L3_CACHE;
+   amd->pm_amd_config |= AMD_PMC_TO_L3SLICE(ped->ped_l3_slice);
+   amd->pm_amd_config |= AMD_PMC_TO_L3CORE(ped->ped_l3_thread);
+   }
+   else if (strcmp("data fabric", pe->topic) == 0){
+
+   amd->pm_amd_config |= AMD_PMC_TO_EVENTMASK_DF(ped->ped_event);
+   amd->pm_amd_sub_class = PMC_AMD_SUB_CLASS_DATA_FABRIC;
+   }
+   else{
+   amd->pm_amd_config |= AMD_PMC_TO_EVENTMASK(ped->ped_event);
+   amd->pm_amd_sub_class = PMC_AMD_SUB_CLASS_CORE;
+   if ((pm->pm_caps & (PMC_CAP_USER|PMC_CAP_SYSTEM)) == 0 ||
+   (pm->pm_caps & (PMC_CAP_USER|PMC_CAP_SYSTEM)) ==
+   (PMC_CAP_USER|PMC_CAP_SYSTEM))
+   amd->pm_amd_config |= (AMD_PMC_USR | AMD_PMC_OS);
+   else if (pm->pm_caps & PMC_CAP_USER)
+   amd->pm_amd_config |= AMD_PMC_USR;
+   else if (pm->pm_caps & PMC_CAP_SYSTEM)
+   amd->pm_amd_config |= AMD_PMC_OS;
+   if (ped->ped_edge)
+   amd->pm_amd_config |= AMD_PMC_EDGE;
+   if (ped->ped_inv)
+   amd->pm_amd_config |= AMD_PMC_EDGE;
+   if (pm->pm_caps & PMC_CAP_INTERRUPT)
+   amd->pm_amd_config |= AMD_PMC_INT;
+   }
return (0);
 }
 

Added: head/lib/libpmc/pmu-events/arch/x86/amdfam17h/data-fabric.json