Commit Graph

234433 Commits

Author SHA1 Message Date
Conrad Meyer
c4729f6e89 OCF: Add plain hash modes
In part, to support OpenSSL's use of cryptodev, which puts the HMAC pieces
in software and only offloads the raw hash primitive.

The following cryptodev identifiers are added:

 * CRYPTO_RIPEMD160 (not hooked up)
 * CRYPTO_SHA2_224
 * CRYPTO_SHA2_256
 * CRYPTO_SHA2_384
 * CRYPTO_SHA2_512

The plain SHA1 and 2 hashes are plumbed through cryptodev (feels like there
is a lot of redundancy here...) and cryptosoft.

This adds new auth_hash implementations for the plain hashes, as well as
SHA1 (which had a cryptodev.h identifier, but no implementation).

Add plain SHA 1 and 2 hash tests to the cryptocheck tool.

Motivation stems from John Baldwin's earlier OCF email,
https://lists.freebsd.org/pipermail/freebsd-arch/2018-January/018835.html .
2018-07-09 07:28:13 +00:00
Conrad Meyer
c97f39ce17 OCF: Add CRYPTO_SHA2_224_HMAC mode
Round out the complete set of basic SHA2 HMAC modes with SHA2-224.

Support is added to the cryptocheck test tool.
2018-07-09 07:26:12 +00:00
Conrad Meyer
1245c6d1a5 Implement SHA2-224 submode of SHA2-256
Like SHA2-384:SHA2-512, SHA2-224 is simply a truncated SHA2-256 with a
different initial vector.  Add to round out the complete basic SHA2 family.
2018-07-09 07:24:05 +00:00
Conrad Meyer
590adc1bc2 Remove "HMAC" from <HASH>_HMAC_BLOCK_LEN macro names
The block size is a property of the underlying hash algorithm, and has
nothing to do with the HMAC construction.

No functional change.
2018-07-09 07:21:37 +00:00
Xin LI
b393a8ace6 Don't delete outfile unconditionally.
MFC after:	1 month
2018-07-09 06:19:33 +00:00
Warner Losh
f32fbc84bd Remove dirs that git svn should have removed but didn't. 2018-07-09 03:57:23 +00:00
Pedro F. Giffuni
d2e5337149 libiconv: correct undefined behavior.
Detected on NetBSD:
# nm /usr/lib/libc.so|grep sanit
    /public/src.git/lib/libc/citrus/modules/citrus_mapper_std.c:173:8:
runtime error: left shift of 1 by 31 places cannot be represented in type 'int'

Obtained from:	NetBSD (CVS Rev. 1.11)
MFC after:	1 week
2018-07-08 23:22:04 +00:00
Warner Losh
b60a815e6d Remove stray space from PNP string. 2018-07-08 23:12:27 +00:00
Pedro F. Giffuni
3fcbc83d04 gzip: fix for undefined behavior.
Unportable left shift reported with MKSANITIZER=yes
USE_SANITIZER=undefined:

# progress -zf ./games.tgz  tar -xp -C "./" -f -
/public/src.git/usr.bin/gzip/gzip.c:2126:33: runtime error: left shift of
251 by 24 places cannot be represented in type 'int'
100%
|****************************************************************************************************************|
44500 KiB  119.69 MiB/s    00:00 ETA

Refactor the following code into something that is more clear
and fix signed integer shift, by casting all buf[] elements to
(unsigned int):

unsigned char buf[8];
uint32_t usize;
[...]
else {
    usize = buf[4] | buf[5] << 8 |
            buf[6] << 16 | buf[7] << 24;
[...]

New version:

    usize = buf[4];
    usize |= (unsigned int)buf[5] << 8;
    usize |= (unsigned int)buf[6] << 16;
    usize |= (unsigned int)buf[7] << 24;

Only the "<< 24" part needs explicit cast, but for consistency make the
integer promotion explicit and clear to a code reader.

Sponsored by <The NetBSD Foundation>

Obtained from:	NetBSD (CVS rev. 1.113)
MFC after:	1 week
2018-07-08 22:39:33 +00:00
Ian Lepore
0592ad0252 Oops, fix a typo: imx_snvs should be imx6_snvs. 2018-07-08 21:14:43 +00:00
Ian Lepore
638a5afda9 Move device statements out of std.imx* and into kernel config files.
In the armv4/5 world device statements in these files were common, but in
the v6/7 world, other socs don't put device statements into those files, so
this just brings imx5 and imx6 into line with the current conventions.
2018-07-08 21:09:52 +00:00
Warner Losh
6ea57aa23b Add PNP info to PCI attachment of et driver
Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15979
2018-07-08 20:40:28 +00:00
Warner Losh
f489d4c3ac Add PNP info to PCI attachment of ipw driver
Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15979
2018-07-08 20:40:23 +00:00
Warner Losh
d477921096 Add PNP info to PCI attachment of ixv driver
Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15979
2018-07-08 20:40:19 +00:00
Warner Losh
4ce9eaf731 Add PNP info to PCI attachment of ix driver
Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15979
2018-07-08 20:40:14 +00:00
Warner Losh
4322d10734 Add PNP info to PCI attachments of ciss driver
Move the module declaration so that it's after the device table.
The PNP_INFO must come after the module declaration.

Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15995
2018-07-08 20:40:10 +00:00
Warner Losh
4d0f1c5658 Add PNP info to PCI attachment of dc driver
Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15995
2018-07-08 20:40:06 +00:00
Warner Losh
ea72f463b2 Add PNP info to PCI attachments of bge driver
Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15995
2018-07-08 20:40:01 +00:00
Warner Losh
6c15b8d934 Add PNP info to PCI attachments of bfe driver
Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15995
2018-07-08 20:39:57 +00:00
Warner Losh
b042bc51c8 Add PNP info to PCI attachment of alc driver
Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)
Pull Request: https://github.com/bsdimp/freebsd/pull/4
2018-07-08 20:39:52 +00:00
Warner Losh
b2b71ff0b4 Add PNP info to PCI attachment of gem driver
Move device table earlier in the file so we can reference it in the
PNP_INFO macro.

Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)
Pull Request: https://github.com/bsdimp/freebsd/pull/5
2018-07-08 20:39:48 +00:00
Warner Losh
20dd1e71e0 Add PNP info to PCI attachment of fxp driver
Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)
Pull Request: https://github.com/bsdimp/freebsd/pull/5
2018-07-08 20:39:43 +00:00
Warner Losh
40abe76bf0 Add PNP info to PCI attachment of ena driver
Make unsigned values uint16_t for pnp table. They are properly
uint16_t befause they are 16-bit PCI IDs. The PNP_INFO language has no
type for bare unsigned.

Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)
Pull Request: https://github.com/bsdimp/freebsd/pull/5
2018-07-08 20:39:38 +00:00
Warner Losh
63c017dae5 Add PNP info to PCI attachment of cas driver
Move module delcaration to be after device table. The PNP_INFO must
follow the module declaration.

Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)
Pull Request: https://github.com/bsdimp/freebsd/pull/5
2018-07-08 20:39:23 +00:00
Mark Johnston
ae00e67228 Reuse the PV entry when updating a mapping in pmap_enter().
This addresses a problem described in r335784, where memory
pressure forces reclamation of a PV chunk and in rare cases leads to a
use-after-free of a page table page.

Reviewed by:	alc, kib
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D16181
2018-07-08 20:38:46 +00:00
Ian Lepore
9b4738cf7b Make the imx6_snvs driver usable as a module, add pnp info. Add a manpage. 2018-07-08 19:35:41 +00:00
Matt Macy
3843df3fdc critical_{enter, exit}: add missing compiler barrier
Reported by:	markj
2018-07-08 19:35:29 +00:00
Ian Lepore
952dd10db4 Catch up with improvements in RTC handling... It's no longer necessary to
ignore the timestamp passed in to settime() due to inaccuracy, the core
routines now pass in a nanosecond-accurate time freshly-obtained before
calling each driver's settime() method.  Also, add calls to the new
debugging output helpers.
2018-07-08 18:44:42 +00:00
Rick Macklem
acc6e58def Fix the kernel part of pnfsdscopymr() to handle holes in the file being copied.
If a mirrored DS is being recovered that has a lot of large sparse files,
pnfsdscopymr(8) would use a lot of space on the recovered mirror since it
would write the "holes" in the file being mirrored.
This patch adds code to check for a "hole" and skip doing the write.
The check is done on a "per PNFSDS_COPYSIZ size block", which is currently 64K.
I think that most file server file systems will be using a blocksize at
least this large. If the file server is using a smaller blocksize and
smaller holes need to be preserved, PNFSDS_COPYSIZ could be decreased.
The block of 0s is malloc()d, since pnfsdcopymr(8) should be an infrequent
occurrence.
2018-07-08 18:15:55 +00:00
Alan Cox
717d5c0b47 Invalidate the mapping before updating its physical address.
Doing so ensures that all threads sharing the pmap have a consistent
view of the mapping.  This fixes the problem described in the commit
log messages for r329254 without the overhead of an extra fault in the
common case.  Once other pmap_enter() implementations are similarly
modified, the workaround added in r329254 can be removed, reducing the
overhead of CoW faults.

See also r335784 for amd64.  The i386 implementation of pmap_enter()
already reused the PV entry from the old mapping.

Reviewed by:	kib, markj
Tested by:	pho
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D16133
2018-07-08 16:51:54 +00:00
Mark Johnston
7525d42f70 Reduce diff between msun/src/e_pow.c and msun/src/e_powf.c.
Remove unnecessary casts, use integer literal constants instead of
floating point constants where possible, and introduce three const
static variables to hold 0.5, 0.25, and 1/3.

PR:		229420
Submitted by:	Steve Kargl <sgk@troutmask.apl.washington.edu>
MFC after:	1 week
2018-07-08 16:33:58 +00:00
Mark Johnston
46a846f791 Fix whitespace issues in bessel function routines.
PR:		229423
Submitted by:	Steve Kargl <sgk@troutmask.apl.washington.edu>
MFC after:	3 days
2018-07-08 16:26:13 +00:00
Konstantin Belousov
f4a5a0b8ac Add a missed chunk r335939.
Noted by:	David Carlier
MFC after:	9 days
Differential revision:	https://reviews.freebsd.org/D16178
2018-07-08 15:48:47 +00:00
Ed Schouten
30dd2da2a3 Use the FQDN in the newsyslog log message when RFC 5424 is enabled.
The RFC 5424 spec mentions that logging FQDNs over short hostnames is
preferred. Alter this code, so that the hostname doesn't get truncated
on startup. Keep track of the length of the short hostname, so that
fprintf() can do the truncation where necessary.

MFC after:	1 month
2018-07-08 10:08:24 +00:00
Warner Losh
007b82d7ab Stop using ../zfs/libzfs.h but instead use libzfs.h.
While ../zfs/libzfs.h mostly works, there are a few situations where
it does not. Eliminate the problem by using plain libzfs.h, like we do
for ufs support. This fixes the weird cases, and is easier to
understand. It also follows the general style convetion of avoiding
../ in #includes.
2018-07-08 07:42:58 +00:00
Warner Losh
b8902de147 Move ZFS files into libsa
Move the libzfs stuff into libsa. There's no need for it to be a
separate library. The separate library adds to the issues of build
ordering that we see from time to time. Move the filesystem support
into libsa, like all the other filesystem support rather than making
zfs the odd-duck out.

Discussed with: allanjude@
2018-07-08 07:42:49 +00:00
Ian Lepore
9d6c74a0d9 Create an aarch64 subdir under man4, now that we have aarch64 manpages.
Reported by:	Mark Millard
2018-07-08 01:29:48 +00:00
Ian Lepore
cf2cec68bd Add pnp info to imx6_ahci, and add a module makefile, and a manpage for it. 2018-07-08 00:27:28 +00:00
Ian Lepore
fdd9550b54 Move armv8crypto.4 into the aarch64 dir; should have been part of r336077.
Pointy hat:	ian@
Reported by:	rpokola@
2018-07-08 00:02:14 +00:00
Ian Lepore
284db32c87 Move arm- and aarch64-specific manpages into arch-specific directories.
This removes a bit of the .if/.endif clutter from man4/Makefile by using
the existing machinery that supports per-arch manpages.
2018-07-07 21:49:30 +00:00
Ian Lepore
9287e4663a Add a manpage for the imx5/6 watchdog driver. 2018-07-07 20:43:01 +00:00
Rick Macklem
ed66a76bca Fix handling of the hybrid DS case for a pNFS server.
After the addition of the "#mds_path" suffix for a DS specification on the
"-p" nfsd option, it is possible to have a mix of DSs assigned to an MDS
file system and DSs that store files for all DSs. This is what I referred
to as "hybrid" above.
At first, I didn't think this hybrid case would be useful, but I now believe
that some system administrators may fine it useful.
This patch modifies the file storage assignment algorithm so that it
makes the "#mds_path" DSs take priority and the all file systems DSs
are now only used for MDS file systems with no "#mds_path" DS servers.
This only affects the pNFS server for this "hybrid" case.
2018-07-07 19:27:49 +00:00
Kirk McKusick
e1c27cf7d6 Import commit from NetBSD with checkin message:
Avoid Undefined Behavior in ffs_clusteracct()

    Change the type of 'bit' variable from int to unsigned int and use unsigned
    values consistently.

    sys/ufs/ffs/ffs_subr.c:336:10, shift exponent -1 is negative

    Detected with Kernel Undefined Behavior Sanitizer.

    Reported by <Harry Pantazis>

Submitted by: Pedro Giffuni
2018-07-07 19:11:43 +00:00
Ian Lepore
31ff8defe3 Add support to the imx watchdog for the FDT "timeout-sec" property, by
automatically initializing the watchdog using the given value.  Also,
attach at BUS_PASS_TIMER to extend watchdog protection to more of the
kernel init process.
2018-07-07 19:10:00 +00:00
Ian Lepore
a4db01f7c6 Correctly calculate the value to put in the imx wdog countdown register.
The correct value is seconds*2-1.  The code was using just seconds*2, which
led to being off by a half-second -- usually not a big deal, except when the
value was the max (128) it overflowed so zero would get written to the
countdown register, which equates to a timeout of a half second.
2018-07-07 19:03:38 +00:00
Ian Lepore
2b352b736d Add pnp info and a module makefile for the imx_wdog watchdog driver. 2018-07-07 17:25:09 +00:00
Warner Losh
62ba9c86ed Fix PCI_SUBDEV call 2018-07-07 15:55:58 +00:00
Warner Losh
69c173e23f Update AMDSMB to use PCI_MATCH
Differential Review: https://reviews.freebsd.org/D16172
2018-07-07 15:55:52 +00:00
Warner Losh
4d711ae269 Switch to using new PCI_MATCH stuff. 2018-07-07 15:25:16 +00:00
Warner Losh
971b5f7632 Create PCI_MATCH and pci_match_device
Create a covenience function to match PCI device IDs. It's about 15
years overdue.

Differential Revision: https://reviews.freebsd.org/D15999
2018-07-07 15:25:11 +00:00