chipsalliance / espresso

34 stars 14 forks source link

espresso executable does not work #27

Open hadipourh opened 1 year ago

hadipourh commented 1 year ago

I cloned the existing version (Jun 1, 2023) and compiled it using the following commands on a Debian-based Linux:

mkdir build
cd build
cmake ..
make

I could compile it successfully. However, the executable espresso does not work, e.g., it does not respond to the following simple command:

./espresso -h

Just so you know, this issue does not exist with the last released version, i.e., v.2.4.

edwardcwang commented 1 year ago

It just times out? No error messages, segfaults, etc?

hadipourh commented 1 year ago

Thanks for your reply! There are no error messages or any form of output generated. It just runs silently. Additionally, I have tested this program with several input files that work successfully with another Espresso implementation found here, but I've experienced the same non-responsive behavior.

edwardcwang commented 1 year ago

Interesting. Have you tried straceing it to see what it's blocked on?

hadipourh commented 1 year ago

I tried strace. The following is the output:

execve("./espresso", ["./espresso", "-h"], 0x7ffec293b6f8 /* 64 vars */) = 0
brk(NULL)                               = 0x557c59e96000
arch_prctl(0x3001 /* ARCH_??? */, 0x7ffd92ea8ab0) = -1 EINVAL (Invalid argument)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f010613e000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "tls/haswell/avx512_1/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "tls/haswell/avx512_1/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "tls/haswell/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "tls/haswell/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "tls/avx512_1/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "tls/avx512_1/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "tls/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "tls/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "haswell/avx512_1/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "haswell/avx512_1/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "haswell/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "haswell/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "avx512_1/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "avx512_1/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/hhadipour/Softwares/gurobi950/linux64/lib/tls/haswell/avx512_1/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/home/hhadipour/Softwares/gurobi950/linux64/lib/tls/haswell/avx512_1/x86_64", 0x7ffd92ea7d00) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/hhadipour/Softwares/gurobi950/linux64/lib/tls/haswell/avx512_1/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/home/hhadipour/Softwares/gurobi950/linux64/lib/tls/haswell/avx512_1", 0x7ffd92ea7d00) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/hhadipour/Softwares/gurobi950/linux64/lib/tls/haswell/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/home/hhadipour/Softwares/gurobi950/linux64/lib/tls/haswell/x86_64", 0x7ffd92ea7d00) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/hhadipour/Softwares/gurobi950/linux64/lib/tls/haswell/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/home/hhadipour/Softwares/gurobi950/linux64/lib/tls/haswell", 0x7ffd92ea7d00) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/hhadipour/Softwares/gurobi950/linux64/lib/tls/avx512_1/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/home/hhadipour/Softwares/gurobi950/linux64/lib/tls/avx512_1/x86_64", 0x7ffd92ea7d00) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/hhadipour/Softwares/gurobi950/linux64/lib/tls/avx512_1/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/home/hhadipour/Softwares/gurobi950/linux64/lib/tls/avx512_1", 0x7ffd92ea7d00) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/hhadipour/Softwares/gurobi950/linux64/lib/tls/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/home/hhadipour/Softwares/gurobi950/linux64/lib/tls/x86_64", 0x7ffd92ea7d00) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/hhadipour/Softwares/gurobi950/linux64/lib/tls/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/home/hhadipour/Softwares/gurobi950/linux64/lib/tls", 0x7ffd92ea7d00) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/hhadipour/Softwares/gurobi950/linux64/lib/haswell/avx512_1/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/home/hhadipour/Softwares/gurobi950/linux64/lib/haswell/avx512_1/x86_64", 0x7ffd92ea7d00) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/hhadipour/Softwares/gurobi950/linux64/lib/haswell/avx512_1/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/home/hhadipour/Softwares/gurobi950/linux64/lib/haswell/avx512_1", 0x7ffd92ea7d00) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/hhadipour/Softwares/gurobi950/linux64/lib/haswell/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/home/hhadipour/Softwares/gurobi950/linux64/lib/haswell/x86_64", 0x7ffd92ea7d00) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/hhadipour/Softwares/gurobi950/linux64/lib/haswell/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/home/hhadipour/Softwares/gurobi950/linux64/lib/haswell", 0x7ffd92ea7d00) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/hhadipour/Softwares/gurobi950/linux64/lib/avx512_1/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/home/hhadipour/Softwares/gurobi950/linux64/lib/avx512_1/x86_64", 0x7ffd92ea7d00) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/hhadipour/Softwares/gurobi950/linux64/lib/avx512_1/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/home/hhadipour/Softwares/gurobi950/linux64/lib/avx512_1", 0x7ffd92ea7d00) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/hhadipour/Softwares/gurobi950/linux64/lib/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/home/hhadipour/Softwares/gurobi950/linux64/lib/x86_64", 0x7ffd92ea7d00) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/hhadipour/Softwares/gurobi950/linux64/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/home/hhadipour/Softwares/gurobi950/linux64/lib", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=159511, ...}) = 0
mmap(NULL, 159511, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f0106117000
close(3)                                = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\300A\2\0\0\0\0\0"..., 832) = 832
pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784
pread64(3, "\4\0\0\0\20\0\0\0\5\0\0\0GNU\0\2\0\0\300\4\0\0\0\3\0\0\0\0\0\0\0", 32, 848) = 32
pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\30x\346\264ur\f|Q\226\236i\253-'o"..., 68, 880) = 68
fstat(3, {st_mode=S_IFREG|0755, st_size=2029592, ...}) = 0
pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784
pread64(3, "\4\0\0\0\20\0\0\0\5\0\0\0GNU\0\2\0\0\300\4\0\0\0\3\0\0\0\0\0\0\0", 32, 848) = 32
pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\30x\346\264ur\f|Q\226\236i\253-'o"..., 68, 880) = 68
mmap(NULL, 2037344, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f0105f25000
mmap(0x7f0105f47000, 1540096, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x22000) = 0x7f0105f47000
mmap(0x7f01060bf000, 319488, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x19a000) = 0x7f01060bf000
mmap(0x7f010610d000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1e7000) = 0x7f010610d000
mmap(0x7f0106113000, 13920, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f0106113000
close(3)                                = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f0105f23000
arch_prctl(ARCH_SET_FS, 0x7f010613f640) = 0
mprotect(0x7f010610d000, 16384, PROT_READ) = 0
mprotect(0x557c58a24000, 4096, PROT_READ) = 0
mprotect(0x7f010616d000, 4096, PROT_READ) = 0
munmap(0x7f0106117000, 159511)          = 0
brk(NULL)                               = 0x557c59e96000
brk(0x557c59eb7000)                     = 0x557c59eb7000
fstat(0, {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0xa), ...}) = 0
read(0, 

After printing the last line, strace gets stuck, and I must interrupt it. I wonder if it fails to find a C library, i.e., libc.so.6.

By the way, regardless of the issue, the last released version, i.e., v2.4, is compiled and working smoothly. So, the issue is related to the new modifications after v2.4.

edwardcwang commented 1 year ago

Interesting. And do you get similar results if you try it in a clean environment e.g. new VM, container, etc?

hadipourh commented 1 year ago

Yes, I encounter the same non-responsive or silent failure issue running it in a clean environment.

However, it does not return any outputs when I execute it, e.g., ./espresso -h. This silent failure emerges in a clean environment. So it is likely a universal issue, not just with my configuration.

a1880 commented 1 year ago

This version of espresso does not evaluate commandline arguments, other than the original espresso from Berkeley (compilable version). It would be helpful to include comments where this version deviates from the original.

hadipourh commented 1 year ago

If this tool doesn't support command-line arguments like the original version, how should one use it? The help command, i.e., ./espresso -h, doesn't work, and I haven't found any manuals. For the original version, there is a nearly comprehensive manual, which I've already implemented in my tool: https://github.com/hadipourh/sboxanalyzer.

I tried to use this version because its build process is managed by CMake. As far as I can tell, release v.2.4 of this repository handles command-line arguments just as well as the original version.

a1880 commented 1 year ago

From looking at the main program: This version reads the PLA description from standard input (stdin) and writes the results to standard output (stdout). No commandline parameters are evaluated. The original espresso has 10+ parameters.

hadipourh commented 1 year ago

Thanks for your comment! I think it would be better to keep the command-line arguments in order to maintain compatibility with the previous implementation.

a1880 commented 1 year ago

@hadipourh You are perhaps better off when you turn to another espresso fork like the one I mentioned in my previous comment.