From: sashiko-bot@kernel.org
To: "Alexandre Courbot" <acourbot@nvidia.com>
Cc: ojeda@kernel.org, dri-devel@lists.freedesktop.org,
"Danilo Krummrich" <dakr@kernel.org>
Subject: Re: [PATCH v4 3/6] gpu: nova-core: export Rust symbols for nova-drm
Date: Fri, 05 Jun 2026 08:45:03 +0000 [thread overview]
Message-ID: <20260605084503.B38D61F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260605-nova-exports-v4-3-e948c287407c@nvidia.com>
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 <acourbot@nvidia.com>
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/20260605-nova-exports-v4-0-e948c287407c@nvidia.com?part=3
next prev parent reply other threads:[~2026-06-05 8:45 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-05 8:31 [PATCH v4 0/6] gpu: drm: nova: enable calling into nova-core Alexandre Courbot
2026-06-05 8:31 ` [PATCH v4 1/6] rust: inline some init methods Alexandre Courbot
2026-06-08 7:05 ` Miguel Ojeda
2026-06-05 8:31 ` [PATCH v4 2/6] gpu: build nova-core and nova-drm from drivers/gpu/Makefile Alexandre Courbot
2026-06-05 8:31 ` [PATCH v4 3/6] gpu: nova-core: export Rust symbols for nova-drm Alexandre Courbot
2026-06-05 8:45 ` sashiko-bot [this message]
2026-06-05 8:31 ` [PATCH v4 4/6] gpu: nova-core: emit Rust metadata " Alexandre Courbot
2026-06-05 8:36 ` Miguel Ojeda
2026-06-05 8:31 ` [PATCH v4 5/6] gpu: drm: nova: build after nova-core and use its symbols Alexandre Courbot
2026-06-05 8:31 ` [PATCH POC v4 6/6] gpu: drm: nova: demonstrate interaction with nova-core Alexandre Courbot
2026-06-05 8:45 ` sashiko-bot
2026-06-05 8:48 ` [PATCH v4 0/6] gpu: drm: nova: enable calling into nova-core Miguel Ojeda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260605084503.B38D61F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=acourbot@nvidia.com \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=ojeda@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox