From: "Arnd Bergmann" <arnd@arndb.de>
To: "Wenzhao Liao" <wenzhaoliao@ruc.edu.cn>,
rust-for-linux@vger.kernel.org, linux-pci@vger.kernel.org
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
"Danilo Krummrich" <dakr@kernel.org>,
bhelgaas@google.com,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org, linux-api@vger.kernel.org
Subject: Re: [RFC PATCH v3 1/6] uapi: add goldfish_address_space userspace ABI header
Date: Mon, 13 Apr 2026 18:28:36 +0200 [thread overview]
Message-ID: <68053fb8-3305-43e0-897e-6cc4e48e2362@app.fastmail.com> (raw)
In-Reply-To: <20260406165120.166928-2-wenzhaoliao@ruc.edu.cn>
On Mon, Apr 6, 2026, at 18:51, Wenzhao Liao wrote:
> +struct goldfish_address_space_allocate_block {
> + __u64 size;
> + __u64 offset;
> + __u64 phys_addr;
> +};
> +
> +struct goldfish_address_space_ping {
> + __u64 offset;
> + __u64 size;
> + __u64 metadata;
> + __u32 version;
> + __u32 wait_fd;
> + __u32 wait_flags;
> + __u32 direction;
> +};
> +
> +struct goldfish_address_space_claim_shared {
> + __u64 offset;
> + __u64 size;
> +};
All these ioctl structures are well-formed in the sense that they
are portable across architectures and won't leak kernel data
through implicit padding.
Two of the members are a bit worrying, but that may just
be my own understanding:
- the 'phys_addr' member sounds like it refers to a physical
memory location in the CPU address space, which in general
should not be visible to user space, as that tends to
expose security problems if users with access to the
device can use this to access data they should not.
- the 'version' field may refer to the version of the ioctl
command, which is similarly discouraged since it is
harder to deal with than just coming up with new ioctl
command codes. If this refers to the version of the
remote side, this is probably fine.
> +#define GOLDFISH_ADDRESS_SPACE_IOCTL_MAGIC 'G'
> +
> +#define GOLDFISH_ADDRESS_SPACE_IOCTL_OP(OP, T) \
> + _IOWR(GOLDFISH_ADDRESS_SPACE_IOCTL_MAGIC, OP, T)
I think it would be better to remove this intermediate macro, since
it prevents easy scraping of ioctl command codes from looking
at the source file with regular expressions.
It is also unusual that all commands are both reading
and writing the data. Please check if you can make some
of them read-only or write-only.
Arnd
next prev parent reply other threads:[~2026-04-13 16:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1775456181.git.wenzhaoliao@ruc.edu.cn>
2026-04-06 16:51 ` [RFC PATCH v3 0/6] Rust goldfish_address_space driver (ioctl-only subset) Wenzhao Liao
2026-04-06 16:51 ` [RFC PATCH v3 1/6] uapi: add goldfish_address_space userspace ABI header Wenzhao Liao
2026-04-13 16:28 ` Arnd Bergmann [this message]
2026-04-06 16:51 ` [RFC PATCH v3 2/6] rust: bindings: expose goldfish address-space headers Wenzhao Liao
2026-04-06 16:51 ` [RFC PATCH v3 3/6] rust: page: add helpers for page-backed ping state Wenzhao Liao
2026-04-06 16:51 ` [RFC PATCH v3 4/6] rust: pci: add shared BAR memremap support Wenzhao Liao
2026-04-06 16:51 ` [RFC PATCH v3 5/6] rust: miscdevice: harden registration and safe file_operations invariants Wenzhao Liao
2026-04-06 16:51 ` [RFC PATCH v3 6/6] platform/goldfish: add Rust goldfish_address_space driver Wenzhao Liao
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=68053fb8-3305-43e0-897e-6cc4e48e2362@app.fastmail.com \
--to=arnd@arndb.de \
--cc=bhelgaas@google.com \
--cc=dakr@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=kwilczynski@kernel.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=wenzhaoliao@ruc.edu.cn \
/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