Bug 210507 - Linux compat function needed
Summary: Linux compat function needed
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: Unspecified
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Dmitry Chagin
Keywords: feature, needs-patch
Depends on:
Reported: 2016-06-24 01:26 UTC by Joe Maloney
Modified: 2017-10-08 07:24 UTC (History)
3 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Joe Maloney 2016-06-24 01:26:32 UTC
I am trying to work with Matt Macy to improve linux compat for FreeBSD-CURRENT.  I am currently extracting a linux environment into a chroot by doing:

tar -xf xenial-server-cloudimg-amd64-root.tar.gz -C /compat/linux

I am then chrooting by doing:

chroot /compat/linux/ /bin/bash

From there I am trying to run apt-get update which results in:
E: Dynamic MMap ran out of room. Please increase the size of APT::Cache-Start. Current value: 25165824. (man 5 apt.conf)

Increasing the value does nothing.  To debug I tried using strace.  Unfortunately running strace even using:

strace ls

results in

strace: ptrace(PTRACE_TRACEME, ...): Function not implemented

The purpose of this entire excercise is to get some debugging tools for intel drivers working to also improve driver support for intel chipsets.  Please let me know if I can be of further assistance.
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2016-06-24 01:46:56 UTC
Categorize, re-assign and notify (CC) correctly
Comment 2 Dmitry Chagin freebsd_committer 2016-06-27 05:49:23 UTC
(In reply to Joe Maloney from comment #0)
use ktrace/kdump like

trace -di /blablabla
and than
dump -HAR -m64 > u.out.file.name
Comment 3 Dmitry Chagin freebsd_committer 2016-06-27 06:07:50 UTC
(In reply to Joe Maloney from comment #0)
(In reply to Dmitry Chagin from comment #2)
whoops, I mean:

ktrace -di /blablabla
and than
kdump -HAR -m64 > u.out.file.name

or implement ptrace() for x86_64 Linuxulator :)
Comment 4 Matthew Macy 2016-06-27 07:02:53 UTC
(In reply to Dmitry Chagin from comment #3)
Can you give a list of all the unimplemented linux64 syscalls? There's no way of telling from looking at syscalls.master since it says ptrace is implemented:

101	AUE_PTRACE	STD	{ int linux_ptrace(l_long req, l_long pid, \
				    l_long addr, l_long data); }

But evidently you only have a stub.

Thanks in advance.
Comment 5 Dmitry Chagin freebsd_committer 2016-06-27 19:27:28 UTC
(In reply to Matthew Macy from comment #4)
Comment 6 Matthew Macy 2016-07-03 05:48:19 UTC
How do I disable the /compat/linux indirection? It totally breaks chroot.

ktrace -di chroot /compat/linux/ cat /proc/self/fd
cat: /proc/self/fd: Too many levels of symbolic links

   968 101414 cat      0.000015 CALL  L64  linux_open(0x7fffffffdd84,0,0x20000)
   968 101414 cat      0.000013 NAMI  L64  "/compat/linux/proc/self/fd"
   968 101414 cat      0.000018 NAMI  L64  "/proc/self/fd"
   968 101414 cat      0.000252 RET   L64  linux_open -1 errno -40 Too many levels of symbolic links
Comment 7 Matthew Macy 2016-07-03 06:42:12 UTC
Never mind. /proc/self/fd is a soft link to /dev/fd. And for some reason fdescfs can never actually be mounted anywhere other than /dev/fd ...

Comment 8 Matthew Macy 2016-07-08 07:41:58 UTC
root@planecrash:/home/mmacy # chroot /compat/linux/ apt-get update
Hit:1 http://archive.ubuntu.com/ubuntu xenial InRelease
Get:2 http://security.ubuntu.com/ubuntu xenial-security InRelease [94.5 kB]
Hit:3 http://archive.ubuntu.com/ubuntu xenial-updates InRelease                     
Fetched 94.5 kB in 1s (55.1 kB/s)                                                   
Reading package lists... Done
root@planecrash:/home/mmacy # uname -a
FreeBSD planecrash 11.0-ALPHA5 FreeBSD 11.0-ALPHA5 #84 c132a99(drm-next-4.6)-dirty: Wed Jul  6 20:40:07 PDT 2016     mmacy@armageddon:/mnt/storage/mmacy/devel/build/mnt/storage/mmacy/devel/fbg-merge/sys/GENERIC  amd64

apt-get update works now 

I haven't plugged all the holes in ptrace but the other issues I raised are fixed.

You can close this issue. I'll upstream Linux updates when I upstream drm updates or when I get Steam / widevine to work, which ever comes sooner.
Comment 9 Dmitry Chagin freebsd_committer 2017-05-01 12:28:29 UTC
Comment 10 Dmitry Chagin freebsd_committer 2017-10-08 07:24:43 UTC
Please, see r321839