svn commit: r339830 - head/usr.sbin/bsdinstall/scripts

2018-10-27 Thread Devin Teske
Author: dteske
Date: Sun Oct 28 00:58:39 2018
New Revision: 339830
URL: https://svnweb.freebsd.org/changeset/base/339830

Log:
  Adjust for 80-columns.
  
  No functional change.
  
  Sponsored by: Smule, Inc.

Modified:
  head/usr.sbin/bsdinstall/scripts/zfsboot

Modified: head/usr.sbin/bsdinstall/scripts/zfsboot
==
--- head/usr.sbin/bsdinstall/scripts/zfsbootSun Oct 28 00:57:44 2018
(r339829)
+++ head/usr.sbin/bsdinstall/scripts/zfsbootSun Oct 28 00:58:39 2018
(r339830)
@@ -347,8 +347,8 @@ dialog_menu_main()
'>>> $msg_install'  '$msg_install_desc'
'$msg_install_help'
'T $msg_pool_type_disks'
-   '$ZFSBOOT_VDEV_TYPE: $n $disks_grammar'
-   '$msg_pool_type_disks_help'
+  '$ZFSBOOT_VDEV_TYPE: $n $disks_grammar'
+  '$msg_pool_type_disks_help'
'- $msg_rescan_devices' '*'
'$msg_rescan_devices_help'
'- $msg_disk_info'  '*'
@@ -361,8 +361,8 @@ dialog_menu_main()
'E $msg_encrypt_disks'  '$usegeli'
'$msg_encrypt_disks_help'
'P $msg_partition_scheme'
-   '$ZFSBOOT_PARTITION_SCHEME 
($ZFSBOOT_BOOT_TYPE)'
-   '$msg_partition_scheme_help'
+  '$ZFSBOOT_PARTITION_SCHEME ($ZFSBOOT_BOOT_TYPE)'
+  '$msg_partition_scheme_help'
'S $msg_swap_size'  '$ZFSBOOT_SWAP_SIZE'
'$msg_swap_size_help'
'M $msg_swap_mirror''$swapmirror'
___
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: r339827 - head/usr.bin/localedef

2018-10-27 Thread Yuri Pankov
Author: yuripv
Date: Sat Oct 27 23:31:42 2018
New Revision: 339827
URL: https://svnweb.freebsd.org/changeset/base/339827

Log:
  localedef: define characters in "space" class also as "print", except
  for the known conflicts ("control" characters can't be "print"able).
  POSIX doesn't explicitly forbid this, and actually includes 
  character in "print".
  
  PR:   225692
  Reviewed by:  bapt, cem (previous version), pfg (previous version)
  Approved by:  kib (mentor)
  Differential Revision:https://reviews.freebsd.org/D17467

Modified:
  head/usr.bin/localedef/ctype.c

Modified: head/usr.bin/localedef/ctype.c
==
--- head/usr.bin/localedef/ctype.c  Sat Oct 27 21:24:28 2018
(r339826)
+++ head/usr.bin/localedef/ctype.c  Sat Oct 27 23:31:42 2018
(r339827)
@@ -120,7 +120,13 @@ add_ctype_impl(ctype_node_t *ctn)
ctn->ctype |= (_ISDIGIT | _ISGRAPH | _ISPRINT | _ISXDIGIT | 
_E4);
break;
case T_ISSPACE:
-   ctn->ctype |= _ISSPACE;
+   /*
+* This can be troublesome as , ,
+* , , and  are defined both
+* as space and cntrl, and POSIX doesn't allow cntrl/print
+* combination.  We will take care of this in dump_ctype().
+*/
+   ctn->ctype |= (_ISSPACE | _ISPRINT);
break;
case T_ISCNTRL:
ctn->ctype |= _ISCNTRL;
@@ -378,9 +384,15 @@ dump_ctype(void)
ctn->ctype |= _ISPRINT;
 
/*
-* Finally, POSIX requires that certain combinations
-* are invalid.  We don't flag this as a fatal error,
-* but we will warn about.
+* POSIX requires that certain combinations are invalid.
+* Try fixing the cases we know about (see add_ctype_impl()).
+*/
+   if ((ctn->ctype & (_ISSPACE|_ISCNTRL)) == (_ISSPACE|_ISCNTRL))
+   ctn->ctype &= ~_ISPRINT;
+
+   /*
+* Finally, don't flag remaining cases as a fatal error,
+* and just warn about them.
 */
if ((ctn->ctype & _ISALPHA) &&
(ctn->ctype & (_ISPUNCT|_ISDIGIT)))
___
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: r339823 - in head/sys/dev: atkbdc evdev kbdmux usb/input

2018-10-27 Thread Vladimir Kondratyev
On 27.10.2018 23:32, Niclas Zeising wrote:
> On 10/27/18 10:22 PM, Vladimir Kondratyev wrote:
>> Author: wulf
>> Date: Sat Oct 27 20:22:41 2018
>> New Revision: 339823
>> URL: https://svnweb.freebsd.org/changeset/base/339823
>>
>> Log:
>>    evdev: Use console lock as evdev lock for all supported keyboard
>> drivers.
>>       Now evdev part of keyboard drivers does not take any locks if
>> corresponding
>>    input/eventN device node is not opened by userland consumers.
>>       Do not assert console lock inside evdev to handle the cases
>> when keyboard
>>    driver is called from some special single-threaded context like
>> shutdown
>>    thread.
>>
> Related to https://reviews.freebsd.org/D15070 ?
>
Yes it is a part of D15070.

Along with r339824 it closes all issues known to me that preventing
evdev to be enabled by default.



___
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: r339826 - in head: sys/amd64/vmm/intel usr.sbin/bhyve

2018-10-27 Thread Yuri Pankov
Author: yuripv
Date: Sat Oct 27 21:24:28 2018
New Revision: 339826
URL: https://svnweb.freebsd.org/changeset/base/339826

Log:
  Provide basic descriptions for VMX exit reason (from "Intel 64 and IA-32
  Architectures Software Developer’s Manual Volume 3").  Add the document
  to SEE ALSO in bhyve.8 (and pet manlint here a bit).
  
  Reviewed by:  jhb, rgrimes, 0mp
  Approved by:  kib (mentor)
  Differential Revision:https://reviews.freebsd.org/D17531

Modified:
  head/sys/amd64/vmm/intel/vmcs.h
  head/usr.sbin/bhyve/bhyve.8
  head/usr.sbin/bhyve/bhyverun.c

Modified: head/sys/amd64/vmm/intel/vmcs.h
==
--- head/sys/amd64/vmm/intel/vmcs.h Sat Oct 27 21:17:01 2018
(r339825)
+++ head/sys/amd64/vmm/intel/vmcs.h Sat Oct 27 21:24:28 2018
(r339826)
@@ -338,6 +338,14 @@ vmcs_write(uint32_t encoding, uint64_t val)
 #define EXIT_REASON_WBINVD 54
 #define EXIT_REASON_XSETBV 55
 #defineEXIT_REASON_APIC_WRITE  56
+#defineEXIT_REASON_RDRAND  57
+#defineEXIT_REASON_INVPCID 58
+#defineEXIT_REASON_VMFUNC  59
+#defineEXIT_REASON_ENCLS   60
+#defineEXIT_REASON_RDSEED  61
+#defineEXIT_REASON_PM_LOG_FULL 62
+#defineEXIT_REASON_XSAVES  63
+#defineEXIT_REASON_XRSTORS 64
 
 /*
  * NMI unblocking due to IRET.

Modified: head/usr.sbin/bhyve/bhyve.8
==
--- head/usr.sbin/bhyve/bhyve.8 Sat Oct 27 21:17:01 2018(r339825)
+++ head/usr.sbin/bhyve/bhyve.8 Sat Oct 27 21:24:28 2018(r339826)
@@ -367,7 +367,11 @@ Emergency write is advertised, but no-op at present.
 .Pp
 Framebuffer devices:
 .Bl -tag -width 10n
-.It Oo rfb= Ns Oo Ar IP: Oc Ns Ar port Oc Ns Oo ,w= Ns Ar width Oc Ns Oo ,h= 
Ns Ar height Oc Ns Oo ,vga= Ns Ar vgaconf Oc Ns Oo Ns ,wait Oc Ns Oo ,password= 
Ns Ar password Oc
+.It Xo
+.Oo rfb= Ns Oo Ar IP\&: Oc Ns Ar port Oc Ns Oo ,w= Ns Ar width Oc Ns Oo ,h= Ns
+.Ar height Oc Ns Oo ,vga= Ns Ar vgaconf Oc Ns Oo Ns ,wait Oc Ns Oo ,password= 
Ns
+.Ar password Oc
+.Xc
 .Bl -tag -width 8n
 .It Ar IPv4:port No or Ar [IPv6%zone]:port
 An
@@ -398,8 +402,8 @@ and memory space
 .Pq 64KB at Ad 0xA .
 The default
 .Dq io
-option should be used for guests that attempt to issue BIOS
-calls which result in I/O port queries, and fail to boot if I/O decode is 
disabled.
+option should be used for guests that attempt to issue BIOS calls which result
+in I/O port queries, and fail to boot if I/O decode is disabled.
 .Pp
 The
 .Dq on
@@ -424,8 +428,8 @@ for configuration notes of particular guests.
 .It wait
 Instruct
 .Nm
-to only boot upon the initiation of a VNC connection, simplifying the 
installation
-of operating systems that require immediate keyboard input.
+to only boot upon the initiation of a VNC connection, simplifying the
+installation of operating systems that require immediate keyboard input.
 This can be removed for post-installation use.
 .It password
 This type of authentication is known to be cryptographically weak and is not
@@ -497,8 +501,9 @@ General purpose registers can be queried for each virt
 registers such as floating-point and system registers cannot be queried.
 .Ss Memory
 Memory (including memory mapped I/O regions) can be read by the debugger,
-but not written.  Memory operations use virtual addresses that are resolved
-to physical addresses via the current virtual CPU's active address translation.
+but not written.
+Memory operations use virtual addresses that are resolved to physical addresses
+via the current virtual CPU's active address translation.
 .Ss Control
 The running guest can be interrupted by the debugger at any time
 .Pq for example, by pressing Ctrl-C in the debugger .
@@ -609,6 +614,12 @@ bhyve -c 2 -m 4G -w -H \\
 .Xr ethers 5 ,
 .Xr bhyvectl 8 ,
 .Xr bhyveload 8
+.Pp
+.Rs
+.%A Intel
+.%B 64 and IA-32 Architectures Software Developer’s Manual
+.%V Volume 3
+.Re
 .Sh HISTORY
 .Nm
 first appeared in

Modified: head/usr.sbin/bhyve/bhyverun.c
==
--- head/usr.sbin/bhyve/bhyverun.c  Sat Oct 27 21:17:01 2018
(r339825)
+++ head/usr.sbin/bhyve/bhyverun.c  Sat Oct 27 21:24:28 2018
(r339826)
@@ -38,6 +38,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 
@@ -89,6 +91,73 @@ __FBSDID("$FreeBSD$");
 #define MB (1024UL * 1024)
 #define GB (1024UL * MB)
 
+static const char * const vmx_exit_reason_desc[] = {
+   [EXIT_REASON_EXCEPTION] = "Exception or non-maskable interrupt (NMI)",
+   [EXIT_REASON_EXT_INTR] = "External interrupt",
+   [EXIT_REASON_TRIPLE_FAULT] = "Triple fault",
+   [EXIT_REASON_INIT] = "INIT signal",
+   [EXIT_REASON_SIPI] = 

Re: svn commit: r339823 - in head/sys/dev: atkbdc evdev kbdmux usb/input

2018-10-27 Thread Niclas Zeising

On 10/27/18 11:26 PM, Vladimir Kondratyev wrote:

On 27.10.2018 23:32, Niclas Zeising wrote:

On 10/27/18 10:22 PM, Vladimir Kondratyev wrote:

Author: wulf
Date: Sat Oct 27 20:22:41 2018
New Revision: 339823
URL: https://svnweb.freebsd.org/changeset/base/339823

Log:
    evdev: Use console lock as evdev lock for all supported keyboard
drivers.
       Now evdev part of keyboard drivers does not take any locks if
corresponding
    input/eventN device node is not opened by userland consumers.
       Do not assert console lock inside evdev to handle the cases
when keyboard
    driver is called from some special single-threaded context like
shutdown
    thread.


Related to https://reviews.freebsd.org/D15070 ?


Yes it is a part of D15070.

Along with r339824 it closes all issues known to me that preventing
evdev to be enabled by default.



Thank you!
Any chance you can add a note in phabricator and close/abandon the review?
Once again thank you!
Regards
--
Niclas Zeising
___
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: r339824 - head/sys/dev/evdev

2018-10-27 Thread Vladimir Kondratyev
Author: wulf
Date: Sat Oct 27 21:04:34 2018
New Revision: 339824
URL: https://svnweb.freebsd.org/changeset/base/339824

Log:
  evdev: disable evdev if it is invoked from KDB or panic context
  
  This allow to prevent deadlock on entering KDB if one of evdev locks is
  already taken by userspace process.
  
  Also this change discards all but LED console events produced by KDB as
  unrelated to userspace.
  
  Tested by:dumbbell (as part of D15070)
  Objected by:  bde (as 'KDB lock an already locked mutex' problem solution)
  MFC after:1 month

Modified:
  head/sys/dev/evdev/cdev.c
  head/sys/dev/evdev/evdev.c
  head/sys/dev/evdev/evdev_private.h

Modified: head/sys/dev/evdev/cdev.c
==
--- head/sys/dev/evdev/cdev.c   Sat Oct 27 20:22:41 2018(r339823)
+++ head/sys/dev/evdev/cdev.c   Sat Oct 27 21:04:34 2018(r339824)
@@ -349,6 +349,19 @@ evdev_ioctl(struct cdev *dev, u_long cmd, caddr_t data
if (client->ec_revoked || evdev == NULL)
return (ENODEV);
 
+   /*
+* Fix evdev state corrupted with discarding of kdb events.
+* EVIOCGKEY and EVIOCGLED ioctls can suffer from this.
+*/
+   if (evdev->ev_kdb_active) {
+   EVDEV_LOCK(evdev);
+   if (evdev->ev_kdb_active) {
+   evdev->ev_kdb_active = false;
+   evdev_restore_after_kdb(evdev);
+   }
+   EVDEV_UNLOCK(evdev);
+   }
+
/* file I/O ioctl handling */
switch (cmd) {
case FIOSETOWN:

Modified: head/sys/dev/evdev/evdev.c
==
--- head/sys/dev/evdev/evdev.c  Sat Oct 27 20:22:41 2018(r339823)
+++ head/sys/dev/evdev/evdev.c  Sat Oct 27 21:04:34 2018(r339824)
@@ -32,9 +32,11 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -763,6 +765,30 @@ evdev_send_event(struct evdev_dev *evdev, uint16_t typ
}
 }
 
+void
+evdev_restore_after_kdb(struct evdev_dev *evdev)
+{
+   int code;
+
+   EVDEV_LOCK_ASSERT(evdev);
+
+   /* Report postponed leds */
+   for (code = 0; code < LED_CNT; code++)
+   if (bit_test(evdev->ev_kdb_led_states, code))
+   evdev_send_event(evdev, EV_LED, code,
+   !bit_test(evdev->ev_led_states, code));
+   bit_nclear(evdev->ev_kdb_led_states, 0, LED_MAX);
+
+   /* Release stuck keys (CTRL + ALT + ESC) */
+   evdev_stop_repeat(evdev);
+   for (code = 0; code < KEY_CNT; code++) {
+   if (bit_test(evdev->ev_key_states, code)) {
+   evdev_send_event(evdev, EV_KEY, code, KEY_EVENT_UP);
+   evdev_send_event(evdev, EV_SYN, SYN_REPORT, 1);
+   }
+   }
+}
+
 int
 evdev_push_event(struct evdev_dev *evdev, uint16_t type, uint16_t code,
 int32_t value)
@@ -771,7 +797,25 @@ evdev_push_event(struct evdev_dev *evdev, uint16_t typ
if (evdev_check_event(evdev, type, code, value) != 0)
return (EINVAL);
 
+   /*
+* Discard all but LEDs kdb events as unrelated to userspace.
+* Aggregate LED updates and postpone reporting until kdb deactivation.
+*/
+   if (kdb_active || SCHEDULER_STOPPED()) {
+   evdev->ev_kdb_active = true;
+   if (type == EV_LED)
+   bit_set(evdev->ev_kdb_led_states,
+   bit_test(evdev->ev_led_states, code) != value);
+   return (0);
+   }
+
EVDEV_ENTER(evdev);
+
+   /* Fix evdev state corrupted with discarding of kdb events */
+   if (evdev->ev_kdb_active) {
+   evdev->ev_kdb_active = false;
+   evdev_restore_after_kdb(evdev);
+   }
 
evdev_modify_event(evdev, type, code, );
if (type == EV_SYN && code == SYN_REPORT &&

Modified: head/sys/dev/evdev/evdev_private.h
==
--- head/sys/dev/evdev/evdev_private.h  Sat Oct 27 20:22:41 2018
(r339823)
+++ head/sys/dev/evdev/evdev_private.h  Sat Oct 27 21:04:34 2018
(r339824)
@@ -117,6 +117,10 @@ struct evdev_dev
bitstr_tbit_decl(ev_sw_states, SW_CNT);
boolev_report_opened;
 
+   /* KDB state: */
+   boolev_kdb_active;
+   bitstr_tbit_decl(ev_kdb_led_states, LED_CNT);
+
/* Multitouch protocol type B state: */
struct evdev_mt *   ev_mt;
 
@@ -190,6 +194,7 @@ int evdev_cdev_destroy(struct evdev_dev *);
 bool evdev_event_supported(struct evdev_dev *, uint16_t);
 void evdev_set_abs_bit(struct evdev_dev *, uint16_t);
 void evdev_set_absinfo(struct evdev_dev *, uint16_t, struct input_absinfo *);
+void evdev_restore_after_kdb(struct 

Re: svn commit: r339823 - in head/sys/dev: atkbdc evdev kbdmux usb/input

2018-10-27 Thread Niclas Zeising

On 10/27/18 10:22 PM, Vladimir Kondratyev wrote:

Author: wulf
Date: Sat Oct 27 20:22:41 2018
New Revision: 339823
URL: https://svnweb.freebsd.org/changeset/base/339823

Log:
   evdev: Use console lock as evdev lock for all supported keyboard drivers.
   
   Now evdev part of keyboard drivers does not take any locks if corresponding

   input/eventN device node is not opened by userland consumers.
   
   Do not assert console lock inside evdev to handle the cases when keyboard

   driver is called from some special single-threaded context like shutdown
   thread.

Modified:
   head/sys/dev/atkbdc/atkbd.c
   head/sys/dev/evdev/evdev_private.h
   head/sys/dev/kbdmux/kbdmux.c
   head/sys/dev/usb/input/ukbd.c



Related to https://reviews.freebsd.org/D15070 ?
Regards
--
Niclas Zeising
___
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: r339823 - in head/sys/dev: atkbdc evdev kbdmux usb/input

2018-10-27 Thread Vladimir Kondratyev
Author: wulf
Date: Sat Oct 27 20:22:41 2018
New Revision: 339823
URL: https://svnweb.freebsd.org/changeset/base/339823

Log:
  evdev: Use console lock as evdev lock for all supported keyboard drivers.
  
  Now evdev part of keyboard drivers does not take any locks if corresponding
  input/eventN device node is not opened by userland consumers.
  
  Do not assert console lock inside evdev to handle the cases when keyboard
  driver is called from some special single-threaded context like shutdown
  thread.

Modified:
  head/sys/dev/atkbdc/atkbd.c
  head/sys/dev/evdev/evdev_private.h
  head/sys/dev/kbdmux/kbdmux.c
  head/sys/dev/usb/input/ukbd.c

Modified: head/sys/dev/atkbdc/atkbd.c
==
--- head/sys/dev/atkbdc/atkbd.c Sat Oct 27 20:17:57 2018(r339822)
+++ head/sys/dev/atkbdc/atkbd.c Sat Oct 27 20:22:41 2018(r339823)
@@ -484,7 +484,7 @@ atkbd_init(int unit, keyboard_t **kbdp, void *arg, int
evdev_support_led(evdev, LED_CAPSL);
evdev_support_led(evdev, LED_SCROLLL);
 
-   if (evdev_register(evdev))
+   if (evdev_register_mtx(evdev, ))
evdev_free(evdev);
else
state->ks_evdev = evdev;

Modified: head/sys/dev/evdev/evdev_private.h
==
--- head/sys/dev/evdev/evdev_private.h  Sat Oct 27 20:17:57 2018
(r339822)
+++ head/sys/dev/evdev/evdev_private.h  Sat Oct 27 20:22:41 2018
(r339823)
@@ -132,9 +132,14 @@ struct evdev_dev
LIST_HEAD(, evdev_client) ev_clients;
 };
 
+#defineSYSTEM_CONSOLE_LOCK 
+
 #defineEVDEV_LOCK(evdev)   mtx_lock((evdev)->ev_lock)
 #defineEVDEV_UNLOCK(evdev) mtx_unlock((evdev)->ev_lock)
-#defineEVDEV_LOCK_ASSERT(evdev)mtx_assert((evdev)->ev_lock, 
MA_OWNED)
+#defineEVDEV_LOCK_ASSERT(evdev)do {
\
+   if ((evdev)->ev_lock != SYSTEM_CONSOLE_LOCK)\
+   mtx_assert((evdev)->ev_lock, MA_OWNED); \
+} while (0)
 #defineEVDEV_ENTER(evdev)  do {
\
if ((evdev)->ev_lock_type == EV_LOCK_INTERNAL)  \
EVDEV_LOCK(evdev);  \

Modified: head/sys/dev/kbdmux/kbdmux.c
==
--- head/sys/dev/kbdmux/kbdmux.cSat Oct 27 20:17:57 2018
(r339822)
+++ head/sys/dev/kbdmux/kbdmux.cSat Oct 27 20:22:41 2018
(r339823)
@@ -505,7 +505,7 @@ kbdmux_init(int unit, keyboard_t **kbdp, void *arg, in
evdev_support_led(evdev, LED_CAPSL);
evdev_support_led(evdev, LED_SCROLLL);
 
-   if (evdev_register(evdev))
+   if (evdev_register_mtx(evdev, ))
evdev_free(evdev);
else
state->ks_evdev = evdev;

Modified: head/sys/dev/usb/input/ukbd.c
==
--- head/sys/dev/usb/input/ukbd.c   Sat Oct 27 20:17:57 2018
(r339822)
+++ head/sys/dev/usb/input/ukbd.c   Sat Oct 27 20:22:41 2018
(r339823)
@@ -1361,7 +1361,7 @@ ukbd_attach(device_t dev)
if (sc->sc_flags & UKBD_FLAG_SCROLLLOCK)
evdev_support_led(evdev, LED_SCROLLL);
 
-   if (evdev_register(evdev))
+   if (evdev_register_mtx(evdev, ))
evdev_free(evdev);
else
sc->sc_evdev = evdev;
___
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: r339822 - head/bin/sh

2018-10-27 Thread Jilles Tjoelker
Author: jilles
Date: Sat Oct 27 20:17:57 2018
New Revision: 339822
URL: https://svnweb.freebsd.org/changeset/base/339822

Log:
  sh: Use exitstatus instead of exerrno to pass EXEXEC status
  
  No functional change is intended.

Modified:
  head/bin/sh/eval.c
  head/bin/sh/exec.c
  head/bin/sh/exec.h
  head/bin/sh/jobs.c
  head/bin/sh/main.c

Modified: head/bin/sh/eval.c
==
--- head/bin/sh/eval.c  Sat Oct 27 19:08:06 2018(r339821)
+++ head/bin/sh/eval.c  Sat Oct 27 20:17:57 2018(r339822)
@@ -468,7 +468,8 @@ evalredir(union node *n, int flags)
popredir();
if (e == EXERROR || e == EXEXEC) {
if (in_redirect) {
-   exitstatus = 2;
+   if (e == EXERROR)
+   exitstatus = 2;
FORCEINTON;
return;
}
@@ -669,8 +670,10 @@ evalbackcmd(union node *n, struct backcmd *result)
forcelocal++;
savehandler = handler;
if (setjmp(jmploc.loc)) {
-   if (exception == EXERROR || exception == EXEXEC)
+   if (exception == EXERROR)
exitstatus = 2;
+   else if (exception == EXEXEC)
+   /* nothing */;
else if (exception != 0) {
handler = savehandler;
forcelocal--;
@@ -1089,7 +1092,7 @@ evalcommand(union node *cmd, int flags, struct backcmd
e = exception;
if (e == EXINT)
exitstatus = SIGINT+128;
-   else if (e != EXEXIT)
+   else if (e != EXEXEC && e != EXEXIT)
exitstatus = 2;
goto cmddone;
}

Modified: head/bin/sh/exec.c
==
--- head/bin/sh/exec.c  Sat Oct 27 19:08:06 2018(r339821)
+++ head/bin/sh/exec.c  Sat Oct 27 20:17:57 2018(r339822)
@@ -91,7 +91,6 @@ struct tblentry {
 
 static struct tblentry *cmdtable[CMDTABLESIZE];
 static int cmdtable_cd = 0;/* cmdtable contains cd-dependent entries */
-int exerrno = 0;   /* Last exec error */
 
 
 static void tryexec(char *, char **, char **);
@@ -135,10 +134,10 @@ shellexec(char **argv, char **envp, const char *path, 
 
/* Map to POSIX errors */
if (e == ENOENT || e == ENOTDIR) {
-   exerrno = 127;
+   exitstatus = 127;
exerror(EXEXEC, "%s: not found", argv[0]);
} else {
-   exerrno = 126;
+   exitstatus = 126;
exerror(EXEXEC, "%s: %s", argv[0], strerror(e));
}
 }

Modified: head/bin/sh/exec.h
==
--- head/bin/sh/exec.h  Sat Oct 27 19:08:06 2018(r339821)
+++ head/bin/sh/exec.h  Sat Oct 27 20:17:57 2018(r339822)
@@ -61,8 +61,6 @@ struct cmdentry {
 #define DO_ERR 0x01/* prints errors */
 #define DO_NOFUNC  0x02/* don't return shell functions, for command */
 
-extern int exerrno;/* last exec error */
-
 void shellexec(char **, char **, const char *, int) __dead2;
 char *padvance(const char **, const char **, const char *);
 void find_command(const char *, struct cmdentry *, int, const char *);

Modified: head/bin/sh/jobs.c
==
--- head/bin/sh/jobs.c  Sat Oct 27 19:08:06 2018(r339821)
+++ head/bin/sh/jobs.c  Sat Oct 27 20:17:57 2018(r339822)
@@ -73,6 +73,7 @@ __FBSDID("$FreeBSD$");
 #include "mystring.h"
 #include "var.h"
 #include "builtins.h"
+#include "eval.h"
 
 
 /*
@@ -1005,7 +1006,7 @@ vforkexecshell(struct job *jp, char **argv, char **env
if (pid == 0) {
TRACE(("Child shell %d\n", (int)getpid()));
if (setjmp(jmploc.loc))
-   _exit(exception == EXEXEC ? exerrno : 2);
+   _exit(exception == EXEXEC ? exitstatus : 2);
if (pip != NULL) {
close(pip[0]);
if (pip[1] != 1) {

Modified: head/bin/sh/main.c
==
--- head/bin/sh/main.c  Sat Oct 27 19:08:06 2018(r339821)
+++ head/bin/sh/main.c  Sat Oct 27 20:17:57 2018(r339822)
@@ -106,10 +106,6 @@ main(int argc, char *argv[])
state = 0;
if (setjmp(main_handler.loc)) {
switch (exception) {
-   case EXEXEC:
-   exitstatus = exerrno;
-   break;

svn commit: r339820 - head/sys/kern

2018-10-27 Thread Mark Johnston
Author: markj
Date: Sat Oct 27 18:48:49 2018
New Revision: 339820
URL: https://svnweb.freebsd.org/changeset/base/339820

Log:
  Use M_WAITOK in init_hwpmc().
  
  No functional change intended.
  
  MFC after:2 weeks

Modified:
  head/sys/kern/kern_pmc.c

Modified: head/sys/kern/kern_pmc.c
==
--- head/sys/kern/kern_pmc.cSat Oct 27 17:49:46 2018(r339819)
+++ head/sys/kern/kern_pmc.cSat Oct 27 18:48:49 2018(r339820)
@@ -360,9 +360,8 @@ init_hwpmc(void *dummy __unused)
"range.\n", pmc_softevents);
pmc_softevents = PMC_EV_DYN_COUNT;
}
-   pmc_softs = malloc(pmc_softevents * sizeof(struct pmc_soft *), 
M_PMCHOOKS, M_NOWAIT|M_ZERO);
-   KASSERT(pmc_softs != NULL, ("cannot allocate soft events table"));
-
+   pmc_softs = malloc(pmc_softevents * sizeof(*pmc_softs), M_PMCHOOKS,
+   M_WAITOK | M_ZERO);
for (domain = 0; domain < NDOMAINS; domain++) {
pmc_dom_hdrs[domain] = malloc_domain(sizeof(struct 
pmc_domain_buffer_header), M_PMC, domain,

M_WAITOK|M_ZERO);
___
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: r339819 - head/sys/vm

2018-10-27 Thread Alan Cox
Author: alc
Date: Sat Oct 27 17:49:46 2018
New Revision: 339819
URL: https://svnweb.freebsd.org/changeset/base/339819

Log:
  Eliminate typically pointless calls to vm_fault_prefault() on soft, copy-
  on-write faults.  On a page fault, when we call vm_fault_prefault(), it
  probes the pmap and the shadow chain of vm objects to see if there are
  opportunities to create read and/or execute-only mappings to neighoring
  pages.  For example, in the case of hard faults, such effort typically pays
  off, that is, mappings are created that eliminate future soft page faults.
  However, in the the case of soft, copy-on-write faults, the effort very
  rarely pays off.  (See the review for some specific data.)
  
  Reviewed by:  kib, markj
  MFC after:3 weeks
  Differential Revision:https://reviews.freebsd.org/D17367

Modified:
  head/sys/vm/vm_fault.c

Modified: head/sys/vm/vm_fault.c
==
--- head/sys/vm/vm_fault.c  Sat Oct 27 17:21:13 2018(r339818)
+++ head/sys/vm/vm_fault.c  Sat Oct 27 17:49:46 2018(r339819)
@@ -1181,6 +1181,16 @@ readrest:
 */
vm_object_pip_wakeup(fs.object);
VM_OBJECT_WUNLOCK(fs.object);
+
+   /*
+* We only try to prefault read-only mappings to the
+* neighboring pages when this copy-on-write fault is
+* a hard fault.  In other cases, trying to prefault
+* is typically wasted effort.
+*/
+   if (faultcount == 0)
+   faultcount = 1;
+
/*
 * Only use the new page below...
 */
___
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: r339818 - in head: libexec/rc sbin/rcorder share/man/man8 usr.sbin/acpi/acpiconf

2018-10-27 Thread Eugene Grosbein
Author: eugen
Date: Sat Oct 27 17:21:13 2018
New Revision: 339818
URL: https://svnweb.freebsd.org/changeset/base/339818

Log:
  rcorder(8): add support for /etc/rc.resume, so it calls "rcorder -k resume"
  and runs scripts containing "KEYWORD: resume" with single "resume" argument.
  
  Working example is the port sysutils/cpupdate that defines
  extra_commands="resume" to reload CPU microcode cleared
  by suspend/resume sequence.
  
  This change does nothing for a system having no scripts with KEYWORD: resume.
  
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D15247

Modified:
  head/libexec/rc/rc.resume
  head/sbin/rcorder/rcorder.8
  head/share/man/man8/rc.8
  head/usr.sbin/acpi/acpiconf/acpiconf.8

Modified: head/libexec/rc/rc.resume
==
--- head/libexec/rc/rc.resume   Sat Oct 27 17:15:58 2018(r339817)
+++ head/libexec/rc/rc.resume   Sat Oct 27 17:21:13 2018(r339818)
@@ -55,4 +55,22 @@ fi
 /usr/bin/logger -t $subsystem resumed at `/bin/date +'%Y%m%d %H:%M:%S'`
 /bin/sync && /bin/sync && /bin/sync
 
+. /etc/rc.subr
+
+load_rc_config
+
+rcorder_opts="-k resume"
+
+case ${local_startup} in
+[Nn][Oo] | '') ;;
+*) find_local_scripts_new ;;
+esac
+
+files=`rcorder ${rcorder_opts} /etc/rc.d/* ${local_rc} 2>/dev/null`
+
+for _rc_elem in $files; do
+   debug "run_rc_script $_rc_elem resume"
+   run_rc_script $_rc_elem resume
+done
+
 exit 0

Modified: head/sbin/rcorder/rcorder.8
==
--- head/sbin/rcorder/rcorder.8 Sat Oct 27 17:15:58 2018(r339817)
+++ head/sbin/rcorder/rcorder.8 Sat Oct 27 17:21:13 2018(r339818)
@@ -31,7 +31,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 10, 2016
+.Dd October 27, 2018
 .Dt RCORDER 8
 .Os
 .Sh NAME
@@ -136,6 +136,23 @@ There must be at least one file with no dependencies i
 arguments passed to
 .Nm
 in order for it to find a starting place in the dependency ordering.
+.Sh KEYWORDS
+There are several
+.Em KEYWORDs
+in use:
+.Bl -tag -width ".Cm shutdown" -offset indent
+.It Cm firstboot, nojail, nojailvnet, nostart
+Used by
+.Xr rc 8 .
+.It Cm resume
+Used by
+.Nm /etc/rc.resume
+(see
+.Xr acpiconf 8 )
+.It Cm shutdown
+Used by
+.Xr rc.shutdown 8 .
+.El
 .Sh DIAGNOSTICS
 The
 .Nm
@@ -156,7 +173,9 @@ A set of files has a circular dependency which was det
 processing the stated file.
 .El
 .Sh SEE ALSO
-.Xr rc 8
+.Xr acpiconf 8 ,
+.Xr rc 8 ,
+.Xr rc.shutdown 8
 .Sh HISTORY
 The
 .Nm

Modified: head/share/man/man8/rc.8
==
--- head/share/man/man8/rc.8Sat Oct 27 17:15:58 2018(r339817)
+++ head/share/man/man8/rc.8Sat Oct 27 17:21:13 2018(r339818)
@@ -44,6 +44,7 @@
 .Nm rc.d/
 .Nm rc.firewall
 .Nm rc.local
+.Nm rc.resume
 .Nm rc.shutdown
 .Nm rc.subr
 .Sh DESCRIPTION
@@ -548,6 +549,7 @@ is unnecessary, but is often included.
 .Xr kill 1 ,
 .Xr rc.conf 5 ,
 .Xr init 8 ,
+.Xr rc.resume 8 ,
 .Xr rc.subr 8 ,
 .Xr rcorder 8 ,
 .Xr reboot 8 ,

Modified: head/usr.sbin/acpi/acpiconf/acpiconf.8
==
--- head/usr.sbin/acpi/acpiconf/acpiconf.8  Sat Oct 27 17:15:58 2018
(r339817)
+++ head/usr.sbin/acpi/acpiconf/acpiconf.8  Sat Oct 27 17:21:13 2018
(r339818)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 22, 2015
+.Dd October 27, 2018
 .Dt ACPICONF 8
 .Os
 .Sh NAME
@@ -72,13 +72,35 @@ If the
 .Pa /etc/rc.suspend
 and
 .Pa /etc/rc.resume
-scripts are executable, they will be run before and after entering
-the given sleep state.
+scripts are executable, they will be run by
+.Xr devd 8
+or
+.Xr apmd 8
+before and after entering the given sleep state.
+.Pp
+The
+.Pa /etc/rc.resume
+script uses the
+.Xr rcorder 8
+utility to call scripts in
+.Pa /etc/rc.d/
+and the
+.Va $local_startup
+directories that have a "resume" KEYWORD.
+Called scripts are supplied with single "resume"
+command line argument. See
+.Xr rc.conf 5
+for more information about
+.Va $local_startup .
 .El
 .Sh SEE ALSO
 .Xr acpi 4 ,
 .Xr acpidump 8 ,
-.Xr apm 8
+.Xr apm 8 ,
+.Xr apmd 8 ,
+.Xr devd 8 ,
+.Xr rc.conf 5 ,
+.Xr rcorder 8
 .Sh HISTORY
 The
 .Nm
___
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: r339817 - head/libexec/makewhatis.local

2018-10-27 Thread Eugene Grosbein
Author: eugen
Date: Sat Oct 27 17:15:58 2018
New Revision: 339817
URL: https://svnweb.freebsd.org/changeset/base/339817

Log:
  makewhatis: do not try to operate on read-only mounted directories
  just to fail later.
  
  MFC after:1 month

Modified:
  head/libexec/makewhatis.local/makewhatis.local.sh

Modified: head/libexec/makewhatis.local/makewhatis.local.sh
==
--- head/libexec/makewhatis.local/makewhatis.local.sh   Sat Oct 27 16:41:34 
2018(r339816)
+++ head/libexec/makewhatis.local/makewhatis.local.sh   Sat Oct 27 17:15:58 
2018(r339817)
@@ -47,10 +47,10 @@ done
 dirs=`echo $dirs | sed 's/:/ /g'`
 case X"$dirs" in X) echo "usage: $0 [options] directories ..."; exit 1;; esac
 
-localdirs=`find -H $dirs -fstype local -type d -prune -print`
+localdirs=`find -H $dirs -fstype local \! -fstype rdonly -type d -prune -print`
 
 case X"$localdirs" in
-   X)  echo "$0: no local-mounted manual directories found: $dirs"
+   X)  echo "$0: no local rw-mounted manual directories found: $dirs"
exit 1;;
*)  exec `basename $0 .local` $opt $localdirs;;
 esac
___
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: r339816 - head/sbin/mount_msdosfs

2018-10-27 Thread Eugene Grosbein
Author: eugen
Date: Sat Oct 27 16:41:34 2018
New Revision: 339816
URL: https://svnweb.freebsd.org/changeset/base/339816

Log:
  mount_msdosfs: do not fail mounts requiring locale name conversion table
  that is already present in a kernel statically.
  
  For example, the command "mount_msdosfs -L ru_RU.KOI8-R" fails with error
  "mount_msdosfs: msdosfs_iconv: File exists" for a kernel having
  options LIBICONV and MSDOSFS_ICONV. After this change, it mounts successfully.
  
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D16951

Modified:
  head/sbin/mount_msdosfs/mount_msdosfs.c

Modified: head/sbin/mount_msdosfs/mount_msdosfs.c
==
--- head/sbin/mount_msdosfs/mount_msdosfs.c Sat Oct 27 16:14:42 2018
(r339815)
+++ head/sbin/mount_msdosfs/mount_msdosfs.c Sat Oct 27 16:41:34 2018
(r339816)
@@ -46,6 +46,7 @@ static const char rcsid[] =
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -308,17 +309,17 @@ set_charset(struct iovec **iov, int *iovlen, const cha
 
build_iovec_argf(iov, iovlen, "cs_win", ENCODING_UNICODE);
error = kiconv_add_xlat16_cspairs(ENCODING_UNICODE, cs_local);
-   if (error)
+   if (error && errno != EEXIST)
return (-1);
if (cs_dos != NULL) {
error = kiconv_add_xlat16_cspairs(cs_dos, cs_local);
-   if (error)
+   if (error && errno != EEXIST)
return (-1);
} else {
build_iovec_argf(iov, iovlen, "cs_dos", cs_local);
error = kiconv_add_xlat16_cspair(cs_local, cs_local,
KICONV_FROM_UPPER | KICONV_LOWER);
-   if (error)
+   if (error && errno != EEXIST)
return (-1);
}
 
___
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: r339815 - in head/sys/geom: . nop part raid stripe uzip

2018-10-27 Thread Eugene Grosbein
Author: eugen
Date: Sat Oct 27 16:14:42 2018
New Revision: 339815
URL: https://svnweb.freebsd.org/changeset/base/339815

Log:
  Extend stripeoffset and stripesize of GEOMs from u_int to off_t
  
  GEOM's stripeoffset overflows at 4 gigabyte margin (2^32)
  because of its u_int type. This leads to incorrect data in the output
  generated by "sysctl kern.geom.confxml" command, "graid list" etc.
  when GEOM array has volumes larger than 4G, for example.
  
  This change does not affect ABI but changes KBI. No MFC planned.
  
  Differential Revision:https://reviews.freebsd.org/D13426

Modified:
  head/sys/geom/geom.h
  head/sys/geom/geom_disk.h
  head/sys/geom/geom_dump.c
  head/sys/geom/geom_redboot.c
  head/sys/geom/geom_subr.c
  head/sys/geom/nop/g_nop.c
  head/sys/geom/part/g_part.c
  head/sys/geom/raid/g_raid.c
  head/sys/geom/stripe/g_stripe.c
  head/sys/geom/stripe/g_stripe.h
  head/sys/geom/uzip/g_uzip.c

Modified: head/sys/geom/geom.h
==
--- head/sys/geom/geom.hSat Oct 27 15:09:35 2018(r339814)
+++ head/sys/geom/geom.hSat Oct 27 16:14:42 2018(r339815)
@@ -215,8 +215,8 @@ struct g_provider {
TAILQ_ENTRY(g_provider) orphan;
off_t   mediasize;
u_int   sectorsize;
-   u_int   stripesize;
-   u_int   stripeoffset;
+   off_t   stripesize;
+   off_t   stripeoffset;
struct devstat  *stat;
u_int   nstart, nend;
u_int   flags;

Modified: head/sys/geom/geom_disk.h
==
--- head/sys/geom/geom_disk.h   Sat Oct 27 15:09:35 2018(r339814)
+++ head/sys/geom/geom_disk.h   Sat Oct 27 16:14:42 2018(r339815)
@@ -109,8 +109,8 @@ struct disk {
u_int   d_fwheads;
u_int   d_maxsize;
off_t   d_delmaxsize;
-   u_int   d_stripeoffset;
-   u_int   d_stripesize;
+   off_t   d_stripeoffset;
+   off_t   d_stripesize;
chard_ident[DISK_IDENT_SIZE];
chard_descr[DISK_IDENT_SIZE];
uint16_td_hba_vendor;
@@ -151,7 +151,8 @@ void disk_add_alias(struct disk *disk, const char *);
 #define DISK_VERSION_030x5856105c
 #define DISK_VERSION_040x5856105d
 #define DISK_VERSION_050x5856105e
-#define DISK_VERSION   DISK_VERSION_05
+#define DISK_VERSION_060x5856105f
+#define DISK_VERSION   DISK_VERSION_06
 
 #endif /* _KERNEL */
 #endif /* _GEOM_GEOM_DISK_H_ */

Modified: head/sys/geom/geom_dump.c
==
--- head/sys/geom/geom_dump.c   Sat Oct 27 15:09:35 2018(r339814)
+++ head/sys/geom/geom_dump.c   Sat Oct 27 16:14:42 2018(r339815)
@@ -64,8 +64,8 @@ g_confdot_provider(struct sbuf *sb, struct g_provider 
 {
 
sbuf_printf(sb, "z%p [shape=hexagon,label=\"%s\\nr%dw%de%d\\nerr#%d\\n"
-   "sector=%u\\nstripe=%u\"];\n", pp, pp->name, pp->acr, pp->acw,
-   pp->ace, pp->error, pp->sectorsize, pp->stripesize);
+   "sector=%u\\nstripe=%ju\"];\n", pp, pp->name, pp->acr, pp->acw,
+   pp->ace, pp->error, pp->sectorsize, (uintmax_t)pp->stripesize);
 }
 
 static void
@@ -216,8 +216,8 @@ g_conf_provider(struct sbuf *sb, struct g_provider *pp
sbuf_printf(sb, "\t  %jd\n",
(intmax_t)pp->mediasize);
sbuf_printf(sb, "\t  %u\n", pp->sectorsize);
-   sbuf_printf(sb, "\t  %u\n", pp->stripesize);
-   sbuf_printf(sb, "\t  %u\n", 
pp->stripeoffset);
+   sbuf_printf(sb, "\t  %ju\n", 
(uintmax_t)pp->stripesize);
+   sbuf_printf(sb, "\t  %ju\n", 
(uintmax_t)pp->stripeoffset);
if (pp->flags & G_PF_WITHER)
sbuf_printf(sb, "\t  \n");
else if (pp->geom->flags & G_GEOM_WITHER)

Modified: head/sys/geom/geom_redboot.c
==
--- head/sys/geom/geom_redboot.cSat Oct 27 15:09:35 2018
(r339814)
+++ head/sys/geom/geom_redboot.cSat Oct 27 16:14:42 2018
(r339815)
@@ -246,7 +246,7 @@ g_redboot_taste(struct g_class *mp, struct g_provider 
int error, sectorsize, i;
struct fis_image_desc *fd, *head;
uint32_t offmask;
-   u_int blksize;  /* NB: flash block size stored as stripesize */
+   off_t blksize;  /* NB: flash block size stored as stripesize */
u_char *buf;
off_t offset;
const char *value;
@@ -283,9 +283,9 @@ g_redboot_taste(struct g_class *mp, struct g_provider 
else
offmask = 0x;   

svn commit: r339814 - in head/sys: dev/random sys

2018-10-27 Thread Conrad Meyer
Author: cem
Date: Sat Oct 27 15:09:35 2018
New Revision: 339814
URL: https://svnweb.freebsd.org/changeset/base/339814

Log:
  random(4): Match enabled sources mask to build options
  
  r287023 and r334450 added build option mechanisms to permanently disable
  spammy and/or low quality entropy sources.
  
  Follow-up those changes by updating the 'enabled' sources mask to match.
  When sources are compile-time disabled, represent them as disabled in the
  source mask, and prevent users from modifying that, like pure sources.
  (Modifying the mask bit would have no effect, but users might think it did
  if it was not prevented.)
  
  Mostly a cosmetic change.
  
  Reviewed by:  markm
  Approved by:  secteam (gordon)
  X-MFC-With:   334450
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D17252

Modified:
  head/sys/dev/random/random_harvestq.c
  head/sys/sys/random.h

Modified: head/sys/dev/random/random_harvestq.c
==
--- head/sys/dev/random/random_harvestq.c   Sat Oct 27 14:44:39 2018
(r339813)
+++ head/sys/dev/random/random_harvestq.c   Sat Oct 27 15:09:35 2018
(r339814)
@@ -64,6 +64,17 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#if defined(RANDOM_ENABLE_ETHER)
+#define _RANDOM_HARVEST_ETHER_OFF 0
+#else
+#define _RANDOM_HARVEST_ETHER_OFF (1u << RANDOM_NET_ETHER)
+#endif
+#if defined(RANDOM_ENABLE_UMA)
+#define _RANDOM_HARVEST_UMA_OFF 0
+#else
+#define _RANDOM_HARVEST_UMA_OFF (1u << RANDOM_UMA)
+#endif
+
 static void random_kthread(void);
 static void random_sources_feed(void);
 
@@ -254,6 +265,10 @@ read_rate_increment(u_int chunk)
 static int
 random_check_uint_harvestmask(SYSCTL_HANDLER_ARGS)
 {
+   static const u_int user_immutable_mask =
+   (((1 << ENTROPYSOURCE) - 1) & (-1UL << RANDOM_PURE_START)) |
+   _RANDOM_HARVEST_ETHER_OFF | _RANDOM_HARVEST_UMA_OFF;
+
int error;
u_int value, orig_value;
 
@@ -268,8 +283,8 @@ random_check_uint_harvestmask(SYSCTL_HANDLER_ARGS)
/*
 * Disallow userspace modification of pure entropy sources.
 */
-   hc_source_mask = (value & ~RANDOM_HARVEST_PURE_MASK) |
-   (orig_value & RANDOM_HARVEST_PURE_MASK);
+   hc_source_mask = (value & ~user_immutable_mask) |
+   (orig_value & user_immutable_mask);
return (0);
 }
 
@@ -351,13 +366,17 @@ random_print_harvestmask_symbolic(SYSCTL_HANDLER_ARGS)
 static void
 random_harvestq_init(void *unused __unused)
 {
+   static const u_int almost_everything_mask =
+   (((1 << (RANDOM_ENVIRONMENTAL_END + 1)) - 1) &
+   ~_RANDOM_HARVEST_ETHER_OFF & ~_RANDOM_HARVEST_UMA_OFF);
+
struct sysctl_oid *random_sys_o;
 
random_sys_o = SYSCTL_ADD_NODE(_clist,
SYSCTL_STATIC_CHILDREN(_kern_random),
OID_AUTO, "harvest", CTLFLAG_RW, 0,
"Entropy Device Parameters");
-   hc_source_mask = RANDOM_HARVEST_EVERYTHING_MASK;
+   hc_source_mask = almost_everything_mask;
SYSCTL_ADD_PROC(_clist,
SYSCTL_CHILDREN(random_sys_o),
OID_AUTO, "mask", CTLTYPE_UINT | CTLFLAG_RW,

Modified: head/sys/sys/random.h
==
--- head/sys/sys/random.h   Sat Oct 27 14:44:39 2018(r339813)
+++ head/sys/sys/random.h   Sat Oct 27 15:09:35 2018(r339814)
@@ -92,9 +92,6 @@ enum random_entropy_source {
 _Static_assert(ENTROPYSOURCE <= 32,
 "hardcoded assumption that values fit in a typical word-sized bitset");
 
-#define RANDOM_HARVEST_EVERYTHING_MASK ((1 << (RANDOM_ENVIRONMENTAL_END + 1)) 
- 1)
-#define RANDOM_HARVEST_PURE_MASK (((1 << ENTROPYSOURCE) - 1) & (-1UL << 
RANDOM_PURE_START))
-
 #define RANDOM_LEGACY_BOOT_ENTROPY_MODULE  "/boot/entropy"
 #define RANDOM_CACHED_BOOT_ENTROPY_MODULE  "boot_entropy_cache"
 #defineRANDOM_CACHED_SKIP_START256
___
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: r339784 - head/sbin/dumpon

2018-10-27 Thread Alexey Dokuchaev
On Fri, Oct 26, 2018 at 07:54:00PM +, Conrad Meyer wrote:
> New Revision: 339784
> URL: https://svnweb.freebsd.org/changeset/base/339784
> 
> Log:
>   dumpon(8): Provide seatbelt against weak RSA keys
>   
> ...
> +#if OPENSSL_VERSION_NUMBER >= 0x1010L
> + if (RSA_security_bits(pubkey) < 112)
> +#else
> + if (RSA_size(pubkey) * 8 < 2048)
> +#endif

Shouldn't the check be against 0x1015L (that is, 1.1.0-pre5) to be
precise?

./danfe
___
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: r339812 - head/libexec/rc

2018-10-27 Thread Dag-Erling Smørgrav
Author: des
Date: Sat Oct 27 09:34:33 2018
New Revision: 339812
URL: https://svnweb.freebsd.org/changeset/base/339812

Log:
  Add default value for local_unbound_tls + fix nearby style bugs.
  
  Reported by:  bcran@
  MFC after:3 days

Modified:
  head/libexec/rc/rc.conf

Modified: head/libexec/rc/rc.conf
==
--- head/libexec/rc/rc.conf Sat Oct 27 07:59:19 2018(r339811)
+++ head/libexec/rc/rc.conf Sat Oct 27 09:34:33 2018(r339812)
@@ -283,8 +283,9 @@ hastd_enable="NO"   # Run the HAST daemon (YES/NO).
 hastd_program="/sbin/hastd"# path to hastd, if you want a different one.
 hastd_flags="" # Optional flags to hastd.
 ctld_enable="NO"   # CAM Target Layer / iSCSI target daemon.
-local_unbound_enable="NO"  # local caching resolver
-blacklistd_enable="NO" # Run blacklistd daemon (YES/NO).
+local_unbound_enable="NO"  # Local caching resolver
+local_unbound_tls="NO" # Use DNS over TLS
+blacklistd_enable="NO" # Run blacklistd daemon (YES/NO).
 blacklistd_flags=""# Optional flags for blacklistd(8).
 resolv_enable="YES"# Enable resolv / resolvconf
 
___
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: r339655 - head/contrib/jemalloc/src

2018-10-27 Thread Antoine Brodin
On Tue, Oct 23, 2018 at 4:11 PM Edward Tomasz Napierala
 wrote:
> Author: trasz
> Date: Tue Oct 23 14:11:35 2018
> New Revision: 339655
> URL: https://svnweb.freebsd.org/changeset/base/339655
>
> Log:
>   Pick f80c97e477d1b3fe7778c65d9439d673738b4131 from upstream:
>
>   Rework the way jemalloc uses mmap(2) on FreeBSD.
>
>   This makes it directly use MAP_EXCL and MAP_ALIGNED() instead
>   of weird workarounds involving mapping at random places and then
>   unmapping parts of them.
>
>   Discussed with:   jasone
>   MFC after:2 weeks
>   Sponsored by: DARPA, AFRL

Hi,

I don't know if it's related,  but we now encounter a jemalloc
assertion when trying to build packages for mips
http://beefy7.nyi.freebsd.org/data/head-mips-default/p483081_s339802/logs/errors/pkg-1.10.5_5.log

Antoine
___
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: r339811 - head/sbin/route

2018-10-27 Thread Eugene Grosbein
Author: eugen
Date: Sat Oct 27 07:59:19 2018
New Revision: 339811
URL: https://svnweb.freebsd.org/changeset/base/339811

Log:
  route(8): correctly return exit status when "-q" flag is used.
  
  Previously, route returned 1 in case of error  properly signalling failure
  but "route -q" it returned 0 for same case. Fix it.
  
  PR:   186333
  MFC after:1 month

Modified:
  head/sbin/route/route.c

Modified: head/sbin/route/route.c
==
--- head/sbin/route/route.c Sat Oct 27 07:32:26 2018(r339810)
+++ head/sbin/route/route.c Sat Oct 27 07:59:19 2018(r339811)
@@ -1050,10 +1050,13 @@ newroute(int argc, char **argv)
}
printf("\n");
}
+   }
 
-   fibnum = 0;
-   TAILQ_FOREACH(fl, _head, fl_next) {
-   if (fl->fl_error != 0) {
+   fibnum = 0;
+   TAILQ_FOREACH(fl, _head, fl_next) {
+   if (fl->fl_error != 0) {
+   error = 1;
+   if (!qflag) {
printf("%s %s %s", cmd, (nrflags & F_ISHOST)
? "host" : "net", dest);
if (*gateway)
@@ -1087,7 +1090,6 @@ newroute(int argc, char **argv)
break;
}
printf(": %s\n", errmsg);
-   error = 1;
}
}
}
___
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: r339809 - head/usr.sbin/cxgbetool

2018-10-27 Thread Navdeep Parhar
Author: np
Date: Sat Oct 27 05:26:09 2018
New Revision: 339809
URL: https://svnweb.freebsd.org/changeset/base/339809

Log:
  cxgbetool(8): Add a subaction (tcbrss ) that can be used with "pass"
  action to distribute traffic using the half of the VI's RSS indirection
  table.
  
  The value specified should either be the start of the VI's RSS slice
  (available at dev...rss_base since r339700) or the
  midpoint (rss_base + rss_size/2).  The traffic that hits the filter will
  use the first or second half of the indirection table respectively.
  The indirection table can be populated in different ways to achieve
  different kinds of traffic/load distributions.  For example, r339749
  allows a netmap interface to have half the rx queues in the first half
  of the table and the rest in the other.
  
  Sponsored by: Chelsio Communications

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

Modified: head/usr.sbin/cxgbetool/cxgbetool.c
==
--- head/usr.sbin/cxgbetool/cxgbetool.c Sat Oct 27 04:59:35 2018
(r339808)
+++ head/usr.sbin/cxgbetool/cxgbetool.c Sat Oct 27 05:26:09 2018
(r339809)
@@ -924,7 +924,7 @@ do_show_one_filter_info(struct t4_filter *t, uint32_t 
if (t->fs.dirsteer == 0) {
printf("RSS");
if (t->fs.maskhash)
-   printf("(TCB=hash)");
+   printf("(region %d)", t->fs.iq << 1);
} else {
printf("%d", t->fs.iq);
if (t->fs.dirsteerhash == 0)
@@ -1263,11 +1263,19 @@ set_filter(uint32_t idx, int argc, const char *argv[],
} else if (!parse_val("rpttid", args, )) {
t.fs.rpttid = 1;
} else if (!parse_val("queue", args, )) {
-   t.fs.dirsteer = 1;
-   t.fs.iq = val;
+   t.fs.dirsteer = 1;  /* direct steer */
+   t.fs.iq = val;  /* to the iq with this cntxt_id 
*/
} else if (!parse_val("tcbhash", args, )) {
-   t.fs.maskhash = 1;
-   t.fs.dirsteerhash = 1;
+   t.fs.dirsteerhash = 1;  /* direct steer */
+   /* XXX: use (val << 1) as the rss_hash? */
+   t.fs.iq = val;
+   } else if (!parse_val("tcbrss", args, )) {
+   t.fs.maskhash = 1;  /* steer to RSS region */
+   /*
+* val = start idx of the region but the internal TCB
+* field is 10b only and is left shifted by 1 before 
use.
+*/
+   t.fs.iq = val >> 1;
} else if (!parse_val("eport", args, )) {
t.fs.eport = val;
} else if (!parse_val("swapmac", args, )) {
___
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: r339808 - head/sys/netinet

2018-10-27 Thread Eugene Grosbein
Author: eugen
Date: Sat Oct 27 04:59:35 2018
New Revision: 339808
URL: https://svnweb.freebsd.org/changeset/base/339808

Log:
  Prevent ip_input() from panicing due to unprotected access to INADDR_HASH.
  
  PR:   220078
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D12457
  Tested-by:Cassiano Peixoto and others

Modified:
  head/sys/netinet/ip_input.c

Modified: head/sys/netinet/ip_input.c
==
--- head/sys/netinet/ip_input.c Sat Oct 27 04:53:25 2018(r339807)
+++ head/sys/netinet/ip_input.c Sat Oct 27 04:59:35 2018(r339808)
@@ -448,6 +448,7 @@ ip_direct_input(struct mbuf *m)
 void
 ip_input(struct mbuf *m)
 {
+   struct rm_priotracker in_ifa_tracker;
struct ip *ip = NULL;
struct in_ifaddr *ia = NULL;
struct ifaddr *ifa;
@@ -681,7 +682,7 @@ passin:
/*
 * Check for exact addresses in the hash bucket.
 */
-   /* IN_IFADDR_RLOCK(); */
+   IN_IFADDR_RLOCK(_ifa_tracker);
LIST_FOREACH(ia, INADDR_HASH(ip->ip_dst.s_addr), ia_hash) {
/*
 * If the address matches, verify that the packet
@@ -693,11 +694,11 @@ passin:
counter_u64_add(ia->ia_ifa.ifa_ipackets, 1);
counter_u64_add(ia->ia_ifa.ifa_ibytes,
m->m_pkthdr.len);
-   /* IN_IFADDR_RUNLOCK(); */
+   IN_IFADDR_RUNLOCK(_ifa_tracker);
goto ours;
}
}
-   /* IN_IFADDR_RUNLOCK(); */
+   IN_IFADDR_RUNLOCK(_ifa_tracker);
 
/*
 * Check for broadcast addresses.
___
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: r339806 - head/sys/net

2018-10-27 Thread Eugene Grosbein
Author: eugen
Date: Sat Oct 27 04:45:28 2018
New Revision: 339806
URL: https://svnweb.freebsd.org/changeset/base/339806

Log:
  Prevent stf(4) from panicing due to unprotected access to INADDR_HASH.
  
  PR:   220078
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D12457
  Tested-by:Cassiano Peixoto and others

Modified:
  head/sys/net/if_stf.c

Modified: head/sys/net/if_stf.c
==
--- head/sys/net/if_stf.c   Sat Oct 27 04:10:42 2018(r339805)
+++ head/sys/net/if_stf.c   Sat Oct 27 04:45:28 2018(r339806)
@@ -367,6 +367,7 @@ stf_encapcheck(const struct mbuf *m, int off, int prot
 static int
 stf_getsrcifa6(struct ifnet *ifp, struct in6_addr *addr, struct in6_addr *mask)
 {
+   struct rm_priotracker in_ifa_tracker;
struct ifaddr *ia;
struct in_ifaddr *ia4;
struct in6_ifaddr *ia6;
@@ -382,9 +383,11 @@ stf_getsrcifa6(struct ifnet *ifp, struct in6_addr *add
continue;
 
bcopy(GET_V4(>sin6_addr), , sizeof(in));
+   IN_IFADDR_RLOCK(_ifa_tracker);
LIST_FOREACH(ia4, INADDR_HASH(in.s_addr), ia_hash)
if (ia4->ia_addr.sin_addr.s_addr == in.s_addr)
break;
+   IN_IFADDR_RUNLOCK(_ifa_tracker);
if (ia4 == NULL)
continue;
 
___
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: r339805 - head/stand/lua

2018-10-27 Thread Kyle Evans
Author: kevans
Date: Sat Oct 27 04:10:42 2018
New Revision: 339805
URL: https://svnweb.freebsd.org/changeset/base/339805

Log:
  lualoader: Always return a proper dictionary for blacklist
  
  If module_blacklist isn't specified, we have an empty blacklist; effectively
  the same as if module_blacklist="" were specified in loader.conf(5).
  
  This was reported when switching to a BE that predated the module_blacklist
  introduction, but the problem is valid all the same and likely to be tripped
  over in other scenarios.
  
  Reported by:  bwidawsk
  MFC after:3 days

Modified:
  head/stand/lua/config.lua

Modified: head/stand/lua/config.lua
==
--- head/stand/lua/config.lua   Sat Oct 27 03:37:14 2018(r339804)
+++ head/stand/lua/config.lua   Sat Oct 27 04:10:42 2018(r339805)
@@ -266,12 +266,12 @@ local function isValidComment(line)
 end
 
 local function getBlacklist()
+   local blacklist = {}
local blacklist_str = loader.getenv('module_blacklist')
if blacklist_str == nil then
-   return nil
+   return blacklist
end
 
-   local blacklist = {}
for mod in blacklist_str:gmatch("[;, ]?([%w-_]+)[;, ]?") do
blacklist[mod] = true
end
___
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: r339810 - head/sys/netpfil/ipfw

2018-10-27 Thread Eugene Grosbein
Author: eugen
Date: Sat Oct 27 07:32:26 2018
New Revision: 339810
URL: https://svnweb.freebsd.org/changeset/base/339810

Log:
  ipfw: implement ngtee/netgraph actions for layer-2 frames.
  
  Kernel part of ipfw does not support and ignores rules other than
  "pass", "deny" and dummynet-related for layer-2 (ethernet frames).
  Others are processed as "pass".
  
  Make it support ngtee/netgraph rules just like they are supported
  for IP packets. For example, this allows us to mirror some frames
  selectively to another interface for delivery to remote network analyzer
  over RSPAN vlan. Assuming ng_ipfw(4) netgraph node has a hook named "900"
  attached to "lower" hook of vlan900's ng_ether(4) node, that would be
  as simple as:
  
  ipfw add ngtee 900 ip from any to 8.8.8.8 layer2 out xmit igb0
  
  PR:   213452
  MFC after:1 month
  Tested-by:Fyodor Ustinov 

Modified:
  head/sys/netpfil/ipfw/ip_fw_pfil.c

Modified: head/sys/netpfil/ipfw/ip_fw_pfil.c
==
--- head/sys/netpfil/ipfw/ip_fw_pfil.c  Sat Oct 27 05:26:09 2018
(r339809)
+++ head/sys/netpfil/ipfw/ip_fw_pfil.c  Sat Oct 27 07:32:26 2018
(r339810)
@@ -317,11 +317,12 @@ ipfw_check_frame(void *arg, struct mbuf **m0, struct i
struct ip_fw_args args;
struct m_tag *mtag;
 
+   bzero(, sizeof(args));
+
+again:
/* fetch start point from rule, if any.  remove the tag if present. */
mtag = m_tag_locate(*m0, MTAG_IPFW_RULE, 0, NULL);
-   if (mtag == NULL) {
-   args.rule.slot = 0;
-   } else {
+   if (mtag != NULL) {
args.rule = *((struct ipfw_rule_ref *)(mtag+1));
m_tag_delete(*m0, mtag);
if (args.rule.info & IPFW_ONEPASS)
@@ -378,14 +379,27 @@ ipfw_check_frame(void *arg, struct mbuf **m0, struct i
 
case IP_FW_DUMMYNET:
ret = EACCES;
+   int dir2;
 
if (ip_dn_io_ptr == NULL)
break; /* i.e. drop */
 
*m0 = NULL;
-   dir = (dir == PFIL_IN) ? DIR_IN : DIR_OUT;
-   ip_dn_io_ptr(, dir | PROTO_LAYER2, );
+   dir2 = (dir == PFIL_IN) ? DIR_IN : DIR_OUT;
+   ip_dn_io_ptr(, dir2 | PROTO_LAYER2, );
return 0;
+
+   case IP_FW_NGTEE:
+   case IP_FW_NETGRAPH:
+   if (ng_ipfw_input_p == NULL) {
+   ret = EACCES;
+   break; /* i.e. drop */
+   }
+   ret = ng_ipfw_input_p(m0, (dir == PFIL_IN) ? DIR_IN : DIR_OUT,
+   , (i == IP_FW_NGTEE) ? 1 : 0);
+   if (i == IP_FW_NGTEE) /* ignore errors for NGTEE */
+   goto again; /* continue with packet */
+   break;
 
default:
KASSERT(0, ("%s: unknown retval", __func__));
___
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: r339807 - head/sys/netinet

2018-10-27 Thread Eugene Grosbein
Author: eugen
Date: Sat Oct 27 04:53:25 2018
New Revision: 339807
URL: https://svnweb.freebsd.org/changeset/base/339807

Log:
  Prevent multicast code from panicing due to unprotected access to INADDR_HASH.
  
  PR:   220078
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D12457
  Tested-by:Cassiano Peixoto and others

Modified:
  head/sys/netinet/in_mcast.c

Modified: head/sys/netinet/in_mcast.c
==
--- head/sys/netinet/in_mcast.c Sat Oct 27 04:45:28 2018(r339806)
+++ head/sys/netinet/in_mcast.c Sat Oct 27 04:53:25 2018(r339807)
@@ -1444,6 +1444,7 @@ static int
 inp_block_unblock_source(struct inpcb *inp, struct sockopt *sopt)
 {
struct group_source_req  gsr;
+   struct rm_priotrackerin_ifa_tracker;
sockunion_t *gsa, *ssa;
struct ifnet*ifp;
struct in_mfilter   *imf;
@@ -1481,9 +1482,11 @@ inp_block_unblock_source(struct inpcb *inp, struct soc
ssa->sin.sin_len = sizeof(struct sockaddr_in);
ssa->sin.sin_addr = mreqs.imr_sourceaddr;
 
-   if (!in_nullhost(mreqs.imr_interface))
+   if (!in_nullhost(mreqs.imr_interface)) {
+   IN_IFADDR_RLOCK(_ifa_tracker);
INADDR_TO_IFP(mreqs.imr_interface, ifp);
-
+   IN_IFADDR_RUNLOCK(_ifa_tracker);
+   }
if (sopt->sopt_name == IP_BLOCK_SOURCE)
doblock = 1;
 
@@ -1969,7 +1972,6 @@ inp_getmoptions(struct inpcb *inp, struct sockopt *sop
  *
  * Returns NULL if no ifp could be found.
  *
- * SMPng: TODO: Acquire the appropriate locks for INADDR_TO_IFP.
  * FUTURE: Implement IPv4 source-address selection.
  */
 static struct ifnet *
@@ -1987,7 +1989,9 @@ inp_lookup_mcast_ifp(const struct inpcb *inp,
 
ifp = NULL;
if (!in_nullhost(ina)) {
+   IN_IFADDR_RLOCK(_ifa_tracker);
INADDR_TO_IFP(ina, ifp);
+   IN_IFADDR_RUNLOCK(_ifa_tracker);
} else {
fibnum = inp ? inp->inp_inc.inc_fibnum : 0;
if (fib4_lookup_nh_basic(fibnum, gsin->sin_addr, 0, 0, )==0)
@@ -2332,6 +2336,7 @@ inp_leave_group(struct inpcb *inp, struct sockopt *sop
 {
struct group_source_req  gsr;
struct ip_mreq_sourcemreqs;
+   struct rm_priotrackerin_ifa_tracker;
sockunion_t *gsa, *ssa;
struct ifnet*ifp;
struct in_mfilter   *imf;
@@ -2390,9 +2395,11 @@ inp_leave_group(struct inpcb *inp, struct sockopt *sop
 * XXX NOTE WELL: The RFC 3678 API is preferred because
 * using an IPv4 address as a key is racy.
 */
-   if (!in_nullhost(mreqs.imr_interface))
+   if (!in_nullhost(mreqs.imr_interface)) {
+   IN_IFADDR_RLOCK(_ifa_tracker);
INADDR_TO_IFP(mreqs.imr_interface, ifp);
-
+   IN_IFADDR_RUNLOCK(_ifa_tracker);
+   }
CTR3(KTR_IGMPV3, "%s: imr_interface = 0x%08x, ifp = %p",
__func__, ntohl(mreqs.imr_interface.s_addr), ifp);
 
@@ -2560,6 +2567,7 @@ out_inp_locked:
 static int
 inp_set_multicast_if(struct inpcb *inp, struct sockopt *sopt)
 {
+   struct rm_priotrackerin_ifa_tracker;
struct in_addr   addr;
struct ip_mreqn  mreqn;
struct ifnet*ifp;
@@ -2598,7 +2606,9 @@ inp_set_multicast_if(struct inpcb *inp, struct sockopt
if (in_nullhost(addr)) {
ifp = NULL;
} else {
+   IN_IFADDR_RLOCK(_ifa_tracker);
INADDR_TO_IFP(addr, ifp);
+   IN_IFADDR_RUNLOCK(_ifa_tracker);
if (ifp == NULL)
return (EADDRNOTAVAIL);
}
___
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: r339804 - head/sys/geom/eli

2018-10-27 Thread Xin LI
Author: delphij
Date: Sat Oct 27 03:37:14 2018
New Revision: 339804
URL: https://svnweb.freebsd.org/changeset/base/339804

Log:
  Restore backward compatibility for "attach" verb.
  
  In r332361 and r333439, two new parameters were added to geli attach
  verb using gctl_get_paraml, which requires the value to be present.
  This would prevent old geli(8) binary from attaching geli(4) device
  as they have no knowledge about the new parameters.
  
  Restore backward compatibility by treating the absense of these two
  values as seeing the default value supplied by userland.
  
  PR:   232595
  Reviewed by:  oshogbo
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D17680

Modified:
  head/sys/geom/eli/g_eli_ctl.c

Modified: head/sys/geom/eli/g_eli_ctl.c
==
--- head/sys/geom/eli/g_eli_ctl.c   Sat Oct 27 03:16:32 2018
(r339803)
+++ head/sys/geom/eli/g_eli_ctl.c   Sat Oct 27 03:37:14 2018
(r339804)
@@ -59,8 +59,8 @@ g_eli_ctl_attach(struct gctl_req *req, struct g_class 
struct g_provider *pp;
const char *name;
u_char *key, mkey[G_ELI_DATAIVKEYLEN];
-   int *nargs, *detach, *readonly, *dryrun;
-   int keysize, error, nkey;
+   int *nargs, *detach, *readonly, *dryrunp;
+   int keysize, error, nkey, dryrun, dummy;
intmax_t *valp;
 
g_topology_assert();
@@ -81,12 +81,14 @@ g_eli_ctl_attach(struct gctl_req *req, struct g_class 
return;
}
 
-   valp = gctl_get_paraml(req, "keyno", sizeof(*valp));
-   if (valp == NULL) {
-   gctl_error(req, "No '%s' argument.", "keyno");
-   return;
+   /* "keyno" is optional for backward compatibility */
+   nkey = -1;
+   valp = gctl_get_param(req, "keyno", );
+   if (valp != NULL) {
+   valp = gctl_get_paraml(req, "keyno", sizeof(*valp));
+   if (valp != NULL)
+   nkey = *valp;
}
-   nkey = *valp;
if (nkey < -1 || nkey >= G_ELI_MAXMKEYS) {
gctl_error(req, "Invalid '%s' argument.", "keyno");
return;
@@ -98,10 +100,13 @@ g_eli_ctl_attach(struct gctl_req *req, struct g_class 
return;
}
 
-   dryrun = gctl_get_paraml(req, "dryrun", sizeof(*dryrun));
-   if (dryrun == NULL) {
-   gctl_error(req, "No '%s' argument.", "dryrun");
-   return;
+   /* "dryrun" is optional for backward compatibility */
+   dryrun = 0;
+   dryrunp = gctl_get_param(req, "dryrun", );
+   if (dryrunp != NULL) {
+   dryrunp = gctl_get_paraml(req, "dryrun", sizeof(*dryrunp));
+   if (dryrunp != NULL)
+   dryrun = *dryrunp;
}
 
if (*detach && *readonly) {
@@ -161,7 +166,7 @@ g_eli_ctl_attach(struct gctl_req *req, struct g_class 
md.md_flags |= G_ELI_FLAG_WO_DETACH;
if (*readonly)
md.md_flags |= G_ELI_FLAG_RO;
-   if (!*dryrun)
+   if (!dryrun)
g_eli_create(req, mp, pp, , mkey, nkey);
explicit_bzero(mkey, sizeof(mkey));
explicit_bzero(, sizeof(md));
___
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"