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-next>] [day] [month] [year] [list]
Message-Id: <20180117151414.23686-1-willy@infradead.org>
Date:   Wed, 17 Jan 2018 07:14:11 -0800
From:   Matthew Wilcox <willy@...radead.org>
To:     Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>
Cc:     "David S. Miller" <davem@...emloft.net>,
        Matthew Wilcox <mawilcox@...rosoft.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        linux-kernel@...r.kernel.org
Subject: [PATCH 0/3] lockdep: Allow checking a read-only lock

From: Matthew Wilcox <mawilcox@...rosoft.com>

I am not for one moment suggesting that the concept of a read-only lock
makes sense.  You can't sensibly put one in ROM or in read-only mappings.
What does make sense is some APIs want to specify a const pointer to
indicate that they do not modify the object being pointed to.  One example
we have of this today is in the networking stack; tcp_md5_do_lookup takes
a const struct sock * argument and wants to ensure that the caller either
took the socket lock or the rcu lock.

At the moment, tcp_md5_do_lookup() is actually lying to its callers;
lockdep_sock_is_held() casts away the constness of the pointer because
lockdep actually does modify the lock when checking whether it's held
(under rare and unnecessary conditions).

Fix this situation by (patch 1) only assigning a lock key on registration,
not on check, (patch 2) marking the pointers in the lockdep check path
as const and (patch 3) converting a few of the callers to themselves
be const, removing the nasty hack in lockdep_sock_is_held().

Matthew Wilcox (3):
  lockdep: Assign lock keys on registration
  lockdep: Make lockdep checking constant
  lockdep: Convert some users to const

 include/linux/backing-dev.h |  2 +-
 include/linux/lockdep.h     |  4 +-
 include/linux/srcu.h        |  4 +-
 include/net/sock.h          |  4 +-
 kernel/locking/lockdep.c    | 89 ++++++++++++++++++++++++---------------------
 5 files changed, 53 insertions(+), 50 deletions(-)

-- 
2.15.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ