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

dlt-daemon: create sockets using "android way" #333

Merged
merged 1 commit into from
Oct 12, 2021

Conversation

sebastienraillet
Copy link
Contributor

Summary

The goal of this PR is to use the android way to create sockets inside DLT daemon for android system to allow a better configuration of SELinux labels / contexts on them.

Description

  • Before this PR, dlt-daemon sockets were created inside /data/local/tmp. This works but have many drawbacks:

    • /data/local/tmp isn't always a tmpfs depending of the android system you have. Means sockets are potentially created on a filesystem which binds to a real device
    • as the sockets are created by the dlt-daemon itself, this prevent the usage of specific SELinux labels / contexts as they will inherit the label / context from its parent location (e.g the ones from /data/local/tmp). This prevent a fine control of the SELinux label / context that you would like to apply on them
  • This commit adapts the dlt-daemon in such way:

    • application and control sockets are now created inside /dev/socket which is the standard path for sockets on android
    • these sockets are now created by init (see dlt-daemon.rc) and their fds are recovered by dlt-daemon through a specific android API (dlt_daemon_unix_android_get_socket). If the fds can't be recovered, we fallback to the previous mechanism by creating by ourself the sockets (even if this will prevent SELinux label / context on this socket)
    • all these modifications have been put under compilation flag for android

Signed-off-by: Sebastien RAILLET sebastien.raillet@marelli.com

* Before this commit, dlt-daemon sockets were created inside
/data/local/tmp. This works but have many drawbacks:
    - /data/local/tmp isn't always a tmpfs depending of the android
    system you have. Means sockets are potentially created on a
    filesystem which binds to a real device
    - as the sockets are created by the dlt-daemon itself, this
    prevent the usage of specific SELinux labels / contexts as
    they will inherit the label / context from its parent
    location (e.g the ones from /data/local/tmp). This prevent a
    fine control of the SELinux label / context that you would like
    to apply on them

* This commit adapts the dlt-daemon in such way: 
    - application and control sockets are now created inside
    /dev/socket which is the standard path for sockets on android
    - these sockets are now created by init (see dlt-daemon.rc) and
    their fds are recovered by dlt-daemon through a specific android
    API (dlt_daemon_unix_android_get_socket). If the fds can't be
    recovered, we fallback to the previous mechanism by creating
    by ourself the sockets (even if this will prevent SELinux
    label / context on this socket)
    - all these modifications have been put under compilation flag
    for android

Signed-off-by: Sebastien RAILLET <sebastien.raillet@marelli.com>
Android.bp Show resolved Hide resolved
@ssugiura ssugiura merged commit 1919000 into COVESA:master Oct 12, 2021
@sebastienraillet sebastienraillet deleted the android-socket-management branch October 12, 2021 08:31
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

Successfully merging this pull request may close these issues.

None yet

3 participants