Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: application killed when switching from termux to termux-x11 #699

Open
natebragg opened this issue Aug 13, 2024 · 10 comments
Open

[Bug]: application killed when switching from termux to termux-x11 #699

natebragg opened this issue Aug 13, 2024 · 10 comments

Comments

@natebragg
Copy link

Problem description

I run TERMUX_X11_DEBUG=1 termux-x11 :0 -xstartup xclock in termux. I then switch apps to termux-x11, which flashes and then goes back to the 'not connected' screen.

When I go back to termux and look at the log the last line is X connection to :0 broken (explicit kill or server shutdown). Although I used xclock here, this happens for each of the various applications I tested.

I am using a Samsung SM-T820 tablet.

What steps will reproduce the bug?

See above.

What is the expected behavior?

No response

@twaik
Copy link
Member

twaik commented Aug 13, 2024

Probably you should post the logcat output. Run logcat > log.txt 2>&1 after termux-x11 stops and post here the log file. Not screenshot.

@natebragg
Copy link
Author

log.txt

Nothing jumps out to me immediately. I don't even see xclock mentioned.

@twaik
Copy link
Member

twaik commented Aug 15, 2024

It seems like termux-x11 is killed with SYS_SECCOMP. It is pretty much weird, it should not behave this way. And I do not see any way to fix it because it is caused by your firmware, probably after system update.

@natebragg
Copy link
Author

This system has not been updated in a long time. It is an older device, running Android 9. It may be a firmware issue perhaps, but when googling around it seems it may also be caused by lifecycle events. When I go from termux to some other app (settings, calendar, whatever) this issue does not happen. Only the x11 server. Interestingly, this also does not occur when testing this in split screen mode (xclock is not displaying, but that is a separate issue that I will open).

@natebragg
Copy link
Author

Oh, and when exiting from split screen, it now works fine. Switching between the two apps does not cause xclock to be killed. So this is clearly an issue with initially launching the app. Perhaps there's a good way to catch this in action via app-specific logging?

@natebragg
Copy link
Author

natebragg commented Aug 16, 2024

Another update---I tried to see if strace termux-x11 could give any insight, and interestingly when I run it and then quickly switch to the server, strace slows things down enough that it worked sometimes, and crashed others. If I run this without switching quickly, however, it crashes after switching. As far as I can tell, modulo memory addresses and such, the strace logs are similar.

@peasoft
Copy link

peasoft commented Oct 3, 2024

Reproduced on an OPPO device with Android 10.

  1. Open Termux X11
  2. Switch to Termux and run termux-x11
  3. Switch to Termux X11
  4. Connection lost, termux-x11 was killed

However:

  1. Open Termux and run termux-x11
  2. Open Termux X11
  3. Switch to Termux
  4. Everything is fine

@twaik
Copy link
Member

twaik commented Nov 26, 2024

@natebragg Can you please try

clang -o libsetgid.so -shared -x c - <<< "void setgid(void){}"

And then

LD_PRELOAD=libsetgid.so termux-x11 :0 -xstartup xclock

?

@natebragg
Copy link
Author

@twaik This does not crash! I love this, quite ingenious. The only downside is that xclock does not display, but that is a separate issue. Unfortunately, if I run xterm instead, it still crashes with the same error as before. gvim is also killed.

@twaik
Copy link
Member

twaik commented Nov 28, 2024

Probably you should do clang -o libsetgid.so -shared -x c - <<< "int setgid(void){ return 0; }" and add LD_PRELOAD=libsetgid.so to the ~/.bashrc. There are not a chance it is not a bug in your firmware.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants