Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chenhengqi/put-cpptools-in-prison
solution for the cpptools victim
https://github.com/chenhengqi/put-cpptools-in-prison
cpp vscode vscode-extension
Last synced: 23 days ago
JSON representation
solution for the cpptools victim
- Host: GitHub
- URL: https://github.com/chenhengqi/put-cpptools-in-prison
- Owner: chenhengqi
- License: unlicense
- Created: 2021-04-02T01:14:13.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-04-02T05:23:09.000Z (over 3 years ago)
- Last Synced: 2023-08-07T09:07:40.593Z (about 1 year ago)
- Topics: cpp, vscode, vscode-extension
- Homepage:
- Size: 1000 Bytes
- Stars: 17
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Put cpptools in prison
## create CPU and Memory cgroups
```
$ sudo mkdir -p /sys/fs/cgroup/cpu/prison
$ sudo mkdir -p /sys/fs/cgroup/memory/prison
```## set CPU and Memory limits
```
$ sudo sh -c 'echo 10000 > /sys/fs/cgroup/cpu/prison/cpu.cfs_period_us'
$ sudo sh -c 'echo 1000 > /sys/fs/cgroup/cpu/prison/cpu.cfs_quota_us'
$ sudo sh -c 'echo 131072 > /sys/fs/cgroup/memory/prison/memory.limit_in_bytes'
```## put cpptools in prison
```shell
#!/bin/bash
for pid in `pgrep cpptools`
do
sudo sh -c "echo $pid > /sys/fs/cgroup/cpu/prison/cgroup.procs"
sudo sh -c "echo $pid > /sys/fs/cgroup/memory/prison/cgroup.procs"
done
```