svn commit: r267712 - head/sys/dev/uart

2014-06-22 Thread John-Mark Gurney
Author: jmg
Date: Sun Jun 22 06:54:36 2014
New Revision: 267712
URL: http://svnweb.freebsd.org/changeset/base/267712

Log:
  add support for MosChip MCS9922...  This is found on an ExpressCard..
  
  tested to work w/ cu talking to itself (the two ports connected via
  null modem cable)...

Modified:
  head/sys/dev/uart/uart_bus_pci.c

Modified: head/sys/dev/uart/uart_bus_pci.c
==
--- head/sys/dev/uart/uart_bus_pci.cSun Jun 22 02:48:27 2014
(r267711)
+++ head/sys/dev/uart/uart_bus_pci.cSun Jun 22 06:54:36 2014
(r267712)
@@ -136,6 +136,8 @@ static const struct pci_id pci_ns8250_id
MosChip MCS9901 PCIe to Peripheral Controller, 0x10 },
 { 0x9710, 0x9904, 0xa000, 0x1000,
MosChip MCS9904 PCIe to Peripheral Controller, 0x10 },
+{ 0x9710, 0x9922, 0x, 0,
+   MosChip MCS9922 Multi I/O Controller, 0x10 },
 { 0xdeaf, 0x9051, 0x, 0, Middle Digital PC Weasel Serial Port, 0x10 },
 { 0x, 0, 0x, 0, NULL, 0, 0}
 };
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r267715 - in head: contrib/wpa/src/utils usr.sbin/wpa/hostapd usr.sbin/wpa/hostapd_cli usr.sbin/wpa/wpa_cli usr.sbin/wpa/wpa_passphrase usr.sbin/wpa/wpa_supplicant

2014-06-22 Thread John-Mark Gurney
Author: jmg
Date: Sun Jun 22 10:00:33 2014
New Revision: 267715
URL: http://svnweb.freebsd.org/changeset/base/267715

Log:
  convert to using pidfile...  This prevents multiple wpa_supplicants
  running at the same time causing problems w/ wifi not working..
  
  the patch will be submitted upstream...  The next step if someone wants
  to push it upstream is to break os_unix.c up so that all these other
  utilities don't need libutil..
  
  Reviewed by:  rpaulo

Modified:
  head/contrib/wpa/src/utils/os_unix.c
  head/usr.sbin/wpa/hostapd/Makefile
  head/usr.sbin/wpa/hostapd_cli/Makefile
  head/usr.sbin/wpa/wpa_cli/Makefile
  head/usr.sbin/wpa/wpa_passphrase/Makefile
  head/usr.sbin/wpa/wpa_supplicant/Makefile

Modified: head/contrib/wpa/src/utils/os_unix.c
==
--- head/contrib/wpa/src/utils/os_unix.cSun Jun 22 08:32:31 2014
(r267714)
+++ head/contrib/wpa/src/utils/os_unix.cSun Jun 22 10:00:33 2014
(r267715)
@@ -153,16 +153,40 @@ static int os_daemon(int nochdir, int no
 #endif /* __APPLE__ */
 
 
+#ifdef __FreeBSD__
+#include err.h
+#include libutil.h
+#include stdint.h
+#endif /* __FreeBSD__ */
+
 int os_daemonize(const char *pid_file)
 {
 #if defined(__uClinux__) || defined(__sun__)
return -1;
 #else /* defined(__uClinux__) || defined(__sun__) */
+#ifdef __FreeBSD__
+   pid_t otherpid;
+   struct pidfh *pfh;
+
+   pfh = pidfile_open(pid_file, 0600, otherpid);
+   if (pfh == NULL) {
+   if (errno == EEXIST) {
+   errx(1, Daemon already running, pid: %jd.,
+   (intmax_t)otherpid);
+   }
+   warn(Cannot open or create pidfile.);
+   }
+#endif /* __FreeBSD__ */
+
if (os_daemon(0, 0)) {
perror(daemon);
+#ifdef __FreeBSD__
+   pidfile_remove(pfh);
+#endif /* __FreeBSD__ */
return -1;
}
 
+#ifndef __FreeBSD__
if (pid_file) {
FILE *f = fopen(pid_file, w);
if (f) {
@@ -170,6 +194,9 @@ int os_daemonize(const char *pid_file)
fclose(f);
}
}
+#else /* __FreeBSD__ */
+   pidfile_write(pfh);
+#endif /* __FreeBSD__ */
 
return -0;
 #endif /* defined(__uClinux__) || defined(__sun__) */

Modified: head/usr.sbin/wpa/hostapd/Makefile
==
--- head/usr.sbin/wpa/hostapd/Makefile  Sun Jun 22 08:32:31 2014
(r267714)
+++ head/usr.sbin/wpa/hostapd/Makefile  Sun Jun 22 10:00:33 2014
(r267715)
@@ -46,8 +46,8 @@ CFLAGS+=-DCONFIG_DRIVER_BSD \
 CFLAGS+= -DCONFIG_IPV6
 .endif
 #CFLAGS+= -g
-DPADD+=${LIBPCAP}
-LDADD+=-lpcap
+DPADD+=${LIBPCAP} ${LIBUTIL}
+LDADD+=-lpcap -lutil
 
 # User customizations for wpa_supplicant/hostapd build environment
 CFLAGS+=${HOSTAPD_CFLAGS}

Modified: head/usr.sbin/wpa/hostapd_cli/Makefile
==
--- head/usr.sbin/wpa/hostapd_cli/Makefile  Sun Jun 22 08:32:31 2014
(r267714)
+++ head/usr.sbin/wpa/hostapd_cli/Makefile  Sun Jun 22 10:00:33 2014
(r267715)
@@ -10,6 +10,9 @@ SRCS= common.c edit.c eloop.c hostapd_cl
 CFLAGS+= -DCONFIG_CTRL_IFACE
 CFLAGS+= -DCONFIG_CTRL_IFACE_UNIX
 
+DPADD+=${LIBUTIL}
+LDADD+=-lutil
+
 MAN=   hostapd_cli.8
 
 .include bsd.prog.mk

Modified: head/usr.sbin/wpa/wpa_cli/Makefile
==
--- head/usr.sbin/wpa/wpa_cli/Makefile  Sun Jun 22 08:32:31 2014
(r267714)
+++ head/usr.sbin/wpa/wpa_cli/Makefile  Sun Jun 22 10:00:33 2014
(r267715)
@@ -15,7 +15,7 @@ CFLAGS+= -DCONFIG_CTRL_IFACE_UNIX
 CFLAGS+= -D_DIRENT_HAVE_D_TYPE
 
 CFLAGS+= -DCONFIG_READLINE -I${DESTDIR}/${INCLUDEDIR}/edit
-LDADD+= -ledit -ltermcap
-DPADD+= ${LIBEDIT} ${LIBTERMCAP}
+LDADD+= -ledit -ltermcap -lutil
+DPADD+= ${LIBEDIT} ${LIBTERMCAP} ${LIBUTIL}
 
 .include bsd.prog.mk

Modified: head/usr.sbin/wpa/wpa_passphrase/Makefile
==
--- head/usr.sbin/wpa/wpa_passphrase/Makefile   Sun Jun 22 08:32:31 2014
(r267714)
+++ head/usr.sbin/wpa/wpa_passphrase/Makefile   Sun Jun 22 10:00:33 2014
(r267715)
@@ -11,6 +11,9 @@ SRCS= common.c md5-internal.c md5.c os_u
 CFLAGS+= -DINTERNAL_SHA1
 CFLAGS+= -DINTERNAL_MD5
 
+DPADD+=${LIBUTIL}
+LDADD+=-lutil
+
 MAN=   wpa_passphrase.8
 
 .include bsd.prog.mk

Modified: head/usr.sbin/wpa/wpa_supplicant/Makefile
==
--- head/usr.sbin/wpa/wpa_supplicant/Makefile   Sun Jun 22 08:32:31 2014
(r267714)
+++ head/usr.sbin/wpa/wpa_supplicant/Makefile   Sun Jun 22 10:00:33 2014
(r267715)
@@ -49,8 +49,8 @@ 

svn commit: r267719 - in head/sys/arm: conf tegra

2014-06-22 Thread Andrew Turner
Author: andrew
Date: Sun Jun 22 15:15:52 2014
New Revision: 267719
URL: http://svnweb.freebsd.org/changeset/base/267719

Log:
  Remove the incomplete Tegra 2 code, nobody was maintaining it. The AC100
  never booted to single user mode.
  
  It can be brought back if someone is willing to get it into a stable state
  and maintain it.

Deleted:
  head/sys/arm/conf/AC100
  head/sys/arm/tegra/
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r267727 - in head/tools/tools: . prstats

2014-06-22 Thread Gavin Atkinson
Author: gavin
Date: Sun Jun 22 16:35:03 2014
New Revision: 267727
URL: http://svnweb.freebsd.org/changeset/base/267727

Log:
  With the migration from GNATS to Bugzilla, we no longer need a tool to
  graph GNATS PR statistics.  It would be nice to have a similar tool for
  the new bug database, but that would likely be a from-scratch rewrite.

Deleted:
  head/tools/tools/prstats/
Modified:
  head/tools/tools/README

Modified: head/tools/tools/README
==
--- head/tools/tools/README Sun Jun 22 16:34:27 2014(r267726)
+++ head/tools/tools/README Sun Jun 22 16:35:03 2014(r267727)
@@ -55,7 +55,6 @@ pciid Generate src/share/misc/pci_vendo
 pciromsA tool for dumping PCI ROM images. WARNING: alpha 
quality.
 pirtoolA tool for dumping the $PIR table on i386 machines at 
runtime.
 portsinfo  Generate list of new ports for last two weeks.
-prstatsGenerate statistics about the PR database.
 recoverdiskCopy as much data as possible from a defective disk.
 scsi-defects   Get at the primary or grown defect list of a SCSI disk.
 sysdoc Build a manual page with available sysctls for a specific
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r267745 - head/lib/libc/stdlib

2014-06-22 Thread Pedro F. Giffuni
Author: pfg
Date: Sun Jun 22 20:13:57 2014
New Revision: 267745
URL: http://svnweb.freebsd.org/changeset/base/267745

Log:
  getopt(3): recognize option:: as GNU extension for optional options.
  
  Also ANSIfy a function declaration.
  
  While here update the OpenBSD patch level in getopt_long.c as we
  already have the corresponding change.
  
  Obtained from:NetBSD
  MFC after:2 weeks

Modified:
  head/lib/libc/stdlib/getopt.3
  head/lib/libc/stdlib/getopt.c
  head/lib/libc/stdlib/getopt_long.c

Modified: head/lib/libc/stdlib/getopt.3
==
--- head/lib/libc/stdlib/getopt.3   Sun Jun 22 19:10:55 2014
(r267744)
+++ head/lib/libc/stdlib/getopt.3   Sun Jun 22 20:13:57 2014
(r267745)
@@ -1,4 +1,4 @@
-.\$NetBSD: getopt.3,v 1.31 2003/09/23 10:26:54 wiz Exp $
+.\$NetBSD: getopt.3,v 1.34 2014/06/05 22:09:50 wiz Exp $
 .\
 .\ Copyright (c) 1988, 1991, 1993
 .\The Regents of the University of California.  All rights reserved.
@@ -30,7 +30,7 @@
 .\ @(#)getopt.3   8.5 (Berkeley) 4/27/95
 .\ $FreeBSD$
 .\
-.Dd April 27, 1995
+.Dd June 5, 2014
 .Dt GETOPT 3
 .Os
 .Sh NAME
@@ -65,6 +65,17 @@ The option string
 may contain the following elements: individual characters, and
 characters followed by a colon to indicate an option argument
 is to follow.
+If an individual character is followed by two colons, then the
+option argument is optional;
+.Va optarg
+is set to the rest of the current
+.Va argv
+word, or
+.Dv NULL
+if there were no more characters in the current word.
+This is a
+.Nx
+extension.
 For example, an option string
 .Li \x
 recognizes an option

Modified: head/lib/libc/stdlib/getopt.c
==
--- head/lib/libc/stdlib/getopt.c   Sun Jun 22 19:10:55 2014
(r267744)
+++ head/lib/libc/stdlib/getopt.c   Sun Jun 22 20:13:57 2014
(r267745)
@@ -1,4 +1,4 @@
-/* $NetBSD: getopt.c,v 1.26 2003/08/07 16:43:40 agc Exp $  */
+/* $NetBSD: getopt.c,v 1.29 2014/06/05 22:00:22 christos Exp $ */
 
 /*
  * Copyright (c) 1987, 1993, 1994
@@ -59,10 +59,7 @@ char *optarg;/* argument associated wi
  * Parse argc/argv argument vector.
  */
 int
-getopt(nargc, nargv, ostr)
-   int nargc;
-   char * const nargv[];
-   const char *ostr;
+getopt(int nargc, char * const nargv[], const char *ostr)
 {
static char *place = EMSG;  /* option letter processing */
char *oli;  /* option letter list index */
@@ -115,6 +112,12 @@ getopt(nargc, nargv, ostr)
   entire next argument. */
if (*place)
optarg = place;
+   else if (oli[2] == ':')
+   /*
+* GNU Extension, for optional arguments if the rest of
+* the argument is empty, we return NULL
+*/
+   optarg = NULL;
else if (nargc  ++optind)
optarg = nargv[optind];
else {

Modified: head/lib/libc/stdlib/getopt_long.c
==
--- head/lib/libc/stdlib/getopt_long.c  Sun Jun 22 19:10:55 2014
(r267744)
+++ head/lib/libc/stdlib/getopt_long.c  Sun Jun 22 20:13:57 2014
(r267745)
@@ -1,4 +1,4 @@
-/* $OpenBSD: getopt_long.c,v 1.22 2006/10/04 21:29:04 jmc Exp $*/
+/* $OpenBSD: getopt_long.c,v 1.23 2007/10/31 12:34:57 chl Exp $*/
 /* $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $  */
 
 /*
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r267755 - head/sys/kern

2014-06-22 Thread Mateusz Guzik
Author: mjg
Date: Sun Jun 22 21:37:27 2014
New Revision: 267755
URL: http://svnweb.freebsd.org/changeset/base/267755

Log:
  Don't take filedesc lock in fdunshare().
  
  We can read refcnt safely and only care if it is equal to 1.
  
  If it could suddenly change from 1 to something bigger the code would be
  buggy even in the previous form and transitions from  1 to 1 are equally racy
  and harmless (we copy even though there is no need).
  
  MFC after:1 week

Modified:
  head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==
--- head/sys/kern/kern_descrip.cSun Jun 22 21:28:05 2014
(r267754)
+++ head/sys/kern/kern_descrip.cSun Jun 22 21:37:27 2014
(r267755)
@@ -1852,17 +1852,14 @@ fdshare(struct filedesc *fdp)
 void
 fdunshare(struct proc *p, struct thread *td)
 {
+   struct filedesc *tmp;
 
-   FILEDESC_XLOCK(p-p_fd);
-   if (p-p_fd-fd_refcnt  1) {
-   struct filedesc *tmp;
-
-   FILEDESC_XUNLOCK(p-p_fd);
-   tmp = fdcopy(p-p_fd);
-   fdescfree(td);
-   p-p_fd = tmp;
-   } else
-   FILEDESC_XUNLOCK(p-p_fd);
+   if (p-p_fd-fd_refcnt == 1)
+   return;
+
+   tmp = fdcopy(p-p_fd);
+   fdescfree(td);
+   p-p_fd = tmp;
 }
 
 /*
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r267756 - head/lib/libc/stdlib

2014-06-22 Thread Andrey A. Chernov
Author: ache
Date: Sun Jun 22 21:54:57 2014
New Revision: 267756
URL: http://svnweb.freebsd.org/changeset/base/267756

Log:
  Merge intermediate OpenBSD v1.25 changes (almost identical to ours)
  to reduce diff and bump OpenBSD patch level to v1.26.
  
  MFC after:  2 weeks

Modified:
  head/lib/libc/stdlib/getopt_long.c

Modified: head/lib/libc/stdlib/getopt_long.c
==
--- head/lib/libc/stdlib/getopt_long.c  Sun Jun 22 21:37:27 2014
(r267755)
+++ head/lib/libc/stdlib/getopt_long.c  Sun Jun 22 21:54:57 2014
(r267756)
@@ -1,4 +1,4 @@
-/* $OpenBSD: getopt_long.c,v 1.23 2007/10/31 12:34:57 chl Exp $*/
+/* $OpenBSD: getopt_long.c,v 1.26 2013/06/08 22:47:56 millert Exp $
*/
 /* $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $  */
 
 /*
@@ -248,7 +248,7 @@ parse_long_options(char * const *nargv, 
if (short_too  current_argv_len == 1)
continue;
 
-   if (match == -1)/* first partial match */
+   if (match == -1)/* first partial match */
match = i;
else if ((flags  FLAG_LONGONLY) ||
 long_options[i].has_arg !=
@@ -359,37 +359,31 @@ getopt_internal(int nargc, char * const 
 {
char *oli;  /* option letter list index */
int optchar, short_too;
-   int posixly_correct;/* no static, can be changed on the fly */
+   static int posixly_correct = -1;
 
if (options == NULL)
return (-1);
 
/*
+* XXX Some GNU programs (like cvs) set optind to 0 instead of
+* XXX using optreset.  Work around this braindamage.
+*/
+   if (optind == 0)
+   optind = optreset = 1;
+
+   /*
 * Disable GNU extensions if POSIXLY_CORRECT is set or options
 * string begins with a '+'.
 */
-   posixly_correct = (getenv(POSIXLY_CORRECT) != NULL);
-#ifdef GNU_COMPATIBLE
+   if (posixly_correct == -1 || optreset)
+   posixly_correct = (getenv(POSIXLY_CORRECT) != NULL);
if (*options == '-')
flags |= FLAG_ALLARGS;
else if (posixly_correct || *options == '+')
flags = ~FLAG_PERMUTE;
-#else
-   if (posixly_correct || *options == '+')
-   flags = ~FLAG_PERMUTE;
-   else if (*options == '-')
-   flags |= FLAG_ALLARGS;
-#endif
if (*options == '+' || *options == '-')
options++;
 
-   /*
-* XXX Some GNU programs (like cvs) set optind to 0 instead of
-* XXX using optreset.  Work around this braindamage.
-*/
-   if (optind == 0)
-   optind = optreset = 1;
-
optarg = NULL;
if (optreset)
nonopt_start = nonopt_end = -1;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r267745 - head/lib/libc/stdlib

2014-06-22 Thread Baptiste Daroussin
On Sun, Jun 22, 2014 at 08:13:58PM +, Pedro F. Giffuni wrote:
 Author: pfg
 Date: Sun Jun 22 20:13:57 2014
 New Revision: 267745
 URL: http://svnweb.freebsd.org/changeset/base/267745
 
 Log:
   getopt(3): recognize option:: as GNU extension for optional options.
   

Will that allow to have sed -i acting like sed -i '' ?
If yes that will help a lot with GNU compatibility, porters will like it :)

regards,
Bapt


pgpKuViVhYOjt.pgp
Description: PGP signature


Re: svn commit: r267745 - head/lib/libc/stdlib

2014-06-22 Thread Pedro Giffuni

Il giorno 22/giu/2014, alle ore 18:48, Baptiste Daroussin b...@freebsd.org ha 
scritto:

 On Sun, Jun 22, 2014 at 08:13:58PM +, Pedro F. Giffuni wrote:
 Author: pfg
 Date: Sun Jun 22 20:13:57 2014
 New Revision: 267745
 URL: http://svnweb.freebsd.org/changeset/base/267745
 
 Log:
  getopt(3): recognize option:: as GNU extension for optional options.
 
 
 Will that allow to have sed -i acting like sed -i '’ ?

Hmm .. yes.

 If yes that will help a lot with GNU compatibility, porters will like it :)
 


The illumos guys did it long ago on their fork of our BSD sed:

https://www.illumos.org/issues/586

so a patch is available[1].

There was also a discussion/bikeshed about how ugly and non-unixish such an 
extension is.

Pedro.


[1]
http://src.illumos.org/source/diff/illumos-gate/usr/src/cmd/sed/main.c?r1=/illumos-gate/usr/src/cmd/sed/main.c@d15978eab6c23a98f0a5474466d5fe9b1be3ca9br2=/illumos-gate/usr/src/cmd/sed/main.c@e50226eccc6dfcba3cc6f0df38438900e3df225cformat=ufull=0


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


svn commit: r267758 - head

2014-06-22 Thread Andrey A. Chernov
Author: ache
Date: Mon Jun 23 00:54:56 2014
New Revision: 267758
URL: http://svnweb.freebsd.org/changeset/base/267758

Log:
  Change suggestion how to set MAKESYSPATH as broken incremental build
  workaround. Magic .../share/mk (search directories up to /)
  does not work for f.e. /usr/src/gnu/lib/libgcc because the path
  inside is starting from /usr/obj hierarchy and ends up in
  /usr/share/mk, not in the /usr/src/share/mk where src.opts.mk is.
  IMHO proper fixing of incremental build is needed urgently.

Modified:
  head/UPDATING

Modified: head/UPDATING
==
--- head/UPDATING   Sun Jun 22 23:40:20 2014(r267757)
+++ head/UPDATING   Mon Jun 23 00:54:56 2014(r267758)
@@ -67,7 +67,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11
behavior back, you can .include /etc/src.conf from /etc/make.conf
(which is still global and isn't changed). This also changes the
behavior of incremental builds inside the tree of individual
-   directories. Set MAKESYSPATH to .../share/mk to do that.
+   directories. Set MAKESYSPATH to /usr/src/share/mk to do that.
Although this has survived make universe and some upgrade scenarios,
other upgrade scenarios may have broken. At least one form of
temporary breakage was fixed with MAKESYSPATH settings for buildworld
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r267759 - head/sys/cddl/dev/dtrace/amd64

2014-06-22 Thread Mark Johnston
Author: markj
Date: Mon Jun 23 01:10:56 2014
New Revision: 267759
URL: http://svnweb.freebsd.org/changeset/base/267759

Log:
  Fix a couple of bugs on amd64 when fetching probe arguments beyond the
  first five for probes entered through a UD fault (i.e. FBT probes).
  
  Specifically, handle the fact that dtrace_invop_callsite must be
  16 byte-aligned and thus may not immediately follow the call to
  dtrace_invop() in dtrace_invop_start(). Also fetch register arguments and
  the stack pointer through a struct trapframe instead of a struct reg.
  
  PR:   191260
  Submitted by: luke...@gmail.com
  MFC after:3 weeks

Modified:
  head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c

Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c
==
--- head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c Mon Jun 23 00:54:56 2014
(r267758)
+++ head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c Mon Jun 23 01:10:56 2014
(r267759)
@@ -349,7 +349,8 @@ dtrace_getarg(int arg, int aframes)
for (i = 1; i = aframes; i++) {
fp = fp-f_frame;
 
-   if (fp-f_retaddr == (long)dtrace_invop_callsite) {
+   if (P2ROUNDUP(fp-f_retaddr, 16) ==
+   (long)dtrace_invop_callsite) {
/*
 * In the case of amd64, we will use the pointer to the
 * regs structure that was pushed when we took the
@@ -363,33 +364,33 @@ dtrace_getarg(int arg, int aframes)
 * we're seeking is passed in regsiters, we can just
 * load it directly.
 */
-   struct reg *rp = (struct reg *)((uintptr_t)fp[1] +
-   sizeof (uintptr_t));
+   struct trapframe *tf =
+   (struct trapframe *)((uintptr_t)fp[1]);
 
if (arg = inreg) {
switch (arg) {
case 0:
-   stack = (uintptr_t *)rp-r_rdi;
+   stack = (uintptr_t *)tf-tf_rdi;
break;
case 1:
-   stack = (uintptr_t *)rp-r_rsi;
+   stack = (uintptr_t *)tf-tf_rsi;
break;
case 2:
-   stack = (uintptr_t *)rp-r_rdx;
+   stack = (uintptr_t *)tf-tf_rdx;
break;
case 3:
-   stack = (uintptr_t *)rp-r_rcx;
+   stack = (uintptr_t *)tf-tf_rcx;
break;
case 4:
-   stack = (uintptr_t *)rp-r_r8;
+   stack = (uintptr_t *)tf-tf_r8;
break;
case 5:
-   stack = (uintptr_t *)rp-r_r9;
+   stack = (uintptr_t *)tf-tf_r9;
break;
}
arg = 0;
} else {
-   stack = (uintptr_t *)(rp-r_rsp);
+   stack = (uintptr_t *)(tf-tf_rsp);
arg -= inreg;
}
goto load;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r267760 - head/sys/kern

2014-06-22 Thread Mateusz Guzik
Author: mjg
Date: Mon Jun 23 01:28:18 2014
New Revision: 267760
URL: http://svnweb.freebsd.org/changeset/base/267760

Log:
  Tidy up fd-related functions called by do_execve
  
  o assert in each one that fdp is not shared
  o remove unnecessary NULL checks - all userspace processes have fdtables
  and kernel processes cannot execve
  o remove comments about the danger of fd_ofiles getting reallocated - fdtable
  is not shared and fd_ofiles could be only reallocated if new fd was about to 
be
  added, but if that was possible the code would already be buggy as 
setugidsafety
  work could be undone
  
  MFC after:1 week

Modified:
  head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==
--- head/sys/kern/kern_descrip.cMon Jun 23 01:10:56 2014
(r267759)
+++ head/sys/kern/kern_descrip.cMon Jun 23 01:28:18 2014
(r267760)
@@ -2081,15 +2081,8 @@ setugidsafety(struct thread *td)
struct file *fp;
int i;
 
-   /* Certain daemons might not have file descriptors. */
fdp = td-td_proc-p_fd;
-   if (fdp == NULL)
-   return;
-
-   /*
-* Note: fdp-fd_ofiles may be reallocated out from under us while
-* we are blocked in a close.  Be careful!
-*/
+   KASSERT(fdp-fd_refcnt == 1, (the fdtable should not be shared));
FILEDESC_XLOCK(fdp);
for (i = 0; i = fdp-fd_lastfile; i++) {
if (i  2)
@@ -2141,15 +2134,8 @@ fdcloseexec(struct thread *td)
struct file *fp;
int i;
 
-   /* Certain daemons might not have file descriptors. */
fdp = td-td_proc-p_fd;
-   if (fdp == NULL)
-   return;
-
-   /*
-* We cannot cache fd_ofiles since operations
-* may block and rip them out from under us.
-*/
+   KASSERT(fdp-fd_refcnt == 1, (the fdtable should not be shared));
FILEDESC_XLOCK(fdp);
for (i = 0; i = fdp-fd_lastfile; i++) {
fde = fdp-fd_ofiles[i];
@@ -2180,8 +2166,6 @@ fdcheckstd(struct thread *td)
int i, error, devnull;
 
fdp = td-td_proc-p_fd;
-   if (fdp == NULL)
-   return (0);
KASSERT(fdp-fd_refcnt == 1, (the fdtable should not be shared));
devnull = -1;
error = 0;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r267761 - in head/sys/cddl: contrib/opensolaris/uts/common/sys dev/dtrace/i386

2014-06-22 Thread Mark Johnston
Author: markj
Date: Mon Jun 23 02:00:14 2014
New Revision: 267761
URL: http://svnweb.freebsd.org/changeset/base/267761

Log:
  Fix some bugs when fetching probe arguments in i386. Firstly ensure that
  the 4 byte-aligned dtrace_invop_callsite can be found and that it
  immediately follows the call to dtrace_invop(). Secondly, fix some pointer
  arithmetic to account for differences between struct i386_frame and illumos'
  struct frame. Finally, ensure that dtrace_getarg() isn't inlined. It works
  by following a fixed number of frame pointers to the probe site, so inlining
  breaks it.
  
  MFC after:3 weeks

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h
  head/sys/cddl/dev/dtrace/i386/dtrace_asm.S
  head/sys/cddl/dev/dtrace/i386/dtrace_isa.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h  Mon Jun 
23 01:28:18 2014(r267760)
+++ head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h  Mon Jun 
23 02:00:14 2014(r267761)
@@ -1268,7 +1268,11 @@ typedef struct dtrace_toxrange {
uintptr_t   dtt_limit;  /* limit of toxic range */
 } dtrace_toxrange_t;
 
+#if defined(sun)
 extern uint64_t dtrace_getarg(int, int);
+#else
+extern uint64_t __noinline dtrace_getarg(int, int);
+#endif
 extern greg_t dtrace_getfp(void);
 extern int dtrace_getipl(void);
 extern uintptr_t dtrace_caller(int);

Modified: head/sys/cddl/dev/dtrace/i386/dtrace_asm.S
==
--- head/sys/cddl/dev/dtrace/i386/dtrace_asm.S  Mon Jun 23 01:28:18 2014
(r267760)
+++ head/sys/cddl/dev/dtrace/i386/dtrace_asm.S  Mon Jun 23 02:00:14 2014
(r267761)
@@ -49,14 +49,8 @@
 * dtrace_invop wants us to do.
 */
calldtrace_invop
-
-   /*
-* We pushed 3 times for the arguments to dtrace_invop,
-* so we need to increment the stack pointer to get rid of
-* those values.
-*/
-   addl$12, %esp
ALTENTRY(dtrace_invop_callsite)
+   addl$12, %esp
cmpl$DTRACE_INVOP_PUSHL_EBP, %eax
je  invop_push
cmpl$DTRACE_INVOP_POPL_EBP, %eax

Modified: head/sys/cddl/dev/dtrace/i386/dtrace_isa.c
==
--- head/sys/cddl/dev/dtrace/i386/dtrace_isa.c  Mon Jun 23 01:28:18 2014
(r267760)
+++ head/sys/cddl/dev/dtrace/i386/dtrace_isa.c  Mon Jun 23 02:00:14 2014
(r267761)
@@ -413,7 +413,8 @@ dtrace_getarg(int arg, int aframes)
for (i = 1; i = aframes; i++) {
fp = fp-f_frame;
 
-   if (fp-f_retaddr == (long)dtrace_invop_callsite) {
+   if (P2ROUNDUP(fp-f_retaddr, 4) ==
+   (long)dtrace_invop_callsite) {
/*
 * If we pass through the invalid op handler, we will
 * use the pointer that it passed to the stack as the
@@ -422,7 +423,7 @@ dtrace_getarg(int arg, int aframes)
 * beyond the EIP/RIP that was pushed when the trap was
 * taken -- hence the + 1 below.
 */
-   stack = ((uintptr_t **)fp[1])[1] + 1;
+   stack = ((uintptr_t **)fp[1])[0] + 1;
goto load;
}
 
@@ -438,7 +439,7 @@ dtrace_getarg(int arg, int aframes)
 */
arg++;
 
-   stack = (uintptr_t *)fp[1];
+   stack = (uintptr_t *)fp + 2;
 
 load:
DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r267581 - in head/sys/dev/sound: pci pci/hda pcm

2014-06-22 Thread Hans Petter Selasky

Hi,

Looks like this patch cause instant panic at USB audio detach:


usbconfig -d 0.4 reset
uaudio0: at uhub1, port 2, addr 4 (disconnected)

vm_fault(0xc0661400, 0, 1, 0) - 1
Fatal kernel mode data abort: 'Translation Fault (P)'
trapframe: 0xd28b8b58
FSR=0017, FAR=002c, spsr=6113
r0 =, r1 =c1b35000, r2 =, r3 =
r4 =c1a24000, r5 =, r6 =c1b3338c, r7 =c172e150
r8 =c1b35000, r9 =, r10=c162a400, r11=d28b8bd0
r12=c1bc9ad4, ssp=d28b8ba8, slr=c1b9855c, pc =c048fa3c

[ thread pid 14 tid 100037 ]
Stopped at  bus_dmamem_free+0x10:   ldr r0, [r9, #0x02c]
db bt



Tracing pid 14 tid 100037 td 0xc1712960
db_trace_self() at db_trace_self
 pc = 0xc0492958  lr = 0xc0130f38 (db_stack_trace+0xf4)
 sp = 0xd28b8860  fp = 0xd28b8878
r10 = 0xc0660180
db_stack_trace() at db_stack_trace+0xf4
 pc = 0xc0130f38  lr = 0xc01308a8 (db_command+0x270)
 sp = 0xd28b8880  fp = 0xd28b8920
 r4 = 0x  r5 = 0x
 r6 = 0x
db_command() at db_command+0x270
 pc = 0xc01308a8  lr = 0xc013060c (db_command_loop+0x60)
 sp = 0xd28b8928  fp = 0xd28b8938
 r4 = 0xc04d2192  r5 = 0xc04ec76c
 r6 = 0xc066016c  r7 = 0xc058b540
 r8 = 0xc0656294  r9 = 0xc0656290
r10 = 0x0001
db_command_loop() at db_command_loop+0x60
 pc = 0xc013060c  lr = 0xc0132fd4 (db_trap+0xd8)
 sp = 0xd28b8940  fp = 0xd28b8a60
 r4 = 0x  r5 = 0xc0660178
 r6 = 0xc06562c0
db_trap() at db_trap+0xd8
 pc = 0xc0132fd4  lr = 0xc028efbc (kdb_trap+0xbc)
 sp = 0xd28b8a68  fp = 0xd28b8a88
 r4 = 0x  r5 = 0x0017
 r6 = 0xc06562c0  r7 = 0xc058b540
kdb_trap() at kdb_trap+0xbc
 pc = 0xc028efbc  lr = 0xc04a5194 (dab_fatal+0x174)
 sp = 0xd28b8a90  fp = 0xd28b8aa8
 r4 = 0xd28b8b58  r5 = 0x0017
 r6 = 0x61d3  r7 = 0x002c
 r8 = 0xd28b8b58  r9 = 0x0013
r10 = 0x0001
dab_fatal() at dab_fatal+0x174
 pc = 0xc04a5194  lr = 0xc04a4f4c (data_abort_handler+0x3e8)
 sp = 0xd28b8ab0  fp = 0xd28b8b50
 r4 = 0xc16be3cc  r5 = 0xc1712960
 r6 = 0xd28b8eb0  r7 = 0x
data_abort_handler() at data_abort_handler+0x3e8
 pc = 0xc04a4f4c  lr = 0xc04944d4 (exception_exit)
 sp = 0xd28b8b58  fp = 0xd28b8bd0
 r4 = 0xc1a24000  r5 = 0x
 r6 = 0xc1b3338c  r7 = 0xc172e150
 r8 = 0xc1b35000  r9 = 0x
r10 = 0xc162a400
exception_exit() at exception_exit
 pc = 0xc04944d4  lr = 0xc1b9855c (sndbuf_free+0x80)
 sp = 0xd28b8ba8  fp = 0xd28b8bd0
 r0 = 0x  r1 = 0xc1b35000
 r2 = 0x  r3 = 0x
 r4 = 0xc1a24000  r5 = 0x
 r6 = 0xc1b3338c  r7 = 0xc172e150
 r8 = 0xc1b35000  r9 = 0x
r10 = 0xc162a400 r12 = 0xc1bc9ad4
bus_dmamem_free() at bus_dmamem_free+0x10
 pc = 0xc048fa3c  lr = 0xc1b984c4 (sndbuf_destroy+0x14)
 sp = 0xd28b8bd8  fp = 0xd28b8be0
 r4 = 0xc162ae00  r5 = 0xc1a24000
 r6 = 0xd28b8bd0  r7 = 0xc1b9855c
 r8 = 0x  r9 = 0xc1a24000
Unknown entry: 0
sndbuf_destroy() at sndbuf_destroy+0x14
 pc = 0xc1b984c4  lr = 0xc1b984c4 (sndbuf_destroy+0x14)
 sp = 0xd28b8bd8  fp = 0xd28b8be0

 Unable to unwind into user mode

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


svn commit: r267762 - head/sys/dev/sound/pcm

2014-06-22 Thread Alexander Kabaev
Author: kan
Date: Mon Jun 23 03:45:39 2014
New Revision: 267762
URL: http://svnweb.freebsd.org/changeset/base/267762

Log:
  Restore the check for non-NULL dmatag in sndbuf_free.
  
  The sound drivers that use own buffer management can use sndbuf_setup
  and not do any busdma allocation, so the driver will end up with the
  managed buffer but no valid dma map and tag for it. Avoid calling
  bus_dmamem_free in such cases.
  
  Reported by: ache
  Missed in review by: kan

Modified:
  head/sys/dev/sound/pcm/buffer.c

Modified: head/sys/dev/sound/pcm/buffer.c
==
--- head/sys/dev/sound/pcm/buffer.c Mon Jun 23 02:00:14 2014
(r267761)
+++ head/sys/dev/sound/pcm/buffer.c Mon Jun 23 03:45:39 2014
(r267762)
@@ -141,7 +141,8 @@ sndbuf_free(struct snd_dbuf *b)
if (b-flags  SNDBUF_F_MANAGED) {
if (b-buf_addr)
bus_dmamap_unload(b-dmatag, b-dmamap);
-   bus_dmamem_free(b-dmatag, b-buf, b-dmamap);
+   if (b-dmatag)
+   bus_dmamem_free(b-dmatag, b-buf, b-dmamap);
} else
free(b-buf, M_DEVBUF);
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r267763 - in head: share/man/man9 sys/netinet6

2014-06-22 Thread Kevin Lo
Author: kevlo
Date: Mon Jun 23 05:17:39 2014
New Revision: 267763
URL: http://svnweb.freebsd.org/changeset/base/267763

Log:
  Catch up with r186809, correct comments.

Modified:
  head/share/man/man9/domain.9
  head/sys/netinet6/ip6protosw.h

Modified: head/share/man/man9/domain.9
==
--- head/share/man/man9/domain.9Mon Jun 23 03:45:39 2014
(r267762)
+++ head/share/man/man9/domain.9Mon Jun 23 05:17:39 2014
(r267763)
@@ -111,7 +111,7 @@ struct protosw {
pr_slowtimo_t *pr_slowtimo; /* slow timeout (500ms) */
pr_drain_t *pr_drain;   /* flush any excess space possible */
 
-   struct  pr_usrreqs *pr_usrreqs; /* supersedes pr_usrreq() */
+   struct  pr_usrreqs *pr_usrreqs; /* user-protocol hook */
 };
 .Ed
 .Pp

Modified: head/sys/netinet6/ip6protosw.h
==
--- head/sys/netinet6/ip6protosw.h  Mon Jun 23 03:45:39 2014
(r267762)
+++ head/sys/netinet6/ip6protosw.h  Mon Jun 23 05:17:39 2014
(r267763)
@@ -138,7 +138,7 @@ struct ip6protosw {
(void);
void(*pr_drain) /* flush any excess space possible */
(void);
-   struct  pr_usrreqs *pr_usrreqs; /* supersedes pr_usrreq() */
+   struct  pr_usrreqs *pr_usrreqs; /* user-protocol hook */
 };
 
 #ifdef _KERNEL
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org