From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org
Cc: linux-kernel@vger.kernel.org, live-patching@vger.kernel.org,
Michal Marek <mmarek@suse.cz>,
Peter Zijlstra <peterz@infradead.org>,
Andy Lutomirski <luto@kernel.org>, Borislav Petkov <bp@alien8.de>,
Linus Torvalds <torvalds@linux-foundation.org>,
Andi Kleen <andi@firstfloor.org>, Pedro Alves <palves@redhat.com>,
Namhyung Kim <namhyung@gmail.com>,
Bernd Petrovitsch <bernd@petrovitsch.priv.at>,
Chris J Arges <chris.j.arges@canonical.com>,
Andrew Morton <akpm@linux-foundation.org>,
Jiri Slaby <jslaby@suse.cz>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
David Vrabel <david.vrabel@citrix.com>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
Boris Ostrovsky <boris.ostrovsky@oracle.com>,
Jeremy Fitzhardinge <jeremy@goop.org>,
Chris Wright <chrisw@sous-sol.org>,
Alok Kataria <akataria@vmware.com>,
Rusty Russell <rusty@rustcorp.com.au>,
Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
Mathias Krause <minipli@ld-linux.so>, Pavel Machek <pavel@ucw.cz>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Len Brown <len.brown@intel.com>,
Matt Fleming <matt@codeblueprint.co.uk>
Subject: [PATCH v15 00/25] Compile-time stack metadata validation
Date: Fri, 18 Dec 2015 06:39:14 -0600 [thread overview]
Message-ID: <cover.1450442274.git.jpoimboe@redhat.com> (raw)
This is v15 of the compile-time stack metadata validation patch set,
along with proposed fixes for many of the warnings it found. It's based
on the tip/master branch.
v14 can be found here:
https://lkml.kernel.org/r/cover.1445443144.git.jpoimboe@redhat.com
For more information about the motivation behind this patch set, and
more details about what it does, see the patch 6 changelog and
tools/stacktool/Documentation/stack-validation.txt.
Patches 1-3 are some minor tools/ fixes in preparation for stacktool.
Patches 4-8 add stacktool and some related macros.
Patches 9-23 are some proposed fixes for several of the warnings
reported by stacktool. They've been compile-tested and boot-tested in a
VM, but I haven't attempted any meaningful testing for many of them.
Patches 24-25 are some additional warning fixes from Chris J Arges.
v15:
- restructure code for a new cmdline interface "stacktool check" using
the new subcommand framework in tools/lib/subcmd
- fix 32 bit build fail (put __sp at end) in paravirt_types.h patch 10
which was reported by 0day
v14:
- make tools/include/linux/list.h self-sufficient
- create FRAME_OFFSET to allow 32-bit code to be able to access function
arguments on the stack
- add FRAME_OFFSET usage in crypto patch 14/24: "Create stack frames in
aesni-intel_asm.S"
- rename "index" -> "idx" to fix build with some compilers
v13:
- LDFLAGS order fix from Chris J Arges
- new warning fix patches from Chris J Arges
- "--frame-pointer" -> "--check-frame-pointer"
v12:
- rename "stackvalidate" -> "stacktool"
- move from scripts/ to tools/:
- makefile rework
- make a copy of the x86 insn code (and warn if the code diverges)
- use tools/include/linux/list.h
- move warning macros to a new warn.h file
- change wording: "stack validation" -> "stack metadata validation"
v11:
- attempt to answer the "why" question better in the documentation and
commit message
- s/FP_SAVE/FRAME_BEGIN/ in documentation
v10:
- add scripts/mod to directory ignores
- remove circular dependencies for ignored objects which are built
before stackvalidate
- fix CONFIG_MODVERSIONS incompatibility
v9:
- rename FRAME/ENDFRAME -> FRAME_BEGIN/FRAME_END
- fix jump table issue for when the original instruction is a jump
- drop paravirt thunk alignment patch
- add maintainers to CC for proposed warning fixes
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
Cc: linux-kernel@vger.kernel.org
Cc: live-patching@vger.kernel.org
Cc: Michal Marek <mmarek@suse.cz>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Pedro Alves <palves@redhat.com>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Bernd Petrovitsch <bernd@petrovitsch.priv.at>
Cc: Chris J Arges <chris.j.arges@canonical.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Chris J Arges (2):
x86/uaccess: Add stack frame output operand in get_user inline asm
x86/stacktool: Ignore head_$(BITS) files.
Josh Poimboeuf (23):
tools: Fix formatting of the "make -C tools" help message
tools: Make list.h self-sufficient
tools subcmd: Add missing NORETURN define for parse-options.h
x86/asm: Frame pointer macro cleanup
x86/asm: Add C versions of frame pointer macros
x86/stacktool: Compile-time stack metadata validation
x86/stacktool: Add file and directory ignores
x86/stacktool: 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: Create a stack frame in PV_CALLEE_SAVE_REGS_THUNK
x86/amd: Set ELF function type for vide()
x86/reboot: Add ljmp instructions to stacktool whitelist
x86/xen: Add xen_cpuid() and xen_setup_gdt() to stacktool whitelists
x86/asm/crypto: Create stack frames 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: Create stack frames in clmul_ghash_mul/update()
x86/asm/entry: Create stack frames in thunk functions
x86/asm/acpi: Create a stack frame in do_suspend_lowlevel()
x86/asm: Create stack frames in rwsem functions
x86/asm/efi: Create a stack frame in efi_call()
x86/asm/power: Create stack frames in hibernate_asm_64.S
MAINTAINERS | 7 +
Makefile | 5 +-
arch/Kconfig | 6 +
arch/x86/Kconfig | 1 +
arch/x86/boot/Makefile | 1 +
arch/x86/boot/compressed/Makefile | 3 +-
arch/x86/crypto/aesni-intel_asm.S | 75 +-
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 | 59 +-
arch/x86/include/asm/paravirt.h | 9 +-
arch/x86/include/asm/paravirt_types.h | 18 +-
arch/x86/include/asm/stacktool.h | 45 +
arch/x86/include/asm/uaccess.h | 5 +-
arch/x86/include/asm/xen/hypercall.h | 5 +-
arch/x86/kernel/Makefile | 1 +
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/stacktool.h | 29 +
lib/Kconfig.debug | 12 +
scripts/Makefile.build | 38 +-
scripts/mod/Makefile | 2 +
tools/Makefile | 43 +-
tools/include/linux/list.h | 753 +++++++++++++++-
tools/lib/subcmd/parse-options.h | 4 +
tools/stacktool/.gitignore | 2 +
tools/stacktool/Build | 13 +
tools/stacktool/Documentation/stack-validation.txt | 336 +++++++
tools/stacktool/Makefile | 60 ++
tools/stacktool/arch.h | 44 +
tools/stacktool/arch/x86/Build | 12 +
tools/stacktool/arch/x86/decode.c | 163 ++++
.../stacktool/arch/x86/insn/gen-insn-attr-x86.awk | 387 ++++++++
tools/stacktool/arch/x86/insn/inat.c | 97 ++
tools/stacktool/arch/x86/insn/inat.h | 221 +++++
tools/stacktool/arch/x86/insn/inat_types.h | 29 +
tools/stacktool/arch/x86/insn/insn.c | 594 +++++++++++++
tools/stacktool/arch/x86/insn/insn.h | 201 +++++
tools/stacktool/arch/x86/insn/x86-opcode-map.txt | 984 +++++++++++++++++++++
tools/stacktool/builtin-check.c | 961 ++++++++++++++++++++
tools/stacktool/builtin.h | 22 +
tools/stacktool/elf.c | 403 +++++++++
tools/stacktool/elf.h | 79 ++
tools/stacktool/special.c | 199 +++++
tools/stacktool/special.h | 42 +
tools/stacktool/stacktool.c | 133 +++
tools/stacktool/warn.h | 60 ++
59 files changed, 6134 insertions(+), 106 deletions(-)
create mode 100644 arch/x86/include/asm/stacktool.h
create mode 100644 include/linux/stacktool.h
create mode 100644 tools/stacktool/.gitignore
create mode 100644 tools/stacktool/Build
create mode 100644 tools/stacktool/Documentation/stack-validation.txt
create mode 100644 tools/stacktool/Makefile
create mode 100644 tools/stacktool/arch.h
create mode 100644 tools/stacktool/arch/x86/Build
create mode 100644 tools/stacktool/arch/x86/decode.c
create mode 100644 tools/stacktool/arch/x86/insn/gen-insn-attr-x86.awk
create mode 100644 tools/stacktool/arch/x86/insn/inat.c
create mode 100644 tools/stacktool/arch/x86/insn/inat.h
create mode 100644 tools/stacktool/arch/x86/insn/inat_types.h
create mode 100644 tools/stacktool/arch/x86/insn/insn.c
create mode 100644 tools/stacktool/arch/x86/insn/insn.h
create mode 100644 tools/stacktool/arch/x86/insn/x86-opcode-map.txt
create mode 100644 tools/stacktool/builtin-check.c
create mode 100644 tools/stacktool/builtin.h
create mode 100644 tools/stacktool/elf.c
create mode 100644 tools/stacktool/elf.h
create mode 100644 tools/stacktool/special.c
create mode 100644 tools/stacktool/special.h
create mode 100644 tools/stacktool/stacktool.c
create mode 100644 tools/stacktool/warn.h
--
2.4.3
next reply other threads:[~2015-12-18 12:40 UTC|newest]
Thread overview: 67+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-18 12:39 Josh Poimboeuf [this message]
2015-12-18 12:39 ` [PATCH v15 01/25] tools: Fix formatting of the "make -C tools" help message Josh Poimboeuf
2016-01-13 9:40 ` [tip:perf/urgent] " tip-bot for Josh Poimboeuf
2015-12-18 12:39 ` [PATCH v15 02/25] tools: Make list.h self-sufficient Josh Poimboeuf
2016-01-12 12:35 ` Borislav Petkov
2016-01-12 14:54 ` Arnaldo Carvalho de Melo
2016-01-12 15:59 ` Borislav Petkov
2016-01-12 17:16 ` Arnaldo Carvalho de Melo
2016-01-13 9:40 ` [tip:perf/urgent] " tip-bot for Josh Poimboeuf
2015-12-18 12:39 ` [PATCH v15 03/25] tools subcmd: Add missing NORETURN define for parse-options.h Josh Poimboeuf
2016-01-13 9:41 ` [tip:perf/urgent] " tip-bot for Josh Poimboeuf
2015-12-18 12:39 ` [PATCH v15 04/25] x86/asm: Frame pointer macro cleanup Josh Poimboeuf
2016-01-19 13:39 ` [tip:x86/asm] x86/asm: Clean up frame pointer macros tip-bot for Josh Poimboeuf
2015-12-18 12:39 ` [PATCH v15 05/25] x86/asm: Add C versions of " Josh Poimboeuf
2016-01-19 13:40 ` [tip:x86/asm] " tip-bot for Josh Poimboeuf
2015-12-18 12:39 ` [PATCH v15 06/25] x86/stacktool: Compile-time stack metadata validation Josh Poimboeuf
2016-01-12 14:48 ` Borislav Petkov
2016-01-12 15:06 ` Josh Poimboeuf
2016-01-12 16:10 ` Borislav Petkov
2016-01-19 12:02 ` Ingo Molnar
2015-12-18 12:39 ` [PATCH v15 07/25] x86/stacktool: Add file and directory ignores Josh Poimboeuf
2015-12-18 12:39 ` [PATCH v15 08/25] x86/stacktool: Add ignore macros Josh Poimboeuf
2015-12-18 12:39 ` [PATCH v15 09/25] x86/xen: Add stack frame dependency to hypercall inline asm calls Josh Poimboeuf
2015-12-18 12:39 ` [PATCH v15 10/25] x86/paravirt: Add stack frame dependency to PVOP " Josh Poimboeuf
2015-12-18 12:39 ` [PATCH v15 11/25] x86/paravirt: Create a stack frame in PV_CALLEE_SAVE_REGS_THUNK Josh Poimboeuf
2015-12-18 12:39 ` [PATCH v15 12/25] x86/amd: Set ELF function type for vide() Josh Poimboeuf
2015-12-18 12:39 ` [PATCH v15 13/25] x86/reboot: Add ljmp instructions to stacktool whitelist Josh Poimboeuf
2016-01-12 16:47 ` Borislav Petkov
2016-01-12 17:43 ` Josh Poimboeuf
2016-01-12 17:55 ` Borislav Petkov
2016-01-12 18:56 ` Josh Poimboeuf
2016-01-12 19:37 ` Borislav Petkov
2016-01-13 10:55 ` Ingo Molnar
2016-01-15 6:06 ` Josh Poimboeuf
2016-01-15 10:41 ` Borislav Petkov
2016-01-15 11:00 ` Ingo Molnar
2016-01-15 11:11 ` Borislav Petkov
2016-01-15 11:13 ` Ingo Molnar
2016-01-20 5:42 ` Josh Poimboeuf
2016-01-20 5:50 ` H. Peter Anvin
2016-01-20 6:09 ` Josh Poimboeuf
2016-01-20 10:44 ` Borislav Petkov
2016-01-15 10:56 ` Ingo Molnar
2015-12-18 12:39 ` [PATCH v15 14/25] x86/xen: Add xen_cpuid() and xen_setup_gdt() to stacktool whitelists Josh Poimboeuf
2015-12-18 12:39 ` [PATCH v15 15/25] x86/asm/crypto: Create stack frames in aesni-intel_asm.S Josh Poimboeuf
2016-01-12 16:53 ` Borislav Petkov
2016-01-12 16:54 ` Borislav Petkov
2015-12-18 12:39 ` [PATCH v15 16/25] x86/asm/crypto: Move .Lbswap_mask data to .rodata section Josh Poimboeuf
2015-12-18 12:39 ` [PATCH v15 17/25] x86/asm/crypto: Move jump_table " Josh Poimboeuf
2015-12-18 12:39 ` [PATCH v15 18/25] x86/asm/crypto: Create stack frames in clmul_ghash_mul/update() Josh Poimboeuf
2015-12-18 12:39 ` [PATCH v15 19/25] x86/asm/entry: Create stack frames in thunk functions Josh Poimboeuf
2015-12-18 12:39 ` [PATCH v15 20/25] x86/asm/acpi: Create a stack frame in do_suspend_lowlevel() Josh Poimboeuf
2015-12-20 16:13 ` Rafael J. Wysocki
2015-12-18 12:39 ` [PATCH v15 21/25] x86/asm: Create stack frames in rwsem functions Josh Poimboeuf
2016-01-12 12:41 ` Borislav Petkov
2016-01-12 14:36 ` Josh Poimboeuf
2016-01-12 14:40 ` Borislav Petkov
2015-12-18 12:39 ` [PATCH v15 22/25] x86/asm/efi: Create a stack frame in efi_call() Josh Poimboeuf
2015-12-18 12:39 ` [PATCH v15 23/25] x86/asm/power: Create stack frames in hibernate_asm_64.S Josh Poimboeuf
2015-12-20 16:14 ` Rafael J. Wysocki
2015-12-18 12:39 ` [PATCH v15 24/25] x86/uaccess: Add stack frame output operand in get_user inline asm Josh Poimboeuf
2015-12-18 12:39 ` [PATCH v15 25/25] x86/stacktool: Ignore head_$(BITS) files Josh Poimboeuf
2016-01-12 14:58 ` [PATCH v15 00/25] Compile-time stack metadata validation Arnaldo Carvalho de Melo
2016-01-12 17:17 ` Borislav Petkov
2016-01-12 17:50 ` Josh Poimboeuf
2016-01-12 18:04 ` Borislav Petkov
2016-01-13 10:18 ` Ingo Molnar
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=cover.1450442274.git.jpoimboe@redhat.com \
--to=jpoimboe@redhat.com \
--cc=acme@kernel.org \
--cc=akataria@vmware.com \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=bernd@petrovitsch.priv.at \
--cc=boris.ostrovsky@oracle.com \
--cc=bp@alien8.de \
--cc=chris.j.arges@canonical.com \
--cc=chrisw@sous-sol.org \
--cc=davem@davemloft.net \
--cc=david.vrabel@citrix.com \
--cc=herbert@gondor.apana.org.au \
--cc=hpa@zytor.com \
--cc=jeremy@goop.org \
--cc=jslaby@suse.cz \
--cc=konrad.wilk@oracle.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=luto@kernel.org \
--cc=matt@codeblueprint.co.uk \
--cc=mingo@redhat.com \
--cc=minipli@ld-linux.so \
--cc=mmarek@suse.cz \
--cc=namhyung@gmail.com \
--cc=palves@redhat.com \
--cc=pavel@ucw.cz \
--cc=peterz@infradead.org \
--cc=rjw@rjwysocki.net \
--cc=rusty@rustcorp.com.au \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=x86@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).