svn commit: r273960 - head/sys/netgraph

2014-11-01 Thread Gleb Smirnoff
Author: glebius
Date: Sun Nov  2 05:51:31 2014
New Revision: 273960
URL: https://svnweb.freebsd.org/changeset/base/273960

Log:
  NG_NODE_NAME(node) is always not NULL. Use correct macro.
  
  Submitted by: Dmitry Luhtionov 

Modified:
  head/sys/netgraph/ng_bridge.c

Modified: head/sys/netgraph/ng_bridge.c
==
--- head/sys/netgraph/ng_bridge.c   Sun Nov  2 02:32:33 2014
(r273959)
+++ head/sys/netgraph/ng_bridge.c   Sun Nov  2 05:51:31 2014
(r273960)
@@ -1046,7 +1046,7 @@ ng_bridge_nodename(node_p node)
 {
static char name[NG_NODESIZ];
 
-   if (NG_NODE_NAME(node) != NULL)
+   if (NG_NODE_HAS_NAME(node))
snprintf(name, sizeof(name), "%s", NG_NODE_NAME(node));
else
snprintf(name, sizeof(name), "[%x]", ng_node2ID(node));
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r273958 - head/sys/dev/random

2014-11-01 Thread Adrian Chadd
Woo, this fixed the embedded boot! Thanks!



-adrian

On 1 November 2014 19:01, Dag-Erling Smørgrav  wrote:
> Author: des
> Date: Sun Nov  2 02:01:55 2014
> New Revision: 273958
> URL: https://svnweb.freebsd.org/changeset/base/273958
>
> Log:
>   Restore the auto-reseed logic, but move it to a much later point,
>   immediately before kick_init.
>
>   Approved by:  so (self)
>
> Modified:
>   head/sys/dev/random/random_adaptors.c
>   head/sys/dev/random/yarrow.c
>
> Modified: head/sys/dev/random/random_adaptors.c
> ==
> --- head/sys/dev/random/random_adaptors.c   Sun Nov  2 01:47:27 2014  
>   (r273957)
> +++ head/sys/dev/random/random_adaptors.c   Sun Nov  2 02:01:55 2014  
>   (r273958)
> @@ -447,30 +447,8 @@ random_adaptors_deinit(void)
>  }
>
>  /*
> - * First seed.
> - *
> - * NB! NB! NB!
> - * NB! NB! NB!
> - *
> - * It turns out this is bloody dangerous. I was fiddling with code elsewhere
> - * and managed to get conditions where a safe (i.e. seeded) entropy device 
> should
> - * not have been possible. This managed to hide that by unblocking the 
> device anyway.
> - * As crap randomness is not directly distinguishable from good randomness, 
> this
> - * could have gone unnoticed for quite a while.
> - *
> - * NB! NB! NB!
> - * NB! NB! NB!
> - *
> - * Very luckily, the probe-time entropy is very nearly good enough to cause a
> - * first seed all of the time, and the default settings for other entropy
> - * harvesting causes a proper, safe, first seed (unblock) in short order 
> after that.
> - *
> - * That said, the below would be useful where folks are more concerned with
> - * a quick start than with extra paranoia in a low-entropy environment.
> - *
> - * markm - October 2013.
> + * Reseed the active adaptor shortly before starting init(8).
>   */
> -#ifdef RANDOM_AUTOSEED
>  /* ARGSUSED */
>  static void
>  random_adaptors_seed(void *unused __unused)
> @@ -484,6 +462,5 @@ random_adaptors_seed(void *unused __unus
>
> arc4rand(NULL, 0, 1);
>  }
> -SYSINIT(random_seed, SI_SUB_INTRINSIC_POST, SI_ORDER_LAST,
> -random_adaptors_reseed, NULL);
> -#endif /*  RANDOM_AUTOSEED */
> +SYSINIT(random_seed, SI_SUB_KTHREAD_INIT, SI_ORDER_FIRST,
> +random_adaptors_seed, NULL);
>
> Modified: head/sys/dev/random/yarrow.c
> ==
> --- head/sys/dev/random/yarrow.cSun Nov  2 01:47:27 2014
> (r273957)
> +++ head/sys/dev/random/yarrow.cSun Nov  2 02:01:55 2014
> (r273958)
> @@ -508,7 +508,9 @@ void
>  random_yarrow_reseed(void)
>  {
>
> +   mtx_lock(&random_reseed_mtx);
> reseed(SLOW);
> +   mtx_unlock(&random_reseed_mtx);
>  }
>
>  int
>
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/m

2014-11-01 Thread Jan Beich
Mark Murray  writes:

> Log:
>   This is the much-discussed major upgrade to the random(4) device,
> known to you all as /dev/random.
[...]
> Modified: head/sys/dev/random/randomdev_soft.c
> ===
> --- head/sys/dev/random/randomdev_soft.c  (revision 273871)
> +++ head/sys/dev/random/randomdev_soft.c  (revision 273872)
[...]
> +MID_DEV_MODULE(yarrow, randomdev_soft_modevent, NULL);
> +MODULE_VERSION(yarrow, 1);
> +MODULE_DEPEND(yarrow, random_adaptors, 1, 1, 1);

I have a minimalistic kernel where everything is pushed to a module for
easier/faster debugging before kload. As its config has no |device random|
loading random.ko fails because nothing provides random_adaptors e.g., try

  $ grep -r MODULE_VERSION.\*random_adaptors sys/dev/random

-

VFEmail.net - http://www.vfemail.net
ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the 
NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!  
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!  
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/m

2014-11-01 Thread Ian Lepore
On Sun, 2014-11-02 at 03:05 +0100, Dag-Erling Smørgrav wrote:
> Adrian Chadd  writes:
> > Dag-Erling Smørgrav  writes:
> > > I'm working on a patch.
> > Ok, thanks. I'm happy to test it out on this MIPS AP I have on my
> > bench right now.
> 
> r273957 cleans up the rc scripts, r273958 re-enables auto-reseed.
> 
> DES

That fixes it on my RPi board, thanks.

-- Ian


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


svn commit: r273959 - head/sys/kern

2014-11-01 Thread Mateusz Guzik
Author: mjg
Date: Sun Nov  2 02:32:33 2014
New Revision: 273959
URL: https://svnweb.freebsd.org/changeset/base/273959

Log:
  filedesc: tidy up fdcheckstd
  
  No functional changes.

Modified:
  head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==
--- head/sys/kern/kern_descrip.cSun Nov  2 02:01:55 2014
(r273958)
+++ head/sys/kern/kern_descrip.cSun Nov  2 02:32:33 2014
(r273959)
@@ -2189,29 +2189,28 @@ fdcheckstd(struct thread *td)
 
fdp = td->td_proc->p_fd;
KASSERT(fdp->fd_refcnt == 1, ("the fdtable should not be shared"));
+   MPASS(fdp->fd_nfiles >= 3);
devnull = -1;
-   error = 0;
-   for (i = 0; i < 3; i++) {
+   for (i = 0; i <= 2; i++) {
if (fdp->fd_ofiles[i].fde_file != NULL)
continue;
-   if (devnull < 0) {
-   save = td->td_retval[0];
+
+   save = td->td_retval[0];
+   if (devnull != -1) {
+   error = do_dup(td, DUP_FIXED, devnull, i);
+   } else {
error = kern_open(td, "/dev/null", UIO_SYSSPACE,
O_RDWR, 0);
-   devnull = td->td_retval[0];
-   td->td_retval[0] = save;
-   if (error)
-   break;
-   KASSERT(devnull == i, ("oof, we didn't get our fd"));
-   } else {
-   save = td->td_retval[0];
-   error = do_dup(td, DUP_FIXED, devnull, i);
-   td->td_retval[0] = save;
-   if (error != 0)
-   break;
+   if (error == 0) {
+   devnull = td->td_retval[0];
+   KASSERT(devnull == i, ("we didn't get our fd"));
+   }
}
+   td->td_retval[0] = save;
+   if (error != 0)
+   return (error);
}
-   return (error);
+   return (0);
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/m

2014-11-01 Thread Dag-Erling Smørgrav
Adrian Chadd  writes:
> Dag-Erling Smørgrav  writes:
> > I'm working on a patch.
> Ok, thanks. I'm happy to test it out on this MIPS AP I have on my
> bench right now.

r273957 cleans up the rc scripts, r273958 re-enables auto-reseed.

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

svn commit: r273958 - head/sys/dev/random

2014-11-01 Thread Dag-Erling Smørgrav
Author: des
Date: Sun Nov  2 02:01:55 2014
New Revision: 273958
URL: https://svnweb.freebsd.org/changeset/base/273958

Log:
  Restore the auto-reseed logic, but move it to a much later point,
  immediately before kick_init.
  
  Approved by:  so (self)

Modified:
  head/sys/dev/random/random_adaptors.c
  head/sys/dev/random/yarrow.c

Modified: head/sys/dev/random/random_adaptors.c
==
--- head/sys/dev/random/random_adaptors.c   Sun Nov  2 01:47:27 2014
(r273957)
+++ head/sys/dev/random/random_adaptors.c   Sun Nov  2 02:01:55 2014
(r273958)
@@ -447,30 +447,8 @@ random_adaptors_deinit(void)
 }
 
 /*
- * First seed.
- *
- * NB! NB! NB!
- * NB! NB! NB!
- *
- * It turns out this is bloody dangerous. I was fiddling with code elsewhere
- * and managed to get conditions where a safe (i.e. seeded) entropy device 
should
- * not have been possible. This managed to hide that by unblocking the device 
anyway.
- * As crap randomness is not directly distinguishable from good randomness, 
this
- * could have gone unnoticed for quite a while.
- *
- * NB! NB! NB!
- * NB! NB! NB!
- *
- * Very luckily, the probe-time entropy is very nearly good enough to cause a
- * first seed all of the time, and the default settings for other entropy
- * harvesting causes a proper, safe, first seed (unblock) in short order after 
that.
- *
- * That said, the below would be useful where folks are more concerned with
- * a quick start than with extra paranoia in a low-entropy environment.
- *
- * markm - October 2013.
+ * Reseed the active adaptor shortly before starting init(8).
  */
-#ifdef RANDOM_AUTOSEED
 /* ARGSUSED */
 static void
 random_adaptors_seed(void *unused __unused)
@@ -484,6 +462,5 @@ random_adaptors_seed(void *unused __unus
 
arc4rand(NULL, 0, 1);
 }
-SYSINIT(random_seed, SI_SUB_INTRINSIC_POST, SI_ORDER_LAST,
-random_adaptors_reseed, NULL);
-#endif /*  RANDOM_AUTOSEED */
+SYSINIT(random_seed, SI_SUB_KTHREAD_INIT, SI_ORDER_FIRST,
+random_adaptors_seed, NULL);

Modified: head/sys/dev/random/yarrow.c
==
--- head/sys/dev/random/yarrow.cSun Nov  2 01:47:27 2014
(r273957)
+++ head/sys/dev/random/yarrow.cSun Nov  2 02:01:55 2014
(r273958)
@@ -508,7 +508,9 @@ void
 random_yarrow_reseed(void)
 {
 
+   mtx_lock(&random_reseed_mtx);
reseed(SLOW);
+   mtx_unlock(&random_reseed_mtx);
 }
 
 int
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r273957 - in head: . etc/rc.d

2014-11-01 Thread Dag-Erling Smørgrav
Author: des
Date: Sun Nov  2 01:47:27 2014
New Revision: 273957
URL: https://svnweb.freebsd.org/changeset/base/273957

Log:
  Get rid of the postrandom script.  It was born in a time when the
  random script ran before filesystems were mounted, which is no
  longer the case.
  
  In random_start(), immediately delete each file that is fed into
  /dev/random, and recreate the default entropy file immediately
  after reading and deleting it.  The logic used in random_stop()
  to determine which file to write to should probably be factored
  out and used here as well.

Deleted:
  head/etc/rc.d/postrandom
Modified:
  head/ObsoleteFiles.inc
  head/etc/rc.d/Makefile
  head/etc/rc.d/adjkerntz
  head/etc/rc.d/random

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Sun Nov  2 01:13:11 2014(r273956)
+++ head/ObsoleteFiles.inc  Sun Nov  2 01:47:27 2014(r273957)
@@ -38,6 +38,8 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20141102: postrandom obsoleted by new /dev/random code
+OLD_FILES+=etc/rc.d/postrandom
 # 20141031: initrandom obsoleted by new /dev/random code
 OLD_FILES+=etc/rc.d/initrandom
 # 20141028: debug files accidentally installed as directory name

Modified: head/etc/rc.d/Makefile
==
--- head/etc/rc.d/Makefile  Sun Nov  2 01:13:11 2014(r273956)
+++ head/etc/rc.d/Makefile  Sun Nov  2 01:47:27 2014(r273957)
@@ -112,7 +112,6 @@ FILES=  DAEMON \
pf \
pflog \
pfsync \
-   postrandom \
powerd \
power_profile \
ppp \

Modified: head/etc/rc.d/adjkerntz
==
--- head/etc/rc.d/adjkerntz Sun Nov  2 01:13:11 2014(r273956)
+++ head/etc/rc.d/adjkerntz Sun Nov  2 01:47:27 2014(r273957)
@@ -4,7 +4,7 @@
 #
 
 # PROVIDE: adjkerntz
-# REQUIRE: FILESYSTEMS postrandom
+# REQUIRE: FILESYSTEMS
 # BEFORE: netif
 # KEYWORD: nojail
 

Modified: head/etc/rc.d/random
==
--- head/etc/rc.d/randomSun Nov  2 01:13:11 2014(r273956)
+++ head/etc/rc.d/randomSun Nov  2 01:47:27 2014(r273957)
@@ -17,41 +17,58 @@ stop_cmd="random_stop"
 extra_commands="saveseed"
 saveseed_cmd="${name}_stop"
 
+save_dev_random()
+{
+   for f ; do
+   if :>>"$f" ; then
+   debug "saving entropy to $f"
+   dd if=/dev/random of="$f" bs=4096 count=1 2>/dev/null
+   fi
+   done
+}
+
 feed_dev_random()
 {
-   if [ -f "${1}" -a -r "${1}" -a -s "${1}" ]; then
-   cat "${1}" | dd of=/dev/random bs=8k 2>/dev/null
-   fi
+   for f ; do
+   if [ -f "$f" -a -r "$f" -a -s "$f" ] ; then
+   if dd if="$f" of=/dev/random bs=4096 2>/dev/null ; then
+   debug "entropy read from $f"
+   rm -f "$f"
+   fi
+   fi
+   done
 }
 
 random_start()
 {
+   echo -n 'Feeding entropy:'
+
+   if [ ! -w /dev/random ] ; then
+   warn "/dev/random is not writeable"
+   return 1
+   fi
+
# Reseed /dev/random with previously stored entropy.
-   case ${entropy_dir} in
+   case ${entropy_dir:=/var/db/entropy} in
[Nn][Oo])
;;
*)
-   entropy_dir=${entropy_dir:-/var/db/entropy}
-   if [ -d "${entropy_dir}" ]; then
-   if [ -w /dev/random ]; then
-   for seedfile in ${entropy_dir}/*; do
-   feed_dev_random "${seedfile}"
-   done
-   fi
+   if [ -d "${entropy_dir}" ] ; then
+   feed_dev_random "${entropy_dir}"/*
fi
;;
esac
 
-   case ${entropy_file} in
+   case ${entropy_file:=/entropy} in
[Nn][Oo] | '')
;;
*)
-   if [ -w /dev/random ]; then
-   feed_dev_random "${entropy_file}"
-   feed_dev_random /var/db/entropy-file
-   fi
+   feed_dev_random "${entropy_file}" /var/db/entropy-file
+   save_dev_random "${entropy_file}"
;;
esac
+
+   echo '.'
 }
 
 random_stop()
@@ -59,7 +76,7 @@ random_stop()
# Write some entropy so when the machine reboots /dev/random
# can be reseeded
#
-   case ${entropy_file} in
+   case ${entropy_file:=/entropy} in
[Nn][Oo] | '')
;;
*)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all

svn commit: r273956 - head/sys/kern

2014-11-01 Thread Mateusz Guzik
Author: mjg
Date: Sun Nov  2 01:13:11 2014
New Revision: 273956
URL: https://svnweb.freebsd.org/changeset/base/273956

Log:
  filedesc: lock filedesc lock in fdcloseexec only when needed

Modified:
  head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==
--- head/sys/kern/kern_descrip.cSun Nov  2 00:11:25 2014
(r273955)
+++ head/sys/kern/kern_descrip.cSun Nov  2 01:13:11 2014
(r273956)
@@ -2160,19 +2160,17 @@ fdcloseexec(struct thread *td)
 
fdp = td->td_proc->p_fd;
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];
fp = fde->fde_file;
if (fp != NULL && (fp->f_type == DTYPE_MQUEUE ||
(fde->fde_flags & UF_EXCLOSE))) {
+   FILEDESC_XLOCK(fdp);
fdfree(fdp, i);
(void) closefp(fdp, i, fp, td, 0);
/* closefp() drops the FILEDESC lock. */
-   FILEDESC_XLOCK(fdp);
}
}
-   FILEDESC_XUNLOCK(fdp);
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/m

2014-11-01 Thread Adrian Chadd
On 1 November 2014 17:26, Dag-Erling Smørgrav  wrote:
> Adrian Chadd  writes:
>> Ok, so i figured maybe it hadn't been seeded just yet:
>
> which is what I've been saying all along.
>
> And the reason it hasn't been reseeded is that Mark disabled the
> automatic reseeding that used to happen late in the boot :(
>
> I'm working on a patch.

Ok, thanks. I'm happy to test it out on this MIPS AP I have on my
bench right now.




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

Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/m

2014-11-01 Thread Dag-Erling Smørgrav
Adrian Chadd  writes:
> Ok, so i figured maybe it hadn't been seeded just yet:

which is what I've been saying all along.

And the reason it hasn't been reseeded is that Mark disabled the
automatic reseeding that used to happen late in the boot :(

I'm working on a patch.

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/m

2014-11-01 Thread Dag-Erling Smørgrav
Adrian Chadd  writes:
> So, is there some way to go back to whatever the previous revision
> before this did? It at least comes up and doesn't hang things.

svn up -r273871

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/m

2014-11-01 Thread Adrian Chadd
Ok, so i figured maybe it hadn't been seeded just yet:

# cat /boot/kernel/* | dd of=/dev/random bs=8k
random: random_adaptor_write 8192
random: random_adaptor_write 8192
random: random_adaptor_write 8192
random: random_adaptor_write 8192
random: random_adaptor_write 8192
random: random_adaptor_write 8192
random: random_adaptor_write 8192
random: random_adaptor_write 8192
random: random_adaptor_write 8192
random: random_adaptor_write 8192
random: random_adaptor_write 8192
random: random_adaptor_write 8192
random: random_adaptor_write 8192
random: random_adaptor_write 8192
random: random_adaptor_write 8192
random: random_adaptor_write 8192
random: random_adaptor_write 8192
random: random_adaptor_write 8192
random: random_adaptor_write 8192
random: random_adaptor_write 8192
random: random_adaptor_write 8192
random: random_adaptor_write 8192
random: random_adaptor_write 8192
random: random_adaptor_write 8192
random: random_adaptor_write 8192
random: reseed - fast - thresh 96,1 -  130 28 0 0 0 0 0 0 14977 0 0 0
0 0 0 0 0 0 0 0
random: reseed - slow - thresh 128,2 -  130 28 0 0 0 0 0 0 14976 0 0 0
0 0 0 0 0 0 0 0
random: unblocking device.

.. at that point things worked fine.

So, hm. How do us embedded people just unblock it for now at boot, so
we can actually _get_ enough entropy?

Thanks,



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


svn commit: r273955 - in head: etc/rc.d share/man/man7

2014-11-01 Thread John-Mark Gurney
Author: jmg
Date: Sun Nov  2 00:11:25 2014
New Revision: 273955
URL: https://svnweb.freebsd.org/changeset/base/273955

Log:
  add an rc.d script to automatically grow the specified FS...  It has
  been tested on both MBR and GPT...  It won't be enabled until you add
  growfs_enable="YES" and will only run on first boot..

Added:
  head/etc/rc.d/growfs   (contents, props changed)
  head/share/man/man7/growfs.7   (contents, props changed)
Modified:
  head/etc/rc.d/Makefile
  head/share/man/man7/Makefile

Modified: head/etc/rc.d/Makefile
==
--- head/etc/rc.d/Makefile  Sun Nov  2 00:05:52 2014(r273954)
+++ head/etc/rc.d/Makefile  Sun Nov  2 00:11:25 2014(r273955)
@@ -49,6 +49,7 @@ FILES=DAEMON \
geli \
geli2 \
gptboot \
+   growfs \
gssd \
hastd \
${_hcsecd} \

Added: head/etc/rc.d/growfs
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/etc/rc.d/growfsSun Nov  2 00:11:25 2014(r273955)
@@ -0,0 +1,98 @@
+#!/bin/sh
+#
+# Copyright 2014 John-Mark Gurney
+# All rights reserved.
+#
+# 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 AUTHOR 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 AUTHOR 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.
+#
+# $FreeBSD$
+#
+
+# PROVIDE: growfs
+# BEFORE: sysctl
+# KEYWORD: firstboot
+
+# This allows us to distribute a image
+# and have it work on essentially any size drive.
+#
+# TODO: Figure out where this should really be ordered.
+# I suspect it should go just after fsck but before mountcritlocal
+# but it's hard to tell for sure because of the bug described
+# below.
+# 
+
+. /etc/rc.subr
+
+name="growfs"
+start_cmd="growfs_start"
+stop_cmd=":"
+rcvar="growfs_enable"
+
+growfs_start ()
+{
+echo "Growing root partition to fill device"
+rootdev=$(df / | tail -n 1 | awk '{ sub("/dev/", "", $1); print $1 }')
+if [ x"$rootdev" = x"${rootdev%/*}" ]; then
+   # raw device
+   rawdev="$rootdev"
+else
+   rawdev=$(glabel status | awk '$1 == "'"$rootdev"'" { print $3 }')
+   if [ x"$rawdev" = x"" ]; then
+   echo "Can't figure out device for: $rootdev"
+   return
+   fi
+fi
+
+sysctl -b kern.geom.conftxt | awk '
+{
+   lvl=$1
+   device[lvl] = $3
+   type[lvl] = $2
+   idx[lvl] = $7
+   parttype[lvl] = $13
+   if (dev == $3) {
+   for (i = 1; i <= lvl; i++) {
+   # resize
+   if (type[i] == "PART") {
+   pdev = device[i - 1]
+   cmd[i] = "gpart resize -i " idx[i] " " pdev
+   if (parttype[i] == "GPT")
+   cmd[i] = "gpart recover " pdev " ; " 
cmd[i]
+   } else if (type[i] == "LABEL") {
+   continue
+   } else {
+   print "unhandled type: " type[i]
+   exit 1
+   }
+   }
+   for (i = 1; i <= lvl; i++) {
+   if (cmd[i])
+   system(cmd[i])
+   }
+   exit 0
+   }
+}' dev="$rawdev"
+growfs -y /dev/"$rootdev"
+}
+
+load_rc_config $name
+run_rc_command "$1"

Modified: head/share/man/man7/Makefile
==
--- head/share/man/man7/MakefileSun Nov  2 00:05:52 2014
(r273954)
+++ head/share/man/man7/MakefileSun Nov  2 00:11:25 2014
(r273955)
@@ -14,6 +14,7 @@ MAN=  adding_user.7 \
environ.7 \
ffs.7 \

Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/m

2014-11-01 Thread Dag-Erling Smørgrav
Ian Lepore  writes:
> Yeah.  I vaguely remember discussion about this something like 12-18
> months ago.  As I remember it, there was a desire to avoid using the
> same startup saved entropy on a rapid series of reboots and the thinking
> was to combat that by generating some fresh saved entropy on each boot.

Sure, but this can be done from cron instead of an rc script (see
below).

> It seems like that should work if the old saved entropy were stirred
> in with the modicum of boot-time entropy before generating a new save
> file.

That's what happens in random_start().

> I was thinking maybe postrandom should only try to save a new file if
> there are some existing files to avoid the possibility of hanging.  But
> when I look at postrandom more closely, it seems to be generating a save
> file, then deleting it along with all the other save files.

Umm, yes, I hadn't noticed that (I only reviewed the kernel code).  I
think we should just remove the fastsaveseed line.  Instead, make a
@reboot entry for save-entropy in /etc/crontab.

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/m

2014-11-01 Thread Adrian Chadd
Hi,

Right - but I'm not even getting to anywhere near this point.

It's hanging in hostapd when hostapd tries reading random data.

again, if i try ctrl-C'ing whilst the random device is inside
random_adaptor_read(), it's just .. broken. The read doesn't finish,
the process doesn't accept any new input, signals or anything - it
just doesn't work.

So, is there some way to go back to whatever the previous revision
before this did? It at least comes up and doesn't hang things.

Thanks,


-adrian

On 1 November 2014 16:57, Ian Lepore  wrote:
> On Sun, 2014-11-02 at 00:33 +0100, Dag-Erling Smørgrav wrote:
>> Dag-Erling Smørgrav  writes:
>> > From the code.  This is a portion of the rc script that only runs at
>> > shutdown.  If random_stop() runs during boot, something is seriously
>> > wrong *somewhere else* and you are welcome to help find out what.
>>
>> I found it - postrandom triggers it.  For now, just remove
>> /etc/rc.d/postrandom (I'm not sure it's really needed, there are better
>> ways to do this).
>>
>> DES
>
> It appears another quick easy workaround is to set entropy_file=NO in
> rc.conf, which may be the right thing to do for people using a varmfs
> that isn't going to survive a reboot anyway, even after this glitch is
> fixed.
>
> -- Ian
>
>
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/m

2014-11-01 Thread Ian Lepore
On Sun, 2014-11-02 at 00:33 +0100, Dag-Erling Smørgrav wrote:
> Dag-Erling Smørgrav  writes:
> > From the code.  This is a portion of the rc script that only runs at
> > shutdown.  If random_stop() runs during boot, something is seriously
> > wrong *somewhere else* and you are welcome to help find out what.
> 
> I found it - postrandom triggers it.  For now, just remove
> /etc/rc.d/postrandom (I'm not sure it's really needed, there are better
> ways to do this).
> 
> DES

It appears another quick easy workaround is to set entropy_file=NO in
rc.conf, which may be the right thing to do for people using a varmfs
that isn't going to survive a reboot anyway, even after this glitch is
fixed.

-- Ian


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


Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/m

2014-11-01 Thread Ian Lepore
On Sun, 2014-11-02 at 00:33 +0100, Dag-Erling Smørgrav wrote:
> Dag-Erling Smørgrav  writes:
> > From the code.  This is a portion of the rc script that only runs at
> > shutdown.  If random_stop() runs during boot, something is seriously
> > wrong *somewhere else* and you are welcome to help find out what.
> 
> I found it - postrandom triggers it.  For now, just remove
> /etc/rc.d/postrandom (I'm not sure it's really needed, there are better
> ways to do this).
> 
> DES

Yeah.  I vaguely remember discussion about this something like 12-18
months ago.  As I remember it, there was a desire to avoid using the
same startup saved entropy on a rapid series of reboots and the thinking
was to combat that by generating some fresh saved entropy on each boot.

It seems like that should work if the old saved entropy were stirred in
with the modicum of boot-time entropy before generating a new save file.
Hmmm, but what if there is no saved entropy?  Maybe that's what's
happening here, given that a freshly created varmfs is involved.

I was thinking maybe postrandom should only try to save a new file if
there are some existing files to avoid the possibility of hanging.  But
when I look at postrandom more closely, it seems to be generating a save
file, then deleting it along with all the other save files.

-- Ian


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


Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/m

2014-11-01 Thread Dag-Erling Smørgrav
Ian Lepore  writes:
> and so it tries to write an entropy file at startup and hangs,
> presumably because /dev/random hasn't been sufficiently fed to
> generate that much random output?

That's problem #2, /dev/random *should* be unblocked by then.

BTW, there is no such thing as being "sufficiently fed to generate that
much random output".  Yarrow doesn't work that way.

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/m

2014-11-01 Thread Ian Lepore
On Sun, 2014-11-02 at 00:24 +0100, Dag-Erling Smrgrav wrote:
> Ian Lepore  writes:
> > Mark R V Murray  writes:
> > > The writing happens at shutdown; before you do the shutdown could
> > > you please do a ‘sysctl kern.random’ and post the result?
> > I'm not sure where you're getting "at shutdown" from.
> 
> From the code.  This is a portion of the rc script that only runs at
> shutdown.  If random_stop() runs during boot, something is seriously
> wrong *somewhere else* and you are welcome to help find out what.
> 
> DES

Well that took all of 90 seconds...

In rc.d/random we have:

 extra_commands="saveseed"
 saveseed_cmd="${name}_stop"

and in rc.d/postrandom we have:

  postrandom_start()
  {
/etc/rc.d/random fastsaveseed
  ...

and so it tries to write an entropy file at startup and hangs,
presumably because /dev/random hasn't been sufficiently fed to generate
that much random output?

-- Ian


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


Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/m

2014-11-01 Thread Dag-Erling Smørgrav
Dag-Erling Smørgrav  writes:
> From the code.  This is a portion of the rc script that only runs at
> shutdown.  If random_stop() runs during boot, something is seriously
> wrong *somewhere else* and you are welcome to help find out what.

I found it - postrandom triggers it.  For now, just remove
/etc/rc.d/postrandom (I'm not sure it's really needed, there are better
ways to do this).

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/m

2014-11-01 Thread Dag-Erling Smørgrav
Ian Lepore  writes:
> Mark R V Murray  writes:
> > The writing happens at shutdown; before you do the shutdown could
> > you please do a ‘sysctl kern.random’ and post the result?
> I'm not sure where you're getting "at shutdown" from.

From the code.  This is a portion of the rc script that only runs at
shutdown.  If random_stop() runs during boot, something is seriously
wrong *somewhere else* and you are welcome to help find out what.

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/m

2014-11-01 Thread Ian Lepore
On Sat, 2014-11-01 at 22:39 +, Mark R V Murray wrote:
> Hi
> 
> I’m not sure what you are showing me here?
> 
> How yo you draw the “not enough entropy” conclusion?
> 
> The writing happens at shutdown; before you do the shutdown could you please 
> do a ‘sysctl kern.random’ and post the result?
> 
> Do you have anything random-related in your rc.conf?
> 
> Could you please do a verbose boot on a kernel with “options RANDOM_DEBUG” 
> set and send me the dmesg output from a failing box.
> 
> M

Nothing related to random in rc.conf for me.  Here's a verbose dmesg:


Type '?' for a list of commands, 'help' for more detailed help.
loader> set boot_verbose=1
loader> boot
Using DTB compiled into kernel.
Waiting for Ethernet connection... done.
Kernel entry at 0x100100...
Kernel args: (null)
KDB: debugger backends: ddb
KDB: current backend: ddb
Copyright (c) 1992-2014 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights
reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 11.0-CURRENT #1 r273952: Sat Nov  1 16:55:50 MDT 2014

ilep...@revolution.hippie.lan:/local/build/staging/freebsd/rpi/obj/arm.armv6/local/build/staging/freebsd/rpi/src/sys/RPI-B-serial
 arm
FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
Preloaded elf kernel "/boot/kernel/kernel" at 0xc066d000.
CPU: ARM1176JZ-S rev 7 (ARM11J core)
 Supported features: ARM_ISA THUMB2 JAZELLE ARMv4 Security_Ext
 WB enabled LABT branch prediction enabled
  16KB/32B 4-way instruction cache
  16KB/32B 4-way write-back-locking-C data cache
real memory  = 134213632 (127 MB)
avail memory = 123449344 (117 MB)
Physical memory chunk(s):
  0x1000 - 0x07ff,   127 MB (  32767 pages)
Excluded memory regions:
  0x0010 - 0x007a4fff, 6 MB (   1701 pages) NoAlloc 
  0x0800 - 0x0fff,   128 MB (  32768 pages) NoAlloc NoDump
Static device mappings:
  0x2000 - 0x20ff mapped at VA 0xfef0
random device not loaded/active; using insecure pseudo-random number
generator
random: entropy device infrastructure driver
random: random_adaptors_init
random: selecting highest priority adaptor 
random: random_adaptor_choose - changing from NULL to Dummy
random: dummy_random_init
openfirm: 
random: SOFT: yarrow init()
random: selecting highest priority adaptor 
random: random_adaptor_choose - changing from Dummy to Yarrow
random: random_harvestq_init
mem: 
nfslock: pseudo-device
null: 
random: device_attach(): feeding 4 bit(s) of entropy from nexus0
ofwbus0: 
simplebus0:  mem 0x2000-0x20ff
on ofwbus0
random: device_attach(): feeding 4 bit(s) of entropy from simplebus0
random: device_attach(): feeding 4 bit(s) of entropy from ofwbus0
ofwbus0:  type unknown (no driver attached)
intc0:  mem 0xb200-0xb3ff on simplebus0
random: device_attach(): feeding 4 bit(s) of entropy from intc0
systimer0:  mem 0x3000-0x3fff irq 8,9,10,11 on
simplebus0
Event timer "BCM2835 Event Timer 3" frequency 100 Hz quality 1000
Timecounter "BCM2835 Timecounter" frequency 100 Hz quality 1000
random: device_attach(): feeding 4 bit(s) of entropy from systimer0
simplebus0:  mem 0xb400-0xb423 irq 0 compat
broadcom,bcm2835-sp804 (no driver attached)
bcmwd0:  mem 0x10001c-0x100027 on simplebus0
random: device_attach(): feeding 4 bit(s) of entropy from bcmwd0
gpio0:  mem 0x20-0x2000af irq
57,59,58,60 on simplebus0
gpio0: read-only pins: 46,47,48,49,50,51,52,53.
gpio0: reserved pins: 48,49,50,51,52,53.
gpioc0:  on gpio0
random: device_attach(): feeding 4 bit(s) of entropy from gpioc0
gpiobus0:  on gpio0
gpioled0:  at pin(s) 16 on gpiobus0
random: device_attach(): feeding 4 bit(s) of entropy from gpioled0
random: device_attach(): feeding 4 bit(s) of entropy from gpiobus0
random: device_attach(): feeding 4 bit(s) of entropy from gpio0
simplebus0:  mem 0x205000-0x20501f irq 61 compat
broadcom,bcm2835-bsc (no driver attached)
simplebus0:  mem 0x804000-0x80401f irq 61 compat
broadcom,bcm2835-bsc (no driver attached)
simplebus0:  mem 0x204000-0x20401f irq 62 compat
broadcom,bcm2835-spi (no driver attached)
bcm_dma0:  mem 0x7000-0x7fff,0xe05000-0xe05fff
irq 24,25,26,27,28,29,30,31,32,33,34,35,36 on simplebus0
random: device_attach(): feeding 4 bit(s) of entropy from bcm_dma0
mbox0:  mem 0xb880-0xb8bf irq 1 on simplebus0
random: device_attach(): feeding 4 bit(s) of entropy from mbox0
sdhci_bcm0:  mem 0x30-0x3000ff irq
70 on simplebus0
sdhci_bcm0-slot0: 50MHz HS 4bits 3.3V 1.8V PIO
sdhci_bcm0-slot0: == REGISTER DUMP ==
sdhci_bcm0-slot0: Sys addr: 0x | Version:  0x9902
sdhci_bcm0-slot0: Blk size: 0x | Blk cnt:  0x
sdhci_bcm0-slot0: Argument: 0x | Trn mode: 0x
sdhci_bcm0-slot0: Present:  0x01ff | Host ctl: 0x
sdhci_bcm0-slot0: Power:0x | Blk gap:  0x
sdhci_bcm0-slot0: Wake-up:  0x | Clock:0x
sdhci_bcm0-slot0: Timeo

Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/m

2014-11-01 Thread Adrian Chadd
Here's what I have so far:

# sysctl kern.random
kern.random.adaptors: yarrow(90),dummy(1)
kern.random.active_adaptor: yarrow
kern.random.live_entropy_sources:
kern.random.yarrow.gengateinterval: 10
kern.random.yarrow.bins: 10
kern.random.yarrow.fastthresh: 96
kern.random.yarrow.slowthresh: 128
kern.random.yarrow.slowoverthresh: 2
kern.random.harvest.mask: 1023
kern.random.harvest.mask_bin: 11
kern.random.harvest.mask_symbolic:
UMA_ALLOC,SWI,INTERRUPT,NET_NG,NET_ETHER,NET_TUN,MOUSE,KEYBOARD,ATTACH,CACHED


.. that's after boot, before I run hostapd and it hangs.

CPU platform: Atheros AR7161 rev 2
CPU Frequency=680 MHz
CPU DDR Frequency=340 MHz
CPU AHB Frequency=170 MHz
platform frequency: 680 MHz
CPU reference clock: 40 MHz
CPU MDIO clock: 40 MHz
arguments:
  a0 = 0007
  a1 = a3f77fb0
  a2 = a3f78460
  a3 = 0008
Cmd line:argv is invalid
Environment:
envp is invalid
Cache info:
  picache_stride= 4096
  picache_loopcount = 16
  pdcache_stride= 4096
  pdcache_loopcount = 8
cpu0: MIPS Technologies processor v116.147
  MMU: Standard TLB, 16 entries
  L1 i-cache: 4 ways of 512 sets, 32 bytes per line
  L1 d-cache: 4 ways of 256 sets, 32 bytes per line
  Config1=0x9ee3519e
  Config3=0x20
KDB: debugger backends: ddb
KDB: current backend: ddb
Copyright (c) 1992-2014 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 11.0-CURRENT #12 r273952M: Sat Nov  1 15:51:09 PDT 2014

adrian@lucy-11i386:/usr/home/adrian/work/freebsd/head-embedded/obj/mips/mips.mips/usr/home/adrian/work/freebsd/head-embedded/src/sys/DIR-825B1
mips
gcc version 4.2.1 20070831 patched [FreeBSD]
WARNING: WITNESS option enabled, expect reduced performance.
MEMGUARD DEBUGGING ALLOCATOR INITIALIZED:
MEMGUARD map base: 0xc080
MEMGUARD map size: 104860 KBytes
real memory  = 67108864 (65536K bytes)
avail memory = 53735424 (51MB)
random device not loaded/active; using insecure pseudo-random number generator
random: entropy device infrastructure driver
random: random_adaptors_init
random: selecting highest priority adaptor 
random: random_adaptor_choose - changing from NULL to Dummy
random: dummy_random_init
random: SOFT: yarrow init()
random: selecting highest priority adaptor 
random: random_adaptor_choose - changing from Dummy to Yarrow
random: random_harvestq_init
nexus0: 
clock0:  on nexus0
Timecounter "MIPS32" frequency 34000 Hz quality 800
Event timer "MIPS32" frequency 34000 Hz quality 800
random: device_attach(): feeding 4 bit(s) of entropy from clock0
apb0 at irq 4 on nexus0
uart0: <16550 or compatible> at mem 0x18020003-0x1802001a irq 3 on apb0
uart0: console (115200,n,8,1)
random: device_attach(): feeding 4 bit(s) of entropy from uart0
random: device_attach(): feeding 4 bit(s) of entropy from apb0
pcib0 at irq 0 on nexus0
pcib0: ar71xx_pci_attach: missing hint 'baseslot', default to
AR71XX_PCI_BASE_SLOT
pcib0: found EEPROM at 0x1f661000 on 0.17.0
  reg: 6000, val=29168c
  reg: 6008, val=281
  reg: 602c, val=a095168c
  reg: 5000, val=2a168c
  reg: 5008, val=281
  reg: 502c, val=a095168c
  reg: 5064, val=5040cc0
  reg: 506c, val=33811
  reg: 4004, val=40073b
  reg: 4074, val=3
  reg: 4000, val=1c2
  reg: 6034, val=44
pcib0: EEPROM firmware: 0x1f661000 @ 4096 bytes
pcib0: device EEPROM 'pcib.0.bus.0.17.0.eeprom_firmware' registered
pcib0: found EEPROM at 0x1f665000 on 0.18.0
  reg: 6000, val=29168c
  reg: 6008, val=281
  reg: 602c, val=a094168c
  reg: 5000, val=2a168c
  reg: 5008, val=281
  reg: 502c, val=a094168c
  reg: 5064, val=5040cc0
  reg: 506c, val=33811
  reg: 4004, val=40073b
  reg: 4074, val=3
  reg: 4000, val=1c2
  reg: 6034, val=44
pcib0: EEPROM firmware: 0x1f665000 @ 4096 bytes
pcib0: device EEPROM 'pcib.0.bus.0.18.0.eeprom_firmware' registered
pci0:  on pcib0
pci0:  at device 17.0 (no driver attached)
pci0:  at device 18.0 (no driver attached)
random: device_attach(): feeding 4 bit(s) of entropy from pci0
random: device_attach(): feeding 4 bit(s) of entropy from pcib0
arge0:  at mem
0x1900-0x19000fff irq 2 on nexus0
arge0: Overriding MAC from EEPROM
arge0: Vendor stores MAC in ASCII format
arge0: finishing attachment, phymask , proxy null
arge0: Ethernet address: 00:18:e7:dd:39:97
random: device_attach(): feeding 4 bit(s) of entropy from arge0
arge1:  at mem
0x1a00-0x1a000fff irq 3 on nexus0
arge1: Overriding MAC from EEPROM
arge1: Vendor stores MAC in ASCII format
arge1: finishing attachment, phymask , proxy null
arge1: Ethernet address: 00:18:e7:dd:39:98
random: device_attach(): feeding 4 bit(s) of entropy from arge1
spi0:  at mem 0x1f00-0x1f0f on nexus0
spibus0:  on spi0
mx25l0:  at cs 0 on spibus0
mx25l0: m25p64, sector 65536 bytes, 128 sectors
random: device_attach(): feeding 4 bit(s) of entropy from mx25l0
random: device_attach(): feeding 4 bit(s) of entr

Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/m

2014-11-01 Thread Alexander Kabaev
On Sat, 1 Nov 2014 22:39:17 +
Mark R V Murray  wrote:

> Hi
> 
> I'm not sure what you are showing me here?
> 
> How yo you draw the "not enough entropy" conclusion?
> 
> The writing happens at shutdown; before you do the shutdown could you
> please do a 'sysctl kern.random' and post the result?
> 
> Do you have anything random-related in your rc.conf?
> 
> Could you please do a verbose boot on a kernel with "options
> RANDOM_DEBUG" set and send me the dmesg output from a failing box.
> 
> M
> 
> > On 1 Nov 2014, at 22:15, Alexander Kabaev  wrote:
> > 
> > On Sat, 1 Nov 2014 14:57:02 -0700
> > Adrian Chadd  wrote:
> > 
> >> Hi,
> >> 
> >> I'm having a problem with this on MIPS router boards now:
> >> 
> >> db> bt 277
> >> Tracing pid 277 tid 100034 td 0x80d7b9c0
> >> cpu_switch+90 (?,?,?,?) ra ca90db68 sp 0 sz 0
> >> sched_switch+224 (?,?,?,?) ra ca90db680028 sp 0 sz 0
> >> mi_switch+27c (?,?,?,?) ra ca90db900020 sp 0 sz 0
> >> 80176358+1a0 (?,?,?,?) ra ca90dbb00028 sp 0 sz 0
> >> 801765dc+2d0 (?,?,?,?) ra ca90dbd80030 sp 0 sz 0
> >> sleepq_timedwait_sig+18 (?,?,?,?) ra ca90dc080020 sp 0 sz 0
> >> _sleep+3b8 (?,?,?,803199e0) ra ca90dc280068 sp 0 sz 0
> >> random_adaptor_read+114 (?,?,?,?) ra ca90dc900038 sp 0 sz 0
> >> 800b1898+c0 (?,?,?,?) ra ca90dcc80048 sp 0 sz 0
> >> 80187450+6c (?,?,?,?) ra ca90dd100028 sp 0 sz 0
> >> kern_readv+8c (?,?,?,?) ra ca90dd380050 sp 0 sz 0
> >> sys_read+48 (?,?,?,?) ra ca90dd880040 sp 0 sz 0
> >> trap+7f0 (?,?,?,?) ra ca90ddc800b8 sp 0 sz 0
> >> MipsUserGenException+10c (?,?,?,408ed960) ra ca90de80 sp 0
> >> sz 0
> >> 
> >> ... I've included "random" into the kernel rather than as a module
> >> now.
> >> 
> >> This -looks- like it's not getting enough entropy now?
> >> 
> >> 
> >> 
> >> -adrian
> >> 
> > 
> > Me too, on amd64 box. The machine gets hung for several minutes
> > after 'writing entropy file' until random is unblocked.
> > Anecdotally, banging on the keyboard trying to help the entropy
> > gathering along seems to speed the process up.
> > 
> > -- 
> > Alexander Kabaev
> 
> -- 
> Mark R V Murray

Nothing related to random in my rc.conf

% sysctl kern.random
kern.random.adaptors: yarrow(90),dummy(1)
kern.random.active_adaptor: yarrow
kern.random.live_entropy_sources: 
kern.random.yarrow.gengateinterval: 10
kern.random.yarrow.bins: 10
kern.random.yarrow.fastthresh: 96
kern.random.yarrow.slowthresh: 128
kern.random.yarrow.slowoverthresh: 2
kern.random.harvest.mask: 1023
kern.random.harvest.mask_bin: 11
kern.random.harvest.mask_symbolic:
UMA_ALLOC,SWI,INTERRUPT,NET_NG,NET_ETHER,NET_TUN,MOUSE,KEYBOARD,ATTACH,CACHED

-- 
Alexander Kabaev


pgpLd9tYv2q6V.pgp
Description: OpenPGP digital signature


Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/m

2014-11-01 Thread Ian Lepore
On Sat, 2014-11-01 at 22:39 +, Mark R V Murray wrote:
> Hi
> 
> I’m not sure what you are showing me here?
> 
> How yo you draw the “not enough entropy” conclusion?
> 
> The writing happens at shutdown; before you do the shutdown could you please 
> do a ‘sysctl kern.random’ and post the result?
> 

I'm not sure where you're getting "at shutdown" from.  Everyone
reporting these problems has been pretty clear that it's happening at
boot time:

...
warning: no time-of-day clock registered, system time will not be set accurately
warning: no time-of-day clock registered, system time will not be set accurately
Interface ue0 IP-Address 172.22.42.28 Broadcast 172.22.42.255 
Setting hostuuid: 1d295353-1dd2-11b2-9f30-653cd80a9fc4.
Setting hostid: 0x2896f513.
No suitable dump device was found.
Starting file system checks:
mount_nfs: can't update /var/db/mounttab for 172.22.42.240:/rpi
Mounting local file systems:.
Writing entropy file:

And there it hangs, I guess maybe forever.  In this case it's an R-Pi
running -current that I just sync'd and built fresh from scratch a few
minutes ago:

FreeBSD 11.0-CURRENT #0 r273952: Sat Nov  1 16:27:00 MDT 2014

-- Ian



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

Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/m

2014-11-01 Thread Adrian Chadd
On 1 November 2014 15:39, Mark R V Murray  wrote:
> Hi
>
> I’m not sure what you are showing me here?
>
> How yo you draw the “not enough entropy” conclusion?

This is a kernel backtrace from the hostap process. It's stuck in that
particular read, waiting somewhere in random_adaptor_read().

If I hit ctrl-C on this process, the whole kernel hangs. I'll see if I
can get some ddb output from that.

> The writing happens at shutdown; before you do the shutdown could you please 
> do a ‘sysctl kern.random’ and post the result?

It won't ever get to that point, as it's hanging at startup. :)

> Do you have anything random-related in your rc.conf?

Nope.

> Could you please do a verbose boot on a kernel with “options RANDOM_DEBUG” 
> set and send me the dmesg output from a failing box.

Ok, I'll give that a go.
Thanks,


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

Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/m

2014-11-01 Thread Mark R V Murray
Hi

I’m not sure what you are showing me here?

How yo you draw the “not enough entropy” conclusion?

The writing happens at shutdown; before you do the shutdown could you please do 
a ‘sysctl kern.random’ and post the result?

Do you have anything random-related in your rc.conf?

Could you please do a verbose boot on a kernel with “options RANDOM_DEBUG” set 
and send me the dmesg output from a failing box.

M

> On 1 Nov 2014, at 22:15, Alexander Kabaev  wrote:
> 
> On Sat, 1 Nov 2014 14:57:02 -0700
> Adrian Chadd  wrote:
> 
>> Hi,
>> 
>> I'm having a problem with this on MIPS router boards now:
>> 
>> db> bt 277
>> Tracing pid 277 tid 100034 td 0x80d7b9c0
>> cpu_switch+90 (?,?,?,?) ra ca90db68 sp 0 sz 0
>> sched_switch+224 (?,?,?,?) ra ca90db680028 sp 0 sz 0
>> mi_switch+27c (?,?,?,?) ra ca90db900020 sp 0 sz 0
>> 80176358+1a0 (?,?,?,?) ra ca90dbb00028 sp 0 sz 0
>> 801765dc+2d0 (?,?,?,?) ra ca90dbd80030 sp 0 sz 0
>> sleepq_timedwait_sig+18 (?,?,?,?) ra ca90dc080020 sp 0 sz 0
>> _sleep+3b8 (?,?,?,803199e0) ra ca90dc280068 sp 0 sz 0
>> random_adaptor_read+114 (?,?,?,?) ra ca90dc900038 sp 0 sz 0
>> 800b1898+c0 (?,?,?,?) ra ca90dcc80048 sp 0 sz 0
>> 80187450+6c (?,?,?,?) ra ca90dd100028 sp 0 sz 0
>> kern_readv+8c (?,?,?,?) ra ca90dd380050 sp 0 sz 0
>> sys_read+48 (?,?,?,?) ra ca90dd880040 sp 0 sz 0
>> trap+7f0 (?,?,?,?) ra ca90ddc800b8 sp 0 sz 0
>> MipsUserGenException+10c (?,?,?,408ed960) ra ca90de80 sp 0 sz
>> 0
>> 
>> ... I've included "random" into the kernel rather than as a module
>> now.
>> 
>> This -looks- like it's not getting enough entropy now?
>> 
>> 
>> 
>> -adrian
>> 
> 
> Me too, on amd64 box. The machine gets hung for several minutes after
> 'writing entropy file' until random is unblocked. Anecdotally, banging
> on the keyboard trying to help the entropy gathering along seems to
> speed the process up.
> 
> -- 
> Alexander Kabaev

-- 
Mark R V Murray

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

svn commit: r273953 - in head/sys: dev/hwpmc kern sys

2014-11-01 Thread Mateusz Guzik
Author: mjg
Date: Sat Nov  1 22:36:40 2014
New Revision: 273953
URL: https://svnweb.freebsd.org/changeset/base/273953

Log:
  Fix up module unload for syscall_module_handler consumers.
  
  After r273707 it was registering syscalls as static.
  
  This fixes hwpmc module unload.
  
  Reported by: markj

Modified:
  head/sys/dev/hwpmc/hwpmc_mod.c
  head/sys/kern/kern_syscalls.c
  head/sys/sys/sysent.h

Modified: head/sys/dev/hwpmc/hwpmc_mod.c
==
--- head/sys/dev/hwpmc/hwpmc_mod.c  Sat Nov  1 22:00:46 2014
(r273952)
+++ head/sys/dev/hwpmc/hwpmc_mod.c  Sat Nov  1 22:36:40 2014
(r273953)
@@ -320,7 +320,8 @@ static struct syscall_module_data pmc_sy
NULL,
&pmc_syscall_num,
&pmc_sysent,
-   { 0, NULL }
+   { 0, NULL },
+   SY_THR_STATIC_KLD,
 };
 
 static moduledata_t pmc_mod = {

Modified: head/sys/kern/kern_syscalls.c
==
--- head/sys/kern/kern_syscalls.c   Sat Nov  1 22:00:46 2014
(r273952)
+++ head/sys/kern/kern_syscalls.c   Sat Nov  1 22:36:40 2014
(r273953)
@@ -160,7 +160,7 @@ syscall_module_handler(struct module *mo
switch (what) {
case MOD_LOAD:
error = syscall_register(data->offset, data->new_sysent,
-   &data->old_sysent, SY_THR_STATIC_KLD);
+   &data->old_sysent, data->flags);
if (error) {
/* Leave a mark so we know to safely unload below. */
data->offset = NULL;

Modified: head/sys/sys/sysent.h
==
--- head/sys/sys/sysent.h   Sat Nov  1 22:00:46 2014(r273952)
+++ head/sys/sys/sysent.h   Sat Nov  1 22:36:40 2014(r273953)
@@ -175,6 +175,7 @@ struct syscall_module_data {
int *offset;/* offset into sysent */
struct sysent *new_sysent;  /* new sysent */
struct sysent old_sysent;   /* old sysent */
+   int flags;  /* flags for syscall_register */
 };
 
 #defineMAKE_SYSENT(syscallname)\
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/m

2014-11-01 Thread Adrian Chadd
Yeah I can't do that for a wireless AP.

Oh, and if I hit Ctrl-C, the whole system hangs! :(


-adrian


On 1 November 2014 15:15, Alexander Kabaev  wrote:
> On Sat, 1 Nov 2014 14:57:02 -0700
> Adrian Chadd  wrote:
>
>> Hi,
>>
>> I'm having a problem with this on MIPS router boards now:
>>
>> db> bt 277
>> Tracing pid 277 tid 100034 td 0x80d7b9c0
>> cpu_switch+90 (?,?,?,?) ra ca90db68 sp 0 sz 0
>> sched_switch+224 (?,?,?,?) ra ca90db680028 sp 0 sz 0
>> mi_switch+27c (?,?,?,?) ra ca90db900020 sp 0 sz 0
>> 80176358+1a0 (?,?,?,?) ra ca90dbb00028 sp 0 sz 0
>> 801765dc+2d0 (?,?,?,?) ra ca90dbd80030 sp 0 sz 0
>> sleepq_timedwait_sig+18 (?,?,?,?) ra ca90dc080020 sp 0 sz 0
>> _sleep+3b8 (?,?,?,803199e0) ra ca90dc280068 sp 0 sz 0
>> random_adaptor_read+114 (?,?,?,?) ra ca90dc900038 sp 0 sz 0
>> 800b1898+c0 (?,?,?,?) ra ca90dcc80048 sp 0 sz 0
>> 80187450+6c (?,?,?,?) ra ca90dd100028 sp 0 sz 0
>> kern_readv+8c (?,?,?,?) ra ca90dd380050 sp 0 sz 0
>> sys_read+48 (?,?,?,?) ra ca90dd880040 sp 0 sz 0
>> trap+7f0 (?,?,?,?) ra ca90ddc800b8 sp 0 sz 0
>> MipsUserGenException+10c (?,?,?,408ed960) ra ca90de80 sp 0 sz
>> 0
>>
>> ... I've included "random" into the kernel rather than as a module
>> now.
>>
>> This -looks- like it's not getting enough entropy now?
>>
>>
>>
>> -adrian
>>
>
> Me too, on amd64 box. The machine gets hung for several minutes after
> 'writing entropy file' until random is unblocked. Anecdotally, banging
> on the keyboard trying to help the entropy gathering along seems to
> speed the process up.
>
> --
> Alexander Kabaev
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/m

2014-11-01 Thread Alexander Kabaev
On Sat, 1 Nov 2014 14:57:02 -0700
Adrian Chadd  wrote:

> Hi,
> 
> I'm having a problem with this on MIPS router boards now:
> 
> db> bt 277
> Tracing pid 277 tid 100034 td 0x80d7b9c0
> cpu_switch+90 (?,?,?,?) ra ca90db68 sp 0 sz 0
> sched_switch+224 (?,?,?,?) ra ca90db680028 sp 0 sz 0
> mi_switch+27c (?,?,?,?) ra ca90db900020 sp 0 sz 0
> 80176358+1a0 (?,?,?,?) ra ca90dbb00028 sp 0 sz 0
> 801765dc+2d0 (?,?,?,?) ra ca90dbd80030 sp 0 sz 0
> sleepq_timedwait_sig+18 (?,?,?,?) ra ca90dc080020 sp 0 sz 0
> _sleep+3b8 (?,?,?,803199e0) ra ca90dc280068 sp 0 sz 0
> random_adaptor_read+114 (?,?,?,?) ra ca90dc900038 sp 0 sz 0
> 800b1898+c0 (?,?,?,?) ra ca90dcc80048 sp 0 sz 0
> 80187450+6c (?,?,?,?) ra ca90dd100028 sp 0 sz 0
> kern_readv+8c (?,?,?,?) ra ca90dd380050 sp 0 sz 0
> sys_read+48 (?,?,?,?) ra ca90dd880040 sp 0 sz 0
> trap+7f0 (?,?,?,?) ra ca90ddc800b8 sp 0 sz 0
> MipsUserGenException+10c (?,?,?,408ed960) ra ca90de80 sp 0 sz
> 0
> 
> ... I've included "random" into the kernel rather than as a module
> now.
> 
> This -looks- like it's not getting enough entropy now?
> 
> 
> 
> -adrian
> 

Me too, on amd64 box. The machine gets hung for several minutes after
'writing entropy file' until random is unblocked. Anecdotally, banging
on the keyboard trying to help the entropy gathering along seems to
speed the process up.

-- 
Alexander Kabaev


pgpqoadi7RLpT.pgp
Description: OpenPGP digital signature


svn commit: r273952 - head/contrib/netbsd-tests/lib/libc/hash

2014-11-01 Thread Garrett Cooper
Author: ngie
Date: Sat Nov  1 22:00:46 2014
New Revision: 273952
URL: https://svnweb.freebsd.org/changeset/base/273952

Log:
  Port h_hash and t_sha2 to FreeBSD
  
  t_sha2 contains dirty copy-paste hacks that need to be fixed with the openssh
  OpenBSD compat layer
  
  Submitted by: pho

Modified:
  head/contrib/netbsd-tests/lib/libc/hash/h_hash.c
  head/contrib/netbsd-tests/lib/libc/hash/t_sha2.c

Modified: head/contrib/netbsd-tests/lib/libc/hash/h_hash.c
==
--- head/contrib/netbsd-tests/lib/libc/hash/h_hash.cSat Nov  1 21:30:18 
2014(r273951)
+++ head/contrib/netbsd-tests/lib/libc/hash/h_hash.cSat Nov  1 22:00:46 
2014(r273952)
@@ -35,8 +35,13 @@
 #include 
 #include 
 #include 
+#ifdef __NetBSD__
 #include 
+#endif
 
+#ifdef __FreeBSD__
+#include 
+#endif
 
 int mflag, rflag, sflag, tflag;
 
@@ -102,17 +107,32 @@ regress(void)
MD5Final(out, &ctx);
outlen = 16;
} else {
+#ifdef __FreeBSD__
+   SHA_CTX ctx;
+
+   SHA1_Init(&ctx);
+   SHA1_Update(&ctx, buf, len);
+#else
SHA1_CTX ctx;
 
SHA1Init(&ctx);
SHA1Update(&ctx, buf, len);
+#endif
while (!last &&
fgets((char *)buf, sizeof(buf), stdin) != NULL) {
len = strlen((char *)buf);
CHOMP(buf, len, last);  
+#ifdef __FreeBSD__
+   SHA1_Update(&ctx, buf, len);
+#else
SHA1Update(&ctx, buf, len);
+#endif
}
+#ifdef __FreeBSD__
+   SHA1_Final(out, &ctx);
+#else
SHA1Final(out, &ctx);
+#endif
outlen = 20;
}
hexdump(out, outlen);

Modified: head/contrib/netbsd-tests/lib/libc/hash/t_sha2.c
==
--- head/contrib/netbsd-tests/lib/libc/hash/t_sha2.cSat Nov  1 21:30:18 
2014(r273951)
+++ head/contrib/netbsd-tests/lib/libc/hash/t_sha2.cSat Nov  1 22:00:46 
2014(r273952)
@@ -36,9 +36,23 @@ __RCSID("$NetBSD: t_sha2.c,v 1.3 2012/09
 
 #include 
 #include 
+#ifdef __NetBSD__
 #include 
+#endif
 #include 
 
+#ifdef __FreeBSD__
+#include 
+typedef SHA512_CTX SHA384_CTX;
+/* From /usr/src/crypto/openssh/openbsd-compat/sha2.h */
+#define SHA256_DIGEST_LENGTH   32
+#define SHA256_DIGEST_STRING_LENGTH(SHA256_DIGEST_LENGTH * 2 + 1)
+#define SHA384_DIGEST_LENGTH   48
+#define SHA384_DIGEST_STRING_LENGTH(SHA384_DIGEST_LENGTH * 2 + 1)
+#define SHA512_DIGEST_LENGTH   64
+#define SHA512_DIGEST_STRING_LENGTH(SHA512_DIGEST_LENGTH * 2 + 1)
+#endif
+
 ATF_TC(t_sha256);
 ATF_TC(t_sha384);
 ATF_TC(t_sha512);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/m

2014-11-01 Thread Adrian Chadd
Hi,

I'm having a problem with this on MIPS router boards now:

db> bt 277
Tracing pid 277 tid 100034 td 0x80d7b9c0
cpu_switch+90 (?,?,?,?) ra ca90db68 sp 0 sz 0
sched_switch+224 (?,?,?,?) ra ca90db680028 sp 0 sz 0
mi_switch+27c (?,?,?,?) ra ca90db900020 sp 0 sz 0
80176358+1a0 (?,?,?,?) ra ca90dbb00028 sp 0 sz 0
801765dc+2d0 (?,?,?,?) ra ca90dbd80030 sp 0 sz 0
sleepq_timedwait_sig+18 (?,?,?,?) ra ca90dc080020 sp 0 sz 0
_sleep+3b8 (?,?,?,803199e0) ra ca90dc280068 sp 0 sz 0
random_adaptor_read+114 (?,?,?,?) ra ca90dc900038 sp 0 sz 0
800b1898+c0 (?,?,?,?) ra ca90dcc80048 sp 0 sz 0
80187450+6c (?,?,?,?) ra ca90dd100028 sp 0 sz 0
kern_readv+8c (?,?,?,?) ra ca90dd380050 sp 0 sz 0
sys_read+48 (?,?,?,?) ra ca90dd880040 sp 0 sz 0
trap+7f0 (?,?,?,?) ra ca90ddc800b8 sp 0 sz 0
MipsUserGenException+10c (?,?,?,408ed960) ra ca90de80 sp 0 sz 0

... I've included "random" into the kernel rather than as a module now.

This -looks- like it's not getting enough entropy now?



-adrian


On 30 October 2014 14:21, Mark Murray  wrote:
> Author: markm
> Date: Thu Oct 30 21:21:53 2014
> New Revision: 273872
> URL: https://svnweb.freebsd.org/changeset/base/273872
>
> Log:
>   This is the much-discussed major upgrade to the random(4) device, known to 
> you all as /dev/random.
>
>   This code has had an extensive rewrite and a good series of reviews, both 
> by the author and other parties. This means a lot of code has been 
> simplified. Pluggable structures for high-rate entropy generators are 
> available, and it is most definitely not the case that /dev/random can be 
> driven by only a hardware souce any more. This has been designed out of the 
> device. Hardware sources are stirred into the CSPRNG (Yarrow, Fortuna) like 
> any other entropy source. Pluggable modules may be written by third parties 
> for additional sources.
>
>   The harvesting structures and consequently the locking have been 
> simplified. Entropy harvesting is done in a more general way (the 
> documentation for this will follow). There is some GREAT entropy to be had in 
> the UMA allocator, but it is disabled for now as messing with that is likely 
> to annoy many people.
>
>   The venerable (but effective) Yarrow algorithm, which is no longer 
> supported by its authors now has an alternative, Fortuna. For now, Yarrow is 
> retained as the default algorithm, but this may be changed using a kernel 
> option. It is intended to make Fortuna the default algorithm for 11.0. 
> Interested parties are encouraged to read ISBN 978-0-470-47424-2 
> "Cryptography Engineering" By Ferguson, Schneier and Kohno for Fortuna's gory 
> details. Heck, read it anyway.
>
>   Many thanks to Arthur Mesh who did early grunt work, and who got caught in 
> the crossfire rather more than he deserved to.
>
>   My thanks also to folks who helped me thresh this out on whiteboards and in 
> the odd "Hallway track", or otherwise.
>
>   My Nomex pants are on. Let the feedback commence!
>
>   Reviewed by:  trasz,des(partial),imp(partial?),rwatson(partial?)
>   Approved by:  so(des)
>
> Added:
>   head/sys/dev/random/build.sh   (contents, props changed)
>   head/sys/dev/random/fortuna.c   (contents, props changed)
>   head/sys/dev/random/fortuna.h   (contents, props changed)
>   head/sys/dev/random/uint128.h   (contents, props changed)
>   head/sys/dev/random/unit_test.c   (contents, props changed)
>   head/sys/dev/random/unit_test.h   (contents, props changed)
>   head/sys/modules/padlock_rng/
>   head/sys/modules/padlock_rng/Makefile   (contents, props changed)
>   head/sys/modules/rdrand_rng/
>   head/sys/modules/rdrand_rng/Makefile   (contents, props changed)
> Deleted:
>   head/etc/rc.d/initrandom
>   head/sys/dev/random/harvest.c
>   head/sys/dev/random/rwfile.c
>   head/sys/dev/random/rwfile.h
> Modified:
>   head/etc/defaults/rc.conf
>   head/etc/rc.d/Makefile
>   head/etc/rc.d/geli
>   head/etc/rc.d/postrandom
>   head/etc/rc.d/random
>   head/libexec/save-entropy/save-entropy.sh
>   head/share/examples/kld/random_adaptor/random_adaptor_example.c
>   head/sys/conf/NOTES
>   head/sys/conf/files
>   head/sys/conf/options
>   head/sys/dev/glxsb/glxsb.c
>   head/sys/dev/random/dummy_rng.c
>   head/sys/dev/random/hash.c
>   head/sys/dev/random/hash.h
>   head/sys/dev/random/ivy.c
>   head/sys/dev/random/live_entropy_sources.c
>   head/sys/dev/random/live_entropy_sources.h
>   head/sys/dev/random/nehemiah.c
>   head/sys/dev/random/random_adaptors.c
>   head/sys/dev/random/random_adaptors.h
>   head/sys/dev/random/random_harvestq.c
>   head/sys/dev/random/random_harvestq.h
>   head/sys/dev/random/randomdev.c
>   head/sys/dev/random/randomdev.h
>   head/sys/dev/random/randomdev_soft.c
>   head/sys/dev/random/randomdev_soft.h
>   head/sys/dev/random/yarrow.c
>   head/sys/dev/random/yarrow.h
>   head/sys/kern/init_main.c
>   head/sys/kern/kern_intr.c
>   head/sys/kern/subr_bus.c
>   head/sys/modules/Makefile
>   head/sys/modul

svn commit: r273951 - head/contrib/netbsd-tests/lib/libc/stdio

2014-11-01 Thread Garrett Cooper
Author: ngie
Date: Sat Nov  1 21:30:18 2014
New Revision: 273951
URL: https://svnweb.freebsd.org/changeset/base/273951

Log:
  Expect :sscanf_whitespace to fail on !NetBSD OSes
  
  Submitted by: pho

Modified:
  head/contrib/netbsd-tests/lib/libc/stdio/t_scanf.c

Modified: head/contrib/netbsd-tests/lib/libc/stdio/t_scanf.c
==
--- head/contrib/netbsd-tests/lib/libc/stdio/t_scanf.c  Sat Nov  1 21:25:22 
2014(r273950)
+++ head/contrib/netbsd-tests/lib/libc/stdio/t_scanf.c  Sat Nov  1 21:30:18 
2014(r273951)
@@ -64,6 +64,10 @@ ATF_TC_BODY(sscanf_whitespace, tc)
const char str[] = "\f\n\r\t\v%z";
char c;
 
+#ifndef __NetBSD__
+   atf_tc_expect_fail("fails on FreeBSD and some variants of Linux");
+#endif
+
 /* set of "white space" symbols from isspace(3) */
 c = 0;
 (void)sscanf(str, "%%%c", &c);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r273950 - head/contrib/netbsd-tests/lib/libc/stdio

2014-11-01 Thread Garrett Cooper
Author: ngie
Date: Sat Nov  1 21:25:22 2014
New Revision: 273950
URL: https://svnweb.freebsd.org/changeset/base/273950

Log:
  Skip :fopen_regular on !NetBSD because it's a NetBSD specific test
  
  Submitted by: pho

Modified:
  head/contrib/netbsd-tests/lib/libc/stdio/t_fopen.c

Modified: head/contrib/netbsd-tests/lib/libc/stdio/t_fopen.c
==
--- head/contrib/netbsd-tests/lib/libc/stdio/t_fopen.c  Sat Nov  1 21:23:27 
2014(r273949)
+++ head/contrib/netbsd-tests/lib/libc/stdio/t_fopen.c  Sat Nov  1 21:25:22 
2014(r273950)
@@ -434,7 +434,9 @@ ATF_TP_ADD_TCS(tp)
ATF_TP_ADD_TC(tp, fopen_err);
ATF_TP_ADD_TC(tp, fopen_mode);
ATF_TP_ADD_TC(tp, fopen_perm);
+#ifdef __NetBSD__
ATF_TP_ADD_TC(tp, fopen_regular);
+#endif
ATF_TP_ADD_TC(tp, fopen_seek);
ATF_TP_ADD_TC(tp, freopen_std);
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r273949 - head/contrib/netbsd-tests/lib/libc/stdio

2014-11-01 Thread Garrett Cooper
Author: ngie
Date: Sat Nov  1 21:23:27 2014
New Revision: 273949
URL: https://svnweb.freebsd.org/changeset/base/273949

Log:
  Add new atf_tc_expect_fail to fflush_err; this is a new (within the past 
couple months) bug

Modified:
  head/contrib/netbsd-tests/lib/libc/stdio/t_fflush.c

Modified: head/contrib/netbsd-tests/lib/libc/stdio/t_fflush.c
==
--- head/contrib/netbsd-tests/lib/libc/stdio/t_fflush.c Sat Nov  1 21:21:06 
2014(r273948)
+++ head/contrib/netbsd-tests/lib/libc/stdio/t_fflush.c Sat Nov  1 21:23:27 
2014(r273949)
@@ -48,6 +48,10 @@ ATF_TC_BODY(fflush_err, tc)
 {
FILE *f;
 
+#ifdef __FreeBSD__
+   atf_tc_expect_fail("the EOF invariant fails on FreeBSD; this is new");
+#endif
+
f = fopen(path, "w");
 
ATF_REQUIRE(f != NULL);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r273948 - head/contrib/netbsd-tests/lib/libc/stdio

2014-11-01 Thread Garrett Cooper
Author: ngie
Date: Sat Nov  1 21:21:06 2014
New Revision: 273948
URL: https://svnweb.freebsd.org/changeset/base/273948

Log:
  Disable testcases 12 and 15-22 on FreeBSD
  
  Submitted by: pho

Modified:
  head/contrib/netbsd-tests/lib/libc/stdio/t_fmemopen.c

Modified: head/contrib/netbsd-tests/lib/libc/stdio/t_fmemopen.c
==
--- head/contrib/netbsd-tests/lib/libc/stdio/t_fmemopen.c   Sat Nov  1 
21:00:40 2014(r273947)
+++ head/contrib/netbsd-tests/lib/libc/stdio/t_fmemopen.c   Sat Nov  1 
21:21:06 2014(r273948)
@@ -27,7 +27,7 @@
  *
  */
 
-#if defined(__NetBSD__)
+#if defined(__FreeBSD__) || defined(__NetBSD__)
 #include 
 #else
 #if defined(__linux__)
@@ -563,6 +563,7 @@ ATF_TC_BODY(test11, tc)
}
 }
 
+#ifndef __FreeBSD__
 ATF_TC(test12);
 ATF_TC_HEAD(test12, tc)
 {
@@ -620,6 +621,7 @@ ATF_TC_BODY(test12, tc)
}
}
 }
+#endif
 
 ATF_TC(test13);
 ATF_TC_HEAD(test13, tc)
@@ -629,7 +631,9 @@ ATF_TC_HEAD(test13, tc)
 ATF_TC_BODY(test13, tc)
 {
struct testcase *t;
+#ifndef __FreeBSD__
off_t i;
+#endif
const char **p;
char buf[BUFSIZ];
FILE *fp;
@@ -659,7 +663,9 @@ ATF_TC_BODY(test13, tc)
/* negative + OOB */
ATF_CHECK(fseeko(fp, -1, SEEK_END) == -1);
ATF_CHECK(ftello(fp) == (off_t)0);
+#endif
 
+#ifndef __FreeBSD__
/* positive */
for (i = 1; i <= t->n; ++i) {
ATF_CHECK(fseeko(fp, i, SEEK_END) == 0);
@@ -711,11 +717,13 @@ ATF_TC_BODY(test14, tc)
ATF_CHECK(fseeko(fp, -(len + 1), SEEK_END) == -1);
ATF_CHECK(ftello(fp) == len);
 
+#ifndef __FreeBSD__
/* positive */
for (i = 1; i <= rest; ++i) {
ATF_CHECK(fseeko(fp, i, SEEK_END) == 0);
ATF_CHECK(ftello(fp) == len + i);
}
+#endif
 
/* negative */
for (i = 1; i < len; ++i) {
@@ -734,6 +742,8 @@ const char *mode_rw1[] = {
 NULL
 };
 
+#ifndef __FreeBSD__
+
 /* test15 - 18:
  * When a stream open for writing is flushed or closed, a null byte is written
  * at the current position or at the end of the buffer, depending on the size
@@ -1135,6 +1145,7 @@ ATF_TC_BODY(test22, tc)
}
}
 }
+#endif
 
 ATF_TP_ADD_TCS(tp)
 {
@@ -1150,9 +1161,12 @@ ATF_TP_ADD_TCS(tp)
ATF_TP_ADD_TC(tp, test09);
ATF_TP_ADD_TC(tp, test10);
ATF_TP_ADD_TC(tp, test11);
+#ifndef __FreeBSD__
ATF_TP_ADD_TC(tp, test12);
+#endif
ATF_TP_ADD_TC(tp, test13);
ATF_TP_ADD_TC(tp, test14);
+#ifndef __FreeBSD__
ATF_TP_ADD_TC(tp, test15);
ATF_TP_ADD_TC(tp, test16);
ATF_TP_ADD_TC(tp, test17);
@@ -1161,6 +1175,7 @@ ATF_TP_ADD_TCS(tp)
ATF_TP_ADD_TC(tp, test20);
ATF_TP_ADD_TC(tp, test21);
ATF_TP_ADD_TC(tp, test22);
+#endif
 
return atf_no_error();
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r273947 - head/contrib/netbsd-tests/lib/libc/stdio

2014-11-01 Thread Garrett Cooper
Author: ngie
Date: Sat Nov  1 21:00:40 2014
New Revision: 273947
URL: https://svnweb.freebsd.org/changeset/base/273947

Log:
  Expect :snprintf_posarg_error to blow up with a SIGSEGV on !NetBSD OSes

Modified:
  head/contrib/netbsd-tests/lib/libc/stdio/t_printf.c

Modified: head/contrib/netbsd-tests/lib/libc/stdio/t_printf.c
==
--- head/contrib/netbsd-tests/lib/libc/stdio/t_printf.c Sat Nov  1 20:50:39 
2014(r273946)
+++ head/contrib/netbsd-tests/lib/libc/stdio/t_printf.c Sat Nov  1 21:00:40 
2014(r273947)
@@ -36,6 +36,10 @@
 #include 
 #include 
 
+#ifndef __NetBSD__
+#include 
+#endif
+
 ATF_TC(snprintf_c99);
 ATF_TC_HEAD(snprintf_c99, tc)
 {
@@ -116,6 +120,12 @@ ATF_TC_BODY(snprintf_posarg_error, tc)
 {
char s[16], fmt[32];
 
+#ifndef __NetBSD__
+   atf_tc_expect_signal(SIGSEGV,
+   "some non-NetBSD platforms including FreeBSD don't validate "
+   "negative size; testcase blows up with SIGSEGV");
+#endif
+
snprintf(fmt, sizeof(fmt), "%%%zu$d", SIZE_MAX / sizeof(size_t));
 
ATF_CHECK(snprintf(s, sizeof(s), fmt, -23) == -1);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r273946 - head/contrib/netbsd-tests/lib/libc/stdlib

2014-11-01 Thread Garrett Cooper
Author: ngie
Date: Sat Nov  1 20:50:39 2014
New Revision: 273946
URL: https://svnweb.freebsd.org/changeset/base/273946

Log:
  Port h_atexit to FreeBSD
  
  __cxa_atexit varies between FreeBSD and NetBSD, and thus we must use pointers
  instead of static fields in the BSS. More extensive discussion is included in
  the source code
  
  In collaboration with: kib
  Submitted by: pho

Modified:
  head/contrib/netbsd-tests/lib/libc/stdlib/h_atexit.c

Modified: head/contrib/netbsd-tests/lib/libc/stdlib/h_atexit.c
==
--- head/contrib/netbsd-tests/lib/libc/stdlib/h_atexit.cSat Nov  1 
20:45:45 2014(r273945)
+++ head/contrib/netbsd-tests/lib/libc/stdlib/h_atexit.cSat Nov  1 
20:50:39 2014(r273946)
@@ -42,9 +42,33 @@ __RCSID("$NetBSD: h_atexit.c,v 1.1 2011/
 extern int __cxa_atexit(void (*func)(void *), void *, void *);
 extern void __cxa_finalize(void *);
 
+#if defined(__FreeBSD__)
+/*
+ * On shared object unload, in __cxa_finalize, call and clear all installed
+ * atexit and __cxa_atexit handlers that are either installed by unloaded
+ * dso, or points to the functions provided by the dso.
+ *
+ * The reason of the change is to ensure that there is no lingering pointers
+ * to the unloaded code after the dlclose(3).  It is known reason for infinite
+ * stream of the crash reports for many programs which use loadable modules
+ * and fail to properly clean on module unload.  Examples are apache, php,
+ * perl etc.
+ *
+ * You pass the &dso_handle_1 and &dso_handle_2, which points inside the
+ * main binary, to the registration function.  The code from r211706,
+ * correctly detects that they are for the main binary, and on the first
+ * call to __cxa_finalize(), which also pass pointer to main binary, all
+ * registered functions from the main binary are executed.
+ */
+
+static void *dso_handle_1 = (void *)1;
+static void *dso_handle_2 = (void *)2;
+static void *dso_handle_3 = (void *)3;
+#else
 static int dso_handle_1;
 static int dso_handle_2;
 static int dso_handle_3;
+#endif
 
 static int arg_1;
 static int arg_2;
@@ -167,6 +191,15 @@ main(int argc, char *argv[])
 
ASSERT(0 == atexit(normal_handler_0));
ASSERT(0 == atexit(normal_handler_1));
+#if defined(__FreeBSD__)
+   ASSERT(0 == __cxa_atexit(cxa_handler_4, &arg_1, dso_handle_1));
+   ASSERT(0 == __cxa_atexit(cxa_handler_5, &arg_1, dso_handle_1));
+   ASSERT(0 == __cxa_atexit(cxa_handler_3, &arg_2, dso_handle_2));
+   ASSERT(0 == __cxa_atexit(cxa_handler_2, &arg_3, dso_handle_3));
+
+   __cxa_finalize(dso_handle_1);
+   __cxa_finalize(dso_handle_2);
+#else
ASSERT(0 == __cxa_atexit(cxa_handler_4, &arg_1, &dso_handle_1));
ASSERT(0 == __cxa_atexit(cxa_handler_5, &arg_1, &dso_handle_1));
ASSERT(0 == __cxa_atexit(cxa_handler_3, &arg_2, &dso_handle_2));
@@ -174,5 +207,6 @@ main(int argc, char *argv[])
 
__cxa_finalize(&dso_handle_1);
__cxa_finalize(&dso_handle_2);
+#endif
exit(0);
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r273945 - head/contrib/netbsd-tests/lib/libc/sys

2014-11-01 Thread Garrett Cooper
Author: ngie
Date: Sat Nov  1 20:45:45 2014
New Revision: 273945
URL: https://svnweb.freebsd.org/changeset/base/273945

Log:
  Port t_mincore to FreeBSD
  
  Mark :mincore_resid as atf_tc_expect_fail on FreeBSD because of new bug
  discovered in running the tests (it succeeded from earlier on in the year to
  September/October on FreeBSD, at least)
  
  Submitted by: pho

Modified:
  head/contrib/netbsd-tests/lib/libc/sys/t_mincore.c

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_mincore.c
==
--- head/contrib/netbsd-tests/lib/libc/sys/t_mincore.c  Sat Nov  1 20:41:47 
2014(r273944)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_mincore.c  Sat Nov  1 20:45:45 
2014(r273945)
@@ -74,6 +74,10 @@ __RCSID("$NetBSD: t_mincore.c,v 1.8 2012
 #include 
 #include 
 
+#ifdef __FreeBSD__
+#include 
+#endif
+
 static longpage = 0;
 static const char  path[] = "mincore";
 static size_t  check_residency(void *, size_t);
@@ -121,8 +125,10 @@ ATF_TC_BODY(mincore_err, tc)
ATF_REQUIRE(vec != NULL);
ATF_REQUIRE(map != MAP_FAILED);
 
+#ifdef __NetBSD__
errno = 0;
ATF_REQUIRE_ERRNO(EINVAL, mincore(map, 0, vec) == -1);
+#endif
 
errno = 0;
ATF_REQUIRE_ERRNO(ENOMEM, mincore(0, page, vec) == -1);
@@ -187,13 +193,24 @@ ATF_TC_BODY(mincore_resid, tc)
 
npgs = 128;
 
+#ifdef __FreeBSD__
+   addr = mmap(NULL, npgs * page, PROT_READ | PROT_WRITE,
+   MAP_ANON | MAP_PRIVATE, -1, (off_t)0);
+#else
addr = mmap(NULL, npgs * page, PROT_READ | PROT_WRITE,
MAP_ANON | MAP_PRIVATE | MAP_WIRED, -1, (off_t)0);
+#endif
 
if (addr == MAP_FAILED)
atf_tc_skip("could not mmap wired anonymous test area, system "
"might be low on memory");
 
+#ifdef __FreeBSD__
+   atf_tc_expect_fail("the following calls fail; this seems to be a new "
+   "issue (didn't occur in 07/2014)");
+
+   ATF_REQUIRE(mlock(addr, npgs * page) == 0);
+#endif
ATF_REQUIRE(check_residency(addr, npgs) == npgs);
ATF_REQUIRE(munmap(addr, npgs * page) == 0);
 
@@ -238,12 +255,16 @@ ATF_TC_BODY(mincore_resid, tc)
(void)munlockall();
 
ATF_REQUIRE(madvise(addr2, npgs * page, MADV_FREE) == 0);
+#ifdef __NetBSD__
ATF_REQUIRE(check_residency(addr2, npgs) == 0);
+#endif
 
(void)memset(addr, 0, npgs * page);
 
ATF_REQUIRE(madvise(addr, npgs * page, MADV_FREE) == 0);
+#ifdef __NetBSD__
ATF_REQUIRE(check_residency(addr, npgs) == 0);
+#endif
 
(void)munmap(addr, npgs * page);
(void)munmap(addr2, npgs * page);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r273943 - head/contrib/netbsd-tests/lib/libc/sys

2014-11-01 Thread Garrett Cooper
Author: ngie
Date: Sat Nov  1 20:41:40 2014
New Revision: 273943
URL: https://svnweb.freebsd.org/changeset/base/273943

Log:
  Port t_kevent to FreeBSD
  
  Submitted by: pho

Modified:
  head/contrib/netbsd-tests/lib/libc/sys/t_kevent.c

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_kevent.c
==
--- head/contrib/netbsd-tests/lib/libc/sys/t_kevent.c   Sat Nov  1 20:33:42 
2014(r273942)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_kevent.c   Sat Nov  1 20:41:40 
2014(r273943)
@@ -43,12 +43,18 @@ __RCSID("$NetBSD: t_kevent.c,v 1.6 2012/
 #include 
 #include 
 #include 
+#ifdef __NetBSD__
 #include 
+#endif
 #include 
 #include 
 #include 
 #include 
 
+#ifdef __FreeBSD__
+#defineDRVCTLDEV "/nonexistent"
+#endif
+
 ATF_TC(kevent_zerotimer);
 ATF_TC_HEAD(kevent_zerotimer, tc)
 {
@@ -108,9 +114,15 @@ ATF_TC_BODY(kqueue_desc_passing, tc)
if (recvmsg(s[1], &m, 0) == -1)
err(1, "child: could not recvmsg");
 
+#ifdef __FreeBSD__
+   bcopy(CMSG_DATA(msg), &kq, sizeof(kq));
+   printf("child (pid %d): received kq fd %d\n", getpid(), kq);
+   _exit(0);
+#else
kq = *(int *)CMSG_DATA(msg);
printf("child (pid %d): received kq fd %d\n", getpid(), kq);
exit(0);
+#endif
}
 
close(s[1]);
@@ -122,15 +134,29 @@ ATF_TC_BODY(kqueue_desc_passing, tc)
msg->cmsg_type = SCM_RIGHTS;
msg->cmsg_len = CMSG_LEN(sizeof(int));
 
+#ifdef __FreeBSD__
+   /* 
+* What is should have been
+*   bcopy(&s[0], CMSG_DATA(msg), sizeof(kq));
+*/
+   bcopy(&kq, CMSG_DATA(msg), sizeof(kq));
+#else
*(int *)CMSG_DATA(msg) = kq;
+#endif
 
EV_SET(&ev, 1, EVFILT_TIMER, EV_ADD|EV_ENABLE, 0, 1, 0);
ATF_CHECK(kevent(kq, &ev, 1, NULL, 0, NULL) != -1);
 
printf("parent (pid %d): sending kq fd %d\n", getpid(), kq);
if (sendmsg(s[0], &m, 0) == -1) {
+#if defined(__NetBSD__)
ATF_REQUIRE_EQ_MSG(errno, EBADF, "errno is %d", errno);
atf_tc_skip("PR kern/46523");
+#endif
+#if defined(__FreeBSD__)
+   ATF_REQUIRE_EQ_MSG(errno, EOPNOTSUPP, "errno is %d", errno);
+   close(s[0]);
+#endif
}
 
close(kq);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r273942 - head/contrib/netbsd-tests/lib/libc/gen

2014-11-01 Thread Garrett Cooper
Author: ngie
Date: Sat Nov  1 20:33:42 2014
New Revision: 273942
URL: https://svnweb.freebsd.org/changeset/base/273942

Log:
  Skip :sethostname_basic because it messes up the test host's hostname
  
  Convert code from #if defined(__FreeBSD__) to #ifdef __FreeBSD__

Modified:
  head/contrib/netbsd-tests/lib/libc/gen/t_sethostname.c

Modified: head/contrib/netbsd-tests/lib/libc/gen/t_sethostname.c
==
--- head/contrib/netbsd-tests/lib/libc/gen/t_sethostname.c  Sat Nov  1 
20:07:32 2014(r273941)
+++ head/contrib/netbsd-tests/lib/libc/gen/t_sethostname.c  Sat Nov  1 
20:33:42 2014(r273942)
@@ -59,11 +59,13 @@ ATF_TC_BODY(sethostname_basic, tc)
char name[MAXHOSTNAMELEN];
size_t i;
 
+   atf_tc_skip("screws up the test host's hostname on FreeBSD");
+
for (i = 0; i < __arraycount(hosts); i++) {
 
(void)memset(name, 0, sizeof(name));
 
-#if defined(__FreeBSD__)
+#ifdef __FreeBSD__
/* 
 * Sanity checks to ensure that the wrong invariant isn't being
 * tested for per PR # 181127
@@ -106,7 +108,7 @@ ATF_TC_BODY(sethostname_limit, tc)
 
 ATF_TC_CLEANUP(sethostname_limit, tc)
 {
-#if defined(__FreeBSD__)
+#ifdef __FreeBSD__
ATF_REQUIRE(sethostname(host, MAXHOSTNAMELEN - 1 ) == 0);
ATF_REQUIRE(sethostname(host, MAXHOSTNAMELEN) == -1);
 #endif
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r273941 - head/release/doc/en_US.ISO8859-1/hardware

2014-11-01 Thread Gavin Atkinson
Author: gavin
Date: Sat Nov  1 20:07:32 2014
New Revision: 273941
URL: https://svnweb.freebsd.org/changeset/base/273941

Log:
  Updates to the list of CPUs supported by the amd64 platform
  
  MFC after:3 days

Modified:
  head/release/doc/en_US.ISO8859-1/hardware/article.xml

Modified: head/release/doc/en_US.ISO8859-1/hardware/article.xml
==
--- head/release/doc/en_US.ISO8859-1/hardware/article.xml   Sat Nov  1 
18:51:48 2014(r273940)
+++ head/release/doc/en_US.ISO8859-1/hardware/article.xml   Sat Nov  1 
20:07:32 2014(r273941)
@@ -76,7 +76,7 @@
   Note that there are two names for this architecture, AMD64
(AMD) and Intel EM64T (Extended Memory 64-bit Technology).
64-bit mode of the two architectures are almost compatible
-   with each other, and &os;/&arch.amd64; should support them
+   with each other, and &os;/&arch.amd64; supports them
both.
 
   As of this writing, the following processors are
@@ -92,6 +92,18 @@

 

+ &amd.sempron;.
+   
+
+   
+ &amd.turion;.
+   
+
+   
+ &amd.phenom;.
+   
+
+   
  All multi-core &intel; &xeon; processors except
Sossaman have EM64T support.

@@ -104,22 +116,30 @@

 

- All &intel; Core 2 (not Core Duo) and later
+ All &intel; &core; 2 (not &core; Duo) and later
processors

 

+ All &intel; &core; i range of processors
+   
+
+   
  All &intel; &pentium; D processors

 

- &intel; &pentium; 4s and Celeron Ds using
+ All &intel; ¢rino; Duo and ¢rino; Pro platforms
+   
+
+   
+ &intel; &pentium; 4s and &celeron; Ds using
the Cedar Mill core have EM64T
support.

 

- Some &intel; &pentium; 4s and Celeron Ds using
+ Some &intel; &pentium; 4s and &celeron; Ds using
the Prescott core have EM64T support.  See
the http://processorfinder.intel.com";>Intel
Processor Spec Finder for the definitive answer about
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r273940 - head/sys/boot/common

2014-11-01 Thread Marcel Moolenaar
Author: marcel
Date: Sat Nov  1 18:51:48 2014
New Revision: 273940
URL: https://svnweb.freebsd.org/changeset/base/273940

Log:
  Change the order of the arguments to file_loadraw(). They were swapped
  as of r262345 when file_loadraw() was made public and this little detail
  got overlooked during porting.
  
  Obtained from:Juniper Networks, Inc.

Modified:
  head/sys/boot/common/install.c

Modified: head/sys/boot/common/install.c
==
--- head/sys/boot/common/install.c  Sat Nov  1 17:52:04 2014
(r273939)
+++ head/sys/boot/common/install.c  Sat Nov  1 18:51:48 2014
(r273940)
@@ -286,7 +286,7 @@ install(char *pkgname)
}
 
s = (inst_rootfs == NULL) ? "/install.iso" : inst_rootfs;
-   if (file_loadraw("mfs_root", s) == NULL) {
+   if (file_loadraw(s, "mfs_root") == NULL) {
error = errno;
command_errmsg = "cannot load root file system";
goto fail;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r273939 - head/sys/modules

2014-11-01 Thread Mark Murray
Author: markm
Date: Sat Nov  1 17:52:04 2014
New Revision: 273939
URL: https://svnweb.freebsd.org/changeset/base/273939

Log:
  Remove duplicate macro settings (probably due to an SVN merge /faux pas/ on 
my part.
  
  Spotted by: DES
  Approved by:  DES(implicit)

Modified:
  head/sys/modules/Makefile

Modified: head/sys/modules/Makefile
==
--- head/sys/modules/Makefile   Sat Nov  1 17:22:53 2014(r273938)
+++ head/sys/modules/Makefile   Sat Nov  1 17:52:04 2014(r273939)
@@ -606,17 +606,6 @@ _x86bios=  x86bios
 _ixl=  ixl
 _ixlv= ixlv
 _ntb=  ntb
-_nvd=  nvd
-_nvme= nvme
-_nvram=nvram
-_nxge= nxge
-.if ${MK_CDDL} != "no" || defined(ALL_MODULES)
-_opensolaris=  opensolaris
-.endif
-.if ${MK_CRYPT} != "no" || defined(ALL_MODULES)
-_padlock=  padlock
-.endif
-_pccard=   pccard
 _qlxge=qlxge
 _qlxgb=qlxgb
 _qlxgbe=   qlxgbe
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r273938 - head/contrib/netbsd-tests/lib/libc/sys

2014-11-01 Thread Garrett Cooper
Author: ngie
Date: Sat Nov  1 17:22:53 2014
New Revision: 273938
URL: https://svnweb.freebsd.org/changeset/base/273938

Log:
  getitimer on FreeBSD returns the last set time instead of the remaining time;
  test for that instead
  
  Submitted by: pho

Modified:
  head/contrib/netbsd-tests/lib/libc/sys/t_getitimer.c

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_getitimer.c
==
--- head/contrib/netbsd-tests/lib/libc/sys/t_getitimer.cSat Nov  1 
17:19:43 2014(r273937)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_getitimer.cSat Nov  1 
17:22:53 2014(r273938)
@@ -194,8 +194,13 @@ ATF_TC_BODY(setitimer_old, tc)
 
ATF_REQUIRE(setitimer(ITIMER_REAL, &it, &ot) == 0);
 
+#ifdef __FreeBSD__
+   if (ot.it_value.tv_sec == 4 && ot.it_value.tv_usec == 3)
+   atf_tc_fail("setitimer(2) did not return remaining time");
+#else
if (ot.it_value.tv_sec != 4 || ot.it_value.tv_usec != 3)
atf_tc_fail("setitimer(2) did not store old values");
+#endif
 }
 
 ATF_TP_ADD_TCS(tp)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r273937 - head/contrib/netbsd-tests/lib/libc/sys

2014-11-01 Thread Garrett Cooper
Author: ngie
Date: Sat Nov  1 17:19:43 2014
New Revision: 273937
URL: https://svnweb.freebsd.org/changeset/base/273937

Log:
  Port lib/libc/sys/t_dup to FreeBSD/Linux
  
  - The requirements differ between FreeBSD/Linux when dealing with oldd/newd
being equal (both fail with EINVAL, not EBADF)
  - Add an EBADF testcase
  - Fix compilation issues on clang
  
  In collaboration with: pho

Modified:
  head/contrib/netbsd-tests/lib/libc/sys/t_dup.c

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_dup.c
==
--- head/contrib/netbsd-tests/lib/libc/sys/t_dup.c  Sat Nov  1 17:14:29 
2014(r273936)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_dup.c  Sat Nov  1 17:19:43 
2014(r273937)
@@ -45,8 +45,14 @@ __RCSID("$NetBSD: t_dup.c,v 1.8 2012/03/
 #include 
 #include 
 
+#ifdef __FreeBSD__
+#include 
+#endif
+
 static charpath[] = "dup";
+#ifdef __NetBSD__
 static voidcheck_mode(bool, bool, bool);
+#endif
 
 static void
 check_mode(bool _dup, bool _dup2, bool _dup3)
@@ -207,10 +213,24 @@ ATF_TC_BODY(dup3_err, tc)
ATF_REQUIRE(fd >= 0);
 
errno = 0;
+#if defined(__FreeBSD__) || defined(__linux__)
+   /*
+* FreeBSD and linux return EINVAL, because...
+*
+* [EINVAL] The oldd argument is equal to the newd argument.
+*/
+   ATF_REQUIRE(dup3(fd, fd, O_CLOEXEC) == -1);
+#else
ATF_REQUIRE(dup3(fd, fd, O_CLOEXEC) != -1);
+#endif
 
errno = 0;
+#if defined(__FreeBSD__) || defined(__linux__)
+   ATF_REQUIRE_ERRNO(EINVAL, dup3(-1, -1, O_CLOEXEC) == -1);
+   ATF_REQUIRE_ERRNO(EBADF, dup3(fd, -1, O_CLOEXEC) == -1);
+#else
ATF_REQUIRE_ERRNO(EBADF, dup3(-1, -1, O_CLOEXEC) == -1);
+#endif
 
errno = 0;
ATF_REQUIRE_ERRNO(EBADF, dup3(fd, -1, O_CLOEXEC) == -1);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r273936 - head/contrib/netbsd-tests/lib/libc/net

2014-11-01 Thread Garrett Cooper
Author: ngie
Date: Sat Nov  1 17:14:29 2014
New Revision: 273936
URL: https://svnweb.freebsd.org/changeset/base/273936

Log:
  Port lib/libc/net/h_dns_server to FreeBSD
  
  Submitted by: pho

Modified:
  head/contrib/netbsd-tests/lib/libc/net/h_dns_server.c

Modified: head/contrib/netbsd-tests/lib/libc/net/h_dns_server.c
==
--- head/contrib/netbsd-tests/lib/libc/net/h_dns_server.c   Sat Nov  1 
17:13:13 2014(r273935)
+++ head/contrib/netbsd-tests/lib/libc/net/h_dns_server.c   Sat Nov  1 
17:14:29 2014(r273936)
@@ -49,7 +49,13 @@ __RCSID("$NetBSD: h_dns_server.c,v 1.4 2
 #include 
 
 #include 
+#ifdef __NetBSD__
 #include 
+#endif
+
+#ifdef __FreeBSD__
+#include 
+#endif
 
 union sockaddr_either {
struct sockaddr s;
@@ -164,6 +170,106 @@ name2str(const void *v, char *buf, size_
 }
 #endif
 
+#ifdef __FreeBSD__
+/* XXX the daemon2_* functions should be in a library */
+
+int __daemon2_detach_pipe[2];
+
+static int
+daemon2_fork(void)
+{
+   int r;
+   int fd;
+   int i;
+
+   /*
+* Set up the pipe, making sure the write end does not
+* get allocated one of the file descriptors that will
+* be closed in daemon2_detach().
+*/
+   for (i = 0; i < 3; i++) {
+   r = pipe(__daemon2_detach_pipe);
+   if (r < 0)
+   return -1;
+   if (__daemon2_detach_pipe[1] <= STDERR_FILENO &&
+   (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
+   (void)dup2(fd, __daemon2_detach_pipe[0]);
+   (void)dup2(fd, __daemon2_detach_pipe[1]);
+   if (fd > STDERR_FILENO)
+   (void)close(fd);
+   continue;
+   }
+   break;
+   }
+
+   r = fork();
+   if (r < 0) {
+   return -1;
+   } else if (r == 0) {
+   /* child */
+   close(__daemon2_detach_pipe[0]);
+   return 0;
+   }
+   /* Parent */
+
+   (void) close(__daemon2_detach_pipe[1]);
+
+   for (;;) {
+  char dummy;
+  r = read(__daemon2_detach_pipe[0], &dummy, 1);
+  if (r < 0) {
+  if (errno == EINTR)
+  continue;
+  _exit(1);
+  } else if (r == 0) {
+  _exit(1);
+  } else { /* r > 0 */
+  _exit(0);
+  }
+   }
+}
+
+static int
+daemon2_detach(int nochdir, int noclose)
+{
+   int r;
+   int fd;
+
+   if (setsid() == -1)
+   return -1;
+
+   if (!nochdir)
+   (void)chdir("/");
+
+   if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
+   (void)dup2(fd, STDIN_FILENO);
+   (void)dup2(fd, STDOUT_FILENO);
+   (void)dup2(fd, STDERR_FILENO);
+   if (fd > STDERR_FILENO)
+   (void)close(fd);
+   }
+
+   while (1) {
+   r = write(__daemon2_detach_pipe[1], "", 1);
+   if (r < 0) {
+   if (errno == EINTR)
+   continue;
+   /* May get "broken pipe" here if parent is killed */
+   return -1;
+   } else if (r == 0) {
+   /* Should not happen */
+   return -1;
+   } else {
+   break;
+   }
+   }
+
+   (void) close(__daemon2_detach_pipe[1]);
+
+   return 0;
+}
+#endif
+
 int main(int argc, char **argv) {
int s, r, protocol;
union sockaddr_either saddr;
@@ -176,6 +282,9 @@ int main(int argc, char **argv) {
char buf1[1024], buf2[1024];
 #endif
 
+#ifdef __FreeBSD__
+   daemon2_fork();
+#endif
if (argc < 2 || ((protocol = argv[1][0]) != '4' && protocol != '6'))
errx(1, "usage: dns_server 4 | 6");
s = socket(protocol == '4' ? PF_INET : PF_INET6, SOCK_DGRAM, 
IPPROTO_UDP);
@@ -212,11 +321,19 @@ int main(int argc, char **argv) {
f = fopen(pidfile_name, "w");
fprintf(f, "%d", getpid());
fclose(f);
+#ifdef __FreeBSD__
+#ifdef DEBUG
+   daemon2_detach(0, 1);
+#else
+   daemon2_detach(0, 0);
+#endif
+#else
 #ifdef DEBUG
daemon(0, 1);
 #else
daemon(0, 0);
 #endif
+#endif
 
for (;;) {
unsigned char buf[512];
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r273935 - head/contrib/netbsd-tests/lib/libc/net

2014-11-01 Thread Garrett Cooper
Author: ngie
Date: Sat Nov  1 17:13:13 2014
New Revision: 273935
URL: https://svnweb.freebsd.org/changeset/base/273935

Log:
  Port tests to FreeBSD/Linux
  
  Some of the testcases don't work outside of NetBSD, and the behavior of
  ether_aton_r differs between FreeBSD, Linux, and NetBSD, and the calls to the
  API need to be massaged for FreeBSD and Linux.
  
  Submitted by: pho

Modified:
  head/contrib/netbsd-tests/lib/libc/net/t_ether_aton.c

Modified: head/contrib/netbsd-tests/lib/libc/net/t_ether_aton.c
==
--- head/contrib/netbsd-tests/lib/libc/net/t_ether_aton.c   Sat Nov  1 
17:12:44 2014(r273934)
+++ head/contrib/netbsd-tests/lib/libc/net/t_ether_aton.c   Sat Nov  1 
17:13:13 2014(r273935)
@@ -46,9 +46,18 @@ __RCSID("$NetBSD: t_ether_aton.c,v 1.1 2
 #include 
 #include 
 
+#if !defined(__NetBSD__)
+#if defined(__linux__)
+#include 
+#endif
+#include 
+#endif
+
+#if defined(__NetBSD__)
 #define ETHER_ADDR_LEN 6
 
 int ether_aton_r(u_char *dest, size_t len, const char *str);
+#endif
 
 static const struct {
u_char res[ETHER_ADDR_LEN];
@@ -56,9 +65,11 @@ static const struct {
int error;
 } tests[] = {
{ { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab }, "01:23:45:67:89:ab", 0 },
+#if defined(__NetBSD__)
{ { 0x00, 0x01, 0x22, 0x03, 0x14, 0x05 }, "0:1:22-3:14:05", 0 },
{ { 0x00, 0x01, 0x22, 0x03, 0x14, 0x05 }, "000122031405", 0 },
{ { 0x0a, 0x0B, 0xcc, 0xdD, 0xEE, 0x0f }, "0a0BccdDEE0f", 0 },
+#endif
 #define ZERO { 0, 0, 0, 0, 0, 0 }
{ ZERO, "0:1:2-3:04:05:06", ENAMETOOLONG },
{ ZERO, "0:1:2-3:04:", ENOBUFS },
@@ -75,22 +86,44 @@ ATF_TC_HEAD(tc_ether_aton, tc)
  
 ATF_TC_BODY(tc_ether_aton, tc)
 {
+#if defined(__NetBSD__)
u_char dest[ETHER_ADDR_LEN];
+#else
+   struct ether_addr dest;
+#endif
size_t t;
+#if defined(__NetBSD__)
int e, r;
+#else
+   int e;
+   struct ether_addr *r;
+#endif
const char *s;
 
for (t = 0; tests[t].str; t++) {
s = tests[t].str;
if ((e = tests[t].error) == 0) {
+#if defined(__NetBSD__)
if (ether_aton_r(dest, sizeof(dest), s) != e)
atf_tc_fail("failed on `%s'", s);
if (memcmp(dest, tests[t].res, sizeof(dest)) != 0)
atf_tc_fail("unexpected result on `%s'", s);
+#else
+   if (ether_aton_r(s, &dest) == NULL && e == 0)
+   atf_tc_fail("failed on `%s'", s);
+   if (memcmp(&dest, tests[t].res, sizeof(dest)) != 0)
+   atf_tc_fail("unexpected result on `%s'", s);
+#endif
} else {
+#if defined(__NetBSD__)
if ((r = ether_aton_r(dest, sizeof(dest), s)) != e)
atf_tc_fail("unexpectedly succeeded on `%s' "
"(%d != %d)", s, r, e);
+#else
+   if ((r = ether_aton_r(s, &dest)) != NULL && e != 0)
+   atf_tc_fail("unexpectedly succeeded on `%s' "
+   "(%p != %d)", s, r, e);
+#endif
}
}
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r273934 - in head/sys/boot: arm/uboot fdt powerpc/uboot uboot uboot/fdt

2014-11-01 Thread Andrew Turner
Author: andrew
Date: Sat Nov  1 17:12:44 2014
New Revision: 273934
URL: https://svnweb.freebsd.org/changeset/base/273934

Log:
  Start to allow platforms other than U-Boot to use the FDT code in loader by
  moving U-Boot specific code from libfdt.a to a new libuboot_fdt.a. This
  needs to be a new library for linking to work correctly.
  
  Differential Revision:https://reviews.freebsd.org/D1054
  Reviewed by:  ian, rpaulo (earlier version)
  MFC after:1 week

Added:
  head/sys/boot/uboot/fdt/
  head/sys/boot/uboot/fdt/Makefile   (contents, props changed)
  head/sys/boot/uboot/fdt/uboot_fdt.c   (contents, props changed)
Modified:
  head/sys/boot/arm/uboot/Makefile
  head/sys/boot/fdt/Makefile
  head/sys/boot/fdt/fdt_loader_cmd.c
  head/sys/boot/fdt/fdt_platform.h
  head/sys/boot/powerpc/uboot/Makefile
  head/sys/boot/uboot/Makefile

Modified: head/sys/boot/arm/uboot/Makefile
==
--- head/sys/boot/arm/uboot/MakefileSat Nov  1 17:09:39 2014
(r273933)
+++ head/sys/boot/arm/uboot/MakefileSat Nov  1 17:12:44 2014
(r273934)
@@ -72,6 +72,7 @@ CFLAGS+=  -DLOADER_TFTP_SUPPORT
 CFLAGS+=   -I${.CURDIR}/../../fdt
 CFLAGS+=   -I${.OBJDIR}/../../fdt
 CFLAGS+=   -DLOADER_FDT_SUPPORT
+LIBUBOOT_FDT=  ${.OBJDIR}/../../uboot/fdt/libuboot_fdt.a
 LIBFDT=${.OBJDIR}/../../fdt/libfdt.a
 .endif
 
@@ -112,8 +113,8 @@ CFLAGS+=-I${.CURDIR}/../../../../lib/li
 # clang doesn't understand %D as a specifier to printf
 NO_WERROR.clang=
 
-DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBSTAND}
-LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} -lstand
+DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSTAND}
+LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} -lstand
 
 vers.c:${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}

Modified: head/sys/boot/fdt/Makefile
==
--- head/sys/boot/fdt/Makefile  Sat Nov  1 17:09:39 2014(r273933)
+++ head/sys/boot/fdt/Makefile  Sat Nov  1 17:12:44 2014(r273934)
@@ -11,8 +11,7 @@ SRCS+=fdt.c fdt_ro.c fdt_wip.c fdt_sw.
 # Loader's fdt commands extension sources.
 SRCS+= fdt_loader_cmd.c
 
-CFLAGS+=   -I${.CURDIR}/../../contrib/libfdt/ -I${.CURDIR}/../common/ \
-   -I${.CURDIR}/../uboot/lib
+CFLAGS+=   -I${.CURDIR}/../../contrib/libfdt/ -I${.CURDIR}/../common/
 
 CFLAGS+=   -ffreestanding
 

Modified: head/sys/boot/fdt/fdt_loader_cmd.c
==
--- head/sys/boot/fdt/fdt_loader_cmd.c  Sat Nov  1 17:09:39 2014
(r273933)
+++ head/sys/boot/fdt/fdt_loader_cmd.c  Sat Nov  1 17:12:44 2014
(r273934)
@@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$");
 
 #include "bootstrap.h"
 #include "fdt_platform.h"
-#include "glue.h"
 
 #ifdef DEBUG
 #define debugf(fmt, args...) do { printf("%s(): ", __func__);  \
@@ -53,9 +52,6 @@ __FBSDID("$FreeBSD$");
 
 #define FDT_PROP_SEP   " = "
 
-#define STR(number) #number
-#define STRINGIFY(number) STR(number)
-
 #define COPYOUT(s,d,l) archsw.arch_copyout(s, d, l)
 #define COPYIN(s,d,l)  archsw.arch_copyin(s, d, l)
 
@@ -229,7 +225,7 @@ fdt_load_dtb(vm_offset_t va)
return (0);
 }
 
-static int
+int
 fdt_load_dtb_addr(struct fdt_header *header)
 {
int err;
@@ -254,7 +250,7 @@ fdt_load_dtb_addr(struct fdt_header *hea
return (0);
 }
 
-static int
+int
 fdt_load_dtb_file(const char * filename)
 {
struct preloaded_file *bfp, *oldbfp;
@@ -284,9 +280,6 @@ int
 fdt_setup_fdtp()
 {
struct preloaded_file *bfp;
-   struct fdt_header *hdr;
-   const char *s;
-   char *p;
vm_offset_t va;

debugf("fdt_setup_fdtp()\n");
@@ -309,41 +302,8 @@ fdt_setup_fdtp()
}
}
 
-   /*
-* If the U-boot environment contains a variable giving the address of a
-* valid blob in memory, use it.  The U-boot README says the right
-* variable for fdt data loaded into ram is fdt_addr_r, so try that
-* first.  Board vendors also use both fdtaddr and fdt_addr names.
-*/
-   s = ub_env_get("fdt_addr_r");
-   if (s == NULL)
-   s = ub_env_get("fdtaddr");
-   if (s == NULL)
-   s = ub_env_get("fdt_addr");
-   if (s != NULL && *s != '\0') {
-   hdr = (struct fdt_header *)strtoul(s, &p, 16);
-   if (*p == '\0') {
-   if (fdt_load_dtb_addr(hdr) == 0) {
-   printf("Using DTB provided by U-Boot at "
-   "address %p.\n", hdr);
-   return (0);
-   }
-   }
-   }
-
-   /*
-* If the U-boot environment 

svn commit: r273933 - head/contrib/netbsd-tests/lib/libc/net

2014-11-01 Thread Garrett Cooper
Author: ngie
Date: Sat Nov  1 17:09:39 2014
New Revision: 273933
URL: https://svnweb.freebsd.org/changeset/base/273933

Log:
  Don't prune duplicate services in the expected output from /etc/services on
  FreeBSD
  
  Submitted by: pho

Modified:
  head/contrib/netbsd-tests/lib/libc/net/t_servent.sh

Modified: head/contrib/netbsd-tests/lib/libc/net/t_servent.sh
==
--- head/contrib/netbsd-tests/lib/libc/net/t_servent.sh Sat Nov  1 17:05:15 
2014(r273932)
+++ head/contrib/netbsd-tests/lib/libc/net/t_servent.sh Sat Nov  1 17:09:39 
2014(r273933)
@@ -81,6 +81,24 @@ servent_body()
}
' | sort >exp
 
+   case "$(uname)" in
+   FreeBSD)
+   #  (3) Don't prune duplicates
+   tr '\t' ' ' < /etc/services |
+   sed 's/#.*//;s/   */ /g; /^$/d;s#\([0-9]\)/#\1 #;s/ *$//' |
+   sort |
+   while read l; do
+   set $l
+   name=$1; shift
+   port=$1; shift
+   proto=$1; shift
+   alias="$@"
+   printf "name=%s, port=%s, proto=%s, aliases=%s\n" \
+   $name $port $proto "$alias"
+   done > exp
+   ;;
+   esac
+
# run test program
"$(atf_get_srcdir)/h_servent" | sed 's/ *$//' | sort >out
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r273932 - in head/sys: dev/vt kern sys

2014-11-01 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Sat Nov  1 17:05:15 2014
New Revision: 273932
URL: https://svnweb.freebsd.org/changeset/base/273932

Log:
  vt(4): Adjust the cursor position after changing the window size
  
  A new terminal_set_cursor() is added: it wraps the existing
  teken_set_cursor() function.
  
  In vtbuf_grow(), the cursor position is adjusted at the end of the
  function. In vt_change_font(), we call terminal_set_cursor() just after
  terminal_set_winsize_blank(), while the terminal is mute.
  
  This fixes a bug where, after loading a kernel video driver which
  increases the terminal window size, the cursor remains at its old
  position, in other words, in the middle of the display content.
  
  PR:   194421
  MFC after:1 week

Modified:
  head/sys/dev/vt/vt_buf.c
  head/sys/dev/vt/vt_core.c
  head/sys/kern/subr_terminal.c
  head/sys/sys/terminal.h

Modified: head/sys/dev/vt/vt_buf.c
==
--- head/sys/dev/vt/vt_buf.cSat Nov  1 13:45:01 2014(r273931)
+++ head/sys/dev/vt/vt_buf.cSat Nov  1 17:05:15 2014(r273932)
@@ -562,6 +562,18 @@ vtbuf_grow(struct vt_buf *vb, const term
vb->vb_roffset = vb->vb_curroffset;
}
 
+   /* Adjust cursor position. */
+   if (vb->vb_cursor.tp_col > p->tp_col - 1)
+   /*
+* Move cursor to the last column, in case its previous
+* position is outside of the new screen area.
+*/
+   vb->vb_cursor.tp_col = p->tp_col - 1;
+
+   if (vb->vb_curroffset > 0 || vb->vb_cursor.tp_row > p->tp_row - 1)
+   /* Move cursor to the last line on the screen. */
+   vb->vb_cursor.tp_row = p->tp_row - 1;
+
vtbuf_make_undirty(vb);
VTBUF_UNLOCK(vb);
 

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Sat Nov  1 13:45:01 2014(r273931)
+++ head/sys/dev/vt/vt_core.c   Sat Nov  1 17:05:15 2014(r273932)
@@ -1532,6 +1532,7 @@ vt_change_font(struct vt_window *vw, str
terminal_mute(tm, 1);
vtbuf_grow(&vw->vw_buf, &size, vw->vw_buf.vb_history_size);
terminal_set_winsize_blank(tm, &wsz, 0, NULL);
+   terminal_set_cursor(tm, &vw->vw_buf.vb_cursor);
terminal_mute(tm, 0);
 
/* Actually apply the font to the current window. */

Modified: head/sys/kern/subr_terminal.c
==
--- head/sys/kern/subr_terminal.c   Sat Nov  1 13:45:01 2014
(r273931)
+++ head/sys/kern/subr_terminal.c   Sat Nov  1 17:05:15 2014
(r273932)
@@ -190,6 +190,13 @@ terminal_maketty(struct terminal *tm, co
 }
 
 void
+terminal_set_cursor(struct terminal *tm, const term_pos_t *pos)
+{
+
+   teken_set_cursor(&tm->tm_emulator, pos);
+}
+
+void
 terminal_set_winsize_blank(struct terminal *tm, const struct winsize *size,
 int blank, const term_attr_t *attr)
 {

Modified: head/sys/sys/terminal.h
==
--- head/sys/sys/terminal.h Sat Nov  1 13:45:01 2014(r273931)
+++ head/sys/sys/terminal.h Sat Nov  1 17:05:15 2014(r273932)
@@ -207,6 +207,7 @@ struct terminal {
 
 struct terminal *terminal_alloc(const struct terminal_class *tc, void *softc);
 void   terminal_maketty(struct terminal *tm, const char *fmt, ...);
+void   terminal_set_cursor(struct terminal *tm, const term_pos_t *pos);
 void   terminal_set_winsize_blank(struct terminal *tm,
 const struct winsize *size, int blank, const term_attr_t *attr);
 void   terminal_set_winsize(struct terminal *tm, const struct winsize *size);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r273762 - head/sys/modules/dtrace/dtraceall

2014-11-01 Thread Jan Beich
Julian Elischer  writes:

> Log:
>   Allow loading of dtraceall without nfscl if what you really wnat is 
> nfsclient

... or if what you really want is neither, no NFS by default.

>   
>   Obtained from:  Panzura tree
>   MFC after:  1 week
>
> Modified:
>   head/sys/modules/dtrace/dtraceall/dtraceall.c
>
> Modified: head/sys/modules/dtrace/dtraceall/dtraceall.c
> ==
> --- head/sys/modules/dtrace/dtraceall/dtraceall.c Tue Oct 28 03:42:09 
> 2014(r273761)
> +++ head/sys/modules/dtrace/dtraceall/dtraceall.c Tue Oct 28 04:18:09 
> 2014(r273762)
> @@ -67,7 +67,9 @@ MODULE_DEPEND(dtraceall, cyclic, 1, 1, 1
>  MODULE_DEPEND(dtraceall, opensolaris, 1, 1, 1);
>  MODULE_DEPEND(dtraceall, dtrace, 1, 1, 1);
>  MODULE_DEPEND(dtraceall, dtmalloc, 1, 1, 1);
> +#if defined(NFSCLIENT)

Did you mean #if defined(NFSCL) ? Otherwise, dtraceall.ko with GENERIC
kernel wouldn't pull dtnfscl.ko despite nfscl.ko being compiled in.

>  MODULE_DEPEND(dtraceall, dtnfscl, 1, 1, 1);
> +#endif
>  #if defined(NFSCLIENT)
>  MODULE_DEPEND(dtraceall, dtnfsclient, 1, 1, 1);
>  #endif

-

VFEmail.net - http://www.vfemail.net
ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the 
NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!  
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!  
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/m

2014-11-01 Thread Mark R V Murray
Hi Garrett,

> On 31 Oct 2014, at 21:04, Garrett Cooper  wrote:
> Could you please add an UPDATING entry for this? Some users (like me) who do 
> make installworld from old kernels are experiencing issues (some dealing with 
> filesystem corruption). Please see this thread on -current@ for more details: 
> https://lists.freebsd.org/pipermail/freebsd-current/2014-October/053039.html

Will do. Thanks for the reminder.

> This also should have had “Relnotes: yes” in the commit message because this 
> deserves to be put in the release notes for 11.0

Oops. :-(

M
-- 
Mark R V Murray

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


svn commit: r273931 - in stable: 10/lib/libutil 7/lib/libutil 8/lib/libutil 9/lib/libutil

2014-11-01 Thread Dimitry Andric
Author: dim
Date: Sat Nov  1 13:45:01 2014
New Revision: 273931
URL: https://svnweb.freebsd.org/changeset/base/273931

Log:
  MFC r273837:
  
  Fix a clang 3.5 warning about abs(3) being given an argument of type
  quad_t in setusercontext().  While here, sanitize the clamping of the
  priority value, and use the correct type for the return value of
  login_getcapnum().
  
  Reviewed by:  kib

Modified:
  stable/9/lib/libutil/login_class.c
Directory Properties:
  stable/9/lib/libutil/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/lib/libutil/login_class.c
  stable/7/lib/libutil/login_class.c
  stable/8/lib/libutil/login_class.c
Directory Properties:
  stable/10/   (props changed)
  stable/7/lib/libutil/   (props changed)
  stable/8/lib/libutil/   (props changed)

Modified: stable/9/lib/libutil/login_class.c
==
--- stable/9/lib/libutil/login_class.c  Sat Nov  1 11:19:50 2014
(r273930)
+++ stable/9/lib/libutil/login_class.c  Sat Nov  1 13:45:01 2014
(r273931)
@@ -423,7 +423,7 @@ setlogincontext(login_cap_t *lc, const s
 int
 setusercontext(login_cap_t *lc, const struct passwd *pwd, uid_t uid, unsigned 
int flags)
 {
-quad_t p;
+rlim_t p;
 mode_t mymask;
 login_cap_t *llc = NULL;
 struct sigaction sa, prevsa;
@@ -448,16 +448,16 @@ setusercontext(login_cap_t *lc, const st
 
if (p > PRIO_MAX) {
rtp.type = RTP_PRIO_IDLE;
-   rtp.prio = p - PRIO_MAX - 1;
-   p = (rtp.prio > RTP_PRIO_MAX) ? 31 : p;
+   p -= PRIO_MAX + 1;
+   rtp.prio = p > RTP_PRIO_MAX ? RTP_PRIO_MAX : p;
if (rtprio(RTP_SET, 0, &rtp))
syslog(LOG_WARNING, "rtprio '%s' (%s): %m",
pwd ? pwd->pw_name : "-",
lc ? lc->lc_class : LOGIN_DEFCLASS);
} else if (p < PRIO_MIN) {
rtp.type = RTP_PRIO_REALTIME;
-   rtp.prio = abs(p - PRIO_MIN + RTP_PRIO_MAX);
-   p = (rtp.prio > RTP_PRIO_MAX) ? 1 : p;
+   p -= PRIO_MIN - RTP_PRIO_MAX;
+   rtp.prio = p < RTP_PRIO_MIN ? RTP_PRIO_MIN : p;
if (rtprio(RTP_SET, 0, &rtp))
syslog(LOG_WARNING, "rtprio '%s' (%s): %m",
pwd ? pwd->pw_name : "-",
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r273931 - in stable: 10/lib/libutil 7/lib/libutil 8/lib/libutil 9/lib/libutil

2014-11-01 Thread Dimitry Andric
Author: dim
Date: Sat Nov  1 13:45:01 2014
New Revision: 273931
URL: https://svnweb.freebsd.org/changeset/base/273931

Log:
  MFC r273837:
  
  Fix a clang 3.5 warning about abs(3) being given an argument of type
  quad_t in setusercontext().  While here, sanitize the clamping of the
  priority value, and use the correct type for the return value of
  login_getcapnum().
  
  Reviewed by:  kib

Modified:
  stable/10/lib/libutil/login_class.c
Directory Properties:
  stable/10/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/7/lib/libutil/login_class.c
  stable/8/lib/libutil/login_class.c
  stable/9/lib/libutil/login_class.c
Directory Properties:
  stable/7/lib/libutil/   (props changed)
  stable/8/lib/libutil/   (props changed)
  stable/9/lib/libutil/   (props changed)

Modified: stable/10/lib/libutil/login_class.c
==
--- stable/10/lib/libutil/login_class.c Sat Nov  1 11:19:50 2014
(r273930)
+++ stable/10/lib/libutil/login_class.c Sat Nov  1 13:45:01 2014
(r273931)
@@ -423,7 +423,7 @@ setlogincontext(login_cap_t *lc, const s
 int
 setusercontext(login_cap_t *lc, const struct passwd *pwd, uid_t uid, unsigned 
int flags)
 {
-quad_t p;
+rlim_t p;
 mode_t mymask;
 login_cap_t *llc = NULL;
 struct sigaction sa, prevsa;
@@ -448,16 +448,16 @@ setusercontext(login_cap_t *lc, const st
 
if (p > PRIO_MAX) {
rtp.type = RTP_PRIO_IDLE;
-   rtp.prio = p - PRIO_MAX - 1;
-   p = (rtp.prio > RTP_PRIO_MAX) ? 31 : p;
+   p -= PRIO_MAX + 1;
+   rtp.prio = p > RTP_PRIO_MAX ? RTP_PRIO_MAX : p;
if (rtprio(RTP_SET, 0, &rtp))
syslog(LOG_WARNING, "rtprio '%s' (%s): %m",
pwd ? pwd->pw_name : "-",
lc ? lc->lc_class : LOGIN_DEFCLASS);
} else if (p < PRIO_MIN) {
rtp.type = RTP_PRIO_REALTIME;
-   rtp.prio = abs(p - PRIO_MIN + RTP_PRIO_MAX);
-   p = (rtp.prio > RTP_PRIO_MAX) ? 1 : p;
+   p -= PRIO_MIN - RTP_PRIO_MAX;
+   rtp.prio = p < RTP_PRIO_MIN ? RTP_PRIO_MIN : p;
if (rtprio(RTP_SET, 0, &rtp))
syslog(LOG_WARNING, "rtprio '%s' (%s): %m",
pwd ? pwd->pw_name : "-",
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r273931 - in stable: 10/lib/libutil 7/lib/libutil 8/lib/libutil 9/lib/libutil

2014-11-01 Thread Dimitry Andric
Author: dim
Date: Sat Nov  1 13:45:01 2014
New Revision: 273931
URL: https://svnweb.freebsd.org/changeset/base/273931

Log:
  MFC r273837:
  
  Fix a clang 3.5 warning about abs(3) being given an argument of type
  quad_t in setusercontext().  While here, sanitize the clamping of the
  priority value, and use the correct type for the return value of
  login_getcapnum().
  
  Reviewed by:  kib

Modified:
  stable/7/lib/libutil/login_class.c
Directory Properties:
  stable/7/lib/libutil/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/lib/libutil/login_class.c
  stable/8/lib/libutil/login_class.c
  stable/9/lib/libutil/login_class.c
Directory Properties:
  stable/10/   (props changed)
  stable/8/lib/libutil/   (props changed)
  stable/9/lib/libutil/   (props changed)

Modified: stable/7/lib/libutil/login_class.c
==
--- stable/7/lib/libutil/login_class.c  Sat Nov  1 11:19:50 2014
(r273930)
+++ stable/7/lib/libutil/login_class.c  Sat Nov  1 13:45:01 2014
(r273931)
@@ -420,7 +420,7 @@ setlogincontext(login_cap_t *lc, const s
 int
 setusercontext(login_cap_t *lc, const struct passwd *pwd, uid_t uid, unsigned 
int flags)
 {
-quad_t p;
+rlim_t p;
 mode_t mymask;
 login_cap_t *llc = NULL;
 struct rtprio rtp;
@@ -444,16 +444,16 @@ setusercontext(login_cap_t *lc, const st
 
if (p > PRIO_MAX) {
rtp.type = RTP_PRIO_IDLE;
-   rtp.prio = p - PRIO_MAX - 1;
-   p = (rtp.prio > RTP_PRIO_MAX) ? 31 : p;
+   p -= PRIO_MAX + 1;
+   rtp.prio = p > RTP_PRIO_MAX ? RTP_PRIO_MAX : p;
if (rtprio(RTP_SET, 0, &rtp))
syslog(LOG_WARNING, "rtprio '%s' (%s): %m",
pwd ? pwd->pw_name : "-",
lc ? lc->lc_class : LOGIN_DEFCLASS);
} else if (p < PRIO_MIN) {
rtp.type = RTP_PRIO_REALTIME;
-   rtp.prio = abs(p - PRIO_MIN + RTP_PRIO_MAX);
-   p = (rtp.prio > RTP_PRIO_MAX) ? 1 : p;
+   p -= PRIO_MIN - RTP_PRIO_MAX;
+   rtp.prio = p < RTP_PRIO_MIN ? RTP_PRIO_MIN : p;
if (rtprio(RTP_SET, 0, &rtp))
syslog(LOG_WARNING, "rtprio '%s' (%s): %m",
pwd ? pwd->pw_name : "-",
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r273931 - in stable: 10/lib/libutil 7/lib/libutil 8/lib/libutil 9/lib/libutil

2014-11-01 Thread Dimitry Andric
Author: dim
Date: Sat Nov  1 13:45:01 2014
New Revision: 273931
URL: https://svnweb.freebsd.org/changeset/base/273931

Log:
  MFC r273837:
  
  Fix a clang 3.5 warning about abs(3) being given an argument of type
  quad_t in setusercontext().  While here, sanitize the clamping of the
  priority value, and use the correct type for the return value of
  login_getcapnum().
  
  Reviewed by:  kib

Modified:
  stable/8/lib/libutil/login_class.c
Directory Properties:
  stable/8/lib/libutil/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/lib/libutil/login_class.c
  stable/7/lib/libutil/login_class.c
  stable/9/lib/libutil/login_class.c
Directory Properties:
  stable/10/   (props changed)
  stable/7/lib/libutil/   (props changed)
  stable/9/lib/libutil/   (props changed)

Modified: stable/8/lib/libutil/login_class.c
==
--- stable/8/lib/libutil/login_class.c  Sat Nov  1 11:19:50 2014
(r273930)
+++ stable/8/lib/libutil/login_class.c  Sat Nov  1 13:45:01 2014
(r273931)
@@ -422,7 +422,7 @@ setlogincontext(login_cap_t *lc, const s
 int
 setusercontext(login_cap_t *lc, const struct passwd *pwd, uid_t uid, unsigned 
int flags)
 {
-quad_t p;
+rlim_t p;
 mode_t mymask;
 login_cap_t *llc = NULL;
 struct rtprio rtp;
@@ -446,16 +446,16 @@ setusercontext(login_cap_t *lc, const st
 
if (p > PRIO_MAX) {
rtp.type = RTP_PRIO_IDLE;
-   rtp.prio = p - PRIO_MAX - 1;
-   p = (rtp.prio > RTP_PRIO_MAX) ? 31 : p;
+   p -= PRIO_MAX + 1;
+   rtp.prio = p > RTP_PRIO_MAX ? RTP_PRIO_MAX : p;
if (rtprio(RTP_SET, 0, &rtp))
syslog(LOG_WARNING, "rtprio '%s' (%s): %m",
pwd ? pwd->pw_name : "-",
lc ? lc->lc_class : LOGIN_DEFCLASS);
} else if (p < PRIO_MIN) {
rtp.type = RTP_PRIO_REALTIME;
-   rtp.prio = abs(p - PRIO_MIN + RTP_PRIO_MAX);
-   p = (rtp.prio > RTP_PRIO_MAX) ? 1 : p;
+   p -= PRIO_MIN - RTP_PRIO_MAX;
+   rtp.prio = p < RTP_PRIO_MIN ? RTP_PRIO_MIN : p;
if (rtprio(RTP_SET, 0, &rtp))
syslog(LOG_WARNING, "rtprio '%s' (%s): %m",
pwd ? pwd->pw_name : "-",
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r273930 - in vendor/atf: atf-0.20/atf-config atf-0.20/atf-report atf-0.20/atf-run atf-0.20/atf-version atf-0.20/tools atf-0.21/atf-config atf-0.21/atf-report atf-0.21/atf-run atf-0.21/a...

2014-11-01 Thread Julio Merino
Author: jmmv
Date: Sat Nov  1 11:19:50 2014
New Revision: 273930
URL: https://svnweb.freebsd.org/changeset/base/273930

Log:
  Remove empty directories for the deprecated (now gone) tools.
  
  The tools-related directories should have been removed with the import of
  atf-0.20 months ago, but I missed the bit in the Subversion Primer saying
  that emptied directories require manual removal.  Do so now.

Deleted:
  vendor/atf/atf-0.20/atf-config/
  vendor/atf/atf-0.20/atf-report/
  vendor/atf/atf-0.20/atf-run/
  vendor/atf/atf-0.20/atf-version/
  vendor/atf/atf-0.20/tools/
  vendor/atf/atf-0.21/atf-config/
  vendor/atf/atf-0.21/atf-report/
  vendor/atf/atf-0.21/atf-run/
  vendor/atf/atf-0.21/atf-version/
  vendor/atf/atf-0.21/tools/
  vendor/atf/dist/atf-config/
  vendor/atf/dist/atf-report/
  vendor/atf/dist/atf-run/
  vendor/atf/dist/atf-version/
  vendor/atf/dist/tools/
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r273929 - in head: . contrib/atf contrib/atf/atf-c contrib/atf/atf-c++ contrib/atf/atf-c++/detail contrib/atf/atf-c/detail contrib/atf/atf-sh contrib/atf/doc contrib/atf/test-programs l...

2014-11-01 Thread Julio Merino
Author: jmmv
Date: Sat Nov  1 11:17:54 2014
New Revision: 273929
URL: https://svnweb.freebsd.org/changeset/base/273929

Log:
  MFV: Import atf-0.21.

Added:
  head/contrib/atf/atf-c++/atf-c++.3
 - copied unchanged from r273873, vendor/atf/dist/atf-c++/atf-c++.3
  head/contrib/atf/atf-c/atf-c.3
 - copied unchanged from r273873, vendor/atf/dist/atf-c/atf-c.3
  head/contrib/atf/atf-sh/atf-sh.3
 - copied unchanged from r273873, vendor/atf/dist/atf-sh/atf-sh.3
  head/contrib/atf/config.h
 - copied, changed from r273922, head/contrib/atf/bconfig.h
  head/contrib/atf/doc/atf.7.in
 - copied unchanged from r273873, vendor/atf/dist/doc/atf.7.in
Deleted:
  head/contrib/atf/atf-c++/config.cpp
  head/contrib/atf/atf-c++/config.hpp
  head/contrib/atf/atf-c++/config_test.cpp
  head/contrib/atf/atf-c++/detail/sanity_test.cpp
  head/contrib/atf/atf-c/config.c
  head/contrib/atf/atf-c/config.h
  head/contrib/atf/atf-c/config_test.c
  head/contrib/atf/bconfig.h
Modified:
  head/ObsoleteFiles.inc
  head/contrib/atf/FREEBSD-Xlist
  head/contrib/atf/NEWS
  head/contrib/atf/atf-c++.hpp
  head/contrib/atf/atf-c++/Kyuafile
  head/contrib/atf/atf-c++/atf_c++_test.cpp
  head/contrib/atf/atf-c++/build.cpp
  head/contrib/atf/atf-c++/build.hpp
  head/contrib/atf/atf-c++/build_test.cpp
  head/contrib/atf/atf-c++/check.cpp
  head/contrib/atf/atf-c++/check.hpp
  head/contrib/atf/atf-c++/check_test.cpp
  head/contrib/atf/atf-c++/detail/Kyuafile
  head/contrib/atf/atf-c++/detail/application.cpp
  head/contrib/atf/atf-c++/detail/application.hpp
  head/contrib/atf/atf-c++/detail/application_test.cpp
  head/contrib/atf/atf-c++/detail/auto_array.hpp
  head/contrib/atf/atf-c++/detail/auto_array_test.cpp
  head/contrib/atf/atf-c++/detail/env.cpp
  head/contrib/atf/atf-c++/detail/env.hpp
  head/contrib/atf/atf-c++/detail/env_test.cpp
  head/contrib/atf/atf-c++/detail/exceptions.cpp
  head/contrib/atf/atf-c++/detail/exceptions.hpp
  head/contrib/atf/atf-c++/detail/exceptions_test.cpp
  head/contrib/atf/atf-c++/detail/fs.cpp
  head/contrib/atf/atf-c++/detail/fs.hpp
  head/contrib/atf/atf-c++/detail/fs_test.cpp
  head/contrib/atf/atf-c++/detail/process.cpp
  head/contrib/atf/atf-c++/detail/process.hpp
  head/contrib/atf/atf-c++/detail/process_test.cpp
  head/contrib/atf/atf-c++/detail/sanity.hpp
  head/contrib/atf/atf-c++/detail/test_helpers.cpp
  head/contrib/atf/atf-c++/detail/test_helpers.hpp
  head/contrib/atf/atf-c++/detail/text.cpp
  head/contrib/atf/atf-c++/detail/text.hpp
  head/contrib/atf/atf-c++/detail/text_test.cpp
  head/contrib/atf/atf-c++/detail/version_helper.cpp
  head/contrib/atf/atf-c++/macros.hpp
  head/contrib/atf/atf-c++/macros_hpp_test.cpp
  head/contrib/atf/atf-c++/macros_test.cpp
  head/contrib/atf/atf-c++/pkg_config_test.sh
  head/contrib/atf/atf-c++/tests.cpp
  head/contrib/atf/atf-c++/tests.hpp
  head/contrib/atf/atf-c++/tests_test.cpp
  head/contrib/atf/atf-c++/unused_test.cpp
  head/contrib/atf/atf-c++/utils.cpp
  head/contrib/atf/atf-c++/utils.hpp
  head/contrib/atf/atf-c++/utils_test.cpp
  head/contrib/atf/atf-c.h
  head/contrib/atf/atf-c/Kyuafile
  head/contrib/atf/atf-c/atf_c_test.c
  head/contrib/atf/atf-c/build.c
  head/contrib/atf/atf-c/build.h
  head/contrib/atf/atf-c/build_test.c
  head/contrib/atf/atf-c/check.c
  head/contrib/atf/atf-c/check.h
  head/contrib/atf/atf-c/check_test.c
  head/contrib/atf/atf-c/defs.h.in
  head/contrib/atf/atf-c/detail/dynstr.c
  head/contrib/atf/atf-c/detail/dynstr.h
  head/contrib/atf/atf-c/detail/dynstr_test.c
  head/contrib/atf/atf-c/detail/env.c
  head/contrib/atf/atf-c/detail/env.h
  head/contrib/atf/atf-c/detail/env_test.c
  head/contrib/atf/atf-c/detail/fs.c
  head/contrib/atf/atf-c/detail/fs.h
  head/contrib/atf/atf-c/detail/fs_test.c
  head/contrib/atf/atf-c/detail/list.c
  head/contrib/atf/atf-c/detail/list.h
  head/contrib/atf/atf-c/detail/list_test.c
  head/contrib/atf/atf-c/detail/map.c
  head/contrib/atf/atf-c/detail/map.h
  head/contrib/atf/atf-c/detail/map_test.c
  head/contrib/atf/atf-c/detail/process.c
  head/contrib/atf/atf-c/detail/process.h
  head/contrib/atf/atf-c/detail/process_helpers.c
  head/contrib/atf/atf-c/detail/process_test.c
  head/contrib/atf/atf-c/detail/sanity.c
  head/contrib/atf/atf-c/detail/sanity.h
  head/contrib/atf/atf-c/detail/sanity_test.c
  head/contrib/atf/atf-c/detail/test_helpers.c
  head/contrib/atf/atf-c/detail/test_helpers.h
  head/contrib/atf/atf-c/detail/text.c
  head/contrib/atf/atf-c/detail/text.h
  head/contrib/atf/atf-c/detail/text_test.c
  head/contrib/atf/atf-c/detail/tp_main.c
  head/contrib/atf/atf-c/detail/user.c
  head/contrib/atf/atf-c/detail/user.h
  head/contrib/atf/atf-c/detail/user_test.c
  head/contrib/atf/atf-c/detail/version_helper.c
  head/contrib/atf/atf-c/error.c
  head/contrib/atf/atf-c/error.h
  head/contrib/atf/atf-c/error_fwd.h
  head/contrib/atf/atf-c/error_test.c
  head/contrib/atf/atf-c/h_build.h
  head/contrib/atf/atf-c/macros.h
  head/contrib/atf/atf-c/macros_h_test.c
  head/contrib

svn commit: r273928 - head/contrib/netbsd-tests/usr.sbin/mtree

2014-11-01 Thread Julio Merino
Author: jmmv
Date: Sat Nov  1 11:07:59 2014
New Revision: 273928
URL: https://svnweb.freebsd.org/changeset/base/273928

Log:
  Put mtree test files into a subdirectory.
  
  Kyua 0.11 points TMPDIR to the test's work directory, and atf_check creates
  auxiliary files in TMPDIR.  This confuses a couple of mtree tests that were
  using the work directory's root to validate the contents of the directory.
  
  Fix the two affected tests by creating an auxiliary directory to use for
  the mtree tests.  (Kyua should probably do this on its own; filed bug #133
  upstream to take a look at this.)

Modified:
  head/contrib/netbsd-tests/usr.sbin/mtree/t_mtree.sh

Modified: head/contrib/netbsd-tests/usr.sbin/mtree/t_mtree.sh
==
--- head/contrib/netbsd-tests/usr.sbin/mtree/t_mtree.sh Sat Nov  1 10:50:18 
2014(r273927)
+++ head/contrib/netbsd-tests/usr.sbin/mtree/t_mtree.sh Sat Nov  1 11:07:59 
2014(r273928)
@@ -284,6 +284,13 @@ ignore_head()
 
 ignore_body()
 {
+   # Kyua 0.11 and above point TMPDIR to our work directory and atf-check
+   # generates a temporary file, which confuses mtree.  Put the mtree files
+   # into a subdirectory.
+   #
+   # See https://github.com/jmmv/kyua/issues/133 for details.
+   mkdir root && cd root
+
mkdir newdir
mtree -F ${FLAVOR} -c | mtree -F ${FLAVOR} -Ck uid,gid,mode > mtree.spec
ln -s newdir otherdir
@@ -313,6 +320,13 @@ mtree_ignore_body() 
 }
 netbsd6_ignore_body() 
 {
+   # Kyua 0.11 and above point TMPDIR to our work directory and atf-check
+   # generates a temporary file, which confuses mtree.  Put the mtree files
+   # into a subdirectory.
+   #
+   # See https://github.com/jmmv/kyua/issues/133 for details.
+   mkdir root && cd root
+
FLAVOR=netbsd6 ignore_body
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r273927 - in head/sys/boot: fdt uboot/common uboot/lib

2014-11-01 Thread Andrew Turner
Author: andrew
Date: Sat Nov  1 10:50:18 2014
New Revision: 273927
URL: https://svnweb.freebsd.org/changeset/base/273927

Log:
  Move the definitions of the fdt functions from a uboot header to a new fdt
  header. There is nothing in the fdt spec that ties it to U-Boot.
  
  While here sort and fix the signature of fdt_setup_fdtp.
  
  MFC after:1 week

Added:
  head/sys/boot/fdt/fdt_platform.h   (contents, props changed)
Modified:
  head/sys/boot/fdt/fdt_loader_cmd.c
  head/sys/boot/uboot/common/metadata.c
  head/sys/boot/uboot/lib/Makefile
  head/sys/boot/uboot/lib/libuboot.h
  head/sys/boot/uboot/lib/module.c

Modified: head/sys/boot/fdt/fdt_loader_cmd.c
==
--- head/sys/boot/fdt/fdt_loader_cmd.c  Sat Nov  1 10:40:29 2014
(r273926)
+++ head/sys/boot/fdt/fdt_loader_cmd.c  Sat Nov  1 10:50:18 2014
(r273927)
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include "bootstrap.h"
+#include "fdt_platform.h"
 #include "glue.h"
 
 #ifdef DEBUG

Added: head/sys/boot/fdt/fdt_platform.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/boot/fdt/fdt_platform.hSat Nov  1 10:50:18 2014
(r273927)
@@ -0,0 +1,35 @@
+/*-
+ * Copyright (c) 2014 Andrew Turner 
+ * All rights reserved.
+ *
+ * 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 AUTHOR 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 AUTHOR 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.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef FDT_PLATFORM_H
+#define FDT_PLATFORM_H
+
+extern int fdt_copy(vm_offset_t);
+extern int fdt_setup_fdtp(void);
+
+#endif /* FDT_PLATFORM_H */

Modified: head/sys/boot/uboot/common/metadata.c
==
--- head/sys/boot/uboot/common/metadata.c   Sat Nov  1 10:40:29 2014
(r273926)
+++ head/sys/boot/uboot/common/metadata.c   Sat Nov  1 10:50:18 2014
(r273927)
@@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$");
 #include "glue.h"
 
 #if defined(LOADER_FDT_SUPPORT)
-#include "libuboot.h"
+#include 
 #endif
 
 static int

Modified: head/sys/boot/uboot/lib/Makefile
==
--- head/sys/boot/uboot/lib/MakefileSat Nov  1 10:40:29 2014
(r273926)
+++ head/sys/boot/uboot/lib/MakefileSat Nov  1 10:50:18 2014
(r273927)
@@ -27,7 +27,7 @@ LOADER_FDT_SUPPORT=   no
 .endif
 
 .if ${LOADER_FDT_SUPPORT} == "yes"
-CFLAGS+= -DLOADER_FDT_SUPPORT
+CFLAGS+= -DLOADER_FDT_SUPPORT -I${.CURDIR}/../../fdt
 .endif
 
 # Pick up FDT includes

Modified: head/sys/boot/uboot/lib/libuboot.h
==
--- head/sys/boot/uboot/lib/libuboot.h  Sat Nov  1 10:40:29 2014
(r273926)
+++ head/sys/boot/uboot/lib/libuboot.h  Sat Nov  1 10:50:18 2014
(r273927)
@@ -72,8 +72,3 @@ void reboot(void);
 
 int uboot_diskgetunit(int type, int type_unit);
 
-#if defined(LOADER_FDT_SUPPORT)
-extern int fdt_setup_fdtp();
-extern int fdt_copy(vm_offset_t);
-#endif
-

Modified: head/sys/boot/uboot/lib/module.c
==
--- head/sys/boot/uboot/lib/module.cSat Nov  1 10:40:29 2014
(r273926)
+++ head/sys/boot/uboot/lib/module.cSat Nov  1 10:50:18 2014
(r273927)
@@ -34,6 +34,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#if defined(LOADER_FDT_SUPPORT)
+#include 
+#endif
+
 #include "bootstrap.h"
 #include "libuboot.h"
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@fre

Re: svn commit: r273917 - head/sys/dev/gpio

2014-11-01 Thread Luiz Otavio O Souza
On Sat, Nov 1, 2014 at 7:56 AM, Bjoern A. Zeeb wrote:
>
> On 31 Oct 2014, at 19:15 , Luiz Otavio O Souza wrote:
>
>> Author: loos
>> Date: Fri Oct 31 19:15:14 2014
>> New Revision: 273917
>> URL: https://svnweb.freebsd.org/changeset/base/273917
>>
>> Log:
>>  Fix the gpiobus locking by using a more sane model where it isn't necessary
>>  hold the gpiobus lock between the gpio calls.
>>
>>  gpiobus_acquire_lock() now accepts a third parameter which tells gpiobus
>>  what to do when the bus is already busy.
>>
>>  When GPIOBUS_WAIT wait is used, the calling thread will be put to sleep
>>  until the bus became free.
>>
>>  With GPIOBUS_DONTWAIT the calling thread will receive EWOULDBLOCK right
>>  away and then it can act upon.
>>
>>  This fixes the gpioiic(4) locking issues that arises when doing multiple
>>  concurrent access on the bus.
>
> I guess it was this commit that broke things:
>
> /scratch/tmp/bz/head.svn/sys/dev/gpio/gpioled.c: In function 
> 'gpioled_control':
> /scratch/tmp/bz/head.svn/sys/dev/gpio/gpioled.c:88: error: 'GPIOBUS_DONTWAIT' 
> undeclared (first use in this function)
> /scratch/tmp/bz/head.svn/sys/dev/gpio/gpioled.c:88: error: (Each undeclared 
> identifier is reported only once
> /scratch/tmp/bz/head.svn/sys/dev/gpio/gpioled.c:88: error: for each function 
> it appears in.)
> --- gpioled.o ---
> *** [gpioled.o] Error code 1
>
> bmake: stopped in 
> /storage/head/obj/mips.mips/scratch/tmp/bz/head.svn/sys/AP121
> --- buildkernel ---
> *** [buildkernel] Error code 1

Fixed in r273926.

Sorry for the breakage.

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


svn commit: r273926 - head/sys/dev/gpio

2014-11-01 Thread Luiz Otavio O Souza
Author: loos
Date: Sat Nov  1 10:40:29 2014
New Revision: 273926
URL: https://svnweb.freebsd.org/changeset/base/273926

Log:
  Fix the build of non-FDT systems by moving the gpiobusvar.h header outside
  the FDT #ifdef.
  
  While here remove a few unused headers.

Modified:
  head/sys/dev/gpio/gpioled.c

Modified: head/sys/dev/gpio/gpioled.c
==
--- head/sys/dev/gpio/gpioled.c Sat Nov  1 10:35:45 2014(r273925)
+++ head/sys/dev/gpio/gpioled.c Sat Nov  1 10:40:29 2014(r273926)
@@ -31,11 +31,9 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
-#include 
 #include 
-#include 
+#include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -43,12 +41,12 @@ __FBSDID("$FreeBSD$");
 
 #ifdef FDT
 #include 
-#include 
 #include 
 #endif
 
+#include 
 #include 
-#include 
+
 #include "gpiobus_if.h"
 
 /*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r273925 - head/sys/netinet

2014-11-01 Thread Michael Tuexen
Author: tuexen
Date: Sat Nov  1 10:35:45 2014
New Revision: 273925
URL: https://svnweb.freebsd.org/changeset/base/273925

Log:
  Don't zero the stats before they are read out.
  
  MFC after: 3 days

Modified:
  head/sys/netinet/sctp_sysctl.c

Modified: head/sys/netinet/sctp_sysctl.c
==
--- head/sys/netinet/sctp_sysctl.c  Sat Nov  1 09:10:21 2014
(r273924)
+++ head/sys/netinet/sctp_sysctl.c  Sat Nov  1 10:35:45 2014
(r273925)
@@ -636,26 +636,27 @@ sctp_sysctl_handle_stats(SYSCTL_HANDLER_
int error;
 
 #if defined(SMP) && defined(SCTP_USE_PERCPU_STAT)
-   struct sctpstat sb_temp;
struct sctpstat *sarry;
struct sctpstat sb;
int cpu;
+
 #endif
+   struct sctpstat sb_temp;
 
if ((req->newptr != NULL) &&
(req->newlen != sizeof(struct sctpstat))) {
return (EINVAL);
}
-
-#if defined(SMP) && defined(SCTP_USE_PERCPU_STAT)
-   memset(&sb, 0, sizeof(sb));
-   memset(&sb_temp, 0, sizeof(sb_temp));
+   memset(&sb_temp, 0, sizeof(struct sctpstat));
 
if (req->newptr != NULL) {
-   error = SYSCTL_IN(req, &sb_temp, sizeof(sb_temp));
-   if (error != 0)
+   error = SYSCTL_IN(req, &sb_temp, sizeof(struct sctpstat));
+   if (error != 0) {
return (error);
+   }
}
+#if defined(SMP) && defined(SCTP_USE_PERCPU_STAT)
+   memset(&sb, 0, sizeof(sb));
for (cpu = 0; cpu < mp_maxid; cpu++) {
sarry = &SCTP_BASE_STATS[cpu];
if (sarry->sctps_discontinuitytime.tv_sec > 
sb.sctps_discontinuitytime.tv_sec) {
@@ -783,15 +784,19 @@ sctp_sysctl_handle_stats(SYSCTL_HANDLER_
sb.sctps_send_burst_avoid += sarry->sctps_send_burst_avoid;
sb.sctps_send_cwnd_avoid += sarry->sctps_send_cwnd_avoid;
sb.sctps_fwdtsn_map_over += sarry->sctps_fwdtsn_map_over;
-   if (req->newptr != NULL)
+   if (req->newptr != NULL) {
memcpy(sarry, &sb_temp, sizeof(struct sctpstat));
+   }
}
error = SYSCTL_OUT(req, &sb, sizeof(struct sctpstat));
 #else
-   error = SYSCTL_IN(req, &SCTP_BASE_STATS, sizeof(struct sctpstat));
-   if (error)
-   return (error);
error = SYSCTL_OUT(req, &SCTP_BASE_STATS, sizeof(struct sctpstat));
+   if (error != 0) {
+   return (error);
+   }
+   if (req->newptr != NULL) {
+   memcpy(&SCTP_BASE_STATS, &sb_temp, sizeof(struct sctpstat));
+   }
 #endif
return (error);
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r273917 - head/sys/dev/gpio

2014-11-01 Thread Bjoern A. Zeeb

On 31 Oct 2014, at 19:15 , Luiz Otavio O Souza  wrote:

> Author: loos
> Date: Fri Oct 31 19:15:14 2014
> New Revision: 273917
> URL: https://svnweb.freebsd.org/changeset/base/273917
> 
> Log:
>  Fix the gpiobus locking by using a more sane model where it isn't necessary
>  hold the gpiobus lock between the gpio calls.
> 
>  gpiobus_acquire_lock() now accepts a third parameter which tells gpiobus
>  what to do when the bus is already busy.
> 
>  When GPIOBUS_WAIT wait is used, the calling thread will be put to sleep
>  until the bus became free.
> 
>  With GPIOBUS_DONTWAIT the calling thread will receive EWOULDBLOCK right
>  away and then it can act upon.
> 
>  This fixes the gpioiic(4) locking issues that arises when doing multiple
>  concurrent access on the bus.

I guess it was this commit that broke things:

/scratch/tmp/bz/head.svn/sys/dev/gpio/gpioled.c: In function 'gpioled_control':
/scratch/tmp/bz/head.svn/sys/dev/gpio/gpioled.c:88: error: 'GPIOBUS_DONTWAIT' 
undeclared (first use in this function)
/scratch/tmp/bz/head.svn/sys/dev/gpio/gpioled.c:88: error: (Each undeclared 
identifier is reported only once
/scratch/tmp/bz/head.svn/sys/dev/gpio/gpioled.c:88: error: for each function it 
appears in.)
--- gpioled.o ---
*** [gpioled.o] Error code 1

bmake: stopped in /storage/head/obj/mips.mips/scratch/tmp/bz/head.svn/sys/AP121
--- buildkernel ---
*** [buildkernel] Error code 1




> 
> Modified:
>  head/sys/dev/gpio/gpiobus.c
>  head/sys/dev/gpio/gpiobus_if.m
>  head/sys/dev/gpio/gpiobusvar.h
>  head/sys/dev/gpio/gpioiic.c
>  head/sys/dev/gpio/gpioled.c
> 
> Modified: head/sys/dev/gpio/gpiobus.c
> ==
> --- head/sys/dev/gpio/gpiobus.c   Fri Oct 31 18:53:16 2014
> (r273916)
> +++ head/sys/dev/gpio/gpiobus.c   Fri Oct 31 19:15:14 2014
> (r273917)
> @@ -53,9 +53,7 @@ static void gpiobus_hinted_child(device_
> /*
>  * GPIOBUS interface
>  */
> -static void gpiobus_lock_bus(device_t);
> -static void gpiobus_unlock_bus(device_t);
> -static void gpiobus_acquire_bus(device_t, device_t);
> +static int gpiobus_acquire_bus(device_t, device_t, int);
> static void gpiobus_release_bus(device_t, device_t);
> static int gpiobus_pin_setflags(device_t, device_t, uint32_t, uint32_t);
> static int gpiobus_pin_getflags(device_t, device_t, uint32_t, uint32_t*);
> @@ -326,37 +324,26 @@ gpiobus_hinted_child(device_t bus, const
>   device_delete_child(bus, child);
> }
> 
> -static void
> -gpiobus_lock_bus(device_t busdev)
> +static int
> +gpiobus_acquire_bus(device_t busdev, device_t child, int how)
> {
>   struct gpiobus_softc *sc;
> 
>   sc = device_get_softc(busdev);
>   GPIOBUS_ASSERT_UNLOCKED(sc);
>   GPIOBUS_LOCK(sc);
> -}
> -
> -static void
> -gpiobus_unlock_bus(device_t busdev)
> -{
> - struct gpiobus_softc *sc;
> -
> - sc = device_get_softc(busdev);
> - GPIOBUS_ASSERT_LOCKED(sc);
> + if (sc->sc_owner != NULL) {
> + if (how == GPIOBUS_DONTWAIT) {
> + GPIOBUS_UNLOCK(sc);
> + return (EWOULDBLOCK);
> + }
> + while (sc->sc_owner != NULL)
> + mtx_sleep(sc, &sc->sc_mtx, 0, "gpiobuswait", 0);
> + }
> + sc->sc_owner = child;
>   GPIOBUS_UNLOCK(sc);
> -}
> 
> -static void
> -gpiobus_acquire_bus(device_t busdev, device_t child)
> -{
> - struct gpiobus_softc *sc;
> -
> - sc = device_get_softc(busdev);
> - GPIOBUS_ASSERT_LOCKED(sc);
> -
> - if (sc->sc_owner)
> - panic("gpiobus: cannot serialize the access to device.");
> - sc->sc_owner = child;
> + return (0);
> }
> 
> static void
> @@ -365,14 +352,15 @@ gpiobus_release_bus(device_t busdev, dev
>   struct gpiobus_softc *sc;
> 
>   sc = device_get_softc(busdev);
> - GPIOBUS_ASSERT_LOCKED(sc);
> -
> - if (!sc->sc_owner)
> + GPIOBUS_ASSERT_UNLOCKED(sc);
> + GPIOBUS_LOCK(sc);
> + if (sc->sc_owner == NULL)
>   panic("gpiobus: releasing unowned bus.");
>   if (sc->sc_owner != child)
>   panic("gpiobus: you don't own the bus. game over.");
> -
>   sc->sc_owner = NULL;
> + wakeup(sc);
> + GPIOBUS_UNLOCK(sc);
> }
> 
> static int
> @@ -469,8 +457,6 @@ static device_method_t gpiobus_methods[]
>   DEVMETHOD(bus_hinted_child, gpiobus_hinted_child),
> 
>   /* GPIO protocol */
> - DEVMETHOD(gpiobus_lock_bus, gpiobus_lock_bus),
> - DEVMETHOD(gpiobus_unlock_bus,   gpiobus_unlock_bus),
>   DEVMETHOD(gpiobus_acquire_bus,  gpiobus_acquire_bus),
>   DEVMETHOD(gpiobus_release_bus,  gpiobus_release_bus),
>   DEVMETHOD(gpiobus_pin_getflags, gpiobus_pin_getflags),
> 
> Modified: head/sys/dev/gpio/gpiobus_if.m
> ==
> --- head/sys/dev/gpio/gpiobus_if.mFri Oct 31 18:53:16 2014
> (r273916)
> +++ head/sys/dev/gpio/gpiobus_if.mFri Oct

Re: svn commit: r273919 - head/etc/rc.d

2014-11-01 Thread Dag-Erling Smørgrav
Garrett Cooper  writes:
> rcorder errors are indeed cryptic/confusing. I can quickly add a
> testcase for this if you like (basically check for all the scenarios
> that need to be covered via /etc/rc). Does that sound good?

Yes, that sounds great.  I'll look into adding a loop detection and
reporting mode to rcorder so we can get a better error message.

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

svn commit: r273924 - head/lib/libc/sys

2014-11-01 Thread Dag-Erling Smørgrav
Author: des
Date: Sat Nov  1 09:10:21 2014
New Revision: 273924
URL: https://svnweb.freebsd.org/changeset/base/273924

Log:
   is a superset of  and must always come
  first.  Coincidentally, today is the 11th anniversary of this man
  page's (and this bug's) first appearance in FreeBSD.
  
  MFC after:3 days

Modified:
  head/lib/libc/sys/utrace.2

Modified: head/lib/libc/sys/utrace.2
==
--- head/lib/libc/sys/utrace.2  Sat Nov  1 05:45:05 2014(r273923)
+++ head/lib/libc/sys/utrace.2  Sat Nov  1 09:10:21 2014(r273924)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 28, 2000
+.Dd November 1, 2014
 .Dt UTRACE 2
 .Os
 .Sh NAME
@@ -37,7 +37,6 @@
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
-.In sys/types.h
 .In sys/param.h
 .In sys/time.h
 .In sys/uio.h
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"