Commit Graph

19579 Commits

Author SHA1 Message Date
christos 0b298669b8 delete unused variable 2019-01-10 13:53:58 +00:00
christos 77ae40ee4d PR/53851: Andreas Gustafsson: libwrap prints "m" instead of errno
Handle %m inline if needed, otherwise vasprintf strips the %m and...
2019-01-10 13:53:26 +00:00
maxv 06484a82be Handle REPN. FreeBSD has a "repn movs", which is a bit unusual, but doesn't
seem illegal as far as I can tell from the AMD SDM.

With that, I can boot FreeBSD on Qemu+NVMM.
2019-01-08 07:34:22 +00:00
wiz d8ad10e63e Remove leading zero from date. 2019-01-07 22:17:02 +00:00
maxv 75c7df3cfe Optimize the legpref node: omit BRN (we don't care and it's the same as
OVR_CS), inline the loops, sort the checks from most to least likely
prefix, and use a compact structure.
2019-01-07 18:13:34 +00:00
maxv 04b8bfbf75 Optimize: on single memory operand instructions, take the GPA directly from
the exit structure provided by the kernel. This saves an MMU translation,
and sometimes complex address computation (eg SIB).

Drop the GVA field, it is not useful to virtualizers.
2019-01-07 16:30:25 +00:00
maxv 960d1f7675 Improvements and fixes:
* Decode AND/OR/XOR from Group1.

 * Sign-extend the immediates and displacements in 64bit mode.

 * Fix the storage of {read,write}_guest_memory, now that we batch certain
   IO operations we can copy more than 8 bytes, and shit hits the fan.

 * Remove the CR4_PSE check in the 64bit MMU. This bit is actually ignored
   in long mode, and some systems (like FreeBSD) don't set it.
2019-01-07 13:47:33 +00:00
christos f0d7eb24ef use the pico objects if we are making a PIC profiled library. 2019-01-06 18:14:10 +00:00
maxv 809327425b Improvements and fixes in NVMM.
Kernel driver:

 * Don't take an extra (unneeded) reference to the UAO.

 * Provide npc for HLT. I'm not really happy with it right now, will
   likely be revisited.

 * Add the INT_SHADOW, INT_WINDOW_EXIT and NMI_WINDOW_EXIT states. Provide
   them in the exitstate too.

 * Don't take the TPR into account when processing INTs. The virtualizer
   can do that itself (Qemu already does).

 * Provide a hypervisor signature in CPUID, and hide SVM.

 * Ignore certain MSRs. One special case is MSR_NB_CFG in which we set
   NB_CFG_INITAPICCPUIDLO. Allow reads of MSR_TSC.

 * If the LWP has pending signals or softints, leave, rather than waiting
   for a rescheduling to happen later. This reduces interrupt processing
   time in the guest (Qemu sends a signal to the thread, and now we leave
   right away). This could be improved even more by sending an actual IPI
   to the CPU, but I'll see later.

Libnvmm:

 * Fix the MMU translation of large pages, we need to add the lower bits
   too.

 * Change the IO and Mem structures to take a pointer rather than a
   static array. This provides more flexibility.

 * Batch together the str+rep IO transactions. We do one big memory
   read/write, and then send the IO commands to the hypervisor all at
   once. This considerably increases performance.

 * Decode MOVZX.

With these changes in place, Qemu+NVMM works. I can install NetBSD 8.0
in a VM with multiple VCPUs, connect to the network, etc.
2019-01-06 16:10:51 +00:00
uwe 5b2acdab92 _wnoutrefresh - extend current position checks.
Also verify that dwin->cury >= begy (ditto for x), i.e. for pads make
sure that the current position is after the beginning of the displayed
portion.  While here refactor the checks for better readability.

We should probably combine the y and x checks b/c if one of them is
not in the range, the current position as a whole is not in the range
and it doesn't make sense to pick and set just the y or just the x
part of it.
2019-01-06 04:27:53 +00:00
uwe aa9d3f22ec _wnoutrefresh - fix current position checks for pads
maxy is an absolute value and should not be adjusted for begy when we
check also absolute cury.  Note that this change does not affect
calculations for normal windows as for them we always pass zero for
begy.  Ditto for x.
2019-01-06 03:59:17 +00:00
uwe 182a153ef7 prefresh - fix current position calculations
The code was copy-pasted from wrefresh(), but for pads we need to
adjust for (pbegy, pbegx).

PR lib/53801
2019-01-06 03:46:11 +00:00
maya 8a135c6afb Match the function prototype of encrypthandler instead of casting to it.
Make GCC 9 snapshot happier with the code

While here, remove unnecessary braces around return (KNF).
2019-01-05 08:55:58 +00:00
maxv 2e9744b39f In !64bit mode RIP-relative is null+disp32, handle that correctly. 2019-01-04 10:25:39 +00:00
uwe 13b962ac1e Fix mis-applied change in previous. Don't increment r_oldcv twice.
PR lib/53803
2019-01-04 03:03:44 +00:00
maxv 579fb4792d When there's no DecodeAssist in hardware, decode manually in software. This
is needed on certain AMD CPUs (like mine): the segment base of OUTS can be
overridden, and it is wrong to just assume DS.

We fetch the instruction and look at the prefixes if any to determine the
correct segment.
2019-01-02 12:18:08 +00:00
christos 76c767265c Release 2018i - 2018-12-30 11:05:43 -0800
Briefly:
    São Tomé and Príncipe switches from +01 to +00 on 2019-01-01.

  Changes to future timestamps

    Due to a change in government, São Tomé and Príncipe switches back
    from +01 to +00 on 2019-01-01 at 02:00.  (Thanks to Vadim
    Nasardinov and Michael Deckers.)


Release 2018h - 2018-12-23 17:59:32 -0800

  Briefly:
    Qyzylorda, Kazakhstan moved from +06 to +05 on 2018-12-21.
    New zone Asia/Qostanay because Qostanay, Kazakhstan didn't move.
    Metlakatla, Alaska observes PST this winter only.
    Guess Morocco will continue to adjust clocks around Ramadan.
    Add predictions for Iran from 2038 through 2090.

  Changes to future timestamps

    Guess that Morocco will continue to fall back just before and
    spring forward just after Ramadan, the practice since 2012.
    (Thanks to Maamar Abdelkader.)  This means Morocco will observe
    negative DST during Ramadan in main and vanguard formats, and in
    rearguard format it stays in the +00 timezone and observes
    ordinary DST in all months other than Ramadan.  As before, extend
    this guesswork to the year 2037.  As a consequence, Morocco is
    scheduled to observe three DST transitions in some Gregorian years
    (e.g., 2033) due to the mismatch between the Gregorian and Islamic
    calendars.

    The table of exact transitions for Iranian DST has been extended.
    It formerly cut off before the year 2038 in a nod to 32-bit time_t.
    It now cuts off before 2091 as there is doubt about how the Persian
    calendar will treat 2091.  This change predicts DST transitions in
    2038-9, 2042-3, and 2046-7 to occur one day later than previously
    predicted.  As before, post-cutoff transitions are approximated.

  Changes to past and future timestamps

    Qyzylorda (aka Kyzylorda) oblast in Kazakhstan moved from +06 to
    +05 on 2018-12-21.  This is a zone split as Qostanay (aka
    Kostanay) did not switch, so create a zone Asia/Qostanay.

    Metlakatla moved from Alaska to Pacific standard time on 2018-11-04.
    It did not change clocks that day and remains on -08 this winter.
    (Thanks to Ryan Stanley.)  It will revert to the usual Alaska
    rules next spring, so this change affects only timestamps
    from 2018-11-04 through 2019-03-10.

  Change to past timestamps

    Kwajalein's 1993-08-20 transition from -12 to +12 was at 24:00,
    not 00:00.  I transcribed the time incorrectly from Shanks.
    (Thanks to Phake Nick.)

    Nauru's 1979 transition was on 02-10 at 02:00, not 05-01 at 00:00.
    (Thanks to Phake Nick.)

    Guam observed DST irregularly from 1959 through 1977.
    (Thanks to Phake Nick.)

    Hong Kong observed DST in 1941 starting 06-15 (not 04-01), then on
    10-01 changed standard time to +08:30 (not +08).  Its transition
    back to +08 after WWII was on 1945-09-15, not the previous day.
    Its 1904-10-30 change took effect at 01:00 +08 (not 00:00 LMT).
    (Thanks to Phake Nick, Steve Allen, and Joseph Myers.)  Also,
    its 1952 fallback was on 11-02 (not 10-25).

    This release contains many changes to timestamps before 1946 due
    to Japanese possession or occupation of Pacific/Chuuk,
    Pacific/Guam, Pacific/Kosrae, Pacific/Kwajalein, Pacific/Majuro,
    Pacific/Nauru, Pacific/Palau, and Pacific/Pohnpei.
    (Thanks to Phake Nick.)

    Assume that the Spanish East Indies was like the Philippines and
    observed American time until the end of 1844.  This affects
    Pacific/Chuuk, Pacific/Kosrae, Pacific/Palau, and Pacific/Pohnpei.

  Changes to past tm_isdst flags

    For the recent Morocco change, the tm_isdst flag should be 1 from
    2018-10-27 00:00 to 2018-10-28 03:00.  (Thanks to Michael Deckers.)
    Give a URL to the official decree.  (Thanks to Matt Johnson.)
2019-01-01 03:04:56 +00:00
maxv 4aa536c2db Fix the segmentation check, the limit is relative, not absolute. 2018-12-29 17:54:54 +00:00
christos 7a3b8449d8 Re-do previous (always make available preinit/initarray/finiarray), with
less disruption.
2018-12-28 20:12:35 +00:00
alnsn f4bc8af01c Document "ROOT." syntax before documenting a generic . 2018-12-28 18:44:11 +00:00
christos 12faa81882 Undo previous; breaks macppc/m68k (at least) 2018-12-28 18:17:10 +00:00
christos 96e2e1e315 Avoid duplicate definitions on arm (reported by kre@) 2018-12-28 13:53:17 +00:00
alnsn a2fe1bd34b No need to quadruple a buffer because strunvis(3) doesn't expand. 2018-12-27 21:35:48 +00:00
christos 7848d457d8 Allow both array and non-array constructors for transition. 2018-12-27 19:32:32 +00:00
christos 312d62b9b5 Enable initfini array support for everyone. 2018-12-27 18:57:14 +00:00
mlelstv 70cf95aac9 Clean up double free in some error paths that did trigger
an assertion in libprop.
2018-12-27 14:05:54 +00:00
maxv 38b2a665bf Several improvements and fixes:
* Change the Assist API. Rather than passing callbacks in each call, the
   callbacks are now registered beforehand. Then change the I/O Assist to
   fetch MMIO data via the Mem callback. This allows a guest to perform an
   I/O string operation on a memory that is itself an MMIO.

 * Introduce two new functions internal to libnvmm, read_guest_memory and
   write_guest_memory. They can handle mapped memory, MMIO memory and
   cross-page transactions.

 * Allow nvmm_gva_to_gpa and nvmm_gpa_to_hva to take non-page-aligned
   addresses. This simplifies a lot of things.

 * Support the MOVS instruction, and add a test for it. This instruction
   is special, in that it takes two implicit memory operands. In
   particular, it means that the two buffers can both be in MMIO memory,
   and we handle this case.

 * Fix gross copy-pasto in nvmm_hva_unmap. Also fix a few things here and
   there.
2018-12-27 07:22:31 +00:00
mrg 1958a4b9ee move sqlite earlier in its section. my build often sits with only 3
processes active here for quite some time otherwise.
2018-12-24 22:02:32 +00:00
mrg cffa8474c3 be consistent about uint64_t and bit masks. 2018-12-19 11:02:21 +00:00
mrg 35db1fca91 use uint64_t for idx_mask. fixes lookups for some PAs. from skrll.
bump copyright.  we updated this a lot of this in 2018.
2018-12-19 11:00:09 +00:00
skrll 9181a215b8 Fix _kvm_kvatop so that it now works. 2018-12-18 16:25:47 +00:00
wiz 76792de36e Use An in AUTHORS section. 2018-12-17 08:18:06 +00:00
maya fa8f034bc1 unifdef RSA_ENCPWD. The matching code does not exist. 2018-12-16 16:06:39 +00:00
abhinav 3cf9f52098 Remove self reference in SEE ALSO
Add references consistent with those in md4(3) and md5(3)

Reported by kamil
2018-12-16 14:08:48 +00:00
hannken 650b07c895 Add an option "modctl" to capture modctl(). 2018-12-16 14:03:37 +00:00
maya 87f1587c95 G/C SPX support
It was presented as a draft in 1993. I don't see any mentions since. it
was not enabled.
2018-12-15 23:22:51 +00:00
maxv 506b4248b0 Invert the mapping logic.
Until now, the "owner" of the memory was the guest, and by calling
nvmm_gpa_map(), the virtualizer was creating a view towards the guest
memory.

Qemu expects the contrary: it wants the owner to be the virtualizer, and
nvmm_gpa_map should just create a view from the guest towards the
virtualizer's address space. Under this scheme, it is legal to have two
GPAs that point to the same HVA.

Introduce nvmm_hva_map() and nvmm_hva_unmap(), that map/unamp the HVA into
a dedicated UOBJ. Change nvmm_gpa_map() and nvmm_gpa_unmap() to just
perform an enter into the desired UOBJ.

With this change in place, all the mapping-related problems in Qemu+NVMM
are fixed.
2018-12-15 13:39:43 +00:00
maxv 3f62f34a84 Two changes:
- Fix the I/O Assist, for INS* it is RDI and not RSI, and the register
   gets updated regardless of the REP prefix.

 - Fill in the Mem Assist. We decode and emulate certain instructions,
   and pass a mem descriptor to the callback to handle the transaction.
   The disassembler could use some polishing, and there are still a
   few instructions missing; but basically it works.
2018-12-15 13:09:02 +00:00
christos 57aff58910 more const 2018-12-14 23:42:39 +00:00
uwe cb6634cf44 Don't leave a subordinate clause out in the cold. 2018-12-14 03:43:22 +00:00
uwe e8277867b9 Fix typo in the function comment. 2018-12-14 03:29:54 +00:00
maya 60dcd2644e Remove unused code 2018-12-13 09:09:32 +00:00
maya 62523467d4 Remove unused macro 2018-12-13 08:45:29 +00:00
maya 3ba1def22c Remove unused macro. 2018-12-13 08:39:34 +00:00
dholland c46ad0a300 Adjust English usage in message for EAI_NONAME. 2018-12-13 04:41:41 +00:00
dholland aaa03614bc Return EAI_NODATA, not EAI_NONAME, for nonexistent hosts.
This causes e.g. "ssh nosuchname" to print "No address associated with
hostname", which is correct, rather than "hostname nor servname
provided, or not known", which is not.
2018-12-13 04:30:55 +00:00
wiz ea293cc938 Remove superfluous dot. 2018-12-12 11:40:08 +00:00
maxv 6c8db606f2 Change the map/unmap functions, again. 2018-12-12 10:42:34 +00:00
maxv 0c0c8940d2 Change the "FILES" section, in the end I don't want to commit toyvirt
and smallkern, there is little interest installing them by default,
rather they can be downloaded from www. It's better this way.

While here add NVMM(4) in "SEE ALSO".
2018-12-12 09:09:08 +00:00
sevan 0f1014292f Reword post mortem description. It tries to get the tree averages if it can. 2018-12-11 23:02:19 +00:00
sevan e67a3558e2 Clarify the difference to getloadavg(3). 2018-12-11 02:29:11 +00:00
christos dda6d8cae4 fix grammar. 2018-12-09 20:29:53 +00:00
tih 138c67b5ef Summary: Align softfloat float128 with libgcc.
While libgcc adapts its float128 data structure to the endianness of
the architecture, the softfloat code in libc didn't.  With both of
them handling the same values, softfloat must follow the toolchain.

OK: riastradh
2018-12-06 19:17:13 +00:00
kamil cae5584ffc Correct handling of minval > maxval in strtonum(3)
The original implementation in OpenBSD returns "invalid" and avoids reading
the input string. The replaced behavior was interpreting the input string
ignoring the invalid arguments.
2018-12-06 06:29:56 +00:00
christos 85390d7315 Add a couple more readline compat functions. 2018-12-02 16:58:13 +00:00
kamil cfb2a8fe4d Correct the documentation of cdbr_open_mem(3)
Fix function prototype in the man-page.
Add link cdbr_open_mem(3) -> cdbr(3).
2018-12-01 02:43:43 +00:00
roy ae8e2e2858 curses: Fix inverted logic when drawing LR corner with auto margins
Thanks to M. Levinson.
2018-11-30 04:38:14 +00:00
maxv a026d6cb92 Rewrite the gpa map/unmap functions. Dig holes in the mapped areas when
there is an overlap. Close to what Qemu expects.
2018-11-29 19:55:20 +00:00
christos f04c2e3e34 Fix off by one <tsahara at iij> 2018-11-29 03:10:20 +00:00
wiz f3f43bfe46 More macros, less whitespace. 2018-11-27 10:38:14 +00:00
kamil 80ee9b513a Fix link sha1.3 <- SHA1File.3
This SHA1File used to link to sha2(3).
2018-11-27 03:56:37 +00:00
kamil 99255a5dff Document SHA1FileChunk(3) in sha1(3)
Description taken from OpenBSD.
2018-11-27 03:29:36 +00:00
joerg 463db15fc5 Do not pass the main object handle from the assembler startup stub to
the common ___start routine. It's only used for a pointless magic
version check. Thanks to martin@ for testing various architectures.
2018-11-26 17:37:44 +00:00
christos e9933f923a From Yuichiro Naito (FreeBSD):
hrs@ says that
(cbp >= MB_LEN_MAX) condition is necessary for checking invalid
byte sequences.  If malicious input was given, libedit would read
byte sequences forever.
2018-11-25 16:21:04 +00:00
christos 2cb4fa4296 From Yuichiro Naito (FreeBSD):
hrs@ says that wctomb(3) has an internal shift state,
if wctomb(3) is called outside of libedit,
the internal state can be changed and causes miscalculate multibyte size.

So in this part, wcrtomb(3) should be used.
wcrtomb(3) requires that shift state is given in the argument.
We always initialize the shift state in ct_enc_width() to keep independent
from outside of libedit.
2018-11-25 16:20:28 +00:00
christos e06500e20d PR/53682: Jordan Lewis: use newlines instead of padded spaces when restoring
multi-line histories.
2018-11-24 12:17:35 +00:00
wiz 9be4740cf8 Grammar improvements. 2018-11-24 11:04:39 +00:00
uwe 80d62aa1ec attron(), attroff() - don't take a shortcut. 2018-11-24 01:04:18 +00:00
skrll 031e68cbb9 Update comments to help explain what's going on 2018-11-23 12:39:18 +00:00
skrll 5c89cda337 Fix so the setcontext call is via the PLT and libpthread can override 2018-11-23 11:38:07 +00:00
uwe 3981bd4fdf wattr_set - turn off all wide attributes (fix unedited copy/paste). 2018-11-23 11:16:59 +00:00
uwe 19b437abe9 Rename the reserved argument from "opt" to "opts" to match SUS text. 2018-11-23 11:15:14 +00:00
uwe 44b007ca68 Refactor. Move code to turn attributes on/off into separate
functions.  Express both old and new functions to manipulate
attributes using those functions.  Check that the the new API's opts
argument (reserved by the standard for future use) is NULL and error
out if not (like getcchar/setcchar).  No functional change intended.
2018-11-23 11:11:59 +00:00
uwe 801bc96314 Drop a few redundant casts of a variable to its own type. 2018-11-22 23:37:31 +00:00
uwe 485cf0548e Move getattrs() and wcolor_set() so that they are with their peers and
so that wide and non-wide functions are in the same order.  While here,
make __wcolor_set() static.  No functional change intended.
2018-11-22 23:29:09 +00:00
uwe b717da4cab Drop HAVE_WCHAR ifdefs from code that is not even compiled with !HAVE_WCHAR.
We still try to mainain the ability to build our curses with
!HAVE_WCHAR, but it doesn't make sense to provide stubs for new wide
API functions that just error out when !HAVE_WCHAR.  Any code that
only uses old API (and can work with !HAVE_WCHAR curses) doesn't use
those new functions.  The code that uses new API obviosly cannot work
when all the new API is stubbed out.

So the plan is to drop the stubs.  This commit does that for files
that are not even compiled with !HAVE_WCHAR (not only those stubs are
useless, they were not even there to begin with).

Same object code is generated for the normal HAVE_WCHAR case.  Nothing
is even recompiled for !HAVE_WCHAR.

Ok by blymn@ jdc@ roy@
2018-11-22 22:16:45 +00:00
uwe e0a45a7a9d We need insstr.c for !HAVE_WCHAR too. 2018-11-22 22:00:49 +00:00
skrll e9071591eb G/C __APCS_26__ support 2018-11-22 20:38:59 +00:00
ryo 466808d25b fix condition code. x1==0 is parent. 2018-11-22 08:30:58 +00:00
skrll df8c50d73f _REG_LR should be _lwp_exit 2018-11-21 21:24:42 +00:00
skrll 81f196752c Fix some register names in comments 2018-11-21 21:04:15 +00:00
skrll 916ea5ef0d Fix a comment 2018-11-21 21:01:41 +00:00
uwe 9d5d4061af Compare pointers to NULL, not to zero. 2018-11-20 22:02:31 +00:00
uwe 042640f557 Drop bogus cast. 2018-11-20 21:42:52 +00:00
uwe 039bdd2780 Don't hide assignments inside tests. 2018-11-20 21:41:31 +00:00
uwe 49cc439a5a Fix color pair handling. color_pair argument is a pair number. 2018-11-20 17:48:19 +00:00
maxv 15051740bd Fix error handling of realloc, and use memmove because the areas overlap;
noted by agc@. These _nvmm_area_add/delete functions don't make a lot of
sense right now and will likely be rewritten to match the behavior
expected by Qemu; but still fix for the time being.

Also fix a collision check while here.
2018-11-19 21:45:37 +00:00
uwe ce63d7aabc wbkgd - when updating window rendition for the new background character,
it's the old background characters that need to be updated, not spaces.

While here, simplify and also fix the bug introduced in 1.20 (that
lost the default color) - actually use the results of wbkgdset().
2018-11-19 20:37:04 +00:00
uwe 22b16841d0 Provide basic documentation on getcchar(3) and setcchar(3).
Looks like we don't have any of wide curses stuff documented, so this
seems to be a good place to start.  Needs more exposition on wide
attr_t and how it's related to non-wide chtype, etc, etc.
2018-11-19 01:08:21 +00:00
uwe af85389f73 wbkgrnd - do not duplicate code that's already in wbkgrndset() 2018-11-18 22:53:22 +00:00
uwe 76bb992903 When we remove default color from attributes, just clear all __COLOR.
It's both a nono-optmization and matches the test used in counterpart
code that adds default color when none is set.
2018-11-18 22:34:32 +00:00
uwe 0b616789d6 Reorder "bkgrnd" functions to match the order of old "bkgd" functions. 2018-11-18 22:18:02 +00:00
uwe 5fc077791a Don't fuse HAVE_WCHAR and (trivial) !HAVE_WCHAR bodies into single
function definition.  Instead provide two sets of definitions under
single #ifdef.  Same object code is generated for both HAVE_WCHAR and
!HAVE_WCHAR.
2018-11-18 22:11:38 +00:00
uwe ee4af76d2e wbkgd - do not duplicate the code that's already in wbkgdset()
that we do call anyway.
2018-11-18 21:01:16 +00:00
uwe 14d0245468 Fix comments on bkgdset() and friends to match reality. 2018-11-18 20:26:29 +00:00
uwe 3f33c7bd5f Don't mix private and public names for the same thing in one statement.
While here, fix harmless edito in a debug call.
2018-11-18 18:52:29 +00:00
christos e91c30539f fix compilation 2018-11-18 17:15:41 +00:00
christos 18bb6ea433 Remove utf-8 requirement (Yuichiro NAITO) 2018-11-18 17:09:39 +00:00
uwe 5938495dd2 Reindent a few lineeq() calls now that we can w/out exceeding 80
columns limit.  Whitespace change only.
2018-11-18 02:46:24 +00:00
uwe 47498e515e Further tweak previous. Change the check order to be more logical.
No functional change intentded.  While here fix indentation.
2018-11-18 02:39:44 +00:00
uwe 89ed91e019 Merge one more #ifdef with mostly identical code in both branches.
The same object code is generated modulo gratuitously different order
of checks.
2018-11-18 02:34:39 +00:00
uwe 7013a4d9a5 Merge another #ifdefs that now has identical code in both branches
modulo swapped arguments to celleq() call.  Same object code is
generated otherwise for both HAVE_WCHAR and !HAVE_WCHAR
2018-11-18 02:17:24 +00:00
uwe 7539fe2666 Merge few #ifdefs that now have identical code in both branches.
Same object code is generated for both HAVE_WCHAR and !HAVE_WCHAR.
2018-11-18 01:54:30 +00:00
uwe 05cd1d4d96 Define celleq() and lineeq() for !HAVE_WCHAR too and use them instead
of explicit memcmp() calls.  Same object code is generated for both
HAVE_WCHAR and !HAVE_WCHAR, but we can now try to merge some of the
#ifdefs
2018-11-18 01:39:55 +00:00
uwe d2a41e949e Oops, revert previous. Wrong tree. 2018-11-18 01:23:57 +00:00
uwe e573989caa Comment out LIBDPLIBS so that this can be built outside of the tree. 2018-11-18 01:22:49 +00:00
uwe e156886d4b Rename cellcmp() and linecmp() to celleq() and lineeq() respectively
and make them static.
2018-11-18 01:19:29 +00:00
uwe 291b9ad5db quickch - fix inverted checks.
I have to admit I have no idea what's going on here, but HAVE_WCHAR
code here inverted the sense of linecmp and cellcmp checks w.r.t the
!HAVE_WCHAR variant just above it.  Cf. also all other similar #ifdefs
in this file.

Found through source code inspection, not really tested.
2018-11-18 01:05:30 +00:00
uwe 02236eecfb cellcmp - use logical && not bitwise & 2018-11-18 00:45:44 +00:00
maxv 07310f302a Don't forget to set 'prot' when the guest has paging disabled. 2018-11-17 16:11:33 +00:00
ryo b3731ba225 fix type of argument for va_arg; don't round to 32bit. 2018-11-16 10:51:08 +00:00
blymn a887f4aff9 Fix for PR lib/52063
Many thanks to  Onno van der Linden (o.vd.linden@quicknet.nl) for providing
the bulk of the patch that fixes the issue.
2018-11-16 10:12:00 +00:00
manu b553c427d4 Use reclaim2 to fix reclaim/lookup race conditions
The PUFFS reclaim operation had a race condition with lookups: we could
be asked to lookup a node, then to reclaim it before lookup completion.
At lookup completion, we would then create a leaked node.

Enter the PUFFS reclaim2 operation, which features a nlookup argument.
That let us count how many lookups are pending and avoid the above
described scenario. It also makes the codes simplier.
2018-11-16 02:39:02 +00:00
uwe 540f2c17fd _cursesi_addbyte - fix function comment after what looks like an
editing accident.
2018-11-15 03:17:51 +00:00
martin 53fe79071f Too much magic involved - revert previous. 2018-11-13 09:24:37 +00:00
martin 94c721a4e0 Need some minimalistic support for additional things that ../Makefile
requires, even if we do nothing here
2018-11-13 09:14:14 +00:00
martin 9b49821e7c Move conditionals for libnvmm to subdir makefile, requested boy mrg. 2018-11-13 09:00:08 +00:00
maya c587647461 Revert my own rev 1.2, the missing include was only when building the 32-bit
compat library, we no longer do this.
2018-11-13 06:57:14 +00:00
nakayama 996407034c No need to install shared libraries to /lib. 2018-11-12 17:46:53 +00:00
martin c0f5d6f2fc Do not build a compat i386 version of libnvmm. 2018-11-12 09:25:42 +00:00
maya dd1f793151 Add missing include for struct nvmm_x64_state
(Pointed out by the clang build)
2018-11-11 00:06:48 +00:00
maxv 823f3f6003 Add copyright and RCSID, from wiz@. 2018-11-10 10:57:06 +00:00
maxv 2760ca24b5 Add libnvmm, NetBSD's new virtualization API. It provides a way for VMM
software to effortlessly create and manage virtual machines via NVMM.

It is mostly complete, only nvmm_assist_mem needs to be filled -- I have
a draft for that, but it needs some more care. This Mem Assist should
not be needed when emulating a system in x2apic mode, so theoretically
the current form of libnvmm is sufficient to emulate a whole class of
systems.

Generally speaking, there are so many modes in x86 that it is difficult
to handle each corner case without introducing a ton of checks that just
slow down the common-case execution. Currently we check a limited number
of things; we may add more checks in the future if they turn out to be
needed, but that's rather low priority.

Libnvmm is compiled and installed only on amd64. A man page (reviewed by
wiz@) is provided.
2018-11-10 09:28:56 +00:00
martin 6b62e867ad Add modfl alias. 2018-11-09 10:19:47 +00:00
mrg 33cbd42a21 tg1 is a 64 bit value, store it in a 64 bit variable. 2018-11-09 04:06:40 +00:00
riastradh 0cc7838e19 Attempt to implement fabsf by copying fabs and s/d/f/g.
Vax wizards, please vaxinate if I flubbed this!
2018-11-08 18:19:37 +00:00
riastradh 7b66ed5df0 Use the generic C fabs/fabsl on ia64 for now to unbreak the build. 2018-11-08 16:36:16 +00:00
riastradh 3e49d37969 powerpc64 needs fabsl too. (Apparently no __HAVE_LONG_DOUBLE?) 2018-11-08 16:31:46 +00:00
riastradh e84f49ed3d Try speling it rite, riasthradhdadhaa or whatever your name is. 2018-11-08 16:29:50 +00:00
msaitoh 169880b3b2 "s/ an an / an /" in comment. No functional change. 2018-11-08 06:43:52 +00:00
msaitoh 54c9821e53 "s/ are are / are /" in comment. No functional change. 2018-11-08 06:34:40 +00:00
riastradh cdb65da578 On ports without __HAVE_LONG_DOUBLE, make fabsl alias fabs.
For some reason, fabs lives in libc, not in libm, and our tests now
detect when fabs or fabsl is missing from libm.  For those ports that
sometimes have long double and sometimes don't, make it conditional.

Still missing: fabs _and_ fabsl on ia64.  Need help from an itanium
wizard!  Other portmasters: Please take a look and see if I missed
any ports that might have long double where this alias will not work.
2018-11-07 22:21:42 +00:00
riastradh 7374a22668 When hardware subnormal support is available, disable flush-to-zero.
Similarly, when hardware NaN propagation is available, disable
default-NaN substitution.

This enables IEEE 754 semantics on any hardware that supports it by
default.  Programs that want flush-to-zero or default-NaN substitution
can enable them explicitly.

ok ryo@
2018-11-07 06:47:38 +00:00
riastradh 6059a086c9 Disable x87 implementations of sin, cos, tan.
The x87 hardware uses a bad approximation to pi for argument
reduction, and consequently yields bad answers for inputs near pi or
pi/2.

Tweak one tanf test whose doubly rounded output is a little too far
from the correct answer on the doubly rounded input.
2018-11-07 04:00:12 +00:00
wiz b572c9cad3 Fix xref. 2018-11-05 09:18:55 +00:00
maya 81e6878869 Suggest to remove lfs_ stubs on a major bump.
they're deprecated, ioctl is used instead.
2018-11-05 04:08:39 +00:00
mrg 19db227738 initialise the kvm errbuf so that if an error occurs, but the
internal _kvm_*err() functions aren't called, stack garbage is
not reported as an error string.

call _kvm_err() if _kvm_kvatop() fails.  now the above is not
triggered anymore :-)
2018-11-05 00:43:30 +00:00
christos 2d24b2e817 - Introduce a new SO_RERROR socket option to explicitly turn on
receive overflow errors re-instating the default behavior to
  silently ignore them as before 2018-03-19.
- Introduce a new kern.sooptions sysctl to control the default
  behavior of socket options. Setting this to 0x4000 (SO_RERROR),
  turns on receive overflow error reporting for all sockets.
- Change dhcpcd to turn on SO_RERROR on all its sockets.

As discussed in tech-net.
2018-11-04 16:30:28 +00:00
blymn e3b169cf11 Remove obsolete clauses from copyright block. Original copyright was
mine so should be ok to do.
2018-11-02 04:17:39 +00:00
mrg d89d4475a3 compare matching TG1 bits.
aarch64 crash dump kvtop now less broken, but still not stable.
2018-11-01 05:37:11 +00:00
wiz c23b16b56b Add comma in enumeration. 2018-10-29 21:06:13 +00:00
uwe 4c629b7589 Fix indentation. 2018-10-29 01:27:39 +00:00
uwe 29dacce45c waddch - instead of enclosing every statement in #ifdef HAVE_WCHAR
just provide two separate definitions.

Same object code is generated for all four combinations of debug/wchar.
2018-10-29 01:19:54 +00:00
uwe 9635311de9 Fix operator precedence for !HAVE_WCHAR 2018-10-29 01:02:16 +00:00
uwe 8c2d3cb78d __CTRACE - don't call gettimeofday() twice. 2018-10-29 00:31:57 +00:00
uwe d05568e5ff Make __CTRACE_init() static and ANSIfy its definition. 2018-10-29 00:25:20 +00:00
christos 273e6379f5 Welcome tzcode-2018g
Changes to code

    When generating TZif files with leap seconds, zic no longer uses a
    format that trips up older 32-bit clients, fixing a bug introduced
    in 2018f.  (Reported by Daniel Fischer.)  Also, the zic workaround
    for QTBUG-53071 now also works for TZif files with leap seconds.

    The translator to rearguard format now rewrites the line
    "Rule Japan 1948 1951 - Sep Sat>=8 25:00 0 S" to
    "Rule Japan 1948 1951 - Sep Sun>=9  1:00 0 S".
    This caters to zic before 2007 and to Oracle TZUpdater 2.2.0
    and earlier.  (Reported by Christos Zoulas.)

  Changes to documentation

    tzfile.5 has new sections on interoperability issues.
2018-10-27 22:29:24 +00:00
uwe c71ebe1c3f Ignore terminfo padding specifications when checking whether
exit_attribute_mode contains exit_alt_charset_mode.

Fixes PR lib/53653.
2018-10-26 22:22:24 +00:00
uwe 3efeeb08cd Oops, update name in .Dt, bump date. 2018-10-25 10:41:00 +00:00
uwe 90fc733d35 Rename curses_insertch.3 to curses_insch.3 to match the function names
documented in that manpage.  With the letter salad used in curses
function names naming consistency is very important and this page was
the only one that didn't match.

Add mvinsch and mvwinsch links.  Update xrefs in other man pages.
2018-10-25 10:36:56 +00:00
christos b15150dc5e Apply revisions 1.21, 1.22 from OpenBSD:
In re_fastputc(), set lastline to the new line, not the previous
line so it gets initialized properly.  Fixes a crash in bc with
MALLOC_OPTIONS=UJ.  OK deraadt@, committing on behalf of yasuoka@

Initialize "old" screen buffer lines before use; otherwise, they would
never get NUL-terminated and cause read buffer overruns.
This fixes for example segfaults in sftp(1) that could be triggered
by typing in an extremely long string (more than one line - the longer,
the likelier to crash), then hitting backspace once.
Problem reported and patch OK'ed by sthen@.

XXX: pullup-8
2018-10-23 16:49:13 +00:00
roy 9588a9422e curses: ensure attributes are correctly set for each character
Another fix for PR# 30978.
2018-10-21 12:47:33 +00:00
christos b2b04f7e8a Update to 2018f:
Changes to code

    zic now always generates TZif files where time type 0 is used for
    timestamps before the first transition.  This simplifies the
    reading of TZif files and should not affect behavior of existing
    TZif readers because the same set of time types is used; only
    their internal indexes may have changed.  This affects only the
    legacy zones EST5EDT, CST6CDT, MST7MDT, PST8PDT, CET, MET, and
    EET, which previously used nonzero types for these timestamps.

    Because of the type 0 change, zic no longer outputs a dummy
    transition at time -2**59 (before the Big Bang), as clients should
    no longer need this to handle historical timestamps correctly.
    This reverts a change introduced in 2013d and shrinks most TZif
    files by a few bytes.

    zic now supports negative time-of-day in Rule and Leap lines, e.g.,
    "Rule X min max - Apr lastSun -6:00 1:00 -" means the transition
    occurs at 18:00 on the Saturday before the last Sunday in April.
    This behavior was documented in 2018a but the code did not
    entirely match the documentation.

    localtime.c no longer requires at least one time type in TZif
    files that lack transitions or have a POSIX-style TZ string.  This
    future-proofs the code against possible future extensions to the
    format that would allow TZif files with POSIX-style TZ strings and
    without transitions or time types.

    A read-access subscript error in localtime.c has been fixed.
    It could occur only in TZif files with timecnt == 0, something that
    does not happen in practice now but could happen in future versions.

    localtime.c no longer ignores TZif POSIX-style TZ strings that
    specify only standard time.  Instead, these TZ strings now
    override the default time type for timestamps after the last
    transition (or for all time stamps if there are no transitions),
    just as DST strings specifying DST have always done.

    leapseconds.awk now outputs "#updated" and "#expires" comments,
    and supports leap seconds at the ends of months other than June
    and December.  (Inspired by suggestions from Chris Woodbury.)

  Changes to documentation

    New restrictions: A Rule name must start with a character that
    is neither an ASCII digit nor "-" nor "+", and an unquoted name
    should not use characters in the set "!$%&'()*,/:;<=>?@[\]^`{|}~".
    The latter restriction makes room for future extensions (a
    possibility noted by Tom Lane).

    tzfile.5 now documents what time types apply before the first and
    after the last transition, if any.

    Documentation now uses the spelling "timezone" for a TZ setting
    that determines timestamp history, and "time zone" for a
    geographic region currently sharing the same standard time.

    The name "TZif" is now used for the tz binary data format.

    tz-link.htm now mentions the A0 TimeZone Migration utilities.
    (Thanks to Aldrin Martoq for the link.)
2018-10-19 23:05:35 +00:00
roy 501d84b3ab curses: don't optimize stdout buffer for non BSD platforms
The way BSD setvbuf works is not portable and should not be relied on.
This is only important if curses is started, stopped and started in the
same session which is how portable applications handle terminal resizing.
2018-10-18 07:53:13 +00:00
uwe b42d6bc7c1 Fix pasto. 2018-10-10 21:09:58 +00:00
roy 65c1447580 curses: test terminal capabilities for drawing in the bottom right corner
If auto margins are present, we need to turn them off or enter
an insert mode to "push" the character we want into the corner.
If pushing a wide character of greater than one cell, we need something
more than ich1, othewise the bottom right corner will remain blank.

Follow on fix for PR# 30978.

OK jdc@
2018-10-10 09:40:11 +00:00
kamil b50859a9e1 Drop Pad functions from sha2(3)
This man-page first appeared before porting all the features to NetBSD and
actually Pad ones were never ported. Keeping it in the documentation is
misleading and actually caused bugs in handling of these functions in 3rd
party software.
2018-10-09 11:36:35 +00:00
roy 7b8fbc2d04 terminfo: if $TERMINFO.cdb doesn't exist, try $TERMINFO
This allows this command sequence to work:
tic -o /tmp/foo foo
TERMINFO=/tmp/foo TERM=foo infocmp
2018-10-08 20:44:34 +00:00
christos e0a9077d02 use the right type. 2018-10-06 23:48:00 +00:00
jmcneill 51976c5c14 If fs_spec starts with the special string "ROOT.", replace it with a device
path derived from the value of the kern.root_device sysctl.
2018-10-06 13:09:53 +00:00
roy 4ab8a24fa9 curses: allow drawing the lowest right hand cell of the terminal
This is a historical behaviour that needs fixing
If any terminal does scroll when drawing in the lowest right hand cell
of the terminal then an entry should be made in the terminfo database
(currently there is no standard code) to state that and define
__SCROLLWIN as before.

Fixes PR# 30978.
2018-10-05 11:59:05 +00:00
roy ae348ab5a5 curses: once __slk_init is called, reset slk_fmt
This allows soft label keys to be used on more than one terminal.
2018-10-04 19:11:09 +00:00
roy 0a1d3be0c8 curses: declare SLK format as invalid until slk_init(3) called
If we don't, then when __slk_init with a valid format of 0 it sets
up labels to be drawn without a window.
2018-10-04 18:40:41 +00:00
roy dd838550f1 curses: resize ripped off windows
The application must still redraw them though.
2018-10-03 13:22:29 +00:00
roy d34c5681a4 curses: fix ripoffline
When creating stdscr, ensure it's placed and sized in accordance with
lines ripped off.
LINES is no longer adjusted for lines ripped off.
POSIX makes no mention that it should be adjusted.
Bottom lines are now placed correctly.
Lines ripped off are now displayed after calling initscr.

ok kamil@

Fixes PR #53635
2018-10-02 17:35:44 +00:00
kamil 83265ee89a curses.h: Fix typo in a comment of the word 'handling'
No functional change intended.
2018-09-30 10:55:00 +00:00
kamil 8943bc5423 Fix addchnstr() macro in curses.h
Add a missing argument 'n'.
2018-09-30 10:08:13 +00:00
kamil fdb7fdb9da Fix the documented function prototype of slk_attr_set(3)
Note the missing argument short pair.
2018-09-29 22:04:57 +00:00
kamil 212eaddd8d Fix function prototypes in curses_underscore.3
Correct function prototype of wunderscore(3) and wunderend(3).
2018-09-29 21:52:29 +00:00
christos c5c9ba2461 - re-enable lint (otherwise the sets break)
- no space after -I (for consistency)
2018-09-29 15:52:44 +00:00
rmind 39013e66c1 NPF: Major rework -- migrate NPF to the libnv library.
- This conversion significantly simplifies the code and moves NPF to
  a binary serialisation format (replacing the XML-like format).
- Fix some memory/reference leaks and possibly use-after-free bugs.
- Bump NPF_VERSION as this change makes libnpf incompatible with the
  previous versions.  Also, different serialisation format means NPF
  connection/config saving and loading is not compatible with the
  previous versions either.

Thanks to christos@ for extra testing.
2018-09-29 14:41:35 +00:00
kamil 055799effd Correct function prototypes in curses_background(3)
Fix prototypes for: bkgdset(3), wbkgd(3) and wbkgdset(3).
2018-09-29 11:23:18 +00:00
roy e407f0a09e curses: resizeterm(3) should always send KEY_RESIZE
Fixes #53636

OK kamil@
2018-09-28 15:03:48 +00:00
kamil 06c174310a Fix typos in curses_screen.3
Fn -> Ft in the resize_term(3) prototype
funcion -> function
2018-09-28 08:11:34 +00:00
roy d12ba5c052 curses: call resizeterm if getch issues KEY_RESIZE
This fixes PR #53633.
2018-09-27 14:07:55 +00:00
roy 21a2638f2f curses: unify resize handling in getch
Instead of testing each fgetc call for resize event, add the wrapper
__fgetc_resize to simplify the logic.
While here, ensure that get_wch uses the correct input stream which
may or may not be stdin.
2018-09-27 14:05:26 +00:00
kre d794b9b637 HACK: if calling dirname() with the results of a previous dirname()
there is no need to copy the path into the output buffer, it is already
there....

All this has to change to become compat with a forthcoming POSIX update.
2018-09-27 00:45:34 +00:00
kamil 911ec14d76 According to POSIX moving the cursor in curses(3) touches the window
Mark the old and new lines as dirty, so they will be refreshed upon next
call to getch(3)-like routine.

This also matches the ncurses behavior.

Reviewed by <roy>
2018-09-26 18:51:45 +00:00
kamil 71dc5d0e77 Correct detecting of terminal resize in curses(3) with keypad(,TRUE)
A previous change fixed only keypad(,FALSE) scenarios.

Handle catching terminal resize in INKEY_NORM and INKEY_ASSEMBLING (in the
middle of assembling a key code from passed codes) as both accept keys with
fgetc(3) and both can be in theory interrupted with a resize.

PR lib/53615
2018-09-26 14:42:22 +00:00
rin 1e421f65db PR lib/53615
Before invoking a previous signal handler, make sure it is not SIG_*.
Fix potential crash with SIGWINCH.

OK roy
2018-09-18 22:51:00 +00:00
rin 88ccf2cadc PR lib/53615
getch() and get_wch() should return KEY_RESIZE when interrupted by SIGWINCH.

OK roy
2018-09-18 22:46:18 +00:00
kre b8b0289d66 Fix editing mistake, remove ) from func call that is now gone. 2018-09-13 09:03:40 +00:00
christos 26f83385d3 more efficient to use decode_result :-) Pointed out by kre@ 2018-09-13 01:26:33 +00:00
christos 6da79ee096 PR/53597: Yasuhiro Horimoto: Avoid segmentation fault in bad history file. 2018-09-12 22:10:35 +00:00
maya 591f556772 Add a todo item for a future major bump (rename many symbols) 2018-09-09 07:24:59 +00:00
christos 3271408c58 Add libnv 2018-09-08 14:11:41 +00:00
maxv c1cd5851ce Remove dead references to netinet6/ipsec.h. 2018-09-06 09:54:36 +00:00
maxv c698ced324 fix references, the things were moved into netipsec/ a while ago 2018-09-06 09:28:00 +00:00
christos 48875230b6 Allow being compiled as a tool. 2018-08-30 12:06:06 +00:00
ryo 4f574380a4 delete __{ge,lt,gt,le,eq,ne,unordt}tf2.
these should not be defined in libc.

pointed out by joerg@. thanks.
2018-08-27 16:46:13 +00:00
christos 8ea42f66ff adjust to new libssh api. 2018-08-26 08:54:03 +00:00
msaitoh fba7dcecac - SIOCGIFINDEX was added in 2013, but if_freenameindex(3) have not used it
for years. Use it to improve performance. Same as FreeBSD.
- KNF.
2018-08-22 03:12:31 +00:00
kamil 66f17364ec Drop a duplicate instruction line
No functional change intended.
2018-08-19 02:10:42 +00:00
martin 7dba0fd9ed PR standards/53525: move getsubopt to stdlib.h 2018-08-15 10:49:47 +00:00
wiz 4e9665c6ea Sort SEE ALSO. 2018-08-13 06:08:48 +00:00
wiz c9911a308e Various improvements.
More markup, sort errors, fix -1.
2018-08-13 06:00:21 +00:00
christos 491e774596 switch to the new bind. 2018-08-12 13:01:55 +00:00
ryo fae343b8b2 fix multiple definition of __{ge,lt,gt,le,eq,ne,unordt}tf2 in libc and libgcc.
this fixes the ATF call_once_static, call_once2_static, cxxruntime_static, static_destructor_static.
2018-08-11 10:06:40 +00:00
kamil c85fcdfeed Merge FreeBSD improvements to the man-page of timespec_get(3)
Keep NetBSD references instead of FreeBSD ones included in the FreeBSD
version.
2018-08-10 20:35:52 +00:00
simonb e6a7f880ff Avoid curx going beyond end of window when adding a wide character to the
last column.

OK @blymn.
2018-08-08 02:26:08 +00:00
ryo e6a0182575 need to set _UC_TLSBASE of uc_flags for _lwp_makecontext().
pointed out from skrll@. thanks.
2018-08-04 10:22:09 +00:00
kamil 93bf963a4b Restrict -fno-sanitize=function to Clang/LLVM only
The base GCC version 6,x does not support this option.
2018-08-03 14:01:21 +00:00
kamil d92938e14a Add a support to build ubsan.c in libc
Under the condition of MKLIBCSANITIZER==yes link ubsan.c into libc.

This is a clean-room reimplementation from scratch of the Undefined
Behavior runtime called micro-UBSan (or uBSan - user-UBSan).
2018-08-03 04:29:35 +00:00
kamil 7517542c29 Disable sanitization of -fsanitize=function in libc
Generated code for the checks (in at least libunwind) depends on the C++
runtime feature of RTTI.

Pass -fno-sanitize=function to LIBCSANITIZERFLAGS.
2018-08-03 02:29:35 +00:00
rjs f78bd2661d Add missing SCTP manpage. 2018-08-02 10:18:19 +00:00
rjs 97b85c8c95 Add userland support for SCTP and manpages. 2018-08-02 08:40:47 +00:00
ryo 90a07881a6 fix long double NaN definition. 2018-08-01 19:59:49 +00:00
sevan 8757822cde Remove ISO references 2018-07-31 22:28:26 +00:00
rjs 4dbc455943 Userland changes for getsockopt2(). 2018-07-31 13:04:09 +00:00
kre 65afe3be98 PR lib/53477 (rudolf at eq.cz) - correct an obvious mistake. 2018-07-28 14:00:19 +00:00
maya 726d0d156a it's C18, not C17. 2018-07-27 15:15:30 +00:00
maya b91e8b8ee6 Claim C17 (although I'm unsure), add a note about C11's requirements. 2018-07-27 14:34:44 +00:00
maya 8d702a64ca C17 conformance: aligned_alloc's size doesn't need to be a multiple of
alignment any more.

Thanks Joseph Myers for the heads up.
2018-07-27 13:08:47 +00:00
kamil 1ec5b47878 Specify NOLIBCSANITIZER in lib/csu
The low-level libraries in csu are used in non-sanitized code.
2018-07-26 01:25:23 +00:00
kamil 21d1b523b3 Avoid undefined behavior in ftok(3)
Do not change the signedness bit with a left shift operation.
Cast to unsigned integer to prevent this.

ftok.c:56:10, left shift of 123456789 by 24 places cannot be represented in type 'int'
ftok.c:56:10, left shift of 4160 by 24 places cannot be represented in type 'int'

Detected with micro-UBSan in the user mode.
2018-07-26 00:05:28 +00:00
kamil 1a4c49b997 Avoid undefined behavior in the definition of LAST_FRAG in xdr_rec.c
Do not change the signedness bit with a left shift operation.
Switch to unsigned integer to prevent this in the LAST_FRAG symbol.

xdr_rec.c:559:39, left shift of 1 by 31 places cannot be represented in type 'int'
xdr_rec.c:572:26, left shift of 1 by 31 places cannot be represented in type 'int'
xdr_rec.c:573:25, left shift of 1 by 31 places cannot be represented in type 'int'
xdr_rec.c:632:37, left shift of 1 by 31 places cannot be represented in type 'int'
xdr_rec.c:711:32, left shift of 1 by 31 places cannot be represented in type 'int'
xdr_rec.c:722:28, left shift of 1 by 31 places cannot be represented in type 'int'

Detected with micro-UBSan in the user mode.
2018-07-25 23:59:08 +00:00
kamil f34d1bdd0f Avoid undefined behavior in left bit shift in jemalloc(3)
Change the type of shifted value to unsigned to prevent altering the
signedness bit.

jemalloc.c:1707:14, left shift of 1 by 31 places cannot be represented in type 'int'
jemalloc.c:1724:15, left shift of 1 by 31 places cannot be represented in type 'int'
jemalloc.c:1840:28, left shift of 1 by 31 places cannot be represented in type 'int'

Detected with micro-UBSan in the user mode.
2018-07-25 20:05:35 +00:00
ryo ac20698df5 fix a bug. no need postincrement here. 2018-07-20 12:19:07 +00:00
joerg eb13f74bfc The fpu mode for VFP2 instructions is still just vfp. 2018-07-19 19:35:02 +00:00
joerg 1b0031d44e Push FPU choice into the assembler sources themselve. 2018-07-17 15:03:48 +00:00
joerg 700ad9d05d Determine dynamic binaries by presence of PT_INTERP. Static PIE has
_DYNAMIC.
2018-07-13 19:50:21 +00:00
joerg bf395f73c9 Compute relocbase correctly for static PIE. AT_BASE is not usable in
this case.
2018-07-13 19:49:47 +00:00
kre 96ef5eaedd i386/amd64 build fix. Fix "possibly used uninitialized" from gcc.
These changes should make no practical effect - but because external
data is being examined, it would be possible to contrive a situation
(perhaps) where uninit'd vars could actually be used (unless the format
has been checked elsewhere earlier - I did not look ... we have to
appease gcc anyway).

Joerg: Please review (& fix)
2018-07-13 01:00:17 +00:00
joerg 26c47810f2 Add static PIE support for i386 and AMD64.
The basic glue works with mininal changes for other architectures as
well, but those require linker changes first to avoid leaking dynamic
relocations into the binary.
2018-07-12 21:36:45 +00:00
joerg c0d91a1260 _DYNAMIC is present for static PIE as well, so loosen rtld check. 2018-07-12 21:35:12 +00:00
maxv 62c8988166 Remove the kernel PMC code. Sent yesterday on tech-kern@.
This change:

 * Removes "options PERFCTRS", the associated includes, and the associated
   ifdefs. In doing so, it removes several XXXSMPs in the MI code, which is
   good.

 * Removes the PMC code of ARM XSCALE.

 * Removes all the pmc.h files. They were all empty, except for ARM XSCALE.

 * Reorders the x86 PMC code not to rely on the legacy pmc.h file. The
   definitions are put in sysarch.h.

 * Removes the kern/sys_pmc.c file, and along with it, the sys_pmc_control
   and sys_pmc_get_info syscalls. They are marked as OBSOL in kern,
   netbsd32 and rump.

 * Removes the pmc_evid_t and pmc_ctr_t types.

 * Removes all the associated man pages. The sets are marked as obsolete.
2018-07-12 10:46:40 +00:00
maxv 18f65af8ea Retire libpmc. It uses the legacy PMC interface in the kernel, which has
support for only one ARM CPU. It used to have x86 support, but it was broken
and I removed it. The legacy PMC interface will be removed from the kernel
too. Sent on tech-kern@ yesterday, thorpej was fine.
2018-07-12 06:52:48 +00:00
christos 1765287814 revert previous now that MAP_ALIGNED has been fixed. 2018-07-09 00:47:47 +00:00
christos 0dba751ea2 switch to FreeBSD's memmem 2018-07-08 17:53:42 +00:00
christos de03d6cb9a correct previous cast. 2018-07-08 16:48:47 +00:00
christos 606587dd27 cast for lint 2018-07-08 16:39:27 +00:00
msaitoh 8402962f31 Indent. 2018-07-04 07:38:38 +00:00
christos a17e2f9d4b use a switch. 2018-06-30 16:05:44 +00:00
christos 0fd9ea3645 put back lsan 2018-06-28 10:14:01 +00:00
ozaki-r 79209cd2af rumphijack: don't modify a cmsg on just validating it
Pointed out by k-goda@IIJ
2018-06-28 06:20:36 +00:00
dholland bc382992a0 Describe what this actually does. Bump date. 2018-06-25 01:21:21 +00:00
kamil 171790efcf Fix stack use after scope in libutil/pty
The pt variable's elements are used after the end of the pt scope.
A move of pt to outer scope fixes this.

Detected with MKSANITIZER/ASan with tmux(1), a forkpty(3) user.
2018-06-24 09:30:26 +00:00
kamil b2b644497e Prevent underflow buffer read in trim_whitespace() in libutil/passwd.c
If a string is empty or contains only white characters, the algorithm of
removal of white characters at the end of the passed string will read
buffer at index -1 and keep iterating backward.

Detected with MKSANITIZER/ASan when executing passwd(1).
2018-06-24 01:53:14 +00:00
kamil bef3ed2e02 Disable MKSANITIZER in lib/csu
These low-level libraries are expected to be not touched by a sanitizer.
Every libc program not using sanitizers cannot work with sanitized csu.
2018-06-16 18:58:00 +00:00
dholland d8a5b30306 atomic_and/atomic_or do bitwise ops, not logical ops. 2018-06-16 08:11:32 +00:00
eadler 8ddc25ac24 libc: remove explicit cast NULL in atoi
There isn't any reason to cast NULL so just remove it. A similar change
was already made in DragonFly and FreeBSD (by me).

ok fly@
2018-06-13 09:38:32 +00:00
kamil 0d6563db8b Disable sanitizers for libm and librt
The sanitizers are designed to use pristine OS versions of these libraries,
install interceptors for public symbols in them and link with them in every
sanitized executable.

Having unmodified base libraries (c, m, rt, pthread) also makes the system
usable with programs linking with them and without sanitization, as there
are no fatal issues during the resolving of missing symbols.

The remaining libraries like libutil, libintl etc are prebuilt with
sanitization and all their users in the MKSANITIZER=yes distribution are
required to use the same sanitizer.

libc and libpthread are already marked with the NOSANITIZER flag.
2018-06-13 08:19:36 +00:00
maya 9616ec28db Avoid left-shifting a negative number in the non-compat case, too. 2018-06-11 20:28:23 +00:00
kamil 5a889623ce Correct Undefined Behavior in libc/citrus
Unportable left shift reported with MKSANITIZER=yes USE_SANITIZER=undefined:

# 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'

Sponsored by <The NetBSD Foundation>
2018-06-11 18:03:38 +00:00
christos 2357fc5dd5 use SUBDIR.roff suggested by uwe@ 2018-06-10 17:55:11 +00:00
christos aa66956410 But set NOSANITIZER 2018-06-09 23:45:56 +00:00
christos 64715b9aa8 We can't build those three with MKSANITIZER, they are used too early. 2018-06-09 22:41:55 +00:00
christos a3c16b5549 Provide more compatibility with readline headers; now python-3.6.5 works
when changing 'readline' -> 'edit' in setup.py.
Revert previous conditional setting of unbuffered.
2018-06-09 17:41:55 +00:00
maxv 85add8c74c Disable draft_00 in racoon, discussed on tech-net@ and now in PR/53334.
While here clarify the comments, no #undef.

No need to increase the library version I guess, since draft_00 is not
used in libipsec.
2018-05-31 07:16:16 +00:00
chs ba2539a980 merge a new version of the CDDL dtrace and ZFS code.
this changes the upstream vendor from OpenSolaris to FreeBSD,
and this version is based on FreeBSD svn r315983.

in addition to the 10 years of improvements from upstream,
this version also has these NetBSD-specific enhancements:
 - dtrace FBT probes can now be placed in kernel modules.
 - ZFS now supports mmap().
2018-05-28 21:04:59 +00:00