FreeBSD/src 344267head/sys/arm/freescale/imx imx6_snvs.c

Add a compatible string to match recent changes in the upstream dts.

FreeBSD/src 344266stable 11, stable/11/stand/libsa cd9660read.c cd9660.c

MFC r332170, r332173: light cd9660 cleanup

r332170:
libsa: cd9660: warning: 'lenskip' may be used uninitialized in this function

We better provide value for lenskip in both instances.

r332173:
libsa: name is not used in dirmatch()

Seems like variable 'name' is leftover.

FreeBSD/src 344265stable 11, stable/11/stand/zfs zfs.c libzfs.h

MFC r329727-r329728: lualoader ZFS BE Support

r329727:
stand/zfs: Add all bootenvs to environment

For the benefit of lualoader, add all bootenvs to environment when
init_zfs_bootenv is invoked. All of the boot environment logic can then be
implemented in pure lua, rather than going back and forth with C to
implement paging.

This stores all boot environments in bootenvs[idx] and the final count of
bootenvs in bootenvs_count.

While here, make a copy of currdev for init_zfs_bootenv since it will be
modifying it and the caller may not necessarily want that. Some of the logic
was shifted around so that the 'currdev' pointer remains at the beginning of
the string and 'beroot' is moved around as needed to modify it or ultimately
store it in zfs_be_root.

The original zfs_bootenv that this was copied from will be able to go away
only if/when forth eventually goes away.

r329728:
stand/zfs: Unbreak build, 'truct' ~= 'struct'

FreeBSD/src 344264head/lib/clang/libllvmminimal Makefile

Add one additional file to libllvmminimal, since in some cases (e.g.
upgrading from stable/10 to stable/11) symbols from it are needed to
link llvm-tblgen and clang-tblgen.

Reported by:    kib
MFC after:      3 days

FreeBSD/src 344263stable 11, stable/11/sbin/mdmfs mdmfs.c

MFC r344023:

mdmfs: Fix many bugs in automatic md(4) creation.

This code allocated a correctly sized buffer, read past the end of
the source buffer, writing off the end of the target buffer, and then
writing a '\0' terminator past the end of the target buffer (in the
wrong place). It then leaked the buffer.

Switch to a statically sized buffer on the stack and update the source
pointer and length before use so the correct things are copied.

Fix a logic error in the checks that the format of the line is as
expected and move on out of an assert.

Remove an unneeded close(). fclose() closes the descriptor.

Found with:     CheriABI
Obtained from:  CheriBSD
Reviewed by:    kib, jhb, markj
Sponsored by:   DARPA, AFRL
Differential Revision:  https://reviews.freebsd.org/D19122

FreeBSD/src 344262stable 12, stable/12/sbin/mdmfs mdmfs.c

MFC r344023:

mdmfs: Fix many bugs in automatic md(4) creation.

This code allocated a correctly sized buffer, read past the end of the
source buffer, writing off the end of the target buffer, and then writing
a '\0' terminator past the end of the target buffer (in the wrong place).
It then leaked the buffer.

Switch to a statically sized buffer on the stack and update the source
pointer and length before use so the correct things are copied.

Fix a logic error in the checks that the format of the line is as
expected and move on out of an assert.

Remove an unneeded close(). fclose() closes the descriptor.

Found with:     CheriABI
Obtained from:  CheriBSD
Reviewed by:    kib, jhb, markj
Sponsored by:   DARPA, AFRL
Differential Revision:  https://reviews.freebsd.org/D19122

FreeBSD/src 344261head/contrib/libc++/include type_traits

Pull in r345199 from upstream libc++ trunk (by Petr Hosek):

  Revert "Teach __libcpp_is_floating_point that __fp16 and _Float16 are
  floating-point types."

  This reverts commits r333103 and r333108. _Float16 and __fp16 are C11
  extensions and compilers other than Clang don't define these for C++.

  Differential Revision: https://reviews.llvm.org/D53670

This prevents "_Float16 is not supported on this target" errors in
libc++'s type_traits header, in some cases.

Reported by:    Charlie Li
MFC after:      3 days

FreeBSD/src 344260head/stand/uboot/common main.c

Allow the u-boot loaderdev env var to be formatted in the "usual" loader(8)
way: device<unit>[s|p]<slice><partition>.  E.g., disk0s2a or disk3p12.
The code first tries to parse the variable in this format using the
standard disk_parsedev().  If that fails, it falls back to parsing the
legacy format that has been supported by ubldr for years.

In addition to 'disk', all the valid uboot device names can also be used:
mmc, sata, usb, ide, scsi. The 'disk' device serves as an alias for all
those types and will match the Nth storage-type device found (where N is
the unit number).

FreeBSD/src 344259stable 12, stable/12/sbin/bectl/tests bectl_test.sh

MFC r343543: bectl(8) test: Force destroy the zpool in cleanup

This is a wild guess as to why bectl tests failed once upon a time in CI,
given no apparent way to see a transcript of cleanup routines with Kyua. The
bectl tests construct a new, clean zpool for every test. The failure
indicated was because of a mount that was leftover from a previous test, but
the previous test had succeeded so it's not clear how the mount remained
leftover unless the `zpool get health ${pool}` had somehow failed.

FreeBSD/src 344258stable 11, stable/11/usr.sbin/nscd nscd.conf.5

MFC r339214:

Remove BUGS section from nscd.conf(5) man page.  This was missed in r339194.

Sponsored by:   DARPA, AFRL

FreeBSD/src 344257stable 11, stable/11/usr.sbin/nscd nscd.8

MFC r339194:

Remove the BUGS section of nscd(8) man page.  According to bushman@'s
reponse quoted in PR, he no longer maintains it.

PR:            210590
Sponsored by:   DARPA, AFRL

FreeBSD/src 344256head/sys/amd64/amd64 pmap.c

amd64: cleanup pmap_init_pat().

The pmap_works variable is always true for amd64.  Remove it, the
branch in the initialization taken when false, and corresponding
sysctl.

Remove pat_table[] local array, work on pat_index[] directly.

Collapse whole initialization to not override already assigned values.

Add comment explaining the choice for PAT4 and PAT7.

Reviewed by:    alc, markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
MFC note:       Leave the sysctl around
Differential revision:  https://reviews.freebsd.org/D19225

FreeBSD/src 344255head/stand/uboot/common main.c

Fix more places to use DEV_TYP_NONE instead of -1 to indicate 'no device'.

FreeBSD/src 344254head/stand/uboot/common main.c

Use DEV_TYP_NONE instead of -1 to indicate no device was specified.

DEV_TYP_NONE has a value of zero, which makes more sense since the device
type is a bunch of bits describing the device, crammed into an int.

FreeBSD/src 344253head/sys/dev/netmap netmap_freebsd.c netmap_kern.h

netmap: don't schedule kqueue notify task when kqueue is not used

This change adds a counter (kqueue_users) to keep track of how many
kqueue users are referencing a given struct nm_selinfo.
In this way, nm_os_selwakeup() can schedule the kevent notification
task only when kqueue is actually being used.
This is important to avoid wasting CPU in the common case where
kqueue is not used.

Reviewed by:    Aleksandr Fedorov <aleksandr.fedorov at itglobal.com>
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D19177

FreeBSD/src 344252head/sys/conf ldscript.riscv

Avoid orphan sections between __bss_start and .(s)bss.

Ensure __bss_start is associated with the next section
in case orphan sections are placed directly after .sdata,
as has been seen to happen with LLD.

Submitted by:   "J.R.T. Clarke" <jrtc4 at cam.ac.uk>
Differential Revision:  https://reviews.freebsd.org/D18429

FreeBSD/src 344251stable 12, stable/12/sys/netpfil/ipfw ip_fw_dynamic.c

MFC r344018:
  Remove `set' field from state structure and use set from parent rule.

  Initially it was introduced because parent rule pointer could be freed,
  and rule's information could become inaccessible. In r341471 this was
  changed. And now we don't need this information, and also it can become
  stale. E.g. rule can be moved from one set to another. This can lead
  to parent's set and state's set will not match. In this case it is
  possible that static rule will be freed, but dynamic state will not.
  This can happen when `ipfw delete set N` command is used to delete
  rules, that were moved to another set.
  To fix the problem we will use the set number from parent rule.

  Obtained from:        Yandex LLC
  Sponsored by: Yandex LLC

FreeBSD/src 344250stable 11, stable/11/usr.sbin/jail command.c

MFC: r343164

Clarify error messages a bit.

X-Found-With:   r343112
Reviewed by:    eugen (implicitly, when r343112 analysis)

FreeBSD/src 344249stable 12, stable/12/usr.sbin/jail command.c

MFC: r343164

Clarify error messages a bit.

X-Found-With:   r343112
Reviewed by:    eugen (implicitly, when r343112 analysis)

FreeBSD/src 344248head/stand/libsa cd9660.c

cd9660: dirmatch fails to unmatch when name is prefix for directory record

Loader does fail to properly match the file name in directory record and
does open file based on prefix match.

For fix, we check the name lengths first.

Reviewed by:    allanjude
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D19213

FreeBSD/src 344247head/stand/uboot/common main.c, head/stand/uboot/lib libuboot.h

Make uboot_devdesc properly alias disk_devdesc, so that parsing the u-boot
loaderdev variable works correctly.

The uboot_devdesc struct is variously cast back and forth between
uboot_devdesc and disk_devdesc as pointers are handed off through various
opaque interfaces.  uboot_devdesc attempted to mimic the layout of
disk_devdesc by having a devdesc struct, followed by a union of some
device-specific stuff that included a struct that contains the same fields
as a disk_devdesc.  However, one of those fields inside the struct is 64-bit
which causes the entire union to be 64-bit aligned -- 32 bits of padding
is added between the struct devdesc and the union, so the whole mess ends
up NOT properly mimicking a disk_devdesc after all.  (In disk_devdesc there
is also 32 bits of padding, but it shows up immediately before the d_offset
field, rather than before the whole collection of d_* fields.)

This fixes the problem by using an anonymous union to overlay the devdesc
field uboot network devices need with the disk_devdesc that uboot storage
devices need.  This is a different solution than the one contributed with
the PR (so if anything goes wrong, the blame goes to me), but 95% of the
credit for this fix goes to Pawel Worach and Manuel Stuhn who analyzed the
problem and proposed a fix.

PR:            233097

FreeBSD/src 344246head/usr.bin/kdump kdump.c

kdump: expand comment on reasons for CAPFAIL_LOOKUP

Comment for CAPFAIL_LOOKUP refered only to paths containing ".." but
it is returned for other restricted VFS lookup cases, such as absolute
paths or openat(AT_FDCWD, ...).

FreeBSD/src 344245head/usr.sbin/bsnmpd/modules/snmp_hostres hostres_partition_tbl.c

snmp_hostres(3): fix a typo in sanity checks in handle_chunk()

PR:            204253
Submitted by:   David Binderman <dcb314 at hotmail.com>
MFC after:      5 days

FreeBSD/src 344244head/usr.sbin/rpc.ypupdated update.c

Fix memory / resource leaks in usr.sbin/rpc.ypupdated/update.c

Re-apply r343909 to this file to get the issue fixed.

PR:            204956
Reported by:    David Binderman <dcb314 at hotmail.com>
MFC after:      5 days

FreeBSD/src 344243head/stand/lua password.lua

lualoader: only clear the screen before first password prompt

This was previously an unconditional screen clear, regardless of whether or
not we would be prompting for any passwords. This is pointless, given that
the screen clear is only there to put our screen into a consistent state
before we draw the prompts and do cursor manipulation.

This is also the only screen clear besides that to draw the menu.  One can
now see early pre-loader and loader output with the menu disabled, which may
be useful for diagnostics.

Reported by:    ian
MFC after:      3 days

FreeBSD/src 344242head/etc/mtree BSD.root.dist, head/stand/powerpc/uboot Makefile

powerpc/boot: Move ubldr to /boot/uboot, and make this a separate filesystem

Summary:
Now that mpc85xx can boot via ubldr, move ubldr to a separate
filesystem, mounted on /boot/uboot, so that a fresh install can boot correctly.

Reviewed By: nwhitehorn
Differential Revision: https://reviews.freebsd.org/D18709

FreeBSD/src 344241head/stand/common disk.c

Garbage collection no-longer-used constant.

FreeBSD/src 344240head/stand/common disk.c

Make lsdev -v output line up in neat columns by using a fixed width for
the size field and a tab between the partition type and the size.

Changes this

  disk devices:
        disk0 (MMC)
        disk0s1: DOS/Windows            49MB
        disk0s2: FreeBSD                14GB
        disk0s2a: FreeBSD UFS         14GB
        disk0s2b: Unknown             2048KB
        disk0s2d: FreeBSD UFS         2040KB

to this

  disk devices:
        disk0 (MMC)
        disk0s1: DOS/Windows      49MB
        disk0s2: FreeBSD          14GB
        disk0s2a: FreeBSD UFS     14GB
        disk0s2b: Unknown       2048KB
        disk0s2d: FreeBSD UFS   2040KB

FreeBSD/src 344239head/stand/common disk.c

Use a couple local variables to avoid repetitive long expressions that
cause line-wrapping.

FreeBSD/src 344238head/stand/common disk.c

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
of the raw slice after disk_open() returns.  For good measure, d_partition
is also set back to -1, although that doesn't currently affect anything.

I would have preferred to make disk_open() avoid such rude assumptions and
if you ask for partition -1 you get the raw slice.  But the commit history
shows that someone already did that once (r239058), and had to revert it
(r239232), so I didn't even try to go down that road.

FreeBSD/src 344237stable 12, stable/12/sbin/dhclient dhclient.c

MFC r343896,r343922: dhclient: Pass through exit status from script

The wait status is translated into 8 bits the same way as the shell
calculates $?.

FreeBSD/src 344236head/sys/contrib/libnv nvpair.c

libnv: fix revert

Reported by:    jenkins

FreeBSD/src 344235head/sys/contrib/libnv nvpair.c

libnv: fix double free

In r343986 we introduced a double free. The structure was already
freed fixed in the r302966. This problem was introduced
because the GitHub version was out of sync with the FreeBSD one.

Submitted by:   Mindaugas Rasiukevicius <rmind at netbsd.org>
MFC with:       r343986

FreeBSD/src 344234head/stand/libsa/zfs zfs.c

It turns out r344226 narrowed the overrun bug but did not eliminate it entirely

This commit fixes a remaining output buffer overrun in the
single-sector case when there is a non-zero tail.

Reviewed by:    allanjude, tsoome
MFC after:      3 months
MFC with:       r344226
Differential Revision:  https://reviews.freebsd.org/D19220

FreeBSD/src 344233head/sys/kern sys_pipe.c

Remove a write-only variable orphaned by r340677.

FreeBSD/src 344232head/sys/amd64/sgx sgx_linux.c

Fix refcount leaks in the SGX Linux compat ioctl handler.

Some argument validation error paths would return without releasing the
file reference obtained at the beginning of the function.

While here, fix some style bugs and remove trivial debug prints.

Reviewed by:    kib
MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D19214

FreeBSD/src 344231head/sys/vm vm_pageout.c

Remove a redundant flag variable.

Use the object pointer itself to determine whether the object is locked.
No functional change intended.

Reviewed by:    kib
MFC after:      1 week
Sponsored by:   Netflix
Differential Revision:  https://reviews.freebsd.org/D19215
DeltaFile
+10-33head/sys/vm/vm_pageout.c
+10-331 files

FreeBSD/src 344230stable 11, stable/11/sys/i386/include counter.h

MFC r343723:
i386: Do not ever store to other-CPU counter64 slot.

FreeBSD/src 344229stable 12, stable/12/sys/i386/include counter.h

MFC r343723:
i386: Do not ever store to other-CPU counter64 slot.

FreeBSD/src 344228stable 12, stable/12/sys/vm swap_pager.c

MFC r343966:
struct xswdev on amd64 requires compat32 shims after ino64.

FreeBSD/src 344227head/stand/i386/zfsboot zfsboot.c

Remove whole-disk vdev support from zfsboot

This is consistent with the removal of whole-disk vdev support from
libsa/zfs/zfs.c in r342151, and is part way to having the LBAs read
during probe be fully constrained by partition tables when present.

Reviewed by:    tsoome
MFC after:      3 months
Differential Revision:  https://reviews.freebsd.org/D19142

FreeBSD/src 344226head/stand/libsa/zfs zfs.c

Fix memory corruption bug introduced in r325310

The bug occurred when a bounce buffer was used and the requested read
size was greater than the size of the bounce buffer.  This commit also
rewrites the read logic so that it is easier to systematically verify
all alignment and size cases.

Reviewed by:    allanjude, tsoome
MFC after:      3 months
Differential Revision:  https://reviews.freebsd.org/D19140

FreeBSD/src 344225stable 11, stable/11/sys/net80211 ieee80211_proto.c ieee80211_tdma.c

MFC r343699:
net80211: do not setup Tx parameters for unsupported modes.

That should shorten 'ifconfig <wlan> list txparam' output since
unsupported modes will not be shown.

FreeBSD/src 344224stable 12, stable/12/sys/net80211 ieee80211_proto.c ieee80211_tdma.c

MFC r343699:
net80211: do not setup Tx parameters for unsupported modes.

That should shorten 'ifconfig <wlan> list txparam' output since
unsupported modes will not be shown.

FreeBSD/src 344223stable 11, stable/11/sys/net80211 ieee80211_scan.c ieee80211_scan_sta.c

MFC r343696:
net80211: do not setup roaming parameters for unsupported modes.

ifconfig(8) prints per-mode parameters if they are non-zero; since
we have 13 possible modes with 3...5 typically supported this change
should greatly reduce amount of information for 'ifconfig <wlan> list roam'
command.

While here ensure that sta_roam_check() will not use roaming parameters
for unsupported modes (it should not).

This change effectively reverts r188776.

FreeBSD/src 344222stable 12, stable/12/sys/net80211 ieee80211_scan.c ieee80211_scan_sta.c

MFC r343696:
net80211: do not setup roaming parameters for unsupported modes.

ifconfig(8) prints per-mode parameters if they are non-zero; since
we have 13 possible modes with 3...5 typically supported this change
should greatly reduce amount of information for 'ifconfig <wlan> list roam'
command.

While here ensure that sta_roam_check() will not use roaming parameters
for unsupported modes (it should not).

This change effectively reverts r188776.

FreeBSD/src 344221stable 12 10, stable/10/sys/cam/scsi scsi_da.c

MFC r343501:
Add NO_6_BYTE / NO_SYNC_CACHE quirks for (C|D|E).* Olympus digital cameras

PR:            97472
Submitted by:   Fabio Luis Girardi <papelhigienico at gmail.com>
Reviewed by:    imp

FreeBSD/src 344220stable/11/contrib/lua/src luaconf.h.dist, stable/11/stand/common interp_lua.c

MFC lualoader: r326353, r328440, r328443, r329166-r329167, r329274, r329329,
r329349-r329352, r329355-r329359, r329366-r329369, r329386-r329387, r329393,
r329413-r329415, r329417, r329424-r329436, r329457, r329473-r329474,
r329496-r329501, r329503-r329504, r329543, r329547-r329551, r329576-r329578,
r329580, r329583, r329585-r329590, r329592-r329596, r329609-r329611,
r329614, r329619, r329621-r329622, r329624, r329626-r329627,
r329629-r329632, r329640-r329641, r329643-r329646, r329649-r329650, r329654,
r329656, r329662, r329669-r329671, r329673-r329674, r329680,
r329684-r329689, r329692-r329693, r329696-r329700, r329709, r329716,
r329731, r329733-r329734, r329747-r329748, r329756, r329779, r329782,
r329784, r329786, r329804, r329806, r329809, r329811, r329836,
r329850-r329852, r329854, r329856-r329858, r329861, r329895,
r329897-r329899, r329901-r329903, r329922-r329924, r329927-r329928,
r329944-r329949, r329986-r329987, r330008-r330010, r330012, r330020,
r330082-r330084, r330087-r330088, r330098-r330101, r330138-r330139,
r330261-r330263, r330267-r330269, r330281-r330284, r330287, r330339-r330342,
r330345-r330346, r330369-r330370, r330434-r330435, r330564, r330616-r330618,
r330620, r330625, r330690, r330701, r330703, r330825, r331211, r331257,
r331259, r331281-r331282, r331304, r331314, r331476-r331477,
r331563-r331564, r331854-r331857, r331859-r331860, r332106, r334723,
r334879, r334891, r334907, r334912, r334939, r334986, r335009, r335371,
r336759, r337711, r337807-r337810, r338054, r338063, r338065-r338067,
r338083, r338085-r338086, r338108, r338167-r338168, r338173, r338203,
r338255, r338259, r338309, r338394, r338438, r338886, r338893, r339173,
r339200, r339218, r339222, r339301, r339307, r339677-r339678, r339702,

    [288 lines not shown]

FreeBSD/src 344219head/sys/arm/allwinner axp81x.c

Add sysctl for setting battery charging current.
The charging current can be set using steps
from 0: 200mA to 13: 2800mA (200mA/step).
While there, fix battery charging current related
sensor descriptions.

Reviewed by:    manu
Differential Revision:  https://reviews.freebsd.org/D19212

FreeBSD/src 344218head/sbin/mdmfs mdmfs.c

mdmfs(8): use -o reserve with malloc-backed md(4)

Mentioned in mdconfig(8), malloc-backed md(4) can be unstable unless
required memory is allocated up front with -o reserve. Furthermore, panics
have been observed with md used in fstab on 12.0-RELEASE. Choose the stable
route and pass -o reserve.

Submitted by:   Paul Vixie
MFC after:      1 week