lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150812044317.GB25439@treble.redhat.com>
Date:	Tue, 11 Aug 2015 23:43:17 -0500
From:	Josh Poimboeuf <jpoimboe@...hat.com>
To:	Chris J Arges <chris.j.arges@...onical.com>
Cc:	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>, Michal Marek <mmarek@...e.cz>,
	Peter Zijlstra <peterz@...radead.org>,
	Andy Lutomirski <luto@...nel.org>,
	Borislav Petkov <bp@...en8.de>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Andi Kleen <andi@...stfloor.org>,
	Pedro Alves <palves@...hat.com>,
	Namhyung Kim <namhyung@...il.com>,
	Bernd Petrovitsch <bernd@...rovitsch.priv.at>, x86@...nel.org,
	live-patching@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v8 00/21] Compile-time stack validation

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@...hat.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

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ