<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/rust/kernel/print.rs, branch v6.6.131</title>
<subtitle>Clone of https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git</subtitle>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/'/>
<entry>
<title>rust: print: use explicit link in documentation</title>
<updated>2024-02-16T18:10:43+00:00</updated>
<author>
<name>Miguel Ojeda</name>
<email>ojeda@kernel.org</email>
</author>
<published>2023-10-05T21:05:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=aacae44644fb1f9d1ad76394df47aa1e40e294a7'/>
<id>aacae44644fb1f9d1ad76394df47aa1e40e294a7</id>
<content type='text'>
commit a53d8cdd5a0aec75ae32badc2d8995c59ea6e3f0 upstream.

The future `rustdoc` in the Rust 1.73.0 upgrade requires an explicit
link for `pr_info!`:

    error: unresolved link to `pr_info`
       --&gt; rust/kernel/print.rs:395:63
        |
    395 | /// Use only when continuing a previous `pr_*!` macro (e.g. [`pr_info!`]).
        |                                                               ^^^^^^^^ no item named `pr_info` in scope
        |
        = note: `macro_rules` named `pr_info` exists in this crate, but it is not in scope at this link's location
        = note: `-D rustdoc::broken-intra-doc-links` implied by `-D warnings`

Thus do so to avoid a broken link while upgrading.

Reviewed-by: Alice Ryhl &lt;aliceryhl@google.com&gt;
Reviewed-by: Vincenzo Palazzo &lt;vincenzopalazzodev@gmail.com&gt;
Reviewed-by: Finn Behrens &lt;me@kloenk.dev&gt;
Reviewed-by: Martin Rodriguez Reboredo &lt;yakoyoku@gmail.com&gt;
Link: https://lore.kernel.org/r/20231005210556.466856-3-ojeda@kernel.org
Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit a53d8cdd5a0aec75ae32badc2d8995c59ea6e3f0 upstream.

The future `rustdoc` in the Rust 1.73.0 upgrade requires an explicit
link for `pr_info!`:

    error: unresolved link to `pr_info`
       --&gt; rust/kernel/print.rs:395:63
        |
    395 | /// Use only when continuing a previous `pr_*!` macro (e.g. [`pr_info!`]).
        |                                                               ^^^^^^^^ no item named `pr_info` in scope
        |
        = note: `macro_rules` named `pr_info` exists in this crate, but it is not in scope at this link's location
        = note: `-D rustdoc::broken-intra-doc-links` implied by `-D warnings`

Thus do so to avoid a broken link while upgrading.

Reviewed-by: Alice Ryhl &lt;aliceryhl@google.com&gt;
Reviewed-by: Vincenzo Palazzo &lt;vincenzopalazzodev@gmail.com&gt;
Reviewed-by: Finn Behrens &lt;me@kloenk.dev&gt;
Reviewed-by: Martin Rodriguez Reboredo &lt;yakoyoku@gmail.com&gt;
Link: https://lore.kernel.org/r/20231005210556.466856-3-ojeda@kernel.org
Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rust: kernel: Mark rust_fmt_argument as extern "C"</title>
<updated>2023-04-06T21:11:04+00:00</updated>
<author>
<name>David Gow</name>
<email>davidgow@google.com</email>
</author>
<published>2023-02-14T22:47:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=c682e4c37d2b8ba3bde1125cbbea4ee88824b4e2'/>
<id>c682e4c37d2b8ba3bde1125cbbea4ee88824b4e2</id>
<content type='text'>
The rust_fmt_argument function is called from printk() to handle the %pA
format specifier.

Since it's called from C, we should mark it extern "C" to make sure it's
ABI compatible.

Cc: stable@vger.kernel.org
Fixes: 247b365dc8dc ("rust: add `kernel` crate")
Signed-off-by: David Gow &lt;davidgow@google.com&gt;
Reviewed-by: Gary Guo &lt;gary@garyguo.net&gt;
Reviewed-by: Björn Roy Baron &lt;bjorn3_gh@protonmail.com&gt;
Reviewed-by: Vincenzo Palazzo &lt;vincenzopalazzodev@gmail.com&gt;
[Applied `rustfmt`]
Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The rust_fmt_argument function is called from printk() to handle the %pA
format specifier.

Since it's called from C, we should mark it extern "C" to make sure it's
ABI compatible.

Cc: stable@vger.kernel.org
Fixes: 247b365dc8dc ("rust: add `kernel` crate")
Signed-off-by: David Gow &lt;davidgow@google.com&gt;
Reviewed-by: Gary Guo &lt;gary@garyguo.net&gt;
Reviewed-by: Björn Roy Baron &lt;bjorn3_gh@protonmail.com&gt;
Reviewed-by: Vincenzo Palazzo &lt;vincenzopalazzodev@gmail.com&gt;
[Applied `rustfmt`]
Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rust: print: avoid evaluating arguments in `pr_*` macros in `unsafe` blocks</title>
<updated>2023-01-15T23:54:35+00:00</updated>
<author>
<name>Miguel Ojeda</name>
<email>ojeda@kernel.org</email>
</author>
<published>2022-12-13T18:03:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=6618d69aa129a8fc613e64775d5019524c6f231b'/>
<id>6618d69aa129a8fc613e64775d5019524c6f231b</id>
<content type='text'>
At the moment it is possible to perform unsafe operations in
the arguments of `pr_*` macros since they are evaluated inside
an `unsafe` block:

    let x = &amp;10u32 as *const u32;
    pr_info!("{}", *x);

In other words, this is a soundness issue.

Fix it so that it requires an explicit `unsafe` block.

Reported-by: Wedson Almeida Filho &lt;wedsonaf@gmail.com&gt;
Reported-by: Domen Puncer Kugler &lt;domen.puncerkugler@nccgroup.com&gt;
Link: https://github.com/Rust-for-Linux/linux/issues/479
Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
Reviewed-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Reviewed-by: Gary Guo &lt;gary@garyguo.net&gt;
Reviewed-by: Björn Roy Baron &lt;bjorn3_gh@protonmail.com&gt;
Reviewed-by: Vincenzo Palazzo &lt;vincenzopalazzodev@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
At the moment it is possible to perform unsafe operations in
the arguments of `pr_*` macros since they are evaluated inside
an `unsafe` block:

    let x = &amp;10u32 as *const u32;
    pr_info!("{}", *x);

In other words, this is a soundness issue.

Fix it so that it requires an explicit `unsafe` block.

Reported-by: Wedson Almeida Filho &lt;wedsonaf@gmail.com&gt;
Reported-by: Domen Puncer Kugler &lt;domen.puncerkugler@nccgroup.com&gt;
Link: https://github.com/Rust-for-Linux/linux/issues/479
Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
Reviewed-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Reviewed-by: Gary Guo &lt;gary@garyguo.net&gt;
Reviewed-by: Björn Roy Baron &lt;bjorn3_gh@protonmail.com&gt;
Reviewed-by: Vincenzo Palazzo &lt;vincenzopalazzodev@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rust: print: add `pr_cont!` macro</title>
<updated>2022-12-01T19:12:44+00:00</updated>
<author>
<name>Miguel Ojeda</name>
<email>ojeda@kernel.org</email>
</author>
<published>2022-11-10T16:41:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=fc6c7cac83f05f455be1f35160a618e9df103838'/>
<id>fc6c7cac83f05f455be1f35160a618e9df103838</id>
<content type='text'>
This level is a bit different from the rest since it does not
pass the module name to the `_printk()` call.

Thus add a new parameter to the general `print_macro!` to
handle it differently.

Co-developed-by: Adam Bratschi-Kaye &lt;ark.email@gmail.com&gt;
Signed-off-by: Adam Bratschi-Kaye &lt;ark.email@gmail.com&gt;
Co-developed-by: Wedson Almeida Filho &lt;wedsonaf@gmail.com&gt;
Signed-off-by: Wedson Almeida Filho &lt;wedsonaf@gmail.com&gt;
Co-developed-by: Gary Guo &lt;gary@garyguo.net&gt;
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
Reviewed-by: Wei Liu &lt;wei.liu@kernel.org&gt;
Reviewed-by: Sergio González Collado &lt;sergio.collado@gmail.com&gt;
Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This level is a bit different from the rest since it does not
pass the module name to the `_printk()` call.

Thus add a new parameter to the general `print_macro!` to
handle it differently.

Co-developed-by: Adam Bratschi-Kaye &lt;ark.email@gmail.com&gt;
Signed-off-by: Adam Bratschi-Kaye &lt;ark.email@gmail.com&gt;
Co-developed-by: Wedson Almeida Filho &lt;wedsonaf@gmail.com&gt;
Signed-off-by: Wedson Almeida Filho &lt;wedsonaf@gmail.com&gt;
Co-developed-by: Gary Guo &lt;gary@garyguo.net&gt;
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
Reviewed-by: Wei Liu &lt;wei.liu@kernel.org&gt;
Reviewed-by: Sergio González Collado &lt;sergio.collado@gmail.com&gt;
Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rust: print: add more `pr_*!` levels</title>
<updated>2022-12-01T19:12:14+00:00</updated>
<author>
<name>Miguel Ojeda</name>
<email>ojeda@kernel.org</email>
</author>
<published>2022-11-10T16:41:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=4c7f949906ae2ceb31d71fb235975f1bfa1adb21'/>
<id>4c7f949906ae2ceb31d71fb235975f1bfa1adb21</id>
<content type='text'>
Currently, only `pr_info!` (for the minimal sample) and
`pr_emerg!` (for the panic handler) are there.

Add the other levels as new macros, i.e. `pr_alert!`, `pr_crit!`,
`pr_err!`, `pr_warn!`, `pr_notice!` and `pr_debug!`.

Co-developed-by: Adam Bratschi-Kaye &lt;ark.email@gmail.com&gt;
Signed-off-by: Adam Bratschi-Kaye &lt;ark.email@gmail.com&gt;
Co-developed-by: Wedson Almeida Filho &lt;wedsonaf@gmail.com&gt;
Signed-off-by: Wedson Almeida Filho &lt;wedsonaf@gmail.com&gt;
Co-developed-by: Gary Guo &lt;gary@garyguo.net&gt;
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
Reviewed-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Reviewed-by: Wei Liu &lt;wei.liu@kernel.org&gt;
Reviewed-by: Sergio Gonzalez Collado &lt;sergio.collado@gmail.com&gt;
Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently, only `pr_info!` (for the minimal sample) and
`pr_emerg!` (for the panic handler) are there.

Add the other levels as new macros, i.e. `pr_alert!`, `pr_crit!`,
`pr_err!`, `pr_warn!`, `pr_notice!` and `pr_debug!`.

Co-developed-by: Adam Bratschi-Kaye &lt;ark.email@gmail.com&gt;
Signed-off-by: Adam Bratschi-Kaye &lt;ark.email@gmail.com&gt;
Co-developed-by: Wedson Almeida Filho &lt;wedsonaf@gmail.com&gt;
Signed-off-by: Wedson Almeida Filho &lt;wedsonaf@gmail.com&gt;
Co-developed-by: Gary Guo &lt;gary@garyguo.net&gt;
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
Reviewed-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Reviewed-by: Wei Liu &lt;wei.liu@kernel.org&gt;
Reviewed-by: Sergio Gonzalez Collado &lt;sergio.collado@gmail.com&gt;
Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rust: add `kernel` crate</title>
<updated>2022-09-28T06:58:24+00:00</updated>
<author>
<name>Wedson Almeida Filho</name>
<email>wedsonaf@google.com</email>
</author>
<published>2022-02-11T19:25:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=247b365dc8dc442412c88fe02346cd2bddac7bd6'/>
<id>247b365dc8dc442412c88fe02346cd2bddac7bd6</id>
<content type='text'>
The `kernel` crate currently includes all the abstractions that wrap
kernel features written in C.

These abstractions call the C side of the kernel via the generated
bindings with the `bindgen` tool. Modules developed in Rust should
never call the bindings themselves.

In the future, as the abstractions grow in number, we may need
to split this crate into several, possibly following a similar
subdivision in subsystems as the kernel itself and/or moving
the code to the actual subsystems.

Reviewed-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Co-developed-by: Alex Gaynor &lt;alex.gaynor@gmail.com&gt;
Signed-off-by: Alex Gaynor &lt;alex.gaynor@gmail.com&gt;
Co-developed-by: Geoffrey Thomas &lt;geofft@ldpreload.com&gt;
Signed-off-by: Geoffrey Thomas &lt;geofft@ldpreload.com&gt;
Co-developed-by: Finn Behrens &lt;me@kloenk.de&gt;
Signed-off-by: Finn Behrens &lt;me@kloenk.de&gt;
Co-developed-by: Adam Bratschi-Kaye &lt;ark.email@gmail.com&gt;
Signed-off-by: Adam Bratschi-Kaye &lt;ark.email@gmail.com&gt;
Co-developed-by: Sven Van Asbroeck &lt;thesven73@gmail.com&gt;
Signed-off-by: Sven Van Asbroeck &lt;thesven73@gmail.com&gt;
Co-developed-by: Gary Guo &lt;gary@garyguo.net&gt;
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
Co-developed-by: Boris-Chengbiao Zhou &lt;bobo1239@web.de&gt;
Signed-off-by: Boris-Chengbiao Zhou &lt;bobo1239@web.de&gt;
Co-developed-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Signed-off-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Co-developed-by: Fox Chen &lt;foxhlchen@gmail.com&gt;
Signed-off-by: Fox Chen &lt;foxhlchen@gmail.com&gt;
Co-developed-by: Viktor Garske &lt;viktor@v-gar.de&gt;
Signed-off-by: Viktor Garske &lt;viktor@v-gar.de&gt;
Co-developed-by: Dariusz Sosnowski &lt;dsosnowski@dsosnowski.pl&gt;
Signed-off-by: Dariusz Sosnowski &lt;dsosnowski@dsosnowski.pl&gt;
Co-developed-by: Léo Lanteri Thauvin &lt;leseulartichaut@gmail.com&gt;
Signed-off-by: Léo Lanteri Thauvin &lt;leseulartichaut@gmail.com&gt;
Co-developed-by: Niklas Mohrin &lt;dev@niklasmohrin.de&gt;
Signed-off-by: Niklas Mohrin &lt;dev@niklasmohrin.de&gt;
Co-developed-by: Milan Landaverde &lt;milan@mdaverde.com&gt;
Signed-off-by: Milan Landaverde &lt;milan@mdaverde.com&gt;
Co-developed-by: Morgan Bartlett &lt;mjmouse9999@gmail.com&gt;
Signed-off-by: Morgan Bartlett &lt;mjmouse9999@gmail.com&gt;
Co-developed-by: Maciej Falkowski &lt;m.falkowski@samsung.com&gt;
Signed-off-by: Maciej Falkowski &lt;m.falkowski@samsung.com&gt;
Co-developed-by: Nándor István Krácser &lt;bonifaido@gmail.com&gt;
Signed-off-by: Nándor István Krácser &lt;bonifaido@gmail.com&gt;
Co-developed-by: David Gow &lt;davidgow@google.com&gt;
Signed-off-by: David Gow &lt;davidgow@google.com&gt;
Co-developed-by: John Baublitz &lt;john.m.baublitz@gmail.com&gt;
Signed-off-by: John Baublitz &lt;john.m.baublitz@gmail.com&gt;
Co-developed-by: Björn Roy Baron &lt;bjorn3_gh@protonmail.com&gt;
Signed-off-by: Björn Roy Baron &lt;bjorn3_gh@protonmail.com&gt;
Signed-off-by: Wedson Almeida Filho &lt;wedsonaf@google.com&gt;
Co-developed-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The `kernel` crate currently includes all the abstractions that wrap
kernel features written in C.

These abstractions call the C side of the kernel via the generated
bindings with the `bindgen` tool. Modules developed in Rust should
never call the bindings themselves.

In the future, as the abstractions grow in number, we may need
to split this crate into several, possibly following a similar
subdivision in subsystems as the kernel itself and/or moving
the code to the actual subsystems.

Reviewed-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Co-developed-by: Alex Gaynor &lt;alex.gaynor@gmail.com&gt;
Signed-off-by: Alex Gaynor &lt;alex.gaynor@gmail.com&gt;
Co-developed-by: Geoffrey Thomas &lt;geofft@ldpreload.com&gt;
Signed-off-by: Geoffrey Thomas &lt;geofft@ldpreload.com&gt;
Co-developed-by: Finn Behrens &lt;me@kloenk.de&gt;
Signed-off-by: Finn Behrens &lt;me@kloenk.de&gt;
Co-developed-by: Adam Bratschi-Kaye &lt;ark.email@gmail.com&gt;
Signed-off-by: Adam Bratschi-Kaye &lt;ark.email@gmail.com&gt;
Co-developed-by: Sven Van Asbroeck &lt;thesven73@gmail.com&gt;
Signed-off-by: Sven Van Asbroeck &lt;thesven73@gmail.com&gt;
Co-developed-by: Gary Guo &lt;gary@garyguo.net&gt;
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
Co-developed-by: Boris-Chengbiao Zhou &lt;bobo1239@web.de&gt;
Signed-off-by: Boris-Chengbiao Zhou &lt;bobo1239@web.de&gt;
Co-developed-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Signed-off-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Co-developed-by: Fox Chen &lt;foxhlchen@gmail.com&gt;
Signed-off-by: Fox Chen &lt;foxhlchen@gmail.com&gt;
Co-developed-by: Viktor Garske &lt;viktor@v-gar.de&gt;
Signed-off-by: Viktor Garske &lt;viktor@v-gar.de&gt;
Co-developed-by: Dariusz Sosnowski &lt;dsosnowski@dsosnowski.pl&gt;
Signed-off-by: Dariusz Sosnowski &lt;dsosnowski@dsosnowski.pl&gt;
Co-developed-by: Léo Lanteri Thauvin &lt;leseulartichaut@gmail.com&gt;
Signed-off-by: Léo Lanteri Thauvin &lt;leseulartichaut@gmail.com&gt;
Co-developed-by: Niklas Mohrin &lt;dev@niklasmohrin.de&gt;
Signed-off-by: Niklas Mohrin &lt;dev@niklasmohrin.de&gt;
Co-developed-by: Milan Landaverde &lt;milan@mdaverde.com&gt;
Signed-off-by: Milan Landaverde &lt;milan@mdaverde.com&gt;
Co-developed-by: Morgan Bartlett &lt;mjmouse9999@gmail.com&gt;
Signed-off-by: Morgan Bartlett &lt;mjmouse9999@gmail.com&gt;
Co-developed-by: Maciej Falkowski &lt;m.falkowski@samsung.com&gt;
Signed-off-by: Maciej Falkowski &lt;m.falkowski@samsung.com&gt;
Co-developed-by: Nándor István Krácser &lt;bonifaido@gmail.com&gt;
Signed-off-by: Nándor István Krácser &lt;bonifaido@gmail.com&gt;
Co-developed-by: David Gow &lt;davidgow@google.com&gt;
Signed-off-by: David Gow &lt;davidgow@google.com&gt;
Co-developed-by: John Baublitz &lt;john.m.baublitz@gmail.com&gt;
Signed-off-by: John Baublitz &lt;john.m.baublitz@gmail.com&gt;
Co-developed-by: Björn Roy Baron &lt;bjorn3_gh@protonmail.com&gt;
Signed-off-by: Björn Roy Baron &lt;bjorn3_gh@protonmail.com&gt;
Signed-off-by: Wedson Almeida Filho &lt;wedsonaf@google.com&gt;
Co-developed-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
