dex2oat: Avoid an open from /proc/self/fd

ReadCommentedInputStream reads a text file by line, filters out empty or
commented line, then send the line to a callback. The original
implementation uses ifstream and std::getline.

aosp/1734115 added a way to read the text file by FD. Since there
doesn't seem to be a way in C++ to convert the FD to an input stream,
it creates one by opening /proc/self/fd/43.

In the context of Comp OS, this requires giving dex2oat a special open
privilege to "authfs".

This change replaces ifstream/std::getline with f(d)open/getline(3).

Bug: 196404749
Test: TH
Test: Disallow open for dex2oat in microdroid, ComposHostTestCases still
      pass
Ignore-AOSP-First: merge conflict resolution
Merged-In: I257f471b2afc80b6f1e1f8fa25248abc7ff5a3d5
Change-Id: I257f471b2afc80b6f1e1f8fa25248abc7ff5a3d5
(cherry picked from commit b81cc515d96f38286662e470bc38a0f6bb12ea57)
1 file changed