Closed PKizzle closed 3 years ago
CAPT driver, interesting.
I'll try to add as many function as I can later.
So, I added most function, except all dbus_* one, that I will add later, and fcntl64 and lockf64. For those 2, I'm unsure where do they come from.
Sounds great. fcntl64 comes from libxml2.so and lockf64 can be found in libc.so
I doubt the fcntl64 needed there comes from libxml2.so. Indeed I found lockf64 in libc, I didn't checked enough the fisrt time, but fcntl64 should also comes from libc. But I don't find it on my test x86 system. That's odd.
You're right about fcntl64. It's part of libc6. Strange you couldn't find it.
Is that CAPT driver recent? I don't see any trace of this function in the libc from my Mint x86 system, nor from an Ubuntu 18.04 x86_64 system.
In all case, I can create an alias fcntl64
-> fcntl
, but that's strange that driver somehow needs that function (or maybe it's one of the dependant lib)
The CAPT driver was released in 2017. This is from the changelog of glibc 2.28, which was released 2018.
The fcntl function now have a Long File Support variant named fcntl64. It
is added to fix some Linux Open File Description (OFD) locks usage on non
LFS mode. As for others *64 functions, fcntl64 semantics are analogous with
fcntl and LFS support is handled transparently. Also for Linux, the OFD
locks act as a cancellation entrypoint.
So I guess an alias should be alright.
Or, maybe I will call the actual fcntl64
if it's found in the system, else I call the fcntl64 syscall, that should be present if no fcntl64
is there. Or regular fcntl
as a fallback?
I would use regular fcntl
as fallback since versions of libc6 prior to v2.28 don't have fcntl64
So, I pushed a few dbus function, and an attempt at a fcntl64 function. The driver should go a bit farther. DBus function have many callback, so wrapping them takes some time.
Thank you very much. Will try that later today...
Okay so this is the output after the update:
Warning, don't know of to handle rel #174 type: 0xe (unknown) (0x76960fc0)
Warning, don't know of to handle rel #175 type: 0xe (unknown) (0x76960fc4)
Warning, don't know of to handle rel #180 type: 0xe (unknown) (0x76960fd8)
Error: Symbol dbus_message_get_path not found, cannot apply R_386_JMP_SLOT @0x7693c048 (0x2526)
Error: Symbol dbus_watch_get_flags not found, cannot apply R_386_JMP_SLOT @0x7693c054 (0x2556)
Error: Symbol dbus_message_get_args not found, cannot apply R_386_JMP_SLOT @0x7693c060 (0x2586)
Error: Symbol dbus_watch_get_data not found, cannot apply R_386_JMP_SLOT @0x7693c074 (0x25d6)
Error: Symbol dbus_message_unref not found, cannot apply R_386_JMP_SLOT @0x7693c08c (0x2636)
Error: Symbol dbus_message_iter_close_container not found, cannot apply R_386_JMP_SLOT @0x7693c090 (0x2646)
Error: Symbol dbus_error_free not found, cannot apply R_386_JMP_SLOT @0x7693c094 (0x2656)
Error: Symbol dbus_watch_get_unix_fd not found, cannot apply R_386_JMP_SLOT @0x7693c0a0 (0x2686)
Error: Symbol dbus_connection_send_with_reply_and_block not found, cannot apply R_386_JMP_SLOT @0x7693c0a8 (0x26a6)
Error: Symbol dbus_message_iter_append_fixed_array not found, cannot apply R_386_JMP_SLOT @0x7693c0ac (0x26b6)
Error: Symbol dbus_watch_get_enabled not found, cannot apply R_386_JMP_SLOT @0x7693c0b0 (0x26c6)
Error: Symbol dbus_message_new_method_call not found, cannot apply R_386_JMP_SLOT @0x7693c0e0 (0x2786)
Error: Symbol dbus_message_iter_get_fixed_array not found, cannot apply R_386_JMP_SLOT @0x7693c0e4 (0x2796)
Error: Symbol dbus_message_iter_next not found, cannot apply R_386_JMP_SLOT @0x7693c0e8 (0x27a6)
Error: Symbol dbus_message_iter_open_container not found, cannot apply R_386_JMP_SLOT @0x7693c0ec (0x27b6)
Error: Symbol dbus_watch_handle not found, cannot apply R_386_JMP_SLOT @0x7693c118 (0x2866)
Error: Symbol dbus_message_get_member not found, cannot apply R_386_JMP_SLOT @0x7693c11c (0x2876)
Error: Symbol dbus_connection_ref not found, cannot apply R_386_JMP_SLOT @0x7693c120 (0x2886)
Error: Symbol dbus_error_init not found, cannot apply R_386_JMP_SLOT @0x7693c124 (0x2896)
Error: Symbol dbus_message_iter_get_arg_type not found, cannot apply R_386_JMP_SLOT @0x7693c130 (0x28c6)
Error: Symbol dbus_error_is_set not found, cannot apply R_386_JMP_SLOT @0x7693c138 (0x28e6)
Error: Symbol dbus_message_iter_recurse not found, cannot apply R_386_JMP_SLOT @0x7693c140 (0x2906)
Error: Symbol dbus_message_get_interface not found, cannot apply R_386_JMP_SLOT @0x7693c148 (0x2926)
Error: Symbol dbus_connection_set_dispatch_status_function not found, cannot apply R_386_JMP_SLOT @0x7693c154 (0x2956)
Error: Symbol dbus_connection_add_filter not found, cannot apply R_386_JMP_SLOT @0x7693c15c (0x2976)
Error: Symbol dbus_message_append_args not found, cannot apply R_386_JMP_SLOT @0x7693c164 (0x2996)
Error: Symbol dbus_watch_set_data not found, cannot apply R_386_JMP_SLOT @0x7693c16c (0x29b6)
Error: Symbol dbus_message_is_signal not found, cannot apply R_386_JMP_SLOT @0x7693c174 (0x29d6)
Error: Symbol dbus_connection_set_watch_functions not found, cannot apply R_386_JMP_SLOT @0x7693c17c (0x29f6)
Error: Symbol dbus_connection_dispatch not found, cannot apply R_386_JMP_SLOT @0x7693c184 (0x2a16)
Error: Symbol dbus_message_iter_get_element_type not found, cannot apply R_386_JMP_SLOT @0x7693c18c (0x2a36)
Error: Symbol __res_init not found, cannot apply R_386_JMP_SLOT @0x76b69ebc (0x10ef6)
Error: Unsupported libc Syscall 0x163 (355)
Ok, I have pushed a commit with syscall 355. Maybe it will go a bit farther.
With some small modifications I built box86 to be used in an alpine docker image. Works very well so far! Now I'm just waiting for the dbus functions to be implemented ;)
What does that alpine docker brings you?
Also, not sure the dbus function will be enough. while also working on dropbox (another issue ticket), I have found that I may have an issue with __tls_get_addr, and tls storage in general. I need to work on that (and it may be related to the handle rel #XXX type: 0xe (unknown)
message you have (not sure yet).
I dockerize everything, since that makes it very easy to distribute software for RaspberryPis. And alpine helps to keep to the image size small.
So dbus support is more difficult to implement :(
No, it's not linked. It's just I found an issue with tls storage, and I don't know how to fix it yet. No link with the dbus function that are still missing.
Ah okay. Hope you'll find a solution
Okay so I found out, that there currently seems to be a problem with loading libraries for the captdrv application. When run natively in x86 all libraries are loaded successfully, but using box86 only the first one gets loaded. Here is the strace output from native x86:
[pid 30713] read(3</usr/lib/i386-linux-gnu/libc3pl.so.0.0.1>, "\177ELF...")
[pid 30713] fstat64(3</usr/lib/i386-linux-gnu/libc3pl.so.0.0.1>, {st_dev=makedev(8, 2), st_ino=396946, st_mode=S_IFREG|0644, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=2880, st_size=1473052, st_atime=2019-06-26T17:12:49+0200.87$
[pid 30713] fstat64(3</usr/lib/i386-linux-gnu/libc3pl.so.0.0.1>, {st_dev=makedev(8, 2), st_ino=396946, st_mode=S_IFREG|0644, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=2880, st_size=1473052, st_atime=2019-06-26T17:12:49+0200.87$
[pid 30713] readlinkat(AT_FDCWD, "/proc/self/fd/3", "/usr/lib/i386-linux-gnu/libc3pl.so.0.0.1", 4096) = 68
[pid 30713] mmap2(0x5c6ca000, 1474560, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3</usr/lib/i386-linux-gnu/libc3pl.so.0.0.1>, 0) = 0x5c6ca000
[pid 30713] fstat64(3</usr/lib/i386-linux-gnu/libc3pl.so.0.0.1>, {st_dev=makedev(8, 2), st_ino=396946, st_mode=S_IFREG|0644, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=2880, st_size=1473052, st_atime=2019-06-26T17:12:49+0200.87$
[pid 30713] readlinkat(AT_FDCWD, "/proc/self/fd/3", "/usr/lib/i386-linux-gnu/libc3pl.so.0.0.1", 4096) = 68
[pid 30713] mmap2(0x5c80e000, 147456, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3</usr/lib/i386-linux-gnu/libc3pl.so.0.0.1>, 0x144000) = 0x5c80e000
[pid 30713] close(3</usr/lib/i386-linux-gnu/libc3pl.so.0.0.1>) = 0
[pid 30713] openat(4095<>, "usr", O_RDONLY|O_DIRECTORY|O_NOFOLLOW|O_CLOEXEC) = 3</usr>
[pid 30713] openat(3</usr>, "lib", O_RDONLY|O_DIRECTORY|O_NOFOLLOW|O_CLOEXEC) = 7</usr/lib>
[pid 30713] close(3</usr>) = 0
[pid 30713] openat(7</usr/lib>, "i386-linux-gnu", O_RDONLY|O_DIRECTORY|O_NOFOLLOW|O_CLOEXEC) = 3</usr/lib/i386-linux-gnu>
[pid 30713] close(7</usr/lib>) = 0
[pid 30713] readlinkat(3</usr/lib/i386-linux-gnu>, "libcaptfilter.so", "libcaptfilter.so.1.0.0", 8191) = 22
[pid 30713] readlinkat(3</usr/lib/i386-linux-gnu>, "libcaptfilter.so.1.0.0", 0x67617021, 8191) = -1 EINVAL (Invalid argument)
[pid 30713] openat(3</usr/lib/i386-linux-gnu>, "libcaptfilter.so.1.0.0", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 7</usr/lib/i386-linux-gnu/libcaptfilter.so.1.0.0>
[pid 30713] close(3</usr/lib/i386-linux-gnu>) = 0
[pid 30713] fcntl(7</usr/lib/i386-linux-gnu/libcaptfilter.so.1.0.0>, F_DUPFD_CLOEXEC, 0) = 3</usr/lib/i386-linux-gnu/libcaptfilter.so.1.0.0>
[pid 30713] close(7</usr/lib/i386-linux-gnu/libcaptfilter.so.1.0.0>) = 0
[pid 30713] read(3</usr/lib/i386-linux-gnu/libcaptfilter.so.1.0.0>, "\177ELF...")
[pid 30713] fstat64(3</usr/lib/i386-linux-gnu/libcaptfilter.so.1.0.0>, {st_dev=makedev(8, 2), st_ino=396977, st_mode=S_IFREG|0644, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=400, st_size=200920, st_atime=2019-06-26T17:12:50+020$
[pid 30713] fstat64(3</usr/lib/i386-linux-gnu/libcaptfilter.so.1.0.0>, {st_dev=makedev(8, 2), st_ino=396977, st_mode=S_IFREG|0644, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=400, st_size=200920, st_atime=2019-06-26T17:12:50+020$
[pid 30713] readlinkat(AT_FDCWD, "/proc/self/fd/3", "/usr/lib/i386-linux-gnu/libcaptfilter.so.1.0.0", 4096) = 74
[pid 30713] mmap2(0x5c698000, 204800, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3</usr/lib/i386-linux-gnu/libcaptfilter.so.1.0.0>, 0) = 0x5c698000
[pid 30713] fstat64(3</usr/lib/i386-linux-gnu/libcaptfilter.so.1.0.0>, {st_dev=makedev(8, 2), st_ino=396977, st_mode=S_IFREG|0644, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=400, st_size=200920, st_atime=2019-06-26T17:12:50+020$
[pid 30713] readlinkat(AT_FDCWD, "/proc/self/fd/3", "/usr/lib/i386-linux-gnu/libcaptfilter.so.1.0.0", 4096) = 74
[pid 30713] mmap2(0x5c6be000, 49152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3</usr/lib/i386-linux-gnu/libcaptfilter.so.1.0.0>, 0x25000) = 0x5c6be000
[pid 30713] close(3</usr/lib/i386-linux-gnu/libcaptfilter.so.1.0.0>) = 0
[pid 30713] openat(4095<>, "usr", O_RDONLY|O_DIRECTORY|O_NOFOLLOW|O_CLOEXEC) = 3</usr>
[pid 30713] openat(3</usr>, "lib", O_RDONLY|O_DIRECTORY|O_NOFOLLOW|O_CLOEXEC) = 7</usr/lib>
[pid 30713] close(3</usr>) = 0
[pid 30713] openat(7</usr/lib>, "i386-linux-gnu", O_RDONLY|O_DIRECTORY|O_NOFOLLOW|O_CLOEXEC) = 3</usr/lib/i386-linux-gnu>
[pid 30713] close(7</usr/lib>) = 0
[pid 30713] readlinkat(3</usr/lib/i386-linux-gnu>, "libcanon_slim.so.1.0.0", 0x67617021, 8191) = -1 EINVAL (Invalid argument)
[pid 30713] openat(3</usr/lib/i386-linux-gnu>, "libcanon_slim.so.1.0.0", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 7</usr/lib/i386-linux-gnu/libcanon_slim.so.1.0.0>
[pid 30713] close(3</usr/lib/i386-linux-gnu>) = 0
[pid 30713] fcntl(7</usr/lib/i386-linux-gnu/libcanon_slim.so.1.0.0>, F_DUPFD_CLOEXEC, 0) = 3</usr/lib/i386-linux-gnu/libcanon_slim.so.1.0.0>
[pid 30713] close(7</usr/lib/i386-linux-gnu/libcanon_slim.so.1.0.0>) = 0
[pid 30713] read(3</usr/lib/i386-linux-gnu/libcanon_slim.so.1.0.0>, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\24\17\0\0004\0\0\0`i\0\0\0\0\0\0004\0 \0\4\0(\0\26\0\25\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310H\0\0\310H\0\0\5\0\0\0\0\20\0\0\1$
[pid 30713] fstat64(3</usr/lib/i386-linux-gnu/libcanon_slim.so.1.0.0>, {st_dev=makedev(8, 2), st_ino=396970, st_mode=S_IFREG|0644, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=56, st_size=27856, st_atime=2019-06-26T17:12:50+0200.$
[pid 30713] fstat64(3</usr/lib/i386-linux-gnu/libcanon_slim.so.1.0.0>, {st_dev=makedev(8, 2), st_ino=396970, st_mode=S_IFREG|0644, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=56, st_size=27856, st_atime=2019-06-26T17:12:50+0200.$
[pid 30713] readlinkat(AT_FDCWD, "/proc/self/fd/3", "/usr/lib/i386-linux-gnu/libcanon_slim.so.1.0.0", 4096) = 74
[pid 30713] mmap2(0x5c691000, 28672, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3</usr/lib/i386-linux-gnu/libcanon_slim.so.1.0.0>, 0) = 0x5c691000
[pid 30713] fstat64(3</usr/lib/i386-linux-gnu/libcanon_slim.so.1.0.0>, {st_dev=makedev(8, 2), st_ino=396970, st_mode=S_IFREG|0644, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=56, st_size=27856, st_atime=2019-06-26T17:12:50+0200.$
[pid 30713] readlinkat(AT_FDCWD, "/proc/self/fd/3", "/usr/lib/i386-linux-gnu/libcanon_slim.so.1.0.0", 4096) = 74
[pid 30713] mmap2(0x5c696000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3</usr/lib/i386-linux-gnu/libcanon_slim.so.1.0.0>, 0x5000) = 0x5c696000
[pid 30713] close(3</usr/lib/i386-linux-gnu/libcanon_slim.so.1.0.0>) = 0
And this is the output from strace with box86:
[pid 71] readv(6</usr/lib/libc3pl.so>, [{iov_base="\177ELF...", iov_len=51}, {iov_base="\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0`?\24\0`?\24\0\5\0\0\0\0\20\0\0\1\0\0\0\0@\2>
[pid 71] _llseek(6</usr/lib/libc3pl.so>, 1479328, [1479328], SEEK_SET) = 0
[pid 71] readv(6</usr/lib/libc3pl.so>, [{iov_base="\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\v\0\0\0\5\0\0\0\2\0\0\0\324\0\0\0\324\0\0\0\330)\0\0\2\0\0\0\0\0\0\0\4\0\0\0\4\0\0\0\21\0\0\0\v\0\0\0\2\0\0\0\254*\0\0\254*\0\0\320f\0\0>
[pid 71] _llseek(6</usr/lib/libc3pl.so>, 52, [52], SEEK_SET) = 0
[pid 71] readv(6</usr/lib/libc3pl.so>, [{iov_base="\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0`?\24\0`?\24\0\5\0\0\0\0\20\0\0\1\0\0\0\0@\24\0\0@\24\0\0@\24\0p5\2\0D6\2\0\6\0\0\0\0\20\0\0\2\0\0\0\274@\24\0\274@\24\0\274@\24\0\320\0\0\0\320\0\0\0\6\0\0\0\4\0\0\0P\345td\20?\24\0\20>
[pid 71] _llseek(6</usr/lib/libc3pl.so>, 1479124, [1479124], SEEK_SET) = 0
[pid 71] readv(6</usr/lib/libc3pl.so>, [{iov_base="\0.shstrtab\0.hash\0.dynsym\0.dynstr\0.gnu.version\0.gnu.version_r\0.rel.dyn\0.rel.plt\0.init\0.text\0.fini\0.rodata\0.eh_frame_hdr\0.eh_frame\0.ctors\0.dtors\0.jcr\0.data.rel.ro\0.dynamic\0.got\0.got.plt\0.data\0.bss>
[pid 71] _llseek(6</usr/lib/libc3pl.so>, 1327292, [1327292], SEEK_SET) = 0
[pid 71] readv(6</usr/lib/libc3pl.so>, [{iov_base="\1\0\0\0\351y\0\0\1\0\0\0\363y\0\0\16\0\0\0\20z\0\0\f\0\0\0\324S\1\0\r\0\0\0T|\23\0\4\0\0\0\324\0\0\0\5\0\0\0|\221\0\0\6\0\0\0\254*\0\0\n\0\0\0=z\0\0\v\0\0\0\20\0\0\0\3\0\0\0\244G\24\0\2\0\0\0\320\32\0\0\24\0\0\0\21\0>
[pid 71] brk(0x1854000) = 0x1854000
[pid 71] _llseek(6</usr/lib/libc3pl.so>, 37244, [37244], SEEK_SET) = 0
[pid 71] readv(6</usr/lib/libc3pl.so>, [{iov_base="\0_DYNAMIC\0_GLOBAL_OFFSET_TABLE_\0__gmon_start__\0_fini\0__cxa_finalize\0_Jv_RegisterClasses\0c3pl_setup_xlateobj\0c3pl_write_cmyk2rgb_output\0memset\0c3pl_get_bitmap_format\0c3pl_set_image_function\0c3pl_draw_plgblt>
[pid 71] brk(0x185b000) = 0x185b000
[pid 71] _llseek(6</usr/lib/libc3pl.so>, 10924, [10924], SEEK_SET) = 0
[pid 71] readv(6</usr/lib/libc3pl.so>, [{iov_base="\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\324S\1\0\0\0\0\0\3\0\10\0\0\0\0\0\234\211\1\0\0\0\0\0\3\0\n\0\0\0\0\0T|\23\0\0\0\0\0\3\0\v\0\0\0\0\0\200|\23\0\0\0\0\0\3\0\f\0\0\0\0\0\20?\24\0\0\0\0\0\3\0\r\0\0\0\0\0$?\24\0\0>
[pid 71] mmap2(NULL, 1472068, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_SHARED|MAP_ANONYMOUS, -1, 0) = 0x76bca000
[pid 71] _llseek(6</usr/lib/libc3pl.so>, 0, [0], SEEK_SET) = 0
[pid 71] readv(6</usr/lib/libc3pl.so>, [{iov_base="\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\234\211\1\0004\0\0\0\240\222\26\0\0\0\0\0004\0 \0\5\0(\0\32\0\31\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0`?\24\0`?\24\0\5\0\0\0\0\20\0\0\1\0\0\0\0@\24\0\0@\24\0\0@\24\0p5\2\0D6>
[pid 71] _llseek(6</usr/lib/libc3pl.so>, 1327104, [1327104], SEEK_SET) = 0
[pid 71] readv(6</usr/lib/libc3pl.so>, [{iov_base="\377\377\377\377\0\0\0\0\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\370\225\23\0\370\225\23\0\372\225\23\0\370\225\23\0\370\225\23\0\370\225\23\0\370\225\23\0\370\225\23\0\370\225\23\0\370\225\23\0\374\22>
[pid 71] _llseek(6</usr/lib/libc3pl.so>, -1023, [1471856], SEEK_CUR) = 0
[pid 71] close(6</usr/lib/libc3pl.so>) = 0
[pid 71] brk(0x185d000) = 0x185d000
[pid 71] brk(0x1860000) = 0x1860000
[pid 71] brk(0x1865000) = 0x1865000
[pid 71] brk(0x186e000) = 0x186e000
[pid 71] brk(0x1872000) = 0x1872000
[pid 71] brk(0x1875000) = 0x1875000
[pid 71] brk(0x187c000) = 0x187c000
And this is the part of box86's output:
Calling Init for /usr/lib/libc3pl.so @0x76c4d3d4
Run X86 (0x76fbf220), EIP=0x76c4d3d4, Stack=0x76e22010
0093|0x76c509b9: Calling my___gmon_start__ (/usr/bin/box86) (76F21CB0, 08059358, 76F21C78...) =>__gmon_start__ called (dummy call)
return 0x00EFA958
Trying to Get "/usr/lib/libc3pl.so" to maplib
return 0x00000001
0093|0x8050a75: Calling my_dlerror (/usr/bin/box86) (00000000, 00000000, 00000000...) => return 0x005129D8
0093|0x8050a8a: Calling my_dlsym (/usr/bin/box86) (00000001, 080576ED, 00000004...) =>Call to dlsym(0x1, "C3PL_InitialiseInterface")
return 0x76C56EAC
0093|0x8050a91: Calling my_dlerror (/usr/bin/box86) (00000001, 080576ED, 00000004...) => return 0x005129D8
With box86 libc3pl.so gets loaded but not the required libcaptfilter.so and libcanon_slim.so. These libraries are not linked with captdrv, but loaded by the program itself.
ldd /usr/bin/captdrv
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0x5cbef000)
libcaepcm.so.1 => /usr/lib/i386-linux-gnu/libcaepcm.so.1 (0x5cb6d000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0x5c98f000)
/lib/ld-linux.so.2 (0x40000000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0x5c889000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0x5c868000)
librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0x5c85d000)
Well, if other libs are loaded with dlopen, that means it may have crashed before getting to that point. I don't really understand: is it crashing or it's just doing nothing?
(Also, this week end I added stuff about Thread Local Storage, so be sure to use latest version)
It seems like captdrv is doing nothing. It's not crashing because there were a lot of error checks implemented. But of course no output for debugging :(
Okay I will try out your latest version. Maybe something has changed.
Okay I was able to find the error. Your implementation of dlerror (my_dlerror) always throws a generic error. But this terminated captdrv. I changed it to return NULL and now captdrv tries to load the next library. This fails with
Edit: Okay was also able to fix that.Faillure to create lib
.
Ah, yes. dl_error
... I'll check what the correct behavour should be. Nice find.
Ok, I have just pushed some improvements.. Now dlerror
should behave :)
Nice, thanks.
Okay while I now receive the expected output, I found out that writing the output to file is very slow. Do you have an idea why this happens? (The cpu core running box86 is at 100%)
So it's working correctly now, but it is slow?
The slowiness is probably because most code is still x86, and box86 only have an interpretor, no DynaRec/JIT. Build without trace enable, that will speed up a bit. But for a true speedup, you'll have to wait I implement some kind of DynaRec/JIT (I want to do that, but I haven't started yet).
I already disabled tracing.
Currently libstdc++.so.6
is emulated and no wrapper is available. Do you plan to add a wrapper for it?
Adding a DynaRec would be very nice. Maybe you could take a look at https://www.unicorn-engine.org?
I cannot wrap C++ library. I haven't found a way to go around vtable for now. So libstdc++ will not be wrapped for now.
unicorn-engine is using QEmu iirc, and that is not my plan. There is not a lot of Dynarec engine that are opensource, and on the correct licence (not GPL but MIT or something equivalent).
Hopefully you'll find some opensource project that you can use as a guideline to implement a Dynarec engine.
Okay while I now receive the expected output, I found out that writing the output to file is very slow. Do you have an idea why this happens? (The cpu core running box86 is at 100%)
Just my two cents to that topic: I've uses several different x86 emulations on ARM hardware, starting from qemu and DOSBox over ExaGear (very fast and efficent x86 emulation), and box86. And why they reacted differently in certain situation, one thing was constant throughout all of these, very slow I/O performance. I don't know if it's cause of missing dynarec for some tasks, but I/O was ALWAYS the slowest part of these emulations. So although I hope at somepoint dynarec will be implemented, I don't expect it to speed up I/O performance (although I really would enjoy this). But as long as CPU performance can be increased due dynarec and some programs run faster than they are right now, I probably could live with slow I/O performance, although I understand this might be rather bad for I/O based applications.
Mhm, exagear version 3 has quite an acceptable I/O performance. box86 is currently not comparable in that matter ;)
Which might be due to the fact that your CPU is at 100% and I won't say that dynarec will not improve the overall situation, but even with ExaGear I had lot of issues regarding I/O performance. Installing applications took a very long time, while installing the same applications directly under ARM was a lot faster. But then again, I mostly worked with ExaGear 2.x and although I still have ExaGear 3, I haven't really tried it yet, not sure if they were able to improve I/O.
So let's hope dynarec will improve the situation. I guess its unfair to compare box86 with exagear anyway.
I don't mind if box86 is compared to exagear or qemu. I know I'm slower than Exagear, the lack of Dynarec is obvious there. I would also like to have some speed comparaison with Qemu, as Box86 can be faster I think, depending the use case.
But Box86 should be the easiest to use, as it doesn't need a full x86 chroot system. And Box86 is also very young, and open sources, so it will evolve. And I'll put some Dynarec in the future, and it will become even more usable (and maybe faster than exagear in some usecase).
It already is a lot faster in some cases, the fact alone that you wrapped OpenGL calls elevates it over ExaGear. Playing NeverWinter Nights and other games on ARM can be quite fun.
Okay so I tried out your dynarec version of box86, but am now facing an issue that the execution of software fails when it tries to create a child process using clone.
This is the output I should get (on x86):
write(2, "opvpOpenPrinter(462)\n", 21opvpOpenPrinter(462)
) = 21
pipe2([6, 9], 0) = 0
pipe2([10, 11], 0) = 0
rt_sigprocmask(SIG_SETMASK, ~[], [], 8) = 0
clone(child_stack=NULL, flags=CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, parent_tidptr=0x67778a3c, child_tidptr=0x67778a3c) = 30866
And this is the output I receive using box86:
write(2, "opvpOpenPrinter(462)\n", 21opvpOpenPrinter(462)
) = 21
pipe([5, 6]) = 0
pipe([7, 8]) = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=NULL} ---
+++ killed by SIGSEGV (core dumped) +++
Any idea what could cause this?
can you try to use gdb and get a backtrace of the crash?
Okay, I hope I've done it correctly:
#0 0x73894994 in Run (emu=0x7464a0c8, step=step@entry=0) at /home/box86/src/emu/x86run.c:223
#1 0x738948b8 in EmuCall (emu=emu@entry=0x7464a0c8, addr=<optimized out>) at /home/box86/src/emu/x86emu.c:392
#2 0x738cbd9c in x86emu_fork (emu=emu@entry=0x7464a0c8, forktype=1) at /home/box86/src/emu/x86int3.c:30
#3 0x738d6fcc in DynaRun (emu=emu@entry=0x7464a0c8) at /home/box86/src/dynarec/dynarec.c:164
#4 0x738c792c in my___libc_start_main (emu=emu@entry=0x7464a0c8, main=0x76f70100, argc=<optimized out>, ubp_av=<optimized out>, init=0x76f70450, fini=0x76f704b0, rtld_fini=0x75f7d000, stack_end=0x76d1fc0c)
at /home/box86/src/emu/x86run_private.c:51
#5 0x738e4dbc in iFEpippppp (emu=emu@entry=0x7464a0c8, fcn=fcn@entry=1938585664) at /home/box86/src/wrapped/generated/wrapper.c:2771
#6 0x738cbf48 in x86Int3 (emu=0x7464a0c8) at /home/box86/src/emu/x86int3.c:218
#7 0x73896500 in Run (emu=0x7464a0c8, step=step@entry=0) at /home/box86/src/emu/x86run.c:874
#8 0x7384d4f8 in main (argc=<optimized out>, argv=<optimized out>, env=<optimized out>) at /home/box86/src/main.c:769
Yes, it's correct, but it's not really helpfull. I'm guessing it's a missing wrapped function. Do you have any "Missing symbol" at load? If not, run with "BOX86_DLSYM_ERROR=1" to have error on dlopen/dlsym logged.
(Side note: is your build have Dynarec enabled?)
Yes, there are the following missing symbols:
Error: Symbol FT_Get_Sfnt_Name_Count not found, cannot apply R_386_JMP_SLOT @0x746bd010 (0x5056)
Error: Symbol FT_Get_X11_Font_Format not found, cannot apply R_386_JMP_SLOT @0x746bd040 (0x5116)
Error: Symbol FT_Set_Var_Design_Coordinates not found, cannot apply R_386_JMP_SLOT @0x746bd098 (0x5276)
Error: Symbol FT_Get_Advance not found, cannot apply R_386_JMP_SLOT @0x746bd09c (0x5286)
Error: Symbol FT_Get_MM_Var not found, cannot apply R_386_JMP_SLOT @0x746bd10c (0x5446)
Error: Symbol FT_Get_BDF_Property not found, cannot apply R_386_JMP_SLOT @0x746bd1d8 (0x5776)
Error: Symbol FT_Get_Sfnt_Name not found, cannot apply R_386_JMP_SLOT @0x746bd1ec (0x57c6)
Error: Symbol png_create_write_struct_2 not found, cannot apply R_386_JMP_SLOT @0x75f6c678 (0x799e6)
Error: Symbol png_get_mem_ptr not found, cannot apply R_386_JMP_SLOT @0x75f6cbc4 (0x7af16)
Error: Symbol FT_Outline_Done not found, cannot apply R_386_JMP_SLOT @0x75f6d150 (0x7c546)
Error: Symbol png_set_swap not found, cannot apply R_386_JMP_SLOT @0x75f6d240 (0x7c906)
Error: Symbol png_write_rows not found, cannot apply R_386_JMP_SLOT @0x75f6d904 (0x7e416)
Error: Symbol FT_Bitmap_Done not found, cannot apply R_386_JMP_SLOT @0x75f6d97c (0x7e5f6)
Error: Symbol png_set_bKGD not found, cannot apply R_386_JMP_SLOT @0x75f6dab4 (0x7ead6)
Error: Symbol png_set_invert_alpha not found, cannot apply R_386_JMP_SLOT @0x75f6daec (0x7ebb6)
Error: Symbol png_set_pHYs not found, cannot apply R_386_JMP_SLOT @0x75f6de6c (0x7f9b6)
Error: Symbol FT_Property_Set not found, cannot apply R_386_JMP_SLOT @0x75f6e090 (0x80246)
Error: Symbol FT_New_Library not found, cannot apply R_386_JMP_SLOT @0x75f6e3cc (0x80f36)
Error: Symbol png_set_text not found, cannot apply R_386_JMP_SLOT @0x75f6e3d8 (0x80f66)
Error: Symbol FT_Add_Default_Modules not found, cannot apply R_386_JMP_SLOT @0x75f6ee34 (0x838d6)
Error: Symbol png_set_invert_mono not found, cannot apply R_386_JMP_SLOT @0x75f6eed4 (0x83b56)
Error: Symbol png_set_iCCP not found, cannot apply R_386_JMP_SLOT @0x75f6ef38 (0x83ce6)
They are from libpng and libfontconfig
ok. from libpng12 or libpng16?
I was able to fix the libpng symbols by adding BOX86_LD_PRELOAD=libpng.so
Ok. Other symbols are from FreeType, and I need to add them...
Is it working now and this ticket closed?
I do no longer use the printer driver because I bought a new one. Therefore I'll close this issue. Whish you all the best for 2021 @ptitSeb !
Is it working now
Kind of. captfilter
is working, pstocapt
requires emulated libcups.so.2
, other daemons not tested.
The heaviest is captfilter
(the printer language processing software), other binaries do not create any significant CPU load.
root@uowprint:~# time qemu-i386 /tmp/captfilter --PageSize=A4 --MediaType=PlainPaper --Resolution=600 < /tmp/input.pbm > /tmp/output.bin
real 0m32.670s
user 0m32.440s
sys 0m0.090s
root@uowprint:~# time box86 /tmp/captfilter --PageSize=A4 --MediaType=PlainPaper --Resolution=600 < /tmp/input.pbm > /tmp/output.bin
real 0m7.915s
user 0m7.830s
sys 0m0.030s
Is it working now
Kind of.
captfilter
is working,pstocapt
requires nativelibcups.so.2
, other daemons not tested. The heaviest iscaptfilter
(the printer language processing software), other binaries do not create any significant CPU load.root@uowprint:~# time qemu-i386 /tmp/captfilter --PageSize=A4 --MediaType=PlainPaper --Resolution=600 < /tmp/input.pbm > /tmp/output.bin real 0m32.670s user 0m32.440s sys 0m0.090s root@uowprint:~# time box86 /tmp/captfilter --PageSize=A4 --MediaType=PlainPaper --Resolution=600 < /tmp/input.pbm > /tmp/output.bin real 0m7.915s user 0m7.830s sys 0m0.030s
Oh nice, thanks for the bench!
Cups is partially wrapped on box86 (I guess that makes the bench versus qemu unfair of course).
Cups is partially wrapped on box86 (I guess that makes the bench versus qemu unfair of course).
No, the benchmark shows the difference between qemu's JIT vs box86 JIT. The binary does basically nothing more than processing stdin and return stdout binary data, all self-contained. libcups and all other libraries are just to receive configuration options from printer job.
Cups is partially wrapped on box86 (I guess that makes the bench versus qemu unfair of course).
No, the benchmark shows the difference between qemu's JIT vs box86 JIT. The binary does basically nothing more than processing stdin and return stdout binary data, all self-contained. libcups and all other libraries are just to receive configuration options from printer job.
Ah ok. So box86 is roughly 4 times faster! that's nice :)
I try to use box86 to run the Canon CAPT printer driver, which is sadly not offered for ARM. Currently I see a lot of error messages.
Using default BOX86_LD_LIBRARY_PATH: ./:lib/ Using default BOX86_PATH: ./:bin/ Counted 42 Env var Looking for sbin/ccpd Using emulated lib/libcups.so.2 Using emulated lib/libgssapi_krb5.so.2 Using emulated lib/libkrb5.so.3 Using emulated lib/libk5crypto.so.3 Using emulated lib/libkrb5support.so.0 Using emulated lib/libkeyutils.so.1 Using native(wrapped) libc.so.6 Using native(wrapped) ld-linux.so.2 Using native(wrapped) libpthread.so.0 Using native(wrapped) librt.so.1 Using emulated lib/libresolv.so.2 Using native(wrapped) libdl.so.2 Using emulated lib/libcom_err.so.2 Using emulated lib/libavahi-common.so.3 Using emulated lib/libavahi-client.so.3 Using native(wrapped) libdbus-1.so.3 Using emulated lib/libgnutls.so.30 Using native(wrapped) libz.so.1 Using emulated lib/libp11-kit.so.0 Using emulated lib/libffi.so.6 Using emulated lib/libidn.so.11 Using emulated lib/libtasn1.so.6 Using emulated lib/libnettle.so.6 Using emulated lib/libhogweed.so.4 Using emulated lib/libgmp.so.10 Using native(wrapped) libm.so.6 Warning, don't know of to handle rel #174 type: 0xe (unknown) (0x76a5afc0) Warning, don't know of to handle rel #175 type: 0xe (unknown) (0x76a5afc4) Error: Global Symbol in6addr_any not found, cannot apply R_386_GLOB_DAT @0x76a5afc8 ((nil)) Warning, don't know of to handle rel #180 type: 0xe (unknown) (0x76a5afd8) Error: Symbol gmtime_r not found, cannot apply R_386_JMP_SLOT @0x76a5b044 (0x2426) Error: Symbol res_maybe_init not found, cannot apply R_386_JMP_SLOT @0x76a5b048 (0x2436) Error: Symbol res_iclose not found, cannot apply R_386_JMP_SLOT @0x76a5b050 (0x2456) Error: Symbol sendmmsg not found, cannot apply R_386_JMP_SLOT @0x76a5b098 (0x2576) Error: Symbol asprintf_chk not found, cannot apply R_386_JMP_SLOT @0x76fb6090 (0x1f06) Error: Global Symbol secure_getenv not found, cannot apply R_386_GLOB_DAT @0x76ff2f50 ((nil)) Error: Global Symbol in6addr_any not found, cannot apply R_386_GLOB_DAT @0x76b6de64 ((nil)) Error: Symbol asprintf_chk not found, cannot apply R_386_JMP_SLOT @0x76b6e434 (0x131f6) Error: Symbol res_nclose not found, cannot apply R_386_JMP_SLOT @0x76b6e7e8 (0x140c6) Error: Symbol res_ninit not found, cannot apply R_386_JMP_SLOT @0x76b6e950 (0x14666) Error: Symbol __asprintf_chk not found, cannot apply R_386_JMP_SLOT @0x76bc11e0 (0x6dc6) Error: Symbol dbus_message_iter_get_basic not found, cannot apply R_386_JMP_SLOT @0x76a36018 (0x2466) Error: Symbol dbus_connection_unref not found, cannot apply R_386_JMP_SLOT @0x76a36024 (0x2496) Error: Symbol dbus_message_iter_init_append not found, cannot apply R_386_JMP_SLOT @0x76a36028 (0x24a6) Error: Symbol dbus_timeout_get_data not found, cannot apply R_386_JMP_SLOT @0x76a36030 (0x24c6) Error: Symbol dbus_connection_get_dispatch_status not found, cannot apply R_386_JMP_SLOT @0x76a36040 (0x2506) Error: Symbol dbus_connection_set_timeout_functions not found, cannot apply R_386_JMP_SLOT @0x76a36044 (0x2516) Error: Symbol dbus_message_get_path not found, cannot apply R_386_JMP_SLOT @0x76a36048 (0x2526) Error: Symbol dbus_watch_get_flags not found, cannot apply R_386_JMP_SLOT @0x76a36054 (0x2556) Error: Symbol dbus_message_get_args not found, cannot apply R_386_JMP_SLOT @0x76a36060 (0x2586) Error: Symbol dbus_watch_get_data not found, cannot apply R_386_JMP_SLOT @0x76a36074 (0x25d6) Error: Symbol dbus_message_unref not found, cannot apply R_386_JMP_SLOT @0x76a3608c (0x2636) Error: Symbol dbus_message_iter_close_container not found, cannot apply R_386_JMP_SLOT @0x76a36090 (0x2646) Error: Symbol dbus_error_free not found, cannot apply R_386_JMP_SLOT @0x76a36094 (0x2656) Error: Symbol dbus_watch_get_unix_fd not found, cannot apply R_386_JMP_SLOT @0x76a360a0 (0x2686) Error: Symbol dbus_connection_send_with_reply_and_block not found, cannot apply R_386_JMP_SLOT @0x76a360a8 (0x26a6) Error: Symbol dbus_message_iter_append_fixed_array not found, cannot apply R_386_JMP_SLOT @0x76a360ac (0x26b6) Error: Symbol dbus_watch_get_enabled not found, cannot apply R_386_JMP_SLOT @0x76a360b0 (0x26c6) Error: Symbol dbus_timeout_get_interval not found, cannot apply R_386_JMP_SLOT @0x76a360bc (0x26f6) Error: Symbol dbus_timeout_set_data not found, cannot apply R_386_JMP_SLOT @0x76a360d8 (0x2766) Error: Symbol dbus_message_new_method_call not found, cannot apply R_386_JMP_SLOT @0x76a360e0 (0x2786) Error: Symbol dbus_message_iter_get_fixed_array not found, cannot apply R_386_JMP_SLOT @0x76a360e4 (0x2796) Error: Symbol dbus_message_iter_next not found, cannot apply R_386_JMP_SLOT @0x76a360e8 (0x27a6) Error: Symbol dbus_message_iter_open_container not found, cannot apply R_386_JMP_SLOT @0x76a360ec (0x27b6) Error: Symbol dbus_timeout_get_enabled not found, cannot apply R_386_JMP_SLOT @0x76a360f0 (0x27c6) Error: Symbol dbus_watch_handle not found, cannot apply R_386_JMP_SLOT @0x76a36118 (0x2866) Error: Symbol dbus_message_get_member not found, cannot apply R_386_JMP_SLOT @0x76a3611c (0x2876) Error: Symbol dbus_connection_ref not found, cannot apply R_386_JMP_SLOT @0x76a36120 (0x2886) Error: Symbol dbus_error_init not found, cannot apply R_386_JMP_SLOT @0x76a36124 (0x2896) Error: Symbol dbus_timeout_handle not found, cannot apply R_386_JMP_SLOT @0x76a3612c (0x28b6) Error: Symbol dbus_message_iter_get_arg_type not found, cannot apply R_386_JMP_SLOT @0x76a36130 (0x28c6) Error: Symbol dbus_error_is_set not found, cannot apply R_386_JMP_SLOT @0x76a36138 (0x28e6) Error: Symbol dbus_message_iter_recurse not found, cannot apply R_386_JMP_SLOT @0x76a36140 (0x2906) Error: Symbol dbus_message_get_interface not found, cannot apply R_386_JMP_SLOT @0x76a36148 (0x2926) Error: Symbol dbus_connection_set_dispatch_status_function not found, cannot apply R_386_JMP_SLOT @0x76a36154 (0x2956) Error: Symbol dbus_connection_add_filter not found, cannot apply R_386_JMP_SLOT @0x76a3615c (0x2976) Error: Symbol dbus_message_append_args not found, cannot apply R_386_JMP_SLOT @0x76a36164 (0x2996) Error: Symbol dbus_watch_set_data not found, cannot apply R_386_JMP_SLOT @0x76a3616c (0x29b6) Error: Symbol dbus_message_is_signal not found, cannot apply R_386_JMP_SLOT @0x76a36174 (0x29d6) Error: Symbol dbus_connection_set_watch_functions not found, cannot apply R_386_JMP_SLOT @0x76a3617c (0x29f6) Error: Symbol dbus_connection_dispatch not found, cannot apply R_386_JMP_SLOT @0x76a36184 (0x2a16) Error: Symbol dbus_message_iter_get_element_type not found, cannot apply R_386_JMP_SLOT @0x76a3618c (0x2a36) Error: Symbol obstack_vprintf not found, cannot apply R_386_32 @0x76447b88 ((nil)) Error: Symbol _obstack_newchunk not found, cannot apply R_386_JMP_SLOT @0x76448104 (0xb1d6) Error: Global Symbol fmemopen not found, cannot apply R_386_GLOB_DAT @0x76750328 ((nil)) Error: Global Symbol secure_getenv not found, cannot apply R_386_GLOB_DAT @0x7675073c ((nil)) Error: Symbol pthread_rwlock_wrlock not found, cannot apply R_386_JMP_SLOT @0x76c637dc (0xf376) Error: Symbol pthread_rwlock_init not found, cannot apply R_386_JMP_SLOT @0x76c63884 (0xf616) Error: Symbol pthread_rwlock_unlock not found, cannot apply R_386_JMP_SLOT @0x76c6399c (0xfa76) Error: Symbol fcntl64 not found, cannot apply R_386_JMP_SLOT @0x76c63bf0 (0x103c6) Error: Symbol pthread_rwlock_rdlock not found, cannot apply R_386_JMP_SLOT @0x76c63de4 (0x10b96) Error: Symbol lockf64 not found, cannot apply R_386_JMP_SLOT @0x76c63e64 (0x10d96) Error: Symbol __res_init not found, cannot apply R_386_JMP_SLOT @0x76c63ebc (0x10ef6)