[Intel-xe] ✓ CI.checkpatch: success for locking/ww_mutex: Adjust to lockdep nest_lock requirements

Patchwork patchwork at emeril.freedesktop.org
Mon Sep 11 09:09:55 UTC 2023


== Series Details ==

Series: locking/ww_mutex: Adjust to lockdep nest_lock requirements
URL   : https://patchwork.freedesktop.org/series/123522/
State : success

== Summary ==

+ KERNEL=/kernel
+ git clone https://gitlab.freedesktop.org/drm/maintainer-tools mt
Cloning into 'mt'...
warning: redirecting to https://gitlab.freedesktop.org/drm/maintainer-tools.git/
+ git -C mt rev-list -n1 origin/master
63c2b6b160bca2df6efc7bc4cea6f442097d7854
+ cd /kernel
+ git config --global --add safe.directory /kernel
+ git log -n1
commit 5d1e864cd9593ed11be888d89c1d3117941ba998
Author: Thomas Hellström <thomas.hellstrom at linux.intel.com>
Date:   Mon Sep 11 10:40:42 2023 +0200

    locking/ww_mutex: Adjust to lockdep nest_lock requirements
    
    When using mutex_acquire_nest() with a nest_lock, lockdep refcounts the
    number of acquired lockdep_maps of mutexes of the same class, and also
    keeps a pointer to the first acquired lockdep_map of a class. That pointer
    is then used for various comparison-, printing- and checking purposes,
    but there is no mechanism to actively ensure that lockdep_map stays in
    memory. Instead, a warning is printed if the lockdep_map is freed and
    there are still held locks of the same lock class, even if the lockdep_map
    itself has been released.
    
    In the context of WW/WD transactions that means that if a user unlocks
    and frees a ww_mutex from within an ongoing ww transaction, and that
    mutex happens to be the first ww_mutex grabbed in the transaction,
    such a warning is printed and there might be a risk of a UAF.
    
    Note that this is only problem when lockdep is enabled and affects only
    dereferences of struct lockdep_map.
    
    Adjust to this by adding a fake lockdep_map to the acquired context and
    make sure it is the first acquired lockdep map of the associated
    ww_mutex class. Then hold it for the duration of the WW/WD transaction.
    
    Cc: Peter Zijlstra <peterz at infradead.org>
    Cc: Ingo Molnar <mingo at redhat.com>
    Cc: Will Deacon <will at kernel.org>
    Cc: Waiman Long <longman at redhat.com>
    Cc: Boqun Feng <boqun.feng at gmail.com>
    Cc: Daniel Vetter <daniel.vetter at intel.com>
    Cc: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
    Cc: Christian König <christian.koenig at amd.com>
    Cc: intel-xe at lists.freedesktop.org
    Cc: intel-gfx at lists.freedesktop.org
    Cc: dri-devel at lists.freedestkop.org
    Signed-off-by: Thomas Hellström <thomas.hellstrom at linux.intel.com>
+ /mt/dim checkpatch 0533b5d42b2f8ec916646c10715ac45215e87689 drm-intel
5d1e864cd locking/ww_mutex: Adjust to lockdep nest_lock requirements




More information about the Intel-xe mailing list