Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 293632 - sys-apps/sandbox: sparc ptrace code breaks glibc compile
Summary: sys-apps/sandbox: sparc ptrace code breaks glibc compile
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Sandbox (show other bugs)
Hardware: Sparc Linux
: High normal (vote)
Assignee: Sandbox Maintainers
URL: https://lore.kernel.org/sparclinux/20...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-18 17:36 UTC by Raúl Porcel (RETIRED)
Modified: 2021-10-25 06:23 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Raúl Porcel (RETIRED) gentoo-dev 2009-11-18 17:36:20 UTC
CPP='sparc-unknown-linux-gnu-gcc -E -x c-header'  /var/tmp/portage/sys-libs/glibc-2.9_p20081201-r2/work/build-sparc32-sparc-unknown-linux-gnu-nptl/elf/ld-linux.so.2 --library-path /var/tmp/portage/sys-libs/glibc-2.9_p20081201-r2/work/build-sparc32-sparc-unknown-linux-gnu-nptl:/var/tmp/portage/sys-libs/glibc-2.9_p20081201-r2/work/build-sparc32-sparc-unknown-linux-gnu-nptl/math:/var/tmp/portage/sys-libs/glibc-2.9_p20081201-r2/work/build-sparc32-sparc-unknown-linux-gnu-nptl/elf:/var/tmp/portage/sys-libs/glibc-2.9_p20081201-r2/work/build-sparc32-sparc-unknown-linux-gnu-nptl/dlfcn:/var/tmp/portage/sys-libs/glibc-2.9_p20081201-r2/work/build-sparc32-sparc-unknown-linux-gnu-nptl/nss:/var/tmp/portage/sys-libs/glibc-2.9_p20081201-r2/work/build-sparc32-sparc-unknown-linux-gnu-nptl/nis:/var/tmp/portage/sys-libs/glibc-2.9_p20081201-r2/work/build-sparc32-sparc-unknown-linux-gnu-nptl/rt:/var/tmp/portage/sys-libs/glibc-2.9_p20081201-r2/work/build-sparc32-sparc-unknown-linux-gnu-nptl/resolv:/var/tmp/portage/sys-libs/glibc-2.9_p20081201-r2/work/build-sparc32-sparc-unknown-linux-gnu-nptl/crypt:/var/tmp/portage/sys-libs/glibc-2.9_p20081201-r2/work/build-sparc32-sparc-unknown-linux-gnu-nptl/nptl /var/tmp/portage/sys-libs/glibc-2.9_p20081201-r2/work/build-sparc32-sparc-unknown-linux-gnu-nptl/sunrpc/rpcgen -Y ../scripts -h rpcsvc/rstat.x -o /var/tmp/portage/sys-libs/glibc-2.9_p20081201-r2/work/build-sparc32-sparc-unknown-linux-gnu-nptl/sunrpc/rpcsvc/rstat.T
ISE:_do_ptrace ptrace(PTRACE_PEEKDATA, ..., 0x00000004, 0x00000000): Input/output error
/usr/lib/libsandbox.so[0x7003b570]
/usr/lib/libsandbox.so[0x7003d608]
/usr/lib/libsandbox.so[0x7003d6a8]
/usr/lib/libsandbox.so[0x7003e038]
/usr/lib/libsandbox.so[0x70040f60]
/usr/lib/libsandbox.so(execve+0x40)[0x70041300]
/bin/sh(shell_execve+0x10)[0x3be30]
/bin/sh[0x41a04]
/bin/sh(execute_command_internal+0xc18)[0x3dff8]
/bin/sh(parse_and_execute+0x214)[0x7f734]
/proc/12432/cmdline: /var/tmp/portage/sys-libs/glibc-2.9_p20081201-r2/work/build-sparc32-sparc-unknown-linux-gnu-nptl/elf/ld-linux.so.2 --library-path /var/tmp/portage/sys-libs/glibc-2.9_p20081201-r2/work/build-sparc32-sparc-unknown-linux-gnu-nptl:/var/tmp/portage/sys-libs/glibc-2.9_p20081201-r2/work/build-sparc32-sparc-unknown-linux-gnu-nptl/math:/var/tmp/portage/sys-libs/glibc-2.9_p20081201-r2/work/build-sparc32-sparc-unknown-linux-gnu-nptl/elf:/var/tmp/portage/sys-libs/glibc-2.9_p20081201-r2/work/build-sparc32-sparc-unknown-linux-gnu-nptl/dlfcn:/var/tmp/portage/sys-libs/glibc-2.9_p20081201-r2/work/build-sparc32-sparc-unknown-linux-gnu-nptl/nss:/var/tmp/portage/sys-libs/glibc-2.9_p20081201-r2/work/build-sparc32-sparc-unknown-linux-gnu-nptl/nis:/var/tmp/portage/sys-libs/glibc-2.9_p20081201-r2/work/build-sparc32-sparc-unknown-linux-gnu-nptl/rt:/var/tmp/portage/sys-libs/glibc-2.9_p20081201-r2/work/build-sparc32-sparc-unknown-linux-gnu-nptl/resolv:/var/tmp/portage/sys-libs/glibc-2.9_p20081201-r2/work/build-sparc32-sparc-unknown-linux-gnu-nptl/crypt:/var/tmp/portage/sys-libs/glibc-2.9_p20081201-r2/work/build-sparc32-sparc-unknown-linux-gnu-nptl/nptl /var/tmp/portage/sys-libs/glibc-2.9_p20081201-r2/work/build-sparc32-sparc-unknown-linux-gnu-nptl/sunrpc/rpcgen -Y ../scripts -h rpcsvc/rstat.x -o /var/tmp/portage/sys-libs/glibc-2.9_p20081201-r2/work/build-sparc32-sparc-unknown-linux-gnu-nptl/sunrpc/rpcsvc/rstat.T 

make[2]: *** [/var/tmp/portage/sys-libs/glibc-2.9_p20081201-r2/work/build-sparc32-sparc-unknown-linux-gnu-nptl/sunrpc/rpcsvc/rstat.stmp] Aborted
make[2]: Leaving directory `/var/tmp/portage/sys-libs/glibc-2.9_p20081201-r2/work/glibc-2.9-20081201/sunrpc'
make[1]: *** [sunrpc/others] Error 2
make[1]: Leaving directory `/var/tmp/portage/sys-libs/glibc-2.9_p20081201-r2/work/glibc-2.9-20081201'
make: *** [all] Error 2
 * 
 * ERROR: sys-libs/glibc-2.9_p20081201-r2 failed.
 * Call stack:
 *               ebuild.sh, line   49:  Called src_compile


Works fine with sandbox-2.1
Comment 1 SpanKY gentoo-dev 2009-11-19 00:05:51 UTC
i havent quite been able to figure out why it's failing yet.  it ptraces an open() call and when trying to read the file name in question, the register has a value of 4 instead of an address to a string.

trying to debug with simpler ptrace tools hasnt yielded insight yet :/
Comment 2 Raúl Porcel (RETIRED) gentoo-dev 2009-11-21 14:02:27 UTC
No hurry Mike, i've marked it -sparc meanwhile :)
Comment 4 Daniel Robbins 2010-10-24 21:52:28 UTC
Getting this on amd64 with Funtoo's glibc-2.10.1-r1 and sandbox enabled - does it seem to be the same thing? : sandbox-2.3-r1.

nu-nptl/crypt:/var/tmp/portage/sys-libs/glibc-2.10.1-r1/work/build-x86-x86_64-pc-linux-gnu-nptl/nptl /var/tmp/portage/sys-libs/glibc-2.10.1-r1/work/build-x86-x86_64-pc-linux-gnu-nptl/sunrpc/rpcgen -Y ../scripts -h rpcsvc/rex.x -o /var/tmp/portage/sys-libs/glibc-2.10.1-r1/work/build-x86-x86_64-pc-linux-gnu-nptl/sunrpc/rpcsvc/rex.T
.././scripts/mkinstalldirs /var/tmp/portage/sys-libs/glibc-2.10.1-r1/work/build-x86-x86_64-pc-linux-gnu-nptl/sunrpc/rpcsvc
touch /var/tmp/portage/sys-libs/glibc-2.10.1-r1/work/build-x86-x86_64-pc-linux-gnu-nptl/sunrpc/xklm_prot.stmp
touch /var/tmp/portage/sys-libs/glibc-2.10.1-r1/work/build-x86-x86_64-pc-linux-gnu-nptl/sunrpc/rpcsvc/nlm_prot.stmp
touch /var/tmp/portage/sys-libs/glibc-2.10.1-r1/work/build-x86-x86_64-pc-linux-gnu-nptl/sunrpc/rpcsvc/bootparam_prot.stmp
/usr/lib/libsandbox.so[0x2b95bbefe852]
/usr/lib/libsandbox.so[0x2b95bbefe8c3]
/usr/lib/libsandbox.so[0x2b95bbf005bf]
/usr/lib/libsandbox.so[0x2b95bbf00b69]
/usr/lib/libsandbox.so[0x2b95bbf018cc]
/usr/lib/libsandbox.so(execve+0x4f)[0x2b95bbf02bcf]
/bin/sh(shell_execve+0x33)[0x42fcd3]
touch /var/tmp/portage/sys-libs/glibc-2.10.1-r1/work/build-x86-x86_64-pc-linux-gnu-nptl/sunrpc/rpcsvc/klm_prot.stmp
/bin/sh[0x434fe5]
/bin/sh(execute_command_internal+0xb97)[0x431cf7]
/bin/sh(parse_and_execute+0x1ca)[0x46d53a]
/proc/4378/cmdline: /var/tmp/portage/sys-libs/glibc-2.10.1-r1/work/build-x86-x86_64-pc-linux-gnu-nptl/elf/ld-linux.so.2 --library-path /var/tmp/portage/sys-libs/glibc-2.10.1-r1/work/build-x86-x86_64-pc-linux-gnu-nptl:/var/tmp/portage/sys-libs/glibc-2.10.1-r1/work/build-x86-x86_64-pc-linux-gnu-nptl/math:/var/tmp/portage/sys-libs/glibc-2.10.1-r1/work/build-x86-x86_64-pc-linux-gnu-nptl/elf:/var/tmp/portage/sys-libs/glibc-2.10.1-r1/work/build-x86-x86_64-pc-linux-gnu-nptl/dlfcn:/var/tmp/portage/sys-libs/glibc-2.10.1-r1/work/build-x86-x86_64-pc-linux-gnu-nptl/nss:/var/tmp/portage/sys-libs/glibc-2.10.1-r1/work/build-x86-x86_64-pc-linux-gnu-nptl/nis:/var/tmp/portage/sys-libs/glibc-2.10.1-r1/work/build-x86-x86_64-pc-linux-gnu-nptl/rt:/var/tmp/portage/sys-libs/glibc-2.10.1-r1/work/build-x86-x86_64-pc-linux-gnu-nptl/resolv:/var/tmp/portage/sys-libs/glibc-2.10.1-r1/work/build-x86-x86_64-pc-linux-gnu-nptl/crypt:/var/tmp/portage/sys-libs/glibc-2.10.1-r1/work/build-x86-x86_64-pc-linux-gnu-nptl/nptl /var/tmp/portage/sys-libs/glibc-2.10.1-r1/work/build-x86-x86_64-pc-linux-gnu-nptl/sunrpc/rpcgen -Y ../scripts -h rpcsvc/yppasswd.x -o /var/tmp/portage/sys-libs/glibc-2.10.1-r1/work/build-x86-x86_64-pc-linux-gnu-nptl/sunrpc/rpcsvc/yppasswd.T

make[2]: *** [/var/tmp/portage/sys-libs/glibc-2.10.1-r1/work/build-x86-x86_64-pc-linux-gnu-nptl/sunrpc/rpcsvc/yppasswd.stmp] Aborted
make[2]: *** Waiting for unfinished jobs....
Comment 5 SpanKY gentoo-dev 2010-10-26 14:03:34 UTC
if the arch isnt sparc, then it isnt the same bug
Comment 6 SpanKY gentoo-dev 2016-01-16 06:23:48 UTC
after doing a bit more testing, the ptrace code isn't quite that useful.  we can't inject errors and cancel syscalls at all -- see linked URL.  we can detect the bad syscall and kill the process, but that's not what we do for other targets normally.
Comment 7 SpanKY gentoo-dev 2021-10-25 05:51:35 UTC
my kernel hack for canceling syscalls turned into a real fix and was merged for linux-4.5, so we should be good to go on that front.

i revisited the code in general for fun now that we have a fast sparc64 box and got it working on 64-bit too.  all tests pass for 32-bit & 64-bit, and with the main loop overhaul, i'm going to try to re-enable this for sparc.
Comment 8 Larry the Git Cow gentoo-dev 2021-10-25 06:23:08 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=f3b7a388d49383e092e7c09d514b698db644bb20

commit f3b7a388d49383e092e7c09d514b698db644bb20
Author:     Mike Frysinger <vapier@gentoo.org>
AuthorDate: 2021-10-25 05:52:29 +0000
Commit:     Mike Frysinger <vapier@gentoo.org>
CommitDate: 2021-10-25 05:52:29 +0000

    libsandbox: port ptrace to sparc64 & re-enable for sparc
    
    Now that we have a real dev system & userland running sparc64,
    port the logic to it and make sure tests pass on 32-bit & 64-bit.
    Hopefully the trace main loop rewrite to avoid signals should
    address the instability issues we saw.
    
    Closes: https://bugs.gentoo.org/293632
    Signed-off-by: Mike Frysinger <vapier@gentoo.org>

 README.md                      |  1 +
 libsandbox/trace/linux/sparc.c | 18 +++++++++++-------
 2 files changed, 12 insertions(+), 7 deletions(-)

Additionally, it has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=c1dc899d4cdece095925e2391aefce3b0ad3785f

commit c1dc899d4cdece095925e2391aefce3b0ad3785f
Author:     Mike Frysinger <vapier@gentoo.org>
AuthorDate: 2021-10-25 05:58:19 +0000
Commit:     Mike Frysinger <vapier@gentoo.org>
CommitDate: 2021-10-25 05:58:19 +0000

    libsandbox: add sparc personality support
    
    This allows tracing of sparc32 in a sparc64 multilib setup.
    
    Although it doesn't quite work -- the syscall table needs to be
    reloaded after the exec commits.  We leave that out for now since
    there isn't actually a sparc32+sparc64 multilib port currently.
    
    Bug: https://bugs.gentoo.org/293632
    Signed-off-by: Mike Frysinger <vapier@gentoo.org>

 TODO                           |  3 ++
 configure.ac                   |  4 +++
 libsandbox/trace/linux/sparc.c | 70 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 77 insertions(+)