Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-96697

RemoteObjects: localabstract scheme is blocked on Android by SELinux when client and server are in different processes

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.2.0
    • Remote Objects
    • None
    • Sony Xperia 1 III variant of Android 11
    • Android

    Description

      With https://codereview.qt-project.org/c/qt/qtremoteobjects/+/366916 support for abstract local sockets was added to QtRO for Linux platforms to help with cases where the file system is read-only.

      Though it seems this still doesn't work on "mainstream" distributions of Android (tested on a Sony variant of Android 11, Xperia 1 III).

      Looking at the log output from remote objects I can see that listening on the server succeeds but attempting to connect to it from the client is faced with a SocketAccessError.

      # Server side
      09-20 14:54:28.477 32668 32698 D qt.remoteobjects: :  QRemoteObjectSourceIo is Listening QUrl("localabstract:replica")
      09-20 14:54:28.477 32668 32698 D qt.remoteobjects: : Connection made 0 5 "messageFromService"
      09-20 14:54:28.477 32668 32698 D qt.remoteobjects: :  Registering "QtAndroidService"
      
      ###
      
      # Client side
      09-20 14:54:30.462   410   470 D libserviceremoteobjectsclient_arm64-v8a.so: Start remote object client
      09-20 14:54:30.462   410   470 D qt.remoteobjects: :  Opening connection to "localabstract:replica"
      09-20 14:54:30.462   410   470 D qt.remoteobjects: :  Replica Connection isValid false
      09-20 14:54:30.462   410   470 D qt.remoteobjects: : onError QLocalSocket::SocketAccessError "replica"
      09-20 14:54:30.462   410   470 D qt.remoteobjects: :  Starting setReplicaImplementation for "QtAndroidService"
      09-20 14:54:30.462   410   470 D qt.remoteobjects: :  void qt::QRemoteObjectNodePrivate::openConnectionIfNeeded(const qt::QString &) "QtAndroidService" 0xb4000072570b2510
      09-20 14:54:30.462   410   470 D qt.remoteobjects: :  "QtAndroidService" not available - available addresses: QHash()
      09-20 14:54:30.462   410   470 D qt.remoteobjects: : configurePrivate starting for "QtAndroidService"
      09-20 14:54:30.462   410   470 D qt.remoteobjects: :   Rep connect 5 true "initialized"
      09-20 14:54:30.462   410   470 D qt.remoteobjects: :   Rep connect 6 true "notified"
      09-20 14:54:30.462   410   470 D qt.remoteobjects: :   Rep connect 7 true "stateChanged"
      09-20 14:54:30.462   410   470 D qt.remoteobjects: :   Connect 8 true "messageFromService"
      09-20 14:54:30.462   410   470 D qt.remoteobjects: : "configurePrivate finished, signalOffset = 8, methodOffset = 9, #Signals = 1"
      09-20 14:54:30.462   410   470 D qt.remoteobjects: :  setReplicaImplementation - Created new instance "QtAndroidService" QHash()
      [...]
      09-20 14:54:30.458   410   410 W qtMainLoopThrea: type=1400 audit(0.0:76210): avc: denied { connectto } for path=007265706C696361 scontext=u:r:untrusted_app:s0:c237,c257,c512,c768 tcontext=u:r:untrusted_app:s0:c238,c257,c512,c768 tclass=unix_stream_socket permissive=0 ppid=868 pcomm="main" pgid=410 pgcomm="tandroidservice" app=org.qtproject.example.qtandroidservice
      

      Note the last line from the client! It's from SELinux saying we've been denied access to the connectto call!

      An updated version of the serviceremoteobjects example from qtandroidextras is attached which works with Qt6.2.

      # Configure with
      mkdir build && cd build && qmake ../serviceremoteobjects.pro
      # Build with
      make && make apk -j1
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              bstottle Brett Stottlemyer
              manordheim Mårten Nordheim
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes