Commit Graph

19474 Commits

Author SHA1 Message Date
mrg 504bd058ec use adrp not adr, since the data is not pc-rel. fixes brk(2). 2019-02-05 13:02:35 +00:00
mrg 82974f2217 check for snprintf() truncation and fail sanely if so, rather than
attempting to use a file that won't exist or isn't secure.
2019-02-04 08:21:11 +00:00
mrg fd676684f8 - avoid uninitialised memory usage 2019-02-04 04:37:50 +00:00
mrg 1fcf7be45f - use -Wno-error=implicit-fallthrough with GCC7. 2019-02-04 04:05:15 +00:00
mrg 2c04daffef add some fallthru comments. 2019-02-04 03:30:20 +00:00
thorpej 68e270a267 Implement support for "pshared" POSIX semaphores.
Fixes lib/53273 (and Firefox's multi-process tab feature).
2019-02-03 03:20:23 +00:00
isaki 8b1980912d Fix minor bugs of SNDCTL_DSP_GETISPACE.
- hiwat is playback-only parameter.
- 'bytes' should not be rounded down.
2019-02-02 04:52:16 +00:00
maxv 2089a3819a Fix two issues:
* Uh I put the wrong masks in some GPRs, fuck.

 * When the opsize of MOVZX is 4, we need to combine the zero-extend from
   the instruction with the natural zero-extend of long mode.

Add two associated tests.
2019-02-01 06:49:58 +00:00
mrg 7d08015811 make the backtrace()'s tracer() return _URC_FOREIGN_EXCEPTION_CAUGHT
when the array is full.  it won't be able to do any more work if so,
and avoids infinite loops in unwinding as seen on arm64.

XXX:  lack of signal support here means that backtrace() is useless
XXX:  from a signal handler, such as attempting to display the stack
XXX:  when handling a SIGSEGV.
2019-01-30 22:46:49 +00:00
isaki 6b4163e9ca Revert a wrong SNDCTL_DSP_GETOSPACE part of rev1.33.
- 'fragments' is the number of full free blocks and should not be
  negative value.
- 'bytes' should not be rounded down.
It makes mpv work correctly (fixes a second half of kern/53028).
Reviewed by mlelstv@
2019-01-29 11:54:02 +00:00
dholland ad8aa774f5 fix duplicated chunk from merge 2019-01-27 04:33:29 +00:00
dholland a5dfc9a7f2 fix another mergeo 2019-01-27 02:42:32 +00:00
dholland f4d9309d1d fix mergeo 2019-01-27 02:40:49 +00:00
pgoyette d91f98a871 Merge the [pgoyette-compat] branch 2019-01-27 02:08:33 +00:00
maxv c07836be52 Ah, fix bug: when the opcode has an immediate, we fill the src with a
register storage, but then we overwrite it without zeroing out the highest
bits of the resulting immediate (which may contain garbage from the union).
2019-01-26 14:44:54 +00:00
mrg 6339cfba17 remove the new check for tlen >= PTRDIFF_MAX. the prior
checks assure the condition is met and GCC7 is happy.

suggested by kre.
2019-01-24 22:07:14 +00:00
christos c959ea2c0d PR/53904: Jintao Zhu: Use a mutex instead of an rwlock to assure thread safety 2019-01-24 18:01:38 +00:00
uwe 7142fa3957 It's section 3 page, not section 2. While here, xref puffs(3) in the
SEE ALSO section too.
2019-01-23 19:43:49 +00:00
kre bcc54a5c42 And as long as we're attempting to achieve perfection in code
that is never going to be executed, let's also check for possible
overflow in a sum that will never be computed...
2019-01-23 02:48:48 +00:00
kre 1f29642da2 There's no point setting errno, it is just overwritten by err
in the exit path ... this function never fails, it simply sometimes
doesn't actually expand the %m and just leaves the format string
intact.

And declare variables at the head of their scope, not at some random
place in the middle of the code, whatever C allows, that is just ugly.
2019-01-23 02:32:06 +00:00
christos 223b7e5915 limit allocation to PTRDIFF_T to appease gcc-7, from mrg@ 2019-01-23 02:00:00 +00:00
mrg bfe7e5d8b3 memset to zero the entire array, not just 8 bytes of it.
picked up by gcc7's checker that the array size has not
been multipled by the member size.

here, we had 8 but should have had 8 * sizeof(int).

XXX: real bug - pullup-7, pullup-8
2019-01-23 00:08:06 +00:00
mrg 1fbe8d0596 remove diag assert - the compiler demands fp is non NULL now. 2019-01-23 00:05:47 +00:00
rmind 3d9a792dd8 Major NPF improvements:
- Convert NPF connection table to thmap.  State lookup is now lock-free.
- Improve connection state G/C: it is now incremental and tunable.
- Add support for dynamic NAT address.  Translation addresses can now be
  selected from a pool of addresses.  There are two selection algorithms,
  "ip-hash" and "round-robin" (see the man page).
- Translation address can be specified as e.g. ifaddrs(wm0) in npf.conf
  to dynamically choose an IP from the interface address(es).
- Add support for the NETMAP algorithm with static NAT for net-to-net
  translation (it is equivalent to iptables NETMAP logic).
- Convert 'ipset' tables to use thmap; the table lookup is now lock-free.
- Misc improvements, bug fixes and more unit tests.
- Bump NPF_VERSION (will also bump libnpf).
2019-01-19 21:19:31 +00:00
wiz f401b5d182 Use \- for minus. 2019-01-15 07:01:01 +00:00
uwe 3e392f0443 Fly, nasal demons, fly away... 2019-01-15 03:43:15 +00:00
riastradh f5a847d300 Use the same variable for the locale example. 2019-01-15 03:30:58 +00:00
uwe 326784a6c3 Don't talk about "the first argument" when there's only one. 2019-01-15 01:23:49 +00:00
uwe 31759755bb Fix markup pasto. 2019-01-15 01:13:49 +00:00
uwe 2a102dd013 Remove the extra cast to int in the CAVEATS example.
We removed it from EXAMPLES a few releases ago.
2019-01-15 01:11:03 +00:00
uwe 893d5ca890 Fix typo in macro flag. 2019-01-15 00:43:32 +00:00
riastradh 2712861341 Expand on correct and incorrect usage, and on compiler warnings.
Give an example program with the warning, and some example nonsense
outputs.  Also note why glibc's approach doesn't solve the problem.
2019-01-15 00:31:19 +00:00
kre 4426ee8da1 Whitespace (indent with tabs, rather than spaces), and rearrange one
line that needed wrapping so it no longer does, and is (IMO) clearer.
WHile here, note that this was created in 2019, not 2018, for the
copyright notice...

NFCI.
2019-01-14 03:30:25 +00:00
maxv 7ceb32d30a Handle more corner cases, clean up a little, and add a set of instructions
in Group1.
2019-01-13 10:43:22 +00:00
kre 7b39a1eecc Always return from expandm() with errno unaltered, so on the
off chance it failed, there's still the possibility that whatever
processes the result will be able to deal with the %m that would
(presumably) be left in the format string.

And as a frill, don't call strerror() until we know we are
going to use its result (still call it only once, no matter
how many %m's are in the format string).
2019-01-13 06:10:34 +00:00
christos 3359bf52a4 check for *. integer overflow over ptrdiff. Pointed out by kre@ 2019-01-13 01:32:51 +00:00
kre c323915498 Make expandm() return a const char * so we can do away with __UNCONST()
and more importantly, so that we don't accidentally return a value
that is a const char * in reality (pointer to read only string) as a
char *.
2019-01-12 22:14:08 +00:00
christos a55f258316 Don't do %%m -> %%%m escaping, requested by gson@. 2019-01-12 21:50:29 +00:00
kre 63c2be2dac Return the buffer that has not been freed, so it can be later,
rather than the one that already was.
2019-01-12 21:05:37 +00:00
christos 94a22d4c76 Provide an extra argument to store the returned pointer so we can use
the function directly as the return format (before assigning it to a
variable) to appease clang.
2019-01-12 19:08:24 +00:00
christos feb39a8c47 Use a utility function to expand %m correctly... 2019-01-11 20:37:30 +00:00
christos f326096470 let's try one more time: prepare the format to pass to syslog instead
of trying to escape %m.
2019-01-11 16:15:20 +00:00
christos 87cda185f0 instead of handling %m inline, escape it. 2019-01-11 13:05:57 +00:00
dholland 43fda370f5 At some point we lost the text that explains the difference between
clear() and erase(). Or possibly we never had any. Put some back.
Bump date.
2019-01-11 06:14:39 +00:00
christos 11e9eb638e PR/53856: F. Aragon: editline/libedit not prompting colors in readline mode 2019-01-10 18:41:56 +00:00
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