svn commit: r327513 - head/usr.bin/kdump

2018-01-02 Thread Mariusz Zaborski
Author: oshogbo
Date: Wed Jan  3 07:43:04 2018
New Revision: 327513
URL: https://svnweb.freebsd.org/changeset/base/327513

Log:
  NLS data and tz can be cached using caspicum helpers.
  
  Using them we simplifies and unifies sandboxed code.

Modified:
  head/usr.bin/kdump/kdump.c

Modified: head/usr.bin/kdump/kdump.c
==
--- head/usr.bin/kdump/kdump.c  Wed Jan  3 06:41:39 2018(r327512)
+++ head/usr.bin/kdump/kdump.c  Wed Jan  3 07:43:04 2018(r327513)
@@ -175,34 +175,7 @@ static TAILQ_HEAD(trace_procs, proc_info) trace_procs;
 
 #ifdef WITH_CASPER
 static cap_channel_t *cappwd, *capgrp;
-#endif
 
-static void
-strerror_init(void)
-{
-
-   /*
-* Cache NLS data before entering capability mode.
-* XXXPJD: There should be strerror_init() and strsignal_init() in libc.
-*/
-   (void)catopen("libc", NL_CAT_LOCALE);
-}
-
-static void
-localtime_init(void)
-{
-   time_t ltime;
-
-   /*
-* Allow localtime(3) to cache /etc/localtime content before entering
-* capability mode.
-* XXXPJD: There should be localtime_init() in libc.
-*/
-   (void)time();
-   (void)localtime();
-}
-
-#ifdef WITH_CASPER
 static int
 cappwdgrp_setup(cap_channel_t **cappwdp, cap_channel_t **capgrpp)
 {
@@ -450,8 +423,9 @@ main(int argc, char *argv[])
if (!freopen(tracefile, "r", stdin))
err(1, "%s", tracefile);
 
-   strerror_init();
-   localtime_init();
+   caph_cache_catpages();
+   caph_cache_tzdata();
+
 #ifdef WITH_CASPER
if (resolv != 0) {
if (cappwdgrp_setup(, ) < 0) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327512 - head

2018-01-02 Thread Mike Karels
Author: karels
Date: Wed Jan  3 06:41:39 2018
New Revision: 327512
URL: https://svnweb.freebsd.org/changeset/base/327512

Log:
  Add info about SW_WATCHDOG change to be dynamic in the common case.

Modified:
  head/UPDATING

Modified: head/UPDATING
==
--- head/UPDATING   Wed Jan  3 06:22:40 2018(r327511)
+++ head/UPDATING   Wed Jan  3 06:41:39 2018(r327512)
@@ -51,6 +51,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW:
 
 ** SPECIAL WARNING: **
 
+20180102:
+   The SW_WATCHDOG option is no longer necessary to enable the
+   hardclock-based software watchdog if no hardware watchdog is
+   configured. As before, SW_WATCHDOG will cause the software
+   watchdog to be enabled even if a hardware watchdog is configured.
+
 20171215:
r326887 fixes the issue described in the 20171214 UPDATING entry.
r326888 flips the switch back to building GELI support always.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327511 - head/lib/libcasper/libcasper

2018-01-02 Thread Mariusz Zaborski
Author: oshogbo
Date: Wed Jan  3 06:22:40 2018
New Revision: 327511
URL: https://svnweb.freebsd.org/changeset/base/327511

Log:
  Document services which we have in libcasper.
  
  Reviewed by:  bcr@
  Differential Revision:https://reviews.freebsd.org/D13734

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

Modified: head/lib/libcasper/libcasper/libcasper.3
==
--- head/lib/libcasper/libcasper/libcasper.3Wed Jan  3 03:46:28 2018
(r327510)
+++ head/lib/libcasper/libcasper/libcasper.3Wed Jan  3 06:22:40 2018
(r327511)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 29, 2017
+.Dd January 2, 2018
 .Dt LIBCASPER 3
 .Os
 .Sh NAME
@@ -190,6 +190,29 @@ obtained via the
 .Fn cap_init
 function.
 The function returns capability that provides access to opened service.
+Casper supports the following services in the base system:
+.Bl -tag -width "system.random" -compact -offset indent
+.Pp
+.It system.dns
+provides DNS libc compatible API
+.It system.grp
+provides
+.Xr getgrent 3
+compatible API
+.It system.pwd
+provides
+.Xr getpwent 3
+compatible API
+.It system.random
+allows to obtain entropy from /dev/random
+.It system.sysctl
+provides
+.Xr sysctlbyname 3
+compatible API
+.It system.syslog
+provides
+.Xr syslog 3
+compatible API
 .Sh RETURN VALUES
 The
 .Fn cap_clone ,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327510 - head/share/misc

2018-01-02 Thread Eitan Adler
Author: eadler
Date: Wed Jan  3 03:46:28 2018
New Revision: 327510
URL: https://svnweb.freebsd.org/changeset/base/327510

Log:
  bsd-family-tree: revert r327333
  
  bsd-family-tree should only contain projects that have had actual
  releases.
  
  Requested by: core

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

Modified: head/share/misc/bsd-family-tree
==
--- head/share/misc/bsd-family-tree Wed Jan  3 01:47:34 2018
(r327509)
+++ head/share/misc/bsd-family-tree Wed Jan  3 03:46:28 2018
(r327510)
@@ -355,28 +355,22 @@ FreeBSD 5.2   |  | |  
  |   11.0 | 10.12   | | NetBSD 7.0.2   |   |
  | |  |   | | ||   |
  | |  |   | | *- NetBSD 7.1|   |
- | |  | macOS   |   |  |   DragonFly 4.8.0
- | |  | 10.13   |   | OpenBSD 6.1  |
- |  FreeBSD   |   | |   |  |   DragonFly 5.0.0
- |   11.1  FreeBSD| |   |  |   |
- | |10.4  | |   | OpenBSD 6.2  DragonFly 5.0.1
- | |  |   v |   |  |   |
- | |  | |   |  |   DragonFly 5.0.2
- | |  | |   |  |   |
- | |   FreeBSD  |  NetBSD 7.1.1|   |
- | |   10-stable|  |   |
- |  FreeBSD\|  |   |
- |  11-stable   \   |  |   |
- |/  `| |  |   |
- | HardenedBSD| |  |   |
- |  11-stable  HardenedBSD  |  |   |
- |  10-stable   |  |   |
- |  |  |   |
- |  |  |   |
- |  |  |   |
-FreeBSD 12 -current   NetBSD -current   OpenBSD -currentDragonFly -current
- |  |  |   |
- v  v  v   v
+ | |  |   | |  |   |   |
+ | |  |   | |  |   |   |
+ | |  | macOS   |  |   |   DragonFly 4.8.0
+ | |  | 10.13   |  |  OpenBSD 6.1  |
+ |  FreeBSD   |   | |  |   |   DragonFly 5.0.0
+ |   11.1  FreeBSD| |  |   |   |
+ | |10.4  | |  |  OpenBSD 6.2  DragonFly 5.0.1
+ | |  | |  |   |   |
+ | |  | |  NetBSD 7.1.1|   DragonFly 5.0.2
+ | |  | |  |   |   |
+ | |  | |  v   |   |
+ | v  | |  |   |
+ || |  |   |
+FreeBSD 12 -current   | NetBSD -current   OpenBSD -currentDragonFly 
-current
+ || |  |   |
+ vv v  v   v
 
 Time
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327505 - in head: share/man/man4 sys/conf sys/dev/watchdog sys/kern sys/sys

2018-01-02 Thread Mike Karels
Author: karels
Date: Wed Jan  3 00:56:30 2018
New Revision: 327505
URL: https://svnweb.freebsd.org/changeset/base/327505

Log:
  make SW_WATCHDOG dynamic
  
  Enable the hardclock-based watchdog previously conditional on the
  SW_WATCHDOG option whenever hardware watchdogs are not found, and
  watchdogd attempts to enable the watchdog. The SW_WATCHDOG option
  still causes the sofware watchdog to be enabled even if there is a
  hardware watchdog. This does not change the other software-based
  watchdog enabled by the --softtimeout option to watchdogd.
  
  Note that the code to reprime the watchdog during kernel core dumps is
  no longer conditional on SW_WATCHDOG. I think this was previously a bug.
  
  Reviewed by:  imp alfred bjk
  MFC after:1 week
  Relnotes: yes
  Differential Revision:https://reviews.freebsd.org/D13713

Modified:
  head/share/man/man4/watchdog.4
  head/sys/conf/NOTES
  head/sys/dev/watchdog/watchdog.c
  head/sys/kern/kern_clock.c
  head/sys/kern/kern_dump.c
  head/sys/sys/watchdog.h

Modified: head/share/man/man4/watchdog.4
==
--- head/share/man/man4/watchdog.4  Tue Jan  2 23:52:26 2018
(r327504)
+++ head/share/man/man4/watchdog.4  Wed Jan  3 00:56:30 2018
(r327505)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 21, 2009
+.Dd January 2, 2018
 .Dt WATCHDOG 4
 .Os
 .Sh NAME
@@ -40,8 +40,11 @@ facility is used for controlling hardware and software
 .Pp
 The device
 .Pa /dev/fido
-responds to a single
+supports several optional
 .Xr ioctl 2
+calls for configuration, and
+responds to a single operational
+.Xr ioctl
 call,
 .Dv WDIOCPATPAT .
 It takes a single argument which represents a timeout value specified as a
@@ -60,12 +63,16 @@ indicates that the
 will be kept from timing out from the kernel.
 .Pp
 The
+.Dv WDIOCPATPAT
 .Xr ioctl 2
 call will return success if just one of the available
 .Xr watchdog 9
 implementations supports setting the timeout to the specified timeout.
 This
 means that at least one watchdog is armed.
+By default, this will be a hardware watchdog if one is present, but if
+no hardware watchdog is able to process the request, a default software
+watchdog is enabled.
 If the call fails, for instance if
 none of
 .Xr watchdog 9
@@ -77,8 +84,53 @@ To disable the watchdogs pass
 If disarming the watchdog(s) failed an error is returned.
 The watchdog might
 still be armed!
+.Pp
+The optional configuration
+.Xr ioctl
+commands are listed here, along with the type of the parameter used.
+Examples of their use can be found in
+.Xr watchdogd 8 .
+.Bl -tag -width "WDIOC_SETSOFTTIMEOUTACT int  "
+.It Dv WDIOC_SETTIMEOUT Fa int
+set/reset the timer
+.It Dv WDIOC_GETTIMEOUT Fa int
+get total timeout
+.It Dv WDIOC_GETTIMELEFT Fa int
+get time left
+.It Dv WDIOC_GETPRETIMEOUT Fa int
+get the pre-timeout
+.It Dv WDIOC_SETPRETIMEOUT Fa int
+set the pre-timeout
+.It Dv WDIOC_SETPRETIMEOUTACT Fa int
+Set the action when a pre-timeout occurs (see
+.Li WD_SOFT_*
+below).
+.It Dv WDIOC_SETSOFT Fa int
+Use an internal software watchdog instead of hardware.
+There is also an external software watchdog, which is used by default
+if no hardware watchdog was attached.
+.It Dv WDIOC_SETSOFTTIMEOUTACT Fa int
+Set the action whan a soft timeout occurs.
+.El
+.Pp
+The actions that may be specified for the pre-timeout or the internal software
+watchdog are listed here.
+Multiple actions can be specified by ORing values together.
+.Bl -tag -width  WD_SOFT_PRINT
+.It Dv WD_SOFT_PANIC
+panic
+.It Dv WD_SOFT_DDB
+enter debugger
+.It Dv WD_SOFT_LOG
+log(9)
+.It Dv WD_SOFT_PRINT
+printf(9)
+.El
 .Sh RETURN VALUES
-The ioctl returns zero on success and non-zero on failure.
+The
+.Dv WDIOCPATPAT
+.Xr ioctl
+returns zero on success and non-zero on failure.
 .Bl -tag -width Er
 .It Bq Er EOPNOTSUPP
 No watchdog present in the kernel or
@@ -89,6 +141,10 @@ Watchdog could not be disabled (timeout value of 0).
 .It Bq Er EINVAL
 Invalid flag combination passed.
 .El
+.Pp
+The configuration
+.Xr ioctl
+operations return zero on success and non-zero on failure.
 .Sh EXAMPLES
 .Bd -literal -offset indent
 #include 
@@ -122,8 +178,10 @@ Enables a watchdog to recover from a potentially freez
 .Pp
 .Dl "options SW_WATCHDOG"
 .Pp
-in your kernel config adds a software watchdog in the kernel, dropping to KDB
-or panic-ing when firing.
+in your kernel config forces a software watchdog in the kernel
+to be configured even if a hardware watchdog is configured,
+dropping to KDB or panicking when firing, depending
+on the KDB and KDB_UNATTENDED kernel configuration options.
 .Sh SEE ALSO
 .Xr watchdogd 8 ,
 .Xr watchdog 9

Modified: head/sys/conf/NOTES
==
--- head/sys/conf/NOTES Tue Jan  2 23:52:26 2018(r327504)
+++ head/sys/conf/NOTES Wed Jan  3 00:56:30 2018(r327505)
@@ -2609,7 +2609,9 @@ options   

svn commit: r327503 - head/usr.sbin/kldxref

2018-01-02 Thread Ed Maste
Author: emaste
Date: Tue Jan  2 21:31:54 2018
New Revision: 327503
URL: https://svnweb.freebsd.org/changeset/base/327503

Log:
  kldxref: correct function names in warning messages
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.sbin/kldxref/ef.c
  head/usr.sbin/kldxref/ef_obj.c

Modified: head/usr.sbin/kldxref/ef.c
==
--- head/usr.sbin/kldxref/ef.c  Tue Jan  2 20:58:05 2018(r327502)
+++ head/usr.sbin/kldxref/ef.c  Tue Jan  2 21:31:54 2018(r327503)
@@ -475,7 +475,7 @@ ef_seg_read_rel(elf_file_t ef, Elf_Off offset, size_t 
 
if (ofs == 0) {
if (ef->ef_verbose)
-   warnx("ef_seg_read(%s): zero offset (%lx:%ld)",
+   warnx("ef_seg_read_rel(%s): zero offset (%lx:%ld)",
ef->ef_name, (long)offset, ofs);
return EFAULT;
}

Modified: head/usr.sbin/kldxref/ef_obj.c
==
--- head/usr.sbin/kldxref/ef_obj.c  Tue Jan  2 20:58:05 2018
(r327502)
+++ head/usr.sbin/kldxref/ef_obj.c  Tue Jan  2 21:31:54 2018
(r327503)
@@ -227,7 +227,7 @@ ef_obj_seg_read(elf_file_t ef, Elf_Off offset, size_t 
 
if (offset + len > ef->size) {
if (ef->ef_verbose)
-   warnx("ef_seg_read_rel(%s): bad offset/len (%lx:%ld)",
+   warnx("ef_obj_seg_read(%s): bad offset/len (%lx:%ld)",
ef->ef_name, (long)offset, (long)len);
return (EFAULT);
}
@@ -246,7 +246,7 @@ ef_obj_seg_read_rel(elf_file_t ef, Elf_Off offset, siz
 
if (offset + len > ef->size) {
if (ef->ef_verbose)
-   warnx("ef_seg_read_rel(%s): bad offset/len (%lx:%ld)",
+   warnx("ef_obj_seg_read_rel(%s): bad offset/len 
(%lx:%ld)",
ef->ef_name, (long)offset, (long)len);
return (EFAULT);
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327502 - head/sys/dev/nctgpio

2018-01-02 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Tue Jan  2 20:58:05 2018
New Revision: 327502
URL: https://svnweb.freebsd.org/changeset/base/327502

Log:
  nctgpio: add new device id for the GPIO chip in PCEngines APU3
  
  PR:   224512
  Submitted by: m...@sentex.net
  MFC after:2 weeks

Modified:
  head/sys/dev/nctgpio/nctgpio.c

Modified: head/sys/dev/nctgpio/nctgpio.c
==
--- head/sys/dev/nctgpio/nctgpio.c  Tue Jan  2 20:22:31 2018
(r327501)
+++ head/sys/dev/nctgpio/nctgpio.c  Tue Jan  2 20:58:05 2018
(r327502)
@@ -140,6 +140,10 @@ struct nuvoton_vendor_device_id {
.chip_id= 0xc452,
.descr  = "Nuvoton NCT5104D (PC-Engines APU)",
},
+   {
+   .chip_id= 0xc453,
+   .descr  = "Nuvoton NCT5104D (PC-Engines APU3)",
+   },
 };
 
 static void
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327500 - head/sys/dev/ath

2018-01-02 Thread Ed Maste
Author: emaste
Date: Tue Jan  2 19:34:23 2018
New Revision: 327500
URL: https://svnweb.freebsd.org/changeset/base/327500

Log:
  ath: fix possible memory disclosures in ioctl handlers
  
  Apply the fix from r327499 to additional ioctl handlers.
  
  Reported by:  Ilja van Sprundel 
  MFC after:1 week
  MFC with: r327499
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/ath/if_ath_lna_div.c
  head/sys/dev/ath/if_ath_spectral.c

Modified: head/sys/dev/ath/if_ath_lna_div.c
==
--- head/sys/dev/ath/if_ath_lna_div.c   Tue Jan  2 19:29:30 2018
(r327499)
+++ head/sys/dev/ath/if_ath_lna_div.c   Tue Jan  2 19:34:23 2018
(r327500)
@@ -189,7 +189,7 @@ ath_lna_div_ioctl(struct ath_softc *sc, struct ath_dia
 * pointer for us to use below in reclaiming the buffer;
 * may want to be more defensive.
 */
-   outdata = malloc(outsize, M_TEMP, M_NOWAIT);
+   outdata = malloc(outsize, M_TEMP, M_NOWAIT | M_ZERO);
if (outdata == NULL) {
error = ENOMEM;
goto bad;
@@ -198,6 +198,7 @@ ath_lna_div_ioctl(struct ath_softc *sc, struct ath_dia
switch (id) {
default:
error = EINVAL;
+   goto bad;
}
if (outsize < ad->ad_out_size)
ad->ad_out_size = outsize;

Modified: head/sys/dev/ath/if_ath_spectral.c
==
--- head/sys/dev/ath/if_ath_spectral.c  Tue Jan  2 19:29:30 2018
(r327499)
+++ head/sys/dev/ath/if_ath_spectral.c  Tue Jan  2 19:34:23 2018
(r327500)
@@ -219,7 +219,7 @@ ath_ioctl_spectral(struct ath_softc *sc, struct ath_di
 * pointer for us to use below in reclaiming the buffer;
 * may want to be more defensive.
 */
-   outdata = malloc(outsize, M_TEMP, M_NOWAIT);
+   outdata = malloc(outsize, M_TEMP, M_NOWAIT | M_ZERO);
if (outdata == NULL) {
error = ENOMEM;
goto bad;
@@ -282,6 +282,7 @@ ath_ioctl_spectral(struct ath_softc *sc, struct ath_di
break;
default:
error = EINVAL;
+   goto bad;
}
if (outsize < ad->ad_out_size)
ad->ad_out_size = outsize;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327499 - head/sys/dev/ath

2018-01-02 Thread Ed Maste
Author: emaste
Date: Tue Jan  2 19:29:30 2018
New Revision: 327499
URL: https://svnweb.freebsd.org/changeset/base/327499

Log:
  ath: fix memory disclosure from ath_btcoex_ioctl
  
  The ath_btcoex_ioctl handler allocated a buffer without M_ZERO and
  returned it to userland without writing to it.
  
  The device has permissions only for root so this is not urgent, and the
  fix can be MFCd and considered for a future EN.
  
  Reported by:  Ilja van Sprundel 
  Submitted by: Domagoj Stolfa 
  Reviewed by:  adrian
  MFC after:1 week

Modified:
  head/sys/dev/ath/if_ath_btcoex.c

Modified: head/sys/dev/ath/if_ath_btcoex.c
==
--- head/sys/dev/ath/if_ath_btcoex.cTue Jan  2 18:31:32 2018
(r327498)
+++ head/sys/dev/ath/if_ath_btcoex.cTue Jan  2 19:29:30 2018
(r327499)
@@ -459,7 +459,7 @@ ath_btcoex_ioctl(struct ath_softc *sc, struct ath_diag
 * pointer for us to use below in reclaiming the buffer;
 * may want to be more defensive.
 */
-   outdata = malloc(outsize, M_TEMP, M_NOWAIT);
+   outdata = malloc(outsize, M_TEMP, M_NOWAIT | M_ZERO);
if (outdata == NULL) {
error = ENOMEM;
goto bad;
@@ -468,6 +468,7 @@ ath_btcoex_ioctl(struct ath_softc *sc, struct ath_diag
switch (id) {
default:
error = EINVAL;
+   goto bad;
}
if (outsize < ad->ad_out_size)
ad->ad_out_size = outsize;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r327447 - head/sys/sys

2018-01-02 Thread John Baldwin
On Tuesday, January 02, 2018 11:56:31 AM Julian Elischer wrote:
> On 1/1/18 5:00 am, Colin Percival wrote:
> > Author: cperciva
> > Date: Sun Dec 31 21:00:21 2017
> > New Revision: 327447
> > URL: https://svnweb.freebsd.org/changeset/base/327447
> >
> > Log:
> >Wrap includes in sys/tslog.h with #ifdef TSLOG.
> >
> >This is necessary because some non-kernel code #defines _KERNEL and then
> >includes kernel headers; as a result, it was getting conflicting versions
> >of curthread and curproc.  Non-kernel code should probably refrain from
> >defining _KERNEL, but for now hiding these indirect inclusions fixes the
> >build.
> 
> this is a recurring issue. Program that want to look into the 
> internals of files such as mount.h
> and define _KERNEL to allow themselves to do so.  It eventualy leads 
> to all sorts of confusion and pollution.
> Maybe we should make a policy on how to do this. At $JOB I had to hack 
> it to define a
> #ifdef _NOTREALLYKERNEL to split out parts we really wanted, but it 
> would be better to have specific ones for
> various specific 'rule breakers'..
> e.g.
> #if defined( _KERNEL ) || defined (WANT_TO_LOOK_AT_something)
> 
> kdump seems ot do the right thing with:
> 
> kdump/kdump.c:#define _WANT_KERNEL_ERRNO
> errno.h:#if defined(_KERNEL) || defined(_WANT_KERNEL_ERRNO)

The past few years we have been using _WANT_FOO when new things need to be
exposed and that is our current pattern.  However, that doesn't fix existing
code for old things.

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


svn commit: r327498 - in head/sys/dev: hptnr hptrr

2018-01-02 Thread Ed Maste
Author: emaste
Date: Tue Jan  2 18:31:32 2018
New Revision: 327498
URL: https://svnweb.freebsd.org/changeset/base/327498

Log:
  hpt{nr,rr}: plug info leak in hpt_ioctl
  
  The hpt{nr,rr} ioctl handler allocates a buffer without M_ZERO and calls
  hpt_do_ioctl(), which might not overwrite the entire buffer.
  
  Also zero bytesReturned in case it is not written by hpt_do_ioctl().
  
  The hpt27{nr,rr} device has permissions only for root so this is not urgent,
  and the fix can be MFCd and considered for a future EN.
  
  The same issue was reported in the hpt27xx driver by Ilja Van Sprundel.
  
  Reviewed by:  jhb, kib
  MFC after:3 days
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/hptnr/hptnr_osm_bsd.c
  head/sys/dev/hptrr/hptrr_osm_bsd.c

Modified: head/sys/dev/hptnr/hptnr_osm_bsd.c
==
--- head/sys/dev/hptnr/hptnr_osm_bsd.c  Tue Jan  2 18:29:44 2018
(r327497)
+++ head/sys/dev/hptnr/hptnr_osm_bsd.c  Tue Jan  2 18:31:32 2018
(r327498)
@@ -1586,7 +1586,7 @@ static int hpt_ioctl(struct cdev *dev, u_long cmd, cad
 {
PHPT_IOCTL_PARAM piop=(PHPT_IOCTL_PARAM)data;
IOCTL_ARG ioctl_args;
-   HPT_U32 bytesReturned;
+   HPT_U32 bytesReturned = 0;
 
switch (cmd){
case HPT_DO_IOCONTROL:
@@ -1616,7 +1616,7 @@ static int hpt_ioctl(struct cdev *dev, u_long cmd, cad
}

if (ioctl_args.nOutBufferSize) {
-   ioctl_args.lpOutBuffer = 
malloc(ioctl_args.nOutBufferSize, M_DEVBUF, M_WAITOK);
+   ioctl_args.lpOutBuffer = 
malloc(ioctl_args.nOutBufferSize, M_DEVBUF, M_WAITOK | M_ZERO);
if (!ioctl_args.lpOutBuffer)
goto invalid;
}

Modified: head/sys/dev/hptrr/hptrr_osm_bsd.c
==
--- head/sys/dev/hptrr/hptrr_osm_bsd.c  Tue Jan  2 18:29:44 2018
(r327497)
+++ head/sys/dev/hptrr/hptrr_osm_bsd.c  Tue Jan  2 18:31:32 2018
(r327498)
@@ -1233,7 +1233,7 @@ static int hpt_ioctl(struct cdev *dev, u_long cmd, cad
 {
PHPT_IOCTL_PARAM piop=(PHPT_IOCTL_PARAM)data;
IOCTL_ARG ioctl_args;
-   HPT_U32 bytesReturned;
+   HPT_U32 bytesReturned = 0;
 
switch (cmd){
case HPT_DO_IOCONTROL:
@@ -1263,7 +1263,7 @@ static int hpt_ioctl(struct cdev *dev, u_long cmd, cad
}

if (ioctl_args.nOutBufferSize) {
-   ioctl_args.lpOutBuffer = 
malloc(ioctl_args.nOutBufferSize, M_DEVBUF, M_WAITOK);
+   ioctl_args.lpOutBuffer = 
malloc(ioctl_args.nOutBufferSize, M_DEVBUF, M_WAITOK | M_ZERO);
if (!ioctl_args.lpOutBuffer)
goto invalid;
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327497 - head/sys/dev/hpt27xx

2018-01-02 Thread Ed Maste
Author: emaste
Date: Tue Jan  2 18:29:44 2018
New Revision: 327497
URL: https://svnweb.freebsd.org/changeset/base/327497

Log:
  hpt27xx: plug info leak in hpt_ioctl
  
  The hpt27xx ioctl handler allocates a buffer without M_ZERO and calls
  hpt_do_ioctl(), which might not overwrite the entire buffer.
  
  Also zero bytesReturned in case it is not written by hpt_do_ioctl().
  
  The hpt27xx device has permissions only for root so this is not urgent,
  and the fix can be MFCd and considered for a future EN.
  
  Reported by:  Ilja van Sprundel 
  Submitted by: Domagoj Stolfa  (M_ZERO)
  Reviewed by:  jhb, kib
  MFC after:3 days
  Security: info leak in root-only ioctl
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/hpt27xx/hpt27xx_osm_bsd.c

Modified: head/sys/dev/hpt27xx/hpt27xx_osm_bsd.c
==
--- head/sys/dev/hpt27xx/hpt27xx_osm_bsd.c  Tue Jan  2 18:11:54 2018
(r327496)
+++ head/sys/dev/hpt27xx/hpt27xx_osm_bsd.c  Tue Jan  2 18:29:44 2018
(r327497)
@@ -1404,7 +1404,7 @@ static int hpt_ioctl(struct cdev *dev, u_long cmd, cad
 {
PHPT_IOCTL_PARAM piop=(PHPT_IOCTL_PARAM)data;
IOCTL_ARG ioctl_args;
-   HPT_U32 bytesReturned;
+   HPT_U32 bytesReturned = 0;
 
switch (cmd){
case HPT_DO_IOCONTROL:
@@ -1434,7 +1434,7 @@ static int hpt_ioctl(struct cdev *dev, u_long cmd, cad
}

if (ioctl_args.nOutBufferSize) {
-   ioctl_args.lpOutBuffer = 
malloc(ioctl_args.nOutBufferSize, M_DEVBUF, M_WAITOK);
+   ioctl_args.lpOutBuffer = 
malloc(ioctl_args.nOutBufferSize, M_DEVBUF, M_WAITOK | M_ZERO);
if (!ioctl_args.lpOutBuffer)
goto invalid;
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r327496 - head/sys/geom/mirror

2018-01-02 Thread Mark Johnston
On Tue, Jan 02, 2018 at 06:11:54PM +, Mark Johnston wrote:
> Author: markj
> Date: Tue Jan  2 18:11:54 2018
> New Revision: 327496
> URL: https://svnweb.freebsd.org/changeset/base/327496
> 
> Log:
>   Fix some I/O ordering issues in gmirror.
>   
>   ...
>   
>   Reviewed by:imp
>   MFC after:  3 weeks
>   Sponsored by:   Dell EMC Isilon
>   Differential Revision:  https://reviews.freebsd.org/D13559

Sorry, I forgot to add:

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


svn commit: r327496 - head/sys/geom/mirror

2018-01-02 Thread Mark Johnston
Author: markj
Date: Tue Jan  2 18:11:54 2018
New Revision: 327496
URL: https://svnweb.freebsd.org/changeset/base/327496

Log:
  Fix some I/O ordering issues in gmirror.
  
  - BIO_FLUSH requests were dispatched to the disks directly from
g_mirror_start() rather than going through the mirror's I/O request
queue, so they could have been reordered with preceding writes.
Address this by processing such requests from the queue, avoiding
direct dispatch.
  - Handling for collisions with synchronization requests was too
fine-grained and could cause reordering of writes. In particular,
BIO_ORDERED was not being honoured. Address this by effectively
freezing the request queue any time a collision with a synchronization
request occurs. The queue is unfrozen once the collision with the
first frozen request is over.
  - The above-mentioned collision handling allowed reads to jump ahead
of writes to the same offset. Address this by freezing all request
types when a collision occurs, not just BIO_WRITEs and BIO_DELETEs.
  
  Also add some more fail points for use in testing error handling.
  
  Reviewed by:  imp
  MFC after:3 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D13559

Modified:
  head/sys/geom/mirror/g_mirror.c

Modified: head/sys/geom/mirror/g_mirror.c
==
--- head/sys/geom/mirror/g_mirror.c Tue Jan  2 17:25:13 2018
(r327495)
+++ head/sys/geom/mirror/g_mirror.c Tue Jan  2 18:11:54 2018
(r327496)
@@ -111,7 +111,8 @@ static void g_mirror_update_device(struct g_mirror_sof
 static void g_mirror_dumpconf(struct sbuf *sb, const char *indent,
 struct g_geom *gp, struct g_consumer *cp, struct g_provider *pp);
 static void g_mirror_sync_stop(struct g_mirror_disk *disk, int type);
-static void g_mirror_register_request(struct bio *bp);
+static void g_mirror_register_request(struct g_mirror_softc *sc,
+struct bio *bp);
 static void g_mirror_sync_release(struct g_mirror_softc *sc);
 
 
@@ -892,27 +893,6 @@ g_mirror_unidle(struct g_mirror_softc *sc)
 }
 
 static void
-g_mirror_flush_done(struct bio *bp)
-{
-   struct g_mirror_softc *sc;
-   struct bio *pbp;
-
-   pbp = bp->bio_parent;
-   sc = pbp->bio_to->private;
-   mtx_lock(>sc_done_mtx);
-   if (pbp->bio_error == 0)
-   pbp->bio_error = bp->bio_error;
-   pbp->bio_completed += bp->bio_completed;
-   pbp->bio_inbed++;
-   if (pbp->bio_children == pbp->bio_inbed) {
-   mtx_unlock(>sc_done_mtx);
-   g_io_deliver(pbp, pbp->bio_error);
-   } else
-   mtx_unlock(>sc_done_mtx);
-   g_destroy_bio(bp);
-}
-
-static void
 g_mirror_done(struct bio *bp)
 {
struct g_mirror_softc *sc;
@@ -926,32 +906,76 @@ g_mirror_done(struct bio *bp)
 }
 
 static void
-g_mirror_regular_request(struct bio *bp)
+g_mirror_regular_request_error(struct g_mirror_softc *sc, struct bio *bp)
 {
-   struct g_mirror_softc *sc;
struct g_mirror_disk *disk;
+
+   disk = bp->bio_from->private;
+
+   if (bp->bio_cmd == BIO_FLUSH && bp->bio_error == EOPNOTSUPP)
+   return;
+   if (disk == NULL)
+   return;
+
+   if ((disk->d_flags & G_MIRROR_DISK_FLAG_BROKEN) == 0) {
+   disk->d_flags |= G_MIRROR_DISK_FLAG_BROKEN;
+   G_MIRROR_LOGREQ(0, bp, "Request failed (error=%d).",
+   bp->bio_error);
+   } else {
+   G_MIRROR_LOGREQ(1, bp, "Request failed (error=%d).",
+   bp->bio_error);
+   }
+   if (g_mirror_disconnect_on_failure &&
+   g_mirror_ndisks(sc, G_MIRROR_DISK_STATE_ACTIVE) > 1) {
+   if (bp->bio_error == ENXIO &&
+   bp->bio_cmd == BIO_READ)
+   sc->sc_bump_id |= G_MIRROR_BUMP_SYNCID;
+   else if (bp->bio_error == ENXIO)
+   sc->sc_bump_id |= G_MIRROR_BUMP_SYNCID_NOW;
+   else
+   sc->sc_bump_id |= G_MIRROR_BUMP_GENID;
+   g_mirror_event_send(disk, G_MIRROR_DISK_STATE_DISCONNECTED,
+   G_MIRROR_EVENT_DONTWAIT);
+   }
+}
+
+static void
+g_mirror_regular_request(struct g_mirror_softc *sc, struct bio *bp)
+{
struct bio *pbp;
 
g_topology_assert_not();
+   KASSERT(sc->sc_provider == bp->bio_parent->bio_to,
+   ("regular request %p with unexpected origin", bp));
 
pbp = bp->bio_parent;
-   sc = pbp->bio_to->private;
bp->bio_from->index--;
if (bp->bio_cmd == BIO_WRITE || bp->bio_cmd == BIO_DELETE)
sc->sc_writes--;
-   disk = bp->bio_from->private;
-   if (disk == NULL) {
+   if (bp->bio_from->private == NULL) {
g_topology_lock();
g_mirror_kill_consumer(sc, bp->bio_from);
g_topology_unlock();
}
 

Re: svn commit: r327495 - head/usr.sbin/rpcbind

2018-01-02 Thread Conrad Meyer
On Tue, Jan 2, 2018 at 9:25 AM, Conrad Meyer  wrote:
> Author: cem
> Date: Tue Jan  2 17:25:13 2018
> New Revision: 327495
> URL: https://svnweb.freebsd.org/changeset/base/327495
>
> Log:
>   rpcbind: Fix race in signal termination
>
>   If a signal was delivered while the main thread was not in poll(2) and after
>   check was performed, we could reenter poll and never detect termination. Fix
>   this with the pipefd trick.  (This race was introduced very recently, in
>   r327482.)
>
>   PR:   224503
>   Reported by:  kib
>   Reviewed by:  kib, markj
>   Sponsored by: Dell EMC Isilon

I forgot:
Differential Revision: https://reviews.freebsd.org/D13732

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


svn commit: r327495 - head/usr.sbin/rpcbind

2018-01-02 Thread Conrad Meyer
Author: cem
Date: Tue Jan  2 17:25:13 2018
New Revision: 327495
URL: https://svnweb.freebsd.org/changeset/base/327495

Log:
  rpcbind: Fix race in signal termination
  
  If a signal was delivered while the main thread was not in poll(2) and after
  check was performed, we could reenter poll and never detect termination. Fix
  this with the pipefd trick.  (This race was introduced very recently, in
  r327482.)
  
  PR:   224503
  Reported by:  kib
  Reviewed by:  kib, markj
  Sponsored by: Dell EMC Isilon

Modified:
  head/usr.sbin/rpcbind/rpcb_svc_com.c
  head/usr.sbin/rpcbind/rpcbind.c
  head/usr.sbin/rpcbind/rpcbind.h

Modified: head/usr.sbin/rpcbind/rpcb_svc_com.c
==
--- head/usr.sbin/rpcbind/rpcb_svc_com.cTue Jan  2 16:50:57 2018
(r327494)
+++ head/usr.sbin/rpcbind/rpcb_svc_com.cTue Jan  2 17:25:13 2018
(r327495)
@@ -1101,7 +1101,7 @@ void
 my_svc_run(void)
 {
size_t nfds;
-   struct pollfd pollfds[FD_SETSIZE];
+   struct pollfd pollfds[FD_SETSIZE + 1];
int poll_ret, check_ret;
int n;
 #ifdef SVC_RUN_DEBUG
@@ -1112,6 +1112,9 @@ my_svc_run(void)
 
for (;;) {
p = pollfds;
+   p->fd = terminate_rfd;
+   p->events = MASKVAL;
+   p++;
for (n = 0; n <= svc_maxfd; n++) {
if (FD_ISSET(n, _fdset)) {
p->fd = n;
@@ -1130,23 +1133,26 @@ my_svc_run(void)
fprintf(stderr, ">\n");
}
 #endif
-   switch (poll_ret = poll(pollfds, nfds, 30 * 1000)) {
+   poll_ret = poll(pollfds, nfds, 30 * 1000);
+
+   if (doterminate != 0) {
+   close(rpcbindlockfd);
+#ifdef WARMSTART
+   syslog(LOG_ERR,
+   "rpcbind terminating on signal %d. Restart with 
\"rpcbind -w\"",
+   (int)doterminate);
+   write_warmstart();  /* Dump yourself */
+#endif
+   exit(2);
+   }
+
+   switch (poll_ret) {
case -1:
/*
 * We ignore all errors, continuing with the assumption
 * that it was set by the signal handlers (or any
 * other outside event) and not caused by poll().
 */
-   if (doterminate != 0) {
-   close(rpcbindlockfd);
-#ifdef WARMSTART
-   syslog(LOG_ERR,
-   "rpcbind terminating on signal %d. Restart 
with \"rpcbind -w\"",
-   (int)doterminate);
-   write_warmstart();  /* Dump yourself */
-#endif
-   exit(2);
-   }
case 0:
cleanfds = svc_fdset;
__svc_clean_idle(, 30, FALSE);

Modified: head/usr.sbin/rpcbind/rpcbind.c
==
--- head/usr.sbin/rpcbind/rpcbind.c Tue Jan  2 16:50:57 2018
(r327494)
+++ head/usr.sbin/rpcbind/rpcbind.c Tue Jan  2 17:25:13 2018
(r327495)
@@ -79,6 +79,7 @@ staticchar sccsid[] = "@(#)rpcbind.c 1.35 89/04/21 Co
 /* Global variables */
 int debugging = 0; /* Tell me what's going on */
 int doabort = 0;   /* When debugging, do an abort on errors */
+int terminate_rfd; /* Pipefd to wake on signal */
 volatile sig_atomic_t doterminate = 0; /* Terminal signal received */
 rpcblist_ptr list_rbl; /* A list of version 3/4 rpcbind services */
 int rpcbindlockfd;
@@ -101,6 +102,7 @@ static struct sockaddr **bound_sa;
 static int ipv6_only = 0;
 static int nhosts = 0;
 static int on = 1;
+static int terminate_wfd;
 
 #ifdef WARMSTART
 /* Local Variable */
@@ -133,6 +135,7 @@ main(int argc, char *argv[])
void *nc_handle;/* Net config handle */
struct rlimit rl;
int maxrec = RPC_MAXDATASIZE;
+   int error, fds[2];
 
parseargs(argc, argv);
 
@@ -192,6 +195,16 @@ main(int argc, char *argv[])
}
endnetconfig(nc_handle);
 
+   /*
+* Allocate pipe fd to wake main thread from signal handler in non-racy
+* way.
+*/
+   error = pipe(fds);
+   if (error != 0)
+   err(1, "pipe failed");
+   terminate_rfd = fds[0];
+   terminate_wfd = fds[1];
+
/* catch the usual termination signals for graceful exit */
(void) signal(SIGCHLD, reap);
(void) signal(SIGINT, terminate);
@@ -761,8 +774,13 @@ rbllist_add(rpcprog_t prog, rpcvers_t vers, struct net
 static void
 terminate(int signum)
 {
+   char c = '\0';
+   ssize_t wr;
 
doterminate = signum;
+   wr = 

svn commit: r327494 - head/usr.sbin/mailwrapper

2018-01-02 Thread Baptiste Daroussin
Author: bapt
Date: Tue Jan  2 16:50:57 2018
New Revision: 327494
URL: https://svnweb.freebsd.org/changeset/base/327494

Log:
  Revert r326844
  
  There has been some fallout from the change. The change itself was not 
valueable
  enough to spend time investigating the corner cases, let's just back it out.
  
  Reported by:  flo

Modified:
  head/usr.sbin/mailwrapper/Makefile
  head/usr.sbin/mailwrapper/Makefile.depend
  head/usr.sbin/mailwrapper/mailwrapper.c

Modified: head/usr.sbin/mailwrapper/Makefile
==
--- head/usr.sbin/mailwrapper/Makefile  Tue Jan  2 16:19:41 2018
(r327493)
+++ head/usr.sbin/mailwrapper/Makefile  Tue Jan  2 16:50:57 2018
(r327494)
@@ -5,6 +5,8 @@
 .if ${MK_MAILWRAPPER} != "no"
 PROG=  mailwrapper
 MAN=   mailwrapper.8
+
+LIBADD=util
 .endif
 
 .if ${MK_MAILWRAPPER} != "no" || ${MK_SENDMAIL} != "no"

Modified: head/usr.sbin/mailwrapper/Makefile.depend
==
--- head/usr.sbin/mailwrapper/Makefile.depend   Tue Jan  2 16:19:41 2018
(r327493)
+++ head/usr.sbin/mailwrapper/Makefile.depend   Tue Jan  2 16:50:57 2018
(r327494)
@@ -7,7 +7,8 @@ DIRDEPS = \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
-   lib/libcompiler_rt
+   lib/libcompiler_rt \
+   lib/libutil \
 
 
 .include 

Modified: head/usr.sbin/mailwrapper/mailwrapper.c
==
--- head/usr.sbin/mailwrapper/mailwrapper.c Tue Jan  2 16:19:41 2018
(r327493)
+++ head/usr.sbin/mailwrapper/mailwrapper.c Tue Jan  2 16:50:57 2018
(r327494)
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -88,17 +89,14 @@ int
 main(int argc, char *argv[], char *envp[])
 {
FILE *config;
-   char *line, *cp, *from, *to, *ap, *walk;
+   char *line, *cp, *from, *to, *ap;
const char *progname;
char localmailerconf[MAXPATHLEN];
const char *mailerconf;
-   size_t linecap = 0, lineno = 0;
-   ssize_t linelen;
+   size_t len, lineno = 0;
int i;
struct arglist al;
 
-   line = NULL;
-
/* change __progname to mailwrapper so we get sensible error messages */
progname = getprogname();
setprogname("mailwrapper");
@@ -125,16 +123,12 @@ main(int argc, char *argv[], char *envp[])
}
 
for (;;) {
-   if ((linelen = getline(, , config)) <= 0) {
-   if (feof(config)) {
+   if ((line = fparseln(config, , , NULL, 0)) == NULL) {
+   if (feof(config))
errx(EX_CONFIG, "no mapping in %s", mailerconf);
-   }
err(EX_CONFIG, "cannot parse line %lu", (u_long)lineno);
}
-   lineno++;
-   walk = line;
-   /* strip comments */
-   strsep(, "#");
+
 #defineWS  " \t\n"
cp = line;
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r327476 - head/sbin/shutdown

2018-01-02 Thread Rodney W. Grimes
[ Charset UTF-8 unsupported, converting... ]
> On 1 January 2018 at 15:22, Rodney W. Grimes
>  wrote:
> >>
> >> Baah. This is what happens when my build/test and commit box are not the
> >> same. Will fix later when I get back home.
> 
> Done. One of these days I will actually perfect my edit-test-commit
> cycle and make fewer mistakes :'(

Thank you,
it is a long and steep learning curve,
some of us are still on it!


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


svn commit: r327490 - head/share/man/man4

2018-01-02 Thread Kyle Evans
Author: kevans
Date: Tue Jan  2 14:54:54 2018
New Revision: 327490
URL: https://svnweb.freebsd.org/changeset/base/327490

Log:
  aw_sid: Add man page for this driver
  
  Reviewed by:  manu, bjk (both earlier version), brueffer (manpages)
  Differential Revision:https://reviews.freebsd.org/D13720

Added:
  head/share/man/man4/aw_sid.4   (contents, props changed)
Modified:
  head/share/man/man4/Makefile

Modified: head/share/man/man4/Makefile
==
--- head/share/man/man4/MakefileTue Jan  2 14:07:55 2018
(r327489)
+++ head/share/man/man4/MakefileTue Jan  2 14:54:54 2018
(r327490)
@@ -73,6 +73,7 @@ MAN=  aac.4 \
${_aw_gpio.4} \
${_aw_mmc.4} \
${_aw_rtc.4} \
+   ${_aw_sid.4} \
axe.4 \
axge.4 \
bce.4 \
@@ -763,6 +764,7 @@ _armv8crypto.4= armv8crypto.4
 _aw_gpio.4=aw_gpio.4
 _aw_mmc.4= aw_mmc.4
 _aw_rtc.4= aw_rtc.4
+_aw_sid.4= aw_sid.4
 .endif
 
 .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"

Added: head/share/man/man4/aw_sid.4
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man4/aw_sid.4Tue Jan  2 14:54:54 2018
(r327490)
@@ -0,0 +1,74 @@
+.\"-
+.\" Copyright (c) 2018 Kyle Evans 
+.\" 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$
+.\"
+.Dd January 2, 2018
+.Dt AW_SID 4
+.Os
+.Sh NAME
+.Nm aw_sid
+.Nd driver for the SID controller in Allwinner SoC
+.Sh DESCRIPTION
+The
+.Nm
+device driver provides support for the Allwinner SID (Security ID) controller.
+This controller provides root security keys that may be used as either a device
+unique ID or to generate a MAC address.
+.Sh HARDWARE
+The
+.Nm
+driver supports the SID controller with one of the following compatible
+strings:
+.Pp
+.Bl -bullet -compact
+.It
+allwinner,sun4i-a10-sid
+.It
+allwinner,sun7i-a20-sid
+.It
+allwinner,sun50i-a64-sid
+.It
+allwinner,sun8i-a83t-sid
+.El
+.Sh SYSCTL VARIABLES
+The following read-only variables are available via
+.Xr sysctl 8 :
+.Bl -tag -width indent
+.It Va dev.aw_sid.rootkey
+Root security key for this device.
+.El
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 11.0 .
+.Sh AUTHORS
+The
+.Nm
+device driver was written by
+.An Jared McNeill Aq Mt jmcne...@invisible.ca .
+This manual page was written by
+.An Kyle Evans Aq Mt kev...@freebsd.org .
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327489 - head/contrib/elftoolchain/elfcopy

2018-01-02 Thread Ed Maste
Author: emaste
Date: Tue Jan  2 14:07:55 2018
New Revision: 327489
URL: https://svnweb.freebsd.org/changeset/base/327489

Log:
  elfcopy: copy raw (untranslated) contents to binary output
  
  Previously elfcopy used elf_getdata to obtain data from ELF sections
  being copied to binary output, but elf_getdata returns data that has
  been translated - that is, data is in host byte order. When the host and
  target differ in endianness (e.g., converting a big-endian MIPS ELF
  object to binary on an x86 host) this resulted in byte-swapped data in
  certain sections such as .dynamic.
  
  Instead use elf_rawdata to keep data in the original, target endianness.
  
  Reported by:  Hiroki Mori , Bill Yuan
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/contrib/elftoolchain/elfcopy/binary.c

Modified: head/contrib/elftoolchain/elfcopy/binary.c
==
--- head/contrib/elftoolchain/elfcopy/binary.c  Tue Jan  2 09:02:42 2018
(r327488)
+++ head/contrib/elftoolchain/elfcopy/binary.c  Tue Jan  2 14:07:55 2018
(r327489)
@@ -101,10 +101,10 @@ create_binary(int ifd, int ofd)
sh.sh_size == 0)
continue;
(void) elf_errno();
-   if ((d = elf_getdata(scn, NULL)) == NULL) {
+   if ((d = elf_rawdata(scn, NULL)) == NULL) {
elferr = elf_errno();
if (elferr != 0)
-   warnx("elf_getdata failed: %s", elf_errmsg(-1));
+   warnx("elf_rawdata failed: %s", elf_errmsg(-1));
continue;
}
if (d->d_buf == NULL || d->d_size == 0)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r327476 - head/sbin/shutdown

2018-01-02 Thread Eitan Adler
On 1 January 2018 at 15:22, Rodney W. Grimes
 wrote:
>>
>> Baah. This is what happens when my build/test and commit box are not the
>> same. Will fix later when I get back home.

Done. One of these days I will actually perfect my edit-test-commit
cycle and make fewer mistakes :'(


-- 
Eitan Adler
Source, Ports, Doc committer
Bugmeister, Ports Security teams
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327488 - head/sbin/shutdown

2018-01-02 Thread Eitan Adler
Author: eadler
Date: Tue Jan  2 09:02:42 2018
New Revision: 327488
URL: https://svnweb.freebsd.org/changeset/base/327488

Log:
  shutdown: Fix r327476 by adding init
  
  Initialize maybe_today. While here sort.
  
  PR:   32411
  Additionally reported by: rgrimes, ian

Modified:
  head/sbin/shutdown/shutdown.c

Modified: head/sbin/shutdown/shutdown.c
==
--- head/sbin/shutdown/shutdown.c   Tue Jan  2 05:27:24 2018
(r327487)
+++ head/sbin/shutdown/shutdown.c   Tue Jan  2 09:02:42 2018
(r327488)
@@ -431,7 +431,7 @@ getoffset(char *timearg)
struct tm *lt;
char *p;
time_t now;
-   int this_year, maybe_today;
+   int maybe_today, this_year;
char *timeunit;
 
(void)time();
@@ -482,6 +482,7 @@ getoffset(char *timearg)
 
unsetenv("TZ"); /* OUR timezone */
lt = localtime();   /* current time val */
+   maybe_today = 1;
 
switch(strlen(timearg)) {
case 10:
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"