Commit graph

234460 commits

Author SHA1 Message Date
Xin LI 34e314e794 Use endian.h le32dec() instead of rolling our own.
Suggested by:	phk
Reviewed by:	imp, pfg
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D16192
2018-07-10 01:42:28 +00:00
Kyle Evans 0f46005e4b subr_hints: Skip static_env and static_hints if they don't contain hints
This is possible because, well, they're static. Both the dynamic environment
and the MD-environment (generally loader(8) environment) can potentially
have room for new variables to be set, and thus do not receive this
treatment.
2018-07-10 00:36:37 +00:00
Kyle Evans dc4446df5f subr_hints: Convert some bool-like ints to bools 2018-07-10 00:34:19 +00:00
Kyle Evans 5768da6c21 subr_hints: Use goto/label instead of series of conditionals 2018-07-10 00:33:31 +00:00
Cy Schubert e4098e39ca Remove redundant space.
MFC after:	3 days
2018-07-10 00:26:13 +00:00
Daichi GOTO 5c48c1ee57 top(1): Fix the prompt bug and core dump problem in o / p mode that occurred by r336028
Reviewed by:	cy
Approved by:	gnn (mentor)
Differential Revision:	https://reviews.freebsd.org/D16174
2018-07-10 00:19:52 +00:00
Mark Johnston 013072f04c Fix pre-SI_SUB_CPU initialization of per-CPU counters.
r336020 introduced pcpu_page_alloc(), replacing page_alloc() as the
backend allocator for PCPU UMA zones.  Unlike page_alloc(), it does
not honour malloc(9) flags such as M_ZERO or M_NODUMP, so fix that.

r336020 also changed counter(9) to initialize each counter using a
CPU_FOREACH() loop instead of an SMP rendezvous.  Before SI_SUB_CPU,
smp_rendezvous() will only execute the callback on the current CPU
(i.e., CPU 0), so only one counter gets zeroed.  The rest are zeroed
by virtue of the fact that UMA gratuitously zeroes slabs when importing
them into a zone.

Prior to SI_SUB_CPU, all_cpus is clear, so with r336020 we weren't
zeroing vm_cnt counters during boot: the CPU_FOREACH() loop had no
effect, and pcpu_page_alloc() didn't honour M_ZERO.  Fix this by
iterating over the full range of CPU IDs when zeroing counters,
ignoring whether the corresponding bits in all_cpus are set.

Reported and tested by:	pho (previous version)
Reviewed by:		kib (previous version)
Differential Revision:	https://reviews.freebsd.org/D16190
2018-07-10 00:18:12 +00:00
Warner Losh bdea3adca6 Tweak documentation to RB_ constants to reflect current use
RB_ASKNAME is no longer instructions to the boot loader to request a
prompt for which kernel to boot. Instead, it asks for what the root
file system to use. RB_INITNAME is unused, and never has been in
FreeBSD as far as I can tell. Remove it from the documentation and fix
comment. RB_SELFTEST and RB_MINIROOT likewise (though they were
completely undocumented). These last three constants can likely just
be deleted as nothing references them (even to set useless bits).

RB_ASKNAME doesn't actually survive reboot, however, so needs to be
communicated to the bootloader via other means. If the bootloader sets
it, though, it will be honored.
2018-07-10 00:01:14 +00:00
Pedro F. Giffuni add14e43f8 localedef(1): remove duplicated includes.
Hinted by:	DragonFlyBSD
2018-07-09 20:38:47 +00:00
Justin Hibbits 3395ab28eb powerpc/powernv: Make opal_i2c driver work with attached i2c drivers
* FreeBSD stores addresses in 8 bit format, but the OPAL API requires the 7-bit
  address, and encodes the direction elsewhere.  Behave like other i2c drivers,
  and shift accordingly.
* The OPAL API can already handle multiple requests in flight.  Change the async
  token to be private to the thread, so as not to stomp across i2c accesses,
  remove the limitation error message, and use the correct message index to
  transfer all messages in the list.
* Micro-optimize the async handler to not continuously call pmap_kextract() when
  spin-waiting for the operation to complete.

This has been tested by hexdumping an EEPROM attached via the icee(4) driver.
2018-07-09 20:33:48 +00:00
Pedro F. Giffuni 51a8f735f8 sed(1): Suppress implicit-fallthrough.
Apparently some tools are not able to determine if all the cases of a
switch are covered. Make use of the attribute for cases like this.

Hinted by:	DragonFlyBSD GGC8 (but fixed differently)

CID:	976552
2018-07-09 20:27:31 +00:00
Oleksandr Tymoshenko 00b5108bfb ig4(4): add devmatch(8) PNP info
Now that we have all devices ids in a table add MODULE_PNP_INFO macro
to let devmatch autoload module
2018-07-09 20:00:45 +00:00
Rick Macklem de9a1a70ab Add support for a "forced" pnfsdskill to the pNFS server kernel code.
The pnfsdskill(8) command will normally fail if there is no valid mirror
for the DS to be disabled. However, a system administrator may need to
disable a DS which does not have a valid mirror so that the nfsd threads
can be terminated. This patch adds the kernel code needed by pnfsdskill(8)
to implement this "forced" case of disabling a DS.
This patch only affects the pNFS server.
2018-07-09 19:58:01 +00:00
Emmanuel Vadot 1017327049 truncate: Add support for -s % and /
% round up to the multiple size and / round down
This is compatible with gnu truncate.
Add tests and document in the man page.
2018-07-09 19:03:30 +00:00
Emmanuel Vadot dde27dbc9b truncate: style(9) some parts 2018-07-09 19:02:05 +00:00
Ian Lepore 4c2b439617 Add pnp info to the imx_spi driver. 2018-07-09 19:00:39 +00:00
Ian Lepore d0e6405ddd Add a manpage for the imx_spi driver. 2018-07-09 19:00:13 +00:00
Warner Losh f12495bbfa Remove gateworks nanobsd support.
A quick test of this shows multiple problems. Rather than fix the
problems, just retire this board's support. It's for a 12 year old
board that's been out of production for at least 7 years and generally
lacks the memory to run even a stripped down NanoBSD image well. It's
not really relevant anymore.
2018-07-09 18:02:35 +00:00
Warner Losh 405111fde0 Remove armeb from the list of architectures we build for the boot
laoder testing scripts. It just adds to the build time, and will be
retired soon anyway, per discussions in freebsd-arch@ last month.
2018-07-09 18:02:23 +00:00
Ian Lepore 5e71fdc20d Add missing generated header file.
Reported by:	Julian H. Stacey <jhs@berklix.com>
2018-07-09 14:18:03 +00:00
Andrey V. Elsukov f7c4fdee1a Add "record-state", "set-limit" and "defer-action" rule options to ipfw.
"record-state" is similar to "keep-state", but it doesn't produce implicit
O_PROBE_STATE opcode in a rule. "set-limit" is like "limit", but it has the
same feature as "record-state", it is single opcode without implicit
O_PROBE_STATE opcode. "defer-action" is targeted to be used with dynamic
states. When rule with this opcode is matched, the rule's action will
not be executed, instead dynamic state will be created. And when this
state will be matched by "check-state", then rule action will be executed.
This allows create a more complicated rulesets.

Submitted by:	lev
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D1776
2018-07-09 11:35:18 +00:00
Andrey V. Elsukov 98a8fdf6da Deduplicate the code.
Add generic function if_tunnel_check_nesting() that does check for
allowed nesting level for tunneling interfaces and also does loop
detection. Use it in gif(4), gre(4) and me(4) interfaces.

Differential Revision:	https://reviews.freebsd.org/D16162
2018-07-09 11:03:28 +00:00
Wojciech Macek d50fbe3fe2 ARM64: Add quirk mechanism to pci_host_generic_acpi
Add few quirks which are necessary to use AHCI on ThX2

Submitted by:          Patryk Duda <pdk@semihalf.com>
Obtained from:         Semihalf
Sponsored by:          Cavium
Differential revision: https://reviews.freebsd.org/D15929
2018-07-09 09:00:16 +00:00
Wojciech Macek db2156bc49 ARM64: Add support for ThunderX2 PCIe
Submitted by:          Patryk Duda <pdk@semihalf.com>
Obtained from:         Semihalf
Sponsored by:          Cavium
Differential revision: https://reviews.freebsd.org/D15141
2018-07-09 08:55:07 +00:00
Wojciech Macek 45e8acf71c ARM64: Add ThunderX2 CPU revision macro. Add ThunderX2 name in identcpu.c
Submitted by:          Patryk Duda <pdk@semihalf.com>
Obtained from:         Semihalf
Sponsored by:          Cavium
2018-07-09 08:41:54 +00:00
Conrad Meyer e76247cd60 gzip(1): Don't shadow global 'err'
Unbreak work build on ppc due to -Werror=shadow.  Introduced in r336121.

X-MFC-With:		r336121
2018-07-09 08:37:55 +00:00
Conrad Meyer 8ff3cdd1b5 Integrate SHA2-224 with userspace components
The double compilation of the kernel sources in libmd and libcrypt is
baffling, but add yet another define hack to prevent duplicate symbols.

Add documentation and SHA2-224 test cases to libmd.

Integrate with the md5(1) command, document, and add more test cases;
self-tests pass.
2018-07-09 08:19:04 +00:00
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