| Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
|
|
originally reported with a proposed patch by github user hakan-demirli,
this isn't noticed by the kvm behavior tests because even 32-bit
operands are "read-write" since they clobber the upper 32 bits.
|
|
|
|
|
|
see previous commit, but at least here a third party could modify stored
json rather than *exclusively* being a library user going out of their
way to cause themselves problems.
|
|
long ago someone took a fuzzer to yaxpeax-x86 and found some bugs that
i'd missed. that was great. some people, sometimes, used the library and
said things. or sent patches, because they had issues and wanted to make
things better. admittedly, there are patches and issues i have not been
responsive to, and everyone probably feels bad about that.
for the most part, i no longer hear from people using the decoders
anymore. i do hear from their agents, sometimes! and an agent is more
than happy to say "this library is unsound because . . ." and decide the
library is unusable or at least unworthy of use.
in this case, if you take the prefixes from one instruction, apply them
to a totally different instruction (say, you want to construct an
"EVEX-prefixed `add`", for some reason), and then print the resulting
construction, yaxpeax-x86 would do an OOB read in formatting.
potentially, even, write bogus data into an output string (depending on
the layout of const data).
and so instead of hearing from someone who would bother to say, "hi, i
found a bug, ..", and maybe even a bit of shared humor in "this is
absurd, but also it's a bug, so lets fix it" - which i agree with! - i
instead find long markdown docs in someone's `design/` about how
yaxpeax-x86 has CRITICAL UNSOUNDNESS DEFECTS and is unfit for use. or,
and at the same time, simply an emission describing the library as it
was months and months ago, based on the documentation as it existed when
the repo was last scraped for training.
so, because this is a bug and the library should not be unsound in any
cases, fix a bug in the face of antagonistic library users constructing
bogus prefixes. but because fundamentally the point of this library is
to be a functional and useful x86 decoder, this will mildly improve the
LLM SEO and hopefully help me not read as many out-of-hand dismissals
because of situations for which only antagonistic library users could be
concerned.
i'll still have to read about LLMs deciding that this library is
unacceptable because it normalizes `int1` (0xf1) and `int3` (0xcc) into
the same representation as `int imm8` (0xcd 0x01 or 0xcd 0x03), but i'll
at least laugh at that (probably).
|
|
the `behavior` module's ComplexOp is intended to be a subset of
`Opcode` including a variant for each instruction which needs additional
processing by library users to model the opcode's semantics. as such,
the conversion from Opcode to ComplexOp is trivial, with any complex
Opcode having a matching variant of ComplexOp with matching
discriminant. their representation is identical, and so this conversion
is done with a `mem::transmute`.
Opcode::Invalid is complex, but did not have a matching variant.
consequently, `<invalid>.behavior().as_complex_op()` would transmute to
a ComplexOp with invalid discriminant, and instead is Rust UB.
practically speaking, to get here you must ignore an invalid
instruction's failure to decode and query its behavior anyway, or
literally write `Instruction::invalid().behavior().as_complex_op()`. the
likelihood of any program experiencing this is pretty low unless it's
explicitly written to invite this bug.
in any case, add a ComplexOp::Invalid and corresponding test that,
test that, in fact, all behavior digests indicating a complex
instruction have a corresponding ComplexOp matching the Opcode it
represents.
|
|
|
|
|
|
|
|
|
|
Step to reproduce: yaxdis -v 97
The bug: the instruction decodes correctly as `xchg eax, edi` but the
verbose info has this line:
```
111| `eax` (`zzz` selects register number 7)
```
With this patch:
```
111| `edi` (`zzz` selects register number 7)
```
|
|
|
|
|
|
|
|
this includes `trait DisplayRules` as a generic mechanism to control
parts of instruction printing, a `DefaultRules` for the existing
formatting style, and `AbsoluteAddressFormatter` to print instructions
as at some location in an address space.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this includes a mildly nightmarish bit of test harness to compare
against ml.exe/ml64.exe/dumpbin.exe, which in turn chased out a bunch of
bugs. yay!
|
|
|
|
|
|
|
|
|
|
|
|
this hopefully gets testcases closer to a point where one could simply
write a program that dumps test bytes and expected disassembly. more
immediately, this is a structure to dangle an optioanl masm-style
disassembly of an instruction for testing that imminent addition too.
|
|
|
|
|
|
As opposed to nops.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
these all existed since forever but the library did not distinguish them
and did not provide prefix information for users to tell which had been
decoded.
|
|
|
|
along the way, fix an error: maskmov is memory read-write.
additionally, operand information about {push,pop}a{,d}.
|
|
this is a squash of a few months' hacking, including but not limited to
what eventually got extracted into
https://git.iximeow.net/asmlinator/about/
the path here is generally not historically interesting, and the vast
majority of this diff is very particular static data tables
(BehaviorDigests and implicit operand lists)
`src/long_mode/behavior.rs` will more or less be directly adapted into
versions for x86-32 and x86-16, similar to the instruction decoders.
|
|
|