<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/kernel/module/internal.h, branch v6.1.66</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v6.1.66</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v6.1.66'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2022-09-07T15:04:48Z</updated>
<entry>
<title>dyndbg: gather __dyndbg[] state into struct _ddebug_info</title>
<updated>2022-09-07T15:04:48Z</updated>
<author>
<name>Jim Cromie</name>
<email>jim.cromie@gmail.com</email>
</author>
<published>2022-09-04T21:40:48Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=b7b4eebdba7b6aea6b34dc29691b71c39d1dbd6a'/>
<id>urn:sha1:b7b4eebdba7b6aea6b34dc29691b71c39d1dbd6a</id>
<content type='text'>
This new struct composes the linker provided (vector,len) section,
and provides a place to add other __dyndbg[] state-data later:

  descs - the vector of descriptors in __dyndbg section.
  num_descs - length of the data/section.

Use it, in several different ways, as follows:

In lib/dynamic_debug.c:

ddebug_add_module(): Alter params-list, replacing 2 args (array,index)
with a struct _ddebug_info * containing them both, with room for
expansion.  This helps future-proof the function prototype against the
looming addition of class-map info into the dyndbg-state, by providing
a place to add more member fields later.

NB: later add static struct _ddebug_info builtins_state declaration,
not needed yet.

ddebug_add_module() is called in 2 contexts:

In dynamic_debug_init(), declare, init a struct _ddebug_info di
auto-var to use as a cursor.  Then iterate over the prdbg blocks of
the builtin modules, and update the di cursor before calling
_add_module for each.

Its called from kernel/module/main.c:load_info() for each loaded
module:

In internal.h, alter struct load_info, replacing the dyndbg array,len
fields with an embedded _ddebug_info containing them both; and
populate its members in find_module_sections().

The 2 calling contexts differ in that _init deals with contiguous
subranges of __dyndbgs[] section, packed together, while loadable
modules are added one at a time.

So rename ddebug_add_module() into outer/__inner fns, call __inner
from _init, and provide the offset into the builtin __dyndbgs[] where
the module's prdbgs reside.  The cursor provides start, len of the
subrange for each.  The offset will be used later to pack the results
of builtin __dyndbg_sites[] de-duplication, and is 0 and unneeded for
loadable modules,

Note:

kernel/module/main.c includes &lt;dynamic_debug.h&gt; for struct
_ddeubg_info.  This might be prone to include loops, since its also
included by printk.h.  Nothing has broken in robot-land on this.

cc: Luis Chamberlain &lt;mcgrof@kernel.org&gt;
Signed-off-by: Jim Cromie &lt;jim.cromie@gmail.com&gt;
Link: https://lore.kernel.org/r/20220904214134.408619-12-jim.cromie@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>module: Modify module_flags() to accept show_state argument</title>
<updated>2022-07-15T00:40:23Z</updated>
<author>
<name>Aaron Tomlin</name>
<email>atomlin@redhat.com</email>
</author>
<published>2022-07-14T15:39:31Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=17dd25c29cda98c370f8d5a4ae3daee33fac1669'/>
<id>urn:sha1:17dd25c29cda98c370f8d5a4ae3daee33fac1669</id>
<content type='text'>
No functional change.

With this patch a given module's state information (i.e. 'mod-&gt;state')
can be omitted from the specified buffer. Please note that this is in
preparation to include the last unloaded module's taint flag(s),
if available.

Signed-off-by: Aaron Tomlin &lt;atomlin@redhat.com&gt;
Signed-off-by: Luis Chamberlain &lt;mcgrof@kernel.org&gt;
</content>
</entry>
<entry>
<title>module: Fix selfAssignment cppcheck warning</title>
<updated>2022-07-01T21:44:17Z</updated>
<author>
<name>Christophe Leroy</name>
<email>christophe.leroy@csgroup.eu</email>
</author>
<published>2022-06-12T15:21:56Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=cfa94c538be621a0ba645adfa9ead005b5fa02f6'/>
<id>urn:sha1:cfa94c538be621a0ba645adfa9ead005b5fa02f6</id>
<content type='text'>
cppcheck reports the following warnings:

kernel/module/main.c:1455:26: warning: Redundant assignment of 'mod-&gt;core_layout.size' to itself. [selfAssignment]
   mod-&gt;core_layout.size = strict_align(mod-&gt;core_layout.size);
                         ^
kernel/module/main.c:1489:26: warning: Redundant assignment of 'mod-&gt;init_layout.size' to itself. [selfAssignment]
   mod-&gt;init_layout.size = strict_align(mod-&gt;init_layout.size);
                         ^
kernel/module/main.c:1493:26: warning: Redundant assignment of 'mod-&gt;init_layout.size' to itself. [selfAssignment]
   mod-&gt;init_layout.size = strict_align(mod-&gt;init_layout.size);
                         ^
kernel/module/main.c:1504:26: warning: Redundant assignment of 'mod-&gt;init_layout.size' to itself. [selfAssignment]
   mod-&gt;init_layout.size = strict_align(mod-&gt;init_layout.size);
                         ^
kernel/module/main.c:1459:26: warning: Redundant assignment of 'mod-&gt;data_layout.size' to itself. [selfAssignment]
   mod-&gt;data_layout.size = strict_align(mod-&gt;data_layout.size);
                         ^
kernel/module/main.c:1463:26: warning: Redundant assignment of 'mod-&gt;data_layout.size' to itself. [selfAssignment]
   mod-&gt;data_layout.size = strict_align(mod-&gt;data_layout.size);
                         ^
kernel/module/main.c:1467:26: warning: Redundant assignment of 'mod-&gt;data_layout.size' to itself. [selfAssignment]
   mod-&gt;data_layout.size = strict_align(mod-&gt;data_layout.size);
                         ^

This is due to strict_align() being a no-op when
CONFIG_STRICT_MODULE_RWX is not selected.

Transform strict_align() macro into an inline function. It will
allow type checking and avoid the selfAssignment warning.

Reported-by: kernel test robot &lt;lkp@intel.com&gt;
Signed-off-by: Christophe Leroy &lt;christophe.leroy@csgroup.eu&gt;
Signed-off-by: Luis Chamberlain &lt;mcgrof@kernel.org&gt;
</content>
</entry>
<entry>
<title>module: Introduce module unload taint tracking</title>
<updated>2022-05-12T17:29:41Z</updated>
<author>
<name>Aaron Tomlin</name>
<email>atomlin@redhat.com</email>
</author>
<published>2022-05-02T20:52:52Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=99bd9956551b27cb6f5b445abaced7e13b9976cd'/>
<id>urn:sha1:99bd9956551b27cb6f5b445abaced7e13b9976cd</id>
<content type='text'>
Currently, only the initial module that tainted the kernel is
recorded e.g. when an out-of-tree module is loaded.

The purpose of this patch is to allow the kernel to maintain a record of
each unloaded module that taints the kernel. So, in addition to
displaying a list of linked modules (see print_modules()) e.g. in the
event of a detected bad page, unloaded modules that carried a taint/or
taints are displayed too. A tainted module unload count is maintained.

The number of tracked modules is not fixed. This feature is disabled by
default.

Signed-off-by: Aaron Tomlin &lt;atomlin@redhat.com&gt;
Signed-off-by: Luis Chamberlain &lt;mcgrof@kernel.org&gt;
</content>
</entry>
<entry>
<title>module: Move module_assert_mutex_or_preempt() to internal.h</title>
<updated>2022-05-12T17:29:41Z</updated>
<author>
<name>Aaron Tomlin</name>
<email>atomlin@redhat.com</email>
</author>
<published>2022-05-02T20:51:04Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=6fb0538d0121ffab770a505b183968d93466ad59'/>
<id>urn:sha1:6fb0538d0121ffab770a505b183968d93466ad59</id>
<content type='text'>
No functional change.

This patch migrates module_assert_mutex_or_preempt() to internal.h.
So, the aforementiond function can be used outside of main/or core
module code yet will remain restricted for internal use only.

Signed-off-by: Aaron Tomlin &lt;atomlin@redhat.com&gt;
Signed-off-by: Luis Chamberlain &lt;mcgrof@kernel.org&gt;
</content>
</entry>
<entry>
<title>module: Make module_flags_taint() accept a module's taints bitmap and usable outside core code</title>
<updated>2022-05-12T17:29:41Z</updated>
<author>
<name>Aaron Tomlin</name>
<email>atomlin@redhat.com</email>
</author>
<published>2022-05-02T20:51:03Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=c14e522bc76efed6e947cd0ab83a1fac7a7a3ec9'/>
<id>urn:sha1:c14e522bc76efed6e947cd0ab83a1fac7a7a3ec9</id>
<content type='text'>
No functional change.

The purpose of this patch is to modify module_flags_taint() to accept
a module's taints bitmap as a parameter and modifies all users
accordingly. Furthermore, it is now possible to access a given
module's taint flags data outside of non-essential code yet does
remain for internal use only.

This is in preparation for module unload taint tracking support.

Signed-off-by: Aaron Tomlin &lt;atomlin@redhat.com&gt;
Signed-off-by: Luis Chamberlain &lt;mcgrof@kernel.org&gt;
</content>
</entry>
<entry>
<title>module: Add CONFIG_ARCH_WANTS_MODULES_DATA_IN_VMALLOC</title>
<updated>2022-04-05T15:43:05Z</updated>
<author>
<name>Christophe Leroy</name>
<email>christophe.leroy@csgroup.eu</email>
</author>
<published>2022-02-23T12:02:14Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=01dc0386efb769056257410ba5754558384006a7'/>
<id>urn:sha1:01dc0386efb769056257410ba5754558384006a7</id>
<content type='text'>
Add CONFIG_ARCH_WANTS_MODULES_DATA_IN_VMALLOC to allow architectures
to request having modules data in vmalloc area instead of module area.

This is required on powerpc book3s/32 in order to set data non
executable, because it is not possible to set executability on page
basis, this is done per 256 Mbytes segments. The module area has exec
right, vmalloc area has noexec.

This can also be useful on other powerpc/32 in order to maximize the
chance of code being close enough to kernel core to avoid branch
trampolines.

Cc: Jason Wessel &lt;jason.wessel@windriver.com&gt;
Acked-by: Daniel Thompson &lt;daniel.thompson@linaro.org&gt;
Cc: Douglas Anderson &lt;dianders@chromium.org&gt;
Signed-off-by: Christophe Leroy &lt;christophe.leroy@csgroup.eu&gt;
[mcgrof: rebased in light of kernel/module/kdb.c move]
Signed-off-by: Luis Chamberlain &lt;mcgrof@kernel.org&gt;
</content>
</entry>
<entry>
<title>module: Introduce data_layout</title>
<updated>2022-04-05T15:43:05Z</updated>
<author>
<name>Christophe Leroy</name>
<email>christophe.leroy@csgroup.eu</email>
</author>
<published>2022-02-23T12:02:13Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=6ab9942c44b2d213a16b2620e4baf0223122222f'/>
<id>urn:sha1:6ab9942c44b2d213a16b2620e4baf0223122222f</id>
<content type='text'>
In order to allow separation of data from text, add another layout,
called data_layout. For architectures requesting separation of text
and data, only text will go in core_layout and data will go in
data_layout.

For architectures which keep text and data together, make data_layout
an alias of core_layout, that way data_layout can be used for all
data manipulations, regardless of whether data is in core_layout or
data_layout.

Signed-off-by: Christophe Leroy &lt;christophe.leroy@csgroup.eu&gt;
Signed-off-by: Luis Chamberlain &lt;mcgrof@kernel.org&gt;
</content>
</entry>
<entry>
<title>module: Prepare for handling several RB trees</title>
<updated>2022-04-05T15:43:05Z</updated>
<author>
<name>Christophe Leroy</name>
<email>christophe.leroy@csgroup.eu</email>
</author>
<published>2022-02-23T12:02:12Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=446d55666d5599ca58c1ceac25ce4b5191e70835'/>
<id>urn:sha1:446d55666d5599ca58c1ceac25ce4b5191e70835</id>
<content type='text'>
In order to separate text and data, we need to setup
two rb trees.

Modify functions to give the tree as a parameter.

Signed-off-by: Christophe Leroy &lt;christophe.leroy@csgroup.eu&gt;
Signed-off-by: Luis Chamberlain &lt;mcgrof@kernel.org&gt;
</content>
</entry>
<entry>
<title>module: Always have struct mod_tree_root</title>
<updated>2022-04-05T15:43:05Z</updated>
<author>
<name>Christophe Leroy</name>
<email>christophe.leroy@csgroup.eu</email>
</author>
<published>2022-02-23T12:02:11Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=80b8bf4369906aefbcb63a03012aed7a1abcbd18'/>
<id>urn:sha1:80b8bf4369906aefbcb63a03012aed7a1abcbd18</id>
<content type='text'>
In order to separate text and data, we need to setup
two rb trees.

This means that struct mod_tree_root is required even without
MODULES_TREE_LOOKUP.

Signed-off-by: Christophe Leroy &lt;christophe.leroy@csgroup.eu&gt;
Reviewed-by: Aaron Tomlin &lt;atomlin@atomlin.com&gt;
Signed-off-by: Luis Chamberlain &lt;mcgrof@kernel.org&gt;
</content>
</entry>
</feed>
