|
|
bf96fb |
From fea3f2ec1936cfb9ed0b3ee62d9d23698097b814 Mon Sep 17 00:00:00 2001
|
|
|
bf96fb |
From: Peter Jones <pjones@redhat.com>
|
|
|
bf96fb |
Date: Fri, 15 Mar 2019 09:52:02 -0400
|
|
|
bf96fb |
Subject: [PATCH] Once again, try even harder to get binaries without
|
|
|
bf96fb |
timestamps in them.
|
|
|
bf96fb |
MIME-Version: 1.0
|
|
|
bf96fb |
Content-Type: text/plain; charset=UTF-8
|
|
|
bf96fb |
Content-Transfer-Encoding: 8bit
|
|
|
bf96fb |
|
|
|
bf96fb |
$ objdump -x /builddir/build/BUILDROOT/shim-*/usr/share/shim/*/shimx64.efi | grep 'Time/Date'
|
|
|
bf96fb |
Time/Date Thu Jan 1 00:00:08 1970
|
|
|
bf96fb |
$ _
|
|
|
bf96fb |
|
|
|
bf96fb |
"What is despair? I have known it—hear my song. Despair is when you’re
|
|
|
bf96fb |
debugging a kernel driver and you look at a memory dump and you see that
|
|
|
bf96fb |
a pointer has a value of 7."
|
|
|
bf96fb |
- http://scholar.harvard.edu/files/mickens/files/thenightwatch.pdf
|
|
|
bf96fb |
|
|
|
bf96fb |
objcopy only knows about -D for some targets.
|
|
|
bf96fb |
ld only believes in --no-insert-timestamp in some versions.
|
|
|
bf96fb |
dd takes off and nukes the site from orbit.
|
|
|
bf96fb |
|
|
|
bf96fb |
It's the only way to be sure.
|
|
|
bf96fb |
|
|
|
bf96fb |
Signed-off-by: Peter Jones <pjones@redhat.com>
|
|
|
bf96fb |
---
|
|
|
bf96fb |
Make.defaults | 4 ++++
|
|
|
bf96fb |
Makefile | 6 ++++--
|
|
|
bf96fb |
2 files changed, 8 insertions(+), 2 deletions(-)
|
|
|
bf96fb |
|
|
|
bf96fb |
diff --git a/Make.defaults b/Make.defaults
|
|
|
bf96fb |
index e11ab5a7f2c..4c26c1adf1f 100644
|
|
|
bf96fb |
--- a/Make.defaults
|
|
|
bf96fb |
+++ b/Make.defaults
|
|
|
bf96fb |
@@ -72,6 +72,7 @@ ifeq ($(ARCH),x86_64)
|
|
|
bf96fb |
ARCH_SUFFIX ?= x64
|
|
|
bf96fb |
ARCH_SUFFIX_UPPER ?= X64
|
|
|
bf96fb |
ARCH_LDFLAGS ?=
|
|
|
bf96fb |
+ TIMESTAMP_LOCATION := 136
|
|
|
bf96fb |
endif
|
|
|
bf96fb |
ifeq ($(ARCH),ia32)
|
|
|
bf96fb |
CFLAGS += -mno-mmx -mno-sse -mno-red-zone -nostdinc \
|
|
|
bf96fb |
@@ -81,6 +82,7 @@ ifeq ($(ARCH),ia32)
|
|
|
bf96fb |
ARCH_SUFFIX ?= ia32
|
|
|
bf96fb |
ARCH_SUFFIX_UPPER ?= IA32
|
|
|
bf96fb |
ARCH_LDFLAGS ?=
|
|
|
bf96fb |
+ TIMESTAMP_LOCATION := 136
|
|
|
bf96fb |
endif
|
|
|
bf96fb |
ifeq ($(ARCH),aarch64)
|
|
|
bf96fb |
CFLAGS += -DMDE_CPU_AARCH64 -DPAGE_SIZE=4096 -mstrict-align
|
|
|
bf96fb |
@@ -90,6 +92,7 @@ ifeq ($(ARCH),aarch64)
|
|
|
bf96fb |
FORMAT := -O binary
|
|
|
bf96fb |
SUBSYSTEM := 0xa
|
|
|
bf96fb |
ARCH_LDFLAGS += --defsym=EFI_SUBSYSTEM=$(SUBSYSTEM)
|
|
|
bf96fb |
+ TIMESTAMP_LOCATION := 72
|
|
|
bf96fb |
endif
|
|
|
bf96fb |
ifeq ($(ARCH),arm)
|
|
|
bf96fb |
CFLAGS += -DMDE_CPU_ARM -DPAGE_SIZE=4096 -mstrict-align
|
|
|
bf96fb |
@@ -99,6 +102,7 @@ ifeq ($(ARCH),arm)
|
|
|
bf96fb |
FORMAT := -O binary
|
|
|
bf96fb |
SUBSYSTEM := 0xa
|
|
|
bf96fb |
ARCH_LDFLAGS += --defsym=EFI_SUBSYSTEM=$(SUBSYSTEM)
|
|
|
bf96fb |
+ TIMESTAMP_LOCATION := 72
|
|
|
bf96fb |
endif
|
|
|
bf96fb |
|
|
|
bf96fb |
FORMAT ?= --target efi-app-$(ARCH)
|
|
|
bf96fb |
diff --git a/Makefile b/Makefile
|
|
|
bf96fb |
index 115e7f08c0f..a012c9f0d16 100644
|
|
|
bf96fb |
--- a/Makefile
|
|
|
bf96fb |
+++ b/Makefile
|
|
|
bf96fb |
@@ -189,11 +189,13 @@ endif
|
|
|
bf96fb |
ifneq ($(OBJCOPY_GTE224),1)
|
|
|
bf96fb |
$(error objcopy >= 2.24 is required)
|
|
|
bf96fb |
endif
|
|
|
bf96fb |
- $(OBJCOPY) -j .text -j .sdata -j .data -j .data.ident \
|
|
|
bf96fb |
+ $(OBJCOPY) -D -j .text -j .sdata -j .data -j .data.ident \
|
|
|
bf96fb |
-j .dynamic -j .dynsym -j .rel* \
|
|
|
bf96fb |
-j .rela* -j .reloc -j .eh_frame \
|
|
|
bf96fb |
-j .vendor_cert \
|
|
|
bf96fb |
$(FORMAT) $^ $@
|
|
|
bf96fb |
+ # I am tired of wasting my time fighting binutils timestamp code.
|
|
|
bf96fb |
+ dd conv=notrunc bs=1 count=4 seek=$(TIMESTAMP_LOCATION) if=/dev/zero of=$@
|
|
|
bf96fb |
|
|
|
bf96fb |
ifneq ($(origin ENABLE_SHIM_HASH),undefined)
|
|
|
bf96fb |
%.hash : %.efi
|
|
|
bf96fb |
@@ -204,7 +206,7 @@ endif
|
|
|
bf96fb |
ifneq ($(OBJCOPY_GTE224),1)
|
|
|
bf96fb |
$(error objcopy >= 2.24 is required)
|
|
|
bf96fb |
endif
|
|
|
bf96fb |
- $(OBJCOPY) -j .text -j .sdata -j .data \
|
|
|
bf96fb |
+ $(OBJCOPY) -D -j .text -j .sdata -j .data \
|
|
|
bf96fb |
-j .dynamic -j .dynsym -j .rel* \
|
|
|
bf96fb |
-j .rela* -j .reloc -j .eh_frame \
|
|
|
bf96fb |
-j .debug_info -j .debug_abbrev -j .debug_aranges \
|
|
|
bf96fb |
--
|
|
|
bf96fb |
2.20.1
|
|
|
bf96fb |
|