]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoMerge r345574 from vendor-crypto:
emaste [Wed, 27 Mar 2019 14:35:38 +0000 (14:35 +0000)]
Merge r345574 from vendor-crypto:

upstream: when checking that filenames sent by the server side

match what the client requested, be prepared to handle shell-style brace
alternations, e.g. "{foo,bar}".

"looks good to me" millert@ + in snaps for the last week courtesy
deraadt@

OpenBSD-Commit-ID: 3b1ce7639b0b25b2248e3a30f561a548f6815f3e

Discussed with: des
Obtained from: OpenSSH-portable 3d896c157c722bc47adca51a58dca859225b5874

5 years agoAdd missing break statements. Coverity CID 1400446.
scottl [Wed, 27 Mar 2019 12:25:46 +0000 (12:25 +0000)]
Add missing break statements.  Coverity CID 1400446.

Reported by: mav

5 years agoFix copying of bitmaps in depths > 8. This fix is complete, except different
bde [Wed, 27 Mar 2019 08:02:55 +0000 (08:02 +0000)]
Fix copying of bitmaps in depths > 8.  This fix is complete, except different
depths for the source and target are not supported.  The bits for higher
numbered planes (mostly for red) were either not copied or were copied to
lower numbered planes for nearby pixels.

Quick fix for creation of mouse cursor bitmaps in all depths.   This fix is
only complete for the default lightwhite cursor with a black frame.

Even the lightwhite and black colors are hard to find.  The templates
use 0xff for lightwhite, but that means brightblue in the simplest mode
(Truecolor depth 24).  Other modes are even more complicated -- they are
singly or doubly indirect throught palette(s) and changing of the palettes
by applications is supported.

Details:

Replicate the template value for Truecolor modes to fill out the target
depth (and more for depths not a multiple of 8).  Do this for every
drawing of the cursor so that it sort of works for mouse cursor bitmaps
set by applications.

Use 0xf for lightwhite in most other modes.  Only do this for the
default cursor so that it doesn't affect mouse cursor bitmaps set by
applications.  0xf mostly works because it was originally for CGA
lightwhite and is emulated using 1 or 2 indirections on EGA and VGA.
0x3f (EGA white) and 0xff (VGA black) direct palette indexes mostly
don't work since backwards compatibility inhibits or prevents them
representing lightwhite.  But 0x3f (EGA white) must be used for mode
37 (VGA_MODEX) (320x240x8 V) since this mode is closer to EGA than VGA.

5 years agox86: Use XSAVEOPT for fpusave(), when available
cem [Tue, 26 Mar 2019 22:45:41 +0000 (22:45 +0000)]
x86: Use XSAVEOPT for fpusave(), when available

Remove redundant npxsave_core definition while here.

Suggested by: Anton Rang
Reviewed by: kib, Anton Rang <rang AT acm.org>
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D19665

5 years agoAdd CTLFLAG_VNET to the net.inet.icmp.tstamprepl definition.
markj [Tue, 26 Mar 2019 22:14:50 +0000 (22:14 +0000)]
Add CTLFLAG_VNET to the net.inet.icmp.tstamprepl definition.

Reported by: Hans Fiedler <hans@hfconsulting.com>
MFC after: 3 days

5 years agopf: use UID_ROOT and GID_WHEEL named constants in make_dev
emaste [Tue, 26 Mar 2019 21:20:42 +0000 (21:20 +0000)]
pf: use UID_ROOT and GID_WHEEL named constants in make_dev

No functional change but improves consistency and greppability of
make_dev calls.

Discussed with: kp

5 years agoAdd special psuedo-options for the base/{binutils,gcc} ports.
jhb [Tue, 26 Mar 2019 20:56:12 +0000 (20:56 +0000)]
Add special psuedo-options for the base/{binutils,gcc} ports.

The WITH_PORT_BASE_{BINUTILS,GCC} options are used to prevent 'make check-old'
and 'make delete-old' from deleting files installed by the base/binutils
and base/gcc packages as normally one disables the in-tree variants
(e.g. WITHOUT_BINUTILS) when using these packages.

Reviewed by: bapt (earlier version)
Differential Revision: https://reviews.freebsd.org/D19483

5 years agoRemove the TIMED src option from the list of options.
jhb [Tue, 26 Mar 2019 20:44:02 +0000 (20:44 +0000)]
Remove the TIMED src option from the list of options.

This was missed in r342139 when timed(8) was removed and fixes a
warning when running makeman to regenerate src.conf.5.

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

5 years agostand: remove CLANG_NO_IAS from zfsldr
emaste [Tue, 26 Mar 2019 20:32:05 +0000 (20:32 +0000)]
stand: remove CLANG_NO_IAS from zfsldr

Many components under stand/ had CLANG_NO_IAS added when Clang's
Integrated Assembler (IAS) did not handle .codeNN directives.  Clang
gained support quite some time ago, and we can now build stand/ with
IAS.

Note that in some cases there are small differences in the generated
output, so CLANG_NO_IAS should be removed only after testing (or after
finding no differences in the output).  For zfsldr I compared objdump
output between GNU as- and Clang IAS-built zfsldr and .text was
identical (changes were limited to the object's ELF headers and debug
info).

Sponsored by: The FreeBSD Foundation

5 years agoinit: pedantic correction to "can't exec" script warning
emaste [Tue, 26 Mar 2019 19:38:25 +0000 (19:38 +0000)]
init: pedantic correction to "can't exec" script warning

Direct /etc/rc exec was introduced in r337321, with a fallback to
passing it to sh if direct exec fails.  "Can't exec" is slightly
misleading in this case (the script is still executed, just not
directly).

5 years agoDTF_REWIND does nothing (since r247236) so retire its use
emaste [Tue, 26 Mar 2019 19:35:41 +0000 (19:35 +0000)]
DTF_REWIND does nothing (since r247236) so retire its use

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

5 years agoImprove error reporting when the swap pager runs out of memory.
trasz [Tue, 26 Mar 2019 19:11:15 +0000 (19:11 +0000)]
Improve error reporting when the swap pager runs out of memory.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D19699

5 years agoChange default value of kern.bootfile to reflect reality
gonzo [Tue, 26 Mar 2019 18:03:18 +0000 (18:03 +0000)]
Change default value of kern.bootfile to reflect reality

In most cases kernel.bootfile is populated from the information
provided by loader(8). There are certain scenarios when loader
is not available, for instance when kernel is loaded by u-boot
or some other BootROM directly. In this case the default value
"/kernel" points to invalid location and breaks some functinality,
like using installkernel on self-hosted system or dtrace's CTF
lookup. This can be fixed by setting the value manually but the
default that reflects correct location is better than default that
points to invalid one.

Current default was set around FreeBSD 1, when "/kernel" was the
actual path. Transition to /boot/kernel/kernel happened circa FreeBSD 3.

PR: 221550
Reviewed by: ian, imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D18902

5 years agoMake smartpqi(4) behave better when running out of memory, by returning
trasz [Tue, 26 Mar 2019 15:47:13 +0000 (15:47 +0000)]
Make smartpqi(4) behave better when running out of memory, by returning
CAM_RESRC_UNAVAIL instead of CAM_REQUEUE_REQ.  This makes CAM delay a bit
before retrying, so that the retries actually get a chance to succeed.

Reviewed by: sbruno
MFC after: 2 weeks
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D19696

5 years ago.Xr trim(8) from dd(1).
trasz [Tue, 26 Mar 2019 15:44:06 +0000 (15:44 +0000)]
.Xr trim(8) from dd(1).

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoFactor out resource limit enforcement code in the ELF loader.
trasz [Tue, 26 Mar 2019 15:35:49 +0000 (15:35 +0000)]
Factor out resource limit enforcement code in the ELF loader.
It makes the code slightly easier to follow, and might make
it easier to fix the resouce accounting to also account for
the interpreter.

The PROC_UNLOCK() is moved earlier - I don't see anything
it should protect; the lim_max() is a wrapper around lim_rlimit(),
and that, differently from lim_rlimit_proc(), doesn't require
the proc lock to be held.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D19689

5 years agoFix a small bug in the tcp_log_id where the bucket
rrs [Tue, 26 Mar 2019 10:41:27 +0000 (10:41 +0000)]
Fix a small bug in the tcp_log_id where the bucket
was unlocked and yet the bucket-unlock flag was not
changed to false. This can cause a panic if INVARIANTS
is on and we go through the right path (though rare).

Reported by: syzbot+179a1ad49f3c4c215fa2@syzkaller.appspotmail.com
Reviewed by: tuexen@
MFC after: 1 week

5 years agoSZ has been known as Eswatini since April 2018 (formerly Swaziland).
philip [Tue, 26 Mar 2019 09:46:17 +0000 (09:46 +0000)]
SZ has been known as Eswatini since April 2018 (formerly Swaziland).

Sources:
https://www.iso.org/obp/ui/#iso:code:3166:SZ
http://www.un.org/en/member-states/index.html#gotoE
http://www.times.co.sz/news/118373-kingdom-of-eswatini-change-now-official.html

MFC after: 3 days

5 years agoFix a double free of an SCTP association in an error path.
tuexen [Tue, 26 Mar 2019 08:27:00 +0000 (08:27 +0000)]
Fix a double free of an SCTP association in an error path.
This is joint work with rrs@. The issue was found by running
syzkaller.

MFC after: 1 week

5 years agoImport tzdata 2019a
philip [Tue, 26 Mar 2019 08:10:51 +0000 (08:10 +0000)]
Import tzdata 2019a

Changes: https://github.com/eggert/tz/blob/2019a/NEWS

MFC after: 3 days

5 years agopowerpc64: Micro-optimize moea64 native pmap tlbie
jhibbits [Tue, 26 Mar 2019 02:53:35 +0000 (02:53 +0000)]
powerpc64: Micro-optimize moea64 native pmap tlbie

* Cache moea64_need_lock in a local variable; gcc generates slightly better
  code this way, it doesn't need to reload the value from memory each read.
* VPN cropping is only needed on PowerPC ISA 2.02 and older cores, a subset
  of those that need serialization, so move this under the need_lock check,
  so those that don't need the lock don't even need to check this.

5 years agoAllow kernel config to specify DTS/DTSO to build, and out-of-tree support
kevans [Tue, 26 Mar 2019 02:45:23 +0000 (02:45 +0000)]
Allow kernel config to specify DTS/DTSO to build, and out-of-tree support

This allows for directives such as

makeoptions DTS+=/out/of/tree/myboard.dts
# in tree! Same rules applied as if this were in a dtb/ module
makeoptions DTS+=otherboard.dts

to be specified in config(5) and have these built/installed alongside th
kernel. The assumption that overlays live in an overlays/ directory is only
made for in-tree DTSO, but we still make the assumption that out-of-tree
arm64 DTS will be in vendored directories (for now).

This lowers the cost to hacking on an overlay or dts by being able to
quickly throw it in a custom config, especially if it doesn't fit one of the
current dtb/modules quite appropriately or it's not intended for commit
there.

The build/install targets were split out of dtb.mk to centralize the build
logic and leave out the all/realinstall/CLEANFILES additions... it was
believed that we didn't want to pollute the kernel build with these.

The build rules were converted to suffix rules at the suggestion of Ian to
clean things up a little bit in a world where we can have mixed
in-tree/out-of-tree DTS/DTSO specified.

Reviewed by: ian
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D19351

5 years agolualoader: Fix up some luacheck concerns
kevans [Tue, 26 Mar 2019 02:35:58 +0000 (02:35 +0000)]
lualoader: Fix up some luacheck concerns

- Garbage collect an unused (removed because it was useless) constant
- Don't bother with vararg notation if args will not be used

MFC after: 1 week

5 years agolualoader: Clear the screen before prompting for password
kevans [Tue, 26 Mar 2019 02:33:27 +0000 (02:33 +0000)]
lualoader: Clear the screen before prompting for password

Assuming that the autoboot sequence was interrupted, we've done enough
cursor manipulation that the prompt for the password will be sufficiently
obscured a couple of lines up. Clear the screen and reset the cursor
position here, too.

MFC after: 1 week

5 years agoMFV r345515: netbsd-tests: import memory bump for libc/regex/t_exhaust
kevans [Tue, 26 Mar 2019 02:21:09 +0000 (02:21 +0000)]
MFV r345515: netbsd-tests: import memory bump for libc/regex/t_exhaust

MFC after: 3 days

5 years agoRefine r345425: get rid of superfluous helper macro that I have added.
sobomax [Tue, 26 Mar 2019 01:28:10 +0000 (01:28 +0000)]
Refine r345425: get rid of superfluous helper macro that I have added.

MFC after: 2 weeks

5 years agoReject F_SETLK_REMOTE commands when sysid == 0.
markj [Mon, 25 Mar 2019 21:38:58 +0000 (21:38 +0000)]
Reject F_SETLK_REMOTE commands when sysid == 0.

A sysid of 0 denotes the local system, and some handlers for remote
locking commands do not attempt to deal with local locks.  Note that
F_SETLK_REMOTE is only available to privileged users as it is intended
to be used as a testing interface.

Reviewed by: kib
Reported by: syzbot+9c457a6ae014a3281eb8@syzkaller.appspotmail.com
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19702

5 years agoCorrect contradictory information on default syslog logging priority.
grembo [Mon, 25 Mar 2019 21:14:51 +0000 (21:14 +0000)]
Correct contradictory information on default syslog logging priority.

MFC after: 1 week

5 years agoSort printing of the ID registers on arm64 to be identical to the
andrew [Mon, 25 Mar 2019 18:02:04 +0000 (18:02 +0000)]
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

5 years agoInitialize scheduler specific data for the FCFS scheduler.
tuexen [Mon, 25 Mar 2019 16:40:54 +0000 (16:40 +0000)]
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

5 years agoImprove locking when tearing down an SCTP association.
tuexen [Mon, 25 Mar 2019 15:23:20 +0000 (15:23 +0000)]
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

5 years agoChange all kernel C-type macros into static inline functions.
hselasky [Mon, 25 Mar 2019 13:50:38 +0000 (13:50 +0000)]
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

5 years agoMFV r345495:
mm [Mon, 25 Mar 2019 11:49:57 +0000 (11:49 +0000)]
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

5 years agoFix another type of buffer overrun for segmented modes. The buffer index
bde [Mon, 25 Mar 2019 11:48:40 +0000 (11:48 +0000)]
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.

5 years agoUpdate vendor/libarchive/dist to git 3c079320b23ddf5ef38c443569c25898ad79ddb9
mm [Mon, 25 Mar 2019 11:39:49 +0000 (11:39 +0000)]
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)

5 years agoFix the handling of fragmented unordered messages when using DATA chunks
tuexen [Mon, 25 Mar 2019 09:47:22 +0000 (09:47 +0000)]
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

5 years agorun(4): merge some common TSF-related code into run_disable_tsf()
avos [Mon, 25 Mar 2019 09:10:07 +0000 (09:10 +0000)]
run(4): merge some common TSF-related code into run_disable_tsf()

No functional change intended.

MFC after: 5 days

5 years agoThe Atheros AR7241 has 20 GPIO pins
allanjude [Mon, 25 Mar 2019 07:48:52 +0000 (07:48 +0000)]
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@yahoo.co.jp>
Reviewed by: mizhka
Differential Revision: https://reviews.freebsd.org/D17580

5 years agoMake TMPFS_PAGES_MINRESERVED a kernel option
allanjude [Mon, 25 Mar 2019 07:46:20 +0000 (07:46 +0000)]
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@yahoo.co.jp>
Reviewed by: mizhka
Differential Revision: https://reviews.freebsd.org/D13583

5 years agoApply WITH_PIE changes to other binutils components
emaste [Mon, 25 Mar 2019 01:18:26 +0000 (01:18 +0000)]
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

5 years agoFix GNU objdump build under WITH_PIE
emaste [Mon, 25 Mar 2019 01:06:29 +0000 (01:06 +0000)]
Fix GNU objdump build under WITH_PIE

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

Reported by: David E. Cross, on twitter

5 years agoAdd description for WITHOUT_RETPOLINE
emaste [Sun, 24 Mar 2019 23:26:03 +0000 (23:26 +0000)]
Add description for WITHOUT_RETPOLINE

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

5 years agoOops, my previous commit to libvgl was missing the change of VGLSetBorder()
bde [Sun, 24 Mar 2019 20:43:21 +0000 (20:43 +0000)]
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.

5 years agoAdd event table decoding for SAS Broadcast Primitive events.
scottl [Sun, 24 Mar 2019 20:37:37 +0000 (20:37 +0000)]
Add event table decoding for SAS Broadcast Primitive events.

5 years agoFix the type of the color args for VGLMouseFreeze(), VGLBitmapPutChar(),
bde [Sun, 24 Mar 2019 20:36:35 +0000 (20:36 +0000)]
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).

5 years agoAdd support for arbitrary font widths. Only multiples of 8 were supported.
bde [Sun, 24 Mar 2019 19:41:45 +0000 (19:41 +0000)]
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).

5 years agoFix a transposition error from the previous commit
scottl [Sun, 24 Mar 2019 19:29:30 +0000 (19:29 +0000)]
Fix a transposition error from the previous commit

5 years agoFix reading of pixels in (4 and 8-plane) planar modes.
bde [Sun, 24 Mar 2019 19:27:03 +0000 (19:27 +0000)]
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.

5 years agoSupport device-independent labels for geom_flashmap slices.
ian [Sun, 24 Mar 2019 19:11:45 +0000 (19:11 +0000)]
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

5 years agor329522 created problemss with commands that enter the TIMEDOUT state but
scottl [Sun, 24 Mar 2019 19:09:50 +0000 (19:09 +0000)]
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

5 years agoFix buffer overruns in modes with color depth more than 8.
bde [Sun, 24 Mar 2019 18:57:03 +0000 (18:57 +0000)]
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
  used for frame buffer accesses in these modes, but needs to be 1 in
  MEMBUF images.

mouse.c:
- the mouse cursor buffers were too small.

vgl.h:
- PixelBytes was not initialized in the static bitmap constructor.  It
  should be initialized to the value for the current mode, but that is
  impossible in a static constructor.  Initialize it to -1 so as to
  fail if it is used without further initialization.

All modes that are supposed to be supported now don't crash in
nontrivial tests, and almost work.  Missing uses of PixelBytes now
give in-bounds wrong pointers instead of overruns.  Misconversions of
bitmaps give multiple miscolored mouse cursors instead of 1 white one,
and similarly for bitmaps copied through a MEMBUF.

5 years agoDistinguish between "no partition" and "choose best partition" with a constant.
ian [Sun, 24 Mar 2019 18:51:52 +0000 (18:51 +0000)]
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

5 years agoRevert accidental change that should not have been included in r345475.
ian [Sun, 24 Mar 2019 18:02:27 +0000 (18:02 +0000)]
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.

5 years agoTruncate a too-long interrupt handler name when there is only one handler.
ian [Sun, 24 Mar 2019 17:53:26 +0000 (17:53 +0000)]
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

5 years agoFix libvgl to not always fail to initialize due to its invalid mmap()
bde [Sun, 24 Mar 2019 16:47:43 +0000 (16:47 +0000)]
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

5 years agoWhitespace cleanup (annoying).
dchagin [Sun, 24 Mar 2019 15:08:30 +0000 (15:08 +0000)]
Whitespace cleanup (annoying).

MFC after: 1 month

5 years agoRegen from r345471.
dchagin [Sun, 24 Mar 2019 14:51:17 +0000 (14:51 +0000)]
Regen from r345471.

MFC after: 1 month

5 years agoUpdate syscall.master to 5.0.
dchagin [Sun, 24 Mar 2019 14:50:02 +0000 (14:50 +0000)]
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

5 years agoRegen for r345469 (shmat()).
dchagin [Sun, 24 Mar 2019 14:46:07 +0000 (14:46 +0000)]
Regen for r345469 (shmat()).

MFC after: 1 month

5 years agoLinux between 4.18 and 5.0 split IPC system calls.
dchagin [Sun, 24 Mar 2019 14:44:35 +0000 (14:44 +0000)]
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

5 years agoRevert r313993.
dchagin [Sun, 24 Mar 2019 14:02:57 +0000 (14:02 +0000)]
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

5 years agoFix build issue for the userland stack.
tuexen [Sun, 24 Mar 2019 12:13:05 +0000 (12:13 +0000)]
Fix build issue for the userland stack.
Joint work with rrs@.

MFC after: 1 week

5 years agoFox more signed unsigned issues. This time on the send path.
tuexen [Sun, 24 Mar 2019 10:40:20 +0000 (10:40 +0000)]
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

5 years agoFix a signed/unsigned bug when receiving SCTP messages.
tuexen [Sun, 24 Mar 2019 09:46:16 +0000 (09:46 +0000)]
Fix a signed/unsigned bug when receiving SCTP messages.
This is joint work with rrs@.

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

5 years agoFix AMD type flash write operations, and display chip information at boot
allanjude [Sun, 24 Mar 2019 06:28:25 +0000 (06:28 +0000)]
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@yahoo.co.jp>
Reviewed by: imp, sbruno
Differential Revision: https://reviews.freebsd.org/D14279

5 years agoLimit the size of messages sent on 1-to-many style SCTP sockets with the
tuexen [Sat, 23 Mar 2019 22:56:03 +0000 (22:56 +0000)]
Limit the size of messages sent on 1-to-many style SCTP sockets with the
SCTP_SENDALL flag. Allow also only one operation per SCTP endpoint.

This fixes an issue found by running syzkaller and is joint work with rrs@.

MFC after: 1 week

5 years agoLimit the number of bytes which can be queued for SCTP sockets.
tuexen [Sat, 23 Mar 2019 22:46:29 +0000 (22:46 +0000)]
Limit the number of bytes which can be queued for SCTP sockets.
This is joint work with rrs@.
Reported by: syzbot+307f167f9bc214f095bc@syzkaller.appspotmail.com
MFC after: 1 week

5 years agoAdd sysctl variable net.inet.tcp.rexmit_initial for setting RTO.Initial
tuexen [Sat, 23 Mar 2019 21:36:59 +0000 (21:36 +0000)]
Add sysctl variable net.inet.tcp.rexmit_initial for setting RTO.Initial
used by TCP.

Reviewed by: rrs@, 0mp@
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D19355

5 years agoAdd descriptions for sysctls in kern_mib.c and sysctl.3 which lack them.
rpokala [Sat, 23 Mar 2019 19:53:15 +0000 (19:53 +0000)]
Add descriptions for sysctls in kern_mib.c and sysctl.3 which lack them.

r343532 noted the difference between "hw.realmem" and "hw.physmem", which I
was previously unaware of. I discovered that neither sysctl had a
description visible via `sysctl -d', so I found where they were defined and
added suitable descriptions. While in the file, I went ahead and added
descriptions for all the others which lacked them. I also updated sysctl.3
accordingly

Reviewed by: kib, bcr
MFC after: 1 weeks
Sponsored by: Panasas
Differential Revision: https://reviews.freebsd.org/D19007

5 years agoRemove duplicate options.
imp [Sat, 23 Mar 2019 18:32:28 +0000 (18:32 +0000)]
Remove duplicate options.

5 years agoAdd device xz. This was somehow missed in the last round.
imp [Sat, 23 Mar 2019 18:32:24 +0000 (18:32 +0000)]
Add device xz. This was somehow missed in the last round.

Submitted by: Brandon Bergren

5 years agoASLR: check for max_addr after applying randomization, not before.
kib [Sat, 23 Mar 2019 16:36:18 +0000 (16:36 +0000)]
ASLR: check for max_addr after applying randomization, not before.

Otherwise resulting address from vm_map_find() migh not satisfy the
upper limit.  For instance, it could affect MAP_32BIT flag from 64bit
processes.

Found by: Doug Moore <dougm@rice.edu>
Reviewed by: alc, Doug Moore <dougm@rice.edu>
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D19688

5 years agoAdd ability to automatically load ipfw_nat64, ipfw_nptv6 and ipfw_pmod
ae [Sat, 23 Mar 2019 15:41:32 +0000 (15:41 +0000)]
Add ability to automatically load ipfw_nat64, ipfw_nptv6 and ipfw_pmod
modules by declaring corresponding variables in rc.conf. Also document
them in rc.conf(5).

Submitted by: Dries Michiels
Differential Revision: https://reviews.freebsd.org/D19673

5 years agoPull in r356809 from upstream llvm trunk (by Eli Friedman):
dim [Sat, 23 Mar 2019 14:10:05 +0000 (14:10 +0000)]
Pull in r356809 from upstream llvm trunk (by Eli Friedman):

  [ARM] Don't form "ands" when it isn't scheduled correctly.

  In r322972/r323136, the iteration here was changed to catch cases at
  the beginning of a basic block... but we accidentally deleted an
  important safety check.  Restore that check to the way it was.

  Fixes https://bugs.llvm.org/show_bug.cgi?id=41116

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

This should fix "Assertion failed: (LiveCPSR && "CPSR liveness tracking
is wrong!"), function UpdateCPSRUse" errors when building the devel/xwpe
port for armv7.

PR: 236062, 236568
MFC after: 1 month
X-MFC-With: r344779

5 years agoRemove trunc_page_ps() and round_page_ps() macros. This completes
trasz [Sat, 23 Mar 2019 13:41:14 +0000 (13:41 +0000)]
Remove trunc_page_ps() and round_page_ps() macros.  This completes
the undoing of r100384.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D19680

5 years agoAdd UPDATING note for geom_uzip(4)/xz, and bump geom_uzip(4) man page date.
kib [Sat, 23 Mar 2019 10:13:01 +0000 (10:13 +0000)]
Add UPDATING note for geom_uzip(4)/xz, and bump geom_uzip(4) man page date.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

5 years agoFix a KASSERT() in tcp_output().
tuexen [Sat, 23 Mar 2019 09:56:41 +0000 (09:56 +0000)]
Fix a KASSERT() in tcp_output().

When checking the length of the headers at this point, the IP level
options have not been added to the mbuf chain.
So don't take them into account.

Reported by: syzbot+16025fff7ee5f7c5957b@syzkaller.appspotmail.com
Reported by: syzbot+adb5836b8a9ff621b2aa@syzkaller.appspotmail.com
Reported by: syzbot+d25a5352bcdf40acdbb8@syzkaller.appspotmail.com
Reviewed by: rrs@
MFC after: 3 days
Sponsored by: Netflix, Inc.

5 years agoAllow using TPM as entropy source.
mw [Sat, 23 Mar 2019 05:13:51 +0000 (05:13 +0000)]
Allow using TPM as entropy source.

TPM has a built-in RNG, with its own entropy source.
The driver was extended to harvest 16 random bytes from TPM every 10 seconds.
A new build option "TPM_HARVEST" was introduced - for now, however, it
is not enabled by default in the GENERIC config.

Submitted by: Kornel Duleba <mindal@semihalf.com>
Reviewed by: markm, delphij
Approved by: secteam
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D19620

5 years agoThe check for $ippool_rules in start_cmd is tautological.
cy [Sat, 23 Mar 2019 04:32:10 +0000 (04:32 +0000)]
The check for $ippool_rules in start_cmd is tautological.

Reported by: hrs@
MFC after: 13 days
X-MFC with: r345400

5 years agopowernv: Add Hypervisor Maintenance Interrupt handler
jhibbits [Sat, 23 Mar 2019 03:23:20 +0000 (03:23 +0000)]
powernv: Add Hypervisor Maintenance Interrupt handler

Attempting to build www/firefox on POWER9 resulted in a HMI exception being
thrown, a fatal trap currently.  This is typically caused by timer facility
errors, but examination of the Hypervisor Maintenance Exception Register
(HMER) yielded only that an exception had recovered, with no information of
the actual exception cause.

When an HMI occurs, OPAL_HANDLE_HMI or OPAL_HANDLE_HMI2 must be called to
handle the exception at the firmware level.  If the exception is handled, we
can continue.

This adds only the preliminary handler, enough to prevent package building
from panicking.  An enhancement in the future is to use the flags returned
by OPAL_HANDLE_HMI2 to print more useful error messages, and log maintenance
events.

Reviewed by: luporl
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D19634

5 years agoEnable etherswitchcfg and e6000sw driver in arm64 build
mw [Sat, 23 Mar 2019 02:53:47 +0000 (02:53 +0000)]
Enable etherswitchcfg and e6000sw driver in arm64 build

After latest binding update, this patch enables usage of
the switch on Armada 3720 EspressoBin, so compile it
by default with arm64 GENERIC.

A patch was extracted from https://reviews.freebsd.org/D19036

Submitted by: Bert JW Regeer <xistence@0x58.com>
Reviewed by: manu

5 years agoUpdate mvneta/e6000sw for new DSA Device Tree Bindings
mw [Sat, 23 Mar 2019 02:48:47 +0000 (02:48 +0000)]
Update mvneta/e6000sw for new DSA Device Tree Bindings

In the latest Linux kernel revisions the DSA (Distributed
Switch Architecture) device tree binding was changed.
Instead of the top level dsa@ node, the switch and its
ports is represented as a child node of the mdio bus.
With that other modifications were added, such as
relation with the ethernet port of the SoC. Adjust
e6000sw etherswitch and mvneta drivers to that.

Tested on Armada 3720 EspressoBin and Armada 388 Clearfog Pro boards.

Submitted by: Bert JW Regeer <xistence@0x58.com>
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D19036

5 years agostrings: return an error code and the char value separately
oshogbo [Sat, 23 Mar 2019 02:17:07 +0000 (02:17 +0000)]
strings: return an error code and the char value separately

If we returning 32 bits value it's hard to distinguish if the returned value
is a valid one or if its an error (in case of EOF). For that reason separate
exit code of the function from the returned character.

Reported by: cem, se

5 years agopf tests: Fix accidental duplication of content
kp [Sat, 23 Mar 2019 01:07:51 +0000 (01:07 +0000)]
pf tests: Fix accidental duplication of content

Also use the correct name for the scapy test script.

5 years agopowerpc: Re-merge isa3 HPT with moea64 native HPT
jhibbits [Fri, 22 Mar 2019 22:14:14 +0000 (22:14 +0000)]
powerpc: Re-merge isa3 HPT with moea64 native HPT

r345402 fixed the bug that led to the split of the ISA 3.0 HPT handling from
the existing manager.  The cause of the bug was gcc moving the register
holding VPN to a different register (not r0), which triggered bizarre
behaviors.  With the fix, things work, so they can be re-merged.  No
performance lost with the merge.

5 years agoMake it possible to update TMPFS mount point from read-only to read-write
sobomax [Fri, 22 Mar 2019 21:31:21 +0000 (21:31 +0000)]
Make it possible to update TMPFS mount point from read-only to read-write
and vice versa.

Reviewed by: delphij
Approved by: delphij
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D19682

5 years agoRevert r345410, VOP_FSYNC change in ZFS vdev_file
avg [Fri, 22 Mar 2019 17:44:47 +0000 (17:44 +0000)]
Revert r345410, VOP_FSYNC change in ZFS vdev_file

I overlooked the fact that that VOP_FSYNC() call is not a FreeBSD VFS
call, but a macro that provides an illumos-compatible wrapper for the
FreeBSD operation.

PR: 236475
Reported by: lwhsu
Pointyhat to: avg

5 years agoUpdate mentor and calendar files
mhorne [Fri, 22 Mar 2019 17:37:14 +0000 (17:37 +0000)]
Update mentor and calendar files

Add an entry for myself (mhorne) to these files.

Approved by: markj

5 years agoUse internal command variables for consistent style.
cy [Fri, 22 Mar 2019 11:46:35 +0000 (11:46 +0000)]
Use internal command variables for consistent style.

Reported by: rgrimes@
MFC after: 13 days
X-MFC with: r345400

5 years agointpm: change translation of HBA error status to smbus(4) errors
avg [Fri, 22 Mar 2019 10:38:22 +0000 (10:38 +0000)]
intpm: change translation of HBA error status to smbus(4) errors

PIIX4_SMBHSTSTAT_ERR can be set for several reasons that, unfortunately,
cannot be distinguished, but the most typical case is a missing or hung
slave (SMB_ENOACK).

PIIX4_SMBHSTSTAT_FAIL means failed or killed / aborted transaction, so
it's previous mapping to SMB_ENOACK was not ideal.

After this change an smb(4) access to a missing slave results in ENXIO
rather than EIO.  To me, that seems to be more appropriate.

MFC after: 3 weeks

5 years agoZFS vdev_file: use correct value for waitfor parameter of VOP_FSYNC
avg [Fri, 22 Mar 2019 09:11:45 +0000 (09:11 +0000)]
ZFS vdev_file: use correct value for waitfor parameter of VOP_FSYNC

PR: 236475
Reported by: asomers
MFC after: 2 weeks

5 years agopf tests: Test CVE-2019-5598
kp [Fri, 22 Mar 2019 07:39:28 +0000 (07:39 +0000)]
pf tests: Test CVE-2019-5598

Verify that pf correctly drops inconsistent ICMP packets (i.e. where the
IP src/dst do not match the IP src/dst in the ICMP packet.

5 years agoAdd nvme support to the arm64 GENERIC kernel.
cperciva [Fri, 22 Mar 2019 06:36:40 +0000 (06:36 +0000)]
Add nvme support to the arm64 GENERIC kernel.

Submitted by: Greg V
Differential Revision: https://reviews.freebsd.org/D19657

5 years agoBuild if_ena.ko on arm64.
cperciva [Fri, 22 Mar 2019 06:33:26 +0000 (06:33 +0000)]
Build if_ena.ko on arm64.

This module provides support for the Amazon Elastic Network Adapter; it
was previously only built on x86 architectures, but Amazon EC2 now also
has ARM64 instances with this hardware.

Submitted by: Greg V

5 years agoInitialize uart_bus_space_mem.
cperciva [Fri, 22 Mar 2019 06:28:37 +0000 (06:28 +0000)]
Initialize uart_bus_space_mem.

This value was being used uninitialized, resulting in predictable issues
on systems with memory-mapped UART registers.

A case could be made that memmap_bus should be declared in a header
rather than being declared in each .c file which needs to refer to it,
but that's a broader style question.

This commit unbreaks hw.uart.console="mm:..." on ARM64.

Submitted by: Greg V

5 years agoObey SPCR AccessWidth parameter.
cperciva [Fri, 22 Mar 2019 06:21:03 +0000 (06:21 +0000)]
Obey SPCR AccessWidth parameter.

The "access width" value was hard-coded as 2, indicating 32-bit accesses;
instead, use the value specified in the SPCR table.

This unbreaks the console on EC2 "A1" family instances.

Submitted by: Greg V

5 years agoFrom r345400, remove the ippool rc script when ipfilter is not wanted
cy [Fri, 22 Mar 2019 01:43:55 +0000 (01:43 +0000)]
From r345400, remove the ippool rc script when ipfilter is not wanted
by the user.

PR: 218433
MFC after: 2 weeks
X-MFC with: r345400

5 years agopowerpc64: Handle the modern (2.05+) implementaiton of tlbie
jhibbits [Fri, 22 Mar 2019 01:43:31 +0000 (01:43 +0000)]
powerpc64: Handle the modern (2.05+) implementaiton of tlbie

By happenstance gcc4 puts 'vpn' into r0 in all uses of TLBIE(), but modern
gcc does not.  Also, the single-argument form of tlbie zeros all unused
arguments, making the modern tlbie instruction use r0 as the RS field
(LPID).

The vpn argument has the bottom 12 bits cleared (the input having been
left-shifted by 12 bits), which just so happens, on the POWER9 and previous
incarnations, to be the number of LPID bits supported.  With those bits
being zero, the instruction:

tlbie r0, r0

will invalidate the VPN in r0, in LPAR 0 (ignoring the upper bits of r0 for
the RS field).  One build with gcc8 yields:

tlbie r9, r0

with r0 having arbitrary contents, not equal to r9.  This leads to strange
crashes, behaviors, and panics, due to the requested TLB entry not actually
being invalidated.

As the moea64_native must work on both old and new, we explicitly zero out
r0 so that it can work with only the single argument, built with base gcc
and modern gcc.  isa3_hashtb takes a different approach, encoding the
two-argument form, soas not to explicitly clobber r0, and instead let the
compiler decide.

Reported by: Brandon Bergren
Tested by: Brandon Bergren
MFC after: 1 week

5 years agoFrom r345400, connect ippool to the build/install.
cy [Fri, 22 Mar 2019 01:42:27 +0000 (01:42 +0000)]
From r345400, connect ippool to the build/install.

PR: 218433
MFC after: 2 weeks
X-MFC with: r345400

5 years agoAdd rc.d support for ippool(8).
cy [Fri, 22 Mar 2019 01:30:51 +0000 (01:30 +0000)]
Add rc.d support for ippool(8).

I've been using ippool at my site for approximately two years. It's
about time this was committed.

PR: 218433
MFC after: 2 weeks