Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assert failed at X86FuncPrototypeDiscovery.cpp:227 #190

Open
Mis012 opened this issue Apr 5, 2023 · 2 comments
Open

assert failed at X86FuncPrototypeDiscovery.cpp:227 #190

Mis012 opened this issue Apr 5, 2023 · 2 comments
Labels
x86-64 Relates top raising x86-64 binaries

Comments

@Mis012
Copy link

Mis012 commented Apr 5, 2023

happened with first two random x86_64 binaries I tried, so statistically seems like it should be common, however
simple echo 'int main(int argc, char **argv) {printf("hello_world");}' >tst.c compiled with gcc is lifted without errors

llvm-mctoll: /llvm-project/llvm/tools/llvm-mctoll/X86/X86FuncPrototypeDiscovery.cpp:227: virtual llvm::FunctionType* llvm::mctoll::X86MachineInstructionRaiser::getRaisedFunctionPrototype(): Assertion `((OpType == MachineOperand::MachineOperandType::MO_Immediate) || (OpType == MachineOperand::MachineOperandType::MO_JumpTableIndex)) && "Unexpected block terminator found"' failed.

*** Please submit an issue at https://github.com/microsoft/llvm-mctoll
*** along with a back trace and a reproducer, if possible.
Stack dump:
0.	Program arguments: /llvm-project/build/bin/llvm-mctoll -d libsteam_api.so -I stub.h
 #0 0x0000559d56cc2844 PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
 #1 0x0000559d56cc02eb SignalHandler(int) Signals.cpp:0:0
 #2 0x00007f069f242ee0 __restore_rt (/lib64/libc.so.6+0x3dee0)
 #3 0x00007f069f29547c __pthread_kill_implementation /usr/src/debug/glibc-2.37/nptl/pthread_kill.c:44:76
 #4 0x00007f069f242e16 gsignal /usr/src/debug/glibc-2.37/signal/../sysdeps/posix/raise.c:27:6
 #5 0x00007f069f22b89c abort /usr/src/debug/glibc-2.37/stdlib/abort.c:81:7
 #6 0x00007f069f22b7ab _nl_load_domain.cold /usr/src/debug/glibc-2.37/intl/loadmsgcat.c:1196:9
 #7 0x00007f069f23b216 (/lib64/libc.so.6+0x36216)
 #8 0x0000559d573101fb llvm::mctoll::X86MachineInstructionRaiser::getRaisedFunctionPrototype() (/llvm-project/build/bin/llvm-mctoll+0x157c1fb)
 #9 0x0000559d572d8e5d llvm::mctoll::ModuleRaiser::runMachineFunctionPasses() (/llvm-project/build/bin/llvm-mctoll+0x1544e5d)
#10 0x0000559d5649ef80 disassembleObject(llvm::object::ObjectFile const*, bool) (.constprop.0) llvm-mctoll.cpp:0:0
#11 0x0000559d56442225 main (/llvm-project/build/bin/llvm-mctoll+0x6ae225)
#12 0x00007f069f22caf0 __libc_start_call_main /usr/src/debug/glibc-2.37/csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#13 0x00007f069f22cbb9 call_init /usr/src/debug/glibc-2.37/csu/../csu/libc-start.c:128:20
#14 0x00007f069f22cbb9 __libc_start_main@GLIBC_2.2.5 /usr/src/debug/glibc-2.37/csu/../csu/libc-start.c:347:5
#15 0x0000559d5648db75 _start /home/abuild/rpmbuild/BUILD/glibc-2.37/csu/../sysdeps/x86_64/start.S:117:0
Aborted (core dumped)
@Mis012
Copy link
Author

Mis012 commented Apr 5, 2023

example binary:
libsteam_api.so.gz

following supplied with -I:

#define _GNU_SOURCE

#define __fortify_function
#define __USE_FORTIFY_LEVEL 3 // > 1
#include <stdio.h>
#include <stdlib.h>
#include <bits/stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <ctype.h>
#include <string.h>
#include <sys/stat.h>
#include <dlfcn.h>
#include <unwind.h>
#include <math.h>
#include <errno.h>
#include <pthread.h>
#include <signal.h>


#include "/usr/include/c++/10/x86_64-suse-linux/bits/os_defines.h"
#include "/usr/include/c++/10/x86_64-suse-linux/bits/c++config.h"
#include <c++/10/cxxabi.h>

extern int __fprintf_chk (FILE *__restrict __stream, int __flag,
			  const char *__restrict __format, ...);
extern int __printf_chk (int __flag, const char *__restrict __format, ...);
extern int __vfprintf_chk (FILE *__restrict __stream, int __flag,
			   const char *__restrict __format, __gnuc_va_list __ap);
extern int __vprintf_chk (int __flag, const char *__restrict __format,
			  __gnuc_va_list __ap);

void __stack_chk_fail(void);

@bharadwajy
Copy link
Contributor

Thanks for your interest in the project and the bug report.

I will plan to triage the issue.

@bharadwajy bharadwajy added the x86-64 Relates top raising x86-64 binaries label Apr 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
x86-64 Relates top raising x86-64 binaries
Projects
None yet
Development

No branches or pull requests

2 participants