grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] use stock embedded timestamp 2015-01-01T0000+0000


From: Vladimir 'φ-coder/phcoder' Serbinenko
Subject: Re: [PATCH] use stock embedded timestamp 2015-01-01T0000+0000
Date: Fri, 27 Mar 2015 13:27:42 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.4.0

On 22.03.2015 20:33, Daniel Kahn Gillmor wrote:
Variant timestamps make some grub platforms produce non-deterministic
core images.  This makes it difficult to use simple tools to audit the
stability of a system with grub installed.

This patch selects a single timestamp to use for these embedded
timestamps so that the core images will be replicable.
---
  util/mkimage.c | 9 ++++++---
  1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/util/mkimage.c b/util/mkimage.c
index 7821dc5..adc1706 100644
--- a/util/mkimage.c
+++ b/util/mkimage.c
@@ -55,6 +55,9 @@

  #define TARGET_NO_FIELD 0xffffffff

+/* use 2015-01-01T00:00:00+0000 as a stock timestamp */
+#define STABLE_EMBEDDING_TIMESTAMP 1420070400
+
  struct grub_install_image_target_desc
  {
    const char *dirname;
@@ -1439,7 +1442,7 @@ grub_install_generate_image (const char *dir, const char 
*prefix,
        c->machine = grub_host_to_target16 (image_target->pe_target);

        c->num_sections = grub_host_to_target16 (4);
-       c->time = grub_host_to_target32 (time (0));
+       c->time = grub_host_to_target32 (STABLE_EMBEDDING_TIMESTAMP);
        c->characteristics = grub_host_to_target16 (GRUB_PE32_EXECUTABLE_IMAGE
                                                    | 
GRUB_PE32_LINE_NUMS_STRIPPED
                                                    | 
((image_target->voidp_sizeof == 4)
@@ -1782,7 +1785,7 @@ grub_install_generate_image (const char *dir, const char 
*prefix,

        memset (hdr, 0, sizeof (*hdr));
        hdr->ih_magic = grub_cpu_to_be32_compile_time (GRUB_UBOOT_IH_MAGIC);
-      hdr->ih_time = grub_cpu_to_be32 (time (0));
+      hdr->ih_time = grub_cpu_to_be32 (STABLE_EMBEDDING_TIMESTAMP);
        hdr->ih_size = grub_cpu_to_be32 (core_size);
        hdr->ih_load = grub_cpu_to_be32 (image_target->link_addr);
        hdr->ih_ep = grub_cpu_to_be32 (image_target->link_addr);
@@ -1856,7 +1859,7 @@ grub_install_generate_image (const char *dir, const char 
*prefix,
        head->magic = image_target->bigendian ? grub_host_to_target16 (0x160)
          : grub_host_to_target16 (0x166);
        head->nsec = grub_host_to_target16 (1);
-       head->time = grub_host_to_target32 (0);
+       head->time = grub_host_to_target32 (STABLE_EMBEDDING_TIMESTAMP);
I dropped this hunk as it's just changing one const to another.
        head->opt = grub_host_to_target16 (0x38);
        head->flags = image_target->bigendian
          ? grub_host_to_target16 (0x207)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]