* Re: [PATCH v8 00/21] Compile-time stack validation
@ 2015-08-11 21:31 Chris J Arges
2015-08-12 4:43 ` Josh Poimboeuf
0 siblings, 1 reply; 12+ messages in thread
From: Chris J Arges @ 2015-08-11 21:31 UTC (permalink / raw)
To: Josh Poimboeuf
Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Michal Marek,
Peter Zijlstra, Andy Lutomirski, Borislav Petkov, Linus Torvalds,
Andi Kleen, Pedro Alves, Namhyung Kim, Bernd Petrovitsch, x86,
live-patching, linux-kernel
Josh,
I've applied and tried to build your patchset against the latest
mainline kernel with the following config:
http://paste.ubuntu.com/12058017/
I can build if I disable CONFIG_STACK_VALIDATION, then re-enable it
after all objects are already built, so this seems like it should be
resolvable in Makefiles. Any suggestions for debugging this?
Building from clean I get the following:
~/linux$ make
HOSTCC scripts/basic/fixdep
HOSTCC scripts/basic/bin2c
GEN arch/x86/lib/inat-tables.c
HOSTCC arch/x86/tools/relocs_32.o
HOSTCC arch/x86/tools/relocs_64.o
HOSTCC arch/x86/tools/relocs_common.o
HOSTLD arch/x86/tools/relocs
CHK include/config/kernel.release
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
CC arch/x86/purgatory/purgatory.o
AS arch/x86/purgatory/stack.o
AS arch/x86/purgatory/setup-x86_64.o
CC arch/x86/purgatory/sha256.o
AS arch/x86/purgatory/entry64.o
CC arch/x86/purgatory/string.o
LD arch/x86/purgatory/purgatory.ro
BIN2C arch/x86/purgatory/kexec-purgatory.c
CC kernel/bounds.s
CHK include/generated/bounds.h
CHK include/generated/timeconst.h
CC arch/x86/kernel/asm-offsets.s
CHK include/generated/asm-offsets.h
CALL scripts/checksyscalls.sh
HOSTCC scripts/genksyms/genksyms.o
HOSTCC scripts/genksyms/parse.tab.o
HOSTCC scripts/genksyms/lex.lex.o
HOSTLD scripts/genksyms/genksyms
CC scripts/mod/empty.o
scripts/mod/empty.o
open: No such file or directory
error reading elf file scripts/mod/empty.o
scripts/Makefile.build:284: recipe for target 'scripts/mod/empty.o' failed
make[2]: *** [scripts/mod/empty.o] Error 1
scripts/Makefile.build:429: recipe for target 'scripts/mod' failed
make[1]: *** [scripts/mod] Error 2
Makefile:545: recipe for target 'scripts' failed
make: *** [scripts] Error 2
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v8 00/21] Compile-time stack validation
2015-08-11 21:31 [PATCH v8 00/21] Compile-time stack validation Chris J Arges
@ 2015-08-12 4:43 ` Josh Poimboeuf
2015-08-12 21:24 ` Chris J Arges
0 siblings, 1 reply; 12+ messages in thread
From: Josh Poimboeuf @ 2015-08-12 4:43 UTC (permalink / raw)
To: Chris J Arges
Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Michal Marek,
Peter Zijlstra, Andy Lutomirski, Borislav Petkov, Linus Torvalds,
Andi Kleen, Pedro Alves, Namhyung Kim, Bernd Petrovitsch, x86,
live-patching, linux-kernel
On Tue, Aug 11, 2015 at 04:31:07PM -0500, Chris J Arges wrote:
> Josh,
>
> I've applied and tried to build your patchset against the latest
> mainline kernel with the following config:
> http://paste.ubuntu.com/12058017/
>
> I can build if I disable CONFIG_STACK_VALIDATION, then re-enable it
> after all objects are already built, so this seems like it should be
> resolvable in Makefiles. Any suggestions for debugging this?
>
> Building from clean I get the following:
> ~/linux$ make
> HOSTCC scripts/basic/fixdep
> HOSTCC scripts/basic/bin2c
> GEN arch/x86/lib/inat-tables.c
> HOSTCC arch/x86/tools/relocs_32.o
> HOSTCC arch/x86/tools/relocs_64.o
> HOSTCC arch/x86/tools/relocs_common.o
> HOSTLD arch/x86/tools/relocs
> CHK include/config/kernel.release
> CHK include/generated/uapi/linux/version.h
> CHK include/generated/utsrelease.h
> CC arch/x86/purgatory/purgatory.o
> AS arch/x86/purgatory/stack.o
> AS arch/x86/purgatory/setup-x86_64.o
> CC arch/x86/purgatory/sha256.o
> AS arch/x86/purgatory/entry64.o
> CC arch/x86/purgatory/string.o
> LD arch/x86/purgatory/purgatory.ro
> BIN2C arch/x86/purgatory/kexec-purgatory.c
> CC kernel/bounds.s
> CHK include/generated/bounds.h
> CHK include/generated/timeconst.h
> CC arch/x86/kernel/asm-offsets.s
> CHK include/generated/asm-offsets.h
> CALL scripts/checksyscalls.sh
> HOSTCC scripts/genksyms/genksyms.o
> HOSTCC scripts/genksyms/parse.tab.o
> HOSTCC scripts/genksyms/lex.lex.o
> HOSTLD scripts/genksyms/genksyms
> CC scripts/mod/empty.o
> scripts/mod/empty.o
> open: No such file or directory
> error reading elf file scripts/mod/empty.o
> scripts/Makefile.build:284: recipe for target 'scripts/mod/empty.o' failed
> make[2]: *** [scripts/mod/empty.o] Error 1
> scripts/Makefile.build:429: recipe for target 'scripts/mod' failed
> make[1]: *** [scripts/mod] Error 2
> Makefile:545: recipe for target 'scripts' failed
> make: *** [scripts] Error 2
Thanks for trying it out. I couldn't figure out how to recreate this
exact error, but I played around with "make mrproper" and saw some
probably related errors. Does this fix it?
---8<---
Subject: [PATCH] stackvalidate: fix circular build dependencies
After "make mrproper" with CONFIG_STACK_VALIDATION enabled, I get the
following errors:
make[2]: *** No rule to make target 'arch/x86/purgatory/purgatory.o', needed by 'arch/x86/purgatory/purgatory.ro'. Stop.
make[3]: *** No rule to make target 'scripts/mod/empty.o', needed by 'scripts/mod/elfconfig.h'. Stop.
These are caused by circular dependencies. The %.o pattern rules in
scripts/Makefile.build have the stackvalidate binary listed as a
dependency. But stackvalidate gets built *after* archprepare and
scripts/mod, both of which build objects using the %.o pattern rules.
The STACKVALIDATE and STACKVALIDATE_foo.o variables are already used to
determine whether to validate a given object. Also use them to
determine whether to create the pattern rule dependency.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
scripts/Makefile.build | 7 +++++--
scripts/mod/Makefile | 2 ++
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index a1270d3..ec96c51 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -243,7 +243,7 @@ endif
ifdef CONFIG_STACK_VALIDATION
-stackvalidate = $(objtree)/scripts/stackvalidate/stackvalidate
+__stackvalidate = $(objtree)/scripts/stackvalidate/stackvalidate
ifndef CONFIG_FRAME_POINTER
nofp = --no-frame-pointer
@@ -251,9 +251,12 @@ endif
# Set STACKVALIDATE_foo.o=n to skip stack validation for a file.
# Set STACKVALIDATE=n to skip stack validation for a directory.
+stackvalidate = $(if $(patsubst n%,, \
+ $(STACKVALIDATE_$(basetarget).o)$(STACKVALIDATE)y), \
+ $(__stackvalidate))
cmd_stackvalidate = $(if $(patsubst n%,, \
$(STACKVALIDATE_$(basetarget).o)$(STACKVALIDATE)y), \
- $(stackvalidate) $(nofp) "$(@)";)
+ $(__stackvalidate) $(nofp) "$(@)";)
endif # CONFIG_STACK_VALIDATION
diff --git a/scripts/mod/Makefile b/scripts/mod/Makefile
index c11212f..374c413 100644
--- a/scripts/mod/Makefile
+++ b/scripts/mod/Makefile
@@ -1,3 +1,5 @@
+STACKVALIDATE := n
+
hostprogs-y := modpost mk_elfconfig
always := $(hostprogs-y) empty.o
--
2.4.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v8 00/21] Compile-time stack validation
2015-08-12 4:43 ` Josh Poimboeuf
@ 2015-08-12 21:24 ` Chris J Arges
2015-08-13 2:07 ` Josh Poimboeuf
2015-08-13 11:22 ` Josh Poimboeuf
0 siblings, 2 replies; 12+ messages in thread
From: Chris J Arges @ 2015-08-12 21:24 UTC (permalink / raw)
To: Josh Poimboeuf
Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Michal Marek,
Peter Zijlstra, Andy Lutomirski, Borislav Petkov, Linus Torvalds,
Andi Kleen, Pedro Alves, Namhyung Kim, Bernd Petrovitsch, x86,
live-patching, linux-kernel
<snip>
>
> Thanks for trying it out. I couldn't figure out how to recreate this
> exact error, but I played around with "make mrproper" and saw some
> probably related errors. Does this fix it?
>
> ---8<---
>
> Subject: [PATCH] stackvalidate: fix circular build dependencies
>
> After "make mrproper" with CONFIG_STACK_VALIDATION enabled, I get the
> following errors:
>
> make[2]: *** No rule to make target 'arch/x86/purgatory/purgatory.o', needed by 'arch/x86/purgatory/purgatory.ro'. Stop.
> make[3]: *** No rule to make target 'scripts/mod/empty.o', needed by 'scripts/mod/elfconfig.h'. Stop.
>
> These are caused by circular dependencies. The %.o pattern rules in
> scripts/Makefile.build have the stackvalidate binary listed as a
> dependency. But stackvalidate gets built *after* archprepare and
> scripts/mod, both of which build objects using the %.o pattern rules.
>
> The STACKVALIDATE and STACKVALIDATE_foo.o variables are already used to
> determine whether to validate a given object. Also use them to
> determine whether to create the pattern rule dependency.
>
> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
> ---
> scripts/Makefile.build | 7 +++++--
> scripts/mod/Makefile | 2 ++
> 2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index a1270d3..ec96c51 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -243,7 +243,7 @@ endif
>
> ifdef CONFIG_STACK_VALIDATION
>
> -stackvalidate = $(objtree)/scripts/stackvalidate/stackvalidate
> +__stackvalidate = $(objtree)/scripts/stackvalidate/stackvalidate
>
> ifndef CONFIG_FRAME_POINTER
> nofp = --no-frame-pointer
> @@ -251,9 +251,12 @@ endif
>
> # Set STACKVALIDATE_foo.o=n to skip stack validation for a file.
> # Set STACKVALIDATE=n to skip stack validation for a directory.
> +stackvalidate = $(if $(patsubst n%,, \
> + $(STACKVALIDATE_$(basetarget).o)$(STACKVALIDATE)y), \
> + $(__stackvalidate))
> cmd_stackvalidate = $(if $(patsubst n%,, \
> $(STACKVALIDATE_$(basetarget).o)$(STACKVALIDATE)y), \
> - $(stackvalidate) $(nofp) "$(@)";)
> + $(__stackvalidate) $(nofp) "$(@)";)
>
> endif # CONFIG_STACK_VALIDATION
>
> diff --git a/scripts/mod/Makefile b/scripts/mod/Makefile
> index c11212f..374c413 100644
> --- a/scripts/mod/Makefile
> +++ b/scripts/mod/Makefile
> @@ -1,3 +1,5 @@
> +STACKVALIDATE := n
> +
> hostprogs-y := modpost mk_elfconfig
> always := $(hostprogs-y) empty.o
>
>
Josh,
I still get build failures and I've pared it down to x86_64 defconfig plus:
CONFIG_MODVERSIONS=y
CONFIG_STACK_VALIDATION=y
And it seems like some modules may get the .tmp_foo.o treatment while
others end up foo.o so something like the following will not work:
cmd_stackvalidate = $(if $(patsubst n%,, \
$(STACKVALIDATE_$(basetarget).o)$(STACKVALIDATE)y), \
$(__stackvalidate) $(nofp) "$(@D)/.tmp_$(@F)";)
In addition, I'm not sure if skipping modules like STACKVALIDATE_foo.o=n
will still function properly for modversioned modules.
I'll try to look at this more tomorrow,
--chris j arges
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v8 00/21] Compile-time stack validation
2015-08-12 21:24 ` Chris J Arges
@ 2015-08-13 2:07 ` Josh Poimboeuf
2015-08-13 11:22 ` Josh Poimboeuf
1 sibling, 0 replies; 12+ messages in thread
From: Josh Poimboeuf @ 2015-08-13 2:07 UTC (permalink / raw)
To: Chris J Arges
Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Michal Marek,
Peter Zijlstra, Andy Lutomirski, Borislav Petkov, Linus Torvalds,
Andi Kleen, Pedro Alves, Namhyung Kim, Bernd Petrovitsch, x86,
live-patching, linux-kernel
On Wed, Aug 12, 2015 at 04:24:49PM -0500, Chris J Arges wrote:
> <snip>
> >
> > Thanks for trying it out. I couldn't figure out how to recreate this
> > exact error, but I played around with "make mrproper" and saw some
> > probably related errors. Does this fix it?
> >
> > ---8<---
> >
> > Subject: [PATCH] stackvalidate: fix circular build dependencies
> >
> > After "make mrproper" with CONFIG_STACK_VALIDATION enabled, I get the
> > following errors:
> >
> > make[2]: *** No rule to make target 'arch/x86/purgatory/purgatory.o', needed by 'arch/x86/purgatory/purgatory.ro'. Stop.
> > make[3]: *** No rule to make target 'scripts/mod/empty.o', needed by 'scripts/mod/elfconfig.h'. Stop.
> >
> > These are caused by circular dependencies. The %.o pattern rules in
> > scripts/Makefile.build have the stackvalidate binary listed as a
> > dependency. But stackvalidate gets built *after* archprepare and
> > scripts/mod, both of which build objects using the %.o pattern rules.
> >
> > The STACKVALIDATE and STACKVALIDATE_foo.o variables are already used to
> > determine whether to validate a given object. Also use them to
> > determine whether to create the pattern rule dependency.
> >
> > Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
> > ---
> > scripts/Makefile.build | 7 +++++--
> > scripts/mod/Makefile | 2 ++
> > 2 files changed, 7 insertions(+), 2 deletions(-)
> >
> > diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> > index a1270d3..ec96c51 100644
> > --- a/scripts/Makefile.build
> > +++ b/scripts/Makefile.build
> > @@ -243,7 +243,7 @@ endif
> >
> > ifdef CONFIG_STACK_VALIDATION
> >
> > -stackvalidate = $(objtree)/scripts/stackvalidate/stackvalidate
> > +__stackvalidate = $(objtree)/scripts/stackvalidate/stackvalidate
> >
> > ifndef CONFIG_FRAME_POINTER
> > nofp = --no-frame-pointer
> > @@ -251,9 +251,12 @@ endif
> >
> > # Set STACKVALIDATE_foo.o=n to skip stack validation for a file.
> > # Set STACKVALIDATE=n to skip stack validation for a directory.
> > +stackvalidate = $(if $(patsubst n%,, \
> > + $(STACKVALIDATE_$(basetarget).o)$(STACKVALIDATE)y), \
> > + $(__stackvalidate))
> > cmd_stackvalidate = $(if $(patsubst n%,, \
> > $(STACKVALIDATE_$(basetarget).o)$(STACKVALIDATE)y), \
> > - $(stackvalidate) $(nofp) "$(@)";)
> > + $(__stackvalidate) $(nofp) "$(@)";)
> >
> > endif # CONFIG_STACK_VALIDATION
> >
> > diff --git a/scripts/mod/Makefile b/scripts/mod/Makefile
> > index c11212f..374c413 100644
> > --- a/scripts/mod/Makefile
> > +++ b/scripts/mod/Makefile
> > @@ -1,3 +1,5 @@
> > +STACKVALIDATE := n
> > +
> > hostprogs-y := modpost mk_elfconfig
> > always := $(hostprogs-y) empty.o
> >
> >
>
> Josh,
>
> I still get build failures and I've pared it down to x86_64 defconfig plus:
> CONFIG_MODVERSIONS=y
> CONFIG_STACK_VALIDATION=y
Are you still seeing the same error as before? I think the errors you
saw were caused by stackvalidate choking on scripts/mod/empty.o. But I
don't see how that's still possible with the above patch since I set
STACKVALIDATE to 'n' in scripts/mod/Makefile which should tell it to
skip the directory.
> And it seems like some modules may get the .tmp_foo.o treatment while
> others end up foo.o so something like the following will not work:
>
> cmd_stackvalidate = $(if $(patsubst n%,, \
> $(STACKVALIDATE_$(basetarget).o)$(STACKVALIDATE)y), \
> $(__stackvalidate) $(nofp) "$(@D)/.tmp_$(@F)";)
>
> In addition, I'm not sure if skipping modules like STACKVALIDATE_foo.o=n
> will still function properly for modversioned modules.
I'm not sure that's really a problem, since I don't think we'll need to
skip validation of any module code. It's only used for skipping code
which runs outside of the kernel's normal operation (e.g., boot, vdso,
kexec).
--
Josh
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v8 00/21] Compile-time stack validation
2015-08-12 21:24 ` Chris J Arges
2015-08-13 2:07 ` Josh Poimboeuf
@ 2015-08-13 11:22 ` Josh Poimboeuf
2015-08-13 14:42 ` Chris J Arges
1 sibling, 1 reply; 12+ messages in thread
From: Josh Poimboeuf @ 2015-08-13 11:22 UTC (permalink / raw)
To: Chris J Arges
Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Michal Marek,
Peter Zijlstra, Andy Lutomirski, Borislav Petkov, Linus Torvalds,
Andi Kleen, Pedro Alves, Namhyung Kim, Bernd Petrovitsch, x86,
live-patching, linux-kernel
On Wed, Aug 12, 2015 at 04:24:49PM -0500, Chris J Arges wrote:
> I still get build failures and I've pared it down to x86_64 defconfig plus:
> CONFIG_MODVERSIONS=y
> CONFIG_STACK_VALIDATION=y
>
> And it seems like some modules may get the .tmp_foo.o treatment while
> others end up foo.o so something like the following will not work:
>
> cmd_stackvalidate = $(if $(patsubst n%,, \
> $(STACKVALIDATE_$(basetarget).o)$(STACKVALIDATE)y), \
> $(__stackvalidate) $(nofp) "$(@D)/.tmp_$(@F)";)
Does this fix it?
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index ec96c51..0181915 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -263,8 +263,8 @@ endif # CONFIG_STACK_VALIDATION
define rule_cc_o_c
$(call echo-cmd,checksrc) $(cmd_checksrc) \
$(call echo-cmd,cc_o_c) $(cmd_cc_o_c); \
- $(cmd_stackvalidate) \
$(cmd_modversions) \
+ $(cmd_stackvalidate) \
$(call echo-cmd,record_mcount) \
$(cmd_record_mcount) \
scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' > \
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v8 00/21] Compile-time stack validation
2015-08-13 11:22 ` Josh Poimboeuf
@ 2015-08-13 14:42 ` Chris J Arges
2015-08-13 14:50 ` Josh Poimboeuf
0 siblings, 1 reply; 12+ messages in thread
From: Chris J Arges @ 2015-08-13 14:42 UTC (permalink / raw)
To: Josh Poimboeuf
Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Michal Marek,
Peter Zijlstra, Andy Lutomirski, Borislav Petkov, Linus Torvalds,
Andi Kleen, Pedro Alves, Namhyung Kim, Bernd Petrovitsch, x86,
live-patching, linux-kernel
On Thu, Aug 13, 2015 at 06:22:20AM -0500, Josh Poimboeuf wrote:
> On Wed, Aug 12, 2015 at 04:24:49PM -0500, Chris J Arges wrote:
> > I still get build failures and I've pared it down to x86_64 defconfig plus:
> > CONFIG_MODVERSIONS=y
> > CONFIG_STACK_VALIDATION=y
> >
> > And it seems like some modules may get the .tmp_foo.o treatment while
> > others end up foo.o so something like the following will not work:
> >
> > cmd_stackvalidate = $(if $(patsubst n%,, \
> > $(STACKVALIDATE_$(basetarget).o)$(STACKVALIDATE)y), \
> > $(__stackvalidate) $(nofp) "$(@D)/.tmp_$(@F)";)
>
> Does this fix it?
>
> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index ec96c51..0181915 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -263,8 +263,8 @@ endif # CONFIG_STACK_VALIDATION
> define rule_cc_o_c
> $(call echo-cmd,checksrc) $(cmd_checksrc) \
> $(call echo-cmd,cc_o_c) $(cmd_cc_o_c); \
> - $(cmd_stackvalidate) \
> $(cmd_modversions) \
> + $(cmd_stackvalidate) \
> $(call echo-cmd,record_mcount) \
> $(cmd_record_mcount) \
> scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' > \
>
Josh,
Yes, this fixes my build. For completeness this is my current diff:
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index a1270d3..0181915 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -243,7 +243,7 @@ endif
ifdef CONFIG_STACK_VALIDATION
-stackvalidate = $(objtree)/scripts/stackvalidate/stackvalidate
+__stackvalidate = $(objtree)/scripts/stackvalidate/stackvalidate
ifndef CONFIG_FRAME_POINTER
nofp = --no-frame-pointer
@@ -251,17 +251,20 @@ endif
# Set STACKVALIDATE_foo.o=n to skip stack validation for a file.
# Set STACKVALIDATE=n to skip stack validation for a directory.
+stackvalidate = $(if $(patsubst n%,, \
+ $(STACKVALIDATE_$(basetarget).o)$(STACKVALIDATE)y), \
+ $(__stackvalidate))
cmd_stackvalidate = $(if $(patsubst n%,, \
$(STACKVALIDATE_$(basetarget).o)$(STACKVALIDATE)y), \
- $(stackvalidate) $(nofp) "$(@)";)
+ $(__stackvalidate) $(nofp) "$(@)";)
endif # CONFIG_STACK_VALIDATION
define rule_cc_o_c
$(call echo-cmd,checksrc) $(cmd_checksrc) \
$(call echo-cmd,cc_o_c) $(cmd_cc_o_c); \
- $(cmd_stackvalidate) \
$(cmd_modversions) \
+ $(cmd_stackvalidate) \
$(call echo-cmd,record_mcount) \
$(cmd_record_mcount) \
scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' > \
diff --git a/scripts/mod/Makefile b/scripts/mod/Makefile
index c11212f..374c413 100644
--- a/scripts/mod/Makefile
+++ b/scripts/mod/Makefile
@@ -1,3 +1,5 @@
+STACKVALIDATE := n
+
hostprogs-y := modpost mk_elfconfig
always := $(hostprogs-y) empty.o
Thanks,
--chris
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v8 00/21] Compile-time stack validation
2015-08-13 14:42 ` Chris J Arges
@ 2015-08-13 14:50 ` Josh Poimboeuf
0 siblings, 0 replies; 12+ messages in thread
From: Josh Poimboeuf @ 2015-08-13 14:50 UTC (permalink / raw)
To: Chris J Arges
Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Michal Marek,
Peter Zijlstra, Andy Lutomirski, Borislav Petkov, Linus Torvalds,
Andi Kleen, Pedro Alves, Namhyung Kim, Bernd Petrovitsch, x86,
live-patching, linux-kernel
On Thu, Aug 13, 2015 at 09:42:25AM -0500, Chris J Arges wrote:
> On Thu, Aug 13, 2015 at 06:22:20AM -0500, Josh Poimboeuf wrote:
> > On Wed, Aug 12, 2015 at 04:24:49PM -0500, Chris J Arges wrote:
> > > I still get build failures and I've pared it down to x86_64 defconfig plus:
> > > CONFIG_MODVERSIONS=y
> > > CONFIG_STACK_VALIDATION=y
> > >
> > > And it seems like some modules may get the .tmp_foo.o treatment while
> > > others end up foo.o so something like the following will not work:
> > >
> > > cmd_stackvalidate = $(if $(patsubst n%,, \
> > > $(STACKVALIDATE_$(basetarget).o)$(STACKVALIDATE)y), \
> > > $(__stackvalidate) $(nofp) "$(@D)/.tmp_$(@F)";)
> >
> > Does this fix it?
> >
> > diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> > index ec96c51..0181915 100644
> > --- a/scripts/Makefile.build
> > +++ b/scripts/Makefile.build
> > @@ -263,8 +263,8 @@ endif # CONFIG_STACK_VALIDATION
> > define rule_cc_o_c
> > $(call echo-cmd,checksrc) $(cmd_checksrc) \
> > $(call echo-cmd,cc_o_c) $(cmd_cc_o_c); \
> > - $(cmd_stackvalidate) \
> > $(cmd_modversions) \
> > + $(cmd_stackvalidate) \
> > $(call echo-cmd,record_mcount) \
> > $(cmd_record_mcount) \
> > scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' > \
> >
>
> Josh,
>
> Yes, this fixes my build. For completeness this is my current diff:
Great! I'll roll both patches into v10.
--
Josh
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v8 00/21] Compile-time stack validation
2015-08-06 17:23 ` Josh Poimboeuf
@ 2015-08-06 17:46 ` Josh Poimboeuf
0 siblings, 0 replies; 12+ messages in thread
From: Josh Poimboeuf @ 2015-08-06 17:46 UTC (permalink / raw)
To: Ingo Molnar
Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Michal Marek,
Peter Zijlstra, Andy Lutomirski, Borislav Petkov, Linus Torvalds,
Andi Kleen, Pedro Alves, Namhyung Kim, Bernd Petrovitsch, x86,
live-patching, linux-kernel
On Thu, Aug 06, 2015 at 12:23:32PM -0500, Josh Poimboeuf wrote:
> On Thu, Aug 06, 2015 at 10:07:50AM +0200, Ingo Molnar wrote:
> >
> > * Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> >
> > > This is v8 of the compile-time stack validation patch set, based on the
> > > tip/master branch.
> > >
> > > The frame pointer macros are still called FRAME and ENDFRAME because I
> > > don't think we converged on anything else yet. Otherwise I tried to
> > > address all the other review comments from v7.
> >
> > So I think:
> >
> > FRAME_START
> > FRAME_END
>
> (One last tweak to the bikeshed)
>
> The antonym of END is BEGIN. So how about:
>
> FRAME_BEGIN
> FRAME_END
Ok, so thesaurus.com reminds me that words can have more than one
antonym, and that START and BEGIN are both antonyms of END.
Personally, when I START something I usually FINISH it or even STOP it.
So I'll stop the bikeshedding I started and go with BEGIN/END.
--
Josh
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v8 00/21] Compile-time stack validation
2015-08-06 8:07 ` Ingo Molnar
2015-08-06 16:06 ` Josh Poimboeuf
@ 2015-08-06 17:23 ` Josh Poimboeuf
2015-08-06 17:46 ` Josh Poimboeuf
1 sibling, 1 reply; 12+ messages in thread
From: Josh Poimboeuf @ 2015-08-06 17:23 UTC (permalink / raw)
To: Ingo Molnar
Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Michal Marek,
Peter Zijlstra, Andy Lutomirski, Borislav Petkov, Linus Torvalds,
Andi Kleen, Pedro Alves, Namhyung Kim, Bernd Petrovitsch, x86,
live-patching, linux-kernel
On Thu, Aug 06, 2015 at 10:07:50AM +0200, Ingo Molnar wrote:
>
> * Josh Poimboeuf <jpoimboe@redhat.com> wrote:
>
> > This is v8 of the compile-time stack validation patch set, based on the
> > tip/master branch.
> >
> > The frame pointer macros are still called FRAME and ENDFRAME because I
> > don't think we converged on anything else yet. Otherwise I tried to
> > address all the other review comments from v7.
>
> So I think:
>
> FRAME_START
> FRAME_END
(One last tweak to the bikeshed)
The antonym of END is BEGIN. So how about:
FRAME_BEGIN
FRAME_END
--
Josh
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v8 00/21] Compile-time stack validation
2015-08-06 8:07 ` Ingo Molnar
@ 2015-08-06 16:06 ` Josh Poimboeuf
2015-08-06 17:23 ` Josh Poimboeuf
1 sibling, 0 replies; 12+ messages in thread
From: Josh Poimboeuf @ 2015-08-06 16:06 UTC (permalink / raw)
To: Ingo Molnar
Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Michal Marek,
Peter Zijlstra, Andy Lutomirski, Borislav Petkov, Linus Torvalds,
Andi Kleen, Pedro Alves, Namhyung Kim, Bernd Petrovitsch, x86,
live-patching, linux-kernel
On Thu, Aug 06, 2015 at 10:07:50AM +0200, Ingo Molnar wrote:
>
> * Josh Poimboeuf <jpoimboe@redhat.com> wrote:
>
> > This is v8 of the compile-time stack validation patch set, based on the
> > tip/master branch.
> >
> > The frame pointer macros are still called FRAME and ENDFRAME because I
> > don't think we converged on anything else yet. Otherwise I tried to
> > address all the other review comments from v7.
>
> So I think:
>
> FRAME_START
> FRAME_END
>
> would be OK.
Thanks, that sounds good to me.
> They could be added as new aliases, keeping the old ones as well, while in the new
> patches you should use this new form.
Turns out nobody uses the existing FRAME/ENDFRAME macros, so I'll just
rename them.
--
Josh
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v8 00/21] Compile-time stack validation
2015-07-28 14:46 Josh Poimboeuf
@ 2015-08-06 8:07 ` Ingo Molnar
2015-08-06 16:06 ` Josh Poimboeuf
2015-08-06 17:23 ` Josh Poimboeuf
0 siblings, 2 replies; 12+ messages in thread
From: Ingo Molnar @ 2015-08-06 8:07 UTC (permalink / raw)
To: Josh Poimboeuf
Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Michal Marek,
Peter Zijlstra, Andy Lutomirski, Borislav Petkov, Linus Torvalds,
Andi Kleen, Pedro Alves, Namhyung Kim, Bernd Petrovitsch, x86,
live-patching, linux-kernel
* Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> This is v8 of the compile-time stack validation patch set, based on the
> tip/master branch.
>
> The frame pointer macros are still called FRAME and ENDFRAME because I
> don't think we converged on anything else yet. Otherwise I tried to
> address all the other review comments from v7.
So I think:
FRAME_START
FRAME_END
would be OK.
They could be added as new aliases, keeping the old ones as well, while in the new
patches you should use this new form.
Thanks,
Ingo
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v8 00/21] Compile-time stack validation
@ 2015-07-28 14:46 Josh Poimboeuf
2015-08-06 8:07 ` Ingo Molnar
0 siblings, 1 reply; 12+ messages in thread
From: Josh Poimboeuf @ 2015-07-28 14:46 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin
Cc: Michal Marek, Peter Zijlstra, Andy Lutomirski, Borislav Petkov,
Linus Torvalds, Andi Kleen, Pedro Alves, Namhyung Kim,
Bernd Petrovitsch, x86, live-patching, linux-kernel
This is v8 of the compile-time stack validation patch set, based on the
tip/master branch.
The frame pointer macros are still called FRAME and ENDFRAME because I
don't think we converged on anything else yet. Otherwise I tried to
address all the other review comments from v7.
v7 can be found here:
https://lkml.kernel.org/r/cover.1436893563.git.jpoimboe@redhat.com
For more information about the motivation behind this patch set, and
more details about what it does, please see the changelog in patch 3.
Patches 1-5 are the stackvalidate tool and some related macros.
Patches 6-21 are some proposed fixes for several of the warnings
reported by stackvalidate. They've been compile-tested and boot tested
in a VM, but I haven't attempted any meaningful testing for many of
them.
v8:
- add proposed fixes for warnings
- fix all memory leaks
- process ignores earlier and add more ignore checks
- always assume POPCNT alternative is enabled
- drop hweight inline asm fix
- drop __schedule() ignore patch
- change .Ltemp_\@ to .Lstackvalidate_ignore_\@ in asm macro
- fix CONFIG_* checks in asm macros
- add C versions of ignore macros and frame macros
- change ";" to "\n" in C macros
- add ifdef CONFIG_STACK_VALIDATION checks in C ignore macros
- use numbered label in C ignore macro
- add missing break in switch case statement in arch-x86.c
v7:
- sibling call support
- document proposed solution for inline asm() frame pointer issues
- say "kernel entry/exit" instead of "context switch"
- clarify the checking of switch statement jump tables
- discard __stackvalidate_ignore_* sections in linker script
- use .Ltemp_\@ to get a unique label instead of static 3-digit number
- change STACKVALIDATE_IGNORE_FUNC variable to a static
- move STACKVALIDATE_IGNORE_INSN to arch-specific .h file
v6:
- rename asmvalidate -> stackvalidate (again)
- gcc-generated object file support
- recursive branch state analysis
- external jump support
- fixup/exception table support
- jump label support
- switch statement jump table support
- added documentation
- detection of "noreturn" dead end functions
- added a Kbuild mechanism for skipping files and dirs
- moved frame pointer macros to arch/x86/include/asm/frame.h
- moved ignore macros to include/linux/stackvalidate.h
v5:
- stackvalidate -> asmvalidate
- frame pointers only required for non-leaf functions
- check for the use of the FP_SAVE/RESTORE macros instead of manually
analyzing code to detect frame pointer usage
- additional checks to ensure each function doesn't leave its boundaries
- make the macros simpler and more flexible
- support for analyzing ALTERNATIVE macros
- simplified the arch interfaces in scripts/asmvalidate/arch.h
- fixed some asmvalidate warnings
- rebased onto latest tip asm cleanups
- many more small changes
v4:
- Changed the default to CONFIG_STACK_VALIDATION=n, until all the asm
code can get cleaned up.
- Fixed a stackvalidate error path exit code issue found by Michal
Marek.
v3:
- Added a patch to make the push/pop CFI macros arch-independent, as
suggested by H. Peter Anvin
v2:
- Fixed memory leaks reported by Petr Mladek
Josh Poimboeuf (21):
x86/asm: Frame pointer macro cleanup
x86/asm: Add C versions of FRAME and ENDFRAME macros
x86/stackvalidate: Compile-time stack validation
x86/stackvalidate: Add file and directory ignores
x86/stackvalidate: Add ignore macros
x86/xen: Add stack frame dependency to hypercall inline asm calls
x86/paravirt: Add stack frame dependency to PVOP inline asm calls
x86/paravirt: Fix frame pointer usage in PV_CALLEE_SAVE_REGS_THUNK
x86/paravirt: Align paravirt thunk functions at 16-byte boundaries
x86/amd: Set ELF function type for vide()
x86/reboot: Add ljmp instructions to stackvalidate whitelist
x86/xen: Add xen_cpuid() and xen_setup_gdt() to stackvalidate
whitelists
x86/asm/crypto: Fix frame pointer usage in aesni-intel_asm.S
x86/asm/crypto: Move .Lbswap_mask data to .rodata section
x86/asm/crypto: Move jump_table to .rodata section
x86/asm/crypto: Fix frame pointer usage in clmul_ghash_mul/update()
x86/asm/entry: Fix frame pointer usage in thunk functions
x86/asm/acpi: Fix frame pointer usage in do_suspend_lowlevel()
x86/asm: Fix frame pointer usage in rwsem functions
x86/asm/efi: Fix frame pointer usage in efi_call()
x86/asm/power: Fix frame pointer usage in hibernate_asm_64.S
Documentation/stack-validation.txt | 193 ++++++
MAINTAINERS | 8 +
arch/Kconfig | 6 +
arch/x86/Kconfig | 1 +
arch/x86/Makefile | 6 +-
arch/x86/boot/Makefile | 3 +-
arch/x86/boot/compressed/Makefile | 3 +-
arch/x86/crypto/aesni-intel_asm.S | 21 +
arch/x86/crypto/crc32c-pcl-intel-asm_64.S | 8 +-
arch/x86/crypto/ghash-clmulni-intel_asm.S | 5 +
arch/x86/entry/thunk_64.S | 4 +
arch/x86/entry/vdso/Makefile | 5 +-
arch/x86/include/asm/frame.h | 51 +-
arch/x86/include/asm/paravirt.h | 10 +-
arch/x86/include/asm/paravirt_types.h | 18 +-
arch/x86/include/asm/stackvalidate.h | 45 ++
arch/x86/include/asm/xen/hypercall.h | 5 +-
arch/x86/kernel/acpi/wakeup_64.S | 3 +
arch/x86/kernel/cpu/amd.c | 5 +-
arch/x86/kernel/reboot.c | 7 +-
arch/x86/kernel/vmlinux.lds.S | 5 +-
arch/x86/lib/rwsem.S | 11 +-
arch/x86/platform/efi/efi_stub_64.S | 3 +
arch/x86/power/hibernate_asm_64.S | 7 +
arch/x86/purgatory/Makefile | 2 +
arch/x86/realmode/Makefile | 4 +-
arch/x86/realmode/rm/Makefile | 3 +-
arch/x86/xen/enlighten.c | 4 +-
drivers/firmware/efi/libstub/Makefile | 1 +
include/linux/stackvalidate.h | 28 +
lib/Kconfig.debug | 11 +
scripts/Makefile | 1 +
scripts/Makefile.build | 34 +-
scripts/stackvalidate/Makefile | 24 +
scripts/stackvalidate/arch-x86.c | 160 +++++
scripts/stackvalidate/arch.h | 44 ++
scripts/stackvalidate/elf.c | 427 ++++++++++++++
scripts/stackvalidate/elf.h | 92 +++
scripts/stackvalidate/list.h | 217 +++++++
scripts/stackvalidate/special.c | 197 +++++++
scripts/stackvalidate/special.h | 41 ++
scripts/stackvalidate/stackvalidate.c | 949 ++++++++++++++++++++++++++++++
42 files changed, 2624 insertions(+), 48 deletions(-)
create mode 100644 Documentation/stack-validation.txt
create mode 100644 arch/x86/include/asm/stackvalidate.h
create mode 100644 include/linux/stackvalidate.h
create mode 100644 scripts/stackvalidate/Makefile
create mode 100644 scripts/stackvalidate/arch-x86.c
create mode 100644 scripts/stackvalidate/arch.h
create mode 100644 scripts/stackvalidate/elf.c
create mode 100644 scripts/stackvalidate/elf.h
create mode 100644 scripts/stackvalidate/list.h
create mode 100644 scripts/stackvalidate/special.c
create mode 100644 scripts/stackvalidate/special.h
create mode 100644 scripts/stackvalidate/stackvalidate.c
--
2.1.0
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2015-08-13 14:50 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-11 21:31 [PATCH v8 00/21] Compile-time stack validation Chris J Arges
2015-08-12 4:43 ` Josh Poimboeuf
2015-08-12 21:24 ` Chris J Arges
2015-08-13 2:07 ` Josh Poimboeuf
2015-08-13 11:22 ` Josh Poimboeuf
2015-08-13 14:42 ` Chris J Arges
2015-08-13 14:50 ` Josh Poimboeuf
-- strict thread matches above, loose matches on Subject: below --
2015-07-28 14:46 Josh Poimboeuf
2015-08-06 8:07 ` Ingo Molnar
2015-08-06 16:06 ` Josh Poimboeuf
2015-08-06 17:23 ` Josh Poimboeuf
2015-08-06 17:46 ` Josh Poimboeuf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).