Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hypervisor rootkit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
flg_bachelors
TS
2024
hypervisor rootkit
Commits
2978e6b7
Commit
2978e6b7
authored
5 months ago
by
iliya.saroukha
Browse files
Options
Downloads
Patches
Plain Diff
debug: trying to print out the CPL value, probably doesn't work though
parent
58e0e324
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
proto/hypervisor.c
+17
-0
17 additions, 0 deletions
proto/hypervisor.c
with
17 additions
and
0 deletions
proto/hypervisor.c
+
17
−
0
View file @
2978e6b7
...
...
@@ -79,6 +79,20 @@ static unsigned char vmxon(unsigned long long pa) {
}
static
int
my_init
(
void
)
{
/*
* https://www.sciencedirect.com/topics/computer-science/current-privilege-level
*/
DEBUG_FMT
(
"Querying CS (lowest 2 bits) for CPL
\n
"
);
unsigned
long
cs
,
cpl
;
__asm__
volatile
(
"mov %%cs, %0"
:
"=r"
(
cs
));
cpl
=
cs
&
0x3
;
DEBUG_FMT
(
"CPL level = %lu
\n
"
,
cpl
);
if
(
cpl
>
0
)
{
return
-
1
;
}
pr_info
(
"Checking VMX support using CPUID
\n
"
);
if
(
!
vmx_support_cpuid
())
{
pr_err
(
"VMX isn't supported
\n
"
);
...
...
@@ -119,6 +133,9 @@ static int my_init(void) {
unsigned
char
vmxon_ret
=
0
;
if
((
vmxon_ret
=
vmxon
(
vmxon_region
.
pa
)
!=
0
))
{
/*unsigned long vm_err = __rdmsr(0x4400);*/
/*pr_err("VM_ERR val = 0x%lx\n", vm_err);*/
kfree
(
vmxon_region
.
va
);
__asm__
volatile
(
"vmxoff"
);
pr_err
(
"`vmxon` failed with return code %d
\n
"
,
vmxon_ret
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment