If anyone is interested, I have published a patch:

https://android-review.googlesource.com/#/c/200521/

The error message sucks, perhaps read_spec_entry could return specific error 
codes versus -1.

Bill

From: Roberts, William C
Sent: Tuesday, February 2, 2016 1:33 PM
To: [email protected]
Cc: Stephen Smalley <[email protected]>
Subject: mixture of unicode and ascii spaces in FC

I recently got a report of a file_contexts entry failing to label a file 
created by a mkdir in init.rc under /data. I had the person send their 
file_context file to me, and it contained Unicode spaces (c2a0) between the 
path and the label with a single 0x20 (ascii space)

C2 A0 C2 A0 C2 A0 C2 A0 C2 A0 C2 A0 C2 A0 C2 A0 C2 A0 20

That (surprisingly to me) gets past checkfc. I replicated on AOSP, and found 
that it does indeed compile into a file_contexts file  but I was unable to 
restorecon the /data/location path (the new thing attempting to label). I then
Attempted to do the same, with normal spaces, (0x20) and it worked as 
indicated. If you remove the last ascii space 0x20, then it fails claiming its 
missing a field.

isspace() rightfully reports these bytes as non-spaces. I looked at 
read_spec_entries() and children functions, it appears that it separates 
entries based on isspace(). I.E., everything, including these UTF bytes should 
be in the regex side.

Outside of telling someone don't do UTF, should we be checking that all bytes 
are in the traditional ascii range of 0x00 and 0x7F so we can throw an error?

Bill
_______________________________________________
Seandroid-list mailing list
[email protected]
To unsubscribe, send email to [email protected].
To get help, send an email containing "help" to 
[email protected].

Reply via email to