On Tue, May 27, 2025 at 12:09:36PM -0400, Tamir Duberstein wrote:
> Use a match expression with slice patterns instead of length checks and
> indexing. The result is more idiomatic, which is a better example for
> future Rust code authors.
>
> Signed-off-by: Tamir Duberstein
Rev
On Mon, May 05, 2025 at 11:55:33AM +0200, Andreas Hindborg wrote:
> "Alice Ryhl" writes:
>
> > On Fri, May 02, 2025 at 02:16:35PM +0200, Andreas Hindborg wrote:
> > It would be a use-after-free to
> > access it during module teardown. For example, what if I acc
On Fri, May 02, 2025 at 02:16:35PM +0200, Andreas Hindborg wrote:
> Add support for module parameters to the `module!` macro. Implement read
> only support for integer types without `sysfs` support.
>
> Acked-by: Petr Pavlu # from modules perspective
> Tested-by: Daniel Gomez
> Signed-off-by: An
eviewed-by: Daniel Almeida
> Tested-by: Daniel Almeida
> Reviewed-by: Fiona Behrens
> Signed-off-by: Andreas Hindborg
Reviewed-by: Alice Ryhl
On Tue, Feb 4, 2025 at 1:05 PM Andreas Hindborg wrote:
>
> Implement `strip_prefix` for `BStr` by deferring to `slice::strip_prefix`
> on the underlying `&[u8]`.
>
> Reviewed-by: Gary Guo
> Reviewed-by: Alice Ryhl
> Signed-off-by: Andreas Hindborg
> ---
>
&g
On Fri, Dec 27, 2024 at 2:52 AM Isaac J. Manjarres
wrote:
>
> Add tests to ensure that F_SEAL_FUTURE_EXEC behaves as expected.
>
> Signed-off-by: Isaac J. Manjarres
Reviewed-by: Alice Ryhl
On Thu, Jan 9, 2025 at 11:56 AM Andreas Hindborg wrote:
>
> Implement `strip_prefix` for `BStr` by deferring to `slice::strip_prefix`
> on the underlying `&[u8]`.
>
> Signed-off-by: Andreas Hindborg
Reviewed-by: Alice Ryhl
On Tue, Jan 7, 2025 at 6:21 AM Jeff Xu wrote:
> Do you know which code checks for VM_MAYEXEC flag in the mprotect code
> path ? it isn't obvious to me, i.e. when I grep the VM_MAYEXEC inside
> mm path, it only shows one place in mprotect and that doesn't do the
> work.
>
> ~/mm/mm$ grep VM_MAYEXE
On Thu, Dec 12, 2024 at 6:07 PM Boqun Feng wrote:
>
> On Thu, Dec 12, 2024 at 11:51:23AM +0100, Alice Ryhl wrote:
> > On Fri, Nov 1, 2024 at 7:03 AM Boqun Feng wrote:
> > >
> > > Preparation for generic atomic implementation. To unify the
> > > ipmlementa
On Thu, Dec 12, 2024 at 6:34 PM Boqun Feng wrote:
>
> On Thu, Dec 12, 2024 at 11:57:07AM +0100, Alice Ryhl wrote:
> [...]
> > > diff --git a/rust/kernel/sync/atomic/generic.rs
> > > b/rust/kernel/sync/atomic/generic.rs
> > > new file mode 100644
&g
On Fri, Nov 1, 2024 at 7:03 AM Boqun Feng wrote:
>
> To provide using LKMM atomics for Rust code, a generic `Atomic` is
> added, currently `T` needs to be Send + Copy because these are the
> straightforward usages and all basic types support this. The trait
> `AllowAtomic` should be only ipmlement
On Fri, Nov 1, 2024 at 7:03 AM Boqun Feng wrote:
>
> Preparation for generic atomic implementation. To unify the
> ipmlementation of a generic method over `i32` and `i64`, the C side
> atomic methods need to be grouped so that in a generic method, they can
> be referred as ::, otherwise their para
On Wed, Oct 30, 2024 at 5:59 AM David Gow wrote:
>
> On Tue, 29 Oct 2024 at 20:08, Alice Ryhl wrote:
> >
> > On Tue, Oct 29, 2024 at 10:24 AM David Gow wrote:
> > >
> > > From: José Expósito
> > >
> > > Add a couple of Rust const func
On Tue, Oct 29, 2024 at 10:24 AM David Gow wrote:
>
> From: José Expósito
>
> Add a couple of Rust const functions and macros to allow to develop
> KUnit tests without relying on generated C code:
>
> - The `kunit_unsafe_test_suite!` Rust macro is similar to the
>`kunit_test_suite` C macro.
On Fri, Sep 13, 2024 at 11:33 PM Gary Guo wrote:
>
> With `long` mapped to `isize`, `size_t`/`__kernel_size_t` mapped to
> usize and `char` mapped to `u8`, many of the existing casts are no
> longer necessary.
>
> Signed-off-by: Gary Guo
This is great!
Reviewed-by: Alice Ryhl
should get inlined. The
helper can be eliminated once we have the necessary inline asm to make
atomic operations from Rust.
Signed-off-by: Alice Ryhl
---
This is an alternate version of patch 1 that resolves the conflict with
https://lore.kernel.org/all/20240725183325.122827-7-oj...@kernel.org/
rust
ned-off-by: Alice Ryhl
---
rust/Makefile | 5 ++-
rust/kernel/.gitignore | 3 ++
rust/kernel/arch_static_branch_asm.rs.S | 7
rust/kernel/jump_label.rs | 64 -
rust/kernel/lib.rs
define a ARCH_STATIC_BRANCH_ASM that
takes the same arguments in a consistent order so that Rust can use the
same logic for every architecture.
Suggested-by: Peter Zijlstra (Intel)
Acked-by: Peter Zijlstra (Intel)
Co-developed-by: Miguel Ojeda
Signed-off-by: Miguel Ojeda
Signed-off-by: Alice
This updates the Rust printing sample to invoke a tracepoint. This
ensures that we have a user in-tree from the get-go even though the
patch is being merged before its real user.
Signed-off-by: Alice Ryhl
---
MAINTAINERS| 1 +
include/trace/events/rust_sample.h | 31
problem that they sometimes
are emitted without a user.
Reviewed-by: Carlos Llamas
Reviewed-by: Gary Guo
Signed-off-by: Alice Ryhl
---
include/linux/tracepoint.h | 22 +-
include/trace/define_trace.h| 12 ++
rust/bindings/bindings_helper.h | 1 +
rust/kernel/lib.rs
should get inlined. The
helper can be eliminated once we have the necessary inline asm to make
atomic operations from Rust.
Signed-off-by: Alice Ryhl
---
rust/bindings/bindings_helper.h | 1 +
rust/helpers.c | 9 +
rust/kernel/jump_label.rs | 29
l.org/rust-for-linux/20231101-rust-binder-v1-0-08ba9197f...@google.com/
[1]
Link: https://r.android.com/3119993 [2]
Link: https://lore.kernel.org/all/20240725183325.122827-7-oj...@kernel.org/ [3]
Link: https://lore.kernel.org/all/20240815103016.2771842-1-...@metaspace.dk/ [4]
Signed-off-by: Alice
ned-off-by: Alice Ryhl
---
rust/Makefile | 5 ++-
rust/kernel/.gitignore | 3 ++
rust/kernel/arch_static_branch_asm.rs.S | 7
rust/kernel/jump_label.rs | 64 -
rust/kernel/lib.rs
define a ARCH_STATIC_BRANCH_ASM that
takes the same arguments in a consistent order so that Rust can use the
same logic for every architecture.
Suggested-by: Peter Zijlstra (Intel)
Acked-by: Peter Zijlstra (Intel)
Co-developed-by: Miguel Ojeda
Signed-off-by: Miguel Ojeda
Signed-off-by: Alice
This updates the Rust printing sample to invoke a tracepoint. This
ensures that we have a user in-tree from the get-go even though the
patch is being merged before its real user.
Signed-off-by: Alice Ryhl
---
MAINTAINERS| 1 +
include/trace/events/rust_sample.h | 31
problem that they sometimes
are emitted without a user.
Reviewed-by: Carlos Llamas
Reviewed-by: Gary Guo
Signed-off-by: Alice Ryhl
---
include/linux/tracepoint.h | 22 +-
include/trace/define_trace.h| 12 ++
rust/bindings/bindings_helper.h | 1 +
rust/kernel/lib.rs
should get inlined. The
helper can be eliminated once we have the necessary inline asm to make
atomic operations from Rust.
Signed-off-by: Alice Ryhl
---
rust/bindings/bindings_helper.h | 1 +
rust/helpers.c | 9 +
rust/kernel/jump_label.rs | 29
ba9197f...@google.com/
[1]
Link: https://r.android.com/3119993 [2]
Signed-off-by: Alice Ryhl
---
Changes in v7:
- Fix spurious file included in first patch.
- Fix issue with riscv asm.
- Fix tags on fourth patch to match fifth patch.
- Add Reviewed-by/Acked-by tags where appropriate.
- Link to v6:
ht
On Thu, Aug 8, 2024 at 7:23 PM Alice Ryhl wrote:
>
> To avoid duplication of inline asm between C and Rust, we need to
> import the inline asm from the relevant `jump_label.h` header into Rust.
> To make that easier, this patch updates the header files to expose the
> inlin
On Sat, Aug 10, 2024 at 11:04 PM Peter Zijlstra wrote:
>
> On Thu, Aug 08, 2024 at 05:23:41PM +, Alice Ryhl wrote:
>
> > +/// Wrapper around `asm!` that uses at&t syntax on x86.
> > +// Uses a semicolon to avoid parsing ambiguities, even though this does
On Fri, Aug 9, 2024 at 8:16 PM Gary Guo wrote:
>
> On Thu, 08 Aug 2024 17:23:37 +0000
> Alice Ryhl wrote:
>
> > Add just enough support for static key so that we can use it from
> > tracepoints. Tracepoints rely on `static_key_false` even though it is
> >
argument
`key` to inline assembly as an 'i' parameter. Any attempt to add a C
helper for this function will fail to compile because the value of `key`
must be known at compile-time.
Suggested-by: Peter Zijlstra
Co-developed-by: Miguel Ojeda
Signed-off-by: Miguel Ojeda
Signed-off-by:
define a ARCH_STATIC_BRANCH_ASM that
takes the same arguments in a consistent order so that Rust can use the
same logic for every architecture.
Link: https://lore.kernel.org/r/20240725183325.122827-7-oj...@kernel.org [1]
Signed-off-by: Alice Ryhl
---
arch/arm/include/asm/jump_label.h | 14
This updates the Rust printing sample to invoke a tracepoint. This
ensures that we have a user in-tree from the get-go even though the
patch is being merged before its real user.
Signed-off-by: Alice Ryhl
---
MAINTAINERS| 1 +
include/trace/events/rust_sample.h | 31
problem that they sometimes
are emitted without a user.
Reviewed-by: Carlos Llamas
Signed-off-by: Alice Ryhl
---
include/linux/tracepoint.h | 22 +-
include/trace/define_trace.h| 12 ++
rust/bindings/bindings_helper.h | 1 +
rust/kernel/lib.rs | 1
should get inlined. The
helper can be eliminated once we have the necessary inline asm to make
atomic operations from Rust.
Signed-off-by: Alice Ryhl
---
rust/bindings/bindings_helper.h | 1 +
rust/helpers.c| 9 +
rust/kernel/arch_static_branch_asm.rs | 1
ba9197f...@google.com/
[1]
Link: https://r.android.com/3119993 [2]
Signed-off-by: Alice Ryhl
---
Changes in v6:
- Add support for !CONFIG_JUMP_LABEL.
- Add tracepoint to rust_print sample.
- Deduplicate inline asm.
- Require unsafe inside `declare_trace!`.
- Fix bug on x86 due to use of in
On Fri, Aug 2, 2024 at 11:40 AM Peter Zijlstra wrote:
>
> On Fri, Aug 02, 2024 at 09:31:27AM +, Alice Ryhl wrote:
> > Add just enough support for static key so that we can use it from
> > tracepoints. Tracepoints rely on `static_key_false` even though it is
> > deprec
problem that they sometimes
are emitted without a user.
Reviewed-by: Carlos Llamas
Signed-off-by: Alice Ryhl
---
include/linux/tracepoint.h | 22 +-
include/trace/define_trace.h| 12 ++
rust/bindings/bindings_helper.h | 1 +
rust/kernel/lib.rs | 1
d-by: WANG Rui
Link:
https://lore.kernel.org/rust-for-linux/20240801102804.gq33...@noisy.programming.kicks-ass.net/
[1]
Signed-off-by: Alice Ryhl
---
arch/arm64/include/asm/jump_label.h | 1 +
arch/loongarch/include/asm/jump_label.h | 1 +
arch/riscv/include/asm/jump_label.h | 1 +
ba9197f...@google.com/
[1]
Link: https://r.android.com/3119993 [2]
Signed-off-by: Alice Ryhl
---
Changes in v5:
- Update first patch regarding inline asm duplication.
- Add __rust_do_trace helper to support conditions.
- Rename DEFINE_RUST_DO_TRACE_REAL to __DEFINE_RUST_DO_TRACE.
- Get rid of
On Thu, Aug 1, 2024 at 12:28 PM Peter Zijlstra wrote:
>
> On Wed, Jul 31, 2024 at 11:34:13PM +0200, Alice Ryhl wrote:
>
> > > Please work harder to not have to duplicate stuff like this.
> >
> > I really didn't want to duplicate it, but it's very hard
On Wed, Jul 31, 2024 at 7:05 PM Peter Zijlstra wrote:
>
> On Fri, Jun 28, 2024 at 01:23:31PM +, Alice Ryhl wrote:
>
> > rust/kernel/arch/arm64/jump_label.rs | 34
> > rust/kernel/arch/loongarch/jump_label.rs | 35 +
On Wed, Jun 26, 2024 at 8:43 PM Steven Rostedt wrote:
>
> On Wed, 26 Jun 2024 10:48:23 +0200
> Alice Ryhl wrote:
>
> > >
> > > Because your hooks/rust_binder.h and events/rust_binder.h use the same
> > > TRACE_SYSTEM name? Could you try something like:
&
Make it possible to have Rust code call into tracepoints defined by C
code. It is still required that the tracepoint is declared in a C
header, and that this header is included in the input to bindgen.
Signed-off-by: Alice Ryhl
---
include/linux/tracepoint.h | 18 +++-
include
argument `key` to inline
assembly as an 'i' parameter, so any attempt to add a C helper for this
function will fail to compile because the value of `key` must be known
at compile-time.
Signed-off-by: Alice Ryhl
---
rust/kernel/arch/arm64/jump_label.rs | 34
r
remains in C code. See v1 for an implementation where
__DO_TRACE is also implemented in Rust.
Link:
https://lore.kernel.org/rust-for-linux/20231101-rust-binder-v1-0-08ba9197f...@google.com/
[1]
Link: https://r.android.com/3119993 [2]
Signed-off-by: Alice Ryhl
---
Changes in v4:
- Move arch-spe
On Tue, Jun 25, 2024 at 6:18 PM Boqun Feng wrote:
>
> Hi Alice,
>
> On Fri, Jun 21, 2024 at 10:35:26AM +, Alice Ryhl wrote:
> > Add just enough support for static key so that we can use it from
> > tracepoints. Tracepoints rely on `static_key_false` even though it is
&
On Tue, Jun 25, 2024 at 8:11 PM Boqun Feng wrote:
>
> On Fri, Jun 21, 2024 at 02:52:10PM +0200, Alice Ryhl wrote:
> [...]
> >
> > Hmm, I tried using the support where I have both events and hooks:
> >
> > #define CREATE_TRACE_POINTS
> > #define CREATE_RUST_
On Fri, Jun 21, 2024 at 12:35 PM Alice Ryhl wrote:
>
> Make it possible to have Rust code call into tracepoints defined by C
> code. It is still required that the tracepoint is declared in a C
> header, and that this header is included in the input to bindgen.
>
> Signed-
On Wed, Jun 12, 2024 at 5:03 PM Conor Dooley wrote:
>
> On Mon, Jun 10, 2024 at 02:01:04PM +, Alice Ryhl wrote:
> > Add just enough support for static key so that we can use it from
> > tracepoints. Tracepoints rely on `static_key_false` even though it is
> > deprec
Make it possible to have Rust code call into tracepoints defined by C
code. It is still required that the tracepoint is declared in a C
header, and that this header is included in the input to bindgen.
Signed-off-by: Alice Ryhl
---
include/linux/tracepoint.h | 18 +++-
include
argument `key` to inline
assembly as an 'i' parameter, so any attempt to add a C helper for this
function will fail to compile because the value of `key` must be known
at compile-time.
Signed-off-by: Alice Ryhl
---
rust/kernel/lib.rs| 1 +
rust/kernel/static_ke
remains in C code. See v1 for an implementation where
__DO_TRACE is also implemented in Rust.
Link:
https://lore.kernel.org/rust-for-linux/20231101-rust-binder-v1-0-08ba9197f...@google.com/
[1]
Link: https://r.android.com/3119993 [2]
Signed-off-by: Alice Ryhl
---
Changes in v3:
- Support for Rust stati
Make it possible to have Rust code call into tracepoints defined by C
code. It is still required that the tracepoint is declared in a C
header, and that this header is included in the input to bindgen.
Signed-off-by: Alice Ryhl
---
include/linux/tracepoint.h | 18 +++-
include
argument `key` to inline
assembly as an 'i' parameter, so any attempt to add a C helper for this
function will fail to compile because the value of `key` must be known
at compile-time.
Signed-off-by: Alice Ryhl
---
rust/kernel/lib.rs| 1 +
rust/kernel/static_k
remains in C code. See v1 for an implementation where
__DO_TRACE is also implemented in Rust.
Link:
https://lore.kernel.org/rust-for-linux/20231101-rust-binder-v1-0-08ba9197f...@google.com/
[1]
Link: https://r.android.com/3119993 [2]
Signed-off-by: Alice Ryhl
---
Changes in v2:
- Call into C code fo
Peter Zijlstra wrote:
> On Thu, Jun 06, 2024 at 09:09:00PM +0200, Miguel Ojeda wrote:
> > On Thu, Jun 6, 2024 at 7:19 PM Peter Zijlstra wrote:
> > >
> > > This is absolutely unreadable gibberish -- how am I supposed to keep
> > > this in sync with the rest of the static_call infrastructure?
> >
On Thu, Jun 6, 2024 at 5:37 PM Mathieu Desnoyers
wrote:
>
> On 2024-06-06 11:05, Alice Ryhl wrote:
> > Add just enough support for static key so that we can use it from
> > tracepoints. Tracepoints rely on `static_key_false` even though it is
> > deprecated, so we add t
On Thu, Jun 6, 2024 at 5:29 PM Mathieu Desnoyers
wrote:
>
> On 2024-06-06 11:05, Alice Ryhl wrote:
> > Make it possible to have Rust code call into tracepoints defined by C
> > code. It is still required that the tracepoint is declared in a C
> > header, and that this h
On Thu, Jun 6, 2024 at 5:25 PM Mathieu Desnoyers
wrote:
>
> On 2024-06-06 11:05, Alice Ryhl wrote:
> > This implementation implements support for static keys in Rust so that
> > the actual static branch will end up in the Rust object file. However,
> > it would also be p
Add just enough support for static key so that we can use it from
tracepoints. Tracepoints rely on `static_key_false` even though it is
deprecated, so we add the same functionality to Rust.
Signed-off-by: Alice Ryhl
---
rust/kernel/lib.rs| 1 +
rust/kernel/static_key.rs | 87
patchable at runtime.
Signed-off-by: Alice Ryhl
---
rust/kernel/lib.rs | 1 +
rust/kernel/static_call.rs | 92 ++
2 files changed, 93 insertions(+)
diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs
index fbd91a48ff8b..d534b1178955 100644
Make it possible to have Rust code call into tracepoints defined by C
code. It is still required that the tracepoint is declared in a C
header, and that this header is included in the input to bindgen.
Signed-off-by: Alice Ryhl
---
rust/bindings/bindings_helper.h | 1 +
rust/bindings/lib.rs
droid.com/3110088 [2]
Signed-off-by: Alice Ryhl
---
Alice Ryhl (3):
rust: add static_call support
rust: add static_key_false
rust: add tracepoint support
rust/bindings/bindings_helper.h | 1 +
rust/bindings/lib.rs| 15 +++
rust/helpers.c | 24
65 matches
Mail list logo