Allow CONFIG_LTO_CLANG to be enabled.
Signed-off-by: Sami Tolvanen
Reviewed-by: Kees Cook
Acked-by: Will Deacon
---
arch/arm64/Kconfig | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index cf7eaaa0fb2f..59abe44845f3 100644
--- a/arch/arm64/Kconfig
With CONFIG_LTO_CLANG, clang generates LLVM IR instead of ELF object
files. As empty.o is used for probing target properties, disable LTO
for it to produce an object file instead.
Signed-off-by: Sami Tolvanen
Reviewed-by: Kees Cook
---
scripts/mod/Makefile | 1 +
1 file changed, 1 insertion
LLD always splits sections with LTO, which increases module sizes. This
change adds linker script rules to merge the split sections in the final
module.
Suggested-by: Nick Desaulniers
Signed-off-by: Sami Tolvanen
Reviewed-by: Kees Cook
---
scripts/module.lds.S | 24
1
are used.
Signed-off-by: Sami Tolvanen
Reviewed-by: Kees Cook
---
include/linux/init.h | 31 +++
1 file changed, 27 insertions(+), 4 deletions(-)
diff --git a/include/linux/init.h b/include/linux/init.h
index d466bea7ecba..27b9478dcdef 100644
--- a/include/linux
Disable LTO for the vDSO by filtering out CC_FLAGS_LTO, as there's no
point in using link-time optimization for the small amount of C code.
Signed-off-by: Sami Tolvanen
Reviewed-by: Kees Cook
Acked-by: Will Deacon
---
arch/arm64/kernel/vdso/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1
when PREL32 relocations
are used.
Signed-off-by: Sami Tolvanen
Acked-by: Bjorn Helgaas
Reviewed-by: Kees Cook
---
include/linux/pci.h | 19 ++-
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 22207a79762c
they are all linked into vmlinux.o at
the same time.
Signed-off-by: Sami Tolvanen
Reviewed-by: Kees Cook
---
.gitignore | 1 +
Makefile | 3 ++-
arch/Kconfig | 1 -
scripts/Makefile.build | 33 +++--
scripts/Makefile.modpost
LLVM_IAS=1
To prepare for LTO support with other compilers, common parts are
gated behind the CONFIG_LTO option, and LTO can be disabled for
specific files by filtering out CC_FLAGS_LTO.
Signed-off-by: Sami Tolvanen
Reviewed-by: Kees Cook
---
Makefile | 19 ++-
arch
tion 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:
On Wed, Dec 9, 2020 at 4:36 AM Arnd Bergmann wrote:
>
> On Tue, Dec 8, 2020 at 1:15 PM Arnd Bergmann wrote:
> >
> > - one build seems to have dropped all symbols the string operations
> > from vmlinux,
> > so while the link goes through, modules cannot be loaded:
> > ERROR: modpost: "memmove"
On Tue, Dec 8, 2020 at 2:20 PM Arnd Bergmann wrote:
>
> On Tue, Dec 8, 2020 at 10:10 PM 'Nick Desaulniers' via Clang Built
> Linux wrote:
> >
> > On Tue, Dec 8, 2020 at 1:00 PM Arnd Bergmann wrote:
> > >
> > > On Tue, Dec 8, 2020 at 5:43 PM 'Sami Tolva
On Tue, Dec 8, 2020 at 1:02 PM Arnd Bergmann wrote:
>
> On Tue, Dec 8, 2020 at 9:59 PM Arnd Bergmann wrote:
> >
> > Attaching the config for "ld.lld: error: Never resolved function from
> > blockaddress (Producer: 'LLVM12.0.0' Reader: 'LLVM 12.0.0')"
>
> And here is a new one: "ld.lld: error:
On Tue, Dec 8, 2020 at 5:55 AM Arnd Bergmann wrote:
>
> On Tue, Dec 8, 2020 at 1:15 PM Arnd Bergmann wrote:
> > On Tue, Dec 1, 2020 at 10:37 PM 'Sami Tolvanen' via Clang Built Linux
> > wrote:
> >
> > - many builds complain about thousands of duplicate s
On Tue, Dec 8, 2020 at 4:15 AM Arnd Bergmann wrote:
>
> On Tue, Dec 1, 2020 at 10:37 PM 'Sami Tolvanen' via Clang Built Linux
> wrote:
> >
> > This patch series adds support for building the kernel with Clang's
> > Link Time Optimization (LTO). In addition
On Sat, Dec 5, 2020 at 10:50 PM Nathan Chancellor
wrote:
>
> On Fri, Dec 04, 2020 at 02:52:41PM -0800, Sami Tolvanen wrote:
> > On Thu, Dec 3, 2020 at 2:32 PM Nick Desaulniers
> > wrote:
> > >
> > > So I'd recommend to Sami to simply make the Kconfig als
On Thu, Dec 3, 2020 at 2:32 PM Nick Desaulniers wrote:
>
> So I'd recommend to Sami to simply make the Kconfig also depend on
> clang's integrated assembler (not just llvm-nm and llvm-ar).
Sure, sounds good to me. What's the preferred way to test for this in Kconfig?
It looks like actually
On Thu, Dec 3, 2020 at 10:00 AM Masahiro Yamada wrote:
>
> On Thu, Oct 15, 2020 at 7:50 AM Kees Cook wrote:
> >
> > On Mon, Oct 12, 2020 at 05:31:52PM -0700, Sami Tolvanen wrote:
> > > With LTO, llvm-nm prints out symbols for each archive member
> > >
ppen because
> scripts/gen_autoksyms.sh expects all undefined symbols are placed in
> the second line of .mod files.
>
> One possible way is to replace "xargs echo" with
> "sed ':x;N;$!bx;s/\n/ /g'" or something, but I rewrote the code by
> using awk because it is more re
On Thu, Dec 3, 2020 at 3:26 AM Will Deacon wrote:
>
> Hi Sami,
>
> On Tue, Dec 01, 2020 at 01:36:51PM -0800, Sami Tolvanen wrote:
> > This patch series adds support for building the kernel with Clang's
> > Link Time Optimization (LTO). In addition to performance, th
On Tue, Dec 1, 2020 at 6:43 PM Masahiro Yamada wrote:
>
> On Wed, Dec 2, 2020 at 2:31 AM Kees Cook wrote:
> >
> > On Mon, Nov 30, 2020 at 12:01:31PM +, Will Deacon wrote:
> > > Hi Sami,
> > >
> > > On Wed, Nov 18, 2020 at 02:07:14PM -0800, Sami T
Allow CONFIG_LTO_CLANG to be enabled.
Signed-off-by: Sami Tolvanen
Reviewed-by: Kees Cook
Acked-by: Will Deacon
---
arch/arm64/Kconfig | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index c7f07978f5b6..9d29c48ecd4f 100644
--- a/arch/arm64/Kconfig
On Tue, Dec 1, 2020 at 11:51 AM 'Nick Desaulniers' via Clang Built
Linux wrote:
>
> On Tue, Dec 1, 2020 at 9:31 AM Kees Cook wrote:
> >
> > On Mon, Nov 30, 2020 at 12:01:31PM +, Will Deacon wrote:
> > > Hi Sami,
> > >
> > > On Wed, Nov 18,
Disable LTO for rodata.o to allow objcopy to be used to
manipulate sections.
Signed-off-by: Sami Tolvanen
Acked-by: Kees Cook
---
drivers/misc/lkdtm/Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/misc/lkdtm/Makefile b/drivers/misc/lkdtm/Makefile
index c70b3822013f
work with LTO as we have LLVM bitcode
instead of ELF objects.
This change selects FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY, which
disables recordmcount when patchable function entries are used instead.
Signed-off-by: Sami Tolvanen
Acked-by: Will Deacon
---
arch/arm64/Kconfig | 2 ++
1 file
Disable LTO for the vDSO by filtering out CC_FLAGS_LTO, as there's no
point in using link-time optimization for the small amount of C code.
Signed-off-by: Sami Tolvanen
Reviewed-by: Kees Cook
Acked-by: Will Deacon
---
arch/arm64/kernel/vdso/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1
With CONFIG_LTO_CLANG, we produce LLVM bitcode instead of ELF object
files. Since LTO is not really needed here and the Makefile assumes we
produce an object file, disable LTO for libstub.
Signed-off-by: Sami Tolvanen
Reviewed-by: Kees Cook
---
drivers/firmware/efi/libstub/Makefile | 2 ++
1
With CONFIG_LTO_CLANG, clang generates LLVM IR instead of ELF object
files. As empty.o is used for probing target properties, disable LTO
for it to produce an object file instead.
Signed-off-by: Sami Tolvanen
Reviewed-by: Kees Cook
---
scripts/mod/Makefile | 1 +
1 file changed, 1 insertion
when PREL32 relocations
are used.
Signed-off-by: Sami Tolvanen
Acked-by: Bjorn Helgaas
Reviewed-by: Kees Cook
---
include/linux/pci.h | 19 ++-
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 22207a79762c
Wendling
Signed-off-by: Sami Tolvanen
Reviewed-by: Kees Cook
---
scripts/mod/modpost.c| 16 +++-
scripts/mod/modpost.h| 9 +
scripts/mod/sumversion.c | 6 +-
3 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/scripts/mod/modpost.c b/scripts/mod
script
that specifies the same order for initcalls that we would have without
LTO. With LTO enabled, the script is called in link-vmlinux.sh through
jobserver-exec to limit the number of jobs spawned.
Signed-off-by: Sami Tolvanen
Reviewed-by: Kees Cook
---
include/linux/init.h | 52
are used.
Signed-off-by: Sami Tolvanen
Reviewed-by: Kees Cook
---
include/linux/init.h | 31 +++
1 file changed, 27 insertions(+), 4 deletions(-)
diff --git a/include/linux/init.h b/include/linux/init.h
index d466bea7ecba..27b9478dcdef 100644
--- a/include/linux
LLD always splits sections with LTO, which increases module sizes. This
change adds linker script rules to merge the split sections in the final
module.
Suggested-by: Nick Desaulniers
Signed-off-by: Sami Tolvanen
Reviewed-by: Kees Cook
---
scripts/module.lds.S | 24
1
and split the dependency list to
multiple lines, which results in used symbols getting trimmed.
This change removes duplicate dependencies, which will reduce the
probability of this happening and makes .mod files smaller and
easier to read.
Signed-off-by: Sami Tolvanen
Reviewed-by: Kees Cook
defconfig, we found that a limit of 5 is a
reasonable compromise between performance and binary size, reducing the
size of a stripped vmlinux by 11%.
Suggested-by: George Burgess IV
Signed-off-by: Sami Tolvanen
Reviewed-by: Kees Cook
---
Makefile | 3 +++
1 file changed, 3 insertions(+)
diff
they are all linked into vmlinux.o at
the same time.
Signed-off-by: Sami Tolvanen
Reviewed-by: Kees Cook
---
.gitignore | 1 +
Makefile | 3 ++-
arch/Kconfig | 1 -
scripts/Makefile.build | 33 +++--
scripts/Makefile.modpost
in a different
environment.
Signed-off-by: Sami Tolvanen
---
Makefile | 20
kernel/trace/Kconfig | 16
scripts/Makefile.build | 6 ++
3 files changed, 26 insertions(+), 16 deletions(-)
diff --git a/Makefile b/Makefile
index 43ecedeb3f02
LLVM tools must be used:
CC=clang LD=ld.lld AR=llvm-ar NM=llvm-nm
To prepare for LTO support with other compilers, common parts are
gated behind the CONFIG_LTO option, and LTO can be disabled for
specific files by filtering out CC_FLAGS_LTO.
Signed-off-by: Sami Tolvanen
Reviewed-by: Kees Cook
ies
and replaced recordmcount with the objtool pass to avoid
whitelisting relocations that are not calls.
- Updated several commit messages with better explanations.
Sami Tolvanen (17):
tracing: move function tracer options to Kconfig
kbuild: add support for Clang LTO
kbuild: lto: fix mod
On Tue, Dec 1, 2020 at 3:40 AM Will Deacon wrote:
>
> On Mon, 30 Nov 2020 15:34:40 -0800, Sami Tolvanen wrote:
> > As discussed a few months ago [1][2], virtually mapped shadow call stacks
> > are better for safety and robustness. This series dusts off the VMAP
> > opti
The following commit has been merged into the x86/misc branch of tip:
Commit-ID: 83321c335dccba262a57378361d63da96b8166d6
Gitweb:
https://git.kernel.org/tip/83321c335dccba262a57378361d63da96b8166d6
Author:Sami Tolvanen
AuthorDate:Mon, 30 Nov 2020 11:39:00 -08:00
Committer
On Mon, Nov 30, 2020 at 3:52 AM Will Deacon wrote:
>
> On Wed, Nov 18, 2020 at 02:07:28PM -0800, Sami Tolvanen wrote:
> > Disable LTO for the vDSO by filtering out CC_FLAGS_LTO, as there's no
> > point in using link-time optimization for the small about of C code.
>
> &qu
/sdei.c,
and removed the now unneeded scs.c.
Sami Tolvanen (2):
scs: switch to vmapped shadow stacks
arm64: scs: use vmapped IRQ and SDEI shadow stacks
arch/arm64/kernel/Makefile | 1 -
arch/arm64/kernel/entry.S | 6 ++--
arch/arm64/kernel/irq.c| 19 ++
arch/arm64/kernel/scs.c
Use scs_alloc() to allocate also IRQ and SDEI shadow stacks instead of
using statically allocated stacks.
Signed-off-by: Sami Tolvanen
Acked-by: Will Deacon
---
arch/arm64/kernel/Makefile | 1 -
arch/arm64/kernel/entry.S | 6 ++--
arch/arm64/kernel/irq.c| 19 +++
arch/arm64
shadow stack size to a full page and provides
more robust overflow detection, similarly to VMAP_STACK.
Signed-off-by: Sami Tolvanen
Acked-by: Will Deacon
---
include/linux/scs.h | 12
kernel/scs.c| 71 ++---
2 files changed, 66 insertions
On Mon, Nov 30, 2020 at 3:49 AM Will Deacon wrote:
>
> On Tue, Nov 24, 2020 at 11:59:40AM -0800, Sami Tolvanen wrote:
> > Use scs_alloc() to allocate also IRQ and SDEI shadow stacks instead of
> > using statically allocated stacks.
> >
> > Signed-off-by: Sami Tol
On Mon, Nov 30, 2020 at 3:44 AM Will Deacon wrote:
>
> On Tue, Nov 24, 2020 at 11:59:39AM -0800, Sami Tolvanen wrote:
> > +void *scs_alloc(int node)
> > {
> > - void *s = kmem_cache_alloc_node(scs_cache, GFP_SCS, node);
> > + int i;
> > + vo
-by: Sami Tolvanen
---
arch/x86/pci/mmconfig-shared.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c
index 6fa42e9c4e6f..234998f196d4 100644
--- a/arch/x86/pci/mmconfig-shared.c
+++ b/arch/x86/pci/mmconfig
On Fri, Nov 27, 2020 at 4:15 AM Borislav Petkov wrote:
> I think the proper fix is to fix the typedef to:
>
> typedef bool (*check_reserved_t)(u64 start, u64 end, enum e820_type
> type);
>
> because
>
> * is_mmconf_reserved() is passing in E820_TYPE_RESERVED which is enum
> e820_type
>
Use scs_alloc() to allocate also IRQ and SDEI shadow stacks instead of
using statically allocated stacks.
Signed-off-by: Sami Tolvanen
---
arch/arm64/kernel/Makefile | 1 -
arch/arm64/kernel/entry.S | 6 ++--
arch/arm64/kernel/irq.c| 19 ++
arch/arm64/kernel/scs.c| 16
() to scs_alloc() when using a cached
shadow stack instead of calling it in scs_free().
- Added a comment to scs_free().
- Moved arm64 IRQ and SDEI shadow stack initialization to irq/sdei.c,
and removed the now unneeded scs.c.
Sami Tolvanen (2):
scs: switch to vmapped shadow stacks
arm64: scs
shadow stack size to a full page and provides
more robust overflow detection, similarly to VMAP_STACK.
Signed-off-by: Sami Tolvanen
---
include/linux/scs.h | 12 -
kernel/scs.c| 66 +
2 files changed, 61 insertions(+), 17 deletions(-)
diff
On Mon, Nov 23, 2020 at 2:21 AM David Brazdil wrote:
>
> Hey Sami,
>
> On Wed, Nov 18, 2020 at 02:07:29PM -0800, Sami Tolvanen wrote:
> > We use objcopy to manipulate ELF binaries for the nVHE code,
> > which fails with LTO as the compiler produces LLVM bitcode
On Fri, Nov 20, 2020 at 3:59 PM Kees Cook wrote:
>
> On Fri, Nov 20, 2020 at 12:58:41PM -0800, Sami Tolvanen wrote:
> > On Fri, Nov 20, 2020 at 12:43 PM Kees Cook wrote:
> > >
> > > On Fri, Nov 20, 2020 at 01:29:35PM -0700, Nathan Chancellor wrote:
> > &g
On Fri, Nov 20, 2020 at 12:43 PM Kees Cook wrote:
>
> On Fri, Nov 20, 2020 at 01:29:35PM -0700, Nathan Chancellor wrote:
> > On Fri, Nov 20, 2020 at 11:47:21AM -0800, Kees Cook wrote:
> > > On Fri, Nov 20, 2020 at 08:23:11AM -0800, Sami Tolvanen wrote:
> > >
On Thu, Nov 19, 2020 at 8:04 PM Josh Poimboeuf wrote:
>
> On Wed, Nov 18, 2020 at 02:07:14PM -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
>
On Thu, Nov 19, 2020 at 5:00 AM Will Deacon wrote:
>
> Hi Sami,
>
> On Thu, Oct 22, 2020 at 01:23:54PM -0700, Sami Tolvanen wrote:
> > The kernel currently uses kmem_cache to allocate shadow call stacks,
> > which means an overflow may not be immediately detected and ca
On Wed, Nov 18, 2020 at 3:49 PM Nick Desaulniers
wrote:
>
> On Wed, Nov 18, 2020 at 2:07 PM Sami Tolvanen wrote:
> >
> > This change adds build system support for Clang's Link Time
> > Optimization (LTO). With -flto, instead of ELF object files, Clang
> > produces L
The following commit has been merged into the perf/urgent branch of tip:
Commit-ID: ebd19fc372e3e78bf165f230e7c084e304441c08
Gitweb:
https://git.kernel.org/tip/ebd19fc372e3e78bf165f230e7c084e304441c08
Author:Sami Tolvanen
AuthorDate:Fri, 13 Nov 2020 10:31:26 -08:00
when PREL32 relocations
are used.
Signed-off-by: Sami Tolvanen
Acked-by: Bjorn Helgaas
Reviewed-by: Kees Cook
---
include/linux/pci.h | 19 ++-
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 22207a79762c
Wendling
Signed-off-by: Sami Tolvanen
Reviewed-by: Kees Cook
---
scripts/mod/modpost.c| 16 +++-
scripts/mod/modpost.h| 9 +
scripts/mod/sumversion.c | 6 +-
3 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/scripts/mod/modpost.c b/scripts/mod
work with LTO as we have LLVM bitcode
instead of ELF objects.
This change selects FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY, which
disables recordmcount when patchable function entries are used instead.
Signed-off-by: Sami Tolvanen
---
arch/arm64/Kconfig | 2 ++
1 file changed, 2 insertions
Allow CONFIG_LTO_CLANG and CONFIG_THINLTO to be enabled.
Signed-off-by: Sami Tolvanen
Reviewed-by: Kees Cook
---
arch/arm64/Kconfig | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index c7f07978f5b6..56bd83a764f4 100644
--- a/arch/arm64/Kconfig
We use objcopy to manipulate ELF binaries for the nVHE code,
which fails with LTO as the compiler produces LLVM bitcode
instead. Disable LTO for this code to allow objcopy to be used.
Signed-off-by: Sami Tolvanen
Reviewed-by: Kees Cook
---
arch/arm64/kvm/hyp/nvhe/Makefile | 4 ++--
1 file
With CONFIG_LTO_CLANG, we produce LLVM bitcode instead of ELF object
files. Since LTO is not really needed here and the Makefile assumes we
produce an object file, disable LTO for libstub.
Signed-off-by: Sami Tolvanen
Reviewed-by: Kees Cook
---
drivers/firmware/efi/libstub/Makefile | 2 ++
1
Disable LTO for rodata.o to allow objcopy to be used to
manipulate sections.
Signed-off-by: Sami Tolvanen
Acked-by: Kees Cook
---
drivers/misc/lkdtm/Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/misc/lkdtm/Makefile b/drivers/misc/lkdtm/Makefile
index c70b3822013f
Disable LTO for the vDSO by filtering out CC_FLAGS_LTO, as there's no
point in using link-time optimization for the small about of C code.
Signed-off-by: Sami Tolvanen
Reviewed-by: Kees Cook
---
arch/arm64/kernel/vdso/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git
are used.
Signed-off-by: Sami Tolvanen
Reviewed-by: Kees Cook
---
include/linux/init.h | 31 +++
1 file changed, 27 insertions(+), 4 deletions(-)
diff --git a/include/linux/init.h b/include/linux/init.h
index d466bea7ecba..27b9478dcdef 100644
--- a/include/linux
With CONFIG_LTO_CLANG, clang generates LLVM IR instead of ELF object
files. As empty.o is used for probing target properties, disable LTO
for it to produce an object file instead.
Signed-off-by: Sami Tolvanen
Reviewed-by: Kees Cook
---
scripts/mod/Makefile | 1 +
1 file changed, 1 insertion
script
that specifies the same order for initcalls that we would have without
LTO. With LTO enabled, the script is called in link-vmlinux.sh through
jobserver-exec to limit the number of jobs spawned.
Signed-off-by: Sami Tolvanen
Reviewed-by: Kees Cook
---
include/linux/init.h | 52
LLD always splits sections with LTO, which increases module sizes. This
change adds linker script rules to merge the split sections in the final
module.
Suggested-by: Nick Desaulniers
Signed-off-by: Sami Tolvanen
Reviewed-by: Kees Cook
---
scripts/module.lds.S | 24
1
and split the dependency list to
multiple lines, which results in used symbols getting trimmed.
This change removes duplicate dependencies, which will reduce the
probability of this happening and makes .mod files smaller and
easier to read.
Signed-off-by: Sami Tolvanen
Reviewed-by: Kees Cook
defconfig, we found that a limit of 5 is a
reasonable compromise between performance and binary size, reducing the
size of a stripped vmlinux by 11%.
Suggested-by: George Burgess IV
Signed-off-by: Sami Tolvanen
Reviewed-by: Kees Cook
---
Makefile | 3 +++
1 file changed, 3 insertions(+)
diff
they are all linked into vmlinux.o at
the same time.
Signed-off-by: Sami Tolvanen
Reviewed-by: Kees Cook
---
.gitignore | 1 +
Makefile | 3 ++-
arch/Kconfig | 1 -
scripts/Makefile.build | 33 +++--
scripts/Makefile.modpost
LLVM tools must be used:
CC=clang LD=ld.lld AR=llvm-ar NM=llvm-nm
To prepare for LTO support with other compilers, common parts are
gated behind the CONFIG_LTO option, and LTO can be disabled for
specific files by filtering out CC_FLAGS_LTO.
Signed-off-by: Sami Tolvanen
Reviewed-by: Kees Cook
in a different
environment.
Signed-off-by: Sami Tolvanen
---
Makefile | 20
kernel/trace/Kconfig | 16
scripts/Makefile.build | 6 ++
3 files changed, 26 insertions(+), 16 deletions(-)
diff --git a/Makefile b/Makefile
index e2c3f65c4721
ies
and replaced recordmcount with the objtool pass to avoid
whitelisting relocations that are not calls.
- Updated several commit messages with better explanations.
Sami Tolvanen (17):
tracing: move function tracer options to Kconfig
kbuild: add support for Clang LTO
kbuild: lto:
On Tue, Nov 17, 2020 at 1:45 PM Kees Cook wrote:
>
> On Tue, Nov 17, 2020 at 12:59:02PM -0800, Sami Tolvanen wrote:
> > Instead of casting callback functions to type iw_handler, which trips
> > indirect call checking with Clang's Control-Flow Integrity (CFI), add
Instead of casting callback functions to type iw_handler, which trips
indirect call checking with Clang's Control-Flow Integrity (CFI), add
stub functions with the correct function type for the callbacks.
Reported-by: Sedat Dilek
Signed-off-by: Sami Tolvanen
---
net/wireless/wext-compat.c
On Mon, Nov 16, 2020 at 1:18 PM Steven Rostedt wrote:
>
> On Mon, 16 Nov 2020 13:10:57 -0800
> Sami Tolvanen wrote:
>
> > Clang doesn't warn about this as we're building a module, it just
> > generates a reference to a non-existing global "my_tramp" symbol,
>
On Mon, Nov 16, 2020 at 12:38 PM Steven Rostedt wrote:
>
> On Mon, 16 Nov 2020 12:10:10 -0800
> Sami Tolvanen wrote:
>
> > On Mon, Nov 16, 2020 at 8:39 AM Steven Rostedt wrote:
> > >
> > > On Fri, 13 Nov 2020 10:34:14 -0800
> > > Sami Tolvanen wr
On Mon, Nov 16, 2020 at 8:39 AM Steven Rostedt wrote:
>
> On Fri, 13 Nov 2020 10:34:14 -0800
> Sami Tolvanen wrote:
>
> > my_tramp[12]? are declared as global functions in C, but they are not
> > marked global in the inline assembly definition. This mismatch confuses
Use unsigned int instead of raw unsigned in check_reserved_t to follow
the kernel's style guidelines.
Signed-off-by: Sami Tolvanen
---
arch/x86/pci/mmconfig-shared.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig
to unsigned to fix
the type mismatch.
Reported-by: Sedat Dilek
Signed-off-by: Sami Tolvanen
---
arch/x86/include/asm/e820/api.h | 2 +-
arch/x86/kernel/e820.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/include/asm/e820/api.h b/arch/x86/include/asm/e820
On Fri, Nov 13, 2020 at 2:34 PM Josh Poimboeuf wrote:
>
> On Fri, Nov 13, 2020 at 12:24:32PM -0800, Sami Tolvanen wrote:
> > > I still don't see this warning for some reason.
> >
> > Do you have CONFIG_XEN enabled? I can reproduce this on ToT master as
> > foll
On Fri, Nov 13, 2020 at 2:34 PM Josh Poimboeuf wrote:
>
> On Fri, Nov 13, 2020 at 12:24:32PM -0800, Sami Tolvanen wrote:
> > > I still don't see this warning for some reason.
> >
> > Do you have CONFIG_XEN enabled? I can reproduce this on ToT master as
> > foll
On Fri, Nov 13, 2020 at 11:54 AM Josh Poimboeuf wrote:
>
> On Tue, Nov 10, 2020 at 10:59:55AM -0800, Sami Tolvanen wrote:
> > On Tue, Nov 10, 2020 at 9:46 AM Josh Poimboeuf wrote:
> > >
> > > On Mon, Nov 09, 2020 at 08:29:24PM -0600, Josh Poimboeuf wrote:
> &g
On Fri, Nov 13, 2020 at 10:35 AM Randy Dunlap wrote:
>
> On 11/13/20 10:26 AM, Sami Tolvanen wrote:
> > e820__mapped_all is passed as a callback to is_mmconf_reserved, which
> > expects a function of type:
> >
> > typedef bool (*check_reserved_t)(u64
my_tramp[12]? are declared as global functions in C, but they are not
marked global in the inline assembly definition. This mismatch confuses
Clang's Control-Flow Integrity checking. Fix the definitions by adding
.globl.
Signed-off-by: Sami Tolvanen
---
samples/ftrace/ftrace-direct-modify.c | 2
This change switches rapl to use PMU_FORMAT_ATTR, and fixes two other
macros to use device_attribute instead of kobj_attribute to avoid
callback type mismatches that trip indirect call checking with Clang's
Control-Flow Integrity (CFI).
Reported-by: Sedat Dilek
Signed-off-by: Sami Tolvanen
to unsigned to fix
the type mismatch.
Reported-by: Sedat Dilek
Signed-off-by: Sami Tolvanen
---
arch/x86/include/asm/e820/api.h | 2 +-
arch/x86/kernel/e820.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/include/asm/e820/api.h b/arch/x86/include/asm/e820
On Tue, Nov 10, 2020 at 9:46 AM Josh Poimboeuf wrote:
>
> On Mon, Nov 09, 2020 at 08:29:24PM -0600, Josh Poimboeuf wrote:
> > On Mon, Nov 09, 2020 at 03:11:41PM -0800, Sami Tolvanen wrote:
> > > CONFIG_XEN
> > >
> > > __swi
On Mon, Nov 9, 2020 at 6:29 PM Josh Poimboeuf wrote:
> How would I recreate all these warnings?
You can reproduce all of these using a normal gcc build without any of
the LTO patches by running objtool check -arfld vmlinux.o. However,
with gcc you'll see even more warnings due to duplicate
On Fri, Oct 23, 2020 at 10:36 AM Sami Tolvanen wrote:
>
> On Wed, Oct 21, 2020 at 05:22:59PM -0700, Sami Tolvanen wrote:
> > There are a couple of differences, like the first "undefined stack
> > state" warning pointing to set_bringup_idt_handler.constprop.0()
> &g
On Thu, Oct 22, 2020 at 09:25:53AM +0200, Peter Zijlstra wrote:
> On Wed, Oct 21, 2020 at 04:27:47PM -0500, Josh Poimboeuf wrote:
> > On Wed, Oct 21, 2020 at 11:32:13AM +0200, Peter Zijlstra wrote:
> > > On Wed, Oct 21, 2020 at 10:56:06AM +0200, Peter Zijlstra wrote:
> > >
> > > > I do not see
On Wed, Oct 21, 2020 at 05:22:59PM -0700, Sami Tolvanen wrote:
> There are a couple of differences, like the first "undefined stack
> state" warning pointing to set_bringup_idt_handler.constprop.0()
> instead of __switch_to_asm(). I tried running this with --backtrace,
>
Use scs_alloc() to allocate also IRQ and SDEI shadow stacks instead of
using statically allocated stacks.
Signed-off-by: Sami Tolvanen
---
arch/arm64/include/asm/scs.h | 21 ++-
arch/arm64/kernel/entry.S| 6 ++--
arch/arm64/kernel/irq.c | 2 ++
arch/arm64/kernel/scs.c
://lore.kernel.org/lkml/20200515172355.GD23334@willie-the-truck/
[2] https://lore.kernel.org/lkml/20200427220942.gb80...@google.com/
Sami Tolvanen (2):
scs: switch to vmapped shadow stacks
arm64: scs: use vmapped IRQ and SDEI shadow stacks
arch/arm64/include/asm/scs.h | 21 ++-
arch
size to a full page and provides more
robust overflow detection similarly to VMAP_STACK.
Signed-off-by: Sami Tolvanen
---
include/linux/scs.h | 7 +
kernel/scs.c| 63 ++---
2 files changed, 55 insertions(+), 15 deletions(-)
diff --git a/include
On Wed, Oct 21, 2020 at 1:56 AM Peter Zijlstra wrote:
>
> On Tue, Oct 20, 2020 at 12:24:37PM -0700, Sami Tolvanen wrote:
> > > > Building allyesconfig with this series and LTO enabled, I still see
> > > > the following objtool warnings for vmlinux.o, grouped by sou
On Wed, Oct 21, 2020 at 1:56 AM Peter Zijlstra wrote:
>
> On Tue, Oct 20, 2020 at 12:24:37PM -0700, Sami Tolvanen wrote:
> > > > Building allyesconfig with this series and LTO enabled, I still see
> > > > the following objtool warnings for vmlinux.o, grouped by sou
201 - 300 of 912 matches
Mail list logo