From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796202051; b=4vmgj26Td0sB5/928hUQZC3gHKPFdvfwy9xnhPQ+DyoW7NKos2tfqrzdX/bX5Gie+N3w FdGQzVQ0Xo+IYRtDR3+qGjDKoxX1zMK/oFPwDpCsYwO6ubjD8YQWhyMeKGXq593bYRBMX k2ED2syDOtjSvg2wBY3GVOnYMo2tpIVEoEyEEBtfENVJQCamIQQswutQuruqtxkDFmV+1 8gybNAvE0Zen38+0va7/uEyQSTDICFiKBkRFHZUDG/r4ymuiP8U+LVBbE+hlhXqh/0Euk A+My538vyUCUg/2zk0Y0FOVZdG84xcBbYapKf28Chlp5QKpefVSbKkG3+nJRxNpJEpA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796202051; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=d4dnlKKh0NGHjwAE/six2rHrOnJdys8bxID5b+AfgCc=; b=thbSBYvWxLKYf0uCakl7tdDVGsmTNNfDxHzwzOMn89j6OWZSMHtLt5OIBsTlofrd5Zet bherXR2G17oG4U4QhoioOvEzCsynfkBynycjBA4pLY+1WqBCr1KZzordP9mPKLefb0Q0z gKUaBmnQI5CR+IksSv8306geH6sTU80Ymd14FkxF6xccTOPcxFsX0kRUUVuQtp9xHOyzZ vUuDCsBT5hEaXU2Ey6HZ7ldqWNWFKalRDvBFbrBDOLNjESP33szANyTMEECNMBlr9C2xm 1Mrtibcjr47GVqkLCX5SbQ9TMZldb4B0Drdq94U7M/LpjYPqTfNDh1ucMnS/E1FxMBw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=jii+yYZH; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 91302606A693; Wed, 2 Dec 2026 09:00:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=jii+yYZH Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FA1D1F00897; Wed, 2 Dec 2026 09:00:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796202051; bh=d4dnlKKh0NGHjwAE/six2rHrOnJdys8bxID5b+AfgCc=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=jii+yYZH8eR6ZKnCm3rBigUmOYjUDXX2c08BAY2Cxy1IIGycw5+9o3JjOrkqYm9T+ csBD5tyI5Bo7865H6G4tfBBhXiNHRXRjOcVkZVq6hP7T5/G+mcvX6Q9GAX55dVeGOn VCVOSkzpTca2s0DG3WxoH9vP4m9TjpxiXEWg/gEk= Date: Wed, 2 Dec 2026 10:00:47 +0100 From: Greg Kroah-Hartman To: Rahul Priolkar Cc: Jiri Slaby , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Dmitry Torokhov , linux-input@vger.kernel.org Subject: Re: [BUG] tty: sysrq: duplicate input handler registration on v7.4-rc5 Message-ID: <2026120242-corridor-chase-3d79@gregkh> References: <6b0fd458.e5646aef.135df4.76b7@mx.google.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6b0fd458.e5646aef.135df4.76b7@mx.google.com> On Wed, Dec 02, 2026 at 12:18:32AM -0800, Rahul Priolkar wrote: > Hello, > > On Linux v7.4-rc5 (fe6ff8d5d675), we observed duplicate entries for > the SysRq input handler on a defconfig-based x86_64 guest. In each > trial, we updated kernel.sysrq and checked /proc/bus/input/handlers > for exactly one SysRq entry. With concurrent updates, the handler > appeared 60 times in one listing after 98 trials. Updating kernel.sysrq > requires root in the initial user namespace. > > Our reading of drivers/tty/sysrq.c is that sysrq_toggle_support() can > register the static handler twice because the enable-state check and > registration are not serialized. Does that match your understanding of > the failure? > > A debug build with DEBUG_LIST and BUG_ON_DATA_CORRUPTION stopped in > the first run. The relevant frames were: > > kernel BUG at lib/list_debug.c:37! > RIP: 0010:__list_add_valid_or_report > input_register_handler > sysrq_register_handler > sysrq_sysctl_handler > > On the unmodified kernel, we ran the updates one at a time as a > control. All 3,000 trials showed exactly one handler entry. We then > tested an rc5 build that included a mutex around sysrq_toggle_support() > along with our other candidate fixes. Across 6,000 concurrent-update > trials, we saw no duplicate entries or kernel warnings. I can share > the candidate patch if useful. Always send a patch.