Commit Graph

266079 Commits

Author SHA1 Message Date
maya 07425de535 Correct copy-paste error. From joerg, thanks. 2019-03-12 02:07:14 +00:00
kre 686a5c874c This had a similar problem to that reported in PR lib/54053
for the userland (libc) version of humanize_number(),
except in a much more limited, and less harmful, way ...

If the value to be printed was > ~0/10 (eg ~0 itself) and
the buffer given was big enough to hold it, "umax" would overflow,
and the expected result was not produced (here at least the effect was
simply to scale the result for huge values by one unnecessary step,
rather than maximally scale all values usually generating 0E, but
incorrect nonetheless.)
2019-03-12 00:25:44 +00:00
maxv 35465bdaf6 Add sanity check: make sure we retrieve a valid item header, by checking
its page address against the one we computed. If there's a mismatch it
means the buffer does not belong to the pool, and we panic.
2019-03-11 20:38:27 +00:00
maxv 74d3d7bc94 Rename pr_item_notouch_* to pr_item_bitmap_*, and move some code into new
pr_item_linkedlist_* functions. This makes it easier to see that we have
two ways of handling freed items.

No functional change.
2019-03-11 20:21:32 +00:00
christos 643c7056b9 Add an initializatin that is not needed when the optimizer works... 2019-03-11 18:06:28 +00:00
christos 3cae15996b Reduce diffs with upstream and enable the built-in database code. 2019-03-11 17:59:28 +00:00
kamil 6167c1c8b0 Register ./usr/X11R7/lib/libvdpau_g.a in md.amd64 sets
This unbreaks the build.
2019-03-11 17:50:19 +00:00
kre 03996e069a Explicitly test for PR lib/54053
A suitable test was actually there already - but the results
were not verified.   So just add a test that the result string
is what is expected.  (Previously for len==128 and bytes==10000
it would  have returned "0E" now it returns 10000 as it should.)
2019-03-11 17:45:12 +00:00
kre df01b8ae2e PR lib/54053
When auto scaling, and the buffer is bigger than big enough
for the biggest possible number, don't try and calculate
the max value that will fit in the buffer - that calc
will overflow (guaranteed) and is useless, the value
we're formatting cannot possibly be bigger.  So simply
use the unscaled value (the raw number).

While here, also avoid returning values that are larger
than the buffer len ... while it would be nice to be able
to find out how big the buffer should be so the data will
fit, the interface doesn't really allow that (the buffer
length passed in controls the scaling - at least when
auto scaling) and the code already does "return -1" when
it detects the buffer length is too small, even before
it works out how much would have been needed.  So, rather
than returning a value > len (while truncating the result
to fit in len ... all courtesy of snprintf()) return -1
in this case as well.

Also, allow suffix==NULL (meaning "") - there's no reason
not to, and requiring users to pass in an explicit "" is
not useful.
2019-03-11 15:10:51 +00:00
kardel 40a95aca3d PR/54045
fix mpii to adhere to physio diagnostic invariant that
fully processed data must not post an error:
1) verify expected scspi state via KASSERT() instead of just
   setting the variables.
2) set xs->resid only in known good conditions
3) insure setting errors in all error paths and refrain
   from clearing xs->resid in error paths.

While there do some cosmectic clean up:
1) extend and relocate some debug output
2) mpii HBAs can also manage non-disk devices like tapes etc,
   so log that physical "devices" instead of physical "disks" are
   attached or detached.

Tested with NEOSeries FlexStor II and luckily a broken tape drive 8-(

mpii0 at pci1 dev 0 function 0: vendor 1000 product 00ab (rev. 0x01)
mpii0: interrupting at irq 11
mpii0: HBA 9400-8i8e, firmware 3.0.4.0, MPI 2.6
mpii0: physical device inserted in slot 9
mpii0: physical device inserted in slot 13
mpii0: physical device inserted in slot 16
st0 at scsibus0 target 9 lun 0: <IBM, ULTRIUM-HH7, J4D1> tape removable
st0: density code 92, variable blocks, write-enabled
ch0 at scsibus0 target 9 lun 1: <BDT, FlexStor II, 5.50> changer removable
ch0: 23 slots, 2 drives, 1 picker, 1 portal
st0: tagged queueing
ch0: tagged queueing
st1 at scsibus0 target 13 lun 0: <IBM, ULTRIUM-HH7, J4D1> tape removable
st1: density code 92, variable blocks, write-enabled
st1: tagged queueing
ses0 at scsibus0 target 16 lun 0: <LSI, VirtualSES, 01> enclosure services fixed

Note: pullup-8
2019-03-11 14:35:22 +00:00
mrg d8f51e97eb install transset. 2019-03-11 09:20:13 +00:00
mrg 0b5c7c926a fix path to khrplatform.h 2019-03-11 08:05:18 +00:00
mrg 45a98ae559 fix a bunch of man page transforms.
XXX X11MANCPP=yes has only one use left, maybe it can go away!
2019-03-11 06:25:55 +00:00
nakayama f4cc5cb728 Install new files also to etc/fonts/conf.avail. 2019-03-11 05:05:31 +00:00
christos d90f6d4d22 add __dead for clang. 2019-03-11 03:56:30 +00:00
ozaki-r 7497b1f182 Add missing ifa_release on error paths 2019-03-11 03:00:41 +00:00
mrg e50995f1ef handle @PKG_EXPAT_LIBS@ and @PKG_EXPAT_CFLAGS@. 2019-03-11 01:40:05 +00:00
christos 7f6ee53058 remove unneeded header. 2019-03-11 00:31:36 +00:00
christos 2e38032ba2 new mdocml 2019-03-11 00:17:16 +00:00
christos 6167eca2d0 resolve conflicts 2019-03-11 00:15:38 +00:00
christos 059d37ece9 adjust to the new mandoc api 2019-03-11 00:14:44 +00:00
kamil b8c8c51cf8 Introduce enhancements to the kcov(4) code
Add new tests verifying dup2(2) scenarios:
 - kcov_dup2
 - kcov_basic_dup2_pc
 - kcov_basic_dup2_cmp

The dup2(2) trick is used by syzkaller and assert that it works.
All new tests pass.

While there add minor non-functional cleanup changes.
2019-03-10 22:34:14 +00:00
christos 544c191c34 Changes in version 1.14.5, released on March 10, 2019
--- MAJOR NEW FEATURES ---
 * apropos(1): improve POSIX compliance by accepting case-insensitive
   extended regular expressions by default
 * new -O tag[=term] output option (open a page at the definition of a term)
 * tbl(7) -T html: spanning and horizontal and vertical alignment of cells
 * tbl(7) -T html: draw lines on the edges of table cells
 * tbl(7) -T utf8: render lines with the Unicode box drawing characters
 * mandoc is now able to handle the manual pages of the groff package.
    --- MINOR NEW FEATURES ---
 * -T html: new option -O toc (table of contents)
 * -T html: second argument to -O man to support local and remote links
 * mdoc(7) .Bd -centered now fills the text contained in it
 * man-ext .SY and .YS macros (synopsis block)
 * man-ext .TQ macro (tagged paragraph without vertical space before it)
 * tbl(7) \& explicit alignment indicator
 * roff(7) .shift, .while, and .return requests
 * roff(7) .char request (output glyph definition)
 * roff(7) .nop request (no operation)
 * roff(7) .ft request: handle the CB, CI, and CR fonts
 * roff(7) .if c conditional (character available)
 * roff(7) \\$@ escape sequence (insert all macro arguments, quoted)
 * roff(7) \*(.T predefined string (interpolate output device name)
 * roff(7) \[charNNN] escape sequence (for printable ASCII characters)
 * roff(7) \# escape sequence (line continuation with comment)
    --- HTML OUTPUT SYNTAX CORRECTIONS ---
 * Render .br and \p as <br/>, not as an empty <div>.
 * Render .Pp and .PP as <p> and automatically close it when needed.
 * Stop writing empty list elements for non-compact .Bl -tag lists.
 * Do not put <p> inside <a> if .UR or .MT contain .PP.
 * Implement tooltips purely in CSS rather than abusing title= attributes.
    --- MINOR FUNCTIONAL IMPROVEMENTS ---
 * many improvements to the handling of fill and no-fill mode
 * tbl(7): better column widths in the presence of horizontal spans
 * several minor improvements to escape sequence handling
 * several minor improvements to manual font handling
 * portability: autodetect need for _GNU_SOURCE or _OPENBSD_SOURCE
 * portability: autodetect whether less(1) supports the -T option
 * large numbers of bugfixes of diverse kinds
    --- STRUCTURAL IMPROVEMENTS ---
 * Disentangle eqn(7) and tbl(7) from other parser header files,
   and clean up some parser data structures.
 * Substantially simplify error and warning message infrastructure.
    --- THANKS TO ---
 * John Gardner for crucial help implementing tooltips in CSS.
 * Alexander Bluhm, Raphael Graf, Ted Unangst (OpenBSD)
   and Daniel Sabogal (Alpine Linux) for patches.
 * Anthony Bentley and Jason McIntyre (OpenBSD) for documentation patches,
   suggesting new features, bug reports, and useful discussions.
 * Kyle Evans and Baptiste Daroussin (FreeBSD) for minor patches.
 * Pali Rohar for suggesting multiple new features and for reporting
   several bugs and missing features.
 * Klemens Nanni (OpenBSD) for suggesting multiple new features.
 * Kristaps Dzonsons (bsd.lv), Marc Espie (OpenBSD), Adam Kalisz,
   and Laura Morales for suggesting new features.
 * Wolfram Schneider and Yuri Pankov (FreeBSD) for reporting missing features.
 * Edward Tomasz Napierala (FreeBSD) for suggesting a feature improvement.
 * Thomas Klausner (NetBSD) and Sevan Janiyan (SmartOS)
   for bug reports and release testing.
 * Bryan Steele, Janne Johansson, Kurt Mosiejczuk, Mike Belopuhov, Theo
   Buehler, Todd Miller (OpenBSD), Andreas Gustafsson, Christos Zoulas,
   Robert Elz (NetBSD), Kurt Jaeger (FreeBSD), Fabio Scotoni, Kelvin
   Sherlock, Mark Harris, Orestis Ioannou, Raf Czlonka, and Sean Farrell
   for bug reports.
 * Ulrich Spoerlein (FreeBSD), Leah Neukirchen (Void Linux),
   Matej Cepl (openSUSE), and Jan Stary (MacOS X) for release testing.
 * Brian Callahan and Stuart Henderson (OpenBSD) for help
   with the OpenBSD groff port.
 * Bertrand Garrigues, Branden Robinson, Ralph Corderoy, and Werner
   Lemberg (GNU troff) for checking groff patches.
 * Scott Cheloha, Theo de Raadt (OpenBSD)
   and Natanael Copa (Alpine Linux) for useful discussions.
2019-03-10 22:28:56 +00:00
christos c5ac9f1c90 add vdpau to evbarm 2019-03-10 22:00:37 +00:00
christos 24ea0e6557 one more noreturn 2019-03-10 21:52:00 +00:00
kamil 00b9b09886 Register kcov(4) in CHANGES
kcov(4): Added driver for kernel coverage tracing

Register the entry with the current date as the driver has been just
finished.

Primary author of the port: Siddharth Muralee.
Review and major code improvements by <maxv>.
Various contributions by myself.
2019-03-10 21:25:09 +00:00
jmcneill c8d46f13f9 Use syscon instead of bus_space_map 2019-03-10 19:47:03 +00:00
christos 4ebe1e1401 Add noreturn where needed. In the prof case because of cassert() and return
in some functions we disable the cassert() for clang. We should really have
a JEMALLOC_PROF_NORETURN and a way to mark the remaining of the function
unreachable.
2019-03-10 19:34:30 +00:00
christos bd8496e18f Add noreturn for the benefit of clang 2019-03-10 19:32:56 +00:00
christos 6f4fc14722 shorten name, use snprintf 2019-03-10 18:03:40 +00:00
kamil f43e07b7f7 Add support for trace type selection in kcov(4)
Allow to specify mode in KCOV_IOC_ENABLE synchronizing the functionality
with Linux, FreeBSD and OpenBSD. As a NetBSD (and OpenBSD) specific of
the ioctl(2) interface, the mode argument has to be specified as &value
rather than value.

There are 3 modes available:
 1. KCOV_MODE_NONE       -- no trace specified, useful for testing purposes
 2. KCOV_MODE_TRACE_PC   -- trace the kernel program counter
 3. KCOV_MODE_TRACE_CMP  -- trace comparison instructions and switch statements

Adapt the ATF tests and documentation for new API.

The KCOV_MODE_TRACE_CMP mode is implemented but still awaits for the
GCC 8.x upgrade or selection of Clang/LLVM as the kernel compiler.

Obtained from OpenBSD and adapted for NetBSD by myself.
2019-03-10 17:51:00 +00:00
maxv ffd738cfac Two changes:
* Allow large pages to be passed in pmap_pdes_valid, this happens under
   DDB when it reads RIP (.text), called via pmap_extract.

 * Invert a branch in pmap_extract, so that 'l_cpu' is not touched if we're
   dealing with the kernel pmap.

This fixes 'boot -d'.
2019-03-10 16:30:01 +00:00
christos 177af116b1 clang does not have the gnu_printf attribute 2019-03-10 15:45:26 +00:00
christos 0a0bcc4d2a turn on debugging to help find problems. 2019-03-10 15:32:42 +00:00
christos 9610e03031 catch up with name change. 2019-03-10 15:31:02 +00:00
kre b0172d2346 Deal with overflow when the sleep duration given is a simple
integer (previously it was just clamped at the max possible value).
This would have caused
	sleep 10000000000000000000
(or anything bigger) to have only actually slept for 9223372036854775807
secs.   Someone would have noticed that happen, one day, in some other
universe.

This is now an error, as it was previously if this had been entered as
	sleep 1e19

Also detect an attempt to sleep for so long that a time_t will no longer
be able to represent the current time when the sleep is done.

Undo the attempts to work around a broken kernel nanosleep()
implementation (by only ever issuing shortish sleep requests,
and looping).   That code was broken (idiot botch of mine) though
you would have had to wait a month to observe it happen.  I was going
to just fix it, but sanity prevailed, and the kernel got fixed instead.

That allows this to be much simplified, only looping as needed to
handle dealing with SIGINFO.   Switch to using clock_nanosleep()
to implement the delay, as while our nanosleep() uses CLOCK_MONOTONIC
the standards say it should use CLOCK_REALTIME, and if that we
ever changed that, the old way would alter "sleep 5" from
"sleep for 5 seconds" to "sleep until now + 5 secs", which is
subtly different.

Always use %g format to print the original sleep duration in reports of how
much time remains - this works best for both long and short durations.
A couple of other minor (frill) mods to the SIGINFO report message as well.
2019-03-10 15:18:45 +00:00
kre 3f1f0cc730 Fix the code that deals with very long sleeps (> 248 days) which
go beyond the maximum that the callout mechanism can handle.
[See the comments in tvtohz() in subr_sleep.c for the details.]

When that happens the timeout is clamped to MAX_INT (ticks), and the
code in nanosleep1() looped (or tried to) repeating the sleep (aka
kpause()) until the requested end time for the sleep was reached.

Unfortunately, the code assumed that kpause() would return 0 when
it returned after the timeout expired.   But it doesn't, it returns
EWOULDBLOCK instead (why is incomprehensible to me, but I assume
there is a reason.)   [That comes from sleepq_block() which returns
EWOULDBLOCK when callout_halt() indicates that the callout had fired,
which is exactly what has happened when the time has elapsed.]

There was already code to deal with that EWOULDBLOCK and return 0
instead of an error in that case - but it was placed after the
error code was tested against 0 for the purposes of the loop.

Simply move the EWOULDBLOCK->0 mapping earlier, so the code which
is expecting "error == 0" to mean "nothing went wrong" actually
gets to see that happen, and the loop can actually loop.

(Someday the loop should probably be rewritten as a loop, instead of
as a bunch of code followed by a "goto again"!)
2019-03-10 14:45:53 +00:00
mrg 58f8d333d6 only do vdpau headers on vdpau systems.
XXX: make this a common define in the few places
2019-03-10 13:52:11 +00:00
kre dd8f5519fc Undo previous, in the name of "defined" behaviour, it breaks things.
This is all explained in the comment at the head of the file:

 * Some of the "math" in here is a bit tricky.  We have to beware of
 * wrapping ints.
 *
 * [...] but c->c_time can
 * be positive or negative so comparing it with anything is dangerous.

In particular, "if (c->c_time > ticks)" is simply wrong.

 * The only way we can use the c->c_time value in any predictable way is
 * when we calculate how far in the future `to' will timeout - "c->c_time
 * - c->c_cpu->cc_ticks".  The result will always be positive for future
 * timeouts and 0 or negative for due timeouts.

Go back to the old way.   But write the calculation of delta slightly
differently which will hopefully appease KUBsan.   Perhaps.  In any
case, this code works on any system that NetBSD has any hope of ever
running on, whatever the C standards say is "defined" behaviour.
2019-03-10 13:44:49 +00:00
kamil 923f374452 Fix bug in kcov_multiple_threads in t_kcov
Spawn the expected number of threads rather than hardcoding one value for
all tests.
2019-03-10 13:24:50 +00:00
kamil f0a7538d78 Sync TODO.sanitizers with reality
Mark compiler-rt sanitizers as imported into src/, but still not
integrated (waiting for Clang/LLVM upgrade to 8.0 or newer).

ESan has been discontinued upstream, drop from plans.

lld ported to NetBSD by <mgorny>, but we need to keep local patches.

Mark kernel-msan as finished for Linux

Mark syzkaller and KCOV as finished projects.
2019-03-10 12:59:03 +00:00
kamil 869dfc9042 Add support for multiple threads in kcov(4)
Reuse the fd_clone() API to associate kcov descriptors (KD) with a file
descriptor. Each fd (/dev/kcov) can be reused for a single LWP.

Add new ATF regression tests and cleanup existing code there. All tests
pass.

Refresh the kcov(4) man page documentation.

Developed with help from <maxv>.
2019-03-10 12:54:39 +00:00
skrll 3d8954378b Fix two oddities...
- remove extraneous semi-colons from do { } while (0) macro definitions
- actually wrap MUTEX_INITIALIZE_ADAPTIVE contents in do { }

Spotted by kre@
2019-03-10 12:49:48 +00:00
mrg 9f50906983 libvdpau pkg-config file is called vdpau.pc.
this does not need a special rule, just to be named correctly.
2019-03-10 12:44:58 +00:00
mrg 5e9cdbeac0 add most of the AMDGPU target makefiles and stuff that don't
touch the build.  this comes from:

commit f90685c11d4460d3098fa35f48b58d1893e974e0
Author: Maya Rashish <maya@NetBSD.org>
Date:   Sat Feb 23 09:46:14 2019 +0200

    Separate MKCLANG from MKLLVM.

    build LLVM libraries as PIC.
    Add AMDGPU target, and adjust tools accordingly.
2019-03-10 12:14:05 +00:00
wiz 91d1f8236d Update mandoc entry, and note new 1.14.5 release. 2019-03-10 11:53:35 +00:00
mrg f4e2645dc0 - build and install libvdpau and x86 and evbarm.
- add khrplatform.h for mesa_ver=18 platforms.

need to enable libvdpau.pc generation (needs special rules)


this mostly comes from maya in the first one, and a small part
of the second:

commit 48eb746983a5a7967fba221e7b167808af36f44a
Author: Maya Rashish <maya@NetBSD.org>
Date:   Sun Feb 24 09:31:22 2019 +0200

    More of vdpau. Cogs spin.

commit d9fbba8f61a43648d32f160c5fa62626788566ff
Author: Maya Rashish <maya@NetBSD.org>
Date:   Sat Feb 23 22:36:37 2019 +0200

    Adjust for MesaLib 18.

    Build llvmpipe driver on x86 (the driver itself is x86-only).
    build llvm on all x86, even on GCC builds.
    galahad driver removed (upstream).
    Don't build mesa 7 at all.
2019-03-10 11:18:02 +00:00
jmcneill 478d6c3484 Add support for Rockchip eMMC PHY 2019-03-10 11:10:21 +00:00
jmcneill a14204ca85 Add eMMC clocks 2019-03-10 11:09:35 +00:00
mrg 21af34482f convert make's HAVE_MESA_VER into mesa_ver for set lists 2019-03-10 11:04:08 +00:00