Skip to content
Snippets Groups Projects
  • Nick Kralevich's avatar
    bless app created renderscript files · 0eb0a16f
    Nick Kralevich authored
    When an app uses renderscript to compile a Script instance,
    renderscript compiles and links the script using /system/bin/bcc and
    /system/bin/ld.mc, then places the resulting shared library into the
    application's code_cache directory. The application then dlopen()s the
    resulting shared library.
    
    Currently, this executable code is writable to the application. This
    violates the W^X property (https://en.wikipedia.org/wiki/W%5EX), which
    requires any executable code be immutable.
    
    This change introduces a new label "rs_data_file". Files created by
    /system/bin/bcc and /system/bin/ld.mc in the application's home
    directory assume this label. This allows us to differentiate in
    security policy between app created files, and files created by
    renderscript on behalf of the application.
    
    Apps are allowed to delete these files, but cannot create or write these
    files. This is enforced through a neverallow compile time assertion.
    
    Several exceptions are added to Treble neverallow assertions to support
    this functionality. However, because renderscript was previously invoked
    from an application context, this is not a Treble separation regression.
    
    This change is needed to support blocking dlopen() for non-renderscript
    /data/data files, which will be submitted in a followup change.
    
    Bug: 112357170
    Test: cts-tradefed run cts -m CtsRenderscriptTestCases
    Change-Id: Ie38bbd94d26db8a418c2a049c24500a5463698a3
    0eb0a16f