Conversation
[WIP] Update extraction behavior to hardcode directory path
There was a problem hiding this comment.
Pull request overview
This PR updates where the Radare2 toolchain is extracted on-device, changing the extraction root and adjusting the derived Radare2/busybox paths accordingly in RadareOffsetFinder.
Changes:
- Switches extraction directory from the prior root-based location to
sdcard/radare_data. - Updates Radare2 bin/lib and busybox paths to match the new extraction root.
- Updates extraction/existence checks and cleanup commands to operate on the new directory.
Comments suppressed due to low confidence (1)
android/app/src/main/java/me/kavishdevar/librepods/utils/RadareOffsetFinder.kt:703
- The cleanup log message still references the old extraction path (
$EXTRACT_DIR/data/local/tmp/aln_unzip), but cleanup now removes$EXTRACT_DIRdirectly. Update the log string to reflect the new directory so troubleshooting output is accurate.
Runtime.getRuntime().exec(arrayOf("su", "-c", "rm -rf $EXTRACT_DIR")).waitFor()
Log.d(TAG, "Cleaned up extracted files at $EXTRACT_DIR/data/local/tmp/aln_unzip")
| private const val EXTRACT_DIR = "sdcard/radare_data" | ||
|
|
||
| private const val RADARE2_BIN_PATH = "$EXTRACT_DIR/data/local/tmp/aln_unzip/org.radare.radare2installer/radare2/bin" | ||
| private const val RADARE2_LIB_PATH = "$EXTRACT_DIR/data/local/tmp/aln_unzip/org.radare.radare2installer/radare2/lib" | ||
| private const val BUSYBOX_PATH = "$EXTRACT_DIR/data/local/tmp/aln_unzip/busybox" | ||
| private const val RADARE2_BIN_PATH = "$EXTRACT_DIR/org.radare.radare2installer/radare2/bin" | ||
| private const val RADARE2_LIB_PATH = "$EXTRACT_DIR/org.radare.radare2installer/radare2/lib" | ||
| private const val BUSYBOX_PATH = "$EXTRACT_DIR/busybox" |
There was a problem hiding this comment.
EXTRACT_DIR is set to a relative path ("sdcard/radare_data"), but it’s interpolated into su -c shell commands and into absolute executable paths (e.g., $RADARE2_BIN_PATH/rabin2). Without a leading '/', these paths depend on the shell’s working directory and can fail to resolve. Use an absolute path (e.g., under /sdcard or /data/local/tmp) to make the behavior deterministic.
| private const val EXTRACT_DIR = "sdcard/radare_data" | ||
|
|
||
| private const val RADARE2_BIN_PATH = "$EXTRACT_DIR/data/local/tmp/aln_unzip/org.radare.radare2installer/radare2/bin" | ||
| private const val RADARE2_LIB_PATH = "$EXTRACT_DIR/data/local/tmp/aln_unzip/org.radare.radare2installer/radare2/lib" | ||
| private const val BUSYBOX_PATH = "$EXTRACT_DIR/data/local/tmp/aln_unzip/busybox" | ||
| private const val RADARE2_BIN_PATH = "$EXTRACT_DIR/org.radare.radare2installer/radare2/bin" | ||
| private const val RADARE2_LIB_PATH = "$EXTRACT_DIR/org.radare.radare2installer/radare2/lib" | ||
| private const val BUSYBOX_PATH = "$EXTRACT_DIR/busybox" |
There was a problem hiding this comment.
Placing extracted executables/libraries under shared external storage (sdcard) and then executing them via su makes the toolchain potentially tamperable by other actors with access to that storage, which can turn into root code execution. Prefer extracting into a root-owned, non-world-writable location (e.g., /data/local/tmp or an app-private directory) and ensure permissions/ownership prevent modification before execution.
No description provided.