lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <699ec35a-5453-4900-b535-a9a9863bb9bf@leemhuis.info>
Date: Fri, 30 May 2025 09:46:35 +0200
From: Thorsten Leemhuis <linux@...mhuis.info>
To: Rudraksha Gupta <guptarud@...il.com>, linux-kernel@...r.kernel.org,
 Linux regressions mailing list <regressions@...ts.linux.dev>,
 rust-for-linux@...r.kernel.org, Miguel Ojeda <ojeda@...nel.org>,
 Linux Next Mailing List <linux-next@...r.kernel.org>,
 Tamir Duberstein <tamird@...il.com>
Subject: Re: REGRESSION: armv7 build mismatched types

CCing linux-next and Tamir Duberstein, who authored the culprit.

On 30.05.25 08:23, Rudraksha Gupta wrote:
> Logs: https://gitlab.postmarketos.org/LogicalErzor/pmaports/-/jobs/1368490
> 
> Archive: https://web.archive.org/web/20250530060232/https://
> gitlab.postmarketos.org/LogicalErzor/pmaports/-/jobs/1368490/raw

I ran into the same error on aarch64 and x86_64 when building -next for
Fedora today using the rawhide config:

https://download.copr.fedorainfracloud.org/results/@kernel-vanilla/next/fedora-rawhide-x86_64/09103515-next-next-all/builder-live.log.gz
https://download.copr.fedorainfracloud.org/results/@kernel-vanilla/next/fedora-rawhide-aarch64/09103515-next-next-all/builder-live.log.gz

Reverting b20fbbc08a363f ("rust: check type of `$ptr` in
`container_of!`") fixed things. That's the patch Rudraksha suspected to
be the root of the problem (see the quote below).

Ciao, Thorsten

> Snip:
> 
> ||
> 
> |EXPORTS rust/exports_core_generated.h|
> |
> ||
> RUSTC L rust/compiler_builtins.o
> ||
> RUSTC L rust/ffi.o
> ||
> RUSTC L rust/build_error.o
> ||
> RUSTC L rust/pin_init.o
> ||
> RUSTC L rust/bindings.o
> ||
> RUSTC L rust/uapi.o
> ||
> EXPORTS rust/exports_bindings_generated.h
> ||
> RUSTC L rust/kernel.o
> ||
> error[E0308]: mismatched types
> ||
> --> rust/kernel/lib.rs:234:45
> ||
> |
> ||
> 234 | $crate::assert_same_type(field_ptr, (&raw const (*container_ptr).
> $($fields)*).cast_mut());
> ||
> | ------------------------ ---------
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `*const
> drm_device`, found `*mut Opaque<drm_device>`
> ||
> | | |
> ||
> | | expected all arguments to be this `*const drm_device` type because
> they need to match the type of this parameter
> ||
> | arguments to this function are incorrect
> ||
> |
> ||
> ::: rust/kernel/drm/device.rs:140:18
> ||
> |
> ||
> 140 | unsafe { crate::container_of!(ptr, Self, dev) }.cast_mut()
> ||
> | ------------------------------------ in this macro invocation
> ||
> |
> ||
> = note: expected raw pointer `*const drm_device`
> ||
> found raw pointer `*mut Opaque<drm_device>`
> ||
> note: function defined here
> ||
> --> rust/kernel/lib.rs:241:8
> ||
> |
> ||
> 241 | pub fn assert_same_type<T>(_: T, _: T) {}
> ||
> | ^^^^^^^^^^^^^^^^ - ---- ---- this parameter needs to match the `*const
> drm_device` type of parameter #1
> ||
> | | |
> ||
> | | parameter #2 needs to match the `*const drm_device` type of this
> parameter
> ||
> | parameter #1 and parameter #2 both reference this parameter `T`
> ||
> = note: this error originates in the macro `crate::container_of` (in
> Nightly builds, run with -Z macro-backtrace for more info)
> ||
> error[E0308]: mismatched types
> ||
> --> rust/kernel/lib.rs:234:45
> ||
> |
> ||
> 234 | $crate::assert_same_type(field_ptr, (&raw const (*container_ptr).
> $($fields)*).cast_mut());
> ||
> | ------------------------ ---------
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `*mut
> drm_gem_object`, found `*mut Opaque<drm_gem_object>`
> ||
> | | |
> ||
> | | expected all arguments to be this `*mut drm_gem_object` type because
> they need to match the type of this parameter
> ||
> | arguments to this function are incorrect
> ||
> |
> ||
> ::: rust/kernel/drm/gem/mod.rs:130:20
> ||
> |
> ||
> 130 | unsafe { &*crate::container_of!(self_ptr, Object<T>, obj) }
> ||
> | ---------------------------------------------- in this macro invocation
> ||
> |
> ||
> = note: expected raw pointer `*mut drm_gem_object`
> ||
> found raw pointer `*mut Opaque<drm_gem_object>`
> ||
> note: function defined here
> ||
> --> rust/kernel/lib.rs:241:8
> ||
> |
> ||
> 241 | pub fn assert_same_type<T>(_: T, _: T) {}
> ||
> | ^^^^^^^^^^^^^^^^ - ---- ---- this parameter needs to match the `*mut
> drm_gem_object` type of parameter #1
> ||
> | | |
> ||
> | | parameter #2 needs to match the `*mut drm_gem_object` type of this
> parameter
> ||
> | parameter #1 and parameter #2 both reference this parameter `T`
> ||
> = note: this error originates in the macro `crate::container_of` (in
> Nightly builds, run with -Z macro-backtrace for more info)
> ||
> error[E0308]: mismatched types
> ||
> --> rust/kernel/lib.rs:234:45
> ||
> |
> ||
> 234 | $crate::assert_same_type(field_ptr, (&raw const (*container_ptr).
> $($fields)*).cast_mut());
> ||
> | ------------------------ ---------
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `*mut
> drm_gem_object`, found `*mut Opaque<drm_gem_object>`
> ||
> | | |
> ||
> | | expected all arguments to be this `*mut drm_gem_object` type because
> they need to match the type of this parameter
> ||
> | arguments to this function are incorrect
> ||
> |
> ||
> ::: rust/kernel/drm/gem/mod.rs:273:29
> ||
> |
> ||
> 273 | let this = unsafe { crate::container_of!(obj, Self, obj) };
> ||
> | ------------------------------------ in this macro invocation
> ||
> |
> ||
> = note: expected raw pointer `*mut drm_gem_object`
> ||
> found raw pointer `*mut Opaque<drm_gem_object>`
> ||
> note: function defined here
> ||
> --> rust/kernel/lib.rs:241:8
> ||
> |
> ||
> 241 | pub fn assert_same_type<T>(_: T, _: T) {}
> ||
> | ^^^^^^^^^^^^^^^^ - ---- ---- this parameter needs to match the `*mut
> drm_gem_object` type of parameter #1
> ||
> | | |
> ||
> | | parameter #2 needs to match the `*mut drm_gem_object` type of this
> parameter
> ||
> | parameter #1 and parameter #2 both reference this parameter `T`
> ||
> = note: this error originates in the macro `crate::container_of` (in
> Nightly builds, run with -Z macro-backtrace for more info)
> ||
> error: aborting due to 3 previous errors
> ||
> For more information about this error, try `rustc --explain E0308`.
> ||
> make[2]: *** [rust/Makefile:538: rust/kernel.o] Error 1
> ||
> make[1]: *** [/home/pmos/build/src/linux-next-next-20250530/
> Makefile:1285: prepare] Error 2
> ||make: *** [Makefile:248: __sub-make] Error 2|
> 
> 
> Bad: next-20250530
> 
> Good: next-20250528
> 
> 
> Likely introduced with: https://lore.kernel.org/all/
> CANiq72mFiCrzawVUVOU2giJtBVsRdAO3sGtDsZptPuFvmid3EQ@...l.gmail.com/
> 
> 
> Repo: https://gitlab.postmarketos.org/LogicalErzor/pmaports/-/tree/rust/
> device/testing/linux-next
> 
> How it's built (Alpine-like build system):
> 
> - https://archive.ph/vxEmk
> 
> Config fragments (in addition to qcom_defconfig):
> 
> - https://archive.ph/q4hfc
> 
> - https://archive.ph/RKgFf
> 
> 
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ