Skip to content

Commit 6ec624b

Browse files
committed
init: do not attest when using TDX flavor
Do not attest with the libkrun-tdx flavor. Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
1 parent ebc24f7 commit 6ec624b

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

init/init.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,28 @@ int main(int argc, char **argv)
990990
char *rlimits;
991991
char **config_argv, **exec_argv;
992992

993+
#ifdef TDX
994+
if (mkdir("/tmp", 0755) < 0 && errno != EEXIST) {
995+
perror("mkdir(/tmp)");
996+
exit(-1);
997+
}
998+
if (mkdir("/tmp/vda", 0755) < 0 && errno != EEXIST) {
999+
perror("mkdir(/tmp/vda)");
1000+
exit(-1);
1001+
}
1002+
if (mount("/dev/vda", "/tmp/vda", "ext4", MS_RELATIME, NULL) < 0) {
1003+
perror("mount(/dev/vda)");
1004+
exit(-1);
1005+
}
1006+
chdir("/tmp/vda");
1007+
if (mount(".", "/", NULL, MS_MOVE, NULL) < 0) {
1008+
perror("remount root");
1009+
exit(-1);
1010+
}
1011+
chroot(".");
1012+
1013+
#endif
1014+
9931015
#ifdef SEV
9941016
if (chroot_luks() < 0) {
9951017
printf("Couldn't switch to LUKS volume, bailing out\n");

0 commit comments

Comments
 (0)