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: <20200604084958.GU20149@phenom.ffwll.local>
Date:   Thu, 4 Jun 2020 10:49:58 +0200
From:   Daniel Vetter <daniel@...ll.ch>
To:     "Ahmed S. Darwish" <a.darwish@...utronix.de>
Cc:     Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>, Will Deacon <will@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        "Paul E. McKenney" <paulmck@...nel.org>,
        "Sebastian A. Siewior" <bigeasy@...utronix.de>,
        Steven Rostedt <rostedt@...dmis.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Sumit Semwal <sumit.semwal@...aro.org>,
        David Airlie <airlied@...ux.ie>,
        Daniel Vetter <daniel@...ll.ch>, linux-media@...r.kernel.org,
        dri-devel@...ts.freedesktop.org
Subject: Re: [PATCH v2 6/6] dma-buf: Remove custom seqcount lockdep class key

On Wed, Jun 03, 2020 at 04:49:49PM +0200, Ahmed S. Darwish wrote:
> Commit 3c3b177a9369 ("reservation: add support for read-only access
> using rcu") introduced a sequence counter to manage updates to
> reservations. Back then, the reservation object initializer
> reservation_object_init() was always inlined.
> 
> Having the sequence counter initialization inlined meant that each of
> the call sites would have a different lockdep class key, which would've
> broken lockdep's deadlock detection. The aforementioned commit thus
> introduced, and exported, a custom seqcount lockdep class key and name.
> 
> The commit 8735f16803f00 ("dma-buf: cleanup reservation_object_init...")
> transformed the reservation object initializer to a normal non-inlined C
> function. seqcount_init(), which automatically defines the seqcount
> lockdep class key and must be called non-inlined, can now be safely used.
> 
> Remove the seqcount custom lockdep class key, name, and export. Use
> seqcount_init() inside the dma reservation object initializer.
> 
> Signed-off-by: Ahmed S. Darwish <a.darwish@...utronix.de>
> Reviewed-by: Sebastian Andrzej Siewior <bigeasy@...utronix.de>

Patch lgtm, and Ahmed says plan is that this should land through -tip
since it's part of a larger series, so

Acked-by: Daniel Vetter <daniel.vetter@...ll.ch>

for merging through whatever tree/branch fits bets. I don't expect
conflicts here, nothing in-flight touching this. I expect this will show
up in 5.9-rc1 or so.

Cheers, Daniel

> ---
>  drivers/dma-buf/dma-resv.c | 9 +--------
>  include/linux/dma-resv.h   | 2 --
>  2 files changed, 1 insertion(+), 10 deletions(-)
> 
> diff --git a/drivers/dma-buf/dma-resv.c b/drivers/dma-buf/dma-resv.c
> index 4264e64788c4..590ce7ad60a0 100644
> --- a/drivers/dma-buf/dma-resv.c
> +++ b/drivers/dma-buf/dma-resv.c
> @@ -50,12 +50,6 @@
>  DEFINE_WD_CLASS(reservation_ww_class);
>  EXPORT_SYMBOL(reservation_ww_class);
>  
> -struct lock_class_key reservation_seqcount_class;
> -EXPORT_SYMBOL(reservation_seqcount_class);
> -
> -const char reservation_seqcount_string[] = "reservation_seqcount";
> -EXPORT_SYMBOL(reservation_seqcount_string);
> -
>  /**
>   * dma_resv_list_alloc - allocate fence list
>   * @shared_max: number of fences we need space for
> @@ -134,9 +128,8 @@ subsys_initcall(dma_resv_lockdep);
>  void dma_resv_init(struct dma_resv *obj)
>  {
>  	ww_mutex_init(&obj->lock, &reservation_ww_class);
> +	seqcount_init(&obj->seq);
>  
> -	__seqcount_init(&obj->seq, reservation_seqcount_string,
> -			&reservation_seqcount_class);
>  	RCU_INIT_POINTER(obj->fence, NULL);
>  	RCU_INIT_POINTER(obj->fence_excl, NULL);
>  }
> diff --git a/include/linux/dma-resv.h b/include/linux/dma-resv.h
> index ee50d10f052b..a6538ae7d93f 100644
> --- a/include/linux/dma-resv.h
> +++ b/include/linux/dma-resv.h
> @@ -46,8 +46,6 @@
>  #include <linux/rcupdate.h>
>  
>  extern struct ww_class reservation_ww_class;
> -extern struct lock_class_key reservation_seqcount_class;
> -extern const char reservation_seqcount_string[];
>  
>  /**
>   * struct dma_resv_list - a list of shared fences
> -- 
> 2.20.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ