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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bffea54f-d8b1-4043-8f5a-81ecac16be2e@de.bosch.com>
Date: Thu, 15 Aug 2024 12:02:48 +0200
From: Dirk Behme <dirk.behme@...bosch.com>
To: Andreas Hindborg <nmi@...aspace.dk>, Jens Axboe <axboe@...nel.dk>, "Miguel
 Ojeda" <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>, "Wedson
 Almeida Filho" <wedsonaf@...il.com>
CC: Andreas Hindborg <a.hindborg@...sung.com>, Boqun Feng
	<boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
	Björn Roy Baron <bjorn3_gh@...tonmail.com>, Benno Lossin
	<benno.lossin@...ton.me>, Alice Ryhl <aliceryhl@...gle.com>,
	"linux-block@...r.kernel.org" <linux-block@...r.kernel.org>,
	<rust-for-linux@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] rust: block: fix wrong usage of lockdep API

On 15.08.2024 09:49, Andreas Hindborg wrote:
> From: Andreas Hindborg <a.hindborg@...sung.com>
> 
> When allocating `struct gendisk`, `GenDiskBuilder` is using a dynamic lock
> class key without registering the key. This is incorrect use of the API,
> which causes a `WARN` trace. This patch fixes the issue by using a static
> lock class key, which is more appropriate for the situation anyway.
> 
> Fixes: 3253aba3408a ("rust: block: introduce `kernel::block::mq` module")
> Reported-by: "Behme Dirk (XC-CP/ESB5)" <Dirk.Behme@...bosch.com>
> Closes: https://rust-for-linux.zulipchat.com/#narrow/stream/288089-General/topic/6.2E11.2E0-rc1.3A.20rust.2Fkernel.2Fblock.2Fmq.2Ers.3A.20doctest.20lock.20warning
> Signed-off-by: Andreas Hindborg <a.hindborg@...sung.com>

Tested-by: Dirk Behme <dirk.behme@...bosch.com>

Many thanks! :)

Dirk

> ---
>   rust/kernel/block/mq/gen_disk.rs | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/rust/kernel/block/mq/gen_disk.rs b/rust/kernel/block/mq/gen_disk.rs
> index f548a6199847..dbe560b09953 100644
> --- a/rust/kernel/block/mq/gen_disk.rs
> +++ b/rust/kernel/block/mq/gen_disk.rs
> @@ -6,7 +6,7 @@
>   //! C header: [`include/linux/blk_mq.h`](srctree/include/linux/blk_mq.h)
>   
>   use crate::block::mq::{raw_writer::RawWriter, Operations, TagSet};
> -use crate::error;
> +use crate::{error, static_lock_class};
>   use crate::{bindings, error::from_err_ptr, error::Result, sync::Arc};
>   use core::fmt::{self, Write};
>   
> @@ -93,8 +93,6 @@ pub fn build<T: Operations>(
>           name: fmt::Arguments<'_>,
>           tagset: Arc<TagSet<T>>,
>       ) -> Result<GenDisk<T>> {
> -        let lock_class_key = crate::sync::LockClassKey::new();
> -
>           // SAFETY: `bindings::queue_limits` contain only fields that are valid when zeroed.
>           let mut lim: bindings::queue_limits = unsafe { core::mem::zeroed() };
>   
> @@ -110,7 +108,7 @@ pub fn build<T: Operations>(
>                   tagset.raw_tag_set(),
>                   &mut lim,
>                   core::ptr::null_mut(),
> -                lock_class_key.as_ptr(),
> +                static_lock_class!().as_ptr(),
>               )
>           })?;
>   

-- 
======================================================================
Dirk Behme                      Robert Bosch Car Multimedia GmbH
                                 CM/ESO2
Phone: +49 5121 49-3274         Dirk Behme
Fax:   +49 711 811 5053274      PO Box 77 77 77
mailto:dirk.behme@...bosch.com  D-31132 Hildesheim - Germany

Bosch Group, Car Multimedia (CM)
              Engineering SW Operating Systems 2 (ESO2)

Robert Bosch Car Multimedia GmbH - Ein Unternehmen der Bosch Gruppe
Sitz: Hildesheim
Registergericht: Amtsgericht Hildesheim HRB 201334
Aufsichtsratsvorsitzender: Dr. Dirk Hoheisel
Geschäftsführung: Dr. Steffen Berns;
                   Dr. Sven Ost, Jörg Pollak, Dr. Walter Schirm
======================================================================


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ