Unexpected Child Process Termination in Magisk su on Android
in Post with 0 comment

I encountered an unusual issue with tar on my Android device running Magisk su. When attempting to compress a directory using the 'tar -czvf archive.tar.gz directory' command, the child process spawned to perform the compression was terminated prematurely as soon as the archiver process concluded.

Reproducing this issue:

On my Android emulator with Magisk su (version 28.1), running the following command resulted in the child 'sleep' process not being found:

```
root -c "sleep 123 &"

ps -A | grep sleep
# no sleep process found
```

This behavior deviates from the expected behavior observed on both rooted Debian systems and unmodified Linux distributions, where the 'sleep' process would continue to run in the background. Here's a comparison:

**Debian (Rooted):**
```
/system/bin/sh -c "sleep 123 &"
ps -A | grep sleep
root 30923 1 11560 3620 __se_sys_nanosleep_time32 0 S sleep
```

**Magisk su (Android):**
```
root -c "sleep 123 &"
ps -aux | grep sleep
root 207105 0.0 0.0 3212 1020 ? S 15:41 0:00 sleep 123
```

**Key Questions:**
Is this unexpected child process termination a feature or a bug within Magisk su?
Is there a configuration option or workaround to prevent this behavior? Understanding the cause and potential solutions would be greatly appreciated.

The article has been posted for too long and comments have been automatically closed.