Skip to content

Commit

Permalink
feat: pagefault kernel module (#11)
Browse files Browse the repository at this point in the history
* Adding page fault kmod

* Adding page fault kmod

* Adding page fault kmod

* Update README.md

* Unfinished pagefault

* Updating for GH actions

* Updating for GH actions

* Updating for GH actions

* Updating for GH actions

* Fixing GH Actions tests

* Fixing GH Actions tests

* Fixing GH Actions tests

* Fixing GH Actions tests

* Fixing GH Actions tests
  • Loading branch information
ShivanshVij authored Jul 3, 2024
1 parent a1a90da commit b54dc46
Show file tree
Hide file tree
Showing 27 changed files with 4,443 additions and 1 deletion.
688 changes: 688 additions & 0 deletions .clang-format

Large diffs are not rendered by default.

147 changes: 147 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# Generated from CLion Inspection settings
---
Checks: '-*,
bugprone-argument-comment,
bugprone-assert-side-effect,
bugprone-bad-signal-to-kill-thread,
bugprone-branch-clone,
bugprone-copy-constructor-init,
bugprone-dangling-handle,
bugprone-dynamic-static-initializers,
bugprone-fold-init-type,
bugprone-forward-declaration-namespace,
bugprone-forwarding-reference-overload,
bugprone-inaccurate-erase,
bugprone-incorrect-roundings,
bugprone-integer-division,
bugprone-lambda-function-name,
bugprone-macro-parentheses,
bugprone-macro-repeated-side-effects,
bugprone-misplaced-operator-in-strlen-in-alloc,
bugprone-misplaced-pointer-arithmetic-in-alloc,
bugprone-misplaced-widening-cast,
bugprone-move-forwarding-reference,
bugprone-multiple-statement-macro,
bugprone-no-escape,
bugprone-parent-virtual-call,
bugprone-posix-return,
bugprone-reserved-identifier,
bugprone-sizeof-container,
bugprone-sizeof-expression,
bugprone-spuriously-wake-up-functions,
bugprone-string-constructor,
bugprone-string-integer-assignment,
bugprone-string-literal-with-embedded-nul,
bugprone-suspicious-enum-usage,
bugprone-suspicious-include,
bugprone-suspicious-memset-usage,
bugprone-suspicious-missing-comma,
bugprone-suspicious-semicolon,
bugprone-suspicious-string-compare,
bugprone-suspicious-memory-comparison,
bugprone-suspicious-realloc-usage,
bugprone-swapped-arguments,
bugprone-terminating-continue,
bugprone-throw-keyword-missing,
bugprone-too-small-loop-variable,
bugprone-undefined-memory-manipulation,
bugprone-undelegated-constructor,
bugprone-unhandled-self-assignment,
bugprone-unused-raii,
bugprone-unused-return-value,
bugprone-use-after-move,
bugprone-virtual-near-miss,
cert-dcl21-cpp,
cert-dcl58-cpp,
cert-err34-c,
cert-err52-cpp,
cert-err60-cpp,
cert-flp30-c,
cert-msc50-cpp,
cert-msc51-cpp,
cert-str34-c,
cppcoreguidelines-interfaces-global-init,
cppcoreguidelines-narrowing-conversions,
cppcoreguidelines-pro-type-member-init,
cppcoreguidelines-pro-type-static-cast-downcast,
cppcoreguidelines-slicing,
google-default-arguments,
google-explicit-constructor,
google-runtime-operator,
hicpp-exception-baseclass,
hicpp-multiway-paths-covered,
misc-misplaced-const,
misc-new-delete-overloads,
misc-no-recursion,
misc-non-copyable-objects,
misc-throw-by-value-catch-by-reference,
misc-unconventional-assign-operator,
misc-uniqueptr-reset-release,
modernize-avoid-bind,
modernize-concat-nested-namespaces,
modernize-deprecated-headers,
modernize-deprecated-ios-base-aliases,
modernize-loop-convert,
modernize-make-shared,
modernize-make-unique,
modernize-pass-by-value,
modernize-raw-string-literal,
modernize-redundant-void-arg,
modernize-replace-auto-ptr,
modernize-replace-disallow-copy-and-assign-macro,
modernize-replace-random-shuffle,
modernize-return-braced-init-list,
modernize-shrink-to-fit,
modernize-unary-static-assert,
modernize-use-auto,
modernize-use-bool-literals,
modernize-use-emplace,
modernize-use-equals-default,
modernize-use-equals-delete,
modernize-use-nodiscard,
modernize-use-noexcept,
modernize-use-nullptr,
modernize-use-override,
modernize-use-transparent-functors,
modernize-use-uncaught-exceptions,
mpi-buffer-deref,
mpi-type-mismatch,
openmp-use-default-none,
performance-faster-string-find,
performance-for-range-copy,
performance-implicit-conversion-in-loop,
performance-inefficient-algorithm,
performance-inefficient-string-concatenation,
performance-inefficient-vector-operation,
performance-move-const-arg,
performance-move-constructor-init,
performance-no-automatic-move,
performance-noexcept-move-constructor,
performance-trivially-destructible,
performance-type-promotion-in-math-fn,
performance-unnecessary-copy-initialization,
performance-unnecessary-value-param,
portability-simd-intrinsics,
readability-avoid-const-params-in-decls,
readability-const-return-type,
readability-container-size-empty,
readability-convert-member-functions-to-static,
readability-delete-null-pointer,
readability-deleted-default,
readability-inconsistent-declaration-parameter-name,
readability-make-member-function-const,
readability-misleading-indentation,
readability-misplaced-array-index,
readability-non-const-parameter,
readability-redundant-control-flow,
readability-redundant-declaration,
readability-redundant-function-ptr-dereference,
readability-redundant-smartptr-get,
readability-redundant-string-cstr,
readability-redundant-string-init,
readability-simplify-subscript-expr,
readability-static-accessed-through-instance,
readability-static-definition-in-anonymous-namespace,
readability-string-compare,
readability-uniqueptr-delete-release,
readability-use-anyofallof'
78 changes: 78 additions & 0 deletions .github/workflows/kmod-pagefault-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Pagefault Kernel Module Tests

on:
pull_request:
paths:
- "kmod/pagefault/**"

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.22"
check-latest: true
cache: false

- name: Build Module
working-directory: kmod/pagefault
run: make module
shell: bash

- name: Generate Test Data
working-directory: kmod/pagefault
run: make tests-generate
shell: bash

- name: Set 'vm.max_map_count' parameter
run: sudo sysctl -w vm.max_map_count=262144
shell: bash

- name: Load Module
working-directory: kmod/pagefault
run: sudo make load
shell: bash

- name: Run Kernel Module Test
working-directory: kmod/pagefault
run: make tests
shell: bash

- name: Unload Module
working-directory: kmod/pagefault
run: sudo make unload
shell: bash

- name: Build Module with Benchmarking
working-directory: kmod/pagefault
run: BENCHMARK=true make module
shell: bash

- name: Load Module
working-directory: kmod/pagefault
run: sudo make load
shell: bash

- name: Run Kernel Module Test (With Benchmarking)
working-directory: kmod/pagefault
run: make tests
shell: bash

- name: Print last 30 dmesg logs
run: sudo dmesg | tail -n 30 | grep silo_pagefault
shell: bash

- name: Unload Module
working-directory: kmod/pagefault
run: sudo make unload
shell: bash

- name: Cleanup Module
working-directory: kmod/pagefault
run: make clean
shell: bash
2 changes: 2 additions & 0 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
- James Moore <[email protected]> @jimmyaxod
- Shivansh Vij <[email protected]> @shivanshvij
- Luiz Aoqui <[email protected]> @lgfa29
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<img alt="Logo" src="./docs/logo-light.svg">
</picture>

[![License: AGPL 3.0](https://img.shields.io/github/license/loopholelabs/silo)](<[https://www.apache.org/licenses/LICENSE-2.0](https://www.gnu.org/licenses/agpl-3.0.en.html)>)
[![License: AGPL 3.0](https://img.shields.io/github/license/loopholelabs/silo)](https://www.gnu.org/licenses/agpl-3.0.en.html)
[![Discord](https://dcbadge.vercel.app/api/server/JYmFhtdPeu?style=flat)](https://loopholelabs.io/discord)
![Go Version](https://img.shields.io/badge/go%20version-%3E=1.21-61CFDD.svg)
[![Go Reference](https://pkg.go.dev/badge/github.com/loopholelabs/silo.svg)](https://pkg.go.dev/github.com/loopholelabs/silo)
Expand Down
1 change: 1 addition & 0 deletions docs/kmod-logo-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/kmod-logo-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions kmod/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<br />
<div align="center">
<div align="center">
<a href="https://loopholelabs.io">
<img src="https://cdn.loopholelabs.io/loopholelabs/LoopholeLabsLogo.svg" alt="Logo" height="30">
</a></div>
<br />
<div>
<picture>
<source media="(prefers-color-scheme: dark)" srcset="../docs/kmod-logo-dark.svg">
<img alt="Logo" src="../docs/kmod-logo-light.svg">
</picture>
</div>
<br />

[![License: AGPL 3.0](https://img.shields.io/github/license/loopholelabs/silo)](https://www.gnu.org/licenses/agpl-3.0.en.html)
[![Discord](https://dcbadge.vercel.app/api/server/JYmFhtdPeu?style=flat)](https://loopholelabs.io/discord)
</div>

## Overview

This repository contains various kernel modules for use with Silo.

### Pagefault

The `pagefault` module allows a userspace process to efficiently multiple segments of memory over a base memory space.

## License

All Kernel Modules are available as open source under the terms of
the [GPL v3 License](https://www.gnu.org/licenses/gpl-3.0.en.html).

15 changes: 15 additions & 0 deletions kmod/pagefault/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.idea
.ccls-cache
*.ko
*.cmd
*.symvers
*.order
*.o
*.out
*.o.*
*.mod
*.mod.*
.run
*.img
*.bin
.fuse_hidden*
Loading

0 comments on commit b54dc46

Please sign in to comment.