Message ID | 20201211184633.3213045-1-samitolvanen@google.com (mailing list archive) |
---|---|
Headers | show |
Series | Add support for Clang LTO | expand |
On Fri, Dec 11, 2020 at 10:46:17AM -0800, Sami Tolvanen wrote: > This patch series adds support for building the kernel with Clang's > Link Time Optimization (LTO). In addition to performance, the primary > motivation for LTO is to allow Clang's Control-Flow Integrity (CFI) > to be used in the kernel. Google has shipped millions of Pixel > devices running three major kernel versions with LTO+CFI since 2018. > > Most of the patches are build system changes for handling LLVM > bitcode, which Clang produces with LTO instead of ELF object files, > postponing ELF processing until a later stage, and ensuring initcall > ordering. > > Note that arm64 support depends on Will's memory ordering patches > [1]. I will post x86_64 patches separately after we have fixed the > remaining objtool warnings [2][3]. > > [1] https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git/log/?h=for-next/lto > [2] https://lore.kernel.org/lkml/20201120040424.a3wctajzft4ufoiw@treble/ > [3] https://git.kernel.org/pub/scm/linux/kernel/git/jpoimboe/linux.git/log/?h=objtool-vmlinux > > You can also pull this series from > > https://github.com/samitolvanen/linux.git lto-v9 > > --- > Changes in v9: > > - Added HAS_LTO_CLANG dependencies to LLVM=1 and LLVM_IAS=1 to avoid > issues with mismatched toolchains. > > - Dropped the .mod patch as Masahiro landed a better solution to > the split line issue in commit 7d32358be8ac ("kbuild: avoid split > lines in .mod files"). > > - Updated CC_FLAGS_LTO to use -fvisibility=hidden to avoid weak symbol > visibility issues with ThinLTO on x86. > > - Changed LTO_CLANG_FULL to depend on !COMPILE_TEST to prevent > timeouts in automated testing. > > - Added a dependency to CPU_LITTLE_ENDIAN to ARCH_SUPPORTS_LTO_CLANG > in arch/arm64/Kconfig. > > - Added a default symbol list to fix an issue with TRIM_UNUSED_KSYMS. This continues to look good to me. I'd like to see it in -next ASAP so we can continue to find any little needed tweaks. Since it works in the general case, we can add on top of this series once it's in -next. Masahiro, let me know if you'd rather I not carry this in -next. AFAICT, the bulk of the changes in the build system continue to be confined to the LTO-only cases, so it should not be disruptive to anyone doing non-LTO builds.
On Fri, 11 Dec 2020 10:46:17 -0800, Sami Tolvanen wrote: > This patch series adds support for building the kernel with Clang's > Link Time Optimization (LTO). In addition to performance, the primary > motivation for LTO is to allow Clang's Control-Flow Integrity (CFI) > to be used in the kernel. Google has shipped millions of Pixel > devices running three major kernel versions with LTO+CFI since 2018. > > Most of the patches are build system changes for handling LLVM > bitcode, which Clang produces with LTO instead of ELF object files, > postponing ELF processing until a later stage, and ensuring initcall > ordering. > > [...] Applied to kspp/lto/v5.11-rc2, thanks! I'll let 0-day grind on this over the weekend and toss it in -next on Monday if there aren't any objections. [01/16] tracing: move function tracer options to Kconfig https://git.kernel.org/kees/c/3b15cdc15956 [02/16] kbuild: add support for Clang LTO https://git.kernel.org/kees/c/833174494976 [03/16] kbuild: lto: fix module versioning https://git.kernel.org/kees/c/6eb20c5338a0 [04/16] kbuild: lto: limit inlining https://git.kernel.org/kees/c/f6db4eff0691 [05/16] kbuild: lto: merge module sections https://git.kernel.org/kees/c/d03e46783689 [06/16] kbuild: lto: add a default list of used symbols https://git.kernel.org/kees/c/81bfbc27b122 [07/16] init: lto: ensure initcall ordering https://git.kernel.org/kees/c/7918ea64195d [08/16] init: lto: fix PREL32 relocations https://git.kernel.org/kees/c/a51d9615ffb5 [09/16] PCI: Fix PREL32 relocations for LTO https://git.kernel.org/kees/c/dc83615370e7 [10/16] modpost: lto: strip .lto from module names https://git.kernel.org/kees/c/5c0312ef3ca0 [11/16] scripts/mod: disable LTO for empty.c https://git.kernel.org/kees/c/3d05432db312 [12/16] efi/libstub: disable LTO https://git.kernel.org/kees/c/b12eba00cb87 [13/16] drivers/misc/lkdtm: disable LTO for rodata.o https://git.kernel.org/kees/c/ed02e86f1752 [14/16] arm64: vdso: disable LTO https://git.kernel.org/kees/c/d73692f0f527 [15/16] arm64: disable recordmcount with DYNAMIC_FTRACE_WITH_REGS https://git.kernel.org/kees/c/09b812ac146f [16/16] arm64: allow LTO to be selected https://git.kernel.org/kees/c/1354b8946c46
On Fri, Dec 11, 2020 at 7:46 PM 'Sami Tolvanen' via Clang Built Linux <clang-built-linux@googlegroups.com> wrote: > > This patch series adds support for building the kernel with Clang's > Link Time Optimization (LTO). In addition to performance, the primary > motivation for LTO is to allow Clang's Control-Flow Integrity (CFI) > to be used in the kernel. Google has shipped millions of Pixel > devices running three major kernel versions with LTO+CFI since 2018. > > Most of the patches are build system changes for handling LLVM > bitcode, which Clang produces with LTO instead of ELF object files, > postponing ELF processing until a later stage, and ensuring initcall > ordering. > > Note that arm64 support depends on Will's memory ordering patches > [1]. I will post x86_64 patches separately after we have fixed the > remaining objtool warnings [2][3]. > > [1] https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git/log/?h=for-next/lto > [2] https://lore.kernel.org/lkml/20201120040424.a3wctajzft4ufoiw@treble/ > [3] https://git.kernel.org/pub/scm/linux/kernel/git/jpoimboe/linux.git/log/?h=objtool-vmlinux > Hi Sami, Thanks for the update. I am interested in having Clang LTO (Clang-CFI) for x86-64 working and help with testing. I tried the Git tree mentioned in [3] <jpoimboe.git#objtool-vmlinux> (together with changes from <peterz.git#x86/urgent>). I only see in my build-log... drivers/gpu/drm/i915/gem/i915_gem_execbuffer.o: warning: objtool: eb_relocate_parse_slow()+0x3d0: stack state mismatch: cfa1=7+120 cfa2=-1+0 drivers/gpu/drm/i915/gem/i915_gem_execbuffer.o: warning: objtool: eb_copy_relocations()+0x229: stack state mismatch: cfa1=7+120 cfa2=-1+0 ...which was reported and worked on in [1]. This is with Clang-IAS version 11.0.1. Unfortunately, the recent changes in <samitolvanen.github#clang-cfi> do not cleanly apply with Josh stuff. My intention/wish was to report this combination of patchsets "heals" a lot of objtool-warnings for vmlinux.o I observed with Clang-CFI. Is it possible to have a Git branch where Josh's objtool-vmlinux is working together with Clang-LTO? For testing purposes. Thanks. Regards, - Sedat - [1] https://github.com/ClangBuiltLinux/linux/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc > You can also pull this series from > > https://github.com/samitolvanen/linux.git lto-v9 > > --- > Changes in v9: > > - Added HAS_LTO_CLANG dependencies to LLVM=1 and LLVM_IAS=1 to avoid > issues with mismatched toolchains. > > - Dropped the .mod patch as Masahiro landed a better solution to > the split line issue in commit 7d32358be8ac ("kbuild: avoid split > lines in .mod files"). > > - Updated CC_FLAGS_LTO to use -fvisibility=hidden to avoid weak symbol > visibility issues with ThinLTO on x86. > > - Changed LTO_CLANG_FULL to depend on !COMPILE_TEST to prevent > timeouts in automated testing. > > - Added a dependency to CPU_LITTLE_ENDIAN to ARCH_SUPPORTS_LTO_CLANG > in arch/arm64/Kconfig. > > - Added a default symbol list to fix an issue with TRIM_UNUSED_KSYMS. > > Changes in v8: > > - Cleaned up the LTO Kconfig options based on suggestions from > Nick and Kees. > > - Dropped the patch to disable LTO for the arm64 nVHE KVM code as > David pointed out it's not needed anymore. > > Changes in v7: > > - Rebased to master again. > > - Added back arm64 patches as the prerequisites are now staged, > and dropped x86_64 support until the remaining objtool issues > are resolved. > > - Dropped ifdefs from module.lds.S. > > Changes in v6: > > - Added the missing --mcount flag to patch 5. > > - Dropped the arm64 patches from this series and will repost them > later. > > Changes in v5: > > - Rebased on top of tip/master. > > - Changed the command line for objtool to use --vmlinux --duplicate > to disable warnings about retpoline thunks and to fix .orc_unwind > generation for vmlinux.o. > > - Added --noinstr flag to objtool, so we can use --vmlinux without > also enabling noinstr validation. > > - Disabled objtool's unreachable instruction warnings with LTO to > disable false positives for the int3 padding in vmlinux.o. > > - Added ANNOTATE_RETPOLINE_SAFE annotations to the indirect jumps > in x86 assembly code to fix objtool warnings with retpoline. > > - Fixed modpost warnings about missing version information with > CONFIG_MODVERSIONS. > > - Included Makefile.lib into Makefile.modpost for ld_flags. Thanks > to Sedat for pointing this out. > > - Updated the help text for ThinLTO to better explain the trade-offs. > > - Updated commit messages with better explanations. > > Changes in v4: > > - Fixed a typo in Makefile.lib to correctly pass --no-fp to objtool. > > - Moved ftrace configs related to generating __mcount_loc to Kconfig, > so they are available also in Makefile.modfinal. > > - Dropped two prerequisite patches that were merged to Linus' tree. > > Changes in v3: > > - Added a separate patch to remove the unused DISABLE_LTO treewide, > as filtering out CC_FLAGS_LTO instead is preferred. > > - Updated the Kconfig help to explain why LTO is behind a choice > and disabled by default. > > - Dropped CC_FLAGS_LTO_CLANG, compiler-specific LTO flags are now > appended directly to CC_FLAGS_LTO. > > - Updated $(AR) flags as KBUILD_ARFLAGS was removed earlier. > > - Fixed ThinLTO cache handling for external module builds. > > - Rebased on top of Masahiro's patch for preprocessing modules.lds, > and moved the contents of module-lto.lds to modules.lds.S. > > - Moved objtool_args to Makefile.lib to avoid duplication of the > command line parameters in Makefile.modfinal. > > - Clarified in the commit message for the initcall ordering patch > that the initcall order remains the same as without LTO. > > - Changed link-vmlinux.sh to use jobserver-exec to control the > number of jobs started by generate_initcall_ordering.pl. > > - Dropped the x86/relocs patch to whitelist L4_PAGE_OFFSET as it's > no longer needed with ToT kernel. > > - Disabled LTO for arch/x86/power/cpu.c to work around a Clang bug > with stack protector attributes. > > Changes in v2: > > - Fixed -Wmissing-prototypes warnings with W=1. > > - Dropped cc-option from -fsplit-lto-unit and added .thinlto-cache > scrubbing to make distclean. > > - Added a comment about Clang >=11 being required. > > - Added a patch to disable LTO for the arm64 KVM nVHE code. > > - Disabled objtool's noinstr validation with LTO unless enabled. > > - Included Peter's proposed objtool mcount patch in the series > and replaced recordmcount with the objtool pass to avoid > whitelisting relocations that are not calls. > > - Updated several commit messages with better explanations. > > > Sami Tolvanen (16): > tracing: move function tracer options to Kconfig > kbuild: add support for Clang LTO > kbuild: lto: fix module versioning > kbuild: lto: limit inlining > kbuild: lto: merge module sections > kbuild: lto: add a default list of used symbols > init: lto: ensure initcall ordering > init: lto: fix PREL32 relocations > PCI: Fix PREL32 relocations for LTO > modpost: lto: strip .lto from module names > scripts/mod: disable LTO for empty.c > efi/libstub: disable LTO > drivers/misc/lkdtm: disable LTO for rodata.o > arm64: vdso: disable LTO > arm64: disable recordmcount with DYNAMIC_FTRACE_WITH_REGS > arm64: allow LTO to be selected > > .gitignore | 1 + > Makefile | 45 +++-- > arch/Kconfig | 90 +++++++++ > arch/arm64/Kconfig | 4 + > arch/arm64/kernel/vdso/Makefile | 3 +- > drivers/firmware/efi/libstub/Makefile | 2 + > drivers/misc/lkdtm/Makefile | 1 + > include/asm-generic/vmlinux.lds.h | 11 +- > include/linux/init.h | 79 +++++++- > include/linux/pci.h | 19 +- > init/Kconfig | 1 + > kernel/trace/Kconfig | 16 ++ > scripts/Makefile.build | 48 ++++- > scripts/Makefile.lib | 6 +- > scripts/Makefile.modfinal | 9 +- > scripts/Makefile.modpost | 25 ++- > scripts/generate_initcall_order.pl | 270 ++++++++++++++++++++++++++ > scripts/link-vmlinux.sh | 70 ++++++- > scripts/lto-used-symbollist | 5 + > scripts/mod/Makefile | 1 + > scripts/mod/modpost.c | 16 +- > scripts/mod/modpost.h | 9 + > scripts/mod/sumversion.c | 6 +- > scripts/module.lds.S | 24 +++ > 24 files changed, 696 insertions(+), 65 deletions(-) > create mode 100755 scripts/generate_initcall_order.pl > create mode 100644 scripts/lto-used-symbollist > > > base-commit: 33dc9614dc208291d0c4bcdeb5d30d481dcd2c4c > -- > 2.29.2.576.ga3fc446d84-goog > > -- > You received this message because you are subscribed to the Google Groups "Clang Built Linux" group. > To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20201211184633.3213045-1-samitolvanen%40google.com.
On Sat, Jan 09, 2021 at 03:54:20PM +0100, Sedat Dilek wrote: > I am interested in having Clang LTO (Clang-CFI) for x86-64 working and > help with testing. > > I tried the Git tree mentioned in [3] <jpoimboe.git#objtool-vmlinux> > (together with changes from <peterz.git#x86/urgent>). > > I only see in my build-log... > > drivers/gpu/drm/i915/gem/i915_gem_execbuffer.o: warning: objtool: > eb_relocate_parse_slow()+0x3d0: stack state mismatch: cfa1=7+120 > cfa2=-1+0 > drivers/gpu/drm/i915/gem/i915_gem_execbuffer.o: warning: objtool: > eb_copy_relocations()+0x229: stack state mismatch: cfa1=7+120 > cfa2=-1+0 > > ...which was reported and worked on in [1]. > > This is with Clang-IAS version 11.0.1. > > Unfortunately, the recent changes in <samitolvanen.github#clang-cfi> > do not cleanly apply with Josh stuff. > My intention/wish was to report this combination of patchsets "heals" > a lot of objtool-warnings for vmlinux.o I observed with Clang-CFI. > > Is it possible to have a Git branch where Josh's objtool-vmlinux is > working together with Clang-LTO? > For testing purposes. I updated my branch with my most recent work from before the holidays, can you try it now? It still doesn't fix any of the crypto warnings, but I'll do that in a separate set after posting these next week.
On Sat, Jan 9, 2021 at 4:36 PM Josh Poimboeuf <jpoimboe@redhat.com> wrote: > > On Sat, Jan 09, 2021 at 03:54:20PM +0100, Sedat Dilek wrote: > > I am interested in having Clang LTO (Clang-CFI) for x86-64 working and > > help with testing. > > > > I tried the Git tree mentioned in [3] <jpoimboe.git#objtool-vmlinux> > > (together with changes from <peterz.git#x86/urgent>). > > > > I only see in my build-log... > > > > drivers/gpu/drm/i915/gem/i915_gem_execbuffer.o: warning: objtool: > > eb_relocate_parse_slow()+0x3d0: stack state mismatch: cfa1=7+120 > > cfa2=-1+0 > > drivers/gpu/drm/i915/gem/i915_gem_execbuffer.o: warning: objtool: > > eb_copy_relocations()+0x229: stack state mismatch: cfa1=7+120 > > cfa2=-1+0 > > > > ...which was reported and worked on in [1]. > > > > This is with Clang-IAS version 11.0.1. > > > > Unfortunately, the recent changes in <samitolvanen.github#clang-cfi> > > do not cleanly apply with Josh stuff. > > My intention/wish was to report this combination of patchsets "heals" > > a lot of objtool-warnings for vmlinux.o I observed with Clang-CFI. > > > > Is it possible to have a Git branch where Josh's objtool-vmlinux is > > working together with Clang-LTO? > > For testing purposes. > > I updated my branch with my most recent work from before the holidays, > can you try it now? It still doesn't fix any of the crypto warnings, > but I'll do that in a separate set after posting these next week. > Thanks, Josh. Did you push it (oh ah push it push it really really really good...) to your remote Git please :-). - Sedat - [1] https://www.youtube.com/watch?v=vCadcBR95oU
On Sat, Jan 09, 2021 at 04:46:21PM +0100, Sedat Dilek wrote: > On Sat, Jan 9, 2021 at 4:36 PM Josh Poimboeuf <jpoimboe@redhat.com> wrote: > > > > On Sat, Jan 09, 2021 at 03:54:20PM +0100, Sedat Dilek wrote: > > > I am interested in having Clang LTO (Clang-CFI) for x86-64 working and > > > help with testing. > > > > > > I tried the Git tree mentioned in [3] <jpoimboe.git#objtool-vmlinux> > > > (together with changes from <peterz.git#x86/urgent>). > > > > > > I only see in my build-log... > > > > > > drivers/gpu/drm/i915/gem/i915_gem_execbuffer.o: warning: objtool: > > > eb_relocate_parse_slow()+0x3d0: stack state mismatch: cfa1=7+120 > > > cfa2=-1+0 > > > drivers/gpu/drm/i915/gem/i915_gem_execbuffer.o: warning: objtool: > > > eb_copy_relocations()+0x229: stack state mismatch: cfa1=7+120 > > > cfa2=-1+0 > > > > > > ...which was reported and worked on in [1]. > > > > > > This is with Clang-IAS version 11.0.1. > > > > > > Unfortunately, the recent changes in <samitolvanen.github#clang-cfi> > > > do not cleanly apply with Josh stuff. > > > My intention/wish was to report this combination of patchsets "heals" > > > a lot of objtool-warnings for vmlinux.o I observed with Clang-CFI. > > > > > > Is it possible to have a Git branch where Josh's objtool-vmlinux is > > > working together with Clang-LTO? > > > For testing purposes. > > > > I updated my branch with my most recent work from before the holidays, > > can you try it now? It still doesn't fix any of the crypto warnings, > > but I'll do that in a separate set after posting these next week. > > > > Thanks, Josh. > > Did you push it (oh ah push it push it really really really good...) > to your remote Git please :-). I thought I already pushed it pretty good ;-) do you not see it? git://git.kernel.org/pub/scm/linux/kernel/git/jpoimboe/linux.git objtool-vmlinux d6baee244f2d — objtool: Alphabetize usage option list (3 weeks ago) c0b2a6a625ac — objtool: Separate vmlinux/noinstr validation config options (3 weeks ago) 84c53551ad17 — objtool: Enable full vmlinux validation (3 weeks ago) e518ac0801cd — x86/power: Support objtool validation in hibernate_asm_64.S (3 weeks ago) d0ac4c7301c1 — x86/power: Move restore_registers() to top of the file (3 weeks ago) d3389bc83538 — x86/power: Convert indirect jumps to retpolines (3 weeks ago) 7a974d90aa40 — x86/acpi: Support objtool validation in wakeup_64.S (3 weeks ago) 6693e26cd6cc — x86/acpi: Convert indirect jump to retpoline (3 weeks ago) 0dfb760c74d1 — x86/ftrace: Support objtool vmlinux.o validation in ftrace_64.S (3 weeks ago) 89a4febfd7bf — x86/xen/pvh: Convert indirect jump to retpoline (3 weeks ago) b62837092140 — x86/xen: Support objtool vmlinux.o validation in xen-head.S (3 weeks ago) 705e18481ed9 — x86/xen: Support objtool validation in xen-asm.S (3 weeks ago) 3548319e21b9 — objtool: Add xen_start_kernel() to noreturn list (3 weeks ago) 6016e8da8c3d — objtool: Combine UNWIND_HINT_RET_OFFSET and UNWIND_HINT_FUNC (3 weeks ago) 56d6a7aee8b1 — objtool: Add asm version of STACK_FRAME_NON_STANDARD (3 weeks ago) 68259d951f1a — objtool: Assume only ELF functions do sibling calls (3 weeks ago) 0d6c8816cf91 — x86/ftrace: Add UNWIND_HINT_FUNC annotation for ftrace_stub (3 weeks ago) 24d6ce8cd8f6 — objtool: Support retpoline jump detection for vmlinux.o (3 weeks ago) 8145ea268f16 — objtool: Fix ".cold" section suffix check for newer versions of GCC (3 weeks ago) b3dfca472514 — objtool: Fix retpoline detection in asm code (3 weeks ago) b82402fa5211 — objtool: Fix error handling for STD/CLD warnings (3 weeks ago) 1f02defb4b79 — objtool: Fix seg fault in BT_FUNC() with fake jump (3 weeks ago) 2c85ebc57b3e — Linux 5.10 (4 weeks ago)
On Sat, Jan 9, 2021 at 5:07 PM Josh Poimboeuf <jpoimboe@redhat.com> wrote: > > On Sat, Jan 09, 2021 at 04:46:21PM +0100, Sedat Dilek wrote: > > On Sat, Jan 9, 2021 at 4:36 PM Josh Poimboeuf <jpoimboe@redhat.com> wrote: > > > > > > On Sat, Jan 09, 2021 at 03:54:20PM +0100, Sedat Dilek wrote: > > > > I am interested in having Clang LTO (Clang-CFI) for x86-64 working and > > > > help with testing. > > > > > > > > I tried the Git tree mentioned in [3] <jpoimboe.git#objtool-vmlinux> > > > > (together with changes from <peterz.git#x86/urgent>). > > > > > > > > I only see in my build-log... > > > > > > > > drivers/gpu/drm/i915/gem/i915_gem_execbuffer.o: warning: objtool: > > > > eb_relocate_parse_slow()+0x3d0: stack state mismatch: cfa1=7+120 > > > > cfa2=-1+0 > > > > drivers/gpu/drm/i915/gem/i915_gem_execbuffer.o: warning: objtool: > > > > eb_copy_relocations()+0x229: stack state mismatch: cfa1=7+120 > > > > cfa2=-1+0 > > > > > > > > ...which was reported and worked on in [1]. > > > > > > > > This is with Clang-IAS version 11.0.1. > > > > > > > > Unfortunately, the recent changes in <samitolvanen.github#clang-cfi> > > > > do not cleanly apply with Josh stuff. > > > > My intention/wish was to report this combination of patchsets "heals" > > > > a lot of objtool-warnings for vmlinux.o I observed with Clang-CFI. > > > > > > > > Is it possible to have a Git branch where Josh's objtool-vmlinux is > > > > working together with Clang-LTO? > > > > For testing purposes. > > > > > > I updated my branch with my most recent work from before the holidays, > > > can you try it now? It still doesn't fix any of the crypto warnings, > > > but I'll do that in a separate set after posting these next week. > > > > > > > Thanks, Josh. > > > > Did you push it (oh ah push it push it really really really good...) > > to your remote Git please :-). > > I thought I already pushed it pretty good ;-) do you not see it? > > git://git.kernel.org/pub/scm/linux/kernel/git/jpoimboe/linux.git objtool-vmlinux > > d6baee244f2d — objtool: Alphabetize usage option list (3 weeks ago) > c0b2a6a625ac — objtool: Separate vmlinux/noinstr validation config options (3 weeks ago) > 84c53551ad17 — objtool: Enable full vmlinux validation (3 weeks ago) > e518ac0801cd — x86/power: Support objtool validation in hibernate_asm_64.S (3 weeks ago) > d0ac4c7301c1 — x86/power: Move restore_registers() to top of the file (3 weeks ago) > d3389bc83538 — x86/power: Convert indirect jumps to retpolines (3 weeks ago) > 7a974d90aa40 — x86/acpi: Support objtool validation in wakeup_64.S (3 weeks ago) > 6693e26cd6cc — x86/acpi: Convert indirect jump to retpoline (3 weeks ago) > 0dfb760c74d1 — x86/ftrace: Support objtool vmlinux.o validation in ftrace_64.S (3 weeks ago) > 89a4febfd7bf — x86/xen/pvh: Convert indirect jump to retpoline (3 weeks ago) > b62837092140 — x86/xen: Support objtool vmlinux.o validation in xen-head.S (3 weeks ago) > 705e18481ed9 — x86/xen: Support objtool validation in xen-asm.S (3 weeks ago) > 3548319e21b9 — objtool: Add xen_start_kernel() to noreturn list (3 weeks ago) > 6016e8da8c3d — objtool: Combine UNWIND_HINT_RET_OFFSET and UNWIND_HINT_FUNC (3 weeks ago) > 56d6a7aee8b1 — objtool: Add asm version of STACK_FRAME_NON_STANDARD (3 weeks ago) > 68259d951f1a — objtool: Assume only ELF functions do sibling calls (3 weeks ago) > 0d6c8816cf91 — x86/ftrace: Add UNWIND_HINT_FUNC annotation for ftrace_stub (3 weeks ago) > 24d6ce8cd8f6 — objtool: Support retpoline jump detection for vmlinux.o (3 weeks ago) > 8145ea268f16 — objtool: Fix ".cold" section suffix check for newer versions of GCC (3 weeks ago) > b3dfca472514 — objtool: Fix retpoline detection in asm code (3 weeks ago) > b82402fa5211 — objtool: Fix error handling for STD/CLD warnings (3 weeks ago) > 1f02defb4b79 — objtool: Fix seg fault in BT_FUNC() with fake jump (3 weeks ago) > 2c85ebc57b3e — Linux 5.10 (4 weeks ago) > I already have this one in my patch-series - I hoped you pushed something new to your objtool-vmlinux Git branch. That is what I mean by shortened... <jpoimboe.git#objtool-vmlinux>. Hey, it's based on Linux v5.10 - I can test this with Linux v5.10.6 :-). - Sedat -
> > > Did you push it (oh ah push it push it really really really good...) > > > to your remote Git please :-). > > > > I thought I already pushed it pretty good ;-) do you not see it? > > > > git://git.kernel.org/pub/scm/linux/kernel/git/jpoimboe/linux.git objtool-vmlinux > > > > d6baee244f2d — objtool: Alphabetize usage option list (3 weeks ago) > > c0b2a6a625ac — objtool: Separate vmlinux/noinstr validation config options (3 weeks ago) > > 84c53551ad17 — objtool: Enable full vmlinux validation (3 weeks ago) > > e518ac0801cd — x86/power: Support objtool validation in hibernate_asm_64.S (3 weeks ago) > > d0ac4c7301c1 — x86/power: Move restore_registers() to top of the file (3 weeks ago) > > d3389bc83538 — x86/power: Convert indirect jumps to retpolines (3 weeks ago) > > 7a974d90aa40 — x86/acpi: Support objtool validation in wakeup_64.S (3 weeks ago) > > 6693e26cd6cc — x86/acpi: Convert indirect jump to retpoline (3 weeks ago) > > 0dfb760c74d1 — x86/ftrace: Support objtool vmlinux.o validation in ftrace_64.S (3 weeks ago) > > 89a4febfd7bf — x86/xen/pvh: Convert indirect jump to retpoline (3 weeks ago) > > b62837092140 — x86/xen: Support objtool vmlinux.o validation in xen-head.S (3 weeks ago) > > 705e18481ed9 — x86/xen: Support objtool validation in xen-asm.S (3 weeks ago) > > 3548319e21b9 — objtool: Add xen_start_kernel() to noreturn list (3 weeks ago) > > 6016e8da8c3d — objtool: Combine UNWIND_HINT_RET_OFFSET and UNWIND_HINT_FUNC (3 weeks ago) > > 56d6a7aee8b1 — objtool: Add asm version of STACK_FRAME_NON_STANDARD (3 weeks ago) > > 68259d951f1a — objtool: Assume only ELF functions do sibling calls (3 weeks ago) > > 0d6c8816cf91 — x86/ftrace: Add UNWIND_HINT_FUNC annotation for ftrace_stub (3 weeks ago) > > 24d6ce8cd8f6 — objtool: Support retpoline jump detection for vmlinux.o (3 weeks ago) > > 8145ea268f16 — objtool: Fix ".cold" section suffix check for newer versions of GCC (3 weeks ago) > > b3dfca472514 — objtool: Fix retpoline detection in asm code (3 weeks ago) > > b82402fa5211 — objtool: Fix error handling for STD/CLD warnings (3 weeks ago) > > 1f02defb4b79 — objtool: Fix seg fault in BT_FUNC() with fake jump (3 weeks ago) > > 2c85ebc57b3e — Linux 5.10 (4 weeks ago) > > > > I already have this one in my patch-series - I hoped you pushed > something new to your objtool-vmlinux Git branch. > That is what I mean by shortened... <jpoimboe.git#objtool-vmlinux>. > > Hey, it's based on Linux v5.10 - I can test this with Linux v5.10.6 :-). This is the most recent version of the patches. I only pushed them this morning since you said the prior version wasn't applying on Sami's clang-cfi branch. This version rebases fine on 'clang-cfi'.
On Sat, Jan 9, 2021 at 5:33 PM Josh Poimboeuf <jpoimboe@redhat.com> wrote: > > > > > Did you push it (oh ah push it push it really really really good...) > > > > to your remote Git please :-). > > > > > > I thought I already pushed it pretty good ;-) do you not see it? > > > > > > git://git.kernel.org/pub/scm/linux/kernel/git/jpoimboe/linux.git objtool-vmlinux > > > > > > d6baee244f2d — objtool: Alphabetize usage option list (3 weeks ago) > > > c0b2a6a625ac — objtool: Separate vmlinux/noinstr validation config options (3 weeks ago) > > > 84c53551ad17 — objtool: Enable full vmlinux validation (3 weeks ago) > > > e518ac0801cd — x86/power: Support objtool validation in hibernate_asm_64.S (3 weeks ago) > > > d0ac4c7301c1 — x86/power: Move restore_registers() to top of the file (3 weeks ago) > > > d3389bc83538 — x86/power: Convert indirect jumps to retpolines (3 weeks ago) > > > 7a974d90aa40 — x86/acpi: Support objtool validation in wakeup_64.S (3 weeks ago) > > > 6693e26cd6cc — x86/acpi: Convert indirect jump to retpoline (3 weeks ago) > > > 0dfb760c74d1 — x86/ftrace: Support objtool vmlinux.o validation in ftrace_64.S (3 weeks ago) > > > 89a4febfd7bf — x86/xen/pvh: Convert indirect jump to retpoline (3 weeks ago) > > > b62837092140 — x86/xen: Support objtool vmlinux.o validation in xen-head.S (3 weeks ago) > > > 705e18481ed9 — x86/xen: Support objtool validation in xen-asm.S (3 weeks ago) > > > 3548319e21b9 — objtool: Add xen_start_kernel() to noreturn list (3 weeks ago) > > > 6016e8da8c3d — objtool: Combine UNWIND_HINT_RET_OFFSET and UNWIND_HINT_FUNC (3 weeks ago) > > > 56d6a7aee8b1 — objtool: Add asm version of STACK_FRAME_NON_STANDARD (3 weeks ago) > > > 68259d951f1a — objtool: Assume only ELF functions do sibling calls (3 weeks ago) > > > 0d6c8816cf91 — x86/ftrace: Add UNWIND_HINT_FUNC annotation for ftrace_stub (3 weeks ago) > > > 24d6ce8cd8f6 — objtool: Support retpoline jump detection for vmlinux.o (3 weeks ago) > > > 8145ea268f16 — objtool: Fix ".cold" section suffix check for newer versions of GCC (3 weeks ago) > > > b3dfca472514 — objtool: Fix retpoline detection in asm code (3 weeks ago) > > > b82402fa5211 — objtool: Fix error handling for STD/CLD warnings (3 weeks ago) > > > 1f02defb4b79 — objtool: Fix seg fault in BT_FUNC() with fake jump (3 weeks ago) > > > 2c85ebc57b3e — Linux 5.10 (4 weeks ago) > > > > > > > I already have this one in my patch-series - I hoped you pushed > > something new to your objtool-vmlinux Git branch. > > That is what I mean by shortened... <jpoimboe.git#objtool-vmlinux>. > > > > Hey, it's based on Linux v5.10 - I can test this with Linux v5.10.6 :-). > > This is the most recent version of the patches. I only pushed them this > morning since you said the prior version wasn't applying on Sami's > clang-cfi branch. This version rebases fine on 'clang-cfi'. > I tried merging with clang-cfi Git which is based on Linux v5.11-rc2+ with a lot of merge conflicts. Did you try on top of cfi-10 Git tag which is based on Linux v5.10? Whatever you successfully did... Can you give me a step-by-step instruction? - Sedat -
On Sat, Jan 09, 2021 at 05:45:47PM +0100, Sedat Dilek wrote: > I tried merging with clang-cfi Git which is based on Linux v5.11-rc2+ > with a lot of merge conflicts. > > Did you try on top of cfi-10 Git tag which is based on Linux v5.10? > > Whatever you successfully did... Can you give me a step-by-step instruction? Oops, my bad. My last three commits (which I just added) do conflict. Sorry for the confusion. Just drop my last three commits: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/jpoimboe/linux.git objtool-vmlinux git checkout -B tmp FETCH_HEAD git reset --hard HEAD~~~ git fetch https://github.com/samitolvanen/linux clang-lto git rebase --onto FETCH_HEAD 79881bfc57be
On Sat, Jan 09, 2021 at 11:03:57AM -0600, Josh Poimboeuf wrote: > On Sat, Jan 09, 2021 at 05:45:47PM +0100, Sedat Dilek wrote: > > I tried merging with clang-cfi Git which is based on Linux v5.11-rc2+ > > with a lot of merge conflicts. > > > > Did you try on top of cfi-10 Git tag which is based on Linux v5.10? > > > > Whatever you successfully did... Can you give me a step-by-step instruction? > > Oops, my bad. My last three commits (which I just added) do conflict. > Sorry for the confusion. > > Just drop my last three commits: > > git fetch https://git.kernel.org/pub/scm/linux/kernel/git/jpoimboe/linux.git objtool-vmlinux > git checkout -B tmp FETCH_HEAD > git reset --hard HEAD~~~ > git fetch https://github.com/samitolvanen/linux clang-lto > git rebase --onto FETCH_HEAD 79881bfc57be Last one should be: git rebase --onto FETCH_HEAD 2c85ebc57b3e
On Sat, Jan 9, 2021 at 6:06 PM Josh Poimboeuf <jpoimboe@redhat.com> wrote: > > On Sat, Jan 09, 2021 at 11:03:57AM -0600, Josh Poimboeuf wrote: > > On Sat, Jan 09, 2021 at 05:45:47PM +0100, Sedat Dilek wrote: > > > I tried merging with clang-cfi Git which is based on Linux v5.11-rc2+ > > > with a lot of merge conflicts. > > > > > > Did you try on top of cfi-10 Git tag which is based on Linux v5.10? > > > > > > Whatever you successfully did... Can you give me a step-by-step instruction? > > > > Oops, my bad. My last three commits (which I just added) do conflict. > > Sorry for the confusion. > > > > Just drop my last three commits: > > > > git fetch https://git.kernel.org/pub/scm/linux/kernel/git/jpoimboe/linux.git objtool-vmlinux > > git checkout -B tmp FETCH_HEAD > > git reset --hard HEAD~~~ > > git fetch https://github.com/samitolvanen/linux clang-lto > > git rebase --onto FETCH_HEAD 79881bfc57be > > Last one should be: > > git rebase --onto FETCH_HEAD 2c85ebc57b3e > OK, that worked fine. So commit 2c85ebc57b3e is v5.10 Git tag in upstream. So, I substituted: git rebase --onto FETCH_HEAD v5.10 Thanks. - Sedat -
On Sat, Jan 9, 2021 at 6:06 PM Josh Poimboeuf <jpoimboe@redhat.com> wrote: > > On Sat, Jan 09, 2021 at 11:03:57AM -0600, Josh Poimboeuf wrote: > > On Sat, Jan 09, 2021 at 05:45:47PM +0100, Sedat Dilek wrote: > > > I tried merging with clang-cfi Git which is based on Linux v5.11-rc2+ > > > with a lot of merge conflicts. > > > > > > Did you try on top of cfi-10 Git tag which is based on Linux v5.10? > > > > > > Whatever you successfully did... Can you give me a step-by-step instruction? > > > > Oops, my bad. My last three commits (which I just added) do conflict. > > Sorry for the confusion. > > > > Just drop my last three commits: > > > > git fetch https://git.kernel.org/pub/scm/linux/kernel/git/jpoimboe/linux.git objtool-vmlinux > > git checkout -B tmp FETCH_HEAD > > git reset --hard HEAD~~~ > > git fetch https://github.com/samitolvanen/linux clang-lto > > git rebase --onto FETCH_HEAD 79881bfc57be > > Last one should be: > > git rebase --onto FETCH_HEAD 2c85ebc57b3e > Hi Josh, as said I tried your latest changes on top of Linux v5.10.6 + cfi-5.10. This reduces the objtool-warnings in vmlinux.o from 15 down to 2. Without your latest changes: $ grep 'vmlinux.o: warning: objtool:' build-log_5.10.4-3-amd64-clang11-cfi.txt | wc -l 15 $ grep 'vmlinux.o: warning: objtool:' build-log_5.10.4-3-amd64-clang11-cfi.txt vmlinux.o: warning: objtool: wakeup_long64()+0x61: indirect jump found in RETPOLINE build vmlinux.o: warning: objtool: .text+0x408a: indirect jump found in RETPOLINE build vmlinux.o: warning: objtool: .text+0x40c5: indirect jump found in RETPOLINE build vmlinux.o: warning: objtool: .head.text+0x298: indirect jump found in RETPOLINE build vmlinux.o: warning: objtool: __switch_to_asm()+0x0: undefined stack state vmlinux.o: warning: objtool: .entry.text+0xf91: sibling call from callable instruction with modified stack frame vmlinux.o: warning: objtool: .entry.text+0x16c4: unsupported instruction in callable function vmlinux.o: warning: objtool: .entry.text+0x15a4: redundant CLD vmlinux.o: warning: objtool: do_suspend_lowlevel()+0x116: sibling call from callable instruction with modified stack frame vmlinux.o: warning: objtool: kretprobe_trampoline()+0x49: return with modified stack frame vmlinux.o: warning: objtool: machine_real_restart()+0x85: unsupported instruction in callable function vmlinux.o: warning: objtool: __x86_retpoline_rdi()+0x0: stack state mismatch: cfa1=7+8 cfa2=-1+0 vmlinux.o: warning: objtool: .entry.text+0x48: stack state mismatch: cfa1=7-8 cfa2=-1+0 vmlinux.o: warning: objtool: .entry.text+0x156d: stack state mismatch: cfa1=7-8 cfa2=-1+0 vmlinux.o: warning: objtool: .entry.text+0x15fc: stack state mismatch: cfa1=7-8 cfa2=-1+0 With your latest changes in <jpoimboe.git#objtool-vmlinux>: $ grep 'vmlinux.o: warning: objtool:' build-log_5.10.6-1-amd64-clang11-cfi.txt | wc -l 2 $ grep 'vmlinux.o: warning: objtool:' build-log_5.10.6-1-amd64-clang11-cfi.txt vmlinux.o: warning: objtool: kretprobe_trampoline()+0x49: return with modified stack frame vmlinux.o: warning: objtool: machine_real_restart()+0x85: unsupported instruction in callable function Awesome. If you need further information, please let me know. Regards, - Sedat -