FreeBSD/src 346486head/lib/libvgl mouse.c simple.c

Fix missing restoring of the mouse cursor position, the border color and the
blank state after a screen switch.

FreeBSD/src 346485stable 11, stable/11/libexec/rtld-elf debug.h Makefile

MFC r346216:
ld-elf.so: make LD_DEBUG always functional.

FreeBSD/src 346484stable 12, stable/12/libexec/rtld-elf debug.h Makefile

MFC r346216:
ld-elf.so: make LD_DEBUG always functional.

FreeBSD/src 346483stable/11/stand/common part.c disk.c, stable/11/stand/efi/loader bootinfo.c copy.c

MFC r343911, r344238-r344241, r344247, r344254-r344255, r344260, r344268,
r344335, r344839, r345066, r345330

r343911:
Allow reading the UEFI variable size

When loading bigger variables form UEFI it is necessary to know their
size beforehand, so that an appropriate amount of memory can be
allocated. The easiest way to do this is to try to read the variable
with buffer size equal 0, expecting EFI_BUFFER_TOO_SMALL error to be
returned. Allow such possible approach in efi_getenv routine.

Extracted from a bigger patch as suggested by imp.

r344238:
Restore loader(8)'s ability for lsdev to show partitions within a bsd slice.

I'm pretty sure this used to work at one time, perhaps long ago.  It has
been failing recently because if you call disk_open() with dev->d_partition
set to -1 when d_slice refers to a bsd slice, it assumes you want it to
open the first partition within that slice.  When you then pass that open
dev instance to ptable_open(), it tries to read the start of the 'a'
partition and decides there is no recognizable partition type there.

This restores the old functionality by resetting d_offset to the start

    [127 lines not shown]

FreeBSD/src 346482stable/11/stand/efi/include efiip.h efitcp.h, stable/11/stand/efi/libefi env.c

MFC r341101, r341231, r341276, r341329, r341433, r341780, r342054-r342055,
r342721, r342742, r342840, r343008, r343225

r341101:
powerpcspe: Don't crash the loader on ubldr with SPE instructions.

-msoft-float seems to be insufficient for disabling the SPE on powerpcspe.
Force it off with -mno-spe as well.  This prevents a crash in ubldr on
powerpcspe.

r341231:
loader: command_bcache() should print unsigned values

All bcache counters are unsigned.

r341276:
When handling CMD_CRIT error set command_errmsg to NULL after we dump it out,
so that it does not result in error message printed twice.

OK load doodoo
can't find 'doodoo'
can't find 'doodoo'
OK

r341329:

    [75 lines not shown]

FreeBSD/src 346481stable 11, stable/11/sbin/init init.c

MFC r337534-r337535

r337534:
Refactor common code into execute_script().

r337535:
Use NULLs instead of casted zeroes, for consistency.

FreeBSD/src 346480stable/11/stand/common bcache.c part.c, stable/11/stand/efi/libefi delay.c

MFC r338262, r339334, r339796, r340240, r340857, r340917, r341007

r338262:
stand: fdt: Drop some write-only assignments/variables and leaked bits

Generally straightforward enough; a copy of argv[1] was being made in
command_fdt_internal, solely used for a comparison within the
handler-search, then promptly leaked.

r339334:
loader.efi: add poweroff command

Add poweroff command to make life a bit easier.

r339796:
Simplify the EFI delay() function by calling BS->Stall()

r340240:
loader: ptable_open() check for ptable_cd9660read result is wrong

The ptable_*read() functions return NULL on read errors (and partition table
closed as an side effect). The ptable_open must check the return value and
act properly.

r340857:

    [12 lines not shown]

FreeBSD/src 346479stable 11, stable/11/sbin/init init.8 init.c

MFC r337321, r337435, r337707, r337740, r337834, r337836, r337968

r337321:
Make it possible for init to execute any executable, not just sh(1)
scripts. This means one should be able to eg rewrite their /etc/rc
in Python.

r337435:
Move description of init_shell, init_script, and init_chroot kenv
tunables from loader(8) to init(8), since it's init that actually
uses them.  Add .Xrs at their old place.

r337707:
Move around text in loader(8), in particular stuff related to ZFS,
to restore the usual section order.

r337740:
Add init_exec kenv(1) variable, to make init(8) execute a file
after opening the console, replacing init as PID 1.

From the user point of view, it makes it possible to run eg the
shell as PID 1, using 'set init_exec=/bin/sh' at the loader(8)
prompt.

r337834:

    [9 lines not shown]

FreeBSD/src 346478stable 11, stable/11/stand/defaults loader.conf.5

MFC r339292: Fix a minor typo in loader.conf(5).

FreeBSD/src 346477stable/11/stand/libsa cd9660.c printf.c, stable/11/stand/libsa/zfs zfs.c zfsimpl.c

MFC r337871, r339970, r342151, r342161, r343123-r343124, r344226, r344234,
r344248, r344387

r337871:
pkgfs_init: Initialize pkg

new_package may not set *pp if it errors out, leaving pkg uninitialized.

r339970:
Remove unnecessary include from libstand.

r342151:
loader: zfs reader should not probe partitionless disks

First of all, normal setups can not boot such pools as the tools
do not support installing boot programs.

Secondly, for proper pool configuration detection, we need to checks all
four label copies on disk, 2 from front and 2 from the end of the disk,
but zfs label does not contain the size of the disk - so we depend on
firmware to report the correct disk size or use information from the
partition table.

Without partition table, we only can rely on firmware to report and support
disk IO properly.

    [66 lines not shown]

FreeBSD/src 346476stable/11/stand/i386/libi386 biosdisk.c bioscd.c, stable/11/stand/i386/loader main.c

MFC r341253, r341328, r342619, r342626, r342707, r342785, r342865

r341253:
The libstand's panic() appends its own '\n' to the message, so that users of the API
don't need to supply one.

r341328:
loader: create separate lists for fd, cd and hd, merge bioscd with biosdisk

Create unified block IO implementation in BIOS version, like it is done in UEFI
side. Implement fd, disk and cd device lists, this will split floppy devices
from disks and will allow us to have consistent, predictable device naming
(modulo BIOS issues).

r342619:
loader: create bio_alloc and bio_free for bios bounce buffer

We do have 16KB buffer space defined in pxe.c, move it to bio.c and implement
bio_alloc()/bio_free() interface to make it possible to use this space for
other BIOS calls (notably, from biosdisk.c).

r342626:
Add Copyright.

r342707:

    [14 lines not shown]

FreeBSD/src 346475stable 11, stable/11/stand/common disk.c part.c

MFC r339658, r339959, r340047, r340049, r340215

r339658:
loader: biosdisk interface should be able to cope with 4k sectors

The 4kn support in current bios specific biosdisk.c is broken, as the code
is only implementing the support for the 512B sector size.

This work is building the support for custom size sectors, we still do assume
the requested data to be multiple of 512B blocks and we only do address the
biosdisk.c interface here.

For reference, see also:
https://www.illumos.org/issues/8303
https://www.illumos.org/rb/r/547

As the GELI is moved above biosdisk "layer", the GELI should just work

r339959:
loader: issue edd probe before legacy ah=08 and detect no media

while probing for drives, use int13 extended info before standard one and
provide workaround for case we are not getting needed information in case
of floppy drive.


    [24 lines not shown]

FreeBSD/src 346474stable 11, stable/11/stand/i386/libi386 biosdisk.c bioscd.c

MFC i386 stand cleanup: r337353-r337354, r337356, r337872, r337878, r337881,
r337890-r337891, r338188

r337353:
loader: cstyle cleanup for biosdisk.c

Also switch u_int to uint32_t. Also replace "write" by "dowrite".
No functional changes intended.

r337354:
loader: 337353 did miss to rename 2 write instances

2 write instances got somehow missed.

r337356:
loader: bd_open() should cleanup from disk_open() error

Since bd_open() does early increment for reference counter and bcache
allocation, it also should undo those in case of the error.

Also remove unused variables rdev, g_err.

r337872:
libi386: remove BD_SUPPORT_FRAGS


    [36 lines not shown]

FreeBSD/src 346473stable 11, stable/11/stand/i386/libi386 biosdisk.c

MFC r337271, r337317: stand: i386: sector calculation fixes

r337271:
Some drives report a geometry that is inconsisetent with the total
number of sectors reported through the BIOS. Cylinders * heads *
sectors may not necessarily be equal to the total number of sectors
reported through int13h function 48h.

An example of this is when a Mediasonic HD3-U2B PATA to USB enclosure
with a 80 GB disk is attached. Loader hangs at line 506 of
stand/i386/libi386/biosdisk.c while attempting to read sectors beyond
the end of the disk, sector 156906855. I discovered that the Mediasonic
enclosure was reporting the disk with 9767 cylinders, 255 heads, 63
sectors/track. That's 156906855 sectors. However camcontrol and
Windows 10 both report report the disk having 156301488 sectors, not
the calculated value. At line 280 biosdisk.c sets the sectors to the
higher of either bd->bd_sectors or the total calculated at line 276
(156906855) instead of the lower and correct value of 156301488 reported
by int 13h 48h.

This was tested on all three of my Mediasonic HD3-U2B PATA to USB
enclosures.

Instead of using the higher of bd_sectors (returned by int13h) or the
calculated value, this patch uses the lower and safer of the values.

    [7 lines not shown]

FreeBSD/src 346472stable 11, stable/11/stand/efi/libefi env.c

MFC r336424-r336425: loader command typos

r336424:
Fix typo in the command summary.

Of course, I can't get the command to work, but it's a start...

r336425:
More typos

FreeBSD/src 346471stable 11, stable/11/sbin/reboot boot_i386.8

MFC r333662: Clarify that boot_mute / boot -m mutes kernel console only

Perhaps RB_MUTE could mute user startup (rc) output as well, but right
now it mutes only kernel console output, so make the documentation match
reality.

PR:            228193

FreeBSD/src 346470head/sys/contrib/dev/ath/ath_hal/ar9300 ar9300_freebsd.c ar9300_stub_funcs.c, head/sys/dev/ath if_ath_rx.c if_athvar.h

[ath] [ath_hal] [ath_hal_9300] Extend the start PCU receive to handle resetting ANI.

One of the fun issues with scanning has been how the existing
ANI values were programmed into the hardware when channels were
changed.  If you're on a really crappy channel and ANI has made
you deaf then when you scan you continue to be deaf on all channels.

This code passes in a flag to startpcureceive which in AR5416 and later
is also used to enable ANI.  This allows it to know if it's a normal
operation or a scan operation.

This fixes my situation at home where a temporary spot of a device
going deaf due to interference starts scanning and .. can't hear
anything until I restart.

Now, this isn't the full fix - ideally:

(a) all the ANI config and per-channel information would be migrated
     to the shared HAL stuff and enabled for all of the NICs;
(b) when a station reassociates and some other error conditions
    (like missed beacons, NF calibration failures, etc) a knob
    to reset ANI parameters would likely help recovery.

But hey, I'm committing bits of code again! woo!


    [3 lines not shown]

FreeBSD/src 346469head/usr.bin/dtc fdt.cc

dtc(1): Pull in fix for segfault-upon-error condition

Specifically, parse errors within a node would lead to a segfault due to
an unconditional dereference after emitting the error.

Obtained from:  https://github.com/davidchisnall/dtc/commit/e5ecf9319fd3f
MFC after:      3 days

FreeBSD/src 346468stable 10, stable/10/usr.sbin/nfsuserd nfsuserd.8

MFC: r345995
Delete the BUGS entry related to failing when jails are enabled.

r345994 has finally fixed the bug that caused the nfsuserd(8) daemon to
fail when jails were enabled, so delete the BUGS entry from the man page.

FreeBSD/src 346467stable 10, stable/10/usr.sbin/nfsuserd nfsuserd.c Makefile

MFC: r345994
Fix nfsuserd so that it handles the mapped localhost address when jails
are enabled.

The nfsuserd(8) daemon does not function correctly when jails are enabled,
since localhost gets mapped to another IP address and, as such, the upcall
RPC fails.
This patch fixes the problem by doing a getsockname(2) of a socket mapped
to localhost to find out what the correct address is for the comparison
test with the upcall's from IP address.
This patch also adds INET6 support and the required #ifdef's for INET and
INET6. It now uses INET6 by default for the upcalls, if the kernel has
INET6 support and the daemon is also built with INET6 support.

FreeBSD/src 346466stable 10, stable/10/sys/fs/nfs nfs_commonsubs.c nfs_commonport.c

MFC: r345992, r346087
Add INET6 support for the upcalls to the nfsuserd daemon.

The kernel code uses UDP to do upcalls to the nfsuserd(8) daemon to get
updates to the username<->uid and groupname<->gid mappings.
A change to AF_LOCAL last year had to be reverted, since it could result
in vnode locking issues on the AF_LOCAL socket.
This patch adds INET6 support and the required #ifdef INET and INET6
to the code.

FreeBSD/src 346465stable 11, stable/11/usr.sbin/nfsuserd nfsuserd.8

MFC: r345995
Delete the BUGS entry related to failing when jails are enabled.

r345994 has finally fixed the bug that caused the nfsuserd(8) daemon to
fail when jails were enabled, so delete the BUGS entry from the man page.

FreeBSD/src 346464stable 11, stable/11/usr.sbin/nfsuserd nfsuserd.c Makefile

MFC: r345994
Fix nfsuserd so that it handles the mapped localhost address when jails
are enabled.

The nfsuserd(8) daemon does not function correctly when jails are enabled,
since localhost gets mapped to another IP address and, as such, the upcall
RPC fails.
This patch fixes the problem by doing a getsockname(2) of a socket mapped
to localhost to find out what the correct address is for the comparison
test with the upcall's from IP address.
This patch also adds INET6 support and the required #ifdef's for INET and
INET6. It now uses INET6 by default for the upcalls, if the kernel has
INET6 support and the daemon is also built with INET6 support.

FreeBSD/src 346463stable 11, stable/11/sys/fs/nfs nfs_commonsubs.c nfs_commonport.c

MFC: r345992, r346087
Add INET6 support for the upcalls to the nfsuserd daemon.

The kernel code uses UDP to do upcalls to the nfsuserd(8) daemon to get
updates to the username<->uid and groupname<->gid mappings.
A change to AF_LOCAL last year had to be reverted, since it could result
in vnode locking issues on the AF_LOCAL socket.
This patch adds INET6 support and the required #ifdef INET and INET6
to the code.

FreeBSD/src 346462stable 12, stable/12/usr.sbin/nfsuserd nfsuserd.8

MFC: r345995
Delete the BUGS entry related to failing when jails are enabled.

r345994 has finally fixed the bug that caused the nfsuserd(8) daemon to
fail when jails were enabled, so delete the BUGS entry from the man page.

This is a content change.

FreeBSD/src 346461stable 12, stable/12/usr.sbin/nfsuserd nfsuserd.c Makefile

MFC: r345994
Fix nfsuserd so that it handles the mapped localhost address when jails
are enabled.

The nfsuserd(8) daemon does not function correctly when jails are enabled,
since localhost gets mapped to another IP address and, as such, the upcall
RPC fails.
This patch fixes the problem by doing a getsockname(2) of a socket mapped
to localhost to find out what the correct address is for the comparison
test with the upcall's from IP address.
This patch also adds INET6 support and the required #ifdef's for INET and
INET6. It now uses INET6 by default for the upcalls, if the kernel has
INET6 support and the daemon is also built with INET6 support.

FreeBSD/src 346460stable 12, stable/12/sys/fs/nfs nfs_commonsubs.c nfs_commonport.c

MFC: r345992, r346087
Add INET6 support for the upcalls to the nfsuserd daemon.

The kernel code uses UDP to do upcalls to the nfsuserd(8) daemon to get
updates to the username<->uid and groupname<->gid mappings.
A change to AF_LOCAL last year had to be reverted, since it could result
in vnode locking issues on the AF_LOCAL socket.
This patch adds INET6 support and the required #ifdef INET and INET6
to the code.
This patch also reverts the unused AF_LOCAL socket code.

FreeBSD/src 346459head/contrib/sqlite3 sqlite3.c configure, head/contrib/sqlite3/tea configure configure.ac

MFV r346450:

Update sqlite3-3.27.1 (3270100) --> sqlite3-3.27.2 (3270200)

MFC after:      11 days

FreeBSD/src 346458head/sys/dev/atkbdc psm.c

psm(4): give names to synaptics commands

Submitted by:   Ben LeMasurier <ben at crypt.ly>
MFC after:      2 weeks

FreeBSD/src 346457head/share/man/man4 psm.4, head/sys/dev/atkbdc psm.c

psm(4): respect tap_disabled configuration with enabled Extended support

This fixes a bug where, even when hw.psm.tap_enabled=0, touchpad taps
were processed.
tap_enabled has three states: unconfigured, disabled, and enabled (-1, 0, 1).
To respect PR kern/139272, taps are ignored only when explicity disabled.

Submitted by:   Ben LeMasurier <ben at crypt.ly> (initial version)
MFC after:      2 weeks

FreeBSD/src 346456head/sys/dev/atkbdc psm.c

psm(4): do not process gestures when palm is present

Ignoring of gesture processing when the palm is detected helps to reduce
some of the erratic pointer behavior.

This fixes regression introduced in r317814

Reported by:    Ben LeMasurier <ben at crypt.ly>
MFC after:      2 weeks

FreeBSD/src 346455head/sys/dev/atkbdc psm.c

psm(4): Add support for 4 and 5 finger touches in synaptics driver

While 4-th and 5-th finger positions are not exported through PS/2
interface, total number of touches is reported by MT trackpads.

MFC after:      2 weeks

FreeBSD/src 346454head/lib/libvgl mouse.c simple.c

Make libvgl mostly work without superuser privilege in direct modes by
not doing any unnecessary PIO instructions or refusing to start when the
i/o privilege needed for these instructions cannot be acquired.

This turns off useless palette management in direct modes.  Palette
management had no useful effect since the hardware palette is not used
in these modes.

This transiently acquires i/o privilege if possible as needed to give
VGLSetBorder() and VGLBlankDisplay() a chance of working.  Neither has
much chance of working.  I was going to drop support for them in direct
modes, but found that VGLBlankDisplay() still works with an old graphics
card on a not so old LCD monitor.

This has some good side effects: reduce glitches for managing the palette
for screen switches, and speed up and reduce async-signal-unsafeness in
mouse cursor drawing.

FreeBSD/src 346453vendor/sqlite3 sqlite-3270200

Tag import of sqlite3-3.27.2 (3270200)

FreeBSD/src 346452head/tests/sys/opencrypto cryptodev.py cryptotest.py

Revert r346443

My wide sweeping stylistic change (while well intended) is impeding others from
working on `tests/sys/opencrypto`.

The plan is to revert the change in ^/head, then reintroduce the changes after
the other changes get merged into ^/head .

Approved by:    emaste (mentor; implicit)
Requested by:   jhb
MFC after:      2 months

FreeBSD/src 346451user/ngie/bug-237403/tests/sys/opencrypto runtests.sh

Fix up `kern.cryptodevallowsoft` handling

- Always ensure `kern.cryptodevallowsoft` is unset when completing the tests,
  otherwise `/dev/crypto` access could remain on after the tests are complete
  if interrupted.
- Check for errors when setting `kern.cryptodevallowsoft`. While this isn't
  strictly needed in positive cases, it helps when dealing with the myriad of
  problems that might ensue because `/dev/crypto` doesn't exist when the sysctl
  isn't enabled.

FreeBSD/src 346450vendor/sqlite3/dist sqlite3.c configure, vendor/sqlite3/dist/tea configure configure.ac

Import sqlite3-3.27.2 (3270200)

FreeBSD/src 346449user/ngie/bug-237403/tests/sys/opencrypto cryptotest.py cryptodev.py

Replace `str.{decode,encode}("hex")` with binascii.(un)?hexlify

Encoding/decoding base_string objects as "hex" was removed in py3 and replaced
with other methods, one being `binascii.(un)?hexlify`.

FreeBSD/src 346448head/sys/netinet/netdump netdump_client.c

netdump: Fix 11 compatibility DIOCSKERNELDUMP ioctl

The logic was present for the 11 version of the DIOCSKERNELDUMP ioctl, but
had not been updated for the 12 ABI.

Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D19980

FreeBSD/src 346447user/ngie/bug-237403/tests/sys/opencrypto cryptotest.py

Use py3 compatible method for catching exceptions

Now ancient versions of python used to support catching exceptions in the form
`except Exception, exception_object`. This support was removed in py3 (and
introduced preemptively in earlier 2.x versions), being replaced by the form
`except Exception as exception_object`.

FreeBSD/src 346446user/ngie/bug-237403/tests/sys/opencrypto dpkt.py runtests.sh

Hack away at runtests

- Do not rely on local copy of dpkt module. Rely on py-dpkt, instead. The
  reason for this is that this removes the need for introducing localized fixes
  to dpkt.py, as upstream has changed significantly in the last few years, and
  now supports both python 2.x and python 3.
- Convert tests to TAP format. This adds improved introspection, as the plain
  tests have little to no introspection, and kyua lacks python unittest engine
  support. As such, remove `set -ex`, as it would impede being able to run this
  test with TAP cleanly.

FreeBSD/src 346445head/sys/compat/linuxkpi/common/include/linux io.h, head/sys/compat/linuxkpi/common/src linux_compat.c

Enable ioremap for aarch64 in the LinuxKPI

Required for Mellanox drivers (e.g. on Ampere eMAG at Packet.com).

PR:            237055
Submitted by:   Greg V <greg at unrelenting.technology>
Reviewed by:    hselasky
Differential Revision:  https://reviews.freebsd.org/D19987

FreeBSD/src 346444user/ngie bug-237403

Quick branch for hacking on getting python3 support to work for tests/sys/opencrypto

This branch will also convert the test from plain to TAP for improved introspection.

Bug 237403

FreeBSD/src 346443head/tests/sys/opencrypto cryptodev.py cryptotest.py

tests/sys/opencrypto: fix whitespace per PEP8

Replace hard tabs with four-character indentations, per PEP8.

This is being done to separate stylistic changes from the tests from functional
ones, as I accidentally introduced a bug to the tests when I used four-space
indentation locally.

No functional change.

MFC after:      2 months
Approved by:    emaste (mentor: implicit blanket approval for trivial fixes)

FreeBSD/src 346442stable/11/contrib/sqlite3 sqlite3.c config.guess, stable/12/contrib/sqlite3 sqlite3.c config.guess

MFC r345996:

Update sqlite3-3.26.0 (3260000) --> sqlite3-3.27.1 (3270100)

FreeBSD/src 346441head/sys/modules/em Makefile, head/sys/modules/fusefs Makefile

Use symlinks for kernel modules rather than hardlinks

When aliasing a kernel module to a different name (ie if_igb for if_em),
it's better to use symlinks than hard links. kldxref will omit entries for
the links, ensuring that the loaded module has the correct name.

Reviewed by:    imp
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D19979

FreeBSD/src 346440head/sys/modules/opensolaris Makefile

Export cpu_core from opensolaris.ko.

It is referenced by dtrace*.ko.

PR:            191462
Submitted by:   me.freebsd at cgf.cx
MFC after:      1 week

FreeBSD/src 346439stable 12, stable/12/sys/conf kmod.mk kern.post.mk

MFC r345348, r345594:
Use -fdebug-prefix-map to map auto-generated kernel build paths.

FreeBSD/src 346438stable 12, stable/12/usr.sbin/bhyve uart_emul.c

MFC r346010:
Fix indentation.

FreeBSD/src 346437stable 11, stable/11/usr.sbin/bhyve uart_emul.c

MFC r346010:
Fix indentation.