Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: prctl(2) of compat_linux for Firefox for Linux/x86_64



Tobias Nygren <tnn%NetBSD.org@localhost> writes:

> On Tue, 22 Aug 2023 04:56:18 +0900
> Ryo ONODERA <ryo%tetera.org@localhost> wrote:
>
>> Hi,
>> 
>> The recent improvements in compat_linux reduces unimplemented
>> Linux system calls that is used by the official Firefox binary
>> for Linux/x86_64.
>> Great thanks for Theodore Preduta and their great works.
>> 
>> Sadly, the official Firefox 117.0b9 binary for Linux/x86_64 does not
>> start its GUI yet.
>> From the result of ktrace command, the following calls remain unimplemented.
>> 
>>  22518  12874 firefox-bin CALL  #157 (unimplemented prctl)
>>  22518  12874 firefox-bin RET   #157 (unimplemented prctl) -1 errno -38 Too many processes
>> 
>> I have no idea whether prctl(2) is the last unimplemented system call.
>> So I may find another unimplemented during starting process of GUI.
>> 
>> Is there any plan to implement prctl(2) for compat_linux?
>
> It looks like a kitchen sink syscall that provides all sorts
> of functionality. Implementing full emulation would be very difficult.
> Partial support for some of the options looks doable.
>
> grep through the Firefox source code found these uses:
>
> PR_SET_NAME - this is straightforward to emulate
> PR_SET_VMA - this can be made a no-op
>
> These are difficult because they depend on the kernel security model,
> but it should be OK to just return EINVAL for both.
>
> PR_SET_SECCOMP
> PR_SET_NO_NEW_PRIVS

Thanks for you input.
I have implemented PR_SET_NAME and PR_SET_VMA in my local tree.
(My implementation of PR_SET_NAME sets a name to process, not thread.
I did not understand the expected behavior from prctl(2) man page
on Linux.)

I have two problems.

(1) I have one more unimplemented syscall, sched_getattr.
I have no idea whether I can ignore it.

(2) Firefox for Linux expects the file descriptor created by memfd_create
can open with O_RDONLY via '/procfs/self/fd/#'. However it seems that NetBSD
and compat_linux's memfd implementation does not support read-only open.
And procfs is essential for Firefox for Linux (/proc/self/exe is
essential) and I cannot unmount it.

Is there any suggestion?

Thank you.

> -Tobias

-- 
Ryo ONODERA // ryo%tetera.org@localhost
PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB  FD1B F404 27FA C7D1 15F3


Home | Main Index | Thread Index | Old Index