Re: svn commit: r364946 - head/sys/kern

2020-08-29 Thread Mateusz Guzik
This crashes on boot for me:

atal trap 12: page fault while in kernel mode
cpuid = 0; apic id = 00
fault virtual address   = 0x0
fault code  = supervisor read data, page not present
instruction pointer = 0x20:0x805b0a7f
stack pointer   = 0x28:0xfe002366a7f0
frame pointer   = 0x28:0xfe002366a7f0
code segment= base 0x0, limit 0xf, type 0x1b
= DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags= interrupt enabled, resume, IOPL = 0
current process = 89 (devmatch)
trap number = 12
panic: page fault
cpuid = 0
time = 1598692135
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfe002366a4a0
vpanic() at vpanic+0x182/frame 0xfe002366a4f0
panic() at panic+0x43/frame 0xfe002366a550
trap_fatal() at trap_fatal+0x387/frame 0xfe002366a5b0
trap_pfault() at trap_pfault+0x4f/frame 0xfe002366a610
trap() at trap+0x27d/frame 0xfe002366a720
calltrap() at calltrap+0x8/frame 0xfe002366a720
--- trap 0xc, rip = 0x805b0a7f, rsp = 0xfe002366a7f0, rbp
= 0xfe002366a7f0 ---
strlen() at strlen+0x1f/frame 0xfe002366a7f0
sbuf_cat() at sbuf_cat+0x15/frame 0xfe002366a810
sysctl_devices() at sysctl_devices+0x104/frame 0xfe002366a8a0
sysctl_root_handler_locked() at sysctl_root_handler_locked+0x91/frame
0xfe002366a8f0
sysctl_root() at sysctl_root+0x249/frame 0xfe002366a970
userland_sysctl() at userland_sysctl+0x170/frame 0xfe002366aa20
sys___sysctl() at sys___sysctl+0x5f/frame 0xfe002366aad0
amd64_syscall() at amd64_syscall+0x10c/frame 0xfe002366abf0
fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfe002366abf0
--- syscall (202, FreeBSD ELF64, sys___sysctl), rip = 0x80041c0ea, rsp
= 0x7fffda78, rbp = 0x7fffdab0 ---
KDB: enter: panic
[ thread pid 89 tid 100067 ]
Stopped at  kdb_enter+0x37: movq$0,0x7e2616(%rip)


On 8/29/20, Warner Losh  wrote:
> Author: imp
> Date: Sat Aug 29 04:30:12 2020
> New Revision: 364946
> URL: https://svnweb.freebsd.org/changeset/base/364946
>
> Log:
>   Move to using sbuf for some sysctl in newbus
>
>   Convert two different sysctl to using sbuf. First, for all the default
>   sysctls we implement for each device driver that's attached. This is a
>   pure sbuf conversion.
>
>   Second, convert sysctl_devices to fill its buffer with sbuf rather
>   than a hand-rolled crappy thing I wrote years ago.
>
>   Reviewed by: cem, markj
>   Differential Revision: https://reviews.freebsd.org/D26206
>
> Modified:
>   head/sys/kern/subr_bus.c
>
> Modified: head/sys/kern/subr_bus.c
> ==
> --- head/sys/kern/subr_bus.c  Sat Aug 29 04:30:06 2020(r364945)
> +++ head/sys/kern/subr_bus.c  Sat Aug 29 04:30:12 2020(r364946)
> @@ -260,36 +260,33 @@ enum {
>  static int
>  device_sysctl_handler(SYSCTL_HANDLER_ARGS)
>  {
> + struct sbuf sb;
>   device_t dev = (device_t)arg1;
> - const char *value;
> - char *buf;
>   int error;
>
> - buf = NULL;
> + sbuf_new_for_sysctl(&sb, NULL, 1024, req);
>   switch (arg2) {
>   case DEVICE_SYSCTL_DESC:
> - value = dev->desc ? dev->desc : "";
> + sbuf_cpy(&sb, dev->desc ? dev->desc : "");
>   break;
>   case DEVICE_SYSCTL_DRIVER:
> - value = dev->driver ? dev->driver->name : "";
> + sbuf_cpy(&sb, dev->driver ? dev->driver->name : "");
>   break;
>   case DEVICE_SYSCTL_LOCATION:
> - value = buf = malloc(1024, M_BUS, M_WAITOK | M_ZERO);
> - bus_child_location_str(dev, buf, 1024);
> + bus_child_location_sb(dev, &sb);
>   break;
>   case DEVICE_SYSCTL_PNPINFO:
> - value = buf = malloc(1024, M_BUS, M_WAITOK | M_ZERO);
> - bus_child_pnpinfo_str(dev, buf, 1024);
> + bus_child_pnpinfo_sb(dev, &sb);
>   break;
>   case DEVICE_SYSCTL_PARENT:
> - value = dev->parent ? dev->parent->nameunit : "";
> + sbuf_cpy(&sb, dev->parent ? dev->parent->nameunit : "");
>   break;
>   default:
> + sbuf_delete(&sb);
>   return (EINVAL);
>   }
> - error = SYSCTL_OUT_STR(req, value);
> - if (buf != NULL)
> - free(buf, M_BUS);
> + error = sbuf_finish(&sb);
> + sbuf_delete(&sb);
>   return (error);
>  }
>
> @@ -5464,13 +5461,13 @@ SYSCTL_PROC(_hw_bus, OID_AUTO, info, CTLTYPE_STRUCT
> |
>  static int
>  sysctl_devices(SYSCTL_HANDLER_ARGS)
>  {
> + struct sbuf sb;
>   int *name = (int *)arg1;
>   u_int   namelen = arg2;
>   int index;
>   device_tdev;
>   struct u_device *udev;
>   int error;
> - char*walker, *ep;
>
>   

Re: svn commit: r364944 - head/sys/kern

2020-08-29 Thread Hans Petter Selasky

On 2020-08-29 06:29, Warner Losh wrote:

+#define DEVCTL_BUFFER (1024 - sizeof(void *))
  struct dev_event_info {
-   char *dei_data;
STAILQ_ENTRY(dev_event_info) dei_link;
+   char dei_data[DEVCTL_BUFFER];
  };


Maybe add:

CTASSERT(sizeof(struct dev_event_info) == 1024);

Not sure if STAILQ's can have some debug fields in them.

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


Re: svn commit: r364941 - in head/sys: net net/route netinet netinet6

2020-08-29 Thread Hartmann, O.
On Fri, 28 Aug 2020 22:50:21 + (UTC)
"Alexander V. Chernikov"  wrote:

> Author: melifaro
> Date: Fri Aug 28 22:50:20 2020
> New Revision: 364941
> URL: https://svnweb.freebsd.org/changeset/base/364941
> 
> Log:
>   Move net/route/shared.h definitions to net/route/route_var.h.
>   
>   No functional changes.
>   
>   net/route/shared.h was created in the inital phases of nexthop
> conversion. It was intended to serve the same purpose as route_var.h
> - share definitions of functions and structures between the routing
> subsystem components. At that time route_var.h was included by many
> files external to the routing subsystem, which largerly defeats its
> purpose. 
>   As currently this is not the case anymore and amount of route_var.h
> includes is roughly the same as shared.h, retire the latter in favour
> of the former.
> 
> Deleted:
>   head/sys/net/route/shared.h
> Modified:
>   head/sys/net/radix_mpath.c
>   head/sys/net/route.c
>   head/sys/net/route/nhop.c
>   head/sys/net/route/nhop_ctl.c
>   head/sys/net/route/route_ctl.c
>   head/sys/net/route/route_helpers.c
>   head/sys/net/route/route_var.h
>   head/sys/net/rtsock.c
>   head/sys/netinet/in_fib.c
>   head/sys/netinet/in_rmx.c
>   head/sys/netinet6/in6_fib.c
>   head/sys/netinet6/in6_rmx.c
> 
> Modified: head/sys/net/radix_mpath.c
> ==
> --- head/sys/net/radix_mpath.cFri Aug 28 21:59:10 2020
> (r364940) +++ head/sys/net/radix_mpath.c  Fri Aug 28 22:50:20
> 2020  (r364941) @@ -56,7 +56,6 @@ __FBSDID("$FreeBSD$");
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
> 
> Modified: head/sys/net/route.c
> ==
> --- head/sys/net/route.c  Fri Aug 28 21:59:10 2020
> (r364940) +++ head/sys/net/route.cFri Aug 28 22:50:20
> 2020  (r364941) @@ -64,7 +64,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  
>  #ifdef RADIX_MPATH
> 
> Modified: head/sys/net/route/nhop.c
> ==
> --- head/sys/net/route/nhop.c Fri Aug 28 21:59:10 2020
> (r364940) +++ head/sys/net/route/nhop.c   Fri Aug 28 22:50:20
> 2020  (r364941) @@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$");
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  
>  /*
> 
> Modified: head/sys/net/route/nhop_ctl.c
> ==
> --- head/sys/net/route/nhop_ctl.c Fri Aug 28 21:59:10
> 2020  (r364940) +++ head/sys/net/route/nhop_ctl.c Fri
> Aug 28 22:50:20 2020  (r364941) @@ -49,7 +49,6 @@
> __FBSDID("$FreeBSD$"); #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  
>  /*
> 
> Modified: head/sys/net/route/route_ctl.c
> ==
> --- head/sys/net/route/route_ctl.cFri Aug 28 21:59:10
> 2020  (r364940) +++ head/sys/net/route/route_ctl.cFri
> Aug 28 22:50:20 2020  (r364941) @@ -52,7 +52,6 @@
> __FBSDID("$FreeBSD$"); #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  
>  #ifdef RADIX_MPATH
> 
> Modified: head/sys/net/route/route_helpers.c
> ==
> --- head/sys/net/route/route_helpers.cFri Aug 28 21:59:10
> 2020  (r364940) +++ head/sys/net/route/route_helpers.c
> Fri Aug 28 22:50:20 2020  (r364941) @@ -55,7 +55,6 @@
> __FBSDID("$FreeBSD$"); #include 
>  #include 
>  #include 
> -#include 
>  #ifdef INET
>  #include 
>  #endif
> 
> Modified: head/sys/net/route/route_var.h
> ==
> --- head/sys/net/route/route_var.hFri Aug 28 21:59:10
> 2020  (r364940) +++ head/sys/net/route/route_var.hFri
> Aug 28 22:50:20 2020  (r364941) @@ -39,7 +39,14 @@
>  #include 
>  #include   /* struct sockaddr_in */
>  #include 
> +#include 
>  
> +#ifdef   RTDEBUG
> +#define  DPRINTF(_fmt, ...)  printf("%s: " _fmt "\n",
> __func__ , ## __VA_ARGS__) +#else
> +#define  DPRINTF(_fmt, ...)
> +#endif
> +
>  struct nh_control;
>  typedef int rnh_preadd_entry_f_t(u_int fibnum, const struct sockaddr
> *addr, const struct sockaddr *mask, struct nhop_object *nh);
> @@ -221,6 +228,7 @@ fib_rte_to_nh_flags(int rt_flags)
>   return (res);
>  }
>  
> +/* route_temporal.c */
>  void tmproutes_update(struct rib_head *rnh, struct rtentry *rt);
>  void tmproutes_init(struct rib_head *rh);
>  void tmproutes_destroy(struct rib_head *rh);
> @@ -236,5 +244,33 @@ int change_route_conditional(struct rib_head
> *rnh, str 
>  void vnet_rtzone_init(void);
>  void vnet_rtzone_destroy(void);
> +
> +/* subscriptions */
> +void rib_init_subscriptions(struct rib_head *rnh);
> +void rib_destroy_subscriptions(struct rib_head *rnh);
> +
> +/* Nexhops */
> +void nhops_init(void);
> +int 

svn commit: r364949 - head/sys/kern

2020-08-29 Thread Warner Losh
Author: imp
Date: Sat Aug 29 09:59:52 2020
New Revision: 364949
URL: https://svnweb.freebsd.org/changeset/base/364949

Log:
  Avoid NULL pointer dereferences
  
  Add back NULL pointer checks accidentally dropped in r364946. We need
  to append a NUL character when that happens.

Modified:
  head/sys/kern/subr_bus.c

Modified: head/sys/kern/subr_bus.c
==
--- head/sys/kern/subr_bus.cSat Aug 29 06:55:10 2020(r364948)
+++ head/sys/kern/subr_bus.cSat Aug 29 09:59:52 2020(r364949)
@@ -5499,11 +5499,20 @@ sysctl_devices(SYSCTL_HANDLER_ARGS)
udev->dv_flags = dev->flags;
udev->dv_state = dev->state;
sbuf_new(&sb, udev->dv_fields, sizeof(udev->dv_fields), SBUF_FIXEDLEN);
-   sbuf_cat(&sb, dev->nameunit);
+   if (dev->nameunit != NULL)
+   sbuf_cat(&sb, dev->nameunit);
+   else
+   sbuf_putc(&sb, '\0');
sbuf_putc(&sb, '\0');
-   sbuf_cat(&sb, dev->desc);
+   if (dev->desc != NULL)
+   sbuf_cat(&sb, dev->desc);
+   else
+   sbuf_putc(&sb, '\0');
sbuf_putc(&sb, '\0');
-   sbuf_cat(&sb, dev->driver != NULL ? dev->driver->name : '\0');
+   if (dev->driver != NULL)
+   sbuf_cat(&sb, dev->driver->name);
+   else
+   sbuf_putc(&sb, '\0');
sbuf_putc(&sb, '\0');
bus_child_pnpinfo_sb(dev, &sb);
sbuf_putc(&sb, '\0');
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r364946 - head/sys/kern

2020-08-29 Thread Warner Losh
On Sat, Aug 29, 2020 at 1:09 AM Mateusz Guzik  wrote:

> This crashes on boot for me:
>

I wasn't able to get it to crash on boot for me, but I was able to recreate
it. Fixed in r364949. I think it didn't crash on boot for me because
kldxref failed due to the segment thing so devmatch didn't run which would
have triggered this bug. devinfo did trigger a very similar crash, and
r364949 fixes that crash. Even a new kldxref failed due to the too many
segments thing, so I can't confirm that's what you hit, but I'm pretty sure
it is...

Warner


> atal trap 12: page fault while in kernel mode
> cpuid = 0; apic id = 00
> fault virtual address   = 0x0
> fault code  = supervisor read data, page not present
> instruction pointer = 0x20:0x805b0a7f
> stack pointer   = 0x28:0xfe002366a7f0
> frame pointer   = 0x28:0xfe002366a7f0
> code segment= base 0x0, limit 0xf, type 0x1b
> = DPL 0, pres 1, long 1, def32 0, gran 1
> processor eflags= interrupt enabled, resume, IOPL = 0
> current process = 89 (devmatch)
> trap number = 12
> panic: page fault
> cpuid = 0
> time = 1598692135
> KDB: stack backtrace:
> db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame
> 0xfe002366a4a0
> vpanic() at vpanic+0x182/frame 0xfe002366a4f0
> panic() at panic+0x43/frame 0xfe002366a550
> trap_fatal() at trap_fatal+0x387/frame 0xfe002366a5b0
> trap_pfault() at trap_pfault+0x4f/frame 0xfe002366a610
> trap() at trap+0x27d/frame 0xfe002366a720
> calltrap() at calltrap+0x8/frame 0xfe002366a720
> --- trap 0xc, rip = 0x805b0a7f, rsp = 0xfe002366a7f0, rbp
> = 0xfe002366a7f0 ---
> strlen() at strlen+0x1f/frame 0xfe002366a7f0
> sbuf_cat() at sbuf_cat+0x15/frame 0xfe002366a810
> sysctl_devices() at sysctl_devices+0x104/frame 0xfe002366a8a0
> sysctl_root_handler_locked() at sysctl_root_handler_locked+0x91/frame
> 0xfe002366a8f0
> sysctl_root() at sysctl_root+0x249/frame 0xfe002366a970
> userland_sysctl() at userland_sysctl+0x170/frame 0xfe002366aa20
> sys___sysctl() at sys___sysctl+0x5f/frame 0xfe002366aad0
> amd64_syscall() at amd64_syscall+0x10c/frame 0xfe002366abf0
> fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfe002366abf0
> --- syscall (202, FreeBSD ELF64, sys___sysctl), rip = 0x80041c0ea, rsp
> = 0x7fffda78, rbp = 0x7fffdab0 ---
> KDB: enter: panic
> [ thread pid 89 tid 100067 ]
> Stopped at  kdb_enter+0x37: movq$0,0x7e2616(%rip)
>
>
> On 8/29/20, Warner Losh  wrote:
> > Author: imp
> > Date: Sat Aug 29 04:30:12 2020
> > New Revision: 364946
> > URL: https://svnweb.freebsd.org/changeset/base/364946
> >
> > Log:
> >   Move to using sbuf for some sysctl in newbus
> >
> >   Convert two different sysctl to using sbuf. First, for all the default
> >   sysctls we implement for each device driver that's attached. This is a
> >   pure sbuf conversion.
> >
> >   Second, convert sysctl_devices to fill its buffer with sbuf rather
> >   than a hand-rolled crappy thing I wrote years ago.
> >
> >   Reviewed by: cem, markj
> >   Differential Revision: https://reviews.freebsd.org/D26206
> >
> > Modified:
> >   head/sys/kern/subr_bus.c
> >
> > Modified: head/sys/kern/subr_bus.c
> >
> ==
> > --- head/sys/kern/subr_bus.c  Sat Aug 29 04:30:06 2020(r364945)
> > +++ head/sys/kern/subr_bus.c  Sat Aug 29 04:30:12 2020(r364946)
> > @@ -260,36 +260,33 @@ enum {
> >  static int
> >  device_sysctl_handler(SYSCTL_HANDLER_ARGS)
> >  {
> > + struct sbuf sb;
> >   device_t dev = (device_t)arg1;
> > - const char *value;
> > - char *buf;
> >   int error;
> >
> > - buf = NULL;
> > + sbuf_new_for_sysctl(&sb, NULL, 1024, req);
> >   switch (arg2) {
> >   case DEVICE_SYSCTL_DESC:
> > - value = dev->desc ? dev->desc : "";
> > + sbuf_cpy(&sb, dev->desc ? dev->desc : "");
> >   break;
> >   case DEVICE_SYSCTL_DRIVER:
> > - value = dev->driver ? dev->driver->name : "";
> > + sbuf_cpy(&sb, dev->driver ? dev->driver->name : "");
> >   break;
> >   case DEVICE_SYSCTL_LOCATION:
> > - value = buf = malloc(1024, M_BUS, M_WAITOK | M_ZERO);
> > - bus_child_location_str(dev, buf, 1024);
> > + bus_child_location_sb(dev, &sb);
> >   break;
> >   case DEVICE_SYSCTL_PNPINFO:
> > - value = buf = malloc(1024, M_BUS, M_WAITOK | M_ZERO);
> > - bus_child_pnpinfo_str(dev, buf, 1024);
> > + bus_child_pnpinfo_sb(dev, &sb);
> >   break;
> >   case DEVICE_SYSCTL_PARENT:
> > - value = dev->parent ? dev->parent->nameunit : "";
> > + sbuf_cpy(&sb, dev->parent ? dev->parent->nameunit : "");
> >   break;
> >   default:
> > + sbuf_dele

Re: svn commit: r364946 - head/sys/kern

2020-08-29 Thread Michal Meloun



On 29.08.2020 12:04, Warner Losh wrote:
> On Sat, Aug 29, 2020 at 1:09 AM Mateusz Guzik  wrote:
> 
>> This crashes on boot for me:
>>
> 
> I wasn't able to get it to crash on boot for me, but I was able to recreate
> it.
It crashed on ofw based systems where some enumerated devices have not a
suitable driver, see:
---
sysctl_devices: nameunit: root0, descs: System root bus, driver: root
sysctl_devices: nameunit: nexus0, descs: (null), driver: nexus
sysctl_devices: nameunit: ofwbus0, descs: Open Firmware Device Tree,
driver: ofwbus
sysctl_devices: nameunit: pcib0, descs: Nvidia Integrated PCI/PCI-E
Controller, driver: pcib
sysctl_devices: nameunit: simplebus0, descs: Flattened device tree
simple bus, driver: simplebus
sysctl_devices: nameunit: gic0, descs: ARM Generic Interrupt Controller,
driver: gic
sysctl_devices: nameunit: (null), descs: (null), driver:
sysctl_devices: nameunit: lic0, descs: (null), driver: lic
sysctl_devices: nameunit: (null), descs: (null), driver:
sysctl_devices: nameunit: car0, descs: Tegra Clock Driver, driver: car

--
> Fixed in r364949.Confirmed.
 I think it didn't crash on boot for me because
> kldxref failed due to the segment thing so devmatch didn't run which would
> have triggered this bug. devinfo did trigger a very similar crash, and
> r364949 fixes that crash. Even a new kldxref failed due to the too many
> segments thing, so I can't confirm that's what you hit, but I'm pretty sure
> it is...
> 
But there is another issue in device_sysctl_handler() (not analyzed yet):
root@tegra210:~ # sysctl dev.cpu.
dev.cpu.3.temperature: 50.5C
dev.cpu.3panic: sbuf_clear makes no sense on sbuf 0x6f21a528
with drain
cpuid = 2
time = 1598696937
KDB: stack backtrace:
db_trace_self() at db_fetch_ksymtab+0x164
 pc = 0x006787f4  lr = 0x00153400
 sp = 0x6f21a1b0  fp = 0x6f21a3b0

db_fetch_ksymtab() at vpanic+0x198
 pc = 0x00153400  lr = 0x0036b274
 sp = 0x6f21a3c0  fp = 0x6f21a420

vpanic() at panic+0x44
 pc = 0x0036b274  lr = 0x0036b018
 sp = 0x6f21a430  fp = 0x6f21a4e0

panic() at sbuf_clear+0xa0
 pc = 0x0036b018  lr = 0x003c17c8
 sp = 0x6f21a4f0  fp = 0x6f21a4f0

sbuf_clear() at sbuf_cpy+0x58
 pc = 0x003c17c8  lr = 0x003c1ff0
 sp = 0x6f21a500  fp = 0x6f21a500

sbuf_cpy() at _gone_in_dev+0x560
 pc = 0x003c1ff0  lr = 0x003a9078
 sp = 0x6f21a510  fp = 0x6f21a570

_gone_in_dev() at sbuf_new_for_sysctl+0x170
 pc = 0x003a9078  lr = 0x0037c1a8
 sp = 0x6f21a580  fp = 0x6f21a5a0

sbuf_new_for_sysctl() at kernel_sysctl+0x36c
 pc = 0x0037c1a8  lr = 0x0037b63c
 sp = 0x6f21a5b0  fp = 0x6f21a630

kernel_sysctl() at userland_sysctl+0xf4
 pc = 0x0037b63c  lr = 0x0037bc5c
 sp = 0x6f21a640  fp = 0x6f21a6d0

userland_sysctl() at sys___sysctl+0x68
 pc = 0x0037bc5c  lr = 0x0037bb28
 sp = 0x6f21a6e0  fp = 0x6f21a790

sys___sysctl() at do_el0_sync+0x4e0
 pc = 0x0037bb28  lr = 0x00697918
 sp = 0x6f21a7a0  fp = 0x6f21a830

do_el0_sync() at handle_el0_sync+0x90
 pc = 0x00697918  lr = 0x0067aa24
 sp = 0x6f21a840  fp = 0x6f21a980

handle_el0_sync() at 0x4047764c
 pc = 0x0067aa24  lr = 0x4047764c
 sp = 0x6f21a990  fp = 0xc250

KDB: enter: panic
[ thread pid 1263 tid 100092 ]
Stopped at  0x40477fb4: undefined   5442

> Warner
>

> 
>> atal trap 12: page fault while in kernel mode
>> cpuid = 0; apic id = 00
>> fault virtual address   = 0x0
>> fault code  = supervisor read data, page not present
>> instruction pointer = 0x20:0x805b0a7f
>> stack pointer   = 0x28:0xfe002366a7f0
>> frame pointer   = 0x28:0xfe002366a7f0
>> code segment= base 0x0, limit 0xf, type 0x1b
>> = DPL 0, pres 1, long 1, def32 0, gran 1
>> processor eflags= interrupt enabled, resume, IOPL = 0
>> current process = 89 (devmatch)
>> trap number = 12
>> panic: page fault
>> cpuid = 0
>> time = 1598692135
>> KDB: stack backtrace:
>> db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame
>> 0xfe002366a4a0
>> vpanic() at vpanic+0x182/frame 0xfe002366a4f0
>> panic() at panic+0x43/frame 0xfe002366a550
>> trap_fatal() at trap_fatal+0x387/frame 0xfe002366a5b0
>> trap_pfault() at trap_pfault+0x4f/frame 0xfe002366a610
>> trap() at trap+0x27d/frame 0xfe002366a720
>> calltrap(

Re: svn commit: r364946 - head/sys/kern

2020-08-29 Thread Warner Losh
On Sat, Aug 29, 2020 at 4:38 AM Michal Meloun 
wrote:

>
>
> On 29.08.2020 12:04, Warner Losh wrote:
> > On Sat, Aug 29, 2020 at 1:09 AM Mateusz Guzik  wrote:
> >
> >> This crashes on boot for me:
> >>
> >
> > I wasn't able to get it to crash on boot for me, but I was able to
> recreate
> > it.
> It crashed on ofw based systems where some enumerated devices have not a
> suitable driver, see:
> ---
> sysctl_devices: nameunit: root0, descs: System root bus, driver: root
> sysctl_devices: nameunit: nexus0, descs: (null), driver: nexus
> sysctl_devices: nameunit: ofwbus0, descs: Open Firmware Device Tree,
> driver: ofwbus
> sysctl_devices: nameunit: pcib0, descs: Nvidia Integrated PCI/PCI-E
> Controller, driver: pcib
> sysctl_devices: nameunit: simplebus0, descs: Flattened device tree
> simple bus, driver: simplebus
> sysctl_devices: nameunit: gic0, descs: ARM Generic Interrupt Controller,
> driver: gic
> sysctl_devices: nameunit: (null), descs: (null), driver:
> sysctl_devices: nameunit: lic0, descs: (null), driver: lic
> sysctl_devices: nameunit: (null), descs: (null), driver:
> sysctl_devices: nameunit: car0, descs: Tegra Clock Driver, driver: car
> 
> --
> > Fixed in r364949.Confirmed.
>  I think it didn't crash on boot for me because
> > kldxref failed due to the segment thing so devmatch didn't run which
> would
> > have triggered this bug. devinfo did trigger a very similar crash, and
> > r364949 fixes that crash. Even a new kldxref failed due to the too many
> > segments thing, so I can't confirm that's what you hit, but I'm pretty
> sure
> > it is...
> >
> But there is another issue in device_sysctl_handler() (not analyzed yet):
> root@tegra210:~ # sysctl dev.cpu.
> dev.cpu.3.temperature: 50.5C
> dev.cpu.3panic: sbuf_clear makes no sense on sbuf 0x6f21a528
> with drain
> cpuid = 2
> time = 1598696937
> KDB: stack backtrace:
> db_trace_self() at db_fetch_ksymtab+0x164
>  pc = 0x006787f4  lr = 0x00153400
>  sp = 0x6f21a1b0  fp = 0x6f21a3b0
>
> db_fetch_ksymtab() at vpanic+0x198
>  pc = 0x00153400  lr = 0x0036b274
>  sp = 0x6f21a3c0  fp = 0x6f21a420
>
> vpanic() at panic+0x44
>  pc = 0x0036b274  lr = 0x0036b018
>  sp = 0x6f21a430  fp = 0x6f21a4e0
>
> panic() at sbuf_clear+0xa0
>  pc = 0x0036b018  lr = 0x003c17c8
>  sp = 0x6f21a4f0  fp = 0x6f21a4f0
>
> sbuf_clear() at sbuf_cpy+0x58
>  pc = 0x003c17c8  lr = 0x003c1ff0
>  sp = 0x6f21a500  fp = 0x6f21a500
>
> sbuf_cpy() at _gone_in_dev+0x560
>  pc = 0x003c1ff0  lr = 0x003a9078
>  sp = 0x6f21a510  fp = 0x6f21a570
>
> _gone_in_dev() at sbuf_new_for_sysctl+0x170
>  pc = 0x003a9078  lr = 0x0037c1a8
>  sp = 0x6f21a580  fp = 0x6f21a5a0
>
> sbuf_new_for_sysctl() at kernel_sysctl+0x36c
>  pc = 0x0037c1a8  lr = 0x0037b63c
>  sp = 0x6f21a5b0  fp = 0x6f21a630
>

This traceback is all kinds of crazy. sbuf_new_for_sysctl doesn't call
_gone_in_dev(), which doesn't do sbuf stuff at all. And neither does it
call sbuf_cpy(). Though I get a crash that looks like:
Tracing pid 66442 tid 101464 td 0xfe02f47b7c00
kdb_enter() at kdb_enter+0x37/frame 0xfe02f4ae3740
vpanic() at vpanic+0x19e/frame 0xfe02f4ae3790
panic() at panic+0x43/frame 0xfe02f4ae37f0
sbuf_clear() at sbuf_clear+0xac/frame 0xfe02f4ae3800
sbuf_cpy() at sbuf_cpy+0x5a/frame 0xfe02f4ae3820
device_sysctl_handler() at device_sysctl_handler+0x133/frame
0xfe02f4ae38a0
sysctl_root_handler_locked() at sysctl_root_handler_locked+0x9c/frame
0xfe02f4ae38f0
sysctl_root() at sysctl_root+0x20a/frame 0xfe02f4ae3970
userland_sysctl() at userland_sysctl+0x17d/frame 0xfe02f4ae3a20
sys___sysctl() at sys___sysctl+0x5f/frame 0xfe02f4ae3ad0
amd64_syscall() at amd64_syscall+0x140/frame 0xfe02f4ae3bf0
fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfe02f4ae3bf0
--- syscall (202, FreeBSD ELF64, sys___sysctl), rip = 0x80042d50a, rsp =
0x7fffd458, rbp = 0x7fffd490 ---

on a sysctl -a which I think makes more sense...  I'll see if I can track
it down... I think it's because sbuf_cpy does an unconditional clear, which
triggers this assert, which is likely bogus for this case. sbuf_cat doesn't
seem to have this issue... I'll confirm and commit.

Warner


> kernel_sysctl() at userland_sysctl+0xf4
>  pc = 0x0037b63c  lr = 0x0037bc5c
>  sp = 0x6f21a640  fp = 0x6f21a6d0
>
> userland_sysctl() at sys___sysctl+0x68
>  pc = 0x0037bc5c  lr = 0x0037bb28
>  sp = 0x6f21a6e0  fp = 0x6f21a790
>
> sys___sysc

svn commit: r364950 - head/sys/net/route

2020-08-29 Thread Alexander V. Chernikov
Author: melifaro
Date: Sat Aug 29 11:04:24 2020
New Revision: 364950
URL: https://svnweb.freebsd.org/changeset/base/364950

Log:
  Fix build with RADIX_MPATH.
  
  Reported by:  Hartmann, O 

Modified:
  head/sys/net/route/route_ctl.c

Modified: head/sys/net/route/route_ctl.c
==
--- head/sys/net/route/route_ctl.c  Sat Aug 29 09:59:52 2020
(r364949)
+++ head/sys/net/route/route_ctl.c  Sat Aug 29 11:04:24 2020
(r364950)
@@ -101,7 +101,7 @@ vnet_rtzone_init()
 {

V_rtzone = uma_zcreate("rtentry", sizeof(struct rtentry),
-   NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
+   NULL, NULL, NULL, NULL, UMA_ALIGN_CACHE, 0);
 }
 
 #ifdef VIMAGE
@@ -310,6 +310,7 @@ add_route(struct rib_head *rnh, struct rt_addrinfo *in
 
RIB_WLOCK(rnh);
 #ifdef RADIX_MPATH
+   netmask = info->rti_info[RTAX_NETMASK];
/* do not permit exactly the same dst/mask/gw pair */
if (rt_mpath_capable(rnh) &&
rt_mpath_conflict(rnh, rt, netmask)) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r364951 - head/sys/kern

2020-08-29 Thread Warner Losh
Author: imp
Date: Sat Aug 29 11:18:10 2020
New Revision: 364951
URL: https://svnweb.freebsd.org/changeset/base/364951

Log:
  Use sbuf_cat instead of sbuf_cpy
  
  sbuf_cpy doesn't work with sysctl sbufs because of the drain function.

Modified:
  head/sys/kern/subr_bus.c

Modified: head/sys/kern/subr_bus.c
==
--- head/sys/kern/subr_bus.cSat Aug 29 11:04:24 2020(r364950)
+++ head/sys/kern/subr_bus.cSat Aug 29 11:18:10 2020(r364951)
@@ -267,10 +267,10 @@ device_sysctl_handler(SYSCTL_HANDLER_ARGS)
sbuf_new_for_sysctl(&sb, NULL, 1024, req);
switch (arg2) {
case DEVICE_SYSCTL_DESC:
-   sbuf_cpy(&sb, dev->desc ? dev->desc : "");
+   sbuf_cat(&sb, dev->desc ? dev->desc : "");
break;
case DEVICE_SYSCTL_DRIVER:
-   sbuf_cpy(&sb, dev->driver ? dev->driver->name : "");
+   sbuf_cat(&sb, dev->driver ? dev->driver->name : "");
break;
case DEVICE_SYSCTL_LOCATION:
bus_child_location_sb(dev, &sb);
@@ -279,7 +279,7 @@ device_sysctl_handler(SYSCTL_HANDLER_ARGS)
bus_child_pnpinfo_sb(dev, &sb);
break;
case DEVICE_SYSCTL_PARENT:
-   sbuf_cpy(&sb, dev->parent ? dev->parent->nameunit : "");
+   sbuf_cat(&sb, dev->parent ? dev->parent->nameunit : "");
break;
default:
sbuf_delete(&sb);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r364946 - head/sys/kern

2020-08-29 Thread Michal Meloun



On 29.08.2020 13:02, Warner Losh wrote:
> On Sat, Aug 29, 2020 at 4:38 AM Michal Meloun 
> wrote:
> 
>>
>>
>> On 29.08.2020 12:04, Warner Losh wrote:
>>> On Sat, Aug 29, 2020 at 1:09 AM Mateusz Guzik  wrote:
>>>
 This crashes on boot for me:

>>>
>>> I wasn't able to get it to crash on boot for me, but I was able to
>> recreate
>>> it.
>> It crashed on ofw based systems where some enumerated devices have not a
>> suitable driver, see:
>> ---
>> sysctl_devices: nameunit: root0, descs: System root bus, driver: root
>> sysctl_devices: nameunit: nexus0, descs: (null), driver: nexus
>> sysctl_devices: nameunit: ofwbus0, descs: Open Firmware Device Tree,
>> driver: ofwbus
>> sysctl_devices: nameunit: pcib0, descs: Nvidia Integrated PCI/PCI-E
>> Controller, driver: pcib
>> sysctl_devices: nameunit: simplebus0, descs: Flattened device tree
>> simple bus, driver: simplebus
>> sysctl_devices: nameunit: gic0, descs: ARM Generic Interrupt Controller,
>> driver: gic
>> sysctl_devices: nameunit: (null), descs: (null), driver:
>> sysctl_devices: nameunit: lic0, descs: (null), driver: lic
>> sysctl_devices: nameunit: (null), descs: (null), driver:
>> sysctl_devices: nameunit: car0, descs: Tegra Clock Driver, driver: car
>> 
>> --
>>> Fixed in r364949.Confirmed.
>>  I think it didn't crash on boot for me because
>>> kldxref failed due to the segment thing so devmatch didn't run which
>> would
>>> have triggered this bug. devinfo did trigger a very similar crash, and
>>> r364949 fixes that crash. Even a new kldxref failed due to the too many
>>> segments thing, so I can't confirm that's what you hit, but I'm pretty
>> sure
>>> it is...
>>>
>> But there is another issue in device_sysctl_handler() (not analyzed yet):
>> root@tegra210:~ # sysctl dev.cpu.
>> dev.cpu.3.temperature: 50.5C
>> dev.cpu.3panic: sbuf_clear makes no sense on sbuf 0x6f21a528
>> with drain
>> cpuid = 2
>> time = 1598696937
>> KDB: stack backtrace:
>> db_trace_self() at db_fetch_ksymtab+0x164
>>  pc = 0x006787f4  lr = 0x00153400
>>  sp = 0x6f21a1b0  fp = 0x6f21a3b0
>>
>> db_fetch_ksymtab() at vpanic+0x198
>>  pc = 0x00153400  lr = 0x0036b274
>>  sp = 0x6f21a3c0  fp = 0x6f21a420
>>
>> vpanic() at panic+0x44
>>  pc = 0x0036b274  lr = 0x0036b018
>>  sp = 0x6f21a430  fp = 0x6f21a4e0
>>
>> panic() at sbuf_clear+0xa0
>>  pc = 0x0036b018  lr = 0x003c17c8
>>  sp = 0x6f21a4f0  fp = 0x6f21a4f0
>>
>> sbuf_clear() at sbuf_cpy+0x58
>>  pc = 0x003c17c8  lr = 0x003c1ff0
>>  sp = 0x6f21a500  fp = 0x6f21a500
>>
>> sbuf_cpy() at _gone_in_dev+0x560
>>  pc = 0x003c1ff0  lr = 0x003a9078
>>  sp = 0x6f21a510  fp = 0x6f21a570
>>
>> _gone_in_dev() at sbuf_new_for_sysctl+0x170
>>  pc = 0x003a9078  lr = 0x0037c1a8
>>  sp = 0x6f21a580  fp = 0x6f21a5a0
>>
>> sbuf_new_for_sysctl() at kernel_sysctl+0x36c
>>  pc = 0x0037c1a8  lr = 0x0037b63c
>>  sp = 0x6f21a5b0  fp = 0x6f21a630
>>
> 
> This traceback is all kinds of crazy. sbuf_new_for_sysctl doesn't call
> _gone_in_dev(), which doesn't do sbuf stuff at all. And neither does it
> call sbuf_cpy(). Though I get a crash that looks like:
> Tracing pid 66442 tid 101464 td 0xfe02f47b7c00
> kdb_enter() at kdb_enter+0x37/frame 0xfe02f4ae3740
> vpanic() at vpanic+0x19e/frame 0xfe02f4ae3790
> panic() at panic+0x43/frame 0xfe02f4ae37f0
> sbuf_clear() at sbuf_clear+0xac/frame 0xfe02f4ae3800
> sbuf_cpy() at sbuf_cpy+0x5a/frame 0xfe02f4ae3820
> device_sysctl_handler() at device_sysctl_handler+0x133/frame
> 0xfe02f4ae38a0
> sysctl_root_handler_locked() at sysctl_root_handler_locked+0x9c/frame
> 0xfe02f4ae38f0
> sysctl_root() at sysctl_root+0x20a/frame 0xfe02f4ae3970
> userland_sysctl() at userland_sysctl+0x17d/frame 0xfe02f4ae3a20
> sys___sysctl() at sys___sysctl+0x5f/frame 0xfe02f4ae3ad0
> amd64_syscall() at amd64_syscall+0x140/frame 0xfe02f4ae3bf0
> fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfe02f4ae3bf0
> --- syscall (202, FreeBSD ELF64, sys___sysctl), rip = 0x80042d50a, rsp =
> 0x7fffd458, rbp = 0x7fffd490 ---
> 
> on a sysctl -a which I think makes more sense...  I'll see if I can track
> it down... I think it's because sbuf_cpy does an unconditional clear, which
> triggers this assert, which is likely bogus for this case. sbuf_cat doesn't
> seem to have this issue... I'll confirm and commit.
> 
> Warner

Yeah, sorry. Local symbols are not available for netbooted kernel :(.
And i csan confirm that problem is cause by using sbuf_cpy() on sbuf
allocated by sbuf_new_for_sysc

Re: svn commit: r364946 - head/sys/kern

2020-08-29 Thread Warner Losh
On Sat, Aug 29, 2020 at 5:25 AM Michal Meloun 
wrote:

>
>
> On 29.08.2020 13:02, Warner Losh wrote:
> > On Sat, Aug 29, 2020 at 4:38 AM Michal Meloun 
> > wrote:
> >
> >>
> >>
> >> On 29.08.2020 12:04, Warner Losh wrote:
> >>> On Sat, Aug 29, 2020 at 1:09 AM Mateusz Guzik 
> wrote:
> >>>
>  This crashes on boot for me:
> 
> >>>
> >>> I wasn't able to get it to crash on boot for me, but I was able to
> >> recreate
> >>> it.
> >> It crashed on ofw based systems where some enumerated devices have not a
> >> suitable driver, see:
> >> ---
> >> sysctl_devices: nameunit: root0, descs: System root bus, driver: root
> >> sysctl_devices: nameunit: nexus0, descs: (null), driver: nexus
> >> sysctl_devices: nameunit: ofwbus0, descs: Open Firmware Device Tree,
> >> driver: ofwbus
> >> sysctl_devices: nameunit: pcib0, descs: Nvidia Integrated PCI/PCI-E
> >> Controller, driver: pcib
> >> sysctl_devices: nameunit: simplebus0, descs: Flattened device tree
> >> simple bus, driver: simplebus
> >> sysctl_devices: nameunit: gic0, descs: ARM Generic Interrupt Controller,
> >> driver: gic
> >> sysctl_devices: nameunit: (null), descs: (null), driver:
> >> sysctl_devices: nameunit: lic0, descs: (null), driver: lic
> >> sysctl_devices: nameunit: (null), descs: (null), driver:
> >> sysctl_devices: nameunit: car0, descs: Tegra Clock Driver, driver: car
> >> 
> >> --
> >>> Fixed in r364949.Confirmed.
> >>  I think it didn't crash on boot for me because
> >>> kldxref failed due to the segment thing so devmatch didn't run which
> >> would
> >>> have triggered this bug. devinfo did trigger a very similar crash, and
> >>> r364949 fixes that crash. Even a new kldxref failed due to the too many
> >>> segments thing, so I can't confirm that's what you hit, but I'm pretty
> >> sure
> >>> it is...
> >>>
> >> But there is another issue in device_sysctl_handler() (not analyzed
> yet):
> >> root@tegra210:~ # sysctl dev.cpu.
> >> dev.cpu.3.temperature: 50.5C
> >> dev.cpu.3panic: sbuf_clear makes no sense on sbuf 0x6f21a528
> >> with drain
> >> cpuid = 2
> >> time = 1598696937
> >> KDB: stack backtrace:
> >> db_trace_self() at db_fetch_ksymtab+0x164
> >>  pc = 0x006787f4  lr = 0x00153400
> >>  sp = 0x6f21a1b0  fp = 0x6f21a3b0
> >>
> >> db_fetch_ksymtab() at vpanic+0x198
> >>  pc = 0x00153400  lr = 0x0036b274
> >>  sp = 0x6f21a3c0  fp = 0x6f21a420
> >>
> >> vpanic() at panic+0x44
> >>  pc = 0x0036b274  lr = 0x0036b018
> >>  sp = 0x6f21a430  fp = 0x6f21a4e0
> >>
> >> panic() at sbuf_clear+0xa0
> >>  pc = 0x0036b018  lr = 0x003c17c8
> >>  sp = 0x6f21a4f0  fp = 0x6f21a4f0
> >>
> >> sbuf_clear() at sbuf_cpy+0x58
> >>  pc = 0x003c17c8  lr = 0x003c1ff0
> >>  sp = 0x6f21a500  fp = 0x6f21a500
> >>
> >> sbuf_cpy() at _gone_in_dev+0x560
> >>  pc = 0x003c1ff0  lr = 0x003a9078
> >>  sp = 0x6f21a510  fp = 0x6f21a570
> >>
> >> _gone_in_dev() at sbuf_new_for_sysctl+0x170
> >>  pc = 0x003a9078  lr = 0x0037c1a8
> >>  sp = 0x6f21a580  fp = 0x6f21a5a0
> >>
> >> sbuf_new_for_sysctl() at kernel_sysctl+0x36c
> >>  pc = 0x0037c1a8  lr = 0x0037b63c
> >>  sp = 0x6f21a5b0  fp = 0x6f21a630
> >>
> >
> > This traceback is all kinds of crazy. sbuf_new_for_sysctl doesn't call
> > _gone_in_dev(), which doesn't do sbuf stuff at all. And neither does it
> > call sbuf_cpy(). Though I get a crash that looks like:
> > Tracing pid 66442 tid 101464 td 0xfe02f47b7c00
> > kdb_enter() at kdb_enter+0x37/frame 0xfe02f4ae3740
> > vpanic() at vpanic+0x19e/frame 0xfe02f4ae3790
> > panic() at panic+0x43/frame 0xfe02f4ae37f0
> > sbuf_clear() at sbuf_clear+0xac/frame 0xfe02f4ae3800
> > sbuf_cpy() at sbuf_cpy+0x5a/frame 0xfe02f4ae3820
> > device_sysctl_handler() at device_sysctl_handler+0x133/frame
> > 0xfe02f4ae38a0
> > sysctl_root_handler_locked() at sysctl_root_handler_locked+0x9c/frame
> > 0xfe02f4ae38f0
> > sysctl_root() at sysctl_root+0x20a/frame 0xfe02f4ae3970
> > userland_sysctl() at userland_sysctl+0x17d/frame 0xfe02f4ae3a20
> > sys___sysctl() at sys___sysctl+0x5f/frame 0xfe02f4ae3ad0
> > amd64_syscall() at amd64_syscall+0x140/frame 0xfe02f4ae3bf0
> > fast_syscall_common() at fast_syscall_common+0xf8/frame
> 0xfe02f4ae3bf0
> > --- syscall (202, FreeBSD ELF64, sys___sysctl), rip = 0x80042d50a, rsp =
> > 0x7fffd458, rbp = 0x7fffd490 ---
> >
> > on a sysctl -a which I think makes more sense...  I'll see if I can track
> > it down... I think it's because sbuf_cpy does an unconditional clear,
> which
> > triggers this assert, which is li

svn commit: r364952 - head/sys/arm/allwinner/clkng

2020-08-29 Thread Emmanuel Vadot
Author: manu
Date: Sat Aug 29 11:39:53 2020
New Revision: 364952
URL: https://svnweb.freebsd.org/changeset/base/364952

Log:
  Fix arm64 build after r364927
  
  Reported by:  jenkins, dch
  Pointy hat to:manu

Modified:
  head/sys/arm/allwinner/clkng/aw_clk_nm.c

Modified: head/sys/arm/allwinner/clkng/aw_clk_nm.c
==
--- head/sys/arm/allwinner/clkng/aw_clk_nm.cSat Aug 29 11:18:10 2020
(r364951)
+++ head/sys/arm/allwinner/clkng/aw_clk_nm.cSat Aug 29 11:39:53 2020
(r364952)
@@ -221,14 +221,14 @@ aw_clk_nm_set_freq(struct clknode *clk, uint64_t fpare
if ((best < *fout) &&
  ((flags & CLK_SET_ROUND_DOWN) == 0)) {
*stop = 1;
-   printf("best freq (%llu) < requested freq(%llu)\n",
+   printf("best freq (%ju) < requested freq(%ju)\n",
best, *fout);
return (ERANGE);
}
if ((best > *fout) &&
  ((flags & CLK_SET_ROUND_UP) == 0)) {
*stop = 1;
-   printf("best freq (%llu) > requested freq(%llu)\n",
+   printf("best freq (%ju) > requested freq(%ju)\n",
best, *fout);
return (ERANGE);
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r364953 - head/sys/kern

2020-08-29 Thread Warner Losh
Author: imp
Date: Sat Aug 29 11:46:50 2020
New Revision: 364953
URL: https://svnweb.freebsd.org/changeset/base/364953

Log:
  We don't need to INCLUDENUL, so turn it off to avoid assertion...
  
  sbuf_new_for_sysctl turns on INCLUDENUL, but we don't need it. And we assert 
for
  it in the new bus_pnpinfo_sb and bus_location_sb strings.

Modified:
  head/sys/kern/subr_bus.c

Modified: head/sys/kern/subr_bus.c
==
--- head/sys/kern/subr_bus.cSat Aug 29 11:39:53 2020(r364952)
+++ head/sys/kern/subr_bus.cSat Aug 29 11:46:50 2020(r364953)
@@ -265,6 +265,7 @@ device_sysctl_handler(SYSCTL_HANDLER_ARGS)
int error;
 
sbuf_new_for_sysctl(&sb, NULL, 1024, req);
+   sbuf_clear_flags(&sb, SBUF_INCLUDENUL);
switch (arg2) {
case DEVICE_SYSCTL_DESC:
sbuf_cat(&sb, dev->desc ? dev->desc : "");
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r364954 - head/sys/net/route

2020-08-29 Thread Alexander V. Chernikov
Author: melifaro
Date: Sat Aug 29 12:04:13 2020
New Revision: 364954
URL: https://svnweb.freebsd.org/changeset/base/364954

Log:
  Revert uma zone alignemnt cache unadvertenly committed in r364950.

Modified:
  head/sys/net/route/route_ctl.c

Modified: head/sys/net/route/route_ctl.c
==
--- head/sys/net/route/route_ctl.c  Sat Aug 29 11:46:50 2020
(r364953)
+++ head/sys/net/route/route_ctl.c  Sat Aug 29 12:04:13 2020
(r364954)
@@ -101,7 +101,7 @@ vnet_rtzone_init()
 {

V_rtzone = uma_zcreate("rtentry", sizeof(struct rtentry),
-   NULL, NULL, NULL, NULL, UMA_ALIGN_CACHE, 0);
+   NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
 }
 
 #ifdef VIMAGE
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r364955 - stable/12/libexec/rc/rc.d

2020-08-29 Thread Edward Tomasz Napierala
Author: trasz
Date: Sat Aug 29 12:54:17 2020
New Revision: 364955
URL: https://svnweb.freebsd.org/changeset/base/364955

Log:
  Drop the "nocover" option from the linux rc script; the option
  is not yet supported in 12-STABLE.
  
  This is a direct commit intended as a temporary workaround.
  
  Reported by:  scf@
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/12/libexec/rc/rc.d/linux

Modified: stable/12/libexec/rc/rc.d/linux
==
--- stable/12/libexec/rc/rc.d/linux Sat Aug 29 12:04:13 2020
(r364954)
+++ stable/12/libexec/rc/rc.d/linux Sat Aug 29 12:54:17 2020
(r364955)
@@ -48,11 +48,11 @@ linux_start()
 
if checkyesno linux_mounts_enable; then 
_emul_path="/compat/linux"
-   mount -o nocover -t linprocfs linprocfs "${_emul_path}/proc"
-   mount -o nocover -t linsysfs linsysfs "${_emul_path}/sys"
-   mount -o nocover -t devfs devfs "${_emul_path}/dev"
-   mount -o nocover,linrdlnk -t fdescfs fdescfs 
"${_emul_path}/dev/fd"
-   mount -o nocover,mode=1777 -t tmpfs tmpfs 
"${_emul_path}/dev/shm"
+   mount -t linprocfs linprocfs "${_emul_path}/proc"
+   mount -t linsysfs linsysfs "${_emul_path}/sys"
+   mount -t devfs devfs "${_emul_path}/dev"
+   mount -o linrdlnk -t fdescfs fdescfs "${_emul_path}/dev/fd"
+   mount -o mode=1777 -t tmpfs tmpfs "${_emul_path}/dev/shm"
fi
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r364946 - head/sys/kern

2020-08-29 Thread Brandon Bergren
On Sat, Aug 29, 2020, at 6:34 AM, Warner Losh wrote:
> 
> 
> On Sat, Aug 29, 2020 at 5:25 AM Michal Meloun  wrote:
> > Yeah, sorry. Local symbols are not available for netbooted kernel :(.
> > And i csan confirm that problem is cause by using sbuf_cpy() on sbuf
> > allocated by sbuf_new_for_sysctl() (thus with drain handler) in
> > device_sysctl_handler(). But pure replacing sbuf_cpy() by sbuf_cat()
> > gives me another panic:
> > panic: Assertion (sb->s_flags & SBUF_INCLUDENUL) == 0 failed at
> > /usr2/Meloun/git/pmap/sys/kern/subr_bus.c:4936
> > (still as respose for sysctl dev.cpu)
> 

By the way, on powerpc*, we have a little hack in place to be able to load 
symbols even when loader isn't in use -- in petitboot, if you provide a second 
copy of the kernel as the initrd, it will be used at runtime to load symbols. 
(the powerpc code has special probing to skip attaching the initrd as a md 
device if it looks like an ELF file)

And on powerpc32, you can actually netboot loader instead of netbooting the 
kernel (with a little dhcpd magic) and get symbols loaded the "normal" way.

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


svn commit: r364956 - head/release

2020-08-29 Thread Glen Barber
Author: gjb
Date: Sat Aug 29 15:13:07 2020
New Revision: 364956
URL: https://svnweb.freebsd.org/changeset/base/364956

Log:
  Install devel/git from packages if NOPORTS is set in the release.sh
  configuration file.
  
  Reported by:  Michael Butler
  Sponsored by: Rubicon Communications, LLC (netgate.com)

Modified:
  head/release/release.sh

Modified: head/release/release.sh
==
--- head/release/release.sh Sat Aug 29 12:54:17 2020(r364955)
+++ head/release/release.sh Sat Aug 29 15:13:07 2020(r364956)
@@ -282,6 +282,11 @@ extra_chroot_setup() {
WRKDIRPREFIX=/tmp/ports \
DISTDIR=/tmp/distfiles \
install clean distclean
+   else
+   eval chroot ${CHROOTDIR} env ASSUME_ALWAYS_YES=yes \
+   pkg install -y devel/git
+   eval chroot ${CHROOTDIR} env ASSUME_ALWAYS_YES=yes \
+   pkg clean -y
fi
if [ -d ${CHROOTDIR}/usr/ports ]; then
# Trick the ports 'run-autotools-fixup' target to do the right
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r364957 - head/release

2020-08-29 Thread Glen Barber
Author: gjb
Date: Sat Aug 29 15:30:21 2020
New Revision: 364957
URL: https://svnweb.freebsd.org/changeset/base/364957

Log:
  Avoid the build from falling over if devel/git is not installed
  on the system.  Set a null branch/hash in this case, to avoid
  undefined GITREV/GITBRANCH variables from falling over in other
  areas.
  
  Reported by:  many
  Sponsored by: Rubicon Communications, LLC (netgate.com)

Modified:
  head/release/Makefile.inc1

Modified: head/release/Makefile.inc1
==
--- head/release/Makefile.inc1  Sat Aug 29 15:13:07 2020(r364956)
+++ head/release/Makefile.inc1  Sat Aug 29 15:30:21 2020(r364957)
@@ -10,10 +10,8 @@ GIT_CMD=   ${_P}/git
 .  endif
 . endif
 .endfor
-.if !defined(GIT_CMD) && empty(GIT_CMD)
-. error "Git binary not found.  Set GIT_CMD appropriately."
-.endif
 
+.if !empty(GIT_CMD) && exists(${GIT_CMD})
 # Set the git branch and hash to export where needed.
 .if !defined(GITBRANCH) || empty(GITBRANCH)
 GITBRANCH!=${GIT_CMD} -C ${.CURDIR} rev-parse --abbrev-ref HEAD 
2>/dev/null | sed -e 's/\^\///'
@@ -21,6 +19,12 @@ GITBRANCH!=  ${GIT_CMD} -C ${.CURDIR} rev-parse --abbre
 .endif
 .if !defined(GITREV) || empty(GITREV)
 GITREV!=   ${GIT_CMD} -C ${.CURDIR} rev-parse --verify --short HEAD 
2>/dev/null || true
+.export GITREV
+.endif
+.else
+GITBRANCH= nullbranch
+GITREV=nullhash
+.export GITBRANCH
 .export GITREV
 .endif
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r364958 - head/release

2020-08-29 Thread Glen Barber
Author: gjb
Date: Sat Aug 29 15:31:23 2020
New Revision: 364958
URL: https://svnweb.freebsd.org/changeset/base/364958

Log:
  Indentation fixes.  No functional changes.
  
  Sponsored by: Rubicon Communications, LLC (netgate.com)

Modified:
  head/release/Makefile.inc1

Modified: head/release/Makefile.inc1
==
--- head/release/Makefile.inc1  Sat Aug 29 15:30:21 2020(r364957)
+++ head/release/Makefile.inc1  Sat Aug 29 15:31:23 2020(r364958)
@@ -13,19 +13,19 @@ GIT_CMD=   ${_P}/git
 
 .if !empty(GIT_CMD) && exists(${GIT_CMD})
 # Set the git branch and hash to export where needed.
-.if !defined(GITBRANCH) || empty(GITBRANCH)
+. if !defined(GITBRANCH) || empty(GITBRANCH)
 GITBRANCH!=${GIT_CMD} -C ${.CURDIR} rev-parse --abbrev-ref HEAD 
2>/dev/null | sed -e 's/\^\///'
-.export GITBRANCH
-.endif
-.if !defined(GITREV) || empty(GITREV)
+. export GITBRANCH
+. endif
+. if !defined(GITREV) || empty(GITREV)
 GITREV!=   ${GIT_CMD} -C ${.CURDIR} rev-parse --verify --short HEAD 
2>/dev/null || true
-.export GITREV
-.endif
+. export GITREV
+. endif
 .else
 GITBRANCH= nullbranch
 GITREV=nullhash
-.export GITBRANCH
-.export GITREV
+. export GITBRANCH
+. export GITREV
 .endif
 
 # Set the build date, primarily for snapshot builds.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r364959 - head/release

2020-08-29 Thread Glen Barber
Author: gjb
Date: Sat Aug 29 15:50:27 2020
New Revision: 364959
URL: https://svnweb.freebsd.org/changeset/base/364959

Log:
  Add a VCSUPDATE command to run 'git pull' instead of 'git clone'
  if the tree already exists.
  
  Reported by:  Michael Butler
  Sponsored by: Rubicon Communications, LLC (netgate.com)

Modified:
  head/release/release.sh

Modified: head/release/release.sh
==
--- head/release/release.sh Sat Aug 29 15:31:23 2020(r364958)
+++ head/release/release.sh Sat Aug 29 15:50:27 2020(r364959)
@@ -70,6 +70,7 @@ env_setup() {
exit 1
fi
VCSCMD="/usr/local/bin/git clone -q"
+   VCSUPDATE="/usr/local/bin/git pull -q"
 
# The default git checkout server, and branches for src/, doc/,
# and ports/.
@@ -220,13 +221,25 @@ chroot_setup() {
mkdir -p ${CHROOTDIR}/usr
 
if [ -z "${SRC_UPDATE_SKIP}" ]; then
-   ${VCSCMD} ${SRC} -b ${SRCBRANCH} ${CHROOTDIR}/usr/src
+   if [ -d "${CHROOTDIR}/usr/src" ]; then
+   cd ${CHROOTDIR}/usr/src && ${VCSUPDATE} && cd -
+   else
+   ${VCSCMD} ${SRC} -b ${SRCBRANCH} ${CHROOTDIR}/usr/src
+   fi
fi
if [ -z "${NODOC}" ] && [ -z "${DOC_UPDATE_SKIP}" ]; then
-   ${VCSCMD} ${DOC} -b ${DOCBRANCH} ${CHROOTDIR}/usr/doc
+   if [ -d "${CHROOTDIR}/usr/doc" ]; then
+   cd ${CHROOTDIR}/usr/doc && ${VCSUPDATE} && cd -
+   else
+   ${VCSCMD} ${DOC} -b ${DOCBRANCH} ${CHROOTDIR}/usr/doc
+   fi
fi
if [ -z "${NOPORTS}" ] && [ -z "${PORTS_UPDATE_SKIP}" ]; then
-   ${VCSCMD} ${PORT} -b ${PORTBRANCH} ${CHROOTDIR}/usr/ports
+   if [ -d "${CHROOTDIR}/usr/ports" ]; then
+   cd ${CHROOTDIR}/usr/ports && ${VCSUPDATE} && cd -
+   else
+   ${VCSCMD} ${PORT} -b ${PORTBRANCH} 
${CHROOTDIR}/usr/ports
+   fi
fi
 
if [ -z "${CHROOTBUILD_SKIP}" ]; then
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r364960 - head/release

2020-08-29 Thread Glen Barber
Author: gjb
Date: Sat Aug 29 16:04:02 2020
New Revision: 364960
URL: https://svnweb.freebsd.org/changeset/base/364960

Log:
  Refine the VCSUPDATE logic further:
  - Look for the .git directory instead of top-level directory.
  - Use 'git -C' instead of cd(1).
  
  Sponsored by: Rubicon Communications, LLC (netgate.com)

Modified:
  head/release/release.sh

Modified: head/release/release.sh
==
--- head/release/release.sh Sat Aug 29 15:50:27 2020(r364959)
+++ head/release/release.sh Sat Aug 29 16:04:02 2020(r364960)
@@ -221,22 +221,22 @@ chroot_setup() {
mkdir -p ${CHROOTDIR}/usr
 
if [ -z "${SRC_UPDATE_SKIP}" ]; then
-   if [ -d "${CHROOTDIR}/usr/src" ]; then
-   cd ${CHROOTDIR}/usr/src && ${VCSUPDATE} && cd -
+   if [ -d "${CHROOTDIR}/usr/src/.git" ]; then
+   ${VCSUPDATE} -C ${CHROOTDIR}/usr/src
else
${VCSCMD} ${SRC} -b ${SRCBRANCH} ${CHROOTDIR}/usr/src
fi
fi
if [ -z "${NODOC}" ] && [ -z "${DOC_UPDATE_SKIP}" ]; then
-   if [ -d "${CHROOTDIR}/usr/doc" ]; then
-   cd ${CHROOTDIR}/usr/doc && ${VCSUPDATE} && cd -
+   if [ -d "${CHROOTDIR}/usr/doc/.git" ]; then
+   ${VCSUPDATE} -C ${CHROOTDIR}/usr/doc
else
${VCSCMD} ${DOC} -b ${DOCBRANCH} ${CHROOTDIR}/usr/doc
fi
fi
if [ -z "${NOPORTS}" ] && [ -z "${PORTS_UPDATE_SKIP}" ]; then
-   if [ -d "${CHROOTDIR}/usr/ports" ]; then
-   cd ${CHROOTDIR}/usr/ports && ${VCSUPDATE} && cd -
+   if [ -d "${CHROOTDIR}/usr/ports/.git" ]; then
+   ${VCSUPDATE} -C ${CHROOTDIR}/usr/ports
else
${VCSCMD} ${PORT} -b ${PORTBRANCH} 
${CHROOTDIR}/usr/ports
fi
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r364955 - stable/12/libexec/rc/rc.d

2020-08-29 Thread Sean C. Farley

On Sat, 29 Aug 2020, Edward Tomasz Napierala wrote:


Author: trasz
Date: Sat Aug 29 12:54:17 2020
New Revision: 364955
URL: https://svnweb.freebsd.org/changeset/base/364955

Log:
 Drop the "nocover" option from the linux rc script; the option
 is not yet supported in 12-STABLE.

 This is a direct commit intended as a temporary workaround.

 Reported by:   scf@
 Sponsored by:  The FreeBSD Foundation

Modified:
 stable/12/libexec/rc/rc.d/linux


Thank you!

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


svn commit: r364961 - in stable/12: lib/libsecureboot stand/common stand/uboot/lib sys/kern

2020-08-29 Thread Simon J. Gerraty
Author: sjg
Date: Sat Aug 29 16:23:00 2020
New Revision: 364961
URL: https://svnweb.freebsd.org/changeset/base/364961

Log:
  MFC loader fixes
  
  r361710: stand/uboot: fix setting of gateip.s_addr
  Missplaced paren.
  
  r361933: loader: install allow for more complete device spec in url
  
  Rework to simplify and impose sane url syntax.
  That is we allow for file://[devname[:fstype]]/package
  
  r362127: verify_pcr_export: bump kenv_mvallen if needed
  r362231: make KENV_MVALLEN tunable
  
  When doing secure boot, loader wants to export loader.ve.hashed
  the value of which typically exceeds KENV_MVALLEN.
  
  Replace use of KENV_MVALLEN with tunable kenv_mvallen.
  
  Add getenv_string_buffer() for the case where a stack buffer cannot be
  created and use uma_zone_t kenv_zone for suitably sized buffers.
  
  r364443: veloader: insist on verifying .4th .lua etc
  
  When files are read from .rc or .4th, verify_file is asked to
  guess the severity (VE_TRY,VE_WANT,VE_MUST)
  
  Reviewed by:  imp, stevek, kevans

Modified:
  stable/12/lib/libsecureboot/verify_file.c
  stable/12/stand/common/install.c
  stable/12/stand/uboot/lib/net.c
  stable/12/sys/kern/kern_environment.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libsecureboot/verify_file.c
==
--- stable/12/lib/libsecureboot/verify_file.c   Sat Aug 29 16:04:02 2020
(r364960)
+++ stable/12/lib/libsecureboot/verify_file.c   Sat Aug 29 16:23:00 2020
(r364961)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2017-2018, Juniper Networks, Inc.
+ * Copyright (c) 2017-2020, Juniper Networks, Inc.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include "libsecureboot.h"
 #include 
@@ -254,6 +255,10 @@ severity_guess(const char *filename)
strcmp(cp, ".cookie") == 0 ||
strcmp(cp, ".hints") == 0)
return (VE_TRY);
+   if (strcmp(cp, ".4th") == 0 ||
+   strcmp(cp, ".lua") == 0 ||
+   strcmp(cp, ".rc") == 0)
+   return (VE_MUST);
}
return (VE_WANT);
 }
@@ -532,6 +537,19 @@ verify_pcr_export(void)
DEBUG_PRINTF(1,
("%s: setenv(loader.ve.hashed, %s\n",
__func__, hinfo));
+   if ((hlen = strlen(hinfo)) > KENV_MVALLEN) {
+   /*
+* bump kenv_mvallen
+* roundup to multiple of KENV_MVALLEN
+*/
+   char mvallen[16];
+
+   hlen += KENV_MVALLEN -
+   (hlen % KENV_MVALLEN);
+   if (snprintf(mvallen, sizeof(mvallen),
+   "%d", (int) hlen) < 
sizeof(mvallen))
+   setenv("kenv_mvallen", mvallen, 
1);
+   }
free(hinfo);
}
}

Modified: stable/12/stand/common/install.c
==
--- stable/12/stand/common/install.cSat Aug 29 16:04:02 2020
(r364960)
+++ stable/12/stand/common/install.cSat Aug 29 16:23:00 2020
(r364961)
@@ -184,7 +184,8 @@ cleanup(void)
 
 /*
  * usage: install URL
- * where: URL = (tftp|file)://[host]/
+ * where: URL = tftp://[host]/
+ * or  file://[devname[:fstype]]/
  */
 static int
 install(char *pkgname)
@@ -192,8 +193,9 @@ install(char *pkgname)
static char buf[256];
struct fs_ops *proto;
struct preloaded_file *fp;
-   char *s, *currdev;
-   const char *devname;
+   char *e, *s, *currdev;
+   char *devname;
+   size_t devnamelen;
int error, fd, i, local;
 
s = strstr(pkgname, "://");
@@ -201,34 +203,74 @@ install(char *pkgname)
goto invalid_url;
 
i = s - pkgname;
+   s += 3;
+   if (*s == '\0')
+   goto invalid_url;
+
+   devname = NULL;
+   devnamelen = 0;
+   proto = NULL;
+   local = 0;
+
if (i == 4 && !strncasecmp(pkgname, "tftp", i)) {
devname = "net0";
+   devnamelen = 4;
proto = &tftp_fsops;
-   local = 0;
} else if (i == 4 && !strncasecmp(pkgname, "file", i)) {
currdev = getenv("currdev");
-   if (currdev != NULL && strcmp(currdev, "pxe0:") == 0) {
-   devna

svn commit: r364962 - stable/12/sys/security/mac_veriexec

2020-08-29 Thread Simon J. Gerraty
Author: sjg
Date: Sat Aug 29 16:27:21 2020
New Revision: 364962
URL: https://svnweb.freebsd.org/changeset/base/364962

Log:
  mac_veriexec_fingerprint_check_vnode: v_writecount > 0 means active writers
  
  v_writecount can actually be < 0 for text,
  so check for v_writecount > 0
  
  MFC of r362125
  
  Reviewed by:  stevek

Modified:
  stable/12/sys/security/mac_veriexec/veriexec_fingerprint.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/security/mac_veriexec/veriexec_fingerprint.c
==
--- stable/12/sys/security/mac_veriexec/veriexec_fingerprint.c  Sat Aug 29 
16:23:00 2020(r364961)
+++ stable/12/sys/security/mac_veriexec/veriexec_fingerprint.c  Sat Aug 29 
16:27:21 2020(r364962)
@@ -214,7 +214,7 @@ mac_veriexec_fingerprint_check_vnode(struct vnode *vp,
int error;
 
/* reject fingerprint if writers are active */
-   if (vp->v_writecount)
+   if (vp->v_writecount > 0)
return (ETXTBSY);
 
if ((vp->v_mount->mnt_flag & MNT_VERIFIED) != 0) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r364946 - head/sys/kern

2020-08-29 Thread Ian Lepore
On Sat, 2020-08-29 at 05:02 -0600, Warner Losh wrote:
> >
> > sbuf_cpy() at _gone_in_dev+0x560
> >  pc = 0x003c1ff0  lr = 0x003a9078
> >  sp = 0x6f21a510  fp = 0x6f21a570
> >
> > _gone_in_dev() at sbuf_new_for_sysctl+0x170
> >  pc = 0x003a9078  lr = 0x0037c1a8
> >  sp = 0x6f21a580  fp = 0x6f21a5a0
> >
> > sbuf_new_for_sysctl() at kernel_sysctl+0x36c
> >  pc = 0x0037c1a8  lr = 0x0037b63c
> >  sp = 0x6f21a5b0  fp = 0x6f21a630
> >
> 
> This traceback is all kinds of crazy. sbuf_new_for_sysctl doesn't call
> _gone_in_dev(), which doesn't do sbuf stuff at all. And neither does it
> call sbuf_cpy(). Though I get a crash that looks like:
> Tracing pid 66442 tid 101464 td 0xfe02f47b7c00
> kdb_enter() at kdb_enter+0x37/frame 0xfe02f4ae3740
> vpanic() at vpanic+0x19e/frame 0xfe02f4ae3790
> panic() at panic+0x43/frame 0xfe02f4ae37f0
> sbuf_clear() at sbuf_clear+0xac/frame 0xfe02f4ae3800
> sbuf_cpy() at sbuf_cpy+0x5a/frame 0xfe02f4ae3820
> device_sysctl_handler() at device_sysctl_handler+0x133/frame
> 0xfe02f4ae38a0
> sysctl_root_handler_locked() at sysctl_root_handler_locked+0x9c/frame
> 0xfe02f4ae38f0
> sysctl_root() at sysctl_root+0x20a/frame 0xfe02f4ae3970
> userland_sysctl() at userland_sysctl+0x17d/frame 0xfe02f4ae3a20
> sys___sysctl() at sys___sysctl+0x5f/frame 0xfe02f4ae3ad0
> amd64_syscall() at amd64_syscall+0x140/frame 0xfe02f4ae3bf0
> fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfe02f4ae3bf0
> --- syscall (202, FreeBSD ELF64, sys___sysctl), rip = 0x80042d50a, rsp =
> 0x7fffd458, rbp = 0x7fffd490 ---
> 
> on a sysctl -a which I think makes more sense...  I'll see if I can track
> it down... I think it's because sbuf_cpy does an unconditional clear, which
> triggers this assert, which is likely bogus for this case. sbuf_cat doesn't
> seem to have this issue... I'll confirm and commit.
> 
> Warner

This kind of crazy happens when the traceback just reports the name of
the nearest global symbol it can find because static or other local
symbols aren't available to it.  The clue that that's what's going on
tends to be in things like:

  sbuf_cpy() at _gone_in_dev+0x560

It's almost certain that _gone_in_dev() isn't a big enough function
that an offset of 0x560 is still in that function, so it's really in
some static function that got linked nearby but the symbols for statics
got stripped.  Usually you can use addr2line on kernel.full to get the
real names for the pc and lr values.

-- Ian


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


svn commit: r364963 - in stable/12: crypto/openssl/crypto/aes/asm crypto/openssl/crypto/bn/asm crypto/openssl/crypto/chacha/asm crypto/openssl/crypto/ec/asm crypto/openssl/crypto/modes/asm crypto/o...

2020-08-29 Thread Jung-uk Kim
Author: jkim
Date: Sat Aug 29 18:11:37 2020
New Revision: 364963
URL: https://svnweb.freebsd.org/changeset/base/364963

Log:
  MFC:  r364822, r364823
  
  Fix Clang version detection and regen X86 assembly files.

Modified:
  stable/12/crypto/openssl/crypto/aes/asm/aesni-mb-x86_64.pl
  stable/12/crypto/openssl/crypto/aes/asm/aesni-sha1-x86_64.pl
  stable/12/crypto/openssl/crypto/aes/asm/aesni-sha256-x86_64.pl
  stable/12/crypto/openssl/crypto/bn/asm/rsaz-avx2.pl
  stable/12/crypto/openssl/crypto/bn/asm/rsaz-x86_64.pl
  stable/12/crypto/openssl/crypto/bn/asm/x86_64-mont.pl
  stable/12/crypto/openssl/crypto/bn/asm/x86_64-mont5.pl
  stable/12/crypto/openssl/crypto/chacha/asm/chacha-x86.pl
  stable/12/crypto/openssl/crypto/chacha/asm/chacha-x86_64.pl
  stable/12/crypto/openssl/crypto/ec/asm/ecp_nistz256-avx2.pl
  stable/12/crypto/openssl/crypto/ec/asm/ecp_nistz256-x86_64.pl
  stable/12/crypto/openssl/crypto/ec/asm/x25519-x86_64.pl
  stable/12/crypto/openssl/crypto/modes/asm/aesni-gcm-x86_64.pl
  stable/12/crypto/openssl/crypto/modes/asm/ghash-x86_64.pl
  stable/12/crypto/openssl/crypto/poly1305/asm/poly1305-x86.pl
  stable/12/crypto/openssl/crypto/poly1305/asm/poly1305-x86_64.pl
  stable/12/crypto/openssl/crypto/sha/asm/sha1-586.pl
  stable/12/crypto/openssl/crypto/sha/asm/sha1-mb-x86_64.pl
  stable/12/crypto/openssl/crypto/sha/asm/sha1-x86_64.pl
  stable/12/crypto/openssl/crypto/sha/asm/sha256-586.pl
  stable/12/crypto/openssl/crypto/sha/asm/sha256-mb-x86_64.pl
  stable/12/crypto/openssl/crypto/sha/asm/sha512-x86_64.pl
  stable/12/secure/lib/libcrypto/amd64/aesni-gcm-x86_64.S
  stable/12/secure/lib/libcrypto/amd64/aesni-mb-x86_64.S
  stable/12/secure/lib/libcrypto/amd64/aesni-sha1-x86_64.S
  stable/12/secure/lib/libcrypto/amd64/aesni-sha256-x86_64.S
  stable/12/secure/lib/libcrypto/amd64/chacha-x86_64.S
  stable/12/secure/lib/libcrypto/amd64/ecp_nistz256-x86_64.S
  stable/12/secure/lib/libcrypto/amd64/ghash-x86_64.S
  stable/12/secure/lib/libcrypto/amd64/poly1305-x86_64.S
  stable/12/secure/lib/libcrypto/amd64/rsaz-avx2.S
  stable/12/secure/lib/libcrypto/amd64/rsaz-x86_64.S
  stable/12/secure/lib/libcrypto/amd64/sha1-mb-x86_64.S
  stable/12/secure/lib/libcrypto/amd64/sha1-x86_64.S
  stable/12/secure/lib/libcrypto/amd64/sha256-mb-x86_64.S
  stable/12/secure/lib/libcrypto/amd64/sha256-x86_64.S
  stable/12/secure/lib/libcrypto/amd64/sha512-x86_64.S
  stable/12/secure/lib/libcrypto/amd64/x25519-x86_64.S
  stable/12/secure/lib/libcrypto/amd64/x86_64-mont.S
  stable/12/secure/lib/libcrypto/amd64/x86_64-mont5.S
  stable/12/secure/lib/libcrypto/i386/chacha-x86.S
  stable/12/secure/lib/libcrypto/i386/poly1305-x86.S
  stable/12/secure/lib/libcrypto/i386/sha1-586.S
  stable/12/secure/lib/libcrypto/i386/sha256-586.S
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/crypto/openssl/crypto/aes/asm/aesni-mb-x86_64.pl
==
--- stable/12/crypto/openssl/crypto/aes/asm/aesni-mb-x86_64.pl  Sat Aug 29 
16:27:21 2020(r364962)
+++ stable/12/crypto/openssl/crypto/aes/asm/aesni-mb-x86_64.pl  Sat Aug 29 
18:11:37 2020(r364963)
@@ -70,7 +70,7 @@ if (!$avx && $win64 && ($flavour =~ /masm/ || $ENV{ASM
$avx = ($1>=10) + ($1>=11);
 }
 
-if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) 
([0-9]+\.[0-9]+)/) {
+if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) 
([0-9]+\.[0-9]+)/) {
$avx = ($2>=3.0) + ($2>3.0);
 }
 

Modified: stable/12/crypto/openssl/crypto/aes/asm/aesni-sha1-x86_64.pl
==
--- stable/12/crypto/openssl/crypto/aes/asm/aesni-sha1-x86_64.plSat Aug 
29 16:27:21 2020(r364962)
+++ stable/12/crypto/openssl/crypto/aes/asm/aesni-sha1-x86_64.plSat Aug 
29 18:11:37 2020(r364963)
@@ -108,7 +108,7 @@ $avx=1 if (!$avx && $win64 && ($flavour =~ /nasm/ || $
 $avx=1 if (!$avx && $win64 && ($flavour =~ /masm/ || $ENV{ASM} =~ /ml64/) &&
   `ml64 2>&1` =~ /Version ([0-9]+)\./ &&
   $1>=10);
-$avx=1 if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on 
LLVM) ([0-9]+\.[0-9]+)/ && $2>=3.0);
+$avx=1 if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on 
LLVM) ([0-9]+\.[0-9]+)/ && $2>=3.0);
 
 $shaext=1; ### set to zero if compiling for 1.0.1
 

Modified: stable/12/crypto/openssl/crypto/aes/asm/aesni-sha256-x86_64.pl
==
--- stable/12/crypto/openssl/crypto/aes/asm/aesni-sha256-x86_64.pl  Sat Aug 
29 16:27:21 2020(r364962)
+++ stable/12/crypto/openssl/crypto/aes/asm/aesni-sha256-x86_64.pl  Sat Aug 
29 18:11:37 2020(r364963)
@@ -70,7 +70,7 @@ if (!$avx && $win64 && ($flavour =~ /masm/ || $ENV{ASM
$avx = ($1>=10) + ($1>=12);
 }
 
-if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) 

svn commit: r364964 - in head: share/man/man9 sys/compat/linuxkpi/common/include/linux sys/kern sys/sys sys/vm

2020-08-29 Thread Vladimir Kondratyev
Author: wulf
Date: Sat Aug 29 19:26:31 2020
New Revision: 364964
URL: https://svnweb.freebsd.org/changeset/base/364964

Log:
  LinuxKPI: Implement ksize() function.
  
  In Linux, ksize() gets the actual amount of memory allocated for a given
  object. This commit adds malloc_usable_size() to FreeBSD KPI which does
  the same. It also maps LinuxKPI ksize() to newly created function.
  
  ksize() function is used by drm-kmod.
  
  Reviewed by:  hselasky, kib
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D26215

Modified:
  head/share/man/man9/malloc.9
  head/sys/compat/linuxkpi/common/include/linux/slab.h
  head/sys/kern/kern_malloc.c
  head/sys/sys/malloc.h
  head/sys/vm/memguard.c
  head/sys/vm/memguard.h

Modified: head/share/man/man9/malloc.9
==
--- head/share/man/man9/malloc.9Sat Aug 29 18:11:37 2020
(r364963)
+++ head/share/man/man9/malloc.9Sat Aug 29 19:26:31 2020
(r364964)
@@ -29,7 +29,7 @@
 .\" $NetBSD: malloc.9,v 1.3 1996/11/11 00:05:11 lukem Exp $
 .\" $FreeBSD$
 .\"
-.Dd August 3, 2020
+.Dd August 28, 2020
 .Dt MALLOC 9
 .Os
 .Sh NAME
@@ -55,6 +55,8 @@
 .Fn realloc "void *addr" "size_t size" "struct malloc_type *type" "int flags"
 .Ft void *
 .Fn reallocf "void *addr" "size_t size" "struct malloc_type *type" "int flags"
+.Ft size_t
+.Fn malloc_usable_size "const void *addr"
 .Fn MALLOC_DECLARE type
 .In sys/param.h
 .In sys/malloc.h
@@ -149,6 +151,13 @@ function is identical to
 .Fn realloc
 except that it
 will free the passed pointer when the requested memory cannot be allocated.
+.Pp
+The
+.Fn malloc_usable_size
+function returns the usable size of the allocation pointed to by
+.Fa addr .
+The return value may be larger than the size that was requested during
+allocation.
 .Pp
 Unlike its standard C library counterpart
 .Pq Xr malloc 3 ,

Modified: head/sys/compat/linuxkpi/common/include/linux/slab.h
==
--- head/sys/compat/linuxkpi/common/include/linux/slab.hSat Aug 29 
18:11:37 2020(r364963)
+++ head/sys/compat/linuxkpi/common/include/linux/slab.hSat Aug 29 
19:26:31 2020(r364964)
@@ -154,6 +154,12 @@ kfree(const void *ptr)
free(__DECONST(void *, ptr), M_KMALLOC);
 }
 
+static inline size_t
+ksize(const void *ptr)
+{
+   return (malloc_usable_size(ptr));
+}
+
 extern struct linux_kmem_cache *linux_kmem_cache_create(const char *name,
 size_t size, size_t align, unsigned flags, linux_kmem_ctor_t *ctor);
 

Modified: head/sys/kern/kern_malloc.c
==
--- head/sys/kern/kern_malloc.c Sat Aug 29 18:11:37 2020(r364963)
+++ head/sys/kern/kern_malloc.c Sat Aug 29 19:26:31 2020(r364964)
@@ -938,6 +938,42 @@ reallocf(void *addr, size_t size, struct malloc_type *
return (mem);
 }
 
+/*
+ * malloc_usable_size: returns the usable size of the allocation.
+ */
+size_t
+malloc_usable_size(const void *addr)
+{
+#ifndef DEBUG_REDZONE
+   uma_zone_t zone;
+   uma_slab_t slab;
+#endif
+   u_long size;
+
+   if (addr == NULL)
+   return (0);
+
+#ifdef DEBUG_MEMGUARD
+   if (is_memguard_addr(__DECONST(void *, addr)))
+   return (memguard_get_req_size(addr));
+#endif
+
+#ifdef DEBUG_REDZONE
+   size = redzone_get_size(__DECONST(void *, addr));
+#else
+   vtozoneslab((vm_offset_t)addr & (~UMA_SLAB_MASK), &zone, &slab);
+   if (slab == NULL)
+   panic("malloc_usable_size: address %p(%p) is not allocated.\n",
+   addr, (void *)((u_long)addr & (~UMA_SLAB_MASK)));
+
+   if (!malloc_large_slab(slab))
+   size = zone->uz_size;
+   else
+   size = malloc_large_size(slab);
+#endif
+   return (size);
+}
+
 CTASSERT(VM_KMEM_SIZE_SCALE >= 1);
 
 /*

Modified: head/sys/sys/malloc.h
==
--- head/sys/sys/malloc.h   Sat Aug 29 18:11:37 2020(r364963)
+++ head/sys/sys/malloc.h   Sat Aug 29 19:26:31 2020(r364964)
@@ -244,6 +244,7 @@ voidmalloc_type_allocated(struct malloc_type *type, 
u
 void   malloc_type_freed(struct malloc_type *type, unsigned long size);
 void   malloc_type_list(malloc_type_list_func_t *, void *);
 void   malloc_uninit(void *);
+size_t malloc_usable_size(const void *);
 void   *realloc(void *addr, size_t size, struct malloc_type *type, int flags)
__result_use_check __alloc_size(2);
 void   *reallocf(void *addr, size_t size, struct malloc_type *type, int flags)

Modified: head/sys/vm/memguard.c
==
--- head/sys/vm/memguard.c  Sat Aug 29 18:11:37 2020(r364963)
+++ head/sys/vm/memguard.c  Sat Aug 29 19:26:31 2020(r364964)

svn commit: r364965 - in head/stand: common libsa

2020-08-29 Thread Simon J. Gerraty
Author: sjg
Date: Sat Aug 29 21:05:43 2020
New Revision: 364965
URL: https://svnweb.freebsd.org/changeset/base/364965

Log:
  zalloc_malloc:Free hexdump preceeding buffer when we detect overflow
  
  Move hexdump from stand/common/misc.c to stand/libsa/hexdump.c
  (svn cp)
  Disable use of pager - causes linking issue for boot1
  can be re-enabled by defining HEXDUMP_PAGER.
  
  Reviewed by:  stevek, imp
  MFC after:1 week
  Sponsored by: Juniper Networks
  Differential Revision: https://reviews.freebsd.org/D26235

Added:
  head/stand/libsa/hexdump.c   (contents, props changed)
 - copied, changed from r364346, head/stand/common/misc.c
Modified:
  head/stand/common/bootstrap.h
  head/stand/common/misc.c
  head/stand/libsa/Makefile
  head/stand/libsa/pkgfs.c
  head/stand/libsa/stand.h
  head/stand/libsa/zalloc_malloc.c

Modified: head/stand/common/bootstrap.h
==
--- head/stand/common/bootstrap.h   Sat Aug 29 19:26:31 2020
(r364964)
+++ head/stand/common/bootstrap.h   Sat Aug 29 21:05:43 2020
(r364965)
@@ -68,7 +68,6 @@ int   getrootmount(char *rootdev);
 
 /* misc.c */
 char   *unargv(int argc, char *argv[]);
-void   hexdump(caddr_t region, size_t len);
 size_t strlenout(vm_offset_t str);
 char   *strdupout(vm_offset_t str);
 void   kern_bzero(vm_offset_t dest, size_t len);

Modified: head/stand/common/misc.c
==
--- head/stand/common/misc.cSat Aug 29 19:26:31 2020(r364964)
+++ head/stand/common/misc.cSat Aug 29 21:05:43 2020(r364965)
@@ -169,46 +169,6 @@ alloc_pread(readin_handle_t fd, off_t off, size_t len)
return (buf);
 }
 
-/*
- * Display a region in traditional hexdump format.
- */
-void
-hexdump(caddr_t region, size_t len)
-{
-caddr_tline;
-intx, c;
-char   lbuf[80];
-#define emit(fmt, args...) {sprintf(lbuf, fmt , ## args); 
pager_output(lbuf);}
-
-pager_open();
-for (line = region; line < (region + len); line += 16) {
-   emit("%08lx  ", (long) line);
-   
-   for (x = 0; x < 16; x++) {
-   if ((line + x) < (region + len)) {
-   emit("%02x ", *(uint8_t *)(line + x));
-   } else {
-   emit("-- ");
-   }
-   if (x == 7)
-   emit(" ");
-   }
-   emit(" |");
-   for (x = 0; x < 16; x++) {
-   if ((line + x) < (region + len)) {
-   c = *(uint8_t *)(line + x);
-   if ((c < ' ') || (c > '~')) /* !isprint(c) */
-   c = '.';
-   emit("%c", c);
-   } else {
-   emit(" ");
-   }
-   }
-   emit("|\n");
-}
-pager_close();
-}
-
 void
 dev_cleanup(void)
 {

Modified: head/stand/libsa/Makefile
==
--- head/stand/libsa/Makefile   Sat Aug 29 19:26:31 2020(r364964)
+++ head/stand/libsa/Makefile   Sat Aug 29 21:05:43 2020(r364965)
@@ -13,8 +13,9 @@ LIBSA_CPUARCH?=${MACHINE_CPUARCH}
 LIB?=  sa
 
 # standalone components and stuff we have modified locally
-SRCS+= gzguts.h zutil.h __main.c abort.c assert.c bcd.c environment.c getopt.c 
gets.c \
-   globals.c pager.c panic.c printf.c strdup.c strerror.c \
+SRCS+= gzguts.h zutil.h __main.c abort.c assert.c bcd.c environment.c \
+   getopt.c gets.c globals.c \
+   hexdump.c pager.c panic.c printf.c strdup.c strerror.c \
random.c sbrk.c twiddle.c zalloc.c zalloc_malloc.c
 
 # private (pruned) versions of libc string functions

Copied and modified: head/stand/libsa/hexdump.c (from r364346, 
head/stand/common/misc.c)
==
--- head/stand/common/misc.cTue Aug 18 14:17:14 2020(r364346, copy 
source)
+++ head/stand/libsa/hexdump.c  Sat Aug 29 21:05:43 2020(r364965)
@@ -29,147 +29,8 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
-#include 
 
 /*
- * Concatenate the (argc) elements of (argv) into a single string, and return
- * a copy of same.
- */
-char *
-unargv(int argc, char *argv[])
-{
-size_t hlong;
-inti;
-char   *cp;
-
-for (i = 0, hlong = 0; i < argc; i++)
-   hlong += strlen(argv[i]) + 2;
-
-if(hlong == 0)
-   return(NULL);
-
-cp = malloc(hlong);
-cp[0] = 0;
-for (i = 0; i < argc; i++) {
-   strcat(cp, argv[i]);
-   if (i < (argc - 1))
- strcat(cp, " ");
-}
- 
-return(cp);
-}
-
-/*
- * Get the length of a string in kernel space
- */
-size_t
-strlenout(vm_offset_t src)
-{
-char   c;
-size_t len;
-
-for (len = 0; ; len++) {
-   archsw.arch_copyout(src++, &c, 1);
-   if (c == 0)
-   break;
-}
-return(len);
-}
-
-/*
- * Make a duplicate copy of a string in kernel space
-

svn commit: r364966 - head/release

2020-08-29 Thread Glen Barber
Author: gjb
Date: Sat Aug 29 21:42:59 2020
New Revision: 364966
URL: https://svnweb.freebsd.org/changeset/base/364966

Log:
  Remove the VCSUPDATE command, because git is too stupid to have
  the '-C ' after the subcommand.
  
  Meanwhile, hard-code 'git -C <...> pull' for now.
  
  Reported by:  Michael Butler
  Sponsored by: Rubicon Communications, LLC (netgate.com)

Modified:
  head/release/release.sh

Modified: head/release/release.sh
==
--- head/release/release.sh Sat Aug 29 21:05:43 2020(r364965)
+++ head/release/release.sh Sat Aug 29 21:42:59 2020(r364966)
@@ -70,7 +70,6 @@ env_setup() {
exit 1
fi
VCSCMD="/usr/local/bin/git clone -q"
-   VCSUPDATE="/usr/local/bin/git pull -q"
 
# The default git checkout server, and branches for src/, doc/,
# and ports/.
@@ -222,21 +221,21 @@ chroot_setup() {
 
if [ -z "${SRC_UPDATE_SKIP}" ]; then
if [ -d "${CHROOTDIR}/usr/src/.git" ]; then
-   ${VCSUPDATE} -C ${CHROOTDIR}/usr/src
+   git -C ${CHROOTDIR}/usr/src pull
else
${VCSCMD} ${SRC} -b ${SRCBRANCH} ${CHROOTDIR}/usr/src
fi
fi
if [ -z "${NODOC}" ] && [ -z "${DOC_UPDATE_SKIP}" ]; then
if [ -d "${CHROOTDIR}/usr/doc/.git" ]; then
-   ${VCSUPDATE} -C ${CHROOTDIR}/usr/doc
+   git -C ${CHROOTDIR}/usr/doc pull
else
${VCSCMD} ${DOC} -b ${DOCBRANCH} ${CHROOTDIR}/usr/doc
fi
fi
if [ -z "${NOPORTS}" ] && [ -z "${PORTS_UPDATE_SKIP}" ]; then
if [ -d "${CHROOTDIR}/usr/ports/.git" ]; then
-   ${VCSUPDATE} -C ${CHROOTDIR}/usr/ports
+   git -C ${CHROOTDIR}/usr/ports pull
else
${VCSCMD} ${PORT} -b ${PORTBRANCH} 
${CHROOTDIR}/usr/ports
fi
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r364967 - head/release

2020-08-29 Thread Glen Barber
Author: gjb
Date: Sat Aug 29 21:46:34 2020
New Revision: 364967
URL: https://svnweb.freebsd.org/changeset/base/364967

Log:
  Restore the '-q' flag to the 'git pull' command.
  
  Sponsored by: Rubicon Communications, LLC (netgate.com)

Modified:
  head/release/release.sh

Modified: head/release/release.sh
==
--- head/release/release.sh Sat Aug 29 21:42:59 2020(r364966)
+++ head/release/release.sh Sat Aug 29 21:46:34 2020(r364967)
@@ -221,21 +221,21 @@ chroot_setup() {
 
if [ -z "${SRC_UPDATE_SKIP}" ]; then
if [ -d "${CHROOTDIR}/usr/src/.git" ]; then
-   git -C ${CHROOTDIR}/usr/src pull
+   git -C ${CHROOTDIR}/usr/src -q pull
else
${VCSCMD} ${SRC} -b ${SRCBRANCH} ${CHROOTDIR}/usr/src
fi
fi
if [ -z "${NODOC}" ] && [ -z "${DOC_UPDATE_SKIP}" ]; then
if [ -d "${CHROOTDIR}/usr/doc/.git" ]; then
-   git -C ${CHROOTDIR}/usr/doc pull
+   git -C ${CHROOTDIR}/usr/doc -q pull
else
${VCSCMD} ${DOC} -b ${DOCBRANCH} ${CHROOTDIR}/usr/doc
fi
fi
if [ -z "${NOPORTS}" ] && [ -z "${PORTS_UPDATE_SKIP}" ]; then
if [ -d "${CHROOTDIR}/usr/ports/.git" ]; then
-   git -C ${CHROOTDIR}/usr/ports pull
+   git -C ${CHROOTDIR}/usr/ports -q pull
else
${VCSCMD} ${PORT} -b ${PORTBRANCH} 
${CHROOTDIR}/usr/ports
fi
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r364968 - head/release

2020-08-29 Thread Glen Barber
Author: gjb
Date: Sat Aug 29 21:47:49 2020
New Revision: 364968
URL: https://svnweb.freebsd.org/changeset/base/364968

Log:
  Fix ordering of the 'pull' subcommand and the '-q' flag.
  
  Pointyhat to: gjb (myself)
  Sponsored by: Rubicon Communications, LLC (netgate.com)

Modified:
  head/release/release.sh

Modified: head/release/release.sh
==
--- head/release/release.sh Sat Aug 29 21:46:34 2020(r364967)
+++ head/release/release.sh Sat Aug 29 21:47:49 2020(r364968)
@@ -221,21 +221,21 @@ chroot_setup() {
 
if [ -z "${SRC_UPDATE_SKIP}" ]; then
if [ -d "${CHROOTDIR}/usr/src/.git" ]; then
-   git -C ${CHROOTDIR}/usr/src -q pull
+   git -C ${CHROOTDIR}/usr/src pull -q
else
${VCSCMD} ${SRC} -b ${SRCBRANCH} ${CHROOTDIR}/usr/src
fi
fi
if [ -z "${NODOC}" ] && [ -z "${DOC_UPDATE_SKIP}" ]; then
if [ -d "${CHROOTDIR}/usr/doc/.git" ]; then
-   git -C ${CHROOTDIR}/usr/doc -q pull
+   git -C ${CHROOTDIR}/usr/doc pull -q
else
${VCSCMD} ${DOC} -b ${DOCBRANCH} ${CHROOTDIR}/usr/doc
fi
fi
if [ -z "${NOPORTS}" ] && [ -z "${PORTS_UPDATE_SKIP}" ]; then
if [ -d "${CHROOTDIR}/usr/ports/.git" ]; then
-   git -C ${CHROOTDIR}/usr/ports -q pull
+   git -C ${CHROOTDIR}/usr/ports pull -q
else
${VCSCMD} ${PORT} -b ${PORTBRANCH} 
${CHROOTDIR}/usr/ports
fi
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r364969 - stable/12/sys/kern

2020-08-29 Thread Jamie Gritton
Author: jamie
Date: Sat Aug 29 22:09:36 2020
New Revision: 364969
URL: https://svnweb.freebsd.org/changeset/base/364969

Log:
  Fix a null dereference when debug.disablefullpath=1 and jail created
  with path=/.
  
  PR:   214881
  Submitted by: aler (at) playground.ru
  Reported by:  aler (at) playground.ru

Modified:
  stable/12/sys/kern/kern_jail.c

Modified: stable/12/sys/kern/kern_jail.c
==
--- stable/12/sys/kern/kern_jail.c  Sat Aug 29 21:47:49 2020
(r364968)
+++ stable/12/sys/kern/kern_jail.c  Sat Aug 29 22:09:36 2020
(r364969)
@@ -943,40 +943,45 @@ kern_jail_set(struct thread *td, struct uio *optuio, i
error = EINVAL;
goto done_free;
}
-   NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE,
-   path, td);
-   error = namei(&nd);
-   if (error)
-   goto done_free;
-   root = nd.ni_vp;
-   NDFREE(&nd, NDF_ONLY_PNBUF);
-   g_path = malloc(MAXPATHLEN, M_TEMP, M_WAITOK);
-   strlcpy(g_path, path, MAXPATHLEN);
-   error = vn_path_to_global_path(td, root, g_path, MAXPATHLEN);
-   if (error == 0)
-   path = g_path;
-   else if (error == ENODEV) {
-   /* proceed if sysctl debug.disablefullpath == 1 */
-   fullpath_disabled = 1;
-   if (len < 2 || (len == 2 && path[0] == '/'))
-   path = NULL;
-   } else {
-   /* exit on other errors */
-   goto done_free;
-   }
-   if (root->v_type != VDIR) {
-   error = ENOTDIR;
-   vput(root);
-   goto done_free;
-   }
-   VOP_UNLOCK(root, 0);
-   if (fullpath_disabled) {
-   /* Leave room for a real-root full pathname. */
-   if (len + (path[0] == '/' && strcmp(mypr->pr_path, "/")
-   ? strlen(mypr->pr_path) : 0) > MAXPATHLEN) {
-   error = ENAMETOOLONG;
-   vrele(root);
+   if (len < 2 || (len == 2 && path[0] == '/'))
+   path = NULL;
+   else
+   {
+   NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE,
+   path, td);
+   error = namei(&nd);
+   if (error)
goto done_free;
+   root = nd.ni_vp;
+   NDFREE(&nd, NDF_ONLY_PNBUF);
+   g_path = malloc(MAXPATHLEN, M_TEMP, M_WAITOK);
+   strlcpy(g_path, path, MAXPATHLEN);
+   error = vn_path_to_global_path(td, root, g_path,
+   MAXPATHLEN);
+   if (error == 0)
+   path = g_path;
+   else if (error == ENODEV) {
+   /* means sysctl debug.disablefullpath == 1 */
+   fullpath_disabled = 1;
+   } else {
+   /* exit on other errors */
+   goto done_free;
+   }
+   if (root->v_type != VDIR) {
+   error = ENOTDIR;
+   vput(root);
+   goto done_free;
+   }
+   VOP_UNLOCK(root, 0);
+   if (fullpath_disabled) {
+   /* Leave room for a real-root full pathname. */
+   if (len + (path[0] == '/' &&
+   strcmp(mypr->pr_path, "/")
+   ? strlen(mypr->pr_path) : 0) > MAXPATHLEN) {
+   error = ENAMETOOLONG;
+   vrele(root);
+   goto done_free;
+   }
}
}
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r364970 - head/sys/sys

2020-08-29 Thread Jamie Gritton
Author: jamie
Date: Sat Aug 29 22:24:41 2020
New Revision: 364970
URL: https://svnweb.freebsd.org/changeset/base/364970

Log:
  Add __BEGIN_DECLS to jail.h to keep C++ happy.
  
  PR:   238928
  Reported by:  yuri@

Modified:
  head/sys/sys/jail.h

Modified: head/sys/sys/jail.h
==
--- head/sys/sys/jail.h Sat Aug 29 22:09:36 2020(r364969)
+++ head/sys/sys/jail.h Sat Aug 29 22:24:41 2020(r364970)
@@ -110,11 +110,13 @@ struct xprison {
 
 struct iovec;
 
+__BEGIN_DECLS
 int jail(struct jail *);
 int jail_set(struct iovec *, unsigned int, int);
 int jail_get(struct iovec *, unsigned int, int);
 int jail_attach(int);
 int jail_remove(int);
+__END_DECLS
 
 #else /* _KERNEL */
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r364972 - stable/12/sys/netgraph/bluetooth/drivers/ubt

2020-08-29 Thread Mark Johnston
Author: markj
Date: Sun Aug 30 02:26:43 2020
New Revision: 364972
URL: https://svnweb.freebsd.org/changeset/base/364972

Log:
  MFC r364509:
  ng_ubt: Add a device ID.
  
  PR:   248838

Modified:
  stable/12/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c
==
--- stable/12/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c   Sun Aug 30 
01:09:15 2020(r364971)
+++ stable/12/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c   Sun Aug 30 
02:26:43 2020(r364972)
@@ -508,6 +508,7 @@ static const STRUCT_USB_HOST_ID ubt_devs[] =
{ USB_VPI(USB_VENDOR_LITEON, 0x2003, 0) },
{ USB_VPI(USB_VENDOR_FOXCONN, 0xe042, 0) },
{ USB_VPI(USB_VENDOR_DELL, 0x8197, 0) },
+   { USB_VPI(USB_VENDOR_BELKIN, 0x065a, 0) },
 };
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"