Commit Graph

16501 Commits

Author SHA1 Message Date
Mark Wielaard
2d040ce2c7 arm: Hook up preadv2 and pwritev2 syscalls.
They work the same as on other linux architectures.
2020-01-25 15:10:26 +01:00
Mark Wielaard
6cbd9ad1a1 guest_generic_bb_to_IR.c (stmt_is_guardable): Handle Ist_LoadG.
Triggers on Fedora 31 armv7hl with glibc 2.30 in _dl_relocate_object.
2020-01-25 15:00:32 +01:00
Mark Wielaard
2dab324986 Fix tests/x86/incdec_alt.c asm for GCC10.
Thanks to Jakub Jelinek. The test is broken. It blindly assumes the
toplevel inline asm is placed into some sensible section, but that is
a wrong assumption. The right thing is to start the inline asm with
.text directive and end with .previous. The reason gcc 10 breaks it
is the -fno-common default, the int r1, ... vars are emitted into .bss
section and that is the section that is current when the inline asm is
emitted previously they were in .common at the end of the assembly file.
2020-01-24 11:43:10 +01:00
Julian Seward
4c39fd9a00 Work around apparently-bogus warning from gcc 10. 2020-01-24 11:02:53 +01:00
Mark Wielaard
ee18ab11dd Fix GCC10 issue in guest_s390_defs.h typedef enum type s390x_vec_op_t.
GCC10 defaults to -fno-common which produces this error:

  guest_s390_defs.h:291: multiple definition of `s390x_vec_op_t

This is because GCC10 detects there are multiple definitions of the
variable s390x_vec_op_t. We don't want to define a variable though.
We had wanted to define a type (one that currently isn't used).
Fix this by making it a typedef enum.

https://bugzilla.redhat.com/show_bug.cgi?id=1794482
2020-01-23 21:30:59 +01:00
Stefan Maksimovic
0baeea7813 mips: update none/tests/mips32/msa_fpu.c
Guard withinEpsOf[FD] within none/tests/mips32/msa_fpu.c

Enclose the recently introduced functions with preprocessor guards,
much like the rest of the code is inside the main function.
Also mark the functions as static.
Minor code formatting.
2020-01-23 13:32:56 +00:00
Julian Seward
9dcd3ab1f6 Fix some spelling errors found by Lintian. Patch from Alessandro Ghedini <ghedo@debian.org>. 2020-01-23 10:53:36 +01:00
Julian Seward
16eb4436e2 iselV128Expr_wrk: handle Iex_ITE. This is needed by the recent 'grail' changes. n-i-bz. 2020-01-22 11:39:53 +01:00
Julian Seward
c82d35f6d6 arm64 front end: add support for 'dc civac', handling it the same as 'dc cvau'.
This partially fixes #412377.
2020-01-22 11:21:53 +01:00
Julian Seward
dad7f1d717 Enable sys_adjtimex() on arm-linux. Fixes #412408. 2020-01-22 11:03:54 +01:00
Julian Seward
c88133141a Bug 407376 - Update Xen support to 4.12 (4.13, actually) and add more coverage.
Patch from Tamas K Lengyel (tamas@tklengyel.com).
2020-01-22 10:55:33 +01:00
Julian Seward
685247b67a Bug 416464 - Handle ioctl PR_CAPBSET_READ/DROP.
Patch from Stefan Bruens (stefan.bruens@rwth-aachen.de).
2020-01-22 10:45:40 +01:00
Julian Seward
3542be5bdc Bug 385386 - Assertion failed "szB >= CACHE_ENTRY_SIZE" on m_debuginfo/image.c:517.
Patch from Reimar Doeffinger (kde@reimardoeffinger.de).
2020-01-22 10:32:31 +01:00
Julian Seward
6e0573777c Bug 415757 - vex x86->IR: unhandled instruction bytes: 0x66 0xF 0xCE (bswapw).
Implement bswapw, even though the instruction does not officially exist.  Patch
from Alex Henrie (alexhenrie24@gmail.com).
2020-01-22 09:31:57 +01:00
Julian Seward
95a44677c1 Update bug lists. 2020-01-22 09:08:54 +01:00
Mark Wielaard
f12114be23 Add bugs 416239 and 416387 to NEWS.
commit 58fc707804
416239  valgrind crashes when handling clock_adjtime

commit 7d4071fe85
416387  finit_module and bpf syscalls are unhandled on arm64
2020-01-18 02:09:49 +01:00
Alexandra Hajkova
7d4071fe85 arm64: hook up finit_module and bpf syscalls
This fixes "WARNING: unhandled arm64-linux syscall" in
delete_module01 and bpf_prog01 tests in the LTP test suite.
2020-01-18 01:44:33 +01:00
Stefan Maksimovic
0483f86aac mips64: fix assert in host_mips_defs.c for Malu_MADD
Mark the immediate as signed for Iex_Get and Ist_Put for Ity_V128 on BE.

The Malu_MADD case in emit_MIPSInst in VEX/priv/host_mips_defs.c expects a
signed immediate, hence the change.

This fixes an assert in host_mips_defs.c.
2020-01-17 13:19:44 +00:00
Stefan Maksimovic
3e0e34aecd mips64: rework math tests to take into account allowed approximation
Change the math tests to check whether the results are approximate to the
expected values instead of checking for exact matches since the calculations
in question are allowed to be approximate.

This fixes
  /none/tests/mips64/test_math and
  /none/tests/mips64/msa_fpu

on mips64r6.
2020-01-17 12:58:07 +00:00
Bart Van Assche
d6efbcb0b5 drd/tests/std_mutex: Add a unit test for std::mutex 2020-01-15 20:01:40 -08:00
Bart Van Assche
bb8c57ec64 drd: Fix 'conflicting load' error on std::mutex::lock() 2020-01-15 20:00:06 -08:00
Bart Van Assche
2d8192a2a7 drd/tests/Makefile.am: Fix indentation 2020-01-15 19:55:47 -08:00
Mark Wielaard
6f9a8d619d priv/guest_generic_bb_to_IR.c stmt_is_guardable(): Add Ist_Dirty.
This might happen when the source contains something like
if (something_involving_pcmpxstrx && foo) { .. }
which might use amd64g_dirtyhelper_PCMPxSTRx.
2020-01-15 18:11:24 +01:00
Alexandra Hájková
58fc707804 syswrap-linux.c: fix clock_adjtime handling
Not checking whether valgrind can dereference timex pointer
casues VALGRIND INTERNAL ERROR while handling clock_adjtime.
2020-01-15 16:01:12 +01:00
Petar Jovanovic
8b809cdbba mips: Implement Iex_CCall for nanoMIPS
Implement Iex_CCall for nanoMIPS.

This fixes none/tests/nestedfns.

Patch by Stefan Maksimovic.
2020-01-14 17:45:00 +00:00
Petar Jovanovic
3501c118df mips: Fix BEQC[16] and BNEC[16] instructions for nanoMIPS
Instruction decoding was not correct. In some cases, BEQC has been decoded
as BNEC and vice versa.

It caused problems with musl malloc() function.

Patch by Stefan Maksimovic.
2020-01-14 17:37:21 +00:00
Aleksandar Rikalo
d7b2a29718 mips: Fix return from syscall mechanism for nanoMIPS
- Restore guest sigmask in VG_(sigframe_destroy)
- Use "syscall[32]" asm idiom instead of "syscall" with immediate parameter
  in VG_(nanomips_linux_SUBST_FOR_rt_sigreturn)
- Call ML_(fixup_guest_state_to_restart_syscall) from PRE(sys_rt_sigreturn)
- Tiny code refactor of sigframe-nanomips-linux.c

This fixes none/tests/thread-exits.
2020-01-14 17:24:29 +00:00
Petar Jovanovic
8557d21928 mips: Add membarrier syscall for nanoMIPS
This fixes none/tests/linux/membarrier.
2020-01-14 12:43:13 +00:00
Petar Jovanovic
ab8807ee53 mips: Add Iop_ROTX for nanoMIPS
Implement Iop_ROTX and use it for ROTX instruction.
Fixes libvexmultiarch_test and libvex_test.

Patch by: Aleksandra Karadzic and Nikola Milutinovic.
2020-01-14 12:40:09 +00:00
Aleksandar Rikalo
8b7a3a2107 mips: Fix UASWM and UALWM instructions for nanoMIPS
UASWM and UALWM have not been implemented correctly.
Code used to implement SWM and LWM has been reused without making all of
the required adjustments.

This fixes memcpy() and memset() libc functions.
2020-01-14 12:09:18 +00:00
Aleksandar Rikalo
0fb2f59f57 mips: Change client request convention for nanoMIPS
Use a7/t0 register pair for for client requests. The same convention is
used throughout the rest of the code, as well as for mips32/64.
2020-01-14 12:07:11 +00:00
Aleksandar Rikalo
d4d92fe5db mips: Fix Ist_CAS for nanoMIPS
This code portion introduced a SEGFAULT:

-  if (&i->NMin.Cas.sz){
+  if (i->NMin.Cas.sz == 8) {

The implementation of Ist_Cas has been fixed and missing logging has been
added as well.
2020-01-14 12:04:31 +00:00
Aleksandar Rikalo
43c90db16f mips: Fix SAVE instruction for nanoMIPS
During a save (push) instruction adjusting the SP is required before doing
a store, otherwise Memcheck reports warning because of a write operation
outside of the stack area.
2020-01-14 11:54:15 +00:00
Petar Jovanovic
6eb5b451d3 mips: Fix BRSC and BALRSC instructions for nanoMIPS
Basic blocks should be terminated after detecting branch instruction.
2020-01-14 09:48:56 +00:00
Petar Jovanovic
1d3a772034 mips: Fix clone syscall for nanoMIPS
- Reset syscall return register (a0) in clone_new_thread()
- Use "syscall[32]" asm idiom instead of "syscall" with immediate parameter
  in ML_ (call_on_new_stack_0_1)()
- Optimize stack usage in ML_ (call_on_new_stack_0_1)()
- Code refactor of ML_ (call_on_new_stack_0_1)()

It partially fixes all tests which use clone system call, e.g. none/tests/pth_atfork1.

Patch by Aleksandar Rikalo.
2020-01-14 09:31:48 +00:00
Petar Jovanovic
3e48ab0803 mips: add IOP_And1 and Iop_Or1 for nanoMIPS
Support IOP_And1 and Iop_Or1 in iselWordExpr_R_wrk().
2020-01-09 18:28:57 +00:00
Petar Jovanovic
f6ce74cd7b mips: Implement Iop_CmpNEZ32, Iop_CmpNEZ64, Iop_And1 and Iop_Or1
Implement Iop_CmpNEZ32, Iop_CmpNEZ64, Iop_And1 and Iop_Or1
and fix broken Memcheck for mips32/64.
2020-01-09 19:05:07 +01:00
Petar Jovanovic
cb62332c32 mips: update NEWS and README.mips
Patches from Bug #400872 (Add nanoMIPS support to Valgrind) have been
merged.

Update README.mips with a correct configure line applicable for the latest
nanomips toolchain package in public.
2020-01-06 16:51:37 +00:00
Petar Jovanovic
9acc066ffc mips: Add tests for nanoMIPS instruction set
Patch by Tamara Vlahovic, Aleksandar Rikalo and Dimitrije Nikolic.

Related KDE issue: #400872.
2020-01-03 17:31:35 +00:00
Julian Seward
2a7d3ae768 sys_statx: don't complain if both |filename| and |buf| are NULL.
So as to work around the Rust library's dubious use of statx.
2020-01-02 14:27:24 +01:00
Julian Seward
cadd909935 amd64 insn selector: improved handling of Or1/And1 trees.
This splits function iselCondCode into iselCondCode_C and iselCondCode_R, the
former of which is the old one that computes boolean expressions into an amd64
condition code, but the latter being new, and computes boolean expressions
into the lowest bit of an integer register.  This enables much better code
generation for Or1/And1 trees, which now result quite commonly from the new
&&-recovery machinery in the front end.
2020-01-02 09:32:19 +01:00
Julian Seward
4eaa80103d amd64 back end: generate 32-bit shift instructions for 32-bit IR shifts.
Until now these have been handled by possibly widening the value to 64 bits,
if necessary, followed by a 64-bit shift.  That wastes instructions and code
space.
2020-01-02 09:23:46 +01:00
Julian Seward
7239439e84 Enable expensive handling of CmpEQ64/CmpNE64 for amd64 by default.
This has unfortunately become necessary because optimising compilers are
generating 64-bit equality comparisons on partially defined values on this
target.  There will shortly be two followup commits which partially mitigate
the resulting performance loss.
2020-01-02 09:12:52 +01:00
Julian Seward
79dd0bd6e8 Fold Iop_CmpEQ32x8(x,x) to all-1s ..
.. hence treating it as a dependency-breaking idiom.  Also handle the
    resulting IRConst_V256(0xFFFFFFFF) in the amd64 insn selector.

(dup of 96de5118f5332ae145912ebe91b8fa143df74b8d from 'grail')

Possibly fixes #409429.
2020-01-02 08:00:07 +01:00
Julian Seward
61a634b607 'grail' fixes for MIPS:
This isn't a good result.  It merely disables the new functionality on MIPS
because enabling it causes segfaults, even with --tool=none, the cause of
which are not obvious.  It is only chasing through conditional branches that
is disabled, though.  Chasing through unconditional branches (jumps and calls
to known destinations) is still enabled.

* guest_generic_bb_to_IR.c bb_to_IR(): Disable, hopefully temporarily, the key
  &&-recovery transformation on MIPS.

* VEX/priv/host_mips_isel.c iselWordExpr_R_wrk(), iselCondCode_wrk():

  - add support for Iop_And1, Iop_Or1, and IRConst_U1.  This code is my best
    guess about what is correct, but is #if 0'd for now.

  - Properly guard some Iex_Binop cases that lacked a leading check that the
    expression actually was a Binop.
2020-01-02 06:45:02 +01:00
Julian Seward
8d510c468a 'grail' fixes for s390x:
This isn't a good result.  It merely disables the new functionality on s390x,
for the reason stated below.

* guest_generic_bb_to_IR.c bb_to_IR(): Disable, hopefully temporarily, the key
  &&-recovery transformation on s390x, since it causes Memcheck to crash for
  reasons I couldn't figure out.  It also exposes some missing Iex_ITE cases
  in the s390x insn selector, although those shouldn't be a big deal to fix.

  Maybe it's some strangeness to do with the s390x "ex" instruction.  I don't
  exactly understand how that trickery works, but from some study of it, I
  didn't see anything obviously wrong.

  It is only chasing through conditional branches that is disabled for s390x.
  Chasing through unconditional branches (jumps and calls to known
  destinations) is still enabled.

* host_s390_isel.c s390_isel_cc(): No functional change.  Code has been added
  here to handle the new Iop_And1 and Iop_Or1, and it is somewhat tested, but
  is not needed until conditional branch chasing is enabled on s390x.
2020-01-02 06:45:02 +01:00
Julian Seward
076a79a48e 'grail' fixes for ppc32 and ppc64:
* do_minimal_initial_iropt_BB: for ppc64, flatten rather than assert flatness.
  (Kludge. Sigh.)

* priv/host_ppc_isel.c iselCondCode_wrk(): handle And1 and Or1, the
  not-particularly-optimal way

* priv/host_ppc_isel.c iselCondCode_wrk(): handle Ico_U1(0).
2020-01-02 06:45:02 +01:00
Julian Seward
1df8c25b42 'grail' fixes for arm32:
* priv/guest_generic_bb_to_IR.c expr_is_guardable(), stmt_is_guardable():
  add some missing cases

* do_minimal_initial_iropt_BB: add comment (no functional change)

* priv/host_arm_isel.c iselCondCode_wrk(): handle And1 and Or1, the
  not-particularly-optimal way
2020-01-02 06:45:02 +01:00
Julian Seward
1fa3bc8f54 'grail' fixes for arm64:
* guest_arm64_toIR.c: use |sigill_diag| to guard auxiliary diagnostic printing
  in case of decode failure

* guest_generic_bb_to_IR.c expr_is_guardable(), stmt_is_guardable(): handle a
  few more cases that didn't turn up so far on x86 or amd64

* host_arm64_defs.[ch]:

  - new instruction ARM64Instr_Set64, to copy a condition code value into a
    register (the CSET instruction)

  - use this to reimplement Iop_And1 and Iop_Or1
2020-01-02 06:44:48 +01:00
Julian Seward
e404fe924c bb_to_IR(): Avoid causing spurious SIGILL-diagnostic messages ..
.. when speculating into conditional-branch destinations.  A simple change
requiring a big comment explaining the rationale.
2020-01-02 06:42:21 +01:00