Received: by 2002:ab2:68c1:0:b0:1fd:9a81:d0e4 with SMTP id e1csp592570lqp; Sun, 9 Jun 2024 09:56:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXoaqDb+b2rxypGWO/nNkfIoSd10IFFSKdDfe6LXxD/M901njgZWNIp/CFd/eD1dqA3/K4us592CC3b3f9fEwEfDZavZvx5CMzXXetmsA== X-Google-Smtp-Source: AGHT+IHArFjAgl6lGOpp+bsVpkaDTRHW7jXP77PqijVyx8zfdGUCqDlHQkXOX7Fe3vggqUPN8XYp X-Received: by 2002:a05:620a:ed5:b0:792:b9d5:d3b3 with SMTP id af79cd13be357-7953c5fa07cmr603236685a.20.1717952186749; Sun, 09 Jun 2024 09:56:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717952186; cv=pass; d=google.com; s=arc-20160816; b=uF5iiySOIGsr2A/BemP6creBbrf/nYyb4p9bKuejMQFjZo00lycBi8nus3xXpuClh6 matx0mz/zMPHpWF3gn1GT93SM6bisJ8XGxKcN5UwbKwTnHkP0bj/v1K0k9YqLEwj4b3P T5gslJS7ELIO7VyvYdKvFCP6/OmtEHBAgKa59hmKFz01Vul2R0u7d5F2r39gtjJPFwSx 3phKW+itkBqOkor4WM6NgQtjG30Iln9wcOaW9YvPauLmEfQxVWYYZ1wWJlsFIRnSZX5O 3EEKzge8gkGjj76tBc7ujwHS1ppMyA0w1+SIMTIi24LybUXBykEar1SEvG/nZG8bGHk4 l7Mg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:references:in-reply-to:subject:cc:to:dkim-signature :dkim-signature:from; bh=2BfnhShkMx76spM67lpVd99C3roozhsXHPVJTgEobwM=; fh=E3WGmHdHGeQOlLK2gY2OVbqwZHpwZtJxo0MQwuNP0JM=; b=A0twSswelzySoJA7RVZ/H4GPtcdW4UONVOV9PSGfgNFqpRMGkFdBQcjrFCEsSwyhl6 yac7/W2DDUT9uNLnapJPfYC/SZQHITIMMdHWMO/HbGejIgS3AtPwOL/tf+2gwC/UYqtk fM1e2X7yNhW6wnqAIaZu8z9yphRpvZ6QlYZ97UwxmpX0ncVcH/l6LQ799t6HZGcLYpS+ xqxDVgQ+s2z/cgnH27yZD8krSjJ2KGHBR3o3MBnyAPsUyU7yoE7W6PSkM6gG8JoAzinj KkdU6DXNhW79VIclTEPPsBIgfAU9BGwdpuVJYBgklPlQ/e0f+Iu5qJv1+y29pjojtiDF GmFQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=PXHRcjgd; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-207434-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207434-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-79589126461si122149385a.85.2024.06.09.09.56.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jun 2024 09:56:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-207434-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=PXHRcjgd; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-207434-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207434-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 70AEC1C2090A for ; Sun, 9 Jun 2024 16:56:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0B88447F60; Sun, 9 Jun 2024 16:56:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="PXHRcjgd"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="zCYX5cs1" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE1DB63C7 for ; Sun, 9 Jun 2024 16:56:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717952178; cv=none; b=XFgI0PtXkrHZrVsWWrFi93GvGj/J5hxHHJhQ0YmzhrrQmDtnl01VT1Z6aeY7ajtEXgkmy0Sdd0FpF2oWkY730DA2WKOe/xMstYu+Qz6uG6+fBJaIcGh/xfsDLisBjyfBAHB3O1mbyWgg+HcDup/oxFallWONgW3op+4hWF8WE0Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717952178; c=relaxed/simple; bh=QVRDcudzq+SxuxGLiSNE6jrKkkJUQNIjX703RDFrUM0=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=YC88AJXXKvtG+H/lQ/woZioCh6i69nANTmmZr+MKVmJQf257gyo3YsolMYzOMpeUK8Zleoe2PT9PoBy239/F2HEbAsjSHUt6TK+13HuzCmro1gm/xcuzK0Ug9cHbdOPCeRF/dgiat9Vw+3jMH1hAdzW1wPe6ba1nvykFoxWyA2M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=PXHRcjgd; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=zCYX5cs1; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1717952175; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=2BfnhShkMx76spM67lpVd99C3roozhsXHPVJTgEobwM=; b=PXHRcjgd4omUMqVA20w1Qyn/t4cjCl0oj5c8JdjBAA3qZF68g2wDcvab8V1P8neWFEcRtd nEnRV7j+YjIGU2dkfkwK5HZ0xqydB0xNaIhKCeZQOTQMOXQAyfX/pIj/TenhkAzRo/tkV8 UwA97Y2K5+nXV+Kc2gnbU3wl+l9Ugxfi6Nsvioigr0V/IwBBSVps4nRdwhUPefD8gAs1jD hcoLTPebNInOFfdHjObHl/uOV2lfznYPy5QVnmn86YDsI+L88Mfs+MlsIMqBSHZyNWLpkz fBr/C5K/0C0lX0+7bvH9Fh4Ync/++VNf0YIlzvEqjCZUQcG7GURkYC8BZcCoaQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1717952175; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=2BfnhShkMx76spM67lpVd99C3roozhsXHPVJTgEobwM=; b=zCYX5cs1LwLmwMr0V6KwDwpuptYlwCTrCGyHfrX9h80Y0rvp8vz12MjJGaBgj69cHEVDzW WObTgUpuulR8zxAg== To: Steven Rostedt Cc: Sam Sun , linux-kernel@vger.kernel.org, x86@kernel.org, syzkaller-bugs@googlegroups.com, peterz@infradead.org, jpoimboe@kernel.org, jbaron@akamai.com, ardb@kernel.org, mingo@redhat.com, Borislav Petkov , dave.hansen@linux.intel.com, hpa@zytor.com, xrivendell7@gmail.com, Greg Kroah-Hartman , Tejun Heo Subject: Re: [Linux kernel bug] WARNING in static_key_slow_inc_cpuslocked In-Reply-To: <87le3exfx2.ffs@tglx> References: <20240609090431.3af238bc@gandalf.local.home> <87o78axlbm.ffs@tglx> <20240609102530.0a292b07@rorschach.local.home> <87le3exfx2.ffs@tglx> Date: Sun, 09 Jun 2024 18:56:14 +0200 Message-ID: <87h6e2xdg1.ffs@tglx> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Sun, Jun 09 2024 at 18:02, Thomas Gleixner wrote: > On Sun, Jun 09 2024 at 10:25, Steven Rostedt wrote: > Well the bug is there to detect inconsistency and that clearly works :) > > But I clearly can't read, because the jump label operations are > serialized via jump_label_mutex. Hrm... Ok. Now I found if for real. It's in the jump label core: CPU0 CPU1 static_key_slow_dec() static_key_slow_try_dec() key->enabled == 1 val = atomic_fetch_add_unless(&key->enabled, -1, 1); if (val == 1) return false; jump_label_lock(); if (atomic_dec_and_test(&key->enabled)) { --> key->enabled == 0 __jump_label_update() static_key_slow_dec() static_key_slow_try_dec() key->enabled == 0 val = atomic_fetch_add_unless(&key->enabled, -1, 1); --> key->enabled == -1 <- FAIL static_key_slow_try_dec() is buggy. It needs similar logic as static_key_slow_try_inc() to work correctly. It's not only the 0, key->enabled can be -1 when the other CPU is in the slow path of enabling it. I'll send a patch after testing it. Thanks, tglx