-
-
Notifications
You must be signed in to change notification settings - Fork 478
Description
note: this issue cannot be reproduced before #3475 is merged as rz-gg just doesn't work without it.
it seems like shellforge had a regression in i386 binary generation when calling syscalls.
the problem was introduced in rizin in PR #2428 which updated the autogenerated sflib. as can be seen, the argument constaints of the syscall wrappers changed from r (general purpose register) to g (which allows memory locations too). this can cause problems as the syscall functions save ebx on the stack which moves esp without the compiler knowledege which can make it reference stack saved arguments wrongly.
i opened a PR to shellforge4 at whatsbcn/shellforge4#7. when it is fixed, i think it should suffice to regenerate sflib and update rizin's sflib.
Expected behavior
when compiling
int log(char *s, int l) {
write(2, s, l);
}
int main() {
log("hello", sizeof("hello"));
log(" ", sizeof(" "));
log("world!", sizeof("world!"));
exit(0);
}via rz-gg -b 32 -a x86 -F -O test.c and running ./test hello world! should be printed
Actual behavior
hello is printed.