Bug 249381

Summary: [Linuxulator] Failing linux_socket(0x10,0x3,0) causes PulseAudio under Linux emulator to fail
Product: Base System Reporter: Yuri Victorovich <yuri>
Component: miscAssignee: freebsd-emulation (Nobody) <emulation>
Status: Closed FIXED    
Severity: Affects Only Me CC: break19, dchagin, emaste, iwtcex, trasz
Priority: --- Keywords: needs-qa
Version: 12.1-STABLE   
Hardware: Any   
OS: Any   
Bug Depends on:    
Bug Blocks: 247219    

Description Yuri Victorovich freebsd_committer freebsd_triage 2020-09-17 01:36:30 UTC
Linux apps using PulseAudio print this and fail:
> setsockopt(SOL_SOCKET, SO_PASSCRED): Protocol not available

Here are the corresponding lines from ktrace:
>  14619 zoom     CALL  linux_socket(0x10,0x3,0)
>  14619 zoom     RET   linux_socket -1 errno -97 Address family not supported by protocol family

It is probably wise to support such 'socket' call because it is important to support PulseAudio.


> FreeBSD xx.xx.xx 12.2-STABLE FreeBSD 12.2-STABLE #1 r365688M: Sun Sep 13 05:26:18 PDT 2020     unknown@xx.xx:/huge-disk/sys/usr/src/amd64.amd64/sys/GENERIC  amd64
Comment 1 Yuri Victorovich freebsd_committer freebsd_triage 2020-09-17 02:04:29 UTC
Correction: the kernel log of the failed setsockopt is:
>  15432 zoom     CALL  linux_setsockopt(0x30,0x1,0xc,0x7fffffffb964,0x4)
>  15432 zoom     RET   linux_setsockopt -1 errno -92 Protocol not available
Comment 2 Alex S 2020-09-20 00:45:55 UTC
Also see bug 206083.
Comment 3 break19 2020-09-29 00:59:01 UTC
This is also apparently causing the linux Discordapp to coredump.

from linux-c7-strace
> wait4(6206, [{WIFEXITED(s) && WEXITSTATUS(s) == 1}], 0, NULL) = 6206
> lstat("/opt", {st_mode=S_IFDIR|0755, st_size=2, ...}) = 0
> lstat("/opt/Discord", {st_mode=S_IFDIR|0755, st_size=20, ...}) = 0
> lstat("/opt/Discord/Discord", {st_mode=S_IFREG|0755, st_size=115293392, ...}) = 0
> socketpair(AF_UNIX, SOCK_SEQPACKET, 0, [10, 11]) = 0
> setsockopt(10, SOL_SOCKET, SO_PASSCRED, [1], 4) = -1 ENOPROTOOPT (Protocol not available)
> --- SIGTRAP {si_signo=SIGTRAP, si_code=TRAP_BRKPT} ---
> /compat/linux/usr/bin/strace: [ Process PID=6205 runs in x32 mode. ]
> syscall_0xfffffffffffffffc(0x8479f19a0, 0x2, 0xffffffff, 0x7fffffff, 0, 0x2 <unfinished ...>
> +++ killed by SIGTRAP +++
> [1]    6203 trace trap  /compat/linux/usr/bin/strace ./Discord

and from ktrace/kdump:

>  6251 Discord  CALL  linux_setsockopt(0xa,0x1,0x10,0x7fffffffcb7c,0x4)
>  6251 Discord  RET   linux_setsockopt -1 errno -92 Protocol not available
>  6251 Discord  PSIG  SIGTRAP SIG_DFL code=TRAP_BRKPT
>  6251 Discord  RET   poll -1 errno -4 Interrupted system call
>  6251 Discord  NAMI  "sandbox_ipc_thr.core"
Comment 5 Edward Tomasz Napierala freebsd_committer freebsd_triage 2021-01-18 11:50:48 UTC
This - lack of SO_PASSCRED - should be fixed in 13-CURRENT.  Could you perhaps give it a try?
Comment 6 Dmitry Chagin freebsd_committer freebsd_triage 2023-01-30 18:04:02 UTC
SO_PASSCRED implemented by cem@