FreeBSD/src 345511stable 12, stable/12/sys/kern uipc_socket.c

Merge r344741:
  Remove bogus assert that I added in r319722. It is a legitimate case
  to call soabort() on a newborn socket created by sonewconn() in case
  if further setup of PCB failed. Code in sofree() handles such socket
  correctly.

  Submitted by: jtl, rrs

FreeBSD/src 345510head/sys/arm64/arm64 identcpu.c

Sort printing of the ID registers on arm64 to be identical to the
documentation. This will simplify checking new fields when they are added.

MFC after:      2 weeks
Sponsored by:   DARPA, AFRL

FreeBSD/src 345509stable 11 12, stable/11/share/examples/etc make.conf

MFC:    r345387

Catch up with Clang 7.0.

FreeBSD/src 345508stable 10, stable/10/sys/dev/pms/RefTisa/tisa/sassata/sas/ini itdio.c

MFC r345009:

Fix a scribbler in the PMS driver.

The ESGL bit was left uninitialized when executing the REPORT LUNS
ioctl. This could allow a zeroed data buffer to be treated as a
scatter/gather list. The firmware would eventually walk past the end
of the data buffer, potentially find what looked like a valid
address/length pair, and write the result to semi-random memory.

Obtained from:  Dell EMC Isilon
Sponsored by:   Dell EMC Isilon

FreeBSD/src 345507stable 11, stable/11/sys/dev/pms/RefTisa/tisa/sassata/sas/ini itdio.c

MFC r345009:

Fix a scribbler in the PMS driver.

The ESGL bit was left uninitialized when executing the REPORT LUNS
ioctl. This could allow a zeroed data buffer to be treated as a
scatter/gather list. The firmware would eventually walk past the end
of the data buffer, potentially find what looked like a valid
address/length pair, and write the result to semi-random memory.

Obtained from:  Dell EMC Isilon
Sponsored by:   Dell EMC Isilon

FreeBSD/src 345506stable 12, stable/12/sys/dev/pms/RefTisa/tisa/sassata/sas/ini itdio.c

MFC r345009:

Fix a scribbler in the PMS driver.

The ESGL bit was left uninitialized when executing the REPORT LUNS
ioctl. This could allow a zeroed data buffer to be treated as a
scatter/gather list. The firmware would eventually walk past the end
of the data buffer, potentially find what looked like a valid
address/length pair, and write the result to semi-random memory.

Obtained from:  Dell EMC Isilon
Sponsored by:   Dell EMC Isilon

FreeBSD/src 345505head/sys/netinet sctp_ss_functions.c

Initialize scheduler specific data for the FCFS scheduler.
This is joint work with rrs@. The issue was reported by using
syzkaller.

MFC after:             1 week

FreeBSD/src 345504head/sys/netinet sctp_pcb.c

Improve locking when tearing down an SCTP association.
This is joint work with rrs@ and the issue was found by
syzkaller.

MFC after:             1 week

FreeBSD/src 345503stable 12, stable/12/release/arm64 RPI3.conf PINE64-LTS.conf

MFC 345379:
 Bump the IMAGE_SIZE for arm64 SoC images to prevent failures due
 to full filesystem.  This makes the size of the arm64 SoC images
 consistent with armv6 and armv7.

Sponsored by:   The FreeBSD Foundation

FreeBSD/src 345502stable 12, stable/12/sys/kern kern_proc.c

MFC r344823:
Show wiring state of map entries in procstat -v.

FreeBSD/src 345501stable 12, stable/12/contrib/netbsd-tests/lib/libpthread t_cond.c

MFC r344935:
Have pthread_cond_destroy() return EBUSY if the condvar has waiters.

PR:     234805

FreeBSD/src 345500stable 12, stable/12/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall tst.args.c

MFC r345355:
Ensure that we use a 64-bit value for the last mmap() argument.

FreeBSD/src 345499head/sys/sys ctype.h

Change all kernel C-type macros into static inline functions.

The current kernel C-type macros might obscurely hide the fact that
the input argument might be used multiple times.

This breaks code like:
isalpha(*ptr++)

Use static inline functions instead of macros to fix this.

Reviewed by:           kib @
Differential Revision:  https://reviews.freebsd.org/D19694
MFC after:             1 week
Sponsored by:          Mellanox Technologies
DeltaFile
+58-12head/sys/sys/ctype.h
+58-121 files

FreeBSD/src 345498projects/krb5/contrib/llvm/include/llvm/IR IntrinsicsHexagon.td, projects/krb5/sys/dev/cxgbe/firmware t6fw-1.23.0.0.bin.uu t6fw-1.22.0.3.bin.uu

MFH to r345497.

FreeBSD/src 345497head/contrib/libarchive/libarchive archive_entry.c archive_write_disk_posix.c, head/contrib/libarchive/libarchive/test test_read_format_zip.c test_read_format_rar5.c

MFV r345495:
Sync libarchive with vendor.

Relevant vendor changes:
  PR #1153: fixed 2 bugs in ZIP reader [1]
  PR #1143: ensure archive_read_disk_entry_from_file() uses ARCHIVE_READ_DISK
  Changes to file flags code, support more file flags on FreeBSD:
    UF_OFFLINE, UF_READONLY, UF_SPARSE, UF_REPARSE, UF_SYSTEM
    UF_ARCHIVE is not supported by intention (yet)

PR:            236300
MFC after:      2 weeks

FreeBSD/src 345496head/lib/libvgl simple.c

Fix another type of buffer overrun for segmented modes.  The buffer index
was not taken modulo the window size in VGLClear().

Segmented modes also need a kernel fix to almost work.  The ioctl to set
the window origin is broken.

These bugs are rarely problems since non-VESA modes only need
segmentation to support multiple pages but libvgl doesn't support
multiple pages and treats these modes as non-segmented, and VESA modes
are usually mapped linearly except on old hardware so they really are
non-segmented.

FreeBSD/src 345495vendor/libarchive/dist/build/ci travis_ci.sh, vendor/libarchive/dist/libarchive archive_entry.c archive_write_disk_posix.c

Update vendor/libarchive/dist to git 3c079320b23ddf5ef38c443569c25898ad79ddb9

Relevant vendor changes:
  PR #1153: fixed 2 bugs in ZIP reader
  PR #1143: ensure archive_read_disk_entry_from_file() uses ARCHIVE_READ_DISK
  Changes to file flags code, support more file flags on FreeBSD:
    UF_OFFLINE, UF_READONLY, UF_SPARSE, UF_REPARSE, UF_SYSTEM
    UF_ARCHIVE is not supported by intention (yet)

FreeBSD/src 345494head/sys/netinet sctp_indata.c

Fix the handling of fragmented unordered messages when using DATA chunks
and FORWARD-TSN.

This bug was reported in https://github.com/sctplab/usrsctp/issues/286
for the userland stack.

This is joint work with rrs@.

MFC after:             1 week

FreeBSD/src 345493head/sys/dev/usb/wlan if_run.c

run(4): merge some common TSF-related code into run_disable_tsf()

No functional change intended.

MFC after:      5 days

FreeBSD/src 345492head/sys/mips/atheros ar71xx_gpio.c ar71xx_gpiovar.h

The Atheros AR7241 has 20 GPIO pins

AR724X_GPIO_PINS used for this family is defined as 18
The datasheet for the AR7241 describes 20 pins, allow all to be used.

Submitted by:   Hiroki Mori <yamori813 at yahoo.co.jp>
Reviewed by:    mizhka
Differential Revision:  https://reviews.freebsd.org/D17580

FreeBSD/src 345491head/sys/conf options, head/sys/fs/tmpfs tmpfs_vfsops.c tmpfs.h

Make TMPFS_PAGES_MINRESERVED a kernel option

TMPFS_PAGES_MINRESERVED controls how much memory is reserved for the system
and not used by tmpfs.

On very small memory systems, the default value may be too high and this
prevents these small memory systems from using reroot, which is required
for them to install firmware updates.

Submitted by:   Hiroki Mori <yamori813 at yahoo.co.jp>
Reviewed by:    mizhka
Differential Revision:  https://reviews.freebsd.org/D13583

FreeBSD/src 345490head/gnu/usr.bin/binutils/as Makefile, head/gnu/usr.bin/binutils/ld Makefile

Apply WITH_PIE changes to other binutils components

Followon to r345489, explicitly specified bare .a libraries need
${PIE_SUFFIX} (although these still built).

MFC with:       r345489

FreeBSD/src 345489head/gnu/usr.bin/binutils/objdump Makefile

Fix GNU objdump build under WITH_PIE

Explicitly specified bare .a libraries need ${PIE_SUFFIX}.

Reported by:    David E. Cross, on twitter

FreeBSD/src 345488head/tools/build/options WITHOUT_RETPOLINE

Add description for WITHOUT_RETPOLINE

Not used by default at the moment, but added for the benefit of
downstream projects/branches with different options.

FreeBSD/src 345487stable/12/bin/sh sh.1 jobs.c, stable/12/bin/sh/tests/execution Makefile pipefail6.42

MFC r344502: sh: Add set -o pipefail

The pipefail option allows checking the exit status of all commands in a
pipeline more easily, at a limited cost of complexity in sh itself. It works
similarly to the option in bash, ksh93 and mksh.

Like ksh93 and unlike bash and mksh, the state of the option is saved when a
pipeline is started. Therefore, even in the case of commands like
  A | B &
a later change of the option does not affect the exit status, the same way
  (A | B) &
works.

Since SIGPIPE is not handled specially, more work in the script is required
for a proper exit status for pipelines containing commands such as head that
may terminate successfully without reading all input. This can be something
like

(
        cmd1
        r=$?
        if [ "$r" -gt 128 ] && [ "$(kill -l "$r")" = PIPE ]; then
               exit 0
        else
               exit "$r"

    [5 lines not shown]

FreeBSD/src 345486head/lib/libvgl vgl.h vgl.3

Oops, my previous commit to libvgl was missing the change of VGLSetBorder()
to match the change in its declaration.  Change the declaration back to
"byte color" since setting of the border color is not supported for more
than 256 colors.

FreeBSD/src 345485head/sys/dev/mpr mpr_table.c, head/sys/dev/mps mps_table.c

Add event table decoding for SAS Broadcast Primitive events.

FreeBSD/src 345484head/lib/libvgl vgl.3 vgl.h

Fix the type of the color args for VGLMouseFreeze(), VGLBitmapPutChar(),
VGLBitmapString() and VGLSetBorder() so as to not truncate to 8 bits.

Complete the corresponding fix for VGLGetXY() and VGLPutXY() (parts
of the man page were out of date).

FreeBSD/src 345483head/lib/libvgl text.c

Add support for arbitrary font widths.  Only multiples of 8 were supported.

Since the font format is undocumented, it is unclear how non-multiples
of 8 should be padded to bytes in the font file.  Use the same
representation as bdf text format (big- endian, with padding in the
lower bits).
DeltaFile
+17-13head/lib/libvgl/text.c
+17-131 files

FreeBSD/src 345482head/sys/dev/mps mps.c

Fix a transposition error from the previous commit

FreeBSD/src 345481head/lib/libvgl simple.c

Fix reading of pixels in (4 and 8-plane) planar modes.

There seems to be no alternative to reading each plane independently using
3 slow i/o's per plane (this delivers 8 nearby pixels, but we don't buffer
the results so run 8 times slower than necessary.

All the code for this was there, but it was ifdefed out and replaced by
simpler code that cannot work in planar modes.  The ifdefed out code
was correct except it was missing a volatile declaration, so compilers
optimized the multiple dummy reads in it to a single read.

FreeBSD/src 345480head/sys/conf files, head/sys/geom geom_flashmap.h geom_flashmap.c

Support device-independent labels for geom_flashmap slices.

While geom_flashmap has always supported label names for its slices, it does
so by appending "s.labelname" to the provider device name, meaning you still
have to know the name and unit of the hardware device to use the labels.

These changes add support for device-independent geom_flashmap labels, using
the standard geom_label infrastructure. geom_flashmap now creates a softc
struct attached to its geom, and as it creates slices it stores the label
into an array in the softc. The new geom_label_flashmap uses those labels
when tasting a geom_flashmap provider.

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

FreeBSD/src 345479head/sys/dev/mpr mpr.c, head/sys/dev/mps mps.c

r329522 created problemss with commands that enter the TIMEDOUT state but
are successfully returned by the card (usually due to an abort being issued
as part of timeout recovery). Remove what amounts to an insufficient
KASSERT, and don't overwrite the state value. State should probably be
re-designed, and that will be done with a future commit.

Reported by:    phk, bei.io
Reviewed by:    imp, mav
Differential Revision:  D19677

FreeBSD/src 345478head/lib/libvgl main.c bitmap.c

Fix buffer overruns in modes with color depth more than 8.

Support for 16-bit and 32-bit Truecolor modes was supposed to be
complete in r70991 of main.c and in nearby revisions for other files, but
it was broken by the overruns in most cases (all cases were the mouse
is enabled, and most cases where bitmaps are used).  r70991 also
uninintentionally added support for depths 9-15, 17-23 and 25-31.
Depth 24 was more obviously broken and its support is ifdefed out.  In
the other ranges, only depth 15 is common.  It was broken by buffer
overruns in all cases.

bitmap.c:
- the static buffer was used even when it was too small (but it was
  large enough to often work accidentally in depth 16)
- the size of the dynamically allocated buffer was too small
- the sizing info bitmap->PixelBytes was not inititialzed in the bitmap
  constructor.  It often ended up as 0 for MEMBUFs, so using it in more
  places gave more null pointer accesses.  (It is per-bitmap, but since
  conversion between bitmaps of different depths is not supported (except
  from 4 bits by padding to 8), it would work better if it were global.)

main.c:
- depths were rounded down instead of up to a multiple of 8, so PixelBytes
  was 1 too small for depths above 8 except 16, 24 and 32.
- PixelBytes was not initialized for 4-bit planar modes.  It isn't really

    [17 lines not shown]

FreeBSD/src 345477head/stand/common disk.h disk.c, head/stand/efi/loader main.c

Distinguish between "no partition" and "choose best partition" with a constant.

The values of the d_slice and d_partition fields of a disk_devdesc have a
few values with special meanings in the disk_open() routine. Through various
evolutions of the loader code over time, a d_partition value of -1 has
meant both "use the first ufs partition found in the bsd label" and "don't
open a bsd partition at all, open the raw slice."

This defines a new special value of -2 to mean open the raw slice, and it
gives symbolic names to all the special values used in d_slice and
d_partition, and adjusts all existing uses of those fields to use the new
constants.

The phab review for this timed out without being accepted, but I'm still
citing it below because there is useful commentary there.

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

FreeBSD/src 345476head/sys/kern kern_intr.c

Revert accidental change that should not have been included in r345475.
I had changed this value as part of a local experiment, and neglected to
change it back before committing the other changes.

FreeBSD/src 345475head/sys/kern kern_intr.c

Truncate a too-long interrupt handler name when there is only one handler.

There are only 19 bytes available for the name of an interrupt plus the
name(s) of handlers/drivers using it. There is a mechanism from the days of
shared interrupts that replaces some of the handler names with '+' when they
don't all fit into 19 bytes.

In modern times there is typically only one device on an interrupt, but long
device names are the norm, especially with embedded systems. Also, in systems
with multiple interrupt controllers, the names of the interrupts themselves
can be long. For example, 'gic0,s54: imx6_anatop0' doesn't fit, and
replacing the device driver name with a '+' provides no useful info at all.

When there is only one handler but its name was too long to fit, this
change truncates enough leading chars of the handler name (replacing them
with a '-' char to indicate that some chars are missing) to use all 19
bytes, preserving the unit number typically on the end of the name. Using
the prior example, this results in: 'gic0,s54:-6_anatop0' which provides
plenty of info to figure out which device is involved.

PR:            211946
Reviewed by:    gonzo@ (prior version without the '-' char)
Differential Revision:  https://reviews.freebsd.org/D19675

FreeBSD/src 345474head/lib/libvgl main.c

Fix libvgl to not always fail to initialize due to its invalid mmap()
args (neither MAP_PRIVATE nor MAP_SHARED).  It was broken in r271635
and/or r271724 by stricter checking.  The compatibility code in r271724
doesn't work for my old binaries (actually new binaries with old
libraries).

PR:            needed to test the fix for PR 162373

FreeBSD/src 345473head/sys/compat/linux linux_fork.c

Whitespace cleanup (annoying).

MFC after:      1 month

FreeBSD/src 345472head/sys/amd64/linux linux_systrace_args.c linux_syscalls.c, head/sys/amd64/linux32 linux32_systrace_args.c linux32_proto.h

Regen from r345471.

MFC after:      1 month

FreeBSD/src 345471head/sys/amd64/linux syscalls.master, head/sys/amd64/linux32 syscalls.master linux32_dummy.c

Update syscall.master to 5.0.

For 32-bit Linuxulator, ipc() syscall was historically
the entry point for the IPC API. Starting in Linux 4.18, direct
syscalls are provided for the IPC. Enable it.

MFC after:      1 month

FreeBSD/src 345470head/sys/amd64/linux32 linux32_systrace_args.c linux32_proto.h, head/sys/i386/linux linux_systrace_args.c linux_proto.h

Regen for r345469 (shmat()).

MFC after:      1 month

FreeBSD/src 345469head/sys/amd64/linux32 linux32_machdep.c syscalls.master, head/sys/compat/linux linux_ipc.c linux_ipc.h

Linux between 4.18 and 5.0 split IPC system calls.
In preparation for doing this in the Linuxulator modify our linux_shmat()
to match actual Linux shmat() system call.

MFC after:      1 month

FreeBSD/src 345468head/sys/amd64/linux linux_machdep.c

Revert r313993.
AMD64_SET_**BASE expects a pointer to a pointer, we just passing in the pointer value 
itself.

Set PCB_FULL_IRET for doreti to restore %fs, %gs and its correspondig base.

PR:            225105
Reported by:    trasz@
MFC after:      1 month

FreeBSD/src 345467head/sys/netinet sctp_output.c sctputil.c

Fix build issue for the userland stack.
Joint work with rrs@.

MFC after:             1 week

FreeBSD/src 345466head/sys/netinet sctp_output.c sctp_structs.h

Fox more signed unsigned issues. This time on the send path.
This is joint work with rrs@ and was found by running syzkaller.

MFC after:             1 week

FreeBSD/src 345465head/sys/netinet sctputil.c

Fix a signed/unsigned bug when receiving SCTP messages.
This is joint work with rrs@.

Reported by:           syzbot+6b8a4bc8cc828e9d9790 at syzkaller.appspotmail.com
MFC after:             1 week

FreeBSD/src 345464head/sys/dev/cfi cfi_core.c cfi_var.h

Fix AMD type flash write operations, and display chip information at boot

Applies to MX flash chips on AR9132 and RT3050

Submitted by:   Hiroki Mori <yamori813 at yahoo.co.jp>
Reviewed by:    imp, sbruno
Differential Revision:  https://reviews.freebsd.org/D14279

FreeBSD/src 345463stable 12, stable/12/share/examples/kld/dyn_sysctl dyn_sysctl.c

MFC r345220:

Fix build for KLD dyn_sysctl example

Looks like the example was broken by change of SYSCTL_STATIC_CHILDREN
definition in r267992. Fix build by switching to using SYSCTL_ADD_ROOT_NODE

PR:            236139
Submitted by:   Andrew Reiter <arr at watson.org>

FreeBSD/src 345462stable 12, stable/12/sys/dev/beri/virtio virtio_block.c

MFC r343998:

Fix off-by-one error in BERI virtio driver

The hardcoded ident is exactly 20 bytes long but sprintf adds terminating zero,
so there is one byte written out of array bounds.As a fix use strncpy it
appends \0 only if space allows and its behavior matches virtio spec:

When VIRTIO_BLK_T_GET_ID is issued, the device identifier, up to 20 bytes, is
written to the buffer. The identifier should be interpreted as an ascii string.
It is terminated with \0, unless it is exactly 20 bytes long.

PR:            202298
Reviewed by:    br
Differential Revision:  https://reviews.freebsd.org/D18852