Skip to content

merged dev to main (for release 5) #98

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

Merged
merged 33 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
9b75b6b
add load_function for hooking kprobes/uprobes
ffranzgitHub Nov 11, 2024
5036ad2
Implement unload_function
ffranzgitHub Nov 12, 2024
e7afd61
Add config fields to align with the ebpf_utils::load_function()
ffranzgitHub Nov 11, 2024
1227c6f
Implement update_from_config()
ffranzgitHub Nov 12, 2024
681955d
Fixed compiler warnings and errors.
Mr-Kanister Nov 12, 2024
93ed0e6
Merge branch 'dev' into feat/backend_daemon_load_ebpf
fhilgers Nov 14, 2024
0a73b3b
Merge pull request #78 from amosproj/feat/backend_daemon_load_ebpf
fhilgers Nov 14, 2024
26e57c7
refactor(rust): update folder structure
fhilgers Nov 15, 2024
74bdf41
refactor: adapt counter to new structure
fhilgers Nov 15, 2024
a585dfc
fix: make cargo build/test/xtask work again
fhilgers Nov 15, 2024
74b695e
scope(daemon) implement listing processes
Mr-Kanister Nov 16, 2024
a2b7e46
scope(daemon) remove cmdline field of processes
Mr-Kanister Nov 16, 2024
5a364a7
scope(daemon) add error conversion for ProcError
Mr-Kanister Nov 17, 2024
77562fb
[none working] implemented retprbe
der-whity Nov 17, 2024
434f4bb
chore(eBPF) moved fetching call args from retprobe to probe
der-whity Nov 17, 2024
d924139
scope(daemon) fixes too short process names
Mr-Kanister Nov 17, 2024
edcda1a
feat: update client programs/config
fhilgers Nov 17, 2024
125f25a
Merge pull request #90 from amosproj/60-client-load-list
fhilgers Nov 19, 2024
a2e426b
chore(eBPF) fixed return KProbe time difference
der-whity Nov 19, 2024
8839c5f
scope(cli-client) prettify cli-client
Mr-Kanister Nov 17, 2024
a32fb23
scope(daemon-cli) use clap for argument parsing
Mr-Kanister Nov 19, 2024
45c6df2
test(daemon): listing processes
fhilgers Nov 19, 2024
d2582d6
doc: add product mission to readme
luca-dot-sh Nov 19, 2024
06d9aa0
scope(daemon-test) check_server, set_get_configuration
Mr-Kanister Nov 19, 2024
56175e4
ignore integration test in ci
fhilgers Nov 19, 2024
116a623
Merge branch 'dev' into 59-cli-rebased
fhilgers Nov 19, 2024
fa0191c
Merge pull request #92 from amosproj/59-cli-rebased
fhilgers Nov 19, 2024
bbcf784
feat: connect to backend, add processes list, add error handling, add…
luca-dot-sh Nov 19, 2024
6a3bc81
fix: reuse lint and format
luca-dot-sh Nov 19, 2024
b107ab7
Merge pull request #93 from amosproj/clientsdk_integration_config
fhilgers Nov 20, 2024
395390e
chore: sprint-05 deliverables
fhilgers Nov 20, 2024
80ffd2e
Merge pull request #96 from amosproj/sprint-05-deliverables
ffranzgitHub Nov 20, 2024
3fc49b0
Merge pull request #97 from amosproj/88-vfs_write
ffranzgitHub Nov 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# SPDX-FileCopyrightText: 2024 Robin Seidl <[email protected]>
# SPDX-FileCopyrightText: 2024 The AMOS Projects
#
# SPDX-License-Identifier: MIT
Expand Down Expand Up @@ -47,4 +48,4 @@ target
sbom.json

.codebuddy/

build
1 change: 0 additions & 1 deletion Deliverables/sprint-01/Dummy.md

This file was deleted.

1 change: 0 additions & 1 deletion Deliverables/sprint-04/dummy.md

This file was deleted.

Binary file added Deliverables/sprint-05/build-process-video.webm
Binary file not shown.
Binary file added Deliverables/sprint-05/feature-board.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions Deliverables/sprint-05/feature-board.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
Title URL Assignees Status Estimated size Real size
internal: implement test cli client load and list programs https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/59 BenediktZinn, ffranzgitHub, Mr-Kanister Awaiting Review 3
internal: implement loading/unloading of ebpf functions in daemon https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/77 der-whity, ffranzgitHub, Mr-Kanister Awaiting Review 2 3
Home Screen and Navigation Drawer https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/43 luca-dot-sh Feature Archive 2 3
EBPF Program extension https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/54 der-whity Feature Archive 3 3
Bugfix: Manage Sbom generation through nix https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/55 Mr-Kanister Feature Archive 1 1
Communcation between Android side and Rust side https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/42 fhilgers Feature Archive 5 5
scope(ebpf) unix domain socket traffic analysis (research) https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/22 fhilgers Feature Archive 5 3
Create a prototype for the visualisation screen https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/47 luca-dot-sh Feature Archive 3 3
internal: implement frontend load and list programs https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/62 luca-dot-sh Feature Archive 2 2
Preparation of CI https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/6 fhilgers Feature Archive 3 3
scope(ui) find timeseries visualization library (research) https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/21 clabrous, luca-dot-sh Feature Archive 2 2
Generation of sboms doesn't include kotlin https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/39 Feature Archive 1 1
Manage Sbom generation through nix https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/30 Mr-Kanister Feature Archive 2 1
scope(daemon) get information about android processes to list/find/search them (research) https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/20 der-whity, ffranzgitHub Feature Archive 3 1
License and Copyright Agreement https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/18 fhilgers Feature Archive 2 2
Preperation of Kotlin https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/7 clabrous, luca-dot-sh Feature Archive 3 3
Docker Container https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/11 fhilgers Feature Archive 3 3
scope(build) aarch64 als target https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/23 fhilgers Feature Archive 1 1
scope(build) android 13 instead of 15 https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/24 fhilgers Feature Archive 1 1
Team Decision https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/8 BenediktZinn, clabrous, der-whity, ffranzgitHub, fhilgers, luca-dot-sh, Mr-Kanister Feature Archive 1 1
architecture document https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/10 fhilgers Feature Archive 3 5
bill of materials https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/9 BenediktZinn, der-whity, Mr-Kanister Feature Archive 3 3
Brain Storming Architecture https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/3 Feature Archive 3 1
scope(ebpf/daemon) uprobe https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/19 Sprint Backlog 8
Retrieve running processes List https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/72 Mr-Kanister Awaiting Review 3 3
internal: implement client library and export to kotlin for load and list programs https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/60 BenediktZinn, fhilgers Awaiting Review 2
internal: define kotlin interface for frontend loading and listing programs https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/58 fhilgers Awaiting Review 1
Define metric for the visualisation screen https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/46 Product Backlog
Plaintext architecture document https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/34 Product Backlog
Define the time intervals / time delay between each data point https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/45 Product Backlog
Show information about which apps are available (depends on the daemon search functionality) https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/25 Product Backlog -1
Distinguish between System vs. User Applications https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/74 Product Backlog 3
Identify Running State https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/75 Product Backlog 3
UI Filter for System and User Applications https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/76 Product Backlog
Define Project Goals / Project Features https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/2 Product Backlog 3
Brain Storming eBPF Use Cases https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/1 Product Backlog 2
Create kprobe to Track Blocking vfs_write Call https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/88 der-whity Product Backlog
POC: analyze unix domain sockets https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/80 Sprint Backlog 5
Display Installed Applications in UI https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/73 luca-dot-sh Feature Archive 2
User eBPF programm Selection https://github.com/amosproj/amos2024ws03-android-zero-instrumentation/issues/41 ffranzgitHub, fhilgers, Mr-Kanister Awaiting Review 5
Binary file added Deliverables/sprint-05/imp-squared-backlog.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions Deliverables/sprint-05/imp-squared-backlog.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Title Assignees Status
Note: All of the Items have a more detailed description pls. click them to see. (this is not an item) Todo
Team collaboration (between dev and po) Todo
Streamline testing proces Todo
Repository coordination Todo
Making sure all tasks in a sprint are being finished Todo
Assist in creating team processes (Sinatra Doctrine) In Progress
Lifting the collective mood In Progress
Load balancing inside the dev team In Progress
Gain Independence from the IP In Progress
Creating a Template for backlog item suggestions by the IP Done
Solving dissatisfaction among the team Done
Focus on IP (and PO relations) Done
Ensuring that everyone has work to do Done
Backlog Item creation procedure Done
Helping Coordinate the team meeting Done
Helping to set up the first IP meeting Done
Supporting team in understanding the amos workflow (e.g importance of the team meeting) Done
Creating Sub-Teams to streamline development Done
Establishing a continuouse release cycle with the team Done
Improving time management in the Team meeting Done
Ensuring a continuous backlog items flow Done
Binary file added Deliverables/sprint-05/planning-documents.pdf
Binary file not shown.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ SPDX-License-Identifier: MIT

<img src="Deliverables/sprint-01/team-logo.svg" width="224">

## Product Mission

**ZIOFA** (Zero Instrumentation Observability for Android) aims to implement observability use cases relevant to performance specified by our industry partner using eBPF. Examples include tracing long-running blocking calls, leaking JNI indirect references or signals like SIGKILL sent to processes, all without instrumenting the observed application itself.
The eBPF programs are loaded and unloaded using a **backend daemon** running as root that will collect metrics and send them to a client. For displaying these metrics to the user, we are implementing an **on-device UI** that can display visualizations for these use cases and allow for configuration of the enabled use cases, but **using a decoupled Client SDK** so that future work may easily make the data accessible the external processing.

## Building

### [Nix](https://nixos.org/download/)
Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@

rustTest = pkgs.writeShellScriptBin "rust-test" ''
${rustCiPreamble}
(cd rust && cargo test)
(cd rust && cargo test --workspace --exclude "backend-daemon")
'';

rustBuildRelease = pkgs.writeShellScriptBin "rust-build-release" ''
Expand Down
4 changes: 4 additions & 0 deletions frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ SPDX-License-Identifier: MIT
`./gradlew build` <br/>
The resulting APKs for release/debug build types can then be found under `frontend/app/build/outputs/apk`.

### Installing the app:
`./gradlew installRealBackendDebug` or `./gradlew iRBD` for installing a version with a **real** backend <br/>
`./gradlew installMockBackendDebug` or `./gradlew iMBD` for installing a version with a **mocked** backend <br/>

### Generating the report for the bill of materials (BOM)
To generate a BOM of all *release runtime dependencies*, the following Gradle task can be run: <br/>
`./gradlew cyclonedxBom` <br/>
Expand Down
12 changes: 12 additions & 0 deletions frontend/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ android {
}
buildFeatures {
compose = true
buildConfig = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.1"
Expand All @@ -69,6 +70,17 @@ android {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}

flavorDimensions += "environment"
productFlavors {
create("realBackend") {
dimension = "environment"
}
create("mockedBackend") {
dimension = "environment"
versionNameSuffix = ".mocked" // Optional
}
}
}

dependencies {
Expand Down
22 changes: 18 additions & 4 deletions frontend/app/src/main/java/de/amosproj3/ziofa/ZiofaApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,38 @@
package de.amosproj3.ziofa

import android.app.Application
import de.amosproj3.ziofa.api.ConfigurationAccess
import de.amosproj3.ziofa.api.ProcessListAccess
import de.amosproj3.ziofa.bl.ConfigurationManager
import de.amosproj3.ziofa.client.ClientFactory
import de.amosproj3.ziofa.client.RustClientFactory
import de.amosproj3.ziofa.client.mocks.MockClientFactory
import de.amosproj3.ziofa.ui.configuration.ConfigurationViewModel
import de.amosproj3.ziofa.ui.processes.ProcessesViewModel
import de.amosproj3.ziofa.ui.visualization.VisualizationViewModel
import org.koin.android.ext.koin.androidContext
import org.koin.android.ext.koin.androidLogger
import org.koin.core.context.startKoin
import org.koin.core.module.dsl.singleOf
import org.koin.core.module.dsl.viewModel
import org.koin.dsl.binds
import org.koin.dsl.module
import timber.log.Timber

class ZiofaApplication : Application() {

val appModule = module {
singleOf<ClientFactory>(::RustClientFactory)
viewModel { ConfigurationViewModel() }
viewModel { VisualizationViewModel(get()) }
single<ClientFactory> {
if (BuildConfig.FLAVOR == "mockedBackend") {
MockClientFactory()
} else {
RustClientFactory("http://[::1]:50051")
}
}
single { ConfigurationManager(clientFactory = get()) } binds
arrayOf(ConfigurationAccess::class, ProcessListAccess::class)
viewModel { ConfigurationViewModel(configurationAccess = get()) }
viewModel { ProcessesViewModel(processListAccess = get()) }
viewModel { VisualizationViewModel(clientFactory = get()) }
}

override fun onCreate() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// SPDX-FileCopyrightText: 2024 Luca Bretting <[email protected]>
//
// SPDX-License-Identifier: MIT

package de.amosproj3.ziofa.api

import kotlinx.coroutines.flow.StateFlow
import uniffi.shared.Configuration

interface ConfigurationAccess {
val configuration: StateFlow<ConfigurationUpdate>

fun submitConfiguration(configuration: Configuration)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// SPDX-FileCopyrightText: 2024 Luca Bretting <[email protected]>
//
// SPDX-License-Identifier: MIT

package de.amosproj3.ziofa.api

import uniffi.shared.Configuration

sealed class ConfigurationUpdate {
data class OK(val configuration: Configuration) : ConfigurationUpdate()

data class NOK(val error: Throwable) : ConfigurationUpdate()

data object UNKNOWN : ConfigurationUpdate()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// SPDX-FileCopyrightText: 2024 Luca Bretting <[email protected]>
//
// SPDX-License-Identifier: MIT

package de.amosproj3.ziofa.api

import kotlinx.coroutines.flow.StateFlow
import uniffi.shared.Process

interface ProcessListAccess {
val processesList: StateFlow<List<Process>>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// SPDX-FileCopyrightText: 2024 Luca Bretting <[email protected]>
//
// SPDX-License-Identifier: MIT

package de.amosproj3.ziofa.bl

import de.amosproj3.ziofa.api.ConfigurationAccess
import de.amosproj3.ziofa.api.ConfigurationUpdate
import de.amosproj3.ziofa.api.ProcessListAccess
import de.amosproj3.ziofa.client.Client
import de.amosproj3.ziofa.client.ClientFactory
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
import timber.log.Timber
import uniffi.client.ClientException
import uniffi.shared.Configuration
import uniffi.shared.Process

class ConfigurationManager(val clientFactory: ClientFactory) :
ProcessListAccess, ConfigurationAccess {

private val coroutineScope = CoroutineScope(Dispatchers.IO)
private var client: Client? = null

override val processesList = MutableStateFlow<List<Process>>(listOf())
override val configuration: MutableStateFlow<ConfigurationUpdate> =
MutableStateFlow(ConfigurationUpdate.UNKNOWN)

override fun submitConfiguration(configuration: Configuration) {
coroutineScope.launch {
client?.setConfiguration(configuration)
getAndUpdateConfiguration() // "emulates" callback of changed configuration until
// implemented
}
}

init {
coroutineScope.launch {
try {
client = clientFactory.connect()
initializeConfigurationState()
startProcessListUpdates()
} catch (e: ClientException) {
configuration.update { ConfigurationUpdate.NOK(e) }
}
}
}

private suspend fun initializeConfigurationState() {
val initializedConfiguration =
try {
client!!.getConfiguration()
} catch (e: ClientException) {
// TODO this should be handled on the backend
client!!.setConfiguration(Configuration(listOf()))
client!!.getConfiguration()
}
configuration.update { ConfigurationUpdate.OK(initializedConfiguration) }
}

private suspend fun startProcessListUpdates() {
while (true) {
delay(1000)
client?.let { client -> processesList.update { client.listProcesses() } }
?: processesList.update { listOf() }.also { Timber.w("Client not ready!") }
}
}

private suspend fun getAndUpdateConfiguration() {
configuration.update {
try {
(client?.getConfiguration()?.let { ConfigurationUpdate.OK(it) }
?: ConfigurationUpdate.UNKNOWN)
.also { Timber.i("Received config $it") }
} catch (e: Exception) {
ConfigurationUpdate.NOK(e)
}
}
}
}
1 change: 1 addition & 0 deletions frontend/app/src/main/java/de/amosproj3/ziofa/ui/Routes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ enum class Routes {
Configuration,
About,
Home,
Processes,
}
28 changes: 19 additions & 9 deletions frontend/app/src/main/java/de/amosproj3/ziofa/ui/ZiofaApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import de.amosproj3.ziofa.ui.about.AboutScreen
import de.amosproj3.ziofa.ui.configuration.ConfigurationScreen
import de.amosproj3.ziofa.ui.navigation.HomeScreen
import de.amosproj3.ziofa.ui.navigation.composables.ZiofaTopBar
import de.amosproj3.ziofa.ui.processes.ProcessesScreen
import de.amosproj3.ziofa.ui.visualization.VisualizationScreen

/** Main application composable. All calls to [NavController] should happen here. */
Expand All @@ -41,6 +42,7 @@ fun ZIOFAApp() {
toVisualize = { navController.navigate(Routes.Visualize.name) },
toConfiguration = { navController.navigate(Routes.Configuration.name) },
toAbout = { navController.navigate(Routes.About.name) },
toProcesses = { navController.navigate(Routes.Processes.name) },
modifier = Modifier.padding(innerPadding),
)
}
Expand All @@ -49,7 +51,10 @@ fun ZIOFAApp() {
enterTransition = { slideInHorizontally(initialOffsetX = { it }) + fadeIn() },
exitTransition = { slideOutHorizontally(targetOffsetX = { it }) + fadeOut() },
) {
ConfigurationScreen(Modifier.padding(innerPadding))
ConfigurationScreen(
Modifier.padding(innerPadding),
onBack = { navController.backToHome() },
)
}
composable(
Routes.Visualize.name,
Expand All @@ -65,6 +70,14 @@ fun ZIOFAApp() {
) {
AboutScreen(Modifier.padding(innerPadding))
}

composable(
Routes.Processes.name,
enterTransition = { slideInHorizontally(initialOffsetX = { it }) + fadeIn() },
exitTransition = { slideOutHorizontally(targetOffsetX = { it }) + fadeOut() },
) {
ProcessesScreen(Modifier.padding(innerPadding))
}
}
}
}
Expand All @@ -82,15 +95,12 @@ fun DynamicTopBar(navController: NavController) {
}

else -> {
ZiofaTopBar(
screenName = currentRoute,
onBack = {
navController.navigate(Routes.Home.name) {
popUpTo(Routes.Home.name) { inclusive = false }
}
},
)
ZiofaTopBar(screenName = currentRoute, onBack = { navController.backToHome() })
}
}
}
}

fun NavController.backToHome() {
this.navigate(Routes.Home.name) { popUpTo(Routes.Home.name) { inclusive = false } }
}
Loading
Loading