public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Kees Cook <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org,
	keescook@chromium.org, tglx@linutronix.de, hpa@linux.intel.com
Subject: [tip:x86/kaslr] x86, relocs: Build separate 32/64-bit tools
Date: Tue, 16 Apr 2013 16:20:48 -0700	[thread overview]
Message-ID: <tip-17c961f7702ff6037b66bb2e5f3ddd58de4ce7e5@git.kernel.org> (raw)
In-Reply-To: <1365797627-20874-5-git-send-email-keescook@chromium.org>

Commit-ID:  17c961f7702ff6037b66bb2e5f3ddd58de4ce7e5
Gitweb:     http://git.kernel.org/tip/17c961f7702ff6037b66bb2e5f3ddd58de4ce7e5
Author:     Kees Cook <keescook@chromium.org>
AuthorDate: Fri, 12 Apr 2013 13:13:45 -0700
Committer:  H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Tue, 16 Apr 2013 15:22:01 -0700

x86, relocs: Build separate 32/64-bit tools

Since the ELF structures and access macros change size based on 32 vs
64 bits, build a separate 32-bit relocs tool (for handling realmode
and 32-bit relocations), and a 64-bit relocs tool (for handling 64-bit
kernel relocations).

Signed-off-by: Kees Cook <keescook@chromium.org>
Link: http://lkml.kernel.org/r/1365797627-20874-5-git-send-email-keescook@chromium.org
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
---
 arch/x86/boot/compressed/Makefile |  2 +-
 arch/x86/realmode/rm/Makefile     |  2 +-
 arch/x86/tools/.gitignore         |  3 ++-
 arch/x86/tools/Makefile           | 20 ++++++++++++++++++--
 4 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index 5ef205c..0dac175 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -44,7 +44,7 @@ $(obj)/vmlinux.bin: vmlinux FORCE
 
 targets += $(patsubst $(obj)/%,%,$(VMLINUX_OBJS)) vmlinux.bin.all vmlinux.relocs
 
-CMD_RELOCS = arch/x86/tools/relocs
+CMD_RELOCS = arch/x86/tools/relocs_$(BITS)
 quiet_cmd_relocs = RELOCS  $@
       cmd_relocs = $(CMD_RELOCS) $< > $@;$(CMD_RELOCS) --abs-relocs $<
 $(obj)/vmlinux.relocs: vmlinux FORCE
diff --git a/arch/x86/realmode/rm/Makefile b/arch/x86/realmode/rm/Makefile
index 8869287..2b1e429 100644
--- a/arch/x86/realmode/rm/Makefile
+++ b/arch/x86/realmode/rm/Makefile
@@ -56,7 +56,7 @@ $(obj)/realmode.bin: $(obj)/realmode.elf $(obj)/realmode.relocs
 	$(call if_changed,objcopy)
 
 quiet_cmd_relocs = RELOCS  $@
-      cmd_relocs = arch/x86/tools/relocs --realmode $< > $@
+      cmd_relocs = arch/x86/tools/relocs_32 --realmode $< > $@
 
 targets += realmode.relocs
 $(obj)/realmode.relocs: $(obj)/realmode.elf FORCE
diff --git a/arch/x86/tools/.gitignore b/arch/x86/tools/.gitignore
index be0ed06..2b45d5f 100644
--- a/arch/x86/tools/.gitignore
+++ b/arch/x86/tools/.gitignore
@@ -1 +1,2 @@
-relocs
+relocs_32*
+relocs_64*
diff --git a/arch/x86/tools/Makefile b/arch/x86/tools/Makefile
index bae601f..a8cb70c 100644
--- a/arch/x86/tools/Makefile
+++ b/arch/x86/tools/Makefile
@@ -37,6 +37,22 @@ $(obj)/test_get_len.o: $(srctree)/arch/x86/lib/insn.c $(srctree)/arch/x86/lib/in
 
 $(obj)/insn_sanity.o: $(srctree)/arch/x86/lib/insn.c $(srctree)/arch/x86/lib/inat.c $(srctree)/arch/x86/include/asm/inat_types.h $(srctree)/arch/x86/include/asm/inat.h $(srctree)/arch/x86/include/asm/insn.h $(objtree)/arch/x86/lib/inat-tables.c
 
+HOSTCFLAGS_relocs_32.o += -DELF_BITS=32
+HOSTCFLAGS_relocs_64.o += -DELF_BITS=64
+
+quiet_cmd_cp_reloc = GEN     $@
+      cmd_cp_reloc = cp $< $@
+
+$(obj)/relocs_%.c: $(srctree)/arch/x86/tools/relocs.c
+	$(call cmd,cp_reloc)
+
 HOST_EXTRACFLAGS += -I$(srctree)/tools/include
-hostprogs-y	+= relocs
-relocs: $(obj)/relocs
+hostprogs-y    += relocs_$(BITS)
+relocs_binaries = relocs_$(BITS)
+ifeq ($(CONFIG_64BIT),y)
+	hostprogs-y  += relocs_32
+	relocs_binaries += relocs_32
+endif
+relocs: $(relocs_binaries)
+relocs_32: $(obj)/relocs_32
+relocs_64: $(obj)/relocs_64

  parent reply	other threads:[~2013-04-16 23:21 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-12 20:13 [PATCH v2 0/6] kernel ASLR Kees Cook
2013-04-12 20:13 ` [PATCH 1/6] x86: relocs: generalize Elf structure names Kees Cook
2013-04-16 23:17   ` [tip:x86/kaslr] x86, relocs: Generalize ELF " tip-bot for Kees Cook
2013-04-12 20:13 ` [PATCH 2/6] x86: relocs: consolidate processing logic Kees Cook
2013-04-16 23:18   ` [tip:x86/kaslr] x86, relocs: Consolidate " tip-bot for Kees Cook
2013-04-12 20:13 ` [PATCH 3/6] x86: relocs: add 64-bit ELF support to relocs tool Kees Cook
2013-04-16 23:19   ` [tip:x86/kaslr] x86, relocs: Add " tip-bot for Kees Cook
2013-04-12 20:13 ` [PATCH 4/6] x86: relocs: build separate 32/64-bit tools Kees Cook
2013-04-16 22:21   ` H. Peter Anvin
2013-04-16 22:38     ` Kees Cook
2013-04-16 22:39       ` H. Peter Anvin
2013-04-16 23:20   ` tip-bot for Kees Cook [this message]
2013-04-16 23:22   ` [tip:x86/kaslr] x86, relocs: Refactor the relocs tool to merge 32- and 64-bit ELF tip-bot for H. Peter Anvin
2013-04-12 20:13 ` [PATCH 5/6] x86: kaslr: routines to choose random base offset Kees Cook
2013-04-14  0:11   ` Yinghai Lu
2013-04-12 20:13 ` [PATCH 6/6] x86: kaslr: relocate base offset at boot Kees Cook
2013-04-14  0:37   ` Yinghai Lu
2013-04-14  3:06     ` H. Peter Anvin
2013-04-15 21:06       ` Eric Northup
2013-04-15 21:25         ` H. Peter Anvin
2013-04-15 21:41           ` Kees Cook
2013-04-15 21:44             ` Eric Northup
2013-04-15 21:46             ` H. Peter Anvin
2013-04-15 21:59               ` Kees Cook
2013-04-16  2:31                 ` H. Peter Anvin
2013-04-16  2:40                   ` H. Peter Anvin
2013-04-16 16:08                     ` Kees Cook
2013-04-15 22:00               ` Yinghai Lu
2013-04-15 22:07                 ` Kees Cook
2013-04-15 22:38                   ` Yinghai Lu
2013-04-15 22:42                     ` Kees Cook
2013-04-15 22:57                       ` Yinghai Lu
2013-04-16  2:34                     ` H. Peter Anvin
2013-04-16  2:36                 ` H. Peter Anvin
2013-04-16  2:56                   ` Yinghai Lu
2013-04-16  3:02                     ` H. Peter Anvin
2013-04-16 13:08                       ` Ingo Molnar
2013-04-16 13:27                         ` H. Peter Anvin
2013-04-16 18:08 ` [PATCH v2 0/6] kernel ASLR Kees Cook
2013-04-16 18:15   ` H. Peter Anvin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-17c961f7702ff6037b66bb2e5f3ddd58de4ce7e5@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=hpa@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox