Repository navigation
Conversation
|
[AUTOMATED] The proof is sound in everything we built (4,700+ recovered names checked against linker relocations, 0 wrong), but it never fires on a normally linked image. Repro, the body's example linked through the compiler driver: powerpc-linux-gnu-gcc -shared -msecure-plt -Wl,--strip-all tmp/ppc32-pic/check.o -o tmp/ppc32-pic/check-gcc.so
kuna decompile tmp/ppc32-pic/check-gcc.so check --mode fast --option ppc32picimports on # still sub_620();crtbeginS.o calls through CTR, and one uncertified caller withdraws every contract in the image. The same happens when any function has Tracking the exact registers each unhandled instruction writes doesn't move any of those off 0. Scoping a failure to the stubs its caller reaches would, but needs an argument for why an uncertified transfer cannot enter other stubs. Could you make recovery reach compiled images (e.g. scoped failure under stated ABI assumptions, local-call summaries, calls through GOT-loaded import pointers) before this lands? I pushed two commits: a per-image cache of the proof plus a linear lazy-resolver scan (option-on load of an 8,201-import image 2.9x -> 1.2x of option-off; a crafted 16,000-resolver image 47 s -> 0.06 s), the option-off GNU assertion restored, and docs stating the current reach. |
|
[AUTOMATED] I extended the proof (pushed printf '%s\n' 'extern void __stack_chk_fail(void), other(void), another(void), extra(void);' \
'void refs(void) { other(); another(); extra(); __stack_chk_fail(); }' \
'int check(void) { extra(); return 7; }' |
powerpc-linux-gnu-gcc -O1 -fPIC -msecure-plt -fno-asynchronous-unwind-tables -x c -c - -o check.o
powerpc-linux-gnu-gcc -shared -msecure-plt -Wl,--secure-plt check.o -o check-gcc.so
kuna decompile check-gcc.so check --mode fast --option ppc32picimports onBefore this push the call printed as What changed
Results (raw proof output, before demangling)
Default. It stays off. With the loader gate forced on, the datatests (675/675) and the stage tests still match their baselines exactly. But with it on, listing a PPC32 PIC image's functions takes 1.1x to 1.7x as long (Lua .so 1.17x, libstdc++ 1.33x, libc 1.49x). A single-function decompile of a large library takes up to about 3x as long (libc |
|
Oops, sorry I was working on this. I'll rebase and see if any of my updates help - things slow here as many other tasks running!! 😀 |
|
[AUTOMATED] @phix33, before you rebase: we pushed
It also fixes a crafted 6 KB Results after the fixes:
One case is still open, and the spec now states it as part of assumption (5). A callee stores a return address it received in r0, and another function later jumps there with its own r30. In the repro below, The cheap rule would be to give up whenever a return address sits in a register at a local call. It costs 38% of libstdc++'s names and 88% of Lua -O1's. Could the walk instead give volatile registers symbolic entry values, so a callee that stores an incoming register is seen as leaking whatever its caller passed?
stash-one.s .macro PRO l
stwu 1,-32(1)
mflr 0
bcl 20,31,\l
\l: stw 30,24(1)
mflr 30
addis 30,30,.LCTOC1-\l@ha
stw 0,36(1)
addi 30,30,.LCTOC1-\l@l
.endm
.macro EPI
lwz 0,36(1)
lwz 30,24(1)
addi 1,1,32
mtlr 0
blr
.endm
.section ".got2","aw"
.LCTOC1 = .+32768
.long 0
.section ".bss"
.align 2
saved_ra: .long 0
.text
.globl refs, c, h
.type refs,@function
.type c,@function
.type h,@function
refs: PRO .L0
bl aaa+32768@plt
bl bbb+32768@plt
bl ddd+32768@plt
EPI
c: PRO .L1
bl a # a's return address (c+0x24) reaches stash in r0
bl ccc+32768@plt # named ccc; h re-enters here with r30-4
EPI
a: PRO .L2
bl stash
EPI
stash: mflr 11 # store the caller's r0 for h
bcl 20,31,.L3
.L3: mflr 12
mtlr 11
addis 12,12,saved_ra-.L3@ha
stw 0,saved_ra-.L3@l(12)
cmpwi 3,0
beq 1f
1: blr
h: PRO .L4
bcl 20,31,.L5
.L5: mflr 12
addis 12,12,saved_ra-.L5@ha
lwz 9,saved_ra-.L5@l(12)
addi 30,30,-4
mtctr 9
bctr |
610f7af to
d40a5c9
Compare
Recover imported names and terminal calls in PPC32 PIC code. With GCC and GNU PowerPC binutils:
Adding
--option ppc32picimports onnames__stack_chk_failand removes the final return. Withabi,checkalso changes fromsub_5c0(); return 7;toextra(); return 7;.Implementation
onproves terminal calls in their caller context; returning imports invalidate later slot reads.abienables broader stub naming under documented compiler and ABI assumptions, including that application code leaves GOT slots intact.abiin the console requires reload. Recovered xrefs include instruction text.Tests
Both byte orders cover counted branches, slot overwrites, callbacks, xrefs and unaligned stores; the overlapping-store regression fails before the fix. A large synthetic unwind image checks scaling. Focused tests, parity, spec and catalog checks pass. The full workspace retains nine pre-existing failures.