[Linux] relative paths in linker includes not handled correctly
Categories
(Core :: Security: Process Sandboxing, defect, P1)
Tracking
()
People
(Reporter: aros, Assigned: gcp)
References
Details
Attachments
(1 file)
47 bytes,
text/x-phabricator-request
|
RyanVM
:
approval-mozilla-beta+
|
Details | Review |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0
Steps to reproduce:
It turns out Firefox on Linux cannot open shared libraries in /usr/local/(lib|lib64) on Linux which makes it impossible to use it with manually compiled/installed FFmpeg library. See bug 1516178 for more details.
I would like to propose that whitelist these two locations in order to avoid this issue.
Normally they are both owned by the root user and it's very unlikely that's going to affect Firefox security.
Reporter | ||
Updated•6 years ago
|
Reporter | ||
Comment 1•6 years ago
|
||
I presume this issue affects all Unix'es (Linux, FreeBSD, OpenBSD).
Comment 2•6 years ago
|
||
gcp: Shouldn't the ld.so.conf
parser have taken care of this?
Assignee | ||
Comment 3•6 years ago
|
||
Could you attach ld.so.conf and any relevant include files?
Reporter | ||
Comment 4•6 years ago
|
||
$ cat /etc/ld.so.conf
include ld.so.conf.d/*.conf
$ cat /etc/ld.so.conf.d/local-x86_64.conf
/usr/local/lib64
Reporter | ||
Comment 5•6 years ago
|
||
Looks like you haven't taken into account the last 10 years of Linux development.
Most Linux distros have switched to /etc/ld.so.conf.d
.
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Comment 6•6 years ago
|
||
Our code already handles the include, so it's still not clear why this isn't working.
Assignee | ||
Comment 7•6 years ago
•
|
||
For comparison, this is my own system, which (of course) also uses ld.so.conf.d files:
Sandbox: policy for /dev/nvidia-uvm-tools: 1 -> 7
Sandbox: policy for /dev/nvidia-uvm: 1 -> 7
Sandbox: policy for /dev/nvidia-modeset: 1 -> 7
Sandbox: policy for /dev/nvidia0: 1 -> 7
Sandbox: policy for /dev/nvidiactl: 1 -> 7
...
Sandbox: policy for /usr/local/lib/: 1 -> 35
Sandbox: policy for /usr/local/lib: 1 -> 3
Sandbox: policy for /lib/x86_64-linux-gnu/: 1 -> 35
Sandbox: policy for /lib/x86_64-linux-gnu: 1 -> 3
Sandbox: policy for /usr/lib/x86_64-linux-gnu/: 1 -> 35
Sandbox: policy for /usr/lib/x86_64-linux-gnu: 1 -> 3
...
Those are being picked up from almost exactly the same config as you have (and which is extremely standard anyway...):
/etc/ld.so.conf:
include /etc/ld.so.conf.d/*.conf
/etc/ld.so.conf.d/libc.conf:
# libc default configuration
/usr/local/lib
/etc/ld.so.conf.d/x86_64-linux-gnu.conf:
# Multiarch support
/usr/local/lib/x86_64-linux-gnu
/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu
(IIRC there's no entry for /usr/local/lib/x86_64-linux-gnu in the log because /usr/local/lib/ supersedes it)
Assignee | ||
Comment 8•6 years ago
|
||
Okay, one difference I notice is that the path in the ld.so.conf include is relative, not absolute. We allow relative paths in the include, but I wonder if the glob() call is going wrong because it's in the wrong cwd for the relative path.
It seems Fedora ships the ld.so.conf like that, so it'd be surprising this wasn't caught earlier.
Assignee | ||
Comment 9•6 years ago
|
||
Confirmed that this is the problem.
Assignee | ||
Comment 10•6 years ago
|
||
Assignee | ||
Updated•6 years ago
|
Reporter | ||
Comment 11•6 years ago
|
||
(In reply to Gian-Carlo Pascutto [:gcp] from comment #10)
Wow, great many thanks for a quick fix! It's strange no one has filed this bug report earlier.
Reporter | ||
Updated•6 years ago
|
Comment 13•6 years ago
|
||
Comment 14•6 years ago
|
||
bugherder |
Comment 15•6 years ago
|
||
Please nominate this for Beta approval when you get a chance. We may want this on ESR68 also, but maybe after it bakes for a bit first.
Assignee | ||
Comment 16•6 years ago
|
||
Comment on attachment 9079277 [details]
Bug 1565996 - Handle relative paths in linker config parsing. r?jld
Beta/Release Uplift Approval Request
- User impact if declined: Some libraries not picked up in the content process on certain distros. Affects for example video decoding on Fedora if the user updates ffmpeg manually.
- Is this code covered by automated tests?: No
- Has the fix been verified in Nightly?: No
- Needs manual test from QE?: Yes
- If yes, steps to reproduce:
- List of other uplifts needed: None
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): Worst breakage probably puts other Linux distros on the level of Fedora, which this fixes. Gain is somewhat hazy; we did this work to solve long-tail compatibility issues on Linux, so any bugs this fixes are probably not super visible or obvious.
- String changes made/needed:
Assignee | ||
Comment 17•6 years ago
|
||
Artem, is this working for you in the current Nightly?
Reporter | ||
Comment 18•6 years ago
|
||
(In reply to Gian-Carlo Pascutto [:gcp] from comment #17)
Artem, is this working for you in the current Nightly?
Yes, it is, I've just checked the latest nightly. Thanks again!
Comment 19•6 years ago
|
||
Comment on attachment 9079277 [details]
Bug 1565996 - Handle relative paths in linker config parsing. r?jld
Fixes a Linux-only bug which can cause some libraries to not be properly detected with some distros. Approved for 69.0b9.
Comment 20•6 years ago
|
||
bugherder uplift |
Updated•6 years ago
|
Updated•6 years ago
|
Assignee | ||
Comment 21•6 years ago
|
||
Didn't intend this to require manual QE as it's tricky to set up a case and reporter confirmed the fix.
Comment 22•6 years ago
|
||
Marking bug as verified based on comment 18.
@Artem, if you have time mind checking with 69.0b10 as well, once it becomes available?
Reporter | ||
Comment 23•6 years ago
|
||
(In reply to Cristian Fogel, QA [:cfogel] from comment #22)
Marking bug as verified based on comment 18.
@Artem, if you have time mind checking with 69.0b10 as well, once it becomes available?
Confirming fixed.
Comment 24•6 years ago
|
||
Awesome!
Thank you for the help.
Updated•5 years ago
|
Description
•