<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/scripts/mod, branch vsnprintf</title>
<subtitle>Linux kernel source tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/'/>
<entry>
<title>modpost: distinguish same module paths from different dump files</title>
<updated>2024-12-21T03:42:10+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-12-12T15:46:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=9435dc77a33fa20afec7cd35ceaae5f7f42dbbe2'/>
<id>9435dc77a33fa20afec7cd35ceaae5f7f42dbbe2</id>
<content type='text'>
Since commit 13b25489b6f8 ("kbuild: change working directory to external
module directory with M="), module paths are always relative to the top
of the external module tree.

The module paths recorded in Module.symvers are no longer globally unique
when they are passed via KBUILD_EXTRA_SYMBOLS for building other external
modules, which may result in false-positive "exported twice" errors.
Such errors should not occur because external modules should be able to
override in-tree modules.

To address this, record the dump file path in struct module and check it
when searching for a module.

Fixes: 13b25489b6f8 ("kbuild: change working directory to external module directory with M=")
Reported-by: Jon Hunter &lt;jonathanh@nvidia.com&gt;
Closes: https://lore.kernel.org/all/eb21a546-a19c-40df-b821-bbba80f19a3d@nvidia.com/
Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Tested-by: Jon Hunter &lt;jonathanh@nvidia.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Since commit 13b25489b6f8 ("kbuild: change working directory to external
module directory with M="), module paths are always relative to the top
of the external module tree.

The module paths recorded in Module.symvers are no longer globally unique
when they are passed via KBUILD_EXTRA_SYMBOLS for building other external
modules, which may result in false-positive "exported twice" errors.
Such errors should not occur because external modules should be able to
override in-tree modules.

To address this, record the dump file path in struct module and check it
when searching for a module.

Fixes: 13b25489b6f8 ("kbuild: change working directory to external module directory with M=")
Reported-by: Jon Hunter &lt;jonathanh@nvidia.com&gt;
Closes: https://lore.kernel.org/all/eb21a546-a19c-40df-b821-bbba80f19a3d@nvidia.com/
Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Tested-by: Jon Hunter &lt;jonathanh@nvidia.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>modpost: Add .irqentry.text to OTHER_SECTIONS</title>
<updated>2024-12-08T08:11:34+00:00</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2024-12-01T11:17:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=7912405643a14b527cd4a4f33c1d4392da900888'/>
<id>7912405643a14b527cd4a4f33c1d4392da900888</id>
<content type='text'>
The compiler can fully inline the actual handler function of an interrupt
entry into the .irqentry.text entry point. If such a function contains an
access which has an exception table entry, modpost complains about a
section mismatch:

  WARNING: vmlinux.o(__ex_table+0x447c): Section mismatch in reference ...

  The relocation at __ex_table+0x447c references section ".irqentry.text"
  which is not in the list of authorized sections.

Add .irqentry.text to OTHER_SECTIONS to cure the issue.

Reported-by: Sergey Senozhatsky &lt;senozhatsky@chromium.org&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: stable@vger.kernel.org # needed for linux-5.4-y
Link: https://lore.kernel.org/all/20241128111844.GE10431@google.com/
Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The compiler can fully inline the actual handler function of an interrupt
entry into the .irqentry.text entry point. If such a function contains an
access which has an exception table entry, modpost complains about a
section mismatch:

  WARNING: vmlinux.o(__ex_table+0x447c): Section mismatch in reference ...

  The relocation at __ex_table+0x447c references section ".irqentry.text"
  which is not in the list of authorized sections.

Add .irqentry.text to OTHER_SECTIONS to cure the issue.

Reported-by: Sergey Senozhatsky &lt;senozhatsky@chromium.org&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: stable@vger.kernel.org # needed for linux-5.4-y
Link: https://lore.kernel.org/all/20241128111844.GE10431@google.com/
Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>modpost: replace tdb_hash() with hash_str()</title>
<updated>2024-11-27T23:46:03+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-11-23T08:36:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=5eaea85187bf2132d1af916010fa9e26bb63f97f'/>
<id>5eaea85187bf2132d1af916010fa9e26bb63f97f</id>
<content type='text'>
Use a helper available in scripts/include/hash.h.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Use a helper available in scripts/include/hash.h.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>modpost: improve error messages in device_id_check()</title>
<updated>2024-11-27T23:46:02+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-11-19T23:56:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=2b1bd507542a6ec1506a847da8e81fc764a4e707'/>
<id>2b1bd507542a6ec1506a847da8e81fc764a4e707</id>
<content type='text'>
The first error message in device_id_check() is obscure and can be
misleading because the cause of the error is unlikely to be found in
the struct definition in mod_devicetable.h.

This type of error occurs when an array is passed to an incorrect type
of MODULE_DEVICE_TABLE().

[Example 1]

    static const struct acpi_device_id foo_ids[] = {
            { "FOO" },
            { /* sentinel */ },
    };
    MODULE_DEVICE_TABLE(of, foo_ids);

Currently, modpost outputs a meaningless suggestion:

    ERROR: modpost: ...: sizeof(struct of_device_id)=200 is not a modulo of the size of section __mod_device_table__of__&lt;identifier&gt;=64.
    Fix definition of struct of_device_id in mod_devicetable.h

The root cause here is that MODULE_DEVICE_TABLE(of, ...) is used instead
of the correct MODULE_DEVICE_TABLE(acpi, ...).

This commit provides a more intuitive error message:

    ERROR: modpost: ...: type mismatch between foo_ids[] and MODULE_DEVICE_TABLE(of, ...)

The second error message, related to a missing terminator, is too
verbose.

[Example 2]

    static const struct acpi_device_id foo_ids[] = {
            { "FOO" },
    };
    MODULE_DEVICE_TABLE(acpi, foo_ids);

The current error message is overly long, and does not pinpoint the
incorrect array:

    ...: struct acpi_device_id is 32 bytes.  The last of 1 is:
    0x46 0x4f 0x4f 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
    ERROR: modpost: ...: struct acpi_device_id is not terminated with a NULL entry!

This commit changes it to a more concise error message, sufficient to
identify the incorrect array:

    ERROR: modpost: ...: foo_ids[] is not terminated with a NULL entry

Lastly, this commit squashes device_id_check() into do_table() and
changes fatal() into error(), allowing modpost to continue processing
other modules.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The first error message in device_id_check() is obscure and can be
misleading because the cause of the error is unlikely to be found in
the struct definition in mod_devicetable.h.

This type of error occurs when an array is passed to an incorrect type
of MODULE_DEVICE_TABLE().

[Example 1]

    static const struct acpi_device_id foo_ids[] = {
            { "FOO" },
            { /* sentinel */ },
    };
    MODULE_DEVICE_TABLE(of, foo_ids);

Currently, modpost outputs a meaningless suggestion:

    ERROR: modpost: ...: sizeof(struct of_device_id)=200 is not a modulo of the size of section __mod_device_table__of__&lt;identifier&gt;=64.
    Fix definition of struct of_device_id in mod_devicetable.h

The root cause here is that MODULE_DEVICE_TABLE(of, ...) is used instead
of the correct MODULE_DEVICE_TABLE(acpi, ...).

This commit provides a more intuitive error message:

    ERROR: modpost: ...: type mismatch between foo_ids[] and MODULE_DEVICE_TABLE(of, ...)

The second error message, related to a missing terminator, is too
verbose.

[Example 2]

    static const struct acpi_device_id foo_ids[] = {
            { "FOO" },
    };
    MODULE_DEVICE_TABLE(acpi, foo_ids);

The current error message is overly long, and does not pinpoint the
incorrect array:

    ...: struct acpi_device_id is 32 bytes.  The last of 1 is:
    0x46 0x4f 0x4f 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
    ERROR: modpost: ...: struct acpi_device_id is not terminated with a NULL entry!

This commit changes it to a more concise error message, sufficient to
identify the incorrect array:

    ERROR: modpost: ...: foo_ids[] is not terminated with a NULL entry

Lastly, this commit squashes device_id_check() into do_table() and
changes fatal() into error(), allowing modpost to continue processing
other modules.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>modpost: rename alias symbol for MODULE_DEVICE_TABLE()</title>
<updated>2024-11-27T23:46:02+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-11-19T23:56:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=054a9cd395a79f4a5595f2cd24542e9bca8723c8'/>
<id>054a9cd395a79f4a5595f2cd24542e9bca8723c8</id>
<content type='text'>
This commit renames the alias symbol, __mod_&lt;type&gt;__&lt;name&gt;_device_table
to __mod_device_table__&lt;type&gt;__&lt;name&gt;.

This change simplifies the code slightly, as there is no longer a need
to check both the prefix and suffix.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This commit renames the alias symbol, __mod_&lt;type&gt;__&lt;name&gt;_device_table
to __mod_device_table__&lt;type&gt;__&lt;name&gt;.

This change simplifies the code slightly, as there is no longer a need
to check both the prefix and suffix.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>modpost: rename variables in handle_moddevtable()</title>
<updated>2024-11-27T23:46:02+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-11-19T23:56:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=9a8ace8bb2efa0ca43a77866fa9c835294b1e045'/>
<id>9a8ace8bb2efa0ca43a77866fa9c835294b1e045</id>
<content type='text'>
This commit renames the variables in handle_moddevtable() as follows:

    name       -&gt; type
    namelen    -&gt; typelen
    identifier -&gt; name

These changes align with the definition in include/linux/module.h:

  extern typeof(name) __mod_##type##__##name##_device_table

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This commit renames the variables in handle_moddevtable() as follows:

    name       -&gt; type
    namelen    -&gt; typelen
    identifier -&gt; name

These changes align with the definition in include/linux/module.h:

  extern typeof(name) __mod_##type##__##name##_device_table

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>modpost: move strstarts() to modpost.h</title>
<updated>2024-11-27T23:46:02+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-11-19T23:56:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=9d98038d438d8515473a75a29bc524e9a4a5882a'/>
<id>9d98038d438d8515473a75a29bc524e9a4a5882a</id>
<content type='text'>
This macro is useful in file2alias.c as well.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This macro is useful in file2alias.c as well.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>modpost: convert do_usb_table() to a generic handler</title>
<updated>2024-11-27T23:46:02+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-11-19T23:56:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=abd20428c3f2f8b97a2a0414343faf0ff246a018'/>
<id>abd20428c3f2f8b97a2a0414343faf0ff246a018</id>
<content type='text'>
do_usb_table() no longer needs to iterate over the usb_device_id array.

Convert it to a generic -&gt;do_entry() handler.

This is the last special case. Clean up handle_moddevtable().

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
do_usb_table() no longer needs to iterate over the usb_device_id array.

Convert it to a generic -&gt;do_entry() handler.

This is the last special case. Clean up handle_moddevtable().

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>modpost: convert do_of_table() to a generic handler</title>
<updated>2024-11-27T23:46:02+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-11-19T23:56:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=c58854c8e0b50c2f30c729b82b92b3fd8cc8f2c1'/>
<id>c58854c8e0b50c2f30c729b82b92b3fd8cc8f2c1</id>
<content type='text'>
do_of_table() no longer needs to iterate over the of_device_id array.

Convert it to a generic -&gt;do_entry() handler.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
do_of_table() no longer needs to iterate over the of_device_id array.

Convert it to a generic -&gt;do_entry() handler.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>modpost: convert do_pnp_device_entry() to a generic handler</title>
<updated>2024-11-27T23:46:02+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-11-19T23:56:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=600dbaf1e2f0c0b70b2d3e7513a161b884e7718f'/>
<id>600dbaf1e2f0c0b70b2d3e7513a161b884e7718f</id>
<content type='text'>
do_pnp_device_entry() no longer needs to iterate over the
pnp_device_id array.

Convert it to a generic -&gt;do_entry() handler.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
do_pnp_device_entry() no longer needs to iterate over the
pnp_device_id array.

Convert it to a generic -&gt;do_entry() handler.

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