From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753098AbcFNUr4 (ORCPT ); Tue, 14 Jun 2016 16:47:56 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:52710 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753076AbcFNUry (ORCPT ); Tue, 14 Jun 2016 16:47:54 -0400 Date: Tue, 14 Jun 2016 21:47:53 +0100 From: Ben Hutchings To: Sasha Levin Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Peter Zijlstra , Ingo Molnar Message-ID: <20160614204752.GU7555@decadent.org.uk> References: <20160614204437.GS7555@decadent.org.uk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="XilfshMFnlxBucLf" Content-Disposition: inline In-Reply-To: <20160614204437.GS7555@decadent.org.uk> User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: ben@decadent.org.uk Subject: [PATCH 2/7] liblockdep: Reduce MAX_LOCK_DEPTH to avoid overflowing lock_chain::depth X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on shadbolt.decadent.org.uk) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --XilfshMFnlxBucLf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable liblockdep has been broken since commit 75dd602a5198 ("lockdep: Fix lock_chain::base size"), as that adds a check that MAX_LOCK_DEPTH is within the range of lock_chain::depth and in liblockdep it is much too large. That should have resulted in a compiler error, but didn't because: - the check uses ARRAY_SIZE(), which isn't yet defined in liblockdep so is assumed to be an (undeclared) function - putting a function call inside a BUILD_BUG_ON() expression quietly turns it into some nonsense involving a variable-length array It did produce a compiler warning, but I didn't notice because liblockdep already produces too many warnings if -Wall is enabled (which I'll fix shortly). Even before that commit, which reduced lock_chain::depth from 8 bits to 6, MAX_LOCK_DEPTH was too large. Cc: # for versions before 4.6, use a value of 255 Signed-off-by: Ben Hutchings --- tools/lib/lockdep/uinclude/linux/lockdep.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/lib/lockdep/uinclude/linux/lockdep.h b/tools/lib/lockdep= /uinclude/linux/lockdep.h index c808c7d02d21..d30214221920 100644 --- a/tools/lib/lockdep/uinclude/linux/lockdep.h +++ b/tools/lib/lockdep/uinclude/linux/lockdep.h @@ -8,7 +8,7 @@ #include #include =20 -#define MAX_LOCK_DEPTH 2000UL +#define MAX_LOCK_DEPTH 63UL =20 #define asmlinkage #define __visible --XilfshMFnlxBucLf Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIVAwUBV2BteOe/yOyVhhEJAQrq6BAAxh3oXQU/aZbnFZv9IA1xJOIrnGM06POS 5xGrpT1UyTobuFan2OHSed2n3wpJ7ZKUfOBUsl/QOMTFLcxGCJPinuokOP5ed70g TDZfTfIfLJJ6ExTQ4ZZrX91tm/e2jz0Mc1IgvwrblKalrFaNnYSJmrjGs4SGo/1E JtQdcFee8pAuRQIUc5Ed8fw2RX9zM6aAydw6BdH1bcI2x9IdwpQJ9KvF7eXoUZ6v 9x0OZONdTbVjCKbNtnUEs7FFpIlIasD05CMSBHyn+izAQQoCv9H1GdU3JmG/ATtg ehlUv7jRZJqodaCP6rKBNWAmrpr725SFml9o+ngujb9j1d/4XK5347nSXprxqr37 6r+1g8JKtF+pUCloaB89Yr+QRLSMH0/xHNRDOOkH+1NHm1CeTYNJWnPC7ws+/NbZ Y1u4QLwlBUPqOzAD3Wkqo62QyxVsdspP7yAQdRkCdu+YYj1xeJk+7VXuBWs7qBmT DxmqH5xbC2UppWG3qiAhq3jtto79fwy9wkuRoyRBWUTVyNf3PordVwoJsiQk4es+ XQ0AnLTifT7xUOctQ7wIEvnT0UhIyH3ELJqSlr7v20zxTxy3sN0Q/Y2eZgrkMqor Bqh88lQBvAGg0gDipj+3g2njmTLoWwqKRgibwxc1qWIxsYasYzUwzCzd1cRGZ8BA qlvfk/iZJZw= =cpV7 -----END PGP SIGNATURE----- --XilfshMFnlxBucLf--