Commit Graph

221377 Commits

Author SHA1 Message Date
Bryan Drewery
29e9c668a1 Fix SUBDIR_DEPEND for gdb on binutils after r307659.
Sponsored by:	Dell EMC Isilon
2017-03-15 21:17:45 +00:00
Konstantin Belousov
e35ddbe448 Implement LD_BIND_NOT knob for rtld.
From the manpage:
When set to a nonempty string, prevents modifications of the PLT slots
when doing bindings.  As result, each call of the PLT-resolved
function is resolved.  In combination with debug output, this provides
complete account of all bind actions at runtime.

Same feature exists on Linux and Solaris.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2017-03-15 21:11:57 +00:00
Alexander Motin
d10e4cd0c0 Remove not very useful ATIO/INOT stats.
While there polish respective debug logging.

MFC after:	2 weeks
2017-03-15 19:49:45 +00:00
Toomas Soome
6147bab8ea boot1.efi: can't boot from ZFS on 4kn HDD
The boot1.efi immediate issue from PR216964 is that we are reading into
too small buffer, from UEFI spec 2.6:

The size of the Buffer in bytes. This must be a multiple of the intrinsic block size of the device.

The secondary issue is that LBA calculation does not check reminder from
division.

This fix does check the provided buffer size and if we read less than
media sector size or the read offset is not aligned to sector boundary,
we allocate bounce buffer and perform the read by single sector.

PR:		216964
Reported by:	Sergey Kozlov
Reviewed by:	allanjude, Sergey Kozlov
Approved by:	allanjude (mentor)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D9870
2017-03-15 19:48:22 +00:00
Navdeep Parhar
94036cfff0 cxgbe/iw_cxgbe: Use the socket and not the toepcb to reach for the
inpcb.  t4_tom detaches the inpcb from the toepcb as soon as the
hardware is done with the connection (in final_cpl_received) but the
socket is around as long as the cm_id and the rest of iWARP state is.

This fixes an intermittent NULL dereference during abort.

Submitted by:	KrishnamRaju ErapaRaju @ Chelsio
MFC after:	3 days
Sponsored by:	Chelsio Communications
2017-03-15 19:10:04 +00:00
Michael Zhilin
4c0fdc5a3d [bhnd] fix mask for PMU control
This patch fixes typo which results in extra bits of PMU control register.

PR:     217782
Submitted by:	Svyatoslav <razmyslov at viva64.com>
Found by:	PVS-Studio
2017-03-15 18:57:18 +00:00
John Baldwin
03f7f17878 Use UMA_ALIGN_PTR instead of sizeof(void *) for zone alignment.
uma_zcreate()'s alignment argument is supposed to be sizeof(foo) - 1,
and uma.h provides a set of helper macros for common types.  Passing
sizeof(void *) results in all of the members being misaligned triggering
unaligned access faults on certain architectures (notably MIPS).

Reported by:	brooks
Obtained from:	CheriBSD
MFC after:	3 days
Sponsored by:	DARPA / AFRL
2017-03-15 18:23:32 +00:00
Enji Cooper
a393b6c82f syslogd: fix memory leaks in main(..) and allowaddr(..)
- main(..): free memory assigned to fdsr before calling die(..).
- allowaddr(..): free memory assigned to ap before returning from the
  function early. Add a `err` goto label to reduce freeaddrinfo/free(ap)
  logic duplication.

MFC after:	1 week
X-MFC notes:	some of this is dependent on refactoring not MFCed
Reported by:	clang static analyzer, Coverity
CID:		1367750 (ap leakage in allowaddr(..))
Submitted by:	Tom Rix <trix@juniper.net>
Reviewed by:	ngie
Sponsored by:	Dell EMC Isilon, Juniper
Differential Revision:	D10004
2017-03-15 18:15:30 +00:00
Ed Maste
870952f562 makefs: improve error messages
- remove \n
- use __func__
- err adds the error string itself

NetBSD revs:
cd9660.c	1.48 1.49
ffs/buf.c	1.21
ffs/mkfs.c	1.27

Obtained from:	NetBSD
2017-03-15 18:14:54 +00:00
Enji Cooper
b0b1dbdd49 Start adding basic tests for cam(3)
This change contains several negative and positive tests for:
- cam_open_device
- cam_close_device
- cam_getccb
- cam_freeccb

This also contains a test for the failure case noted in bug 217649,
i.e., O_RDWR must be specified because pass(4) requires it.

This test unfortunately cannot assume that cam-capable devices are
present, so the user must explicitly provide a device via
`test_suites.FreeBSD.cam_test_device`. In the future, a test kernel
module might be shipped, or ctl(4) might be used, as a test device
when testing out libcam, which will allow the tests to do away with
having to specify an explicit test device.

Reviewed by:	asomers, ken (earlier diff)
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
Differential Revision: D9928
2017-03-15 18:00:54 +00:00
Enji Cooper
b7ea08a976 diff(1): sort long options under -D example in SYNOPSYS
Sponsored by:	Dell EMC Isilon
2017-03-15 17:54:47 +00:00
Alan Cox
52d1addaa1 Relax the locking requirements for vm_object_page_noreuse(). While
reviewing all uses of OFF_TO_IDX(), I observed that
vm_object_page_noreuse() is requiring an exclusive lock on the object
when, in fact, a shared lock suffices.

Reviewed by:	kib, markj
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D10011
2017-03-15 17:43:45 +00:00
Ed Maste
538ab9e64e makefs: don't print pointers in debugging messages
NetBSD revisions:
ffs/buf.c	1.14

Obtained from:	NetBSD
2017-03-15 17:26:19 +00:00
Ed Maste
babca35cb2 makefs: use 'm' for cd9660 allow-multidot, per NetBSD
NetBSD revisions:
cd9660.c	1.55

Obtained from:	NetBSD
2017-03-15 16:16:30 +00:00
Maxim Konovalov
aeccc5c944 Spell "const" properly.
PR:		217797
Submitted by:	tobik
2017-03-15 16:13:52 +00:00
Baptiste Daroussin
861152d234 Do not die on system built without CAPSICUM 2017-03-15 15:57:11 +00:00
Alexander Motin
0e6bc811e4 Refactor interrupt handling.
Instead of single isp_intr() function doing all possible magic, introduce
four different functions to handle mailbox operation completions, async
events, response and ATIO queues.  The goal is to isolate different code
paths to make code more readable, and to make easier support for multiple
interrupt vectors.  Even oldest hardware in many cases can identify what
code path it should run on interrupt.  Contemporary hardware can assign
them to different interrupt vectors.

MFC after:	2 weeks
2017-03-15 14:58:29 +00:00
Sean Bruno
b207ed2b4a Actually set the MTU to the requested value and fixup handling of jumbo
frames.

Submitted by:	Matt Macy <mmacy@nextbsd.org>
Reported by:	pho
Sponsored by:	Limelight Networks
2017-03-15 14:44:59 +00:00
Andrey V. Elsukov
6ed1473867 Change the syntax of ipfw's named states.
Since the state name is an optional argument, it often can conflict
with other options. To avoid ambiguity now the state name must be
prefixed with a colon.

Obtained from:	Yandex LLC
MFC after:	2 week
Sponsored by:	Yandex LLC
2017-03-15 13:36:35 +00:00
Ed Maste
776c68249b makefs: sync option parsing with NetBSD
- add support for parsing different types; not just int
- homogenize option parsing
- fix single letter parsing
- remove duplicated code

NetBSD revisions:
cd9660.c        1.36 1.37 1.38 1.41 1.42 1.43
ffs.c           1.50 1.51 1.52 1.53 1.56 1.57
makefs.c        1.36 1.37 1.38 1.39 1.40 1.42 1.43 1.44 1.46
makefs.h        1.28 1.29 1.31 1.32

Obtained from:	NetBSD
Sponsored by:	The FreeBSD Foundation
2017-03-15 13:34:51 +00:00
Alexander Motin
ce9f323727 Fix panic when SIM dereferenced before allocation.
MFC after:	2 weeks
2017-03-15 11:16:26 +00:00
Alexander Motin
b0a66d29b8 Fix ancient bug from r84597, which broke 23xx after r315234.
MFC after:	13 days
2017-03-15 10:33:44 +00:00
Kevin Lo
354d72b4f1 Fix unreachable code in wi_pci_resume().
PR:	217784
Submitted by:	Svyatoslav <razmyslov at viva64.com>
Found by:	PVS-Studio
2017-03-15 09:31:58 +00:00
Enji Cooper
beeed5993e Integrate contrib/netbsd-tests/usr.bin/diff/t_diff.sh in as
.../usr.bin/diff/diff_test

Some minor adjustment needed to be done for :same as it currently
has the test script hardcoded into the test, instead of using an
idiom like $(dirname $0)

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-03-15 06:18:14 +00:00
Gleb Smirnoff
1c0b5002f5 Fix buildworld broken in r315230 when /sys doesn't point into a right
source tree.  Usage of SYSDIR is apparently wrong here.

Discussed with:	allanjude
2017-03-15 05:31:02 +00:00
Mark Johnston
7d88be4c03 When draining a callout, don't clear CALLOUT_ACTIVE while it is running.
The callout may reschedule itself and execute again before callout_drain()
returns, but we should not clear CALLOUT_ACTIVE until the callout is
stopped.

Tested by:	pho
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-03-15 00:29:27 +00:00
Sean Bruno
5e88838850 Change casting to a uintptr_t to be compatible with non-x86 architectures.
Submitted by:	Matt Macy <mmacy@nextbsd.org>
Reported by:	rpokala
Sponsored by:	Limelight Networks
2017-03-14 22:25:07 +00:00
Eric van Gyzen
8addc72b3e Add missing pieces of r315280
I moved this branch from github to a private server, and pulled from the
wrong one when committing r315280, so I failed to include two recent commits.
Thankfully, they were only cosmetic and were included in the review.
Specifically:

Add documentation, polish comments, and improve style(9).

Tested by:	pho (r315280)
MFC after:	2 weeks
Sponsored by:	Dell EMC
Differential Revision:	https://reviews.freebsd.org/D9791
2017-03-14 22:02:02 +00:00
Eric van Gyzen
40769242ed Add some ntohl() love to r315277
inet_ntoa() and inet_ntoa_r() take the address in network
byte-order.  When I removed those calls, I should have
replaced them with ntohl() to make the hex addresses slightly
less unreadable.  Here they are.

See r315277 regarding classic blunders.

vangyzen: you're deep in "no good deed" territory, it seems
    --badger

Reported by:	ian
MFC after:	3 days
MFC when:	I finally get it right
Sponsored by:	Dell EMC
2017-03-14 20:57:54 +00:00
Tobias Kortkamp
3c04774023 Fix sysdecode_cap_rights which currently prints bogus capability rights
PR:		217787
Reviewed by:	jhb, emaste
Approved by:	jhb
2017-03-14 20:31:10 +00:00
Konstantin Belousov
d1780e8dac Use atop() instead of OFF_TO_IDX() for convertion of addresses or
addresses offsets, as intended.

Suggested and reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2017-03-14 19:39:17 +00:00
Eric van Gyzen
9dbdf2a169 When the RTC is adjusted, reevaluate absolute sleep times based on the RTC
POSIX 2008 says this about clock_settime(2):

    If the value of the CLOCK_REALTIME clock is set via clock_settime(),
    the new value of the clock shall be used to determine the time
    of expiration for absolute time services based upon the
    CLOCK_REALTIME clock.  This applies to the time at which armed
    absolute timers expire.  If the absolute time requested at the
    invocation of such a time service is before the new value of
    the clock, the time service shall expire immediately as if the
    clock had reached the requested time normally.

    Setting the value of the CLOCK_REALTIME clock via clock_settime()
    shall have no effect on threads that are blocked waiting for
    a relative time service based upon this clock, including the
    nanosleep() function; nor on the expiration of relative timers
    based upon this clock.  Consequently, these time services shall
    expire when the requested relative interval elapses, independently
    of the new or old value of the clock.

When the real-time clock is adjusted, such as by clock_settime(3),
wake any threads sleeping until an absolute real-clock time.
Such a sleep is indicated by a non-zero td_rtcgen.  The sleep functions
will set that field to zero and return zero to tell the caller
to reevaluate its sleep duration based on the new value of the clock.

At present, this affects the following functions:

    pthread_cond_timedwait(3)
    pthread_mutex_timedlock(3)
    pthread_rwlock_timedrdlock(3)
    pthread_rwlock_timedwrlock(3)
    sem_timedwait(3)
    sem_clockwait_np(3)

I'm working on adding clock_nanosleep(2), which will also be affected.

Reported by:	Sebastian Huber <sebastian.huber@embedded-brains.de>
Reviewed by:	jhb, kib
MFC after:	2 weeks
Relnotes:	yes
Sponsored by:	Dell EMC
Differential Revision:	https://reviews.freebsd.org/D9791
2017-03-14 19:06:44 +00:00
Alexander Motin
9c2e9bcfbe Remove some dead/broken code paths around async handling
MFC after:	2 weeks
2017-03-14 18:42:33 +00:00
Dmitry Chagin
5bb676adf7 Fix usage of the same 'i' variable in the external and nested loops.
Submitted by: Svyatoslav <razmyslov at viva64.com>
Sponsored by: PVS-Studio

MFC after:	1 week
2017-03-14 18:29:23 +00:00
Eric van Gyzen
47d803ea71 KTR: log IPv4 addresses in hex rather than dotted-quad
When I made the changes in r313821, I fell victim to one of the
classic blunders, the most famous of which is: never get involved
in a land war in Asia.  But only slightly less well known is this:
Keep your brain turned on and engaged when making a tedious, sweeping,
mechanical change.  KTR can correctly log the immediate integral values
passed to it, as well as constant strings, but not non-constant strings,
since they might change by the time ktrdump retrieves them.

Reported by:	glebius
MFC after:	3 days
Sponsored by:	Dell EMC
2017-03-14 18:27:48 +00:00
Ed Maste
f490b9b3bf makefs: sync -T timestamp with NetBSD
NetBSD revision:
makefs.c	1.51

Obtained from:	NetBSD
2017-03-14 18:08:32 +00:00
Alexander Motin
6327b0d287 Remove tangled isp_mbox_continue() mechanism.
It was implemented to reduce context switches when uploading firmware to
card's RAM.  But this mechanism is not used last 10 years since all mbox
operations are now polled, and it was never used for cards produced in
last 15 years.  Newer cards can use DMA to upload firmware.

MFC after:	2 weeks
2017-03-14 17:34:44 +00:00
Xin LI
78d7964b46 Implement INHERIT_ZERO for minherit(2).
INHERIT_ZERO is an OpenBSD feature.

When a page is marked as such, it would be zeroed
upon fork().

This would be used in new arc4random(3) functions.

PR:	182610
Reviewed by:	kib (earlier version)
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D427
2017-03-14 17:10:42 +00:00
Ed Maste
f7d3963023 makefs: remove unused variable
NetBSD revisions:
mkfs.c 1.32

Obtained from:	NetBSD
2017-03-14 16:40:18 +00:00
Fabien Thomas
d42aefee43 Fix arm stack frame walking support:
- Adjust stack offset for Clang
- Correctly fill registers for fake stack frame (soft PMC)

MFC after:	1 week
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D7396
2017-03-14 16:06:57 +00:00
Sean Bruno
0a1b74a3d1 Fixup LINT by using uint64_t type as we do on all other calls to PNMB()
Found with Jenkins.

Reported by:	lwshu
Sponsored by:	Limelight Networks
2017-03-14 15:08:56 +00:00
Hans Petter Selasky
5f50a414ba Set "current" pointer for LinuxKPI interrupts and timer callbacks.
MFC after:		1 week
Sponsored by:		Mellanox Technologies
2017-03-14 14:02:47 +00:00
Sean Bruno
883722a43c Restore changes for RSS routing improvements made in 314369 that were
reverted in the IFLIB update I made in 315217.

Submitted by:	Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
2017-03-14 13:54:18 +00:00
Dmitry Marakasov
8d27c2000b Fix late and noauto with geli swap
With the following in /etc/fstab:

/dev/gpt/swap.eli none swap sw,late 0 0

swap will not be enabled, with `swapon -aL' complaining:

swapon: Invalid option: late

This happens because swap_on_geli_args() which parses geli arguments
out of all mount options does not expect late or noauto among them.
Fix this by explicitly allowing these arguments.

Reviewed by:	jilles
Approved by:	jilles
MFC after:	2 weeks
Differential Revision:	D9835
2017-03-14 12:39:19 +00:00
Konstantin Belousov
01feb4c3d4 Use designated initializers for kevent_copyops.
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-03-14 09:25:01 +00:00
Konstantin Belousov
67d0b0ea60 Hide kev_iovlen() definition under #ifdef KTRACE, fixing build of
kernel configs without KTRACE.

Reported by:	rpokala
Sponsored by:	The FreeBSD Foundation
MFC after:	4 days
2017-03-14 08:45:52 +00:00
Alexander Motin
0cbfd9bb18 Remove dangerous and questionable isp_mboxcmd_qnw() call.
MFC after:	2 weeks
2017-03-14 08:45:33 +00:00
Dexuan Cui
38955f5698 loader.efi: use stricter check for Hyper-V
Some other hypervisors like Xen can pretend to be Hyper-V but obviously
they can't implement all Hyper-V features. Let's make sure we're genuine
Hyper-V here.

Also fix some minor coding style issues.

PR:		211746
MFC after:	2 weeks
Sponsored by:	Microsoft
2017-03-14 08:12:14 +00:00
Alexander Motin
a1fa02673a Improvements around attach, reset and detach.
This change fixes DMA resource leak on driver unload.  Also it removes
DMA resources allocation for hardcoded number of requests before fetching
the real number from firmware.  Also it prepares ground for more flexible
IRQs allocation according to firmware capabilities.

MFC after:	2 weeks
2017-03-14 08:03:56 +00:00
Andrey V. Elsukov
3667f39ea3 Use memset with structure size. 2017-03-14 07:57:33 +00:00