Commit Graph

3 Commits

Author SHA1 Message Date
Donald Dutile 5806df5e42 module: Annotate struct module_notes_attrs with __counted_by
JIRA: https://issues.redhat.com/browse/RHEL-28063

commit ea0b0bcef4917a2640ecc100c768b8e785784834
Author: Kees Cook <keescook@chromium.org>
Date:   Fri Sep 22 10:52:53 2023 -0700

    module: Annotate struct module_notes_attrs with __counted_by

    Prepare for the coming implementation by GCC and Clang of the __counted_by
    attribute. Flexible array members annotated with __counted_by can have
    their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS
    (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family
    functions).

    As found with Coccinelle[1], add __counted_by for struct module_notes_attrs.

    [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

    Cc: Luis Chamberlain <mcgrof@kernel.org>
    Cc: linux-modules@vger.kernel.org
    Signed-off-by: Kees Cook <keescook@chromium.org>
    Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>

Signed-off-by: Donald Dutile <ddutile@redhat.com>
2024-06-17 14:17:29 -04:00
Donald Dutile 6e230e9c8d module: remove redundant module_sysfs_initialized variable
JIRA: https://issues.redhat.com/browse/RHEL-28063

commit 3cd60866d46050d14734cbbac41b00c8d3e51d61
Author: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Date:   Thu Sep 29 14:10:39 2022 +0200

    module: remove redundant module_sysfs_initialized variable

    The variable module_sysfs_initialized is used for checking whether
    module_kset has been initialized. Checking module_kset itself works
    just fine for that.

    This is a leftover from commit 7405c1e15e ("kset: convert /sys/module
    to use kset_create").

    Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
    Reviewed-by: Miroslav Benes <mbenes@suse.cz>
    [mcgrof: adjusted commit log as suggested by Christophe Leroy]
    Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>

Signed-off-by: Donald Dutile <ddutile@redhat.com>
2024-06-17 14:17:21 -04:00
Donald Dutile b0398c9791 module: Move sysfs support into a separate file
JIRA: https://issues.redhat.com/browse/RHEL-28063

Conflicts:
  Modified sysfs.c patch to change spaces before tabs
  that git am was complaining about.  No functional change.

commit 44c09535de4784f31d151aa1047efcf4797ca3cd
Author: Aaron Tomlin <atomlin@redhat.com>
Date:   Tue Mar 22 14:03:42 2022 +0000

    module: Move sysfs support into a separate file

    No functional change.

    This patch migrates module sysfs support out of core code into
    kernel/module/sysfs.c. In addition simple code refactoring to
    make this possible.

    Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
    Signed-off-by: Aaron Tomlin <atomlin@redhat.com>
    Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>

Signed-off-by: Donald Dutile <ddutile@redhat.com>
2024-06-17 14:17:13 -04:00