<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/scripts/Makefile.modfinal, branch v6.12.80</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.12.80</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.12.80'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2024-09-20T00:21:53+00:00</updated>
<entry>
<title>kbuild: remove append operation on cmd_ld_ko_o</title>
<updated>2024-09-20T00:21:53+00:00</updated>
<author>
<name>Thomas Weißschuh</name>
<email>linux@weissschuh.net</email>
</author>
<published>2024-09-08T13:26:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=cc6d281fcc7319babc6dde8f95a8b7feb1eeffd0'/>
<id>urn:sha1:cc6d281fcc7319babc6dde8f95a8b7feb1eeffd0</id>
<content type='text'>
The append operation was introduced in
commit b1a1a1a09b46 ("kbuild: lto: postpone objtool")
when the command was created from two parts.
In commit 850ded46c642 ("kbuild: Fix TRIM_UNUSED_KSYMS with LTO_CLANG")
however the first part was removed again, making the append operation
unnecessary.

To keep this command definition aligned with all other command
definitions, remove the append again.

Signed-off-by: Thomas Weißschuh &lt;linux@weissschuh.net&gt;
Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>kbuild: compile constant module information only once</title>
<updated>2024-09-07T08:24:08+00:00</updated>
<author>
<name>Thomas Weißschuh</name>
<email>linux@weissschuh.net</email>
</author>
<published>2024-09-01T17:55:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=fdf94e4403ece60b29ef9e2da95e2fcefe50817f'/>
<id>urn:sha1:fdf94e4403ece60b29ef9e2da95e2fcefe50817f</id>
<content type='text'>
Various information about modules is compiled into the info sections.
For that a dedicated .mod.c file is generated by modpost for each module
and then linked into the module.
However most of the information in the .mod.c is the same for all
modules, internal and external.
Split the shared information into a dedicated source file that is
compiled once and then linked into all modules.

This avoids frequent rebuilds for all .mod.c files when using
CONFIG_LOCALVERSION_AUTO because the local version ends up in .mod.c
through UTS_RELEASE and VERMAGIC_STRING.
The modules are still relinked in this case.

The code is also easier to maintain as it's now in a proper source file
instead of an inline string literal.

Signed-off-by: Thomas Weißschuh &lt;linux@weissschuh.net&gt;
Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>kbuild: fix typos "prequisites" to "prerequisites"</title>
<updated>2024-08-22T17:41:02+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-08-18T07:07:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8fb4ac1cee88a57e7a56faba49b408a41a4af4db'/>
<id>urn:sha1:8fb4ac1cee88a57e7a56faba49b408a41a4af4db</id>
<content type='text'>
This typo in scripts/Makefile.build has been present for more than 20
years. It was accidentally copy-pasted to other scripts/Makefile.* files.
Fix them all.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Reviewed-by: Nathan Chancellor &lt;nathan@kernel.org&gt;
</content>
</entry>
<entry>
<title>kbuild,bpf: Add module-specific pahole flags for distilled base BTF</title>
<updated>2024-06-21T21:45:07+00:00</updated>
<author>
<name>Alan Maguire</name>
<email>alan.maguire@oracle.com</email>
</author>
<published>2024-06-20T09:17:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=46fb0b62ea29c0dbcb3e44f1d67aafe79bc6e045'/>
<id>urn:sha1:46fb0b62ea29c0dbcb3e44f1d67aafe79bc6e045</id>
<content type='text'>
Support creation of module BTF along with distilled base BTF;
the latter is stored in a .BTF.base ELF section and supplements
split BTF references to base BTF with information about base types,
allowing for later relocation of split BTF with a (possibly
changed) base.  resolve_btfids detects the presence of a .BTF.base
section and will use it instead of the base BTF it is passed in
BTF id resolution.

Modules will be built with a distilled .BTF.base section for external
module build, i.e.

make -C. -M=path2/module

...while in-tree module build as part of a normal kernel build will
not generate distilled base BTF; this is because in-tree modules
change with the kernel and do not require BTF relocation for the
running vmlinux.

Signed-off-by: Alan Maguire &lt;alan.maguire@oracle.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Reviewed-by: Eduard Zingerman &lt;eddyz87@gmail.com&gt;
Link: https://lore.kernel.org/bpf/20240620091733.1967885-6-alan.maguire@oracle.com
</content>
</entry>
<entry>
<title>kbuild: use GCOV_PROFILE and KCSAN_SANITIZE in scripts/Makefile.modfinal</title>
<updated>2024-05-14T14:36:12+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-05-06T13:35:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b4f944ba521485125206640f6e66dce3f350ad6b'/>
<id>urn:sha1:b4f944ba521485125206640f6e66dce3f350ad6b</id>
<content type='text'>
Instead of filtering out the GCOV and KCSAN flags, let's set GCOV_PROFILE
and KCSAN_SANITIZE to 'n', as in other Makefiles.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Reviewed-by: Kees Cook &lt;keescook@chromium.org&gt;
Tested-by: Roberto Sassu &lt;roberto.sassu@huawei.com&gt;
</content>
</entry>
<entry>
<title>kbuild: Disable KCSAN for autogenerated *.mod.c intermediaries</title>
<updated>2024-03-31T12:09:41+00:00</updated>
<author>
<name>Borislav Petkov (AMD)</name>
<email>bp@alien8.de</email>
</author>
<published>2024-03-26T20:25:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=54babdc0343fff2f32dfaafaaa9e42c4db278204'/>
<id>urn:sha1:54babdc0343fff2f32dfaafaaa9e42c4db278204</id>
<content type='text'>
When KCSAN and CONSTRUCTORS are enabled, one can trigger the

  "Unpatched return thunk in use. This should not happen!"

catch-all warning.

Usually, when objtool runs on the .o objects, it does generate a section
.return_sites which contains all offsets in the objects to the return
thunks of the functions present there. Those return thunks then get
patched at runtime by the alternatives.

KCSAN and CONSTRUCTORS add this to the object file's .text.startup
section:

  -------------------
  Disassembly of section .text.startup:

  ...

  0000000000000010 &lt;_sub_I_00099_0&gt;:
    10:   f3 0f 1e fa             endbr64
    14:   e8 00 00 00 00          call   19 &lt;_sub_I_00099_0+0x9&gt;
                          15: R_X86_64_PLT32      __tsan_init-0x4
    19:   e9 00 00 00 00          jmp    1e &lt;__UNIQUE_ID___addressable_cryptd_alloc_aead349+0x6&gt;
                          1a: R_X86_64_PLT32      __x86_return_thunk-0x4
  -------------------

which, if it is built as a module goes through the intermediary stage of
creating a &lt;module&gt;.mod.c file which, when translated, receives a second
constructor:

  -------------------
  Disassembly of section .text.startup:

  0000000000000010 &lt;_sub_I_00099_0&gt;:
    10:   f3 0f 1e fa             endbr64
    14:   e8 00 00 00 00          call   19 &lt;_sub_I_00099_0+0x9&gt;
                          15: R_X86_64_PLT32      __tsan_init-0x4
    19:   e9 00 00 00 00          jmp    1e &lt;_sub_I_00099_0+0xe&gt;
                          1a: R_X86_64_PLT32      __x86_return_thunk-0x4

  ...

  0000000000000030 &lt;_sub_I_00099_0&gt;:
    30:   f3 0f 1e fa             endbr64
    34:   e8 00 00 00 00          call   39 &lt;_sub_I_00099_0+0x9&gt;
                          35: R_X86_64_PLT32      __tsan_init-0x4
    39:   e9 00 00 00 00          jmp    3e &lt;__ksymtab_cryptd_alloc_ahash+0x2&gt;
                          3a: R_X86_64_PLT32      __x86_return_thunk-0x4
  -------------------

in the .ko file.

Objtool has run already so that second constructor's return thunk cannot
be added to the .return_sites section and thus the return thunk remains
unpatched and the warning rightfully fires.

Drop KCSAN flags from the mod.c generation stage as those constructors
do not contain data races one would be interested about.

Debugged together with David Kaplan &lt;David.Kaplan@amd.com&gt; and Nikolay
Borisov &lt;nik.borisov@suse.com&gt;.

Reported-by: Paul Menzel &lt;pmenzel@molgen.mpg.de&gt;
Closes: https://lore.kernel.org/r/0851a207-7143-417e-be31-8bf2b3afb57d@molgen.mpg.de
Signed-off-by: Borislav Petkov (AMD) &lt;bp@alien8.de&gt;
Tested-by: Paul Menzel &lt;pmenzel@molgen.mpg.de&gt; # Dell XPS 13
Reviewed-by: Nikolay Borisov &lt;nik.borisov@suse.com&gt;
Reviewed-by: Marco Elver &lt;elver@google.com&gt;
Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>kbuild: remove ARCH_POSTLINK from module builds</title>
<updated>2023-10-28T12:10:08+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2023-10-18T15:19:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7f6d8f7e43fb516f060cf71672a922031aa5faa9'/>
<id>urn:sha1:7f6d8f7e43fb516f060cf71672a922031aa5faa9</id>
<content type='text'>
The '%.ko' rule in arch/*/Makefile.postlink does nothing but call the
'true' command.

Remove the unneeded code.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Reviewed-by: Nicolas Schier &lt;n.schier@avm.de&gt;
</content>
</entry>
<entry>
<title>btf, scripts: rust: drop is_rust_module.sh</title>
<updated>2023-08-10T20:28:04+00:00</updated>
<author>
<name>Andrea Righi</name>
<email>andrea.righi@canonical.com</email>
</author>
<published>2023-07-04T05:21:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=41bdc6decda074afc4d8f8ba44c69b08d0e9aff6'/>
<id>urn:sha1:41bdc6decda074afc4d8f8ba44c69b08d0e9aff6</id>
<content type='text'>
With commit c1177979af9c ("btf, scripts: Exclude Rust CUs with pahole")
we are now able to use pahole directly to identify Rust compilation
units (CUs) and exclude them from generating BTF debugging information
(when DEBUG_INFO_BTF is enabled).

And if pahole doesn't support the --lang-exclude flag, we can't enable
both RUST and DEBUG_INFO_BTF at the same time.

So, in any case, the script is_rust_module.sh is just redundant and we
can drop it.

NOTE: we may also be able to drop the "Rust loadable module" mark
inside Rust modules, but it seems safer to keep it for now to make sure
we are not breaking any external tool that may potentially rely on it.

Signed-off-by: Andrea Righi &lt;andrea.righi@canonical.com&gt;
Reviewed-by: Nathan Chancellor &lt;nathan@kernel.org&gt;
Tested-by: Eric Curtin &lt;ecurtin@redhat.com&gt;
Reviewed-by: Eric Curtin &lt;ecurtin@redhat.com&gt;
Reviewed-by: Neal Gompa &lt;neal@gompa.dev&gt;
Reviewed-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Reviewed-by: Martin Rodriguez Reboredo &lt;yakoyoku@gmail.com&gt;
Acked-by: Daniel Xu &lt;dxu@dxuuu.xyz&gt;
Link: https://lore.kernel.org/r/20230704052136.155445-1-andrea.righi@canonical.com
[ Picked the `Reviewed-by`s from the old patch too. ]
Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
</content>
</entry>
<entry>
<title>kbuild: Disable GCOV for *.mod.o</title>
<updated>2023-06-25T14:12:20+00:00</updated>
<author>
<name>Sami Tolvanen</name>
<email>samitolvanen@google.com</email>
</author>
<published>2023-06-23T00:11:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=25a21fbb934a0d989e1858f83c2ddf4cfb2ebe30'/>
<id>urn:sha1:25a21fbb934a0d989e1858f83c2ddf4cfb2ebe30</id>
<content type='text'>
With GCOV_PROFILE_ALL, Clang injects __llvm_gcov_* functions to each
object file, including the *.mod.o. As we filter out CC_FLAGS_CFI
for *.mod.o, the compiler won't generate type hashes for the
injected functions, and therefore indirectly calling them during
module loading trips indirect call checking.

Enabling CFI for *.mod.o isn't sufficient to fix this issue after
commit 0c3e806ec0f9 ("x86/cfi: Add boot time hash randomization"),
as *.mod.o aren't processed by objtool, which means any hashes
emitted there won't be randomized. Therefore, in addition to
disabling CFI for *.mod.o, also disable GCOV, as the object files
don't otherwise contain any executable code.

Fixes: cf68fffb66d6 ("add support for Clang CFI")
Reported-by: Joe Fradley &lt;joefradley@google.com&gt;
Signed-off-by: Sami Tolvanen &lt;samitolvanen@google.com&gt;
Acked-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Reviewed-by: Kees Cook &lt;keescook@chromium.org&gt;
Reviewed-by: Nick Desaulniers &lt;ndesaulniers@google.com&gt;
Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>kbuild: rename cmd_$@ to savedcmd_$@ in *.cmd files</title>
<updated>2023-01-22T14:43:33+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2022-12-29T09:15:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=92215e7a801da7b89037a185c98f5ebb86a415b9'/>
<id>urn:sha1:92215e7a801da7b89037a185c98f5ebb86a415b9</id>
<content type='text'>
The cmd-check macro compares $(cmd_$@) and $(cmd_$1), but a pitfall is
that you cannot use cmd_&lt;target&gt; as the variable name for the command.

For example, the following code will not work in the top Makefile
or ./Kbuild.

    quiet_cmd_foo = GEN     $@
          cmd_foo = touch $@

    targets += foo
    foo: FORCE
            $(call if_changed,foo)

In this case, both $@ and $1 are expanded to 'foo', so $(cmd_check)
is always empty.

We do not need to use the same prefix for cmd_$@ and cmd_$1.
Rename the former to savedcmd_$@.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Reviewed-by: Nicolas Schier &lt;nicolas@fjasle.eu&gt;
</content>
</entry>
</feed>
