From: David Rheinsberg <david@readahead.eu>
To: rust-for-linux@vger.kernel.org
Cc: teg@jklm.no, Miguel Ojeda <ojeda@kernel.org>,
David Rheinsberg <david@readahead.eu>
Subject: [RFC 05/16] bus1: add module scaffolding
Date: Tue, 31 Mar 2026 21:02:57 +0200 [thread overview]
Message-ID: <20260331190308.141622-6-david@readahead.eu> (raw)
In-Reply-To: <20260331190308.141622-1-david@readahead.eu>
Add ./ipc/bus1/ as the new home of the bus1 module. `uapi/linux/bus1.h`
will provide the user-space API, but is left blank for now.
The module setup and the user-space API are written in C with the intent
to expose a C API to the other parts of the kernel to use in the future,
if desired.
The internals of the bus1 module are written in Rust. The exposed C API
is defined in `lib.h` and only used inside of the bus1 module for now.
`bindgen` is used to generate Rust symbols for `lib.h` (and
`uapi/linux/bus1.h`) so we can avoid duplicating symbols of the C API in
the Rust code. This way, we can rely on the C header and the C API of
the Rust code to match.
Signed-off-by: David Rheinsberg <david@readahead.eu>
---
include/uapi/linux/bus1.h | 5 +++++
init/Kconfig | 12 ++++++++++++
ipc/Makefile | 2 +-
ipc/bus1/Makefile | 28 ++++++++++++++++++++++++++++
ipc/bus1/lib.h | 18 ++++++++++++++++++
ipc/bus1/lib.rs | 18 ++++++++++++++++++
ipc/bus1/main.c | 19 +++++++++++++++++++
7 files changed, 101 insertions(+), 1 deletion(-)
create mode 100644 include/uapi/linux/bus1.h
create mode 100644 ipc/bus1/Makefile
create mode 100644 ipc/bus1/lib.h
create mode 100644 ipc/bus1/lib.rs
create mode 100644 ipc/bus1/main.c
diff --git a/include/uapi/linux/bus1.h b/include/uapi/linux/bus1.h
new file mode 100644
index 000000000000..4297e7a00ab9
--- /dev/null
+++ b/include/uapi/linux/bus1.h
@@ -0,0 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _UAPI_LINUX_BUS1_H
+#define _UAPI_LINUX_BUS1_H
+
+#endif /* _UAPI_LINUX_BUS1_H */
diff --git a/init/Kconfig b/init/Kconfig
index 444ce811ea67..20e8a577d9a7 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -502,6 +502,18 @@ config POSIX_MQUEUE_SYSCTL
depends on SYSCTL
default y
+config BUS1
+ tristate "Bus1 Capability-based IPC"
+ depends on RUST
+ help
+ The Bus1 linux subsystem provides capability-based inter-process
+ communication. It allows services and operating system tasks to
+ exchange messages, send notifications, and transfer data and
+ resources, using an object-capability system for implicit access
+ control. It is highly scalable, yet guarantees causal ordering across
+ all its operations, including the builtin object lifetime
+ notifications.
+
config WATCH_QUEUE
bool "General notification queue"
default n
diff --git a/ipc/Makefile b/ipc/Makefile
index c2558c430f51..6fa8c3b1c47c 100644
--- a/ipc/Makefile
+++ b/ipc/Makefile
@@ -9,4 +9,4 @@ obj-$(CONFIG_SYSVIPC_SYSCTL) += ipc_sysctl.o
obj-$(CONFIG_POSIX_MQUEUE) += mqueue.o msgutil.o
obj-$(CONFIG_IPC_NS) += namespace.o
obj-$(CONFIG_POSIX_MQUEUE_SYSCTL) += mq_sysctl.o
-
+obj-$(CONFIG_BUS1) += bus1/
diff --git a/ipc/bus1/Makefile b/ipc/bus1/Makefile
new file mode 100644
index 000000000000..1f2fbbe8603f
--- /dev/null
+++ b/ipc/bus1/Makefile
@@ -0,0 +1,28 @@
+# SPDX-License-Identifier: GPL-2.0
+
+quiet_cmd_bindgen = BINDGEN $@
+ cmd_bindgen = \
+ $(BINDGEN) $< -o $@ \
+ $(addprefix --allowlist-file=,$^) \
+ --ctypes-prefix kernel::ffi \
+ --no-debug '.*' \
+ --no-layout-tests \
+ --rust-target 1.68 \
+ --use-core \
+ -- \
+ $(c_flags) \
+ -D__BINDGEN__ \
+ -DMODULE \
+ -fno-builtin
+
+$(obj)/capi.rs: $(src)/lib.h $(srctree)/include/uapi/linux/bus1.h
+ $(call cmd,bindgen)
+
+$(obj)/lib.o: $(obj)/capi.rs
+$(obj)/lib.o: export BUS1_CAPI_PATH=$(abspath $(obj)/capi.rs)
+
+bus1-y := \
+ lib.o \
+ main.o
+
+obj-$(CONFIG_BUS1) += bus1.o
diff --git a/ipc/bus1/lib.h b/ipc/bus1/lib.h
new file mode 100644
index 000000000000..e84c47f97031
--- /dev/null
+++ b/ipc/bus1/lib.h
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0
+#ifndef __B1_LIB_H
+#define __B1_LIB_H
+
+/**
+ * DOC: C API of the Bus1 Rust Module
+ *
+ * This header exposes the C API of the Bus1 rust module. It provides the
+ * necessary hooks for the C module code to call into the rust code.
+ */
+
+#include <linux/cleanup.h>
+#include <linux/err.h>
+#include <linux/errno.h>
+#include <linux/types.h>
+#include <uapi/linux/bus1.h>
+
+#endif /* __B1_LIB_H */
diff --git a/ipc/bus1/lib.rs b/ipc/bus1/lib.rs
new file mode 100644
index 000000000000..7c3364651638
--- /dev/null
+++ b/ipc/bus1/lib.rs
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0
+//! # Kernel Bus1 Crate
+//!
+//! This is the in-kernel implementation of the Bus1 communication system in
+//! rust. Any user-space API is outside the scope of this module.
+
+#[allow(
+ dead_code,
+ missing_docs,
+ non_camel_case_types,
+ non_snake_case,
+ non_upper_case_globals,
+)]
+pub mod capi {
+ include!(env!("BUS1_CAPI_PATH"));
+}
+
+const __LOG_PREFIX: &[u8] = b"bus1\0";
diff --git a/ipc/bus1/main.c b/ipc/bus1/main.c
new file mode 100644
index 000000000000..bd6399b2ce3a
--- /dev/null
+++ b/ipc/bus1/main.c
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#include <linux/init.h>
+#include <linux/module.h>
+#include "lib.h"
+
+static int __init b1_main_init(void)
+{
+ return 0;
+}
+
+static void __exit b1_main_deinit(void)
+{
+}
+
+module_init(b1_main_init);
+module_exit(b1_main_deinit);
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("Capability-based IPC");
--
2.53.0
next prev parent reply other threads:[~2026-03-31 19:05 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-31 19:02 [RFC 00/16] bus1: Capability-based IPC for Linux David Rheinsberg
2026-03-31 19:02 ` [RFC 01/16] rust/sync: add LockedBy::access_mut_unchecked() David Rheinsberg
2026-03-31 19:29 ` Miguel Ojeda
2026-03-31 19:02 ` [RFC 02/16] rust/sync: add Arc::drop_unless_unique() David Rheinsberg
2026-03-31 19:02 ` [RFC 03/16] rust/alloc: add Vec::into_boxed_slice() David Rheinsberg
2026-03-31 19:28 ` Miguel Ojeda
2026-03-31 21:10 ` Gary Guo
2026-03-31 22:07 ` Danilo Krummrich
2026-04-01 9:28 ` David Rheinsberg
2026-03-31 19:02 ` [RFC 04/16] rust/error: add EXFULL, EBADRQC, EDQUOT, ENOTRECOVERABLE David Rheinsberg
2026-03-31 19:02 ` David Rheinsberg [this message]
2026-03-31 19:02 ` [RFC 06/16] bus1: add the user-space API David Rheinsberg
2026-03-31 19:02 ` [RFC 07/16] bus1: add man-page David Rheinsberg
2026-04-01 16:30 ` Jonathan Corbet
2026-04-01 18:01 ` David Rheinsberg
2026-04-01 18:06 ` David Rheinsberg
2026-04-04 15:30 ` Thomas Meyer
2026-03-31 19:03 ` [RFC 08/16] bus1/util: add basic utilities David Rheinsberg
2026-03-31 19:35 ` Miguel Ojeda
2026-04-01 11:05 ` David Rheinsberg
2026-04-01 11:25 ` Miguel Ojeda
2026-03-31 19:03 ` [RFC 09/16] bus1/util: add field projections David Rheinsberg
2026-03-31 19:38 ` Miguel Ojeda
2026-03-31 19:03 ` [RFC 10/16] bus1/util: add IntoDeref/FromDeref David Rheinsberg
2026-03-31 19:44 ` Miguel Ojeda
2026-03-31 19:03 ` [RFC 11/16] bus1/util: add intrusive data-type helpers David Rheinsberg
2026-03-31 19:03 ` [RFC 12/16] bus1/util: add intrusive single linked lists David Rheinsberg
2026-03-31 19:03 ` [RFC 13/16] bus1/util: add intrusive rb-tree David Rheinsberg
2026-03-31 19:43 ` Miguel Ojeda
2026-03-31 19:03 ` [RFC 14/16] bus1/acct: add resouce accounting David Rheinsberg
2026-03-31 19:03 ` [RFC 15/16] bus1: introduce peers, handles, and nodes David Rheinsberg
2026-03-31 19:03 ` [RFC 16/16] bus1: implement the uapi David Rheinsberg
2026-03-31 19:46 ` [RFC 00/16] bus1: Capability-based IPC for Linux 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=20260331190308.141622-6-david@readahead.eu \
--to=david@readahead.eu \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=teg@jklm.no \
/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