]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoMFC r362128:
Konstantin Belousov [Fri, 19 Jun 2020 10:33:45 +0000 (10:33 +0000)]
MFC r362128:
rtld: set osrel when in the direct exec mode.

3 years agoMFC r362078:
Ravi Pokala [Fri, 19 Jun 2020 05:54:15 +0000 (05:54 +0000)]
MFC r362078:

Decode the "LACP Fast Timeout" LAGG option flag

r286700 added the "lacp_fast_timeout" option to `ifconfig', but we forgot to
include the new option in the string used to decode the option bits. Add
"LACP_FAST_TIMO" to LAGG_OPT_BITS.

Also, s/LAGG_OPT_LACP_TIMEOUT/LAGG_OPT_LACP_FAST_TIMO/g , to be clearer that
the flag indicates "Fast Timeout" mode.

3 years agoMFC r362100: Fix config_intrhook leak on initial reset failure.
Alexander Motin [Fri, 19 Jun 2020 00:45:29 +0000 (00:45 +0000)]
MFC r362100: Fix config_intrhook leak on initial reset failure.

3 years agoMFC r361835: Add bunch of HDA controller and codec IDs.
Alexander Motin [Fri, 19 Jun 2020 00:44:35 +0000 (00:44 +0000)]
MFC r361835: Add bunch of HDA controller and codec IDs.

3 years agoMFC r361816: Limit AHCI to only one MSI if more is not needed.
Alexander Motin [Fri, 19 Jun 2020 00:43:44 +0000 (00:43 +0000)]
MFC r361816: Limit AHCI to only one MSI if more is not needed.

My AMD Ryzen system has 4 AHCI controllers, each supporting 16 MSI vectors.
Since two of the controllers have only one SATA port, limit to single MSI
saves system 30 interrupt vectors for free.

It may be possible to also limit number of MSI vectors to 4 and 8 for the
other two controllers, but according to the AHCI specification after that
controllers may revert to only one vector, that would be a bigger loss to
risk.

3 years agoMFC r358555, r358799-r358800
Emmanuel Vadot [Thu, 18 Jun 2020 23:31:56 +0000 (23:31 +0000)]
MFC r358555, r358799-r358800

r358555:
cpufreq_dt: Improve multiple opp support

When looking for cpu with the same OPP starts from the root /cpus node
so each instance of cpufreq_dt will now each cpu with the same operating
point.
Also test that the node we are testing have the property "device_type" set
to be equal to "cpu".
While here add more debug printfs (off by defaults).

r358799:
cpufreq_dt: Fix r358555

Before skipping the current cpu when trying to find the ones that
have the same opp, record that this one have this opp.

Reported by: mmel
X-MFC-With: r358555

r358800:
cpufreq: Unbreak build.

3 years agoMFC r356888, r356891
Emmanuel Vadot [Thu, 18 Jun 2020 23:23:21 +0000 (23:23 +0000)]
MFC r356888, r356891

r356888:
arm: allwinner: Fix padconf for interrupts information

Add a eint_bank member to the allwinner_pins structure.
On Allwinner SoCs not all pins can do interrupt.
Older SoC (A10/A13 and A20) there is a maximum number of interrupts
set to 32 and all the configuration is done in the same registers.
While on "newer" SoCs (>=A31) interrupts registers are splitted per
pin bank (i.e. all interrupts available in bank B will be configured
with a sets of registers and the one in bank G in another set).
While here set the names to all interrupts function to
pX_eintY where X is the bank name and Y the interrupt number.

To whom ever in the future look at the H5 manual and notice that the bank F
have interrupts support : This isn't true, trust me.

r356891:
arm: allwinner: Add GPIO Interrupt support

Not all pins in Allwinner have interrupts support so we rely
on the padconf data to add the proper caps when pin_getcaps is called.
The pin is switch to the specific "eint" function during setup_intr and
switched back to its old function in teardown_intr.
Only INTR_MAP_DATA_GPIO is supported for now.

3 years agoMFC r356276, r356609-r356610, r356637, r356798-r356800, r356802
Emmanuel Vadot [Thu, 18 Jun 2020 23:21:12 +0000 (23:21 +0000)]
MFC r356276, r356609-r356610, r356637, r356798-r356800, r356802

r356276:
arm: allwinner: aw_spi: Call bus_generic_attach

This is needed when the driver is compiled into the kernel.
When compiled as a module this will be called from another
code path as we also depend on ofw_spibus.

r356609:
twsi: Rework how we handle the i2c messages

We use to handle each message separately in i2c_transfer but that cannot
work with message with NOSTOP as it confuses the controller that we disable
the interrupts and start a new message.
Handle every message in the interrupt handler and fire a new start condition
if the previous message have NOSTOP, the controller understand this as a
repeated start.
This fixes booting on Allwinner A10/A20 platform where before the i2c controller
used to write 0 to the PMIC register that control the regulators as it though that
this was the continuation of the write message.

Tested on:   A20 BananaPi, Cubieboard 1 (kevans)
Reported by: kevans

r356610:
arm: allwinner: axp209: Add regnode_status method

This allow consumers to check if the regulator is enable or not.

r356637:
arm64: allwinner: dtso: Add spi0 spigen DTSO

This overlays can be used on A64 board to use spigen and spi(8)
on the spi0 pins.

Tested On:  Pine64-LTS, A64-Olinuxino

Submitted by: Gary Otten <gdotten@gmail.com>

r356798:
axp8xx: Add missing voltage regulators offset

This lead to writing the desired voltage value to the wrong register.

r356799:
axp8xx: Add a regnode_init method

This method will set the desired voltaged based on values in the DTS.
It will not enable the regulator, this is the job of either a consumer
or regnode_set_constraint SYSINIT if the regulator is boot_on or always_on.

r356800:
arm: allwinner: Add support for bank supply

Each GPIO bank is powered by a different pin and so can be powered at different
voltage from different regulators.
Add a new config that now hold the pinmux data and the banks available on each
SoCs.
Since the aw_gpio driver being also the pinmux one it's attached before the PMIC
so add a config_intrhook_oneshot function that will enable the needed regulators
when the system is fully functional.

r356802:
arm: allwinner: ahci: target-supply is optional

The target-supply regulator is optional so don't fail if it's not present.
While here disable the clock on detach.

X-MFC-With: 356600

3 years agoMFC r353528-r353529
Emmanuel Vadot [Thu, 18 Jun 2020 23:18:47 +0000 (23:18 +0000)]
MFC r353528-r353529

r353528:
arm64: allwinner: Add Allwinner H6 Support

This adds support for H6 SoC.
Add a CCU driver for H6 that support all PLLs and most of the clocks
that we are intersted in for now (i2c, mmc, usb, etc ...)

r353529:
arm64: allwinner: Add H6 GPIO/Pinctrl driver

This adds support for Allwinner H6 GPIO and pinctrl driver for
both the main pinctrl unit and the 'r_' one.

3 years agoservices: Add SSDP to service database
Pedro F. Giffuni [Thu, 18 Jun 2020 22:10:06 +0000 (22:10 +0000)]
services: Add SSDP to service database

This is used for UPnP and is registered in the IANA database.

PR: 241573

3 years agoMFC r349584, r349728, r349731, r350440, r350443, r351185, r353493, r353575, r355625...
Emmanuel Vadot [Thu, 18 Jun 2020 21:44:49 +0000 (21:44 +0000)]
MFC r349584, r349728, r349731, r350440, r350443, r351185, r353493, r353575, r355625, r355627, r355629, r356813

r349584:
Since r349571 we need all the accessor to be present for set or get
otherwise we panic.
dwmmc don't handle VCCQ (voltage for the IO line of the SD/eMMC) or
TIMING.
Add the needed accessor in the {read,write}_ivar functions.

Reviewed by: imp (previous version)

r349728 by imp:
Implement missing MMCBR ivars

All MMCBR bridges have to implement all the MMCBR variables. This
implements them for everybody that currently doesn't.

A common routine for this should be written.

r349731 by imp:
Fix cut-and-pasto that slipped through my testing.

r350440 by br:
Add support for the SD/MMC controller found in Terasic DE10-Pro
(an Intel Stratix 10 GX/SX FPGA Development Kit).

Set the bus speed manually due to lack of clock management support.

Sponsored by: DARPA, AFRL

r350443 by br:
Fix MMCCAM kernel build.

Sponsored by: DARPA, AFRL

r351185 by mmel:
Enhance support of extres in dwmmc driver.
Handle all clocks, regulators and resets defined by dwmmc bindings.

r353493 by br:
Fix the driver attachment in cases when the external resource devices
(resets, regulators, clocks) are not available.

Rely on a system initialization done by a bootloader in that cases.

This fixes operation on Terasic DE10-Pro (an Intel Stratix 10
development kit).

Sponsored by: DARPA, AFRL

r353575 by br:
Fix dwmmc(4) driver attachment when ext_resources are not present.

Ignore only ENOENT (no DTS properties found) and ENODEV (driver not
present) non-zero return values from ext_resources.

Reviewed by: manu
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D22043

r355625:
dwmmc: Add a detach method

This method will disable the regulators, clocks and assert the reset of
the module. It will also detach it's children (the mmc device) and release
it's resources.
While here enable the regulators on attach as we need them to power up
the sdcard or emmc.

r355627:
dwmmc: Handle the card detect interrupt

The driver used to always add the mmc device as it's child even
it no card was detected. Add a function that will detect if the
card is present or not and that will attach/detach the mmc device.
The function is either call on attach (as we won't have the interrupt
fired) or from two taskqueues. The first taskqueue will directly call
the function when the sdcard was present and is now removed and the other
one will delay a bit the attach when we didn't had a card and now have one.
This is mostly based on comments from the sdhci driver where it describe
a situation when the CD pin is detected before the others pins are connected.

r355629:
dwmmc: Use device_delete_children

Instead of first detaching the children(s) and then delete them,
use the device_delete_children function that does all of that.

Suggested by: ian

r356813:
dwmmc: Remove max_hz from the softc

We never use it so directly set the value to the mmc host structure.

3 years agoMFC r360504 (by imp): Style(9) nit: put function name at start of line.
Alexander Motin [Thu, 18 Jun 2020 20:25:42 +0000 (20:25 +0000)]
MFC r360504 (by imp): Style(9) nit: put function name at start of line.

3 years agoMFC r360503 (by imp): Move / reword a comment.
Alexander Motin [Thu, 18 Jun 2020 20:23:46 +0000 (20:23 +0000)]
MFC r360503 (by imp): Move / reword a comment.

Explain what we're doing with mapping CAM's notion of a LUN to NVMe's
notion of a namespace.

3 years agoMFC r352925: xen/ctrl: acknowledge all control requests
Roger Pau Monné [Thu, 18 Jun 2020 15:15:04 +0000 (15:15 +0000)]
MFC r352925: xen/ctrl: acknowledge all control requests
MFC r357616: xen/console: fix priority of Xen console
MFC r361274: dev/xenstore: fix return with locks held
Note this should be dev/evtchn not dev/xenstore.
MFC r361578: xenpv: do not use low 1MB for Xen mappings on i386
MFC r361580: xen/control: short circuit xctrl_on_watch_event on spurious event

Those are all Xen related fixes or minor improvements that have been sitting on
current for a reasonable time without complaints.

Sponsored by: Citrix Systems R&D

3 years agoMFC r361828:
Hans Petter Selasky [Thu, 18 Jun 2020 10:53:40 +0000 (10:53 +0000)]
MFC r361828:
Ensure pci_channel_offline() actually queries the PCI register space,
and not only the software cache of that register.  Else
pci_channel_offline() won't detect that the PCI device is gone when
using the LinuxKPI.

Sponsored by: Mellanox Technologies

3 years agoMFC r361724:
Hans Petter Selasky [Thu, 18 Jun 2020 10:49:49 +0000 (10:49 +0000)]
MFC r361724:
Implement __is_constexpr() function macro in the LinuxKPI.
Bump the FreeBSD version.

Sponsored by: Mellanox Technologies

3 years agoMFC r361723:
Hans Petter Selasky [Thu, 18 Jun 2020 10:46:58 +0000 (10:46 +0000)]
MFC r361723:
Implement struct_size() function macro in the LinuxKPI.

Sponsored by: Mellanox Technologies

3 years agoMFC r361722:
Hans Petter Selasky [Thu, 18 Jun 2020 10:45:30 +0000 (10:45 +0000)]
MFC r361722:
Implement BUILD_BUG_ON_ZERO() in the LinuxKPI.
Tested using gcc and clang.

Sponsored by: Mellanox Technologies

3 years agoMFC r362045:
Hans Petter Selasky [Thu, 18 Jun 2020 10:38:02 +0000 (10:38 +0000)]
MFC r362045:
Make sure packets generated by raw IP code is let through by mlx5en(4).

Allow the TCP header to reside in the mbuf following the IP header.
Else such packets will get dropped.

Backtrace:
mlx5e_sq_xmit()
mlx5e_xmit()
ether_output_frame()
ether_output()
ip_output_send()
ip_output()
rip_output()
sosend_generic()
sosend()
kern_sendit()
sendit()
sys_sendto()
amd64_syscall()
fast_syscall_common()

Sponsored by: Mellanox Technologies

3 years agoMFC r362044:
Hans Petter Selasky [Thu, 18 Jun 2020 10:19:37 +0000 (10:19 +0000)]
MFC r362044:
Extend use of unlikely() in the fast path, in mlx5en(4).

Typically the TCP/IP headers fit within the first mbuf and should not
trigger any of the error cases. Use unlikely() for these cases.

No functional change.

Sponsored by: Mellanox Technologies

3 years agoMFC r362043:
Hans Petter Selasky [Thu, 18 Jun 2020 10:08:41 +0000 (10:08 +0000)]
MFC r362043:
Use const keyword when parsing the TCP/IP header in the fast path in mlx5en(4).

When parsing the TCP/IP header in the fast path, make it clear by using
the const keyword, no fields are to be modified inside the transmitted
packet.

No functional change.

Sponsored by: Mellanox Technologies

3 years agoMFC r362076
Vincenzo Maffione [Thu, 18 Jun 2020 10:03:17 +0000 (10:03 +0000)]
MFC r362076

netmap: introduce netmap_kring_on()

This function returns NULL if the ring identified by
queue id and direction is in netmap mode. Otherwise
return the corresponding kring.
Use this function to replace vtnet_netmap_queue_on().

3 years agoMFC r361789: ipfw: unbreak matching with big table type flow.
Eugene Grosbein [Thu, 18 Jun 2020 08:37:56 +0000 (08:37 +0000)]
MFC r361789: ipfw: unbreak matching with big table type flow.

3 years agoMFC r361790: ifconfig(8): make it possible to filter output by interface group.
Eugene Grosbein [Thu, 18 Jun 2020 08:33:36 +0000 (08:33 +0000)]
MFC r361790: ifconfig(8): make it possible to filter output by interface group.

3 years agoMFC 361940:
Mateusz Piotrowski [Thu, 18 Jun 2020 07:34:30 +0000 (07:34 +0000)]
MFC 361940:

Use Fl instead of Ar for long flags

Also, bump date after r361935.

3 years agoMFC 361920:
Mateusz Piotrowski [Wed, 17 Jun 2020 21:51:32 +0000 (21:51 +0000)]
MFC 361920:

Document that /lib is always in the list of shared library paths

/lib was added to the list in r119011.

3 years agoMFC r362035:
Mark Johnston [Wed, 17 Jun 2020 18:47:59 +0000 (18:47 +0000)]
MFC r362035:
Remove the FIRMWARE_MAX limit.

3 years agoMFC r361995-r361996, r361999, r362111: posix_spawnp fixes
Kyle Evans [Wed, 17 Jun 2020 16:22:08 +0000 (16:22 +0000)]
MFC r361995-r361996, r361999, r362111: posix_spawnp fixes

r361995:
execvp: fix up the ENOEXEC fallback

If execve fails with ENOEXEC, execvp is expected to rebuild the command
with /bin/sh instead and try again.

The previous version did this, but overlooked two details:

argv[0] can conceivably be NULL, in which case memp would never get
terminated.  We must allocate no less than three * sizeof(char *) so we can
properly terminate at all times. For the non-NULL argv standard case, we
count all the non-NULL elements and actually skip the first argument, so we
end up capturing the NULL terminator in our bcopy().

The second detail is that the spec is actually worded such that we should
have been preserving argv[0] as passed to execvp:

"[...] executed command shall be as if the process invoked the sh utility
using execl() as follows:

execl(<shell path>, arg0, file, arg1, ..., (char *)0);

where <shell path> is an unspecified pathname for the sh utility, file is
the process image file, and for execvp(), where arg0, arg1, and so on
correspond to the values passed to execvp() in argv[0], argv[1], and so on."

So we make this change at this time as well, while we're already touching
it. We decidedly can't preserve a NULL argv[0] as this would be incredibly,
incredibly fragile, so we retain our legacy behavior of using "sh" for
argv[] in this specific instance.

Some light tests are added to try and detect some components of handling the
ENOEXEC fallback; posix_spawnp_enoexec_fallback_null_argv0 is likely not
100% reliable, but it at least won't raise false-alarms and it did result in
useful failures with pre-change libc on my machine.

This is a secondary change in D25038.

r361996:
execvPe: obviate the need for potentially large stack allocations

Some environments in which execvPe may be called have a limited amount of
stack available. Currently, it avoidably allocates a segment on the stack
large enough to hold PATH so that it may be mutated and use strsep() for
easy parsing. This logic is now rewritten to just operate on the immutable
string passed in and do the necessary math to extract individual paths,
since it will be copying out those segments to another buffer anyways and
piecing them together with the name for a full path.

Additional size is also needed for the stack in posix_spawnp(), because it
may need to push all of argv to the stack and rebuild the command with sh in
front of it. We'll make sure it's properly aligned for the new thread, but
future work should likely make rfork_thread a little easier to use by
ensuring proper alignment.

Some trivial cleanup has been done with a couple of error writes, moving
strings into char arrays for use with the less fragile sizeof().

r361999:
Add missing shell script from r361995

r362111:
posix_spawn: fix for some custom allocator setups

libc cannot assume that aligned_alloc and free come from jemalloc, or that
any application providing its own malloc and free is actually providing
aligned_alloc.

Switch back to malloc and just make sure we're passing a properly aligned
stack into rfork_thread, as an application perhaps can't reasonably replace
just malloc or just free without headaches.

This unbreaks ksh93 after r361996, which provides malloc/free but no
aligned_alloc.

3 years agoMFC r362037:
Mark Johnston [Wed, 17 Jun 2020 13:46:05 +0000 (13:46 +0000)]
MFC r362037:
Fix a couple of nits in Linux sysinfo(2) emulation.

3 years agoMFC r361770, r361784, r362032:
Konstantin Belousov [Wed, 17 Jun 2020 10:50:55 +0000 (10:50 +0000)]
MFC r361770, r361784, r362032:
Add pthread_getname_np() and pthread_setname_np() aliases for
pthread_get_name_np() and pthread_set_name_np().

3 years agoMFC r355324:
Emmanuel Vadot [Tue, 16 Jun 2020 20:44:51 +0000 (20:44 +0000)]
MFC r355324:

Import DTS files for riscv from Linux 5.4

Requested by:  mhorne

3 years agoMFC r354117:
Emmanuel Vadot [Tue, 16 Jun 2020 20:43:42 +0000 (20:43 +0000)]
MFC r354117:

arm64: rockchip: dts: Build the Khadas board DTS

We boot on thoses boards so build them.

Submitted by: s199p.wa1k9r@gmail.com
Differential Revision: https://reviews.freebsd.org/D22158

3 years agoMFC r356487:
Emmanuel Vadot [Tue, 16 Jun 2020 20:41:59 +0000 (20:41 +0000)]
MFC r356487:

regulator: fix regnode_method_get_voltage

This method is supposed to write the voltage into uvolt
and return an errno compatible value.

Reviewed by: mmel
Differential Revision: https://reviews.freebsd.org/D23006

3 years agoMFC r347441:
Emmanuel Vadot [Tue, 16 Jun 2020 20:38:55 +0000 (20:38 +0000)]
MFC r347441:

efibootmgr: Do not add the new boot entry in dry-run is specified

While here fix a typo.

Sponsored-by: Ampere Computing, LLC
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D20212

3 years agoMFC r351144:
Emmanuel Vadot [Tue, 16 Jun 2020 20:36:22 +0000 (20:36 +0000)]
MFC r351144:

arm64: Add EspressoBin DTB to the build

This will compile the espressobin dts to a dtb file and this will be
install in /boot/dtb/marvell/ during installkernel.

3 years agoMFC r347440, r347929-r347930, r349588
Emmanuel Vadot [Tue, 16 Jun 2020 20:35:01 +0000 (20:35 +0000)]
MFC r347440, r347929-r347930, r349588

r347440:
ahci: Check if bus is cache-coherent

We do this for FDT systems but not for ACPI ones.
Check the presence of the _CCA attribute.

Sponsored by: Ampere Computing, LLC
Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D20144

r347929:
pci: ecam: Do not warn on mismatch of bus_end

We cannot know the bus end number before parsing the MCFG table
so don't set the bus_end before that. If the MCFG table doesn't
exist we will set the configuration base address based on the _CBA
value and set the bus_end to the maximal number allowed by PCI.

Sponsored by: Ampere Computing, LLC

Differential Revision: https://reviews.freebsd.org/D20213

r347930:
pci: ecam: Correctly parse memory and IO region

When activating a resource do not compare the resource id to the adress.
Treat IO region as MEMORY region too.

Submitted by: Tuan Phan <tphan@amperecomputing.com> (Original Version)
Sponsored by: Ampere Computing, LLC
Differential Revision: https://reviews.freebsd.org/D20214

r349588:
arm64: efi: Map memory IO region as device

Reviewed by: andrew
Sponsored by: Ampere Computing, LLC

3 years agoMFC r346683:
Emmanuel Vadot [Tue, 16 Jun 2020 20:23:57 +0000 (20:23 +0000)]
MFC r346683:

bsdinstall: up the interface before calling dhclient

3 years agoMFC r346332:
Emmanuel Vadot [Tue, 16 Jun 2020 20:22:56 +0000 (20:22 +0000)]
MFC r346332:

ofw_graph: Add functions for graph bindings

Those functions are helpers to work on graph bindings.
graphs are mostly use with video related devices.
See https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/graph.txt?id=4436a3711e3249840e0679e92d3c951bcaf25515

Differential Revision: https://reviews.freebsd.org/D19877

3 years agoMFC r361977: libusb: improve compatibility
Kyle Evans [Tue, 16 Jun 2020 12:21:55 +0000 (12:21 +0000)]
MFC r361977: libusb: improve compatibility

Specifically, add LIBUSB_CLASS_PHYSICAL and the libusb_has_capability API.
Descriptions and functionality for these derived from the
documentation at [0].  The current set of capabilities are all supported by
libusb.

These were detected as missing after updating net/freerdp to 2.1.1, which
attempted to use both.

[0] http://libusb.sourceforge.net/api-1.0/group__libusb__misc.html

3 years agoMFC r361715:
Vladimir Kondratyev [Mon, 15 Jun 2020 22:41:28 +0000 (22:41 +0000)]
MFC r361715:

[psm] Do not disable trackpoint when hw.psm.elantech.touchpad_off is enabled

PR: 246117
Reported by: Alexander Sieg <ports@xanderio.de>

MFC r361718:

[psm] Workaround active PS/2 multiplexor hang

which happens on some laptops after returning to legacy multiplexing mode
at initialization stage.

PR: 242542
Reported by: Felix Palmen <felix@palmen-it.de>

3 years agoMFC r360624:
Vladimir Kondratyev [Mon, 15 Jun 2020 22:32:59 +0000 (22:32 +0000)]
MFC r360624:

[evdev] Add AT translated set1 scancodes for F-unlocked F1-12 keys.

"F lock" is a switch between two sets of scancodes for function keys F1-F12
found on some Logitech and Microsoft PS/2 keyboards [1]. When "F lock" is
pressed, then F1-F12 act as function keys and produce usual keyscans for
these keys. When "F lock" is depressed, F1-F12 produced the same keyscans
but prefixed with E0.
Some laptops use [2] E0-prefixed F1-F12 scancodes for non-standard keys.

[1] https://www.win.tue.nl/~aeb/linux/kbd/scancodes-6.html
[2] https://reviews.freebsd.org/D21565

MFC r360625:

[evdev] Sync event codes with Linux kernel 5.6

3 years agoMFC r353127:
Yuri Pankov [Mon, 15 Jun 2020 15:59:44 +0000 (15:59 +0000)]
MFC r353127:

Pre-generate Big5 charmap from CLDR data.

The one used previously was missing the characters in 0-127 range,
making various tools try to escape them in output.

PR: 235100
Reviewed by: bapt
Tested by: Ting-Wei Lan <lantw44@gmail.com>
Differential Revision: https://reviews.freebsd.org/D21794

3 years agoMFC r362095, r362145
Cy Schubert [Mon, 15 Jun 2020 03:10:53 +0000 (03:10 +0000)]
MFC r362095, r362145

r362095:
MFV r362082:

Update sqlite3 3.31.1 --> 3.32.0.

PR: 247149
Reported by: spam123@bitbert.com
Reminded by: emaste
Security: CVE-2020-11655, CVE-2020-13434, CVE-2020-13435,
CVE-2020-13630, CVE-2020-13631, CVE-2020-13632

r362145:
MFV r362143:

Update sqlite3 to 3.32.2 (3320200).

CVE-2020-11655: SQLite through 3.31.1 allows attackers to cause a denial of
service (segmentation fault) via a malformed window-function query because
the AggInfo object's initialization is mishandled.

CVE-2020-13434: SQLite through 3.32.0 has an integer overflow in
sqlite3_str_vappendf in printf.c.

CVE-2020-13435: SQLite through 3.32.0 has a segmentation fault in
sqlite3ExprCodeTarget in expr.c.

CVE-2020-13630: ext/fts3/fts3.c in SQLite before 3.32.0 has a
use-after-free in fts3EvalNextRow, related to the snippet feature

CVE-2020-13631: SQLite before 3.32.0 allows a virtual table to be renamed
to the name of one of its shadow tables, related to alter.c and build.c.

CVE-2020-13632: ext/fts3/fts3_snippet.c in SQLite before 3.32.0 ha s a
NULL pointer dereference via a crafted matchinfo() query.

PR: 247149
Reported by: spam123@bitbert.com
Security: vuxml: c4ac9c79-ab37-11ea-8b5e-b42e99a1b9c3
https://nvd.nist.gov/vuln/detail/CVE-2020-11655
https://nvd.nist.gov/vuln/detail/CVE-2020-13434
https://nvd.nist.gov/vuln/detail/CVE-2020-13435
https://nvd.nist.gov/vuln/detail/CVE-2020-13630
https://nvd.nist.gov/vuln/detail/CVE-2020-13631
https://nvd.nist.gov/vuln/detail/CVE-2020-13632

3 years agoMFC r361945, r362036:
Mark Johnston [Mon, 15 Jun 2020 03:02:59 +0000 (03:02 +0000)]
MFC r361945, r362036:
Stop computing a "sharedram" value when emulating Linux sysinfo(2).

3 years agoRevert r362187, it contained some unintended changes.
Mark Johnston [Mon, 15 Jun 2020 03:02:19 +0000 (03:02 +0000)]
Revert r362187, it contained some unintended changes.

This is a direct commit to stable/12.

3 years agoMFC r361945, r362036:
Mark Johnston [Mon, 15 Jun 2020 03:01:28 +0000 (03:01 +0000)]
MFC r361945, r362036:
Stop computing a "sharedram" value when emulating Linux sysinfo(2).

3 years agoUpdate Subversion and dependencies to 1.14.0 LTS.
Dimitry Andric [Sun, 14 Jun 2020 17:36:43 +0000 (17:36 +0000)]
Update Subversion and dependencies to 1.14.0 LTS.

MFC r344438 (by emaste):

svn: support building with WITH_PIE

Subversion builds and links against its own .a archives using local
rules, so did not benefit from with the WITH_PIE library support added
in r344179.  Apply the same _pie suffix locally.

Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D19246

MFC r352156 (by imp):

Remove directory empty after r266735

MFC r357299 (by cem):

contrib/apr: Remove scope leak UB

In apr_vformatter, the variable buf was declared inside a limited scope
region, but a pointer to it is leaked outside of that region and used
later.  This is undefined behavior.  Fix by moving the buf variable to
function scope.

Reported by: Coverity
CID: 1192541

MFC r357301 (by cem):

contrib/apr: Rip out bogus [CS]PRNG implementation

This construction used some relatively slow design involving SHA2; even if
it were fed real entropy (unclear; external to the design), it did not
handle fork in a safe way, and it was difficult to audit for correctness.
So just rip it out and use the very simple and known-correct arc4random(3)
interface in its place.

MFC r361677:

Change Makefiles under usr.bin/svn to make them easier to incrementally
update. No functional change intended.

MFC r361678:

Update apr to 1.7.0. See contrib/apr/CHANGES for a summary of changes.

MFC r361681:

Change more Makefiles under usr.bin/svn to make them easier to
incrementally update. No functional change intended.

MFC r361684 (by kevans):

apr: build some needed emulated 64-bit atomic bits after r361678

This should fix the build on armv{6,7}, mips, and mips64, which all need
emulated 64-bit atomics for apr.

MFC r361691:

Follow-up r361678 (update apr to 1.7.0) by also regenerating the apr
internal headers through the upstream configure script, with some minor
custom tweaks.

MFC r361692:

Update apr-util to 1.6.1. See contrib/apr-util/CHANGES for a summary of
changes.

MFC r361693:

Update Subversion to 1.14.0 LTS. See contrib/subversion/CHANGES for a
summary of changes, or for a more thorough overview:

https://subversion.apache.org/docs/release-notes/1.14

NOTE: there is no need to dump and reload repositories, and the working
copy format is still the same as Subversion 1.8 through 1.13.

Relnotes: yes

3 years agoMFC r362056:
Hans Petter Selasky [Sun, 14 Jun 2020 05:25:06 +0000 (05:25 +0000)]
MFC r362056:
Add missing range checks when receiving USB ethernet packets.

Found by: Ilja Van Sprundel, IOActive
Sponsored by: Mellanox Technologies

3 years agoMFC r361294:
Martin Matuska [Fri, 12 Jun 2020 22:59:59 +0000 (22:59 +0000)]
MFC r361294:
Update libarchive to 3.4.3

Relevant vendor changes:
  PR #1352: support negative zstd compression levels
  PR #1359: improve zstd version checking
  PR #1348: support RHT.security.selinux from GNU tar
  PR #1357: support for archives compressed with pzstd
  PR #1367: fix issues in acl tests
  PR #1372: child handling cleanup
  PR #1378: fix memory leak from passphrase callback

Relnotes: yes

3 years agoMFC r361562:
Alan Somers [Fri, 12 Jun 2020 20:39:42 +0000 (20:39 +0000)]
MFC r361562:

geli: fix a livelock during panic

During any kind of shutdown, kern_reboot calls geli's pre_sync event hook,
which tries to destroy all unused geli devices. But during a panic, geli
can't destroy any devices, because the scheduler is stopped, so it can't
switch threads. A livelock results, and the system never dumps core.

This commit fixes the problem by refusing to destroy any devices during
panic, used or otherwise.

PR: 246207
Reviewed by: jhb
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D24697

3 years agoMFC r361439:
Alan Somers [Fri, 12 Jun 2020 20:33:00 +0000 (20:33 +0000)]
MFC r361439:

[skip ci] ip.4: fix typos

3 years agoMFC r361401:
Alan Somers [Fri, 12 Jun 2020 20:32:26 +0000 (20:32 +0000)]
MFC r361401:

Fix issues with FUSE_ACCESS when default_permissions is disabled

This patch fixes two issues relating to FUSE_ACCESS when the
default_permissions mount option is disabled:

* VOP_ACCESS() calls with VADMIN set should never be sent to a fuse server
  in the form of FUSE_ACCESS operations. The FUSE protocol has no equivalent
  of VADMIN, so we must evaluate such things kernel-side, regardless of the
  default_permissions setting.

* The FUSE protocol only requires FUSE_ACCESS to be sent for two purposes:
  for the access(2) syscall and to check directory permissions for
  searchability during lookup. FreeBSD sends it much more frequently, due to
  differences between our VFS and Linux's, for which FUSE was designed. But
  this patch does eliminate several cases not required by the FUSE protocol:

  * for any FUSE_*XATTR operation
  * when creating a new file
  * when deleting a file
  * when setting timestamps, such as by utimensat(2).

* Additionally, when default_permissions is disabled, this patch removes one
  FUSE_GETATTR operation when deleting a file.

PR: 245689
Reported by: MooseFS FreeBSD Team <freebsd@moosefs.pro>
Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D24777

3 years agoMFC r361399:
Alan Somers [Fri, 12 Jun 2020 20:27:37 +0000 (20:27 +0000)]
MFC r361399:

Disable nullfs cacheing on top of fusefs

Nullfs cacheing can keep a large number of vnodes active.  That results in
more active FUSE file handles, causing some FUSE servers to use extra
resources.  Disable nullfs cacheing for fusefs, just like we already do for
NFSv4.

PR: 245688
Reported by: MooseFS FreeBSD Team <freebsd@moosefs.pro>

3 years agoMFC r361223:
Alan Somers [Fri, 12 Jun 2020 20:11:25 +0000 (20:11 +0000)]
MFC r361223:

fusefs: fix intermittency in some ENOENT tests

When a FUSE operation other than LOOKUP returns ENOENT, the kernel will
reclaim that vnode, resuling in a FUSE_FORGET being sent a short while
later.  Many of the ENOENT tests weren't expecting those FUSE_FORGET
operations.  They usually passed by luck since FUSE_FORGET is often delayed.
This commit adds appropriate expectations.

3 years agoMFC r351516: Announce PCI Segment Groups supported to PCI host _OSC.
Alexander Motin [Fri, 12 Jun 2020 15:37:55 +0000 (15:37 +0000)]
MFC r351516: Announce PCI Segment Groups supported to PCI host _OSC.

According to ACPI 6.3 specification:
    The OS sets this bit to 1 if it supports PCI Segment Groups as defined
    by the _SEG object, and access to the configuration space of devices
    in PCI Segment Groups as described by this specification.  Otherwise,
    the OS sets this bit to 0.

As far as I see we support both of those as PCI domains for quite a while.

3 years agoMFC r361135:
Fedor Uporov [Fri, 12 Jun 2020 13:54:41 +0000 (13:54 +0000)]
MFC r361135:
Restrict the max runp and runb return values in case of extents mapping.

This restriction already present in case of indirect mapping, do the same
in case of extents.

PR: 246182
Reported by: Teran McKinney

3 years agoMFC r361134:
Fedor Uporov [Fri, 12 Jun 2020 13:53:50 +0000 (13:53 +0000)]
MFC r361134:
Fix incorrect inode link count check in case of rename.

The check was incorrect because the directory inode link count have
min value 2 after dir_nlink extfs feature introduction.

3 years agoMFC r361133:
Fedor Uporov [Fri, 12 Jun 2020 13:52:11 +0000 (13:52 +0000)]
MFC r361133:
Add inode bitmap tail initialization.

Make ext2fs compatible with changes introduced in e2fsprogs v1.45.2.
Now the tail of inode bitmap is filled with 0xff pattern explicitly during
bitmap initialization phase to avoid e2fsck error like:
"Padding at end of inode bitmap is not set."

3 years agofix up r362086, MFC of r361620, add missing VOP_UNLOCK argument
Andriy Gapon [Fri, 12 Jun 2020 07:36:32 +0000 (07:36 +0000)]
fix up r362086, MFC of r361620, add missing VOP_UNLOCK argument

The useless argument has been dropped in head, but not in this branch.

Pointy hat to: avg

3 years agoMFC r361621: do not enable pci bridge decoding on resume until I/O windows are restored
Andriy Gapon [Fri, 12 Jun 2020 07:25:40 +0000 (07:25 +0000)]
MFC r361621: do not enable pci bridge decoding on resume until I/O windows are restored

PCI bus driver restores most but not all of a child PCI-PCI bridge
configuration.  The bridge's I/O windows are restored by pcib driver and
that happens later in time.  This can be problematic because the Command
register is restored before the windows are restored.  If the firmware
programs the windows incorrectly or even does not program them at all,
then the bridge can start claiming I/O cycles that are not intended for
it.  This will continue until the correct windows are restored.

I have observed this problem with a buggy BIOS where after resuming from
S3 an I/O port window of a PCI-PCI bridge was configured with zero base
and limit causing the bridge to claim 0x0 - 0xFFF port range.  That
interfered with ACPI port access including ACPI PM Timer at port 0x808,
thus wreaking havoc in the time keeping.

The solution is to restore the Command register of PCI-PCI bridges after
the windows are restored in pcib driver.  While here, I decided that for
other PCI device types (normal and cardbus) it's better to restore the
Command register after their BARs are restored.

3 years agoMFC r361620: corefile_open_last: don't keep a locked vnode while locking other ones
Andriy Gapon [Fri, 12 Jun 2020 07:23:27 +0000 (07:23 +0000)]
MFC r361620: corefile_open_last: don't keep a locked vnode while locking other ones

Consider this scenario:
- kern.corefile=/var/coredumps/%N.%U.%I.core
- multiple processes with the same name crash at the same time

It's possible that one process selects existing file N as oldvp while it
keeps looking for an unused file number.  Another process scans through
files and stumbles upon N.  That process would be blocked on the vnode
lock while holding the directory vnode exclusively locked.  The first
process would, thus, get blocked on the directory's vnode lock.

More generally, holding a file's vnode lock (oldvp) while trying to lock
its directory (for the next lookup) is a violation of the vnode locking
order.

I have observed this deadlock in the wild.

So, the change to keep oldvp "opened" but unlocked and to lock it again
only if it's to be returned as the result.
As kib noted, an alternative would be to keep the directory locked and
to use VOP_LOOKUP directly for scanning through existing core files.

3 years agoMFC r361957-r361960
Cy Schubert [Fri, 12 Jun 2020 01:03:51 +0000 (01:03 +0000)]
MFC r361957-r361960

r361957:
MFV r361936:

Upstream commit message:

[PATCH 1/3] WPS UPnP: Do not allow event subscriptions with URLs to
other networks

The UPnP Device Architecture 2.0 specification errata ("UDA errata
16-04-2020.docx") addresses a problem with notifications being allowed
to go out to other domains by disallowing such cases. Do such filtering
for the notification callback URLs to avoid undesired connections to
external networks based on subscriptions that any device in the local
network could request when WPS support for external registrars is
enabled (the upnp_iface parameter in hostapd configuration).

Obtained from: https://w1.fi/security/2020-1/\
0001-WPS-UPnP-Do-not-allow-event-subscriptions-with-URLs-.patch
Security: VU#339275 and CVE-2020-12695

r361958:
MFV r361937:

Upstream commit message:

[PATCH 2/3] WPS UPnP: Fix event message generation using a long URL path

More than about 700 character URL ended up overflowing the wpabuf used
for building the event notification and this resulted in the wpabuf
buffer overflow checks terminating the hostapd process. Fix this by
allocating the buffer to be large enough to contain the full URL path.
However, since that around 700 character limit has been the practical
limit for more than ten years, start explicitly enforcing that as the
limit or the callback URLs since any longer ones had not worked before
and there is no need to enable them now either.

Obtained from: https://w1.fi/security/2020-1/\
0002-WPS-UPnP-Fix-event-message-generation-using-a-long-U.patch
Security: VU#339275 and CVE-2020-12695

r361959:
MFV r361938:

Upstream commit message:

[PATCH 3/3] WPS UPnP: Handle HTTP initiation failures for events more
properly

While it is appropriate to try to retransmit the event to another
callback URL on a failure to initiate the HTTP client connection, there
is no point in trying the exact same operation multiple times in a row.
Replve the event_retry() calls with event_addr_failure() for these cases
to avoid busy loops trying to repeat the same failing operation.

These potential busy loops would go through eloop callbacks, so the
process is not completely stuck on handling them, but unnecessary CPU
would be used to process the continues retries that will keep failing
for the same reason.

Obtained from: https://w1.fi/security/2020-1/\
0003-WPS-UPnP-Handle-HTTP-initiation-failures-for-events-.patch
Security: VU#339275 and CVE-2020-12695

r361960:
Post CVE-2020-12695 cleanup patch:

Resolve a Linuxism to fix the build.

3 years agoMFC r361805: em(4): Add support for Comet Lake Mobile Platform
Eric Joyner [Fri, 12 Jun 2020 00:42:05 +0000 (00:42 +0000)]
MFC r361805: em(4): Add support for Comet Lake Mobile Platform

This change introduces Comet Lake Mobile Platform support in the e1000
driver along with shared code patches described below.

  - Cast return value of e1000_ltr2ns() to higher type to avoid overflow
  - Remove useless statement of assigning act_offset
  - Add initialization of identification LED
  - Fix flow control setup after connected standby:
    After connected standby the driver blocks resets during
    "AdapterStart" and skips flow control setup. This change adds
    condition in e1000_setup_link_ich8lan() to always setup flow control
    and to setup physical interface only when there is no need to block
    resets.

Sponsored by: Intel Corporation

3 years agoMFC r357061:
Kristof Provost [Thu, 11 Jun 2020 16:51:13 +0000 (16:51 +0000)]
MFC r357061:

pf: Apply kif flags to new group members

If we have a 'set skip on <ifgroup>' rule this flag it set on the group
kif, but must also be set on all members. pfctl does this when the rules
are set, but if groups are added afterwards we must also apply the flags
to the new member. If not, new group members will not be skipped until
the rules are reloaded.

3 years agoMFC r342660 (by scottl):
Mark Johnston [Thu, 11 Jun 2020 14:48:20 +0000 (14:48 +0000)]
MFC r342660 (by scottl):
Port over the SCSI sense handling fix from mpr(4) in r342528, and fix
whitespace to match.

PR: 223813
Reported and tested by: farrokhi

3 years agoMFC r361785, r361801 (by mckusick), r361803 (by se), r361814 (by mckusick),
Konstantin Belousov [Thu, 11 Jun 2020 11:36:49 +0000 (11:36 +0000)]
MFC r361785, r361801 (by mckusick), r361803 (by se), r361814 (by mckusick),
    r361875 (by mckusick):
Fixes for UFS fdatasync(2).

3 years agoMFC r361891:
Benedict Reuschling [Thu, 11 Jun 2020 10:00:56 +0000 (10:00 +0000)]
MFC r361891:

Add EXAMPLES to cover all flags except -f since it is analogous to -s.

An EXAMPLE section was adding with some basic examples that show the use of
uniq(1) with various flags.

Submitted by: fernape@
Approved by: bcr@
Relnotes: yes (EXAMPLE section for uniq(1))
Differential Revision: https://reviews.freebsd.org/D25149

3 years agoMFC r361788: superio: do not assume that current LDN cannot change after config exit
Andriy Gapon [Thu, 11 Jun 2020 05:28:08 +0000 (05:28 +0000)]
MFC r361788: superio: do not assume that current LDN cannot change after config exit

That assumption should be true when superio(4) uses the hardware
exlusively.  But it turns out to not hold on some real systems.
So, err on the side of correctness rather than performance.
Clear current_ldn in sio_conf_exit.

3 years agoMFC r361787: ifconfig.8: fix cpability and flag descriptions for list scan / sta
Andriy Gapon [Thu, 11 Jun 2020 05:26:23 +0000 (05:26 +0000)]
MFC r361787: ifconfig.8: fix cpability and flag descriptions for list scan / sta

Some capability descriptions under list scan actually described flags.
Some capability descriptions were missing.
Some flag descriptions under list sta actually described capabilites.

3 years agoMFC r361760
Vincenzo Maffione [Wed, 10 Jun 2020 20:05:53 +0000 (20:05 +0000)]
MFC r361760

netmap: vtnet: clean up rxsync disabled logs

3 years agoMFC r361759
Vincenzo Maffione [Wed, 10 Jun 2020 20:05:07 +0000 (20:05 +0000)]
MFC r361759

netmap: vtnet: fix race condition in rxsync

This change prevents a race that happens when rxsync dequeues
N-1 rx packets (with N being the size of the netmap rx ring).
In this situation, the loop exits without re-enabling the
rx interrupts, thus causing the VQ to stall.

3 years agoMFC r361758
Vincenzo Maffione [Wed, 10 Jun 2020 20:04:20 +0000 (20:04 +0000)]
MFC r361758

netmap: vtnet: add vtnrx_nm_refill index to receive queues

The new index tracks the next netmap slot that is going
to be enqueued into the virtqueue. The index is necessary
to prevent the receive VQ and the netmap rx ring from going
out of sync, considering that we never enqueue N slots, but
at most N-1. This change fixes a bug that causes the VQ
and the netmap ring to go out of sync after N-1 packets
have been received.

3 years agoMFC r361746
Vincenzo Maffione [Wed, 10 Jun 2020 20:03:11 +0000 (20:03 +0000)]
MFC r361746

netmap: vale: fix disabled logs

3 years agoMFC r361745
Vincenzo Maffione [Wed, 10 Jun 2020 20:02:38 +0000 (20:02 +0000)]
MFC r361745

netmap: vtnet: call netmap_rx_irq() under VQ lock

The netmap_rx_irq() function normally wakes up user-space threads
waiting for more packets. In this case, it is not necessary to
call it under the driver queue lock. However, if the interface is
attached to a VALE switch, netmap_rx_irq() ends up calling rxsync
on the interface (see netmap_bwrap_intr_notify()). Although
concurrent rxsyncs are serialized through the kring lock
(see nm_kr_tryget()), the lock acquire operation is not blocking.
As a result, it may happen that netmap_rx_irq() is called on
an RX ring while another instance is running, causing the
second call to fail, and received packets stall in the receive VQ.
We fix this issue by calling netmap_irx_irq() under the VQ lock.

3 years agoMFC r361744
Vincenzo Maffione [Wed, 10 Jun 2020 19:59:11 +0000 (19:59 +0000)]
MFC r361744

netmap: vtnet: honor NM_IRQ_RESCHED

The netmap_rx_irq() function may return NM_IRQ_RESCHED to inform the
driver that more work is pending, and that netmap expects netmap_rx_irq()
to be called again as soon as possible.
This change implements this behaviour in the vtnet driver.

3 years agoMFC r361698
Vincenzo Maffione [Wed, 10 Jun 2020 19:58:03 +0000 (19:58 +0000)]
MFC r361698

netmap: if_vtnet: avoid netmap ring wraparound

netmap assumes the one "slot" is left unused to distinguish
the empty ring and full ring conditions. This assumption was
violated by vtnet_netmap_rxq_populate().

3 years agoMFC r361697
Vincenzo Maffione [Wed, 10 Jun 2020 19:57:10 +0000 (19:57 +0000)]
MFC r361697

netmap: if_vtnet: replace vtnet_free_used()

The functionality contained in this function is duplicated,
as it is already available in vtnet_txq_free_mbufs()
and vtnet_rxq_free_mbufs().

3 years agoMFC r361696
Vincenzo Maffione [Wed, 10 Jun 2020 19:55:36 +0000 (19:55 +0000)]
MFC r361696

netmap: vtnet: fix RX virtqueue initialization bug

The vtnet_netmap_rxq_populate() function erroneously assumed
that kring->nr_hwcur = 0, i.e. the kring was in the initial
state. However, this is not always the case: for example,
when a vtnet reinit is triggered by some changes in the
interface flags or capenable.
This patch changes the behaviour of vtnet_netmap_kring_refill()
so that it always starts publishing the netmap buffers starting
from the current value of kring->nr_hwcur.

3 years agoMFC r361749:
Andrey V. Elsukov [Wed, 10 Jun 2020 13:06:13 +0000 (13:06 +0000)]
MFC r361749:
  Add if_reassign method to all tunneling interfaces.

  After r339550 tunneling interfaces have started handle appearing and
  disappearing of ingress IP address on the host system.
  When such interfaces are moving into VNET jail, they lose ability to
  properly handle ifaddr_event_ext event. And this leads to need to
  reconfigure tunnel to make it working again.

  Since moving an interface into VNET jail leads to removing of all IP
  addresses, it looks consistent, that tunnel configuration should also
  be cleared. This is what will do if_reassign method.

  Reported by: John W. O'Brien <john saltant com>

3 years agoMFC r361748:
Ryan Moeller [Wed, 10 Jun 2020 03:57:10 +0000 (03:57 +0000)]
MFC r361748:

tmpfs: Preserve alignment of struct fid fields

On 64-bit platforms, the two short fields in `struct tmpfs_fid` are padded to
the 64-bit alignment of the long field.  This pushes the offsets of the
subsequent fields by 4 bytes and makes `struct tmpfs_fid` bigger than
`struct fid`.  `tmpfs_vptofh()` casts a `struct fid *` to `struct tmpfs_fid *`,
causing 4 bytes of adjacent memory to be overwritten when the struct fields are
set.  Through several layers of indirection and embedded structs, the adjacent
memory for one particular call to `tmpfs_vptofh()` happens to be the stack
canary for `nfsrvd_compound()`.  Half of the canary ends up being clobbered,
going unnoticed until eventually the stack check fails when `nfsrvd_compound()`
returns and a panic is triggered.

Instead of duplicating fields of `struct fid` in `struct tmpfs_fid`, narrow the
struct to cover only the unique fields for tmpfs and assert at compile time
that the struct fits in the allotted space.  This way we don't have to
replicate the offsets of `struct fid` fields, we just use them directly.

Reviewed by:    kib, mav, rmacklem
Approved by:    mav (mentor)
Sponsored by:   iXsystems, Inc.
Differential Revision:  https://reviews.freebsd.org/D25077

3 years agoMFC r361725, r361728:
Konstantin Belousov [Tue, 9 Jun 2020 09:04:57 +0000 (09:04 +0000)]
MFC r361725, r361728:
Do not allow to load ET_DYN object with DF_1_PIE flag set.

3 years agoMFC r361630: Remove session locking from cfiscsi_pdu_update_cmdsn().
Alexander Motin [Tue, 9 Jun 2020 02:03:30 +0000 (02:03 +0000)]
MFC r361630: Remove session locking from cfiscsi_pdu_update_cmdsn().

cs_cmdsn can be incremented with single atomic.  expcmdsn/maxcmdsn set in
cfiscsi_pdu_prepare() based on cs_cmdsn are not required to be updated
synchronously, only monotonically, that is achieved with lock there.

3 years agoMFC r361625: Report STATUS_QUEUED/SENT in `ctladm dumpooa` output.
Alexander Motin [Tue, 9 Jun 2020 02:01:39 +0000 (02:01 +0000)]
MFC r361625: Report STATUS_QUEUED/SENT in `ctladm dumpooa` output.

3 years agoMFC r361616: Move EXPDATASN/R2TSN from PDU to CTL_PRIV_FRONTEND.
Alexander Motin [Tue, 9 Jun 2020 02:01:09 +0000 (02:01 +0000)]
MFC r361616: Move EXPDATASN/R2TSN from PDU to CTL_PRIV_FRONTEND.

We any way have per-I/O space in CTL_PRIV_FRONTEND, while for PDU private
fields I have better use ideas.  Plus to me such use of PDU fields looked
a layering violation.

3 years agoMFC r361609: Remove PDU_TOTAL_TRANSFER_LEN() macro.
Alexander Motin [Tue, 9 Jun 2020 02:00:36 +0000 (02:00 +0000)]
MFC r361609: Remove PDU_TOTAL_TRANSFER_LEN() macro.

I don't see a point to copy io->scsiio.kern_total_len into the request
PDU private field.  The io is going to stay with us till the end, and
kern_total_len field is not changed after being first initialized.

3 years agoMFC r361740: lld: Set DF_1_PIE for -pie
Ed Maste [Tue, 9 Jun 2020 00:27:54 +0000 (00:27 +0000)]
MFC r361740: lld: Set DF_1_PIE for -pie

DF_1_PIE originated from Solaris[1].

GNU ld[2] sets the flag on non-Solaris platforms.

It can help distinguish PIE from ET_DYN.
eu-classify from elfutils uses this to recognize PIE[3].

glibc uses this flag to reject dlopen'ing a PIE[4]

[1] https://docs.oracle.com/cd/E36784_01/html/E36857/chapter6-42444.html
[2] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=5fe2850dd96483f176858fd75c098313d5b20bc2
[3] https://sourceware.org/git/?p=elfutils.git;a=commit;h=3f489b5c7c78df6d52f8982f79c36e9a220e8951
[4] https://sourceware.org/bugzilla/show_bug.cgi?id=24323

Sponsored by: The FreeBSD Foundation

3 years agoMFC r361739: llvm: Add DF_1_PIE
Ed Maste [Tue, 9 Jun 2020 00:25:53 +0000 (00:25 +0000)]
MFC r361739: llvm: Add DF_1_PIE

Sponsored by: The FreeBSD Foundation

3 years agoMFC r361792:
Mark Johnston [Mon, 8 Jun 2020 21:38:52 +0000 (21:38 +0000)]
MFC r361792:
Update vt(4) config option names to chase r303043.

PR: 246080

3 years agoMFC r361793:
Mark Johnston [Mon, 8 Jun 2020 21:35:24 +0000 (21:35 +0000)]
MFC r361793:
dhclient: Fix a logic bug remove_protocol().

PR: 245971

3 years agoMFC r359601 (by brooks):
Mark Johnston [Mon, 8 Jun 2020 15:27:44 +0000 (15:27 +0000)]
MFC r359601 (by brooks):
pmc: diable position-independent builds, they fail to link on amd64

PR: 245189

3 years agoMFC 361721:
Cy Schubert [Mon, 8 Jun 2020 14:00:11 +0000 (14:00 +0000)]
MFC 361721:

Per-rule hit counts (-h) can be used with either -i (input) or -o (output)
filter rule lists.

3 years agoMFC r361844:
Mark Johnston [Mon, 8 Jun 2020 13:27:45 +0000 (13:27 +0000)]
MFC r361844:
librtld_db: Handle anonymous mappings below the first file mapping.

3 years agoMFC r361110:
Hans Petter Selasky [Mon, 8 Jun 2020 09:39:48 +0000 (09:39 +0000)]
MFC r361110:
Implement synchronize_srcu_expedited() in the LinuxKPI.

Differential Revision: https://reviews.freebsd.org/D24798
Sponsored by: Mellanox Technologies

3 years agoMFC r361498:
Hans Petter Selasky [Mon, 8 Jun 2020 09:37:20 +0000 (09:37 +0000)]
MFC r361498:
Sync with Linux packet pacing enhancements in mlx5en(4).

Linux commit:
05d3ac978ed25b753bfe34fe76c50c31ee506a82

Sponsored by: Mellanox Technologies

3 years agoMFC r361827:
Hans Petter Selasky [Mon, 8 Jun 2020 09:32:57 +0000 (09:32 +0000)]
MFC r361827:
USB HID descriptors may push/pop the current state to allow
description of items residing in a so-called union. FreeBSD currently
only supports 4 such push levels.

If the push level is not restored within the processing of the same
HID item, an invalid memory location may be used for subsequent HID
item processing.

Verify that the push level is always valid when processing HID items.

Reported by: Andy Nguyen (Google)
Sponsored by: Mellanox Technologies

3 years agoMFC r361582:
Hans Petter Selasky [Mon, 8 Jun 2020 09:30:08 +0000 (09:30 +0000)]
MFC r361582:
Fix check for wMaxPacketSize in USB bluetooth driver,
in case device is not FULL speed.

Sponsored by: Mellanox Technologies

3 years agoMFC r361581:
Hans Petter Selasky [Mon, 8 Jun 2020 09:26:46 +0000 (09:26 +0000)]
MFC r361581:
Implement helper function, usbd_get_max_frame_length(), which allows kernel
device drivers to correctly predict the default USB transfer frame length.

Sponsored by: Mellanox Technologies

3 years agoMFC r361577:
Hans Petter Selasky [Mon, 8 Jun 2020 09:23:52 +0000 (09:23 +0000)]
MFC r361577:
Don't allow USB device drivers to parent own interface.
It will prevent proper USB device detach.

Sponsored by: Mellanox Technologies

3 years agoMFC r352028:
Oleksandr Tymoshenko [Mon, 8 Jun 2020 00:20:15 +0000 (00:20 +0000)]
MFC r352028:

[rpi] Inherit framebuffer BPP value from the VideoCore firmware

Instead of using hardcoded bpp of 24, obtain current/configured value
from VideoCore. This solves certain problems with Xorg/Qt apps that
require bpp of 32 to work properly. The mode can be forced by setting
framebuffer_depth value in config.txt

PR: 235363
Submitted by: Steve Peurifoy <ssw01@mathistry.net>
Tested by: Johnathan Chen <jonc@chen.org.nz> (stabe/12 patch)

3 years agoMFC r361664:
Mark Johnston [Sun, 7 Jun 2020 17:40:29 +0000 (17:40 +0000)]
MFC r361664:
Handle getcpu() calls in vsyscall emulation on amd64.

PR: 246339