{"action":"created","issue":{"url":"https://api.github.com/repos/CTSRD-CHERI/cheribsd/issues/183","repository_url":"https://api.github.com/repos/CTSRD-CHERI/cheribsd","labels_url":"https://api.github.com/repos/CTSRD-CHERI/cheribsd/issues/183/labels{/name}","comments_url":"https://api.github.com/repos/CTSRD-CHERI/cheribsd/issues/183/comments","events_url":"https://api.github.com/repos/CTSRD-CHERI/cheribsd/issues/183/events","html_url":"https://github.com/CTSRD-CHERI/cheribsd/issues/183","id":200148377,"number":183,"title":"Dynamic linking broken","user":{"login":"RichardsonAlex","id":4019307,"avatar_url":"https://avatars.githubusercontent.com/u/4019307?v=3","gravatar_id":"","url":"https://api.github.com/users/RichardsonAlex","html_url":"https://github.com/RichardsonAlex","followers_url":"https://api.github.com/users/RichardsonAlex/followers","following_url":"https://api.github.com/users/RichardsonAlex/following{/other_user}","gists_url":"https://api.github.com/users/RichardsonAlex/gists{/gist_id}","starred_url":"https://api.github.com/users/RichardsonAlex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RichardsonAlex/subscriptions","organizations_url":"https://api.github.com/users/RichardsonAlex/orgs","repos_url":"https://api.github.com/users/RichardsonAlex/repos","events_url":"https://api.github.com/users/RichardsonAlex/events{/privacy}","received_events_url":"https://api.github.com/users/RichardsonAlex/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-01-11T16:55:31Z","updated_at":"2017-01-11T20:50:58Z","closed_at":null,"body":"It seems that dynamically linked binaries no longer work with latest git HEAD. Not sure if it was the merge or is related to the linker script change.\r\n\r\nWhen running /bin/helloworld with rtld debug enabled I get the following output:\r\n\r\n```\r\nroot@qemu-cheri-alr48:~ # /bin/helloworld\r\n/libexec/ld-cheri-elf.so.1 is initialized, base address = 0x161000000\r\nRTLD dynamic = 0x1610026d8\r\nRTLD pltgot  = 0x1610b5a00\r\ninitializing thread locks\r\n_rtld_thread_init: done\r\nprocessing main program's program header\r\nnote osrel 1200019\r\nnote crt_no_init\r\nAT_EXECPATH 0x7fffffee90 /bin/helloworld\r\nobj_main path /bin/helloworld\r\nIgnoring d_tag 21 = 0x15\r\nIgnoring d_tag 1879048193 = 0x70000001\r\nIgnoring d_tag 1879048197 = 0x70000005\r\nIgnoring d_tag 1879048198 = 0x70000006\r\nIgnoring d_tag 1879048210 = 0x70000012\r\n/bin/helloworld valid_hash_sysv 1 valid_hash_gnu 0 dynsymcount 41\r\nlm_init(\"(null)\")\r\nloading LD_PRELOAD libraries\r\nloading needed objects\r\n Searching for \"libgcc_s.so.1\"\r\nsearch_library_pathfds('libgcc_s.so.1', '(null)', fdp)\r\nlm_find(\"(null)\", \"/libcheri\")\r\nlmp_find(\"$DEFAULT$\")\r\n  Trying \"/libcheri/libgcc_s.so.1\"\r\nlm_find(\"(null)\", \"/usr/libcheri\")\r\nlmp_find(\"$DEFAULT$\")\r\n  Trying \"/usr/libcheri/libgcc_s.so.1\"\r\nloading \"/usr/libcheri/libgcc_s.so.1\"\r\nIgnoring d_tag 1879048193 = 0x70000001\r\nIgnoring d_tag 1879048197 = 0x70000005\r\nIgnoring d_tag 1879048198 = 0x70000006\r\nIgnoring d_tag 1879048210 = 0x70000012\r\n/usr/libcheri/libgcc_s.so.1 valid_hash_sysv 1 valid_hash_gnu 0 dynsymcount 20\r\n  0xc000 .. 0x1cfff: /usr/libcheri/libgcc_s.so.1\r\n Searching for \"libc.so.7\"\r\nsearch_library_pathfds('libc.so.7', '(null)', fdp)\r\nlm_find(\"(null)\", \"/libcheri\")\r\nlmp_find(\"$DEFAULT$\")\r\n  Trying \"/libcheri/libc.so.7\"\r\nlm_find(\"(null)\", \"/usr/libcheri\")\r\nlmp_find(\"$DEFAULT$\")\r\n  Trying \"/usr/libcheri/libc.so.7\"\r\nloading \"/usr/libcheri/libc.so.7\"\r\nIgnoring d_tag 1879048193 = 0x70000001\r\nIgnoring d_tag 1879048197 = 0x70000005\r\nIgnoring d_tag 1879048198 = 0x70000006\r\nIgnoring d_tag 1879048210 = 0x70000012\r\n/usr/libcheri/libc.so.7 valid_hash_sysv 1 valid_hash_gnu 0 dynsymcount 3106\r\n  0x1d000 .. 0x347fff: /usr/libcheri/libc.so.7\r\n  WARNING: /usr/libcheri/libc.so.7 has impure text\r\nchecking for required versions\r\ninitializing initial thread local storage offsets\r\nrelocating \"/bin/helloworld\"\r\ngot:0x120011598 for 17 entries adding 0\r\ngot:0x120011618 for 41 entries\r\nrelocating \"/usr/libcheri/libgcc_s.so.1\"\r\ngot:0x1c988 for 8 entries adding 0xc000\r\ngot:0x1c9c0 for 20 entries\r\nlooking for .size.__CTOR_END__ in /usr/libcheri/libgcc_s.so.1 and /bin/helloworld\r\nfound .size.__CTOR_END__ in /usr/libcheri/libgcc_s.so.1 and /bin/helloworld\r\nlooking for .size.__start___cap_relocs in /usr/libcheri/libgcc_s.so.1 and /bin/helloworld\r\nlooking for .size.__stop___cap_relocs in /usr/libcheri/libgcc_s.so.1 and /bin/helloworld\r\nlooking for .size._int in /usr/libcheri/libgcc_s.so.1 and /bin/helloworld\r\nfound .size._int in /usr/libcheri/libgcc_s.so.1 and /bin/helloworld\r\nrelocating \"/usr/libcheri/libc.so.7\"\r\ngot:0x315688 for 5077 entries adding 0x1d000\r\ngot:0x31f528 for 3106 entries\r\nlooking for .size.__pthread_cxa_finalize in /usr/libcheri/libc.so.7 and /libexec/ld-cheri-elf.so.1\r\nlooking for .size.environ in /usr/libcheri/libc.so.7 and /bin/helloworld\r\nfound .size.environ in /usr/libcheri/libc.so.7 and /bin/helloworld\r\n0 -> 20\r\nlooking for .size.__progname in /usr/libcheri/libc.so.7 and /bin/helloworld\r\nfound .size.__progname in /usr/libcheri/libc.so.7 and /bin/helloworld\r\n0 -> 20\r\nlooking for .size._Block_copy in /usr/libcheri/libc.so.7 and /bin/helloworld\r\ndoing copy relocations\r\ninitializing initial thread local storage\r\ninitializing key program variables\r\n\"__progname\": *0x1200114c0 <-- 0x7fffffed05\r\n\"environ\": *0x120011740 <-- 0x7fffffe4a0\r\n\"__elf_aux_vector\": *0x347000 <-- 0x7fffffe700\r\nresolving ifuncs\r\ncalling init function for /usr/libcheri/libc.so.7 at 0x71fd0\r\ncalling init function for /usr/libcheri/libgcc_s.so.1 at 0xc7a0\r\nloading filtees\r\ntransferring control to program entry point = 0x120000c00\r\n$c00: v:1 s:0 p:7fff807d b:0000000000000000 l:0000010000000000 o:0 t:0\r\n$c01: v:1 s:0 p:7fff807d b:0000000000000000 l:0000010000000000 o:40 t:0\r\n$c02: v:1 s:0 p:7fff807d b:00000001200114c0 l:0000000000000020 o:0 t:0\r\n$c03: v:1 s:0 p:7fff807d b:0000007fffffdc58 l:0000000000000308 o:8 t:0\r\n$c04: v:1 s:0 p:7fff807d b:0000007fffffdc58 l:0000000000000308 o:0 t:0\r\n$c05: v:1 s:0 p:7fff807d b:0000000120011700 l:0000000000000020 o:0 t:0\r\n$c06: v:1 s:0 p:7fff807d b:0000000000000000 l:0000010000000000 o:120011740 t:0\r\n$c07: v:1 s:0 p:7fff807d b:0000000000000000 l:0000010000000000 o:1200114c0 t:0\r\n$c08: v:1 s:0 p:7fff807d b:0000000000000000 l:0000010000000000 o:1200013a0 t:0\r\n$c09: v:1 s:0 p:7fff807d b:0000007fff7ff000 l:00000000007ff3c0 o:7fe258 t:0\r\n$c10: v:0 s:0 p:00000000 b:0000000000000000 l:0000000000000000 o:0 t:0\r\n$c11: v:1 s:0 p:7fff807d b:0000007fff7ff000 l:00000000007ff3c0 o:0 t:0\r\n$c12: v:1 s:0 p:7ffe8017 b:0000000000000000 l:0000010000000000 o:70bf0 t:0\r\n$c13: v:1 s:0 p:00008055 b:0000007fffffd500 l:0000000000000020 o:0 t:0\r\n$c14: v:0 s:0 p:00000000 b:0000000000000000 l:0000000000000000 o:0 t:0\r\n$c15: v:0 s:0 p:00000000 b:0000000000000000 l:0000000000000000 o:0 t:0\r\n$c16: v:0 s:0 p:00000000 b:0000000000000000 l:0000000000000000 o:0 t:0\r\n$c17: v:1 s:0 p:7ffe8017 b:0000000000000000 l:0000010000000000 o:161016554 t:0\r\n$c18: v:1 s:0 p:7fff807d b:0000000000000000 l:0000010000000000 o:40 t:0\r\n$c19: v:1 s:0 p:7fff807d b:0000000000000000 l:0000010000000000 o:5020 t:0\r\n$c20: v:1 s:0 p:7fff807d b:0000007fffffdf60 l:0000000000000020 o:0 t:0\r\n$c21: v:1 s:0 p:7fff807d b:00000001610a4980 l:0000000000000020 o:0 t:0\r\n$c22: v:1 s:0 p:7fff807d b:0000000000000000 l:0000010000000000 o:120011590 t:0\r\n$c23: v:0 s:0 p:00000000 b:0000000000000000 l:0000000000000000 o:0 t:0\r\n$c24: v:0 s:0 p:00000000 b:0000000000000000 l:0000000000000000 o:0 t:0\r\n$c26: v:1 s:0 p:7fff807d b:0000000000000000 l:0000010000000000 o:0 t:0\r\n$c31: v:1 s:0 p:7ffe8017 b:0000000000000000 l:0000010000000000 o:71f6c t:0\r\nJan 11 16:52:05 qemu-cheri-alr48 kernel: ALIGNMENT_FIX_ERR: pid 592 tid 100040 (helloworld), uid 0: pc 0x71f6c got a read fault (type 0x4) at 0x1e0000001f\r\nJan 11 16:52:05 qemu-cheri-alr48 kernel: Trapframe Register Dump:\r\nJan 11 16:52:05 qemu-cheri-alr48 kernel: zero: 0        at: 0x26f6d80001d000    v0: 0x1e0000001f        v1: 0\r\nJan 11 16:52:05 qemu-cheri-alr48 kernel: a0: 0  a1: 0x7ff058    a2: 0x9 a3: 0\r\nJan 11 16:52:05 qemu-cheri-alr48 kernel: a4: 0  a5: 0   a6: 0   a6: 0\r\nJan 11 16:52:05 qemu-cheri-alr48 kernel: t0: 0x38560    t1: 0x161038560 t2: 0x20        t3: 0\r\nJan 11 16:52:05 qemu-cheri-alr48 kernel: t8: 0x22       t9: 0x70bf0     s0: 0x22        s1: 0x1\r\nJan 11 16:52:05 qemu-cheri-alr48 kernel: s2: 0  s3: 0   s4: 0   s5: 0\r\nJan 11 16:52:05 qemu-cheri-alr48 kernel: s6: 0  s7: 0   k0: 0   k1: 0\r\nJan 11 16:52:05 qemu-cheri-alr48 kernel: gp: 0x1610bd9f0        sp: 0x7feb20    s8: 0x7feb20    ra: 0x120001360\r\nJan 11 16:52:05 qemu-cheri-alr48 kernel: sr: 0x408084b3 mullo: 0        mulhi: 0x1      badvaddr: 0x1e0000001f\r\nJan 11 16:52:05 qemu-cheri-alr48 kernel: cause: 0x10    pc: 0x71f6c\r\nJan 11 16:52:05 qemu-cheri-alr48 kernel: Page table info for bad address 0x1e0000001f: pde = 0, pte = 0\r\nBus error (core dumped)\r\n```"},"comment":{"url":"https://api.github.com/repos/CTSRD-CHERI/cheribsd/issues/comments/271990370","html_url":"https://github.com/CTSRD-CHERI/cheribsd/issues/183#issuecomment-271990370","issue_url":"https://api.github.com/repos/CTSRD-CHERI/cheribsd/issues/183","id":271990370,"user":{"login":"RichardsonAlex","id":4019307,"avatar_url":"https://avatars.githubusercontent.com/u/4019307?v=3","gravatar_id":"","url":"https://api.github.com/users/RichardsonAlex","html_url":"https://github.com/RichardsonAlex","followers_url":"https://api.github.com/users/RichardsonAlex/followers","following_url":"https://api.github.com/users/RichardsonAlex/following{/other_user}","gists_url":"https://api.github.com/users/RichardsonAlex/gists{/gist_id}","starred_url":"https://api.github.com/users/RichardsonAlex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RichardsonAlex/subscriptions","organizations_url":"https://api.github.com/users/RichardsonAlex/orgs","repos_url":"https://api.github.com/users/RichardsonAlex/repos","events_url":"https://api.github.com/users/RichardsonAlex/events{/privacy}","received_events_url":"https://api.github.com/users/RichardsonAlex/received_events","type":"User","site_admin":false},"created_at":"2017-01-11T20:50:58Z","updated_at":"2017-01-11T20:50:58Z","body":"I also have some patches which will remove the use of the local label in PIC_TAILCALL by using pc-relative relocations. Until that works, changing the local label sounds like a good solution.\r\n\r\nAlthough I feel like clang should actually be warning about duplicate labels here."}}
{"actor":{"display_login":"RichardsonAlex"}}