Closed Bug 1697721 Opened 3 years ago Closed 3 years ago

nsLocalFile::CreateAllAncestors fails for veiled paths

Categories

(Core :: XPCOM, defect, P5)

All
OpenBSD
defect

Tracking

()

RESOLVED FIXED
89 Branch
Tracking Status
firefox89 --- fixed

People

(Reporter: mrrjj, Assigned: mrrjj)

Details

Attachments

(1 file)

When creating a new profile, Firefox fails to create the "~/.mozilla/firefox/<profile>/storage/permanent" folder. I have observed this behavior with Firefox 85, 86, and 78esr, but the responsible code goes all the way back to Netscape.

The two most obvious symptoms of this failure are the browser's Web Developer tools showing no page source in the Inspector tab (non-78esr) and various error messages in the Browser Console relating to IndexedDB.

When creating a profile, nsLocalFile::CreateAllAncestors begins checking each directory in the path "/home/<user>/.mozilla/firefox/<profile>/storage/permanent" for existence (i.e., "/home" then "/home/<user>" then ...). Since "/home" is veiled to Firefox, the existence check fails and nsLocalFile::CreateAllAncestors gives up. Thus the "permanent" folder is never created despite "/home/<user>/.mozilla/firefox/<profile>" being unveiled to Firefox.

Instead nsLocalFile::CreateAllAncestors should attempt to create every directory in the path, and the success of the call should depend only on the outcome of creating the final directory.

Some systems hide path components. Determine access by creating the whole path.

Assignee: nobody → mrrjj

Note to anyone looking at this issue: like bug #1696958 this happens because the peculiarities from sandboxing on OpenBSD via unveil() are very specific to our OS, as (to my knowledge) sandboxing on other OSes dont hide parts of the filesystem.

As for the patch itself, the logic sounds sane to me, but there might be dragons in there.

Severity: -- → S4
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P5
Version: unspecified → Trunk
Pushed by gpascutto@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c41a7b705276
Have nsLocalFile::CreateAllAncestors make each path component. r=xpcom-reviewers,kmag
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 89 Branch
You need to log in before you can comment on or make changes to this bug.