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

Distinguish the process AppScope state (Unscoped/Attached/Detached) #1096

Closed
michalbiesek opened this issue Sep 6, 2022 · 2 comments
Closed
Assignees

Comments

@michalbiesek
Copy link
Contributor

michalbiesek commented Sep 6, 2022

Currently, in our model, we could distinguish the state of whether our library is loaded or not.
With the detach functionality we have a new state: our library can be loaded but we are not sending any data.
So essentially in context of the AppScope, process can be in three states:

  • Unscoped (our library is not loaded)
  • Attached (our library is loaded and we actively send the data to the destination place - we are hooked)
  • Detached (our library is loaded and we do not send the data to the destination place - we are unhooked)

See the state diagram below

Scenario 1 Attach to running application

stateDiagram-v2
    ProcStart: Process Start
    State1: AppScope is not loaded
    State2: AppScope is loaded
    state State1 {
    ProcStart --> Unscoped
    Unscoped --> Attached: ldscope -a
    }
    state State2 {
    Attached --> Detached: ldscope -d
    Detached --> Attached: ldscope -a
    }
Loading

Scenario 2 Run scoped application

stateDiagram-v2
    State1: AppScope is not loaded
    State2: AppScope is loaded
    state State1 {
    * --> Attached :ldscope ./foo_process
    }
    state State2 {
    Attached --> Detached: ldscope -d
    Detached --> Attached: ldscope -a
    }
Loading

We should be able to distinguish these three states with for example scope ps without extensive privileges like ptrace

@michalbiesek michalbiesek self-assigned this Sep 6, 2022
michalbiesek added a commit that referenced this issue Sep 6, 2022
- check if application was attached/deatached
- provide a dummy mapping for the detach state

Closes #1096
@michalbiesek
Copy link
Contributor Author

Test instructions:

  • Start example process (e.g. htop)
  • Perform attach via e.g. ldscope -a <htop_pid>
  • Run sudo scope ps
    Example output:
sudo scope ps
ID	PID    	USER      COMMAND	STATE
1 	3230690	foouser	  htop   	Attached
  • Perform detach via e.g. ldscope -d <htop_pid>
  • Wait several seconds ~5 to ensure that the dynamic configuration file was consumed
  • Run sudo scope ps
    Example output:
sudo scope ps
ID	PID    	USER      COMMAND	STATE
1 	3230690	foouser	  htop   	Detached

michalbiesek added a commit that referenced this issue Sep 6, 2022
- check if application was attached/detached
- provide a dummy mapping for the detach state

Closes #1096
michalbiesek added a commit that referenced this issue Sep 6, 2022
- check if application was attached/detached
- provide a dummy mapping for the detach state

Closes #1096
michalbiesek added a commit that referenced this issue Sep 9, 2022
- check if application was attached/detached
- provide a dummy mapping for the detach state

Closes #1096
michalbiesek added a commit that referenced this issue Sep 12, 2022
- check if application was instrumented/uninstrumented
- provide a dummy mapping for the uninstrumented state

Closes #1096
michalbiesek added a commit that referenced this issue Sep 13, 2022
- check the state of application if was unscoped/scoped/loaded
- provide a dummy mapping for the loaded state

Closes #1096
michalbiesek added a commit that referenced this issue Sep 16, 2022
- check the state of application if was unscoped/scoped/loaded
- provide a dummy mapping for the loaded state

Closes #1096
@michalbiesek
Copy link
Contributor Author

michalbiesek commented Sep 16, 2022

Closing since the work will be continued in #1108

@michalbiesek michalbiesek removed this from the Next Feature Version (1.2.0) milestone Sep 16, 2022
michalbiesek added a commit to michalbiesek/appscope that referenced this issue Feb 19, 2023
- check the state of application if was unscoped/scoped/loaded
- provide a dummy mapping for the loaded state

Closes criblio#1096
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

1 participant