Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/tiann/KernelSU into susfs
Browse files Browse the repository at this point in the history
* 'main' of https://github.com/tiann/KernelSU:
  build(deps): bump the maven group across 1 directory with 5 updates (tiann#2485)
  website: fix minor typos (tiann#2482)
  Set KSU_APP_PROFILE_VER for shell (tiann#2481)
  kernel: fix sometimes sucompat can not toggle by manager (tiann#2484)
  Avoid popping back stack right after navigation (tiann#2477)
  • Loading branch information
YumeMichi committed Mar 4, 2025
2 parents 5496e65 + 203cd4d commit 6e09f8f
Show file tree
Hide file tree
Showing 15 changed files with 30 additions and 19 deletions.
1 change: 1 addition & 0 deletions kernel/allowlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ void ksu_show_allow_list(void)
static void ksu_grant_root_to_shell()
{
struct app_profile profile = {
.version = KSU_APP_PROFILE_VER,
.allow_su = true,
.current_uid = 2000,
};
Expand Down
3 changes: 3 additions & 0 deletions kernel/core_hook.c
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,9 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
bool enabled = (arg3 != 0);
if (enabled == ksu_su_compat_enabled) {
pr_info("cmd enable su but no need to change.\n");
if (copy_to_user(result, &reply_ok, sizeof(reply_ok))) {// return the reply_ok directly
pr_err("prctl reply error, cmd: %lu\n", arg2);
}
return 0;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.DpOffset
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.dropUnlessResumed
import coil.compose.AsyncImage
import coil.request.ImageRequest
import com.ramcosta.composedestinations.annotation.Destination
Expand Down Expand Up @@ -109,7 +110,7 @@ fun AppProfileScreen(
Scaffold(
topBar = {
TopBar(
onBack = { navigator.popBackStack() },
onBack = dropUnlessResumed { navigator.popBackStack() },
scrollBehavior = scrollBehavior
)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import androidx.compose.ui.input.key.key
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.dropUnlessResumed
import com.ramcosta.composedestinations.annotation.Destination
import com.ramcosta.composedestinations.annotation.RootGraph
import com.ramcosta.composedestinations.navigation.DestinationsNavigator
Expand Down Expand Up @@ -85,7 +86,7 @@ fun ExecuteModuleActionScreen(navigator: DestinationsNavigator, moduleId: String
Scaffold(
topBar = {
TopBar(
onBack = {
onBack = dropUnlessResumed {
navigator.popBackStack()
},
onSave = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.dropUnlessResumed
import com.ramcosta.composedestinations.annotation.Destination
import com.ramcosta.composedestinations.annotation.RootGraph
import com.ramcosta.composedestinations.navigation.DestinationsNavigator
Expand Down Expand Up @@ -143,7 +144,7 @@ fun FlashScreen(navigator: DestinationsNavigator, flashIt: FlashIt) {
topBar = {
TopBar(
flashing,
onBack = {
onBack = dropUnlessResumed {
navigator.popBackStack()
},
onSave = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.dropUnlessResumed
import com.maxkeppeker.sheets.core.models.base.Header
import com.maxkeppeker.sheets.core.models.base.rememberUseCaseState
import com.maxkeppeler.sheets.list.ListDialog
Expand Down Expand Up @@ -133,7 +134,7 @@ fun InstallScreen(navigator: DestinationsNavigator) {
Scaffold(
topBar = {
TopBar(
onBack = { navigator.popBackStack() },
onBack = dropUnlessResumed { navigator.popBackStack() },
onLkmUpload = onLkmUpload,
scrollBehavior = scrollBehavior
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.core.content.FileProvider
import androidx.lifecycle.compose.dropUnlessResumed
import com.maxkeppeker.sheets.core.models.base.Header
import com.maxkeppeker.sheets.core.models.base.IconSource
import com.maxkeppeker.sheets.core.models.base.rememberUseCaseState
Expand Down Expand Up @@ -107,7 +108,7 @@ fun SettingScreen(navigator: DestinationsNavigator) {
Scaffold(
topBar = {
TopBar(
onBack = {
onBack = dropUnlessResumed {
navigator.popBackStack()
},
scrollBehavior = scrollBehavior
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.dropUnlessResumed
import androidx.lifecycle.viewmodel.compose.viewModel
import com.ramcosta.composedestinations.annotation.Destination
import com.ramcosta.composedestinations.annotation.RootGraph
Expand Down Expand Up @@ -100,7 +101,7 @@ fun AppProfileTemplateScreen(
}
}
TopBar(
onBack = { navigator.popBackStack() },
onBack = dropUnlessResumed { navigator.popBackStack() },
onSync = {
scope.launch { viewModel.fetchTemplates(true) }
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.KeyboardType
import androidx.lifecycle.compose.dropUnlessResumed
import com.ramcosta.composedestinations.annotation.Destination
import com.ramcosta.composedestinations.annotation.RootGraph
import com.ramcosta.composedestinations.result.ResultBackNavigator
Expand Down Expand Up @@ -105,7 +106,7 @@ fun TemplateEditorScreen(
},
readOnly = readOnly,
summary = titleSummary,
onBack = { navigator.navigateBack(result = !readOnly) },
onBack = dropUnlessResumed { navigator.navigateBack(result = !readOnly) },
onDelete = {
if (deleteAppProfileTemplate(template.id)) {
navigator.navigateBack(result = true)
Expand Down
8 changes: 4 additions & 4 deletions manager/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[versions]
agp = "8.8.1"
agp = "8.8.2"
kotlin = "2.1.10"
ksp = "2.1.10-1.0.30"
ksp = "2.1.10-1.0.31"
compose-bom = "2025.02.00"
lifecycle = "2.8.7"
navigation = "2.8.7"
activity-compose = "1.10.0"
navigation = "2.8.8"
activity-compose = "1.10.1"
kotlinx-coroutines = "1.10.1"
coil-compose = "2.7.0"
compose-destination = "2.1.0-beta16"
Expand Down
2 changes: 1 addition & 1 deletion website/docs/guide/difference-with-magisk.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Before understanding the differences, it's important to know how to identify whe
Here are some differences:

- KernelSU modules cannot be installed in Recovery mode.
- KernelSU modules don't have built-in support for Zygisk, but you can use Zygisk modules through [ZygiskNext](https://github.com/Dr-TSNG/ZygiskNext)).
- KernelSU modules don't have built-in support for Zygisk, but you can use Zygisk modules through [ZygiskNext](https://github.com/Dr-TSNG/ZygiskNext).
- The method for replacing or deleting files in KernelSU modules is completely different from Magisk. KernelSU doesn't support the `.replace` method. Instead, you need to create a same-named file with `mknod filename c 0 0` to delete the corresponding file.
- The directories for BusyBox are different. The built-in BusyBox in KernelSU is located at `/data/adb/ksu/bin/busybox`, while in Magisk it is at `/data/adb/magisk/busybox`. **Note that this is an internal behavior of KernelSU and may change in the future!**
- KernelSU doesn't support `.replace` files, but it supports the `REMOVE` and `REPLACE` variables to remove or replace files and folders.
Expand Down
2 changes: 1 addition & 1 deletion website/docs/guide/how-to-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ If you can successfully build the kernel, adding support for KernelSU will be re
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -
```

```sh[ main branch (dev)]
```sh[main branch (dev)]
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s main
```

Expand Down
8 changes: 4 additions & 4 deletions website/docs/pt_BR/guide/app-profile.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ SELinux é um poderoso mecanismo do Controle de Acesso Obrigatório (MAC). Ele o

O SELinux pode ser executado em dois modos globais:

1. Modo permissivo: Os eventos de negação são registrados, mas não aplicados.
2. Modo de aplicação: Os eventos de negação são registrados e aplicados.
1. Modo permissivo (Permissive): Os eventos de negação são registrados, mas não aplicados.
2. Modo impondo (Enforcing): Os eventos de negação são registrados e aplicados.

::: warning AVISO
Os sistemas Android modernos dependem fortemente do SELinux para garantir a segurança geral do sistema. É altamente recomendável não usar nenhum sistema personalizado executado em "Modo permissivo", pois ele não oferece vantagens significativas em relação a um sistema completamente aberto.
Expand All @@ -85,7 +85,7 @@ typeattribute app1 mlstrustedsubject
allow app1 * * *
```

Observe que a regra `allow app1 * * *` é usada apenas para fins de demonstração. Na prática, esta regra não deve ser utilizada extensivamente, pois não difere muito do Modo permissivo.
Observe que a regra `allow app1 * * *` é usada apenas para fins de demonstração. Na prática, esta regra não deve ser usada extensivamente, pois não difere muito do Modo permissivo.

### Escalação

Expand All @@ -99,7 +99,7 @@ Por exemplo, se você conceder permissão root a um usuário ADB shell (que é u
::: warning OBSERVAÇÃO
Este comportamento é totalmente esperado e não é um bug. Portanto, recomendamos o seguinte:

Se você realmente precisa conceder privilégios root ao ADB (por exemplo, como desenvolvedor), não é aconselhável alterar o UID para `2000` ao configurar o Perfil root. Usar `1000` (system) seria uma melhor escolha.
Se você realmente precisa conceder privilégios root ao ADB (por exemplo, como desenvolvedor), não é aconselhável alterar o UID para `2000` ao configurar o Perfil root. Usar `1000` (sistema) seria uma melhor escolha.
:::

## Perfil não root
Expand Down
2 changes: 1 addition & 1 deletion website/docs/pt_BR/guide/how-to-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Se você conseguir compilar o kernel com sucesso, adicionar suporte ao KernelSU
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -
```

```sh[Branch principal (dev)]
```sh[Branch main (dev)]
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s main
```

Expand Down
2 changes: 1 addition & 1 deletion website/docs/pt_BR/guide/what-is-kernelsu.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ O KernelSU é uma solução root para dispositivos Android GKI, funciona no modo

## Características

A principal característica do KernelSU é que ele é baseado em kernel. O KernelSU funciona no modo kernel, portanto pode fornecer uma interface de kernel que nunca tivemos antes. Por exemplo, é possível adicionar pontos de interrupção de hardware a qualquer processo no modo kernel, acessar a memória física de qualquer processo de forma invisível, interceptar qualquer chamada de sistema (syscall) no espaço do kernel, entre outras funcionalidades.
A principal característica do KernelSU é que ele é **baseado em kernel**. O KernelSU funciona no modo kernel, portanto pode fornecer uma interface de kernel que nunca tivemos antes. Por exemplo, é possível adicionar pontos de interrupção de hardware a qualquer processo no modo kernel, acessar a memória física de qualquer processo de forma invisível, interceptar qualquer chamada de sistema (syscall) no espaço do kernel, entre outras funcionalidades.

E também, o KernelSU fornece um sistema de módulos via OverlayFS, que permite carregar seu plugin personalizado no sistema. Ele também fornece um mecanismo para modificar arquivos na partição `/system`.

Expand Down

0 comments on commit 6e09f8f

Please sign in to comment.