-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Wojciech Ozga <woz@zurich.ibm.com>
- Loading branch information
1 parent
e5d61f8
commit d7e1f5d
Showing
25 changed files
with
283 additions
and
231 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
27 changes: 27 additions & 0 deletions
27
confidential-vms/linux_vm/overlay/root/ace_module/Makefile
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
CONFIG_MODULE_SIG=n | ||
|
||
startstop-objs := start.o stop.o | ||
obj-m += ace.o | ||
|
||
ifeq ($(CONFIG_STATUS_CHECK_GCC),y) | ||
CC=$(STATUS_CHECK_GCC) | ||
ccflags-y += -fanalyzer | ||
endif | ||
|
||
KDIR ?= /lib/modules/$(shell uname -r)/build | ||
PWD := $(CURDIR) | ||
|
||
default: | ||
$(MAKE) -C $(KDIR) CC="$(CC)" M="$(PWD)" modules | ||
rm -f .Module* .modules* .ace* *.symvers *.order ace.mod.* *.o *.mod | ||
|
||
load: | ||
@insmod ace.ko | ||
|
||
clean: | ||
$(MAKE) -C /lib/modules/$(shell uname -r)/build CC="$(CC)" M="$(PWD)" clean | ||
$(RM) other/cat_noblock *.plist | ||
|
||
indent: | ||
clang-format -i *[.ch] | ||
clang-format -i other/*[.ch] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#include<linux/init.h> | ||
#include<linux/module.h> | ||
#include <asm/sbi.h> | ||
#include <linux/io.h> | ||
#include <linux/kernel.h> | ||
#include <linux/debugfs.h> | ||
#include <linux/delay.h> /* usleep_range */ | ||
#include <linux/kthread.h> | ||
#include <linux/seq_file.h> /* single_open, single_release */ | ||
#include <linux/slab.h> /* kmalloc, kfree */ | ||
|
||
MODULE_LICENSE("GPL"); | ||
MODULE_AUTHOR("Wojciech Ozga <woz@zurich.ibm.com>"); | ||
|
||
static int ace_init(void){ | ||
volatile u8 *secret; | ||
struct sbiret ret; | ||
int i; | ||
|
||
printk(KERN_ALERT "Requesting secret from the security monitor\n"); | ||
secret = kmalloc(1024*sizeof(u8), GFP_KERNEL); | ||
ret = sbi_ecall(0x434F5647, 9, virt_to_phys((void *) secret), 1024, 0, 0, 0, 0); | ||
if (!ret.error) { | ||
printk(KERN_ALERT "Secret=0x"); | ||
for (i=0; i<ret.value; i++) { | ||
printk(KERN_CONT "%02x", secret[i]); | ||
} | ||
printk(KERN_CONT "\n"); | ||
} else { | ||
printk(KERN_ALERT "Error: %lx %lx", ret.error, ret.value); | ||
} | ||
return 0; | ||
} | ||
|
||
static void ace_exit(void){ | ||
} | ||
|
||
module_init(ace_init); | ||
module_exit(ace_exit); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hello from confidential VM's filesystem |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hello from confidential VM's filesystem |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.