svn commit: r346307 - in head: share/man/man4 sys/conf

2019-04-16 Thread Kyle Evans
Author: kevans
Date: Wed Apr 17 03:29:16 2019
New Revision: 346307
URL: https://svnweb.freebsd.org/changeset/base/346307

Log:
  fdt: further consolidate DTB building and revise manpage
  
  FDT_DTS_FILE was built separately with a rule in sys/conf/files and
  recreated the rules we used in dtb.mk. Now that we have other infrastructure
  to build a DTB along with the kernel, fold FDT_DTS_FILE into that since it
  doesn't have any special requirements.
  
  fdt(4) never got revised to mention the DTS/DTSO make options, so do that
  now.
  
  Reviewed by:  imp
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D19736

Modified:
  head/share/man/man4/fdt.4
  head/sys/conf/files
  head/sys/conf/kern.post.mk

Modified: head/share/man/man4/fdt.4
==
--- head/share/man/man4/fdt.4   Tue Apr 16 23:08:54 2019(r346306)
+++ head/share/man/man4/fdt.4   Wed Apr 17 03:29:16 2019(r346307)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 12, 2010
+.Dd March 28, 2019
 .Dt FDT 4
 .Os
 .Sh NAME
@@ -139,6 +139,21 @@ support at the
 .Fx
 kernel level.
 .Bl -tag -width Ar
+.It Va makeoptions DTS+=.dts
+Specifies device tree source (DTS) files for a given kernel.
+The indicated DTS files will be converted (compiled) into a binary form
+along with building the kernel itself.
+Any DTS file names not written as an absolute path must be specified relative
+to the default location of DTS sources i.e.,
+.Pa sys/dts .
+.It Va makeoptions DTSO+=.dtso
+Specifies device tree source overlay (DTSO) files for a given kernel.
+Overlay files will be built with the kernel as with the makeoption
+.Va DTS
+described above.
+Overlay files specified as relative paths will be relative to the default
+location of DTS overlays for the platform being built i.e.,
+.Pa sys/dts/arm/overlays .
 .It Va options FDT
 The primary option for enabling
 .Nm
@@ -153,10 +168,9 @@ drivers, as well as helper routines and libraries.
 .It Va makeoptions FDT_DTS_FILE=.dts
 Specifies a preferred (default) device tree source (DTS) file for a given
 kernel.
-The indicated DTS file will be converted (compiled) into a binary form
-along with building the kernel itself.
-The DTS file name is relative to the default location of DTS sources i.e.
-.Pa sys/dts .
+It will be built along with the kernel as if it were supplied via the 
makeoption
+.Va DTS
+described above.
 This makeoption is not mandatory unless FDT_DTB_STATIC is also defined (see
 below).
 .It Va options FDT_DTB_STATIC

Modified: head/sys/conf/files
==
--- head/sys/conf/files Tue Apr 16 23:08:54 2019(r346306)
+++ head/sys/conf/files Wed Apr 17 03:29:16 2019(r346307)
@@ -19,17 +19,9 @@ bhnd_nvram_map_data.hoptional bhnd   
   \
compile-with"sh $S/dev/bhnd/tools/nvram_map_gen.sh 
$S/dev/bhnd/nvram/nvram_map -d" \
no-obj no-implicit-rule before-depend  \
clean   "bhnd_nvram_map_data.h"
-#
-# The 'fdt_dtb_file' target covers an actual DTB file name, which is derived
-# from the specified source (DTS) file: .dts -> .dtb
-#
-fdt_dtb_file   optional fdt fdt_dtb_static \
-   compile-with "sh -c 'MACHINE=${MACHINE} $S/tools/fdt/make_dtb.sh $S 
${FDT_DTS_FILE} ${.CURDIR}'" \
-   no-obj no-implicit-rule before-depend   \
-   clean   "${FDT_DTS_FILE:R}.dtb"
 fdt_static_dtb.h   optional fdt fdt_dtb_static \
compile-with "sh -c 'MACHINE=${MACHINE} $S/tools/fdt/make_dtbh.sh 
${FDT_DTS_FILE} ${.CURDIR}'" \
-   dependency  "fdt_dtb_file" \
+   dependency  "${FDT_DTS_FILE:T:R}.dtb" \
no-obj no-implicit-rule before-depend \
clean   "fdt_static_dtb.h"
 feeder_eq_gen.hoptional sound  
   \
@@ -1723,7 +1715,7 @@ dev/fdt/fdt_pinctrl.c optional fdt fdt_pinctrl
 dev/fdt/fdt_pinctrl_if.m   optional fdt fdt_pinctrl
 dev/fdt/fdt_slicer.c   optional fdt cfi | fdt nand | fdt mx25l | fdt 
n25q | fdt at45d
 dev/fdt/fdt_static_dtb.S   optional fdt fdt_dtb_static \
-   dependency  "fdt_dtb_file"
+   dependency  "${FDT_DTS_FILE:T:R}.dtb"
 dev/fdt/simplebus.coptional fdt
 dev/fdt/simple_mfd.c   optional fdt
 dev/fe/if_fe.c optional fe

Modified: head/sys/conf/kern.post.mk
==
--- head/sys/conf/kern.post.mk  Tue Apr 16 23:08:54 2019(r346306)
+++ head/sys/conf/kern.post.mk  Wed Apr 17 03:29:16 2019(r346307)
@@ -8,6 +8,9 @@
 # should be defined in the kern.pre.mk so that port makefiles can
 # override or augment them.
 
+.if !empty(FDT_DTS_FILE)
+DTS+=  ${FDT_DTS_FILE}
+.endif
 .if defined(DTS) || defined(DTSO)

Re: svn commit: r346250 - in head: share/man/man4 share/man/man9 sys/dev/random sys/kern sys/libkern sys/sys

2019-04-16 Thread Conrad Meyer
On Tue, Apr 16, 2019 at 4:31 PM John Baldwin  wrote:
> bhyveload is effectively the loader in this case.  It runs the normal loader
> scripts and logic and so would load the guests's /boot/entropy and pass it
> to the guest kernel as metadata just like the regular loader.

Right, except it doesn't seem to do things like nuke /boot/nextboot.conf :-(.

> In addition, bhyve also supports virtio-rng which is another way to provide
> entropy to guest OS's.  That's why in my reply I focused on qemu for mips
> (or riscv) as for x86 hypervisors there are existing, somewhat-standarized
> solutions for the hypervisor to provide entropy to the guest.

Perhaps cryptographically random stack-protector cookies are simply
inappropriate for MIPS or RISCV.  Do we have any other examples of
kernel random consumers blocking after that immediate hiccup is
overcome?

Best,
Conrad
___
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: r346250 - in head: share/man/man4 share/man/man9 sys/dev/random sys/kern sys/libkern sys/sys

2019-04-16 Thread Conrad Meyer
On Tue, Apr 16, 2019 at 4:28 PM John Baldwin  wrote:
> Yes, but we need some kind of non-blocking API, not an 
> unconditionally-blocking API
> that deadlocks.

I'm not sure we do.  It would be sufficient to check once at subsystem
initialization time.  There's no race condition such that we block
again once we're seeded.

As far as APIs go, read_random_uio is nonblocking, although not an
arc4random interface (and quite cumbersome to set up and use).

> Eh, I thought that we periodically pulled in new entropy to generate a new 
> chacha20
> key for the PRNG and that could be blocking as well when I was last reading 
> this
> code, or is that not correct?

No, that's incorrect.  We periodically pull new Fortuna (devrandom)
output to reseed chacha20 in arc4random, but once Fortuna is "seeded,"
it *never* blocks ever again.

> Or maybe arc4random passes in a flag to disable
> reseeding so it isn't blocking once the PRNG has been seeded at least once?

As above, *re*seeding arc4random never blocks.

> Still, what I would suggest is to have the existing arc4random() use 
> WITNESS_WARN.
> We could provide an alternative API that is non-blocking and returns 
> EWOULDBLOCK.

I think the alternative EWOULDBLOCK proposal is worse than
WITNESS_WARN.  But I highlighted some problems with WITNESS_WARN in my
earlier email; how would you resolve them?

> Code that trips over the warning would have to be changed to use the 
> non-blocking
> API and then deal with EWOULDBLOCK.

Or it could just check that the random device is seeded, prior to
using arc4random?

> One way of dealing with that would be to
> check the is_random_seeded() flag earlier in the function, subsystem, whatever
> and then the code could assert that the non-blocking API never failed.

That's more or less the status quo with no-error arc4random, no?

> There are things like virtio-rng for modern x86 VM environments, but those 
> don't
> exist on things like the MIPS MALTA machine.

They probably probe later than SI_SUB_RANDOM too :-(.

> I also don't actually care at all (as in
> absolutely zero) about the entropy of keys generated for a test qemu instance 
> I fire up
> on my desktop that doesn't permit inbound access from the outside world.  
> Having some
> kind of tunable / kernel option for those use cases (that isn't the default) 
> doesn't
> seem unreasonable.

Sure.  It would probably be ok to have a knob for that.  We would want
to be careful about naming it / documenting it; the thing about knobs
is people tend to twiddle them.

Best,
Conrad
___
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: r346250 - in head: share/man/man4 share/man/man9 sys/dev/random sys/kern sys/libkern sys/sys

2019-04-16 Thread John Baldwin
On 4/16/19 3:51 PM, Rodney W. Grimes wrote:
>> On 4/15/19 11:40 AM, Conrad Meyer wrote:
>> Note that I actually often run into unseeded systems when doing development
>> using qemu for non-x86 architectures.  For example, when booting mips from
>> qemu, there is no loader, the kernel just starts, and since the endian is
>> opposite, I frequently regenerate the filesystem using makefs.
> 
> Isnt this also the case for bhyveload?  We do not go through the loader
> there when we are starting a FreeBSD guest, correct?

bhyveload is effectively the loader in this case.  It runs the normal loader
scripts and logic and so would load the guests's /boot/entropy and pass it
to the guest kernel as metadata just like the regular loader.

In addition, bhyve also supports virtio-rng which is another way to provide
entropy to guest OS's.  That's why in my reply I focused on qemu for mips
(or riscv) as for x86 hypervisors there are existing, somewhat-standarized
solutions for the hypervisor to provide entropy to the guest.

-- 
John Baldwin
___
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: r346250 - in head: share/man/man4 share/man/man9 sys/dev/random sys/kern sys/libkern sys/sys

2019-04-16 Thread John Baldwin
On 4/16/19 3:49 PM, Conrad Meyer wrote:
> On Tue, Apr 16, 2019 at 2:32 PM John Baldwin  wrote:
>> There are definitely places arc4random is used where sleeping is not allowed.
> 
> Sure.
> 
>> ipsec generating nonces for AES-CBC is one example I can think of off the
>> top of my head.
> 
> IVs for AES-CBC are also a great example of a case we should be seeded for.

Yes, but we need some kind of non-blocking API, not an unconditionally-blocking 
API
that deadlocks.
>> I think it might be useful to add an explicit WITNESS_WARN
>> in arc4random to catch these cases so they can be found and reasoned about.
> 
> Well, we kind of want that, but we also want the warning to disappear
> if the consumer has correctly reasoned about it.  E.g., if the thread
> has verified seeded status with is_random_seeded(), it is no longer
> possible for a arc4random consumption to block.  Right?  I think that
> may be difficult to integrate with the WITNESS_WARN, so even if all
> consumers are correctly implemented, we will not eliminate the witness
> warnings.  Do you have any ideas?  The only dumb proposal I have is
> burning a flag in td_flags for "this thread checked
> is_random_seeded(), and it returned true."

Eh, I thought that we periodically pulled in new entropy to generate a new 
chacha20
key for the PRNG and that could be blocking as well when I was last reading this
code, or is that not correct?  Or maybe arc4random passes in a flag to disable
reseeding so it isn't blocking once the PRNG has been seeded at least once?

Still, what I would suggest is to have the existing arc4random() use 
WITNESS_WARN.
We could provide an alternative API that is non-blocking and returns 
EWOULDBLOCK.
Code that trips over the warning would have to be changed to use the 
non-blocking
API and then deal with EWOULDBLOCK.  One way of dealing with that would be to
check the is_random_seeded() flag earlier in the function, subsystem, whatever
and then the code could assert that the non-blocking API never failed.

>> Note that I actually often run into unseeded systems when doing development
>> using qemu for non-x86 architectures.  For example, when booting mips from
>> qemu, there is no loader, the kernel just starts, and since the endian is
>> opposite, I frequently regenerate the filesystem using makefs.
> 
> Right.  Perhaps we could incorporate boot/entropy generation into
> makefs?  Or pass host entropy into some kernel accessible region (env
> var, whatever) via qemu?  The latter is sort of a general problem for
> VMs.  You want to be able to snapshot and clone a VM without producing
> reproducible RNG state, but Fortuna doesn't handle that explicitly
> (aside from future entropy differences and forward secrecy causing
> quick divergence).

There are things like virtio-rng for modern x86 VM environments, but those don't
exist on things like the MIPS MALTA machine.  I also don't actually care at all 
(as in
absolutely zero) about the entropy of keys generated for a test qemu instance I 
fire up
on my desktop that doesn't permit inbound access from the outside world.  
Having some
kind of tunable / kernel option for those use cases (that isn't the default) 
doesn't
seem unreasonable.

-- 
John Baldwin
___
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: r346306 - stable/11/release/doc/en_US.ISO8859-1/relnotes

2019-04-16 Thread Glen Barber
Author: gjb
Date: Tue Apr 16 23:08:54 2019
New Revision: 346306
URL: https://svnweb.freebsd.org/changeset/base/346306

Log:
  Fix a typo.
  
  Submitted by: adamw
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml

Modified: stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml
==
--- stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml  Tue Apr 16 
22:42:50 2019(r346305)
+++ stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml  Tue Apr 16 
23:08:54 2019(r346306)
@@ -531,7 +531,7 @@
 
   An
issue that could result in a system hang during
-   ZFS vnode reclaimation has been
+   ZFS vnode reclamation has been
fixed.
 
 
___
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: r346263 - head/contrib/tcpdump

2019-04-16 Thread Ed Maste
On Tue, 16 Apr 2019 at 11:38, Conrad Meyer  wrote:
>
> I don't think documenting that makes much sense in general.  It would
> be extremely burdensome to fully document and quickly become
> desynchronized from the code.  It's comparable to OpenBSD pledging
> differently in different paths of programs.

It's probably worth having tcpdump emit a warning if it's not able to
enter capability mode as a result of the options in use, if someone's
interested in proposing a patch.
___
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: r346250 - in head: share/man/man4 share/man/man9 sys/dev/random sys/kern sys/libkern sys/sys

2019-04-16 Thread Conrad Meyer
On Tue, Apr 16, 2019 at 2:32 PM John Baldwin  wrote:
> There are definitely places arc4random is used where sleeping is not allowed.

Sure.

> ipsec generating nonces for AES-CBC is one example I can think of off the
> top of my head.

IVs for AES-CBC are also a great example of a case we should be seeded for.

> I think it might be useful to add an explicit WITNESS_WARN
> in arc4random to catch these cases so they can be found and reasoned about.

Well, we kind of want that, but we also want the warning to disappear
if the consumer has correctly reasoned about it.  E.g., if the thread
has verified seeded status with is_random_seeded(), it is no longer
possible for a arc4random consumption to block.  Right?  I think that
may be difficult to integrate with the WITNESS_WARN, so even if all
consumers are correctly implemented, we will not eliminate the witness
warnings.  Do you have any ideas?  The only dumb proposal I have is
burning a flag in td_flags for "this thread checked
is_random_seeded(), and it returned true."

> Note that I actually often run into unseeded systems when doing development
> using qemu for non-x86 architectures.  For example, when booting mips from
> qemu, there is no loader, the kernel just starts, and since the endian is
> opposite, I frequently regenerate the filesystem using makefs.

Right.  Perhaps we could incorporate boot/entropy generation into
makefs?  Or pass host entropy into some kernel accessible region (env
var, whatever) via qemu?  The latter is sort of a general problem for
VMs.  You want to be able to snapshot and clone a VM without producing
reproducible RNG state, but Fortuna doesn't handle that explicitly
(aside from future entropy differences and forward secrecy causing
quick divergence).

Best,
Conrad
___
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: r346250 - in head: share/man/man4 share/man/man9 sys/dev/random sys/kern sys/libkern sys/sys

2019-04-16 Thread Rodney W. Grimes
> On 4/15/19 11:40 AM, Conrad Meyer wrote:
> > Author: cem
> > Date: Mon Apr 15 18:40:36 2019
> > New Revision: 346250
> > URL: https://svnweb.freebsd.org/changeset/base/346250
> > 
> > Log:
> >   random(4): Block read_random(9) on initial seeding
> >   
> >   read_random() is/was used, mostly without error checking, in a lot of
> >   very sensitive places in the kernel -- including seeding the widely used
> >   arc4random(9).
> >   
> >   Most uses, especially arc4random(9), should block until the device is 
> > seeded
> >   rather than proceeding with a bogus or empty seed.  I did not spy any
> >   obvious kernel consumers where blocking would be inappropriate (in the
> >   sense that lack of entropy would be ok -- I did not investigate locking
> >   angle thoroughly).  In many instances, arc4random_buf(9) or that family
> >   of APIs would be more appropriate anyway; that work was done in r345865.
> 
> There are definitely places arc4random is used where sleeping is not allowed.
> ipsec generating nonces for AES-CBC is one example I can think of off the
> top of my head.  I think it might be useful to add an explicit WITNESS_WARN
> in arc4random to catch these cases so they can be found and reasoned about.
> 
> >   This change primarily impacts the behavior of /dev/random on embedded
> >   systems with read-only media that do not configure "nodevice random".  We
> >   toggle the default from 'charge on blindly with no entropy' to 'block
> >   indefinitely.'  This default is safer, but may cause frustration.  
> > Embedded
> >   system designers using FreeBSD have several options.  The most obvious is 
> > to
> >   plan to have a small writable NVRAM or NAND to persist entropy, like 
> > larger
> >   systems.  Early entropy can be fed from any loader, or by writing directly
> >   to /dev/random during boot.  Some embedded SoCs now provide a fast 
> > hardware
> >   entropy source; this would also work for quickly seeding Fortuna.  A 3rd
> >   option would be creating an embedded-specific, more simplistic random
> >   module, like that designed by DJB in [1] (this design still requires a 
> > small
> >   rewritable media for forward secrecy).  Finally, the least preferred 
> > option
> >   might be "nodevice random", although I plan to remove this in a subsequent
> >   revision.
> 
> Note that I actually often run into unseeded systems when doing development
> using qemu for non-x86 architectures.  For example, when booting mips from
> qemu, there is no loader, the kernel just starts, and since the endian is
> opposite, I frequently regenerate the filesystem using makefs.

Isnt this also the case for bhyveload?  We do not go through the loader
there when we are starting a FreeBSD guest, correct?

> John Baldwin
-- 
Rod Grimes rgri...@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: r346305 - in head/sys/arm: allwinner conf

2019-04-16 Thread Emmanuel Vadot
Author: manu
Date: Tue Apr 16 22:42:50 2019
New Revision: 346305
URL: https://svnweb.freebsd.org/changeset/base/346305

Log:
  arm: allwinner: Makes more device optional
  
  MFC after:2 weeks

Modified:
  head/sys/arm/allwinner/files.allwinner
  head/sys/arm/conf/GENERIC

Modified: head/sys/arm/allwinner/files.allwinner
==
--- head/sys/arm/allwinner/files.allwinner  Tue Apr 16 21:09:57 2019
(r346304)
+++ head/sys/arm/allwinner/files.allwinner  Tue Apr 16 22:42:50 2019
(r346305)
@@ -2,10 +2,10 @@
 
 arm/allwinner/a10_ahci.c   optionalahci
 arm/allwinner/a10_codec.c  optionalsound
-arm/allwinner/a10_dmac.c   standard
-arm/allwinner/a31_dmac.c   standard
+arm/allwinner/a10_dmac.c   optionala10_dmac
+arm/allwinner/a31_dmac.c   optionala31_dmac
 arm/allwinner/a10_ehci.c   optionalehci
-arm/allwinner/a10_sramc.c  standard
+arm/allwinner/a10_sramc.c  optionalSOC_ALLWINNER_A10
 arm/allwinner/aw_gpio.coptionalgpio
 arm/allwinner/aw_if_dwc.c  optionaldwc
 arm/allwinner/aw_machdep.c standard
@@ -13,21 +13,21 @@ arm/allwinner/aw_mmc.c  optional
mmc | mmccam
 arm/allwinner/aw_mp.c  optionalsmp
 arm/allwinner/aw_nmi.c optionalintrng
 arm/allwinner/aw_rsb.c optionalrsb | p2wi
-arm/allwinner/aw_rtc.c standard
+arm/allwinner/aw_rtc.c optionalaw_rtc
 arm/allwinner/aw_syscon.c  optionalext_resources syscon
-arm/allwinner/aw_ts.c  standard
+arm/allwinner/aw_ts.c  optionalaw_thermal
 arm/allwinner/aw_usbphy.c  optionalehci | ohci
-arm/allwinner/aw_wdog.cstandard
+arm/allwinner/aw_wdog.coptionalaw_wdog
 arm/allwinner/axp209.c optionalaxp209
 arm/allwinner/axp81x.c optionalaxp81x
 arm/allwinner/if_awg.c optionalawg ext_resources syscon
 arm/allwinner/if_emac.coptionalemac
-arm/allwinner/sunxi_dma_if.m   standard
+arm/allwinner/sunxi_dma_if.m   optionala10_dmac | a31_dmac
 dev/iicbus/twsi/a10_twsi.c optionaltwsi
 dev/usb/controller/generic_ohci.c  optionalohci
 dev/usb/controller/generic_usb_if.moptionalohci
-arm/allwinner/aw_sid.c standard
-arm/allwinner/aw_thermal.c standard
+arm/allwinner/aw_sid.c optionalaw_sid
+arm/allwinner/aw_thermal.c optionalaw_thermal
 dev/iicbus/sy8106a.c   optionalsy8106a
 arm/allwinner/aw_cir.c optionalaw_cir evdev
 

Modified: head/sys/arm/conf/GENERIC
==
--- head/sys/arm/conf/GENERIC   Tue Apr 16 21:09:57 2019(r346304)
+++ head/sys/arm/conf/GENERIC   Tue Apr 16 22:42:50 2019(r346305)
@@ -181,6 +181,7 @@ device  ti_adc
 # watchdog.
 device ti_wdt
 device imxwdt  # Watchdog. WARNING: can't be 
disabled!!!
+device aw_wdog # Allwinner Watchdog
 
 device scbus   # SCSI bus (required for ATA/SCSI)
 device da  # Direct Access (disks)
@@ -253,6 +254,8 @@ device  ti_mbox
 # DMA controller
 device fslsdma
 device ti_sdma
+device a10_dmac
+device a31_dmac
 
 # Extensible Firmware Interface
 optionsEFI
@@ -262,8 +265,15 @@ device cesa
 device crypto
 device cryptodev
 
-# imx6 on-chip RTC
-device imx6_snvs   # On-chip RTC
+# RTC
+device imx6_snvs   # IMX6 On-chip RTC
+device aw_rtc  # Allwinner On-chip RTC
+
+# EFUSE
+device aw_sid  # Allwinner Secure ID EFUSE
+
+# Thermal sensors
+device aw_thermal  # Allwinner Thermal Sensor Controller
 
 # Flattened Device Tree
 optionsFDT # Configure using FDT/DTB data
___
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: r346250 - in head: share/man/man4 share/man/man9 sys/dev/random sys/kern sys/libkern sys/sys

2019-04-16 Thread John Baldwin
On 4/15/19 11:40 AM, Conrad Meyer wrote:
> Author: cem
> Date: Mon Apr 15 18:40:36 2019
> New Revision: 346250
> URL: https://svnweb.freebsd.org/changeset/base/346250
> 
> Log:
>   random(4): Block read_random(9) on initial seeding
>   
>   read_random() is/was used, mostly without error checking, in a lot of
>   very sensitive places in the kernel -- including seeding the widely used
>   arc4random(9).
>   
>   Most uses, especially arc4random(9), should block until the device is seeded
>   rather than proceeding with a bogus or empty seed.  I did not spy any
>   obvious kernel consumers where blocking would be inappropriate (in the
>   sense that lack of entropy would be ok -- I did not investigate locking
>   angle thoroughly).  In many instances, arc4random_buf(9) or that family
>   of APIs would be more appropriate anyway; that work was done in r345865.

There are definitely places arc4random is used where sleeping is not allowed.
ipsec generating nonces for AES-CBC is one example I can think of off the
top of my head.  I think it might be useful to add an explicit WITNESS_WARN
in arc4random to catch these cases so they can be found and reasoned about.

>   This change primarily impacts the behavior of /dev/random on embedded
>   systems with read-only media that do not configure "nodevice random".  We
>   toggle the default from 'charge on blindly with no entropy' to 'block
>   indefinitely.'  This default is safer, but may cause frustration.  Embedded
>   system designers using FreeBSD have several options.  The most obvious is to
>   plan to have a small writable NVRAM or NAND to persist entropy, like larger
>   systems.  Early entropy can be fed from any loader, or by writing directly
>   to /dev/random during boot.  Some embedded SoCs now provide a fast hardware
>   entropy source; this would also work for quickly seeding Fortuna.  A 3rd
>   option would be creating an embedded-specific, more simplistic random
>   module, like that designed by DJB in [1] (this design still requires a small
>   rewritable media for forward secrecy).  Finally, the least preferred option
>   might be "nodevice random", although I plan to remove this in a subsequent
>   revision.

Note that I actually often run into unseeded systems when doing development
using qemu for non-x86 architectures.  For example, when booting mips from
qemu, there is no loader, the kernel just starts, and since the endian is
opposite, I frequently regenerate the filesystem using makefs.

-- 
John Baldwin
___
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: r341586 - head/sys/dev/mlx5/mlx5_en

2019-04-16 Thread John Baldwin
On 4/16/19 8:32 AM, Hans Petter Selasky wrote:
> On 4/16/19 4:39 PM, Andrey V. Elsukov wrote:
>> On 05.12.2018 17:25, Slava Shwartsman wrote:
>>> Author: slavash
>>> Date: Wed Dec  5 14:25:03 2018
>>> New Revision: 341586
>>> URL: https://svnweb.freebsd.org/changeset/base/341586
>>>
>>> Log:
>>>mlx5en: Implement backpressure indication.
>>>
>>>The backpressure indication is implemented using an unlimited rate type 
>>> of
>>>mbuf send tag. When the upper layers typically the socket layer has 
>>> obtained such
>>>a tag, it can then query the destination driver queue for the current
>>>amount of space available in the send queue.
>>>
>>>A single mbuf send tag may be referenced multiple times and a refcount 
>>> has been added
>>>to the mlx5e_priv structure to track its usage. Because the send tag 
>>> resides
>>>in the mlx5e_channel structure, there is no need to wait for refcounts 
>>> to reach
>>>zero until the mlx4en(4) driver is detached. The channels structure is 
>>> persistant
>>>during the lifetime of the mlx5en(4) driver it belongs to and can so be 
>>> accessed
>>>without any need of synchronization.
>>>
>>>The mlx5e_snd_tag structure was extended to contain a type field, 
>>> because there are now
>>>two different tag types which end up in the driver which need to be 
>>> distinguished.
>>>
>>>Submitted by:   hselasky@
>>>Approved by:hselasky (mentor)
>>>MFC after:  1 week
>>>Sponsored by:   Mellanox Technologies
>>> @@ -587,27 +609,33 @@ mlx5e_xmit(struct ifnet *ifp, struct mbuf *mb)
>>> struct mlx5e_sq *sq;
>>> int ret;
>>>   
>>> -   sq = mlx5e_select_queue(ifp, mb);
>>> -   if (unlikely(sq == NULL)) {
>>> -#ifdef RATELIMIT
>>> -   /* Check for route change */
>>> -   if (mb->m_pkthdr.snd_tag != NULL &&
>>> -   mb->m_pkthdr.snd_tag->ifp != ifp) {
>>> +   if (mb->m_pkthdr.snd_tag != NULL) {
>>> +   sq = mlx5e_select_queue_by_send_tag(ifp, mb);
>>> +   if (unlikely(sq == NULL)) {
>>> +   /* Check for route change */
>>> +   if (mb->m_pkthdr.snd_tag->ifp != ifp) {
>>> +   /* Free mbuf */
>>> +   m_freem(mb);
>>> +
>>> +   /*
>>> +* Tell upper layers about route
>>> +* change and to re-transmit this
>>> +* packet:
>>> +*/
>>> +   return (EAGAIN);
>>> +   }
>>
>> Hi,
>>
>> I just discovered something strange and found that this commit is the
>> cause.
>> The test system has mlx5en 100G interface. It has two vlans: vlan500 and
>> vlan100.
>> Via vlan500 it receives some packets flows. Then it routes these packets
>> into vlan100.
>> But packets are dropped in mlx5e_xmit() with EAGAIN error code.
>>
>> # dtrace -n 'fbt::ip6_output:return {printf("%d", arg1);}'
>> dtrace: description 'fbt::ip6_output:return ' matched 1 probe
>> CPU IDFUNCTION:NAME
>>   23  54338ip6_output:return 35
>>   16  54338ip6_output:return 35
>>   21  54338ip6_output:return 35
>>   22  54338ip6_output:return 35
>>   24  54338ip6_output:return 35
>>   23  54338ip6_output:return 35
>>   14  54338ip6_output:return 35
>> ^C
>>
>> # dtrace -n 'fbt::mlx5e_xmit:return {printf("%d", arg1);}'
>> dtrace: description 'fbt::mlx5e_xmit:return ' matched 1 probe
>> CPU IDFUNCTION:NAME
>>   16  69030mlx5e_xmit:return 35
>>   23  69030mlx5e_xmit:return 35
>>   26  69030mlx5e_xmit:return 35
>>   25  69030mlx5e_xmit:return 35
>>   24  69030mlx5e_xmit:return 35
>>   21  69030mlx5e_xmit:return 35
>>   26  69030mlx5e_xmit:return 35
>> ^C
>>
>> The kernel config is GENERIC.
>> 13.0-CURRENT #9 r345758+82f3d57(svn_head)-dirty
>>
> 
> Hi,
> 
> This might be a case where rcvif in the mbuf's pktheader is not cleared 
> before the packet is fed back on the wire.
> 
> John Baldwin is working on the send tags implementation, to eliminate 
> the EAGAIN handling in the network drivers.

I will try to push this branch sooner then since it affects more than just
TLS.  Part of the change includes a new flag we can use to assert that we
aren't just getting a stale rcvif (though there are also now assertions in
ip_output that should catch this case I think).

-- 
John Baldwin
___
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: r346304 - stable/12/sys/conf

2019-04-16 Thread Kyle Evans
Author: kevans
Date: Tue Apr 16 21:09:57 2019
New Revision: 346304
URL: https://svnweb.freebsd.org/changeset/base/346304

Log:
  MFC r345519: DTS/DTSO makeoptions
  
  Allow kernel config to specify DTS/DTSO to build, and out-of-tree support
  
  This allows for directives such as
  
  makeoptions DTS+=/out/of/tree/myboard.dts
  # in tree! Same rules applied as if this were in a dtb/ module
  makeoptions DTS+=otherboard.dts
  
  to be specified in config(5) and have these built/installed alongside th
  kernel. The assumption that overlays live in an overlays/ directory is only
  made for in-tree DTSO, but we still make the assumption that out-of-tree
  arm64 DTS will be in vendored directories (for now).
  
  This lowers the cost to hacking on an overlay or dts by being able to
  quickly throw it in a custom config, especially if it doesn't fit one of the
  current dtb/modules quite appropriately or it's not intended for commit
  there.
  
  The build/install targets were split out of dtb.mk to centralize the build
  logic and leave out the all/realinstall/CLEANFILES additions... it was
  believed that we didn't want to pollute the kernel build with these.
  
  The build rules were converted to suffix rules at the suggestion of Ian to
  clean things up a little bit in a world where we can have mixed
  in-tree/out-of-tree DTS/DTSO specified.

Added:
  stable/12/sys/conf/dtb.build.mk
 - copied unchanged from r345519, head/sys/conf/dtb.build.mk
Modified:
  stable/12/sys/conf/dtb.mk
  stable/12/sys/conf/kern.post.mk
Directory Properties:
  stable/12/   (props changed)

Copied: stable/12/sys/conf/dtb.build.mk (from r345519, 
head/sys/conf/dtb.build.mk)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/12/sys/conf/dtb.build.mk Tue Apr 16 21:09:57 2019
(r346304, copy of r345519, head/sys/conf/dtb.build.mk)
@@ -0,0 +1,77 @@
+# $FreeBSD$
+
+.include 
+# Grab all the options for a kernel build. For backwards compat, we need to
+# do this after bsd.own.mk.
+.include "kern.opts.mk"
+
+DTC?=  dtc
+
+.if !defined(SYSDIR)
+.if defined(S)
+SYSDIR=${S}
+.else
+# Search for kernel source tree in standard places.
+.for _dir in ${.CURDIR}/../.. ${.CURDIR}/../../.. /sys /usr/src/sys
+.if exists(${_dir}/kern/)
+SYSDIR=${_dir:tA}
+.endif
+.endfor
+.endif # defined(S)
+.endif # defined(SYSDIR)
+
+.if !defined(SYSDIR) || !exists(${SYSDIR}/kern/)
+.error "can't find kernel source tree"
+.endif
+
+DTB=${DTS:T:R:S/$/.dtb/}
+DTBO=${DTSO:T:R:S/$/.dtbo/}
+
+.SUFFIXES: .dtb .dts .dtbo .dtso
+.PATH.dts: ${SYSDIR}/gnu/dts/${MACHINE} ${SYSDIR}/dts/${MACHINE}
+.PATH.dtso: ${SYSDIR}/dts/${MACHINE}/overlays
+
+.export DTC ECHO
+
+.dts.dtb:  ${OP_META}
+   @${ECHO} Generating ${.TARGET} from ${.IMPSRC}
+   @${SYSDIR}/tools/fdt/make_dtb.sh ${SYSDIR} ${.IMPSRC} ${.OBJDIR}
+
+.dtso.dtbo:${OP_META}
+   @${ECHO} Generating ${.TARGET} from ${.IMPSRC}
+   @${SYSDIR}/tools/fdt/make_dtbo.sh ${SYSDIR} ${.IMPSRC} ${.OBJDIR}
+
+# Add dependencies on the source file so that out-of-tree things can be 
included
+# without any .PATH additions.
+.for _dts in ${DTS}
+${_dts:R:T}.dtb: ${_dts}
+.endfor
+
+.for _dtso in ${DTSO}
+${_dtso:R:T}.dtbo: ${_dtso}
+.endfor
+
+_dtbinstall:
+# Need to create this because installkernel doesn't invoke mtree with 
BSD.root.mtree
+# to make sure the tree is setup properly. We don't recreate it to avoid 
duplicate
+# entries in the NO_ROOT case.
+   test -d ${DESTDIR}${DTBDIR} || ${INSTALL} -d -o ${DTBOWN} -g ${DTBGRP} 
${DESTDIR}${DTBDIR}
+.for _dtb in ${DTB}
+.if ${MACHINE_CPUARCH} == "aarch64"
+   # :H:T here to grab the vendor component of the DTB path in a way that
+   # allows out-of-tree DTS builds, too.  We make the assumption that
+   # out-of-tree DTS will have a similar directory structure to in-tree,
+   # with .dts files appearing in a vendor/ directory.
+   test -d ${DESTDIR}${DTBDIR}/${_dtb:H:T} || ${INSTALL} -d -o ${DTBOWN} 
-g ${DTBGRP} ${DESTDIR}${DTBDIR}/${_dtb:H:T}
+   ${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \
+   ${_INSTALLFLAGS} ${_dtb:T} ${DESTDIR}${DTBDIR}/${_dtb:H:T}
+.else
+   ${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \
+   ${_INSTALLFLAGS} ${_dtb} ${DESTDIR}${DTBDIR}/
+.endif
+.endfor
+   test -d ${DESTDIR}${DTBODIR} || ${INSTALL} -d -o ${DTBOWN} -g ${DTBGRP} 
${DESTDIR}${DTBODIR}
+.for _dtbo in ${DTBO}
+   ${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \
+   ${_INSTALLFLAGS} ${_dtbo} ${DESTDIR}${DTBODIR}/
+.endfor

Modified: stable/12/sys/conf/dtb.mk
==
--- stable/12/sys/conf/dtb.mk   Tue Apr 16 21:02:41 2019(r346303)
+++ stable/12/sys/conf/dtb.mk   Tue Apr 16 21:09:57 2019(r346304)
@@ -8,6 +8,8 @@
 #
 # DTS  List of the dts files to build and 

svn commit: r346303 - in stable: 11/sys/net 12/sys/net

2019-04-16 Thread Kyle Evans
Author: kevans
Date: Tue Apr 16 21:02:41 2019
New Revision: 346303
URL: https://svnweb.freebsd.org/changeset/base/346303

Log:
  MFC r345192-r345194: if_bridge(4): Drop pointless rtflush
  
  r345192:
  if_bridge(4): Drop pointless rtflush
  
  At this point, all routes should've already been dropped by removing all
  members from the bridge. This condition is in-fact KASSERT'd in the line
  immediately above where this nop flush was added.
  
  r345193:
  Revert r345192: Too many trees in play for bridge(4) bits
  
  An accidental appendage was committed that has not undergone review yet.
  
  r345194:
  if_bridge(4): Drop pointless rtflush
  
  At this point, all routes should've already been dropped by removing all
  members from the bridge. This condition is in-fact KASSERT'd in the line
  immediately above where this nop flush was added.

Modified:
  stable/11/sys/net/if_bridge.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/sys/net/if_bridge.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/sys/net/if_bridge.c
==
--- stable/11/sys/net/if_bridge.c   Tue Apr 16 21:01:07 2019
(r346302)
+++ stable/11/sys/net/if_bridge.c   Tue Apr 16 21:02:41 2019
(r346303)
@@ -2885,7 +2885,6 @@ bridge_rtable_fini(struct bridge_softc *sc)
 
KASSERT(sc->sc_brtcnt == 0,
("%s: %d bridge routes referenced", __func__, sc->sc_brtcnt));
-   bridge_rtflush(sc, 1);
free(sc->sc_rthash, M_DEVBUF);
 }
 
___
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: r346303 - in stable: 11/sys/net 12/sys/net

2019-04-16 Thread Kyle Evans
Author: kevans
Date: Tue Apr 16 21:02:41 2019
New Revision: 346303
URL: https://svnweb.freebsd.org/changeset/base/346303

Log:
  MFC r345192-r345194: if_bridge(4): Drop pointless rtflush
  
  r345192:
  if_bridge(4): Drop pointless rtflush
  
  At this point, all routes should've already been dropped by removing all
  members from the bridge. This condition is in-fact KASSERT'd in the line
  immediately above where this nop flush was added.
  
  r345193:
  Revert r345192: Too many trees in play for bridge(4) bits
  
  An accidental appendage was committed that has not undergone review yet.
  
  r345194:
  if_bridge(4): Drop pointless rtflush
  
  At this point, all routes should've already been dropped by removing all
  members from the bridge. This condition is in-fact KASSERT'd in the line
  immediately above where this nop flush was added.

Modified:
  stable/12/sys/net/if_bridge.c
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/net/if_bridge.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/sys/net/if_bridge.c
==
--- stable/12/sys/net/if_bridge.c   Tue Apr 16 21:01:07 2019
(r346302)
+++ stable/12/sys/net/if_bridge.c   Tue Apr 16 21:02:41 2019
(r346303)
@@ -2892,7 +2892,6 @@ bridge_rtable_fini(struct bridge_softc *sc)
 
KASSERT(sc->sc_brtcnt == 0,
("%s: %d bridge routes referenced", __func__, sc->sc_brtcnt));
-   bridge_rtflush(sc, 1);
free(sc->sc_rthash, M_DEVBUF);
 }
 
___
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: r346302 - in stable: 11/stand/efi/fdt 11/stand/fdt 11/stand/powerpc/kboot 11/stand/powerpc/ofw 11/stand/uboot/fdt 12/stand/efi/fdt 12/stand/fdt 12/stand/powerpc/kboot 12/stand/powerpc/o...

2019-04-16 Thread Kyle Evans
Author: kevans
Date: Tue Apr 16 21:01:07 2019
New Revision: 346302
URL: https://svnweb.freebsd.org/changeset/base/346302

Log:
  MFC r346132: stand: refactor overlay loading a little bit
  
  It was pointed out that manually loading a .dtb to be used rather than
  relying on platform-specific method for loading .dtb will result in overlays
  not being applied. This was true because overlay loading was hacked into
  fdt_platform_load_dtb, rather than done in a way more independent from how
  the .dtb is loaded.
  
  Instead, push overlay loading (for now) out into an
  fdt_platform_load_overlays. This method easily allows ubldr to pull in any
  fdt_overlays specified in the ub env, and omits overlay-checking on
  platforms where they're not tested and/or not desired (e.g. powerpc). If we
  eventually stop caring about fdt_overlays from ubenv (if we ever cared),
  this method should get chopped out in favor of just calling
  fdt_load_dtb_overlays() directly.

Modified:
  stable/12/stand/efi/fdt/efi_fdt.c
  stable/12/stand/fdt/fdt_loader_cmd.c
  stable/12/stand/fdt/fdt_platform.h
  stable/12/stand/powerpc/kboot/kbootfdt.c
  stable/12/stand/powerpc/ofw/ofwfdt.c
  stable/12/stand/uboot/fdt/uboot_fdt.c
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/stand/efi/fdt/efi_fdt.c
  stable/11/stand/fdt/fdt_loader_cmd.c
  stable/11/stand/fdt/fdt_platform.h
  stable/11/stand/powerpc/kboot/kbootfdt.c
  stable/11/stand/powerpc/ofw/ofwfdt.c
  stable/11/stand/uboot/fdt/uboot_fdt.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/stand/efi/fdt/efi_fdt.c
==
--- stable/12/stand/efi/fdt/efi_fdt.c   Tue Apr 16 20:59:57 2019
(r346301)
+++ stable/12/stand/efi/fdt/efi_fdt.c   Tue Apr 16 21:01:07 2019
(r346302)
@@ -52,8 +52,14 @@ fdt_platform_load_dtb(void)
return (1);
printf("Using DTB provided by EFI at %p.\n", hdr);
 
-   fdt_load_dtb_overlays(NULL);
return (0);
+}
+
+void
+fdt_platform_load_overlays(void)
+{
+
+   fdt_load_dtb_overlays(NULL);
 }
 
 void

Modified: stable/12/stand/fdt/fdt_loader_cmd.c
==
--- stable/12/stand/fdt/fdt_loader_cmd.cTue Apr 16 20:59:57 2019
(r346301)
+++ stable/12/stand/fdt/fdt_loader_cmd.cTue Apr 16 21:01:07 2019
(r346302)
@@ -522,6 +522,7 @@ fdt_setup_fdtp()
if (fdt_load_dtb(bfp->f_addr) == 0) {
printf("Using DTB from loaded file '%s'.\n", 
bfp->f_name);
+   fdt_platform_load_overlays();
return (0);
}
}
@@ -531,12 +532,15 @@ fdt_setup_fdtp()
if (fdt_load_dtb_addr(fdt_to_load) == 0) {
printf("Using DTB from memory address %p.\n",
fdt_to_load);
+   fdt_platform_load_overlays();
return (0);
}
}
 
-   if (fdt_platform_load_dtb() == 0)
+   if (fdt_platform_load_dtb() == 0) {
+   fdt_platform_load_overlays();
return (0);
+   }
 
/* If there is a dtb compiled into the kernel, use it. */
if ((va = fdt_find_static_dtb()) != 0) {

Modified: stable/12/stand/fdt/fdt_platform.h
==
--- stable/12/stand/fdt/fdt_platform.h  Tue Apr 16 20:59:57 2019
(r346301)
+++ stable/12/stand/fdt/fdt_platform.h  Tue Apr 16 21:01:07 2019
(r346302)
@@ -51,6 +51,7 @@ int fdt_setup_fdtp(void);
 
 /* The platform library needs to implement these functions */
 int fdt_platform_load_dtb(void);
+void fdt_platform_load_overlays(void);
 void fdt_platform_fixups(void);
 
 #endif /* FDT_PLATFORM_H */

Modified: stable/12/stand/powerpc/kboot/kbootfdt.c
==
--- stable/12/stand/powerpc/kboot/kbootfdt.cTue Apr 16 20:59:57 2019
(r346301)
+++ stable/12/stand/powerpc/kboot/kbootfdt.cTue Apr 16 21:01:07 2019
(r346302)
@@ -177,6 +177,12 @@ fdt_platform_load_dtb(void)
 }
 
 void
+fdt_platform_load_overlays(void)
+{
+
+}
+
+void
 fdt_platform_fixups(void)
 {
 

Modified: stable/12/stand/powerpc/ofw/ofwfdt.c
==
--- stable/12/stand/powerpc/ofw/ofwfdt.cTue Apr 16 20:59:57 2019
(r346301)
+++ stable/12/stand/powerpc/ofw/ofwfdt.cTue Apr 16 21:01:07 2019
(r346302)
@@ -198,6 +198,12 @@ fdt_platform_load_dtb(void)
 }
 
 void
+fdt_platform_load_overlays(void)
+{
+
+}
+
+void
 fdt_platform_fixups(void)
 {
 

Modified: stable/12/stand/uboot/fdt/uboot_fdt.c

svn commit: r346302 - in stable: 11/stand/efi/fdt 11/stand/fdt 11/stand/powerpc/kboot 11/stand/powerpc/ofw 11/stand/uboot/fdt 12/stand/efi/fdt 12/stand/fdt 12/stand/powerpc/kboot 12/stand/powerpc/o...

2019-04-16 Thread Kyle Evans
Author: kevans
Date: Tue Apr 16 21:01:07 2019
New Revision: 346302
URL: https://svnweb.freebsd.org/changeset/base/346302

Log:
  MFC r346132: stand: refactor overlay loading a little bit
  
  It was pointed out that manually loading a .dtb to be used rather than
  relying on platform-specific method for loading .dtb will result in overlays
  not being applied. This was true because overlay loading was hacked into
  fdt_platform_load_dtb, rather than done in a way more independent from how
  the .dtb is loaded.
  
  Instead, push overlay loading (for now) out into an
  fdt_platform_load_overlays. This method easily allows ubldr to pull in any
  fdt_overlays specified in the ub env, and omits overlay-checking on
  platforms where they're not tested and/or not desired (e.g. powerpc). If we
  eventually stop caring about fdt_overlays from ubenv (if we ever cared),
  this method should get chopped out in favor of just calling
  fdt_load_dtb_overlays() directly.

Modified:
  stable/11/stand/efi/fdt/efi_fdt.c
  stable/11/stand/fdt/fdt_loader_cmd.c
  stable/11/stand/fdt/fdt_platform.h
  stable/11/stand/powerpc/kboot/kbootfdt.c
  stable/11/stand/powerpc/ofw/ofwfdt.c
  stable/11/stand/uboot/fdt/uboot_fdt.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/stand/efi/fdt/efi_fdt.c
  stable/12/stand/fdt/fdt_loader_cmd.c
  stable/12/stand/fdt/fdt_platform.h
  stable/12/stand/powerpc/kboot/kbootfdt.c
  stable/12/stand/powerpc/ofw/ofwfdt.c
  stable/12/stand/uboot/fdt/uboot_fdt.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/stand/efi/fdt/efi_fdt.c
==
--- stable/11/stand/efi/fdt/efi_fdt.c   Tue Apr 16 20:59:57 2019
(r346301)
+++ stable/11/stand/efi/fdt/efi_fdt.c   Tue Apr 16 21:01:07 2019
(r346302)
@@ -52,8 +52,14 @@ fdt_platform_load_dtb(void)
return (1);
printf("Using DTB provided by EFI at %p.\n", hdr);
 
-   fdt_load_dtb_overlays(NULL);
return (0);
+}
+
+void
+fdt_platform_load_overlays(void)
+{
+
+   fdt_load_dtb_overlays(NULL);
 }
 
 void

Modified: stable/11/stand/fdt/fdt_loader_cmd.c
==
--- stable/11/stand/fdt/fdt_loader_cmd.cTue Apr 16 20:59:57 2019
(r346301)
+++ stable/11/stand/fdt/fdt_loader_cmd.cTue Apr 16 21:01:07 2019
(r346302)
@@ -522,6 +522,7 @@ fdt_setup_fdtp()
if (fdt_load_dtb(bfp->f_addr) == 0) {
printf("Using DTB from loaded file '%s'.\n", 
bfp->f_name);
+   fdt_platform_load_overlays();
return (0);
}
}
@@ -531,12 +532,15 @@ fdt_setup_fdtp()
if (fdt_load_dtb_addr(fdt_to_load) == 0) {
printf("Using DTB from memory address %p.\n",
fdt_to_load);
+   fdt_platform_load_overlays();
return (0);
}
}
 
-   if (fdt_platform_load_dtb() == 0)
+   if (fdt_platform_load_dtb() == 0) {
+   fdt_platform_load_overlays();
return (0);
+   }
 
/* If there is a dtb compiled into the kernel, use it. */
if ((va = fdt_find_static_dtb()) != 0) {

Modified: stable/11/stand/fdt/fdt_platform.h
==
--- stable/11/stand/fdt/fdt_platform.h  Tue Apr 16 20:59:57 2019
(r346301)
+++ stable/11/stand/fdt/fdt_platform.h  Tue Apr 16 21:01:07 2019
(r346302)
@@ -51,6 +51,7 @@ int fdt_setup_fdtp(void);
 
 /* The platform library needs to implement these functions */
 int fdt_platform_load_dtb(void);
+void fdt_platform_load_overlays(void);
 void fdt_platform_fixups(void);
 
 #endif /* FDT_PLATFORM_H */

Modified: stable/11/stand/powerpc/kboot/kbootfdt.c
==
--- stable/11/stand/powerpc/kboot/kbootfdt.cTue Apr 16 20:59:57 2019
(r346301)
+++ stable/11/stand/powerpc/kboot/kbootfdt.cTue Apr 16 21:01:07 2019
(r346302)
@@ -177,6 +177,12 @@ fdt_platform_load_dtb(void)
 }
 
 void
+fdt_platform_load_overlays(void)
+{
+
+}
+
+void
 fdt_platform_fixups(void)
 {
 

Modified: stable/11/stand/powerpc/ofw/ofwfdt.c
==
--- stable/11/stand/powerpc/ofw/ofwfdt.cTue Apr 16 20:59:57 2019
(r346301)
+++ stable/11/stand/powerpc/ofw/ofwfdt.cTue Apr 16 21:01:07 2019
(r346302)
@@ -198,6 +198,12 @@ fdt_platform_load_dtb(void)
 }
 
 void
+fdt_platform_load_overlays(void)
+{
+
+}
+
+void
 fdt_platform_fixups(void)
 {
 

Modified: stable/11/stand/uboot/fdt/uboot_fdt.c

svn commit: r346301 - stable/12/lib/libbe

2019-04-16 Thread Kyle Evans
Author: kevans
Date: Tue Apr 16 20:59:57 2019
New Revision: 346301
URL: https://svnweb.freebsd.org/changeset/base/346301

Log:
  MFC r346082: libbe(3): use libzfs name validation for datasets/snapshot names
  
  Our home-rolled solution didn't quite capture all of the details, and we
  didn't actually validate snapshot names at all. zfs_name_valid captures the
  important details, but it doesn't necessarily expose the errors that we're
  wanting to see in the be_validate_* functions. Validating lengths
  independently, then the names, should make this a non-issue.

Modified:
  stable/12/lib/libbe/be.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libbe/be.c
==
--- stable/12/lib/libbe/be.cTue Apr 16 20:56:51 2019(r346300)
+++ stable/12/lib/libbe/be.cTue Apr 16 20:59:57 2019(r346301)
@@ -593,6 +593,9 @@ be_validate_snap(libbe_handle_t *lbh, const char *snap
if (strlen(snap_name) >= BE_MAXPATHLEN)
return (BE_ERR_PATHLEN);
 
+   if (!zfs_name_valid(snap_name, ZFS_TYPE_SNAPSHOT))
+   return (BE_ERR_INVALIDNAME);
+
if (!zfs_dataset_exists(lbh->lzh, snap_name,
ZFS_TYPE_SNAPSHOT))
return (BE_ERR_NOENT);
@@ -646,12 +649,6 @@ be_root_concat(libbe_handle_t *lbh, const char *name, 
 int
 be_validate_name(libbe_handle_t *lbh, const char *name)
 {
-   for (int i = 0; *name; i++) {
-   char c = *(name++);
-   if (isalnum(c) || (c == '-') || (c == '_') || (c == '.'))
-   continue;
-   return (BE_ERR_INVALIDNAME);
-   }
 
/*
 * Impose the additional restriction that the entire dataset name must
@@ -659,6 +656,10 @@ be_validate_name(libbe_handle_t *lbh, const char *name
 */
if (strlen(lbh->root) + 1 + strlen(name) > MAXNAMELEN)
return (BE_ERR_PATHLEN);
+
+   if (!zfs_name_valid(name, ZFS_TYPE_DATASET))
+   return (BE_ERR_INVALIDNAME);
+
return (BE_ERR_SUCCESS);
 }
 
___
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: r346300 - in stable: 11/sys/net 12/sys/net

2019-04-16 Thread Kyle Evans
Author: kevans
Date: Tue Apr 16 20:56:51 2019
New Revision: 346300
URL: https://svnweb.freebsd.org/changeset/base/346300

Log:
  MFC r345180, r345187: if_bridge(4): Fix module teardown
  
  r345180: if_bridge(4): Fix module teardown
  
  bridge_rtnode_zone still has outstanding allocations at the time of
  destruction in the current model because all of the interface teardown
  happens in a VNET_SYSUNINIT, -after- the MOD_UNLOAD has already been
  processed.  The SYSUNINIT triggers destruction of the interfaces, which then
  attempts to free the memory from the zone that's already been destroyed, and
  we hit a panic.
  
  Solve this by virtualizing the uma_zone we allocate the rtnodes from to fix
  the ordering. bridge_rtable_fini should also take care to flush any
  remaining routes that weren't taken care of when dynamic routes were flushed
  in bridge_stop.
  
  r345187: bridge: Fix STP-related panic
  
  After r345180 we need to have the appropriate vnet context set to delete an
  rtnode in bridge_rtnode_destroy().
  That's usually the case, but not when it's called by the STP code (through
  bstp_notify_rtage()).
  
  We have to set the vnet context in bridge_rtable_expire() just as we do in the
  other STP callback bridge_state_change().

Modified:
  stable/12/sys/net/if_bridge.c
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/net/if_bridge.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/sys/net/if_bridge.c
==
--- stable/12/sys/net/if_bridge.c   Tue Apr 16 20:41:04 2019
(r346299)
+++ stable/12/sys/net/if_bridge.c   Tue Apr 16 20:56:51 2019
(r346300)
@@ -235,7 +235,8 @@ static eventhandler_tag bridge_detach_cookie;
 
 intbridge_rtable_prune_period = BRIDGE_RTABLE_PRUNE_PERIOD;
 
-uma_zone_t bridge_rtnode_zone;
+VNET_DEFINE_STATIC(uma_zone_t, bridge_rtnode_zone);
+#defineV_bridge_rtnode_zoneVNET(bridge_rtnode_zone)
 
 static int bridge_clone_create(struct if_clone *, int, caddr_t);
 static voidbridge_clone_destroy(struct ifnet *);
@@ -527,6 +528,9 @@ static void
 vnet_bridge_init(const void *unused __unused)
 {
 
+   V_bridge_rtnode_zone = uma_zcreate("bridge_rtnode",
+   sizeof(struct bridge_rtnode), NULL, NULL, NULL, NULL,
+   UMA_ALIGN_PTR, 0);
BRIDGE_LIST_LOCK_INIT();
LIST_INIT(_bridge_list);
V_bridge_cloner = if_clone_simple(bridge_name,
@@ -542,6 +546,7 @@ vnet_bridge_uninit(const void *unused __unused)
if_clone_detach(V_bridge_cloner);
V_bridge_cloner = NULL;
BRIDGE_LIST_LOCK_DESTROY();
+   uma_zdestroy(V_bridge_rtnode_zone);
 }
 VNET_SYSUNINIT(vnet_bridge_uninit, SI_SUB_PSEUDO, SI_ORDER_ANY,
 vnet_bridge_uninit, NULL);
@@ -552,9 +557,6 @@ bridge_modevent(module_t mod, int type, void *data)
 
switch (type) {
case MOD_LOAD:
-   bridge_rtnode_zone = uma_zcreate("bridge_rtnode",
-   sizeof(struct bridge_rtnode), NULL, NULL, NULL, NULL,
-   UMA_ALIGN_PTR, 0);
bridge_dn_p = bridge_dummynet;
bridge_detach_cookie = EVENTHANDLER_REGISTER(
ifnet_departure_event, bridge_ifdetach, NULL,
@@ -563,7 +565,6 @@ bridge_modevent(module_t mod, int type, void *data)
case MOD_UNLOAD:
EVENTHANDLER_DEREGISTER(ifnet_departure_event,
bridge_detach_cookie);
-   uma_zdestroy(bridge_rtnode_zone);
bridge_dn_p = NULL;
break;
default:
@@ -732,6 +733,9 @@ bridge_clone_destroy(struct ifnet *ifp)
bridge_delete_span(sc, bif);
}
 
+   /* Tear down the routing table. */
+   bridge_rtable_fini(sc);
+
BRIDGE_UNLOCK(sc);
 
callout_drain(>sc_brcallout);
@@ -744,9 +748,6 @@ bridge_clone_destroy(struct ifnet *ifp)
ether_ifdetach(ifp);
if_free(ifp);
 
-   /* Tear down the routing table. */
-   bridge_rtable_fini(sc);
-
BRIDGE_LOCK_DESTROY(sc);
free(sc, M_DEVBUF);
 }
@@ -2671,7 +2672,7 @@ bridge_rtupdate(struct bridge_softc *sc, const uint8_t
 * initialize the expiration time and Ethernet
 * address.
 */
-   brt = uma_zalloc(bridge_rtnode_zone, M_NOWAIT | M_ZERO);
+   brt = uma_zalloc(V_bridge_rtnode_zone, M_NOWAIT | M_ZERO);
if (brt == NULL)
return (ENOMEM);
 
@@ -2684,7 +2685,7 @@ bridge_rtupdate(struct bridge_softc *sc, const uint8_t
brt->brt_vlan = vlan;
 
if ((error = bridge_rtnode_insert(sc, brt)) != 0) {
-   uma_zfree(bridge_rtnode_zone, brt);
+   uma_zfree(V_bridge_rtnode_zone, brt);
return (error);
}

svn commit: r346300 - in stable: 11/sys/net 12/sys/net

2019-04-16 Thread Kyle Evans
Author: kevans
Date: Tue Apr 16 20:56:51 2019
New Revision: 346300
URL: https://svnweb.freebsd.org/changeset/base/346300

Log:
  MFC r345180, r345187: if_bridge(4): Fix module teardown
  
  r345180: if_bridge(4): Fix module teardown
  
  bridge_rtnode_zone still has outstanding allocations at the time of
  destruction in the current model because all of the interface teardown
  happens in a VNET_SYSUNINIT, -after- the MOD_UNLOAD has already been
  processed.  The SYSUNINIT triggers destruction of the interfaces, which then
  attempts to free the memory from the zone that's already been destroyed, and
  we hit a panic.
  
  Solve this by virtualizing the uma_zone we allocate the rtnodes from to fix
  the ordering. bridge_rtable_fini should also take care to flush any
  remaining routes that weren't taken care of when dynamic routes were flushed
  in bridge_stop.
  
  r345187: bridge: Fix STP-related panic
  
  After r345180 we need to have the appropriate vnet context set to delete an
  rtnode in bridge_rtnode_destroy().
  That's usually the case, but not when it's called by the STP code (through
  bstp_notify_rtage()).
  
  We have to set the vnet context in bridge_rtable_expire() just as we do in the
  other STP callback bridge_state_change().

Modified:
  stable/11/sys/net/if_bridge.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/sys/net/if_bridge.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/sys/net/if_bridge.c
==
--- stable/11/sys/net/if_bridge.c   Tue Apr 16 20:41:04 2019
(r346299)
+++ stable/11/sys/net/if_bridge.c   Tue Apr 16 20:56:51 2019
(r346300)
@@ -233,7 +233,8 @@ static eventhandler_tag bridge_detach_cookie;
 
 intbridge_rtable_prune_period = BRIDGE_RTABLE_PRUNE_PERIOD;
 
-uma_zone_t bridge_rtnode_zone;
+static VNET_DEFINE(uma_zone_t, bridge_rtnode_zone);
+#defineV_bridge_rtnode_zoneVNET(bridge_rtnode_zone)
 
 static int bridge_clone_create(struct if_clone *, int, caddr_t);
 static voidbridge_clone_destroy(struct ifnet *);
@@ -526,6 +527,9 @@ static void
 vnet_bridge_init(const void *unused __unused)
 {
 
+   V_bridge_rtnode_zone = uma_zcreate("bridge_rtnode",
+   sizeof(struct bridge_rtnode), NULL, NULL, NULL, NULL,
+   UMA_ALIGN_PTR, 0);
BRIDGE_LIST_LOCK_INIT();
LIST_INIT(_bridge_list);
V_bridge_cloner = if_clone_simple(bridge_name,
@@ -541,6 +545,7 @@ vnet_bridge_uninit(const void *unused __unused)
if_clone_detach(V_bridge_cloner);
V_bridge_cloner = NULL;
BRIDGE_LIST_LOCK_DESTROY();
+   uma_zdestroy(V_bridge_rtnode_zone);
 }
 VNET_SYSUNINIT(vnet_bridge_uninit, SI_SUB_PSEUDO, SI_ORDER_ANY,
 vnet_bridge_uninit, NULL);
@@ -551,9 +556,6 @@ bridge_modevent(module_t mod, int type, void *data)
 
switch (type) {
case MOD_LOAD:
-   bridge_rtnode_zone = uma_zcreate("bridge_rtnode",
-   sizeof(struct bridge_rtnode), NULL, NULL, NULL, NULL,
-   UMA_ALIGN_PTR, 0);
bridge_input_p = bridge_input;
bridge_output_p = bridge_output;
bridge_dn_p = bridge_dummynet;
@@ -565,7 +567,6 @@ bridge_modevent(module_t mod, int type, void *data)
case MOD_UNLOAD:
EVENTHANDLER_DEREGISTER(ifnet_departure_event,
bridge_detach_cookie);
-   uma_zdestroy(bridge_rtnode_zone);
bridge_input_p = NULL;
bridge_output_p = NULL;
bridge_dn_p = NULL;
@@ -737,6 +738,9 @@ bridge_clone_destroy(struct ifnet *ifp)
bridge_delete_span(sc, bif);
}
 
+   /* Tear down the routing table. */
+   bridge_rtable_fini(sc);
+
BRIDGE_UNLOCK(sc);
 
callout_drain(>sc_brcallout);
@@ -749,9 +753,6 @@ bridge_clone_destroy(struct ifnet *ifp)
ether_ifdetach(ifp);
if_free(ifp);
 
-   /* Tear down the routing table. */
-   bridge_rtable_fini(sc);
-
BRIDGE_LOCK_DESTROY(sc);
free(sc, M_DEVBUF);
 }
@@ -2664,7 +2665,7 @@ bridge_rtupdate(struct bridge_softc *sc, const uint8_t
 * initialize the expiration time and Ethernet
 * address.
 */
-   brt = uma_zalloc(bridge_rtnode_zone, M_NOWAIT | M_ZERO);
+   brt = uma_zalloc(V_bridge_rtnode_zone, M_NOWAIT | M_ZERO);
if (brt == NULL)
return (ENOMEM);
 
@@ -2677,7 +2678,7 @@ bridge_rtupdate(struct bridge_softc *sc, const uint8_t
brt->brt_vlan = vlan;
 
if ((error = bridge_rtnode_insert(sc, brt)) != 0) {
-   uma_zfree(bridge_rtnode_zone, brt);
+   uma_zfree(V_bridge_rtnode_zone, brt);
return (error);
}

svn commit: r346299 - head/share/man/man9

2019-04-16 Thread Ed Maste
Author: emaste
Date: Tue Apr 16 20:41:04 2019
New Revision: 346299
URL: https://svnweb.freebsd.org/changeset/base/346299

Log:
  iflibtxrx.9: update function descriptions to match implementation
  
  isc_rxd_refill, isc_rxd_flush return nothing, not void *.
  
  isc_txd_credits_update, isc_rxd_available return int, not int *.
  
  isc_txd_credits_update has a bool as final argument, not a uint32_t.
  Prior to r315217 it took four arguments; the final two were
  uint32_t, bool.
  
  Reported by:  Gerald Aryeetey 
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/share/man/man9/iflibtxrx.9

Modified: head/share/man/man9/iflibtxrx.9
==
--- head/share/man/man9/iflibtxrx.9 Tue Apr 16 20:08:19 2019
(r346298)
+++ head/share/man/man9/iflibtxrx.9 Tue Apr 16 20:41:04 2019
(r346299)
@@ -1,5 +1,5 @@
 .\" $FreeBSD$
-.Dd March 23, 2017
+.Dd April 16, 2019
 .Dt IFLIBTXTX 9
 .Os
 .Sh NAME
@@ -19,19 +19,19 @@
 .Fa "uint16_t qid"
 .Fa "uint32_t _pidx_or_credits_"
 .Fc
-.Ft int *
+.Ft int
 .Fo isc_txd_credits_update
 .Fa "void *sc"
 .Fa "uint16_t qid"
-.Fa "uint32_t credits"
+.Fa "bool clear"
 .Fc
-.Ft int *
+.Ft int
 .Fo isc_rxd_available
 .Fa "void *sc"
 .Fa "uint16_t qsid"
 .Fa "uint32_t cidx"
 .Fc
-.Ft void *
+.Ft void
 .Fo isc_rxd_refill
 .Fa "void *sc"
 .Fa "uint16_t qsid"
@@ -41,7 +41,7 @@
 .Fa "caddr_t *vaddrs"
 .Fa "uint16_t count"
 .Fc
-.Ft void *
+.Ft void
 .Fo isc_rxd_flush
 .Fa "void *sc"
 .Fa "uint16_t qsid"
___
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: r346298 - head/usr.sbin/config

2019-04-16 Thread Emmanuel Vadot
Author: manu
Date: Tue Apr 16 20:08:19 2019
New Revision: 346298
URL: https://svnweb.freebsd.org/changeset/base/346298

Log:
  config: Only warn if duplicate option/device comes from the same file
  
  This is useful for arm (possibly other arches too) where we want to have
  a GENERIC kernel that only include files for the different SoC. Since
  multiple SoCs/Board needs the same device we would need to do either :
  
  Include the device in a generic file
  Include the device in each file that really needs it
  
  Option 1 works but if someone wants to create a specific kernel config
  (which isn't uncommon for embedded system), he will need to add a lots
  of nodevice to it.
  
  Option 2 also works but produce a lots of warnings.
  
  Reviewed by:  kevans
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D19424

Modified:
  head/usr.sbin/config/config.h
  head/usr.sbin/config/config.y

Modified: head/usr.sbin/config/config.h
==
--- head/usr.sbin/config/config.h   Tue Apr 16 20:06:39 2019
(r346297)
+++ head/usr.sbin/config/config.h   Tue Apr 16 20:08:19 2019
(r346298)
@@ -86,6 +86,7 @@ struct files_name {
 struct device {
int d_done; /* processed */
char*d_name;/* name of device (e.g. rk11) */
+   char*yyfile;/* name of the file that first include 
the device */
 #defineUNKNOWN -2  /* -2 means not set yet */
STAILQ_ENTRY(device) d_next;/* Next one in list */
 };
@@ -125,6 +126,7 @@ struct opt {
char*op_name;
char*op_value;
int op_ownfile; /* true = own file, false = makefile */
+   char*yyfile;/* name of the file that first include the 
option */
SLIST_ENTRY(opt) op_next;
SLIST_ENTRY(opt) op_append;
 };

Modified: head/usr.sbin/config/config.y
==
--- head/usr.sbin/config/config.y   Tue Apr 16 20:06:39 2019
(r346297)
+++ head/usr.sbin/config/config.y   Tue Apr 16 20:08:19 2019
(r346298)
@@ -382,11 +382,13 @@ finddev(struct device_head *dlist, char *name)
 static void
 newdev(char *name)
 {
-   struct device *np;
+   struct device *np, *dp;
 
-   if (finddev(, name)) {
-   fprintf(stderr,
-   "WARNING: duplicate device `%s' encountered.\n", name);
+   if ((dp = finddev(, name)) != NULL) {
+   if (strcmp(dp->yyfile, yyfile) == 0)
+   fprintf(stderr,
+   "WARNING: duplicate device `%s' encountered in 
%s\n",
+   name, yyfile);
return;
}
 
@@ -394,6 +396,7 @@ newdev(char *name)
if (np == NULL)
err(EXIT_FAILURE, "calloc");
np->d_name = name;
+   np->yyfile = strdup(yyfile);
STAILQ_INSERT_TAIL(, np, d_next);
 }
 
@@ -408,6 +411,7 @@ rmdev_schedule(struct device_head *dh, char *name)
dp = finddev(dh, name);
if (dp != NULL) {
STAILQ_REMOVE(dh, dp, device, d_next);
+   free(dp->yyfile);
free(dp->d_name);
free(dp);
}
@@ -446,8 +450,9 @@ newopt(struct opt_head *list, char *name, char *value,
 
op2 = findopt(list, name);
if (op2 != NULL && !append && !dupe) {
-   fprintf(stderr,
-   "WARNING: duplicate option `%s' encountered.\n", name);
+   if (strcmp(op2->yyfile, yyfile) == 0)
+   fprintf(stderr,
+   "WARNING: duplicate option `%s' encountered.\n", 
name);
return;
}
 
@@ -457,6 +462,7 @@ newopt(struct opt_head *list, char *name, char *value,
op->op_name = name;
op->op_ownfile = 0;
op->op_value = value;
+   op->yyfile = strdup(yyfile);
if (op2 != NULL) {
if (append) {
while (SLIST_NEXT(op2, op_append) != NULL)
@@ -481,6 +487,7 @@ rmopt_schedule(struct opt_head *list, char *name)
 
while ((op = findopt(list, name)) != NULL) {
SLIST_REMOVE(list, op, opt, op_next);
+   free(op->yyfile);
free(op->op_name);
free(op);
}
___
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: r346297 - head/sys/conf

2019-04-16 Thread Emmanuel Vadot
Author: manu
Date: Tue Apr 16 20:06:39 2019
New Revision: 346297
URL: https://svnweb.freebsd.org/changeset/base/346297

Log:
  arm: Order files.arm to have cloudabi and annapurna sections
  
  MFC after:2 weeks

Modified:
  head/sys/conf/files.arm

Modified: head/sys/conf/files.arm
==
--- head/sys/conf/files.arm Tue Apr 16 20:05:24 2019(r346296)
+++ head/sys/conf/files.arm Tue Apr 16 20:06:39 2019(r346297)
@@ -1,26 +1,7 @@
 # $FreeBSD$
-cloudabi32_vdso.o  optionalcompat_cloudabi32   \
-   dependency  "$S/contrib/cloudabi/cloudabi_vdso_armv6.S" \
-   compile-with"${CC} -x assembler-with-cpp -shared -nostdinc 
-nostdlib -Wl,-T$S/compat/cloudabi/cloudabi_vdso.lds 
$S/contrib/cloudabi/cloudabi_vdso_armv6.S -o ${.TARGET}" \
-   no-obj no-implicit-rule \
-   clean   "cloudabi32_vdso.o"
-#
-cloudabi32_vdso_blob.o optionalcompat_cloudabi32   \
-   dependency  "cloudabi32_vdso.o" \
-   compile-with"${OBJCOPY} --input-target binary --output-target 
elf32-littlearm --binary-architecture arm cloudabi32_vdso.o ${.TARGET}" \
-   no-implicit-rule\
-   clean   "cloudabi32_vdso_blob.o"
-#
 
 kern/kern_clocksource.cstandard
 
-arm/annapurna/alpine/alpine_ccu.c  optional al_ccu fdt
-arm/annapurna/alpine/alpine_nb_service.c   optional al_nb_service fdt
-arm/annapurna/alpine/alpine_pci.c  optional al_pci fdt
-arm/annapurna/alpine/alpine_pci_msix.c optional al_pci fdt
-arm/annapurna/alpine/alpine_serdes.c   optional al_serdes fdt  
\
-   no-depend   \
-   compile-with "${CC} -c -o ${.TARGET} ${CFLAGS} -I$S/contrib/alpine-hal 
-I$S/contrib/alpine-hal/eth ${PROF} ${.IMPSRC}"
 arm/arm/autoconf.c standard
 arm/arm/bcopy_page.S   standard
 arm/arm/bcopyinout.S   standard
@@ -171,3 +152,25 @@ libkern/ucmpdi2.c  standard
 libkern/udivdi3.c  standard
 libkern/umoddi3.c  standard
 
+# CloudABI support
+cloudabi32_vdso.o  optionalcompat_cloudabi32   \
+   dependency  "$S/contrib/cloudabi/cloudabi_vdso_armv6.S" \
+   compile-with"${CC} -x assembler-with-cpp -shared -nostdinc 
-nostdlib -Wl,-T$S/compat/cloudabi/cloudabi_vdso.lds 
$S/contrib/cloudabi/cloudabi_vdso_armv6.S -o ${.TARGET}" \
+   no-obj no-implicit-rule \
+   clean   "cloudabi32_vdso.o"
+#
+cloudabi32_vdso_blob.o optionalcompat_cloudabi32   \
+   dependency  "cloudabi32_vdso.o" \
+   compile-with"${OBJCOPY} --input-target binary --output-target 
elf32-littlearm --binary-architecture arm cloudabi32_vdso.o ${.TARGET}" \
+   no-implicit-rule\
+   clean   "cloudabi32_vdso_blob.o"
+#
+
+# Annapurna support
+arm/annapurna/alpine/alpine_ccu.c  optional al_ccu fdt
+arm/annapurna/alpine/alpine_nb_service.c   optional al_nb_service fdt
+arm/annapurna/alpine/alpine_pci.c  optional al_pci fdt
+arm/annapurna/alpine/alpine_pci_msix.c optional al_pci fdt
+arm/annapurna/alpine/alpine_serdes.c   optional al_serdes fdt  
\
+   no-depend   \
+   compile-with "${CC} -c -o ${.TARGET} ${CFLAGS} -I$S/contrib/alpine-hal 
-I$S/contrib/alpine-hal/eth ${PROF} ${.IMPSRC}"
___
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: r346295 - in head/sys: arm/allwinner arm/altera/socfpga arm/amlogic/aml8726 arm/annapurna/alpine arm/broadcom/bcm2835 arm/freescale/imx arm/freescale/vybrid arm/mv arm/nvidia/tegra124 a...

2019-04-16 Thread Emmanuel Vadot
Author: manu
Date: Tue Apr 16 20:04:22 2019
New Revision: 346295
URL: https://svnweb.freebsd.org/changeset/base/346295

Log:
  arm: Add kern_clocksource.c directly in files.arm
  
  This files is needed and included in all our config so move it to a common
  location.
  
  MFC after:2 weeks

Modified:
  head/sys/arm/allwinner/files.allwinner
  head/sys/arm/altera/socfpga/files.socfpga
  head/sys/arm/amlogic/aml8726/files.aml8726
  head/sys/arm/annapurna/alpine/files.alpine
  head/sys/arm/broadcom/bcm2835/files.bcm283x
  head/sys/arm/freescale/imx/files.imx5
  head/sys/arm/freescale/imx/files.imx6
  head/sys/arm/freescale/vybrid/files.vybrid
  head/sys/arm/mv/files.arm7
  head/sys/arm/mv/files.mv
  head/sys/arm/nvidia/tegra124/files.tegra124
  head/sys/arm/qemu/files.qemu
  head/sys/arm/ralink/files.ralink
  head/sys/arm/rockchip/files.rk30xx
  head/sys/arm/samsung/exynos/files.exynos5
  head/sys/arm/ti/files.ti
  head/sys/arm/versatile/files.versatile
  head/sys/arm/xilinx/files.zynq7
  head/sys/conf/files.arm

Modified: head/sys/arm/allwinner/files.allwinner
==
--- head/sys/arm/allwinner/files.allwinner  Tue Apr 16 19:46:02 2019
(r346294)
+++ head/sys/arm/allwinner/files.allwinner  Tue Apr 16 20:04:22 2019
(r346295)
@@ -1,5 +1,4 @@
 # $FreeBSD$
-kern/kern_clocksource.cstandard
 
 arm/allwinner/a10_ahci.c   optionalahci
 arm/allwinner/a10_codec.c  optionalsound

Modified: head/sys/arm/altera/socfpga/files.socfpga
==
--- head/sys/arm/altera/socfpga/files.socfpga   Tue Apr 16 19:46:02 2019
(r346294)
+++ head/sys/arm/altera/socfpga/files.socfpga   Tue Apr 16 20:04:22 2019
(r346295)
@@ -1,7 +1,5 @@
 # $FreeBSD$
 
-kern/kern_clocksource.cstandard
-
 arm/altera/socfpga/socfpga_common.cstandard
 arm/altera/socfpga/socfpga_machdep.c   standard
 arm/altera/socfpga/socfpga_manager.c   standard

Modified: head/sys/arm/amlogic/aml8726/files.aml8726
==
--- head/sys/arm/amlogic/aml8726/files.aml8726  Tue Apr 16 19:46:02 2019
(r346294)
+++ head/sys/arm/amlogic/aml8726/files.aml8726  Tue Apr 16 20:04:22 2019
(r346295)
@@ -1,7 +1,5 @@
 #$FreeBSD$
 
-kern/kern_clocksource.cstandard
-
 arm/amlogic/aml8726/aml8726_l2cache.c  standard
 
 arm/amlogic/aml8726/aml8726_machdep.c  standard

Modified: head/sys/arm/annapurna/alpine/files.alpine
==
--- head/sys/arm/annapurna/alpine/files.alpine  Tue Apr 16 19:46:02 2019
(r346294)
+++ head/sys/arm/annapurna/alpine/files.alpine  Tue Apr 16 20:04:22 2019
(r346295)
@@ -1,7 +1,5 @@
 # $FreeBSD$
 
-kern/kern_clocksource.cstandard
-
 arm/versatile/sp804.c  standard
 dev/uart/uart_dev_ns8250.c optionaluart
 

Modified: head/sys/arm/broadcom/bcm2835/files.bcm283x
==
--- head/sys/arm/broadcom/bcm2835/files.bcm283x Tue Apr 16 19:46:02 2019
(r346294)
+++ head/sys/arm/broadcom/bcm2835/files.bcm283x Tue Apr 16 20:04:22 2019
(r346295)
@@ -18,8 +18,6 @@ arm/broadcom/bcm2835/bcm2835_vcio.c   standard
 arm/broadcom/bcm2835/bcm2835_wdog.cstandard
 arm/broadcom/bcm2835/bcm283x_dwc_fdt.c optional dwcotg fdt
 
-kern/kern_clocksource.c standard
-
 dev/mbox/mbox_if.m standard
 
 arm/broadcom/bcm2835/bcm2835_audio.c   optional sound vchiq \

Modified: head/sys/arm/freescale/imx/files.imx5
==
--- head/sys/arm/freescale/imx/files.imx5   Tue Apr 16 19:46:02 2019
(r346294)
+++ head/sys/arm/freescale/imx/files.imx5   Tue Apr 16 20:04:22 2019
(r346295)
@@ -1,5 +1,4 @@
 # $FreeBSD$
-kern/kern_clocksource.cstandard
 
 # Init
 arm/freescale/imx/imx_common.c standard

Modified: head/sys/arm/freescale/imx/files.imx6
==
--- head/sys/arm/freescale/imx/files.imx6   Tue Apr 16 19:46:02 2019
(r346294)
+++ head/sys/arm/freescale/imx/files.imx6   Tue Apr 16 20:04:22 2019
(r346295)
@@ -1,11 +1,6 @@
 # $FreeBSD$
 
 #
-# Standard ARM support.
-#
-kern/kern_clocksource.cstandard
-
-#
 # Standard imx6 devices and support.
 #
 arm/freescale/fsl_ocotp.c  standard

Modified: head/sys/arm/freescale/vybrid/files.vybrid

svn commit: r346294 - in head/sys: amd64/amd64 i386/i386

2019-04-16 Thread Konstantin Belousov
Author: kib
Date: Tue Apr 16 19:46:02 2019
New Revision: 346294
URL: https://svnweb.freebsd.org/changeset/base/346294

Log:
  Fix initial x87 state after r345562.
  
  After the referenced commit, we did not set x87 and sse valid bits in
  the xstate_bv bitmask for initial fpu state (stored in memory), when
  using XSAVE.
  
  The state is loaded into FPU register file to initialize the process
  FPU state, and since both bits were clear, the default x87 and SSE
  states were loaded.  By chance, FreeBSD ABI SSE2 state is same as FPU
  initial state, so the bug is not visible for 64bit processes.  But on
  i386, the precision control should be set to double (53bit mantissa),
  instead of the default double extended (64bit mantissa). For 32bit
  processes on amd64, kernel reloads control word with the right mask,
  which only left native i386 and amd64 native but using x87 as
  affected.
  
  Fix it by setting minimal required xstate_bv mask.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/amd64/amd64/fpu.c
  head/sys/i386/i386/npx.c

Modified: head/sys/amd64/amd64/fpu.c
==
--- head/sys/amd64/amd64/fpu.c  Tue Apr 16 19:38:16 2019(r346293)
+++ head/sys/amd64/amd64/fpu.c  Tue Apr 16 19:46:02 2019(r346294)
@@ -370,6 +370,7 @@ fpuinit(void)
 static void
 fpuinitstate(void *arg __unused)
 {
+   uint64_t *xstate_bv;
register_t saveintr;
int cp[4], i, max_ext_n;
 
@@ -400,6 +401,10 @@ fpuinitstate(void *arg __unused)
 * Save Area.
 */
if (use_xsave) {
+   xstate_bv = (uint64_t *)((char *)(fpu_initialstate + 1) +
+   offsetof(struct xstate_hdr, xstate_bv));
+   *xstate_bv = XFEATURE_ENABLED_X87 | XFEATURE_ENABLED_SSE;
+
max_ext_n = flsl(xsave_mask);
xsave_area_desc = malloc(max_ext_n * sizeof(struct
xsave_area_elm_descr), M_DEVBUF, M_WAITOK | M_ZERO);

Modified: head/sys/i386/i386/npx.c
==
--- head/sys/i386/i386/npx.cTue Apr 16 19:38:16 2019(r346293)
+++ head/sys/i386/i386/npx.cTue Apr 16 19:46:02 2019(r346294)
@@ -472,6 +472,7 @@ npxinit(bool bsp)
 static void
 npxinitstate(void *arg __unused)
 {
+   uint64_t *xstate_bv;
register_t saveintr;
int cp[4], i, max_ext_n;
 
@@ -507,6 +508,7 @@ npxinitstate(void *arg __unused)
sizeof(npx_initialstate->sv_xmm.sv_fp));
bzero(npx_initialstate->sv_xmm.sv_xmm,
sizeof(npx_initialstate->sv_xmm.sv_xmm));
+
} else
bzero(npx_initialstate->sv_87.sv_ac,
sizeof(npx_initialstate->sv_87.sv_ac));
@@ -516,6 +518,10 @@ npxinitstate(void *arg __unused)
 * Save Area.
 */
if (use_xsave) {
+   xstate_bv = (uint64_t *)((char *)(npx_initialstate + 1) +
+   offsetof(struct xstate_hdr, xstate_bv));
+   *xstate_bv = XFEATURE_ENABLED_X87 | XFEATURE_ENABLED_SSE;
+
if (xsave_mask >> 32 != 0)
max_ext_n = fls(xsave_mask >> 32) + 32;
else
___
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: r346293 - in head/sys/arm/allwinner: . clk

2019-04-16 Thread Emmanuel Vadot
Author: manu
Date: Tue Apr 16 19:38:16 2019
New Revision: 346293
URL: https://svnweb.freebsd.org/changeset/base/346293

Log:
  allwinner: clk: Garbage collect old clock implementation
  
  The old clocks are disconneted from the build since r337344.
  Remove all those pseudo drivers. The only one remaining is for gmac
  (the ethernet controller) so move it to sys/arm/allwinner.
  While here remove a83t support from gmacclk as it is unneeded since r326114.
  
  MFC after:1 month

Added:
  head/sys/arm/allwinner/aw_gmacclk.c
 - copied, changed from r346292, head/sys/arm/allwinner/clk/aw_gmacclk.c
Deleted:
  head/sys/arm/allwinner/clk/
Modified:
  head/sys/arm/allwinner/aw_ccu.c
  head/sys/arm/allwinner/files.allwinner

Modified: head/sys/arm/allwinner/aw_ccu.c
==
--- head/sys/arm/allwinner/aw_ccu.c Tue Apr 16 18:47:20 2019
(r346292)
+++ head/sys/arm/allwinner/aw_ccu.c Tue Apr 16 19:38:16 2019
(r346293)
@@ -53,38 +53,18 @@ __FBSDID("$FreeBSD$");
 #defineCCU_BASE0x01c2
 #defineCCU_SIZE0x400
 
-#definePRCM_BASE   0x01f01400
-#definePRCM_SIZE   0x200
-
-#defineSYSCTRL_BASE0x01c0
-#defineSYSCTRL_SIZE0x34
-
 struct aw_ccu_softc {
struct simplebus_softc  sc;
bus_space_tag_t bst;
-   bus_space_handle_t  ccu_bsh;
-   bus_space_handle_t  prcm_bsh;
-   bus_space_handle_t  sysctrl_bsh;
+   bus_space_handle_t  bsh;
struct mtx  mtx;
int flags;
 };
 
-#defineCLOCK_CCU   (1 << 0)
-#defineCLOCK_PRCM  (1 << 1)
-#defineCLOCK_SYSCTRL   (1 << 2)
-
 static struct ofw_compat_data compat_data[] = {
-   { "allwinner,sun4i-a10",CLOCK_CCU },
-   { "allwinner,sun5i-a13",CLOCK_CCU },
-   { "allwinner,sun7i-a20",CLOCK_CCU },
-   { "allwinner,sun6i-a31",CLOCK_CCU },
-   { "allwinner,sun6i-a31s",   CLOCK_CCU },
-   { "allwinner,sun50i-a64",   CLOCK_CCU },
-   { "allwinner,sun50i-h5",CLOCK_CCU },
-   { "allwinner,sun8i-a33",CLOCK_CCU },
-   { "allwinner,sun8i-a83t",   CLOCK_CCU|CLOCK_PRCM|CLOCK_SYSCTRL },
-   { "allwinner,sun8i-h2-plus",CLOCK_CCU|CLOCK_PRCM },
-   { "allwinner,sun8i-h3", CLOCK_CCU|CLOCK_PRCM },
+   { "allwinner,sun7i-a20",1 },
+   { "allwinner,sun6i-a31",1 },
+   { "allwinner,sun6i-a31s",   1 },
{ NULL, 0 }
 };
 
@@ -92,24 +72,11 @@ static int
 aw_ccu_check_addr(struct aw_ccu_softc *sc, bus_addr_t addr,
 bus_space_handle_t *pbsh, bus_size_t *poff)
 {
-   if (addr >= CCU_BASE && addr < (CCU_BASE + CCU_SIZE) &&
-   (sc->flags & CLOCK_CCU) != 0) {
+   if (addr >= CCU_BASE && addr < (CCU_BASE + CCU_SIZE)) {
*poff = addr - CCU_BASE;
-   *pbsh = sc->ccu_bsh;
+   *pbsh = sc->bsh;
return (0);
}
-   if (addr >= PRCM_BASE && addr < (PRCM_BASE + PRCM_SIZE) &&
-   (sc->flags & CLOCK_PRCM) != 0) {
-   *poff = addr - PRCM_BASE;
-   *pbsh = sc->prcm_bsh;
-   return (0);
-   }
-   if (addr >= SYSCTRL_BASE && addr < (SYSCTRL_BASE + SYSCTRL_SIZE) &&
-   (sc->flags & CLOCK_SYSCTRL) != 0) {
-   *poff = addr - SYSCTRL_BASE;
-   *pbsh = sc->sysctrl_bsh;
-   return (0);
-   }
return (EINVAL);
 }
 
@@ -241,29 +208,11 @@ aw_ccu_attach(device_t dev)
 * properties.
 */
sc->bst = bus_get_bus_tag(dev);
-   if (sc->flags & CLOCK_CCU) {
-   error = bus_space_map(sc->bst, CCU_BASE, CCU_SIZE, 0,
-   >ccu_bsh);
-   if (error != 0) {
-   device_printf(dev, "couldn't map CCU: %d\n", error);
-   return (error);
-   }
-   }
-   if (sc->flags & CLOCK_PRCM) {
-   error = bus_space_map(sc->bst, PRCM_BASE, PRCM_SIZE, 0,
-   >prcm_bsh);
-   if (error != 0) {
-   device_printf(dev, "couldn't map PRCM: %d\n", error);
-   return (error);
-   }
-   }
-   if (sc->flags & CLOCK_SYSCTRL) {
-   error = bus_space_map(sc->bst, SYSCTRL_BASE, SYSCTRL_SIZE, 0,
-   >sysctrl_bsh);
-   if (error != 0) {
-   device_printf(dev, "couldn't map SYSCTRL: %d\n", error);
-   return (error);
-   }
+   error = bus_space_map(sc->bst, CCU_BASE, CCU_SIZE, 0,
+   >bsh);
+   if (error != 0) {
+   device_printf(dev, "couldn't map CCU: %d\n", error);
+   return (error);
}
 
mtx_init(>mtx, device_get_nameunit(dev), NULL, MTX_DEF);

Copied and modified: 

svn commit: r346292 - in head: . sys/kern

2019-04-16 Thread Conrad Meyer
Author: cem
Date: Tue Apr 16 18:47:20 2019
New Revision: 346292
URL: https://svnweb.freebsd.org/changeset/base/346292

Log:
  stack_protector: Add tunable to bypass random cookies
  
  This is a stopgap measure to unbreak installer/VM/embedded boot issues
  introduced (or at least exposed by) in r346250.
  
  Add the new tunable, "security.stack_protect.permit_nonrandom_cookies," in
  order to continue boot with insecure non-random stack cookies if the random
  device is unavailable.
  
  For now, enable it by default.  This is NOT safe.  It will be disabled by
  default in a future revision.
  
  There is follow-on work planned to use fast random sources (e.g., RDRAND on
  x86 and DARN on Power) to seed when the early entropy file cannot be
  provided, for whatever reason.  Please see D19928.
  
  Some better hacks may be used to make the non-random __stack_chk_guard
  slightly less predictable (from delphij@ and mjg@); those suggestions are
  left for a future revision.  I think it may also be plausible to move stack
  guard initialization far later in the boot process; potentially it could be
  moved all the way to just before userspace is started.
  
  Reported by:  many
  Reviewed by:  delphij, emaste, imp (all w/ caveat: this is a stopgap fix)
  Security: yes
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D19927

Modified:
  head/UPDATING
  head/sys/kern/stack_protector.c

Modified: head/UPDATING
==
--- head/UPDATING   Tue Apr 16 18:32:07 2019(r346291)
+++ head/UPDATING   Tue Apr 16 18:47:20 2019(r346292)
@@ -32,6 +32,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW:
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
 
 20190416:
+   The tunable "security.stack_protect.permit_nonrandom_cookies" may be
+   set to a non-zero value to boot systems that do not provide early
+   entropy.  Otherwise, such systems may see the panic message:
+   "cannot initialize stack cookies because random device is not yet
+   seeded."
+
+20190416:
The loadable random module KPI has changed; the random_infra_init()
routine now requires a 3rd function pointer for a bool (*)(void)
method that returns true if the random device is seeded (and

Modified: head/sys/kern/stack_protector.c
==
--- head/sys/kern/stack_protector.c Tue Apr 16 18:32:07 2019
(r346291)
+++ head/sys/kern/stack_protector.c Tue Apr 16 18:47:20 2019
(r346292)
@@ -4,12 +4,28 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 
 long __stack_chk_guard[8] = {};
 void __stack_chk_fail(void);
 
+/*
+ * XXX This default is unsafe!!!  We intend to change it after resolving issues
+ * with early entropy in the installer; some kinds of systems that do not use
+ * loader(8), such as riscv, aarch64, and power; and perhaps others that I am
+ * forgetting off the top of my head.
+ */
+static bool permit_nonrandom_cookies = true;
+
+SYSCTL_NODE(_security, OID_AUTO, stack_protect, CTLFLAG_RW, 0,
+"-fstack-protect support");
+SYSCTL_BOOL(_security_stack_protect, OID_AUTO, permit_nonrandom_cookies,
+CTLFLAG_RDTUN, _nonrandom_cookies, 0,
+"Allow stack guard to be used without real random cookies");
+
 void
 __stack_chk_fail(void)
 {
@@ -23,8 +39,37 @@ __stack_chk_init(void *dummy __unused)
size_t i;
long guard[nitems(__stack_chk_guard)];
 
-   arc4rand(guard, sizeof(guard), 0);
-   for (i = 0; i < nitems(guard); i++)
-   __stack_chk_guard[i] = guard[i];
+   if (is_random_seeded()) {
+   arc4rand(guard, sizeof(guard), 0);
+   for (i = 0; i < nitems(guard); i++)
+   __stack_chk_guard[i] = guard[i];
+   return;
+   }
+
+   if (permit_nonrandom_cookies) {
+   printf("%s: WARNING: Initializing stack protection with "
+   "non-random cookies!\n", __func__);
+   printf("%s: WARNING: This severely limits the benefit of "
+   "-fstack-protector!\n", __func__);
+
+   /*
+* The emperor is naked, but I rolled some dice and at least
+* these values aren't zero.
+*/
+   __stack_chk_guard[0] = (long)0xe7318d5959af899full;
+   __stack_chk_guard[1] = (long)0x35a9481c089348bfull;
+   __stack_chk_guard[2] = (long)0xde657fdc04117255ull;
+   __stack_chk_guard[3] = (long)0x0dd44c61c22e4a6bull;
+   __stack_chk_guard[4] = (long)0x0a5869a354edb0a5ull;
+   __stack_chk_guard[5] = (long)0x05cebfed255b5232ull;
+   __

svn commit: r346291 - stable/11/sys/cam

2019-04-16 Thread Alexander Motin
Author: mav
Date: Tue Apr 16 18:32:07 2019
New Revision: 346291
URL: https://svnweb.freebsd.org/changeset/base/346291

Log:
  MFC r345805: Unify SCSI_STATUS_BUSY retry handling with other cases.
  
   - Do not retry if periph was invalidated.
   - Do not decrement retry_count if already zero.
   - Report action_string when applicable.

Modified:
  stable/11/sys/cam/cam_periph.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/cam_periph.c
==
--- stable/11/sys/cam/cam_periph.c  Tue Apr 16 18:31:40 2019
(r346290)
+++ stable/11/sys/cam/cam_periph.c  Tue Apr 16 18:32:07 2019
(r346291)
@@ -1383,6 +1383,7 @@ camperiphscsistatuserror(union ccb *ccb, union ccb **o
 int *openings, u_int32_t *relsim_flags,
 u_int32_t *timeout, u_int32_t *action, const char **action_string)
 {
+   struct cam_periph *periph;
int error;
 
switch (ccb->csio.scsi_status) {
@@ -1465,14 +1466,21 @@ camperiphscsistatuserror(union ccb *ccb, union ccb **o
 * Restart the queue after either another
 * command completes or a 1 second timeout.
 */
-   if ((sense_flags & SF_RETRY_BUSY) != 0 ||
-   (ccb->ccb_h.retry_count--) > 0) {
+   periph = xpt_path_periph(ccb->ccb_h.path);
+   if (periph->flags & CAM_PERIPH_INVALID) {
+   error = EIO;
+   *action_string = "Periph was invalidated";
+   } else if ((sense_flags & SF_RETRY_BUSY) != 0 ||
+   ccb->ccb_h.retry_count > 0) {
+   if ((sense_flags & SF_RETRY_BUSY) == 0)
+   ccb->ccb_h.retry_count--;
error = ERESTART;
*relsim_flags = RELSIM_RELEASE_AFTER_TIMEOUT
  | RELSIM_RELEASE_AFTER_CMDCMPLT;
*timeout = 1000;
} else {
error = EIO;
+   *action_string = "Retries exhausted";
}
break;
case SCSI_STATUS_RESERV_CONFLICT:
___
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: r346290 - stable/12/sys/cam

2019-04-16 Thread Alexander Motin
Author: mav
Date: Tue Apr 16 18:31:40 2019
New Revision: 346290
URL: https://svnweb.freebsd.org/changeset/base/346290

Log:
  MFC r345805: Unify SCSI_STATUS_BUSY retry handling with other cases.
  
   - Do not retry if periph was invalidated.
   - Do not decrement retry_count if already zero.
   - Report action_string when applicable.

Modified:
  stable/12/sys/cam/cam_periph.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cam/cam_periph.c
==
--- stable/12/sys/cam/cam_periph.c  Tue Apr 16 17:56:53 2019
(r346289)
+++ stable/12/sys/cam/cam_periph.c  Tue Apr 16 18:31:40 2019
(r346290)
@@ -1448,6 +1448,7 @@ camperiphscsistatuserror(union ccb *ccb, union ccb **o
 int *openings, u_int32_t *relsim_flags,
 u_int32_t *timeout, u_int32_t *action, const char **action_string)
 {
+   struct cam_periph *periph;
int error;
 
switch (ccb->csio.scsi_status) {
@@ -1530,14 +1531,21 @@ camperiphscsistatuserror(union ccb *ccb, union ccb **o
 * Restart the queue after either another
 * command completes or a 1 second timeout.
 */
-   if ((sense_flags & SF_RETRY_BUSY) != 0 ||
-   (ccb->ccb_h.retry_count--) > 0) {
+   periph = xpt_path_periph(ccb->ccb_h.path);
+   if (periph->flags & CAM_PERIPH_INVALID) {
+   error = EIO;
+   *action_string = "Periph was invalidated";
+   } else if ((sense_flags & SF_RETRY_BUSY) != 0 ||
+   ccb->ccb_h.retry_count > 0) {
+   if ((sense_flags & SF_RETRY_BUSY) == 0)
+   ccb->ccb_h.retry_count--;
error = ERESTART;
*relsim_flags = RELSIM_RELEASE_AFTER_TIMEOUT
  | RELSIM_RELEASE_AFTER_CMDCMPLT;
*timeout = 1000;
} else {
error = EIO;
+   *action_string = "Retries exhausted";
}
break;
case SCSI_STATUS_RESERV_CONFLICT:
___
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: r346289 - stable/11/sys/fs/msdosfs

2019-04-16 Thread Konstantin Belousov
Author: kib
Date: Tue Apr 16 17:56:53 2019
New Revision: 346289
URL: https://svnweb.freebsd.org/changeset/base/346289

Log:
  MFC r346064:
  Fix dirty buf exhaustion easily triggered with msdosfs.

Modified:
  stable/11/sys/fs/msdosfs/msdosfs_fat.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/msdosfs/msdosfs_fat.c
==
--- stable/11/sys/fs/msdosfs/msdosfs_fat.c  Tue Apr 16 17:55:54 2019
(r346288)
+++ stable/11/sys/fs/msdosfs/msdosfs_fat.c  Tue Apr 16 17:56:53 2019
(r346289)
@@ -52,6 +52,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -977,6 +978,7 @@ extendfile(struct denode *dep, u_long count, struct bu
u_long cn, got;
struct msdosfsmount *pmp = dep->de_pmp;
struct buf *bp;
+   struct vop_fsync_args fsync_ap;
daddr_t blkno;
 
/*
@@ -1086,8 +1088,16 @@ extendfile(struct denode *dep, u_long count, struct bu
if (bpp) {
*bpp = bp;
bpp = NULL;
-   } else
+   } else {
bdwrite(bp);
+   }
+   if (vm_page_count_severe() ||
+   buf_dirty_count_severe()) {
+   fsync_ap.a_vp = DETOV(dep);
+   fsync_ap.a_waitfor = MNT_WAIT;
+   fsync_ap.a_td = curthread;
+   vop_stdfsync(_ap);
+   }
}
}
}
___
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: r346288 - in stable/12/sys: fs/fuse fs/msdosfs kern sys

2019-04-16 Thread Konstantin Belousov
Author: kib
Date: Tue Apr 16 17:55:54 2019
New Revision: 346288
URL: https://svnweb.freebsd.org/changeset/base/346288

Log:
  MFC r346065:
  Add vn_fsync_buf().

Modified:
  stable/12/sys/fs/fuse/fuse_io.c
  stable/12/sys/fs/msdosfs/msdosfs_fat.c
  stable/12/sys/kern/vfs_default.c
  stable/12/sys/kern/vfs_vnops.c
  stable/12/sys/sys/vnode.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/fs/fuse/fuse_io.c
==
--- stable/12/sys/fs/fuse/fuse_io.c Tue Apr 16 17:54:51 2019
(r346287)
+++ stable/12/sys/fs/fuse/fuse_io.c Tue Apr 16 17:55:54 2019
(r346288)
@@ -744,13 +744,8 @@ fuse_io_strategy(struct vnode *vp, struct buf *bp)
 int
 fuse_io_flushbuf(struct vnode *vp, int waitfor, struct thread *td)
 {
-   struct vop_fsync_args a = {
-   .a_vp = vp,
-   .a_waitfor = waitfor,
-   .a_td = td,
-   };
 
-   return (vop_stdfsync());
+   return (vn_fsync_buf(vp, waitfor));
 }
 
 /*

Modified: stable/12/sys/fs/msdosfs/msdosfs_fat.c
==
--- stable/12/sys/fs/msdosfs/msdosfs_fat.c  Tue Apr 16 17:54:51 2019
(r346287)
+++ stable/12/sys/fs/msdosfs/msdosfs_fat.c  Tue Apr 16 17:55:54 2019
(r346288)
@@ -980,7 +980,6 @@ extendfile(struct denode *dep, u_long count, struct bu
u_long cn, got;
struct msdosfsmount *pmp = dep->de_pmp;
struct buf *bp;
-   struct vop_fsync_args fsync_ap;
daddr_t blkno;
 
/*
@@ -1092,12 +1091,8 @@ extendfile(struct denode *dep, u_long count, struct bu
bdwrite(bp);
}
if (vm_page_count_severe() ||
-   buf_dirty_count_severe()) {
-   fsync_ap.a_vp = DETOV(dep);
-   fsync_ap.a_waitfor = MNT_WAIT;
-   fsync_ap.a_td = curthread;
-   vop_stdfsync(_ap);
-   }
+   buf_dirty_count_severe())
+   vn_fsync_buf(DETOV(dep), MNT_WAIT);
}
}
}

Modified: stable/12/sys/kern/vfs_default.c
==
--- stable/12/sys/kern/vfs_default.cTue Apr 16 17:54:51 2019
(r346287)
+++ stable/12/sys/kern/vfs_default.cTue Apr 16 17:55:54 2019
(r346288)
@@ -638,98 +638,8 @@ vop_stdfsync(ap)
struct thread *a_td;
} */ *ap;
 {
-   struct vnode *vp;
-   struct buf *bp, *nbp;
-   struct bufobj *bo;
-   struct mount *mp;
-   int error, maxretry;
 
-   error = 0;
-   maxretry = 1; /* large, arbitrarily chosen */
-   vp = ap->a_vp;
-   mp = NULL;
-   if (vp->v_type == VCHR) {
-   VI_LOCK(vp);
-   mp = vp->v_rdev->si_mountpt;
-   VI_UNLOCK(vp);
-   }
-   bo = >v_bufobj;
-   BO_LOCK(bo);
-loop1:
-   /*
-* MARK/SCAN initialization to avoid infinite loops.
-*/
-TAILQ_FOREACH(bp, >bo_dirty.bv_hd, b_bobufs) {
-bp->b_vflags &= ~BV_SCANNED;
-   bp->b_error = 0;
-   }
-
-   /*
-* Flush all dirty buffers associated with a vnode.
-*/
-loop2:
-   TAILQ_FOREACH_SAFE(bp, >bo_dirty.bv_hd, b_bobufs, nbp) {
-   if ((bp->b_vflags & BV_SCANNED) != 0)
-   continue;
-   bp->b_vflags |= BV_SCANNED;
-   if (BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWAIT, NULL)) {
-   if (ap->a_waitfor != MNT_WAIT)
-   continue;
-   if (BUF_LOCK(bp,
-   LK_EXCLUSIVE | LK_INTERLOCK | LK_SLEEPFAIL,
-   BO_LOCKPTR(bo)) != 0) {
-   BO_LOCK(bo);
-   goto loop1;
-   }
-   BO_LOCK(bo);
-   }
-   BO_UNLOCK(bo);
-   KASSERT(bp->b_bufobj == bo,
-   ("bp %p wrong b_bufobj %p should be %p",
-   bp, bp->b_bufobj, bo));
-   if ((bp->b_flags & B_DELWRI) == 0)
-   panic("fsync: not dirty");
-   if ((vp->v_object != NULL) && (bp->b_flags & B_CLUSTEROK)) {
-   vfs_bio_awrite(bp);
-   } else {
-   bremfree(bp);
-   bawrite(bp);
-   }
-   if (maxretry < 1000)
-   pause("dirty", hz < 1000 ? 1 : hz / 1000);
-   BO_LOCK(bo);
-   goto loop2;
-   }
-
-   /*
-* If 

svn commit: r346287 - stable/12/sys/fs/msdosfs

2019-04-16 Thread Konstantin Belousov
Author: kib
Date: Tue Apr 16 17:54:51 2019
New Revision: 346287
URL: https://svnweb.freebsd.org/changeset/base/346287

Log:
  MFC r346064:
  Fix dirty buf exhaustion easily triggered with msdosfs.

Modified:
  stable/12/sys/fs/msdosfs/msdosfs_fat.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/fs/msdosfs/msdosfs_fat.c
==
--- stable/12/sys/fs/msdosfs/msdosfs_fat.c  Tue Apr 16 17:43:14 2019
(r346286)
+++ stable/12/sys/fs/msdosfs/msdosfs_fat.c  Tue Apr 16 17:54:51 2019
(r346287)
@@ -54,6 +54,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -979,6 +980,7 @@ extendfile(struct denode *dep, u_long count, struct bu
u_long cn, got;
struct msdosfsmount *pmp = dep->de_pmp;
struct buf *bp;
+   struct vop_fsync_args fsync_ap;
daddr_t blkno;
 
/*
@@ -1086,8 +1088,16 @@ extendfile(struct denode *dep, u_long count, struct bu
if (bpp) {
*bpp = bp;
bpp = NULL;
-   } else
+   } else {
bdwrite(bp);
+   }
+   if (vm_page_count_severe() ||
+   buf_dirty_count_severe()) {
+   fsync_ap.a_vp = DETOV(dep);
+   fsync_ap.a_waitfor = MNT_WAIT;
+   fsync_ap.a_td = curthread;
+   vop_stdfsync(_ap);
+   }
}
}
}
___
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: r346250 - in head: share/man/man4 share/man/man9 sys/dev/random sys/kern sys/libkern sys/sys

2019-04-16 Thread Ian Lepore
On Tue, 2019-04-16 at 09:58 -0700, Conrad Meyer wrote:
> Systems lacking both an NV store and an entropy source available
> during mi_startup (i.e., not interrupts...) cannot safely provide
> entropy in early boot.  On those systems, we must disable random
> consumption during early boot.

Or you could remember that one of the core unix philosphies is "tools,
not policy" and leave it to embedded systems developers to decide for
themselves what's "safe" or not.  Not every application needs
cryptographic strength entropy, especially for things like retrying
after a short random delay or generating a random MAC address or
whatever.

-- 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: r346286 - stable/11/sys/fs/tmpfs

2019-04-16 Thread Konstantin Belousov
Author: kib
Date: Tue Apr 16 17:43:14 2019
New Revision: 346286
URL: https://svnweb.freebsd.org/changeset/base/346286

Log:
  MFC r345425, r345514, r345799, r345800, r345803, r346157:
  Enable tmpfs rw->ro remounts.

Modified:
  stable/11/sys/fs/tmpfs/tmpfs.h
  stable/11/sys/fs/tmpfs/tmpfs_fifoops.c
  stable/11/sys/fs/tmpfs/tmpfs_subr.c
  stable/11/sys/fs/tmpfs/tmpfs_vfsops.c
  stable/11/sys/fs/tmpfs/tmpfs_vnops.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/tmpfs/tmpfs.h
==
--- stable/11/sys/fs/tmpfs/tmpfs.h  Tue Apr 16 17:33:08 2019
(r346285)
+++ stable/11/sys/fs/tmpfs/tmpfs.h  Tue Apr 16 17:43:14 2019
(r346286)
@@ -330,6 +330,11 @@ LIST_HEAD(tmpfs_node_list, tmpfs_node);
  */
 struct tmpfs_mount {
/*
+* Original value of the "size" parameter, for reference purposes,
+* mostly.
+*/
+   off_t   tm_size_max;
+   /*
 * Maximum number of memory pages available for use by the file
 * system, set during mount time.  This variable must never be
 * used directly as it may be bigger than the current amount of
@@ -437,8 +442,8 @@ voidtmpfs_dir_destroy(struct tmpfs_mount *, struct 
tm
 struct tmpfs_dirent *  tmpfs_dir_lookup(struct tmpfs_node *node,
struct tmpfs_node *f,
struct componentname *cnp);
-inttmpfs_dir_getdents(struct tmpfs_node *, struct uio *, int,
-   u_long *, int *);
+inttmpfs_dir_getdents(struct tmpfs_mount *, struct tmpfs_node *,
+   struct uio *, int, u_long *, int *);
 inttmpfs_dir_whiteout_add(struct vnode *, struct componentname *);
 void   tmpfs_dir_whiteout_remove(struct vnode *, struct componentname *);
 inttmpfs_reg_resize(struct vnode *, off_t, boolean_t);
@@ -452,7 +457,8 @@ int tmpfs_chtimes(struct vnode *, struct vattr *, stru
 void   tmpfs_itimes(struct vnode *, const struct timespec *,
const struct timespec *);
 
-void   tmpfs_set_status(struct tmpfs_node *node, int status);
+void   tmpfs_set_status(struct tmpfs_mount *tm, struct tmpfs_node *node,
+   int status);
 void   tmpfs_update(struct vnode *);
 inttmpfs_truncate(struct vnode *, off_t);
 struct tmpfs_dirent *tmpfs_dir_first(struct tmpfs_node *dnode,

Modified: stable/11/sys/fs/tmpfs/tmpfs_fifoops.c
==
--- stable/11/sys/fs/tmpfs/tmpfs_fifoops.c  Tue Apr 16 17:33:08 2019
(r346285)
+++ stable/11/sys/fs/tmpfs/tmpfs_fifoops.c  Tue Apr 16 17:43:14 2019
(r346286)
@@ -54,7 +54,8 @@ tmpfs_fifo_close(struct vop_close_args *v)
struct tmpfs_node *node;
 
node = VP_TO_TMPFS_NODE(v->a_vp);
-   tmpfs_set_status(node, TMPFS_NODE_ACCESSED);
+   tmpfs_set_status(VFS_TO_TMPFS(v->a_vp->v_mount), node,
+   TMPFS_NODE_ACCESSED);
tmpfs_update(v->a_vp);
return (fifo_specops.vop_close(v));
 }

Modified: stable/11/sys/fs/tmpfs/tmpfs_subr.c
==
--- stable/11/sys/fs/tmpfs/tmpfs_subr.c Tue Apr 16 17:33:08 2019
(r346285)
+++ stable/11/sys/fs/tmpfs/tmpfs_subr.c Tue Apr 16 17:43:14 2019
(r346286)
@@ -213,6 +213,8 @@ tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount 
 */
return (EBUSY);
}
+   if ((mp->mnt_kern_flag & MNT_RDONLY) != 0)
+   return (EROFS);
 
nnode = (struct tmpfs_node *)uma_zalloc_arg(tmp->tm_node_pool, tmp,
M_WAITOK);
@@ -1104,7 +1106,8 @@ tmpfs_dir_destroy(struct tmpfs_mount *tmp, struct tmpf
  * error happens.
  */
 static int
-tmpfs_dir_getdotdent(struct tmpfs_node *node, struct uio *uio)
+tmpfs_dir_getdotdent(struct tmpfs_mount *tm, struct tmpfs_node *node,
+struct uio *uio)
 {
int error;
struct dirent dent;
@@ -1124,7 +1127,7 @@ tmpfs_dir_getdotdent(struct tmpfs_node *node, struct u
else
error = uiomove(, dent.d_reclen, uio);
 
-   tmpfs_set_status(node, TMPFS_NODE_ACCESSED);
+   tmpfs_set_status(tm, node, TMPFS_NODE_ACCESSED);
 
return (error);
 }
@@ -1137,7 +1140,8 @@ tmpfs_dir_getdotdent(struct tmpfs_node *node, struct u
  * error happens.
  */
 static int
-tmpfs_dir_getdotdotdent(struct tmpfs_node *node, struct uio *uio)
+tmpfs_dir_getdotdotdent(struct tmpfs_mount *tm, struct tmpfs_node *node,
+struct uio *uio)
 {
int error;
struct dirent dent;
@@ -1168,7 +1172,7 @@ tmpfs_dir_getdotdotdent(struct tmpfs_node *node, struc
else
error = uiomove(, dent.d_reclen, uio);
 
-   tmpfs_set_status(node, TMPFS_NODE_ACCESSED);
+   tmpfs_set_status(tm, node, TMPFS_NODE_ACCESSED);
 
return (error);
 }
@@ -1181,8 +1185,8 @@ tmpfs_dir_getdotdotdent(struct tmpfs_node *node, struc
  * error 

svn commit: r346285 - stable/12/sys/fs/tmpfs

2019-04-16 Thread Konstantin Belousov
Author: kib
Date: Tue Apr 16 17:33:08 2019
New Revision: 346285
URL: https://svnweb.freebsd.org/changeset/base/346285

Log:
  MFC r345425, r345514, r345799, r345800, r345803, r346157:
  Enable tmpfs rw->ro remounts.

Modified:
  stable/12/sys/fs/tmpfs/tmpfs.h
  stable/12/sys/fs/tmpfs/tmpfs_fifoops.c
  stable/12/sys/fs/tmpfs/tmpfs_subr.c
  stable/12/sys/fs/tmpfs/tmpfs_vfsops.c
  stable/12/sys/fs/tmpfs/tmpfs_vnops.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/fs/tmpfs/tmpfs.h
==
--- stable/12/sys/fs/tmpfs/tmpfs.h  Tue Apr 16 17:16:18 2019
(r346284)
+++ stable/12/sys/fs/tmpfs/tmpfs.h  Tue Apr 16 17:33:08 2019
(r346285)
@@ -325,6 +325,11 @@ LIST_HEAD(tmpfs_node_list, tmpfs_node);
  */
 struct tmpfs_mount {
/*
+* Original value of the "size" parameter, for reference purposes,
+* mostly.
+*/
+   off_t   tm_size_max;
+   /*
 * Maximum number of memory pages available for use by the file
 * system, set during mount time.  This variable must never be
 * used directly as it may be bigger than the current amount of
@@ -432,8 +437,8 @@ voidtmpfs_dir_destroy(struct tmpfs_mount *, struct 
tm
 struct tmpfs_dirent *  tmpfs_dir_lookup(struct tmpfs_node *node,
struct tmpfs_node *f,
struct componentname *cnp);
-inttmpfs_dir_getdents(struct tmpfs_node *, struct uio *, int,
-   u_long *, int *);
+inttmpfs_dir_getdents(struct tmpfs_mount *, struct tmpfs_node *,
+   struct uio *, int, u_long *, int *);
 inttmpfs_dir_whiteout_add(struct vnode *, struct componentname *);
 void   tmpfs_dir_whiteout_remove(struct vnode *, struct componentname *);
 inttmpfs_reg_resize(struct vnode *, off_t, boolean_t);
@@ -447,7 +452,8 @@ int tmpfs_chtimes(struct vnode *, struct vattr *, stru
 void   tmpfs_itimes(struct vnode *, const struct timespec *,
const struct timespec *);
 
-void   tmpfs_set_status(struct tmpfs_node *node, int status);
+void   tmpfs_set_status(struct tmpfs_mount *tm, struct tmpfs_node *node,
+   int status);
 void   tmpfs_update(struct vnode *);
 inttmpfs_truncate(struct vnode *, off_t);
 struct tmpfs_dirent *tmpfs_dir_first(struct tmpfs_node *dnode,

Modified: stable/12/sys/fs/tmpfs/tmpfs_fifoops.c
==
--- stable/12/sys/fs/tmpfs/tmpfs_fifoops.c  Tue Apr 16 17:16:18 2019
(r346284)
+++ stable/12/sys/fs/tmpfs/tmpfs_fifoops.c  Tue Apr 16 17:33:08 2019
(r346285)
@@ -56,7 +56,8 @@ tmpfs_fifo_close(struct vop_close_args *v)
struct tmpfs_node *node;
 
node = VP_TO_TMPFS_NODE(v->a_vp);
-   tmpfs_set_status(node, TMPFS_NODE_ACCESSED);
+   tmpfs_set_status(VFS_TO_TMPFS(v->a_vp->v_mount), node,
+   TMPFS_NODE_ACCESSED);
tmpfs_update(v->a_vp);
return (fifo_specops.vop_close(v));
 }

Modified: stable/12/sys/fs/tmpfs/tmpfs_subr.c
==
--- stable/12/sys/fs/tmpfs/tmpfs_subr.c Tue Apr 16 17:16:18 2019
(r346284)
+++ stable/12/sys/fs/tmpfs/tmpfs_subr.c Tue Apr 16 17:33:08 2019
(r346285)
@@ -218,6 +218,8 @@ tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount 
 */
return (EBUSY);
}
+   if ((mp->mnt_kern_flag & MNT_RDONLY) != 0)
+   return (EROFS);
 
nnode = (struct tmpfs_node *)uma_zalloc_arg(tmp->tm_node_pool, tmp,
M_WAITOK);
@@ -1108,7 +1110,8 @@ tmpfs_dir_destroy(struct tmpfs_mount *tmp, struct tmpf
  * error happens.
  */
 static int
-tmpfs_dir_getdotdent(struct tmpfs_node *node, struct uio *uio)
+tmpfs_dir_getdotdent(struct tmpfs_mount *tm, struct tmpfs_node *node,
+struct uio *uio)
 {
int error;
struct dirent dent;
@@ -1128,7 +1131,7 @@ tmpfs_dir_getdotdent(struct tmpfs_node *node, struct u
else
error = uiomove(, dent.d_reclen, uio);
 
-   tmpfs_set_status(node, TMPFS_NODE_ACCESSED);
+   tmpfs_set_status(tm, node, TMPFS_NODE_ACCESSED);
 
return (error);
 }
@@ -1141,7 +1144,8 @@ tmpfs_dir_getdotdent(struct tmpfs_node *node, struct u
  * error happens.
  */
 static int
-tmpfs_dir_getdotdotdent(struct tmpfs_node *node, struct uio *uio)
+tmpfs_dir_getdotdotdent(struct tmpfs_mount *tm, struct tmpfs_node *node,
+struct uio *uio)
 {
int error;
struct dirent dent;
@@ -1172,7 +1176,7 @@ tmpfs_dir_getdotdotdent(struct tmpfs_node *node, struc
else
error = uiomove(, dent.d_reclen, uio);
 
-   tmpfs_set_status(node, TMPFS_NODE_ACCESSED);
+   tmpfs_set_status(tm, node, TMPFS_NODE_ACCESSED);
 
return (error);
 }
@@ -1185,8 +1189,8 @@ tmpfs_dir_getdotdotdent(struct tmpfs_node *node, struc
  * error 

svn commit: r346284 - in stable/12/sys: amd64/pci i386/pci x86/include x86/x86

2019-04-16 Thread Konstantin Belousov
Author: kib
Date: Tue Apr 16 17:16:18 2019
New Revision: 346284
URL: https://svnweb.freebsd.org/changeset/base/346284

Log:
  MFC r346062:
  pci_cfgreg.c: Use io port config access for early boot time.
  
  PR:   236838

Modified:
  stable/12/sys/amd64/pci/pci_cfgreg.c
  stable/12/sys/i386/pci/pci_cfgreg.c
  stable/12/sys/x86/include/pci_cfgreg.h
  stable/12/sys/x86/x86/legacy.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/amd64/pci/pci_cfgreg.c
==
--- stable/12/sys/amd64/pci/pci_cfgreg.cTue Apr 16 17:12:27 2019
(r346283)
+++ stable/12/sys/amd64/pci/pci_cfgreg.cTue Apr 16 17:16:18 2019
(r346284)
@@ -44,12 +44,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-enum {
-   CFGMECH_NONE = 0,
-   CFGMECH_1,
-   CFGMECH_PCIE,
-};
-
 static uint32_tpci_docfgregread(int bus, int slot, int func, int reg,
int bytes);
 static int pciereg_cfgread(int bus, unsigned slot, unsigned func,
@@ -61,7 +55,13 @@ static void  pcireg_cfgwrite(int bus, int slot, int fun
 
 SYSCTL_DECL(_hw_pci);
 
-static int cfgmech;
+/*
+ * For amd64 we assume that type 1 I/O port-based access always works.
+ * If an ACPI MCFG table exists, pcie_cfgregopen() will be called to
+ * switch to memory-mapped access.
+ */
+int cfgmech = CFGMECH_1;
+
 static vm_offset_t pcie_base;
 static int pcie_minbus, pcie_maxbus;
 static uint32_t pcie_badslots;
@@ -71,47 +71,10 @@ static int mcfg_enable = 1;
 SYSCTL_INT(_hw_pci, OID_AUTO, mcfg, CTLFLAG_RDTUN, _enable, 0,
 "Enable support for PCI-e memory mapped config access");
 
-/* 
- * Initialise access to PCI configuration space 
- */
 int
 pci_cfgregopen(void)
 {
-   uint64_t pciebar;
-   uint16_t did, vid;
 
-   if (cfgmech != CFGMECH_NONE)
-   return (1);
-   cfgmech = CFGMECH_1;
-
-   /*
-* Grope around in the PCI config space to see if this is a
-* chipset that is capable of doing memory-mapped config cycles.
-* This also implies that it can do PCIe extended config cycles.
-*/
-
-   /* Check for supported chipsets */
-   vid = pci_cfgregread(0, 0, 0, PCIR_VENDOR, 2);
-   did = pci_cfgregread(0, 0, 0, PCIR_DEVICE, 2);
-   switch (vid) {
-   case 0x8086:
-   switch (did) {
-   case 0x3590:
-   case 0x3592:
-   /* Intel 7520 or 7320 */
-   pciebar = pci_cfgregread(0, 0, 0, 0xce, 2) << 16;
-   pcie_cfgregopen(pciebar, 0, 255);
-   break;
-   case 0x2580:
-   case 0x2584:
-   case 0x2590:
-   /* Intel 915, 925, or 915GM */
-   pciebar = pci_cfgregread(0, 0, 0, 0x48, 4);
-   pcie_cfgregopen(pciebar, 0, 255);
-   break;
-   }
-   }
-
return (1);
 }
 
@@ -135,9 +98,6 @@ pci_cfgregread(int bus, int slot, int func, int reg, i
 {
uint32_t line;
 
-   if (cfgmech == CFGMECH_NONE)
-   return (0x);
-
/*
 * Some BIOS writers seem to want to ignore the spec and put
 * 0 in the intline rather than 255 to indicate none.  Some use
@@ -161,9 +121,6 @@ pci_cfgregread(int bus, int slot, int func, int reg, i
 void
 pci_cfgregwrite(int bus, int slot, int func, int reg, u_int32_t data, int 
bytes)
 {
-
-   if (cfgmech == CFGMECH_NONE)
-   return;
 
if (cfgmech == CFGMECH_PCIE &&
(bus >= pcie_minbus && bus <= pcie_maxbus) &&

Modified: stable/12/sys/i386/pci/pci_cfgreg.c
==
--- stable/12/sys/i386/pci/pci_cfgreg.c Tue Apr 16 17:12:27 2019
(r346283)
+++ stable/12/sys/i386/pci/pci_cfgreg.c Tue Apr 16 17:16:18 2019
(r346284)
@@ -64,20 +64,13 @@ struct pcie_cfg_elem {
vm_paddr_t  papage;
 };
 
-enum {
-   CFGMECH_NONE = 0,
-   CFGMECH_1,
-   CFGMECH_2,
-   CFGMECH_PCIE,
-};
-
 SYSCTL_DECL(_hw_pci);
 
 static TAILQ_HEAD(pcie_cfg_list, pcie_cfg_elem) pcie_list[MAXCPU];
 static uint64_t pcie_base;
 static int pcie_minbus, pcie_maxbus;
 static uint32_t pcie_badslots;
-static int cfgmech;
+int cfgmech;
 static int devmax;
 static struct mtx pcicfg_mtx;
 static int mcfg_enable = 1;
@@ -136,10 +129,8 @@ pcibios_get_version(void)
 int
 pci_cfgregopen(void)
 {
-   static int  opened = 0;
-   uint64_tpciebar;
-   u_int16_t   vid, did;
-   u_int16_t   v;
+   uint16_t v;
+   static int opened = 0;
 
if (opened)
return (1);
@@ -158,38 +149,7 @@ pci_cfgregopen(void)
if (v >= 0x0210)
pci_pir_open();
 
-   if (cfgmech == CFGMECH_PCIE)
-   return (1); 
-
-   /*
-* Grope 

svn commit: r346283 - in stable/11/release/doc: en_US.ISO8859-1/relnotes share/xml

2019-04-16 Thread Glen Barber
Author: gjb
Date: Tue Apr 16 17:12:27 2019
New Revision: 346283
URL: https://svnweb.freebsd.org/changeset/base/346283

Log:
  Release notes documentation:
  - r336449, setproctitle_fast(3) addition.
  - r337418, kqueue(2) allow EVFILT_TIMER updates.
  - r338405, pthread_get_name_np(3) addition.
  - r339857, ddb(4) option to print process arguments added.
  - r340182, ichwd(4) support for Lewisburg PCH TCO watchdog timer.
  - r341828, ZFS vnode reclaimation deadlock fixed.
  - r342206, lagg(4) allow changing MTU without destroying interface.
  - r342656, x86 MSI IRQs are now tunable.
  - r343084, jail(8) IDs printed when logging a process exit.
  - r344399, zfsloader functionality now part of loader(8).
  - r344399, loader(8) GELI support extended to all architectures.
  - r344403, efi guess console device/type if not defined.
  - r345040, ccr(4) driver addition.
  - r345981, random(4) reseeding performance improvements.
  
  Add Klara Systems, Modirum MDPay, and Panzura to the sponsors
  file, sort, and remove random blank lines.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml
  stable/11/release/doc/share/xml/sponsor.ent

Modified: stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml
==
--- stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml  Tue Apr 16 
17:12:17 2019(r346282)
+++ stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml  Tue Apr 16 
17:12:27 2019(r346283)
@@ -350,6 +350,19 @@
   The  library has been
updated to version 1.9.0 (pre-release).
 
+  The  function
+   has been added, which is optimized for high-frequency process
+   title updates.
+
+  The  system call has been
+   updated to allow updating
+   EVFILT_TIMER.
+
+  The  function
+   has been added, which is used to retrieve the function name
+   associated with a thread.
+
   The  library has been
updated to improve POSIX compliance.
 
@@ -377,7 +390,21 @@
 
   General Kernel Changes
 
-  
+  The  debugging utility has been
+   updated to print command-line arguments to a process.
+
+  The number of MSI
+   IRQs have been converted from a constant to
+   a tunable.  The default remains at 512,
+   which can now be changed during boot with the
+   machdep.num_msi_irqs .
+
+  The kernel will now log the 
+   ID when logging a process exit.  The
+ID 0
+   represents processes that are not jailed.
 
 
 
@@ -414,7 +441,14 @@
 
   Device Drivers
 
-  
+  The  driver has been updated
+   to include support for TCO watchdog timers
+   in the Lewisburg PCH (C620) chipset.
+
+  The  driver has been
+   updated to improve performance during expensive
+   reseeding.
 
 
 
@@ -429,6 +463,16 @@
   The TP-Link TL-WN321G
network adapter now uses the  driver instead of the
 driver.
+
+  The
+driver has been updated to allow changing the
+   MTU without requiring destroying and
+   recreating the interface.
+
+  The  driver has been added,
+   providing support for Chelsio T6 cryptography
+   accelerators.
 
   
 
@@ -485,7 +529,10 @@
 
   ZFS
 
-  
+  An
+   issue that could result in a system hang during
+   ZFS vnode reclaimation has been
+   fixed.
 
 
 
@@ -504,7 +551,21 @@
 
   Boot Loader Changes
 
-  
+  The functionality provided by
+   zfsloader has been added to
+   .  Once the system boot blocks have been updated
+   following UPDATING,
+   zfsloader is no longer needed.  A hard
+   link to  has been added to ease in the
+   transition.
+
+  The  has been updated to
+   extend  support to all architectures.
+
+  The UEFI boot
+has been updated to better determine the system
+   console type and device if not defined in
+   .
 
 
 

Modified: stable/11/release/doc/share/xml/sponsor.ent
==
--- stable/11/release/doc/share/xml/sponsor.ent Tue Apr 16 17:12:17 2019
(r346282)
+++ stable/11/release/doc/share/xml/sponsor.ent Tue Apr 16 17:12:27 2019
(r346283)
@@ -15,10 +15,8 @@
 
 
 
-
 
 
-
 
 
 
@@ -40,16 +38,21 @@
 
 
 
+
+
 
+
+
 
 
-
 
 
 
 
 
 
+
+
 
 
 
___
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: r346282 - in head: . share/man/man9 sys/dev/random sys/sys

2019-04-16 Thread Conrad Meyer
Author: cem
Date: Tue Apr 16 17:12:17 2019
New Revision: 346282
URL: https://svnweb.freebsd.org/changeset/base/346282

Log:
  random(4): Add is_random_seeded(9) KPI
  
  The imagined use is for early boot consumers of random to be able to make
  decisions based on whether random is available yet or not.  One such
  consumer seems to be __stack_chk_init(), which runs immediately after random
  is initialized.  A follow-up patch will attempt to address that.
  
  Reported by:  many
  Reviewed by:  delphij (except man page)
  Approved by:  secteam(delphij)
  Differential Revision:https://reviews.freebsd.org/D19926

Modified:
  head/UPDATING
  head/share/man/man9/Makefile
  head/share/man/man9/random.9
  head/sys/dev/random/random_infra.c
  head/sys/dev/random/randomdev.c
  head/sys/dev/random/randomdev.h
  head/sys/sys/param.h
  head/sys/sys/random.h

Modified: head/UPDATING
==
--- head/UPDATING   Tue Apr 16 16:49:34 2019(r346281)
+++ head/UPDATING   Tue Apr 16 17:12:17 2019(r346282)
@@ -31,6 +31,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW:
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
 
+20190416:
+   The loadable random module KPI has changed; the random_infra_init()
+   routine now requires a 3rd function pointer for a bool (*)(void)
+   method that returns true if the random device is seeded (and
+   therefore unblocked).
+
 20190404:
r345895 reverts r320698. This implies that an nfsuserd(8) daemon
built from head sources between r320757 (July 6, 2017) and

Modified: head/share/man/man9/Makefile
==
--- head/share/man/man9/MakefileTue Apr 16 16:49:34 2019
(r346281)
+++ head/share/man/man9/MakefileTue Apr 16 17:12:17 2019
(r346282)
@@ -1668,6 +1668,7 @@ MLINKS+=psignal.9 gsignal.9 \
psignal.9 tdsignal.9
 MLINKS+=random.9 arc4rand.9 \
random.9 arc4random.9 \
+   random.9 is_random_seeded.9 \
random.9 read_random.9 \
random.9 read_random_uio.9 \
random.9 srandom.9

Modified: head/share/man/man9/random.9
==
--- head/share/man/man9/random.9Tue Apr 16 16:49:34 2019
(r346281)
+++ head/share/man/man9/random.9Tue Apr 16 17:12:17 2019
(r346282)
@@ -26,13 +26,14 @@
 .\"
 .\" $FreeBSD$
 .\" "
-.Dd April 15, 2019
+.Dd April 16, 2019
 .Dt RANDOM 9
 .Os
 .Sh NAME
 .Nm arc4rand ,
 .Nm arc4random ,
 .Nm arc4random_buf ,
+.Nm is_random_seeded ,
 .Nm random ,
 .Nm read_random ,
 .Nm read_random_uio ,
@@ -48,6 +49,8 @@
 .Fn arc4rand "void *ptr" "u_int length" "int reseed"
 .Pp
 .In sys/random.h
+.Ft bool
+.Fn is_random_seeded "void"
 .Ft void
 .Fn read_random "void *buffer" "int count"
 .Ft int
@@ -106,6 +109,13 @@ is not used directly;
 instead, use the
 .Fn arc4rand
 family of functions.
+.Pp
+The
+.Fn is_random_seeded
+function can be used to check in advance if
+.Fn read_random
+will block.
+(If random is seeded, it will not block.)
 .Pp
 The
 .Fn read_random_uio

Modified: head/sys/dev/random/random_infra.c
==
--- head/sys/dev/random/random_infra.c  Tue Apr 16 16:49:34 2019
(r346281)
+++ head/sys/dev/random/random_infra.c  Tue Apr 16 17:12:17 2019
(r346282)
@@ -63,12 +63,20 @@ null_read_random(void *dummy __unused, u_int dummy2 __
panic("%s: no random module is loaded", __func__);
 }
 
+static bool
+null_is_random_seeded(void)
+{
+   return (false);
+}
+
 struct random_readers {
int (*read_random_uio)(struct uio *, bool);
void(*read_random)(void *, u_int);
+   bool(*is_random_seeded)(void);
 } random_reader_context = {
(int (*)(struct uio *, bool))nullop,
null_read_random,
+   null_is_random_seeded,
 };
 
 struct sx randomdev_config_lock;
@@ -82,12 +90,15 @@ random_infra_sysinit(void *dummy __unused)
 SYSINIT(random_device_h_init, SI_SUB_RANDOM, SI_ORDER_FIRST, 
random_infra_sysinit, NULL);
 
 void
-random_infra_init(int (*p_random_read_uio)(struct uio *, bool), void 
(*p_random_read)(void *, u_int))
+random_infra_init(int (*p_random_read_uio)(struct uio *, bool),
+void (*p_random_read)(void *, u_int),
+bool (*p_is_random_seeded)(void))
 {
 
RANDOM_CONFIG_X_LOCK();
random_reader_context.read_random_uio = p_random_read_uio;
random_reader_context.read_random = p_random_read;
+   random_reader_context.is_random_seeded = p_is_random_seeded;
RANDOM_CONFIG_X_UNLOCK();
 }
 
@@ -98,6 +109,7 @@ random_infra_uninit(void)
RANDOM_C

Re: svn commit: r346250 - in head: share/man/man4 share/man/man9 sys/dev/random sys/kern sys/libkern sys/sys

2019-04-16 Thread Conrad Meyer
On Tue, Apr 16, 2019 at 9:33 AM Warner Losh  wrote:
> In that case, we're better off having a MD routine that gets called if 
> there's no loader-provided entropy pool.

Yes, this is more or less the same plan I had.  There's no need to add
anything MD specific; we already abstract MD random sources behind the
harvest mechanism.

> (and requiring an NV store is not even an option to require, so don't go 
> there).

Systems lacking both an NV store and an entropy source available
during mi_startup (i.e., not interrupts...) cannot safely provide
entropy in early boot.  On those systems, we must disable random
consumption during early boot.

> What we can't do is just hang if the loader can't provide an entropy pool.

I think we're all on the same page there.

Best,
Conrad
___
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: r346281 - head/sys/sys

2019-04-16 Thread Andrew Gallatin
Author: gallatin
Date: Tue Apr 16 16:49:34 2019
New Revision: 346281
URL: https://svnweb.freebsd.org/changeset/base/346281

Log:
  Replace cosqos with numa_domain in mbuf pkthdr
  
  The cosqos field was added nearly 6 years ago in r254804, and it is
  still unused by any in-tree consumers.  I have a patchset that I'm
  working on which aligns many network resources by NUMA domain,
  including inps, inpcb lb group, tcp pacing, lagg output link
  selection, backing pages for sendfile, and more.  It reduces
  cross-domain traffic by roughly 50% for a real web workload.
  
  This patchset relies on being able to store the numa domain in the
  mbuf, and grabbing the unused cosqos field for this purpose is the
  first step in starting to usptream it.
  
  Reviewed by:  kib, markj
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D19862

Modified:
  head/sys/sys/mbuf.h

Modified: head/sys/sys/mbuf.h
==
--- head/sys/sys/mbuf.h Tue Apr 16 15:52:04 2019(r346280)
+++ head/sys/sys/mbuf.h Tue Apr 16 16:49:34 2019(r346281)
@@ -98,6 +98,7 @@ struct mbuf;
 #defineMLEN((int)(MSIZE - MHSIZE))
 #defineMHLEN   ((int)(MSIZE - MPKTHSIZE))
 #defineMINCLSIZE   (MHLEN + 1)
+#defineM_NODOM 255
 
 #ifdef _KERNEL
 /*-
@@ -158,7 +159,7 @@ struct pkthdr {
uint32_t flowid;/* packet's 4-tuple system */
uint32_t csum_flags;/* checksum and offload features */
uint16_t fibnum;/* this packet should use this fib */
-   uint8_t  cosqos;/* class/quality of service */
+   uint8_t  numa_domain;   /* NUMA domain of recvd pkt */
uint8_t  rsstype;   /* hash type */
union {
uint64_trcv_tstmp;  /* timestamp in ns */
@@ -405,33 +406,6 @@ struct mbuf {
 #defineM_HASHTYPE_SET(m, v)((m)->m_pkthdr.rsstype = (v))
 #defineM_HASHTYPE_TEST(m, v)   (M_HASHTYPE_GET(m) == (v))
 #defineM_HASHTYPE_ISHASH(m)(M_HASHTYPE_GET(m) & 
M_HASHTYPE_HASHPROP)
-
-/*
- * COS/QOS class and quality of service tags.
- * It uses DSCP code points as base.
- */
-#defineQOS_DSCP_CS00x00
-#defineQOS_DSCP_DEFQOS_DSCP_CS0
-#defineQOS_DSCP_CS10x20
-#defineQOS_DSCP_AF11   0x28
-#defineQOS_DSCP_AF12   0x30
-#defineQOS_DSCP_AF13   0x38
-#defineQOS_DSCP_CS20x40
-#defineQOS_DSCP_AF21   0x48
-#defineQOS_DSCP_AF22   0x50
-#defineQOS_DSCP_AF23   0x58
-#defineQOS_DSCP_CS30x60
-#defineQOS_DSCP_AF31   0x68
-#defineQOS_DSCP_AF32   0x70
-#defineQOS_DSCP_AF33   0x78
-#defineQOS_DSCP_CS40x80
-#defineQOS_DSCP_AF41   0x88
-#defineQOS_DSCP_AF42   0x90
-#defineQOS_DSCP_AF43   0x98
-#defineQOS_DSCP_CS50xa0
-#defineQOS_DSCP_EF 0xb8
-#defineQOS_DSCP_CS60xc0
-#defineQOS_DSCP_CS70xe0
 
 /*
  * External mbuf storage buffer types.
___
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: r341586 - head/sys/dev/mlx5/mlx5_en

2019-04-16 Thread Slava Shwartsman




On 16-Apr-19 17:39, Andrey V. Elsukov wrote:

On 05.12.2018 17:25, Slava Shwartsman wrote:

Author: slavash
Date: Wed Dec  5 14:25:03 2018
New Revision: 341586
URL: https://svnweb.freebsd.org/changeset/base/341586

Log:
   mlx5en: Implement backpressure indication.
   
   The backpressure indication is implemented using an unlimited rate type of

   mbuf send tag. When the upper layers typically the socket layer has obtained 
such
   a tag, it can then query the destination driver queue for the current
   amount of space available in the send queue.
   
   A single mbuf send tag may be referenced multiple times and a refcount has been added

   to the mlx5e_priv structure to track its usage. Because the send tag resides
   in the mlx5e_channel structure, there is no need to wait for refcounts to 
reach
   zero until the mlx4en(4) driver is detached. The channels structure is 
persistant
   during the lifetime of the mlx5en(4) driver it belongs to and can so be 
accessed
   without any need of synchronization.
   
   The mlx5e_snd_tag structure was extended to contain a type field, because there are now

   two different tag types which end up in the driver which need to be 
distinguished.
   
   Submitted by:   hselasky@

   Approved by:hselasky (mentor)
   MFC after:  1 week
   Sponsored by:   Mellanox Technologies
@@ -587,27 +609,33 @@ mlx5e_xmit(struct ifnet *ifp, struct mbuf *mb)
struct mlx5e_sq *sq;
int ret;
  
-	sq = mlx5e_select_queue(ifp, mb);

-   if (unlikely(sq == NULL)) {
-#ifdef RATELIMIT
-   /* Check for route change */
-   if (mb->m_pkthdr.snd_tag != NULL &&
-   mb->m_pkthdr.snd_tag->ifp != ifp) {
+   if (mb->m_pkthdr.snd_tag != NULL) {
+   sq = mlx5e_select_queue_by_send_tag(ifp, mb);
+   if (unlikely(sq == NULL)) {
+   /* Check for route change */
+   if (mb->m_pkthdr.snd_tag->ifp != ifp) {
+   /* Free mbuf */
+   m_freem(mb);
+
+   /*
+* Tell upper layers about route
+* change and to re-transmit this
+* packet:
+*/
+   return (EAGAIN);
+   }


Hi,

I just discovered something strange and found that this commit is the
cause.
The test system has mlx5en 100G interface. It has two vlans: vlan500 and
vlan100.
Via vlan500 it receives some packets flows. Then it routes these packets
into vlan100.
But packets are dropped in mlx5e_xmit() with EAGAIN error code.

# dtrace -n 'fbt::ip6_output:return {printf("%d", arg1);}'
dtrace: description 'fbt::ip6_output:return ' matched 1 probe
CPU IDFUNCTION:NAME
  23  54338ip6_output:return 35
  16  54338ip6_output:return 35
  21  54338ip6_output:return 35
  22  54338ip6_output:return 35
  24  54338ip6_output:return 35
  23  54338ip6_output:return 35
  14  54338ip6_output:return 35
^C

# dtrace -n 'fbt::mlx5e_xmit:return {printf("%d", arg1);}'
dtrace: description 'fbt::mlx5e_xmit:return ' matched 1 probe
CPU IDFUNCTION:NAME
  16  69030mlx5e_xmit:return 35
  23  69030mlx5e_xmit:return 35
  26  69030mlx5e_xmit:return 35
  25  69030mlx5e_xmit:return 35
  24  69030mlx5e_xmit:return 35
  21  69030mlx5e_xmit:return 35
  26  69030mlx5e_xmit:return 35
^C

The kernel config is GENERIC.
13.0-CURRENT #9 r345758+82f3d57(svn_head)-dirty



Hi Andrey,

Thanks for letting us know about this regression.
I would like to try to reproduce this issue in house.

Can you please share the exact steps to reproduce it?
- Can I reproduce the issue with B2B setup?
- What is the route command you used to make the route between the VLANs?
- What app are you using to generate the traffic?


Slava
___
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: r346250 - in head: share/man/man4 share/man/man9 sys/dev/random sys/kern sys/libkern sys/sys

2019-04-16 Thread Warner Losh
On Tue, Apr 16, 2019 at 9:51 AM Conrad Meyer  wrote:

> Hi Warner,
>
> On Tue, Apr 16, 2019 at 8:47 AM Warner Losh  wrote:
> > On Tue, Apr 16, 2019 at 9:16 AM Ian Lepore  wrote:
> >> Isn't a file full of data which is distributed in identical form to
> >> everyone the exact opposite of entropy?
>
> Ian has the right idea.
>
> > It's just to bootstrap entropy for installs. The CI stuff doesn't matter
> if that's the same since the CI images aren't exposed to the internet in
> any way that would make it matter. The normal install would have the same
> seeds of entropy, but diverge from there fairly quickly. The stuff that's
> used early in the install is the don't care sort of things that won't
> matter in the installer (which then creates it's own entropy that's
> different for every install).
>
> I agree that it would be safe, although potentially misleading and
> potentially dangerous, to create a fake entropy file for the installer
> images.  We need to be careful *not* to embed such files in .img files
> which are installed by 'dd' directly to a disk or flash or VM, for
> example.  It would be catastrophic to distribute the same entropy file
> to all FreeBSD AWS images.
>

In that case, we're better off having a MD routine that gets called if
there's no loader-provided entropy pool. It would be responsible for
generating it in a MD defined way. It would handle it or call panic() based
on the requirements of the environment. This would answer the issue with
embedded systems that do not have any writable store (and requiring an NV
store is not even an option to require, so don't go there). It would let
hardware with RNG generate something. It would let hardware without get it
from wherever which may be highly specific to different scenarios or make
the conscious decision not to get it at all vs panic, etc.

What we can't do is just hang if the loader can't provide an entropy pool.

Warner
___
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: r341586 - head/sys/dev/mlx5/mlx5_en

2019-04-16 Thread Andrey V. Elsukov
On 16.04.2019 18:26, Slava Shwartsman wrote:
> Thanks for letting us know about this regression.
> I would like to try to reproduce this issue in house.
> 
> Can you please share the exact steps to reproduce it?
> - Can I reproduce the issue with B2B setup?
> - What is the route command you used to make the route between the VLANs?
> - What app are you using to generate the traffic?
> 

I think this can be reproduced on simple router, where single mce(4)
interface is used as parent for several vlan(4) interfaces. E.g.

[host1] vlan100 <--> mce0.100 [gateway] mce0.200 <--> vlan200 [host2]
10.0.0.110.0.0.254  192.168.0.254192.168.0.1

gateway:
sysctl net.inet.ip.forwarding=1

host1:
route add 192.168.0.0/24 10.0.0.254

host2:
route add 10.0.0.0/24 192.168.0.254
ping 10.0.0.1

I.e. you need to make setup, where ingress and egress interface is the
same - mce0.

-- 
WBR, Andrey V. Elsukov



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r346250 - in head: share/man/man4 share/man/man9 sys/dev/random sys/kern sys/libkern sys/sys

2019-04-16 Thread Rodney W. Grimes
[ Charset UTF-8 unsupported, converting... ]
> Hi Warner,
> 
> On Tue, Apr 16, 2019 at 8:47 AM Warner Losh  wrote:
> > On Tue, Apr 16, 2019 at 9:16 AM Ian Lepore  wrote:
> >> Isn't a file full of data which is distributed in identical form to
> >> everyone the exact opposite of entropy?
> 
> Ian has the right idea.
> 
> > It's just to bootstrap entropy for installs. The CI stuff doesn't matter if 
> > that's the same since the CI images aren't exposed to the internet in any 
> > way that would make it matter. The normal install would have the same seeds 
> > of entropy, but diverge from there fairly quickly. The stuff that's used 
> > early in the install is the don't care sort of things that won't matter in 
> > the installer (which then creates it's own entropy that's different for 
> > every install).
> 
> I agree that it would be safe, although potentially misleading and
> potentially dangerous, to create a fake entropy file for the installer
> images.  We need to be careful *not* to embed such files in .img files
> which are installed by 'dd' directly to a disk or flash or VM, for
> example.  It would be catastrophic to distribute the same entropy file
> to all FreeBSD AWS images.

Thank you Conrad, I'll bow out of any discussion now,
you clearly have the same concern I do.

> Best,
> Conrad
-- 
Rod Grimes rgri...@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"


Re: svn commit: r346250 - in head: share/man/man4 share/man/man9 sys/dev/random sys/kern sys/libkern sys/sys

2019-04-16 Thread Rodney W. Grimes
> On Tue, Apr 16, 2019 at 9:16 AM Ian Lepore  wrote:
> 
> > On Tue, 2019-04-16 at 07:18 -0600, Warner Losh wrote:
> > > On Tue, Apr 16, 2019, 7:04 AM Emmanuel Vadot 
> > > wrote:
> > >
> > > > On Mon, 15 Apr 2019 17:54:56 -0700
> > > > Conrad Meyer  wrote:
> > > >
> > > > > On Mon, Apr 15, 2019 at 5:53 PM Conrad Meyer 
> > > > > wrote:
> > > > > > E.g., the CI infrastructure for
> > > > > > Riscv/Arm is/was generating minimal filesystem images and not
> > > > > > populating /boot/entropy.
> > > > >
> > > > > I should add, I say "is/was" because I have a PR out which may
> > > > > address
> > > > > the problem: https://github.com/freebsd/freebsd-ci/pull/31
> > > > >
> > > > > Best,
> > > > > Conrad
> > > >
> > > >  It's not only CI, all release images (memstick, iso) don't have
> > > > a /boot/entropy.
> > > >  Also all arm/arm64 image don't have this file too.
> > > >  If /boot/entropy is needed and isn't present loader(8) should
> > > > gather
> > > > some entropy and pass this to the kernel for the first boot.
> > > >
> > >
> > > Maybe we need to bootstrap the entropy file as part of buildworld.
> > > I'm not
> > > sure if the loader can find enough...
> > >
> > >
> > Isn't a file full of data which is distributed in identical form to
> > everyone the exact opposite of entropy?
> >
> 
> It's just to bootstrap entropy for installs. The CI stuff doesn't matter if
> that's the same since the CI images aren't exposed to the internet in any
> way that would make it matter.

Incorrect, the CI artifacts are publically avaliable.  I infact have
Makefiles that take any given CI build artifact set and create a VM
from it, I use this for bisecting failures and other testing.

> The normal install would have the same seeds
> of entropy, but diverge from there fairly quickly. The stuff that's used
> early in the install is the don't care sort of things that won't matter in
> the installer (which then creates it's own entropy that's different for
> every install).

I have concerns here, if I use a distribution with a canned entropy
in it to make a file system that is snapshotted, aka frozen in time,
that its entropy would be repeatable.  This file system is never run
through any installer, it is, I believe, how most of the Cloud images
are created.

> Warner
-- 
Rod Grimes rgri...@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: r346280 - head/lib/libvgl

2019-04-16 Thread Bruce Evans
Author: bde
Date: Tue Apr 16 15:52:04 2019
New Revision: 346280
URL: https://svnweb.freebsd.org/changeset/base/346280

Log:
  Sigh, r346279 was also a test version with the reduced size doubled (so
  it was actually double the full size in current kernels where the reduction
  is null, so overran the mmapped() buffer).

Modified:
  head/lib/libvgl/main.c

Modified: head/lib/libvgl/main.c
==
--- head/lib/libvgl/main.c  Tue Apr 16 15:41:45 2019(r346279)
+++ head/lib/libvgl/main.c  Tue Apr 16 15:52:04 2019(r346280)
@@ -275,7 +275,7 @@ VGLInit(int mode)
* get the same efficiency and bugs for all kernels.
*/
   if (VGLModeInfo.vi_mode >= M_VESA_BASE)
-VGLBufSize = 2*VGLAdpInfo.va_line_width*VGLModeInfo.vi_height*
+VGLBufSize = VGLAdpInfo.va_line_width*VGLModeInfo.vi_height*
  VGLModeInfo.vi_planes;
   VGLBuf = malloc(VGLBufSize);
   if (VGLBuf == NULL) {
___
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: r346250 - in head: share/man/man4 share/man/man9 sys/dev/random sys/kern sys/libkern sys/sys

2019-04-16 Thread Conrad Meyer
Hi Warner,

On Tue, Apr 16, 2019 at 8:47 AM Warner Losh  wrote:
> On Tue, Apr 16, 2019 at 9:16 AM Ian Lepore  wrote:
>> Isn't a file full of data which is distributed in identical form to
>> everyone the exact opposite of entropy?

Ian has the right idea.

> It's just to bootstrap entropy for installs. The CI stuff doesn't matter if 
> that's the same since the CI images aren't exposed to the internet in any way 
> that would make it matter. The normal install would have the same seeds of 
> entropy, but diverge from there fairly quickly. The stuff that's used early 
> in the install is the don't care sort of things that won't matter in the 
> installer (which then creates it's own entropy that's different for every 
> install).

I agree that it would be safe, although potentially misleading and
potentially dangerous, to create a fake entropy file for the installer
images.  We need to be careful *not* to embed such files in .img files
which are installed by 'dd' directly to a disk or flash or VM, for
example.  It would be catastrophic to distribute the same entropy file
to all FreeBSD AWS images.

Best,
Conrad
___
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: r346250 - in head: share/man/man4 share/man/man9 sys/dev/random sys/kern sys/libkern sys/sys

2019-04-16 Thread Warner Losh
On Tue, Apr 16, 2019 at 9:27 AM Conrad Meyer  wrote:

> On Tue, Apr 16, 2019 at 7:24 AM Justin Hibbits 
> wrote:
> >
> > Hi Conrad,
> > ...
> > [Power] does use bsdinstall to install.  How is entropy loaded at
> startup,
> > which causes the problem noted in github?
>
> There are a couple very early load sources.  loader(8) will load
> early-boot entropy from /boot/entropy and pass it to the kernel as a
> fake module (entropy_cache_load in loader.conf(5)), similar to
> cpu_microcode early load.
>
> The fallback option is random(4) itself groping into the filesystem
> during early auto-conf (SI_SUB_RANDOM:SI_ORDER_FOURTH, IIRC) to access
> /boot/entropy directly.
>

SI_SUB_RANDOM is too early. It's at 0x216,  while SI_SUB_ROOT_CONF
doesn't happen until 0xb00.


> > If it's loaded before
> > filesystems get mounted, that could be a problem for us, because /boot
> > is on a different filesystem (msdosfs, to be read by petitboot).
> > Petitboot also does not have a way to preload modules, so all we have
> > at startup, until spawning init, is the kernel.
>
> Yes, that seems potentially problematic.  Can the Power kernel access
> the non-msdosfs root filesystem?  Let's follow-up offline about
> PPC-specific early entropy seeding.  I would much prefer we figure out
> a way to provide early entropy to Power than disabling or crippling
> every early random consumer on the arch.  Do you know what the Linux
> folks do?
>
> On Power with darn, we could probably just spin in SI_ORDER_FOURTH
> until we have enough darn output to seed random.  Similar for x86 CI
> images, I guess; though they do not have the loader problem, some
> people have non-bsdinstall installation methods.
>

They do have the loader problem because many means to generate an image
don't generate /boot/entropy.

Warner
___
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: r346250 - in head: share/man/man4 share/man/man9 sys/dev/random sys/kern sys/libkern sys/sys

2019-04-16 Thread Conrad Meyer
Hi Ruslan,

On Tue, Apr 16, 2019 at 8:38 AM Ruslan Bukin  wrote:
>
> Hi I just got this:
>
> ...
> _sleep() at random_harvest_deregister_source+0x132
> random_harvest_deregister_source() at read_random+0xc4
> read_random() at vn_fsync_buf+0x594
> vn_fsync_buf() at arc4rand+0xd4
> arc4rand() at sched_tdname+0x4c
> sched_tdname() at mi_startup+0x20c
> mi_startup() at 0xffc001a6
> KDB: enter: panic


The stack is clearly bogus or missing some frames; can you attach GDB
on this system (or an emulator) and get a full stack?  The step(s) I'm
missing are mi_startup -> sched_tdname, and sched_tdname ->
arc4rand().  What's consuming random during early boot on riscv?

(The vn_fsync_buf frame is also confusing and probably incorrect?  A
real stack would be helpful.)  Maybe it's just __stack_chk_init, given
mi_startup, like the other reproductions.  I will need to take a step
back from email to address that.)

> We don't have loader(8) support for RISC-V and we don't have any hardware 
> with random number generators yet. Most of our fpga/hardware has no way to 
> have rootfs at all (we use mdroot).

Is it possible to inject entropy into the mdroot?  If not, it seems
like anything that consumes random during early boot on riscv must be
disabled.

> We use BBL bootloader to boot freebsd. BBL embeds freebsd kernel to the BBL 
> binary on a compile time (similar way how we embed mdroot to kernel). Once 
> BBL initialized itself it jumps to the pre-defined address of payload which 
> is freebsd kernel.
>
> So I'm pondering what is our current option, i.e. how to feed entropy in this 
> case ?

Can a running system rebuild the mdroot or BBL?  Or do they reside on
RO flash of some kind?  If so, it would be possible to rewrite the BBL
or mdroot with entropy injected for the next boot, I think.

Otherwise, the straightforward solution is to simply disable anything
that attempts to consume random early in boot on such devices with no
hardware entropy source and no early filesystem access.

Anything that is tripping on this was silently feeding itself with
predictable, non-random data prior to this change.

Best,
Conrad
___
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: r346250 - in head: share/man/man4 share/man/man9 sys/dev/random sys/kern sys/libkern sys/sys

2019-04-16 Thread Warner Losh
On Tue, Apr 16, 2019 at 9:16 AM Ian Lepore  wrote:

> On Tue, 2019-04-16 at 07:18 -0600, Warner Losh wrote:
> > On Tue, Apr 16, 2019, 7:04 AM Emmanuel Vadot 
> > wrote:
> >
> > > On Mon, 15 Apr 2019 17:54:56 -0700
> > > Conrad Meyer  wrote:
> > >
> > > > On Mon, Apr 15, 2019 at 5:53 PM Conrad Meyer 
> > > > wrote:
> > > > > E.g., the CI infrastructure for
> > > > > Riscv/Arm is/was generating minimal filesystem images and not
> > > > > populating /boot/entropy.
> > > >
> > > > I should add, I say "is/was" because I have a PR out which may
> > > > address
> > > > the problem: https://github.com/freebsd/freebsd-ci/pull/31
> > > >
> > > > Best,
> > > > Conrad
> > >
> > >  It's not only CI, all release images (memstick, iso) don't have
> > > a /boot/entropy.
> > >  Also all arm/arm64 image don't have this file too.
> > >  If /boot/entropy is needed and isn't present loader(8) should
> > > gather
> > > some entropy and pass this to the kernel for the first boot.
> > >
> >
> > Maybe we need to bootstrap the entropy file as part of buildworld.
> > I'm not
> > sure if the loader can find enough...
> >
> >
> Isn't a file full of data which is distributed in identical form to
> everyone the exact opposite of entropy?
>

It's just to bootstrap entropy for installs. The CI stuff doesn't matter if
that's the same since the CI images aren't exposed to the internet in any
way that would make it matter. The normal install would have the same seeds
of entropy, but diverge from there fairly quickly. The stuff that's used
early in the install is the don't care sort of things that won't matter in
the installer (which then creates it's own entropy that's different for
every install).

Warner
___
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: r346279 - head/lib/libvgl

2019-04-16 Thread Bruce Evans
Author: bde
Date: Tue Apr 16 15:41:45 2019
New Revision: 346279
URL: https://svnweb.freebsd.org/changeset/base/346279

Log:
  Oops, r346278 committed a test version with the change annulled.

Modified:
  head/lib/libvgl/main.c

Modified: head/lib/libvgl/main.c
==
--- head/lib/libvgl/main.c  Tue Apr 16 15:31:23 2019(r346278)
+++ head/lib/libvgl/main.c  Tue Apr 16 15:41:45 2019(r346279)
@@ -274,7 +274,7 @@ VGLInit(int mode)
* be too slow, and malloc() may fail).  Restrict ourselves similarly to
* get the same efficiency and bugs for all kernels.
*/
-  if (0 && VGLModeInfo.vi_mode >= M_VESA_BASE)
+  if (VGLModeInfo.vi_mode >= M_VESA_BASE)
 VGLBufSize = 2*VGLAdpInfo.va_line_width*VGLModeInfo.vi_height*
  VGLModeInfo.vi_planes;
   VGLBuf = malloc(VGLBufSize);
___
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: r346250 - in head: share/man/man4 share/man/man9 sys/dev/random sys/kern sys/libkern sys/sys

2019-04-16 Thread Ruslan Bukin
Hi I just got this:

UART 16550 configured with options: baud = 115200 | freq = 5000
bbl loader
  
  
r   vv
  
rr
rr
rr
  vv  
r   vv
rrvv  
rr  rr
  vv  
rr  vv  rr
  vv  
rr  vv  rr
  vv  
rr  vv  rr
  vv  
rr  rr
  
rr  rr

   INSTRUCTION SETS WANT TO BE FREE
physmap[0] = 0xc000
physmap[1] = 0xc120
physmap[2] = 0xc130
physmap[3] = 0x0001
pmap_bootstrap ffc0005c6000 c000 e00958
ffc0005c6000
100
physmap_idx 4
min_pa c000
max_pa 1
---<>---
KDB: debugger backends: ddb
KDB: current backend: ddb
Copyright (c) 1992-2019 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 13.0-CURRENT #496 999d9e9b642(master)-dirty: Tue Apr 16 16:23:48 BST 
2019

br@pie:/usr/home/br/obj/usr/home/br/dev/freebsd-riscv/riscv.riscv64/sys/GENERIC 
riscv
gcc version 8.2.0 (GCC) 
Preloaded elf64 kernel "kernel" at 0xffc000dfeda0.
CPU(0): Unknown Implementer Unknown Processor
random: randomdev_wait_until_seeded unblock wait
t[0] == 0x
t[1] == 0x
t[2] == 0xffc0004e86d8
t[3] == 0x
t[4] == 0x
t[5] == 0x
t[6] == 0x
s[0] == 0xffc03b00
s[1] == 0xffc000da5920
s[2] == 0xffc000da5920
s[3] == 0x
s[4] == 0x
s[5] == 0xffc0005cf4d0
s[6] == 0xffc0004fc948
s[7] == 0xffc000da5920
s[8] == 0x
s[9] == 0xffc000d45a80
s[10] == 0x
s[11] == 0x197c
a[0] == 0xffc000da5920
a[1] == 0x
a[2] == 0xffc0004fc948
a[3] == 0x0900
a[4] == 0xffc000da5920
a[5] == 0x
a[6] == 0x0100
a[7] == 0x0001
sepc == 0xffc0001f8d3c
sstatus == 0x80026100
panic: Fatal page fault at 0xffc0001f8d3c: 0x18
time = 1
KDB: stack backtrace:
db_trace_self() at db_read_token+0x5e2
 pc = 0xffc0004c726a ra = 0xffcca1de
 sp = 0xffc035f8 fp = 0xffc03818

db_read_token() at kdb_backtrace+0x2e
 pc = 0xffcca1de ra = 0xffc00024c9d2
 sp = 0xffc03818 fp = 0xffc03828

kdb_backtrace() at vpanic+0x124
 pc = 0xffc00024c9d2 ra = 0xffc000212aaa
 sp = 0xffc03828 fp = 0xffc03868

vpanic() at panic+0x22
 pc = 0xffc000212aaa ra = 0xffc000212ae2
 sp = 0xffc03868 fp = 0xffc03888

panic() at sysarch+0x3ba
 pc = 0xffc000212ae2 ra = 0xffc0004d2cfc
 sp = 0xffc03888 fp = 0xffc03998

sysarch() at do_trap_supervisor+0x4e
 pc = 0xffc0004d2cfc ra = 0xffc0004d2df6
 sp = 0xffc03998 fp = 0xffc039b8

do_trap_supervisor() at cpu_exception_handler_supervisor+0x68
 pc = 0xffc0004d2df6 ra = 0xffc0004c78f8
 sp = 0xffc039b8 fp = 0xffc03b00

cpu_exception_handler_supervisor() at sleepq_add+0x46
 pc = 0xffc0004c78f8 ra = 0xffc00025919e
 sp = 0xffc03b00 fp = 0xffc03b40

sleepq_add() at _sleep+0x2d0
 pc = 0xffc00025919e ra = 0xffc00021b892
 sp = 0xffc03b40 fp = 0xffc03be0

_sleep() at random_harvest_deregister_source+0x132
 pc = 0xffc00021b892 ra = 0xffced172
 sp = 0xffc03be0 fp = 0xffc03c50

random_harvest_deregister_source() at read_random+0xc4
 pc = 0xffced172 ra = 0xffced752
 sp = 0xffc03c50 fp = 0xffc03ca0

read_random() at vn_fsync_buf+0x594
 pc = 0xffced752 ra = 0xffc0002caa40
 sp = 0xffc03ca0 fp = 0xffc03d00

vn_fsync_buf() at arc4rand+0xd4
 pc = 0xffc0002caa40 ra = 0xffc0002cac04
 sp = 0xffc03d00 fp = 0xffc03d90

arc4rand() at sched_tdname+0x4c
 pc = 0xffc0002cac04 ra = 

Re: svn commit: r346263 - head/contrib/tcpdump

2019-04-16 Thread Conrad Meyer
On Tue, Apr 16, 2019 at 6:20 AM Shawn Webb  wrote:
> Is there any documentation anywhere telling users that Capsicum
> support will be disabled under certain circumstances?

Hi Shawn,

I don't think documenting that makes much sense in general.  It would
be extremely burdensome to fully document and quickly become
desynchronized from the code.  It's comparable to OpenBSD pledging
differently in different paths of programs.

To me, "for now," suggests that this is perhaps a temporary workaround
and maybe we can do something better in the future.

Take care,
Conrad

P.S., When do you plan to update your Easy Feature Comparison page to
reflect that FreeBSD has the same procfs and "boot hardening" as HBSD?
___
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: r341586 - head/sys/dev/mlx5/mlx5_en

2019-04-16 Thread Hans Petter Selasky

On 4/16/19 4:39 PM, Andrey V. Elsukov wrote:

On 05.12.2018 17:25, Slava Shwartsman wrote:

Author: slavash
Date: Wed Dec  5 14:25:03 2018
New Revision: 341586
URL: https://svnweb.freebsd.org/changeset/base/341586

Log:
   mlx5en: Implement backpressure indication.
   
   The backpressure indication is implemented using an unlimited rate type of

   mbuf send tag. When the upper layers typically the socket layer has obtained 
such
   a tag, it can then query the destination driver queue for the current
   amount of space available in the send queue.
   
   A single mbuf send tag may be referenced multiple times and a refcount has been added

   to the mlx5e_priv structure to track its usage. Because the send tag resides
   in the mlx5e_channel structure, there is no need to wait for refcounts to 
reach
   zero until the mlx4en(4) driver is detached. The channels structure is 
persistant
   during the lifetime of the mlx5en(4) driver it belongs to and can so be 
accessed
   without any need of synchronization.
   
   The mlx5e_snd_tag structure was extended to contain a type field, because there are now

   two different tag types which end up in the driver which need to be 
distinguished.
   
   Submitted by:   hselasky@

   Approved by:hselasky (mentor)
   MFC after:  1 week
   Sponsored by:   Mellanox Technologies
@@ -587,27 +609,33 @@ mlx5e_xmit(struct ifnet *ifp, struct mbuf *mb)
struct mlx5e_sq *sq;
int ret;
  
-	sq = mlx5e_select_queue(ifp, mb);

-   if (unlikely(sq == NULL)) {
-#ifdef RATELIMIT
-   /* Check for route change */
-   if (mb->m_pkthdr.snd_tag != NULL &&
-   mb->m_pkthdr.snd_tag->ifp != ifp) {
+   if (mb->m_pkthdr.snd_tag != NULL) {
+   sq = mlx5e_select_queue_by_send_tag(ifp, mb);
+   if (unlikely(sq == NULL)) {
+   /* Check for route change */
+   if (mb->m_pkthdr.snd_tag->ifp != ifp) {
+   /* Free mbuf */
+   m_freem(mb);
+
+   /*
+* Tell upper layers about route
+* change and to re-transmit this
+* packet:
+*/
+   return (EAGAIN);
+   }


Hi,

I just discovered something strange and found that this commit is the
cause.
The test system has mlx5en 100G interface. It has two vlans: vlan500 and
vlan100.
Via vlan500 it receives some packets flows. Then it routes these packets
into vlan100.
But packets are dropped in mlx5e_xmit() with EAGAIN error code.

# dtrace -n 'fbt::ip6_output:return {printf("%d", arg1);}'
dtrace: description 'fbt::ip6_output:return ' matched 1 probe
CPU IDFUNCTION:NAME
  23  54338ip6_output:return 35
  16  54338ip6_output:return 35
  21  54338ip6_output:return 35
  22  54338ip6_output:return 35
  24  54338ip6_output:return 35
  23  54338ip6_output:return 35
  14  54338ip6_output:return 35
^C

# dtrace -n 'fbt::mlx5e_xmit:return {printf("%d", arg1);}'
dtrace: description 'fbt::mlx5e_xmit:return ' matched 1 probe
CPU IDFUNCTION:NAME
  16  69030mlx5e_xmit:return 35
  23  69030mlx5e_xmit:return 35
  26  69030mlx5e_xmit:return 35
  25  69030mlx5e_xmit:return 35
  24  69030mlx5e_xmit:return 35
  21  69030mlx5e_xmit:return 35
  26  69030mlx5e_xmit:return 35
^C

The kernel config is GENERIC.
13.0-CURRENT #9 r345758+82f3d57(svn_head)-dirty



Hi,

This might be a case where rcvif in the mbuf's pktheader is not cleared 
before the packet is fed back on the wire.


John Baldwin is working on the send tags implementation, to eliminate 
the EAGAIN handling in the network drivers.


--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"


svn commit: r346278 - head/lib/libvgl

2019-04-16 Thread Bruce Evans
Author: bde
Date: Tue Apr 16 15:31:23 2019
New Revision: 346278
URL: https://svnweb.freebsd.org/changeset/base/346278

Log:
  Quick fix for slow clearing and context switches of large frame buffers
  with old kernels, by breaking the support for large frame buffers in the
  same way as for current kernels.
  
  Large frame buffers may be too large to map into kva, and the kernel
  (syscons) only uses the first screen page anyway, so r203535, r205557
  and 248799 limit the buffer size in VESA modes to the first screen
  page, apparently without noticing that this breaks applications by
  using the same limit for user mappings as for kernel mappings.  In
  vgl, this makes the virtual screen the same as the physical screen.
  
  However, this is almost a feature since clearing and switching large
  (usually mostly unused) frame buffers takes too long.  E.g., on a 16
  year old low-end AGP card it takes about 12 seconds to clear the 128MB
  frame buffer in old kernels that map it all and also map it with slow
  attributes (e.g., uncacheable).  Older PCI cards are even slower, but
  usually have less memory.  Newer PCIe cards are faster, but may have
  many GB of memory.  Also, vgl malloc()s a shadow buffer with the same
  size as the frame buffer, so large frame buffers are even more wasteful
  in applications than in the kernel.
  
  Use the same limit in vgl as in newer kernels.
  
  Virtual screens and panning still work in non-VESA modes that have
  more than 1 page.  The reduced buffer size in the kernel also breaks
  mmap() of the last physical page in modes where the reduced size is
  not a multiple of the physical page size.  The same reduction in vgl
  only reduces the virtual screen size.

Modified:
  head/lib/libvgl/main.c

Modified: head/lib/libvgl/main.c
==
--- head/lib/libvgl/main.c  Tue Apr 16 14:29:12 2019(r346277)
+++ head/lib/libvgl/main.c  Tue Apr 16 15:31:23 2019(r346278)
@@ -264,6 +264,19 @@ VGLInit(int mode)
   else
 VGLBufSize = max(VGLAdpInfo.va_line_width*VGLModeInfo.vi_height,
 VGLAdpInfo.va_window_size)*VGLModeInfo.vi_planes;
+  /*
+   * The above is for old -CURRENT.  Current -CURRENT since r203535 and/or
+   * r248799 restricts va_buffer_size to the displayed size in VESA modes to
+   * avoid wasting kva for mapping unused parts of the frame buffer.  But all
+   * parts were usable here.  Applying the same restriction to user mappings
+   * makes our virtualization useless and breaks our panning, but large frame
+   * buffers are also difficult for us to manage (clearing and switching may
+   * be too slow, and malloc() may fail).  Restrict ourselves similarly to
+   * get the same efficiency and bugs for all kernels.
+   */
+  if (0 && VGLModeInfo.vi_mode >= M_VESA_BASE)
+VGLBufSize = 2*VGLAdpInfo.va_line_width*VGLModeInfo.vi_height*
+ VGLModeInfo.vi_planes;
   VGLBuf = malloc(VGLBufSize);
   if (VGLBuf == NULL) {
 VGLEnd();
___
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: r346259 - head/sys/dev/tpm

2019-04-16 Thread Conrad Meyer
Hi Marcin,

Isn't this check racy?  Thread TIDs are allocated from a fixed range
and can be recycled.

Best,
Conrad

On Mon, Apr 15, 2019 at 7:28 PM Marcin Wojtas  wrote:
>
> Author: mw
> Date: Tue Apr 16 02:28:35 2019
> New Revision: 346259
> URL: https://svnweb.freebsd.org/changeset/base/346259
>
> Log:
>   tpm: Prevent session hijack
>
>   Check caller thread id before allowing to read the buffer
>   to make sure that it can only be accessed by the thread that
>   did the associated write to the TPM.
>
>   Submitted by: Kornel Duleba 
>   Reviewed by: delphij
>   Obtained from: Semihalf
>   Sponsored by: Stormshield
>   Differential Revision: https://reviews.freebsd.org/D19713
>
> Modified:
>   head/sys/dev/tpm/tpm20.c
>   head/sys/dev/tpm/tpm20.h
>
> Modified: head/sys/dev/tpm/tpm20.c
> ==
> --- head/sys/dev/tpm/tpm20.cTue Apr 16 02:12:38 2019(r346258)
> +++ head/sys/dev/tpm/tpm20.cTue Apr 16 02:28:35 2019(r346259)
> @@ -77,6 +77,10 @@ tpm20_read(struct cdev *dev, struct uio *uio, int flag
>
> callout_stop(>discard_buffer_callout);
> sx_xlock(>dev_lock);
> +   if (sc->owner_tid != uio->uio_td->td_tid) {
> +   sx_xunlock(>dev_lock);
> +   return (EPERM);
> +   }
>
> bytes_to_transfer = MIN(sc->pending_data_length, uio->uio_resid);
> if (bytes_to_transfer > 0) {
> @@ -128,9 +132,11 @@ tpm20_write(struct cdev *dev, struct uio *uio, int fla
>
> result = sc->transmit(sc, byte_count);
>
> -   if (result == 0)
> +   if (result == 0) {
> callout_reset(>discard_buffer_callout,
> TPM_READ_TIMEOUT / tick, tpm20_discard_buffer, sc);
> +   sc->owner_tid = uio->uio_td->td_tid;
> +   }
>
> sx_xunlock(>dev_lock);
> return (result);
>
> Modified: head/sys/dev/tpm/tpm20.h
> ==
> --- head/sys/dev/tpm/tpm20.hTue Apr 16 02:12:38 2019(r346258)
> +++ head/sys/dev/tpm/tpm20.hTue Apr 16 02:28:35 2019(r346259)
> @@ -120,6 +120,7 @@ struct tpm_sc {
>
> uint8_t *buf;
> size_t  pending_data_length;
> +   lwpid_t owner_tid;
>
> struct callout  discard_buffer_callout;
>  #ifdef TPM_HARVEST
>
___
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: r346250 - in head: share/man/man4 share/man/man9 sys/dev/random sys/kern sys/libkern sys/sys

2019-04-16 Thread Conrad Meyer
On Tue, Apr 16, 2019 at 7:24 AM Justin Hibbits  wrote:
>
> Hi Conrad,
> ...
> [Power] does use bsdinstall to install.  How is entropy loaded at startup,
> which causes the problem noted in github?

There are a couple very early load sources.  loader(8) will load
early-boot entropy from /boot/entropy and pass it to the kernel as a
fake module (entropy_cache_load in loader.conf(5)), similar to
cpu_microcode early load.

The fallback option is random(4) itself groping into the filesystem
during early auto-conf (SI_SUB_RANDOM:SI_ORDER_FOURTH, IIRC) to access
/boot/entropy directly.

> If it's loaded before
> filesystems get mounted, that could be a problem for us, because /boot
> is on a different filesystem (msdosfs, to be read by petitboot).
> Petitboot also does not have a way to preload modules, so all we have
> at startup, until spawning init, is the kernel.

Yes, that seems potentially problematic.  Can the Power kernel access
the non-msdosfs root filesystem?  Let's follow-up offline about
PPC-specific early entropy seeding.  I would much prefer we figure out
a way to provide early entropy to Power than disabling or crippling
every early random consumer on the arch.  Do you know what the Linux
folks do?

On Power with darn, we could probably just spin in SI_ORDER_FOURTH
until we have enough darn output to seed random.  Similar for x86 CI
images, I guess; though they do not have the loader problem, some
people have non-bsdinstall installation methods.

Thanks,
Conrad
___
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: r346250 - in head: share/man/man4 share/man/man9 sys/dev/random sys/kern sys/libkern sys/sys

2019-04-16 Thread Conrad Meyer
On Tue, Apr 16, 2019 at 6:19 AM Warner Losh  wrote:
> On Tue, Apr 16, 2019, 7:04 AM Emmanuel Vadot  wrote:
>>  It's not only CI, all release images (memstick, iso) don't have
>> a /boot/entropy.
>>  Also all arm/arm64 image don't have this file too.
>>  If /boot/entropy is needed and isn't present loader(8) should gather
>> some entropy and pass this to the kernel for the first boot.
>
> Maybe we need to bootstrap the entropy file as part of buildworld. I'm not 
> sure if the loader can find enough...

Well, one thing we should explicitly *not do* is distribute the same
"entropy" to everyone in released images.  So there is some difficulty
here.  Buildworld does not know if the target of the build is a
one-off or a release image.  Something like makerelease still seems
inappropriately dangerous.

The idea of loader-provided entropy is not that it generates the
entropy itself, but that it can access the /boot/ filesystem to load
entropy and pass it to the kernel as a fake module.

I think we have identified that at least stack_chk_init was silently
broken on a number of systems, using non-random stack guards.  Now
it's loudly broken.  Ed has proposed a happy medium where we can
check, in stack_chk_init, if the random device is seeded (via new KPI)
and give users a big stick tunable to proceed without entropy or not.
For now, I think we would default that to "proceed" just to unbreak CI
and any other sharp corners.  But the goal would be to default that to
"panic" eventually.

I don't know enough about stack_chk_init to determine how late it can
be seeded.  It seems to have come in in r180012 as a component of
-fstack-protector.  I will do a little investigating.  Suggestions on
appropriate reviewers welcome (I think ru@ is no longer with the
project).

Best regards,
Conrad
___
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: r346250 - in head: share/man/man4 share/man/man9 sys/dev/random sys/kern sys/libkern sys/sys

2019-04-16 Thread Ian Lepore
On Tue, 2019-04-16 at 07:18 -0600, Warner Losh wrote:
> On Tue, Apr 16, 2019, 7:04 AM Emmanuel Vadot 
> wrote:
> 
> > On Mon, 15 Apr 2019 17:54:56 -0700
> > Conrad Meyer  wrote:
> > 
> > > On Mon, Apr 15, 2019 at 5:53 PM Conrad Meyer 
> > > wrote:
> > > > E.g., the CI infrastructure for
> > > > Riscv/Arm is/was generating minimal filesystem images and not
> > > > populating /boot/entropy.
> > > 
> > > I should add, I say "is/was" because I have a PR out which may
> > > address
> > > the problem: https://github.com/freebsd/freebsd-ci/pull/31
> > > 
> > > Best,
> > > Conrad
> > 
> >  It's not only CI, all release images (memstick, iso) don't have
> > a /boot/entropy.
> >  Also all arm/arm64 image don't have this file too.
> >  If /boot/entropy is needed and isn't present loader(8) should
> > gather
> > some entropy and pass this to the kernel for the first boot.
> > 
> 
> Maybe we need to bootstrap the entropy file as part of buildworld.
> I'm not
> sure if the loader can find enough...
> 
> 
Isn't a file full of data which is distributed in identical form to
everyone the exact opposite of entropy?

-- 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"


Re: svn commit: r345562 - in head/sys: amd64/amd64 i386/i386

2019-04-16 Thread Ed Maste
On Tue, 26 Mar 2019 at 18:45, Conrad Meyer  wrote:
>
> Author: cem
> Date: Tue Mar 26 22:45:41 2019
> New Revision: 345562
> URL: https://svnweb.freebsd.org/changeset/base/345562
>
> Log:
>   x86: Use XSAVEOPT for fpusave(), when available
>
>   Remove redundant npxsave_core definition while here.
>
>   Suggested by: Anton Rang
>   Reviewed by:  kib, Anton Rang 
>   Sponsored by: Dell EMC Isilon
>   Differential Revision:https://reviews.freebsd.org/D19665

Note that this introduced failures in the i386 CI tests, PR 236936.

Investigation is ongoing and taking some time, in part because the
behaviour may be different between an i386 userland in an amd64 jail
versus running on an i386 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"


Re: svn commit: r341586 - head/sys/dev/mlx5/mlx5_en

2019-04-16 Thread Andrey V. Elsukov
On 05.12.2018 17:25, Slava Shwartsman wrote:
> Author: slavash
> Date: Wed Dec  5 14:25:03 2018
> New Revision: 341586
> URL: https://svnweb.freebsd.org/changeset/base/341586
> 
> Log:
>   mlx5en: Implement backpressure indication.
>   
>   The backpressure indication is implemented using an unlimited rate type of
>   mbuf send tag. When the upper layers typically the socket layer has 
> obtained such
>   a tag, it can then query the destination driver queue for the current
>   amount of space available in the send queue.
>   
>   A single mbuf send tag may be referenced multiple times and a refcount has 
> been added
>   to the mlx5e_priv structure to track its usage. Because the send tag resides
>   in the mlx5e_channel structure, there is no need to wait for refcounts to 
> reach
>   zero until the mlx4en(4) driver is detached. The channels structure is 
> persistant
>   during the lifetime of the mlx5en(4) driver it belongs to and can so be 
> accessed
>   without any need of synchronization.
>   
>   The mlx5e_snd_tag structure was extended to contain a type field, because 
> there are now
>   two different tag types which end up in the driver which need to be 
> distinguished.
>   
>   Submitted by:   hselasky@
>   Approved by:hselasky (mentor)
>   MFC after:  1 week
>   Sponsored by:   Mellanox Technologies
> @@ -587,27 +609,33 @@ mlx5e_xmit(struct ifnet *ifp, struct mbuf *mb)
>   struct mlx5e_sq *sq;
>   int ret;
>  
> - sq = mlx5e_select_queue(ifp, mb);
> - if (unlikely(sq == NULL)) {
> -#ifdef RATELIMIT
> - /* Check for route change */
> - if (mb->m_pkthdr.snd_tag != NULL &&
> - mb->m_pkthdr.snd_tag->ifp != ifp) {
> + if (mb->m_pkthdr.snd_tag != NULL) {
> + sq = mlx5e_select_queue_by_send_tag(ifp, mb);
> + if (unlikely(sq == NULL)) {
> + /* Check for route change */
> + if (mb->m_pkthdr.snd_tag->ifp != ifp) {
> + /* Free mbuf */
> + m_freem(mb);
> +
> + /*
> +  * Tell upper layers about route
> +  * change and to re-transmit this
> +  * packet:
> +  */
> + return (EAGAIN);
> + }

Hi,

I just discovered something strange and found that this commit is the
cause.
The test system has mlx5en 100G interface. It has two vlans: vlan500 and
vlan100.
Via vlan500 it receives some packets flows. Then it routes these packets
into vlan100.
But packets are dropped in mlx5e_xmit() with EAGAIN error code.

# dtrace -n 'fbt::ip6_output:return {printf("%d", arg1);}'
dtrace: description 'fbt::ip6_output:return ' matched 1 probe
CPU IDFUNCTION:NAME
 23  54338ip6_output:return 35
 16  54338ip6_output:return 35
 21  54338ip6_output:return 35
 22  54338ip6_output:return 35
 24  54338ip6_output:return 35
 23  54338ip6_output:return 35
 14  54338ip6_output:return 35
^C

# dtrace -n 'fbt::mlx5e_xmit:return {printf("%d", arg1);}'
dtrace: description 'fbt::mlx5e_xmit:return ' matched 1 probe
CPU IDFUNCTION:NAME
 16  69030mlx5e_xmit:return 35
 23  69030mlx5e_xmit:return 35
 26  69030mlx5e_xmit:return 35
 25  69030mlx5e_xmit:return 35
 24  69030mlx5e_xmit:return 35
 21  69030mlx5e_xmit:return 35
 26  69030mlx5e_xmit:return 35
^C

The kernel config is GENERIC.
13.0-CURRENT #9 r345758+82f3d57(svn_head)-dirty

-- 
WBR, Andrey V. Elsukov



signature.asc
Description: OpenPGP digital signature


svn commit: r346277 - stable/11/release/doc/en_US.ISO8859-1/relnotes

2019-04-16 Thread Glen Barber
Author: gjb
Date: Tue Apr 16 14:29:12 2019
New Revision: 346277
URL: https://svnweb.freebsd.org/changeset/base/346277

Log:
  Release notes documentation:
  - r335640, pcap(3) 1.9.0 (pre-release).
  - r338452, lastlogin(8) libxo(3) support.
  - r338475, traceroute(8) capsicum support.
  - r338707, pthread(3) POSIX compliance improvements.
  - r339446, jail(8) allow.read_msgbuf parameter addition.
  - r340369, TP-Link TL-WN321G uses run(4) instead of rum(4).
  - r340963, makewhatis(1) do not operate on read-only directories.
  - r341790, jail(8) '-e ' flag added.
  - r342254, vt(4) uk.macbook.kbd keymap addition.
  - r343118, trim(8) utility added.
  
  Keep sorted by revision number.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml

Modified: stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml
==
--- stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml  Tue Apr 16 
14:28:33 2019(r346276)
+++ stable/11/release/doc/en_US.ISO8859-1/relnotes/article.xml  Tue Apr 16 
14:29:12 2019(r346277)
@@ -161,6 +161,13 @@
 
   Userland Configuration Changes
 
+  The  utility has been
+   updated to include a new  parameter,
+   allow.read_msgbuf, which prevents jailed
+   processes and users from accessing the  buffer.
+   This parameter is set to false by
+   default.
+
   The system ,
/etc/crontab, has been updated to set
PATH for consistency with the 
@@ -183,25 +190,41 @@
which is used to specify the timestamp for build
reproducibility.
 
-  The  utility has been
-   updated to include  support.
-
   The  utility has been updated
to add a new statusoperand,
progress, which reports the current status
on a single line every second.
 
+  The  utility has been
+   updated to include  support.
+
+  The  utility has been
+   updated to include  support.
+
+  The  utility has been
+   updated to include  support.
+
   The  utility has been
updated to implement -B and
--ignore-blank-lines support.
 
-  The  utility has been
-   updated to support sectors larger than 2048 bytes.
+  The  utility has been
+   updated to prevent operating within read-only
+   directories.
 
+  The  utility has been
+   updated to add a new flag, -e, which takes
+   a  parameter as an argument and prints a list
+   of non-wildcard jails with the specified parameter.
+
   The  utility has been
updated to include the -l flag which
enables live mode when specified.
 
+  The  utility has been added,
+   which deletes content for blocks on flash-based storage
+   devices that use wear-leveling algorithms.
+
   The  utility has been
updated to add -l support for 
files.
@@ -220,6 +243,9 @@
utilities have been updated to allow dashes in label
names.
 
+  The  utility has been
+   updated to support sectors larger than 2048 bytes.
+
   The  utility has been updated
to add the pipefail option which simplifies
checking the exit status of all commands in a pipeline.
@@ -321,7 +347,11 @@
 
   Runtime Libraries and API
 
-  
+  The  library has been
+   updated to version 1.9.0 (pre-release).
+
+  The  library has been
+   updated to improve POSIX compliance.
 
 
 
@@ -396,7 +426,9 @@
 
   Network Drivers
 
-  
+  The TP-Link TL-WN321G
+   network adapter now uses the  driver instead of the
+driver.
 
   
 
@@ -411,7 +443,9 @@
 
   Hardware Support
 
-  
+  The  keyboard mapping has been
+   updated to include uk.macbook.kbd
+   support.
 
 
 
___
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: r346276 - head/lib/libvgl

2019-04-16 Thread Bruce Evans
Author: bde
Date: Tue Apr 16 14:28:33 2019
New Revision: 346276
URL: https://svnweb.freebsd.org/changeset/base/346276

Log:
  Fix a variable name in r346215.  Clearing of the right of the screen was
  broken, except it worked accidentally in most cases where the virtual
  screen is larger than the physical screen.

Modified:
  head/lib/libvgl/simple.c

Modified: head/lib/libvgl/simple.c
==
--- head/lib/libvgl/simple.cTue Apr 16 14:07:14 2019(r346275)
+++ head/lib/libvgl/simple.cTue Apr 16 14:28:33 2019(r346276)
@@ -515,7 +515,7 @@ VGLClear(VGLBitmap *object, u_long color)
 for (i = 0; i < object->VXsize; i++)
   bcopy(, src.Bitmap + i * object->PixelBytes, object->PixelBytes);
 for (i = 0; i < object->VYsize; i++)
-  __VGLBitmapCopy(, 0, 0, object, 0, i, object->VYsize, 1);
+  __VGLBitmapCopy(, 0, 0, object, 0, i, object->VXsize, 1);
 break;
 
   case VIDBUF8X:
___
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: r346250 - in head: share/man/man4 share/man/man9 sys/dev/random sys/kern sys/libkern sys/sys

2019-04-16 Thread Justin Hibbits
Hi Conrad,

On Mon, 15 Apr 2019 17:53:17 -0700
Conrad Meyer  wrote:

> Hi Justin,
> 
> On Mon, Apr 15, 2019 at 5:01 PM Justin Hibbits 
> wrote:
> > Given the discussion over there it would probably also fail on
> > powernv, which also does not use loader.  
> 
> Does power use bsdinstall (which populates /boot/entropy at install
> time via usr.sbin/bsdinstall/scripts/entropy) and install the
> libexec/rc/rc.d/random rc script (which re-emits new /boot/entropy on
> every startup)?  If so, it should be ok.
> 
> The problem is new installs that don't use bsdinstall or otherwise
> provide initial /boot/entropy.  E.g., the CI infrastructure for
> Riscv/Arm is/was generating minimal filesystem images and not
> populating /boot/entropy.
> 
> Best,
> Conrad

It does use bsdinstall to install.  How is entropy loaded at startup,
which causes the problem noted in github?  If it's loaded before
filesystems get mounted, that could be a problem for us, because /boot
is on a different filesystem (msdosfs, to be read by petitboot).
Petitboot also does not have a way to preload modules, so all we have
at startup, until spawning init, is the kernel.

- Justin
___
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: r346275 - head/usr.sbin/portsnap/portsnap

2019-04-16 Thread Glen Barber
Author: gjb
Date: Tue Apr 16 14:07:14 2019
New Revision: 346275
URL: https://svnweb.freebsd.org/changeset/base/346275

Log:
  Remove INDEX-10 reference, as 10.x is now EoL.
  
  MFC after:3 days
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.sbin/portsnap/portsnap/portsnap.conf

Modified: head/usr.sbin/portsnap/portsnap/portsnap.conf
==
--- head/usr.sbin/portsnap/portsnap/portsnap.conf   Tue Apr 16 13:31:16 
2019(r346274)
+++ head/usr.sbin/portsnap/portsnap/portsnap.conf   Tue Apr 16 14:07:14 
2019(r346275)
@@ -30,7 +30,6 @@ KEYPRINT=9b5feee6d69f170e3dd0a2c8e469ddbd64f13f978f2f3
 # REFUSE korean polish portuguese russian ukrainian vietnamese
 
 # List of INDEX files to build and the DESCRIBE file to use for each
-#INDEX INDEX-10 DESCRIBE.10
 #INDEX INDEX-11 DESCRIBE.11
 #INDEX INDEX-12 DESCRIBE.12
 INDEX INDEX-13 DESCRIBE.13
___
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: r346274 - head/share/man/man4

2019-04-16 Thread Tom Jones
Author: thj
Date: Tue Apr 16 13:31:16 2019
New Revision: 346274
URL: https://svnweb.freebsd.org/changeset/base/346274

Log:
  Update and clarify pflog man page
  
  The pflog0 interface is created when the module is loaded, this can
  be triggered by pf and pflogd being enabled or by kldloading the module.
  
  By default the interface would be pflog0, add the ifconfig stage of the
  example to make this example clearer.
  
  Reviewed by:  kp, bz, bcr, jtl, 0mp
  Approved by:  jtl (mentor), bz (mentor)
  Differential Revision:https://reviews.freebsd.org/D19861

Modified:
  head/share/man/man4/pflog.4

Modified: head/share/man/man4/pflog.4
==
--- head/share/man/man4/pflog.4 Tue Apr 16 13:26:31 2019(r346273)
+++ head/share/man/man4/pflog.4 Tue Apr 16 13:31:16 2019(r346274)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 31, 2007
+.Dd April 9, 2019
 .Dt PFLOG 4
 .Os
 .Sh NAME
@@ -47,13 +47,18 @@ on the
 interface, or stored to disk using
 .Xr pflogd 8 .
 .Pp
-The pflog0 interface is created automatically at boot if both
+The pflog0 interface is created when the
+.Nm
+module is loaded;
+further instances can be created using
+.Xr ifconfig 8 .
+The
+.Nm
+module is loaded automatically if both
 .Xr pf 4
 and
 .Xr pflogd 8
-are enabled;
-further instances can be created using
-.Xr ifconfig 8 .
+are enabled.
 .Pp
 Each packet retrieved on this interface has a header associated
 with it of length
@@ -87,6 +92,8 @@ Create a
 interface
 and monitor all packets logged on it:
 .Bd -literal -offset indent
+# ifconfig pflog create
+pflog1
 # ifconfig pflog1 up
 # tcpdump -n -e -ttt -i pflog1
 .Ed
___
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: r346273 - in head/sys: compat/freebsd32 kern

2019-04-16 Thread Ed Maste
Author: emaste
Date: Tue Apr 16 13:26:31 2019
New Revision: 346273
URL: https://svnweb.freebsd.org/changeset/base/346273

Log:
  correct readlinkat(2) return type
  
  r176215 corrected readlink(2)'s return type and the type of the last
  argument.  readlink(2) was introduced in r177788 after being developed
  as part of Google Summer of Code 2007; it appears to have inherited the
  wrong return type.
  
  Man pages and header files were already ssize_t; update syscalls.master
  to match.
  
  PR:   197915
  Submitted by: Henning Petersen 
  MFC after:2 weeks

Modified:
  head/sys/compat/freebsd32/syscalls.master
  head/sys/kern/syscalls.master

Modified: head/sys/compat/freebsd32/syscalls.master
==
--- head/sys/compat/freebsd32/syscalls.master   Tue Apr 16 12:40:49 2019
(r346272)
+++ head/sys/compat/freebsd32/syscalls.master   Tue Apr 16 13:26:31 2019
(r346273)
@@ -963,7 +963,7 @@
uint32_t dev); }
 499AUE_OPENAT_RWTC NOPROTO { int openat(int fd, const char *path, \
int flag, mode_t mode); }
-500AUE_READLINKAT  NOPROTO { int readlinkat(int fd, const char *path, \
+500AUE_READLINKAT  NOPROTO { ssize_t readlinkat(int fd, const char *path, \
char *buf, size_t bufsize); }
 501AUE_RENAMEATNOPROTO { int renameat(int oldfd, const char *old, \
int newfd, const char *new); }

Modified: head/sys/kern/syscalls.master
==
--- head/sys/kern/syscalls.master   Tue Apr 16 12:40:49 2019
(r346272)
+++ head/sys/kern/syscalls.master   Tue Apr 16 13:26:31 2019
(r346273)
@@ -2716,7 +2716,7 @@
);
}
 500AUE_READLINKAT  STD {
-   int readlinkat(
+   ssize_t readlinkat(
int fd,
_In_z_ const char *path,
_Out_writes_bytes_(bufsize) char *buf,
___
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: r346263 - head/contrib/tcpdump

2019-04-16 Thread Shawn Webb
On Tue, Apr 16, 2019 at 04:12:42AM +, Mariusz Zaborski wrote:
> Author: oshogbo
> Date: Tue Apr 16 04:12:41 2019
> New Revision: 346263
> URL: https://svnweb.freebsd.org/changeset/base/346263
> 
> Log:
>   tcpdump: disable Capsicum if -E option is provided.
>   
>   The -E is used to provide a secret for decrypting IPsec.
>   The secret may be provided through command line or as the file.
>   The problem is that tcpdump doesn't support yet opening files in capability 
> mode
>   and the file may contain a list of the files to open.
>   
>   As a workaround, for now, let's just disable capsicum if the -E
>   the option is provided.
>   
>   PR: 236819
>   MFC after:  2 weeks
> 
> Modified:
>   head/contrib/tcpdump/tcpdump.c
> 
> Modified: head/contrib/tcpdump/tcpdump.c
> ==
> --- head/contrib/tcpdump/tcpdump.cTue Apr 16 02:48:04 2019
> (r346262)
> +++ head/contrib/tcpdump/tcpdump.cTue Apr 16 04:12:41 2019
> (r346263)
> @@ -2063,7 +2063,8 @@ main(int argc, char **argv)
>   }
>  
>  #ifdef HAVE_CAPSICUM
> - cansandbox = (VFileName == NULL && zflag == NULL);
> + cansandbox = (VFileName == NULL && zflag == NULL &&
> + ndo->ndo_espsecret == NULL);
>  #ifdef HAVE_CASPER
>   cansandbox = (cansandbox && (ndo->ndo_nflag || capdns != NULL));
>  #else

Is there any documentation anywhere telling users that Capsicum
support will be disabled under certain circumstances?

Thanks,

-- 
Shawn Webb
Cofounder / Security Engineer
HardenedBSD

Tor-ified Signal:+1 443-546-8752
Tor+XMPP+OTR:latt...@is.a.hacker.sx
GPG Key ID:  0x6A84658F52456EEE
GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9  3633 C85B 0AF8 AB23 0FB2


signature.asc
Description: PGP signature


Re: svn commit: r346250 - in head: share/man/man4 share/man/man9 sys/dev/random sys/kern sys/libkern sys/sys

2019-04-16 Thread Warner Losh
On Tue, Apr 16, 2019, 7:04 AM Emmanuel Vadot  wrote:

> On Mon, 15 Apr 2019 17:54:56 -0700
> Conrad Meyer  wrote:
>
> > On Mon, Apr 15, 2019 at 5:53 PM Conrad Meyer  wrote:
> > > E.g., the CI infrastructure for
> > > Riscv/Arm is/was generating minimal filesystem images and not
> > > populating /boot/entropy.
> >
> > I should add, I say "is/was" because I have a PR out which may address
> > the problem: https://github.com/freebsd/freebsd-ci/pull/31
> >
> > Best,
> > Conrad
>
>  It's not only CI, all release images (memstick, iso) don't have
> a /boot/entropy.
>  Also all arm/arm64 image don't have this file too.
>  If /boot/entropy is needed and isn't present loader(8) should gather
> some entropy and pass this to the kernel for the first boot.
>

Maybe we need to bootstrap the entropy file as part of buildworld. I'm not
sure if the loader can find enough...

Warner

-- 
> Emmanuel Vadot  
>
>
___
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: r346250 - in head: share/man/man4 share/man/man9 sys/dev/random sys/kern sys/libkern sys/sys

2019-04-16 Thread Emmanuel Vadot
On Mon, 15 Apr 2019 17:54:56 -0700
Conrad Meyer  wrote:

> On Mon, Apr 15, 2019 at 5:53 PM Conrad Meyer  wrote:
> > E.g., the CI infrastructure for
> > Riscv/Arm is/was generating minimal filesystem images and not
> > populating /boot/entropy.
> 
> I should add, I say "is/was" because I have a PR out which may address
> the problem: https://github.com/freebsd/freebsd-ci/pull/31
> 
> Best,
> Conrad

 It's not only CI, all release images (memstick, iso) don't have
a /boot/entropy.
 Also all arm/arm64 image don't have this file too.
 If /boot/entropy is needed and isn't present loader(8) should gather
some entropy and pass this to the kernel for the first boot.

-- 
Emmanuel Vadot  
___
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: r346272 - head/sys/arm/allwinner

2019-04-16 Thread Emmanuel Vadot
Author: manu
Date: Tue Apr 16 12:40:49 2019
New Revision: 346272
URL: https://svnweb.freebsd.org/changeset/base/346272

Log:
  aw_syscon: Add a new compatible
  
  Since 5.0 DTS the syscon controller have a new compatible as it
  exports new subnodes, we currently only use it as a syscon provider
  so just add the new compatible.
  
  Tested On:  H3
  MFC after:1 month

Modified:
  head/sys/arm/allwinner/aw_syscon.c

Modified: head/sys/arm/allwinner/aw_syscon.c
==
--- head/sys/arm/allwinner/aw_syscon.c  Tue Apr 16 12:39:31 2019
(r346271)
+++ head/sys/arm/allwinner/aw_syscon.c  Tue Apr 16 12:40:49 2019
(r346272)
@@ -52,6 +52,7 @@ static struct ofw_compat_data compat_data[] = {
{"allwinner,sun50i-a64-system-control", 1},
{"allwinner,sun8i-a83t-system-controller", 1},
{"allwinner,sun8i-h3-system-controller", 1},
+   {"allwinner,sun8i-h3-system-control", 1},
{NULL, 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"


svn commit: r346271 - in head/sys/arm/allwinner: . clkng

2019-04-16 Thread Emmanuel Vadot
Author: manu
Date: Tue Apr 16 12:39:31 2019
New Revision: 346271
URL: https://svnweb.freebsd.org/changeset/base/346271

Log:
  aw_rtc: Register the clocks
  
  Since latest DTS update the rtc is supposed to register two clocks :
  
  - osc32k (the 32k oscillator on the board that the RTC uses directly and
  that other peripheral can use)
  - iosc (the internal oscillator of the RTC when available which frequency
  depend on the SoC revision)
  
  Since we need the RTC before the proper clock control unit (because it uses
  those clocks) attach it a BUS_PASS_BUS + MIDDLE and attach the clock control
  unit at BUS_PASS_BUS + LAST for the SoC that requires it.
  
  Tested On: A20, H3, A64
  
  MFC after:1 month

Modified:
  head/sys/arm/allwinner/aw_rtc.c
  head/sys/arm/allwinner/clkng/ccu_a31.c
  head/sys/arm/allwinner/clkng/ccu_a64.c
  head/sys/arm/allwinner/clkng/ccu_a83t.c
  head/sys/arm/allwinner/clkng/ccu_h3.c

Modified: head/sys/arm/allwinner/aw_rtc.c
==
--- head/sys/arm/allwinner/aw_rtc.c Tue Apr 16 12:25:15 2019
(r346270)
+++ head/sys/arm/allwinner/aw_rtc.c Tue Apr 16 12:39:31 2019
(r346271)
@@ -1,4 +1,5 @@
 /*-
+ * Copyright (c) 2019 Emmanuel Vadot 
  * Copyright (c) 2016 Vladimir Belian 
  * All rights reserved.
  *
@@ -43,6 +44,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+
 #include 
 
 #include "clock_if.h"
@@ -62,7 +65,7 @@ __FBSDID("$FreeBSD$");
 #defineLOSC_MAGIC  0x16aa
 #defineLOSC_BUSY_MASK  0x0380
 
-#defineIS_SUN7I(sc->type == A20_RTC)
+#defineIS_SUN7I(sc->conf->is_a20 == true)
 
 #defineYEAR_MIN(IS_SUN7I ? 1970 : 2010)
 #defineYEAR_MAX(IS_SUN7I ? 2100 : 2073)
@@ -92,27 +95,68 @@ __FBSDID("$FreeBSD$");
 #defineRTC_READ(sc, reg)   bus_read_4((sc)->res, (reg))
 #defineRTC_WRITE(sc, reg, val) bus_write_4((sc)->res, (reg), 
(val))
 
-#defineIS_LEAP_YEAR(y) \
-   (((y) % 400) == 0 || (((y) % 100) != 0 && ((y) % 4) == 0))
+#defineIS_LEAP_YEAR(y) (((y) % 400) == 0 || (((y) % 100) != 0 && ((y) 
% 4) == 0))
 
-#defineA10_RTC 1
-#defineA20_RTC 2
-#defineA31_RTC 3
+struct aw_rtc_conf {
+   uint64_tiosc_freq;
+   bus_size_t  rtc_date;
+   bus_size_t  rtc_time;
+   bus_size_t  rtc_losc_sta;
+   boolis_a20;
+};
 
+struct aw_rtc_conf a10_conf = {
+   .rtc_date = A10_RTC_DATE_REG,
+   .rtc_time = A10_RTC_TIME_REG,
+   .rtc_losc_sta = LOSC_CTRL_REG,
+};
+
+struct aw_rtc_conf a20_conf = {
+   .rtc_date = A10_RTC_DATE_REG,
+   .rtc_time = A10_RTC_TIME_REG,
+   .rtc_losc_sta = LOSC_CTRL_REG,
+   .is_a20 = true,
+};
+
+struct aw_rtc_conf a31_conf = {
+   .iosc_freq = 65,/* between 600 and 700 Khz */
+   .rtc_date = A31_RTC_DATE_REG,
+   .rtc_time = A31_RTC_TIME_REG,
+   .rtc_losc_sta = A31_LOSC_AUTO_SWT_STA,
+};
+
+struct aw_rtc_conf h3_conf = {
+   .iosc_freq = 1600,
+   .rtc_date = A31_RTC_DATE_REG,
+   .rtc_time = A31_RTC_TIME_REG,
+   .rtc_losc_sta = A31_LOSC_AUTO_SWT_STA,
+};
+
 static struct ofw_compat_data compat_data[] = {
-   { "allwinner,sun4i-a10-rtc", A10_RTC },
-   { "allwinner,sun7i-a20-rtc", A20_RTC },
-   { "allwinner,sun6i-a31-rtc", A31_RTC },
+   { "allwinner,sun4i-a10-rtc", (uintptr_t) _conf },
+   { "allwinner,sun7i-a20-rtc", (uintptr_t) _conf },
+   { "allwinner,sun6i-a31-rtc", (uintptr_t) _conf },
+   { "allwinner,sun8i-h3-rtc", (uintptr_t) _conf },
{ NULL, 0 }
 };
 
 struct aw_rtc_softc {
struct resource *res;
+   struct aw_rtc_conf  *conf;
int type;
-   bus_size_t  rtc_date;
-   bus_size_t  rtc_time;
 };
 
+static struct clk_fixed_def aw_rtc_osc32k = {
+   .clkdef.id = 0,
+   .freq = 32768,
+};
+
+static struct clk_fixed_def aw_rtc_iosc = {
+   .clkdef.id = 2,
+};
+
+static voidaw_rtc_install_clocks(struct aw_rtc_softc *sc, device_t dev);
+
 static int aw_rtc_probe(device_t dev);
 static int aw_rtc_attach(device_t dev);
 static int aw_rtc_detach(device_t dev);
@@ -140,9 +184,8 @@ static driver_t aw_rtc_driver = {
 static devclass_t aw_rtc_devclass;
 
 EARLY_DRIVER_MODULE(aw_rtc, simplebus, aw_rtc_driver, aw_rtc_devclass, 0, 0,
-BUS_PASS_TIMER + BUS_PASS_ORDER_MIDDLE);
+BUS_PASS_BUS + BUS_PASS_ORDER_MIDDLE);
 
-
 static int
 aw_rtc_probe(device_t dev)
 {
@@ -161,7 +204,6 @@ static int
 aw_rtc_attach(device_t dev)
 {
struct aw_rtc_softc *sc  = device_get_softc(dev);
-   bus_size_t rtc_losc_sta;
uint32_t val;
int rid = 0;
 
@@ -171,20 +213,7 @@ aw_rtc_attach(device_t dev)

svn commit: r346270 - head/cddl/usr.sbin/zfsd

2019-04-16 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Apr 16 12:25:15 2019
New Revision: 346270
URL: https://svnweb.freebsd.org/changeset/base/346270

Log:
  Drop -g from CFLAGS for zfsd(8).  No idea why it was ever there.
  
  Reviewed by:  kib, ngie, asomers
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D19915

Modified:
  head/cddl/usr.sbin/zfsd/Makefile.common

Modified: head/cddl/usr.sbin/zfsd/Makefile.common
==
--- head/cddl/usr.sbin/zfsd/Makefile.common Tue Apr 16 11:37:15 2019
(r346269)
+++ head/cddl/usr.sbin/zfsd/Makefile.common Tue Apr 16 12:25:15 2019
(r346270)
@@ -30,7 +30,7 @@ INCFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/ut
 INCFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
 INCFLAGS+= -I${SRCTOP}/cddl/usr.sbin
 
-CFLAGS+= -g -DNEED_SOLARIS_BOOLEAN ${INCFLAGS}
+CFLAGS+= -DNEED_SOLARIS_BOOLEAN ${INCFLAGS}
 
 LIBADD+=   devdctl zfs zfs_core util geom bsdxml sbuf nvpair uutil
 
___
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: r346269 - head/sys/fs/ext2fs

2019-04-16 Thread Fedor Uporov
Author: fsu
Date: Tue Apr 16 11:37:15 2019
New Revision: 346269
URL: https://svnweb.freebsd.org/changeset/base/346269

Log:
  ext2fs: Initial version of DTrace support.
  
  Commit forgotten file.
  
  Reviewed by:pfg, gnn
  MFC after:  1 week
  
  Differential Revision:https://reviews.freebsd.org/D19848

Modified:
  head/sys/fs/ext2fs/ext2_extents.c

Modified: head/sys/fs/ext2fs/ext2_extents.c
==
--- head/sys/fs/ext2fs/ext2_extents.c   Tue Apr 16 11:30:41 2019
(r346268)
+++ head/sys/fs/ext2fs/ext2_extents.c   Tue Apr 16 11:37:15 2019
(r346269)
@@ -37,6 +37,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -46,9 +47,17 @@
 #include 
 #include 
 
+SDT_PROVIDER_DECLARE(ext2fs);
+/*
+ * ext2fs trace probe:
+ * arg0: verbosity. Higher numbers give more verbose messages
+ * arg1: Textual message
+ */
+SDT_PROBE_DEFINE2(ext2fs, , trace, extents, "int", "char*");
+
 static MALLOC_DEFINE(M_EXT2EXTENTS, "ext2_extents", "EXT2 extents");
 
-#ifdef EXT2FS_DEBUG
+#ifdef EXT2FS_PRINT_EXTENTS
 static void
 ext4_ext_print_extent(struct ext4_extent *ep)
 {
@@ -230,22 +239,22 @@ ext4_ext_check_header(struct inode *ip, struct ext4_ex
fs = ip->i_e2fs;
 
if (eh->eh_magic != EXT4_EXT_MAGIC) {
-   error_msg = "invalid magic";
+   error_msg = "header: invalid magic";
goto corrupted;
}
if (eh->eh_max == 0) {
-   error_msg = "invalid eh_max";
+   error_msg = "header: invalid eh_max";
goto corrupted;
}
if (eh->eh_ecount > eh->eh_max) {
-   error_msg = "invalid eh_entries";
+   error_msg = "header: invalid eh_entries";
goto corrupted;
}
 
return (0);
 
 corrupted:
-   ext2_fserr(fs, ip->i_uid, error_msg);
+   SDT_PROBE2(ext2fs, , trace, extents, 1, error_msg);
return (EIO);
 }
 
@@ -412,7 +421,7 @@ ext4_ext_find_extent(struct inode *ip, daddr_t block,
 
ppos++;
if (ppos > depth) {
-   ext2_fserr(fs, ip->i_uid,
+   SDT_PROBE2(ext2fs, , trace, extents, 1,
"ppos > depth => extent corrupted");
error = EIO;
brelse(bp);
@@ -643,13 +652,13 @@ ext4_ext_insert_index(struct inode *ip, struct ext4_ex
fs = ip->i_e2fs;
 
if (lblk == path->ep_index->ei_blk) {
-   ext2_fserr(fs, ip->i_uid,
+   SDT_PROBE2(ext2fs, , trace, extents, 1,
"lblk == index blk => extent corrupted");
return (EIO);
}
 
if (path->ep_header->eh_ecount >= path->ep_header->eh_max) {
-   ext2_fserr(fs, ip->i_uid,
+   SDT_PROBE2(ext2fs, , trace, extents, 1,
"ecout > maxcount => extent corrupted");
return (EIO);
}
@@ -667,7 +676,7 @@ ext4_ext_insert_index(struct inode *ip, struct ext4_ex
memmove(idx + 1, idx, len * sizeof(struct ext4_extent_index));
 
if (idx > EXT_MAX_INDEX(path->ep_header)) {
-   ext2_fserr(fs, ip->i_uid,
+   SDT_PROBE2(ext2fs, , trace, extents, 1,
"index is out of range => extent corrupted");
return (EIO);
}
@@ -736,7 +745,7 @@ ext4_ext_split(struct inode *ip, struct ext4_extent_pa
 * We will split at current extent for now.
 */
if (path[depth].ep_ext > EXT_MAX_EXTENT(path[depth].ep_header)) {
-   ext2_fserr(fs, ip->i_uid,
+   SDT_PROBE2(ext2fs, , trace, extents, 1,
"extent is out of range => extent corrupted");
return (EIO);
}
@@ -773,7 +782,7 @@ ext4_ext_split(struct inode *ip, struct ext4_extent_pa
ex = EXT_FIRST_EXTENT(neh);
 
if (path[depth].ep_header->eh_ecount != path[depth].ep_header->eh_max) {
-   ext2_fserr(fs, ip->i_uid,
+   SDT_PROBE2(ext2fs, , trace, extents, 1,
"extents count out of range => extent corrupted");
error = EIO;
goto cleanup;
@@ -1362,7 +1371,7 @@ ext4_ext_rm_leaf(struct inode *ip, struct ext4_extent_
 
eh = path[depth].ep_header;
if (!eh) {
-   ext2_fserr(ip->i_e2fs, ip->i_uid,
+   SDT_PROBE2(ext2fs, , trace, extents, 1,
"bad header => extent corrupted");
return (EIO);
}
@@ -1449,7 +1458,8 @@ ext4_read_extent_tree_block(struct inode *ip, e4fs_dad
 
eh = ext4_ext_block_header(bp->b_data);
if (eh->eh_depth != depth) {
-   ext2_fserr(fs, ip->i_uid, "unexpected eh_depth");
+   SDT_PROBE2(ext2fs, , trace, extents, 1,
+   "unexpected eh_depth");
goto err;
}
 

svn commit: r346268 - stable/12/lib/libc/string

2019-04-16 Thread Ed Maste
Author: emaste
Date: Tue Apr 16 11:30:41 2019
New Revision: 346268
URL: https://svnweb.freebsd.org/changeset/base/346268

Log:
  MFC r346054: libc: update strstr implementation to match musl
  
  musl commits:
  122d67f846cb0be2c9e1c3880db9eb9545bbe38c
  0239cd0681e889a269fb7691f60e81ef8d081e6b
  8f5a820d147da36bcdbddd201b35d293699dacd8
  
  Submitted by: David CARLIER 
  Obtained from:musl
  MFC after:1 week

Modified:
  stable/12/lib/libc/string/strstr.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libc/string/strstr.c
==
--- stable/12/lib/libc/string/strstr.c  Tue Apr 16 11:20:10 2019
(r346267)
+++ stable/12/lib/libc/string/strstr.c  Tue Apr 16 11:30:41 2019
(r346268)
@@ -143,9 +143,8 @@ static char *twoway_strstr(const unsigned char *h, con
/* Check last byte first; advance by shift on mismatch */
if (BITOP(byteset, h[l-1], &)) {
k = l-shift[h[l-1]];
-   //printf("adv by %zu (on %c) at [%s] (%zu;l=%zu)\n", k, 
h[l-1], h, shift[h[l-1]], l);
if (k) {
-   if (mem0 && mem && k < p) k = l-p;
+   if (k < mem) k = mem;
h += k;
mem = 0;
continue;
___
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: r346267 - head/sys/fs/ext2fs

2019-04-16 Thread Fedor Uporov
Author: fsu
Date: Tue Apr 16 11:20:10 2019
New Revision: 346267
URL: https://svnweb.freebsd.org/changeset/base/346267

Log:
  ext2fs: Initial version of DTrace support.
  
  Reviewed by:pfg, gnn
  MFC after:  1 week
  
  Differential Revision:https://reviews.freebsd.org/D19848

Modified:
  head/sys/fs/ext2fs/ext2_alloc.c
  head/sys/fs/ext2fs/ext2_csum.c
  head/sys/fs/ext2fs/ext2_extattr.c
  head/sys/fs/ext2fs/ext2_extents.h
  head/sys/fs/ext2fs/ext2_extern.h
  head/sys/fs/ext2fs/ext2_hash.c
  head/sys/fs/ext2fs/ext2_htree.c
  head/sys/fs/ext2fs/ext2_inode.c
  head/sys/fs/ext2fs/ext2_inode_cnv.c
  head/sys/fs/ext2fs/ext2_lookup.c
  head/sys/fs/ext2fs/ext2_subr.c
  head/sys/fs/ext2fs/ext2_vfsops.c
  head/sys/fs/ext2fs/ext2_vnops.c
  head/sys/fs/ext2fs/fs.h

Modified: head/sys/fs/ext2fs/ext2_alloc.c
==
--- head/sys/fs/ext2fs/ext2_alloc.c Tue Apr 16 09:44:46 2019
(r346266)
+++ head/sys/fs/ext2fs/ext2_alloc.c Tue Apr 16 11:20:10 2019
(r346267)
@@ -42,6 +42,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -55,6 +56,23 @@
 #include 
 #include 
 
+SDT_PROVIDER_DEFINE(ext2fs);
+/*
+ * ext2fs trace probe:
+ * arg0: verbosity. Higher numbers give more verbose messages
+ * arg1: Textual message
+ */
+SDT_PROBE_DEFINE2(ext2fs, , alloc, trace, "int", "char*");
+SDT_PROBE_DEFINE3(ext2fs, , alloc, ext2_reallocblks_realloc,
+"ino_t", "e2fs_lbn_t", "e2fs_lbn_t");
+SDT_PROBE_DEFINE1(ext2fs, , alloc, ext2_reallocblks_bap, "uint32_t");
+SDT_PROBE_DEFINE1(ext2fs, , alloc, ext2_reallocblks_blkno, "e2fs_daddr_t");
+SDT_PROBE_DEFINE2(ext2fs, , alloc, ext2_b_bitmap_validate_error, "char*", 
"int");
+SDT_PROBE_DEFINE3(ext2fs, , alloc, ext2_nodealloccg_bmap_corrupted,
+"int", "daddr_t", "char*");
+SDT_PROBE_DEFINE2(ext2fs, , alloc, ext2_blkfree_bad_block, "ino_t", 
"e4fs_daddr_t");
+SDT_PROBE_DEFINE2(ext2fs, , alloc, ext2_vfree_doublefree, "char*", "ino_t");
+
 static daddr_t ext2_alloccg(struct inode *, int, daddr_t, int);
 static daddr_t ext2_clusteralloc(struct inode *, int, daddr_t, int);
 static u_long  ext2_dirpref(struct inode *);
@@ -128,8 +146,7 @@ ext2_alloc(struct inode *ip, daddr_t lbn, e4fs_daddr_t
}
 nospace:
EXT2_UNLOCK(ump);
-   ext2_fserr(fs, cred->cr_uid, "filesystem full");
-   uprintf("\n%s: write failed, filesystem is full\n", fs->e2fs_fsmnt);
+   SDT_PROBE2(ext2fs, , alloc, trace, 1, "cannot allocate data block");
return (ENOSPC);
 }
 
@@ -147,8 +164,10 @@ ext2_alloc_meta(struct inode *ip)
EXT2_LOCK(ip->i_ump);
blk = ext2_hashalloc(ip, ino_to_cg(fs, ip->i_number), 0, fs->e2fs_bsize,
ext2_alloccg);
-   if (0 == blk)
+   if (0 == blk) {
EXT2_UNLOCK(ip->i_ump);
+   SDT_PROBE2(ext2fs, , alloc, trace, 1, "cannot allocate meta 
block");
+   }
 
return (blk);
 }
@@ -289,10 +308,8 @@ ext2_reallocblks(struct vop_reallocblks_args *ap)
 * block pointers in the inode and indirect blocks associated
 * with the file.
 */
-#ifdef DEBUG
-   printf("realloc: ino %ju, lbns %jd-%jd\n\told:",
-   (uintmax_t)ip->i_number, (intmax_t)start_lbn, (intmax_t)end_lbn);
-#endif /* DEBUG */
+   SDT_PROBE3(ext2fs, , alloc, ext2_reallocblks_realloc,
+   ip->i_number, start_lbn, end_lbn);
blkno = newblk;
for (bap = [soff], i = 0; i < len; i++, blkno += fs->e2fs_fpb) {
if (i == ssize) {
@@ -303,9 +320,7 @@ ext2_reallocblks(struct vop_reallocblks_args *ap)
if (buflist->bs_children[i]->b_blkno != fsbtodb(fs, *bap))
panic("ext2_reallocblks: alloc mismatch");
 #endif
-#ifdef DEBUG
-   printf(" %d,", *bap);
-#endif /* DEBUG */
+   SDT_PROBE1(ext2fs, , alloc, ext2_reallocblks_bap, *bap);
*bap++ = blkno;
}
/*
@@ -341,20 +356,13 @@ ext2_reallocblks(struct vop_reallocblks_args *ap)
/*
 * Last, free the old blocks and assign the new blocks to the buffers.
 */
-#ifdef DEBUG
-   printf("\n\tnew:");
-#endif /* DEBUG */
for (blkno = newblk, i = 0; i < len; i++, blkno += fs->e2fs_fpb) {
ext2_blkfree(ip, dbtofsb(fs, buflist->bs_children[i]->b_blkno),
fs->e2fs_bsize);
buflist->bs_children[i]->b_blkno = fsbtodb(fs, blkno);
-#ifdef DEBUG
-   printf(" %d,", blkno);
-#endif /* DEBUG */
+   SDT_PROBE1(ext2fs, , alloc, ext2_reallocblks_blkno, blkno);
}
-#ifdef DEBUG
-   printf("\n");
-#endif /* DEBUG */
+
return (0);
 
 fail:
@@ -481,8 +489,7 @@ ext2_valloc(struct vnode *pvp, int mode, struct ucred 
 
 noinodes:
EXT2_UNLOCK(ump);
-   ext2_fserr(fs, cred->cr_uid, "out of inodes");
-   uprintf("\n%s: create/symlink failed, no inodes free\n", 
fs->e2fs_fsmnt);
+   SDT_PROBE2(ext2fs, , 

svn commit: r346266 - head/sys/arm/conf

2019-04-16 Thread Peter Jeremy
Author: peterj
Date: Tue Apr 16 09:44:46 2019
New Revision: 346266
URL: https://svnweb.freebsd.org/changeset/base/346266

Log:
  Specify correct Ethernet phy for RPI-B
  
  Correct a typo in the RPI-B ethernet config - the RPi-B includes a
  SMC LAN9512 USB bridge and Ethernet 10/100 NIC/phy.  The phy part of
  this is supported by smscphy.
  
  Tested On: RPi1 Model B
  
  Approved by:  grog, jhb (mentors)
  MFC after:3 days

Modified:
  head/sys/arm/conf/RPI-B

Modified: head/sys/arm/conf/RPI-B
==
--- head/sys/arm/conf/RPI-B Tue Apr 16 09:42:42 2019(r346265)
+++ head/sys/arm/conf/RPI-B Tue Apr 16 09:44:46 2019(r346266)
@@ -77,7 +77,7 @@ deviceda
 device umass
 
 # USB ethernet support
-device smcphy
+device smscphy
 device mii
 device smsc
 
___
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: r346265 - head/sys/arm/broadcom/bcm2835

2019-04-16 Thread Peter Jeremy
Author: peterj
Date: Tue Apr 16 09:42:42 2019
New Revision: 346265
URL: https://svnweb.freebsd.org/changeset/base/346265

Log:
  Fix cpufreq(4) on RPI-B
  
  Since r324184 the root node compatible for the original Raspberry Pi
  is "brcm,bcm2835", add it to the compatible list of bcm2835_cpufreq.
  
  Tested On: RPi1 Model B
  
  Note that the default Das U-Boot FDT does not include a cpus clause
  so actually adding a bcm2835_cpufreq device requires adding a FDT
  overlay defining the cpu.
  
  Approved by:  grog, jhb (mentors)
  MFC after:3 days

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c Tue Apr 16 05:11:39 
2019(r346264)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c Tue Apr 16 09:42:42 
2019(r346265)
@@ -126,6 +126,7 @@ static struct ofw_compat_data compat_data[] = {
{ "broadcom,bcm2835-vc",1 },
{ "broadcom,bcm2708-vc",1 },
{ "brcm,bcm2709",   1 },
+   { "brcm,bcm2835",   1 },
{ "brcm,bcm2836",   1 },
{ "brcm,bcm2837",   1 },
{ NULL, 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"