- Confidentiality
- Resources should be protected from unauthorized access
- Prioritized by governments
- Concepts
- Sensitivity
- How harmful is disclosure
- Sensitivity
- Discretion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 下面是一个基于进程名和文件名实现特定进程可以访问特定文件的LSM示例代码 | |
| #include <linux/lsm_hooks.h> | |
| #include <linux/path.h> | |
| #include <linux/dcache.h> | |
| #include <linux/namei.h> | |
| // 定义允许访问文件的进程名称 | |
| static char *allowed_process_name = "my_app"; | |
| // 定义需要保护的文件路径 | |
| static char *file_path = "path/to/protected/file"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static unsigned long vaddr2paddr(unsigned long vaddr) | |
| { | |
| pgd_t *pgd; | |
| pud_t *pud; | |
| pmd_t *pmd; | |
| pte_t *pte; | |
| unsigned long paddr = 0; | |
| unsigned long page_addr = 0; | |
| unsigned long page_offset = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| int main(int argc, char *argv[]) | |
| { | |
| union w { | |
| int a; | |
| char b; | |
| } c; | |
| c.a = 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <immintrin.h> | |
| int main() { | |
| unsigned int balance = 100; | |
| unsigned int withdrawal = 50; | |
| // 开始事务 | |
| if (_xbegin() == _XBEGIN_STARTED) { | |
| // 在事务中执行操作 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* --- Usage --- */ | |
| g++ server.c -o server | |
| g++ client.c -o client | |
| ./server | |
| ./client 127.0.0.1 | |
| /* --- server.c --- */ | |
| #include <sys/socket.h> | |
| #include <netinet/in.h> | |
| #include <arpa/inet.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <atomic> | |
| #include <chrono> | |
| #include <immintrin.h> | |
| #include <iostream> | |
| #include <thread> | |
| struct Node { | |
| Node * prev{}; | |
| Node * next{}; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <cpuid.h> | |
| #include <stdint.h> | |
| int cpu_supports_cet_shadow_stack() { | |
| uint32_t eax = 0, ebx = 0, ecx = 0, edx = 0; | |
| __cpuid_count(7, 0, eax, ebx, ecx, edx); | |
| return (ecx & (1 << 7)) != 0; | |
| } |
NewerOlder