Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] Exporting Rust symbols via `nova_core_exports.c` silently assigns identical `int`-based CRCs to all exported Rust symbols, defeating kernel module versioning (CONFIG_MODVERSIONS). --
commit 7d9ae3e551194f16dfdfeaf200ba6d4a6e3969c0 Author: Alexandre Courbot <[email protected]> gpu: nova-core: export Rust symbols for nova-drm This commit exports nova-core's Rust symbols so nova-drm can resolve references to it when loaded as a module. It generates declarations and EXPORT_SYMBOL_RUST_GPL() calls for Rust global symbols using nm and compiles them into the module as nova_core_exports.o. > diff --git a/drivers/gpu/Makefile b/drivers/gpu/Makefile > index 45e0941324fbf..2f9c6101e21c7 100644 > --- a/drivers/gpu/Makefile > +++ b/drivers/gpu/Makefile [ ... ] > +$(obj)/nova-core/exports_nova_core_generated.h: $(obj)/nova-core/nova_core.o > FORCE > + $(call if_changed,exports) > + > +targets += nova-core/exports_nova_core_generated.h > + > +$(obj)/nova-core/nova_core_exports.o: > $(obj)/nova-core/exports_nova_core_generated.h > +CFLAGS_nova-core/nova_core_exports.o := -I $(objtree)/$(obj)/nova-core [Severity: High] Does this rule need to skip gendwarfksyms? When CONFIG_MODVERSIONS and CONFIG_GENDWARFKSYMS are enabled, Kbuild computes symbol CRCs based on their DWARF type information. Since gendwarfksyms runs on nova_core_exports.o without skipping, it will generate CRCs based on the types defined in the generated C file rather than the actual Rust types. To fix this, should nova_core_exports.o skip gendwarfksyms ($(obj)/nova-core/nova_core_exports.o: private skip_gendwarfksyms = 1) and Kbuild support be added to run gendwarfksyms directly on the nova_core.o Rust object, similar to how it is handled in rust/Makefile? > diff --git a/drivers/gpu/nova-core/nova_core_exports.c > b/drivers/gpu/nova-core/nova_core_exports.c > new file mode 100644 > index 0000000000000..6e80ca9792ee5 > --- /dev/null > +++ b/drivers/gpu/nova-core/nova_core_exports.c [ ... ] > +#include <linux/export.h> > + > +#define EXPORT_SYMBOL_RUST_GPL(sym) extern int sym; EXPORT_SYMBOL_GPL(sym) [Severity: High] Will this macro assign identical, unchanging CRCs to all exported Rust symbols? Because EXPORT_SYMBOL_RUST_GPL types all exported Rust symbols as extern int sym, the resulting DWARF type for the symbols in the C object is simply int. Consequently, gendwarfksyms calculates the CRC for the C int type and assigns it to all exported Rust symbols. Any subsequent ABI changes in the Rust structs or functions that do not alter the mangled symbol name will not be reflected in the CRC. Could this silently allow incompatible, out-of-date dependent modules like nova-drm to load and cause memory corruption? > + > +#include "exports_nova_core_generated.h" -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=3
