Thread: DIY - KeK
View Single Post
Old 08-15-2012, 05:44 PM   #264
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
See what is to be learned from strace about this problem:
Code:
(armv6l:1) /home # strace -fF chroot /home/emd /bin/sh
  * * snip the usual memory setup stuff * *
  chroot("/home/emd")                     = 0
  chdir("/")                              = 0
  execve("/bin/sh", ["/bin/sh"], [/* 9 vars */]) = 0
  --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x1be} ---
  +++ killed by SIGSEGV +++
  Segmentation fault
(armv6l:1) /home #
Hmm...
The chroot, chdir and execve system calls all returned 0 (success).
It looks like the Ubuntu-core, /bin/sh stumbled into the mapping error segfault.

In Ubuntu-core /bin/sh is a sym-link to /bin/dash.
About the simplest compiled program in any distribution is:
Code:
int main(void) { return 0; }
Also known in public as: /bin/true.

Code:
(armv6l:1) /home # strace -fF chroot /home/emd /bin/true
  * * snip the usual memory setup stuff * *
chroot("/home/emd")                     = 0
chdir("/")                              = 0
execve("/bin/true", ["/bin/true"], [/* 9 vars */]) = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x1be} ---
+++ killed by SIGSEGV +++
Segmentation fault
(armv6l:1) /home #
Hmm...
That should tell me something, not sure what.
How in the world can: "return 0" cause a seg-fault?

An ABI mis-match?
Will have to investigate that possibility.
knc1 is offline   Reply With Quote