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

avc: denied { ioctl } messages in Android testbed #1962

Closed
mhsmith opened this issue Jun 5, 2023 · 1 comment · Fixed by #1951
Closed

avc: denied { ioctl } messages in Android testbed #1962

mhsmith opened this issue Jun 5, 2023 · 1 comment · Fixed by #1951
Labels
android The issue relates to Android mobile support. bug A crash or error in behavior.

Comments

@mhsmith
Copy link
Member

mhsmith commented Jun 5, 2023

The Android testbed produces a message like this approximately once per test:

W/Thread-2: type=1400 audit(0.0:767): avc: denied { ioctl } for path="pipe:[10138300]" dev="pipefs" ino=10138300 ioctlcmd=0x5413 scontext=u:r:untrusted_app:s0:c162,c256,c512,c768 tcontext=u:r:untrusted_app:s0:c162,c256,c512,c768 tclass=fifo_file permissive=0 app=org.beeware.toga.testbed

This is an SELinux message, probably caused by the pytest-asyncio plugin, which I think uses a pipe as a means of thread synchronization.

It doesn't appear to be causing any problems, it just makes the log harder to read. But I don't want to suppress all "avc: denied" messages, because they often contain useful information about why the app has been blocked from doing something.

@mhsmith mhsmith added bug A crash or error in behavior. android The issue relates to Android mobile support. labels Jun 5, 2023
@mhsmith
Copy link
Member Author

mhsmith commented Jun 18, 2023

probably caused by the pytest-asyncio plugin, which I think uses a pipe as a means of thread synchronization.

Actually, it turns out that when you search the NDK headers for 5413, you find TIOCGWINSZ, which is the ioctl used by os.get_terminal_size, which is called by pytest.

Normally this function would raise an OSError ("Inappropriate ioctl for device"). But because we're using Chaquopy's stdio redirection mechanism, which replaces stdout with a pipe, we instead get a PermissionError and this log message.

I worked around this in #1951 by monkey-patching os.get_terminal_size. This should be merged into Chaquopy itself (chaquo/chaquopy#886).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android The issue relates to Android mobile support. bug A crash or error in behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant