openbsd
6 years agopseudo-device must be file-flagged otherwise ramdisks cannot link.
deraadt [Sun, 19 Aug 2018 18:01:04 +0000 (18:01 +0000)]
pseudo-device must be file-flagged otherwise ramdisks cannot link.

6 years agoMostly complete implementation of the 'c' (character available)
schwarze [Sun, 19 Aug 2018 17:43:39 +0000 (17:43 +0000)]
Mostly complete implementation of the 'c' (character available)
roff conditional, except that the .char request still isn't supported
and that behaviour differs from groff in many edge cases.
But at least valid character names and numbers are now distinguished
from invalid ones.
This also fixes the bug that parsing of the 'c' conditional was
incomplete, which resulted in leaking the tested character to the
input parser at the beginning of the body when the condition was
inverted.

6 years agotweak previous;
jmc [Sun, 19 Aug 2018 17:17:44 +0000 (17:17 +0000)]
tweak previous;

6 years agoAdd a client redraw-window flag instead of the redraw-all flag and for
nicm [Sun, 19 Aug 2018 16:45:03 +0000 (16:45 +0000)]
Add a client redraw-window flag instead of the redraw-all flag and for
all just use the three flags together (window, borders, status).

6 years agoRename and collapse tls12_get_sigandhash_cbb().
jsing [Sun, 19 Aug 2018 15:38:03 +0000 (15:38 +0000)]
Rename and collapse tls12_get_sigandhash_cbb().

Now that all callers of tls12_get_sigandhash() have been converted to CBB,
collapse tls12_get_sigandhash() and tls12_get_sigandhash_cbb() into a
single function. Rename it to tls12_gethashandsig() to be representative
of the actual order of the sigalgs parameters, and perform some other
clean up.

ok inoguchi@ tb@

6 years agoConvert ssl3_send_newsession_ticket() to CBB.
jsing [Sun, 19 Aug 2018 15:29:26 +0000 (15:29 +0000)]
Convert ssl3_send_newsession_ticket() to CBB.

This removes a memorable BUF_MEM_grow() and associated comment.

ok inoguchi@ tb@

6 years agoImplement "mach dtb <filename.dtb>" in efiboot(8). This way we can
patrick [Sun, 19 Aug 2018 14:09:41 +0000 (14:09 +0000)]
Implement "mach dtb <filename.dtb>" in efiboot(8).  This way we can
provide our own FDT if the BIOS doesn't supply one, or even override
the supplied one.

Idea from and ok kettenis@

6 years agoCall daemon with 0 as first argument so that it changes the cwd to /.
florian [Sun, 19 Aug 2018 12:31:41 +0000 (12:31 +0000)]
Call daemon with 0 as first argument so that it changes the cwd to /.
It is not a problem in slowcgi since it calls chroot(2) and then
chdir(2) shortly afterwards but hopefully prevents copying code into
daemons where it does matter.
Problem first observed by dlg in ntpd(8) which keeps sitting in the
directory from where it was started which might for example prevent an
unmount.
Discussed with deraadt@

6 years agoCall daemon with 0 as first argument so that it changes the cwd to /
florian [Sun, 19 Aug 2018 12:29:03 +0000 (12:29 +0000)]
Call daemon with 0 as first argument so that it changes the cwd to /
otherwise the main process will keep sitting in the directory from
where slaacd was started which might for example prevent an unmount.
Problem first observed by dlg in ntpd(8).
Discussed with deraadt@

6 years agoregen
anton [Sun, 19 Aug 2018 11:51:04 +0000 (11:51 +0000)]
regen

6 years agosync
anton [Sun, 19 Aug 2018 11:48:28 +0000 (11:48 +0000)]
sync

6 years agoAdd kcov(4), a kernel code coverage tracing driver. It's used in conjunction
anton [Sun, 19 Aug 2018 11:42:33 +0000 (11:42 +0000)]
Add kcov(4), a kernel code coverage tracing driver. It's used in conjunction
with the syzkaller kernel fuzzer. So far, 8 distinct panics have been found and
fixed. This effort will continue.

kcov is limited to architectures using Clang as their default compiler and is
not enabled by default.

With help from mpi@, thanks!

ok kettenis@ mpi@ visa@

6 years agoAdd support for multiple PCI segments. Only really implemented for arm64
kettenis [Sun, 19 Aug 2018 08:23:47 +0000 (08:23 +0000)]
Add support for multiple PCI segments.  Only really implemented for arm64
for now as amd64/i386 firmware still caters for legacy OSes that only
support a single PCI segment.

ok patrick@

6 years agoRemove a stale/obvious comment.
visa [Sun, 19 Aug 2018 02:22:40 +0000 (02:22 +0000)]
Remove a stale/obvious comment.

OK mpi@

6 years agoBugfix: When a line ends with '\ \"', don't strip the trailing space
schwarze [Sat, 18 Aug 2018 22:04:32 +0000 (22:04 +0000)]
Bugfix: When a line ends with '\ \"', don't strip the trailing space
because that turned it into a bogus line continuation.

6 years agosupport the highly surprising escape sequence \# (line continuation
schwarze [Sat, 18 Aug 2018 21:36:53 +0000 (21:36 +0000)]
support the highly surprising escape sequence \# (line continuation
with comment); used for example by gropdf(1)

6 years agoparagraphs can contain .MT and .UR blocks
schwarze [Sat, 18 Aug 2018 20:41:50 +0000 (20:41 +0000)]
paragraphs can contain .MT and .UR blocks

6 years agoIf a tbl(7) column contains both text cells and numeric cells,
schwarze [Sat, 18 Aug 2018 20:17:58 +0000 (20:17 +0000)]
If a tbl(7) column contains both text cells and numeric cells,
horizontally align the numbers in the same way as groff does.

6 years agoSESSION_UNATTACHED flag is no longer necessary now we have an attached
nicm [Sat, 18 Aug 2018 20:08:52 +0000 (20:08 +0000)]
SESSION_UNATTACHED flag is no longer necessary now we have an attached
count instead.

6 years ago.RE causes a line break even if .RS is not open
schwarze [Sat, 18 Aug 2018 17:32:06 +0000 (17:32 +0000)]
.RE causes a line break even if .RS is not open

6 years ago.SY causes a one-column indentation even without any argument
schwarze [Sat, 18 Aug 2018 17:06:58 +0000 (17:06 +0000)]
.SY causes a one-column indentation even without any argument

6 years agoDon't mention using poll(2) as a timeout.
cheloha [Sat, 18 Aug 2018 16:55:30 +0000 (16:55 +0000)]
Don't mention using poll(2) as a timeout.

Not a strictly portable use of the interface and there are more suitable
interfaces for timeouts anyway.

ok schwarze millert

6 years agoPlug SSL object leaks in doConnection().
cheloha [Sat, 18 Aug 2018 16:51:33 +0000 (16:51 +0000)]
Plug SSL object leaks in doConnection().

Move SSL_new/SSL_free up into benchmark() to restrict the responsibility
for the SSL object to a single scope.  Make doConnection() return an int,
openssl-style.  Some miscellaneous cleanup, too.

Discussed with tb, jsing, and jca.  Basic idea from jsing, lots of patch
input from tb.

ok deraadt on an earlier version

ok tb jsing

6 years agoDo not allocate a column for decimal points if all numbers are integers.
schwarze [Sat, 18 Aug 2018 16:44:52 +0000 (16:44 +0000)]
Do not allocate a column for decimal points if all numbers are integers.

6 years agoSome tidying and helper functions.
nicm [Sat, 18 Aug 2018 16:14:03 +0000 (16:14 +0000)]
Some tidying and helper functions.

6 years agoAdd support for flushing the instruction cache of other processes. This is
kettenis [Sat, 18 Aug 2018 15:42:19 +0000 (15:42 +0000)]
Add support for flushing the instruction cache of other processes.  This is
needed for inserting and removing breakpoints through ptrace(2).

The approach here only works for CPUs that have a PIPT instruction cache
as we use aliased mappings to invalidate the instruction cache.  That doesn't
work on CPUs that have a virtually indexed instruction cache.

ok deraadt@, visa@

6 years agoAfter calling getaddrinfo(3) both on rfc868 and ntp cases we can drop the "dns"
mestre [Sat, 18 Aug 2018 15:25:20 +0000 (15:25 +0000)]
After calling getaddrinfo(3) both on rfc868 and ntp cases we can drop the "dns"
promise and only pledge("stdio inet") since from here until the end of the
program we will only exchange packets through sockets.

After a discussion with deraadt@ about adding privdrop to it we came to the
conclusion that the easiest and sane solution is just to reduce pledge(2)
instead of adding a ton of code to chroot the child that is already forbidden
to access the filesystem anyway.

6 years agoUnsurprisingly, zero-width non-breaking spaces have... width 0.
schwarze [Sat, 18 Aug 2018 15:16:05 +0000 (15:16 +0000)]
Unsurprisingly, zero-width non-breaking spaces have...  width 0.

6 years agoend of sentence detection after .ME and .UE, useful for some GNU manuals
schwarze [Sat, 18 Aug 2018 15:12:09 +0000 (15:12 +0000)]
end of sentence detection after .ME and .UE, useful for some GNU manuals

6 years agoThe .nf/.fi (fill mode) requests never have text children
schwarze [Sat, 18 Aug 2018 14:25:55 +0000 (14:25 +0000)]
The .nf/.fi (fill mode) requests never have text children
and in particular do not reset font mode.

6 years agoTwo consecutive .SY blocks only get a blank line in between
schwarze [Sat, 18 Aug 2018 14:02:52 +0000 (14:02 +0000)]
Two consecutive .SY blocks only get a blank line in between
if the first one is explicitly closed with .YS.

6 years agoprevent line breaks in the middle of .OP
schwarze [Sat, 18 Aug 2018 13:04:48 +0000 (13:04 +0000)]
prevent line breaks in the middle of .OP

6 years agoMake sure we don't match (and attach) more than the maximum number of
kettenis [Sat, 18 Aug 2018 11:34:08 +0000 (11:34 +0000)]
Make sure we don't match (and attach) more than the maximum number of
supported CPUs.

ok deraadt@, patrick@, visa@

6 years agoSupport arbitrary number of redistributors.
kettenis [Sat, 18 Aug 2018 10:10:19 +0000 (10:10 +0000)]
Support arbitrary number of redistributors.
Inspired by an earlier diff from drahn@

ok patrick@, jsg@

6 years agoMassively reduce the amount of text, cutting it down to what is needed
schwarze [Sat, 18 Aug 2018 04:32:04 +0000 (04:32 +0000)]
Massively reduce the amount of text, cutting it down to what is needed
to understand existing man(7) code and deleting parts that would only
be useful for writing new documents, which we strongly discourage:

* Delete the MANUAL STRUCTURE section which merely duplicates mdoc(7).
* Delete internal cross references only useful for writing new code.
* Delete many instances of "included only for compatibility" as the
  whole language is only provided for compatibility.
* Fix a few minor errors and omissions.

6 years agoimplement the GNU man-ext .SY/.YS (synopsis block) macro in man,
schwarze [Sat, 18 Aug 2018 02:03:41 +0000 (02:03 +0000)]
implement the GNU man-ext .SY/.YS (synopsis block) macro in man,
used in most manual pages of the groff package

6 years agoThe official name for the ssdfb(4) reset GPIO attribute uses plural form.
patrick [Fri, 17 Aug 2018 21:00:17 +0000 (21:00 +0000)]
The official name for the ssdfb(4) reset GPIO attribute uses plural form.

6 years agoRemove more pointer arithmetic passing via regions outside the array
schwarze [Fri, 17 Aug 2018 20:31:52 +0000 (20:31 +0000)]
Remove more pointer arithmetic passing via regions outside the array
that is undefined according to the C standard.  Robert Elz <kre at
munnari dot oz dot au> pointed out i wasn't quite done yet.

6 years agoConvert ssl3_send_client_verify() to CBB.
jsing [Fri, 17 Aug 2018 16:28:21 +0000 (16:28 +0000)]
Convert ssl3_send_client_verify() to CBB.

ok inoguchi@ tb@

6 years agospelling;
jmc [Fri, 17 Aug 2018 14:33:29 +0000 (14:33 +0000)]
spelling;

6 years agoSupport reading and using serveral device tree attributes for ssdfb(4),
patrick [Fri, 17 Aug 2018 14:20:15 +0000 (14:20 +0000)]
Support reading and using serveral device tree attributes for ssdfb(4),
since some OLED display controller settings can change depending on the
actual hardware integration.

6 years agoMake the wording more concise, use the imperative throughout, state
schwarze [Fri, 17 Aug 2018 14:03:10 +0000 (14:03 +0000)]
Make the wording more concise, use the imperative throughout, state
more precisely which options require which other options, add many
missing incompatibilities, mention the default for -e, and some
macro cleanup.
OK jmc@ tb@

6 years agoNo need to send the same nameserver twice.
martijn [Fri, 17 Aug 2018 07:12:28 +0000 (07:12 +0000)]
No need to send the same nameserver twice.

OK ccardenas@

6 years agothe stack already counts bytes and packets, so don't do it again here.
dlg [Fri, 17 Aug 2018 01:53:31 +0000 (01:53 +0000)]
the stack already counts bytes and packets, so don't do it again here.

makes output stats look plausible.

reported by jason tubnor
ok deraadt@

6 years agoimplement the GNU man-ext .TQ macro in man(7),
schwarze [Thu, 16 Aug 2018 23:40:19 +0000 (23:40 +0000)]
implement the GNU man-ext .TQ macro in man(7),
used for example by groff_diff(7)

6 years agoAdd regress coverage for CBB_add_u32().
jsing [Thu, 16 Aug 2018 18:40:19 +0000 (18:40 +0000)]
Add regress coverage for CBB_add_u32().

6 years agoProvide CBB_add_u32(), as needed for an upcoming conversion.
jsing [Thu, 16 Aug 2018 18:39:37 +0000 (18:39 +0000)]
Provide CBB_add_u32(), as needed for an upcoming conversion.

ok tb@

6 years agoSimplify the add signature code/logic in ssl3_send_server_key_exchange().
jsing [Thu, 16 Aug 2018 18:13:15 +0000 (18:13 +0000)]
Simplify the add signature code/logic in ssl3_send_server_key_exchange().

ok tb@

6 years agoSwitch nsd control socket from localhost to a unix domain socket.
florian [Thu, 16 Aug 2018 17:59:12 +0000 (17:59 +0000)]
Switch nsd control socket from localhost to a unix domain socket.
OK sthen

6 years agoupdate to 4.1.24
florian [Thu, 16 Aug 2018 17:56:18 +0000 (17:56 +0000)]
update to 4.1.24
OK sthen

6 years agoConvert ssl3_send_server_key_exchange() to CBB.
jsing [Thu, 16 Aug 2018 17:49:48 +0000 (17:49 +0000)]
Convert ssl3_send_server_key_exchange() to CBB.

ok inoguchi@ tb@

6 years agoWhen installing the link to rcs2log, set the owner on the link itself
millert [Thu, 16 Aug 2018 17:45:28 +0000 (17:45 +0000)]
When installing the link to rcs2log, set the owner on the link itself
and not the file it points to.  OK deraadt@ tb@

6 years agoThe zoneinfo directories can be mode 755 just like everything else.
millert [Thu, 16 Aug 2018 17:40:54 +0000 (17:40 +0000)]
The zoneinfo directories can be mode 755 just like everything else.
OK deraadt@

6 years agoConvert ssl3_get_server_key_exchange() to CBS.
jsing [Thu, 16 Aug 2018 17:39:50 +0000 (17:39 +0000)]
Convert ssl3_get_server_key_exchange() to CBS.

ok inoguchi@ tb@

6 years agoRevert previous, which was wrong as noted by schwarze. Also revert a hunk
tb [Thu, 16 Aug 2018 16:56:51 +0000 (16:56 +0000)]
Revert previous, which was wrong as noted by schwarze. Also revert a hunk
from r1.45 and thereby avoid a use-after-free spotted by schwarze.

ok schwarze

6 years agoMake pmap_allocate_asid() mpsafe. Since between checking the ASID
patrick [Thu, 16 Aug 2018 15:36:04 +0000 (15:36 +0000)]
Make pmap_allocate_asid() mpsafe.  Since between checking the ASID
table and setting the bits atomically another core can select the
same ASID as we did it currently would not be safe to run it without
the kernel lock.  This replaces the atomic_setbits_int(9) call with
atomic_cas_uint(9) where we can check that the table entry has not
been changed since we evaluted it.  Also modify pmap_free_asid() to
use the same concept.

ok kettenis@

6 years agoDo not calculate a pointer to a memory location before the beginning of
schwarze [Thu, 16 Aug 2018 15:04:45 +0000 (15:04 +0000)]
Do not calculate a pointer to a memory location before the beginning of
a static array.  Christos Zoulas, Robert Elz, and Andreas Gustafsson
point out that is undefined behaviour by the C standard even if we
never access the pointer.

6 years agoAdd the KEYC_XTERM flag to all function keys that imply a modifier so
nicm [Thu, 16 Aug 2018 14:04:03 +0000 (14:04 +0000)]
Add the KEYC_XTERM flag to all function keys that imply a modifier so
that they are correctly translated into xterm(1)-style keys. GitHub
issue 1437.

6 years agoDocument \*(.T.
schwarze [Thu, 16 Aug 2018 14:01:35 +0000 (14:01 +0000)]
Document \*(.T.
While here, delete the section about predefined strings.
For manual pages, the concept is not important enough to be discussed
in such a prominent place, and some aspects of the text were also
misleading.  Add a shorter version of the relevant parts to the
description of the \* escape sequence instead.

6 years agoImplement the \*(.T predefined string (interpolate device name)
schwarze [Thu, 16 Aug 2018 13:49:40 +0000 (13:49 +0000)]
Implement the \*(.T predefined string (interpolate device name)
by allowing the preprocessor to pass it through to the formatters.
Used for example by the groff_char(7) manual page.

6 years agoRemove unused variable.
rob [Thu, 16 Aug 2018 10:26:34 +0000 (10:26 +0000)]
Remove unused variable.

From Nan at chinadtrace dot org. Thanks!

6 years agoTurns out the integration of the GIC-500 on the Rockchip RK3399 is busted.
kettenis [Wed, 15 Aug 2018 21:46:29 +0000 (21:46 +0000)]
Turns out the integration of the GIC-500 on the Rockchip RK3399 is busted.
It treats all access to the memory mapped registers as "secure" even if
we're running in non-secure mode.  As a result, during bringup of OpenBSD
on the RK3399, I got confused and tweaked the interrupt priorities in a way
that is wrong (but worked on the RK3399.

Fix those priorities to match what they should be according to the
documentation (and works on other hardware that includes a GICv3) and
add code that detects the broken RK3399 GIC and adjusts the priorities
accordingly.  Also remove (broken) code that tries to mess around with
group 0 interrupts and fix setting bits in the GICD_CTLR register on the
broken RK3399 GIC.

6 years agoDistinguish between softc array members that are indexed by redistributor
kettenis [Wed, 15 Aug 2018 20:27:56 +0000 (20:27 +0000)]
Distinguish between softc array members that are indexed by redistributor
and those that are indexed by the assigned CPU (unit) number.  Fix the
shuffling of the affinity fields are shuffled around to match the spec.

6 years agoPush back the kernel lock in sys_mmap(2) a little bit more now that
kettenis [Wed, 15 Aug 2018 20:22:13 +0000 (20:22 +0000)]
Push back the kernel lock in sys_mmap(2) a little bit more now that
fd_getfile(9) is mpsafe.  Note that sys_mmap(2) isn't actually unlocked
currently.  However this diff has been tested with it unlocked, and I
hope to unlock it for real soon-ish.

ok visa@, mpi@

6 years agoUse atomic instructions to keep track of what ASIDs are in use. This makes
kettenis [Wed, 15 Aug 2018 20:18:31 +0000 (20:18 +0000)]
Use atomic instructions to keep track of what ASIDs are in use.  This makes
pmap_free_asid() and therefore pmap_destroy() mpsafe which is important since
we might end up calling that function without holding the kernel lock
as a result of releasing a reference in pmap_page_protect(9).

ok visa@

6 years agoAdd /usr/include/c++ to hier.7.
fcambus [Wed, 15 Aug 2018 19:40:30 +0000 (19:40 +0000)]
Add /usr/include/c++ to hier.7.

OK jmc@

6 years agoRemove dead assignment in login(1).
fcambus [Wed, 15 Aug 2018 19:38:47 +0000 (19:38 +0000)]
Remove dead assignment in login(1).

Since rev 1.36, the instance variable is never read again so we can
simply drop the else clause with the assignment.

While there, also drop the useless increment, as pointed out by tom@.

OK deraadt@ (previous version), millert@, tom@

6 years agoUpdate AP selection heuristics for auto-join.
stsp [Wed, 15 Aug 2018 18:45:43 +0000 (18:45 +0000)]
Update AP selection heuristics for auto-join.

We now prefer stronger crypto over weaker crypto over none, prefer 5 GHz
band with reasonable RSSI, and use RSSI as a tie-breaker with a slight
advantage for 5GHz. Candidate APs are now ranked by a score which is
calculated based on these attributes.

There is likely room for improvements to make these heuristics
work well across many different environments, but it's a start.

ok phessler@

6 years agoSIOCGIFNETMASK_IN6 failing just means that someone delete the address
florian [Wed, 15 Aug 2018 16:48:20 +0000 (16:48 +0000)]
SIOCGIFNETMASK_IN6 failing just means that someone delete the address
we are currently looking at. No need to fatal.
Found the hard way by naddy

6 years agofix incomplete variable renaming in previous;
schwarze [Wed, 15 Aug 2018 15:36:11 +0000 (15:36 +0000)]
fix incomplete variable renaming in previous;
found by Thomas Klausner <wiz at NetBSD> via a compiler warning

6 years agoRestore ability to use hostnames to configure ip addresses.
florian [Wed, 15 Aug 2018 14:43:30 +0000 (14:43 +0000)]
Restore ability to use hostnames to configure ip addresses.
Unveil /etc/{resolv.conf,hosts,services} which keeps it in sync with
the kernel bypass for pledge("dns").
OK deraadt
pointed out by & OK stsp

6 years agoPartially revert previous, EM7455 is already handled by umb(4).
mpi [Wed, 15 Aug 2018 14:13:07 +0000 (14:13 +0000)]
Partially revert previous, EM7455 is already handled by umb(4).

Reported by Bryan Vyhmeister.

6 years agoGrab the KERNEL_LOCK() in MP-unsafe fo_close routines. This prevents
visa [Wed, 15 Aug 2018 13:19:06 +0000 (13:19 +0000)]
Grab the KERNEL_LOCK() in MP-unsafe fo_close routines. This prevents
a scenario where MP-unsafe code gets run without the kernel lock
as a consequence of an unlocked system call.

OK mpi@, kettenis@

6 years agoFix struct soplice usage
kn [Wed, 15 Aug 2018 12:10:49 +0000 (12:10 +0000)]
Fix struct soplice usage

sys/sys/socketvar.h r1.57 (2014) moved various struct socket fields into
a new struct sosplice field, this adapts usage accordingly.

OK bluhm

6 years agoIntroduce mue_eeprom_present to check if the EEPROM is present.
kevlo [Wed, 15 Aug 2018 07:13:51 +0000 (07:13 +0000)]
Introduce mue_eeprom_present to check if the EEPROM is present.
When the EEPROM is not populated, set the MAC config register
MUE_MAC_CR_AUTO_SPEED.  While there, encode the MAC address for the onboard
USB Ethernet for the Rasperry Pi, like smsc(4) does.

6 years agosync machine list with arm64.html
jsg [Wed, 15 Aug 2018 06:31:58 +0000 (06:31 +0000)]
sync machine list with arm64.html

6 years agoadd cpuid and msr bits from
jsg [Wed, 15 Aug 2018 02:07:35 +0000 (02:07 +0000)]
add cpuid and msr bits from
'Deep Dive: CPUID Enumeration and Architectural MSRs'
ok deraadt@

6 years agounveil(2) /etc/nologin.txt for reading
cheloha [Tue, 14 Aug 2018 18:13:11 +0000 (18:13 +0000)]
unveil(2) /etc/nologin.txt for reading

ok deraadt

6 years agoImprove consistency of the substitution command further.
schwarze [Tue, 14 Aug 2018 18:10:09 +0000 (18:10 +0000)]
Improve consistency of the substitution command further.

When the opening square bracket ('[') is abused as the delimiter, the regular
expression contains a bracket expression, and the bracket expression contains
another opening square bracket (sick! - i mean, sic!), then do not require
escaping that innermost bracket and treat a preceding backslash as a literal
backslash character, in accordance with POSIX:

   $ printf 'x[x\\x\n' | sed 's[\[[][R[g'
  xRx\x
   $ printf 'x[x\\x\n' | sed 's[\[\[][R[g'
  xRxRx

While here, also make the implementation more readable and insert
some comments.

Joint work with martijn@ (started during g2k18) and OK martijn@.

6 years agoAdd a comment that explains what the check is doing and why len >= 1.
tb [Tue, 14 Aug 2018 17:59:26 +0000 (17:59 +0000)]
Add a comment that explains what the check is doing and why len >= 1.

Prompted by a remark by jsing

6 years agoThe UI_add_{input,verify}_string() functions want a length not including
tb [Tue, 14 Aug 2018 17:51:36 +0000 (17:51 +0000)]
The UI_add_{input,verify}_string() functions want a length not including
the terminating NUL. EVP_read_pw_string_min() got this wrong, leading to
a one-byte buffer overrun in all callers of EVP_read_pw_string().

Found by mestre running 'openssl passwd' with MALLOC_OPTIONS including C.

Fix this by doing some basic sanity checking in EVP_read_pw_string_min().
Cap the len argument at BUFSIZ and ensure that min < len as well as
0 <= min and 1 <= len.  The last two checks are important as these
numbers may end up in reallocarray().

ok bcook (on previous version), jsing, mestre

6 years agospelling error
deraadt [Tue, 14 Aug 2018 16:43:02 +0000 (16:43 +0000)]
spelling error

6 years agoRemove now unused variable, that got left behind from a previous change.
jsing [Tue, 14 Aug 2018 16:31:02 +0000 (16:31 +0000)]
Remove now unused variable, that got left behind from a previous change.

6 years agoActually check the return values for EVP_Sign* and EVP_Verify*.
jsing [Tue, 14 Aug 2018 16:19:06 +0000 (16:19 +0000)]
Actually check the return values for EVP_Sign* and EVP_Verify*.

ok bcook@ beck@ tb@

6 years agoDon't fail by default in the -new case; ok tb jca
cheloha [Tue, 14 Aug 2018 15:25:04 +0000 (15:25 +0000)]
Don't fail by default in the -new case; ok tb jca

6 years agoAdd size to arguments struct too.
nicm [Tue, 14 Aug 2018 11:38:05 +0000 (11:38 +0000)]
Add size to arguments struct too.

6 years agoSome tidying, use a struct for arguments (there will be more later) and
nicm [Tue, 14 Aug 2018 11:31:34 +0000 (11:31 +0000)]
Some tidying, use a struct for arguments (there will be more later) and
add a helper function.

6 years agoDrop unnecessary pledge(2) promises on apm(8):
mestre [Tue, 14 Aug 2018 06:38:33 +0000 (06:38 +0000)]
Drop unnecessary pledge(2) promises on apm(8):

After we successfully connect to the unix socket created by apmd(8) all actions
occur over fds so we can drop only to pledge("stdio").

The code path in the case that the required action is GETSTATUS, and we couldn't
connect to the socket, then after open(2)/ioctl(2) the device /dev/apm directly
we can pledge("stdio") as well since from here on down we only need to
printf(3) messages.

OK deraadt@

6 years agoreturn ENOTTY rather than EINVAL to indicate an ioctl hasn't been handled
jmatthew [Tue, 14 Aug 2018 05:22:21 +0000 (05:22 +0000)]
return ENOTTY rather than EINVAL to indicate an ioctl hasn't been handled

ok dlg@ deraadt@ kettenis@

6 years agosupport tail arguments on the .ME and .UE macros,
schwarze [Tue, 14 Aug 2018 01:26:12 +0000 (01:26 +0000)]
support tail arguments on the .ME and .UE macros,
used for example in the ditroff(7) manual of the groff package

6 years agodocument new namei flags
deraadt [Mon, 13 Aug 2018 23:13:02 +0000 (23:13 +0000)]
document new namei flags

6 years agoInstead of using BYPASSUNVEIL at NDINIT time, use KERNELPATH to indicate
deraadt [Mon, 13 Aug 2018 23:12:39 +0000 (23:12 +0000)]
Instead of using BYPASSUNVEIL at NDINIT time, use KERNELPATH to indicate
we want to skip all userland-related checks.  Discussed with beck and
semarie, tested by stsp.

6 years agoMore clear version of previous namei/pledge/chroot solution. namei flag
deraadt [Mon, 13 Aug 2018 23:11:44 +0000 (23:11 +0000)]
More clear version of previous namei/pledge/chroot solution.  namei flag
KERNELPATH indicates this operation is being done on behalf of the kernel,
not a process, so ignore chroot of the current process context, start at /,
and skip unveil and pledge checks.  Discussed with beck and semarie

6 years agoin sys_statfs(), BYPASSUNVEIL can be passed to NDINIT in the "flags"
deraadt [Mon, 13 Aug 2018 20:36:35 +0000 (20:36 +0000)]
in sys_statfs(), BYPASSUNVEIL can be passed to NDINIT in the "flags"
argument, rather than manually |= afterwards.  Observed by semarie

6 years agoThe first panic in pledge_namei should only be for ni_pledge == 0
deraadt [Mon, 13 Aug 2018 20:31:38 +0000 (20:31 +0000)]
The first panic in pledge_namei should only be for ni_pledge == 0
(the other cause is implausible, and crashes with a nice *NULL)

6 years agoMake the owner of fcgi socket configurable.
florian [Mon, 13 Aug 2018 16:54:50 +0000 (16:54 +0000)]
Make the owner of fcgi socket configurable.

Andrew Daugherity (andrew.daugherity AT gmail) pointed out that this
is helpful for his port to linux. For example on openSUSE nginx and
Apache run as different users so a compile time default user won't cut
it.
Man page tweaks jmc@

While here, consistently log users at debug level; from Andrew.

6 years agobasic macro cleanup, break lines of excessive length, fix order of sections
schwarze [Mon, 13 Aug 2018 16:37:56 +0000 (16:37 +0000)]
basic macro cleanup, break lines of excessive length, fix order of sections

6 years agoSimplify the startup of the cleaner, reaper and update threads by
visa [Mon, 13 Aug 2018 15:26:17 +0000 (15:26 +0000)]
Simplify the startup of the cleaner, reaper and update threads by
passing the main function directly to kthread_create(9). The start_*
functions are mere stepping stones nowadays and can be pruned.
They used to contain more logic in the pre-kthread era.

While here, set `cleanerproc' and `syncerproc' during the thread
creation rather than expect the threads to set the proc pointer.
Also, rename `sched_sync' to `syncer_thread' to reduce confusion
with the scheduler-related functions.

OK kettenis@, deraadt@, mpi@

6 years agoAdd more content. Tweaks from ingo. This man page is not yet hooked up to the
rob [Mon, 13 Aug 2018 15:22:39 +0000 (15:22 +0000)]
Add more content. Tweaks from ingo. This man page is not yet hooked up to the
build and is still a work in progress. Tweaks and comments welcome.

6 years agoAdd support for band-steering access points to net80211.
stsp [Mon, 13 Aug 2018 15:19:52 +0000 (15:19 +0000)]
Add support for band-steering access points to net80211.

Some access points have a feature called "band steering" where they
will try to push clients from 2 GHz channels to 5 GHz channels.
If a client sends probe-requests on both 2 GHz and 5GHz channels, and
then attempts to authenticate on a 2 GHz channel, such APs will deny
authentication and hope that the client will come back on a 5 GHz channel.

So if we fail to AUTH for any reason, and if there is a different
AP with the same ESSID that we haven't tried yet, try that AP next.
Keep trying until no APs are left, and only then continue scanning.

APs with support for this feature were provided by Mischa Peters.

ok phessler@ mpi@