DSP file relabling for SODP

Fix wrong SELinux labels

If you have previously flashed any version of a Sony-Open-Devices-based ROM from before December 17th 2018, your dsp partition might have wrong SELinux labels and you might thus have problems with audio.

Short version

Either re-flash the dsp partition with stock firmware via Sony’s own Emma or the open-source FlashTool, or manually force the correct file labels. You need to be root via adb shell or in recovery:

# It might be either /system/vendor/dsp or /vendor/dsp depending on your device
# Just try both until one succeeds
mount -o remount,rw /system/vendor/dsp
chcon -R u:object_r:adsprpcd_file:s0 /dsp

Reboot, et voilĂ  - you should have proper audio again.

If you only want to fix your audio problem, you can stop reading now.

Long version

Sony devices have a dsp partition that holds firmware files and libraries needed for the Qualcomm “Hexagon” DSP - Digital Signal Processor.

The partition is shippped with the SELinux file label u:object_r:adsprpcd_file:s0 by default, and stock firmware uses this label as well when flashed via Emma or FlashTool.

When stellirin rewrote the SODP sepolicy in late 2017, they chose to use qdsp_file instead of adsprpcd_file for /dsp. A few lines of code were added in init.$device.rc - which gets run under the label vendor_init - to re-mount the dsp partition and update it to use the qdsp_file label.

Because re-labeling these files as vendor_init is a neverallow in Pie, we noticed that we should rather be re-using the stock file labels, i.e. adsprpcd_file.
The relabeling bit(restorecon_recursive) was removed from its new location in init.common.rc and the “new” old label was restored.

As stated in the “short version”, fixing the problem is easy: Run chcon or run Emma - Emma can now flash single partitions, which is great.


A small inconsistency can cause a whole lot of trouble. Who could have predicted back in 2017 that Google would tighten the security around re-labeling files?
The transition is going to be a bit painful, but in the end, re-using adsprpcd_file is the better solution.

Published by

Edit source on Github