fix: исправлена проблема при загрузке кастомного бинарника
This commit is contained in:
1 parent
68d5d6b639
commit
4725ddf480
1 file changed
+16
-1
@@ -7,6 +7,7 @@ import android.app.Service
|
|||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.net.ConnectivityManager
|
import android.net.ConnectivityManager
|
||||||
import android.net.Network
|
import android.net.Network
|
||||||
|
import android.os.Build
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.IBinder
|
import android.os.IBinder
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
@@ -104,7 +105,8 @@ class ProxyService : Service() {
|
|||||||
val cfg = AppPreferences(applicationContext).clientConfigFlow.first()
|
val cfg = AppPreferences(applicationContext).clientConfigFlow.first()
|
||||||
|
|
||||||
val customBin = File(filesDir, "custom_vkturn")
|
val customBin = File(filesDir, "custom_vkturn")
|
||||||
val executable = if (customBin.exists()) {
|
val useCustom = customBin.exists()
|
||||||
|
val executable = if (useCustom) {
|
||||||
ProxyServiceState.addLog("Используется кастомное ядро из памяти телефона")
|
ProxyServiceState.addLog("Используется кастомное ядро из памяти телефона")
|
||||||
customBin.absolutePath
|
customBin.absolutePath
|
||||||
} else {
|
} else {
|
||||||
@@ -132,6 +134,19 @@ class ProxyService : Service() {
|
|||||||
if (cfg.manualCaptcha) cmdArgs.add("--manual-captcha")
|
if (cfg.manualCaptcha) cmdArgs.add("--manual-captcha")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Кастомное ядро лежит в filesDir, откуда SELinux (untrusted_app) запрещает execve.
|
||||||
|
// Запускаем через системный линкер: /system/bin/linker* — ему execve разрешён,
|
||||||
|
// а целевой ELF мапится как данные. Работает для PIE-бинарников
|
||||||
|
// (Go-сборки android/arm64 PIE по умолчанию).
|
||||||
|
if (useCustom) {
|
||||||
|
val linker = if (Build.SUPPORTED_ABIS.firstOrNull()?.contains("64") == true) {
|
||||||
|
"/system/bin/linker64"
|
||||||
|
} else {
|
||||||
|
"/system/bin/linker"
|
||||||
|
}
|
||||||
|
cmdArgs.add(0, linker)
|
||||||
|
}
|
||||||
|
|
||||||
var exitCode = -1
|
var exitCode = -1
|
||||||
val startedAt = System.currentTimeMillis()
|
val startedAt = System.currentTimeMillis()
|
||||||
var startupEmitted = false
|
var startupEmitted = false
|
||||||
|
|||||||
Reference in new issue
Block a user