All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sami Tolvanen <samitolvanen@google.com>
To: Masahiro Yamada <masahiroy@kernel.org>, Will Deacon <will@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	Kees Cook <keescook@chromium.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	clang-built-linux@googlegroups.com,
	kernel-hardening@lists.openwall.com, linux-arch@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-pci@vger.kernel.org, x86@kernel.org,
	Sami Tolvanen <samitolvanen@google.com>
Subject: [PATCH v2 15/28] init: lto: ensure initcall ordering
Date: Thu,  3 Sep 2020 13:30:40 -0700	[thread overview]
Message-ID: <20200903203053.3411268-16-samitolvanen@google.com> (raw)
In-Reply-To: <20200903203053.3411268-1-samitolvanen@google.com>

With LTO, the compiler doesn't necessarily obey the link order for
initcalls, and initcall variables need globally unique names to avoid
collisions at link time.

This change exports __KBUILD_MODNAME and adds the initcall_id() macro,
which uses it together with __COUNTER__ and __LINE__ to help ensure
these variables have unique names, and moves each variable to its own
section when LTO is enabled, so the correct order can be specified using
a linker script.

The generate_initcall_ordering.pl script uses nm to find initcalls from
the object files passed to the linker, and generates a linker script
that specifies the intended order. With LTO, the script is called in
link-vmlinux.sh.

Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
---
 include/linux/init.h               |  52 +++++-
 scripts/Makefile.lib               |   6 +-
 scripts/generate_initcall_order.pl | 270 +++++++++++++++++++++++++++++
 scripts/link-vmlinux.sh            |  14 ++
 4 files changed, 333 insertions(+), 9 deletions(-)
 create mode 100755 scripts/generate_initcall_order.pl

diff --git a/include/linux/init.h b/include/linux/init.h
index 212fc9e2f691..af638cd6dd52 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -184,19 +184,57 @@ extern bool initcall_debug;
  * as KEEP() in the linker script.
  */
 
+/* Format: <modname>__<counter>_<line>_<fn> */
+#define __initcall_id(fn)					\
+	__PASTE(__KBUILD_MODNAME,				\
+	__PASTE(__,						\
+	__PASTE(__COUNTER__,					\
+	__PASTE(_,						\
+	__PASTE(__LINE__,					\
+	__PASTE(_, fn))))))
+
+/* Format: __<prefix>__<iid><id> */
+#define __initcall_name(prefix, __iid, id)			\
+	__PASTE(__,						\
+	__PASTE(prefix,						\
+	__PASTE(__,						\
+	__PASTE(__iid, id))))
+
+#ifdef CONFIG_LTO_CLANG
+/*
+ * With LTO, the compiler doesn't necessarily obey link order for
+ * initcalls. In order to preserve the correct order, we add each
+ * variable into its own section and generate a linker script (in
+ * scripts/link-vmlinux.sh) to specify the order of the sections.
+ */
+#define __initcall_section(__sec, __iid)			\
+	#__sec ".init.." #__iid
+#else
+#define __initcall_section(__sec, __iid)			\
+	#__sec ".init"
+#endif
+
 #ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
-#define ___define_initcall(fn, id, __sec)			\
+#define ____define_initcall(fn, __name, __sec)			\
 	__ADDRESSABLE(fn)					\
-	asm(".section	\"" #__sec ".init\", \"a\"	\n"	\
-	"__initcall_" #fn #id ":			\n"	\
+	asm(".section	\"" __sec "\", \"a\"		\n"	\
+	    __stringify(__name) ":			\n"	\
 	    ".long	" #fn " - .			\n"	\
 	    ".previous					\n");
 #else
-#define ___define_initcall(fn, id, __sec) \
-	static initcall_t __initcall_##fn##id __used \
-		__attribute__((__section__(#__sec ".init"))) = fn;
+#define ____define_initcall(fn, __name, __sec)			\
+	static initcall_t __name __used 			\
+		__attribute__((__section__(__sec))) = fn;
 #endif
 
+#define __unique_initcall(fn, id, __sec, __iid)			\
+	____define_initcall(fn,					\
+		__initcall_name(initcall, __iid, id),		\
+		__initcall_section(__sec, __iid))
+
+#define ___define_initcall(fn, id, __sec)			\
+	__unique_initcall(fn, id, __sec, __initcall_id(fn))
+
 #define __define_initcall(fn, id) ___define_initcall(fn, id, .initcall##id)
 
 /*
@@ -236,7 +274,7 @@ extern bool initcall_debug;
 #define __exitcall(fn)						\
 	static exitcall_t __exitcall_##fn __exit_call = fn
 
-#define console_initcall(fn)	___define_initcall(fn,, .con_initcall)
+#define console_initcall(fn)	___define_initcall(fn, con, .con_initcall)
 
 struct obs_kernel_param {
 	const char *str;
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 3d599716940c..7e382d12d309 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -117,9 +117,11 @@ target-stem = $(basename $(patsubst $(obj)/%,%,$@))
 # These flags are needed for modversions and compiling, so we define them here
 # $(modname_flags) defines KBUILD_MODNAME as the name of the module it will
 # end up in (or would, if it gets compiled in)
-name-fix = $(call stringify,$(subst $(comma),_,$(subst -,_,$1)))
+name-fix-token = $(subst $(comma),_,$(subst -,_,$1))
+name-fix = $(call stringify,$(call name-fix-token,$1))
 basename_flags = -DKBUILD_BASENAME=$(call name-fix,$(basetarget))
-modname_flags  = -DKBUILD_MODNAME=$(call name-fix,$(modname))
+modname_flags  = -DKBUILD_MODNAME=$(call name-fix,$(modname)) \
+		 -D__KBUILD_MODNAME=kmod_$(call name-fix-token,$(modname))
 modfile_flags  = -DKBUILD_MODFILE=$(call stringify,$(modfile))
 
 _c_flags       = $(filter-out $(CFLAGS_REMOVE_$(target-stem).o), \
diff --git a/scripts/generate_initcall_order.pl b/scripts/generate_initcall_order.pl
new file mode 100755
index 000000000000..fe83aec2b51e
--- /dev/null
+++ b/scripts/generate_initcall_order.pl
@@ -0,0 +1,270 @@
+#!/usr/bin/env perl
+# SPDX-License-Identifier: GPL-2.0
+#
+# Generates a linker script that specifies the correct initcall order.
+#
+# Copyright (C) 2019 Google LLC
+
+use strict;
+use warnings;
+use IO::Handle;
+use IO::Select;
+use POSIX ":sys_wait_h";
+
+my $nm = $ENV{'NM'} || die "$0: ERROR: NM not set?";
+my $objtree = $ENV{'objtree'} || '.';
+
+## currently active child processes
+my $jobs = {};		# child process pid -> file handle
+## results from child processes
+my $results = {};	# object index -> [ { level, secname }, ... ]
+
+## reads _NPROCESSORS_ONLN to determine the maximum number of processes to
+## start
+sub get_online_processors {
+	open(my $fh, "getconf _NPROCESSORS_ONLN 2>/dev/null |")
+		or die "$0: ERROR: failed to execute getconf: $!";
+	my $procs = <$fh>;
+	close($fh);
+
+	if (!($procs =~ /^\d+$/)) {
+		return 1;
+	}
+
+	return int($procs);
+}
+
+## writes results to the parent process
+## format: <file index> <initcall level> <base initcall section name>
+sub write_results {
+	my ($index, $initcalls) = @_;
+
+	# sort by the counter value to ensure the order of initcalls within
+	# each object file is correct
+	foreach my $counter (sort { $a <=> $b } keys(%{$initcalls})) {
+		my $level = $initcalls->{$counter}->{'level'};
+
+		# section name for the initcall function
+		my $secname = $initcalls->{$counter}->{'module'} . '__' .
+			      $counter . '_' .
+			      $initcalls->{$counter}->{'line'} . '_' .
+			      $initcalls->{$counter}->{'function'};
+
+		print "$index $level $secname\n";
+	}
+}
+
+## reads a result line from a child process and adds it to the $results array
+sub read_results{
+	my ($fh) = @_;
+
+	# each child prints out a full line w/ autoflush and exits after the
+	# last line, so even if buffered I/O blocks here, it shouldn't block
+	# very long
+	my $data = <$fh>;
+
+	if (!defined($data)) {
+		return 0;
+	}
+
+	chomp($data);
+
+	my ($index, $level, $secname) = $data =~
+		/^(\d+)\ ([^\ ]+)\ (.*)$/;
+
+	if (!defined($index) ||
+		!defined($level) ||
+		!defined($secname)) {
+		die "$0: ERROR: child process returned invalid data: $data\n";
+	}
+
+	$index = int($index);
+
+	if (!exists($results->{$index})) {
+		$results->{$index} = [];
+	}
+
+	push (@{$results->{$index}}, {
+		'level'   => $level,
+		'secname' => $secname
+	});
+
+	return 1;
+}
+
+## finds initcalls from an object file or all object files in an archive, and
+## writes results back to the parent process
+sub find_initcalls {
+	my ($index, $file) = @_;
+
+	die "$0: ERROR: file $file doesn't exist?" if (! -f $file);
+
+	open(my $fh, "\"$nm\" --defined-only \"$file\" 2>/dev/null |")
+		or die "$0: ERROR: failed to execute \"$nm\": $!";
+
+	my $initcalls = {};
+
+	while (<$fh>) {
+		chomp;
+
+		# check for the start of a new object file (if processing an
+		# archive)
+		my ($path)= $_ =~ /^(.+)\:$/;
+
+		if (defined($path)) {
+			write_results($index, $initcalls);
+			$initcalls = {};
+			next;
+		}
+
+		# look for an initcall
+		my ($module, $counter, $line, $symbol) = $_ =~
+			/[a-z]\s+__initcall__(\S*)__(\d+)_(\d+)_(.*)$/;
+
+		if (!defined($module)) {
+			$module = ''
+		}
+
+		if (!defined($counter) ||
+			!defined($line) ||
+			!defined($symbol)) {
+			next;
+		}
+
+		# parse initcall level
+		my ($function, $level) = $symbol =~
+			/^(.*)((early|rootfs|con|[0-9])s?)$/;
+
+		die "$0: ERROR: invalid initcall name $symbol in $file($path)"
+			if (!defined($function) || !defined($level));
+
+		$initcalls->{$counter} = {
+			'module'   => $module,
+			'line'     => $line,
+			'function' => $function,
+			'level'    => $level,
+		};
+	}
+
+	close($fh);
+	write_results($index, $initcalls);
+}
+
+## waits for any child process to complete, reads the results, and adds them to
+## the $results array for later processing
+sub wait_for_results {
+	my ($select) = @_;
+
+	my $pid = 0;
+	do {
+		# unblock children that may have a full write buffer
+		foreach my $fh ($select->can_read(0)) {
+			read_results($fh);
+		}
+
+		# check for children that have exited, read the remaining data
+		# from them, and clean up
+		$pid = waitpid(-1, WNOHANG);
+		if ($pid > 0) {
+			if (!exists($jobs->{$pid})) {
+				next;
+			}
+
+			my $fh = $jobs->{$pid};
+			$select->remove($fh);
+
+			while (read_results($fh)) {
+				# until eof
+			}
+
+			close($fh);
+			delete($jobs->{$pid});
+		}
+	} while ($pid > 0);
+}
+
+## forks a child to process each file passed in the command line and collects
+## the results
+sub process_files {
+	my $index = 0;
+	my $njobs = get_online_processors();
+	my $select = IO::Select->new();
+
+	while (my $file = shift(@ARGV)) {
+		# fork a child process and read it's stdout
+		my $pid = open(my $fh, '-|');
+
+		if (!defined($pid)) {
+			die "$0: ERROR: failed to fork: $!";
+		} elsif ($pid) {
+			# save the child process pid and the file handle
+			$select->add($fh);
+			$jobs->{$pid} = $fh;
+		} else {
+			# in the child process
+			STDOUT->autoflush(1);
+			find_initcalls($index, "$objtree/$file");
+			exit;
+		}
+
+		$index++;
+
+		# limit the number of children to $njobs
+		if (scalar(keys(%{$jobs})) >= $njobs) {
+			wait_for_results($select);
+		}
+	}
+
+	# wait for the remaining children to complete
+	while (scalar(keys(%{$jobs})) > 0) {
+		wait_for_results($select);
+	}
+}
+
+sub generate_initcall_lds() {
+	process_files();
+
+	my $sections = {};	# level -> [ secname, ...]
+
+	# sort results to retain link order and split to sections per
+	# initcall level
+	foreach my $index (sort { $a <=> $b } keys(%{$results})) {
+		foreach my $result (@{$results->{$index}}) {
+			my $level = $result->{'level'};
+
+			if (!exists($sections->{$level})) {
+				$sections->{$level} = [];
+			}
+
+			push(@{$sections->{$level}}, $result->{'secname'});
+		}
+	}
+
+	die "$0: ERROR: no initcalls?" if (!keys(%{$sections}));
+
+	# print out a linker script that defines the order of initcalls for
+	# each level
+	print "SECTIONS {\n";
+
+	foreach my $level (sort(keys(%{$sections}))) {
+		my $section;
+
+		if ($level eq 'con') {
+			$section = '.con_initcall.init';
+		} else {
+			$section = ".initcall${level}.init";
+		}
+
+		print "\t${section} : {\n";
+
+		foreach my $secname (@{$sections->{$level}}) {
+			print "\t\t*(${section}..${secname}) ;\n";
+		}
+
+		print "\t}\n";
+	}
+
+	print "}\n";
+}
+
+generate_initcall_lds();
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index a352a5ad9ef7..1d5730176bed 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -43,6 +43,16 @@ info()
 	fi
 }
 
+# Generate a linker script to ensure correct ordering of initcalls.
+gen_initcalls()
+{
+	info GEN .tmp_initcalls.lds
+
+	${srctree}/scripts/generate_initcall_order.pl \
+		${KBUILD_VMLINUX_OBJS} ${KBUILD_VMLINUX_LIBS} \
+		> .tmp_initcalls.lds
+}
+
 # If CONFIG_LTO_CLANG is selected, collect generated symbol versions into
 # .tmp_symversions.lds
 gen_symversions()
@@ -74,6 +84,9 @@ modpost_link()
 		--end-group"
 
 	if [ -n "${CONFIG_LTO_CLANG}" ]; then
+		gen_initcalls
+		lds="-T .tmp_initcalls.lds"
+
 		if [ -n "${CONFIG_MODVERSIONS}" ]; then
 			gen_symversions
 			lds="${lds} -T .tmp_symversions.lds"
@@ -285,6 +298,7 @@ cleanup()
 {
 	rm -f .btf.*
 	rm -f .tmp_System.map
+	rm -f .tmp_initcalls.lds
 	rm -f .tmp_symversions.lds
 	rm -f .tmp_vmlinux*
 	rm -f System.map
-- 
2.28.0.402.g5ffc5be6b7-goog


WARNING: multiple messages have this Message-ID (diff)
From: Sami Tolvanen <samitolvanen@google.com>
To: Masahiro Yamada <masahiroy@kernel.org>, Will Deacon <will@kernel.org>
Cc: linux-arch@vger.kernel.org, x86@kernel.org,
	Kees Cook <keescook@chromium.org>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	kernel-hardening@lists.openwall.com,
	Peter Zijlstra <peterz@infradead.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kbuild@vger.kernel.org,
	Nick Desaulniers <ndesaulniers@google.com>,
	linux-kernel@vger.kernel.org,
	Steven Rostedt <rostedt@goodmis.org>,
	clang-built-linux@googlegroups.com,
	Sami Tolvanen <samitolvanen@google.com>,
	linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 15/28] init: lto: ensure initcall ordering
Date: Thu,  3 Sep 2020 13:30:40 -0700	[thread overview]
Message-ID: <20200903203053.3411268-16-samitolvanen@google.com> (raw)
In-Reply-To: <20200903203053.3411268-1-samitolvanen@google.com>

With LTO, the compiler doesn't necessarily obey the link order for
initcalls, and initcall variables need globally unique names to avoid
collisions at link time.

This change exports __KBUILD_MODNAME and adds the initcall_id() macro,
which uses it together with __COUNTER__ and __LINE__ to help ensure
these variables have unique names, and moves each variable to its own
section when LTO is enabled, so the correct order can be specified using
a linker script.

The generate_initcall_ordering.pl script uses nm to find initcalls from
the object files passed to the linker, and generates a linker script
that specifies the intended order. With LTO, the script is called in
link-vmlinux.sh.

Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
---
 include/linux/init.h               |  52 +++++-
 scripts/Makefile.lib               |   6 +-
 scripts/generate_initcall_order.pl | 270 +++++++++++++++++++++++++++++
 scripts/link-vmlinux.sh            |  14 ++
 4 files changed, 333 insertions(+), 9 deletions(-)
 create mode 100755 scripts/generate_initcall_order.pl

diff --git a/include/linux/init.h b/include/linux/init.h
index 212fc9e2f691..af638cd6dd52 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -184,19 +184,57 @@ extern bool initcall_debug;
  * as KEEP() in the linker script.
  */
 
+/* Format: <modname>__<counter>_<line>_<fn> */
+#define __initcall_id(fn)					\
+	__PASTE(__KBUILD_MODNAME,				\
+	__PASTE(__,						\
+	__PASTE(__COUNTER__,					\
+	__PASTE(_,						\
+	__PASTE(__LINE__,					\
+	__PASTE(_, fn))))))
+
+/* Format: __<prefix>__<iid><id> */
+#define __initcall_name(prefix, __iid, id)			\
+	__PASTE(__,						\
+	__PASTE(prefix,						\
+	__PASTE(__,						\
+	__PASTE(__iid, id))))
+
+#ifdef CONFIG_LTO_CLANG
+/*
+ * With LTO, the compiler doesn't necessarily obey link order for
+ * initcalls. In order to preserve the correct order, we add each
+ * variable into its own section and generate a linker script (in
+ * scripts/link-vmlinux.sh) to specify the order of the sections.
+ */
+#define __initcall_section(__sec, __iid)			\
+	#__sec ".init.." #__iid
+#else
+#define __initcall_section(__sec, __iid)			\
+	#__sec ".init"
+#endif
+
 #ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
-#define ___define_initcall(fn, id, __sec)			\
+#define ____define_initcall(fn, __name, __sec)			\
 	__ADDRESSABLE(fn)					\
-	asm(".section	\"" #__sec ".init\", \"a\"	\n"	\
-	"__initcall_" #fn #id ":			\n"	\
+	asm(".section	\"" __sec "\", \"a\"		\n"	\
+	    __stringify(__name) ":			\n"	\
 	    ".long	" #fn " - .			\n"	\
 	    ".previous					\n");
 #else
-#define ___define_initcall(fn, id, __sec) \
-	static initcall_t __initcall_##fn##id __used \
-		__attribute__((__section__(#__sec ".init"))) = fn;
+#define ____define_initcall(fn, __name, __sec)			\
+	static initcall_t __name __used 			\
+		__attribute__((__section__(__sec))) = fn;
 #endif
 
+#define __unique_initcall(fn, id, __sec, __iid)			\
+	____define_initcall(fn,					\
+		__initcall_name(initcall, __iid, id),		\
+		__initcall_section(__sec, __iid))
+
+#define ___define_initcall(fn, id, __sec)			\
+	__unique_initcall(fn, id, __sec, __initcall_id(fn))
+
 #define __define_initcall(fn, id) ___define_initcall(fn, id, .initcall##id)
 
 /*
@@ -236,7 +274,7 @@ extern bool initcall_debug;
 #define __exitcall(fn)						\
 	static exitcall_t __exitcall_##fn __exit_call = fn
 
-#define console_initcall(fn)	___define_initcall(fn,, .con_initcall)
+#define console_initcall(fn)	___define_initcall(fn, con, .con_initcall)
 
 struct obs_kernel_param {
 	const char *str;
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 3d599716940c..7e382d12d309 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -117,9 +117,11 @@ target-stem = $(basename $(patsubst $(obj)/%,%,$@))
 # These flags are needed for modversions and compiling, so we define them here
 # $(modname_flags) defines KBUILD_MODNAME as the name of the module it will
 # end up in (or would, if it gets compiled in)
-name-fix = $(call stringify,$(subst $(comma),_,$(subst -,_,$1)))
+name-fix-token = $(subst $(comma),_,$(subst -,_,$1))
+name-fix = $(call stringify,$(call name-fix-token,$1))
 basename_flags = -DKBUILD_BASENAME=$(call name-fix,$(basetarget))
-modname_flags  = -DKBUILD_MODNAME=$(call name-fix,$(modname))
+modname_flags  = -DKBUILD_MODNAME=$(call name-fix,$(modname)) \
+		 -D__KBUILD_MODNAME=kmod_$(call name-fix-token,$(modname))
 modfile_flags  = -DKBUILD_MODFILE=$(call stringify,$(modfile))
 
 _c_flags       = $(filter-out $(CFLAGS_REMOVE_$(target-stem).o), \
diff --git a/scripts/generate_initcall_order.pl b/scripts/generate_initcall_order.pl
new file mode 100755
index 000000000000..fe83aec2b51e
--- /dev/null
+++ b/scripts/generate_initcall_order.pl
@@ -0,0 +1,270 @@
+#!/usr/bin/env perl
+# SPDX-License-Identifier: GPL-2.0
+#
+# Generates a linker script that specifies the correct initcall order.
+#
+# Copyright (C) 2019 Google LLC
+
+use strict;
+use warnings;
+use IO::Handle;
+use IO::Select;
+use POSIX ":sys_wait_h";
+
+my $nm = $ENV{'NM'} || die "$0: ERROR: NM not set?";
+my $objtree = $ENV{'objtree'} || '.';
+
+## currently active child processes
+my $jobs = {};		# child process pid -> file handle
+## results from child processes
+my $results = {};	# object index -> [ { level, secname }, ... ]
+
+## reads _NPROCESSORS_ONLN to determine the maximum number of processes to
+## start
+sub get_online_processors {
+	open(my $fh, "getconf _NPROCESSORS_ONLN 2>/dev/null |")
+		or die "$0: ERROR: failed to execute getconf: $!";
+	my $procs = <$fh>;
+	close($fh);
+
+	if (!($procs =~ /^\d+$/)) {
+		return 1;
+	}
+
+	return int($procs);
+}
+
+## writes results to the parent process
+## format: <file index> <initcall level> <base initcall section name>
+sub write_results {
+	my ($index, $initcalls) = @_;
+
+	# sort by the counter value to ensure the order of initcalls within
+	# each object file is correct
+	foreach my $counter (sort { $a <=> $b } keys(%{$initcalls})) {
+		my $level = $initcalls->{$counter}->{'level'};
+
+		# section name for the initcall function
+		my $secname = $initcalls->{$counter}->{'module'} . '__' .
+			      $counter . '_' .
+			      $initcalls->{$counter}->{'line'} . '_' .
+			      $initcalls->{$counter}->{'function'};
+
+		print "$index $level $secname\n";
+	}
+}
+
+## reads a result line from a child process and adds it to the $results array
+sub read_results{
+	my ($fh) = @_;
+
+	# each child prints out a full line w/ autoflush and exits after the
+	# last line, so even if buffered I/O blocks here, it shouldn't block
+	# very long
+	my $data = <$fh>;
+
+	if (!defined($data)) {
+		return 0;
+	}
+
+	chomp($data);
+
+	my ($index, $level, $secname) = $data =~
+		/^(\d+)\ ([^\ ]+)\ (.*)$/;
+
+	if (!defined($index) ||
+		!defined($level) ||
+		!defined($secname)) {
+		die "$0: ERROR: child process returned invalid data: $data\n";
+	}
+
+	$index = int($index);
+
+	if (!exists($results->{$index})) {
+		$results->{$index} = [];
+	}
+
+	push (@{$results->{$index}}, {
+		'level'   => $level,
+		'secname' => $secname
+	});
+
+	return 1;
+}
+
+## finds initcalls from an object file or all object files in an archive, and
+## writes results back to the parent process
+sub find_initcalls {
+	my ($index, $file) = @_;
+
+	die "$0: ERROR: file $file doesn't exist?" if (! -f $file);
+
+	open(my $fh, "\"$nm\" --defined-only \"$file\" 2>/dev/null |")
+		or die "$0: ERROR: failed to execute \"$nm\": $!";
+
+	my $initcalls = {};
+
+	while (<$fh>) {
+		chomp;
+
+		# check for the start of a new object file (if processing an
+		# archive)
+		my ($path)= $_ =~ /^(.+)\:$/;
+
+		if (defined($path)) {
+			write_results($index, $initcalls);
+			$initcalls = {};
+			next;
+		}
+
+		# look for an initcall
+		my ($module, $counter, $line, $symbol) = $_ =~
+			/[a-z]\s+__initcall__(\S*)__(\d+)_(\d+)_(.*)$/;
+
+		if (!defined($module)) {
+			$module = ''
+		}
+
+		if (!defined($counter) ||
+			!defined($line) ||
+			!defined($symbol)) {
+			next;
+		}
+
+		# parse initcall level
+		my ($function, $level) = $symbol =~
+			/^(.*)((early|rootfs|con|[0-9])s?)$/;
+
+		die "$0: ERROR: invalid initcall name $symbol in $file($path)"
+			if (!defined($function) || !defined($level));
+
+		$initcalls->{$counter} = {
+			'module'   => $module,
+			'line'     => $line,
+			'function' => $function,
+			'level'    => $level,
+		};
+	}
+
+	close($fh);
+	write_results($index, $initcalls);
+}
+
+## waits for any child process to complete, reads the results, and adds them to
+## the $results array for later processing
+sub wait_for_results {
+	my ($select) = @_;
+
+	my $pid = 0;
+	do {
+		# unblock children that may have a full write buffer
+		foreach my $fh ($select->can_read(0)) {
+			read_results($fh);
+		}
+
+		# check for children that have exited, read the remaining data
+		# from them, and clean up
+		$pid = waitpid(-1, WNOHANG);
+		if ($pid > 0) {
+			if (!exists($jobs->{$pid})) {
+				next;
+			}
+
+			my $fh = $jobs->{$pid};
+			$select->remove($fh);
+
+			while (read_results($fh)) {
+				# until eof
+			}
+
+			close($fh);
+			delete($jobs->{$pid});
+		}
+	} while ($pid > 0);
+}
+
+## forks a child to process each file passed in the command line and collects
+## the results
+sub process_files {
+	my $index = 0;
+	my $njobs = get_online_processors();
+	my $select = IO::Select->new();
+
+	while (my $file = shift(@ARGV)) {
+		# fork a child process and read it's stdout
+		my $pid = open(my $fh, '-|');
+
+		if (!defined($pid)) {
+			die "$0: ERROR: failed to fork: $!";
+		} elsif ($pid) {
+			# save the child process pid and the file handle
+			$select->add($fh);
+			$jobs->{$pid} = $fh;
+		} else {
+			# in the child process
+			STDOUT->autoflush(1);
+			find_initcalls($index, "$objtree/$file");
+			exit;
+		}
+
+		$index++;
+
+		# limit the number of children to $njobs
+		if (scalar(keys(%{$jobs})) >= $njobs) {
+			wait_for_results($select);
+		}
+	}
+
+	# wait for the remaining children to complete
+	while (scalar(keys(%{$jobs})) > 0) {
+		wait_for_results($select);
+	}
+}
+
+sub generate_initcall_lds() {
+	process_files();
+
+	my $sections = {};	# level -> [ secname, ...]
+
+	# sort results to retain link order and split to sections per
+	# initcall level
+	foreach my $index (sort { $a <=> $b } keys(%{$results})) {
+		foreach my $result (@{$results->{$index}}) {
+			my $level = $result->{'level'};
+
+			if (!exists($sections->{$level})) {
+				$sections->{$level} = [];
+			}
+
+			push(@{$sections->{$level}}, $result->{'secname'});
+		}
+	}
+
+	die "$0: ERROR: no initcalls?" if (!keys(%{$sections}));
+
+	# print out a linker script that defines the order of initcalls for
+	# each level
+	print "SECTIONS {\n";
+
+	foreach my $level (sort(keys(%{$sections}))) {
+		my $section;
+
+		if ($level eq 'con') {
+			$section = '.con_initcall.init';
+		} else {
+			$section = ".initcall${level}.init";
+		}
+
+		print "\t${section} : {\n";
+
+		foreach my $secname (@{$sections->{$level}}) {
+			print "\t\t*(${section}..${secname}) ;\n";
+		}
+
+		print "\t}\n";
+	}
+
+	print "}\n";
+}
+
+generate_initcall_lds();
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index a352a5ad9ef7..1d5730176bed 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -43,6 +43,16 @@ info()
 	fi
 }
 
+# Generate a linker script to ensure correct ordering of initcalls.
+gen_initcalls()
+{
+	info GEN .tmp_initcalls.lds
+
+	${srctree}/scripts/generate_initcall_order.pl \
+		${KBUILD_VMLINUX_OBJS} ${KBUILD_VMLINUX_LIBS} \
+		> .tmp_initcalls.lds
+}
+
 # If CONFIG_LTO_CLANG is selected, collect generated symbol versions into
 # .tmp_symversions.lds
 gen_symversions()
@@ -74,6 +84,9 @@ modpost_link()
 		--end-group"
 
 	if [ -n "${CONFIG_LTO_CLANG}" ]; then
+		gen_initcalls
+		lds="-T .tmp_initcalls.lds"
+
 		if [ -n "${CONFIG_MODVERSIONS}" ]; then
 			gen_symversions
 			lds="${lds} -T .tmp_symversions.lds"
@@ -285,6 +298,7 @@ cleanup()
 {
 	rm -f .btf.*
 	rm -f .tmp_System.map
+	rm -f .tmp_initcalls.lds
 	rm -f .tmp_symversions.lds
 	rm -f .tmp_vmlinux*
 	rm -f System.map
-- 
2.28.0.402.g5ffc5be6b7-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2020-09-03 20:33 UTC|newest]

Thread overview: 520+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-24 20:31 [PATCH 00/22] add support for Clang LTO Sami Tolvanen
2020-06-24 20:31 ` Sami Tolvanen
2020-06-24 20:31 ` Sami Tolvanen
2020-06-24 20:31 ` [PATCH 01/22] objtool: use sh_info to find the base for .rela sections Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 20:31 ` [PATCH 02/22] kbuild: add support for Clang LTO Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 20:53   ` Nick Desaulniers
2020-06-24 20:53     ` Nick Desaulniers
2020-06-24 20:53     ` Nick Desaulniers
2020-06-24 21:29     ` Sami Tolvanen
2020-06-24 21:29       ` Sami Tolvanen
2020-06-25  2:26   ` Nathan Chancellor
2020-06-25  2:26     ` Nathan Chancellor
2020-06-25 16:13     ` Sami Tolvanen
2020-06-25 16:13       ` Sami Tolvanen
2020-06-24 20:31 ` [PATCH 03/22] kbuild: lto: fix module versioning Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 20:31 ` [PATCH 04/22] kbuild: lto: fix recordmcount Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 21:27   ` Peter Zijlstra
2020-06-24 21:27     ` Peter Zijlstra
2020-06-24 21:45     ` Sami Tolvanen
2020-06-24 21:45       ` Sami Tolvanen
2020-06-25  7:45       ` Peter Zijlstra
2020-06-25  7:45         ` Peter Zijlstra
2020-06-25 16:15         ` Sami Tolvanen
2020-06-25 16:15           ` Sami Tolvanen
2020-06-25 20:02           ` [RFC][PATCH] objtool,x86_64: Replace recordmcount with objtool Peter Zijlstra
2020-06-25 20:02             ` Peter Zijlstra
2020-06-25 20:54             ` Nick Desaulniers
2020-06-25 20:54               ` Nick Desaulniers
2020-06-25 20:54               ` Nick Desaulniers
2020-06-25 22:40             ` Sami Tolvanen
2020-06-25 22:40               ` Sami Tolvanen
2020-06-26 11:29               ` Peter Zijlstra
2020-06-26 11:29                 ` Peter Zijlstra
2020-06-26 11:42                 ` Peter Zijlstra
2020-06-26 11:42                   ` Peter Zijlstra
2020-07-17 17:28                 ` Sami Tolvanen
2020-07-17 17:28                   ` Sami Tolvanen
2020-07-17 17:28                   ` Sami Tolvanen
2020-07-17 17:36                   ` Steven Rostedt
2020-07-17 17:36                     ` Steven Rostedt
2020-07-17 17:47                     ` Sami Tolvanen
2020-07-17 17:47                       ` Sami Tolvanen
2020-07-17 17:47                       ` Sami Tolvanen
2020-07-17 18:05                       ` Steven Rostedt
2020-07-17 18:05                         ` Steven Rostedt
2020-07-20 16:52                         ` Sami Tolvanen
2020-07-20 16:52                           ` Sami Tolvanen
2020-07-20 16:52                           ` Sami Tolvanen
2020-07-22 17:58                           ` Steven Rostedt
2020-07-22 17:58                             ` Steven Rostedt
2020-07-22 18:07                             ` Sami Tolvanen
2020-07-22 18:07                               ` Sami Tolvanen
2020-07-22 18:07                               ` Sami Tolvanen
2020-07-22 17:55                 ` Steven Rostedt
2020-07-22 17:55                   ` Steven Rostedt
2020-07-22 18:41                   ` Peter Zijlstra
2020-07-22 18:41                     ` Peter Zijlstra
2020-07-22 19:09                     ` Steven Rostedt
2020-07-22 19:09                       ` Steven Rostedt
2020-07-22 20:03                       ` Sami Tolvanen
2020-07-22 20:03                         ` Sami Tolvanen
2020-07-22 20:03                         ` Sami Tolvanen
2020-07-22 23:56                       ` Peter Zijlstra
2020-07-22 23:56                         ` Peter Zijlstra
2020-07-23  0:06                         ` Steven Rostedt
2020-07-23  0:06                           ` Steven Rostedt
2020-08-06 22:09                           ` Sami Tolvanen
2020-08-06 22:09                             ` Sami Tolvanen
2020-06-24 20:31 ` [PATCH 05/22] kbuild: lto: postpone objtool Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 21:19   ` Peter Zijlstra
2020-06-24 21:19     ` Peter Zijlstra
2020-06-24 21:49     ` Sami Tolvanen
2020-06-24 21:49       ` Sami Tolvanen
2020-06-25  7:47       ` Peter Zijlstra
2020-06-25  7:47         ` Peter Zijlstra
2020-06-25 16:22         ` Sami Tolvanen
2020-06-25 16:22           ` Sami Tolvanen
2020-06-25 18:33           ` Peter Zijlstra
2020-06-25 18:33             ` Peter Zijlstra
2020-06-25 19:32             ` Sami Tolvanen
2020-06-25 19:32               ` Sami Tolvanen
2020-06-24 20:31 ` [PATCH 06/22] kbuild: lto: limit inlining Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 21:20   ` Peter Zijlstra
2020-06-24 21:20     ` Peter Zijlstra
2020-06-24 23:37     ` Sami Tolvanen
2020-06-24 23:37       ` Sami Tolvanen
2020-06-24 20:31 ` [PATCH 07/22] kbuild: lto: merge module sections Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 21:01   ` Nick Desaulniers
2020-06-24 21:01     ` Nick Desaulniers
2020-06-24 21:01     ` Nick Desaulniers
2020-06-24 21:31     ` Sami Tolvanen
2020-06-24 21:31       ` Sami Tolvanen
2020-06-24 20:31 ` [PATCH 08/22] kbuild: lto: remove duplicate dependencies from .mod files Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 21:13   ` Nick Desaulniers
2020-06-24 21:13     ` Nick Desaulniers
2020-06-24 21:13     ` Nick Desaulniers
2020-06-24 20:31 ` [PATCH 09/22] init: lto: ensure initcall ordering Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-25  0:58   ` kernel test robot
2020-06-25  0:58     ` kernel test robot
2020-06-25  0:58     ` kernel test robot
2020-06-25  4:19   ` kernel test robot
2020-06-25  4:19     ` kernel test robot
2020-06-25  4:19     ` kernel test robot
2020-06-24 20:31 ` [PATCH 10/22] init: lto: fix PREL32 relocations Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 20:31 ` [PATCH 11/22] pci: " Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 22:49   ` kernel test robot
2020-06-24 22:49     ` kernel test robot
2020-06-24 22:49     ` kernel test robot
2020-06-24 23:03     ` Nick Desaulniers
2020-06-24 23:03       ` Nick Desaulniers
2020-06-24 23:03       ` Nick Desaulniers
2020-06-24 23:03       ` Nick Desaulniers
2020-06-24 23:21       ` Sami Tolvanen
2020-06-24 23:21         ` Sami Tolvanen
2020-06-24 23:21         ` Sami Tolvanen
2020-07-17 20:26   ` Bjorn Helgaas
2020-07-17 20:26     ` Bjorn Helgaas
2020-07-22 18:15     ` Sami Tolvanen
2020-07-22 18:15       ` Sami Tolvanen
2020-07-22 18:15       ` Sami Tolvanen
2020-06-24 20:31 ` [PATCH 12/22] modpost: lto: strip .lto from module names Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 22:05   ` Nick Desaulniers
2020-06-24 22:05     ` Nick Desaulniers
2020-06-24 22:05     ` Nick Desaulniers
2020-06-24 20:31 ` [PATCH 13/22] scripts/mod: disable LTO for empty.c Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 20:57   ` Nick Desaulniers
2020-06-24 20:57     ` Nick Desaulniers
2020-06-24 20:57     ` Nick Desaulniers
2020-06-24 20:31 ` [PATCH 14/22] efi/libstub: disable LTO Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 20:31 ` [PATCH 15/22] drivers/misc/lkdtm: disable LTO for rodata.o Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 20:31 ` [PATCH 16/22] arm64: export CC_USING_PATCHABLE_FUNCTION_ENTRY Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 20:31 ` [PATCH 17/22] arm64: vdso: disable LTO Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 20:58   ` Nick Desaulniers
2020-06-24 20:58     ` Nick Desaulniers
2020-06-24 20:58     ` Nick Desaulniers
2020-06-24 21:09     ` Nick Desaulniers
2020-06-24 21:09       ` Nick Desaulniers
2020-06-24 21:09       ` Nick Desaulniers
2020-06-24 23:51       ` Andi Kleen
2020-06-24 23:51         ` Andi Kleen
2020-06-24 21:52     ` Sami Tolvanen
2020-06-24 21:52       ` Sami Tolvanen
2020-06-24 23:05       ` Nick Desaulniers
2020-06-24 23:05         ` Nick Desaulniers
2020-06-24 23:05         ` Nick Desaulniers
2020-06-24 23:39         ` Sami Tolvanen
2020-06-24 23:39           ` Sami Tolvanen
2020-06-24 20:31 ` [PATCH 18/22] arm64: allow LTO_CLANG and THINLTO to be selected Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 20:31 ` [PATCH 19/22] x86, vdso: disable LTO only for vDSO Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 20:31 ` [PATCH 20/22] x86, ftrace: disable recordmcount for ftrace_make_nop Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 20:31 ` [PATCH 21/22] x86, relocs: Ignore L4_PAGE_OFFSET relocations Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 20:31   ` Sami Tolvanen
2020-06-24 20:32 ` [PATCH 22/22] x86, build: allow LTO_CLANG and THINLTO to be selected Sami Tolvanen
2020-06-24 20:32   ` Sami Tolvanen
2020-06-24 20:32   ` Sami Tolvanen
2020-06-24 21:15 ` [PATCH 00/22] add support for Clang LTO Peter Zijlstra
2020-06-24 21:15   ` Peter Zijlstra
2020-06-24 21:30   ` Sami Tolvanen
2020-06-24 21:30     ` Sami Tolvanen
2020-06-25  8:27     ` Will Deacon
2020-06-25  8:27       ` Will Deacon
2020-06-24 21:31   ` Nick Desaulniers
2020-06-24 21:31     ` Nick Desaulniers
2020-06-24 21:31     ` Nick Desaulniers
2020-06-25  8:03     ` Peter Zijlstra
2020-06-25  8:03       ` Peter Zijlstra
2020-06-25  8:24       ` Peter Zijlstra
2020-06-25  8:24         ` Peter Zijlstra
2020-06-25  8:57         ` Peter Zijlstra
2020-06-25  8:57           ` Peter Zijlstra
2020-06-30 19:19           ` Marco Elver
2020-06-30 19:19             ` Marco Elver
2020-06-30 20:12             ` Peter Zijlstra
2020-06-30 20:12               ` Peter Zijlstra
2020-06-30 20:30               ` Paul E. McKenney
2020-06-30 20:30                 ` Paul E. McKenney
2020-07-01  9:10                 ` Peter Zijlstra
2020-07-01  9:10                   ` Peter Zijlstra
2020-07-01 14:20                   ` David Laight
2020-07-01 14:20                     ` David Laight
2020-07-01 16:06                     ` Paul E. McKenney
2020-07-01 16:06                       ` Paul E. McKenney
2020-07-02  9:37                       ` David Laight
2020-07-02  9:37                         ` David Laight
2020-07-02 18:00                         ` Paul E. McKenney
2020-07-02 18:00                           ` Paul E. McKenney
2020-07-01  9:41                 ` Marco Elver
2020-07-01  9:41                   ` Marco Elver
2020-07-01  9:41                   ` Marco Elver
2020-07-01 10:03                   ` Will Deacon
2020-07-01 10:03                     ` Will Deacon
2020-07-01 11:40                   ` Peter Zijlstra
2020-07-01 11:40                     ` Peter Zijlstra
2020-07-01 14:06                     ` Paul E. McKenney
2020-07-01 14:06                       ` Paul E. McKenney
2020-07-01 15:05                       ` Peter Zijlstra
2020-07-01 15:05                         ` Peter Zijlstra
2020-07-01 16:03                         ` Paul E. McKenney
2020-07-01 16:03                           ` Paul E. McKenney
2020-07-02  8:20                           ` Peter Zijlstra
2020-07-02  8:20                             ` Peter Zijlstra
2020-07-02 17:59                             ` Paul E. McKenney
2020-07-02 17:59                               ` Paul E. McKenney
2020-07-03 13:13                               ` Peter Zijlstra
2020-07-03 13:13                                 ` Peter Zijlstra
2020-07-03 13:25                                 ` Peter Zijlstra
2020-07-03 13:25                                   ` Peter Zijlstra
2020-07-03 14:51                                   ` Paul E. McKenney
2020-07-03 14:51                                     ` Paul E. McKenney
2020-07-03 14:42                                 ` Paul E. McKenney
2020-07-03 14:42                                   ` Paul E. McKenney
2020-07-06 16:26                                   ` Paul E. McKenney
2020-07-06 16:26                                     ` Paul E. McKenney
2020-07-06 18:29                                     ` Peter Zijlstra
2020-07-06 18:29                                       ` Peter Zijlstra
2020-07-06 18:39                                       ` Paul E. McKenney
2020-07-06 18:39                                         ` Paul E. McKenney
2020-07-06 19:40                                         ` Peter Zijlstra
2020-07-06 19:40                                           ` Peter Zijlstra
2020-07-06 23:41                                           ` Paul E. McKenney
2020-07-06 23:41                                             ` Paul E. McKenney
2020-06-28 16:56 ` Masahiro Yamada
2020-06-28 16:56   ` Masahiro Yamada
2020-06-28 16:56   ` Masahiro Yamada
2020-06-29 23:20   ` Sami Tolvanen
2020-06-29 23:20     ` Sami Tolvanen
2020-07-07 15:51     ` Sami Tolvanen
2020-07-07 15:51       ` Sami Tolvanen
2020-07-07 16:05       ` Sami Tolvanen
2020-07-07 16:05         ` Sami Tolvanen
2020-07-07 16:56         ` Jakub Kicinski
2020-07-07 16:56           ` Jakub Kicinski
2020-07-07 17:17           ` Nick Desaulniers
2020-07-07 17:17             ` Nick Desaulniers
2020-07-07 17:17             ` Nick Desaulniers
2020-07-07 17:30             ` Jakub Kicinski
2020-07-07 17:30               ` Jakub Kicinski
2020-07-11 16:32 ` Paul Menzel
2020-07-11 16:32   ` Paul Menzel
2020-07-11 16:32   ` Paul Menzel
2020-07-12  8:59   ` Sedat Dilek
2020-07-12  8:59     ` Sedat Dilek
2020-07-12  8:59     ` Sedat Dilek
2020-07-12 18:40     ` Nathan Chancellor
2020-07-12 18:40       ` Nathan Chancellor
2020-07-14  9:44       ` Sedat Dilek
2020-07-14  9:44         ` Sedat Dilek
2020-07-14  9:44         ` Sedat Dilek
2020-07-14 17:54         ` Nick Desaulniers
2020-07-14 17:54           ` Nick Desaulniers
2020-07-14 17:54           ` Nick Desaulniers
2020-07-12 23:34   ` Sami Tolvanen
2020-07-12 23:34     ` Sami Tolvanen
2020-07-12 23:34     ` Sami Tolvanen
2020-07-14 12:16     ` Paul Menzel
2020-07-14 12:16       ` Paul Menzel
2020-07-14 12:35       ` Sedat Dilek
2020-07-14 12:35         ` Sedat Dilek
2020-07-14 12:35         ` Sedat Dilek
2020-07-14 13:40         ` Paul Menzel
2020-09-03 20:30 ` [PATCH v2 00/28] Add " Sami Tolvanen
2020-09-03 20:30   ` Sami Tolvanen
2020-09-03 20:30   ` Sami Tolvanen
2020-09-03 20:30   ` [PATCH v2 01/28] x86/boot/compressed: Disable relocation relaxation Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 21:44     ` Kees Cook
2020-09-03 21:44       ` Kees Cook
2020-09-03 23:42       ` Arvind Sankar
2020-09-03 23:42         ` Arvind Sankar
2020-09-04  7:14         ` Nathan Chancellor
2020-09-04  7:14           ` Nathan Chancellor
2020-09-06  3:16     ` Sasha Levin
2020-09-03 20:30   ` [PATCH v2 02/28] x86/asm: Replace __force_order with memory clobber Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 21:45     ` Kees Cook
2020-09-03 21:45       ` Kees Cook
2020-09-03 20:30   ` [PATCH v2 03/28] lib/string.c: implement stpcpy Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 21:47     ` Kees Cook
2020-09-03 21:47       ` Kees Cook
2020-09-06  3:16     ` Sasha Levin
2020-09-03 20:30   ` [PATCH v2 04/28] RAS/CEC: Fix cec_init() prototype Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 21:50     ` Kees Cook
2020-09-03 21:50       ` Kees Cook
2020-09-03 20:30   ` [PATCH v2 05/28] objtool: Add a pass for generating __mcount_loc Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 21:51     ` Kees Cook
2020-09-03 21:51       ` Kees Cook
2020-09-03 22:03       ` Sami Tolvanen
2020-09-03 22:03         ` Sami Tolvanen
2020-09-03 22:03         ` Sami Tolvanen
2020-09-04  9:31         ` peterz
2020-09-04  9:31           ` peterz
2020-09-10 18:29           ` Kees Cook
2020-09-10 18:29             ` Kees Cook
2020-09-03 20:30   ` [PATCH v2 06/28] objtool: Don't autodetect vmlinux.o Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 21:52     ` Kees Cook
2020-09-03 21:52       ` Kees Cook
2020-09-03 20:30   ` [PATCH v2 07/28] kbuild: add support for objtool mcount Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 21:56     ` Kees Cook
2020-09-03 21:56       ` Kees Cook
2020-09-03 20:30   ` [PATCH v2 08/28] x86, build: use " Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 21:58     ` Kees Cook
2020-09-03 21:58       ` Kees Cook
2020-09-03 22:11       ` Sami Tolvanen
2020-09-03 22:11         ` Sami Tolvanen
2020-09-03 22:11         ` Sami Tolvanen
2020-09-03 20:30   ` [PATCH v2 09/28] kbuild: add support for Clang LTO Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 22:08     ` Kees Cook
2020-09-03 22:08       ` Kees Cook
2020-09-08 17:02       ` Sami Tolvanen
2020-09-08 17:02         ` Sami Tolvanen
2020-09-05 19:36     ` Masahiro Yamada
2020-09-05 19:36       ` Masahiro Yamada
2020-09-08 17:10       ` Sami Tolvanen
2020-09-08 17:10         ` Sami Tolvanen
2020-09-05 20:17     ` Masahiro Yamada
2020-09-05 20:17       ` Masahiro Yamada
2020-09-08 17:14       ` Sami Tolvanen
2020-09-08 17:14         ` Sami Tolvanen
2020-09-07 15:30     ` Masahiro Yamada
2020-09-07 15:30       ` Masahiro Yamada
2020-09-08 17:30       ` Sami Tolvanen
2020-09-08 17:30         ` Sami Tolvanen
2020-09-03 20:30   ` [PATCH v2 10/28] kbuild: lto: fix module versioning Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 22:11     ` Kees Cook
2020-09-03 22:11       ` Kees Cook
2020-09-08 18:23       ` Sami Tolvanen
2020-09-08 18:23         ` Sami Tolvanen
2020-09-03 20:30   ` [PATCH v2 11/28] kbuild: lto: postpone objtool Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 22:19     ` Kees Cook
2020-09-03 22:19       ` Kees Cook
2020-09-08 20:56       ` Sami Tolvanen
2020-09-08 20:56         ` Sami Tolvanen
2020-09-03 20:30   ` [PATCH v2 12/28] kbuild: lto: limit inlining Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 22:20     ` Kees Cook
2020-09-03 22:20       ` Kees Cook
2020-09-03 20:30   ` [PATCH v2 13/28] kbuild: lto: merge module sections Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 22:23     ` Kees Cook
2020-09-03 22:23       ` Kees Cook
2020-09-07 15:25     ` Masahiro Yamada
2020-09-07 15:25       ` Masahiro Yamada
2020-09-08 21:07       ` Sami Tolvanen
2020-09-08 21:07         ` Sami Tolvanen
2020-09-03 20:30   ` [PATCH v2 14/28] kbuild: lto: remove duplicate dependencies from .mod files Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 22:29     ` Kees Cook
2020-09-03 22:29       ` Kees Cook
2020-09-03 20:30   ` Sami Tolvanen [this message]
2020-09-03 20:30     ` [PATCH v2 15/28] init: lto: ensure initcall ordering Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 22:40     ` Kees Cook
2020-09-03 22:40       ` Kees Cook
2020-09-08 21:16       ` Sami Tolvanen
2020-09-08 21:16         ` Sami Tolvanen
2020-09-10  9:25     ` David Woodhouse
2020-09-10  9:25       ` David Woodhouse
2020-09-10  9:25       ` David Woodhouse
2020-09-10 15:07       ` Sami Tolvanen
2020-09-10 15:07         ` Sami Tolvanen
2020-09-03 20:30   ` [PATCH v2 16/28] init: lto: fix PREL32 relocations Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 22:41     ` Kees Cook
2020-09-03 22:41       ` Kees Cook
2020-09-06  3:16     ` Sasha Levin
2020-09-03 20:30   ` [PATCH v2 17/28] PCI: Fix PREL32 relocations for LTO Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 22:42     ` Kees Cook
2020-09-03 22:42       ` Kees Cook
2020-09-03 20:30   ` [PATCH v2 18/28] modpost: lto: strip .lto from module names Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 22:42     ` Kees Cook
2020-09-03 22:42       ` Kees Cook
2020-09-03 20:30   ` [PATCH v2 19/28] scripts/mod: disable LTO for empty.c Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 22:43     ` Kees Cook
2020-09-03 22:43       ` Kees Cook
2020-09-03 20:30   ` [PATCH v2 20/28] efi/libstub: disable LTO Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 22:43     ` Kees Cook
2020-09-03 22:43       ` Kees Cook
2020-09-03 20:30   ` [PATCH v2 21/28] drivers/misc/lkdtm: disable LTO for rodata.o Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 20:30   ` [PATCH v2 22/28] arm64: export CC_USING_PATCHABLE_FUNCTION_ENTRY Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 22:44     ` Kees Cook
2020-09-03 22:44       ` Kees Cook
2020-09-08 21:23       ` Sami Tolvanen
2020-09-08 21:23         ` Sami Tolvanen
2020-09-03 20:30   ` [PATCH v2 23/28] arm64: vdso: disable LTO Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 22:45     ` Kees Cook
2020-09-03 22:45       ` Kees Cook
2020-09-03 20:30   ` [PATCH v2 24/28] KVM: arm64: disable LTO for the nVHE directory Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 22:45     ` Kees Cook
2020-09-03 22:45       ` Kees Cook
2020-09-03 20:30   ` [PATCH v2 25/28] arm64: allow LTO_CLANG and THINLTO to be selected Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 22:45     ` Kees Cook
2020-09-03 22:45       ` Kees Cook
2020-09-03 20:30   ` [PATCH v2 26/28] x86, vdso: disable LTO only for vDSO Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 22:46     ` Kees Cook
2020-09-03 22:46       ` Kees Cook
2020-09-03 20:30   ` [PATCH v2 27/28] x86, relocs: Ignore L4_PAGE_OFFSET relocations Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 22:47     ` Kees Cook
2020-09-03 22:47       ` Kees Cook
2020-09-08 23:28       ` Sami Tolvanen
2020-09-08 23:28         ` Sami Tolvanen
2020-09-03 20:30   ` [PATCH v2 28/28] x86, build: allow LTO_CLANG and THINLTO to be selected Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 20:30     ` Sami Tolvanen
2020-09-03 22:48     ` Kees Cook
2020-09-03 22:48       ` Kees Cook
2020-09-03 23:34   ` [PATCH v2 00/28] Add support for Clang LTO Kees Cook
2020-09-03 23:34     ` Kees Cook
2020-09-04  4:45     ` Nathan Chancellor
2020-09-04  4:45       ` Nathan Chancellor
2020-09-03 23:38   ` Kees Cook
2020-09-03 23:38     ` Kees Cook
2020-09-04  7:53   ` Sedat Dilek
2020-09-04  7:53     ` Sedat Dilek
2020-09-04  7:53     ` Sedat Dilek
2020-09-04  8:55   ` peterz
2020-09-04  8:55     ` peterz
2020-09-04  9:08     ` Sedat Dilek
2020-09-04  9:08       ` Sedat Dilek
2020-09-04  9:08       ` Sedat Dilek
2020-09-06  0:24   ` Masahiro Yamada
2020-09-06  0:24     ` Masahiro Yamada
2020-09-08 23:46     ` Sami Tolvanen
2020-09-08 23:46       ` Sami Tolvanen
2020-09-10  1:18       ` Masahiro Yamada
2020-09-10  1:18         ` Masahiro Yamada
2020-09-10 15:17         ` Sami Tolvanen
2020-09-10 15:17           ` Sami Tolvanen
2020-09-10 18:18         ` Kees Cook
2020-09-10 18:18           ` Kees Cook
2020-09-10 17:46   ` Nick Desaulniers
2020-09-10 18:07     ` Masahiro Yamada
2020-09-22 16:27     ` [EXTERNAL] " Ian Bearman
2020-09-22 17:52       ` Nick Desaulniers

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=20200903203053.3411268-16-samitolvanen@google.com \
    --to=samitolvanen@google.com \
    --cc=clang-built-linux@googlegroups.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=keescook@chromium.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=will@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.