Received: by 2002:a05:7412:8d1c:b0:fa:4c10:6cad with SMTP id bj28csp637888rdb; Wed, 17 Jan 2024 12:33:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IENZkJ6bxSrUU8zOj772+VB2FAYIvWPKWaR8zkRCBNMn7ZQN7fmP2wy7zR4AiBNYdAdibLB X-Received: by 2002:a05:6358:451:b0:175:a4ac:9664 with SMTP id 17-20020a056358045100b00175a4ac9664mr7860350rwe.7.1705523621158; Wed, 17 Jan 2024 12:33:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705523621; cv=pass; d=google.com; s=arc-20160816; b=npjBxALn0WopN4hgDJGd2hk9zUhO/bMvFbStXvlNnY43VM1J7bSUjUAJHPlp0lFb36 bb2SgGiiQd6O3ImuAOgjMBN6bJEfDiCmIG02JTAgE6MnhGIRL8jjGaiyGB7UR5+QHxiG dLDYd+FxllA4e77tW7qPxsIxral68d1HSd/5OsoVWH8NXfyyx5as0quI4ZoKsqUGgNJ6 sX7FjQJgJNuFYcMZNcf0Cresv0D6PSr1DM1tIcOJhQiCI1ljdaiXUFGCkadH8ey2aEfT gWAwPvczDoWwcPkiskrzQPcgOEoOwV0HH7GcPTKQ/wkGtBHoCWhvgb/y4bNPAC1Bi4DO 7e8w== 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:dkim-signature; bh=AqmufiTe2BBmyR5yUPzcNSTsh2jPVIHqVcVLhy/WCGI=; fh=OMmpGKykSZxJNs7d7KEw0j5ED5FVjGN8O6M6DPdkE20=; b=hZpWabwmmberXAMuoa2tJf4BLQWhqALCVjWjKe/Rd1K794Z47IvXKHzSBD9U97EmsZ DtqbY7YI9SmqdKPX6QEcbYjOV9fEr5r7Qhw9Yt5z1H1SnwPYHfAreRljJiX2u0IOhJId zFxGDV5WmZdCvqvIUV3C0r6wgq7N6VJYjdmIyMxmy8rBHZ4MVRPCYSjqnWbDzBKtuBMO x+waSzE0b4vN3C+PjyuzHpBHofZlhKi8YZFDnCCtueb6CikMAnoaVFeHpa1mS4MwR6SS DfHwkvfcBcVZTZmljCAkJqlDISG8ADmZ7RnKIdLNj7q+6Y+sOBFUwJywLZaRfVQnwCLw 6xog== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=0hO8Q94B; arc=pass (i=1 dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-29421-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29421-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id t10-20020a63460a000000b005c220a94525si154474pga.90.2024.01.17.12.33.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 12:33:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-29421-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=0hO8Q94B; arc=pass (i=1 dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-29421-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29421-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 1425AB21B7D for ; Wed, 17 Jan 2024 20:32:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0D461250F3; Wed, 17 Jan 2024 20:31:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="0hO8Q94B" 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 ECFAC25545; Wed, 17 Jan 2024 20:31:39 +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=1705523500; cv=none; b=FpzkRDe6NwgmRdm8M8Gfz35LqNp9+WhVv8lA+Mb9HfurGYpKWMDvaY9LKYJvtcFXppaYtp8nJQcisH6iWHd8sWRZ9BU9NH+1yT1UObA1oVHYUbJbIAzHZUilUsXbUxRcMHjSQ1UIdJ4AMRdeOYEA9KZHO2ek43rGwxDQp9dxOKQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705523500; c=relaxed/simple; bh=J0SBN0Y/pLqk/sWpUBOHmnTzq9HxFnlLlaoNkWWBkIs=; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-Id: In-Reply-To:References:X-Mailer:Mime-Version:Content-Type: Content-Transfer-Encoding; b=PWBnnoQhsn0l2R4iuZnraCibkr83Zq0Dt/zIjw2L2idT1RaF224mk2rgqPUYMUMU9iVEMPCvOkMVrSN9uZsUNH2FWE+DnKnb8KoUNX0KDhhaaKUS4dlk9qnEgbub9hxzrPd2ioKV8rqKtca37YfLF8ivOKF0AqDk4spQ5WKeihI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=0hO8Q94B; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F480C433C7; Wed, 17 Jan 2024 20:31:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1705523499; bh=J0SBN0Y/pLqk/sWpUBOHmnTzq9HxFnlLlaoNkWWBkIs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=0hO8Q94BlwPqxzmpVv9+KPO0TIz9O67uJl9NFfFvyGCrWYal+RncSmNx/cwhDQdFu nmqbjPDAN7ObyrMQyfIlgKAebjCsDy6kYi4byy5Pro7QjDSnjxXS0OD1HbBPNsoOXi HQUrGrkpv0LLvKmZlPHERPWSb/1rvM201uAbwLjk= Date: Wed, 17 Jan 2024 12:31:33 -0800 From: Andrew Morton To: Chen Zhongjin Cc: , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH] kprobes: Use synchronize_rcu_tasks_rude in kprobe_optimizer Message-Id: <20240117123133.2e40438936167e6a4aec8b16@linux-foundation.org> In-Reply-To: <20240117061636.288412-1-chenzhongjin@huawei.com> References: <20240117061636.288412-1-chenzhongjin@huawei.com> X-Mailer: Sylpheed 3.8.0beta1 (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 Wed, 17 Jan 2024 06:16:36 +0000 Chen Zhongjin wrote: > There is a deadlock scenario in kprobe_optimizer(): > > pid A pid B pid C > kprobe_optimizer() do_exit() perf_kprobe_init() > mutex_lock(&kprobe_mutex) exit_tasks_rcu_start() mutex_lock(&kprobe_mutex) > synchronize_rcu_tasks() zap_pid_ns_processes() // waiting kprobe_mutex > // waiting tasks_rcu_exit_srcu kernel_wait4() > // waiting pid C exit > > To avoid this deadlock loop, use synchronize_rcu_tasks_rude() in kprobe_optimizer() > rather than synchronize_rcu_tasks(). synchronize_rcu_tasks_rude() can also promise > that all preempted tasks have scheduled, but it will not wait tasks_rcu_exit_srcu. > > Signed-off-by: Chen Zhongjin Thanks. Should we backport this fix into earlier kernels? If so, are we able to identify a suitable Fixes: target?