Skip to content

Abstract unix socket control #7

Closed

Activity

  1. moved this to Ready in Landlockon Feb 1, 2024
  2. changed the title [-]Abstract socket control[/-] [+]Abstract unix socket control[/+] on Feb 1, 2024
  3. tahifahimi commented on Mar 13, 2024

    @tahifahimi

    Hi @l0kod,
    I start working on this, and read almost all of the related docs & explanations :)
    quick question, besides following the landlock logic from task.c (which is ptrace.c in staging branch) and scope changes that should apply to net.c, do we need to modify any other file?

  4. l0kod commented on Mar 13, 2024

    @l0kod
    MemberAuthor

    Hi @tahifahimi,

    Hi @l0kod, I start working on this, and read almost all of the related docs & explanations :)

    Great!

    besides following the landlock logic from task.c (which is ptrace.c in staging branch) and scope changes that should apply to net.c, do we need to modify any other file?

    I think most changes should be in task.c/ptrace.c. The net.c file is dedicated to network rule management (only TCP bind/connect for now), but the abstract unix socket restrictions should be implemented as scopes like for ptrace restrictions (e.g. no new Landlock rule type but only a ruleset's flag, no sockaddr parsing...). Moreover, I consider abstract unix sockets to be more an IPC mechanism rather than a network feature. task.c contains the main helpers that should be used (and extended): task_is_scoped() and domain_scope_le().

    About the flag design, see #8 (comment). Updating this interface should lead you to the other files that will need some changes.

  5. tahifahimi commented on Mar 15, 2024

    @tahifahimi

    Thanks for your comments! Based on you suggested, I had a look; please correct me if I am wrong.
    First I have to add a struct field to the landlock_ruleset in landlock/ruleset.h (a struct field same as hierarchy which is used for ptrace). Then I should edit the "landlock/ptrace.c" and add landlock_hooks for unix_stream_connect and unix_may_send and write the respective helpers (same thing we have for ptrace_traceme and ptrace_access_check for ptrace).

  6. l0kod commented on Mar 15, 2024

    @l0kod
    MemberAuthor

    Looks good! One important thing to keep in mind is that because abstract unix socket scoping will be optional, you might need to implement new checks in the current domain_scope_le() helper and related data structures/calls.

    BTW, the rename of ptrace.c to task.c is now merged: 35e886e

  7. l0kod commented on Mar 15, 2024

    @l0kod
    MemberAuthor

    I'm assigning this issue to you. Please regularly update it with your progress. This doesn't need to be long but just enough to make sure you are not blocked.

  8. assigned and unassigned on Mar 15, 2024
  9. moved this from Ready to In Progress in Landlockon Mar 15, 2024
  10. tahifahimi commented on Mar 20, 2024

    @tahifahimi

    @l0kod, I have a quick question:
    Since the input of hook_unix_stream_connect are struct sock *const sock, struct sock *const other, and struct sock *const newsk, how can we map a sock struct to a task_struct? (because it is specified in here that we want to scope the abstract unix socket according to a landlock domain, and we can get the landlock_ruleset through landlock_get_task_domainfunction)

  11. 23 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions