Message ID | 170082096447.398.12922994682541625976.tip-bot2@tip-bot2 |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp1056296vqx; Fri, 24 Nov 2023 02:16:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IGAer8P3x9bkRBUr2wVGNcOjLOeyJCSmkEfSVkaP+ejj4DReT7Z20DS+9DLDzilycEvm7iB X-Received: by 2002:a17:90b:1b4f:b0:27d:3073:88fc with SMTP id nv15-20020a17090b1b4f00b0027d307388fcmr2058127pjb.41.1700820994054; Fri, 24 Nov 2023 02:16:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700820994; cv=none; d=google.com; s=arc-20160816; b=uG+OwQsfra6zY3YjQs7WTBFzns1GYE9cdRg1NOAVyIstNqIV7szEhaL/5W/dJamXXx hAeFCpQldfEeLlNtgOtdCjytbzh754mBPWTacO8Idz+WXhdPOZKo6bL0wpYrQyeOXj0S ppxf/YZWp6yBIa8FSaehRlH8SQ3bwIFOh0aMR1PPlNOP8SsXMQx4p1Pe0/UsYUO9ME76 TO2naawKtpAy4GmLme6pTzF+N5nu9Xh/+V2ztWYKcZD1SXmhbpeQgMU4S+i1dot1swNW F0CfuT+TbgNNm7kkVDTq1KZJpnkDP0JSS649+omv/qh4CR81TvnP1ckk76eBcyuU/6G/ gppA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=u7aU0X/sqpgYUwPx+c8pZR8R1BH27ZWy+KyLcXN294M=; fh=Vo2q+OLEOabn+mTy7BNGeCnEtFHPqDncSLh0VGkQ1eg=; b=kUvRnroeb3f+eLPupunE1Shp5Gcv3cQnmDsjZ6LJUftIaldg3ka6HXgdXSLOlgAchB ZdfIRBTy6ASX5j/jFMGedlJW5gPDBuz9S3KC4jvwCsZOUEwZeCLh+RoIGpjt2PtwpNY9 EMYqWQbtodveLGiU4hXpF23tot82sXwC0RK6dgYEneGCWq+ls5zM55kV5t+jZ8fpZ93e ayEf6kVvG32GrbzvWu7grcV50pvE5CaozNf8aADoKmWQxrBFPeZ3jb8+N9Av4+SrE7Nw E1b/cMBBzi1GWwA+X3VubKg9k0ha0JoiqWEqYu1j7doIZPU0Qbp25sTpTiN3SzHxgo+t vZMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ODfqP21F; dkim=neutral (no key) header.i=@linutronix.de header.b=we9vcT+0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id ie4-20020a17090b400400b00285807d0f78si2005795pjb.86.2023.11.24.02.16.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 02:16:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ODfqP21F; dkim=neutral (no key) header.i=@linutronix.de header.b=we9vcT+0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id C635980A52B6; Fri, 24 Nov 2023 02:16:22 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345407AbjKXKQL (ORCPT <rfc822;ouuuleilei@gmail.com> + 99 others); Fri, 24 Nov 2023 05:16:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345564AbjKXKQA (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 24 Nov 2023 05:16:00 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0933810F2; Fri, 24 Nov 2023 02:16:07 -0800 (PST) Date: Fri, 24 Nov 2023 10:16:04 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1700820965; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=u7aU0X/sqpgYUwPx+c8pZR8R1BH27ZWy+KyLcXN294M=; b=ODfqP21FCJ75BJfo2CCuiEk2W4AsW1oux3GfYfEF7atGab1B99ONoW/YyTU4ZH+STegTzs k1TIpPO0ykX884zdwHFbHwBvyuJ2ZIqOBNlX8VzPuZGZkPgZC3Ssrt6pFG3LF5xt1PYH/x Ozg38cWP6Lle2Ncsv6oWFBf/MSiaz+tmbY+Rk/9Er/tSOUIWvun+s79DT81yqUxikkh780 RCndUSqcdXHcaiDvnVRQ6B+6JPaPjZ22rk6+RjJ2rd8BHScBoDpBZq/YzHfM/TAoTVEKZu XdbwikS9wUHdmP/jgMD+2AiRQl0eT9jB/eru/abYm7W6g/CuyytuUGy/mPqtXA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1700820965; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=u7aU0X/sqpgYUwPx+c8pZR8R1BH27ZWy+KyLcXN294M=; b=we9vcT+0pRShDzUC5kMESoq761AX60N3OQojJGXMqzMkM3HG0Po5IUa1nDiyYsdfnAmLWl U0OOd6MXfv4t4ACQ== From: "tip-bot2 for Peter Zijlstra" <tip-bot2@linutronix.de> Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: locking/urgent] lockdep: Fix block chain corruption Cc: Kent Overstreet <kent.overstreet@linux.dev>, "Peter Zijlstra (Intel)" <peterz@infradead.org>, x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231121114126.GH8262@noisy.programming.kicks-ass.net> References: <20231121114126.GH8262@noisy.programming.kicks-ass.net> MIME-Version: 1.0 Message-ID: <170082096447.398.12922994682541625976.tip-bot2@tip-bot2> Robot-ID: <tip-bot2@linutronix.de> Robot-Unsubscribe: Contact <mailto:tglx@linutronix.de> to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Fri, 24 Nov 2023 02:16:23 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783440074607374871 X-GMAIL-MSGID: 1783440074607374871 |
Series |
[tip:,locking/urgent] lockdep: Fix block chain corruption
|
|
Commit Message
tip-bot2 for Thomas Gleixner
Nov. 24, 2023, 10:16 a.m. UTC
The following commit has been merged into the locking/urgent branch of tip: Commit-ID: bca4104b00fec60be330cd32818dd5c70db3d469 Gitweb: https://git.kernel.org/tip/bca4104b00fec60be330cd32818dd5c70db3d469 Author: Peter Zijlstra <peterz@infradead.org> AuthorDate: Tue, 21 Nov 2023 12:41:26 +01:00 Committer: Peter Zijlstra <peterz@infradead.org> CommitterDate: Fri, 24 Nov 2023 11:04:54 +01:00 lockdep: Fix block chain corruption Kent reported an occasional KASAN splat in lockdep. Mark then noted: > I suspect the dodgy access is to chain_block_buckets[-1], which hits the last 4 > bytes of the redzone and gets (incorrectly/misleadingly) attributed to > nr_large_chain_blocks. That would mean @size == 0, at which point size_to_bucket() returns -1 and the above happens. alloc_chain_hlocks() has 'size - req', for the first with the precondition 'size >= rq', which allows the 0. This code is trying to split a block, del_chain_block() takes what we need, and add_chain_block() puts back the remainder, except in the above case the remainder is 0 sized and things go sideways. Fixes: 810507fe6fd5 ("locking/lockdep: Reuse freed chain_hlocks entries") Reported-by: Kent Overstreet <kent.overstreet@linux.dev> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Tested-by: Kent Overstreet <kent.overstreet@linux.dev> Link: https://lkml.kernel.org/r/20231121114126.GH8262@noisy.programming.kicks-ass.net --- kernel/locking/lockdep.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index e85b5ad..151bd3d 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -3497,7 +3497,8 @@ static int alloc_chain_hlocks(int req) size = chain_block_size(curr); if (likely(size >= req)) { del_chain_block(0, size, chain_block_next(curr)); - add_chain_block(curr + req, size - req); + if (size > req) + add_chain_block(curr + req, size - req); return curr; } }