Commit Graph

284491 Commits

Author SHA1 Message Date
christos
a98351bd74 Reset options on every loop. 2021-01-13 17:01:31 +00:00
chs
a5d839ece9 in pmap_writetext(), restore the context also when we return early. 2021-01-13 16:42:17 +00:00
christos
7e0da10f84 If an option is not found in the standard table, log it and don't try to
dereference it. This prevents crashes from XenServer VM that PXE boots and
includes option 175 in the DHCP request. Reported by Stephen Borrill.
2021-01-13 15:51:49 +00:00
skrll
118a4c19b7 Improve English in comments 2021-01-13 07:36:56 +00:00
skrll
16902a87e4 Improve english in a comment 2021-01-13 07:34:37 +00:00
skrll
95cbb4a14b skip sigbus_adraln on MIPS 2021-01-13 06:44:55 +00:00
skrll
df83eae357 Don't advertise AUDIO_PROP_CAPTURE - no capture method is provided
[   1.0000000] audio0 at vraiu0: missing capture method
2021-01-13 06:39:46 +00:00
riastradh
03120d5679 entropy(7): Add missing URL to reference. 2021-01-13 05:21:34 +00:00
riastradh
a1c3883806 threadpool(9): Tidy up thread naming.
- `dispatcher', not `overseer' -- much more appropriate metaphor.
- Just omit `/-1' from unbound thread names.
- Just omit `@-1' from dynamic-priority (PRI_NONE) thread names.
2021-01-13 02:20:15 +00:00
riastradh
8798207fb7 threadpool(9): Make threadpool_percpu_ref_remote non-sleepable.
Needed for threadpool-based workqueue_enqueue to run in interrupt
context.
2021-01-13 02:19:08 +00:00
rillig
b1ccbae033 lint: update usage for lint1 and lint2
(Forgotten in the previous commit.)
2021-01-12 21:48:10 +00:00
rillig
58ad84b7ab lint: add new check for strict bool mode
In strict bool mode, bool is considered incompatible with all other
scalar types, just as in Java, C#, Pascal.

The controlling expressions in if statements, while loops, for loops and
the '?:' operator must be of type bool.  The logical operators work on
bool instead of int, the bitwise operators accept both integer and bool.
The arithmetic operators don't accept bool.

Since <stdbool.h> implements bool using C preprocessor macros instead of
predefining the identifiers "true" and "false", the integer constants 0
and 1 may be used in all contexts that require a bool expression.
Except from these, no implicit conversion between bool and scalar types
is allowed.

See usr.bin/tests/xlint/lint1/d_c99_bool_strict.c for more details.

The command line option -T has been chosen because all obvious choices
(-b or -B for bool, -s or -S for strict) are already in use.  The -T may
stand for "types are checked strictly".

The default behavior of lint doesn't change.  The strict bool check is
purely optional.

An example program for strict bool mode is usr.bin/make, which has been
using explicit comparisons such as p != NULL, ch != '\0' or n > 0 in
most places for a long time now, even before the refactoring in 2020.
2021-01-12 20:42:00 +00:00
skrll
edcd2fff07 Typo in comment 2021-01-12 19:36:39 +00:00
joerg
48b62e131c Don't use arc4random for the tools build on NetBSD either.
compat_defs.h explicitly forces _POSIX_SOURCE and this hides the
prototype in stdlib.h.
2021-01-12 14:21:18 +00:00
skrll
cb66973317 Turn on DIAGNOSTIC to help track down problem in hpcmips test runs 2021-01-12 08:03:19 +00:00
knakahara
c8dbf241c1 Fix PR kern/55920 . Add pci_msi_count() and pci_msix_count() description. 2021-01-12 05:08:50 +00:00
skrll
49de5dda47 Trailing whitespace 2021-01-11 22:02:28 +00:00
skrll
89d6c918de Fix spelling of preferred in comments. While here improve grammar in
one of the comments.
2021-01-11 22:01:14 +00:00
skrll
01e80a0645 Improve a comment 2021-01-11 21:58:31 +00:00
skrll
8b0d288f4c Correct the spelling of preferred. 2021-01-11 21:51:20 +00:00
christos
93bfe048a1 Make this compile without -DINET6 (Kurt Schreiner) 2021-01-11 21:45:22 +00:00
christos
d25fab543f Only try to create up-to NAME_MAX filenames.
XXX: this should be moved to stdio/t_mktemp.c where the rest of the tests
are and the code lives.
2021-01-11 20:31:34 +00:00
rillig
d091eb5048 lint: split typeok into several functions 2021-01-11 20:04:01 +00:00
rillig
c3b6c0b39c lint: sprinkle a few const modifiers throughout the code 2021-01-11 19:29:49 +00:00
skrll
63292dfbcd Trailing whitespace 2021-01-11 17:18:51 +00:00
skrll
98ba77a49d Small simplification 2021-01-11 17:12:13 +00:00
skrll
d720e6a6d8 Tidy up more error handling confusion 2021-01-11 17:00:18 +00:00
skrll
441170498e KNF 2021-01-11 16:48:35 +00:00
skrll
93a703195e Trailing whitespace 2021-01-11 16:48:03 +00:00
simonb
0df872764f For "ps/a" print all of p_comm instead of just the first 10 chars, add a
space after PID, left justify the command name.
2021-01-11 07:49:04 +00:00
skrll
6285957ff6 PR/55715: pmax testbed panics with "assertion "asid == curcpu()->ci_pmap_asid_cur" failed"
It's GXemul that has the bug! Unfortunately, there's no way (currently) to
detect if we're running under GXemul emulation, so disable for all mips
for now.  Hopefully, GXemul will get fixed soon.
2021-01-11 07:17:49 +00:00
chs
d442ebc7fd in pgt_page_alloc(), wait and retry the page allocation if PR_WAITOK.
fixes PR 55895.
2021-01-11 06:12:43 +00:00
riastradh
0c4aa85688 entropy: Downgrade consolidation warning from printf to LOG_DEBUG.
Candidate fix for PR kern/55458.  This message is rather technical,
and so is unlikely to be acted on by anyone not debugging the kernel
anyway.  Most likely, on any system where it is a real problem, there
will be another (less technical) entropy warning anyway.
2021-01-11 02:18:40 +00:00
rillig
bf28682f65 lint: extend test for strict _Bool handling
There is no danger in allowing (flags & FLAG) as a controlling
expression, provided that it is immediately compared to zero, such as in
an if statement or as the operand of a logical operator.
2021-01-11 00:28:28 +00:00
rillig
810790fcb7 make(1): make a few more bool expressions more precise
The previous version of lint(1) from a few hours ago didn't catch all
occurrences.  And even the current one doesn't catch everything.
Function arguments and return types still need some work.  The "return
quietly" from shouldDieQuietly still implicitly converts from int to
_Bool.

No functional change.
2021-01-10 23:59:53 +00:00
riastradh
cba96d16f7 Various entropy integration improvements.
- New /etc/security check for entropy in daily security report.

- New /etc/rc.d/entropy script runs (after random_seed and rndctl) to
  check for entropy at boot -- in rc.conf, you can:

  . set `entropy=check' to halt multiuser boot and enter single-user
    mode if not enough entropy

  . set `entropy=wait' to make multiuser boot wait until enough entropy

  Default is to always boot without waiting -- and rely on other
  channels like security report to alert the operator if there's a
  problem.

- New man page entropy(7) discussing the higher-level concepts and
  system integration with cross-references.

- New paragraph in afterboot(8) about entropy citing entropy(7) for
  more details.

This change addresses many of the issues discussed in security/55659.
This is a first draft; happy to take improvements to the man pages and
scripted messages to improve clarity.

I considered changing motd to include an entropy warning with a
reference to the entropy(7) man page, but it's a little trickier:
- Not sure it's appropriate for all users to see at login rather than
  users who have power to affect the entropy estimate (maybe it is,
  just haven't decided).
- We only have a mechanism for changing once at boot; the message would
  remain until next boot even if an operator adds enough entropy.
- The mechanism isn't really conducive to making a message appear
  conditionally from boot to boot.
2021-01-10 23:24:25 +00:00
rillig
e9d1e169d3 lint: add enum flags to the test about strict boolean mode 2021-01-10 21:45:50 +00:00
rillig
465f117622 lint: allow custom flags to be specified in all unit tests
Previously, only the tests called msg_*.c could use this feature.  Since
it is useful for other tests as well, enable it everywhere.
2021-01-10 21:26:12 +00:00
rillig
31940a95cd make(1): consistently use boolean expressions in conditions
Most of the make code already followed the style of explicitly writing
(ptr != NULL) instead of the shorter (ptr) in conditions.

The remaining 50 instances have been found by an experimental,
unpublished check in lint(1) that treats bool expressions as
incompatible to any other scalar type, just as in Java, C#, Pascal and
several other languages.

The only unsafe operation on Boolean that is left over is (flags &
FLAG), for an enum implementing a bit set.  If Boolean is an ordinary
integer type (the default), some high bits may get lost.  But if Boolean
is the same as _Bool (by compiling with -DUSE_C99_BOOLEAN), C99 6.3.1.2
defines that a conversion from any scalar to the type _Bool acts as a
comparison to 0, which cannot lose any bits.
2021-01-10 21:20:46 +00:00
skrll
8be367b3f6 PR/55715: pmax testbed panics with "assertion "asid == curcpu()->ci_pmap_asid_cur" failed"
disable the sigbus_adraln test on qemu for now
2021-01-10 20:46:14 +00:00
riastradh
26da9de7e6 rc.subr(8): Fix markup -- use .It to set off a new item. 2021-01-10 19:26:31 +00:00
jmcneill
0561b403b9 Disable nouveau for now. It can cause long pauses at boot and sometimes
fails to initialize the display at all.
2021-01-10 19:20:16 +00:00
rillig
74ead7f1f1 lint: split check_global_variable into several functions
This reduces the indentation and allows the messages in the comments to
contain the complete text instead of only an abbreviated prefix.

No functional change.
2021-01-10 18:22:52 +00:00
rillig
556f6964e2 lint: fix assertion failure for syntax error in enum declaration 2021-01-10 18:13:42 +00:00
rillig
0ec7a3ab6a lint: add test for triggering assertion failures in lint1 2021-01-10 18:06:38 +00:00
rillig
76d2ead3e0 lint: add test for treating _Bool as non-scalar type
This strict mode is not yet implemented.  The plan is to use it for
usr.bin/make, to get rid of the many possible variants of defining the
Boolean type in make.h.  These variants did find some bugs, but not
reliably so.  Using static analysis seems more promising for this.

In an early stage of developing this test, lint1 crashed in the enum
definition in line 213, where the node for the '?:' had been NULL.  This
can happen in other situations as well, such as with syntax errors, but
these should be rare, as lint is usually only run if the compiler has
accepted the source code.  Still, there should not be any assertion
failures while running lint1.
2021-01-10 17:43:46 +00:00
ryoon
09c03af8ed Add whitespace after comma 2021-01-10 15:50:16 +00:00
rillig
f49e4318ba lint: remove redundant parentheses around return value 2021-01-10 14:12:48 +00:00
rillig
b57d857fe2 lint: change return type of eqptrtype to bool 2021-01-10 14:09:57 +00:00
rillig
9325ef4f0b lint: rename functions with short names 2021-01-10 14:07:34 +00:00