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

Memory access error in bin compact mode #1101

Open
GuilhermeVieiraDev opened this issue Sep 16, 2023 · 1 comment
Open

Memory access error in bin compact mode #1101

GuilhermeVieiraDev opened this issue Sep 16, 2023 · 1 comment
Labels
kind/bug Something isn't working

Comments

@GuilhermeVieiraDev
Copy link

GuilhermeVieiraDev commented Sep 16, 2023

Describe the bug

I was doing a PR to add the convert command of imagemagick the dynamic-apps repository while the error occurred.
It is missing a library, when I copied from the original installation it works.

Steps to reproduce

After installing imagemagick on your computer start by extracting the convert bin to your dynamic-apps:

  • ./extract.sh /usr/bin/convert /imagemagick

Copy the bin file:

  • cp /usr/bin/convert ../dynamic-apps/imagemagick/usr/bin

There are some modules and configurations we need to copy as well to the directory:

  • cp --parents /etc/ImageMagick-7/delegates.xml ../dynamic-apps/imagemagick
  • cp --parents -r /usr/lib/ImageMagick-7.1.1/ ../dynamic-apps/imagemagick

Add an image in the /dynamic-apps/imagemagick directory called img.png

Then run in the app-elfloader:

  • ./run.sh -r ../dynamic-apps/imagemagick/ /usr/bin/convert img.png img.jpg or use ./run.sh -k app-elfloader_qemu-x86_64_strace -r ../dynamic-apps/imagemagick/ /usr/bin/convert img.png img.jpg to have strace logs.

If I use the next command it should work properly:

  • cp --parents /usr/lib/libjpeg.so.8 ../dynamic-apps/imagemagick

Expected behavior

Convert, for example, an image from PNG to JPEG.

Which architectures were you using or does this bug affect?

x86_64

Which platforms were you using or does this bug affect?

kvm

Relevant log output

openat(AT_FDCWD, "/usr/lib/libjpeg.so.8", O_RDONLY|O_CLOEXEC) = No such file or directory (-2)
munmap(va:0x100366d000) = OK
openat(AT_FDCWD, "/usr/lib/ImageMagick-7.1.1/modules-Q16HDRI/coders/jpeg.so", O_RDONLY|O_CLOEXEC) = fd:3
read(fd:3, <out>"\x7FELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00>\x00\x01\x00\x00\x00"..., 832) = 832
newfstatat(0x3, 0x40016ace4, ...) = 0x0
mmap(NULL, 57360, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, fd:3, 0) = va:0x100366d000
mmap(va:0x1003670000, 28672, PROT_EXEC|PROT_READ, MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED, fd:3, 12288) = va:0x1003670000
mmap(va:0x1003677000, 12288, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED, fd:3, 40960) = va:0x1003677000
mmap(va:0x100367a000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED, fd:3, 49152) = va:0x100367a000
close(fd:3) = OK
openat(AT_FDCWD, "/usr/lib/libjpeg.so.8", O_RDONLY|O_CLOEXEC) = No such file or directory (-2)
munmap(va:0x100366d000) = OK
clock_gettime(CLOCK_0x4, <out>timespec:0x400083200) = Invalid argument (-22)
times(0x400083200, 0x400083200, ...) = Operation not supported (-95)
futex(va:0x47f845884, FUTEX_WAKE|FUTEX_PRIVATE_FLAG, 0x7fffffff) = OK
[    5.264295] CRIT: [libkvmplat] <trace.c @   41> RIP: 0000001000050e29 CS: 0008
[    5.266778] CRIT: [libkvmplat] <trace.c @   42> RSP: 000000040007cc78 SS: 0010 EFLAGS: 00010206
[    5.269913] CRIT: [libkvmplat] <trace.c @   44> RAX: 000000047f886900 RBX: 000000047f83ea10 RCX: 0000000000000006
[    5.273507] CRIT: [libkvmplat] <trace.c @   46> RDX: 000000047f816a50 RSI: 0000000000000002 RDI: 000000040007fcb0
[    5.276921] CRIT: [libkvmplat] <trace.c @   48> RBP: 000000047f838a00 R08: 000000047f800010 R09: 0000000000000007
[    5.280284] CRIT: [libkvmplat] <trace.c @   50> R10: 000000047f837a40 R11: 000000040007ac78 R12: 000000047f816a50
[    5.283685] CRIT: [libkvmplat] <trace.c @   52> R13: 0000000000000001 R14: 000000047f886900 R15: 000000040007fcb0
[    5.287070] CRIT: [libkvmplat] <trace.c @   86> base is 0x47f838a00 caller is 0
[    5.289545] CRIT: [libkvmplat] <trace.c @   86> base is 0x1700000001 RIP: 0000000000104507 CS: 0008
[    5.292497] CRIT: [libkvmplat] <trace.c @   42> RSP: 00000000001efee0 SS: 0010 EFLAGS: 00010006
[    5.295336] CRIT: [libkvmplat] <trace.c @   44> RAX: 00000000001efe08 RBX: 0000001700000001 RCX: 0000000000000018
[    5.299065] CRIT: [libkvmplat] <trace.c @   46> RDX: 0000003000000030 RSI: 0000000000000000 RDI: 00000000001a7c41
[    5.302634] CRIT: [libkvmplat] <trace.c @   48> RBP: 00000000001efef0 R08: 0000000000000046 R09: 00000000000000ff
[    5.305960] CRIT: [libkvmplat] <trace.c @   50> R10: 0000000000000002 R11: 0000000000000000 R12: 0000000000000007
[    5.309271] CRIT: [libkvmplat] <trace.c @   52> R13: 00000000001eff50 R14: 000000047f886900 R15: 000000040007fcb0
[    5.312576] CRIT: [libkvmplat] <trace.c @   86> base is 0x1efef0 caller is 0x1053c8
[    5.315237] CRIT: [libkvmplat] <trace.c @   86> base is 0x1eff40 caller is 0x10ef3d
[    5.317715] CRIT: [libkvmplat] <trace.c @   86> base is 0x1efef0 caller is 0x1053c8
[    5.320188] CRIT: [libkvmplat] <trace.c @   86> base is 0x1eff40 caller is 0x10ef3d
[    5.322668] CRIT: [libkvmplat] <trace.c @   86> base is 0x1efef0 caller is 0x1053c8
[    5.325166] CRIT: [libkvmplat] <trace.c @   86> base is 0x1eff40 caller is 0x10ef3d
[    5.327765] CRIT: [libkvmplat] <trace.c @   86> base is 0x1efef0 caller is 0x1053c8
[    5.330460] CRIT: [libkvmplat] <trace.c @   86> base is 0x1eff40 caller is 0x10ef3d
[    5.333139] CRIT: [libkvmplat] <trace.c @   86> base is 0x1efef0 caller is 0x1053c8
[    5.335619] CRIT: [libkvmplat] <trace.c @   86> base is 0x1eff40 caller is 0x10ef3d
[    5.338090] CRIT: [libkvmplat] <trace.c @   86> base is 0x1efef0 caller is 0x1053c8
[    5.340547] CRIT: [libkvmplat] <trace.c @   86> base is 0x1eff40 caller is 0x10ef3d
[    5.343029] CRIT: [libkvmplat] <trace.c @   86> base is 0x1efef0 caller is 0x1053c8
[    5.345498] CRIT: [libkvmplat] <trace.c @   86> base is 0x1eff40 caller is 0x10ef3d
[    5.347982] CRIT: [libkvmplat] <trace.c @   86> base is 0x1efef0 caller is 0x1053c8
[    5.350467] CRIT: [libkvmplat] <trace.c @   86> base is 0x1eff40 caller is 0x10ef3d
[    5.352938] CRIT: [libkvmplat] <trace.c @   86> base is 0x1efef0 caller is 0x1053c8
[    5.355414] CRIT: [libkvmplat] <trace.c @   86> base is 0x1eff40 caller is 0x10ef3d
@GuilhermeVieiraDev GuilhermeVieiraDev added the kind/bug Something isn't working label Sep 16, 2023
@TiagoRG
Copy link

TiagoRG commented Sep 16, 2023

If I import and use the magick command by itself with the compare function, it also has a similar error.

./run.sh -k app-elfloader_qemu-x86_64_strace -r path/to/dynamic-apps/imagemagick /usr/bin/magick compare img1.png img2.jpg diff.png

These are the logs I got from it:

time(0x0, 0x0, ...) = 0x6505bc78
futex(va:0x47f858684, FUTEX_WAKE|FUTEX_PRIVATE_FLAG, 0x7fffffff) = OK
munmap(va:0x1004905000) = OK
newfstatat(0xffffff9c, 0x40009c070, ...) = No such file or directory (-2)
clock_gettime(CLOCK_0x4, <out>timespec:0x400084170) = Invalid argument (-22)
times(0x400084170, 0x400084170, ...) = Operation not supported (-95)
futex(va:0x47f858684, FUTEX_WAKE|FUTEX_PRIVATE_FLAG, 0x7fffffff) = OK
[    2.885921] CRIT: [libkvmplat] <trace.c @   41> RIP: 0000001000050e29 CS: 0008
[    2.887825] CRIT: [libkvmplat] <trace.c @   42> RSP: 000000040007cae8 SS: 0010 EFLAGS: 00010206
[    2.890706] CRIT: [libkvmplat] <trace.c @   44> RAX: 000000047f855ac0 RBX: 000000047f8525a0 RCX: 0000000000000006
[    2.893868] CRIT: [libkvmplat] <trace.c @   46> RDX: 000000047f816a50 RSI: 0000000000000002 RDI: 0000000400080b20
[    2.896473] CRIT: [libkvmplat] <trace.c @   48> RBP: 000000047f850000 R08: 000000047f800010 R09: 0000000000000007
[    2.899081] CRIT: [libkvmplat] <trace.c @   50> R10: 000000047f835e80 R11: 000000040007bae8 R12: 000000047f816a50
[    2.901779] CRIT: [libkvmplat] <trace.c @   52> R13: 0000000000000001 R14: 000000047f855ac0 R15: 0000000400080b20
[    2.904441] CRIT: [libkvmplat] <trace.c @   86> base is 0x47f850000 caller is 0x4
[    2.907189] CRIT: [libkvmplat] <trace.c @   86> base is 0x1700000001 RIP: 0000000000104507 CS: 0008
[    2.909938] CRIT: [libkvmplat] <trace.c @   42> RSP: 00000000001efee0 SS: 0010 EFLAGS: 00010006
[    2.913000] CRIT: [libkvmplat] <trace.c @   44> RAX: 00000000001efe08 RBX: 0000001700000001 RCX: 0000000000000018
[    2.915724] CRIT: [libkvmplat] <trace.c @   46> RDX: 0000003000000030 RSI: 0000000000000000 RDI: 00000000001a7c41
[    2.918589] CRIT: [libkvmplat] <trace.c @   48> RBP: 00000000001efef0 R08: 0000000000000046 R09: 00000000000000ff
[    2.921253] CRIT: [libkvmplat] <trace.c @   50> R10: 0000000000000002 R11: 0000000000000000 R12: 0000000000000007
[    2.924646] CRIT: [libkvmplat] <trace.c @   52> R13: 00000000001eff50 R14: 000000047f855ac0 R15: 0000000400080b20
[    2.927245] CRIT: [libkvmplat] <trace.c @   86> base is 0x1efef0 caller is 0x1053c8
[    2.929182] CRIT: [libkvmplat] <trace.c @   86> base is 0x1eff40 caller is 0x10ef3d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
Status: 🧊 Icebox
Development

No branches or pull requests

2 participants