Bug 169814 - [linux] ptrace is broken in Linux emulation
Summary: [linux] ptrace is broken in Linux emulation
Status: Closed Feedback Timeout
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 9.0-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: Edward Tomasz Napierala
URL:
Keywords:
Depends on:
Blocks: 247219
  Show dependency treegraph
 
Reported: 2012-07-13 08:30 UTC by Richard Yao
Modified: 2020-10-14 15:36 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Yao 2012-07-13 08:30:02 UTC
ptrace is broken, which causes sys-libs/glibc to fail to build in a Gentoo Linux jail under Linux emulation:

http://bpaste.net/show/34782/

This issue can also be demonstrated using strace:

# strace echo Hello World
strace: test_ptrace_setoptions_for_all: PTRACE_TRACEME doesn't work: Function not implemented
strace: test_ptrace_setoptions_for_all: unexpected exit status 1

Fix: 

There is no known fix or workaround.
How-To-Repeat: mkdir /mnt/linux
wget ftp://gentoo.osuosl.org/pub/gentoo/releases/amd64/current-stage3/*.tar.bz2 -O - | tar -x -C /mnt/linux
cp /etc/resolv.conf /mnt/linux/etc/resolv.conf
mount -t linprocfs none /mnt/linux/proc
mount -t linsysfs none /mnt/linux/sys
mount -t devfs none /mnt/linux/dev
mount -t fdescfs none /mnt/linux/dev/fd
chroot /mnt/linux /bin/bash
env-update
source /etc/profile
export PS1="(chroot) $PS1"
cd
emerge-webrsync
ln -sf /bin/busybox /bin/tar
ln -sf /bin/busybox /bin/rm
ln -sf /bin/busybox /usr/bin/touch

# And finally:
emerge strace
strace echo Hello World

# Alternatively, rebuild glibc:
emerge --oneshot sys-libs/glibc
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2012-07-16 04:15:13 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-emulation

Over to maintainer(s).
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:47 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 3 Ed Maste freebsd_committer 2018-08-01 15:34:51 UTC
Linux ptrace support added in r313809, merged to stable/11 in r316363 - are you able to test again?

https://reviews.freebsd.org/rS313809
https://reviews.freebsd.org/rS316363
Comment 4 Andriy Voskoboinyk freebsd_committer 2019-01-26 04:18:38 UTC
Doesn't work for me (r343254):
# strace echo Hello World

strace: ptrace(PTRACE_TRACEME, ...): Function not implemented
+++ exited with 1 +++

dmesg:
linux: pid 40303 (strace): syscall ptrace not implemented

kldstat | grep linux
 6    3 0xffffffff8182f000     4280 linux_common.ko
10    4 0xffffffff819ec000    19f30 linuxkpi.ko
11    3 0xffffffff81a06000    12f30 linuxkpi_gplv2.ko
30    1 0xffffffff81b9c000    51c88 linux.ko
31    1 0xffffffff81bee000    4a0e0 linux64.ko

# strace -V | head -n 1
strace -- version 4.25
Comment 5 Andriy Voskoboinyk freebsd_committer 2019-01-28 00:12:16 UTC
However, I'm using 32-bit linux on amd64 FreeBSD - and it seems to be unimplemented here:

grep ptrace sys/amd64/linux32/linux32_dummy.c
DUMMY(ptrace);
Comment 6 Edward Tomasz Napierala freebsd_committer 2019-06-18 17:52:20 UTC
Should be fixed now in 13-CURRENT on amd64.  Can you test?