Commit Graph

238479 Commits

Author SHA1 Message Date
Mark Johnston
7bdc329113 Use Capsicum helpers in ping(8).
Also use caph_cache_catpages() to ensure that strerror() works when
run with kern.trap_enotcap=1.

Reviewed by:	oshogbo
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18514
2018-12-12 02:33:01 +00:00
Kirk McKusick
8f829a5cf0 Continuing efforts to provide hardening of FFS. This change adds a
check hash to the filesystem inodes. Access attempts to files
associated with an inode with an invalid check hash will fail with
EINVAL (Invalid argument). Access is reestablished after an fsck
is run to find and validate the inodes with invalid check-hashes.
This check avoids a class of filesystem panics related to corrupted
inodes. The hash is done using crc32c.

Note this check-hash is for the inode itself and not any of its
indirect blocks. Check-hash validation may be extended to also
cover indirect block pointers, but that will be a separate (and
more costly) feature.

Check hashes are added only to UFS2 and not to UFS1 as UFS1 is
primarily used in embedded systems with small memories and low-powered
processors which need as light-weight a filesystem as possible.

Reviewed by:  kib
Tested by:    Peter Holm
Sponsored by: Netflix
2018-12-11 22:14:37 +00:00
Kristof Provost
d3cc40300e pf tests: Use the ATF cleanup infrastructure in the ioctl tests
Use ATF_TC_CLEANUP(), because that means the cleanup code will get
called even if a test fails. Before it would only be executed if every
test within the body succeeded.

Reported by:	Marie Helene Kvello-Aune <marieheleneka@gmail.com>
MFC after:	2 weeks
2018-12-11 21:49:13 +00:00
Kristof Provost
87c7063c2b pf tests: ioctl tests require root rights
Explicitly mark these tests as requiring root rights. We need to be able
to open /dev/pf.

Reported by:	Marie Helene Kvello-Aune <marieheleneka@gmail.com>
MFC after:	2 weeks
2018-12-11 21:45:56 +00:00
Kristof Provost
5b551954ab pf: Prevent integer overflow in PF when calculating the adaptive timeout.
Mainly states of established TCP connections would be affected resulting
in immediate state removal once the number of states is bigger than
adaptive.start.  Disabling adaptive timeouts is a workaround to avoid this bug.
Issue found and initial diff by Mathieu Blanc (mathieu.blanc at cea dot fr)

Reported by: Andreas Longwitz <longwitz AT incore.de>
Obtained from:  OpenBSD
MFC after:	2 weeks
2018-12-11 21:44:39 +00:00
Bjoern A. Zeeb
7984cba7d7 Remove a dead file. CVS was removed in r251794. 2018-12-11 21:16:09 +00:00
Alexander Motin
49f8782283 Allow CTL device specification in bhyve virtio-scsi.
There was a large refactoring done in CTL to allow multiple ioctl frontend
ports (and respective devices) to be created, particularly for bhyve.
Unfortunately, respective part of bhyve functionality got lost somehow from
the original virtio-scsi commit.  This change allows wanted device path to
be specified in either of two ways:
 -s 6,virtio-scsi,/dev/cam/ctl1.1
 -s 6,virtio-scsi,dev=/dev/cam/ctl2.3
If neither is specified, the default /dev/cam/ctl device is used.

While there, remove per-queue CTL device opening, which makes no sense at
this point.

Reported by:	wg
Reviewed by:	araujo
MFC after:	3 days
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D18504
2018-12-11 20:47:00 +00:00
Mateusz Guzik
cc426dd319 Remove unused argument to priv_check_cred.
Patch mostly generated with cocinnelle:

@@
expression E1,E2;
@@

- priv_check_cred(E1,E2,0)
+ priv_check_cred(E1,E2)

Sponsored by:	The FreeBSD Foundation
2018-12-11 19:32:16 +00:00
Dimitry Andric
959530cc41 Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
the upstream release_70 branch r348686 (effectively, 7.0.1 rc3).  The
release will follow very soon, but no more functional changes are
expected.

Release notes for llvm, clang and lld 7.0.0 are available here:
<http://releases.llvm.org/7.0.0/docs/ReleaseNotes.html>
<http://releases.llvm.org/7.0.0/tools/clang/docs/ReleaseNotes.html>
<http://releases.llvm.org/7.0.0/tools/lld/docs/ReleaseNotes.html>

PR:		230240, 230355
Relnotes:	yes
MFC after:	2 months
2018-12-11 19:05:28 +00:00
Stephen Hurd
7124b5ba04 Fix !tx_abdicate error from r336560
r336560 was supposed to restore pre-r323954 behaviour when tx_abdicate is
not set (the default case). However, it appears that rather than the drainage
check being made conditional on tx_abdicate being set, it was duplicated
so it occured twice if tx_abdicate was set and once if it was not.

Now when !tx_abdicate, drainage is only checked if the doorbell isn't
pending.

Reported by:    lev
MFC after:      1 week
Sponsored by:   Limelight Networks
2018-12-11 17:46:01 +00:00
Dimitry Andric
2bf1d8b75f Set tentative merge date, and add UPDATING note. 2018-12-11 17:39:49 +00:00
Mateusz Guzik
e8451da5e8 audi: replace open-coded TDP_AUDITREC checks with the macro
Sponsored by:	The FreeBSD Foundation
2018-12-11 17:14:12 +00:00
Mark Johnston
b6da2600f9 Fix the PAE kernel gcc build.
The error was caused by map_ucode() casting a vm_paddr_t to a void *.
Use a uintptr_t instead to match the caller.  Fix some style bugs while
here.

Reported by:	bde
Reviewed by:	bde
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2018-12-11 16:49:01 +00:00
David Bright
081954d3a2 asmc: Add Support for MacBookAir 7,1 and 7,2
PR:		226172
Submitted by:	James Wright <james.wright@jigsawdezign.com>
Reported by:	James Wright <james.wright@jigsawdezign.com>
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D18396
2018-12-11 16:35:59 +00:00
Mateusz Guzik
6b2d61136f fd: dedup code in sys_getdtablesize
Sponsored by:	The FreeBSD Foundation
2018-12-11 12:08:18 +00:00
Mateusz Guzik
73e62bc9bb Make lim_cur inline if possible.
It is a function call only to accomodate *some* ABIs which install a hook.
They only care for 3 types of limits: DATA, STACK, VMEM

Instead of always calling the func, see at compilation time if the requested
limit is something else and just do the read if so.

Sponsored by:	The FreeBSD Foundation
2018-12-11 12:01:46 +00:00
Mateusz Guzik
86db4d40ac fd: tidy up closing a fd
- avoid a call to knote_close in the common case
- annotate mqueue as unlikely

Sponsored by:	The FreeBSD Foundation
2018-12-11 11:58:44 +00:00
Mateusz Guzik
663de8167e fd: stop looking for exact freefile after allocation
If a lower fd is closed later, the lookup goes to waste. Allocation
always performs the lookup anyway.

Sponsored by:	The FreeBSD Foundation
2018-12-11 11:57:12 +00:00
Andrew Turner
1242588828 Only read the ACPI proximity tabled on arm64 when we are booting from
ACPI.

Sponsored by:	DARPA, AFRL
2018-12-11 11:13:11 +00:00
Dimitry Andric
893405b45f Merge ^/head r341764 through r341812. 2018-12-11 06:47:04 +00:00
Dimitry Andric
12401698f6 For arm and armv6, only enable LLVM target support for arm by default,
to shrink libllvm.a.

This is a workaround for "relocation truncated to fit" errors with BFD
ld 2.17.50 on arm and armv6, when linking executables against it.

The required range extensions are not yet supported by this very old
version of BFD ld.  When arm and armv6 userland can be successfully
linked by lld, this workaround can be removed.
2018-12-11 06:45:53 +00:00
Xin LI
99f65e3efe Remove questionable initialization for ICH8M, rely on BIOS to properly
initialize the controller.

According to the datasheet, the old code checks if port 2 (P2E, 0x4) was
the only enabled port (except port 0, which was ignored by mask 0xfe),
and issue a write to the PCS register to disable all but port 0, right
before ahci_ctlr_reset.

Some other operating systems would issue a port enable to all ports, but
since the current code only does the special initialization for ICH8M,
it entirely and rely on BIOS to do the right thing (the alternative
would be https://reviews.freebsd.org/D18300?id=50922 , should we see
reports that we really need to do it).

Reviewed by:	mav
MFC after:	3 months
Differential Revision:	https://reviews.freebsd.org/D18300
2018-12-11 05:10:22 +00:00
Konstantin Belousov
94dd54b9a2 Free bootstacks after AP startup.
Bootstacks are unused after APs executed sched_throw() in
init_secondary_tail() and started executing on proper idle thread
stack.  Add sysinit that detects that the idle thread for each CPU was
scheduled at least once, and free corresponding bootstack.

Slight addition of the code (~200 bytes) is compensated by the saving,
because even on typical small modern desktop CPU we leak 128K of
memory otherwise (4 pages x 8 threads).

Reviewed by:	jhb
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D18486
2018-12-11 02:54:36 +00:00
Konstantin Belousov
eba8ab0e3e Remove special case handling for getfhat(fd, NULL, handle).
There is no reason for it to behave differently from openat(fd, NULL).
Also the handling did not worked because the substituted path was from
the system address space, causing EFAULT.

Submitted by:	Jack Halford <jack@gandi.net>
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D18501
2018-12-11 02:48:49 +00:00
Mark Johnston
a64886cef3 Remove an unused malloc(9) type.
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2018-12-11 02:16:27 +00:00
Mark Johnston
e7d46a1d71 Use inline tests for individual PTE bits in the RISC-V pmap.
Inline tests for PTE_* bits are easy to read and don't really require a
predicate function, and predicates which operate on a pt_entry_t are
inconvenient when working with L1 and L2 page table entries.

Reviewed by:	jhb
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18461
2018-12-11 02:15:56 +00:00
David Bright
735bd25d31 Add uk.macbook.kbd keymap (vt)
PR:		215185
Submitted by:	James Wright <james.wright@jigsawdezign.com>
Reported by:	James Wright <james.wright@jigsawdezign.com>
Reviewed by:	emaste (earlier version)
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D18395
2018-12-11 02:14:40 +00:00
Justin Hibbits
9d720d45c9 powerpc/booke: Don't get and use the load offset for TOC on APs
The code was a near exact copy of the code in startup, but it doesn't need
the complexity since the kernel is already relocated.  With
VM_MIN_KERNEL_ADDRESS as currently set to KERNBASE, this doesn't cause a
problem, because it's a zero offset.  However, when KERNBASE is changed to a
physical load address, it then has a non-zero offset, and ends up with an
invalid stack pointer, causing the AP to hang.
2018-12-11 02:03:00 +00:00
Conrad Meyer
b2b1708d59 rc.subr: Implement list_vars without using 'read'
'read' pessimistically read(2)s one byte at a time, which can be quite
silly for large environments in slow emulators.

In my boring user environment, truss shows that the number of read()
syscalls to source rc.subr and invoke list_vars is reduced by something like
3400 to 60.  ministat(1) shows a significant time difference of about -71%
for my environment.

Suggested by:	jilles
Discussed with:	dteske, jhb, jilles
Differential Revision:	https://reviews.freebsd.org/D18481
2018-12-11 01:38:50 +00:00
John Baldwin
c1745bf503 Validate the string size parameter passed to -s.
Use strtonum() to reject negative sizes instead of core dumping.

PR:		232206
Submitted by:	David Carlier <devnexen@gmail.com>
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D17537
2018-12-10 21:47:19 +00:00
Warner Losh
d11278054b Remove stray hints files. 2018-12-10 21:33:01 +00:00
John Baldwin
c5786670ac Don't report stale signal information for non-signal events in ptrace_lwpinfo.
Once a signal's siginfo was copied to 'td_si' as part of the signal
exchange in issignal(), it was never cleared.  This caused future
thread events that are reported as SIGTRAP events without signal
information to report the stale siginfo in 'td_si'.  For example, if a
debugger created a new process and used SIGSTOP to stop it after
PT_ATTACH, future system call entry / exit events would set PL_FLAG_SI
with the SIGSTOP siginfo in pl_siginfo.  This broke 'catch syscall' in
current versions of gdb as it assumed PL_FLAG_SI with SIGTRAP
indicates a breakpoint or single step trap.

Reviewed by:	kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D18487
2018-12-10 19:39:24 +00:00
Andrey V. Elsukov
a895c1c28a Rework how protocol number is tracked in rule. Save it when O_PROTO
opcode will be printed. This should solve the problem, when protocol
name is not printed in `ipfw -N show`.

Reported by:	Claudio Eichenberger <cei at yourshop.com>
MFC after:	1 week
2018-12-10 16:23:11 +00:00
Andrey V. Elsukov
5f9c94c592 Use correct size for IPv4 address in gethostbyaddr().
When u_long is 8 bytes, it returns EINVAL and 'ipfw -N show' doesn't work.

Reported by:	Claudio Eichenberger <cei at yourshop.com>
MFC after:	1 week
2018-12-10 15:42:13 +00:00
Leandro Lupori
be2bd024de ppc64: handle exception 0x1500 (soft patch)
This change adds a hypervisor trap handler for exception 0x1500 (soft patch),
normalizing all VSX registers and returning.
This avoids a kernel panic due to unknown exception.

Change made with the collaboration of leonardo.bianconi_eldorado.org.br,
that found out that this is a hypervisor exception and not a supervisor one,
and fixed this in the code.

Reviewed by:	jhibbits, sbruno
Differential Revision:	https://reviews.freebsd.org/D17806
2018-12-10 14:54:28 +00:00
Ed Maste
457e6311ad Clean stale wpa dependencies and objects after r341759
The wpa update added some source files with the same name as a file in
another directory (found via .PATH in the previous version).  Having a
stale entry in a .depend file means the new file won't be built, so test
for this case and if found remove all of wpa's dependency files.

MFC with:	r341759
Sponsored by:	The FreeBSD Foundation
2018-12-10 14:50:11 +00:00
Eugene Grosbein
2d0a6ce24c ping(8): add space after "<=" as per style(9).
MFC after:	1 week
X-MFC-with:	r341768
2018-12-10 14:39:21 +00:00
Hans Petter Selasky
ca487c1888 Remove no longer needed ifdefs in the LinuxKPI, after r341787.
Differential Revision:	https://reviews.freebsd.org/D18450
Reviewed by:		kib@
MFC after:		3 days
Sponsored by:		Mellanox Technologies
2018-12-10 13:41:33 +00:00
Hans Petter Selasky
d7a9bfee8f Implement atomic_swap_xxx() for all platforms.
Differential Revision:	https://reviews.freebsd.org/D18450
Reviewed by:		kib@
MFC after:		3 days
Sponsored by:		Mellanox Technologies
2018-12-10 13:38:13 +00:00
Andriy Voskoboinyk
98d2a76e37 rtwn, rsu: add more USB ids.
PR:		233638
Submitted by:	cezary.sliwa@gmail.com
MFC after:	3 days
2018-12-10 09:45:57 +00:00
Andrew Rybchenko
8b44715740 sfxge(4): use n Tx queues instead of n + 2 on EF10 HW
On EF10 HW we can avoid sending packets without checksum offload
or with IP-only checksum offload to dedicated queues. Instead, we
can use option descriptors to change offload policy on any queue
during runtime. Thus, we don't need to create two dedicated queues.

Submitted by:   Ivan Malov <Ivan.Malov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18390
2018-12-10 09:36:05 +00:00
Andrew Rybchenko
e4b0a127b5 sfxge(4): prepare the number of Tx queues on event queue 0 to become variable
The number of Tx queues on event queue 0 can depend on the NIC family type,
and this property will be leveraged by future patches.
This patch prepares the code for this change.

Submitted by:   Ivan Malov <Ivan.Malov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18389
2018-12-10 09:35:53 +00:00
Andrew Rybchenko
dc373f7885 sfxge(4): report support for Tx checksum op descriptors
FreeBSD driver needs a patch to provide a means for packets
which do not need checksum offload but have flow ID set
to avoid hitting only the first Tx queue (which has been used
for packets not needing checksum offload).

This should be possible on Huntington, Medford or Medford2 chips
since these support toggling checksum offload on any given queue
dynamically by means of pushing option descriptors.

The patch for FreeBSD driver will then need a means to figure out
whether the feature can be used, and testing adapter family might
not be a good solution.

This patch adds a feature bit specifically to indicate support
for checksum option descriptors. The new feature bits may have
more users in future, apart from the mentioned FreeBSD patch.

Submitted by:   Ivan Malov <Ivan.Malov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18388
2018-12-10 09:35:45 +00:00
Andrew Rybchenko
f38d0724f0 sfxge(4): populate per-event queue stats in sysctl
In order to find out why the first event queue and corresponding
interrupt is triggered more frequent, it is useful to know which
events go to each event queue.

Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18418
2018-12-10 09:35:33 +00:00
Justin Hibbits
870d94c50a powerpc/booke: Replace a logical equivalent of pmap_kextract() with a real call
No sense in reinventing the wheel here.  AP bringup is not a time-critical
point.
2018-12-10 04:16:40 +00:00
Justin Hibbits
9471caaba7 powerpc/ubldr: Teach powerpc's ubldr to boot 64-bit kernels
This is just a copy of powerpc/ofw's ppc64_elf_freebsd.c modified to fit
ubldr's boot format.

MFC after:	1 week
2018-12-10 01:52:39 +00:00
Warner Losh
0cbe99d748 Fix typo in powerpcspe name. 2018-12-09 21:53:45 +00:00
Warner Losh
b920de1428 Send a START UNIT command when a disk responds with an ASC of 04/1C.
This will hopefully spin up a disk that's in low-power mode.

Sponsored by: Netflix
Submitted by: scottl@
2018-12-09 21:37:34 +00:00
Eugene Grosbein
65c3a67d23 ping(8): remove needless comparision with LONG_MAX
after unsigned long ultmp changed to long ltmp in r340245.

MFC after:	1 week
2018-12-09 21:11:15 +00:00
Alan Cox
2905d1ceaf blst_leaf_alloc updates bighint for a leaf when an allocation is successful
and includes the last block represented by the leaf.  The reasoning is that,
if the last block is included, then there must be no solution before that
one in the leaf, so the leaf cannot provide an allocation that big again;
indeed, the leaf cannot provide a solution bigger than range1.

Which is all correct, except that if the value of blk passed in did not
represent the first block of the leaf, because the cursor was pointing to
the middle of the leaf, then a possible solution before the cursor may have
been ignored, and bighint cannot be updated.

Consider the sequence allocate 63 (returning address 0), free 0,63 (freeing
that same block, and allocate 1 (returning 63).  The result is that one
block is allocated from the first leaf, and the value of bighint is 0, so
that nothing can be allocated from that leaf until the only block allocated
from that leaf is freed.  This change detects that skipped-over solution,
and when there is one it makes sure that the value of bighint is not changed
when the last block is allocated.

Submitted by:	Doug Moore <dougm@rice.edu>
Tested by:	pho
X-MFC with:	r340402
Differential Revision:	https://reviews.freebsd.org/D18474
2018-12-09 17:55:10 +00:00