Closed
Bug 1221803
Opened 10 years ago
Closed 10 years ago
Remove system_data_file:file write permission for b2g domain
Categories
(Firefox OS Graveyard :: GonkIntegration, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
FxOS-S11 (13Nov)
People
(Reporter: tedd, Assigned: tedd)
References
Details
Attachments
(2 files, 1 obsolete file)
Currently the b2g domain is allowed to write files [1] which are labeled with system_data_file. This is the default type for files located in /data.
So far, this wasn't a problem, but shown Bug 1213259 Comment 32 and onward, the new Android M version contains a rule that prohibits to write to files labeled with system_data_file.
I filed this bug to investigate the possibility to remove this permission from the b2g domain, by either labeling files on the file system more specific or change code in Gecko. If at some point the decision is made that this would be too much work, this bug can simply be resolved to WONTFIX.
[1] https://github.com/mozilla-b2g/gonk-misc/blob/cc2d4f76e25677edb9016ce8c36b8ef24338489d/sepolicy/b2g.te#L136
| Assignee | ||
Updated•10 years ago
|
Assignee: nobody → julian.r.hector
| Assignee | ||
Comment 1•10 years ago
|
||
I stripped the permission out of the policies and recompiled/flashed the phone without the permission to see what would have been denied.
This is the log of SELinux running in permissive mode.
| Assignee | ||
Comment 2•10 years ago
|
||
Based on some testing and the denials in dmesg etc, I could find the following files interesting:
> /data/local/permissions.sqlite
> /data/local/webapps/
> /data/b2g/mozilla/Crash Reports/InstallTime20151104213524
> /data/b2g/mozilla/ki5y3g1z.default/formhistory.sqlite
> /data/b2g/mozilla/ki5y3g1z.default/datareporting/aborted-session-ping.tmp
> /data/b2g/mozilla/ki5y3g1z.default/pkcs11.txt
On the file-system /data/b2g/ is labeled with system_data_file (can be seen with ls -Z).
I also believe that permissions.sqlite and /data/local/webapps/ is purely related to b2g.
Usually with SELinux it is the case that newly created files/directories inherit the domain from the parent directory, so even though the b2g process probably creates all/some of the profile files, they will be labeled with system_data_file.
I think we can solve this issue by creating a file type for b2g data files, and label /data/b2g and the before mentioned files in /data/local/ with that domain. Additionally all files created by a process running in the b2g domain should be labeled with that file type.
This way we could avoid having b2g related files labeled with system_data_file which requires us to give system_data_file write privileges.
| Assignee | ||
Comment 3•10 years ago
|
||
what do you think of Comment 2 :kang? Does this sound like an acceptable solution?
I am going to make a PoC patch and see how it works out.
Flags: needinfo?(gdestuynder)
| Assignee | ||
Comment 4•10 years ago
|
||
This is a WIP patch to label all b2g related files in /data/ with the b2g_data_file domain and therefore effectively remove the need to write to files labeled with system_data_file.
| Assignee | ||
Comment 5•10 years ago
|
||
While testing the above WIP patch, I also tested removing more of the system_data_file rules, more precisely the following:
> allow b2g system_data_file:dir { open setattr rename read write rmdir remove_name create add_name };
> allow b2g system_data_file:fifo_file { open read setattr create getattr unlink };
> allow b2g system_data_file:file { lock open };
> allow b2g system_data_file:lnk_file { create unlink };
> allow b2g system_data_file:sock_file { create setattr getattr unlink };
It seems that these lines can be replaced with just:
> allow b2g system_data_file:dir { remove_name add_name };
During all my testing so far, it didn't seem to be a problem that those permissions are not granted.
I assume that this is because a lot of that file handling was done inside /data/b2g which was labeled with system_data_file while the rule generation was initially done.
lgtm - and in fact this all makes sense.
I would favor adding the b2g data label because we'll need them anyway and it just makes sense (tm).
thanks for looking into it!
Flags: needinfo?(gdestuynder)
| Assignee | ||
Comment 7•10 years ago
|
||
Attachment #8683469 -
Attachment is obsolete: true
Attachment #8683964 -
Flags: review?(gdestuynder)
Attachment #8683964 -
Flags: review?(gdestuynder) → review+
Comment 9•10 years ago
|
||
Status: NEW → RESOLVED
Closed: 10 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → FxOS-S11 (13Nov)
You need to log in
before you can comment on or make changes to this bug.
Description
•