rust: macros: allow non-ASCII characters in `authors`
Subsystems (2)
PATCH 1/1 rust: macros: allow non-ASCII characters in `authors`
Module authors may have non-ASCII characters in their names. In C, MODULE_AUTHOR allows arbitrary string literals which are emitted as raw UTF-8 bytes into the .modinfo section, and multiple in-tree modules use non-ASCII author names.
Originally, the single author field permitted arbitrary string literals including non-ASCII characters. When support for multiple authors was introduced in commit 38559da6afb2 ("rust: module: introduce authors key"), it reused the expect_string_array helper that had originally been added for module aliases. Because that helper enforced an ASCII check, authors inadvertently became restricted to ASCII-only string literals. Later, when the macro parsing was rewritten to use syn in commit c578ad703ae9 ("rust: macros: use syn to parse module! macro"), this restriction was carried over by using AsciiLitStr in authors type.
Change the element type of authors in ModuleInfo from AsciiLitStr to LitStr so that UTF-8 author names are permitted.
--- rust/macros/lib.rs | 2 +- rust/macros/module.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
rust/macros/lib.rs +1 -1
@@ -129,7 +129,7 @@/// # Supported argument types /// - `type`: type which implements the [`Module`] trait (required). /// - `name`: ASCII string literal of the name of the kernel module (required). -/// - `authors`: array of ASCII string literals of the authors of the kernel module. +/// - `authors`: array of string literals of the authors of the kernel module. /// - `description`: string literal of the description of the kernel module. /// - `license`: ASCII string literal of the license of the kernel module (required). /// - `alias`: array of ASCII string literals of the alias names of the kernel module.
rust/macros/module.rs +1 -1
@@ -369,7 +369,7 @@ pub(crate) struct ModuleInfo { type_: Type, license: AsciiLitStr, name: AsciiLitStr, - authors: Option<Punctuated<AsciiLitStr, Token![,]>>, + authors: Option<Punctuated<LitStr, Token![,]>>, description: Option<LitStr>, alias: Option<Punctuated<AsciiLitStr, Token![,]>>, firmware: Option<Punctuated<AsciiLitStr, Token![,]>>,
Signature · 1 line
2.55.0.1082.g2b9226bbc0-goog
Gary Guo
reviewerQuoted 15 lines · On Thu Sep 17, 2026 at 6:11 AM BST, =?UTF-8?q?Thi=C3=A9baud=20Weksteen?= wrote:
Module authors may have non-ASCII characters in their names. In C,
MODULE_AUTHORallows arbitrary string literals which are emitted as raw UTF-8 bytes into the.modinfosection, and multiple in-tree modules use non-ASCII author names.Originally, the single
authorfield permitted arbitrary string literals including non-ASCII characters. When support for multiple authors was introduced in commit38559da6afb2("rust: module: introduceauthorskey"), it reused theexpect_string_arrayhelper that had originally been added for module aliases. Because that helper enforced an ASCII check,authorsinadvertently became restricted to ASCII-only string literals. Later, when the macro parsing was rewritten to usesynin commitc578ad703ae9("rust: macros: usesynto parsemodule!macro"), this restriction was carried over by using AsciiLitStr inauthorstype.
Quoted 5 lines
Change the element type of
authorsinModuleInfofromAsciiLitStrtoLitStrso that UTF-8 author names are permitted.Fixes 38559da6afb2 ("rust: module: introduce `authors` key")Signed-off-by Thiébaud Weksteen <[email protected]>
Off topic, but I have a question for modules maintainers...
Does the authors field still serve this purpose today?
Almost always it is just the initial submitter, while the code has been subject to many changes (many of them tree wide too), and the maintainers could have changed as well.
We have copyright comments on top of files, and git for checking the file history. What's the point of keeping his inside module metadata?
Best,
Gary
Quoted 31 lines
--- rust/macros/lib.rs | 2 +- rust/macros/module.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)rust/macros/lib.rs +1
-1@@ -129,7 +129,7 @@/// # Supported argument types /// - `type`: type which implements the [`Module`] trait (required). /// - `name`: ASCII string literal of the name of the kernel module (required). -/// - `authors`: array of ASCII string literals of the authors of the kernel module. +/// - `authors`: array of string literals of the authors of the kernel module. /// - `description`: string literal of the description of the kernel module. /// - `license`: ASCII string literal of the license of the kernel module (required). /// - `alias`: array of ASCII string literals of the alias names of the kernel module. rust/macros/module.rs +1
-1@@ -369,7 +369,7 @@ pub(crate) struct ModuleInfo { type_: Type, license: AsciiLitStr, name: AsciiLitStr, - authors: Option<Punctuated<AsciiLitStr, Token![,]>>, + authors: Option<Punctuated<LitStr, Token![,]>>, description: Option<LitStr>, alias: Option<Punctuated<AsciiLitStr, Token![,]>>, firmware: Option<Punctuated<AsciiLitStr, Token![,]>>,
Quoted 24 lines · Gary Guo
Quoted 15 lines · On Thu Sep 17, 2026 at 6:11 AM BST, =?UTF-8?q?Thi=C3=A9baud=20Weksteen?= wrote:
Module authors may have non-ASCII characters in their names. In C,
MODULE_AUTHORallows arbitrary string literals which are emitted as raw UTF-8 bytes into the.modinfosection, and multiple in-tree modules use non-ASCII author names.Originally, the single
authorfield permitted arbitrary string literals including non-ASCII characters. When support for multiple authors was introduced in commit38559da6afb2("rust: module: introduceauthorskey"), it reused theexpect_string_arrayhelper that had originally been added for module aliases. Because that helper enforced an ASCII check,authorsinadvertently became restricted to ASCII-only string literals. Later, when the macro parsing was rewritten to usesynin commitc578ad703ae9("rust: macros: usesynto parsemodule!macro"), this restriction was carried over by using AsciiLitStr inauthorstype.Quoted 5 lines
Change the element type of
authorsinModuleInfofromAsciiLitStrtoLitStrso that UTF-8 author names are permitted.Fixes 38559da6afb2 ("rust: module: introduce `authors` key")Signed-off-by Thiébaud Weksteen <[email protected]>Off topic, but I have a question for modules maintainers...
Quoted 8 lines
Does the
authorsfield still serve this purpose today?Almost always it is just the initial submitter, while the code has been subject to many changes (many of them tree wide too), and the maintainers could have changed as well.
We have copyright comments on top of files, and git for checking the file history. What's the point of keeping his inside module metadata?
MODULE_AUTHOR() was apparently added in 2.1.18 back in 1996 [1], with a comment that it is for documentation purposes.
I don't have a full picture of how this modinfo field is currently used by module authors, maintainers and users. I think it can be useful as a record of all past and present primary authors of a specific module, and it has also value for external modules. Unlike copyright statements and Git history, the information is directly visible to users through the modinfo utility.
It is up to individual module maintainers whether they want to use this field and maintain its information. The module loader doesn't enforce its setting in any way.
Signature · 2 lines
Cheers, Petr
Gary Guo
reviewerQuoted 31 lines · Petr Pavlu
Quoted 30 lines · Gary Guo
Quoted 15 lines · On Thu Sep 17, 2026 at 6:11 AM BST, =?UTF-8?q?Thi=C3=A9baud=20Weksteen?= wrote:
Module authors may have non-ASCII characters in their names. In C,
MODULE_AUTHORallows arbitrary string literals which are emitted as raw UTF-8 bytes into the.modinfosection, and multiple in-tree modules use non-ASCII author names.Originally, the single
authorfield permitted arbitrary string literals including non-ASCII characters. When support for multiple authors was introduced in commit38559da6afb2("rust: module: introduceauthorskey"), it reused theexpect_string_arrayhelper that had originally been added for module aliases. Because that helper enforced an ASCII check,authorsinadvertently became restricted to ASCII-only string literals. Later, when the macro parsing was rewritten to usesynin commitc578ad703ae9("rust: macros: usesynto parsemodule!macro"), this restriction was carried over by using AsciiLitStr inauthorstype.Quoted 5 lines
Change the element type of
authorsinModuleInfofromAsciiLitStrtoLitStrso that UTF-8 author names are permitted.Fixes 38559da6afb2 ("rust: module: introduce `authors` key")Signed-off-by Thiébaud Weksteen <[email protected]>Off topic, but I have a question for modules maintainers...
Does the
authorsfield still serve this purpose today?Almost always it is just the initial submitter, while the code has been subject to many changes (many of them tree wide too), and the maintainers could have changed as well.
Quoted 5 lines
Quoted 2 lines
We have copyright comments on top of files, and git for checking the file history. What's the point of keeping his inside module metadata?
MODULE_AUTHOR()was apparently added in 2.1.18 back in 1996 [1], with a comment that it is for documentation purposes.
I am pretty sure the kernel changed a lot since then :)
Quoted 4 lines
I don't have a full picture of how this modinfo field is currently used by module authors, maintainers and users. I think it can be useful as a record of all past and present primary authors of a specific module,
Well, if they're actually updated... But as pointed out that this was usually not the case.
Quoted 1 line
and it has also value for external modules.
The version field has value for external modules too, but that was recently removed. I don't think we should care about external modules too much.
Quoted 3 lines
Unlike copyright statements
and Git history, the information is directly visible to users through the modinfo utility.
Hmm, why does the user want to know who is the primary author of a module? Users shouldn't try to contact the authors anyway, they should find the current maintainers...
Even if the field is perfectly up-to-date, a user running an older kernel should still not use this field as they need to contact the current mainline maintainer if they have issues.
I just find this info to be hardly useful at all.
Best,
Gary
Quoted 6 lines
It is up to individual module maintainers whether they want to use this field and maintain its information. The module loader doesn't enforce its setting in any way.
Quoted 16 lines · Thiébaud Weksteen
Module authors may have non-ASCII characters in their names. In C,
MODULE_AUTHORallows arbitrary string literals which are emitted as raw UTF-8 bytes into the.modinfosection, and multiple in-tree modules use non-ASCII author names.Originally, the single
authorfield permitted arbitrary string literals including non-ASCII characters. When support for multiple authors was introduced in commit38559da6afb2("rust: module: introduceauthorskey"), it reused theexpect_string_arrayhelper that had originally been added for module aliases. Because that helper enforced an ASCII check,authorsinadvertently became restricted to ASCII-only string literals. Later, when the macro parsing was rewritten to usesynin commitc578ad703ae9("rust: macros: usesynto parsemodule!macro"), this restriction was carried over by using AsciiLitStr inauthorstype.
Quoted 5 lines
Change the element type of
authorsinModuleInfofromAsciiLitStrtoLitStrso that UTF-8 author names are permitted.Fixes 38559da6afb2 ("rust: module: introduce `authors` key")Signed-off-by Thiébaud Weksteen <[email protected]>
This looks good, thanks! We did discuss allowing non-ASCII long ago, so this wasn't intentional.
Petr & modules: I can pick this on up (an Acked-by would be nice!), unless you want to pick it.
By the way:
Cheers,
Miguel
Gary Guo
reviewerQuoted 26 lines · Miguel Ojeda
Quoted 16 lines · Thiébaud Weksteen
Module authors may have non-ASCII characters in their names. In C,
MODULE_AUTHORallows arbitrary string literals which are emitted as raw UTF-8 bytes into the.modinfosection, and multiple in-tree modules use non-ASCII author names.Originally, the single
authorfield permitted arbitrary string literals including non-ASCII characters. When support for multiple authors was introduced in commit38559da6afb2("rust: module: introduceauthorskey"), it reused theexpect_string_arrayhelper that had originally been added for module aliases. Because that helper enforced an ASCII check,authorsinadvertently became restricted to ASCII-only string literals. Later, when the macro parsing was rewritten to usesynin commitc578ad703ae9("rust: macros: usesynto parsemodule!macro"), this restriction was carried over by using AsciiLitStr inauthorstype.Quoted 5 lines
Change the element type of
authorsinModuleInfofromAsciiLitStrtoLitStrso that UTF-8 author names are permitted.Fixes 38559da6afb2 ("rust: module: introduce `authors` key")Signed-off-by Thiébaud Weksteen <[email protected]>This looks good, thanks! We did discuss allowing non-ASCII long ago, so this wasn't intentional.
Quoted 6 lines
Petr & modules: I can pick this on up (an Acked-by would be nice!), unless you want to pick it.
By the way:
I'm not sure that this should be considered a fix. More like a feature.
Best,
Gary
Quoted 2 lines · Gary Guo
I'm not sure that this should be considered a fix. More like a feature.
Yeah, I had the same thought, but given we discussed the topic in the past and we supported non-ASCII on purpose on commit b13c9880f909 ("rust: macros: take string literals in module!"), I thought it counted as such (that is why I mentioned it was unintentional in my previous message).
Having said that, it has been quite a while, and it is also true that for 6.18.y it may not be worth to change it since it does not apply cleanly given the syn rewrite. It is easy, but requires creating a next expect_ helper.
Cheers,
Miguel
Gary Guo
reviewerQuoted 9 lines · Miguel Ojeda
Quoted 2 lines · Gary Guo
I'm not sure that this should be considered a fix. More like a feature.
Yeah, I had the same thought, but given we discussed the topic in the past and we supported non-ASCII on purpose on commit
b13c9880f909("rust: macros: take string literals inmodule!"), I thought it counted as such (that is why I mentioned it was unintentional in my previous message).
Ah, that's my patch. It had been completely paged out from my memory. In that case this is indeed a fix.
I don't think it's worth tagging stable though. It's not something worth putting effort backporting, but if AUTOSEL picked it via the fixes tag it doesn't hurt either.
Best,
Gary
Quoted 3 lines · Gary Guo
Ah, that's my patch. It had been completely paged out from my memory. In that case this is indeed a fix.
Thanks for confirming!
Quoted 3 lines
I don't think it's worth tagging stable though. It's not something worth putting effort backporting, but if AUTOSEL picked it via the fixes tag it doesn't hurt either.
Yeah, I think it doesn't matter either way. I can remove the Cc. If someone needs it, we can backport it later on.
Cheers,
Miguel
Petr Pavlu
maintainerQuoted 32 lines · Gary Guo
Quoted 31 lines · Petr Pavlu
Quoted 30 lines · Gary Guo
Quoted 15 lines · On Thu Sep 17, 2026 at 6:11 AM BST, =?UTF-8?q?Thi=C3=A9baud=20Weksteen?= wrote:
Module authors may have non-ASCII characters in their names. In C,
MODULE_AUTHORallows arbitrary string literals which are emitted as raw UTF-8 bytes into the.modinfosection, and multiple in-tree modules use non-ASCII author names.Originally, the single
authorfield permitted arbitrary string literals including non-ASCII characters. When support for multiple authors was introduced in commit38559da6afb2("rust: module: introduceauthorskey"), it reused theexpect_string_arrayhelper that had originally been added for module aliases. Because that helper enforced an ASCII check,authorsinadvertently became restricted to ASCII-only string literals. Later, when the macro parsing was rewritten to usesynin commitc578ad703ae9("rust: macros: usesynto parsemodule!macro"), this restriction was carried over by using AsciiLitStr inauthorstype.Quoted 5 lines
Change the element type of
authorsinModuleInfofromAsciiLitStrtoLitStrso that UTF-8 author names are permitted.Fixes 38559da6afb2 ("rust: module: introduce `authors` key")Signed-off-by Thiébaud Weksteen <[email protected]>Off topic, but I have a question for modules maintainers...
Does the
authorsfield still serve this purpose today?Almost always it is just the initial submitter, while the code has been subject to many changes (many of them tree wide too), and the maintainers could have changed as well.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
We have copyright comments on top of files, and git for checking the file history. What's the point of keeping his inside module metadata?
MODULE_AUTHOR()was apparently added in 2.1.18 back in 1996 [1], with a comment that it is for documentation purposes.I am pretty sure the kernel changed a lot since then :)
It depends. Copyright lines, changelogs and the MAINTAINERS file were all present in 1996, yet MODULE_AUTHOR() was still added.
Quoted 22 lines
Quoted 5 lines
I don't have a full picture of how this modinfo field is currently used by module authors, maintainers and users. I think it can be useful as a record of all past and present primary authors of a specific module,
Well, if they're actually updated... But as pointed out that this was usually not the case.
Quoted 1 line
and it has also value for external modules.
The version field has value for external modules too, but that was recently removed. I don't think we should care about external modules too much.
Quoted 3 lines
Unlike copyright statements
and Git history, the information is directly visible to users through the modinfo utility.Hmm, why does the user want to know who is the primary author of a module? Users shouldn't try to contact the authors anyway, they should find the current maintainers...
Quoted 5 lines
Even if the field is perfectly up-to-date, a user running an older kernel should still not use this field as they need to contact the current mainline maintainer if they have issues.
I just find this info to be hardly useful at all.
It is fairly common for software to list its authors in an About dialog or in its documentation. This information is typically not used to determine where to report bugs. One could therefore make the same argument that such information is not useful. In my view, it simply gives people credit in a more visible way. I think the module author field serves a similar documentation purpose.
As mentioned, the author field is optional and individual module maintainers can decide whether it is useful for their modules. If it should be removed, I suggest removing the uses of MODULE_AUTHOR() first.
Signature · 2 lines
Regards, Petr
Quoted 20 lines · Miguel Ojeda
Quoted 19 lines · Thiébaud Weksteen
Module authors may have non-ASCII characters in their names. In C,
MODULE_AUTHORallows arbitrary string literals which are emitted as raw UTF-8 bytes into the.modinfosection, and multiple in-tree modules use non-ASCII author names.Originally, the single
authorfield permitted arbitrary string literals including non-ASCII characters. When support for multiple authors was introduced in commit38559da6afb2("rust: module: introduceauthorskey"), it reused theexpect_string_arrayhelper that had originally been added for module aliases. Because that helper enforced an ASCII check,authorsinadvertently became restricted to ASCII-only string literals. Later, when the macro parsing was rewritten to usesynin commitc578ad703ae9("rust: macros: usesynto parsemodule!macro"), this restriction was carried over by using AsciiLitStr inauthorstype.Change the element type of
authorsinModuleInfofromAsciiLitStrtoLitStrso that UTF-8 author names are permitted.
Quoted 8 lines
Quoted 2 lines
Fixes 38559da6afb2 ("rust: module: introduce `authors` key")Signed-off-by Thiébaud Weksteen <[email protected]>This looks good, thanks! We did discuss allowing non-ASCII long ago, so this wasn't intentional.
Petr & modules: I can pick this on up (an Acked-by would be nice!), unless you want to pick it.
Signature · 2 lines
Thanks, Petr
Miguel Ojeda
AppliedQuoted 16 lines · Thiébaud Weksteen
Module authors may have non-ASCII characters in their names. In C,
MODULE_AUTHORallows arbitrary string literals which are emitted as raw UTF-8 bytes into the.modinfosection, and multiple in-tree modules use non-ASCII author names.Originally, the single
authorfield permitted arbitrary string literals including non-ASCII characters. When support for multiple authors was introduced in commit38559da6afb2("rust: module: introduceauthorskey"), it reused theexpect_string_arrayhelper that had originally been added for module aliases. Because that helper enforced an ASCII check,authorsinadvertently became restricted to ASCII-only string literals. Later, when the macro parsing was rewritten to usesynin commitc578ad703ae9("rust: macros: usesynto parsemodule!macro"), this restriction was carried over by using AsciiLitStr inauthorstype.
Quoted 5 lines
Change the element type of
authorsinModuleInfofromAsciiLitStrtoLitStrso that UTF-8 author names are permitted.Fixes 38559da6afb2 ("rust: module: introduce `authors` key")Signed-off-by Thiébaud Weksteen <[email protected]>
Applied to rust-next -- thanks!
Cheers,
Miguel