mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jules Mercier <jules@les-mercier.fr>
To: Peder Bergan <peder.bergan@gmail.com>
Cc: Miguel Ojeda <ojeda@kernel.org>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	Alice Ryhl <aliceryhl@google.com>,
	Carlos Llamas <cmllamas@google.com>
Subject: Re: [PATCH] rust: bindgen: Preserve sched_statistics alignment
Date: Fri, 20 Nov 2026 13:57:06 +0100	[thread overview]
Message-ID: <20261120125706.7526-1-jules@les-mercier.fr> (raw)
In-Reply-To: <20261119-fix-schedstats-bindgen-layout-v1-1-0599dd230ffd@gmail.com>

On Thu, Nov 19, 2026 at 08:33:07PM +0100, Peder Bergan wrote:
> With CONFIG_SCHEDSTATS disabled, struct sched_statistics is empty but
> still cache-line aligned. Bindgen emits the empty definition without
> that alignment. On affected builds this misplaces fields following
> stats in the generated task_struct. In the reported arm64 build, Rust
> Binder reads the wrong pointer via CurrentTask::mm() and rejects mmap()
> with -EINVAL.
>
> Make sched_statistics opaque so bindgen uses the C size and alignment.
> Rust has no callers that access the fields of this type.

Tested on a OnePlus 6T (sdm845, arm64), kernel based on next-20261102,
LLVM=1, bindgen 0.73.2, with CONFIG_SCHEDSTATS=n.

Without this patch, mmap() of the binder devices fails with -EINVAL as
described in the issue, and Waydroid cannot start. With it, binder
works and Waydroid boots.

Tested-by: Jules Mercier <jules@les-mercier.fr>

Thanks!

      parent reply	other threads:[~2026-11-20 12:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 19:33 Peder Bergan via B4 Relay
2026-11-20 12:31 ` Miguel Ojeda
2026-11-20 12:33   ` Miguel Ojeda
2026-11-20 15:38   ` peder.bergan
2026-11-20 16:34     ` Miguel Ojeda
2026-11-20 12:57 ` Jules Mercier [this message]

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=20261120125706.7526-1-jules@les-mercier.fr \
    --to=jules@les-mercier.fr \
    --cc=aliceryhl@google.com \
    --cc=cmllamas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ojeda@kernel.org \
    --cc=peder.bergan@gmail.com \
    --cc=rust-for-linux@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®