Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp1632216lqz; Mon, 1 Apr 2024 12:03:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUbrMS6HODVfhKcP8dTR9+PjUFVNRbIc0C9cK02lYDomEcLrIMc4RUZ3WqEYbbCC5KAlcgSRCkDMT+sT5Xc4/FMujhrK4vuPVur/3wJww== X-Google-Smtp-Source: AGHT+IFvW04+EhBOKl6aAIIJRNY+OXTQHvAGbYOkG4B+i26q7eOSabC0aTHoSbO+Edq/COBTVjBa X-Received: by 2002:a1f:cd07:0:b0:4d4:15d2:8b3b with SMTP id d7-20020a1fcd07000000b004d415d28b3bmr6499062vkg.9.1711998212169; Mon, 01 Apr 2024 12:03:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711998212; cv=pass; d=google.com; s=arc-20160816; b=pL9g/6ocLzj/RvX2WhV3ouDlKlXkSAqWp4+S59xeRDp3rkzPANu93FLHLC6/xZfBzd 3xI36gTD/fnYBI2QFuslZIvf/h5Vupf2Xiqy10FQmqpez8mTsPLtb7dPsSoRfET9slvH OZGiDiVOdDAp+JJ4LN+mUtJ+dK4mfh6Wz2L+GNIYis8Cl5bXb2ghnk3fTP2RZ6qWCfLZ lbPGouAuo93Ku2UxClSN1rl5cn3J64gRKFP3HiHDefsU3pd6Q8V/o1IBoHC9g+jExgx1 McZKoJITJtMYwaHPy4dzAsZsGtXAFsRAhmSHl0lYXvuMx9UKmdzdovQLw5QCIpwV/pKK SUrg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date; bh=lhdGgc4QnWsBvAqgS8LP2ChM2lORqrstctMYXaUejLM=; fh=zAUkigIGTTE7dxx1DJDd9oZxIPWaYZ/TEN69uW81kbs=; b=xyKGRP7F9QejKBZe7Do4OIJPovnW4/tsxqpCq3ccO0dZWBe139ZG3Q5Hg8IN/5Qxvy l/zRe7hqyMak3jtWTPrMaQZZz1gR79POjKNEG2stBy3INXwZ7BhuEDMSIGIJLUO558UG lLhhNlMje9O1g/02TRZOJxbmsRUvwP7VyGuLPwfE/AzHb14vhMit196u4gxlHwXqeZxB Q+gINCgdeWtZ6OlrMzP+RTDNDidz/4ZVTwOdmUI+898OJLobiBuj0uPTo2CbWpLvaCpA PyVhRrjTyzg6RKdps8NuTy0BcKULk4w2RrMde3dsnsqyPjzbrHBw3z+LXatUD7lfvjOx 8dJA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-126971-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-126971-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id ec14-20020a056122368e00b004c0012da595si1536048vkb.44.2024.04.01.12.03.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Apr 2024 12:03:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-126971-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-126971-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-126971-linux.lists.archive=gmail.com@vger.kernel.org" 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 C4B871C215AC for ; Mon, 1 Apr 2024 19:03:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1598851C2C; Mon, 1 Apr 2024 19:03:27 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 8E9AA4CE13; Mon, 1 Apr 2024 19:03:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711998206; cv=none; b=kYgkBMj0uvgMCdHUZhWdZx0r7RbtUladC91g8/+aQd4468nS0wTHAz779/35T7HLRLdacyeicg83cBBUfpf5XK8SJypBE3E5DkdRwP49AVtOVfMZXtaVeg7kr80OW790HqTNl71y5gjeLTHu8Y1+tZzTUG9Wjc5ZQNei4WAbg/E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711998206; c=relaxed/simple; bh=cExGv+FJE8UD0ApN8USdfLbi+102ExdtwV5jd7Wtldo=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=azmBbYhAhe9xc6Lbr2OjtIGfyHFR29V3geg8DbEaf07cX6phhQLFqitVNTXRXkiYQbrlaqEgyEs4p8WpEVzuUC/aCupLMurEPjhp/vqxXVP4zaUldlPqkkqrmwTX6+Z2iyH41WnAQ2a8iktSG0KKcPqWXB5Q/Je+pA46MzNKYgI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D252AC433C7; Mon, 1 Apr 2024 19:03:24 +0000 (UTC) Date: Mon, 1 Apr 2024 15:05:40 -0400 From: Steven Rostedt To: Nikita Kiryushin Cc: "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Mathieu Desnoyers , Lai Jiangshan , Zqiang , rcu@vger.kernel.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org Subject: Re: [PATCH v2] rcu: Fix buffer overlow in print_cpu_stall_info() Message-ID: <20240401150540.6dab14fc@gandalf.local.home> In-Reply-To: <20240401185454.361291-1-kiryushin@ancud.ru> References: <5a629a8e-5a70-4c7d-ab6a-f4a09e8c574c@paulmck-laptop> <20240401185454.361291-1-kiryushin@ancud.ru> X-Mailer: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Mon, 1 Apr 2024 21:54:54 +0300 Nikita Kiryushin wrote: > --- a/kernel/rcu/tree_stall.h > +++ b/kernel/rcu/tree_stall.h > @@ -504,7 +504,8 @@ static void print_cpu_stall_info(int cpu) > rcu_dynticks_in_eqs(rcu_dynticks_snap(cpu)); > rcuc_starved = rcu_is_rcuc_kthread_starving(rdp, &j); > if (rcuc_starved) > - sprintf(buf, " rcuc=%ld jiffies(starved)", j); > + /* %ld is intentional, for easier bug detection */ The above still has assumptions of what is going on for the reviewer. I would suggest something a bit more obvious like: /* Print signed value, as negative means it is likely a bug */ > + snprintf(buf, sizeof(buf), " rcuc=%ld jiffies(starved)", j); > pr_err("\t%d-%c%c%c%c: (%lu %s) idle=%04x/%ld/%#lx softirq=%u/%u fqs=%ld%s%s\n", -- Steve