<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/scripts/mod, branch v6.1.21</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v6.1.21</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v6.1.21'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2022-08-20T17:47:36Z</updated>
<entry>
<title>modpost: fix module versioning when a symbol lacks valid CRC</title>
<updated>2022-08-20T17:47:36Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2022-08-09T14:11:17Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=5b8a9a8fd1f0c3d55d407cf759d54ca68798d9ad'/>
<id>urn:sha1:5b8a9a8fd1f0c3d55d407cf759d54ca68798d9ad</id>
<content type='text'>
Since commit 7b4537199a4a ("kbuild: link symbol CRCs at final link,
removing CONFIG_MODULE_REL_CRCS"), module versioning is broken on
some architectures. Loading a module fails with "disagrees about
version of symbol module_layout".

On such architectures (e.g. ARCH=sparc build with sparc64_defconfig),
modpost shows a warning, like follows:

  WARNING: modpost: EXPORT symbol "_mcount" [vmlinux] version generation failed, symbol will not be versioned.
  Is "_mcount" prototyped in &lt;asm/asm-prototypes.h&gt;?

Previously, it was a harmless warning (CRC check was just skipped),
but now wrong CRCs are used for comparison because invalid CRCs are
just skipped.

  $ sparc64-linux-gnu-nm -n vmlinux
    [snip]
  0000000000c2cea0 r __ksymtab__kstrtol
  0000000000c2ceb8 r __ksymtab__kstrtoul
  0000000000c2ced0 r __ksymtab__local_bh_enable
  0000000000c2cee8 r __ksymtab__mcount
  0000000000c2cf00 r __ksymtab__printk
  0000000000c2cf18 r __ksymtab__raw_read_lock
  0000000000c2cf30 r __ksymtab__raw_read_lock_bh
    [snip]
  0000000000c53b34 D __crc__kstrtol
  0000000000c53b38 D __crc__kstrtoul
  0000000000c53b3c D __crc__local_bh_enable
  0000000000c53b40 D __crc__printk
  0000000000c53b44 D __crc__raw_read_lock
  0000000000c53b48 D __crc__raw_read_lock_bh

Please notice __crc__mcount is missing here.

When the module subsystem looks up a CRC that comes after, it results
in reading out a wrong address. For example, when __crc__printk is
needed, the module subsystem reads 0xc53b44 instead of 0xc53b40.

All CRC entries must be output for correct index accessing. Invalid
CRCs will be unused, but are needed to keep the one-to-one mapping
between __ksymtab_* and __crc_*.

The best is to fix all modpost warnings, but several warnings are still
remaining on less popular architectures.

Fixes: 7b4537199a4a ("kbuild: link symbol CRCs at final link, removing CONFIG_MODULE_REL_CRCS")
Reported-by: matoro &lt;matoro_mailinglist_kernel@matoro.tk&gt;
Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Tested-by: matoro &lt;matoro_mailinglist_kernel@matoro.tk&gt;
</content>
</entry>
<entry>
<title>Merge tag 'kbuild-v5.20' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild</title>
<updated>2022-08-10T17:40:41Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2022-08-10T17:40:41Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=0af5cb349a2c97fbabb3cede96efcde9d54b7940'/>
<id>urn:sha1:0af5cb349a2c97fbabb3cede96efcde9d54b7940</id>
<content type='text'>
Pull Kbuild updates from Masahiro Yamada:

 - Remove the support for -O3 (CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3)

 - Fix error of rpm-pkg cross-builds

 - Support riscv for checkstack tool

 - Re-enable -Wformwat warnings for Clang

 - Clean up modpost, Makefiles, and misc scripts

* tag 'kbuild-v5.20' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (30 commits)
  modpost: remove .symbol_white_list field entirely
  modpost: remove unneeded .symbol_white_list initializers
  modpost: add PATTERNS() helper macro
  modpost: shorten warning messages in report_sec_mismatch()
  Revert "Kbuild, lto, workaround: Don't warn for initcall_reference in modpost"
  modpost: use more reliable way to get fromsec in section_rel(a)()
  modpost: add array range check to sec_name()
  modpost: refactor get_secindex()
  kbuild: set EXIT trap before creating temporary directory
  modpost: remove unused Elf_Sword macro
  Makefile.extrawarn: re-enable -Wformat for clang
  kbuild: add dtbs_prepare target
  kconfig: Qt5: tell the user which packages are required
  modpost: use sym_get_data() to get module device_table data
  modpost: drop executable ELF support
  checkstack: add riscv support for scripts/checkstack.pl
  kconfig: shorten the temporary directory name for cc-option
  scripts: headers_install.sh: Update config leak ignore entries
  kbuild: error out if $(INSTALL_MOD_PATH) contains % or :
  kbuild: error out if $(KBUILD_EXTMOD) contains % or :
  ...
</content>
</entry>
<entry>
<title>modpost: remove .symbol_white_list field entirely</title>
<updated>2022-08-04T11:32:13Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2022-08-01T09:39:02Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=672fb6740cbfde34f4d367ffa3c939b608a927e1'/>
<id>urn:sha1:672fb6740cbfde34f4d367ffa3c939b608a927e1</id>
<content type='text'>
It is not so useful to have symbol whitelists in arrays. With this
over-engineering, the code is difficult to follow.

Let's do it more directly, and collect the relevant code to one place.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>modpost: remove unneeded .symbol_white_list initializers</title>
<updated>2022-08-04T11:32:13Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2022-08-01T09:39:01Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=1560cb0e186e83f0572a84d22e139c100060905c'/>
<id>urn:sha1:1560cb0e186e83f0572a84d22e139c100060905c</id>
<content type='text'>
The -&gt;symbol_white_list field is referenced in secref_whitelist(),
only when 'fromsec' is data_sections.

        /* Check for pattern 2 */
        if (match(tosec, init_exit_sections) &amp;&amp;
            match(fromsec, data_sections) &amp;&amp;
            match(fromsym, mismatch-&gt;symbol_white_list))
                return 0;

If .fromsec is not data sections, the .symbol_white_list member is
not used by anyone.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>modpost: add PATTERNS() helper macro</title>
<updated>2022-08-04T11:32:13Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2022-08-01T09:39:00Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=7452dd26a59a9dfcde3f179594f3be6c4752a9a9'/>
<id>urn:sha1:7452dd26a59a9dfcde3f179594f3be6c4752a9a9</id>
<content type='text'>
This will be useful to define a NULL-terminated array inside a function
call.

Currently, string arrays passed to match() are defined in separate
places:

    static const char *const init_sections[] = { ALL_INIT_SECTIONS, NULL };
    static const char *const text_sections[] = { ALL_TEXT_SECTIONS, NULL };
    static const char *const optim_symbols[] = { "*.constprop.*", NULL };

            ...

            /* Check for pattern 5 */
            if (match(fromsec, text_sections) &amp;&amp;
                match(tosec, init_sections) &amp;&amp;
                match(fromsym, optim_symbols))
                    return 0;

With the new helper macro, you can list the patterns directly in the
function call, like this:

            /* Check for pattern 5 */
            if (match(fromsec, PATTERNS(ALL_TEXT_SECTIONS)) &amp;&amp;
                match(tosec, PATTERNS(ALL_INIT_SECTIONS)) &amp;&amp;
                match(fromsym, PATTERNS("*.contprop.*")))
                    return 0;

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>modpost: shorten warning messages in report_sec_mismatch()</title>
<updated>2022-08-04T11:32:13Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2022-08-01T09:38:59Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=072dd2c8928f2ecdc52cdf5acf30479b327386c9'/>
<id>urn:sha1:072dd2c8928f2ecdc52cdf5acf30479b327386c9</id>
<content type='text'>
Each section mismatch results in long warning messages. Too much.

Make each warning fit in one line, and remove a lot of messy code.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>Revert "Kbuild, lto, workaround: Don't warn for initcall_reference in modpost"</title>
<updated>2022-08-04T11:27:17Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2022-07-30T17:36:36Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=a25efd6ef1ef4c32991a1d5a013dd41e3b8f7eff'/>
<id>urn:sha1:a25efd6ef1ef4c32991a1d5a013dd41e3b8f7eff</id>
<content type='text'>
This reverts commit 77ab21adae509c5540956729e2d03bc1a59bc82a.

Even after 8 years later, GCC LTO has not been upstreamed. Also, it said
"This is a workaround". If this is needed in the future, it should be
added in a proper way.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Reviewed-by: Nick Desaulniers &lt;ndesaulniers@google.com&gt;
Acked-by: Jiri Slaby &lt;jirislaby@kernel.org&gt;
</content>
</entry>
<entry>
<title>modpost: use more reliable way to get fromsec in section_rel(a)()</title>
<updated>2022-08-03T13:58:10Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2022-07-30T17:36:35Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=5419aa2a8deea06b796222d3215dac6adc270c78'/>
<id>urn:sha1:5419aa2a8deea06b796222d3215dac6adc270c78</id>
<content type='text'>
The section name of Rel and Rela starts with ".rel" and ".rela"
respectively (but, I do not know whether this is specification or
convention).

For example, ".rela.text" holds relocation entries applied to the
".text" section.

So, the code chops the ".rel" or ".rela" prefix to get the name of
the section to which the relocation applies.

However, I do not like to skip 4 or 5 bytes blindly because it is
potential memory overrun.

The ELF specification provides a more reliable way to do this.

 - The sh_info field holds extra information, whose interpretation
   depends on the section type

 - If the section type is SHT_REL or SHT_RELA, the sh_info field holds
   the section header index of the section to which the relocation
   applies.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>modpost: add array range check to sec_name()</title>
<updated>2022-08-03T13:58:10Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2022-07-30T17:36:34Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=125ed24a4ab0d704bab5dee5ccb2c3b05f627c78'/>
<id>urn:sha1:125ed24a4ab0d704bab5dee5ccb2c3b05f627c78</id>
<content type='text'>
The section index is always positive, so the argument, secindex, should
be unsigned.

Also, inserted the array range check.

If sym-&gt;st_shndx is a special section index (between SHN_LORESERVE and
SHN_HIRESERVE), there is no corresponding section header.

For example, if a symbol specifies an absolute value, sym-&gt;st_shndx is
SHN_ABS (=0xfff1).

The current users do not cause the out-of-range access of
info-&gt;sechddrs[], but it is better to avoid such a pitfall.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>modpost: refactor get_secindex()</title>
<updated>2022-08-03T13:56:46Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2022-08-03T13:50:13Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=36b0f0deed4fcbe9ff31268e6c3554714e4d2387'/>
<id>urn:sha1:36b0f0deed4fcbe9ff31268e6c3554714e4d2387</id>
<content type='text'>
SPECIAL() is only used in get_secindex(). Squash it.

Make the code more readable with more comments.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
</feed>
