dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

Blame SOURCES/0131-Measure-the-kernel-commandline.patch

8631a2
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
8631a2
From: Matthew Garrett <mjg59@coreos.com>
8631a2
Date: Sun, 9 Aug 2015 16:32:29 -0700
8631a2
Subject: [PATCH] Measure the kernel commandline
8631a2
8631a2
Measure the kernel commandline to ensure that it hasn't been modified
8631a2
---
8631a2
 grub-core/lib/cmdline.c | 6 +++++-
8631a2
 1 file changed, 5 insertions(+), 1 deletion(-)
8631a2
8631a2
diff --git a/grub-core/lib/cmdline.c b/grub-core/lib/cmdline.c
8631a2
index 970ea868c14..6b56304d4a7 100644
8631a2
--- a/grub-core/lib/cmdline.c
8631a2
+++ b/grub-core/lib/cmdline.c
8631a2
@@ -19,6 +19,7 @@
8631a2
 
8631a2
 #include <grub/lib/cmdline.h>
8631a2
 #include <grub/misc.h>
8631a2
+#include <grub/tpm.h>
8631a2
 
8631a2
 static int
8631a2
 is_hex(char c)
8631a2
@@ -79,7 +80,7 @@ int grub_create_loader_cmdline (int argc, char *argv[], char *buf,
8631a2
 {
8631a2
   int i, space;
8631a2
   unsigned int arg_size;
8631a2
-  char *c;
8631a2
+  char *c, *orig = buf;
8631a2
 
8631a2
   for (i = 0; i < argc; i++)
8631a2
     {
8631a2
@@ -125,5 +126,8 @@ int grub_create_loader_cmdline (int argc, char *argv[], char *buf,
8631a2
 
8631a2
   *buf = 0;
8631a2
 
8631a2
+  grub_tpm_measure ((void *)orig, grub_strlen (orig), GRUB_CMDLINE_PCR,
8631a2
+		    "Kernel Commandline");
8631a2
+
8631a2
   return i;
8631a2
 }