Elektrine
EN
Log in Register
Paige Chat Timeline Communities Gallery Videos Email DNS VPN Uptime Kairo
Back to Timeline
Remote

Evan Martin

@evmar@inuh.net
  • Open on inuh.net
0 Followers
0 Following
18 Posts
Joined November 15, 2022
website:
https://neugierig.org

Posts

Open post
evmar
Evan Martin @evmar@inuh.net · May 01, 2026
Evan Martin
@evmar@inuh.net
inuh.net

Pet peeve: Rust projects whose repo is organized as a bunch of directories like
crates/$projectname_foo
crates/$projectname_bar

1) This is not organization! This is ravioli code. Directories and their nesting convey relationships.
2) You don't need to repeat the project name in every crate. In other words, the crate name is not required to match the directory name. If a project has a myproject-async-interp crate, it is easy to figure out that the path named async-interp is its home.

0
1
1
0
Open post
evmar
Evan Martin @evmar@inuh.net · Apr 29, 2026
Evan Martin
@evmar@inuh.net
inuh.net
Replying to @evmar@inuh.net
@thakis Thinking about it more: also I've mostly written Rust the last few years and Rust is a lot worse than C++ in a debugger. E.g. you can't evaluate any complex expressions, and even evaluating a reference like "foo.bar.baz" in Rust you have to manually change to "foo.bar->baz" depending on whether any of the intermediate components are references or not.
2
1
0
0
Open post
evmar
Evan Martin @evmar@inuh.net · Apr 29, 2026
Evan Martin
@evmar@inuh.net
inuh.net
Replying to @thakis@serenityos.social
@thakis I think never before! I am so accustomed to debuggers never working that I don’t use them often, and then Mac makes everything worse by lldb being extra clunky. But also most of my emulator bugs of the past years have been bugs in my emulation, which is one level removed from the system debugger (until now!)
1
2
0
0
Open post
evmar
Evan Martin @evmar@inuh.net · Apr 29, 2026
Evan Martin
@evmar@inuh.net
inuh.net
Replying to @evmar@inuh.net
Anyway if you read the thread this far, here's a screenshot of the missing phase 2, now rendering properly.
5
4
0
0
Open post
evmar
Evan Martin @evmar@inuh.net · Apr 29, 2026
Evan Martin
@evmar@inuh.net
inuh.net
Replying to @evmar@inuh.net
Normally screwing up the stack pointer in this way makes things go immediately wrong elsewhere because it fails to return to the right address. But in this case, the function was using ebp to save/restore the stack pointer, totally masking that I had messed up the stack pointer -- except in how it was failing to preserve this register, the cause of this bug. This is the same masking @aaronsgiles wrote about in https://corteximplant.com/@aaronsgiles/116044322660755992 .
2
5
0
0
Open post
evmar
Evan Martin @evmar@inuh.net · Apr 29, 2026
Evan Martin
@evmar@inuh.net
inuh.net
Replying to @evmar@inuh.net
The culprit was a function that was using edi for its own purposes. It was correctly using push/pop edi to preserve the caller's value, but that was going wrong. The stdcall ABI used on Windows means the callee pops arguments off the stack. This means when the culprit function calls one of my functions and I had the arguments wrong, the stack pointer gets off by an entry or two. I've written this bug so many times! This meant the restored edi was instead some other garbage on the stack.
3
6
0
0
Open post
evmar
Evan Martin @evmar@inuh.net · Apr 29, 2026
Evan Martin
@evmar@inuh.net
inuh.net
Replying to @evmar@inuh.net
From there, I could see that phase2 was intended as a loop and that the loop was exiting. Again, because I have translated source code I could use my system debugger to step through it, though the control flow is harder than normal code. From there, I could see that edi was some sort of counter that started at 0, but after a single pass through the loop it had a garbage value. The system debugger's watch points tracked it down further, possibly the first time I've used those.
2
7
0
0
Open post
evmar
Evan Martin @evmar@inuh.net · Apr 29, 2026
Evan Martin
@evmar@inuh.net
inuh.net
Replying to @evmar@inuh.net
The first step was trying to isolate the problem. I disassembled enough of the code to figure out that the phases were (thankfully) pretty simple sequential code. The cool new thing about the static translation approach of Theseus is that I can modify the translated source code by hand, so it was easy to patch out the call to phase1 and panic in phase3, which reduced the problem to the program immediately entering and then leaving phase2.
3
8
0
0
Open post
evmar
Evan Martin @evmar@inuh.net · Apr 29, 2026
Evan Martin
@evmar@inuh.net
inuh.net

This morning I tracked down an emulator bug that manifested as rendering the first scene of a demo and then skipping directly to the third. This kind of thing is brutal (and kind of fun, sometimes) to track down because it is very hard to pinpoint the point where things have gone wrong.

3
9
0
0
Open post
evmar
Evan Martin @evmar@inuh.net · Apr 24, 2026
Evan Martin
@evmar@inuh.net
inuh.net

New blog post: Theseus unpacking
Revisiting unpacking executables.

https://neugierig.org/software/blog/2026/04/theseus-unpack.html

(A more structured description of my earlier ramble...)

neugierig.org

Tech Notes: Theseus unpacking

Revisiting unpacking executables.

1
0
0
0
Open post
evmar
Evan Martin @evmar@inuh.net · Apr 23, 2026
Evan Martin
@evmar@inuh.net
inuh.net
Replying to @evmar@inuh.net
(Code is not really up to my expectations for good shape for publishing, sorry in advance if you attempt to read it! Was a fun nerd snipe in any case.)
1
0
0
0
Open post
evmar
Evan Martin @evmar@inuh.net · Apr 23, 2026
Evan Martin
@evmar@inuh.net
inuh.net
Replying to @evmar@inuh.net
In any case, the flow looks like this: $ tc --exe chillin.exe --out exe/chillin-unpack ... WARN tc/src/traverse.rs:40 omitting 004085dd: block appears zero-filled (This shows the code jmp'd to 004085dd, but there was no code there -- that's where the unpacked code starts.) Then I can hand-write a file that provides that function, where it re-invokes the compiler: https://github.com/evmar/theseus/blob/9e2b135af2c32df73f0965c4f5f5159432fb80fe/exe/chillin-unpack/src/externs.rs Which means the whole do_unpack function ends up relatively tiny: https://github.com/evmar/theseus/blob/9e2b135af2c32df73f0965c4f5f5159432fb80fe/exe/chillin-unpack/src/main.rs
0
1
0
0
Open post
evmar
Evan Martin @evmar@inuh.net · Apr 23, 2026
Evan Martin
@evmar@inuh.net
inuh.net
Replying to @evmar@inuh.net
Unfortunately, I was so focused on how nifty this was that I overlooked the other reason to care about unpacking, which is loading the program in a tool like Ghidra. And for that I really do need an exe file.
0
2
0
0
Open post
evmar
Evan Martin @evmar@inuh.net · Apr 23, 2026
Evan Martin
@evmar@inuh.net
inuh.net
Replying to @evmar@inuh.net
The variation is: first run Theseus on the packed executable, producing a program that unpacks and then jumps to a dynamic address (the address of the unpacked code, which Theseus didn't see to translate). Then modify that program to implement that address, and implement it by a function that calls back into the Theseus compiler to generate source code directly. No intermediate exe serialization needed! The unpacker has the unpacked data in memory, so I can codegen directly from there.
1
3
0
0
Open post
evmar
Evan Martin @evmar@inuh.net · Apr 23, 2026
Evan Martin
@evmar@inuh.net
inuh.net

One of the (private) responses I got to my post about Theseus was someone asking if it can handle packed executables. It can't, of course, because they unpack more code at runtime.

But they totally nerd sniped me because for a one-time unpack I could just as well run two phases: first use Theseus to run the unpacker, modified to write out an executable, then run Theseus again on that.

In fact, there's a cooler variation I thought of, which I implemented!

3
4
0
0
Open post
evmar
Evan Martin @evmar@inuh.net · Apr 19, 2026
Evan Martin
@evmar@inuh.net
inuh.net

New blog post: Theseus, a static Windows emulator
An new old approach to emulation.

https://neugierig.org/software/blog/2026/04/theseus.html

57
0
19
1
Open post
evmar
Evan Martin @evmar@inuh.net · Apr 16, 2026
Evan Martin
@evmar@inuh.net
inuh.net

Speaking of common names, we gave our son a pretty unique one: his mom's last name was already rare, and his is a common name from a different part of the world such that the two together are almost certainly globally unique.

On one hand, this is kind of nice, to not have the name conflicts I encounter so often. On the other, sometimes I think it's kind of nice that you can never be quite sure whether some fact is about me or about some doppelnamer. It's almost a kind of privacy.

4
4
0
0
Open post
evmar
Evan Martin @evmar@inuh.net · Apr 01, 2026
Evan Martin
@evmar@inuh.net
inuh.net
Replying to @jyasskin@hachyderm.io
@jyasskin https://en.wikipedia.org/wiki/Contronym
1
0
0
0

Remote instance

inuh.net
Open on original server
313k7r1n3
Elektrine

Tor hidden service

elekhj7afj4qnrr4yd3bkzslsyo5jgfxw3orgjkhlcxifueodybyiiad.onion

Platform

  • Email
  • Chat
  • Timeline
  • Communities
  • VPN
  • DNS

Company

  • About
  • Contact
  • FAQ

Legal

  • Terms of Service
  • Privacy Policy
  • Warrant Canary
  • Lite (no JS)
  • VPN Policy
  • Source code

Support

  • support@elektrine.com
  • Report Security Issue
Mail client setup IMAP mail.elektrine.com:993 POP3 mail.elektrine.com:995 SMTP mail.elektrine.com:465
© 2026 Elektrine. All rights reserved. Server: 22:35:28 UTC