[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAGXu5jJgoWk89Oh_RjQN7Kn7AZJt_g37O+X_K=7V+asW=8wsUg@mail.gmail.com>
Date: Mon, 10 Mar 2014 13:45:37 -0700
From: Kees Cook <keescook@...omium.org>
To: Josh Triplett <josh@...htriplett.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
"H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...hat.com>,
Jan Beulich <JBeulich@...e.com>,
Kyungsik Lee <kyungsik.lee@....com>,
Thomas Gleixner <tglx@...utronix.de>,
Wei Yongjun <yongjun_wei@...ndmicro.com.cn>,
LKML <linux-kernel@...r.kernel.org>,
"x86@...nel.org" <x86@...nel.org>
Subject: Re: [PATCH 2/3] x86, boot: Don't compile aslr.c when !CONFIG_RANDOMIZE_BASE
On Mon, Mar 10, 2014 at 1:32 PM, Josh Triplett <josh@...htriplett.org> wrote:
> All the code in aslr.c gets compiled out if !CONFIG_RANDOMIZE_BASE, but
> aslr.o itself still gets compiled in. Eliminate it from the compile
> entirely in that case.
>
> This does not change the generated code at all, in either case.
>
> Signed-off-by: Josh Triplett <josh@...htriplett.org>
Good clean-up! This makes things quite a bit more readable. Thanks!
Acked-by: Kees Cook <keescook@...omium.org>
-Kees
> ---
> arch/x86/boot/compressed/Makefile | 4 +++-
> arch/x86/boot/compressed/aslr.c | 3 ---
> 2 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
> index 7c50279..42e738d 100644
> --- a/arch/x86/boot/compressed/Makefile
> +++ b/arch/x86/boot/compressed/Makefile
> @@ -28,7 +28,9 @@ HOST_EXTRACFLAGS += -I$(srctree)/tools/include
>
> vmlinux-objs-y := $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o \
> $(obj)/string.o $(obj)/cmdline.o $(obj)/early_serial_console.o \
> - $(obj)/piggy.o $(obj)/cpuflags.o $(obj)/aslr.o
> + $(obj)/piggy.o $(obj)/cpuflags.o
> +
> +vmlinux-objs-$(CONFIG_RANDOMIZE_BASE) += $(obj)/aslr.o
>
> $(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone
>
> diff --git a/arch/x86/boot/compressed/aslr.c b/arch/x86/boot/compressed/aslr.c
> index 4dbf967..d0f8923 100644
> --- a/arch/x86/boot/compressed/aslr.c
> +++ b/arch/x86/boot/compressed/aslr.c
> @@ -1,6 +1,5 @@
> #include "misc.h"
>
> -#ifdef CONFIG_RANDOMIZE_BASE
> #include <asm/msr.h>
> #include <asm/archrandom.h>
> #include <asm/e820.h>
> @@ -313,5 +312,3 @@ unsigned char *choose_kernel_location(unsigned char *input,
> out:
> return (unsigned char *)choice;
> }
> -
> -#endif /* CONFIG_RANDOMIZE_BASE */
> --
> 1.9.0
>
--
Kees Cook
Chrome OS Security
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists