CVS commit: src/sys/dev/pckbport
Module Name:src Committed By: maya Date: Sat Jul 14 00:47:33 UTC 2018 Modified Files: src/sys/dev/pckbport: synaptics.c synapticsreg.h Log Message: Send the 'magic reverse engineered sequence' with a single sliced command, don't wait for individual ACKs. Fixes kern/53444. While here: - use better descriptive names for functions - use a function for the extended write command - add macro for number from the old synaptics documentation - don't get the resp from the command sequence if we're going to ignore it anyway most from uwe. To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/sys/dev/pckbport/synaptics.c cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pckbport/synapticsreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pckbport/synaptics.c diff -u src/sys/dev/pckbport/synaptics.c:1.41 src/sys/dev/pckbport/synaptics.c:1.42 --- src/sys/dev/pckbport/synaptics.c:1.41 Sun Jun 3 15:10:12 2018 +++ src/sys/dev/pckbport/synaptics.c Sat Jul 14 00:47:33 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: synaptics.c,v 1.41 2018/06/03 15:10:12 christos Exp $ */ +/* $NetBSD: synaptics.c,v 1.42 2018/07/14 00:47:33 maya Exp $ */ /* * Copyright (c) 2005, Steve C. Woodford @@ -48,7 +48,7 @@ #include "opt_pms.h" #include -__KERNEL_RCSID(0, "$NetBSD: synaptics.c,v 1.41 2018/06/03 15:10:12 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: synaptics.c,v 1.42 2018/07/14 00:47:33 maya Exp $"); #include #include @@ -179,7 +179,7 @@ synaptics_poll_reset(struct pms_softc *p } static int -synaptics_poll_status(struct pms_softc *psc, u_char slice, u_char resp[3]) +synaptics_special_read(struct pms_softc *psc, u_char slice, u_char resp[3]) { u_char cmd[1] = { PMS_SEND_DEV_STATUS }; int res = pms_sliced_command(psc->sc_kbctag, psc->sc_kbcslot, slice); @@ -188,6 +188,21 @@ synaptics_poll_status(struct pms_softc * cmd, 1, 3, resp, 0); } +static int +synaptics_special_write(struct pms_softc *psc, u_char command, u_char arg) +{ + int res = pms_sliced_command(psc->sc_kbctag, psc->sc_kbcslot, arg); + if (res) + return res; + + u_char cmd[2]; + cmd[0] = PMS_SET_SAMPLE; + cmd[1] = command; + res = pckbport_poll_cmd(psc->sc_kbctag, psc->sc_kbcslot, + cmd, 2, 0, NULL, 0); + return res; +} + static void pms_synaptics_probe_extended(struct pms_softc *psc) { @@ -213,7 +228,7 @@ pms_synaptics_probe_extended(struct pms_ if (((sc->caps & SYNAPTICS_CAP_EXTNUM) + 0x08) >= SYNAPTICS_EXTENDED_QUERY) { - res = synaptics_poll_status(psc, SYNAPTICS_EXTENDED_QUERY, resp); + res = synaptics_special_read(psc, SYNAPTICS_EXTENDED_QUERY, resp); if (res == 0) { int buttons = (resp[1] >> 4); aprint_debug_dev(psc->sc_dev, @@ -245,7 +260,7 @@ pms_synaptics_probe_extended(struct pms_ if (((sc->caps & SYNAPTICS_CAP_EXTNUM) + 0x08) >= SYNAPTICS_CONTINUED_CAPABILITIES) { - res = synaptics_poll_status(psc, + res = synaptics_special_read(psc, SYNAPTICS_CONTINUED_CAPABILITIES, resp); /* @@ -362,7 +377,7 @@ pms_synaptics_probe_init(void *vsc) /* Query the hardware capabilities. */ - res = synaptics_poll_status(psc, SYNAPTICS_READ_CAPABILITIES, resp); + res = synaptics_special_read(psc, SYNAPTICS_READ_CAPABILITIES, resp); if (res) { /* Hmm, failed to get capabilites. */ aprint_error_dev(psc->sc_dev, @@ -410,7 +425,6 @@ pms_synaptics_enable(void *vsc) struct synaptics_softc *sc = >u.synaptics; u_char enable_modes; int res; - u_char cmd[1], resp[3]; if (sc->flags & SYN_FLAG_HAS_PASSTHROUGH) { /* @@ -441,37 +455,17 @@ pms_synaptics_enable(void *vsc) for (int i = 0; i < 2; i++) synaptics_poll_cmd(psc, PMS_SET_SCALE11, 0); - res = pms_sliced_command(psc->sc_kbctag, psc->sc_kbcslot, - enable_modes); + res = synaptics_special_write(psc, SYNAPTICS_CMD_SET_MODE2, enable_modes); if (res) aprint_error("synaptics: set mode error\n"); - synaptics_poll_cmd(psc, PMS_SET_SAMPLE, SYNAPTICS_CMD_SET_MODE2, 0); - /* a couple of set scales to clear out pending commands */ for (int i = 0; i < 2; i++) synaptics_poll_cmd(psc, PMS_SET_SCALE11, 0); - /* - * Enable multi-finger capability in cold boot case with - * undocumented sequence. - * Parameters from - * https://github.com/RehabMan/OS-X-Voodoo-PS2-Controller/ - * VoodooPS2Trackpad/VoodooPS2SynapticsTouchPad.cpp - * setTouchPadModeByte function. - */ - if (sc->flags & SYN_FLAG_HAS_EXTENDED_WMODE) { - static const uint8_t seq[] = { - 0xe6, 0xe8, 0x00, 0xe8, 0x00, - 0xe8, 0x00, 0xe8, 0x03, 0xf3, - 0xc8, - }; - for (size_t s = 0; s < __arraycount(seq); s++) { - cmd[0] = seq[s]; - (void)pckbport_poll_cmd(psc->sc_kbctag, psc->sc_kbcslot, -cmd, 1, 3, resp, 0); - } - } + /* Set advanced gesture mode */ + if (sc->flags & SYN_FLAG_HAS_EXTENDED_WMODE) + synaptics_special_write(psc, SYNAPTICS_WRITE_DELUXE_3, 0x3); synaptics_poll_cmd(psc, PMS_DEV_ENABLE, 0);
CVS commit: src/bin/sh
Module Name:src Committed By: kre Date: Fri Jul 13 22:43:44 UTC 2018 Modified Files: src/bin/sh: histedit.c mystring.c options.c parser.c var.c Log Message: Remove atoi() Mostly use number() (no longer implemented using atoi()) when an unsigned integer is required, but use strtoXXX() when a conversion is wanted, without the possibility or error (like setting OPTIND and RANDOM). Always init OPTIND to 1 when sh starts (overriding anything in environ.) To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/bin/sh/histedit.c src/bin/sh/options.c cvs rdiff -u -r1.17 -r1.18 src/bin/sh/mystring.c cvs rdiff -u -r1.146 -r1.147 src/bin/sh/parser.c cvs rdiff -u -r1.69 -r1.70 src/bin/sh/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/sh/histedit.c diff -u src/bin/sh/histedit.c:1.52 src/bin/sh/histedit.c:1.53 --- src/bin/sh/histedit.c:1.52 Wed Jun 28 13:46:06 2017 +++ src/bin/sh/histedit.c Fri Jul 13 22:43:44 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: histedit.c,v 1.52 2017/06/28 13:46:06 kre Exp $ */ +/* $NetBSD: histedit.c,v 1.53 2018/07/13 22:43:44 kre Exp $ */ /*- * Copyright (c) 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)histedit.c 8.2 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: histedit.c,v 1.52 2017/06/28 13:46:06 kre Exp $"); +__RCSID("$NetBSD: histedit.c,v 1.53 2018/07/13 22:43:44 kre Exp $"); #endif #endif /* not lint */ @@ -210,8 +210,8 @@ sethistsize(const char *hs) HistEvent he; if (hist != NULL) { - if (hs == NULL || *hs == '\0' || - (histsize = atoi(hs)) < 0) + if (hs == NULL || *hs == '\0' || *hs == '-' || + (histsize = number(hs)) < 0) histsize = 100; history(hist, , H_SETSIZE, histsize); history(hist, , H_SETUNIQUE, 1); @@ -529,7 +529,7 @@ str_to_event(const char *str, int last) s++; } if (is_number(s)) { - i = atoi(s); + i = number(s); if (relative) { while (retval != -1 && i--) { retval = history(hist, , H_NEXT); Index: src/bin/sh/options.c diff -u src/bin/sh/options.c:1.52 src/bin/sh/options.c:1.53 --- src/bin/sh/options.c:1.52 Tue Nov 21 03:42:39 2017 +++ src/bin/sh/options.c Fri Jul 13 22:43:44 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: options.c,v 1.52 2017/11/21 03:42:39 kre Exp $ */ +/* $NetBSD: options.c,v 1.53 2018/07/13 22:43:44 kre Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)options.c 8.2 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: options.c,v 1.52 2017/11/21 03:42:39 kre Exp $"); +__RCSID("$NetBSD: options.c,v 1.53 2018/07/13 22:43:44 kre Exp $"); #endif #endif /* not lint */ @@ -60,6 +60,7 @@ __RCSID("$NetBSD: options.c,v 1.52 2017/ #include "memalloc.h" #include "error.h" #include "mystring.h" +#include "syntax.h" #ifndef SMALL #include "myhistedit.h" #endif @@ -456,7 +457,12 @@ setcmd(int argc, char **argv) void getoptsreset(const char *value) { - if (number(value) == 1) { + /* + * This is just to detect the case where OPTIND=1 + * is executed. Any other string assigned to OPTIND + * is OK, but is not a reset. No errors, so cannot use number() + */ + if (is_digit(*value) && strtol(value, NULL, 10) == 1) { shellparam.optnext = NULL; shellparam.reset = 1; } Index: src/bin/sh/mystring.c diff -u src/bin/sh/mystring.c:1.17 src/bin/sh/mystring.c:1.18 --- src/bin/sh/mystring.c:1.17 Sun Apr 28 17:01:28 2013 +++ src/bin/sh/mystring.c Fri Jul 13 22:43:44 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: mystring.c,v 1.17 2013/04/28 17:01:28 dholland Exp $ */ +/* $NetBSD: mystring.c,v 1.18 2018/07/13 22:43:44 kre Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)mystring.c 8.2 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: mystring.c,v 1.17 2013/04/28 17:01:28 dholland Exp $"); +__RCSID("$NetBSD: mystring.c,v 1.18 2018/07/13 22:43:44 kre Exp $"); #endif #endif /* not lint */ @@ -51,6 +51,8 @@ __RCSID("$NetBSD: mystring.c,v 1.17 2013 * is_number(s) Return true if s is a string of digits. */ +#include +#include #include #include "shell.h" #include "syntax.h" @@ -110,10 +112,15 @@ prefix(const char *pfx, const char *stri int number(const char *s) { + char *ep = NULL; + intmax_t n; - if (! is_number(s)) - error("Illegal number: %s", s); - return atoi(s); + if (!is_digit(*s) || ((n = strtoimax(s, , 10)), + (ep == NULL || ep == s || *ep != '\0'))) + error("Illegal number: '%s'", s); + if (n < INT_MIN || n > INT_MAX) + error("Number out of range: %s", s); + return (int)n; } Index: src/bin/sh/parser.c diff -u src/bin/sh/parser.c:1.146 src/bin/sh/parser.c:1.147 --- src/bin/sh/parser.c:1.146 Sat Apr 21 21:32:14 2018 +++ src/bin/sh/parser.c Fri Jul 13 22:43:44 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: parser.c,v 1.146 2018/04/21 21:32:14 kre Exp $ */ +/* $NetBSD: parser.c,v 1.147 2018/07/13 22:43:44 kre Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -37,7 +37,7 @@
CVS commit: src/share/man/man5
Module Name:src Committed By: maya Date: Fri Jul 13 21:46:58 UTC 2018 Modified Files: src/share/man/man5: rc.conf.5 Log Message: Remove dhclient references. To generate a diff of this commit: cvs rdiff -u -r1.170 -r1.171 src/share/man/man5/rc.conf.5 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man5/rc.conf.5 diff -u src/share/man/man5/rc.conf.5:1.170 src/share/man/man5/rc.conf.5:1.171 --- src/share/man/man5/rc.conf.5:1.170 Fri Jun 22 19:35:25 2018 +++ src/share/man/man5/rc.conf.5 Fri Jul 13 21:46:58 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: rc.conf.5,v 1.170 2018/06/22 19:35:25 maya Exp $ +.\" $NetBSD: rc.conf.5,v 1.171 2018/07/13 21:46:58 maya Exp $ .\" .\" Copyright (c) 1996 Matthew R. Green .\" All rights reserved. @@ -55,7 +55,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd June 22, 2018 +.Dd July 14, 2018 .Dt RC.CONF 5 .Os .Sh NAME @@ -644,46 +644,6 @@ Runs .Xr blacklistd 8 to dynamically block hosts on a DoS according to configuration set in .Xr blacklistd.conf 5 -.It Sy dhclient -Boolean value. -Set true to configure some or all network interfaces using -the ISC DHCP client. -If you set -.Sy dhclient -true, then -.Pa /var -must be in -.Sy critical_filesystems_local , -or -.Pa /var -must be on the root file system, -or you must modify the -.Sy dhclient_flags -variable to direct the DHCP client to store the leases file -in some other directory on the root file system. -You must not provide ifconfig information or ifaliases -information for any interface that is to be configured using the DHCP client. -Interface aliases can be set up in the DHCP client configuration -file if needed - see -.Xr dhclient.conf 5 -for details. -.Pp -Passes -.Sy dhclient_flags -to the DHCP client. -See -.Xr dhclient 8 -for complete documentation. -If you wish to configure all broadcast -network interfaces using the DHCP client, you can leave this blank. -To configure only specific interfaces, name the interfaces to be configured -on the command line. -.Pp -If you must run the DHCP client before mounting critical file systems, -then you should specify an alternate location for the DHCP client's lease -file in the -.Sy dhclient_flags -variable - for example, "-lf /tmp/dhclient.leases". .It Sy dhcpcd Boolean value. Set true to configure some or all network interfaces using dhcpcd.
CVS commit: src/share/examples/apm
Module Name:src Committed By: maya Date: Fri Jul 13 21:45:37 UTC 2018 Modified Files: src/share/examples/apm: script Log Message: dhclient->dhcpcd To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/share/examples/apm/script Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/examples/apm/script diff -u src/share/examples/apm/script:1.5 src/share/examples/apm/script:1.6 --- src/share/examples/apm/script:1.5 Mon Mar 10 16:14:37 2003 +++ src/share/examples/apm/script Fri Jul 13 21:45:37 2018 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: script,v 1.5 2003/03/10 16:14:37 david Exp $ +# $NetBSD: script,v 1.6 2018/07/13 21:45:37 maya Exp $ # # @@ -44,7 +44,7 @@ case $0 in umount -a-t nfs umount -a -f -t nfs ifconfig $if down - sh /etc/rc.d/dhclient stop + sh /etc/rc.d/dhcpcd stop $LOGGER 'Suspending done.' ;; @@ -55,14 +55,14 @@ case $0 in umount -a-t nfs umount -a -f -t nfs ifconfig $if down - sh /etc/rc.d/dhclient stop + sh /etc/rc.d/dhcpcd stop $LOGGER 'Standby done.' ;; *resume) $LOGGER 'Resuming...' noise $S/KDE_Startup.wav - sh /etc/rc.d/dhclient start + sh /etc/rc.d/dhcpcd start # mount /home # mount /data $LOGGER 'Resuming done.'
CVS commit: src/share/man/man5
Module Name:src Committed By: maya Date: Fri Jul 13 21:44:32 UTC 2018 Modified Files: src/share/man/man5: networks.5 Log Message: Xref dhcpcd, not removed dhclient. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/share/man/man5/networks.5 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man5/networks.5 diff -u src/share/man/man5/networks.5:1.16 src/share/man/man5/networks.5:1.17 --- src/share/man/man5/networks.5:1.16 Sun Sep 7 16:22:28 2003 +++ src/share/man/man5/networks.5 Fri Jul 13 21:44:32 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: networks.5,v 1.16 2003/09/07 16:22:28 wiz Exp $ +.\" $NetBSD: networks.5,v 1.17 2018/07/13 21:44:32 maya Exp $ .\" .\" Copyright (c) 1983, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" @(#)networks.5 8.1 (Berkeley) 6/5/93 .\" -.Dd November 17, 2000 +.Dd July 14, 2018 .Dt NETWORKS 5 .Os .Sh NAME @@ -136,7 +136,7 @@ file resides in .Xr nsswitch.conf 5 , .Xr resolv.conf 5 , .Xr hostname 7 , -.Xr dhclient 8 , +.Xr dhcpcd 8 , .Xr dhcpd 8 , .Xr named 8 .Rs
CVS commit: src/usr.sbin/tprof
Module Name:src Committed By: joerg Date: Fri Jul 13 19:54:53 UTC 2018 Modified Files: src/usr.sbin/tprof: tprof.c Log Message: Mark tprof_monitor as dead To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/tprof/tprof.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/tprof/tprof.c diff -u src/usr.sbin/tprof/tprof.c:1.9 src/usr.sbin/tprof/tprof.c:1.10 --- src/usr.sbin/tprof/tprof.c:1.9 Fri Jul 13 12:04:50 2018 +++ src/usr.sbin/tprof/tprof.c Fri Jul 13 19:54:53 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: tprof.c,v 1.9 2018/07/13 12:04:50 maxv Exp $ */ +/* $NetBSD: tprof.c,v 1.10 2018/07/13 19:54:53 joerg Exp $ */ /* * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ #include #ifndef lint -__RCSID("$NetBSD: tprof.c,v 1.9 2018/07/13 12:04:50 maxv Exp $"); +__RCSID("$NetBSD: tprof.c,v 1.10 2018/07/13 19:54:53 joerg Exp $"); #endif /* not lint */ #include @@ -84,7 +84,7 @@ int devfd; int outfd; static void tprof_list(int, char **); -static void tprof_monitor(int, char **); +static void tprof_monitor(int, char **) __dead; static struct cmdtab { const char *label;
CVS commit: src/external/gpl3
Module Name:src Committed By: joerg Date: Fri Jul 13 19:54:14 UTC 2018 Modified Files: src/external/gpl3/binutils.old/dist/bfd: elf.c src/external/gpl3/binutils/dist/bfd: elf.c Log Message: Reapply with fixed condition: PT_PHDR is useful without PT_INTERP, i.e. for static PIE. It removes the need for platform-specific computations of _DYNAMIC and friends. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/external/gpl3/binutils.old/dist/bfd/elf.c cvs rdiff -u -r1.11 -r1.12 src/external/gpl3/binutils/dist/bfd/elf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/gpl3/binutils.old/dist/bfd/elf.c diff -u src/external/gpl3/binutils.old/dist/bfd/elf.c:1.7 src/external/gpl3/binutils.old/dist/bfd/elf.c:1.8 --- src/external/gpl3/binutils.old/dist/bfd/elf.c:1.7 Fri Jul 13 10:49:17 2018 +++ src/external/gpl3/binutils.old/dist/bfd/elf.c Fri Jul 13 19:54:14 2018 @@ -4159,7 +4159,7 @@ static bfd_size_type get_program_header_size (bfd *abfd, struct bfd_link_info *info) { size_t segs; - asection *s; + asection *s, *s2; const struct elf_backend_data *bed; /* Assume we will need exactly two PT_LOAD segments: one for text @@ -4167,21 +4167,28 @@ get_program_header_size (bfd *abfd, stru segs = 2; s = bfd_get_section_by_name (abfd, ".interp"); + s2 = bfd_get_section_by_name (abfd, ".dynamic"); if (s != NULL && (s->flags & SEC_LOAD) != 0) { - /* If we have a loadable interpreter section, we need a - PT_INTERP segment. In this case, assume we also need a - PT_PHDR segment, although that may not be true for all - targets. */ - segs += 2; + ++segs; } - if (bfd_get_section_by_name (abfd, ".dynamic") != NULL) + if (s2 != NULL && (s2->flags & SEC_LOAD) != 0) { /* We need a PT_DYNAMIC segment. */ ++segs; } + if ((s != NULL && (s->flags & SEC_LOAD) != 0) || + (s2 != NULL && (s2->flags & SEC_LOAD) != 0)) +{ + /* + * If either a PT_INTERP or PT_DYNAMIC segment is created, + * also create a PT_PHDR segment. + */ + ++segs; +} + if (info != NULL && info->relro) { /* We need a PT_GNU_RELRO segment. */ @@ -4447,7 +4454,13 @@ _bfd_elf_map_sections_to_segments (bfd * the program headers and a PT_INTERP segment for the .interp section. */ s = bfd_get_section_by_name (abfd, ".interp"); - if (s != NULL && (s->flags & SEC_LOAD) != 0) + if (s != NULL && (s->flags & SEC_LOAD) == 0) + s = NULL; + dynsec = bfd_get_section_by_name (abfd, ".dynamic"); + if (dynsec != NULL && (dynsec->flags & SEC_LOAD) == 0) + dynsec = NULL; + + if (s != NULL || dynsec != NULL) { amt = sizeof (struct elf_segment_map); m = (struct elf_segment_map *) bfd_zalloc (abfd, amt); @@ -4462,7 +4475,10 @@ _bfd_elf_map_sections_to_segments (bfd * *pm = m; pm = >next; + } + if (s != NULL) + { amt = sizeof (struct elf_segment_map); m = (struct elf_segment_map *) bfd_zalloc (abfd, amt); if (m == NULL) @@ -4489,10 +4505,6 @@ _bfd_elf_map_sections_to_segments (bfd * if (maxpagesize == 0) maxpagesize = 1; writable = FALSE; - dynsec = bfd_get_section_by_name (abfd, ".dynamic"); - if (dynsec != NULL - && (dynsec->flags & SEC_LOAD) == 0) - dynsec = NULL; /* Deal with -Ttext or something similar such that the first section is not adjacent to the program headers. This is an Index: src/external/gpl3/binutils/dist/bfd/elf.c diff -u src/external/gpl3/binutils/dist/bfd/elf.c:1.11 src/external/gpl3/binutils/dist/bfd/elf.c:1.12 --- src/external/gpl3/binutils/dist/bfd/elf.c:1.11 Fri Jul 13 10:49:17 2018 +++ src/external/gpl3/binutils/dist/bfd/elf.c Fri Jul 13 19:54:13 2018 @@ -4301,7 +4301,7 @@ static bfd_size_type get_program_header_size (bfd *abfd, struct bfd_link_info *info) { size_t segs; - asection *s; + asection *s, *s2; const struct elf_backend_data *bed; /* Assume we will need exactly two PT_LOAD segments: one for text @@ -4309,21 +4309,28 @@ get_program_header_size (bfd *abfd, stru segs = 2; s = bfd_get_section_by_name (abfd, ".interp"); + s2 = bfd_get_section_by_name (abfd, ".dynamic"); if (s != NULL && (s->flags & SEC_LOAD) != 0) { - /* If we have a loadable interpreter section, we need a - PT_INTERP segment. In this case, assume we also need a - PT_PHDR segment, although that may not be true for all - targets. */ - segs += 2; + ++segs; } - if (bfd_get_section_by_name (abfd, ".dynamic") != NULL) + if (s2 != NULL && (s2->flags & SEC_LOAD) != 0) { /* We need a PT_DYNAMIC segment. */ ++segs; } + if ((s != NULL && (s->flags & SEC_LOAD) != 0) || + (s2 != NULL && (s2->flags & SEC_LOAD) != 0)) +{ + /* + * If either a PT_INTERP or PT_DYNAMIC segment is created, + * also
CVS commit: src/lib/libc/tls
Module Name:src Committed By: joerg Date: Fri Jul 13 19:50:22 UTC 2018 Modified Files: src/lib/libc/tls: tls.c Log Message: Determine dynamic binaries by presence of PT_INTERP. Static PIE has _DYNAMIC. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/lib/libc/tls/tls.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/tls/tls.c diff -u src/lib/libc/tls/tls.c:1.8 src/lib/libc/tls/tls.c:1.9 --- src/lib/libc/tls/tls.c:1.8 Sun Dec 14 23:49:17 2014 +++ src/lib/libc/tls/tls.c Fri Jul 13 19:50:21 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: tls.c,v 1.8 2014/12/14 23:49:17 chs Exp $ */ +/* $NetBSD: tls.c,v 1.9 2018/07/13 19:50:21 joerg Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__RCSID("$NetBSD: tls.c,v 1.8 2014/12/14 23:49:17 chs Exp $"); +__RCSID("$NetBSD: tls.c,v 1.9 2018/07/13 19:50:21 joerg Exp $"); #include "namespace.h" @@ -45,6 +45,7 @@ __RCSID("$NetBSD: tls.c,v 1.8 2014/12/14 #include #include #include +#include #include #include #include @@ -52,6 +53,7 @@ __RCSID("$NetBSD: tls.c,v 1.8 2014/12/14 __dso_hidden void __libc_static_tls_setup(void); +static bool is_dynamic; static const void *tls_initaddr; static size_t tls_initsize; static size_t tls_size; @@ -131,8 +133,6 @@ _rtld_tls_free(struct tls_tcb *tcb) free(p); } -__weakref_visible int rtld_DYNAMIC __weak_reference(_DYNAMIC); - static int __section(".text.startup") __libc_static_tls_setup_cb(struct dl_phdr_info *data, size_t len, void *cookie) { @@ -140,6 +140,10 @@ __libc_static_tls_setup_cb(struct dl_phd const Elf_Phdr *phlimit = data->dlpi_phdr + data->dlpi_phnum; for (; phdr < phlimit; ++phdr) { + if (phdr->p_type == PT_INTERP) { + is_dynamic = true; + return -1; + } if (phdr->p_type != PT_TLS) continue; tls_initaddr = (void *)(phdr->p_vaddr + data->dlpi_addr); @@ -154,11 +158,9 @@ __libc_static_tls_setup(void) { struct tls_tcb *tcb; - if (_DYNAMIC != NULL) { - return; - } - dl_iterate_phdr(__libc_static_tls_setup_cb, NULL); + if (is_dynamic) + return; tcb = _rtld_tls_allocate(); #ifdef __HAVE___LWP_SETTCB
CVS commit: src/lib/libc/dlfcn
Module Name:src Committed By: joerg Date: Fri Jul 13 19:49:47 UTC 2018 Modified Files: src/lib/libc/dlfcn: dlfcn_elf.c Log Message: Compute relocbase correctly for static PIE. AT_BASE is not usable in this case. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/lib/libc/dlfcn/dlfcn_elf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/dlfcn/dlfcn_elf.c diff -u src/lib/libc/dlfcn/dlfcn_elf.c:1.15 src/lib/libc/dlfcn/dlfcn_elf.c:1.16 --- src/lib/libc/dlfcn/dlfcn_elf.c:1.15 Fri Jan 5 19:29:44 2018 +++ src/lib/libc/dlfcn/dlfcn_elf.c Fri Jul 13 19:49:47 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: dlfcn_elf.c,v 1.15 2018/01/05 19:29:44 kamil Exp $ */ +/* $NetBSD: dlfcn_elf.c,v 1.16 2018/07/13 19:49:47 joerg Exp $ */ /* * Copyright (c) 2000 Takuya SHIOZAKI @@ -27,7 +27,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: dlfcn_elf.c,v 1.15 2018/01/05 19:29:44 kamil Exp $"); +__RCSID("$NetBSD: dlfcn_elf.c,v 1.16 2018/07/13 19:49:47 joerg Exp $"); #endif /* LIBC_SCCS and not lint */ #include "namespace.h" @@ -176,6 +176,17 @@ dl_iterate_phdr_setup(void) break; } } + + if (!dlpi_phdr) + return; + + const Elf_Phdr *phdr = (const Elf_Phdr *)dlpi_phdr; + const Elf_Phdr *phlimit = phdr + dlpi_phnum; + + for (; phdr < phlimit; ++phdr) { + if (phdr->p_type == PT_PHDR) + dlpi_addr = (uintptr_t)phdr - phdr->p_vaddr; + } } /*ARGSUSED*/
CVS commit: src/sys/dev/pckbport
Module Name:src Committed By: maya Date: Fri Jul 13 19:44:08 UTC 2018 Modified Files: src/sys/dev/pckbport: pms.c Log Message: Add comment elaborating what a sliced command is. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/sys/dev/pckbport/pms.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pckbport/pms.c diff -u src/sys/dev/pckbport/pms.c:1.36 src/sys/dev/pckbport/pms.c:1.37 --- src/sys/dev/pckbport/pms.c:1.36 Sun Aug 13 08:49:27 2017 +++ src/sys/dev/pckbport/pms.c Fri Jul 13 19:44:08 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: pms.c,v 1.36 2017/08/13 08:49:27 christos Exp $ */ +/* $NetBSD: pms.c,v 1.37 2018/07/13 19:44:08 maya Exp $ */ /*- * Copyright (c) 2004 Kentaro Kurahone. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pms.c,v 1.36 2017/08/13 08:49:27 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pms.c,v 1.37 2018/07/13 19:44:08 maya Exp $"); #include "opt_pms.h" @@ -675,6 +675,10 @@ pmsinput(void *vsc, int data) } } +/* + * Touchpad special command sequence used by Synaptics and others. + * Sends 0xE6 0xE8 rr 0xE8 ss 0xE8 tt 0xE8 uu where (rr*64)+(ss*16)+(tt*4)+uu + */ int pms_sliced_command(pckbport_tag_t tag, pckbport_slot_t slot, u_char scmd) {
CVS commit: src/doc
Module Name:src Committed By: sevan Date: Fri Jul 13 18:49:44 UTC 2018 Modified Files: src/doc: CHANGES Log Message: Give a heads up about ssh-agent path whitelist change. To generate a diff of this commit: cvs rdiff -u -r1.2408 -r1.2409 src/doc/CHANGES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES diff -u src/doc/CHANGES:1.2408 src/doc/CHANGES:1.2409 --- src/doc/CHANGES:1.2408 Thu Jul 12 21:42:53 2018 +++ src/doc/CHANGES Fri Jul 13 18:49:44 2018 @@ -1,4 +1,4 @@ -# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2408 $> +# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2409 $> # # # [Note: This file does not mention every change made to the NetBSD source tree. @@ -170,4 +170,6 @@ Changes from NetBSD 8.0 to NetBSD 9.0: gcc: add lsan the Leak Sanitizer [christos 20180626] aarch64: Add support for SMP. [ryo 20180709] viadrm(4): Removed, superseded by viadrmums. [maya 20180710] + ssh-agent(1): /usr/pkg/lib* whitelisted by default for PKCS11 related + libraries, in place of /usr/local/lib*. [sevan 20180710] x86: Support for -static -pie binaries. [joerg 20180712]
CVS commit: [netbsd-8] src/doc
Module Name:src Committed By: martin Date: Fri Jul 13 16:16:32 UTC 2018 Modified Files: src/doc [netbsd-8]: CHANGES-8.0 Log Message: Tickets #911, #912, #913, #914, #915, #916, #917, #921 To generate a diff of this commit: cvs rdiff -u -r1.1.2.226 -r1.1.2.227 src/doc/CHANGES-8.0 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-8.0 diff -u src/doc/CHANGES-8.0:1.1.2.226 src/doc/CHANGES-8.0:1.1.2.227 --- src/doc/CHANGES-8.0:1.1.2.226 Fri Jul 13 14:43:46 2018 +++ src/doc/CHANGES-8.0 Fri Jul 13 16:16:32 2018 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-8.0,v 1.1.2.226 2018/07/13 14:43:46 martin Exp $ +# $NetBSD: CHANGES-8.0,v 1.1.2.227 2018/07/13 16:16:32 martin Exp $ A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04 until the 8.0 release: @@ -14202,3 +14202,53 @@ usr.bin/calendar/calendars/calendar.usho Various calendar fixes and floating holidays. [jnemeth, ticket #908] +sys/kern/init_main.c1.498 +sys/net/if.c 1.429 +sys/net/if.h 1.264 +sys/rump/net/lib/libnet/net_component.c 1.10 + + Fix setup of net.inet6.ip6.ifq sysctl node. + [ozaki-r, ticket #911] + +sys/arch/x86/include/specialreg.h 1.127 +sys/arch/x86/x86/identcpu.c 1.79 + + Disable MWAIT/MONITOR on Apollo Lake CPUs to workaround APL30 errata. + [maya, ticket #912] + +external/bsd/dhcpcd/Makefile.inc 1.3 + + Fix an inconsistency that showed /var/db/duid in the man page while the + binary opened /var/db/dhcpcd/duid. + [triaxx, ticket #913] + +usr.bin/printf/printf.c1.38,1.39 + + Avoid running off into oblivion when a format string, + or arg to a %b conversion ends in an unescaped backslash. + Avoid printing error messages twice when an invalid + escape sequence (\ sequence) is present in an arg to a %b + conversion. + [kre, ticket #914] + +sys/net/if.c 1.424 + + Print "NET_MPSAFE enabled" if it's enabled. + [msaitoh, ticket #915] + +external/bsd/ppp/usr.sbin/pppd/sys-bsd.c 1.5 + + Fix deletion of a proxy arp entry. + [christos, ticket #916] + +external/gpl3/binutils.old/dist/bfd/peXXigen.c 1.6 +(applied to external/gpl3/binutils/dist/bfd/peXXigen.c) + + Fix reproducible builds for EFI boot blocks. + [christos, ticket #917] + +usr.sbin/ndp/ndp.c1.52-1.54 + + Fix the host and address output when neighbor cache entry is deleted. + [nonaka, ticket #921] +
CVS commit: [netbsd-8] src/usr.sbin/ndp
Module Name:src Committed By: martin Date: Fri Jul 13 16:14:23 UTC 2018 Modified Files: src/usr.sbin/ndp [netbsd-8]: ndp.c Log Message: Pull up following revision(s) (requested by nonaka in ticket #921): usr.sbin/ndp/ndp.c: revision 1.52-1.54 Remove duplicate rtrlist() function prototype. ndp(8): host_buf should not be used in delete(). host_buf is passed to the argument host of delete() in do_foreach(). Use s6, not mysin. To generate a diff of this commit: cvs rdiff -u -r1.48.6.1 -r1.48.6.2 src/usr.sbin/ndp/ndp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/ndp/ndp.c diff -u src/usr.sbin/ndp/ndp.c:1.48.6.1 src/usr.sbin/ndp/ndp.c:1.48.6.2 --- src/usr.sbin/ndp/ndp.c:1.48.6.1 Fri Jul 7 13:57:26 2017 +++ src/usr.sbin/ndp/ndp.c Fri Jul 13 16:14:23 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ndp.c,v 1.48.6.1 2017/07/07 13:57:26 martin Exp $ */ +/* $NetBSD: ndp.c,v 1.48.6.2 2018/07/13 16:14:23 martin Exp $ */ /* $KAME: ndp.c,v 1.121 2005/07/13 11:30:13 keiichi Exp $ */ /* @@ -134,7 +134,6 @@ static void ifinfo(char *, int, char **) static void rtrlist(void); static void plist(void); static void pfx_flush(void); -static void rtrlist(void); static void rtr_flush(void); static void harmonize_rtr(void); #ifdef SIOCSDEFIFACE_IN6 /* XXX: check SIOCGDEFIFACE_IN6 as well? */ @@ -476,6 +475,7 @@ delete_one(char *host) static int delete(struct rt_msghdr *rtm, char *host) { + char delete_host_buf[NI_MAXHOST]; struct sockaddr_in6 *mysin = _m; struct sockaddr_dl *sdl; @@ -491,13 +491,13 @@ delete(struct rt_msghdr *rtm, char *host if (rtmsg(RTM_DELETE, rtm) == 0) { struct sockaddr_in6 s6 = *mysin; /* XXX: for safety */ - mysin->sin6_scope_id = 0; - inet6_putscopeid(mysin, INET6_IS_ADDR_LINKLOCAL); + s6.sin6_scope_id = 0; + inet6_putscopeid(, INET6_IS_ADDR_LINKLOCAL); (void)getnameinfo((struct sockaddr *)(void *), - (socklen_t)s6.sin6_len, host_buf, - sizeof(host_buf), NULL, 0, + (socklen_t)s6.sin6_len, delete_host_buf, + sizeof(delete_host_buf), NULL, 0, (nflag ? NI_NUMERICHOST : 0)); - (void)printf("%s (%s) deleted\n", host, host_buf); + (void)printf("%s (%s) deleted\n", host, delete_host_buf); } return 0;
CVS commit: [netbsd-8] src/external/gpl3/binutils/dist/bfd
Module Name:src Committed By: martin Date: Fri Jul 13 16:10:46 UTC 2018 Modified Files: src/external/gpl3/binutils/dist/bfd [netbsd-8]: peXXigen.c Log Message: Pull up following revision(s) (requested by christos in ticket #917): external/gpl3/binutils.old/dist/bfd/peXXigen.c: revision 1.6 (with /binutils.old/ -> /binutils/) Fix reproducible builds for EFI boot blocks (from HEAD) To generate a diff of this commit: cvs rdiff -u -r1.1.1.5 -r1.1.1.5.6.1 \ src/external/gpl3/binutils/dist/bfd/peXXigen.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/gpl3/binutils/dist/bfd/peXXigen.c diff -u src/external/gpl3/binutils/dist/bfd/peXXigen.c:1.1.1.5 src/external/gpl3/binutils/dist/bfd/peXXigen.c:1.1.1.5.6.1 --- src/external/gpl3/binutils/dist/bfd/peXXigen.c:1.1.1.5 Wed Oct 26 17:29:42 2016 +++ src/external/gpl3/binutils/dist/bfd/peXXigen.c Fri Jul 13 16:10:46 2018 @@ -879,6 +879,8 @@ _bfd_XXi_only_swap_filehdr_out (bfd * ab /* Only use a real timestamp if the option was chosen. */ if ((pe_data (abfd)->insert_timestamp)) H_PUT_32 (abfd, time (0), filehdr_out->f_timdat); + else +H_PUT_32 (abfd, 0, filehdr_out->f_timdat); PUT_FILEHDR_SYMPTR (abfd, filehdr_in->f_symptr, filehdr_out->f_symptr);
CVS commit: [netbsd-8] src/external/bsd/ppp/usr.sbin/pppd
Module Name:src Committed By: martin Date: Fri Jul 13 16:05:02 UTC 2018 Modified Files: src/external/bsd/ppp/usr.sbin/pppd [netbsd-8]: sys-bsd.c Log Message: Pull up following revision(s) (requested by christos in ticket #916): external/bsd/ppp/usr.sbin/pppd/sys-bsd.c: revision 1.5 New arp code needs RTF_LLDATA for DELETE to work! XXX: pullup-8 To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.4.6.1 src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c diff -u src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c:1.4 src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c:1.4.6.1 --- src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c:1.4 Sat Aug 6 05:58:20 2016 +++ src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c Fri Jul 13 16:05:02 2018 @@ -1679,7 +1679,7 @@ sifproxyarp(int unit, u_int32_t hisaddr) } arpmsg.hdr.rtm_type = RTM_ADD; -arpmsg.hdr.rtm_flags = RTF_ANNOUNCE | RTF_HOST | RTF_STATIC; +arpmsg.hdr.rtm_flags = RTF_ANNOUNCE | RTF_HOST | RTF_STATIC | RTF_LLDATA; arpmsg.hdr.rtm_version = RTM_VERSION; arpmsg.hdr.rtm_seq = ++rtm_seq; arpmsg.hdr.rtm_addrs = RTA_DST | RTA_GATEWAY;
CVS commit: [netbsd-8] src/sys/net
Module Name:src Committed By: martin Date: Fri Jul 13 16:01:12 UTC 2018 Modified Files: src/sys/net [netbsd-8]: if.c Log Message: Pull up following revision(s) (requested by msaitoh in ticket #915): sys/net/if.c: revision 1.424 Print "NET_MPSAFE enabled" if it's enabled. To generate a diff of this commit: cvs rdiff -u -r1.394.2.12 -r1.394.2.13 src/sys/net/if.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net/if.c diff -u src/sys/net/if.c:1.394.2.12 src/sys/net/if.c:1.394.2.13 --- src/sys/net/if.c:1.394.2.12 Fri Jul 13 15:49:55 2018 +++ src/sys/net/if.c Fri Jul 13 16:01:12 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: if.c,v 1.394.2.12 2018/07/13 15:49:55 martin Exp $ */ +/* $NetBSD: if.c,v 1.394.2.13 2018/07/13 16:01:12 martin Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc. @@ -90,7 +90,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.394.2.12 2018/07/13 15:49:55 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.394.2.13 2018/07/13 16:01:12 martin Exp $"); #if defined(_KERNEL_OPT) #include "opt_inet.h" @@ -309,6 +309,11 @@ ifinit(void) void ifinit1(void) { + +#ifdef NET_MPSAFE + printf("NET_MPSAFE enabled\n"); +#endif + mutex_init(_clone_mtx, MUTEX_DEFAULT, IPL_NONE); TAILQ_INIT(_list);
CVS commit: [netbsd-8] src/usr.bin/printf
Module Name:src Committed By: martin Date: Fri Jul 13 15:58:25 UTC 2018 Modified Files: src/usr.bin/printf [netbsd-8]: printf.c Log Message: Pull up following revision(s) (requested by kre in ticket #914): usr.bin/printf/printf.c: revision 1.38,1.39 >From leot@ on tech-userlevel: Avoid running off into oblivion when a format string, or arg to a %b conversion ends in an unescaped backslash. Patch from Leo slightly modified by me. Avoid printing error messages twice when an invalid escape sequence (\ sequence) is present in an arg to a %b conversion. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.37.8.1 src/usr.bin/printf/printf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/printf/printf.c diff -u src/usr.bin/printf/printf.c:1.37 src/usr.bin/printf/printf.c:1.37.8.1 --- src/usr.bin/printf/printf.c:1.37 Tue Jun 16 22:54:10 2015 +++ src/usr.bin/printf/printf.c Fri Jul 13 15:58:25 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: printf.c,v 1.37 2015/06/16 22:54:10 christos Exp $ */ +/* $NetBSD: printf.c,v 1.37.8.1 2018/07/13 15:58:25 martin Exp $ */ /* * Copyright (c) 1989, 1993 @@ -41,7 +41,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19 #if 0 static char sccsid[] = "@(#)printf.c 8.2 (Berkeley) 3/22/95"; #else -__RCSID("$NetBSD: printf.c,v 1.37 2015/06/16 22:54:10 christos Exp $"); +__RCSID("$NetBSD: printf.c,v 1.37.8.1 2018/07/13 15:58:25 martin Exp $"); #endif #endif /* not lint */ @@ -65,8 +65,8 @@ __RCSID("$NetBSD: printf.c,v 1.37 2015/0 #define ESCAPE 033 #endif -static void conv_escape_str(char *, void (*)(int)); -static char *conv_escape(char *, char *); +static void conv_escape_str(char *, void (*)(int), int); +static char *conv_escape(char *, char *, int); static char *conv_expand(const char *); static char getchr(void); static double getdouble(void); @@ -170,7 +170,7 @@ int main(int argc, char *argv[]) for (fmt = format; (ch = *fmt++) != '\0';) { if (ch == '\\') { char c_ch; -fmt = conv_escape(fmt, _ch); +fmt = conv_escape(fmt, _ch, 0); putchar(c_ch); continue; } @@ -241,7 +241,7 @@ int main(int argc, char *argv[]) t = NULL; /* Count number of bytes we want to output */ b_length = 0; -conv_escape_str(cp, b_count); +conv_escape_str(cp, b_count, 0); t = malloc(b_length + 1); if (t == NULL) goto out; @@ -254,7 +254,7 @@ int main(int argc, char *argv[]) goto out; b_fmt = a; /* Output leading spaces and data bytes */ -conv_escape_str(cp, b_output); +conv_escape_str(cp, b_output, 1); /* Add any trailing spaces */ printf("%s", b_fmt); break; @@ -357,7 +357,7 @@ b_output(int ch) * Halts processing string if a \c escape is encountered. */ static void -conv_escape_str(char *str, void (*do_putchar)(int)) +conv_escape_str(char *str, void (*do_putchar)(int), int quiet) { int value; int ch; @@ -415,7 +415,7 @@ conv_escape_str(char *str, void (*do_put } /* Finally test for sequences valid in the format string */ - str = conv_escape(str - 1, ); + str = conv_escape(str - 1, , quiet); do_putchar(c); } } @@ -424,7 +424,7 @@ conv_escape_str(char *str, void (*do_put * Print "standard" escape characters */ static char * -conv_escape(char *str, char *conv_ch) +conv_escape(char *str, char *conv_ch, int quiet) { char value; char ch; @@ -433,6 +433,14 @@ conv_escape(char *str, char *conv_ch) ch = *str++; switch (ch) { + case '\0': + if (!quiet) + warnx("incomplete escape sequence"); + rval = 1; + value = '\\'; + --str; + break; + case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': num_buf[0] = ch; @@ -470,7 +478,8 @@ conv_escape(char *str, char *conv_ch) case 'v': value = '\v'; break; /* vertical-tab */ default: - warnx("unknown escape sequence `\\%c'", ch); + if (!quiet) + warnx("unknown escape sequence `\\%c'", ch); rval = 1; value = ch; break;
CVS commit: [netbsd-8] src/external/bsd/dhcpcd
Module Name:src Committed By: martin Date: Fri Jul 13 15:55:25 UTC 2018 Modified Files: src/external/bsd/dhcpcd [netbsd-8]: Makefile.inc Log Message: Pull up following revision(s) (requested by triaxx in ticket #913): external/bsd/dhcpcd/Makefile.inc: revision 1.3 Fix an inconsistency that showed /var/db/duid in the man page while the binary opened /var/db/dhcpcd/duid. To generate a diff of this commit: cvs rdiff -u -r1.1.8.1 -r1.1.8.2 src/external/bsd/dhcpcd/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/dhcpcd/Makefile.inc diff -u src/external/bsd/dhcpcd/Makefile.inc:1.1.8.1 src/external/bsd/dhcpcd/Makefile.inc:1.1.8.2 --- src/external/bsd/dhcpcd/Makefile.inc:1.1.8.1 Thu Jun 15 05:33:49 2017 +++ src/external/bsd/dhcpcd/Makefile.inc Fri Jul 13 15:55:25 2018 @@ -1,11 +1,11 @@ -# $NetBSD: Makefile.inc,v 1.1.8.1 2017/06/15 05:33:49 snj Exp $ +# $NetBSD: Makefile.inc,v 1.1.8.2 2018/07/13 15:55:25 martin Exp $ SRCDIR= ${NETBSDSRCDIR}/external/bsd/dhcpcd DIST= ${SRCDIR}/dist SED_SYS= -e 's:@SYSCONFDIR@:/etc:g' \ -e 's:@DATADIR@:/usr/share/examples:g' \ - -e 's:@DBDIR@:/var/db:g' \ + -e 's:@DBDIR@:/var/db/dhcpcd:g' \ -e 's:@LIBDIR@:/lib:g' \ -e 's:@RUNDIR@:/var/run:g' \ -e 's:@HOOKDIR@:/libexec/dhcpcd-hooks:g' \
CVS commit: [netbsd-8] src/sys/arch/x86
Module Name:src Committed By: martin Date: Fri Jul 13 15:51:28 UTC 2018 Modified Files: src/sys/arch/x86/include [netbsd-8]: specialreg.h src/sys/arch/x86/x86 [netbsd-8]: identcpu.c Log Message: Pull up following revision(s) (requested by maya in ticket #912): sys/arch/x86/x86/identcpu.c: revision 1.79 sys/arch/x86/include/specialreg.h: revision 1.127 Disable MWAIT/MONITOR on Apollo Lake CPUs to workaround APL30 errata. We use MWAIT/MONITOR to hatch secondary CPUs. The errata means that the wakeup may not happen, so SMP boot fails. Use wrmsr to disable it in hardware too, for extra paranoia. PR port-amd64/53420, also reported on netbsd-users by joern clausen and ssartor. To generate a diff of this commit: cvs rdiff -u -r1.98.2.5 -r1.98.2.6 src/sys/arch/x86/include/specialreg.h cvs rdiff -u -r1.55.2.4 -r1.55.2.5 src/sys/arch/x86/x86/identcpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/include/specialreg.h diff -u src/sys/arch/x86/include/specialreg.h:1.98.2.5 src/sys/arch/x86/include/specialreg.h:1.98.2.6 --- src/sys/arch/x86/include/specialreg.h:1.98.2.5 Sat Jun 9 15:12:21 2018 +++ src/sys/arch/x86/include/specialreg.h Fri Jul 13 15:51:28 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: specialreg.h,v 1.98.2.5 2018/06/09 15:12:21 martin Exp $ */ +/* $NetBSD: specialreg.h,v 1.98.2.6 2018/07/13 15:51:28 martin Exp $ */ /*- * Copyright (c) 1991 The Regents of the University of California. @@ -683,6 +683,7 @@ #define MSR_THERM_STATUS 0x19c #define MSR_THERM2_CTL 0x19d /* Pentium M */ #define MSR_MISC_ENABLE 0x1a0 +#define IA32_MISC_MWAIT_EN 0x4 #define MSR_TEMPERATURE_TARGET 0x1a2 #define MSR_DEBUGCTLMSR 0x1d9 #define MSR_LASTBRANCHFROMIP 0x1db Index: src/sys/arch/x86/x86/identcpu.c diff -u src/sys/arch/x86/x86/identcpu.c:1.55.2.4 src/sys/arch/x86/x86/identcpu.c:1.55.2.5 --- src/sys/arch/x86/x86/identcpu.c:1.55.2.4 Sat Jun 23 11:39:02 2018 +++ src/sys/arch/x86/x86/identcpu.c Fri Jul 13 15:51:28 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: identcpu.c,v 1.55.2.4 2018/06/23 11:39:02 martin Exp $ */ +/* $NetBSD: identcpu.c,v 1.55.2.5 2018/07/13 15:51:28 martin Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.55.2.4 2018/06/23 11:39:02 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.55.2.5 2018/07/13 15:51:28 martin Exp $"); #include "opt_xen.h" @@ -189,6 +189,24 @@ cpu_probe_intel_cache(struct cpu_info *c } static void +cpu_probe_intel_errata(struct cpu_info *ci) +{ + u_int family, model, stepping; + + family = CPUID_TO_FAMILY(ci->ci_signature); + model = CPUID_TO_MODEL(ci->ci_signature); + stepping = CPUID_TO_STEPPING(ci->ci_signature); + + if (family == 0x6 && model == 0x5C && stepping == 0x9) { /* Apollo Lake */ + wrmsr(MSR_MISC_ENABLE, + rdmsr(MSR_MISC_ENABLE) & ~IA32_MISC_MWAIT_EN); + + cpu_feature[1] &= ~CPUID2_MONITOR; + ci->ci_feat_val[1] &= ~CPUID2_MONITOR; + } +} + +static void cpu_probe_intel(struct cpu_info *ci) { @@ -196,6 +214,7 @@ cpu_probe_intel(struct cpu_info *ci) return; cpu_probe_intel_cache(ci); + cpu_probe_intel_errata(ci); } static void
CVS commit: [netbsd-8] src/sys
Module Name:src Committed By: martin Date: Fri Jul 13 15:49:55 UTC 2018 Modified Files: src/sys/kern [netbsd-8]: init_main.c src/sys/net [netbsd-8]: if.c if.h src/sys/rump/net/lib/libnet [netbsd-8]: net_component.c Log Message: Pull up following revision(s) (requested by ozaki-r in ticket #911): sys/kern/init_main.c: revision 1.498 sys/rump/net/lib/libnet/net_component.c: revision 1.10 sys/net/if.h: revision 1.264 sys/net/if.c: revision 1.429 Fix net.inet6.ip6.ifq node doesn't exist The node (and child nodes) is initialized in sysctl_net_pktq_setup, but the call of sysctl_net_pktq_setup is skipped unexpectedly. sysctl_net_pktq_setup is skipped if in6_present is false that indicates the netinet6 component isn't loaded on rump kernels. However the flag is accidentally always false because the flag is turned on in in6_dom_init that is called after if_sysctl_setup on both normal and rump kernels. Fix the issue by moving if_sysctl_setup after in6_dom_init (domaininit on normal kernels). This fix is ad-hoc but good enough for netbsd-8. We should refine the initialization order of network components in the future. Pointed out by hikaru@ To generate a diff of this commit: cvs rdiff -u -r1.490 -r1.490.6.1 src/sys/kern/init_main.c cvs rdiff -u -r1.394.2.11 -r1.394.2.12 src/sys/net/if.c cvs rdiff -u -r1.239.2.6 -r1.239.2.7 src/sys/net/if.h cvs rdiff -u -r1.9 -r1.9.6.1 src/sys/rump/net/lib/libnet/net_component.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/init_main.c diff -u src/sys/kern/init_main.c:1.490 src/sys/kern/init_main.c:1.490.6.1 --- src/sys/kern/init_main.c:1.490 Mon Jan 16 09:28:40 2017 +++ src/sys/kern/init_main.c Fri Jul 13 15:49:55 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: init_main.c,v 1.490 2017/01/16 09:28:40 ryo Exp $ */ +/* $NetBSD: init_main.c,v 1.490.6.1 2018/07/13 15:49:55 martin Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -97,7 +97,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.490 2017/01/16 09:28:40 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.490.6.1 2018/07/13 15:49:55 martin Exp $"); #include "opt_ddb.h" #include "opt_inet.h" @@ -558,6 +558,7 @@ main(void) lltableinit(); #endif domaininit(true); + ifinit_post(); if_attachdomain(); splx(s); Index: src/sys/net/if.c diff -u src/sys/net/if.c:1.394.2.11 src/sys/net/if.c:1.394.2.12 --- src/sys/net/if.c:1.394.2.11 Thu Jun 7 17:50:54 2018 +++ src/sys/net/if.c Fri Jul 13 15:49:55 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: if.c,v 1.394.2.11 2018/06/07 17:50:54 martin Exp $ */ +/* $NetBSD: if.c,v 1.394.2.12 2018/07/13 15:49:55 martin Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc. @@ -90,7 +90,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.394.2.11 2018/06/07 17:50:54 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.394.2.12 2018/07/13 15:49:55 martin Exp $"); #if defined(_KERNEL_OPT) #include "opt_inet.h" @@ -291,8 +291,6 @@ void ifinit(void) { - if_sysctl_setup(NULL); - #if (defined(INET) || defined(INET6)) encapinit(); #endif @@ -330,6 +328,14 @@ ifinit1(void) #endif } +/* XXX must be after domaininit() */ +void +ifinit_post(void) +{ + + if_sysctl_setup(NULL); +} + ifnet_t * if_alloc(u_char type) { Index: src/sys/net/if.h diff -u src/sys/net/if.h:1.239.2.6 src/sys/net/if.h:1.239.2.7 --- src/sys/net/if.h:1.239.2.6 Fri Jul 13 14:26:48 2018 +++ src/sys/net/if.h Fri Jul 13 15:49:55 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: if.h,v 1.239.2.6 2018/07/13 14:26:48 martin Exp $ */ +/* $NetBSD: if.h,v 1.239.2.7 2018/07/13 15:49:55 martin Exp $ */ /*- * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -1088,6 +1088,7 @@ void if_link_state_change_softint(struct void if_up(struct ifnet *); void ifinit(void); void ifinit1(void); +void ifinit_post(void); int ifaddrpref_ioctl(struct socket *, u_long, void *, struct ifnet *); extern int (*ifioctl)(struct socket *, u_long, void *, struct lwp *); int ifioctl_common(struct ifnet *, u_long, void *); Index: src/sys/rump/net/lib/libnet/net_component.c diff -u src/sys/rump/net/lib/libnet/net_component.c:1.9 src/sys/rump/net/lib/libnet/net_component.c:1.9.6.1 --- src/sys/rump/net/lib/libnet/net_component.c:1.9 Thu Feb 16 08:39:10 2017 +++ src/sys/rump/net/lib/libnet/net_component.c Fri Jul 13 15:49:55 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: net_component.c,v 1.9 2017/02/16 08:39:10 knakahara Exp $ */ +/* $NetBSD: net_component.c,v 1.9.6.1 2018/07/13 15:49:55 martin Exp $ */ /* * Copyright (c) 2009 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: net_component.c,v 1.9 2017/02/16 08:39:10 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: net_component.c,v 1.9.6.1 2018/07/13 15:49:55 martin Exp $"); #include #include @@ -65,5
CVS commit: [netbsd-8] src/doc
Module Name:src Committed By: martin Date: Fri Jul 13 14:43:46 UTC 2018 Modified Files: src/doc [netbsd-8]: CHANGES-8.0 Log Message: Tickets #905, #906, #907, #908 To generate a diff of this commit: cvs rdiff -u -r1.1.2.225 -r1.1.2.226 src/doc/CHANGES-8.0 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-8.0 diff -u src/doc/CHANGES-8.0:1.1.2.225 src/doc/CHANGES-8.0:1.1.2.226 --- src/doc/CHANGES-8.0:1.1.2.225 Thu Jul 12 15:26:11 2018 +++ src/doc/CHANGES-8.0 Fri Jul 13 14:43:46 2018 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-8.0,v 1.1.2.225 2018/07/12 15:26:11 martin Exp $ +# $NetBSD: CHANGES-8.0,v 1.1.2.226 2018/07/13 14:43:46 martin Exp $ A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04 until the 8.0 release: @@ -14162,3 +14162,43 @@ lib/libutil/pty.c1.32 Fix stack use after scope in libutil/pty. [kamil, ticket #901] +sys/net/if.h 1.263 (patch) +sys/netinet/igmp.c1.68 (patch) +sys/netinet/in_l2tp.c1.15 (patch) +sys/netinet/ip_encap.c1.69 (patch) +sys/netinet/ip_icmp.c1.172 (patch) +sys/netinet/ip_mroute.c1.160 (patch) +sys/netinet6/in6_l2tp.c1.16 (patch) +sys/netinet6/ip6_mroute.c 1.129 (patch) + + Fix a panic if the system receives l2tpv3 packets before setting up + an l2tp(4) interface. + [knakahara, ticket #905] + +bin/sh/eval.c 1.155 +bin/sh/exec.c 1.52 +bin/sh/exec.h 1.27 +bin/sh/mknodes.sh1.3 +bin/sh/nodes.c.pat1.14 + + Deal with ref after free found by ASAN when a function redefines + itself, or some other function which is still active. + [kre, ticket #906] + +bin/sh/expand.c 1.122 + + Fix matching of character classes [[:xxx:]] in shell patterns + so that '[' is not always considered a member of the class. + [kre, ticket #907] + +usr.bin/calendar/calendars/calendar.birthday 1.27 +usr.bin/calendar/calendars/calendar.christian 1.7 +usr.bin/calendar/calendars/calendar.history 1.35 +usr.bin/calendar/calendars/calendar.holiday 1.28,1.29 +usr.bin/calendar/calendars/calendar.judaic 1.7 +usr.bin/calendar/calendars/calendar.netbsd 1.39 +usr.bin/calendar/calendars/calendar.usholiday 1.8 + + Various calendar fixes and floating holidays. + [jnemeth, ticket #908] +
CVS commit: [netbsd-8] src/usr.bin/calendar/calendars
Module Name:src Committed By: martin Date: Fri Jul 13 14:35:55 UTC 2018 Modified Files: src/usr.bin/calendar/calendars [netbsd-8]: calendar.birthday calendar.christian calendar.history calendar.holiday calendar.judaic calendar.netbsd calendar.usholiday Log Message: Pull up following revision(s) (requested by jnemeth in ticket #908): usr.bin/calendar/calendars/calendar.birthday: revision 1.27 usr.bin/calendar/calendars/calendar.christian: revision 1.7 usr.bin/calendar/calendars/calendar.usholiday: revision 1.8 usr.bin/calendar/calendars/calendar.netbsd: revision 1.39 usr.bin/calendar/calendars/calendar.holiday: revision 1.28 usr.bin/calendar/calendars/calendar.holiday: revision 1.29 usr.bin/calendar/calendars/calendar.judaic: revision 1.7 usr.bin/calendar/calendars/calendar.history: revision 1.35 Only 35 years late. Mention the Sand Creek massacre. Fix a typo. (or, `Emily Dickinson' - the American poet - was born on the same date) Update calendar files for the upcoming NetBSD 8.0 release. I'm assuming that it will be released by August 1, which is two months from now. Thus I used 2018 dates for all holidays between Aug. 1st and Dec. 31st, and 2019 dates for all holidays between Jan. 1st and Jul. 31st. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.26.8.1 \ src/usr.bin/calendar/calendars/calendar.birthday cvs rdiff -u -r1.6 -r1.6.6.1 \ src/usr.bin/calendar/calendars/calendar.christian \ src/usr.bin/calendar/calendars/calendar.judaic cvs rdiff -u -r1.34 -r1.34.8.1 \ src/usr.bin/calendar/calendars/calendar.history cvs rdiff -u -r1.27 -r1.27.6.1 \ src/usr.bin/calendar/calendars/calendar.holiday cvs rdiff -u -r1.38 -r1.38.4.1 src/usr.bin/calendar/calendars/calendar.netbsd cvs rdiff -u -r1.7 -r1.7.6.1 \ src/usr.bin/calendar/calendars/calendar.usholiday Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/calendar/calendars/calendar.birthday diff -u src/usr.bin/calendar/calendars/calendar.birthday:1.26 src/usr.bin/calendar/calendars/calendar.birthday:1.26.8.1 --- src/usr.bin/calendar/calendars/calendar.birthday:1.26 Mon Feb 15 20:58:02 2016 +++ src/usr.bin/calendar/calendars/calendar.birthday Fri Jul 13 14:35:55 2018 @@ -253,7 +253,7 @@ 12/05 Walt (Walter Elias) Disney born in Chicago, 1901 12/08 Horace (Quintus Horatius Flaccus) born in Venosa (Italy), 65 BC 12/08 James (Grover) Thurber born in Columbus, Ohio, 1894 -12/10 Emily Dickenson born, 1830 +12/10 Emily Dickinson born, 1830 12/12 E.G. Robinson born, 1893 12/14 George Washington dies, 1799 12/17 William Safire (Safir) born, 1929 Index: src/usr.bin/calendar/calendars/calendar.christian diff -u src/usr.bin/calendar/calendars/calendar.christian:1.6 src/usr.bin/calendar/calendars/calendar.christian:1.6.6.1 --- src/usr.bin/calendar/calendars/calendar.christian:1.6 Tue Dec 6 04:54:00 2016 +++ src/usr.bin/calendar/calendars/calendar.christian Fri Jul 13 14:35:55 2018 @@ -1,17 +1,17 @@ 01/06* Epiphany -02/28* Shrove Tuesday / Mardi Gras (day before Ash Wednesday) -03/01* Ash Wednesday (First day of Lent) -04/09* Palm Sunday (7 days before Easter) -04/13* Maundy Thursday (3 days before Easter) -04/14* Good Friday (2 days before Easter) -04/16* Easter Sunday -05/21* Rogation Sunday -05/25* Ascension Day (10 days before Pentecost) -06/04* Pentecost (Whitsunday) -06/05* Whitmonday -06/11* Trinity Sunday (7 days after Pentecost) -06/15* Corpus Christi (11 days after Pentecost) +03/05* Shrove Tuesday / Mardi Gras (day before Ash Wednesday) +03/06* Ash Wednesday (First day of Lent) +04/14* Palm Sunday (7 days before Easter) +04/17* Maundy Thursday (3 days before Easter) +04/18* Good Friday (2 days before Easter) +04/20* Easter Sunday +05/26* Rogation Sunday +05/30* Ascension Day (10 days before Pentecost) +06/09* Pentecost (Whitsunday) +06/10* Whitmonday +06/16* Trinity Sunday (7 days after Pentecost) +06/20* Corpus Christi (11 days after Pentecost) 10/18 Feast Day of St. Luke -12/03* First Sunday of Advent (4th Sunday before Christmas) +12/02* First Sunday of Advent (4th Sunday before Christmas) 12/06 St. Nicholas' Day 12/25 Feast of the Nativity (Christmas) Index: src/usr.bin/calendar/calendars/calendar.judaic diff -u src/usr.bin/calendar/calendars/calendar.judaic:1.6 src/usr.bin/calendar/calendars/calendar.judaic:1.6.6.1 --- src/usr.bin/calendar/calendars/calendar.judaic:1.6 Tue Dec 6 04:54:00 2016 +++ src/usr.bin/calendar/calendars/calendar.judaic Fri Jul 13 14:35:55 2018 @@ -1,27 +1,27 @@ -02/11* Tu B'Shvat (Feast of Trees) -03/10* Fast of Esther (Battle of Purim; 1 day before Purim; fast day) -03/11* Purim (Feast of Lots; 30 days before Pesach) -04/10* Pesach (First Day of Passover; sabbatical) -04/11* Pesach (sabbatical) -04/12* Pesach (sabbatical) -04/13* Pesach (Last Day of Passover; 8th day of
CVS commit: [netbsd-8] src/bin/sh
Module Name:src Committed By: martin Date: Fri Jul 13 14:32:01 UTC 2018 Modified Files: src/bin/sh [netbsd-8]: expand.c Log Message: Pull up following revision(s) (requested by kre in ticket #907): bin/sh/expand.c: revision 1.122 When matching a char class ([[:name:]]) in a pattern (for filename expansion, case patterrns, etc) do not force '[' to be a member of every class. Before this fix, try: case [ in [[:alpha:]]) echo Huh\?;; esac XXX pullup-8(Perhaps -7 as well, though that shell version has much more relevant bugs than this one.) This bug is not in -6 as that has no charclass support. To generate a diff of this commit: cvs rdiff -u -r1.110.2.3 -r1.110.2.4 src/bin/sh/expand.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/sh/expand.c diff -u src/bin/sh/expand.c:1.110.2.3 src/bin/sh/expand.c:1.110.2.4 --- src/bin/sh/expand.c:1.110.2.3 Wed Oct 25 06:51:36 2017 +++ src/bin/sh/expand.c Fri Jul 13 14:32:01 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: expand.c,v 1.110.2.3 2017/10/25 06:51:36 snj Exp $ */ +/* $NetBSD: expand.c,v 1.110.2.4 2018/07/13 14:32:01 martin Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)expand.c 8.5 (Berkeley) 5/15/95"; #else -__RCSID("$NetBSD: expand.c,v 1.110.2.3 2017/10/25 06:51:36 snj Exp $"); +__RCSID("$NetBSD: expand.c,v 1.110.2.4 2018/07/13 14:32:01 martin Exp $"); #endif #endif /* not lint */ @@ -1774,8 +1774,10 @@ patmatch(const char *pattern, const char } if (c == '[' && *p == ':') { found |= match_charclass(p, chr, ); - if (end != NULL) + if (end != NULL) { p = end; + continue; + } } if (c == CTLESC) c = *p++;
CVS commit: [netbsd-8] src/bin/sh
Module Name:src Committed By: martin Date: Fri Jul 13 14:29:15 UTC 2018 Modified Files: src/bin/sh [netbsd-8]: eval.c exec.c exec.h mknodes.sh nodes.c.pat Log Message: Pull up following revision(s) (requested by kre in ticket #906): bin/sh/eval.c: revision 1.155 bin/sh/mknodes.sh: revision 1.3 bin/sh/nodes.c.pat: revision 1.14 bin/sh/exec.h: revision 1.27 bin/sh/exec.c: revision 1.52 Deal with ref after free found by ASAN when a function redefines itself, or some other function which is still active. This was a long known bug (fixed ages ago in the FreeBSD sh) which hadn't been fixed as in practice, the situation that causes the problem simply doesn't arise .. ASAN found it in the sh dotcmd tests which do have this odd "feature" in the way they are written (but where it never caused a problem, as the tests are so simple that no mem is ever allocated between when the old version of the function was deleted, and when it finished executing, so its code all remained intact, despite having been freed.) The fix is taken from the FreeBSD sh. XXX -- pullup-8 (after a while to ensure no other problems arise). To generate a diff of this commit: cvs rdiff -u -r1.140.2.2 -r1.140.2.3 src/bin/sh/eval.c cvs rdiff -u -r1.47.2.2 -r1.47.2.3 src/bin/sh/exec.c cvs rdiff -u -r1.24.8.2 -r1.24.8.3 src/bin/sh/exec.h cvs rdiff -u -r1.2 -r1.2.56.1 src/bin/sh/mknodes.sh cvs rdiff -u -r1.13 -r1.13.26.1 src/bin/sh/nodes.c.pat Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/sh/eval.c diff -u src/bin/sh/eval.c:1.140.2.2 src/bin/sh/eval.c:1.140.2.3 --- src/bin/sh/eval.c:1.140.2.2 Sun Jul 23 14:58:14 2017 +++ src/bin/sh/eval.c Fri Jul 13 14:29:15 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: eval.c,v 1.140.2.2 2017/07/23 14:58:14 snj Exp $ */ +/* $NetBSD: eval.c,v 1.140.2.3 2018/07/13 14:29:15 martin Exp $ */ /*- * Copyright (c) 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)eval.c 8.9 (Berkeley) 6/8/95"; #else -__RCSID("$NetBSD: eval.c,v 1.140.2.2 2017/07/23 14:58:14 snj Exp $"); +__RCSID("$NetBSD: eval.c,v 1.140.2.3 2018/07/13 14:29:15 martin Exp $"); #endif #endif /* not lint */ @@ -1067,6 +1067,7 @@ evalcommand(union node *cmd, int flgs, s INTOFF; savelocalvars = localvars; localvars = NULL; + reffunc(cmdentry.u.func); INTON; if (setjmp(jmploc.loc)) { if (exception == EXSHELLPROC) { @@ -1076,6 +1077,7 @@ evalcommand(union node *cmd, int flgs, s freeparam(); shellparam = saveparam; } + unreffunc(cmdentry.u.func); poplocalvars(); localvars = savelocalvars; funclinebase = savefuncline; @@ -1094,8 +1096,8 @@ evalcommand(union node *cmd, int flgs, s VTRACE(DBG_EVAL, ("function: node: %d '%s' # %d%s; funclinebase=%d\n", - cmdentry.u.func->type, - NODETYPENAME(cmdentry.u.func->type), + getfuncnode(cmdentry.u.func)->type, + NODETYPENAME(getfuncnode(cmdentry.u.func)->type), cmdentry.lineno, cmdentry.lno_frel?" (=1)":"", funclinebase)); } @@ -1103,9 +1105,10 @@ evalcommand(union node *cmd, int flgs, s /* stop shell blowing its stack */ if (++funcnest > 1000) error("too many nested function calls"); - evaltree(cmdentry.u.func, flags & EV_TESTED); + evaltree(getfuncnode(cmdentry.u.func), flags & EV_TESTED); funcnest--; INTOFF; + unreffunc(cmdentry.u.func); poplocalvars(); localvars = savelocalvars; funclinebase = savefuncline; Index: src/bin/sh/exec.c diff -u src/bin/sh/exec.c:1.47.2.2 src/bin/sh/exec.c:1.47.2.3 --- src/bin/sh/exec.c:1.47.2.2 Sun Jul 23 14:58:14 2017 +++ src/bin/sh/exec.c Fri Jul 13 14:29:15 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: exec.c,v 1.47.2.2 2017/07/23 14:58:14 snj Exp $ */ +/* $NetBSD: exec.c,v 1.47.2.3 2018/07/13 14:29:15 martin Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)exec.c 8.4 (Berkeley) 6/8/95"; #else -__RCSID("$NetBSD: exec.c,v 1.47.2.2 2017/07/23 14:58:14 snj Exp $"); +__RCSID("$NetBSD: exec.c,v 1.47.2.3 2018/07/13 14:29:15 martin Exp $"); #endif #endif /* not lint */ @@ -481,8 +481,9 @@ printentry(struct tblentry *cmdp, int ve out1fmt("%s", cmdp->cmdname); if (verbose) { struct procstat ps; + INTOFF; - commandtext(, cmdp->param.func); + commandtext(, getfuncnode(cmdp->param.func)); INTON; out1str("() { "); out1str(ps.cmd); @@ -989,9 +990,8 @@ addcmdentry(char *name, struct cmdentry INTOFF; cmdp = cmdlookup(name, 1); if (cmdp->cmdtype != CMDSPLBLTIN) { - if (cmdp->cmdtype == CMDFUNCTION) { - freefunc(cmdp->param.func); - } + if (cmdp->cmdtype == CMDFUNCTION) + unreffunc(cmdp->param.func); cmdp->cmdtype = entry->cmdtype; cmdp->lineno = entry->lineno; cmdp->fn_ln1 = entry->lno_frel; @@ -1031,7 +1031,7 @@ unsetfunc(char *name) if ((cmdp = cmdlookup(name, 0)) != NULL && cmdp->cmdtype ==
CVS commit: [netbsd-8] src/sys
Module Name:src Committed By: martin Date: Fri Jul 13 14:26:48 UTC 2018 Modified Files: src/sys/net [netbsd-8]: if.h src/sys/netinet [netbsd-8]: igmp.c in_l2tp.c ip_encap.c ip_icmp.c ip_mroute.c src/sys/netinet6 [netbsd-8]: in6_l2tp.c ip6_mroute.c Log Message: Pull up following revision(s) via patch (requested by knakahara in ticket #905): sys/netinet/ip_mroute.c: revision 1.160 sys/netinet6/in6_l2tp.c: revision 1.16 sys/net/if.h: revision 1.263 sys/netinet/in_l2tp.c: revision 1.15 sys/netinet/ip_icmp.c: revision 1.172 sys/netinet/igmp.c: revision 1.68 sys/netinet/ip_encap.c: revision 1.69 sys/netinet6/ip6_mroute.c: revision 1.129 sbappendaddr() is required any lock. Currently, softnet_lock is appropriate. When rip_input() is called as inetsw[].pr_input, rip_iput() is always called with holding softnet_lock, that is, in case of !defined(NET_MPSAFE) it is acquired in ipintr(), otherwise(defined(NET_MPSAFE)) it is acquire in PR_WRAP_INPUT macro. However, some function calls rip_input() directly without holding softnet_lock. That causes assertion failure in sbappendaddr(). rip6_input() and icmp6_rip6_input() are also required softnet_lock for the same reason. To generate a diff of this commit: cvs rdiff -u -r1.239.2.5 -r1.239.2.6 src/sys/net/if.h cvs rdiff -u -r1.64.6.1 -r1.64.6.2 src/sys/netinet/igmp.c cvs rdiff -u -r1.2.8.5 -r1.2.8.6 src/sys/netinet/in_l2tp.c cvs rdiff -u -r1.65.2.2 -r1.65.2.3 src/sys/netinet/ip_encap.c cvs rdiff -u -r1.161.6.2 -r1.161.6.3 src/sys/netinet/ip_icmp.c cvs rdiff -u -r1.146.6.3 -r1.146.6.4 src/sys/netinet/ip_mroute.c cvs rdiff -u -r1.5.8.5 -r1.5.8.6 src/sys/netinet6/in6_l2tp.c cvs rdiff -u -r1.119.6.2 -r1.119.6.3 src/sys/netinet6/ip6_mroute.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net/if.h diff -u src/sys/net/if.h:1.239.2.5 src/sys/net/if.h:1.239.2.6 --- src/sys/net/if.h:1.239.2.5 Sat Apr 14 10:16:19 2018 +++ src/sys/net/if.h Fri Jul 13 14:26:48 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: if.h,v 1.239.2.5 2018/04/14 10:16:19 martin Exp $ */ +/* $NetBSD: if.h,v 1.239.2.6 2018/07/13 14:26:48 martin Exp $ */ /*- * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -534,6 +534,11 @@ if_is_link_state_changeable(struct ifnet #define SOFTNET_LOCK_UNLESS_NET_MPSAFE() do { } while (0) #define SOFTNET_UNLOCK_UNLESS_NET_MPSAFE() do { } while (0) +#define SOFTNET_LOCK_IF_NET_MPSAFE() \ + do { mutex_enter(softnet_lock); } while (0) +#define SOFTNET_UNLOCK_IF_NET_MPSAFE() \ + do { mutex_exit(softnet_lock); } while (0) + #else /* NET_MPSAFE */ #define KERNEL_LOCK_UNLESS_NET_MPSAFE() \ @@ -546,6 +551,9 @@ if_is_link_state_changeable(struct ifnet #define SOFTNET_UNLOCK_UNLESS_NET_MPSAFE()\ do { mutex_exit(softnet_lock); } while (0) +#define SOFTNET_LOCK_IF_NET_MPSAFE() do { } while (0) +#define SOFTNET_UNLOCK_IF_NET_MPSAFE() do { } while (0) + #endif /* NET_MPSAFE */ #define SOFTNET_KERNEL_LOCK_UNLESS_NET_MPSAFE()\ Index: src/sys/netinet/igmp.c diff -u src/sys/netinet/igmp.c:1.64.6.1 src/sys/netinet/igmp.c:1.64.6.2 --- src/sys/netinet/igmp.c:1.64.6.1 Tue Jan 2 10:20:34 2018 +++ src/sys/netinet/igmp.c Fri Jul 13 14:26:47 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: igmp.c,v 1.64.6.1 2018/01/02 10:20:34 snj Exp $ */ +/* $NetBSD: igmp.c,v 1.64.6.2 2018/07/13 14:26:47 martin Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: igmp.c,v 1.64.6.1 2018/01/02 10:20:34 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: igmp.c,v 1.64.6.2 2018/07/13 14:26:47 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_mrouting.h" @@ -474,6 +474,11 @@ igmp_input(struct mbuf *m, ...) * Pass all valid IGMP packets up to any process(es) listening * on a raw IGMP socket. */ + /* + * Currently, igmp_input() is always called holding softnet_lock + * by ipintr()(!NET_MPSAFE) or PR_INPUT_WRAP()(NET_MPSAFE). + */ + KASSERT(mutex_owned(softnet_lock)); rip_input(m, iphlen, proto); return; Index: src/sys/netinet/in_l2tp.c diff -u src/sys/netinet/in_l2tp.c:1.2.8.5 src/sys/netinet/in_l2tp.c:1.2.8.6 --- src/sys/netinet/in_l2tp.c:1.2.8.5 Thu May 17 14:07:03 2018 +++ src/sys/netinet/in_l2tp.c Fri Jul 13 14:26:47 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: in_l2tp.c,v 1.2.8.5 2018/05/17 14:07:03 martin Exp $ */ +/* $NetBSD: in_l2tp.c,v 1.2.8.6 2018/07/13 14:26:47 martin Exp $ */ /* * Copyright (c) 2017 Internet Initiative Japan Inc. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: in_l2tp.c,v 1.2.8.5 2018/05/17 14:07:03 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in_l2tp.c,v 1.2.8.6 2018/07/13 14:26:47 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_l2tp.h" @@ -42,6 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: in_l2tp.c,v #include #include #include +#include
CVS commit: src/sys/arch/amd64/include
Module Name:src Committed By: martin Date: Fri Jul 13 14:11:02 UTC 2018 Modified Files: src/sys/arch/amd64/include: frameasm.h Log Message: Provide empty SVS_ENTER_NMI/SVS_LEAVE_NMI for kernels w/o options SVS To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/sys/arch/amd64/include/frameasm.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/include/frameasm.h diff -u src/sys/arch/amd64/include/frameasm.h:1.39 src/sys/arch/amd64/include/frameasm.h:1.40 --- src/sys/arch/amd64/include/frameasm.h:1.39 Thu Jul 12 19:48:16 2018 +++ src/sys/arch/amd64/include/frameasm.h Fri Jul 13 14:11:02 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: frameasm.h,v 1.39 2018/07/12 19:48:16 maxv Exp $ */ +/* $NetBSD: frameasm.h,v 1.40 2018/07/13 14:11:02 martin Exp $ */ #ifndef _AMD64_MACHINE_FRAMEASM_H #define _AMD64_MACHINE_FRAMEASM_H @@ -185,7 +185,9 @@ #else #define SVS_ENTER /* nothing */ +#define SVS_ENTER_NMI /* nothing */ #define SVS_LEAVE /* nothing */ +#define SVS_LEAVE_NMI /* nothing */ #define SVS_ENTER_ALTSTACK /* nothing */ #define SVS_LEAVE_ALTSTACK /* nothing */ #endif
CVS commit: src/usr.sbin/tprof
Module Name:src Committed By: maxv Date: Fri Jul 13 12:04:50 UTC 2018 Modified Files: src/usr.sbin/tprof: tprof.8 tprof.c tprof_analyze.c Log Message: Ask for a file path with the "analyze" command, instead of reading stdin. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/tprof/tprof.8 cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/tprof/tprof.c cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/tprof/tprof_analyze.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/tprof/tprof.8 diff -u src/usr.sbin/tprof/tprof.8:1.7 src/usr.sbin/tprof/tprof.8:1.8 --- src/usr.sbin/tprof/tprof.8:1.7 Fri Jul 13 11:14:14 2018 +++ src/usr.sbin/tprof/tprof.8 Fri Jul 13 12:04:50 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: tprof.8,v 1.7 2018/07/13 11:14:14 maxv Exp $ +.\" $NetBSD: tprof.8,v 1.8 2018/07/13 12:04:50 maxv Exp $ .\" .\" Copyright (c)2011 YAMAMOTO Takashi, .\" All rights reserved. @@ -90,11 +90,13 @@ The default is .Op Fl P .Op Fl p Ar pid .Op Fl s +.Ar file .Xc Analyze the samples produced by a previous run of .Nm tprof , -and generate a plain text -representation. +stored in +.Ar file , +and generate a plain text representation of them. .It Fl C Don't distinguish CPUs. All samples are treated as its CPU number is 0. @@ -119,7 +121,7 @@ The following command profiles the syste samples into the file myfile.out. .Dl # tprof monitor -e llc-misses:k -o myfile.out sleep 20 The following command displays the results of the sampling. -.Dl # tprof analyze < myfile.out +.Dl # tprof analyze myfile.out .Ed .Sh DIAGNOSTICS The Index: src/usr.sbin/tprof/tprof.c diff -u src/usr.sbin/tprof/tprof.c:1.8 src/usr.sbin/tprof/tprof.c:1.9 --- src/usr.sbin/tprof/tprof.c:1.8 Fri Jul 13 11:03:36 2018 +++ src/usr.sbin/tprof/tprof.c Fri Jul 13 12:04:50 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: tprof.c,v 1.8 2018/07/13 11:03:36 maxv Exp $ */ +/* $NetBSD: tprof.c,v 1.9 2018/07/13 12:04:50 maxv Exp $ */ /* * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ #include #ifndef lint -__RCSID("$NetBSD: tprof.c,v 1.8 2018/07/13 11:03:36 maxv Exp $"); +__RCSID("$NetBSD: tprof.c,v 1.9 2018/07/13 12:04:50 maxv Exp $"); #endif /* not lint */ #include @@ -109,8 +109,8 @@ usage(void) fprintf(stderr, "\tmonitor -e name:option [-o outfile] command\n"); fprintf(stderr, "\t\tMonitor the event 'name' with option 'option'\n" "\t\tcounted during the execution of 'command'.\n"); - fprintf(stderr, "\tanalyze [-C] [-k] [-L] [-P] [-p pid] [-s]\n"); - fprintf(stderr, "\t\tAnalyze the samples from stdin.\n"); + fprintf(stderr, "\tanalyze [-C] [-k] [-L] [-P] [-p pid] [-s] file\n"); + fprintf(stderr, "\t\tAnalyze the samples of the file 'file'.\n"); exit(EXIT_FAILURE); } @@ -298,4 +298,7 @@ main(int argc, char *argv[]) break; } } + if (ct->label == NULL) { + usage(); + } } Index: src/usr.sbin/tprof/tprof_analyze.c diff -u src/usr.sbin/tprof/tprof_analyze.c:1.1 src/usr.sbin/tprof/tprof_analyze.c:1.2 --- src/usr.sbin/tprof/tprof_analyze.c:1.1 Fri Jul 13 11:03:36 2018 +++ src/usr.sbin/tprof/tprof_analyze.c Fri Jul 13 12:04:50 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: tprof_analyze.c,v 1.1 2018/07/13 11:03:36 maxv Exp $ */ +/* $NetBSD: tprof_analyze.c,v 1.2 2018/07/13 12:04:50 maxv Exp $ */ /* * Copyright (c) 2010,2011,2012 YAMAMOTO Takashi, @@ -28,7 +28,7 @@ #include #ifndef lint -__RCSID("$NetBSD: tprof_analyze.c,v 1.1 2018/07/13 11:03:36 maxv Exp $"); +__RCSID("$NetBSD: tprof_analyze.c,v 1.2 2018/07/13 12:04:50 maxv Exp $"); #endif /* not lint */ #include @@ -283,6 +283,7 @@ tprof_analyze(int argc, char **argv) bool kernel_only = false; extern char *optarg; extern int optind; + FILE *f; while ((ch = getopt(argc, argv, "CkLPp:s")) != -1) { uintmax_t val; @@ -321,6 +322,15 @@ tprof_analyze(int argc, char **argv) argc -= optind; argv += optind; + if (argc == 0) { + errx(EXIT_FAILURE, "missing file name"); + } + + f = fopen(argv[0], "rb"); + if (f == NULL) { + errx(EXIT_FAILURE, "fopen"); + } + ksymload(); rb_tree_init(, _ops); @@ -332,14 +342,14 @@ tprof_analyze(int argc, char **argv) while (/*CONSTCOND*/true) { struct addr *o; tprof_sample_t sample; - size_t n = fread(, sizeof(sample), 1, stdin); + size_t n = fread(, sizeof(sample), 1, f); bool in_kernel; if (n == 0) { - if (feof(stdin)) { + if (feof(f)) { break; } - if (ferror(stdin)) { + if (ferror(f)) { err(EXIT_FAILURE, "fread"); } } @@ -434,4 +444,6 @@ tprof_analyze(int argc, char **argv) a->nsamples, a->pid, a->lwpid, a->cpuid, a->in_kernel, a->addr, name); } + + fclose(f); }
CVS commit: src
Module Name:src Committed By: maxv Date: Fri Jul 13 11:14:14 UTC 2018 Modified Files: src/distrib/sets/lists/base: mi src/distrib/sets/lists/debug: mi src/distrib/sets/lists/man: mi src/usr.bin: Makefile src/usr.sbin/tprof: tprof.8 Removed Files: src/usr.bin/tpfmt: Makefile README sym.c sym.h tpfmt.1 tpfmt.c Log Message: Remove tpfmt(1). Its code was merged into tprof(8). To generate a diff of this commit: cvs rdiff -u -r1.1178 -r1.1179 src/distrib/sets/lists/base/mi cvs rdiff -u -r1.256 -r1.257 src/distrib/sets/lists/debug/mi cvs rdiff -u -r1.1597 -r1.1598 src/distrib/sets/lists/man/mi cvs rdiff -u -r1.230 -r1.231 src/usr.bin/Makefile cvs rdiff -u -r1.4 -r0 src/usr.bin/tpfmt/Makefile src/usr.bin/tpfmt/sym.c cvs rdiff -u -r1.1 -r0 src/usr.bin/tpfmt/README cvs rdiff -u -r1.2 -r0 src/usr.bin/tpfmt/sym.h cvs rdiff -u -r1.3 -r0 src/usr.bin/tpfmt/tpfmt.1 cvs rdiff -u -r1.5 -r0 src/usr.bin/tpfmt/tpfmt.c cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/tprof/tprof.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/base/mi diff -u src/distrib/sets/lists/base/mi:1.1178 src/distrib/sets/lists/base/mi:1.1179 --- src/distrib/sets/lists/base/mi:1.1178 Fri Jun 29 12:34:14 2018 +++ src/distrib/sets/lists/base/mi Fri Jul 13 11:14:14 2018 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1178 2018/06/29 12:34:14 roy Exp $ +# $NetBSD: mi,v 1.1179 2018/07/13 11:14:14 maxv Exp $ # # Note: Don't delete entries from here - mark them as "obsolete" instead, # unless otherwise stated below. @@ -974,7 +974,7 @@ ./usr/bin/tn3270base-obsolete obsolete ./usr/bin/top base-util-bin ./usr/bin/touch base-util-bin -./usr/bin/tpfmt base-util-bin +./usr/bin/tpfmt base-obsolete obsolete ./usr/bin/tpm_sealdatabase-tpm-bin tpm ./usr/bin/tpm_unsealdata base-tpm-bin tpm ./usr/bin/tpm_versionbase-tpm-bin tpm Index: src/distrib/sets/lists/debug/mi diff -u src/distrib/sets/lists/debug/mi:1.256 src/distrib/sets/lists/debug/mi:1.257 --- src/distrib/sets/lists/debug/mi:1.256 Fri Jun 29 12:34:14 2018 +++ src/distrib/sets/lists/debug/mi Fri Jul 13 11:14:14 2018 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.256 2018/06/29 12:34:14 roy Exp $ +# $NetBSD: mi,v 1.257 2018/07/13 11:14:14 maxv Exp $ ./etc/mtree/set.debug comp-sys-root ./usr/lib comp-sys-usr compatdir ./usr/lib/i18n/libBIG5_g.a comp-c-debuglib debuglib,compatfile @@ -803,7 +803,7 @@ ./usr/libdata/debug/usr/bin/tn3270.debug comp-obsolete obsolete ./usr/libdata/debug/usr/bin/top.debug comp-util-debug debug ./usr/libdata/debug/usr/bin/touch.debug comp-util-debug debug -./usr/libdata/debug/usr/bin/tpfmt.debug comp-util-debug debug +./usr/libdata/debug/usr/bin/tpfmt.debug comp-obsolete obsolete ./usr/libdata/debug/usr/bin/tpm_sealdata.debug comp-tpm-debug tpm,debug ./usr/libdata/debug/usr/bin/tpm_unsealdata.debug comp-tpm-debug tpm,debug ./usr/libdata/debug/usr/bin/tpm_version.debug comp-tpm-debug tpm,debug Index: src/distrib/sets/lists/man/mi diff -u src/distrib/sets/lists/man/mi:1.1597 src/distrib/sets/lists/man/mi:1.1598 --- src/distrib/sets/lists/man/mi:1.1597 Fri Jul 13 09:15:56 2018 +++ src/distrib/sets/lists/man/mi Fri Jul 13 11:14:14 2018 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1597 2018/07/13 09:15:56 maxv Exp $ +# $NetBSD: mi,v 1.1598 2018/07/13 11:14:14 maxv Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -573,7 +573,7 @@ ./usr/share/man/cat1/tn3270.0 man-obsolete obsolete ./usr/share/man/cat1/top.0 man-util-catman .cat ./usr/share/man/cat1/touch.0 man-util-catman .cat -./usr/share/man/cat1/tpfmt.0 man-util-catman .cat +./usr/share/man/cat1/tpfmt.0 man-obsolete obsolete ./usr/share/man/cat1/tpm_sealdata.0 man-tpm-catman tpm,.cat ./usr/share/man/cat1/tpm_version.0 man-tpm-catman tpm,.cat ./usr/share/man/cat1/tput.0 man-util-catman .cat @@ -3777,7 +3777,7 @@ ./usr/share/man/html1/tn3270.html man-obsolete obsolete ./usr/share/man/html1/top.html man-util-htmlman html ./usr/share/man/html1/touch.html man-util-htmlman html -./usr/share/man/html1/tpfmt.html man-util-htmlman html +./usr/share/man/html1/tpfmt.html man-obsolete obsolete ./usr/share/man/html1/tpm_sealdata.html man-tpm-htmlman tpm,html ./usr/share/man/html1/tpm_version.html man-tpm-htmlman tpm,html ./usr/share/man/html1/tput.html man-util-htmlman html @@ -6635,7 +6635,7 @@ ./usr/share/man/man1/tn3270.1 man-obsolete obsolete ./usr/share/man/man1/top.1 man-util-man .man ./usr/share/man/man1/touch.1 man-util-man .man -./usr/share/man/man1/tpfmt.1 man-util-man .man +./usr/share/man/man1/tpfmt.1 man-obsolete obsolete ./usr/share/man/man1/tpm_sealdata.1 man-tpm-man tpm,.man ./usr/share/man/man1/tpm_version.1 man-tpm-man tpm,.man ./usr/share/man/man1/tput.1 man-util-man .man Index:
CVS commit: src/usr.bin
Module Name:src Committed By: mrg Date: Fri Jul 13 11:13:10 UTC 2018 Modified Files: src/usr.bin: Makefile Log Message: don't try to decend into remove 'pmc' subdir. To generate a diff of this commit: cvs rdiff -u -r1.229 -r1.230 src/usr.bin/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/Makefile diff -u src/usr.bin/Makefile:1.229 src/usr.bin/Makefile:1.230 --- src/usr.bin/Makefile:1.229 Sun May 21 15:28:42 2017 +++ src/usr.bin/Makefile Fri Jul 13 11:13:10 2018 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.229 2017/05/21 15:28:42 riastradh Exp $ +# $NetBSD: Makefile,v 1.230 2018/07/13 11:13:10 mrg Exp $ # from: @(#)Makefile 8.3 (Berkeley) 1/7/94 .include @@ -20,7 +20,7 @@ SUBDIR= apply asa at audio audiocfg \ mkcsmapper mkdep mkesdb mkfifo mklocale mkstr mktemp mkubootimage \ moduli msgc msgs \ nbperf nc netgroup netstat newgrp newsyslog nfsstat nice nl nohup \ - pagesize passwd paste patch pathchk pkill pmap pmc pr \ + pagesize passwd paste patch pathchk pkill pmap pr \ printenv printf progress pwait pwhash qsubst quota radioctl rdist \ renice rev revoke rfcomm_sppd rlogin rpcgen rpcinfo rs rsh \ rup ruptime rusers rwall rwho \
CVS commit: src/usr.sbin/tprof
Module Name:src Committed By: maxv Date: Fri Jul 13 11:03:36 UTC 2018 Modified Files: src/usr.sbin/tprof: Makefile tprof.8 tprof.c tprof.h Added Files: src/usr.sbin/tprof: tprof_analyze.c Log Message: Merge tpfmt(1) into tprof(8). We want to have access to everything with only one tool. The code is copied mostly as-is, and the functionality is available via the "analyze" command. Eg: tprof monitor -e llc-misses:k -o myfile.out sleep 20 tprof analyze < myfile.out Will move soon, I don't like the reading via stdin. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/tprof/Makefile cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/tprof/tprof.8 cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/tprof/tprof.c cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/tprof/tprof.h cvs rdiff -u -r0 -r1.1 src/usr.sbin/tprof/tprof_analyze.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/tprof/Makefile diff -u src/usr.sbin/tprof/Makefile:1.4 src/usr.sbin/tprof/Makefile:1.5 --- src/usr.sbin/tprof/Makefile:1.4 Fri Jul 13 07:56:29 2018 +++ src/usr.sbin/tprof/Makefile Fri Jul 13 11:03:36 2018 @@ -1,10 +1,10 @@ -# $NetBSD: Makefile,v 1.4 2018/07/13 07:56:29 maxv Exp $ +# $NetBSD: Makefile,v 1.5 2018/07/13 11:03:36 maxv Exp $ .PATH: ${.CURDIR}/arch PROG= tprof MAN= tprof.8 -SRCS= tprof.c +SRCS= tprof.c tprof_analyze.c .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64" SRCS+= tprof_x86.c @@ -15,7 +15,11 @@ SRCS+= tprof_noarch.c CPPFLAGS+= -I${NETBSDSRCDIR}/sys/ LDADD+= -lpthread +LDADD+= -lelf +LDADD+= -lutil DPADD+= ${LIBPTHREAD} +DPADD+= ${LIBELF} +DPADD+= ${LIBUTIL} .include .include Index: src/usr.sbin/tprof/tprof.8 diff -u src/usr.sbin/tprof/tprof.8:1.5 src/usr.sbin/tprof/tprof.8:1.6 --- src/usr.sbin/tprof/tprof.8:1.5 Fri Jul 13 09:04:31 2018 +++ src/usr.sbin/tprof/tprof.8 Fri Jul 13 11:03:36 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: tprof.8,v 1.5 2018/07/13 09:04:31 maxv Exp $ +.\" $NetBSD: tprof.8,v 1.6 2018/07/13 11:03:36 maxv Exp $ .\" .\" Copyright (c)2011 YAMAMOTO Takashi, .\" All rights reserved. @@ -83,11 +83,43 @@ The collected samples are written into t if specified. The default is .Dq Pa tprof.out . +.It analyze Xo +.Op Fl C +.Op Fl k +.Op Fl L +.Op Fl P +.Op Fl p Ar pid +.Op Fl s +.Xc +Analyze the samples produced by a previous run of +.Nm tprof , +and generate a plain text +representation. +.It Fl C +Don't distinguish CPUs. +All samples are treated as its CPU number is 0. +.It Fl k +Kernel only. +Ignore samples for userland code. +.It Fl L +Don't distinguish LWPs. +All samples are treated as its LWP ID is 0. +.It Fl P +Don't distinguish processes. +All samples are treated as its PID is 0. +.It Fl p Ar pid +Process only samples for the process with PID +.Ar pid +and ignore the rest. +.It Fl s +Per symbol. .El .Sh EXAMPLES The following command profiles the system during 20 seconds and writes the samples into the file myfile.out. .Dl # tprof monitor -e llc-misses:k -o myfile.out sleep 20 +The following command displays the results of the sampling. +.Dl # tprof analyze < myfile.out .Ed .Sh DIAGNOSTICS The Index: src/usr.sbin/tprof/tprof.c diff -u src/usr.sbin/tprof/tprof.c:1.7 src/usr.sbin/tprof/tprof.c:1.8 --- src/usr.sbin/tprof/tprof.c:1.7 Fri Jul 13 09:04:31 2018 +++ src/usr.sbin/tprof/tprof.c Fri Jul 13 11:03:36 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: tprof.c,v 1.7 2018/07/13 09:04:31 maxv Exp $ */ +/* $NetBSD: tprof.c,v 1.8 2018/07/13 11:03:36 maxv Exp $ */ /* * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ #include #ifndef lint -__RCSID("$NetBSD: tprof.c,v 1.7 2018/07/13 09:04:31 maxv Exp $"); +__RCSID("$NetBSD: tprof.c,v 1.8 2018/07/13 11:03:36 maxv Exp $"); #endif /* not lint */ #include @@ -94,6 +94,7 @@ static struct cmdtab { } const tprof_cmdtab[] = { { "list", false, false, tprof_list }, { "monitor", true, false, tprof_monitor }, + { "analyze", true, true, tprof_analyze }, { NULL, false, false, NULL }, }; @@ -101,13 +102,15 @@ __dead static void usage(void) { - fprintf(stderr, "%s [op] [options] [command]\n", getprogname()); + fprintf(stderr, "%s op [arguments]\n", getprogname()); fprintf(stderr, "\n"); fprintf(stderr, "\tlist\n"); fprintf(stderr, "\t\tList the available events.\n"); fprintf(stderr, "\tmonitor -e name:option [-o outfile] command\n"); fprintf(stderr, "\t\tMonitor the event 'name' with option 'option'\n" "\t\tcounted during the execution of 'command'.\n"); + fprintf(stderr, "\tanalyze [-C] [-k] [-L] [-P] [-p pid] [-s]\n"); + fprintf(stderr, "\t\tAnalyze the samples from stdin.\n"); exit(EXIT_FAILURE); } Index: src/usr.sbin/tprof/tprof.h diff -u src/usr.sbin/tprof/tprof.h:1.1 src/usr.sbin/tprof/tprof.h:1.2 --- src/usr.sbin/tprof/tprof.h:1.1 Fri Jul 13 07:56:29 2018 +++ src/usr.sbin/tprof/tprof.h Fri Jul 13 11:03:36 2018 @@ -1,4 +1,4 @@ -/*
CVS commit: src/external/gpl3
Module Name:src Committed By: maya Date: Fri Jul 13 10:49:17 UTC 2018 Modified Files: src/external/gpl3/binutils.old/dist/bfd: elf.c src/external/gpl3/binutils/dist/bfd: elf.c Log Message: stopgap fix: revert bfd PT_PHDR without PT_INTERP changes. This currently results in most binaries being broken. Give more time to debug without -current being badly broken. The reverted commit message was: PT_PHDR is useful without PT_INTERP, i.e. for static PIE. It removes the need for platform-specific computations of _DYNAMIC and friends. ok martin, mrg To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/external/gpl3/binutils.old/dist/bfd/elf.c cvs rdiff -u -r1.10 -r1.11 src/external/gpl3/binutils/dist/bfd/elf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/gpl3/binutils.old/dist/bfd/elf.c diff -u src/external/gpl3/binutils.old/dist/bfd/elf.c:1.6 src/external/gpl3/binutils.old/dist/bfd/elf.c:1.7 --- src/external/gpl3/binutils.old/dist/bfd/elf.c:1.6 Thu Jul 12 21:38:16 2018 +++ src/external/gpl3/binutils.old/dist/bfd/elf.c Fri Jul 13 10:49:17 2018 @@ -4159,7 +4159,7 @@ static bfd_size_type get_program_header_size (bfd *abfd, struct bfd_link_info *info) { size_t segs; - asection *s, *s2; + asection *s; const struct elf_backend_data *bed; /* Assume we will need exactly two PT_LOAD segments: one for text @@ -4167,28 +4167,21 @@ get_program_header_size (bfd *abfd, stru segs = 2; s = bfd_get_section_by_name (abfd, ".interp"); - s2 = bfd_get_section_by_name (abfd, ".dynamic"); if (s != NULL && (s->flags & SEC_LOAD) != 0) { - ++segs; + /* If we have a loadable interpreter section, we need a + PT_INTERP segment. In this case, assume we also need a + PT_PHDR segment, although that may not be true for all + targets. */ + segs += 2; } - if (s2 != NULL && (s2->flags & SEC_LOAD) != 0) + if (bfd_get_section_by_name (abfd, ".dynamic") != NULL) { /* We need a PT_DYNAMIC segment. */ ++segs; } - if ((s != NULL && (s->flags & SEC_LOAD) != 0) || - (s2 != NULL && (s2->flags & SEC_LOAD) != 0)) -{ - /* - * If either a PT_INTERP or PT_DYNAMIC segment is created, - * also create a PT_PHDR segment. - */ - ++segs; -} - if (info != NULL && info->relro) { /* We need a PT_GNU_RELRO segment. */ @@ -4455,13 +4448,6 @@ _bfd_elf_map_sections_to_segments (bfd * section. */ s = bfd_get_section_by_name (abfd, ".interp"); if (s != NULL && (s->flags & SEC_LOAD) != 0) - s = NULL; - dynsec = bfd_get_section_by_name (abfd, ".dynamic"); - if (dynsec != NULL - && (dynsec->flags & SEC_LOAD) == 0) - dynsec = NULL; - - if (s != NULL || dynsec != NULL) { amt = sizeof (struct elf_segment_map); m = (struct elf_segment_map *) bfd_zalloc (abfd, amt); @@ -4476,10 +4462,7 @@ _bfd_elf_map_sections_to_segments (bfd * *pm = m; pm = >next; - } - if (s != NULL) - { amt = sizeof (struct elf_segment_map); m = (struct elf_segment_map *) bfd_zalloc (abfd, amt); if (m == NULL) @@ -4506,6 +4489,10 @@ _bfd_elf_map_sections_to_segments (bfd * if (maxpagesize == 0) maxpagesize = 1; writable = FALSE; + dynsec = bfd_get_section_by_name (abfd, ".dynamic"); + if (dynsec != NULL + && (dynsec->flags & SEC_LOAD) == 0) + dynsec = NULL; /* Deal with -Ttext or something similar such that the first section is not adjacent to the program headers. This is an Index: src/external/gpl3/binutils/dist/bfd/elf.c diff -u src/external/gpl3/binutils/dist/bfd/elf.c:1.10 src/external/gpl3/binutils/dist/bfd/elf.c:1.11 --- src/external/gpl3/binutils/dist/bfd/elf.c:1.10 Thu Jul 12 21:38:16 2018 +++ src/external/gpl3/binutils/dist/bfd/elf.c Fri Jul 13 10:49:17 2018 @@ -4301,7 +4301,7 @@ static bfd_size_type get_program_header_size (bfd *abfd, struct bfd_link_info *info) { size_t segs; - asection *s, *s2; + asection *s; const struct elf_backend_data *bed; /* Assume we will need exactly two PT_LOAD segments: one for text @@ -4309,28 +4309,21 @@ get_program_header_size (bfd *abfd, stru segs = 2; s = bfd_get_section_by_name (abfd, ".interp"); - s2 = bfd_get_section_by_name (abfd, ".dynamic"); if (s != NULL && (s->flags & SEC_LOAD) != 0) { - ++segs; + /* If we have a loadable interpreter section, we need a + PT_INTERP segment. In this case, assume we also need a + PT_PHDR segment, although that may not be true for all + targets. */ + segs += 2; } - if (s2 != NULL && (s2->flags & SEC_LOAD) != 0) + if (bfd_get_section_by_name (abfd, ".dynamic") != NULL) { /* We need a PT_DYNAMIC segment. */ ++segs; } - if ((s != NULL && (s->flags & SEC_LOAD) != 0) || - (s2 != NULL && (s2->flags & SEC_LOAD) != 0)) -{ - /* -
CVS commit: src/sys
Module Name:src Committed By: maxv Date: Fri Jul 13 09:58:49 UTC 2018 Modified Files: src/sys/secmodel/suser: secmodel_suser.c src/sys/sys: kauth.h Log Message: Remove KAUTH_MACHDEP_X86PMC, now unused. To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.45 src/sys/secmodel/suser/secmodel_suser.c cvs rdiff -u -r1.76 -r1.77 src/sys/sys/kauth.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/secmodel/suser/secmodel_suser.c diff -u src/sys/secmodel/suser/secmodel_suser.c:1.44 src/sys/secmodel/suser/secmodel_suser.c:1.45 --- src/sys/secmodel/suser/secmodel_suser.c:1.44 Thu Apr 26 18:54:09 2018 +++ src/sys/secmodel/suser/secmodel_suser.c Fri Jul 13 09:58:49 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: secmodel_suser.c,v 1.44 2018/04/26 18:54:09 alnsn Exp $ */ +/* $NetBSD: secmodel_suser.c,v 1.45 2018/07/13 09:58:49 maxv Exp $ */ /*- * Copyright (c) 2006 Elad Efrat * All rights reserved. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: secmodel_suser.c,v 1.44 2018/04/26 18:54:09 alnsn Exp $"); +__KERNEL_RCSID(0, "$NetBSD: secmodel_suser.c,v 1.45 2018/07/13 09:58:49 maxv Exp $"); #include #include @@ -853,7 +853,6 @@ secmodel_suser_machdep_cb(kauth_cred_t c case KAUTH_MACHDEP_NVRAM: case KAUTH_MACHDEP_UNMANAGEDMEM: case KAUTH_MACHDEP_PXG: - case KAUTH_MACHDEP_X86PMC: case KAUTH_MACHDEP_SVS_DISABLE: if (isroot) result = KAUTH_RESULT_ALLOW; Index: src/sys/sys/kauth.h diff -u src/sys/sys/kauth.h:1.76 src/sys/sys/kauth.h:1.77 --- src/sys/sys/kauth.h:1.76 Thu Apr 26 18:54:09 2018 +++ src/sys/sys/kauth.h Fri Jul 13 09:58:49 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: kauth.h,v 1.76 2018/04/26 18:54:09 alnsn Exp $ */ +/* $NetBSD: kauth.h,v 1.77 2018/07/13 09:58:49 maxv Exp $ */ /*- * Copyright (c) 2005, 2006 Elad Efrat @@ -320,7 +320,6 @@ enum { KAUTH_MACHDEP_NVRAM, KAUTH_MACHDEP_UNMANAGEDMEM, KAUTH_MACHDEP_PXG, - KAUTH_MACHDEP_X86PMC, KAUTH_MACHDEP_SVS_DISABLE };
CVS commit: src/usr.sbin/tprof/arch
Module Name:src Committed By: maxv Date: Fri Jul 13 09:53:42 UTC 2018 Modified Files: src/usr.sbin/tprof/arch: tprof_x86.c Log Message: Skylake/Kabylake are family 6, so add a check for that. While here improve the layout of "tprof list". To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/tprof/arch/tprof_x86.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/tprof/arch/tprof_x86.c diff -u src/usr.sbin/tprof/arch/tprof_x86.c:1.2 src/usr.sbin/tprof/arch/tprof_x86.c:1.3 --- src/usr.sbin/tprof/arch/tprof_x86.c:1.2 Fri Jul 13 08:09:21 2018 +++ src/usr.sbin/tprof/arch/tprof_x86.c Fri Jul 13 09:53:42 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: tprof_x86.c,v 1.2 2018/07/13 08:09:21 maxv Exp $ */ +/* $NetBSD: tprof_x86.c,v 1.3 2018/07/13 09:53:42 maxv Exp $ */ /* * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -162,13 +162,15 @@ init_intel_generic(void) edx = 0; x86_cpuid(, , , ); - switch (CPUID_TO_MODEL(eax)) { - case 0x4E: /* Skylake */ - case 0x5E: /* Skylake */ - case 0x8E: /* Kabylake */ - case 0x9E: /* Kabylake */ - table->next = init_intel_skylake_kabylake(); - break; + if (CPUID_TO_FAMILY(eax) == 6) { + switch (CPUID_TO_MODEL(eax)) { + case 0x4E: /* Skylake */ + case 0x5E: /* Skylake */ + case 0x8E: /* Kabylake */ + case 0x9E: /* Kabylake */ + table->next = init_intel_skylake_kabylake(); + break; + } } return table; @@ -314,7 +316,6 @@ recursive_event_list(struct event_table continue; printf("\t%s\n", table->names[i].name); } - printf("\n"); if (table->next != NULL) { recursive_event_list(table->next);
CVS commit: src
Module Name:src Committed By: maxv Date: Fri Jul 13 09:37:32 UTC 2018 Modified Files: src/share/man/man4: options.4 src/share/man/man9: intro.9 src/sys/arch/amd64/conf: ALL GENERIC files.amd64 src/sys/arch/i386/conf: ALL GENERIC NET4501 files.i386 src/sys/arch/x86/conf: files.x86 src/sys/arch/x86/include: specialreg.h sysarch.h src/sys/arch/x86/x86: sys_machdep.c x86_machdep.c src/sys/arch/xen/conf: files.compat Removed Files: src/sys/arch/x86/x86: pmc.c Log Message: Remove the X86PMC code I had written, replaced by tprof. Many defines become unused in specialreg.h, so remove them. We don't want to add defines all the time, there are countless PMCs on many generations, and it's better to just inline the event/unit values. To generate a diff of this commit: cvs rdiff -u -r1.489 -r1.490 src/share/man/man4/options.4 cvs rdiff -u -r1.21 -r1.22 src/share/man/man9/intro.9 cvs rdiff -u -r1.93 -r1.94 src/sys/arch/amd64/conf/ALL cvs rdiff -u -r1.495 -r1.496 src/sys/arch/amd64/conf/GENERIC cvs rdiff -u -r1.104 -r1.105 src/sys/arch/amd64/conf/files.amd64 cvs rdiff -u -r1.442 -r1.443 src/sys/arch/i386/conf/ALL cvs rdiff -u -r1.1182 -r1.1183 src/sys/arch/i386/conf/GENERIC cvs rdiff -u -r1.100 -r1.101 src/sys/arch/i386/conf/NET4501 cvs rdiff -u -r1.394 -r1.395 src/sys/arch/i386/conf/files.i386 cvs rdiff -u -r1.101 -r1.102 src/sys/arch/x86/conf/files.x86 cvs rdiff -u -r1.127 -r1.128 src/sys/arch/x86/include/specialreg.h cvs rdiff -u -r1.13 -r1.14 src/sys/arch/x86/include/sysarch.h cvs rdiff -u -r1.12 -r0 src/sys/arch/x86/x86/pmc.c cvs rdiff -u -r1.47 -r1.48 src/sys/arch/x86/x86/sys_machdep.c cvs rdiff -u -r1.118 -r1.119 src/sys/arch/x86/x86/x86_machdep.c cvs rdiff -u -r1.30 -r1.31 src/sys/arch/xen/conf/files.compat Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man4/options.4 diff -u src/share/man/man4/options.4:1.489 src/share/man/man4/options.4:1.490 --- src/share/man/man4/options.4:1.489 Thu Jul 12 10:46:41 2018 +++ src/share/man/man4/options.4 Fri Jul 13 09:37:32 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: options.4,v 1.489 2018/07/12 10:46:41 maxv Exp $ +.\" $NetBSD: options.4,v 1.490 2018/07/13 09:37:32 maxv Exp $ .\" .\" Copyright (c) 1996 .\" Perry E. Metzger. All rights reserved. @@ -30,7 +30,7 @@ .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" .\" -.Dd July 12, 2018 +.Dd July 13, 2018 .Dt OPTIONS 4 .Os .Sh NAME @@ -2702,7 +2702,6 @@ bolded .Xr gcc 1 , .Xr gdb 1 , .Xr ktrace 1 , -.Xr pmc 1 , .Xr quota 1 , .Xr vndcompress 1 , .Xr gettimeofday 2 , Index: src/share/man/man9/intro.9 diff -u src/share/man/man9/intro.9:1.21 src/share/man/man9/intro.9:1.22 --- src/share/man/man9/intro.9:1.21 Mon May 28 08:36:36 2018 +++ src/share/man/man9/intro.9 Fri Jul 13 09:37:32 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: intro.9,v 1.21 2018/05/28 08:36:36 wiz Exp $ +.\" $NetBSD: intro.9,v 1.22 2018/07/13 09:37:32 maxv Exp $ .\" .\" Copyright (c) 1997, 2007 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd May 30, 2017 +.Dd July 13, 2018 .Dt INTRO 9 .Os .Sh NAME @@ -628,10 +628,6 @@ Performs pattern matching on strings. See .Xr pmatch 9 . .Pp -Hardware Performance Monitoring Interface. -See -.Xr pmc 9 . -.Pp Add or remove a shutdown hook. See .Xr pmf 9 . Index: src/sys/arch/amd64/conf/ALL diff -u src/sys/arch/amd64/conf/ALL:1.93 src/sys/arch/amd64/conf/ALL:1.94 --- src/sys/arch/amd64/conf/ALL:1.93 Thu Jul 12 10:39:06 2018 +++ src/sys/arch/amd64/conf/ALL Fri Jul 13 09:37:32 2018 @@ -1,4 +1,4 @@ -# $NetBSD: ALL,v 1.93 2018/07/12 10:39:06 maya Exp $ +# $NetBSD: ALL,v 1.94 2018/07/13 09:37:32 maxv Exp $ # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp # # ALL machine description file @@ -17,7 +17,7 @@ include "arch/amd64/conf/std.amd64" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "ALL-$Revision: 1.93 $" +#ident "ALL-$Revision: 1.94 $" maxusers 64 # estimated number of users @@ -40,8 +40,6 @@ powernow0 at cpu0 # AMD PowerNow! and C viac7temp* at cpu? # VIA C7 temperature sensor vmt0 at cpu0 # VMware Tools -options PMC # performance-monitoring counters support - # Beep when it is safe to power down the system (requires sysbeep) options BEEP_ONHALT # Some tunable details of the above feature (default values used below) Index: src/sys/arch/amd64/conf/GENERIC diff -u src/sys/arch/amd64/conf/GENERIC:1.495 src/sys/arch/amd64/conf/GENERIC:1.496 --- src/sys/arch/amd64/conf/GENERIC:1.495 Thu Jul 12 10:39:06 2018 +++ src/sys/arch/amd64/conf/GENERIC Fri Jul 13 09:37:32 2018 @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.495 2018/07/12 10:39:06 maya Exp $ +# $NetBSD: GENERIC,v 1.496 2018/07/13 09:37:32
CVS commit: xsrc/external/mit/xf86-video-nv/dist/src
Module Name:xsrc Committed By: mrg Date: Fri Jul 13 09:37:13 UTC 2018 Modified Files: xsrc/external/mit/xf86-video-nv/dist/src: nv_type.h Log Message: add what i believe is the missing part from the previous commit to the old nvidia driver. fixes my build and appears to match intent. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 xsrc/external/mit/xf86-video-nv/dist/src/nv_type.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: xsrc/external/mit/xf86-video-nv/dist/src/nv_type.h diff -u xsrc/external/mit/xf86-video-nv/dist/src/nv_type.h:1.2 xsrc/external/mit/xf86-video-nv/dist/src/nv_type.h:1.3 --- xsrc/external/mit/xf86-video-nv/dist/src/nv_type.h:1.2 Thu Jul 12 21:19:54 2018 +++ xsrc/external/mit/xf86-video-nv/dist/src/nv_type.h Fri Jul 13 09:37:13 2018 @@ -100,6 +100,7 @@ typedef struct { BoolHWCursor; BoolFpScale; BoolShadowFB; +BoolUseEXA; unsigned char * ShadowPtr; int ShadowPitch; CARD32 MinVClockFreqKHz;
CVS commit: src
Module Name:src Committed By: maxv Date: Fri Jul 13 09:15:56 UTC 2018 Modified Files: src/distrib/sets/lists/base: md.amd64 md.i386 src/distrib/sets/lists/debug: md.amd64 md.i386 src/distrib/sets/lists/man: mi Removed Files: src/usr.bin/pmc: Makefile pmc.1 pmc.c Log Message: Remove the usr.bin/pmc tool. People should use tprof instead. To generate a diff of this commit: cvs rdiff -u -r1.274 -r1.275 src/distrib/sets/lists/base/md.amd64 cvs rdiff -u -r1.149 -r1.150 src/distrib/sets/lists/base/md.i386 cvs rdiff -u -r1.100 -r1.101 src/distrib/sets/lists/debug/md.amd64 cvs rdiff -u -r1.15 -r1.16 src/distrib/sets/lists/debug/md.i386 cvs rdiff -u -r1.1596 -r1.1597 src/distrib/sets/lists/man/mi cvs rdiff -u -r1.5 -r0 src/usr.bin/pmc/Makefile cvs rdiff -u -r1.13 -r0 src/usr.bin/pmc/pmc.1 cvs rdiff -u -r1.25 -r0 src/usr.bin/pmc/pmc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/base/md.amd64 diff -u src/distrib/sets/lists/base/md.amd64:1.274 src/distrib/sets/lists/base/md.amd64:1.275 --- src/distrib/sets/lists/base/md.amd64:1.274 Fri Dec 22 07:19:02 2017 +++ src/distrib/sets/lists/base/md.amd64 Fri Jul 13 09:15:55 2018 @@ -1,11 +1,11 @@ -# $NetBSD: md.amd64,v 1.274 2017/12/22 07:19:02 maxv Exp $ +# $NetBSD: md.amd64,v 1.275 2018/07/13 09:15:55 maxv Exp $ ./dev/lms0 base-obsolete obsolete ./dev/mms0 base-obsolete obsolete ./sbin/mount_qemufwcfgbase-sysutil-root ./libexec/ld.elf_so-i386 base-sys-shlib compat,pic ./usr/bin/fdformatbase-util-bin ./usr/bin/iasl base-util-bin -./usr/bin/pmc base-util-bin +./usr/bin/pmc base-obsolete obsolete ./usr/lib/i386/libi386.so.2 base-compat-shlib compat,pic ./usr/lib/i386/libi386.so.2.0 base-compat-shlib compat,pic ./usr/lib/i386/libproc.so.1 base-compat-shlib compat,pic,dtrace Index: src/distrib/sets/lists/base/md.i386 diff -u src/distrib/sets/lists/base/md.i386:1.149 src/distrib/sets/lists/base/md.i386:1.150 --- src/distrib/sets/lists/base/md.i386:1.149 Sun Jul 8 16:55:37 2018 +++ src/distrib/sets/lists/base/md.i386 Fri Jul 13 09:15:55 2018 @@ -1,4 +1,4 @@ -# $NetBSD: md.i386,v 1.149 2018/07/08 16:55:37 christos Exp $ +# $NetBSD: md.i386,v 1.150 2018/07/13 09:15:55 maxv Exp $ ./dev/lms0 base-obsolete obsolete ./dev/mms0 base-obsolete obsolete ./dev/pms0 base-obsolete obsolete @@ -18,7 +18,7 @@ ./usr/bin/fdformatbase-util-bin ./usr/bin/fonteditbase-obsolete obsolete ./usr/bin/iasl base-util-bin -./usr/bin/pmc base-util-bin +./usr/bin/pmc base-obsolete obsolete ./usr/bin/vttestbase-obsolete obsolete ./usr/lib/libi386.sobase-sys-shlib pic ./usr/lib/libi386.so.2base-sys-shlib pic Index: src/distrib/sets/lists/debug/md.amd64 diff -u src/distrib/sets/lists/debug/md.amd64:1.100 src/distrib/sets/lists/debug/md.amd64:1.101 --- src/distrib/sets/lists/debug/md.amd64:1.100 Sat Nov 25 23:29:43 2017 +++ src/distrib/sets/lists/debug/md.amd64 Fri Jul 13 09:15:55 2018 @@ -1,4 +1,4 @@ -# $NetBSD: md.amd64,v 1.100 2017/11/25 23:29:43 jmcneill Exp $ +# $NetBSD: md.amd64,v 1.101 2018/07/13 09:15:55 maxv Exp $ ./usr/lib/i386/12.202++_g.a comp-c-debuglib debuglib,compat,12.202xx ./usr/lib/i386/libi386_g.a comp-c-debuglib debuglib,compat ./usr/lib/i386/libiberty_g.a comp-obsolete obsolete @@ -7,7 +7,7 @@ ./usr/libdata/debug/sbin/mount_qemufwcfg.debug comp-sysutil-debug debug ./usr/libdata/debug/usr/bin/fdformat.debug comp-util-debug debug ./usr/libdata/debug/usr/bin/iasl.debug comp-util-debug debug -./usr/libdata/debug/usr/bin/pmc.debug comp-util-debug debug +./usr/libdata/debug/usr/bin/pmc.debug comp-obsolete obsolete ./usr/libdata/debug/usr/lib/i386/libi386.so.2.0.debug comp-compat-shlib compat,pic,debug ./usr/libdata/debug/usr/lib/i386/libpam.so.4.1.debug comp-compat-shlib compat,pic,debug,pam ./usr/libdata/debug/usr/lib/i386/libproc.so.1.0.debug comp-compat-shlib compat,pic,debug,dtrace Index: src/distrib/sets/lists/debug/md.i386 diff -u src/distrib/sets/lists/debug/md.i386:1.15 src/distrib/sets/lists/debug/md.i386:1.16 --- src/distrib/sets/lists/debug/md.i386:1.15 Sat Nov 25 23:29:43 2017 +++ src/distrib/sets/lists/debug/md.i386 Fri Jul 13 09:15:55 2018 @@ -1,4 +1,4 @@ -# $NetBSD: md.i386,v 1.15 2017/11/25 23:29:43 jmcneill Exp $ +# $NetBSD: md.i386,v 1.16 2018/07/13 09:15:55 maxv Exp $ ./usr/lib/libi386_g.acomp-c-debuglib debuglib ./usr/lib/libm387_g.acomp-c-debuglib debuglib ./usr/lib/libpmc_g.acomp-obsolete obsolete @@ -7,7 +7,7 @@ ./usr/libdata/debug/sbin/mount_qemufwcfg.debug comp-sysutil-debug debug ./usr/libdata/debug/usr/bin/fdformat.debug comp-util-debug debug ./usr/libdata/debug/usr/bin/iasl.debug comp-util-debug debug -./usr/libdata/debug/usr/bin/pmc.debug comp-util-debug debug +./usr/libdata/debug/usr/bin/pmc.debug comp-obsolete obsolete
CVS commit: src/usr.sbin/tprof
Module Name:src Committed By: maxv Date: Fri Jul 13 09:04:31 UTC 2018 Modified Files: src/usr.sbin/tprof: tprof.8 tprof.c Log Message: Change the arguments of the tprof tool, to match the behavior of pmc(1) and cpuctl(8). They become: tprof list tprof monitor -e name:option [-o outfile] command To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/tprof/tprof.8 cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/tprof/tprof.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/tprof/tprof.8 diff -u src/usr.sbin/tprof/tprof.8:1.4 src/usr.sbin/tprof/tprof.8:1.5 --- src/usr.sbin/tprof/tprof.8:1.4 Fri Jul 13 07:56:29 2018 +++ src/usr.sbin/tprof/tprof.8 Fri Jul 13 09:04:31 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: tprof.8,v 1.4 2018/07/13 07:56:29 maxv Exp $ +.\" $NetBSD: tprof.8,v 1.5 2018/07/13 09:04:31 maxv Exp $ .\" .\" Copyright (c)2011 YAMAMOTO Takashi, .\" All rights reserved. @@ -32,16 +32,15 @@ .Nd record tprof profiling samples .Sh SYNOPSIS .Nm -.Op Fl l -.Op Fl e Ar name:option -.Op Fl c -.Op Fl o Ar file -.Ar command ... +.Ar op +.Op Ar arguments .Sh DESCRIPTION The .Nm -is a sampling based profiler. +tool can be used to monitor hardware events (PMCs) during the execution of +certain commands. .Pp +The .Nm utility makes the kernel driver start profiling, executes the specified command, @@ -55,10 +54,21 @@ pseudo driver and a suitable backend sho The .Nm utility accepts the following options. -.Bl -tag -width hogehoge -.It Fl l +The first argument, +.Ar op , +specifies the action to take. +Valid actions are: +.Bl -tag -width offline +.It list Display a list of performance counter events available on the system. -.It Fl e Ar name:option +.It monitor Xo +.Fl e +.Ar name:option +.Op Fl o Ar outfile +.Ar command +.Xc +Monitor the execution of command +.Ar command . .Ar name specifies the name of the event to count; it must be taken from the list of available events. @@ -68,20 +78,16 @@ specifies the source of the event; it mu (userland) and .Ar k (kernel). -.It Fl o Ar file -Write the collected samples to the file named -.Ar file . +The collected samples are written into the file +.Ar outfile +if specified. The default is .Dq Pa tprof.out . -.It Fl c -Write the collected samples to the standard output. -Note that the output is a binary stream. .El .Sh EXAMPLES -The following command profiles the system during 1 second and shows -the top-10 kernel functions which likely caused LLC misses. -.Bd -literal - tprof -e llc-misses:k -c sleep 1 2>/dev/null | tpfmt -skCLP | head -10 +The following command profiles the system during 20 seconds and writes the +samples into the file myfile.out. +.Dl # tprof monitor -e llc-misses:k -o myfile.out sleep 20 .Ed .Sh DIAGNOSTICS The Index: src/usr.sbin/tprof/tprof.c diff -u src/usr.sbin/tprof/tprof.c:1.6 src/usr.sbin/tprof/tprof.c:1.7 --- src/usr.sbin/tprof/tprof.c:1.6 Fri Jul 13 07:56:29 2018 +++ src/usr.sbin/tprof/tprof.c Fri Jul 13 09:04:31 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: tprof.c,v 1.6 2018/07/13 07:56:29 maxv Exp $ */ +/* $NetBSD: tprof.c,v 1.7 2018/07/13 09:04:31 maxv Exp $ */ /* * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ #include #ifndef lint -__RCSID("$NetBSD: tprof.c,v 1.6 2018/07/13 07:56:29 maxv Exp $"); +__RCSID("$NetBSD: tprof.c,v 1.7 2018/07/13 09:04:31 maxv Exp $"); #endif /* not lint */ #include @@ -83,20 +83,31 @@ __RCSID("$NetBSD: tprof.c,v 1.6 2018/07/ int devfd; int outfd; +static void tprof_list(int, char **); +static void tprof_monitor(int, char **); + +static struct cmdtab { + const char *label; + bool takesargs; + bool argsoptional; + void (*func)(int, char **); +} const tprof_cmdtab[] = { + { "list", false, false, tprof_list }, + { "monitor", true, false, tprof_monitor }, + { NULL, false, false, NULL }, +}; + __dead static void usage(void) { - fprintf(stderr, "%s [options] command ...\n", getprogname()); + fprintf(stderr, "%s [op] [options] [command]\n", getprogname()); fprintf(stderr, "\n"); - fprintf(stderr, "-e name:{u}{k}\t" - "the event to count.\n"); - fprintf(stderr, "-l\t\t" - "list the events.\n"); - fprintf(stderr, "-o filename\t" - "output to the file. [default: -o tprof.out]\n"); - fprintf(stderr, "-c\t\t" - "output to stdout. NOTE: the output is a binary stream.\n"); + fprintf(stderr, "\tlist\n"); + fprintf(stderr, "\t\tList the available events.\n"); + fprintf(stderr, "\tmonitor -e name:option [-o outfile] command\n"); + fprintf(stderr, "\t\tMonitor the event 'name' with option 'option'\n" + "\t\tcounted during the execution of 'command'.\n"); exit(EXIT_FAILURE); } @@ -132,48 +143,27 @@ process_samples(void *dummy) return NULL; } -int -main(int argc, char *argv[]) +static void +tprof_list(int argc, char **argv) { + tprof_event_list(); +} + +static void +tprof_monitor(int argc,
CVS commit: src/usr.sbin/tprof/arch
Module Name:src Committed By: maxv Date: Fri Jul 13 08:09:21 UTC 2018 Modified Files: src/usr.sbin/tprof/arch: tprof_x86.c Log Message: Inline the values in amd_f10h_names[], we're not going to use defines for each CPU model found in the wild. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/tprof/arch/tprof_x86.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/tprof/arch/tprof_x86.c diff -u src/usr.sbin/tprof/arch/tprof_x86.c:1.1 src/usr.sbin/tprof/arch/tprof_x86.c:1.2 --- src/usr.sbin/tprof/arch/tprof_x86.c:1.1 Fri Jul 13 07:56:29 2018 +++ src/usr.sbin/tprof/arch/tprof_x86.c Fri Jul 13 08:09:21 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: tprof_x86.c,v 1.1 2018/07/13 07:56:29 maxv Exp $ */ +/* $NetBSD: tprof_x86.c,v 1.2 2018/07/13 08:09:21 maxv Exp $ */ /* * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -180,77 +180,76 @@ init_intel_generic(void) * AMD Family 10h */ static struct name_to_event amd_f10h_names[] = { - { "seg-load-all", F10H_SEGMENT_REG_LOADS, 0x7f, true }, - { "seg-load-es", F10H_SEGMENT_REG_LOADS, 0x01, true }, - { "seg-load-cs", F10H_SEGMENT_REG_LOADS, 0x02, true }, - { "seg-load-ss", F10H_SEGMENT_REG_LOADS, 0x04, true }, - { "seg-load-ds", F10H_SEGMENT_REG_LOADS, 0x08, true }, - { "seg-load-fs", F10H_SEGMENT_REG_LOADS, 0x10, true }, - { "seg-load-gs", F10H_SEGMENT_REG_LOADS, 0x20, true }, - { "seg-load-hs", F10H_SEGMENT_REG_LOADS, 0x40, true }, - { "l1cache-access", F10H_DATA_CACHE_ACCESS, 0, true }, - { "l1cache-miss", F10H_DATA_CACHE_MISS, 0, true }, - { "l1cache-refill", F10H_DATA_CACHE_REFILL_FROM_L2, 0x1f, true }, - { "l1cache-refill-invalid", F10H_DATA_CACHE_REFILL_FROM_L2, 0x01, true }, - { "l1cache-refill-shared", F10H_DATA_CACHE_REFILL_FROM_L2, 0x02, true }, - { "l1cache-refill-exclusive", F10H_DATA_CACHE_REFILL_FROM_L2, 0x04, true }, - { "l1cache-refill-owner", F10H_DATA_CACHE_REFILL_FROM_L2, 0x08, true }, - { "l1cache-refill-modified", F10H_DATA_CACHE_REFILL_FROM_L2, 0x10, true }, - { "l1cache-load", F10H_DATA_CACHE_REFILL_FROM_NORTHBRIDGE,0x1f, true }, - { "l1cache-load-invalid", F10H_DATA_CACHE_REFILL_FROM_NORTHBRIDGE,0x01, true }, - { "l1cache-load-shared", F10H_DATA_CACHE_REFILL_FROM_NORTHBRIDGE,0x02, true }, - { "l1cache-load-exclusive", F10H_DATA_CACHE_REFILL_FROM_NORTHBRIDGE,0x04, true }, - { "l1cache-load-owner", F10H_DATA_CACHE_REFILL_FROM_NORTHBRIDGE,0x08, true }, - { "l1cache-load-modified", F10H_DATA_CACHE_REFILL_FROM_NORTHBRIDGE,0x10, true }, - { "l1cache-writeback", F10H_CACHE_LINES_EVICTED, 0x1f, true }, - { "l1cache-writeback-invalid", F10H_CACHE_LINES_EVICTED, 0x01, true }, - { "l1cache-writeback-shared", F10H_CACHE_LINES_EVICTED, 0x02, true }, - { "l1cache-writeback-exclusive",F10H_CACHE_LINES_EVICTED, 0x04, true }, - { "l1cache-writeback-owner", F10H_CACHE_LINES_EVICTED, 0x08, true }, - { "l1cache-writeback-modified", F10H_CACHE_LINES_EVICTED, 0x10, true }, - { "l1DTLB-hit-all", F10H_L1_DTLB_HIT, 0x07, true }, - { "l1DTLB-hit-4Kpage", F10H_L1_DTLB_HIT, 0x01, true }, - { "l1DTLB-hit-2Mpage", F10H_L1_DTLB_HIT, 0x02, true }, - { "l1DTLB-hit-1Gpage", F10H_L1_DTLB_HIT, 0x04, true }, - { "l1DTLB-miss-all", F10H_L1_DTLB_MISS, 0x07, true }, - { "l1DTLB-miss-4Kpage", F10H_L1_DTLB_MISS, 0x01, true }, - { "l1DTLB-miss-2Mpage", F10H_L1_DTLB_MISS, 0x02, true }, - { "l1DTLB-miss-1Gpage", F10H_L1_DTLB_MISS, 0x04, true }, - { "l2DTLB-miss-all", F10H_L2_DTLB_MISS, 0x03, true }, - { "l2DTLB-miss-4Kpage", F10H_L2_DTLB_MISS, 0x01, true }, - { "l2DTLB-miss-2Mpage", F10H_L2_DTLB_MISS, 0x02, true }, + { "seg-load-all", 0x20, 0x7f, true }, + { "seg-load-es", 0x20, 0x01, true }, + { "seg-load-cs", 0x20, 0x02, true }, + { "seg-load-ss", 0x20, 0x04, true }, + { "seg-load-ds", 0x20, 0x08, true }, + { "seg-load-fs", 0x20, 0x10, true }, + { "seg-load-gs", 0x20, 0x20, true }, + { "seg-load-hs", 0x20, 0x40, true }, + { "l1cache-access", 0x40, 0x00, true }, + { "l1cache-miss", 0x41, 0x00, true }, + { "l1cache-refill", 0x42, 0x1f, true }, + { "l1cache-refill-invalid", 0x42, 0x01, true }, + { "l1cache-refill-shared", 0x42, 0x02, true }, + { "l1cache-refill-exclusive", 0x42, 0x04, true }, + { "l1cache-refill-owner", 0x42, 0x08, true }, + { "l1cache-refill-modified", 0x42, 0x10, true }, + { "l1cache-load", 0x43, 0x1f, true }, + { "l1cache-load-invalid", 0x43, 0x01, true }, + { "l1cache-load-shared", 0x43, 0x02, true }, + { "l1cache-load-exclusive", 0x43, 0x04, true }, + { "l1cache-load-owner", 0x43, 0x08, true }, + { "l1cache-load-modified", 0x43, 0x10, true }, + { "l1cache-writeback", 0x44, 0x1f, true }, + { "l1cache-writeback-invalid", 0x44, 0x01, true }, + { "l1cache-writeback-shared", 0x44, 0x02, true }, + { "l1cache-writeback-exclusive",0x44, 0x04, true }, + { "l1cache-writeback-owner", 0x44, 0x08, true }, + { "l1cache-writeback-modified", 0x44, 0x10, true }, + {
CVS commit: src
Module Name:src Committed By: maxv Date: Fri Jul 13 07:56:29 UTC 2018 Modified Files: src/sys/arch/x86/x86: tprof_amdpmi.c tprof_pmi.c src/sys/dev/tprof: tprof.c tprof.h tprof_ioctl.h tprof_types.h src/usr.sbin/tprof: Makefile tprof.8 tprof.c Added Files: src/usr.sbin/tprof: tprof.h src/usr.sbin/tprof/arch: tprof_noarch.c tprof_x86.c Removed Files: src/usr.sbin/tprof: README tpann.sh tpfmt.sh Log Message: Revamp tprof. Rewrite the Intel backend to use the generic PMC interface, which is available on all Intel CPUs. Synchronize the AMD backend with the new interface. The kernel identifies the PMC interface, and gives its id to userland. Userland then queries the events itself (via cpuid etc). These events depend on the PMC interface. The tprof utility is rewritten to allow the user to choose which event to count (which was not possible until now, the event was hardcoded in the backend). The command line format is based on usr.bin/pmc, eg: tprof -e llc-misses:k -o output sleep 20 The man page is updated too, but the arguments will likely change soon anyway so it doesn't matter a lot. The tprof utility has three tables: Intel Architectural Version 1 Intel Skylake/Kabylake AMD Family 10h A CPU can support a combination of tables. For example Kabylake has Intel-Architectural-Version-1 and its own Intel-Kabylake table. For now the Intel Skylake/Kabylake table contains only one event, just to demonstrate that the combination of tables works. Tested on an Intel Core i5 Kabylake. The code for AMD Family 10h is taken from the code I had written for usr.bin/pmc. I haven't tested it yet, but it's the same as pmc(1), so I guess it works as-is. The whole thing is written in such a way that (I think) it is not complicated to add more CPU models, and more architectures (other than x86). To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/x86/x86/tprof_amdpmi.c cvs rdiff -u -r1.14 -r1.15 src/sys/arch/x86/x86/tprof_pmi.c cvs rdiff -u -r1.13 -r1.14 src/sys/dev/tprof/tprof.c cvs rdiff -u -r1.5 -r1.6 src/sys/dev/tprof/tprof.h cvs rdiff -u -r1.3 -r1.4 src/sys/dev/tprof/tprof_ioctl.h cvs rdiff -u -r1.2 -r1.3 src/sys/dev/tprof/tprof_types.h cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/tprof/Makefile \ src/usr.sbin/tprof/tprof.8 cvs rdiff -u -r1.9 -r0 src/usr.sbin/tprof/README cvs rdiff -u -r1.2 -r0 src/usr.sbin/tprof/tpann.sh cvs rdiff -u -r1.3 -r0 src/usr.sbin/tprof/tpfmt.sh cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/tprof/tprof.c cvs rdiff -u -r0 -r1.1 src/usr.sbin/tprof/tprof.h cvs rdiff -u -r0 -r1.1 src/usr.sbin/tprof/arch/tprof_noarch.c \ src/usr.sbin/tprof/arch/tprof_x86.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/x86/tprof_amdpmi.c diff -u src/sys/arch/x86/x86/tprof_amdpmi.c:1.7 src/sys/arch/x86/x86/tprof_amdpmi.c:1.8 --- src/sys/arch/x86/x86/tprof_amdpmi.c:1.7 Tue May 23 08:54:39 2017 +++ src/sys/arch/x86/x86/tprof_amdpmi.c Fri Jul 13 07:56:29 2018 @@ -1,6 +1,35 @@ -/* $NetBSD: tprof_amdpmi.c,v 1.7 2017/05/23 08:54:39 nonaka Exp $ */ +/* $NetBSD: tprof_amdpmi.c,v 1.8 2018/07/13 07:56:29 maxv Exp $ */ -/*- +/* + * Copyright (c) 2018 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Maxime Villard. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* * Copyright (c)2008,2009 YAMAMOTO Takashi, * All rights reserved. * @@ -27,7 +56,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tprof_amdpmi.c,v 1.7 2017/05/23 08:54:39 nonaka