]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agopax(1): Honour the restrict in sigaction().
pfg [Sat, 27 Jan 2018 18:24:13 +0000 (18:24 +0000)]
pax(1): Honour the restrict in sigaction().

Use a setup_sig() helper and make it fail when either of sigaction fails.

While there, do not leak fds for "." + minor cleanup.

Obtained from: OpenBSD (through DragonFly git eca362d0f9bd086cc56d6b5bc4f03f09e040b9db)

6 years agofortune(6): Fix gcc80 -Wbool-operation warnings.
pfg [Sat, 27 Jan 2018 17:43:09 +0000 (17:43 +0000)]
fortune(6): Fix gcc80 -Wbool-operation warnings.

Hinted by: Dragonfly (git 4d1086765752f0569497d06460d95117c74f33ac)

6 years agoRevert r328479:
pfg [Sat, 27 Jan 2018 16:34:00 +0000 (16:34 +0000)]
Revert r328479:
{ext2|ufs}_readdir: Set limit on valid ncookies values.

We aren't allowed to set resid like this.

Pointed out by: kib, imp

6 years ago{ext2|ufs}_readdir: Set limit on valid ncookies values.
pfg [Sat, 27 Jan 2018 15:33:52 +0000 (15:33 +0000)]
{ext2|ufs}_readdir: Set limit on valid ncookies values.

Sanitize the values that will be assigned to ncookies so that we ensure
they are sane and we can handle them.

Let ncookies signed as it was before r328346. The valid range is such
that unsigned values are not required and we are not able to avoid at
least one cast anyways.

Hinted by: bde

6 years agoAdd constant for the PAD chunk as defined in RFC 4820.
tuexen [Sat, 27 Jan 2018 13:46:55 +0000 (13:46 +0000)]
Add constant for the PAD chunk as defined in RFC 4820.
This will be used by traceroute and traceroute6 soon.

MFC after: 1 week

6 years agoUpdate references in comments, since the IDs have become an RFC long
tuexen [Sat, 27 Jan 2018 13:43:03 +0000 (13:43 +0000)]
Update references in comments, since the IDs have become an RFC long
time ago. Also cleanup whitespaces. No functional change.

MFC after: 1 week

6 years agoAdd SPDX tags for nv(9).
oshogbo [Sat, 27 Jan 2018 12:58:21 +0000 (12:58 +0000)]
Add SPDX tags for nv(9).

MFC after: 2 weeks

6 years agoAdd SPDX tags for libcasper(3) and services.
oshogbo [Sat, 27 Jan 2018 12:55:34 +0000 (12:55 +0000)]
Add SPDX tags for libcasper(3) and services.

MFC after: 2 weeks

6 years agoDon't truncate name of glabel.
oshogbo [Sat, 27 Jan 2018 12:28:52 +0000 (12:28 +0000)]
Don't truncate name of glabel.
If it's to long just report that.

Reviewed by: trasz@
Differential Revision: https://reviews.freebsd.org/D13746

6 years agoDocument the grp Casper service.
oshogbo [Sat, 27 Jan 2018 11:54:51 +0000 (11:54 +0000)]
Document the grp Casper service.

Reviewed by: brueffer@, bcr@
Differential Revision: https://reviews.freebsd.org/D13821

6 years agoUse PCID to optimize PTI.
kib [Sat, 27 Jan 2018 11:49:37 +0000 (11:49 +0000)]
Use PCID to optimize PTI.

Use PCID to avoid complete TLB shootdown when switching between user
and kernel mode with PTI enabled.

I use the model close to what I read about KAISER, user-mode PCID has
1:1 correspondence to the kernel-mode PCID, by setting bit 11 in PCID.
Full kernel-mode TLB shootdown is performed on context switches, since
KVA TLB invalidation only works in the current pmap. User-mode part of
TLB is flushed on the pmap activations as well.

Similarly, IPI TLB shootdowns must handle both kernel and user address
spaces for each address.  Note that machines which implement PCID but
do not have INVPCID instructions, cause the usual complications in the
IPI handlers, due to the need to switch to the target PCID temporary.
This is racy, but because for PCID/no-INVPCID we disable the
interrupts in pmap_activate_sw(), IPI handler cannot see inconsistent
state of CPU PCID vs PCPU pmap/kcr3/ucr3 pointers.

On the other hand, on kernel/user switches, CR3_PCID_SAVE bit is set
and we do not clear TLB.

I can imagine alternative use of PCID, where there is only one PCID
allocated for the kernel pmap. Then, there is no need to shootdown
kernel TLB entries on context switch. But copyout(3) would need to
either use method similar to proc_rwmem() to access the userspace
data, or (in reverse) provide a temporal mapping for the kernel buffer
into user mode PCID and use trampoline for copy.

Reviewed by: markj (previous version)
Tested by: pho
Discussed with: alc (some aspects)
Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks
Differential revision: https://reviews.freebsd.org/D13985

6 years agoFix native_lapic_ipi_alloc().
kib [Sat, 27 Jan 2018 11:33:21 +0000 (11:33 +0000)]
Fix native_lapic_ipi_alloc().

When PTI is enabled, empty IDT slots point to rsvd_pti.

Reported by: Dexuan-BSD Cui <dexuan.bsd@gmail.com>
Sponsored by: The FreeBSD Foundation
MFC after: 5 days

6 years agoImplement mitigation for Spectre version 2 attacks on ARMv7.
mmel [Sat, 27 Jan 2018 11:19:41 +0000 (11:19 +0000)]
Implement mitigation for Spectre version 2 attacks on ARMv7.

Similarly as we already do for arm64, for mitigation is necessary to
flush branch predictor when we:
- do task switch
- receive prefetch abort on non-userspace address

The user can disable this mitigation by setting 'machdep.disable_bp_hardening'
sysctl variable, or it can check actual system status by reading
'machdep.spectre_v2_safe'

The situation is complicated by fact that:
- for Cortex-A8, the BPIALL instruction is effectively NOP until the IBE bit
  in ACTLR is set.
- for Cortex-A15, the BPIALL is always NOP. The branch predictor can be
  only flushed by doing ICIALLU with special bit (Enable invalidates  of BTB)
  set in ACTLR.

Since access to the ACTLR register is locked to secure monitor/firmware on
most boards, they will also need update of firmware / U-boot.
In worst case, when secure monitor is on-chip ROM (e.g. PandaBoard),
the board is unfixable.

MFC after: 2 weeks
Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D13931

6 years agoFix pmap_fault().
mmel [Sat, 27 Jan 2018 09:49:47 +0000 (09:49 +0000)]
Fix pmap_fault().

- special fault handling for break-before-make mechanism should be also
  applied for instruction translation faults, not only for data translation
  faults.

- since arm64_address_translate_...() functions are not atomic,
  use these with disabled interrupts.

6 years agoccp(4): Store IV in output buffer in GCM software fallback when requested
cem [Sat, 27 Jan 2018 07:41:31 +0000 (07:41 +0000)]
ccp(4): Store IV in output buffer in GCM software fallback when requested

Apply r328361 to duplicate copy of ccr_gcm_soft in ccp(4).

Properly honor the lack of the CRD_F_IV_PRESENT flag in the GCM software
fallback case for encryption requests.

6 years agoFinish the incomplete move of CAM_PERIPH_PRINT().
scottl [Sat, 27 Jan 2018 07:18:02 +0000 (07:18 +0000)]
Finish the incomplete move of CAM_PERIPH_PRINT().

Reported by: kevans

6 years agoClarify some comments in the MIPS makecontext().
jhb [Sat, 27 Jan 2018 00:39:49 +0000 (00:39 +0000)]
Clarify some comments in the MIPS makecontext().

- N32 and N64 do not have a $a0-3 gap.
- Use 'sp += 4' to skip over the gap for O32 rather than '+= i'.  It
  doesn't make a functional change, but makes the code match the comment.

Sponsored by: DARPA / AFRL

6 years agoRemove mention of sys/boot/ from hier(7), it doesn't exist anymore.
trasz [Sat, 27 Jan 2018 00:09:43 +0000 (00:09 +0000)]
Remove mention of sys/boot/ from hier(7), it doesn't exist anymore.

MFC after: 2 weeks

6 years agoMove CAM_PERIPH_PRINT() to cam_periph.h
scottl [Fri, 26 Jan 2018 23:56:07 +0000 (23:56 +0000)]
Move CAM_PERIPH_PRINT() to cam_periph.h

6 years agoMove per-operation data out of the csession structure.
jhb [Fri, 26 Jan 2018 23:21:50 +0000 (23:21 +0000)]
Move per-operation data out of the csession structure.

Create a struct cryptop_data which contains state needed for a single
symmetric crypto operation and move that state out of the session. This
closes a race with the CRYPTO_F_DONE flag that can result in use after
free.

While here, remove the 'cse->error' member.  It was just a copy of
'crp->crp_etype' and cryptodev_op() and cryptodev_aead() checked both
'crp->crp_etype' and 'cse->error'.  Similarly, do not check for an
error from mtx_sleep() since it is not used with PCATCH or a timeout
so cannot fail with an error.

PR: 218597
Reviewed by: kib
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D13928

6 years agoFix a sleepable malloc in ndastart. We shouldn't be sleeping
imp [Fri, 26 Jan 2018 23:14:46 +0000 (23:14 +0000)]
Fix a sleepable malloc in ndastart. We shouldn't be sleeping
here. Return ENOMEM when we can't malloc a buffer for the DSM
TRIM. This should fix the WITNESS warnings similar to the following:

uma_zalloc_arg: zone "16" with the following non-sleepable locks held:
exclusive sleep mutex CAM device lock (CAM device lock) r = 0 (0xfffff800080c34d0) locked @ /usr/src/sys/cam/nvme/nvme_da.c:351

Reviewed by: scottl@
Sponsored by: Netflix

6 years agoUse bus_dmamem_alloc(9) KPI instead of contigmalloc(9).
mav [Fri, 26 Jan 2018 22:22:26 +0000 (22:22 +0000)]
Use bus_dmamem_alloc(9) KPI instead of contigmalloc(9).

I suppose it should make this code NUMA-aware with recent NUMA drop-in,
trying to allocate shared memory buffers from domain closer to NT-bridge.

MFC after: 2 weeks

6 years agoTag unreachable places as such. I left the while (1); in place since
imp [Fri, 26 Jan 2018 22:22:21 +0000 (22:22 +0000)]
Tag unreachable places as such. I left the while (1); in place since
in this context we want to busy wait to stop.

Suggested by: pfg@

6 years agoMake exit() never return until host_exit can be written.
imp [Fri, 26 Jan 2018 21:51:13 +0000 (21:51 +0000)]
Make exit() never return until host_exit can be written.

6 years agoBERI isn't BTX, so we don't have to provide exit(). Just remove it
imp [Fri, 26 Jan 2018 21:51:09 +0000 (21:51 +0000)]
BERI isn't BTX, so we don't have to provide exit(). Just remove it
since it's unused.

6 years agoNow that exit is __dead2, we need to tag ub_exit() as __dead2. To do
imp [Fri, 26 Jan 2018 21:50:59 +0000 (21:50 +0000)]
Now that exit is __dead2, we need to tag ub_exit() as __dead2. To do
that, we have to put a while (1); after the syscall that will never
return to fake out the compiler....

6 years agoFix a cut-and-paste error in a panic message
scottl [Fri, 26 Jan 2018 18:42:28 +0000 (18:42 +0000)]
Fix a cut-and-paste error in a panic message

6 years agoFor many years the message "fsync: giving up on dirty" has occationally
mckusick [Fri, 26 Jan 2018 18:17:11 +0000 (18:17 +0000)]
For many years the message "fsync: giving up on dirty" has occationally
appeared on UFS/FFS filesystems. In some cases it was promptly followed
by a panic of "softdep_deallocate_dependencies: dangling deps". This fix
should eliminate both of these occurences.

Submitted by: Andreas Longwitz <longwitz at incore.de>
Reviewed by:  kib
Tested by:    Peter Holm (pho)
PR:           225423
MFC after:    1 week

6 years agoGross hack to omit printing hex floating point when the lua number
imp [Fri, 26 Jan 2018 17:56:20 +0000 (17:56 +0000)]
Gross hack to omit printing hex floating point when the lua number
type is int64. While lua is setup for the representation, it's not
setup to properly print the numbers as ints. This is the least-gross
way around that, and won't affect the bootloader where we do this.

6 years agoAdd support to the imx5/6 watchdog for the external reset signal. Also, if
ian [Fri, 26 Jan 2018 17:55:17 +0000 (17:55 +0000)]
Add support to the imx5/6 watchdog for the external reset signal.  Also, if
the "power down" watchdog used by the ROM boot code is still active when the
regular watchdog is activated, turn off the power-down watchdog.

This adds support for the "fsl,ext-reset-output" FDT property.  When
present, that property indicates that a chip reset is accomplished by
asserting the WDOG1_B external signal, which is supposed to trigger some
external component such as a PMIC to ready the hardware for reset (for
example, adjusting voltages from idle to full-power levels), and assert the
POR signal to SoC when ready.  To guard against misconfiguation leading to a
non-rebootable system, the external reset signal is backstopped by code
that asserts a normal internal chip reset if nothing responds to the
external reset signal within one second.

6 years agoabort() should be marked __dead2 since it won't return.
imp [Fri, 26 Jan 2018 17:40:13 +0000 (17:40 +0000)]
abort() should be marked __dead2 since it won't return.

6 years agoPreserve the original luaconf.h in a convenient place. Clients will
imp [Fri, 26 Jan 2018 17:24:25 +0000 (17:24 +0000)]
Preserve the original luaconf.h in a convenient place. Clients will
almost certainly need to override this, so reinforce that. If that's
not hte case, clients can always do a #include luaconf.h.dist.

6 years agoProvide abs form stdlib.h.
imp [Fri, 26 Jan 2018 17:13:09 +0000 (17:13 +0000)]
Provide abs form stdlib.h.

Sponsored by: Netflix

6 years agoImplement abort() as a call to panic.
imp [Fri, 26 Jan 2018 17:13:04 +0000 (17:13 +0000)]
Implement abort() as a call to panic.

Sponsored by: Netflix

6 years agoSplit panic routine
imp [Fri, 26 Jan 2018 17:13:00 +0000 (17:13 +0000)]
Split panic routine

Split panic routine so that the 'Hit Any Key to continue' behavior can
be overriden.

Sponsored by: Netflix

6 years agoDecouple Linux files from the belonging character device right after open
hselasky [Fri, 26 Jan 2018 10:49:02 +0000 (10:49 +0000)]
Decouple Linux files from the belonging character device right after open
in the LinuxKPI. This is done by calling finit() just before returning a magic
value of ENXIO in the "linux_dev_fdopen" function.

The Linux file structure should mimic the BSD file structure as much as
possible. This patch decouples the Linux file structure from the belonging
character device right after the "linux_dev_fdopen" function has returned.
This fixes an issue which allows a Linux file handle to exist after a
character device has been destroyed and removed from the directory index
of /dev. Only when the reference count of the BSD file handle reaches zero,
the Linux file handle is destroyed. This fixes use-after-free issues related
to accessing the Linux file structure after the character device has been
destroyed.

While at it add a missing NULL check for non-present file operation.
Calling a NULL pointer will result in a segmentation fault.

Reviewed by: kib @
MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoPPC: Add place for NULL chars in intrnames
wma [Fri, 26 Jan 2018 09:38:40 +0000 (09:38 +0000)]
PPC: Add place for NULL chars in intrnames

In a corner case we could fall into OOB error.

Authored by:           Patryk Duda <pdk@semihalf.com>
Submitted by:          Wojciech Macek <wma@semihalf.com>
Obtained from:         Semihalf
Sponsored by:          IBM, QCM Technologies

6 years agoo A command line flag for the syslog_facility fixed in the SYNOPSIS.
maxim [Fri, 26 Jan 2018 08:52:28 +0000 (08:52 +0000)]
o A command line flag for the syslog_facility fixed in the SYNOPSIS.

PR: 225441

6 years agoo EMFILE errno documented.
maxim [Fri, 26 Jan 2018 08:38:26 +0000 (08:38 +0000)]
o EMFILE errno documented.

PR: 219209
Submitted by: yuri (with minor adjustment)
Reviewed by: brooks

6 years agoFix LINT build.
lwhsu [Fri, 26 Jan 2018 06:21:24 +0000 (06:21 +0000)]
Fix LINT build.

Approved by: delphij

6 years agodevd: readd virtual
eadler [Fri, 26 Jan 2018 05:03:37 +0000 (05:03 +0000)]
devd: readd virtual

- my C++ knowledge is old and rusty. re-add virtual

6 years agodevd: minor nits
eadler [Fri, 26 Jan 2018 04:40:41 +0000 (04:40 +0000)]
devd: minor nits

- mark usage as noreturn
- config does not need a virtual destructor

6 years agoexample cdev: use make_dev_s
eadler [Fri, 26 Jan 2018 04:24:39 +0000 (04:24 +0000)]
example cdev: use make_dev_s

Make use of make_dev_s in the example cdev. While here, fix warnings.

Reviewed by: rpokala

6 years agodd(1): Use a local swapbytes() function.
eadler [Fri, 26 Jan 2018 03:30:05 +0000 (03:30 +0000)]
dd(1): Use a local swapbytes() function.

swab(3) has restrict qualifiers for src and dst.
Avoid relying on undefined overlapping swab behavior.

Obtained From: OpenBSD

6 years agoRefactoring of reading and writing of the UFS/FFS superblock.
mckusick [Fri, 26 Jan 2018 00:58:32 +0000 (00:58 +0000)]
Refactoring of reading and writing of the UFS/FFS superblock.
Specifically reading is done if ffs_sbget() and writing is done
in ffs_sbput(). These functions are exported to libufs via the
sbget() and sbput() functions which then used in the various
filesystem utilities. This work is in preparation for adding
subperblock check hashes.

No functional change intended.

Reviewed by: kib

6 years agoMinimum changes for ctl to build on architectures with non-matching physical and
jhibbits [Fri, 26 Jan 2018 00:58:02 +0000 (00:58 +0000)]
Minimum changes for ctl to build on architectures with non-matching physical and
virtual address sizes

Summary:
Some architectures use physical addresses larger than virtual.  This is the
minimal changeset needed to get CAM/CTL to build on these targets.  No
functional changes.  More changes would likely be needed for this to be fully
functional on said platforms, but they can be made when needed.

Reviewed By: mav, chuck
Differential Revision: https://reviews.freebsd.org/D14041

6 years agoMinimal change to build linuxkpi on architectures with physical addresses larger
jhibbits [Fri, 26 Jan 2018 00:56:09 +0000 (00:56 +0000)]
Minimal change to build linuxkpi on architectures with physical addresses larger
than virtual

Summary:
Some architectures have physical/bus addresses that are much larger
than virtual addresses.  This change just quiets a warning, as DMAP is not used
on those architectures, and on 64-bit platforms uintptr_t is the same size as
vm_paddr_t and void *.

Reviewed By: hselasky
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D14043

6 years agocxgbe(4): Accept old names of a couple of tunables.
np [Fri, 26 Jan 2018 00:45:40 +0000 (00:45 +0000)]
cxgbe(4): Accept old names of a couple of tunables.

6 years agocxgbe(4): Do not display harmless warning in non-debug builds.
np [Fri, 26 Jan 2018 00:03:14 +0000 (00:03 +0000)]
cxgbe(4): Do not display harmless warning in non-debug builds.

MFC after: 3 days
Sponsored by: Chelsio Communications

6 years agoAdd declaration of SSL_get_selected_srtp_profile() for OpenSSL.
jkim [Thu, 25 Jan 2018 23:38:05 +0000 (23:38 +0000)]
Add declaration of SSL_get_selected_srtp_profile() for OpenSSL.

Because there was an extra declaration in the vendor version, we locally
removed the second one in r238405 with 1.0.1c.  Later, upstream fixed it in
1.0.2d but they removed the first one.  Therefore, both were removed in our
version unfortunately.  Now we revert to the vendor one to re-add it.

MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D10525

6 years agonfs: Remove NFSSOCKADDRALLOC, NFSSOCKADDRFREE macros
cem [Thu, 25 Jan 2018 22:38:39 +0000 (22:38 +0000)]
nfs: Remove NFSSOCKADDRALLOC, NFSSOCKADDRFREE macros

They were just thin wrappers over malloc(9) w/ M_ZERO and free(9).

Discussed with: rmacklem, markj
Sponsored by: Dell EMC Isilon

6 years agostyle: Remove remaining deprecated MALLOC/FREE macros
cem [Thu, 25 Jan 2018 22:25:13 +0000 (22:25 +0000)]
style: Remove remaining deprecated MALLOC/FREE macros

Mechanically replace uses of MALLOC/FREE with appropriate invocations of
malloc(9) / free(9) (a series of sed expressions).  Something like:

* MALLOC(a, b, ... -> a = malloc(...
* FREE( -> free(
* free((caddr_t) -> free(

No functional change.

For now, punt on modifying contrib ipfilter code, leaving a definition of
the macro in its KMALLOC().

Reported by: jhb
Reviewed by: cy, imp, markj, rmacklem
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D14035

6 years agoAdd new opt_da.h for stand-alone build.
imp [Thu, 25 Jan 2018 21:48:07 +0000 (21:48 +0000)]
Add new opt_da.h for stand-alone build.

Sponsored by: Netflix

6 years agoTrack Ref / DeRef and Hold / Unhold that da is doing to track down
imp [Thu, 25 Jan 2018 21:38:30 +0000 (21:38 +0000)]
Track Ref / DeRef and Hold / Unhold that da is doing to track down
leaks. We assume each source can be taken / dropped only once and
don't recurse. These are only enabled via DA_TRACK_REFS or
INVARIANTS. There appreas to be a reference leak under extreme load,
and these should help us colaberatively work it out. It also documents
better the reference / holding protocol better.

Reviewed by: ken@, scottl@
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D14040

6 years agoWhen devices are invalidated, there's some cases where ccbs for that
imp [Thu, 25 Jan 2018 21:38:09 +0000 (21:38 +0000)]
When devices are invalidated, there's some cases where ccbs for that
device still wind up in xpt_done after the path has been
invalidated. Since we don't always need sim or devq, add some guard
rails to only fail if we have to use them.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D14040

6 years ago`make installkernel' should display a completed message if done
wosch [Thu, 25 Jan 2018 21:36:26 +0000 (21:36 +0000)]
`make installkernel' should display a completed message if done

PR: 225159
Reviewed by: bdrewery
Approved by:  cem (mentor)
Differential Revision: https://reviews.freebsd.org/D13940

6 years agovt: add Ctrl+/ key mapping
emaste [Thu, 25 Jan 2018 21:13:42 +0000 (21:13 +0000)]
vt: add Ctrl+/ key mapping

This matches Xorg's handling of Ctrl+/ and may be useful as a tmux
escape.

PR: 212197
Submitted by: martin at sugioarto.com
Tested by: Arshan Khanifar <arshankhanifar_gmail.com>
MFC after: 2 weeks
Relnotes: Yes

6 years agoloader.efi: add missing EFI GUIDs
emaste [Thu, 25 Jan 2018 20:09:51 +0000 (20:09 +0000)]
loader.efi: add missing EFI GUIDs

These were found during bring-up on a new arm64 platform and in an
amd64 VM.

Submitted by: Arshan Khanifar <arshankhanifar_gmail.com>
Reviewed by: imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D14036

6 years agobsdinstall: enable SUJ by default (revert r327890)
emaste [Thu, 25 Jan 2018 19:57:21 +0000 (19:57 +0000)]
bsdinstall: enable SUJ by default (revert r327890)

fsck should be fixed as of r328092.

PR: 225110
Tested by: dumbbell, Arshan Khanifar <arshankhanifar gmail.com>

6 years agoAvoid all SLB operations in trap handling if the process is not using a
nwhitehorn [Thu, 25 Jan 2018 18:10:33 +0000 (18:10 +0000)]
Avoid all SLB operations in trap handling if the process is not using a
software-managed SLB.

6 years agoTreat DSE exceptions like DSI exceptions when generating signinfo.
nwhitehorn [Thu, 25 Jan 2018 18:09:26 +0000 (18:09 +0000)]
Treat DSE exceptions like DSI exceptions when generating signinfo.
Both can generate SIGSEGV, but DSEs would have put the wrong address
into the siginfo structure when the signal was delivered.

MFC after: 1 week

6 years agoFix return style in RD2. Remove bogus return value from a void function
ian [Thu, 25 Jan 2018 18:08:56 +0000 (18:08 +0000)]
Fix return style in RD2.  Remove bogus return value from a void function
in WR2 (I have no idea why that didn't result in a compile error).

6 years agoMinor style issue introduced in r328346.
pfg [Thu, 25 Jan 2018 18:01:46 +0000 (18:01 +0000)]
Minor style issue introduced in r328346.

Pointed by: bde

6 years agoMinor cleanups... Move DRIVER_MODULE() and other boilerplate stuff to the
ian [Thu, 25 Jan 2018 17:53:33 +0000 (17:53 +0000)]
Minor cleanups... Move DRIVER_MODULE() and other boilerplate stuff to the
bottom of the file, where it is in most imx5/6 drivers.  Switch from an RD2
macro using bus_space_read_2() to an inline function using bus_read_2();
likewise for WR2.  Use RESOURCE_SPEC_END to end the resource_spec list.

Net effect should be no functional changes.

6 years agoo Move sdhci_fdt to the generic files list.
br [Thu, 25 Jan 2018 17:16:29 +0000 (17:16 +0000)]
o Move sdhci_fdt to the generic files list.
o Include Qualcomm EHCI and UART drivers to the build.

Sponsored by: DARPA, AFRL

6 years agoAdd support for SDHCI controller found in Qualcomm Snapdragon 410e.
br [Thu, 25 Jan 2018 17:00:35 +0000 (17:00 +0000)]
Add support for SDHCI controller found in Qualcomm Snapdragon 410e.

Tested on DragonBoard 410c.

Sponsored by: DARPA, AFRL

6 years agoAdd basic driver for Qualcomm USB 2.0 EHCI controller.
br [Thu, 25 Jan 2018 16:58:23 +0000 (16:58 +0000)]
Add basic driver for Qualcomm USB 2.0 EHCI controller.
This driver relies on system initialization in u-boot.

Tested on DragonBoard 410c.

Sponsored by: DARPA, AFRL

6 years agoBump .Dd date for c99 change
imp [Thu, 25 Jan 2018 15:55:58 +0000 (15:55 +0000)]
Bump .Dd date for c99 change

6 years agoAdd info about c99 designationed initializers.
imp [Thu, 25 Jan 2018 15:42:21 +0000 (15:42 +0000)]
Add info about c99 designationed initializers.

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

6 years agoUse tcpinfoh_t for TCP headers in the tcp:::debug-{drop,input} probes.
markj [Thu, 25 Jan 2018 15:35:34 +0000 (15:35 +0000)]
Use tcpinfoh_t for TCP headers in the tcp:::debug-{drop,input} probes.

The header passed to these probes has some fields converted to host
order by tcp_fields_to_host(), so the tcpinfo_t translator doesn't do
what we want.

Submitted by: Hannes Mehnert
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D12647

6 years agoRemove uneeded parentheses.
markj [Thu, 25 Jan 2018 15:31:56 +0000 (15:31 +0000)]
Remove uneeded parentheses.

MFC after: 1 week

6 years agouefi.8: describe architecture-specific default path
emaste [Thu, 25 Jan 2018 14:36:47 +0000 (14:36 +0000)]
uefi.8: describe architecture-specific default path

Sponsored by: The FreeBSD Foundation

6 years agoInstall uefi.8 also on arm64
emaste [Thu, 25 Jan 2018 13:51:20 +0000 (13:51 +0000)]
Install uefi.8 also on arm64

Our standard boot method for arm64 is via UEFI, so install the man page
that describes the boot process.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

6 years agoBPF: Switch to 32 bit compatible mode only when thread is 32 bit
wma [Thu, 25 Jan 2018 12:13:41 +0000 (12:13 +0000)]
BPF: Switch to 32 bit compatible mode only when thread is 32 bit

Sometimes 32 bit and 64 bit ioctls are represented by the same number.
It causes unnecessary switch to 32 bit commpatible mode.

This patch prevents switching when we are dealing with 64 bit executable.
It fixes issue mentioned here

Authored by:           Patryk Duda <pdk@semihalf.com>
Submitted by:          Wojciech Macek <wma@semihalf.com>
Reviewed by:           andrew, wma
Obtained from:         Semihalf
Sponsored by:          IBM, QCM Technologies
Differential revision: https://reviews.freebsd.org/D14023

6 years agoFix architectures where pointer and u_int have different sizes
lwhsu [Thu, 25 Jan 2018 08:36:19 +0000 (08:36 +0000)]
Fix architectures where pointer and u_int have different sizes

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D14049

6 years agoFix build for architectures where size_t is not unsigned long
lwhsu [Thu, 25 Jan 2018 06:37:14 +0000 (06:37 +0000)]
Fix build for architectures where size_t is not unsigned long

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

6 years ago[etherswitch] fix LINT build for rtl8366rb
mizhka [Thu, 25 Jan 2018 05:48:42 +0000 (05:48 +0000)]
[etherswitch] fix LINT build for rtl8366rb

Build with rtl8366rb has been broken due to incorrect retrieval of pointer
to device_t.

Reported by: lwhsu
Differential Revision: https://reviews.freebsd.org/D14044

6 years agoFix manual page install on non-amd64
lwhsu [Thu, 25 Jan 2018 05:15:44 +0000 (05:15 +0000)]
Fix manual page install on non-amd64

Reviewed by: emaste, imp
Differential Revision: https://reviews.freebsd.org/D14038

6 years agoMinor whitespace cleanup to remove leading space before tab. No
imp [Thu, 25 Jan 2018 02:52:44 +0000 (02:52 +0000)]
Minor whitespace cleanup to remove leading space before tab. No
functional changes.

6 years agoMore throughly integrate libufs into fsck_ffs by using its cgput()
mckusick [Wed, 24 Jan 2018 23:57:40 +0000 (23:57 +0000)]
More throughly integrate libufs into fsck_ffs by using its cgput()
routine to write out the cylinder groups rather than recreating the
calculation of the cylinder-group check hash in fsck_ffs.

No functional change intended.

6 years agoUpdate .Dd missed in -r328304.
mckusick [Wed, 24 Jan 2018 22:36:21 +0000 (22:36 +0000)]
Update .Dd missed in -r328304.

Reported by: Bjoern Zeeb (bz)
MFC with:    328304

6 years agoUpgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
dim [Wed, 24 Jan 2018 22:35:00 +0000 (22:35 +0000)]
Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
6.0.0 (branches/release_60 r323338).

MFC after: 3 months
X-MFC-With: r327952
PR: 224669

6 years agoarm: lpc: Remove support
manu [Wed, 24 Jan 2018 22:04:16 +0000 (22:04 +0000)]
arm: lpc: Remove support

Code hasn't been touch this it's original commit in 2012 beside api changes.

Reviewed by: ian
Differential Revision: https://reviews.freebsd.org/D13625
Discussed with: freebsd-arm@freebsd.org (no reply)

6 years agoAdd efi.8 as a man page link to uefi.8
emaste [Wed, 24 Jan 2018 21:39:40 +0000 (21:39 +0000)]
Add efi.8 as a man page link to uefi.8

FreeBSD and industry has been inconsistent in the use of UEFI and EFI.
They are essentially just different versions of the same specification
and are often used interchangeably.  Make it easier for users to find
information by making efi(8) an alias for uefi(8).

Reported by: imp, jhb

6 years ago[etherswitch] check if_alloc returns NULL
mizhka [Wed, 24 Jan 2018 21:33:18 +0000 (21:33 +0000)]
[etherswitch] check if_alloc returns NULL

This patch is cosmetic. It checks if allocation of ifnet structure failed.
It's better to have this check rather than assume positive scenario.

Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>
Reported by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>

6 years agouefi.8: add .Xr cross references to new efi tools
emaste [Wed, 24 Jan 2018 21:26:01 +0000 (21:26 +0000)]
uefi.8: add .Xr cross references to new efi tools

6 years agouefi.8: note that UEFI and EFI are used interchangeably
emaste [Wed, 24 Jan 2018 21:20:24 +0000 (21:20 +0000)]
uefi.8: note that UEFI and EFI are used interchangeably

6 years agouefi.8: update HISTORY and remove incomplete AUTHORS
emaste [Wed, 24 Jan 2018 21:11:35 +0000 (21:11 +0000)]
uefi.8: update HISTORY and remove incomplete AUTHORS

- EFI support appeared in 5.0 for ia64
- arm64 UEFI support added in 11.0

The AUTHORS section included the folks responsible for the bulk of the
work to bring UEFI support to amd64, but missed those who did the
original work on ia64, the initial port to i386, the ports to arm64 and
arm, and have generally maintained and improved general UEFI support
since then.  It's unwieldly to include everyone and would quickly become
outdated again anyhow, so just remove the AUTHORS section.

Reviewed by: manu
Discussed with: jhb
Differential Revision: https://reviews.freebsd.org/D14033

6 years agoStore IV in output buffer in GCM software fallback when requested.
jhb [Wed, 24 Jan 2018 20:16:48 +0000 (20:16 +0000)]
Store IV in output buffer in GCM software fallback when requested.

Properly honor the lack of the CRD_F_IV_PRESENT flag in the GCM
software fallback case for encryption requests.

Submitted by: Harsh Jain @ Chelsio
Sponsored by: Chelsio Communications

6 years agoDon't read or generate an IV until all error checking is complete.
jhb [Wed, 24 Jan 2018 20:15:49 +0000 (20:15 +0000)]
Don't read or generate an IV until all error checking is complete.

In particular, this avoids edge cases where a generated IV might be
written into the output buffer even though the request is failed with
an error.

Sponsored by: Chelsio Communications

6 years agoExpand the software fallback for GCM to cover more cases.
jhb [Wed, 24 Jan 2018 20:14:57 +0000 (20:14 +0000)]
Expand the software fallback for GCM to cover more cases.

- Extend ccr_gcm_soft() to handle requests with a non-empty payload.
  While here, switch to allocating the GMAC context instead of placing
  it on the stack since it is over 1KB in size.
- Allow ccr_gcm() to return a special error value (EMSGSIZE) which
  triggers a fallback to ccr_gcm_soft().  Move the existing empty
  payload check into ccr_gcm() and change a few other cases
  (e.g. large AAD) to fallback to software via EMSGSIZE as well.
- Add a new 'sw_fallback' stat to count the number of requests
  processed via the software fallback.

Submitted by: Harsh Jain @ Chelsio (original version)
Sponsored by: Chelsio Communications

6 years agoClamp DSGL entries to a length of 2KB.
jhb [Wed, 24 Jan 2018 20:13:07 +0000 (20:13 +0000)]
Clamp DSGL entries to a length of 2KB.

This works around an issue in the T6 that can result in DMA engine
stalls if an error occurs while processing a DSGL entry with a length
larger than 2KB.

Submitted by: Harsh Jain @ Chelsio
Sponsored by: Chelsio Communications

6 years agoFail crypto requests when the resulting work request is too large.
jhb [Wed, 24 Jan 2018 20:12:00 +0000 (20:12 +0000)]
Fail crypto requests when the resulting work request is too large.

Most crypto requests will not trigger this condition, but a request
with a highly-fragmented data buffer (and a resulting "large" S/G
list) could trigger it.

Sponsored by: Chelsio Communications

6 years agoDon't discard AAD and IV output data for AEAD requests.
jhb [Wed, 24 Jan 2018 20:11:00 +0000 (20:11 +0000)]
Don't discard AAD and IV output data for AEAD requests.

The T6 can hang when processing certain AEAD requests if the request
sets a flag asking the crypto engine to discard the input IV and AAD
rather than copying them into the output buffer.  The existing driver
always discards the IV and AAD as we do not need it.  As a workaround,
allocate a single "dummy" buffer when the ccr driver attaches and
change all AEAD requests to write the IV and AAD to this scratch
buffer.  The contents of the scratch buffer are never used (similar to
"bogus_page"), and it is ok for multiple in-flight requests to share
this dummy buffer.

Submitted by: Harsh Jain @ Chelsio (original version)
Sponsored by: Chelsio Communications

6 years agoReject requests with AAD and IV larger than 511 bytes.
jhb [Wed, 24 Jan 2018 20:08:10 +0000 (20:08 +0000)]
Reject requests with AAD and IV larger than 511 bytes.

The T6 crypto engine's control messages only support a total AAD
length (including the prefixed IV) of 511 bytes.  Reject requests with
large AAD rather than returning incorrect results.

Sponsored by: Chelsio Communications

6 years agoAlways set the IV location to IV_NOP.
jhb [Wed, 24 Jan 2018 20:06:02 +0000 (20:06 +0000)]
Always set the IV location to IV_NOP.

The firmware ignores this field in the FW_CRYPTO_LOOKASIDE_WR work
request.

Submitted by: Harsh Jain @ Chelsio
Sponsored by: Chelsio Communications

6 years agoAlways store the IV in the immediate portion of a work request.
jhb [Wed, 24 Jan 2018 20:04:08 +0000 (20:04 +0000)]
Always store the IV in the immediate portion of a work request.

Combined authentication-encryption and GCM requests already stored the
IV in the immediate explicitly.  This extends this behavior to block
cipher requests to work around a firmware bug.  While here, simplify
the AEAD and GCM handlers to not include always-true conditions.

Submitted by: Harsh Jain @ Chelsio
Sponsored by: Chelsio Communications

6 years agoAdopt revision 1.76 and 1.77 from NetBSD:
ae [Wed, 24 Jan 2018 19:48:25 +0000 (19:48 +0000)]
Adopt revision 1.76 and 1.77 from NetBSD:
  Fix a vulnerability in IPsec-IPv6-AH, that allows an attacker to remotely
  crash the kernel with a single packet.

  In this loop we need to increment 'ad' by two, because the length field
  of the option header does not count the size of the option header itself.

  If the length is zero, then 'count' is incremented by zero, and there's
  an infinite loop. Beyond that, this code was written with the assumption
  that since the IPv6 packet already went through the generic IPv6 option
  parser, several fields are guaranteed to be valid; but this assumption
  does not hold because of the missing '+2', and there's as a result a
  triggerable buffer overflow (write zeros after the end of the mbuf,
  potentially to the next mbuf in memory since it's a pool).

  Add the missing '+2', this place will be reinforced in separate commits.

Reported by: Maxime Villard <maxv at NetBSD.org>
MFC after: 1 week

6 years agomalloc(9): Change nominal size to size_t to match standard C
cem [Wed, 24 Jan 2018 19:37:18 +0000 (19:37 +0000)]
malloc(9): Change nominal size to size_t to match standard C

No functional change -- size_t matches unsigned long on all platforms.

Reported by: bde
Discussed with: jhb
Sponsored by: Dell EMC Isilon

6 years agoMerge revision 1.35 from NetBSD:
ae [Wed, 24 Jan 2018 19:06:44 +0000 (19:06 +0000)]
Merge revision 1.35 from NetBSD:
  fix pointer/offset mistakes in handling of IPv4 options

Reported by: Maxime Villard <maxv at NetBSD.org>
MFC after: 1 week